summaryrefslogtreecommitdiff
path: root/coreutils/touch.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-04-09 21:35:07 +0000
committerDenis Vlasenko2007-04-09 21:35:07 +0000
commit3f3aa2a57dc648ade9083f3b3ad83cce8206b912 (patch)
treed5c648f583bb2edef25f05c2bed303df3d1a61f6 /coreutils/touch.c
parentcd7001f7055c3fc2d6298ab9e3befe91e951c652 (diff)
downloadbusybox-3f3aa2a57dc648ade9083f3b3ad83cce8206b912.zip
busybox-3f3aa2a57dc648ade9083f3b3ad83cce8206b912.tar.gz
make xfunctions optionally longjump instead of exit.
use it for making NOFORK more practical. touch: make it a NOFORK applet
Diffstat (limited to 'coreutils/touch.c')
-rw-r--r--coreutils/touch.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c
index ae4e689..5f81b23 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -17,21 +17,16 @@
* Also, exiting on a failure was a bug. All args should be processed.
*/
-#include <stdio.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <utime.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
#include "busybox.h"
+/* This is a NOFORK applet. Be very careful! */
+
int touch_main(int argc, char **argv);
int touch_main(int argc, char **argv)
{
int fd;
int status = EXIT_SUCCESS;
- bool flags = (getopt32(argc, argv, "c") & 1);
+ int flags = getopt32(argc, argv, "c");
argv += optind;
@@ -41,7 +36,7 @@ int touch_main(int argc, char **argv)
do {
if (utime(*argv, NULL)) {
- if (errno == ENOENT) { /* no such file*/
+ if (errno == ENOENT) { /* no such file */
if (flags) { /* Creation is disabled, so ignore. */
continue;
}