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/client/client.c | 22 +++++++++++----------- source3/client/clitar.c | 12 ++++++------ source3/client/smbmount.c | 16 ++++++++-------- source3/client/smbspool.c | 8 ++++---- 4 files changed, 29 insertions(+), 29 deletions(-) (limited to 'source3/client') diff --git a/source3/client/client.c b/source3/client/client.c index ccbeb72e81..479c4f764f 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -479,7 +479,7 @@ static void do_list_helper(file_info *f, const char *mask, void *state) char *p; pstrcpy(mask2, mask); - p = strrchr(mask2,'\\'); + p = strrchr_m(mask2,'\\'); if (!p) return; p[1] = 0; pstrcat(mask2, f->name); @@ -1354,7 +1354,7 @@ static void cmd_print(void) } pstrcpy(rname,lname); - p = strrchr(rname,'/'); + p = strrchr_m(rname,'/'); if (p) { slprintf(rname, sizeof(rname)-1, "%s-%d", p+1, (int)sys_getpid()); } @@ -1813,7 +1813,7 @@ static void process_command_string(char *cmd) fstring tok; int i; - if ((p = strchr(cmd, ';')) == 0) { + if ((p = strchr_m(cmd, ';')) == 0) { strncpy(line, cmd, 999); line[1000] = '\0'; cmd += strlen(cmd); @@ -1971,7 +1971,7 @@ struct cli_state *do_connect(const char *server, const char *share) sharename = servicename; if (*sharename == '\\') { server = sharename+2; - sharename = strchr(server,'\\'); + sharename = strchr_m(server,'\\'); if (!sharename) return NULL; *sharename = 0; sharename++; @@ -2003,7 +2003,7 @@ struct cli_state *do_connect(const char *server, const char *share) called.name, cli_errstr(c))); cli_shutdown(c); free(c); - if ((p=strchr(called.name, '.'))) { + if ((p=strchr_m(called.name, '.'))) { *p = 0; goto again; } @@ -2350,11 +2350,11 @@ static int do_message_op(void) /* modification to support userid%passwd syntax in the USER var 25.Aug.97, jdblair@uab.edu */ - if ((p=strchr(username,'%'))) { + if ((p=strchr_m(username,'%'))) { *p = 0; pstrcpy(password,p+1); got_pass = True; - memset(strchr(getenv("USER"),'%')+1,'X',strlen(password)); + memset(strchr_m(getenv("USER"),'%')+1,'X',strlen(password)); } strupper(username); } @@ -2471,11 +2471,11 @@ static int do_message_op(void) { char *lp; pstrcpy(username,optarg); - if ((lp=strchr(username,'%'))) { + if ((lp=strchr_m(username,'%'))) { *lp = 0; pstrcpy(password,lp+1); got_pass = True; - memset(strchr(optarg,'%')+1,'X',strlen(password)); + memset(strchr_m(optarg,'%')+1,'X',strlen(password)); } } break; @@ -2512,7 +2512,7 @@ static int do_message_op(void) /* break up the line into parameter & value. will need to eat a little whitespace possibly */ param = buf; - if (!(ptr = strchr (buf, '='))) + if (!(ptr = strchr_m (buf, '='))) continue; val = ptr+1; *ptr = '\0'; @@ -2589,7 +2589,7 @@ static int do_message_op(void) return do_tar_op(base_directory); } - if ((p=strchr(query_host,'#'))) { + if ((p=strchr_m(query_host,'#'))) { *p = 0; p++; sscanf(p, "%x", &name_type); diff --git a/source3/client/clitar.c b/source3/client/clitar.c index 8f935da4e0..d28e652b35 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -533,7 +533,7 @@ static BOOL ensurepath(char *fname) safe_strcpy(ffname, fname, strlen(fname)); /* do a `basename' on ffname, so don't try and make file name directory */ - if ((basehack=strrchr(ffname, '\\')) == NULL) + if ((basehack=strrchr_m(ffname, '\\')) == NULL) return True; else *basehack='\0'; @@ -1451,7 +1451,7 @@ int process_tar(void) *(cliplist[i]+strlen(cliplist[i])-1)='\0'; } - if (strrchr(cliplist[i], '\\')) { + if (strrchr_m(cliplist[i], '\\')) { pstring saved_dir; safe_strcpy(saved_dir, cur_dir, sizeof(pstring)); @@ -1463,7 +1463,7 @@ int process_tar(void) safe_strcat(tarmac, cliplist[i], sizeof(pstring)); } safe_strcpy(cur_dir, tarmac, sizeof(pstring)); - *(strrchr(cur_dir, '\\')+1)='\0'; + *(strrchr_m(cur_dir, '\\')+1)='\0'; DEBUG(5, ("process_tar, do_list with tarmac: %s\n", tarmac)); do_list(tarmac,attribute,do_tar, False, True); @@ -1514,13 +1514,13 @@ static int clipfind(char **aret, int ret, char *tok) if (aret==NULL) return 0; /* ignore leading slashes or dots in token */ - while(strchr("/\\.", *tok)) tok++; + while(strchr_m("/\\.", *tok)) tok++; while(ret--) { char *pkey=*aret++; /* ignore leading slashes or dots in list */ - while(strchr("/\\.", *pkey)) pkey++; + while(strchr_m("/\\.", *pkey)) pkey++; if (!strslashcmp(pkey, tok)) return 1; } @@ -1604,7 +1604,7 @@ static int read_inclusion_file(char *filename) } else { unfixtarname(tmpstr, p, strlen(p) + 1, True); cliplist[i] = tmpstr; - if ((p = strchr(p, '\000')) == NULL) { + if ((p = strchr_m(p, '\000')) == NULL) { DEBUG(0,("INTERNAL ERROR: inclusion_buffer is of unexpected contents.\n")); abort(); } diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index 076be0ccb8..d0c18e6134 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -130,7 +130,7 @@ static struct cli_state *do_connection(char *service) } pstrcpy(server, service+2); - share = strchr(server,'\\'); + share = strchr_m(server,'\\'); if (!share) { usage(); exit(1); @@ -164,7 +164,7 @@ static struct cli_state *do_connection(char *service) getpid(), called.name, cli_errstr(c))); cli_shutdown(c); free(c); - if ((p=strchr(called.name, '.'))) { + if ((p=strchr_m(called.name, '.'))) { *p = 0; goto again; } @@ -715,7 +715,7 @@ static void parse_mount_smb(int argc, char **argv) */ for (opts = strtok(optarg, ","); opts; opts = strtok(NULL, ",")) { DEBUG(3, ("opts: %s\n", opts)); - if ((opteq = strchr(opts, '='))) { + if ((opteq = strchr_m(opts, '='))) { val = atoi(opteq + 1); *opteq = '\0'; @@ -723,13 +723,13 @@ static void parse_mount_smb(int argc, char **argv) !strcmp(opts, "logon")) { char *lp; pstrcpy(username,opteq+1); - if ((lp=strchr(username,'%'))) { + if ((lp=strchr_m(username,'%'))) { *lp = 0; pstrcpy(password,lp+1); got_pass = True; - memset(strchr(opteq+1,'%')+1,'X',strlen(password)); + memset(strchr_m(opteq+1,'%')+1,'X',strlen(password)); } - if ((lp=strchr(username,'/'))) { + if ((lp=strchr_m(username,'/'))) { *lp = 0; pstrcpy(workgroup,lp+1); } @@ -824,11 +824,11 @@ static void parse_mount_smb(int argc, char **argv) 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',strlen(password)); + memset(strchr_m(getenv("USER"),'%')+1,'X',strlen(password)); } strupper(username); } diff --git a/source3/client/smbspool.c b/source3/client/smbspool.c index 1c85de11dd..0c21399e96 100644 --- a/source3/client/smbspool.c +++ b/source3/client/smbspool.c @@ -134,7 +134,7 @@ static int smb_print(struct cli_state *, char *, FILE *); * Extract the destination from the URI... */ - if ((sep = strrchr(uri, '@')) != NULL) + if ((sep = strrchr_m(uri, '@')) != NULL) { username = uri + 6; *sep++ = '\0'; @@ -145,7 +145,7 @@ static int smb_print(struct cli_state *, char *, FILE *); * Extract password as needed... */ - if ((password = strchr(username, ':')) != NULL) + if ((password = strchr_m(username, ':')) != NULL) *password++ = '\0'; else password = ""; @@ -157,7 +157,7 @@ static int smb_print(struct cli_state *, char *, FILE *); server = uri + 6; } - if ((sep = strchr(server, '/')) == NULL) + if ((sep = strchr_m(server, '/')) == NULL) { fputs("ERROR: Bad URI - need printer name!\n", stderr); return (1); @@ -166,7 +166,7 @@ static int smb_print(struct cli_state *, char *, FILE *); *sep++ = '\0'; printer = sep; - if ((sep = strchr(printer, '/')) != NULL) + if ((sep = strchr_m(printer, '/')) != NULL) { /* * Convert to smb://[username:password@]workgroup/server/printer... -- cgit