home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
diskutil
/
fdf
/
elib
/
input.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-05
|
651b
|
39 lines
#include <ctype.h>
#include <stdio.h>
/*
* skip_whitespace
*
* given a string pointer, skip the whitespace and return the pointer to
* the new spot.
*/
char *skip_whitespace(char *str)
{
while (isspace(*str))
str++;
return str;
}
/*
* zap_trailing_nl
*
* on strings which have been read in using fgets(), take out the trailing
* newline. If no newline, read the input stream until one is encountered.
*/
void zap_trailing_nl(char *str, int max_ch, FILE *stream)
{
int i = strlen(str), ch;
if ((i > 0) && (str[i-1] == '\n'))
str[i-1] = '\0';
else if (i >= max_ch)
while (((ch = getc(stream)) != EOF) && (ch != '\n'));
}