home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume39 / ncftp / part05 < prev    next >
Encoding:
Text File  |  1993-08-25  |  44.9 KB  |  1,607 lines

  1. Newsgroups: comp.sources.misc
  2. From: mgleason@cse.unl.edu (Mike Gleason)
  3. Subject: v39i057:  ncftp - Alternative User Interface for FTP, v1.5.0, Part05/05
  4. Message-ID: <1993Aug26.000650.24541@sparky.sterling.com>
  5. X-Md4-Signature: 39010a522fb7895b84b073b64aa35d3e
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: NCEMRSoft
  8. Date: Thu, 26 Aug 1993 00:06:50 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: mgleason@cse.unl.edu (Mike Gleason)
  12. Posting-number: Volume 39, Issue 57
  13. Archive-name: ncftp/part05
  14. Environment: UNIX, ANSI-C, !SVR4
  15. Supersedes: ncftp: Volume 35, Issue 4-7
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  Makefile defaults.h ftp.h ftprc.h glob.h main.h
  22. #   patchlevel.h set.h sys.h tips.c util.h v2_Note
  23. # Wrapped by kent@sparky on Wed Aug 25 18:59:17 1993
  24. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  25. echo If this archive is complete, you will see the following message:
  26. echo '          "shar: End of archive 5 (of 5)."'
  27. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  28.   echo shar: Will not clobber existing file \"'Makefile'\"
  29. else
  30.   echo shar: Extracting \"'Makefile'\" \(7705 characters\)
  31.   sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  32. X# Makefile for ncftp
  33. X# 
  34. X# Major sections delimited by a dash lines.  If several lines set the same
  35. X# make variable, you can choose between the commented #samples, or just
  36. X# type what you want manually.
  37. X#--------------------------------------------------------------------------
  38. X
  39. X
  40. X# System dependent definitions.  See the README, part B.
  41. X#--------------------------------------------------------------------------
  42. XSDEFS = 
  43. X
  44. X
  45. X# Program definitions.  See the README, part C.
  46. X#--------------------------------------------------------------------------
  47. X#PDEFS =
  48. X#PDEFS = -DGETLINE
  49. X#PDEFS = -DREADLINE -DCURSES
  50. X#PDEFS = -DSOCKS
  51. XPDEFS = -DDEBUG -DDB_ERRS
  52. X
  53. X
  54. X# Choose your compiler and flags below.  Make sure you use an ANSI compiler
  55. X# that handles new style function declarations and prototypes (gcc should).
  56. X#--------------------------------------------------------------------------
  57. XCC = cc
  58. X#CC = gcc
  59. X
  60. X#CFLAGS = -O
  61. XCFLAGS = -g
  62. X
  63. X#LFLAGS = -s
  64. XLFLAGS =
  65. X
  66. X
  67. X# Additional libraries and/or object files.
  68. X# 
  69. X# For each library, add -lLIBNAME to the LIBS line below, for a library
  70. X#   named libLIBNAME.a.
  71. X#
  72. X# For each object file, just add the pathname of the object file.
  73. X#
  74. X# Some may need any of -lsocket, -lnet, -linet, -lintl, or -lnsl. 
  75. X# You'll need -lcurses or -ltermcap if CURSES is defined.
  76. X# You'll need -lreadline AND either -lcurses or -ltermcap if you
  77. X#   want to use the GNU Readline library.
  78. X# You'll need -lgetline (compile it as a library) if you want to use
  79. X#   getline.
  80. X# You'll need to know where the Rconnect.o object file is if you want
  81. X#   to use Socks.
  82. X#--------------------------------------------------------------------------
  83. X#LIBS =
  84. X#LIBS = -ldbmalloc
  85. X#LIBS = -lgetline
  86. X#LIBS = -lreadline -lcurses
  87. X#LIBS = ../lib/Rconnect.o
  88. X
  89. X
  90. X# If the libraries are in a non-standard directory, or you if want to use
  91. X# getline or readline and they aren't installed system-wide, add the
  92. X# extra directories to look in here, using -L's.
  93. X#--------------------------------------------------------------------------
  94. X#LIBDIRS =
  95. XLIBDIRS = -L$(HOME)/src
  96. X#LIBDIRS = -L./getline
  97. X#LIBDIRS = -L./readline
  98. X
  99. X
  100. X# Additional headers.
  101. X# If you defined READLINE or GETLINE, you have to tell where it's header
  102. X# file can be found.
  103. X#--------------------------------------------------------------------------
  104. X#HDRDIRS = -I.
  105. XHDRDIRS = -I$(HOME)/src
  106. X#HDRDIRS = -I./getline
  107. X#HDRDIRS = -I./readline
  108. X
  109. X
  110. X# If you want to 'make install,' edit these variables, otherwise don't
  111. X# worry about it.
  112. X#--------------------------------------------------------------------------
  113. XBINDIR = /usr/local
  114. XMANDIR = /usr/man/man1
  115. XRM = rm -f
  116. XCP = cp
  117. X
  118. X
  119. X#************************************************
  120. X#*** SHOULD NOT NEED TO EDIT BELOW THIS POINT ***
  121. X#************************************************
  122. X
  123. XDEFS = $(PDEFS) $(SDEFS)
  124. XMK = $(CC) $(CFLAGS) $(DEFS) $(HDRDIRS) $(LFLAGS) $(LIBDIRS) $(LIBS)
  125. X
  126. XNAME = ncftp
  127. XMAN = ncftp.1
  128. XALL = $(SRCS) $(HEADERS) patchlevel.h Blurb README Makefile $(MAN) \
  129. Xv2_Note
  130. X
  131. XVERS=150
  132. XPKGNAME = ncftp$(VERS)
  133. XTARNAME = $(PKGNAME).tar
  134. XSRCS = cmds.c cmdtab.c ftp.c ftprc.c getpass.c glob.c main.c open.c set.c \
  135. Xtips.c util.c
  136. X  
  137. XHEADERS = cmds.h copyright.h defaults.h ftp.h ftprc.h getpass.h glob.h \
  138. Xmain.h open.h set.h sys.h util.h
  139. X   
  140. XOBJS = cmds.o cmdtab.o ftp.o ftprc.o getpass.o glob.o main.o open.o set.o \
  141. Xtips.o util.o
  142. X
  143. XC_COMPILE = $(CC) $(CFLAGS) $(DEFS) $(HDRDIRS)
  144. XC_COMPILE2 = $(CC) $(CFLAGS) $(DEFS) -DMK='"$(MK)"' $(HDRDIRS)
  145. X
  146. Xall: $(NAME) done
  147. X
  148. X$(NAME): $(OBJS)
  149. X    $(CC) $(LFLAGS) $(LIBDIRS) $(OBJS)  -o $(NAME) $(LIBS)
  150. X
  151. Xinstall: $(NAME)
  152. X    $(CP) $(NAME) $(BINDIR)/$(NAME)
  153. X    $(CP) $(MAN)  $(MANDIR)/$(MAN)
  154. X
  155. Xuninstall:
  156. X    $(RM) $(BINDIR)/$(NAME)
  157. X    $(RM) $(MANDIR)/$(MAN)
  158. X
  159. Xcmds.o:
  160. X    $(C_COMPILE2) cmds.c -c -o cmds.o
  161. X
  162. X.c.o:
  163. X    $(C_COMPILE) -c $<
  164. X
  165. Xclean:
  166. X    rm -f $(OBJS) core $(NAME)
  167. X
  168. XSGI_CFLAGS = -prototypes -xansi -fullwarn -woff 211,269,270,303,309,24,51
  169. XFTPDIR=/usr/people/ftp/pub/mgleason
  170. X
  171. Xshared: $(OBJS)
  172. X     $(CC) $(OBJS)  $(LIBDIRS) -o $(NAME) -lc_s $(LIBS) -s
  173. X     -@ls -l $(NAME)
  174. X
  175. Xlint: $(SRCS)
  176. X    lint $(SRCS) $(CFLAGS) $(DEFS) > './Junk/lint'
  177. X
  178. Xtags:
  179. X    ctags -x $(SRCS) $(HEADERS) | sort -f > tags
  180. X    
  181. Xtar:
  182. X    tar cvf - $(ALL) | compress > $(TARNAME).Z
  183. X    ls -l $(TARNAME).Z
  184. X
  185. Xgz:
  186. X    tar cvf - $(ALL) | gzip > $(TARNAME).z
  187. X    ls -l $(TARNAME).z
  188. X
  189. Xshar2:
  190. X    shar $(ALL) > $(NAME).shar
  191. X
  192. Xshar:
  193. X    shar $(ALL) | cat Blurb - > $(NAME).shar
  194. X
  195. Xdone: $(NAME)
  196. X    -@ls -l $(NAME)
  197. X    -@echo 'Done.'
  198. X
  199. X
  200. Xpixie: $(NAME) $(NAME).Counts $(NAME).Addrs
  201. X    prof -pixie $(NAME) $(NAME).Addrs $(NAME).Counts -feedback Feedback
  202. X
  203. X$(NAME).Addrs: $(NAME)
  204. X    pixie -o $(NAME).pixie $(NAME)
  205. X
  206. X$(NAME).Counts: ftp $(NAME).Addrs
  207. X    $(NAME).pixie
  208. X
  209. Xprofile:
  210. X    rm -f *.[ou]
  211. X    cc $(SGI_CFLAGS) $(SRCS) $(DEFS)  -g -p -o ncftp.prof
  212. X    ncftp.prof
  213. X    prof ncftp.prof mon.out
  214. X
  215. Xrmobjs:
  216. X    -@rm -f *.[ou]
  217. X
  218. Xfreshdebug: rmobjs
  219. X    pmake "CFLAGS=$(SGI_CFLAGS) -g" LFLAGS=-g
  220. X
  221. Xdebug:
  222. X    pmake "CFLAGS=$(SGI_CFLAGS) -g" LFLAGS=-g
  223. X
  224. Xopt: rmobjs
  225. X    pmake "CFLAGS=-O2 $(SGI_CFLAGS)" LFLAGS=-s
  226. X    -@ls -l $(NAME)
  227. X
  228. Xshopt: opt shared
  229. X
  230. Xgopt: rmobjs
  231. X    pmake CC=gcc "CFLAGS=-O2 $(SGI_CFLAGS)" LFLAGS=-s
  232. X    -@ls -l $(NAME)
  233. X
  234. XJUNK = ~/N/Junk
  235. X
  236. Xmantst: ncftp.1
  237. X    nroff -man ncftp.1 > $(JUNK)/ncftp.man
  238. X    less $(JUNK)/ncftp.man
  239. X
  240. Xsz:
  241. X    sz -e $(ALL)
  242. X
  243. Xgetline:
  244. X    -rm util.o cmds.o tips.o
  245. X    make PDEFS=-DGETLINE LIBS=-lgetline LIBDIRS=-L$(HOME)/src/ncftp/getline \
  246. X        HDRDIRS=-I$(HOME)/src/ncftp/getline
  247. X
  248. Xfinst:
  249. X    -@mkdir /tmp/$(PKGNAME)
  250. X    cp -r $(ALL) /tmp/$(PKGNAME)
  251. X    (cd /tmp ; tar cvf - $(PKGNAME) | gzip -f > $(FTPDIR)/$(TARNAME).z )
  252. X    chmod 644 $(FTPDIR)/$(TARNAME).z
  253. X    -@ls -l $(FTPDIR)/$(TARNAME).z
  254. X    -@rm -rf /tmp/$(PKGNAME)
  255. X
  256. Xdepend:
  257. X    cc -M $(SRCS) | grep -v '/' >> Makefile
  258. X
  259. Xprotos:
  260. X    apply "mkptypes -x -A %1 > %1.pr" $(SRCS)
  261. X    -@echo 'Done.'
  262. X
  263. Xpatch:
  264. X    -rm -rf /tmp/old /tmp/new
  265. X    -mkdir /tmp/old /tmp/new
  266. X    cp ~/ncftp.shar /tmp/old/oldncftp.shar
  267. X    (cd /tmp/old ; unshar -n oldncftp.shar )
  268. X    make shar
  269. X    cp ncftp.shar /tmp/new
  270. X    (cd /tmp/new; unshar -n ncftp.shar )
  271. X    rm /tmp/new/ncftp.shar /tmp/old/oldncftp.shar
  272. X    (cd /tmp/old ; diff -c . ../new > ../pch)
  273. X
  274. Xcoall:
  275. X    co -u -f $(SRCS) $(HEADERS)
  276. X
  277. Xnewver:
  278. X    ci -Nv$(VERS) -f "-mv$(VERS) release" -M -u $(SRCS) $(HEADERS)
  279. X
  280. Xciall:
  281. X    ci -q -M -u $(SRCS) $(HEADERS)
  282. X
  283. X# Dependencies:
  284. Xcmds.o: cmds.c 
  285. Xcmds.o: sys.h 
  286. Xcmds.o: util.h 
  287. Xcmds.o: cmds.h 
  288. Xcmds.o: main.h 
  289. Xcmds.o: ftp.h 
  290. Xcmds.o: ftprc.h 
  291. Xcmds.o: getpass.h 
  292. Xcmds.o: glob.h 
  293. Xcmds.o: set.h 
  294. Xcmds.o: defaults.h 
  295. Xcmds.o: copyright.h 
  296. Xcmdtab.o: cmdtab.c 
  297. Xcmdtab.o: sys.h 
  298. Xcmdtab.o: util.h 
  299. Xcmdtab.o: cmds.h 
  300. Xcmdtab.o: main.h 
  301. Xcmdtab.o: ftp.h 
  302. Xcmdtab.o: ftprc.h 
  303. Xcmdtab.o: glob.h 
  304. Xcmdtab.o: open.h 
  305. Xcmdtab.o: set.h 
  306. Xcmdtab.o: copyright.h 
  307. Xftp.o: ftp.c 
  308. Xftp.o: sys.h 
  309. Xftp.o: util.h 
  310. Xftp.o: ftp.h 
  311. Xftp.o: cmds.h 
  312. Xftp.o: main.h 
  313. Xftp.o: ftprc.h 
  314. Xftp.o: getpass.h 
  315. Xftp.o: defaults.h 
  316. Xftp.o: copyright.h 
  317. Xftprc.o: ftprc.c 
  318. Xftprc.o: sys.h 
  319. Xftprc.o: util.h 
  320. Xftprc.o: ftprc.h 
  321. Xftprc.o: main.h 
  322. Xftprc.o: cmds.h 
  323. Xftprc.o: set.h 
  324. Xftprc.o: defaults.h 
  325. Xftprc.o: copyright.h 
  326. Xgetpass.o: getpass.c 
  327. Xgetpass.o: sys.h 
  328. Xgetpass.o: util.h 
  329. Xgetpass.o: cmds.h 
  330. Xgetpass.o: getpass.h 
  331. Xgetpass.o: copyright.h 
  332. Xglob.o: glob.c 
  333. Xglob.o: sys.h 
  334. Xglob.o: util.h 
  335. Xglob.o: glob.h 
  336. Xglob.o: cmds.h 
  337. Xglob.o: copyright.h 
  338. Xmain.o: main.c 
  339. Xmain.o: sys.h 
  340. Xmain.o: util.h 
  341. Xmain.o: cmds.h 
  342. Xmain.o: main.h 
  343. Xmain.o: ftp.h 
  344. Xmain.o: ftprc.h 
  345. Xmain.o: open.h 
  346. Xmain.o: set.h 
  347. Xmain.o: defaults.h 
  348. Xmain.o: copyright.h 
  349. Xopen.o: open.c 
  350. Xopen.o: sys.h 
  351. Xopen.o: util.h 
  352. Xopen.o: open.h 
  353. Xopen.o: cmds.h 
  354. Xopen.o: ftp.h 
  355. Xopen.o: ftprc.h 
  356. Xopen.o: main.h 
  357. Xopen.o: defaults.h 
  358. Xopen.o: copyright.h 
  359. Xset.o: set.c 
  360. Xset.o: sys.h 
  361. Xset.o: util.h 
  362. Xset.o: cmds.h 
  363. Xset.o: main.h 
  364. Xset.o: set.h 
  365. Xset.o: defaults.h 
  366. Xset.o: copyright.h 
  367. Xtips.o: tips.c 
  368. Xtips.o: sys.h 
  369. Xtips.o: util.h 
  370. Xutil.o: util.c 
  371. Xutil.o: sys.h 
  372. Xutil.o: util.h 
  373. Xutil.o: cmds.h 
  374. Xutil.o: main.h 
  375. Xutil.o: ftp.h 
  376. Xutil.o: ftprc.h 
  377. Xutil.o: defaults.h 
  378. Xutil.o: copyright.h 
  379. END_OF_FILE
  380.   if test 7705 -ne `wc -c <'Makefile'`; then
  381.     echo shar: \"'Makefile'\" unpacked with wrong size!
  382.   fi
  383.   # end of 'Makefile'
  384. fi
  385. if test -f 'defaults.h' -a "${1}" != "-c" ; then 
  386.   echo shar: Will not clobber existing file \"'defaults.h'\"
  387. else
  388.   echo shar: Extracting \"'defaults.h'\" \(2610 characters\)
  389.   sed "s/^X//" >'defaults.h' <<'END_OF_FILE'
  390. X/* Defaults.h: default values for ftp's common variables */
  391. X
  392. X/* These are all surrounded by #ifndef blocks so you can just use
  393. X * the -D flag with your compiler (i.e. -DZCAT=\"/usr/local/bin/zcat\").
  394. X */
  395. X
  396. X#ifndef _DEFAULTS_H_
  397. X#define _DEFAULTS_H_
  398. X
  399. X/*  $RCSfile: defaults.h,v $
  400. X *  $Revision: 14020.13 $
  401. X *  $Date: 93/07/09 10:58:27 $
  402. X */
  403. X
  404. X#ifndef NEWMAILMESSAGE            /* For english speakers, "You have new mail." */
  405. X#define NEWMAILMESSAGE "You have new mail."
  406. X#endif
  407. X
  408. X#ifndef ZCAT                    /* Usually "zcat," but use the full pathname */
  409. X                                /* if possible. */
  410. X#define ZCAT "zcat"
  411. X#endif
  412. X
  413. X#ifndef MAX_XFER_BUFSIZE
  414. X#define MAX_XFER_BUFSIZE 32768
  415. X#endif
  416. X
  417. X#ifndef dANONOPEN                /* 1 or 0, usually 1 */
  418. X#define dANONOPEN    1
  419. X#endif
  420. X
  421. X#ifndef dDEBUG                    /* 1 or 0, usually 0 */
  422. X#define dDEBUG 0
  423. X#endif
  424. X
  425. X#ifndef dMPROMPT                /* Usually 1, I prefer 0... */
  426. X#define dMPROMPT 0
  427. X#endif
  428. X
  429. X#ifndef dVERBOSE                /* V_QUIET, V_ERRS, V_TERSE, V_VERBOSE */
  430. X#define dVERBOSE V_TERSE
  431. X#endif
  432. X
  433. X#ifndef dPROMPT                    /* short: "@Bftp@P>" */
  434. X                                /* long: "@B@E @UNcFTP@P @B@M@D@P ->" */
  435. X#define dPROMPT "@B@c@Mncftp@P>" /* new two line prompt */
  436. X#endif
  437. X
  438. X#ifndef dPAGER                    /* if set to empty string, act like 'cat' */
  439. X#define dPAGER "more"
  440. X#endif
  441. X
  442. X#ifndef dLOGNAME                /* usu. put in the user's home directory. */
  443. X#define dLOGNAME "~/.ftplog"
  444. X#endif
  445. X
  446. X#ifndef dRECENTF                /* usu. put in the user's home directory. */
  447. X#define dRECENTF "~/.ncrecent"
  448. X#endif
  449. X
  450. X#ifndef dMAXRECENTS                /* limit to how many recent sites to save. */
  451. X#define dMAXRECENTS 16
  452. X#endif
  453. X
  454. X#ifndef dRECENT_ON                /* Do you want the recent log on? */
  455. X                                /* usually 1. */
  456. X#define dRECENT_ON 1
  457. X#endif
  458. X
  459. X                                /* Do you want logging on by default? */
  460. X#ifndef dLOGGING                /* usually 0 */
  461. X#define dLOGGING 0
  462. X#endif
  463. X
  464. X#ifndef dTYPE                    /* usually TYPE_A */
  465. X#define dTYPE TYPE_A
  466. X#endif
  467. X
  468. X#ifndef dTYPESTR                /* usually "ascii" */
  469. X#define dTYPESTR "ascii"
  470. X#endif
  471. X
  472. X#ifndef dREDIALDELAY            /* usu. 60 (seconds). */
  473. X#define dREDIALDELAY 60
  474. X#endif
  475. X
  476. X#ifndef CMDLINELEN
  477. X#define CMDLINELEN 256
  478. X#endif
  479. X
  480. X#ifndef RECEIVEDLINELEN
  481. X#define RECEIVEDLINELEN 256
  482. X#endif
  483. X
  484. X#ifndef MAXMACROS
  485. X#define MAXMACROS 16
  486. X#endif
  487. X
  488. X#ifndef MACBUFLEN                /* usually 4096. */
  489. X#define MACBUFLEN 4096
  490. X#endif
  491. X
  492. X/* Do you want binary transfers by default? */
  493. X#ifndef dAUTOBINARY                /* usually 1 */
  494. X#define dAUTOBINARY 1
  495. X#endif
  496. X
  497. X#ifndef dPROGRESS
  498. X#define dPROGRESS pr_philbar    /* can be: pr_none, pr_percent, pr_philbar,
  499. X                                 * or pr_kbytes
  500. X                                 */
  501. X#endif
  502. X
  503. X/* Default login name at gateway */
  504. X#ifdef GATEWAY
  505. X#    ifndef dGATEWAY_LOGIN
  506. X#        define dGATEWAY_LOGIN "ftp"
  507. X#    endif
  508. X#endif
  509. X
  510. X#endif    /* _DEFAULTS_H_ */
  511. X
  512. X/* eof */
  513. END_OF_FILE
  514.   if test 2610 -ne `wc -c <'defaults.h'`; then
  515.     echo shar: \"'defaults.h'\" unpacked with wrong size!
  516.   fi
  517.   # end of 'defaults.h'
  518. fi
  519. if test -f 'ftp.h' -a "${1}" != "-c" ; then 
  520.   echo shar: Will not clobber existing file \"'ftp.h'\"
  521. else
  522.   echo shar: Extracting \"'ftp.h'\" \(1375 characters\)
  523.   sed "s/^X//" >'ftp.h' <<'END_OF_FILE'
  524. X/* ftp.h */
  525. X
  526. X#ifndef _ftp_h_
  527. X#define _ftp_h_
  528. X
  529. X/*  $RCSfile: ftp.h,v $
  530. X *  $Revision: 14020.11 $
  531. X *  $Date: 93/07/09 11:04:12 $
  532. X */
  533. X
  534. X#define IS_FILE 1
  535. X#define IS_STREAM 0
  536. X#define IS_PIPE -1
  537. X
  538. X/* Progress-meter types. */
  539. X#define pr_none 0
  540. X#define pr_percent 1
  541. X#define pr_philbar 2
  542. X#define pr_kbytes 3
  543. X#define pr_dots 4
  544. X#define pr_last pr_dots
  545. X
  546. Xint hookup(char *, unsigned int);
  547. Xint Login(char *userNamePtr, char *passWordPtr, char *accountPtr, int doInit);
  548. Xvoid cmdabort SIG_PARAMS;
  549. Xint command(char *);
  550. Xint quiet_command(char *);
  551. Xint verbose_command(char *);
  552. Xint getreply(int);
  553. Xint start_progress(int, char *);
  554. Xint progress_report(int);
  555. Xvoid end_progress(char *, char *, char *);
  556. Xvoid close_file(FILE **, int);
  557. Xvoid abortsend SIG_PARAMS;
  558. Xint sendrequest(char *, char *, char *);
  559. Xvoid abortrecv SIG_PARAMS;
  560. Xvoid GetLSRemoteDir(char *, char *);
  561. Xint AdjustLocalFileName(char *);
  562. Xint SetToAsciiForLS(int, int);
  563. Xint IssueCommand(char *, char *);
  564. XFILE *OpenOutputFile(int, char *, char *, sig_t *);
  565. Xvoid ReceiveBinary(FILE *, FILE *, int *, char *);
  566. Xvoid AddRedirLine(char *);
  567. Xvoid ReceiveAscii(FILE *, FILE *, int *, char *, int);
  568. Xvoid CloseOutputFile(FILE *, int, char *, time_t);
  569. Xvoid ResetOldType(int);
  570. Xint FileType(char *);
  571. Xvoid CloseData(void);
  572. Xint recvrequest(char *, char *, char *, char *);
  573. Xint initconn(void);
  574. XFILE *dataconn(char *);
  575. X
  576. X#endif /* _ftp_h_ */
  577. X
  578. X/* eof ftp.h */
  579. END_OF_FILE
  580.   if test 1375 -ne `wc -c <'ftp.h'`; then
  581.     echo shar: \"'ftp.h'\" unpacked with wrong size!
  582.   fi
  583.   # end of 'ftp.h'
  584. fi
  585. if test -f 'ftprc.h' -a "${1}" != "-c" ; then 
  586.   echo shar: Will not clobber existing file \"'ftprc.h'\"
  587. else
  588.   echo shar: Extracting \"'ftprc.h'\" \(931 characters\)
  589.   sed "s/^X//" >'ftprc.h' <<'END_OF_FILE'
  590. X/* ftprc.h */
  591. X
  592. X#ifndef _ftprc_h_
  593. X#define _ftprc_h_
  594. X
  595. X/*  $RCSfile: ftprc.h,v $
  596. X *  $Revision: 14020.11 $
  597. X *  $Date: 93/05/21 05:45:31 $
  598. X */
  599. X
  600. X#define NETRC "netrc"
  601. X#define FTPRC "ncftprc"
  602. X
  603. X#define RC_DELIM " \n\t,"
  604. X
  605. Xtypedef struct site *siteptr;
  606. Xtypedef struct site {
  607. X    char *name;            /* name (or IP address) of site */
  608. X    siteptr next;
  609. X} site;
  610. X
  611. Xtypedef struct recentsite {
  612. X    char *name;            /* name (or IP address) of site */
  613. X    char *dir;            /* directory we were in last time we called. */
  614. X    time_t lastcall;    /* when this site was called last. */
  615. X} recentsite;
  616. X
  617. Xint thrash_rc(void);
  618. Xvoid AddNewSitePtr(char *word);
  619. Xint ruserpass2(char *host, char **user, char **pass, char **acct);
  620. Xvoid GetFullSiteName(char *host, char *lastdir);
  621. Xvoid ReadRecentSitesFile(void);
  622. Xvoid WriteRecentSitesFile(void);
  623. Xvoid AddRecentSite(char *host, char *lastdir);
  624. Xvoid UpdateRecentSitesList(char *host, char *lastdir);
  625. Xvoid PrintSiteList(void);
  626. X
  627. X#endif
  628. X/* eof */
  629. END_OF_FILE
  630.   if test 931 -ne `wc -c <'ftprc.h'`; then
  631.     echo shar: \"'ftprc.h'\" unpacked with wrong size!
  632.   fi
  633.   # end of 'ftprc.h'
  634. fi
  635. if test -f 'glob.h' -a "${1}" != "-c" ; then 
  636.   echo shar: Will not clobber existing file \"'glob.h'\"
  637. else
  638.   echo shar: Extracting \"'glob.h'\" \(375 characters\)
  639.   sed "s/^X//" >'glob.h' <<'END_OF_FILE'
  640. X/* glob.h */
  641. X
  642. X#ifndef _glob_h_
  643. X#define _glob_h_ 1
  644. X
  645. X/*  $RCSfile: glob.h,v $
  646. X *  $Revision: 14020.11 $
  647. X *  $Date: 93/05/21 05:45:32 $
  648. X */
  649. X
  650. Xchar **glob(char *v);
  651. Xint letter(char c);
  652. Xint digit(char c);
  653. Xint any(int c, char *s);
  654. Xint blklen(char **av);
  655. Xchar **blkcpy(char **oav, char **bv);
  656. Xvoid blkfree(char **av0);
  657. Xchar **copyblk(char **v);
  658. Xint gethdir(char *home_dir);
  659. X
  660. X#endif
  661. X
  662. END_OF_FILE
  663.   if test 375 -ne `wc -c <'glob.h'`; then
  664.     echo shar: \"'glob.h'\" unpacked with wrong size!
  665.   fi
  666.   # end of 'glob.h'
  667. fi
  668. if test -f 'main.h' -a "${1}" != "-c" ; then 
  669.   echo shar: Will not clobber existing file \"'main.h'\"
  670. else
  671.   echo shar: Extracting \"'main.h'\" \(889 characters\)
  672.   sed "s/^X//" >'main.h' <<'END_OF_FILE'
  673. X/* main.h */
  674. X
  675. X#ifndef _main_h_
  676. X#define _main_h_
  677. X
  678. X/*  $RCSfile: main.h,v $
  679. X *  $Revision: 14020.12 $
  680. X *  $Date: 93/05/21 05:45:33 $
  681. X */
  682. X
  683. Xstruct userinfo {
  684. X    str32   username;
  685. X    string  homedir;
  686. X    string  shell;
  687. X    string  hostname;
  688. X    int        uid;
  689. X};
  690. X
  691. Xvoid intr SIG_PARAMS;
  692. Xint getuserinfo(void);
  693. Xint init_arrays(void);
  694. Xvoid init_transfer_buffer(void);
  695. Xvoid init_prompt(void);
  696. Xvoid lostpeer SIG_PARAMS;
  697. Xvoid cmdscanner(int top);
  698. Xchar *strprompt(void);
  699. Xvoid makeargv(void);
  700. Xchar *slurpstring(void);
  701. Xint help(int argc, char **argv);
  702. Xvoid trim_log(void);
  703. Xint CheckNewMail(void);
  704. X
  705. X#ifdef CURSES
  706. Xvoid tcap_put(char *cap);
  707. Xvoid termcap_init(void);
  708. Xvoid termcap_get(char *dest, char *attr);
  709. X#ifdef NO_CONST
  710. Xextern char *tgetstr(char *, char **);
  711. X#else
  712. Xextern char *tgetstr(const char *, char **);
  713. X#endif
  714. X#endif    /* CURSES */
  715. X/* Should be in a 'tips.h,' but... */
  716. Xvoid PrintTip(void);
  717. X
  718. X#endif    /* _main_h_ */
  719. X
  720. END_OF_FILE
  721.   if test 889 -ne `wc -c <'main.h'`; then
  722.     echo shar: \"'main.h'\" unpacked with wrong size!
  723.   fi
  724.   # end of 'main.h'
  725. fi
  726. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  727.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  728. else
  729.   echo shar: Extracting \"'patchlevel.h'\" \(6991 characters\)
  730.   sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  731. X/* patchlevel.h */
  732. X
  733. X/*
  734. X * v1.0.0 - December 6, 1992.
  735. X *    Initial release.
  736. X *
  737. X * v1.0.1 - December 8, 1992.
  738. X *  Added default value for NCARGS in glob.c for systems that don't define it.
  739. X *  Fixed pdir bug which was caused by me mistakenly adding the page-a-
  740. X *  compressed-file feature to ls instead of page.  Fixed bug in documentation,
  741. X *  which had the same error!  Added spec for Ultrix in sys.h.  Fixed error
  742. X *  in sys.h that recommended -Dconst instead of -Dconst="".  Added GETPASS
  743. X *  compile flag to use getpass() instead of getpass2(), which make compiling
  744. X *  easier if the compiler choked in cmds.c.  Added GETCWDSIZET for systems
  745. X *  whose getcwd() takes a size_t instead of an int.
  746. X *
  747. X * v1.0.2 - Jan 17, 1993.
  748. X *  Using the cpp symbol CONST instead of const to tell
  749. X *  the compiler not to use the 'const' directive.  Checking for __sgi as
  750. X *  well as sgi in sys.h.  Added #ifndef __GNUC__ block to make SunOS users
  751. X *  use gcc.  You can avoid trying to include <unistd.h> by defining
  752. X *  NO_UNISTDH.  Added DG/UX entry in sys.h.  Also added still another cpp
  753. X *  symbol, BAD_INETADDR, which is used if inet_addr returns a structure
  754. X *  instead of a u_long (this is only for DG/UX so far).  Changed long to
  755. X *  int in wait().  Added default value for NCARGS in glob.c.  Added cpp
  756. X *  symbol NO_STDLIBH for systems without <stdlib.h>.  Fixed 'quote.'
  757. X *  Fixed 'size.'  Set all's string variable are printed in double quotes.
  758. X *  Ansi-escapes is init'd to 1 if TERM==xterm.  Fixed 'type tenex.'  Set
  759. X *  verbose makes sure verbose is within bounds and prints messages now.
  760. X *  Better getpass2.  Tries .ncftprc before .netrc.  @N adds a \n to prompt.
  761. X *  ls() is more flexible.  Macdef and $ print current macros if no arg
  762. X *  is given.  getpass2 is now Getpass, and accompanying this are
  763. X *  more cpp symbols SGTTYB and TERMIOS.  Better SCO support.  No longer using
  764. X *  gets(), instead using own Gets() which is safer.  Better termcap support,
  765. X *  or actually curses support, to get ansi-escape sequences.  Using -FC
  766. X *  instead of -CF for ls flags, do avoid a rare conflict.  Progress meters
  767. X *  work better.  Phil Dietz added a cool bar graph one, and I added another
  768. X *  similar to the default percentage meter that shows the # KB transferred,
  769. X *  which will work on systems not supporting SIZE.  Fixed floating point
  770. X *  exception bug in put/mput.  Fixed implicit_cd to work with wuarchive-ish
  771. X *  cd messages.  Added NeXT and DYNIX blocks in sys.h.  
  772. X *  Fixed bug in _cd, that was trying to use wildcards when it
  773. X *  shouldn't.  Fixed bug in macdef.  Fixed small bug in getreply.  Turned
  774. X *  off echoing during the progress-meter.  Added syslogging capability.
  775. X *
  776. X * v1.4.0 - Summer 1993, not finished yet. 
  777. X *  Fixed error in CONST block in ftpdefs.h.  Fixed error in sys.h so that when
  778. X *  you compile with -DGETPASS it uses getpass.  'ls' bug with wildcards
  779. X *  fixed.  'ls' enhanced to take multiple remote paths.  Added new cpp symbol
  780. X *  STRICT_PROTOS so I don't have to worry about the correct declarations of
  781. X *  int returning functions.  Moved termcap_init() up.  Changed value of
  782. X *  tcap_plain to "me" from "se."  Defining TERMIOS by default for SunOS.
  783. X *  Edited perror to not print ioctl errors (for SunOS only).  Making sure
  784. X *  we use ioctl only on tty files.  Using <arpa/ftp.h> for SCO to get
  785. X *  MAXPATHLEN instead of <sys/arpa.h>.  386BSD and Pyramid OSx entries added
  786. X *  to sys.h.  Fixed subtle error in FGets macro.  Using private _Strn
  787. X *  string routines, with macros to them instead of the strn routines.
  788. X *  Added support for GNU Readline (not included).  Added BROKEN_MEMCPY
  789. X *  CPP symbol for other systems with same bug as that of SCO (see ftp.c).
  790. X *  Changed mail detection code a bit, hopefully ending the false alarms
  791. X *  that some systems were having.  New CPP symbol, dFTP_PORT, lets you define
  792. X *  the default ftp port if your OS (i.e. ISC unix) is wrong.  Fixed bugs
  793. X *  in 'rstatus' and 'syst;'  apparently no one noticed...  Phased out
  794. X *  mls and mdir since ls does it all now.  Added dPROGRESS to defaults.h to
  795. X *  set the default progress indicator.  Colon-mode wasn't quiet; fixed.
  796. X *  Some new prompt @flags added.  @flags that may result in an empty string
  797. X *  are set so that when they do print something, they tack on a trailing
  798. X *  space.  May have fixed bug that caused 'page' to drop connection when
  799. X *  you quit your pager.  NcFTP tries to prevent itself from becoming a
  800. X *  mindless zombie process.  Fixed bug in 'rename.'  Added another progress
  801. X *  indicator that doesn't use any backspaces.  Firewall support added by
  802. X *  Dave Wolfe (dwolfe@pffft.sps.mot.com).  Saving the entire servent struct,
  803. X *  not just a ptr to it.  Support the DOTDIR env variable.  Fetched files'
  804. X *  modification times now set to that on the server.  Added RO-Var "netrc."
  805. X *  Munged Makefile to support 'install' and 'uninstall,' and passing the
  806. X *  installation parameters as a -D flag.  Awesome new recent site log!
  807. X *  Can type 'open' by itself to print out the sites in our netrc/recent
  808. X *  buffers.  Added show command.  Drastic changes in source code; cmds.c
  809. X *  made smaller by spawning set.c and util.c; ftpdefs.h eliminated.  Improved
  810. X *  on-line help.  Revamped the command table, by eliminating obselete fields
  811. X *  and adding a usage field to print a cmd's usage message.  Removed all the
  812. X *  useless settings of the 'code' variable.  Added tips.c.  Better support
  813. X *  for ~s and environment vars in pathnames.  Ascii transfers can get whole
  814. X *  lines at a time instead of just chars at a time, so ascii transfers may
  815. X *  be a bit faster.  Old FTP commands are acknowledged at least.  Some
  816. X *  additions for Apollo in sys.h.  Code in ftp.c cleaned up a bit, most
  817. X *  notably the obnoxiously long recvrequest() function has been broken up
  818. X *  into quite a few subroutines; it's still too long for my taste, though.
  819. X *  Incorporated some stuff by Tom Dickey.  Enhanced Perror() function to
  820. X *  print more stuff if DB_ERRS is defined.  Added 'ftpcat' mode.  You can
  821. X *  now turnoff the startup msg.  GNU gzip support added.  Added dbprintf()
  822. X *  function to print the debug messages.  Changed mind and decided to
  823. X *  read the whole stream anyway on aborts for better stability;  you can
  824. X *  still try the aborting the stream if you define TryAbort.  Added 'site'
  825. X *  command.  Fixed bug where verbose was left set to V_QUIET when you used
  826. X *  colon-mode.  Printing a warning when you try something like 'ls -t *.Z,'
  827. X *  because wildcards don't work right with ls flags. Verbose and debug can
  828. X *  be set directly from the cmd line (i.e. -D 3, not -DDD).  Verbosity can
  829. X *  be set using their ascii names, in addition to it's number, like 'set
  830. X *  verbose = quiet.'  Removed setpeer from cmds.c, and created new files,
  831. X *  open.{c,h} dedicated to it; broke up setpeer into smaller sub-procs,
  832. X *  and commented whole file (yay!).  Added a new user var, anon-open,
  833. X *  for those folks who don't want anon logins as the default.
  834. X */
  835. END_OF_FILE
  836.   if test 6991 -ne `wc -c <'patchlevel.h'`; then
  837.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  838.   fi
  839.   # end of 'patchlevel.h'
  840. fi
  841. if test -f 'set.h' -a "${1}" != "-c" ; then 
  842.   echo shar: Will not clobber existing file \"'set.h'\"
  843. else
  844.   echo shar: Extracting \"'set.h'\" \(1029 characters\)
  845.   sed "s/^X//" >'set.h' <<'END_OF_FILE'
  846. X/* Set.h */
  847. X
  848. X#ifndef _set_h_
  849. X#define _set_h_
  850. X
  851. X/*  $RCSfile: set.h,v $
  852. X *  $Revision: 14020.11 $
  853. X *  $Date: 93/06/26 06:21:32 $
  854. X */
  855. X
  856. X/* Variable types. */
  857. X#define INT        1
  858. X#define LONG    2
  859. X#define STR        3
  860. X#define BOOL    4
  861. X
  862. Xtypedef void (*setvarproc)(char *, int);
  863. Xstruct var {
  864. X    char            *name;
  865. X    short            nmlen;
  866. X    short            type;
  867. X    short            conn_required;
  868. X    void            *var;
  869. X    setvarproc        proc;
  870. X};
  871. X
  872. X#define VARENTRY(n,t,c,v,p)    { (n), (short)(sizeof(n) - 1), (t), (c), (v), (setvarproc)(p) }
  873. X#define NVARS ((int) (sizeof(vars)/sizeof(struct var)))
  874. X
  875. Xvoid set_prompt(char *new, int unset);
  876. Xvoid set_log(char *fname, int unset);
  877. Xvoid set_ldir(char *ldir, int unset);
  878. X#ifdef GATEWAY
  879. Xvoid set_gateway(char *, int);
  880. Xvoid set_gatelogin(char *, int);
  881. X#endif
  882. Xvoid set_pager(char *new, int unset);
  883. Xvoid set_verbose(char *new, int unset);
  884. Xvoid set_type(char *newtype, int unset);
  885. Xstruct var *match_var(char *varname);
  886. Xvoid show_var(struct var *v);
  887. Xvoid show(char *varname);
  888. Xint do_show(int argc, char **argv);
  889. Xint set(int argc, char **argv);
  890. X
  891. X#endif    /* _set_h_ */
  892. END_OF_FILE
  893.   if test 1029 -ne `wc -c <'set.h'`; then
  894.     echo shar: \"'set.h'\" unpacked with wrong size!
  895.   fi
  896.   # end of 'set.h'
  897. fi
  898. if test -f 'sys.h' -a "${1}" != "-c" ; then 
  899.   echo shar: Will not clobber existing file \"'sys.h'\"
  900. else
  901.   echo shar: Extracting \"'sys.h'\" \(7142 characters\)
  902.   sed "s/^X//" >'sys.h' <<'END_OF_FILE'
  903. X/* Sys.h
  904. X * See the README for details.
  905. X */
  906. X
  907. X/*  $RCSfile: sys.h,v $
  908. X *  $Revision: 14020.13 $
  909. X *  $Date: 93/06/21 06:42:11 $
  910. X */
  911. X
  912. X#ifdef __sun
  913. X#    ifndef sun
  914. X#        define sun 1
  915. X#    endif
  916. X#endif
  917. X
  918. X#ifdef sun
  919. X#    if !defined(__GNUC__) && !defined(__STDC__) && !defined(SunOverride)
  920. X    ^^^ "You need to use an ANSI C compiler.  Try using gcc or acc." ^^^
  921. X#    endif
  922. X#    define System "SunOS"
  923. X#    ifndef RINDEX
  924. X#        define RINDEX 1
  925. X#    endif
  926. X#    ifndef TERMIOS
  927. X#        define TERMIOS 1
  928. X#    endif
  929. X#    ifndef HAS_DOMAINNAME
  930. X#        define HAS_DOMAINNAME 1
  931. X#    endif
  932. X#endif /* sun */
  933. X
  934. X#ifdef __sgi
  935. X#    ifndef sgi
  936. X#        define sgi 1
  937. X#    endif
  938. X#endif
  939. X
  940. X#ifdef sgi
  941. X#    define System "IRIX"
  942. X#    ifndef SYSV
  943. X#        define SYSV 1
  944. X#    endif
  945. X#    ifndef HERROR
  946. X#        define HERROR 1
  947. X#    endif
  948. X#    ifndef U_WAIT
  949. X#        define U_WAIT 1
  950. X#    endif
  951. X#    ifndef STRICT_PROTOS
  952. X#        define STRICT_PROTOS 1
  953. X#    endif
  954. X#endif /* sgi */
  955. X
  956. X#ifdef _AIX
  957. X#    define System "AIX"
  958. X#    define SYSSELECTH 1
  959. X#endif    /* _AIX */
  960. X
  961. X#ifdef SCO324
  962. X#    define System "SCO Unix"
  963. X#    ifndef SYSV
  964. X#        define SYSV 1
  965. X#    endif
  966. X#    ifndef BROKEN_MEMCPY
  967. X#        define BROKEN_MEMCPY 1
  968. X#    endif
  969. X#endif    /* SCO */
  970. X
  971. X#ifdef aux
  972. X#    define System "A/UX"
  973. X#    ifndef BROKEN_MEMCPY
  974. X#        define BROKEN_MEMCPY 1
  975. X#    endif
  976. X#    ifndef SYSV
  977. X#        define SYSV 1
  978. X#    endif
  979. X#endif
  980. X
  981. X#ifdef NeXT
  982. X#    define System "NeXTStep"
  983. X#    ifndef RINDEX
  984. X#        define RINDEX 1
  985. X#    endif
  986. X#    ifndef BSD
  987. X#        define BSD 1
  988. X#    endif
  989. X#    ifndef NO_UNISTDH
  990. X#        define NO_UNISTDH 1
  991. X#    endif
  992. X#    ifndef NO_UTIMEH
  993. X#        define NO_UTIMEH
  994. X#    endif
  995. X#endif
  996. X
  997. X#ifdef pyr
  998. X#    define System "OSx"
  999. X#    ifndef BSD
  1000. X#        define BSD 1
  1001. X#    endif
  1002. X#    ifndef SGTTYB
  1003. X#        define SGTTYB 1
  1004. X#    endif
  1005. X#    ifndef NO_STDLIBH
  1006. X#        define NO_STDLIBH 1
  1007. X#    endif
  1008. X#    include <sys/types.h>
  1009. Xextern int errno;
  1010. X#endif    /* pyr */
  1011. X
  1012. X#ifdef DYNIX
  1013. X#    define System "Dynix"
  1014. X#    ifndef BSD
  1015. X#        define BSD 1
  1016. X#    endif
  1017. X#    ifndef SGTTYB
  1018. X#        define SGTTYB 1
  1019. X#    endif
  1020. X#    ifndef NO_STDLIBH
  1021. X#        define NO_STDLIBH 1
  1022. X#    endif
  1023. X#endif    /* DYNIX */
  1024. X
  1025. X#ifdef ultrix
  1026. X#    define System "Ultrix"
  1027. X#    ifndef BSD
  1028. X#        define BSD 1
  1029. X#    endif
  1030. X#    ifndef __GNUC__
  1031. X#        ifndef NO_CONST
  1032. X#            define NO_CONST 1
  1033. X#        endif
  1034. X#    endif
  1035. X#endif    /* ultrix */
  1036. X
  1037. X#ifdef __hpux
  1038. X#    ifndef HPUX
  1039. X#        define HPUX 1
  1040. X#    endif
  1041. X#    define Select(a,b,c,d,e) select((a), (int *)(b), (c), (d), (e))
  1042. X#endif
  1043. X
  1044. X#ifdef HPUX 
  1045. X#    define System "HP-UX"
  1046. X#    ifndef _HPUX_SOURCE
  1047. X#        define _HPUX_SOURCE 1
  1048. X#    endif
  1049. X#    ifndef GETCWDSIZET
  1050. X#        define GETCWDSIZET 1
  1051. X#    endif
  1052. X#    define SYSV 1
  1053. X#endif    /* HPUX */
  1054. X
  1055. X#ifdef SINIX
  1056. X#    define System "SINIX"
  1057. X#    ifndef SYSV
  1058. X#        define SYSV 1
  1059. X#    endif
  1060. X/* You may need to add -lresolv, -lport, -lcurses to MORELIBS in Makefile. */
  1061. X#endif
  1062. X
  1063. X#ifdef BULL          /* added 23nov92 for Bull DPX/2 */
  1064. X#    define _POSIX_SOURCE
  1065. X#    define _XOPEN_SOURCE
  1066. X#    define _BULL_SOURCE
  1067. X#    ifndef SYSV
  1068. X#        define SYSV 1
  1069. X#    endif
  1070. X#    define bull
  1071. X#    define System "Bull DPX/2 BOS"
  1072. X#    include <sys/types.h>
  1073. X#    define SYSSELECTH
  1074. X#endif  /* BULL */   /* added 23nov92 for Bull DPX/2 */
  1075. X
  1076. X#ifdef __dgux
  1077. X#     ifndef DGUX
  1078. X#             define DGUX 1
  1079. X#     endif
  1080. X#endif
  1081. X
  1082. X#ifdef DGUX
  1083. X#     ifndef _DGUX_SOURCE
  1084. X#             define _DGUX_SOURCE
  1085. X#     endif
  1086. X#     define GETCWDSIZET 1
  1087. X#     define BAD_INETADDR 1
  1088. X#     define SYSV 1
  1089. X#     define System "DG/UX"
  1090. X#endif  /* DGUX */
  1091. X
  1092. X#ifdef apollo
  1093. X#    ifndef BSD
  1094. X#        define BSD 43
  1095. X#    endif
  1096. X#    define SIG_PARAMS (int sig, ...)
  1097. X#    define NO_UTIMEH 1
  1098. X#    define System "Apollo"
  1099. X#endif
  1100. X
  1101. X/* -------------------------------------------------------------------- */
  1102. X
  1103. X#ifdef _SYSV
  1104. X#    ifndef SYSV
  1105. X#        define SYSV 1
  1106. X#    endif
  1107. X#endif
  1108. X
  1109. X#ifdef USG
  1110. X#    ifndef SYSV
  1111. X#        define SYSV 1
  1112. X#    endif
  1113. X#endif
  1114. X
  1115. X#ifdef _BSD
  1116. X#    ifndef BSD
  1117. X#        define BSD 1
  1118. X#    endif
  1119. X#endif
  1120. X
  1121. X#ifdef SYSV
  1122. X#    ifndef RINDEX
  1123. X#        define RINDEX 1
  1124. X#    endif
  1125. X#    define bcopy(s,d,l) memcpy((d),(s),(l))
  1126. X#ifdef __386BSD__
  1127. X#    define TERMIOS
  1128. X#    ifndef BSD
  1129. X#        define BSD
  1130. X#    endif
  1131. X#endif
  1132. X
  1133. X#    define bzero(cp,l) memset((cp),0,(l))
  1134. X#endif
  1135. X
  1136. X#ifdef BSD
  1137. X#    ifndef __386BSD__
  1138. X#        ifndef SYSDIRH
  1139. X#            define SYSDIRH 1
  1140. X#        endif
  1141. X#        ifndef SGTTYB
  1142. X#            define SGTTYB
  1143. X#        endif
  1144. X#    endif
  1145. X#    ifndef SGTTYB
  1146. X#        define SGTTYB
  1147. X#    endif
  1148. X#    ifndef RINDEX
  1149. X#        define RINDEX 1
  1150. X#    endif
  1151. X#endif
  1152. X
  1153. X/*
  1154. X * Some systems besides System V don't use rindex/index (like SunOS).
  1155. X * Add -DRINDEX to your SDEFS line if you need to.
  1156. X */
  1157. X#ifdef RINDEX
  1158. X    /* or #include <strings.h> if you have it. */
  1159. X#    define rindex strrchr
  1160. X#    define index strchr
  1161. X#endif /* RINDEX */
  1162. X
  1163. X#ifdef SOCKS
  1164. X#define Getsockname(d,a,l) Rgetsockname((d), (struct sockaddr *)(a), (l))
  1165. X#else
  1166. X#ifdef SYSV
  1167. X#    define Getsockname(d,a,l) getsockname((d), (void *)(a), (l))
  1168. X#else
  1169. X#    define Getsockname(d,a,l) getsockname((d), (struct sockaddr *)(a), (l))
  1170. X#endif
  1171. X#endif
  1172. X
  1173. X#ifndef Select
  1174. X#    define Select(a,b,c,d,e) select((a), (b), (c), (d), (e))
  1175. X#endif
  1176. X
  1177. X#ifdef GETPASS
  1178. X#    define Getpass getpass
  1179. X#endif
  1180. X
  1181. X/* Enable connections through firewall gateways */
  1182. X#ifndef GATEWAY
  1183. X#    define GATEWAY 1
  1184. X#endif
  1185. X
  1186. X#ifdef _POSIX_SOURCE
  1187. X#    define TERMIOS
  1188. X#endif
  1189. X
  1190. X#include <stdio.h>
  1191. X#ifndef NO_STDLIBH
  1192. X#    include <stdlib.h>
  1193. X#else
  1194. Xextern void *malloc(size_t);
  1195. Xextern void *calloc(size_t, size_t);
  1196. Xextern void *malloc(size_t);
  1197. Xextern void    free(void *);
  1198. Xextern void *realloc(void *, size_t);
  1199. Xextern void    exit(int);
  1200. X
  1201. X#ifdef NO_CONST
  1202. Xextern char *getenv(char *);
  1203. Xextern int atoi(char *);
  1204. X#else
  1205. Xextern char *getenv(const char *);
  1206. Xextern int atoi(const char *);
  1207. X#endif
  1208. X
  1209. X#endif    /* NO_STDLIBH */
  1210. X
  1211. X#ifdef NO_UNISTDH
  1212. Xchar *getlogin (void);
  1213. X#ifdef NO_CONST
  1214. Xextern char *getenv(char *);
  1215. X#else
  1216. Xextern char *getenv(const char *);
  1217. X#endif
  1218. X#endif    /* NO_UNISTDH */
  1219. X
  1220. X#ifdef NO_STD_PROTOS
  1221. X#include <sys/time.h>
  1222. X#include <sys/types.h>
  1223. X#include <sys/socket.h>
  1224. X#include <time.h>
  1225. Xextern    int     _filbuf(FILE *);
  1226. Xextern    int     _flsbuf(int, FILE *);
  1227. Xextern    int     fflush(FILE *);
  1228. Xextern    int     fprintf(FILE *, char *, ...);
  1229. Xextern    int     fputc(int, FILE *);
  1230. Xextern    int     fputs(char *, FILE *);
  1231. Xextern    int     fclose(FILE *);
  1232. Xextern    int     pclose(FILE *);
  1233. Xextern    void    perror(char *);
  1234. Xextern    int     printf(char *, ...);
  1235. Xextern    int     rewind(FILE *);
  1236. Xextern    int     sscanf(char *, char *, ...);
  1237. X
  1238. Xextern    char *  mktemp(char *);
  1239. Xextern    int     rename(char *, char *);
  1240. X
  1241. Xextern    int     gettimeofday(struct timeval *, struct timezone *);
  1242. Xextern    time_t  mktime(struct tm *);
  1243. Xextern    int     strftime(char *, int, char *, struct tm *);
  1244. Xextern    time_t  time(time_t *);
  1245. X
  1246. Xextern    int     tolower(int);
  1247. X
  1248. X#ifndef bcopy
  1249. Xextern    void    bcopy(char *, char *, size_t);
  1250. X#endif
  1251. X#ifndef bzero
  1252. Xextern    void    bzero(char *, size_t);
  1253. X#endif
  1254. X
  1255. X#ifdef SOCKS 
  1256. Xextern    int     Raccept(int, struct sockaddr *, int *);
  1257. Xextern    int     Rbind(int, struct sockaddr *, int, unsigned long);
  1258. Xextern    int     Rconnect(int, struct sockaddr *, int);
  1259. Xextern    int     Rlisten(int, int);
  1260. Xextern    int     Rgetsockname(int, struct sockaddr *, int *);
  1261. X#else
  1262. Xextern    int     accept(int, struct sockaddr *, int *);
  1263. Xextern    int     bind(int, struct sockaddr *, int);
  1264. Xextern    int     connect(int, struct sockaddr *, int);
  1265. Xextern    int     listen(int, int);
  1266. Xextern    int     getsockname(int, struct sockaddr *, int *);
  1267. X#endif
  1268. Xextern    int     gethostname(char *, int), getdomainname(char *, int);
  1269. Xextern    int     select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
  1270. Xextern    int     send(int, char *, int, int);
  1271. Xextern    int     setsockopt(int, int, int, char *, int);
  1272. Xextern    int     shutdown(int, int);
  1273. Xextern    int     socket(int, int, int);
  1274. X#endif    /* NO_STD_PROTOS */
  1275. X
  1276. X/* eof sys.h */
  1277. END_OF_FILE
  1278.   if test 7142 -ne `wc -c <'sys.h'`; then
  1279.     echo shar: \"'sys.h'\" unpacked with wrong size!
  1280.   fi
  1281.   # end of 'sys.h'
  1282. fi
  1283. if test -f 'tips.c' -a "${1}" != "-c" ; then 
  1284.   echo shar: Will not clobber existing file \"'tips.c'\"
  1285. else
  1286.   echo shar: Extracting \"'tips.c'\" \(5050 characters\)
  1287.   sed "s/^X//" >'tips.c' <<'END_OF_FILE'
  1288. X/* tips.c */
  1289. X
  1290. X/*  $RCSfile: tips.c,v $
  1291. X *  $Revision: 14020.11 $
  1292. X *  $Date: 93/05/21 05:44:39 $
  1293. X */
  1294. X
  1295. X#include "sys.h"
  1296. X
  1297. X#ifndef NO_TIPS
  1298. X
  1299. X#include "util.h"
  1300. X#ifndef NO_UNISTDH
  1301. X#   include <unistd.h>
  1302. X#endif
  1303. X
  1304. X/* Make sure that the indentations are spaces, not tabs.
  1305. X * Try newform -i-4 < tips.c > tips.c.new
  1306. X *
  1307. X * Always add new tips right above the last one.
  1308. X */
  1309. X
  1310. Xstatic char *tiplist[] = {
  1311. X    "Have you tried typing 'open' by itself lately?",
  1312. X
  1313. X    "If you don't want a .ncrecent file in your home directory, put the \n\
  1314. X     command '#unset recent-list' in your .netrc/.ncftprc file.",
  1315. X
  1316. X    "pseudo-filename-completion is supported in some commands.  To use it,\n\
  1317. X     use a wildcard expression that will match exactly one file.  I.e., if you\n\
  1318. X     want to fetch obnoxiouslylongfilename.zip, try 'get obn*.zip.'  Note that\n\
  1319. X     you can't use the cd command with this feature (yet).",
  1320. X
  1321. X    "You don't need to type the exact site name with open.  If a site is in\n\
  1322. X     your .netrc/.ncftprc or the recent-list (.ncrecent), just type a unique\n\
  1323. X     abbreviation (substring really).   I.e. 'open wuar' if you have the site\n\
  1324. X     wuarchive.wustl.edu in your rc or recent-list.",
  1325. X
  1326. X    "You can put set commands in your .netrc/.ncftprc, by adding lines such\n\
  1327. X     as '#set local-dir /usr/tmp' to the file, which will be run at startup.",
  1328. X
  1329. X    "Abuse the power of the .netrc!  Put in entries for your favorite sites.\n\
  1330. X     Sample .netrc (or .ncftprc):\n\
  1331. X     #set pager \"less -M\"\n\
  1332. X     \n\
  1333. X     machine wuarchive.wustl.edu\n\
  1334. X         macdef init\n\
  1335. X         cd /pub\n\
  1336. X         get README\n\
  1337. X         dir\n\
  1338. X         (blank line to end macro)",
  1339. X    
  1340. X    "If you want to keep your .netrc's for ftp and ncftp separate, name\n\
  1341. X     ncftp's rc to .ncftprc.",
  1342. X
  1343. X    "Type 'open' by itself to get a list of the sites in your recent-list and\n\
  1344. X     your .netrc.  You can then supply '#5' at the prompt, or use 'open #5'\n\
  1345. X     later.",
  1346. X
  1347. X    "Colon-mode is a quick way to get a file from your shell.  Try something\n\
  1348. X     like 'ncftp wuarchive.wustl.edu:/pub/README.'",
  1349. X
  1350. X    "The open command accepts several flags.  Do a 'help open' for details.",
  1351. X
  1352. X    "Sometimes a directory listing is several screens long and you won't\n\
  1353. X     remember the thing you wanted.  Use the 'predir' command to re-view the\n\
  1354. X     listing.  The program keeps the copy locally, so you won't have to wait\n\
  1355. X     for the remote server to re-send it to you.",
  1356. X
  1357. X    "Use the 'page' (or 'more') command to view a remote file with your pager.",
  1358. X
  1359. X    "ncftp may be keeping detailed information on everything you transfer.\n\
  1360. X     Run the 'version' command and if you see SYSLOG, your actions are being\n\
  1361. X     recorded on the system log.",
  1362. X
  1363. X    "Try the 'redir' command to re-display the last directory listing (ls,\n\
  1364. X     dir, ls -lrt, etc).  'predir' does the same, only with your pager.",
  1365. X
  1366. X    "This program is pronounced Nik-F-T-P.  NCEMRSoft is Nik'-mer-soft.",
  1367. X
  1368. X    "Never pick Nebraska to win a big game.",
  1369. X
  1370. X#ifdef GETLINE
  1371. X    "NcFTP was compiled with the Getline command-line/history editor! (by\n\
  1372. X     Chris Thewalt <thewalt@ce.berkeley.edu>).  To activate it, use the up\n\
  1373. X     and down arrows to scroll through the history, and/or use EMACS-style\n\
  1374. X     commands to edit the line.",
  1375. X#endif
  1376. X
  1377. X#ifdef READLINE
  1378. X    "NcFTP was compiled with the GNU Readline command-line/history editor!\n\
  1379. X     To activate it, use the up & down arrows to scroll through the history,\n\
  1380. X     and/or use EMACS-style (or maybe VI-style) commands to edit the line.",
  1381. X#endif
  1382. X
  1383. X    "You can get the newest version of NcFTP from cse.unl.edu, in the\n\
  1384. X     /pub/mgleason directory.",
  1385. X
  1386. X    "The type of progress-meter that will be used depends if the remote host\n\
  1387. X     supports the SIZE command, and whether your terminal is capable of ANSI\n\
  1388. X     escape codes.",
  1389. X
  1390. X    "To report a bug, mail your message to mgleason@cse.unl.edu.  Include the\n\
  1391. X     output of the 'version' command in your message.  An easy way to do that\n\
  1392. X     is to compose your message, then do a 'ncftp -H >> msg.'",
  1393. X
  1394. X    "Sick and tired of these tips?  Put '#unset tips' in your .netrc/.ncftprc."
  1395. X};
  1396. X
  1397. X/* Not another dinky header, por favor. */
  1398. X#define NTIPS ((int) (sizeof(tiplist) / sizeof(char *)))
  1399. Xvoid PrintTip(void);
  1400. Xextern int fromatty, debug;
  1401. X
  1402. Xint tips = 1;
  1403. X#endif  /* NO_TIPS */
  1404. X
  1405. Xvoid PrintTip(void)
  1406. X{
  1407. X#ifndef NO_TIPS
  1408. X    int cheap_rn, i, tn;
  1409. X    string str;
  1410. X
  1411. X    if (tips && fromatty) {
  1412. X        cheap_rn = (int) getpid() % NTIPS;
  1413. X        if (debug) {
  1414. X            (void) printf("pid: %d;  ntips: %d\n", getpid(), NTIPS);
  1415. X            (void) Gets("*** Tip# (-1 == all): ", str, sizeof(str));
  1416. X            tn = atoi(str) - 1;
  1417. X            if (tn == -1)
  1418. X                tn = 0;
  1419. X            if (tn < -1)
  1420. X                for(i=0; i<NTIPS; i++)
  1421. X                    (void) printf("Tip: %s\n", tiplist[i]);
  1422. X            else if (tn < NTIPS)
  1423. X                (void) printf("Tip: %s\n", tiplist[tn]);
  1424. X        } else
  1425. X            (void) printf("Tip: %s\n", tiplist[cheap_rn]);
  1426. X    }
  1427. X#endif  /* NO_TIPS */
  1428. X}   /* PrintTip */
  1429. X
  1430. X/* tips.c */
  1431. END_OF_FILE
  1432.   if test 5050 -ne `wc -c <'tips.c'`; then
  1433.     echo shar: \"'tips.c'\" unpacked with wrong size!
  1434.   fi
  1435.   # end of 'tips.c'
  1436. fi
  1437. if test -f 'util.h' -a "${1}" != "-c" ; then 
  1438.   echo shar: Will not clobber existing file \"'util.h'\"
  1439. else
  1440.   echo shar: Extracting \"'util.h'\" \(2072 characters\)
  1441.   sed "s/^X//" >'util.h' <<'END_OF_FILE'
  1442. X/* Util.h */
  1443. X
  1444. X#ifndef _util_h_
  1445. X#define _util_h_
  1446. X
  1447. X/*  $RCSfile: util.h,v $
  1448. X *  $Revision: 14020.12 $
  1449. X *  $Date: 93/07/09 11:32:49 $
  1450. X */
  1451. X
  1452. Xtypedef char string[128], str32[32], longstring[512];
  1453. Xtypedef char Hostname[64];
  1454. X
  1455. X/* For Perror. */
  1456. X#ifdef DB_ERRS
  1457. X#    ifdef __LINE__
  1458. X#        define PERROR(p,e) Perror(p, __LINE__, e)
  1459. X        void Perror(char *, int, char *);
  1460. X#    else
  1461. X#        define PERROR(p,e) Perror(p, e)
  1462. X        void Perror(char *, char *);
  1463. X#    endif
  1464. X#else
  1465. X#    define PERROR(p,e) Perror(e)
  1466. X    void Perror(char *);
  1467. X#endif
  1468. X
  1469. X#ifdef NO_VARARGS
  1470. X#    define dbprintf if (debug) (void) printf
  1471. X#else
  1472. X#    ifndef DB_STREAM
  1473. X#        define DB_STREAM stdout
  1474. X#    endif
  1475. X    void dbprintf(char *fmt, ...);
  1476. X#endif
  1477. X
  1478. X/* For 'Getopt.' */
  1479. X#define BADCH   ((int)'?')
  1480. X#define EMSG    ""
  1481. X
  1482. X/* Handy macros. */
  1483. X#define Strncpy(d,s) _Strncpy((char *) (d), (char *) (s), (size_t) sizeof(d))
  1484. X#define Strncat(d,s) _Strncat((char *) (d), (char *) (s), (size_t) sizeof(d))
  1485. X#define FGets(a,b) fgets((a), (int) (sizeof(a) - 2), (b))
  1486. X
  1487. X#ifndef NO_CONST
  1488. Xtypedef int (*cmp_t)(const void *, const void *);
  1489. X#else
  1490. Xtypedef int (*cmp_t)(void *, void *);
  1491. X#endif
  1492. X
  1493. X#define QSort(base,n,sz,cmp) \
  1494. X    qsort(base, (size_t)(n), (size_t)(sz), (cmp_t)(cmp))
  1495. X
  1496. X#ifndef SIG_PARAMS
  1497. X#define SIG_PARAMS (int sig)
  1498. X#endif
  1499. Xtypedef void (*sig_t) SIG_PARAMS;
  1500. X
  1501. X#define Signal(a,proc) signal((a), (sig_t)(proc))
  1502. X
  1503. X/* Protos. */
  1504. Xchar *_Strncat(char *dst, char *src, register size_t n);
  1505. Xchar *_Strncpy(char *dst, char *src, register size_t n);
  1506. Xchar *NewString(char *oldstr);
  1507. Xchar **re_makeargv(char *promptstr, int *argc);
  1508. Xchar *onoff(int);
  1509. Xint StrToBool(char *s);
  1510. Xint confirm(char *cmd, char *file);
  1511. Xvoid fatal(char *msg);
  1512. Xchar *get_cwd(char *buf, int size);
  1513. Xint tmp_name(char *str);
  1514. Xint Getopt(int argc, char **argv, char *opstring);
  1515. Xvoid Getopt_Reset(void);
  1516. Xchar *Gets(char *promptstr, char *sline, size_t size);
  1517. Xsize_t RemoveTrailingNewline(char *cp, int *stripped);
  1518. Xunsigned long UnLSDate(char *dstr);
  1519. Xchar *Strpcpy(char *dst, char *src);
  1520. Xint UserLoggedIn(void);
  1521. Xchar *LocalPath(char *path);
  1522. Xchar *LocalDotPath(char *path);
  1523. Xchar *GetHomeDir(char *home);
  1524. X
  1525. X#endif    /* _util_h_ */
  1526. END_OF_FILE
  1527.   if test 2072 -ne `wc -c <'util.h'`; then
  1528.     echo shar: \"'util.h'\" unpacked with wrong size!
  1529.   fi
  1530.   # end of 'util.h'
  1531. fi
  1532. if test -f 'v2_Note' -a "${1}" != "-c" ; then 
  1533.   echo shar: Will not clobber existing file \"'v2_Note'\"
  1534. else
  1535.   echo shar: Extracting \"'v2_Note'\" \(2712 characters\)
  1536.   sed "s/^X//" >'v2_Note' <<'END_OF_FILE'
  1537. XVersion 1.5 of NcFTP is an interim release.  Version 2.0 is much cooler,
  1538. Xbut it wasn't ready to go by my self-imposed deadline of September 1, 1993.
  1539. XThe reason for that deadline is that my senior year will be getting under
  1540. Xway, and I don't want to work on the program during that period.  Last year
  1541. XI spent too much time on NcFTP and other projects, and not enough time on
  1542. Xstudies.  As a result, my grades slipped a bit.  Therefore I will be
  1543. Xstudying more and programming, reading news, and reading email less.  If
  1544. Xyou send me email, I _will_ read it, but it may take me awhile to get to it,
  1545. Xand I may not answer.  Please don't be offended.  I really regret having
  1546. Xto release code that is such a mess.  I should have wrote the code from
  1547. Xscratch, rather than build it upon the original BSD code (which is a mess
  1548. Xitself!).
  1549. X
  1550. XThis version is based on the betas of 1.4.  1.4 was almost finished when
  1551. XI decided to add some significant features, and clean up the code so it
  1552. Xis better organized and easier to read.  That version is called 2.0, and
  1553. Xisn't finished yet.  The innards are totally different from that of 1.4
  1554. X(and 1.5), so patches to 1.5 won't work at all on 2.0.  During the process
  1555. Xof adding stuff and cleaning up, a couple of bugs creeped in that will
  1556. Xtake time to resolve.  Maybe I can work on it during Christmas break.
  1557. X
  1558. XI apologize in advance for bugs I fixed in 2.0 but forgot to re-fix
  1559. Xin 1.5 (I think I got'em all, though).
  1560. X
  1561. XHere is a list of things that are in the 2.0 code but not this version:
  1562. X
  1563. X* Easy-to-read, better organized, commented code.
  1564. X* Using my own "style guide," so source is coded uniformly.
  1565. X* Unlimited global macros.  These are really nice!  They take arguments,
  1566. X  so you can make mini-scripts.  The macros can be typed as if they
  1567. X  were commands; no more $macroname crap.
  1568. X* No-longer using .netrc and it's format.  This was necessary for the
  1569. X  global macros anyway, and it allowed me to add some other features,
  1570. X  like host aliases.  Old .netrc's won't work.  Sorry!
  1571. X* Improved command line parser, that lets any command use > and |, so
  1572. X  it behaves like a real shell command line (almost).
  1573. X* Improved 'redir' that works automatically, can reformat listings with
  1574. X  different ls flags, all without refetching it over the network.  It
  1575. X  will also facilitate remote globbing... AND remote filename completion!
  1576. X* Many little things I can't begin to list.
  1577. X
  1578. XKeep that in mind if you want to make a feature enhancement.  I'm telling
  1579. Xyou this now so you don't spend your time programming something that is
  1580. Xalready done for the 2.0 release.  Also note that patches for 1.5 will
  1581. Xhave to be re-coded for 2.0.  (The gist is that you should wait until
  1582. X2.0 is done before doing anything major).
  1583. END_OF_FILE
  1584.   if test 2712 -ne `wc -c <'v2_Note'`; then
  1585.     echo shar: \"'v2_Note'\" unpacked with wrong size!
  1586.   fi
  1587.   # end of 'v2_Note'
  1588. fi
  1589. echo shar: End of archive 5 \(of 5\).
  1590. cp /dev/null ark5isdone
  1591. MISSING=""
  1592. for I in 1 2 3 4 5 ; do
  1593.     if test ! -f ark${I}isdone ; then
  1594.     MISSING="${MISSING} ${I}"
  1595.     fi
  1596. done
  1597. if test "${MISSING}" = "" ; then
  1598.     echo You have unpacked all 5 archives.
  1599.     rm -f ark[1-9]isdone
  1600. else
  1601.     echo You still must unpack the following archives:
  1602.     echo "        " ${MISSING}
  1603. fi
  1604. exit 0
  1605. exit 0 # Just in case...
  1606.