Add unistd.h to the getosreldate(3) manpage.

Update referenced example to include unistd.h per manpage.
Update example to be more style(9)-ish, silence warnings and add
FreeBSD id to the source file.
This commit is contained in:
Konstantin Belousov 2008-09-30 11:25:55 +00:00
parent 6d71d3189c
commit e45b2259ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183495
2 changed files with 11 additions and 6 deletions

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd December 2, 2005
.Dd September 30, 2008
.Dt GETOSRELDATE 3
.Os
.Sh NAME
@ -34,6 +34,7 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In unistd.h
.Ft int
.Fn getosreldate void
.Sh DESCRIPTION

View File

@ -1,3 +1,4 @@
/* $FreeBSD$ */
#if __FreeBSD__ == 0 /* 1.0 did not define __FreeBSD__ */
#define __FreeBSD_version 199401
#elif __FreeBSD__ == 1 /* 1.1 defined it to be 1 */
@ -5,13 +6,16 @@
#else /* 2.0 and higher define it to be 2 */
#include <osreldate.h> /* and this works */
#endif
#include <stdio.h>
#include <unistd.h>
int main(void) {
extern int getosreldate(void);
printf("Compilation release date: %d\n", __FreeBSD_version);
int
main(void) {
printf("Compilation release date: %d\n", __FreeBSD_version);
#if __FreeBSD_version >= 199408
printf("Execution environment release date: %d\n", getosreldate());
printf("Execution environment release date: %d\n", getosreldate());
#else
printf("Execution environment release date: can't tell\n");
printf("Execution environment release date: can't tell\n");
#endif
return (0);
}