home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume26 / sftp / patch01 < prev    next >
Text File  |  1993-07-16  |  18KB  |  871 lines

  1. Newsgroups: comp.sources.unix
  2. From: mzraly@cs.umb.edu (Michael S Zraly)
  3. Subject: v26i296: sftp - command line ftp interface, Patch01
  4. Sender: unix-sources-moderator@gw.home.vix.com
  5. Approved: vixie@gw.home.vix.com
  6.  
  7. Submitted-By: mzraly@cs.umb.edu (Michael S Zraly)
  8. Posting-Number: Volume 26, Issue 296
  9. Archive-Name: sftp/patch01
  10.  
  11. *** Makefile.orig    Fri Jul 16 23:35:20 1993
  12. --- Makefile    Fri Jul 16 23:35:20 1993
  13. ***************
  14. *** 1,4 ****
  15. ! # Makefile
  16.   # Michael S Zraly
  17.   # mzraly@cs.umb.edu
  18.   # 26 July 1992
  19. --- 1,4 ----
  20. ! # sftp Makefile
  21.   # Michael S Zraly
  22.   # mzraly@cs.umb.edu
  23.   # 26 July 1992
  24. *** README.orig    Fri Jul 16 23:35:20 1993
  25. --- README    Fri Jul 16 23:35:20 1993
  26. ***************
  27. *** 1,4 ****
  28. ! README
  29.   Michael S Zraly
  30.   mzraly@cs.umb.edu
  31.   26 July 1992
  32. --- 1,4 ----
  33. ! sftp README
  34.   Michael S Zraly
  35.   mzraly@cs.umb.edu
  36.   26 July 1992
  37. ***************
  38. *** 13,22 ****
  39.   REQUIREMENTS
  40.   
  41.   No special permissions are required.  The only non-standard command
  42. ! that sftp uses is getopts(1).  It is available by anonymous FTP
  43. ! from a number of sites; let archie(1) be your guide.  The source for
  44. ! getopts is in perl.
  45.   
  46.   INSTALLATION
  47.   
  48.   Type "make install".  The only "compiling" necessary is the formatting
  49. --- 13,38 ----
  50.   REQUIREMENTS
  51.   
  52.   No special permissions are required.  The only non-standard command
  53. ! that sftp uses is getopts(1).  If you do not have getopts built into
  54. ! your version of /bin/sh, you have two options:
  55.   
  56. +     (1) change the first line in sftp from "#! /bin/sh"
  57. +         to "#! /bin/ksh" or "#! /bin/bash" or whatever
  58. +         the paths are on your system for the Korn shell
  59. +         and the GNU people's Bourne-again shell.  These
  60. +         shells both have getopts built into them.
  61. +     (2) Get rmgetopts, which I hope will be distributed
  62. +         over comp.sources.unix soon.  If it isn't send me
  63. +         mail at mzraly@cs.umb.edu and I'll send you a copy.
  64. +         rmgetopts converts shell scripts using getopts to
  65. +         parse command line options into ones that don't.
  66. +         Once rmgetopts is in place, just type
  67. +         % mv sftp sftp.orig
  68. +         % rmgetopts sftp.orig > sftp
  69. +         % chmod +x sftp
  70.   INSTALLATION
  71.   
  72.   Type "make install".  The only "compiling" necessary is the formatting
  73. ***************
  74. *** 31,34 ****
  75. --- 47,59 ----
  76.   Send them (and fixes, if you have them) to me at:
  77.   
  78.       mzraly@cs.umb.edu
  79. + HISTORY
  80. + The first version of sftp was submitted to comp.sources.unix in July
  81. + of 1992 and distributed in July of 1993.  At the time I thought that
  82. + getopts was a program separate from the shell, not realizing that the
  83. + getopts sources I had seen on the net were strictly in and for perl.
  84. + The second version was created in July 1993 to tighten up the code.
  85.   
  86. *** sftp.orig    Fri Jul 16 23:35:20 1993
  87. --- sftp    Fri Jul 16 23:35:20 1993
  88. ***************
  89. *** 1,4 ****
  90. ! #! /bin/sh
  91.   #
  92.   # sftp -- "surgical" FTP
  93.   #
  94. --- 1,4 ----
  95. ! #!/bin/sh
  96.   #
  97.   # sftp -- "surgical" FTP
  98.   #
  99. ***************
  100. *** 8,259 ****
  101.   #
  102.   # Based loosely on getfile, written by John Granrose
  103.   # for his anonymous FTP archive at pilot.njin.net.
  104. - cmd=
  105. - dbg=false
  106. - use=false
  107. - ver=false
  108. - bin=false
  109. - hash=false
  110. - mac=
  111. - dir=
  112. - fil=
  113. - key=
  114. - sub=
  115. - usage='-(g|l|m) [-duvbh] (site dir | [-f file] -k key [-s subdir]) file[s]'
  116. - prog=`basename $0`
  117. - USAGE="usage: $prog $usage"
  118.   #
  119. ! #    Set initial value for fil
  120.   #
  121. ! if test -n "$FTPKEYS"
  122. ! then
  123. !     fil=$FTPKEYS
  124. ! elif test -r .ftpkeys
  125. ! then
  126. !     fil=.ftpkeys
  127. ! elif test -r $HOME/.ftpkeys
  128. ! then
  129. !     fil=$HOME/.ftpkeys
  130. ! fi
  131.   #
  132. ! #    Parse options
  133.   #
  134. ! while getopts glmduvbhf:k:s: c
  135. ! do
  136. !     case $c in
  137. !     g)    if test -n "$cmd"
  138. !         then
  139. !             echo option -g 1>&2
  140. !             echo $USAGE 1>&2
  141. !             exit 1
  142. !         fi
  143. !         cmd=get
  144. !         ;;
  145. !     l)    if test -n "$cmd"
  146. !         then
  147. !             echo option -l 1>&2
  148. !             echo $USAGE 1>&2
  149. !             exit 1
  150. !         fi
  151. !         cmd=ls
  152. !         ;;
  153. !     m)    if test -n "$cmd"
  154. !         then
  155. !             echo option -m 1>&2
  156. !             echo $USAGE 1>&2
  157. !             exit 1
  158. !         fi
  159. !         cmd=mget
  160. !         ;;
  161. !     d)    dbg=true
  162. !         ;;
  163. !     u)    use=true
  164. !         ;;
  165. !     v)    ver=true
  166. !         ;;
  167. !     b)    bin=true
  168. !         ;;
  169. !     h)    hash=true
  170. !         ;;
  171. !     f)    fil=$OPTARG
  172. !         ;;
  173. !     k)    key=$OPTARG
  174. !         ;;
  175. !     s)    sub=$OPTARG
  176. !         ;;
  177. !     *)    echo option -$c 1>&2
  178. !         echo $USAGE 1>&2
  179. !         exit 1
  180. !         ;;
  181. !     esac
  182. ! done
  183. ! shift `expr $OPTIND - 1`
  184.   #
  185. ! #    Set cmd, fil variables appropriately
  186.   #
  187. ! if test -z "$cmd"
  188. ! then
  189. !     cmd=ls
  190. ! fi
  191. ! if test -z "$key" -o -z "$fil"
  192. ! then
  193. !     fil=/dev/null
  194. ! fi
  195.   #
  196. ! #    Now to determine mac, dir variables
  197.   #
  198.   
  199. ! if test -z "$key"
  200. ! then
  201. !     if test "$cmd" = "ls"
  202. !     then
  203. !         min=2
  204. !     else
  205. !         min=3
  206. !     fi
  207. !     if test "$#" -lt "$min"
  208. !     then
  209. !         echo too few args 1>&2
  210. !         echo $USAGE 1>&2
  211. !         exit 1
  212. !     else
  213. !         mac=$1
  214. !         dir=$2
  215. !         shift
  216. !         shift
  217. !     fi
  218. ! else
  219. !     #
  220. !     #    Here we need to read $fil and look for $key to get $mac. $dir
  221. !     #
  222. !     str=`grep "^$key[     ]" $fil`
  223. !     mac=`echo "$str" | awk '{ print $2 }'`
  224. !     dir=`echo "$str" | awk '{ print $3 }'`
  225. ! fi
  226.   
  227. ! if test -z "$mac"
  228. ! then
  229. !     echo machine not set 1>&2
  230. !     echo $prog: ERROR 1>&2
  231. !     dbg=true
  232. ! fi
  233.   
  234. ! #
  235. ! #    Take care of possible subdirectory
  236. ! #
  237.   
  238. ! if test -n "$sub"
  239. ! then
  240. !     dir=$dir/$sub
  241. ! fi
  242.   
  243. ! #
  244. ! #    Now check for debugging option
  245. ! #
  246.   
  247. ! if test $dbg = "true"
  248.   then
  249. !     echo "cmd  = \"$cmd\""
  250. !     echo "dbg  = \"$dbg\""
  251. !     echo "use  = \"$use\""
  252. !     echo "ver  = \"$ver\""
  253. !     echo "bin  = \"$bin\""
  254. !     echo "hash = \"$hash\""
  255. !     echo "mac  = \"$mac\""
  256. !     echo "dir  = \"$dir\""
  257. !     echo "fil  = \"$fil\""
  258. !     echo "key  = \"$key\""
  259. !     echo "sub  = \"$sub\""
  260. !     exit 0
  261.   fi
  262.   
  263. ! #
  264. ! #    Set arguments to FTP command
  265. ! #
  266.   
  267. ! if test "$use" = "false"
  268. ! then
  269. !     optn=-n
  270. ! fi
  271.   
  272. ! if test "$ver" = "true"
  273. ! then
  274. !     optv=-v
  275. ! fi
  276.   
  277. ! #
  278. ! #    Now for the actual FTP'ing
  279. ! #
  280.   
  281. ! (
  282. !     #
  283. !     #    If not using .netrc file, assume anonymous login
  284. !     #
  285. !     if test "$use" = "false"
  286. !     then
  287. !         echo user anonymous $USER@$HOST
  288. !     fi
  289. !     #
  290. !     #    cd to base directory
  291. !     #
  292. !     if test -n "$dir"
  293. !     then
  294. !         echo cd $dir
  295. !     fi
  296. !     #
  297. !     #    take care of binary, hash commands if needed
  298. !     #
  299. !     if test "$bin" = "true"
  300. !     then
  301. !         echo binary
  302. !     fi
  303. !     if test "$hash" = "true"
  304. !     then
  305. !         echo hash
  306. !     fi
  307. !     #
  308. !     #    execute ftp command
  309. !     #
  310. !     case "$cmd" in
  311. !     ls)    if test "$#" -gt 0
  312. !         then
  313. !             for n do
  314. !                 echo ls $n
  315. !             done
  316. !         else
  317. !             echo ls
  318. !         fi
  319. !         ;;
  320. !     get)    echo get $1 $2
  321.           ;;
  322. !     mget)    for n do
  323. !             echo mget $n
  324. !         done
  325.           ;;
  326. !     *)    echo $prog: Invalid ftp command $cmd 1>&2
  327.           ;;
  328.       esac
  329. !     #
  330. !     #    all done
  331. !     #
  332.       echo bye
  333. ! ) | ftp -i $optn $optv $mac
  334.   
  335. - #
  336. - #    Exit with status of FTP command
  337. - #
  338.   exit $?
  339. --- 8,185 ----
  340.   #
  341.   # Based loosely on getfile, written by John Granrose
  342.   # for his anonymous FTP archive at pilot.njin.net.
  343.   #
  344. ! # Michael S Zraly
  345. ! # mzraly@cs.umb.edu
  346. ! # 8 July 1993
  347.   #
  348. ! # Oops!  Not all versions of sh have getopts.
  349. ! # Rewrite eliminates call to getopts and parses
  350. ! # arguments by hand (yuck!)
  351.   #
  352. ! # Actually we'll release the source using getopts
  353. ! # along with a separate program, rmgetopts, that
  354. ! # will convert getopts-style option parsing to the
  355. ! # more portable hand-parsing equivalent.
  356.   #
  357. ! # Might as well tighten the code up while we're at it:
  358.   #
  359. ! # (1) Move consistency tests OUT of ftp input subshell,
  360. ! #     so that we know before invoking ftp whether or not
  361. ! #     (for instance) $command is bogus.
  362.   #
  363. ! # (2) Wherever possible, replace invocations of the program
  364. ! #     'test' with the shell built-in 'case'.  In general,
  365. ! #
  366. ! #    if test -z "$foo"; then            case "$foo" in
  367. ! #        ...           ===>        "") ...;;
  368. ! #    fi                    esac
  369. ! #
  370. ! #     and
  371. ! #
  372. ! #    if test -n "$foo"; then            case "$foo" in
  373. ! #        ...           ===>        ?*) ...;;
  374. ! #    fi                    esac
  375. ! #
  376. ! #     Why?  Because 'case' is a shell built-in whose execution
  377. ! #     does not require the shell to exec another process, while
  378. ! #     test is a separate program.  Typically, then, a 'test' will
  379. ! #     take longer than a 'case'.
  380.   #
  381. ! # (3) Improve error checking and messages.
  382.   #
  383. + # (4) Generally reformat for better readability.
  384.   
  385. ! prog=`basename $0`
  386. ! usage='[-glmbhuv] [-s subdir] (host [dir] | [-f file] -k key) file[s]'
  387.   
  388. ! USAGE="usage: $prog $usage"
  389.   
  390. ! # Initialize variables
  391.   
  392. ! command=ls    # ftp command to give
  393. ! binary=        # binary command, if to be given
  394. ! hash=        # hash command, if to be given
  395. ! usenetrc=n    # use .netrc ? opposite of ftp's -n flag
  396. ! verbose=n    # verbose connection ? same as ftp's -v flag
  397. ! topdir=        # main directory in which ftp commands are to be given
  398. ! subdir=        # subdirectory of topdir in which ftp commands are to be given
  399. ! host=        # host on which ftp commands are to be given
  400. ! ftpkeys=    # file containing references to commonly used hosts
  401. ! key=        # key used to search ftpkeys file
  402.   
  403. ! # Set initial value for ftpkeys
  404.   
  405. ! if test -n "$FTPKEYS"
  406. ! then
  407. !     ftpkeys=$FTPKEYS
  408. ! elif test -r ".ftpkeys"
  409. ! then
  410. !     ftpkeys=.ftpkeys
  411. ! elif test -r "$HOME/.ftpkeys"
  412.   then
  413. !     ftpkeys=$HOME/.ftpkeys
  414.   fi
  415.   
  416. ! # Parse options
  417.   
  418. ! while getopts glmbhuvf:k:s: c
  419. ! do
  420. !     case "$c" in
  421. !     g)    command=get;;
  422. !     l)    command=ls;;
  423. !     m)    command=mget;;
  424. !     u)    usenetrc=y;;
  425. !     v)    verbose=y;;
  426. !     b)    binary=binary;;
  427. !     h)    hash=hash;;
  428. !     f)    ftpkeys=$OPTARG;;
  429. !     k)    key=$OPTARG;;
  430. !     s)    subdir=$OPTARG;;
  431. !     *)    echo "$USAGE" 1>&2; exit 1;;
  432. !     esac
  433. ! done
  434.   
  435. ! shift `expr $OPTIND - 1`
  436.   
  437. ! # Check variable consistency
  438.   
  439. ! case "$ftpkeys" in
  440. ! "")    ftpkeys=/dev/null;;
  441. ! esac
  442. ! case "$key" in
  443. ! "")    ftpkeys=/dev/null
  444. !     case "$#" in
  445. !     0)    echo "$prog: no host on command line" 1>&2
  446. !         echo "$USAGE" 1>&2; exit 1
  447.           ;;
  448. !     1)    host=$1; shift;;
  449. !     *)    host=$1; topdir=$2; shift 2;;
  450. !     esac
  451. !     ;;
  452. ! *)    str=`grep -e "^$key[     ]" $ftpkeys`
  453. !     case "$str" in
  454. !     "")    echo "$prog: key '$key' not in file '$ftpkeys'" 1>&2; exit 1;;
  455. !     esac
  456. !     host=`echo "$str" | awk '{ print $2 }'`
  457. !     case "$host" in
  458. !     "")    echo "$prog: host not found in key entry '$str'" 1>&2; exit 1;;
  459. !     esac
  460. !     topdir=`echo "$str" | awk '{ print $3 }'`
  461. !     ;;
  462. ! esac
  463. ! case "$command" in
  464. ! ls)    ;;
  465. ! get)    case "$#" in
  466. !     1|2)    ;;
  467. !     *)    echo "$prog: too many args for get command ($*)" 1>&2
  468. !         echo "$USAGE" 1>&2; exit 1
  469.           ;;
  470. !     esac
  471. !     ;;
  472. ! mget)    case "$1" in
  473. !     "")    echo "$prog: too few args for mget command ($*)" 1>&2
  474. !         echo "$USAGE" 1>&2; exit 1
  475.           ;;
  476.       esac
  477. !     ;;
  478. ! *)    echo "$prog: command not set -- this should never happen" 1>&2
  479. !     echo "$USAGE" 1>&2; exit 1
  480. !     ;;
  481. ! esac
  482. ! # Set arguments to FTP command
  483. ! case "$usenetrc" in
  484. ! n)    optn=-n;;
  485. ! esac
  486. ! case "$verbose" in
  487. ! y)    optv=-v;;
  488. ! esac
  489. ! # Do the FTP thing
  490. ! (
  491. !     case "$usenetrc" in
  492. !     n)    echo user anonymous $USER@$HOST;;
  493. !     esac
  494. !     case "$topdir" in
  495. !     ?*)    echo cd $topdir;;
  496. !     esac
  497. !     case "$subdir" in
  498. !     ?*)    echo cd $subdir;;
  499. !     esac
  500. !     echo $binary
  501. !     echo $hash
  502. !     echo $command $*
  503.       echo bye
  504. ! ) | ftp -i $optn $optv $host
  505.   
  506.   exit $?
  507. *** sftp.1.orig    Fri Jul 16 23:35:20 1993
  508. --- sftp.1    Fri Jul 16 23:35:20 1993
  509. ***************
  510. *** 1,42 ****
  511. ! .\" man page
  512.   .\" Michael S Zraly
  513.   .\" mzraly@cs.umb.edu
  514. ! .\" 26 July 1992
  515.   .\"
  516.   .TH SFTP 1 "July 25, 1992"
  517.   .SH NAME
  518. ! sftp \- "surgical" FTP interface
  519.   .SH SYNOPSIS
  520. ! \fBsftp \-g\fP [\fB\-duvbh\fP]
  521. ! machine dir local [remote]
  522. ! .br
  523. ! \fBsftp \-g\fP [\fB\-duvbh\fP]
  524. ! [\fB\-f\fPfile] \fB\-k\fPkey \fB\-s\fPsubdir local [remote]
  525. ! .br
  526. ! \fBsftp \-l\fP [\fB\-duvbh\fP]
  527. ! machine dir [files]
  528. ! .br
  529. ! \fBsftp \-l\fP [\fB\-duvbh\fP]
  530. ! [\fB\-f\fPfile] \fB\-k\fPkey \fB\-s\fPsubdir [files]
  531. ! .br
  532. ! \fBsftp \-m\fP [\fB\-duvbh\fP]
  533. ! machine dir file[s]
  534. ! .br
  535. ! \fBsftp \-m\fP [\fB\-duvbh\fP]
  536. ! [\fB\-f\fPfile] \fB\-k\fPkey \fB\-s\fPsubdir file[s]
  537. ! .br
  538.   .SH DESCRIPTION
  539. ! .PP
  540.   .I sftp
  541.   is a front end for the get, ls, and mget commands of
  542.   .IR ftp (1).
  543.   It provides the means for a user to execute a ``surgical strike''
  544.   into an FTP site; that is, the FTP session is quick, direct, and
  545. ! effective.  Little time is wasted.
  546. ! Note that this command is very useful in conjunction with the
  547. ! .IR archie (1)
  548. ! client.
  549. ! .PP
  550.   Which command is used depends on which of the options
  551.   .BR \-g ,
  552.   .BR \-l ,
  553. --- 1,35 ----
  554. ! .\" sftp manual-page
  555.   .\" Michael S Zraly
  556.   .\" mzraly@cs.umb.edu
  557. ! .\" 26 July 1992 original
  558. ! .\" 16 July 1993 updated
  559.   .\"
  560.   .TH SFTP 1 "July 25, 1992"
  561.   .SH NAME
  562. ! sftp \- ``surgical'' FTP interface
  563.   .SH SYNOPSIS
  564. ! .B sftp
  565. ! [
  566. ! .B \-glmbhuv
  567. ! ]
  568. ! [
  569. ! .BI \-s " sub"
  570. ! ]
  571. ! (host [dir] |
  572. ! [
  573. ! .BI \-f " file"
  574. ! ]
  575. ! .BI \-k " key)"
  576. ! file...
  577.   .SH DESCRIPTION
  578. ! .LP
  579.   .I sftp
  580.   is a front end for the get, ls, and mget commands of
  581.   .IR ftp (1).
  582.   It provides the means for a user to execute a ``surgical strike''
  583.   into an FTP site; that is, the FTP session is quick, direct, and
  584. ! effective.
  585. ! .LP
  586.   Which command is used depends on which of the options
  587.   .BR \-g ,
  588.   .BR \-l ,
  589. ***************
  590. *** 54,70 ****
  591.   file which contains lines of the form:
  592.   .RS
  593.   .sp
  594. ! keyword machine directory
  595.   .sp
  596.   .RE
  597.   The
  598.   .I ftpkeys
  599. ! file may be specified by the environment variable
  600. ! ``FTPKEYS''.  If this variable is not set,
  601. ! the current directory will be searched for a file
  602. ! named ``.ftpkeys''; finally, if there is no such
  603. ! file in the current directory, the user's home
  604. ! directory will be searched for a ``.ftpkeys'' file.
  605.   .SH OPTIONS
  606.   .TP
  607.   .B \-g
  608. --- 47,62 ----
  609.   file which contains lines of the form:
  610.   .RS
  611.   .sp
  612. ! keyword machine [directory]
  613.   .sp
  614.   .RE
  615.   The
  616.   .I ftpkeys
  617. ! file may be specified by the environment variable ``FTPKEYS''.
  618. ! If this variable is not set,
  619. ! the current directory will be searched for a file named ``.ftpkeys'';
  620. ! if there is no such file in the current directory,
  621. ! the user's home directory will be searched for a ``.ftpkeys'' file.
  622.   .SH OPTIONS
  623.   .TP
  624.   .B \-g
  625. ***************
  626. *** 82,90 ****
  627.   .I mget
  628.   command.
  629.   .TP
  630. ! .B \-d
  631. ! Rather than executing FTP command,
  632. ! print debugging information.
  633.   .TP
  634.   .B \-u
  635.   Rather than FTP'ing anonymously, use the
  636. --- 74,89 ----
  637.   .I mget
  638.   command.
  639.   .TP
  640. ! .B \-b
  641. ! Before file transfer, give the FTP
  642. ! .I binary
  643. ! command.
  644. ! Some FTP daemons automatically issue this command.
  645. ! .TP
  646. ! .B \-h
  647. ! Before file transfer, give the FTP
  648. ! .I hash
  649. ! command.
  650.   .TP
  651.   .B \-u
  652.   Rather than FTP'ing anonymously, use the
  653. ***************
  654. *** 99,178 ****
  655.   .IR ftp (1)
  656.   command, so that the session is printed to the terminal.
  657.   .TP
  658. ! .B \-b
  659. ! Before file transfer, give the FTP
  660. ! .I binary
  661. ! command.  Note that some FTP daemons automatically issue this command.
  662. ! .TP
  663. ! .B \-h
  664. ! Before file transfer, give the FTP
  665. ! .I hash
  666. ! command.
  667. ! .TP
  668. ! .BR \-f file
  669.   Use
  670.   .I file
  671.   in place of ``$FTPKEYS'' or ``./.ftpkeys'' or ``~/.ftpkeys''
  672.   (see above).
  673.   .TP
  674. ! .BR \-k key
  675. ! Use key to search for appropriate entry in
  676.   .I ftpkeys
  677.   file to determine target machine and directory.
  678.   .TP
  679. ! .BR \-s sub
  680. ! Append
  681. ! .I sub
  682. ! to target directory.  Used mainly with the
  683.   .B \-k
  684.   option, but allowed without it.
  685.   .SH EXAMPLES
  686. ! .PP
  687. ! To list the top-level at ftp.uu.net:
  688.   .RS
  689.   .sp
  690.   sftp ftp.uu.net /
  691.   .RE
  692. ! .PP
  693.   To get the shell script from which this command is ultimately derived:
  694.   .RS
  695.   .sp
  696.   sftp -g pilot.njin.net pub/ftp-list getfile
  697.   .RE
  698. ! .PP
  699.   To view that file without actually copying it to the local machine:
  700.   .RS
  701.   .sp
  702.   sftp -g pilot.njin.net pub/ftp-list getfile "|cat"
  703.   .RE
  704. ! .PP
  705. ! To read that file through a more complicated command,
  706.   or any command with spaces in it, nest quotation marks thusly:
  707.   .RS
  708.   .sp
  709. ! sftp -g pilot.njin.net pub/ftp-list getfile '"|more -c"'
  710. ! .RE
  711. ! .PP
  712. ! To get the index for comp.sources.misc:
  713. ! .RS
  714. ! .sp
  715. ! sftp -g ftp.uu.net usenet/comp.sources.misc index
  716.   .RE
  717. ! .PP
  718. ! To get all the compressed files from that directory:
  719. ! (Note that single quotes are used to prevent expansion
  720. ! of the shell metacharacter ``*'').
  721.   .RS
  722.   .sp
  723.   sftp -m ftp.uu.net usenet/comp.sources.misc '*.Z'
  724.   .RE
  725. ! .PP
  726.   Assume there is an entry in the ftpkeys file:
  727.   .RS
  728.   .sp
  729.   CSG ftp.uu.net usenet/comp.sources.games
  730.   .RE
  731. ! .PP
  732.   Now to get the sources for the 
  733.   .IR rogue (6)
  734.   clone:
  735. --- 98,169 ----
  736.   .IR ftp (1)
  737.   command, so that the session is printed to the terminal.
  738.   .TP
  739. ! .BI \-f file
  740.   Use
  741.   .I file
  742.   in place of ``$FTPKEYS'' or ``./.ftpkeys'' or ``~/.ftpkeys''
  743.   (see above).
  744.   .TP
  745. ! .BI \-k key
  746. ! Use
  747. ! .I key
  748. ! to search for appropriate entry in
  749.   .I ftpkeys
  750.   file to determine target machine and directory.
  751.   .TP
  752. ! .BI \-s sub
  753. ! After changing directory to
  754. ! .IR dir ,
  755. ! as specified on the command line,
  756. ! change directory again to
  757. ! .IR sub .
  758. ! Used mainly with the
  759.   .B \-k
  760.   option, but allowed without it.
  761.   .SH EXAMPLES
  762. ! .LP
  763. ! Three ways to list the top-level directory at ftp.uu.net:
  764.   .RS
  765.   .sp
  766. + sftp ftp.uu.net
  767. + .br
  768.   sftp ftp.uu.net /
  769. + .br
  770. + sftp -s / ftp.uu.net
  771.   .RE
  772. ! .LP
  773.   To get the shell script from which this command is ultimately derived:
  774.   .RS
  775.   .sp
  776.   sftp -g pilot.njin.net pub/ftp-list getfile
  777.   .RE
  778. ! .LP
  779.   To view that file without actually copying it to the local machine:
  780.   .RS
  781.   .sp
  782.   sftp -g pilot.njin.net pub/ftp-list getfile "|cat"
  783.   .RE
  784. ! .LP
  785. ! To read a file through a more complicated command,
  786.   or any command with spaces in it, nest quotation marks thusly:
  787.   .RS
  788.   .sp
  789. ! sftp -g world.std.com  / README '"|more -c"'
  790.   .RE
  791. ! .LP
  792. ! To get all the compressed files from the comp.sources.misc directory:
  793. ! (Single quotes are used to prevent shell expansion of ``*'').
  794.   .RS
  795.   .sp
  796.   sftp -m ftp.uu.net usenet/comp.sources.misc '*.Z'
  797.   .RE
  798. ! .LP
  799.   Assume there is an entry in the ftpkeys file:
  800.   .RS
  801.   .sp
  802.   CSG ftp.uu.net usenet/comp.sources.games
  803.   .RE
  804. ! .LP
  805.   Now to get the sources for the 
  806.   .IR rogue (6)
  807.   clone:
  808. ***************
  809. *** 196,212 ****
  810.   directory\-entries.
  811.   See the DESCRIPTION section above for more information.
  812.   .SH "SEE ALSO"
  813. ! .PP
  814. ! .IR archie (1),
  815. ! .IR awk (1),
  816.   .IR ftp (1),
  817. ! .IR getopts (1),
  818. ! .IR grep (1),
  819. ! .IR sh (1),
  820. ! .IR test (1).
  821.   .SH BUGS
  822. ! .PP
  823.   The keyword lookup scheme could be more fully developed.
  824.   .SH AUTHOR
  825. ! .PP
  826.   Michael S Zraly (mzraly@cs.umb.edu)
  827. --- 187,198 ----
  828.   directory\-entries.
  829.   See the DESCRIPTION section above for more information.
  830.   .SH "SEE ALSO"
  831. ! .LP
  832.   .IR ftp (1),
  833. ! .IR sh (1).
  834.   .SH BUGS
  835. ! .LP
  836.   The keyword lookup scheme could be more fully developed.
  837.   .SH AUTHOR
  838. ! .LP
  839.   Michael S Zraly (mzraly@cs.umb.edu)
  840.