static char SccsId
[] = "@(#)util.c 3.8.1.1 %G%";
** STRIPQUOTES -- Strip quotes & quote bits from a string.
** Runs through a string and strips off unquoted quote
** characters and quote bits. This is done in place.
** s -- the string to strip.
** qf -- if set, remove actual `` " '' characters
** as well as the quote bits.
for (p
= q
= s
; (c
= *p
++) != '\0'; )
** CAPITALIZE -- return a copy of a string, properly capitalized.
** s -- the string to capitalize.
** a pointer to a properly capitalized string.
while (!isalpha(*s
) && *s
!= '\0')
** XALLOC -- Allocate memory and bitch wildly on failure.
** THIS IS A CLUDGE. This should be made to give a proper
** error -- but after all, what can we do?
** sz -- size of area to allocate.
** pointer to data region.
register unsigned int sz
;
syserr("Out of memory!!");
** NEWSTR -- make copy of string.
** Space is allocated for it using xalloc.
** pointer to new string.
p
= xalloc((unsigned) (strlen(s
) + 1));
** COPYPLIST -- copy list of pointers.
** This routine is the equivalent of newstr for lists of
** list -- list of pointers to copy.
** Must be NULL terminated.
** copycont -- if TRUE, copy the contents of the vector
** (which must be a string) also.
copyplist(list
, copycont
)
for (vp
= list
; *vp
!= NULL
; vp
++)
newvp
= (char **) xalloc((unsigned) (vp
- list
) * sizeof *vp
);
bmove((char *) list
, (char *) newvp
, (vp
- list
) * sizeof *vp
);
for (vp
= newvp
; *vp
!= NULL
; vp
++)
** PRINTAV -- print argument vector.
** av -- argument vector.
** LOWER -- turn letter into lower case.
** c -- character to turn into lower case.
if (isascii(c
) && isupper(c
))
** XPUTS -- put string doing control escapes.
while ((c
= *s
++) != '\0')
** MAKELOWER -- Translate a line into lower case
** p -- the string to translate. If NULL, return is
** String pointed to by p is translated to lower case.
for (; (c
= *p
) != '\0'; p
++)
if (isascii(c
) && isupper(c
))
** SAMEWORD -- return TRUE if the words are the same
** a, b -- the words to compare.
** TRUE if a & b match exactly (modulo case)
while (lower(*a
) == lower(*b
))
** CLEAR -- clear a block of memory
** p -- location to clear.
** l -- number of bytes to clear.
** BUILDFNAME -- build full name from gecos style entry.
** This routine interprets the strange entry that would appear
** in the GECOS field of the password file.
** login -- the login name of this user (for &).
** buf -- place to put the result.
buildfname(p
, login
, buf
)
while (*p
!= '\0' && *p
!= ',' && *p
!= ';')
(void) strcpy(bp
, login
);
** SYSLOG -- fake entry to fool lint