FreeBSD Bugzilla – Attachment 139911 Details for
Bug 186294
calendar(1): calendar' preprocessor process comments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
patch3.txt
patch3.txt (text/plain), 1.69 KB, created by
oliver
on 2014-03-03 18:54:02 UTC
(
hide
)
Description:
patch3.txt
Filename:
MIME Type:
Creator:
oliver
Created:
2014-03-03 18:54:02 UTC
Size:
1.69 KB
patch
obsolete
>--- /usr/src/usr.bin/calendar/calcpp.c 2014-03-03 19:22:25.000000000 +0100 >+++ calcpp.c 2014-03-03 19:19:37.000000000 +0100 >@@ -52,6 +52,8 @@ > static void pushfp(FILE *fp); > static FILE *popfp(void); > static int tokenscpp(char *buf, char *string); >+static void striptags(char *buf, int size, const char *ts, const char *te); >+static void rmcomments(char *buf, int size); > > #define T_INVALID -1 > #define T_INCLUDE 0 >@@ -93,6 +95,7 @@ > return(fp); > } > } >+ rmcomments(buf,size); > switch (tokenscpp(buf, name)) { > case T_INCLUDE: > *buf = '\0'; >@@ -230,3 +233,48 @@ > return (1); > return (0); > } >+ >+ >+ >+ >+ >+static void >+rmcomments(char *buf, int size) >+{ >+ striptags(buf,size,"/*", "*/"); >+} >+ >+ >+static void >+striptags(char *buf, int size, const char *ts, const char *te) >+{ >+ static int cf = 0; /* carry flag */ >+ int te_len = strlen(te); /* end tag length */ >+ char *idx_ts = strstr(buf, ts); >+ char *idx_te = strstr(buf, te); >+ if (idx_ts == NULL && idx_te == NULL) { >+ if (cf == 0) >+ return; >+ else >+ *buf='\0'; >+ } else if (idx_ts != NULL && idx_te == NULL) { >+ if (cf == 0) { >+ cf = 1; >+ buf = idx_ts; >+ } >+ *buf = '\0'; >+ } else if (idx_ts != NULL && idx_te != NULL && cf == 0) { >+ if (idx_ts < idx_te) { >+ memmove(idx_ts, idx_te+te_len, >+ (buf+size)-(idx_ts+te_len)); >+ } else { >+ buf = idx_ts; >+ } >+ striptags(buf,size,ts,te); >+ } else if (idx_ts == NULL && idx_te != NULL && cf == 1) { >+ memmove(buf, idx_te+te_len, >+ (buf+size)-(idx_te+te_len)); >+ cf = 0; >+ } >+ return; >+}
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 Raw
Actions:
View
Attachments on
bug 186294
:
139908
|
139909
|
139910
| 139911