FreeBSD Bugzilla – Attachment 225624 Details for
Bug 256455
calendar(1) always considers // as the start of a comment
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Ignore // within words to allow URLs in calendar entries
2.diff (text/plain), 1.16 KB, created by
Stefan Eßer
on 2021-06-07 13:54:48 UTC
(
hide
)
Description:
Ignore // within words to allow URLs in calendar entries
Filename:
MIME Type:
Creator:
Stefan Eßer
Created:
2021-06-07 13:54:48 UTC
Size:
1.16 KB
patch
obsolete
>--- usr.bin/calendar/io.c >+++ usr.bin/calendar/io.c >@@ -405,7 +405,7 @@ cal_parse(FILE *in, FILE *out) > { > char *mylocale = NULL; > char *line = NULL; >- char *buf; >+ char *buf, *bufp; > size_t linecap = 0; > ssize_t linelen; > ssize_t l; >@@ -443,21 +443,27 @@ cal_parse(FILE *in, FILE *out) > } > } > if (!incomment) { >+ bufp = buf; > do { >- c = strstr(buf, "//"); >- cc = strstr(buf, "/*"); >+ c = strstr(bufp, "//"); >+ cc = strstr(bufp, "/*"); > if (c != NULL && (cc == NULL || c - cc < 0)) { >- /* single line comment */ >- *c = '\0'; >- linelen = c - buf; >- break; >+ bufp = c + 2; >+ /* ignore "//" within string to allow it in an URL */ >+ if (c == buf || isspace(c[-1])) { >+ /* single line comment */ >+ *c = '\0'; >+ linelen = c - buf; >+ break; >+ } > } else if (cc != NULL) { > c = strstr(cc + 2, "*/"); >- if (c != NULL) { >+ if (c != NULL) { // 'a /* b */ c' -- cc=2, c=7+2 > /* multi-line comment ending on same line */ > c += 2; > memmove(cc, c, buf + linelen + 1 - c); > linelen -= c - cc; >+ bufp = cc; > } else { > /* multi-line comment */ > *cc = '\0';
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 256455
: 225624