basename,dirname,freeramdisk,rx,raidautorun,runsv,chvt: skip "--" argument
[oweals/busybox.git] / miscutils / eject.c
index adff9e0e285b33ad5df44a5a84d95447df4b528d..184ccc5d7fc449dc57b0595a1e2f1bc6c66c94cc 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (C) 2004  Peter Willis <psyphreak@phreaker.net>
  * Copyright (C) 2005  Tito Ragusa <farmatito@tiscali.it>
  *
- * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 
 /*
  * Most of the dirty work blatantly ripped off from cat.c =)
  */
 
+//usage:#define eject_trivial_usage
+//usage:       "[-t] [-T] [DEVICE]"
+//usage:#define eject_full_usage "\n\n"
+//usage:       "Eject DEVICE or default /dev/cdrom\n"
+//usage:     "\nOptions:"
+//usage:       IF_FEATURE_EJECT_SCSI(
+//usage:     "\n       -s      SCSI device"
+//usage:       )
+//usage:     "\n       -t      Close tray"
+//usage:     "\n       -T      Open/close tray (toggle)"
+
 #include <sys/mount.h>
 #include "libbb.h"
 /* Must be after libbb.h: they need size_t */
+#include "fix_u32.h"
 #include <scsi/sg.h>
 #include <scsi/scsi.h>
 
@@ -75,7 +87,7 @@ static void eject_cdrom(unsigned flags, const char *dev)
        int cmd = CDROMEJECT;
 
        if (flags & FLAG_CLOSE
-        || (flags & FLAG_SMART && ioctl(dev_fd, CDROM_DRIVE_STATUS) == CDS_TRAY_OPEN)
+        || ((flags & FLAG_SMART) && ioctl(dev_fd, CDROM_DRIVE_STATUS) == CDS_TRAY_OPEN)
        ) {
                cmd = CDROMCLOSETRAY;
        }