diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-07-04 07:36:09 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-07-04 07:36:09 +0000 |
commit | 527e824293ee934ca5da0ef5424efe5ab7757248 (patch) | |
tree | dd86fab3b0ba9cdbd86661dfae562fa123a8f53c /source3/lib | |
parent | 87fbb7092b8f8b2f0db0f361c3d625e19de57cd9 (diff) | |
download | samba-527e824293ee934ca5da0ef5424efe5ab7757248.tar.gz samba-527e824293ee934ca5da0ef5424efe5ab7757248.tar.bz2 samba-527e824293ee934ca5da0ef5424efe5ab7757248.zip |
strchr and strrchr are macros when compiling with optimisation in gcc, so we can't redefine them. damn.
(This used to be commit c41fc06376d1a2b83690612304e85010b5e5f3cf)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/access.c | 10 | ||||
-rw-r--r-- | source3/lib/cmd_interp.c | 12 | ||||
-rw-r--r-- | source3/lib/debug.c | 2 | ||||
-rw-r--r-- | source3/lib/interface.c | 2 | ||||
-rw-r--r-- | source3/lib/substitute.c | 8 | ||||
-rw-r--r-- | source3/lib/system.c | 4 | ||||
-rw-r--r-- | source3/lib/username.c | 8 | ||||
-rw-r--r-- | source3/lib/util.c | 20 | ||||
-rw-r--r-- | source3/lib/util_file.c | 2 | ||||
-rw-r--r-- | source3/lib/util_sid.c | 4 | ||||
-rw-r--r-- | source3/lib/util_sock.c | 2 | ||||
-rw-r--r-- | source3/lib/util_str.c | 22 |
12 files changed, 48 insertions, 48 deletions
diff --git a/source3/lib/access.c b/source3/lib/access.c index c32b0b7c6c..99f3cc49b5 100644 --- a/source3/lib/access.c +++ b/source3/lib/access.c @@ -97,19 +97,19 @@ static int string_match(char *tok,char *s, char *invalid_char) } else if (strcasecmp(tok, "FAIL") == 0) { /* fail: match any */ return (FAIL); } else if (strcasecmp(tok, "LOCAL") == 0) { /* local: no dots */ - if (strchr(s, '.') == 0 && strcasecmp(s, "unknown") != 0) + if (strchr_m(s, '.') == 0 && strcasecmp(s, "unknown") != 0) return (True); } else if (!strcasecmp(tok, s)) { /* match host name or address */ return (True); } else if (tok[(tok_len = strlen(tok)) - 1] == '.') { /* network */ if (strncmp(tok, s, tok_len) == 0) return (True); - } else if ((cut = strchr(tok, '/')) != 0) { /* netnumber/netmask */ + } else if ((cut = strchr_m(tok, '/')) != 0) { /* netnumber/netmask */ if (isdigit((int)s[0]) && masked_match(tok, cut, s)) return (True); - } else if (strchr(tok, '*') != 0) { + } else if (strchr_m(tok, '*') != 0) { *invalid_char = '*'; - } else if (strchr(tok, '?') != 0) { + } else if (strchr_m(tok, '?') != 0) { *invalid_char = '?'; } return (False); @@ -252,7 +252,7 @@ static BOOL only_ipaddrs_in_list(char** list) * was a network/netmask pair. Only network/netmask pairs * have a '/' in them */ - if ((p=strchr(*list, '/')) == NULL) + if ((p=strchr_m(*list, '/')) == NULL) { only_ip = False; DEBUG(3,("only_ipaddrs_in_list: list has non-ip address (%s)\n", *list)); diff --git a/source3/lib/cmd_interp.c b/source3/lib/cmd_interp.c index ef6f94bd49..292f0e9e9e 100644 --- a/source3/lib/cmd_interp.c +++ b/source3/lib/cmd_interp.c @@ -365,7 +365,7 @@ static uint32 process(struct client_info *info, char *cmd_str) { char *p; - if ((p = strchr(cmd, ';')) == 0) + if ((p = strchr_m(cmd, ';')) == 0) { strncpy(line, cmd, 999); line[1000] = '\0'; @@ -702,11 +702,11 @@ static uint32 cmd_use(struct client_info *info, int argc, char *argv[]) { char *lp; pstrcpy(usr.ntc.user_name, optarg); - if ((lp = strchr(usr.ntc.user_name, '%'))) + if ((lp = strchr_m(usr.ntc.user_name, '%'))) { *lp = 0; pstrcpy(password, lp + 1); - memset(strchr(optarg, '%') + 1, 'X', + memset(strchr_m(optarg, '%') + 1, 'X', strlen(password)); got_pwd = True; } @@ -1012,7 +1012,7 @@ static uint32 cmd_set(CLIENT_INFO *info, int argc, char *argv[]) char *lp; cmd_set_options |= CMD_USER; pstrcpy(usr.ntc.user_name, optarg); - if ((lp = strchr(usr.ntc.user_name, '%'))) + if ((lp = strchr_m(usr.ntc.user_name, '%'))) { *lp = 0; pstrcpy(password, lp + 1); @@ -1241,11 +1241,11 @@ static void read_user_env(struct ntuser_creds *u) /* modification to support userid%passwd syntax in the USER var 25.Aug.97, jdblair@uab.edu */ - if ((p = strchr(u->user_name, '%'))) + if ((p = strchr_m(u->user_name, '%'))) { *p = 0; pstrcpy(password, p + 1); - memset(strchr(getenv("USER"), '%') + 1, 'X', + memset(strchr_m(getenv("USER"), '%') + 1, 'X', strlen(password)); } } diff --git a/source3/lib/debug.c b/source3/lib/debug.c index 06092c6a35..27d5e55dc0 100644 --- a/source3/lib/debug.c +++ b/source3/lib/debug.c @@ -312,7 +312,7 @@ void setup_logging(char *pname, BOOL interactive) } #ifdef WITH_SYSLOG else { - char *p = strrchr( pname,'/' ); + char *p = strrchr_m( pname,'/' ); if (p) pname = p + 1; #ifdef LOG_DAEMON diff --git a/source3/lib/interface.c b/source3/lib/interface.c index e16afa45af..269e0fa85b 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -120,7 +120,7 @@ static void interpret_interface(char *token) if (added) return; /* maybe it is a DNS name */ - p = strchr(token,'/'); + p = strchr_m(token,'/'); if (!p) { ip = *interpret_addr2(token); for (i=0;i<total_probed;i++) { diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index 25be4b030f..7f597d37f2 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -56,7 +56,7 @@ static size_t expand_env_var(char *p, int len) * Look for the terminating ')'. */ - if ((q = strchr(p,')')) == NULL) { + if ((q = strchr_m(p,')')) == NULL) { DEBUG(0,("expand_env_var: Unterminated environment variable [%s]\n", p)); return 2; } @@ -107,7 +107,7 @@ static char *automount_path(char *user_name) char *automount_value = automount_lookup(user_name); if(strlen(automount_value) > 0) { - home_path_start = strchr(automount_value,':'); + home_path_start = strchr_m(automount_value,':'); if (home_path_start != NULL) { DEBUG(5, ("NIS lookup succeeded. Home path is: %s\n", home_path_start?(home_path_start+1):"")); @@ -171,7 +171,7 @@ void standard_sub_basic(char *str) char *p, *s; fstring pidstr; - for (s=str; (p=strchr(s, '%'));s=p) { + for (s=str; (p=strchr_m(s, '%'));s=p) { fstring tmp_str; int l = sizeof(pstring) - (int)(p-str); @@ -220,7 +220,7 @@ void standard_sub_advanced(int snum, char *user, char *connectpath, gid_t gid, c char *p, *s, *home; struct passwd *pass; - for (s=str; (p=strchr(s, '%'));s=p) { + for (s=str; (p=strchr_m(s, '%'));s=p) { int l = sizeof(pstring) - (int)(p-str); switch (*(p+1)) { diff --git a/source3/lib/system.c b/source3/lib/system.c index 8d4a872f14..0799a855e8 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -340,7 +340,7 @@ struct hostent *sys_gethostbyname(const char *name) /* Does this name have any dots in it? If so, make no change */ - if (strchr(name, '.')) + if (strchr_m(name, '.')) return(gethostbyname(name)); /* Get my hostname, which should have domain name @@ -350,7 +350,7 @@ struct hostent *sys_gethostbyname(const char *name) gethostname(hostname, sizeof(hostname) - 1); hostname[sizeof(hostname) - 1] = 0; - if ((domain = strchr(hostname, '.')) == NULL) + if ((domain = strchr_m(hostname, '.')) == NULL) return(gethostbyname(name)); /* Attach domain name to query and do modified query. diff --git a/source3/lib/username.c b/source3/lib/username.c index 3c99fc33d5..403a855f1a 100644 --- a/source3/lib/username.c +++ b/source3/lib/username.c @@ -92,7 +92,7 @@ BOOL map_username(char *user) while((s=fgets_slash(buf,sizeof(buf),f))!=NULL) { char *unixname = s; - char *dosname = strchr(unixname,'='); + char *dosname = strchr_m(unixname,'='); BOOL return_if_mapped = False; if (!dosname) @@ -109,7 +109,7 @@ BOOL map_username(char *user) unixname++; } - if (!*unixname || strchr("#;",*unixname)) + if (!*unixname || strchr_m("#;",*unixname)) continue; { @@ -120,7 +120,7 @@ BOOL map_username(char *user) } } - if (strchr(dosname,'*') || user_in_list(user,dosname)) { + if (strchr_m(dosname,'*') || user_in_list(user,dosname)) { DEBUG(3,("Mapped user %s to %s\n",user,unixname)); mapped_user = True; fstrcpy(last_from,user); @@ -529,7 +529,7 @@ struct passwd *smb_getpwnam(char *user, BOOL allow_change) lookup just the username portion locally */ sep = lp_winbind_separator(); if (!sep || !*sep) sep = "\\"; - p = strchr(user,*sep); + p = strchr_m(user,*sep); if (p && strncasecmp(global_myname, user, strlen(global_myname))==0) { return Get_Pwnam(p+1, allow_change); diff --git a/source3/lib/util.c b/source3/lib/util.c index a8ef69e559..d220b2c531 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -140,7 +140,7 @@ char *Atoic(char *p, int *n, char *c) p++; } - if (strchr(c, *p) == NULL) + if (strchr_m(c, *p) == NULL) { DEBUG(5, ("Atoic: no separator characters (%s) not found\n", c)); return NULL; @@ -366,7 +366,7 @@ void dos_clean_name(char *s) *p = 0; pstrcpy(s1,p+3); - if ((p=strrchr(s,'\\')) != NULL) + if ((p=strrchr_m(s,'\\')) != NULL) *p = 0; else *s = 0; @@ -404,7 +404,7 @@ void unix_clean_name(char *s) *p = 0; pstrcpy(s1,p+3); - if ((p=strrchr(s,'/')) != NULL) + if ((p=strrchr_m(s,'/')) != NULL) *p = 0; else *s = 0; @@ -428,7 +428,7 @@ void make_dir_struct(char *buf,char *mask,char *fname,SMB_OFF_T size,int mode,ti size = 0; memset(buf+1,' ',11); - if ((p = strchr(mask2,'.')) != NULL) + if ((p = strchr_m(mask2,'.')) != NULL) { *p = 0; memcpy(buf+1,mask2,MIN(strlen(mask2),8)); @@ -720,7 +720,7 @@ BOOL get_myname(char *my_name) if (my_name) { /* split off any parts after an initial . */ - char *p = strchr(hostname,'.'); + char *p = strchr_m(hostname,'.'); if (p) *p = 0; fstrcpy(my_name,hostname); @@ -766,7 +766,7 @@ BOOL is_ipaddress(const char *str) pure_address = False; /* Check that a pure number is not misinterpreted as an IP */ - pure_address = pure_address && (strchr(str, '.') != NULL); + pure_address = pure_address && (strchr_m(str, '.') != NULL); return pure_address; } @@ -1144,7 +1144,7 @@ BOOL is_in_path(char *name, name_compare_entry *namelist) } /* Get the last component of the unix name. */ - p = strrchr(name, '/'); + p = strrchr_m(name, '/'); strncpy(last_component, p ? ++p : name, sizeof(last_component)-1); last_component[sizeof(last_component)-1] = '\0'; @@ -1211,7 +1211,7 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist) continue; } /* find the next / */ - name_end = strchr(nameptr, '/'); + name_end = strchr_m(nameptr, '/'); /* oops - the last check for a / didn't find one. */ if (name_end == NULL) @@ -1244,7 +1244,7 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist) continue; } /* find the next / */ - if ((name_end = strchr(nameptr, '/')) != NULL) + if ((name_end = strchr_m(nameptr, '/')) != NULL) { *name_end = 0; } @@ -1741,7 +1741,7 @@ char *parent_dirname(const char *path) return(NULL); pstrcpy(dirpath, path); - p = strrchr(dirpath, '/'); /* Find final '/', if any */ + p = strrchr_m(dirpath, '/'); /* Find final '/', if any */ if (!p) { pstrcpy(dirpath, "."); /* No final "/", so dir is "." */ } else { diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index 7dc25a8dae..01a8b1c333 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -255,7 +255,7 @@ int getfileline(void *vp, char *linebuf, int linebuf_size) continue; } - p = (unsigned char *) strchr(linebuf, ':'); + p = (unsigned char *) strchr_m(linebuf, ':'); if (p == NULL) { DEBUG(0, ("getfileline: malformed line entry (no :)\n")); diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c index 70341507cb..c89c7c70d9 100644 --- a/source3/lib/util_sid.c +++ b/source3/lib/util_sid.c @@ -318,8 +318,8 @@ void split_domain_name(const char *fullname, char *domain, char *name) fullname++; pstrcpy(full_name, fullname); - p = strchr(full_name+1, '\\'); - if (!p) p = strchr(full_name+1, sep[0]); + p = strchr_m(full_name+1, '\\'); + if (!p) p = strchr_m(full_name+1, sep[0]); if (p != NULL) { *p = 0; diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 01cff85f65..a55ef1a92e 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -127,7 +127,7 @@ void set_socket_options(int fd, char *options) char *p; BOOL got_value = False; - if ((p = strchr(tok,'='))) { + if ((p = strchr_m(tok,'='))) { *p = 0; value = atoi(p+1); got_value = True; diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 8ff3e23443..736229c75f 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -43,13 +43,13 @@ BOOL next_token(char **ptr,char *buff,char *sep, size_t bufsize) if (!sep) sep = " \t\n\r"; /* find the first non sep char */ - while (*s && strchr(sep,*s)) s++; + while (*s && strchr_m(sep,*s)) s++; /* nothing left? */ if (! *s) return(False); /* copy over the token */ - for (quoted = False; len < bufsize && *s && (quoted || !strchr(sep,*s)); s++) { + for (quoted = False; len < bufsize && *s && (quoted || !strchr_m(sep,*s)); s++) { if (*s == '\"') { quoted = !quoted; } else { @@ -103,15 +103,15 @@ char **toktocliplist(int *ctok, char *sep) if (!sep) sep = " \t\n\r"; - while(*s && strchr(sep,*s)) s++; + while(*s && strchr_m(sep,*s)) s++; /* nothing left? */ if (!*s) return(NULL); do { ictok++; - while(*s && (!strchr(sep,*s))) s++; - while(*s && strchr(sep,*s)) *s++=0; + while(*s && (!strchr_m(sep,*s))) s++; + while(*s && strchr_m(sep,*s)) *s++=0; } while(*s); *ctok=ictok; @@ -461,7 +461,7 @@ char *alpha_strcpy(char *dest, const char *src, const char *other_safe_chars, si for(i = 0; i < len; i++) { int val = (src[i] & 0xff); - if(isupper(val) || islower(val) || isdigit(val) || strchr(other_safe_chars, val)) + if(isupper(val) || islower(val) || isdigit(val) || strchr_m(other_safe_chars, val)) dest[i] = src[i]; else dest[i] = '_'; @@ -499,7 +499,7 @@ char *strncpyn(char *dest, const char *src,size_t n, char c) char *p; size_t str_len; - p = strchr(src, c); + p = strchr_m(src, c); if (p == NULL) { DEBUG(5, ("strncpyn: separator character (%c) not found\n", c)); @@ -539,14 +539,14 @@ size_t strhex_to_str(char *p, size_t len, const char *strhex) continue; } - if (!(p1 = strchr(hexchars, toupper(strhex[i])))) + if (!(p1 = strchr_m(hexchars, toupper(strhex[i])))) { break; } i++; /* next hex digit */ - if (!(p2 = strchr(hexchars, toupper(strhex[i])))) + if (!(p2 = strchr_m(hexchars, toupper(strhex[i])))) { break; } @@ -751,7 +751,7 @@ void all_string_sub(char *s,const char *pattern,const char *insert, size_t len) ****************************************************************************/ void split_at_last_component(char *path, char *front, char sep, char *back) { - char *p = strrchr(path, sep); + char *p = strrchr_m(path, sep); if (p != NULL) { @@ -806,7 +806,7 @@ char *string_truncate(char *s, int length) /**************************************************************************** -strchr and strrchr are very hard to do on general multi-byte strings. +strchr and strrchr_m are very hard to do on general multi-byte strings. we convert via ucs2 for now ****************************************************************************/ char *strchr_m(const char *s, char c) |