home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / utils / sercli.shr / sercli / src / rcs / config.c,v next >
Encoding:
Text File  |  1993-06-16  |  2.8 KB  |  189 lines

  1. head    1.5;
  2. access;
  3. symbols
  4.     sercli_v1_10:1.5
  5.     sercli_v1_9:1.4
  6.     sercli_v1_8:1.4
  7.     sercli_v1_7:1.3
  8.     sercli_v1_6:1.2
  9.     sercli_v1_5:1.1;
  10. locks
  11.     rkr:1.5;
  12. comment    @**  @;
  13.  
  14.  
  15. 1.5
  16. date    93.06.16.23.28.53;    author rkr;    state Exp;
  17. branches;
  18. next    1.4;
  19.  
  20. 1.4
  21. date    91.12.20.09.43.39;    author rkr;    state Exp;
  22. branches;
  23. next    1.3;
  24.  
  25. 1.3
  26. date    91.12.10.02.48.05;    author rkr;    state Exp;
  27. branches;
  28. next    1.2;
  29.  
  30. 1.2
  31. date    91.12.02.10.51.23;    author rkr;    state Exp;
  32. branches;
  33. next    1.1;
  34.  
  35. 1.1
  36. date    91.11.28.08.25.13;    author rkr;    state Exp;
  37. branches;
  38. next    ;
  39.  
  40.  
  41. desc
  42. @sercli is a program to permit shell-like interface to the serial port,
  43. while also permitting easy config- and run-time-control over the way the
  44. serial port (or even _which_ serial port) is used.
  45.  
  46. @
  47.  
  48.  
  49. 1.5
  50. log
  51. @Added per-file copyright notice, as suggested by GPL.
  52. @
  53. text
  54. @/*
  55. **  $Source: WB_2.1:homes/rkr/prog/sercli/src/rcs/config.c,v $
  56. **  $Author: rkr $
  57. **  $Revision: 1.4 $
  58. **  $Locker:  $
  59. **  $State: Exp $
  60. **  $Date: 1991/12/20 09:43:39 $
  61. **
  62. **  sercli (an Amiga .device <-> FIFO interface tool)
  63. **  Copyright (C) 1993  Richard Rauch
  64. **
  65. **  See /doc/sercli.doc and /COPYING for use and distribution license.
  66. **
  67. */
  68.  
  69. #include "defs.h"
  70. #include "misc.h"
  71. #include "config.h"
  72.  
  73.  
  74.  
  75. /*
  76. **  If the text is blank, or begins with one of certain characters, the
  77. **  text is considered a comment.
  78. **
  79. **  It might be better to provide these in a global string variable, or a
  80. **  parameter to this function, and use one of the ANSI searching functions
  81. **  to scan {comment_chars} for the first char in {text}.
  82. **
  83. **
  84. **  If the text is not deemed a comment, we locate the first colon in the
  85. **  line; this becomes a terminator for a compare.
  86. **
  87. **  Then, each option in {opts} is compared to text, up to, but not
  88. **  including, the colon.  Case INsensitive
  89. **
  90. */
  91. int match (char *text, option *opts)
  92. {
  93.     int
  94.     end,
  95.     result;
  96.  
  97.     switch (*text)
  98.     {
  99.     case 0:
  100.     case ' ':
  101.     case '\t':
  102.     case '\n':
  103.     case '\v':
  104.     case '\r':
  105.     case '*':
  106.     case '#':
  107.     case ';':
  108.     case ':':
  109.     result = OPTION_COMMENT;
  110.     break;
  111.  
  112.     default:
  113.     for (end = 0; (text [end]) && (text [end] != ':') ; ++end)
  114.         ;
  115.  
  116.     for (; OPTION_NULL != opts->o_id; ++opts)
  117.         if (strnicmp (text, opts->o_text, end) == 0)
  118.         break;
  119.  
  120.     result = opts->o_id;
  121.     if (!result)
  122.         result = OPTION_NOT_FOUND;
  123.  
  124.     break;
  125.     }
  126.     return (result);
  127. }
  128.  
  129. @
  130.  
  131.  
  132. 1.4
  133. log
  134. @*** empty log message ***
  135. @
  136. text
  137. @d2 1
  138. a2 1
  139. **  $Source: Workbench:personal/rkr/prog/sercli/src/rcs/config.c,v $
  140. d4 2
  141. a5 2
  142. **  $Revision: 1.3 $
  143. **  $Locker: rkr $
  144. d7 6
  145. a12 1
  146. **  $Date: 91/12/10 02:48:05 $
  147. @
  148.  
  149.  
  150. 1.3
  151. log
  152. @*** empty log message ***
  153. @
  154. text
  155. @d4 1
  156. a4 1
  157. **  $Revision: 1.2 $
  158. d7 1
  159. a7 1
  160. **  $Date: 91/12/02 10:51:23 $
  161. @
  162.  
  163.  
  164. 1.2
  165. log
  166. @*** empty log message ***
  167. @
  168. text
  169. @d7 1
  170. a7 1
  171. **  $Date: 91/12/02 10:42:00 $
  172. @
  173.  
  174.  
  175. 1.1
  176. log
  177. @Initial revision
  178. @
  179. text
  180. @d2 6
  181. a7 6
  182. **  $Source$
  183. **  $Author$
  184. **  $Revision$
  185. **  $Locker$
  186. **  $State$
  187. **  $Date$
  188. @
  189.