2018-08-15 04:07:33 +03:00
|
|
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
|
|
* This file is part of ToaruOS and is released under the terms
|
2018-05-04 07:01:55 +03:00
|
|
|
* of the NCSA / University of Illinois License - see LICENSE.md
|
|
|
|
* Copyright (C) 2013 K. Lange
|
2018-07-18 09:35:52 +03:00
|
|
|
*
|
2018-08-15 04:07:33 +03:00
|
|
|
* touch - Create or update file timestamps
|
2018-05-04 07:01:55 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2018-07-18 09:35:52 +03:00
|
|
|
#include <errno.h>
|
2018-05-04 07:01:55 +03:00
|
|
|
|
|
|
|
int main(int argc, char * argv[]) {
|
|
|
|
if (argc < 2) {
|
|
|
|
fprintf(stderr, "%s: argument expected\n", argv[0]);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2018-07-18 09:35:52 +03:00
|
|
|
int out = 0;
|
|
|
|
for (int i = 1; i < argc; ++i) {
|
|
|
|
FILE * f = fopen(argv[i], "a");
|
|
|
|
if (!f) {
|
|
|
|
fprintf(stderr, "%s: %s: %s\n", argv[0], argv[i], strerror(errno));
|
|
|
|
out = 1;
|
|
|
|
}
|
|
|
|
fclose(f);
|
2018-05-04 07:01:55 +03:00
|
|
|
}
|
|
|
|
|
2018-07-18 09:35:52 +03:00
|
|
|
return out;
|
2018-05-04 07:01:55 +03:00
|
|
|
}
|