xref: /csrg-svn/old/dbx/mkdate.c (revision 21612)
1*21612Sdist /*
2*21612Sdist  * Copyright (c) 1983 Regents of the University of California.
3*21612Sdist  * All rights reserved.  The Berkeley software License Agreement
4*21612Sdist  * specifies the terms and conditions for redistribution.
5*21612Sdist  */
611802Slinton 
7*21612Sdist #ifndef lint
8*21612Sdist static char sccsid[] = "@(#)mkdate.c	5.1 (Berkeley) 05/31/85";
9*21612Sdist #endif not lint
1011802Slinton 
1118225Slinton static char rcsid[] = "$Header: mkdate.c,v 1.5 84/12/26 10:40:30 linton Exp $";
1218225Slinton 
1311802Slinton #include <stdio.h>
1413737Ssam #include <sys/time.h>
1511802Slinton 
1611802Slinton main()
1711802Slinton {
1811802Slinton     struct tm *t;
1911802Slinton     long clock;
2011802Slinton     char name[100];
2111802Slinton     int namelen;
2211802Slinton 
2311802Slinton     printf("char *date = \"");
2411802Slinton     clock = time(0);
2511802Slinton     t = localtime(&clock);
2611802Slinton     printf("%d/%d/%d ", t->tm_mon + 1, t->tm_mday, t->tm_year % 100);
2711802Slinton     printf("%d:%02d", t->tm_hour, t->tm_min);
2811802Slinton     gethostname(name, &namelen);
2911802Slinton     printf(" (%s)", name);
3011802Slinton     printf("\";\n");
3116613Ssam     DoVersionNumber();
3211802Slinton }
3316613Ssam 
3416613Ssam DoVersionNumber()
3516613Ssam {
3616613Ssam     FILE *f;
3716613Ssam     int n;
3816613Ssam 
3916613Ssam     f = fopen("version", "r");
4016613Ssam     if (f == NULL) {
4116613Ssam 	n = 1;
4216613Ssam     } else {
4316613Ssam 	fscanf(f, "%d", &n);
4416613Ssam 	n = n + 1;
4516613Ssam 	fclose(f);
4616613Ssam     }
4716613Ssam     f = fopen("version", "w");
4816613Ssam     if (f != NULL) {
4916613Ssam 	fprintf(f, "%d\n", n);
5016613Ssam 	fclose(f);
5116613Ssam     }
5216613Ssam     printf("int versionNumber = %d;\n", n);
5316613Ssam }
54