From 527e824293ee934ca5da0ef5424efe5ab7757248 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jul 2001 07:36:09 +0000 Subject: strchr and strrchr are macros when compiling with optimisation in gcc, so we can't redefine them. damn. (This used to be commit c41fc06376d1a2b83690612304e85010b5e5f3cf) --- source3/utils/make_printerdef.c | 14 +++++++------- source3/utils/nmblookup.c | 2 +- source3/utils/pdbedit.c | 4 ++-- source3/utils/rpccheck.c | 2 +- source3/utils/smbcacls.c | 10 +++++----- source3/utils/smbpasswd.c | 6 +++--- source3/utils/smbw_sample.c | 2 +- source3/utils/testparm.c | 8 ++++---- 8 files changed, 24 insertions(+), 24 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/make_printerdef.c b/source3/utils/make_printerdef.c index f403ee79bb..5107b124a7 100644 --- a/source3/utils/make_printerdef.c +++ b/source3/utils/make_printerdef.c @@ -47,8 +47,8 @@ static char *myfgets(char *s, int n, FILE *stream) int i; fgets(s,n,stream); - while ((LString1 = strchr(s,'%')) != NULL) { - if (!(LString2 = strchr(LString1+1,'%'))) break; + while ((LString1 = strchr_m(s,'%')) != NULL) { + if (!(LString2 = strchr_m(LString1+1,'%'))) break; *LString2 = '\0'; pstrcpy(String,LString1+1); i = 0; @@ -56,7 +56,7 @@ static char *myfgets(char *s, int n, FILE *stream) if (strncmp(sbuffer[i],String,strlen(String))==0) { pstrcpy(String,sbuffer[i]); - if ((temp = strchr(String,'=')) != NULL) ++temp; + if ((temp = strchr_m(String,'=')) != NULL) ++temp; pstrcpy(String,temp); break; } @@ -360,7 +360,7 @@ static void scan_copyfiles(FILE *fichier, char *chaine) * This may still be wrong but at least I get the same list * of files as seen on a printer test page. */ - part = strchr(buffer[i],'='); + part = strchr_m(buffer[i],'='); if (part) { /* * Case (1) eg. pscript.hlp = pscript.hl_ - chop after the first name. @@ -379,13 +379,13 @@ static void scan_copyfiles(FILE *fichier, char *chaine) break; } } else { - part = strchr(buffer[i],','); + part = strchr_m(buffer[i],','); if (part) { /* * Cases (2-4) */ - if ((mpart = strrchr(part+1,','))!=NULL) { + if ((mpart = strrchr_m(part+1,','))!=NULL) { /* * Second ',' - case 3 or 4. * Check if the last part is just a number, @@ -507,7 +507,7 @@ static void scan_short_desc(FILE *fichier, char *short_desc) temp = strtok(languagemonitor,","); if (*temp == '"') ++temp; pstrcpy(languagemonitor,temp); - if ((temp = strchr(languagemonitor,'"'))!=NULL) *temp = '\0'; + if ((temp = strchr_m(languagemonitor,'"'))!=NULL) *temp = '\0'; } if (i) fprintf(stderr,"End of section found\n"); diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c index adb75e6104..3e2f0610e6 100644 --- a/source3/utils/nmblookup.c +++ b/source3/utils/nmblookup.c @@ -303,7 +303,7 @@ int main(int argc,char *argv[]) } } - p = strchr(lookup,'#'); + p = strchr_m(lookup,'#'); if (p) { *p = '\0'; sscanf(++p,"%x",&lookup_type); diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c index 2b1dfe9f92..ec90e7ff1d 100644 --- a/source3/utils/pdbedit.c +++ b/source3/utils/pdbedit.c @@ -391,7 +391,7 @@ static int import_users (char *filename) sam_pwent.acct_ctrl = ACB_NORMAL; /* Get user name */ - p = (unsigned char *) strchr(linebuf, ':'); + p = (unsigned char *) strchr_m(linebuf, ':'); if (p == NULL) { fprintf (stderr, "Error: malformed password entry at line %d !!\n", line); @@ -478,7 +478,7 @@ static int import_users (char *filename) /* Get ACCT_CTRL field if any */ if (*p == '[') { - unsigned char *end_p = (unsigned char *)strchr((char *)p, ']'); + unsigned char *end_p = (unsigned char *)strchr_m((char *)p, ']'); sam_pwent.acct_ctrl = pdb_decode_acct_ctrl((char*)p); if(sam_pwent.acct_ctrl == 0) sam_pwent.acct_ctrl = ACB_NORMAL; diff --git a/source3/utils/rpccheck.c b/source3/utils/rpccheck.c index f504463027..1b00d528ac 100644 --- a/source3/utils/rpccheck.c +++ b/source3/utils/rpccheck.c @@ -46,7 +46,7 @@ main() prs_init(&ps, 1600, 4, ctx, MARSHALL); while (scanf("%s", s)!=-1) { - if (strlen(s)==2 && strchr(filter, *s)!=NULL && strchr(filter, *(s+1))!=NULL) { + if (strlen(s)==2 && strchr_m(filter, *s)!=NULL && strchr_m(filter, *(s+1))!=NULL) { d=strtol(s, NULL, 16); if(!prs_append_data(&ps, &d, 1)) printf("error while reading data\n"); diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 9edc35f800..20333f772b 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -234,7 +234,7 @@ static BOOL parse_ace(SEC_ACE *ace, char *str) struct perm_value *v; ZERO_STRUCTP(ace); - p = strchr(str,':'); + p = strchr_m(str,':'); if (!p) return False; *p = '\0'; p++; @@ -697,7 +697,7 @@ struct cli_state *connect_one(char *share) extern pstring global_myname; fstrcpy(server,share+2); - share = strchr(server,'\\'); + share = strchr_m(server,'\\'); if (!share) return NULL; *share = 0; share++; @@ -843,11 +843,11 @@ You can string acls together with spaces, commas or newlines\n\ if (getenv("USER")) { pstrcpy(username,getenv("USER")); - if ((p=strchr(username,'%'))) { + if ((p=strchr_m(username,'%'))) { *p = 0; pstrcpy(password,p+1); got_pass = True; - memset(strchr(getenv("USER"), '%') + 1, 'X', + memset(strchr_m(getenv("USER"), '%') + 1, 'X', strlen(password)); } } @@ -856,7 +856,7 @@ You can string acls together with spaces, commas or newlines\n\ switch (opt) { case 'U': pstrcpy(username,optarg); - p = strchr(username,'%'); + p = strchr_m(username,'%'); if (p) { *p = 0; pstrcpy(password, p+1); diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c index ebc588eb64..a10e757910 100644 --- a/source3/utils/smbpasswd.c +++ b/source3/utils/smbpasswd.c @@ -603,11 +603,11 @@ static int process_root(int argc, char *argv[]) fstrcpy(user_name, optarg); - if ((lp = strchr(user_name, '%'))) { + if ((lp = strchr_m(user_name, '%'))) { *lp = 0; fstrcpy(user_password, lp + 1); got_pass = True; - memset(strchr(optarg, '%') + 1, 'X', + memset(strchr_m(optarg, '%') + 1, 'X', strlen(user_password)); } @@ -920,7 +920,7 @@ int main(int argc, char **argv) if (!*global_myname) { char *p; fstrcpy(global_myname, myhostname()); - p = strchr(global_myname, '.' ); + p = strchr_m(global_myname, '.' ); if (p) *p = 0; } strupper(global_myname); diff --git a/source3/utils/smbw_sample.c b/source3/utils/smbw_sample.c index 7d6eb7f353..6a8fbf116b 100644 --- a/source3/utils/smbw_sample.c +++ b/source3/utils/smbw_sample.c @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) smbw_setshared("DEBUG", optarg); break; case 'U': - p = strchr(optarg,'%'); + p = strchr_m(optarg,'%'); if (p) { *p=0; smbw_setshared("PASSWORD",p+1); diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index c9080e1994..9b19a6c0fd 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -240,8 +240,8 @@ int main(int argc, char *argv[]) int i; if(deny_list) { for (i=0; deny_list[i]; i++) { - char *hasstar = strchr(deny_list[i], '*'); - char *hasquery = strchr(deny_list[i], '?'); + char *hasstar = strchr_m(deny_list[i], '*'); + char *hasquery = strchr_m(deny_list[i], '?'); if(hasstar || hasquery) { printf("Invalid character %c in hosts deny list (%s) for service %s.\n", hasstar ? *hasstar : *hasquery, deny_list[i], lp_servicename(s) ); @@ -251,8 +251,8 @@ int main(int argc, char *argv[]) if(allow_list) { for (i=0; allow_list[i]; i++) { - char *hasstar = strchr(allow_list[i], '*'); - char *hasquery = strchr(allow_list[i], '?'); + char *hasstar = strchr_m(allow_list[i], '*'); + char *hasquery = strchr_m(allow_list[i], '?'); if(hasstar || hasquery) { printf("Invalid character %c in hosts allow list (%s) for service %s.\n", hasstar ? *hasstar : *hasquery, allow_list[i], lp_servicename(s) ); -- cgit