The following commit has been merged in the master branch:
commit aa18c17889d55b09e71f402afb986b7c35390212
Author: Guillem Jover <[email protected]>
Date:   Sat Feb 5 10:24:45 2011 +0100

    dpkg: Handle --force-all as any other force option
    
    Add an entry for "all" to forceinfos, so that the code paths are more
    clear on what each is doing. This will also make further refactoring
    easier.

diff --git a/src/main.c b/src/main.c
index 619c7bb..d6a4d56 100644
--- a/src/main.c
+++ b/src/main.c
@@ -197,6 +197,7 @@ static const struct forceinfo {
   const char *name;
   int *opt;
 } forceinfos[]= {
+  { "all",                 NULL                         },
   { "downgrade",           &fc_downgrade                },
   { "configure-any",       &fc_configureany             },
   { "hold",                &fc_hold                     },
@@ -472,15 +473,14 @@ static void setforce(const struct cmdinfo *cip, const 
char *value) {
     for (fip=forceinfos; fip->name; fip++)
       if (!strncmp(fip->name,value,l) && strlen(fip->name)==l) break;
     if (!fip->name) {
-      if (strncmp("all", value, l) == 0) {
+      badusage(_("unknown force/refuse option `%.*s'"),
+               (int)min(l, 250), value);
+    } else {
+      if (strcmp("all", fip->name) == 0) {
        for (fip=forceinfos; fip->name; fip++)
          if (fip->opt)
            *fip->opt= cip->arg;
-      } else
-       badusage(_("unknown force/refuse option `%.*s'"),
-                (int)min(l, 250), value);
-    } else {
-      if (fip->opt)
+      } else if (fip->opt)
        *fip->opt= cip->arg;
       else
        warning(_("obsolete force/refuse option '%s'\n"), fip->name);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to