aboutsummaryrefslogtreecommitdiff
path: root/coreutils/touch.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>1999-10-05 16:24:54 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>1999-10-05 16:24:54 +0000
commit1f3e8dc36947bdcc2d008fba3cdc29e2c79f9c27 (patch)
tree15feebbb4be9a9168209609f48f0b100f9364420 /coreutils/touch.c
downloadbusybox-w32-1f3e8dc36947bdcc2d008fba3cdc29e2c79f9c27.tar.gz
busybox-w32-1f3e8dc36947bdcc2d008fba3cdc29e2c79f9c27.tar.bz2
busybox-w32-1f3e8dc36947bdcc2d008fba3cdc29e2c79f9c27.zip
Initial revision
git-svn-id: svn://busybox.net/trunk/busybox@5 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'coreutils/touch.c')
-rw-r--r--coreutils/touch.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c
new file mode 100644
index 000000000..ca4b98108
--- /dev/null
+++ b/coreutils/touch.c
@@ -0,0 +1,20 @@
1#include "internal.h"
2#include <sys/types.h>
3#include <stdio.h>
4#include <utime.h>
5
6const char touch_usage[] = "touch [-c] file [file ...]\n"
7"\n"
8"\tUpdate the last-modified date on the given file[s].\n";
9
10extern int
11touch_fn(const struct FileInfo * i)
12{
13 if ( (utime(i->source, 0) != 0) && (i->create != 1) ) {
14 if ( fopen(i->source, "w") == NULL ) {
15 name_and_error(i->source);
16 return 1;
17 }
18 }
19 return 0;
20}