diff options
Diffstat (limited to 'dselect')
-rw-r--r-- | dselect/.cvsignore | 1 | ||||
-rw-r--r-- | dselect/Makefile.am | 74 | ||||
-rw-r--r-- | dselect/Makefile.in | 119 | ||||
-rw-r--r-- | dselect/basecmds.cc | 13 | ||||
-rw-r--r-- | dselect/baselist.cc | 8 | ||||
-rw-r--r-- | dselect/basetop.cc | 8 | ||||
-rw-r--r-- | dselect/bindings.cc | 8 | ||||
-rw-r--r-- | dselect/curkeys.cc | 8 | ||||
-rwxr-xr-x | dselect/debugmake | 3 | ||||
-rw-r--r-- | dselect/dselect.h | 2 | ||||
-rw-r--r-- | dselect/junk | 162 | ||||
-rw-r--r-- | dselect/kt.c | 30 | ||||
-rw-r--r-- | dselect/kt.cc | 30 | ||||
-rw-r--r-- | dselect/main.cc | 12 | ||||
-rw-r--r-- | dselect/methkeys.cc | 10 | ||||
-rw-r--r-- | dselect/methlist.cc | 8 | ||||
-rw-r--r-- | dselect/method.cc | 8 | ||||
-rw-r--r-- | dselect/methparse.cc | 21 | ||||
-rwxr-xr-x | dselect/mkcurkeys.pl | 11 | ||||
-rwxr-xr-x | dselect/mkhelpmsgs.pl | 2 | ||||
-rw-r--r-- | dselect/pkgcmds.cc | 8 | ||||
-rw-r--r-- | dselect/pkgdepcon.cc | 42 | ||||
-rw-r--r-- | dselect/pkgdisplay.cc | 8 | ||||
-rw-r--r-- | dselect/pkginfo.cc | 8 | ||||
-rw-r--r-- | dselect/pkgkeys.cc | 10 | ||||
-rw-r--r-- | dselect/pkglist.cc | 8 | ||||
-rw-r--r-- | dselect/pkgsublist.cc | 22 | ||||
-rw-r--r-- | dselect/pkgtop.cc | 8 | ||||
-rwxr-xr-x | dselect/rp | 2 |
29 files changed, 195 insertions, 459 deletions
diff --git a/dselect/.cvsignore b/dselect/.cvsignore new file mode 100644 index 000000000..70845e08e --- /dev/null +++ b/dselect/.cvsignore @@ -0,0 +1 @@ +Makefile.in diff --git a/dselect/Makefile.am b/dselect/Makefile.am new file mode 100644 index 000000000..3e49b477f --- /dev/null +++ b/dselect/Makefile.am @@ -0,0 +1,74 @@ +## Process this file with automake to produce a Makefile.in + +AUTOMAKE_OPTIONS = 1.1 foreign + +## Directory definitions + +localedir = $(datadir)/locale + +## Various options + +CFLAGS = @CFLAGS@ @CWARNS@ -g $(XCFLAGS) -DLOCALEDIR=\"$(localedir)\" +OPTCFLAGS = @CFLAGS@ @OPTCFLAGS@ @CWARNS@ -g $(XCFLAGS) -DLOCALEDIR=\"$(localedir)\" +LDFLAGS = @LDFLAGS@ $(XLDFLAGS) +LIBS = @INTLLIBS@ @LIBS@ $(XLIBS) + +CXXFLAGS = @CXXFLAGS@ @CWARNS@ -g $(XCXXFLAGS) -DLOCALEDIR=\"$(localedir)\" +OPTCXXFLAGS = @CXXFLAGS@ @OPTCFLAGS@ @CWARNS@ -g $(XCXXFLAGS) -DLOCALEDIR=\"$(localedir)\" + +DEFS = -I$(top_srcdir)/include -I$(top_srcdir) -I$(srcdir) \ + -I$(top_builddir) -I$(top_builddir)/include -I. \ + -I$(top_srcdir)/intl -I$(top_builddir)/intl @DEFS@ +## Automake variables + +bin_PROGRAMS = dselect +man_MANS = dselect.8 + +EXTRA_DIST = keyoverride mkcurkeys.pl mkhelpmsgs.pl helpmsgs.src \ + checkunimp.pl $(man_MANS) + +dselect_SOURCES = main.cc bindings.cc curkeys.cc helpmsgs.cc \ + basecmds.cc baselist.cc basetop.cc \ + pkgcmds.cc pkgdepcon.cc pkgdisplay.cc pkginfo.cc \ + pkgkeys.cc pkglist.cc pkgsublist.cc pkgtop.cc \ + methkeys.cc method.cc methparse.cc methlist.cc \ + dselect.h bindings.h pkglist.h method.h +dselect_LDADD = ../lib/libdpkg.la ../lib/myopt.o -lncurses + + +BUILT_SOURCES = curkeys.h helpmsgs.h helpmsgs.cc +CLEANFILES = curkeys.h.new helpmsgs.h.new helpmsgs.cc.new $(BUILT_SOURCES) + +DISTCLEANFILES = updates status available *.old +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in + +## Rules + +helpmsgs.h helpmsgs.cc: helpmsgs.src $(srcdir)/mkhelpmsgs.pl + perl $(srcdir)/mkhelpmsgs.pl $< + +curkeys.h: keyoverride $(srcdir)/mkcurkeys.pl + cursesfile=`echo '#include <curses.h>' | \ + $(CC) -E - | grep 'curses.h' | head -1 | \ + sed -e 's/^[^"]*"//; s/".*$$//'`; \ + if [ "$$cursesfile" == "" ]; then echo "can't find curses file"; exit 1; fi; \ + perl $(srcdir)/mkcurkeys.pl $< $$cursesfile > $@.new + mv $@.new $@ + +$(DEP_FILES): helpmsgs.h curkeys.h + +## Optimize for speed, not space, for most commonly used files + +pkgdepcon.o: pkgdepcon.cc + $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(OPTCXXFLAGS) -c $< + +pkgdisplay.o: pkgdisplay.cc + $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(OPTCXXFLAGS) -c $< + +curkeys.o: curkeys.cc + $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(OPTCXXFLAGS) -c $< + +dist-hook: + cp -p helpmsgs.h helpmsgs.cc curkeys.h $(distdir)/ + +## End of file. diff --git a/dselect/Makefile.in b/dselect/Makefile.in deleted file mode 100644 index 1ef6f9cd6..000000000 --- a/dselect/Makefile.in +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright (C) 1994 Ian Murdock <imurdock@debian.org> -# Copyright (C) 1994,1995 Ian Jackson <ijackson@nyx.cs.du.edu> -# -# This is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2, -# or (at your option) any later version. -# -# This is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with dpkg; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -srcdir = @srcdir@ -VPATH = @srcdir@ - -prefix = @prefix@ -exec_prefix = $(prefix) -bindir = $(exec_prefix)/bin -libdir = $(prefix)/lib -mandir = $(prefix)/man -man8dir = $(mandir)/man8 -man8 = 8 - -SRC = \ - main.cc bindings.cc curkeys.cc helpmsgs.cc \ - basecmds.cc baselist.cc basetop.cc \ - pkgcmds.cc pkgdepcon.cc pkgdisplay.cc pkginfo.cc pkgkeys.cc \ - pkglist.cc pkgsublist.cc pkgtop.cc \ - methkeys.cc method.cc methparse.cc methlist.cc - -OBJ = \ - main.o bindings.o curkeys.o helpmsgs.o \ - basecmds.o baselist.o basetop.o \ - pkgcmds.o pkgdepcon.o pkgdisplay.o pkginfo.o pkgkeys.o \ - pkglist.o pkgsublist.o pkgtop.o \ - methkeys.o method.o methparse.o methlist.o - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ - -CC = @CC@ -CPLUSPLUS = @CXX@ - -CFLAGS = @CFLAGS@ @CWARNS@ -g $(XCFLAGS) -OPTCFLAGS = @OPTCFLAGS@ -LDFLAGS = $(XLDFLAGS) - -EXTERNLIBS = -lncurses -LIBS = -L../lib -ldpkg $(EXTERNLIBS) $(XLIBS) -ALL_CFLAGS = -I../include -I.. @DEFS@ $(CFLAGS) -ALL_CFLAGS_OPT = $(ALL_CFLAGS) $(OPTCFLAGS) - -.SUFFIXES: .cc .o .c - -.cc.o: - $(CPLUSPLUS) $(ALL_CFLAGS) -c $< - -.c.o: - $(CC) $(ALL_CFLAGS) -c $< - -all: dselect - -dselect: $(OBJ) ../lib/libdpkg.a - $(CC) $(LDFLAGS) -o dselect $(OBJ) $(LIBS) - -# These next few files are very heavily used, and should be optimised -# for speed rather than space. (ALL_CFLAGS_OPT usually means -O3.) -pkgdepcon.o: pkgdepcon.cc - $(CPLUSPLUS) $(ALL_CFLAGS_OPT) -c $< - -pkgdisplay.o: pkgdisplay.cc - $(CPLUSPLUS) $(ALL_CFLAGS_OPT) -c $< - -curkeys.o: curkeys.cc curkeys.inc - $(CPLUSPLUS) $(ALL_CFLAGS) -c curkeys.cc - -helpmsgs.h helpmsgs.cc: helpmsgs.src mkhelpmsgs.pl - perl mkhelpmsgs.pl - -curkeys.inc: keyoverride mkcurkeys.pl - perl mkcurkeys.pl keyoverride \ - `echo '#include <ncurses/curses.h>' | \ - $(CC) -E - | grep ncurses | head -1 | \ - sed -e 's/^[^"]*"//; s/".*$$//'` > curkeys.inc.new - mv curkeys.inc.new curkeys.inc - -kt: kt.o - $(CC) $(LDFLAGS) -o kt kt.o $(LIBS) - -kt.o: kt.c curkeys.inc - -clean: - rm -f curkeys.inc curkeys.inc.new - rm -f helpmsgs.h helpmsgs.cc helpmsgs.h.new helpmsgs.cc.new - rm -f *.o core dselect kt - -distclean: clean - rm -f Makefile *.orig *~ *.~* ./#*# - rm -rf t updates status available *.old - -install: all - $(INSTALL_PROGRAM) -s dselect $(bindir)/dselect - -# $(INSTALL_DATA) dselect.8 $(man8dir)/dselect.$(man8) - -$(OBJ): dselect.h ../config.h ../include/dpkg.h ../include/dpkg-db.h -main.o: ../version.h ../include/myopt.h -method.o: method.h -pkgcmds.o pkgdepcon.o pkgdisplay.o pkgtop.o: pkglist.h -baselist.o bindings.o curkeys.o main.o: bindings.h method.h pkglist.h -methlist.o methkeys.o pkginfo.o pkgkeys.o: bindings.h method.h pkglist.h -pkglist.o pkgsublist.o methparse.o: bindings.h method.h pkglist.h -helpmsgs.o methlist.o pkginfo.o basecmds.o: helpmsgs.h helpmsgs.cc diff --git a/dselect/basecmds.cc b/dselect/basecmds.cc index 85d2d7f96..e113fbbe6 100644 --- a/dselect/basecmds.cc +++ b/dselect/basecmds.cc @@ -21,14 +21,14 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "helpmsgs.h" @@ -97,11 +97,12 @@ void baselist::kd_searchagain() { void baselist::kd_search() { werase(querywin); mvwaddstr(querywin,0,0, "Search for ? "); - echo(); + echo(); /* fixme: ncurses documentation or implementation */ /* fixme: make / RET do `search again' and / DEL to abort */ if (wgetnstr(querywin,searchstring,sizeof(searchstring)-1) == ERR) searchstring[0]= 0; - noecho(); + raise(SIGWINCH); /* fixme: ncurses and xterm arrow keys */ + noecho(); /* fixme: ncurses */ if (whatinfo_height) { touchwin(whatinfowin); refreshinfo(); } else if (info_height) { touchwin(infopad); refreshinfo(); } else if (thisstate_height) redrawthisstate(); diff --git a/dselect/baselist.cc b/dselect/baselist.cc index c3f97edfa..19a416653 100644 --- a/dselect/baselist.cc +++ b/dselect/baselist.cc @@ -21,15 +21,15 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> #include <ctype.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "bindings.h" diff --git a/dselect/basetop.cc b/dselect/basetop.cc index 54b792750..3493b4756 100644 --- a/dselect/basetop.cc +++ b/dselect/basetop.cc @@ -21,15 +21,15 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> #include <ctype.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" diff --git a/dselect/bindings.cc b/dselect/bindings.cc index 4fb545072..ce7c0b688 100644 --- a/dselect/bindings.cc +++ b/dselect/bindings.cc @@ -21,14 +21,14 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "bindings.h" diff --git a/dselect/curkeys.cc b/dselect/curkeys.cc index 532b2695d..f22c9b680 100644 --- a/dselect/curkeys.cc +++ b/dselect/curkeys.cc @@ -21,13 +21,13 @@ extern "C" { #include <ncurses/curses.h> -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "bindings.h" const keybindings::keyname keybindings::keynames[] = { -#include "curkeys.inc" +#include "curkeys.h" }; diff --git a/dselect/debugmake b/dselect/debugmake deleted file mode 100755 index 027029770..000000000 --- a/dselect/debugmake +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -set -x -make 'XCFLAGS=-g -O0' LDFLAGS=-g 'EXTERNLIBS= -lncurses_g -lefence' "$@" diff --git a/dselect/dselect.h b/dselect/dselect.h index 7978c8b3a..e11130917 100644 --- a/dselect/dselect.h +++ b/dselect/dselect.h @@ -25,6 +25,8 @@ #define TOTAL_LIST_WIDTH 180 #define MAX_DISPLAY_INFO 120 +#include <signal.h> + struct helpmenuentry { char key; const struct helpmessage *msg; diff --git a/dselect/junk b/dselect/junk deleted file mode 100644 index e2ae289d8..000000000 --- a/dselect/junk +++ /dev/null @@ -1,162 +0,0 @@ -const packagelist::infotype packagelist::helpinfos[]= { - { itr_nonrecursive, itd_mainwelcome }, - { itr_recursive, itd_recurwelcome }, - { 0, itd_keys }, - { 0, itd_explaindisplay }, - { 0, 0 } -}; - -int packagelist::itr_nonrecursive() { return !recursive; } - -void packagelist::itd_mainwelcome() { - whatinfovb("main welcome page"); - - varbuf vb; - vb("This is dselect's main package listing screen."); - if (!readwrite) vb(" (read-only access.)"); - vb("\n\n" - "Please press `"); - vb(bindings->find("help")); - vb("' repeatedly to show more help, including the list of " - "keystrokes and an explanation of the display; use `"); - vb(bindings->find("iscrollon")); - vb("' and `"); - vb(bindings->find("iscrollback")); - vb("' to scroll this help screen. Press `"); - vb(bindings->find("info")); - vb("' repeatedly to see more information about the highlighted package(s).\n" - "\n"); - if (readwrite) { - vb("Move the highlight and use `"); - vb(bindings->find("select")); - vb("' and `"); - vb(bindings->find("deselect")); - vb("' to select and deselect packages for " - "installation. Press `"); - vb(bindings->find("quit")); - vb("' to confirm your changes and quit, or `"); - vb(bindings->find("abortnocheck")); - vb("' to abort without making changes.\n" - "\n" - "Deselecting a package that is currently " - "installed will arrange for it to be deinstalled later. If you " - "select a package for purging its configuration files will be " - "deleted when the package is; usually they are kept.\n"); - } else { - vb("You do not have read/write access to the package administration " - "area, so you may only examine the state of packages.\n"); - } - wordwrapinfo(0,vb.string()); -} - -void packagelist::itd_explaindisplay() { - whatinfovb("explanation of the display"); - - varbuf vb; - vb("The top half of the screen shows a list of packages. For each " - "package its status (explained in more detail below), class, " - "section, name and a summary of its description is shown.\n" - "\n" - "In the middle of the screen is a status line containing a description " - "of the status of the currently highlighted package (or a description " - "of which packages are highlighted if this is more than one package).\n" - "\n" - "The bottom half of the screen is used to display more extended " - "information about the highlighed package(s), and for help displays " - "like this one.\n" - "\n" - "The four characters at the start of each package's entry in the list " - "show its status: Error, Installed, Old, Wanted.\n" - "\n" - "`Wanted' is whether it is currently " - "selected or not (ie, its desired state as currently being edited); " - "`Old', immediately to the left of that, gives the desired state before " - "this package list was entered, if different (or a space if not)." - "\n" - "`Installed' shows the package's current actual state on " - "the system; the `Error' column is used to mark packages for which " - "installation or removal errors have occurred.\n"); - wordwrapinfo(0,vb.string()); -} - -void packagelist::itd_recurwelcome() { - whatinfovb("recursive package listing welcome page"); - - varbuf vb; - vb("Some of the packages you have selected require or recommend " - "the installation of other packages you haven't selected, or " - "some of them conflict with packages you have selected.\n" - "Details of problems for each package are available by pressing `"); - vb(bindings->find("info")); - vb("'.\n" - "This sub-list of packages is to allow you to resolve these " - "dependencies and conflicts. You may accept my suggestions " - "about which related packages to select or deselect by pressing `"); - vb(bindings->find("quitcheck")); - vb("'.\n" - "\n" - "Alternatively, you can edit the setup I have suggested, or use `"); - vb(bindings->find("revertdirect")); - vb("' to reject my suggestions, before using `"); - vb(bindings->find("quitcheck")); - vb("'.\n" - "\n" - "For a list of the keys available, consult the keymap " - "help screen (available by pressing `"); - vb(bindings->find("help")); - vb("'); see the manual for detailed information.\n" - "\n" - "If you wish to replace a package on which many others depend with " - "a conflicting one you'll probably find it easier to try selecting " - "the new one rather than deselecting the old one first, as doing " - "the latter will cause me to suggest deselecting all that depend on it."); - wordwrapinfo(0,vb.string()); -} - -void methodlist::kd_info() { - showinghelp=0; - redrawinfo(); -} - -void methodlist::kd_help() { - if (showinghelp) ifhelpthenkeys= !ifhelpthenkeys; - showinghelp=1; - redrawinfo(); -} - -void methodlist::itd_welcome() { - whatinfovb("method selection welcome page"); - - varbuf vb; - vb("This is dselect's access method selection screen."); - vb("\n\n" - "Please press `"); - vb(bindings->find("help")); - vb("' to show more help; in particular, you should read the list of " - "keystrokes; use `"); - vb(bindings->find("iscrollon")); - vb("' and `"); - vb(bindings->find("iscrollback")); - vb("' to scroll this help screen. Press `"); - vb(bindings->find("info")); - vb("' to see more information about the highlighted method.\n" - "\n"); - vb("Move the highlight and use `"); - vb(bindings->find("select-and-quit")); - vb("' to select the highlighted method. Press `"); - vb(bindings->find("abort")); - vb("' to abort without changing the access method.\n" - "\n" - "When you have selected the access method you will " - "be prompted for the information it requires to do the " - "installation.\n"); - wordwrapinfo(0,vb.string()); -} - - if (showinghelp) - if (ifhelpthenkeys) - itd_keys(); - else - itd_welcome(); - else - diff --git a/dselect/kt.c b/dselect/kt.c deleted file mode 100644 index d322c68bf..000000000 --- a/dselect/kt.c +++ /dev/null @@ -1,30 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <assert.h> -#include <ncurses/curses.h> - -struct kd { int v; const char *n; } kds[]= { -#include "curkeys.inc" -}; - -int main(int argc, char **argv) { - int n=0, c, y,x; - struct kd *kdp; - - initscr(); cbreak(); noecho(); nonl(); - keypad(stdscr,TRUE); - getmaxyx(stdscr,y,x); - mvprintw(5,5,"q to quit; b to beep; (y%d x%d)",y,x); - - for (;;) { - refresh(); - c= getch(); if (c==ERR) { endwin(); perror("err"); exit(1); } - for (kdp=kds; kdp->v != -1 && kdp->v != c; kdp++); - n++; mvprintw(10 + (n%4),10,"n %10d keycode %4d %-10s F0 + %4d",n,c, - kdp->n ? kdp->n : "<none>", c-KEY_F0); - if (c == 'q') break; - if (c == 'b') beep(); - } - endwin(); - return 0; -} diff --git a/dselect/kt.cc b/dselect/kt.cc deleted file mode 100644 index d448a5878..000000000 --- a/dselect/kt.cc +++ /dev/null @@ -1,30 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <assert.h> -#include <ncurses/curses.h> - -struct kd { int v; const char *n; } kds[]= { -#include "curkeys.inc" -}; - -int main(int argc, char **argv) { - int n=0, c, y,x; - struct kd *kdp; - - initscr(); cbreak(); noecho(); nonl(); - keypad(stdscr,TRUE); - getmaxyx(stdscr,y,x); - mvprintw(5,5,"q to quit; b to beep; (y%d x%d)",y,x); - - for (;;) { - refresh(); - c= getch(); if (c==ERR) { endwin(); perror("err"); exit(1); } - for (kdp=kds; kdp->v != -1 && kdp->v != c; kdp++); - n++; mvprintw(10 + (n%4),10,"n %10d keycode %4d %-10s F0 + %4d",n,c, - kdp->n, c-KEY_F0); - if (c == 'q') break; - if (c == 'b') beep(); - } - endwin(); - return 0; -} diff --git a/dselect/main.cc b/dselect/main.cc index e15d1b561..dbad037b1 100644 --- a/dselect/main.cc +++ b/dselect/main.cc @@ -33,15 +33,15 @@ #include <ctype.h> #include <assert.h> -#include <ncurses.h> +#include <curses.h> #include <term.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" -#include "version.h" -#include "myopt.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> +#include <version.h> +#include <myopt.h> } #include "dselect.h" #include "bindings.h" diff --git a/dselect/methkeys.cc b/dselect/methkeys.cc index cf3bca9ac..a0587feab 100644 --- a/dselect/methkeys.cc +++ b/dselect/methkeys.cc @@ -21,14 +21,14 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "bindings.h" @@ -56,7 +56,7 @@ const keybindings::interpretation methodlist_kinterps[] = { { "redraw", methodlist::kd_redraw, 0, qa_noquit }, { "select-and-quit", methodlist::kd_quit, 0, qa_quitchecksave }, { "abort", methodlist::kd_abort, 0, qa_quitnochecksave }, - { 0, 0, qa_noquit } + { 0, 0, 0, qa_noquit } }; #define C(x) ((x)-'a'+1) diff --git a/dselect/methlist.cc b/dselect/methlist.cc index c81ce8e1c..f995189a7 100644 --- a/dselect/methlist.cc +++ b/dselect/methlist.cc @@ -21,14 +21,14 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "bindings.h" diff --git a/dselect/method.cc b/dselect/method.cc index 67939ebaa..a835d0a50 100644 --- a/dselect/method.cc +++ b/dselect/method.cc @@ -36,12 +36,12 @@ #include <fcntl.h> #include <sys/file.h> -#include <ncurses.h> +#include <curses.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "method.h" diff --git a/dselect/methparse.cc b/dselect/methparse.cc index ffa280ee5..4388415cc 100644 --- a/dselect/methparse.cc +++ b/dselect/methparse.cc @@ -33,12 +33,12 @@ #include <ctype.h> #include <assert.h> -#include <ncurses.h> +#include <curses.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "bindings.h" @@ -47,12 +47,13 @@ int noptions=0; struct option *options=0, *coption=0; struct method *methods=0; -static void badmethod(const char *pathname, const char *why) __NORETURN; -static void badmethod(const char *pathname, const char *why) { +static void badmethod(const char *pathname, const char *why) NONRETURNING; +static void badmethod(const char *pathname, const char *why) +{ ohshit("syntax error in method options file `%.250s' -- %s", pathname, why); } -static void eofmethod(const char *pathname, FILE *f, const char *why) __NORETURN; +static void eofmethod(const char *pathname, FILE *f, const char *why) NONRETURNING; static void eofmethod(const char *pathname, FILE *f, const char *why) { if (ferror(f)) ohshite("error reading options file `%.250s'",pathname); badmethod(pathname,why); @@ -98,6 +99,8 @@ void readmethods(const char *pathbase, option **optionspp, int *nread) { if (methodlen > IMETHODMAXLEN) ohshit("method `%.250s' has name that is too long (%d > %d characters)", dent->d_name, methodlen, IMETHODMAXLEN); + /* Check if there is a localized version of this method */ + strcpy(pathmeth, dent->d_name); strcpy(pathmeth+methodlen, "/"); pathinmeth= pathmeth+methodlen+1; @@ -195,12 +198,12 @@ void readmethods(const char *pathbase, option **optionspp, int *nread) { if (debug) fprintf(debug," readmethods(`%s',...) new option" " index=`%s' name=`%s' summary=`%.20s'" - " strlen(description=%s)=%d" + " strlen(description=%s)=%ld" " method name=`%s' path=`%s' pathinmeth=`%s'\n", pathbase, opt->index, opt->name, opt->summary, opt->description ? "`...'" : "null", - opt->description ? strlen(opt->description) : -1, + opt->description ? (long) strlen(opt->description) : -1, opt->meth->name, opt->meth->path, opt->meth->pathinmeth); for (optinsert= optionspp; *optinsert && strcmp(opt->index,(*optinsert)->index) > 0; diff --git a/dselect/mkcurkeys.pl b/dselect/mkcurkeys.pl index 192914297..045f8a155 100755 --- a/dselect/mkcurkeys.pl +++ b/dselect/mkcurkeys.pl @@ -19,13 +19,14 @@ # License along with this; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -@ARGV == 2 || die; +$#ARGV == 1 || die ("usage: mkcurkeys.pl <filename> <curses.h>"); open(OV,"<$ARGV[0]") || die $!; while (<OV>) { - m/^#/ && next; - m/\S/ || next; - m/^(\w+)\s+(\S.*\S)\s+$/ || die; + chomp; + /^#/ && next; # skip comments + /\S/ || next; # ignore blank lines + /^(\w+)\s+(\S.*\S)\s*$/ || die ("cannot parse line:\n$_\n"); $over{$1}= $2; $base{$1}= ''; } @@ -60,7 +61,7 @@ close(NCH); printf(<<'END') || die $!; /* * WARNING - THIS FILE IS GENERATED AUTOMATICALLY - DO NOT EDIT - * It is generated by mkcurkeys.pl from <ncurses/curses.h> + * It is generated by mkcurkeys.pl from <curses.h> * and keyoverride. If you want to override things try adding * them to keyoverride. */ diff --git a/dselect/mkhelpmsgs.pl b/dselect/mkhelpmsgs.pl index 878620fe7..d6eb3140c 100755 --- a/dselect/mkhelpmsgs.pl +++ b/dselect/mkhelpmsgs.pl @@ -2,7 +2,7 @@ $maxnlines= 22; -open(SRC,"helpmsgs.src") || die $!; +open(SRC,$ARGV[0]) || die $!; open(NC,">helpmsgs.cc.new") || die $!; open(NH,">helpmsgs.h.new") || die $!; diff --git a/dselect/pkgcmds.cc b/dselect/pkgcmds.cc index 7950bb9b9..a2e9d2915 100644 --- a/dselect/pkgcmds.cc +++ b/dselect/pkgcmds.cc @@ -21,14 +21,14 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "pkglist.h" diff --git a/dselect/pkgdepcon.cc b/dselect/pkgdepcon.cc index a6abb3094..9395b6626 100644 --- a/dselect/pkgdepcon.cc +++ b/dselect/pkgdepcon.cc @@ -21,13 +21,13 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "pkglist.h" @@ -86,7 +86,7 @@ int packagelist::resolvesuggest() { int index; for (index=0; index<nitems; index++) { if (!table[index]->pkg->name) continue; - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvesuggest() loop[%i] %s / %d\n", this, index, table[index]->pkg->name, changemade); dependency *depends; @@ -102,7 +102,7 @@ int packagelist::resolvesuggest() { if (depends->type != dep_provides) continue; changemade= checkdependers(depends->list->ed,changemade); } - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvesuggest() loop[%i] %s / -> %d\n", this, index, table[index]->pkg->name, changemade); } @@ -119,7 +119,7 @@ static int dep_update_best_to_change_stop(perpackagestate *& best, pkginfo *tryt // There's no point trying to select a pure virtual package. if (!trythis->clientdata) return 0; - if (depdebug) + if (depdebug && debug) fprintf(debug,"update_best_to_change(best=%s{%d}, test=%s{%d});\n", best ? best->pkg->name : "", best ? (int)best->spriority : -1, trythis->name, trythis->clientdata->spriority); @@ -150,7 +150,7 @@ static int dep_update_best_to_change_stop(perpackagestate *& best, pkginfo *tryt return 0; yes: - if (depdebug) fprintf(debug,"update_best_to_change(); yes\n"); + if (depdebug && debug) fprintf(debug,"update_best_to_change(); yes\n"); best=trythis->clientdata; return 0; } @@ -167,7 +167,7 @@ int packagelist::deselect_one_of(pkginfo *per, pkginfo *ped, dependency *display er= per->clientdata; // these can be changed by add ed= ped->clientdata; - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::deselect_one_of(): er %s{%d} ed %s{%d} [%p]\n", this, er->pkg->name, er->spriority, ed->pkg->name, ed->spriority, display); @@ -184,7 +184,7 @@ int packagelist::deselect_one_of(pkginfo *per, pkginfo *ped, dependency *display else best= ed; // ... failing that, the second - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::deselect_one_of(): best %s{%d}\n", this, best->pkg->name, best->spriority); @@ -203,7 +203,7 @@ int packagelist::resolvedepcon(dependency *depends) { deppossi *possi, *provider; int r, foundany; - if (depdebug) { + if (depdebug && debug) { fprintf(debug,"packagelist[%p]::resolvedepcon([%p] %s --%s-->", this,depends,depends->up->name,relatestrings[depends->type]); for (possi=depends->list; possi; possi=possi->next) @@ -237,7 +237,7 @@ int packagelist::resolvedepcon(dependency *depends) { for (possi= depends->list; possi && !deppossatisfied(possi,&fixbyupgrade); possi= possi->next); - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): depends found %s\n", this,depends, possi ? possi->ed->name : "[none]"); @@ -249,7 +249,7 @@ int packagelist::resolvedepcon(dependency *depends) { if (depends->type == dep_suggests) return r; if (fixbyupgrade) { - if (depdebug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): " + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): " "fixbyupgrade %s\n", this,depends,fixbyupgrade->pkg->name); best= fixbyupgrade; } else { @@ -270,12 +270,12 @@ int packagelist::resolvedepcon(dependency *depends) { if (!foundany) addunavailable(possi); } if (!best) { - if (depdebug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): " + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): " "mustdeselect nobest\n", this,depends); return r; } } - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): select best=%s{%d}\n", this,depends, best->pkg->name, best->spriority); if (best->spriority >= sp_selecting) return r; @@ -285,7 +285,7 @@ int packagelist::resolvedepcon(dependency *depends) { mustdeselect: best= depends->up->clientdata; - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): mustdeselect best=%s{%d}\n", this,depends, best->pkg->name, best->spriority); @@ -298,20 +298,20 @@ int packagelist::resolvedepcon(dependency *depends) { case dep_conflicts: - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): conflict\n", this,depends); if (would_like_to_install(depends->up->clientdata->selected,depends->up) == 0) return 0; - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): conflict installing 1\n", this,depends); if (!deppossatisfied(depends->list,0)) return 0; - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): conflict satisfied - ouch\n", this,depends); @@ -326,7 +326,7 @@ int packagelist::resolvedepcon(dependency *depends) { if (provider->up->up == depends->up) continue; // conflicts & provides same thing r= deselect_one_of(depends->up, provider->up->up, depends); if (r) return r; } - if (depdebug) + if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): no desel\n", this,depends); return 0; @@ -365,7 +365,7 @@ int packagelist::deppossatisfied(deppossi *possi, perpackagestate **fixbyupgrade return 0; } } - if (possi->verrel != deppossi::dvr_none) return 0; + if (possi->verrel != dvr_none) return 0; deppossi *provider; if (possi->ed->installed.valid) { for (provider= possi->ed->installed.depended; diff --git a/dselect/pkgdisplay.cc b/dselect/pkgdisplay.cc index 92c31a868..16a4ff286 100644 --- a/dselect/pkgdisplay.cc +++ b/dselect/pkgdisplay.cc @@ -21,14 +21,14 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "pkglist.h" diff --git a/dselect/pkginfo.cc b/dselect/pkginfo.cc index 718bc1fbb..3ed653657 100644 --- a/dselect/pkginfo.cc +++ b/dselect/pkginfo.cc @@ -21,14 +21,14 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <ctype.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "bindings.h" diff --git a/dselect/pkgkeys.cc b/dselect/pkgkeys.cc index 198b040b0..35c9dd617 100644 --- a/dselect/pkgkeys.cc +++ b/dselect/pkgkeys.cc @@ -21,14 +21,14 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "bindings.h" @@ -72,7 +72,7 @@ const keybindings::interpretation packagelist_kinterps[] = { { "revert", 0, packagelist::kd_revert_abort, qa_noquit }, { "revertsuggest", 0, packagelist::kd_revertsuggest, qa_noquit }, { "revertdirect", 0, packagelist::kd_revertdirect, qa_noquit }, - { 0, 0, qa_noquit } + { 0, 0, 0, qa_noquit } }; #define C(x) ((x)-'a'+1) diff --git a/dselect/pkglist.cc b/dselect/pkglist.cc index eabd60c33..cdc3a2b08 100644 --- a/dselect/pkglist.cc +++ b/dselect/pkglist.cc @@ -21,14 +21,14 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "bindings.h" diff --git a/dselect/pkgsublist.cc b/dselect/pkgsublist.cc index 75216f4e0..1c301f62f 100644 --- a/dselect/pkgsublist.cc +++ b/dselect/pkgsublist.cc @@ -21,14 +21,14 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "bindings.h" @@ -122,13 +122,13 @@ int packagelist::add(dependency *depends, showpriority displayimportance) { possi=possi->next, comma=(possi && possi->next ? ", " : " or ")) { info(comma); info(possi->ed->name); - if (possi->verrel != deppossi::dvr_none) { + if (possi->verrel != dvr_none) { switch (possi->verrel) { - case deppossi::dvr_earlierequal: info(" (<= "); break; - case deppossi::dvr_laterequal: info(" (>= "); break; - case deppossi::dvr_earlierstrict: info(" (<< "); break; - case deppossi::dvr_laterstrict: info(" (>> "); break; - case deppossi::dvr_exact: info(" (= "); break; + case dvr_earlierequal: info(" (<= "); break; + case dvr_laterequal: info(" (>= "); break; + case dvr_earlierstrict: info(" (<< "); break; + case dvr_laterstrict: info(" (>> "); break; + case dvr_exact: info(" (= "); break; default: internerr("unknown verrel"); } info(versiondescribe(&possi->version,vdew_never)); @@ -139,7 +139,7 @@ int packagelist::add(dependency *depends, showpriority displayimportance) { add(depends->up,info.string(),displayimportance); for (possi=depends->list; possi; possi=possi->next) { add(possi->ed,info.string(),displayimportance); - if (possi->verrel == deppossi::dvr_none && depends->type != dep_provides) { + if (possi->verrel == dvr_none && depends->type != dep_provides) { // providers aren't relevant if a version was specified, or // if we're looking at a provider relationship already deppossi *provider; diff --git a/dselect/pkgtop.cc b/dselect/pkgtop.cc index 00d642fc2..80577786d 100644 --- a/dselect/pkgtop.cc +++ b/dselect/pkgtop.cc @@ -21,15 +21,15 @@ #include <stdio.h> #include <string.h> -#include <ncurses.h> +#include <curses.h> #include <assert.h> #include <signal.h> #include <ctype.h> extern "C" { -#include "config.h" -#include "dpkg.h" -#include "dpkg-db.h" +#include <config.h> +#include <dpkg.h> +#include <dpkg-db.h> } #include "dselect.h" #include "pkglist.h" diff --git a/dselect/rp b/dselect/rp deleted file mode 100755 index 632348822..000000000 --- a/dselect/rp +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -while cat p; do echo ===================; done |