A small cleanup by Vladimir
[oweals/busybox.git] / touch.c
diff --git a/touch.c b/touch.c
index 7db6c6e3383ab2156d6c1569174a44b5cc28d3e3..a3256d55970dc4fc746a2b1d29e22ac0d3ba620e 100644 (file)
--- a/touch.c
+++ b/touch.c
@@ -3,7 +3,7 @@
  * Mini touch implementation for busybox
  *
  *
- * Copyright (C) 1999,2000 by Lineo, inc.
+ * Copyright (C) 1999,2000,2001 by Lineo, inc.
  * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -28,6 +28,8 @@
 #include <fcntl.h>
 #include <utime.h>
 #include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
 
 extern int touch_main(int argc, char **argv)
 {
@@ -42,14 +44,13 @@ extern int touch_main(int argc, char **argv)
                                create = FALSE;
                                break;
                        default:
-                               usage(touch_usage);
-                               exit(FALSE);
+                               show_usage();
                        }
                }
        }
 
        if (argc < 1) {
-               usage(touch_usage);
+               show_usage();
        }
 
        while (argc > 0) {
@@ -57,18 +58,18 @@ extern int touch_main(int argc, char **argv)
                                S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
                if (fd < 0) {
                        if (create == FALSE && errno == ENOENT)
-                               exit(TRUE);
+                               return EXIT_SUCCESS;
                        else {
-                               fatalError("%s", strerror(errno));
+                               perror_msg_and_die("%s", *argv);
                        }
                }
                close(fd);
                if (utime(*argv, NULL)) {
-                       fatalError("%s", strerror(errno));
+                       perror_msg_and_die("%s", *argv);
                }
                argc--;
                argv++;
        }
 
-       return(TRUE);
+       return EXIT_SUCCESS;
 }