home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 2 / 2028 < prev    next >
Internet Message Format  |  1990-12-28  |  25KB

  1. From: dfs@doe.carleton.ca (David F. Skoll)
  2. Newsgroups: alt.sources
  3. Subject: REMIND 2.0 03/03
  4. Message-ID: <dfs.657486297@yar>
  5. Date: 1 Nov 90 19:04:57 GMT
  6.  
  7. ------------- CUT HERE ---
  8. #!/bin/sh
  9. # This is part 03 of Remind 2.0
  10. if touch 2>&1 | fgrep 'amc' > /dev/null
  11.  then TOUCH=touch
  12.  else TOUCH=true
  13. fi
  14. # ============= remind.1 ==============
  15. if test X"$1" != X"-c" -a -f 'remind.1'; then
  16.     echo "File already exists: skipping 'remind.1'"
  17. else
  18. sed 's/^X//' << 'SHAR_EOF' > remind.1 &&
  19. X.TH REMIND 1 "25 October 1990"
  20. X.UC 4
  21. X.SH NAME
  22. Xremind \- a sophisticated reminder service
  23. X.SH SYNOPSIS
  24. X.B remind
  25. X[
  26. X.B \-dvrop
  27. X]
  28. X.I filename
  29. X[
  30. X.I date
  31. X]
  32. X.SH DESCRIPTION
  33. X.B remind
  34. Xreads the supplied
  35. X.I filename
  36. Xfor a list of reminders, and then issues reminders appropriate for
  37. Xthe current date.
  38. XEach reminder can consist of a message sent to standard output, or
  39. Xa program to be executed.
  40. X.SH OPTIONS
  41. X.TP
  42. X.B \-d
  43. XThe
  44. X.B \-d
  45. Xflag causes
  46. X.B remind
  47. Xto enter a debugging mode.
  48. XIn this mode, each reminder in the reminder file is examined and its
  49. Xtrigger date is printed to standard output.  Also, some consistency
  50. Xchecking is done, and warnings are issued about constructs which could
  51. Xresult in slow execution times.
  52. X.TP
  53. X.B \-v
  54. XThe
  55. X.B \-v
  56. Xflag causes the debugging messages caused by
  57. X.B \-d
  58. Xto be printed in a verbose manner.  Also, any error messages issued by
  59. X.B remind
  60. Xare printed in verbose format.
  61. X.TP
  62. X.B \-r
  63. XThe
  64. X.B \-r
  65. Xflag causes
  66. X.B remind
  67. Xto ignore any
  68. X.B RUN
  69. Xdirectives in the reminder file.
  70. X.TP
  71. X.B \-o
  72. XThe
  73. X.B \-o
  74. Xflag causes
  75. X.B remind
  76. Xto ignore any
  77. X.B ONCE
  78. Xdirectives in the reminder file.
  79. X.TP
  80. X.B \-p
  81. XThe
  82. X.B \-p
  83. Xflag causes
  84. X.B remind
  85. Xto go into
  86. X.I purge
  87. Xmode.  This mode is incompatible with the
  88. X.B \-d
  89. Xflag.  It causes
  90. X.B remind
  91. Xto scan the reminder file and echo all reminders which have not expired
  92. Xto the standard output.  All expired reminders are echoed to the standard
  93. Xerror stream.
  94. X.PP
  95. XIf you supply a
  96. X.I date
  97. Xon the command line, it must consist of
  98. X.I day month year
  99. Xwhere
  100. X.I day
  101. Xis the day of the month,
  102. X.I month
  103. Xis (at least the first three letters of) the English name of the month,
  104. Xand
  105. X.I year
  106. Xis a year (all 4 digits) from 1990 to 2075.  These components can appear
  107. Xin any order, but must be separated by spaces.  If a date is supplied,
  108. X.B remind
  109. Xuses it rather than the actual system date as its notion of "today."  You
  110. Xcan use this feature to test how reminders will appear in the future.
  111. X.SH REMINDER FILES
  112. X.B Remind
  113. Xuses scripts called
  114. X.I reminder files
  115. Xto control its operation.  A sample reminder file is shown below:
  116. X.PP
  117. X.nf
  118. X    #!/usr/local/bin/remind
  119. X    # Sample file
  120. X    BANNER Hi there.  Here are your reminders:
  121. X
  122. X    # First some birthdays
  123. X    REM 6 Jan MSG David's birthday.
  124. X    REM 23 Nov +10 MSG El's birthday is %a.
  125. X
  126. X    # Next some housekeeping
  127. X    REM 1 -1 OMIT Sat Sun RUN do_backup
  128. X
  129. X    # Introduce some holidays
  130. X    OMIT 25 Dec        # Christmas
  131. X    OMIT  1 July        # Canada Day
  132. X    OMIT 22 Nov 1990    # American Thanksgiving
  133. X
  134. X    # Business things
  135. X    REM 23 Nov 1990 +2 MSG Meeting with Bill at 10am %a.
  136. X.fi
  137. X.PP
  138. XNote that
  139. X.B remind
  140. Xignores blank lines and lines beginning with "#".
  141. XAlso, commands, names of months, etc. can be typed in any
  142. Xmixture of upper- and lower-case.  The convention I use is to
  143. Xuse upper-case for
  144. X.B remind
  145. Xtokens like
  146. X.I
  147. XMSG, OMIT,
  148. Xetc., and mixed case for other words like
  149. X.I January
  150. Xand
  151. X.I Sunday.
  152. X.SH THE REM COMMAND
  153. XThe most-used command in a reminder file is the
  154. X.I REM
  155. Xcommand.  This command is used to denote a reminder.  There are two
  156. Xforms of the
  157. X.I REM
  158. Xcommand; they are:
  159. X.RS
  160. XREM [ONCE]
  161. X[
  162. X.I date_spec
  163. X]
  164. X[
  165. X.I delta
  166. X]
  167. X[
  168. X.I back
  169. X]
  170. X[
  171. XOMIT
  172. X.I omit_list
  173. X]
  174. XMSG
  175. X.I body
  176. X.PP
  177. XREM [ONCE]
  178. X[
  179. X.I date_spec
  180. X]
  181. X[
  182. X.I delta
  183. X]
  184. X[
  185. X.I back
  186. X]
  187. X[
  188. XOMIT
  189. X.I omit_list
  190. X]
  191. XRUN
  192. X.I body
  193. X.RE
  194. XThe
  195. X.I date_spec, delta
  196. Xand
  197. X.I back
  198. Xcan be specified in any order.  The 
  199. X.I OMIT, 
  200. Xif present, must follow these three
  201. Xitems.  The 
  202. X.I MSG
  203. Xor
  204. X.I RUN 
  205. Xmust be the last item before the
  206. X.I body.
  207. X.PP
  208. X.B Date Specifications
  209. X.PP
  210. XThe
  211. X.I date_spec
  212. Xconsists of zero to four parts.  These parts are
  213. X.I day
  214. X(day of month),
  215. X.I month
  216. X(month name),
  217. X.I year
  218. Xand
  219. X.I weekday.
  220. X.I Month
  221. Xand
  222. X.I weekday
  223. Xare the English names of months and weekdays.  At least the first three
  224. Xcharacters must be used.  Case is irrelevant.  The following are examples
  225. Xof the various parts of a
  226. X.I date_spec:
  227. X.TP
  228. X.I day:
  229. X1, 22, 31, 14, 3
  230. X.TP
  231. X.I month:
  232. XJANUARY, feb, March, ApR, may, Aug
  233. X.TP
  234. X.I year:
  235. X1990, 1993, 2030, 95 (interpreted as 1995).  The year can range
  236. Xfrom 1990 to 2075.
  237. X.TP
  238. X.I weekday:
  239. XMonday, tue, Wed, THU, Friday, saturday, sundAy
  240. X.PP
  241. XNote that there can be several
  242. X.I weekday
  243. Xcomponents separated by spaces in a
  244. X.I date_spec.
  245. X.PP
  246. X.B Interpretation of Date Specifications
  247. X.PP
  248. XThe following examples show how date specifications are interpreted.
  249. X.PP
  250. X1. Null date specification - the reminder is triggered every day.
  251. XThe trigger date for a specific run is simply the current system date.
  252. X.PP
  253. X2. Only
  254. X.I day
  255. Xpresent.  The reminder is triggered on the specified day of each month.
  256. XThe trigger date for a particular run is the closest such day to the
  257. Xcurrent system date.  For example:
  258. X.nf
  259. X    REM 1 MSG First of every month.
  260. X    REM 31 MSG 31st of every month that has 31 days.
  261. X.fi
  262. X.PP
  263. X3. Only
  264. X.I month
  265. Xpresent.  The reminder is triggered every day of the specified month.
  266. XExample:
  267. X.nf
  268. X    REM Feb MSG Every day in February
  269. X.fi
  270. X.PP
  271. X4.
  272. X.I day
  273. Xand
  274. X.I month
  275. Xpresent.  Examples:
  276. X.nf
  277. X    REM 6 Jan MSG Every 6th of January
  278. X    REM Feb 29 MSG Every 29th of February
  279. X.fi
  280. X.PP
  281. X5.  Only
  282. X.I year
  283. Xpresent. Example:
  284. X.nf
  285. X    REM 1991 MSG Every day in 1991
  286. X.fi
  287. X.PP
  288. X6.
  289. X.I year
  290. Xand
  291. X.I day
  292. Xpresent.  Examples:
  293. X.nf
  294. X    REM 1 1990 MSG 1st of every month in 1990
  295. X    REM 1992 23 MSG 23rd of every month in 1992
  296. X.fi
  297. X.PP
  298. X7.
  299. X.I year
  300. Xand
  301. X.I month
  302. Xpresent.  Examples:
  303. X.nf
  304. X    REM Feb 1991 MSG Every day in Feb 1991
  305. X    REM 1992 September MSG Every day in Sept 1992
  306. X.fi
  307. X.PP
  308. X8.
  309. X.I year, month
  310. Xand
  311. X.I day
  312. Xpresent.  Examples:
  313. X.nf
  314. X    REM 8 Jan 1991 MSG 8th January 1991.
  315. X    REM 1992 March 9 MSG 9th March 1992.
  316. X.fi
  317. X.PP
  318. X9.
  319. X.I weekday
  320. Xonly.  Examples:
  321. X.nf
  322. X    REM Sat MSG Every Saturday
  323. X    REM Mon Tue Wed Thu Fri MSG Every working day
  324. X    REM Monday Wednesday MSG Every Monday and Wednesday
  325. X.fi
  326. X.PP
  327. X10.
  328. X.I weekday
  329. Xand
  330. X.I day
  331. Xpresent.  Examples:
  332. X.nf
  333. X    REM Sat 1 MSG First Saturday of every month
  334. X    REM Mon Tue Wed Thu Fri MSG 1st working day after 15th of every month
  335. X.fi
  336. X.PP
  337. X11.
  338. X.I weekday
  339. Xand
  340. X.I month
  341. Xpresent.  Examples:
  342. X.nf
  343. X    REM Mon March MSG Every Monday in March
  344. X    REM Mon Tue Wed Thu Fri Feb MSG Every working day in February
  345. X.fi
  346. X.PP
  347. X12.
  348. X.I weekday, month
  349. Xand
  350. X.I day
  351. Xpresent.  Examples:
  352. X.nf
  353. X    REM Mon 1 March MSG First Monday in March
  354. X    REM Sat Sun 15 July MSG First Sat or Sun on or after 15 July
  355. X.fi
  356. X.PP
  357. X13.
  358. X.I weekday
  359. Xand
  360. X.I year
  361. Xpresent.  Example:
  362. X.nf
  363. X    REM Sat Sun 1991 MSG Every Saturday and Sunday in 1991
  364. X.fi
  365. X.PP
  366. X14.
  367. X.I weekday, day
  368. Xand
  369. X.I year
  370. Xpresent.  Examples:
  371. X.nf
  372. X    REM Mon 15 1990 MSG 1st Mon after 15th of every month in 1990
  373. X    REM Mon Tue Wed Thu Fri 1 1990 MSG 1st working day of every
  374. X        month in 1990
  375. X.fi
  376. X.PP
  377. X15.
  378. X.I weekday, month
  379. Xand
  380. X.I year
  381. Xpresent.  Example:
  382. X.nf
  383. X    REM Mon Wed 1991 Feb MSG Every Mon and Wed in Feb 1991.
  384. X.fi
  385. X.PP
  386. X16.
  387. X.I weekday, day, month
  388. Xand
  389. X.I year
  390. Xpresent.  Example:
  391. X.nf
  392. X    REM Mon Tue Wed Thu Fri 28 Oct 1990 MSG 1st working day
  393. X        on or after 28 October 1990.
  394. X.fi
  395. X.PP
  396. XNote that when
  397. X.I weekday
  398. Xand
  399. X.I day
  400. Xare specified,
  401. X.B remind
  402. Xchooses the first date on or after the specified
  403. X.I day
  404. Xwhich also satisfies the
  405. X.I weekday
  406. Xconstraint.  It does this by picking the first date on or after the specified
  407. X.I day
  408. Xwhich is listed in the list of
  409. X.I weekdays.
  410. XThus, a reminder like:
  411. X.PP
  412. X.nf
  413. X    REM Mon Tue 28 Oct 1990 MSG Hi
  414. X.fi
  415. X.PP
  416. Xwould be issued only on Monday, 29 October, 1990.  It would not be issued
  417. Xon Tuesday, 30 October, 1990, since the 29th is the first date to satisfy
  418. Xthe
  419. X.I weekday
  420. Xconstraints.
  421. X.PP
  422. X.B Backward Scanning
  423. X.PP
  424. XSometimes, you need to incorporate "backward scanning" into your date
  425. Xspecification.  This is accomplished with the
  426. X.I back
  427. Xpart of the reminder specification.  If present, the
  428. X.I back
  429. Xis specified as a negative number.  This causes
  430. X.B remind
  431. Xto compute the trigger date as usual, and then move back the specified
  432. Xnumber of days.  For example:
  433. X.PP
  434. X.nf
  435. X    REM Mon 1 -7 MSG Last Monday of every month.
  436. X.fi
  437. X.PP
  438. XThis works by finding the first Monday of every month, and then moving
  439. X"back" seven days.  This results in the last Monday of the previous
  440. Xmonth.  (Warning:  If you have global 
  441. X.I OMITs, 
  442. Xthis might not work - see
  443. Xthe 
  444. X.I OMIT 
  445. Xcommand.)
  446. X.PP
  447. XAnother example is:
  448. X.PP
  449. X.nf
  450. X    REM 1 -1 MSG Last day of every month.
  451. X.fi
  452. X.PP
  453. XSince we don't know how many days are in a month, to get to the last day
  454. Xof a month, we go to the first day of the next month and then move back
  455. Xone day.
  456. X.PP
  457. X.B Remind
  458. Xwill automatically scan forwards and backwards until it finds a suitable
  459. Xtrigger date.  Note that large
  460. X.I back
  461. Xvalues can lead to a lot of backtracking and slow the execution of
  462. X.B remind.
  463. X.PP
  464. X.B Advance Warning
  465. X.PP
  466. X.B Remind
  467. Xcan warn you of an upcoming reminder as far in advance as you desire.  This
  468. Xis specified by a
  469. X.I delta,
  470. Xwhich is a positive number preceded by a "+" sign.  For example:
  471. X.PP
  472. X.nf
  473. X    REM 8 Jan 1992 +3 MSG Test1
  474. X    REM 1 +1 MSG Test2
  475. X.fi
  476. X.PP
  477. XThe reminder "Test1" will be triggered on the 8th of January, 1992, as well
  478. Xas the 3 days preceding it.  All told, "Test1" will be triggered on the
  479. X5th through the 8th of January, 1992.
  480. X.PP
  481. XThe reminder "Test2" will be triggered on the first day of every month, as
  482. Xwell as the day before.  In effect, "Test2" will be triggered on the first
  483. Xand last day of every month.
  484. X.PP
  485. X.I Delta
  486. Xand
  487. X.I back
  488. Xcan be combined:
  489. X.PP
  490. X.nf
  491. X    REM Mon 1 -7 +3 MSG Test3
  492. X.fi
  493. X.PP
  494. XThe reminder "Test3" will be triggered on the last Monday of every month,
  495. Xas well as the three days preceding it.
  496. X.PP
  497. X.B The MSG Keyword
  498. X.PP
  499. XThe
  500. X.I MSG
  501. Xkeyword causes the remaining part of the line to be passed through a
  502. Xsubstitution filter and then printed to standard output whenever the
  503. Xreminder is triggered.  See the section "Substitution" for more information
  504. Xabout the substitution filter.
  505. X.PP
  506. X.B The RUN Keyword
  507. X.PP
  508. XThe
  509. X.I RUN
  510. Xkeyword causes the remaining part of the line to be passed through the
  511. Xsubstitution filter and then passed to the default shell for execution
  512. Xwhenever the reminder is triggered.  If the
  513. X.B \-r
  514. Xcommand-line option is specified, all
  515. X.I REM
  516. Xcommands with the
  517. X.I RUN
  518. Xkeyword are ignored.
  519. X.PP
  520. X.B
  521. XGetting Reminded only Once per Day
  522. X.PP
  523. XIf you run
  524. X.B remind
  525. Xfrom your
  526. X.I .login
  527. Xscript, you may only want certain reminders to be run once per day, not
  528. Xonce per login.  Typically, this is used to control
  529. X.I RUN
  530. Xcommands so that they only execute once per day.  To specify this,
  531. Xplace the
  532. X.I ONCE
  533. Xkeyword in the reminder file.  When
  534. X.B remind
  535. Xencounters a
  536. X.I ONCE
  537. Xkeyword, it checks the last-access date of the reminder file.  If it is
  538. Xequal to the current date,
  539. X.B remind
  540. Xassumes that the reminder file has already been run once, and ignored the
  541. Xreminder.  If you start
  542. X.B remind
  543. Xwith the
  544. X.B \-o
  545. Xcommand-line option,
  546. X.B remind
  547. Xignores the
  548. X.I ONCE
  549. Xkeyword.
  550. X.PP
  551. X.B
  552. XLocally Omitting Weekdays
  553. X.PP
  554. XA
  555. X.I REM
  556. Xcommand containing the
  557. X.I OMIT
  558. Xkeyword followed by a list of weekdays causes the
  559. X.I delta
  560. Xand
  561. X.I back
  562. Xto ignore the specified weekdays when counting days.  This is called a
  563. X.I local OMIT.
  564. XFor example:
  565. X.PP
  566. X.nf
  567. X    REM 1 +1 OMIT Sat Sun MSG Test4
  568. X.fi
  569. X.PP
  570. XThis reminder prints "Test4" on the first day of every month, as well
  571. Xas the previous day.  If, however, the first day of the month falls on
  572. Xa Sunday or Monday, the reminder is also triggered on the previous
  573. XFriday, since the
  574. X.I delta
  575. Xof +1 does not count Saturdays or Sundays when moving backwards.  Here's
  576. Xanother example:
  577. X.PP
  578. X.nf
  579. X    REM 1 -1 +1 OMIT Sat Sun MSG Test5
  580. X.fi
  581. X.PP
  582. XThis reminder is triggered on the last working day of each month, as well
  583. Xas the working day preceding it.  Let's look at it in detail:
  584. X.PP
  585. XThe
  586. X.I day
  587. Xof "1" specifies the first day of each month.  The
  588. X.I back
  589. Xof "-1" tells
  590. X.B remind
  591. Xto go backwards by one day, not counting Saturday and Sunday as it moves.
  592. XThis takes us the the last working day of the preceding month, which is the
  593. Xtrigger date.  The
  594. X.I delta
  595. Xof "+1" ensures that the reminder will be triggered on the day preceding
  596. Xthis trigger date also.  Finally, if the trigger date happens to be
  597. Xa Monday, the
  598. X.I delta
  599. Xcombined with the
  600. X.I local OMIT
  601. Xcauses the reminder to be triggered on the Friday (and Saturday and Sunday)
  602. Xpreceding the trigger date.
  603. X.SH THE OMIT COMMAND
  604. X.I OMIT
  605. Xexists as a separate command as well as a keyword within a
  606. X.I REM
  607. Xstatement.  When used as a separate command, it is called a
  608. X.I global OMIT,
  609. Xand has the following form:
  610. X.RS
  611. XOMIT
  612. X.I day
  613. X.I month
  614. X[
  615. X.I year
  616. X]
  617. X.RE
  618. XThe arguments can be specified in any order.
  619. X.PP
  620. XThe form without the
  621. X.I year
  622. Xcomponent is used for holidays which fall on the same date each year.
  623. XFor example:
  624. X.PP
  625. X.nf
  626. X    OMIT 25 December    # Christmas
  627. X    OMIT  1 January        # New Year's Day
  628. X.fi
  629. X.PP
  630. X(Note that
  631. X.I OMIT
  632. Xcan have a following comment on the same line, unlike the
  633. X.I REM
  634. Xcommand.)
  635. X.PP
  636. XThe form with the
  637. X.I year
  638. Xcomponent is used for holidays which vary from year to year.  For example:
  639. X.PP
  640. X.nf
  641. X    OMIT 12 October 1990    # Columbus Day 1990
  642. X    OMIT 22 November 1990    # Thanksgiving Day 1990
  643. X.fi
  644. X.PP
  645. XIn its debugging messages,
  646. X.B remind
  647. Xcalls the first form a
  648. X.I partially-specified global OMIT
  649. Xand the second form a
  650. X.I fully-specified global OMIT.
  651. X.PP
  652. XThe dates specified by
  653. X.I global OMITs
  654. Xare omitted by the
  655. X.I back
  656. Xand
  657. X.I delta
  658. Xportions of a reminders, in addition to any
  659. X.I local OMITs.
  660. XFor example:
  661. X.PP
  662. X.nf
  663. X    OMIT 25 December
  664. X    REM 26 +1 OMIT Sat Sun MSG Test6
  665. X.fi
  666. X.PP
  667. XThis would issue a reminder on the 26th of each month, as well as the
  668. Xpreceding working day.  Also, on the 24th of December 1990, the reminder
  669. Xwould be issued.  Even though the 25th of December 1990 is a Tuesday, the
  670. X.I global OMIT
  671. Xwould cause the
  672. X.I delta
  673. Xto skip it.
  674. X.PP
  675. X.I Global OMITs
  676. Xare in force for all reminders following them in the reminder file.  Thus,
  677. Xyou could have a series of reminders for which
  678. X.I global OMITs
  679. Xare inappropriate (such as birthdays or reminders which rely on
  680. X.I back
  681. Xto get to a specific weekday) ahead of any
  682. X.I global OMITs,
  683. Xwith business reminders (for which omission of holidays is appropriate)
  684. Xfollowing the
  685. X.I global OMITs.
  686. X.SH THE INCLUDE COMMAND
  687. XThe
  688. X.I INCLUDE
  689. Xcommand has the following form:
  690. X.RS
  691. XINCLUDE
  692. X.I filename
  693. X.RE
  694. XThis causes
  695. X.B remind
  696. Xto suspend the current file and read the contents of the specified
  697. X.I filename.
  698. XOnce that file has been read,
  699. X.B remind
  700. Xcontinues reading the original file from where it left off.
  701. X.I INCLUDE
  702. Xcommands can be nested to a depth of 10.
  703. X.PP
  704. X.I INCLUDE
  705. Xallows you or someone else to maintain a file of holidays or system-wide
  706. Xreminders that everyone should get.  For example, your reminder file could
  707. Xlook something like this:
  708. X.PP
  709. X.nf
  710. X    #!/usr/local/bin/remind
  711. X    #
  712. X    # Place personal stuff here - birthdays, etc.
  713. X
  714. X    # Now get system-wide global OMITS (holidays)
  715. X    INCLUDE /usr/share/holidays
  716. X
  717. X    # and system-wide reminders
  718. X    INCLUDE /usr/share/reminders
  719. X
  720. X    # Place local business stuff here.
  721. X.fi
  722. X.PP
  723. XThe
  724. X.I ONCE
  725. Xkeyword operates on the last-access date of the top-level file.
  726. XThe access dates of
  727. X.I INCLUDEd
  728. Xfiles are not used to control the operation of the
  729. X.I ONCE
  730. Xkeyword.
  731. X.SH SUBSTITUTION
  732. XBefore being processed, the body of a
  733. X.I REM
  734. Xcommand is passed through a substitution filter.  The filter scans for
  735. Xsequences "%x" where "x" is any letter, and performs substitutions as
  736. Xshown below.  (All dates refer to the trigger date of the reminder.)
  737. X.TP
  738. X.B %a
  739. Xis replaced with "on \fIweekday, day month, year\fR"
  740. X.RS
  741. XFor example, consider the reminder:
  742. X.PP
  743. XREM 18 Oct 1990 +4 MSG Meeting with Bob %a.
  744. X.PP
  745. XOn 16 October 1990, it would print "Meeting with Bob on Thursday, 18 October,
  746. X1990."
  747. X.PP
  748. XOn 17 October 1990, it would print "Meeting with Bob tomorrow."
  749. X.PP
  750. XOn 18 October 1990, it would print "Meeting with Bob today."
  751. X.RE
  752. X.TP
  753. X.B %b
  754. Xis replaced with "in \fIdiff\fR day's time" where
  755. X.I diff
  756. Xis the
  757. X.B actual
  758. Xnumber of days between the current date and the trigger date.
  759. X(\fIOMITs\fR have no effect.)
  760. X.RS
  761. XFor example, consider:
  762. X.PP
  763. XREM 18 Oct 1990 +4 MSG Meeting with Bob %b.
  764. X.PP
  765. XOn 16 October 1990, it would print "Meeting with Bob in 2 days' time."
  766. X.PP
  767. XOn 17 October 1990, it would print "Meeting with Bob tomorrow."
  768. X.PP
  769. XOn 18 October 1990, it would print "Meeting with Bob today."
  770. X.RE
  771. X.TP
  772. X.B %c
  773. Xis replaced with "on \fIweekday\fR"
  774. X.RS
  775. XExample: REM 18 Oct 1990 +4 MSG Meeting with Bob %c.
  776. X.PP
  777. XOn 16 October 1990, it would print "Meeting with Bob on Thursday."
  778. X.PP
  779. XOn 17 October 1990, it would print "Meeting with Bob tomorrow."
  780. X.PP
  781. XOn 18 October 1990, it would print "Meeting with Bob today."
  782. X.RE
  783. X.TP
  784. X.B %d
  785. Xis replaced with "\fIday\fR", the day of the month.
  786. X.TP
  787. X.B %e
  788. Xis replaced with "on \fIdd/mm/yyyy\fR"
  789. X.TP
  790. X.B %f
  791. Xis replaced with "on \fImm/dd/yyyy\fR"
  792. X.TP
  793. X.B %g
  794. Xis replaced with "on \fIweekday, day month\fR"
  795. X.TP
  796. X.B %h
  797. Xis replaced with "on \fIdd/mm\fR"
  798. X.TP
  799. X.B %i
  800. Xis replaced with "on \fImm/dd\fR"
  801. X.TP
  802. X.B %j
  803. Xis replaced with "on \fIweekday, month day-th, year\fR"  This form appends the
  804. Xcharacters "st", "nd", "rd" or "th" to the day of the month, as appropriate.
  805. X.TP
  806. X.B %k
  807. Xis replaced with "on \fIweekday, month day-th\fR"
  808. X.TP
  809. X.B %l
  810. Xis replaced with "on \fIyyyy/mm/dd\fR"
  811. X.TP
  812. X.B %m
  813. Xis replaced with "\fImonth\fR", the name of the month.
  814. X.TP
  815. X.B %n
  816. Xis replaced with the number (1 to 12) of the month.
  817. X.TP
  818. X.B %o
  819. Xis replaced with " (today)" if and only if the current system date is the same
  820. Xas the date being used by
  821. X.B remind
  822. Xas the current date.  Recall that you can specify a date for
  823. X.B remind
  824. Xto use on the command line.  This substitution is not generally useful in a
  825. X.I REM
  826. Xcommand, but is useful in a
  827. X.I BANNER
  828. Xstatement.  (See the section "The BANNER Command.)
  829. X.TP
  830. X.B %p
  831. Xis replaced with "s" if the
  832. X.I diff
  833. Xbetween the current date and the trigger date is not 1.  You can use this
  834. Xto construct reminders like:
  835. X.RS
  836. XREM 1 Jan +4 MSG %x day%p to go before New Year!
  837. X.RE
  838. X.TP
  839. X.B %q
  840. Xis replaced with "'s" if the
  841. X.I diff
  842. Xbetween the trigger date and the current date is 1.  Otherwise, it is replaced
  843. Xwith "s'"  This can be used as follows:
  844. X.RS
  845. XREM 1 Jan +4 MSG New Year in %x day%q time!
  846. X.RE
  847. X.TP
  848. X.B %r
  849. Xis replaced with the day of the month (01 to 31) padded with a leading zero
  850. Xif needed to pad to two digits.
  851. X.TP
  852. X.B %s
  853. Xis replaced with "st", "nd", "rd" or "th" depending on the day of the month.
  854. X.TP
  855. X.B %t
  856. Xis replaced with the number of the month (01 to 12) padded to two digits
  857. Xwith a leading zero.
  858. X.TP
  859. X.B %u
  860. Xis replaced with "on \fIweekday, day-th month, year\fR"  This is similar
  861. Xto
  862. X.B %a
  863. Xexcept that "st", "nd", "rd" or "th" is added to the
  864. X.I day
  865. Xas appropriate.
  866. X.TP
  867. X.B %v
  868. Xis replaced with "on \fIweekday, day-th month\fR"
  869. X.TP
  870. X.B %w
  871. Xis replaced with "\fIweekday\fR", the name of the day of the week.
  872. X.TP
  873. X.B %x
  874. Xis replaced with the
  875. X.I diff
  876. Xbetween the current date and the trigger date.  The
  877. X.I diff
  878. Xis defined as the actual number of days between these two dates;
  879. X.I OMITs
  880. Xare not counted.  (Strict date subtraction is performed.)
  881. X.TP
  882. X.B %y
  883. Xis replaced with "\fIyear\fR", the year of the trigger date.
  884. X.TP
  885. X.B %z
  886. Xis replaced with "\fIyy\fR", the last two digits of the year.
  887. X.PP
  888. XNotes:
  889. X.TP
  890. X o
  891. XSubstitutions a, b, c, e, f, g, h, i, j, k, l, u and v all are replaced
  892. Xwith "today" if the current date equals the trigger date, or "tomorrow"
  893. Xif the trigger date is one day after the current date.  Thus, they are
  894. X.B not
  895. Xthe same as substitutions built up from the simpler %w, %y, etc.
  896. Xsequences.
  897. X.TP 
  898. Xo
  899. XCapital letters can be used in the substitution sequence, in which case
  900. Xthe first character of the substituted string is capitalized (if it is
  901. Xnormally a lower-case letter.)
  902. X.TP 
  903. Xo
  904. XAll other characters following a "%" sign are simply copied.  In particular,
  905. Xto get a "%" sign out, use "%%" in the body.  To start the body of a reminder
  906. Xwith a space, use "% ", since
  907. X.B remind
  908. Xnormally scans for the first non-space character after a
  909. X.I MSG
  910. Xor
  911. X.I RUN
  912. Xtoken.
  913. X.PP
  914. X.B 
  915. XMulti-line Reminders
  916. X.PP
  917. X.B Remind
  918. Xis a line-oriented program.  Normally, a blank line is printed between
  919. Xreminders.  You can "fake" a multi-line reminder by repeating single-line
  920. Xreminders, ending all but the last with "%".  The final "%" causes
  921. X.B remind
  922. Xnot to print a blank line after the reminder.  (Don't type any spaces after
  923. Xthe final "%")  Thus:
  924. X.PP
  925. X.nf
  926. X    REM 25 July +2 MSG This is an example of a%
  927. X    REM 25 July +2 MSG long reminder that takes up%
  928. X    REM 25 July +2 MSG three lines.
  929. X.fi
  930. X.SH THE BANNER COMMAND
  931. XWhen
  932. X.B remind
  933. Xissues reminders, it normally prints a message saying:
  934. X.PP
  935. X"Reminders for \fIweekday, day-th month, year\fR (today):"
  936. X.PP
  937. X(If you supply a date on the command line different from the system date,
  938. Xthe "(today)" portion is omitted.)
  939. X.PP
  940. XYou can change this default to anything you want with the
  941. X.I BANNER
  942. Xcommand.  It should appear in the reminder file before any
  943. X.I REM
  944. Xcommands.  (This is not enforced, but a
  945. X.I BANNER
  946. Xcommand encountered after a reminder has been triggered will be ignored.)
  947. X.PP
  948. XThe format of
  949. X.I BANNER
  950. Xis:
  951. X.PP
  952. XBANNER
  953. X.I string
  954. X.PP
  955. XThe
  956. X.I string
  957. Xis passed through the substitution mechanism described before, using the
  958. Xcurrent date for substitution.  The standard banner is described by:
  959. X.PP
  960. X.nf
  961. X    BANNER Reminders for %w, %d%s %m, %y%o:
  962. X.fi
  963. X.PP
  964. XYou can have a blank banner by using:
  965. X.PP
  966. X.nf
  967. X    BANNER %
  968. X.fi
  969. X.PP
  970. X.SH PURGING REMINDER FILES
  971. XYou should periodically purge your reminder file of "expired"
  972. X.I REM
  973. Xcommands and global
  974. X.I OMITs.
  975. XThese are reminders which took place in the past and can never occur
  976. Xagain, or
  977. X.I OMITs
  978. Xwhich are for past years.  Of course, only
  979. X.I REMs
  980. Xand
  981. X.I OMITs
  982. Xwith the
  983. X.I year
  984. Xspecified can ever expire.
  985. X.PP
  986. XTo purge your reminder file, run
  987. X.B remind
  988. Xin
  989. X.I purge
  990. Xmode.  This mode simply echoes non-expired lines to standard output, and
  991. Xexpired lines to standard error.  Thus, to purge a file, you could type:
  992. X.PP
  993. X.nf
  994. X    REMIND -p notes.old > notes.new
  995. X.fi
  996. X.PP
  997. XThe file "notes.new" would contain all non-expired lines from "notes.old."
  998. XAll expired lines are echoed to the screen.
  999. X.I INCLUDEd
  1000. Xfiles are read an processed, but not purged.  You must purge each
  1001. X.I INCLUDEd
  1002. Xfile separately.
  1003. X.PP
  1004. XYou can supply a date on the command line when purging, but beware:  If you
  1005. Xsupply a date in the future, you may inadvertently purge lines which have not
  1006. Xreally expired yet.
  1007. X.SH DEBUGGING A REMINDER FILE
  1008. XThe debug command-line option \-d is used to debug reminder files.  It tells
  1009. Xyou useful information about the reminder file.  It displays the trigger date
  1010. Xof each reminder, and places an asterisk by those which would be issued
  1011. Xon the current date.  It also informs you of
  1012. X.I OMITs
  1013. Xwhich have expired, and gives warnings about situations which could lead
  1014. Xto long execution times or unexpected results.
  1015. X.PP
  1016. XAll debugging messages are sent to standard error.
  1017. X.SH AUTHOR
  1018. XDavid F. Skoll
  1019. X.SH BUGS
  1020. X.B Remind
  1021. Xwas originally written for MS-DOS and ported to UNIX.  It does some things
  1022. Xin an ungainly way.
  1023. X.PP
  1024. XMulti-line reminders are a kludge.
  1025. X.PP
  1026. XDate calculation algorithms are fairly "brute force."
  1027. X
  1028. SHAR_EOF
  1029. $TOUCH -am 1101132790 remind.1 &&
  1030. chmod 0600 remind.1 ||
  1031. echo "restore of remind.1 failed"
  1032. set `wc -c remind.1`;Wc_c=$1
  1033. if test "$Wc_c" != "22384"; then
  1034.     echo original size 22384, current size $Wc_c
  1035. fi
  1036. fi
  1037. # ============= remind.mak ==============
  1038. if test X"$1" != X"-c" -a -f 'remind.mak'; then
  1039.     echo "File already exists: skipping 'remind.mak'"
  1040. else
  1041. sed 's/^X//' << 'SHAR_EOF' > remind.mak &&
  1042. X# Simple-minded MAKE file.
  1043. X
  1044. XHEADERS = globals.h protos.h defines.h
  1045. XWARN = /W3
  1046. Xmain.obj: main.c $(HEADERS)
  1047. X   cl $(WARN) /AS /Fomain.obj /c main.c
  1048. X
  1049. Xnextdate.obj: nextdate.c $(HEADERS)
  1050. X   cl $(WARN) /AS /Fonextdate.obj /c nextdate.c
  1051. X
  1052. Xdorem.obj: dorem.c $(HEADERS)
  1053. X   cl $(WARN) /AS /Fodorem.obj /c dorem.c
  1054. X
  1055. Xinit.obj: init.c $(HEADERS)
  1056. X   cl $(WARN) /AS /Foinit.obj /c init.c
  1057. X
  1058. Xdosubst.obj: dosubst.c
  1059. X   cl $(WARN) /AS /Fodosubst.obj /c dosubst.c
  1060. X
  1061. Xfiles.obj: files.c
  1062. X   cl $(WARN) /AS /Fofiles.obj /c files.c
  1063. X
  1064. Xremind.exe: main.obj nextdate.obj dorem.obj init.obj dosubst.obj files.obj
  1065. X   cl /Feremind.exe main.obj nextdate.obj dorem.obj init.obj dosubst.obj files.obj
  1066. X
  1067. SHAR_EOF
  1068. $TOUCH -am 1101134890 remind.mak &&
  1069. chmod 0600 remind.mak ||
  1070. echo "restore of remind.mak failed"
  1071. set `wc -c remind.mak`;Wc_c=$1
  1072. if test "$Wc_c" != "665"; then
  1073.     echo original size 665, current size $Wc_c
  1074. fi
  1075. fi
  1076. exit 0
  1077.