Initialize the `lasts' to NULL before calling strtok_r the first time.

With our strtok_r it's not necessary, but the man-page on SGIs says it
should be done.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1791 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-06-01 03:15:07 +00:00
parent f3750c9f04
commit 49e6c777dd
2 changed files with 4 additions and 2 deletions

View File

@@ -125,9 +125,11 @@ ftpd_popen(char *program, char *type, int do_stderr, int no_glob)
return (NULL);
/* break up string into pieces */
for (argc = 0, cp = program;; cp = NULL)
for (argc = 0, cp = program;; cp = NULL) {
foo = NULL;
if (!(argv[argc++] = strtok_r(cp, " \t\n", &foo)))
break;
}
gargv[0] = (char*)ftp_rooted(argv[0]);
/* glob each piece */

View File

@@ -157,7 +157,7 @@ sl_loop (SL_cmd *cmds, char *prompt)
add_history(buf);
count = 0;
{
char *foo;
char *foo = NULL;
char *p;
for(p = strtok_r (buf, " \t", &foo);