Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site bbncc5.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!bbnccv!bbncc5!cspencer From: cspencer@bbncc5.UUCP (Clifford Spencer) Newsgroups: net.bugs.4bsd Subject: ftp won't always glob Message-ID: <919@bbncc5.UUCP> Date: Wed, 30-Oct-85 09:31:33 EST Article-I.D.: bbncc5.919 Posted: Wed Oct 30 09:31:33 1985 Date-Received: Fri, 1-Nov-85 02:26:08 EST Distribution: net Organization: Bolt Beranek and Newman, Cambridge, MA Lines: 158 Index: /usr/src/ucb/ftp/{cmds.c,glob.c} 4.2BSD (and Ultrix!) Description: When processing '!' shell escapes, Ftp globs meta characters on its own and does an execvp() instead of handing the command to a shell. If you give '!' more than one argument, you get garbage out. If you give it one arg, the glob still doesn't work. Repeat-By: % ftp ftp> !echo *Fix: I think Guy Harris mentioned this about 7 months ago, but fixed it by removing the feature and always forking a shell. I you would rather make it work, here's how. These fixes are in suitable for handing to "patch", but are not difficult to apply by hand. -cliff =================================== CUT CUT CUT ========================== *** cmds.c.orig Wed Oct 30 09:03:45 1985 --- cmds.c Wed Oct 30 09:03:53 1985 *************** *** 265,271 sendrequest("STOR", argv[i], argv[i]); continue; } ! gargs = glob(argv[i]); if (globerr != NULL) { printf("%s\n", globerr); if (gargs) --- 265,271 ----- sendrequest("STOR", argv[i], argv[i]); continue; } ! gargs = glob(&argv[i]); if (globerr != NULL) { printf("%s\n", globerr); if (gargs) *************** *** 1005,1011 if (!doglob) return (1); ! globbed = glob(*cpp); if (globerr != NULL) { printf("%s: %s\n", *cpp, globerr); if (globbed) --- 1005,1011 ----- if (!doglob) return (1); ! globbed = glob(cpp); if (globerr != NULL) { printf("%s: %s\n", *cpp, globerr); if (globbed) *** glob.c.orig Wed Oct 30 09:03:40 1985 --- glob.c Wed Oct 30 09:03:49 1985 *************** *** 44,50 char ** glob(v) ! register char *v; { char agpath[BUFSIZ]; char *agargv[GAVSIZ]; --- 44,50 ----- char ** glob(v) ! register char **v; { char agpath[BUFSIZ]; char *agargv[GAVSIZ]; *************** *** 48,56 { char agpath[BUFSIZ]; char *agargv[GAVSIZ]; - char *vv[2]; - vv[0] = v; - vv[1] = 0; gflag = 0; rscan(vv, tglob); if (gflag == 0) --- 48,53 ----- { char agpath[BUFSIZ]; char *agargv[GAVSIZ]; gflag = 0; rscan(v, tglob); if (gflag == 0) *************** *** 52,58 vv[0] = v; vv[1] = 0; gflag = 0; ! rscan(vv, tglob); if (gflag == 0) return (copyblk(vv)); --- 49,55 ----- char agpath[BUFSIZ]; char *agargv[GAVSIZ]; gflag = 0; ! rscan(v, tglob); if (gflag == 0) return (copyblk(v)); *************** *** 54,60 gflag = 0; rscan(vv, tglob); if (gflag == 0) ! return (copyblk(vv)); globerr = 0; gpath = agpath; gpathp = gpath; *gpathp = 0; --- 51,57 ----- gflag = 0; rscan(v, tglob); if (gflag == 0) ! return (copyblk(v)); globerr = 0; gpath = agpath; gpathp = gpath; *gpathp = 0; *************** *** 60,66 gpath = agpath; gpathp = gpath; *gpathp = 0; lastgpathp = &gpath[sizeof agpath - 2]; ginit(agargv); globcnt = 0; ! collect(v); if (globcnt == 0 && (gflag&1)) { blkfree(gargv), gargv = 0; return (0); --- 57,64 ----- gpath = agpath; gpathp = gpath; *gpathp = 0; lastgpathp = &gpath[sizeof agpath - 2]; ginit(agargv); globcnt = 0; ! while(*v) ! collect(*v++); if (globcnt == 0 && (gflag&1)) { blkfree(gargv), gargv = 0; return (0); -- cliff spencer {harvard, ihnp4, decvax}!bbnccv!cspencer cspencer@bbncc5