X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=util-linux%2Ffdflush.c;h=56ea2244d7444189fb2b13c16325c608268a695e;hb=f93a95de6960b1d1977a934aafd3e9a8b8ea1765;hp=ce6870cd1128178698d77513de9996b772972638;hpb=f6be944a6ae612c70ce010582d9c3cdd72f7144f;p=oweals%2Fbusybox.git diff --git a/util-linux/fdflush.c b/util-linux/fdflush.c index ce6870cd1..56ea2244d 100644 --- a/util-linux/fdflush.c +++ b/util-linux/fdflush.c @@ -1,8 +1,9 @@ - +/* vi: set sw=4 ts=4: */ /* * Mini fdflush implementation for busybox * - * Copyright (C) 1998 by Erik Andersen + * + * Copyright (C) 1995, 1996 by Bruce Perens . * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,25 +30,27 @@ extern int fdflush_main(int argc, char **argv) { - int value; - int fd; - if ( **(argv+1) == '-' ) { - fprintf(stderr, "Usage: fdflush device\n"); - exit(FALSE); - } + int value; + int fd; + + if (argc <= 1 || **(++argv) == '-') { + usage("fdflush device\n\nForce floppy disk drive to detect disk change\n"); + } - fd = open(*argv, 0); - if ( fd < 0 ) { - perror(*argv); - exit(FALSE); - } + fd = open(*argv, 0); + if (fd < 0) { + perror(*argv); + exit(FALSE); + } - value = ioctl(fd, FDFLUSH, 0); - close(fd); + value = ioctl(fd, FDFLUSH, 0); + /* Don't bother closing. Exit does + * that, so we can save a few bytes */ + /* close(fd); */ - if ( value ) { - perror(*argv); - exit(FALSE); - } - exit (TRUE); + if (value) { + perror(*argv); + exit(FALSE); + } + exit(TRUE); }