home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / dev / misc / hwgrcs / src / rcs.rcsfiles / rcskeep.c,v < prev    next >
Encoding:
Text File  |  1995-06-25  |  19.8 KB  |  894 lines

  1. head    5.4;
  2. branch    5.4.1;
  3. access;
  4. symbols
  5.     HWGRCSP12F:5.4.1.4
  6.     HWGRCSP11F:5.4.1.4
  7.     HWGRCSP10F:5.4.1.4
  8.     HWGRCSP9:5.4.1.4
  9.     HWGRCSP8F:5.4.1.4
  10.     HWGRCSP7F:5.4.1.1
  11.     HWGRCSP6F:5.4.1.1
  12.     HWGRCSP5F:5.4.1.1
  13.     HWGRCSp4:5.4.1.1
  14.     HWGRCSp3:5.4.1
  15.     HWGRCS_Fish:5.4.1
  16.     HWGRCS:5.4.1;
  17. locks; strict;
  18. comment    @ * @;
  19.  
  20.  
  21. 5.4
  22. date    91.08.19.03.13.55;    author eggert;    state Exp;
  23. branches
  24.     5.4.1.1;
  25. next    ;
  26.  
  27. 5.4.1.1
  28. date    93.01.18.14.38.39;    author heinz;    state Exp;
  29. branches;
  30. next    5.4.1.2;
  31.  
  32. 5.4.1.2
  33. date    94.02.12.19.20.21;    author heinz;    state Exp;
  34. branches;
  35. next    5.4.1.3;
  36.  
  37. 5.4.1.3
  38. date    94.02.14.19.29.45;    author heinz;    state Exp;
  39. branches;
  40. next    5.4.1.4;
  41.  
  42. 5.4.1.4
  43. date    94.03.14.09.22.13;    author heinz;    state Exp;
  44. branches;
  45. next    ;
  46.  
  47.  
  48. desc
  49. @Checked in with -k 16.jan.93 HWG
  50. @
  51.  
  52.  
  53. 5.4
  54. log
  55. @checked in with -k by heinz at 1993/01/17 01:53:17
  56. @
  57. text
  58. @/*
  59.  *                     RCS keyword extraction
  60.  */
  61. /*****************************************************************************
  62.  *                       main routine: getoldkeys()
  63.  *                       Testprogram: define KEEPTEST
  64.  *****************************************************************************
  65.  */
  66.  
  67. /* Copyright (C) 1982, 1988, 1989 Walter Tichy
  68.    Copyright 1990, 1991 by Paul Eggert
  69.    Distributed under license by the Free Software Foundation, Inc.
  70.  
  71. This file is part of RCS.
  72.  
  73. RCS is free software; you can redistribute it and/or modify
  74. it under the terms of the GNU General Public License as published by
  75. the Free Software Foundation; either version 2, or (at your option)
  76. any later version.
  77.  
  78. RCS is distributed in the hope that it will be useful,
  79. but WITHOUT ANY WARRANTY; without even the implied warranty of
  80. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  81. GNU General Public License for more details.
  82.  
  83. You should have received a copy of the GNU General Public License
  84. along with RCS; see the file COPYING.  If not, write to
  85. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  86.  
  87. Report problems and direct all questions to:
  88.  
  89.     rcs-bugs@@cs.purdue.edu
  90.  
  91. */
  92.  
  93.  
  94.  
  95. /* $Log: rcskeep.c,v $
  96.  * Revision 5.4  1991/08/19  03:13:55  eggert
  97.  * Tune.
  98.  *
  99.  * Revision 5.3  1991/04/21  11:58:25  eggert
  100.  * Shorten names to keep them distinct on shortname hosts.
  101.  *
  102.  * Revision 5.2  1990/10/04  06:30:20  eggert
  103.  * Parse time zone offsets; future RCS versions may output them.
  104.  *
  105.  * Revision 5.1  1990/09/20  02:38:56  eggert
  106.  * ci -k now checks dates more thoroughly.
  107.  *
  108.  * Revision 5.0  1990/08/22  08:12:53  eggert
  109.  * Retrieve old log message if there is one.
  110.  * Don't require final newline.
  111.  * Remove compile-time limits; use malloc instead.  Tune.
  112.  * Permit dates past 1999/12/31.  Ansify and Posixate.
  113.  *
  114.  * Revision 4.6  89/05/01  15:12:56  narten
  115.  * changed copyright header to reflect current distribution rules
  116.  * 
  117.  * Revision 4.5  88/08/09  19:13:03  eggert
  118.  * Remove lint and speed up by making FILE *fp local, not global.
  119.  * 
  120.  * Revision 4.4  87/12/18  11:44:21  narten
  121.  * more lint cleanups (Guy Harris)
  122.  * 
  123.  * Revision 4.3  87/10/18  10:35:50  narten
  124.  * Updating version numbers. Changes relative to 1.1 actually relative
  125.  * to 4.1
  126.  * 
  127.  * Revision 1.3  87/09/24  14:00:00  narten
  128.  * Sources now pass through lint (if you ignore printf/sprintf/fprintf 
  129.  * warnings)
  130.  * 
  131.  * Revision 1.2  87/03/27  14:22:29  jenkins
  132.  * Port to suns
  133.  * 
  134.  * Revision 4.1  83/05/10  16:26:44  wft
  135.  * Added new markers Id and RCSfile; extraction added.
  136.  * Marker matching with trymatch().
  137.  * 
  138.  * Revision 3.2  82/12/24  12:08:26  wft
  139.  * added missing #endif.
  140.  *
  141.  * Revision 3.1  82/12/04  13:22:41  wft
  142.  * Initial revision.
  143.  *
  144.  */
  145.  
  146. /*
  147. #define KEEPTEST
  148. */
  149. /* Testprogram; prints out the keyword values found. */
  150.  
  151. #include  "rcsbase.h"
  152.  
  153. libId(keepId, "$Id: rcskeep.c,v 5.4 1991/08/19 03:13:55 eggert Exp $")
  154.  
  155. static int checknum P((char const*,int));
  156. static int getval P((RILE*,struct buf*,int));
  157. static int get0val P((int,RILE*,struct buf*,int));
  158. static int keepdate P((RILE*));
  159. static int keepid P((int,RILE*,struct buf*));
  160. static int keeprev P((RILE*));
  161.  
  162. int prevkeys;
  163. struct buf prevauthor, prevdate, prevrev, prevstate;
  164.  
  165.     int
  166. getoldkeys(fp)
  167.     register RILE *fp;
  168. /* Function: Tries to read keyword values for author, date,
  169.  * revision number, and state out of the file fp.
  170.  * If FNAME is nonnull, it is opened and closed instead of using FP.
  171.  * The results are placed into
  172.  * prevauthor, prevdate, prevrev, prevstate.
  173.  * Aborts immediately if it finds an error and returns false.
  174.  * If it returns true, it doesn't mean that any of the
  175.  * values were found; instead, check to see whether the corresponding arrays
  176.  * contain the empty string.
  177.  */
  178. {
  179.     register int c;
  180.     char keyword[keylength+1];
  181.     register char * tp;
  182.     int needs_closing;
  183.  
  184.     if (prevkeys)
  185.     return true;
  186.  
  187.     needs_closing = false;
  188.     if (!fp) {
  189.     if (!(fp = Iopen(workfilename, FOPEN_R_WORK, (struct stat*)0))) {
  190.         eerror(workfilename);
  191.         return false;
  192.     }
  193.     needs_closing = true;
  194.     }
  195.  
  196.     /* initialize to empty */
  197.     bufscpy(&prevauthor, "");
  198.     bufscpy(&prevdate, "");
  199.     bufscpy(&prevrev, "");
  200.     bufscpy(&prevstate, "");
  201.  
  202.     c = '\0'; /* anything but KDELIM */
  203.     for (;;) {
  204.         if ( c==KDELIM) {
  205.         do {
  206.         /* try to get keyword */
  207.         tp = keyword;
  208.         for (;;) {
  209.             Igeteof(fp, c, goto ok;);
  210.             switch (c) {
  211.             default:
  212.                 if (keyword+keylength <= tp)
  213.                 break;
  214.                 *tp++ = c;
  215.                 continue;
  216.  
  217.             case '\n': case KDELIM: case VDELIM:
  218.                 break;
  219.             }
  220.             break;
  221.         }
  222.         } while (c==KDELIM);
  223.             if (c!=VDELIM) continue;
  224.         *tp = c;
  225.         Igeteof(fp, c, break;);
  226.         switch (c) {
  227.         case ' ': case '\t': break;
  228.         default: continue;
  229.         }
  230.  
  231.         switch (trymatch(keyword)) {
  232.             case Author:
  233.         if (!keepid(0, fp, &prevauthor))
  234.             return false;
  235.         c = 0;
  236.                 break;
  237.             case Date:
  238.         if (!(c = keepdate(fp)))
  239.             return false;
  240.                 break;
  241.             case Header:
  242.             case Id:
  243.         if (!(
  244.               getval(fp, (struct buf*)nil, false) &&
  245.               keeprev(fp) &&
  246.               (c = keepdate(fp)) &&
  247.               keepid(c, fp, &prevauthor) &&
  248.               keepid(0, fp, &prevstate)
  249.         ))
  250.             return false;
  251.         /* Skip either ``who'' (new form) or ``Locker: who'' (old).  */
  252.         if (getval(fp, (struct buf*)nil, true) &&
  253.             getval(fp, (struct buf*)nil, true))
  254.             c = 0;
  255.         else if (nerror)
  256.             return false;
  257.         else
  258.             c = KDELIM;
  259.         break;
  260.             case Locker:
  261.             case Log:
  262.             case RCSfile:
  263.             case Source:
  264.         if (!getval(fp, (struct buf*)nil, false))
  265.             return false;
  266.         c = 0;
  267.                 break;
  268.             case Revision:
  269.         if (!keeprev(fp))
  270.             return false;
  271.         c = 0;
  272.                 break;
  273.             case State:
  274.         if (!keepid(0, fp, &prevstate))
  275.             return false;
  276.         c = 0;
  277.                 break;
  278.             default:
  279.                continue;
  280.             }
  281.         if (!c)
  282.         Igeteof(fp, c, c=0;);
  283.         if (c != KDELIM) {
  284.         error("closing %c missing on keyword", KDELIM);
  285.         return false;
  286.         }
  287.         if (*prevauthor.string && *prevdate.string && *prevrev.string && *prevstate.string) {
  288.                 break;
  289.            }
  290.         }
  291.     Igeteof(fp, c, break;);
  292.     }
  293.  
  294.  ok:
  295.     if (needs_closing)
  296.     Ifclose(fp);
  297.     else
  298.     Irewind(fp);
  299.     prevkeys = true;
  300.     return true;
  301. }
  302.  
  303.     static int
  304. badly_terminated()
  305. {
  306.     error("badly terminated keyword value");
  307.     return false;
  308. }
  309.  
  310.     static int
  311. getval(fp, target, optional)
  312.     register RILE *fp;
  313.     struct buf *target;
  314.     int optional;
  315. /* Reads a keyword value from FP into TARGET.
  316.  * Returns true if one is found, false otherwise.
  317.  * Does not modify target if it is nil.
  318.  * Do not report an error if OPTIONAL is set and KDELIM is found instead.
  319.  */
  320. {
  321.     int c;
  322.     Igeteof(fp, c, return badly_terminated(););
  323.     return get0val(c, fp, target, optional);
  324. }
  325.  
  326.     static int
  327. get0val(c, fp, target, optional)
  328.     register int c;
  329.     register RILE *fp;
  330.     struct buf *target;
  331.     int optional;
  332. /* Reads a keyword value from C+FP into TARGET, perhaps OPTIONALly.
  333.  * Same as getval, except C is the lookahead character.
  334.  */
  335. {   register char * tp;
  336.     char const *tlim;
  337.     register int got1;
  338.  
  339.     if (target) {
  340.     bufalloc(target, 1);
  341.     tp = target->string;
  342.     tlim = tp + target->size;
  343.     } else
  344.     tlim = tp = 0;
  345.     got1 = false;
  346.     for (;;) {
  347.     switch (c) {
  348.         default:
  349.         got1 = true;
  350.         if (tp) {
  351.             *tp++ = c;
  352.             if (tlim <= tp)
  353.             tp = bufenlarge(target, &tlim);
  354.         }
  355.         break;
  356.  
  357.         case ' ':
  358.         case '\t':
  359.         if (tp) {
  360.             *tp = 0;
  361. #            ifdef KEEPTEST
  362.             VOID printf("getval: %s\n", target);
  363. #            endif
  364.         }
  365.         if (!got1)
  366.             error("too much white space in keyword value");
  367.         return got1;
  368.  
  369.         case KDELIM:
  370.         if (!got1 && optional)
  371.             return false;
  372.         /* fall into */
  373.         case '\n':
  374.         case 0:
  375.         return badly_terminated();
  376.     }
  377.     Igeteof(fp, c, return badly_terminated(););
  378.     }
  379. }
  380.  
  381.  
  382.     static int
  383. keepdate(fp)
  384.     RILE *fp;
  385. /* Function: reads a date prevdate; checks format
  386.  * Return 0 on error, lookahead character otherwise.
  387.  */
  388. {
  389.     struct buf prevday, prevtime, prevzone;
  390.     register char const *p;
  391.     register int c;
  392.  
  393.     c = 0;
  394.     bufautobegin(&prevday);
  395.     if (getval(fp,&prevday,false)) {
  396.     bufautobegin(&prevtime);
  397.     if (getval(fp,&prevtime,false)) {
  398.         bufautobegin(&prevzone);
  399.         bufscpy(&prevzone, "");
  400.         Igeteof(fp, c, c=0;);
  401.         if (c=='-' || c=='+')
  402.         if (!get0val(c,fp,&prevzone,false))
  403.             c = 0;
  404.         else
  405.             Igeteof(fp, c, c=0;);
  406.         if (c) {
  407.         p = prevday.string;
  408.         bufalloc(&prevdate, strlen(p) + strlen(prevtime.string) + strlen(prevzone.string) + 5);
  409.         VOID sprintf(prevdate.string, "%s%s %s %s",
  410.             /* Parse dates put out by old versions of RCS.  */
  411.             isdigit(p[0]) && isdigit(p[1]) && p[2]=='/'  ?  "19"  :  "",
  412.             p, prevtime.string, prevzone.string
  413.         );
  414.         }
  415.         bufautoend(&prevzone);
  416.     }
  417.     bufautoend(&prevtime);
  418.     }
  419.     bufautoend(&prevday);
  420.     return c;
  421. }
  422.  
  423.     static int
  424. keepid(c, fp, b)
  425.     int c;
  426.     RILE *fp;
  427.     struct buf *b;
  428. /* Get previous identifier from C+FP into B.  */
  429. {
  430.     if (!c)
  431.         Igeteof(fp, c, return false;);
  432.     if (!get0val(c, fp, b, false))
  433.         return false;
  434.     checksid(b->string);
  435.     return true;
  436. }
  437.  
  438.     static int
  439. keeprev(fp)
  440.     RILE *fp;
  441. /* Get previous revision from FP into prevrev.  */
  442. {
  443.     return getval(fp,&prevrev,false) && checknum(prevrev.string,-1);
  444. }
  445.  
  446.  
  447.     static int
  448. checknum(sp,fields)
  449.     register char const *sp;
  450.     int fields;
  451. {    register int dotcount;
  452.      dotcount=0;
  453.      while(*sp) {
  454.         if (*sp=='.') dotcount++;
  455.     else if (!isdigit(*sp)) return false;
  456.         sp++;
  457.      }
  458.      return fields<0 ? dotcount&1 : dotcount==fields;
  459. }
  460.  
  461.  
  462.  
  463. #ifdef KEEPTEST
  464.  
  465. char const cmdid[] ="keeptest";
  466.  
  467.     int
  468. main(argc, argv)
  469. int  argc; char  *argv[];
  470. {
  471.         while (*(++argv)) {
  472.         workfilename = *argv;
  473.         getoldkeys((RILE*)0);
  474.                 VOID printf("%s:  revision: %s, date: %s, author: %s, state: %s\n",
  475.                 *argv, prevrev.string, prevdate.string, prevauthor.string, prevstate.string);
  476.     }
  477.     exitmain(EXIT_SUCCESS);
  478. }
  479. #endif
  480. @
  481.  
  482.  
  483. 5.4.1.1
  484. log
  485. @Start of the AMIGA port of RCS 5.6. I call it HWGRCS now ;^)
  486. @
  487. text
  488. @@
  489.  
  490.  
  491. 5.4.1.2
  492. log
  493. @Support for the new keywords VER, AmigaREV, and AmigaProtection.
  494. @
  495. text
  496. @a38 3
  497.  * Revision 5.4.1.1  1993/01/18  14:38:39  heinz
  498.  * Start of the AMIGA port of RCS 5.6. I call it HWGRCS now ;^)
  499.  *
  500. d59 1
  501. a59 1
  502.  *
  503. d62 1
  504. a62 1
  505.  *
  506. d65 1
  507. a65 1
  508.  *
  509. d69 1
  510. a69 1
  511.  *
  512. d71 1
  513. a71 1
  514.  * Sources now pass through lint (if you ignore printf/sprintf/fprintf
  515. d73 1
  516. a73 1
  517.  *
  518. d76 1
  519. a76 1
  520.  *
  521. d80 1
  522. a80 1
  523.  *
  524. d96 1
  525. a96 1
  526. libId(keepId, "$Id: rcskeep.c,v 5.4.1.1 1993/01/18 14:38:39 heinz Exp heinz $")
  527. a106 13
  528. #ifdef _AMIGA
  529. /* This is a function similar to getval, but it reads anything up to
  530.    '\n' or KDELIM into the target!
  531. */
  532.         static int
  533. linegetval(RILE *fp, struct buf *target, int readkdelim)
  534. /* Reads a keyword value from C+FP into TARGET, perhaps OPTIONALly.
  535.  * Same as getval, except C is the lookahead character.
  536.  */
  537. {
  538.     char * tp;
  539.     char const *tlim;
  540.     int got1, c;
  541. d108 1
  542. a108 44
  543.     Igeteof(fp, c, return false;);
  544.     if (target)
  545.     {
  546.         bufalloc(target, 1);
  547.         tp = target->string;
  548.         tlim = tp + target->size;
  549.     }
  550.     else
  551.     {
  552.         tlim = tp = 0;
  553.     } /* if */
  554.  
  555.     got1 = false;
  556.     for (;;)
  557.     {
  558.         if(c && c != '\n' && (c != KDELIM || readkdelim))
  559.         {
  560.             got1 = true;
  561.             if (tp)
  562.             {
  563.                 *tp++ = c;
  564.                 if (tlim <= tp)
  565.                     tp = bufenlarge(target, &tlim);
  566.             } /* if */
  567.         } /* if */
  568.  
  569.         if(!c || c == KDELIM || c == '\n')
  570.         {
  571.             if (tp)
  572.             {
  573.                 *tp = 0;
  574.             } /* if */
  575.             if (!got1)
  576.                 error("too much white space in keyword value");
  577.             return true;
  578.         } /* if */
  579.         Igeteof(fp, c, return false;);
  580.     } /* for */
  581.  
  582. } /* linegetval */
  583.  
  584. #endif /* _AMIGA */
  585.  
  586.         int
  587. d110 1
  588. a110 1
  589.         register RILE *fp;
  590. d128 1
  591. a128 1
  592.         return true;
  593. d132 5
  594. a136 5
  595.         if (!(fp = Iopen(workfilename, FOPEN_R_WORK, (struct stat*)0))) {
  596.             eerror(workfilename);
  597.             return false;
  598.         }
  599.         needs_closing = true;
  600. d148 18
  601. a165 18
  602.             do {
  603.                 /* try to get keyword */
  604.                 tp = keyword;
  605.                 for (;;) {
  606.                     Igeteof(fp, c, goto ok;);
  607.                     switch (c) {
  608.                         default:
  609.                             if (keyword+keylength <= tp)
  610.                                 break;
  611.                             *tp++ = c;
  612.                             continue;
  613.  
  614.                         case '\n': case KDELIM: case VDELIM:
  615.                             break;
  616.                     }
  617.                     break;
  618.                 }
  619.             } while (c==KDELIM);
  620. d167 6
  621. a172 6
  622.             *tp = c;
  623.             Igeteof(fp, c, break;);
  624.             switch (c) {
  625.                 case ' ': case '\t': break;
  626.                 default: continue;
  627.             }
  628. d174 1
  629. a174 1
  630.             switch (trymatch(keyword)) {
  631. d176 3
  632. a178 3
  633.                 if (!keepid(0, fp, &prevauthor))
  634.                     return false;
  635.                 c = 0;
  636. d181 2
  637. a182 2
  638.                 if (!(c = keepdate(fp)))
  639.                     return false;
  640. d186 17
  641. a202 17
  642.                 if (!(
  643.                       getval(fp, (struct buf*)nil, false) &&
  644.                       keeprev(fp) &&
  645.                       (c = keepdate(fp)) &&
  646.                       keepid(c, fp, &prevauthor) &&
  647.                       keepid(0, fp, &prevstate)
  648.                 ))
  649.                     return false;
  650.                 /* Skip either ``who'' (new form) or ``Locker: who'' (old).  */
  651.                 if (getval(fp, (struct buf*)nil, true) &&
  652.                     getval(fp, (struct buf*)nil, true))
  653.                         c = 0;
  654.                 else if (nerror)
  655.                         return false;
  656.                 else
  657.                         c = KDELIM;
  658.                 break;
  659. d207 3
  660. a209 3
  661.                 if (!getval(fp, (struct buf*)nil, false))
  662.                     return false;
  663.                 c = 0;
  664. d212 3
  665. a214 3
  666.                 if (!keeprev(fp))
  667.                     return false;
  668.                 c = 0;
  669. d217 3
  670. a219 19
  671.                 if (!keepid(0, fp, &prevstate))
  672.                     return false;
  673.                 c = 0;
  674.                 break;
  675. #ifdef _AMIGA
  676.             case CBMVersion:
  677.                 if (!linegetval(fp, (struct buf*)nil, true))
  678.                     return false;
  679.                 c = KDELIM;
  680.                 break;
  681.             case CBMRevision:
  682.                 if (!linegetval(fp, (struct buf*)nil, false))
  683.                     return false;
  684.                 c = 0;
  685.                 break;
  686.             case CBMProtection:
  687.                 if (!linegetval(fp, (struct buf*)nil, false))
  688.                     return false;
  689.                 c = 0;
  690. a220 1
  691. #endif /* _AMIGA */
  692. d224 7
  693. a230 7
  694.             if (!c)
  695.                 Igeteof(fp, c, c=0;);
  696.             if (c != KDELIM) {
  697.                 error("closing %c missing on keyword", KDELIM);
  698.                 return false;
  699.             }
  700.             if (*prevauthor.string && *prevdate.string && *prevrev.string && *prevstate.string) {
  701. d234 1
  702. a234 1
  703.         Igeteof(fp, c, break;);
  704. d239 1
  705. a239 1
  706.         Ifclose(fp);
  707. d241 1
  708. a241 1
  709.         Irewind(fp);
  710. d246 1
  711. a246 1
  712.         static int
  713. d249 2
  714. a250 2
  715.         error("badly terminated keyword value");
  716.         return false;
  717. d253 1
  718. a253 1
  719.         static int
  720. d255 3
  721. a257 3
  722.         register RILE *fp;
  723.         struct buf *target;
  724.         int optional;
  725. d264 3
  726. a266 3
  727.         int c;
  728.         Igeteof(fp, c, return badly_terminated(););
  729.         return get0val(c, fp, target, optional);
  730. d269 1
  731. a269 1
  732.         static int
  733. d271 4
  734. a274 4
  735.         register int c;
  736.         register RILE *fp;
  737.         struct buf *target;
  738.         int optional;
  739. d283 3
  740. a285 3
  741.         bufalloc(target, 1);
  742.         tp = target->string;
  743.         tlim = tp + target->size;
  744. d287 1
  745. a287 1
  746.         tlim = tp = 0;
  747. d290 31
  748. a320 31
  749.         switch (c) {
  750.             default:
  751.                 got1 = true;
  752.                 if (tp) {
  753.                     *tp++ = c;
  754.                     if (tlim <= tp)
  755.                         tp = bufenlarge(target, &tlim);
  756.                 }
  757.                 break;
  758.  
  759.             case ' ':
  760.             case '\t':
  761.                 if (tp) {
  762.                     *tp = 0;
  763. #                   ifdef KEEPTEST
  764.                         VOID printf("getval: %s\n", target);
  765. #                   endif
  766.                 }
  767.                 if (!got1)
  768.                     error("too much white space in keyword value");
  769.                 return got1;
  770.  
  771.             case KDELIM:
  772.                 if (!got1 && optional)
  773.                     return false;
  774.                 /* fall into */
  775.             case '\n':
  776.             case 0:
  777.                 return badly_terminated();
  778.         }
  779.         Igeteof(fp, c, return badly_terminated(););
  780. d325 1
  781. a325 1
  782.         static int
  783. d327 1
  784. a327 1
  785.         RILE *fp;
  786. d339 22
  787. a360 22
  788.         bufautobegin(&prevtime);
  789.         if (getval(fp,&prevtime,false)) {
  790.             bufautobegin(&prevzone);
  791.             bufscpy(&prevzone, "");
  792.             Igeteof(fp, c, c=0;);
  793.             if (c=='-' || c=='+')
  794.                 if (!get0val(c,fp,&prevzone,false))
  795.                     c = 0;
  796.                 else
  797.                     Igeteof(fp, c, c=0;);
  798.             if (c) {
  799.                 p = prevday.string;
  800.                 bufalloc(&prevdate, strlen(p) + strlen(prevtime.string) + strlen(prevzone.string) + 5);
  801.                 VOID sprintf(prevdate.string, "%s%s %s %s",
  802.                     /* Parse dates put out by old versions of RCS.  */
  803.                     isdigit(p[0]) && isdigit(p[1]) && p[2]=='/'  ?  "19"  :  "",
  804.                     p, prevtime.string, prevzone.string
  805.                 );
  806.             }
  807.             bufautoend(&prevzone);
  808.         }
  809.         bufautoend(&prevtime);
  810. d366 1
  811. a366 1
  812.         static int
  813. d368 3
  814. a370 3
  815.         int c;
  816.         RILE *fp;
  817.         struct buf *b;
  818. d373 6
  819. a378 6
  820.         if (!c)
  821.             Igeteof(fp, c, return false;);
  822.         if (!get0val(c, fp, b, false))
  823.             return false;
  824.         checksid(b->string);
  825.         return true;
  826. d381 1
  827. a381 1
  828.         static int
  829. d383 1
  830. a383 1
  831.         RILE *fp;
  832. d386 1
  833. a386 1
  834.         return getval(fp,&prevrev,false) && checknum(prevrev.string,-1);
  835. d390 1
  836. a390 1
  837.         static int
  838. d392 2
  839. a393 2
  840.         register char const *sp;
  841.         int fields;
  842. d398 1
  843. a398 1
  844.         else if (!isdigit(*sp)) return false;
  845. d410 1
  846. a410 1
  847.         int
  848. d415 2
  849. a416 2
  850.                 workfilename = *argv;
  851.                 getoldkeys((RILE*)0);
  852. d418 3
  853. a420 3
  854.                             *argv, prevrev.string, prevdate.string, prevauthor.string, prevstate.string);
  855.         }
  856.         exitmain(EXIT_SUCCESS);
  857. @
  858.  
  859.  
  860. 5.4.1.3
  861. log
  862. @First version of Amiga keywords implemented. Ugly, but acceptable for now.
  863. @
  864. text
  865. @a38 3
  866.  * Revision 5.4.1.2  1994/02/12  19:20:21  heinz
  867.  * Support for the new keywords VER, AmigaREV, and AmigaProtection.
  868.  *
  869. d99 1
  870. a99 1
  871. libId(keepId, "$Id: rcskeep.c,v 5.4.1.2 1994/02/12 19:20:21 heinz Exp heinz $")
  872. d287 4
  873. a290 1
  874.             case CBMDate:
  875. @
  876.  
  877.  
  878. 5.4.1.4
  879. log
  880. @Oops. Wrong delimiter corrected.
  881. @
  882. text
  883. @a38 3
  884.  * Revision 5.4.1.3  1994/02/14  19:29:45  heinz
  885.  * First version of Amiga keywords implemented. Ugly, but acceptable for now.
  886.  *
  887. d102 1
  888. a102 1
  889. libId(keepId, "$Id: rcskeep.c,v 5.4.1.3 1994/02/14 19:29:45 heinz Exp heinz $")
  890. d294 1
  891. a294 1
  892.                 c = KDELIM;
  893. @
  894.