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:
parent
6d71d3189c
commit
e45b2259ec
@ -24,7 +24,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd December 2, 2005
|
.Dd September 30, 2008
|
||||||
.Dt GETOSRELDATE 3
|
.Dt GETOSRELDATE 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -34,6 +34,7 @@
|
|||||||
.Sh LIBRARY
|
.Sh LIBRARY
|
||||||
.Lb libc
|
.Lb libc
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
|
.In unistd.h
|
||||||
.Ft int
|
.Ft int
|
||||||
.Fn getosreldate void
|
.Fn getosreldate void
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* $FreeBSD$ */
|
||||||
#if __FreeBSD__ == 0 /* 1.0 did not define __FreeBSD__ */
|
#if __FreeBSD__ == 0 /* 1.0 did not define __FreeBSD__ */
|
||||||
#define __FreeBSD_version 199401
|
#define __FreeBSD_version 199401
|
||||||
#elif __FreeBSD__ == 1 /* 1.1 defined it to be 1 */
|
#elif __FreeBSD__ == 1 /* 1.1 defined it to be 1 */
|
||||||
@ -5,13 +6,16 @@
|
|||||||
#else /* 2.0 and higher define it to be 2 */
|
#else /* 2.0 and higher define it to be 2 */
|
||||||
#include <osreldate.h> /* and this works */
|
#include <osreldate.h> /* and this works */
|
||||||
#endif
|
#endif
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
int main(void) {
|
int
|
||||||
extern int getosreldate(void);
|
main(void) {
|
||||||
printf("Compilation release date: %d\n", __FreeBSD_version);
|
printf("Compilation release date: %d\n", __FreeBSD_version);
|
||||||
#if __FreeBSD_version >= 199408
|
#if __FreeBSD_version >= 199408
|
||||||
printf("Execution environment release date: %d\n", getosreldate());
|
printf("Execution environment release date: %d\n", getosreldate());
|
||||||
#else
|
#else
|
||||||
printf("Execution environment release date: can't tell\n");
|
printf("Execution environment release date: can't tell\n");
|
||||||
#endif
|
#endif
|
||||||
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user