* Deactivate some color code from Pico (as standalone editor) until
[alpine.git] / pico / blddate.c
blob00f0b558524e9cd0c8144eb3e5cc465a43d9881d
1 #include <system.h>
2 #include <general.h>
4 /*
5 * ========================================================================
6 * Copyright 2006 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 main(argc, argv)
18 int argc;
19 char **argv;
21 struct tm *t;
22 FILE *outfile=stdout;
23 time_t ltime;
25 if(argc > 1 && (outfile = fopen(argv[1], "w")) == NULL){
26 /* TRANSLATORS: an error message when trying to create a file */
27 fprintf(stderr, _("can't create '%s'\n"), argv[1]);
28 exit(1);
31 time(&ltime);
32 t = localtime(&ltime);
33 fprintf(outfile,"char datestamp[]=\"%02d-%s-%d\";\n", t->tm_mday,
34 (t->tm_mon == 0) ? "Jan" :
35 (t->tm_mon == 1) ? "Feb" :
36 (t->tm_mon == 2) ? "Mar" :
37 (t->tm_mon == 3) ? "Apr" :
38 (t->tm_mon == 4) ? "May" :
39 (t->tm_mon == 5) ? "Jun" :
40 (t->tm_mon == 6) ? "Jul" :
41 (t->tm_mon == 7) ? "Aug" :
42 (t->tm_mon == 8) ? "Sep" :
43 (t->tm_mon == 9) ? "Oct" :
44 (t->tm_mon == 10) ? "Nov" :
45 (t->tm_mon == 11) ? "Dec" : "UKN",
46 1900 + t->tm_year);
48 fprintf(outfile, "char hoststamp[]=\"random-pc\";\n");
50 fclose(outfile);
52 exit(0);