|
|
1.1 ! root 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: */ ! 6: ! 7: #ifndef lint ! 8: static char sccsid[] = "@(#)mkdate.c 5.1 (Berkeley) 5/31/85"; ! 9: #endif not lint ! 10: ! 11: static char rcsid[] = "$Header: mkdate.c,v 1.5 84/12/26 10:40:30 linton Exp $"; ! 12: ! 13: #include <stdio.h> ! 14: #include <sys/time.h> ! 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"); ! 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); ! 53: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.