|
|
BSD 4.3tahoe
#include "parms.h"
#include "structs.h"
#ifdef RCSIDENT
static char rcsid[] = "$Header: /var/lib/cvsd/repos/CSRG/43BSDTahoe/new/notes/src/check.c,v 1.1.1.1 2018/04/24 16:12:58 root Exp $";
#endif RCSIDENT
/*
* check.c - checks the arguement supplied. If there are any
* .'s or /'s in the name a -1 is returned.
* If the string is . and / free, then a zero is returned.
*
* Ray Essick 23-nov-1981
*/
chkpath (p)
char *p;
{
int count;
if (*p == '.')
return (-1); /* hidden is bad */
count = 0;
while (*p && (*p != '/') && (*p != ' ') && (*p != ':'))
{
count++;
p++;
}
if (count > NNLEN)
return (-1); /* name too long */
if (*p == 0)
return 0;
else
return (-1);
}
/*
* patcheck - look for a pattern character. These are the shell
* meta-characters ?, [, and *
* Return 0 if non exist in the string
*/
patcheck (p)
char *p;
{
register char *q;
q = p;
while (*q && (*q != '?') && (*q != '[') && (*q != '*'))
q++;
return (*q != '\0'); /* return 0 if no pattern */
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.