Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/netbsd-tests/lib/libc/ssp/h_gets.c
Show All 27 Lines | |||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__COPYRIGHT("@(#) Copyright (c) 2008\ | __COPYRIGHT("@(#) Copyright (c) 2008\ | ||||
The NetBSD Foundation, inc. All rights reserved."); | The NetBSD Foundation, inc. All rights reserved."); | ||||
__RCSID("$NetBSD: h_gets.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $"); | __RCSID("$NetBSD: h_gets.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $"); | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#ifdef __FreeBSD__ | |||||
/* | |||||
* We want to test the gets() implementation, but cannot simply link against | |||||
* the gets symbol because it is not in the default version. (We've made it | |||||
* unavailable by default on FreeBSD because it should not be used.) | |||||
* | |||||
* The next two lines create an unsafe_gets() function that resolves to | |||||
* gets@FBSD_1.0, which we call from our local gets() implementation. | |||||
*/ | |||||
__sym_compat(gets, unsafe_gets, FBSD_1.0); | |||||
char *unsafe_gets(char *); | |||||
char *gets(char *buf) | |||||
{ | |||||
return unsafe_gets(buf); | |||||
} | |||||
#endif | |||||
int | int | ||||
main(int argc, char *argv[]) | main(int argc, char *argv[]) | ||||
{ | { | ||||
char b[10]; | char b[10]; | ||||
(void)gets(b); | (void)gets(b); | ||||
(void)printf("%s\n", b); | (void)printf("%s\n", b); | ||||
return 0; | return 0; | ||||
} | } |