gets.c\stdio\src - musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src/stdio/gets.c
blob: 17963b93e39223a031dfbd661e34160e5fe81b58 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "stdio_impl.h"
#include <limits.h>
#include <string.h>
char *gets(char *s)
{
	size_t i=0;
	int c;
	FLOCK(stdin);
	while ((c=getc_unlocked(stdin)) != EOF && c != '\n') s[i++] = c;
	s[i] = 0;
	if (c != '\n' && (!feof(stdin) || !i)) s = 0;
	FUNLOCK(stdin);
	return s;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年09月05日 18:19:44 +0000

AltStyle によって変換されたページ (->オリジナル) /