]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
attempt to work around x86_64 problem
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 16 Sep 2008 22:19:53 +0000 (00:19 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Tue, 16 Sep 2008 22:19:53 +0000 (00:19 +0200)
iw.c

diff --git a/iw.c b/iw.c
index 672c516a679943c265e437a338f652a31286c8aa..bba3e6f645ba4d927dc37f36e3fd7bc78fb7d82c 100644 (file)
--- a/iw.c
+++ b/iw.c
@@ -71,6 +71,11 @@ static void nl80211_cleanup(struct nl80211_state *state)
        nl_handle_destroy(state->nl_handle);
 }
 
+__COMMAND(NULL, NULL, NULL, 0, 0, CIB_NONE, NULL);
+__COMMAND(NULL, NULL, NULL, 1, 0, CIB_NONE, NULL);
+
+static int cmd_size;
+
 static void usage(const char *argv0)
 {
        struct cmd *cmd;
@@ -80,7 +85,10 @@ static void usage(const char *argv0)
        fprintf(stderr, "\t--debug\t\tenable netlink debugging\n");
        fprintf(stderr, "\t--version\tshow version\n");
        fprintf(stderr, "Commands:\n");
-       for (cmd = &__start___cmd; cmd < &__stop___cmd; cmd++) {
+       for (cmd = &__start___cmd; cmd < &__stop___cmd;
+            cmd = (struct cmd *)((char *)cmd + cmd_size)) {
+               if (!cmd->handler)
+                       continue;
                switch (cmd->idby) {
                case CIB_NONE:
                        fprintf(stderr, "\t");
@@ -176,7 +184,10 @@ static int handle_cmd(struct nl80211_state *state,
        argc--;
        argv++;
 
-       for (cmd = &__start___cmd; cmd < &__stop___cmd; cmd++) {
+       for (cmd = &__start___cmd; cmd < &__stop___cmd;
+            cmd = (struct cmd *)((char *)cmd + cmd_size)) {
+               if (!cmd->handler)
+                       continue;
                if (cmd->idby != idby)
                        continue;
                if (cmd->section) {
@@ -258,6 +269,7 @@ int main(int argc, char **argv)
        int err;
        const char *argv0;
 
+       cmd_size = abs((long)&__cmd_NULL1CIB_NONE - (long)&__cmd_NULL0CIB_NONE);
        /* strip off self */
        argc--;
        argv0 = *argv++;