summaryrefslogtreecommitdiffstats
path: root/share/examples
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-09-30 11:25:55 +0000
committerkib <kib@FreeBSD.org>2008-09-30 11:25:55 +0000
commitc725244bd26d726d10a15a7a2c8068a2bc7b1802 (patch)
tree2ee14e40d451eca121787c14c7fae8c22ef515ce /share/examples
parent65c9dc411fe01a6481680e7a7d95568064bb056f (diff)
downloadFreeBSD-src-c725244bd26d726d10a15a7a2c8068a2bc7b1802.zip
FreeBSD-src-c725244bd26d726d10a15a7a2c8068a2bc7b1802.tar.gz
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.
Diffstat (limited to 'share/examples')
-rw-r--r--share/examples/FreeBSD_version/FreeBSD_version.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/share/examples/FreeBSD_version/FreeBSD_version.c b/share/examples/FreeBSD_version/FreeBSD_version.c
index 1d75897..036a5ae 100644
--- a/share/examples/FreeBSD_version/FreeBSD_version.c
+++ b/share/examples/FreeBSD_version/FreeBSD_version.c
@@ -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);
}
OpenPOWER on IntegriCloud