IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 17, 2006, 5:04:25 PM (20 years ago)
Author:
eugene
Message:

added additional chars to whitespace checks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/lib.shell/string.c

    r7917 r10073  
    33/**********************************************************************/
    44/* returns a pointer to an isolated string containing the first word,
    5    removing leading whitespace.  A "word" is a contiguous set of
     5   removing leading WHITESPACE.  A "word" is a contiguous set of
    66   characters from the set: alphanumerics, and any of: / . _ -
    7    Any other single, non-whitespace characters are considered to be
     7   Any other single, non-WHITESPACE characters are considered to be
    88   complete words in themselves.  Any characters surrounded by quotes
    99   make a single word
     
    1717  if (string == (char *) NULL) return ((char *) NULL);
    1818
    19   for (i = 0; whitespace (string[i]); i++);
     19  for (i = 0; OHANA_WHITESPACE (string[i]); i++);
    2020  if (string[i] == 0) return ((char *)NULL);
    2121  if (string[i] == ';') {
     
    6363
    6464
    65   for (j = i; (string[j] != 0) && (string[j] != ';') && !whitespace(string[j]); j++);
     65  for (j = i; (string[j] != 0) && (string[j] != ';') && !OHANA_WHITESPACE(string[j]); j++);
    6666  word = strncreate (&string[i], j - i);
    6767  return (word);
     
    7070
    7171/* returns a pointer to an isolated string containing the first command,
    72    removing leading whitespace.  A command ends with the first non whitespace */
     72   removing leading WHITESPACE.  A command ends with the first non WHITESPACE */
    7373char *thiscomm (char *string) {
    7474
     
    7878  if (string == (char *) NULL) return ((char *) NULL);
    7979
    80   for (i = 0; whitespace (string[i]); i++);
     80  for (i = 0; OHANA_WHITESPACE (string[i]); i++);
    8181  if (string[i] == 0) return ((char *)NULL);
    8282
    83   for (j = i; ((string[j] != 0) && !whitespace (string[j])); j++);
     83  for (j = i; ((string[j] != 0) && !OHANA_WHITESPACE (string[j])); j++);
    8484  if (i == j) return ((char *) NULL);
    8585
     
    122122  if (string == (char *) NULL) return ((char *) NULL);
    123123
    124   for (i = 0; whitespace (string[i]); i++);
     124  for (i = 0; OHANA_WHITESPACE (string[i]); i++);
    125125  if (string[i] == 0) return ((char *)NULL);
    126126
     
    134134    }
    135135    i++;
    136     for (; (string[i] != 0) && whitespace (string[i]); i++);
     136    for (; (string[i] != 0) && OHANA_WHITESPACE (string[i]); i++);
    137137    if (string[i] == 0) return ((char *) NULL);
    138138    return (&string[i]);
     
    155155      return ((char *)NULL);
    156156    }
    157     for (; (string[i] != 0) && whitespace (string[i]); i++);
     157    for (; (string[i] != 0) && OHANA_WHITESPACE (string[i]); i++);
    158158    if (string[i] == 0) return ((char *) NULL);
    159159    return (&string[i]);
     
    161161
    162162  if (string[i] == ';') i++;
    163   for (; (string[i] != 0) && (string[i] != ';') && !whitespace(string[i]); i++);
    164   for (; (string[i] != 0) && whitespace (string[i]); i++);
     163  for (; (string[i] != 0) && (string[i] != ';') && !OHANA_WHITESPACE(string[i]); i++);
     164  for (; (string[i] != 0) && OHANA_WHITESPACE (string[i]); i++);
    165165  if (string[i] == 0) return ((char *) NULL);
    166166
     
    169169
    170170/* returns a pointer to the next command, or (char *) NULL
    171    if there is not a next command.  A command is bounded by whitespace */
     171   if there is not a next command.  A command is bounded by WHITESPACE */
    172172char *nextcomm (char *string) {
    173173
     
    176176  if (string == (char *) NULL) return ((char *) NULL);
    177177 
    178   for (i = 0; (string[i] != 0) && !whitespace (string[i]); i++);
     178  for (i = 0; (string[i] != 0) && !OHANA_WHITESPACE (string[i]); i++);
    179179  if (string[i] == 0) return ((char *) NULL);
    180180 
    181   for (; whitespace (string[i]); i++);
     181  for (; OHANA_WHITESPACE (string[i]); i++);
    182182  if (string[i] == 0) return ((char *) NULL);
    183183
     
    193193  if (c == (char *) NULL) return ((char *) NULL);
    194194
    195   for (; !whitespace(*c) && (c >= string); c--);
     195  for (; !OHANA_WHITESPACE(*c) && (c >= string); c--);
    196196  if (c < string) return ((char *)NULL);
    197197
    198   for (; whitespace(*c) && (c >= string); c--);
     198  for (; OHANA_WHITESPACE(*c) && (c >= string); c--);
    199199  if (c < string)
    200200    return ((char *)NULL);
    201   for (; !whitespace(*c) && (c >= string); c--);
     201  for (; !OHANA_WHITESPACE(*c) && (c >= string); c--);
    202202  c++;
    203203  return (c);
     
    207207
    208208/* take a pointer to the beginning of a variable (ie $fred) and return
    209    a pointer to the next thing (non whitespace) which is not part of the
     209   a pointer to the next thing (non WHITESPACE) which is not part of the
    210210   variable extract only the variable name */
    211211
     
    224224  if (i == start) return ((char *) NULL);
    225225
    226   for (j = i; whitespace (string[j]); j++);
     226  for (j = i; OHANA_WHITESPACE (string[j]); j++);
    227227  if (string[j] == 0) return ((char *)NULL);
    228228
     
    240240  if (c == (char *) NULL) return ((char *) NULL);
    241241
    242   for (; (c >= string) && whitespace(*c); c--);
     242  for (; (c >= string) && OHANA_WHITESPACE(*c); c--);
    243243  if (c < string) return ((char *)NULL);
    244244
Note: See TracChangeset for help on using the changeset viewer.