home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sources / misc / 4073 < prev    next >
Encoding:
Text File  |  1992-11-09  |  73.3 KB  |  2,269 lines

  1. Newsgroups: comp.sources.misc
  2. Path: sparky!kent
  3. From: dfs@doe.carleton.ca (David F. Skoll)
  4. Subject:  v33i068:  remind - A replacement for calendar, Part11/12
  5. Message-ID: <1992Nov10.042035.1434@sparky.imd.sterling.com>
  6. Followup-To: comp.sources.d
  7. X-Md4-Signature: f892ce4e2bb42672c29efbdf83626ec6
  8. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  9. Organization: Dept. of Electronics, Carleton University
  10. References: <csm-v33i058=remind.221714@sparky.IMD.Sterling.COM>
  11. Date: Tue, 10 Nov 1992 04:20:35 GMT
  12. Approved: kent@sparky.imd.sterling.com
  13. Lines: 2254
  14.  
  15. Submitted-by: dfs@doe.carleton.ca (David F. Skoll)
  16. Posting-number: Volume 33, Issue 68
  17. Archive-name: remind/part11
  18. Environment: UNIX, MS-DOS
  19. Supersedes: remind: Volume 17, Issue 3-6
  20.  
  21. #!/bin/sh
  22. # This is part 11 of Remind 03.00.00
  23. if touch 2>&1 | fgrep 'amc' > /dev/null
  24.  then TOUCH=touch
  25.  else TOUCH=true
  26. fi
  27. # ============= remind.1 ==============
  28. if test X"$1" != X"-c" -a -f 'remind.1'; then
  29.     echo "File already exists: skipping 'remind.1'"
  30. else
  31. echo "x - extracting remind.1 (Text)"
  32. sed 's/^X//' << 'SHAR_EOF' > remind.1 &&
  33. X.TH REMIND 1 "20 October 1992"
  34. X.UC4
  35. X.SH NAME
  36. Xremind \- a sophisticated reminder service
  37. X.SH SYNOPSIS
  38. X.B remind [\fIoptions\fR] \fIfilename\fR [\fIdate\fR]
  39. X.SH DESCRIPTION
  40. X\fBRemind\fR reads the supplied \fIfilename\fR and executes the commands
  41. Xfound in it.  The commands are used to issue reminders and alarms.  Each
  42. Xreminder or alarm can consist of a message sent to standard output, or
  43. Xa program to be executed.
  44. X.SH OPTIONS
  45. X.TP
  46. X.B \-n
  47. XThe \fB\-n\fR option causes \fBRemind\fR to print the \fBnext\fR occurrence
  48. Xof each reminder in a simple calendar format.  You can sort this by
  49. Xdate by piping the output through \fBsort(1)\fR.
  50. X.TP
  51. X.B \-r
  52. XThe \fB\-r\fR option disables \fBRUN\fR directives and the \fBshell()\fR
  53. Xfunction
  54. X.TP
  55. X.B \-c\fR\fIn\fR
  56. XThe \fB\-c\fR option causes \fBRemind\fR to produce a calendar which is sent to
  57. Xstandard output.  If you supply a number \fIn\fR, then a calendar will
  58. Xbe generated for \fIn\fR months, starting with the current month.  By
  59. Xdefault, a calendar for only the current month is produced.  If \fIn\fR
  60. Xstarts with '+', then a calendar for \fIn\fR weeks is produced.
  61. X.TP
  62. X.B \-w\fR\fIn\fR
  63. XThe \fB\-w\fR option specifies the output width of the formatted calendar,
  64. Xin columns.  By default, the calendar is formatted for an 80-column
  65. Xdevice.
  66. X.TP
  67. X.B \-s\fR\fIn\fR
  68. XThe \fB\-s\fR option is very similar to the \fB\-c\fR option, except
  69. Xthat the output calendar is not formatted.  It is listed in a "simple
  70. Xformat" which can be used as input for more sophisticated calendar-drawing
  71. Xprograms.
  72. X.TP
  73. X.B \-v
  74. XThe \fB\-v\fR option makes the output of \fBRemind\fR slightly more verbose.
  75. X.TP
  76. X.B \-o
  77. XThe \fB\-o\fR option causes \fBRemind\fR to ignore all \fBONCE\fR directives.
  78. X.TP
  79. X.B \-t
  80. XThe \fB\-t\fR option causes \fBRemind\fR to trigger all non-expired reminders,
  81. Xregardless of the \fIdelta\fR supplied for each reminder.
  82. X.TP
  83. X.B \-h
  84. XThe \fB\-h\fR option ("hush...") supresses certain warning and information
  85. Xmessages.  In particular, if no reminders are triggered, this mode
  86. Xproduces no output.
  87. X.TP
  88. X.B \-a
  89. XThe \fB\-a\fR option causes \fBRemind\fR not to immediately trigger timed
  90. Xreminders which would also be queued.
  91. X.TP
  92. X.B \-q
  93. XThe \fB\-q\fR option causes \fBRemind\fR not to queue timed reminders
  94. Xfor later execution.
  95. X.TP
  96. X.B \-f
  97. XThe \fB\-f\fR option causes \fBRemind\fR to remain in the foreground
  98. Xwhen processing queued reminders, rather than forking off
  99. Xa background process to handle them.
  100. X.TP
  101. X.B \-e
  102. XThe \fB\-e\fR option diverts error messages (normally sent to the
  103. Xstandard error stream) to the standard output stream.
  104. X.TP
  105. X.B \-d\fR\fIchars\fR
  106. XThe \fB-d\fR option enables certain debugging modes.  The \fIchars\fR
  107. Xspecify which modes to enable:
  108. X.RS 2
  109. X.TP
  110. X.B e
  111. XEcho all input lines
  112. X.TP
  113. X.B x
  114. XTrace all expression evaluation
  115. X.TP
  116. X.B t
  117. XDisplay all trigger date computation
  118. X.TP
  119. X.B v
  120. XDump the variable table after execution of the reminder script
  121. X.TP
  122. X.B l
  123. XEcho lines when displaying error messages
  124. X.RE
  125. X.TP
  126. X\fB\-b\fR[\fIn\fR]
  127. XSet the time format for the calendar and simple-calendar outputs.  \fIN\fR
  128. Xcan range from 0 to 2, with the default 0.  A value of 0 causes times
  129. Xto be inserted in 12-hour (am/pm) format.  1 causes times to be inserted
  130. Xin 24-hour format, and 2 inhibits the automatic insertion of times in the
  131. Xcalendar output.
  132. X.TP
  133. X\fB\-x\fR[\fIn\fR]
  134. XSets the iteration limit for the \fBSATISFY\fR clause of a \fBREM\fR
  135. Xcommand.  Defaults to 150.
  136. X.TP
  137. X\fB\-z\fR[\fIn\fR]
  138. XRuns \fBRemind\fR in the daemon mode.  If \fIn\fR is supplied, it
  139. Xspecifies how often (in minutes) \fBRemind\fR should wake up to
  140. Xcheck if the reminder script has been changed.  \fIN\fR defaults
  141. Xto 5, and can range from 5 to 60.  Note that the use of the
  142. X\fB\-z\fR option also enables the \fB\-f\fR option.
  143. X.PP
  144. XIf you supply a \fIdate\fR on the command line, it must consist of
  145. X\fIday month year\fR, where \fIday\fR is the day of the month,
  146. X\fImonth\fR is at least the first three letters of the English name
  147. Xof the month, and \fIyear\fR is a year (all 4 digits) from 1990 to
  148. Xabout 2075.  You can leave out the \fIday\fR, which then defaults to 1.
  149. X.PP
  150. XIf you do supply a \fIdate\fR on the command line, then \fBRemind\fR uses
  151. Xit, rather than the actual system date, as its notion of "today."
  152. XThis lets you create calendars for future months, or test to see
  153. Xhow your reminders will be triggered in the future.
  154. X.SH REMINDER FILES
  155. X.PP
  156. X\fBRemind\fR uses scripts to control its operation.  The commands
  157. Xinside a script can range from
  158. Xthe very simple and almost immediately understandable:
  159. X.PP
  160. X.nf
  161. X    REM 6 Jan MSG David's birthday
  162. X.fi
  163. X.PP
  164. Xto the baroque and obscure:
  165. X.PP
  166. X.nf
  167. X    REM [trigger(date(thisyear, 1, 1) + 180)] ++5 OMIT \\
  168. X    sat sun SKIP MSG [ord(thisyear-1980)] payment due %b!
  169. X.fi
  170. X.PP
  171. XA reminder file consists of commands, with one command per line.  Several
  172. Xlines can be continued using the backslash character, as in the above
  173. Xexample.  In this case, all of the concatenated lines are treated as a
  174. Xsingle line by \fBRemind\fR.  Note that if an error occurs, \fBRemind\fR
  175. Xreports the line number of the last line of a continued line.
  176. X.PP
  177. X\fBRemind\fR ignores blank lines, and lines beginning with the '#' or ';'
  178. Xcharacters.  You can use the semicolon as a comment character if you
  179. Xwish to pass a \fBRemind\fR script through the C pre-processor, which
  180. Xinterprets the '#' character as the start of a pre-processing
  181. Xdirective.
  182. X.PP
  183. X\fBRemind\fR is not case sensitive; you can generally use any mixture of upper-
  184. Xor lower-case for commands, parameters, invocation options, etc.
  185. X.SH THE REM COMMAND
  186. X.PP
  187. XThe most powerful command in a \fBRemind\fR script is the \fBREM\fR command.
  188. XThis command is responsible for issuing reminders.
  189. XIts syntax is:
  190. X.PP
  191. X.RS
  192. X\fBREM\fR [\fBONCE\fR] [\fIdate_spec\fR]
  193. X[\fIback\fR]
  194. X[\fIdelta\fR]
  195. X[\fIrepeat\fR]
  196. X[\fBSKIP\fR | \fBBEFORE\fR | \fBAFTER\fR]
  197. X[\fBOMIT\fR \fIomit_list\fR]
  198. X[\fBAT\fR \fItime\fR [\fItdelta\fR] [\fItrepeat\fR]]
  199. X[\fBUNTIL\fR \fIexpiry_date\fR]
  200. X\fBMSG\fR | \fBRUN\fR | \fBCAL\fR | \fBSATISFY\fR
  201. X.I body
  202. X.RE
  203. X.PP
  204. XThe parts of the \fBREM\fR command can be specified in any order, except
  205. Xthat the \fIbody\fR must come immediately after the \fBMSG\fR,
  206. X\fBRUN\fR, \fBCAL\fR or \fBSATISFY\fR keyword.
  207. X.PP
  208. XThe \fBREM\fR token is optional, providing that the remainder
  209. Xof the command cannot be mistaken for another \fBRemind\fR command
  210. Xsuch as \fBOMIT\fR or \fBRUN\fR.  The portion of the \fBREM\fR command
  211. Xbefore the \fBMSG\fR, \fBRUN\fR, \fBCAL\fR or \fBSATISFY\fR clause
  212. Xis called a \fItrigger\fR.
  213. X.PP
  214. X.B MSG, RUN, and CAL
  215. X.PP
  216. XThe keywords \fBMSG\fR, \fBRUN\fR and \fBCAL\fR denote the \fItype\fR
  217. Xof the reminder.  (\fBSATISFY\fR is more complicated and will be explained
  218. Xlater.)  A \fBMSG\fR type reminder simply prints a message to the standard
  219. Xoutput, after passing the \fIbody\fR through a special substitution filter,
  220. Xdescribed in the section "The Substitution Filter."  A \fBRUN\fR-type
  221. Xreminder also passes the \fIbody\fR through the substitution filter, but
  222. Xthen executes the result as a system command.  A \fBCAL\fR-type reminder
  223. Xis used only to place entries in the calendar produced when \fBRemind\fR
  224. Xis run with the \-c or \-s options.
  225. X.PP
  226. X.B DATE SPECIFICATIONS
  227. X.PP
  228. XA \fIdate_spec\fR consists of zero to four parts.
  229. XThese parts are
  230. X.I day
  231. X(day of month),
  232. X.I month
  233. X(month name),
  234. X.I year
  235. Xand
  236. X.I weekday.
  237. X.I Month
  238. Xand
  239. X.I weekday
  240. Xare the English names of months and weekdays.  At least the first three
  241. Xcharacters must be used.  The following are examples of the various parts of a
  242. X.I date_spec:
  243. X.TP
  244. X.I day:
  245. X1, 22, 31, 14, 3
  246. X.TP
  247. X.I month:
  248. XJANUARY, feb, March, ApR, may, Aug
  249. X.TP
  250. X.I year:
  251. X1990, 1993, 2030, 95 (interpreted as 1995).  The year can range
  252. Xfrom 1990 to 2075.
  253. X.TP
  254. X.I weekday:
  255. XMonday, tue, Wed, THU, Friday, saturday, sundAy
  256. X.PP
  257. XNote that there can be several
  258. X.I weekday
  259. Xcomponents separated by spaces in a
  260. X.I date_spec.
  261. X.PP
  262. X.B INTERPRETATION OF DATE SPECIFICATIONS
  263. X.PP
  264. XThe following examples show how date specifications are interpreted.
  265. X.PP
  266. X1. Null date specification - the reminder is triggered every day.
  267. XThe trigger date for a specific run is simply the current system date.
  268. X.PP
  269. X2. Only
  270. X.I day
  271. Xpresent.  The reminder is triggered on the specified day of each month.
  272. XThe trigger date for a particular run is the closest such day to the
  273. Xcurrent system date.  For example:
  274. X.nf
  275. X    REM 1 MSG First of every month.
  276. X    REM 31 MSG 31st of every month that has 31 days.
  277. X.fi
  278. X.PP
  279. X3. Only
  280. X.I month
  281. Xpresent.  The reminder is triggered every day of the specified month.
  282. XExample:
  283. X.nf
  284. X    REM Feb MSG Every day in February
  285. X.fi
  286. X.PP
  287. X4.
  288. X.I day
  289. Xand
  290. X.I month
  291. Xpresent.  Examples:
  292. X.nf
  293. X    REM 6 Jan MSG Every 6th of January
  294. X    REM Feb 29 MSG Every 29th of February
  295. X.fi
  296. X.PP
  297. X5.  Only
  298. X.I year
  299. Xpresent. Example:
  300. X.nf
  301. X    REM 1991 MSG Every day in 1991
  302. X.fi
  303. X.PP
  304. X6.
  305. X.I year
  306. Xand
  307. X.I day
  308. Xpresent.  Examples:
  309. X.nf
  310. X    REM 1 1990 MSG 1st of every month in 1990
  311. X    REM 1992 23 MSG 23rd of every month in 1992
  312. X.fi
  313. X.PP
  314. X7.
  315. X.I year
  316. Xand
  317. X.I month
  318. Xpresent.  Examples:
  319. X.nf
  320. X    REM Feb 1991 MSG Every day in Feb 1991
  321. X    REM 1992 September MSG Every day in Sept 1992
  322. X.fi
  323. X.PP
  324. X8.
  325. X.I year, month
  326. Xand
  327. X.I day
  328. Xpresent.  Examples:
  329. X.nf
  330. X    REM 8 Jan 1991 MSG 8th January 1991.
  331. X    REM 1992 March 9 MSG 9th March 1992.
  332. X.fi
  333. X.PP
  334. X9.
  335. X.I weekday
  336. Xonly.  Examples:
  337. X.nf
  338. X    REM Sat MSG Every Saturday
  339. X    REM Mon Tue Wed Thu Fri MSG Every working day
  340. X    REM Monday Wednesday MSG Every Monday and Wednesday
  341. X.fi
  342. X.PP
  343. X10.
  344. X.I weekday
  345. Xand
  346. X.I day
  347. Xpresent.  Examples:
  348. X.nf
  349. X    REM Sat 1 MSG First Saturday of every month
  350. X    REM Mon Tue Wed Thu Fri 15 \\
  351. X        MSG 1st working day after 15th of every month
  352. X.fi
  353. X.PP
  354. X11.
  355. X.I weekday
  356. Xand
  357. X.I month
  358. Xpresent.  Examples:
  359. X.nf
  360. X    REM Mon March MSG Every Monday in March
  361. X    REM Mon Tue Wed Thu Fri Feb MSG Every working day in February
  362. X.fi
  363. X.PP
  364. X12.
  365. X.I weekday, month
  366. Xand
  367. X.I day
  368. Xpresent.  Examples:
  369. X.nf
  370. X    REM Mon 1 March MSG First Monday in March
  371. X    REM Sat Sun 15 July MSG First Sat or Sun on or after 15 July
  372. X.fi
  373. X.PP
  374. X13.
  375. X.I weekday
  376. Xand
  377. X.I year
  378. Xpresent.  Example:
  379. X.nf
  380. X    REM Sat Sun 1991 MSG Every Saturday and Sunday in 1991
  381. X.fi
  382. X.PP
  383. X14.
  384. X.I weekday, day
  385. Xand
  386. X.I year
  387. Xpresent.  Examples:
  388. X.nf
  389. X    REM Mon 15 1990 MSG 1st Mon after 15th of every month in 1990
  390. X    REM Mon Tue Wed Thu Fri 1 1990 \\
  391. X        MSG 1st working day of every month in 1990
  392. X.fi
  393. X.PP
  394. X15.
  395. X.I weekday, month
  396. Xand
  397. X.I year
  398. Xpresent.  Example:
  399. X.nf
  400. X    REM Mon Wed 1991 Feb MSG Every Mon and Wed in Feb 1991.
  401. X.fi
  402. X.PP
  403. X16.
  404. X.I weekday, day, month
  405. Xand
  406. X.I year
  407. Xpresent.  Example:
  408. X.nf
  409. X    REM Mon Tue Wed Thu Fri 28 Oct 1990 \\
  410. X        MSG 1st working day on or after 28 October 1990.
  411. X.fi
  412. X.PP
  413. XNote that when both
  414. X.I weekday
  415. Xand
  416. X.I day
  417. Xare specified,
  418. X.B Remind
  419. Xchooses the first date on or after the specified
  420. X.I day
  421. Xwhich also satisfies the
  422. X.I weekday
  423. Xconstraint.  It does this by picking the first date on or after the specified
  424. X.I day
  425. Xwhich is listed in the list of
  426. X.I weekdays.
  427. XThus, a reminder like:
  428. X.PP
  429. X.nf
  430. X    REM Mon Tue 28 Oct 1990 MSG Hi
  431. X.fi
  432. X.PP
  433. Xwould be issued only on Monday, 29 October, 1990.  It would not be issued
  434. Xon Tuesday, 30 October, 1990, since the 29th is the first date to satisfy
  435. Xthe
  436. X.I weekday
  437. Xconstraints.
  438. X.PP
  439. X.B BACKWARD SCANNING
  440. X.PP
  441. XSometimes, it is necessary to specify a date as being a set amount of
  442. Xtime before another date.  For example, the last Monday in a given
  443. Xmonth is computed as the first Monday in the next month, minus 7 days.
  444. XThe \fIback\fR specification in the reminder is used in this case:
  445. X.PP
  446. X.nf
  447. X    REM Mon 1 -7 MSG Last Monday of every month.
  448. X.fi
  449. X.PP
  450. XA \fIback\fR is specified with one or two dashes followed by an integer.
  451. XThis causes \fBRemind\fR to move "backwards" from what would normally be the
  452. Xtrigger date.  The difference between \-\-7 and \-7 will be explained
  453. Xwhen the \fBOMIT\fR keyword is described.
  454. X.PP
  455. X.B ADVANCE WARNING
  456. X.PP
  457. XFor some reminders, it is appropriate to receive advance warning of the
  458. Xevent.  For example, you may wish to be reminded of someone's birthday
  459. Xseveral days in advance.  The \fIdelta\fR portion of the \fBREM\fR command
  460. Xachieves this.  It is specified as one or two "+" signs followed by a number
  461. X\fIn\fR.  Again, the difference between the "+" and "++" forms will
  462. Xbe explained under the \fBOMIT\fR keyword.
  463. X\fBRemind\fR will trigger the reminder on computed trigger date, as well as
  464. Xon each of the \fIn\fR days before the event.  Here are some examples:
  465. X.PP
  466. X.nf
  467. X    REM 6 Jan +5 MSG Remind me of birthday 5 days in advance.
  468. X.fi
  469. X.PP
  470. XThe above example would be triggered every 6th of January, as well as the
  471. X1st through 5th of January.
  472. X.PP
  473. X.B PERIODIC REMINDERS
  474. X.PP
  475. XWe have already seen some built-in mechanisms for certain types of
  476. Xperiodic reminders.  For example, an event occurring every Wednesday
  477. Xcould be specified as:
  478. X.PP
  479. X.nf
  480. X    REM Wed MSG Event!
  481. X.fi
  482. X.PP
  483. XHowever, events which do not repeat daily, weekly, monthly or yearly require
  484. Xanother approach.  The \fIrepeat\fR component of the \fBREM\fR command
  485. Xfills this need.  To use it, you must completely specify a date (year, month
  486. Xand day, and optionally weekday.)  The \fIrepeat\fR component is an asterisk
  487. Xfollowed by a number specifying the repetition period in days.
  488. X.PP
  489. XFor example, suppose you get paid every second Wednesday, and your
  490. Xlast payday was Wednesday, 28 October, 1992.  You can use:
  491. X.PP
  492. X.nf
  493. X    REM 28 Oct 1992 *14 MSG Payday
  494. X.fi
  495. X.PP
  496. XThis issues the reminder every 14 days, starting from the calculated trigger
  497. Xdate.  You can use \fIdelta\fR and \fIback\fR with \fIrepeat.\fR  Note,
  498. Xhowever, that the \fIback\fR is used only to compute the initial
  499. Xtrigger date; thereafter, the reminder repeats with the specified
  500. Xperiod.  Similarly, if you specify a weekday, it is used only to calculate
  501. Xthe initial date, and does not affect the repetition period.
  502. X.PP
  503. X.B EXPIRY DATES
  504. X.PP
  505. XSome reminders should be issued periodically for a certain time, but then
  506. Xexpire.  For example, suppose you have a class every Friday, and that your
  507. Xlast class is on 11 December 1992.  You can use:
  508. X.PP
  509. X.nf
  510. X    REM Fri UNTIL 11 Dec 1992 MSG Class today.
  511. X.fi
  512. X.PP
  513. XAnother example:  Suppose you have jury duty from 30 November 1992 until
  514. X4 December 1992.  The following reminder will issue the message every day
  515. Xof your jury duty, as well as 2 days ahead of time:
  516. X.PP
  517. X.nf
  518. X    REM 30 Nov 1992 *1 +2 UNTIL 4 Dec 1992 MSG Jury duty
  519. X.fi
  520. X.PP
  521. XNote that the \fIrepeat\fR of *1 is necessary; without it, the reminder
  522. Xwould be issued only on 30 November (and the two days preceding.)
  523. X.PP
  524. X.B THE ONCE KEYWORD
  525. X.PP
  526. XSometimes, it is necessary to ensure that reminders are run only once
  527. Xon a given day.  For example, if you have a reminder which makes a backup
  528. Xof your files every Friday:
  529. X.PP
  530. X.nf
  531. X    REM Fri RUN do_backup
  532. X.fi
  533. X.PP
  534. X(Here, \fIdo_backup\fR is assumed to be a program or shell script which
  535. Xdoes the work.)  If you run \fBRemind\fR from your .login script, for
  536. Xexample, and log in several times per day, the \fIdo_backup\fR program
  537. Xwill be run each time you log in.  If, however, you use the \fBONCE\fR
  538. Xkeyword in the reminder, the \fBRemind\fR checks the last access date of
  539. Xthe reminder script.  If it is the same as the current date, \fBRemind\fR
  540. Xassumes that it has already been run, and will not issue reminders containing
  541. Xthe \fBONCE\fR keyword.
  542. X.PP
  543. XNote that if you view or edit your reminder script, the last access date
  544. Xwill be updated, and the \fBONCE\fR keyword will not operate properly.
  545. XIf you start \fBRemind\fR with the \fB\-o\fR option, then the \fBONCE\fR
  546. Xkeyword will be ignored.
  547. X.PP
  548. X.B LOCALLY OMITTING WEEKDAYS
  549. X.PP
  550. XThe \fBOMIT\fR portion of the \fBREM\fR command is used to "omit" certain
  551. Xdays when counting the \fIdelta\fR or \fIback\fR.  It is specified using
  552. Xthe keyword \fBOMIT\fR followed by a list of weekdays.  Its action is
  553. Xbest illustrated with examples:
  554. X.PP
  555. X.nf
  556. X    REM 1 +1 OMIT Sat Sun MSG Important Event
  557. X.fi
  558. X.PP
  559. XThis reminder is normally triggered on the first of every month, as well
  560. Xas the day preceding it.  However, if the first of the month falls on a
  561. XSunday or Monday, then the reminder is triggered starting from the
  562. Xprevious Friday.  This is because the \fIdelta\fR of +1 does not count
  563. XSaturday or Sunday when it counts backwards from the trigger date to
  564. Xdetermine how much advance warning to give.
  565. X.PP
  566. XContrast this with the use of "++1" in the above command.  In this case,
  567. Xthe reminder is triggered on the first of each month, as well as the day
  568. Xpreceding it.  The omitted days are counted.
  569. X.PP
  570. X.nf
  571. X    REM 1 -1 OMIT Sat Sun MSG Last working day of month
  572. X.fi
  573. X.PP
  574. XAgain, in the above example, the \fIback\fR of \-1 normally causes the
  575. Xtrigger date to be the last day of the month.  However, because of the
  576. X\fBOMIT\fR clause, if the first of the month falls on a Sunday or Monday,
  577. Xthe trigger date is moved backwards past the weekend to Friday.  (If you
  578. Xhave globally omitted holidays, the reminder will be moved back past them,
  579. Xalso.  See "The OMIT command" for more details.)
  580. X.PP
  581. XBy comparison, if we had used "\-\-1", the reminder would be triggered on
  582. Xthe last day of the month, regardless of the \fBOMIT\fR.
  583. X.PP
  584. X.B TIMED REMINDERS
  585. X.PP
  586. XTimed reminders are those which have an \fBAT\fR keyword followed
  587. Xby a \fItime\fR and optional \fItdelta\fR and \fItrepeat\fR.  The \fItime\fR
  588. Xmust be specified in 24-hour format, with 0:00 representing midnight,
  589. X12:00 representing noon, and 23:59 representing one minute to midnight.
  590. X.PP
  591. X\fBRemind\fR treats timed reminders specially.  If the trigger date
  592. Xfor a timed reminder is the same as the current system date, the
  593. Xreminder is queued for later activation.  When \fBRemind\fR has
  594. Xfinished processing the reminder file,
  595. Xit puts itself in the background, and activates timed reminders when the
  596. Xsystem time reached the specified time.
  597. X.PP
  598. XIf the trigger date is \fInot\fR the same as the system date, the reminder
  599. Xis not queued.
  600. X.PP
  601. XFor example, the following reminder, triggered every working day, 
  602. Xwill emit a message telling you to
  603. Xleave at 5:00pm:
  604. X.PP
  605. X.nf
  606. X    REM Mon Tue Wed Thu Fri AT 17:00 MSG Time to leave!
  607. X.fi
  608. X.PP
  609. XThe following reminder will be triggered on Thursdays and Fridays,
  610. Xbut will only be queued on Fridays:
  611. X.PP
  612. X.nf
  613. X    REM Fri ++1 AT 13:00 MSG Lunch at 1pm Friday.
  614. X.fi
  615. X.PP
  616. XThe \fItdelta\fR and \fItrepeat\fR have the same form as a \fIrepeat\fR
  617. Xand \fIdelta\fR, but are specified in minutes.  For example, this reminder
  618. Xwill be triggered at 12:00pm as well as 45 minutes before:
  619. X.PP
  620. X.nf
  621. X    REM AT 12:00 +45 MSG Example
  622. X.fi
  623. X.PP
  624. XThe following will be issued starting at 10:45, every half hour until 11:45,
  625. Xand again at noon.
  626. X.PP
  627. X.nf
  628. X    REM AT 12:00 +75 *30 MSG Example2
  629. X.fi
  630. X.PP
  631. XThe "+75" means that the reminder is issued starting 75 minutes before noon;
  632. Xin other words, at 10:45.  The *30 specifies that the reminder is subsequently
  633. Xto be issued every 30 minutes.  Note that the reminder is always issued at
  634. Xthe specified time, even if the \fItdelta\fR is not a multiple of the
  635. X\fItrepeat\fR.  So the above example is issued at 10:45am, 11:15am, 11:45am,
  636. Xand 12:00pm.  Note that in the time specification, there is no distinction
  637. Xbetween the "+" and "++" forms of \fItdelta\fR.
  638. X.PP
  639. XNormally, \fBRemind\fR will issue timed reminders as it processes the reminder
  640. Xscript, as well as queuing them for later.  If you do not want \fBRemind\fR to
  641. Xissue the reminders when processing the script, but only to queue them
  642. Xfor later, use the \fB\-a\fR command-line option.  If you do not want
  643. Xreminders to be queued for later, use the \fB\-q\fR command-line
  644. Xoption.
  645. X.PP
  646. XNormally, \fBRemind\fR forks a background process to handle queued reminders.
  647. XIf you want \fBRemind\fR to remain in the foreground, use the \fB\-f\fR
  648. Xcommand-line option.  This is useful, for example, in .xinitrc
  649. Xscripts, where you can use the command:
  650. X.PP
  651. X.nf
  652. X    remind -fa myreminders &
  653. X.fi
  654. X.PP
  655. XThis ensures that when you exit X-Windows, the \fBRemind\fR process is killed.
  656. X.PP
  657. X.B WARNING ABOUT TIMED REMINDERS
  658. X.PP
  659. XNote:  If you use user-defined functions or variables (described later)
  660. Xin the bodies of timed reminders, then when the timed reminders are
  661. Xactivated, the variables and functions have the definitions which were
  662. Xin effect at the end of the reminder script.  These definitions may
  663. X\fInot\fR necessarily be those which were in effect at the time the reminder
  664. Xwas queued.
  665. X.PP
  666. X.SH THE SUBSTITUTION FILTER
  667. X.PP
  668. XBefore being processed, the body of a
  669. X.B REM
  670. Xcommand is passed through a substitution filter.  The filter scans for
  671. Xsequences "%x" (where "x" is any letter and certain other characters)
  672. Xand performs substitutions as
  673. Xshown below.  (All dates refer to the trigger date of the reminder.)
  674. X.TP
  675. X.B %a
  676. Xis replaced with "on \fIweekday, day month, year\fR"
  677. X.RS
  678. XFor example, consider the reminder:
  679. X.PP
  680. XREM 18 Oct 1990 +4 MSG Meeting with Bob %a.
  681. X.PP
  682. XOn 16 October 1990, it would print "Meeting with Bob on Thursday, 18 October,
  683. X1990."
  684. X.PP
  685. XOn 17 October 1990, it would print "Meeting with Bob tomorrow."
  686. X.PP
  687. XOn 18 October 1990, it would print "Meeting with Bob today."
  688. X.RE
  689. X.TP
  690. X.B %b
  691. Xis replaced with "in \fIdiff\fR day's time" where
  692. X.I diff
  693. Xis the
  694. X.B actual
  695. Xnumber of days between the current date and the trigger date.
  696. X(\fBOMITs\fR have no effect.)
  697. X.RS
  698. XFor example, consider:
  699. X.PP
  700. XREM 18 Oct 1990 +4 MSG Meeting with Bob %b.
  701. X.PP
  702. XOn 16 October 1990, it would print "Meeting with Bob in 2 days' time."
  703. X.PP
  704. XOn 17 October 1990, it would print "Meeting with Bob tomorrow."
  705. X.PP
  706. XOn 18 October 1990, it would print "Meeting with Bob today."
  707. X.RE
  708. X.TP
  709. X.B %c
  710. Xis replaced with "on \fIweekday\fR"
  711. X.RS
  712. XExample: REM 18 Oct 1990 +4 MSG Meeting with Bob %c.
  713. X.PP
  714. XOn 16 October 1990, it would print "Meeting with Bob on Thursday."
  715. X.PP
  716. XOn 17 October 1990, it would print "Meeting with Bob tomorrow."
  717. X.PP
  718. XOn 18 October 1990, it would print "Meeting with Bob today."
  719. X.RE
  720. X.TP
  721. X.B %d
  722. Xis replaced with "\fIday\fR", the day of the month.
  723. X.TP
  724. X.B %e
  725. Xis replaced with "on \fIdd/mm/yyyy\fR"
  726. X.TP
  727. X.B %f
  728. Xis replaced with "on \fImm/dd/yyyy\fR"
  729. X.TP
  730. X.B %g
  731. Xis replaced with "on \fIweekday, day month\fR"
  732. X.TP
  733. X.B %h
  734. Xis replaced with "on \fIdd/mm\fR"
  735. X.TP
  736. X.B %i
  737. Xis replaced with "on \fImm/dd\fR"
  738. X.TP
  739. X.B %j
  740. Xis replaced with "on \fIweekday, month day-th, year\fR"  This form appends the
  741. Xcharacters "st", "nd", "rd" or "th" to the day of the month, as appropriate.
  742. X.TP
  743. X.B %k
  744. Xis replaced with "on \fIweekday, month day-th\fR"
  745. X.TP
  746. X.B %l
  747. Xis replaced with "on \fIyyyy/mm/dd\fR"
  748. X.TP
  749. X.B %m
  750. Xis replaced with "\fImonth\fR", the name of the month.
  751. X.TP
  752. X.B %n
  753. Xis replaced with the number (1 to 12) of the month.
  754. X.TP
  755. X.B %o
  756. Xis replaced with " (today)" if and only if the current system date is the same
  757. Xas the date being used by
  758. X.B Remind
  759. Xas the current date.  Recall that you can specify a date for
  760. X.B Remind
  761. Xto use on the command line.  This substitution is not generally useful in a
  762. X.B REM
  763. Xcommand, but is useful in a
  764. X.B BANNER
  765. Xcommand.  (See "The BANNER Command.")
  766. X.TP
  767. X.B %p
  768. Xis replaced with "s" if the
  769. X.I diff
  770. Xbetween the current date and the trigger date is not 1.  You can use this
  771. Xto construct reminders like:
  772. X.RS
  773. XREM 1 Jan +4 MSG %x day%p to go before New Year!
  774. X.RE
  775. X.TP
  776. X.B %q
  777. Xis replaced with "'s" if the
  778. X.I diff
  779. Xbetween the trigger date and the current date is 1.  Otherwise, it is replaced
  780. Xwith "s'"  This can be used as follows:
  781. X.RS
  782. XREM 1 Jan +4 MSG New Year in %x day%q time!
  783. X.RE
  784. X.TP
  785. X.B %r
  786. Xis replaced with the day of the month (01 to 31) padded with a leading zero
  787. Xif needed to pad to two digits.
  788. X.TP
  789. X.B %s
  790. Xis replaced with "st", "nd", "rd" or "th" depending on the day of the month.
  791. X.TP
  792. X.B %t
  793. Xis replaced with the number of the month (01 to 12) padded to two digits
  794. Xwith a leading zero.
  795. X.TP
  796. X.B %u
  797. Xis replaced with "on \fIweekday, day-th month, year\fR"  This is similar
  798. Xto
  799. X.B %a
  800. Xexcept that "st", "nd", "rd" or "th" is added to the
  801. X.I day
  802. Xas appropriate.
  803. X.TP
  804. X.B %v
  805. Xis replaced with "on \fIweekday, day-th month\fR"
  806. X.TP
  807. X.B %w
  808. Xis replaced with "\fIweekday\fR", the name of the day of the week.
  809. X.TP
  810. X.B %x
  811. Xis replaced with the
  812. X.I diff
  813. Xbetween the current date and the trigger date.  The
  814. X.I diff
  815. Xis defined as the actual number of days between these two dates;
  816. X.B OMITs
  817. Xare not counted.  (Strict date subtraction is performed.)
  818. X.TP
  819. X.B %y
  820. Xis replaced with "\fIyear\fR", the year of the trigger date.
  821. X.TP
  822. X.B %z
  823. Xis replaced with "\fIyy\fR", the last two digits of the year.
  824. X.TP
  825. X.B %_
  826. X(percent-underscore) is replaced with a newline.  You can use this to
  827. Xachieve multi-line reminders.
  828. X.TP
  829. X.B %1
  830. Xis replaced with "now", "\fIm\fR minutes from now", "\fIm\fR minutes ago",
  831. X"\fIh\fR hours from now", "\fIh\fR hours ago", "\fIh\fR hours and \fIm\fR
  832. Xminutes from now" or "\fIh\fR hours and \fIm\fR minutes ago", as appropriate
  833. Xfor a timed reminder.  Note that unless you specify the \fB\-a\fR option,
  834. Xtimed reminders will be triggered like normal reminders, and thus a timed
  835. Xreminder which occurred earlier in the day may be triggered.  This
  836. Xcauses the need for the "...ago" forms.
  837. X.TP
  838. X.B %2
  839. Xis replaced with "at \fIhh\fR:\fImm\fRam" or "..pm" depending on the
  840. X.B AT
  841. Xtime of the reminder.
  842. X.TP
  843. X.B %3
  844. Xis replaced with "at \fIhh\fR:\fImm\fR" in 24-hour format.
  845. X.TP
  846. X.B %4
  847. Xis replaced with "\fImm\fR" where \fImm\fR is the number of minutes between
  848. X"now" and the time specified by \fBAT\fR.  If the \fBAT\fR time is
  849. Xearlier than the current time, then the result is negative.
  850. X.TP
  851. X.B %5
  852. Xis replaced with "\fIma\fR" where \fIma\fR is the absolute value of the number
  853. Xproduced by \fB%4\fR.
  854. X.TP
  855. X.B %6
  856. Xis replaced with "ago" or "from now", depending on the relationship between
  857. Xthe \fBAT\fR time and the current time.
  858. X.TP
  859. X.B %7
  860. Xis replaced with the number of hours between the \fBAT\fR time and the
  861. Xcurrent time.  It is always non-negative.
  862. X.TP
  863. X.B %8
  864. Xis replaced with the number of minutes between the \fBAT\fR time and
  865. Xthe current time, after the hours (\fB%7\fR) have been subtracted out.
  866. XThis is a number ranging from 0 to 59.
  867. X.TP
  868. X.B %9
  869. Xis replaced with "s" if the value produced by \fB%8\fR is not 1.
  870. X.TP
  871. X.B %0
  872. Xis replaced with "s" if the value produced by \fB%7\fR is not 1.
  873. X.TP
  874. X.B %!
  875. Xis replaced with "is" if the current time is before the \fBAT\fR time,
  876. Xor "was" if it is after.
  877. X.TP
  878. X.B %@
  879. Xis similar to \fB%2\fR but displays the current time.
  880. X.TP
  881. X.B %#
  882. Xis similar to \fB%3\fR but displays the current time.
  883. X.TP
  884. X.B 
  885. X%"
  886. X(percent-doublequote) is removed.  This sequence is not 
  887. Xused by the substitution filter,
  888. Xbut is used to tell \fBremind\fR which text to include in a calendar
  889. Xentry when the \fB\-c\fR option is chosen.  See "Calendar
  890. XMode"
  891. X.PP
  892. XNotes:
  893. X.TP
  894. Xo
  895. X.B Remind
  896. Xnormally prints a blank line after each reminder; if the last character
  897. Xof the body is "%", the blank line will not be printed.
  898. X.TP
  899. Xo
  900. XSubstitutions a, b, c, e, f, g, h, i, j, k, l, u and v all are replaced
  901. Xwith "today" if the current date equals the trigger date, or "tomorrow"
  902. Xif the trigger date is one day after the current date.  Thus, they are
  903. X.B not
  904. Xthe same as substitutions built up from the simpler %w, %y, etc.
  905. Xsequences.
  906. X.TP
  907. Xo
  908. XAny of the substitutions dealing with time (0 through 9 and '!')
  909. Xproduce undefined results if used in a reminder which does not have
  910. Xan \fBAT\fR keyword.  Also, if a reminder has a \fIdelta\fR and may
  911. Xbe triggered on several days, the time substitutions ignore the date.  Thus,
  912. Xthe \fB%1\fR substitution may report that a meeting is in 15 minutes, for
  913. Xexample, even though it may only be in 2 days time, because a \fIdelta\fR has
  914. Xtriggered the reminder.  It is recommended that you use the time substitutions
  915. Xonly in timed reminders with no \fIdelta\fR which are designed to be
  916. Xqueued for timed activation.
  917. X.TP 
  918. Xo
  919. XCapital letters can be used in the substitution sequence, in which case
  920. Xthe first character of the substituted string is capitalized (if it is
  921. Xnormally a lower-case letter.)
  922. X.TP 
  923. Xo
  924. XAll other characters following a "%" sign are simply copied.  In particular,
  925. Xto get a "%" sign out, use "%%" in the body.  To start the body of a reminder
  926. Xwith a space, use "% ", since
  927. X.B remind
  928. Xnormally scans for the first non-space character after a
  929. X.B MSG,
  930. X.B CAL
  931. Xor
  932. X.B RUN
  933. Xtoken.
  934. X.SH THE OMIT COMMAND
  935. X.PP
  936. XIn addition to being a keyword in the \fBREM\fR command,
  937. X\fBOMIT\fR is a command in its own right.  Its syntax is:
  938. X.PP
  939. X.RS
  940. X\fBOMIT\fR \fIday\fR \fImonth\fR [\fIyear\fR]
  941. X.RE
  942. X.PP
  943. XThe \fBOMIT\fR command is used to "globally" omit certain days, which
  944. Xare usually holidays.  These globally-omitted days are skipped by the
  945. X"\-" and "+" forms of \fIback\fR and \fIdelta\fR.  Some examples:
  946. X.PP
  947. X.nf
  948. X    OMIT 1 Jan
  949. X    OMIT 7 Sep 1992
  950. X.fi
  951. X.PP
  952. XThe first example specifies a holiday which occurs on the same date each
  953. Xyear - New Year's Day.  The second example specifies a holiday which
  954. Xchanges each year - Labour Day.  For these types of holidays, you
  955. Xmust create an \fBOMIT\fR command for each year.  (Later, in the
  956. Xdescription of expressions and some of the more advanced features of
  957. X\fBRemind\fR, you will see how to automate this for some cases.)
  958. X.PP
  959. XFor convenience, you can use a \fIdelta\fR and \fBMSG\fR or \fBRUN\fR
  960. Xkeyword in the \fBOMIT\fR command.  The following sequences are exactly
  961. Xequivalent:
  962. X.PP
  963. X.nf
  964. X    OMIT 1 Jan
  965. X    REM 1 Jan +4 MSG New year's day is %b!
  966. X
  967. X    and
  968. X
  969. X    OMIT 1 Jan +4 MSG New year's day is %b!
  970. X.fi
  971. X.PP
  972. X.B THE BEFORE, AFTER AND SKIP KEYWORDS
  973. X.PP
  974. XNormally, days which are omitted, whether by a global \fBOMIT\fR command
  975. Xor the local \fBOMIT\fR keyword in a \fBREM\fR statement, only affect the
  976. Xcounting of the \-\fIback\fR or the +\fIdelta\fR.  For example, suppose
  977. Xyou have a meeting every Wednesday.  Suppose, too, that you have indicated
  978. X11 Nov as a holiday:
  979. X.PP
  980. X.nf
  981. X    OMIT 11 Nov +4 MSG Remembrance Day
  982. X    REM Wed +1 MSG Code meeting %b.
  983. X.fi
  984. X.PP
  985. XThe above sequence will issue a reminder about a meeting for 11 November 1992,
  986. Xwhich is a Wednesday.  This is probably incorrect.  There are three
  987. Xoptions:
  988. X.TP
  989. X.B BEFORE
  990. XThis keyword moves the reminder to before any omitted days.  Thus, in
  991. Xthe above example, use of \fBBEFORE\fR would cause the meeting reminder
  992. Xto be triggered on Tuesday, 10 November 1992.
  993. X.TP
  994. X.B AFTER
  995. XThis keyword moves the reminder to after any omitted days.  In the above
  996. Xexample, the meeting reminder would be triggered on Thursday, 12 November
  997. X1992.
  998. X.TP
  999. X.B SKIP
  1000. XThis keyword causes the reminder to be skipped completely on any omitted
  1001. Xdays.  Thus, in the above example, the reminder would not be triggered
  1002. Xon 11 November 1992.  However, it would be triggered as usual on the following
  1003. XWednesday, 18 November 1992.
  1004. X.PP
  1005. XThe \fBBEFORE\fR and \fBAFTER\fR keywords move the trigger date of a
  1006. Xreminder to before or after a block of omitted days, respectively.
  1007. XSuppose you normally run a backup on the first day of the month.  However,
  1008. Xif the first day of the month is a weekend or holiday, you run the backup
  1009. Xon the first working day following the weekend or holiday.  You could use:
  1010. X.PP
  1011. X.nf
  1012. X    REM 1 OMIT Sat Sun AFTER RUN do_backup
  1013. X.fi
  1014. X.PP
  1015. XLet's examine how the trigger date is computed.  The \fB1\fR specifies
  1016. Xthe first day of the month.  The local \fBOMIT\fR keyword causes the
  1017. X\fBAFTER\fR keyword to move the reminder forward past weekends.
  1018. XFinally, the \fBAFTER\fR keyword will keep moving the reminder forward
  1019. Xuntil it has passed any holidays specified with global \fBOMIT\fR
  1020. Xcommands.
  1021. X.SH THE INCLUDE COMMAND
  1022. X.PP
  1023. X\fBRemind\fR allows you to include other files in your reminder script,
  1024. Xsimilar to the C preprocessor #include directive.  For example, your
  1025. Xsystem administrator may maintain a file of holidays or system-wide
  1026. Xreminders.  You can include these in your reminder script as follows:
  1027. X.PP
  1028. X.nf
  1029. X    INCLUDE /usr/share/remind/holidays
  1030. X    INCLUDE /usr/share/remind/reminders
  1031. X.fi
  1032. X.PP
  1033. X(The actual pathnames vary from system to system - ask your system
  1034. Xadministrator.)
  1035. X.PP
  1036. X\fBINCLUDE\fR files can be nested up to a depth of 8.
  1037. X.PP
  1038. X.SH THE RUN COMMAND
  1039. X.PP
  1040. XIf you include other files in your reminder script, you may not always
  1041. Xentirely "trust" the contents of the other files.  For example, they
  1042. Xmay contain \fBRUN\fR-type reminders which could be used to access your
  1043. Xfiles or perform undesired actions.  The \fBRUN\fR command can restrict
  1044. Xthis:  If you include the command \fBRUN OFF\fR in your top-level reminder
  1045. Xscript, any reminder or expression which would normally execute a system
  1046. Xcommand is disabled.  \fBRUN ON\fR will re-enable the execution of
  1047. Xsystem commands.  Note that the \fBRUN\fR command can \fIonly\fR be used
  1048. Xin your top-level reminder script; it will \fInot\fR work in any files
  1049. Xaccessed by the \fBINCLUDE\fR command.  This is to protect you from someone
  1050. Xplacing a \fBRUN ON\fR command in an included file.
  1051. X.PP
  1052. XIf you run \fBRemind\fR with the \fB\-r\fR command-line option,
  1053. X\fBRUN\fR-type reminders and the \fBshell()\fR function will be disabled,
  1054. Xregardless of any \fBRUN\fR commands in the reminder script.
  1055. X.PP
  1056. XOne use of the \fBRUN\fR command is to provide a secure interface
  1057. Xbetween \fBRemind\fR and the \fBElm\fR mail system.  The \fBElm\fR
  1058. Xsystem can automatically scan incoming mail for reminder or calendar
  1059. Xentries, and place them in your calendar file.  To use this feature,
  1060. Xyou should set the calendar filename option under \fBElm\fR to be something
  1061. Xlike "~/.reminders.in", \fInot\fR your main reminder file!  This is
  1062. Xso that any \fBRUN ON\fR commands mailed to you can never be activated.
  1063. X.PP
  1064. XThen, you can use the \fBElm\fR \fIscan message for calendar entries\fR
  1065. Xcommand to place reminders prefaced by "->" into .reminders.in.  In
  1066. Xyour main .reminders file, include the following lines:
  1067. X.PP
  1068. X.nf
  1069. X    RUN OFF   # Disable RUN
  1070. X    INCLUDE .reminders.in
  1071. X    RUN ON    # Re-enable RUN
  1072. X.fi
  1073. X.PP
  1074. X.SH THE BANNER COMMAND
  1075. X.PP
  1076. XWhen \fBRemind\fR first issues a reminder, it prints a message like this:
  1077. X.PP
  1078. X.nf
  1079. X    Reminders for Friday, 30th October, 1992 (today):
  1080. X.fi
  1081. X.PP
  1082. XThe \fBBANNER\fR command lets you change the format.  It should appear
  1083. Xbefore any \fBREM\fR commands.  The format is:
  1084. X.PP
  1085. X.RS
  1086. X\fBBANNER\fR \fIformat\fR
  1087. X.RE
  1088. X.PP
  1089. XThe \fIformat\fR is similar to the \fIbody\fR of a \fBREM\fR command.  It
  1090. Xis passed through the substitution filter, with an implicit trigger of
  1091. Xthe current system date.  Thus, the default banner is equivalent to:
  1092. X.PP
  1093. X.nf
  1094. X    BANNER Reminders for %w, %d%s %m, %y%o:
  1095. X.fi
  1096. X.PP
  1097. XYou can disable the banner completely with BANNER %.  Or you can create
  1098. Xa custom banner:
  1099. X.PP
  1100. X.nf
  1101. X    BANNER Hi - here are your reminders for %y/%t/%r:
  1102. X.fi
  1103. X.SH CONTROLLING THE OMIT CONTEXT
  1104. X.PP
  1105. XSometimes, it is necessary to temporarily change the global \fBOMITs\fR
  1106. Xwhich are in force for a few reminders.  Three commands allow you to do
  1107. Xthis:
  1108. X.TP
  1109. X.B PUSH-OMIT-CONTEXT
  1110. XThis command saves the current global \fBOMITs\fR on an internal stack.
  1111. X.TP
  1112. X.B CLEAR-OMIT-CONTEXT
  1113. XThis command clears all of the global \fBOMITs\fR, starting you off with
  1114. Xa "clean slate."
  1115. X.TP
  1116. X.B POP-OMIT-CONTEXT
  1117. XThis command restores the global \fBOMITs\fR which were saved by the most
  1118. Xrecent \fBPUSH-OMIT-CONTEXT\fR.
  1119. X.PP
  1120. XFor example, suppose you have a block of reminders which require a clear
  1121. X\fBOMIT\fR context, and that they also introduce unwanted global \fBOMITs\fR
  1122. Xwhich could interfere with later reminders.  You could use the following
  1123. Xfragment:
  1124. X.PP
  1125. X.nf
  1126. X    PUSH-OMIT-CONTEXT    # Save the current context
  1127. X    CLEAR-OMIT-CONTEXT    # Clean the slate
  1128. X    # Block of reminders goes here
  1129. X    POP-OMIT-CONTEXT    # Restore the saved omit context
  1130. X.fi
  1131. X.SH EXPRESSIONS
  1132. X.PP
  1133. XIn certain contexts, to be described later, \fBRemind\fR will accept
  1134. Xexpressions for evaluation.  \fBRemind\fR expressions resemble C
  1135. Xexpressions, but operate on different types of objects.
  1136. X.PP
  1137. X.B DATA TYPES
  1138. X.PP
  1139. X\fBRemind\fR expressions understand four types of objects:
  1140. X.TP
  1141. X.B INT
  1142. XThe \fBINT\fR data type consists of the integers representable in one machine
  1143. Xword.  The \fBINT\fR data type corresponds to the C "int" type.
  1144. X.TP
  1145. X.B STRING
  1146. XThe \fBSTRING\fR data type consists of strings of characters.  It is
  1147. Xsomewhat comparable to a C character array, but more closely resembles
  1148. Xthe string type in BASIC.
  1149. X.TP
  1150. X.B TIME
  1151. XThe \fBTIME\fR data type consists of times of the day.  The \fBTIME\fR
  1152. Xdata type is internally stored as an integer representing the number
  1153. Xof minutes since midnight.
  1154. X.TP
  1155. X.B DATE
  1156. XThe \fBDATE\fR data type consists of dates (later than 1 January 1990.)
  1157. XInternally, \fBDATE\fR objects are stored as the number of days since
  1158. X1 January 1990.
  1159. X.PP
  1160. X.B CONSTANTS
  1161. X.PP
  1162. XThe following examples illustrate constants in \fBRemind\fR expressions:
  1163. X.TP
  1164. X.B INT constants
  1165. X12, 36, -10, 0, 1209
  1166. X.TP
  1167. X.B STRING constants
  1168. X"Hello there", "This is a test", "\\n\\gosd\\w", ""
  1169. X.PP
  1170. X.RS
  1171. XNote that the empty string is represented by "", and that
  1172. Xbackslashes in a string are \fInot\fR interpreted specially, as in they are
  1173. Xin C.
  1174. X.RE
  1175. X.TP
  1176. X.B TIME constants
  1177. X12:33, 0:01, 14:15, 16:42
  1178. X.PP
  1179. X.RS
  1180. XNote that \fBTIME\fR constants are written in 24-hour format
  1181. X.RE
  1182. X.TP
  1183. X.B DATE constants
  1184. X\fBDATE\fR constants have no readable representation.  They must be
  1185. Xcreated with the \fBdate()\fR function, which takes the year, month
  1186. Xand day as arguments:
  1187. X.PP
  1188. X.RS
  1189. Xdate(1992, 2, 29), date(1996, 4, 2), date(2001, 12, 17)
  1190. X.PP
  1191. XHowever, \fBDATE\fR constants are \fIprinted\fR as
  1192. X\fIyyyy\fR/\fImm\fR/\fIdd\fR.
  1193. X.RE
  1194. X.PP
  1195. X.B OPERATORS
  1196. X.PP
  1197. X\fIRemind\fR has the following operators.  Operators on the same line
  1198. Xhave equal precedence, while operators on lower lines have lower precedence
  1199. Xthan those on higher lines.  The operators approximately correspond to
  1200. XC operators.
  1201. X.PP
  1202. X.nf
  1203. X    !  -     (unary logical negation and arithmetic negation)
  1204. X    *  /  %        
  1205. X    +  -
  1206. X    <  <=  >  >=
  1207. X    ==  !=
  1208. X    &&
  1209. X    ||
  1210. X.fi
  1211. X.PP
  1212. X.B DESCRIPTION OF OPERATORS
  1213. X.PP
  1214. X.TP
  1215. X.B !
  1216. XLogical negation.  Can be applied to an \fBINT\fR type.  If the operand
  1217. Xis non-zero, returns zero.  Otherwise, returns 1.
  1218. X.TP
  1219. X.B \-
  1220. XUnary minus.  Can be applied to an \fBINT\fR.  Returns the negative
  1221. Xof the operand.
  1222. X.TP
  1223. X.B *
  1224. XMultiplication.  Returns the product of two \fBINT\fRs.
  1225. X.TP
  1226. X.B /
  1227. XInteger division.  Returns the quotient of two \fBINT\fRs, discarding the
  1228. Xremainder.
  1229. X.TP
  1230. X.B %
  1231. XModulus.  Returns the remainder upon dividing one \fBINT\fR by another.
  1232. X.TP
  1233. X.B +
  1234. XHas several uses.  These are:
  1235. X.PP
  1236. X.RS
  1237. X\fBINT\fR + \fBINT\fR - returns the sum of two \fBINT\fRs.
  1238. X.PP
  1239. X\fBINT\fR + \fBTIME\fR or \fBTIME\fR + \fBINT\fR - returns a \fBTIME\fR
  1240. Xobtained by adding
  1241. X\fBINT\fR minutes to the original \fBTIME\fR.
  1242. X.PP
  1243. X\fBINT\fR + \fBDATE\fR or \fBDATE\fR + \fBINT\fR - returns a \fBDATE\fR
  1244. Xobtained by adding \fBINT\fR days to the original \fBDATE\fR.
  1245. X.PP
  1246. X\fBSTRING\fR + \fBSTRING\fR - returns a \fBSTRING\fR which is the
  1247. Xconcatenation of the two orignal
  1248. X\fBSTRING\fRs.
  1249. X.PP
  1250. X\fBSTRING\fR + anything or anything + \fBSTRING\fR -
  1251. Xconverts the non-\fBSTRING\fR
  1252. Xargument to a \fBSTRING\fR, and then performs concatenation.  See
  1253. Xthe \fBcoerce()\fR function.
  1254. X.RE
  1255. X.TP
  1256. X.B \-
  1257. XHas several uses.  These are:
  1258. X.PP
  1259. X.RS
  1260. X\fBINT\fR - \fBINT\fR - returns the difference of two \fBINT\fRs.
  1261. X.PP
  1262. X\fBDATE\fR - \fBDATE\fR - returns (as an \fBINT\fR) the difference in days
  1263. Xbetween two \fBDATE\fRs.
  1264. X.PP
  1265. X\fBTIME\fR - \fBTIME\fR - returns (as an \fBINT\fR) the difference in minutes
  1266. Xbetween two \fBTIME\fRs.
  1267. X.PP
  1268. X\fBDATE\fR - \fBINT\fR - returns a \fBDATE\fR which is \fBINT\fR days
  1269. Xearlier than
  1270. Xthe original \fBDATE\fR.
  1271. X.PP
  1272. X\fBTIME\fR - \fBINT\fR - returns a \fBTIME\fR which is \fBINT\fR minutes
  1273. Xearlier
  1274. Xthan the original \fBTIME\fR.
  1275. X.RE
  1276. X.TP
  1277. X.B <, <=, >, and >=
  1278. XThese are the comparison operators.  They can take operands of any type,
  1279. Xbut both operands must be of the same type.  The comparison operators
  1280. Xreturn 1 if the comparison is true, or 0 if it is false.  Note that
  1281. Xstring comparison is done following the lexical ordering of
  1282. Xcharacters on your system, and that upper and lower case \fIare\fR
  1283. Xdistinct for these operators.
  1284. X.TP
  1285. X.B ==, !=
  1286. X== tests for equality, returning 1 if its operands are equal, and
  1287. X0 if they are not.  != tests for inequality.
  1288. X.PP
  1289. X.RS
  1290. XIf the operands are not of the same type, == returns 0 and != returns
  1291. X1.  Again, string comparisons are case-sensitive.
  1292. X.RE
  1293. X.TP
  1294. X.B &&
  1295. XThis is the logical AND operator.  Both of its operands must be of
  1296. Xtype \fBINT\fR.  It returns 1 if both operands are non-zero, and 0
  1297. Xotherwise.
  1298. X.TP
  1299. X.B ||
  1300. XThis is the logical OR operator.  Both of its operands must be of
  1301. Xtype \fBINT\fR.  It returns 1 if either operand is non-zero, and 0
  1302. Xotherwise.
  1303. X.PP
  1304. X.B NOTES
  1305. X.PP
  1306. XOperators of equal precedence are \fIalways\fR evaluated from left
  1307. Xto right, except where parentheses dictate otherwise.  This is important,
  1308. Xbecause the enhanced "+" and "\-" operators are not necessarily associative.
  1309. XFor example:
  1310. X.PP
  1311. X.nf
  1312. X    1 + 2 + "string" + 3 + 4  yields "3string34"
  1313. X    1 + (2 + "string") + (3 + 4)  yields "12string7"
  1314. X    12:59 + 1 + "test"  yields "13:00test"
  1315. X    12:59 + (1 + "test")  yields "12:591test"
  1316. X.fi
  1317. X.PP
  1318. XThe logical operators are \fInot\fR so-called short-circuit operators, as
  1319. Xthey are in C.  Both operands are always evaluated.  Thus, an expression
  1320. Xsuch as:
  1321. X.PP
  1322. X.nf
  1323. X    (f!=0) && (100/f <= 3)
  1324. X.fi
  1325. X.PP
  1326. Xwill cause an error if f is zero.
  1327. X.PP
  1328. X.B VARIABLES
  1329. X.PP
  1330. X\fBRemind\fR allows you to assign values to variables.  The \fBSET\fR
  1331. Xcommand is used as follows:
  1332. X.PP
  1333. X\fBSET\fR \fIvar\fR \fIexpr\fR
  1334. X.PP
  1335. X\fIVar\fR is the name of a variable.  It must start with a letter or
  1336. Xunderscore, and consist only of letters, digits and underscores.  Only
  1337. Xthe first 12 characters of a variable name are significant.  Variable
  1338. Xnames are \fInot\fR case sensitive; thus, "Afoo" and "afOo" are the same
  1339. Xvariable.  Examples:
  1340. X.PP
  1341. X.nf
  1342. X    SET a 10 + (9*8)
  1343. X    SET b "This is a test"
  1344. X    SET mydir getenv("HOME")
  1345. X    SET time 12:15
  1346. X    SET date today()
  1347. X.fi
  1348. X.PP
  1349. XNote that variables themselves have no type.  They take on the type of
  1350. Xwhatever you store in them.
  1351. X.PP
  1352. XTo delete a variable, use the \fBUNSET\fR command:
  1353. X.PP
  1354. X\fBUNSET\fR \fIvar\fR [\fIvar\fR...]
  1355. X.PP
  1356. XFor example, to delete all the variables declared above, use:
  1357. X.PP
  1358. X.nf
  1359. X    UNSET a b mydir time date
  1360. X.fi
  1361. X.PP
  1362. X.B BUILT-IN FUNCTIONS
  1363. X.PP
  1364. X\fBRemind\fR has a plethora of built-in functions.  The syntax for a function
  1365. Xcall is the same as in C - the function name, followed a comma-separated list
  1366. Xof arguments in parentheses.  Function names are not case-sensitive.  If
  1367. Xa function takes no arguments, it must be followed by "()" in the function
  1368. Xcall.  Otherwise, \fBRemind\fR will interpret it as a variable name,
  1369. Xand probably not work correctly.
  1370. X.PP
  1371. XIn the descriptions below, short forms are used to denote acceptable
  1372. Xtypes for the arguments.  The characters "i", "s", "d" and "t" denote
  1373. X\fBINT\fR, \fBSTRING\fR, \fBDATE\fR and \fBTIME\fR arguments,
  1374. Xrespectively.  If an argument can be one of several types, the characters
  1375. Xare concatenated.  For example, "di_arg" denotes an argument which can be
  1376. Xa \fBDATE\fR or an \fBINT\fR.  "x_arg" denotes an argument which can be
  1377. Xof any type.  The type of the argument is followed by
  1378. Xan underscore and an identifier naming the argument, for convenience.
  1379. X.PP
  1380. XThe built-in functions are:
  1381. X.TP
  1382. X.B abs(i_num)
  1383. XReturns the absolute value of \fInum\fR.
  1384. X.TP
  1385. X.B access(s_file, si_mode)
  1386. XTests the access permissions for the file \fIfile\fR.  \fIMode\fR can
  1387. Xbe a string, containing a mix of the characters "rwx" for read,
  1388. Xwrite and execute permission testing.  Alternatively, \fImode\fR can
  1389. Xbe a number as described in the Unix \fBaccess\fR(2) system call.  The
  1390. Xfunction returns 0 if the file can be accessed with the specified \fImode\fR,
  1391. Xand -1 otherwise.
  1392. X.TP
  1393. X.B asc(s_string)
  1394. XReturns an \fBINT\fR which is the ASCII code of the first character
  1395. Xin \fIstring\fR.  As a special case, \fBasc("")\fR returns 0.
  1396. X.TP
  1397. X.B baseyr()
  1398. XReturns the "base year" which was compiled into \fBRemind\fR (normally
  1399. X1990.)  All dates are stored internally as the number of days since
  1400. X1 January of \fBbaseyr()\fR.
  1401. X.TP
  1402. X.B char(i_i1 [,i_i2...])
  1403. XThis function can take any number of \fBINT\fR arguments.  It returns
  1404. Xa \fBSTRING\fR consisting of the characters specified by the arguments.
  1405. XNote that none of the arguments can be 0, unless there is only one
  1406. Xargument.  As a special case, \fBchar(0)\fR returns "".
  1407. X.TP
  1408. X.B choose(i_index, x_arg1 [,x_arg2...])
  1409. X\fBChoose\fR must take at least two arguments, the first of which is
  1410. Xan \fBINT\fR.  If \fIindex\fR is \fIn\fR, then the \fIn\fRth subsequent
  1411. Xargument is returned.  If \fIindex\fR is less than 1, then \fIarg1\fR
  1412. Xis returned.  If \fIindex\fR is greater than the number of subsequent
  1413. Xarguments, then the last argument is returned.  Examples:
  1414. X.PP
  1415. X.nf
  1416. X        \fBchoose(0, "foo", 1:13, 1000)\fR returns "foo"
  1417. X        \fBchoose(1, "foo", 1:13, 1000)\fR returns "foo"
  1418. X        \fBchoose(2, "foo", 1:13, 1000)\fR returns 1:13
  1419. X        \fBchoose(3, "foo", 1:13, 1000)\fR returns 1000
  1420. X        \fBchoose(4, "foo", 1:13, 1000)\fR returns 1000
  1421. X.fi
  1422. X.RS
  1423. XNote that all arguments to \fBchoose()\fR are \fIalways\fR
  1424. Xevaluated.
  1425. X.RE
  1426. X.TP
  1427. X.B coerce(s_type, x_arg)
  1428. XThis function converts \fIarg\fR to the specified \fItype\fR, if such
  1429. Xconversion is possible.  \fIType\fR must be one of "INT", "STRING",
  1430. X"DATE" or "TIME" (case-insensitive).
  1431. XThe conversion rules are as follows:
  1432. X.RS
  1433. X.PP
  1434. XIf \fIarg\fR is already of the \fItype\fR specified, it is returned
  1435. Xunchanged.
  1436. X.PP
  1437. XIf \fItype\fR is "STRING", then \fIarg\fR is converted to a string
  1438. Xconsisting of its printed representation.
  1439. X.PP
  1440. XIf \fItype\fR is "DATE", then an \fBINT\fR \fIarg\fR is converted
  1441. Xby interpreting it as the number of days since 1 January \fBbaseyr()\fR.
  1442. XA \fBSTRING\fR \fIarg\fR is converted by attempting to read it as if
  1443. Xit were a printed date.  A \fBTIME\fR \fIarg\fR cannot be converted to
  1444. Xa date.
  1445. X.PP
  1446. XIf \fItype\fR is "TIME", then an \fBINT\fR \fIarg\fR is converted
  1447. Xby interpreting it as the number of minutes since midnight.
  1448. XA \fBSTRING\fR \fIarg\fR is converted by attempting to read it as if
  1449. Xit were a printed time.  A \fBDATE\fR \fIarg\fR cannot be converted to
  1450. Xa time.
  1451. X.PP
  1452. XIf \fItype\fR is "INT", then \fBDATE\fR and \fBTIME\fR arguments are
  1453. Xconverted using the reverse of procedures described above.  A
  1454. X\fBSTRING\fR \fIarg\fR is converted by parsing it as an integer.
  1455. X.RE
  1456. X.TP
  1457. X.B date(i_y, i_m, i_d)
  1458. XThe \fBdate()\fR function returns a \fBDATE\fR object with the year,
  1459. Xmonth and day components specified by \fIy\fR, \fIm\fR and \fId\fR.
  1460. X.TP
  1461. X.B day(d_date)
  1462. XThis function takes a \fBDATE\fR as an argument, and returns an \fBINT\fR
  1463. Xwhich is the day-of-month component of \fIdate\fR.
  1464. X.TP
  1465. X.B daysimon(i_m, i_y)
  1466. XReturns the number of days in month \fIm\fR (1-12) of the year \fIy\fR.
  1467. X.TP
  1468. X.B defined(s_var)
  1469. XReturns 1 if the variable named by \fIvar\fR is defined, or 0 if it is not.
  1470. X.RS
  1471. XNote that \fBdefined()\fR takes a \fBSTRING\fR argument; thus, to check
  1472. Xif variable X is defined, use:
  1473. X.PP
  1474. X.nf
  1475. X        defined("X")
  1476. X.fi
  1477. X.PP
  1478. Xand not:
  1479. X.PP
  1480. X.nf
  1481. X        defined(X)
  1482. X.fi
  1483. X.PP
  1484. XThe second example will attempt to evaluate X, and will return an
  1485. Xerror if it is undefined or not of type \fBSTRING\fR.
  1486. X.RE
  1487. X.TP
  1488. X.B filename()
  1489. XReturns (as a \fBSTRING\fR) the name of the current file being processed
  1490. Xby \fBRemind\fR.  Inside included files, returns the name of the
  1491. Xincluded file.
  1492. X.TP
  1493. X.B getenv(s_envvar)
  1494. XSimilar to the \fBgetenv\fR(2) system call.  Returns a string representing
  1495. Xthe value of the specified environment variable.  Returns "" if the
  1496. Xenvironment variable is not defined.  Note that the names of environment
  1497. Xvariables are generally case-sensitive; thus, getenv("HOME") is not
  1498. Xthe same as getenv("home").
  1499. X.TP
  1500. X.B hour(t_time)
  1501. XReturns the hour component of \fItime\fR.
  1502. X.TP
  1503. X.B iif(si_test, x_argtrue, x_argfalse)
  1504. XIf \fItest\fR is not zero, and not the null string "", returns
  1505. X\fIargtrue\fR.  Otherwise, returns \fIargfalse\fR.  Note that all
  1506. Xarguments are \fIalways\fR evaluated.
  1507. X.TP
  1508. X.B index(s_search, s_target [,i_start)
  1509. XReturns an \fBINT\fR which is the location of \fItarget\fR in the
  1510. Xstring \fIsearch\fR.  The first character of a string is numbered 1.
  1511. XIf \fItarget\fR does not exist in \fIsearch\fR, then 0 is returned.
  1512. X.RS
  1513. XThe optional parameter \fIstart\fR specifies the position in
  1514. X\fIsearch\fR at which to start looking for \fItarget\fR.
  1515. X.RE
  1516. X.TP
  1517. X.B isleap(id_arg)
  1518. XReturns 1 if \fIarg\fR is a leap year, and 0 otherwise.  \fIArg\fR can
  1519. Xbe either an \fBINT\fR or a \fBDATE\fR object.  If a \fBDATE\fR is
  1520. Xsupplied, then the year component is used in the test.
  1521. X.TP
  1522. X.B isomitted(d_date)
  1523. XReturns 1 if \fIdate\fR is omitted, given the current global \fBOMIT\fR
  1524. Xcontext.  Returns 0 otherwise.
  1525. X.TP
  1526. X.B lower(s_string)
  1527. XReturns a \fBSTRING\fR with all upper-case characters in \fIstring\fR
  1528. Xconverted to lower-case.
  1529. X.TP
  1530. X.B max(x_arg1 [,x_arg2...)
  1531. XCan take any number of arguments, and returns the maximum.  The arguments
  1532. Xcan be of any type, but must all be of the same type.  They are compared
  1533. Xas with the > operator.
  1534. X.TP
  1535. X.B min(x_arg1 [,x_arg2...)
  1536. XCan take any number of arguments, and returns the minimum.  The arguments
  1537. Xcan be of any type, but must all be of the same type.  They are compared
  1538. Xas with the < operator.
  1539. X.TP
  1540. X.B minute(t_time)
  1541. XReturns the minute component of \fItime\fR.
  1542. X.TP
  1543. X.B mon(di_arg)
  1544. XIf \fIarg\fR is of \fBDATE\fR type, returns a string which names the month
  1545. Xcomponent of the date.  If \fIarg\fR is an \fBINT\fR from 1 to
  1546. X12, returns a string which names the month.
  1547. X.TP
  1548. X.B monnum(d_date)
  1549. XReturns an \fBINT\fR from 1 to 12, representing the month component of
  1550. X\fIdate\fR.
  1551. X.TP
  1552. X.B now()
  1553. XReturns the current system time, as a \fBTIME\fR type.
  1554. X.TP
  1555. X.B ord(i_num)
  1556. XReturns a string which is the ordinal number \fInum\fR.  For example,
  1557. X\fBord(2)\fR returns "2nd", and \fBord(213)\fR returns "213th".
  1558. X.TP
  1559. X.B ostype()
  1560. XReturns "UNIX" on UNIX systems, and "MSDOS" on MS-DOS systems.
  1561. X.TP
  1562. X.B plural(i_num [,s_str1 [,s_str2]])
  1563. XCan take from one to three arguments.  If one argument is supplied, returns
  1564. X"s" if \fInum\fR is not 1, and "" if \fInum\fR is 1.
  1565. X.RS
  1566. XIf two arguments are supplied, returns \fIstr1\fR + "s" if \fInum\fR is
  1567. Xnot 1.  Otherwise, returns \fIstr1\fR.
  1568. X.PP
  1569. XIf three arguments are supplied, returns \fIstr1\fR if \fInum\fR is 1, and
  1570. X\fIstr2\fR otherwise.
  1571. X.RE
  1572. X.TP
  1573. X.B realtoday()
  1574. XReturns the date as provided by the operating system.  This is in contrast to
  1575. X\fBRemind\fR's concept of "today", which may be changed if it is running
  1576. Xin calendar mode, or if a date has been supplied on the command line.
  1577. X.TP
  1578. X.B sgn(i_num)
  1579. XReturns -1 if \fInum\fR is negative, 1 if \fInum\fR is positive,
  1580. Xand 0 if \fInum\fR is zero.
  1581. X.TP
  1582. X.B shell(s_cmd)
  1583. XExecutes \fIcmd\fR as a system command, and returns the first 511
  1584. Xcharacters of output resulting from \fIcmd\fR.  Any whitespace
  1585. Xcharacter in the output is converted to a space.  Note that if \fBRUN
  1586. XOFF\fR has been executed, or the \fB\-r\fR command-line option has
  1587. Xbeen used, \fBshell()\fR will result in an error, and \fIcmd\fR will
  1588. Xnot be executed.
  1589. X.TP
  1590. X.B strlen(s_str)
  1591. XReturns the length of \fIstr\fR.
  1592. X.TP
  1593. X.B substr(s_str, i_start [,i_end])
  1594. XReturns a \fBSTRING\fR consisting of all characters in \fIstr\fR from
  1595. X\fIstart\fR up to and including \fIend\fR.  Characters are numbered
  1596. Xfrom 1.  If \fIend\fR is not supplied, then it defaults to the length
  1597. Xof \fIstr\fR.
  1598. X.TP
  1599. X.B time(i_hr, i_min)
  1600. XCreates a \fBTIME\fR with the hour and minute components specified by
  1601. X\fIhr\fR and \fImin\fR.
  1602. X.TP
  1603. X.B today()
  1604. XReturns \fBRemind\fR's notion of "today."  This may be the actual system
  1605. Xdate, or a date supplied on the command line, or the date of the
  1606. Xcalendar entry currently being computed.
  1607. X.TP
  1608. X.B trigdate()
  1609. XReturns the calculated trigger date of the last \fBREM\fR command.  If used
  1610. Xin the \fIbody\fR of a \fBREM\fR command, returns that command's trigger date.
  1611. X.TP
  1612. X.B trigger(d_date)
  1613. XReturns a string suitable for use in a \fBREM\fR command, allowing you to
  1614. Xcalculate trigger dates in advance.  See the section "Expression pasting"
  1615. Xfor more information.
  1616. X.TP
  1617. X.B trigtime()
  1618. XReturns the time of the last \fBREM\fR command with an \fBAT\fR clause.
  1619. X.TP
  1620. X.B trigvalid()
  1621. XReturns 1 if the value returned by \fBtrigdate()\fR is valid for the most
  1622. Xrecent \fBREM\fR command, or 0 otherwise.  Sometimes \fBREM\fR commands
  1623. Xcannot calculate a trigger date.  For example, the following \fBREM\fR
  1624. Xcommand can never be triggered:
  1625. X.PP
  1626. X.nf
  1627. X        REM Mon OMIT Mon SKIP MSG Impossible!
  1628. X.fi
  1629. X.PP
  1630. X.TP
  1631. X.B typeof(x_arg)
  1632. XReturns "STRING", "INT", "DATE" or "TIME", depending on the type of \fIarg\fR.
  1633. X.TP
  1634. X.B upper(s_string)
  1635. XReturns a \fBSTRING\fR with all lower-case characters in \fIstring\fR
  1636. Xconverted to upper-case.
  1637. X.TP
  1638. X.B value(s_varname [,x_default])
  1639. XReturns the value of the specified variable.  For example, value("X"+"Y")
  1640. Xreturns the value of variable XY, if it is defined.  If XY is not defined,
  1641. Xan error results.
  1642. X.RS
  1643. XHowever, if you supply a second argument, it is returned if the \fIvarname\fR
  1644. Xis not defined.  The expression value("XY", 0) will return 0 if XY is not
  1645. Xdefined, and the value of XY if it is defined.
  1646. X.RE
  1647. X.TP
  1648. X.B version()
  1649. XReturns a string specifying the version of \fBRemind\fR.  For version 
  1650. X03.00.00, returns "03.00.00".  It is guaranteed that as new versions of
  1651. X\fBRemind\fR are released, the value returned by \fBversion()\fR will
  1652. Xstrictly increase, according to the rules for string ordering.
  1653. X.TP
  1654. X.B wkday(di_arg)
  1655. XIf \fIarg\fR is a \fBDATE\fR, returns a string representing the day of the
  1656. Xweek of the date.  If \fIarg\fR is an \fBINT\fR from 0 to 6, returns
  1657. Xthe corresponding weekday ("Sunday" to "Saturday").
  1658. X.TP
  1659. X.B wkdaynum(d_date)
  1660. XReturns a number from 0 to 6 representing the day-of-week of the specified
  1661. X\fIdate\fR.  (0 represents Sunday, and 6 represents Saturday.)
  1662. X.TP
  1663. X.B year(d_date)
  1664. XReturns a \fBINT\fR which is the year component of \fIdate\fR.
  1665. X.SH EXPRESSION PASTING
  1666. X.PP
  1667. XAn extremely powerful feature of \fBRemind\fR is its macro capability,
  1668. Xor "expression pasting."
  1669. X.PP
  1670. XIn almost any situation where \fBRemind\fR is not expecting an expression,
  1671. Xyou can "paste" an expression in.  To do this, surround the expression
  1672. Xwith square brackets.  For example:
  1673. X.PP
  1674. X.nf
  1675. X    REM [trigger(mydate)] MSG foo
  1676. X.fi
  1677. X.PP
  1678. XThis evaluates the expression "trigger(mydate)", where "mydate" is
  1679. Xpresumably some pre-computed variable, and then "pastes" the result
  1680. Xinto the command-line for the parser to process.
  1681. X.PP
  1682. XA formal description of this is:  When \fBRemind\fR encounters a
  1683. X"pasted-in" expression, it evaluates the expression, and coerces the
  1684. Xresult to a \fBSTRING\fR.  It then substitutes the string for the
  1685. Xpasted-in expression, and continues parsing.  Note, however, that
  1686. Xexpressions are evaluated only once, not recursively.  Thus, writing:
  1687. X.PP
  1688. X.nf
  1689. X    ["[a+b]"]
  1690. X.fi
  1691. X.PP
  1692. Xcauses \fBRemind\fR to read the token "[a+b]".  It does not interpret
  1693. Xthis as a pasted-in expression.  In fact, the only way to get a literal
  1694. Xleft-bracket into a reminder is to use ["["].
  1695. X.PP
  1696. XYou can use expression pasting almost anywhere.  However, there are a few
  1697. Xexceptions:
  1698. X.TP
  1699. Xo
  1700. XIf \fBRemind\fR is expecting an expression, as in the \fBSET\fR command,
  1701. Xor the \fBIF\fR command, then no expression pasting takes place.  The
  1702. Xexpression is simply evaluated as if the square brackets were not there.
  1703. X.TP
  1704. Xo
  1705. XYou cannot use expression pasting for the first token on a line.
  1706. XFor example, the following will not work:
  1707. X.PP
  1708. X.nf
  1709. X        ["SET"] a 1
  1710. X.fi
  1711. X.RS
  1712. XThis restriction is because \fBRemind\fR must be able to unambiguously
  1713. Xdetermine the first token of a line for the flow-control commands (to
  1714. Xbe discussed later.)
  1715. X.PP
  1716. XIn fact, if \fBRemind\fR cannot determine the first token on a line, it
  1717. Xassumes that it is a \fBREM\fR command.  If expression-pasting is used,
  1718. X\fBRemind\fR assumes it is a \fBREM\fR command.  Thus, the following
  1719. Xthree commands are equivalent:
  1720. X.PP
  1721. X.nf
  1722. X        REM 12 Nov 1993 AT 13:05 MSG BOO!
  1723. X        12 Nov 1993 AT 13:05 MSG BOO!
  1724. X        [12] ["Nov " + 1993] AT [12:05+60] MSG BOO!
  1725. X.fi
  1726. X.RE
  1727. X.TP
  1728. Xo
  1729. XYou cannot use expression-pasting to determine the type (\fBMSG\fR,
  1730. X\fBCAL\fR, etc.) of a \fBREM\fR command.  You can paste expressions
  1731. Xbefore and after the \fBMSG\fR, etc keywords, but cannot do something like
  1732. Xthis:
  1733. X.PP
  1734. X.nf
  1735. X        REM ["12 Nov 1993 AT 13:05 " + "MSG" + " BOO!"]
  1736. X.fi
  1737. X.PP
  1738. X.B COMMON PITFALLS IN EXPRESSION PASTING
  1739. X.PP
  1740. XRemember, when pasting in expressions, that extra spaces are not
  1741. Xinserted.  Thus, something like:
  1742. X.PP
  1743. X.nf
  1744. X    REM[expr]MSG[expr]
  1745. X.fi
  1746. X.PP
  1747. Xwill probably fail.
  1748. X.PP
  1749. XIf you use an expression to calculate a \fIdelta\fR or \fIback\fR,
  1750. Xensure that the result is a positive number.  Something like:
  1751. X.PP
  1752. X.nf
  1753. X    REM +[mydelta] Nov 12 1993 MSG foo
  1754. X.fi
  1755. X.PP
  1756. Xwill fail if \fImydelta\fR happens to be negative.
  1757. X.PP
  1758. X.SH FLOW CONTROL COMMANDS
  1759. X.PP
  1760. X\fBRemind\fR has commands which control the flow of a reminder script.
  1761. XNormally, reminder scripts are processed sequentially.  However,
  1762. X\fBIF\fR and related commands allow you to process files conditionally,
  1763. Xand skip sections which you don't want interpreted.
  1764. X.PP
  1765. X.B THE IF COMMAND
  1766. X.PP
  1767. XThe \fBIF\fR command has the following form:
  1768. X.PP
  1769. X.nf
  1770. X    IF expr
  1771. X        t-command
  1772. X        t-command...
  1773. X    ELSE
  1774. X        f-command
  1775. X        f-command...
  1776. X    ENDIF
  1777. X.fi
  1778. X.PP
  1779. XNote that the commands are shown indented for clarity.  Also, the \fBELSE\fR
  1780. Xportion can be omitted.  \fBIF\fR commands can be nested up to a small limit,
  1781. Xprobably around 8 or 16 levels of nesting, depending on your system.
  1782. X.PP
  1783. XIf the \fIexpr\fR evaluates to a non-zero \fBINT\fR, or a non-null
  1784. X\fBSTRING\fR, then the \fBIF\fR portion is considered true, and the
  1785. X\fIt-commands\fR are executed.  If \fIexpr\fR evaluates to zero or
  1786. Xnull, then the \fIf-commands\fR (if the \fBELSE\fR portion is present)
  1787. Xare executed.  If \fIexpr\fR is not of type \fBINT\fR or \fBSTRING\fR,
  1788. Xthen it is an error.
  1789. X.PP
  1790. XExamples:
  1791. X.PP
  1792. X.nf
  1793. X    IF defined("want_hols")
  1794. X        INCLUDE /usr/share/remind/holidays
  1795. X    ENDIF
  1796. X
  1797. X    IF today() > date(1992, 2, 10)
  1798. X        set missed_ap "You missed it!"
  1799. X    ELSE
  1800. X        set missed_ap "Still have time..."
  1801. X    ENDIF
  1802. X.fi
  1803. X.PP
  1804. X.B THE IFTRIG COMMAND
  1805. X.PP
  1806. XThe \fBIFTRIG\fR command is similar to an \fBIF\fR command, except
  1807. Xthat it computes a trigger (as in the \fBREM\fR command), and evaluates
  1808. Xto true if a corresponding \fBREM\fR command would trigger.  Examples:
  1809. X.PP
  1810. X.nf
  1811. X    IFTRIG 1 Nov
  1812. X        ; Executed on 1 Nov
  1813. X    ELSE
  1814. X        ; Executed except on 1 Nov
  1815. X    ENDIF
  1816. X
  1817. X    IFTRIG 1 -1 OMIT Sat Sun +4
  1818. X        ; Executed on last working day of month,
  1819. X        ; and the 4 working days preceding it
  1820. X    ELSE
  1821. X        ; Executed except on above days
  1822. X    ENDIF
  1823. X.fi
  1824. X.PP
  1825. XNote that the \fBIFTRIG\fR command computes a trigger date, which can
  1826. Xbe retrieved with the \fBtrigdate()\fR function.  You can use all of
  1827. Xthe normal trigger components, such as \fBUNTIL\fR, \fIdelta\fR, etc in the
  1828. X\fBIFTRIG\fR command.
  1829. X.PP
  1830. X.SH USER-DEFINED FUNCTIONS
  1831. X.PP
  1832. XIn addition to the built-in functions, \fBRemind\fR allows you to define
  1833. Xyour own functions.  The \fBFSET\fR command does this for you:
  1834. X.PP
  1835. X\fBFSET\fR \fIfname\fR(\fIargs\fR) \fIexpr\fR
  1836. X.PP
  1837. X\fIFname\fR is the name of the function, and follows the convention for
  1838. Xnaming variables.  \fIArgs\fR is a comma-separated list of arguments, and
  1839. X\fIexpr\fR is an expression.  \fIArgs\fR can be empty, in which case
  1840. Xyou define a function taking no parameters.  Here are some examples:
  1841. X.PP
  1842. X.nf
  1843. X    FSET double(x) 2*x
  1844. X    FSET yeardiff(date1, date2) year(date1) - year(date2)
  1845. X    FSET since(x) ord(year(trigdate())-x)
  1846. X.fi
  1847. X.PP
  1848. XThe last function is useful in birthday reminders.  For example:
  1849. X.PP
  1850. X.nf
  1851. X    REM 1 Nov +12 MSG Dean's [since(1984)] birthday is %b.
  1852. X.fi
  1853. X.PP
  1854. XDean was born in 1984.  The above example, on 1 November 1992, would print:
  1855. X.PP
  1856. X.nf
  1857. X    Dean's 8th birthday is today.
  1858. X.fi
  1859. X.PP
  1860. XNotes:
  1861. X.TP
  1862. Xo
  1863. XIf you access a variable in \fIexpr\fR which is not in the list of arguments,
  1864. Xthe "global" value (if any) is used.
  1865. X.TP
  1866. Xo
  1867. XFunction and parameter names are significant only to 12 characters.
  1868. X.TP
  1869. Xo
  1870. XThe \fBvalue()\fR function \fIalways\fR accesses the "global" value of a
  1871. Xvariable, even if it has the same name as an argument.  For example:
  1872. X.RS
  1873. X.nf
  1874. X        fset func(x) value("x")
  1875. X        set x 1
  1876. X        set y func(5)
  1877. X.fi
  1878. X.PP
  1879. XThe above sequence sets y to 1, which is the global value of x.
  1880. X.RE
  1881. X.TP
  1882. Xo
  1883. XUser-defined functions may call other functions, including other user-defined
  1884. Xfunctions.  However, recursive calls are not allowed.
  1885. X.TP
  1886. Xo
  1887. XUser-defined functions are not syntax-checked when they are defined; parsing
  1888. Xoccurs only when they are called.
  1889. X.TP
  1890. Xo
  1891. XIf a user-defined function has the same name as a built-in function,
  1892. Xit is ignored and the built-in function is used.  To prevent conflicts
  1893. Xwith future versions of \fBRemind\fR (which may define more built-in
  1894. Xfunctions), you may wish to name all user-defined functions beginning
  1895. Xwith an underscore.
  1896. X.PP
  1897. X.SH THE SATISFY CLAUSE
  1898. X.PP
  1899. XThe form of \fBREM\fR which uses \fBSATISFY\fR is as follows:
  1900. X.PP
  1901. X\fBREM\fR \fItrigger\fR \fBSATISFY\fR \fIexpr\fR
  1902. X.PP
  1903. XThe way this works is as follows:  \fBRemind\fR first calculates a trigger
  1904. Xdate, in the normal fashion.  Next, it sets \fBtrigdate()\fR to the
  1905. Xcalculated trigger date.  It then evaluates \fIexpr\fR.  If the result
  1906. Xis not the null string or zero, processing
  1907. Xends.  Otherwise, \fBRemind\fR computes the next trigger date, and re-tests
  1908. X\fIexpr\fR.  This iteration continues until \fIexpr\fR evaluates to non-zero
  1909. Xor non-null, or until the iteration limit specified with the \fB\-x\fR
  1910. Xcommand-line option is reached.
  1911. X.PP
  1912. XIf \fIexpr\fR is not satisfied, then \fBtrigvalid()\fR is set to 0.
  1913. XOtherwise, \fBtrigvalid()\fR is set to 1.  In any event, no error message
  1914. Xis issued.
  1915. X.PP
  1916. XThis is really useful only if \fIexpr\fR involves a call to the
  1917. X\fBtrigdate()\fR function; otherwise, \fIexpr\fR will not change as
  1918. X\fBRemind\fR iterates.
  1919. X.PP
  1920. XAn example of the usefulness of \fBSATISFY\fR:  Suppose you wish to
  1921. Xbe warned of every Friday the 13th.  Your first attempt may be:
  1922. X.PP
  1923. X.nf
  1924. X    # WRONG!
  1925. X    REM Fri 13 +2 MSG Friday the 13th is %b.
  1926. X.fi
  1927. X.PP
  1928. XBut this won't work.  This reminder triggers on the first Friday
  1929. Xon or after the 13th of each month.  The way to do it is with a
  1930. Xmore complicated sequence:
  1931. X.PP
  1932. X.nf
  1933. X    REM 13 SATISFY wkdaynum(trigdate()) == 5
  1934. X    IF trigvalid()
  1935. X        REM [trigger(trigdate())] +2 MSG \\
  1936. X        Friday the 13th is %b.
  1937. X    ENDIF
  1938. X.fi
  1939. X.PP
  1940. XLet's see how this works.  The \fBSATISFY\fR clause iterates through
  1941. Xall the 13ths of successive months, until a trigger date is found whose
  1942. Xday-of-week is Friday (== 5).  If a valid date was found, we use the
  1943. Xcalculated trigger date (converted into a trigger format with the
  1944. X\fBtrigger()\fR function) to set up the next reminder.
  1945. X.PP
  1946. XWe could also have written:
  1947. X.PP
  1948. X.nf
  1949. X    REM Fri SATISFY day(trigdate()) == 13
  1950. X.fi
  1951. X.PP
  1952. Xbut this would result in more iterations, since "Fridays" occur more
  1953. Xoften than "13ths of the month."
  1954. X.PP
  1955. XThis technique of using one \fBREM\fR command to calculate a trigger date
  1956. Xto be used by another command is quite powerful.  For example, suppose
  1957. Xyou wanted to OMIT Labour day, which is the first Monday in September.  You
  1958. Xcould use:
  1959. X.PP
  1960. X.nf
  1961. X    # Note: SATISFY 1 is an idiom for "do nothing"
  1962. X    REM Mon 1 Sept SATISFY 1
  1963. X    OMIT [trigger(trigdate())]
  1964. X.fi
  1965. X.PP
  1966. X\fBCAVEAT:\fR This \fIonly\fR omits the \fInext\fR Labour Day, not
  1967. Xall Labour Days in the future.  This could cause strange results, as
  1968. Xthe \fBOMIT\fR context can change depending on the current date.  For
  1969. Xexample, if you use the following command after the above commands:
  1970. X.PP
  1971. X.nf
  1972. X    REM Mon AFTER msg hello
  1973. X.fi
  1974. X.PP
  1975. Xthe result will not be as you expect.  Consider producing a calendar
  1976. Xfor September, 1992.  Labour Day was on Monday, 7 September, 1992.
  1977. XHowever, when \fBRemind\fR gets around to calculating the trigger
  1978. Xfor Tuesday, 8 September, 1992, the \fBOMIT\fR command will now be
  1979. Xommitting Labour Day for 1993, and the "Mon AFTER" command
  1980. Xwill not be triggered.
  1981. X.PP
  1982. XIt is probably best to stay away from computing \fBOMIT\fR
  1983. Xtrigger dates unless you keep these pitfalls in mind.
  1984. X.PP
  1985. X.SH DEBUGGING REMINDER SCRIPTS
  1986. X.PP
  1987. XAlthough the command-line \fB\-d\fR option is useful for debugging, it
  1988. Xis often overkill.  For example, if you turn on the \fB\-dx\fR option for
  1989. Xa reminder file with many complex expressions, you'll get a huge amount of
  1990. Xoutput.  The \fBDEBUG\fR command allows you to control the debugging flags
  1991. Xunder program control.  The format is:
  1992. X.PP
  1993. X\fBDEBUG\fR [+\fIflagson\fR] [\-\fIflagsoff\fR]
  1994. X.PP
  1995. X\fIFlagson\fR and \fIflagsoff\fR consist of strings of the characters "extvl"
  1996. Xwhich correspond to the debugging options discussed in the command-line
  1997. Xoptions section.  If preceded with a "+", the corresponding group of
  1998. Xdebugging options is switched on.  Otherwise, they are switched off.
  1999. XFor example, you could use this sequence to debug a complicated expression:
  2000. X.PP
  2001. X.nf
  2002. X    DEBUG +x
  2003. X    set a very_complex_expression(many_args)
  2004. X    DEBUG \-x
  2005. X.fi
  2006. X.PP
  2007. X.B THE DUMPVARS COMMAND
  2008. X.PP
  2009. XThe command \fBDUMPVARS\fR displays the values of variables in memory.  Its
  2010. Xformat is:
  2011. X.PP
  2012. X\fBDUMPVARS\fR [\fIvar\fR...]
  2013. X.PP
  2014. XIf you supply a space-separated list of variable names, the corresponding
  2015. Xvariables are displayed.  If you do not supply a list of variables, then
  2016. Xall variables in memory are displayed.
  2017. X.PP
  2018. X.B THE ERRMSG COMMAND
  2019. X.PP
  2020. XThe \fBERRMSG\fR command has the following format:
  2021. X.PP
  2022. X\fBERRMSG\fR \fIbody\fR
  2023. X.PP
  2024. XThe \fIbody\fR is passed through the substitution filter (with an
  2025. Ximplicit trigger date of \fBtoday()\fR) and printed to the error
  2026. Xoutput stream.  Example:
  2027. X.PP
  2028. X.nf
  2029. X    IF !defined("critical_var")
  2030. X        ERRMSG You must supply a value for "critical_var"
  2031. X        EXIT
  2032. X    ENDIF
  2033. X.fi
  2034. X.PP
  2035. X.B THE EXIT COMMAND
  2036. X.PP
  2037. XThe above example also shows the use of the \fBEXIT\fR command.  This
  2038. Xcauses an unconditional exit from script processing.  Any queued
  2039. Xtimed reminders are discarded.  If you are in calendar mode
  2040. X(described next), then the calendar processing is aborted.
  2041. X.PP
  2042. X.SH CALENDAR MODE
  2043. X.PP
  2044. XIf you supply the \fB\-c\fR or \fB\-s\fR command-line option, the \fBRemind\fR
  2045. Xruns in "calendar mode."  In this mode, \fBRemind\fR interprets the script
  2046. Xrepeatedly, performing one iteration through the whole file for each day
  2047. Xin the calendar.  Reminders which trigger are saved in internal buffers,
  2048. Xand then inserted into the calendar in the appropriate places.
  2049. X.PP
  2050. XFor example, if you have a reminder script called ".reminders", and you
  2051. Xexecuted this command:
  2052. X.PP
  2053. X.nf
  2054. X    remind -c .reminders jan 1993
  2055. X.fi
  2056. X.PP
  2057. Xthen \fBRemind\fR executes the script 31 times, once for each day in
  2058. XJanuary.  Each time it executes the script, it increments the value
  2059. Xof \fBtoday()\fR.  Any reminders whose trigger date matches \fBtoday()\fR
  2060. Xare entered into the calendar.
  2061. X.PP
  2062. X\fBMSG\fR and \fBCAL\fR-type reminders, by default, have their entire
  2063. Xbody inserted into the calendar.  \fBRUN\fR-type reminders are not
  2064. Xnormally inserted into the calendar.  However, if you enclose a portion of
  2065. Xthe body in the %"...%" sequence, only that portion is inserted.  For
  2066. Xexample, consider the following:
  2067. X.PP
  2068. X.nf
  2069. X    REM 6 Jan MSG %"David's birthday%" is %b
  2070. X.fi
  2071. X.PP
  2072. XIn the normal mode, \fBRemind\fR would print "David's birthday is today"
  2073. Xon 6 January.  However, in the calendar mode, only the text "David's birthday"
  2074. Xis inserted into the box for 6 January.
  2075. X.PP
  2076. XIf you explicitly use the %"...%" sequence in a \fBRUN\fR-type reminder,
  2077. Xthen the text between the delimiters is inserted into the calendar.
  2078. XIf you use the sequence %"%" in a \fBMSG\fR or \fBCAL\fR-type reminder, then
  2079. Xno calendar entry is produced for that reminder.
  2080. X.PP
  2081. X.B PRESERVING VARIABLES
  2082. X.PP
  2083. XBecause \fBRemind\fR iterates through the script for each day in the calendar,
  2084. Xslow operations may severely reduce the speed of producing a calendar.
  2085. X.PP
  2086. XFor example, suppose you set the variables "me" and "hostname" as follows:
  2087. X.PP
  2088. X.nf
  2089. X    SET me shell("whoami")
  2090. X    SET hostname shell("hostname")
  2091. X.fi
  2092. X.PP
  2093. XNormally, \fBRemind\fR clears all variables between iterations in calendar
  2094. Xmode.  However, if certain variables are slow to compute, and will
  2095. Xnot change between iterations, you can "preserve" their values with the
  2096. X\fBPRESERVE\fR command.  Also, since function definitions are preserved
  2097. Xbetween calendar iterations, there is no need to redefine them on each
  2098. Xiteration.  Thus, you could use the following sequence:
  2099. X.PP
  2100. X.nf
  2101. X    IF ! defined("initialized")
  2102. X        set initialized 1
  2103. X        set me shell("whoami")
  2104. X        set hostname shell("hostname")
  2105. X        fset func complex_expr()
  2106. X        preserve initialized me hostname
  2107. X    ENDIF
  2108. X.fi
  2109. X.PP
  2110. XThe operation is as follows:  On the first iteration through the script,
  2111. X"initialized" is not defined.  Thus, the commands between \fBIF\fR and
  2112. X\fBENDIF\fR are executed.  The \fBPRESERVE\fR command ensures that the
  2113. Xvalues of initialized, me and hostname are preserved for subsequent
  2114. Xiterations.  On the next iteration, the commands are skipped, since
  2115. Xinitialized has remained defined.  Thus, time-consuming operations which
  2116. Xdo not depend on the value of \fBtoday()\fR are done only once.
  2117. X.PP
  2118. XNote that for efficiency, \fBRemind\fR caches the reminder script
  2119. X(and any \fBINCLUDE\fRd files) in memory when producing a calendar.
  2120. X.PP
  2121. XTimed reminders are sorted and placed into the calendar in time order.
  2122. XThese are followed by non-timed reminders.  \fBRemind\fR automatically
  2123. Xplaces the time of timed reminders in the calendar according to the
  2124. X\fB\-b\fR command-line option.
  2125. X.PP
  2126. X.SH DAEMON MODE
  2127. X.PP
  2128. XIf you use the \fB\-z\fR command-line option, \fBRemind\fR runs in the
  2129. X"daemon" mode.  In this mode, no "normal" reminders are issued.
  2130. XInstead, only timed reminders are collected and queued, and are then
  2131. Xissued whenever they reach their trigger time.
  2132. X.PP
  2133. XIn addition, \fBRemind\fR wakes up every few minutes to check the modification
  2134. Xdate on the reminder script (the filename supplied on the command line.)
  2135. XIf \fBRemind\fR detects that the script has changed, it re-executes itself
  2136. Xin daemon mode, and interprets the changed script.
  2137. X.PP
  2138. XIn daemon mode, \fBRemind\fR also re-reads the remind script when it
  2139. Xdetects that the system date has changed.
  2140. X.PP
  2141. XIn daemon mode, \fBRemind\fR acts as if the \fB\-f\fR option had been used,
  2142. Xso to run in the daemon mode in the background, use:
  2143. X.PP
  2144. X.nf
  2145. X    remind -z .reminders &
  2146. X.fi
  2147. X.PP
  2148. XIf you use \fBsh\fR or \fBbash\fR, you may have to use the "nohup" command
  2149. Xto ensure that the daemon is not killed whn you log out.
  2150. X.PP
  2151. X.SH MISCELLANEOUS
  2152. X.PP
  2153. X.B COMMAND ABBREVIATIONS
  2154. X.PP
  2155. XThe following commands can be abbreviated:
  2156. X.TP
  2157. Xo
  2158. X\fBREM\fR can be omitted - it is implied if no other valid command
  2159. Xis present.
  2160. X.TP
  2161. Xo
  2162. X\fBCLEAR-OMIT-CONTEXT\fR --> \fBCLEAR\fR
  2163. X.TP
  2164. Xo
  2165. X\fBPUSH-OMIT-CONTEXT\fR --> \fBPUSH\fR
  2166. X.TP
  2167. Xo
  2168. X\fBPOP-OMIT-CONTEXT\fR --> \fBPOP\fR
  2169. X.TP
  2170. Xo
  2171. X\fBDUMPVARS\fR --> \fBDUMP\fR
  2172. X.TP
  2173. Xo
  2174. X\fBBANNER\fR --> \fBBAN\fR
  2175. X.TP
  2176. Xo
  2177. X\fBINCLUDE\fR --> \fBINC\fR
  2178. X.PP
  2179. X.B NIFTY EXAMPLES
  2180. X.PP
  2181. XThis section is a sampling of what you can do with \fBRemind\fR.
  2182. X.PP
  2183. X.nf
  2184. X    REM 5 Feb 1991 AT 14:00 +45 *30 \\
  2185. X    RUN mail -s "Meeting at %2" $LOGNAME </dev/null &
  2186. X.fi
  2187. X.PP
  2188. XOn 5 February, 1991, this reminder will mail
  2189. Xyou reminders of a 2:00pm meeting at 1:15,
  2190. X1:45 and 2:00.  The subject of the mail message will be "Meeting at 2:00pm"
  2191. Xand the body of the message will be blank.
  2192. X.PP
  2193. X.nf
  2194. X    REM AT 17:00 RUN echo "5:00pm - GO HOME!" | xless -g +0+0 &
  2195. X.fi
  2196. X.PP
  2197. XThis reminder will pop up an xless window at 5:00pm every day.  The xless
  2198. Xwindow will contain the line "5:00pm - GO HOME!"
  2199. X.PP
  2200. X.nf
  2201. X    REM AT 23:59 RUN (sleep 120; remind -a [filename()]) &
  2202. X.fi
  2203. X.PP
  2204. XThis reminder will run at one minute to midnight.  It will cause a new
  2205. Xremind process to start at one minute past midnight.  This allows you to
  2206. Xhave a continuous reminder service so you can work through the night and
  2207. Xstill get timed reminders for early in the morning.  Note that this
  2208. Xtrick is no longer necessary, providing you run \fBRemind\fR in
  2209. Xdaemon mode.
  2210. X.PP
  2211. X.nf
  2212. X    remind \-c12 /dev/null Jan 1993
  2213. X.fi
  2214. X.PP
  2215. XThis invocation of \fBremind\fR will cause it to print a calendar for
  2216. X1993, with all entries left blank.
  2217. X.PP
  2218. X.nf
  2219. X    REM CAL [trigdate()-date(year(trigdate()), 1, 1)+1]
  2220. X.fi
  2221. X.PP
  2222. XThis example puts an entry in each box of a calendar showing the number
  2223. X(1-365 or 366) of the day of the year.
  2224. X.PP
  2225. X.nf
  2226. X    REM Tue 2 Nov SATISFY (year(trigdate())%4) == 0
  2227. X    IF trigvalid()
  2228. X        REM [trigger(trigdate())] ++5 MSG \\
  2229. X        U.S. Presidential Election!!
  2230. X    ENDIF
  2231. X.fi
  2232. X.PP
  2233. XThis example warns you 5 days ahead of each American presidential
  2234. Xelection.  The first \fBREM\fR command calculates the first Tuesday after
  2235. Xthe first Monday in November.  (This is equivalent to the first
  2236. XTuesday on or after 2 November.)  The \fBSATISFY\fR clause ensures
  2237. Xthat the trigger date is issued only in election years, which are
  2238. Xmultiples of 4.  The second \fBREM\fR command actually issues the
  2239. Xreminder.
  2240. X.SH AUTHOR
  2241. X.PP
  2242. XDavid F. Skoll
  2243. X.SH BUGS
  2244. X.PP
  2245. XDate calculation is a bit "brute force."
  2246. X.PP
  2247. XThe MS-DOS version of \fBRemind\fR does not support queuing or timed
  2248. Xactivation of reminders.
  2249. X.PP
  2250. X\fBRemind\fR has some built-in limits on total line length,
  2251. Xsubstitution buffer length, number of global \fBOMIT\fRs, etc.
  2252. X.PP
  2253. X.SH SEE ALSO
  2254. X.pp
  2255. Xrem, elm, kall
  2256. SHAR_EOF
  2257. $TOUCH -am 1109141292 remind.1 &&
  2258. chmod 0600 remind.1 ||
  2259. echo "restore of remind.1 failed"
  2260. set `wc -c remind.1`;Wc_c=$1
  2261. if test "$Wc_c" != "71460"; then
  2262.     echo original size 71460, current size $Wc_c
  2263. fi
  2264. fi
  2265. echo "End of part 11, continue with part 12"
  2266. exit 0
  2267.  
  2268. exit 0 # Just in case...
  2269.