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/printing/lpq_parse.c | 30 +++++++++++++++--------------- source3/printing/nt_printing.c | 26 +++++++++++++------------- source3/printing/pcap.c | 14 +++++++------- source3/printing/print_generic.c | 2 +- source3/printing/print_svid.c | 8 ++++---- 5 files changed, 40 insertions(+), 40 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/lpq_parse.c b/source3/printing/lpq_parse.c index a143709570..90d8499595 100644 --- a/source3/printing/lpq_parse.c +++ b/source3/printing/lpq_parse.c @@ -277,7 +277,7 @@ static BOOL parse_lpq_lprng(char *line,print_queue_struct *buf,BOOL first) * for the current user on the taskbar. Plop in a null. */ - if ((cptr = strchr(buf->user,'@')) != NULL) { + if ((cptr = strchr_m(buf->user,'@')) != NULL) { *cptr = '\0'; } @@ -342,13 +342,13 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first) if (!isdigit((int)*tok[1]) || !isdigit((int)*tok[4])) return(False); buf->size = atoi(tok[4]) * 1024; /* if the fname contains a space then use STDIN */ - if (strchr(tok[2],' ')) + if (strchr_m(tok[2],' ')) fstrcpy(tok[2],"STDIN"); /* only take the last part of the filename */ { fstring tmp; - char *p = strrchr(tok[2],'/'); + char *p = strrchr_m(tok[2],'/'); if (p) { fstrcpy(tmp,p+1); @@ -376,13 +376,13 @@ static BOOL parse_lpq_aix(char *line,print_queue_struct *buf,BOOL first) if (!isdigit((int)*tok[3]) || !isdigit((int)*tok[8])) return(False); buf->size = atoi(tok[8]) * 1024; /* if the fname contains a space then use STDIN */ - if (strchr(tok[4],' ')) + if (strchr_m(tok[4],' ')) fstrcpy(tok[4],"STDIN"); /* only take the last part of the filename */ { fstring tmp; - char *p = strrchr(tok[4],'/'); + char *p = strrchr_m(tok[4],'/'); if (p) { fstrcpy(tmp,p+1); @@ -453,7 +453,7 @@ static BOOL parse_lpq_hpux(char * line, print_queue_struct *buf, BOOL first) if (!isdigit((int)*tok[1])) return(False); /* if the fname contains a space then use STDIN */ - if (strchr(tok[0],' ')) + if (strchr_m(tok[0],' ')) fstrcpy(tok[0],"STDIN"); buf->size = atoi(tok[1]); @@ -564,7 +564,7 @@ static BOOL parse_lpq_sysv(char *line,print_queue_struct *buf,BOOL first) return(False); /* if the user contains a ! then trim the first part of it */ - if ((p=strchr(tok[2],'!'))) { + if ((p=strchr_m(tok[2],'!'))) { fstring tmp; fstrcpy(tmp,p+1); fstrcpy(tok[2],tmp); @@ -627,7 +627,7 @@ static BOOL parse_lpq_qnx(char *line,print_queue_struct *buf,BOOL first) /* only take the last part of the filename */ { fstring tmp; - char *p = strrchr(tok[6],'/'); + char *p = strrchr_m(tok[6],'/'); if (p) { fstrcpy(tmp,p+1); @@ -685,13 +685,13 @@ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first) return(False); /* if the fname contains a space then use STDIN */ - if (strchr(tok[6],' ')) + if (strchr_m(tok[6],' ')) fstrcpy(tok[6],"STDIN"); /* only take the last part of the filename */ { fstring tmp; - char *p = strrchr(tok[6],'/'); + char *p = strrchr_m(tok[6],'/'); if (p) { fstrcpy(tmp,p+1); @@ -703,9 +703,9 @@ static BOOL parse_lpq_plp(char *line,print_queue_struct *buf,BOOL first) buf->job = atoi(tok[4]); buf->size = atoi(tok[7]); - if (strchr(tok[7],'K')) + if (strchr_m(tok[7],'K')) buf->size *= 1024; - if (strchr(tok[7],'M')) + if (strchr_m(tok[7],'M')) buf->size *= 1024*1024; buf->status = strequal(tok[0],"active")?LPQ_PRINTING:LPQ_QUEUED; @@ -841,8 +841,8 @@ static BOOL parse_lpq_nt(char *line,print_queue_struct *buf,BOOL first) return(False); /* Just want the first word in the owner field - the username */ - if (strchr(parse_line.owner, ' ')) - *(strchr(parse_line.owner, ' ')) = '\0'; + if (strchr_m(parse_line.owner, ' ')) + *(strchr_m(parse_line.owner, ' ')) = '\0'; else parse_line.space1 = '\0'; @@ -1053,7 +1053,7 @@ BOOL parse_lpq_entry(int snum,char *line, /* We don't want the newline in the status message. */ { - char *p = strchr(line,'\n'); + char *p = strchr_m(line,'\n'); if (p) *p = 0; } diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index d099c29cc1..d742773d27 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -673,29 +673,29 @@ static uint32 clean_up_driver_struct_level_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *dri * or worse c:\windows\system\driver.dll ! */ /* using an intermediate string to not have overlaping memcpy()'s */ - if ((p = strrchr(driver->driverpath,'\\')) != NULL) { + if ((p = strrchr_m(driver->driverpath,'\\')) != NULL) { fstrcpy(new_name, p+1); fstrcpy(driver->driverpath, new_name); } - if ((p = strrchr(driver->datafile,'\\')) != NULL) { + if ((p = strrchr_m(driver->datafile,'\\')) != NULL) { fstrcpy(new_name, p+1); fstrcpy(driver->datafile, new_name); } - if ((p = strrchr(driver->configfile,'\\')) != NULL) { + if ((p = strrchr_m(driver->configfile,'\\')) != NULL) { fstrcpy(new_name, p+1); fstrcpy(driver->configfile, new_name); } - if ((p = strrchr(driver->helpfile,'\\')) != NULL) { + if ((p = strrchr_m(driver->helpfile,'\\')) != NULL) { fstrcpy(new_name, p+1); fstrcpy(driver->helpfile, new_name); } if (driver->dependentfiles) { for (i=0; *driver->dependentfiles[i]; i++) { - if ((p = strrchr(driver->dependentfiles[i],'\\')) != NULL) { + if ((p = strrchr_m(driver->dependentfiles[i],'\\')) != NULL) { fstrcpy(new_name, p+1); fstrcpy(driver->dependentfiles[i], new_name); } @@ -738,29 +738,29 @@ static uint32 clean_up_driver_struct_level_6(NT_PRINTER_DRIVER_INFO_LEVEL_6 *dri * or worse c:\windows\system\driver.dll ! */ /* using an intermediate string to not have overlaping memcpy()'s */ - if ((p = strrchr(driver->driverpath,'\\')) != NULL) { + if ((p = strrchr_m(driver->driverpath,'\\')) != NULL) { fstrcpy(new_name, p+1); fstrcpy(driver->driverpath, new_name); } - if ((p = strrchr(driver->datafile,'\\')) != NULL) { + if ((p = strrchr_m(driver->datafile,'\\')) != NULL) { fstrcpy(new_name, p+1); fstrcpy(driver->datafile, new_name); } - if ((p = strrchr(driver->configfile,'\\')) != NULL) { + if ((p = strrchr_m(driver->configfile,'\\')) != NULL) { fstrcpy(new_name, p+1); fstrcpy(driver->configfile, new_name); } - if ((p = strrchr(driver->helpfile,'\\')) != NULL) { + if ((p = strrchr_m(driver->helpfile,'\\')) != NULL) { fstrcpy(new_name, p+1); fstrcpy(driver->helpfile, new_name); } if (driver->dependentfiles) { for (i=0; *driver->dependentfiles[i]; i++) { - if ((p = strrchr(driver->dependentfiles[i],'\\')) != NULL) { + if ((p = strrchr_m(driver->dependentfiles[i],'\\')) != NULL) { fstrcpy(new_name, p+1); fstrcpy(driver->dependentfiles[i], new_name); } @@ -2292,7 +2292,7 @@ static void map_to_os2_driver(fstring drivername) for( i = 0; i < numlines; i++) { char *nt_name = lines[i]; - char *os2_name = strchr(nt_name,'='); + char *os2_name = strchr_m(nt_name,'='); if (!os2_name) continue; @@ -2302,7 +2302,7 @@ static void map_to_os2_driver(fstring drivername) while (isspace(*nt_name)) nt_name++; - if (!*nt_name || strchr("#;",*nt_name)) + if (!*nt_name || strchr_m("#;",*nt_name)) continue; { @@ -3189,7 +3189,7 @@ BOOL nt_printing_getsec(TALLOC_CTX *ctx, char *printername, SEC_DESC_BUF **secde fstring key; char *temp; - if ((temp = strchr(printername + 2, '\\'))) { + if ((temp = strchr_m(printername + 2, '\\'))) { printername = temp + 1; } diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c index 1f909d3533..313e17fb1c 100644 --- a/source3/printing/pcap.c +++ b/source3/printing/pcap.c @@ -122,7 +122,7 @@ static void ScanQconfig_fn(char *psz,void (*fn)(char *, char *)) { case 0: /* locate an entry */ if (*line == '\t' || *line == ' ') continue; - if ((p=strchr(line,':'))) + if ((p=strchr_m(line,':'))) { *p = '\0'; p = strtok(line,":"); @@ -297,14 +297,14 @@ BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname) continue; /* now we have a real printer line - cut it off at the first : */ - p = strchr(line,':'); + p = strchr_m(line,':'); if (p) *p = 0; /* now just check if the name is in the list */ /* NOTE: I avoid strtok as the fn calling this one may be using it */ for (p=line; p; p=q) { - if ((q = strchr(p,'|'))) *q++ = 0; + if ((q = strchr_m(p,'|'))) *q++ = 0; if (strequal(p,pszPrintername)) { @@ -378,7 +378,7 @@ void pcap_printer_fn(void (*fn)(char *, char *)) continue; /* now we have a real printer line - cut it off at the first : */ - p = strchr(line,':'); + p = strchr_m(line,':'); if (p) *p = 0; /* now find the most likely printer name and comment @@ -388,9 +388,9 @@ void pcap_printer_fn(void (*fn)(char *, char *)) for (p=line; p; p=q) { BOOL has_punctuation; - if ((q = strchr(p,'|'))) *q++ = 0; + if ((q = strchr_m(p,'|'))) *q++ = 0; - has_punctuation = (strchr(p,' ') || strchr(p,'\t') || strchr(p,'(') || strchr(p,')')); + has_punctuation = (strchr_m(p,' ') || strchr_m(p,'\t') || strchr_m(p,'(') || strchr_m(p,')')); if (strlen(p)>strlen(comment) && has_punctuation) { @@ -405,7 +405,7 @@ void pcap_printer_fn(void (*fn)(char *, char *)) continue; } - if (!strchr(comment,' ') && + if (!strchr_m(comment,' ') && strlen(p) > strlen(comment)) { StrnCpy(comment,p,sizeof(comment)-1); diff --git a/source3/printing/print_generic.c b/source3/printing/print_generic.c index 3e5753583e..bc9751a653 100644 --- a/source3/printing/print_generic.c +++ b/source3/printing/print_generic.c @@ -157,7 +157,7 @@ static int generic_job_submit(int snum, struct printjob *pjob) return 0; pstrcpy(print_directory, pjob->filename); - p = strrchr(print_directory,'/'); + p = strrchr_m(print_directory,'/'); if (!p) return 0; *p++ = 0; diff --git a/source3/printing/print_svid.c b/source3/printing/print_svid.c index 301f388671..22ddbe70b9 100644 --- a/source3/printing/print_svid.c +++ b/source3/printing/print_svid.c @@ -59,8 +59,8 @@ static void populate_printers(void) char *buf = lines[i]; /* eat "system/device for " */ - if (((tmp = strchr(buf, ' ')) == NULL) || - ((tmp = strchr(++tmp, ' ')) == NULL)) + if (((tmp = strchr_m(buf, ' ')) == NULL) || + ((tmp = strchr_m(++tmp, ' ')) == NULL)) continue; /* @@ -68,13 +68,13 @@ static void populate_printers(void) */ if(!strncmp("for ",++tmp,4)) { - tmp=strchr(tmp, ' '); + tmp=strchr_m(tmp, ' '); tmp++; } name = tmp; /* truncate the ": ..." */ - if ((tmp = strchr(name, ':')) != NULL) + if ((tmp = strchr_m(name, ':')) != NULL) *tmp = '\0'; /* add it to the cache */ -- cgit