home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume20 / xarchie / part19 < prev    next >
Encoding:
Text File  |  1993-06-14  |  50.5 KB  |  1,686 lines

  1. Newsgroups: comp.sources.x
  2. From: ferguson@cs.rochester.edu (George Ferguson)
  3. Subject: v20i047:  xarchie - An X browser interface to Archie, v2.0.6, Part19/24
  4. Message-ID: <1993Jun15.223507.1617@sparky.imd.sterling.com>
  5. X-Md4-Signature: 1701ae8245c6300ae6496830b1ca8f0c
  6. Sender: chris@sparky.imd.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Tue, 15 Jun 1993 22:35:07 GMT
  9. Approved: chris@sparky.imd.sterling.com
  10.  
  11. Submitted-by: ferguson@cs.rochester.edu (George Ferguson)
  12. Posting-number: Volume 20, Issue 47
  13. Archive-name: xarchie/part19
  14. Environment: X11
  15. Supersedes: xarchie: Volume 14, Issue 82-90
  16.  
  17. Submitted-by: ferguson@cs.rochester.edu
  18. Archive-name: xarchie-2.0.6/part19
  19.  
  20. #!/bin/sh
  21. # this is Part.19 (part 19 of xarchie-2.0.6)
  22. # do not concatenate these parts, unpack them in order with /bin/sh
  23. # file xarchie-2.0.6/Ad2c/Makefile continued
  24. #
  25. if test ! -r _shar_seq_.tmp; then
  26.     echo 'Please unpack part 1 first!'
  27.     exit 1
  28. fi
  29. (read Scheck
  30.  if test "$Scheck" != 19; then
  31.     echo Please unpack part "$Scheck" next!
  32.     exit 1
  33.  else
  34.     exit 0
  35.  fi
  36. ) < _shar_seq_.tmp || exit 1
  37. if test ! -f _shar_wnt_.tmp; then
  38.     echo 'x - still skipping xarchie-2.0.6/Ad2c/Makefile'
  39. else
  40. echo 'x - continuing file xarchie-2.0.6/Ad2c/Makefile'
  41. sed 's/^X//' << 'SHAR_EOF' >> 'xarchie-2.0.6/Ad2c/Makefile' &&
  42. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  43. XXFILESEARCHPATHDEFAULT = $(LIBDIR)/%L/%T/%N%S:$(LIBDIR)/%l/%T/%N%S:$(LIBDIR)/%T/%N%S
  44. X             ERRORDB = $(LIBDIR)/XtErrorDB
  45. X
  46. X        SOXLIBREV = 4.4
  47. X          SOXTREV = 4.1
  48. X         SOXAWREV = 4.0
  49. X        SOOLDXREV = 4.0
  50. X         SOXMUREV = 4.0
  51. X        SOXEXTREV = 4.0
  52. X
  53. X       FONTCFLAGS = -t
  54. X
  55. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  56. X
  57. X            IMAKE = imake
  58. X           DEPEND = makedepend
  59. X              RGB = rgb
  60. X            FONTC = bdftosnf
  61. X        MKFONTDIR = mkfontdir
  62. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh
  63. X
  64. X        CONFIGSRC = $(TOP)/config
  65. X        CLIENTSRC = $(TOP)/clients
  66. X          DEMOSRC = $(TOP)/demos
  67. X           LIBSRC = $(TOP)/lib
  68. X          FONTSRC = $(TOP)/fonts
  69. X       INCLUDESRC = $(TOP)/X11
  70. X        SERVERSRC = $(TOP)/server
  71. X          UTILSRC = $(TOP)/util
  72. X        SCRIPTSRC = $(UTILSRC)/scripts
  73. X       EXAMPLESRC = $(TOP)/examples
  74. X       CONTRIBSRC = $(TOP)/../contrib
  75. X           DOCSRC = $(TOP)/doc
  76. X           RGBSRC = $(TOP)/rgb
  77. X        DEPENDSRC = $(UTILSRC)/makedepend
  78. X         IMAKESRC = $(CONFIGSRC)
  79. X         XAUTHSRC = $(LIBSRC)/Xau
  80. X          XLIBSRC = $(LIBSRC)/X
  81. X           XMUSRC = $(LIBSRC)/Xmu
  82. X       TOOLKITSRC = $(LIBSRC)/Xt
  83. X       AWIDGETSRC = $(LIBSRC)/Xaw
  84. X       OLDXLIBSRC = $(LIBSRC)/oldX
  85. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  86. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  87. X     MKFONTDIRSRC = $(FONTSRC)/mkfontdir
  88. X     EXTENSIONSRC = $(TOP)/extensions
  89. X
  90. X  DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
  91. X     EXTENSIONLIB =  -L$(USRLIBDIR) -lXext
  92. X
  93. X          DEPXLIB = $(DEPEXTENSIONLIB)
  94. X             XLIB = $(EXTENSIONLIB) -L$(USRLIBDIR) -lX11
  95. X
  96. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  97. X         XAUTHLIB =  -L$(USRLIBDIR) -lXau
  98. X
  99. X        DEPXMULIB =
  100. X           XMULIB = -L$(USRLIBDIR) -lXmu
  101. X
  102. X       DEPOLDXLIB =
  103. X          OLDXLIB = -L$(USRLIBDIR) -loldX
  104. X
  105. X      DEPXTOOLLIB =
  106. X         XTOOLLIB = -L$(USRLIBDIR) -lXt
  107. X
  108. X        DEPXAWLIB =
  109. X           XAWLIB = -L$(USRLIBDIR) -lXaw
  110. X
  111. X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln
  112. X         LINTXLIB = $(USRLIBDIR)/llib-lX11.ln
  113. X          LINTXMU = $(USRLIBDIR)/llib-lXmu.ln
  114. X        LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln
  115. X          LINTXAW = $(USRLIBDIR)/llib-lXaw.ln
  116. X
  117. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  118. X
  119. X         DEPLIBS1 = $(DEPLIBS)
  120. X         DEPLIBS2 = $(DEPLIBS)
  121. X         DEPLIBS3 = $(DEPLIBS)
  122. X
  123. ###########################################################################
  124. # Imake rules for building libraries, programs, scripts, and data files
  125. # rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
  126. X
  127. ###########################################################################
  128. # start of Imakefile
  129. X
  130. #
  131. #    Imakefile for ad2c - Convert X resources to C decls
  132. #
  133. #    George Ferguson, ferguson@cs.rochester.edu, 19 Mar 1991.
  134. #
  135. X
  136. # Where do you want this (if the default isn't okay)?
  137. #BINDIR = bin
  138. #MANDIR = man/man1
  139. # Default suffix is "1", change if you change MANDIR I guess
  140. ##undef 1
  141. ##define 1 l
  142. X
  143. # Why is this not the default?
  144. INSTPGMFLAGS = -m 0755
  145. X
  146. all:: ad2c
  147. depend:
  148. X    @echo 'no need to depend for ad2c'
  149. ad2c:
  150. X    @echo 'ad2c is up to date'
  151. X
  152. install:: ad2c.script
  153. X    $(INSTALL) -c $(INSTPGMFLAGS) ad2c.script $(BINDIR)/ad2c
  154. X
  155. install.man:: ad2c.man
  156. X    $(INSTALL) -c $(INSTMANFLAGS) ad2c.man $(MANDIR)/ad2c.1
  157. X
  158. ###########################################################################
  159. # common rules for all Makefiles - do not edit
  160. X
  161. emptyrule::
  162. X
  163. clean::
  164. X    $(RM_CMD) \#*
  165. X
  166. Makefile::
  167. X    -@if [ -f Makefile ]; then \
  168. X    echo "    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
  169. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  170. X    else exit 0; fi
  171. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  172. X
  173. tags::
  174. X    $(TAGS) -w *.[ch]
  175. X    $(TAGS) -xw *.[ch] > TAGS
  176. X
  177. saber:
  178. X    #load $(ALLDEFINES) $(SRCS)
  179. X
  180. osaber:
  181. X    #load $(ALLDEFINES) $(OBJS)
  182. X
  183. ###########################################################################
  184. # empty rules for directories that do not have SUBDIRS - do not edit
  185. X
  186. install::
  187. X    @echo "install in $(CURRENT_DIR) done"
  188. X
  189. install.man::
  190. X    @echo "install.man in $(CURRENT_DIR) done"
  191. X
  192. Makefiles::
  193. X
  194. includes::
  195. X
  196. ###########################################################################
  197. # dependencies generated by makedepend
  198. X
  199. SHAR_EOF
  200. echo 'File xarchie-2.0.6/Ad2c/Makefile is complete' &&
  201. chmod 0644 xarchie-2.0.6/Ad2c/Makefile ||
  202. echo 'restore of xarchie-2.0.6/Ad2c/Makefile failed'
  203. Wc_c="`wc -c < 'xarchie-2.0.6/Ad2c/Makefile'`"
  204. test 8882 -eq "$Wc_c" ||
  205.     echo 'xarchie-2.0.6/Ad2c/Makefile: original size 8882, current size' "$Wc_c"
  206. rm -f _shar_wnt_.tmp
  207. fi
  208. # ============= xarchie-2.0.6/Ad2c/ad2c.man ==============
  209. if test -f 'xarchie-2.0.6/Ad2c/ad2c.man' -a X"$1" != X"-c"; then
  210.     echo 'x - skipping xarchie-2.0.6/Ad2c/ad2c.man (File already exists)'
  211.     rm -f _shar_wnt_.tmp
  212. else
  213. > _shar_wnt_.tmp
  214. echo 'x - extracting xarchie-2.0.6/Ad2c/ad2c.man (Text)'
  215. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/Ad2c/ad2c.man' &&
  216. .TH ad2c 1 "19 Apr 1993"
  217. .SH NAME
  218. ad2c \- convert resource files to C declarations
  219. .SH SYNOPSIS
  220. .I ad2c
  221. [ files ]
  222. .SH DESCRIPTION
  223. .LP
  224. .I Ad2c
  225. converts X resource files into C declarations, appropriate for
  226. inclusion as fallback resources.  The program is a
  227. .IR sed (1)
  228. script which is effectively a finite state machine, escaping quotes
  229. and backslashes (and newlines where necessary), and adding quotes and
  230. commas as needed for array initialization.
  231. .LP
  232. It reads from the given files (or stdin if none are given) and writes
  233. the C declarations to stdout.
  234. .SH USAGE
  235. The following example shows a typical use of
  236. .I ad2c
  237. to ensure that an application always has the latest version of its
  238. resources compiled into the executable.  Suppose the application
  239. defaults file is named "Foobar.ad", for application
  240. .IR foobar .
  241. Then the following lines in a Makefile or Imakefile will indicate
  242. how and when to run
  243. .IR ad2c :
  244. X
  245. .nf
  246. .na
  247. X    Foobar.ad.h: Foobar.ad
  248. X            ad2c Foobar.ad >Foobar.ad.h
  249. .ad
  250. .fi
  251. X
  252. The resulting C strings should be included (say in "foobar.c"):
  253. X
  254. .nf
  255. .na
  256. X    static char fallback_resources[] = {
  257. X        #include "Foobar.ad.h"
  258. X        NULL
  259. X    };
  260. .ad
  261. .fi
  262. X
  263. This array of strings can then be given as a parameter to
  264. .IR XtAppInitialize (3X)
  265. or otherwise used to initialize the application's resources.  Running
  266. .I makedepend
  267. or adding the line
  268. X
  269. .nf
  270. .na
  271. X    foobar.c: Foobar.ad.h
  272. .ad
  273. .fi
  274. X
  275. to the Makefile or Imakefile will ensure that "foobar.c" is
  276. recompiled when necessary (ie., whenever "Foobar.ad" changes).
  277. .SH "RETURN VALUE"
  278. .LP
  279. .I Ad2c
  280. returns as for
  281. .IR sed .
  282. .SH "SEE ALSO"
  283. sed(1)
  284. .SH DISCLAIMER
  285. .LP
  286. This software is provided as is with no warranty expressed or implied.
  287. I hope you find it useful, but I won't be held responsable for
  288. any damage that may occur from reading, compiling, installing or
  289. using it.
  290. .LP
  291. You are free to use any part of this code for other purposes. It
  292. would be nice if you could keep my name on some part of whatever the
  293. final product is.
  294. .SH AUTHOR
  295. .LP
  296. George Ferguson, ferguson@cs.rochester.edu.
  297. .LP
  298. Man page by Joseph Beckenbach, jerbil@ultra.com. Usage section added
  299. by George Ferguson. Example corrected by Tim Theisen, tim@cs.wisc.edu.
  300. Example further corrected by David Wojtowicz, davidw@vista.atmos.uiuc.edu.
  301. .LP
  302. Modified to work with Gnu and IBM sed by Charles Hannum,
  303. mycroft@gnu.ai.mit.edu.
  304. SHAR_EOF
  305. chmod 0644 xarchie-2.0.6/Ad2c/ad2c.man ||
  306. echo 'restore of xarchie-2.0.6/Ad2c/ad2c.man failed'
  307. Wc_c="`wc -c < 'xarchie-2.0.6/Ad2c/ad2c.man'`"
  308. test 2347 -eq "$Wc_c" ||
  309.     echo 'xarchie-2.0.6/Ad2c/ad2c.man: original size 2347, current size' "$Wc_c"
  310. rm -f _shar_wnt_.tmp
  311. fi
  312. # ============= xarchie-2.0.6/Ad2c/ad2c.script ==============
  313. if test -f 'xarchie-2.0.6/Ad2c/ad2c.script' -a X"$1" != X"-c"; then
  314.     echo 'x - skipping xarchie-2.0.6/Ad2c/ad2c.script (File already exists)'
  315.     rm -f _shar_wnt_.tmp
  316. else
  317. > _shar_wnt_.tmp
  318. echo 'x - extracting xarchie-2.0.6/Ad2c/ad2c.script (Text)'
  319. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/Ad2c/ad2c.script' &&
  320. #!/bin/sh
  321. #
  322. #    ad2c : Convert app-defaults file to C strings decls.
  323. #
  324. #    George Ferguson, ferguson@cs.rcohester.edu, 12 Nov 1990.
  325. #    19 Mar 1991: gf
  326. #        Made it self-contained.
  327. #    6 Jan 1992: mycroft@gnu.ai.mit.edu (Charles Hannum)
  328. #        Removed use of "-n" and ":read" label since Gnu and
  329. #        IBM sed print pattern space on "n" command. Still works
  330. #        with Sun sed, of course.
  331. #    7 Jan 1992: matthew@sunpix.East.Sun.COM (Matthew Stier)
  332. #        Escape quotes after escaping backslashes.
  333. #    8 Jul 1992: Version 1.6
  334. #        Manpage fixes.
  335. #    19 Apr 1993: Version 1.7
  336. #        Remove comments that were inside the sed command since
  337. #        some versions of sed don't like them. The comments are
  338. #        now given here in the header.
  339. #
  340. # Comments on the script by line:
  341. # /^!/d        Remove comments
  342. # /^$/d        Remove blanks
  343. # s/\\/\\\\/g    Escape backslashes...
  344. # s/\\$//g    ...except the line continuation ones
  345. # s/"/\\"/g    Escape quotes
  346. # s/^/"/    Add leading quote
  347. # : test    Establish label for later branch
  348. # /\\$/b slash    Branch to label "slash" if line ends in backslash
  349. # s/$/",/    Otherwise add closing quote and comma...
  350. # p        ...output the line...
  351. # d        ...and clear the pattern space so it's not printed again
  352. # : slash    Branch comes here if line ends in backslash
  353. # n        Read next line, append to pattern space
  354. # [...]        The "d" and "s" commands that follow just delete
  355. #        comments and blank lines and escape control sequences
  356. # b test    Branch up to see if the line ends in backslash or not
  357. #
  358. X
  359. sed '
  360. /^!/d
  361. /^$/d
  362. s/\\/\\\\/g
  363. s/\\$//g
  364. s/"/\\"/g
  365. s/^/"/
  366. : test
  367. /\\$/b slash
  368. s/$/",/
  369. p
  370. d
  371. : slash
  372. n
  373. /^!/d
  374. /^$/d
  375. s/"/\\"/g
  376. s/\\\\/\\/g
  377. s/\\n/\\\\n/g
  378. s/\\t/\\\\t/g
  379. s/\\f/\\\\f/g
  380. s/\\b/\\\\b/g
  381. b test' "$@"
  382. SHAR_EOF
  383. chmod 0755 xarchie-2.0.6/Ad2c/ad2c.script ||
  384. echo 'restore of xarchie-2.0.6/Ad2c/ad2c.script failed'
  385. Wc_c="`wc -c < 'xarchie-2.0.6/Ad2c/ad2c.script'`"
  386. test 1641 -eq "$Wc_c" ||
  387.     echo 'xarchie-2.0.6/Ad2c/ad2c.script: original size 1641, current size' "$Wc_c"
  388. rm -f _shar_wnt_.tmp
  389. fi
  390. # ============= xarchie-2.0.6/FWF/README ==============
  391. if test ! -d 'xarchie-2.0.6/FWF'; then
  392.     echo 'x - creating directory xarchie-2.0.6/FWF'
  393.     mkdir 'xarchie-2.0.6/FWF'
  394. fi
  395. if test -f 'xarchie-2.0.6/FWF/README' -a X"$1" != X"-c"; then
  396.     echo 'x - skipping xarchie-2.0.6/FWF/README (File already exists)'
  397.     rm -f _shar_wnt_.tmp
  398. else
  399. > _shar_wnt_.tmp
  400. echo 'x - extracting xarchie-2.0.6/FWF/README (Text)'
  401. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/README' &&
  402. =================================== README ===================================
  403. X
  404. X    *****************************************************************
  405. X    *                                                               *
  406. X    *           The Free Widget Foundation Widget Release           *
  407. X    *                          Version 3.0                          *
  408. X    *                                                               *
  409. X    *                         May 19,  1992                         *
  410. X    *                                                               *
  411. X    *****************************************************************
  412. X
  413. X    This is the Free Widget Foundation widget release.  In case you
  414. X    only have this Makefile, the current set of widgets can be obtained
  415. X    via anonymous ftp from the machine a.cs.uiuc.edu (128.174.252.1)
  416. X    in the file pub/fwf.shar.Z.
  417. X
  418. X    The release is also available via anonymous ftp from the site
  419. X    ftp.informatik.tu-muenchen.de, and via email, by sending the
  420. X    command 'GET /pub/X11/contrib/lib/fwf/fwf-2.14.tar.Z'
  421. X    to the account: FTP-Mailer@ftp.informatik.tu-muenchen.de.
  422. X
  423. X    The Free Widget Foundation project was started summer 1990 in order
  424. X    to collect existing widgets in a well-publicized location to prevent
  425. X    duplication of effort.  Numerous people have expressed interest
  426. X    in submitting widgets to the collection.  The collection process is
  427. X    going slowly because of lack of time and organizational needs.  The
  428. X    "Free Widget Foundation" is a pun on the "Free Software Foundation"
  429. X    title.  While the two organizations share some similar goals, that is
  430. X    the improvement of the quality and quantity of public software, this
  431. X    organization is in no way related to the Free Software Foundation or
  432. X    the GNU projects.  In fact, we aren't even a "foundation" in the
  433. X    legal meaning of the word.  We are solely a group of volunteers
  434. X    attempting to build up a working set of usable widgets in an efficient
  435. X    manner.
  436. X
  437. X    The widgets contained in this distribution are only a small subset
  438. X    of widgets which have been offered.  Integration of the donated
  439. X    widgets will begin when the compilation infrastructure has been
  440. X    decided.
  441. X
  442. X    The following files may be of interest in describing other parts of
  443. X    the system:
  444. X
  445. X    README            This file
  446. X    README.FWF        Information about the Free Widget Foundation
  447. X    README.BUILD        How to build the free widgets
  448. X    README.INDEX        Index of widgets contained in this release
  449. X    README.IMAKE        Details about the imake structure
  450. X    README.NOTES        Assorted notes about the state of the release
  451. X    README.TODO        Bugs, inadequacies, planned changes, requests
  452. X    README.SUBMISSION    How to submit your widgets to the FWF
  453. X    VERSION            Current FWF release version
  454. X
  455. SHAR_EOF
  456. chmod 0644 xarchie-2.0.6/FWF/README ||
  457. echo 'restore of xarchie-2.0.6/FWF/README failed'
  458. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/README'`"
  459. test 2662 -eq "$Wc_c" ||
  460.     echo 'xarchie-2.0.6/FWF/README: original size 2662, current size' "$Wc_c"
  461. rm -f _shar_wnt_.tmp
  462. fi
  463. # ============= xarchie-2.0.6/FWF/README.FWF ==============
  464. if test -f 'xarchie-2.0.6/FWF/README.FWF' -a X"$1" != X"-c"; then
  465.     echo 'x - skipping xarchie-2.0.6/FWF/README.FWF (File already exists)'
  466.     rm -f _shar_wnt_.tmp
  467. else
  468. > _shar_wnt_.tmp
  469. echo 'x - extracting xarchie-2.0.6/FWF/README.FWF (Text)'
  470. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/README.FWF' &&
  471. ================================= README.FWF =================================
  472. X
  473. X    The Free Widget Foundation project was started summer 1990 in order
  474. X    to collect existing widgets in a well-publicized location to prevent
  475. X    duplication of effort.  Numerous people have expressed interest
  476. X    in submitting widgets to the collection.  The collection process is
  477. X    going slowly because of lack of time and organizational needs.  The
  478. X    "Free Widget Foundation" is a pun on the "Free Software Foundation"
  479. X    title.  While the two organizations share some similar goals, that is
  480. X    the improvement of the quality and quantity of public software, this
  481. X    organization is in no way related to the Free Software Foundation or
  482. X    the GNU projects.  In fact, we aren't even a "foundation" in the
  483. X    legal meaning of the word.  We are solely a group of volunteers
  484. X    attempting to build up a working set of usable widgets in an efficient
  485. X    manner.
  486. X
  487. X    There is a mailing list set up to discuss the development of the
  488. X    free widgets set.  To be added to the mailing list, send mail to
  489. X    free-widgets-request@kazoo.cs.uiuc.edu.
  490. SHAR_EOF
  491. chmod 0644 xarchie-2.0.6/FWF/README.FWF ||
  492. echo 'restore of xarchie-2.0.6/FWF/README.FWF failed'
  493. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/README.FWF'`"
  494. test 1088 -eq "$Wc_c" ||
  495.     echo 'xarchie-2.0.6/FWF/README.FWF: original size 1088, current size' "$Wc_c"
  496. rm -f _shar_wnt_.tmp
  497. fi
  498. # ============= xarchie-2.0.6/FWF/COPYRIGHT ==============
  499. if test -f 'xarchie-2.0.6/FWF/COPYRIGHT' -a X"$1" != X"-c"; then
  500.     echo 'x - skipping xarchie-2.0.6/FWF/COPYRIGHT (File already exists)'
  501.     rm -f _shar_wnt_.tmp
  502. else
  503. > _shar_wnt_.tmp
  504. echo 'x - extracting xarchie-2.0.6/FWF/COPYRIGHT (Text)'
  505. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/COPYRIGHT' &&
  506. /*
  507. X * Copyright 1990,1991,1992 Brian Totty
  508. X * 
  509. X * Permission to use, copy, modify, distribute, and sell this software
  510. X * and its documentation for any purpose is hereby granted without fee,
  511. X * provided that the above copyright notice appears in all copies and that
  512. X * both that copyright notice and this permission notice appear in
  513. X * supporting documentation, and that the name of Brian Totty or
  514. X * University of Illinois not be used in advertising or publicity
  515. X * pertaining to distribution of the software without specific, written
  516. X * prior permission.  Brian Totty and University of Illinois make no
  517. X * representations about the suitability of this software for any
  518. X * purpose.  It is provided "as is" without express or implied warranty.
  519. X *
  520. X * Brian Totty and University of Illinois disclaim all warranties with
  521. X * regard to this software, including all implied warranties of
  522. X * merchantability and fitness, in no event shall Brian Totty or
  523. X * University of Illinois be liable for any special, indirect or
  524. X * consequential damages or any damages whatsoever resulting from loss of
  525. X * use, data or profits, whether in an action of contract, negligence or
  526. X * other tortious action, arising out of or in connection with the use or
  527. X * performance of this software.
  528. X *
  529. X * Author:
  530. X *     Brian Totty
  531. X *     Department of Computer Science
  532. X *     University Of Illinois at Urbana-Champaign
  533. X *    1304 West Springfield Avenue
  534. X *     Urbana, IL 61801
  535. X * 
  536. X *     totty@cs.uiuc.edu
  537. X *     
  538. X */ 
  539. SHAR_EOF
  540. chmod 0644 xarchie-2.0.6/FWF/COPYRIGHT ||
  541. echo 'restore of xarchie-2.0.6/FWF/COPYRIGHT failed'
  542. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/COPYRIGHT'`"
  543. test 1466 -eq "$Wc_c" ||
  544.     echo 'xarchie-2.0.6/FWF/COPYRIGHT: original size 1466, current size' "$Wc_c"
  545. rm -f _shar_wnt_.tmp
  546. fi
  547. # ============= xarchie-2.0.6/FWF/Dir/DirMgr.c ==============
  548. if test ! -d 'xarchie-2.0.6/FWF/Dir'; then
  549.     echo 'x - creating directory xarchie-2.0.6/FWF/Dir'
  550.     mkdir 'xarchie-2.0.6/FWF/Dir'
  551. fi
  552. if test -f 'xarchie-2.0.6/FWF/Dir/DirMgr.c' -a X"$1" != X"-c"; then
  553.     echo 'x - skipping xarchie-2.0.6/FWF/Dir/DirMgr.c (File already exists)'
  554.     rm -f _shar_wnt_.tmp
  555. else
  556. > _shar_wnt_.tmp
  557. echo 'x - extracting xarchie-2.0.6/FWF/Dir/DirMgr.c (Text)'
  558. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/Dir/DirMgr.c' &&
  559. /****************************************************************************
  560. X
  561. X    DirMgr.c
  562. X
  563. X    This file contains the C code to implement the DirectoryMgr system.
  564. X
  565. X    This system is intended to manage filtered and sorted directory
  566. X    lists.
  567. X
  568. X ****************************************************************************/
  569. /*
  570. X * Copyright 1990,1991,1992 Brian Totty
  571. X * 
  572. X * Permission to use, copy, modify, distribute, and sell this software
  573. X * and its documentation for any purpose is hereby granted without fee,
  574. X * provided that the above copyright notice appears in all copies and that
  575. X * both that copyright notice and this permission notice appear in
  576. X * supporting documentation, and that the name of Brian Totty or
  577. X * University of Illinois not be used in advertising or publicity
  578. X * pertaining to distribution of the software without specific, written
  579. X * prior permission.  Brian Totty and University of Illinois make no
  580. X * representations about the suitability of this software for any
  581. X * purpose.  It is provided "as is" without express or implied warranty.
  582. X *
  583. X * Brian Totty and University of Illinois disclaim all warranties with
  584. X * regard to this software, including all implied warranties of
  585. X * merchantability and fitness, in no event shall Brian Totty or
  586. X * University of Illinois be liable for any special, indirect or
  587. X * consequential damages or any damages whatsoever resulting from loss of
  588. X * use, data or profits, whether in an action of contract, negligence or
  589. X * other tortious action, arising out of or in connection with the use or
  590. X * performance of this software.
  591. X *
  592. X * Author:
  593. X *     Brian Totty
  594. X *     Department of Computer Science
  595. X *     University Of Illinois at Urbana-Champaign
  596. X *    1304 West Springfield Avenue
  597. X *     Urbana, IL 61801
  598. X * 
  599. X *     totty@cs.uiuc.edu
  600. X *     
  601. X */ 
  602. X
  603. #include <DirMgr.h>
  604. X
  605. #ifndef NO_REGEXP
  606. #include <RegExp.h>
  607. #endif
  608. X
  609. #define    DIR_MGR_FSM_SIZE 1024
  610. X
  611. /*---------------------------------------------------------------------------*
  612. X
  613. X                   S I M P L E    I N T E R F A C E
  614. X
  615. X *---------------------------------------------------------------------------*/
  616. X
  617. DirectoryMgr *DirectoryMgrSimpleOpen(path,sort_type,pattern)
  618. char *path;
  619. int sort_type;
  620. char *pattern;
  621. {
  622. X    DirectoryMgr *dm;
  623. X    PFI f_func,s_func;
  624. X    char *f_data;
  625. X
  626. X    if (pattern == NULL) pattern = "*";
  627. X    if (!DirectoryMgrSimpleFilterFunc(pattern,&f_func,&f_data))
  628. X    {
  629. X        return(NULL);
  630. X    }
  631. X    if (!DirectoryMgrSimpleSortingFunc(sort_type,&s_func))
  632. X    {
  633. X        free(f_data);
  634. X        return(NULL);
  635. X    }
  636. X    dm = DirectoryMgrOpen(path,s_func,f_func,f_data,TRUE);
  637. X    return(dm);
  638. } /* End DirectoryMgrSimpleOpen */
  639. X
  640. X
  641. int DirectoryMgrSimpleRefilter(dm,pattern)
  642. DirectoryMgr *dm;
  643. char *pattern;
  644. {
  645. X    PFI f_func;
  646. X    char *f_data;
  647. X
  648. X    if (!DirectoryMgrSimpleFilterFunc(pattern,&f_func,&f_data))
  649. X    {
  650. X        return(FALSE);
  651. X    }
  652. X    DirectoryMgrRefilter(dm,f_func,f_data,TRUE);
  653. X    return(TRUE);
  654. } /* End DirectoryMgrSimpleRefilter */
  655. X
  656. X
  657. int DirectoryMgrSimpleResort(dm,sort_type)
  658. DirectoryMgr *dm;
  659. int sort_type;
  660. {
  661. X    PFI c_func;
  662. X
  663. X    if (!DirectoryMgrSimpleSortingFunc(sort_type,&c_func))
  664. X    {
  665. X        return(FALSE);
  666. X    }
  667. X    DirectoryMgrResort(dm,c_func);
  668. X    return(TRUE);
  669. } /* End DirectoryMgrSimpleResort */
  670. X
  671. X
  672. /*---------------------------------------------------------------------------*
  673. X
  674. X                    N O R M A L    I N T E R F A C E
  675. X
  676. X *---------------------------------------------------------------------------*/
  677. X
  678. DirectoryMgr *DirectoryMgrOpen(path,c_func,f_func,f_data,free_data)
  679. char *path;
  680. PFI c_func,f_func;
  681. char *f_data;
  682. int free_data;
  683. {
  684. X    DirectoryMgr *dm;
  685. X
  686. X    dm = (DirectoryMgr *)calloc(1,sizeof(DirectoryMgr));
  687. X    if (dm == NULL)
  688. X    {
  689. X        if (free_data && f_data) free(f_data);
  690. X        return(NULL);
  691. X    }
  692. X    if (DirectoryOpen(path,DirectoryMgrDir(dm)) == FALSE)
  693. X    {
  694. X        free((char *)dm);
  695. X        if (free_data && f_data) free((char *)f_data);
  696. X        return(NULL);
  697. X    }
  698. X    DirectoryMgrCompFunc(dm) = c_func;
  699. X    DirectoryMgrRefilter(dm,f_func,f_data,free_data);
  700. X    return(dm);
  701. } /* End DirectoryMgrOpen */
  702. X
  703. X
  704. void DirectoryMgrClose(dm)
  705. DirectoryMgr *dm;
  706. {
  707. X    free((char *)DirectoryMgrData(dm));
  708. X    free((char *)DirectoryMgrSortedPtrs(dm));
  709. X    if (DirectoryMgrFilterData(dm) && DirectoryMgrFreeFilterData(dm))
  710. X    {
  711. X        free((char *)DirectoryMgrFilterData(dm));
  712. X    }
  713. X    DirectoryClose(DirectoryMgrDir(dm));
  714. X    free((char *)dm);
  715. } /* End DirectoryMgrClose */
  716. X
  717. X
  718. int DirectoryMgrRefilter(dm,f_func,f_data,f_free)
  719. DirectoryMgr *dm;
  720. PFI f_func;
  721. char *f_data;
  722. int f_free;
  723. {
  724. X    if (DirectoryMgrFilterData(dm) && DirectoryMgrFreeFilterData(dm))
  725. X    {
  726. X        free(DirectoryMgrFilterData(dm));
  727. X    }
  728. X    DirectoryMgrFilterFunc(dm) = f_func;
  729. X    DirectoryMgrFilterData(dm) = f_data;
  730. X    DirectoryMgrFreeFilterData(dm) = f_free;
  731. X    DirectoryMgrRefresh(dm);
  732. X    return(0);    /* gf: what should this be?? */
  733. } /* End DirectoryMgrRefilter */
  734. X
  735. X
  736. int DirectoryMgrRefresh(dm)
  737. DirectoryMgr *dm;
  738. {
  739. X    int err,data_size,ptrs_size,i;
  740. X    DirEntryCons *head,*tail,*cons;
  741. X    DirEntry *dm_data,**dm_ptrs;
  742. X    PFI f_func;
  743. X    char *f_data;
  744. X
  745. X    DirectoryMgrTotalCount(dm) = 0;
  746. X    DirectoryMgrFilteredCount(dm) = 0;
  747. X    DirectoryRestart(DirectoryMgrDir(dm));
  748. X    if (DirectoryMgrData(dm))
  749. X        free((char *)DirectoryMgrData(dm));
  750. X    if (DirectoryMgrSortedPtrs(dm))
  751. X        free((char *)DirectoryMgrSortedPtrs(dm));
  752. X    head = NULL;
  753. X    f_func = DirectoryMgrFilterFunc(dm);
  754. X    f_data = DirectoryMgrFilterData(dm);
  755. X    while (1)
  756. X    {
  757. X        cons = (DirEntryCons *)malloc(sizeof(DirEntryCons));
  758. X        if (cons == NULL)
  759. X        {
  760. X            fprintf(stderr,
  761. X                "DirectoryMgrRefresh: Can't Alloc Cons\n");
  762. X            exit(-1);
  763. X        }
  764. X        err = DirectoryReadNextEntry(DirectoryMgrDir(dm),
  765. X                         &(cons->dir_entry));
  766. X        if (err == FALSE)
  767. X        {
  768. X            free((char *)cons);
  769. X            break;
  770. X        }
  771. X        ++ DirectoryMgrTotalCount(dm);
  772. X        if ((f_func == NULL) ||
  773. X            (f_func && f_func(&(cons->dir_entry),f_data)))
  774. X        {
  775. X            cons->next = NULL;
  776. X            if (head == NULL)
  777. X                head = cons;
  778. X                else
  779. X                tail->next = cons;
  780. X            tail = cons;
  781. X            ++ DirectoryMgrFilteredCount(dm);
  782. X        }
  783. X            else            /* Filter Failed */
  784. X        {
  785. X            free((char *)cons);
  786. X        }
  787. X    }
  788. X
  789. X    data_size = sizeof(DirEntry) * DirectoryMgrFilteredCount(dm);
  790. X    ptrs_size = sizeof(DirEntry *) * DirectoryMgrFilteredCount(dm);
  791. X    dm_data = (DirEntry *)malloc(data_size);
  792. X    dm_ptrs = (DirEntry **)malloc(ptrs_size);
  793. X    if ((dm_data == NULL) || (dm_ptrs == NULL))
  794. X    {
  795. X        fprintf(stderr,"DirectoryMgrRefresh: Out of memory\n");
  796. X        exit(1);
  797. X    }
  798. X    DirectoryMgrData(dm) = dm_data;
  799. X    DirectoryMgrSortedPtrs(dm) = dm_ptrs;
  800. X
  801. X    for (i = 0; i < DirectoryMgrFilteredCount(dm); i++)
  802. X    {
  803. X        DirectoryMgrData(dm)[i] = head->dir_entry;
  804. X        DirectoryMgrSortedPtrs(dm)[i] = &(DirectoryMgrData(dm)[i]);
  805. X        cons = head->next;
  806. X        free((char *)head);
  807. X        head = cons;
  808. X    }
  809. X
  810. X    DirectoryMgrResort(dm,DirectoryMgrCompFunc(dm));
  811. X    DirectoryMgrRestart(dm);
  812. X    return(TRUE);
  813. } /* End DirectoryMgrRefresh */
  814. X
  815. X
  816. void DirectoryMgrResort(dm,c_func)
  817. DirectoryMgr *dm;
  818. PFI c_func;
  819. {
  820. X    DirectoryMgrCompFunc(dm) = c_func;
  821. X    if (c_func != NULL)
  822. X    {
  823. X        qsort(DirectoryMgrSortedPtrs(dm),DirectoryMgrFilteredCount(dm),
  824. X              sizeof(DirEntry *),DirectoryMgrCompFunc(dm));
  825. X    }
  826. X    DirectoryMgrRestart(dm);
  827. } /* End DirectoryMgrResort */
  828. X
  829. /*---------------------------------------------------------------------------*
  830. X
  831. X                  I T E R A T I O N    C O M M A N D S
  832. X
  833. X *---------------------------------------------------------------------------*/
  834. X
  835. int DirectoryMgrGotoItem(dm,i)
  836. DirectoryMgr *dm;
  837. int i;
  838. {
  839. X    if (i < 0 || i >= DirectoryMgrFilteredCount(dm)) return(FALSE);
  840. X    DirectoryMgrCurrentIndex(dm) = i;
  841. X    return(TRUE);
  842. } /* End DirectoryMgrGotoItem */
  843. X
  844. X
  845. int DirectoryMgrGotoNamedItem(dm,name)
  846. DirectoryMgr *dm;
  847. char *name;
  848. {
  849. X    int i;
  850. X    DirEntry *entry;
  851. X
  852. X    for (i = 0; i < DirectoryMgrFilteredCount(dm); i++)
  853. X    {
  854. X        entry = DirectoryMgrSortedPtrs(dm)[i];
  855. X        if (strcmp(DirEntryFileName(entry),name) == 0)
  856. X        {
  857. X            DirectoryMgrCurrentIndex(dm) = i;
  858. X            return(TRUE);
  859. X        }
  860. X    }
  861. X    return(FALSE);
  862. } /* End DirectoryMgrGotoNamedItem */
  863. X
  864. X
  865. void DirectoryMgrRestart(dm)
  866. DirectoryMgr *dm;
  867. {
  868. X    DirectoryMgrCurrentIndex(dm) = 0;
  869. } /* End DirectoryMgrRestart */
  870. X
  871. X
  872. DirEntry *DirectoryMgrCurrentEntry(dm)
  873. DirectoryMgr *dm;
  874. {
  875. X    int index;
  876. X
  877. X    index = DirectoryMgrCurrentIndex(dm);
  878. X    if (index < 0 || index >= DirectoryMgrFilteredCount(dm)) return(NULL);
  879. X    return(DirectoryMgrSortedPtrs(dm)[index]);
  880. } /* End DirectoryMgrCurrentEntry */
  881. X
  882. X
  883. DirEntry *DirectoryMgrNextEntry(dm)
  884. DirectoryMgr *dm;
  885. {
  886. X    int index;
  887. X
  888. X    index = DirectoryMgrCurrentIndex(dm);
  889. X    if (index >= DirectoryMgrFilteredCount(dm)) return(NULL);
  890. X    ++ DirectoryMgrCurrentIndex(dm);
  891. X    return(DirectoryMgrSortedPtrs(dm)[index]);
  892. } /* End DirectoryMgrNextEntry */
  893. X
  894. X
  895. DirEntry *DirectoryMgrPrevEntry(dm)
  896. DirectoryMgr *dm;
  897. {
  898. X    int index;
  899. X
  900. X    index = DirectoryMgrCurrentIndex(dm) - 1;
  901. X    if (index < 0) return(NULL);
  902. X    -- DirectoryMgrCurrentIndex(dm);
  903. X    return(DirectoryMgrSortedPtrs(dm)[index]);
  904. } /* End DirectoryMgrPrevEntry */
  905. X
  906. /*---------------------------------------------------------------------------*
  907. X
  908. X                   U T I L I T Y    F U N C T I O N S
  909. X
  910. X *---------------------------------------------------------------------------*/
  911. X
  912. int DirectoryMgrSimpleFilterFunc(pattern,ff_ptr,fd_ptr)
  913. char *pattern;
  914. PFI *ff_ptr;
  915. char **fd_ptr;
  916. {
  917. #ifndef    NO_REGEXP
  918. X    char regexp[2048];
  919. X
  920. X    *ff_ptr = DirectoryMgrFilterName;
  921. X    *fd_ptr = (char *)malloc(sizeof(char) * DIR_MGR_FSM_SIZE);
  922. X    if (*fd_ptr == NULL) return(FALSE);
  923. X    RegExpPatternToRegExp(pattern,regexp);
  924. X    RegExpCompile(regexp,*fd_ptr,DIR_MGR_FSM_SIZE);
  925. #endif
  926. X    return(TRUE);
  927. } /* End DirectoryMgrSimpleFilterFunc */
  928. X
  929. X
  930. int DirectoryMgrSimpleSortingFunc(sort_type,sf_ptr)
  931. int sort_type;
  932. PFI *sf_ptr;
  933. {
  934. X    *sf_ptr = NULL;
  935. X    switch (sort_type)
  936. X    {
  937. X        case DIR_MGR_SORT_NONE:
  938. X        break;
  939. X        case DIR_MGR_SORT_NAME:
  940. X        *sf_ptr = DirectoryMgrCompareName;
  941. X        break;
  942. X        case DIR_MGR_SORT_SIZE_ASCENDING:
  943. X        *sf_ptr = DirectoryMgrCompareSizeAscending;
  944. X        break;
  945. X        case DIR_MGR_SORT_SIZE_DESCENDING:
  946. X        *sf_ptr = DirectoryMgrCompareSizeDescending;
  947. X        break;
  948. X        case DIR_MGR_SORT_NAME_DIRS_FIRST:
  949. X        *sf_ptr = DirectoryMgrCompareNameDirsFirst;
  950. X        break;
  951. X        case DIR_MGR_SORT_ACCESS_ASCENDING:
  952. X        *sf_ptr = DirectoryMgrCompareLastAccessAscending;
  953. X        break;
  954. X        case DIR_MGR_SORT_ACCESS_DESCENDING:
  955. X        *sf_ptr = DirectoryMgrCompareLastAccessDescending;
  956. X        break;
  957. X        default:
  958. X        fprintf(stderr,"Bad sort type %d\n",sort_type);
  959. X        return(FALSE);
  960. X    }
  961. X    return(TRUE);
  962. } /* End DirectoryMgrSimpleSortingFunc */
  963. X
  964. /*---------------------------------------------------------------------------*
  965. X
  966. X                    S O R T I N G    R O U T I N E S
  967. X
  968. X *---------------------------------------------------------------------------*/
  969. X
  970. int DirectoryMgrCompareName(e1p,e2p)
  971. DirEntry **e1p,**e2p;
  972. {
  973. X    return(strcmp(DirEntryFileName(*e1p),DirEntryFileName(*e2p)));
  974. } /* End DirectoryMgrCompareName */
  975. X
  976. X
  977. int DirectoryMgrCompareNameDirsFirst(e1p,e2p)
  978. DirEntry **e1p,**e2p;
  979. {
  980. X    if (DirEntryLeadsToDir(*e1p))
  981. X    {
  982. X        if (!DirEntryLeadsToDir(*e2p)) return(-1);
  983. X    }
  984. X        else if (DirEntryLeadsToDir(*e2p))
  985. X    {
  986. X        return(1);
  987. X    }
  988. X    return(strcmp(DirEntryFileName(*e1p),DirEntryFileName(*e2p)));
  989. } /* End DirectoryMgrCompareNameDirsFirst */
  990. X
  991. X
  992. int DirectoryMgrCompareSizeAscending(e1p,e2p)
  993. DirEntry **e1p,**e2p;
  994. {
  995. X    if (DirEntryFileSize(*e1p) < DirEntryFileSize(*e2p))
  996. X        return (-1);
  997. X        else if (DirEntryFileSize(*e1p) == DirEntryFileSize(*e2p))
  998. X        return (0);
  999. X        else
  1000. X        return (1);
  1001. } /* End DirectoryMgrCompareSizeAscending */
  1002. X
  1003. X
  1004. int DirectoryMgrCompareSizeDescending(e1p,e2p)
  1005. DirEntry **e1p,**e2p;
  1006. {
  1007. X    if (DirEntryFileSize(*e1p) > DirEntryFileSize(*e2p))
  1008. X        return (-1);
  1009. X        else if (DirEntryFileSize(*e1p) == DirEntryFileSize(*e2p))
  1010. X        return (0);
  1011. X        else
  1012. X        return (1);
  1013. } /* End DirectoryMgrCompareSizeDescending */
  1014. X
  1015. X
  1016. int DirectoryMgrCompareLastAccessAscending(e1p,e2p)
  1017. DirEntry **e1p,**e2p;
  1018. {
  1019. X    return((long)DirEntryLastAccess(*e1p) >
  1020. X           (long)DirEntryLastAccess(*e2p));
  1021. } /* End DirectoryMgrCompareLastAccessAscending */
  1022. X
  1023. X
  1024. int DirectoryMgrCompareLastAccessDescending(e1p,e2p)
  1025. DirEntry **e1p,**e2p;
  1026. {
  1027. X    return((long)DirEntryLastAccess(*e1p) <
  1028. X           (long)DirEntryLastAccess(*e2p));
  1029. } /* End DirectoryMgrCompareLastAccessDescending */
  1030. X
  1031. /*---------------------------------------------------------------------------*
  1032. X
  1033. X                     F I L T E R    R O U T I N E S
  1034. X
  1035. X *---------------------------------------------------------------------------*/
  1036. X
  1037. int DirectoryMgrFilterName(de,fsm)
  1038. DirEntry *de;
  1039. char *fsm;
  1040. {
  1041. #ifndef    NO_REGEXP
  1042. X    return(RegExpMatch(DirEntryFileName(de),fsm));
  1043. #else
  1044. X    return(TRUE);
  1045. #endif
  1046. } /* End DirectoryMgrFilterName */
  1047. SHAR_EOF
  1048. chmod 0644 xarchie-2.0.6/FWF/Dir/DirMgr.c ||
  1049. echo 'restore of xarchie-2.0.6/FWF/Dir/DirMgr.c failed'
  1050. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/Dir/DirMgr.c'`"
  1051. test 12237 -eq "$Wc_c" ||
  1052.     echo 'xarchie-2.0.6/FWF/Dir/DirMgr.c: original size 12237, current size' "$Wc_c"
  1053. rm -f _shar_wnt_.tmp
  1054. fi
  1055. # ============= xarchie-2.0.6/FWF/Dir/DirMgr.h ==============
  1056. if test -f 'xarchie-2.0.6/FWF/Dir/DirMgr.h' -a X"$1" != X"-c"; then
  1057.     echo 'x - skipping xarchie-2.0.6/FWF/Dir/DirMgr.h (File already exists)'
  1058.     rm -f _shar_wnt_.tmp
  1059. else
  1060. > _shar_wnt_.tmp
  1061. echo 'x - extracting xarchie-2.0.6/FWF/Dir/DirMgr.h (Text)'
  1062. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/Dir/DirMgr.h' &&
  1063. /****************************************************************************
  1064. X
  1065. X    DirMgr.h
  1066. X
  1067. X    This file contains the C declarations and definitions for the
  1068. X    DirectoryMgr system.
  1069. X
  1070. X    This system is intended to managed filtered and sorted directory
  1071. X    lists.
  1072. X
  1073. X ****************************************************************************/
  1074. /*
  1075. X * Copyright 1990,1991,1992 Brian Totty
  1076. X * 
  1077. X * Permission to use, copy, modify, distribute, and sell this software
  1078. X * and its documentation for any purpose is hereby granted without fee,
  1079. X * provided that the above copyright notice appears in all copies and that
  1080. X * both that copyright notice and this permission notice appear in
  1081. X * supporting documentation, and that the name of Brian Totty or
  1082. X * University of Illinois not be used in advertising or publicity
  1083. X * pertaining to distribution of the software without specific, written
  1084. X * prior permission.  Brian Totty and University of Illinois make no
  1085. X * representations about the suitability of this software for any
  1086. X * purpose.  It is provided "as is" without express or implied warranty.
  1087. X *
  1088. X * Brian Totty and University of Illinois disclaim all warranties with
  1089. X * regard to this software, including all implied warranties of
  1090. X * merchantability and fitness, in no event shall Brian Totty or
  1091. X * University of Illinois be liable for any special, indirect or
  1092. X * consequential damages or any damages whatsoever resulting from loss of
  1093. X * use, data or profits, whether in an action of contract, negligence or
  1094. X * other tortious action, arising out of or in connection with the use or
  1095. X * performance of this software.
  1096. X *
  1097. X * Author:
  1098. X *     Brian Totty
  1099. X *     Department of Computer Science
  1100. X *     University Of Illinois at Urbana-Champaign
  1101. X *    1304 West Springfield Avenue
  1102. X *     Urbana, IL 61801
  1103. X * 
  1104. X *     totty@cs.uiuc.edu
  1105. X *     
  1106. X */ 
  1107. X
  1108. #ifndef _DIRECTORY_MGR_H_
  1109. #define    _DIRECTORY_MGR_H_
  1110. X
  1111. #include <Directory.h>
  1112. X
  1113. /*---------------------------------------------------------------------------*
  1114. X
  1115. X        Simple DirectoryMgr Interface
  1116. X
  1117. X        DirectoryMgrSimpleOpen();
  1118. X        DirectoryMgrSimpleRefilter();
  1119. X        DirectoryMgrSimpleResort();
  1120. X
  1121. X    Standard DirectoryMgr Interface
  1122. X
  1123. X        DirectoryMgrOpen();
  1124. X        DirectoryMgrClose();
  1125. X        DirectoryMgrRefilter();
  1126. X        DirectoryMgrRefresh();
  1127. X        DirectoryMgrResort();
  1128. X
  1129. X    Moving Around Items
  1130. X
  1131. X        DirectoryMgrGotoItem();
  1132. X        DirectoryMgrGotoNamedItem();
  1133. X        DirectoryMgrRestart();
  1134. X        DirectoryMgrGetIndex();
  1135. X        DirectoryMgrCurrentEntry();
  1136. X        DirectoryMgrNextEntry();
  1137. X        DirectoryMgrPrevEntry();
  1138. X
  1139. X    Utility Functions
  1140. X
  1141. X        DirectoryMgrSimpleFilterFunc();
  1142. X        DirectoryMgrSimpleSortingFunc();
  1143. X
  1144. X    Comparison Functions
  1145. X
  1146. X        DirectoryMgrCompareName();
  1147. X        DirectoryMgrCompareSizeAscending();
  1148. X        DirectoryMgrCompareSizeDescending();
  1149. X
  1150. X    Macros
  1151. X
  1152. X        DirectoryMgrDir();
  1153. X        DirectoryMgrData();
  1154. X        DirectoryMgrSortedPtrs();
  1155. X        DirectoryMgrFilterFunc();
  1156. X        DirectoryMgrCompFunc();
  1157. X        DirectoryMgrFilterData();
  1158. X        DirectoryMgrFreeFilterData();
  1159. X        DirectoryMgrTotalCount();
  1160. X        DirectoryMgrFilteredCount();
  1161. X        DirectoryMgrCurrentIndex();
  1162. X
  1163. X
  1164. X *---------------------------------------------------------------------------*/
  1165. X
  1166. #ifndef PFI
  1167. typedef int (*PFI)();
  1168. #endif
  1169. X
  1170. typedef struct entry_cons
  1171. {
  1172. X    DIR_ENTRY dir_entry;
  1173. X    struct entry_cons *next;
  1174. } DIR_ENTRY_CONS;
  1175. X
  1176. typedef    DIR_ENTRY_CONS DirEntryCons;
  1177. X
  1178. typedef struct
  1179. {
  1180. X    DIRECTORY dir;
  1181. X    DIR_ENTRY *data;
  1182. X    DIR_ENTRY **sorted_ptrs;
  1183. X    int total_count;
  1184. X    int filtered_count;
  1185. X    PFI filter_func;
  1186. X    char *filter_data;
  1187. X    int free_filter_data;
  1188. X    PFI comp_func;
  1189. X    int current_index;
  1190. } DIRECTORY_MGR;
  1191. X
  1192. typedef    DIRECTORY_MGR DirectoryMgr;
  1193. X
  1194. #define    DIR_MGR_SORT_NONE            0
  1195. #define    DIR_MGR_SORT_NAME            1
  1196. #define    DIR_MGR_SORT_NAME_DIRS_FIRST        2
  1197. #define DIR_MGR_SORT_SIZE_ASCENDING        3
  1198. #define DIR_MGR_SORT_SIZE_DESCENDING        4
  1199. #define    DIR_MGR_SORT_ACCESS_ASCENDING        5
  1200. #define    DIR_MGR_SORT_ACCESS_DESCENDING        6
  1201. X
  1202. #define    DirectoryMgrDir(dm)        (&((dm)->dir))
  1203. #define    DirectoryMgrData(dm)        ((dm)->data)
  1204. #define    DirectoryMgrSortedPtrs(dm)    ((dm)->sorted_ptrs)
  1205. #define    DirectoryMgrFilterFunc(dm)    ((dm)->filter_func)
  1206. #define    DirectoryMgrCompFunc(dm)    ((dm)->comp_func)
  1207. #define    DirectoryMgrFilterData(dm)    ((dm)->filter_data)
  1208. #define    DirectoryMgrFreeFilterData(dm)    ((dm)->free_filter_data)
  1209. #define    DirectoryMgrTotalCount(dm)    ((dm)->total_count)
  1210. #define    DirectoryMgrFilteredCount(dm)    ((dm)->filtered_count)
  1211. #define    DirectoryMgrCurrentIndex(dm)    ((dm)->current_index)
  1212. X
  1213. #if (!NeedFunctionPrototypes)
  1214. X
  1215. DirectoryMgr *    DirectoryMgrSimpleOpen();
  1216. int        DirectoryMgrSimpleRefilter();
  1217. int        DirectoryMgrSimpleResort();
  1218. X
  1219. DirectoryMgr *    DirectoryMgrOpen();
  1220. void        DirectoryMgrClose();
  1221. int        DirectoryMgrRefilter();
  1222. int        DirectoryMgrRefresh();
  1223. void        DirectoryMgrResort();
  1224. X
  1225. int        DirectoryMgrGotoItem();
  1226. int        DirectoryMgrGotoNamedItem();
  1227. void        DirectoryMgrRestart();
  1228. int        DirectoryMgrGetIndex();
  1229. DirEntry *    DirectoryMgrCurrentEntry();
  1230. DirEntry *    DirectoryMgrNextEntry();
  1231. DirEntry *    DirectoryMgrPrevEntry();
  1232. X
  1233. int        DirectoryMgrSimpleFilterFunc();
  1234. int        DirectoryMgrSimpleSortingFunc();
  1235. X
  1236. int        DirectoryMgrCompareName();
  1237. int        DirectoryMgrCompareNameDirsFirst();
  1238. int        DirectoryMgrCompareSizeAscending();
  1239. int        DirectoryMgrCompareSizeDescending();
  1240. int        DirectoryMgrCompareLastAccessAscending();
  1241. int        DirectoryMgrCompareLastAccessDescending();
  1242. X
  1243. int        DirectoryMgrFilterName();
  1244. X
  1245. #else
  1246. X
  1247. DirectoryMgr *    DirectoryMgrSimpleOpen(char *path, int sort_type,
  1248. X            char *pattern);
  1249. int        DirectoryMgrSimpleRefilter(DirectoryMgr *dm, char *pattern);
  1250. int        DirectoryMgrSimpleResort(DirectoryMgr *dm, int sort_type);
  1251. X
  1252. DirectoryMgr *    DirectoryMgrOpen(char *path, PFI c_func, PFI f_func,
  1253. X            char *f_data, int free_data);
  1254. void        DirectoryMgrClose(DirectoryMgr *dm);
  1255. int        DirectoryMgrRefilter(DirectoryMgr *dm, PFI f_func,
  1256. X            char *f_data, int f_free);
  1257. int        DirectoryMgrRefresh(DirectoryMgr *dm);
  1258. void        DirectoryMgrResort(DirectoryMgr *dm, PFI c_func);
  1259. X
  1260. int        DirectoryMgrGotoItem(DirectoryMgr *dm, int i);
  1261. int        DirectoryMgrGotoNamedItem(DirectoryMgr *dm, char *name);
  1262. void        DirectoryMgrRestart(DirectoryMgr *dm);
  1263. DirEntry *    DirectoryMgrCurrentEntry(DirectoryMgr *dm);
  1264. DirEntry *    DirectoryMgrNextEntry(DirectoryMgr *dm);
  1265. DirEntry *    DirectoryMgrPrevEntry(DirectoryMgr *dm);
  1266. X
  1267. int        DirectoryMgrSimpleFilterFunc(char *pattern, PFI *ff_ptr,
  1268. X            char **fd_ptr);
  1269. int        DirectoryMgrSimpleSortingFunc(int sort_type, PFI *sf_ptr);
  1270. X
  1271. int        DirectoryMgrCompareName(DirEntry **e1p, DirEntry **e2p);
  1272. int        DirectoryMgrCompareNameDirsFirst(DirEntry **e1p,
  1273. X            DirEntry **e2p);
  1274. int        DirectoryMgrCompareSizeAscending(DirEntry **e1p,
  1275. X            DirEntry **e2p);
  1276. int        DirectoryMgrCompareSizeDescending(DirEntry **e1p,
  1277. X            DirEntry **e2p);
  1278. int        DirectoryMgrCompareLastAccessAscending(DirEntry **e1p,
  1279. X            DirEntry **e2p);
  1280. int        DirectoryMgrCompareLastAccessDescending(DirEntry **e1p,
  1281. X            DirEntry **e2p);
  1282. X
  1283. int        DirectoryMgrFilterName(DirEntry *de, char *fsm);
  1284. X
  1285. #endif
  1286. X
  1287. #endif
  1288. SHAR_EOF
  1289. chmod 0644 xarchie-2.0.6/FWF/Dir/DirMgr.h ||
  1290. echo 'restore of xarchie-2.0.6/FWF/Dir/DirMgr.h failed'
  1291. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/Dir/DirMgr.h'`"
  1292. test 6706 -eq "$Wc_c" ||
  1293.     echo 'xarchie-2.0.6/FWF/Dir/DirMgr.h: original size 6706, current size' "$Wc_c"
  1294. rm -f _shar_wnt_.tmp
  1295. fi
  1296. # ============= xarchie-2.0.6/FWF/Dir/DirMgrT.c ==============
  1297. if test -f 'xarchie-2.0.6/FWF/Dir/DirMgrT.c' -a X"$1" != X"-c"; then
  1298.     echo 'x - skipping xarchie-2.0.6/FWF/Dir/DirMgrT.c (File already exists)'
  1299.     rm -f _shar_wnt_.tmp
  1300. else
  1301. > _shar_wnt_.tmp
  1302. echo 'x - extracting xarchie-2.0.6/FWF/Dir/DirMgrT.c (Text)'
  1303. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/Dir/DirMgrT.c' &&
  1304. /*
  1305. X * Copyright 1990,1991,1992 Brian Totty
  1306. X * 
  1307. X * Permission to use, copy, modify, distribute, and sell this software
  1308. X * and its documentation for any purpose is hereby granted without fee,
  1309. X * provided that the above copyright notice appears in all copies and that
  1310. X * both that copyright notice and this permission notice appear in
  1311. X * supporting documentation, and that the name of Brian Totty or
  1312. X * University of Illinois not be used in advertising or publicity
  1313. X * pertaining to distribution of the software without specific, written
  1314. X * prior permission.  Brian Totty and University of Illinois make no
  1315. X * representations about the suitability of this software for any
  1316. X * purpose.  It is provided "as is" without express or implied warranty.
  1317. X *
  1318. X * Brian Totty and University of Illinois disclaim all warranties with
  1319. X * regard to this software, including all implied warranties of
  1320. X * merchantability and fitness, in no event shall Brian Totty or
  1321. X * University of Illinois be liable for any special, indirect or
  1322. X * consequential damages or any damages whatsoever resulting from loss of
  1323. X * use, data or profits, whether in an action of contract, negligence or
  1324. X * other tortious action, arising out of or in connection with the use or
  1325. X * performance of this software.
  1326. X *
  1327. X * Author:
  1328. X *     Brian Totty
  1329. X *     Department of Computer Science
  1330. X *     University Of Illinois at Urbana-Champaign
  1331. X *    1304 West Springfield Avenue
  1332. X *     Urbana, IL 61801
  1333. X * 
  1334. X *     totty@cs.uiuc.edu
  1335. X *     
  1336. X */ 
  1337. #include <stdio.h>
  1338. #include <DirMgr.h>
  1339. X
  1340. int main(argc,argv)
  1341. int argc;
  1342. char **argv;
  1343. {
  1344. X    DIRECTORY_MGR *dm;
  1345. X    DIR_ENTRY *de;
  1346. X    char *path,*pat;
  1347. X    int sort_mode;
  1348. X
  1349. X    if (argc != 3 && argc != 4)
  1350. X    {
  1351. X        fprintf(stderr,"usage: %s path sort_mode [pattern]\n",argv[0]);
  1352. X        exit(-1);
  1353. X    }
  1354. X    path = argv[1];
  1355. X    sort_mode = atoi(argv[2]);
  1356. X    if (argc == 4)
  1357. X        pat = argv[3];
  1358. X        else
  1359. X        pat = NULL;
  1360. X    dm = DirectoryMgrSimpleOpen(path,sort_mode,pat);
  1361. X    if (dm == NULL)
  1362. X    {
  1363. X        fprintf(stderr,"Can't open directory mgr for '%s'\n",path);
  1364. X        exit(-1);
  1365. X    }
  1366. X    while (1)
  1367. X    {
  1368. X        de = DirectoryMgrNextEntry(dm);
  1369. X        if (de == NULL) break;
  1370. X        DirEntryDump(stderr,de);
  1371. X    }
  1372. X
  1373. X    printf("Changing sort mode to 1\n");
  1374. X    DirectoryMgrSimpleResort(dm,1);
  1375. X    while (1)
  1376. X    {
  1377. X        de = DirectoryMgrNextEntry(dm);
  1378. X        if (de == NULL) break;
  1379. X        DirEntryDump(stderr,de);
  1380. X    }
  1381. X
  1382. X
  1383. X    DirectoryMgrClose(dm);
  1384. X    return(1);
  1385. }
  1386. SHAR_EOF
  1387. chmod 0644 xarchie-2.0.6/FWF/Dir/DirMgrT.c ||
  1388. echo 'restore of xarchie-2.0.6/FWF/Dir/DirMgrT.c failed'
  1389. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/Dir/DirMgrT.c'`"
  1390. test 2302 -eq "$Wc_c" ||
  1391.     echo 'xarchie-2.0.6/FWF/Dir/DirMgrT.c: original size 2302, current size' "$Wc_c"
  1392. rm -f _shar_wnt_.tmp
  1393. fi
  1394. # ============= xarchie-2.0.6/FWF/Dir/Directory.c ==============
  1395. if test -f 'xarchie-2.0.6/FWF/Dir/Directory.c' -a X"$1" != X"-c"; then
  1396.     echo 'x - skipping xarchie-2.0.6/FWF/Dir/Directory.c (File already exists)'
  1397.     rm -f _shar_wnt_.tmp
  1398. else
  1399. > _shar_wnt_.tmp
  1400. echo 'x - extracting xarchie-2.0.6/FWF/Dir/Directory.c (Text)'
  1401. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/Dir/Directory.c' &&
  1402. /****************************************************************************
  1403. X
  1404. X        Directory.c
  1405. X
  1406. X    This file contains the C code that implements the directory
  1407. X    iteration and file information subsystem.
  1408. X
  1409. X    This code is intended to be used as a convenient, machine
  1410. X    independent interface to iterate through the contents of a
  1411. X    directory.
  1412. X
  1413. X ****************************************************************************/
  1414. /*
  1415. X * Copyright 1990,1991,1992 Brian Totty
  1416. X * 
  1417. X * Permission to use, copy, modify, distribute, and sell this software
  1418. X * and its documentation for any purpose is hereby granted without fee,
  1419. X * provided that the above copyright notice appears in all copies and that
  1420. X * both that copyright notice and this permission notice appear in
  1421. X * supporting documentation, and that the name of Brian Totty or
  1422. X * University of Illinois not be used in advertising or publicity
  1423. X * pertaining to distribution of the software without specific, written
  1424. X * prior permission.  Brian Totty and University of Illinois make no
  1425. X * representations about the suitability of this software for any
  1426. X * purpose.  It is provided "as is" without express or implied warranty.
  1427. X *
  1428. X * Brian Totty and University of Illinois disclaim all warranties with
  1429. X * regard to this software, including all implied warranties of
  1430. X * merchantability and fitness, in no event shall Brian Totty or
  1431. X * University of Illinois be liable for any special, indirect or
  1432. X * consequential damages or any damages whatsoever resulting from loss of
  1433. X * use, data or profits, whether in an action of contract, negligence or
  1434. X * other tortious action, arising out of or in connection with the use or
  1435. X * performance of this software.
  1436. X *
  1437. X * Author:
  1438. X *     Brian Totty
  1439. X *     Department of Computer Science
  1440. X *     University Of Illinois at Urbana-Champaign
  1441. X *    1304 West Springfield Avenue
  1442. X *     Urbana, IL 61801
  1443. X * 
  1444. X *     totty@cs.uiuc.edu
  1445. X *     
  1446. X */ 
  1447. X
  1448. #include <Directory.h>
  1449. #include <RegExp.h>
  1450. X
  1451. /*--------------------------------------------------------------------------*
  1452. X
  1453. X        L O W    L E V E L    D I R E C T O R Y    I N T E R F A C E
  1454. X
  1455. X *--------------------------------------------------------------------------*/
  1456. X
  1457. int DirectoryOpen(dir_name,dp)
  1458. char *dir_name;
  1459. Directory *dp;
  1460. {
  1461. X    DirectoryDir(dp) = opendir(dir_name);
  1462. X    if (DirectoryDir(dp) == NULL) return(FALSE);
  1463. X    if (DirectoryPathExpand(dir_name,DirectoryPath(dp)) == NULL)
  1464. X    {
  1465. X        closedir(DirectoryDir(dp));
  1466. X        return(FALSE);
  1467. X    }
  1468. X    return(TRUE);
  1469. } /* End DirectoryOpen */
  1470. X
  1471. X
  1472. void DirectoryRestart(dp)
  1473. Directory *dp;
  1474. {
  1475. X    rewinddir(DirectoryDir(dp));
  1476. } /* End DirectoryRestart */
  1477. X
  1478. X
  1479. void DirectoryClose(dp)
  1480. Directory *dp;
  1481. {
  1482. X    closedir(DirectoryDir(dp));
  1483. } /* End DirectoryClose */
  1484. X
  1485. X
  1486. long DirectoryTellPosition(dp)
  1487. Directory *dp;
  1488. {
  1489. X    return(telldir(DirectoryDir(dp)));
  1490. } /* End DirectoryTellPosition */
  1491. X
  1492. X
  1493. void DirectorySetPosition(dp,pos)
  1494. Directory *dp;
  1495. long pos;
  1496. {
  1497. X    seekdir(DirectoryDir(dp),pos);
  1498. } /* End DirectorySetPosition */
  1499. X
  1500. X
  1501. int DirectoryReadNextEntry(dp,de)
  1502. Directory *dp;
  1503. DirEntry *de;
  1504. {
  1505. X    u_short orig_file_type;
  1506. X    static struct dirent *_ep;
  1507. X    static struct stat _lstats,_stats;
  1508. X    char full_path[MAXPATHLEN + 2];
  1509. X
  1510. X    _ep = readdir(DirectoryDir(dp));
  1511. X    if (_ep == NULL) return(FALSE);
  1512. X    strcpy(DirEntryFileName(de),_ep->d_name);
  1513. X    strcpy(full_path,DirectoryPath(dp));
  1514. X    strcat(full_path,DirEntryFileName(de));
  1515. X
  1516. X    if (lstat(full_path,&_lstats) != 0) return(FALSE);
  1517. X
  1518. X    orig_file_type = _lstats.st_mode & S_IFMT;
  1519. X    switch (orig_file_type)
  1520. X    {
  1521. X        case S_IFDIR:
  1522. X        DirEntryType(de) = F_TYPE_DIR;
  1523. X        break;
  1524. X        case S_IFREG:
  1525. X        DirEntryType(de) = F_TYPE_FILE;
  1526. X        break;
  1527. X        case S_IFCHR:
  1528. X        DirEntryType(de) = F_TYPE_CHAR_SPECIAL;
  1529. X        break;
  1530. X        case S_IFBLK:
  1531. X        DirEntryType(de) = F_TYPE_BLOCK_SPECIAL;
  1532. X        break;
  1533. X        case S_IFLNK:
  1534. X        DirEntryType(de) = F_TYPE_SYM_LINK;
  1535. X        break;
  1536. X        case S_IFSOCK:
  1537. X        DirEntryType(de) = F_TYPE_SOCKET;
  1538. X        break;
  1539. #ifdef S_IFIFO
  1540. X        case S_IFIFO:
  1541. X        DirEntryType(de) = F_TYPE_FIFO;
  1542. X        break;
  1543. #endif
  1544. X        default:
  1545. X        DirEntryType(de) = orig_file_type;
  1546. X        break;
  1547. X    }
  1548. X
  1549. X    DirEntryIsBrokenLink(de) = FALSE;
  1550. X    DirEntryIsDirectoryLink(de) = FALSE;
  1551. X    if (DirEntryIsSymLink(de))            /* Symbolic Link */
  1552. X    {
  1553. X        if (stat(full_path,&_stats) != 0)    /* Can't Stat File */
  1554. X        {
  1555. X            DirEntryIsBrokenLink(de) = TRUE;
  1556. X            _stats = _lstats;
  1557. X        }
  1558. X            else                /* Link Not Broken */
  1559. X        {
  1560. #ifdef SLOW_DIRLINK_TEST
  1561. X                char temp_path[MAXPATHLEN + 2];
  1562. X            if (DirectoryPathExpand(full_path,temp_path) != NULL)
  1563. X            {
  1564. #else
  1565. X            if ((_stats.st_mode & S_IFMT) == S_IFDIR)
  1566. X            {
  1567. #endif
  1568. X                DirEntryIsDirectoryLink(de) = TRUE;
  1569. X            }
  1570. X
  1571. X        }
  1572. X    }
  1573. X        else                    /* Not Symbolic Link */
  1574. X    {
  1575. X        _stats = _lstats;
  1576. X    }
  1577. X
  1578. X    FileInfoOrigMode(DirEntrySelfInfo(de)) = _lstats.st_mode;
  1579. X    FileInfoProt(DirEntrySelfInfo(de)) = _lstats.st_mode & 0777;
  1580. X    FileInfoUserID(DirEntrySelfInfo(de)) = _lstats.st_uid;
  1581. X    FileInfoGroupID(DirEntrySelfInfo(de)) = _lstats.st_gid;
  1582. X    FileInfoFileSize(DirEntrySelfInfo(de)) = _lstats.st_size;
  1583. X    FileInfoLastAccess(DirEntrySelfInfo(de)) = _lstats.st_atime;
  1584. X    FileInfoLastModify(DirEntrySelfInfo(de)) = _lstats.st_mtime;
  1585. X    FileInfoLastStatusChange(DirEntrySelfInfo(de)) = _lstats.st_ctime;
  1586. X
  1587. X    FileInfoOrigMode(DirEntryActualInfo(de)) = _stats.st_mode;
  1588. X    FileInfoProt(DirEntryActualInfo(de)) = _stats.st_mode & 0777;
  1589. X    FileInfoUserID(DirEntryActualInfo(de)) = _stats.st_uid;
  1590. X    FileInfoGroupID(DirEntryActualInfo(de)) = _stats.st_gid;
  1591. X    FileInfoFileSize(DirEntryActualInfo(de)) = _stats.st_size;
  1592. X    FileInfoLastAccess(DirEntryActualInfo(de)) = _stats.st_atime;
  1593. X    FileInfoLastModify(DirEntryActualInfo(de)) = _stats.st_mtime;
  1594. X    FileInfoLastStatusChange(DirEntryActualInfo(de)) = _stats.st_ctime;
  1595. X
  1596. X    return(TRUE);
  1597. } /* End DirectoryReadNextEntry */
  1598. X
  1599. X
  1600. char *DirectoryPathExpand(old_path,new_path)
  1601. char *old_path,*new_path;
  1602. {
  1603. X    register char *p;
  1604. X    char path[MAXPATHLEN + 2];
  1605. X
  1606. X    if (getwd(path) == NULL) return(NULL);
  1607. X    if (chdir(old_path) != 0) return(NULL);
  1608. X    if (getwd(new_path) == NULL) strcpy(new_path,old_path);
  1609. X    if (chdir(path) != 0) return(NULL);
  1610. X    for (p = new_path; *p != '\0'; p++)
  1611. X        /*EMPTY*/;
  1612. X    if ((p != new_path) && *(p - 1) != '/')
  1613. X    {
  1614. X        *p++ = '/';
  1615. X        *p = '\0';
  1616. X    }
  1617. X    return(new_path);
  1618. } /* End DirectoryPathExpand */
  1619. X
  1620. X
  1621. /*---------------------------------------------------------------------------*
  1622. X
  1623. X             D I R E C T O R Y    E N T R Y    R O U T I N E S
  1624. X
  1625. X *---------------------------------------------------------------------------*/
  1626. X
  1627. void DirEntryDump(fp,de)
  1628. FILE *fp;
  1629. DirEntry *de;
  1630. {
  1631. X    fprintf(fp,"%20s, Size %7d, Prot %3o\n",
  1632. X        DirEntryFileName(de),DirEntryFileSize(de),DirEntryProt(de));
  1633. } /* End DirEntryDump */
  1634. SHAR_EOF
  1635. chmod 0644 xarchie-2.0.6/FWF/Dir/Directory.c ||
  1636. echo 'restore of xarchie-2.0.6/FWF/Dir/Directory.c failed'
  1637. Wc_c="`wc -c < 'xarchie-2.0.6/FWF/Dir/Directory.c'`"
  1638. test 6473 -eq "$Wc_c" ||
  1639.     echo 'xarchie-2.0.6/FWF/Dir/Directory.c: original size 6473, current size' "$Wc_c"
  1640. rm -f _shar_wnt_.tmp
  1641. fi
  1642. # ============= xarchie-2.0.6/FWF/Dir/Directory.h ==============
  1643. if test -f 'xarchie-2.0.6/FWF/Dir/Directory.h' -a X"$1" != X"-c"; then
  1644.     echo 'x - skipping xarchie-2.0.6/FWF/Dir/Directory.h (File already exists)'
  1645.     rm -f _shar_wnt_.tmp
  1646. else
  1647. > _shar_wnt_.tmp
  1648. echo 'x - extracting xarchie-2.0.6/FWF/Dir/Directory.h (Text)'
  1649. sed 's/^X//' << 'SHAR_EOF' > 'xarchie-2.0.6/FWF/Dir/Directory.h' &&
  1650. /****************************************************************************
  1651. X
  1652. X    Directory.h
  1653. X
  1654. X    This file contains the C definitions and declarations for the
  1655. X    Directory.c directory iteration code.
  1656. X
  1657. X    This code is intended to be used as a convenient, machine
  1658. X    independent interface to iterate through the contents of a
  1659. X    directory.
  1660. X
  1661. X ****************************************************************************/
  1662. /*
  1663. X * Copyright 1990,1991,1992 Brian Totty
  1664. X * 
  1665. X * Permission to use, copy, modify, distribute, and sell this software
  1666. X * and its documentation for any purpose is hereby granted without fee,
  1667. X * provided that the above copyright notice appears in all copies and that
  1668. X * both that copyright notice and this permission notice appear in
  1669. X * supporting documentation, and that the name of Brian Totty or
  1670. X * University of Illinois not be used in advertising or publicity
  1671. X * pertaining to distribution of the software without specific, written
  1672. SHAR_EOF
  1673. true || echo 'restore of xarchie-2.0.6/FWF/Dir/Directory.h failed'
  1674. fi
  1675. echo 'End of xarchie-2.0.6 part 19'
  1676. echo 'File xarchie-2.0.6/FWF/Dir/Directory.h is continued in part 20'
  1677. echo 20 > _shar_seq_.tmp
  1678. exit 0
  1679.  
  1680. exit 0 # Just in case...
  1681. -- 
  1682.   // chris@IMD.Sterling.COM       | Send comp.sources.x submissions to:
  1683. \X/  Amiga - The only way to fly! |    sources-x@imd.sterling.com
  1684.  "It's intuitively obvious to the |
  1685.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1686.