home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 28 / amigaformatcd28.iso / -seriously_amiga- / archivers / arcppc / src / patch2 < prev    next >
Text File  |  1998-04-23  |  11KB  |  425 lines

  1. Article 188 of comp.sources.bugs:
  2. Path: um-math!hyc
  3. From: hyc@math.lsa.umich.edu (Howard Chu)
  4. Newsgroups: comp.sources.bugs,comp.sources.d
  5. Subject: ARC 5.21 Patch #2
  6. Message-ID: <389@clio.math.lsa.umich.edu>
  7. Date: 1 Aug 88 19:19:49 GMT
  8. Sender: usenet@math.lsa.umich.edu
  9. Reply-To: hyc@math.lsa.umich.edu (Howard Chu)
  10. Organization: University of Michigan Math Dept., Ann Arbor
  11. Lines: 408
  12. Xref: um-math comp.sources.bugs:188 comp.sources.d:459
  13. UUCP-Path: {mailrus,umix}!um-math!hyc
  14.  
  15. Sorry to be bothering you all again so soon. No real functional changes here,
  16. just rearranging things to make it easier to maintain.
  17.  
  18. 1.  Moved configuration info out of arc.h into the Makefile.
  19.  
  20. 2.  Got rid of the tws time library. Kept a modified version of the routine I
  21.     needed. tmclock() instead of twsclock(), included here in tmclock.c. Unless
  22.     you want to use the tws library in other programs of your own, you can
  23.     delete the following:
  24.        Make.tws, dtime.c, dtimep.c, dtimep.lex, lexedit.sed, lexstring.c,
  25.        libtws.3, tws.h.
  26.     I've gotten too many questions about compiling those files, what they
  27.     depend on, etc.  tmclock.c should compile and run on any Unix system.
  28.  
  29. 3.  Changes to arcdos.c and marc.c. Pretty minor, as you'll see.
  30.  
  31. Ok. You won't be hearing more from me about ARC for a long time, I suspect.
  32. At least until I get the 5.22 sources, anyway...
  33.   -- Howard
  34.  
  35. #--------------------------------CUT HERE-------------------------------------
  36. #! /bin/sh
  37. #
  38. # This is a shell archive.  Save this into a file, edit it
  39. # and delete all lines above this comment.  Then give this
  40. # file to sh by executing the command "sh file".  The files
  41. # will be extracted into the current directory owned by
  42. # you with default permissions.
  43. #
  44. # The files contained herein are:
  45. #
  46. # -r--r--r--  1 hyc          2254 Aug  1 14:35 tmclock.c
  47. # -rw-r--r--  1 hyc          5964 Aug  1 15:10 patch2
  48. #
  49. echo 'x - tmclock.c'
  50. if test -f tmclock.c; then echo 'shar: not overwriting tmclock.c'; else
  51. sed 's/^X//' << '________This_Is_The_END________' > tmclock.c
  52. X/*
  53. X * Stolen from Jef Poskanzer's tws time library, which was stolen from
  54. X * Marshall Rose's MH Message Handling system...
  55. X *
  56. X * tmclock() will convert time from a tm struct back to a clock value.
  57. X * tmjuliandate() converts a tm struct to its julian day number.
  58. X * tmsubdayclock() takes hours, minutes, and seconds from a tm struct
  59. X * and returns the number of seconds since midnight of that day. (?)
  60. X *  -- Howard Chu, August 1 1988      hyc@umix.cc.umich.edu, umix!hyc
  61. X */
  62. X
  63. X/* $Header: tmclock.c,v 1.2 88/08/01 14:34:38 hyc Exp $ */
  64. X
  65. X/* Julian day number of the Unix* clock's origin, 01 Jan 1970. */
  66. X#define JD1970 2440587L
  67. X#define    CENTURY    19
  68. X#if    BSD
  69. X#include <sys/time.h>
  70. Xint    daylight;
  71. Xlong    timezone;
  72. X#else
  73. X#include <time.h>
  74. X#endif
  75. X
  76. Xlong
  77. Xtmjuliandate( tm )
  78. Xstruct tm *tm;
  79. X    {
  80. X    register int mday, mon, year;
  81. X    register long a, b;
  82. X    double jd;
  83. X
  84. X    if ( (mday = tm -> tm_mday) < 1 || mday > 31 ||
  85. X        (mon = tm -> tm_mon + 1) < 1 || mon > 12 ||
  86. X        (year = tm -> tm_year) < 1 || year > 10000 )
  87. X    return ( -1L );
  88. X    if ( year < 100 )
  89. X    year += CENTURY * 100;
  90. X
  91. X    if ( mon == 1 || mon == 2 )
  92. X    {
  93. X    --year;
  94. X    mon += 12;
  95. X    }
  96. X    if ( year < 1583 )
  97. X    return ( -1L );
  98. X    a = year / 100;
  99. X    b = 2 - a + a / 4;
  100. X    b += (long) ( (double) year * 365.25 );
  101. X    b += (long) ( 30.6001 * ( (double) mon + 1.0 ) );
  102. X    jd = mday + b + 1720994.5;
  103. X    return ( (long) jd );
  104. X    }
  105. X
  106. X
  107. Xlong
  108. Xtmsubdayclock( tm )
  109. Xstruct tm *tm;
  110. X    {
  111. X    register int sec, min, hour;
  112. X    register long result;
  113. X#if    BSD
  114. X    {
  115. X       struct timeval tp;
  116. X       struct timezone tzp;
  117. X
  118. X       gettimeofday(&tp, &tzp);
  119. X       daylight=tzp.tz_dsttime;
  120. X       timezone=tzp.tz_minuteswest*(-60);
  121. X    }
  122. X#endif
  123. X    if ( (sec = tm -> tm_sec) < 0 || sec > 59 ||
  124. X        (min = tm -> tm_min) < 0 || min > 59 ||
  125. X        (hour = tm -> tm_hour) < 0 || hour > 23 )
  126. X    return ( -1L );
  127. X
  128. X    result = ( hour * 60 + min ) * 60 + sec;
  129. X    result -= timezone;
  130. X    if ( daylight )
  131. X    result -= 60 * 60;
  132. X
  133. X    return ( result );
  134. X    }
  135. X
  136. X
  137. Xlong
  138. Xtmclock( tm )
  139. Xstruct tm *tm;
  140. X    {
  141. X    register long jd, sdc, result;
  142. X
  143. X    if ( ( jd = tmjuliandate( tm ) ) == -1L )
  144. X    return ( -1L );
  145. X    if ( ( sdc = tmsubdayclock( tm ) ) == -1L )
  146. X    return ( -1L );
  147. X
  148. X    result = ( jd - JD1970 ) * 24 * 60 * 60 + sdc;
  149. X
  150. X    return ( result );
  151. X    }
  152. ________This_Is_The_END________
  153. if test `wc -c < tmclock.c` -ne     2254; then
  154.     echo 'shar: tmclock.c was damaged during transit (should have been     2254 bytes)'
  155. fi
  156. fi        ; : end of overwriting check
  157. echo 'x - patch2'
  158. if test -f patch2; then echo 'shar: not overwriting patch2'; else
  159. sed 's/^X//' << '________This_Is_The_END________' > patch2
  160. X*** /tmp/,RCSt1a06989    Mon Aug  1 14:27:21 1988
  161. X--- Makefile    Mon Aug  1 14:27:42 1988
  162. X***************
  163. X*** 21,36 ****
  164. X  #PROG = .ttp
  165. X  PROG =
  166. X  
  167. X! # TWSLIB is only needed on Unix systems. Likewise for TWHEAD.
  168. X! #TWSLIB =
  169. X! #TWHEAD =
  170. X! TWSLIB = libtws.a
  171. X! TWHEAD = tws.h
  172. X  
  173. X  # For MWC 3.0 on the Atari ST, use:
  174. X  #CFLAGS = -VCOMPAC -VPEEP
  175. X! CFLAGS = -O
  176. X  
  177. X  OBJS = arc.o arcadd.o arccode.o arccvt.o arcdata.o arcdel.o arcdos.o \
  178. X  arcext.o arcio.o arclst.o arclzw.o arcmatch.o arcpack.o arcrun.o \
  179. X  arcsq.o arcsqs.o arcsvc.o arctst.o arcunp.o arcusq.o arcmisc.o
  180. X--- 21,45 ----
  181. X  #PROG = .ttp
  182. X  PROG =
  183. X  
  184. X! # SYSTEM defines your operating system:
  185. X! # MSDOS for IBM PCs or other MSDOS machines
  186. X! # GEMDOS for Atari ST (Predefined by MWC, so you don't need to define it.)
  187. X! # BSD for Berkeley Unix
  188. X! # SYSV for AT&T System V Unix
  189. X! # (MTS for Michigan Terminal System, which requires a different makefile)
  190. X! # (MTS also requires one of USEGFINFO or USECATSCAN for directory search)
  191. X! SYSTEM = -DBSD=1
  192. X  
  193. X  # For MWC 3.0 on the Atari ST, use:
  194. X  #CFLAGS = -VCOMPAC -VPEEP
  195. X! CFLAGS = -O $(SYSTEM)
  196. X  
  197. X+ # GNU's gcc is very nice, if you've got it. Otherwise just cc.
  198. X+ CC = cc
  199. X+ 
  200. X+ # tmclock is only needed on Unix systems...
  201. X+ TMCLOCK = tmclock.o
  202. X+ 
  203. X  OBJS = arc.o arcadd.o arccode.o arccvt.o arcdata.o arcdel.o arcdos.o \
  204. X  arcext.o arcio.o arclst.o arclzw.o arcmatch.o arcpack.o arcrun.o \
  205. X  arcsq.o arcsqs.o arcsvc.o arctst.o arcunp.o arcusq.o arcmisc.o
  206. X***************
  207. X*** 37,50 ****
  208. X  
  209. X  MOBJ = marc.o arcdata.o arcdos.o arcio.o arcmatch.o arcmisc.o
  210. X  
  211. X! arc$(PROG):    $(OBJS) $(TWSLIB)
  212. X!     $(CC) -o arc$(PROG) $(OBJS) $(TWSLIB)
  213. X  
  214. X! marc$(PROG):    $(MOBJ) $(TWSLIB)
  215. X!     $(CC) -o marc$(PROG) $(MOBJ) $(TWSLIB)
  216. X  
  217. X  clean:
  218. X!     -rm *.o arc$(PROG) marc$(PROG) $(TWSLIB)
  219. X  
  220. X  arc.o:    $(SRCDIR)arc.c    $(HEADER)
  221. X      $(CC) $(CFLAGS) -c $(SRCDIR)arc.c
  222. X--- 46,59 ----
  223. X  
  224. X  MOBJ = marc.o arcdata.o arcdos.o arcio.o arcmatch.o arcmisc.o
  225. X  
  226. X! arc$(PROG):    $(OBJS) $(TMCLOCK)
  227. X!     $(CC) -o arc$(PROG) $(OBJS) $(TMCLOCK)
  228. X  
  229. X! marc$(PROG):    $(MOBJ) $(TMCLOCK)
  230. X!     $(CC) -o marc$(PROG) $(MOBJ) $(TMCLOCK)
  231. X  
  232. X  clean:
  233. X!     -rm *.o arc$(PROG) marc$(PROG)
  234. X  
  235. X  arc.o:    $(SRCDIR)arc.c    $(HEADER)
  236. X      $(CC) $(CFLAGS) -c $(SRCDIR)arc.c
  237. X***************
  238. X*** 93,97 ****
  239. X  arcusq.o:    $(SRCDIR)arcusq.c    $(HEADER)
  240. X      $(CC) $(CFLAGS) -c $(SRCDIR)arcusq.c
  241. X  
  242. X! libtws.a:
  243. X!     make -f Make.tws libtws.a
  244. X--- 102,106 ----
  245. X  arcusq.o:    $(SRCDIR)arcusq.c    $(HEADER)
  246. X      $(CC) $(CFLAGS) -c $(SRCDIR)arcusq.c
  247. X  
  248. X! tmclock.o:    $(SRCDIR)tmclock.c
  249. X!     $(CC) $(CFLAGS) -c $(SRCDIR)tmclock.c
  250. X*** /tmp/,RCSt1a07213    Mon Aug  1 14:41:30 1988
  251. X--- arc.h    Mon Aug  1 14:35:45 1988
  252. X***************
  253. X*** 1,21 ****
  254. X  /*
  255. X!  * $Header: arc.h,v 1.9 88/07/31 18:43:18 hyc Exp $
  256. X   */
  257. X  
  258. X! #undef    MSDOS
  259. X! #undef    GEMDOS        /* This amusing garbage is to get all my */
  260. X! #undef    DOS        /* define's past some compilers, which */
  261. X! #undef    BSD        /* apparently define some of these themselves */
  262. X! #undef    SYSV
  263. X  #undef    UNIX
  264. X- #undef    MTS
  265. X  
  266. X- #define    MSDOS    0        /* MSDOS machine */
  267. X- #define    GEMDOS    0        /* Atari, GEMDOS */
  268. X- #define    BSD    1        /* BSD4.2 or 4.3 */
  269. X- #define    SYSV    0        /* Also uses BSD */
  270. X- #define    MTS    0        /* MTS or 370(?) */
  271. X- 
  272. X  /*
  273. X   * Assumptions:
  274. X   * char = 8 bits
  275. X--- 1,10 ----
  276. X  /*
  277. X!  * $Header: arc.h,v 1.10 88/08/01 14:28:29 hyc Exp $
  278. X   */
  279. X  
  280. X! #undef    DOS    /* Just in case... */
  281. X  #undef    UNIX
  282. X  
  283. X  /*
  284. X   * Assumptions:
  285. X   * char = 8 bits
  286. X***************
  287. X*** 45,52 ****
  288. X  #endif
  289. X  
  290. X  #if    MTS
  291. X- #define    USEGFINFO    0    /* define this to use GFINFO for directory */
  292. X- #define    USECATSCAN    1    /* scanning, else use CATSCAN/FILEINFO... */
  293. X  #define    CUTOFF    sepchr[0]
  294. X  #endif
  295. X  
  296. X--- 34,39 ----
  297. X*** /tmp/,RCSt1a07263    Mon Aug  1 14:46:27 1988
  298. X--- marc.c    Mon Aug  1 14:20:13 1988
  299. X***************
  300. X*** 1,5 ****
  301. X  /*
  302. X!  * $Header: marc.c,v 1.4 88/07/31 19:49:35 hyc Exp $
  303. X   */
  304. X  
  305. X  /*  MARC - Archive merge utility
  306. X--- 1,5 ----
  307. X  /*
  308. X!  * $Header: marc.c,v 1.5 88/08/01 14:19:19 hyc Exp $
  309. X   */
  310. X  
  311. X  /*  MARC - Archive merge utility
  312. X***************
  313. X*** 105,111 ****
  314. X              arctemp[n] = CUTOFF;
  315. X      }
  316. X  #if    UNIX
  317. X!     else    strcpy(arctemp, "/tmp/";
  318. X  #endif
  319. X  #if    !MSDOS
  320. X      {
  321. X--- 105,111 ----
  322. X              arctemp[n] = CUTOFF;
  323. X      }
  324. X  #if    UNIX
  325. X!     else    strcpy(arctemp, "/tmp/");
  326. X  #endif
  327. X  #if    !MSDOS
  328. X      {
  329. X*** /tmp/,RCSt1a07425    Mon Aug  1 15:09:17 1988
  330. X--- arcdos.c    Mon Aug  1 15:08:18 1988
  331. X***************
  332. X*** 1,5 ****
  333. X  /*
  334. X!  * $Header: arcdos.c,v 1.6 88/07/31 18:48:09 hyc Exp $
  335. X   */
  336. X  
  337. X  /*
  338. X--- 1,5 ----
  339. X  /*
  340. X!  * $Header: arcdos.c,v 1.8 88/08/01 15:07:15 hyc Exp $
  341. X   */
  342. X  
  343. X  /*
  344. X***************
  345. X*** 30,44 ****
  346. X  #if    UNIX
  347. X  #include <sys/types.h>
  348. X  #include <sys/stat.h>
  349. X! #include <sys/time.h>
  350. X! #include "tws.h"
  351. X! #endif
  352. X  
  353. X! #if    SYSV
  354. X! #include <sys/times.h>
  355. X! struct timeval {
  356. X!     long tv_sec;
  357. X!     long tv_usec;
  358. X  };
  359. X  #endif
  360. X  
  361. X--- 30,40 ----
  362. X  #if    UNIX
  363. X  #include <sys/types.h>
  364. X  #include <sys/stat.h>
  365. X! #include <time.h>
  366. X  
  367. X! struct timeval {    /* man page said <sys/types.h>, but it */
  368. X!     long tv_sec;    /* really seems to be in <sys/time.h>, */
  369. X!     long tv_usec;    /* but why bother... */
  370. X  };
  371. X  #endif
  372. X  
  373. X***************
  374. X*** 168,186 ****
  375. X      Fclose(fd);
  376. X  #endif
  377. X  #if    UNIX
  378. X!     struct tws      tms;
  379. X      struct timeval  tvp[2];
  380. X      int    utimes();
  381. X!     twscopy(&tms, dtwstime());
  382. X!     tms.tw_sec = (time & 31) * 2;
  383. X!     tms.tw_min = (time >> 5) & 63;
  384. X!     tms.tw_hour = (time >> 11);
  385. X!     tms.tw_mday = date & 31;
  386. X!     tms.tw_mon = ((date >> 5) & 15) - 1;
  387. X!     tms.tw_year = (date >> 9) + 80;
  388. X!     tms.tw_clock = 0L;
  389. X!     tms.tw_flags = TW_NULL;
  390. X!     tvp[0].tv_sec = twclock(&tms);
  391. X      tvp[1].tv_sec = tvp[0].tv_sec;
  392. X      tvp[0].tv_usec = tvp[1].tv_usec = 0;
  393. X      utimes(f, tvp);
  394. X--- 164,179 ----
  395. X      Fclose(fd);
  396. X  #endif
  397. X  #if    UNIX
  398. X!     struct tm    tm;
  399. X      struct timeval  tvp[2];
  400. X      int    utimes();
  401. X!     tm.tm_sec = (time & 31) * 2;
  402. X!     tm.tm_min = (time >> 5) & 63;
  403. X!     tm.tm_hour = (time >> 11);
  404. X!     tm.tm_mday = date & 31;
  405. X!     tm.tm_mon = ((date >> 5) & 15) - 1;
  406. X!     tm.tm_year = (date >> 9) + 80;
  407. X!     tvp[0].tv_sec = tmclock(&tm);
  408. X      tvp[1].tv_sec = tvp[0].tv_sec;
  409. X      tvp[0].tv_usec = tvp[1].tv_usec = 0;
  410. X      utimes(f, tvp);
  411. ________This_Is_The_END________
  412. if test `wc -c < patch2` -ne     5964; then
  413.     echo 'shar: patch2 was damaged during transit (should have been     5964 bytes)'
  414. fi
  415. fi        ; : end of overwriting check
  416. exit 0
  417. --
  418.   /
  419.  /_ , ,_.                      Howard Chu
  420. / /(_/(__                University of Michigan
  421.     /           Computing Center          College of LS&A
  422.    '              Unix Project          Information Systems
  423.  
  424.  
  425.