Annotation of 43BSDTahoe/new/notes/src/check.c, revision 1.1.1.1

1.1       root        1: #include "parms.h"
                      2: #include "structs.h"
                      3: 
                      4: #ifdef RCSIDENT
                      5: static char rcsid[] = "$Header: check.c,v 1.7 85/01/18 15:06:01 notes Rel $";
                      6: #endif RCSIDENT
                      7: 
                      8: /*
                      9:  *     check.c - checks the arguement supplied. If there are any
                     10:  *     .'s or /'s in the name a -1 is returned. 
                     11:  *     If the string is . and / free, then a zero is returned.
                     12:  *
                     13:  *     Ray Essick      23-nov-1981
                     14:  */
                     15: 
                     16: 
                     17: chkpath (p)
                     18: char   *p;
                     19: {
                     20:     int     count;
                     21: 
                     22:     if (*p == '.')
                     23:        return (-1);                                    /* hidden is bad */
                     24:     count = 0;
                     25:     while (*p && (*p != '/') && (*p != ' ') && (*p != ':'))
                     26:     {
                     27:        count++;
                     28:        p++;
                     29:     }
                     30:     if (count > NNLEN)
                     31:        return (-1);                                    /* name too long */
                     32:     if (*p == 0)
                     33:        return 0;
                     34:     else
                     35:        return (-1);
                     36: }
                     37: 
                     38: /*
                     39:  *     patcheck - look for a pattern character. These are the shell
                     40:  *     meta-characters ?, [, and *
                     41:  *     Return 0 if non exist in the string
                     42:  */
                     43: patcheck (p)
                     44: char   *p;
                     45: {
                     46:     register char  *q;
                     47:     q = p;
                     48:     while (*q && (*q != '?') && (*q != '[') && (*q != '*'))
                     49:        q++;
                     50:     return (*q != '\0');                               /* return 0 if no pattern */
                     51: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.