X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=fdflush.c;h=28f5cb68a02244da47ab04a0073e9d6aff2c317b;hb=063c1f54eae3e1dcb8dd5c00ba9bf802357d3cb9;hp=d9937355f78f1ac1acfffacc75f5d368d3188486;hpb=bd22ed806782eec76929bcd2ec556717e79d24c7;p=oweals%2Fbusybox.git diff --git a/fdflush.c b/fdflush.c index d9937355f..28f5cb68a 100644 --- a/fdflush.c +++ b/fdflush.c @@ -21,41 +21,27 @@ * */ -#include "internal.h" #include #include #include +#include +#include "busybox.h" /* From */ #define FDFLUSH _IO(2,0x4b) extern int fdflush_main(int argc, char **argv) { - int value; int fd; - if (argc <= 1 || **(++argv) == '-') { - usage("fdflush DEVICE\n" -#ifndef BB_FEATURE_TRIVIAL_HELP - "\nForces floppy disk drive to detect disk change\n" -#endif - ); - } + if (argc <= 1 || **(++argv) == '-') + show_usage(); - fd = open(*argv, 0); - if (fd < 0) { - perror(*argv); - exit(FALSE); - } + if ((fd = open(*argv, 0)) < 0) + perror_msg_and_die("%s", *argv); - value = ioctl(fd, FDFLUSH, 0); - /* Don't bother closing. Exit does - * that, so we can save a few bytes */ - /* close(fd); */ + if (ioctl(fd, FDFLUSH, 0)) + perror_msg_and_die("%s", *argv); - if (value) { - perror(*argv); - exit(FALSE); - } - return(TRUE); + return EXIT_SUCCESS; }