svn commit: trunk/busybox: include miscutils

landley at busybox.net landley at busybox.net
Wed May 31 22:53:01 UTC 2006


Author: landley
Date: 2006-05-31 15:52:57 -0700 (Wed, 31 May 2006)
New Revision: 15254

Log:
Patch from Tito to remove long options from hdparm.


Modified:
   trunk/busybox/include/usage.h
   trunk/busybox/miscutils/Config.in
   trunk/busybox/miscutils/hdparm.c


Changeset:
Modified: trunk/busybox/include/usage.h
===================================================================
--- trunk/busybox/include/usage.h	2006-05-31 22:24:33 UTC (rev 15253)
+++ trunk/busybox/include/usage.h	2006-05-31 22:52:57 UTC (rev 15254)
@@ -994,7 +994,8 @@
 #define hdparm_trivial_usage \
 	"[options] [device] .."
 #define hdparm_full_usage \
-	"Options:" \
+	USE_FEATURE_HDPARM_GET_IDENTITY("\tIf no device name is specified read from stdin.\n") \
+	"\nOptions:\n" \
 	"\t-a   get/set fs readahead\n" \
 	"\t-A   set drive read-lookahead flag (0/1)\n" \
 	"\t-b   get/set bus state (0 == off, 1 == on, 2 == tristate)\n" \
@@ -1006,9 +1007,8 @@
 	"\t-f   flush buffer cache for device on exit\n" \
 	"\t-g   display drive geometry\n" \
 	"\t-h   display terse usage information\n" \
-	"\t-i   display drive identification\n" \
+	USE_FEATURE_HDPARM_GET_IDENTITY("\t-i   display drive identification\n") \
 	USE_FEATURE_HDPARM_GET_IDENTITY("\t-I   detailed/current information directly from drive\n") \
-	USE_FEATURE_HDPARM_GET_IDENTITY("\t-Istdin  similar to -I, but wants /proc/ide/" "*" "/hd?/identify as input\n") \
 	"\t-k   get/set keep_settings_over_reset flag (0/1)\n" \
 	"\t-K   set drive keep_features_over_reset flag (0/1)\n" \
 	"\t-L   set drive doorlock (0/1) (removable harddisks only)\n" \

Modified: trunk/busybox/miscutils/Config.in
===================================================================
--- trunk/busybox/miscutils/Config.in	2006-05-31 22:24:33 UTC (rev 15253)
+++ trunk/busybox/miscutils/Config.in	2006-05-31 22:52:57 UTC (rev 15254)
@@ -169,11 +169,12 @@
 config CONFIG_FEATURE_HDPARM_GET_IDENTITY
 	bool "Support obtaining detailed information directly from drives"
 	default y
-	depends on CONFIG_HDPARM && CONFIG_GETOPT_LONG
+	depends on CONFIG_HDPARM
 	help
-	  Enables the -I and -Istdin options to obtain detailed information
+	  Enables the -I and -i options to obtain detailed information
 	  directly from drives about their capabilities and supported ATA
-	  feature set.  Enabling this option will add about 16k...
+	  feature set. If no device name is specified, hdparm will read
+	  identify data from stdin. Enabling this option will add about 16k...
 
 config CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
 	bool "Register an IDE interface (DANGEROUS)"

Modified: trunk/busybox/miscutils/hdparm.c
===================================================================
--- trunk/busybox/miscutils/hdparm.c	2006-05-31 22:24:33 UTC (rev 15253)
+++ trunk/busybox/miscutils/hdparm.c	2006-05-31 22:52:57 UTC (rev 15254)
@@ -23,7 +23,6 @@
 #include <sys/times.h>
 #include <sys/mount.h>
 #include <sys/mman.h>
-#include <getopt.h>
 #include <linux/types.h>
 #include <linux/hdreg.h>
 
@@ -2095,21 +2094,9 @@
 	}
 }
 
-/*-------------------------------------*/
-/* getopt long options */
-#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
-static const struct option HDPARM_LONG_OPT[] =
-{
-	{"Istdin", 0, NULL, '\256'},
-	{NULL, 0, NULL, 0}
-};
-#else
-#define HDPARM_LONG_OPT			NULL
-#endif
-/*-------------------------------------*/
-/* getopt short options */
+/*------- getopt short options --------*/
 static const char hdparm_options[]=	"gfu::n::p:r::m::c::k::a::B:tTh"\
-	USE_FEATURE_HDPARM_GET_IDENTITY("\256iI")
+	USE_FEATURE_HDPARM_GET_IDENTITY("iI")
 	USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::")
 #ifdef HDIO_DRIVE_CMD
 									"S::D::P::X::K::A::L::W::CyYzZ"
@@ -2134,13 +2121,9 @@
 	int c;
 	int flagcount = 0;
 
-	while ((c = getopt_long (argc, argv, hdparm_options, HDPARM_LONG_OPT , NULL)) >= 0) {
+	while ((c = getopt(argc, argv, hdparm_options)) >= 0) {
 		flagcount++;
-#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
-		if (c == '\256') {
-			identify_from_stdin(); /* EXIT */
-		}
-#endif
+		if (c == 'h') bb_show_usage(); /* EXIT */
 		USE_FEATURE_HDPARM_GET_IDENTITY(get_IDentity = (c == 'I'));
 		USE_FEATURE_HDPARM_GET_IDENTITY(get_identity = (c == 'i'));
 		get_geom |= (c == 'g');
@@ -2204,9 +2187,11 @@
 	argc -= optind;
 	argv += optind;
 
+#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
 	if (argc < 1) {
-		bb_show_usage();
+		identify_from_stdin(); /* EXIT */
 	}
+#endif
 
 	while (argc--) {
 		process_dev(*argv);




More information about the busybox-cvs mailing list