1 |
– |
/* Copyright (c) 1994 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Routines for recognizing and moving about words in strings. |
6 |
|
*/ |
7 |
|
|
8 |
+ |
#include <string.h> |
9 |
|
#include <ctype.h> |
10 |
|
|
13 |
– |
#ifdef BSD |
14 |
– |
#define strchr index |
15 |
– |
#endif |
11 |
|
|
17 |
– |
#define NULL 0 |
18 |
– |
|
19 |
– |
extern char *strchr(); |
20 |
– |
|
21 |
– |
|
12 |
|
char * |
13 |
|
iskip(s) /* skip integer in string */ |
14 |
|
register char *s; |
93 |
|
|
94 |
|
cp = fskip(s); |
95 |
|
return(cp != NULL && strchr(ds, *cp) != NULL); |
96 |
+ |
} |
97 |
+ |
|
98 |
+ |
|
99 |
+ |
int |
100 |
+ |
isname(s) /* check for legal identifier name */ |
101 |
+ |
register char *s; |
102 |
+ |
{ |
103 |
+ |
while (*s == '_') /* skip leading underscores */ |
104 |
+ |
s++; |
105 |
+ |
if (!isascii(*s) || !isalpha(*s)) /* start with a letter */ |
106 |
+ |
return(0); |
107 |
+ |
while (isascii(*++s) && isgraph(*s)) /* all visible characters */ |
108 |
+ |
; |
109 |
+ |
return(*s == '\0'); /* ending in nul */ |
110 |
|
} |