home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Unix System Administration Handbook 1997 October
/
usah_oct97.iso
/
news
/
cnews.tar
/
libc
/
dogets.c
< prev
next >
Wrap
Text File
|
1992-04-18
|
364b
|
19 lines
/*
* dogets - do the gets hack on a counted string: given a string and length
* pointer, delete any trailing newline and adjust the length to match.
*/
char *
dogets(s, lenp)
register char *s;
register int *lenp;
{
register char *nlp = s + *lenp - 1;
if (*lenp > 0 && *nlp == '\n') {
*nlp = '\0'; /* stomp innocent newline */
--*lenp;
}
return s;
}