home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
program
/
lynxlib
/
nstring.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-23
|
2KB
|
68 lines
/* This source file is part of the LynxLib miscellaneous library by
Robert Fischer, and is Copyright 1990 by Robert Fischer. It costs no
money, and you may not make money off of it, but you may redistribute
it. It comes with ABSOLUTELY NO WARRANTY. See the file LYNXLIB.DOC
for more details.
To contact the author:
Robert Fischer \\80 Killdeer Rd \\Hamden, CT 06517 USA
(203) 288-9599 fischer-robert@cs.yale.edu */
#include <ctype.h>
#include <stddef.h>
/* ---------------------------------------------------------------- */
char *pstrupper(s) /* Converts string to upper case */
register char *s;
{
for (; *s != NIL; s++) {
if (islower(*s)) *s += 'A' - 'a';
}
return s;
}
/* ---------------------------------------------------------------- */
char *strlower(s) /* Converts string to lower case */
register char *s;
{
for (; *s != NIL; s++) {
if (isupper(*s)) *s = _tolower(*s);
}
return s;
}
/* ---------------------------------------------------------------- */
char *pstrcpy(dest, source)
/* Does a strcpy, but returns the address of the NIL in dest */
register char *dest;
register char *source;
{
while (*source != NIL) *dest++ = *source++;
*dest = NIL;
return dest;
}
/* ---------------------------------------------------------------- */
char *pstrcat(dest, source)
/* Does a strcat, but returns address of the NIL in dest */
register char *dest;
register char *source;
{
while (*dest != NIL) dest++;
while (*source != NIL) *dest++ = *source++;
*dest = NIL;
return dest;
}
/* ---------------------------------------------------------------- */
char *strdup(string)
register char *string;
{
register char *p;
if(p = malloc(strlen(string) + 1))
strcpy(p, string);
return(p);
}
/* ---------------------------------------------------------------- */
char *pstrlen(s)
char *s;
{
return s + strlen(s);
}
/* ---------------------------------------------------------------- */