home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume21 / remind / patch02 next >
Encoding:
Text File  |  1991-07-21  |  21.9 KB  |  738 lines

  1. Newsgroups: comp.sources.misc
  2. From: David F. Skoll <dfs@doe.carleton.ca>
  3. Subject:  v21i002:  remind - A replacement for calendar, Patch02
  4. Message-ID: <1991Jul19.215741.7847@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: 6246e6b315671e22b36495f7f839f9c5
  6. Date: Fri, 19 Jul 1991 21:57:41 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: David F. Skoll <dfs@doe.carleton.ca>
  10. Posting-number: Volume 21, Issue 2
  11. Archive-name: remind/patch02
  12. Patch-To: remind: Volume 17, Issue 3-6
  13.  
  14. This is Official Patch #2 for Remind.  Most notably, this patch adds
  15. the '-h' option to Remind.  This causes Remind to be silent if no
  16. reminders are triggered, or if only background reminders are
  17. triggered.  You should also intall the updated version of
  18. remind-all.csh or remind-all.sh, which make use of this feature.
  19.  
  20. Other fixes: New substitution sequences for inserting the current time
  21. into reminders; stdin and stdout are closed before Remind goes into
  22. the background if they are not ttys; signal handler and sleep
  23. behaviour fixed for SYSV systems; Makefile made more portable.
  24.  
  25. I'd like to thank Dave Wolfe and Raphael Manfredi for some of these patches.
  26.  
  27. As always, a fully-patched version of remind is available via
  28. anonymous ftp from alfred.ccs.carleton.ca:pub/remind-2.3.1.tar.Z.
  29. (Internet address: 134.117.1.1) The patches are available there, too.
  30.  
  31. ------------- Cut Here ---------- Cut Here ---------- Cut Here -------------
  32. #!/bin/sh
  33. # This is Remind 2.3 Official Patch #2, a shell archive (shar 3.32)
  34. # made 07/17/1991 17:25 UTC by dfs@data
  35. # Source directory /enterprise/transporter/dfs/work/.rem/patch2-work
  36. #
  37. # existing files will NOT be overwritten
  38. #
  39. # This shar contains:
  40. # length  mode       name
  41. # ------ ---------- ------------------------------------------
  42. #  19150 -rw------- patch-02
  43. #
  44. if touch 2>&1 | fgrep 'amc' > /dev/null
  45.  then TOUCH=touch
  46.  else TOUCH=true
  47. fi
  48. # ============= patch-02 ==============
  49. if test X"$1" != X"-c" -a -f 'patch-02'; then
  50.     echo "File already exists: skipping 'patch-02'"
  51. else
  52. echo "x - extracting patch-02 (Text)"
  53. sed 's/^X//' << 'SHAR_EOF' > patch-02 &&
  54. XVersion 2.3 Patch 2 - Fixed up a problem with timed reminders which resulted
  55. Xin cursor not starting from left side of screen on some systems.
  56. XFixed the SIGINT handler for SYSV systems - this was interrupting the
  57. Xsleep(2) system call.
  58. XClosed stdin and stdout if remind was part of a pipe - this prevents other
  59. Xsections of the pipe from hanging as remind puts itself in the background.
  60. XAdded the "-h" (Hush mode) option
  61. XAdded the "%#" and "%@" modifiers for the current time.
  62. XMade the Makefile more portable
  63. X
  64. X*** ../patch1.work/COPYRIGHT    Mon Feb 25 17:05:00 1991
  65. X--- ./COPYRIGHT    Wed Jul 17 13:18:07 1991
  66. X***************
  67. X*** 17,23 ****
  68. X  
  69. X  You may incorporate parts of REMIND into your own programs, providing
  70. X  you do not sell these programs.  You must clearly indicate that the parts
  71. X! of REMIND you have incorporated are Copyright (C) 1990 by David Skoll.
  72. X  
  73. X  I will attempt to support REMIND as much as possible.  However, you use
  74. X  it at your own risk.  I am not responsible for any damages caused by
  75. X--- 17,23 ----
  76. X  
  77. X  You may incorporate parts of REMIND into your own programs, providing
  78. X  you do not sell these programs.  You must clearly indicate that the parts
  79. X! of REMIND you have incorporated are Copyright (C) 1990, 1991 by David Skoll.
  80. X  
  81. X  I will attempt to support REMIND as much as possible.  However, you use
  82. X  it at your own risk.  I am not responsible for any damages caused by
  83. X***************
  84. X*** 46,51 ****
  85. X--- 46,54 ----
  86. X  <dennis@peanuts.nosc.mil> for suggesting many of the new features in
  87. X  REMIND.
  88. X  
  89. X+ Dave Wolfe <dwolfe@pffft.sps.mot.com> and Raphael Manfredi <ram@eiffel.com>
  90. X+ for noticing bugs and sending me fixes.
  91. X+ 
  92. X  Timo Salmi, Keith Petersen, Bill Davidsen and Kent Landfield for maintaining
  93. X  the uwasa and SIMTEL archives, and comp.binaries.ibm.pc and comp.sources.misc
  94. X  in the face of a flurry of updates to REMIND.
  95. X***************
  96. X*** 55,60 ****
  97. X--- 58,64 ----
  98. X  
  99. X  Finally, all those who donated money to support the production of
  100. X  REMIND.  Your donations were gratefully appreciated.
  101. X+ 
  102. X  --
  103. X  David F. Skoll <dfs@doe.carleton.ca>
  104. X  4-317 LeBreton Street South
  105. X*** ../patch1.work/Makefile    Tue Feb 26 14:37:07 1991
  106. X--- ./Makefile    Wed Jul 17 12:48:49 1991
  107. X***************
  108. X*** 2,22 ****
  109. X  
  110. X  #--------------- BEGINNING OF THINGS YOU CAN CHANGE --------------
  111. X  
  112. X  #If you have a BSD system:
  113. X! CFLAGS= -O -DUNIX
  114. X  
  115. X  #If you have a SYSV system, comment previous line and uncomment next line:
  116. X! #CFLAGS= -O -DUNIX -DSYSV
  117. X  
  118. X  #If your system does not include <malloc.h>, uncomment next line:
  119. X! #CFLAGS += -DNO_MALLOC_H
  120. X  
  121. X  #If you have a SYSV system which does not implement the pid_t type,
  122. X  #uncomment the next line:
  123. X! #CFLAGS += -Dpid_t=int
  124. X  
  125. X  #If you want to use gcc:
  126. X  #CC= gcc
  127. X  
  128. X  #Where do you want it installed?
  129. X  BINDIR= /usr/local/bin
  130. X--- 2,30 ----
  131. X  
  132. X  #--------------- BEGINNING OF THINGS YOU CAN CHANGE --------------
  133. X  
  134. X+ #If you need more than one of the following definitions for CDEFS,
  135. X+ #concatenate the necessary definitions.
  136. X+ 
  137. X  #If you have a BSD system:
  138. X! CDEFS= -DUNIX
  139. X  
  140. X  #If you have a SYSV system, comment previous line and uncomment next line:
  141. X! #CDEFS= -DUNIX -DSYSV
  142. X  
  143. X  #If your system does not include <malloc.h>, uncomment next line:
  144. X! #CDEFS= -DNO_MALLOC_H
  145. X  
  146. X  #If you have a SYSV system which does not implement the pid_t type,
  147. X  #uncomment the next line:
  148. X! #CDEFS= -Dpid_t=int
  149. X  
  150. X+ #If your system doesn't print return w/ newline for background processes:
  151. X+ #CDEFS= -DNL=\"\\r\\n\"
  152. X+ 
  153. X  #If you want to use gcc:
  154. X  #CC= gcc
  155. X+ 
  156. X+ CFLAGS = -O $(CDEFS)
  157. X  
  158. X  #Where do you want it installed?
  159. X  BINDIR= /usr/local/bin
  160. X*** ../patch1.work/WHATSNEW.23    Thu Mar  7 15:24:35 1991
  161. X--- ./WHATSNEW.23    Wed Jul 17 13:14:26 1991
  162. X***************
  163. X*** 49,51 ****
  164. X--- 49,66 ----
  165. X  Added the "rem" shell script for running Remind with a default script.
  166. X  
  167. X  Added manual pages for "kall" and "rem".
  168. X+ 
  169. X+ * Version 2.3 Patch 2 - Fixed up a problem with timed reminders which resulted
  170. X+ in cursor not starting from left side of screen on some systems.
  171. X+ 
  172. X+ Fixed the SIGINT handler for SYSV systems - this was interrupting the
  173. X+ sleep(2) system call.
  174. X+ 
  175. X+ Closed stdin and stdout if remind was part of a pipe - this prevents other
  176. X+ sections of the pipe from hanging as remind puts itself in the background.
  177. X+ 
  178. X+ Added the "-h" (Hush mode) option
  179. X+ 
  180. X+ Added the "%#" and "%@" modifiers for the current time.
  181. X+ 
  182. X+ Made the Makefile more portable
  183. X*** ../patch1.work/dosubst.c    Mon Feb 18 13:05:17 1991
  184. X--- ./dosubst.c    Wed Jul 17 12:44:34 1991
  185. X***************
  186. X*** 39,50 ****
  187. X     char c;
  188. X     char *od, *s;
  189. X     int wkday = jul % 7;
  190. X!    char *plu, *pm;
  191. X     int curtim = (int) (SystemTime() / 60);
  192. X     int done;
  193. X     int h;
  194. X     int hh;
  195. X     int min;
  196. X     int tdiff;
  197. X     int adiff, mdiff, hdiff;
  198. X     char *mplu, *hplu, *when;
  199. X--- 39,53 ----
  200. X     char c;
  201. X     char *od, *s;
  202. X     int wkday = jul % 7;
  203. X!    char *plu, *pm, *cpm;
  204. X     int curtim = (int) (SystemTime() / 60);
  205. X     int done;
  206. X     int h;
  207. X     int hh;
  208. X     int min;
  209. X+    int ch;
  210. X+    int chh;
  211. X+    int cmin;
  212. X     int tdiff;
  213. X     int adiff, mdiff, hdiff;
  214. X     char *mplu, *hplu, *when;
  215. X***************
  216. X*** 85,93 ****
  217. X     h = tim / 60;
  218. X     min = tim % 60;
  219. X  
  220. X!    if (h >= 12) pm = "pm"; else pm = "am";
  221. X!    if (h == 12) hh = 12; else hh = h % 12;
  222. X  
  223. X     *dst = 0;
  224. X     
  225. X     switch(d) {
  226. X--- 88,102 ----
  227. X     h = tim / 60;
  228. X     min = tim % 60;
  229. X  
  230. X!    pm = (h < 12) ? "am" : "pm";
  231. X!    hh = (h == 12) ? 12 : h % 12;
  232. X!    
  233. X!    ch = curtim / 60;
  234. X!    cmin = curtim % 60;
  235. X  
  236. X+    cpm = (ch < 12) ? "am" : "pm";
  237. X+    chh = (ch == 12) ? 12 : ch % 12;
  238. X+ 
  239. X     *dst = 0;
  240. X     
  241. X     switch(d) {
  242. X***************
  243. X*** 331,338 ****
  244. X              case '!': sprintf(dst, (tdiff >= 0 ? "is" : "was"));
  245. X             dst += strlen(dst);
  246. X             break;
  247. X          
  248. X!             case '_': *dst++ = '\n'; *dst = 0;
  249. X             break;
  250. X  
  251. X              default:
  252. X--- 340,359 ----
  253. X              case '!': sprintf(dst, (tdiff >= 0 ? "is" : "was"));
  254. X             dst += strlen(dst);
  255. X             break;
  256. X+ 
  257. X+         case '@': sprintf(dst, "%d:%02d%s", chh, cmin, cpm);
  258. X+            dst += strlen(dst);
  259. X+            break;
  260. X+ 
  261. X+         case '#': sprintf(dst, "%02d:%02d", ch, cmin);
  262. X+            dst += strlen(dst);
  263. X+            break;
  264. X          
  265. X! #ifndef NL
  266. X! #define NL "\n"
  267. X! #endif
  268. X!         case '_': sprintf(dst, "%s", NL);
  269. X!            dst += strlen(dst);
  270. X             break;
  271. X  
  272. X              default:
  273. X*** ../patch1.work/globals.h    Thu Mar  7 15:13:58 1991
  274. X--- ./globals.h    Wed Jul 17 12:52:37 1991
  275. X***************
  276. X*** 46,48 ****
  277. X--- 46,49 ----
  278. X  extern int   CalTime;
  279. X  extern int   CalWidth;
  280. X  extern int   SimpleCalendar;
  281. X+ extern int   Hush;
  282. X*** ../patch1.work/init.c    Thu Mar  7 15:42:28 1991
  283. X--- ./init.c    Wed Jul 17 12:52:26 1991
  284. X***************
  285. X*** 47,52 ****
  286. X--- 47,53 ----
  287. X     CalWidth = 10;
  288. X     SimpleCalendar = 0;
  289. X     InfiniteDelta = 0;
  290. X+    Hush = 0;
  291. X  
  292. X     if(argc == 1) {
  293. X       fprintf(stderr,
  294. X***************
  295. X*** 53,61 ****
  296. X          "\nREMIND %d.%d Patch Level %d (C) 1990, 1991 by David Skoll.\n\n", 
  297. X             VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL);
  298. X  #ifdef UNIX
  299. X!      fprintf(stderr, "Usage: remind [-n | -d | -p | -c# [-w# | -s]] [-voraqt] filename [date]\n\n");
  300. X  #else
  301. X!      fprintf(stderr, "Usage: remind [-n | -d | -p | -c# [-w# | -s]] [-vort] filename [date]\n\n");
  302. X  #endif
  303. X       fprintf(stderr, "-n   Output next occurrence of reminders in simple format\n");
  304. X       fprintf(stderr, "-d   Debug reminder file\n-p   Purge reminder file\n");
  305. X--- 54,62 ----
  306. X          "\nREMIND %d.%d Patch Level %d (C) 1990, 1991 by David Skoll.\n\n", 
  307. X             VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL);
  308. X  #ifdef UNIX
  309. X!      fprintf(stderr, "Usage: remind [-n | -d | -p | -c# [-w# | -s]] [-voraqth] filename [date]\n\n");
  310. X  #else
  311. X!      fprintf(stderr, "Usage: remind [-n | -d | -p | -c# [-w# | -s]] [-vorth] filename [date]\n\n");
  312. X  #endif
  313. X       fprintf(stderr, "-n   Output next occurrence of reminders in simple format\n");
  314. X       fprintf(stderr, "-d   Debug reminder file\n-p   Purge reminder file\n");
  315. X***************
  316. X*** 68,74 ****
  317. X       fprintf(stderr, "-a   Do not trigger current AT reminders in foreground\n");
  318. X       fprintf(stderr, "-q   Do not queue current AT reminders\n");
  319. X  #endif
  320. X!      fprintf(stderr, "-t   Trigger all non-expired reminders regardless of delta\n\n");
  321. X       exit(1);
  322. X     }
  323. X  
  324. X--- 69,76 ----
  325. X       fprintf(stderr, "-a   Do not trigger current AT reminders in foreground\n");
  326. X       fprintf(stderr, "-q   Do not queue current AT reminders\n");
  327. X  #endif
  328. X!      fprintf(stderr, "-t   Trigger all non-expired reminders regardless of delta\n");
  329. X!      fprintf(stderr, "-h   'Hush' mode - don't display anything if no reminders triggered\n\n");
  330. X       exit(1);
  331. X     }
  332. X  
  333. X***************
  334. X*** 141,146 ****
  335. X--- 143,150 ----
  336. X               break;
  337. X  
  338. X              case 'S': SimpleCalendar = 1; break;
  339. X+ 
  340. X+         case 'H': Hush = 1; break;
  341. X  
  342. X          case 'V': Verbose = 1; break;
  343. X  
  344. X*** ../patch1.work/main.c    Thu Mar  7 15:37:14 1991
  345. X--- ./main.c    Wed Jul 17 12:53:03 1991
  346. X***************
  347. X*** 115,120 ****
  348. X--- 115,121 ----
  349. X  int NumFullOmit, NumPartOmit;
  350. X  int JulianToday, RealToday;
  351. X  int CurYear, CurMon, CurDay;
  352. X+ int Hush;
  353. X  char QueueAts, PrintAts;
  354. X  int  NumAtsQueued;
  355. X  int Calendar, CalTime, CalWidth, SimpleCalendar;
  356. X***************
  357. X*** 672,681 ****
  358. X     }
  359. X  /* Get rid of any spurious OMIT contexts */
  360. X     FreeStackedOmits();
  361. X!    if (NumEmitted == 0 && NumAtsQueued == 0 && !Purge && !Debug && !Next) 
  362. X         printf("No reminders.\n");
  363. X  #ifdef UNIX
  364. X!    if (NumEmitted == 0 && NumAtsQueued != 0 && !Purge && !Debug)
  365. X         printf("%d reminder%s queued for later today.\n", NumAtsQueued,
  366. X                (NumAtsQueued == 1) ? "" : "s");
  367. X  
  368. X--- 673,682 ----
  369. X     }
  370. X  /* Get rid of any spurious OMIT contexts */
  371. X     FreeStackedOmits();
  372. X!    if (!Hush && NumEmitted == 0 && NumAtsQueued == 0 && !Purge && !Debug && !Next) 
  373. X         printf("No reminders.\n");
  374. X  #ifdef UNIX
  375. X!    if (!Hush && NumEmitted == 0 && NumAtsQueued != 0 && !Purge && !Debug)
  376. X         printf("%d reminder%s queued for later today.\n", NumAtsQueued,
  377. X                (NumAtsQueued == 1) ? "" : "s");
  378. X  
  379. X*** ../patch1.work/patchlevel.h    Thu Mar  7 14:45:04 1991
  380. X--- ./patchlevel.h    Wed Jul 17 12:41:43 1991
  381. X***************
  382. X*** 3,6 ****
  383. X  #define VERSION_MAJOR 2
  384. X  #define VERSION_MINOR 3
  385. X  
  386. X! #define PATCHLEVEL 1
  387. X--- 3,6 ----
  388. X  #define VERSION_MAJOR 2
  389. X  #define VERSION_MINOR 3
  390. X  
  391. X! #define PATCHLEVEL 2
  392. X*** ../patch1.work/remind-all.csh    Mon Feb 18 13:05:19 1991
  393. X--- ./remind-all.csh    Wed Jul 17 13:02:36 1991
  394. X***************
  395. X*** 24,38 ****
  396. X  # Set the following variables as appropriate for your system
  397. X  set REMIND = /usr/local/bin/remind
  398. X  set MAIL   = /usr/ucb/mail
  399. X- set CMP    = /usr/bin/cmp
  400. X  set RM     = "/usr/bin/rm -f"
  401. X  
  402. X! set EMPTY  = /tmp/Empty.$$
  403. X! set FULL   = /tmp/Full.$$
  404. X  
  405. X- # Create the dummy empty reminder file
  406. X- $REMIND -rq /dev/null > $EMPTY
  407. X- 
  408. X  # Scan each user's directory for a .reminders file
  409. X  foreach i ($USERS)
  410. X     if (-r ~$i/.reminders) then
  411. X--- 24,33 ----
  412. X  # Set the following variables as appropriate for your system
  413. X  set REMIND = /usr/local/bin/remind
  414. X  set MAIL   = /usr/ucb/mail
  415. X  set RM     = "/usr/bin/rm -f"
  416. X  
  417. X! set REMFILE   = /tmp/RemFile.$$
  418. X  
  419. X  # Scan each user's directory for a .reminders file
  420. X  foreach i ($USERS)
  421. X     if (-r ~$i/.reminders) then
  422. X***************
  423. X*** 39,54 ****
  424. X  
  425. X  #     echo "$i has a .reminders file."     DEBUGGING PURPOSES ONLY
  426. X  
  427. X!       $REMIND -rq ~$i/.reminders > $FULL
  428. X!       $CMP -s $EMPTY $FULL
  429. X!       if ($status != 0) then
  430. X! 
  431. X  #        echo "Sending mail to $i"         DEBUGGING PURPOSES ONLY
  432. X  
  433. X!          $MAIL -s "Reminders" $i < $FULL
  434. X        endif
  435. X!       $RM $FULL
  436. X     endif
  437. X  end
  438. X- 
  439. X- $RM $EMPTY
  440. X--- 34,45 ----
  441. X  
  442. X  #     echo "$i has a .reminders file."     DEBUGGING PURPOSES ONLY
  443. X  
  444. X!       $REMIND -rqh ~$i/.reminders > $REMFILE
  445. X!       if (! -z $REMFILE) then
  446. X  #        echo "Sending mail to $i"         DEBUGGING PURPOSES ONLY
  447. X  
  448. X!          $MAIL -s "Reminders" $i < $REMFILE
  449. X        endif
  450. X!       $RM $REMFILE
  451. X     endif
  452. X  end
  453. X*** ../patch1.work/remind-all.sh    Mon Feb 18 13:05:19 1991
  454. X--- ./remind-all.sh    Wed Jul 17 13:02:58 1991
  455. X***************
  456. X*** 24,38 ****
  457. X  # Set the following variables as appropriate for your system
  458. X  REMIND=/usr/local/bin/remind
  459. X  MAIL=/usr/bin/mail
  460. X- CMP=/bin/cmp
  461. X  RM="/bin/rm -f"
  462. X  
  463. X! EMPTY=/tmp/Empty.$$
  464. X! FULL=/tmp/Full.$$
  465. X  
  466. X- # Create the dummy empty reminder file
  467. X- $REMIND -rq /dev/null > $EMPTY
  468. X- 
  469. X  # Scan each user's directory for a .reminders file
  470. X  for i in $USERS
  471. X  do
  472. X--- 24,33 ----
  473. X  # Set the following variables as appropriate for your system
  474. X  REMIND=/usr/local/bin/remind
  475. X  MAIL=/usr/bin/mail
  476. X  RM="/bin/rm -f"
  477. X  
  478. X! REMFILE=/tmp/RemFile.$$
  479. X  
  480. X  # Scan each user's directory for a .reminders file
  481. X  for i in $USERS
  482. X  do
  483. X***************
  484. X*** 41,57 ****
  485. X  
  486. X  #     echo "$i has a .reminders file."     DEBUGGING PURPOSES ONLY
  487. X  
  488. X!       $REMIND -rq $HOME/.reminders > $FULL
  489. X!       if `$CMP -s $EMPTY $FULL`; then
  490. X!          : do nothing
  491. X!       else
  492. X! 
  493. X  #        echo "Sending mail to $i"         DEBUGGING PURPOSES ONLY
  494. X! 
  495. X!          $MAIL -s "Reminders" $i < $FULL
  496. X        fi
  497. X!       $RM $FULL
  498. X     fi
  499. X  done
  500. X- 
  501. X- $RM $EMPTY
  502. X--- 36,46 ----
  503. X  
  504. X  #     echo "$i has a .reminders file."     DEBUGGING PURPOSES ONLY
  505. X  
  506. X!       $REMIND -rq $HOME/.reminders > $REMFILE
  507. X!       if [ -s $REMFILE ]; then
  508. X  #        echo "Sending mail to $i"         DEBUGGING PURPOSES ONLY
  509. X!          $MAIL -s "Reminders" $i < $REMFILE
  510. X        fi
  511. X!       $RM $REMFILE
  512. X     fi
  513. X  done
  514. X*** ../patch1.work/remind.1    Thu Mar  7 15:52:55 1991
  515. X--- ./remind.1    Wed Jul 17 12:56:26 1991
  516. X***************
  517. X*** 5,11 ****
  518. X  .SH SYNOPSIS
  519. X  .B remind
  520. X  [\fB\-n | \fB\-d\fR | \fB\-p\fR | \fB\-c\fR\fIn\fR [\fB\-w\fR\fIn\fR | \fB\-s\fR]]
  521. X! [\fB\-voraqt\fR]
  522. X  .I filename
  523. X  [\fIdate\fR]
  524. X  .SH DESCRIPTION
  525. X--- 5,11 ----
  526. X  .SH SYNOPSIS
  527. X  .B remind
  528. X  [\fB\-n | \fB\-d\fR | \fB\-p\fR | \fB\-c\fR\fIn\fR [\fB\-w\fR\fIn\fR | \fB\-s\fR]]
  529. X! [\fB\-voraqth\fR]
  530. X  .I filename
  531. X  [\fIdate\fR]
  532. X  .SH DESCRIPTION
  533. X***************
  534. X*** 134,139 ****
  535. X--- 134,146 ----
  536. X  In effect, this causes reminders to be treated as if they have an
  537. X  infinite value of "delta"; ie, they are triggered no matter how far in the
  538. X  future they are.
  539. X+ .TP
  540. X+ .B \-h
  541. X+ The
  542. X+ .B \-h
  543. X+ flag causes \fBremind\fR to go into 'Hush' mode.  In this mode, if no
  544. X+ reminders are triggered, nothing will be displayed.  (Normally, \fBremind\fR
  545. X+ will display "No reminders." in this case.)
  546. X  .PP
  547. X  If you supply a
  548. X  .I date
  549. X***************
  550. X*** 1226,1237 ****
  551. X  causes the need for the "...ago" forms.
  552. X  .TP
  553. X  .B %2
  554. X! is replaced with "\fIhh\fR:\fImm\fRam" or "..pm" depending on the
  555. X  .I AT
  556. X  time of the reminder.
  557. X  .TP
  558. X  .B %3
  559. X! is replaced with "\fIhh\fR:\fImm\fR" in 24-hour format.
  560. X  .TP
  561. X  .B %4
  562. X  is replaced with "\fImm\fR" where \fImm\fR is the number of minutes between
  563. X--- 1233,1244 ----
  564. X  causes the need for the "...ago" forms.
  565. X  .TP
  566. X  .B %2
  567. X! is replaced with "at \fIhh\fR:\fImm\fRam" or "..pm" depending on the
  568. X  .I AT
  569. X  time of the reminder.
  570. X  .TP
  571. X  .B %3
  572. X! is replaced with "at \fIhh\fR:\fImm\fR" in 24-hour format.
  573. X  .TP
  574. X  .B %4
  575. X  is replaced with "\fImm\fR" where \fImm\fR is the number of minutes between
  576. X***************
  577. X*** 1264,1269 ****
  578. X--- 1271,1282 ----
  579. X  .B %!
  580. X  is replaced with "is" if the current time is before the \fIAT\fR time,
  581. X  or "was" if it is after.
  582. X+ .TP
  583. X+ .B %@
  584. X+ is similar to \fB%2\fR but displays the current time.
  585. X+ .TP
  586. X+ .B %#
  587. X+ is similar to \fB%3\fR but displays the current time.
  588. X  .TP
  589. X  .B 
  590. X  %"
  591. X*** ../patch1.work/timed.c    Mon Feb 18 13:05:21 1991
  592. X--- ./timed.c    Wed Jul 17 13:07:45 1991
  593. X***************
  594. X*** 8,13 ****
  595. X--- 8,17 ----
  596. X  #include "globals.h"
  597. X  #include "protos.h"
  598. X  
  599. X+ #ifndef NL
  600. X+ #define NL "\n"
  601. X+ #endif
  602. X+ 
  603. X  /***************************************************************/
  604. X  /*                                                             */
  605. X  /*  TIMED.C                                                    */
  606. X***************
  607. X*** 158,166 ****
  608. X--- 162,187 ----
  609. X     long TimeToSleep;
  610. X     unsigned SleepTime;
  611. X     long now;
  612. X+ #ifdef SYSV
  613. X+    unsigned NotSlept;
  614. X+ #endif
  615. X  
  616. X     signal(SIGINT, SigIntHandler);
  617. X  
  618. X+     /* If we are not connected to a tty, then we must close the
  619. X+      * standard file descriptors. This is to prevent someone
  620. X+      * doing:
  621. X+      *        remind file | <filter> | >log
  622. X+      * and have <filter> hung because the child (us) is still
  623. X+      * connected to it. This means the only commands that will be
  624. X+      * processed correctly are RUN commands, provided they mail
  625. X+      * the result back or use their own resource (as a window).
  626. X+      */
  627. X+     if (!isatty(1) || !isatty(2)) {
  628. X+         close(1);
  629. X+         close(2);
  630. X+     }
  631. X+ 
  632. X     while (e = AtQueue.next) {
  633. X        now = SystemTime();
  634. X        TimeToSleep = (long) e->firsttime * 60L - now;
  635. X***************
  636. X*** 170,185 ****
  637. X           therefore, do the sleeping in 30000-second chunks. */
  638. X  
  639. X        while (TimeToSleep) {
  640. X!          if (TimeToSleep > 30000L) SleepTime = 30000;
  641. X!                               else SleepTime = (unsigned) TimeToSleep;
  642. X           sleep(SleepTime);
  643. X           TimeToSleep -= (long) SleepTime;
  644. X        }
  645. X  
  646. X        /* Over here, we trigger the reminder */
  647. X        DoSubst(e->text, WorkBuf, CurDay, CurMon, CurYear, JulianToday, e->type, e->time, 0);
  648. X        if (e->type == Run_t) system(WorkBuf);
  649. X!       else printf("%s\n", WorkBuf);
  650. X  
  651. X        /* Remove the entry from the queue */
  652. X        AtQueue.next = e->next;
  653. X--- 191,210 ----
  654. X           therefore, do the sleeping in 30000-second chunks. */
  655. X  
  656. X        while (TimeToSleep) {
  657. X!          SleepTime = (unsigned)((TimeToSleep > 30000L) ? 30000L : TimeToSleep);
  658. X! #ifdef SYSV
  659. X!          NotSlept = sleep(SleepTime);
  660. X!          TimeToSleep -= (long)(SleepTime - NotSlept);
  661. X! #else
  662. X           sleep(SleepTime);
  663. X           TimeToSleep -= (long) SleepTime;
  664. X+ #endif
  665. X        }
  666. X  
  667. X        /* Over here, we trigger the reminder */
  668. X        DoSubst(e->text, WorkBuf, CurDay, CurMon, CurYear, JulianToday, e->type, e->time, 0);
  669. X        if (e->type == Run_t) system(WorkBuf);
  670. X!       else printf("%s%s%s", NL, WorkBuf, NL);
  671. X  
  672. X        /* Remove the entry from the queue */
  673. X        AtQueue.next = e->next;
  674. X***************
  675. X*** 209,223 ****
  676. X  {
  677. X     AtEntry *e;
  678. X  
  679. X!    printf("Contents of AT queue:\n");
  680. X  
  681. X     e = AtQueue.next;
  682. X     while (e) {
  683. X!       printf("Trigger: %02d:%02d  Activate: %02d:%02d  Rep: %d  Delta: %d\n",
  684. X                e->time / 60, e->time % 60, e->firsttime / 60, e->firsttime % 60,
  685. X!               e->repeat, e->delta);
  686. X!       printf("Text: %s %s\n\n", ((e->type == Msg_t) ? "MSG" : "RUN"), e->text);
  687. X        e = e->next;
  688. X     }
  689. X!    printf("\n");
  690. X  }
  691. X--- 234,253 ----
  692. X  {
  693. X     AtEntry *e;
  694. X  
  695. X! #ifdef SYSV
  696. X!    signal(SIGINT, SigIntHandler);
  697. X! #endif
  698. X  
  699. X+    printf("Contents of AT queue:%s", NL);
  700. X+ 
  701. X     e = AtQueue.next;
  702. X     while (e) {
  703. X!       printf("Trigger: %02d:%02d  Activate: %02d:%02d  Rep: %d  Delta: %d%s",
  704. X                e->time / 60, e->time % 60, e->firsttime / 60, e->firsttime % 60,
  705. X!               e->repeat, e->delta, NL);
  706. X!       printf("Text: %s %s%s%s", ((e->type == Msg_t) ? "MSG" : "RUN"), e->text,
  707. X!               NL, NL);
  708. X        e = e->next;
  709. X     }
  710. X!    printf(NL);
  711. X  }
  712. SHAR_EOF
  713. $TOUCH -am 0717132591 patch-02 &&
  714. chmod 0600 patch-02 ||
  715. echo "restore of patch-02 failed"
  716. set `wc -c patch-02`;Wc_c=$1
  717. if test "$Wc_c" != "19150"; then
  718.     echo original size 19150, current size $Wc_c
  719. fi
  720. fi
  721. exit 0
  722.  
  723.  
  724. --
  725. David F. Skoll
  726.  
  727. exit 0 # Just in case...
  728. -- 
  729. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  730. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  731. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  732. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  733.