1*50bf276cStholo /* This is REALLY gross, but at least it is a full implementation */
2*50bf276cStholo
3*50bf276cStholo #include <ctype.h>
4*50bf276cStholo #include <time.h>
5*50bf276cStholo #include "vmsmunch.h"
6*50bf276cStholo
7*50bf276cStholo #define ASCTIMEMAX 23
8*50bf276cStholo
9*50bf276cStholo struct utimbuf {
10*50bf276cStholo long actime;
11*50bf276cStholo long modtime;
12*50bf276cStholo };
13*50bf276cStholo
utime(file,buf)14*50bf276cStholo utime(file, buf)
15*50bf276cStholo char *file;
16*50bf276cStholo struct utimbuf *buf;
17*50bf276cStholo {
18*50bf276cStholo static struct VMStimbuf vtb;
19*50bf276cStholo static char conversion_buf[80];
20*50bf276cStholo static char vms_actime[80];
21*50bf276cStholo static char vms_modtime[80];
22*50bf276cStholo
23*50bf276cStholo strcpy(conversion_buf, ctime(&buf->actime));
24*50bf276cStholo conversion_buf[ASCTIMEMAX + 1] = '\0';
25*50bf276cStholo sprintf(vms_actime, "%2.2s-%3.3s-%4.4s %8.5s.00",
26*50bf276cStholo &(conversion_buf[8]), &(conversion_buf[4]),
27*50bf276cStholo &(conversion_buf[20]), &(conversion_buf[11]));
28*50bf276cStholo vms_actime[4] = _toupper(vms_actime[4]);
29*50bf276cStholo vms_actime[5] = _toupper(vms_actime[5]);
30*50bf276cStholo
31*50bf276cStholo strcpy(conversion_buf, ctime(&buf->modtime));
32*50bf276cStholo conversion_buf[ASCTIMEMAX + 1] = '\0';
33*50bf276cStholo sprintf(vms_modtime, "%2.2s-%3.3s-%4.4s %8.5s.00",
34*50bf276cStholo &(conversion_buf[8]), &(conversion_buf[4]),
35*50bf276cStholo &(conversion_buf[20]), &(conversion_buf[11]));
36*50bf276cStholo vms_modtime[4] = _toupper(vms_modtime[4]);
37*50bf276cStholo vms_modtime[4] = _toupper(vms_modtime[5]);
38*50bf276cStholo
39*50bf276cStholo vtb.actime = vms_actime;
40*50bf276cStholo vtb.modtime = vms_modtime;
41*50bf276cStholo VMSmunch(file, SET_TIMES, &vtb);
42*50bf276cStholo }
43