home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / ncftp / part05 < prev    next >
Encoding:
Text File  |  1993-11-02  |  60.5 KB  |  2,438 lines

  1. Newsgroups: comp.sources.misc
  2. From: mgleason@cse.unl.edu (Mike Gleason)
  3. Subject: v40i080:  ncftp - Alternative User Interface for FTP, v1.6, Part05/06
  4. Message-ID: <1993Nov2.232451.6539@sparky.sterling.com>
  5. X-Md4-Signature: b6d7fd2222a04a997fff3647a2742d32
  6. Keywords: ncftp
  7. Sender: kent@sparky.sterling.com (Kent Landfield)
  8. Organization: NCEMRSoft
  9. Date: Tue, 2 Nov 1993 23:24:51 GMT
  10. Approved: kent@sparky.sterling.com
  11.  
  12. Submitted-by: mgleason@cse.unl.edu (Mike Gleason)
  13. Posting-number: Volume 40, Issue 80
  14. Archive-name: ncftp/part05
  15. Environment: UNIX, ANSI-C, !SVR4
  16. Supersedes: ncftp: Volume 39, Issue 53-57
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then feed it
  20. # into a shell via "sh file" or similar.  To overwrite existing files,
  21. # type "sh file -c".
  22. # Contents:  Blurb cmds.h cmdtab.c defaults.h ftp.h getpass.c glob.c
  23. #   sys.h tips.c util.h v2_Note
  24. # Wrapped by kent@sparky on Mon Nov  1 16:19:17 1993
  25. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
  26. echo If this archive is complete, you will see the following message:
  27. echo '          "shar: End of archive 5 (of 6)."'
  28. if test -f 'Blurb' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'Blurb'\"
  30. else
  31.   echo shar: Extracting \"'Blurb'\" \(2188 characters\)
  32.   sed "s/^X//" >'Blurb' <<'END_OF_FILE'
  33. XSubject:  NcFTP 1.6.0 - Alternative User Interface for FTP
  34. X
  35. XArchive-name: ncftp/part01
  36. XEnvironment: UNIX, ANSI-C, !SVR4
  37. XSupersedes: ncftp: Volume 39, Issue 53-57
  38. X
  39. XNcFTP - Alternative user interface for FTP
  40. XVersion 1.6.0 by Mike Gleason, NCEMRSoft.
  41. X
  42. XI used to list the features of ncftp in this blurb, but there are just
  43. Xtoo many to list.  Even if you only ftp occasionally, it is worth your
  44. Xtime to install ncftp (or atleast bug your sysadmin to).  If you won't take
  45. Xmy word for it, just ask around, or extract this archive and read the
  46. Xman page.
  47. X
  48. X1.6.0 is an "evolutionary" upgrade, which consolidates all the previous
  49. Xpatches and adds a little.  1.6, like 1.5 are "interim" versions between
  50. X2.0 which has been suspended indefinitely due to time constraints.
  51. X
  52. XMajor changes since 1.5.6:
  53. X-------------------------
  54. X
  55. X* Built-in support for the "term" package, used by Linux, etc.
  56. X
  57. X* SCO Xenix, Besta, AIX 2, AIX 3, Dynix/PTX support
  58. X
  59. X* Better ISC Unix support.
  60. X
  61. X* Several bug fixes.
  62. X
  63. X
  64. XMajor changes since 1.0.2:
  65. X-------------------------
  66. X
  67. X* Supports the Getline (input-edit) and GNU Readline command-line
  68. X  editing and history libraries.
  69. X
  70. X* Supports the Socks firewall library, and another firewall gateway
  71. X  implementation.
  72. X
  73. X* Terrific new "recent-sites" file that automatically saves the
  74. X  sites you call;  when you open a site in the recent-sites file
  75. X  (of course you can abbreviate the names), you start in the
  76. X  same directory you were in last time.
  77. X
  78. X* Improved on-line help, and tips on how to use the program better
  79. X  are printed each time you run the program.
  80. X
  81. X* Rewritten man page.
  82. X
  83. X* Faster ascii transfers.
  84. X
  85. X* Typing 'open' by itself lists all the sites the program knows
  86. X  about (the ones in your .netrc and the recent-sites list) so
  87. X  you can just pick one.
  88. X
  89. X* Enhanced colon-mode, that can dump a file to stdout (ftpcat mode)
  90. X  or to a pager.  (i.e. ncftp -c wu:/README >/dev/null).
  91. X
  92. X* You can choose whether an open is anonymous by default (like it
  93. X  had always been) or a user login by default by setting a new
  94. X  program variable.
  95. X
  96. X* Bugs fixed.
  97. X
  98. XRead the enclosed file, v2_Notes, which explains why I won't be
  99. Xable to work on the nearly finished, and much improved v2.0.
  100. X
  101. END_OF_FILE
  102.   if test 2188 -ne `wc -c <'Blurb'`; then
  103.     echo shar: \"'Blurb'\" unpacked with wrong size!
  104.   fi
  105.   # end of 'Blurb'
  106. fi
  107. if test -f 'cmds.h' -a "${1}" != "-c" ; then 
  108.   echo shar: Will not clobber existing file \"'cmds.h'\"
  109. else
  110.   echo shar: Extracting \"'cmds.h'\" \(3287 characters\)
  111.   sed "s/^X//" >'cmds.h' <<'END_OF_FILE'
  112. X/* cmds.h */
  113. X
  114. X#ifndef _cmd_h_
  115. X#define _cmd_h_
  116. X
  117. X/*  $RCSfile: cmds.h,v $
  118. X *  $Revision: 14020.11 $
  119. X *  $Date: 93/07/09 10:58:19 $
  120. X */
  121. X
  122. X/* Verbosity levels. */
  123. X#define V_QUIET        -1
  124. X#define V_ERRS        0
  125. X#define V_TERSE        1
  126. X#define V_VERBOSE    2
  127. X#define V_IMPLICITCD 4
  128. X#define IS_VQUIET    (verbose <= V_QUIET)
  129. X#define IS_VERRS    (verbose == V_ERRS)
  130. X#define IS_VTERSE    (verbose == V_TERSE)
  131. X#define IS_VVERBOSE    (verbose == V_VERBOSE)
  132. X#define NOT_VQUIET    (verbose > V_QUIET)
  133. X
  134. X/* Open modes. */
  135. X#define OPEN_A 1
  136. X#define OPEN_U 0
  137. X
  138. X#define LS_FLAGS_AND_FILE '\1'
  139. X
  140. X/* Command result codes. */
  141. X#define USAGE (88)
  142. X#define NOERR (0)
  143. X#define CMDERR (-1)
  144. X
  145. X/*
  146. X * Format of command table.
  147. X */
  148. Xstruct cmd {
  149. X    char    *c_name;    /* name of command */
  150. X    char    c_conn;        /* must be connected to use command */
  151. X    char    c_hidden;    /* a hidden command or alias (won't show up in help) */
  152. X    int        (*c_handler)(int, char **);    /* function to call */
  153. X    char    *c_help;    /* help string */
  154. X    char    *c_usage;    /* usage string or NULL, to ask the function itself. */
  155. X};
  156. X
  157. X#define NCMDS ((int) ((sizeof (cmdtab) / sizeof (struct cmd)) - 1))
  158. X
  159. Xstruct macel {
  160. X    char mac_name[9];    /* macro name */
  161. X    char *mac_start;    /* start of macro in macbuf */
  162. X    char *mac_end;        /* end of macro in macbuf */
  163. X};
  164. X
  165. Xstruct types {
  166. X    char    *t_name;
  167. X    char    *t_mode;
  168. X    int        t_type;
  169. X    char    *t_arg;
  170. X};
  171. X
  172. Xstruct lslist {
  173. X    char            *string;
  174. X    struct lslist    *next;
  175. X};
  176. X
  177. Xint settype(int argc, char **argv);
  178. Xint _settype(char *typename);
  179. Xint setbinary(int argc, char **argv);
  180. Xint setascii(int argc, char **argv);
  181. Xint put(int argc, char **argv);
  182. Xint mput(int argc, char **argv);
  183. Xint rem_glob_one(char *pattern);
  184. Xint get(int argc, char **argv);
  185. Xvoid mabort SIG_PARAMS;
  186. Xint mget(int argc, char **argv);
  187. Xchar *remglob(char *argv[]);
  188. Xint setverbose(int argc, char **argv);
  189. Xint setprompt(int argc, char **argv);
  190. Xint setdebug(int argc, char **argv);
  191. Xvoid fix_options(void);
  192. Xint cd(int argc, char **argv);
  193. Xint implicit_cd(char *dir);
  194. Xint _cd(char *dir);
  195. Xint lcd(int argc, char **argv);
  196. Xint do_delete(int argc, char **argv);
  197. Xint mdelete(int argc, char **argv);
  198. Xint renamefile(int argc, char **argv);
  199. Xint ls(int argc, char **argv);
  200. Xint shell(int argc, char **argv);
  201. Xint do_user(int argc, char **argv);
  202. Xint pwd(int argc, char **argv);
  203. Xint makedir(int argc, char **argv);
  204. Xint removedir(int argc, char **argv);
  205. Xint quote(int argc, char **argv);
  206. Xint rmthelp(int argc, char **argv);
  207. Xint quit(int argc, char **argv);
  208. Xvoid close_streams(int wantShutDown);
  209. Xint disconnect(int argc, char **argv);
  210. Xvoid close_up_shop(void);
  211. Xint globulize(char **cpp);
  212. Xint cdup(int argc, char **argv);
  213. Xint syst(int argc, char **argv);
  214. Xint make_macro(char *name, FILE *fp);
  215. Xint macdef(int argc, char **argv);
  216. Xint domacro(int argc, char **argv);
  217. Xint sizecmd(int argc, char **argv);
  218. Xint modtime(int argc, char **argv);
  219. Xint lookup(int argc, char **argv);
  220. Xint rmtstatus(int argc, char **argv);
  221. Xint create(int argc, char **argv);
  222. Xint getlocalhostname(char *host, size_t size);
  223. Xint show_version(int argc, char **argv);
  224. Xvoid PurgeLineBuffer(void);
  225. Xint ShowLineBuffer(int argc, char **argv);
  226. Xint unimpl(int argc, char **argv);
  227. Xlong GetDateAndSize(char *fName, unsigned long *mod_time);
  228. Xint SetTypeByNumber(int i);
  229. X
  230. X/* In util.c: */
  231. Xvoid cmd_help(struct cmd *c);
  232. Xvoid cmd_usage(struct cmd *c);
  233. Xstruct cmd *getcmd(char *name);
  234. X
  235. X#endif    /* _cmd_h_ */
  236. END_OF_FILE
  237.   if test 3287 -ne `wc -c <'cmds.h'`; then
  238.     echo shar: \"'cmds.h'\" unpacked with wrong size!
  239.   fi
  240.   # end of 'cmds.h'
  241. fi
  242. if test -f 'cmdtab.c' -a "${1}" != "-c" ; then 
  243.   echo shar: Will not clobber existing file \"'cmdtab.c'\"
  244. else
  245.   echo shar: Extracting \"'cmdtab.c'\" \(10893 characters\)
  246.   sed "s/^X//" >'cmdtab.c' <<'END_OF_FILE'
  247. X/* cmdtab.c */
  248. X
  249. X/*  $RCSfile: cmdtab.c,v $
  250. X *  $Revision: 14020.11 $
  251. X *  $Date: 93/07/09 11:04:56 $
  252. X */
  253. X
  254. X#include "sys.h"
  255. X#include "util.h"
  256. X#include "cmds.h"
  257. X#include "main.h"
  258. X#include "ftp.h"
  259. X#include "ftprc.h"
  260. X#include "glob.h"
  261. X#include "open.h"
  262. X#include "set.h"
  263. X#include "copyright.h"
  264. X
  265. X#define REMOTEFILE " remote-file-name"
  266. X#define REMOTEFILES " remote-file-names and/or UNIX-style-wildcards"
  267. X#define LOCALFILE " local-file-name"
  268. X#define LOCALFILES " local-file-names and/or UNIX-style-wildcards"
  269. X#define LDIRNAME " local-directory-name"
  270. X#define RMTDIRNAME " remote-directory-name"
  271. X#define EMPTYSTR ""
  272. X#define TOGGLE " [on | off] (no argument toggles the switch)"
  273. X
  274. X#define BINARYHELP "transfer files as binary files, without CR/LF translation"
  275. X#define BINARYUSAGE EMPTYSTR
  276. X
  277. X#define CHDIRHELP "changes the current remote working directory"
  278. X#define CHDIRUSAGE RMTDIRNAME
  279. X
  280. X#define CLOSEHELP "closes FTP connection to current remote host"
  281. X#define CLOSEUSAGE EMPTYSTR
  282. X
  283. X#define DELETEHELP "deletes the specified file on the remote host"
  284. X#define DELETEUSAGE REMOTEFILE
  285. X
  286. X#define DIRUSAGE " \
  287. X[flags] [remote-items] [>outfile or \"|pipecmd [cmd-args]\"]\n\
  288. X    Note that there must be no whitespace between > and outfile, or | and\n\
  289. X    pipecmd, and if the pipe-command needs arguments, you must enclose the\n\
  290. X    whole thing with double quotes.\n\
  291. XExamples:\n\
  292. X    dir -s\n\
  293. X    dir remoteFile\n\
  294. X    dir /pub/mac \"|head -20\"\n\
  295. X    dir -rtR file1 file2 dir1 >contents.txt"
  296. X
  297. X#define GETUSAGE " remote-file-name [local-file-name or |pipecommand]\n\
  298. XExamples:\n\
  299. X    get myfile.txt\n\
  300. X    get MYFILE.ZIP myfile.zip\n\
  301. X    get myfile.txt |head\n\
  302. X    get myfile.txt \"|head -20\"\n\
  303. X    get ./help/newuser.txt    (./newuser.txt will be local-file-name)\n\
  304. X    get ./help/newuser.txt ./docs/newbie.help\n\
  305. X    get my*.txt  (pseudo-filename-completion if match is unique, i.e. myfile.txt)"
  306. X
  307. X#define    HELPHELP "shows commands, and optionally tell you how to use a specific one"
  308. X#define    HELPUSAGE " [command-name | showall (shows hidden commands) | helpall"
  309. X
  310. X#define LSHELP "prints remote directory contents (short-mode)"
  311. X#define LSUSAGE " \
  312. X[flags] [remote-items] [>outfile or \"|pipecmd [cmd-args]\"]\n\
  313. X    Note that there must be no whitespace between > and outfile, or | and\n\
  314. X    pipecmd, and if the pipe-command needs arguments, you must enclose the\n\
  315. X    whole thing with double quotes.\n\
  316. XExamples:\n\
  317. X    ls -s\n\
  318. X    ls remoteFile\n\
  319. X    ls /pub/mac \"|head -20\"\n\
  320. X    ls -lrtR file1 file2 dir1 >contents.txt"
  321. X
  322. X#define OPENHELP "connects to a new remote host, and optionally fetches a file\n\
  323. X    or sets the current remote working directory"
  324. X#define OPENUSAGE " \
  325. X[-a | -u] [-i] [-p N] [-r [-d N] [-g N]] hostname[:pathname]\n\
  326. X    -a     : Open anonymously (this is the default).\n\
  327. X    -u     : Open, specify user/password.\n\
  328. X    -i     : Ignore machine entry in your .netrc.\n\
  329. X    -p N   : Use port #N for connection.\n\
  330. X    -r     : \"Redial\" until connected.\n\
  331. X    -d N   : Redial, pausing N seconds between tries.\n\
  332. X    -g N   : Redial, giving up after N tries.\n\
  333. X    :path  : Open site, then retrieve file \"path.\""
  334. X
  335. X#define PAGEHELP "view a file on the remote host with your $PAGER"
  336. X#define PAGEUSAGE REMOTEFILE
  337. X
  338. X#define PDIRUSAGE " [flags] [remote-files]"
  339. X
  340. X#define PUTHELP "sends a local file to the current remote host"
  341. X#define PUTUSAGE " local-file-name [remote-file-name]"
  342. X
  343. X#define QUITHELP "quits the program"
  344. X#define QUITUSAGE EMPTYSTR
  345. X
  346. X#define RHELPHELP "asks the remote-server for help"
  347. X#define RHELPUSAGE " [help-topic (i.e. FTP command)]"
  348. X
  349. X#define UNIMPLHELP "this command is not supported"
  350. X#define UNIMPLUSAGE (NULL)
  351. X
  352. Xstruct cmd cmdtab[] = {
  353. X    /* name ; must-be-connected ; hidden ; help-string ; usage-string */
  354. X    { "!",                0,  0,  shell,
  355. X        "spawns a shell for you to run other commands",
  356. X        " [single-command-and-arguments]" },
  357. X    { "$",                0,  0,  domacro,
  358. X        "runs a macro previously defined in your NETRC, or with the macdef cmd",
  359. X        "macro-number" },
  360. X    { "account",       0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  361. X    { "append",        0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  362. X    { "ascii",            1,  1,  setascii,
  363. X        "transfer files as text files, with proper CR/LF translation",
  364. X        "" },
  365. X    { "bell",          0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  366. X    { "binary",           1,  1,  setbinary, BINARYHELP, BINARYUSAGE },
  367. X    { "bye",              0,  1,  quit, QUITHELP, QUITUSAGE },
  368. X    { "case",          0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  369. X    { "cd",               1,  0,  cd, CHDIRHELP, CHDIRUSAGE },
  370. X    { "cdup",             1,  0,  cdup,
  371. X        "changes the current remote working directory to it's parent",
  372. X        "" },
  373. X    { "chdir",            1,  1,  cd, CHDIRHELP, CHDIRUSAGE },
  374. X    { "close",            1,  1,  disconnect, CLOSEHELP, CLOSEUSAGE },
  375. X    { "connect",          0,  1,  cmdOpen, OPENHELP, OPENUSAGE },
  376. X    { "cr",            0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  377. X    { "create",           1,  0,  create,
  378. X        "create an empty file on the remote host",
  379. X        REMOTEFILE },
  380. X    { "delete",           1,  0,  do_delete, DELETEHELP, DELETEUSAGE },
  381. X    { "debug",            0,  1,  setdebug,
  382. X        "to print debugging messages during execution of the program",
  383. X        TOGGLE },
  384. X    { "dir",              1,  0,  ls,
  385. X        "prints remote directory contents (long-mode)",
  386. X        DIRUSAGE },
  387. X    { "erase",            1,  1,  do_delete, DELETEHELP, DELETEUSAGE },
  388. X    { "exit",             0,  1,  quit, QUITHELP, QUITUSAGE },
  389. X    { "form",          0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  390. X    { "get",              1,  0,  get,
  391. X        "fetches a file from the current remote host", GETUSAGE },
  392. X    { "glob",          0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  393. X    { "hash",             0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  394. X    { "help",             0,  0,  help, HELPHELP, HELPUSAGE },
  395. X    { "idle",             0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  396. X    { "image",            1,  1,  setbinary, BINARYHELP, BINARYUSAGE },
  397. X    { "lcd",              0,  0,  lcd,
  398. X        "changes the current local directory", LDIRNAME },
  399. X    { "lookup",           0,  0,  lookup,
  400. X        "uses the name-server to tell you a host's IP number given it's\n\
  401. X    name, or it's name given it's IP number",
  402. X        " hostname | host-IP-number" },
  403. X    { "ls",               1,  0,  ls, LSHELP, LSUSAGE },
  404. X    { "macdef",           0,  0,  macdef,
  405. X        "defines a macro which is expanded when you use the $ command",
  406. X        " new-macro-name" },
  407. X    { "mdelete",          1,  0,  mdelete,
  408. X        "deletes multiple files on the remote host", REMOTEFILES  },
  409. X    { "mdir",             1,  1,  ls, LSHELP, LSUSAGE },
  410. X    { "mget",             1,  0,  mget,
  411. X        "fetches multiple files from the remote host", REMOTEFILES },
  412. X    { "mkdir",            1,  0,  makedir,
  413. X        "creates a new sub-directory on the current remote host",
  414. X        RMTDIRNAME },
  415. X    { "mls",              1,  0,  ls, LSHELP, LSUSAGE },
  416. X    { "mode",          0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  417. X    { "modtime",          1,  0,  modtime,
  418. X        "shows the last modification date for a remote file",
  419. X        REMOTEFILE },
  420. X    { "more",             1,  1,  get, PAGEHELP, PAGEUSAGE },
  421. X    { "mput",             1,  0,  mput,
  422. X        "sends multiple local files to the current remote host",
  423. X        LOCALFILES },
  424. X    { "newer",         0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  425. X    { "nlist",            1,  1,  ls, LSHELP, LSUSAGE },
  426. X    { "nmap",          0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  427. X    { "ntrans",        0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  428. X    { "open",             0,  0,  cmdOpen, OPENHELP, OPENUSAGE },
  429. X    { "p",             1,  1,  get, PAGEHELP, PAGEUSAGE },
  430. X    { "page",             1,  0,  get, PAGEHELP, PAGEUSAGE },
  431. X    { "pdir",             1,  0,  ls,
  432. X        "view a remote directory listing (long mode) with your $PAGER",
  433. X        PDIRUSAGE },
  434. X    { "pls",              1,  0,  ls,
  435. X        "view a remote directory listing (short mode) with your $PAGER",
  436. X        PDIRUSAGE },
  437. X    { "predir",           1,  0,  ShowLineBuffer,
  438. X        "view the last remote directory listing with your $PAGER",
  439. X        EMPTYSTR },
  440. X    { "prompt",           0,  1,  setprompt,
  441. X        "toggle interactive prompting on multiple commands",
  442. X        TOGGLE },
  443. X    { "proxy",         0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  444. X    { "put",              1,  0,  put, PUTHELP, PUTUSAGE },
  445. X    { "pwd",              1,  0,  pwd,
  446. X        "prints the name of the current remote directory",
  447. X        EMPTYSTR },
  448. X    { "quit",             0,  0,  quit, QUITHELP, QUITUSAGE },
  449. X    { "quote",            1,  0,  quote,
  450. X        "allows advanced users to directly enter FTP commands verbatim",
  451. X        " FTP-commands" },
  452. X    { "redir",            1,  0,  ShowLineBuffer,
  453. X        "re-prints the last directory listing",
  454. X        EMPTYSTR },
  455. X    { "reget",         0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  456. X    { "remotehelp",       1,  0,  rmthelp, RHELPHELP, RHELPUSAGE },
  457. X    { "reset",         0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  458. X    { "restart",       0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  459. X    { "rm",               1,  1,  do_delete, DELETEHELP, DELETEUSAGE },
  460. X    { "rstatus",          1,  0,  rmtstatus,
  461. X        "asks the remote-server for it's status",
  462. X        EMPTYSTR },
  463. X    { "rhelp",            1,  1,  rmthelp, RHELPHELP, RHELPUSAGE },
  464. X    { "rename",           1,  0,  renamefile,
  465. X        "changes the name of a file on the current remote host",
  466. X        " old-name new-name" },
  467. X    { "rmdir",            1,  0,  removedir,
  468. X        "deletes a directory on the current remote host",
  469. X        RMTDIRNAME },
  470. X    { "runique",       0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  471. X    { "send",             1,  1,  put, PUTHELP, PUTUSAGE },
  472. X    { "sendport",      0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  473. X    { "show",             0,  0,  do_show,
  474. X        "prints the value of some or all program variables",
  475. X        " all | variable-names" },
  476. X    { "set",              0,  0,  set,
  477. X        "changes the value of a program variable; for numeric/boolean\n\
  478. X    variables sets them to 1/true",
  479. X        " variable-name [= new-value]" },
  480. X    { "site",            1,  0,  quote,
  481. X        "allows advanced users to send site-specific commands to the host",
  482. X        " site-specific-commands\n\
  483. XExample (to try on wuarchive.wustl.edu):\n\
  484. X    site locate emacs" },
  485. X    { "size",             1,  0,  sizecmd,
  486. X        "shows the size of a remote file",
  487. X        REMOTEFILE },
  488. X    { "struct",        0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  489. X    { "sunique",       0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  490. X    { "system",           1,  0,  syst,
  491. X        "tells you what type of machine the current remote host is",
  492. X        EMPTYSTR },
  493. X    { "tenex",         0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  494. X    { "umask",         0,  1,  unimpl, UNIMPLHELP, UNIMPLUSAGE },
  495. X    { "unset",            0,  0,  set,
  496. X        "resets the value of a program variable to it's default state, or for\n\
  497. X    numeric/boolean variables, sets them to 0/false",
  498. X        " variable-name" },
  499. X    { "user",             1,  0,  do_user,
  500. X        "lets you login as a new user (with appropriate password)",
  501. X        " new-user-name [new-password]" },
  502. X    { "type",             1,  0,  settype,
  503. X        "changes the current file transfer method",
  504. X        " ascii | binary | ebcdic | tenex" },
  505. X    { "verbose",          0,  0,  setverbose,
  506. X        "controls how many message the program prints in response to commands",
  507. X        " -1 (quiet) | 0 (errs) | 1 (terse) | 2 (verbose)" },
  508. X    { "version",          0,  0,  show_version,
  509. X        "prints information about the program",
  510. X        EMPTYSTR },
  511. X    { "?",                0,  1,  help, HELPHELP, HELPUSAGE },
  512. X    { NULL,               0,  0,  NULL, NULL, NULL }
  513. X};
  514. X
  515. X/* eof cmdtab.c */
  516. END_OF_FILE
  517.   if test 10893 -ne `wc -c <'cmdtab.c'`; then
  518.     echo shar: \"'cmdtab.c'\" unpacked with wrong size!
  519.   fi
  520.   # end of 'cmdtab.c'
  521. fi
  522. if test -f 'defaults.h' -a "${1}" != "-c" ; then 
  523.   echo shar: Will not clobber existing file \"'defaults.h'\"
  524. else
  525.   echo shar: Extracting \"'defaults.h'\" \(2811 characters\)
  526.   sed "s/^X//" >'defaults.h' <<'END_OF_FILE'
  527. X/* Defaults.h: default values for ftp's common variables */
  528. X
  529. X/* These are all surrounded by #ifndef blocks so you can just use
  530. X * the -D flag with your compiler (i.e. -DZCAT=\"/usr/local/bin/zcat\").
  531. X */
  532. X
  533. X#ifndef _DEFAULTS_H_
  534. X#define _DEFAULTS_H_
  535. X
  536. X/*  $RCSfile: defaults.h,v $
  537. X *  $Revision: 14020.13 $
  538. X *  $Date: 93/07/09 10:58:27 $
  539. X */
  540. X
  541. X#ifndef NEWMAILMESSAGE            /* For english speakers, "You have new mail." */
  542. X#define NEWMAILMESSAGE "You have new mail."
  543. X#endif
  544. X
  545. X#ifndef ZCAT                    /* Usually "zcat," but use the full pathname */
  546. X                                /* if possible. */
  547. X#    ifdef GZCAT                    /* If you said you had gnu's zcat, use it
  548. X                                 * since it can do .Z files too.
  549. X                                 */
  550. X
  551. X#        define ZCAT GZCAT
  552. X#    else /* !GZCAT */
  553. X#        define ZCAT "zcat"
  554. X#    endif    /* ifdef GZCAT */
  555. X#endif    /* ifndef ZCAT */
  556. X
  557. X#ifndef MAX_XFER_BUFSIZE
  558. X#define MAX_XFER_BUFSIZE 32768
  559. X#endif
  560. X
  561. X#ifndef dANONOPEN                /* 1 or 0, usually 1 */
  562. X#define dANONOPEN    1
  563. X#endif
  564. X
  565. X#ifndef dDEBUG                    /* 1 or 0, usually 0 */
  566. X#define dDEBUG 0
  567. X#endif
  568. X
  569. X#ifndef dMPROMPT                /* Usually 1, I prefer 0... */
  570. X#define dMPROMPT 0
  571. X#endif
  572. X
  573. X#ifndef dVERBOSE                /* V_QUIET, V_ERRS, V_TERSE, V_VERBOSE */
  574. X#define dVERBOSE V_TERSE
  575. X#endif
  576. X
  577. X#ifndef dPROMPT                    /* short: "@Bftp@P>" */
  578. X                                /* long: "@B@E @UNcFTP@P @B@M@D@P ->" */
  579. X#define dPROMPT "@B@c@Mncftp@P>" /* new two line prompt */
  580. X#endif
  581. X
  582. X#ifndef dPAGER                    /* if set to empty string, act like 'cat' */
  583. X#define dPAGER "more"
  584. X#endif
  585. X
  586. X#ifndef dLOGNAME                /* usu. put in the user's home directory. */
  587. X#define dLOGNAME "~/.ftplog"
  588. X#endif
  589. X
  590. X#ifndef dRECENTF                /* usu. put in the user's home directory. */
  591. X#define dRECENTF "~/.ncrecent"
  592. X#endif
  593. X
  594. X#ifndef dMAXRECENTS                /* limit to how many recent sites to save. */
  595. X#define dMAXRECENTS 16
  596. X#endif
  597. X
  598. X#ifndef dRECENT_ON                /* Do you want the recent log on? */
  599. X                                /* usually 1. */
  600. X#define dRECENT_ON 1
  601. X#endif
  602. X
  603. X                                /* Do you want logging on by default? */
  604. X#ifndef dLOGGING                /* usually 0 */
  605. X#define dLOGGING 0
  606. X#endif
  607. X
  608. X#ifndef dTYPE                    /* usually TYPE_A */
  609. X#define dTYPE TYPE_A
  610. X#endif
  611. X
  612. X#ifndef dTYPESTR                /* usually "ascii" */
  613. X#define dTYPESTR "ascii"
  614. X#endif
  615. X
  616. X#ifndef dREDIALDELAY            /* usu. 60 (seconds). */
  617. X#define dREDIALDELAY 60
  618. X#endif
  619. X
  620. X#ifndef CMDLINELEN
  621. X#define CMDLINELEN 256
  622. X#endif
  623. X
  624. X#ifndef RECEIVEDLINELEN
  625. X#define RECEIVEDLINELEN 256
  626. X#endif
  627. X
  628. X#ifndef MAXMACROS
  629. X#define MAXMACROS 16
  630. X#endif
  631. X
  632. X#ifndef MACBUFLEN                /* usually 4096. */
  633. X#define MACBUFLEN 4096
  634. X#endif
  635. X
  636. X/* Do you want binary transfers by default? */
  637. X#ifndef dAUTOBINARY                /* usually 1 */
  638. X#define dAUTOBINARY 1
  639. X#endif
  640. X
  641. X#ifndef dPROGRESS
  642. X#define dPROGRESS pr_philbar    /* can be: pr_none, pr_percent, pr_philbar,
  643. X                                 * or pr_kbytes
  644. X                                 */
  645. X#endif
  646. X
  647. X/* Default login name at gateway */
  648. X#ifdef GATEWAY
  649. X#    ifndef dGATEWAY_LOGIN
  650. X#        define dGATEWAY_LOGIN "ftp"
  651. X#    endif
  652. X#endif
  653. X
  654. X#endif    /* _DEFAULTS_H_ */
  655. X
  656. X/* eof */
  657. END_OF_FILE
  658.   if test 2811 -ne `wc -c <'defaults.h'`; then
  659.     echo shar: \"'defaults.h'\" unpacked with wrong size!
  660.   fi
  661.   # end of 'defaults.h'
  662. fi
  663. if test -f 'ftp.h' -a "${1}" != "-c" ; then 
  664.   echo shar: Will not clobber existing file \"'ftp.h'\"
  665. else
  666.   echo shar: Extracting \"'ftp.h'\" \(1714 characters\)
  667.   sed "s/^X//" >'ftp.h' <<'END_OF_FILE'
  668. X/* ftp.h */
  669. X
  670. X#ifndef _ftp_h_
  671. X#define _ftp_h_
  672. X
  673. X/*  $RCSfile: ftp.h,v $
  674. X *  $Revision: 14020.11 $
  675. X *  $Date: 93/07/09 11:04:12 $
  676. X */
  677. X
  678. X#define IS_FILE 1
  679. X#define IS_STREAM 0
  680. X#define IS_PIPE -1
  681. X
  682. X/* Progress-meter types. */
  683. X#define pr_none 0
  684. X#define pr_percent 1
  685. X#define pr_philbar 2
  686. X#define pr_kbytes 3
  687. X#define pr_dots 4
  688. X#define pr_last pr_dots
  689. X
  690. X/* Values sent to CommandWithFlags() to determine whether to read a reply
  691. X * from the remote host after sending the command.
  692. X */
  693. X#define DONT_WAIT_FOR_REPLY 0
  694. X#define WAIT_FOR_REPLY 1
  695. X
  696. X/* Expect EOF values for getreply() */
  697. X#define DONT_EXPECT_EOF        0
  698. X#define EXPECT_EOF            1
  699. X
  700. Xint hookup(char *, unsigned int);
  701. Xint Login(char *userNamePtr, char *passWordPtr, char *accountPtr, int doInit);
  702. Xvoid cmdabort SIG_PARAMS;
  703. Xint CommandWithFlags(char *, int);
  704. Xint command(char *);
  705. Xint command_noreply(char *);
  706. Xint quiet_command(char *);
  707. Xint verbose_command(char *);
  708. Xint getreply(int);
  709. Xint start_progress(int, char *);
  710. Xint progress_report(int);
  711. Xvoid end_progress(char *, char *, char *);
  712. Xvoid close_file(FILE **, int);
  713. Xvoid abortsend SIG_PARAMS;
  714. Xint sendrequest(char *, char *, char *);
  715. Xvoid abortrecv SIG_PARAMS;
  716. Xvoid GetLSRemoteDir(char *, char *);
  717. Xint AdjustLocalFileName(char *);
  718. Xint SetToAsciiForLS(int, int);
  719. Xint IssueCommand(char *, char *);
  720. XFILE *OpenOutputFile(int, char *, char *, Sig_t *);
  721. Xvoid ReceiveBinary(FILE *, FILE *, int *, char *);
  722. Xvoid AddRedirLine(char *);
  723. Xvoid ReceiveAscii(FILE *, FILE *, int *, char *, int);
  724. Xvoid CloseOutputFile(FILE *, int, char *, time_t);
  725. Xvoid ResetOldType(int);
  726. Xint FileType(char *);
  727. Xvoid CloseData(void);
  728. Xint recvrequest(char *, char *, char *, char *);
  729. Xint initconn(void);
  730. XFILE *dataconn(char *);
  731. X
  732. X#endif /* _ftp_h_ */
  733. X
  734. X/* eof ftp.h */
  735. END_OF_FILE
  736.   if test 1714 -ne `wc -c <'ftp.h'`; then
  737.     echo shar: \"'ftp.h'\" unpacked with wrong size!
  738.   fi
  739.   # end of 'ftp.h'
  740. fi
  741. if test -f 'getpass.c' -a "${1}" != "-c" ; then 
  742.   echo shar: Will not clobber existing file \"'getpass.c'\"
  743. else
  744.   echo shar: Extracting \"'getpass.c'\" \(2942 characters\)
  745.   sed "s/^X//" >'getpass.c' <<'END_OF_FILE'
  746. X/* Getpass.c */
  747. X
  748. X/*  $RCSfile: getpass.c,v $
  749. X *  $Revision: 14020.11 $
  750. X *  $Date: 93/05/21 05:44:36 $
  751. X */
  752. X
  753. X#include "sys.h"
  754. X
  755. X#include <signal.h>
  756. X
  757. X#include "util.h"
  758. X#include "cmds.h"
  759. X#include "getpass.h"
  760. X#include "copyright.h"
  761. X
  762. X#ifndef GETPASS
  763. X
  764. X#ifndef sun    /* ...both unnecessary, and conflicting with <termios.h> */
  765. X#include <sys/ioctl.h>
  766. X#endif
  767. X
  768. X#ifdef TERMIOS
  769. X#        include <termios.h>
  770. X#else
  771. X#    ifdef SGTTYB
  772. X#        include <sgtty.h>
  773. X#    else
  774. X#        include <termio.h>
  775. X#    endif
  776. X#endif /* !TERMIOS */
  777. X
  778. X#ifdef STRICT_PROTOS
  779. Xint ioctl(int, int, ...);
  780. X#endif
  781. X
  782. X#endif    /* GETPASS */
  783. X
  784. X
  785. X
  786. X
  787. Xvoid echo(FILE *fp, int on)
  788. X{
  789. X#ifndef GETPASS        /* Otherwise just do nothing which is ok. */
  790. X
  791. X#ifdef TERMIOS
  792. X    static struct termios orig, noecho, *tp;
  793. X#else
  794. X#    ifdef SGTTYB
  795. X    static struct sgttyb orig, noecho, *tp;
  796. X#    else
  797. X    static struct termio orig, noecho, *tp;
  798. X#    endif
  799. X#endif
  800. X    static int state = 0;
  801. X    int fd = fileno(fp);
  802. X    
  803. X    if (!isatty(fd))
  804. X        return;
  805. X
  806. X    if (state == 0) {
  807. X#ifdef TERMIOS
  808. X        if (tcgetattr(fd, &orig) < 0)
  809. X            PERROR("echo", "tcgetattr");
  810. X        noecho = orig;
  811. X        noecho.c_lflag &= ~ECHO;
  812. X#else
  813. X#    ifdef SGTTYB
  814. X        if (ioctl(fd, TIOCGETP, &orig) < 0)
  815. X            PERROR("echo", "ioctl");
  816. X        noecho = orig;
  817. X        noecho.sg_flags &= ~ECHO;
  818. X#    else
  819. X        if (ioctl(fd, TCGETA, &orig) < 0)
  820. X            PERROR("echo", "ioctl");
  821. X        noecho = orig;
  822. X        noecho.c_lflag &= ~ECHO;
  823. X#    endif
  824. X#endif
  825. X        state = 1;
  826. X    }
  827. X    tp = NULL;
  828. X    if (on && state == 2) {
  829. X        /* Turn echo back on. */
  830. X        tp = &orig;
  831. X        state = 1;
  832. X    } else if (!on && state == 1) {
  833. X        /* Turn echo off. */
  834. X        tp = &noecho;
  835. X        state = 2;
  836. X    }
  837. X    if (tp != NULL) {
  838. X#ifdef TERMIOS
  839. X        if (tcsetattr(fd, TCSAFLUSH, tp) < 0)
  840. X            PERROR("echo", "tcsetattr");
  841. X#else
  842. X#    ifdef SGTTYB
  843. X        if (ioctl(fd, TIOCSETP, tp) < 0)
  844. X            PERROR("echo", "ioctl");
  845. X#    else
  846. X        if (ioctl(fd, TCSETA, tp) < 0)
  847. X            PERROR("echo", "ioctl");
  848. X#    endif
  849. X#endif    /* !TERMIOS */
  850. X    }
  851. X
  852. X#endif    /* GETPASS */
  853. X}    /* echo */
  854. X
  855. X
  856. X
  857. X#ifndef GETPASS
  858. X
  859. Xchar *Getpass(char *promptstr)
  860. X{
  861. X    register int ch;
  862. X    register char *p;
  863. X    FILE *fp, *outfp;
  864. X    Sig_t oldintr;
  865. X    static char buf[kMaxPassLen + 1];
  866. X
  867. X    /*
  868. X     * read and write to /dev/tty if possible; else read from
  869. X     * stdin and write to stderr.
  870. X     */
  871. X#if !defined(BOTCHED_FOPEN_RW)
  872. X      if ((outfp = fp = fopen("/dev/tty", "w+")) == NULL) {
  873. X          outfp = stderr;
  874. X          fp = stdin;
  875. X      }
  876. X#else
  877. X    /* SCO 32v2 botches "w+" open */
  878. X    if ((fp = fopen("/dev/tty", "r")) == NULL)
  879. X        fp = stdin;
  880. X    if ((outfp = fopen("/dev/tty", "w")) == NULL)
  881. X        outfp = stderr;
  882. X#endif
  883. X    oldintr = Signal(SIGINT, SIG_IGN);
  884. X    echo(fp, 0);        /* Turn echoing off. */
  885. X    (void) fputs(promptstr, outfp);
  886. X    (void) rewind(outfp);            /* implied flush */
  887. X    for (p = buf; (ch = getc(fp)) != EOF && ch != '\n';)
  888. X        if (p < buf + kMaxPassLen)
  889. X            *p++ = ch;
  890. X    *p = '\0';
  891. X    (void)write(fileno(outfp), "\n", 1);
  892. X    echo(fp, 1);
  893. X    (void) Signal(SIGINT, oldintr);
  894. X    if (fp != stdin)
  895. X        (void)fclose(fp);
  896. X#if defined(BOTCHED_FOPEN_RW)
  897. X    if (outfp != stderr)
  898. X        (void)fclose(outfp);
  899. X#endif
  900. X    return(buf);
  901. X}    /* Getpass */
  902. X
  903. X#endif /* GETPASS */
  904. X
  905. X/* eof Getpass.c */
  906. END_OF_FILE
  907.   if test 2942 -ne `wc -c <'getpass.c'`; then
  908.     echo shar: \"'getpass.c'\" unpacked with wrong size!
  909.   fi
  910.   # end of 'getpass.c'
  911. fi
  912. if test -f 'glob.c' -a "${1}" != "-c" ; then 
  913.   echo shar: Will not clobber existing file \"'glob.c'\"
  914. else
  915.   echo shar: Extracting \"'glob.c'\" \(10224 characters\)
  916.   sed "s/^X//" >'glob.c' <<'END_OF_FILE'
  917. X/* glob.c */
  918. X
  919. X/*  $RCSfile: glob.c,v $
  920. X *  $Revision: 14020.11 $
  921. X *  $Date: 93/05/21 05:44:32 $
  922. X */
  923. X
  924. X#include "sys.h"
  925. X
  926. X#include <sys/stat.h>
  927. X
  928. X/* Dir.h.  Try <sys/dir.h> (add -DSYSDIRH) if <dirent.h> doesn't exist. */
  929. X
  930. X#ifndef SYSDIRH
  931. X#   include <dirent.h>
  932. X#else
  933. X#   include <sys/dir.h>
  934. X#endif
  935. X
  936. X#ifdef SCO324
  937. X#   define direct dirent
  938. X#endif
  939. X
  940. X#include <errno.h>
  941. X#include <pwd.h>
  942. X#include "util.h"
  943. X#include "glob.h"
  944. X#include "cmds.h"
  945. X#include "copyright.h"
  946. X
  947. X#ifndef NCARGS
  948. X#    define NCARGS  4096 /* # characters in exec arglist */
  949. X#endif
  950. X
  951. X#define    L_CURLY    '{'
  952. X#define    R_CURLY    '}'
  953. X
  954. X#define    QUOTE 0200
  955. X#define    TRIM 0177
  956. X#define    eq(a,b)        (strcmp(a, b)==0)
  957. X#define    GAVSIZ        (NCARGS/6)
  958. X#define    isdir(d)    ((d.st_mode & S_IFMT) == S_IFDIR)
  959. X
  960. Xstatic void ginit(char **agargv);
  961. Xstatic void collect(char *as);
  962. Xstatic void acollect(char *as);
  963. Xstatic void sort(void);
  964. Xstatic void expand(char *as);
  965. Xstatic void matchdir(char *pattern);
  966. Xstatic int execbrc(char *p, char *s);
  967. Xstatic match(char *s, char *p);
  968. Xstatic amatch(char *s, char *p);
  969. X#if UNUSED
  970. Xstatic Gmatch(char *s, char *p);
  971. X#endif
  972. Xstatic void Gcat(char *s1, char *s2);
  973. Xstatic void addpath(char c);
  974. Xstatic void rscan(char **t, int (*f )(char));
  975. Xstatic tglob(char c);
  976. Xstatic char *strspl(char *cp, char *dp);
  977. Xstatic char *strend(char *cp);
  978. X
  979. Xstatic    char **gargv;    /* Pointer to the (stack) arglist */
  980. Xstatic    int gargc;        /* Number args in gargv */
  981. Xstatic    int gnleft;
  982. Xstatic    short gflag;
  983. Xchar    *globerr;
  984. Xchar    *home;            /* you must initialize this elsewhere! */
  985. Xextern    int errno;
  986. X
  987. Xstatic    int globcnt;
  988. X
  989. Xchar    *globchars = "`{[*?";
  990. X
  991. Xstatic    char *gpath, *gpathp, *lastgpathp;
  992. Xstatic    int globbed;
  993. Xstatic    char *entp;
  994. Xstatic    char **sortbas;
  995. X
  996. Xchar **
  997. Xglob(char *v)
  998. X{
  999. X    char agpath[BUFSIZ];
  1000. X    char *agargv[GAVSIZ];
  1001. X    char *vv[2];
  1002. X    vv[0] = v;
  1003. X    vv[1] = 0;
  1004. X    gflag = (short) 0;
  1005. X    rscan(vv, tglob);
  1006. X    if (gflag == (short) 0)
  1007. X        return (copyblk(vv));
  1008. X
  1009. X    globerr = 0;
  1010. X    gpath = agpath; gpathp = gpath; *gpathp = 0;
  1011. X    lastgpathp = &gpath[sizeof agpath - 2];
  1012. X    ginit(agargv); globcnt = 0;
  1013. X    collect(v);
  1014. X    if (globcnt == 0 && (gflag & (short)1)) {
  1015. X        blkfree(gargv), gargv = 0;
  1016. X        return (0);
  1017. X    } else
  1018. X        return (gargv = copyblk(gargv));
  1019. X}
  1020. X
  1021. Xstatic
  1022. Xvoid ginit(char **agargv)
  1023. X{
  1024. X    agargv[0] = 0; gargv = agargv; sortbas = agargv; gargc = 0;
  1025. X    gnleft = NCARGS - 4;
  1026. X}
  1027. X
  1028. Xstatic
  1029. Xvoid collect(char *as)
  1030. X{
  1031. X    if (eq(as, "{") || eq(as, "{}")) {
  1032. X        Gcat(as, "");
  1033. X        sort();
  1034. X    } else
  1035. X        acollect(as);
  1036. X}
  1037. X
  1038. Xstatic
  1039. Xvoid acollect(char *as)
  1040. X{
  1041. X    register int ogargc = gargc;
  1042. X
  1043. X    gpathp = gpath; *gpathp = 0; globbed = 0;
  1044. X    expand(as);
  1045. X    if (gargc != ogargc)
  1046. X        sort();
  1047. X}
  1048. X
  1049. Xstatic
  1050. Xvoid sort(void)
  1051. X{
  1052. X    register char **p1, **p2, *c;
  1053. X    char **Gvp = &gargv[gargc];
  1054. X
  1055. X    p1 = sortbas;
  1056. X    while (p1 < Gvp-1) {
  1057. X        p2 = p1;
  1058. X        while (++p2 < Gvp)
  1059. X            if (strcmp(*p1, *p2) > 0)
  1060. X                c = *p1, *p1 = *p2, *p2 = c;
  1061. X        p1++;
  1062. X    }
  1063. X    sortbas = Gvp;
  1064. X}
  1065. X
  1066. Xstatic
  1067. Xvoid expand(char *as)
  1068. X{
  1069. X    register char *cs;
  1070. X    register char *sgpathp, *oldcs;
  1071. X    struct stat stb;
  1072. X
  1073. X    sgpathp = gpathp;
  1074. X    cs = as;
  1075. X    if (*cs == '~' && gpathp == gpath) {
  1076. X        addpath('~');
  1077. X        for (cs++; letter(*cs) || digit(*cs) || *cs == '-';)
  1078. X            addpath(*cs++);
  1079. X        if (!*cs || *cs == '/') {
  1080. X            if (gpathp != gpath + 1) {
  1081. X                *gpathp = 0;
  1082. X                if (gethdir(gpath + 1))
  1083. X                    globerr = "Unknown user name after ~";
  1084. X                (void) strcpy(gpath, gpath + 1);
  1085. X            } else
  1086. X                (void) strcpy(gpath, home);
  1087. X            gpathp = strend(gpath);
  1088. X        }
  1089. X    }
  1090. X    while (!any(*cs, globchars)) {
  1091. X        if (*cs == 0) {
  1092. X            if (!globbed)
  1093. X                Gcat(gpath, "");
  1094. X            else if (stat(gpath, &stb) >= 0) {
  1095. X                Gcat(gpath, "");
  1096. X                globcnt++;
  1097. X            }
  1098. X            goto endit;
  1099. X        }
  1100. X        addpath(*cs++);
  1101. X    }
  1102. X    oldcs = cs;
  1103. X    while (cs > as && *cs != '/')
  1104. X        cs--, gpathp--;
  1105. X    if (*cs == '/')
  1106. X        cs++, gpathp++;
  1107. X    *gpathp = 0;
  1108. X    if (*oldcs == L_CURLY) {
  1109. X        (void) execbrc(cs, ((char *)0));
  1110. X        return;
  1111. X    }
  1112. X    matchdir(cs);
  1113. Xendit:
  1114. X    gpathp = sgpathp;
  1115. X    *gpathp = 0;
  1116. X}
  1117. X
  1118. Xstatic
  1119. Xvoid matchdir(char *pattern)
  1120. X{
  1121. X    struct stat stb;
  1122. X#ifdef SYSDIRH
  1123. X    register struct direct *dp;
  1124. X#else
  1125. X    register struct dirent *dp;
  1126. X#endif
  1127. X    DIR *dirp;
  1128. X
  1129. X    dirp = opendir((*gpath ? gpath : "."));
  1130. X    if (dirp == NULL) {
  1131. X        if (globbed)
  1132. X            return;
  1133. X        goto patherr2;
  1134. X    }
  1135. X    if (fstat(dirp->dd_fd, &stb) < 0)
  1136. X        goto patherr1;
  1137. X    if (!isdir(stb)) {
  1138. X        errno = ENOTDIR;
  1139. X        goto patherr1;
  1140. X    }
  1141. X    while ((dp = readdir(dirp)) != NULL) {
  1142. X        if (dp->d_ino == 0)
  1143. X            continue;
  1144. X        if (match(dp->d_name, pattern)) {
  1145. X            Gcat(gpath, dp->d_name);
  1146. X            globcnt++;
  1147. X        }
  1148. X    }
  1149. X    (void) closedir(dirp);
  1150. X    return;
  1151. X
  1152. Xpatherr1:
  1153. X    (void) closedir(dirp);
  1154. Xpatherr2:
  1155. X    globerr = "Bad directory components";
  1156. X}
  1157. X
  1158. Xstatic
  1159. Xint execbrc(char *p, char *s)
  1160. X{
  1161. X    char restbuf[BUFSIZ + 2];
  1162. X    register char *pe, *pm, *pl;
  1163. X    int brclev = 0;
  1164. X    char *lm, savec, *sgpathp;
  1165. X
  1166. X    for (lm = restbuf; *p != L_CURLY; *lm++ = *p++)
  1167. X        continue;
  1168. X    for (pe = ++p; *pe; pe++)
  1169. X    switch (*pe) {
  1170. X
  1171. X    case L_CURLY:
  1172. X        brclev++;
  1173. X        continue;
  1174. X
  1175. X    case R_CURLY:
  1176. X        if (brclev == 0)
  1177. X            goto pend;
  1178. X        brclev--;
  1179. X        continue;
  1180. X
  1181. X    case '[':
  1182. X        for (pe++; *pe && *pe != ']'; pe++)
  1183. X            continue;
  1184. X        continue;
  1185. X    }
  1186. Xpend:
  1187. X    brclev = 0;
  1188. X    for (pl = pm = p; pm <= pe; pm++)
  1189. X    switch (*pm & (QUOTE|TRIM)) {
  1190. X
  1191. X    case L_CURLY:
  1192. X        brclev++;
  1193. X        continue;
  1194. X
  1195. X    case R_CURLY:
  1196. X        if (brclev) {
  1197. X            brclev--;
  1198. X            continue;
  1199. X        }
  1200. X        goto doit;
  1201. X
  1202. X    case ','|QUOTE:
  1203. X    case ',':
  1204. X        if (brclev)
  1205. X            continue;
  1206. Xdoit:
  1207. X        savec = *pm;
  1208. X        *pm = 0;
  1209. X        (void) strcpy(lm, pl);
  1210. X        (void) strcat(restbuf, pe + 1);
  1211. X        *pm = savec;
  1212. X        if (s == 0) {
  1213. X            sgpathp = gpathp;
  1214. X            expand(restbuf);
  1215. X            gpathp = sgpathp;
  1216. X            *gpathp = 0;
  1217. X        } else if (amatch(s, restbuf))
  1218. X            return (1);
  1219. X        sort();
  1220. X        pl = pm + 1;
  1221. X        if (brclev)
  1222. X            return (0);
  1223. X        continue;
  1224. X
  1225. X    case '[':
  1226. X        for (pm++; *pm && *pm != ']'; pm++)
  1227. X            continue;
  1228. X        if (!*pm)
  1229. X            pm--;
  1230. X        continue;
  1231. X    }
  1232. X    if (brclev)
  1233. X        goto doit;
  1234. X    return (0);
  1235. X}
  1236. X
  1237. Xstatic
  1238. Xint match(char *s, char *p)
  1239. X{
  1240. X    register int c;
  1241. X    register char *sentp;
  1242. X    char sglobbed = globbed;
  1243. X
  1244. X    if (*s == '.' && *p != '.')
  1245. X        return (0);
  1246. X    sentp = entp;
  1247. X    entp = s;
  1248. X    c = amatch(s, p);
  1249. X    entp = sentp;
  1250. X    globbed = sglobbed;
  1251. X    return (c);
  1252. X}
  1253. X
  1254. Xstatic
  1255. Xint amatch(char *s, char *p)
  1256. X{
  1257. X    register int scc;
  1258. X    int ok, lc;
  1259. X    char *sgpathp;
  1260. X    struct stat stb;
  1261. X    int c, cc;
  1262. X
  1263. X    globbed = 1;
  1264. X    for (;;) {
  1265. X        scc = *s++ & TRIM;
  1266. X        switch (c = *p++) {
  1267. X
  1268. X        case L_CURLY:
  1269. X            return (execbrc(p - 1, s - 1));
  1270. X
  1271. X        case '[':
  1272. X            ok = 0;
  1273. X            lc = 077777;
  1274. X            while ((cc = *p++) != '\0') {
  1275. X                if (cc == ']') {
  1276. X                    if (ok)
  1277. X                        break;
  1278. X                    return (0);
  1279. X                }
  1280. X                if (cc == '-') {
  1281. X                    if (lc <= scc && scc <= *p++)
  1282. X                        ok++;
  1283. X                } else
  1284. X                    if (scc == (lc = cc))
  1285. X                        ok++;
  1286. X            }
  1287. X            if (cc == 0)
  1288. X                if (ok)
  1289. X                    p--;
  1290. X                else
  1291. X                    return 0;
  1292. X            continue;
  1293. X
  1294. X        case '*':
  1295. X            if (!*p)
  1296. X                return (1);
  1297. X            if (*p == '/') {
  1298. X                p++;
  1299. X                goto slash;
  1300. X            }
  1301. X            s--;
  1302. X            do {
  1303. X                if (amatch(s, p))
  1304. X                    return (1);
  1305. X            } while (*s++);
  1306. X            return (0);
  1307. X
  1308. X        case 0:
  1309. X            return (scc == 0);
  1310. X
  1311. X        default:
  1312. X            if (c != scc)
  1313. X                return (0);
  1314. X            continue;
  1315. X
  1316. X        case '?':
  1317. X            if (scc == 0)
  1318. X                return (0);
  1319. X            continue;
  1320. X
  1321. X        case '/':
  1322. X            if (scc)
  1323. X                return (0);
  1324. Xslash:
  1325. X            s = entp;
  1326. X            sgpathp = gpathp;
  1327. X            while (*s)
  1328. X                addpath(*s++);
  1329. X            addpath('/');
  1330. X            if (stat(gpath, &stb) == 0 && isdir(stb))
  1331. X                if (*p == 0) {
  1332. X                    Gcat(gpath, "");
  1333. X                    globcnt++;
  1334. X                } else
  1335. X                    expand(p);
  1336. X            gpathp = sgpathp;
  1337. X            *gpathp = 0;
  1338. X            return (0);
  1339. X        }
  1340. X    }
  1341. X}
  1342. X
  1343. X#if UNUSED
  1344. Xstatic
  1345. XGmatch(char *s, char *p)
  1346. X{
  1347. X    register int scc;
  1348. X    int ok, lc;
  1349. X    int c, cc;
  1350. X
  1351. X    for (;;) {
  1352. X        scc = *s++ & TRIM;
  1353. X        switch (c = *p++) {
  1354. X
  1355. X        case '[':
  1356. X            ok = 0;
  1357. X            lc = 077777;
  1358. X            while (cc = *p++) {
  1359. X                if (cc == ']') {
  1360. X                    if (ok)
  1361. X                        break;
  1362. X                    return (0);
  1363. X                }
  1364. X                if (cc == '-') {
  1365. X                    if (lc <= scc && scc <= *p++)
  1366. X                        ok++;
  1367. X                } else
  1368. X                    if (scc == (lc = cc))
  1369. X                        ok++;
  1370. X            }
  1371. X            if (cc == 0)
  1372. X                if (ok)
  1373. X                    p--;
  1374. X                else
  1375. X                    return 0;
  1376. X            continue;
  1377. X
  1378. X        case '*':
  1379. X            if (!*p)
  1380. X                return (1);
  1381. X            for (s--; *s; s++)
  1382. X                if (Gmatch(s, p))
  1383. X                    return (1);
  1384. X            return (0);
  1385. X
  1386. X        case 0:
  1387. X            return (scc == 0);
  1388. X
  1389. X        default:
  1390. X            if ((c & TRIM) != scc)
  1391. X                return (0);
  1392. X            continue;
  1393. X
  1394. X        case '?':
  1395. X            if (scc == 0)
  1396. X                return (0);
  1397. X            continue;
  1398. X
  1399. X        }
  1400. X    }
  1401. X}
  1402. X#endif
  1403. X
  1404. Xstatic
  1405. Xvoid Gcat(char *s1, char *s2)
  1406. X{
  1407. X    register int len = strlen(s1) + strlen(s2) + 1;
  1408. X
  1409. X    if (len >= gnleft || gargc >= GAVSIZ - 1)
  1410. X        globerr = "Arguments too long";
  1411. X    else {
  1412. X        gargc++;
  1413. X        gnleft -= len;
  1414. X        gargv[gargc] = 0;
  1415. X        gargv[gargc - 1] = strspl(s1, s2);
  1416. X    }
  1417. X}
  1418. X
  1419. Xstatic
  1420. Xvoid addpath(char c)
  1421. X{
  1422. X
  1423. X    if (gpathp >= lastgpathp)
  1424. X        globerr = "Pathname too long";
  1425. X    else {
  1426. X        *gpathp++ = c;
  1427. X        *gpathp = 0;
  1428. X    }
  1429. X}
  1430. X
  1431. Xstatic
  1432. Xvoid rscan(char **t, int (*f )(char))
  1433. X{
  1434. X    register char *p, c;
  1435. X
  1436. X    while ((p = *t++) != 0) {
  1437. X        if (f == tglob)
  1438. X            if (*p == '~')
  1439. X                gflag |= (short) 2;
  1440. X            else if (eq(p, "{") || eq(p, "{}"))
  1441. X                continue;
  1442. X        while ((c = *p++) != '\0')
  1443. X            (*f)(c);
  1444. X    }
  1445. X}
  1446. X/*
  1447. Xstatic
  1448. Xscan(t, f)
  1449. X    register char **t;
  1450. X    int (*f)(char);
  1451. X{
  1452. X    register char *p, c;
  1453. X
  1454. X    while (p = *t++)
  1455. X        while (c = *p)
  1456. X            *p++ = (*f)(c);
  1457. X} */
  1458. X
  1459. Xstatic
  1460. Xint tglob(char c)
  1461. X{
  1462. X
  1463. X    if (any(c, globchars))
  1464. X        gflag |= (c == L_CURLY ? (short)2 : (short)1);
  1465. X    return (c);
  1466. X}
  1467. X/*
  1468. Xstatic
  1469. Xtrim(c)
  1470. X    char c;
  1471. X{
  1472. X
  1473. X    return (c & TRIM);
  1474. X} */
  1475. X
  1476. X
  1477. Xint letter(char c)
  1478. X{
  1479. X    return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_');
  1480. X}
  1481. X
  1482. Xint digit(char c)
  1483. X{
  1484. X    return (c >= '0' && c <= '9');
  1485. X}
  1486. X
  1487. Xint any(int c, char *s)
  1488. X{
  1489. X    while (*s)
  1490. X        if (*s++ == c)
  1491. X            return(1);
  1492. X    return(0);
  1493. X}
  1494. X
  1495. Xint blklen(char **av)
  1496. X{
  1497. X    register int i = 0;
  1498. X
  1499. X    while (*av++)
  1500. X        i++;
  1501. X    return (i);
  1502. X}
  1503. X
  1504. Xchar **
  1505. Xblkcpy(char **oav, char **bv)
  1506. X{
  1507. X    register char **av = oav;
  1508. X
  1509. X    while ((*av++ = *bv++) != 0)
  1510. X        continue;
  1511. X    return (oav);
  1512. X}
  1513. X
  1514. Xvoid blkfree(char **av0)
  1515. X{
  1516. X    register char **av = av0;
  1517. X
  1518. X    while (*av)
  1519. X        free(*av++);
  1520. X}
  1521. X
  1522. Xstatic
  1523. Xchar *
  1524. Xstrspl(char *cp, char *dp)
  1525. X{
  1526. X    register char *ep = (char *) malloc((size_t)(strlen(cp) + strlen(dp) + 1L));
  1527. X
  1528. X    if (ep == (char *)0)
  1529. X        fatal("Out of memory");
  1530. X    (void) strcpy(ep, cp);
  1531. X    (void) strcat(ep, dp);
  1532. X    return (ep);
  1533. X}
  1534. X
  1535. Xchar **
  1536. Xcopyblk(char **v)
  1537. X{
  1538. X    register char **nv = (char **)malloc((size_t)((blklen(v) + 1) *
  1539. X                        sizeof(char **)));
  1540. X    if (nv == (char **)0)
  1541. X        fatal("Out of memory");
  1542. X
  1543. X    return (blkcpy(nv, v));
  1544. X}
  1545. X
  1546. Xstatic
  1547. Xchar *
  1548. Xstrend(char *cp)
  1549. X{
  1550. X    while (*cp)
  1551. X        cp++;
  1552. X    return (cp);
  1553. X}
  1554. X
  1555. X/*
  1556. X * Extract a home directory from the password file
  1557. X * The argument points to a buffer where the name of the
  1558. X * user whose home directory is sought is currently.
  1559. X * We write the home directory of the user back there.
  1560. X */
  1561. Xint gethdir(char *home_dir)
  1562. X{
  1563. X    register struct passwd *pp = getpwnam(home_dir);
  1564. X
  1565. X    if (pp == 0)
  1566. X        return (1);
  1567. X    (void) strcpy(home_dir, pp->pw_dir);
  1568. X    return (0);
  1569. X}    /* gethdir */
  1570. X
  1571. X/* eof glob.c */
  1572. END_OF_FILE
  1573.   if test 10224 -ne `wc -c <'glob.c'`; then
  1574.     echo shar: \"'glob.c'\" unpacked with wrong size!
  1575.   fi
  1576.   # end of 'glob.c'
  1577. fi
  1578. if test -f 'sys.h' -a "${1}" != "-c" ; then 
  1579.   echo shar: Will not clobber existing file \"'sys.h'\"
  1580. else
  1581.   echo shar: Extracting \"'sys.h'\" \(9960 characters\)
  1582.   sed "s/^X//" >'sys.h' <<'END_OF_FILE'
  1583. X/* Sys.h
  1584. X * See the README for details.
  1585. X */
  1586. X
  1587. X/*  $RCSfile: sys.h,v $
  1588. X *  $Revision: 14020.13 $
  1589. X *  $Date: 93/06/21 06:42:11 $
  1590. X */
  1591. X
  1592. X#ifdef SVR4
  1593. X#    define System "System V.4"
  1594. X#    ifndef SYSV
  1595. X#        define SYSV 1
  1596. X#    endif
  1597. X#    define VOID void
  1598. X#    ifndef HERROR
  1599. X#        define HERROR 1
  1600. X#    endif
  1601. X#    ifdef TERMH
  1602. X#        define TERMH 1
  1603. X#    endif
  1604. X#    define Gettimeofday gettimeofday
  1605. X#endif  /* SVR4 */
  1606. X
  1607. X#ifdef __sun
  1608. X#    ifndef sun
  1609. X#        define sun 1
  1610. X#    endif
  1611. X#endif
  1612. X
  1613. X#ifdef sun
  1614. X#    if !defined(__GNUC__) && !defined(__STDC__) && !defined(SunOverride)
  1615. X    ^^^ "You need to use an ANSI C compiler.  Try using gcc or acc." ^^^
  1616. X#    endif
  1617. X#    define System "SunOS"
  1618. X#    ifndef RINDEX
  1619. X#        define RINDEX 1
  1620. X#    endif
  1621. X#    ifndef TERMIOS
  1622. X#        define TERMIOS 1
  1623. X#    endif
  1624. X#    ifndef HAS_DOMAINNAME
  1625. X#        define HAS_DOMAINNAME 1
  1626. X#    endif
  1627. X#endif /* sun */
  1628. X
  1629. X#ifdef __sgi
  1630. X#    ifndef sgi
  1631. X#        define sgi 1
  1632. X#    endif
  1633. X#endif
  1634. X
  1635. X#ifdef sgi
  1636. X#    define System "IRIX"
  1637. X#    ifndef SYSV
  1638. X#        define SYSV 1
  1639. X#    endif
  1640. X#    ifndef HERROR
  1641. X#        define HERROR 1
  1642. X#    endif
  1643. X#    ifndef U_WAIT
  1644. X#        define U_WAIT 1
  1645. X#    endif
  1646. X#    ifndef STRICT_PROTOS
  1647. X#        define STRICT_PROTOS 1
  1648. X#    endif
  1649. X#    ifndef TERMIOS
  1650. X#        define TERMIOS 1
  1651. X#    endif
  1652. X#endif /* sgi */
  1653. X
  1654. X#ifdef    AIX
  1655. X#    define System "AIX 2.2.1"
  1656. X#    define BSD_INCLUDES
  1657. X#    define SYSV
  1658. X#    define NO_STDLIB
  1659. X#    define NO_UTIME_H
  1660. X#    define NO_STRFTIME
  1661. X#    define NO_STRSTR
  1662. X#    define NO_MKTIME
  1663. X#endif    /* AIX */
  1664. X
  1665. X#ifdef _AIX
  1666. X#    define System "AIX 3.x"
  1667. X#    define SYSSELECTH 1
  1668. X#endif    /* _AIX */
  1669. X
  1670. X#ifdef SCOXNX
  1671. X#    define System "SCO Xenix"
  1672. X#    define LAI_TCP
  1673. X#    define NO_UTIMEH
  1674. X#    define NO_MKTIME
  1675. X#    define NO_STRFTIME
  1676. X#    define NO_STRSTR
  1677. X#    define NO_RENAME
  1678. X#    define LINGER   /* else SCO bug causes incomplete transfers */
  1679. X#    define SYSV 1
  1680. X#endif    /* SCOXNX */
  1681. X
  1682. X#ifdef SCO322
  1683. X#    define System "SCO Unix 3.2v2"
  1684. X#    define BOTCHED_FOPEN_RW
  1685. X#    define NO_RENAME    /* it exists, but it corrupts filesystems */
  1686. X#    define BROKEN_MEMCPY 1
  1687. X#    define SYSV 1
  1688. X#endif    /* SCO322 */
  1689. X
  1690. X#ifdef SCO324
  1691. X#    define System "SCO Unix 3.2v4"
  1692. X#    ifndef SYSV
  1693. X#        define SYSV 1
  1694. X#    endif
  1695. X#    ifndef BROKEN_MEMCPY
  1696. X#        define BROKEN_MEMCPY 1
  1697. X#    endif
  1698. X#endif    /* SCO324 */
  1699. X
  1700. X#ifdef linux
  1701. X#    define System "Linux"
  1702. X/* Anyone want to fill the rest in? */
  1703. X#endif
  1704. X
  1705. X#ifdef ISC
  1706. X#    define System "Interactive Unix"
  1707. X#    ifndef SYSV
  1708. X#        define SYSV 1
  1709. X#    endif
  1710. X#    ifndef BROKEN_MEMCPY
  1711. X#        define BROKEN_MEMCPY 1
  1712. X#    endif
  1713. X#    ifndef NET_ERRNO_H
  1714. X#        define NET_ERRNO_H 1
  1715. X#    endif
  1716. X#endif  /* ISC */
  1717. X
  1718. X#ifdef aux
  1719. X#    define System "A/UX"
  1720. X#    ifndef BROKEN_MEMCPY
  1721. X#        define BROKEN_MEMCPY 1
  1722. X#    endif
  1723. X#    ifndef SYSV
  1724. X#        define SYSV 1
  1725. X#    endif
  1726. X#endif
  1727. X
  1728. X#ifdef NeXT
  1729. X#    define System "NeXTStep"
  1730. X#    ifndef RINDEX
  1731. X#        define RINDEX 1
  1732. X#    endif
  1733. X#    ifndef BSD
  1734. X#        define BSD 1
  1735. X#    endif
  1736. X#    ifndef NO_UNISTDH
  1737. X#        define NO_UNISTDH 1
  1738. X#    endif
  1739. X#    ifndef NO_UTIMEH
  1740. X#        define NO_UTIMEH
  1741. X#    endif
  1742. X#endif
  1743. X
  1744. X#ifdef pyr
  1745. X#    define System "OSx"
  1746. X#    ifndef BSD
  1747. X#        define BSD 1
  1748. X#    endif
  1749. X#    ifndef SGTTYB
  1750. X#        define SGTTYB 1
  1751. X#    endif
  1752. X#    ifndef NO_STDLIBH
  1753. X#        define NO_STDLIBH 1
  1754. X#    endif
  1755. Xextern int errno;
  1756. X#endif    /* pyr */
  1757. X
  1758. X#ifdef DYNIXPTX
  1759. X#    define System "Dynix/PTX"
  1760. X#    ifndef SYSV
  1761. X#        define SYSV 1
  1762. X#    endif
  1763. X#    ifndef TRY_NOREPLY
  1764. X#        define TRY_NOREPLY 1
  1765. X#    endif
  1766. X#    define gettimeofday(a, b) get_process_stats(a, getpid(), 0, 0)
  1767. X#endif  /* DYNIXPTX */
  1768. X
  1769. X#ifdef DYNIX
  1770. X#    define System "Dynix"
  1771. X#    ifndef BSD
  1772. X#        define BSD 1
  1773. X#    endif
  1774. X#    ifndef SGTTYB
  1775. X#        define SGTTYB 1
  1776. X#    endif
  1777. X#    ifndef NO_UTIMEH
  1778. X#        define NO_UTIMEH 1
  1779. X#    endif
  1780. X#    ifndef NO_STDLIBH
  1781. X#        define NO_STDLIBH 1
  1782. X#    endif
  1783. X#    ifndef NO_VARARGS
  1784. X#        define NO_VARARGS 1
  1785. X#    endif
  1786. X#endif    /* DYNIX */
  1787. X
  1788. X#ifdef ultrix
  1789. X#    define System "Ultrix"
  1790. X#    ifndef BSD
  1791. X#        define BSD 1
  1792. X#    endif
  1793. X#    ifndef __GNUC__
  1794. X#        ifndef NO_CONST
  1795. X#            define NO_CONST 1
  1796. X#        endif
  1797. X#    endif
  1798. X#endif    /* ultrix */
  1799. X
  1800. X#ifdef __hpux
  1801. X#    ifndef HPUX
  1802. X#        define HPUX 1
  1803. X#    endif
  1804. X#    define Select(a,b,c,d,e) select((a), (int *)(b), (c), (d), (e))
  1805. X#endif
  1806. X
  1807. X#ifdef HPUX 
  1808. X#    define System "HP-UX"
  1809. X#    ifndef _HPUX_SOURCE
  1810. X#        define _HPUX_SOURCE 1
  1811. X#    endif
  1812. X#    ifndef GETCWDSIZET
  1813. X#        define GETCWDSIZET 1
  1814. X#    endif
  1815. X#    define SYSV 1
  1816. X#endif    /* HPUX */
  1817. X
  1818. X#ifdef SINIX
  1819. X#    define System "SINIX"
  1820. X#    ifndef SYSV
  1821. X#        define SYSV 1
  1822. X#    endif
  1823. X/* You may need to add -lresolv, -lport, -lcurses to MORELIBS in Makefile. */
  1824. X#endif
  1825. X
  1826. X#ifdef BULL          /* added 23nov92 for Bull DPX/2 */
  1827. X#    define _POSIX_SOURCE
  1828. X#    define _XOPEN_SOURCE
  1829. X#    define _BULL_SOURCE
  1830. X#    ifndef SYSV
  1831. X#        define SYSV 1
  1832. X#    endif
  1833. X#    define bull
  1834. X#    define System "Bull DPX/2 BOS"
  1835. X#    define SYSSELECTH
  1836. X#endif  /* BULL */   /* added 23nov92 for Bull DPX/2 */
  1837. X
  1838. X#ifdef __dgux
  1839. X#     ifndef DGUX
  1840. X#             define DGUX 1
  1841. X#     endif
  1842. X#endif
  1843. X
  1844. X#ifdef DGUX
  1845. X#     ifndef _DGUX_SOURCE
  1846. X#             define _DGUX_SOURCE
  1847. X#     endif
  1848. X#     define GETCWDSIZET 1
  1849. X#     define BAD_INETADDR 1
  1850. X#     define SYSV 1
  1851. X#     define System "DG/UX"
  1852. X#endif  /* DGUX */
  1853. X
  1854. X#ifdef apollo
  1855. X#    ifndef BSD
  1856. X#        define BSD 43
  1857. X#    endif
  1858. X#    define SIG_PARAMS (int sig, ...)
  1859. X#    define NO_UTIMEH 1
  1860. X#    define System "Apollo"
  1861. X#endif
  1862. X
  1863. X#ifdef __Besta__
  1864. X#       define SYSV 1
  1865. X#       define SYSSELECTH 1
  1866. X#       define NO_UNISTDH 1
  1867. X#       define NO_STDLIBH 1
  1868. X#       define NO_UTIMEH 1
  1869. X#    ifndef BROKEN_MEMCPY
  1870. X#        define BROKEN_MEMCPY 1
  1871. X#    endif
  1872. X#       include <sys/types.h>
  1873. X#endif
  1874. X
  1875. X/* -------------------------------------------------------------------- */
  1876. X
  1877. X#ifdef _SYSV
  1878. X#    ifndef SYSV
  1879. X#        define SYSV 1
  1880. X#    endif
  1881. X#endif
  1882. X
  1883. X#ifdef USG
  1884. X#    ifndef SYSV
  1885. X#        define SYSV 1
  1886. X#    endif
  1887. X#endif
  1888. X
  1889. X#ifdef _BSD
  1890. X#    ifndef BSD
  1891. X#        define BSD 1
  1892. X#    endif
  1893. X#endif
  1894. X
  1895. X#ifdef SYSV
  1896. X#    ifndef RINDEX
  1897. X#        define RINDEX 1
  1898. X#    endif
  1899. X#    define bcopy(s,d,l) memcpy((d),(s),(l))
  1900. X#    define bzero(cp,l) memset((cp),0,(l))
  1901. X#    ifndef HAS_GETCWD
  1902. X#        define HAS_GETCWD 1
  1903. X#    endif
  1904. X#endif
  1905. X
  1906. X#ifdef __386BSD__
  1907. X#    define TERMIOS
  1908. X#    ifndef BSD
  1909. X#        define BSD
  1910. X#    endif
  1911. X#endif
  1912. X
  1913. X#ifdef BSD
  1914. X#    ifndef __386BSD__
  1915. X#        ifndef SYSDIRH
  1916. X#            define SYSDIRH 1
  1917. X#        endif
  1918. X#        ifndef SGTTYB
  1919. X#            define SGTTYB
  1920. X#        endif
  1921. X#    endif
  1922. X#    ifndef SGTTYB
  1923. X#        define SGTTYB
  1924. X#    endif
  1925. X#    ifndef RINDEX
  1926. X#        define RINDEX 1
  1927. X#    endif
  1928. X#endif
  1929. X
  1930. X/*
  1931. X * Generic pointer type, e.g. as returned by malloc().
  1932. X */
  1933. X#ifndef PTRTYPE
  1934. X#    define PTRTYPE void
  1935. X#endif
  1936. X
  1937. X#ifndef Free
  1938. X#    define Free(a) free((PTRTYPE *)(a))
  1939. X#endif
  1940. X
  1941. X/*
  1942. X * Some systems besides System V don't use rindex/index (like SunOS).
  1943. X * Add -DRINDEX to your SDEFS line if you need to.
  1944. X */
  1945. X#ifdef RINDEX
  1946. X    /* or #include <strings.h> if you have it. */
  1947. X#    define rindex strrchr
  1948. X#    define index strchr
  1949. X#endif /* RINDEX */
  1950. X
  1951. X#ifdef SOCKS
  1952. X#define Getsockname(d,a,l) Rgetsockname((d), (struct sockaddr *)(a), (l))
  1953. X#else
  1954. X#ifdef SYSV
  1955. X#    define Getsockname(d,a,l) getsockname((d), (void *)(a), (l))
  1956. X#else
  1957. X#    define Getsockname(d,a,l) getsockname((d), (struct sockaddr *)(a), (l))
  1958. X#endif
  1959. X#endif
  1960. X
  1961. X#ifndef Select
  1962. X#    define Select(a,b,c,d,e) select((a), (b), (c), (d), (e))
  1963. X#endif
  1964. X
  1965. X#ifndef Connect
  1966. X#ifndef SVR4
  1967. X#    define Connect(a,b,c) (connect((a), (struct sockaddr *)(b), (int)(c)))
  1968. X#    define Bind(a,b,c) (bind((a), (struct sockaddr *)(b), (int)(c)))
  1969. X#    define Accept(a,b,c) (accept((a), (struct sockaddr *)(b), (int *)(c)))
  1970. X#else  /* SVR4 */
  1971. X#    define Connect(a,b,c) (connect((a), (addr_t)(b), (int)(c)))
  1972. X#    define Bind(a,b,c) (bind((a), (caddr_t)(b), (int)(c)))
  1973. X#    define Accept(a,b,c) (accept((a), (caddr_t)(b), (int *)(c)))
  1974. X#endif    /* SVR4 */
  1975. X#endif    /* Connect */
  1976. X
  1977. X#ifndef Gettimeofday
  1978. X#    define Gettimeofday(a) gettimeofday(a, (struct timezone *)0)
  1979. X#endif /* Gettimeofday */
  1980. X
  1981. X#ifdef GETPASS
  1982. X#    define Getpass getpass
  1983. X#endif
  1984. X
  1985. X/* Enable connections through firewall gateways */
  1986. X#ifndef GATEWAY
  1987. X#    define GATEWAY 1
  1988. X#endif
  1989. X
  1990. X#ifdef _POSIX_SOURCE
  1991. X#    define TERMIOS
  1992. X#endif
  1993. X
  1994. X/* Include frequently used headers: */
  1995. X
  1996. X#include <sys/types.h>
  1997. X
  1998. X#include <sys/param.h>
  1999. X
  2000. X#include <stdio.h>
  2001. X#include <string.h>
  2002. X#include <sys/socket.h>
  2003. X
  2004. X#include <sys/time.h>
  2005. X#include <time.h>
  2006. X
  2007. X#ifndef NO_STDLIBH
  2008. X#    include <stdlib.h>
  2009. X#else
  2010. Xextern PTRTYPE *malloc(size_t);
  2011. Xextern PTRTYPE *calloc(size_t, size_t);
  2012. Xextern PTRTYPE *malloc(size_t);
  2013. Xextern void    free(PTRTYPE *);
  2014. Xextern PTRTYPE *realloc(PTRTYPE *, size_t);
  2015. Xextern void    exit(int);
  2016. X
  2017. X#ifdef NO_CONST
  2018. Xextern char *getenv(char *);
  2019. Xextern int atoi(char *);
  2020. X#else
  2021. Xextern char *getenv(const char *);
  2022. Xextern int atoi(const char *);
  2023. X#endif
  2024. X
  2025. X#endif    /* NO_STDLIBH */
  2026. X
  2027. X#ifndef NO_UNISTDH
  2028. X#    include <unistd.h>
  2029. X#else
  2030. Xchar *getlogin (void);
  2031. X#    ifdef NO_CONST
  2032. Xextern char *getenv(char *);
  2033. X#    else
  2034. Xextern char *getenv(const char *);
  2035. X#    endif
  2036. X#endif    /* NO_UNISTDH */
  2037. X
  2038. X#ifdef NO_STD_PROTOS
  2039. Xextern    int     _filbuf(FILE *);
  2040. Xextern    int     _flsbuf(int, FILE *);
  2041. Xextern    int     fflush(FILE *);
  2042. Xextern    int     fgetc(FILE *);
  2043. Xextern    int     fprintf(FILE *, char *, ...);
  2044. Xextern    int     fputc(int, FILE *);
  2045. Xextern    int     fputs(char *, FILE *);
  2046. Xextern    int     fclose(FILE *);
  2047. Xextern    int     pclose(FILE *);
  2048. Xextern    void    perror(char *);
  2049. Xextern    int     printf(char *, ...);
  2050. Xextern    int     rewind(FILE *);
  2051. Xextern    int     sscanf(char *, char *, ...);
  2052. Xextern    int     vfprintf(FILE *, char *, char *);
  2053. X
  2054. Xextern    char *  mktemp(char *);
  2055. Xextern    int     rename(char *, char *);
  2056. X
  2057. Xextern    int     gettimeofday(struct timeval *, struct timezone *);
  2058. Xextern    time_t  mktime(struct tm *);
  2059. Xextern    int     strftime(char *, int, char *, struct tm *);
  2060. Xextern    time_t  time(time_t *);
  2061. X
  2062. Xextern    int     tolower(int);
  2063. Xextern    int     toupper(int);
  2064. X
  2065. X#ifndef bcopy
  2066. Xextern    void    bcopy(char *, char *, size_t);
  2067. X#endif
  2068. X#ifndef bzero
  2069. Xextern    void    bzero(char *, size_t);
  2070. X#endif
  2071. X
  2072. X#ifdef SOCKS 
  2073. Xextern    int     Raccept(int, struct sockaddr *, int *);
  2074. Xextern    int     Rbind(int, struct sockaddr *, int, unsigned long);
  2075. Xextern    int     Rconnect(int, struct sockaddr *, int);
  2076. Xextern    int     Rlisten(int, int);
  2077. Xextern    int     Rgetsockname(int, struct sockaddr *, int *);
  2078. X#else
  2079. Xextern    int     accept(int, struct sockaddr *, int *);
  2080. Xextern    int     bind(int, struct sockaddr *, int);
  2081. Xextern    int     connect(int, struct sockaddr *, int);
  2082. Xextern    int     listen(int, int);
  2083. Xextern    int     getsockname(int, struct sockaddr *, int *);
  2084. X#endif
  2085. Xextern    int     gethostname(char *, int), getdomainname(char *, int);
  2086. Xextern    int     select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
  2087. Xextern    int     send(int, char *, int, int);
  2088. Xextern    int     setsockopt(int, int, int, char *, int);
  2089. Xextern    int     shutdown(int, int);
  2090. Xextern    int     socket(int, int, int);
  2091. X#endif    /* NO_STD_PROTOS */
  2092. X
  2093. X/* eof sys.h */
  2094. END_OF_FILE
  2095.   if test 9960 -ne `wc -c <'sys.h'`; then
  2096.     echo shar: \"'sys.h'\" unpacked with wrong size!
  2097.   fi
  2098.   # end of 'sys.h'
  2099. fi
  2100. if test -f 'tips.c' -a "${1}" != "-c" ; then 
  2101.   echo shar: Will not clobber existing file \"'tips.c'\"
  2102. else
  2103.   echo shar: Extracting \"'tips.c'\" \(5221 characters\)
  2104.   sed "s/^X//" >'tips.c' <<'END_OF_FILE'
  2105. X/* tips.c */
  2106. X
  2107. X/*  $RCSfile: tips.c,v $
  2108. X *  $Revision: 14020.11 $
  2109. X *  $Date: 93/05/21 05:44:39 $
  2110. X */
  2111. X
  2112. X#include "sys.h"
  2113. X
  2114. X#ifndef NO_TIPS
  2115. X
  2116. X#include "util.h"
  2117. X
  2118. X/* Make sure that the indentations are spaces, not tabs.
  2119. X * Try newform -i-4 < tips.c > tips.c.new
  2120. X *
  2121. X * Always add new tips right above the last one.
  2122. X */
  2123. X
  2124. Xstatic char *tiplist[] = {
  2125. X    "Have you tried typing 'open' by itself lately?",
  2126. X
  2127. X    "If you don't want a .ncrecent file in your home directory, put the \n\
  2128. X     command '#unset recent-list' in your .ncftprc file.",
  2129. X
  2130. X    "pseudo-filename-completion is supported in some commands.  To use it,\n\
  2131. X     use a wildcard expression that will match exactly one file.  I.e., if you\n\
  2132. X     want to fetch obnoxiouslylongfilename.zip, try 'get obn*.zip.'  Note that\n\
  2133. X     you can't use the cd command with this feature (yet).",
  2134. X
  2135. X    "You don't need to type the exact site name with open.  If a site is in\n\
  2136. X     your .ncftprc or the recent-file (.ncrecent), just type a unique\n\
  2137. X     abbreviation (substring really).   I.e. 'open wuar' if you have the site\n\
  2138. X     wuarchive.wustl.edu in your rc or recent-file.",
  2139. X
  2140. X    "You can put set commands in your .ncftprc, by adding lines such\n\
  2141. X     as '#set local-dir /usr/tmp' to the file, which will be run at startup.",
  2142. X
  2143. X    "Use the .ncftprc file to set variables at startup and to add sites that \n\
  2144. X     need init macros.\n\
  2145. X     Sample .ncftprc:\n\
  2146. X     #set pager \"less -M\"\n\
  2147. X     \n\
  2148. X     machine wuarchive.wustl.edu\n\
  2149. X         macdef init\n\
  2150. X         cd /pub\n\
  2151. X         get README\n\
  2152. X         dir\n\
  2153. X         (blank line to end macro)",
  2154. X    
  2155. X    "If you want to keep your .netrc's for ftp and ncftp separate, name\n\
  2156. X     ncftp's rc to .ncftprc.",
  2157. X
  2158. X    "Type 'open' by itself to get a list of the sites in your recent-file and\n\
  2159. X     your .ncftprc.  You can then supply '#5' at the prompt, or use 'open #5'\n\
  2160. X     later.",
  2161. X
  2162. X    "Colon-mode is a quick way to get a file from your shell.  Try something\n\
  2163. X     like 'ncftp wuarchive.wustl.edu:/pub/README.'",
  2164. X
  2165. X    "The open command accepts several flags.  Do a 'help open' for details.",
  2166. X
  2167. X    "Sometimes a directory listing is several screens long and you won't\n\
  2168. X     remember the thing you wanted.  Use the 'predir' command to re-view the\n\
  2169. X     listing.  The program keeps the copy locally, so you won't have to wait\n\
  2170. X     for the remote server to re-send it to you.",
  2171. X
  2172. X    "Use the 'page' (or 'more') command to view a remote file with your pager.",
  2173. X
  2174. X    "ncftp may be keeping detailed information on everything you transfer.\n\
  2175. X     Run the 'version' command and if you see SYSLOG, your actions are being\n\
  2176. X     recorded on the system log.",
  2177. X
  2178. X    "Try the 'redir' command to re-display the last directory listing (ls,\n\
  2179. X     dir, ls -lrt, etc).  'predir' does the same, only with your pager.",
  2180. X
  2181. X    "This program is pronounced Nik-F-T-P.  NCEMRSoft is Nik'-mer-soft.",
  2182. X
  2183. X    "Never pick Nebraska to win a big game.",
  2184. X
  2185. X#ifdef GETLINE
  2186. X    "NcFTP was compiled with the Getline command-line/history editor! (by\n\
  2187. X     Chris Thewalt <thewalt@ce.berkeley.edu>).  To activate it, use the up\n\
  2188. X     and down arrows to scroll through the history, and/or use EMACS-style\n\
  2189. X     commands to edit the line.",
  2190. X#endif
  2191. X
  2192. X#ifdef READLINE
  2193. X    "NcFTP was compiled with the GNU Readline command-line/history editor!\n\
  2194. X     To activate it, use the up & down arrows to scroll through the history,\n\
  2195. X     and/or use EMACS-style (or maybe VI-style) commands to edit the line.",
  2196. X#endif
  2197. X
  2198. X    "You can get the newest version of NcFTP from cse.unl.edu, in the\n\
  2199. X     /pub/mgleason directory.",
  2200. X
  2201. X    "The type of progress-meter that will be used depends if the remote host\n\
  2202. X     supports the SIZE command, and whether your terminal is capable of ANSI\n\
  2203. X     escape codes.",
  2204. X
  2205. X    "To report a bug, mail your message to mgleason@cse.unl.edu.  Include the\n\
  2206. X     output of the 'version' command in your message.  An easy way to do that\n\
  2207. X     is to compose your message, then do a 'ncftp -H >> msg.'",
  2208. X
  2209. X    "Don't put a site in your .ncftprc unless you want an 'init' macro.  The \n\
  2210. X     recent-file saves sites with the last directory you were in, unlike \n\
  2211. X     the rc file, while still letting you use sitename abbreviations.",
  2212. X
  2213. X    "Sick and tired of these tips?  Put '#unset tips' in your .ncftprc."
  2214. X};
  2215. X
  2216. X/* Not another dinky header, por favor. */
  2217. X#define NTIPS ((int) (sizeof(tiplist) / sizeof(char *)))
  2218. Xvoid PrintTip(void);
  2219. Xextern int fromatty, debug;
  2220. X
  2221. Xint tips = 1;
  2222. X#endif  /* NO_TIPS */
  2223. X
  2224. Xvoid PrintTip(void)
  2225. X{
  2226. X#ifndef NO_TIPS
  2227. X    int cheap_rn, i, tn;
  2228. X    string str;
  2229. X
  2230. X    if (tips && fromatty) {
  2231. X        cheap_rn = (int) getpid() % NTIPS;
  2232. X        if (debug) {
  2233. X            (void) printf("pid: %d;  ntips: %d\n", getpid(), NTIPS);
  2234. X            (void) Gets("*** Tip# (-1 == all): ", str, sizeof(str));
  2235. X            tn = atoi(str) - 1;
  2236. X            if (tn == -1)
  2237. X                tn = 0;
  2238. X            if (tn < -1)
  2239. X                for(i=0; i<NTIPS; i++)
  2240. X                    (void) printf("Tip: %s\n", tiplist[i]);
  2241. X            else if (tn < NTIPS)
  2242. X                (void) printf("Tip: %s\n", tiplist[tn]);
  2243. X        } else
  2244. X            (void) printf("Tip: %s\n", tiplist[cheap_rn]);
  2245. X    }
  2246. X#endif  /* NO_TIPS */
  2247. X}   /* PrintTip */
  2248. X
  2249. X/* tips.c */
  2250. END_OF_FILE
  2251.   if test 5221 -ne `wc -c <'tips.c'`; then
  2252.     echo shar: \"'tips.c'\" unpacked with wrong size!
  2253.   fi
  2254.   # end of 'tips.c'
  2255. fi
  2256. if test -f 'util.h' -a "${1}" != "-c" ; then 
  2257.   echo shar: Will not clobber existing file \"'util.h'\"
  2258. else
  2259.   echo shar: Extracting \"'util.h'\" \(2304 characters\)
  2260.   sed "s/^X//" >'util.h' <<'END_OF_FILE'
  2261. X/* Util.h */
  2262. X
  2263. X#ifndef _util_h_
  2264. X#define _util_h_
  2265. X
  2266. X/*  $RCSfile: util.h,v $
  2267. X *  $Revision: 14020.12 $
  2268. X *  $Date: 93/07/09 11:32:49 $
  2269. X */
  2270. X
  2271. Xtypedef char string[128], str32[32], longstring[512];
  2272. Xtypedef char Hostname[64];
  2273. X
  2274. X/* For Perror. */
  2275. X#ifdef DB_ERRS
  2276. X#    ifdef __LINE__
  2277. X#        define PERROR(p,e) Perror(p, __LINE__, e)
  2278. X        void Perror(char *, int, char *);
  2279. X#    else
  2280. X#        define PERROR(p,e) Perror(p, e)
  2281. X        void Perror(char *, char *);
  2282. X#    endif
  2283. X#else
  2284. X#    define PERROR(p,e) Perror(e)
  2285. X    void Perror(char *);
  2286. X#endif
  2287. X
  2288. X#ifdef NO_VARARGS
  2289. X#    define dbprintf if (debug) (void) printf
  2290. X#else
  2291. X#    ifndef DB_STREAM
  2292. X#        define DB_STREAM stdout
  2293. X#    endif
  2294. X    void dbprintf(char *fmt, ...);
  2295. X#endif
  2296. X
  2297. X/* For 'Getopt.' */
  2298. X#define BADCH   ((int)'?')
  2299. X#define EMSG    ""
  2300. X
  2301. X/* Handy macros. */
  2302. X#define Strncpy(d,s) _Strncpy((char *) (d), (char *) (s), (size_t) sizeof(d))
  2303. X#define Strncat(d,s) _Strncat((char *) (d), (char *) (s), (size_t) sizeof(d))
  2304. X#define FGets(a,b) fgets((a), (int) (sizeof(a) - 2), (b))
  2305. X
  2306. X#ifndef NO_CONST
  2307. Xtypedef int (*cmp_t)(const void *, const void *);
  2308. X#else
  2309. Xtypedef int (*cmp_t)(void *, void *);
  2310. X#endif
  2311. X
  2312. X#define QSort(base,n,sz,cmp) \
  2313. X    qsort(base, (size_t)(n), (size_t)(sz), (cmp_t)(cmp))
  2314. X
  2315. X#ifndef SIG_PARAMS
  2316. X#define SIG_PARAMS (int sig)
  2317. X#endif
  2318. Xtypedef void (*Sig_t) SIG_PARAMS;
  2319. X
  2320. X#define Signal(a,proc) signal((a), (Sig_t)(proc))
  2321. X
  2322. X/* Quiets warnings */
  2323. X#if defined(sun)    /* ...actually, any UNIX system */
  2324. X# if defined(__GNUC__)
  2325. X#  undef  SIG_DFL
  2326. X#  undef  SIG_IGN
  2327. X#  define SIG_DFL    (Sig_t)0
  2328. X#  define SIG_IGN    (Sig_t)1
  2329. X# endif
  2330. X#endif
  2331. X
  2332. X/* Protos. */
  2333. Xchar *_Strncat(char *dst, char *src, register size_t n);
  2334. Xchar *_Strncpy(char *dst, char *src, register size_t n);
  2335. Xchar *NewString(char *oldstr);
  2336. Xchar **re_makeargv(char *promptstr, int *argc);
  2337. Xchar *onoff(int);
  2338. Xint StrToBool(char *s);
  2339. Xint confirm(char *cmd, char *file);
  2340. Xvoid fatal(char *msg);
  2341. Xchar *get_cwd(char *buf, int size);
  2342. Xint tmp_name(char *str);
  2343. Xint Getopt(int argc, char **argv, char *opstring);
  2344. Xvoid Getopt_Reset(void);
  2345. Xchar *Gets(char *promptstr, char *sline, size_t size);
  2346. Xsize_t RemoveTrailingNewline(char *cp, int *stripped);
  2347. Xunsigned long UnLSDate(char *dstr);
  2348. Xchar *Strpcpy(char *dst, char *src);
  2349. Xint UserLoggedIn(void);
  2350. Xchar *LocalPath(char *path);
  2351. Xchar *LocalDotPath(char *path);
  2352. X
  2353. X#ifdef NO_STRSTR
  2354. Xchar *strstr(char *s1, char *s2);
  2355. X#endif
  2356. X
  2357. X#endif    /* _util_h_ */
  2358. END_OF_FILE
  2359.   if test 2304 -ne `wc -c <'util.h'`; then
  2360.     echo shar: \"'util.h'\" unpacked with wrong size!
  2361.   fi
  2362.   # end of 'util.h'
  2363. fi
  2364. if test -f 'v2_Note' -a "${1}" != "-c" ; then 
  2365.   echo shar: Will not clobber existing file \"'v2_Note'\"
  2366. else
  2367.   echo shar: Extracting \"'v2_Note'\" \(2732 characters\)
  2368.   sed "s/^X//" >'v2_Note' <<'END_OF_FILE'
  2369. XVersion 1.6 of NcFTP is an interim release.  Version 2.0 is much cooler,
  2370. Xbut it wasn't ready to go by my self-imposed deadline of September 1, 1993.
  2371. XThe reason for that deadline is that my senior year will be getting under
  2372. Xway, and I don't want to work on the program during that period.  Last year
  2373. XI spent too much time on NcFTP and other projects, and not enough time on
  2374. Xstudies.  As a result, my grades slipped a bit.  Therefore I will be
  2375. Xstudying more and programming, reading news, and reading email less.  If
  2376. Xyou send me email, I _will_ read it, but it may take me awhile to get to it,
  2377. Xand I may not answer.  Please don't be offended.  I really regret having
  2378. Xto release code that is such a mess.  I should have wrote the code from
  2379. Xscratch, rather than built it upon the original BSD code (which is a mess
  2380. Xitself!).
  2381. X
  2382. XThis version is based on 1.5, which in turn was based on the betas of 1.4.
  2383. X1.4 was almost finished when I decided to add some significant features, and
  2384. Xclean up the code so it is better organized and easier to read. That version
  2385. Xis called 2.0, and isn't finished yet. The innards are totally different
  2386. Xfrom the 1.4 family, so patches to 1.6 won't work at all on 2.0. During the
  2387. Xprocess of adding stuff and cleaning up, a couple of bugs creeped in that
  2388. Xwill take time to resolve. Maybe I can work on it during Christmas break.
  2389. X
  2390. XI apologize in advance for bugs I fixed in 2.0 but forgot to re-fix
  2391. Xin 1.6 (I think I got'em all, though).
  2392. X
  2393. XHere is a list of things that are in the 2.0 code but not this version:
  2394. X
  2395. X* Easy-to-read, better organized, commented code.
  2396. X* Using my own "style guide," so source is coded uniformly.
  2397. X* Unlimited global macros.  These are really nice!  They take arguments,
  2398. X  so you can make mini-scripts.  The macros can be typed as if they
  2399. X  were commands; no more $macroname crap.
  2400. X* No-longer using .netrc and it's format.  This was necessary for the
  2401. X  global macros anyway, and it allowed me to add some other features,
  2402. X  like host aliases.  Old .netrc's won't work.  Sorry!
  2403. X* Improved command line parser, that lets any command use > and |, so
  2404. X  it behaves like a real shell command line (almost).
  2405. X* Improved 'redir' that works automatically, can reformat listings with
  2406. X  different ls flags, all without refetching it over the network.  It
  2407. X  will also facilitate remote globbing... AND remote filename completion!
  2408. X* Many little things I can't begin to list.
  2409. X
  2410. XKeep that in mind if you want to make a feature enhancement.  I'm telling
  2411. Xyou this now so you don't spend your time programming something that is
  2412. Xalready done for the 2.0 release.  Also note that patches for 1.6 will
  2413. Xhave to be re-coded for 2.0.  (The gist is that you should wait until
  2414. X2.0 is done before doing anything major).
  2415. END_OF_FILE
  2416.   if test 2732 -ne `wc -c <'v2_Note'`; then
  2417.     echo shar: \"'v2_Note'\" unpacked with wrong size!
  2418.   fi
  2419.   # end of 'v2_Note'
  2420. fi
  2421. echo shar: End of archive 5 \(of 6\).
  2422. cp /dev/null ark5isdone
  2423. MISSING=""
  2424. for I in 1 2 3 4 5 6 ; do
  2425.     if test ! -f ark${I}isdone ; then
  2426.     MISSING="${MISSING} ${I}"
  2427.     fi
  2428. done
  2429. if test "${MISSING}" = "" ; then
  2430.     echo You have unpacked all 6 archives.
  2431.     rm -f ark[1-9]isdone
  2432. else
  2433.     echo You still must unpack the following archives:
  2434.     echo "        " ${MISSING}
  2435. fi
  2436. exit 0
  2437. exit 0 # Just in case...
  2438.