home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume21 / xcal / part05 < prev    next >
Encoding:
Text File  |  1993-12-22  |  44.1 KB  |  1,794 lines

  1. Newsgroups: comp.sources.x
  2. From: pc@hillside.co.uk (Peter Collinson)
  3. Subject: v21i080:  xcal - A calendar program for X, Part05/08
  4. Message-ID: <1993Dec21.161757.22057@sparky.sterling.com>
  5. X-Md4-Signature: fd5044c4524fe6111cd2009d6138c940
  6. Sender: chris@sparky.sterling.com (Chris Olson)
  7. Organization: Hillside Systems, 61 Hillside Avenue, Canterbury, Kent CT2 8HA
  8. Date: Tue, 21 Dec 1993 16:17:57 GMT
  9. Approved: chris@sterling.com
  10.  
  11. Submitted-by: pc@hillside.co.uk (Peter Collinson)
  12. Posting-number: Volume 21, Issue 80
  13. Archive-name: xcal/part05
  14. Environment: X11
  15. Supersedes: xcal: Volume 12, Issue 101
  16.  
  17. Xcal is a calendar program. For more details see Part 1 of this posting
  18.  
  19. Part 5 of 8
  20. --shar starts here--
  21. #! /bin/sh
  22. # This is a shell archive.  Remove anything before this line, then unpack
  23. # it by saving it into a file and typing "sh file".  To overwrite existing
  24. # files, type "sh file -c".  You can also feed this as standard input via
  25. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  26. # will see the following message at the end:
  27. #        "End of archive 5 (of 8)."
  28. # Contents:  Makefile.sunos pscal/pscal.script xcalev/xcalev.c
  29. # Wrapped by pc@hillside on Wed Nov 17 11:24:36 1993
  30. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  31. if test -f 'Makefile.sunos' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'Makefile.sunos'\"
  33. else
  34. echo shar: Extracting \"'Makefile.sunos'\" \(14214 characters\)
  35. sed "s/^X//" >'Makefile.sunos' <<'END_OF_FILE'
  36. X# Makefile generated by imake - do not edit!
  37. X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
  38. X#
  39. X# The cpp used on this machine replaces all newlines and multiple tabs and
  40. X# spaces in a macro expansion with a single space.  Imake tries to compensate
  41. X# for this, but is not always successful.
  42. X#
  43. X
  44. X###########################################################################
  45. X# Makefile generated from "Imake.tmpl" and <Imakefile>
  46. X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
  47. X#
  48. X# Platform-specific parameters may be set in the appropriate .cf
  49. X# configuration files.  Site-wide parameters may be set in the file
  50. X# site.def.  Full rebuilds are recommended if any parameters are changed.
  51. X#
  52. X# If your C preprocessor doesn't define any unique symbols, you'll need
  53. X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  54. X# "make Makefile", "make Makefiles", or "make World").
  55. X#
  56. X# If you absolutely can't get imake to work, you'll need to set the
  57. X# variables at the top of each Makefile as well as the dependencies at the
  58. X# bottom (makedepend will do this automatically).
  59. X#
  60. X
  61. X###########################################################################
  62. X# platform-specific configuration parameters - edit sun.cf to change
  63. X
  64. X# platform:  $XConsortium: sun.cf,v 1.38 89/12/23 16:10:10 jim Exp $
  65. X# operating system:  SunOS 4.0.3
  66. X
  67. X###########################################################################
  68. X# site-specific configuration parameters - edit site.def to change
  69. X
  70. X            SHELL = /bin/sh
  71. X
  72. X              TOP = .
  73. X      CURRENT_DIR = .
  74. X
  75. X               AR = ar clq
  76. X  BOOTSTRAPCFLAGS =
  77. X               CC = cc
  78. X
  79. X         COMPRESS = compress
  80. X              CPP = /lib/cpp $(STD_CPP_DEFINES)
  81. X    PREPROCESSCMD = cc -E $(STD_CPP_DEFINES)
  82. X          INSTALL = install
  83. X               LD = ld
  84. X             LINT = lint
  85. X      LINTLIBFLAG = -C
  86. X         LINTOPTS = -axz
  87. X               LN = ln -s
  88. X             MAKE = make
  89. X               MV = mv
  90. X               CP = cp
  91. X           RANLIB = ranlib
  92. X  RANLIBINSTFLAGS =
  93. X               RM = rm -f
  94. X     STD_INCLUDES =
  95. X  STD_CPP_DEFINES =
  96. X      STD_DEFINES =
  97. X EXTRA_LOAD_FLAGS =
  98. X  EXTRA_LIBRARIES =
  99. X             TAGS = ctags
  100. X
  101. X    SHAREDCODEDEF = -DSHAREDCODE
  102. X         SHLIBDEF = -DSUNSHLIB
  103. X
  104. X    PROTO_DEFINES =
  105. X
  106. X     INSTPGMFLAGS =
  107. X
  108. X     INSTBINFLAGS = -m 0755
  109. X     INSTUIDFLAGS = -m 4755
  110. X     INSTLIBFLAGS = -m 0664
  111. X     INSTINCFLAGS = -m 0444
  112. X     INSTMANFLAGS = -m 0444
  113. X     INSTDATFLAGS = -m 0444
  114. X    INSTKMEMFLAGS = -m 4755
  115. X
  116. X          DESTDIR =
  117. X
  118. X     TOP_INCLUDES = -I$(INCROOT)
  119. X
  120. X      CDEBUGFLAGS = -O
  121. X        CCOPTIONS =
  122. X      COMPATFLAGS =
  123. X
  124. X      ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
  125. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES) $(DEFINES) $(COMPATFLAGS)
  126. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  127. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  128. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  129. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
  130. X   LDCOMBINEFLAGS = -X -r
  131. X
  132. X        MACROFILE = sun.cf
  133. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  134. X
  135. X    IMAKE_DEFINES =
  136. X
  137. X         IRULESRC = $(CONFIGDIR)
  138. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES)
  139. X
  140. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
  141. X            $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
  142. X            $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  143. X
  144. X###########################################################################
  145. X# X Window System Build Parameters
  146. X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
  147. X
  148. X###########################################################################
  149. X# X Window System make variables; this need to be coordinated with rules
  150. X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
  151. X
  152. X          PATHSEP = /
  153. X        USRLIBDIR = $(DESTDIR)/usr/lib
  154. X           BINDIR = $(DESTDIR)/usr/bin/X11
  155. X          INCROOT = $(DESTDIR)/usr/include
  156. X     BUILDINCROOT = $(TOP)
  157. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  158. X      BUILDINCTOP = ..
  159. X           INCDIR = $(INCROOT)/X11
  160. X           ADMDIR = $(DESTDIR)/usr/adm
  161. X           LIBDIR = $(USRLIBDIR)/X11
  162. X        CONFIGDIR = $(LIBDIR)/config
  163. X       LINTLIBDIR = $(USRLIBDIR)/lint
  164. X
  165. X          FONTDIR = $(LIBDIR)/fonts
  166. X         XINITDIR = $(LIBDIR)/xinit
  167. X           XDMDIR = $(LIBDIR)/xdm
  168. X           AWMDIR = $(LIBDIR)/awm
  169. X           TWMDIR = $(LIBDIR)/twm
  170. X           GWMDIR = $(LIBDIR)/gwm
  171. X          MANPATH = $(DESTDIR)/usr/man
  172. X    MANSOURCEPATH = $(MANPATH)/man
  173. X           MANDIR = $(MANSOURCEPATH)n
  174. X        LIBMANDIR = $(MANSOURCEPATH)3
  175. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  176. X
  177. X        SOXLIBREV = 4.2
  178. X          SOXTREV = 4.0
  179. X         SOXAWREV = 4.0
  180. X        SOOLDXREV = 4.0
  181. X         SOXMUREV = 4.0
  182. X        SOXEXTREV = 4.0
  183. X
  184. X       FONTCFLAGS = -t
  185. X
  186. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  187. X
  188. X            IMAKE = imake
  189. X           DEPEND = makedepend
  190. X              RGB = rgb
  191. X            FONTC = bdftosnf
  192. X        MKFONTDIR = mkfontdir
  193. X        MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier.sh
  194. X
  195. X        CONFIGSRC = $(TOP)/config
  196. X        CLIENTSRC = $(TOP)/clients
  197. X          DEMOSRC = $(TOP)/demos
  198. X           LIBSRC = $(TOP)/lib
  199. X          FONTSRC = $(TOP)/fonts
  200. X       INCLUDESRC = $(TOP)/X11
  201. X        SERVERSRC = $(TOP)/server
  202. X          UTILSRC = $(TOP)/util
  203. X        SCRIPTSRC = $(UTILSRC)/scripts
  204. X       EXAMPLESRC = $(TOP)/examples
  205. X       CONTRIBSRC = $(TOP)/../contrib
  206. X           DOCSRC = $(TOP)/doc
  207. X           RGBSRC = $(TOP)/rgb
  208. X        DEPENDSRC = $(UTILSRC)/makedepend
  209. X         IMAKESRC = $(CONFIGSRC)
  210. X         XAUTHSRC = $(LIBSRC)/Xau
  211. X          XLIBSRC = $(LIBSRC)/X
  212. X           XMUSRC = $(LIBSRC)/Xmu
  213. X       TOOLKITSRC = $(LIBSRC)/Xt
  214. X       AWIDGETSRC = $(LIBSRC)/Xaw
  215. X       OLDXLIBSRC = $(LIBSRC)/oldX
  216. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  217. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  218. X     MKFONTDIRSRC = $(FONTSRC)/mkfontdir
  219. X     EXTENSIONSRC = $(TOP)/extensions
  220. X
  221. X  DEPEXTENSIONLIB =
  222. X     EXTENSIONLIB = -lXext
  223. X
  224. X          DEPXLIB = $(DEPEXTENSIONLIB)
  225. X             XLIB = $(EXTENSIONLIB) -lX11
  226. X
  227. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  228. X         XAUTHLIB =  -lXau
  229. X
  230. X        DEPXMULIB =
  231. X           XMULIB = -lXmu
  232. X
  233. X       DEPOLDXLIB =
  234. X          OLDXLIB = -loldX
  235. X
  236. X      DEPXTOOLLIB =
  237. X         XTOOLLIB = -lXt
  238. X
  239. X        DEPXAWLIB =
  240. X           XAWLIB = -lXaw
  241. X
  242. X LINTEXTENSIONLIB = $(USRLIBDIR)/llib-lXext.ln
  243. X         LINTXLIB = $(USRLIBDIR)/llib-lX11.ln
  244. X          LINTXMU = $(USRLIBDIR)/llib-lXmu.ln
  245. X        LINTXTOOL = $(USRLIBDIR)/llib-lXt.ln
  246. X          LINTXAW = $(USRLIBDIR)/llib-lXaw.ln
  247. X
  248. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  249. X
  250. X         DEPLIBS1 = $(DEPLIBS)
  251. X         DEPLIBS2 = $(DEPLIBS)
  252. X         DEPLIBS3 = $(DEPLIBS)
  253. X
  254. X###########################################################################
  255. X# Imake rules for building libraries, programs, scripts, and data files
  256. X# rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
  257. X
  258. X###########################################################################
  259. X# start of Imakefile
  260. X
  261. X        DEFINES = -DLONG_IS_32_BITS -DVER_VEC
  262. X
  263. X          SRCS1 = xcal.c xcal_alarm.c xcal_buts.c xcal_days.c xcal_edit.c \
  264. X          xcal_help.c xcal_popup.c xcal_strip.c xcal_memo.c strfdate.c version.c
  265. X          OBJS1 = xcal.o xcal_alarm.o xcal_buts.o xcal_days.o xcal_edit.o \
  266. X          xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o strfdate.o version.o
  267. X
  268. X       PROGRAMS = derived xcal
  269. X   INSTPGMFLAGS = $(INSTBINFLAGS)
  270. X         BINDIR = /usr/local/bin
  271. X
  272. X OBJS = $(OBJS1) $(OBJS2) $(OBJS3)
  273. X SRCS = $(SRCS1) $(SRCS2) $(SRCS3)
  274. X
  275. Xall:: $(PROGRAMS)
  276. X
  277. Xxcal: $(OBJS1) $(DEPLIBS1)
  278. X    $(RM) $@
  279. X    $(CC) -o $@ $(LDOPTIONS) $(OBJS1)  $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(LDLIBS)  -lm $(EXTRA_LOAD_FLAGS)
  280. X
  281. Xinstall:: xcal
  282. X    $(INSTALL) -c $(INSTPGMFLAGS)   xcal $(BINDIR)
  283. X
  284. Xinstall.man:: xcal.man
  285. X    $(INSTALL) -c $(INSTMANFLAGS) xcal.man $(MANDIR)/xcal.n
  286. X
  287. Xsaber_xcal:
  288. X    #load $(ALLDEFINES) $(SRCS1)  $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)  -lm
  289. X
  290. Xosaber_xcal:
  291. X    #load $(ALLDEFINES) $(OBJS1)  $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)  -lm
  292. X
  293. Xdepend::
  294. X    $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  295. X
  296. Xlint:
  297. X    $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
  298. Xlint1:
  299. X    $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  300. X
  301. Xclean::
  302. X    $(RM) $(PROGRAMS)
  303. X
  304. Xinstall:: XCal.ad
  305. X    $(INSTALL) -c $(INSTAPPFLAGS) XCal.ad $(XAPPLOADDIR)/XCal
  306. X
  307. Xinstall:: XCal.help
  308. X    $(INSTALL) -c $(INSTDATFLAGS) XCal.help  $(XAPPLOADDIR)/XCal.help
  309. X
  310. Xderived:    xcal_help.h xcal_ad.h
  311. X
  312. Xclean::
  313. X    $(RM) xcal_help.h xcal_ad.h
  314. X
  315. Xxcal_help.h:    XCal.help
  316. X    sh C_from_help.sh
  317. X
  318. Xxcal_ad.h:    XCal.ad
  319. X    sh C_from_ad.sh
  320. X
  321. XSUBD=xcalpr xcalev xcal_cal
  322. X
  323. Xall::
  324. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  325. X    for i in $(SUBD) ;\
  326. X    do \
  327. X    (cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \
  328. X    $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all); \
  329. X    done
  330. X
  331. Xclean::
  332. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  333. X    for i in $(SUBD) ;\
  334. X    do \
  335. X    (cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \
  336. X    $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \
  337. X    done
  338. X
  339. Xinstall::
  340. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  341. X    for i in $(SUBD) ;\
  342. X    do \
  343. X    (cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \
  344. X    $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \
  345. X    done
  346. X
  347. Xinstall.man::
  348. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  349. X    for i in $(SUBD) ;\
  350. X    do \
  351. X    (cd $$i ; echo "installing man pages" "in $(CURRENT_DIR)/$$i..."; \
  352. X    $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install.man); \
  353. X    done
  354. X
  355. Xdepend::
  356. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  357. X    for i in $(SUBD) ;\
  358. X    do \
  359. X    (cd $$i ; echo "depending" "in $(CURRENT_DIR)/$$i..."; \
  360. X    $(MAKE) $(MFLAGS)   depend); \
  361. X    done
  362. X
  363. XSUBDIRS = pscal
  364. X
  365. Xall::
  366. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  367. X    for i in $(SUBDIRS) ;\
  368. X    do \
  369. X    (cd $$i ; echo "making" all "in $(CURRENT_DIR)/$$i..."; \
  370. X    $(MAKE) $(MFLAGS) 'CDEBUGFLAGS=$(CDEBUGFLAGS)' all); \
  371. X    done
  372. X
  373. Xdepend::
  374. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  375. X    for i in $(SUBDIRS) ;\
  376. X    do \
  377. X    (cd $$i ; echo "depending" "in $(CURRENT_DIR)/$$i..."; \
  378. X    $(MAKE) $(MFLAGS)   depend); \
  379. X    done
  380. X
  381. X###########################################################################
  382. X# common rules for all Makefiles - do not edit
  383. X
  384. Xemptyrule::
  385. X
  386. Xclean::
  387. X    $(RM_CMD) \#*
  388. X
  389. XMakefile::
  390. X    -@if [ -f Makefile ]; then \
  391. X    echo "    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
  392. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  393. X    else exit 0; fi
  394. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  395. X
  396. Xtags::
  397. X    $(TAGS) -w *.[ch]
  398. X    $(TAGS) -xw *.[ch] > TAGS
  399. X
  400. Xsaber:
  401. X    #load $(ALLDEFINES) $(SRCS)
  402. X
  403. Xosaber:
  404. X    #load $(ALLDEFINES) $(OBJS)
  405. X
  406. X###########################################################################
  407. X# rules for building in SUBDIRS - do not edit
  408. X
  409. Xinstall::
  410. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  411. X    for i in $(SUBDIRS) ;\
  412. X    do \
  413. X    (cd $$i ; echo "installing" "in $(CURRENT_DIR)/$$i..."; \
  414. X    $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install); \
  415. X    done
  416. X
  417. Xinstall.man::
  418. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  419. X    for i in $(SUBDIRS) ;\
  420. X    do \
  421. X    (cd $$i ; echo "installing man pages" "in $(CURRENT_DIR)/$$i..."; \
  422. X    $(MAKE) $(MFLAGS) DESTDIR='$(DESTDIR)' install.man); \
  423. X    done
  424. X
  425. Xclean::
  426. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  427. X    for i in $(SUBDIRS) ;\
  428. X    do \
  429. X    (cd $$i ; echo "cleaning" "in $(CURRENT_DIR)/$$i..."; \
  430. X    $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean); \
  431. X    done
  432. X
  433. Xtags::
  434. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  435. X    for i in $(SUBDIRS) ;\
  436. X    do \
  437. X    (cd $$i ; echo "tagging" "in $(CURRENT_DIR)/$$i..."; \
  438. X    $(MAKE) $(MFLAGS) TAGS='$(TAGS)' tags); \
  439. X    done
  440. X
  441. XMakefiles::
  442. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  443. X    for i in $(SUBDIRS) ;\
  444. X    do \
  445. X    echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \
  446. X    case "$$i" in \
  447. X    ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \
  448. X    ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \
  449. X    ./?*/?*) newtop=../../ sub=subsub;; \
  450. X    ./?*) newtop=../ sub=sub;; \
  451. X    */?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \
  452. X    */?*/?*) newtop=../../../ sub=subsubsub;; \
  453. X    */?*) newtop=../../ sub=subsub;; \
  454. X    *) newtop=../ sub=sub;; \
  455. X    esac; \
  456. X    case "$(TOP)" in \
  457. X    /?*) newtop= upprefix= ;; \
  458. X    *) upprefix=../ ;; \
  459. X    esac; \
  460. X    $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \
  461. X    MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\
  462. X    done
  463. X
  464. XsubdirMakefiles:
  465. X    $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
  466. X    -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
  467. X    echo "    $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
  468. X    $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
  469. X    else exit 0; fi
  470. X    cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
  471. X    $(MAKE) $(MFLAGS) Makefiles
  472. X
  473. XsubsubdirMakefiles:
  474. X    $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
  475. X    -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
  476. X    echo "    $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
  477. X    $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
  478. X    else exit 0; fi
  479. X    cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
  480. X    $(MAKE) $(MFLAGS) Makefiles
  481. X
  482. XsubsubsubdirMakefiles:
  483. X    $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
  484. X    -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
  485. X    echo "    $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
  486. X    $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
  487. X    else exit 0; fi
  488. X    cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
  489. X    $(MAKE) $(MFLAGS) Makefiles
  490. X
  491. XsubsubsubsubdirMakefiles:
  492. X    $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak
  493. X    -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \
  494. X    echo "    $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \
  495. X    $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \
  496. X    else exit 0; fi
  497. X    cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \
  498. X    $(MAKE) $(MFLAGS) Makefiles
  499. X
  500. Xincludes::
  501. X    @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
  502. X    for i in $(SUBDIRS) ;\
  503. X    do \
  504. X    (cd $$i ; echo including "in $(CURRENT_DIR)/$$i..."; \
  505. X    $(MAKE) $(MFLAGS)   includes); \
  506. X    done
  507. X
  508. X###########################################################################
  509. X# dependencies generated by makedepend
  510. X
  511. END_OF_FILE
  512. if test 14214 -ne `wc -c <'Makefile.sunos'`; then
  513.     echo shar: \"'Makefile.sunos'\" unpacked with wrong size!
  514. fi
  515. # end of 'Makefile.sunos'
  516. fi
  517. if test -f 'pscal/pscal.script' -a "${1}" != "-c" ; then 
  518.   echo shar: Will not clobber existing file \"'pscal/pscal.script'\"
  519. else
  520. echo shar: Extracting \"'pscal/pscal.script'\" \(13265 characters\)
  521. sed "s/^X//" >'pscal/pscal.script' <<'END_OF_FILE'
  522. X#!/bin/sh
  523. X#+
  524. X#
  525. X# NAME:
  526. X#    pscal
  527. X#
  528. X# SYNOPSIS:
  529. X#    pscal [-Pprinter] [other printer flags] month year
  530. X#
  531. X# DESCRIPTION:
  532. X#    `Pscal' is a PostScript program to print calendars.
  533. X#
  534. X#    The file $HOME/.holiday is read and used to print short messages
  535. X#    on specified days.  The .holiday file should consist of lines of
  536. X#    the form 
  537. X#        month:day:message string
  538. X#    Messages should be 20 characters or less, with no more than 6
  539. X#    messages per day.  No spaces should appear from the beginning
  540. X#    of a line until after the second colon.
  541. X#    Month and day should be numbers in the obvious ranges.
  542. X#    12/89 - The holiday checking has been loosened up in that the
  543. X#    following takes place:
  544. X#        1. The Shell Variable EFILE is used preferentially
  545. X#        2. Then the file Events in the current directory is used
  546. X#        3. Finally the $HOME/.holiday file is used.
  547. X#    The whole process can be turned off by setting EFILE=/dev/null.
  548. X#
  549. X# OPTIONS:
  550. X#    Any argument whose first character is '-' is passed on to lpr.
  551. X#    The shell variables BANNER, LFOOT, CFOOT, and RFOOT become a
  552. X#    top centered banner, and left, centered, or right justified
  553. X#    footers respectively.  As in:
  554. X#
  555. X#        BANNER="Schedule 1" CFOOT=Preliminary pscal 4 90
  556. X#
  557. X# AUTHOR:
  558. X#    Patrick Wood
  559. X#    Copyright (C) 1987 by Pipeline Associates, Inc.
  560. X#    Permission is granted to modify and distribute this free of charge.
  561. X# 
  562. X# HISTORY:
  563. X#    @Original From: patwood@unirot.UUCP (Patrick Wood)
  564. X#    @Shell stuff added 3/9/87 by King Ables
  565. X#    @Made pretty by tjt 1988
  566. X#    @Holiday and printer flag passing hacks added Dec 1988 
  567. X#    @ by smann@june.cs.washington.edu 
  568. X#    @Used the better looking version with 5 rows of days rather than 6
  569. X#    @ hacked together with holiday and banner/footnotes added
  570. X#    @ by Joe (No Relation) Wood, 12/89, jlw@lzga.ATT.COM
  571. X#    @Fixed "-R" (didn't work at all; now it at least works on 8.5x11)
  572. X#    @Also fixed handling of unrecognized arguments
  573. X#    @ by Jeff Mogul, 1/90, mogul@decwrl.dec.com
  574. X#
  575. X# BUGS:
  576. X#    `Pscal' doesn't work for months before 1753 (weird stuff happened
  577. X#    in September, 1752).
  578. X#
  579. X#    A better format for the dates of holidays would be nice.
  580. X#    An escape to allow holiday messages to be raw PostScript would
  581. X#    also be nice.
  582. X#    The holiday messages should be handled more intelligently (ie,
  583. X#    the messages should be clipped to the day).
  584. X#
  585. X
  586. X# 
  587. X# PostScript program to print calendars.
  588. X# Doesn't deal well with September 1752 or before.
  589. X# 
  590. X
  591. XUSAGE="Usage: pscal [ -Rrt ] [ -F hfont ] [ -f font ] [-d directory] [ month [ year ] ]"
  592. X
  593. XTFONT=Times-Bold
  594. XDFONT=Helvetica-Bold
  595. XEFONT=Times-Roman
  596. X
  597. XCalendar=$HOME/Calendar
  598. X
  599. XROTATE=90
  600. XSCALE="1.0 1.0"
  601. X#    Was 50 -120 - changed to 71 -120 for A4 Use
  602. XTRANSLATE="71 -120"
  603. X
  604. XLPR="lpr"
  605. X
  606. Xwhile test $# != 0
  607. Xdo
  608. X    case $1 in
  609. X    -P) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; }
  610. X        eval ENVAR="$1$2"; shift; shift;;
  611. X    -P*) eval ENVAR=$1; shift;;
  612. X    -F) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; }
  613. X        TFONT="$2"; shift; shift;;
  614. X    -F*) TFONT=`echo $1 | sed -n 1s/-.//p`; shift;;
  615. X    -f) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; }
  616. X        DFONT="$2"; shift; shift;;
  617. X    -f*) DFONT=`echo $1 | sed -n 1s/-.//p`; shift;;
  618. X    -t) LPR=cat; shift;;
  619. X    -r) ROTATE=90; shift;;
  620. X    -R) ROTATE=0; SCALE="0.75 0.75"; TRANSLATE="50 900"; shift;;
  621. X    -d) test $# -lt 2 && { echo "$USAGE" 1>&2; exit 1; }
  622. X        Calendar="$2"; shift; shift;;
  623. X    --|-) break;;
  624. X    -*) eval ENVAR=\"$ENVAR $1\"; shift;;
  625. X    *) break
  626. X    esac
  627. Xdone
  628. X
  629. Xtest $# -gt 2 && { echo "$USAGE" 1>&2; exit 1; }
  630. X
  631. Xcase $# in
  632. X    0)    set `date`; YEAR=$6; MONTH=$2;;
  633. X    1)    MONTH=$1; set `date`; YEAR=$6;;
  634. X    2)    MONTH=$1 YEAR=$2;;
  635. Xesac
  636. X
  637. XMONTH=`case $MONTH in Jan|jan) echo 1;;Feb|feb) echo 2;;Mar|mar) echo 3;;Apr|apr) echo 4;;
  638. X    May|may) echo 5;;Jun|jun) echo 6;;Jul|jul) echo 7;;Aug|aug) echo 8;;
  639. X    Sep|sep) echo 9;;Oct|oct) echo 10;;Nov|nov) echo 11;;Dec|dec) echo 12;;
  640. X    1|2|3|4|5|6|7|8|9|10|11|12) echo $MONTH;;esac`
  641. X
  642. XMONTHNAME=`sed -n ${MONTH}p <<END-monthlist
  643. XJan
  644. XFeb
  645. XMar
  646. XApr
  647. XMay
  648. XJun
  649. XJul
  650. XAug
  651. XSep
  652. XOct
  653. XNov
  654. XDec
  655. XEND-monthlist`
  656. X
  657. Xtest $YEAR -lt 100 && YEAR=`expr $YEAR + 1900`
  658. X
  659. Xif [ -n "$EFILE" -a -r "$EFILE" ]
  660. Xthen
  661. X    Files=$EFILE
  662. X    monthday=yes
  663. Xelif [ -r Events ]
  664. Xthen
  665. X    Files=Events
  666. X    monthday=yes
  667. Xelif [ -r $HOME/.holiday ]
  668. Xthen
  669. X    Files=$HOME/.holiday
  670. X    monthday=yes
  671. Xelif [ -d $Calendar ]
  672. Xthen
  673. X    cd $Calendar
  674. X    if [ -d xy$YEAR ]
  675. X    then
  676. X        cd xy$YEAR
  677. X    fi
  678. X    list=`echo xc*$MONTHNAME$YEAR`
  679. X    case "$list" in
  680. X    xc\*$MONTHNAME$YEAR)
  681. X            ;;
  682. X    *)
  683. X        for file in $list
  684. X        do
  685. X            day=`expr $file : 'xc\([0-9]*\)'`
  686. X            (cat $file;echo) | sed '/^$/d
  687. X                    s/^/./' | fmt -25 |
  688. X                     sed -n "7q
  689. X                    s/^\.//
  690. X                    s/^/$day ( /
  691. X                    s/\$/ )/
  692. X                    p"
  693. X        done > /tmp/pscal$$
  694. X        holidays=`cat /tmp/pscal$$`
  695. X        rm -f /tmp/pscal$$    
  696. X    esac
  697. Xfi
  698. X
  699. Xcase "$monthday" in
  700. Xyes)
  701. X    holidays=`cat $Files | grep \^$MONTH: | awk -F: '{printf("%s ( %s",$2,$3);\
  702. X        for(i = 4; i <= NF; i++) printf(":%s", $i);printf(")\n"); }'`
  703. Xesac
  704. X
  705. X$LPR $ENVAR <<END-OF-CALENDAR
  706. X%!
  707. X% PostScript program to draw calendar
  708. X% Copyright (C) 1987 by Pipeline Associates, Inc.
  709. X% Permission is granted to modify and distribute this free of charge.
  710. X
  711. X% The number after /month should be set to a number from 1 to 12.
  712. X% The number after /year should be set to the year you want.
  713. X% You can change the title and date fonts, if you want.
  714. X% We figure out the rest.
  715. X% This program won't produce valid calendars before 1800 due to the switch
  716. X% from Julian to Gregorian calendars in September of 1752 wherever English
  717. X% was spoken.
  718. X
  719. X/month $MONTH def
  720. X/year $YEAR def
  721. X/titlefont /$TFONT def
  722. X/dayfont /$DFONT def
  723. X/eventfont /$EFONT def
  724. X/holidays [ $holidays ] def
  725. X/Bannerstring ($BANNER) def
  726. X/Lfootstring ($LFOOT) def
  727. X/Rfootstring ($RFOOT) def
  728. X/Cfootstring ($CFOOT) def
  729. X
  730. X% calendar names - change these if you don't speak english
  731. X% "August", "April" and "February" could stand to be kerned even if you do
  732. X
  733. X/month_names
  734. X[ (January) (February) (March) (April) (May) (June) (July)
  735. X(August) (September) (October) (November) (December) ]
  736. Xdef
  737. X
  738. X/day_names
  739. X[ (Sunday) (Monday) (Tuesday) (Wednesday) (Thursday) (Friday) (Saturday) ]
  740. Xdef
  741. X
  742. X% layout parameters - you can change these, but things may not look nice
  743. X
  744. X/daywidth 100 def
  745. X/dayheight 95 def
  746. X
  747. X/titlefontsize 48 def
  748. X/weekdayfontsize 10 def
  749. X/datefontsize 30 def
  750. X/footfontsize 20 def
  751. X
  752. X/topgridmarg 35 def
  753. X/leftmarg 35 def
  754. X/daytopmarg 10 def
  755. X/dayleftmarg 5 def
  756. X
  757. X% layout constants - don't change these, things probably won't work
  758. X
  759. X/rows 5 def
  760. X/subrows 6 def
  761. X
  762. X% calendar constants - change these if you want a French revolutionary calendar
  763. X
  764. X/days_week 7 def
  765. X
  766. X/days_month [ 31 28 31 30 31 30 31 31 30 31 30 31 ] def
  767. X
  768. X/isleap {                % is this a leap year?
  769. X    year 4 mod 0 eq            % multiple of 4
  770. X    year 100 mod 0 ne         % not century
  771. X    year 1000 mod 0 eq or and    % unless it's a millenia
  772. X} def
  773. X
  774. X/ndays {                % number of days in this month
  775. X    days_month month 1 sub get
  776. X    month 2 eq            % February
  777. X    isleap and
  778. X    {
  779. X        1 add
  780. X    } if
  781. X} def
  782. X
  783. X/weekday {                % weekday (range 0-6) for integer date
  784. X    days_week mod
  785. X} def
  786. X
  787. X/startday {                % starting day-of-week for this month
  788. X    /off year 2000 sub def        % offset from start of "epoch"
  789. X    off
  790. X    off 4 idiv add            % number of leap years
  791. X    off 100 idiv sub        % number of centuries
  792. X    off 1000 idiv add        % number of millenia
  793. X    6 add weekday days_week add     % offset from Jan 1 2000
  794. X    /off exch def
  795. X    1 1 month 1 sub {
  796. X        /idx exch def
  797. X        days_month idx 1 sub get
  798. X        idx 2 eq
  799. X        isleap and
  800. X        {
  801. X            1 add
  802. X        } if
  803. X        /off exch off add def
  804. X    } for
  805. X    off weekday            % 0--Sunday, 1--monday, etc.
  806. X} def
  807. X
  808. X/prtevent {        % event-string day prtevent
  809. X            %  print out an event
  810. X    /start startday def
  811. X    /day 2 1 roll def
  812. X    day start add 1 sub 7 mod daywidth mul
  813. X    day start add 1 sub 7 div truncate dayheight neg mul 
  814. X    -5 
  815. X    numevents day start add get -10 mul add
  816. X    numevents
  817. X    day start add 
  818. X    numevents day start add get 1 add
  819. X    put
  820. X    add moveto
  821. X    show
  822. X} def
  823. X
  824. X/drawevents {        % read in a file full of events; print
  825. X            %  the events for this month
  826. X    /numevents
  827. X    [0 0 0 0 0 0 0
  828. X     0 0 0 0 0 0 0
  829. X     0 0 0 0 0 0 0
  830. X     0 0 0 0 0 0 0
  831. X     0 0 0 0 0 0 0
  832. X     0 0 0 0 0 0 0] def 
  833. X     eventfont findfont 9 scalefont setfont
  834. X     0 2 holidays length 2 sub {
  835. X        dup
  836. X        1 add holidays 2 1 roll get
  837. X        2 1 roll holidays 2 1 roll get
  838. X        prtevent
  839. X    } for
  840. X        
  841. X} def
  842. X
  843. X% ------------------------------------------------------------------------
  844. X
  845. X/prtnum { 3 string cvs show } def
  846. X
  847. X/center {                % center string in given width
  848. X    /width exch def
  849. X    /str exch def width str 
  850. X    stringwidth pop sub 2 div 0 rmoveto str show
  851. X} def
  852. X
  853. X/centernum { exch 3 string cvs exch center } def
  854. X
  855. X/drawgrid {                % draw calendar boxes
  856. X    titlefont findfont weekdayfontsize scalefont setfont
  857. X    currentpoint /y0 exch def /x0 exch def
  858. X    0 1 days_week 1 sub {
  859. X        submonth 0 eq
  860. X        {
  861. X            x0 y0 moveto
  862. X            dup dup daywidth mul 40 rmoveto
  863. X            day_names exch get
  864. X            daywidth center
  865. X        } if
  866. X        x0 y0 moveto
  867. X        daywidth mul topgridmarg rmoveto
  868. X        1.0 setlinewidth
  869. X        submonth 0 eq
  870. X        {
  871. X            /rowsused rows 1 sub def
  872. X        }
  873. X        {
  874. X            /rowsused rows def
  875. X        }
  876. X        ifelse
  877. X        0 1 rowsused {
  878. X            gsave
  879. X            daywidth 0 rlineto 
  880. X            0 dayheight neg rlineto
  881. X            daywidth neg 0 rlineto
  882. X            closepath stroke
  883. X            grestore
  884. X            0 dayheight neg rmoveto
  885. X        } for
  886. X    } for
  887. X} def
  888. X
  889. X/drawnums {                % place day numbers on calendar
  890. X    dayfont findfont datefontsize
  891. X    submonth 0 ne
  892. X    {
  893. X        2.5 mul
  894. X    } if scalefont setfont
  895. X    /start startday def
  896. X    /days ndays def
  897. X    start daywidth mul dayleftmarg add daytopmarg rmoveto
  898. X    submonth 0 ne
  899. X    {
  900. X        dayleftmarg neg dayheight -2 div rmoveto
  901. X    } if
  902. X    1 1 days {
  903. X        /day exch def
  904. X        gsave
  905. X        day start add weekday 0 eq
  906. X        {
  907. X            submonth 0 eq
  908. X            {
  909. X                .7 setgray
  910. X            } if
  911. X        } if
  912. X        day start add weekday 1 eq
  913. X        {
  914. X            submonth 0 eq
  915. X            {
  916. X                .7 setgray
  917. X            } if
  918. X        } if
  919. X        submonth 0 eq
  920. X        {
  921. X            isdouble
  922. X            {
  923. X                day prtdouble
  924. X            }
  925. X            {
  926. X                day prtnum
  927. X            } ifelse
  928. X        }
  929. X        {
  930. X            day daywidth centernum
  931. X        } ifelse
  932. X        grestore
  933. X        day start add weekday 0 eq
  934. X        {
  935. X            currentpoint exch pop dayheight sub 0 exch moveto
  936. X            submonth 0 eq
  937. X            {
  938. X                dayleftmarg 0 rmoveto
  939. X            } if
  940. X        }
  941. X        {
  942. X            daywidth 0 rmoveto
  943. X        } ifelse
  944. X    } for
  945. X} def
  946. X/isdouble {                % overlay today with next/last week?
  947. X    days start add rows days_week mul gt
  948. X    {
  949. X        day start add rows days_week mul gt
  950. X        {
  951. X            true true
  952. X        }
  953. X        {
  954. X            day start add rows 1 sub days_week mul gt
  955. X            day days_week add days le and
  956. X            {
  957. X                false true
  958. X            }
  959. X            {
  960. X                false
  961. X            } ifelse
  962. X        } ifelse
  963. X    }
  964. X    {
  965. X        false
  966. X    } ifelse
  967. X} def
  968. X
  969. X/prtdouble {
  970. X    gsave
  971. X      dayfont findfont datefontsize 2 mul 3 div scalefont setfont
  972. X      exch
  973. X      {
  974. X        (23/) stringwidth pop dayheight rmoveto
  975. X        prtnum
  976. X      }
  977. X      {
  978. X        0 datefontsize 5 div rmoveto
  979. X        prtnum
  980. X        0 datefontsize -5 div rmoveto
  981. X        gsave
  982. X          dayfont findfont datefontsize scalefont setfont
  983. X          (/) show
  984. X        grestore
  985. X      } ifelse
  986. X    grestore
  987. X} def
  988. X
  989. X/drawfill {                % place fill squares on calendar
  990. X    /start startday def
  991. X    /days ndays def
  992. X    currentpoint /y0 exch def /x0 exch def
  993. X    submonth 0 eq
  994. X    {
  995. X        usefirst
  996. X        {
  997. X            /fillstart 2 def
  998. X        }
  999. X        {
  1000. X            /fillstart 0 def
  1001. X        }
  1002. X        ifelse
  1003. X    }
  1004. X    {
  1005. X        /fillstart 0 def
  1006. X    }
  1007. X    ifelse
  1008. X    fillstart daywidth mul topgridmarg rmoveto
  1009. X    1.0 setlinewidth
  1010. X    fillstart 1 start 1 sub {
  1011. X        gsave
  1012. X        .9 setgray
  1013. X        daywidth 0 rlineto 
  1014. X        0 dayheight neg rlineto
  1015. X        daywidth neg 0 rlineto
  1016. X        closepath fill
  1017. X        grestore
  1018. X        daywidth 0 rmoveto
  1019. X    } for
  1020. X    x0 y0 moveto
  1021. X    submonth 0 ne
  1022. X    {
  1023. X        /lastday rows 1 add days_week mul def
  1024. X        days_week 1 sub daywidth mul -440 rmoveto
  1025. X    }
  1026. X    {
  1027. X        /lastday rows days_week mul 2 sub fillstart add def
  1028. X        days_week 3 sub fillstart add daywidth mul
  1029. X        -440 dayheight add rmoveto
  1030. X    } ifelse
  1031. X    lastday -1 ndays start 1 add add
  1032. X    {
  1033. X        /day exch def
  1034. X        gsave
  1035. X        .9 setgray
  1036. X        daywidth 0 rlineto 
  1037. X        0 dayheight neg rlineto
  1038. X        daywidth neg 0 rlineto
  1039. X        closepath fill
  1040. X        grestore
  1041. X        day weekday 1 eq
  1042. X        {
  1043. X            x0 y0 moveto
  1044. X            days_week 1 sub daywidth mul -440 dayheight add rmoveto
  1045. X        }
  1046. X        {
  1047. X            daywidth neg 0 rmoveto
  1048. X        } ifelse
  1049. X    } for
  1050. X} def
  1051. X
  1052. X/usefirst {                % are last two boxes used by days?
  1053. X    start ndays add rows days_week mul 3 sub gt
  1054. X    start 2 ge and
  1055. X    
  1056. X} def
  1057. X
  1058. X/calendar
  1059. X{
  1060. X    titlefont findfont titlefontsize scalefont setfont
  1061. X    0 60 moveto
  1062. X    /month_name month_names month 1 sub get def
  1063. X    month_name show
  1064. X    /yearstring year 10 string cvs def
  1065. X    daywidth days_week mul yearstring stringwidth pop sub 60 moveto
  1066. X    yearstring show
  1067. X
  1068. X    eventflag {
  1069. X        % Show a centered Banner if any at the Top
  1070. X        daywidth days_week mul 2 div
  1071. X        Bannerstring stringwidth pop 2 div sub
  1072. X        60 moveto
  1073. X        Bannerstring show
  1074. X        % Show footnotes left-center-right
  1075. X        eventfont findfont footfontsize scalefont setfont
  1076. X        /bottomrow { dayheight rows mul 5 sub neg } def
  1077. X        0 bottomrow moveto
  1078. X        Lfootstring show
  1079. X        daywidth days_week mul Rfootstring stringwidth pop sub
  1080. X        bottomrow moveto
  1081. X        Rfootstring show
  1082. X        daywidth days_week mul Cfootstring stringwidth pop sub 2 div
  1083. X        bottomrow moveto
  1084. X        Cfootstring show
  1085. X        
  1086. X    } if
  1087. X
  1088. X    0 -5 moveto
  1089. X    drawnums
  1090. X
  1091. X    0 -5 moveto
  1092. X    drawfill
  1093. X
  1094. X    eventflag {
  1095. X        0 0 moveto
  1096. X        drawevents
  1097. X    } if
  1098. X
  1099. X    0 -5 moveto
  1100. X    drawgrid
  1101. X} def
  1102. X
  1103. X/eventflag true def
  1104. X
  1105. X$SCALE scale
  1106. X$ROTATE rotate
  1107. X$TRANSLATE translate
  1108. X/submonth 0 def
  1109. Xcalendar
  1110. X/eventflag false def
  1111. Xmonth 1 sub 0 eq
  1112. X{
  1113. X    /lmonth 12 def
  1114. X    /lyear year 1 sub def
  1115. X}
  1116. X{
  1117. X    /lmonth month 1 sub def
  1118. X    /lyear year def
  1119. X} ifelse
  1120. Xmonth 1 add 13 eq
  1121. X{
  1122. X    /nmonth 1 def
  1123. X    /nyear year 1 add def
  1124. X} 
  1125. X{
  1126. X    /nmonth month 1 add def
  1127. X    /nyear year def
  1128. X} ifelse
  1129. Xusefirst
  1130. X{
  1131. X    0 30 translate
  1132. X}
  1133. X{
  1134. X    days_week 2 sub daywidth mul -350 translate
  1135. X}
  1136. Xifelse
  1137. X/submonth 1 def
  1138. X/year lyear def
  1139. X/month lmonth def
  1140. Xgsave
  1141. X.138 .138 scale
  1142. X12 -120 translate
  1143. Xcalendar
  1144. Xgrestore
  1145. X/submonth 1 def
  1146. X/year nyear def
  1147. X/month nmonth def
  1148. Xdaywidth 0 translate
  1149. Xgsave
  1150. X.138 .138 scale
  1151. X12 -120 translate
  1152. Xcalendar
  1153. Xgrestore
  1154. X
  1155. Xshowpage
  1156. X
  1157. XEND-OF-CALENDAR
  1158. X
  1159. END_OF_FILE
  1160. if test 13265 -ne `wc -c <'pscal/pscal.script'`; then
  1161.     echo shar: \"'pscal/pscal.script'\" unpacked with wrong size!
  1162. fi
  1163. # end of 'pscal/pscal.script'
  1164. fi
  1165. if test -f 'xcalev/xcalev.c' -a "${1}" != "-c" ; then 
  1166.   echo shar: Will not clobber existing file \"'xcalev/xcalev.c'\"
  1167. else
  1168. echo shar: Extracting \"'xcalev/xcalev.c'\" \(12776 characters\)
  1169. sed "s/^X//" >'xcalev/xcalev.c' <<'END_OF_FILE'
  1170. X#ifndef lint
  1171. Xstatic char    *sccsid = "@(#)xcalev.c    1.15 (Hillside Systems) 11/15/93";
  1172. Xstatic char    *copyright = "@(#)Copyright 1993 Peter Collinson, Hillside Systems";
  1173. X#endif                          /* lint */
  1174. X#include "version.h"
  1175. X/***
  1176. X* program name:
  1177. X        xcalev.c
  1178. X* function:
  1179. X    Load's xcal data files from a `calendar' like data file
  1180. X    called regular stored in the standard Calendar directory
  1181. X* switches:
  1182. X    -v    print version and exit
  1183. X    -f    name of regular file
  1184. X    -d dir    Use "dir" instead of Calendar
  1185. X    -x    be compatible with the X calendar program
  1186. X        (ie flat structure in the Calendar directory)
  1187. X    -r    remove entries from the files
  1188. X    followed by an optional year
  1189. X
  1190. X* libraries used:
  1191. X        standard
  1192. X* compile time parameters:
  1193. X        standard
  1194. X* history:
  1195. X        Written October 1993
  1196. X        Peter Collinson
  1197. X        Hillside Systems
  1198. X* (C) Copyright: 1993 Hillside Systems/Peter Collinson
  1199. X        Permission to use, copy, modify, and distribute this software
  1200. X        and its documentation for any purpose is hereby granted to
  1201. X        anyone, provided that the above copyright notice appear
  1202. X        in all copies and that both that copyright notice and this
  1203. X        permission notice appear in supporting documentation, and that
  1204. X        the name of Peter Collinson not be used in advertising or
  1205. X        publicity pertaining to distribution of the software without
  1206. X        specific, written prior permission.  Hillside Systems makes no
  1207. X        representations about the suitability of this software for any
  1208. X        purpose.  It is provided "as is" without express or implied
  1209. X        warranty.
  1210. X        Peter Collinson DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
  1211. X        SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1212. X        AND FITNESS, IN NO EVENT SHALL Peter Collinson BE LIABLE FOR
  1213. X        ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  1214. X        WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1215. X        WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  1216. X        ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1217. X        PERFORMANCE OF THIS SOFTWARE.
  1218. X***/
  1219. X#include <stdio.h>
  1220. X#include <ctype.h>
  1221. X#include <string.h>
  1222. X#include <time.h>
  1223. X#include <pwd.h>
  1224. X#include <unistd.h>
  1225. X#if defined(NeXT)
  1226. X#include <sys/fcntl.h>
  1227. X#endif
  1228. X#include <sys/stat.h>
  1229. X
  1230. Xstatic char    *progname = "xcalev";    /* name of program */
  1231. Xstatic char    *regular = "regular";    /* name of regular file */
  1232. Xstatic char    *calendar = "Calendar";    /* name of calendar directory */
  1233. Xstatic int    compat;            /* if non-zero use calendar compatible files */
  1234. Xstatic int    expunge;        /* remove entries rather than add them */
  1235. X
  1236. Xstatic char    *calfmt;        /* printf format of a calendar file */
  1237. Xstatic char    *caldir;        /* name of a calendar directory */
  1238. X
  1239. Xstatic char    *months[]    = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
  1240. X                   "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
  1241. X
  1242. Xstatic int days_in_months[] = { 
  1243. X    31, 29, 31, 30,
  1244. X    31, 30, 31, 31,
  1245. X    30, 31, 30, 31,
  1246. X};
  1247. X
  1248. Xstatic int    year;            /* year to do the work for */
  1249. X
  1250. X/*
  1251. X * various strings
  1252. X */
  1253. Xstatic char    *memerr = "No more memory\n";
  1254. Xstatic char    *usage = "Usage: xcalev [-f srcfile] [-d dir][-x][-r] [year]\n";
  1255. X
  1256. Xchar    *malloc();
  1257. X
  1258. X/*
  1259. X *    routines
  1260. X */
  1261. Xstatic void filenames();
  1262. Xstatic void lineprocess();
  1263. Xstatic int monthmatch();
  1264. Xstatic void fileupdate();
  1265. Xstatic char *connect_file();
  1266. Xstatic void disconnect_file();
  1267. Xstatic char *delstr();
  1268. Xstatic void rewrite_file();
  1269. Xstatic char *Strdup();
  1270. Xstatic void fatal();
  1271. Xstatic void error();
  1272. Xstatic char *readbfile();
  1273. X
  1274. Xmain(argc, argv)
  1275. X    int    argc;
  1276. X    char    *argv[];
  1277. X{
  1278. X    register int    c;
  1279. X    extern char     *optarg;
  1280. X    extern int    optind;
  1281. X    FILE        *fin;
  1282. X    char        line[BUFSIZ];
  1283. X
  1284. X    while ((c = getopt(argc, argv, "d:f:crv")) != EOF) {
  1285. X
  1286. X        switch (c) {
  1287. X        case 'd':
  1288. X            calendar = optarg;
  1289. X            break;
  1290. X        case 'f':
  1291. X            regular = optarg;
  1292. X            break;
  1293. X        case 'x':
  1294. X            compat = 1;
  1295. X            break;
  1296. X        case 'r':
  1297. X            expunge = 1;
  1298. X            break;
  1299. X        case 'v':
  1300. X            fprintf(stderr, "%s\n", version);
  1301. X            exit(0);
  1302. X        default:
  1303. X            fatal(usage);
  1304. X        }
  1305. X    }
  1306. X    if (optind < argc) {
  1307. X        year = atoi(argv[optind]);
  1308. X        if (year < 1993 && year > 2100)
  1309. X            fatal("Year %s should be > 1993\n", argv[optind]);
  1310. X    }
  1311. X
  1312. X    filenames();
  1313. X
  1314. X    /*
  1315. X     * open the regular file
  1316. X     */
  1317. X    if ((fin = fopen(regular, "r")) == NULL) {
  1318. X        fatal("Cannot open: %s\n", regular);
  1319. X    }
  1320. X    while (fgets(line, sizeof line, fin) != NULL) {
  1321. X        lineprocess(line);
  1322. X    }
  1323. X    fclose(fin);
  1324. X    exit(0);
  1325. X}    
  1326. X
  1327. X
  1328. X/*
  1329. X * organise filenames
  1330. X */
  1331. Xstatic void
  1332. Xfilenames()
  1333. X{
  1334. X    struct    passwd    *pw;
  1335. X    char        buf[256];
  1336. X    time_t        ti;
  1337. X    struct    tm    *tm;
  1338. X
  1339. X    pw = getpwuid(getuid());
  1340. X    if (pw == NULL)
  1341. X        fatal("Cannot get password information\n");
  1342. X    /*
  1343. X     * get filename of Calendar directory
  1344. X     */
  1345. X    if (*calendar != '.' && *calendar != '/') {
  1346. X        /* need to prepend the home directory */
  1347. X        (void) sprintf(buf, "%s/%s", pw->pw_dir, calendar);
  1348. X        calendar = Strdup(buf);
  1349. X    }
  1350. X    /*
  1351. X     * and the source file
  1352. X     */
  1353. X    if (*regular != '.' && *regular != '/') {
  1354. X        (void) sprintf(buf, "%s/%s", calendar, regular);
  1355. X        regular = Strdup(buf);
  1356. X    }
  1357. X    /*
  1358. X     * get the year sorted
  1359. X     */
  1360. X    if (year == 0) {
  1361. X        time(&ti);
  1362. X        tm = localtime(&ti);
  1363. X        year = tm->tm_year + 1900;
  1364. X    }
  1365. X    /*
  1366. X     * xcalendar files are all
  1367. X     * xc<d><Mon><Year>
  1368. X     * or
  1369. X     * xc<dd><Mon><Year>
  1370. X     *
  1371. X     * where d or dd is the day (%02d would have been better)
  1372. X     * <Mon> is a capitalised first three letters of the
  1373. X     *         English month name. If you need compatibility
  1374. X     *         don't redefine the short names in the resources
  1375. X     *         for this program.
  1376. X     * <Year> is the full numeric year.
  1377. X     *
  1378. X     * We will follow this BUT we will also make this program
  1379. X     * create subdirectories for new years
  1380. X     *         xy<Year>
  1381. X     * to speed up file access
  1382. X     */
  1383. X    if (compat) 
  1384. X        (void) sprintf(buf, "%s/xc%%d%%s%d", calendar, year);
  1385. X    else    (void) sprintf(buf, "%s/xy%d/xc%%d%%s%d", calendar, year, year);
  1386. X    calfmt = Strdup(buf);
  1387. X    if (compat)
  1388. X        caldir = calendar;
  1389. X    else {
  1390. X        (void) sprintf(buf, "%s/xy%d", calendar, year);
  1391. X        caldir = Strdup(buf);
  1392. X    }
  1393. X
  1394. X    /*
  1395. X     * See if we have a calendar directory
  1396. X     */
  1397. X    if (access(calendar, F_OK) < 0) {
  1398. X        printf("%s does not exist, creating it\n", calendar);
  1399. X        if (mkdir(calendar, 0755) < 0) {
  1400. X            perror("mkdir");
  1401. X            fatal("Cannot create: %s\n", calendar);
  1402. X        }
  1403. X    }
  1404. X    /*
  1405. X     * and an annual one
  1406. X     */
  1407. X    if (access(caldir, F_OK) < 0) {
  1408. X        printf("%s does not exist, creating it\n", caldir);
  1409. X        if (mkdir(caldir, 0755) < 0) {
  1410. X            perror("mkdir");
  1411. X            fatal("Cannot create: %s\n", caldir);
  1412. X        }
  1413. X    }        
  1414. X}
  1415. X
  1416. X/*
  1417. X *    Process a single line from the regular file
  1418. X *    format is
  1419. X *    Month day text
  1420. X *    or
  1421. X *    day Month text
  1422. X *    Month is always a text string
  1423. X *    day can be a range with no spaces
  1424. X *    eg    5-11
  1425. X *    Lines starting with # are ignored
  1426. X */
  1427. Xstatic void
  1428. Xlineprocess(line)
  1429. X    char    *line;
  1430. X{
  1431. X    char     *p1, *p2, *rest;
  1432. X    char    *ds;
  1433. X    char    *ms;
  1434. X    int    day, dayend, i, mon;
  1435. X    static int lineno;
  1436. X
  1437. X    lineno++;
  1438. X    /* comment */
  1439. X    if (*line == '#')
  1440. X        return;
  1441. X    
  1442. X    /* parse line into three sections */
  1443. X    p1 = strtok(line, " \t");
  1444. X    if (p1 == NULL) {
  1445. X        error("Cannot find month or day on line %d of %s\n", lineno,
  1446. X            regular);
  1447. X        return;
  1448. X    }
  1449. X    p2 = strtok(NULL, " \t");
  1450. X    if (p2 == NULL) {
  1451. X        error("Cannot find month or day on line %d of %s\n",
  1452. X              lineno, regular);
  1453. X        return;
  1454. X    }
  1455. X    rest = strtok(NULL, "\n");
  1456. X    if (rest == NULL) {
  1457. X        error("No associated text with date on line %d of %s\n", 
  1458. X              lineno, regular);
  1459. X        return;
  1460. X    }
  1461. X    /* is p1 or p2 the day? */
  1462. X    if (isdigit(*p1)) {
  1463. X        ds = p1;
  1464. X        ms = p2;
  1465. X    } else {
  1466. X        ds = p2;
  1467. X        ms = p1;
  1468. X    }
  1469. X    /* see if we have a range */
  1470. X    p1 = strchr(ds, '-');
  1471. X    if (p1) {
  1472. X        *p1++ = '\0';
  1473. X        day = atoi(ds);
  1474. X        dayend = atoi(p1);
  1475. X        if (dayend < day) {
  1476. X            error("Illegal day range: %d should be <= than %d\n", day, dayend);
  1477. X            return;
  1478. X        }    
  1479. X    } else {
  1480. X        day = dayend = atoi(ds);
  1481. X    }
  1482. X    mon = monthmatch(ms);
  1483. X    if (mon == -1) {
  1484. X        if (isdigit(*ms))
  1485. X            error("Months must be given as names, line %d of %s\n",
  1486. X                lineno, regular);
  1487. X        else
  1488. X            error("Cannot recognise %s as a month name, line %d of %s\n",
  1489. X                ms, lineno, regular);
  1490. X        return;
  1491. X    }
  1492. X    if (day < 1 || day > days_in_months[mon]) {
  1493. X        error("%s does not have a day numbered %d, line %d of %s\n",
  1494. X            months[mon], day, lineno, regular);
  1495. X        return;
  1496. X    }
  1497. X    if (dayend < 1 || dayend > days_in_months[mon]) {
  1498. X        error("%s does not have a day numbered %d, line %d of %s\n",
  1499. X            months[mon], dayend, lineno, regular);
  1500. X        return;
  1501. X    }
  1502. X
  1503. X    /* lose leading space before the text */
  1504. X    while (isspace(*rest))
  1505. X        rest++;
  1506. X    if (*rest == '\0')
  1507. X        return;
  1508. X    for (i = day; i <= dayend; i++)
  1509. X        fileupdate(i, mon, rest);
  1510. X}
  1511. X
  1512. X/*
  1513. X * Attempt to recognise a month string
  1514. X * return a month (0-11) if OK
  1515. X * else -1
  1516. X */
  1517. Xstatic int
  1518. Xmonthmatch(str)
  1519. X    char    *str;
  1520. X{
  1521. X    register int i;
  1522. X    
  1523. X    for (i = 0; i < 12; i++) {
  1524. X        if (strncasecmp(str, months[i], 3) == 0)
  1525. X            return i;
  1526. X    }
  1527. X    return -1;
  1528. X}
  1529. X
  1530. X/*
  1531. X * update a file from the data
  1532. X */
  1533. Xstatic void
  1534. Xfileupdate(day, mon, txt)
  1535. X    int    day;
  1536. X    int    mon;
  1537. X    char    *txt;
  1538. X{
  1539. X    char    filename[256];
  1540. X    char    *contents;
  1541. X    char    *substr;
  1542. X    int    flen;
  1543. X    int    addnl = 0;
  1544. X    FILE    *newf;
  1545. X
  1546. X    (void) sprintf(filename, calfmt, day, months[mon]);
  1547. X
  1548. X    if (access(filename, F_OK) == 0) {
  1549. X        /* file exists */
  1550. X        /* connect in memory and look for the text string */
  1551. X        contents = connect_file(filename, &flen);
  1552. X        if (flen) {
  1553. X            substr = strstr(contents, txt);
  1554. X            if (substr) {
  1555. X                /* message already exists */
  1556. X                if (expunge) {
  1557. X                    /* 
  1558. X                     * we need to delete the string and
  1559. X                     * rewrite the file
  1560. X                     */
  1561. X                    contents = delstr(contents, flen, txt, substr);
  1562. X                    rewrite_file(filename, contents);
  1563. X                    /* all done - exit */
  1564. X                } 
  1565. X                /* adding to file */
  1566. X                /* but already there - so exit */
  1567. X                disconnect_file(contents, flen);
  1568. X                return;
  1569. X            }
  1570. X            /* add the string at the end of the file */
  1571. X            /* check if we need to add a leading newline */
  1572. X            if (contents[flen-1] != '\n')
  1573. X                addnl = 1;
  1574. X            disconnect_file(contents, flen);
  1575. X        }
  1576. X    }
  1577. X    if (expunge)
  1578. X        return;
  1579. X    newf = fopen(filename, "a");
  1580. X    if (newf == NULL) {
  1581. X        error("Cannot open %s for appending\n", filename);
  1582. X        return;
  1583. X    }
  1584. X    if (addnl)
  1585. X        putc('\n', newf);
  1586. X    fputs(txt, newf);
  1587. X    fclose(newf);
  1588. X}
  1589. X    
  1590. Xstatic char *
  1591. Xconnect_file(filename, bytes)
  1592. X        char    *filename;
  1593. X        int     *bytes;
  1594. X{
  1595. X        int     fd;
  1596. X        struct  stat statb;
  1597. X        char    *fibase;
  1598. X        if ((fd = open(filename, 0)) < 0) {
  1599. X                error("Cannot open calendar file: %s\n", filename);
  1600. X        return NULL;
  1601. X    }
  1602. X        if (fstat(fd, &statb) < 0)
  1603. X                fatal("Cannot fstat %s (shouldn't happen)\n", filename);
  1604. X        if (statb.st_size == 0) {
  1605. X        *bytes = 0;
  1606. X        return;
  1607. X    }
  1608. X    fibase = readbfile(fd, statb.st_size);
  1609. X
  1610. X        if ((int)fibase == -1)
  1611. X                fatal("Cannot read %s into memory\n", filename);
  1612. X        close(fd);      /* we have it now */
  1613. X
  1614. X    fibase[statb.st_size] = '\0';    /* add a terminating NULL */
  1615. X        *bytes = statb.st_size;
  1616. X        return(fibase);
  1617. X}
  1618. X
  1619. Xstatic void
  1620. Xdisconnect_file(base, len)
  1621. X    char    *base;
  1622. X    int    len;
  1623. X{
  1624. X    free(base);
  1625. X}
  1626. X
  1627. X/*
  1628. X * delete a text string from a file
  1629. X */
  1630. Xstatic char *
  1631. Xdelstr(contents, len, txt, posn)
  1632. X    char    *contents;
  1633. X    int    len;
  1634. X    char    *txt;
  1635. X    char    *posn;
  1636. X{
  1637. X    int    len_of_txt;
  1638. X    int    len_to_move;
  1639. X    register char *s, *d;
  1640. X    
  1641. X    len_of_txt = strlen(txt);
  1642. X    if (*(posn + len_of_txt) == '\n')
  1643. X        len_of_txt++;
  1644. X    len_to_move = strlen(posn) - len_of_txt;
  1645. X    /* do this by steam */
  1646. X    d = posn;
  1647. X    s = posn + len_of_txt;
  1648. X    if (*s == '\0') {
  1649. X        *d = '\0';
  1650. X        /* eat any newline at the end of the file */
  1651. X        for(;;) {
  1652. X            if (d == contents)
  1653. X                break;
  1654. X            d--;
  1655. X            if (*d == '\n')
  1656. X                *d = '\0';
  1657. X            else     
  1658. X                break;
  1659. X        }
  1660. X        return contents;
  1661. X    }
  1662. X    while(len_to_move--)
  1663. X        *d++ = *s++;
  1664. X    *d = '\0';
  1665. X    return contents;
  1666. X}
  1667. X    
  1668. X/*
  1669. X * rewrite a file from a new contents string
  1670. X */
  1671. Xstatic void
  1672. Xrewrite_file(filename, new)
  1673. X    char    *filename;
  1674. X    char    *new;
  1675. X{
  1676. X    int    len;
  1677. X    int    fd;
  1678. X    
  1679. X    unlink(filename);
  1680. X    if (*new == '\0') {
  1681. X        /* nothing there - delete the file */
  1682. X        return;
  1683. X    }
  1684. X    len = strlen(new);
  1685. X    if ((fd = creat(filename, 0666)) < 0) {
  1686. X        error("Cannot create: %s\n", filename);
  1687. X        return;
  1688. X    }
  1689. X    if (write(fd, new, len) != len)
  1690. X        error("Problem writing %s\n", filename);
  1691. X    close(fd);
  1692. X}
  1693. X
  1694. X/*
  1695. X * private strdup this used to call the system strdup()
  1696. X * and fail on an error, but it seems that some systems don't a strdup()
  1697. X */
  1698. Xstatic char *
  1699. XStrdup(str)
  1700. X    char    *str;
  1701. X{
  1702. X    int    len;
  1703. X    char    *ret;
  1704. X
  1705. X    len = strlen(str) + 1;
  1706. X    ret = malloc(len);
  1707. X    if (ret == NULL)
  1708. X        fatal(memerr);
  1709. X    (void) memcpy(ret, str, len);
  1710. X    return ret;
  1711. X}
  1712. X
  1713. X/*
  1714. X * fatal routine
  1715. X * print an error message and exit
  1716. X * should use vprintf I guess
  1717. X */
  1718. Xstatic void
  1719. Xfatal(fmt, a, b, c)
  1720. X    char    *fmt;
  1721. X{
  1722. X    fprintf(stderr, "%s: ", progname);
  1723. X    fprintf(stderr, fmt, a, b, c);
  1724. X    exit(1);
  1725. X}
  1726. X
  1727. X/*
  1728. X * error routine
  1729. X */
  1730. Xstatic void
  1731. Xerror(fmt, a, b, c, d)
  1732. X    char    *fmt;
  1733. X{
  1734. X    fprintf(stderr, "%s: ", progname);
  1735. X    fprintf(stderr, fmt, a, b, c, d);
  1736. X}
  1737. X
  1738. X/*
  1739. X * malloc some memory and
  1740. X * read the file into it
  1741. X */
  1742. Xstatic char *
  1743. Xreadbfile(fd, len)
  1744. X    int    fd;
  1745. X    int    len;
  1746. X{
  1747. X    char    *base;
  1748. X    
  1749. X    base = malloc(len+1);
  1750. X    if (base == NULL)
  1751. X        return ((char *)-1);
  1752. X    if (read(fd, base, len) != len)
  1753. X        return ((char *)-1);
  1754. X    return base;
  1755. X}
  1756. END_OF_FILE
  1757. if test 12776 -ne `wc -c <'xcalev/xcalev.c'`; then
  1758.     echo shar: \"'xcalev/xcalev.c'\" unpacked with wrong size!
  1759. fi
  1760. # end of 'xcalev/xcalev.c'
  1761. fi
  1762. echo shar: End of archive 5 \(of 8\).
  1763. cp /dev/null ark5isdone
  1764. MISSING=""
  1765. for I in 1 2 3 4 5 6 7 8 ; do
  1766.     if test ! -f ark${I}isdone ; then
  1767.     MISSING="${MISSING} ${I}"
  1768.     fi
  1769. done
  1770. if test "${MISSING}" = "" ; then
  1771.     echo You have unpacked all 8 archives.
  1772.     rm -f ark[1-9]isdone
  1773. else
  1774.     echo You still need to unpack the following archives:
  1775.     echo "        " ${MISSING}
  1776. fi
  1777. ##  End of shell archive.
  1778. exit 0
  1779.  
  1780. exit 0 # Just in case...
  1781. -- 
  1782.   // chris@Sterling.COM           | Send comp.sources.x submissions to:
  1783. \X/  Amiga: The only way to fly!  |    sources-x@sterling.com
  1784.        "It's intuitively obvious to the most casual observer..."
  1785.  GCS d++(--) -p+ c++ !l u++ e+ m+(-) s++/++ n h--- f+ g+++ w+ t++ r+ y+
  1786.