From cc8ed39b240180b58810784f844e253263594ac3 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 5 Oct 1999 16:24:54 +0000 Subject: Initial revision --- touch.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 touch.c (limited to 'touch.c') diff --git a/touch.c b/touch.c new file mode 100644 index 000000000..ca4b98108 --- /dev/null +++ b/touch.c @@ -0,0 +1,20 @@ +#include "internal.h" +#include +#include +#include + +const char touch_usage[] = "touch [-c] file [file ...]\n" +"\n" +"\tUpdate the last-modified date on the given file[s].\n"; + +extern int +touch_fn(const struct FileInfo * i) +{ + if ( (utime(i->source, 0) != 0) && (i->create != 1) ) { + if ( fopen(i->source, "w") == NULL ) { + name_and_error(i->source); + return 1; + } + } + return 0; +} -- cgit v1.2.3