Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/stdio/fgets.c
Show All 40 Lines | |||||
#include "libc_private.h" | #include "libc_private.h" | ||||
/* | /* | ||||
* Read at most n-1 characters from the given file. | * Read at most n-1 characters from the given file. | ||||
* Stop when a newline has been read, or the count runs out. | * Stop when a newline has been read, or the count runs out. | ||||
* Return first argument, or NULL if no characters were read. | * Return first argument, or NULL if no characters were read. | ||||
*/ | */ | ||||
char * | char * | ||||
fgets(char * __restrict buf, int n, FILE * __restrict fp) | (fgets)(char * __restrict buf, int n, FILE * __restrict fp) | ||||
{ | { | ||||
size_t len; | size_t len; | ||||
char *s, *ret; | char *s, *ret; | ||||
unsigned char *p, *t; | unsigned char *p, *t; | ||||
FLOCKFILE_CANCELSAFE(fp); | FLOCKFILE_CANCELSAFE(fp); | ||||
ORIENT(fp, -1); | ORIENT(fp, -1); | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |