From e49d5ecbbe51718fa925b6890a735e5937cc2aa2 Mon Sep 17 00:00:00 2001 From: Erik Andersen Date: Tue, 8 Feb 2000 19:58:47 +0000 Subject: Some formatting updates (ran the code through indent) -Erik --- coreutils/touch.c | 79 ++++++++++++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 42 deletions(-) (limited to 'coreutils/touch.c') diff --git a/coreutils/touch.c b/coreutils/touch.c index d2d3e9484..a0f21acdd 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); +} -- cgit v1.2.3