From aa1478bbd213582e61632d3399b1386c2dc5c293 Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Tue, 16 May 1995 01:30:20 +0000 Subject: [PATCH] Fix a problem where pkg_manage refused to allow the user to select a full directory hierarchy, as is the format of the new ports collection. It used the old "all packages in one directory" paradigm, which is wrong for ports now. Submitted by: Marc van Kempen --- usr.sbin/pkg_manage/pkg_install.hlp | 4 +- usr.sbin/pkg_manage/pkg_manage.c | 5 +- usr.sbin/pkg_manage/pkg_preview_fs.hlp | 2 +- usr.sbin/pkg_manage/pkg_ui.c | 66 +++++++++++++++++++++----- 4 files changed, 59 insertions(+), 18 deletions(-) diff --git a/usr.sbin/pkg_manage/pkg_install.hlp b/usr.sbin/pkg_manage/pkg_install.hlp index af030845f0ac..8a6ba385592e 100644 --- a/usr.sbin/pkg_manage/pkg_install.hlp +++ b/usr.sbin/pkg_manage/pkg_install.hlp @@ -16,6 +16,4 @@ button with 'TAB' or 'SHIFT-TAB' and press 'ENTER' to actually install them. Before installation a check will be made if a selected package is already installed. If so, - you will be given the choice to delete that package, or skip - the selected package. - + you will be informed of this and the package will be skipped. diff --git a/usr.sbin/pkg_manage/pkg_manage.c b/usr.sbin/pkg_manage/pkg_manage.c index 3a1a0b460a4c..f191a6e1c2a3 100644 --- a/usr.sbin/pkg_manage/pkg_manage.c +++ b/usr.sbin/pkg_manage/pkg_manage.c @@ -95,7 +95,7 @@ exec_catch_errors(char *prog, char *arg, char *fout) * if you don't want output. */ { - char *execstr, *tmp; + char *execstr, *tmp, msg[MAXPATHLEN]; int ret, yesno, unlink_fout; execstr = (char *) malloc( strlen(prog) + strlen(arg) + 30 ); @@ -126,7 +126,8 @@ exec_catch_errors(char *prog, char *arg, char *fout) /* disable helpline */ tmp = get_helpline(); use_helpline("use arrowkeys, PgUp, PgDn to move, press enter when done"); - dialog_textbox("Error output from pkg_add", fout, LINES-2, COLS-4); + sprintf(msg, "Error output from %s", prog); + dialog_textbox(msg, fout, LINES-2, COLS-4); restore_helpline(tmp); } } diff --git a/usr.sbin/pkg_manage/pkg_preview_fs.hlp b/usr.sbin/pkg_manage/pkg_preview_fs.hlp index 5a7e3fea9743..4777d28cc9d6 100644 --- a/usr.sbin/pkg_manage/pkg_preview_fs.hlp +++ b/usr.sbin/pkg_manage/pkg_preview_fs.hlp @@ -5,6 +5,6 @@ Use TAB and SHIFT-TAB to move from field to field. Selection: contains the name of the selected filename. Edit the field - directly of choose a filename from the "Files:" box. + directly or choose a filename from the "Files:" box. diff --git a/usr.sbin/pkg_manage/pkg_ui.c b/usr.sbin/pkg_manage/pkg_ui.c index b612aa546567..8ab6cf23c9b4 100644 --- a/usr.sbin/pkg_manage/pkg_ui.c +++ b/usr.sbin/pkg_manage/pkg_ui.c @@ -29,6 +29,19 @@ extern PKG_info p_inf; +/* + * Local prototypes + */ + +void install_pkgs_indir(void); + + + +/* + * Functions + */ + + void view_installed(void) /* @@ -157,13 +170,14 @@ preview_pkg(void) int err; use_helpfile(PREVIEW_FS_HLP); + use_helpline("Select package to preview"); fname = dialog_fselect(".", "*.tgz"); while (fname) { use_helpfile(PREVIEW_HLP); use_helpline("use PgUp and PgDn and arrow-keys to move through the text"); tmp_file = tempnam(NULL, "pkg."); if (!tmp_file) { - fprintf(stderr, "preview_pkg: Could not allocate space fore tmp_file"); + fprintf(stderr, "preview_pkg: Could not allocate space for tmp_file\n"); exit(-1); } sprintf(args, "-n %s", fname); @@ -176,6 +190,7 @@ preview_pkg(void) free(fname); free(tmp_file); use_helpfile(PREVIEW_FS_HLP); + use_helpline("Select package to preview"); fname = dialog_fselect(".", "*.tgz"); } if (fname) free(fname); @@ -187,11 +202,34 @@ preview_pkg(void) void install_batch(void) +/* + * Desc: Get the directory from which to list and install packages + */ +{ + int quit; + + use_helpfile(DS_INSTALL_HLP); + quit = FALSE; + while (!quit) { + use_helpline("Select directory where the pkg's reside"); + if (dialog_dselect(".", "*.tgz")) { + quit = TRUE; + } else { + install_pkgs_indir(); + } + } + + return; +} /* install_batch() */ + + +void +install_pkgs_indir(void) /* * Desc: install several packages. */ { - WINDOW *pkg_win, *w; + WINDOW *pkg_win, *w, *tmpwin; DirList *d = NULL; char **fnames, o_pkg[MAXPATHLEN], o_pkgi[MAXPATHLEN], **comment, **desc, **names, msg[512]; @@ -203,19 +241,19 @@ install_batch(void) long total_marked = 0, *sizes; char *tmp_file, tmp_dir[MAXPATHLEN]; - /* first go to the directory where the packages are installed, then - list all packages in that directory with a short description of + /* list all packages in the current directory with a short description of the package. Pressing enter should give more info about a specific package. */ - - use_helpfile(DS_INSTALL_HLP); - use_helpline("Select the directory where the pkg's reside"); - if (dialog_dselect()) { - /* cancel button was pressed */ - return; - } - use_helpline(NULL); + /* save current window */ + tmpwin = dupwin(newscr); + if (tmpwin == NULL) { + endwin(); + fprintf(stderr, "\ninstall_pkgs_indir: dupwin(newscr) failed\n"); + exit(1); + } + + use_helpline(NULL); pkg_win = newwin(LINES-4, COLS-12, 2, 5); if (pkg_win == NULL) { endwin(); @@ -510,6 +548,10 @@ install_batch(void) use_helpfile(NULL); use_helpline(NULL); delwin(pkg_win); + + touchwin(tmpwin); + wrefresh(tmpwin); + delwin(tmpwin); return; } /* install_batch() */