003 File Manager
Current Path:
/usr/src/contrib/dialog
usr
/
src
/
contrib
/
dialog
/
📁
..
📄
CHANGES
(108.53 KB)
📄
COPYING
(25.81 KB)
📄
README
(2.78 KB)
📄
VERSION
(20 B)
📄
aclocal.m4
(195.3 KB)
📄
argv.c
(3.54 KB)
📄
arrows.c
(6.8 KB)
📄
buildlist.c
(31.36 KB)
📄
buttons.c
(16.19 KB)
📄
calendar.c
(24.45 KB)
📄
checklist.c
(17.98 KB)
📄
columns.c
(4.17 KB)
📄
config.guess
(43.14 KB)
📄
config.hin
(75 B)
📄
config.sub
(34.92 KB)
📄
configure
(666.11 KB)
📄
configure.in
(7.57 KB)
📄
demo.pl
(11.44 KB)
📄
dialog-config.in
(4.31 KB)
📄
dialog.1
(60.51 KB)
📄
dialog.3
(124.54 KB)
📄
dialog.c
(52.45 KB)
📄
dialog.h
(37.7 KB)
📄
dialog.lsm
(1.1 KB)
📄
dialog.pl
(15.08 KB)
📄
dlg_colors.h
(6.87 KB)
📄
dlg_keys.c
(20.68 KB)
📄
dlg_keys.h
(5.23 KB)
📄
editbox.c
(16.81 KB)
📄
formbox.c
(23.3 KB)
📄
fselect.c
(22.06 KB)
📄
guage.c
(10.26 KB)
📄
headers-sh.in
(5.35 KB)
📄
headers.sh
(3.6 KB)
📄
help.c
(1.4 KB)
📄
inputbox.c
(7.04 KB)
📄
inputstr.c
(17.73 KB)
📄
install-sh
(6.96 KB)
📄
makefile.in
(10.07 KB)
📄
menubox.c
(20.26 KB)
📄
mixedform.c
(3.39 KB)
📄
mixedgauge.c
(9.6 KB)
📄
mouse.c
(3.5 KB)
📄
mousewget.c
(2.19 KB)
📄
msgbox.c
(4.99 KB)
📁
package
📄
pause.c
(6.53 KB)
📁
po
📄
prgbox.c
(2.73 KB)
📄
progressbox.c
(9.88 KB)
📄
rangebox.c
(10.54 KB)
📄
rc.c
(15 KB)
📄
rename.sh
(3.04 KB)
📁
samples
📄
tailbox.c
(9.53 KB)
📄
textbox.c
(24.86 KB)
📄
timebox.c
(10.27 KB)
📄
trace.c
(5.72 KB)
📄
treeview.c
(16.55 KB)
📄
ttysize.c
(2.28 KB)
📄
ui_getc.c
(14.03 KB)
📄
util.c
(64.44 KB)
📄
version.c
(1.01 KB)
📄
yesno.c
(4.28 KB)
Editing: msgbox.c
/* * $Id: msgbox.c,v 1.81 2018/06/21 23:29:59 tom Exp $ * * msgbox.c -- implements the message box and info box * * Copyright 2000-2012,2018 Thomas E. Dickey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License, version 2.1 * as published by the Free Software Foundation. * * This program 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to * Free Software Foundation, Inc. * 51 Franklin St., Fifth Floor * Boston, MA 02110, USA. * * An earlier version of this program lists as authors: * Savio Lam (lam836@cs.cuhk.hk) */ #include <dialog.h> #include <dlg_keys.h> /* * Display a message box. Program will pause and display an "OK" button * if the parameter 'pauseopt' is non-zero. */ int dialog_msgbox(const char *title, const char *cprompt, int height, int width, int pauseopt) { /* *INDENT-OFF* */ static DLG_KEYS_BINDING binding[] = { HELPKEY_BINDINGS, ENTERKEY_BINDINGS, SCROLLKEY_BINDINGS, TRAVERSE_BINDINGS, END_KEYS_BINDING }; /* *INDENT-ON* */ int x, y, last = 0, page; int button; int key = 0, fkey; int result = DLG_EXIT_UNKNOWN; WINDOW *dialog = 0; char *prompt; const char **buttons = dlg_ok_label(); int offset = 0; int check; bool show = TRUE; int min_width = (pauseopt == 1 ? 12 : 0); bool save_nocancel = dialog_vars.nocancel; #ifdef KEY_RESIZE int req_high; int req_wide; #endif DLG_TRACE(("# msgbox args:\n")); DLG_TRACE2S("title", title); DLG_TRACE2S("message", cprompt); DLG_TRACE2N("height", height); DLG_TRACE2N("width", width); DLG_TRACE2N("pauseopt", pauseopt); dialog_vars.nocancel = TRUE; button = dlg_default_button(); #ifdef KEY_RESIZE req_high = height; req_wide = width; restart: #endif dlg_button_layout(buttons, &min_width); prompt = dlg_strclone(cprompt); dlg_tab_correct_str(prompt); dlg_auto_size(title, prompt, &height, &width, (pauseopt == 1 ? 2 : 0), min_width); dlg_print_size(height, width); dlg_ctl_size(height, width); x = dlg_box_x_ordinate(width); y = dlg_box_y_ordinate(height); #ifdef KEY_RESIZE if (dialog != 0) dlg_move_window(dialog, height, width, y, x); else #endif { dialog = dlg_new_window(height, width, y, x); dlg_register_window(dialog, "msgbox", binding); dlg_register_buttons(dialog, "msgbox", buttons); } page = height - (1 + 3 * MARGIN); dlg_mouse_setbase(x, y); dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); dlg_draw_title(dialog, title); dlg_attrset(dialog, dialog_attr); if (pauseopt) { dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); mouse_mkbutton(height - 2, width / 2 - 4, 6, '\n'); dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); dlg_draw_helpline(dialog, FALSE); while (result == DLG_EXIT_UNKNOWN) { if (show) { last = dlg_print_scrolled(dialog, prompt, offset, page, width, pauseopt); dlg_trace_win(dialog); show = FALSE; } key = dlg_mouse_wgetch(dialog, &fkey); if (dlg_result_key(key, fkey, &result)) break; if (!fkey && (check = dlg_char_to_button(key, buttons)) >= 0) { result = dlg_ok_buttoncode(check); break; } if (fkey) { switch (key) { #ifdef KEY_RESIZE case KEY_RESIZE: dlg_will_resize(dialog); dlg_clear(); free(prompt); height = req_high; width = req_wide; show = TRUE; goto restart; #endif case DLGK_FIELD_NEXT: button = dlg_next_button(buttons, button); if (button < 0) button = 0; dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); break; case DLGK_FIELD_PREV: button = dlg_prev_button(buttons, button); if (button < 0) button = 0; dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); break; case DLGK_ENTER: result = dlg_ok_buttoncode(button); break; default: if (is_DLGK_MOUSE(key)) { result = dlg_ok_buttoncode(key - M_EVENT); if (result < 0) result = DLG_EXIT_OK; } else if (dlg_check_scrolled(key, last, page, &show, &offset) == 0) { } else { beep(); } break; } } else { beep(); } } } else { dlg_print_scrolled(dialog, prompt, offset, page, width, pauseopt); dlg_draw_helpline(dialog, FALSE); wrefresh(dialog); dlg_trace_win(dialog); result = DLG_EXIT_OK; } dlg_del_window(dialog); dlg_mouse_free_regions(); free(prompt); dialog_vars.nocancel = save_nocancel; return result; }
Upload File
Create Folder