/[qemacs]/qemacs/util.c
ViewVC logotype

Diff of /qemacs/util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by chqrlie, Mon May 9 02:17:47 2005 UTC revision 1.8 by chqrlie, Mon May 9 03:19:36 2005 UTC
# Line 259  const char *basename(const char *filenam Line 259  const char *basename(const char *filenam
259      const char *p;      const char *p;
260      p = strrchr(filename, '/');      p = strrchr(filename, '/');
261      if (!p) {      if (!p) {
262          /* should also scan for ':' */          /* should also scan for ':' */
263          return filename;          return filename;
264      } else {      } else {
265          p++;          p++;
# Line 354  int strfind(const char *keytable, const Line 354  int strfind(const char *keytable, const
354      const char *p;      const char *p;
355    
356      if (casefold) {      if (casefold) {
357          pstrcpy(buf, sizeof(buf), str);          pstrcpy(buf, sizeof(buf), str);
358          str = buf;          str = buf;
359          css_strtolower(buf, sizeof(buf));          css_strtolower(buf, sizeof(buf));
360      }      }
361      c = *str;      c = *str;
362      len = strlen(str);      len = strlen(str);
363      /* need to special case the empty string */      /* need to special case the empty string */
364      if (len == 0)      if (len == 0)
365          return strstr(keytable, "||") != NULL;          return strstr(keytable, "||") != NULL;
366    
367      /* initial and trailing | are optional */      /* initial and trailing | are optional */
368      /* they do not cause the empty string to match */      /* they do not cause the empty string to match */
369      for (p = keytable;;) {      for (p = keytable;;) {
370          if (!memcmp(p, str, len) && (p[len] == '|' || p[len] == '\0'))          if (!memcmp(p, str, len) && (p[len] == '|' || p[len] == '\0'))
371              return 1;              return 1;
372          for (;;) {          for (;;) {
373              p = strchr(p + 1, c);              p = strchr(p + 1, c);
374              if (!p)              if (!p)
375                  return 0;                  return 0;
376              if (p[-1] == '|')              if (p[-1] == '|')
377                  break;                  break;
378          }          }
379      }      }
380  }  }
381    
# Line 397  static inline int utoupper(int c) Line 397  static inline int utoupper(int c)
397      return c;      return c;
398  }  }
399    
400  int ustristart(const unsigned int *str, const char *val, const unsigned int **ptr)  int ustristart(const unsigned int *str, const char *val,
401                   const unsigned int **ptr)
402  {  {
403      const unsigned int *p;      const unsigned int *p;
404      const char *q;      const char *q;

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26