Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/stdio/gets.c
Show All 39 Lines | |||||
#include "namespace.h" | #include "namespace.h" | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include "un-namespace.h" | #include "un-namespace.h" | ||||
#include "libc_private.h" | #include "libc_private.h" | ||||
#include "local.h" | #include "local.h" | ||||
__warn_references(gets, "warning: this program uses gets(), which is unsafe."); | |||||
char * | char * | ||||
jhb: Can this be marked static? AFAIK there's no prototype for __gets_unsafe(). | |||||
gets(char *buf) | __gets_unsafe(char *buf) | ||||
{ | { | ||||
int c; | int c; | ||||
char *s, *ret; | char *s, *ret; | ||||
static int warned; | static int warned; | ||||
static const char w[] = | static const char w[] = | ||||
"warning: this program uses gets(), which is unsafe.\n"; | "warning: this program uses gets(), which is unsafe.\n"; | ||||
FLOCKFILE_CANCELSAFE(stdin); | FLOCKFILE_CANCELSAFE(stdin); | ||||
Show All 13 Lines | if (c == EOF) { | ||||
*s++ = c; | *s++ = c; | ||||
} | } | ||||
*s = 0; | *s = 0; | ||||
ret = buf; | ret = buf; | ||||
end: | end: | ||||
FUNLOCKFILE_CANCELSAFE(); | FUNLOCKFILE_CANCELSAFE(); | ||||
return (ret); | return (ret); | ||||
} | } | ||||
__sym_compat(gets, __gets_unsafe, FBSD_1.0); |
Can this be marked static? AFAIK there's no prototype for __gets_unsafe().