summaryrefslogtreecommitdiff
path: root/c_src/cmd_device.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-07-04 12:34:24 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-07-04 12:47:30 -0400
commite7cc6bb9cfd0d5de310d5eb61fd17693a2b4d60b (patch)
tree71c4c24abd6cfed054555c0de906827fe5266d8e /c_src/cmd_device.c
parent7d69a303d1c5eafd860c2377a013fd2aaad43ba2 (diff)
getopt() -> getopt_long()
Kill all remaining getopt() uses - all options can now be passed as longopts. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'c_src/cmd_device.c')
-rw-r--r--c_src/cmd_device.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/c_src/cmd_device.c b/c_src/cmd_device.c
index e7c40d0a..dcbf3701 100644
--- a/c_src/cmd_device.c
+++ b/c_src/cmd_device.c
@@ -212,9 +212,13 @@ static void device_online_usage(void)
static int cmd_device_online(int argc, char *argv[])
{
+ static const struct option longopts[] = {
+ { "help", 0, NULL, 'h' },
+ { NULL }
+ };
int opt;
- while ((opt = getopt(argc, argv, "h")) != -1)
+ while ((opt = getopt_long(argc, argv, "h", longopts, NULL)) != -1)
switch (opt) {
case 'h':
device_online_usage();
@@ -293,9 +297,13 @@ static void device_evacuate_usage(void)
static int cmd_device_evacuate(int argc, char *argv[])
{
+ static const struct option longopts[] = {
+ { "help", 0, NULL, 'h' },
+ { NULL }
+ };
int opt;
- while ((opt = getopt(argc, argv, "h")) != -1)
+ while ((opt = getopt_long(argc, argv, "h", longopts, NULL)) != -1)
switch (opt) {
case 'h':
device_evacuate_usage();