The following commit has been merged in the master branch:
commit 127ffc452f3d438be51f368c33ce3983874029ec
Author: Guillem Jover <[email protected]>
Date:   Sat Nov 5 21:04:03 2011 +0100

    dselect: Use modstatdb_get_status() instead of a global variable

diff --git a/dselect/pkgcmds.cc b/dselect/pkgcmds.cc
index 9a259ce..cf5f733 100644
--- a/dselect/pkgcmds.cc
+++ b/dselect/pkgcmds.cc
@@ -100,7 +100,10 @@ void packagelist::setwant(pkginfo::pkgwant nwarg) {
   int index, top, bot;
   pkginfo::pkgwant nw;
 
-  if (!readwrite) { beep(); return; }
+  if (modstatdb_get_status() == msdbrw_readonly) {
+    beep();
+    return;
+  }
 
   if (recursive) {
     redrawitemsrange(cursorline,cursorline+1);
diff --git a/dselect/pkgdisplay.cc b/dselect/pkgdisplay.cc
index 67750b3..18e1af6 100644
--- a/dselect/pkgdisplay.cc
+++ b/dselect/pkgdisplay.cc
@@ -196,7 +196,8 @@ void packagelist::redrawtitle() {
     mywerase(titlewin);
     mvwaddnstr(titlewin,0,0,
                recursive ?  _("dselect - recursive package listing") :
-               !readwrite ? _("dselect - inspection of package states") :
+               modstatdb_get_status() == msdbrw_readonly ?
+                            _("dselect - inspection of package states") :
                             _("dselect - main package listing"),
                xmax);
     getyx(titlewin,y,x);
@@ -255,10 +256,15 @@ void packagelist::redrawtitle() {
         internerr("bad sort in redrawtitle");
       }
     }
-    const char *helpstring= readwrite ? (verbose ? _(" mark:+/=/- terse:v 
help:?")
-                                                 : _(" mark:+/=/- verbose:v 
help:?"))
-                                      : (verbose ? _(" terse:v help:?")
-                                                 : _(" verbose:v help:?"));
+    const char *helpstring;
+
+    if (modstatdb_get_status() == msdbrw_write)
+      helpstring = (verbose ? _(" mark:+/=/- terse:v help:?")
+                            : _(" mark:+/=/- verbose:v help:?"));
+    else
+      helpstring = (verbose ? _(" terse:v help:?")
+                            : _(" verbose:v help:?"));
+
     int l= strlen(helpstring);
     getyx(titlewin,y,x);
     if (xmax-l > 0) {
diff --git a/dselect/pkginfo.cc b/dselect/pkginfo.cc
index 09aba25..2d3840b 100644
--- a/dselect/pkginfo.cc
+++ b/dselect/pkginfo.cc
@@ -57,7 +57,7 @@ const struct helpmenuentry *packagelist::helpmenulist() {
       {  0                        }
     };
   return
-    !readwrite ? ro :
+    modstatdb_get_status() == msdbrw_readonly ? ro :
     !recursive ? rw :
                  recur;
 }
diff --git a/dselect/pkglist.cc b/dselect/pkglist.cc
index 4c2a966..809e367 100644
--- a/dselect/pkglist.cc
+++ b/dselect/pkglist.cc
@@ -396,7 +396,8 @@ packagelist::packagelist(keybindings *kb) : baselist(kb) {
     }
     // treat all unknown packages as already seen
     state->direct= state->original= (pkg->want == pkginfo::want_unknown ? 
pkginfo::want_purge : pkg->want);
-    if (readwrite && state->original == pkginfo::want_unknown) {
+    if (modstatdb_get_status() == msdbrw_write &&
+        state->original == pkginfo::want_unknown) {
       state->suggested=
         pkg->status == pkginfo::stat_installed ||
           pkg->priority <= pkginfo::pri_standard /* FIXME: configurable */
@@ -445,7 +446,7 @@ packagelist::packagelist(keybindings *kb, pkginfo 
**pkgltab) : baselist(kb) {
 
 void perpackagestate::free(int recursive) {
   if (pkg->set->name) {
-    if (readwrite) {
+    if (modstatdb_get_status() == msdbrw_write) {
       if (uprec) {
         assert(recursive);
         uprec->selected= selected;
@@ -594,7 +595,8 @@ pkginfo **packagelist::display() {
   pop_cleanup(ehflag_normaltidy); // unset the SIGWINCH handler
   enddisplay();
 
-  if (interp->qa == qa_quitnochecksave || !readwrite) {
+  if (interp->qa == qa_quitnochecksave ||
+      modstatdb_get_status() == msdbrw_readonly) {
     debug(dbg_general, "packagelist[%p]::display() done - quitNOcheck", this);
     return 0;
   }
diff --git a/dselect/pkglist.h b/dselect/pkglist.h
index 5c538e9..9ad2e49 100644
--- a/dselect/pkglist.h
+++ b/dselect/pkglist.h
@@ -229,6 +229,4 @@ extern const char statuschars[];
 extern const char eflagchars[];
 extern const char wantchars[];
 
-extern modstatdb_rw readwrite;
-
 #endif /* PKGLIST_H */

-- 
dpkg's main repository


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

Reply via email to