Back to index

tetex-bin  3.0
Functions
name_match.c File Reference
#include <curses.priv.h>
#include <term.h>
#include <tic.h>

Go to the source code of this file.

Functions

 _nc_first_name (const char *const sp)
 _nc_name_match (const char *const namelst, const char *const name, const char *const delim)

Function Documentation

_nc_first_name ( const char *const  sp)

Definition at line 46 of file name_match.c.

{
    static char *buf;
    register unsigned n;

#if NO_LEAKS
    if (sp == 0) {
       FreeAndNull(buf);    /* for leak-testing */
       return 0;
    }
#endif

    if (buf == 0)
       buf = typeMalloc(char, MAX_NAME_SIZE + 1);
    for (n = 0; n < MAX_NAME_SIZE; n++) {
       if ((buf[n] = sp[n]) == '\0'
           || (buf[n] == '|'))
           break;
    }
    buf[n] = '\0';
    return (buf);
}

Here is the caller graph for this function:

_nc_name_match ( const char *const  namelst,
const char *const  name,
const char *const  delim 
)

Definition at line 77 of file name_match.c.

{
    const char *s, *d, *t;
    int code, found;

    if ((s = namelst) != 0) {
       while (*s != '\0') {
           for (d = name; *d != '\0'; d++) {
              if (*s != *d)
                  break;
              s++;
           }
           found = FALSE;
           for (code = TRUE; *s != '\0'; code = FALSE, s++) {
              for (t = delim; *t != '\0'; t++) {
                  if (*s == *t) {
                     found = TRUE;
                     break;
                  }
              }
              if (found)
                  break;
           }
           if (code && *d == '\0')
              return code;
           if (*s++ == 0)
              break;
       }
    }
    return FALSE;
}

Here is the caller graph for this function: