From 694ac65faa13cc016f54330b656e64225aa40aab Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 24 Aug 2004 01:32:12 +0000 Subject: 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) --- source4/lib/cmdline/readline.c | 2 +- source4/lib/util_str.c | 25 +++---------------------- 2 files changed, 4 insertions(+), 23 deletions(-) (limited to 'source4/lib') 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; -- cgit