File: utime.c

package info (click to toggle)
cvs 1.10.7-1.99.slink.y2k.1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 8,892 kB
  • ctags: 5,463
  • sloc: ansic: 68,307; sh: 17,664; makefile: 1,640; perl: 902; yacc: 826; csh: 181; lisp: 7
file content (42 lines) | stat: -rw-r--r-- 1,152 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* This is REALLY gross, but at least it is a full implementation */ 

#include <ctype.h>
#include <time.h>
#include "vmsmunch.h"

#define ASCTIMEMAX 23

struct utimbuf {
  long actime;
  long modtime;
 }; 

utime(file, buf)
char *file;
struct utimbuf *buf; 
{
  static struct VMStimbuf vtb;
  static char conversion_buf[80];
  static char vms_actime[80];
  static char vms_modtime[80];

  strcpy(conversion_buf, ctime(&buf->actime));
  conversion_buf[ASCTIMEMAX + 1] = '\0';
  sprintf(vms_actime, "%2.2s-%3.3s-%4.4s %8.5s.00",
      &(conversion_buf[8]), &(conversion_buf[4]),
      &(conversion_buf[20]), &(conversion_buf[11]));
  vms_actime[4] = _toupper(vms_actime[4]);
  vms_actime[5] = _toupper(vms_actime[5]);

  strcpy(conversion_buf, ctime(&buf->modtime));
  conversion_buf[ASCTIMEMAX + 1] = '\0';
  sprintf(vms_modtime, "%2.2s-%3.3s-%4.4s %8.5s.00",
      &(conversion_buf[8]), &(conversion_buf[4]),
      &(conversion_buf[20]), &(conversion_buf[11]));
  vms_modtime[4] = _toupper(vms_modtime[4]);
  vms_modtime[4] = _toupper(vms_modtime[5]);

  vtb.actime = vms_actime;    
  vtb.modtime = vms_modtime;
  VMSmunch(file, SET_TIMES, &vtb); 
}