diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-08-24 01:32:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:16 -0500 |
commit | 694ac65faa13cc016f54330b656e64225aa40aab (patch) | |
tree | 854ad9d4f278ceb67916d68b2843245a1d231097 /source4/lib | |
parent | af057bdf84d91fe387e7920a6b753142e82d7682 (diff) | |
download | samba-694ac65faa13cc016f54330b656e64225aa40aab.tar.gz samba-694ac65faa13cc016f54330b656e64225aa40aab.tar.bz2 samba-694ac65faa13cc016f54330b656e64225aa40aab.zip |
r2003: got rid of next_token_nr(), which involved some horrible globals
and nasy pointer tricks.
this involved fixing some of the internals of smbclient
(This used to be commit 126fec6169f9412932c82e7675840476132bce87)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/cmdline/readline.c | 2 | ||||
-rw-r--r-- | source4/lib/util_str.c | 25 |
2 files changed, 4 insertions, 23 deletions
diff --git a/source4/lib/cmdline/readline.c b/source4/lib/cmdline/readline.c index c5da88b3e0..97201d00bb 100644 --- a/source4/lib/cmdline/readline.c +++ b/source4/lib/cmdline/readline.c @@ -140,7 +140,7 @@ void smb_readline_ca_char(char c) /**************************************************************************** history ****************************************************************************/ -int cmd_history(void) +int cmd_history(const char **cmd_ptr) { #if defined(HAVE_LIBREADLINE) HIST_ENTRY **hlist; diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c index a66a363c17..fc76aed44a 100644 --- a/source4/lib/util_str.c +++ b/source4/lib/util_str.c @@ -67,25 +67,6 @@ BOOL next_token(const char **ptr,char *buff, const char *sep, size_t bufsize) return(True); } -/** -This is like next_token but is not re-entrant and "remembers" the first -parameter so you can pass NULL. This is useful for user interface code -but beware the fact that it is not re-entrant! -**/ - -static char *last_ptr=NULL; - -BOOL next_token_nr(const char **ptr, char *buff, const char *sep, size_t bufsize) -{ - BOOL ret; - if (!ptr) - ptr = (const char **)&last_ptr; - - ret = next_token(ptr, buff, sep, bufsize); - last_ptr = *ptr; - return ret; -} - static uint16_t tmpbuf[sizeof(pstring)]; /** @@ -93,9 +74,9 @@ static uint16_t tmpbuf[sizeof(pstring)]; Uses last_ptr from above - bit of a hack. **/ -char **toktocliplist(int *ctok, const char *sep) +char **toktocliplist(const char *ptr, int *ctok, const char *sep) { - char *s=last_ptr; + char *s = ptr; int ictok=0; char **ret, **iret; @@ -118,7 +99,7 @@ char **toktocliplist(int *ctok, const char *sep) } while(*s); *ctok=ictok; - s=last_ptr; + s = ptr; if (!(ret=iret=malloc(ictok*sizeof(char *)))) return NULL; |