aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-05-31 22:52:57 +0000
committerRob Landley <rob@landley.net>2006-05-31 22:52:57 +0000
commit06208417581fb8dcc05c8ca0250397d33ef3be52 (patch)
tree8cf532e46f72f88e3d978729b85da33c05708ae0
parentc8b360ebb75ff41a5263828a591e7c0932ea944e (diff)
downloadbusybox-w32-06208417581fb8dcc05c8ca0250397d33ef3be52.tar.gz
busybox-w32-06208417581fb8dcc05c8ca0250397d33ef3be52.tar.bz2
busybox-w32-06208417581fb8dcc05c8ca0250397d33ef3be52.zip
Patch from Tito to remove long options from hdparm.
-rw-r--r--include/usage.h6
-rw-r--r--miscutils/Config.in7
-rw-r--r--miscutils/hdparm.c29
3 files changed, 14 insertions, 28 deletions
diff --git a/include/usage.h b/include/usage.h
index 1d143e61e..239bbb373 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -994,7 +994,8 @@ USE_FEATURE_DATE_ISOFMT( \
994#define hdparm_trivial_usage \ 994#define hdparm_trivial_usage \
995 "[options] [device] .." 995 "[options] [device] .."
996#define hdparm_full_usage \ 996#define hdparm_full_usage \
997 "Options:" \ 997 USE_FEATURE_HDPARM_GET_IDENTITY("\tIf no device name is specified read from stdin.\n") \
998 "\nOptions:\n" \
998 "\t-a get/set fs readahead\n" \ 999 "\t-a get/set fs readahead\n" \
999 "\t-A set drive read-lookahead flag (0/1)\n" \ 1000 "\t-A set drive read-lookahead flag (0/1)\n" \
1000 "\t-b get/set bus state (0 == off, 1 == on, 2 == tristate)\n" \ 1001 "\t-b get/set bus state (0 == off, 1 == on, 2 == tristate)\n" \
@@ -1006,9 +1007,8 @@ USE_FEATURE_DATE_ISOFMT( \
1006 "\t-f flush buffer cache for device on exit\n" \ 1007 "\t-f flush buffer cache for device on exit\n" \
1007 "\t-g display drive geometry\n" \ 1008 "\t-g display drive geometry\n" \
1008 "\t-h display terse usage information\n" \ 1009 "\t-h display terse usage information\n" \
1009 "\t-i display drive identification\n" \ 1010 USE_FEATURE_HDPARM_GET_IDENTITY("\t-i display drive identification\n") \
1010 USE_FEATURE_HDPARM_GET_IDENTITY("\t-I detailed/current information directly from drive\n") \ 1011 USE_FEATURE_HDPARM_GET_IDENTITY("\t-I detailed/current information directly from drive\n") \
1011 USE_FEATURE_HDPARM_GET_IDENTITY("\t-Istdin similar to -I, but wants /proc/ide/" "*" "/hd?/identify as input\n") \
1012 "\t-k get/set keep_settings_over_reset flag (0/1)\n" \ 1012 "\t-k get/set keep_settings_over_reset flag (0/1)\n" \
1013 "\t-K set drive keep_features_over_reset flag (0/1)\n" \ 1013 "\t-K set drive keep_features_over_reset flag (0/1)\n" \
1014 "\t-L set drive doorlock (0/1) (removable harddisks only)\n" \ 1014 "\t-L set drive doorlock (0/1) (removable harddisks only)\n" \
diff --git a/miscutils/Config.in b/miscutils/Config.in
index eae977fac..fc90b5447 100644
--- a/miscutils/Config.in
+++ b/miscutils/Config.in
@@ -169,11 +169,12 @@ config CONFIG_HDPARM
169config CONFIG_FEATURE_HDPARM_GET_IDENTITY 169config CONFIG_FEATURE_HDPARM_GET_IDENTITY
170 bool "Support obtaining detailed information directly from drives" 170 bool "Support obtaining detailed information directly from drives"
171 default y 171 default y
172 depends on CONFIG_HDPARM && CONFIG_GETOPT_LONG 172 depends on CONFIG_HDPARM
173 help 173 help
174 Enables the -I and -Istdin options to obtain detailed information 174 Enables the -I and -i options to obtain detailed information
175 directly from drives about their capabilities and supported ATA 175 directly from drives about their capabilities and supported ATA
176 feature set. Enabling this option will add about 16k... 176 feature set. If no device name is specified, hdparm will read
177 identify data from stdin. Enabling this option will add about 16k...
177 178
178config CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF 179config CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
179 bool "Register an IDE interface (DANGEROUS)" 180 bool "Register an IDE interface (DANGEROUS)"
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 55ed2f6ff..37b87ea9f 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -23,7 +23,6 @@
23#include <sys/times.h> 23#include <sys/times.h>
24#include <sys/mount.h> 24#include <sys/mount.h>
25#include <sys/mman.h> 25#include <sys/mman.h>
26#include <getopt.h>
27#include <linux/types.h> 26#include <linux/types.h>
28#include <linux/hdreg.h> 27#include <linux/hdreg.h>
29 28
@@ -2095,21 +2094,9 @@ static void parse_xfermode(int flag, unsigned long *get, unsigned long *set, int
2095 } 2094 }
2096} 2095}
2097 2096
2098/*-------------------------------------*/ 2097/*------- getopt short options --------*/
2099/* getopt long options */
2100#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
2101static const struct option HDPARM_LONG_OPT[] =
2102{
2103 {"Istdin", 0, NULL, '\256'},
2104 {NULL, 0, NULL, 0}
2105};
2106#else
2107#define HDPARM_LONG_OPT NULL
2108#endif
2109/*-------------------------------------*/
2110/* getopt short options */
2111static const char hdparm_options[]= "gfu::n::p:r::m::c::k::a::B:tTh"\ 2098static const char hdparm_options[]= "gfu::n::p:r::m::c::k::a::B:tTh"\
2112 USE_FEATURE_HDPARM_GET_IDENTITY("\256iI") 2099 USE_FEATURE_HDPARM_GET_IDENTITY("iI")
2113 USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::") 2100 USE_FEATURE_HDPARM_HDIO_GETSET_DMA("d::")
2114#ifdef HDIO_DRIVE_CMD 2101#ifdef HDIO_DRIVE_CMD
2115 "S::D::P::X::K::A::L::W::CyYzZ" 2102 "S::D::P::X::K::A::L::W::CyYzZ"
@@ -2134,13 +2121,9 @@ int hdparm_main(int argc, char **argv)
2134 int c; 2121 int c;
2135 int flagcount = 0; 2122 int flagcount = 0;
2136 2123
2137 while ((c = getopt_long (argc, argv, hdparm_options, HDPARM_LONG_OPT , NULL)) >= 0) { 2124 while ((c = getopt(argc, argv, hdparm_options)) >= 0) {
2138 flagcount++; 2125 flagcount++;
2139#if ENABLE_FEATURE_HDPARM_GET_IDENTITY 2126 if (c == 'h') bb_show_usage(); /* EXIT */
2140 if (c == '\256') {
2141 identify_from_stdin(); /* EXIT */
2142 }
2143#endif
2144 USE_FEATURE_HDPARM_GET_IDENTITY(get_IDentity = (c == 'I')); 2127 USE_FEATURE_HDPARM_GET_IDENTITY(get_IDentity = (c == 'I'));
2145 USE_FEATURE_HDPARM_GET_IDENTITY(get_identity = (c == 'i')); 2128 USE_FEATURE_HDPARM_GET_IDENTITY(get_identity = (c == 'i'));
2146 get_geom |= (c == 'g'); 2129 get_geom |= (c == 'g');
@@ -2204,9 +2187,11 @@ int hdparm_main(int argc, char **argv)
2204 argc -= optind; 2187 argc -= optind;
2205 argv += optind; 2188 argv += optind;
2206 2189
2190#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
2207 if (argc < 1) { 2191 if (argc < 1) {
2208 bb_show_usage(); 2192 identify_from_stdin(); /* EXIT */
2209 } 2193 }
2194#endif
2210 2195
2211 while (argc--) { 2196 while (argc--) {
2212 process_dev(*argv); 2197 process_dev(*argv);