diff options
author | Erik Andersen | 2000-02-08 19:58:47 +0000 |
---|---|---|
committer | Erik Andersen | 2000-02-08 19:58:47 +0000 |
commit | e49d5ecbbe51718fa925b6890a735e5937cc2aa2 (patch) | |
tree | c90bda10731ad9333ce3b404f993354c9fc104b8 /coreutils/touch.c | |
parent | c0bf817bbc5c7867fbe8fb76d5c39f8ee802692f (diff) | |
download | busybox-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.zip busybox-e49d5ecbbe51718fa925b6890a735e5937cc2aa2.tar.gz |
Some formatting updates (ran the code through indent)
-Erik
Diffstat (limited to 'coreutils/touch.c')
-rw-r--r-- | coreutils/touch.c | 79 |
1 files changed, 37 insertions, 42 deletions
diff --git a/coreutils/touch.c b/coreutils/touch.c index d2d3e94..a0f21ac 100644 --- a/coreutils/touch.c +++ b/coreutils/touch.c @@ -1,3 +1,4 @@ +/* vi: set sw=4 ts=4: */ /* * Mini touch implementation for busybox * @@ -31,56 +32,50 @@ static const char touch_usage[] = "touch [-c] file [file ...]\n\n" -"Update the last-modified date on the given file[s].\n"; + "Update the last-modified date on the given file[s].\n"; -extern int -touch_main(int argc, char **argv) -{ - int fd; - int create=TRUE; - if (argc < 2) { - usage( touch_usage); - } - argc--; - argv++; +extern int touch_main(int argc, char **argv) +{ + int fd; + int create = TRUE; - /* Parse options */ - while (**argv == '-') { - while (*++(*argv)) switch (**argv) { - case 'c': - create = FALSE; - break; - default: - usage( touch_usage); - exit( FALSE); + if (argc < 2) { + usage(touch_usage); } argc--; argv++; - } - fd = open (*argv, (create==FALSE)? O_RDWR : O_RDWR | O_CREAT, 0644); - if (fd < 0 ) { - if (create==FALSE && errno == ENOENT) - exit( TRUE); - else { - perror("touch"); - exit( FALSE); + /* Parse options */ + while (**argv == '-') { + while (*++(*argv)) + switch (**argv) { + case 'c': + create = FALSE; + break; + default: + usage(touch_usage); + exit(FALSE); + } + argc--; + argv++; } - } - close( fd); - if (utime (*argv, NULL)) { - perror("touch"); - exit( FALSE); - } - else - exit( TRUE); -} - - - - - + fd = open(*argv, (create == FALSE) ? O_RDWR : O_RDWR | O_CREAT, 0644); + if (fd < 0) { + if (create == FALSE && errno == ENOENT) + exit(TRUE); + else { + perror("touch"); + exit(FALSE); + } + } + close(fd); + if (utime(*argv, NULL)) { + perror("touch"); + exit(FALSE); + } else + exit(TRUE); +} |