Commit | Line | Data |
---|---|---|
2a24676e DF |
1 | /* |
2 | * Copyright (c) 1983 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | */ | |
6863f426 | 6 | |
2a24676e DF |
7 | #ifndef lint |
8 | static char sccsid[] = "@(#)mkdate.c 5.1 (Berkeley) %G%"; | |
9 | #endif not lint | |
0022c355 ML |
10 | |
11 | static char rcsid[] = "$Header: mkdate.c,v 1.5 84/12/26 10:40:30 linton Exp $"; | |
6863f426 ML |
12 | |
13 | #include <stdio.h> | |
f00149ba | 14 | #include <sys/time.h> |
6863f426 ML |
15 | |
16 | main() | |
17 | { | |
18 | struct tm *t; | |
19 | long clock; | |
20 | char name[100]; | |
21 | int namelen; | |
22 | ||
23 | printf("char *date = \""); | |
24 | clock = time(0); | |
25 | t = localtime(&clock); | |
26 | printf("%d/%d/%d ", t->tm_mon + 1, t->tm_mday, t->tm_year % 100); | |
27 | printf("%d:%02d", t->tm_hour, t->tm_min); | |
28 | gethostname(name, &namelen); | |
29 | printf(" (%s)", name); | |
30 | printf("\";\n"); | |
2fd0f574 SL |
31 | DoVersionNumber(); |
32 | } | |
33 | ||
34 | DoVersionNumber() | |
35 | { | |
36 | FILE *f; | |
37 | int n; | |
38 | ||
39 | f = fopen("version", "r"); | |
40 | if (f == NULL) { | |
41 | n = 1; | |
42 | } else { | |
43 | fscanf(f, "%d", &n); | |
44 | n = n + 1; | |
45 | fclose(f); | |
46 | } | |
47 | f = fopen("version", "w"); | |
48 | if (f != NULL) { | |
49 | fprintf(f, "%d\n", n); | |
50 | fclose(f); | |
51 | } | |
52 | printf("int versionNumber = %d;\n", n); | |
6863f426 | 53 | } |