blob: 4f5ba89d9faf9533769ea8b07c8623abd5284c43 (
plain) (
blame)
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
|
#include "gbos.h"
/* touch FILE...: create FILE if it does not exist, leave it alone if it does.
*
* There are no timestamps in gbfs (no RTC on an MBC5 cart), so touch only does
* the half that means anything here: make an empty file. O_APPEND is exactly
* right for it - it creates, and it does NOT truncate what is already there. */
void main(void) {
char *argv[8];
unsigned char argc = argv_parse(argv, 8);
unsigned char i, fd;
if (argc < 1) {
puts("usage: touch FILE...");
nl();
sexit(2);
}
for (i = 0; i < argc; i++) {
fd = open(argv[i], O_APPEND);
if (fd > 3) {
puts("touch: cannot create ");
puts(argv[i]);
nl();
continue;
}
close(fd);
}
}
|