Skip to content
This repository was archived by the owner on Sep 13, 2019. It is now read-only.

Commit c271cb8

Browse files
committed
windows: check timestamp on startup before reconverting
1 parent 3defca0 commit c271cb8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

racket/src/worksp/cstartup.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
#include <stdio.h>
2+
#include <sys/types.h>
3+
#include <sys/stat.h>
24

35
/* 65535 characters should be enough for any string --- or so says
46
MSVC. Convert "startup.inc" to a character array. */
57

68
int main(int argc, char **argv) {
9+
struct _stat s1, s2;
710
FILE *in, *out;
811
int c, col = 0;
912

13+
if (_stat(argv[1], &s1) == 0) {
14+
if (_stat(argv[2], &s2) == 0) {
15+
if (s2.st_mtime > s1.st_mtime) {
16+
printf("Generated file is already newer than source\n");
17+
return 0;
18+
}
19+
}
20+
}
21+
1022
in = fopen(argv[1], "r");
1123
out = fopen(argv[2], "w");
1224

0 commit comments

Comments
 (0)