ftp won't always glob
Clifford Spencer
cspencer at bbncc5.UUCP
Thu Oct 31 00:31:33 AEST 1985
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 *
<undefined junk>
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 at bbncc5
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list