1: /*
   2:  *                     RCS keyword table and match operation
   3:  */
   4: #ifndef lint
   5: static char rcsid[]= "$Id: rcskeys.c,v 4.2 87/10/18 10:36:33 narten Exp $ Purdue CS";
   6: #endif
   7: /**********************************************************************************
   8:  **********************************************************************************
   9:  *
  10:  * Copyright (C) 1982 by Walter F. Tichy
  11:  *                       Purdue University
  12:  *                       Computer Science Department
  13:  *                       West Lafayette, IN 47907
  14:  *
  15:  * All rights reserved. No part of this software may be sold or distributed
  16:  * in any form or by any means without the prior written permission of the
  17:  * author.
  18:  * Report problems and direct all inquiries to Tichy@purdue (ARPA net).
  19:  */
  20: 
  21: 
  22: /* $Log:	rcskeys.c,v $
  23:  * Revision 4.2  87/10/18  10:36:33  narten
  24:  * Updating version numbers. Changes relative to 1.1 actuallyt
  25:  * relative to 4.1
  26:  *
  27:  * Revision 1.2  87/09/24  14:00:10  narten
  28:  * Sources now pass through lint (if you ignore printf/sprintf/fprintf
  29:  * warnings)
  30:  *
  31:  * Revision 1.1  84/01/23  14:50:32  kcs
  32:  * Initial revision
  33:  *
  34:  * Revision 4.1  83/05/04  10:06:53  wft
  35:  * Initial revision.
  36:  *
  37:  */
  38: 
  39: 
  40: #include "rcsbase.h"
  41: 
  42: 
  43: 
  44: struct { char * keyword; enum markers marker;} markertable[] =
  45:         {{AUTHOR,   Author  },
  46:          {DATE,     Date    },
  47:          {HEADER,   Header  },
  48:          {IDH,      Id      },
  49:          {LOCKER,   Locker  },
  50:          {LOG,      Log     },
  51:          {RCSFILE,  RCSfile },
  52:          {REVISION, Revision},
  53:          {SOURCE,   Source  },
  54:          {STATE,    State   },
  55:          {nil,      Nomatch }};
  56: 
  57: 
  58: 
  59: enum markers trymatch(string,onlyvdelim)
  60: char * string;
  61: /* function: Checks whether string starts with a keyword followed
  62:  * by a KDELIM or a VDELIM. If onlyvdelim==true, only a VDELIM
  63:  * may follow the keyword.
  64:  * If successful, returns the appropriate marker, otherwise Nomatch.
  65:  */
  66: {
  67:         register int j;
  68:     register char * p, * s;
  69:         for (j=0; markertable[j].keyword!=nil; j++ ) {
  70:         /* try next keyword */
  71:         p = markertable[j].keyword; s = string;
  72:         while (*p!='\0' && *s!='\0' && *p == *s) {
  73:             p++; s++;
  74:         }
  75:         if (*p != '\0') continue; /* no match */
  76:         if ((*s == VDELIM) || (!onlyvdelim && (*s == KDELIM)))
  77:             return(markertable[j].marker);
  78:         }
  79:         return(Nomatch);
  80: }

Defined functions

Defined variables

rcsid defined in line 5; never used
Last modified: 1987-12-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1868
Valid CSS Valid XHTML 1.0 Strict