rbj@icst-cmr.ARPA (Root Boy Jim) (07/29/86)
I have modified the BSD4.2 FTP client to do the `ls' & `dir' commands in a more UNIX-like manner. As currently distributed, you only get ONE remote file name argument, with the second taken to be the name of the local listing file. Thus, `ls foo bar' is taken to mean `ls foo > bar'. This lets you pick between options or a file name, but not both. When talking to a UNIX server, it would be nice to have the -FAC options by default. My changes are as follows: 1) Added the `unix' command. Talks to a UNIX server more intelligently by adding `-FAC' to all `ls' commands, and `-FAs' to all `dir' commands. 2) Added recursive versions of the `ls' and `dir' commands, called `lr' and `dr' respectively. Options added are `-FACR' and `-FAsR' likewise. 3) I didn't do anything with `mls' & `mdir' as they appear to work strangely and I never use them anyway. 4) This is my first sources posting so I'm not exactly sure how to combine shars and patches into one nifty string you can pipe to. So, it's a two step process, first unshar it, then apply the patches, which are diff -c's. (Root Boy) Jim Cottrell <rbj@icst-cmr.arpa> I request a weekend in Havana with Phil Silvers! #! /bin/sh # Yow! This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Only a Pinhead would execute the file with /bin/csh (not sh) to create: # cmds.c.diff # cmdtab.c.diff # ftp_var.h.diff # This archive created: Mon Jul 28 21:01:43 1986 export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'cmds.c.diff' then echo shar: "Zippy will not over-write existing file 'cmds.c.diff'" else sed 's/^YOW!//' << \ZIPPY-THE-PINHEAD > 'cmds.c.diff' YOW!*** /usr/src/ucb/ftp/cmds.c Wed Jul 27 00:34:47 1983 YOW!--- cmds.c Mon Jul 28 20:54:00 1986 YOW!*************** YOW!*** 405,411 YOW! printf("Not connected.\n"); YOW! printf("Mode: %s; Type: %s; Form: %s; Structure: %s\n", YOW! modename, typename, formname, structname); YOW!! printf("Verbose: %s; Bell: %s; Prompting: %s; Globbing: %s\n", YOW! onoff(verbose), onoff(bell), onoff(interactive), YOW! onoff(doglob)); YOW! printf("Hash mark printing: %s; Use of PORT cmds: %s\n", YOW! YOW!--- 405,411 ----- YOW! printf("Not connected.\n"); YOW! printf("Mode: %s; Type: %s; Form: %s; Structure: %s\n", YOW! modename, typename, formname, structname); YOW!! printf("Verbose: %s; Bell: %s; Prompt: %s; Glob: %s; UNIX: %s\n",/*RBJ*/ YOW! onoff(verbose), onoff(bell), onoff(interactive), YOW! onoff(doglob), onoff(udir)); /*RBJ*/ YOW! printf("Hash mark printing: %s; Use of PORT cmds: %s\n", YOW!*************** YOW!*** 407,413 YOW! modename, typename, formname, structname); YOW! printf("Verbose: %s; Bell: %s; Prompting: %s; Globbing: %s\n", YOW! onoff(verbose), onoff(bell), onoff(interactive), YOW!! onoff(doglob)); YOW! printf("Hash mark printing: %s; Use of PORT cmds: %s\n", YOW! onoff(hash), onoff(sendport)); YOW! } YOW! YOW!--- 407,413 ----- YOW! modename, typename, formname, structname); YOW! printf("Verbose: %s; Bell: %s; Prompt: %s; Glob: %s; UNIX: %s\n",/*RBJ*/ YOW! onoff(verbose), onoff(bell), onoff(interactive), YOW!! onoff(doglob), onoff(udir)); /*RBJ*/ YOW! printf("Hash mark printing: %s; Use of PORT cmds: %s\n", YOW! onoff(hash), onoff(sendport)); YOW! } YOW!*************** YOW!*** 423,428 YOW! printf("Bell mode %s.\n", onoff(bell)); YOW! } YOW! YOW! /* YOW! * Turn on packet tracing. YOW! */ YOW! YOW!--- 423,437 ----- YOW! printf("Bell mode %s.\n", onoff(bell)); YOW! } YOW! YOW!+ /* /*RBJ*/ YOW!+ /* Set UNIX directory mode. /*RBJ*/ YOW!+ /* /*RBJ*/ YOW!+ setunix() /*RBJ*/ YOW!+ { /*RBJ*/ YOW!+ udir = !udir; /*RBJ*/ YOW!+ printf("Unix mode %s.\n", onoff(udir)); /*RBJ*/ YOW!+ } /*RBJ*/ YOW!+ YOW! /* YOW! * Turn on packet tracing. YOW! */ YOW!*************** YOW!*** 665,671 YOW! printf("usage: %s remote-directory local-file\n", argv[0]); YOW! return; YOW! } YOW!! cmd = argv[0][0] == 'l' ? "NLST" : "LIST"; YOW! if (strcmp(argv[2], "-") && !globulize(&argv[2])) YOW! return; YOW! recvrequest(cmd, argv[2], argv[1], "w"); YOW! YOW!--- 674,687 ----- YOW! printf("usage: %s remote-directory local-file\n", argv[0]); YOW! return; YOW! } YOW!! /*FTP cmd = argv[0][0] == 'l' ? "NLST" : "LIST"; /*RBJ*/ YOW!! argv[0][0] += argv[0][1] == 'r'; /* Yow! Am I HACKING yet? */ /*RBJ*/ YOW!! switch (argv[0][0]) { /*RBJ*/ YOW!! case 'l': cmd = udir ? "NLST -FAC" : "NLST"; break; /*RBJ*/ YOW!! case 'm': cmd = udir ? "NLST -FACR" : "NLST -R"; break; /*RBJ*/ YOW!! case 'd': cmd = udir ? "LIST -FAs" : "LIST"; break; /*RBJ*/ YOW!! case 'e': cmd = udir ? "LIST -FAsR" : "LIST -R"; break; /*RBJ*/ YOW!! } /*RBJ*/ YOW! if (strcmp(argv[2], "-") && !globulize(&argv[2])) YOW! return; YOW! recvrequest(cmd, argv[2], argv[1], "w"); ZIPPY-THE-PINHEAD if test 2890 -ne "`wc -c < 'cmds.c.diff'`" then echo shar: "YOW! error transmitting 'cmds.c.diff'" '(should have been 2890 characters)' fi fi if test -f 'cmdtab.c.diff' then echo shar: "Zippy will not over-write existing file 'cmdtab.c.diff'" else sed 's/^YOW!//' << \ZIPPY-THE-PINHEAD > 'cmdtab.c.diff' YOW!*** /usr/src/ucb/ftp/cmdtab.c Wed Jul 27 00:34:47 1983 YOW!--- cmdtab.c Mon Jul 28 20:14:46 1986 YOW!*************** YOW!*** 17,22 YOW! int quit(), renamefile(), status(); YOW! int quote(), rmthelp(), shell(); YOW! int pwd(), makedir(), removedir(); YOW! YOW! char appendhelp[] = "append to a file"; YOW! char asciihelp[] = "set ascii transfer type"; YOW! YOW!--- 17,23 ----- YOW! int quit(), renamefile(), status(); YOW! int quote(), rmthelp(), shell(); YOW! int pwd(), makedir(), removedir(); YOW!+ int setunix(); /*RBJ*/ YOW! YOW! char appendhelp[] = "append to a file"; YOW! char asciihelp[] = "set ascii transfer type"; YOW!*************** YOW!*** 26,31 YOW! char connecthelp[] = "connect to remote tftp"; YOW! char deletehelp[] = "delete remote file"; YOW! char debughelp[] = "toggle/set debugging mode"; YOW! char dirhelp[] = "list contents of remote directory"; YOW! char disconhelp[] = "terminate ftp session"; YOW! char formhelp[] = "set file transfer format"; YOW! YOW!--- 27,33 ----- YOW! char connecthelp[] = "connect to remote tftp"; YOW! char deletehelp[] = "delete remote file"; YOW! char debughelp[] = "toggle/set debugging mode"; YOW!+ char drhelp[] = "list RECURSIVELY remote directory"; /*RBJ*/ YOW! char dirhelp[] = "list contents of remote directory"; YOW! char disconhelp[] = "terminate ftp session"; YOW! char formhelp[] = "set file transfer format"; YOW!*************** YOW!*** 33,38 YOW! char hashhelp[] = "toggle printing `#' for each buffer transferred"; YOW! char helphelp[] = "print local help information"; YOW! char lcdhelp[] = "change local working directory"; YOW! char lshelp[] = "nlist contents of remote directory"; YOW! char mdeletehelp[] = "delete multiple files"; YOW! char mdirhelp[] = "list contents of multiple remote directories"; YOW! YOW!--- 35,41 ----- YOW! char hashhelp[] = "toggle printing `#' for each buffer transferred"; YOW! char helphelp[] = "print local help information"; YOW! char lcdhelp[] = "change local working directory"; YOW!+ char lrhelp[] = "nlist RECURSIVELY remote directory"; /*RBJ*/ YOW! char lshelp[] = "nlist contents of remote directory"; YOW! char mdeletehelp[] = "delete multiple files"; YOW! char mdirhelp[] = "list contents of multiple remote directories"; YOW!*************** YOW!*** 57,62 YOW! char tenexhelp[] = "set tenex file transfer type"; YOW! char tracehelp[] = "toggle packet tracing"; YOW! char typehelp[] = "set file transfer type"; YOW! char userhelp[] = "send new user information"; YOW! char verbosehelp[] = "toggle verbose mode"; YOW! YOW! YOW!--- 60,66 ----- YOW! char tenexhelp[] = "set tenex file transfer type"; YOW! char tracehelp[] = "toggle packet tracing"; YOW! char typehelp[] = "set file transfer type"; YOW!+ char unixhelp[] = "toggle UNIX directory mode"; /*RBJ*/ YOW! char userhelp[] = "send new user information"; YOW! char verbosehelp[] = "toggle verbose mode"; YOW! YOW!*************** YOW!*** 71,76 YOW! { "close", disconhelp, 0, 1, disconnect }, YOW! { "delete", deletehelp, 0, 1, delete }, YOW! { "debug", debughelp, 0, 0, setdebug }, YOW! { "dir", dirhelp, 1, 1, ls }, YOW! { "form", formhelp, 0, 1, setform }, YOW! { "get", receivehelp, 1, 1, get }, YOW! YOW!--- 75,81 ----- YOW! { "close", disconhelp, 0, 1, disconnect }, YOW! { "delete", deletehelp, 0, 1, delete }, YOW! { "debug", debughelp, 0, 0, setdebug }, YOW!+ { "dr", drhelp, 1, 1, ls }, /*RBJ*/ YOW! { "dir", dirhelp, 1, 1, ls }, YOW! { "form", formhelp, 0, 1, setform }, YOW! { "get", receivehelp, 1, 1, get }, YOW!*************** YOW!*** 78,83 YOW! { "hash", hashhelp, 0, 0, sethash }, YOW! { "help", helphelp, 0, 0, help }, YOW! { "lcd", lcdhelp, 0, 0, lcd }, YOW! { "ls", lshelp, 1, 1, ls }, YOW! { "mdelete", mdeletehelp, 1, 1, mdelete }, YOW! { "mdir", mdirhelp, 1, 1, mls }, YOW! YOW!--- 83,89 ----- YOW! { "hash", hashhelp, 0, 0, sethash }, YOW! { "help", helphelp, 0, 0, help }, YOW! { "lcd", lcdhelp, 0, 0, lcd }, YOW!+ { "lr", lrhelp, 1, 1, ls }, /*RBJ*/ YOW! { "ls", lshelp, 1, 1, ls }, YOW! { "mdelete", mdeletehelp, 1, 1, mdelete }, YOW! { "mdir", mdirhelp, 1, 1, mls }, YOW!*************** YOW!*** 103,108 YOW! { "tenex", tenexhelp, 0, 1, settenex }, YOW! { "trace", tracehelp, 0, 0, settrace }, YOW! { "type", typehelp, 0, 1, settype }, YOW! { "user", userhelp, 0, 1, user }, YOW! { "verbose", verbosehelp, 0, 0, setverbose }, YOW! { "?", helphelp, 0, 0, help }, YOW! YOW!--- 109,115 ----- YOW! { "tenex", tenexhelp, 0, 1, settenex }, YOW! { "trace", tracehelp, 0, 0, settrace }, YOW! { "type", typehelp, 0, 1, settype }, YOW!+ { "unix", unixhelp, 0, 0, setunix }, /*RBJ*/ YOW! { "user", userhelp, 0, 1, user }, YOW! { "verbose", verbosehelp, 0, 0, setverbose }, YOW! { "?", helphelp, 0, 0, help }, ZIPPY-THE-PINHEAD if test 4358 -ne "`wc -c < 'cmdtab.c.diff'`" then echo shar: "YOW! error transmitting 'cmdtab.c.diff'" '(should have been 4358 characters)' fi fi if test -f 'ftp_var.h.diff' then echo shar: "Zippy will not over-write existing file 'ftp_var.h.diff'" else sed 's/^YOW!//' << \ZIPPY-THE-PINHEAD > 'ftp_var.h.diff' YOW!*** /usr/src/ucb/ftp/ftp_var.h Wed Jul 27 00:34:48 1983 YOW!--- ftp_var.h Mon Jul 28 20:05:28 1986 YOW!*************** YOW!*** 16,21 YOW! int interactive; /* interactively prompt on m* cmds */ YOW! int debug; /* debugging level */ YOW! int bell; /* ring bell on cmd completion */ YOW! int doglob; /* glob local file names */ YOW! int autologin; /* establish user account on connection */ YOW! YOW! YOW!--- 16,22 ----- YOW! int interactive; /* interactively prompt on m* cmds */ YOW! int debug; /* debugging level */ YOW! int bell; /* ring bell on cmd completion */ YOW!+ int udir; /* UNIX directory mode */ /*RBJ*/ YOW! int doglob; /* glob local file names */ YOW! int autologin; /* establish user account on connection */ YOW! ZIPPY-THE-PINHEAD if test 689 -ne "`wc -c < 'ftp_var.h.diff'`" then echo shar: "YOW! error transmitting 'ftp_var.h.diff'" '(should have been 689 characters)' fi fi exit 0 # End of shell archive