]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[cmdline] Show commands in alphabetical order coverity_scan master
authorMichael Brown <mcb30@ipxe.org>
Wed, 6 Aug 2025 15:29:32 +0000 (16:29 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 6 Aug 2025 15:34:45 +0000 (16:34 +0100)
Commands were originally ordered by functional group (e.g. keeping the
image management commands together), with arrays used to impose a
functionally meaningful order within the group.

As the number of commands and functional groups has expanded over the
years, this has become essentially useless as an organising principle.
Switch to sorting commands alphabetically (using the linker table
mechanism).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
49 files changed:
src/arch/x86/hci/commands/cpuid_cmd.c
src/arch/x86/hci/commands/pxe_cmd.c
src/core/exec.c
src/crypto/mishmash/cmd_md4.c
src/crypto/mishmash/cmd_sha224.c
src/crypto/mishmash/cmd_sha256.c
src/crypto/mishmash/cmd_sha384.c
src/crypto/mishmash/cmd_sha512.c
src/hci/commands/autoboot_cmd.c
src/hci/commands/cert_cmd.c
src/hci/commands/config_cmd.c
src/hci/commands/console_cmd.c
src/hci/commands/dhcp_cmd.c
src/hci/commands/digest_cmd.c
src/hci/commands/dynui_cmd.c
src/hci/commands/fcmgmt_cmd.c
src/hci/commands/fdt_cmd.c
src/hci/commands/gdbstub_cmd.c
src/hci/commands/ibmgmt_cmd.c
src/hci/commands/ifmgmt_cmd.c
src/hci/commands/image_archive_cmd.c
src/hci/commands/image_cmd.c
src/hci/commands/image_crypt_cmd.c
src/hci/commands/image_mem_cmd.c
src/hci/commands/image_trust_cmd.c
src/hci/commands/ipstat_cmd.c
src/hci/commands/iwmgmt_cmd.c
src/hci/commands/login_cmd.c
src/hci/commands/lotest_cmd.c
src/hci/commands/neighbour_cmd.c
src/hci/commands/nslookup_cmd.c
src/hci/commands/ntp_cmd.c
src/hci/commands/nvo_cmd.c
src/hci/commands/param_cmd.c
src/hci/commands/pci_cmd.c
src/hci/commands/ping_cmd.c
src/hci/commands/poweroff_cmd.c
src/hci/commands/profstat_cmd.c
src/hci/commands/reboot_cmd.c
src/hci/commands/route_cmd.c
src/hci/commands/sanboot_cmd.c
src/hci/commands/shim_cmd.c
src/hci/commands/sync_cmd.c
src/hci/commands/time_cmd.c
src/hci/commands/usb_cmd.c
src/hci/commands/vlan_cmd.c
src/hci/shell.c
src/image/script.c
src/include/ipxe/command.h

index d73ce2a3e6254baf0304b68ea92f93daddccc3df..b1978d5f2da36019e6e7e8447b755c0d3fc4333f 100644 (file)
@@ -95,7 +95,4 @@ static int cpuid_exec ( int argc, char **argv ) {
 }
 
 /** x86 CPU feature detection command */
-struct command cpuid_command __command = {
-       .name = "cpuid",
-       .exec = cpuid_exec,
-};
+COMMAND ( cpuid, cpuid_exec );
index 473b97f9759c4d4f29ef8c4aa201be9bdd752e6a..cf1a36ed67e2535aca111d0cf11fd38d8909e6e3 100644 (file)
@@ -105,13 +105,5 @@ static int stoppxe_exec ( int argc __unused, char **argv __unused ) {
 }
 
 /** PXE commands */
-struct command pxe_commands[] __command = {
-       {
-               .name = "startpxe",
-               .exec = startpxe_exec,
-       },
-       {
-               .name = "stoppxe",
-               .exec = stoppxe_exec,
-       },
-};
+COMMAND ( startpxe, startpxe_exec );
+COMMAND ( stoppxe, stoppxe_exec );
index a13884b68255a9433cdf70796f9919bea853f702..534fb9993c34acb76bef1f913ed7877b208caab2 100644 (file)
@@ -428,10 +428,7 @@ static int echo_exec ( int argc, char **argv ) {
 }
 
 /** "echo" command */
-struct command echo_command __command = {
-       .name = "echo",
-       .exec = echo_exec,
-};
+COMMAND ( echo, echo_exec );
 
 /** "exit" options */
 struct exit_options {};
@@ -472,10 +469,7 @@ static int exit_exec ( int argc, char **argv ) {
 }
 
 /** "exit" command */
-struct command exit_command __command = {
-       .name = "exit",
-       .exec = exit_exec,
-};
+COMMAND ( exit, exit_exec );
 
 /** "isset" options */
 struct isset_options {};
@@ -507,10 +501,7 @@ static int isset_exec ( int argc, char **argv ) {
 }
 
 /** "isset" command */
-struct command isset_command __command = {
-       .name = "isset",
-       .exec = isset_exec,
-};
+COMMAND ( isset, isset_exec );
 
 /** "iseq" options */
 struct iseq_options {};
@@ -544,10 +535,7 @@ static int iseq_exec ( int argc, char **argv ) {
 }
 
 /** "iseq" command */
-struct command iseq_command __command = {
-       .name = "iseq",
-       .exec = iseq_exec,
-};
+COMMAND ( iseq, iseq_exec );
 
 /** "sleep" options */
 struct sleep_options {};
@@ -587,7 +575,4 @@ static int sleep_exec ( int argc, char **argv ) {
 }
 
 /** "sleep" command */
-struct command sleep_command __command = {
-       .name = "sleep",
-       .exec = sleep_exec,
-};
+COMMAND ( sleep, sleep_exec );
index 6413d565abcbad68a2c169a58597f3bb35ad69ec..8991b0250c66344afe71fe1c60a60eaea9c2a593 100644 (file)
@@ -30,7 +30,4 @@ static int md4sum_exec ( int argc, char **argv ) {
        return digest_exec ( argc, argv, &md4_algorithm );
 }
 
-struct command md4sum_command __command = {
-       .name = "md4sum",
-       .exec = md4sum_exec,
-};
+COMMAND ( md4sum, md4sum_exec );
index ffc4bf87df0b8383129d7fe3f55f37acb1b6b04c..3975a37c5f95a67d0c7d8ae74fcd6cb701fe4567 100644 (file)
@@ -30,7 +30,4 @@ static int sha224sum_exec ( int argc, char **argv ) {
        return digest_exec ( argc, argv, &sha224_algorithm );
 }
 
-struct command sha224sum_command __command = {
-       .name = "sha224sum",
-       .exec = sha224sum_exec,
-};
+COMMAND ( sha224sum, sha224sum_exec );
index 918c3350b14e937c8e023ad917aa8f2535fea33c..8076e8dbf30283c81fc0ef1dead358e9aa305aba 100644 (file)
@@ -30,7 +30,4 @@ static int sha256sum_exec ( int argc, char **argv ) {
        return digest_exec ( argc, argv, &sha256_algorithm );
 }
 
-struct command sha256sum_command __command = {
-       .name = "sha256sum",
-       .exec = sha256sum_exec,
-};
+COMMAND ( sha256sum, sha256sum_exec );
index c1c5058180cae70c9577e612cf604bf0ffefe41b..ed7265ab9306a9b0e9fadb6aeb7a7c8dd916c8df 100644 (file)
@@ -30,7 +30,4 @@ static int sha384sum_exec ( int argc, char **argv ) {
        return digest_exec ( argc, argv, &sha384_algorithm );
 }
 
-struct command sha384sum_command __command = {
-       .name = "sha384sum",
-       .exec = sha384sum_exec,
-};
+COMMAND ( sha384sum, sha384sum_exec );
index 1bb8e1286bc1e88cf739b807a1521c5f31794b2d..96b8ade886e48fdd4b8fdb8bb1a1dffc8129e013 100644 (file)
@@ -30,7 +30,4 @@ static int sha512sum_exec ( int argc, char **argv ) {
        return digest_exec ( argc, argv, &sha512_algorithm );
 }
 
-struct command sha512sum_command __command = {
-       .name = "sha512sum",
-       .exec = sha512sum_exec,
-};
+COMMAND ( sha512sum, sha512sum_exec );
index 56f39a1ce10cee2e1efb51274f710c4cfdece9dd..010c6fcb0211fa3b3f9573faf7bece04d466013a 100644 (file)
@@ -73,9 +73,4 @@ static int autoboot_exec ( int argc, char **argv ) {
 }
 
 /** Booting commands */
-struct command autoboot_commands[] __command = {
-       {
-               .name = "autoboot",
-               .exec = autoboot_exec,
-       },
-};
+COMMAND ( autoboot, autoboot_exec );
index 75d2ccbed16fd22131d753e1309c61aec8c68081..efa4c3c12cfca9afe1662409fb8d962583a58732 100644 (file)
@@ -289,17 +289,6 @@ static int certfree_exec ( int argc, char **argv ) {
 }
 
 /** Certificate management commands */
-struct command certmgmt_commands[] __command = {
-       {
-               .name = "certstat",
-               .exec = certstat_exec,
-       },
-       {
-               .name = "certstore",
-               .exec = certstore_exec,
-       },
-       {
-               .name = "certfree",
-               .exec = certfree_exec,
-       },
-};
+COMMAND ( certstat, certstat_exec );
+COMMAND ( certstore, certstore_exec );
+COMMAND ( certfree, certfree_exec );
index ad415e04543a7efa45b498f80ad2d726bc39c0af..39272196a82ef7d23da0dc2b2ffd32650c0f2b1b 100644 (file)
@@ -79,7 +79,4 @@ static int config_exec ( int argc, char **argv ) {
 }
 
 /** Configuration UI commands */
-struct command config_command __command = {
-       .name = "config",
-       .exec = config_exec,
-};
+COMMAND ( config, config_exec );
index ba472b9f6b358ca3ba228ff25aa0889f073b8a47..19d19ef1bab331cca8478c235e807f6dbc73868e 100644 (file)
@@ -251,17 +251,6 @@ static int cpair_exec ( int argc, char **argv ) {
 }
 
 /** Console management commands */
-struct command console_commands[] __command = {
-       {
-               .name = "console",
-               .exec = console_exec,
-       },
-       {
-               .name = "colour",
-               .exec = colour_exec,
-       },
-       {
-               .name = "cpair",
-               .exec = cpair_exec,
-       },
-};
+COMMAND ( console, console_exec );
+COMMAND ( colour, colour_exec );
+COMMAND ( cpair, cpair_exec );
index 45a922b51da265b1090f38fd41771cd28ab700fd..33c23fc6e34c5c09867c25cc89699d4d1a381387 100644 (file)
@@ -92,13 +92,5 @@ static int pxebs_exec ( int argc, char **argv ) {
 }
 
 /** DHCP management commands */
-struct command dhcp_commands[] __command = {
-       {
-               .name = "dhcp",
-               .exec = ifconf_exec, /* synonym for "ifconf" */
-       },
-       {
-               .name = "pxebs",
-               .exec = pxebs_exec,
-       },
-};
+COMMAND ( dhcp, ifconf_exec ); /* synonym for "ifconf" */
+COMMAND ( pxebs, pxebs_exec );
index 20d33a5d808b37d2ceb8e53430958b8a31f8f9c1..a7f43f69e6b121b54fe95314afdbc87edeb6b4c2 100644 (file)
@@ -128,15 +128,8 @@ static int sha1sum_exec ( int argc, char **argv ) {
        return digest_exec ( argc, argv, &sha1_algorithm );
 }
 
-struct command md5sum_command __command = {
-       .name = "md5sum",
-       .exec = md5sum_exec,
-};
-
-struct command sha1sum_command __command = {
-       .name = "sha1sum",
-       .exec = sha1sum_exec,
-};
+COMMAND ( md5sum, md5sum_exec );
+COMMAND ( sha1sum, sha1sum_exec );
 
 /* Drag in commands for any other enabled algorithms */
 REQUIRING_SYMBOL ( digest_exec );
index 6cad63868be7fdc24380f943e26415b8c1ca3e3e..56a4acd06548720626b20dfafab8c8512129975c 100644 (file)
@@ -350,25 +350,8 @@ static int present_exec ( int argc, char **argv ) {
 }
 
 /** Dynamic user interface commands */
-struct command dynui_commands[] __command = {
-       {
-               .name = "menu",
-               .exec = dynui_exec,
-       },
-       {
-               .name = "form",
-               .exec = dynui_exec,
-       },
-       {
-               .name = "item",
-               .exec = item_exec,
-       },
-       {
-               .name = "choose",
-               .exec = choose_exec,
-       },
-       {
-               .name = "present",
-               .exec = present_exec,
-       },
-};
+COMMAND ( menu, dynui_exec );
+COMMAND ( form, dynui_exec );
+COMMAND ( item, item_exec );
+COMMAND ( choose, choose_exec );
+COMMAND ( present, present_exec );
index 97f10f4ddff4b9f17790695edc8c153520657948..c03ebb05ff7e6f48c5aeabdc4eea4970533000c0 100644 (file)
@@ -207,13 +207,5 @@ static int fcels_exec ( int argc, char **argv ) {
 }
 
 /** Fibre Channel management commands */
-struct command fcmgmt_commands[] __command = {
-       {
-               .name = "fcstat",
-               .exec = fcstat_exec,
-       },
-       {
-               .name = "fcels",
-               .exec = fcels_exec,
-       },
-};
+COMMAND ( fcstat, fcstat_exec );
+COMMAND ( fcels, fcels_exec );
index dbcbf4447e3b29c7e4a7e319df6f7579ae80ee4f..7cd39279b0bff15293795f510311945b0dad89f4 100644 (file)
@@ -88,9 +88,4 @@ static int fdt_exec ( int argc, char **argv ) {
 }
 
 /** Flattened Device Tree commands */
-struct command fdt_commands[] __command = {
-       {
-               .name = "fdt",
-               .exec = fdt_exec,
-       },
-};
+COMMAND ( fdt, fdt_exec );
index c4a831e7ae1b7734167aefddb9aff7f12ff09cc0..ba5edde3afcf9ee8e8e34cf4ccedc0fcfe7e565c 100644 (file)
@@ -107,9 +107,4 @@ static int gdbstub_exec ( int argc, char **argv ) {
 }
 
 /** GDB stub commands */
-struct command gdbstub_commands[] __command = {
-       {
-               .name = "gdbstub",
-               .exec = gdbstub_exec,
-       },
-};
+COMMAND ( gdbstub, gdbstub_exec );
index 1154d749e42fb5f7e862fae2b539d2388131e73e..be8b58cc26fd52f697eff93c97a51166f64f2619 100644 (file)
@@ -71,9 +71,4 @@ static int ibstat_exec ( int argc, char **argv ) {
 }
 
 /** Infiniband commands */
-struct command ibmgmt_commands[] __command = {
-       {
-               .name = "ibstat",
-               .exec = ibstat_exec,
-       },
-};
+COMMAND ( ibstat, ibstat_exec );
index 591cb3da8727e9a316bba43e5fff9873a1d4bd56..2906d1d4599a782b6c3efc4a6e84f7def968af4a 100644 (file)
@@ -303,25 +303,8 @@ static int iflinkwait_exec ( int argc, char **argv ) {
 }
 
 /** Interface management commands */
-struct command ifmgmt_commands[] __command = {
-       {
-               .name = "ifopen",
-               .exec = ifopen_exec,
-       },
-       {
-               .name = "ifclose",
-               .exec = ifclose_exec,
-       },
-       {
-               .name = "ifstat",
-               .exec = ifstat_exec,
-       },
-       {
-               .name = "ifconf",
-               .exec = ifconf_exec,
-       },
-       {
-               .name = "iflinkwait",
-               .exec = iflinkwait_exec,
-       },
-};
+COMMAND ( ifopen, ifopen_exec );
+COMMAND ( ifclose, ifclose_exec );
+COMMAND ( ifstat, ifstat_exec );
+COMMAND ( ifconf, ifconf_exec );
+COMMAND ( iflinkwait, iflinkwait_exec );
index a2212aecfa013356c6332404d8ce2745bcda3c4c..6b907830e45a90b0c8d5c2636eb6165d20ab95aa 100644 (file)
@@ -97,9 +97,4 @@ static int imgextract_exec ( int argc, char **argv ) {
 }
 
 /** Archive image commands */
-struct command image_archive_commands[] __command = {
-       {
-               .name = "imgextract",
-               .exec = imgextract_exec,
-       },
-};
+COMMAND ( imgextract, imgextract_exec );
index 4b42695c4a8f30e028625bb89a811a2b327d134f..1792568622b827b702e184baccf886642ef09986 100644 (file)
@@ -393,54 +393,22 @@ static int imgfree_exec ( int argc, char **argv ) {
        return imgmulti_exec ( argc, argv, unregister_image );
 }
 
-/** Image management commands */
-struct command image_commands[] __command = {
-       {
-               .name = "imgfetch",
-               .exec = imgfetch_exec,
-       },
-       {
-               .name = "module",
-               .exec = imgfetch_exec, /* synonym for "imgfetch" */
-       },
-       {
-               .name = "initrd",
-               .exec = imgfetch_exec, /* synonym for "imgfetch" */
-       },
-       {
-               .name = "kernel",
-               .exec = imgselect_exec, /* synonym for "imgselect" */
-       },
-       {
-               .name = "chain",
-               .exec = imgexec_exec, /* synonym for "imgexec" */
-       },
-       {
-               .name = "imgselect",
-               .exec = imgselect_exec,
-       },
-       {
-               .name = "imgload",
-               .exec = imgselect_exec, /* synonym for "imgselect" */
-       },
-       {
-               .name = "imgargs",
-               .exec = imgargs_exec,
-       },
-       {
-               .name = "imgexec",
-               .exec = imgexec_exec,
-       },
-       {
-               .name = "boot", /* synonym for "imgexec" */
-               .exec = imgexec_exec,
-       },
-       {
-               .name = "imgstat",
-               .exec = imgstat_exec,
-       },
-       {
-               .name = "imgfree",
-               .exec = imgfree_exec,
-       },
-};
+/* "imgfetch" and synonyms */
+COMMAND ( imgfetch, imgfetch_exec );
+COMMAND ( module, imgfetch_exec );
+COMMAND ( initrd, imgfetch_exec );
+
+/* "imgselect" and synonyms */
+COMMAND ( imgselect, imgselect_exec );
+COMMAND ( imgload, imgselect_exec );
+COMMAND ( kernel, imgselect_exec );
+
+/* "imgexec" and synonyms */
+COMMAND ( imgexec, imgexec_exec );
+COMMAND ( chain, imgexec_exec );
+COMMAND ( boot, imgexec_exec );
+
+/* Other image management commands */
+COMMAND ( imgargs, imgargs_exec );
+COMMAND ( imgstat, imgstat_exec );
+COMMAND ( imgfree, imgfree_exec );
index 4dfb5b1312bd7295df15b16f1e42872a238c41be..54568cc28268a8733de64facc78879acc4a9aad7 100644 (file)
@@ -117,9 +117,4 @@ static int imgdecrypt_exec ( int argc, char **argv ) {
 }
 
 /** Image encryption management commands */
-struct command image_crypt_commands[] __command = {
-       {
-               .name = "imgdecrypt",
-               .exec = imgdecrypt_exec,
-       },
-};
+COMMAND ( imgdecrypt, imgdecrypt_exec );
index fcd7666273e5de56d981a966cfb29e1f1cbf0b2d..60c0bf92ae8ac5172fdbdb41a6f3bfddb24773a9 100644 (file)
@@ -89,9 +89,4 @@ static int imgmem_exec ( int argc, char **argv ) {
 }
 
 /** Read memory command */
-struct command imgmem_commands[] __command = {
-       {
-               .name = "imgmem",
-               .exec = imgmem_exec,
-       },
-};
+COMMAND ( imgmem, imgmem_exec );
index 9b9e3f859fd4cf95d48f5f402f6bdd741a4a1c4d..314aa0998d032d8c21be29f3ad8a0d8cb4b0daad 100644 (file)
@@ -163,13 +163,5 @@ static int imgverify_exec ( int argc, char **argv ) {
 }
 
 /** Image trust management commands */
-struct command image_trust_commands[] __command = {
-       {
-               .name = "imgtrust",
-               .exec = imgtrust_exec,
-       },
-       {
-               .name = "imgverify",
-               .exec = imgverify_exec,
-       },
-};
+COMMAND ( imgtrust, imgtrust_exec );
+COMMAND ( imgverify, imgverify_exec );
index 763e4dfd67eb9c7d84c8a74ac5f551392dd06c47..488016e3a97d03a00bec520344e722caf682bc1f 100644 (file)
@@ -66,9 +66,4 @@ static int ipstat_exec ( int argc, char **argv ) {
 }
 
 /** Routing table management commands */
-struct command ipstat_commands[] __command = {
-       {
-               .name = "ipstat",
-               .exec = ipstat_exec,
-       },
-};
+COMMAND ( ipstat, ipstat_exec );
index b61ee8c7b538110f46042625b21aca96b311162d..b430353d93ce45a9db13bc72ed0c9844f978ee69 100644 (file)
@@ -113,13 +113,5 @@ static int iwlist_exec ( int argc, char **argv ) {
 }
 
 /** Wireless interface management commands */
-struct command iwmgmt_commands[] __command = {
-       {
-               .name = "iwstat",
-               .exec = iwstat_exec,
-       },
-       {
-               .name = "iwlist",
-               .exec = iwlist_exec,
-       },
-};
+COMMAND ( iwstat, iwstat_exec );
+COMMAND ( iwlist, iwlist_exec );
index c9e196437908e60eb265012a6c0a9a0afcf32b95..005d4034201d1d4f88f3d6414a72a021c1b0d65a 100644 (file)
@@ -71,7 +71,4 @@ static int login_exec ( int argc, char **argv ) {
 }
 
 /** Login commands */
-struct command login_command __command = {
-       .name = "login",
-       .exec = login_exec,
-};
+COMMAND ( login, login_exec );
index 393b3c36e7ce2c86427ac69f726c052a8cfbff2c..ee3b0d3b51c567c8f6859761e461e11635936f58 100644 (file)
@@ -100,7 +100,4 @@ static int lotest_exec ( int argc, char **argv ) {
 }
 
 /** Loopback testing commands */
-struct command lotest_command __command = {
-       .name = "lotest",
-       .exec = lotest_exec,
-};
+COMMAND ( lotest, lotest_exec );
index 816e87357c08bb8759b9c48e79e1fb11f60b855a..520d5aa066025731a0c5e07dae4b5be4b28b0cca 100644 (file)
@@ -65,9 +65,4 @@ static int nstat_exec ( int argc, char **argv ) {
 }
 
 /** Neighbour management commands */
-struct command neighbour_commands[] __command = {
-       {
-               .name = "nstat",
-               .exec = nstat_exec,
-       },
-};
+COMMAND ( nstat, nstat_exec );
index 265afdc3d297f707ae0586fc8b6cd20915de323f..dc9d61704e22d4ffffef8d3a1095f0984cbb993a 100644 (file)
@@ -73,7 +73,4 @@ static int nslookup_exec ( int argc, char **argv ) {
 }
 
 /** The "nslookup" command */
-struct command nslookup_command __command = {
-       .name = "nslookup",
-       .exec = nslookup_exec,
-};
+COMMAND ( nslookup, nslookup_exec );
index 8f741a512c46a910984c2896fd394c96de476ed3..fed126f4c6c3c9ad24bd236c31d96a1e06dad5e4 100644 (file)
@@ -75,7 +75,4 @@ static int ntp_exec ( int argc, char **argv ) {
 }
 
 /** NTP command */
-struct command ntp_command __command = {
-       .name = "ntp",
-       .exec = ntp_exec,
-};
+COMMAND ( ntp, ntp_exec );
index 6ad7e74285b77b27e80598c65f8670e932bc0e4a..69ab97dcaad3444423e19b3ebec4daa01f215b5a 100644 (file)
@@ -356,25 +356,8 @@ static int inc_exec ( int argc, char **argv ) {
 }
 
 /** Non-volatile option commands */
-struct command nvo_commands[] __command = {
-       {
-               .name = "show",
-               .exec = show_exec,
-       },
-       {
-               .name = "set",
-               .exec = set_exec,
-       },      
-       {
-               .name = "clear",
-               .exec = clear_exec,
-       },
-       {
-               .name = "read",
-               .exec = read_exec,
-       },
-       {
-               .name = "inc",
-               .exec = inc_exec,
-       },
-};
+COMMAND ( show, show_exec );
+COMMAND ( set, set_exec );
+COMMAND ( clear, clear_exec );
+COMMAND ( read, read_exec );
+COMMAND ( inc, inc_exec );
index dad99f8409814c78f0a0420a2b9654f58ff91119..0924df5978b21c50bbcf034f13b8015bf0fea132 100644 (file)
@@ -163,13 +163,5 @@ static int param_exec ( int argc, char **argv ) {
 }
 
 /** Request parameter commands */
-struct command param_commands[] __command = {
-       {
-               .name = "params",
-               .exec = params_exec,
-       },
-       {
-               .name = "param",
-               .exec = param_exec,
-       },
-};
+COMMAND ( params, params_exec );
+COMMAND ( param, param_exec );
index fa1fa5ecec7f72b970874f10215a2311a1322a77..0b54902fb724af96f0bd8715cc6a47416f715878 100644 (file)
@@ -115,9 +115,4 @@ static int pciscan_exec ( int argc, char **argv ) {
 }
 
 /** PCI commands */
-struct command pci_commands[] __command = {
-       {
-               .name = "pciscan",
-               .exec = pciscan_exec,
-       },
-};
+COMMAND ( pciscan, pciscan_exec );
index ab271e75a1247a0cc7bcead48b0ed6f9fb0b43ce..4e86ae1c073e33993a6ef757571e0f9266b4c475 100644 (file)
@@ -107,7 +107,4 @@ static int ping_exec ( int argc, char **argv ) {
 }
 
 /** Ping command */
-struct command ping_command __command = {
-       .name = "ping",
-       .exec = ping_exec,
-};
+COMMAND ( ping, ping_exec );
index afdf12dde55d8dbe535d14a72a9a0e838f6c842f..2c6f1369aa9092c6c4bbb33cbbd5d353bf30d3e7 100644 (file)
@@ -70,7 +70,4 @@ static int poweroff_exec ( int argc, char **argv ) {
 }
 
 /** "poweroff" command */
-struct command poweroff_command __command = {
-       .name = "poweroff",
-       .exec = poweroff_exec,
-};
+COMMAND ( poweroff, poweroff_exec );
index dc6f649e38bc17345fe3d0a67a7aa318fc0e8c32..da01068b27dcd06f03277469d6742ab8d432d714 100644 (file)
@@ -66,9 +66,4 @@ static int profstat_exec ( int argc, char **argv ) {
 }
 
 /** Profiling commands */
-struct command profstat_commands[] __command = {
-       {
-               .name = "profstat",
-               .exec = profstat_exec,
-       },
-};
+COMMAND ( profstat, profstat_exec );
index 5d4e151b8b58f0e8e5cd5e98ef9b9d9638f39625..c5b71c04575528374dcca3fcf90803960c4f5cd1 100644 (file)
@@ -81,7 +81,4 @@ static int reboot_exec ( int argc, char **argv ) {
 }
 
 /** "reboot" command */
-struct command reboot_command __command = {
-       .name = "reboot",
-       .exec = reboot_exec,
-};
+COMMAND ( reboot, reboot_exec );
index 8aa5353633e3cc11380f985ea95768241d69f963..a33754399c2f32a5ce3af7818ba907dde6986679 100644 (file)
@@ -66,9 +66,4 @@ static int route_exec ( int argc, char **argv ) {
 }
 
 /** Routing table management commands */
-struct command route_commands[] __command = {
-       {
-               .name = "route",
-               .exec = route_exec,
-       },
-};
+COMMAND ( route, route_exec );
index 6ab9e8844c9308c61043ef072c3e98e6fd2896e0..122bee527e0a892bc67bb0229d324947875f29de 100644 (file)
@@ -204,17 +204,6 @@ static int sanunhook_exec ( int argc, char **argv ) {
 }
 
 /** SAN commands */
-struct command sanboot_commands[] __command = {
-       {
-               .name = "sanhook",
-               .exec = sanhook_exec,
-       },
-       {
-               .name = "sanboot",
-               .exec = sanboot_exec,
-       },
-       {
-               .name = "sanunhook",
-               .exec = sanunhook_exec,
-       },
-};
+COMMAND ( sanhook, sanhook_exec );
+COMMAND ( sanboot, sanboot_exec );
+COMMAND ( sanunhook, sanunhook_exec );
index 11956290a00972fee978aecf63647b6caca59af6..a53bb3fde702f78ca44d418c303b5af51ab95532 100644 (file)
@@ -123,9 +123,4 @@ static int shim_exec ( int argc, char **argv ) {
 }
 
 /** Shim commands */
-struct command shim_commands[] __command = {
-       {
-               .name = "shim",
-               .exec = shim_exec,
-       },
-};
+COMMAND ( shim, shim_exec );
index 54799d422f4a487c543c018c42e91d9af82cc057..9d6e6a2845d66138850459897d28b978bba6aa14 100644 (file)
@@ -77,7 +77,4 @@ static int sync_exec ( int argc, char **argv ) {
 }
 
 /** Sync commands */
-struct command sync_command __command = {
-       .name = "sync",
-       .exec = sync_exec,
-};
+COMMAND ( sync, sync_exec );
index 08148bf3882372bcb704d790bc6903a7b6f041db..aba080792e9f33b2226bb3e44b9d6fd93632a25c 100644 (file)
@@ -77,7 +77,4 @@ static int time_exec ( int argc, char **argv ) {
 }
 
 /** "time" command */
-struct command time_command __command = {
-       .name = "time",
-       .exec = time_exec,
-};
+COMMAND ( time, time_exec );
index 4ee2f2ddb8e43e731586540ea08cc31a9e4dad21..2e3a823718591eb3131e3c2b9fcecd2dfa4e725a 100644 (file)
@@ -115,9 +115,4 @@ static int usbscan_exec ( int argc, char **argv ) {
 }
 
 /** USB commands */
-struct command usb_commands[] __command = {
-       {
-               .name = "usbscan",
-               .exec = usbscan_exec,
-       },
-};
+COMMAND ( usbscan, usbscan_exec );
index 8a2f0c749e91838391431da34c1430668f428ff8..636e5927f0e140d7b6babe8770813fb420bbe8ab 100644 (file)
@@ -131,13 +131,5 @@ static int vdestroy_exec ( int argc, char **argv ) {
 }
 
 /** VLAN commands */
-struct command vlan_commands[] __command = {
-       {
-               .name = "vcreate",
-               .exec = vcreate_exec,
-       },
-       {
-               .name = "vdestroy",
-               .exec = vdestroy_exec,
-       },
-};
+COMMAND ( vcreate, vcreate_exec );
+COMMAND ( vdestroy, vdestroy_exec );
index 8ecf73a6f9d3861258a261ca857c4ce6f9291818..7e2ecaab6921c8bb2bf3db36462c4a32e5138e8e 100644 (file)
@@ -72,10 +72,7 @@ static int help_exec ( int argc __unused, char **argv __unused ) {
 }
 
 /** "help" command */
-struct command help_command __command = {
-       .name = "help",
-       .exec = help_exec,
-};
+COMMAND ( help, help_exec );
 
 /**
  * Start command shell
@@ -137,7 +134,4 @@ static int shell_exec ( int argc, char **argv ) {
 }
 
 /** "shell" command */
-struct command shell_command __command = {
-       .name = "shell",
-       .exec = shell_exec,
-};
+COMMAND ( shell, shell_exec );
index 01e38cd6fa59938b86ea74bfa8ffeb3ffc4ef15d..257e59a090090ce280a584d4d6295c82ac228214 100644 (file)
@@ -352,10 +352,7 @@ static int goto_exec ( int argc, char **argv ) {
 }
 
 /** "goto" command */
-struct command goto_command __command = {
-       .name = "goto",
-       .exec = goto_exec,
-};
+COMMAND ( goto, goto_exec );
 
 /** "prompt" options */
 struct prompt_options {
@@ -418,7 +415,4 @@ static int prompt_exec ( int argc, char **argv ) {
 }
 
 /** "prompt" command */
-struct command prompt_command __command = {
-       .name = "prompt",
-       .exec = prompt_exec,
-};
+COMMAND ( prompt, prompt_exec );
index a208e7d8faa166d585b8f7b7f5ff3eccb080dc19..331536313d2f95b1b71dc17b222902dc0dd2c97c 100644 (file)
@@ -21,7 +21,12 @@ struct command {
 
 #define COMMANDS __table ( struct command, "commands" )
 
-#define __command __table_entry ( COMMANDS, 01 )
+#define __command( name ) __table_entry ( COMMANDS, _C2 ( 01., name ) )
+
+#define COMMAND( name, exec )                                          \
+       struct command name ## _command __command ( name ) = {          \
+               #name, exec                                             \
+       }
 
 extern char * concat_args ( char **args );