/* * dselect - Debian package maintenance user interface * main.cc - main program * * Copyright © 1994,1995 Ian Jackson * Copyright © 2000,2001 Wichert Akkerman * * 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. */ #include #include #include #include #include #include #include #include #if HAVE_LOCALE_H #include #endif #include #include #include #include #include #include #include #if defined(HAVE_NCURSESW_TERM_H) #include #elif defined(HAVE_NCURSES_TERM_H) #include #else #include #endif #include #include #include #include #include "dselect.h" #include "bindings.h" #include "pkglist.h" const char thisname[]= DSELECT; const char printforhelp[]= N_("Type dselect --help for help."); modstatdb_rw readwrite; const char *admindir= ADMINDIR; FILE *debug; int expertmode= 0; static keybindings packagelistbindings(packagelist_kinterps,packagelist_korgbindings); struct table_t { const char *name; const int num; }; static const struct table_t colourtable[]= { {"black", COLOR_BLACK }, {"red", COLOR_RED }, {"green", COLOR_GREEN }, {"yellow", COLOR_YELLOW }, {"blue", COLOR_BLUE }, {"magenta", COLOR_MAGENTA }, {"cyan", COLOR_CYAN }, {"white", COLOR_WHITE }, {NULL, 0}, }; static const struct table_t attrtable[]= { {"normal", A_NORMAL }, {"standout", A_STANDOUT }, {"underline", A_UNDERLINE }, {"reverse", A_REVERSE }, {"blink", A_BLINK }, {"bright", A_BLINK }, // on some terminals {"dim", A_DIM }, {"bold", A_BOLD }, {NULL, 0}, }; /* A slightly confusing mapping from dselect's internal names to * the user-visible names.*/ static const struct table_t screenparttable[]= { {"list", list }, {"listsel", listsel }, {"title", title }, {"infohead", thisstate }, {"pkgstate", selstate }, {"pkgstatesel", selstatesel }, {"listhead", colheads }, {"query", query }, {"info", info }, {"infodesc", info_head }, {"infofoot", whatinfo }, {"helpscreen", helpscreen }, {NULL, 0}, }; /* Historical (patriotic?) colours. */ struct colordata color[]= { /* fore back attr */ {COLOR_WHITE, COLOR_BLACK, 0 }, // default, not used {COLOR_WHITE, COLOR_BLACK, 0 }, // list {COLOR_WHITE, COLOR_BLACK, A_REVERSE }, // listsel {COLOR_WHITE, COLOR_RED, 0 }, // title {COLOR_WHITE, COLOR_BLUE, 0 }, // thisstate {COLOR_WHITE, COLOR_BLACK, A_BOLD }, // selstate {COLOR_WHITE, COLOR_BLACK, A_REVERSE | A_BOLD }, // selstatesel {COLOR_WHITE, COLOR_BLUE, 0 }, // colheads {COLOR_WHITE, COLOR_RED, 0 }, // query {COLOR_WHITE, COLOR_BLACK, 0 }, // info {COLOR_WHITE, COLOR_BLACK, A_BOLD }, // info_head {COLOR_WHITE, COLOR_BLUE, 0 }, // whatinfo {COLOR_WHITE, COLOR_BLACK, 0 }, // help }; struct menuentry { const char *command; const char *key; const char *option; const char *menuent; urqfunction *fn; }; static const menuentry menuentries[]= { { "access", N_("a"), N_("[A]ccess"), N_("Choose the access method to use."), &urq_setup }, { "update", N_("u"), N_("[U]pdate"), N_("Update list of available packages, if possible."), &urq_update }, { "select", N_("s"), N_("[S]elect"), N_("Request which packages you want on your system."), &urq_list }, { "install", N_("i"), N_("[I]nstall"),N_("Install and upgrade wanted packages."), &urq_install }, { "config", N_("c"), N_("[C]onfig"), N_("Configure any packages that are unconfigured."), &urq_config }, { "remove", N_("r"), N_("[R]emove"), N_("Remove unwanted software."), &urq_remove }, { "quit", N_("q"), N_("[Q]uit"), N_("Quit dselect."), &urq_quit }, { 0, 0, N_("menu"), 0, &urq_menu }, { 0 } }; static const char programdesc[]= N_("Debian `%s' package handling frontend version %s.\n"); static const char copyrightstring[]= N_( "Copyright (C) 1994-1996 Ian Jackson.\n" "Copyright (C) 2000,2001 Wichert Akkerman.\n"); static const char licensestring[]= N_( "This is free software; see the GNU General Public License version 2 or\n" "later for copying conditions. There is NO warranty.\n" "See %s --license for copyright and license details.\n"); static void printversion(const struct cmdinfo *ci, const char *value) { printf(gettext(programdesc), DSELECT, DPKG_VERSION_ARCH); printf(gettext(copyrightstring)); printf(gettext(licensestring), DSELECT); m_output(stdout, _("")); exit(0); } static void usage(const struct cmdinfo *ci, const char *value) { int i; printf(_( "Usage: %s [