Index: usr.sbin/tzsetup/Makefile =================================================================== --- usr.sbin/tzsetup/Makefile (revision 216873) +++ usr.sbin/tzsetup/Makefile (working copy) @@ -3,11 +3,11 @@ PROG= tzsetup MAN= tzsetup.8 -CFLAGS+= -I${.CURDIR} +CFLAGS+= -I${.CURDIR}/../../gnu/lib/libodialog -I. WARNS?= 3 DPADD= ${LIBDIALOG} ${LIBNCURSES} -LDADD= -ldialog -lncurses +LDADD= -lodialog -lncurses .include Index: usr.sbin/sade/Makefile =================================================================== --- usr.sbin/sade/Makefile (revision 216873) +++ usr.sbin/sade/Makefile (working copy) @@ -19,9 +19,9 @@ .if ${MACHINE} == "pc98" CFLAGS+= -DPC98 .endif -CFLAGS+= -I${.CURDIR}/../../gnu/lib/libdialog -I. +CFLAGS+= -I${.CURDIR}/../../gnu/lib/libodialog -I. DPADD= ${LIBDIALOG} ${LIBNCURSES} ${LIBUTIL} ${LIBDISK} -LDADD= -ldialog -lncurses -lutil -ldisk +LDADD= -lodialog -lncurses -lutil -ldisk .include Index: usr.sbin/sysinstall/Makefile =================================================================== --- usr.sbin/sysinstall/Makefile (revision 216873) +++ usr.sbin/sysinstall/Makefile (working copy) @@ -18,12 +18,12 @@ .if ${MACHINE} == "pc98" CFLAGS+= -DPC98 .endif -CFLAGS+= -I${.CURDIR}/../../gnu/lib/libdialog -I. +CFLAGS+= -I${.CURDIR}/../../gnu/lib/libodialog -I. WARNS?= 2 DPADD= ${LIBDIALOG} ${LIBNCURSES} ${LIBUTIL} ${LIBDISK} ${LIBFTPIO} -LDADD= -ldialog -lncurses -lutil -ldisk -lftpio +LDADD= -lodialog -lncurses -lutil -ldisk -lftpio CLEANFILES= makedevs.c rtermcap CLEANFILES+= keymap.tmp keymap.h countries.tmp countries.h Index: gnu/usr.bin/dialog/dialog.c =================================================================== --- gnu/usr.bin/dialog/dialog.c (revision 216873) +++ gnu/usr.bin/dialog/dialog.c (working copy) @@ -1,394 +0,0 @@ -/* - * dialog - Display simple dialog boxes from shell scripts - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $FreeBSD$ - * - * - * HISTORY: - * - * 17/12/93 - Version 0.1 released. - * - * 19/12/93 - menu will now scroll if there are more items than can fit - * on the screen. - * - added 'checklist', a dialog box with a list of options that - * can be turned on or off. A list of options that are on is - * returned on exit. - * - * 20/12/93 - Version 0.15 released. - * - * 29/12/93 - Incorporated patch from Patrick J. Volkerding - * (volkerdi@mhd1.moorhead.msus.edu) that made these changes: - * - increased MAX_LEN to 2048 - * - added 'infobox', equivalent to a message box without pausing - * - added option '--clear' that will clear the screen - * - Explicit line breaking when printing prompt text can be - * invoked by real newline '\n' besides the string "\n" - * - an optional parameter '--title ' can be used to - * specify a title string for the dialog box - * - * 03/01/94 - added 'textbox', a dialog box for displaying text from a file. - * - Version 0.2 released. - * - * 04/01/94 - some fixes and improvements for 'textbox': - * - fixed a bug that will cause a segmentation violation when a - * line is longer than MAX_LEN characters. Lines will now be - * truncated if they are longer than MAX_LEN characters. - * - removed wrefresh() from print_line(). This will increase - * efficiency of print_page() which calls print_line(). - * - display current position in the form of percentage into file. - * - Version 0.21 released. - * - * 05/01/94 - some changes for faster screen update. - * - * 07/01/94 - much more flexible color settings. Can use all 16 colors - * (8 normal, 8 highlight) of the Linux console. - * - * 08/01/94 - added run-time configuration using configuration file. - * - * 09/01/94 - some minor bug fixes and cleanups for menubox, checklist and - * textbox. - * - * 11/01/94 - added a man page. - * - * 13/01/94 - some changes for easier porting to other Unix systems (tested - * on Ultrix, SunOS and HPUX) - * - Version 0.3 released. - * - * 08/06/94 - Patches by Stuart Herbert - S.Herbert@shef.ac.uk - * Fixed attr_clear and the textbox stuff to work with ncurses 1.8.5 - * Fixed the wordwrap routine - it'll actually wrap properly now - * Added a more 3D look to everything - having your own rc file could - * prove 'interesting' to say the least :-) - * Added radiolist option - * - Version 0.4 released. - * - * 09/28/98 - Patches by Anatoly A. Orehovsky - tolik@mpeks.tomsk.su - * Added ftree and tree options - * - */ - -#include - -#include -#include -#include -#include -#include - -void Usage(char *name); -void EndDialog(int cls); - -int main(int argc, char *argv[]) -{ - int offset = 0, clear_screen = 0, end_common_opts = 0, default_yesno = 1, retval; - unsigned char *title = NULL; - unsigned char result[MAX_LEN]; - char *hline = NULL, *hfile = NULL; - - if (argc < 2) - Usage(argv[0]); - else if (!strcmp(argv[1], "--create-rc")) { -#ifdef HAVE_NCURSES - if (argc != 3) - Usage(argv[0]); - dialog_create_rc(argv[2]); - return 0; -#else - fprintf(stderr, "\nThis option is currently unsupported on your system.\n"); - return -1; -#endif - } - - while (offset < argc-1 && !end_common_opts) { /* Common options */ - if (!strcmp(argv[offset+1], "--title")) { - if (argc-offset < 3 || title != NULL) /* No two "--title" please! */ - Usage(argv[0]); - else { - title = argv[offset+2]; - offset += 2; - } - } - else if (!strcmp(argv[offset+1], "--hline")) { - if (argc-offset < 3 || hline != NULL) /* No two "--hline" please! */ - Usage(argv[0]); - else { - hline = argv[offset+2]; - use_helpline(hline); - offset += 2; - } - } - else if (!strcmp(argv[offset+1], "--hfile")) { - if (argc-offset < 3 || hfile != NULL) /* No two "--hfile" please! */ - Usage(argv[0]); - else { - hfile = argv[offset+2]; - use_helpfile(hfile); - offset += 2; - } - } - else if (!strcmp(argv[offset+1], "--clear")) { - if (clear_screen) /* Hey, "--clear" can't appear twice! */ - Usage(argv[0]); - else if (argc == 2) { /* we only want to clear the screen */ - init_dialog(); - dialog_update(); /* init_dialog() will clear the screen for us */ - end_dialog(); - return 0; - } - else { - clear_screen = 1; - offset++; - } - } - else /* no more common options */ - end_common_opts = 1; - } - - if (argc-1 == offset) /* no more options */ - Usage(argv[0]); - - /* Box options */ - - if (!strcmp(argv[offset+1], "--yesno")) { - if (argc-offset != 5 && argc-offset != 6) - Usage(argv[0]); - if (argc-offset == 6) { - if (!strcmp(argv[offset+5], "yes")) - default_yesno = 1; - else if (!strcmp(argv[offset+5], "no")) - default_yesno = 0; - else - Usage(argv[0]); - } - init_dialog(); - if (default_yesno == 1) - retval = dialog_yesno(title, argv[offset+2], atoi(argv[offset+3]), - atoi(argv[offset+4])); - else - retval = dialog_noyes(title, argv[offset+2], atoi(argv[offset+3]), - atoi(argv[offset+4])); - - dialog_update(); - EndDialog(clear_screen); - return retval; - } - else if (!strcmp(argv[offset+1], "--msgbox")) { - if (argc-offset != 5) - Usage(argv[0]); - init_dialog(); - retval = dialog_msgbox(title, argv[offset+2], atoi(argv[offset+3]), - atoi(argv[offset+4]), 1); - - dialog_update(); - EndDialog(clear_screen); - return retval; - } - else if (!strcmp(argv[offset+1], "--prgbox")) { - if (argc-offset != 5) - Usage(argv[0]); - init_dialog(); - retval = dialog_prgbox(title, argv[offset+2], atoi(argv[offset+3]), - atoi(argv[offset+4]), TRUE, TRUE); - - dialog_update(); - EndDialog(clear_screen); - return WEXITSTATUS(retval); - } - else if (!strcmp(argv[offset+1], "--infobox")) { - if (argc-offset != 5) - Usage(argv[0]); - init_dialog(); - retval = dialog_msgbox(title, argv[offset+2], atoi(argv[offset+3]), - atoi(argv[offset+4]), 0); - - dialog_update(); - EndDialog(clear_screen); - return retval; - } - else if (!strcmp(argv[offset+1], "--textbox")) { - if (argc-offset != 5) - Usage(argv[0]); - init_dialog(); - retval = dialog_textbox(title, argv[offset+2], atoi(argv[offset+3]), - atoi(argv[offset+4])); - - dialog_update(); - EndDialog(clear_screen); - return retval; - } - else if (!strcmp(argv[offset+1], "--menu")) { - if (argc-offset < 8 || ((argc-offset) % 2)) - Usage(argv[0]); - init_dialog(); - retval = dialog_menu(title, argv[offset+2], atoi(argv[offset+3]), - atoi(argv[offset+4]), atoi(argv[offset+5]), - (argc-offset-6)/2, argv+offset + 6, result, - NULL, NULL); - dialog_update(); - if (retval == 0) - fputs(result, stderr); - EndDialog(clear_screen); - return retval; - } - else if (!strcmp(argv[offset+1], "--checklist")) { - if (argc-offset < 9 || ((argc-offset-6) % 3)) - Usage(argv[0]); - init_dialog(); - retval = dialog_checklist(title, argv[offset+2], atoi(argv[offset+3]), - atoi(argv[offset+4]), atoi(argv[offset+5]), - (argc-offset-6)/3, argv+offset + 6, result); - - dialog_update(); - if (retval == 0) { - unsigned char *s, *h; int first; - - h = result; - first = 1; - while ((s = strchr(h, '\n')) != NULL) { - *s++ = '\0'; - if (!first) - fputc(' ', stderr); - else - first = 0; - fprintf(stderr, "\"%s\"", h); - h = s; - } - } - EndDialog(clear_screen); - return retval; - } - else if (!strcmp(argv[offset+1], "--radiolist")) { - if (argc-offset < 9 || ((argc-offset-6) % 3)) - Usage(argv[0]); - init_dialog(); - retval = dialog_radiolist(title, argv[offset+2], atoi(argv[offset+3]), - atoi(argv[offset+4]), atoi(argv[offset+5]), - (argc-offset-6)/3, argv+offset + 6, result); - - dialog_update(); - if (retval == 0) - fputs(result, stderr); - EndDialog(clear_screen); - return retval; - } - else if (!strcmp(argv[offset+1], "--inputbox")) { - if (argc-offset != 5 && argc-offset != 6) - Usage(argv[0]); - if (argc-offset == 6) - strcpy(result, argv[offset+5]); - else - *result = '\0'; - init_dialog(); - retval = dialog_inputbox(title, argv[offset+2], atoi(argv[offset+3]), - atoi(argv[offset+4]), result); - - dialog_update(); - if (retval == 0) - fputs(result, stderr); - EndDialog(clear_screen); - return retval; - } -/* ftree and tree options */ - else if (!strcmp(argv[offset+1], "--ftree")) { - unsigned char *tresult; - if (argc-offset != 8) - Usage(argv[0]); - init_dialog(); - retval = dialog_ftree(argv[offset+2], *argv[offset+3], - title, argv[offset+4], atoi(argv[offset+5]), atoi(argv[offset+6]), - atoi(argv[offset+7]), &tresult); - - dialog_update(); - if (!retval) - { - fputs(tresult, stderr); - free(tresult); - } - EndDialog(clear_screen); - return retval; - } - else if (!strcmp(argv[offset+1], "--tree")) { - unsigned char *tresult; - if (argc-offset < 8) - Usage(argv[0]); - init_dialog(); - retval = dialog_tree((unsigned char **)argv+offset+7, argc-offset-7, - *argv[offset+2], title, argv[offset+3], atoi(argv[offset+4]), - atoi(argv[offset+5]), atoi(argv[offset+6]), &tresult); - - dialog_update(); - if (!retval) - fputs(tresult, stderr); - - EndDialog(clear_screen); - return retval; - } - - Usage(argv[0]); - - return 0; -} -/* End of main() */ - - -/* - * Print program usage - */ -void Usage(char *name) -{ - fprintf(stderr, "\ -\ndialog version 0.3, by Savio Lam (lam836@cs.cuhk.hk).\ -\n patched to version %s by Stuart Herbert (S.Herbert@shef.ac.uk)\ -\n Changes Copyright (C) 1995 by Andrey A. Chernov, Moscow, Russia\ -\n patched by Anatoly A. Orehovsky (tolik@mpeks.tomsk.su)\ -\n\ -\n* Display dialog boxes from shell scripts *\ -\n\ -\nUsage: %s --clear\ -\n %s --create-rc \ -\n %s [--title ] [--clear] [--hline <line>] [--hfile <file>]\\\ -\n <Box options>\ -\n\ -\nBox options:\ -\n\ -\n --yesno <text> <height> <width> [yes|no]\ -\n --msgbox <text> <height> <width>\ -\n --prgbox \"<command line>\" <height> <width>\ -\n --infobox <text> <height> <width>\ -\n --inputbox <text> <height> <width> [<init string>]\ -\n --textbox <file> <height> <width>\ -\n --menu <text> <height> <width> <menu height> <tag1> <item1>...\ -\n --checklist <text> <height> <width> <list height> <tag1> <item1> <status1>...\ -\n --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...\ -\n --ftree <file> <FS> <text> <height> <width> <menu height>\ -\n --tree <FS> <text> <height> <width> <menu height> <item1>...\n", VERSION, name, name, name); - exit(-1); -} -/* End of Usage() */ - -/* - * End dialog - */ -void EndDialog(int cls) -{ - if (cls) /* clear screen before exit */ - dialog_clear(); - end_dialog(); -} -/* End of Dialog() */ Index: gnu/usr.bin/dialog/TESTS/msgbox =================================================================== --- gnu/usr.bin/dialog/TESTS/msgbox (revision 216873) +++ gnu/usr.bin/dialog/TESTS/msgbox (working copy) @@ -1,14 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -$DIALOG --title "MESSAGE BOX" --clear \ - --msgbox "Hi, this is a simple message box. You can use this to\n\ -display any message you like. The box will remain until\n\ -you press the ENTER key." -1 -1 - -case $? in - 0) - echo "OK";; - 255) - echo "ESC pressed.";; -esac Index: gnu/usr.bin/dialog/TESTS/prgbox =================================================================== --- gnu/usr.bin/dialog/TESTS/prgbox (revision 216873) +++ gnu/usr.bin/dialog/TESTS/prgbox (working copy) @@ -1,12 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -$DIALOG --title "PROGRAM BOX: 'cal'" --clear \ - --prgbox "cal" 13 27 - -case $? in - 0) - echo "OK";; - *) - echo "Exit code:" $?;; -esac Index: gnu/usr.bin/dialog/TESTS/infobox =================================================================== --- gnu/usr.bin/dialog/TESTS/infobox (revision 216873) +++ gnu/usr.bin/dialog/TESTS/infobox (working copy) @@ -1,15 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -$DIALOG --title "INFO BOX" \ - --infobox "Hi, this is an information box. It is -different from a message box in that it will -not pause waiting for input after displaying -the message. The pause here is only introduced -by the sleep command, not by dialog. - -You have 10 seconds to read this..." -1 -1 - -stty -echo -sleep 10 -stty echo Index: gnu/usr.bin/dialog/TESTS/inputbox =================================================================== --- gnu/usr.bin/dialog/TESTS/inputbox (revision 216873) +++ gnu/usr.bin/dialog/TESTS/inputbox (working copy) @@ -1,28 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -$DIALOG --title "INPUT BOX" --clear \ - --inputbox "Hi, this is an input dialog box. You can use \n\ -this to ask questions that require the user \n\ -to input a string as the answer. You can \n\ -input strings of length longer than the \n\ -width of the input box, in that case, the \n\ -input field will be automatically scrolled. \n\ -You can use BACKSPACE, LEFT, RIGHT, HOME, END\n\ -to correct errors. \n\n\ -Try inputing your name below:" -1 -1 "John Smith" 2> /tmp/inputbox.tmp.$$ - -retval=$? - -input=`cat /tmp/inputbox.tmp.$$` -rm -f /tmp/inputbox.tmp.$$ - -case $retval in - 0) - echo "Input string is '$input'";; - 1) - echo "Cancel pressed.";; - 255) - [ -z "$input" ] || echo $input ; - echo "ESC pressed.";; -esac Index: gnu/usr.bin/dialog/TESTS/treebox =================================================================== --- gnu/usr.bin/dialog/TESTS/treebox (revision 216873) +++ gnu/usr.bin/dialog/TESTS/treebox (working copy) @@ -1,25 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -$DIALOG --clear --title "TREE BOX" \ - --hline "Press arrows, TAB or Enter" \ - --hfile "../COPYING" \ - --tree "/" \ - "This is tree box" -1 -1 10 \ - `find -x / -type d` 2>/tmp/tree.tmp.$$ - -retval=$? - -choice=`cat /tmp/tree.tmp.$$` - -case $retval in - 0) - echo "'$choice' chosen.";; - 1) - echo "Cancel pressed.";; - 255) - [ -z "$choice" ] || echo $choice ; - echo "ESC pressed.";; -esac - -rm -f /tmp/tree.tmp.$$ Index: gnu/usr.bin/dialog/TESTS/checklist =================================================================== --- gnu/usr.bin/dialog/TESTS/checklist (revision 216873) +++ gnu/usr.bin/dialog/TESTS/checklist (working copy) @@ -1,33 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -$DIALOG --title "CHECKLIST BOX" --clear \ - --checklist "Hi, this is a checklist box. You can use this to \n\ -present a list of choices which can be turned on or \n\ -off. If there are more items than can fit on the \n\ -screen, the list will be scrolled. You can use the \n\ -UP/DOWN arrow keys, the first letter of the choice as a\n\ -hot key, or the number keys 1-9 to choose an option. \n\ -Press SPACE to toggle an option on/off. \n\n\ - Which of the following are fruits?" -1 -1 5 \ - "Apple" "It's an apple." off \ - "Dog" "No, that's not my dog." ON \ - "Orange" "Yeah, that's juicy." off \ - "Cat" "No, never put a dog and a cat together!" oN \ - "Fish" "Cats like fish." On \ - "Lemon" "You know how it tastes." on 2> /tmp/checklist.tmp.$$ - -retval=$? - -choice=`cat /tmp/checklist.tmp.$$` -rm -f /tmp/checklist.tmp.$$ - -case $retval in - 0) - echo "'$choice' chosen.";; - 1) - echo "Cancel pressed.";; - 255) - [ -z "$choice" ] || echo $choice ; - echo "ESC pressed.";; -esac Index: gnu/usr.bin/dialog/TESTS/radiolist =================================================================== --- gnu/usr.bin/dialog/TESTS/radiolist (revision 216873) +++ gnu/usr.bin/dialog/TESTS/radiolist (working copy) @@ -1,33 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -$DIALOG --title "RADIOLIST BOX" --clear \ - --radiolist "Hi, this is a radiolist box. You can use this to \n\ -present a list of choices, one of them can be turned \n\ -on or off. If there are more items than can fit on the \n\ -screen, the list will be scrolled. You can use the \n\ -UP/DOWN arrow keys, the first letter of the choice as a\n\ -hot key, or the number keys 1-9 to choose an option. \n\ -Press SPACE to toggle an option on/off. \n\n\ - Which of the following are fruits?" -1 -1 5 \ - "Apple" "It's an apple." off \ - "Dog" "No, that's not my dog." ON \ - "Orange" "Yeah, that's juicy." off \ - "Cat" "No, never put a dog and a cat together!" oFF \ - "Fish" "Cats like fish." OFF \ - "Lemon" "You know how it tastes." oFF 2> /tmp/radiolist.tmp.$$ - -retval=$? - -choice=`cat /tmp/radiolist.tmp.$$` -rm -f /tmp/radiolist.tmp.$$ - -case $retval in - 0) - echo "'$choice' chosen.";; - 1) - echo "Cancel pressed.";; - 255) - [ -z "$choice" ] || echo $choice ; - echo "ESC pressed.";; -esac Index: gnu/usr.bin/dialog/TESTS/Makefile =================================================================== --- gnu/usr.bin/dialog/TESTS/Makefile (revision 216873) +++ gnu/usr.bin/dialog/TESTS/Makefile (working copy) @@ -1,8 +0,0 @@ -# $FreeBSD$ - -NO_OBJ= -FILES= README checklist ftreebox infobox inputbox menubox msgbox \ - prgbox radiolist textbox treebox yesno -FILESDIR= ${SHAREDIR}/examples/dialog - -.include <bsd.prog.mk> Index: gnu/usr.bin/dialog/TESTS/README =================================================================== --- gnu/usr.bin/dialog/TESTS/README (revision 216873) +++ gnu/usr.bin/dialog/TESTS/README (working copy) @@ -1,15 +0,0 @@ -These shell scripts demonstrate possibilities of the dialog(1) tool. - -checklist - checkbox list -ftreebox - file tree box -infobox - info box -inputbox - input box -menubox - menu -msgbox - message box -prgbox - program box -radiolist - radio button list -textbox - simple text box -treebox - tree box -yesno - yes/no dialog - -$FreeBSD$ Index: gnu/usr.bin/dialog/TESTS/menubox =================================================================== --- gnu/usr.bin/dialog/TESTS/menubox (revision 216873) +++ gnu/usr.bin/dialog/TESTS/menubox (working copy) @@ -1,35 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -$DIALOG --clear --title "MENU BOX" \ - --hline "Press 1-9, Up/Down, first letter or Enter" \ - --menu "Hi, this is a menu box. You can use this to \n\ -present a list of choices for the user to \n\ -choose. If there are more items than can fit \n\ -on the screen, the menu will be scrolled. \n\ -You can use the UP/DOWN arrow keys, the first \n\ -letter of the choice as a hot key, or the \n\ -number keys 1-9 to choose an option.\n\ -Try it now!\n\n\ - Choose the OS you like:" -1 -1 4 \ - "FreeBSD" "A Real Operating System for Real Users" \ - "Linux" "Another free Unix Clone for 386/486" \ - "OS/2" "IBM OS/2" \ - "WIN NT" "Microsoft Windows NT" \ - "PCDOS" "IBM PC DOS" \ - "MSDOS" "Microsoft DOS" 2> /tmp/menu.tmp.$$ - -retval=$? - -choice=`cat /tmp/menu.tmp.$$` -rm -f /tmp/menu.tmp.$$ - -case $retval in - 0) - echo "'$choice' chosen.";; - 1) - echo "Cancel pressed.";; - 255) - [ -z "$choice" ] || echo $choice ; - echo "ESC pressed.";; -esac Index: gnu/usr.bin/dialog/TESTS/textbox =================================================================== --- gnu/usr.bin/dialog/TESTS/textbox (revision 216873) +++ gnu/usr.bin/dialog/TESTS/textbox (working copy) @@ -1,42 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -cat << EOF > /tmp/textbox.tmp.$$ -Hi, this is a text dialog box. It can be used to display text from a file. -The file should not contain any 'tab' characters, so you should 'expand' -the file first if it contains 'tab' characters. - -It's like a simple text file viewer, with these keys implemented: - -PGDN/SPACE - Move down one page -PGUP/'b' - Move up one page -DOWN/'j' - Move down one line -UP/'k' - Move up one line -LEFT/'h' - Scroll left -RIGHT/'l' - Scroll right -'0' - Move to beginning of line -HOME/'g' - Move to beginning of file -END/'G' - Move to end of file -'/' - Forward search -'?' - Backward search -'n' - Repeat last search (forward) -'N' - Repeat last search (backward) - - -The following is a sample text file: - - -EOF - -cat ../COPYING | expand >> /tmp/textbox.tmp.$$ - -$DIALOG --clear --title "TEXT BOX" --textbox "/tmp/textbox.tmp.$$" 22 77 - -case $? in - 0) - echo "OK";; - 255) - echo "EXIT choosed.";; -esac - -rm -f /tmp/textbox.tmp.$$ Index: gnu/usr.bin/dialog/TESTS/yesno =================================================================== --- gnu/usr.bin/dialog/TESTS/yesno (revision 216873) +++ gnu/usr.bin/dialog/TESTS/yesno (working copy) @@ -1,23 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -$DIALOG --title "YES/NO BOX" --clear \ - --hline "Press F1 or ? to see GNU GPL" \ - --hfile ../COPYING \ - --yesno "Hi, this is a yes/no dialog box. You can use this to ask \ - questions that have an answer of either yes or no. \ - BTW, do you notice that long lines will be automatically \ - wrapped around so that they can fit in the box? You can \ - also control line breaking explicitly by inserting \ - 'backslash n' at any place you like, but in this case, \ - auto wrap around will be disabled and you will have to \ - control line breaking yourself." 15 61 - -case $? in - 0) - echo "Yes chosen.";; - 1) - echo "No chosen.";; - 255) - echo "ESC pressed.";; -esac Index: gnu/usr.bin/dialog/TESTS/ftreebox =================================================================== --- gnu/usr.bin/dialog/TESTS/ftreebox (revision 216873) +++ gnu/usr.bin/dialog/TESTS/ftreebox (working copy) @@ -1,27 +0,0 @@ -#!/bin/sh -DIALOG=${DIALOG=/usr/bin/dialog} - -find -xd / -type d > /tmp/ftreebox.tmp.$$ - -$DIALOG --clear --title "FTREE BOX" \ - --hline "Press arrows, TAB or Enter" \ - --hfile "../COPYING" \ - --ftree "/tmp/ftreebox.tmp.$$" "/" \ - "This is ftree box" \ - -1 -1 10 2>/tmp/ftree.tmp.$$ - -retval=$? - -choice=`cat /tmp/ftree.tmp.$$` - -case $retval in - 0) - echo "'$choice' chosen.";; - 1) - echo "Cancel pressed.";; - 255) - [ -z "$choice" ] || echo $choice ; - echo "ESC pressed.";; -esac - -rm -f /tmp/ftreebox.tmp.$$ /tmp/ftree.tmp.$$ Index: gnu/usr.bin/dialog/README.lib =================================================================== --- gnu/usr.bin/dialog/README.lib (revision 216873) +++ gnu/usr.bin/dialog/README.lib (working copy) @@ -1,3 +0,0 @@ -Now 'dialog' splitted to this sources and library of functions, -see /usr/src/gnu/lib/libdialog for details. - Ache. Index: gnu/usr.bin/dialog/COPYING =================================================================== --- gnu/usr.bin/dialog/COPYING (revision 216873) +++ gnu/usr.bin/dialog/COPYING (working copy) @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program 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 of the License, or - (at your option) any later version. - - 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. Index: gnu/usr.bin/dialog/Makefile =================================================================== --- gnu/usr.bin/dialog/Makefile (revision 216873) +++ gnu/usr.bin/dialog/Makefile (working copy) @@ -1,17 +1,13 @@ -# Makefile for dialog # $FreeBSD$ -.include <bsd.own.mk> - -.if ${MK_EXAMPLES} != "no" -SUBDIR= TESTS -.endif - +DIALOG= ${.CURDIR}/../../../contrib/dialog PROG= dialog -CFLAGS+= -Wall -Wstrict-prototypes - DPADD= $(LIBDIALOG) $(LIBNCURSES) -LDADD= -ldialog -lncurses +LDADD= -ldialog -lncursesw +CFLAGS+= -I${.CURDIR} -I${DIALOG} +.PATH: ${DIALOG} +WARNS?= 3 + .include <bsd.prog.mk> Index: gnu/usr.bin/dialog/README =================================================================== --- gnu/usr.bin/dialog/README (revision 216873) +++ gnu/usr.bin/dialog/README (working copy) @@ -1,161 +0,0 @@ - - dialog - Display dialog boxes in shell script (version 0.3) - =========================================================== - -This is a program that will enable you to present a variety of questions or -display messages using dialog boxes from a shell script. Currently, these -types of dialog boxes are implemented: yes/no box, menu box, input box, -message box, text box, info box, checklist box. The idea of writing this -program came from the fact that most questions asked in a shell script (and -many interactive programs as well) can be classified into these few types: - - - 1) One that requires the user to answer either yes or no. - - 2) One that presents a number of options for the user to choose. - - 3) One that requires the user to input a string. - - 4) One that displays a message and optionally wait for a key press - before continuing. - - 5) One that presents a list of options that can be turned on or off. - - -The program 'dialog' can, say for example, be called in a shell script to -present the first type of questions like this: - - - if dialog --yesno <question text> <height> <width> - then - ... - fi - - - e.g. if dialog --yesno "Do you want to continue?" 7 51 - then - echo "Continuing..." - else - echo "Aborting..." - fi - - -I've included a sample shell script for each type of boxes in the directory -samples. The program requires ncurses to compile. Running 'dialog' without -arguments will display the usage. - - - -FEATURES --------- - - * Friendly dialog box interface with buttons, etc. - - * Auto wrap around of question text if it's too long to fit on - one line. - - * "\n" can be inserted in question text to control line breaking - explicitly. The real newline character '\n' can also be used. - - * run-time configruation of color settings and other options using - a configuration file. - - - -WHAT'S NEW SINCE VERSION 0.21? ------------------------------- - - * some changes for faster screen update. - - * much more flexible color settings. Can use all 16 colors - (8 normal, 8 highlight) of the Linux console. - - * added run-time configuration using configuration file. - - * some minor bug fixes and cleanups for menubox, checklist and - textbox. - - * added a man page. - - * some changes for easier porting to other Unix systems (tested - on Ultrix, SunOS and HPUX) - - - -INSTALLATION ------------- - - 1. cd ./src - - 2. Go to step 3 if your system has ncurses (e.g. Linux). - Edit Makefile and remove -DHAVE_NCURSES from DEFS. Also - remove rc.c from SRCS and rc.o from OBJS. Change LIBS as - appropriate (Usually, it should be '-lcurses -ltermcap'). - Go to step 6. - - 3. Edit Makefile and remove -DBROKEN_WSCRL from DEFS if you - are using ncurses 1.8.3 or newer. Menu scrolling should - be faster. DON'T REMOVE IT IF YOU ARE NOT USING AT LEAST - VERSION 1.8.3 OF NCURSES. - - 4. Edit dialog.h and change USE_SHADOW to FALSE if you don't - want shadowed dialog boxes. Also change USE_COLORS to - FALSE if you don't want colors. Note that 'dialog' will - check if the terminal supports colors, and will use mono - settings if it doesn't, so USE_COLORS won't do any harm - even if you have a mono display. Also note that USE_SHADOW - implies USE_COLORS. These two options can be changed at - run-time using the run-time configuration file (see below). - - 5. Edit colors.h to change default color definitions if you - don't like the defaults. These are only compiled in defaults, - you can change them at run-time using the run-time - configuration file. - - 6. 'make depend; make install' will compile and install the - binaries in /usr/local/bin (change BINDIR in Makefile if - you want to install elsewhere). - - 7. 'make install.man' will install the man page to - /usr/local/man (change MANDIR in Makefile if you want to - install elsewhere). - - 8. You can then try the sample shell scripts in the samples - directory (make sure the environment variable DIALOG is - not set, the scripts use it to find the dialog binary, if - it's not set, "../src/dialog" will be used). - - 9. Don't forget to mail me (mail address at end of this file) - if you find any bugs, have some good color settings to - contribute or just want to tell me that you like it, Don't - mail me if you don't like it :-) - - - -RUN-TIME CONFIGURATION ----------------------- - - 1. Create a sample configuration file by typing: - - "dialog --create-rc <file>" - - 2. At start, 'dialog' determines the settings to use as follows: - - a) if environment variable DIALOGRC is set, it's value - determines the name of the configuration file. - - b) if the file in (a) can't be found, use the file - $HOME/.dialogrc as the configuration file. - - c) if the file in (b) can't be found, use compiled in - defaults. - - 3. Edit the sample configuration file and copy it to some place - that 'dialog' can find, as stated in step 2 above. - - - - -Comments and bug reports welcome. - -- Savio Lam (lam836@cs.cuhk.hk) Index: gnu/usr.bin/dialog/dialog.1 =================================================================== --- gnu/usr.bin/dialog/dialog.1 (revision 216873) +++ gnu/usr.bin/dialog/dialog.1 (working copy) @@ -1,326 +0,0 @@ -.\" $FreeBSD$ -.TH DIALOG 1 "2 October 1998" -.SH NAME -dialog \- display dialog boxes from shell scripts -.SH SYNOPSIS -.B dialog --clear -.br -.BI "dialog --create-rc " file -.br -.B dialog -[ -.BI "\-\-title " title -] -[ -.B \-\-clear -] -[ -.BI "\-\-hline " line -] -[ -.BI "\-\-hfile " file -] -.B box-options -.SH DESCRIPTION -.B Dialog -is a program which allows you to present a variety of questions or -display messages in dialog box form from a shell script. The following -types of dialog objects are currently supported: -.LP -.BR yes/no " box," " menu" " box," " input" " box," -.BR message " box," " text" " box," " info" " box," -.BR checklist " box," " program" " box," -.BR radiolist " box," -.BR ftree " and " tree " boxes." -.SH OPTIONS -.TP -.B \-\-clear -The screen will be cleared to the -.BR "screen attribute" " on exit." -.TP -.BI \-\-create-rc " file" -.RB "Since " dialog " supports run-time configuration," -this can be used to dump a sample configuration file to the file specified -by -.IR file "." -.TP -.BI \-\-title " title" -Specifies a -.I title -string to be displayed at the top of the dialog box. -.TP -.BI \-\-hline " line" -Specifies a -.I line -string to be displayed at the bottom of the dialog box. -.TP -.BI \-\-hfile " file" -Specifies a -.I file -to be displayed by pressing ? or F1. -.TP -.B Box Options -.TP -.BI \-\-yesno " text height width \fR[ \fByes \fR| \fBno \fR]" -.RB A " yes/no" " dialog box of size" -.I height -rows by -.I width -columns will be displayed. The string specified by -.I text -is displayed inside the dialog box. If this string is too long to fit -in one line, it will be automatically divided into multiple lines at -the appropriate points. The -.I text -string may also contain the sub-string -.I -"\en" -or newline characters -.I `\en\' -to control line breaking explicitly. This dialog box is useful for -asking questions that require the user to answer either yes or no. -.RB "The dialog box has a" " Yes" " button and a " No -button, in which the user can switch between by pressing the -.IR TAB " key." -.RB A " Yes" " button is selected by default unless" " no" -is specified. -.TP -.BI \-\-msgbox " text height width" -.RB A " message" " box is very similar to a" " yes/no" " box." -The only difference between a -.B message -box and a -.B yes/no -box is that a -.B message -box has only a single -.B OK -button. You can use this dialog box to display any message you like. -After reading the message, the user can press the -.I ENTER -key so that -.B dialog -will exit and the calling shell script can continue its operation. -.TP -.BI \-\-infobox " text height width" -.RB An " info" " box is basically a" " message" " box." -However, in this case, -.B dialog -will exit immediately after displaying the message to the user. The -screen is not cleared when -.B dialog -exits, so that the message will remain on the screen until the calling -shell script clears it later. This is useful when you want to inform -the user that some operations are carrying on that may require some -time to finish. -.TP -.BI \-\-inputbox " text height width" -.RB "An " input " box is useful when you want to ask questions that" -require the user to input a string as the answer. When inputing the -string, the -.I BACKSPACE -key can be used to correct typing errors. If the input string is longer than -can be fitted in the dialog box, the input field will be scrolled. On exit, -the input string will be printed on -.IR stderr "." -.TP -.BI \-\-textbox " file height width" -.RB A " text" " box lets you display the contents of a text file in a" -dialog box. It is like a simple text file viewer. The user can move -through the file by using the -.IR UP/DOWN ", " PGUP/PGDN -.RI and " HOME/END" " keys available on most keyboards." -If the lines are too long to be displayed in the box, the -.I LEFT/RIGHT -keys can be used to scroll the text region horizontally. For more -convenience, forward and backward searching functions are also provided. -.IP "\fB\-\-menu \fItext height width menu-height \fR[ \fItag item \fR] \fI..." -As its name suggests, a -.B menu -box is a dialog box that can be used to present a list of choices in -the form of a menu for the user to choose. Each menu entry consists of a -.IR tag " string and an " item " string. The" -.I tag -gives the entry a name to distinguish it from the other entries in the -menu. The -.I item -is a short description of the option that the entry represents. The -user can move between the menu entries by pressing the -.I UP/DOWN -keys, the first letter of the -.I tag -as a hot-key, or the number keys -.IR 1-9 ". There are" -.I menu-height -entries displayed in the menu at one time, but the menu will be -scrolled if there are more entries than that. When -.B dialog -exits, the -.I tag -of the chosen menu entry will be printed on -.IR stderr "." -.TP -.BI \-\-prgbox " command height width" -.RB A " program" " box lets you display output of command in" -dialog box. -.IP "\fB\-\-checklist \fItext height width list-height \fR[ \fItag item status \fR] \fI..." -.RB "A " checklist " box is similar to a " menu " box in that there are" -multiple entries presented in the form of a menu. Instead of choosing -one entry among the entries, each entry can be turned on or off by the -user. The initial on/off state of each entry is specified by -.IR status "." -On exit, a list of the -.I tag -strings of those entries that are turned on will be printed on -.IR stderr "." -.IP "\fB\-\-radiolist \fItext height width list-height \fR[ \fItag item status \fR] \fI..." -.RB "A " radiolist " box is similar to a " checklist " but it only allows" -a single entry to be selected. One entry may initially be turned on as -specified by -.IR status "." -On exit, the -.I tag -string of the entry that is turned on will be printed on -.IR stderr "." -.IP "\fB\-\-ftree \fIfile FS text height width menu-height" -.B ftree -box is a dialog box showing the tree described by the data from the file -.IR file "." -The data in the file should look like find(1) output. For the -find output, the field separator -.I FS -will be -.IR \'/\' ". If" -.IR height " and" -.IR width " are" -positive numbers, they set the absolute size of the whole -.BR ftree " box. If" -.IR height " and" -.IR width " are negative numbers, the size of the" -.B ftree -box will be -selected automatically. -.I menu-height -sets the height of the tree subwindow inside the -.B ftree -box and must be set. -.I text -is shown inside the -.B ftree -box above the tree subwindow and can contain newline characters -.I '\en\' -to split lines. One can navigate in the tree by pressing -.IR UP/DOWN " or " \'+\'/\'-\' ", " PG_UP/PG_DOWN " or " \'b\'/SPACE -.RI "and " HOME/END " or " \'g\'/\'G\' "." -A leaf of the tree is selected by pressing -.IR TAB " or " LEFT/RIGHT -the -.B OK -button and pressing -.IR ENTER "." -The selected leaf (to be more -exact, the full path to it from the root of the tree) is printed to -.IR stderr "." -If -.B Cancel -and then -.I ENTER -is pressed, nothing is printed to -.IR stderr "." -.I file -may contain data like find(1) -output, as well as like the output of find(1) with -.I -d -option. Some of the transient paths to the leaves of the tree may be -absent. Such data is corrected when fed from file. -.IP "\fB\-\-tree \fIFS text height width menu-height \fR[ \fIitem \fR] \fI..." -.B tree -box is like -.B ftree -box with some exceptions. First, the data is not -entered from a file, but from the command line as -.I item item ... -Second, the data thus entered is not corrected in any way. -Thus, the data like the output of find(1) with -.I -d -option will look incorrectly. -.SH "RUN-TIME CONFIGURATION" -.TP 4 -1. -Create a sample configuration file by typing: -.LP -.in +1i -"dialog --create-rc <file>" -.TP 4 -2. -At start, -.B dialog -determines the settings to use as follows: -.RS -.TP 4 -a) -if environment variable -.B DIALOGRC -is set, its value determines the name of the configuration file. -.TP 4 -b) -if the file in (a) can't be found, use the file -.I $HOME/.dialogrc -as the configuration file. -.TP 4 -c) -if the file in (b) can't be found, use compiled in defaults. -.RE -.TP 4 -3. -Edit the sample configuration file and copy it to some place that -.B dialog -can find, as stated in step 2 above. -.SH ENVIRONMENT -.TP 15 -.B DIALOGRC -Define this variable if you want to specify the name of the configuration file -to use. -.SH FILES -.TP 20 -.I $HOME/.dialogrc -default configuration file -.SH DIAGNOSTICS -Exit status is 0 if -.BR dialog " is exited by pressing the " Yes " or " OK -button, and 1 if the -.BR No " or " Cancel -button is pressed. Otherwise, if errors occur inside -.B dialog -or -.B dialog -is exited by pressing the -.I ESC -key, the exit status is -1. -.SH SEE ALSO -dialog(3) -.SH BUGS -Text files containing -.I tab -characters may cause problems with -.B text -box. -.I Tab -characters in text files must first be expanded to spaces before being -.RB "displayed by " text " box." -.sp 1 -Screen update is too slow. -.sp 1 -The -.B ftree -and -.B tree -boxes do not allow the tree to be moved to the left or to -the right. Thus, if there are many levels of data, some of the leaves can be -rendered invisible. A standard display with 80 characters allows for 17 -levels to be visible. Deeper levels are invisible. However, the navigation -in the tree and selection of leaves do work. -.SH AUTHOR -Savio Lam (lam836@cs.cuhk.hk) -.sp 1 -Changes by Anatoly A. Orehovsky (tolik@mpeks.tomsk.su) (ftree and tree boxes) Index: gnu/lib/libdialog/msgbox.c =================================================================== --- gnu/lib/libdialog/msgbox.c (revision 216873) +++ gnu/lib/libdialog/msgbox.c (working copy) @@ -1,346 +0,0 @@ -/* - * msgbox.c -- implements the message box and info box - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <dialog.h> -#include "dialog.priv.h" - - -/* local prototypes */ -static int getnlines(unsigned char *buf); -static void print_page(WINDOW *win, int height, int width, unsigned char *buf, int startline, int hscroll); -static void print_perc(WINDOW *win, int y, int x, float p); - - -/* - * Display a message box. Program will pause and display an "OK" button - * if the parameter 'pause' is non-zero. - */ -int dialog_msgbox(unsigned char *title, unsigned char *prompt, int height, int width, int pause) -{ - int i, j, x, y, key = 0; - WINDOW *dialog; - - if (height < 0) - height = strheight(prompt)+2+2*(!!pause); - if (width < 0) { - i = strwidth(prompt); - j = ((title != NULL) ? strwidth(title) : 0); - width = MAX(i,j)+4; - } - if (pause) - width = MAX(width,10); - - if (width > COLS) - width = COLS; - if (height > LINES) - height = LINES; - /* center dialog box on screen */ - x = DialogX ? DialogX : (COLS - width)/2; - y = DialogY ? DialogY : (LINES - height)/2; - -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(stdscr, y, x, height, width); -#endif - dialog = newwin(height, width, y, x); - if (dialog == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); - exit(1); - } - keypad(dialog, TRUE); - - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - - if (title != NULL) { - wattrset(dialog, title_attr); - wmove(dialog, 0, (width - strlen(title))/2 - 1); - waddch(dialog, ' '); - waddstr(dialog, title); - waddch(dialog, ' '); - } - wattrset(dialog, dialog_attr); - wmove(dialog, 1, 2); - print_autowrap(dialog, prompt, height-1, width-2, width, 1, 2, TRUE, FALSE); - - if (pause) { - wattrset(dialog, border_attr); - wmove(dialog, height-3, 0); - waddch(dialog, ACS_LTEE); - for (i = 0; i < width-2; i++) - waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - waddch(dialog, ACS_RTEE); - wmove(dialog, height-2, 1); - for (i = 0; i < width-2; i++) - waddch(dialog, ' '); - display_helpline(dialog, height-1, width); - print_button(dialog, " OK ", height-2, width/2-6, TRUE); - wrefresh(dialog); - while (key != ESC && key != '\n' && key != ' ' && key != '\r') - key = wgetch(dialog); - if (key == '\r') - key = '\n'; - } - else { - key = '\n'; - wrefresh(dialog); - } - - delwin(dialog); - return (key == ESC ? -1 : 0); -} -/* End of dialog_msgbox() */ - -int -dialog_mesgbox(unsigned char *title, unsigned char *prompt, int height, int width) -/* - * Desc: basically the same as dialog_msgbox, but ... can use PGUP, PGDN and - * arrowkeys to move around the text and pause is always enabled - */ -{ - int i, j, x, y, key=0; - int theight, startline, hscroll, max_lines; - WINDOW *dialog; - - if (height < 0) - height = strheight(prompt)+2+2; - if (width < 0) { - i = strwidth(prompt); - j = ((title != NULL) ? strwidth(title) : 0); - width = MAX(i,j)+4; - } - width = MAX(width,10); - - if (width > COLS) - width = COLS; - if (height > LINES) - height = LINES; - /* center dialog box on screen */ - x = (COLS - width)/2; - y = (LINES - height)/2; - -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(stdscr, y, x, height, width); -#endif - dialog = newwin(height, width, y, x); - if (dialog == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); - exit(1); - } - keypad(dialog, TRUE); - - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - - if (title != NULL) { - wattrset(dialog, title_attr); - wmove(dialog, 0, (width - strlen(title))/2 - 1); - waddch(dialog, ' '); - waddstr(dialog, title); - waddch(dialog, ' '); - } - - wattrset(dialog, border_attr); - wmove(dialog, height-3, 0); - waddch(dialog, ACS_LTEE); - for (i = 0; i < width-2; i++) - waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - waddch(dialog, ACS_RTEE); - wmove(dialog, height-2, 1); - for (i = 0; i < width-2; i++) - waddch(dialog, ' '); - display_helpline(dialog, height-1, width); - print_button(dialog, " OK ", height-2, width/2-6, TRUE); - wattrset(dialog, dialog_attr); - - theight = height - 4; - startline = 0; - hscroll = 0; - max_lines = getnlines(prompt); - print_page(dialog, theight, width, prompt, startline, hscroll); - print_perc(dialog, height-3, width-9, (float) (startline+theight)/max_lines); - wmove(dialog, height-2, width/2-3); - wrefresh(dialog); - while ((key != ESC) && (key != '\n') && (key != '\r') && (key != ' ')) { - key = wgetch(dialog); - switch(key) { - case KEY_HOME: - startline=0; - hscroll=0; - break; - case KEY_END: - startline = max_lines - theight; - if (startline < 0) startline = 0; - break; - case '\020': /* ^P */ - case KEY_UP: - if (startline > 0) startline--; - break; - case '\016': /* ^N */ - case KEY_DOWN: - if (startline < max_lines - theight) startline++; - break; - case KEY_RIGHT: - hscroll+=5; - break; - case KEY_LEFT: - if (hscroll > 0) hscroll-=5; - if (hscroll < 0) hscroll =0; - break; - case KEY_PPAGE: - if (startline - height > 0) { - startline -= theight; - } else { - startline = 0; - } - break; - case KEY_NPAGE: - if (startline + theight < max_lines - theight) { - startline += theight; - } else { - startline = max_lines - theight; - if (startline < 0) startline = 0; - } - break; - case KEY_F(1): - case '?': - display_helpfile(); - break; - } - print_page(dialog, theight, width, prompt, startline, hscroll); - print_perc(dialog, height-3, width-9, (float) (startline+theight)/max_lines); - wmove(dialog, height-2, width/2-3); - wrefresh(dialog); - } - - delwin(dialog); - return (key == ESC ? -1 : 0); - -} /* dialog_mesgbox() */ - -static void -print_perc(WINDOW *win, int y, int x, float p) -/* - * Desc: print p as a percentage at the coordinates (y,x) - */ -{ - char ps[10]; - - if (p>1.0) p=1.0; - sprintf(ps, "(%3d%%)", (int) (p*100)); - wmove(win, y, x); - waddstr(win, ps); - - return; -} /* print_perc() */ - -static int -getnlines(unsigned char *buf) -/* - * Desc: count the # of lines in <buf> - */ -{ - int i = 0; - - if (*buf) - i++; - while (*buf) { - if (*buf == '\n' || *buf == '\r') - i++; - buf++; - } - return(i); -} /* getlines() */ - - -unsigned char * -getline(unsigned char *buf, int n) -/* - * Desc: return a pointer to the n'th line in <buf> or NULL if its - * not there - */ -{ - int i; - - if (n<0) { - return(NULL); - } - - i=0; - while (*buf && i<n) { - if (*buf == '\n' || *buf == '\r') { - i++; - } - buf++; - } - if (i<n) { - return(NULL); - } else { - return(buf); - } -} /* getline() */ - -static void -print_page(WINDOW *win, int height, int width, unsigned char *buf, int startline, int hscroll) -/* - * Desc: Print a page of text in the current window, starting at line <startline> - * with a <horizontal> scroll of hscroll from buffer <buf> - */ -{ - int i, j; - unsigned char *b; - - b = getline(buf, startline); - for (i=0; i<height; i++) { - /* clear line */ - wmove(win, 1+i, 1); - for (j=0; j<width-2; j++) waddnstr(win, " ", 1); - wmove(win, 1+i, 1); - j = 0; - /* scroll to the right */ - while (*b && (*b != '\n') && (*b != '\r') && (j<hscroll)) { - b++; - j++; - } - /* print new line */ - j = 0; - while (*b && (*b != '\n') && (*b != '\r') && (j<width-2)) { - waddnstr(win, b, 1); - if (*b != '\t') { /* check for tabs */ - j++; - } else { - j = ((int) (j+1)/8 + 1) * 8 - 1; - } - b++; - } - while (*b && (*b != '\n') && (*b != '\r')) b++; - if (*b) b++; /* skip over '\n', if it exists */ - } -} /* print_page() */ - - - - Index: gnu/lib/libdialog/dialog.h =================================================================== --- gnu/lib/libdialog/dialog.h (revision 216873) +++ gnu/lib/libdialog/dialog.h (working copy) @@ -1,211 +0,0 @@ -#ifndef _DIALOG_H_INCLUDE -#define _DIALOG_H_INCLUDE - -/* - * dialog.h -- common declarations for all dialog modules - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * Substantial rennovation: 12/18/95, Jordan K. Hubbard - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $FreeBSD$ - * - */ - -#define HAVE_NCURSES - -#ifdef HAVE_NCURSES -#include <ncurses.h> - -#else - -#ifdef ultrix -#include <cursesX.h> -#else -#include <curses.h> -#endif - -#endif - -/* special return codes for `fire' actions */ -#define DITEM_STATUS(flag) ((flag) & 0x0000FFFF) -#define DITEM_SUCCESS 0 -#define DITEM_FAILURE 1 - -/* Flags - returned in upper 16 bits of return status */ -#define DITEM_LEAVE_MENU (1 << 16) -#define DITEM_REDRAW (1 << 17) -#define DITEM_RECREATE (1 << 18) -#define DITEM_RESTORE (1 << 19) -#define DITEM_CONTINUE (1 << 20) - -/* Attributes as used by entry fields right now */ -#define DITEM_NO_ECHO 0x0001 - - -/* negative offsets for buttons in item lists, if specified */ -#define OK_BUTTON -2 -#define CANCEL_BUTTON -1 - -/* for use in describing more exotic behaviors */ -typedef struct _dmenu_item { - char *prompt; - char *title; - int (*checked)(struct _dmenu_item *self); - int (*fire)(struct _dmenu_item *self); - void (*selected)(struct _dmenu_item *self, int is_selected); - void *data; - char lbra, mark, rbra; - long aux; -} dialogMenuItem; - -#define VERSION "0.4" -#define MAX_LEN 4096 - -#ifndef TRUE -#define TRUE (1) -#endif -#ifndef FALSE -#define FALSE (0) -#endif - -extern int DialogX, DialogY, DialogInputAttrs; - -/* - * Attribute names - */ -#define screen_attr attributes[0] -#define shadow_attr attributes[1] -#define dialog_attr attributes[2] -#define title_attr attributes[3] -#define border_attr attributes[4] -#define button_active_attr attributes[5] -#define button_inactive_attr attributes[6] -#define button_key_active_attr attributes[7] -#define button_key_inactive_attr attributes[8] -#define button_label_active_attr attributes[9] -#define button_label_inactive_attr attributes[10] -#define inputbox_attr attributes[11] -#define inputbox_border_attr attributes[12] -#define searchbox_attr attributes[13] -#define searchbox_title_attr attributes[14] -#define searchbox_border_attr attributes[15] -#define position_indicator_attr attributes[16] -#define menubox_attr attributes[17] -#define menubox_border_attr attributes[18] -#define item_attr attributes[19] -#define item_selected_attr attributes[20] -#define tag_attr attributes[21] -#define tag_selected_attr attributes[22] -#define tag_key_attr attributes[23] -#define tag_key_selected_attr attributes[24] -#define check_attr attributes[25] -#define check_selected_attr attributes[26] -#define uarrow_attr attributes[27] -#define darrow_attr attributes[28] - -/* number of attributes */ -#define ATTRIBUTE_COUNT 29 - -extern chtype attributes[]; - -#ifdef HAVE_NCURSES -extern bool use_shadow; -void draw_shadow(WINDOW *win, int y, int x, int height, int width); -#endif -void draw_box(WINDOW *win, int y, int x, int height, int width, chtype box, chtype border); -int line_edit(WINDOW *dialog, int box_y, int box_x, int flen, int box_width, chtype attrs, int first, unsigned char *result, int attr_mask); -int strheight(const char *p); -int strwidth(const char *p); - -void dialog_create_rc(unsigned char *filename); -int dialog_yesno(unsigned char *title, unsigned char *prompt, int height, int width); -int dialog_noyes(unsigned char *title, unsigned char *prompt, int height, int width); -int dialog_prgbox(unsigned char *title, const unsigned char *line, int height, int width, int pause, int use_shell); -int dialog_msgbox(unsigned char *title, unsigned char *prompt, int height, int width, int pause); -int dialog_textbox(unsigned char *title, unsigned char *file, int height, int width); -int dialog_menu(unsigned char *title, unsigned char *prompt, int height, int width, int menu_height, - int item_no, void *itptr, unsigned char *result, int *ch, int *sc); -int dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int width, int list_height, - int item_no, void *itptr, unsigned char *result); -int dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int width, int list_height, - int item_no, void *itptr, unsigned char *result); -int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int width, unsigned char *result); -void dialog_clear_norefresh(void); -void dialog_clear(void); -void dialog_update(void); -void init_dialog(void); -void end_dialog(void); - -/* Additions to libdialog */ -char *dialog_fselect(char *dir, char *fmask); -int dialog_dselect(char *dir, char *fmask); -void dialog_notify(char *msg); -int dialog_mesgbox(unsigned char *title, unsigned char *prompt, int height, int width); -void use_helpfile(char *helpfile); -void use_helpline(char *helpline); -char *get_helpline(void); -void restore_helpline(char *helpline); -void dialog_gauge(char *title, char *prompt, int y, int x, int height, int width, int perc); - -/* - * Display a tree menu from file - * - * filename - file with like find(1) output - * FS - fields separator - * title - title of dialog box - * prompt - prompt text into dialog box - * height - height of dialog box - * width - width of dialog box - * menu_height - height of menu box - * result - pointer to char array - * - * return values: - * -1 - ESC pressed - * 0 - Ok, result set (must be freed later) - * 1 - Cancel - */ -int dialog_ftree(unsigned char *filename, unsigned char FS, - unsigned char *title, unsigned char *prompt, - int height, int width, int menu_height, - unsigned char **result); - -/* - * Display a tree menu from array - * - * names - array with like find(1) output - * size - size of array - * FS - fields separator - * title - title of dialog box - * prompt - prompt text into dialog box - * height - height of dialog box - * width - width of dialog box - * menu_height - height of menu box - * result - pointer to char array - * - * return values: - * -1 - ESC pressed - * 0 - Ok, result set - * 1 - Cancel - */ - -int dialog_tree(unsigned char **names, int size, unsigned char FS, - unsigned char *title, unsigned char *prompt, - int height, int width, int menu_height, - unsigned char **result); - -#endif /* _DIALOG_H_INCLUDE */ Index: gnu/lib/libdialog/colors.h =================================================================== --- gnu/lib/libdialog/colors.h (revision 216873) +++ gnu/lib/libdialog/colors.h (working copy) @@ -1,219 +0,0 @@ -/* - * colors.h -- color attribute definitions - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -/* - * Default color definitions - * - * *_FG = foreground - * *_BG = background - * *_HL = highlight? - */ -#define SCREEN_FG COLOR_CYAN -#define SCREEN_BG COLOR_BLUE -#define SCREEN_HL TRUE - -#define SHADOW_FG COLOR_BLACK -#define SHADOW_BG COLOR_BLACK -#define SHADOW_HL TRUE - -#define DIALOG_FG COLOR_BLACK -#define DIALOG_BG COLOR_WHITE -#define DIALOG_HL FALSE - -#define TITLE_FG COLOR_YELLOW -#define TITLE_BG COLOR_WHITE -#define TITLE_HL TRUE - -#define BORDER_FG COLOR_WHITE -#define BORDER_BG COLOR_WHITE -#define BORDER_HL TRUE - -#define BUTTON_ACTIVE_FG COLOR_WHITE -#define BUTTON_ACTIVE_BG COLOR_BLUE -#define BUTTON_ACTIVE_HL TRUE - -#define BUTTON_INACTIVE_FG COLOR_BLACK -#define BUTTON_INACTIVE_BG COLOR_WHITE -#define BUTTON_INACTIVE_HL FALSE - -#define BUTTON_KEY_ACTIVE_FG COLOR_WHITE -#define BUTTON_KEY_ACTIVE_BG COLOR_BLUE -#define BUTTON_KEY_ACTIVE_HL TRUE - -#define BUTTON_KEY_INACTIVE_FG COLOR_RED -#define BUTTON_KEY_INACTIVE_BG COLOR_WHITE -#define BUTTON_KEY_INACTIVE_HL FALSE - -#define BUTTON_LABEL_ACTIVE_FG COLOR_YELLOW -#define BUTTON_LABEL_ACTIVE_BG COLOR_BLUE -#define BUTTON_LABEL_ACTIVE_HL TRUE - -#define BUTTON_LABEL_INACTIVE_FG COLOR_BLACK -#define BUTTON_LABEL_INACTIVE_BG COLOR_WHITE -#define BUTTON_LABEL_INACTIVE_HL TRUE - -#define INPUTBOX_FG COLOR_BLACK -#define INPUTBOX_BG COLOR_WHITE -#define INPUTBOX_HL FALSE - -#define INPUTBOX_BORDER_FG COLOR_BLACK -#define INPUTBOX_BORDER_BG COLOR_WHITE -#define INPUTBOX_BORDER_HL FALSE - -#define SEARCHBOX_FG COLOR_BLACK -#define SEARCHBOX_BG COLOR_WHITE -#define SEARCHBOX_HL FALSE - -#define SEARCHBOX_TITLE_FG COLOR_YELLOW -#define SEARCHBOX_TITLE_BG COLOR_WHITE -#define SEARCHBOX_TITLE_HL TRUE - -#define SEARCHBOX_BORDER_FG COLOR_WHITE -#define SEARCHBOX_BORDER_BG COLOR_WHITE -#define SEARCHBOX_BORDER_HL TRUE - -#define POSITION_INDICATOR_FG COLOR_YELLOW -#define POSITION_INDICATOR_BG COLOR_WHITE -#define POSITION_INDICATOR_HL TRUE - -#define MENUBOX_FG COLOR_BLACK -#define MENUBOX_BG COLOR_WHITE -#define MENUBOX_HL FALSE - -#define MENUBOX_BORDER_FG COLOR_WHITE -#define MENUBOX_BORDER_BG COLOR_WHITE -#define MENUBOX_BORDER_HL TRUE - -#define ITEM_FG COLOR_BLACK -#define ITEM_BG COLOR_WHITE -#define ITEM_HL FALSE - -#define ITEM_SELECTED_FG COLOR_WHITE -#define ITEM_SELECTED_BG COLOR_BLUE -#define ITEM_SELECTED_HL TRUE - -#define TAG_FG COLOR_YELLOW -#define TAG_BG COLOR_WHITE -#define TAG_HL TRUE - -#define TAG_SELECTED_FG COLOR_YELLOW -#define TAG_SELECTED_BG COLOR_BLUE -#define TAG_SELECTED_HL TRUE - -#define TAG_KEY_FG COLOR_RED -#define TAG_KEY_BG COLOR_WHITE -#define TAG_KEY_HL TRUE - -#define TAG_KEY_SELECTED_FG COLOR_RED -#define TAG_KEY_SELECTED_BG COLOR_BLUE -#define TAG_KEY_SELECTED_HL TRUE - -#define CHECK_FG COLOR_BLACK -#define CHECK_BG COLOR_WHITE -#define CHECK_HL FALSE - -#define CHECK_SELECTED_FG COLOR_WHITE -#define CHECK_SELECTED_BG COLOR_BLUE -#define CHECK_SELECTED_HL TRUE - -#define UARROW_FG COLOR_GREEN -#define UARROW_BG COLOR_WHITE -#define UARROW_HL TRUE - -#define DARROW_FG COLOR_GREEN -#define DARROW_BG COLOR_WHITE -#define DARROW_HL TRUE - -/* End of default color definitions */ - -#define C_ATTR(x,y) ((x ? A_BOLD : 0) | COLOR_PAIR((y))) -#define COLOR_NAME_LEN 10 -#define COLOR_COUNT 8 - - -/* - * Global variables - */ - -typedef struct { - unsigned char name[COLOR_NAME_LEN]; - int value; -} color_names_st; - - -#ifdef __DIALOG_MAIN__ - -/* - * For matching color names with color values - */ -color_names_st color_names[] = { - {"BLACK", COLOR_BLACK}, - {"RED", COLOR_RED}, - {"GREEN", COLOR_GREEN}, - {"YELLOW", COLOR_YELLOW}, - {"BLUE", COLOR_BLUE}, - {"MAGENTA", COLOR_MAGENTA}, - {"CYAN", COLOR_CYAN}, - {"WHITE", COLOR_WHITE}, -}; /* color names */ - - -/* - * Table of color values - */ -int color_table[][3] = { - {SCREEN_FG, SCREEN_BG, SCREEN_HL }, - {SHADOW_FG, SHADOW_BG, SHADOW_HL }, - {DIALOG_FG, DIALOG_BG, DIALOG_HL }, - {TITLE_FG, TITLE_BG, TITLE_HL }, - {BORDER_FG, BORDER_BG, BORDER_HL }, - {BUTTON_ACTIVE_FG, BUTTON_ACTIVE_BG, BUTTON_ACTIVE_HL }, - {BUTTON_INACTIVE_FG, BUTTON_INACTIVE_BG, BUTTON_INACTIVE_HL }, - {BUTTON_KEY_ACTIVE_FG, BUTTON_KEY_ACTIVE_BG, BUTTON_KEY_ACTIVE_HL }, - {BUTTON_KEY_INACTIVE_FG, BUTTON_KEY_INACTIVE_BG, BUTTON_KEY_INACTIVE_HL }, - {BUTTON_LABEL_ACTIVE_FG, BUTTON_LABEL_ACTIVE_BG, BUTTON_LABEL_ACTIVE_HL }, - {BUTTON_LABEL_INACTIVE_FG,BUTTON_LABEL_INACTIVE_BG,BUTTON_LABEL_INACTIVE_HL}, - {INPUTBOX_FG, INPUTBOX_BG, INPUTBOX_HL }, - {INPUTBOX_BORDER_FG, INPUTBOX_BORDER_BG, INPUTBOX_BORDER_HL }, - {SEARCHBOX_FG, SEARCHBOX_BG, SEARCHBOX_HL }, - {SEARCHBOX_TITLE_FG, SEARCHBOX_TITLE_BG, SEARCHBOX_TITLE_HL }, - {SEARCHBOX_BORDER_FG, SEARCHBOX_BORDER_BG, SEARCHBOX_BORDER_HL }, - {POSITION_INDICATOR_FG, POSITION_INDICATOR_BG, POSITION_INDICATOR_HL }, - {MENUBOX_FG, MENUBOX_BG, MENUBOX_HL }, - {MENUBOX_BORDER_FG, MENUBOX_BORDER_BG, MENUBOX_BORDER_HL }, - {ITEM_FG, ITEM_BG, ITEM_HL }, - {ITEM_SELECTED_FG, ITEM_SELECTED_BG, ITEM_SELECTED_HL }, - {TAG_FG, TAG_BG, TAG_HL }, - {TAG_SELECTED_FG, TAG_SELECTED_BG, TAG_SELECTED_HL }, - {TAG_KEY_FG, TAG_KEY_BG, TAG_KEY_HL }, - {TAG_KEY_SELECTED_FG, TAG_KEY_SELECTED_BG, TAG_KEY_SELECTED_HL }, - {CHECK_FG, CHECK_BG, CHECK_HL }, - {CHECK_SELECTED_FG, CHECK_SELECTED_BG, CHECK_SELECTED_HL }, - {UARROW_FG, UARROW_BG, UARROW_HL }, - {DARROW_FG, DARROW_BG, DARROW_HL }, -}; /* color_table */ - -#else - -extern color_names_st color_names[]; -extern int color_table[][3]; - -#endif /* __DIALOG_MAIN__ */ Index: gnu/lib/libdialog/inputbox.c =================================================================== --- gnu/lib/libdialog/inputbox.c (revision 216873) +++ gnu/lib/libdialog/inputbox.c (working copy) @@ -1,190 +0,0 @@ -/* - * inputbox.c -- implements the input box - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#include <dialog.h> -#include "dialog.priv.h" - - -/* - * Display a dialog box for inputing a string - */ -int dialog_inputbox(unsigned char *title, unsigned char *prompt, int height, int width, unsigned char *result) -{ - int i, j, x, y, box_y, box_x, box_width, first, - key = 0, button = -1; - unsigned char instr[MAX_LEN+1]; - WINDOW *dialog; - - if (height < 0) - height = strheight(prompt)+2+4; - if (width < 0) { - i = strwidth(prompt); - j = ((title != NULL) ? strwidth(title) : 0); - width = MAX(i,j) + 4; - } - width = MAX(width,24); - - if (width > COLS) - width = COLS; - if (height > LINES) - height = LINES; - /* center dialog box on screen */ - x = DialogX ? DialogX : (COLS - width)/2; - y = DialogY ? DialogY : (LINES - height)/2; - -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(stdscr, y, x, height, width); -#endif - dialog = newwin(height, width, y, x); - if (dialog == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); - exit(1); - } - keypad(dialog, TRUE); - - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - wattrset(dialog, border_attr); - wmove(dialog, height-3, 0); - waddch(dialog, ACS_LTEE); - for (i = 0; i < width-2; i++) - waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - waddch(dialog, ACS_RTEE); - wmove(dialog, height-2, 1); - for (i = 0; i < width-2; i++) - waddch(dialog, ' '); - - if (title != NULL) { - wattrset(dialog, title_attr); - wmove(dialog, 0, (width - strlen(title))/2 - 1); - waddch(dialog, ' '); - waddstr(dialog, title); - waddch(dialog, ' '); - } - wattrset(dialog, dialog_attr); - wmove(dialog, 1, 2); - print_autowrap(dialog, prompt, height-1, width-2, width, 1, 2, TRUE, FALSE); - - /* Draw the input field box */ - box_width = width-6; - getyx(dialog, y, x); - box_y = y + 2; - box_x = (width - box_width)/2; - draw_box(dialog, y+1, box_x-1, 3, box_width+2, border_attr, dialog_attr); - - display_helpline(dialog, height-1, width); - - x = width/2-11; - y = height-2; - print_button(dialog, "Cancel", y, x+14, FALSE); - print_button(dialog, " OK ", y, x, TRUE); - - first = 1; - strcpy(instr, result); - wattrset(dialog, dialog_attr); - - while (key != ESC) { - - if (button == -1) { /* Input box selected */ - key = line_edit(dialog, box_y, box_x, -1, box_width, inputbox_attr, first, instr, DialogInputAttrs); - first = 0; - } - else - key = wgetch(dialog); - - switch (key) { - case 'O': - case 'o': - delwin(dialog); - strcpy(result, instr); - return 0; - case 'C': - case 'c': - delwin(dialog); - return 1; - case KEY_UP: - case KEY_LEFT: - case KEY_BTAB: - switch (button) { - case -1: - button = 1; /* Indicates "Cancel" button is selected */ - print_button(dialog, " OK ", y, x, FALSE); - print_button(dialog, "Cancel", y, x+14, TRUE); - wrefresh(dialog); - break; - case 0: - button = -1; /* Indicates input box is selected */ - print_button(dialog, "Cancel", y, x+14, FALSE); - print_button(dialog, " OK ", y, x, TRUE); - break; - case 1: - button = 0; /* Indicates "OK" button is selected */ - print_button(dialog, "Cancel", y, x+14, FALSE); - print_button(dialog, " OK ", y, x, TRUE); - wrefresh(dialog); - break; - } - break; - case TAB: - case KEY_DOWN: - case KEY_RIGHT: - switch (button) { - case -1: - button = 0; /* Indicates "OK" button is selected */ - print_button(dialog, "Cancel", y, x+14, FALSE); - print_button(dialog, " OK ", y, x, TRUE); - wrefresh(dialog); - break; - case 0: - button = 1; /* Indicates "Cancel" button is selected */ - print_button(dialog, " OK ", y, x, FALSE); - print_button(dialog, "Cancel", y, x+14, TRUE); - wrefresh(dialog); - break; - case 1: - button = -1; /* Indicates input box is selected */ - print_button(dialog, "Cancel", y, x+14, FALSE); - print_button(dialog, " OK ", y, x, TRUE); - break; - } - break; - case ' ': - case '\n': - case '\r': - delwin(dialog); - if (button < 1) - strcpy(result, instr); - return (button == -1 ? 0 : button); - case ESC: - break; - case KEY_F(1): - case '?': - display_helpfile(); - break; - } - } - - delwin(dialog); - return -1; /* ESC pressed */ -} -/* End of dialog_inputbox() */ Index: gnu/lib/libdialog/checklist.c =================================================================== --- gnu/lib/libdialog/checklist.c (revision 216873) +++ gnu/lib/libdialog/checklist.c (working copy) @@ -1,661 +0,0 @@ -/* - * checklist.c -- implements the checklist box - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * Substantial rennovation: 12/18/95, Jordan K. Hubbard - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <dialog.h> -#include "dialog.priv.h" - - -static void print_item(WINDOW *win, unsigned char *tag, unsigned char *item, int status, int choice, int selected, dialogMenuItem *me, int list_width, int item_x, int check_x); - -#define DREF(di, item) ((di) ? &((di)[(item)]) : NULL) - -/* - * Display a dialog box with a list of options that can be turned on or off - */ -int -dialog_checklist(unsigned char *title, unsigned char *prompt, int height, int width, - int list_height, int cnt, void *it, unsigned char *result) -{ - int i, j, x, y, cur_x, cur_y, old_x, old_y, box_x, box_y, key = 0, button, - choice, l, k, scroll, max_choice, item_no = 0, *status; - int redraw_menu = FALSE, cursor_reset = FALSE; - int rval = 0, onlist = 1, ok_space, cancel_space; - char okButton, cancelButton; - WINDOW *dialog, *list; - unsigned char **items = NULL; - dialogMenuItem *ditems; - int list_width, check_x, item_x; - - /* Allocate space for storing item on/off status */ - if ((status = alloca(sizeof(int) * abs(cnt))) == NULL) { - endwin(); - fprintf(stderr, "\nCan't allocate memory in dialog_checklist().\n"); - exit(-1); - } - -draw: - choice = scroll = button = 0; - /* Previous calling syntax, e.g. just a list of strings? */ - if (cnt >= 0) { - items = it; - ditems = NULL; - item_no = cnt; - /* Initializes status */ - for (i = 0; i < item_no; i++) - status[i] = !strcasecmp(items[i*3 + 2], "on"); - } - /* It's the new specification format - fake the rest of the code out */ - else { - item_no = abs(cnt); - ditems = it; - if (!items) - items = (unsigned char **)alloca((item_no * 3) * sizeof(unsigned char *)); - - /* Initializes status */ - for (i = 0; i < item_no; i++) { - status[i] = ditems[i].checked ? ditems[i].checked(&ditems[i]) : FALSE; - items[i*3] = ditems[i].prompt; - items[i*3 + 1] = ditems[i].title; - items[i*3 + 2] = status[i] ? "on" : "off"; - } - } - max_choice = MIN(list_height, item_no); - - check_x = 0; - item_x = 0; - /* Find length of longest item in order to center checklist */ - for (i = 0; i < item_no; i++) { - l = strlen(items[i*3]); - for (j = 0; j < item_no; j++) { - k = strlen(items[j*3 + 1]); - check_x = MAX(check_x, l + k + 6); - } - item_x = MAX(item_x, l); - } - if (height < 0) - height = strheight(prompt)+list_height+4+2; - if (width < 0) { - i = strwidth(prompt); - j = ((title != NULL) ? strwidth(title) : 0); - width = MAX(i,j); - width = MAX(width,check_x+4)+4; - } - width = MAX(width,24); - - if (width > COLS) - width = COLS; - if (height > LINES) - height = LINES; - /* center dialog box on screen */ - x = (COLS - width)/2; - y = (LINES - height)/2; - -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(stdscr, y, x, height, width); -#endif - dialog = newwin(height, width, y, x); - if (dialog == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width, y, x); - return -1; - } - keypad(dialog, TRUE); - - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - wattrset(dialog, border_attr); - wmove(dialog, height-3, 0); - waddch(dialog, ACS_LTEE); - for (i = 0; i < width-2; i++) - waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - waddch(dialog, ACS_RTEE); - wmove(dialog, height-2, 1); - for (i = 0; i < width-2; i++) - waddch(dialog, ' '); - - if (title != NULL) { - wattrset(dialog, title_attr); - wmove(dialog, 0, (width - strlen(title))/2 - 1); - waddch(dialog, ' '); - waddstr(dialog, title); - waddch(dialog, ' '); - } - wattrset(dialog, dialog_attr); - wmove(dialog, 1, 2); - print_autowrap(dialog, prompt, height - 1, width - 2, width, 1, 2, TRUE, FALSE); - - list_width = width - 6; - getyx(dialog, cur_y, cur_x); - box_y = cur_y + 1; - box_x = (width - list_width) / 2 - 1; - - /* create new window for the list */ - list = subwin(dialog, list_height, list_width, y + box_y + 1, x + box_x + 1); - if (list == NULL) { - delwin(dialog); - endwin(); - fprintf(stderr, "\nsubwin(dialog,%d,%d,%d,%d) failed, maybe wrong dims\n", list_height, list_width, - y + box_y + 1, x + box_x + 1); - return -1; - } - keypad(list, TRUE); - - /* draw a box around the list items */ - draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2, menubox_border_attr, menubox_attr); - - check_x = (list_width - check_x) / 2; - item_x = check_x + item_x + 6; - - /* Print the list */ - for (i = 0; i < max_choice; i++) - print_item(list, items[i * 3], items[i * 3 + 1], status[i], i, i == choice, DREF(ditems, i), list_width, item_x, check_x); - wnoutrefresh(list); - print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y); - - display_helpline(dialog, height - 1, width); - - x = width / 2 - 11; - y = height - 2; - /* Is this a fancy new style argument string where we get to override - * the buttons, or an old style one where they're fixed? - */ - if (ditems && result) { - cancelButton = toupper(ditems[CANCEL_BUTTON].prompt[0]); - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : FALSE); - okButton = toupper(ditems[OK_BUTTON].prompt[0]); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : TRUE); - } - else { - cancelButton = 'C'; - print_button(dialog, "Cancel", y, x + 14, FALSE); - okButton = 'O'; - print_button(dialog, " OK ", y, x, TRUE); - } - wnoutrefresh(dialog); - wmove(list, choice, check_x+1); - wrefresh(list); - - /* - * XXX Black magic voodoo that allows printing to the checklist - * window. For some reason, if this "refresh" code is not in - * place, printing to the window from the selected callback - * prints "behind" the checklist window. There is probably a - * better way to do this. - */ - draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2, menubox_border_attr, menubox_attr); - - for (i = 0; i < max_choice; i++) - print_item(list, items[i * 3], items[i * 3 + 1], status[i], i, i == choice, DREF(ditems, i), list_width, item_x, check_x); - print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y); - - wmove(list, choice, check_x+1); - wnoutrefresh(dialog); - wrefresh(list); - /* XXX Black magic XXX */ - - while (key != ESC) { - key = wgetch(dialog); - - /* Shortcut to OK? */ - if (toupper(key) == okButton) { - if (ditems) { - if (result && ditems[OK_BUTTON].fire) { - int st; - WINDOW *save; - - save = dupwin(newscr); - st = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]); - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - } - } - else if (result) { - *result = '\0'; - for (i = 0; i < item_no; i++) { - if (status[i]) { - strcat(result, items[i*3]); - strcat(result, "\n"); - } - } - } - rval = 0; - key = ESC; /* Lemme out! */ - break; - } - - /* Shortcut to cancel? */ - if (toupper(key) == cancelButton) { - if (ditems && result && ditems[CANCEL_BUTTON].fire) { - int st; - WINDOW *save; - - save = dupwin(newscr); - st = ditems[CANCEL_BUTTON].fire(&ditems[CANCEL_BUTTON]); - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - wmove(dialog, cur_y, cur_x); - } - delwin(save); - } - rval = 1; - key = ESC; /* I gotta go! */ - break; - } - - /* Check if key pressed matches first character of any item tag in list */ - for (i = 0; i < max_choice; i++) - if (key != ' ' && key < 0x100 && toupper(key) == toupper(items[(scroll+i)*3][0])) - break; - - if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) || - KEY_IS_UP(key) || KEY_IS_DOWN(key) || ((key == ' ' || key == '\n' || - key == '\r') && onlist)) { - - /* if moving from buttons to the list, reset and redraw buttons */ - if (!onlist) { - onlist = 1; - button = 0; - - if (ditems && result) { - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : button); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : !button); - } - else { - print_button(dialog, "Cancel", y, x + 14, button); - print_button(dialog, " OK ", y, x, !button); - } - wmove(list, choice, check_x+1); - wnoutrefresh(dialog); - wrefresh(list); - } - - if (key >= '1' && key <= MIN('9', '0'+max_choice)) - i = key - '1'; - - else if (KEY_IS_UP(key)) { - if (!choice) { - if (scroll) { - /* Scroll list down */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - if (list_height > 1) { - /* De-highlight current first item before scrolling down */ - print_item(list, items[scroll * 3], items[scroll * 3 + 1], status[scroll], 0, - FALSE, DREF(ditems, scroll), list_width, item_x, check_x); - scrollok(list, TRUE); - wscrl(list, -1); - scrollok(list, FALSE); - } - scroll--; - print_item(list, items[scroll*3], items[scroll*3 + 1], status[scroll], 0, - TRUE, DREF(ditems, scroll), list_width, item_x, check_x); - print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y); - wmove(list, choice, check_x+1); - wnoutrefresh(dialog); - wrefresh(list); - } - continue; /* wait for another key press */ - } - else - i = choice - 1; - } - else if (KEY_IS_DOWN(key)) { - if (choice == max_choice - 1) { - if (scroll + choice < item_no - 1) { - /* Scroll list up */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - if (list_height > 1) { - /* De-highlight current last item before scrolling up */ - print_item(list, items[(scroll + max_choice - 1) * 3], - items[(scroll + max_choice - 1) * 3 + 1], - status[scroll + max_choice - 1], max_choice - 1, - FALSE, DREF(ditems, scroll + max_choice - 1), list_width, item_x, check_x); - scrollok(list, TRUE); - scroll(list); - scrollok(list, FALSE); - } - scroll++; - print_item(list, items[(scroll + max_choice - 1) * 3], - items[(scroll + max_choice - 1) * 3 + 1], - status[scroll + max_choice - 1], max_choice - 1, TRUE, - DREF(ditems, scroll + max_choice - 1), list_width, item_x, check_x); - print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y); - wmove(list, choice, check_x+1); - wnoutrefresh(dialog); - wrefresh(list); - } - continue; /* wait for another key press */ - } - else - i = choice + 1; - } - else if ((key == ' ' || key == '\n' || key == '\r') && onlist) { /* Toggle item status */ - char lbra = 0, rbra = 0, mark = 0; - - getyx(list, old_y, old_x); /* Save cursor position */ - - if (ditems) { - if (ditems[scroll + choice].fire) { - int st; - WINDOW *save; - - save = dupwin(newscr); - st = ditems[scroll + choice].fire(&ditems[scroll + choice]); /* Call "fire" action */ - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - if (st & DITEM_REDRAW) { - wclear(list); - for (i = 0; i < item_no; i++) - status[i] = ditems[i].checked ? ditems[i].checked(&ditems[i]) : FALSE; - for (i = 0; i < max_choice; i++) { - print_item(list, items[(scroll + i) * 3], items[(scroll + i) * 3 + 1], - status[scroll + i], i, i == choice, DREF(ditems, scroll + i), list_width, item_x, check_x); - } - wnoutrefresh(list); - print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, - cur_x, cur_y); - wrefresh(dialog); - } - if (st & DITEM_LEAVE_MENU) { - /* Allow a fire action to take us out of the menu */ - key = ESC; - rval = 0; - break; - } - else if (st & DITEM_RECREATE) { - delwin(list); - delwin(dialog); - dialog_clear(); - goto draw; - } - } - status[scroll + choice] = ditems[scroll + choice].checked ? - ditems[scroll + choice].checked(&ditems[scroll + choice]) : FALSE; - lbra = ditems[scroll + choice].lbra; - rbra = ditems[scroll + choice].rbra; - mark = ditems[scroll + choice].mark; - } - else - status[scroll + choice] = !status[scroll + choice]; - wmove(list, choice, check_x); - wattrset(list, check_selected_attr); - if (!lbra) - lbra = '['; - if (!rbra) - rbra = ']'; - if (!mark) - mark = 'X'; - wprintw(list, "%c%c%c", lbra, status[scroll + choice] ? mark : ' ', rbra); - wmove(list, old_y, old_x); /* Restore cursor to previous position */ - wrefresh(list); - continue; /* wait for another key press */ - } - - if (i != choice) { - /* De-highlight current item */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - print_item(list, items[(scroll + choice) * 3], items[(scroll + choice) * 3 + 1], - status[scroll + choice], choice, FALSE, DREF(ditems, scroll + choice), list_width, item_x, check_x); - - /* Highlight new item */ - choice = i; - print_item(list, items[(scroll + choice) * 3], items[(scroll + choice) * 3 + 1], status[scroll + choice], choice, TRUE, DREF(ditems, scroll + choice), list_width, item_x, check_x); - wmove(list, choice, check_x+1); /* Restore cursor to previous position */ - wrefresh(list); - } - continue; /* wait for another key press */ - } - - switch (key) { - case KEY_PPAGE: /* can we go up? */ - if (scroll > height - 4) - scroll -= (height-4); - else - scroll = 0; - redraw_menu = TRUE; - if (!onlist) { - onlist = 1; - button = 0; - } - break; - - case KEY_NPAGE: /* can we go down a full page? */ - if (scroll + list_height >= item_no-1 - list_height) { - scroll = item_no - list_height; - if (scroll < 0) - scroll = 0; - } - else - scroll += list_height; - redraw_menu = TRUE; - if (!onlist) { - onlist = 1; - button = 0; - } - break; - - case KEY_HOME: /* go to the top */ - scroll = 0; - choice = 0; - redraw_menu = TRUE; - cursor_reset = TRUE; - onlist = 1; - break; - - case KEY_END: /* Go to the bottom */ - scroll = item_no - list_height; - if (scroll < 0) - scroll = 0; - choice = max_choice - 1; - redraw_menu = TRUE; - cursor_reset = TRUE; - onlist = 1; - break; - - case TAB: - case KEY_BTAB: - /* move to next component */ - if (onlist) { /* on list, next is ok button */ - onlist = 0; - if (ditems && result) { - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : button); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : !button); - ok_space = 1; - cancel_space = strlen(ditems[OK_BUTTON].prompt) + 6; - } - else { - print_button(dialog, "Cancel", y, x + 14, button); - print_button(dialog, " OK ", y, x, !button); - ok_space = 3; - cancel_space = 15; - } - if (button) - wmove(dialog, y, x + cancel_space); - else - wmove(dialog, y, x + ok_space); - wrefresh(dialog); - break; - } - else if (button) { /* on cancel button, next is list */ - button = 0; - onlist = 1; - redraw_menu = TRUE; - break; - } - /* on ok button, next is cancel button, same as left/right case */ - - case KEY_LEFT: - case KEY_RIGHT: - onlist = 0; - button = !button; - if (ditems && result) { - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : button); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : !button); - ok_space = 1; - cancel_space = strlen(ditems[OK_BUTTON].prompt) + 6; - } - else { - print_button(dialog, "Cancel", y, x + 14, button); - print_button(dialog, " OK ", y, x, !button); - ok_space = 3; - cancel_space = 15; - } - if (button) - wmove(dialog, y, x + cancel_space); - else - wmove(dialog, y, x + ok_space); - wrefresh(dialog); - break; - - case ' ': - case '\n': - case '\r': - if (!onlist) { - if (ditems) { - if (result && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) { - int st; - WINDOW *save = dupwin(newscr); - - st = ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire(&ditems[button ? CANCEL_BUTTON : OK_BUTTON]); - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - if (st == DITEM_FAILURE) - continue; - } - } - else if (result) { - *result = '\0'; - for (i = 0; i < item_no; i++) { - if (status[i]) { - strcat(result, items[i*3]); - strcat(result, "\n"); - } - } - } - rval = button; - key = ESC; /* Bail out! */ - break; - } - - /* Let me outta here! */ - case ESC: - rval = -1; - break; - - /* Help! */ - case KEY_F(1): - case '?': - display_helpfile(); - break; - } - - if (redraw_menu) { - getyx(list, old_y, old_x); - wclear(list); - - /* - * Re-draw a box around the list items. It is required - * if amount of list items is smaller than height of listbox. - * Otherwise un-redrawn field will be filled with default - * screen attributes instead of dialog attributes. - */ - draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2, menubox_border_attr, menubox_attr); - - for (i = 0; i < max_choice; i++) - print_item(list, items[(scroll + i) * 3], items[(scroll + i) * 3 + 1], status[scroll + i], i, i == choice, DREF(ditems, scroll + i), list_width, item_x, check_x); - print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y); - - /* redraw buttons to fix highlighting */ - if (ditems && result) { - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : button); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : !button); - } - else { - print_button(dialog, "Cancel", y, x + 14, button); - print_button(dialog, " OK ", y, x, !button); - } - wnoutrefresh(dialog); - if (cursor_reset) { - wmove(list, choice, check_x+1); - cursor_reset = FALSE; - } - else { - wmove(list, old_y, old_x); - } - wrefresh(list); - redraw_menu = FALSE; - } - } - delwin(list); - delwin(dialog); - return rval; -} - - -/* - * Print list item - */ -static void -print_item(WINDOW *win, unsigned char *tag, unsigned char *item, int status, int choice, int selected, dialogMenuItem *me, int list_width, int item_x, int check_x) -{ - int i; - - /* Clear 'residue' of last item */ - wattrset(win, menubox_attr); - wmove(win, choice, 0); - for (i = 0; i < list_width; i++) - waddch(win, ' '); - wmove(win, choice, check_x); - wattrset(win, selected ? check_selected_attr : check_attr); - wprintw(win, "%c%c%c", me && me->lbra ? me->lbra : '[', - status ? me && me->mark ? me->mark : 'X' : ' ', - me && me->rbra ? me->rbra : ']'); - wattrset(win, menubox_attr); - waddch(win, ' '); - wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); - waddch(win, tag[0]); - wattrset(win, selected ? tag_selected_attr : tag_attr); - waddstr(win, tag + 1); - wmove(win, choice, item_x); - wattrset(win, selected ? item_selected_attr : item_attr); - waddstr(win, item); - /* If have a selection handler for this, call it */ - if (me && me->selected) { - wrefresh(win); - me->selected(me, selected); - } -} -/* End of print_item() */ Index: gnu/lib/libdialog/dialog.3 =================================================================== --- gnu/lib/libdialog/dialog.3 (revision 216873) +++ gnu/lib/libdialog/dialog.3 (working copy) @@ -1,842 +0,0 @@ -.\" -.\" Copyright (c) 1995, Jordan Hubbard -.\" -.\" All rights reserved. -.\" -.\" This manual page may be used, modified, copied, distributed, and -.\" sold, in both source and binary form provided that the above -.\" copyright and these terms are retained, verbatim, as the first -.\" lines of this file. Under no circumstances is the author -.\" responsible for the proper functioning of the software described herein -.\" nor does the author assume any responsibility for damages incurred with -.\" its use. -.\" -.\" $FreeBSD$ -.\" -.Dd January 1, 2000 -.Dt DIALOG 3 -.Os -.Sh NAME -.Nm draw_shadow , -.Nm draw_box , -.Nm line_edit , -.Nm strheight , -.Nm strwidth , -.Nm dialog_create_rc , -.Nm dialog_yesno , -.Nm dialog_noyes , -.Nm dialog_prgbox , -.Nm dialog_msgbox , -.Nm dialog_textbox , -.Nm dialog_menu , -.Nm dialog_checklist , -.Nm dialog_radiolist , -.Nm dialog_inputbox , -.Nm dialog_clear_norefresh , -.Nm dialog_clear , -.Nm dialog_update , -.Nm dialog_fselect , -.Nm dialog_notify , -.Nm dialog_mesgbox , -.Nm dialog_gauge , -.Nm init_dialog , -.Nm end_dialog , -.Nm use_helpfile , -.Nm use_helpline , -.Nm get_helpline , -.Nm restore_helpline , -.Nm dialog_ftree , -.Nm dialog_tree -.Nd provide a simple ncurses-based GUI interface -.Sh SYNOPSIS -.In dialog.h -.Ft "void" -.Fn draw_shadow "WINDOW *win" "int y" "int x" "int height" "int width" -.Ft "void" -.Fn draw_box "WINDOW *win" "int y" "int x" "int height" "int width" "chtype box" "chtype border" -.Ft "int" -.Fo line_edit -.Fa "WINDOW *dialog" -.Fa "int box_y" -.Fa "int box_x" -.Fa "int flen" -.Fa "int box_width" -.Fa "chtype attr" -.Fa "int first" -.Fa "unsigned char *result" -.Fa "int attr_mask" -.Fc -.Ft "int" -.Fn strheight "const char *p" -.Ft "int" -.Fn strwidth "const char *p" -.Ft "void" -.Fn dialog_create_rc "unsigned char *filename" -.Ft "int" -.Fn dialog_yesno "unsigned char *title" "unsigned char *prompt" "int height" "int width" -.Ft "int" -.Fn dialog_noyes "unsigned char *title" "unsigned char *prompt" "int height" "int width" -.Ft "int" -.Fn dialog_prgbox "unsigned char *title" "const unsigned char *line" "int height" "int width" "int pause" "int use_shell" -.Ft "int" -.Fn dialog_textbox "unsigned char *title" "unsigned char *file" "int height" "int width" -.Ft "int" -.Fo dialog_menu -.Fa "unsigned char *title" -.Fa "unsigned char *prompt" -.Fa "int height" -.Fa "int width" -.Fa "int menu_height" -.Fa "int cnt" -.Fa "void *it" -.Fa "unsigned char *result" -.Fa "int *ch" -.Fa "int *sc" -.Fc -.Ft "int" -.Fn dialog_checklist "unsigned char *title" "unsigned char *prompt" "int height" "int width" "int list_height" "int cnt" "void *it" "unsigned char *result" -.Ft "int" -.Fn dialog_radiolist "unsigned char *title" "unsigned char *prompt" "int height" "int width" "int list_height" "int cnt" "void *it" "unsigned char *result" -.Ft "int" -.Fn dialog_inputbox "unsigned char *title" "unsigned char *prompt" "int height" "int width" "unsigned char *result" -.Ft "char *" -.Fn dialog_fselect "char *dir" "char *fmask" -.Ft "int" -.Fn dialog_dselect "char *dir" "char *fmask" -.Ft "void" -.Fn dialog_notify "char *msg" -.Ft "int" -.Fn dialog_mesgbox "unsigned char *title" "unsigned char *prompt" "int height" "int width" -.Ft "void" -.Fn dialog_gauge "char *title" "char *prompt" "int y" "int x" "int height" "int width" "int perc" -.Ft "void" -.Fn use_helpfile "char *hfile" -.Ft "void" -.Fn use_helpline "char *hline" -.Ft "char *" -.Fn get_helpline "void" -.Ft "void" -.Fn dialog_clear_norefresh "void" -.Ft "void" -.Fn dialog_clear "void" -.Ft "void" -.Fn dialog_update "void" -.Ft "void" -.Fn init_dialog "void" -.Ft "void" -.Fn end_dialog "void" -.Ft "int" -.Fn dialog_ftree "unsigned char *filename" "unsigned char FS" "unsigned char *title" "unsigned char *prompt" "int height" "int width" "int menu_height" "unsigned char **result" -.Ft "int" -.Fo dialog_tree -.Fa "unsigned char **names" -.Fa "int size" -.Fa "unsigned char FS" -.Fa "unsigned char *title" -.Fa "unsigned char *prompt" -.Fa "int height" -.Fa "int width" -.Fa "int menu_height" -.Fa "unsigned char **result" -.Fc -.Sh DESCRIPTION -The dialog library attempts to provide a fairly simplistic set of -fixed-presentation menus, input boxes, gauges, file requestors and -other general purpose GUI (a bit of a stretch, since it uses -ncurses) objects. -Since the library also had its roots in a -shell-script writer's utility (see the -.Xr dialog 1 -command), the -early API was somewhat primitively based on strings being passed in or -out and parsed. -This API was later extended to take either the -original arguments or arrays of -.Va dialogMenuItem -structures, -giving the user much more control over the internal behavior of each -control. -The -.Va dialogMenuItem -structure internals are public: -.Bd -literal -offset indent -typedef struct _dmenu_item { - char *prompt; - char *title; - int (*checked)(struct _dmenu_item *self); - int (*fire)(struct _dmenu_item *self); - int (*selected)(struct _dmenu_item *self, int is_selected); - void *data; - char lbra, mark, rbra; - long aux; -} dialogMenuItem; -.Ed -.Pp -The -.Dv prompt -and -.Dv title -strings are pretty much self-explanatory, -and the -.Va checked -and -.Va fire -function pointers provide optional -display and action hooks (the -.Dv data -variable being available for -the convenience of those hooks) when more tightly coupled feedback between -a menu object and user code is required. -The -.Va selected -hook also -allows you to verify whether or not a given item is selected (the cursor is -over it) for implementing pretty much any possible context-sensitive -behavior. -A number of clever tricks for simulating various kinds of item -types can also be done by adjusting the values of -.Va lbra -(default: '['), -.Va mark -(default: '*' for radio menus, 'X' for check menus) -and -.Va rbra -(default: ']') and declaring a reasonable -.Va checked -hook, -which should return TRUE for the -.Dq marked -state and FALSE for -.Dq unmarked . -The -.Va aux -field is not used internally, and is available for miscellaneous usage. -If an item has a -.Va fire -hook associated with it, it will also be called -whenever the item is "toggled" in some way and should return one of the -following codes: -.Bd -literal -offset 4n -#define DITEM_SUCCESS 0 /* Successful completion */ -#define DITEM_FAILURE 1 /* Failed to "fire" */ -.Ed -.Pp -The following flags are in the upper 16 bits of return status: -.Bd -literal -offset 4n -#define DITEM_LEAVE_MENU (1 << 16) -#define DITEM_REDRAW (1 << 17) -#define DITEM_RECREATE (1 << 18) -#define DITEM_RESTORE (1 << 19) -#define DITEM_CONTINUE (1 << 20) -.Ed -.Pp -Two special globals also exist for putting a dialog at any arbitrary -X,Y location (the early designers rather short-sightedly made no provisions -for this). -If set to zero, the default centering behavior will be in -effect. -.Pp -Below is a short description of the various functions: -.Pp -The -.Fn draw_shadow -function draws a shadow in curses window -.Va win -using the dimensions of -.Va x , y , width -and -.Va height . -.Pp -The -.Fn draw_box -function draws a bordered box using the dimensions of -.Va x , y , width -and -.Va height . -The attributes from -.Va box -and -.Va border -are used, if specified, while painting the box and border regions of the -object. -.Pp -The -.Fn line_edit -function invokes a simple line editor with an edit box of dimensions -.Va box_x , box_y -and -.Va box_width . -The field length is constrained by -.Va flen , -starting at the -.Va first -character specified and -optionally displayed with character attributes -.Va attr . -The string being edited is stored in -.Va result . -Returns 0 on success, 1 on Cancel, and -1 on failure or ESC. -.Pp -The -.Fn strheight -function returns the height of string in -.Va p , -counting newlines. -.Pp -The -.Fn strwidth -function returns the width of string in -.Va p , -counting newlines. -.Pp -The -.Fn dialog_create_rc -function dumps dialog library settings into -.Pa filename -for later retrieval as defaults. -Returns 0 on success, -1 on failure. -.Pp -The -.Fn dialog_yesno -function displays a text box using -.Va title -and -.Va prompt -strings of dimensions -.Va height -and -.Va width . -Also paint a pair of -.Em Yes -and -.Em \&No -buttons at the bottom. -The default selection is -.Em Yes . -If the -.Em Yes -button is chosen, return FALSE. -If -.Em \&No , -return TRUE. -.Pp -The -.Fn dialog_noyes -function is the same as -.Fn dialog_yesno , -except the default selection is -.Em \&No . -.Pp -The -.Fn dialog_prgbox -function displays a text box of dimensions -.Va height -and -.Va width -containing the output of command -.Va line . -If -.Va use_shell -is TRUE, -.Va line -is passed as an argument to -.Xr sh 1 , -otherwise it is simply passed to -.Xr exec 3 . -If -.Va pause -is TRUE, a final confirmation requestor will be put up when execution -terminates. -Returns 0 on success, -1 on failure. -.Pp -The -.Fn dialog_textbox -function displays a text box containing the contents of -.Va file -with dimensions of -.Va height -and -.Va width . -.Pp -The -.Fn dialog_menu -function displays a menu of dimensions -.Va height -and -.Va width -with an optional internal menu height of -.Va menu_height . -The -.Va cnt -and -.Va it -arguments are of particular importance since they, -together, determine which of the 2 available APIs to use. -To use the -older and traditional interface, -.Va cnt -should be a positive -integer representing the number of string pointer pairs to find in -.Va it -(which should be of type -.Ft char "**" ) , -the strings are -expected to be in prompt and title order for each item and the -.Va result -parameter is expected to point to an array where the -prompt string of the item selected will be copied. -To use the newer -interface, -.Va cnt -should be a -.Va negative -integer representing the number of -.Va dialogMenuItem -structures pointed to by -.Va it -(which should be of type -.Vt dialogMenuItem "*" ) , -one structure per item. -In the new interface, the -.Va result -variable is used as a simple boolean (not a pointer) and should be NULL if -.Va it -only points to menu items and the default OK and Cancel buttons are desired. -If -.Va result -is non-NULL, then -.Va it -is actually expected to point 2 locations -.Va past -the start of the menu item list. -.Va it -is then expected to -point to an item representing the Cancel button, from which the -.Va prompt -and -.Va fire -actions are used to override the default behavior, and -.Va it -to the same for the OK button. -.Pp -Using either API behavior, the -.Va ch -and -.Va sc -values may be passed in to preserve current -item selection and scroll position values across calls. -.Pp -The -.Fn dialog_checklist -function displays a menu of dimensions -.Va height -and -.Va width -with an -optional internal menu height of -.Va list_height . -The -.Va cnt -and -.Va it -arguments are of particular importance since they, -together, determine which of the 2 available APIs to use. -To use the -older and traditional interface, -.Va cnt -should be a positive -integer representing the number of string pointer tuples to find in -.Va it -(which should be of type -.Ft "char **" ) , -the strings are -expected to be in prompt, title and state ("on" or "off") order for -each item and the -.Va result -parameter is expected to point to an -array where the prompt string of the item(s) selected will be -copied. -To use the newer interface, -.Va cnt -should be a -.Em negative -integer representing the number of -.Ft dialogMenuItem -structures pointed to by -.Va it -(which should be of type -.Ft "dialogMenuItem *" ) , -one structure per item. -In the new interface, -the -.Va result -variable is used as a simple boolean (not a pointer) -and should be NULL if -.Va it -only points to menu items and the default OK and Cancel -buttons are desired. -If -.Va result -is non-NULL, then -.Va it -is actually expected to -point 2 locations -.Va past -the start of the menu item list. -.Va it -is then expected to point to an item representing the Cancel -button, from which the -.Va prompt -and -.Va fire -actions are used to override the default behavior, and -.Va it -to the same for the OK button. -.Pp -In the standard API model, the menu supports the selection of multiple items, -each of which is marked with an `X' character to denote selection. -When -the OK button is selected, the prompt values for all items selected are -concatenated into the -.Va result -string. -.Pp -In the new API model, it is not actually necessary to preserve -"checklist" semantics at all since practically everything about how -each item is displayed or marked as "selected" is fully configurable. -You could have a single checklist menu that actually contained a group -of items with "radio" behavior, "checklist" behavior and standard menu -item behavior. -The only reason to call -.Fn dialog_checklist -over -.Fn dialog_radiolist -in the new API model is to inherit the base -behavior, you are no longer constrained by it. -.Pp -Returns 0 on success, 1 on Cancel, and -1 on failure or ESC. -.Pp -The -.Fn dialog_radiolist -function displays a menu of dimensions -.Va height -and -.Va width -with an -optional internal menu height of -.Va list_height . -The -.Va cnt -and -.Va it -arguments are of particular importance since they, -together, determine which of the 2 available APIs to use. -To use the -older and traditional interface, -.Va cnt -should be a positive -integer representing the number of string pointer tuples to find in -.Va it -(which should be of type -.Ft "char **" ) , -the strings are -expected to be in prompt, title and state ("on" or "off") order for -each item and the -.Va result -parameter is expected to point to an -array where the prompt string of the item(s) selected will be -copied. -To use the newer interface, -.Va cnt -should be a -.Dv negative -integer representing the number of -.Ft dialogMenuItem -structures pointed to by -.Va it -(which should be of type -.Ft "dialogMenuItem *" , -one structure per item. -In the new interface, -the -.Va result -variable is used as a simple boolean (not a pointer) -and should be NULL if -.Va it -only points to menu items and the default OK and Cancel -buttons are desired. -If -.Va result -is non-NULL, then -.Va it -is actually expected to point 2 locations -.Va past -the start of the menu item list. -.Va it -is then expected to point to an item representing the Cancel -button, from which the -.Va prompt -and -.Va fire -actions are used to override the default behavior, and -.Va it -does the same for the traditional OK button. -.Pp -In the standard API model, the menu supports the selection of only one -of multiple items, the currently active item marked with an `*' -character to denote selection. -When the OK button is selected, the -prompt value for this item is copied into the -.Va result -string. -.Pp -In the new API model, it is not actually necessary to preserve -"radio button" semantics at all since practically everything about how -each item is displayed or marked as "selected" is fully configurable. -You could have a single radio menu that actually contained a group -of items with "checklist" behavior, "radio" behavior and standard menu -item behavior. -The only reason to call -.Fn dialog_radiolist -over -.Fn dialog_checklistlist -in the new API model is to inherit the base -behavior. -.Pp -Returns 0 on success, 1 on Cancel and -1 on failure or ESC. -.Pp -The -.Fn dialog_inputbox -function displays a single-line text input field in a box displaying -.Va title -and -.Va prompt -of dimensions -.Va height -and -.Va width . -The field entered is stored in -.Va result . -.Pp -Returns 0 on success, -1 on failure or ESC. -.Pp -The -.Fn dialog_fselect -function brings up a file selector dialog starting at -.Va dir -and showing only those file names -matching -.Va fmask . -.Pp -Returns filename selected or NULL. -.Pp -The -.Fn dialog_dselect -function brings up a directory selector dialog starting at -.Va dir -and showing only those directory names -matching -.Va fmask . -.Pp -Returns directory name selected or NULL. -.Pp -The -.Fn dialog_notify -function brings up a generic "hey, you!" notifier dialog containing -.Va msg . -.Pp -The -.Fn dialog_mesgbox -function displays a notifier dialog, but with more control over -.Va title , -.Va prompt , -.Va width -and -.Va height . -This object will also wait for user confirmation, unlike -.Fn dialog_notify . -.Pp -Returns 0 on success, -1 on failure. -.Pp -The -.Fn dialog_gauge -function displays a horizontal bar-graph style gauge. -A value of -.Em 100 -for -.Em perc -constitutes a full gauge, a value of -.Em 0 -an empty one. -.Pp -The -.Fn use_helpfile -function for any menu supporting context sensitive help, invokes the text box -object on this file whenever the -.Em F1 -key is pressed. -.Pp -The -.Fn use_helpline -function displays this line of helpful text below any menu being displayed. -.Pp -The -.Fn get_helpline -function gets the current value of the helpful text line. -.Pp -The -.Fn dialog_clear_norefresh -function clears the screen back to the dialog background color, but do not -refresh the contents just yet. -.Pp -The -.Fn dialog_clear -function clears the screen back to the dialog background color immediately. -.Pp -The -.Fn dialog_update -function does any pending screen refreshes now. -.Pp -The -.Fn init_dialog -function initializes the dialog library (call this routine before any other -dialog API calls). -.Pp -The -.Fn end_dialog -function shuts down the dialog library (call this if you need to get back to -sanity). -.Pp -The -.Fn dialog_ftree -function shows a tree described by the data from the file -.Pa filename . -The data in the file should look like -.Xr find 1 -output. -For the -.Xr find 1 -output, the field separator -.Va FS -will be -.Dq \&/ . -If -.Va height -and -.Va width -are positive numbers, they set the absolute -size of the whole -.Fn dialog_ftree -box. -If -.Va height -and -.Va width -are negative numbers, the size of the -.Fn dialog_ftree -box will be calculated automatically. -.Va menu_height -sets the height of the tree subwindow inside the -.Fn dialog_ftree -box and must be set. -.Va title -is shown centered on the upper border of the -.Fn dialog_ftree -box. -.Va prompt -is shown inside the -.Fn dialog_ftree -box above the tree subwindow and can contain -.Ql \e\&n -to split lines. -One can navigate in -the tree by pressing UP/DOWN or -.Sm off -.So \&+ Sc \&/ So \&- Sc , -.Sm on -PG_UP/PG_DOWN or -.Sm off -.So b Sc \&/SPACE -.Sm on -and -HOME/END or -.Sm off -.So g Sc \&/ So G Sc . -.Sm on -A leaf of the -tree is selected by pressing TAB or LEFT/RIGHT the OK -button and pressing ENTER. -filename may contain data like -.Xr find 1 -output, as well as like the output of -.Xr find 1 -with -.Fl d -option. -Some of the transient paths to the leaves of the tree may -be absent. -Such data is corrected when fed from filename. -.Pp -The function returns 0 and a pointer to the selected leaf (to the path to -the leaf from the root of the tree) into result, if the OK button was -selected. -The memory allocated for the building of the tree is freed on -exiting -.Fn dialog_ftree . -The memory for the result line should be freed -later manually, if necessary. -If the Cancel button was selected, the -function returns 1. -In case of exiting -.Fn dialog_ftree -on ESC, the function returns -1. -.Pp -The -.Fn dialog_tree -function returns the same results as -.Fn dialog_ftree . -If 0 is returned, result will contain a pointer from the array -.Va names . -.\" \fBdialog_tree\fR displays the tree very much like \fBdialog_ftree\fR does, -.\" with some exceptions. The source data for the building of the tree is an -.\" array \fBnames\fR of paths to the leaves (should be similar to \fBfind(1)\fR -.\" output) of the size \fBsize\fR. However, there is no correction of data like -.\" in \fBdialog_ftree\fR. Thus, to display a correct tree, the array must -.\" already contain correct data. Besides, in each session every unique use of -.\" \fBdialog_tree\fR is kept in memory, and later, when calling -.\" \fBdialog_tree\fR with the same \fBnames\fR, \fBsize\fR, \fBFS\fR, -.\" \fBheight\fR, \fBwidth\fR and \fBmenu_height\fR the position of the cursor -.\" in the tree subwindow is restored. -.Sh SEE ALSO -.Xr dialog 1 , -.Xr ncurses 3 -.Sh HISTORY -These functions appeared in -.Fx 2.0 -as the -.Xr dialog 1 -command and were soon split into a separate library -and command by -.An Andrey Chernov . -.An Marc van Kempen -implemented most of the extra controls and objects, -.An Jordan Hubbard -added the dialogMenuItem renovations and this man page and -.An Anatoly A. Orehovsky -implemented -.Fn dialog_ftree -and -.Fn dialog_tree . -.Sh AUTHORS -.An -nosplit -The primary author would appear to be -.An Savio Lam Aq lam836@cs.cuhk.hk -with contributions over the years by -.An Stuart Herbert Aq S.Herbert@sheffield.ac.uk , -.An Marc van Kempen Aq wmbfmk@urc.tue.nl , -.An Andrey Chernov Aq ache@FreeBSD.org , -.An Jordan Hubbard Aq jkh@FreeBSD.org -and -.An Anatoly A. Orehovsky Aq tolik@mpeks.tomsk.su . -.Sh BUGS -Sure! Index: gnu/lib/libdialog/kernel.c =================================================================== --- gnu/lib/libdialog/kernel.c (revision 216873) +++ gnu/lib/libdialog/kernel.c (working copy) @@ -1,536 +0,0 @@ -/* - * dialog - Display simple dialog boxes from shell scripts - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * - * HISTORY: - * - * 17/12/93 - Version 0.1 released. - * - * 19/12/93 - menu will now scroll if there are more items than can fit - * on the screen. - * - added 'checklist', a dialog box with a list of options that - * can be turned on or off. A list of options that are on is - * returned on exit. - * - * 20/12/93 - Version 0.15 released. - * - * 29/12/93 - Incorporated patch from Patrick J. Volkerding - * (volkerdi@mhd1.moorhead.msus.edu) that made these changes: - * - increased MAX_LEN to 2048 - * - added 'infobox', equivalent to a message box without pausing - * - added option '--clear' that will clear the screen - * - Explicit line breaking when printing prompt text can be - * invoked by real newline '\n' besides the string "\n" - * - an optional parameter '--title <string>' can be used to - * specify a title string for the dialog box - * - * 03/01/94 - added 'textbox', a dialog box for displaying text from a file. - * - Version 0.2 released. - * - * 04/01/94 - some fixes and improvements for 'textbox': - * - fixed a bug that will cause a segmentation violation when a - * line is longer than MAX_LEN characters. Lines will now be - * truncated if they are longer than MAX_LEN characters. - * - removed wrefresh() from print_line(). This will increase - * efficiency of print_page() which calls print_line(). - * - display current position in the form of percentage into file. - * - Version 0.21 released. - * - * 05/01/94 - some changes for faster screen update. - * - * 07/01/94 - much more flexible color settings. Can use all 16 colors - * (8 normal, 8 highlight) of the Linux console. - * - * 08/01/94 - added run-time configuration using configuration file. - * - * 09/01/94 - some minor bug fixes and cleanups for menubox, checklist and - * textbox. - * - * 11/01/94 - added a man page. - * - * 13/01/94 - some changes for easier porting to other Unix systems (tested - * on Ultrix, SunOS and HPUX) - * - Version 0.3 released. - * - * 08/06/94 - Patches by Stuart Herbert - S.Herbert@shef.ac.uk - * Fixed attr_clear and the textbox stuff to work with ncurses 1.8.5 - * Fixed the wordwrap routine - it'll actually wrap properly now - * Added a more 3D look to everything - having your own rc file could - * prove 'interesting' to say the least :-) - * Added radiolist option - * - Version 0.4 released. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#define __DIALOG_MAIN__ - -#include <dialog.h> -#include <err.h> -#include "dialog.priv.h" -#ifdef HAVE_NCURSES -#include "colors.h" -#endif - -/* These are two "secret" globals that can be fiddled to make a dialog - * come up someplace other than a "centered" calculation for X,Y - */ -int DialogX, DialogY; - -/* This "secret" global allows you to change the behavior of an input field */ -int DialogInputAttrs; - -/* - * Do some initialization for dialog - */ -void init_dialog(void) -{ - - if (issetugid()) { - errx(1, "libdialog is unsafe to use in setugid applications"); - } - -#if defined(LOCALE) - (void) setlocale(LC_ALL, ""); -#endif - -#ifdef HAVE_NCURSES - if (parse_rc() == -1) /* Read the configuration file */ - exit(-1); -#endif - - if (initscr() == NULL) { /* Init curses */ - fprintf(stderr, "\nCurses initialization error.\n"); - exit(-1); - } - keypad(stdscr, TRUE); - cbreak(); - noecho(); - -#ifdef HAVE_NCURSES - if (use_colors || use_shadow) /* Set up colors */ - color_setup(); -#endif - - /* Set screen to screen attribute */ - dialog_clear_norefresh(); - DialogX = DialogY = 0; -} -/* End of init_dialog() */ - - -#ifdef HAVE_NCURSES -/* - * Setup for color display - */ -void color_setup(void) -{ - int i; - - if (has_colors()) { /* Terminal supports color? */ - start_color(); - - /* Initialize color pairs */ - for (i = 0; i < ATTRIBUTE_COUNT; i++) - init_pair(i+1, color_table[i][0], color_table[i][1]); - - /* Setup color attributes */ - for (i = 0; i < ATTRIBUTE_COUNT; i++) - attributes[i] = C_ATTR(color_table[i][2], i+1); - } -} -/* End of color_setup() */ -#endif - - -/* - * Set window to attribute 'attr' - */ -void attr_clear(WINDOW *win, int height, int width, chtype attr) -{ - int i, j; - - wattrset(win, attr); /* Set window to attribute 'attr' */ - for (i = 0; i < height; i++) { - wmove(win, i, 0); - for (j = 0; j < width; j++) - waddch(win, ' '); - } -} -/* End of attr_clear() */ - - -/* - * Print a string of text in a window, automatically wrap around to the - * next line if the string is too long to fit on one line. Note that the - * string may contain "\n" to represent a newline character or the real - * newline '\n', but in that case, auto wrap around will be disabled. - */ -void print_autowrap(WINDOW *win, unsigned char *prompt, int height, int width, int maxwidth, int y, int x, int center, int rawmode) -{ - int cur_x, cur_y, i; - unsigned char tempstr[MAX_LEN+1], *word, *tempptr, *tempptr1; - chtype ostuff[132], attrs = 0, init_bottom = 0; - - wsetscrreg(win, y, height); - getyx(win, cur_y, cur_x); - - strncpy(tempstr, prompt, MAX_LEN); - tempstr[MAX_LEN] = '\0'; - if ((!rawmode && strstr(tempstr, "\\n") != NULL) || - (strchr(tempstr, '\n') != NULL)) { /* Prompt contains "\n" or '\n' */ - word = tempstr; - while (1) { - tempptr = rawmode ? NULL : strstr(word, "\\n"); - tempptr1 = strchr(word, '\n'); - if (tempptr == NULL && tempptr1 == NULL) - break; - else if (tempptr == NULL) { /* No more "\n" */ - tempptr = tempptr1; - tempptr[0] = '\0'; - } - else if (tempptr1 == NULL) { /* No more '\n' */ - tempptr[0] = '\0'; - tempptr++; - } - else { /* Prompt contains both "\n" and '\n' */ - if (strlen(tempptr)-2 < strlen(tempptr1)-1) { - tempptr = tempptr1; - tempptr[0] = '\0'; - } - else { - tempptr[0] = '\0'; - tempptr++; - } - } - - waddstr(win, word); - word = tempptr + 1; - if (++cur_y > height) { - cur_y--; - if (!init_bottom) { - for (i = 0; i < x; i++) - ostuff[i] = mvwinch(win, cur_y, i); - for (i = width; i < maxwidth; i++) - ostuff[i] = mvwinch(win, cur_y, i); - attrs = getattrs(win); - init_bottom = 1; - } - scrollok(win, TRUE); - scroll(win); - scrollok(win, FALSE); - wmove(win, cur_y, 0); - for (i = 0; i < x; i++) { - wattrset(win, ostuff[i]&A_ATTRIBUTES); - waddch(win, ostuff[i]); - } - wattrset(win, attrs); - for ( ; i < width; i++) - waddch(win, ' '); - for ( ; i < maxwidth; i++) { - wattrset(win, ostuff[i]&A_ATTRIBUTES); - waddch(win, ostuff[i]); - } - wattrset(win, attrs); - wrefresh(win); - } - wmove(win, cur_y, cur_x = x); - } - waddstr(win, word); - } - else if (center && strlen(tempstr) <= width-x*2) { /* If prompt is short */ - wmove(win, cur_y, (width - strlen(tempstr)) / 2); - waddstr(win, tempstr); - } - else if (!center && strlen(tempstr) <= width-cur_x) { /* If prompt is short */ - waddstr(win, tempstr); - } - else { - char *p = tempstr; - - /* Print prompt word by word, wrap around if necessary */ - while ((word = strsep(&p, "\t\n ")) != NULL) { - int loop; - unsigned char sc; - - if (*word == '\0') - continue; - do { - loop = 0; - if (cur_x+strlen(word) >= width+1) { /* wrap around to next line */ - if (x+strlen(word) >= width+1) { - sc = word[width-cur_x-1]; - word[width-cur_x-1] = '\0'; - wmove(win, cur_y, cur_x); - waddstr(win, word); - word[width-cur_x-1] = sc; - word += width-cur_x-1; - getyx(win, cur_y, cur_x); - loop = 1; - } - cur_y++; - cur_x = x; - if (cur_y > height) { - cur_y--; - if (!init_bottom) { - for (i = 0; i < x; i++) - ostuff[i] = mvwinch(win, cur_y, i); - for (i = width; i < maxwidth; i++) - ostuff[i] = mvwinch(win, cur_y, i); - attrs = getattrs(win); - init_bottom = 1; - } - scrollok(win, TRUE); - scroll(win); - scrollok(win, FALSE); - wmove(win, cur_y, 0); - for (i = 0; i < x; i++) { - wattrset(win, ostuff[i]&A_ATTRIBUTES); - waddch(win, ostuff[i]); - } - wattrset(win, attrs); - for ( ; i < width; i++) - waddch(win, ' '); - for ( ; i < maxwidth; i++) { - wattrset(win, ostuff[i]&A_ATTRIBUTES); - waddch(win, ostuff[i]); - } - wattrset(win, attrs); - wrefresh(win); - } - } - } - while(loop); - wmove(win, cur_y, cur_x); - waddstr(win, word); - getyx(win, cur_y, cur_x); - cur_x++; - } - } -} -/* End of print_autowrap() */ - - -/* - * Print a button - */ -void print_button(WINDOW *win, unsigned char *label, int y, int x, int selected) -{ - int i, temp; - - wmove(win, y, x); - wattrset(win, selected ? button_active_attr : button_inactive_attr); - waddstr(win, selected ? "[" : " "); - temp = strspn(label, " "); - label += temp; - for (i = 0; i < temp; i++) - waddch(win, ' '); - wattrset(win, selected ? button_key_active_attr : button_key_inactive_attr); - waddch(win, label[0]); - wattrset(win, selected ? button_active_attr : button_inactive_attr); - waddstr(win, label+1); - waddstr(win, selected ? "]" : " "); - wmove(win, y, x+temp+1); -} -/* End of print_button() */ - - -/* - * Draw a rectangular box with line drawing characters - */ -void draw_box(WINDOW *win, int y, int x, int height, int width, chtype box, chtype border) -{ - int i, j; - - wattrset(win, 0); - for (i = 0; i < height; i++) { - wmove(win, y + i, x); - for (j = 0; j < width; j++) - if (!i && !j) - waddch(win, border | ACS_ULCORNER); - else if (i == height-1 && !j) - waddch(win, border | ACS_LLCORNER); - else if (!i && j == width-1) - waddch(win, box | ACS_URCORNER); - else if (i == height-1 && j == width-1) - waddch(win, box | ACS_LRCORNER); - else if (!i) - waddch(win, border | ACS_HLINE); - else if (i == height-1) - waddch(win, box | ACS_HLINE); - else if (!j) - waddch(win, border | ACS_VLINE); - else if (j == width-1) - waddch(win, box | ACS_VLINE); - else - waddch(win, box | ' '); - } -} -/* End of draw_box() */ - - -#ifdef HAVE_NCURSES -/* - * Draw shadows along the right and bottom edge to give a more 3D look - * to the boxes - */ -void draw_shadow(WINDOW *win, int y, int x, int height, int width) -{ - int i,sx,sy; - chtype attrs; - - if (has_colors()) { /* Whether terminal supports color? */ - getbegyx(win,sy,sx); - attrs = getattrs(win); - if (y+height < getmaxy(win)) { - /* small touch */ - wattrset(win, A_INVIS); - wmove(win, y + height, x + 2); - for (i = 0; i < width; i++) - if (i+x+2 < getmaxx(win)) - waddch(win, ' '); - /* end touch */ - wattrset(win, shadow_attr); - wmove(win, y + height, x + 2); - for (i = 0; i < width; i++) - if (i+x+2 < getmaxx(win)) - waddch(win, mvwinch(newscr, sy+y+height, sx+x+2+i) & A_CHARTEXT); - } - if (x+width < getmaxx(win)) { - for (i = y + 1; i < y + height + 1; i++) { - if (i < getmaxy(win)) { - /* small touch */ - wattrset(win, A_INVIS); - wmove(win, i, x + width); - waddch(win, ' '); - if (x+width+1 < getmaxx(win)) - waddch(win, ' '); - /* end touch */ - wattrset(win, shadow_attr); - wmove(win, i, x + width); - waddch(win, mvwinch(newscr, sy+i, sx+x+width) & A_CHARTEXT); - if (x+width+1 < getmaxx(win)) - waddch(win, mvwinch(newscr, sy+i, sx+x+width+1) & A_CHARTEXT); - } - } - } - wattrset(win, attrs); - wnoutrefresh(win); - } -} -/* End of draw_shadow() */ -#endif - -void dialog_clear_norefresh(void) -{ - attr_clear(stdscr, LINES, COLS, screen_attr); - touchwin(stdscr); - wnoutrefresh(stdscr); -} - -void dialog_clear(void) -{ - dialog_clear_norefresh(); - doupdate(); -} - -void dialog_update(void) -{ - refresh(); -} - -void end_dialog(void) -{ - endwin(); -} - -int strwidth(const char *p) -{ - int i = 0, len, incr; - const char *start, *s, *s1, *s2; - - for (start = s = p; ; start = (s += incr)) { - s1 = strchr(s, '\n'); - s2 = strstr(s, "\\n"); - if (s2 == NULL) - s = s1; - else if (s1 == NULL) - s = s2; - else - s = MIN(s1, s2); - if (s == NULL) - break; - incr = 1 + (s == s2); - len = s - start; - if (len > i) - i = len; - } - len = strlen(start); - if (len > i) - i = len; - return i; -} - -int strheight(const char *p) -{ - int i = 1, incr; - const char *s, *s1, *s2; - - for (s = p; ; s += incr) { - s1 = strchr(s, '\n'); - s2 = strstr(s, "\\n"); - if (s2 == NULL) - s = s1; - else if (s1 == NULL) - s = s2; - else - s = MIN(s1, s2); - if (s == NULL) - break; - incr = 1 + (s == s2); - i++; - } - return i; -} - -void print_arrows(WINDOW *dialog, int scroll, int menu_height, int item_no, - int box_x, int box_y, int tag_x, int cur_x, int cur_y) -{ - wmove(dialog, box_y, box_x + tag_x + 1); - wattrset(dialog, scroll ? uarrow_attr : menubox_attr); - waddch(dialog, scroll ? ACS_UARROW : ACS_HLINE); - wmove(dialog, box_y, box_x + tag_x + 2); - waddch(dialog, scroll ? '(' : ACS_HLINE); - wmove(dialog, box_y, box_x + tag_x + 3); - waddch(dialog, scroll ? '-' : ACS_HLINE); - wmove(dialog, box_y, box_x + tag_x + 4); - waddch(dialog, scroll ? ')' : ACS_HLINE); - wmove(dialog, box_y + menu_height + 1, box_x + tag_x + 1); - wattrset(dialog, scroll+menu_height < item_no ? darrow_attr : menubox_border_attr); - waddch(dialog, scroll+menu_height < item_no ? ACS_DARROW : ACS_HLINE); - wmove(dialog, box_y + menu_height + 1, box_x + tag_x + 2); - waddch(dialog, scroll+menu_height < item_no ? '(' : ACS_HLINE); - wmove(dialog, box_y + menu_height + 1, box_x + tag_x + 3); - waddch(dialog, scroll+menu_height < item_no ? '+' : ACS_HLINE); - wmove(dialog, box_y + menu_height + 1, box_x + tag_x + 4); - waddch(dialog, scroll+menu_height < item_no ? ')' : ACS_HLINE); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ -} - Index: gnu/lib/libdialog/dialog.priv.h =================================================================== --- gnu/lib/libdialog/dialog.priv.h (revision 216873) +++ gnu/lib/libdialog/dialog.priv.h (working copy) @@ -1,183 +0,0 @@ -/* - * dialog.h -- common declarations for all dialog modules - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#include <sys/types.h> -#include <fcntl.h> -#include <unistd.h> -#include <ctype.h> -#include <stdlib.h> -#include <string.h> -#include <termios.h> - -#if defined(LOCALE) -#include <locale.h> -#endif - - -/* - * Change these if you want - */ -#define USE_SHADOW TRUE -#define USE_COLORS TRUE - -#define ESC 27 -#define TAB 9 -#define BUF_SIZE (10*1024) - -#ifndef MIN -#define MIN(x,y) (x < y ? x : y) -#endif -#ifndef MAX -#define MAX(x,y) (x > y ? x : y) -#endif - -#ifndef ctrl -#define ctrl(a) ((a) - 'a' + 1) -#endif - -#ifndef HAVE_NCURSES -#ifndef ACS_ULCORNER -#define ACS_ULCORNER '+' -#endif -#ifndef ACS_LLCORNER -#define ACS_LLCORNER '+' -#endif -#ifndef ACS_URCORNER -#define ACS_URCORNER '+' -#endif -#ifndef ACS_LRCORNER -#define ACS_LRCORNER '+' -#endif -#ifndef ACS_HLINE -#define ACS_HLINE '-' -#endif -#ifndef ACS_VLINE -#define ACS_VLINE '|' -#endif -#ifndef ACS_LTEE -#define ACS_LTEE '+' -#endif -#ifndef ACS_RTEE -#define ACS_RTEE '+' -#endif -#ifndef ACS_UARROW -#define ACS_UARROW '^' -#endif -#ifndef ACS_DARROW -#define ACS_DARROW 'v' -#endif -#endif /* HAVE_NCURSES */ - -/* Travel key conventions */ -#define KEY_IS_UP(key) ((key) == KEY_UP || (key) == '-' || key == '\020' /* ^P */) -#define KEY_IS_DOWN(key) ((key) == KEY_DOWN || (key) == '+' || key == '\016' /* ^N */) - -/* - * Global variables - */ -#ifdef __DIALOG_MAIN__ - -#ifdef HAVE_NCURSES - -/* use colors by default? */ -bool use_colors = USE_COLORS; - -/* shadow dialog boxes by default? - Note that 'use_shadow' implies 'use_colors' */ -bool use_shadow = USE_SHADOW; - -#endif - - -/* - * Attribute values, default is for mono display - */ -chtype attributes[] = { - A_NORMAL, /* screen_attr */ - A_NORMAL, /* shadow_attr */ - A_REVERSE, /* dialog_attr */ - A_REVERSE, /* title_attr */ - A_REVERSE, /* border_attr */ - A_BOLD, /* button_active_attr */ - A_DIM, /* button_inactive_attr */ - A_UNDERLINE, /* button_key_active_attr */ - A_UNDERLINE, /* button_key_inactive_attr */ - A_NORMAL, /* button_label_active_attr */ - A_NORMAL, /* button_label_inactive_attr */ - A_REVERSE, /* inputbox_attr */ - A_REVERSE, /* inputbox_border_attr */ - A_REVERSE, /* searchbox_attr */ - A_REVERSE, /* searchbox_title_attr */ - A_REVERSE, /* searchbox_border_attr */ - A_REVERSE, /* position_indicator_attr */ - A_REVERSE, /* menubox_attr */ - A_REVERSE, /* menubox_border_attr */ - A_REVERSE, /* item_attr */ - A_NORMAL, /* item_selected_attr */ - A_REVERSE, /* tag_attr */ - A_REVERSE, /* tag_selected_attr */ - A_NORMAL, /* tag_key_attr */ - A_BOLD, /* tag_key_selected_attr */ - A_REVERSE, /* check_attr */ - A_REVERSE, /* check_selected_attr */ - A_REVERSE, /* uarrow_attr */ - A_REVERSE /* darrow_attr */ -}; - -#else - -#ifdef HAVE_NCURSES -extern bool use_colors; -#endif - -#endif /* __DIALOG_MAIN__ */ - - - -#ifdef HAVE_NCURSES - -/* - * Function prototypes - */ -#ifdef __DIALOG_MAIN__ - -extern int parse_rc(void); - -#endif /* __DIALOG_MAIN__ */ - -#endif - - -#ifdef HAVE_NCURSES -void color_setup(void); -#endif - -void attr_clear(WINDOW *win, int height, int width, chtype attr); -void print_autowrap(WINDOW *win, unsigned char *prompt, int height, int width, int maxwidth, - int y, int x, int center, int rawmode); -void print_button(WINDOW *win, unsigned char *label, int y, int x, int selected); -FILE *raw_popen(const char *program, char * const *argv, const char *type); -int raw_pclose(FILE *iop); -void display_helpfile(void); -void display_helpline(WINDOW *w, int y, int width); -void print_arrows(WINDOW *dialog, int scroll, int menu_height, int item_no, int box_x, - int box_y, int tag_x, int cur_x, int cur_y); - Index: gnu/lib/libdialog/ui_objects.c =================================================================== --- gnu/lib/libdialog/ui_objects.c (revision 216873) +++ gnu/lib/libdialog/ui_objects.c (working copy) @@ -1,829 +0,0 @@ -/* - * Program: objects.c - * Author: Marc van Kempen - * Desc: Implementation of UI-objects: - * - String input fields - * - List selection - * - Buttons - * - * Copyright (c) 1995, Marc van Kempen - * - * All rights reserved. - * - * This software may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with - * its use. - * - */ - -#include <stdlib.h> -#include <sys/param.h> -#include <ncurses.h> -#include <dialog.h> -#include "dialog.priv.h" -#include "ui_objects.h" - -#define ESC 27 - -/*********************************************************************** - * - * Obj routines - * - ***********************************************************************/ - -void -AddObj(ComposeObj **Obj, int objtype, void *obj) -/* - * Desc: Add the object <obj> to the list of objects <Obj> - */ -{ - if (*Obj == NULL) { - /* Create the root object */ - *Obj = (ComposeObj *) malloc( sizeof(ComposeObj) ); - if (!Obj) { - printf("AddObj: Error malloc'ing ComposeObj\n"); - exit(-1); - } - (*Obj)->objtype = objtype; - (*Obj)->obj = obj; - (*Obj)->next = NULL; - (*Obj)->prev = NULL; - } else { - ComposeObj *o = *Obj; - - /* create the next object */ - while (o->next) o = (ComposeObj *) o->next; - o->next = (struct ComposeObj *) malloc( sizeof(ComposeObj) ); - if (!o->next) { - printf("AddObj: Error malloc'ing o->next\n"); - exit(-1); - } - o->next->objtype = objtype; - o->next->obj = obj; - o->next->next = NULL; - o->next->prev = o; - } - - return; -} /* AddObj() */ - -void -FreeObj(ComposeObj *Obj) -/* - * Desc: free the memory occupied by *Obj - */ -{ - ComposeObj *o = Obj; - - o = Obj; - while (o) { - o = Obj->next; - free(Obj); - Obj = o; - } - - return; -} /* FreeObj() */ - - -int -ReadObj(ComposeObj *Obj) -/* - * Desc: navigate through the different objects calling their - * respective navigation routines as necessary - * Pre: Obj != NULL - */ -{ - ComposeObj *o; - ComposeObj *last; /* the last object in the list */ - int ret; /* the return value from the selection routine */ - - /* find the last object in the list */ - last = Obj; - while (last->next) last = last->next; - - ret = 0; - o = Obj; - while ((ret != SEL_BUTTON) && (ret != SEL_ESC)) { - switch(o->objtype) { - case STRINGOBJ: - ret = SelectStringObj((StringObj *) o->obj); - break; - case LISTOBJ: - ret = SelectListObj((ListObj *) o->obj); - break; - case BUTTONOBJ: - ret = SelectButtonObj((ButtonObj *) o->obj); - break; - } - switch(ret) { - case KEY_DOWN: - case SEL_CR: - case SEL_TAB: /* move to the next object in the list */ - if (o->next != NULL) { - o = o->next; /* next object */ - } else { - o = Obj; /* beginning of the list */ - } - break; - - case KEY_UP: - case SEL_BACKTAB: /* move to the previous object in the list */ - if (o->prev != NULL) { - o = o->prev; /* previous object */ - } else { - o = last; /* end of the list */ - } - break; - - case KEY_F(1): /* display help_file */ - case '?': - display_helpfile(); - break; - } - } - - return(ret); - -} /* ReadObj() */ - - -int -PollObj(ComposeObj **Obj) -{ - ComposeObj *last; /* the last object in the list */ - ComposeObj *first; /* the first object in the list */ - int ret; /* the return value from the selection routine */ - - /* find the last object in the list */ - last = *Obj; - while (last->next) last = last->next; - - /* find the first object in the list */ - first = *Obj; - while (first->prev) first = first->prev; - - ret = 0; - switch((*Obj)->objtype) { - case STRINGOBJ: - ret = SelectStringObj((StringObj *) (*Obj)->obj); - break; - case LISTOBJ: - ret = SelectListObj((ListObj *) (*Obj)->obj); - break; - case BUTTONOBJ: - ret = SelectButtonObj((ButtonObj *) (*Obj)->obj); - break; - } - switch(ret) { - case KEY_DOWN: - case SEL_CR: - case SEL_TAB: /* move to the next object in the list */ - if ((*Obj)->next != NULL) { - *Obj = (*Obj)->next; /* next object */ - } else { - *Obj = first; /* beginning of the list */ - } - break; - - case KEY_UP: - case SEL_BACKTAB: /* move to the previous object in the list */ - if ((*Obj)->prev != NULL) { - *Obj = (*Obj)->prev; /* previous object */ - } else { - *Obj = last; /* end of the list */ - } - break; - } - - return(ret); - -} /* PollObj() */ - - -void -DelObj(ComposeObj *Obj) -/* - * Desc: Free all objects - */ -{ - ComposeObj *o; - - o = Obj; - while (Obj != NULL) { - switch(Obj->objtype) { - case STRINGOBJ: - DelStringObj((StringObj *) Obj->obj); - break; - case LISTOBJ: - DelListObj((ListObj *) Obj->obj); - break; - case BUTTONOBJ: - DelButtonObj((ButtonObj *) Obj->obj); - break; - } - Obj = Obj->next; - } - - FreeObj(o); -} /* DelObj() */ - -/*********************************************************************** - * - * StringObj routines - * - ***********************************************************************/ - -static void -outstr(WINDOW *win, char *str, int attrs) -{ - if (attrs & DITEM_NO_ECHO) { - char *cpy; - int n = strlen(str); - - cpy = alloca(n + 1); - memset(cpy, '*', n); - cpy[n] = '\0'; - waddstr(win, cpy); - } - else - waddstr(win, str); -} - -void -RefreshStringObj(StringObj *so) -/* - * Desc: redraw the object - */ -{ - char tmp[512]; - - wmove(so->win, so->y, so->x+1); - wattrset(so->win, dialog_attr); - waddstr(so->win, so->title); - - draw_box(so->win, so->y+1, so->x, 3, so->w, dialog_attr, border_attr); - wattrset(so->win, item_attr); - wmove(so->win, so->y+2, so->x+1); - if (strlen(so->s) > so->w-2) { - strncpy(tmp, (char *) so->s + strlen(so->s) - so->w + 2, so->w - 1); - outstr(so->win, tmp, so->attr_mask); - } else { - outstr(so->win, so->s, so->attr_mask); - } - - return; -} /* RefreshStringObj() */ - -StringObj * -NewStringObj(WINDOW *win, char *title, char *s, int y, int x, int w, int len) -/* - * Desc: Initialize a new stringobj and return a pointer to it. - * Draw the object on the screen at the specified coordinates - */ -{ - StringObj *so; - - /* Initialize a new object */ - so = (StringObj *) malloc( sizeof(StringObj) ); - if (!so) { - printf("NewStringObj: Error malloc'ing StringObj\n"); - exit(-1); - } - so->title = (char *) malloc( strlen(title) + 1); - if (!so->title) { - printf("NewStringObj: Error malloc'ing so->title\n"); - exit(-1); - } - strcpy(so->title, title); - so->s = s; - strcpy(so->s, s); - so->x = x; - so->y = y; - so->w = w; - so->len = len; - so->win = win; - so->attr_mask = DialogInputAttrs; /* Grossly use a global to avoid changing API */ - - /* Draw it on the screen */ - RefreshStringObj(so); - - return(so); -} /* NewStringObj() */ - -int -SelectStringObj(StringObj *so) -/* - * Desc: get input using the info in <so> - */ -{ - int key; - char tmp[so->len+1]; - - strcpy(tmp, so->s); - key = line_edit(so->win, so->y+2, so->x+1, - so->len, so->w-2, inputbox_attr, TRUE, tmp, so->attr_mask); - if ((key == '\n') || (key == '\r') || (key == '\t') || key == (KEY_BTAB) ) { - strcpy(so->s, tmp); - } - RefreshStringObj(so); - if (key == ESC) { - return(SEL_ESC); - } - if (key == '\t') { - return(SEL_TAB); - } - if ( (key == KEY_BTAB) || (key == KEY_F(2)) ) { - return(SEL_BACKTAB); - } - if ((key == '\n') || (key == '\r')) { - return(SEL_CR); - } - return(key); -} /* SelectStringObj() */ - - -void -DelStringObj(StringObj *so) -/* - * Desc: Free the space occupied by <so> - */ -{ - free(so->title); - free(so); - - return; -} - -/*********************************************************************** - * - * ListObj routines - * - ***********************************************************************/ - -void -DrawNames(ListObj *lo) -/* - * Desc: Just refresh the names, not the surrounding box and title - */ -{ - int i, j, h, x, y; - char tmp[MAXPATHLEN]; - - x = lo->x + 1; - y = lo->y + 2; - h = lo->h - 2; - for (i=lo->scroll; i<lo->n && i<lo->scroll+h; i++) { - wmove(lo->win, y+i-lo->scroll, x); - if (lo->seld[i]) { - wattrset(lo->win, A_BOLD); - } else { - wattrset(lo->win, item_attr); - } - if (strlen(lo->name[i]) > lo->w-2) { - strncpy(tmp, lo->name[i], lo->w-2); - tmp[lo->w - 2] = 0; - waddstr(lo->win, tmp); - } else { - waddstr(lo->win, lo->name[i]); - for (j=strlen(lo->name[i]); j<lo->w-2; j++) waddstr(lo->win, " "); - } - } - wattrset(lo->win, item_attr); - while (i<lo->scroll+h) { - wmove(lo->win, y+i-lo->scroll, x); - for (j=0; j<lo->w-2; j++) waddstr(lo->win, " "); - i++; - } - - return; -} /* DrawNames() */ - -void -RefreshListObj(ListObj *lo) -/* - * Desc: redraw the list object - */ -{ - char perc[7]; - - /* setup the box */ - wmove(lo->win, lo->y, lo->x+1); - wattrset(lo->win, dialog_attr); - waddstr(lo->win, lo->title); - draw_box(lo->win, lo->y+1, lo->x, lo->h, lo->w, dialog_attr, border_attr); - - /* draw the names */ - DrawNames(lo); - - /* Draw % indication */ - sprintf(perc, "(%3d%%)", MIN(100, (int) (100 * (lo->sel+lo->h-2) / MAX(1, lo->n)))); - wmove(lo->win, lo->y + lo->h, lo->x + lo->w - 8); - wattrset(lo->win, dialog_attr); - waddstr(lo->win, perc); - - - return; -} /* RefreshListObj() */ - -ListObj * -NewListObj(WINDOW *win, char *title, char **list, char *listelt, int y, int x, - int h, int w, int n) -/* - * Desc: create a listobj, draw it on the screen and return a pointer to it. - */ -{ - ListObj *lo; - int i; - - /* Initialize a new object */ - lo = (ListObj *) malloc( sizeof(ListObj) ); - if (!lo) { - fprintf(stderr, "NewListObj: Error malloc'ing ListObj\n"); - exit(-1); - } - lo->title = (char *) malloc( strlen(title) + 1); - if (!lo->title) { - fprintf(stderr, "NewListObj: Error malloc'ing lo->title\n"); - exit(-1); - } - strcpy(lo->title, title); - lo->name = list; - if (n>0) { - lo->seld = (int *) malloc( n * sizeof(int) ); - if (!lo->seld) { - fprintf(stderr, "NewListObj: Error malloc'ing lo->seld\n"); - exit(-1); - } - for (i=0; i<n; i++) { - lo->seld[i] = FALSE; - } - } else { - lo->seld = NULL; - } - lo->y = y; - lo->x = x; - lo->w = w; - lo->h = h; - lo->n = n; - lo->scroll = 0; - lo->sel = 0; - lo->elt = listelt; - lo->win = win; - - /* Draw the object on the screen */ - RefreshListObj(lo); - - return(lo); -} /* NewListObj() */ - -void -UpdateListObj(ListObj *lo, char **list, int n) -/* - * Desc: Update the list in the listobject with the provided list - * Pre: lo->name "has been freed" - * "(A i: 0<=i<lo->n: "lo->name[i] has been freed")" - */ -{ - int i; - - if (lo->seld) { - free(lo->seld); - } - - /* Rewrite the list in the object */ - lo->name = list; - if (n>0) { - lo->seld = (int *) malloc( n * sizeof(int) ); - if (!lo->seld) { - fprintf(stderr, "UpdateListObj: Error malloc'ing lo->seld\n"); - exit(-1); - } - for (i=0; i<n; i++) { - lo->seld[i] = FALSE; - } - } else { - lo->seld = NULL; - } - lo->n = n; - lo->scroll = 0; - lo->sel = 0; - - /* Draw the object on the screen */ - RefreshListObj(lo); - - return; -} /* UpdateListObj() */ - -int -SelectListObj(ListObj *lo) -/* - * Desc: get a listname (or listnames), TAB to move on, or ESC ESC to exit - * Pre: lo->n >= 1 - */ -{ - int key, sel_x, sel_y, quit; - char tmp[MAXPATHLEN]; - char perc[4]; - - sel_x = lo->x+1; - sel_y = lo->y + 2 + lo->sel - lo->scroll; - - if (lo->n == 0) return(SEL_TAB); - - keypad(lo->win, TRUE); - - /* Draw current selection in inverse video */ - wmove(lo->win, sel_y, sel_x); - wattrset(lo->win, item_selected_attr); - waddstr(lo->win, lo->name[lo->sel]); - - key = wgetch(lo->win); - quit = FALSE; - while ((key != '\t') && (key != '\n') && (key != '\r') - && (key != ESC) && (key != KEY_F(1)) && (key != '?') && !quit) { - /* first draw current item in normal video */ - wmove(lo->win, sel_y, sel_x); - if (lo->seld[lo->sel]) { - wattrset(lo->win, A_BOLD); - } else { - wattrset(lo->win, item_attr); - } - if (strlen(lo->name[lo->sel]) > lo->w - 2) { - strncpy(tmp, lo->name[lo->sel], lo->w - 2); - tmp[lo->w - 2] = 0; - waddstr(lo->win, tmp); - } else { - waddstr(lo->win, lo->name[lo->sel]); - } - - switch (key) { - case KEY_DOWN: - case ctrl('n'): - if (sel_y < lo->y + lo->h-1) { - if (lo->sel < lo->n-1) { - sel_y++; - lo->sel++; - } - } else { - if (lo->sel < lo->n-1) { - lo->sel++; - lo->scroll++; - DrawNames(lo); - wrefresh(lo->win); - } - } - break; - case KEY_UP: - case ctrl('p'): - if (sel_y > lo->y+2) { - if (lo->sel > 0) { - sel_y--; - lo->sel--; - } - } else { - if (lo->sel > 0) { - lo->sel--; - lo->scroll--; - DrawNames(lo); - wrefresh(lo->win); - } - } - break; - case KEY_HOME: - case ctrl('a'): - lo->sel = 0; - lo->scroll = 0; - sel_y = lo->y + 2; - DrawNames(lo); - wrefresh(lo->win); - break; - case KEY_END: - case ctrl('e'): - if (lo->n < lo->h - 3) { - lo->sel = lo->n-1; - lo->scroll = 0; - sel_y = lo->y + 2 + lo->sel - lo->scroll; - } else { - /* more than one page of list */ - lo->sel = lo->n-1; - lo->scroll = lo->n-1 - (lo->h-3); - sel_y = lo->y + 2 + lo->sel - lo->scroll; - DrawNames(lo); - wrefresh(lo->win); - } - break; - case KEY_NPAGE: - case ctrl('f'): - lo->sel += lo->h - 2; - if (lo->sel >= lo->n) lo->sel = lo->n - 1; - lo->scroll += lo->h - 2; - if (lo->scroll >= lo->n - 1) lo->scroll = lo->n - 1; - if (lo->scroll < 0) lo->scroll = 0; - sel_y = lo->y + 2 + lo->sel - lo->scroll; - DrawNames(lo); - wrefresh(lo->win); - break; - case KEY_PPAGE: - case ctrl('b'): - lo->sel -= lo->h - 2; - if (lo->sel < 0) lo->sel = 0; - lo->scroll -= lo->h - 2; - if (lo->scroll < 0) lo->scroll = 0; - sel_y = lo->y + 2 + lo->sel - lo->scroll; - DrawNames(lo); - wrefresh(lo->win); - break; - default: - quit = TRUE; - break; - } - /* Draw % indication */ - sprintf(perc, "(%3d%%)", MIN(100, (int) - (100 * (lo->sel+lo->h - 2) / MAX(1, lo->n)))); - wmove(lo->win, lo->y + lo->h, lo->x + lo->w - 8); - wattrset(lo->win, dialog_attr); - waddstr(lo->win, perc); - - /* draw current item in inverse */ - wmove(lo->win, sel_y, sel_x); - wattrset(lo->win, item_selected_attr); - if (strlen(lo->name[lo->sel]) > lo->w - 2) { - /* when printing in inverse video show the last characters in the */ - /* name that will fit in the window */ - strncpy(tmp, - lo->name[lo->sel] + strlen(lo->name[lo->sel]) - (lo->w - 2), - lo->w - 2); - tmp[lo->w - 2] = 0; - waddstr(lo->win, tmp); - } else { - waddstr(lo->win, lo->name[lo->sel]); - } - if (!quit) key = wgetch(lo->win); - } - - if (key == ESC) { - return(SEL_ESC); - } - if (key == '\t') { - return(SEL_TAB); - } - if ((key == KEY_BTAB) || (key == ctrl('b'))) { - return(SEL_BACKTAB); - } - if ((key == '\n') || (key == '\r')) { - strcpy(lo->elt, lo->name[lo->sel]); - return(SEL_CR); - } - return(key); -} /* SelectListObj() */ - -void -DelListObj(ListObj *lo) -/* - * Desc: Free the space occupied by the listobject - */ -{ - free(lo->title); - if (lo->seld != NULL) free(lo->seld); - free(lo); - - return; -} /* DelListObj() */ - -void -MarkCurrentListObj(ListObj *lo) -/* - * Desc: mark the current item for the selection list - */ -{ - lo->seld[lo->sel] = !(lo->seld[lo->sel]); - DrawNames(lo); - - return; -} /* MarkCurrentListObj() */ - -void -MarkAllListObj(ListObj *lo) -/* - * Desc: mark all items - */ -{ - int i; - - for (i=0; i<lo->n; i++) { - lo->seld[i] = TRUE; - } - DrawNames(lo); - - return; -} /* MarkAllListObj() */ - -void -UnMarkAllListObj(ListObj *lo) -/* - * Desc: unmark all items - */ -{ - int i; - - for (i=0; i<lo->n; i++) { - lo->seld[i] = FALSE; - } - DrawNames(lo); - - return; -} /* UnMarkAllListObj() */ - - -/*********************************************************************** - * - * ButtonObj routines - * - ***********************************************************************/ - - -void -RefreshButtonObj(ButtonObj *bo) -/* - * Desc: redraw the button - */ -{ - draw_box(bo->win, bo->y, bo->x, 3, bo->w, dialog_attr, border_attr); - print_button(bo->win, bo->title, bo->y+1, bo->x+2, FALSE); - - return; -} /* RefreshButtonObj() */ - -ButtonObj * -NewButtonObj(WINDOW *win, char *title, int *pushed, int y, int x) -/* - * Desc: Create a new button object - */ -{ - ButtonObj *bo; - - bo = (ButtonObj *) malloc( sizeof(ButtonObj) ); - - bo->win = win; - bo->title = (char *) malloc( strlen(title) + 1); - strcpy(bo->title, title); - bo->x = x; - bo->y = y; - bo->w = strlen(title) + 6; - bo->h = 3; - bo->pushed = pushed; - - RefreshButtonObj(bo); - - return(bo); -} /* NewButtonObj() */ - -int -SelectButtonObj(ButtonObj *bo) -/* - * Desc: Wait for buttonpresses or TAB's to move on, or ESC ESC - */ -{ - int key; - - print_button(bo->win, bo->title, bo->y+1, bo->x+2, TRUE); - wmove(bo->win, bo->y+1, bo->x+(bo->w/2)-1); - key = wgetch(bo->win); - print_button(bo->win, bo->title, bo->y+1, bo->x+2, FALSE); - switch(key) { - case '\t': - return(SEL_TAB); - break; - case KEY_BTAB: - case ctrl('b'): - return(SEL_BACKTAB); - case '\n': - case '\r': - *(bo->pushed) = TRUE; - return(SEL_BUTTON); - break; - case ESC: - return(SEL_ESC); - break; - default: - return(key); - break; - } -} /* SelectButtonObj() */ - -void -DelButtonObj(ButtonObj *bo) -/* - * Desc: Free the space occupied by <bo> - */ -{ - free(bo->title); - free(bo); - - return; -} /* DelButtonObj() */ Index: gnu/lib/libdialog/CHANGES =================================================================== --- gnu/lib/libdialog/CHANGES (revision 216873) +++ gnu/lib/libdialog/CHANGES (working copy) @@ -1,9 +0,0 @@ -- Added two variables to call to dialog_menu() to save the position - in the menu when choosing a menu-option. - -- Added dialog_fselect(), implements a fileselector dialog -- Added ui-interface objects: Stringobject, Listobject and Buttonobject. - The fileselector dialog was built using these objects. -- changed dialog_menu to use PGUP and PGDN -- Added dialog_mesgbox, which display text given in a char buffer. -- Index: gnu/lib/libdialog/COPYING =================================================================== --- gnu/lib/libdialog/COPYING (revision 216873) +++ gnu/lib/libdialog/COPYING (working copy) @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program 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 of the License, or - (at your option) any later version. - - 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 General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. Index: gnu/lib/libdialog/gauge.c =================================================================== --- gnu/lib/libdialog/gauge.c (revision 216873) +++ gnu/lib/libdialog/gauge.c (working copy) @@ -1,79 +0,0 @@ -/* - * gauge.c - * - * progress indicator for libdialog - * - * - * Copyright (c) 1995, Marc van Kempen - * - * All rights reserved. - * - * This software may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdlib.h> -#include <string.h> - -#include "dialog.h" - -void -dialog_gauge(char *title, char *prompt, int y, int x, - int height, int width, int perc) -/* - * Desc: display a progress bar, progress indicated by <perc> - */ -{ - WINDOW *gw; - int glen, i; - char percs[5]; - - gw = newwin(height, width, y, x); - if (!gw) { - fprintf(stderr, "dialog_gauge: Error creating window (%d, %d, %d, %d)", - height, width, y, x); - exit(-1); - } - - draw_box(gw, 0, 0, height, width, dialog_attr, border_attr); - draw_shadow(stdscr, y, x, height, width); - - wattrset(gw, title_attr); - if (title) { - wmove(gw, 0, (width - strlen(title))/2 - 1); - waddstr(gw, "[ "); - waddstr(gw, title); - waddstr(gw, " ]"); - } - wattrset(gw, dialog_attr); - if (prompt) { - wmove(gw, 1, (width - strlen(prompt))/2 - 1); - waddstr(gw, prompt); - } - - draw_box(gw, 2, 2, 3, width-4, dialog_attr, border_attr); - glen = (int) ((float) perc/100 * (width-6)); - - wattrset(gw, dialog_attr); - sprintf(percs, "%3d%%", perc); - wmove(gw, 5, width/2 - 2); - waddstr(gw, percs); - - wattrset(gw, A_BOLD); - wmove(gw, 3, 3); - for (i=0; i<glen; i++) waddch(gw, ' '); - - wrefresh(gw); - delwin(gw); - - return; -} /* dialog_gauge() */ - Index: gnu/lib/libdialog/raw_popen.c =================================================================== --- gnu/lib/libdialog/raw_popen.c (revision 216873) +++ gnu/lib/libdialog/raw_popen.c (working copy) @@ -1,161 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software written by Ken Arnold and - * published in UNIX Review, Vol. 6, No. 8. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)popen.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/wait.h> - -#include <signal.h> -#include <errno.h> -#include <unistd.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <paths.h> - -static struct pid { - struct pid *next; - FILE *fp; - pid_t pid; -} *pidlist; - -FILE * -raw_popen(const char *program, char * const *argv, const char *type) -{ - struct pid *cur; - FILE *iop; - int pdes[2], pid; - - if ((*type != 'r' && *type != 'w') || type[1]) - return (NULL); - - if ((cur = malloc(sizeof(struct pid))) == NULL) - return (NULL); - - if (pipe(pdes) < 0) { - (void)free(cur); - return (NULL); - } - - switch (pid = vfork()) { - case -1: /* Error. */ - (void)close(pdes[0]); - (void)close(pdes[1]); - (void)free(cur); - return (NULL); - /* NOTREACHED */ - case 0: /* Child. */ - if (*type == 'r') { - if (pdes[1] != STDOUT_FILENO) { - (void)dup2(pdes[1], STDOUT_FILENO); - (void)close(pdes[1]); - } - (void) close(pdes[0]); - } else { - if (pdes[0] != STDIN_FILENO) { - (void)dup2(pdes[0], STDIN_FILENO); - (void)close(pdes[0]); - } - (void)close(pdes[1]); - } - if (argv == NULL) - execl(_PATH_BSHELL, "sh", "-c", program, (char *)NULL); - else - execvp(program, argv); - _exit(127); - /* NOTREACHED */ - } - - /* Parent; assume fdopen can't fail. */ - if (*type == 'r') { - iop = fdopen(pdes[0], type); - (void)close(pdes[1]); - } else { - iop = fdopen(pdes[1], type); - (void)close(pdes[0]); - } - - /* Link into list of file descriptors. */ - cur->fp = iop; - cur->pid = pid; - cur->next = pidlist; - pidlist = cur; - - return (iop); -} - -/* - * pclose -- - * Pclose returns -1 if stream is not associated with a `popened' command, - * if already `pclosed', or waitpid returns an error. - */ -int -raw_pclose(FILE *iop) -{ - register struct pid *cur, *last; - int omask, pstat; - pid_t pid; - - (void)fclose(iop); - - /* Find the appropriate file pointer. */ - for (last = NULL, cur = pidlist; cur; last = cur, cur = cur->next) - if (cur->fp == iop) - break; - if (cur == NULL) - return (-1); - - /* Get the status of the process. */ - omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); - do { - pid = waitpid(cur->pid, (int *) &pstat, 0); - } while (pid == -1 && errno == EINTR); - (void)sigsetmask(omask); - - /* Remove the entry from the linked list. */ - if (last == NULL) - pidlist = cur->next; - else - last->next = cur->next; - free(cur); - - return (pid == -1 ? -1 : pstat); -} Index: gnu/lib/libdialog/ui_objects.h =================================================================== --- gnu/lib/libdialog/ui_objects.h (revision 216873) +++ gnu/lib/libdialog/ui_objects.h (working copy) @@ -1,114 +0,0 @@ -/* - * Author: Marc van Kempen - * Desc: include file for UI-objects - * - * Copyright (c) 1995, Marc van Kempen - * - * All rights reserved. - * - * This software may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with - * its use. - * - */ - -#include "dialog.h" -#include <ncurses.h> - -/*********************************************************************** - * - * Defines - * - ***********************************************************************/ - -#define ctrl(a) ((a) - 'a' + 1) - -/* the Object types */ -#define STRINGOBJ 1 -#define LISTOBJ 2 -#define BUTTONOBJ 3 - -/* the return signals from the selection routines */ -/* 1000 and higher should avoid conflicts with keys pressed */ -#define SEL_CR 1001 /* return was pressed */ -#define SEL_ESC 1002 /* ESC pressed */ -#define SEL_TAB 1003 /* TAB pressed */ -#define SEL_BACKTAB 1004 /* SHIFT-TAB pressed */ -#define SEL_BUTTON 1005 /* a button was pressed */ - -/*********************************************************************** - * - * Typedefs - * - ***********************************************************************/ - -typedef struct { - WINDOW *win; /* the window it's contained in */ - char *title; /* the prompt for the input field */ - char *s; /* initial value of the input field */ - int x, y, w, len; /* the (y, x) position of the upperleft */ - /* corner and the width <w> of the display */ - /* and length <len> of the field */ - int attr_mask; /* special attributes */ -} StringObj; - -typedef struct { - WINDOW *win; /* the windows it's contained in */ - char *title; /* the title of the list */ - char **name; /* the names of the list */ - int *seld; /* the currently selected names */ - char *elt; /* the current element in the list list[sel] */ - int x, y, w, h, n; /* dimensions of list and # of elements (n) */ - int scroll, sel; /* current position in the list */ -} ListObj; - -typedef struct { - WINDOW *win; /* the window it's contained in */ - char *title; /* title for the button */ - int x, y, w, h; /* its dimensions */ - int *pushed; /* boolean that determines wether button was pushed */ -} ButtonObj; - -typedef struct ComposeObj { - int objtype; - void *obj; - struct ComposeObj *next, *prev; -} ComposeObj; - -/********************************************************************** - * - * Prototypes - * - **********************************************************************/ - -void RefreshStringObj(StringObj *so); -StringObj *NewStringObj(WINDOW *win, char *title, char *s, - int y, int x, int w, int len); -int SelectStringObj(StringObj *so); -void DelStringObj(StringObj *so); - -void RefreshListObj(ListObj *lo); -ListObj *NewListObj(WINDOW *win, char *title, char **list, - char *listelt, int y, int x, int h, int w, int n); -void UpdateListObj(ListObj *lo, char **list, int n); -int SelectListObj(ListObj *lo); -void DelListObj(ListObj *obj); -void MarkCurrentListObj(ListObj *lo); -void MarkAllListObj(ListObj *lo); -void UnMarkAllListObj(ListObj *lo); - -void RefreshButtonObj(ButtonObj *bo); -ButtonObj *NewButtonObj(WINDOW *win, char *title, int *pushed, - int y, int x); -int SelectButtonObj(ButtonObj *bo); -void DelButtonObj(ButtonObj *bo); -void AddObj(ComposeObj **Obj, int objtype, void *obj); -void FreeObj(ComposeObj *Obj); -int ReadObj(ComposeObj *Obj); -int PollObj(ComposeObj **Obj); -void DelObj(ComposeObj *Obj); - Index: gnu/lib/libdialog/Makefile =================================================================== --- gnu/lib/libdialog/Makefile (revision 216873) +++ gnu/lib/libdialog/Makefile (working copy) @@ -1,47 +0,0 @@ -# Makefile for libdialog -# $FreeBSD$ - -.include <bsd.own.mk> - -LIB= dialog -INCS= dialog.h -MAN= dialog.3 - -SHLIB_MAJOR= 7 -SRCS= kernel.c rc.c checklist.c inputbox.c menubox.c msgbox.c \ - lineedit.c radiolist.c textbox.c yesno.c prgbox.c raw_popen.c \ - fselect.c ui_objects.c dir.c notify.c help.c gauge.c tree.c - -EXAMPLES= Makefile check1.c check2.c check3.c dselect.c fselect.c \ - ftree1.c ftree1.test ftree2.c ftree2.test gauge.c input1.c \ - input2.c menu1.c menu2.c menu3.c msg.c prgbox.c radio1.c \ - radio2.c radio3.c text.c tree.c yesno.c - -CFLAGS+= -I${.CURDIR} -Wall -Wstrict-prototypes -DLOCALE - -DPADD= ${LIBNCURSES} -LDADD= -lncurses - -.if ${MK_HTML} != "no" -FILES= ${EXAMPLES:C;^;${.CURDIR}/TESTS/;} -FILESDIR= ${SHAREDIR}/examples/libdialog -.endif - -MLINKS+=dialog.3 draw_shadow.3 dialog.3 draw_box.3 \ - dialog.3 line_edit.3 dialog.3 strheight.3 \ - dialog.3 strwidth.3 dialog.3 dialog_create_rc.3 \ - dialog.3 dialog_yesno.3 dialog.3 dialog_noyes.3 \ - dialog.3 dialog_prgbox.3 \ - dialog.3 dialog_textbox.3 dialog.3 dialog_menu.3 \ - dialog.3 dialog_checklist.3 dialog.3 dialog_radiolist.3 \ - dialog.3 dialog_inputbox.3 dialog.3 dialog_clear_norefresh.3 \ - dialog.3 dialog_clear.3 dialog.3 dialog_update.3 \ - dialog.3 dialog_fselect.3 dialog.3 dialog_notify.3 \ - dialog.3 dialog_mesgbox.3 dialog.3 dialog_gauge.3 \ - dialog.3 init_dialog.3 dialog.3 end_dialog.3 \ - dialog.3 use_helpfile.3 dialog.3 use_helpline.3 \ - dialog.3 get_helpline.3 dialog.3 restore_helpline.3 \ - dialog.3 dialog_msgbox.3 dialog.3 dialog_ftree.3 \ - dialog.3 dialog_tree.3 - -.include <bsd.lib.mk> Index: gnu/lib/libdialog/yesno.c =================================================================== --- gnu/lib/libdialog/yesno.c (revision 216873) +++ gnu/lib/libdialog/yesno.c (working copy) @@ -1,169 +0,0 @@ -/* - * yesno.c -- implements the yes/no box - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <dialog.h> -#include "dialog.priv.h" - -/* Actual work function */ -static int dialog_yesno_proc(unsigned char *title, unsigned char *prompt, - int height, int width, int yesdefault); - -/* - * Display a dialog box with two buttons - Yes and No - */ -int -dialog_yesno(unsigned char *title, unsigned char *prompt, int height, int width) -{ - return dialog_yesno_proc(title, prompt, height, width, TRUE); -} - -/* - * Display a dialog box with two buttons - No and Yes - */ -int -dialog_noyes(unsigned char *title, unsigned char *prompt, int height, int width) -{ - return dialog_yesno_proc(title, prompt, height, width, FALSE); -} - -static int -dialog_yesno_proc(unsigned char *title, unsigned char *prompt, int height, int width, int yesdefault) -{ - int i, j, x, y, key, button; - WINDOW *dialog; - char *tmphlp; - - /* disable helpline */ - tmphlp = get_helpline(); - use_helpline(NULL); - - if (height < 0) - height = strheight(prompt)+4; - if (width < 0) { - i = strwidth(prompt); - j = ((title != NULL) ? strwidth(title) : 0); - width = MAX(i,j)+4; - } - width = MAX(width,23); - - if (width > COLS) - width = COLS; - if (height > LINES) - height = LINES; - /* center dialog box on screen */ - x = DialogX ? DialogX : (COLS - width)/2; - y = DialogY ? DialogY : (LINES - height)/2; - -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(stdscr, y, x, height, width); -#endif - dialog = newwin(height, width, y, x); - if (dialog == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); - exit(1); - } - keypad(dialog, TRUE); - - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - wattrset(dialog, border_attr); - wmove(dialog, height-3, 0); - waddch(dialog, ACS_LTEE); - for (i = 0; i < width-2; i++) - waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - waddch(dialog, ACS_RTEE); - wmove(dialog, height-2, 1); - for (i = 0; i < width-2; i++) - waddch(dialog, ' '); - - if (title != NULL) { - wattrset(dialog, title_attr); - wmove(dialog, 0, (width - strlen(title))/2 - 1); - waddch(dialog, ' '); - waddstr(dialog, title); - waddch(dialog, ' '); - } - wattrset(dialog, dialog_attr); - wmove(dialog, 1, 2); - print_autowrap(dialog, prompt, height-1, width-2, width, 1, 2, TRUE, FALSE); - - display_helpline(dialog, height-1, width); - - x = width/2-10; - y = height-2; - - /* preset button 0 or 1 for YES or NO as the default */ - key = 0; - button = !yesdefault; - while (key != ESC) { - print_button(dialog, " No ", y, x+13, button); - print_button(dialog, " Yes " , y, x, !button); - if (button) - wmove(dialog, y, x+16); - else - wmove(dialog, y, x+2); - wrefresh(dialog); - - key = wgetch(dialog); - switch (key) { - case 'Y': - case 'y': - delwin(dialog); - restore_helpline(tmphlp); - return 0; - case 'N': - case 'n': - delwin(dialog); - restore_helpline(tmphlp); - return 1; - case KEY_BTAB: - case TAB: - case KEY_UP: - case KEY_DOWN: - case KEY_LEFT: - case KEY_RIGHT: - button = !button; - /* redrawn at the loop's entry */ - break; - case ' ': - case '\r': - case '\n': - delwin(dialog); - restore_helpline(tmphlp); - return button; - case ESC: - break; - case KEY_F(1): - case '?': - display_helpfile(); - break; - } - } - - delwin(dialog); - restore_helpline(tmphlp); - return -1; /* ESC pressed */ -} -/* End of dialog_yesno() */ Index: gnu/lib/libdialog/textbox.c =================================================================== --- gnu/lib/libdialog/textbox.c (revision 216873) +++ gnu/lib/libdialog/textbox.c (working copy) @@ -1,699 +0,0 @@ -/* - * textbox.c -- implements the text box - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <dialog.h> -#include "dialog.priv.h" - - -static void back_lines(int n); -static void print_page(WINDOW *win, int height, int width); -static void print_line(WINDOW *win, int row, int width); -static unsigned char *get_line(void); -static int get_search_term(WINDOW *win, unsigned char *search_term, int height, int width); -static void print_position(WINDOW *win, int height, int width); - - -static int hscroll = 0, fd, file_size, bytes_read, begin_reached = 1, - end_reached = 0, page_length; -static unsigned char *buf, *page; - - -/* - * Display text from a file in a dialog box. - */ -int dialog_textbox(unsigned char *title, unsigned char *file, int height, int width) -{ - int i, x, y, cur_x, cur_y, fpos, key = 0, dir, temp, temp1; -#ifdef HAVE_NCURSES - int passed_end; -#endif - unsigned char search_term[MAX_LEN+1], *tempptr, *found; - WINDOW *dialog, *text; - - if (height < 0 || width < 0) { - fprintf(stderr, "\nAutosizing is impossible in dialog_textbox().\n"); - return(-1); - } - - search_term[0] = '\0'; /* no search term entered yet */ - - /* Open input file for reading */ - if ((fd = open(file, O_RDONLY)) == -1) { - fprintf(stderr, "\nCan't open input file <%s>in dialog_textbox().\n", file); - return(-1); - } - /* Get file size. Actually, 'file_size' is the real file size - 1, - since it's only the last byte offset from the beginning */ - if ((file_size = lseek(fd, 0, SEEK_END)) == -1) { - fprintf(stderr, "\nError getting file size in dialog_textbox().\n"); - return(-1); - } - /* Restore file pointer to beginning of file after getting file size */ - if (lseek(fd, 0, SEEK_SET) == -1) { - fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); - return(-1); - } - /* Allocate space for read buffer */ - if ((buf = malloc(BUF_SIZE+1)) == NULL) { - endwin(); - fprintf(stderr, "\nCan't allocate memory in dialog_textbox().\n"); - exit(-1); - } - if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) { - fprintf(stderr, "\nError reading file in dialog_textbox().\n"); - return(-1); - } - buf[bytes_read] = '\0'; /* mark end of valid data */ - page = buf; /* page is pointer to start of page to be displayed */ - - if (width > COLS) - width = COLS; - if (height > LINES) - height = LINES; - /* center dialog box on screen */ - x = DialogX ? DialogX : (COLS - width)/2; - y = DialogY ? DialogY : (LINES - height)/2; - -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(stdscr, y, x, height, width); -#endif - dialog = newwin(height, width, y, x); - if (dialog == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); - exit(1); - } - keypad(dialog, TRUE); - - /* Create window for text region, used for scrolling text */ -/* text = newwin(height-4, width-2, y+1, x+1); */ - text = subwin(dialog, height-4, width-2, y+1, x+1); - if (text == NULL) { - endwin(); - fprintf(stderr, "\nsubwin(dialog,%d,%d,%d,%d) failed, maybe wrong dims\n", height-4,width-2,y+1,x+1); - exit(1); - } - keypad(text, TRUE); - - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - - wattrset(dialog, border_attr); - wmove(dialog, height-3, 0); - waddch(dialog, ACS_LTEE); - for (i = 0; i < width-2; i++) - waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - waddch(dialog, ACS_RTEE); - wmove(dialog, height-2, 1); - for (i = 0; i < width-2; i++) - waddch(dialog, ' '); - - if (title != NULL) { - wattrset(dialog, title_attr); - wmove(dialog, 0, (width - strlen(title))/2 - 1); - waddch(dialog, ' '); - waddstr(dialog, title); - waddch(dialog, ' '); - } - display_helpline(dialog, height-1, width); - - print_button(dialog, " OK ", height-2, width/2-6, TRUE); - wnoutrefresh(dialog); - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - - /* Print first page of text */ - attr_clear(text, height-4, width-2, dialog_attr); - print_page(text, height-4, width-2); - print_position(dialog, height, width); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - - while ((key != ESC) && (key != '\n') && (key != '\r') && (key != ' ')) { - key = wgetch(dialog); - switch (key) { - case 'E': /* Exit */ - case 'e': - delwin(dialog); - free(buf); - close(fd); - return 0; - case 'g': /* First page */ - case KEY_HOME: - if (!begin_reached) { - begin_reached = 1; - /* First page not in buffer? */ - if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); - exit(-1); - } - if (fpos > bytes_read) { /* Yes, we have to read it in */ - if (lseek(fd, 0, SEEK_SET) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); - exit(-1); - } - if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) { - endwin(); - fprintf(stderr, "\nError reading file in dialog_textbox().\n"); - exit(-1); - } - buf[bytes_read] = '\0'; - } - page = buf; - print_page(text, height-4, width-2); - print_position(dialog, height, width); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } - break; - case 'G': /* Last page */ -#ifdef HAVE_NCURSES - case KEY_END: -#endif - end_reached = 1; - /* Last page not in buffer? */ - if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); - exit(-1); - } - if (fpos < file_size) { /* Yes, we have to read it in */ - if (lseek(fd, -BUF_SIZE, SEEK_END) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); - exit(-1); - } - if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) { - endwin(); - fprintf(stderr, "\nError reading file in dialog_textbox().\n"); - exit(-1); - } - buf[bytes_read] = '\0'; - } - page = buf + bytes_read; - back_lines(height-4); - print_page(text, height-4, width-2); - print_position(dialog, height, width); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - break; - case 'K': /* Previous line */ - case 'k': - case '\020': /* ^P */ - case KEY_UP: - if (!begin_reached) { - back_lines(page_length+1); -#ifdef HAVE_NCURSES - /* We don't call print_page() here but use scrolling to ensure - faster screen update. However, 'end_reached' and 'page_length' - should still be updated, and 'page' should point to start of - next page. This is done by calling get_line() in the following - 'for' loop. */ - scrollok(text, TRUE); - wscrl(text, -1); /* Scroll text region down one line */ - scrollok(text, FALSE); - page_length = 0; - passed_end = 0; - for (i = 0; i < height-4; i++) { - if (!i) { - print_line(text, 0, width-2); /* print first line of page */ - wnoutrefresh(text); - } - else - get_line(); /* Called to update 'end_reached' and 'page' */ - if (!passed_end) - page_length++; - if (end_reached && !passed_end) - passed_end = 1; - } -#else - print_page(text, height-4, width-2); -#endif - print_position(dialog, height, width); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } - break; - case 'B': /* Previous page */ - case 'b': - case KEY_PPAGE: - if (!begin_reached) { - back_lines(page_length + height-4); - print_page(text, height-4, width-2); - print_position(dialog, height, width); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } - break; - case 'J': /* Next line */ - case 'j': - case '\016': /* ^N */ - case KEY_DOWN: - if (!end_reached) { - begin_reached = 0; - scrollok(text, TRUE); - scroll(text); /* Scroll text region up one line */ - scrollok(text, FALSE); - print_line(text, height-5, width-2); -#ifndef HAVE_NCURSES - wmove(text, height-5, 0); - waddch(text, ' '); - wmove(text, height-5, width-3); - waddch(text, ' '); -#endif - wnoutrefresh(text); - print_position(dialog, height, width); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } - break; - case 'F': /* Next page */ - case 'f': - case KEY_NPAGE: - if (!end_reached) { - begin_reached = 0; - print_page(text, height-4, width-2); - print_position(dialog, height, width); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } - break; - case '0': /* Beginning of line */ - case 'H': /* Scroll left */ - case 'h': - case KEY_LEFT: - if (hscroll > 0) { - if (key == '0') - hscroll = 0; - else - hscroll--; - /* Reprint current page to scroll horizontally */ - back_lines(page_length); - print_page(text, height-4, width-2); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } - break; - case 'L': /* Scroll right */ - case 'l': - case KEY_RIGHT: - if (hscroll < MAX_LEN) { - hscroll++; - /* Reprint current page to scroll horizontally */ - back_lines(page_length); - print_page(text, height-4, width-2); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } - break; - case '/': /* Forward search */ - case 'n': /* Repeat forward search */ - case '?': /* Backward search */ - case 'N': /* Repeat backward search */ - /* set search direction */ - dir = (key == '/' || key == 'n') ? 1 : 0; - if (dir ? !end_reached : !begin_reached) { - if (key == 'n' || key == 'N') { - if (search_term[0] == '\0') { /* No search term yet */ - fprintf(stderr, "\a"); /* beep */ - break; - } - } - else /* Get search term from user */ - if (get_search_term(text, search_term, height-4, width-2) == -1) { - /* ESC pressed in get_search_term(). Reprint page to clear box */ - wattrset(text, dialog_attr); - back_lines(page_length); - print_page(text, height-4, width-2); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - break; - } - /* Save variables for restoring in case search term can't be found */ - tempptr = page; - temp = begin_reached; - temp1 = end_reached; - if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); - exit(-1); - } - fpos -= bytes_read; - /* update 'page' to point to next (previous) line before - forward (backward) searching */ - back_lines(dir ? page_length-1 : page_length+1); - found = NULL; - if (dir) /* Forward search */ - while((found = strstr(get_line(), search_term)) == NULL) { - if (end_reached) - break; - } - else /* Backward search */ - while((found = strstr(get_line(), search_term)) == NULL) { - if (begin_reached) - break; - back_lines(2); - } - if (found == NULL) { /* not found */ - fprintf(stderr, "\a"); /* beep */ - /* Restore program state to that before searching */ - if (lseek(fd, fpos, SEEK_SET) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); - exit(-1); - } - if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) { - endwin(); - fprintf(stderr, "\nError reading file in dialog_textbox().\n"); - exit(-1); - } - buf[bytes_read] = '\0'; - page = tempptr; - begin_reached = temp; - end_reached = temp1; - /* move 'page' to point to start of current page in order to - re-print current page. Note that 'page' always points to - start of next page, so this is necessary */ - back_lines(page_length); - } - else /* Search term found */ - back_lines(1); - /* Reprint page */ - wattrset(text, dialog_attr); - print_page(text, height-4, width-2); - if (found != NULL) - print_position(dialog, height, width); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } - else /* no need to find */ - fprintf(stderr, "\a"); /* beep */ - break; - case ESC: - break; - case KEY_F(1): - display_helpfile(); - break; - } - } - - delwin(dialog); - free(buf); - close(fd); - return (key == ESC ? -1 : 0); -} -/* End of dialog_textbox() */ - - -/* - * Go back 'n' lines in text file. Called by dialog_textbox(). - * 'page' will be updated to point to the desired line in 'buf'. - */ -static void back_lines(int n) -{ - int i, fpos; - - begin_reached = 0; - /* We have to distinguish between end_reached and !end_reached since at end - of file, the line is not ended by a '\n'. The code inside 'if' basically - does a '--page' to move one character backward so as to skip '\n' of the - previous line */ - if (!end_reached) { - /* Either beginning of buffer or beginning of file reached? */ - if (page == buf) { - if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in back_lines().\n"); - exit(-1); - } - if (fpos > bytes_read) { /* Not beginning of file yet */ - /* We've reached beginning of buffer, but not beginning of file yet, - so read previous part of file into buffer. Note that we only - move backward for BUF_SIZE/2 bytes, but not BUF_SIZE bytes to - avoid re-reading again in print_page() later */ - /* Really possible to move backward BUF_SIZE/2 bytes? */ - if (fpos < BUF_SIZE/2 + bytes_read) { - /* No, move less then */ - if (lseek(fd, 0, SEEK_SET) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in back_lines().\n"); - exit(-1); - } - page = buf + fpos - bytes_read; - } - else { /* Move backward BUF_SIZE/2 bytes */ - if (lseek(fd, -(BUF_SIZE/2 + bytes_read), SEEK_CUR) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in back_lines().\n"); - exit(-1); - } - page = buf + BUF_SIZE/2; - } - if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) { - endwin(); - fprintf(stderr, "\nError reading file in back_lines().\n"); - exit(-1); - } - buf[bytes_read] = '\0'; - } - else { /* Beginning of file reached */ - begin_reached = 1; - return; - } - } - if (*(--page) != '\n') { /* '--page' here */ - /* Something's wrong... */ - endwin(); - fprintf(stderr, "\nInternal error in back_lines().\n"); - exit(-1); - } - } - - /* Go back 'n' lines */ - for (i = 0; i < n; i++) - do { - if (page == buf) { - if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in back_lines().\n"); - exit(-1); - } - if (fpos > bytes_read) { - /* Really possible to move backward BUF_SIZE/2 bytes? */ - if (fpos < BUF_SIZE/2 + bytes_read) { - /* No, move less then */ - if (lseek(fd, 0, SEEK_SET) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in back_lines().\n"); - exit(-1); - } - page = buf + fpos - bytes_read; - } - else { /* Move backward BUF_SIZE/2 bytes */ - if (lseek(fd, -(BUF_SIZE/2 + bytes_read), SEEK_CUR) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in back_lines().\n"); - exit(-1); - } - page = buf + BUF_SIZE/2; - } - if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) { - endwin(); - fprintf(stderr, "\nError reading file in back_lines().\n"); - exit(-1); - } - buf[bytes_read] = '\0'; - } - else { /* Beginning of file reached */ - begin_reached = 1; - return; - } - } - } while (*(--page) != '\n'); - page++; -} -/* End of back_lines() */ - - -/* - * Print a new page of text. Called by dialog_textbox(). - */ -static void print_page(WINDOW *win, int height, int width) -{ - int i, passed_end = 0; - - page_length = 0; - for (i = 0; i < height; i++) { - print_line(win, i, width); - if (!passed_end) - page_length++; - if (end_reached && !passed_end) - passed_end = 1; - } - wnoutrefresh(win); -} -/* End of print_page() */ - - -/* - * Print a new line of text. Called by dialog_textbox() and print_page(). - */ -static void print_line(WINDOW *win, int row, int width) -{ - int i, y, x; - unsigned char *line; - - line = get_line(); - line += MIN(strlen(line),hscroll); /* Scroll horizontally */ - wmove(win, row, 0); /* move cursor to correct line */ - waddch(win,' '); -#ifdef HAVE_NCURSES - waddnstr(win, line, MIN(strlen(line),width-2)); -#else - line[MIN(strlen(line),width-2)] = '\0'; - waddstr(win, line); -#endif - - getyx(win, y, x); - /* Clear 'residue' of previous line */ - for (i = 0; i < width-x; i++) - waddch(win, ' '); -} -/* End of print_line() */ - - -/* - * Return current line of text. Called by dialog_textbox() and print_line(). - * 'page' should point to start of current line before calling, and will be - * updated to point to start of next line. - */ -static unsigned char *get_line(void) -{ - int i = 0, fpos; - static unsigned char line[MAX_LEN+1]; - - end_reached = 0; - while (*page != '\n') { - if (*page == '\0') { /* Either end of file or end of buffer reached */ - if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in get_line().\n"); - exit(-1); - } - if (fpos < file_size) { /* Not end of file yet */ - /* We've reached end of buffer, but not end of file yet, so read next - part of file into buffer */ - if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) { - endwin(); - fprintf(stderr, "\nError reading file in get_line().\n"); - exit(-1); - } - buf[bytes_read] = '\0'; - page = buf; - } - else { - if (!end_reached) - end_reached = 1; - break; - } - } - else - if (i < MAX_LEN) - line[i++] = *(page++); - else { - if (i == MAX_LEN) /* Truncate lines longer than MAX_LEN characters */ - line[i++] = '\0'; - page++; - } - } - if (i <= MAX_LEN) - line[i] = '\0'; - if (!end_reached) - page++; /* move pass '\n' */ - - return line; -} -/* End of get_line() */ - - -/* - * Display a dialog box and get the search term from user - */ -static int get_search_term(WINDOW *win, unsigned char *search_term, int height, int width) -{ - int x, y, key = 0, first, - box_height = 3, box_width = 30; - - x = (width - box_width)/2; - y = (height - box_height)/2; -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(win, y, x, box_height, box_width); -#endif - draw_box(win, y, x, box_height, box_width, dialog_attr, searchbox_border_attr); - wattrset(win, searchbox_title_attr); - wmove(win, y, x+box_width/2-4); - waddstr(win, " Search "); - wattrset(win, dialog_attr); - - search_term[0] = '\0'; - - first = 1; - while (key != ESC) { - key = line_edit(win, y+1, x+1, -1, box_width-2, searchbox_attr, first, search_term, 0); - first = 0; - switch (key) { - case '\n': - if (search_term[0] != '\0') - return 0; - break; - case ESC: - break; - } - } - - return -1; /* ESC pressed */ -} -/* End of get_search_term() */ - - -/* - * Print current position - */ -static void print_position(WINDOW *win, int height, int width) -{ - int fpos, percent; - - if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { - endwin(); - fprintf(stderr, "\nError moving file pointer in print_position().\n"); - exit(-1); - } - wattrset(win, position_indicator_attr); - percent = !file_size ? 100 : ((fpos-bytes_read+page-buf)*100)/file_size; - wmove(win, height-3, width-9); - wprintw(win, "(%3d%%)", percent); -} -/* End of print_position() */ Index: gnu/lib/libdialog/lineedit.c =================================================================== --- gnu/lib/libdialog/lineedit.c (revision 216873) +++ gnu/lib/libdialog/lineedit.c (working copy) @@ -1,213 +0,0 @@ -/* - * Changes Copyright (C) 1995 by Andrey A. Chernov, Moscow - * - * Original Copyright: - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#include <dialog.h> -#include "dialog.priv.h" - -static void redraw_field(WINDOW *dialog, int box_y, int box_x, int flen, int box_width, unsigned char instr[], int input_x, int scroll, chtype attr, chtype old_attr, int fexit, int attr_mask); - -/* - * Line editor - */ -int line_edit(WINDOW* dialog, int box_y, int box_x, int flen, int box_width, chtype attr, int first, unsigned char *result, int attr_mask) -{ - int i, key; - chtype old_attr; - static int input_x, scroll; - static unsigned char instr[MAX_LEN+1]; - unsigned char erase_char = erasechar(); - unsigned char kill_char = killchar(); -#ifdef notyet - unsignec char werase_char = cur_term->Ottyb.c_cc[VWERASE]; -#endif - - old_attr = getattrs(dialog); - keypad(dialog, TRUE); - - if (first) { - memset(instr, 0, sizeof(instr)); - strcpy(instr, result); - i = strlen(instr); -/* input_x = i % box_width;*/ - input_x = (i > box_width) ? box_width - 1 : i; -/* scroll = i - input_x;*/ - scroll = (i > box_width) ? i - box_width + 1: 0; - } - redraw_field(dialog, box_y, box_x, flen, box_width, instr, input_x, scroll, attr, old_attr, FALSE, attr_mask); - - for (;;) { - wattrset(dialog, attr); - wrefresh(dialog); - key = wgetch(dialog); - switch (key) { - case ctrl('q'): - goto ret; - break; - case KEY_F(1): - display_helpfile(); - break; - case TAB: - case KEY_BTAB: - case KEY_UP: - case KEY_DOWN: - case ESC: - case '\r': - case '\n': - for (i = strlen(instr) - 1; i >= scroll + input_x && instr[i] == ' '; i--) - instr[i] = '\0'; - if (key == '\r') - key = '\n'; - goto ret; - case '\025': - case '\030': - kill_it: - input_x = scroll = 0; - /* fall through */ - case '\013': - case KEY_EOL: - memset(instr + scroll + input_x, '\0', sizeof(instr) - scroll - input_x); - redraw_field(dialog, box_y, box_x, flen, box_width, instr, input_x, scroll, attr, old_attr, FALSE, attr_mask); - continue; - case '\001': - case KEY_HOME: - input_x = scroll = 0; - redraw_field(dialog, box_y, box_x, flen, box_width, instr, input_x, scroll, attr, old_attr, FALSE, attr_mask); - continue; - case '\005': - case KEY_END: - for (i = strlen(instr) - 1; i >= scroll + input_x && instr[i] == ' '; i--) - instr[i] = '\0'; - i++; - input_x = i % box_width; - scroll = i - input_x; - redraw_field(dialog, box_y, box_x, flen, box_width, instr, input_x, scroll, attr, old_attr, FALSE, attr_mask); - continue; - case '\002': - case KEY_LEFT: - if (input_x || scroll) { - if (!input_x) { - int oldscroll = scroll; - scroll = scroll < box_width-1 ? 0 : scroll-(box_width-1); - input_x = oldscroll - 1 - scroll; - redraw_field(dialog, box_y, box_x, flen, box_width, instr, input_x, scroll, attr, old_attr, FALSE, attr_mask); - } else { - input_x--; - wmove(dialog, box_y, input_x + box_x); - } - } else - beep(); - continue; - case '\006': - case KEY_RIGHT: - if ( scroll+input_x < MAX_LEN - && (flen < 0 || scroll+input_x < flen) - ) { - if (!instr[scroll+input_x]) - instr[scroll+input_x] = ' '; - if (input_x == box_width-1) { - scroll++; - redraw_field(dialog, box_y, box_x, flen, box_width, instr, input_x, scroll, attr, old_attr, FALSE, attr_mask); - } - else { - wmove(dialog, box_y, input_x + box_x); - waddch(dialog, instr[scroll+input_x]); - input_x++; - } - } else - beep(); /* Alarm user about overflow */ - continue; - case '\b': - case '\177': - case KEY_BACKSPACE: - erase_it: - if (input_x || scroll) { - i = strlen(instr); - memmove(instr+scroll+input_x-1, instr+scroll+input_x, i-(scroll+input_x)+1); - if (!input_x) { - int oldscroll = scroll; - scroll = scroll < box_width-1 ? 0 : scroll-(box_width-1); - input_x = oldscroll - 1 - scroll; - } else - input_x--; - redraw_field(dialog, box_y, box_x, flen, box_width, instr, input_x, scroll, attr, old_attr, FALSE, attr_mask); - } else - beep(); - continue; - case '\004': - case KEY_DC: - for (i = strlen(instr) - 1; i >= scroll + input_x && instr[i] == ' '; i--) - instr[i] = '\0'; - i++; - if (i == 0) { - beep(); - continue; - } - memmove(instr+scroll+input_x, instr+scroll+input_x+1, i-(scroll+input_x)); - redraw_field(dialog, box_y, box_x, flen, box_width, instr, input_x, scroll, attr, old_attr, FALSE, attr_mask); - continue; - default: - if (CCEQ(key, erase_char)) - goto erase_it; - if (CCEQ(key, kill_char)) - goto kill_it; - if (key < 0x100 && isprint(key)) { - for (i = strlen(instr) - 1; i >= scroll + input_x && instr[i] == ' '; i--) - instr[i] = '\0'; - i++; - if (i < MAX_LEN && (flen < 0 || scroll+input_x < flen)) { - if (flen < 0 || i < flen) - memmove(instr+scroll+input_x+1, instr+scroll+input_x, i-(scroll+input_x)); - instr[scroll+input_x] = key; - if (input_x == box_width-1 && (flen < 0 || i < flen)) - scroll++; - else - input_x++; - redraw_field(dialog, box_y, box_x, flen, box_width, instr, input_x, scroll, attr, old_attr, FALSE, attr_mask); - } else - beep(); /* Alarm user about overflow */ - continue; - } - } - } -ret: - redraw_field(dialog, box_y, box_x, flen, box_width, instr, input_x, scroll, attr, old_attr, TRUE, attr_mask); - wrefresh(dialog); - strcpy(result, instr); - return key; -} - -static void -redraw_field(WINDOW *dialog, int box_y, int box_x, int flen, int box_width, unsigned char instr[], int input_x, int scroll, chtype attr, chtype old_attr, int fexit, int attr_mask) -{ - int i, fix_len; - - wattrset(dialog, fexit ? old_attr : attr); - wmove(dialog, box_y, box_x); - fix_len = flen >= 0 ? MIN(flen-scroll,box_width) : box_width; - for (i = 0; i < fix_len; i++) - waddch(dialog, instr[scroll+i] ? ((attr_mask & DITEM_NO_ECHO) ? '*' : instr[scroll+i]) : ' '); - wattrset(dialog, old_attr); - for ( ; i < box_width; i++) - waddch(dialog, instr[scroll+i] ? ((attr_mask & DITEM_NO_ECHO) ? '*' : instr[scroll+i]) : ' '); - wmove(dialog, box_y, input_x + box_x); -} Index: gnu/lib/libdialog/tree.c =================================================================== --- gnu/lib/libdialog/tree.c (revision 216873) +++ gnu/lib/libdialog/tree.c (working copy) @@ -1,1133 +0,0 @@ -/* - * tree.c -- implements the 'tree' interface element for libdialog - * - * Author: Anatoly A. Orehovsky (tolik@mpeks.tomsk.su) - * - * Copyright (c) 1997, Anatoly A. Orehovsky - * 09/28/98 - patched by Anatoly A. Orehovsky (smart_tree()) - * - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdlib.h> -#include <strings.h> -#include <stdio.h> -#include <dialog.h> -#include "dialog.priv.h" -#include <ncurses.h> - -/* static utils for make tree */ -struct leaf { - unsigned char *name; /* name of leaf */ - unsigned char *branches; /* branches that going by leaf */ - unsigned char slip; /* slip of leaf*/ - int shift; /* shift relative root of tree */ -}; - -static int mk_slip(struct leaf array[], int arr_size, - int number, int shift); - -/* make tree from file - * - * filename - name of file with like find(1) output - * p_names - pointer to array of strings - * p_size - pointer to size of array - * FS - fields separator - * p_array - pointer to array of leafs - * - * return values: - * 0 - ok and names by p_names, size by p_size, array by p_array set - * -1 - memory allocation error (errno set) - */ - -static int mk_ftree(char *filename, - unsigned char ***p_names, int *p_size, unsigned char FS, - struct leaf **p_array); - -/* make tree from array - * - * names - array of strings - * size - size of array - * FS - fields separator - * p_array - pointer to array of leafs - * - * return values: - * 0 - ok and array by p_array set - * -1 - memory allocation error (errno set) - */ - -static int mk_tree(unsigned char **names, int size, unsigned char FS, - struct leaf **p_array); - -/* free memory from tree (leafs) - * - * return values: - * nothing - */ - -static void free_leafs(struct leaf *array, int size); - -/* free memory from source data for tree (names) - * - * return values: - * if 0 <= choice <= size - pointer to name from names, - * and memory for name not released (must be freed later) - * else - NULL (recomended choice -1 for it) - */ - -static unsigned char *free_names(unsigned char **names, - int size, int choice); - -/* end of static utils for make tree */ - -/* static utils for ftree */ - -/* control struct for queue */ -struct queue { - int size; /* size of queue */ - struct m_queue *first; /* begin of queue */ - struct m_queue *last; /* end of queue */ -}; - -/* queue member */ -struct m_queue { - void *pointer; /* queue member */ - struct m_queue *next; /* next queue member */ -}; - -/* init struct queue by zeros */ -static void init_queue(struct queue *queue); - -/* add pointer to queue */ -/* return - pointer or NULL if error */ -static void *p2_queue(struct queue *queue, void *pointer); - -/* get first from queue */ -/* return - pointer or NULL if queue is empty */ -static void *first_queue(struct queue *queue); - -/* make zero terminated array from queue */ -/* return - pointer to array or NULL if error */ -static void **q2arr(struct queue *queue, int depth); - -/* smart_tree (for like find(1) with -d flag output compliance) */ -/* return - not NULL or NULL if malloc error */ -static unsigned char *smart_tree(struct queue *queue, unsigned char FS, - unsigned char *current, - unsigned char *prev); - -/* end of static utils for ftree */ - -/* static utils for saved_tree */ - -/* saved values for unique tree */ -struct saved_tree { - unsigned char **names; /* names + */ - int size; /* size + */ - unsigned char FS; /* FS + */ - int height; /* height + */ - int width; /* width + */ - int menu_height; /* menu_height - unique for treebox ? */ - int ch; /* saved ch - choice */ - int sc; /* saved sc - scroll */ -}; - -/* search saved tree within queue */ -/* return - struct saved_tree * or NULL if not found */ -static struct saved_tree *search_saved_tree(struct queue *queue, - unsigned char **names, - int size, - unsigned char FS, - int height, - int width, - int menu_height); - -/* end of static utils for saved_tree */ - -static void print_item(WINDOW *win, struct leaf item, int choice, int selected); - -static void print_position(WINDOW *win, int x, int y, - int cur_pos, int size); - -static int menu_width, item_x; - -static int dialog_treemenu(unsigned char *title, unsigned char *prompt, - int height, int width, int menu_height, - int item_no, struct leaf items[], - int *result, - int *ch, int *sc); - -/* - * Display a menu for choosing among a number of options - */ -static -int dialog_treemenu(unsigned char *title, unsigned char *prompt, - int height, int width, int menu_height, - int item_no, struct leaf items[], - int *result, - int *ch, int *sc) -{ - int i, j, x, y, cur_x, cur_y, box_x, box_y, key = 0, button = 0, choice = 0, - l, scroll = 0, max_choice, redraw_menu = FALSE; - WINDOW *dialog, *menu; - - if (ch) /* restore menu item info */ - choice = *ch; - if (sc) - scroll = *sc; - - max_choice = MIN(menu_height, item_no); - - item_x = 0; - /* Find length of longest item in order to center menu */ - for (i = 0; i < item_no; i++) { - l = strlen(items[i].name) + strlen(items[i].branches) * 4 + 4; - item_x = MAX(item_x, l); - } - - if (height < 0) - height = strheight(prompt)+menu_height+4+2; - if (width < 0) { - i = strwidth(prompt); - j = ((title != NULL) ? strwidth(title) : 0); - width = MAX(i,j); - width = MAX(width,item_x+4)+4; - } - width = MAX(width,24); - - if (width > COLS) - width = COLS; - if (height > LINES) - height = LINES; - /* center dialog box on screen */ - x = (COLS - width)/2; - y = (LINES - height)/2; - -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(stdscr, y, x, height, width); -#endif - dialog = newwin(height, width, y, x); - if (dialog == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); - exit(1); - } - keypad(dialog, TRUE); - - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - wattrset(dialog, border_attr); - wmove(dialog, height-3, 0); - waddch(dialog, ACS_LTEE); - for (i = 0; i < width-2; i++) - waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - waddch(dialog, ACS_RTEE); - wmove(dialog, height-2, 1); - for (i = 0; i < width-2; i++) - waddch(dialog, ' '); - - if (title != NULL) { - wattrset(dialog, title_attr); - wmove(dialog, 0, (width - strlen(title))/2 - 1); - waddch(dialog, ' '); - waddstr(dialog, title); - waddch(dialog, ' '); - } - wattrset(dialog, dialog_attr); - wmove(dialog, 1, 2); - print_autowrap(dialog, prompt, height-1, width-2, width, 1, 2, TRUE, FALSE); - - menu_width = width-6; - getyx(dialog, cur_y, cur_x); - box_y = cur_y + 1; - box_x = (width - menu_width)/2 - 1; - - /* create new window for the menu */ - menu = subwin(dialog, menu_height, menu_width, y + box_y + 1, x + box_x + 1); - if (menu == NULL) { - endwin(); - fprintf(stderr, "\nsubwin(dialog,%d,%d,%d,%d) failed, maybe wrong dims\n", menu_height,menu_width,y+box_y+1,x+box_x+1); - exit(1); - } - keypad(menu, TRUE); - - /* draw a box around the menu items */ - draw_box(dialog, box_y, box_x, menu_height+2, menu_width+2, menubox_border_attr, menubox_attr); - - item_x = 1; - - /* Print the menu */ - for (i = 0; i < max_choice; i++) - print_item(menu, items[(scroll+i)], i, i == choice); - wnoutrefresh(menu); - print_arrows(dialog, scroll, menu_height, item_no, box_x, box_y, item_x, cur_x, cur_y); - print_position(dialog, box_x+menu_width, box_y+menu_height, scroll+choice, item_no); - - display_helpline(dialog, height-1, width); - - x = width/2-11; - y = height-2; - print_button(dialog, "Cancel", y, x+14, FALSE); - print_button(dialog, " OK ", y, x, TRUE); - - wrefresh(dialog); - - while (key != ESC) { - key = wgetch(dialog); - /* Check if key pressed matches first character of any item tag in menu */ - - if (key == KEY_UP || key == KEY_DOWN || key == '-' || key == '+') { - if (key == KEY_UP || key == '-') { - if (!choice) { - if (scroll) { -#ifdef BROKEN_WSCRL - /* wscrl() in ncurses 1.8.1 seems to be broken, causing a segmentation - violation when scrolling windows of height = 4, so scrolling is not - used for now */ - scroll--; - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - /* Reprint menu to scroll down */ - for (i = 0; i < max_choice; i++) - print_item(menu, items[(scroll+i)], i, i == choice); - -#else - - /* Scroll menu down */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - if (menu_height > 1) { - /* De-highlight current first item before scrolling down */ - print_item(menu, items[scroll], 0, FALSE); - scrollok(menu, TRUE); - wscrl(menu, -1); - scrollok(menu, FALSE); - } - scroll--; - print_item(menu, items[scroll], 0, TRUE); -#endif - wnoutrefresh(menu); - print_arrows(dialog, scroll, menu_height, item_no, box_x, box_y, item_x, cur_x, cur_y); - print_position(dialog, box_x+menu_width, box_y+menu_height, scroll+choice, item_no); - wmove(dialog, cur_y, cur_x); /* Restore cursor to previous position */ - wrefresh(dialog); - } - continue; /* wait for another key press */ - } - else - i = choice - 1; - } - else if (key == KEY_DOWN || key == '+') { - if (choice == max_choice - 1) { - if (scroll+choice < item_no-1) { -#ifdef BROKEN_WSCRL - /* wscrl() in ncurses 1.8.1 seems to be broken, causing a segmentation - violation when scrolling windows of height = 4, so scrolling is not - used for now */ - scroll++; - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - /* Reprint menu to scroll up */ - for (i = 0; i < max_choice; i++) - print_item(menu, items[(scroll+i)], i, i == choice); - -#else - - /* Scroll menu up */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - if (menu_height > 1) { - /* De-highlight current last item before scrolling up */ - print_item(menu, items[(scroll+max_choice-1)], max_choice-1, FALSE); - scrollok(menu, TRUE); - scroll(menu); - scrollok(menu, FALSE); - } - scroll++; - print_item(menu, items[(scroll+max_choice-1)], max_choice-1, TRUE); -#endif - wnoutrefresh(menu); - print_arrows(dialog, scroll, menu_height, item_no, box_x, box_y, item_x, cur_x, cur_y); - print_position(dialog, box_x+menu_width, box_y+menu_height, scroll+choice, item_no); - wmove(dialog, cur_y, cur_x); /* Restore cursor to previous position */ - wrefresh(dialog); - } - continue; /* wait for another key press */ - } - else - i = choice + 1; - } - - if (i != choice) { - /* De-highlight current item */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - print_item(menu, items[(scroll+choice)], choice, FALSE); - - /* Highlight new item */ - choice = i; - print_item(menu, items[(scroll+choice)], choice, TRUE); - wnoutrefresh(menu); - print_position(dialog, box_x+menu_width, box_y+menu_height, scroll+choice, item_no); - wmove(dialog, cur_y, cur_x); /* Restore cursor to previous position */ - wrefresh(dialog); - } - continue; /* wait for another key press */ - } - - /* save info about menu item position */ - if (ch) - *ch = choice; - if (sc) - *sc = scroll; - - switch (key) { - case KEY_PPAGE: - case 'B' : - case 'b' : - if (scroll > menu_height) { /* can we go up? */ - scroll -= (menu_height); - } else { - scroll = 0; - } - redraw_menu = TRUE; - break; - case KEY_NPAGE: - case 'F' : - case 'f' : - if (scroll + menu_height >= item_no-1 - menu_height) { /* can we go down a full page? */ - scroll = item_no - menu_height; - if (scroll < 0) scroll = 0; - } else { - scroll += menu_height; - } - redraw_menu = TRUE; - break; - case KEY_HOME: - case 'g' : - scroll = 0; - choice = 0; - redraw_menu = TRUE; - break; - case KEY_END: - case 'G' : - scroll = item_no - menu_height; - if (scroll < 0) scroll = 0; - choice = max_choice - 1; - redraw_menu = TRUE; - break; - case 'O': - case 'o': - delwin(dialog); - *result = scroll+choice; - return 0; - case 'C': - case 'c': - delwin(dialog); - return 1; - case KEY_BTAB: - case TAB: - case KEY_LEFT: - case KEY_RIGHT: - if (!button) { - button = 1; /* Indicates "Cancel" button is selected */ - print_button(dialog, " OK ", y, x, FALSE); - print_button(dialog, "Cancel", y, x+14, TRUE); - } - else { - button = 0; /* Indicates "OK" button is selected */ - print_button(dialog, "Cancel", y, x+14, FALSE); - print_button(dialog, " OK ", y, x, TRUE); - } - wrefresh(dialog); - break; - case ' ': - case '\r': - case '\n': - delwin(dialog); - if (!button) - *result = scroll+choice; - return button; - case ESC: - break; - case KEY_F(1): - case '?': - display_helpfile(); - break; - } - if (redraw_menu) { - for (i = 0; i < max_choice; i++) { - print_item(menu, items[(scroll+i)], - i, i == choice); - } - wnoutrefresh(menu); - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - print_arrows(dialog, scroll, menu_height, item_no, box_x, box_y, item_x, cur_x, cur_y); - print_position(dialog, box_x+menu_width, box_y+menu_height, scroll+choice, item_no); - wmove(dialog, cur_y, cur_x); /* Restore cursor to previous position */ - wrefresh(dialog); - redraw_menu = FALSE; - } - } - - delwin(dialog); - return -1; /* ESC pressed */ -} -/* End of dialog_treemenu() */ - - -/* - * Print menu item - */ -static void print_item(WINDOW *win, struct leaf item, int choice, int selected) -{ - int i, j = menu_width - 2; - char *branches = item.branches; - - /* Clear 'residue' of last item */ - wattrset(win, menubox_attr); - wmove(win, choice, 0); - for (i = 0; i < menu_width; i++) - waddch(win, ' '); - wmove(win, choice, item_x); - - while(*branches && j) - { - switch (*branches++) { - case ' ' : waddch(win, ' '); - break; - case '|' : waddch(win, ACS_VLINE); - } - - j--; - i = 3; - while(i-- && j) - { - waddch(win, ' '); - j--; - } - } - - if (j) - { - switch (item.slip) { - case '+' : waddch(win, ACS_LTEE); - break; - case '`' : waddch(win, ACS_LLCORNER); - } - j--; - } - - i = 3; - while(i-- && j) - { - waddch(win, ACS_HLINE); - j--; - } - - wattrset(win, selected ? item_selected_attr : item_attr); - if (j) - waddnstr(win, item.name, j); -} -/* End of print_item() */ - -/* - * Print current position - */ -static void print_position(WINDOW *win, int x, int y, - int cur_pos, int size) -{ - int percent; - - wattrset(win, position_indicator_attr); - percent = cur_pos == size - 1 ? 100 : (cur_pos * 100)/(size - 1); - wmove(win, y + 1, x - 6); - wprintw(win, "(%3d%%)", percent); -} -/* End of print_position() */ - -/* - * Display a tree menu from file - * - * filename - file with like find(1) output - * FS - fields separator - * title - title of dialog box - * prompt - prompt text into dialog box - * height - height of dialog box - * width - width of dialog box - * menu_height - height of menu box - * result - pointer to char array - * - * return values: - * -1 - ESC pressed - * 0 - Ok, result set (must be freed later) - * 1 - Cancel - */ - -int dialog_ftree(unsigned char *filename, unsigned char FS, - unsigned char *title, unsigned char *prompt, - int height, int width, int menu_height, - unsigned char **result) -{ - int retcode, choice, size; - struct leaf *items; - unsigned char **names; - - if (mk_ftree(filename, &names, &size, FS, &items)) - { - perror("dialog_ftree"); - end_dialog(); - exit(-1); - } - - if (!size) - { - fprintf(stderr, "\ndialog_ftree: file %s is empty\n", filename); - end_dialog(); - exit(-1); - } - - retcode = dialog_treemenu(title, prompt, height, width, menu_height, - size, items, &choice, NULL, NULL); - - free_leafs(items, size); - - if (!retcode) - *result = free_names(names, size, choice); - else - (void)free_names(names, size, -1); - - return retcode; -} -/* End of dialog_ftree() */ - -/* - * Display a tree menu from array - * - * names - array with like find(1) output - * size - size of array - * FS - fields separator - * title - title of dialog box - * prompt - prompt text into dialog box - * height - height of dialog box - * width - width of dialog box - * menu_height - height of menu box - * result - pointer to char array - * - * return values: - * -1 - ESC pressed - * 0 - Ok, result set - * 1 - Cancel - */ - -int dialog_tree(unsigned char **names, int size, unsigned char FS, - unsigned char *title, unsigned char *prompt, - int height, int width, int menu_height, - unsigned char **result) -{ - int retcode, choice; - struct leaf *items; - struct saved_tree *st; - static struct queue *q_saved_tree = NULL; - - if (!size) - { - fprintf(stderr, "\ndialog_tree: source array is empty\n"); - end_dialog(); - exit(-1); - } - - if (mk_tree(names, size, FS, &items)) - { - perror("dialog_tree"); - end_dialog(); - exit(-1); - } - -/* is tree saved ? */ - if (!(st = search_saved_tree(q_saved_tree, names, - size, FS, - height, width, menu_height))) { - if (!q_saved_tree) { - if (!(q_saved_tree = - calloc(sizeof (struct queue), 1))) { - perror("dialog_tree"); - end_dialog(); - exit(-1); - } - } - - if (!(st = calloc(sizeof (struct saved_tree), 1))) { - perror("dialog_tree"); - end_dialog(); - exit(-1); - } - - st->names = names; - st->size = size; - st->FS = FS; - st->height = height; - st->width = width; - st->menu_height = menu_height; - - if (!p2_queue(q_saved_tree, st)) { - perror("dialog_tree"); - end_dialog(); - exit(-1); - } - } - - retcode = dialog_treemenu(title, prompt, height, width, menu_height, - size, items, &choice, - &(st->ch), &(st->sc)); - - free_leafs(items, size); - - if (!retcode) - *result = names[choice]; - - return retcode; -} -/* End of dialog_tree() */ - -/* utils for ftree */ - -/* init struct queue by zeros */ -static void -init_queue(struct queue *queue) -{ - bzero((void *)queue, sizeof(struct queue)); -} - -/* add pointer to queue */ -/* return - pointer or NULL if error */ -static void * -p2_queue(struct queue *queue, void *pointer) -{ - if (!queue) - return NULL; - - if (!queue->first) - { - if (!(queue->first = queue->last = - calloc(1, sizeof(struct m_queue)))) - return NULL; - - } - else - { - if (!(queue->last->next = - calloc(1, sizeof(struct m_queue)))) - return NULL; - - queue->last = queue->last->next; - } - - queue->size++; - return queue->last->pointer = pointer; -} - -/* get first from queue */ -/* return - pointer or NULL if queue is empty */ -static void * -first_queue(struct queue *queue) -{ - void *retval; - struct m_queue *new_first; - - if (!queue || - !queue->first || - !queue->size) - return NULL; - - retval = queue->first->pointer; - new_first = queue->first->next; - free(queue->first); - queue->first = new_first; - queue->size--; - - return retval; - -} - -/* make zero terminated array from queue */ -/* return - pointer to array or NULL if error */ -static void ** -q2arr(struct queue *queue, int depth) -{ - void **mono, **end; - - if (!queue || - !queue->first || - !queue->size) - return NULL; - - /* memory allocation for array */ - if (!(mono = end = malloc(depth * sizeof(void *) + 1))) - return NULL; - - while(depth--) - { - if (!(*end++ = first_queue(queue))) - break; - } - - *end = NULL; - - return mono; - -} - -/* - * smart_tree (for like find(1) with -d flag output compliance) - * - * return values: - * NULL - malloc error - * not NULL - ok - * - */ -static -unsigned char * -smart_tree(struct queue *queue, - unsigned char FS, - unsigned char *current, - unsigned char *prev) { - unsigned char *pcurrent = current, *pprev = prev, *toqueue; - register char break_flag = 0; - - while(*pcurrent && *pprev) { - if (*pcurrent == *pprev) { - pcurrent++; - pprev++; - } - else { - break_flag = 1; - break; - } - } - - if (!*pprev || break_flag) { - if (*pcurrent == FS) { - pcurrent++; - - if ((!*prev) && (*pcurrent)) { - unsigned char tchar = *pcurrent; - - *pcurrent = '\0'; - if (!(toqueue = strdup(current))) { - *pcurrent = tchar; - return NULL; - } - if (!p2_queue(queue, toqueue)) { - *pcurrent = tchar; - return NULL; - } - *pcurrent = tchar; - } - } - - while(*pcurrent) { - if (*pcurrent == FS) { - *pcurrent = '\0'; - if (!(toqueue = strdup(current))) { - *pcurrent = FS; - return NULL; - } - if (!p2_queue(queue, toqueue)) { - *pcurrent = FS; - return NULL; - } - *pcurrent = FS; - } - pcurrent++; - } - if (!p2_queue(queue, current)) - return NULL; - } - return current; -} - -/* end of utils for ftree */ - -/* utils for make tree */ - -/* if error - return -1 */ -static -int -mk_slip(struct leaf array[], int arr_size, int number, int shift) -{ - int t_number; - int t_shift; - - if (number > arr_size - 1) - return number - 1; - - t_shift = shift; - - if (!(array[number].branches = calloc(1, t_shift + 1))) - return -1; - - (void)memset(array[number].branches, ' ', t_shift); - - t_number = number; - - while (array[number].shift < array[t_number + 1].shift) - { - t_number = mk_slip(array, arr_size, t_number + 1, t_shift + 1); - if (t_number < 0) - return -1; - if (t_number == arr_size - 1) - break; - } - - if (array[number].shift == array[t_number + 1].shift) - array[number].slip = '+'; - - if ((array[number].shift > array[t_number + 1].shift) || - t_number == arr_size - 1) - array[number].slip = '`'; - - return t_number; - -} /* mk_slip() */ - -/* make tree from file - * - * filename - name of file with like find(1) output - * p_names - pointer to array of strings - * p_size - pointer to size of array - * FS - fields separator - * p_array - pointer to array of leafs - * - * return values: - * 0 - ok and names by p_names, size by p_size, array by p_array set - * -1 - memory allocation error (errno set) - */ - -static -int -mk_ftree(char *filename, - unsigned char ***p_names, int *p_size, unsigned char FS, - struct leaf **p_array) -{ - int NR; /* number of input records */ - struct queue queue; - unsigned char *string, *sstring = ""; - unsigned char **names; - - FILE *input_file; - - if (!(input_file = fopen(filename, "r"))) - return -1; - - init_queue(&queue); - - if (!(string = malloc(BUFSIZ))) - return -1; - - /* read input file into queue */ - while(fgets(string, BUFSIZ, input_file)) - { - if (strchr(string, '\n')) - *strchr(string, '\n') = '\0'; - - if (!(string = realloc(string, strlen(string) + 1))) - return -1; - - if (!smart_tree(&queue, FS, string, sstring)) - return -1; - sstring = string; - - if (!(string = malloc(BUFSIZ))) - return -1; - } /* read input file into queue */ - - if (fclose(input_file) == EOF) - return -1; - - if (!(NR = queue.size)) - { - *p_size = 0; - return 0; - } - - /* make array from queue */ - if (!(names = (unsigned char **)q2arr(&queue, NR))) - return -1; - - *p_names = names; - *p_size = NR; - - /* make tree from array */ - return mk_tree(names, NR, FS, p_array); - -} /* mk_ftree */ - -/* make tree from array - * - * names - array of strings - * size - size of array - * FS - fields separator - * p_array - pointer to array of leafs - * - * return values: - * 0 - ok and array by p_array set - * -1 - memory allocation error (errno set) - */ - -static -int -mk_tree(unsigned char **names, int size, unsigned char FS, - struct leaf **p_array) -{ - int i; - struct leaf *array; - - /* make array of leafs */ - if (!(array = calloc(size, sizeof(struct leaf)))) - return -1; - - /* init leafs */ - for (i = 0; i < size; i++) - { - unsigned char *in_string, *name; - int shift = 0; - - in_string = name = names[i]; - while(*in_string) - { - if (*in_string == FS) { - if (!i && !*(in_string + 1)) - name = in_string; - else - { - shift++; - name = in_string + 1; - } - } - in_string++; - } - array[i].name = name; - array[i].shift = shift; - array[i].slip = '\0'; - array[i].branches = NULL; - } /* init leafs */ - - /* make slips */ - for (i = 0;i < size; i++) - { - i = mk_slip(array, size, i, 0); - if (i < 0) - return -1; - } /* make slips */ - - /* make branches */ - for (i = 1;i < size; i++) - { - unsigned char *src = array[i - 1].branches; - unsigned char *dst = array[i].branches; - - while(*src && *dst) - *dst++ = *src++; - - if (*dst) - switch (array[i - 1].slip) { - case '+' : *dst = '|'; - break; - case '`' : *dst = ' '; - } - } /* make branches */ - - *p_array = array; - return 0; - -} /* mk_tree() */ - -/* free memory from tree (leafs) - * - * return values: - * nothing - */ - -static -void -free_leafs(struct leaf *array, int size) -{ - struct leaf *p_array = array; - - while (size--) - free(array++->branches); - - free(p_array); -} /* free_leafs() */ - -/* free memory from source data for tree (names) - * - * return values: - * if 0 <= choice <= size - pointer to name from names, - * and memory for name not released (must be freed later) - * else - NULL (recomended choice -1 for it) - */ - -static -unsigned char * -free_names(unsigned char **names, int size, int choice) -{ - unsigned char *retval = NULL; - unsigned char **p_names = names; - - while (size--) - { - if (!choice--) - retval = *names++; - else - free(*names++); - } - free(p_names); - return retval; -} /* free_names() */ - -/* end of utils for make tree */ - -/* static utils for saved_tree */ - -/* search saved tree within queue */ -/* return - struct *saved_tree or NULL if not found */ -static -struct saved_tree * -search_saved_tree(struct queue *queue, unsigned char **names, int size, - unsigned char FS, - int height, int width, - int menu_height) -{ - struct m_queue *member; - struct saved_tree *retval; - - if (!queue || !names || !FS || - !height || !width || !menu_height) - return NULL; - - if (!(member = queue->first)) - return NULL; - - while (member->next) { - retval = member->pointer; - if ((names == retval->names) && - (size == retval->size) && - (FS == retval->FS) && - (height == retval->height) && - (width == retval->width) && - (menu_height == retval->menu_height)) - return retval; - member = member->next; - } - retval = member->pointer; - if ((names == retval->names) && - (size == retval->size) && - (FS == retval->FS) && - (height == retval->height) && - (width == retval->width) && - (menu_height == retval->menu_height)) - return retval; - return NULL; -} - -/* end of static utils for saved_tree */ Index: gnu/lib/libdialog/prgbox.c =================================================================== --- gnu/lib/libdialog/prgbox.c (revision 216873) +++ gnu/lib/libdialog/prgbox.c (working copy) @@ -1,152 +0,0 @@ -/* - * prgbox.c -- implements the message box and info box - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> - -#include <dialog.h> -#include <errno.h> -#include <sys/wait.h> -#include "dialog.priv.h" - -/* - * Display a message box. Program will pause and display an "OK" button - * if the parameter 'pause' is non-zero. - */ -int dialog_prgbox(unsigned char *title, const unsigned char *line, int height, int width, int pause, int use_shell) -{ - int i, x, y, key = 0; - WINDOW *dialog; - FILE *f; - const unsigned char *name; - unsigned char *s, buf[MAX_LEN]; - int status; - - if (height < 0 || width < 0) { - endwin(); - fprintf(stderr, "\nAutosizing is impossible in dialog_prgbox().\n"); - exit(-1); - } - width = MAX(width,10); - - if (width > COLS) - width = COLS; - if (height > LINES) - height = LINES; - /* center dialog box on screen */ - x = DialogX ? DialogX : (COLS - width)/2; - y = DialogY ? DialogY : (LINES - height)/2; - -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(stdscr, y, x, height, width); -#endif - dialog = newwin(height, width, y, x); - if (dialog == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height,width,y,x); - exit(1); - } - keypad(dialog, TRUE); - - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - - if (title != NULL) { - wattrset(dialog, title_attr); - wmove(dialog, 0, (width - strlen(title))/2 - 1); - waddch(dialog, ' '); - waddstr(dialog, title); - waddch(dialog, ' '); - } - wattrset(dialog, dialog_attr); - wmove(dialog, 1, 2); - - if (!use_shell) { - char cmdline[MAX_LEN]; - char *av[51], **ap = av, *val, *p; - - strcpy(cmdline, line); - p = cmdline; - while ((val = strsep(&p," \t")) != NULL) { - if (*val != '\0') - *ap++ = val; - } - *ap = NULL; - f = raw_popen(name = av[0], av, "r"); - } else - f = raw_popen(name = line, NULL, "r"); - - status = -1; - if (f == NULL) { - err: - sprintf(buf, "%s: %s\n", name, strerror(errno)); - prr: - print_autowrap(dialog, buf, height-(pause?3:1), width-2, width, 1, 2, FALSE, TRUE); - wrefresh(dialog); - } else { - while (fgets(buf, sizeof(buf), f) != NULL) { - i = strlen(buf); - if (buf[i-1] == '\n') - buf[i-1] = '\0'; - s = buf; - while ((s = strchr(s, '\t')) != NULL) - *s++ = ' '; - print_autowrap(dialog, buf, height-(pause?3:1), width-2, width, 1, 2, FALSE, TRUE); - print_autowrap(dialog, "\n", height-(pause?3:1), width-2, width, 1, 2, FALSE, FALSE); - wrefresh(dialog); - } - if ((status = raw_pclose(f)) == -1) - goto err; - if (WIFEXITED(status) && WEXITSTATUS(status) == 127) { - sprintf(buf, "%s: program not found\n", name); - goto prr; - } - } - - if (pause) { - wattrset(dialog, border_attr); - wmove(dialog, height-3, 0); - waddch(dialog, ACS_LTEE); - for (i = 0; i < width-2; i++) - waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - waddch(dialog, ACS_RTEE); - wmove(dialog, height-2, 1); - for (i = 0; i < width-2; i++) - waddch(dialog, ' '); - display_helpline(dialog, height-1, width); - print_button(dialog, " OK ", height-2, width/2-6, TRUE); - wrefresh(dialog); - while (key != ESC && key != '\n' && key != ' ' && key != '\r') - key = wgetch(dialog); - if (key == '\r') - key = '\n'; - } - else { - key = '\n'; - wrefresh(dialog); - } - - delwin(dialog); - return (status); -} -/* End of dialog_msgbox() */ Index: gnu/lib/libdialog/rc.c =================================================================== --- gnu/lib/libdialog/rc.c (revision 216873) +++ gnu/lib/libdialog/rc.c (working copy) @@ -1,375 +0,0 @@ -/* - * rc.c -- routines for processing the configuration file - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <dialog.h> -#include "dialog.priv.h" -#include "colors.h" -#include "rc.h" - - -static unsigned char *attr_to_str(int fg, int bg, int hl); -static int str_to_attr(unsigned char *str, int *fg, int *bg, int *hl); -static int parse_line(unsigned char *line, unsigned char **var, unsigned char **value); - - -/* - * Create the configuration file - */ -void dialog_create_rc(unsigned char *filename) -{ - int i; - FILE *rc_file; - - if ((rc_file = fopen(filename, "wt")) == NULL) { - fprintf(stderr, "\nError opening file for writing in create_rc().\n"); - exit(-1); - } - - fprintf(rc_file, "#\ -\n# Run-time configuration file for dialog\ -\n#\ -\n# Automatically generated by \"dialog --create-rc <file>\"\ -\n#\ -\n#\ -\n# Types of values:\ -\n#\ -\n# Number - <number>\ -\n# String - \"string\"\ -\n# Boolean - <ON|OFF>\ -\n# Attribute - (foreground,background,highlight?)\ -\n#\n\n"); - - /* Print an entry for each configuration variable */ - for (i = 0; i < VAR_COUNT; i++) { - fprintf(rc_file, "\n# %s\n", vars[i].comment); /* print comment */ - switch (vars[i].type) { - case VAL_INT: - fprintf(rc_file, "%s = %d\n", vars[i].name, *((int *) vars[i].var)); - break; - case VAL_STR: - fprintf(rc_file, "%s = \"%s\"\n", vars[i].name, (unsigned char *) vars[i].var); - break; - case VAL_BOOL: - fprintf(rc_file, "%s = %s\n", vars[i].name, *((bool *) vars[i].var) ? "ON" : "OFF"); - break; - case VAL_ATTR: - fprintf(rc_file, "%s = %s\n", vars[i].name, attr_to_str(((int *) vars[i].var)[0], ((int *) vars[i].var)[1], ((int *) vars[i].var)[2])); - break; - } - } - - fclose(rc_file); -} -/* End of create_rc() */ - - -/* - * Parse the configuration file and set up variables - */ -int parse_rc(void) -{ - int i, l = 1, parse, fg, bg, hl; - unsigned char str[MAX_LEN+1], *var, *value, *tempptr; - FILE *rc_file; - - /* - * - * At start, 'dialog' determines the settings to use as follows: - * - * a) if environment variable DIALOGRC is set, it's value determines the - * name of the configuration file. - * - * b) if the file in (a) can't be found, use the file $HOME/.dialogrc - * as the configuration file. - * - * c) if the file in (b) can't be found, use compiled in defaults. - * - */ - - if ((tempptr = getenv("DIALOGRC")) != NULL) - rc_file = fopen(tempptr, "rt"); - - if (tempptr == NULL || rc_file == NULL) { /* step (a) failed? */ - /* try step (b) */ - if ((tempptr = getenv("HOME")) == NULL) - return 0; /* step (b) failed, use default values */ - - if (tempptr[0] == '\0' || lastch(tempptr) == '/') - sprintf(str, "%s%s", tempptr, DIALOGRC); - else - sprintf(str, "%s/%s", tempptr, DIALOGRC); - - if ((rc_file = fopen(str, "rt")) == NULL) - return 0; /* step (b) failed, use default values */ - } - - /* Scan each line and set variables */ - while (fgets(str, MAX_LEN, rc_file) != NULL) { - if (lastch(str) != '\n') { /* ignore rest of file if line too long */ - fprintf(stderr, "\nParse error: line %d of configuration file too long.\n", l); - fclose(rc_file); - return -1; /* parse aborted */ - } - else { - lastch(str) = '\0'; - parse = parse_line(str, &var, &value); /* parse current line */ - - switch (parse) { - case LINE_BLANK: /* ignore blank lines and comments */ - case LINE_COMMENT: - break; - case LINE_OK: - /* search table for matching config variable name */ - for (i = 0; i < VAR_COUNT && strcmp(vars[i].name, var); i++); - - if (i == VAR_COUNT) { /* no match */ - fprintf(stderr, "\nParse error: unknown variable at line %d of configuration file.\n", l); - return -1; /* parse aborted */ - } - else { /* variable found in table, set run time variables */ - switch (vars[i].type) { - case VAL_INT: - *((int *) vars[i].var) = atoi(value); - break; - case VAL_STR: - if (!isquote(value[0]) || !isquote(lastch(value)) || strlen(value) < 2) { - fprintf(stderr, "\nParse error: string value expected at line %d of configuration file.\n", l); - return -1; /* parse aborted */ - } - else { - /* remove the (") quotes */ - value++; - lastch(value) = '\0'; - strcpy((unsigned char *) vars[i].var, value); - } - break; - case VAL_BOOL: - if (!strcasecmp(value, "ON")) - *((bool *) vars[i].var) = TRUE; - else if (!strcasecmp(value, "OFF")) - *((bool *) vars[i].var) = FALSE; - else { - fprintf(stderr, "\nParse error: boolean value expected at line %d of configuration file.\n", l); - return -1; /* parse aborted */ - } - break; - case VAL_ATTR: - if (str_to_attr(value, &fg, &bg, &hl) == -1) { - fprintf(stderr, "\nParse error: attribute value expected at line %d of configuration file.\n", l); - return -1; /* parse aborted */ - } - ((int *) vars[i].var)[0] = fg; - ((int *) vars[i].var)[1] = bg; - ((int *) vars[i].var)[2] = hl; - break; - } - } - break; - case LINE_ERROR: - fprintf(stderr, "\nParse error: syntax error at line %d of configuration file.\n", l); - return -1; /* parse aborted */ - } - } - - l++; /* next line */ - } - - fclose(rc_file); - return 0; /* parse successful */ -} -/* End of parse_rc() */ - - -/* - * Convert an attribute to a string representation like this: - * - * "(foreground,background,highlight)" - */ -static unsigned char *attr_to_str(int fg, int bg, int hl) -{ - int i; - static unsigned char str[MAX_LEN+1]; - - strcpy(str, "("); - /* foreground */ - for (i = 0; fg != color_names[i].value; i++); - strcat(str, color_names[i].name); - strcat(str, ","); - - /* background */ - for (i = 0; bg != color_names[i].value; i++); - strcat(str, color_names[i].name); - - /* highlight */ - strcat(str, hl ? ",ON)" : ",OFF)"); - - return str; -} -/* End of attr_to_str() */ - - -/* - * Extract the foreground, background and highlight values from an attribute - * represented as a string in this form: - * - * "(foreground,background,highlight)" - */ -static int str_to_attr(unsigned char *str, int *fg, int *bg, int *hl) -{ - int i = 0, j, get_fg = 1; - unsigned char tempstr[MAX_LEN+1], *part; - - if (str[0] != '(' || lastch(str) != ')') - return -1; /* invalid representation */ - - /* remove the parenthesis */ - strcpy(tempstr, str + 1); - lastch(tempstr) = '\0'; - - - /* get foreground and background */ - - while (1) { - /* skip white space before fg/bg string */ - while (whitespace(tempstr[i]) && tempstr[i] != '\0') i++; - if (tempstr[i] == '\0') - return -1; /* invalid representation */ - part = tempstr + i; /* set 'part' to start of fg/bg string */ - - /* find end of fg/bg string */ - while(!whitespace(tempstr[i]) && tempstr[i] != ',' && tempstr[i] != '\0') i++; - - if (tempstr[i] == '\0') - return -1; /* invalid representation */ - else if (whitespace(tempstr[i])) { /* not yet ',' */ - tempstr[i++] = '\0'; - - /* skip white space before ',' */ - while(whitespace(tempstr[i]) && tempstr[i] != '\0') i++; - - if (tempstr[i] != ',') - return -1; /* invalid representation */ - } - - tempstr[i++] = '\0'; /* skip the ',' */ - for (j = 0; j < COLOR_COUNT && strcasecmp(part, color_names[j].name); j++); - if (j == COLOR_COUNT) /* invalid color name */ - return -1; - if (get_fg) { - *fg = color_names[j].value; - get_fg = 0; /* next we have to get the background */ - } - else { - *bg = color_names[j].value; - break; - } - } /* got foreground and background */ - - - /* get highlight */ - - /* skip white space before highlight string */ - while (whitespace(tempstr[i]) && tempstr[i] != '\0') i++; - if (tempstr[i] == '\0') - return -1; /* invalid representation */ - part = tempstr + i; /* set 'part' to start of highlight string */ - - /* trim trailing white space from highlight string */ - i = strlen(part) - 1; - while(whitespace(part[i])) i--; - part[i+1] = '\0'; - - if (!strcasecmp(part, "ON")) - *hl = TRUE; - else if (!strcasecmp(part, "OFF")) - *hl = FALSE; - else - return -1; /* invalid highlight value */ - - return 0; -} -/* End of str_to_attr() */ - - -/* - * Parse a line in the configuration file - * - * Each line is of the form: "variable = value". On exit, 'var' will contain - * the variable name, and 'value' will contain the value string. - * - * Return values: - * - * LINE_BLANK - line is blank - * LINE_COMMENT - line is comment - * LINE_OK - line is ok - * LINE_ERROR - syntax error in line - */ -static int parse_line(unsigned char *line, unsigned char **var, unsigned char **value) -{ - int i = 0; - - /* ignore white space at beginning of line */ - while(whitespace(line[i]) && line[i] != '\0') i++; - - if (line[i] == '\0') /* line is blank */ - return LINE_BLANK; - else if (line[i] == '#') /* line is comment */ - return LINE_COMMENT; - else if (line[i] == '=') /* variables names can't strart with a '=' */ - return LINE_ERROR; - - /* set 'var' to variable name */ - *var = line + i++; /* skip to next character */ - - /* find end of variable name */ - while(!whitespace(line[i]) && line[i] != '=' && line[i] != '\0') i++; - - if (line[i] == '\0') /* syntax error */ - return LINE_ERROR; - else if (line[i] == '=') - line[i++] = '\0'; - else { - line[i++] = '\0'; - - /* skip white space before '=' */ - while(whitespace(line[i]) && line[i] != '\0') i++; - - if (line[i] != '=') /* syntax error */ - return LINE_ERROR; - else - i++; /* skip the '=' */ - } - - /* skip white space after '=' */ - while(whitespace(line[i]) && line[i] != '\0') i++; - - if (line[i] == '\0') - return LINE_ERROR; - else - *value = line + i; /* set 'value' to value string */ - - /* trim trailing white space from 'value' */ - i = strlen(*value) - 1; - while(whitespace((*value)[i])) i--; - (*value)[i+1] = '\0'; - - return LINE_OK; /* no syntax error in line */ -} -/* End of parse_line() */ Index: gnu/lib/libdialog/notify.c =================================================================== --- gnu/lib/libdialog/notify.c (revision 216873) +++ gnu/lib/libdialog/notify.c (working copy) @@ -1,53 +0,0 @@ -/* - * File: notify.c - * Author: Marc van Kempen - * Desc: display a notify box with a message - * - * Copyright (c) 1995, Marc van Kempen - * - * All rights reserved. - * - * This software may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with - * its use. - * - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <dialog.h> -#include <stdio.h> -#include <stdlib.h> - -void -dialog_notify(char *msg) -/* - * Desc: display an error message - */ -{ - char *tmphlp; - WINDOW *w; - - w = dupwin(newscr); - if (w == NULL) { - endwin(); - fprintf(stderr, "\ndupwin(newscr) failed, malloc memory corrupted\n"); - exit(1); - } - tmphlp = get_helpline(); - use_helpline("Press enter or space"); - dialog_mesgbox("Message", msg, -1, -1); - restore_helpline(tmphlp); - touchwin(w); - wrefresh(w); - delwin(w); - - return; - -} /* dialog_notify() */ - Index: gnu/lib/libdialog/rc.h =================================================================== --- gnu/lib/libdialog/rc.h (revision 216873) +++ gnu/lib/libdialog/rc.h (working copy) @@ -1,222 +0,0 @@ -/* - * rc.h -- declarations for configuration file processing - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#define DIALOGRC ".dialogrc" -#define VAR_LEN 30 -#define COMMENT_LEN 70 - -/* Types of values */ -#define VAL_INT 0 -#define VAL_STR 1 -#define VAL_BOOL 2 -#define VAL_ATTR 3 - -/* Type of line in configuration file */ -#define LINE_BLANK 2 -#define LINE_COMMENT 1 -#define LINE_OK 0 -#define LINE_ERROR -1 - -/* number of configuration variables */ -#define VAR_COUNT (sizeof(vars) / sizeof(vars_st)) - -/* check if character is white space */ -#define whitespace(c) (c == ' ' || c == '\t') - -/* check if character is string quoting characters */ -#define isquote(c) (c == '"' || c == '\'') - -/* get last character of string */ -#define lastch(str) str[strlen(str)-1] - -/* - * Configuration variables - */ -typedef struct { - unsigned char name[VAR_LEN]; /* name of configuration variable as in DIALOGRC */ - void *var; /* address of actually variable to change */ - int type; /* type of value */ - unsigned char comment[COMMENT_LEN]; /* comment to put in "rc" file */ -} vars_st; - -vars_st vars[] = { - { "use_shadow", - &use_shadow, - VAL_BOOL, - "Shadow dialog boxes? This also turns on color." }, - - { "use_colors", - &use_colors, - VAL_BOOL, - "Turn color support ON or OFF" }, - - { "screen_color", - color_table[0], - VAL_ATTR, - "Screen color" }, - - { "shadow_color", - color_table[1], - VAL_ATTR, - "Shadow color" }, - - { "dialog_color", - color_table[2], - VAL_ATTR, - "Dialog box color" }, - - { "title_color", - color_table[3], - VAL_ATTR, - "Dialog box title color" }, - - { "border_color", - color_table[4], - VAL_ATTR, - "Dialog box border color" }, - - { "button_active_color", - color_table[5], - VAL_ATTR, - "Active button color" }, - - { "button_inactive_color", - color_table[6], - VAL_ATTR, - "Inactive button color" }, - - { "button_key_active_color", - color_table[7], - VAL_ATTR, - "Active button key color" }, - - { "button_key_inactive_color", - color_table[8], - VAL_ATTR, - "Inactive button key color" }, - - { "button_label_active_color", - color_table[9], - VAL_ATTR, - "Active button label color" }, - - { "button_label_inactive_color", - color_table[10], - VAL_ATTR, - "Inactive button label color" }, - - { "inputbox_color", - color_table[11], - VAL_ATTR, - "Input box color" }, - - { "inputbox_border_color", - color_table[12], - VAL_ATTR, - "Input box border color" }, - - { "searchbox_color", - color_table[13], - VAL_ATTR, - "Search box color" }, - - { "searchbox_title_color", - color_table[14], - VAL_ATTR, - "Search box title color" }, - - { "searchbox_border_color", - color_table[15], - VAL_ATTR, - "Search box border color" }, - - { "position_indicator_color", - color_table[16], - VAL_ATTR, - "File position indicator color" }, - - { "menubox_color", - color_table[17], - VAL_ATTR, - "Menu box color" }, - - { "menubox_border_color", - color_table[18], - VAL_ATTR, - "Menu box border color" }, - - { "item_color", - color_table[19], - VAL_ATTR, - "Item color" }, - - { "item_selected_color", - color_table[20], - VAL_ATTR, - "Selected item color" }, - - { "tag_color", - color_table[21], - VAL_ATTR, - "Tag color" }, - - { "tag_selected_color", - color_table[22], - VAL_ATTR, - "Selected tag color" }, - - { "tag_key_color", - color_table[23], - VAL_ATTR, - "Tag key color" }, - - { "tag_key_selected_color", - color_table[24], - VAL_ATTR, - "Selected tag key color" }, - - { "check_color", - color_table[25], - VAL_ATTR, - "Check box color" }, - - { "check_selected_color", - color_table[26], - VAL_ATTR, - "Selected check box color" }, - - { "uarrow_color", - color_table[27], - VAL_ATTR, - "Up arrow color" }, - - { "darrow_color", - color_table[28], - VAL_ATTR, - "Down arrow color" } -}; /* vars */ - - - -/* - * Routines to process configuration file - */ -int parse_rc(void); Index: gnu/lib/libdialog/README =================================================================== --- gnu/lib/libdialog/README (revision 216873) +++ gnu/lib/libdialog/README (working copy) @@ -1,8 +0,0 @@ -This library was split out from the `dialog' program for use -in C programs. For a list of interface functions, see dialog.h. -For usage examples, see the `dialog' program sources in -/usr/src/gnu/usr.bin/dialog. - -You can additionally use any ncurses functions after init_dialog(). - - Ache. Index: gnu/lib/libdialog/menubox.c =================================================================== --- gnu/lib/libdialog/menubox.c (revision 216873) +++ gnu/lib/libdialog/menubox.c (working copy) @@ -1,469 +0,0 @@ -/* - * menubox.c -- implements the menu box - * - * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * Substantial rennovation: 12/18/95, Jordan K. Hubbard - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <dialog.h> -#include "dialog.priv.h" -#include <err.h> -#include <ncurses.h> - -static void print_item(WINDOW *win, unsigned char *tag, unsigned char *item, int choice, int selected, dialogMenuItem *me, int menu_width, int tag_x, int item_x); - -#define DREF(di, item) ((di) ? &((di)[(item)]) : NULL) - -/* - * Display a menu for choosing among a number of options - */ -int -dialog_menu(unsigned char *title, unsigned char *prompt, int height, int width, int menu_height, int cnt, void *it, unsigned char *result, int *ch, int *sc) -{ - int i, j, x, y, cur_x, cur_y, box_x, box_y, key = 0, button, choice, - l, k, scroll, max_choice, item_no, redraw_menu = FALSE; - char okButton, cancelButton; - int rval = 0, ok_space, cancel_space; - WINDOW *dialog, *menu; - unsigned char **items = NULL; - dialogMenuItem *ditems; - int menu_width, tag_x, item_x; - -draw: - choice = ch ? *ch : 0; - scroll = sc ? *sc : 0; - button = 0; - - /* If item_no is a positive integer, use old item specification format */ - if (cnt >= 0) { - items = it; - ditems = NULL; - item_no = cnt; - } - /* It's the new specification format - fake the rest of the code out */ - else { - item_no = abs(cnt); - ditems = it; - if (!items) - items = (unsigned char **)alloca((item_no * 2) * sizeof(unsigned char *)); - - /* Initializes status */ - for (i = 0; i < item_no; i++) { - items[i*2] = ditems[i].prompt; - items[i*2 + 1] = ditems[i].title; - } - } - max_choice = MIN(menu_height, item_no); - - tag_x = 0; - item_x = 0; - /* Find length of longest item in order to center menu */ - for (i = 0; i < item_no; i++) { - l = strlen(items[i * 2]); - for (j = 0; j < item_no; j++) { - k = strlen(items[j * 2 + 1]); - tag_x = MAX(tag_x, l + k + 2); - } - item_x = MAX(item_x, l); - } - if (height < 0) - height = strheight(prompt) + menu_height + 4 + 2; - if (width < 0) { - i = strwidth(prompt); - j = ((title != NULL) ? strwidth(title) : 0); - width = MAX(i, j); - width = MAX(width, tag_x + 4) + 4; - } - width = MAX(width, 24); - - if (width > COLS) - width = COLS; - if (height > LINES) - height = LINES; - /* center dialog box on screen */ - x = DialogX ? DialogX : (COLS - width) / 2; - y = DialogY ? DialogY : (LINES - height) / 2; - -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(stdscr, y, x, height, width); -#endif - dialog = newwin(height, width, y, x); - if (dialog == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height, width, y, x); - return -1; - } - keypad(dialog, TRUE); - - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - wattrset(dialog, border_attr); - wmove(dialog, height - 3, 0); - waddch(dialog, ACS_LTEE); - for (i = 0; i < width - 2; i++) - waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - waddch(dialog, ACS_RTEE); - wmove(dialog, height - 2, 1); - for (i = 0; i < width - 2; i++) - waddch(dialog, ' '); - - if (title != NULL) { - wattrset(dialog, title_attr); - wmove(dialog, 0, (width - strlen(title)) / 2 - 1); - waddch(dialog, ' '); - waddstr(dialog, title); - waddch(dialog, ' '); - } - wattrset(dialog, dialog_attr); - wmove(dialog, 1, 2); - print_autowrap(dialog, prompt, height - 1, width - 2, width, 1, 2, TRUE, FALSE); - - menu_width = width - 6; - getyx(dialog, cur_y, cur_x); - box_y = cur_y + 1; - box_x = (width - menu_width) / 2 - 1; - - /* create new window for the menu */ - menu = subwin(dialog, menu_height, menu_width, y + box_y + 1, x + box_x + 1); - if (menu == NULL) { - delwin(dialog); - endwin(); - fprintf(stderr, "\nsubwin(dialog,%d,%d,%d,%d) failed, maybe wrong dims\n", menu_height, menu_width, - y + box_y + 1, x + box_x + 1); - return -1; - } - keypad(menu, TRUE); - - /* draw a box around the menu items */ - draw_box(dialog, box_y, box_x, menu_height+2, menu_width+2, menubox_border_attr, menubox_attr); - - tag_x = menu_width > tag_x + 1 ? (menu_width - tag_x) / 2 : 1; - item_x = menu_width > item_x + 4 ? tag_x + item_x + 2 : menu_width - 3; - - /* Print the menu */ - for (i = 0; i < max_choice; i++) - print_item(menu, items[(scroll + i) * 2], items[(scroll + i) * 2 + 1], i, i == choice, DREF(ditems, scroll + i), menu_width, tag_x, item_x); - wnoutrefresh(menu); - print_arrows(dialog, scroll, menu_height, item_no, box_x, box_y, tag_x, cur_x, cur_y); - - display_helpline(dialog, height - 1, width); - - x = width / 2 - 11; - y = height - 2; - - if (ditems && result) { - cancelButton = toupper(ditems[CANCEL_BUTTON].prompt[0]); - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : FALSE); - okButton = toupper(ditems[OK_BUTTON].prompt[0]); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : TRUE); - } - else { - cancelButton = 'C'; - print_button(dialog, "Cancel", y, x + 14, FALSE); - okButton = 'O'; - print_button(dialog, " OK ", y, x, TRUE); - } - - wrefresh(dialog); - while (key != ESC) { - key = wgetch(dialog); - - /* Shortcut to OK? */ - if (toupper(key) == okButton) { - if (ditems) { - if (result && ditems[OK_BUTTON].fire) { - int status; - WINDOW *save; - - save = dupwin(newscr); - status = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]); - if (status & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - } - } - else if (result) - strcpy(result, items[(scroll + choice) * 2]); - rval = 0; - key = ESC; /* Punt! */ - break; - } - - /* Shortcut to cancel? */ - if (toupper(key) == cancelButton) { - if (ditems && result && ditems[CANCEL_BUTTON].fire) { - int status; - WINDOW *save; - - save = dupwin(newscr); - status = ditems[CANCEL_BUTTON].fire(&ditems[CANCEL_BUTTON]); - if (status & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - } - rval = 1; - key = ESC; /* Run away! */ - break; - } - - /* Check if key pressed matches first character of any item tag in menu */ - for (i = 0; i < max_choice; i++) - if (key < 0x100 && key != ' ' && toupper(key) == toupper(items[(scroll + i) * 2][0])) - break; - - if (i < max_choice || (key >= '1' && key <= MIN('9', '0'+max_choice)) || KEY_IS_UP(key) || KEY_IS_DOWN(key)) { - if (key >= '1' && key <= MIN('9', '0'+max_choice)) - i = key - '1'; - else if (KEY_IS_UP(key)) { - if (!choice) { - if (scroll) { - /* Scroll menu down */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - if (menu_height > 1) { - /* De-highlight current first item before scrolling down */ - print_item(menu, items[scroll * 2], items[scroll * 2 + 1], 0, FALSE, DREF(ditems, scroll), menu_width, tag_x, item_x); - scrollok(menu, TRUE); - wscrl(menu, -1); - scrollok(menu, FALSE); - } - scroll--; - print_item(menu, items[scroll * 2], items[scroll * 2 + 1], 0, TRUE, DREF(ditems, scroll), menu_width, tag_x, item_x); - wnoutrefresh(menu); - print_arrows(dialog, scroll, menu_height, item_no, box_x, box_y, tag_x, cur_x, cur_y); - wrefresh(dialog); - } - continue; /* wait for another key press */ - } - else - i = choice - 1; - } - else if (KEY_IS_DOWN(key)) { - if (choice == max_choice - 1) { - if (scroll + choice < item_no - 1) { - /* Scroll menu up */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - if (menu_height > 1) { - /* De-highlight current last item before scrolling up */ - print_item(menu, items[(scroll + max_choice - 1) * 2], - items[(scroll + max_choice - 1) * 2 + 1], - max_choice-1, FALSE, DREF(ditems, scroll + max_choice - 1), menu_width, tag_x, item_x); - scrollok(menu, TRUE); - scroll(menu); - scrollok(menu, FALSE); - } - scroll++; - print_item(menu, items[(scroll + max_choice - 1) * 2], - items[(scroll + max_choice - 1) * 2 + 1], - max_choice - 1, TRUE, DREF(ditems, scroll + max_choice - 1), menu_width, tag_x, item_x); - wnoutrefresh(menu); - print_arrows(dialog, scroll, menu_height, item_no, box_x, box_y, tag_x, cur_x, cur_y); - wrefresh(dialog); - } - continue; /* wait for another key press */ - } - else - i = choice + 1; - } - - if (i != choice) { - /* De-highlight current item */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - print_item(menu, items[(scroll + choice) * 2], items[(scroll + choice) * 2 + 1], choice, FALSE, DREF(ditems, scroll + choice), menu_width, tag_x, item_x); - - /* Highlight new item */ - choice = i; - print_item(menu, items[(scroll + choice) * 2], items[(scroll + choice) * 2 + 1], choice, TRUE, DREF(ditems, scroll + choice), menu_width, tag_x, item_x); - wnoutrefresh(menu); - wmove(dialog, cur_y, cur_x); /* Restore cursor to previous position */ - wrefresh(dialog); - } - continue; /* wait for another key press */ - } - - switch (key) { - case KEY_PPAGE: - if (scroll > height - 4) { /* can we go up? */ - scroll -= (height - 4); - } else { - scroll = 0; - } - redraw_menu = TRUE; - break; - - case KEY_NPAGE: - if (scroll + menu_height >= item_no-1 - menu_height) { /* can we go down a full page? */ - scroll = item_no - menu_height; - if (scroll < 0) - scroll = 0; - } else { - scroll += menu_height; - } - redraw_menu = TRUE; - break; - - case KEY_HOME: - scroll = 0; - choice = 0; - redraw_menu = TRUE; - break; - - case KEY_END: - scroll = item_no - menu_height; - if (scroll < 0) - scroll = 0; - choice = max_choice - 1; - redraw_menu = TRUE; - break; - - case KEY_BTAB: - case TAB: - case KEY_LEFT: - case KEY_RIGHT: - button = !button; - if (ditems && result) { - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : button); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : !button); - ok_space = 1; - cancel_space = strlen(ditems[OK_BUTTON].prompt) + 6; - } - else { - print_button(dialog, "Cancel", y, x + 14, button); - print_button(dialog, " OK ", y, x, !button); - ok_space = 3; - cancel_space = 15; - } - if (button) - wmove(dialog, y, x+cancel_space); - else - wmove(dialog, y, x+ok_space); - wrefresh(dialog); - break; - - case ' ': - case '\r': - case '\n': - if (!button) { - /* A fire routine can do just about anything to the screen, so be prepared - to accept some hints as to what to do in the aftermath. */ - if (ditems) { - if (ditems[scroll + choice].fire) { - int status; - WINDOW *save; - - save = dupwin(newscr); - status = ditems[scroll + choice].fire(&ditems[scroll + choice]); - if (status & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - if (status & DITEM_CONTINUE) - continue; - else if (status & DITEM_LEAVE_MENU) { - /* Allow a fire action to take us out of the menu */ - key = ESC; - break; - } - else if (status & DITEM_RECREATE) { - delwin(menu); - delwin(dialog); - dialog_clear(); - goto draw; - } - } - } - else if (result) - strcpy(result, items[(scroll+choice)*2]); - } - rval = button; - key = ESC; - break; - - case ESC: - rval = -1; - break; - - case KEY_F(1): - case '?': - display_helpfile(); - break; - } - - /* save info about menu item position */ - if (ch) - *ch = choice; - if (sc) - *sc = scroll; - - if (redraw_menu) { - for (i = 0; i < max_choice; i++) { - print_item(menu, items[(scroll + i) * 2], items[(scroll + i) * 2 + 1], i, i == choice, DREF(ditems, scroll + i), menu_width, tag_x, item_x); - } - wnoutrefresh(menu); - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - print_arrows(dialog, scroll, menu_height, item_no, box_x, box_y, tag_x, cur_x, cur_y); - wmove(dialog, cur_y, cur_x); /* Restore cursor to previous position */ - wrefresh(dialog); - redraw_menu = FALSE; - } - } - delwin(menu); - delwin(dialog); - return rval; -} - - -/* - * Print menu item - */ -static void -print_item(WINDOW *win, unsigned char *tag, unsigned char *item, int choice, int selected, dialogMenuItem *me, int menu_width, int tag_x, int item_x) -{ - int i; - - if (tag == NULL) - errx(1, "bad parameter to print_item()\n"); - - /* Clear 'residue' of last item */ - wattrset(win, menubox_attr); - wmove(win, choice, 0); - for (i = 0; i < menu_width; i++) - waddch(win, ' '); - wmove(win, choice, tag_x); - wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); - waddch(win, tag[0]); - wattrset(win, selected ? tag_selected_attr : tag_attr); - waddnstr(win, tag + 1, item_x - tag_x - 3); - wmove(win, choice, item_x); - wattrset(win, selected ? item_selected_attr : item_attr); - waddnstr(win, item, menu_width - item_x - 1); - /* If have a selection handler for this, call it */ - if (me && me->selected) { - wrefresh(win); - me->selected(me, selected); - } -} -/* End of print_item() */ Index: gnu/lib/libdialog/dir.c =================================================================== --- gnu/lib/libdialog/dir.c (revision 216873) +++ gnu/lib/libdialog/dir.c (working copy) @@ -1,549 +0,0 @@ -/**************************************************************************** - * - * Program: dir.c - * Author: Marc van Kempen - * desc: Directory routines, sorting and reading - * - * Copyright (c) 1995, Marc van Kempen - * - * All rights reserved. - * - * This software may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with - * its use. - * - ****************************************************************************/ - -#include <sys/types.h> -#include <sys/stat.h> - -#include <unistd.h> /* XXX for _POSIX_VERSION ifdefs */ - -#if !defined sgi && !defined _POSIX_VERSION -#include <sys/dir.h> -#endif -#if defined __sun__ -#include <sys/dirent.h> -#endif -#if defined sgi || defined _POSIX_VERSION -#include <dirent.h> -#endif - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <fnmatch.h> -#include <sys/param.h> -#include "dir.h" - -/**************************************************************************** - * - * local prototypes - * - ****************************************************************************/ - -void toggle_dotfiles(void); -int show_dotfiles(void); -int dir_alphasort(const void *d1, const void *d2); -int dir_sizesort(const void *d1, const void *d2); -int dir_datesort(const void *d1, const void *d2); -int dir_extsort(const void *d1, const void *d2); - -/**************************************************************************** - * - * global variables - * - ****************************************************************************/ - - -/* This is user-selectable, I've set them fixed for now however */ - -void *_sort_func = dir_alphasort; -static int _showdotfiles = TRUE; - -/**************************************************************************** - * - * Functions - * - ****************************************************************************/ - -int -dir_select_nd( -#if defined __linux__ - const struct dirent *d -#else - struct dirent *d -#endif -) -/* - * desc: allways include a directory entry <d>, except - * for the current directory and other dot-files - * keep '..' however. - * pre: <d> points to a dirent - * post: returns TRUE if d->d_name != "." else FALSE - */ -{ - if (strcmp(d->d_name, ".")==0 || - (d->d_name[0] == '.' && strlen(d->d_name) > 1 && d->d_name[1] != '.')) { - return(FALSE); - } else { - return(TRUE); - } -}/* dir_select_nd() */ - - -int -dir_select( -#ifdef __linux__ - const struct dirent *d -#else - struct dirent *d -#endif -) -/* - * desc: allways include a directory entry <d>, except - * for the current directory - * pre: <d> points to a dirent - * post: returns TRUE if d->d_name != "." else FALSE - */ -{ - if (strcmp(d->d_name, ".")==0) { /* don't include the current directory */ - return(FALSE); - } else { - return(TRUE); - } -} /* dir_select() */ - -int -dir_select_root_nd( -#ifdef __linux__ - const struct dirent *d -#else - struct dirent *d -#endif -) -/* - * desc: allways include a directory entry <d>, except - * for the current directory and the parent directory. - * Also skip any other dot-files. - * pre: <d> points to a dirent - * post: returns TRUE if d->d_name[0] != "." else FALSE - */ -{ - if (d->d_name[0] == '.') { /* don't include the current directory */ - return(FALSE); /* nor the parent directory */ - } else { - return(TRUE); - } -} /* dir_select_root_nd() */ - - -int -dir_select_root( -#ifdef __linux__ - const struct dirent *d -#else - struct dirent *d -#endif -) -/* - * desc: allways include a directory entry <d>, except - * for the current directory and the parent directory - * pre: <d> points to a dirent - * post: returns TRUE if d->d_name[0] != "." else FALSE - */ -{ - if (strcmp(d->d_name, ".") == 0 || strcmp(d->d_name, "..") == 0) { - return(FALSE); - } else { - return(TRUE); - } -}/* dir_select_root() */ - - -#ifdef NO_ALPHA_SORT -int -alphasort(const void *d1, const void *d2) -/* - * desc: a replacement for what should be in the library - */ -{ - return(strcmp(((struct dirent *) d1)->d_name, - ((struct dirent *) d2)->d_name)); -} /* alphasort() */ -#endif - -int -dir_alphasort(const void *d1, const void *d2) -/* - * desc: compare d1 and d2, but put directories always first - * put '..' always on top - * - */ -{ - DirList *f1 = ((DirList *) d1), - *f2 = ((DirList *) d2); - struct stat *s1 = &(f1->filestatus); - struct stat *s2 = &(f2->filestatus); - - /* check for '..' */ - if (strcmp(((DirList *) d1)->filename, "..") == 0) { - return(-1); - } - if (strcmp(((DirList *) d2)->filename, "..") == 0) { - return(1); - } - - /* put directories first */ - if ((s1->st_mode & S_IFDIR) && (s2->st_mode & S_IFDIR)) { - return(strcmp(f1->filename, f2->filename)); - }; - if (s1->st_mode & S_IFDIR) { - return(-1); - } - if (s2->st_mode & S_IFDIR) { - return(1); - } - return(strcmp(f1->filename, f2->filename)); - -} /* dir_alphasort() */ - - -int -dir_sizesort(const void *d1, const void *d2) -/* - * desc: compare d1 and d2, but put directories always first - * - */ -{ - DirList *f1 = ((DirList *) d1), - *f2 = ((DirList *) d2); - struct stat *s1 = &(f1->filestatus); - struct stat *s2 = &(f2->filestatus); - - /* check for '..' */ - if (strcmp(((DirList *) d1)->filename, "..") == 0) { - return(-1); - } - if (strcmp(((DirList *) d2)->filename, "..") == 0) { - return(1); - } - - /* put directories first */ - if ((s1->st_mode & S_IFDIR) && (s2->st_mode & S_IFDIR)) { - return(s1->st_size < s2->st_size ? - -1 - : - s1->st_size >= s2->st_size); - }; - if (s1->st_mode & S_IFDIR) { - return(-1); - } - if (s2->st_mode & S_IFDIR) { - return(1); - } - return(s1->st_size < s2->st_size ? - -1 - : - s1->st_size >= s2->st_size); - -} /* dir_sizesort() */ - -int -dir_datesort(const void *d1, const void *d2) -/* - * desc: compare d1 and d2 on date, but put directories always first - */ -{ - DirList *f1 = ((DirList *) d1), - *f2 = ((DirList *) d2); - struct stat *s1 = &(f1->filestatus); - struct stat *s2 = &(f2->filestatus); - - - /* check for '..' */ - if (strcmp(((DirList *) d1)->filename, "..") == 0) { - return(-1); - } - if (strcmp(((DirList *) d2)->filename, "..") == 0) { - return(1); - } - - /* put directories first */ - if ((s1->st_mode & S_IFDIR) && (s2->st_mode & S_IFDIR)) { - return(s1->st_mtime < s2->st_mtime ? - -1 - : - s1->st_mtime >= s2->st_mtime); - }; - if (s1->st_mode & S_IFDIR) { - return(-1); - } - if (s2->st_mode & S_IFDIR) { - return(1); - } - return(s1->st_mtime < s2->st_mtime ? - -1 - : - s1->st_mtime >= s2->st_mtime); - -} /* dir_datesort() */ - - -int -null_strcmp(char *s1, char *s2) -/* - * desc: compare strings allowing NULL pointers - */ -{ - if ((s1 == NULL) && (s2 == NULL)) { - return(0); - } - if (s1 == NULL) { - return(-1); - } - if (s2 == NULL) { - return(1); - } - return(strcmp(s1, s2)); -} /* null_strcmp() */ - - -int -dir_extsort(const void *d1, const void *d2) -/* - * desc: compare d1 and d2 on extension, but put directories always first - * extension = "the characters after the last dot in the filename" - * pre: d1 and d2 are pointers to DirList type records - * post: see code - */ -{ - DirList *f1 = ((DirList *) d1), - *f2 = ((DirList *) d2); - struct stat *s1 = &(f1->filestatus); - struct stat *s2 = &(f2->filestatus); - char *ext1, *ext2; - int extf, ret; - - - /* check for '..' */ - if (strcmp(((DirList *) d1)->filename, "..") == 0) { - return(-1); - } - if (strcmp(((DirList *) d2)->filename, "..") == 0) { - return(1); - } - - - /* find the first extension */ - - ext1 = f1->filename + strlen(f1->filename); - extf = FALSE; - while (!extf && (ext1 > f1->filename)) { - extf = (*--ext1 == '.'); - } - if (!extf) { - ext1 = NULL; - } else { - ext1++; - } - /* ext1 == NULL if there's no "extension" else ext1 points */ - /* to the first character of the extension string */ - - /* find the second extension */ - - ext2 = f2->filename + strlen(f2->filename); - extf = FALSE; - while (!extf && (ext2 > f2->filename)) { - extf = (*--ext2 == '.'); - } - if (!extf) { - ext2 = NULL; - } else { - ext2++; - } - /* idem as for ext1 */ - - if ((s1->st_mode & S_IFDIR) && (s2->st_mode & S_IFDIR)) { - ret = null_strcmp(ext1, ext2); - if (ret == 0) { - return(strcmp(f1->filename, f2->filename)); - } else { - return(ret); - } - }; - if (s1->st_mode & S_IFDIR) { - return(-1); - } - if (s2->st_mode & S_IFDIR) { - return(1); - } - ret = null_strcmp(ext1, ext2); - if (ret == 0) { - return(strcmp(f1->filename, f2->filename)); - } else { - return(ret); - } - -} /* dir_extsort() */ - - -void -get_dir(char *dirname, char *fmask, DirList **dir, int *n) -/* - * desc: get the files in the current directory - * pre: <dir> == NULL - * post: <dir> contains <n> dir-entries - */ -{ - char cwd[MAXPATHLEN]; - char buf[256]; - struct dirent **dire; - struct stat status; - int i, j, nb; - long d; - - - getcwd(cwd, MAXPATHLEN); - if (strcmp(cwd, "/") == 0) { /* we are in the root directory */ - if (show_dotfiles()) { - *n = scandir(dirname, &dire, dir_select_root, alphasort); - } else { - *n = scandir(dirname, &dire, dir_select_root_nd, alphasort); - } - } else { - if (show_dotfiles()) { - *n = scandir(dirname, &dire, dir_select, alphasort); - } else { - *n = scandir(dirname, &dire, dir_select_nd, alphasort); - } - } - - /* There is the possibility that we have entered a directory */ - /* which we are not allowed to read, scandir thus returning */ - /* -1 for *n. */ - /* Actually I should also check for lack of memory, but I'll */ - /* let my application happily crash if this is the case */ - /* Solution: */ - /* manually insert the parent directory as the only */ - /* directory entry, and return. */ - - if (*n == -1) { - *n = 1; - *dir = (DirList *) malloc(sizeof(DirList)); - strcpy((*dir)[0].filename, ".."); - lstat("..", &status); - (*dir)[0].filestatus = status; - (*dir)[0].link = FALSE; - return; - } - - *dir = (DirList *) malloc( *n * sizeof(DirList) ); - d = 0; - i = 0; - j = 0; - while (j<*n) { - lstat(dire[j]->d_name, &status); - /* check if this file is to be included */ - /* always include directories, the rest is subject to fmask */ - if (S_ISDIR(status.st_mode) - || fnmatch(fmask, dire[j]->d_name, FNM_NOESCAPE) != FNM_NOMATCH) { - strcpy((*dir)[i].filename, dire[j]->d_name); - (*dir)[i].filestatus = status; - if ((S_IFMT & status.st_mode) == S_IFLNK) { /* handle links */ - (*dir)[i].link = TRUE; - stat(dire[j]->d_name, &status); - nb = readlink(dire[j]->d_name, buf, sizeof(buf) - 1); - if (nb == -1) { - printf("get_dir(): Error reading link: %s\n", dire[j]->d_name); - exit(-1); - } else { - (*dir)[i].linkname = malloc(sizeof(char) * nb + 1); - strncpy((*dir)[i].linkname, buf, nb); - (*dir)[i].linkname[nb] = 0; - } - (*dir)[i].filestatus = status; - } else { - (*dir)[i].link = FALSE; - (*dir)[i].linkname = NULL; - } - i++; - } else { - /* skip this entry */ - } - j++; - } - *n = i; - - /* sort the directory with the directory names on top */ - qsort((*dir), *n, sizeof(DirList), _sort_func); - - /* Free the allocated memory */ - for (i=0; i<*n; i++) { - free(dire[i]); - } - free(dire); - - return; -}/* get_dir() */ - - -void -FreeDir(DirList *d, int n) -/* - * desc: free the dirlist d - * pre: d != NULL - * post: memory allocated to d has been released - */ -{ - int i; - - if (d) { - for (i=0; i<n; i++) { - if (d[i].linkname) { - free(d[i].linkname); - } - } - free(d); - } else { - printf("dir.c:FreeDir(): d == NULL\n"); - exit(-1); - } - - return; -} /* FreeDir() */ - -void -toggle_dotfiles(void) -/* - * desc: toggle visibility of dot-files - */ -{ - _showdotfiles = !_showdotfiles; - - return; -} /* toggle_dotfiles() */ - -int -show_dotfiles(void) -/* - * desc: return the value of _showdotfiles - */ -{ - return(_showdotfiles); -} /* show_dotfiles() */ - -void -set_dotfiles(int b) -/* - * desc: set the value of _showdotfiles - */ -{ - _showdotfiles = b; - - return; -} /* set_dotfiles() */ Index: gnu/lib/libdialog/TESTS/check1.c =================================================================== --- gnu/lib/libdialog/TESTS/check1.c (revision 216873) +++ gnu/lib/libdialog/TESTS/check1.c (working copy) @@ -1,83 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Hook functions */ - -static int -getBool(dialogMenuItem *self) -{ - if (self->data && *((int *)self->data)) - return TRUE; - return FALSE; -} - -static int -setBool(dialogMenuItem *self) -{ - if (self->data) { - *((int *)self->data) = !*((int *)self->data); - return DITEM_SUCCESS; - } - return DITEM_FAILURE; -} - -static int german_book, italian_book, slang_book; - -static int -clearBooks(dialogMenuItem *self) -{ - german_book = italian_book = slang_book = FALSE; - return DITEM_SUCCESS | DITEM_REDRAW; -} - -/* menu2 - A more advanced way of using checked and fire hooks to manipulate the backing-variables directly */ -/* prompt title checked fire sel data */ -static dialogMenuItem menu2[] = { - { "German", "Buy book on learning German", getBool, setBool, NULL, &german_book}, - { "Italian", "Buy book on learning Italian", getBool, setBool, NULL, &italian_book }, - { "Slang", "Buy book on commonly used insults", getBool, setBool, NULL, &slang_book }, - { "Clear", "Clear book list", NULL, clearBooks, NULL, NULL, ' ', ' ', ' ' }, -}; - -/* End of hook functions */ - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - retval = dialog_checklist("this is a dialog_checklist() in action, test #1", - "this checklist menu shows off some of the straight-forward features\n" - "of the new menu system's check & fire dispatch hooks", -1, -1, 4, -4, menu2, NULL); - dialog_clear(); - fprintf(stderr, "returned value for dialog_checklist was %d (%d %d %d)\n", retval, german_book, italian_book, slang_book); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/check2.c =================================================================== --- gnu/lib/libdialog/TESTS/check2.c (revision 216873) +++ gnu/lib/libdialog/TESTS/check2.c (working copy) @@ -1,105 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Hook functions */ - -static int -getBool(dialogMenuItem *self) -{ - if (self->data && *((int *)self->data)) - return TRUE; - return FALSE; -} - -static int -setBool(dialogMenuItem *self) -{ - if (self->data) { - *((int *)self->data) = !*((int *)self->data); - return DITEM_SUCCESS; - } - return DITEM_FAILURE; -} - -static int german_book, italian_book, slang_book; - -static int -clearBooks(dialogMenuItem *self) -{ - german_book = italian_book = slang_book = FALSE; - return DITEM_SUCCESS | DITEM_REDRAW; -} - -static int -buyBooks(dialogMenuItem *self) -{ - char foo[256]; - - if (german_book || italian_book || slang_book) { - strcpy(foo, "Ok, you're buying books on"); - if (german_book) - strcat(foo, " german"); - if (italian_book) - strcat(foo, " italian"); - if (slang_book) - strcat(foo, " slang"); - } - else - strcpy(foo, "You're not buying any books?"); - dialog_mesgbox("This is a direct callback for the `Buy' button", foo, -1, -1); - return DITEM_SUCCESS; -} - -/* menu3 - Look mom! We can finally use our own OK and Cancel buttons! */ -/* prompt title checked fire sel data */ -static dialogMenuItem menu3[] = { - { "Buy!", NULL, NULL, buyBooks }, /* New "OK" button */ - { "No Way!", NULL, NULL, NULL }, /* New "Cancel" button */ - { "German", "Buy books on learning German", getBool, setBool, NULL, &german_book }, - { "Italian", "Buy books on learning Italian", getBool, setBool, NULL, &italian_book }, - { "Slang", "Buy books on commonly used insults", getBool, setBool, NULL, &slang_book }, - { "Clear", "Clear book list", NULL, clearBooks, NULL, NULL, ' ', ' ', ' ' }, -}; - -/* End of hook functions */ - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - retval = dialog_checklist("this is dialog_checklist() in action, test #2", - "Same as before, but now we relabel the buttons and override the OK action.", - -1, -1, 4, -4, menu3 + 2, (char *)TRUE); - dialog_clear(); - fprintf(stderr, "returned value for dialog_checklist was %d\n", retval); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/tree.c =================================================================== --- gnu/lib/libdialog/TESTS/tree.c (revision 216873) +++ gnu/lib/libdialog/TESTS/tree.c (working copy) @@ -1,111 +0,0 @@ -/* - * tree.c - * - * small test-driver for new dialog functionality - * - * Copyright (c) 1998, Anatoly A. Orehovsky - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <dialog.h> - -unsigned char *names[] = { - "/", - "/dev", - "/dev/fd", - "/tmp", - "/usr", - "/var", - "/home", - "/stand", - "/stand/etc", - "/stand/en_US.ISO8859-1", - "/stand/info", - "/stand/info/bin", - "/stand/info/des", - "/stand/info/games", - "/stand/info/manpages", - "/stand/info/proflibs", - "/stand/info/dict", - "/stand/info/info", - "/stand/info/src", - "/etc", - "/etc/gnats", - "/etc/kerberosIV", - "/etc/mtree", - "/etc/namedb", - "/etc/ppp", - "/etc/uucp", - "/etc/sliphome", - "/proc", - "/lkm", - "/mnt", - "/root", - "/sbin", - "/bin", - 0 -}; - -unsigned char *names1[] = { - "a", - "a:b", - "a:b:c", - "a:d" -}; - -int -main(int argc, char **argv) -{ - int retval; - unsigned char *tresult; - char comstr[BUFSIZ]; - - init_dialog(); - do { - use_helpline("Press OK for listing directory"); - retval = dialog_tree(names, - sizeof(names)/sizeof(unsigned char *) - 1, - '/', - "tree dialog box example", - "Typical find -x / -type d output", - -1, -1, 15, - &tresult); - - if (retval) - break; - - use_helpline(NULL); - (void)snprintf(comstr, sizeof(comstr), - "ls -CF %s", tresult); - - retval = dialog_prgbox( - comstr, - comstr, 20, 60, TRUE, TRUE); - - dialog_clear(); - - retval = dialog_tree(names1, - sizeof(names1)/sizeof(unsigned char *), - ':', - "tree dialog box example", - "Other tree", - -1, -1, 5, - &tresult); - if (!retval) - { - dialog_clear(); - } - } while (!retval); - - dialog_update(); - - dialog_clear(); - - end_dialog(); - - exit(retval); -} Index: gnu/lib/libdialog/TESTS/check3.c =================================================================== --- gnu/lib/libdialog/TESTS/check3.c (revision 216873) +++ gnu/lib/libdialog/TESTS/check3.c (working copy) @@ -1,92 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - * - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/wait.h> -#include <dialog.h> - -/* Hook functions */ - -static int -getBool(dialogMenuItem *self) -{ - if (self->data && *((int *)self->data)) - return TRUE; - return FALSE; -} - -static int -setBool(dialogMenuItem *self) -{ - if (self->data) { - *((int *)self->data) = !*((int *)self->data); - return DITEM_SUCCESS; - } - return DITEM_FAILURE; -} - -static int german_book, italian_book, slang_book; -static int spending; - -static int -check(dialogMenuItem *self) -{ - return ((int)(intptr_t)self->data == spending); -} - -static int -spend(dialogMenuItem *self) -{ - spending = (int)(intptr_t)self->data; - return DITEM_SUCCESS | DITEM_REDRAW; -} - -/* menu4 - Show off a simulated compound menu (group at top is checklist, group at bottom radio) */ -/* prompt title checked fire sel, data lbra mark rbra */ -static dialogMenuItem menu4[] = { - { "German", "Buy books on learning German", getBool, setBool, NULL, &german_book }, - { "Italian","Buy books on learning Italian", getBool, setBool, NULL, &italian_book }, - { "Slang", "Buy books on commonly used insults", getBool, setBool, NULL, &slang_book }, - { "-----", "----------------------------------", NULL, NULL, NULL, NULL, ' ', ' ', ' ' }, - { "1000", "Spend $1,000", check, spend, NULL, (void *)1000, '(', '*', ')' }, - { "500", "Spend $500", check, spend, NULL, (void *)500, '(', '*', ')' }, - { "100", "Spend $100", check, spend, NULL, (void *)100, '(', '*', ')' }, -}; - -/* End of hook functions */ - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - - retval = dialog_checklist("this is dialog_checklist() in action, test #3", - "Now we show off some of the button 'styles' one can create.", - -1, -1, 7, -7, menu4, NULL); - dialog_clear(); - fprintf(stderr, "spent $%d on %s%s%s books\n", spending, german_book ? " german" : "", - italian_book ? " italian" : "", slang_book ? " slang" : ""); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/prgbox.c =================================================================== --- gnu/lib/libdialog/TESTS/prgbox.c (revision 216873) +++ gnu/lib/libdialog/TESTS/prgbox.c (working copy) @@ -1,41 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - retval = dialog_prgbox("This is dialog_prgbox() in action with cal(1)", "cal", 14, 50, TRUE, TRUE); - dialog_clear(); - fprintf(stderr, "returned value for dialog_prgbox was %d\n", retval); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/radio1.c =================================================================== --- gnu/lib/libdialog/TESTS/radio1.c (revision 216873) +++ gnu/lib/libdialog/TESTS/radio1.c (working copy) @@ -1,71 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Hook functions */ - -static int spending; - -static int -check(dialogMenuItem *self) -{ - return ((int)(intptr_t)self->data == spending); -} - -static int -spend(dialogMenuItem *self) -{ - spending = (int)(intptr_t)self->data; - return DITEM_SUCCESS | DITEM_REDRAW; -} - -/* menu5 - Show a simple radiolist menu that inherits the radio appearance by default */ -/* prompt title checked fire sel data */ -static dialogMenuItem menu5[] = { - { "1000", "Spend $1,000", check, spend, NULL, (void *)1000 }, - { "500", "Spend $500", check, spend, NULL, (void *)500 }, - { "100", "Spend $100", check, spend, NULL, (void *)100 }, -}; - -/* End of hook functions */ - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - - retval = dialog_radiolist("this is dialog_radiolist() in action, test #1", - "this radio menu shows off some of the straight-forward features\n" - "of the new menu system's check & fire dispatch hooks", -1, -1, 3, -3, menu5, NULL); - dialog_clear(); - fprintf(stderr, "returned value for dialog_radiolist was %d (money set to %d)\n", retval, spending); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/input1.c =================================================================== --- gnu/lib/libdialog/TESTS/input1.c (revision 216873) +++ gnu/lib/libdialog/TESTS/input1.c (working copy) @@ -1,45 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - unsigned char result[128]; - - init_dialog(); - - strcpy(result, "not this!"); - retval = dialog_inputbox("this is dialog_inputbox() in action, test #1", - "Enter something really profound below, please.", - -1, -1, result); - dialog_clear(); - fprintf(stderr, "returned value for dialog_inputbox was %d (%s)\n", retval, result); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/radio2.c =================================================================== --- gnu/lib/libdialog/TESTS/radio2.c (revision 216873) +++ gnu/lib/libdialog/TESTS/radio2.c (working copy) @@ -1,89 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Hook functions */ - -static char bachelor[10], bachelette[10]; - -static int -getBachelor(dialogMenuItem *self) -{ - return !strcmp(bachelor, self->prompt); -} - -static int -setBachelor(dialogMenuItem *self) -{ - strcpy(bachelor, self->prompt); - return DITEM_SUCCESS | DITEM_REDRAW; -} - -static int -getBachelette(dialogMenuItem *self) -{ - return !strcmp(bachelette, self->prompt); -} - -static int -setBachelette(dialogMenuItem *self) -{ - strcpy(bachelette, self->prompt); - return DITEM_SUCCESS | DITEM_REDRAW; -} - -/* menu6- More complex radiolist menu that creates two groups in a single menu */ -/* prompt title checked fire */ -static dialogMenuItem menu6[] = { - { "Tom", "Tom's a dynamic shoe salesman from Tulsa, OK!", getBachelor, setBachelor }, - { "Dick", "Dick's a retired engine inspector from McDonnell-Douglas!", getBachelor, setBachelor }, - { "Harry", "Harry's a professional female impersonator from Las Vegas!", getBachelor, setBachelor }, - { "-----", "----------------------------------", NULL, NULL, NULL, NULL, ' ', ' ', ' ' }, - { "Jane", "Jane's a twice-divorced housewife from Moose, Oregon!", getBachelette, setBachelette }, - { "Sally", "Sally's a shy Human Resources Manager for IBM!", getBachelette, setBachelette }, - { "Mary", "Mary's an energetic serial killer on the lam!", getBachelette, setBachelette }, -}; - -/* End of hook functions */ - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - retval = dialog_radiolist("this is dialog_radiolist() in action, test #2", - "Welcome to \"The Love Blender!\" - America's favorite game show\n" - "where YOU, the contestant, get to choose which of these two\n" - "fine specimens of humanity will go home together, whether they\n" - "like it or not!", -1, -1, 7, -7, menu6, NULL); - dialog_clear(); - fprintf(stderr, "I'm sure that %s and %s will be very happy together!\n", bachelor, bachelette); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/input2.c =================================================================== --- gnu/lib/libdialog/TESTS/input2.c (revision 216873) +++ gnu/lib/libdialog/TESTS/input2.c (working copy) @@ -1,47 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - unsigned char result[128]; - - init_dialog(); - - result[0]='\0'; - DialogInputAttrs |= DITEM_NO_ECHO; - retval = dialog_inputbox("this is dialog_inputbox() in action, test #2 (no echo)", - "Enter something really secret below, please.", - -1, -1, result); - DialogInputAttrs &= DITEM_NO_ECHO; - dialog_clear(); - fprintf(stderr, "returned value for dialog_inputbox was %d (%s)\n", retval, result); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/radio3.c =================================================================== --- gnu/lib/libdialog/TESTS/radio3.c (revision 216873) +++ gnu/lib/libdialog/TESTS/radio3.c (working copy) @@ -1,98 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Hook functions */ - -static int spending; - -static int -check(dialogMenuItem *self) -{ - return ((int)(intptr_t)self->data == spending); -} - -static int -spend(dialogMenuItem *self) -{ - spending = (int)(intptr_t)self->data; - return DITEM_SUCCESS | DITEM_REDRAW; -} - -static void -ask(dialogMenuItem *self, int is_selected) -{ - if (is_selected) { - char *str; - - if (!strcmp(self->prompt, "1000")) - str = "You'd better ask both your parents first! "; - else if (!strcmp(self->prompt, "500")) - str = "You'd better at least ask your Dad! "; - else - str = "Yes, being frugal is probably a good idea!"; - DialogX = 15; - DialogY = 17; - dialog_msgbox("Free Advice", str, -1, -1, 0); - } -} - -/* - * menu5 - Show a simple radiolist menu that inherits the radio appearance by default and appears at - * a different location, leaving room for a msg box below it. This shows off the DialogX/DialogY extensions. - */ - -/* prompt title checked fire sel data */ -static dialogMenuItem menu5[] = { - { "1000", "Spend $1,000", check, spend, ask, (void *)1000 }, - { "500", "Spend $500", check, spend, ask, (void *)500 }, - { "100", "Spend $100", check, spend, ask, (void *)100 }, -}; - -/* End of hook functions */ - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - - DialogX = 5; - DialogY = 1; - retval = dialog_radiolist("this is dialog_radiolist() in action, test #3", - "This radio menu shows off the ability to put dialog menus and other\n" - "controls at different locations, as well as the `selected' hook which\n" - "lets you follow the traversal of the selection bar as well as what's\n" - "selected.", - -1, -1, 3, -3, menu5, NULL); - dialog_clear(); - fprintf(stderr, "returned value for dialog_radiolist was %d (money set to %d)\n", retval, spending); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/ftree1.test =================================================================== --- gnu/lib/libdialog/TESTS/ftree1.test (revision 216873) +++ gnu/lib/libdialog/TESTS/ftree1.test (working copy) @@ -1,73 +0,0 @@ -XTerm login - VendorShellExt shellext - VT100 vt100 - SimpleMenu fontMenu - SmeBSB menuLabel - SmeBSB fontdefault - SmeBSB font1 - SmeBSB font2 - SmeBSB font3 - SmeBSB font4 - SmeBSB font5 - SmeBSB font6 - SmeBSB fontescape - SmeBSB fontsel - SimpleMenu mainMenu - SmeBSB menuLabel - SmeBSB securekbd - SmeBSB allowsends - SmeBSB redraw - SmeLine line1 - SmeBSB 8-bit control - SmeBSB sun function-keys - SmeLine line2 - SmeBSB suspend - SmeBSB continue - SmeBSB interrupt - SmeBSB hangup - SmeBSB terminate - SmeBSB kill - SmeLine line3 - SmeBSB quit - SimpleMenu vtMenu - SmeBSB menuLabel - SmeBSB scrollbar - SmeBSB jumpscroll - SmeBSB reversevideo - SmeBSB autowrap - SmeBSB reversewrap - SmeBSB autolinefeed - SmeBSB appcursor - SmeBSB appkeypad - SmeBSB scrollkey - SmeBSB scrollttyoutput - SmeBSB allow132 - SmeBSB cursesemul - SmeBSB visualbell - SmeBSB marginbell - SmeBSB altscreen - SmeLine line1 - SmeBSB softreset - SmeBSB hardreset - SmeBSB clearsavedlines - SmeLine line2 - SmeBSB tekshow - SmeBSB tekmode - SmeBSB vthide - TopLevelShell tektronix - VendorShellExt shellext - Tek4014 tek4014 - SimpleMenu tekMenu - SmeBSB menuLabel - SmeBSB tektextlarge - SmeBSB tektext2 - SmeBSB tektext3 - SmeBSB tektextsmall - SmeLine line1 - SmeBSB tekpage - SmeBSB tekreset - SmeBSB tekcopy - SmeLine line2 - SmeBSB vtshow - SmeBSB vtmode - SmeBSB tekhide Index: gnu/lib/libdialog/TESTS/dselect.c =================================================================== --- gnu/lib/libdialog/TESTS/dselect.c (revision 216873) +++ gnu/lib/libdialog/TESTS/dselect.c (working copy) @@ -1,41 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - retval = dialog_dselect(".", "*"); - dialog_clear(); - fprintf(stderr, "returned value for dialog_dselect was %d\n", retval); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/ftree2.test =================================================================== --- gnu/lib/libdialog/TESTS/ftree2.test (revision 216873) +++ gnu/lib/libdialog/TESTS/ftree2.test (working copy) @@ -1,73 +0,0 @@ -XTerm login -XTerm login VendorShellExt shellext -XTerm login VT100 vt100 -XTerm login SimpleMenu fontMenu -XTerm login SimpleMenu fontMenu SmeBSB menuLabel -XTerm login SimpleMenu fontMenu SmeBSB fontdefault -XTerm login SimpleMenu fontMenu SmeBSB font1 -XTerm login SimpleMenu fontMenu SmeBSB font2 -XTerm login SimpleMenu fontMenu SmeBSB font3 -XTerm login SimpleMenu fontMenu SmeBSB font4 -XTerm login SimpleMenu fontMenu SmeBSB font5 -XTerm login SimpleMenu fontMenu SmeBSB font6 -XTerm login SimpleMenu fontMenu SmeBSB fontescape -XTerm login SimpleMenu fontMenu SmeBSB fontsel -XTerm login SimpleMenu mainMenu -XTerm login SimpleMenu mainMenu SmeBSB menuLabel -XTerm login SimpleMenu mainMenu SmeBSB securekbd -XTerm login SimpleMenu mainMenu SmeBSB allowsends -XTerm login SimpleMenu mainMenu SmeBSB redraw -XTerm login SimpleMenu mainMenu SmeLine line1 -XTerm login SimpleMenu mainMenu SmeBSB 8-bit control -XTerm login SimpleMenu mainMenu SmeBSB sun function-keys -XTerm login SimpleMenu mainMenu SmeLine line2 -XTerm login SimpleMenu mainMenu SmeBSB suspend -XTerm login SimpleMenu mainMenu SmeBSB continue -XTerm login SimpleMenu mainMenu SmeBSB interrupt -XTerm login SimpleMenu mainMenu SmeBSB hangup -XTerm login SimpleMenu mainMenu SmeBSB terminate -XTerm login SimpleMenu mainMenu SmeBSB kill -XTerm login SimpleMenu mainMenu SmeLine line3 -XTerm login SimpleMenu mainMenu SmeBSB quit -XTerm login SimpleMenu vtMenu -XTerm login SimpleMenu vtMenu SmeBSB menuLabel -XTerm login SimpleMenu vtMenu SmeBSB scrollbar -XTerm login SimpleMenu vtMenu SmeBSB jumpscroll -XTerm login SimpleMenu vtMenu SmeBSB reversevideo -XTerm login SimpleMenu vtMenu SmeBSB autowrap -XTerm login SimpleMenu vtMenu SmeBSB reversewrap -XTerm login SimpleMenu vtMenu SmeBSB autolinefeed -XTerm login SimpleMenu vtMenu SmeBSB appcursor -XTerm login SimpleMenu vtMenu SmeBSB appkeypad -XTerm login SimpleMenu vtMenu SmeBSB scrollkey -XTerm login SimpleMenu vtMenu SmeBSB scrollttyoutput -XTerm login SimpleMenu vtMenu SmeBSB allow132 -XTerm login SimpleMenu vtMenu SmeBSB cursesemul -XTerm login SimpleMenu vtMenu SmeBSB visualbell -XTerm login SimpleMenu vtMenu SmeBSB marginbell -XTerm login SimpleMenu vtMenu SmeBSB altscreen -XTerm login SimpleMenu vtMenu SmeLine line1 -XTerm login SimpleMenu vtMenu SmeBSB softreset -XTerm login SimpleMenu vtMenu SmeBSB hardreset -XTerm login SimpleMenu vtMenu SmeBSB clearsavedlines -XTerm login SimpleMenu vtMenu SmeLine line2 -XTerm login SimpleMenu vtMenu SmeBSB tekshow -XTerm login SimpleMenu vtMenu SmeBSB tekmode -XTerm login SimpleMenu vtMenu SmeBSB vthide -XTerm login TopLevelShell tektronix -XTerm login TopLevelShell tektronix VendorShellExt shellext -XTerm login TopLevelShell tektronix Tek4014 tek4014 -XTerm login SimpleMenu tekMenu -XTerm login SimpleMenu tekMenu SmeBSB menuLabel -XTerm login SimpleMenu tekMenu SmeBSB tektextlarge -XTerm login SimpleMenu tekMenu SmeBSB tektext2 -XTerm login SimpleMenu tekMenu SmeBSB tektext3 -XTerm login SimpleMenu tekMenu SmeBSB tektextsmall -XTerm login SimpleMenu tekMenu SmeLine line1 -XTerm login SimpleMenu tekMenu SmeBSB tekpage -XTerm login SimpleMenu tekMenu SmeBSB tekreset -XTerm login SimpleMenu tekMenu SmeBSB tekcopy -XTerm login SimpleMenu tekMenu SmeLine line2 -XTerm login SimpleMenu tekMenu SmeBSB vtshow -XTerm login SimpleMenu tekMenu SmeBSB vtmode -XTerm login SimpleMenu tekMenu SmeBSB tekhide Index: gnu/lib/libdialog/TESTS/text.c =================================================================== --- gnu/lib/libdialog/TESTS/text.c (revision 216873) +++ gnu/lib/libdialog/TESTS/text.c (working copy) @@ -1,41 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - retval = dialog_textbox("This is dialog_textbox() in action with /etc/passwd", "/etc/passwd", 10, 60); - dialog_clear(); - fprintf(stderr, "returned value for dialog_textbox was %d\n", retval); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/fselect.c =================================================================== --- gnu/lib/libdialog/TESTS/fselect.c (revision 216873) +++ gnu/lib/libdialog/TESTS/fselect.c (working copy) @@ -1,44 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - char *retval; - - init_dialog(); - - retval = dialog_fselect(".", "*.[ch]"); - dialog_clear(); - if (retval) - fprintf(stderr, "returned value for dialog_fselect was %s\n", retval); - else - fprintf(stderr, "returned value for dialog_fselect was NULL\n"); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/menu1.c =================================================================== --- gnu/lib/libdialog/TESTS/menu1.c (revision 216873) +++ gnu/lib/libdialog/TESTS/menu1.c (working copy) @@ -1,96 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Start of hook functions */ -static enum { nowhere, berlin, rome, ny } where; - -static int -_menu1_berlin_action(dialogMenuItem *self) -{ - if (where == berlin) { - dialog_mesgbox("excuse me?", "But you're already *in* Berlin!", -1, -1); - } - else { - where = berlin; - dialog_mesgbox("whoosh!", "Welcome to Berlin! Have a beer!", -1, -1); - } - return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE; -} - -static int -_menu1_rome_action(dialogMenuItem *self) -{ - if (where == rome) { - dialog_mesgbox("The wine must be getting to you..", "You're already in Rome!", -1, -1); - } - else { - where = rome; - dialog_mesgbox("whoosh!", "Welcome to Rome! Have a coffee!", -1, -1); - } - return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE; -} - -static int -_menu1_ny_action(dialogMenuItem *self) -{ - if (where == ny) { - dialog_mesgbox("Say what?", "You're already there!", -1, -1); - } - else { - where = ny; - dialog_mesgbox("whoosh!", "Welcome to New York! Now go someplace else!", -1, -1); - } - return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE; -} - -/* menu1 - show off the "fire" action hook */ -/* prompt title checked fire */ -static dialogMenuItem menu1[] = { - { "Berlin", "Go visit Germany's new capitol", NULL, _menu1_berlin_action }, - { "Rome", "Go visit the Roman ruins", NULL, _menu1_rome_action }, - { "New York", "Go visit the streets of New York", NULL, _menu1_ny_action }, -}; - -/* End of hook functions */ - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - retval = dialog_menu("this is dialog_menu() in action, test #1", - "this simple menu shows off some of the straight-forward features\n" - "of the new menu system's action dispatch hooks. Select Cancel to leave", - -1, -1, 3, -3, menu1, NULL, NULL, NULL); - dialog_clear(); - fprintf(stderr, "returned value for dialog_menu was %d\n", retval); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/menu2.c =================================================================== --- gnu/lib/libdialog/TESTS/menu2.c (revision 216873) +++ gnu/lib/libdialog/TESTS/menu2.c (working copy) @@ -1,96 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Start of hook functions */ -static enum { nowhere, berlin, rome, ny } where; - -static int -_menu1_berlin_action(dialogMenuItem *self) -{ - if (where == berlin) - dialog_mesgbox("excuse me?", "But you're already *in* Berlin!", -1, -1); - else { - where = berlin; - dialog_mesgbox("whoosh!", "Welcome to Berlin! Have a beer!", -1, -1); - } - return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE; -} - -static int -_menu1_rome_action(dialogMenuItem *self) -{ - if (where == rome) - dialog_mesgbox("The wine must be getting to you..", "You're already in Rome!", -1, -1); - else { - where = rome; - dialog_mesgbox("whoosh!", "Welcome to Rome! Have a coffee!", -1, -1); - } - return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE; -} - -static int -_menu1_ny_action(dialogMenuItem *self) -{ - if (where == ny) - dialog_mesgbox("Say what?", "You're already there!", -1, -1); - else { - where = ny; - dialog_mesgbox("whoosh!", "Welcome to New York! Now go someplace else!", -1, -1); - } - return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE; -} - -/* menu1 - show off the "fire" action hook */ -/* prompt title checked fire */ -static dialogMenuItem menu1[] = { - { "Berlin", "Go visit Germany's new capitol", NULL, _menu1_berlin_action }, - { "Rome", "Go visit the Roman ruins", NULL, _menu1_rome_action }, - { "New York", "Go visit the streets of New York", NULL, _menu1_ny_action }, -}; - -/* End of hook functions */ - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - use_helpfile("menu2.c"); - use_helpline("Type F1 to view the source for this demo"); - retval = dialog_menu("this is dialog_menu() in action, test #2", - "this simple menu shows off some of the straight-forward features\n" - "of the new menu system's action dispatch hooks as well as a helpline\n" - "and a helpfile. Select Cancel to leave", - -1, -1, 3, -3, menu1, NULL, NULL, NULL); - dialog_clear(); - fprintf(stderr, "returned value for dialog_menu was %d\n", retval); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/ftree1.c =================================================================== --- gnu/lib/libdialog/TESTS/ftree1.c (revision 216873) +++ gnu/lib/libdialog/TESTS/ftree1.c (working copy) @@ -1,45 +0,0 @@ -/* - * ftree1.c - * - * small test-driver for new dialog functionality - * - * Copyright (c) 1998, Anatoly A. Orehovsky - * - * file ./ftree1.test with xterm widget tree from - * direct editres(1) dump needed !!! - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <dialog.h> - -int -main(int argc, char **argv) -{ - int retval; - unsigned char *tresult; - - init_dialog(); - retval = dialog_ftree("ftree1.test", '\t', - "ftree dialog box example", - "xterm widget tree from direct editres(1) dump", - -1, -1, 15, - &tresult); - - dialog_update(); - - dialog_clear(); - - end_dialog(); - - if (!retval) - { - puts(tresult); - free(tresult); - } - - exit(retval); -} Index: gnu/lib/libdialog/TESTS/msg.c =================================================================== --- gnu/lib/libdialog/TESTS/msg.c (revision 216873) +++ gnu/lib/libdialog/TESTS/msg.c (working copy) @@ -1,42 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - retval = dialog_msgbox("This is dialog_msgbox() in action with pause on", "Hi there. Please press return now.", - -1, -1, 1); - dialog_clear(); - fprintf(stderr, "returned value for dialog_msgbox was %d\n", retval); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/menu3.c =================================================================== --- gnu/lib/libdialog/TESTS/menu3.c (revision 216873) +++ gnu/lib/libdialog/TESTS/menu3.c (working copy) @@ -1,107 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Hook functions */ - -static int -stop(dialogMenuItem *self) -{ - dialog_mesgbox("!", "I'm no idiot!", -1, -1); - return DITEM_SUCCESS; -} - -static int -maybe(dialogMenuItem *self) -{ - dialog_mesgbox("!", "I said don't rush me! I'm THINKING!", -1, -1); - return DITEM_SUCCESS | DITEM_RESTORE | DITEM_CONTINUE; -} - -/* Dummy menu just to show of the ability */ -static char *insurance[] = { - "1,000,000", "Mondo insurance policy", "Off", - "5,000,000", "Mega insurance policy", "Off", - "10,000,000", "Friend! Most Favored customer!", "On" -}; - -static void -preinsure(dialogMenuItem *self, int is_selected) -{ - if (is_selected) { - static WINDOW *w; - - /* This has to be here first if you want to see selection traverse properly in the invoking menu */ - refresh(); - - w = dupwin(newscr); - DialogX = 1; - DialogY = 13; - dialog_radiolist("How much insurance would you like to take out?", - "If you're really going to do this, we recommend some insurance\n" - "first! What kind of life insurance policy would you like?", - -1, -1, 3, 3, insurance, NULL); - touchwin(w); - wrefresh(w); - delwin(w); - } -} - -/* - * Show a simple menu that puts up a sub menu when a certain item is traversed to - */ - -/* prompt title checked fire sel */ -static dialogMenuItem doit[] = { - { "Rah!" }, - { "No way!" }, - { "Stop", "No, I'm not going to do that!", NULL, stop, NULL }, - { "Maybe", "I'm still thinking about it, don't rush me!", NULL, maybe, NULL, }, - { "Go", "Yes! Yes! I want to do it!", NULL, NULL, preinsure }, -}; - -/* End of hook functions */ - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int retval; - - init_dialog(); - - - DialogX = 5; - DialogY = 1; - retval = dialog_menu("Do you have the GUTS?", - "C'mon, macho man! Do you have what it takes to do something REALLY\n" - "dangerous and stupid? WHAT ARE YOU WAITING FOR?!", - -1, -1, 3, -3, doit + 2, (char *)TRUE, NULL, NULL); - dialog_clear(); - fprintf(stderr, "returned value for dialog_menu was %d\n", retval); - - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/ftree2.c =================================================================== --- gnu/lib/libdialog/TESTS/ftree2.c (revision 216873) +++ gnu/lib/libdialog/TESTS/ftree2.c (working copy) @@ -1,47 +0,0 @@ -/* - * ftree2.c - * - * small test-driver for new dialog functionality - * - * Copyright (c) 1998, Anatoly A. Orehovsky - * - * file ./ftree2.test with xterm widget tree from - * preprocess editres(1) dump needed !!! - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <dialog.h> - -int -main(int argc, char **argv) -{ - int retval; - unsigned char *tresult; - - init_dialog(); - use_helpfile("ftree2.test"); - use_helpline("Press Arrows, Tab, Enter or F1"); - retval = dialog_ftree("ftree2.test", '\t', - "ftree dialog box example", - "xterm widget tree from preprocess editres(1) dump", - -1, -1, 15, - &tresult); - - dialog_update(); - - dialog_clear(); - - end_dialog(); - - if (!retval) - { - puts(tresult); - free(tresult); - } - - exit(retval); -} Index: gnu/lib/libdialog/TESTS/gauge.c =================================================================== --- gnu/lib/libdialog/TESTS/gauge.c (revision 216873) +++ gnu/lib/libdialog/TESTS/gauge.c (working copy) @@ -1,41 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int i; - - init_dialog(); - - for (i = 0; i <= 100; i++) { - dialog_gauge("Gas tank", "When this gets 100% full, you'd better yank out the nozzle!", 10, 1, 7, 70, i); - usleep(30000); - } - end_dialog(); - return 0; -} Index: gnu/lib/libdialog/TESTS/Makefile =================================================================== --- gnu/lib/libdialog/TESTS/Makefile (revision 216873) +++ gnu/lib/libdialog/TESTS/Makefile (working copy) @@ -1,20 +0,0 @@ -# Really quick and evil Makefile for building all the tests. I wish that -# bmake was friendlier to the concept of multiple progs/libs in the same -# directory. -# -# $FreeBSD$ - -PROGS= msg yesno prgbox gauge dselect fselect text menu1 menu2 menu3 \ - input1 input2 check1 check2 check3 radio1 radio2 radio3 \ - ftree1 ftree2 tree - -WARNS?= 2 -CFLAGS+= -Wall -Wstrict-prototypes -LDFLAGS+= -ldialog - -all: ${PROGS} - -clean: - rm -f ${PROGS} - -.include <bsd.prog.mk> Index: gnu/lib/libdialog/TESTS/yesno.c =================================================================== --- gnu/lib/libdialog/TESTS/yesno.c (revision 216873) +++ gnu/lib/libdialog/TESTS/yesno.c (working copy) @@ -1,45 +0,0 @@ -/* - * small test-driver for new dialog functionality - * - * Copyright (c) 1995, Jordan Hubbard - * - * All rights reserved. - * - * This source code may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of the software nor does - * the author assume any responsibility for damages incurred with - * its use. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <sys/wait.h> -#include <dialog.h> - -/* Kick it off, James! */ -int -main(int argc, char **argv) -{ - int rval1, rval2; - - init_dialog(); - - rval1 = dialog_yesno("This is dialog_yesno() in action", - "Have you stopped deliberately putting bugs into your code?", -1, -1); - dialog_clear(); - rval2 = dialog_noyes("This is dialog_noyes() in action", - "Have you stopped beating your wife?", -1, -1); - dialog_clear(); - end_dialog(); - fprintf(stderr, "returned value for dialog_yesno was %d\n", rval1); - fprintf(stderr, "returned value for dialog_noyes was %d\n", rval2); - return 0; -} Index: gnu/lib/libdialog/dir.h =================================================================== --- gnu/lib/libdialog/dir.h (revision 216873) +++ gnu/lib/libdialog/dir.h (working copy) @@ -1,38 +0,0 @@ -/* - * include file for dir.c - * - * Copyright (c) 1995, Marc van Kempen - * - * All rights reserved. - * - * This software may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with - * its use. - * - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/dirent.h> - -typedef struct DirList { /* structure to hold the directory entries */ - char filename[MAXNAMLEN]; /* together with the stat-info per file */ - struct stat filestatus; /* filename, or the name to which it points */ - int link; /* is it a link ? */ - char *linkname; /* the name of the file the link points to */ -} DirList; - -#ifndef TRUE -#define TRUE (1) -#endif -#ifndef FALSE -#define FALSE (0) -#endif - -void get_dir(char *dirname, char *fmask, DirList **dir, int *n); -void get_filenames(DirList *d, int n, char ***names, int *nf); -void FreeDir(DirList *d, int n); Index: gnu/lib/libdialog/TODO =================================================================== --- gnu/lib/libdialog/TODO (revision 216873) +++ gnu/lib/libdialog/TODO (working copy) @@ -1,36 +0,0 @@ -- cut off names in the listbox that are to long -done 27Jan95 - The current behaviour may not be desirable. When browsing through - long names these, when highlighted, will be shown with the first - characters cut off, when not highlighted the last characters will - be cut off. - -- look at behaviour of TAB key when browsing through directories. -done 28Jan95 - -- make sure the full name of the directory is written to the - "Directory:"-box -done 28Jan95 - -- mark current selections in listbox when initializing the listobject -Idontknow -- test and use Notify() when checking for error conditions -ok -- test overall -- adapt color of buttons when changing focus to the button. -done 28Jan95 -- add shade to dialog_fselect()-window -done 29Jan95 -- add (nn%) indication to lists. -done 30Jan95 -- add use_helpfile() -done 13Feb95 -- add use_helpline() - -NOTE: apparently there is a bug (or a strange interaction between pkg_manage -and dialog_textbox) in dialog_textbox. When I use this routine to display -the helpfile in display_helpfile() the program gets mysterious segmentation -faults and bus errors. -I now use dialog_mesgbox, after I have read the file into a buffer. - - Index: gnu/lib/libdialog/fselect.c =================================================================== --- gnu/lib/libdialog/fselect.c (revision 216873) +++ gnu/lib/libdialog/fselect.c (working copy) @@ -1,402 +0,0 @@ -/* - * program: fselect.c - * author: Marc van Kempen (wmbfmk@urc.tue.nl) - * Desc: File selection routine - * - * Copyright (c) 1995, Marc van Kempen - * - * All rights reserved. - * - * This software may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with - * its use. - * - */ - -#include <stdlib.h> -#include <unistd.h> -#include <sys/param.h> -#include <dialog.h> -#include "ui_objects.h" -#include "dir.h" -#include "dialog.priv.h" - -/* - * Local prototypes - */ - -char *dialog_dfselect(char *dir, char *fmask, int is_fselect); - -/* - * Functions - */ - -void -get_directories(DirList *d, int n, char ***names, int *nd) -/* - * Desc: return the directorienames in <dir> as an array in - * <names>, the # of entries in <nd>, memory allocated - * to *names should be freed when done with it. - */ -{ - int i; - - /* count the directories, which are in front */ - *nd = 0; - while ((*nd < n) && (S_ISDIR(d[*nd].filestatus.st_mode))) (*nd)++; - *names = (char **) malloc( *nd * sizeof(char *) ); - for (i=0; i<*nd; i++) { - (*names)[i] = (char *) malloc( strlen(d[i].filename) + 1); - strcpy((*names)[i], d[i].filename); - } - - return; -} /* get_directories() */ - -void -get_filenames(DirList *d, int n, char ***names, int *nf) -/* - * Desc: return the filenames in <dir> as an arry in - * <names>, the # of entries in <nf>, memory allocated - * to *names should be freed when done. - */ -{ - int nd, i; - - /* the # of regular files is the total # of files - # of directories */ - /* count the # of directories */ - nd = 0; - while ((nd < n) && (S_ISDIR(d[nd].filestatus.st_mode))) nd++; - - *names = (char **) malloc( (n-nd) * sizeof(char *) ); - *nf = n - nd; - for (i=0; i<*nf; i++) { - (*names)[i] = (char *) malloc( strlen(d[i+nd].filename) + 1); - strcpy((*names)[i], d[i+nd].filename); - } - - return; -} /* get_filenames() */ - -void -FreeNames(char **names, int n) -/* - * Desc: free the space occupied by names - */ -{ - int i; - - /* free the space occupied by names */ - for (i=0; i<n; i++) { - free(names[i]); - } - free(names); - - return; -} /* FreeNames() */ - -int -dialog_dselect_old(void) -/* - * Desc: starting from the current directory, - * choose a new current directory - */ -{ - DirList *d = NULL; - char **names, old_dir[MAXPATHLEN]; - WINDOW *ds_win; - ButtonObj *okbut, *cancelbut; - ListObj *dirs_obj; - StringObj *dir_obj; - char o_dir[MAXPATHLEN]; - struct ComposeObj *obj = NULL; - int n, nd, okbutton, cancelbutton, - quit, cancel, ret; - - ds_win = newwin(LINES-8, COLS-30, 4, 15); - if (ds_win == NULL) { - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", - LINES-8, COLS-30, 4, 15); - exit(1); - } - draw_box(ds_win, 0, 0, LINES-8, COLS-30, dialog_attr, border_attr); - wattrset(ds_win, dialog_attr); - mvwaddstr(ds_win, 0, (COLS-30)/2 - 9, " Directory Select "); - draw_shadow(stdscr, 4, 15, LINES-8, COLS-30); - display_helpline(ds_win, LINES-9, COLS-30); - - /* the Directory string input field */ - getcwd(o_dir, MAXPATHLEN); - dir_obj = NewStringObj(ds_win, "Directory:", o_dir, 1, 2, COLS-34, MAXPATHLEN-1); - AddObj(&obj, STRINGOBJ, (void *) dir_obj); - - /* the list of directories */ - get_dir(".", "*", &d, &n); - get_directories(d, n, &names, &nd); - dirs_obj = NewListObj(ds_win, "Directories:", names, o_dir, 5, 2, - LINES-15, COLS-48, nd); - AddObj(&obj, LISTOBJ, (void *) dirs_obj); - - /* the Ok-button */ - okbutton = FALSE; - okbut = NewButtonObj(ds_win, "Continue", &okbutton, 7, COLS-45); - AddObj(&obj, BUTTONOBJ, (void *) okbut); - - /* the Cancel-button */ - cancelbutton = FALSE; - cancelbut = NewButtonObj(ds_win, "Return", &cancelbutton, 11, COLS-44); - AddObj(&obj, BUTTONOBJ, (void *) cancelbut); - - quit = FALSE; - cancel = FALSE; - strcpy(old_dir, o_dir); - while (!quit) { - ret = PollObj(&obj); - switch(ret) { - case SEL_BUTTON: - if (okbutton) { - quit = TRUE; - } - if (cancelbutton) { - quit = TRUE; - cancel = TRUE; - } - break; - case SEL_CR: - if (strcmp(old_dir, o_dir)) { - /* the directory was changed, cd into it */ - if (chdir(o_dir)) { - dialog_notify("Could not change into directory"); - strcpy(o_dir, old_dir); - } else { - getcwd(o_dir, MAXPATHLEN); - strcpy(old_dir, o_dir); - } - RefreshStringObj(dir_obj); - } - get_dir(".", "*", &d, &n); - FreeNames(names, nd); - get_directories(d, n, &names, &nd); - UpdateListObj(dirs_obj, names, nd); - if (((obj->prev)->obj == (void *) dirs_obj)) { - obj=obj->prev; - } - break; - case SEL_ESC: - quit = TRUE; - cancel = TRUE; - break; - case KEY_F(1): - display_helpfile(); - break; - } - } - - FreeNames(names, nd); - DelObj(obj); - delwin(ds_win); - - return(cancel); - -} /* dialog_dselect() */ - -int -dialog_dselect(char *dir, char *fmask) -/* - * Desc: Choose a directory - */ -{ - if (dialog_dfselect(dir, fmask, FALSE)) { - return(FALSE); /* esc or cancel was pressed */ - } else { - return(TRUE); /* directory was selected */ - } -} /* dialog_dselect() */ - -char * -dialog_fselect(char *dir, char *fmask) -/* - * Desc: Choose a file from a directory - */ -{ - return(dialog_dfselect(dir, fmask, TRUE)); -} /* dialog_fselect() */ - -char * -dialog_dfselect(char *dir, char *fmask, int is_fselect) -/* - * Desc: choose a file from the directory <dir>, which - * initially display files with the mask <filemask> - * pre: <dir> is the initial directory - * only files corresponding to the mask <fmask> are displayed - * post: returns NULL if no file was selected - * else returns pointer to filename, space is allocated, should - * be freed after use. - */ -{ - DirList *d = NULL; - char msg[512]; - char **fnames, **dnames, *ret_name; - WINDOW *fs_win; - int n, nd, nf, ret; - StringObj *fm_obj, *dir_obj, *sel_obj; - char o_fm[255], o_dir[MAXPATHLEN], o_sel[MAXPATHLEN]; - char old_fmask[255], old_dir[MAXPATHLEN]; - ListObj *dirs_obj, *files_obj; - struct ComposeObj *obj = NULL, *o; - int quit, cancel; - ButtonObj *okbut_obj, *canbut_obj; - int ok_button, cancel_button; - - if (chdir(dir)) { - sprintf(msg, "Could not move into specified directory: %s", dir); - dialog_notify(msg); - return(NULL); - } - getcwd(o_dir, MAXPATHLEN); - - /* setup the fileselect-window and initialize its components */ - fs_win = newwin(LINES-2, COLS-20, 1, 10); - if (fs_win == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", - LINES-2, COLS-20, 2, 10); - exit(1); - } - draw_box(fs_win, 0, 0, LINES-2, COLS-20, dialog_attr, border_attr); - wattrset(fs_win, dialog_attr); - if (is_fselect) { - mvwaddstr(fs_win, 0, (COLS-20)/2 - 7, " File Select "); - } else { - mvwaddstr(fs_win, 0, (COLS-20)/2 - 9, " Directory Select "); - } - draw_shadow(stdscr, 1, 10, LINES-2, COLS-20); - display_helpline(fs_win, LINES-3, COLS-20); - - /* Filemask entry */ - strcpy(o_fm, fmask); - fm_obj = NewStringObj(fs_win, "Filemask:", o_fm, 1, 2, 19, 255); - AddObj(&obj, STRINGOBJ, (void *) fm_obj); - - /* Directory entry */ - dir_obj = NewStringObj(fs_win, "Directory:", o_dir, 1, 22, COLS-44, 255); - AddObj(&obj, STRINGOBJ, (void *) dir_obj); - - /* Directory list */ - get_dir(".", fmask, &d, &n); /* read the entire directory */ - get_directories(d, n, &dnames, &nd); /* extract the dir-entries */ - if (is_fselect) { - dirs_obj = NewListObj(fs_win, "Directories:", dnames, o_dir, 5, 2, - LINES-16, (COLS-20)/2-2, nd); - } else { - dirs_obj = NewListObj(fs_win, "Directories:", dnames, o_dir, 5, 2, - LINES-12, (COLS-20)/2-2, nd); - } - AddObj(&obj, LISTOBJ, (void *) dirs_obj); - - /* Filenames list */ - get_filenames(d, n, &fnames, &nf); /* extract the filenames */ - if (is_fselect) { - files_obj = NewListObj(fs_win, "Files:", fnames, o_sel, 5, (COLS-20)/2+1, - LINES-16, (COLS-20)/2-3, nf); - } else { - files_obj = NewListObj(fs_win, "Files:", fnames, o_sel, 5, (COLS-20)/2+1, - LINES-12, (COLS-20)/2-3, nf); - } - AddObj(&obj, LISTOBJ, (void *) files_obj); - - if (is_fselect) { - /* Selection entry */ - o_sel[0] = '\0'; - sel_obj = NewStringObj(fs_win, "Selection:", o_sel, LINES-10, 2, COLS-24, 255); - AddObj(&obj, STRINGOBJ, (void *) sel_obj); - } - - /* Ok button */ - ok_button = FALSE; - okbut_obj = NewButtonObj(fs_win, "Ok", &ok_button, LINES-6, 20); - AddObj(&obj, BUTTONOBJ, (void *) okbut_obj); - - /* Cancel button */ - cancel_button = FALSE; - canbut_obj = NewButtonObj(fs_win, "Cancel", &cancel_button, LINES-6, 30); - AddObj(&obj, BUTTONOBJ, (void *) canbut_obj); - - /* Make sure all objects on the window are drawn */ - wrefresh(fs_win); - keypad(fs_win, TRUE); - - /* Start the reading */ - o = obj; - strcpy(old_fmask, o_fm); - strcpy(old_dir, o_dir); - quit = FALSE; - cancel = FALSE; - while (!quit) { - ret = PollObj(&o); - switch(ret) { - case SEL_CR: - if (strcmp(old_fmask, o_fm) || strcmp(old_dir, o_dir)) { - /* reread directory and update the listobjects */ - if (strcmp(old_dir, o_dir)) { /* dir entry was changed */ - if (chdir(o_dir)) { - dialog_notify("Could not change into directory"); - strcpy(o_dir, old_dir); - } else { - getcwd(o_dir, MAXPATHLEN); - strcpy(old_dir, o_dir); - } - RefreshStringObj(dir_obj); - } else { /* fmask entry was changed */ - strcpy(old_fmask, o_fm); - } - get_dir(".", o_fm, &d, &n); - FreeNames(dnames, nd); - get_directories(d, n, &dnames, &nd); - UpdateListObj(dirs_obj, dnames, nd); - FreeNames(fnames, nf); - get_filenames(d, n, &fnames, &nf); - UpdateListObj(files_obj, fnames, nf); - if (((o->prev)->obj == (void *) dirs_obj)) { - o=o->prev; - } - } - break; - case SEL_BUTTON: - /* check which button was pressed */ - if (ok_button) { - quit = TRUE; - } - if (cancel_button) { - quit = TRUE; - cancel = TRUE; - } - break; - case SEL_ESC: - quit = TRUE; - cancel = TRUE; - break; - case KEY_F(1): - case '?': - display_helpfile(); - break; - } - } - DelObj(obj); - FreeNames(dnames, nd); - FreeNames(fnames, nf); - delwin(fs_win); - - if (cancel || (strlen(o_sel) == 0)) { - return(NULL); - } else { - ret_name = (char *) malloc( strlen(o_sel) + 1 ); - strcpy(ret_name, o_sel); - return(ret_name); - } -} /* dialog_fselect() */ - Index: gnu/lib/libdialog/help.c =================================================================== --- gnu/lib/libdialog/help.c (revision 216873) +++ gnu/lib/libdialog/help.c (working copy) @@ -1,194 +0,0 @@ -/*************************************************************** - * - * Program: help.c - * Author: Marc van Kempen - * Desc: get help - * - * - * Copyright (c) 1995, Marc van Kempen - * - * All rights reserved. - * - * This software may be used, modified, copied, distributed, and - * sold, in both source and binary form provided that the above - * copyright and these terms are retained, verbatim, as the first - * lines of this file. Under no circumstances is the author - * responsible for the proper functioning of this software, nor does - * the author assume any responsibility for damages incurred with - * its use. - * - ***************************************************************/ - -#include <stdlib.h> -#include <sys/param.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <string.h> -#include <dialog.h> - -static char _helpfilebuf[MAXPATHLEN]; -static char _helplinebuf[77]; /* limit the helpline to 76 characters */ -static char *_helpfile = NULL; -static char *_helpline = NULL; - -/****************************************************************** - * - * helpfile routines - * - ******************************************************************/ - -void -use_helpfile(char *hfile) -/* - * desc: set the helpfile to be opened on pressing F1 to <helpfile> - */ -{ - if (hfile != NULL) { - _helpfile = _helpfilebuf; - strcpy(_helpfile, hfile); - } else { - _helpfile = NULL; - } - - return; -} /* use_helpfile() */ - -void -display_helpfile(void) -/* - * desc: display the current helpfile in a window - */ -{ - WINDOW *w; - FILE *f; - struct stat sb; - char msg[80], *buf; - static int in_help = FALSE; - char *savehline = NULL; - - if (in_help) return; /* dont call help when you're in help */ - - if (_helpfile != NULL) { - if ((w = dupwin(newscr)) == NULL) { - dialog_notify("No memory to dup previous screen\n"); - return; - } - if ((f = fopen(_helpfile, "r")) == NULL) { - sprintf(msg, "Can't open helpfile : %s\n", _helpfile); - dialog_notify(msg); - return; - } - if (fstat(fileno(f), &sb)) { - sprintf(msg, "Can't stat helpfile : %s\n", _helpfile); - dialog_notify(msg); - return; - } - if ((buf = (char *) malloc( sb.st_size )) == NULL) { - sprintf(msg, "Could not malloc space for helpfile : %s\n", _helpfile); - dialog_notify(msg); - return; - } - if (fread(buf, 1, sb.st_size, f) != sb.st_size) { - sprintf(msg, "Could not read entire help file : %s", _helpfile); - dialog_notify(msg); - free(buf); - return; - } - buf[sb.st_size] = 0; - in_help = TRUE; - savehline = get_helpline(); - use_helpline("Use arrowkeys, PgUp, PgDn, Home and End to move through text"); - dialog_mesgbox("Online help", buf, LINES-4, COLS-4); - restore_helpline(savehline); - in_help = FALSE; - touchwin(w); - wrefresh(w); - delwin(w); - free(buf); - } else { - /* do nothing */ - } - - return; -} /* display_helpfile() */ - - -/****************************************************************** - * - * helpline routines - * - ******************************************************************/ - -void -use_helpline(char *hline) -/* - * desc: set the helpline to printed in dialogs - */ -{ - if (hline) { - _helpline = _helplinebuf; - if (strlen(hline) > 76) { - /* only display the first 76 characters in the helpline */ - strncpy(_helpline, hline, 76); - _helpline[76] = 0; - } else { - strcpy(_helpline, hline); - } - } else { - _helpline = NULL; - } - - return; -} /* use_helpline() */ - -void -display_helpline(WINDOW *w, int y, int width) -/* - * desc: display the helpline at the given coordinates <y, x> in the window <w> - */ -{ - if (_helpline != NULL) { - if (strlen(_helpline) > width - 6) { - _helpline[width - 6] = 0; - } - wmove(w, y, (int) (width - strlen(_helpline)- 4) / 2); - wattrset(w, title_attr); - waddstr(w, "[ "); - waddstr(w, _helpline); - waddstr(w, " ]"); - } else { - /* do nothing */ - } - - return; -} - -char * -get_helpline(void) -/* - * desc: allocate new space, copy the helpline to it and return a pointer to it - */ -{ - char *hlp; - - if (_helpline) { - hlp = (char *) malloc( strlen(_helpline) + 1 ); - strcpy(hlp, _helpline); - } else { - hlp = NULL; - } - - return(hlp); -} /* get_helpline() */ - -void -restore_helpline(char *helpline) -/* - * Desc: set the helpline to <helpline> and free the space allocated to it - */ -{ - use_helpline(helpline); - free(helpline); - - return; -} /* restore_helpline() */ Index: gnu/lib/libdialog/radiolist.c =================================================================== --- gnu/lib/libdialog/radiolist.c (revision 216873) +++ gnu/lib/libdialog/radiolist.c (working copy) @@ -1,628 +0,0 @@ -/* - * radiolist.c -- implements the radiolist box - * - * AUTHOR: Stuart Herbert - S.Herbert@sheffield.ac.uk - * (from checklist.c by Savio Lam (lam836@cs.cuhk.hk)) - * - * Substantial rennovation: 12/18/95, Jordan K. Hubbard - * - * This program 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 - * of the License, or (at your option) any later version. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <dialog.h> -#include "dialog.priv.h" - - -static void print_item(WINDOW *win, char *tag, char *item, int status, int choice, int selected, dialogMenuItem *me); - -#define DREF(di, item) ((di) ? &((di)[(item)]) : NULL) - -static int list_width, check_x, item_x; - - -/* - * Display a dialog box with a list of options that can be turned on or off - */ -int -dialog_radiolist(unsigned char *title, unsigned char *prompt, int height, int width, int list_height, - int cnt, void *it, unsigned char *result) -{ - int i, j, x, y, cur_x, cur_y, old_x, old_y, box_x, box_y, key = 0, button, - choice, l, k, scroll, max_choice, *status, item_no = 0, was_on = 0; - int redraw_menu = FALSE, cursor_reset = FALSE; - int rval = 0, onlist = 1, ok_space, cancel_space; - char okButton, cancelButton; - WINDOW *dialog, *list; - unsigned char **items = NULL; - dialogMenuItem *ditems; - - /* Allocate space for storing item on/off status */ - if ((status = alloca(sizeof(int) * abs(cnt))) == NULL) { - endwin(); - fprintf(stderr, "\nCan't allocate memory in dialog_radiolist().\n"); - exit(-1); - } - -draw: - button = choice = scroll = 0; - /* Previous calling syntax, e.g. just a list of strings? */ - if (cnt >= 0) { - items = it; - ditems = NULL; - item_no = cnt; - /* Initializes status */ - for (i = 0; i < item_no; i++) { - status[i] = !strcasecmp(items[i*3 + 2], "on"); - if (status[i]) { - if (was_on) - status[i] = FALSE; - else - was_on = 1; - } - } - } - /* It's the new specification format - fake the rest of the code out */ - else { - item_no = abs(cnt); - ditems = it; - if (!items) - items = (unsigned char **)alloca((item_no * 3) * sizeof(unsigned char *)); - /* Initializes status */ - for (i = 0; i < item_no; i++) { - status[i] = ditems[i].checked ? ditems[i].checked(&ditems[i]) : FALSE; - if (status[i]) { - if (was_on) - status[i] = FALSE; - else - was_on = 1; - } - items[i*3] = ditems[i].prompt; - items[i*3 + 1] = ditems[i].title; - items[i*3 + 2] = status[i] ? "on" : "off"; - } - } - max_choice = MIN(list_height, item_no); - - check_x = 0; - item_x = 0; - /* Find length of longest item in order to center radiolist */ - for (i = 0; i < item_no; i++) { - l = strlen(items[i * 3]); - for (j = 0; j < item_no; j++) { - k = strlen(items[j * 3 + 1]); - check_x = MAX(check_x, l + k + 6); - } - item_x = MAX(item_x, l); - } - if (height < 0) - height = strheight(prompt) + list_height + 4 + 2; - if (width < 0) { - i = strwidth(prompt); - j = ((title != NULL) ? strwidth(title) : 0); - width = MAX(i, j); - width = MAX(width, check_x + 4) + 4; - } - width = MAX(width, 24); - - if (width > COLS) - width = COLS; - if (height > LINES) - height = LINES; - /* center dialog box on screen */ - x = DialogX ? DialogX : (COLS - width) / 2; - y = DialogY ? DialogY : (LINES - height) / 2; - -#ifdef HAVE_NCURSES - if (use_shadow) - draw_shadow(stdscr, y, x, height, width); -#endif - dialog = newwin(height, width, y, x); - if (dialog == NULL) { - endwin(); - fprintf(stderr, "\nnewwin(%d,%d,%d,%d) failed, maybe wrong dims\n", height, width, y, x); - return -1; - } - keypad(dialog, TRUE); - - draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); - wattrset(dialog, border_attr); - wmove(dialog, height - 3, 0); - waddch(dialog, ACS_LTEE); - for (i = 0; i < width - 2; i++) - waddch(dialog, ACS_HLINE); - wattrset(dialog, dialog_attr); - waddch(dialog, ACS_RTEE); - wmove(dialog, height - 2, 1); - for (i = 0; i < width - 2; i++) - waddch(dialog, ' '); - - if (title != NULL) { - wattrset(dialog, title_attr); - wmove(dialog, 0, (width - strlen(title)) / 2 - 1); - waddch(dialog, ' '); - waddstr(dialog, title); - waddch(dialog, ' '); - } - wattrset(dialog, dialog_attr); - wmove(dialog, 1, 2); - print_autowrap(dialog, prompt, height - 1, width - 2, width, 1, 2, TRUE, FALSE); - - list_width = width - 6; - getyx(dialog, cur_y, cur_x); - box_y = cur_y + 1; - box_x = (width - list_width) / 2 - 1; - - /* create new window for the list */ - list = subwin(dialog, list_height, list_width, y + box_y + 1, x + box_x + 1); - if (list == NULL) { - delwin(dialog); - endwin(); - fprintf(stderr, "\nsubwin(dialog,%d,%d,%d,%d) failed, maybe wrong dims\n", list_height, list_width, - y + box_y + 1,x + box_x + 1); - return -1; - } - keypad(list, TRUE); - - /* draw a box around the list items */ - draw_box(dialog, box_y, box_x, list_height+2, list_width+2, menubox_border_attr, menubox_attr); - - check_x = (list_width - check_x) / 2; - item_x = check_x + item_x + 6; - - /* Print the list */ - for (i = 0; i < max_choice; i++) - print_item(list, items[i * 3], items[i * 3 + 1], status[i], i, i == choice, DREF(ditems, i)); - wnoutrefresh(list); - print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y); - - display_helpline(dialog, height-1, width); - - x = width/ 2 - 11; - y = height - 2; - if (ditems && result) { - cancelButton = toupper(ditems[CANCEL_BUTTON].prompt[0]); - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, - ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : FALSE); - okButton = toupper(ditems[OK_BUTTON].prompt[0]); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, - ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : TRUE); - } - else { - cancelButton = 'C'; - print_button(dialog, "Cancel", y, x + 14, FALSE); - okButton = 'O'; - print_button(dialog, " OK ", y, x, TRUE); - } - wnoutrefresh(dialog); - wmove(list, choice, check_x+1); - wrefresh(list); - - while (key != ESC) { - key = wgetch(dialog); - - /* See if its the short-cut to "OK" */ - if (toupper(key) == okButton) { - if (ditems) { - if (result && ditems[OK_BUTTON].fire) { - int st; - WINDOW *save; - - save = dupwin(newscr); - st = ditems[OK_BUTTON].fire(&ditems[OK_BUTTON]); - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - } - } - else if (result) { - *result = '\0'; - for (i = 0; i < item_no; i++) { - if (status[i]) { - strcat(result, items[i*3]); - break; - } - } - } - rval = 0; - key = ESC; - break; - } - - /* Shortcut to cancel */ - if (toupper(key) == cancelButton) { - if (ditems && result && ditems[CANCEL_BUTTON].fire) { - int st; - WINDOW *save; - - save = dupwin(newscr); - st = ditems[CANCEL_BUTTON].fire(&ditems[CANCEL_BUTTON]); - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - } - rval = 1; - key = ESC; - break; - } - - /* Check if key pressed matches first character of any item tag in list */ - for (i = 0; i < max_choice; i++) - if (key != ' ' && toupper(key) == toupper(items[(scroll + i) * 3][0])) - break; - - if (i < max_choice || (key >= '1' && key <= MIN('9', '0' + max_choice)) || - KEY_IS_UP(key) || KEY_IS_DOWN(key) || ((key == ' ' || key == '\r' || key == '\n') && onlist == 1)) { - - /* if moving from buttons to the list, reset and redraw buttons */ - if (!onlist) { - onlist = 1; - button = 0; - - if (ditems && result ) { - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, - ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : button); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, - ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : !button); - } - else { - print_button(dialog, "Cancel", y, x + 14, button); - print_button(dialog, " OK ", y, x, !button); - } - } - wmove(list, choice, check_x+1); - wnoutrefresh(dialog); - wrefresh(list); - - if (key >= '1' && key <= MIN('9', '0' + max_choice)) - i = key - '1'; - else if (KEY_IS_UP(key)) { - if (!choice) { - if (scroll) { - /* Scroll list down */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - if (list_height > 1) { - /* De-highlight current first item before scrolling down */ - print_item(list, items[scroll*3], items[scroll*3 + 1], status[scroll], 0, - FALSE, DREF(ditems, scroll)); - scrollok(list, TRUE); - wscrl(list, -1); - scrollok(list, FALSE); - } - scroll--; - print_item(list, items[scroll*3], items[scroll*3 + 1], status[scroll], 0, - TRUE, DREF(ditems, scroll)); - print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y); - wmove(list, choice, check_x+1); - wnoutrefresh(dialog); - wrefresh(list); - } - continue; /* wait for another key press */ - } - else - i = choice - 1; - } - else if (KEY_IS_DOWN(key)) { - if (choice == max_choice - 1) { - if (scroll + choice < item_no - 1) { - /* Scroll list up */ - getyx(dialog, cur_y, cur_x); /* Save cursor position */ - if (list_height > 1) { - /* De-highlight current last item before scrolling up */ - print_item(list, items[(scroll + max_choice - 1) * 3], - items[(scroll + max_choice - 1) * 3 + 1], - status[scroll + max_choice - 1], max_choice - 1, - FALSE, DREF(ditems, scroll + max_choice - 1)); - scrollok(list, TRUE); - scroll(list); - scrollok(list, FALSE); - } - scroll++; - print_item(list, items[(scroll + max_choice - 1) * 3], - items[(scroll + max_choice - 1) * 3 + 1], - status[scroll + max_choice - 1], max_choice - 1, - TRUE, DREF(ditems, scroll + max_choice - 1)); - print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y); - wmove(list, choice, check_x+1); - wnoutrefresh(dialog); - wrefresh(list); - } - continue; /* wait for another key press */ - } - else - i = choice + 1; - } - else if ((key == ' ' || key == '\r' || key == '\n') && onlist) { /* Toggle item status */ - getyx(list, old_y, old_x); /* Save cursor position */ - if (status[scroll + choice]) - continue; - else if (ditems) { - if (ditems[scroll + choice].fire) { - int st; - WINDOW *save; - - save = dupwin(newscr); - st = ditems[scroll + choice].fire(&ditems[scroll + choice]); - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - if (st & DITEM_REDRAW) { - wclear(list); - for (i = 0; i < item_no; i++) - status[i] = ditems[i].checked ? ditems[i].checked(&ditems[i]) : FALSE; - - for (i = 0; i < max_choice; i++) { - print_item(list, items[(scroll + i) * 3], items[(scroll + i) * 3 + 1], - status[scroll + i], i, i == choice, - DREF(ditems, scroll + i)); - } -/* wmove(list, old_y, old_x);*/ /* Restore cursor to previous position */ -/* wrefresh(list); */ - } - if (st & DITEM_LEAVE_MENU) { - /* Allow a fire action to take us out of the menu */ - key = ESC; - break; - } - else if (st & DITEM_RECREATE) { - delwin(list); - delwin(dialog); - dialog_clear(); - goto draw; - } - } - for (i = 0; i < item_no; i++) - status[i] = ditems[i].checked ? ditems[i].checked(&ditems[i]) : FALSE; - } - else { - for (i = 0; i < item_no; i++) - status[i] = 0; - status[scroll + choice] = TRUE; - } - for (i = 0; i < max_choice; i++) - print_item(list, items[(scroll + i) * 3], items[(scroll + i) * 3 + 1], - status[scroll + i], i, i == choice, DREF(ditems, scroll + i)); - wmove(list, choice, check_x+1); /* Restore cursor position */ - wrefresh(list); - continue; /* wait for another key press */ - } - - if (i != choice) { - /* De-highlight current item */ - print_item(list, items[(scroll + choice) * 3], items[(scroll + choice) * 3 +1], - status[scroll + choice], choice, FALSE, DREF(ditems, scroll + choice)); - /* Highlight new item */ - choice = i; - print_item(list, items[(scroll + choice) * 3], items[(scroll + choice) * 3 + 1], - status[scroll + choice], choice, TRUE, DREF(ditems, scroll + choice)); - wmove(list, choice, check_x+1); /* Restore cursor position */ - wrefresh(list); - } - continue; /* wait for another key press */ - } - - switch (key) { - case KEY_PPAGE: - if (scroll > height-4) /* can we go up? */ - scroll -= (height-4); - else - scroll = 0; - redraw_menu = TRUE; - if (!onlist) { - onlist = 1; - button = 0; - } - break; - - case KEY_NPAGE: - if (scroll + list_height >= item_no-1 - list_height) { /* can we go down a full page? */ - scroll = item_no - list_height; - if (scroll < 0) - scroll = 0; - } - else - scroll += list_height; - redraw_menu = TRUE; - if (!onlist) { - onlist = 1; - button = 0; - } - break; - - case KEY_HOME: - scroll = 0; - choice = 0; - redraw_menu = TRUE; - cursor_reset = TRUE; - onlist = 1; - break; - - case KEY_END: - scroll = item_no - list_height; - if (scroll < 0) - scroll = 0; - choice = max_choice - 1; - redraw_menu = TRUE; - cursor_reset = TRUE; - onlist = 1; - break; - - case TAB: - case KEY_BTAB: - /* move to next component */ - if (onlist) { /* on list, next is ok button */ - onlist = 0; - if (ditems && result) - ok_space = 1; - else - ok_space = 3; - wmove(dialog, y, x + ok_space); - wrefresh(dialog); - break; - } - else if (button) { /* on cancel button, next is list */ - button = 0; - onlist = 1; - redraw_menu = TRUE; - break; - } - /* on ok button, next is cancel button, same as left/right case */ - - case KEY_LEFT: - case KEY_RIGHT: - onlist = 0; - button = !button; - if (ditems && result) { - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, - ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : button); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, - ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : !button); - ok_space = 1; - cancel_space = strlen(ditems[OK_BUTTON].prompt) + 6; - } - else { - print_button(dialog, "Cancel", y, x + 14, button); - print_button(dialog, " OK ", y, x, !button); - ok_space = 3; - cancel_space = 15; - } - if (button) - wmove(dialog, y, x + cancel_space); - else - wmove(dialog, y, x + ok_space); - wrefresh(dialog); - break; - - case ' ': - case '\r': - case '\n': - if (!onlist) { - if (ditems) { - if (result && ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire) { - int st; - WINDOW *save; - - save = dupwin(newscr); - st = ditems[button ? CANCEL_BUTTON : OK_BUTTON].fire(&ditems[button ? CANCEL_BUTTON : OK_BUTTON]); - if (st & DITEM_RESTORE) { - touchwin(save); - wrefresh(save); - } - delwin(save); - } - } - else if (result) { - *result = '\0'; - for (i = 0; i < item_no; i++) { - if (status[i]) { - strcpy(result, items[i*3]); - break; - } - } - } - rval = button; - key = ESC; - break; - } - - case ESC: - rval = -1; - break; - - case KEY_F(1): - case '?': - display_helpfile(); - break; - } - - if (redraw_menu) { - getyx(list, old_y, old_x); - wclear(list); - for (i = 0; i < max_choice; i++) - print_item(list, items[(scroll + i) * 3], items[(scroll + i) * 3 + 1], status[scroll + i], - i, i == choice, DREF(ditems, scroll + i)); - print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y); - - /* redraw buttons to fix highlighting */ - if (ditems && result) { - print_button(dialog, ditems[CANCEL_BUTTON].prompt, y, x + strlen(ditems[OK_BUTTON].prompt) + 5, - ditems[CANCEL_BUTTON].checked ? ditems[CANCEL_BUTTON].checked(&ditems[CANCEL_BUTTON]) : button); - print_button(dialog, ditems[OK_BUTTON].prompt, y, x, - ditems[OK_BUTTON].checked ? ditems[OK_BUTTON].checked(&ditems[OK_BUTTON]) : !button); - } - else { - print_button(dialog, "Cancel", y, x + 14, button); - print_button(dialog, " OK ", y, x, !button); - } - wnoutrefresh(dialog); - if (cursor_reset) { - wmove(list, choice, check_x+1); - cursor_reset = FALSE; - } - else { - wmove(list, old_y, old_x); - } - wrefresh(list); - redraw_menu = FALSE; - } - } - - delwin(list); - delwin(dialog); - return rval; /* ESC pressed */ -} - -/* - * Print list item - */ -static void -print_item(WINDOW *win, char *tag, char *item, int status, int choice, int selected, dialogMenuItem *me) -{ - int i; - - /* Clear 'residue' of last item */ - wattrset(win, menubox_attr); - wmove(win, choice, 0); - for (i = 0; i < list_width; i++) - waddch(win, ' '); - wmove(win, choice, check_x); - wattrset(win, selected ? check_selected_attr : check_attr); - wprintw(win, "%c%c%c", me && me->lbra ? me->lbra : '(', - status ? me && me->mark ? me->mark : '*' : ' ', - me && me->rbra ? me->rbra : ')'); - wattrset(win, menubox_attr); - waddch(win, ' '); - wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); - waddch(win, tag[0]); - wattrset(win, selected ? tag_selected_attr : tag_attr); - waddstr(win, tag + 1); - wmove(win, choice, item_x); - wattrset(win, selected ? item_selected_attr : item_attr); - waddstr(win, item); - /* If have a selection handler for this, call it */ - if (me && me->selected) { - wrefresh(win); - me->selected(me, selected); - } -} -/* End of print_item() */ Index: gnu/lib/libodialog/Makefile =================================================================== --- gnu/lib/libodialog/Makefile (revision 216873) +++ gnu/lib/libodialog/Makefile (working copy) @@ -3,20 +3,14 @@ .include <bsd.own.mk> -LIB= dialog -INCS= dialog.h -MAN= dialog.3 +LIB= odialog +#MAN= NOMAN SHLIB_MAJOR= 7 SRCS= kernel.c rc.c checklist.c inputbox.c menubox.c msgbox.c \ lineedit.c radiolist.c textbox.c yesno.c prgbox.c raw_popen.c \ fselect.c ui_objects.c dir.c notify.c help.c gauge.c tree.c -EXAMPLES= Makefile check1.c check2.c check3.c dselect.c fselect.c \ - ftree1.c ftree1.test ftree2.c ftree2.test gauge.c input1.c \ - input2.c menu1.c menu2.c menu3.c msg.c prgbox.c radio1.c \ - radio2.c radio3.c text.c tree.c yesno.c - CFLAGS+= -I${.CURDIR} -Wall -Wstrict-prototypes -DLOCALE DPADD= ${LIBNCURSES} @@ -27,21 +21,4 @@ FILESDIR= ${SHAREDIR}/examples/libdialog .endif -MLINKS+=dialog.3 draw_shadow.3 dialog.3 draw_box.3 \ - dialog.3 line_edit.3 dialog.3 strheight.3 \ - dialog.3 strwidth.3 dialog.3 dialog_create_rc.3 \ - dialog.3 dialog_yesno.3 dialog.3 dialog_noyes.3 \ - dialog.3 dialog_prgbox.3 \ - dialog.3 dialog_textbox.3 dialog.3 dialog_menu.3 \ - dialog.3 dialog_checklist.3 dialog.3 dialog_radiolist.3 \ - dialog.3 dialog_inputbox.3 dialog.3 dialog_clear_norefresh.3 \ - dialog.3 dialog_clear.3 dialog.3 dialog_update.3 \ - dialog.3 dialog_fselect.3 dialog.3 dialog_notify.3 \ - dialog.3 dialog_mesgbox.3 dialog.3 dialog_gauge.3 \ - dialog.3 init_dialog.3 dialog.3 end_dialog.3 \ - dialog.3 use_helpfile.3 dialog.3 use_helpline.3 \ - dialog.3 get_helpline.3 dialog.3 restore_helpline.3 \ - dialog.3 dialog_msgbox.3 dialog.3 dialog_ftree.3 \ - dialog.3 dialog_tree.3 - .include <bsd.lib.mk> Index: contrib/dialog/buttons.c =================================================================== --- contrib/dialog/buttons.c (revision 0) +++ contrib/dialog/buttons.c (revision 0) @@ -0,0 +1,657 @@ +/* + * $Id: buttons.c,v 1.81 2010/04/28 20:57:29 tom Exp $ + * + * buttons.c -- draw buttons, e.g., OK/Cancel + * + * Copyright 2000-2007,2010 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. + */ + +#include <dialog.h> +#include <dlg_keys.h> + +#ifdef NEED_WCHAR_H +#include <wchar.h> +#endif + +#define MIN_BUTTON (dialog_state.visit_items ? -1 : 0) + +static void +center_label(char *buffer, int longest, const char *label) +{ + int len = dlg_count_columns(label); + int left = 0, right = 0; + + *buffer = 0; + if (len < longest) { + left = (longest - len) / 2; + right = (longest - len - left); + if (left > 0) + sprintf(buffer, "%*s", left, " "); + } + strcat(buffer, label); + if (right > 0) + sprintf(buffer + strlen(buffer), "%*s", right, " "); +} + +/* + * Parse a multibyte character out of the string, set it past the parsed + * character. + */ +static int +string_to_char(const char **stringp) +{ + int result; +#ifdef USE_WIDE_CURSES + const char *string = *stringp; + size_t have = strlen(string); + size_t check; + size_t len; + wchar_t cmp2[2]; + mbstate_t state; + + memset(&state, 0, sizeof(state)); + len = mbrlen(string, have, &state); + if ((int) len > 0 && len <= have) { + memset(&state, 0, sizeof(state)); + memset(cmp2, 0, sizeof(cmp2)); + check = mbrtowc(cmp2, string, len, &state); + if ((int) check <= 0) + cmp2[0] = 0; + *stringp += len; + } else { + cmp2[0] = UCH(*string); + *stringp += 1; + } + result = cmp2[0]; +#else + const char *string = *stringp; + result = UCH(*string); + *stringp += 1; +#endif + return result; +} + +/* + * Print a button + */ +static void +print_button(WINDOW *win, char *label, int y, int x, int selected) +{ + int i; + int state = 0; + const int *indx = dlg_index_wchars(label); + int limit = dlg_count_wchars(label); + chtype key_attr = (selected + ? button_key_active_attr + : button_key_inactive_attr); + chtype label_attr = (selected + ? button_label_active_attr + : button_label_inactive_attr); + + (void) wmove(win, y, x); + wattrset(win, selected + ? button_active_attr + : button_inactive_attr); + (void) waddstr(win, "<"); + wattrset(win, label_attr); + for (i = 0; i < limit; ++i) { + int first = indx[i]; + int last = indx[i + 1]; + + switch (state) { + case 0: +#ifdef USE_WIDE_CURSES + if ((last - first) != 1) { + const char *temp = (label + first); + int cmp = string_to_char(&temp); + if (dlg_isupper(cmp)) { + wattrset(win, key_attr); + state = 1; + } + break; + } +#endif + if (dlg_isupper(UCH(label[first]))) { + wattrset(win, key_attr); + state = 1; + } + break; + case 1: + wattrset(win, label_attr); + state = 2; + break; + } + waddnstr(win, label + first, last - first); + } + wattrset(win, selected + ? button_active_attr + : button_inactive_attr); + (void) waddstr(win, ">"); + (void) wmove(win, y, x + ((int) strspn(label, " ")) + 1); +} + +/* + * Count the buttons in the list. + */ +int +dlg_button_count(const char **labels) +{ + int result = 0; + while (*labels++ != 0) + ++result; + return result; +} + +/* + * Compute the size of the button array in columns. Return the total number of + * columns in *length, and the longest button's columns in *longest + */ +void +dlg_button_sizes(const char **labels, + int vertical, + int *longest, + int *length) +{ + int n; + + *length = 0; + *longest = 0; + for (n = 0; labels[n] != 0; n++) { + if (vertical) { + *length += 1; + *longest = 1; + } else { + int len = dlg_count_columns(labels[n]); + if (len > *longest) + *longest = len; + *length += len; + } + } + /* + * If we can, make all of the buttons the same size. This is only optional + * for buttons laid out horizontally. + */ + if (*longest < 6 - (*longest & 1)) + *longest = 6 - (*longest & 1); + if (!vertical) + *length = *longest * n; +} + +/* + * Compute the size of the button array. + */ +int +dlg_button_x_step(const char **labels, int limit, int *gap, int *margin, int *step) +{ + int count = dlg_button_count(labels); + int longest; + int length; + int unused; + int used; + + if (count == 0) + return 0; + dlg_button_sizes(labels, FALSE, &longest, &length); + used = (length + (count * 2)); + unused = limit - used; + + if ((*gap = unused / (count + 3)) <= 0) { + if ((*gap = unused / (count + 1)) <= 0) + *gap = 1; + *margin = *gap; + } else { + *margin = *gap * 2; + } + *step = *gap + (used + count - 1) / count; + return (*gap > 0) && (unused >= 0); +} + +/* + * Make sure there is enough space for the buttons + */ +void +dlg_button_layout(const char **labels, int *limit) +{ + int width = 1; + int gap, margin, step; + + if (labels != 0 && dlg_button_count(labels)) { + while (!dlg_button_x_step(labels, width, &gap, &margin, &step)) + ++width; + width += (4 * MARGIN); + if (width > COLS) + width = COLS; + if (width > *limit) + *limit = width; + } +} + +/* + * Print a list of buttons at the given position. + */ +void +dlg_draw_buttons(WINDOW *win, + int y, int x, + const char **labels, + int selected, + int vertical, + int limit) +{ + chtype save = getattrs(win); + int n; + int step = 0; + int length; + int longest; + int final_x; + int final_y; + int gap; + int margin; + size_t need; + char *buffer; + + dlg_mouse_setbase(getbegx(win), getbegy(win)); + + getyx(win, final_y, final_x); + + dlg_button_sizes(labels, vertical, &longest, &length); + + if (vertical) { + y += 1; + step = 1; + } else { + dlg_button_x_step(labels, limit, &gap, &margin, &step); + x += margin; + } + + /* + * Allocate a buffer big enough for any label. + */ + need = (size_t) longest; + for (n = 0; labels[n] != 0; ++n) { + need += strlen(labels[n]) + 1; + } + buffer = dlg_malloc(char, need); + assert_ptr(buffer, "dlg_draw_buttons"); + + /* + * Draw the labels. + */ + for (n = 0; labels[n] != 0; n++) { + center_label(buffer, longest, labels[n]); + mouse_mkbutton(y, x, dlg_count_columns(buffer), n); + print_button(win, buffer, y, x, + (selected == n) || (n == 0 && selected < 0)); + if (selected == n) + getyx(win, final_y, final_x); + + if (vertical) { + if ((y += step) > limit) + break; + } else { + if ((x += step) > limit) + break; + } + } + (void) wmove(win, final_y, final_x); + wrefresh(win); + free(buffer); + wattrset(win, save); +} + +/* + * Match a given character against the beginning of the string, ignoring case + * of the given character. The matching string must begin with an uppercase + * character. + */ +int +dlg_match_char(int ch, const char *string) +{ + if (string != 0) { + int cmp2 = string_to_char(&string); +#ifdef USE_WIDE_CURSES + wint_t cmp1 = dlg_toupper(ch); + if (cmp2 != 0 && (wchar_t) cmp1 == (wchar_t) dlg_toupper(cmp2)) { + return TRUE; + } +#else + if (ch > 0 && ch < 256) { + if (dlg_toupper(ch) == dlg_toupper(cmp2)) + return TRUE; + } +#endif + } + return FALSE; +} + +/* + * Find the first uppercase character in the label, which we may use for an + * abbreviation. + */ +int +dlg_button_to_char(const char *label) +{ + int cmp = -1; + + while (*label != 0) { + cmp = string_to_char(&label); + if (dlg_isupper(cmp)) { + break; + } + } + return cmp; +} + +/* + * Given a list of button labels, and a character which may be the abbreviation + * for one, find it, if it exists. An abbreviation will be the first character + * which happens to be capitalized in the label. + */ +int +dlg_char_to_button(int ch, const char **labels) +{ + if (labels != 0) { + int j; + + ch = (int) dlg_toupper(dlg_last_getc()); + for (j = 0; labels[j] != 0; ++j) { + int cmp = dlg_button_to_char(labels[j]); + if (ch == cmp) { + dlg_flush_getc(); + return j; + } + } + } + return DLG_EXIT_UNKNOWN; +} + +static const char * +my_yes_label(void) +{ + return (dialog_vars.yes_label != NULL) + ? dialog_vars.yes_label + : _("Yes"); +} + +static const char * +my_no_label(void) +{ + return (dialog_vars.no_label != NULL) + ? dialog_vars.no_label + : _("No"); +} + +static const char * +my_ok_label(void) +{ + return (dialog_vars.ok_label != NULL) + ? dialog_vars.ok_label + : _("OK"); +} + +static const char * +my_cancel_label(void) +{ + return (dialog_vars.cancel_label != NULL) + ? dialog_vars.cancel_label + : _("Cancel"); +} + +static const char * +my_exit_label(void) +{ + return (dialog_vars.exit_label != NULL) + ? dialog_vars.exit_label + : _("EXIT"); +} + +static const char * +my_extra_label(void) +{ + return (dialog_vars.extra_label != NULL) + ? dialog_vars.extra_label + : _("Extra"); +} + +static const char * +my_help_label(void) +{ + return (dialog_vars.help_label != NULL) + ? dialog_vars.help_label + : _("Help"); +} + +/* + * Return a list of button labels. + */ +const char ** +dlg_exit_label(void) +{ + const char **result; + + if (dialog_vars.extra_button) { + result = dlg_ok_labels(); + } else { + static const char *labels[3]; + int n = 0; + + labels[n++] = my_exit_label(); + if (dialog_vars.help_button) + labels[n++] = my_help_label(); + labels[n] = 0; + + result = labels; + } + return result; +} + +/* + * Map the given button index for dlg_exit_label() into our exit-code. + */ +int +dlg_exit_buttoncode(int button) +{ + int result = DLG_EXIT_ERROR; + + if (dialog_vars.extra_button) { + result = dlg_ok_buttoncode(button); + } else if (button == 0) { + result = DLG_EXIT_OK; + } else if (button == 1 && dialog_vars.help_button) { + result = DLG_EXIT_HELP; + } + return result; +} + +const char ** +dlg_ok_label(void) +{ + static const char *labels[3]; + int n = 0; + + labels[n++] = my_ok_label(); + if (dialog_vars.help_button) + labels[n++] = my_help_label(); + labels[n] = 0; + return labels; +} + +/* + * Return a list of button labels for the OK/Cancel group. + */ +const char ** +dlg_ok_labels(void) +{ + static const char *labels[5]; + int n = 0; + + if (!dialog_vars.nook) + labels[n++] = my_ok_label(); + if (dialog_vars.extra_button) + labels[n++] = my_extra_label(); + if (!dialog_vars.nocancel) + labels[n++] = my_cancel_label(); + if (dialog_vars.help_button) + labels[n++] = my_help_label(); + labels[n] = 0; + return labels; +} + +/* + * Map the given button index for dlg_ok_labels() into our exit-code + */ +int +dlg_ok_buttoncode(int button) +{ + int result = DLG_EXIT_ERROR; + int n = !dialog_vars.nook; + + if (!dialog_vars.nook && (button <= 0)) { + result = DLG_EXIT_OK; + } else if (dialog_vars.extra_button && (button == n++)) { + result = DLG_EXIT_EXTRA; + } else if (!dialog_vars.nocancel && (button == n++)) { + result = DLG_EXIT_CANCEL; + } else if (dialog_vars.help_button && (button == n)) { + result = DLG_EXIT_HELP; + } + return result; +} + +/* + * Given that we're using dlg_ok_labels() to list buttons, find the next index + * in the list of buttons. The 'extra' parameter if negative provides a way to + * enumerate extra active areas on the widget. + */ +int +dlg_next_ok_buttonindex(int current, int extra) +{ + int result = current + 1; + + if (current >= 0 + && dlg_ok_buttoncode(result) < 0) + result = extra; + return result; +} + +/* + * Similarly, find the previous button index. + */ +int +dlg_prev_ok_buttonindex(int current, int extra) +{ + int result = current - 1; + + if (result < extra) { + for (result = 0; dlg_ok_buttoncode(result + 1) >= 0; ++result) { + ; + } + } + return result; +} + +/* + * Find the button-index for the "OK" or "Cancel" button, according to + * whether --defaultno is given. If --nocancel was given, we always return + * the index for "OK". + */ +int +dlg_defaultno_button(void) +{ + int result = 0; + + if (dialog_vars.defaultno && !dialog_vars.nocancel) { + while (dlg_ok_buttoncode(result) != DLG_EXIT_CANCEL) + ++result; + } + return result; +} + +/* + * Return a list of buttons for Yes/No labels. + */ +const char ** +dlg_yes_labels(void) +{ + const char **result; + + if (dialog_vars.extra_button) { + result = dlg_ok_labels(); + } else { + static const char *labels[4]; + int n = 0; + + labels[n++] = my_yes_label(); + labels[n++] = my_no_label(); + if (dialog_vars.help_button) + labels[n++] = my_help_label(); + labels[n] = 0; + + result = labels; + } + + return result; +} + +/* + * Map the given button index for dlg_yes_labels() into our exit-code. + */ +int +dlg_yes_buttoncode(int button) +{ + int result = DLG_EXIT_ERROR; + + if (dialog_vars.extra_button) { + result = dlg_ok_buttoncode(button); + } else if (button == 0) { + result = DLG_EXIT_OK; + } else if (button == 1) { + result = DLG_EXIT_CANCEL; + } else if (button == 2 && dialog_vars.help_button) { + result = DLG_EXIT_HELP; + } + + return result; +} + +/* + * Return the next index in labels[]; + */ +int +dlg_next_button(const char **labels, int button) +{ + if (labels[button + 1] != 0) + ++button; + else + button = MIN_BUTTON; + return button; +} + +/* + * Return the previous index in labels[]; + */ +int +dlg_prev_button(const char **labels, int button) +{ + if (button > MIN_BUTTON) + --button; + else { + while (labels[button + 1] != 0) + ++button; + } + return button; +} Index: contrib/dialog/trace.c =================================================================== --- contrib/dialog/trace.c (revision 0) +++ contrib/dialog/trace.c (revision 0) @@ -0,0 +1,156 @@ +/* + * $Id: trace.c,v 1.11 2010/01/17 15:36:26 tom Exp $ + * + * trace.c -- implements screen-dump and keystroke-logging + * + * Copyright 2007-2008,2010 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 + * + * 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. + */ + +#include <dialog.h> + +#ifdef HAVE_DLG_TRACE + +#include <dlg_keys.h> +#include <time.h> + +#define myFP dialog_state.trace_output + +void +dlg_trace_msg(const char *fmt,...) +{ + if (myFP != 0) { + va_list ap; + va_start(ap, fmt); + vfprintf(myFP, fmt, ap); + va_end(ap); + fflush(myFP); + } +} + +void +dlg_trace_win(WINDOW *win) +{ + if (myFP != 0) { + int y, x; + int j, k; + int rc = getmaxy(win); + int cc = getmaxx(win); + chtype ch, c2; + + fprintf(myFP, "window %dx%d at %d,%d\n", + rc, cc, getbegy(win), getbegx(win)); + + getyx(win, y, x); + for (j = 0; j < rc; ++j) { + fprintf(myFP, "%3d:", j); + for (k = 0; k < cc; ++k) { + ch = mvwinch(win, j, k) & (A_CHARTEXT | A_ALTCHARSET); + c2 = dlg_asciibox(ch); + if (c2 != 0) { + ch = c2; + } else if (unctrl(ch) == 0 || strlen(unctrl(ch)) > 1) { + ch = '.'; + } + fputc((int) (ch & 0xff), myFP); + } + fputc('\n', myFP); + } + wmove(win, y, x); + fflush(myFP); + } +} + +void +dlg_trace_chr(int ch, int fkey) +{ + if (myFP != 0) { + const char *fkey_name = "?"; + if (fkey) { + if (fkey > KEY_MAX || (fkey_name = keyname(fkey)) == 0) { +#define CASE(name) case name: fkey_name = #name; break + switch ((DLG_KEYS_ENUM) fkey) { + CASE(DLGK_MIN); + CASE(DLGK_OK); + CASE(DLGK_CANCEL); + CASE(DLGK_EXTRA); + CASE(DLGK_HELP); + CASE(DLGK_ESC); + CASE(DLGK_PAGE_FIRST); + CASE(DLGK_PAGE_LAST); + CASE(DLGK_PAGE_NEXT); + CASE(DLGK_PAGE_PREV); + CASE(DLGK_ITEM_FIRST); + CASE(DLGK_ITEM_LAST); + CASE(DLGK_ITEM_NEXT); + CASE(DLGK_ITEM_PREV); + CASE(DLGK_FIELD_FIRST); + CASE(DLGK_FIELD_LAST); + CASE(DLGK_FIELD_NEXT); + CASE(DLGK_FIELD_PREV); + CASE(DLGK_GRID_UP); + CASE(DLGK_GRID_DOWN); + CASE(DLGK_GRID_LEFT); + CASE(DLGK_GRID_RIGHT); + CASE(DLGK_DELETE_LEFT); + CASE(DLGK_DELETE_RIGHT); + CASE(DLGK_DELETE_ALL); + CASE(DLGK_ENTER); + CASE(DLGK_BEGIN); + CASE(DLGK_FINAL); + CASE(DLGK_SELECT); + CASE(DLGK_TRACE); + } + } + } else { + fkey_name = unctrl((chtype) ch); + if (fkey_name == 0) + fkey_name = "UNKNOWN"; + } + fprintf(myFP, "chr %s (ch=%#x, fkey=%d)\n", + fkey_name, + ch, fkey); + fflush(myFP); + } +} + +void +dlg_trace(const char *fname) +{ + if (fname != 0) { + if (myFP == 0) { + myFP = fopen(fname, "a"); + if (myFP != 0) { + time_t now = time((time_t *) 0); + fprintf(myFP, "** opened at %s", ctime(&now)); + } + } + } else if (myFP != 0) { + time_t now = time((time_t *) 0); + fprintf(myFP, "** closed at %s", ctime(&now)); + fclose(myFP); + myFP = 0; + } +} +#else +#undef dlg_trace +extern void dlg_trace(const char *); +void +dlg_trace(const char *fname) +{ + (void) fname; +} +#endif Index: contrib/dialog/dialog.c =================================================================== --- contrib/dialog/dialog.c (revision 0) +++ contrib/dialog/dialog.c (revision 0) @@ -0,0 +1,1710 @@ +/* + * $Id: dialog.c,v 1.177 2010/01/18 09:21:14 tom Exp $ + * + * cdialog - Display simple dialog boxes from shell scripts + * + * Copyright 2000-2008,2010 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 <string.h> +#include <sys/types.h> +#include <sys/stat.h> + +#ifdef HAVE_SETLOCALE +#include <locale.h> +#endif + +#define PASSARGS t, av, offset_add +#define CALLARGS const char *t, char *av[], int *offset_add +typedef int (callerFn) (CALLARGS); + +typedef enum { + o_unknown = 0 + ,o_allow_close + ,o_and_widget + ,o_ascii_lines + ,o_aspect + ,o_auto_placement + ,o_backtitle + ,o_beep + ,o_beep_after + ,o_begin + ,o_calendar + ,o_cancel_label + ,o_checklist + ,o_clear + ,o_colors + ,o_column_separator + ,o_cr_wrap + ,o_create_rc + ,o_date_format + ,o_default_item + ,o_defaultno + ,o_dselect + ,o_editbox + ,o_exit_label + ,o_extra_button + ,o_extra_label + ,o_fixed_font + ,o_form + ,o_fselect + ,o_fullbutton + ,o_gauge + ,o_help + ,o_help_button + ,o_help_label + ,o_help_status + ,o_icon + ,o_ignore + ,o_infobox + ,o_input_fd + ,o_inputbox + ,o_inputmenu + ,o_insecure + ,o_item_help + ,o_keep_colors + ,o_keep_tite + ,o_keep_window + ,o_max_input + ,o_menu + ,o_mixedform + ,o_mixedgauge + ,o_msgbox + ,o_no_close + ,o_no_collapse + ,o_no_cr_wrap + ,o_no_kill + ,o_no_label + ,o_no_lines + ,o_no_shadow + ,o_nocancel + ,o_noitem + ,o_nook + ,o_ok_label + ,o_output_fd + ,o_output_separator + ,o_passwordbox + ,o_passwordform + ,o_pause + ,o_print_maxsize + ,o_print_size + ,o_print_version + ,o_progressbox + ,o_quoted + ,o_radiolist + ,o_screen_center + ,o_scrollbar + ,o_separate_output + ,o_separate_widget + ,o_separator + ,o_shadow + ,o_single_quoted + ,o_size_err + ,o_sleep + ,o_smooth + ,o_stderr + ,o_stdout + ,o_tab_correct + ,o_tab_len + ,o_tailbox + ,o_tailboxbg + ,o_textbox + ,o_time_format + ,o_timebox + ,o_timeout + ,o_title + ,o_trim + ,o_under_mouse + ,o_visit_items + ,o_wmclass + ,o_yes_label + ,o_yesno +#ifdef HAVE_DLG_TRACE + ,o_trace +#endif +} eOptions; + +/* + * The bits in 'pass' are used to decide which options are applicable at + * different stages in the program: + * 1 flags before widgets + * 2 widgets + * 4 non-widget options + */ +typedef struct { + const char *name; + eOptions code; + int pass; /* 1,2,4 or combination */ + const char *help; /* NULL to suppress, non-empty to display params */ +} Options; + +typedef struct { + eOptions code; + int argmin, argmax; + callerFn *jumper; +} Mode; + +static bool *dialog_opts; +static char **dialog_argv; + +static bool ignore_unknown = FALSE; + +static const char *program = "dialog"; + +/* + * The options[] table is organized this way to make it simple to maintain + * a sorted list of options for the help-message. + */ +/* *INDENT-OFF* */ +static const Options options[] = { + { "allow-close", o_allow_close, 1, NULL }, + { "and-widget", o_and_widget, 4, NULL }, + { "ascii-lines", o_ascii_lines, 1, "" }, + { "aspect", o_aspect, 1, "<ratio>" }, + { "auto-placement", o_auto_placement, 1, NULL }, + { "backtitle", o_backtitle, 1, "<backtitle>" }, + { "beep", o_beep, 1, NULL }, + { "beep-after", o_beep_after, 1, NULL }, + { "begin", o_begin, 1, "<y> <x>" }, + { "calendar", o_calendar, 2, "<text> <height> <width> <day> <month> <year>" }, + { "cancel-label", o_cancel_label, 1, "<str>" }, + { "checklist", o_checklist, 2, "<text> <height> <width> <list height> <tag1> <item1> <status1>..." }, + { "clear", o_clear, 1, "" }, + { "colors", o_colors, 1, "" }, + { "column-separator",o_column_separator, 1, "<str>" }, + { "cr-wrap", o_cr_wrap, 1, "" }, + { "create-rc", o_create_rc, 1, NULL }, + { "date-format", o_date_format, 1, "<str>" }, + { "default-item", o_default_item, 1, "<str>" }, + { "defaultno", o_defaultno, 1, "" }, + { "dselect", o_dselect, 2, "<directory> <height> <width>" }, + { "editbox", o_editbox, 2, "<file> <height> <width>" }, + { "exit-label", o_exit_label, 1, "<str>" }, + { "extra-button", o_extra_button, 1, "" }, + { "extra-label", o_extra_label, 1, "<str>" }, + { "fb", o_fullbutton, 1, NULL }, + { "fixed-font", o_fixed_font, 1, NULL }, + { "form", o_form, 2, "<text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>..." }, + { "fselect", o_fselect, 2, "<filepath> <height> <width>" }, + { "fullbutton", o_fullbutton, 1, NULL }, + { "gauge", o_gauge, 2, "<text> <height> <width> [<percent>]" }, + { "guage", o_gauge, 2, NULL }, + { "help", o_help, 4, "" }, + { "help-button", o_help_button, 1, "" }, + { "help-label", o_help_label, 1, "<str>" }, + { "help-status", o_help_status, 1, "" }, + { "icon", o_icon, 1, NULL }, + { "ignore", o_ignore, 1, "" }, + { "infobox", o_infobox, 2, "<text> <height> <width>" }, + { "input-fd", o_input_fd, 1, "<fd>" }, + { "inputbox", o_inputbox, 2, "<text> <height> <width> [<init>]" }, + { "inputmenu", o_inputmenu, 2, "<text> <height> <width> <menu height> <tag1> <item1>..." }, + { "insecure", o_insecure, 1, "" }, + { "item-help", o_item_help, 1, "" }, + { "keep-colors", o_keep_colors, 1, NULL }, + { "keep-tite", o_keep_tite, 1, "" }, + { "keep-window", o_keep_window, 1, "" }, + { "max-input", o_max_input, 1, "<n>" }, + { "menu", o_menu, 2, "<text> <height> <width> <menu height> <tag1> <item1>..." }, + { "mixedform", o_mixedform, 2, "<text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1> <itype>..." }, + { "mixedgauge", o_mixedgauge, 2, "<text> <height> <width> <percent> <tag1> <item1>..." }, + { "msgbox", o_msgbox, 2, "<text> <height> <width>" }, + { "no-cancel", o_nocancel, 1, "" }, + { "no-close", o_no_close, 1, NULL }, + { "no-collapse", o_no_collapse, 1, "" }, + { "no-cr-wrap", o_no_cr_wrap, 1, NULL }, + { "no-kill", o_no_kill, 1, "" }, + { "no-label", o_no_label, 1, "<str>" }, + { "no-lines", o_no_lines, 1, "" }, + { "no-ok", o_nook, 1, "" }, + { "no-shadow", o_no_shadow, 1, "" }, + { "nocancel", o_nocancel, 1, NULL }, /* see --no-cancel */ + { "noitem", o_noitem, 1, NULL }, + { "nook", o_nook, 1, "" }, /* See no-ok */ + { "ok-label", o_ok_label, 1, "<str>" }, + { "output-fd", o_output_fd, 1, "<fd>" }, + { "output-separator",o_output_separator, 1, "<str>" }, + { "passwordbox", o_passwordbox, 2, "<text> <height> <width> [<init>]" }, + { "passwordform", o_passwordform, 2, "<text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>..." }, + { "pause", o_pause, 2, "<text> <height> <width> <seconds>" }, + { "print-maxsize", o_print_maxsize, 1, "" }, + { "print-size", o_print_size, 1, "" }, + { "print-version", o_print_version, 5, "" }, + { "progressbox", o_progressbox, 2, "<height> <width>" }, + { "quoted", o_quoted, 1, "" }, + { "radiolist", o_radiolist, 2, "<text> <height> <width> <list height> <tag1> <item1> <status1>..." }, + { "screen-center", o_screen_center, 1, NULL }, + { "scrollbar", o_scrollbar, 1, "" }, + { "separate-output",o_separate_output, 1, "" }, + { "separate-widget",o_separate_widget, 1, "<str>" }, + { "separator", o_separator, 1, NULL }, + { "shadow", o_shadow, 1, "" }, + { "single-quoted", o_single_quoted, 1, "" }, + { "size-err", o_size_err, 1, "" }, + { "sleep", o_sleep, 1, "<secs>" }, + { "smooth", o_smooth, 1, NULL }, + { "stderr", o_stderr, 1, "" }, + { "stdout", o_stdout, 1, "" }, + { "tab-correct", o_tab_correct, 1, "" }, + { "tab-len", o_tab_len, 1, "<n>" }, + { "tailbox", o_tailbox, 2, "<file> <height> <width>" }, + { "tailboxbg", o_tailboxbg, 2, "<file> <height> <width>" }, + { "textbox", o_textbox, 2, "<file> <height> <width>" }, + { "time-format", o_time_format, 1, "<str>" }, + { "timebox", o_timebox, 2, "<text> <height> <width> <hour> <minute> <second>" }, + { "timeout", o_timeout, 1, "<secs>" }, + { "title", o_title, 1, "<title>" }, + { "trim", o_trim, 1, "" }, + { "under-mouse", o_under_mouse, 1, NULL }, + { "version", o_print_version, 5, "" }, + { "visit-items", o_visit_items, 1, "" }, + { "wmclass", o_wmclass, 1, NULL }, + { "yes-label", o_yes_label, 1, "<str>" }, + { "yesno", o_yesno, 2, "<text> <height> <width>" }, +#ifdef HAVE_DLG_TRACE + { "trace", o_trace, 1, "<file>" }, +#endif +}; +/* *INDENT-ON* */ + +/* + * Convert a string to an argv[], returning a char** index (which must be + * freed by the caller). The string is modified (replacing gaps between + * tokens with nulls). + */ +static char ** +string_to_argv(char *blob) +{ + size_t n; + int pass; + size_t length = strlen(blob); + char **result = 0; + + for (pass = 0; pass < 2; ++pass) { + bool inparm = FALSE; + bool quoted = FALSE; + char *param = blob; + size_t count = 0; + + for (n = 0; n < length; ++n) { + if (quoted && blob[n] == '"') { + quoted = FALSE; + } else if (blob[n] == '"') { + quoted = TRUE; + if (!inparm) { + if (pass) + result[count] = param; + ++count; + inparm = TRUE; + } + } else if (blob[n] == '\\') { + if (quoted && !isspace(UCH(blob[n + 1]))) { + if (!inparm) { + if (pass) + result[count] = param; + ++count; + inparm = TRUE; + } + if (pass) { + *param++ = blob[n]; + *param++ = blob[n + 1]; + } + } + ++n; + } else if (!quoted && isspace(UCH(blob[n]))) { + inparm = FALSE; + if (pass) { + *param++ = '\0'; + } + } else { + if (!inparm) { + if (pass) + result[count] = param; + ++count; + inparm = TRUE; + } + if (pass) { + *param++ = blob[n]; + } + } + } + + if (!pass) { + if (count) { + result = dlg_calloc(char *, count + 1); + assert_ptr(result, "string_to_argv"); + } else { + break; /* no tokens found */ + } + } else { + *param = '\0'; + } + } + return result; +} + +/* + * Count the entries in an argv list. + */ +static int +count_argv(char **argv) +{ + int result = 0; + + if (argv != 0) { + while (argv[result] != 0) + ++result; + } + return result; +} + +static int +eat_argv(int *argcp, char ***argvp, int start, int count) +{ + int k; + + *argcp -= count; + for (k = start; k <= *argcp; k++) + (*argvp)[k] = (*argvp)[k + count]; + (*argvp)[*argcp] = 0; + return TRUE; +} + +/* + * Make an array showing which argv[] entries are options. Use "--" as a + * special token to escape the next argument, allowing it to begin with "--". + * When we find a "--" argument, also remove it from argv[] and adjust argc. + * That appears to be an undocumented feature of the popt library. + * + * Also, if we see a "--file", expand it into the parameter list by reading the + * text from the given file and stripping quotes, treating whitespace outside + * quotes as a parameter delimiter. + * + * Finally, if we see a "--args", dump the current list of arguments to the + * standard error. This is used for debugging complex --file combinations. + */ +static void +unescape_argv(int *argcp, char ***argvp) +{ + int j, k; + int limit_includes = 20 + *argcp; + int count_includes = 0; + bool changed = FALSE; + bool doalloc = FALSE; + char *filename; + + dialog_opts = dlg_calloc(bool, (size_t) *argcp + 1); + assert_ptr(dialog_opts, "unescape_argv"); + + for (j = 1; j < *argcp; j++) { + bool escaped = FALSE; + if (!strcmp((*argvp)[j], "--")) { + escaped = TRUE; + changed = eat_argv(argcp, argvp, j, 1); + } else if (!strcmp((*argvp)[j], "--args")) { + fprintf(stderr, "Showing arguments at arg%d\n", j); + for (k = 0; k < *argcp; ++k) { + fprintf(stderr, " arg%d:%s\n", k, (*argvp)[k]); + } + changed = eat_argv(argcp, argvp, j, 1); + } else if (!strcmp((*argvp)[j], "--file")) { + if (++count_includes > limit_includes) + dlg_exiterr("Too many --file options"); + + if ((filename = (*argvp)[j + 1]) != 0) { + FILE *fp; + char **list; + char *blob; + int added; + size_t bytes_read; + size_t length; + int n; + + if (*filename == '&') { + fp = fdopen(atoi(filename + sizeof(char)), "r"); + } else { + fp = fopen(filename, "r"); + } + + if (fp) { + blob = NULL; + length = 0; + do { + blob = dlg_realloc(char, length + BUFSIZ + 1, blob); + assert_ptr(blob, "unescape_argv"); + bytes_read = fread(blob + length, + sizeof(char), + BUFSIZ, + fp); + length += bytes_read; + if (ferror(fp)) + dlg_exiterr("error on filehandle in unescape_argv"); + } while (bytes_read == BUFSIZ); + fclose(fp); + + blob[length] = '\0'; + + list = string_to_argv(blob); + if ((added = count_argv(list)) != 0) { + if (added > 2) { + size_t need = (size_t) (*argcp + added + 1); + if (doalloc) { + *argvp = dlg_realloc(char *, need, *argvp); + assert_ptr(*argvp, "unescape_argv"); + } else { + char **newp = dlg_malloc(char *, need); + assert_ptr(newp, "unescape_argv"); + for (n = 0; n < *argcp; ++n) { + newp[n] = (*argvp)[n]; + } + *argvp = newp; + doalloc = TRUE; + } + dialog_opts = dlg_realloc(bool, need, dialog_opts); + assert_ptr(dialog_opts, "unescape_argv"); + } + for (n = *argcp; n >= j + 2; --n) { + (*argvp)[n + added - 2] = (*argvp)[n]; + dialog_opts[n + added - 2] = dialog_opts[n]; + } + for (n = 0; n < added; ++n) { + (*argvp)[n + j] = list[n]; + dialog_opts[n + j] = FALSE; + } + *argcp += added - 2; + free(list); + } + } else { + dlg_exiterr("Cannot open --file %s", filename); + } + (*argvp)[*argcp] = 0; + ++j; + continue; + } else { + dlg_exiterr("No value given for --file"); + } + } + if (!escaped + && (*argvp)[j] != 0 + && !strncmp((*argvp)[j], "--", 2) + && isalpha(UCH((*argvp)[j][2]))) { + dialog_opts[j] = TRUE; + } + } + + /* if we didn't find any "--" tokens, there's no reason to do the table + * lookup in isOption() + */ + if (!changed) { + free(dialog_opts); + dialog_opts = 0; + } + dialog_argv = (*argvp); +} + +/* + * Check if the given string from main's argv is an option. + */ +static bool +isOption(const char *arg) +{ + bool result = FALSE; + + if (arg != 0) { + if (dialog_opts != 0) { + int n; + for (n = 1; dialog_argv[n] != 0; ++n) { + if (dialog_argv[n] == arg) { + result = dialog_opts[n]; + break; + } + } + } else if (!strncmp(arg, "--", 2) && isalpha(UCH(arg[2]))) { + result = TRUE; + } + } + return result; +} + +static eOptions +lookupOption(const char *name, int pass) +{ + unsigned n; + + if (isOption(name)) { + name += 2; + for (n = 0; n < sizeof(options) / sizeof(options[0]); n++) { + if ((pass & options[n].pass) != 0 + && !strcmp(name, options[n].name)) { + return options[n].code; + } + } + } + return o_unknown; +} + +static void +Usage(const char *msg) +{ + dlg_exiterr("Error: %s.\nUse --help to list options.\n\n", msg); +} + +/* + * Count arguments, stopping at the end of the argument list, or on any of our + * "--" tokens. + */ +static int +arg_rest(char *argv[]) +{ + int i = 1; /* argv[0] points to a "--" token */ + + while (argv[i] != 0 + && (!isOption(argv[i]) || lookupOption(argv[i], 7) == o_unknown)) + i++; + return i; +} + +/* + * In MultiWidget this function is needed to count how many tags + * a widget (menu, checklist, radiolist) has + */ +static int +howmany_tags(char *argv[], int group) +{ + int result = 0; + int have; + const char *format = "Expected %d arguments, found only %d"; + char temp[80]; + + while (argv[0] != 0) { + if (isOption(argv[0])) + break; + if ((have = arg_rest(argv)) < group) { + sprintf(temp, format, group, have); + Usage(temp); + } + + argv += group; + result++; + } + + return result; +} + +static int +numeric_arg(char **av, int n) +{ + char *last = 0; + int result = strtol(av[n], &last, 10); + char msg[80]; + + if (last == 0 || *last != 0) { + sprintf(msg, "Expected a number for token %d of %.20s", n, av[0]); + Usage(msg); + } + return result; +} + +static char * +optional_str(char **av, int n, char *dft) +{ + char *ret = dft; + if (arg_rest(av) > n) + ret = av[n]; + return ret; +} + +#if defined(HAVE_DLG_GAUGE) || defined(HAVE_XDIALOG) +static int +optional_num(char **av, int n, int dft) +{ + int ret = dft; + if (arg_rest(av) > n) + ret = numeric_arg(av, n); + return ret; +} +#endif + +/* + * On AIX 4.x, we have to flush the output right away since there is a bug in + * the curses package which discards stdout even when we've used newterm to + * redirect output to /dev/tty. + */ +static int +show_result(int ret) +{ + bool either = FALSE; + + switch (ret) { + case DLG_EXIT_OK: + case DLG_EXIT_EXTRA: + case DLG_EXIT_HELP: + case DLG_EXIT_ITEM_HELP: + if ((dialog_state.output_count > 1) && !dialog_vars.separate_output) { + fputs((dialog_state.separate_str + ? dialog_state.separate_str + : DEFAULT_SEPARATE_STR), + dialog_state.output); + either = TRUE; + } + if (dialog_vars.input_result[0] != '\0') { + fputs(dialog_vars.input_result, dialog_state.output); + either = TRUE; + } + if (either) { + fflush(dialog_state.output); + } + break; + } + return ret; +} + +/* + * These are the widget callers. + */ + +static int +call_yesno(CALLARGS) +{ + *offset_add = 4; + return dialog_yesno(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3)); +} + +static int +call_msgbox(CALLARGS) +{ + *offset_add = 4; + return dialog_msgbox(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), 1); +} + +static int +call_infobox(CALLARGS) +{ + *offset_add = 4; + return dialog_msgbox(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), 0); +} + +static int +call_textbox(CALLARGS) +{ + *offset_add = 4; + return dialog_textbox(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3)); +} + +static int +call_menu(CALLARGS) +{ + int tags = howmany_tags(av + 5, MENUBOX_TAGS); + *offset_add = 5 + tags * MENUBOX_TAGS; + + return dialog_menu(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + numeric_arg(av, 4), + tags, av + 5); +} + +static int +call_inputmenu(CALLARGS) +{ + int tags = howmany_tags(av + 5, MENUBOX_TAGS); + + dialog_vars.input_menu = TRUE; + + if (dialog_vars.max_input == 0) + dialog_vars.max_input = MAX_LEN / 2; + + if (dialog_vars.extra_label == 0) + dialog_vars.extra_label = _("Rename"); + + dialog_vars.extra_button = TRUE; + + *offset_add = 5 + tags * MENUBOX_TAGS; + return dialog_menu(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + numeric_arg(av, 4), + tags, av + 5); +} + +static int +call_checklist(CALLARGS) +{ + int tags = howmany_tags(av + 5, CHECKBOX_TAGS); + int code; + bool save_quoted = dialog_vars.quoted; + + dialog_vars.quoted = !dialog_vars.separate_output; + *offset_add = 5 + tags * CHECKBOX_TAGS; + code = dialog_checklist(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + numeric_arg(av, 4), + tags, av + 5, FLAG_CHECK); + dialog_vars.quoted = save_quoted; + return code; +} + +static int +call_radiolist(CALLARGS) +{ + int tags = howmany_tags(av + 5, CHECKBOX_TAGS); + *offset_add = 5 + tags * CHECKBOX_TAGS; + return dialog_checklist(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + numeric_arg(av, 4), + tags, av + 5, FLAG_RADIO); +} + +static int +call_inputbox(CALLARGS) +{ + *offset_add = arg_rest(av); + return dialog_inputbox(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + optional_str(av, 4, 0), 0); +} + +static int +call_passwordbox(CALLARGS) +{ + *offset_add = arg_rest(av); + return dialog_inputbox(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + optional_str(av, 4, 0), 1); +} + +#ifdef HAVE_XDIALOG +static int +call_calendar(CALLARGS) +{ + *offset_add = arg_rest(av); + return dialog_calendar(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + optional_num(av, 4, -1), + optional_num(av, 5, -1), + optional_num(av, 6, -1)); +} + +static int +call_dselect(CALLARGS) +{ + *offset_add = arg_rest(av); + return dialog_dselect(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3)); +} + +static int +call_editbox(CALLARGS) +{ + *offset_add = 4; + return dialog_editbox(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3)); +} + +static int +call_fselect(CALLARGS) +{ + *offset_add = arg_rest(av); + return dialog_fselect(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3)); +} + +static int +call_timebox(CALLARGS) +{ + *offset_add = arg_rest(av); + return dialog_timebox(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + optional_num(av, 4, -1), + optional_num(av, 5, -1), + optional_num(av, 6, -1)); +} +#endif /* HAVE_XDIALOG */ + +#ifdef HAVE_DLG_FORMBOX +static int +call_form(CALLARGS) +{ + int group = FORMBOX_TAGS; + int tags = howmany_tags(av + 5, group); + *offset_add = 5 + tags * group; + + return dialog_form(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + numeric_arg(av, 4), + tags, av + 5); +} + +static int +call_password_form(CALLARGS) +{ + unsigned save = dialog_vars.formitem_type; + int result; + + dialog_vars.formitem_type = 1; + result = call_form(PASSARGS); + dialog_vars.formitem_type = save; + + return result; +} +#endif /* HAVE_DLG_FORMBOX */ + +#ifdef HAVE_DLG_MIXEDFORM +static int +call_mixed_form(CALLARGS) +{ + int group = MIXEDFORM_TAGS; + int tags = howmany_tags(av + 5, group); + *offset_add = 5 + tags * group; + + return dialog_mixedform(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + numeric_arg(av, 4), + tags, av + 5); +} +#endif /* HAVE_DLG_MIXEDFORM */ + +#ifdef HAVE_DLG_GAUGE +static int +call_gauge(CALLARGS) +{ + *offset_add = arg_rest(av); + return dialog_gauge(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + optional_num(av, 4, 0)); +} + +static int +call_pause(CALLARGS) +{ + *offset_add = arg_rest(av); + return dialog_pause(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + numeric_arg(av, 4)); +} +#endif + +#ifdef HAVE_MIXEDGAUGE +static int +call_mixed_gauge(CALLARGS) +{ +#define MIXEDGAUGE_BASE 5 + int tags = howmany_tags(av + MIXEDGAUGE_BASE, MIXEDGAUGE_TAGS); + *offset_add = MIXEDGAUGE_BASE + tags * MIXEDGAUGE_TAGS; + return dialog_mixedgauge(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + numeric_arg(av, 4), + tags, av + MIXEDGAUGE_BASE); +} +#endif + +#ifdef HAVE_DLG_GAUGE +static int +call_progressbox(CALLARGS) +{ + *offset_add = arg_rest(av); + /* the original version does not accept a prompt string, but for + * consistency we allow it. + */ + return ((*offset_add == 4) + ? dialog_progressbox(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3)) + : dialog_progressbox(t, + "", + numeric_arg(av, 1), + numeric_arg(av, 2))); +} +#endif + +#ifdef HAVE_DLG_TAILBOX +static int +call_tailbox(CALLARGS) +{ + *offset_add = 4; + return dialog_tailbox(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + FALSE); +} + +static int +call_tailboxbg(CALLARGS) +{ + *offset_add = 4; + return dialog_tailbox(t, + av[1], + numeric_arg(av, 2), + numeric_arg(av, 3), + TRUE); +} +#endif +/* *INDENT-OFF* */ +static const Mode modes[] = +{ + {o_yesno, 4, 4, call_yesno}, + {o_msgbox, 4, 4, call_msgbox}, + {o_infobox, 4, 4, call_infobox}, + {o_textbox, 4, 4, call_textbox}, + {o_menu, 7, 0, call_menu}, + {o_inputmenu, 7, 0, call_inputmenu}, + {o_checklist, 8, 0, call_checklist}, + {o_radiolist, 8, 0, call_radiolist}, + {o_inputbox, 4, 5, call_inputbox}, + {o_passwordbox, 4, 5, call_passwordbox}, +#ifdef HAVE_DLG_GAUGE + {o_gauge, 4, 5, call_gauge}, + {o_pause, 5, 5, call_pause}, + {o_progressbox, 3, 4, call_progressbox}, +#endif +#ifdef HAVE_DLG_FORMBOX + {o_passwordform, 13, 0, call_password_form}, + {o_form, 13, 0, call_form}, +#endif +#ifdef HAVE_MIXEDGAUGE + {o_mixedgauge, MIXEDGAUGE_BASE, 0, call_mixed_gauge}, +#endif +#ifdef HAVE_DLG_MIXEDFORM + {o_mixedform, 13, 0, call_mixed_form}, +#endif +#ifdef HAVE_DLG_TAILBOX + {o_tailbox, 4, 4, call_tailbox}, + {o_tailboxbg, 4, 4, call_tailboxbg}, +#endif +#ifdef HAVE_XDIALOG + {o_calendar, 4, 7, call_calendar}, + {o_dselect, 4, 5, call_dselect}, + {o_editbox, 4, 4, call_editbox}, + {o_fselect, 4, 5, call_fselect}, + {o_timebox, 4, 7, call_timebox}, +#endif +}; +/* *INDENT-ON* */ + +static char * +optionString(char **argv, int *num) +{ + int next = *num + 1; + char *result = argv[next]; + if (result == 0) { + char temp[80]; + sprintf(temp, "Expected a string-parameter for %.20s", argv[*num]); + Usage(temp); + } + *num = next; + return result; +} + +static int +optionValue(char **argv, int *num) +{ + int next = *num + 1; + char *src = argv[next]; + char *tmp = 0; + int result = 0; + + if (src != 0) { + result = strtol(src, &tmp, 0); + if (tmp == 0 || *tmp != 0) + src = 0; + } + + if (src == 0) { + char temp[80]; + sprintf(temp, "Expected a numeric-parameter for %.20s", argv[*num]); + Usage(temp); + } + *num = next; + return result; +} + +/* + * Print parts of a message + */ +static void +PrintList(const char *const *list) +{ + const char *leaf = strrchr(program, '/'); + unsigned n = 0; + + if (leaf != 0) + leaf++; + else + leaf = program; + + while (*list != 0) { + fprintf(dialog_state.output, *list, n ? leaf : dialog_version()); + (void) fputc('\n', dialog_state.output); + n = 1; + list++; + } +} + +static const Mode * +lookupMode(eOptions code) +{ + const Mode *modePtr = 0; + unsigned n; + + for (n = 0; n < sizeof(modes) / sizeof(modes[0]); n++) { + if (modes[n].code == code) { + modePtr = &modes[n]; + break; + } + } + return modePtr; +} + +static int +compare_opts(const void *a, const void *b) +{ + Options *const *p = (Options * const *) a; + Options *const *q = (Options * const *) b; + return strcmp((*p)->name, (*q)->name); +} + +/* + * Print program help-message + */ +static void +Help(void) +{ + static const char *const tbl_1[] = + { + "cdialog (ComeOn Dialog!) version %s", + "Copyright 2000-2007,2008 Thomas E. Dickey", + "This is free software; see the source for copying conditions. There is NO", + "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.", + "", + "* Display dialog boxes from shell scripts *", + "", + "Usage: %s <options> { --and-widget <options> }", + "where options are \"common\" options, followed by \"box\" options", + "", +#ifdef HAVE_RC_FILE + "Special options:", + " [--create-rc \"file\"]", +#endif + 0 + }, *const tbl_3[] = + { + "", + "Auto-size with height and width = 0. Maximize with height and width = -1.", + "Global-auto-size if also menu_height/list_height = 0.", + 0 + }; + unsigned limit = sizeof(options) / sizeof(options[0]); + unsigned j, k; + const Options **opts; + + opts = dlg_calloc(const Options *, limit); + assert_ptr(opts, "Help"); + for (j = 0; j < limit; ++j) { + opts[j] = &(options[j]); + } + qsort(opts, limit, sizeof(Options *), compare_opts); + + PrintList(tbl_1); + fprintf(dialog_state.output, "Common options:\n "); + for (j = k = 0; j < limit; j++) { + if ((opts[j]->pass & 1) + && opts[j]->help != 0) { + unsigned len = 6 + strlen(opts[j]->name) + strlen(opts[j]->help); + k += len; + if (k > 75) { + fprintf(dialog_state.output, "\n "); + k = len; + } + fprintf(dialog_state.output, " [--%s%s%s]", opts[j]->name, + *(opts[j]->help) ? " " : "", opts[j]->help); + } + } + fprintf(dialog_state.output, "\nBox options:\n"); + for (j = 0; j < limit; j++) { + if ((opts[j]->pass & 2) != 0 + && opts[j]->help != 0 + && lookupMode(opts[j]->code)) + fprintf(dialog_state.output, " --%-12s %s\n", opts[j]->name, + opts[j]->help); + } + PrintList(tbl_3); + + free(opts); + dlg_exit(DLG_EXIT_OK); +} + +/* + * "Common" options apply to all widgets more/less. Most of the common options + * set values in dialog_vars, a few set dialog_state and a couple write to the + * output stream. + */ +static int +process_common_options(int argc, char **argv, int offset, bool output) +{ + bool done = FALSE; + + while (offset < argc && !done) { /* Common options */ + switch (lookupOption(argv[offset], 1)) { + case o_title: + dialog_vars.title = optionString(argv, &offset); + break; + case o_backtitle: + dialog_vars.backtitle = optionString(argv, &offset); + break; + case o_separate_widget: + dialog_state.separate_str = optionString(argv, &offset); + break; + case o_separate_output: + dialog_vars.separate_output = TRUE; + break; + case o_colors: + dialog_vars.colors = TRUE; + break; + case o_cr_wrap: + dialog_vars.cr_wrap = TRUE; + break; + case o_no_collapse: + dialog_vars.nocollapse = TRUE; + break; + case o_no_kill: + dialog_vars.cant_kill = TRUE; + break; + case o_nocancel: + dialog_vars.nocancel = TRUE; + break; + case o_nook: + dialog_vars.nook = TRUE; + break; + case o_quoted: + dialog_vars.quoted = TRUE; + break; + case o_single_quoted: + dialog_vars.single_quoted = TRUE; + break; + case o_size_err: + dialog_vars.size_err = TRUE; + break; + case o_beep: + dialog_vars.beep_signal = TRUE; + break; + case o_beep_after: + dialog_vars.beep_after_signal = TRUE; + break; + case o_scrollbar: + dialog_state.use_scrollbar = TRUE; + break; + case o_shadow: + dialog_state.use_shadow = TRUE; + break; + case o_defaultno: + dialog_vars.defaultno = TRUE; + break; + case o_default_item: + dialog_vars.default_item = optionString(argv, &offset); + break; + case o_insecure: + dialog_vars.insecure = TRUE; + break; + case o_item_help: + dialog_vars.item_help = TRUE; + break; + case o_help_button: + dialog_vars.help_button = TRUE; + break; + case o_help_status: + dialog_vars.help_status = TRUE; + break; + case o_extra_button: + dialog_vars.extra_button = TRUE; + break; + case o_ignore: + ignore_unknown = TRUE; + break; + case o_keep_window: + dialog_vars.keep_window = TRUE; + break; + case o_no_shadow: + dialog_state.use_shadow = FALSE; + break; + case o_print_size: + dialog_vars.print_siz = TRUE; + break; + case o_print_maxsize: + if (output) { + /* + * If this is the last option, we do not want any error + * messages - just our output. Calling end_dialog() cancels + * the refresh() at the end of the program as well. + */ + if (argv[offset + 1] == 0) { + ignore_unknown = TRUE; + end_dialog(); + } + fflush(dialog_state.output); + fprintf(dialog_state.output, "MaxSize: %d, %d\n", SLINES, SCOLS); + } + break; + case o_print_version: + if (output) { + fprintf(stdout, "Version: %s\n", dialog_version()); + } + break; + case o_separator: + case o_output_separator: + dialog_vars.output_separator = optionString(argv, &offset); + break; + case o_column_separator: + dialog_vars.column_separator = optionString(argv, &offset); + break; + case o_tab_correct: + dialog_vars.tab_correct = TRUE; + break; + case o_sleep: + dialog_vars.sleep_secs = optionValue(argv, &offset); + break; + case o_timeout: + dialog_vars.timeout_secs = optionValue(argv, &offset); + break; + case o_max_input: + dialog_vars.max_input = optionValue(argv, &offset); + break; + case o_tab_len: + dialog_state.tab_len = optionValue(argv, &offset); + break; + case o_trim: + dialog_vars.trim_whitespace = TRUE; + break; + case o_visit_items: + dialog_state.visit_items = TRUE; + break; + case o_aspect: + dialog_state.aspect_ratio = optionValue(argv, &offset); + break; + case o_begin: + dialog_vars.begin_set = TRUE; + dialog_vars.begin_y = optionValue(argv, &offset); + dialog_vars.begin_x = optionValue(argv, &offset); + break; + case o_clear: + dialog_vars.dlg_clear_screen = TRUE; + break; + case o_yes_label: + dialog_vars.yes_label = optionString(argv, &offset); + break; + case o_no_label: + dialog_vars.no_label = optionString(argv, &offset); + break; + case o_ok_label: + dialog_vars.ok_label = optionString(argv, &offset); + break; + case o_cancel_label: + dialog_vars.cancel_label = optionString(argv, &offset); + break; + case o_extra_label: + dialog_vars.extra_label = optionString(argv, &offset); + break; + case o_exit_label: + dialog_vars.exit_label = optionString(argv, &offset); + break; + case o_help_label: + dialog_vars.help_label = optionString(argv, &offset); + break; + case o_date_format: + dialog_vars.date_format = optionString(argv, &offset); + break; + case o_time_format: + dialog_vars.time_format = optionString(argv, &offset); + break; + case o_keep_tite: + dialog_vars.keep_tite = TRUE; + break; + case o_ascii_lines: + dialog_vars.ascii_lines = TRUE; + dialog_vars.no_lines = FALSE; + break; + case o_no_lines: + dialog_vars.no_lines = TRUE; + dialog_vars.ascii_lines = FALSE; + break; + case o_noitem: + case o_fullbutton: + /* ignore */ + break; + /* options of Xdialog which we ignore */ + case o_icon: + case o_wmclass: + (void) optionString(argv, &offset); + /* FALLTHRU */ + case o_allow_close: + case o_auto_placement: + case o_fixed_font: + case o_keep_colors: + case o_no_close: + case o_no_cr_wrap: + case o_screen_center: + case o_smooth: + case o_under_mouse: + break; + case o_unknown: + if (ignore_unknown) + break; + /* FALLTHRU */ + default: /* no more common options */ + done = TRUE; + break; +#ifdef HAVE_DLG_TRACE + case o_trace: + dlg_trace(optionString(argv, &offset)); + break; +#endif + } + if (!done) + offset++; + } + return offset; +} + +/* + * Initialize options at the start of a series of common options culminating + * in a widget. + */ +static void +init_result(char *buffer) +{ + static bool first = TRUE; + static char **special_argv = 0; + static int special_argc = 0; + + /* clear everything we do not save for the next widget */ + memset(&dialog_vars, 0, sizeof(dialog_vars)); + + dialog_vars.input_result = buffer; + dialog_vars.input_result[0] = '\0'; + + /* + * The first time this is called, check for common options given by an + * environment variable. + */ + if (first) { + char *env = getenv("DIALOGOPTS"); + if (env != 0) + env = dlg_strclone(env); + if (env != 0) { + special_argv = string_to_argv(env); + special_argc = count_argv(special_argv); + } + } + if (special_argv != 0) { + process_common_options(special_argc, special_argv, 0, FALSE); +#ifdef NO_LEAKS + free(special_argv[0]); + free(special_argv); + first = TRUE; +#endif + } +} + +int +main(int argc, char *argv[]) +{ + char temp[256]; + bool esc_pressed = FALSE; + bool keep_tite = FALSE; + int offset = 1; + int offset_add; + int retval = DLG_EXIT_OK; + int j, have; + eOptions code; + const Mode *modePtr; + char my_buffer[MAX_LEN + 1]; + + memset(&dialog_state, 0, sizeof(dialog_state)); + memset(&dialog_vars, 0, sizeof(dialog_vars)); + +#if defined(ENABLE_NLS) + /* initialize locale support */ + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); +#elif defined(HAVE_SETLOCALE) + (void) setlocale(LC_ALL, ""); +#endif + + unescape_argv(&argc, &argv); + program = argv[0]; + dialog_state.output = stderr; + dialog_state.input = stdin; + + /* + * Look for the last --stdout, --stderr or --output-fd option, and use + * that. We can only write to one of them. If --stdout is used, that + * can interfere with initializing the curses library, so we want to + * know explicitly if it is used. + */ + while (offset < argc) { + int base = offset; + switch (lookupOption(argv[offset], 7)) { + case o_stdout: + dialog_state.output = stdout; + break; + case o_stderr: + dialog_state.output = stderr; + break; + case o_input_fd: + if ((j = optionValue(argv, &offset)) < 0 + || (dialog_state.input = fdopen(j, "r")) == 0) + dlg_exiterr("Cannot open input-fd\n"); + break; + case o_output_fd: + if ((j = optionValue(argv, &offset)) < 0 + || (dialog_state.output = fdopen(j, "w")) == 0) + dlg_exiterr("Cannot open output-fd\n"); + break; + case o_keep_tite: + keep_tite = TRUE; + break; + default: + ++offset; + continue; + } + for (j = base; j < argc; ++j) { + dialog_argv[j] = dialog_argv[j + 1 + (offset - base)]; + if (dialog_opts != 0) + dialog_opts[j] = dialog_opts[j + 1 + (offset - base)]; + } + argc -= (1 + offset - base); + offset = base; + } + offset = 1; + init_result(my_buffer); + + if (argc == 2) { /* if we don't want clear screen */ + switch (lookupOption(argv[1], 7)) { + case o_print_maxsize: + (void) initscr(); + endwin(); + fflush(dialog_state.output); + fprintf(dialog_state.output, "MaxSize: %d, %d\n", SLINES, SCOLS); + break; + case o_print_version: + fprintf(stdout, "Version: %s\n", dialog_version()); + break; + case o_clear: + initscr(); + refresh(); + endwin(); + break; + case o_ignore: + break; + default: + case o_help: + dialog_state.output = stdout; + Help(); + break; + } + return DLG_EXIT_OK; + } + + if (argc < 2) { + Help(); + } +#ifdef HAVE_RC_FILE + if (lookupOption(argv[1], 7) == o_create_rc) { + if (argc != 3) { + sprintf(temp, "Expected a filename for %.50s", argv[1]); + Usage(temp); + } + if (dlg_parse_rc() == -1) /* Read the configuration file */ + dlg_exiterr("dialog: dlg_parse_rc"); + dlg_create_rc(argv[2]); + return DLG_EXIT_OK; + } +#endif + + dialog_vars.keep_tite = keep_tite; /* init_result() cleared global */ + + init_dialog(dialog_state.input, dialog_state.output); + + while (offset < argc && !esc_pressed) { + init_result(my_buffer); + + offset = process_common_options(argc, argv, offset, TRUE); + + if (argv[offset] == NULL) { + if (ignore_unknown) + break; + Usage("Expected a box option"); + } + + if (lookupOption(argv[offset], 2) != o_checklist + && dialog_vars.separate_output) { + sprintf(temp, "Expected --checklist, not %.20s", argv[offset]); + Usage(temp); + } + + if (dialog_state.aspect_ratio == 0) + dialog_state.aspect_ratio = DEFAULT_ASPECT_RATIO; + + dlg_put_backtitle(); + + /* use a table to look for the requested mode, to avoid code duplication */ + + modePtr = 0; + if ((code = lookupOption(argv[offset], 2)) != o_unknown) + modePtr = lookupMode(code); + if (modePtr == 0) { + sprintf(temp, "%s option %.20s", + lookupOption(argv[offset], 7) != o_unknown + ? "Unexpected" + : "Unknown", + argv[offset]); + Usage(temp); + } + + have = arg_rest(&argv[offset]); + if (have < modePtr->argmin) { + sprintf(temp, "Expected at least %d tokens for %.20s, have %d", + modePtr->argmin - 1, argv[offset], + have - 1); + Usage(temp); + } + if (modePtr->argmax && have > modePtr->argmax) { + sprintf(temp, + "Expected no more than %d tokens for %.20s, have %d", + modePtr->argmax - 1, argv[offset], + have - 1); + Usage(temp); + } + + /* + * Trim whitespace from non-title option values, e.g., the ones that + * will be used as captions or prompts. Do that only for the widget + * we are about to process, since the "--trim" option is reset before + * accumulating options for each widget. + */ + for (j = offset + 1; j <= offset + have; j++) { + switch (lookupOption(argv[j - 1], 7)) { + case o_unknown: + case o_title: + case o_backtitle: + break; + default: + if (argv[j] != 0) { + dlg_trim_string(argv[j]); + } + break; + } + } + + retval = show_result((*(modePtr->jumper)) (dialog_vars.title, + argv + offset, + &offset_add)); + offset += offset_add; + + if (dialog_vars.input_result != my_buffer) + free(dialog_vars.input_result); + + if (retval == DLG_EXIT_ESC) { + esc_pressed = TRUE; + } else { + + if (dialog_vars.beep_after_signal) + (void) beep(); + + if (dialog_vars.sleep_secs) + (void) napms(dialog_vars.sleep_secs * 1000); + + if (offset < argc) { + switch (lookupOption(argv[offset], 7)) { + case o_and_widget: + offset++; + break; + case o_unknown: + sprintf(temp, "Expected --and-widget, not %.20s", + argv[offset]); + Usage(temp); + break; + default: + /* if we got a cancel, etc., stop chaining */ + if (retval != DLG_EXIT_OK) + esc_pressed = TRUE; + else + dialog_vars.dlg_clear_screen = TRUE; + break; + } + } + if (dialog_vars.dlg_clear_screen) + dlg_clear(); + } + } + + dlg_killall_bg(&retval); + if (dialog_state.screen_initialized) { + (void) refresh(); + end_dialog(); + } + dlg_exit(retval); +} Index: contrib/dialog/msgbox.c =================================================================== --- contrib/dialog/msgbox.c (revision 0) +++ contrib/dialog/msgbox.c (revision 0) @@ -0,0 +1,183 @@ +/* + * $Id: msgbox.c,v 1.64 2010/01/15 10:50:17 tom Exp $ + * + * msgbox.c -- implements the message box and info box + * + * Copyright 2000-2009,2010 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[] = { + ENTERKEY_BINDINGS, + DLG_KEYS_DATA( DLGK_ENTER, ' ' ), + SCROLLKEY_BINDINGS, + DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_DOWN ), + DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ), + DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ), + DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_UP ), + DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ), + DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ), + END_KEYS_BINDING + }; + /* *INDENT-ON* */ + + int x, y, last = 0, page; + int button = 0; + int key = 0, fkey; + int result = DLG_EXIT_UNKNOWN; + WINDOW *dialog = 0; + char *prompt = dlg_strclone(cprompt); + const char **buttons = dlg_ok_label(); + int offset = 0; + int check; + bool show = TRUE; + int min_width = (pauseopt == 1 ? 12 : 0); + +#ifdef KEY_RESIZE + int req_high = height; + int req_wide = width; + restart: +#endif + + dlg_button_layout(buttons, &min_width); + + 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_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_title(dialog, title); + + wattrset(dialog, dialog_attr); + + if (pauseopt) { + dlg_draw_bottom_box(dialog); + mouse_mkbutton(height - 2, width / 2 - 4, 6, '\n'); + dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); + + while (result == DLG_EXIT_UNKNOWN) { + if (show) { + last = dlg_print_scrolled(dialog, prompt, offset, + page, width, pauseopt); + 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 = check ? DLG_EXIT_HELP : DLG_EXIT_OK; + break; + } + + if (fkey) { + switch (key) { +#ifdef KEY_RESIZE + case KEY_RESIZE: + dlg_clear(); + 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 = button ? DLG_EXIT_HELP : DLG_EXIT_OK; + break; + case DLGK_MOUSE(0): + result = DLG_EXIT_OK; + break; + case DLGK_MOUSE(1): + result = DLG_EXIT_HELP; + break; + default: + if (dlg_check_scrolled(key, + last, + page, + &show, + &offset) == 0) + break; + beep(); + break; + } + } else { + beep(); + } + } + } else { + dlg_print_scrolled(dialog, prompt, offset, page, width, pauseopt); + wrefresh(dialog); + result = DLG_EXIT_OK; + } + + dlg_del_window(dialog); + dlg_mouse_free_regions(); + free(prompt); + return result; +} Index: contrib/dialog/configure =================================================================== --- contrib/dialog/configure (revision 0) +++ contrib/dialog/configure (revision 0) @@ -0,0 +1,14272 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.52.20100320. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +ac_unique_file="dialog.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<EOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +EOF + + cat <<EOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +EOF + + cat <<\EOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST build programs to run on HOST [BUILD] +EOF +fi + +if test -n "$ac_init_help"; then + + cat <<\EOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + + --disable-echo display "compiling" commands + --disable-largefile omit support for large files + --with-warnings test: turn on gcc warnings + --with-libiconv-prefix=DIR + search for libiconv in DIR/include and DIR/lib + --enable-nls use Native Language Support + --with-included-gettext use the GNU gettext library included here + --disable-included-msgs use included messages, for i18n support + --with-dmalloc test: use Gray Watson's dmalloc library + --with-dbmalloc test: use Conor Cahill's dbmalloc library + --with-purify test: use Purify + --with-valgrind test: use valgrind + --with-no-leaks test: free permanent memory, analyze leaks + --disable-trace do not support --trace option + --with-libtool generate libraries with libtool + --with-libtool-opts=XXX specify additional libtool options + --with-ncurses compile/link with ncurses library + --with-ncursesw compile/link with wide-char ncurses library + --with-curses-dir=DIR directory in which (n)curses is installed + --disable-extras do not include extra dialogs + --disable-rc-file do not include config-file support + --disable-Xdialog do not include Xdialog-style dialogs + --disable-form do not include the form dialog + --disable-gauge do not include the gauge dialogs + --disable-tailbox do not include the tailbox dialog + --disable-mixedform do not include the mixedform dialog + --disable-mixedgauge do not include the mixedgauge dialog + --enable-widec enable wide-curses features + --disable-rpath-hack don't add rpath options for additional libraries + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 <<EOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.52.20100320. Invocation command line was + + $ $0 $@ + +EOF +{ +cat <<_ASUNAME +## ---------- ## +## Platform. ## +## ---------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <<EOF +## ------------ ## +## Core tests. ## +## ------------ ## + +EOF + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +for ac_arg +do + case $ac_arg in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:902: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:913: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:921: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:937: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:941: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:947: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:949: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:951: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:970: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:972: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:993: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:996: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_config_headers="$ac_config_headers dlg_config.h:config.hin" + +if test -f $srcdir/VERSION ; then + echo "$as_me:1008: checking for package version" >&5 +echo $ECHO_N "checking for package version... $ECHO_C" >&6 + + # if there are not enough fields, cut returns the last one... + cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1` + cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2` + cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3` + + # this is how CF_BUNDLED_INTL uses $VERSION: + VERSION="$cf_field1" + + VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'` + test -z "$VERSION_MAJOR" && { { echo "$as_me:1020: error: missing major-version" >&5 +echo "$as_me: error: missing major-version" >&2;} + { (exit 1); exit 1; }; } + + VERSION_MINOR=`echo "$cf_field2" | sed -e 's/^[^.]*\.//' -e 's/-.*//'` + test -z "$VERSION_MINOR" && { { echo "$as_me:1025: error: missing minor-version" >&5 +echo "$as_me: error: missing minor-version" >&2;} + { (exit 1); exit 1; }; } + + echo "$as_me:1029: result: ${VERSION_MAJOR}.${VERSION_MINOR}" >&5 +echo "${ECHO_T}${VERSION_MAJOR}.${VERSION_MINOR}" >&6 + + echo "$as_me:1032: checking for package patch date" >&5 +echo $ECHO_N "checking for package patch date... $ECHO_C" >&6 + VERSION_PATCH=`echo "$cf_field3" | sed -e 's/^[^-]*-//'` + case .$VERSION_PATCH in + .) + { { echo "$as_me:1037: error: missing patch-date $VERSION_PATCH" >&5 +echo "$as_me: error: missing patch-date $VERSION_PATCH" >&2;} + { (exit 1); exit 1; }; } + ;; + .[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]) + ;; + *) + { { echo "$as_me:1044: error: illegal patch-date $VERSION_PATCH" >&5 +echo "$as_me: error: illegal patch-date $VERSION_PATCH" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + echo "$as_me:1049: result: $VERSION_PATCH" >&5 +echo "${ECHO_T}$VERSION_PATCH" >&6 +else + { { echo "$as_me:1052: error: did not find $srcdir/VERSION" >&5 +echo "$as_me: error: did not find $srcdir/VERSION" >&2;} + { (exit 1); exit 1; }; } +fi + +# show the actual data that we have for versions: +test -n "$verbose" && echo " VERSION $VERSION" 1>&6 + +echo "${as_me-configure}:1060: testing VERSION $VERSION ..." 1>&5 + +test -n "$verbose" && echo " VERSION_MAJOR $VERSION_MAJOR" 1>&6 + +echo "${as_me-configure}:1064: testing VERSION_MAJOR $VERSION_MAJOR ..." 1>&5 + +test -n "$verbose" && echo " VERSION_MINOR $VERSION_MINOR" 1>&6 + +echo "${as_me-configure}:1068: testing VERSION_MINOR $VERSION_MINOR ..." 1>&5 + +test -n "$verbose" && echo " VERSION_PATCH $VERSION_PATCH" 1>&6 + +echo "${as_me-configure}:1072: testing VERSION_PATCH $VERSION_PATCH ..." 1>&5 + + PACKAGE=dialog + cat >>confdefs.h <<EOF +#define PACKAGE "$PACKAGE" +EOF + +cf_PACKAGE=`echo "$PACKAGE" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <<EOF +#define ${cf_PACKAGE}_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}" +EOF + + cat >>confdefs.h <<EOF +#define ${cf_PACKAGE}_PATCHDATE ${VERSION_PATCH} +EOF + +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +DESTDIR= + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:1113: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1128: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1136: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1139: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:1148: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1163: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1171: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1174: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1187: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1202: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1210: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1213: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1222: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1237: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1245: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1248: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1261: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1281: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1303: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1306: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1317: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1332: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1340: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1343: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1356: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1371: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1379: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1382: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1394: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:1399:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:1402: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1405: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1407: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1410: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1412: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:1415: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line 1419 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:1435: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1438: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1441: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1464: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1470: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1475: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1481: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1484: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1491: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1499: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1506: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1508: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1511: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1513: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1516: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1532: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1538: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1544: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1550 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1562: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1565: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1577: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1584: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1588: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1594 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1609: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1612: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1615: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1618: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1630: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1636: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1642 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1654: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1657: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1660: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1663: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:1673: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1700: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1703: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1706: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1709: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 1721 "configure" +#include "confdefs.h" +#include <stdlib.h> +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1734: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1737: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1740: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1743: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 1753 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1765: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1768: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1771: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1774: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return +echo "$as_me:1808: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 1829 "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:1834: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1840: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 1863 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:1867: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1873: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:1910: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 1920 "configure" +#include "confdefs.h" +#include <assert.h> + Syntax error +_ACEOF +if { (eval echo "$as_me:1925: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1931: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 1954 "configure" +#include "confdefs.h" +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:1958: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1964: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:1992: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return + +if test $ac_cv_c_compiler_gnu = yes; then + echo "$as_me:2005: checking whether $CC needs -traditional" >&5 +echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 +if test "${ac_cv_prog_gcc_traditional+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_pattern="Autoconf.*'x'" + cat >conftest.$ac_ext <<_ACEOF +#line 2012 "configure" +#include "confdefs.h" +#include <sgtty.h> +int Autoconf = TIOCGETP; +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + if test $ac_cv_prog_gcc_traditional = no; then + cat >conftest.$ac_ext <<_ACEOF +#line 2027 "configure" +#include "confdefs.h" +#include <termio.h> +int Autoconf = TCGETA; +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +echo "$as_me:2040: result: $ac_cv_prog_gcc_traditional" >&5 +echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +echo "$as_me:2047: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:2067: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:2071: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:2079: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" +echo "$as_me:2094: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:2102: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:2105: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:2114: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_RANLIB="ranlib" +echo "$as_me:2129: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:2138: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:2141: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:2167: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:2187: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:2236: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +echo "$as_me:2250: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_AR="${ac_tool_prefix}ar" +echo "$as_me:2265: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:2273: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:2276: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:2285: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_AR="ar" +echo "$as_me:2300: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="ar" +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + echo "$as_me:2309: result: $ac_ct_AR" >&5 +echo "${ECHO_T}$ac_ct_AR" >&6 +else + echo "$as_me:2312: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + AR=$ac_ct_AR +else + AR="$ac_cv_prog_AR" +fi + +echo "$as_me:2321: checking for POSIXized ISC" >&5 +echo $ECHO_N "checking for POSIXized ISC... $ECHO_C" >&6 +if test -d /etc/conf/kconfig.d && + grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 +then + echo "$as_me:2326: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + ISC=yes # If later tests want to check for ISC. + +cat >>confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + echo "$as_me:2340: result: no" >&5 +echo "${ECHO_T}no" >&6 + ISC= +fi + +echo "$as_me:2345: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line 2353 "configure" +#include "confdefs.h" +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:2402: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2405: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2408: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2411: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:2428: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:2431: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +echo "$as_me:2436: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2442 "configure" +#include "confdefs.h" + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2500: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2503: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2506: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2509: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_const=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:2519: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\EOF +#define const +EOF + +fi + +echo "$as_me:2529: checking for makeflags variable" >&5 +echo $ECHO_N "checking for makeflags variable... $ECHO_C" >&6 +if test "${cf_cv_makeflags+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_makeflags='' + for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' + do + cat >cf_makeflags.tmp <<CF_EOF +SHELL = /bin/sh +all : + @ echo '.$cf_option' +CF_EOF + cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null | sed -e 's,[ ]*$,,'` + case "$cf_result" in + .*k) + cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` + case "$cf_result" in + .*CC=*) cf_cv_makeflags= + ;; + *) cf_cv_makeflags=$cf_option + ;; + esac + break + ;; + .-) ;; + *) echo "given option \"$cf_option\", no match \"$cf_result\"" + ;; + esac + done + rm -f cf_makeflags.tmp + +fi +echo "$as_me:2563: result: $cf_cv_makeflags" >&5 +echo "${ECHO_T}$cf_cv_makeflags" >&6 + +echo "$as_me:2566: checking if filesystem supports mixed-case filenames" >&5 +echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 +if test "${cf_cv_mixedcase+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +if test "$cross_compiling" = yes ; then + case $target_alias in #(vi + *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi + cf_cv_mixedcase=no + ;; + *) + cf_cv_mixedcase=yes + ;; + esac +else + rm -f conftest CONFTEST + echo test >conftest + if test -f CONFTEST ; then + cf_cv_mixedcase=no + else + cf_cv_mixedcase=yes + fi + rm -f conftest CONFTEST +fi + +fi +echo "$as_me:2593: result: $cf_cv_mixedcase" >&5 +echo "${ECHO_T}$cf_cv_mixedcase" >&6 +test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF +#define MIXEDCASE_FILENAMES 1 +EOF + +for ac_prog in exctags ctags +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2603: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CTAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CTAGS"; then + ac_cv_prog_CTAGS="$CTAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CTAGS="$ac_prog" +echo "$as_me:2618: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CTAGS=$ac_cv_prog_CTAGS +if test -n "$CTAGS"; then + echo "$as_me:2626: result: $CTAGS" >&5 +echo "${ECHO_T}$CTAGS" >&6 +else + echo "$as_me:2629: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CTAGS" && break +done + +for ac_prog in exetags etags +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2640: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ETAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ETAGS"; then + ac_cv_prog_ETAGS="$ETAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ETAGS="$ac_prog" +echo "$as_me:2655: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ETAGS=$ac_cv_prog_ETAGS +if test -n "$ETAGS"; then + echo "$as_me:2663: result: $ETAGS" >&5 +echo "${ECHO_T}$ETAGS" >&6 +else + echo "$as_me:2666: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ETAGS" && break +done + +# Extract the first word of "${CTAGS-ctags}", so it can be a program name with args. +set dummy ${CTAGS-ctags}; ac_word=$2 +echo "$as_me:2675: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$MAKE_LOWER_TAGS"; then + ac_cv_prog_MAKE_LOWER_TAGS="$MAKE_LOWER_TAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_MAKE_LOWER_TAGS="yes" +echo "$as_me:2690: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_MAKE_LOWER_TAGS" && ac_cv_prog_MAKE_LOWER_TAGS="no" +fi +fi +MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS +if test -n "$MAKE_LOWER_TAGS"; then + echo "$as_me:2699: result: $MAKE_LOWER_TAGS" >&5 +echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 +else + echo "$as_me:2702: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$cf_cv_mixedcase" = yes ; then + # Extract the first word of "${ETAGS-etags}", so it can be a program name with args. +set dummy ${ETAGS-etags}; ac_word=$2 +echo "$as_me:2709: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$MAKE_UPPER_TAGS"; then + ac_cv_prog_MAKE_UPPER_TAGS="$MAKE_UPPER_TAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_MAKE_UPPER_TAGS="yes" +echo "$as_me:2724: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_MAKE_UPPER_TAGS" && ac_cv_prog_MAKE_UPPER_TAGS="no" +fi +fi +MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS +if test -n "$MAKE_UPPER_TAGS"; then + echo "$as_me:2733: result: $MAKE_UPPER_TAGS" >&5 +echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 +else + echo "$as_me:2736: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +else + MAKE_UPPER_TAGS=no +fi + +if test "$MAKE_UPPER_TAGS" = yes ; then + MAKE_UPPER_TAGS= +else + MAKE_UPPER_TAGS="#" +fi + +if test "$MAKE_LOWER_TAGS" = yes ; then + MAKE_LOWER_TAGS= +else + MAKE_LOWER_TAGS="#" +fi + +echo "$as_me:2756: checking if you want to see long compiling messages" >&5 +echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 + +# Check whether --enable-echo or --disable-echo was given. +if test "${enable_echo+set}" = set; then + enableval="$enable_echo" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + + ECHO_LT='--silent' + ECHO_LD='@echo linking $@;' + RULE_CC='@echo compiling $<' + SHOW_CC='@echo compiling $@' + ECHO_CC='@' + + else + + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' + + fi +else + enableval=yes + + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' + +fi; +echo "$as_me:2790: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:2795: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:2799: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:2808: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:2812: error: $ac_config_sub $ac_cv_build_alias failed." >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:2817: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then + echo "$as_me:2825: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:2834: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:2839: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + system_name="$host_os" +else + system_name="`(uname -s -r) 2>/dev/null`" + if test -z "$system_name" ; then + system_name="`(hostname) 2>/dev/null`" + fi +fi +test -n "$system_name" && cat >>confdefs.h <<EOF +#define SYSTEM_NAME "$system_name" +EOF + +if test "${cf_cv_system_name+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cf_cv_system_name="$system_name" +fi + +test -z "$system_name" && system_name="$cf_cv_system_name" +test -n "$cf_cv_system_name" && echo "$as_me:2864: result: Configuring for $cf_cv_system_name" >&5 +echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 + +if test ".$system_name" != ".$cf_cv_system_name" ; then + echo "$as_me:2868: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 +echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 + { { echo "$as_me:2870: error: \"Please remove config.cache and try again.\"" >&5 +echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} + { (exit 1); exit 1; }; } +fi + +case $cf_cv_system_name in +os2*) + CFLAGS="$CFLAGS -Zmt" + CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__" + CXXFLAGS="$CXXFLAGS -Zmt" + # autoconf's macro sets -Zexe and suffix both, which conflict:w + LDFLAGS="$LDFLAGS -Zmt -Zcrtdll" + ac_cv_exeext=.exe + ;; +esac + +PROG_EXT="$EXEEXT" + +test -n "$PROG_EXT" && cat >>confdefs.h <<EOF +#define PROG_EXT "$PROG_EXT" +EOF + + case $cf_cv_system_name in + os2*) PATH_SEPARATOR=';' ;; + *) PATH_SEPARATOR=':' ;; + esac + + case $cf_cv_system_name in #(vi + OS/2*|os2*) #(vi + LIB_PREFIX='' + ;; + *) LIB_PREFIX='lib' + ;; + esac + +cf_XOPEN_SOURCE=500 +cf_POSIX_C_SOURCE=199506L +cf_xopen_source= + +case $host_os in #(vi +aix[456]*) #(vi + cf_xopen_source="-D_ALL_SOURCE" + ;; +darwin[0-8].*) #(vi + cf_xopen_source="-D_APPLE_C_SOURCE" + ;; +darwin*) #(vi + cf_xopen_source="-D_DARWIN_C_SOURCE" + ;; +freebsd*|dragonfly*) #(vi + # 5.x headers associate + # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L + # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L + cf_POSIX_C_SOURCE=200112L + cf_XOPEN_SOURCE=600 + cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +hpux11*) #(vi + cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" + ;; +hpux*) #(vi + cf_xopen_source="-D_HPUX_SOURCE" + ;; +irix[56].*) #(vi + cf_xopen_source="-D_SGI_SOURCE" + ;; +linux*|gnu*|mint*|k*bsd*-gnu) #(vi + +echo "$as_me:2938: checking if we must define _GNU_SOURCE" >&5 +echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_gnu_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 2945 "configure" +#include "confdefs.h" +#include <sys/types.h> +int +main () +{ + +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2960: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2963: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2966: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2969: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + cat >conftest.$ac_ext <<_ACEOF +#line 2978 "configure" +#include "confdefs.h" +#include <sys/types.h> +int +main () +{ + +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2993: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2996: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2999: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3002: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_gnu_source=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3017: result: $cf_cv_gnu_source" >&5 +echo "${ECHO_T}$cf_cv_gnu_source" >&6 +test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + + ;; +mirbsd*) #(vi + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h> + ;; +netbsd*) #(vi + # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw + ;; +openbsd*) #(vi + # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw + ;; +osf[45]*) #(vi + cf_xopen_source="-D_OSF_SOURCE" + ;; +nto-qnx*) #(vi + cf_xopen_source="-D_QNX_SOURCE" + ;; +sco*) #(vi + # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer + ;; +solaris2.1[0-9]) #(vi + cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +solaris2.[1-9]) #(vi + cf_xopen_source="-D__EXTENSIONS__" + ;; +*) + echo "$as_me:3047: checking if we should define _XOPEN_SOURCE" >&5 +echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_xopen_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 3054 "configure" +#include "confdefs.h" +#include <sys/types.h> +int +main () +{ + +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3069: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3072: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3075: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3078: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + cat >conftest.$ac_ext <<_ACEOF +#line 3087 "configure" +#include "confdefs.h" +#include <sys/types.h> +int +main () +{ + +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3102: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3105: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3108: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3111: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xopen_source=$cf_XOPEN_SOURCE +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3126: result: $cf_cv_xopen_source" >&5 +echo "${ECHO_T}$cf_cv_xopen_source" >&6 + if test "$cf_cv_xopen_source" != no ; then + +CFLAGS=`echo "$CFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + + cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_temp_xopen_source +do +case $cf_fix_cppflags in +no) + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + *$cf_add_cflags) #(vi + ;; + *) #(vi + case $cf_add_cflags in #(vi + -D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + *) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + fi + +cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE + +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" + +cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +echo "$as_me:3233: checking if we should define _POSIX_C_SOURCE" >&5 +echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_posix_c_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +echo "${as_me-configure}:3239: testing if the symbol is already defined go no further ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 3242 "configure" +#include "confdefs.h" +#include <sys/types.h> +int +main () +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3257: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3260: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3263: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3266: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_c_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in #(vi + .[12]??*) #(vi + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + .2) #(vi + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + .*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + cat >conftest.$ac_ext <<_ACEOF +#line 3287 "configure" +#include "confdefs.h" +#include <sys/types.h> +int +main () +{ + +#ifdef _POSIX_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3302: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3305: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3308: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3311: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + +echo "${as_me-configure}:3322: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 + + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" + +echo "${as_me-configure}:3327: testing if the second compile does not leave our definition intact error ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 3330 "configure" +#include "confdefs.h" +#include <sys/types.h> +int +main () +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3345: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3348: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3351: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3354: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3370: result: $cf_cv_posix_c_source" >&5 +echo "${ECHO_T}$cf_cv_posix_c_source" >&6 + +if test "$cf_cv_posix_c_source" != no ; then + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_cv_posix_c_source +do +case $cf_fix_cppflags in +no) + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + *$cf_add_cflags) #(vi + ;; + *) #(vi + case $cf_add_cflags in #(vi + -D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + *) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +fi + + ;; +esac + +if test -n "$cf_xopen_source" ; then + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_xopen_source +do +case $cf_fix_cppflags in +no) + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + *$cf_add_cflags) #(vi + ;; + *) #(vi + case $cf_add_cflags in #(vi + -D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + *) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +fi + +# Check whether --enable-largefile or --disable-largefile was given. +if test "${enable_largefile+set}" = set; then + enableval="$enable_largefile" + +fi; +if test "$enable_largefile" != no; then + + echo "$as_me:3549: checking for special C compiler options needed for large files" >&5 +echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_largefile_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat >conftest.$ac_ext <<_ACEOF +#line 3561 "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + rm -f conftest.$ac_objext +if { (eval echo "$as_me:3581: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3584: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3587: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3590: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext + CC="$CC -n32" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:3600: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3603: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3606: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3609: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_largefile_CC=' -n32'; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +echo "$as_me:3623: result: $ac_cv_sys_largefile_CC" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + echo "$as_me:3629: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_file_offset_bits+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_file_offset_bits=no + cat >conftest.$ac_ext <<_ACEOF +#line 3637 "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3657: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3660: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3663: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3666: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 3675 "configure" +#include "confdefs.h" +#define _FILE_OFFSET_BITS 64 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3696: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3699: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3702: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3705: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_file_offset_bits=64; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:3716: result: $ac_cv_sys_file_offset_bits" >&5 +echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 +if test "$ac_cv_sys_file_offset_bits" != no; then + +cat >>confdefs.h <<EOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +EOF + +fi +rm -f conftest* + echo "$as_me:3726: checking for _LARGE_FILES value needed for large files" >&5 +echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_large_files+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_large_files=no + cat >conftest.$ac_ext <<_ACEOF +#line 3734 "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3754: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3757: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3760: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3763: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 3772 "configure" +#include "confdefs.h" +#define _LARGE_FILES 1 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3793: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3796: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3799: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3802: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_large_files=1; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:3813: result: $ac_cv_sys_large_files" >&5 +echo "${ECHO_T}$ac_cv_sys_large_files" >&6 +if test "$ac_cv_sys_large_files" != no; then + +cat >>confdefs.h <<EOF +#define _LARGE_FILES $ac_cv_sys_large_files +EOF + +fi +rm -f conftest* +fi + + if test "$enable_largefile" != no ; then + echo "$as_me:3826: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_largefile_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_largefile_source=no + cat >conftest.$ac_ext <<_ACEOF +#line 3834 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +return !fseeko; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3846: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3849: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3852: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3855: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 3864 "configure" +#include "confdefs.h" +#define _LARGEFILE_SOURCE 1 +#include <stdio.h> +int +main () +{ +return !fseeko; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3877: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3880: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3883: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3886: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_largefile_source=1; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:3897: result: $ac_cv_sys_largefile_source" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6 +if test "$ac_cv_sys_largefile_source" != no; then + +cat >>confdefs.h <<EOF +#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source +EOF + +fi +rm -f conftest* + +# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug +# in glibc 2.1.3, but that breaks too many other things. +# If you want fseeko and ftello with glibc, upgrade to a fixed glibc. +echo "$as_me:3911: checking for fseeko" >&5 +echo $ECHO_N "checking for fseeko... $ECHO_C" >&6 +if test "${ac_cv_func_fseeko+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 3917 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +return fseeko && fseeko (stdin, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:3929: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:3932: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:3935: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3938: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_fseeko=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_fseeko=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:3948: result: $ac_cv_func_fseeko" >&5 +echo "${ECHO_T}$ac_cv_func_fseeko" >&6 +if test $ac_cv_func_fseeko = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_FSEEKO 1 +EOF + +fi + + # Normally we would collect these definitions in the config.h, + # but (like _XOPEN_SOURCE), some environments rely on having these + # defined before any of the system headers are included. Another + # case comes up with C++, e.g., on AIX the compiler compiles the + # header files by themselves before looking at the body files it is + # told to compile. For ncurses, those header files do not include + # the config.h + test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES " + test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE " + test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits " + + echo "$as_me:3969: checking whether to use struct dirent64" >&5 +echo $ECHO_N "checking whether to use struct dirent64... $ECHO_C" >&6 +if test "${cf_cv_struct_dirent64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 3976 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <dirent.h> + +int +main () +{ + + /* if transitional largefile support is setup, this is true */ + extern struct dirent64 * readdir(DIR *); + struct dirent64 *x = readdir((DIR *)0); + struct dirent *y = readdir((DIR *)0); + int z = x - y; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3997: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4000: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4003: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4006: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_struct_dirent64=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_struct_dirent64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:4017: result: $cf_cv_struct_dirent64" >&5 +echo "${ECHO_T}$cf_cv_struct_dirent64" >&6 + test "$cf_cv_struct_dirent64" = yes && cat >>confdefs.h <<\EOF +#define HAVE_STRUCT_DIRENT64 1 +EOF + + fi + +GCC_VERSION=none +if test "$GCC" = yes ; then + echo "$as_me:4027: checking version of $CC" >&5 +echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 + GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" + test -z "$GCC_VERSION" && GCC_VERSION=unknown + echo "$as_me:4031: result: $GCC_VERSION" >&5 +echo "${ECHO_T}$GCC_VERSION" >&6 +fi + +if ( test "$GCC" = yes || test "$GXX" = yes ) +then +echo "$as_me:4037: checking if you want to check for gcc warnings" >&5 +echo $ECHO_N "checking if you want to check for gcc warnings... $ECHO_C" >&6 + +# Check whether --with-warnings or --without-warnings was given. +if test "${with_warnings+set}" = set; then + withval="$with_warnings" + cf_opt_with_warnings=$withval +else + cf_opt_with_warnings=no +fi; +echo "$as_me:4047: result: $cf_opt_with_warnings" >&5 +echo "${ECHO_T}$cf_opt_with_warnings" >&6 +if test "$cf_opt_with_warnings" != no ; then + +if test "$GCC" = yes +then +cat > conftest.i <<EOF +#ifndef GCC_PRINTF +#define GCC_PRINTF 0 +#endif +#ifndef GCC_SCANF +#define GCC_SCANF 0 +#endif +#ifndef GCC_NORETURN +#define GCC_NORETURN /* nothing */ +#endif +#ifndef GCC_UNUSED +#define GCC_UNUSED /* nothing */ +#endif +EOF +if test "$GCC" = yes +then + { echo "$as_me:4069: checking for $CC __attribute__ directives..." >&5 +echo "$as_me: checking for $CC __attribute__ directives..." >&6;} +cat > conftest.$ac_ext <<EOF +#line 4072 "${as_me-configure}" +#include "confdefs.h" +#include "conftest.h" +#include "conftest.i" +#if GCC_PRINTF +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +#else +#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ +#endif +#if GCC_SCANF +#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) +#else +#define GCC_SCANFLIKE(fmt,var) /*nothing*/ +#endif +extern void wow(char *,...) GCC_SCANFLIKE(1,2); +extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; +extern void foo(void) GCC_NORETURN; +int main(int argc GCC_UNUSED, char *argv[] GCC_UNUSED) { return 0; } +EOF + cf_printf_attribute=no + cf_scanf_attribute=no + for cf_attribute in scanf printf unused noreturn + do + +cf_ATTRIBUTE=`echo "$cf_attribute" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cf_directive="__attribute__(($cf_attribute))" + echo "checking for $CC $cf_directive" 1>&5 + + case $cf_attribute in #(vi + printf) #(vi + cf_printf_attribute=yes + cat >conftest.h <<EOF +#define GCC_$cf_ATTRIBUTE 1 +EOF + ;; + scanf) #(vi + cf_scanf_attribute=yes + cat >conftest.h <<EOF +#define GCC_$cf_ATTRIBUTE 1 +EOF + ;; + *) #(vi + cat >conftest.h <<EOF +#define GCC_$cf_ATTRIBUTE $cf_directive +EOF + ;; + esac + + if { (eval echo "$as_me:4121: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4124: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:4126: result: ... $cf_attribute" >&5 +echo "${ECHO_T}... $cf_attribute" >&6 + cat conftest.h >>confdefs.h + case $cf_attribute in #(vi + printf) #(vi + if test "$cf_printf_attribute" = no ; then + cat >>confdefs.h <<EOF +#define GCC_PRINTFLIKE(fmt,var) /* nothing */ +EOF + else + cat >>confdefs.h <<EOF +#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var))) +EOF + fi + ;; + scanf) #(vi + if test "$cf_scanf_attribute" = no ; then + cat >>confdefs.h <<EOF +#define GCC_SCANFLIKE(fmt,var) /* nothing */ +EOF + else + cat >>confdefs.h <<EOF +#define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var))) +EOF + fi + ;; + esac + fi + done +else + fgrep define conftest.i >>confdefs.h +fi +rm -rf conftest* +fi + +INTEL_COMPILER=no + +if test "$GCC" = yes ; then + case $host_os in + linux*|gnu*) + echo "$as_me:4166: checking if this is really Intel C compiler" >&5 +echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -no-gcc" + cat >conftest.$ac_ext <<_ACEOF +#line 4171 "configure" +#include "confdefs.h" + +int +main () +{ + +#ifdef __INTEL_COMPILER +#else +make an error +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4188: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4191: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4194: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4197: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + INTEL_COMPILER=yes +cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + echo "$as_me:4208: result: $INTEL_COMPILER" >&5 +echo "${ECHO_T}$INTEL_COMPILER" >&6 + ;; + esac +fi + +cat > conftest.$ac_ext <<EOF +#line 4215 "${as_me-configure}" +int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } +EOF + +if test "$INTEL_COMPILER" = yes +then +# The "-wdXXX" options suppress warnings: +# remark #1419: external declaration in primary source file +# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) +# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) +# remark #193: zero used for undefined preprocessing identifier +# remark #593: variable "curs_sb_left_arrow" was set but never used +# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits +# remark #869: parameter "tw" was never referenced +# remark #981: operands are evaluated in unspecified order +# warning #279: controlling expression is constant + + { echo "$as_me:4232: checking for $CC warning options..." >&5 +echo "$as_me: checking for $CC warning options..." >&6;} + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS="-Wall" + for cf_opt in \ + wd1419 \ + wd1683 \ + wd1684 \ + wd193 \ + wd593 \ + wd279 \ + wd810 \ + wd869 \ + wd981 + do + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if { (eval echo "$as_me:4248: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4251: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:4253: result: ... -$cf_opt" >&5 +echo "${ECHO_T}... -$cf_opt" >&6 + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + fi + done + CFLAGS="$cf_save_CFLAGS" + +elif test "$GCC" = yes +then + { echo "$as_me:4262: checking for $CC warning options..." >&5 +echo "$as_me: checking for $CC warning options..." >&6;} + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS= + cf_warn_CONST="" + test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" + for cf_opt in W Wall \ + Wbad-function-cast \ + Wcast-align \ + Wcast-qual \ + Winline \ + Wmissing-declarations \ + Wmissing-prototypes \ + Wnested-externs \ + Wpointer-arith \ + Wshadow \ + Wstrict-prototypes \ + Wundef $cf_warn_CONST + do + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if { (eval echo "$as_me:4282: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4285: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:4287: result: ... -$cf_opt" >&5 +echo "${ECHO_T}... -$cf_opt" >&6 + case $cf_opt in #(vi + Wcast-qual) #(vi + CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES" + ;; + Winline) #(vi + case $GCC_VERSION in + [34].*) + test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 + +echo "${as_me-configure}:4298: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 + + continue;; + esac + ;; + esac + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + fi + done + CFLAGS="$cf_save_CFLAGS" +fi +rm -f conftest* + +fi +fi + +EXTRAOBJS="" +echo "$as_me:4315: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4321 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +_ACEOF +if { (eval echo "$as_me:4329: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4335: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 4357 "configure" +#include "confdefs.h" +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 4375 "configure" +#include "confdefs.h" +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line 4396 "configure" +#include "confdefs.h" +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + $ac_main_return(2); + $ac_main_return (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:4422: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4425: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:4427: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4430: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:4443: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo "$as_me:4453: checking for inline" >&5 +echo $ECHO_N "checking for inline... $ECHO_C" >&6 +if test "${ac_cv_c_inline+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat >conftest.$ac_ext <<_ACEOF +#line 4461 "configure" +#include "confdefs.h" +#ifndef __cplusplus +static $ac_kw int static_foo () {return 0; } +$ac_kw int foo () {return 0; } +#endif + +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4470: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4473: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4476: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4479: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_inline=$ac_kw; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:4490: result: $ac_cv_c_inline" >&5 +echo "${ECHO_T}$ac_cv_c_inline" >&6 +case $ac_cv_c_inline in + inline | yes) ;; + no) +cat >>confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >>confdefs.h <<EOF +#define inline $ac_cv_c_inline +EOF + ;; +esac + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:4511: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4517 "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4523: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4526: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4529: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4532: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:4542: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +echo "$as_me:4552: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4558 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4573: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4576: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4579: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4582: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_off_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:4592: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : +else + +cat >>confdefs.h <<EOF +#define off_t long +EOF + +fi + +echo "$as_me:4604: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4610 "configure" +#include "confdefs.h" +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4625: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4628: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4631: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4634: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_size_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:4644: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<EOF +#define size_t unsigned +EOF + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo "$as_me:4658: checking for working alloca.h" >&5 +echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6 +if test "${ac_cv_working_alloca_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4664 "configure" +#include "confdefs.h" +#include <alloca.h> +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4676: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4679: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4682: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4685: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_working_alloca_h=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_working_alloca_h=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4695: result: $ac_cv_working_alloca_h" >&5 +echo "${ECHO_T}$ac_cv_working_alloca_h" >&6 +if test $ac_cv_working_alloca_h = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo "$as_me:4705: checking for alloca" >&5 +echo $ECHO_N "checking for alloca... $ECHO_C" >&6 +if test "${ac_cv_func_alloca_works+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4711 "configure" +#include "confdefs.h" +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include <malloc.h> +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int +main () +{ +char *p = (char *) alloca (1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4743: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4746: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4749: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4752: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_alloca_works=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_alloca_works=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4762: result: $ac_cv_func_alloca_works" >&5 +echo "${ECHO_T}$ac_cv_func_alloca_works" >&6 + +if test $ac_cv_func_alloca_works = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=alloca.$ac_objext + +cat >>confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + +echo "$as_me:4783: checking whether \`alloca.c' needs Cray hooks" >&5 +echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6 +if test "${ac_cv_os_cray+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4789 "configure" +#include "confdefs.h" +#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "webecray" >/dev/null 2>&1; then + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +echo "$as_me:4807: result: $ac_cv_os_cray" >&5 +echo "${ECHO_T}$ac_cv_os_cray" >&6 +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:4812: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4818 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4849: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4852: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4855: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4858: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4868: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + +cat >>confdefs.h <<EOF +#define CRAY_STACKSEG_END $ac_func +EOF + + break +fi + + done +fi + +echo "$as_me:4882: checking stack direction for C alloca" >&5 +echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6 +if test "${ac_cv_c_stack_direction+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4891 "configure" +#include "confdefs.h" +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main () +{ + $ac_main_return (find_stack_direction () < 0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:4914: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4917: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:4919: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4922: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_stack_direction=1 +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_c_stack_direction=-1 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:4934: result: $ac_cv_c_stack_direction" >&5 +echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 + +cat >>confdefs.h <<EOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +EOF + +fi + +for ac_header in stdlib.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:4946: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4952 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4956: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4962: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:4981: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +for ac_func in getpagesize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:4994: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5000 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5031: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5034: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5037: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5040: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:5050: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +EOF + +fi +done + +echo "$as_me:5060: checking for working mmap" >&5 +echo $ECHO_N "checking for working mmap... $ECHO_C" >&6 +if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat >conftest.$ac_ext <<_ACEOF +#line 5069 "configure" +#include "confdefs.h" +$ac_includes_default +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include <fcntl.h> +#include <sys/mman.h> + +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE +/* Assume that all systems that can run configure have sys/param.h. */ +# if !HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# if HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +int +main () +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + $ac_main_return (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + $ac_main_return (1); + if (write (fd, data, pagesize) != pagesize) + $ac_main_return (1); + close (fd); + + /* Next, try to mmap the file at a fixed address which already has + something else allocated at it. If we can, also make sure that + we see the same garbage. */ + fd = open ("conftest.mmap", O_RDWR); + if (fd < 0) + $ac_main_return (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + $ac_main_return (1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + $ac_main_return (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + $ac_main_return (1); + + /* Finally, make sure that changes to the mapped area do not + percolate back to the file as seen by read(). (This is a bug on + some variants of i386 svr4.0.) */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = (char *) malloc (pagesize); + if (!data3) + $ac_main_return (1); + if (read (fd, data3, pagesize) != pagesize) + $ac_main_return (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + $ac_main_return (1); + close (fd); + $ac_main_return (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:5196: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5199: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:5201: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5204: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_mmap_fixed_mapped=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:5216: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_MMAP 1 +EOF + +fi +rm -f conftest.mmap + + echo "$as_me:5227: checking whether we are using the GNU C Library 2.1 or newer" >&5 +echo $ECHO_N "checking whether we are using the GNU C Library 2.1 or newer... $ECHO_C" >&6 +if test "${ac_cv_gnu_library_2_1+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5233 "configure" +#include "confdefs.h" + +#include <features.h> +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "Lucky GNU user" >/dev/null 2>&1; then + ac_cv_gnu_library_2_1=yes +else + ac_cv_gnu_library_2_1=no +fi +rm -f conftest* + +fi +echo "$as_me:5253: result: $ac_cv_gnu_library_2_1" >&5 +echo "${ECHO_T}$ac_cv_gnu_library_2_1" >&6 + + GLIBC21="$ac_cv_gnu_library_2_1" + +cf_makefile=makefile + +test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'` + +# Allow override of "config.h" definition: +: ${CONFIG_H=config.h} + +if test -z "$VERSION" ; then +if test -f $srcdir/VERSION ; then + VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1` +else + VERSION=unknown +fi +fi + +for ac_header in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ +stdlib.h string.h unistd.h sys/param.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:5277: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5283 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:5287: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5293: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:5312: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +for ac_func in feof_unlocked fgets_unlocked getcwd getegid geteuid \ +getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \ +strdup strtoul tsearch __argz_count __argz_stringify __argz_next +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:5327: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5333 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5364: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5367: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5370: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5373: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:5383: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +EOF + +fi +done + +# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. +if test "${with_libiconv_prefix+set}" = set; then + withval="$with_libiconv_prefix" + + case "$withval" in #(vi + no) #(vi + ;; + yes) #(vi + ;; + *) + +for cf_searchpath in `echo "$withval" | tr $PATH_SEPARATOR ' '`; do + if test -d $cf_searchpath/include; then + +if test -n "$cf_searchpath/include" ; then + for cf_add_incdir in $cf_searchpath/include + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 5431 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5443: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5446: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5449: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5452: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me-configure}:5469: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + fi + done + done +fi + + elif test -d $cf_searchpath/../include ; then + +if test -n "$cf_searchpath/../include" ; then + for cf_add_incdir in $cf_searchpath/../include + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 5510 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5522: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5525: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5528: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5531: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me-configure}:5548: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + fi + done + done +fi + + else +{ { echo "$as_me:5564: error: cannot find libiconv under $withval" >&5 +echo "$as_me: error: cannot find libiconv under $withval" >&2;} + { (exit 1); exit 1; }; } + fi + if test -d $cf_searchpath/lib; then + +if test -n "$cf_searchpath/lib" ; then + for cf_add_libdir in $cf_searchpath/lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me-configure}:5589: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + elif test -d $cf_searchpath ; then + +if test -n "$cf_searchpath" ; then + for cf_add_libdir in $cf_searchpath + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me-configure}:5618: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + else +{ { echo "$as_me:5627: error: cannot find libiconv under $withval" >&5 +echo "$as_me: error: cannot find libiconv under $withval" >&2;} + { (exit 1); exit 1; }; } + fi +done + + ;; + esac + +fi; + + echo "$as_me:5638: checking for iconv" >&5 +echo $ECHO_N "checking for iconv... $ECHO_C" >&6 +if test "${am_cv_func_iconv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these +# will be set on completion of the AC_TRY_LINK below. +cf_cv_header_path_iconv= +cf_cv_library_path_iconv= + +echo "${as_me-configure}:5649: testing Starting FIND_LINKAGE(iconv,) ..." 1>&5 + +cat >conftest.$ac_ext <<_ACEOF +#line 5652 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <iconv.h> + +int +main () +{ + + iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5671: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5674: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5677: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5680: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_find_linkage_iconv=yes + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +cf_save_LIBS="$LIBS" +LIBS="-liconv $cf_save_LIBS" + +cat >conftest.$ac_ext <<_ACEOF +#line 5693 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <iconv.h> + +int +main () +{ + + iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5712: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5715: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5718: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5721: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_find_linkage_iconv=yes + cf_cv_library_file_iconv="-liconv" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_find_linkage_iconv=no + LIBS="$cf_save_LIBS" + + test -n "$verbose" && echo " find linkage for iconv library" 1>&6 + +echo "${as_me-configure}:5736: testing find linkage for iconv library ..." 1>&5 + +echo "${as_me-configure}:5738: testing Searching for headers in FIND_LINKAGE(iconv,) ..." 1>&5 + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_test_CPPFLAGS="$CPPFLAGS" + +cf_search= + +# collect the current set of include-directories from compiler flags +cf_header_path_list="" +if test -n "${CFLAGS}${CPPFLAGS}" ; then + for cf_header_path in $CPPFLAGS $CFLAGS + do + case $cf_header_path in #(vi + -I*) + cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + cf_header_path_list="$cf_header_path_list $cf_header_path" + ;; + esac + done +fi + +# add the variations for the package we are looking for + +cf_search= + +test "/usr" != "$prefix" && \ +test -d "/usr" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /usr" + test -d /usr/include && cf_search="$cf_search /usr/include" + test -d /usr/include/iconv && cf_search="$cf_search /usr/include/iconv" + test -d /usr/include/iconv/include && cf_search="$cf_search /usr/include/iconv/include" + test -d /usr/iconv/include && cf_search="$cf_search /usr/iconv/include" + test -d /usr/iconv/include/iconv && cf_search="$cf_search /usr/iconv/include/iconv" +} + +test "$prefix" != "NONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $prefix" + test -d $prefix/include && cf_search="$cf_search $prefix/include" + test -d $prefix/include/iconv && cf_search="$cf_search $prefix/include/iconv" + test -d $prefix/include/iconv/include && cf_search="$cf_search $prefix/include/iconv/include" + test -d $prefix/iconv/include && cf_search="$cf_search $prefix/iconv/include" + test -d $prefix/iconv/include/iconv && cf_search="$cf_search $prefix/iconv/include/iconv" +} + +test "/usr/local" != "$prefix" && \ +test -d "/usr/local" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /usr/local" + test -d /usr/local/include && cf_search="$cf_search /usr/local/include" + test -d /usr/local/include/iconv && cf_search="$cf_search /usr/local/include/iconv" + test -d /usr/local/include/iconv/include && cf_search="$cf_search /usr/local/include/iconv/include" + test -d /usr/local/iconv/include && cf_search="$cf_search /usr/local/iconv/include" + test -d /usr/local/iconv/include/iconv && cf_search="$cf_search /usr/local/iconv/include/iconv" +} + +test "/opt" != "$prefix" && \ +test -d "/opt" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /opt" + test -d /opt/include && cf_search="$cf_search /opt/include" + test -d /opt/include/iconv && cf_search="$cf_search /opt/include/iconv" + test -d /opt/include/iconv/include && cf_search="$cf_search /opt/include/iconv/include" + test -d /opt/iconv/include && cf_search="$cf_search /opt/iconv/include" + test -d /opt/iconv/include/iconv && cf_search="$cf_search /opt/iconv/include/iconv" +} + +test "$HOME" != "$prefix" && \ +test -d "$HOME" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under $HOME" + test -d $HOME/include && cf_search="$cf_search $HOME/include" + test -d $HOME/include/iconv && cf_search="$cf_search $HOME/include/iconv" + test -d $HOME/include/iconv/include && cf_search="$cf_search $HOME/include/iconv/include" + test -d $HOME/iconv/include && cf_search="$cf_search $HOME/iconv/include" + test -d $HOME/iconv/include/iconv && cf_search="$cf_search $HOME/iconv/include/iconv" +} + +test "$includedir" != NONE && \ +test "$includedir" != "/usr/include" && \ +test -d "$includedir" && { + test -d $includedir && cf_search="$cf_search $includedir" + test -d $includedir/iconv && cf_search="$cf_search $includedir/iconv" +} + +test "$oldincludedir" != NONE && \ +test "$oldincludedir" != "/usr/include" && \ +test -d "$oldincludedir" && { + test -d $oldincludedir && cf_search="$cf_search $oldincludedir" + test -d $oldincludedir/iconv && cf_search="$cf_search $oldincludedir/iconv" +} + +cf_search="$cf_search $cf_header_path_list" + + for cf_cv_header_path_iconv in $cf_search + do + if test -d $cf_cv_header_path_iconv ; then + test -n "$verbose" && echo " ... testing $cf_cv_header_path_iconv" 1>&6 + +echo "${as_me-configure}:5839: testing ... testing $cf_cv_header_path_iconv ..." 1>&5 + + CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_iconv" + cat >conftest.$ac_ext <<_ACEOF +#line 5843 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <iconv.h> + +int +main () +{ + + iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5862: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5865: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5868: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5871: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + test -n "$verbose" && echo " ... found iconv headers in $cf_cv_header_path_iconv" 1>&6 + +echo "${as_me-configure}:5876: testing ... found iconv headers in $cf_cv_header_path_iconv ..." 1>&5 + + cf_cv_find_linkage_iconv=maybe + cf_test_CPPFLAGS="$CPPFLAGS" + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + CPPFLAGS="$cf_save_CPPFLAGS" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + done + + if test "$cf_cv_find_linkage_iconv" = maybe ; then + +echo "${as_me-configure}:5894: testing Searching for iconv library in FIND_LINKAGE(iconv,) ..." 1>&5 + + cf_save_LIBS="$LIBS" + cf_save_LDFLAGS="$LDFLAGS" + + if test "$cf_cv_find_linkage_iconv" != yes ; then + +cf_search= +cf_library_path_list="" +if test -n "${LDFLAGS}${LIBS}" ; then + for cf_library_path in $LDFLAGS $LIBS + do + case $cf_library_path in #(vi + -L*) + cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` + +test "$cf_library_path" != "NONE" && \ +test -d "$cf_library_path" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" + test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" + test -d $cf_library_path/lib/iconv && cf_search="$cf_search $cf_library_path/lib/iconv" + test -d $cf_library_path/lib/iconv/lib && cf_search="$cf_search $cf_library_path/lib/iconv/lib" + test -d $cf_library_path/iconv/lib && cf_search="$cf_search $cf_library_path/iconv/lib" + test -d $cf_library_path/iconv/lib/iconv && cf_search="$cf_search $cf_library_path/iconv/lib/iconv" +} + + cf_library_path_list="$cf_library_path_list $cf_search" + ;; + esac + done +fi + +cf_search= + +test "/usr" != "$prefix" && \ +test -d "/usr" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /usr" + test -d /usr/lib && cf_search="$cf_search /usr/lib" + test -d /usr/lib/iconv && cf_search="$cf_search /usr/lib/iconv" + test -d /usr/lib/iconv/lib && cf_search="$cf_search /usr/lib/iconv/lib" + test -d /usr/iconv/lib && cf_search="$cf_search /usr/iconv/lib" + test -d /usr/iconv/lib/iconv && cf_search="$cf_search /usr/iconv/lib/iconv" +} + +test "$prefix" != "NONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $prefix" + test -d $prefix/lib && cf_search="$cf_search $prefix/lib" + test -d $prefix/lib/iconv && cf_search="$cf_search $prefix/lib/iconv" + test -d $prefix/lib/iconv/lib && cf_search="$cf_search $prefix/lib/iconv/lib" + test -d $prefix/iconv/lib && cf_search="$cf_search $prefix/iconv/lib" + test -d $prefix/iconv/lib/iconv && cf_search="$cf_search $prefix/iconv/lib/iconv" +} + +test "/usr/local" != "$prefix" && \ +test -d "/usr/local" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" + test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" + test -d /usr/local/lib/iconv && cf_search="$cf_search /usr/local/lib/iconv" + test -d /usr/local/lib/iconv/lib && cf_search="$cf_search /usr/local/lib/iconv/lib" + test -d /usr/local/iconv/lib && cf_search="$cf_search /usr/local/iconv/lib" + test -d /usr/local/iconv/lib/iconv && cf_search="$cf_search /usr/local/iconv/lib/iconv" +} + +test "/opt" != "$prefix" && \ +test -d "/opt" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /opt" + test -d /opt/lib && cf_search="$cf_search /opt/lib" + test -d /opt/lib/iconv && cf_search="$cf_search /opt/lib/iconv" + test -d /opt/lib/iconv/lib && cf_search="$cf_search /opt/lib/iconv/lib" + test -d /opt/iconv/lib && cf_search="$cf_search /opt/iconv/lib" + test -d /opt/iconv/lib/iconv && cf_search="$cf_search /opt/iconv/lib/iconv" +} + +test "$HOME" != "$prefix" && \ +test -d "$HOME" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under $HOME" + test -d $HOME/lib && cf_search="$cf_search $HOME/lib" + test -d $HOME/lib/iconv && cf_search="$cf_search $HOME/lib/iconv" + test -d $HOME/lib/iconv/lib && cf_search="$cf_search $HOME/lib/iconv/lib" + test -d $HOME/iconv/lib && cf_search="$cf_search $HOME/iconv/lib" + test -d $HOME/iconv/lib/iconv && cf_search="$cf_search $HOME/iconv/lib/iconv" +} + +cf_search="$cf_library_path_list $cf_search" + + for cf_cv_library_path_iconv in $cf_search + do + if test -d $cf_cv_library_path_iconv ; then + test -n "$verbose" && echo " ... testing $cf_cv_library_path_iconv" 1>&6 + +echo "${as_me-configure}:5991: testing ... testing $cf_cv_library_path_iconv ..." 1>&5 + + CPPFLAGS="$cf_test_CPPFLAGS" + LIBS="-liconv $cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_iconv" + cat >conftest.$ac_ext <<_ACEOF +#line 5997 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <iconv.h> + +int +main () +{ + + iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6016: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6019: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6022: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6025: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + test -n "$verbose" && echo " ... found iconv library in $cf_cv_library_path_iconv" 1>&6 + +echo "${as_me-configure}:6030: testing ... found iconv library in $cf_cv_library_path_iconv ..." 1>&5 + + cf_cv_find_linkage_iconv=yes + cf_cv_library_file_iconv="-liconv" + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS" + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + fi + done + LIBS="$cf_save_LIBS" + CPPFLAGS="$cf_save_CPPFLAGS" + LDFLAGS="$cf_save_LDFLAGS" + fi + + else + cf_cv_find_linkage_iconv=no + fi + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +if test "$cf_cv_find_linkage_iconv" = yes ; then +am_cv_func_iconv=yes +else +am_cv_func_iconv="no, consider installing GNU libiconv" +fi + +fi +echo "$as_me:6069: result: $am_cv_func_iconv" >&5 +echo "${ECHO_T}$am_cv_func_iconv" >&6 + + if test "$am_cv_func_iconv" = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_ICONV 1 +EOF + + echo "$as_me:6078: checking if the declaration of iconv() needs const." >&5 +echo $ECHO_N "checking if the declaration of iconv() needs const.... $ECHO_C" >&6 +if test "${am_cv_proto_iconv_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 6085 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <iconv.h> + +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6110: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6113: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6116: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6119: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_proto_iconv_const=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +am_cv_proto_iconv_const=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:6129: result: $am_cv_proto_iconv_const" >&5 +echo "${ECHO_T}$am_cv_proto_iconv_const" >&6 + + if test "$am_cv_proto_iconv_const" = yes ; then + am_cv_proto_iconv_arg1="const" + else + am_cv_proto_iconv_arg1="" + fi + +cat >>confdefs.h <<EOF +#define ICONV_CONST $am_cv_proto_iconv_arg1 +EOF + + fi + + LIBICONV= + if test "$cf_cv_find_linkage_iconv" = yes; then + +if test -n "$cf_cv_header_path_iconv" ; then + for cf_add_incdir in $cf_cv_header_path_iconv + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 6171 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6183: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6186: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6189: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6192: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me-configure}:6209: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + fi + done + done +fi + + if test -n "$cf_cv_library_file_iconv" ; then + LIBICONV="-liconv" + +if test -n "$cf_cv_library_path_iconv" ; then + for cf_add_libdir in $cf_cv_library_path_iconv + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me-configure}:6246: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + fi + fi + + echo "$as_me:6257: checking for nl_langinfo and CODESET" >&5 +echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 +if test "${am_cv_langinfo_codeset+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6263 "configure" +#include "confdefs.h" +#include <langinfo.h> +int +main () +{ +char* cs = nl_langinfo(CODESET); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6275: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6278: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6281: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6284: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_langinfo_codeset=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +am_cv_langinfo_codeset=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:6295: result: $am_cv_langinfo_codeset" >&5 +echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 + if test $am_cv_langinfo_codeset = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LANGINFO_CODESET 1 +EOF + + fi + + if test $ac_cv_header_locale_h = yes; then + echo "$as_me:6306: checking for LC_MESSAGES" >&5 +echo $ECHO_N "checking for LC_MESSAGES... $ECHO_C" >&6 +if test "${am_cv_val_LC_MESSAGES+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6312 "configure" +#include "confdefs.h" +#include <locale.h> +int +main () +{ +return LC_MESSAGES + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6324: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6327: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6330: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6333: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_val_LC_MESSAGES=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +am_cv_val_LC_MESSAGES=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:6343: result: $am_cv_val_LC_MESSAGES" >&5 +echo "${ECHO_T}$am_cv_val_LC_MESSAGES" >&6 + if test $am_cv_val_LC_MESSAGES = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LC_MESSAGES 1 +EOF + + fi + fi + echo "$as_me:6353: checking whether NLS is requested" >&5 +echo $ECHO_N "checking whether NLS is requested... $ECHO_C" >&6 + +# Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=no +fi; + echo "$as_me:6363: result: $USE_NLS" >&5 +echo "${ECHO_T}$USE_NLS" >&6 + + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + INTLLIBS= + + if test "$USE_NLS" = "yes"; then + +cat >>confdefs.h <<\EOF +#define ENABLE_NLS 1 +EOF + + echo "$as_me:6376: checking whether included gettext is requested" >&5 +echo $ECHO_N "checking whether included gettext is requested... $ECHO_C" >&6 + +# Check whether --with-included-gettext or --without-included-gettext was given. +if test "${with_included_gettext+set}" = set; then + withval="$with_included_gettext" + nls_cv_force_use_gnu_gettext=$withval +else + nls_cv_force_use_gnu_gettext=no +fi; + echo "$as_me:6386: result: $nls_cv_force_use_gnu_gettext" >&5 +echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + CATOBJEXT=NONE + + cf_save_LIBS_1="$LIBS" + LIBS="$LIBICONV $LIBS" + echo "$as_me:6395: checking for libintl.h and gettext()" >&5 +echo $ECHO_N "checking for libintl.h and gettext()... $ECHO_C" >&6 +if test "${cf_cv_func_gettext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these +# will be set on completion of the AC_TRY_LINK below. +cf_cv_header_path_intl= +cf_cv_library_path_intl= + +echo "${as_me-configure}:6406: testing Starting FIND_LINKAGE(intl,) ..." 1>&5 + +cat >conftest.$ac_ext <<_ACEOF +#line 6409 "configure" +#include "confdefs.h" + +#include <libintl.h> +extern int _nl_msg_cat_cntr; + +int +main () +{ + + bindtextdomain ("", ""); + return (int) gettext ("") + + + _nl_msg_cat_cntr + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6429: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6432: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6435: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6438: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_find_linkage_intl=yes + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +cf_save_LIBS="$LIBS" +LIBS="-lintl $cf_save_LIBS" + +cat >conftest.$ac_ext <<_ACEOF +#line 6451 "configure" +#include "confdefs.h" + +#include <libintl.h> +extern int _nl_msg_cat_cntr; + +int +main () +{ + + bindtextdomain ("", ""); + return (int) gettext ("") + + + _nl_msg_cat_cntr + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6471: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6474: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6477: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6480: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_find_linkage_intl=yes + cf_cv_library_file_intl="-lintl" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_find_linkage_intl=no + LIBS="$cf_save_LIBS" + + test -n "$verbose" && echo " find linkage for intl library" 1>&6 + +echo "${as_me-configure}:6495: testing find linkage for intl library ..." 1>&5 + +echo "${as_me-configure}:6497: testing Searching for headers in FIND_LINKAGE(intl,) ..." 1>&5 + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_test_CPPFLAGS="$CPPFLAGS" + +cf_search= + +# collect the current set of include-directories from compiler flags +cf_header_path_list="" +if test -n "${CFLAGS}${CPPFLAGS}" ; then + for cf_header_path in $CPPFLAGS $CFLAGS + do + case $cf_header_path in #(vi + -I*) + cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + cf_header_path_list="$cf_header_path_list $cf_header_path" + ;; + esac + done +fi + +# add the variations for the package we are looking for + +cf_search= + +test "/usr" != "$prefix" && \ +test -d "/usr" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /usr" + test -d /usr/include && cf_search="$cf_search /usr/include" + test -d /usr/include/intl && cf_search="$cf_search /usr/include/intl" + test -d /usr/include/intl/include && cf_search="$cf_search /usr/include/intl/include" + test -d /usr/intl/include && cf_search="$cf_search /usr/intl/include" + test -d /usr/intl/include/intl && cf_search="$cf_search /usr/intl/include/intl" +} + +test "$prefix" != "NONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $prefix" + test -d $prefix/include && cf_search="$cf_search $prefix/include" + test -d $prefix/include/intl && cf_search="$cf_search $prefix/include/intl" + test -d $prefix/include/intl/include && cf_search="$cf_search $prefix/include/intl/include" + test -d $prefix/intl/include && cf_search="$cf_search $prefix/intl/include" + test -d $prefix/intl/include/intl && cf_search="$cf_search $prefix/intl/include/intl" +} + +test "/usr/local" != "$prefix" && \ +test -d "/usr/local" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /usr/local" + test -d /usr/local/include && cf_search="$cf_search /usr/local/include" + test -d /usr/local/include/intl && cf_search="$cf_search /usr/local/include/intl" + test -d /usr/local/include/intl/include && cf_search="$cf_search /usr/local/include/intl/include" + test -d /usr/local/intl/include && cf_search="$cf_search /usr/local/intl/include" + test -d /usr/local/intl/include/intl && cf_search="$cf_search /usr/local/intl/include/intl" +} + +test "/opt" != "$prefix" && \ +test -d "/opt" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /opt" + test -d /opt/include && cf_search="$cf_search /opt/include" + test -d /opt/include/intl && cf_search="$cf_search /opt/include/intl" + test -d /opt/include/intl/include && cf_search="$cf_search /opt/include/intl/include" + test -d /opt/intl/include && cf_search="$cf_search /opt/intl/include" + test -d /opt/intl/include/intl && cf_search="$cf_search /opt/intl/include/intl" +} + +test "$HOME" != "$prefix" && \ +test -d "$HOME" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under $HOME" + test -d $HOME/include && cf_search="$cf_search $HOME/include" + test -d $HOME/include/intl && cf_search="$cf_search $HOME/include/intl" + test -d $HOME/include/intl/include && cf_search="$cf_search $HOME/include/intl/include" + test -d $HOME/intl/include && cf_search="$cf_search $HOME/intl/include" + test -d $HOME/intl/include/intl && cf_search="$cf_search $HOME/intl/include/intl" +} + +test "$includedir" != NONE && \ +test "$includedir" != "/usr/include" && \ +test -d "$includedir" && { + test -d $includedir && cf_search="$cf_search $includedir" + test -d $includedir/intl && cf_search="$cf_search $includedir/intl" +} + +test "$oldincludedir" != NONE && \ +test "$oldincludedir" != "/usr/include" && \ +test -d "$oldincludedir" && { + test -d $oldincludedir && cf_search="$cf_search $oldincludedir" + test -d $oldincludedir/intl && cf_search="$cf_search $oldincludedir/intl" +} + +cf_search="$cf_search $cf_header_path_list" + + for cf_cv_header_path_intl in $cf_search + do + if test -d $cf_cv_header_path_intl ; then + test -n "$verbose" && echo " ... testing $cf_cv_header_path_intl" 1>&6 + +echo "${as_me-configure}:6598: testing ... testing $cf_cv_header_path_intl ..." 1>&5 + + CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_intl" + cat >conftest.$ac_ext <<_ACEOF +#line 6602 "configure" +#include "confdefs.h" + +#include <libintl.h> +extern int _nl_msg_cat_cntr; + +int +main () +{ + + bindtextdomain ("", ""); + return (int) gettext ("") + + + _nl_msg_cat_cntr + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6622: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6625: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6628: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6631: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + test -n "$verbose" && echo " ... found intl headers in $cf_cv_header_path_intl" 1>&6 + +echo "${as_me-configure}:6636: testing ... found intl headers in $cf_cv_header_path_intl ..." 1>&5 + + cf_cv_find_linkage_intl=maybe + cf_test_CPPFLAGS="$CPPFLAGS" + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + CPPFLAGS="$cf_save_CPPFLAGS" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + done + + if test "$cf_cv_find_linkage_intl" = maybe ; then + +echo "${as_me-configure}:6654: testing Searching for intl library in FIND_LINKAGE(intl,) ..." 1>&5 + + cf_save_LIBS="$LIBS" + cf_save_LDFLAGS="$LDFLAGS" + + if test "$cf_cv_find_linkage_intl" != yes ; then + +cf_search= +cf_library_path_list="" +if test -n "${LDFLAGS}${LIBS}" ; then + for cf_library_path in $LDFLAGS $LIBS + do + case $cf_library_path in #(vi + -L*) + cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` + +test "$cf_library_path" != "NONE" && \ +test -d "$cf_library_path" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" + test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" + test -d $cf_library_path/lib/intl && cf_search="$cf_search $cf_library_path/lib/intl" + test -d $cf_library_path/lib/intl/lib && cf_search="$cf_search $cf_library_path/lib/intl/lib" + test -d $cf_library_path/intl/lib && cf_search="$cf_search $cf_library_path/intl/lib" + test -d $cf_library_path/intl/lib/intl && cf_search="$cf_search $cf_library_path/intl/lib/intl" +} + + cf_library_path_list="$cf_library_path_list $cf_search" + ;; + esac + done +fi + +cf_search= + +test "/usr" != "$prefix" && \ +test -d "/usr" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /usr" + test -d /usr/lib && cf_search="$cf_search /usr/lib" + test -d /usr/lib/intl && cf_search="$cf_search /usr/lib/intl" + test -d /usr/lib/intl/lib && cf_search="$cf_search /usr/lib/intl/lib" + test -d /usr/intl/lib && cf_search="$cf_search /usr/intl/lib" + test -d /usr/intl/lib/intl && cf_search="$cf_search /usr/intl/lib/intl" +} + +test "$prefix" != "NONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $prefix" + test -d $prefix/lib && cf_search="$cf_search $prefix/lib" + test -d $prefix/lib/intl && cf_search="$cf_search $prefix/lib/intl" + test -d $prefix/lib/intl/lib && cf_search="$cf_search $prefix/lib/intl/lib" + test -d $prefix/intl/lib && cf_search="$cf_search $prefix/intl/lib" + test -d $prefix/intl/lib/intl && cf_search="$cf_search $prefix/intl/lib/intl" +} + +test "/usr/local" != "$prefix" && \ +test -d "/usr/local" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" + test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" + test -d /usr/local/lib/intl && cf_search="$cf_search /usr/local/lib/intl" + test -d /usr/local/lib/intl/lib && cf_search="$cf_search /usr/local/lib/intl/lib" + test -d /usr/local/intl/lib && cf_search="$cf_search /usr/local/intl/lib" + test -d /usr/local/intl/lib/intl && cf_search="$cf_search /usr/local/intl/lib/intl" +} + +test "/opt" != "$prefix" && \ +test -d "/opt" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /opt" + test -d /opt/lib && cf_search="$cf_search /opt/lib" + test -d /opt/lib/intl && cf_search="$cf_search /opt/lib/intl" + test -d /opt/lib/intl/lib && cf_search="$cf_search /opt/lib/intl/lib" + test -d /opt/intl/lib && cf_search="$cf_search /opt/intl/lib" + test -d /opt/intl/lib/intl && cf_search="$cf_search /opt/intl/lib/intl" +} + +test "$HOME" != "$prefix" && \ +test -d "$HOME" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under $HOME" + test -d $HOME/lib && cf_search="$cf_search $HOME/lib" + test -d $HOME/lib/intl && cf_search="$cf_search $HOME/lib/intl" + test -d $HOME/lib/intl/lib && cf_search="$cf_search $HOME/lib/intl/lib" + test -d $HOME/intl/lib && cf_search="$cf_search $HOME/intl/lib" + test -d $HOME/intl/lib/intl && cf_search="$cf_search $HOME/intl/lib/intl" +} + +cf_search="$cf_library_path_list $cf_search" + + for cf_cv_library_path_intl in $cf_search + do + if test -d $cf_cv_library_path_intl ; then + test -n "$verbose" && echo " ... testing $cf_cv_library_path_intl" 1>&6 + +echo "${as_me-configure}:6751: testing ... testing $cf_cv_library_path_intl ..." 1>&5 + + CPPFLAGS="$cf_test_CPPFLAGS" + LIBS="-lintl $cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_intl" + cat >conftest.$ac_ext <<_ACEOF +#line 6757 "configure" +#include "confdefs.h" + +#include <libintl.h> +extern int _nl_msg_cat_cntr; + +int +main () +{ + + bindtextdomain ("", ""); + return (int) gettext ("") + + + _nl_msg_cat_cntr + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6777: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6780: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6783: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6786: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + test -n "$verbose" && echo " ... found intl library in $cf_cv_library_path_intl" 1>&6 + +echo "${as_me-configure}:6791: testing ... found intl library in $cf_cv_library_path_intl ..." 1>&5 + + cf_cv_find_linkage_intl=yes + cf_cv_library_file_intl="-lintl" + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS" + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + fi + done + LIBS="$cf_save_LIBS" + CPPFLAGS="$cf_save_CPPFLAGS" + LDFLAGS="$cf_save_LDFLAGS" + fi + + else + cf_cv_find_linkage_intl=no + fi + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +if test "$cf_cv_find_linkage_intl" = yes ; then +cf_cv_func_gettext=yes +else +cf_cv_func_gettext=no +fi + +fi +echo "$as_me:6830: result: $cf_cv_func_gettext" >&5 +echo "${ECHO_T}$cf_cv_func_gettext" >&6 + LIBS="$cf_save_LIBS_1" + + if test "$cf_cv_func_gettext" = yes ; then + cat >>confdefs.h <<\EOF +#define HAVE_LIBINTL_H 1 +EOF + + if test "$PACKAGE" != gettext; then + +cat >>confdefs.h <<\EOF +#define HAVE_GETTEXT 1 +EOF + +if test -n "$cf_cv_header_path_intl" ; then + for cf_add_incdir in $cf_cv_header_path_intl + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 6869 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6881: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6884: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6887: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6890: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me-configure}:6907: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + fi + done + done +fi + + if test -n "$cf_cv_library_file_intl" ; then + INTLLIBS="$cf_cv_library_file_intl $LIBICONV" + +if test -n "$cf_cv_library_path_intl" ; then + for cf_add_libdir in $cf_cv_library_path_intl + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me-configure}:6944: testing adding $cf_add_libdir to library-path ..." 1>&5 + + INTLLIBS="-L$cf_add_libdir $INTLLIBS" + fi + fi + done +fi + + fi + + gt_save_LIBS="$LIBS" + LIBS="$LIBS $INTLLIBS" + +for ac_func in dcgettext +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:6960: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6966 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6997: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7000: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:7003: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7006: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:7016: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +EOF + +fi +done + + LIBS="$gt_save_LIBS" + + # Extract the first word of "msgfmt", so it can be a program name with args. + +set dummy msgfmt; ac_word=$2 +echo "$as_me:7031: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGFMT" in + [\\/]*|?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word$ac_exeext; then + if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exeext" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + echo "$as_me:7058: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 +else + echo "$as_me:7061: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo "$as_me:7067: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + echo "$as_me:7084: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT + +if test -n "$GMSGFMT"; then + echo "$as_me:7096: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 +else + echo "$as_me:7099: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. + +set dummy xgettext; ac_word=$2 +echo "$as_me:7106: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$XGETTEXT" in + [\\/]*|?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word$ac_exeext; then + if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exeext" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + echo "$as_me:7133: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 +else + echo "$as_me:7136: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CATOBJEXT=.gmo + fi + fi + + if test "$CATOBJEXT" = "NONE"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + if test ! -d $srcdir/intl ; then + { { echo "$as_me:7151: error: no NLS library is packaged with this application" >&5 +echo "$as_me: error: no NLS library is packaged with this application" >&2;} + { (exit 1); exit 1; }; } + fi + INTLOBJS="\$(GETTOBJS)" + # Extract the first word of "msgfmt", so it can be a program name with args. + +set dummy msgfmt; ac_word=$2 +echo "$as_me:7159: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_MSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$MSGFMT" in + [\\/]*|?:[\\/]*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word$ac_exeext; then + if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exeext" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test "$MSGFMT" != ":"; then + echo "$as_me:7186: result: $MSGFMT" >&5 +echo "${ECHO_T}$MSGFMT" >&6 +else + echo "$as_me:7189: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo "$as_me:7195: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GMSGFMT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GMSGFMT in + [\\/]* | ?:[\\/]*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + echo "$as_me:7212: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT=$ac_cv_path_GMSGFMT + +if test -n "$GMSGFMT"; then + echo "$as_me:7224: result: $GMSGFMT" >&5 +echo "${ECHO_T}$GMSGFMT" >&6 +else + echo "$as_me:7227: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. + +set dummy xgettext; ac_word=$2 +echo "$as_me:7234: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XGETTEXT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case "$XGETTEXT" in + [\\/]*|?:[\\/]*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word$ac_exeext; then + if $ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exeext" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test "$XGETTEXT" != ":"; then + echo "$as_me:7261: result: $XGETTEXT" >&5 +echo "${ECHO_T}$XGETTEXT" >&6 +else + echo "$as_me:7264: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INTLLIBS="\$(top_builddir)/intl/libintl.a $LIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + if test "$GMSGFMT" != ":"; then + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then + : ; + else + echo "$as_me:7279: result: found msgfmt program is not GNU msgfmt; ignore it" >&5 +echo "${ECHO_T}found msgfmt program is not GNU msgfmt; ignore it" >&6 + GMSGFMT=":" + fi + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then + : ; + else + echo "$as_me:7289: result: found xgettext program is not GNU xgettext; ignore it" >&5 +echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 + XGETTEXT=":" + fi + fi + + POSUB=po + fi + + ac_config_commands="$ac_config_commands default-1" + + if test "$PACKAGE" = gettext; then + BUILD_INCLUDED_LIBINTL=yes + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + for ac_prog in bison +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:7309: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_INTLBISON+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$INTLBISON"; then + ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_INTLBISON="$ac_prog" +echo "$as_me:7324: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +INTLBISON=$ac_cv_prog_INTLBISON +if test -n "$INTLBISON"; then + echo "$as_me:7332: result: $INTLBISON" >&5 +echo "${ECHO_T}$INTLBISON" >&6 +else + echo "$as_me:7335: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$INTLBISON" && break +done + + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + echo "$as_me:7345: checking version of bison" >&5 +echo $ECHO_N "checking version of bison... $ECHO_C" >&6 + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + echo "$as_me:7354: result: $ac_prog_version" >&5 +echo "${ECHO_T}$ac_prog_version" >&6 + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi + fi + + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + nls_cv_header_intl= + nls_cv_header_libgt= + + DATADIRNAME=share + + INSTOBJEXT=.mo + + GENCAT=gencat + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + echo "$as_me:7380: checking for catalogs to be installed" >&5 +echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 + NEW_LINGUAS= + for presentlang in $ALL_LINGUAS; do + useit=no + for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + NEW_LINGUAS="$NEW_LINGUAS $presentlang" + fi + done + LINGUAS=$NEW_LINGUAS + echo "$as_me:7400: result: $LINGUAS" >&5 +echo "${ECHO_T}$LINGUAS" >&6 + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkdirs.sh" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkdirs.sh" + fi + if test -n "$GNUSYSTEM_AUX_DIR" ; then + if test -e "${GNUSYSTEM_AUX_DIR}/mkinstalldirs"; then + MKINSTALLDIRS="${GNUSYSTEM_AUX_DIR}/mkinstalldirs" + fi + fi + + INTL_LIBTOOL_SUFFIX_PREFIX= + +INTLDIR_MAKE= +MSG_DIR_MAKE= +SUB_MAKEFILE= + +cf_makefile=makefile + +use_our_messages=no +if test "$USE_NLS" = yes ; then +if test -d $srcdir/po ; then +echo "$as_me:7433: checking if we should use included message-library" >&5 +echo $ECHO_N "checking if we should use included message-library... $ECHO_C" >&6 + +# Check whether --enable-included-msgs or --disable-included-msgs was given. +if test "${enable_included_msgs+set}" = set; then + enableval="$enable_included_msgs" + use_our_messages=$enableval +else + use_our_messages=yes +fi; +fi +echo "$as_me:7444: result: $use_our_messages" >&5 +echo "${ECHO_T}$use_our_messages" >&6 +fi + +MSG_DIR_MAKE="#" +if test "$use_our_messages" = yes +then + SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn" + MSG_DIR_MAKE= +fi + +if test "$USE_INCLUDED_LIBINTL" = yes ; then + if test "$nls_cv_force_use_gnu_gettext" = yes ; then + : + elif test "$nls_cv_use_gnu_gettext" = yes ; then + : + else + INTLDIR_MAKE="#" + fi + if test -z "$INTLDIR_MAKE"; then + cat >>confdefs.h <<\EOF +#define HAVE_LIBGETTEXT_H 1 +EOF + + for cf_makefile in \ + $srcdir/intl/Makefile.in \ + $srcdir/intl/makefile.in + do + if test -f "$cf_makefile" ; then + SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}" + break + fi + done + fi +else + INTLDIR_MAKE="#" + if test "$USE_NLS" = yes ; then + +for ac_header in libintl.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:7485: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7491 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:7495: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:7501: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:7520: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + + fi +fi + +if test -z "$INTLDIR_MAKE" ; then + CPPFLAGS="$CPPFLAGS -I../intl" +fi + +if test "$BUILD_INCLUDED_LIBINTL" = yes ; then + GT_YES="#" + GT_NO= +else + GT_YES= + GT_NO="#" +fi + +if test "$USE_INCLUDED_LIBINTL" = yes ; then + if test "$nls_cv_force_use_gnu_gettext" = yes ; then + cat >>confdefs.h <<\EOF +#define HAVE_GETTEXT 1 +EOF + + elif test "$nls_cv_use_gnu_gettext" = yes ; then + cat >>confdefs.h <<\EOF +#define HAVE_GETTEXT 1 +EOF + + fi + if test -n "$nls_cv_header_intl" ; then + cat >>confdefs.h <<\EOF +#define HAVE_LIBINTL_H 1 +EOF + + fi +fi + +echo "$as_me:7565: checking if -lm needed for math functions" >&5 +echo $ECHO_N "checking if -lm needed for math functions... $ECHO_C" >&6 +if test "${cf_cv_need_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 7572 "configure" +#include "confdefs.h" + + #include <stdio.h> + #include <math.h> + +int +main () +{ +double x = rand(); printf("result = %g\n", sqrt(x)) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:7587: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7590: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:7593: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7596: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_need_libm=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_need_libm=yes +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:7606: result: $cf_cv_need_libm" >&5 +echo "${ECHO_T}$cf_cv_need_libm" >&6 +if test "$cf_cv_need_libm" = yes +then + + LIBS="-lm $LIBS" + +fi + +echo "$as_me:7615: checking if you want to use dmalloc for testing" >&5 +echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 + +# Check whether --with-dmalloc or --without-dmalloc was given. +if test "${with_dmalloc+set}" = set; then + withval="$with_dmalloc" + cat >>confdefs.h <<\EOF +#define USE_DMALLOC 1 +EOF + + : ${with_cflags:=-g} + : ${with_no_leaks:=yes} + with_dmalloc=yes +else + with_dmalloc= +fi; +echo "$as_me:7631: result: ${with_dmalloc:-no}" >&5 +echo "${ECHO_T}${with_dmalloc:-no}" >&6 + +case .$with_cflags in #(vi +.*-g*) + case .$CFLAGS in #(vi + .*-g*) #(vi + ;; + *) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -g +do +case $cf_fix_cppflags in +no) + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + *$cf_add_cflags) #(vi + ;; + *) #(vi + case $cf_add_cflags in #(vi + -D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + *) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + ;; + esac + ;; +esac + +if test "$with_dmalloc" = yes ; then + echo "$as_me:7725: checking for dmalloc.h" >&5 +echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 +if test "${ac_cv_header_dmalloc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7731 "configure" +#include "confdefs.h" +#include <dmalloc.h> +_ACEOF +if { (eval echo "$as_me:7735: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:7741: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_dmalloc_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_dmalloc_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:7760: result: $ac_cv_header_dmalloc_h" >&5 +echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 +if test $ac_cv_header_dmalloc_h = yes; then + +echo "$as_me:7764: checking for dmalloc_debug in -ldmalloc" >&5 +echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 +if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldmalloc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 7772 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dmalloc_debug (); +int +main () +{ +dmalloc_debug (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:7791: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7794: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:7797: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7800: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dmalloc_dmalloc_debug=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dmalloc_dmalloc_debug=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:7811: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 +if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBDMALLOC 1 +EOF + + LIBS="-ldmalloc $LIBS" + +fi + +fi + +fi + +echo "$as_me:7826: checking if you want to use dbmalloc for testing" >&5 +echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 + +# Check whether --with-dbmalloc or --without-dbmalloc was given. +if test "${with_dbmalloc+set}" = set; then + withval="$with_dbmalloc" + cat >>confdefs.h <<\EOF +#define USE_DBMALLOC 1 +EOF + + : ${with_cflags:=-g} + : ${with_no_leaks:=yes} + with_dbmalloc=yes +else + with_dbmalloc= +fi; +echo "$as_me:7842: result: ${with_dbmalloc:-no}" >&5 +echo "${ECHO_T}${with_dbmalloc:-no}" >&6 + +case .$with_cflags in #(vi +.*-g*) + case .$CFLAGS in #(vi + .*-g*) #(vi + ;; + *) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -g +do +case $cf_fix_cppflags in +no) + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + *$cf_add_cflags) #(vi + ;; + *) #(vi + case $cf_add_cflags in #(vi + -D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + *) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + ;; + esac + ;; +esac + +if test "$with_dbmalloc" = yes ; then + echo "$as_me:7936: checking for dbmalloc.h" >&5 +echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 +if test "${ac_cv_header_dbmalloc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7942 "configure" +#include "confdefs.h" +#include <dbmalloc.h> +_ACEOF +if { (eval echo "$as_me:7946: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:7952: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_dbmalloc_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_dbmalloc_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:7971: result: $ac_cv_header_dbmalloc_h" >&5 +echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 +if test $ac_cv_header_dbmalloc_h = yes; then + +echo "$as_me:7975: checking for debug_malloc in -ldbmalloc" >&5 +echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 +if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldbmalloc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 7983 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char debug_malloc (); +int +main () +{ +debug_malloc (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8002: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8005: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8008: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8011: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dbmalloc_debug_malloc=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dbmalloc_debug_malloc=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:8022: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 +if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then + cat >>confdefs.h <<EOF +#define HAVE_LIBDBMALLOC 1 +EOF + + LIBS="-ldbmalloc $LIBS" + +fi + +fi + +fi + +echo "$as_me:8037: checking if you want to use purify for testing" >&5 +echo $ECHO_N "checking if you want to use purify for testing... $ECHO_C" >&6 + +# Check whether --with-purify or --without-purify was given. +if test "${with_purify+set}" = set; then + withval="$with_purify" + cat >>confdefs.h <<\EOF +#define USE_PURIFY 1 +EOF + + : ${with_cflags:=-g} + : ${with_no_leaks:=yes} + with_purify=yes +else + with_purify= +fi; +echo "$as_me:8053: result: ${with_purify:-no}" >&5 +echo "${ECHO_T}${with_purify:-no}" >&6 + +case .$with_cflags in #(vi +.*-g*) + case .$CFLAGS in #(vi + .*-g*) #(vi + ;; + *) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -g +do +case $cf_fix_cppflags in +no) + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + *$cf_add_cflags) #(vi + ;; + *) #(vi + case $cf_add_cflags in #(vi + -D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + *) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + ;; + esac + ;; +esac + +echo "$as_me:8146: checking if you want to use valgrind for testing" >&5 +echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 + +# Check whether --with-valgrind or --without-valgrind was given. +if test "${with_valgrind+set}" = set; then + withval="$with_valgrind" + cat >>confdefs.h <<\EOF +#define USE_VALGRIND 1 +EOF + + : ${with_cflags:=-g} + : ${with_no_leaks:=yes} + with_valgrind=yes +else + with_valgrind= +fi; +echo "$as_me:8162: result: ${with_valgrind:-no}" >&5 +echo "${ECHO_T}${with_valgrind:-no}" >&6 + +case .$with_cflags in #(vi +.*-g*) + case .$CFLAGS in #(vi + .*-g*) #(vi + ;; + *) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -g +do +case $cf_fix_cppflags in +no) + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + *$cf_add_cflags) #(vi + ;; + *) #(vi + case $cf_add_cflags in #(vi + -D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + *) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$CPPFLAGS $cf_new_cppflags" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + ;; + esac + ;; +esac + +echo "$as_me:8255: checking if you want to perform memory-leak testing" >&5 +echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 + +# Check whether --with-no-leaks or --without-no-leaks was given. +if test "${with_no_leaks+set}" = set; then + withval="$with_no_leaks" + cat >>confdefs.h <<\EOF +#define NO_LEAKS 1 +EOF + + cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}${with_valgrind}" + case ${cf_doalloc} in #(vi + *yes*) ;; + *) cat >>confdefs.h <<\EOF +#define DOALLOC 10000 +EOF + ;; + esac + with_no_leaks=yes +else + with_no_leaks= +fi; +echo "$as_me:8277: result: $with_no_leaks" >&5 +echo "${ECHO_T}$with_no_leaks" >&6 + +echo "$as_me:8280: checking if you want --trace option" >&5 +echo $ECHO_N "checking if you want --trace option... $ECHO_C" >&6 + +# Check whether --enable-trace or --disable-trace was given. +if test "${enable_trace+set}" = set; then + enableval="$enable_trace" + +else + enableval=yes +fi; +echo "$as_me:8290: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 +if test "$enableval" != no ; then +EXTRAOBJS="$EXTRAOBJS trace\$o" + cat >>confdefs.h <<\EOF +#define HAVE_DLG_TRACE 1 +EOF + +else + : +fi + +LIBTOOL_MAKE="#" + +LIBTOOL= + +# common library maintenance symbols that are convenient for libtool scripts: +LIB_CREATE='${AR} -cr' +LIB_OBJECT='${OBJECTS}' +LIB_SUFFIX=.a +LIB_PREP="$RANLIB" + +# symbols used to prop libtool up to enable it to determine what it should be +# doing: +LIB_CLEAN= +LIB_COMPILE= +LIB_LINK='${CC}' +LIB_INSTALL= +LIB_UNINSTALL= + +echo "$as_me:8320: checking if you want to build libraries with libtool" >&5 +echo $ECHO_N "checking if you want to build libraries with libtool... $ECHO_C" >&6 + +# Check whether --with-libtool or --without-libtool was given. +if test "${with_libtool+set}" = set; then + withval="$with_libtool" + with_libtool=$withval +else + with_libtool=no +fi; +echo "$as_me:8330: result: $with_libtool" >&5 +echo "${ECHO_T}$with_libtool" >&6 +if test "$with_libtool" != "no"; then + + if test "$with_libtool" != "yes" ; then + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$with_libtool" in #(vi +.\$\(*\)*|.\'*\'*) #(vi + ;; +..|./*|.\\*) #(vi + ;; +.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX + ;; +.\${*prefix}*) #(vi + eval with_libtool="$with_libtool" + case ".$with_libtool" in #(vi + .NONE/*) + with_libtool=`echo $with_libtool | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; #(vi +.no|.NONE/*) + with_libtool=`echo $with_libtool | sed -e s%NONE%$cf_path_syntax%` + ;; +*) + { { echo "$as_me:8361: error: expected a pathname, not \"$with_libtool\"" >&5 +echo "$as_me: error: expected a pathname, not \"$with_libtool\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + + LIBTOOL=$with_libtool + else + # Extract the first word of "libtool", so it can be a program name with args. +set dummy libtool; ac_word=$2 +echo "$as_me:8371: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_LIBTOOL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $LIBTOOL in + [\\/]* | ?:[\\/]*) + ac_cv_path_LIBTOOL="$LIBTOOL" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_LIBTOOL="$ac_dir/$ac_word" + echo "$as_me:8388: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +LIBTOOL=$ac_cv_path_LIBTOOL + +if test -n "$LIBTOOL"; then + echo "$as_me:8399: result: $LIBTOOL" >&5 +echo "${ECHO_T}$LIBTOOL" >&6 +else + echo "$as_me:8402: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + if test -z "$LIBTOOL" ; then + { { echo "$as_me:8408: error: Cannot find libtool" >&5 +echo "$as_me: error: Cannot find libtool" >&2;} + { (exit 1); exit 1; }; } + fi + LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} -version-info `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} ${LT_UNDEF} -o' + LIB_OBJECT='${OBJECTS:.o=.lo}' + LIB_SUFFIX=.la + LIB_CLEAN='${LIBTOOL} --mode=clean' + LIB_COMPILE='${LIBTOOL} --mode=compile' + LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}' + LIB_INSTALL='${LIBTOOL} --mode=install' + LIB_UNINSTALL='${LIBTOOL} --mode=uninstall' + LIB_PREP=: + + # Show the version of libtool + echo "$as_me:8423: checking version of libtool" >&5 +echo $ECHO_N "checking version of libtool... $ECHO_C" >&6 + + # Save the version in a cache variable - this is not entirely a good + # thing, but the version string from libtool is very ugly, and for + # bug reports it might be useful to have the original string. "(" + cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'` + echo "$as_me:8430: result: $cf_cv_libtool_version" >&5 +echo "${ECHO_T}$cf_cv_libtool_version" >&6 + if test -z "$cf_cv_libtool_version" ; then + { { echo "$as_me:8433: error: This is not GNU libtool" >&5 +echo "$as_me: error: This is not GNU libtool" >&2;} + { (exit 1); exit 1; }; } + fi + + # special hack to add -no-undefined (which libtool should do for itself) + LT_UNDEF= + case "$cf_cv_system_name" in #(vi + cygwin*|mingw32*|uwin*|aix[456]) #(vi + LT_UNDEF=-no-undefined + ;; + esac + + # special hack to add --tag option for C++ compiler + case $cf_cv_libtool_version in #(vi + 1.[5-9]*|[2-9].[0-9.a-z]*) #(vi + LIBTOOL_CXX="$LIBTOOL --tag=CXX" + LIBTOOL="$LIBTOOL --tag=CC" + ;; + *) + LIBTOOL_CXX="$LIBTOOL" + ;; + esac +else + LIBTOOL="" + LIBTOOL_CXX="" +fi + +test -z "$LIBTOOL" && ECHO_LT= + +if test "$with_libtool" = "yes" ; then + OBJEXT="lo" + LIBTOOL_MAKE= + +echo "$as_me:8467: checking for additional libtool options" >&5 +echo $ECHO_N "checking for additional libtool options... $ECHO_C" >&6 + +# Check whether --with-libtool-opts or --without-libtool-opts was given. +if test "${with_libtool_opts+set}" = set; then + withval="$with_libtool_opts" + with_libtool_opts=$withval +else + with_libtool_opts=no +fi; +echo "$as_me:8477: result: $with_libtool_opts" >&5 +echo "${ECHO_T}$with_libtool_opts" >&6 + +case .$with_libtool_opts in +.yes|.no|.) + ;; +*) + LIBTOOL_OPTS=$with_libtool_opts + ;; +esac + +fi + +use_ncurses=no + +# Check whether --with-ncurses or --without-ncurses was given. +if test "${with_ncurses+set}" = set; then + withval="$with_ncurses" + use_ncurses=ncurses +fi; + +# Check whether --with-ncursesw or --without-ncursesw was given. +if test "${with_ncursesw+set}" = set; then + withval="$with_ncursesw" + use_ncurses=ncursesw +fi; +if test $use_ncurses != no ; then + cf_wide_curses=yes + if test $use_ncurses = ncursesw ; then + +echo "$as_me:8507: checking for multibyte character support" >&5 +echo $ECHO_N "checking for multibyte character support... $ECHO_C" >&6 +if test "${cf_cv_utf8_lib+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_save_LIBS="$LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 8515 "configure" +#include "confdefs.h" + +#include <stdlib.h> +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8528: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8531: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8534: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8537: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_utf8_lib=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +# If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these +# will be set on completion of the AC_TRY_LINK below. +cf_cv_header_path_utf8= +cf_cv_library_path_utf8= + +echo "${as_me-configure}:8549: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 + +cat >conftest.$ac_ext <<_ACEOF +#line 8552 "configure" +#include "confdefs.h" + +#include <libutf8.h> +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8565: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8568: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8571: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8574: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_find_linkage_utf8=yes + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +cf_save_LIBS="$LIBS" +LIBS="-lutf8 $cf_save_LIBS" + +cat >conftest.$ac_ext <<_ACEOF +#line 8587 "configure" +#include "confdefs.h" + +#include <libutf8.h> +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8600: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8603: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8606: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8609: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_find_linkage_utf8=yes + cf_cv_library_file_utf8="-lutf8" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_find_linkage_utf8=no + LIBS="$cf_save_LIBS" + + test -n "$verbose" && echo " find linkage for utf8 library" 1>&6 + +echo "${as_me-configure}:8624: testing find linkage for utf8 library ..." 1>&5 + +echo "${as_me-configure}:8626: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_test_CPPFLAGS="$CPPFLAGS" + +cf_search= + +# collect the current set of include-directories from compiler flags +cf_header_path_list="" +if test -n "${CFLAGS}${CPPFLAGS}" ; then + for cf_header_path in $CPPFLAGS $CFLAGS + do + case $cf_header_path in #(vi + -I*) + cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + cf_header_path_list="$cf_header_path_list $cf_header_path" + ;; + esac + done +fi + +# add the variations for the package we are looking for + +cf_search= + +test "/usr" != "$prefix" && \ +test -d "/usr" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /usr" + test -d /usr/include && cf_search="$cf_search /usr/include" + test -d /usr/include/utf8 && cf_search="$cf_search /usr/include/utf8" + test -d /usr/include/utf8/include && cf_search="$cf_search /usr/include/utf8/include" + test -d /usr/utf8/include && cf_search="$cf_search /usr/utf8/include" + test -d /usr/utf8/include/utf8 && cf_search="$cf_search /usr/utf8/include/utf8" +} + +test "$prefix" != "NONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $prefix" + test -d $prefix/include && cf_search="$cf_search $prefix/include" + test -d $prefix/include/utf8 && cf_search="$cf_search $prefix/include/utf8" + test -d $prefix/include/utf8/include && cf_search="$cf_search $prefix/include/utf8/include" + test -d $prefix/utf8/include && cf_search="$cf_search $prefix/utf8/include" + test -d $prefix/utf8/include/utf8 && cf_search="$cf_search $prefix/utf8/include/utf8" +} + +test "/usr/local" != "$prefix" && \ +test -d "/usr/local" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /usr/local" + test -d /usr/local/include && cf_search="$cf_search /usr/local/include" + test -d /usr/local/include/utf8 && cf_search="$cf_search /usr/local/include/utf8" + test -d /usr/local/include/utf8/include && cf_search="$cf_search /usr/local/include/utf8/include" + test -d /usr/local/utf8/include && cf_search="$cf_search /usr/local/utf8/include" + test -d /usr/local/utf8/include/utf8 && cf_search="$cf_search /usr/local/utf8/include/utf8" +} + +test "/opt" != "$prefix" && \ +test -d "/opt" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /opt" + test -d /opt/include && cf_search="$cf_search /opt/include" + test -d /opt/include/utf8 && cf_search="$cf_search /opt/include/utf8" + test -d /opt/include/utf8/include && cf_search="$cf_search /opt/include/utf8/include" + test -d /opt/utf8/include && cf_search="$cf_search /opt/utf8/include" + test -d /opt/utf8/include/utf8 && cf_search="$cf_search /opt/utf8/include/utf8" +} + +test "$HOME" != "$prefix" && \ +test -d "$HOME" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under $HOME" + test -d $HOME/include && cf_search="$cf_search $HOME/include" + test -d $HOME/include/utf8 && cf_search="$cf_search $HOME/include/utf8" + test -d $HOME/include/utf8/include && cf_search="$cf_search $HOME/include/utf8/include" + test -d $HOME/utf8/include && cf_search="$cf_search $HOME/utf8/include" + test -d $HOME/utf8/include/utf8 && cf_search="$cf_search $HOME/utf8/include/utf8" +} + +test "$includedir" != NONE && \ +test "$includedir" != "/usr/include" && \ +test -d "$includedir" && { + test -d $includedir && cf_search="$cf_search $includedir" + test -d $includedir/utf8 && cf_search="$cf_search $includedir/utf8" +} + +test "$oldincludedir" != NONE && \ +test "$oldincludedir" != "/usr/include" && \ +test -d "$oldincludedir" && { + test -d $oldincludedir && cf_search="$cf_search $oldincludedir" + test -d $oldincludedir/utf8 && cf_search="$cf_search $oldincludedir/utf8" +} + +cf_search="$cf_search $cf_header_path_list" + + for cf_cv_header_path_utf8 in $cf_search + do + if test -d $cf_cv_header_path_utf8 ; then + test -n "$verbose" && echo " ... testing $cf_cv_header_path_utf8" 1>&6 + +echo "${as_me-configure}:8727: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 + + CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_utf8" + cat >conftest.$ac_ext <<_ACEOF +#line 8731 "configure" +#include "confdefs.h" + +#include <libutf8.h> +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8744: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8747: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8750: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8753: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + test -n "$verbose" && echo " ... found utf8 headers in $cf_cv_header_path_utf8" 1>&6 + +echo "${as_me-configure}:8758: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 + + cf_cv_find_linkage_utf8=maybe + cf_test_CPPFLAGS="$CPPFLAGS" + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + CPPFLAGS="$cf_save_CPPFLAGS" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + done + + if test "$cf_cv_find_linkage_utf8" = maybe ; then + +echo "${as_me-configure}:8776: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 + + cf_save_LIBS="$LIBS" + cf_save_LDFLAGS="$LDFLAGS" + + if test "$cf_cv_find_linkage_utf8" != yes ; then + +cf_search= +cf_library_path_list="" +if test -n "${LDFLAGS}${LIBS}" ; then + for cf_library_path in $LDFLAGS $LIBS + do + case $cf_library_path in #(vi + -L*) + cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` + +test "$cf_library_path" != "NONE" && \ +test -d "$cf_library_path" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" + test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" + test -d $cf_library_path/lib/utf8 && cf_search="$cf_search $cf_library_path/lib/utf8" + test -d $cf_library_path/lib/utf8/lib && cf_search="$cf_search $cf_library_path/lib/utf8/lib" + test -d $cf_library_path/utf8/lib && cf_search="$cf_search $cf_library_path/utf8/lib" + test -d $cf_library_path/utf8/lib/utf8 && cf_search="$cf_search $cf_library_path/utf8/lib/utf8" +} + + cf_library_path_list="$cf_library_path_list $cf_search" + ;; + esac + done +fi + +cf_search= + +test "/usr" != "$prefix" && \ +test -d "/usr" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /usr" + test -d /usr/lib && cf_search="$cf_search /usr/lib" + test -d /usr/lib/utf8 && cf_search="$cf_search /usr/lib/utf8" + test -d /usr/lib/utf8/lib && cf_search="$cf_search /usr/lib/utf8/lib" + test -d /usr/utf8/lib && cf_search="$cf_search /usr/utf8/lib" + test -d /usr/utf8/lib/utf8 && cf_search="$cf_search /usr/utf8/lib/utf8" +} + +test "$prefix" != "NONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $prefix" + test -d $prefix/lib && cf_search="$cf_search $prefix/lib" + test -d $prefix/lib/utf8 && cf_search="$cf_search $prefix/lib/utf8" + test -d $prefix/lib/utf8/lib && cf_search="$cf_search $prefix/lib/utf8/lib" + test -d $prefix/utf8/lib && cf_search="$cf_search $prefix/utf8/lib" + test -d $prefix/utf8/lib/utf8 && cf_search="$cf_search $prefix/utf8/lib/utf8" +} + +test "/usr/local" != "$prefix" && \ +test -d "/usr/local" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" + test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" + test -d /usr/local/lib/utf8 && cf_search="$cf_search /usr/local/lib/utf8" + test -d /usr/local/lib/utf8/lib && cf_search="$cf_search /usr/local/lib/utf8/lib" + test -d /usr/local/utf8/lib && cf_search="$cf_search /usr/local/utf8/lib" + test -d /usr/local/utf8/lib/utf8 && cf_search="$cf_search /usr/local/utf8/lib/utf8" +} + +test "/opt" != "$prefix" && \ +test -d "/opt" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /opt" + test -d /opt/lib && cf_search="$cf_search /opt/lib" + test -d /opt/lib/utf8 && cf_search="$cf_search /opt/lib/utf8" + test -d /opt/lib/utf8/lib && cf_search="$cf_search /opt/lib/utf8/lib" + test -d /opt/utf8/lib && cf_search="$cf_search /opt/utf8/lib" + test -d /opt/utf8/lib/utf8 && cf_search="$cf_search /opt/utf8/lib/utf8" +} + +test "$HOME" != "$prefix" && \ +test -d "$HOME" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under $HOME" + test -d $HOME/lib && cf_search="$cf_search $HOME/lib" + test -d $HOME/lib/utf8 && cf_search="$cf_search $HOME/lib/utf8" + test -d $HOME/lib/utf8/lib && cf_search="$cf_search $HOME/lib/utf8/lib" + test -d $HOME/utf8/lib && cf_search="$cf_search $HOME/utf8/lib" + test -d $HOME/utf8/lib/utf8 && cf_search="$cf_search $HOME/utf8/lib/utf8" +} + +cf_search="$cf_library_path_list $cf_search" + + for cf_cv_library_path_utf8 in $cf_search + do + if test -d $cf_cv_library_path_utf8 ; then + test -n "$verbose" && echo " ... testing $cf_cv_library_path_utf8" 1>&6 + +echo "${as_me-configure}:8873: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 + + CPPFLAGS="$cf_test_CPPFLAGS" + LIBS="-lutf8 $cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_utf8" + cat >conftest.$ac_ext <<_ACEOF +#line 8879 "configure" +#include "confdefs.h" + +#include <libutf8.h> +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8892: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8895: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8898: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8901: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + test -n "$verbose" && echo " ... found utf8 library in $cf_cv_library_path_utf8" 1>&6 + +echo "${as_me-configure}:8906: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 + + cf_cv_find_linkage_utf8=yes + cf_cv_library_file_utf8="-lutf8" + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + LDFLAGS="$cf_save_LDFLAGS" + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + fi + done + LIBS="$cf_save_LIBS" + CPPFLAGS="$cf_save_CPPFLAGS" + LDFLAGS="$cf_save_LDFLAGS" + fi + + else + cf_cv_find_linkage_utf8=no + fi + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +if test "$cf_cv_find_linkage_utf8" = yes ; then +cf_cv_utf8_lib=add-on +else +cf_cv_utf8_lib=no +fi + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8947: result: $cf_cv_utf8_lib" >&5 +echo "${ECHO_T}$cf_cv_utf8_lib" >&6 + +# HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between +# ncurses/ncursesw: +if test "$cf_cv_utf8_lib" = "add-on" ; then + cat >>confdefs.h <<\EOF +#define HAVE_LIBUTF8_H 1 +EOF + +if test -n "$cf_cv_header_path_utf8" ; then + for cf_add_incdir in $cf_cv_header_path_utf8 + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 8981 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8993: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8996: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8999: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9002: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me-configure}:9019: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + fi + done + done +fi + +if test -n "$cf_cv_library_path_utf8" ; then + for cf_add_libdir in $cf_cv_library_path_utf8 + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me-configure}:9053: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + LIBS="$cf_cv_library_file_utf8 $LIBS" +fi + + fi + +# Check whether --with-curses-dir or --without-curses-dir was given. +if test "${with_curses_dir+set}" = set; then + withval="$with_curses_dir" + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$withval" in #(vi +.\$\(*\)*|.\'*\'*) #(vi + ;; +..|./*|.\\*) #(vi + ;; +.[a-zA-Z]:[\\/]*) #(vi OS/2 EMX + ;; +.\${*prefix}*) #(vi + eval withval="$withval" + case ".$withval" in #(vi + .NONE/*) + withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; #(vi +.no|.NONE/*) + withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` + ;; +*) + { { echo "$as_me:9095: error: expected a pathname, not \"$withval\"" >&5 +echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + + cf_cv_curses_dir=$withval +else + cf_cv_curses_dir=no +fi; + +cf_ncuconfig_root=$use_ncurses + +echo "Looking for ${cf_ncuconfig_root}-config" +for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:9113: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_NCURSES_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $NCURSES_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_NCURSES_CONFIG="$NCURSES_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_NCURSES_CONFIG="$ac_dir/$ac_word" + echo "$as_me:9130: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +NCURSES_CONFIG=$ac_cv_path_NCURSES_CONFIG + +if test -n "$NCURSES_CONFIG"; then + echo "$as_me:9141: result: $NCURSES_CONFIG" >&5 +echo "${ECHO_T}$NCURSES_CONFIG" >&6 +else + echo "$as_me:9144: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$NCURSES_CONFIG" && break +done +test -n "$NCURSES_CONFIG" || NCURSES_CONFIG="none" + +if test "$NCURSES_CONFIG" != none ; then + +CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" +LIBS="`$NCURSES_CONFIG --libs` $LIBS" + +# even with config script, some packages use no-override for curses.h + +echo "$as_me:9159: checking if we have identified curses headers" >&5 +echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 +if test "${cf_cv_ncurses_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_ncurses_header=none +for cf_header in \ + $use_ncurses/curses.h \ + $use_ncurses/ncurses.h \ + curses.h \ + ncurses.h +do +cat >conftest.$ac_ext <<_ACEOF +#line 9173 "configure" +#include "confdefs.h" +#include <${cf_header}> +int +main () +{ +initscr(); tgoto("?", 0,0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9185: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9188: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9191: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9194: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_header=$cf_header; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:9205: result: $cf_cv_ncurses_header" >&5 +echo "${ECHO_T}$cf_cv_ncurses_header" >&6 + +if test "$cf_cv_ncurses_header" = none ; then + { { echo "$as_me:9209: error: No curses header-files found" >&5 +echo "$as_me: error: No curses header-files found" >&2;} + { (exit 1); exit 1; }; } +fi + +# cheat, to get the right #define's for HAVE_NCURSES_H, etc. + +for ac_header in $cf_cv_ncurses_header +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:9219: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 9225 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:9229: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:9235: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:9254: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +cf_nculib_ROOT=`echo "HAVE_LIB$cf_ncuconfig_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cat >>confdefs.h <<EOF +#define $cf_nculib_ROOT 1 +EOF + +cf_cv_ncurses_version=`$NCURSES_CONFIG --version` + +else + +cf_ncuhdr_root=$use_ncurses + +test -n "$cf_cv_curses_dir" && \ +test "$cf_cv_curses_dir" != "no" && { \ + +if test -n "$cf_cv_curses_dir/include $cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then + for cf_add_incdir in $cf_cv_curses_dir/include $cf_cv_curses_dir/include/$cf_ncuhdr_root + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 9307 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9319: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9322: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9325: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9328: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me-configure}:9345: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + fi + done + done +fi + +} + +echo "$as_me:9362: checking for $cf_ncuhdr_root header in include-path" >&5 +echo $ECHO_N "checking for $cf_ncuhdr_root header in include-path... $ECHO_C" >&6 +if test "${cf_cv_ncurses_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h" + ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h" + for cf_header in $cf_header_list + do + + cat >conftest.$ac_ext <<_ACEOF +#line 9374 "configure" +#include "confdefs.h" + +#include <$cf_header> +int +main () +{ + +#ifdef NCURSES_VERSION + +printf("%s\n", NCURSES_VERSION); +#else +#ifdef __NCURSES_H +printf("old\n"); +#else + make an error +#endif +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9398: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9401: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9404: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9407: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_h=$cf_header + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_ncurses_h=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + test "$cf_cv_ncurses_h" != no && break + done + +fi +echo "$as_me:9422: result: $cf_cv_ncurses_h" >&5 +echo "${ECHO_T}$cf_cv_ncurses_h" >&6 + +if test "$cf_cv_ncurses_h" != no ; then + cf_cv_ncurses_header=$cf_cv_ncurses_h +else + +echo "$as_me:9429: checking for $cf_ncuhdr_root include-path" >&5 +echo $ECHO_N "checking for $cf_ncuhdr_root include-path... $ECHO_C" >&6 +if test "${cf_cv_ncurses_h2+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + test -n "$verbose" && echo + +cf_search= + +# collect the current set of include-directories from compiler flags +cf_header_path_list="" +if test -n "${CFLAGS}${CPPFLAGS}" ; then + for cf_header_path in $CPPFLAGS $CFLAGS + do + case $cf_header_path in #(vi + -I*) + cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` + cf_header_path_list="$cf_header_path_list $cf_header_path" + ;; + esac + done +fi + +# add the variations for the package we are looking for + +cf_search= + +test "/usr" != "$prefix" && \ +test -d "/usr" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /usr" + test -d /usr/include && cf_search="$cf_search /usr/include" + test -d /usr/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/include/$cf_ncuhdr_root" + test -d /usr/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/include/$cf_ncuhdr_root/include" + test -d /usr/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/$cf_ncuhdr_root/include" + test -d /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +test "$prefix" != "NONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for include-directories under $prefix" + test -d $prefix/include && cf_search="$cf_search $prefix/include" + test -d $prefix/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root" + test -d $prefix/include/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/include/$cf_ncuhdr_root/include" + test -d $prefix/$cf_ncuhdr_root/include && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include" + test -d $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $prefix/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +test "/usr/local" != "$prefix" && \ +test -d "/usr/local" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /usr/local" + test -d /usr/local/include && cf_search="$cf_search /usr/local/include" + test -d /usr/local/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root" + test -d /usr/local/include/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/include/$cf_ncuhdr_root/include" + test -d /usr/local/$cf_ncuhdr_root/include && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include" + test -d /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /usr/local/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +test "/opt" != "$prefix" && \ +test -d "/opt" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under /opt" + test -d /opt/include && cf_search="$cf_search /opt/include" + test -d /opt/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/include/$cf_ncuhdr_root" + test -d /opt/include/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/include/$cf_ncuhdr_root/include" + test -d /opt/$cf_ncuhdr_root/include && cf_search="$cf_search /opt/$cf_ncuhdr_root/include" + test -d /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search /opt/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +test "$HOME" != "$prefix" && \ +test -d "$HOME" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for include-directories under $HOME" + test -d $HOME/include && cf_search="$cf_search $HOME/include" + test -d $HOME/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root" + test -d $HOME/include/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/include/$cf_ncuhdr_root/include" + test -d $HOME/$cf_ncuhdr_root/include && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include" + test -d $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root && cf_search="$cf_search $HOME/$cf_ncuhdr_root/include/$cf_ncuhdr_root" +} + +test "$includedir" != NONE && \ +test "$includedir" != "/usr/include" && \ +test -d "$includedir" && { + test -d $includedir && cf_search="$cf_search $includedir" + test -d $includedir/$cf_ncuhdr_root && cf_search="$cf_search $includedir/$cf_ncuhdr_root" +} + +test "$oldincludedir" != NONE && \ +test "$oldincludedir" != "/usr/include" && \ +test -d "$oldincludedir" && { + test -d $oldincludedir && cf_search="$cf_search $oldincludedir" + test -d $oldincludedir/$cf_ncuhdr_root && cf_search="$cf_search $oldincludedir/$cf_ncuhdr_root" +} + +cf_search="$cf_search $cf_header_path_list" + + test -n "$verbose" && echo search path $cf_search + cf_save2_CPPFLAGS="$CPPFLAGS" + for cf_incdir in $cf_search + do + +if test -n "$cf_incdir" ; then + for cf_add_incdir in $cf_incdir + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 9557 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9569: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9572: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9575: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9578: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me-configure}:9595: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + fi + done + done +fi + + for cf_header in \ + ncurses.h \ + curses.h + do + + cat >conftest.$ac_ext <<_ACEOF +#line 9616 "configure" +#include "confdefs.h" + +#include <$cf_header> +int +main () +{ + +#ifdef NCURSES_VERSION + +printf("%s\n", NCURSES_VERSION); +#else +#ifdef __NCURSES_H +printf("old\n"); +#else + make an error +#endif +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9640: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9643: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9646: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9649: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_h2=$cf_header + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_ncurses_h2=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + if test "$cf_cv_ncurses_h2" != no ; then + cf_cv_ncurses_h2=$cf_incdir/$cf_header + test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&6 + break + fi + test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&6 + done + CPPFLAGS="$cf_save2_CPPFLAGS" + test "$cf_cv_ncurses_h2" != no && break + done + test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:9670: error: not found" >&5 +echo "$as_me: error: not found" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:9675: result: $cf_cv_ncurses_h2" >&5 +echo "${ECHO_T}$cf_cv_ncurses_h2" >&6 + + cf_1st_incdir=`echo $cf_cv_ncurses_h2 | sed -e 's%/[^/]*$%%'` + cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2` + if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then + cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header + fi + +if test -n "$cf_1st_incdir" ; then + for cf_add_incdir in $cf_1st_incdir + do + while test $cf_add_incdir != /usr/include + do + if test -d $cf_add_incdir + then + cf_have_incdir=no + if test -n "$CFLAGS$CPPFLAGS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_incdir in $CFLAGS $CPPFLAGS ; do + if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then + cf_have_incdir=yes; break + fi + done + fi + + if test "$cf_have_incdir" = no ; then + if test "$cf_add_incdir" = /usr/local/include ; then + if test "$GCC" = yes + then + cf_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + cat >conftest.$ac_ext <<_ACEOF +#line 9708 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +printf("Hello") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9720: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9723: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9726: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9729: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_have_incdir=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS=$cf_save_CPPFLAGS + fi + fi + fi + + if test "$cf_have_incdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 + +echo "${as_me-configure}:9746: testing adding $cf_add_incdir to include-path ..." 1>&5 + + CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" + + cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + test "$cf_top_incdir" = "$cf_add_incdir" && break + cf_add_incdir="$cf_top_incdir" + else + break + fi + fi + done + done +fi + +fi + +# Set definitions to allow ifdef'ing for ncurses.h + +case $cf_cv_ncurses_header in # (vi +*ncurses.h) + cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_H 1 +EOF + + ;; +esac + +case $cf_cv_ncurses_header in # (vi +ncurses/curses.h|ncurses/ncurses.h) + cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_NCURSES_H 1 +EOF + + ;; +ncursesw/curses.h|ncursesw/ncurses.h) + cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_NCURSES_H 1 +EOF + + ;; +esac + +echo "$as_me:9789: checking for terminfo header" >&5 +echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +case ${cf_cv_ncurses_header} in #(vi +*/ncurses.h|*/ncursesw.h) #(vi + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` + ;; +*) + cf_term_header=term.h + ;; +esac + +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do +cat >conftest.$ac_ext <<_ACEOF +#line 9807 "configure" +#include "confdefs.h" +#include <stdio.h> +#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_test> + +int +main () +{ +int x = auto_left_margin + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9822: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9825: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9828: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9831: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_term_header="$cf_test" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_term_header=unknown + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_term_header" != unknown && break +done + +fi +echo "$as_me:9847: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 + +# Set definitions to allow ifdef'ing to accommodate subdirectories + +case $cf_cv_term_header in # (vi +*term.h) + cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +esac + +case $cf_cv_term_header in # (vi +ncurses/term.h) #(vi + cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +ncursesw/term.h) + cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + +# some applications need this, but should check for NCURSES_VERSION +cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +echo "$as_me:9881: checking for ncurses version" >&5 +echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 +if test "${cf_cv_ncurses_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_ncurses_version=no + cf_tempfile=out$$ + rm -f $cf_tempfile + if test "$cross_compiling" = yes; then + + # This will not work if the preprocessor splits the line after the + # Autoconf token. The 'unproto' program does that. + cat > conftest.$ac_ext <<EOF +#include <${cf_cv_ncurses_header-curses.h}> +#undef Autoconf +#ifdef NCURSES_VERSION +Autoconf NCURSES_VERSION +#else +#ifdef __NCURSES_H +Autoconf "old" +#endif +; +#endif +EOF + cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" + { (eval echo "$as_me:9907: \"$cf_try\"") >&5 + (eval $cf_try) 2>&5 + ac_status=$? + echo "$as_me:9910: \$? = $ac_status" >&5 + (exit $ac_status); } + if test -f conftest.out ; then + cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` + test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" + rm -f conftest.out + fi + +else + cat >conftest.$ac_ext <<_ACEOF +#line 9920 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header-curses.h}> +#include <stdio.h> +int main() +{ + FILE *fp = fopen("$cf_tempfile", "w"); +#ifdef NCURSES_VERSION +# ifdef NCURSES_VERSION_PATCH + fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); +# else + fprintf(fp, "%s\n", NCURSES_VERSION); +# endif +#else +# ifdef __NCURSES_H + fprintf(fp, "old\n"); +# else + make an error +# endif +#endif + ${cf_cv_main_return-return}(0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:9945: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9948: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:9950: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9953: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_ncurses_version=`cat $cf_tempfile` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + rm -f $cf_tempfile + +fi +echo "$as_me:9967: result: $cf_cv_ncurses_version" >&5 +echo "${ECHO_T}$cf_cv_ncurses_version" >&6 +test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +cf_nculib_root=$use_ncurses + # This works, except for the special case where we find gpm, but + # ncurses is in a nonstandard location via $LIBS, and we really want + # to link gpm. +cf_ncurses_LIBS="" +cf_ncurses_SAVE="$LIBS" +echo "$as_me:9979: checking for Gpm_Open in -lgpm" >&5 +echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 +if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgpm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 9987 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char Gpm_Open (); +int +main () +{ +Gpm_Open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10006: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10009: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10012: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10015: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gpm_Gpm_Open=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gpm_Gpm_Open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:10026: result: $ac_cv_lib_gpm_Gpm_Open" >&5 +echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 +if test $ac_cv_lib_gpm_Gpm_Open = yes; then + echo "$as_me:10029: checking for initscr in -lgpm" >&5 +echo $ECHO_N "checking for initscr in -lgpm... $ECHO_C" >&6 +if test "${ac_cv_lib_gpm_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgpm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 10037 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main () +{ +initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10056: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10059: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10062: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10065: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gpm_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gpm_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:10076: result: $ac_cv_lib_gpm_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_gpm_initscr" >&6 +if test $ac_cv_lib_gpm_initscr = yes; then + LIBS="$cf_ncurses_SAVE" +else + cf_ncurses_LIBS="-lgpm" +fi + +fi + +case $host_os in #(vi +freebsd*) + # This is only necessary if you are linking against an obsolete + # version of ncurses (but it should do no harm, since it's static). + if test "$cf_nculib_root" = ncurses ; then + echo "$as_me:10091: checking for tgoto in -lmytinfo" >&5 +echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 +if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmytinfo $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 10099 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); +int +main () +{ +tgoto (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10118: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10121: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10124: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10127: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mytinfo_tgoto=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_mytinfo_tgoto=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:10138: result: $ac_cv_lib_mytinfo_tgoto" >&5 +echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 +if test $ac_cv_lib_mytinfo_tgoto = yes; then + cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS" +fi + + fi + ;; +esac + +LIBS="$cf_ncurses_LIBS $LIBS" + +if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) +then + +if test -n "$cf_cv_curses_dir/lib" ; then + for cf_add_libdir in $cf_cv_curses_dir/lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me-configure}:10172: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + LIBS="-l$cf_nculib_root $LIBS" +else + + eval 'cf_cv_have_lib_'$cf_nculib_root'=no' + cf_libdir="" + echo "$as_me:10185: checking for initscr" >&5 +echo $ECHO_N "checking for initscr... $ECHO_C" >&6 +if test "${ac_cv_func_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 10191 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char initscr (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_initscr) || defined (__stub___initscr) +choke me +#else +f = initscr; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10222: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10225: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10228: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10231: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:10241: result: $ac_cv_func_initscr" >&5 +echo "${ECHO_T}$ac_cv_func_initscr" >&6 +if test $ac_cv_func_initscr = yes; then + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' +else + + cf_save_LIBS="$LIBS" + echo "$as_me:10248: checking for initscr in -l$cf_nculib_root" >&5 +echo $ECHO_N "checking for initscr in -l$cf_nculib_root... $ECHO_C" >&6 + LIBS="-l$cf_nculib_root $LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 10252 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10264: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10267: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10270: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10273: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:10275: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:10282: result: no" >&5 +echo "${ECHO_T}no" >&6 + +cf_search= +cf_library_path_list="" +if test -n "${LDFLAGS}${LIBS}" ; then + for cf_library_path in $LDFLAGS $LIBS + do + case $cf_library_path in #(vi + -L*) + cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` + +test "$cf_library_path" != "NONE" && \ +test -d "$cf_library_path" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $cf_library_path" + test -d $cf_library_path/lib && cf_search="$cf_search $cf_library_path/lib" + test -d $cf_library_path/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root" + test -d $cf_library_path/lib/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/lib/$cf_nculib_root/lib" + test -d $cf_library_path/$cf_nculib_root/lib && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib" + test -d $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $cf_library_path/$cf_nculib_root/lib/$cf_nculib_root" +} + + cf_library_path_list="$cf_library_path_list $cf_search" + ;; + esac + done +fi + +cf_search= + +test "/usr" != "$prefix" && \ +test -d "/usr" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /usr" + test -d /usr/lib && cf_search="$cf_search /usr/lib" + test -d /usr/lib/$cf_nculib_root && cf_search="$cf_search /usr/lib/$cf_nculib_root" + test -d /usr/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/lib/$cf_nculib_root/lib" + test -d /usr/$cf_nculib_root/lib && cf_search="$cf_search /usr/$cf_nculib_root/lib" + test -d /usr/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/$cf_nculib_root/lib/$cf_nculib_root" +} + +test "$prefix" != "NONE" && \ +test -d "$prefix" && \ + { + test -n "$verbose" && echo " ... testing for lib-directories under $prefix" + test -d $prefix/lib && cf_search="$cf_search $prefix/lib" + test -d $prefix/lib/$cf_nculib_root && cf_search="$cf_search $prefix/lib/$cf_nculib_root" + test -d $prefix/lib/$cf_nculib_root/lib && cf_search="$cf_search $prefix/lib/$cf_nculib_root/lib" + test -d $prefix/$cf_nculib_root/lib && cf_search="$cf_search $prefix/$cf_nculib_root/lib" + test -d $prefix/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $prefix/$cf_nculib_root/lib/$cf_nculib_root" +} + +test "/usr/local" != "$prefix" && \ +test -d "/usr/local" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /usr/local" + test -d /usr/local/lib && cf_search="$cf_search /usr/local/lib" + test -d /usr/local/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/lib/$cf_nculib_root" + test -d /usr/local/lib/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/lib/$cf_nculib_root/lib" + test -d /usr/local/$cf_nculib_root/lib && cf_search="$cf_search /usr/local/$cf_nculib_root/lib" + test -d /usr/local/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /usr/local/$cf_nculib_root/lib/$cf_nculib_root" +} + +test "/opt" != "$prefix" && \ +test -d "/opt" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under /opt" + test -d /opt/lib && cf_search="$cf_search /opt/lib" + test -d /opt/lib/$cf_nculib_root && cf_search="$cf_search /opt/lib/$cf_nculib_root" + test -d /opt/lib/$cf_nculib_root/lib && cf_search="$cf_search /opt/lib/$cf_nculib_root/lib" + test -d /opt/$cf_nculib_root/lib && cf_search="$cf_search /opt/$cf_nculib_root/lib" + test -d /opt/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search /opt/$cf_nculib_root/lib/$cf_nculib_root" +} + +test "$HOME" != "$prefix" && \ +test -d "$HOME" && \ +(test $prefix = NONE || test -d $prefix) && { + test -n "$verbose" && echo " ... testing for lib-directories under $HOME" + test -d $HOME/lib && cf_search="$cf_search $HOME/lib" + test -d $HOME/lib/$cf_nculib_root && cf_search="$cf_search $HOME/lib/$cf_nculib_root" + test -d $HOME/lib/$cf_nculib_root/lib && cf_search="$cf_search $HOME/lib/$cf_nculib_root/lib" + test -d $HOME/$cf_nculib_root/lib && cf_search="$cf_search $HOME/$cf_nculib_root/lib" + test -d $HOME/$cf_nculib_root/lib/$cf_nculib_root && cf_search="$cf_search $HOME/$cf_nculib_root/lib/$cf_nculib_root" +} + +cf_search="$cf_library_path_list $cf_search" + + for cf_libdir in $cf_search + do + echo "$as_me:10372: checking for -l$cf_nculib_root in $cf_libdir" >&5 +echo $ECHO_N "checking for -l$cf_nculib_root in $cf_libdir... $ECHO_C" >&6 + LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 10376 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10388: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10391: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10394: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10397: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:10399: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:10406: result: no" >&5 +echo "${ECHO_T}no" >&6 + LIBS="$cf_save_LIBS" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi + +eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root + +if test $cf_found_library = no ; then + { { echo "$as_me:10421: error: Cannot link $cf_nculib_root library" >&5 +echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + +if test -n "$cf_ncurses_LIBS" ; then + echo "$as_me:10429: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 +echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS... $ECHO_C" >&6 + cf_ncurses_SAVE="$LIBS" + for p in $cf_ncurses_LIBS ; do + q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` + if test "$q" != "$LIBS" ; then + LIBS="$q" + fi + done + cat >conftest.$ac_ext <<_ACEOF +#line 10439 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ +initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10451: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10454: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10457: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10460: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:10462: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:10467: result: no" >&5 +echo "${ECHO_T}no" >&6 + LIBS="$cf_ncurses_SAVE" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi + +cf_nculib_ROOT=`echo "HAVE_LIB$cf_nculib_root" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cat >>confdefs.h <<EOF +#define $cf_nculib_ROOT 1 +EOF + +fi + +else + cf_wide_curses=no + +echo "$as_me:10485: checking for extra include directories" >&5 +echo $ECHO_N "checking for extra include directories... $ECHO_C" >&6 +if test "${cf_cv_curses_incdir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_curses_incdir=no +case $host_os in #(vi +hpux10.*) #(vi + test -d /usr/include/curses_colr && \ + cf_cv_curses_incdir="-I/usr/include/curses_colr" + ;; +sunos3*|sunos4*) + test -d /usr/5lib && \ + test -d /usr/5include && \ + cf_cv_curses_incdir="-I/usr/5include" + ;; +esac + +fi +echo "$as_me:10505: result: $cf_cv_curses_incdir" >&5 +echo "${ECHO_T}$cf_cv_curses_incdir" >&6 +test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir" + +echo "$as_me:10509: checking if we have identified curses headers" >&5 +echo $ECHO_N "checking if we have identified curses headers... $ECHO_C" >&6 +if test "${cf_cv_ncurses_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_ncurses_header=none +for cf_header in \ + curses.h \ + ncurses.h ncurses/curses.h ncurses/ncurses.h +do +cat >conftest.$ac_ext <<_ACEOF +#line 10521 "configure" +#include "confdefs.h" +#include <${cf_header}> +int +main () +{ +initscr(); tgoto("?", 0,0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10533: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10536: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10539: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10542: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_ncurses_header=$cf_header; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:10553: result: $cf_cv_ncurses_header" >&5 +echo "${ECHO_T}$cf_cv_ncurses_header" >&6 + +if test "$cf_cv_ncurses_header" = none ; then + { { echo "$as_me:10557: error: No curses header-files found" >&5 +echo "$as_me: error: No curses header-files found" >&2;} + { (exit 1); exit 1; }; } +fi + +# cheat, to get the right #define's for HAVE_NCURSES_H, etc. + +for ac_header in $cf_cv_ncurses_header +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:10567: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 10573 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:10577: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:10583: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:10602: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +echo "$as_me:10612: checking for terminfo header" >&5 +echo $ECHO_N "checking for terminfo header... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +case ${cf_cv_ncurses_header} in #(vi +*/ncurses.h|*/ncursesw.h) #(vi + cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[^.]*\.h$%term.h%'` + ;; +*) + cf_term_header=term.h + ;; +esac + +for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" +do +cat >conftest.$ac_ext <<_ACEOF +#line 10630 "configure" +#include "confdefs.h" +#include <stdio.h> +#include <${cf_cv_ncurses_header-curses.h}> +#include <$cf_test> + +int +main () +{ +int x = auto_left_margin + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10645: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10648: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10651: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10654: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_term_header="$cf_test" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_term_header=unknown + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_term_header" != unknown && break +done + +fi +echo "$as_me:10670: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 + +# Set definitions to allow ifdef'ing to accommodate subdirectories + +case $cf_cv_term_header in # (vi +*term.h) + cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +esac + +case $cf_cv_term_header in # (vi +ncurses/term.h) #(vi + cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +ncursesw/term.h) + cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + +echo "$as_me:10699: checking for ncurses version" >&5 +echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 +if test "${cf_cv_ncurses_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_ncurses_version=no + cf_tempfile=out$$ + rm -f $cf_tempfile + if test "$cross_compiling" = yes; then + + # This will not work if the preprocessor splits the line after the + # Autoconf token. The 'unproto' program does that. + cat > conftest.$ac_ext <<EOF +#include <${cf_cv_ncurses_header-curses.h}> +#undef Autoconf +#ifdef NCURSES_VERSION +Autoconf NCURSES_VERSION +#else +#ifdef __NCURSES_H +Autoconf "old" +#endif +; +#endif +EOF + cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" + { (eval echo "$as_me:10725: \"$cf_try\"") >&5 + (eval $cf_try) 2>&5 + ac_status=$? + echo "$as_me:10728: \$? = $ac_status" >&5 + (exit $ac_status); } + if test -f conftest.out ; then + cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` + test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" + rm -f conftest.out + fi + +else + cat >conftest.$ac_ext <<_ACEOF +#line 10738 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header-curses.h}> +#include <stdio.h> +int main() +{ + FILE *fp = fopen("$cf_tempfile", "w"); +#ifdef NCURSES_VERSION +# ifdef NCURSES_VERSION_PATCH + fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH); +# else + fprintf(fp, "%s\n", NCURSES_VERSION); +# endif +#else +# ifdef __NCURSES_H + fprintf(fp, "old\n"); +# else + make an error +# endif +#endif + ${cf_cv_main_return-return}(0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:10763: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10766: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:10768: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10771: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_ncurses_version=`cat $cf_tempfile` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + rm -f $cf_tempfile + +fi +echo "$as_me:10785: result: $cf_cv_ncurses_version" >&5 +echo "${ECHO_T}$cf_cv_ncurses_version" >&6 +test "$cf_cv_ncurses_version" = no || cat >>confdefs.h <<\EOF +#define NCURSES 1 +EOF + +echo "$as_me:10791: checking if we have identified curses libraries" >&5 +echo $ECHO_N "checking if we have identified curses libraries... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line 10794 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ +initscr(); tgoto("?", 0,0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10806: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10809: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10812: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10815: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +echo "$as_me:10824: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + +if test "$cf_result" = no ; then +case $host_os in #(vi +freebsd*) #(vi + echo "$as_me:10830: checking for tgoto in -lmytinfo" >&5 +echo $ECHO_N "checking for tgoto in -lmytinfo... $ECHO_C" >&6 +if test "${ac_cv_lib_mytinfo_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmytinfo $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 10838 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); +int +main () +{ +tgoto (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10857: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10860: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10863: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10866: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mytinfo_tgoto=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_mytinfo_tgoto=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:10877: result: $ac_cv_lib_mytinfo_tgoto" >&5 +echo "${ECHO_T}$ac_cv_lib_mytinfo_tgoto" >&6 +if test $ac_cv_lib_mytinfo_tgoto = yes; then + LIBS="-lmytinfo $LIBS" +fi + + ;; +hpux10.*) #(vi + echo "$as_me:10885: checking for initscr in -lcur_colr" >&5 +echo $ECHO_N "checking for initscr in -lcur_colr... $ECHO_C" >&6 +if test "${ac_cv_lib_cur_colr_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcur_colr $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 10893 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main () +{ +initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10912: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10915: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10918: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10921: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_cur_colr_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_cur_colr_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:10932: result: $ac_cv_lib_cur_colr_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_cur_colr_initscr" >&6 +if test $ac_cv_lib_cur_colr_initscr = yes; then + + LIBS="-lcur_colr $LIBS" + ac_cv_func_initscr=yes + +else + + echo "$as_me:10941: checking for initscr in -lHcurses" >&5 +echo $ECHO_N "checking for initscr in -lHcurses... $ECHO_C" >&6 +if test "${ac_cv_lib_Hcurses_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lHcurses $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 10949 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main () +{ +initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10968: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10971: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10974: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10977: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Hcurses_initscr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Hcurses_initscr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:10988: result: $ac_cv_lib_Hcurses_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_Hcurses_initscr" >&6 +if test $ac_cv_lib_Hcurses_initscr = yes; then + + # HP's header uses __HP_CURSES, but user claims _HP_CURSES. + LIBS="-lHcurses $LIBS" + CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES" + ac_cv_func_initscr=yes + +fi + +fi + + ;; +linux*) # Suse Linux does not follow /usr/lib convention + +if test -n "/lib" ; then + for cf_add_libdir in /lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me-configure}:11023: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + ;; +sunos3*|sunos4*) + if test -d /usr/5lib ; then + +if test -n "/usr/5lib" ; then + for cf_add_libdir in /usr/5lib + do + if test $cf_add_libdir = /usr/lib ; then + : + elif test -d $cf_add_libdir + then + cf_have_libdir=no + if test -n "$LDFLAGS$LIBS" ; then + # a loop is needed to ensure we can add subdirs of existing dirs + for cf_test_libdir in $LDFLAGS $LIBS ; do + if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then + cf_have_libdir=yes; break + fi + done + fi + if test "$cf_have_libdir" = no ; then + test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 + +echo "${as_me-configure}:11054: testing adding $cf_add_libdir to library-path ..." 1>&5 + + LDFLAGS="-L$cf_add_libdir $LDFLAGS" + fi + fi + done +fi + + LIBS="$LIBS -lcurses -ltermcap" + fi + ac_cv_func_initscr=yes + ;; +esac + +if test ".$ac_cv_func_initscr" != .yes ; then + cf_save_LIBS="$LIBS" + cf_term_lib="" + cf_curs_lib="" + + if test ".${cf_cv_ncurses_version-no}" != .no + then + cf_check_list="ncurses curses cursesX" + else + cf_check_list="cursesX curses ncurses" + fi + + # Check for library containing tgoto. Do this before curses library + # because it may be needed to link the test-case for initscr. + echo "$as_me:11082: checking for tgoto" >&5 +echo $ECHO_N "checking for tgoto... $ECHO_C" >&6 +if test "${ac_cv_func_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11088 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char tgoto (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_tgoto) || defined (__stub___tgoto) +choke me +#else +f = tgoto; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11119: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11122: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11125: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11128: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_tgoto=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_tgoto=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:11138: result: $ac_cv_func_tgoto" >&5 +echo "${ECHO_T}$ac_cv_func_tgoto" >&6 +if test $ac_cv_func_tgoto = yes; then + cf_term_lib=predefined +else + + for cf_term_lib in $cf_check_list termcap termlib unknown + do + as_ac_Lib=`echo "ac_cv_lib_$cf_term_lib''_tgoto" | $as_tr_sh` +echo "$as_me:11147: checking for tgoto in -l$cf_term_lib" >&5 +echo $ECHO_N "checking for tgoto in -l$cf_term_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$cf_term_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11155 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgoto (); +int +main () +{ +tgoto (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11174: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11177: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11180: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11183: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Lib=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11194: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + break +fi + + done + +fi + + # Check for library containing initscr + test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS" + for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown + do + as_ac_Lib=`echo "ac_cv_lib_$cf_curs_lib''_initscr" | $as_tr_sh` +echo "$as_me:11209: checking for initscr in -l$cf_curs_lib" >&5 +echo $ECHO_N "checking for initscr in -l$cf_curs_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$cf_curs_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11217 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char initscr (); +int +main () +{ +initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11236: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11239: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11242: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11245: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Lib=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11256: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + break +fi + + done + test $cf_curs_lib = unknown && { { echo "$as_me:11263: error: no curses library found" >&5 +echo "$as_me: error: no curses library found" >&2;} + { (exit 1); exit 1; }; } + + LIBS="-l$cf_curs_lib $cf_save_LIBS" + if test "$cf_term_lib" = unknown ; then + echo "$as_me:11269: checking if we can link with $cf_curs_lib library" >&5 +echo $ECHO_N "checking if we can link with $cf_curs_lib library... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 11272 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11284: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11287: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11290: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11293: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:11302: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + test $cf_result = no && { { echo "$as_me:11304: error: Cannot link curses library" >&5 +echo "$as_me: error: Cannot link curses library" >&2;} + { (exit 1); exit 1; }; } + elif test "$cf_curs_lib" = "$cf_term_lib" ; then + : + elif test "$cf_term_lib" != predefined ; then + echo "$as_me:11310: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 +echo $ECHO_N "checking if we need both $cf_curs_lib and $cf_term_lib libraries... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 11313 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ +initscr(); tgoto((char *)0, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11325: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11328: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11331: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11334: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 11343 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ +initscr() + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11355: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11358: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11361: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11364: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=error +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:11376: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + fi +fi +fi + +fi + +cf_all_widgets=yes + +echo "$as_me:11386: checking if you want extra dialogs" >&5 +echo $ECHO_N "checking if you want extra dialogs... $ECHO_C" >&6 + +# Check whether --enable-extras or --disable-extras was given. +if test "${enable_extras+set}" = set; then + enableval="$enable_extras" + +else + enableval=yes +fi; +echo "$as_me:11396: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 +if test "$enableval" != no ; then +cf_all_widgets=yes +else +cf_all_widgets=no +fi + +echo "$as_me:11404: checking if you want config-file support" >&5 +echo $ECHO_N "checking if you want config-file support... $ECHO_C" >&6 + +# Check whether --enable-rc-file or --disable-rc-file was given. +if test "${enable_rc_file+set}" = set; then + enableval="$enable_rc_file" + +else + enableval=$cf_all_widgets +fi; +echo "$as_me:11414: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 +if test "$enableval" != no ; then +EXTRAOBJS="$EXTRAOBJS rc\$o" + cat >>confdefs.h <<\EOF +#define HAVE_RC_FILE 1 +EOF + +else + : +fi + +echo "$as_me:11426: checking if you want Xdialog-style dialogs" >&5 +echo $ECHO_N "checking if you want Xdialog-style dialogs... $ECHO_C" >&6 + +# Check whether --enable-Xdialog or --disable-Xdialog was given. +if test "${enable_Xdialog+set}" = set; then + enableval="$enable_Xdialog" + +else + enableval=$cf_all_widgets +fi; +echo "$as_me:11436: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 +if test "$enableval" != no ; then +EXTRAOBJS="$EXTRAOBJS calendar\$o fselect\$o timebox\$o" + cat >>confdefs.h <<\EOF +#define HAVE_XDIALOG 1 +EOF + +else + : +fi + +echo "$as_me:11448: checking if you want the form dialog" >&5 +echo $ECHO_N "checking if you want the form dialog... $ECHO_C" >&6 + +# Check whether --enable-form or --disable-form was given. +if test "${enable_form+set}" = set; then + enableval="$enable_form" + +else + enableval=$cf_all_widgets +fi; +echo "$as_me:11458: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 +if test "$enableval" != no ; then +EXTRAOBJS="$EXTRAOBJS formbox\$o" + cat >>confdefs.h <<\EOF +#define HAVE_DLG_FORMBOX 1 +EOF + +else + : +fi + +echo "$as_me:11470: checking if you want the gauge dialog" >&5 +echo $ECHO_N "checking if you want the gauge dialog... $ECHO_C" >&6 + +# Check whether --enable-gauge or --disable-gauge was given. +if test "${enable_gauge+set}" = set; then + enableval="$enable_gauge" + +else + enableval=$cf_all_widgets +fi; +echo "$as_me:11480: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 +if test "$enableval" != no ; then +EXTRAOBJS="$EXTRAOBJS guage\$o pause\$o progressbox\$o" + cat >>confdefs.h <<\EOF +#define HAVE_DLG_GAUGE 1 +EOF + +else + : +fi + +echo "$as_me:11492: checking if you want the tailbox dialog" >&5 +echo $ECHO_N "checking if you want the tailbox dialog... $ECHO_C" >&6 + +# Check whether --enable-tailbox or --disable-tailbox was given. +if test "${enable_tailbox+set}" = set; then + enableval="$enable_tailbox" + +else + enableval=$cf_all_widgets +fi; +echo "$as_me:11502: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 +if test "$enableval" != no ; then +EXTRAOBJS="$EXTRAOBJS tailbox\$o" + cat >>confdefs.h <<\EOF +#define HAVE_DLG_TAILBOX 1 +EOF + +else + : +fi + +echo "$as_me:11514: checking if you want the mixedform dialog" >&5 +echo $ECHO_N "checking if you want the mixedform dialog... $ECHO_C" >&6 + +# Check whether --enable-mixedform or --disable-mixedform was given. +if test "${enable_mixedform+set}" = set; then + enableval="$enable_mixedform" + +else + enableval=$cf_all_widgets +fi; +echo "$as_me:11524: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 +if test "$enableval" != no ; then +EXTRAOBJS="$EXTRAOBJS mixedform\$o" + cat >>confdefs.h <<\EOF +#define HAVE_DLG_MIXEDFORM 1 +EOF + +else + : +fi + +echo "$as_me:11536: checking if you want the mixedgauge dialog" >&5 +echo $ECHO_N "checking if you want the mixedgauge dialog... $ECHO_C" >&6 + +# Check whether --enable-mixedgauge or --disable-mixedgauge was given. +if test "${enable_mixedgauge+set}" = set; then + enableval="$enable_mixedgauge" + +else + enableval=$cf_all_widgets +fi; +echo "$as_me:11546: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 +if test "$enableval" != no ; then +EXTRAOBJS="$EXTRAOBJS mixedgauge\$o" + cat >>confdefs.h <<\EOF +#define HAVE_MIXEDGAUGE 1 +EOF + +else + : +fi + +echo "$as_me:11558: checking if you want the wide-curses features" >&5 +echo $ECHO_N "checking if you want the wide-curses features... $ECHO_C" >&6 + +# Check whether --enable-widec or --disable-widec was given. +if test "${enable_widec+set}" = set; then + enableval="$enable_widec" + +else + enableval=$cf_wide_curses +fi; +echo "$as_me:11568: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 +if test "$enableval" != no ; then +cat >>confdefs.h <<\EOF +#define USE_WIDE_CURSES 1 +EOF + +else + : +fi + +echo "$as_me:11579: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11585 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +_ACEOF +if { (eval echo "$as_me:11593: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:11599: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 11621 "configure" +#include "confdefs.h" +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 11639 "configure" +#include "confdefs.h" +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line 11660 "configure" +#include "confdefs.h" +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + $ac_main_return(2); + $ac_main_return (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:11686: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11689: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:11691: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11694: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:11707: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo "$as_me:11717: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11723 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <time.h> + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:11739: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:11742: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:11745: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11748: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_time=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_time=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:11758: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 +if test $ac_cv_header_time = yes; then + +cat >>confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +echo "$as_me:11771: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11777 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <$ac_hdr> + +int +main () +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:11792: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:11795: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:11798: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11801: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:11811: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +EOF + +ac_header_dirent=$ac_hdr; break +fi + +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + echo "$as_me:11824: checking for opendir in -ldir" >&5 +echo $ECHO_N "checking for opendir in -ldir... $ECHO_C" >&6 +if test "${ac_cv_lib_dir_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldir $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11832 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11851: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11854: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11857: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11860: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dir_opendir=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dir_opendir=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11871: result: $ac_cv_lib_dir_opendir" >&5 +echo "${ECHO_T}$ac_cv_lib_dir_opendir" >&6 +if test $ac_cv_lib_dir_opendir = yes; then + LIBS="$LIBS -ldir" +fi + +else + echo "$as_me:11878: checking for opendir in -lx" >&5 +echo $ECHO_N "checking for opendir in -lx... $ECHO_C" >&6 +if test "${ac_cv_lib_x_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lx $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11886 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11905: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11908: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11911: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11914: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_x_opendir=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_x_opendir=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11925: result: $ac_cv_lib_x_opendir" >&5 +echo "${ECHO_T}$ac_cv_lib_x_opendir" >&6 +if test $ac_cv_lib_x_opendir = yes; then + LIBS="$LIBS -lx" +fi + +fi + +for ac_header in search.h unctrl.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:11936: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11942 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:11946: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:11952: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:11971: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +echo "$as_me:11981: checking for term.h" >&5 +echo $ECHO_N "checking for term.h... $ECHO_C" >&6 +if test "${cf_cv_term_header+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look +# for <term.h> if we do not find the variant. +for cf_header in \ + `echo ${cf_cv_ncurses_header-curses.h} | sed -e 's%/.*%/%'`term.h \ + term.h +do + cat >conftest.$ac_ext <<_ACEOF +#line 11994 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header-curses.h}> +#include <${cf_header}> +int +main () +{ +WINDOW *x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12008: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12011: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12014: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12017: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_term_header=$cf_header + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_term_header=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +case $cf_cv_term_header in #(vi +no) + # If curses is ncurses, some packagers still mess it up by trying to make + # us use GNU termcap. This handles the most common case. + for cf_header in ncurses/term.h ncursesw/term.h + do + cat >conftest.$ac_ext <<_ACEOF +#line 12036 "configure" +#include "confdefs.h" + +#include <${cf_cv_ncurses_header-curses.h}> +#ifdef NCURSES_VERSION +#include <${cf_header}> +#else +make an error +#endif +int +main () +{ +WINDOW *x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12054: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12057: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12060: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12063: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_term_header=$cf_header + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_term_header=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + done + ;; +esac + +fi +echo "$as_me:12078: result: $cf_cv_term_header" >&5 +echo "${ECHO_T}$cf_cv_term_header" >&6 + +case $cf_cv_term_header in #(vi +term.h) #(vi + cat >>confdefs.h <<\EOF +#define HAVE_TERM_H 1 +EOF + + ;; +ncurses/term.h) #(vi + cat >>confdefs.h <<\EOF +#define HAVE_NCURSES_TERM_H 1 +EOF + + ;; +ncursesw/term.h) + cat >>confdefs.h <<\EOF +#define HAVE_NCURSESW_TERM_H 1 +EOF + + ;; +esac + +echo "$as_me:12102: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 12108 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <signal.h> +#ifdef signal +# undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12130: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12133: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12136: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12139: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_signal=void +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_signal=int +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:12149: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<EOF +#define RETSIGTYPE $ac_cv_type_signal +EOF + +for ac_func in \ +_nc_free_and_exit \ +strcasecmp \ +strftime \ +tsearch \ +waitpid \ + +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:12165: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 12171 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12202: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12205: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12208: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12211: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:12221: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +EOF + +fi +done + +echo "$as_me:12231: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5 +echo $ECHO_N "checking if we must define _XOPEN_SOURCE_EXTENDED... $ECHO_C" >&6 +if test "${cf_cv_need_xopen_extension+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 12238 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ + +#if defined(NCURSES_VERSION_PATCH) +if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403) + make an error +#endif +#endif + long x = winnstr(stdscr, "", 0); + int x1, y1; + getbegyx(stdscr, y1, x1) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12260: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12263: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12266: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12269: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_need_xopen_extension=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cat >conftest.$ac_ext <<_ACEOF +#line 12276 "configure" +#include "confdefs.h" + +#define _XOPEN_SOURCE_EXTENDED +#include <stdlib.h> +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ + +#ifdef NCURSES_VERSION + cchar_t check; + int check2 = curs_set((int)sizeof(check)); +#endif + long x = winnstr(stdscr, "", 0); + int x1, y1; + getbegyx(stdscr, y1, x1) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12298: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12301: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12304: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12307: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_need_xopen_extension=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_need_xopen_extension=unknown +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:12319: result: $cf_cv_need_xopen_extension" >&5 +echo "${ECHO_T}$cf_cv_need_xopen_extension" >&6 +test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" + +for cf_func in \ +flushinp \ +getbegx \ +getbegy \ +getbegyx \ +getcurx \ +getcury \ +getmaxx \ +getmaxy \ +getmaxyx \ +getparx \ +getpary \ +getparyx \ +use_default_colors \ +wget_wch \ + +do + +cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + echo "$as_me:12343: checking for ${cf_func}" >&5 +echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6 + +echo "${as_me-configure}:12346: testing ${cf_func} ..." 1>&5 + + if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + eval cf_result='$ac_cv_func_'$cf_func + if test ".$cf_result" != ".no"; then + cat >conftest.$ac_ext <<_ACEOF +#line 12355 "configure" +#include "confdefs.h" + +#ifdef HAVE_XCURSES +#include <xcurses.h> +char * XCursesProgramName = "test"; +#else +#include <${cf_cv_ncurses_header-curses.h}> +#if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H) +#include <ncursesw/term.h> +#elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H) +#include <ncurses/term.h> +#elif defined(HAVE_TERM_H) +#include <term.h> +#endif +#endif + +int +main () +{ + +#ifndef ${cf_func} +long foo = (long)(&${cf_func}); +${cf_cv_main_return-return}(foo == 0); +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12386: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12389: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12392: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12395: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + fi + eval 'cf_cv_func_'$cf_func'=$cf_result' + +fi + + # use the computed/retrieved cache-value: + eval 'cf_result=$cf_cv_func_'$cf_func + echo "$as_me:12411: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + if test $cf_result != no; then + cat >>confdefs.h <<EOF +#define HAVE_${cf_tr_func} 1 +EOF + + fi +done + +echo "$as_me:12421: checking for start_color" >&5 +echo $ECHO_N "checking for start_color... $ECHO_C" >&6 +if test "${ac_cv_func_start_color+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 12427 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char start_color (); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char start_color (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_start_color) || defined (__stub___start_color) +choke me +#else +f = start_color; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12458: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12461: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12464: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12467: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_start_color=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_start_color=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:12477: result: $ac_cv_func_start_color" >&5 +echo "${ECHO_T}$ac_cv_func_start_color" >&6 +if test $ac_cv_func_start_color = yes; then + cat >>confdefs.h <<\EOF +#define HAVE_COLOR 1 +EOF + +fi + +echo "$as_me:12486: checking for chtype typedef" >&5 +echo $ECHO_N "checking for chtype typedef... $ECHO_C" >&6 +if test "${cf_cv_chtype_decl+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 12493 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ +chtype foo + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12505: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12508: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12511: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12514: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_chtype_decl=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_chtype_decl=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:12524: result: $cf_cv_chtype_decl" >&5 +echo "${ECHO_T}$cf_cv_chtype_decl" >&6 +if test $cf_cv_chtype_decl = yes ; then + cat >>confdefs.h <<\EOF +#define HAVE_TYPE_CHTYPE 1 +EOF + + echo "$as_me:12531: checking if chtype is scalar or struct" >&5 +echo $ECHO_N "checking if chtype is scalar or struct... $ECHO_C" >&6 +if test "${cf_cv_chtype_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 12538 "configure" +#include "confdefs.h" +#include <${cf_cv_ncurses_header-curses.h}> +int +main () +{ +chtype foo; long x = foo + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12550: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12553: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12556: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12559: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_chtype_type=scalar +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_chtype_type=struct +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:12569: result: $cf_cv_chtype_type" >&5 +echo "${ECHO_T}$cf_cv_chtype_type" >&6 + if test $cf_cv_chtype_type = scalar ; then + cat >>confdefs.h <<\EOF +#define TYPE_CHTYPE_IS_SCALAR 1 +EOF + + fi +fi + +for ac_header in sys/wait.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:12582: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 12588 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:12592: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:12598: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:12617: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +cf_wait_headers="#include <sys/types.h> +" +if test $ac_cv_header_sys_wait_h = yes; then +cf_wait_headers="$cf_wait_headers +#include <sys/wait.h> +" +else + +for ac_header in wait.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:12638: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 12644 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:12648: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:12654: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:12673: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +for ac_header in waitstatus.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:12686: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 12692 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:12696: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:12702: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:12721: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<EOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +EOF + +fi +done + +if test $ac_cv_header_wait_h = yes; then +cf_wait_headers="$cf_wait_headers +#include <wait.h> +" +fi +if test $ac_cv_header_waitstatus_h = yes; then +cf_wait_headers="$cf_wait_headers +#include <waitstatus.h> +" +fi +fi + +echo "$as_me:12743: checking for union wait" >&5 +echo $ECHO_N "checking for union wait... $ECHO_C" >&6 +if test "${cf_cv_type_unionwait+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 12750 "configure" +#include "confdefs.h" +$cf_wait_headers +int +main () +{ +int x; + int y = WEXITSTATUS(x); + int z = WTERMSIG(x); + wait(&x); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12766: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12769: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12772: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12775: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_type_unionwait=no + echo compiles ok w/o union wait 1>&5 + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 12785 "configure" +#include "confdefs.h" +$cf_wait_headers +int +main () +{ +union wait x; +#ifdef WEXITSTATUS + int y = WEXITSTATUS(x); +#endif +#ifdef WTERMSIG + int z = WTERMSIG(x); +#endif + wait(&x); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12805: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12808: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12811: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12814: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_type_unionwait=yes + echo compiles ok with union wait and possibly macros too 1>&5 + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_type_unionwait=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi + +echo "$as_me:12829: result: $cf_cv_type_unionwait" >&5 +echo "${ECHO_T}$cf_cv_type_unionwait" >&6 +test $cf_cv_type_unionwait = yes && cat >>confdefs.h <<\EOF +#define HAVE_TYPE_UNIONWAIT 1 +EOF + +if test $cf_cv_type_unionwait = yes; then + + echo "$as_me:12837: checking if union wait can be used as wait-arg" >&5 +echo $ECHO_N "checking if union wait can be used as wait-arg... $ECHO_C" >&6 + if test "${cf_cv_arg_union_wait+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 12844 "configure" +#include "confdefs.h" +$cf_wait_headers +int +main () +{ +union wait x; wait(&x) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12856: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12859: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12862: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12865: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_arg_union_wait=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_arg_union_wait=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi + + echo "$as_me:12877: result: $cf_cv_arg_union_wait" >&5 +echo "${ECHO_T}$cf_cv_arg_union_wait" >&6 + test $cf_cv_arg_union_wait = yes && cat >>confdefs.h <<\EOF +#define WAIT_USES_UNION 1 +EOF + + echo "$as_me:12883: checking if union wait can be used as waitpid-arg" >&5 +echo $ECHO_N "checking if union wait can be used as waitpid-arg... $ECHO_C" >&6 + if test "${cf_cv_arg_union_waitpid+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 12890 "configure" +#include "confdefs.h" +$cf_wait_headers +int +main () +{ +union wait x; waitpid(0, &x, 0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12902: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12905: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12908: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12911: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_arg_union_waitpid=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_arg_union_waitpid=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi + + echo "$as_me:12923: result: $cf_cv_arg_union_waitpid" >&5 +echo "${ECHO_T}$cf_cv_arg_union_waitpid" >&6 + test $cf_cv_arg_union_waitpid = yes && cat >>confdefs.h <<\EOF +#define WAITPID_USES_UNION 1 +EOF + +fi + +echo "$as_me:12931: checking if we must include wchar.h to declare mbstate_t" >&5 +echo $ECHO_N "checking if we must include wchar.h to declare mbstate_t... $ECHO_C" >&6 +if test "${cf_cv_mbstate_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 12938 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <stdio.h> +#ifdef HAVE_LIBUTF8_H +#include <libutf8.h> +#endif +int +main () +{ +mbstate_t state + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12955: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12958: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12961: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12964: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_mbstate_t=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cat >conftest.$ac_ext <<_ACEOF +#line 12971 "configure" +#include "confdefs.h" + +#include <stdlib.h> +#include <stdio.h> +#include <wchar.h> +#ifdef HAVE_LIBUTF8_H +#include <libutf8.h> +#endif +int +main () +{ +mbstate_t value + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12989: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12992: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12995: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12998: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_mbstate_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_mbstate_t=unknown +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:13010: result: $cf_cv_mbstate_t" >&5 +echo "${ECHO_T}$cf_cv_mbstate_t" >&6 + +if test "$cf_cv_mbstate_t" = yes ; then + cat >>confdefs.h <<\EOF +#define NEED_WCHAR_H 1 +EOF + +fi + +if test "$cf_cv_mbstate_t" != unknown ; then + cat >>confdefs.h <<\EOF +#define HAVE_MBSTATE_T 1 +EOF + +fi + +PACKAGE_PREFIX=DLG +PACKAGE_CONFIG=dlg_config.h + +EXTRA_OUTPUT="$EXTRA_OUTPUT headers-sh:$srcdir/headers-sh.in" + +cat >conftest.$ac_ext <<_ACEOF +#line 13033 "configure" +#include "confdefs.h" +#include <locale.h> +int +main () +{ +setlocale(LC_ALL, "") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13045: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13048: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13051: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13054: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cat >>confdefs.h <<\EOF +#define HAVE_SETLOCALE 1 +EOF + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +LD_RPATH_OPT= +echo "$as_me:13067: checking for an rpath option" >&5 +echo $ECHO_N "checking for an rpath option... $ECHO_C" >&6 +case $cf_cv_system_name in #(vi +irix*) #(vi + if test "$GCC" = yes; then + LD_RPATH_OPT="-Wl,-rpath," + else + LD_RPATH_OPT="-rpath " + fi + ;; +linux*|gnu*|k*bsd*-gnu) #(vi + LD_RPATH_OPT="-Wl,-rpath," + ;; +openbsd[2-9].*) #(vi + LD_RPATH_OPT="-Wl,-rpath," + ;; +freebsd*) #(vi + LD_RPATH_OPT="-rpath " + ;; +netbsd*) #(vi + LD_RPATH_OPT="-Wl,-rpath," + ;; +osf*|mls+*) #(vi + LD_RPATH_OPT="-rpath " + ;; +solaris2*) #(vi + LD_RPATH_OPT="-R" + ;; +*) + ;; +esac +echo "$as_me:13098: result: $LD_RPATH_OPT" >&5 +echo "${ECHO_T}$LD_RPATH_OPT" >&6 + +case "x$LD_RPATH_OPT" in #(vi +x-R*) + echo "$as_me:13103: checking if we need a space after rpath option" >&5 +echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6 + cf_save_LIBS="$LIBS" + LIBS="${LD_RPATH_OPT}$libdir $LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 13108 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13120: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13123: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13126: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13129: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_rpath_space=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_rpath_space=yes +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS="$cf_save_LIBS" + echo "$as_me:13139: result: $cf_rpath_space" >&5 +echo "${ECHO_T}$cf_rpath_space" >&6 + test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " + ;; +esac + +echo "$as_me:13145: checking if rpath should be not be set" >&5 +echo $ECHO_N "checking if rpath should be not be set... $ECHO_C" >&6 + +# Check whether --enable-rpath-hack or --disable-rpath-hack was given. +if test "${enable_rpath_hack+set}" = set; then + enableval="$enable_rpath_hack" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + cf_disable_rpath_hack=yes + else + cf_disable_rpath_hack=no + fi +else + enableval=yes + cf_disable_rpath_hack=no + +fi; +echo "$as_me:13162: result: $cf_disable_rpath_hack" >&5 +echo "${ECHO_T}$cf_disable_rpath_hack" >&6 +if test "$cf_disable_rpath_hack" = no ; then + +echo "$as_me:13166: checking for updated LDFLAGS" >&5 +echo $ECHO_N "checking for updated LDFLAGS... $ECHO_C" >&6 +if test -n "$LD_RPATH_OPT" ; then + echo "$as_me:13169: result: maybe" >&5 +echo "${ECHO_T}maybe" >&6 + + for ac_prog in ldd +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:13176: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_cf_ldd_prog+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$cf_ldd_prog"; then + ac_cv_prog_cf_ldd_prog="$cf_ldd_prog" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_cf_ldd_prog="$ac_prog" +echo "$as_me:13191: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +cf_ldd_prog=$ac_cv_prog_cf_ldd_prog +if test -n "$cf_ldd_prog"; then + echo "$as_me:13199: result: $cf_ldd_prog" >&5 +echo "${ECHO_T}$cf_ldd_prog" >&6 +else + echo "$as_me:13202: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$cf_ldd_prog" && break +done +test -n "$cf_ldd_prog" || cf_ldd_prog="no" + + cf_rpath_list="/usr/lib /lib" + if test "$cf_ldd_prog" != no + then +cat >conftest.$ac_ext <<_ACEOF +#line 13214 "configure" +#include "confdefs.h" +#include <stdio.h> +int +main () +{ +printf("Hello"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13226: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13229: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13232: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13235: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[ ]/%/%' -e 's%/[^/][^/]*$%%' |sort -u` +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + fi + + test -n "$verbose" && echo " ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 + +echo "${as_me-configure}:13247: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 + +test -n "$verbose" && echo " ...checking LDFLAGS $LDFLAGS" 1>&6 + +echo "${as_me-configure}:13251: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5 + +cf_rpath_dst= +for cf_rpath_src in $LDFLAGS +do + case $cf_rpath_src in #(vi + -L*) #(vi + + # check if this refers to a directory which we will ignore + cf_rpath_skip=no + if test -n "$cf_rpath_list" + then + for cf_rpath_item in $cf_rpath_list + do + if test "x$cf_rpath_src" = "x-L$cf_rpath_item" + then + cf_rpath_skip=yes + break + fi + done + fi + + if test "$cf_rpath_skip" = no + then + # transform the option + if test "$LD_RPATH_OPT" = "-R " ; then + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` + else + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` + fi + + # if we have not already added this, add it now + cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` + if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" + then + test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 + +echo "${as_me-configure}:13288: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 + + EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" + fi + fi + ;; + esac + cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" +done +LDFLAGS=$cf_rpath_dst + +test -n "$verbose" && echo " ...checked LDFLAGS $LDFLAGS" 1>&6 + +echo "${as_me-configure}:13301: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5 + +test -n "$verbose" && echo " ...checking LIBS $LIBS" 1>&6 + +echo "${as_me-configure}:13305: testing ...checking LIBS $LIBS ..." 1>&5 + +cf_rpath_dst= +for cf_rpath_src in $LIBS +do + case $cf_rpath_src in #(vi + -L*) #(vi + + # check if this refers to a directory which we will ignore + cf_rpath_skip=no + if test -n "$cf_rpath_list" + then + for cf_rpath_item in $cf_rpath_list + do + if test "x$cf_rpath_src" = "x-L$cf_rpath_item" + then + cf_rpath_skip=yes + break + fi + done + fi + + if test "$cf_rpath_skip" = no + then + # transform the option + if test "$LD_RPATH_OPT" = "-R " ; then + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` + else + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` + fi + + # if we have not already added this, add it now + cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` + if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" + then + test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 + +echo "${as_me-configure}:13342: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 + + EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" + fi + fi + ;; + esac + cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" +done +LIBS=$cf_rpath_dst + +test -n "$verbose" && echo " ...checked LIBS $LIBS" 1>&6 + +echo "${as_me-configure}:13355: testing ...checked LIBS $LIBS ..." 1>&5 + + test -n "$verbose" && echo " ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 + +echo "${as_me-configure}:13359: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 + +fi + +fi + +ac_config_files="$ac_config_files dialog-config makefile $EXTRA_OUTPUT $SUB_MAKEFILE samples/install/makefile" +ac_config_commands="$ac_config_commands default" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:13446: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to <bug-autoconf@gnu.org>." +EOF + +cat >>$CONFIG_STATUS <<EOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.52.20100320, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +EOF + +cat >>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <<EOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +EOF +cat >>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:13622: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:13641: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52.20100320, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<EOF +# +# INIT-COMMANDS section. +# + +EOF + +cat >>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "dialog-config" ) CONFIG_FILES="$CONFIG_FILES dialog-config" ;; + "makefile" ) CONFIG_FILES="$CONFIG_FILES makefile" ;; + "$EXTRA_OUTPUT" ) CONFIG_FILES="$CONFIG_FILES $EXTRA_OUTPUT" ;; + "$SUB_MAKEFILE" ) CONFIG_FILES="$CONFIG_FILES $SUB_MAKEFILE" ;; + "samples/install/makefile" ) CONFIG_FILES="$CONFIG_FILES samples/install/makefile" ;; + "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "dlg_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS dlg_config.h:config.hin" ;; + *) { { echo "$as_me:13691: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <<EOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@VERSION@,$VERSION,;t t +s,@VERSION_MAJOR@,$VERSION_MAJOR,;t t +s,@VERSION_MINOR@,$VERSION_MINOR,;t t +s,@VERSION_PATCH@,$VERSION_PATCH,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@DESTDIR@,$DESTDIR,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@AR@,$AR,;t t +s,@ac_ct_AR@,$ac_ct_AR,;t t +s,@cf_cv_makeflags@,$cf_cv_makeflags,;t t +s,@CTAGS@,$CTAGS,;t t +s,@ETAGS@,$ETAGS,;t t +s,@MAKE_LOWER_TAGS@,$MAKE_LOWER_TAGS,;t t +s,@MAKE_UPPER_TAGS@,$MAKE_UPPER_TAGS,;t t +s,@ECHO_LT@,$ECHO_LT,;t t +s,@ECHO_LD@,$ECHO_LD,;t t +s,@RULE_CC@,$RULE_CC,;t t +s,@SHOW_CC@,$SHOW_CC,;t t +s,@ECHO_CC@,$ECHO_CC,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@PROG_EXT@,$PROG_EXT,;t t +s,@LIB_PREFIX@,$LIB_PREFIX,;t t +s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t +s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t +s,@CONFIG_H@,$CONFIG_H,;t t +s,@ALLOCA@,$ALLOCA,;t t +s,@GLIBC21@,$GLIBC21,;t t +s,@LIBICONV@,$LIBICONV,;t t +s,@USE_NLS@,$USE_NLS,;t t +s,@MSGFMT@,$MSGFMT,;t t +s,@GMSGFMT@,$GMSGFMT,;t t +s,@XGETTEXT@,$XGETTEXT,;t t +s,@INTLBISON@,$INTLBISON,;t t +s,@BUILD_INCLUDED_LIBINTL@,$BUILD_INCLUDED_LIBINTL,;t t +s,@USE_INCLUDED_LIBINTL@,$USE_INCLUDED_LIBINTL,;t t +s,@CATALOGS@,$CATALOGS,;t t +s,@CATOBJEXT@,$CATOBJEXT,;t t +s,@GMOFILES@,$GMOFILES,;t t +s,@INTLLIBS@,$INTLLIBS,;t t +s,@INTLOBJS@,$INTLOBJS,;t t +s,@POFILES@,$POFILES,;t t +s,@POSUB@,$POSUB,;t t +s,@DATADIRNAME@,$DATADIRNAME,;t t +s,@INSTOBJEXT@,$INSTOBJEXT,;t t +s,@GENCAT@,$GENCAT,;t t +s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t +s,@INTL_LIBTOOL_SUFFIX_PREFIX@,$INTL_LIBTOOL_SUFFIX_PREFIX,;t t +s,@MSG_DIR_MAKE@,$MSG_DIR_MAKE,;t t +s,@SUB_MAKEFILE@,$SUB_MAKEFILE,;t t +s,@INTLDIR_MAKE@,$INTLDIR_MAKE,;t t +s,@GT_YES@,$GT_YES,;t t +s,@GT_NO@,$GT_NO,;t t +s,@LINK_PREFIX@,$LINK_PREFIX,;t t +s,@LIBTOOL@,$LIBTOOL,;t t +s,@LT_UNDEF@,$LT_UNDEF,;t t +s,@LIBTOOL_CXX@,$LIBTOOL_CXX,;t t +s,@LIBTOOL_OPTS@,$LIBTOOL_OPTS,;t t +s,@LIB_CREATE@,$LIB_CREATE,;t t +s,@LIB_OBJECT@,$LIB_OBJECT,;t t +s,@LIB_SUFFIX@,$LIB_SUFFIX,;t t +s,@LIB_PREP@,$LIB_PREP,;t t +s,@LIB_CLEAN@,$LIB_CLEAN,;t t +s,@LIB_COMPILE@,$LIB_COMPILE,;t t +s,@LIB_LINK@,$LIB_LINK,;t t +s,@LIB_INSTALL@,$LIB_INSTALL,;t t +s,@LIB_UNINSTALL@,$LIB_UNINSTALL,;t t +s,@LIBTOOL_MAKE@,$LIBTOOL_MAKE,;t t +s,@NCURSES_CONFIG@,$NCURSES_CONFIG,;t t +s,@EXTRAOBJS@,$EXTRAOBJS,;t t +s,@PACKAGE_PREFIX@,$PACKAGE_PREFIX,;t t +s,@PACKAGE_CONFIG@,$PACKAGE_CONFIG,;t t +s,@cf_ldd_prog@,$cf_ldd_prog,;t t +s,@EXTRA_LDFLAGS@,$EXTRA_LDFLAGS,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:13980: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:13998: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:14011: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <<EOF + sed "$ac_vpsub +$extrasub +EOF +cat >>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_i turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_iA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_iB='\([ ]\),\1#\2define\3' +ac_iC=' ' +ac_iD='\4,;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:14077: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:14088: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:14101: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +EOF + +# Transform confdefs.h into a list of #define's. We won't use it as a sed +# script, but as data to insert where we see @DEFS@. We expect AC_SAVE_DEFS to +# be either 'cat' or 'sort'. +sort -u confdefs.h | uniq >conftest.vals + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +echo ' rm -f conftest.frag' >> $CONFIG_STATUS +while grep . conftest.vals >/dev/null +do + # Write chunks of a limited-size here document to conftest.frag. + echo ' cat >> conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals | sed -e 's/#ifdef.*/#if 0/' >> $CONFIG_STATUS + echo 'CEOF' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +# Run sed to substitute the contents of conftest.frag into $tmp/in at the +# marker @DEFS@. +echo ' cat >> conftest.edit <<CEOF +/@DEFS@/r conftest.frag +/@DEFS@/d +CEOF +sed -f conftest.edit $tmp/in > $tmp/out +rm -f $tmp/in +mv $tmp/out $tmp/in +rm -f conftest.edit conftest.frag +' >> $CONFIG_STATUS + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:14159: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + + case $ac_dest in + default-1 ) for ac_file in $CONFIG_FILES; do + + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + + # PO directories have a Makefile.in generated from Makefile.inn. + case "$ac_file" in */[Mm]akefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + ac_base=`basename $ac_file .in` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base" + sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base" + fi + ;; + esac + done ;; + esac +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + Property changes on: contrib/dialog/configure ___________________________________________________________________ Added: svn:executable + * Index: contrib/dialog/dlg_keys.c =================================================================== --- contrib/dialog/dlg_keys.c (revision 0) +++ contrib/dialog/dlg_keys.c (revision 0) @@ -0,0 +1,729 @@ +/* + * $Id: dlg_keys.c,v 1.26 2009/02/22 16:19:51 tom Exp $ + * + * dlg_keys.c -- runtime binding support for dialog + * + * Copyright 2006-2007,2009 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. + */ + +#include <dialog.h> +#include <dlg_keys.h> + +#define LIST_BINDINGS struct _list_bindings + +LIST_BINDINGS { + LIST_BINDINGS *link; + WINDOW *win; /* window on which widget gets input */ + const char *name; /* widget name */ + bool buttons; /* true only for dlg_register_buttons() */ + DLG_KEYS_BINDING *binding; /* list of bindings */ +}; + +static LIST_BINDINGS *all_bindings; +static const DLG_KEYS_BINDING end_keys_binding = END_KEYS_BINDING; + +/* + * For a given named widget's window, associate a binding table. + */ +void +dlg_register_window(WINDOW *win, const char *name, DLG_KEYS_BINDING * binding) +{ + LIST_BINDINGS *p, *q; + + for (p = all_bindings, q = 0; p != 0; q = p, p = p->link) { + if (p->win == win && !strcmp(p->name, name)) { + p->binding = binding; + return; + } + } + /* add built-in bindings at the end of the list (see compare_bindings). */ + if ((p = dlg_calloc(LIST_BINDINGS, 1)) != 0) { + p->win = win; + p->name = name; + p->binding = binding; + if (q != 0) + q->link = p; + else + all_bindings = p; + } +} + +/* + * Unlike dlg_lookup_key(), this looks for either widget-builtin or rc-file + * definitions, depending on whether 'win' is null. + */ +static int +key_is_bound(WINDOW *win, const char *name, int curses_key, int function_key) +{ + LIST_BINDINGS *p; + + for (p = all_bindings; p != 0; p = p->link) { + if (p->win == win && !dlg_strcmp(p->name, name)) { + int n; + for (n = 0; p->binding[n].is_function_key >= 0; ++n) { + if (p->binding[n].curses_key == curses_key + && p->binding[n].is_function_key == function_key) { + return TRUE; + } + } + } + } + return FALSE; +} + +/* + * Call this function after dlg_register_window(), for the list of button + * labels associated with the widget. + * + * Ensure that dlg_lookup_key() will not accidentally translate a key that + * we would like to use for a button abbreviation to some other key, e.g., + * h/j/k/l for navigation into a cursor key. Do this by binding the key + * to itself. + * + * See dlg_char_to_button(). + */ +void +dlg_register_buttons(WINDOW *win, const char *name, const char **buttons) +{ + int n; + LIST_BINDINGS *p; + DLG_KEYS_BINDING *q; + + if (buttons == 0) + return; + + for (n = 0; buttons[n] != 0; ++n) { + int curses_key = dlg_button_to_char(buttons[n]); + + /* ignore multibyte characters */ + if (curses_key >= KEY_MIN) + continue; + + /* if it is not bound in the widget, skip it (no conflicts) */ + if (!key_is_bound(win, name, curses_key, FALSE)) + continue; + +#ifdef HAVE_RC_FILE + /* if it is bound in the rc-file, skip it */ + if (key_is_bound(0, name, curses_key, FALSE)) + continue; +#endif + + if ((p = dlg_calloc(LIST_BINDINGS, 1)) != 0) { + if ((q = dlg_calloc(DLG_KEYS_BINDING, 2)) != 0) { + q[0].is_function_key = 0; + q[0].curses_key = curses_key; + q[0].dialog_key = curses_key; + q[1] = end_keys_binding; + + p->win = win; + p->name = name; + p->buttons = TRUE; + p->binding = q; + + /* put these at the beginning, to override the widget's table */ + p->link = all_bindings; + all_bindings = p; + } else { + free(p); + } + } + } +} + +/* + * Remove the bindings for a given window. + */ +void +dlg_unregister_window(WINDOW *win) +{ + LIST_BINDINGS *p, *q; + + for (p = all_bindings, q = 0; p != 0; p = p->link) { + if (p->win == win) { + if (q != 0) { + q->link = p->link; + } else { + all_bindings = p->link; + } + /* the user-defined and buttons-bindings all are length=1 */ + if (p->binding[1].is_function_key < 0) + free(p->binding); + free(p); + dlg_unregister_window(win); + break; + } + q = p; + } +} + +/* + * Call this after wgetch(), using the same window pointer and passing + * the curses-key. + * + * If there is no binding associated with the widget, it simply returns + * the given curses-key. + * + * Parameters: + * win is the window on which the wgetch() was done. + * curses_key is the value returned by wgetch(). + * fkey in/out (on input, it is true if curses_key is a function key, + * and on output, it is true if the result is a function key). + */ +int +dlg_lookup_key(WINDOW *win, int curses_key, int *fkey) +{ + LIST_BINDINGS *p; + int n; + + /* + * Ignore mouse clicks, since they are already encoded properly. + */ +#ifdef KEY_MOUSE + if (*fkey != 0 && curses_key == KEY_MOUSE) { + ; + } else +#endif + /* + * Ignore resize events, since they are already encoded properly. + */ +#ifdef KEY_RESIZE + if (*fkey != 0 && curses_key == KEY_RESIZE) { + ; + } else +#endif + if (*fkey == 0 || curses_key < KEY_MAX) { + for (p = all_bindings; p != 0; p = p->link) { + if (p->win == win || p->win == 0) { + int function_key = (*fkey != 0); + for (n = 0; p->binding[n].is_function_key >= 0; ++n) { + if (p->buttons + && !function_key + && p->binding[n].curses_key == (int) dlg_toupper(curses_key)) { + *fkey = 0; + return p->binding[n].dialog_key; + } + if (p->binding[n].curses_key == curses_key + && p->binding[n].is_function_key == function_key) { + *fkey = p->binding[n].dialog_key; + return *fkey; + } + } + } + } + } + return curses_key; +} + +/* + * Test a dialog internal keycode to see if it corresponds to one of the push + * buttons on the widget such as "OK". + * + * This is only useful if there are user-defined key bindings, since there are + * no built-in bindings that map directly to DLGK_OK, etc. + * + * See also dlg_ok_buttoncode(). + */ +int +dlg_result_key(int dialog_key, int fkey GCC_UNUSED, int *resultp) +{ + int done = FALSE; + +#ifdef HAVE_RC_FILE + if (fkey) { + switch ((DLG_KEYS_ENUM) dialog_key) { + case DLGK_OK: + *resultp = DLG_EXIT_OK; + done = TRUE; + break; + case DLGK_CANCEL: + if (!dialog_vars.nocancel) { + *resultp = DLG_EXIT_CANCEL; + done = TRUE; + } + break; + case DLGK_EXTRA: + if (dialog_vars.extra_button) { + *resultp = DLG_EXIT_EXTRA; + done = TRUE; + } + break; + case DLGK_HELP: + if (dialog_vars.help_button) { + *resultp = DLG_EXIT_HELP; + done = TRUE; + } + break; + case DLGK_ESC: + *resultp = DLG_EXIT_ESC; + done = TRUE; + break; + default: + break; + } + } else +#endif + if (dialog_key == ESC) { + *resultp = DLG_EXIT_ESC; + done = TRUE; + } else if (dialog_key == ERR) { + *resultp = DLG_EXIT_ERROR; + done = TRUE; + } + + return done; +} + +#ifdef HAVE_RC_FILE +typedef struct { + const char *name; + int code; +} CODENAME; + +#define CURSES_NAME(upper) { #upper, KEY_ ## upper } +#define COUNT_CURSES sizeof(curses_names)/sizeof(curses_names[0]) +static const CODENAME curses_names[] = +{ + CURSES_NAME(DOWN), + CURSES_NAME(UP), + CURSES_NAME(LEFT), + CURSES_NAME(RIGHT), + CURSES_NAME(HOME), + CURSES_NAME(BACKSPACE), + CURSES_NAME(F0), + CURSES_NAME(DL), + CURSES_NAME(IL), + CURSES_NAME(DC), + CURSES_NAME(IC), + CURSES_NAME(EIC), + CURSES_NAME(CLEAR), + CURSES_NAME(EOS), + CURSES_NAME(EOL), + CURSES_NAME(SF), + CURSES_NAME(SR), + CURSES_NAME(NPAGE), + CURSES_NAME(PPAGE), + CURSES_NAME(STAB), + CURSES_NAME(CTAB), + CURSES_NAME(CATAB), + CURSES_NAME(ENTER), + CURSES_NAME(PRINT), + CURSES_NAME(LL), + CURSES_NAME(A1), + CURSES_NAME(A3), + CURSES_NAME(B2), + CURSES_NAME(C1), + CURSES_NAME(C3), + CURSES_NAME(BTAB), + CURSES_NAME(BEG), + CURSES_NAME(CANCEL), + CURSES_NAME(CLOSE), + CURSES_NAME(COMMAND), + CURSES_NAME(COPY), + CURSES_NAME(CREATE), + CURSES_NAME(END), + CURSES_NAME(EXIT), + CURSES_NAME(FIND), + CURSES_NAME(HELP), + CURSES_NAME(MARK), + CURSES_NAME(MESSAGE), + CURSES_NAME(MOVE), + CURSES_NAME(NEXT), + CURSES_NAME(OPEN), + CURSES_NAME(OPTIONS), + CURSES_NAME(PREVIOUS), + CURSES_NAME(REDO), + CURSES_NAME(REFERENCE), + CURSES_NAME(REFRESH), + CURSES_NAME(REPLACE), + CURSES_NAME(RESTART), + CURSES_NAME(RESUME), + CURSES_NAME(SAVE), + CURSES_NAME(SBEG), + CURSES_NAME(SCANCEL), + CURSES_NAME(SCOMMAND), + CURSES_NAME(SCOPY), + CURSES_NAME(SCREATE), + CURSES_NAME(SDC), + CURSES_NAME(SDL), + CURSES_NAME(SELECT), + CURSES_NAME(SEND), + CURSES_NAME(SEOL), + CURSES_NAME(SEXIT), + CURSES_NAME(SFIND), + CURSES_NAME(SHELP), + CURSES_NAME(SHOME), + CURSES_NAME(SIC), + CURSES_NAME(SLEFT), + CURSES_NAME(SMESSAGE), + CURSES_NAME(SMOVE), + CURSES_NAME(SNEXT), + CURSES_NAME(SOPTIONS), + CURSES_NAME(SPREVIOUS), + CURSES_NAME(SPRINT), + CURSES_NAME(SREDO), + CURSES_NAME(SREPLACE), + CURSES_NAME(SRIGHT), + CURSES_NAME(SRSUME), + CURSES_NAME(SSAVE), + CURSES_NAME(SSUSPEND), + CURSES_NAME(SUNDO), + CURSES_NAME(SUSPEND), + CURSES_NAME(UNDO), +}; + +#define DIALOG_NAME(upper) { #upper, DLGK_ ## upper } +#define COUNT_DIALOG sizeof(dialog_names)/sizeof(dialog_names[0]) +static const CODENAME dialog_names[] = +{ + DIALOG_NAME(OK), + DIALOG_NAME(CANCEL), + DIALOG_NAME(EXTRA), + DIALOG_NAME(HELP), + DIALOG_NAME(ESC), + DIALOG_NAME(PAGE_FIRST), + DIALOG_NAME(PAGE_LAST), + DIALOG_NAME(PAGE_NEXT), + DIALOG_NAME(PAGE_PREV), + DIALOG_NAME(ITEM_FIRST), + DIALOG_NAME(ITEM_LAST), + DIALOG_NAME(ITEM_NEXT), + DIALOG_NAME(ITEM_PREV), + DIALOG_NAME(FIELD_FIRST), + DIALOG_NAME(FIELD_LAST), + DIALOG_NAME(FIELD_NEXT), + DIALOG_NAME(FIELD_PREV), + DIALOG_NAME(GRID_UP), + DIALOG_NAME(GRID_DOWN), + DIALOG_NAME(GRID_LEFT), + DIALOG_NAME(GRID_RIGHT), + DIALOG_NAME(DELETE_LEFT), + DIALOG_NAME(DELETE_RIGHT), + DIALOG_NAME(DELETE_ALL), + DIALOG_NAME(ENTER), + DIALOG_NAME(BEGIN), + DIALOG_NAME(FINAL), + DIALOG_NAME(SELECT) +}; + +static char * +skip_white(char *s) +{ + while (*s != '\0' && isspace(UCH(*s))) + ++s; + return s; +} + +static char * +skip_black(char *s) +{ + while (*s != '\0' && !isspace(UCH(*s))) + ++s; + return s; +} + +/* + * Find a user-defined binding, given the curses key code. + */ +static DLG_KEYS_BINDING * +find_binding(char *widget, int curses_key) +{ + LIST_BINDINGS *p; + DLG_KEYS_BINDING *result = 0; + + for (p = all_bindings; p != 0; p = p->link) { + if (p->win == 0 + && !dlg_strcmp(p->name, widget) + && p->binding->curses_key == curses_key) { + result = p->binding; + break; + } + } + return result; +} + +/* + * Built-in bindings have a nonzero "win" member, and the associated binding + * table can have more than one entry. We keep those last, since lookups will + * find the user-defined bindings first and use those. + * + * Sort "*" (all-widgets) entries past named widgets, since those are less + * specific. + */ +static int +compare_bindings(LIST_BINDINGS * a, LIST_BINDINGS * b) +{ + int result = 0; + if (a->win == b->win) { + if (!strcmp(a->name, b->name)) { + result = a->binding[0].curses_key - b->binding[0].curses_key; + } else if (!strcmp(b->name, "*")) { + result = -1; + } else if (!strcmp(a->name, "*")) { + result = 1; + } else { + result = dlg_strcmp(a->name, b->name); + } + } else if (b->win) { + result = -1; + } else { + result = 1; + } + return result; +} + +/* + * Find a user-defined binding, given the curses key code. If it does not + * exist, create a new one, inserting it into the linked list, keeping it + * sorted to simplify lookups for user-defined bindings that can override + * the built-in bindings. + */ +static DLG_KEYS_BINDING * +make_binding(char *widget, int curses_key, int is_function, int dialog_key) +{ + LIST_BINDINGS *entry = 0; + DLG_KEYS_BINDING *data = 0; + char *name; + LIST_BINDINGS *p, *q; + DLG_KEYS_BINDING *result = find_binding(widget, curses_key); + + if (result == 0 + && (entry = dlg_calloc(LIST_BINDINGS, 1)) != 0 + && (data = dlg_calloc(DLG_KEYS_BINDING, 2)) != 0 + && (name = dlg_strclone(widget)) != 0) { + + entry->name = name; + entry->binding = data; + + data[0].is_function_key = is_function; + data[0].curses_key = curses_key; + data[0].dialog_key = dialog_key; + + data[1] = end_keys_binding; + + for (p = all_bindings, q = 0; p != 0; q = p, p = p->link) { + if (compare_bindings(entry, p) < 0) { + break; + } + } + if (q != 0) { + q->link = entry; + } else { + all_bindings = entry; + } + if (p != 0) { + entry->link = p; + } + result = data; + } else if (entry != 0) { + free(entry); + if (data) + free(data); + } + + return result; +} + +/* + * Parse the parameters of the "bindkeys" configuration-file entry. This + * expects widget name which may be "*", followed by curses key definition and + * then dialog key definition. + * + * The curses key "should" be one of the names (ignoring case) from + * curses_names[], but may also be a single control character (prefix "^" or + * "~" depending on whether it is C0 or C1), or an escaped single character. + * Binding a printable character with dialog is possible but not useful. + * + * The dialog key must be one of the names from dialog_names[]. + */ +int +dlg_parse_bindkey(char *params) +{ + char *p = skip_white(params); + char *q; + bool escaped = FALSE; + int modified = 0; + int result = FALSE; + unsigned xx; + char *widget; + int is_function = FALSE; + int curses_key; + int dialog_key; + + curses_key = -1; + dialog_key = -1; + widget = p; + + p = skip_black(p); + if (p != widget && *p != '\0') { + *p++ = '\0'; + q = p; + while (*p != '\0' && curses_key < 0) { + if (escaped) { + escaped = FALSE; + curses_key = *p; + } else if (*p == '\\') { + escaped = TRUE; + } else if (modified) { + if (*p == '?') { + curses_key = ((modified == '^') + ? 127 + : 255); + } else { + curses_key = ((modified == '^') + ? (*p & 0x1f) + : ((*p & 0x1f) | 0x80)); + } + } else if (*p == '^') { + modified = *p; + } else if (*p == '~') { + modified = *p; + } else if (isspace(UCH(*p))) { + break; + } + ++p; + } + if (!isspace(UCH(*p))) { + ; + } else { + *p++ = '\0'; + if (curses_key < 0) { + char fprefix[2]; + char check[2]; + int keynumber; + if (sscanf(q, "%[Ff]%d%c", fprefix, &keynumber, check) == 2) { + curses_key = KEY_F(keynumber); + is_function = TRUE; + } else { + for (xx = 0; xx < COUNT_CURSES; ++xx) { + if (!dlg_strcmp(curses_names[xx].name, q)) { + curses_key = curses_names[xx].code; + is_function = TRUE; + break; + } + } + } + } + } + q = skip_white(p); + p = skip_black(q); + if (p != q) { + for (xx = 0; xx < COUNT_DIALOG; ++xx) { + if (!dlg_strcmp(dialog_names[xx].name, q)) { + dialog_key = dialog_names[xx].code; + break; + } + } + } + if (*widget != '\0' + && curses_key >= 0 + && dialog_key >= 0 + && make_binding(widget, curses_key, is_function, dialog_key) != 0) { + result = TRUE; + } + } + return result; +} + +static void +dump_curses_key(FILE *fp, int curses_key) +{ + if (curses_key > KEY_MIN) { + unsigned n; + bool found = FALSE; + for (n = 0; n < COUNT_CURSES; ++n) { + if (curses_names[n].code == curses_key) { + fprintf(fp, "%s", curses_names[n].name); + found = TRUE; + break; + } + } + if (!found) { + if (curses_key >= KEY_F(0)) { + fprintf(fp, "F%d", curses_key - KEY_F(0)); + } else { + fprintf(fp, "curses%d", curses_key); + } + } + } else if (curses_key >= 0 && curses_key < 32) { + fprintf(fp, "^%c", curses_key + 64); + } else if (curses_key == 127) { + fprintf(fp, "^?"); + } else if (curses_key >= 128 && curses_key < 160) { + fprintf(fp, "~%c", curses_key - 64); + } else if (curses_key == 255) { + fprintf(fp, "~?"); + } else { + fprintf(fp, "\\%c", curses_key); + } +} + +static void +dump_dialog_key(FILE *fp, int dialog_key) +{ + unsigned n; + bool found = FALSE; + for (n = 0; n < COUNT_DIALOG; ++n) { + if (dialog_names[n].code == dialog_key) { + fputs(dialog_names[n].name, fp); + found = TRUE; + break; + } + } + if (!found) { + fprintf(fp, "dialog%d", dialog_key); + } +} + +static void +dump_one_binding(FILE *fp, const char *widget, DLG_KEYS_BINDING * binding) +{ + fprintf(fp, "bindkey %s ", widget); + dump_curses_key(fp, binding->curses_key); + fputc(' ', fp); + dump_dialog_key(fp, binding->dialog_key); + fputc('\n', fp); +} + +void +dlg_dump_keys(FILE *fp) +{ + LIST_BINDINGS *p; + const char *last = ""; + unsigned n; + unsigned count = 0; + + for (p = all_bindings; p != 0; p = p->link) { + if (p->win == 0) { + ++count; + } + } + if (count != 0) { + for (p = all_bindings, n = 0; p != 0; p = p->link) { + if (p->win == 0) { + if (dlg_strcmp(last, p->name)) { + fprintf(fp, "\n# key bindings for %s widgets\n", + !strcmp(p->name, "*") ? "all" : p->name); + last = p->name; + } + dump_one_binding(fp, p->name, p->binding); + } + } + } +} +#endif /* HAVE_RC_FILE */ Index: contrib/dialog/config.hin =================================================================== --- contrib/dialog/config.hin (revision 0) +++ contrib/dialog/config.hin (revision 0) @@ -0,0 +1,4 @@ +/* + * The configure script expands this as a set of definitions + */ +@DEFS@ Index: contrib/dialog/tailbox.c =================================================================== --- contrib/dialog/tailbox.c (revision 0) +++ contrib/dialog/tailbox.c (revision 0) @@ -0,0 +1,368 @@ +/* + * $Id: tailbox.c,v 1.56 2010/04/28 20:52:20 tom Exp $ + * + * tailbox.c -- implements the tail box + * + * Copyright 2000-2009,2010 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 + * Pasquale De Marco (demarco_p@abramo.it) + */ + +#include <dialog.h> +#include <dlg_keys.h> + +typedef struct { + DIALOG_CALLBACK obj; + WINDOW *text; + const char **buttons; + int hscroll; + int old_hscroll; + char line[MAX_LEN + 1]; +} MY_OBJ; + +/* + * Return current line of text. + */ +static char * +get_line(MY_OBJ * obj) +{ + FILE *fp = obj->obj.input; + int col = -(obj->hscroll); + int j, tmpint, ch; + + do { + if (((ch = getc(fp)) == EOF) && !feof(fp)) + dlg_exiterr("Error moving file pointer in get_line()."); + else if (!feof(fp) && (ch != '\n')) { + if ((ch == TAB) && (dialog_vars.tab_correct)) { + tmpint = dialog_state.tab_len + - ((col + obj->hscroll) % dialog_state.tab_len); + for (j = 0; j < tmpint; j++) { + if (col >= 0 && col < MAX_LEN) + obj->line[col] = ' '; + ++col; + } + } else { + if (col >= 0) + obj->line[col] = (char) ch; + ++col; + } + if (col >= MAX_LEN) + break; + } + } while (!feof(fp) && (ch != '\n')); + + if (col < 0) + col = 0; + obj->line[col] = '\0'; + + return obj->line; +} + +/* + * Print a new line of text. + */ +static void +print_line(MY_OBJ * obj, WINDOW *win, int row, int width) +{ + int i, y, x; + char *line = get_line(obj); + + (void) wmove(win, row, 0); /* move cursor to correct line */ + (void) waddch(win, ' '); +#ifdef NCURSES_VERSION + (void) waddnstr(win, line, MIN((int) strlen(line), width - 2)); +#else + line[MIN((int) strlen(line), width - 2)] = '\0'; + waddstr(win, line); +#endif + + getyx(win, y, x); + /* Clear 'residue' of previous line */ + for (i = 0; i < width - x; i++) + (void) waddch(win, ' '); +} + +/* + * Go back 'target' lines in text file. BUFSIZ has to be in 'size_t' range. + */ +static void +last_lines(MY_OBJ * obj, int target) +{ + FILE *fp = obj->obj.input; + long inx; + int count = 0; + char buf[BUFSIZ + 1]; + long size_to_read; + long offset = 0; + long fpos = 0; + + if (fseek(fp, 0, SEEK_END) == -1 + || (fpos = ftell(fp)) < 0) + dlg_exiterr("Error moving file pointer in last_lines()."); + + if (fpos != 0) { + ++target; + for (;;) { + if (fpos >= BUFSIZ) { + size_to_read = BUFSIZ; + } else { + size_to_read = fpos; + } + fpos = fpos - size_to_read; + if (fseek(fp, fpos, SEEK_SET) == -1) + dlg_exiterr("Error moving file pointer in last_lines()."); + (void) fread(buf, (size_t) size_to_read, 1, fp); + if (ferror(fp)) + dlg_exiterr("Error reading file in last_lines()."); + + offset += size_to_read; + for (inx = size_to_read - 1; inx >= 0; --inx) { + if (buf[inx] == '\n') { + if (++count > target) + break; + offset = inx + 1; + } + } + + if (count > target) { + break; + } else if (fpos == 0) { + offset = 0; + break; + } + } + + if (fseek(fp, fpos + offset, SEEK_SET) == -1) + dlg_exiterr("Error moving file pointer in last_lines()."); + } +} + +/* + * Print a new page of text. + */ +static void +print_page(MY_OBJ * obj, int height, int width) +{ + int i; + + for (i = 0; i < height; i++) { + print_line(obj, obj->text, i, width); + } + (void) wnoutrefresh(obj->text); +} + +static void +print_last_page(MY_OBJ * obj) +{ + int high = getmaxy(obj->obj.win) - (2 * MARGIN + (obj->obj.bg_task ? 1 : 3)); + int wide = getmaxx(obj->text); + + last_lines(obj, high); + print_page(obj, high, wide); +} + +static void +repaint_text(MY_OBJ * obj) +{ + int cur_y, cur_x; + + getyx(obj->obj.win, cur_y, cur_x); + obj->old_hscroll = obj->hscroll; + print_last_page(obj); + (void) wmove(obj->obj.win, cur_y, cur_x); /* Restore cursor position */ + wrefresh(obj->obj.win); +} + +static bool +handle_my_getc(DIALOG_CALLBACK * cb, int ch, int fkey, int *result) +{ + MY_OBJ *obj = (MY_OBJ *) cb; + bool done = FALSE; + + if (!fkey && dlg_char_to_button(ch, obj->buttons) == 0) { + ch = DLGK_ENTER; + fkey = TRUE; + } + + if (fkey) { + switch (ch) { + case DLGK_ENTER: + *result = DLG_EXIT_OK; + done = TRUE; + break; + case DLGK_BEGIN: /* Beginning of line */ + obj->hscroll = 0; + break; + case DLGK_GRID_LEFT: /* Scroll left */ + if (obj->hscroll > 0) { + obj->hscroll -= 1; + } + break; + case DLGK_GRID_RIGHT: /* Scroll right */ + if (obj->hscroll < MAX_LEN) + obj->hscroll += 1; + break; + default: + beep(); + break; + } + if ((obj->hscroll != obj->old_hscroll)) + repaint_text(obj); + } else { + switch (ch) { + case ERR: + clearerr(cb->input); + ch = getc(cb->input); + (void) ungetc(ch, cb->input); + if ((ch != EOF) || (obj->hscroll != obj->old_hscroll)) { + repaint_text(obj); + } + break; + case ESC: + done = TRUE; + *result = DLG_EXIT_ESC; + break; + default: + beep(); + break; + } + } + + return !done; +} + +/* + * Display text from a file in a dialog box, like in a "tail -f". + */ +int +dialog_tailbox(const char *title, const char *file, int height, int width, int bg_task) +{ + /* *INDENT-OFF* */ + static DLG_KEYS_BINDING binding[] = { + ENTERKEY_BINDINGS, + DLG_KEYS_DATA( DLGK_BEGIN, '0' ), + DLG_KEYS_DATA( DLGK_BEGIN, KEY_BEG ), + DLG_KEYS_DATA( DLGK_GRID_LEFT, 'H' ), + DLG_KEYS_DATA( DLGK_GRID_LEFT, 'h' ), + DLG_KEYS_DATA( DLGK_GRID_LEFT, KEY_LEFT ), + DLG_KEYS_DATA( DLGK_GRID_RIGHT, 'L' ), + DLG_KEYS_DATA( DLGK_GRID_RIGHT, 'l' ), + DLG_KEYS_DATA( DLGK_GRID_RIGHT, KEY_RIGHT ), + END_KEYS_BINDING + }; + /* *INDENT-ON* */ + +#ifdef KEY_RESIZE + int old_height = height; + int old_width = width; +#endif + int fkey; + int x, y, result, thigh; + WINDOW *dialog, *text; + const char **buttons = 0; + MY_OBJ *obj; + FILE *fd; + int min_width = 12; + + /* Open input file for reading */ + if ((fd = fopen(file, "rb")) == NULL) + dlg_exiterr("Can't open input file in dialog_tailbox()."); + +#ifdef KEY_RESIZE + retry: +#endif + dlg_auto_sizefile(title, file, &height, &width, 2, min_width); + dlg_print_size(height, width); + dlg_ctl_size(height, width); + + x = dlg_box_x_ordinate(width); + y = dlg_box_y_ordinate(height); + thigh = height - ((2 * MARGIN) + (bg_task ? 0 : 2)); + + dialog = dlg_new_window(height, width, y, x); + + dlg_mouse_setbase(x, y); + + /* Create window for text region, used for scrolling text */ + text = dlg_sub_window(dialog, + thigh, + width - (2 * MARGIN), + y + MARGIN, + x + MARGIN); + + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); + dlg_draw_title(dialog, title); + + if (!bg_task) { + buttons = dlg_exit_label(); + dlg_button_layout(buttons, &min_width); + dlg_draw_buttons(dialog, height - (2 * MARGIN), 0, buttons, FALSE, + FALSE, width); + } + + (void) wmove(dialog, thigh, (MARGIN + 1)); + (void) wnoutrefresh(dialog); + + obj = dlg_calloc(MY_OBJ, 1); + assert_ptr(obj, "dialog_tailbox"); + + obj->obj.input = fd; + obj->obj.win = dialog; + obj->obj.handle_getc = handle_my_getc; + obj->obj.keep_bg = bg_task && dialog_vars.cant_kill; + obj->obj.bg_task = bg_task; + obj->text = text; + obj->buttons = buttons; + dlg_add_callback(&(obj->obj)); + + dlg_register_window(dialog, "tailbox", binding); + dlg_register_buttons(dialog, "tailbox", buttons); + + /* Print last page of text */ + dlg_attr_clear(text, thigh, getmaxx(text), dialog_attr); + repaint_text(obj); + + if (bg_task) { + result = DLG_EXIT_OK; + } else { + int ch; + do { + ch = dlg_getc(dialog, &fkey); +#ifdef KEY_RESIZE + if (fkey && ch == KEY_RESIZE) { + /* reset data */ + height = old_height; + width = old_width; + /* repaint */ + dlg_clear(); + dlg_del_window(dialog); + refresh(); + dlg_mouse_free_regions(); + dlg_button_layout(buttons, &min_width); + goto retry; + } +#endif + } + while (handle_my_getc(&(obj->obj), ch, fkey, &result)); + } + dlg_mouse_free_regions(); + return result; +} Index: contrib/dialog/dialog.h =================================================================== --- contrib/dialog/dialog.h (revision 0) +++ contrib/dialog/dialog.h (revision 0) @@ -0,0 +1,784 @@ +/* + * $Id: dialog.h,v 1.214 2010/04/28 21:11:49 tom Exp $ + * + * dialog.h -- common declarations for all dialog modules + * + * Copyright 2000-2008,2010 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) + */ + +#ifndef DIALOG_H_included +#define DIALOG_H_included 1 + +#include <dlg_config.h> + +#ifdef __hpux +#define __HP_CURSES_COMPAT /* workaround for getattrs, etc. */ +#endif + +#include <sys/types.h> +#include <fcntl.h> +#include <unistd.h> +#include <ctype.h> +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <signal.h> /* fork() etc. */ +#include <math.h> /* sqrt() */ + +#if defined(HAVE_NCURSESW_NCURSES_H) +#include <ncursesw/ncurses.h> +#elif defined(HAVE_NCURSES_NCURSES_H) +#include <ncurses/ncurses.h> +#elif defined(HAVE_NCURSES_CURSES_H) +#include <ncurses/curses.h> +#elif defined(HAVE_NCURSES_H) +#include <ncurses.h> +#else +#include <curses.h> +#endif + +/* most curses.h headers include this, some do not */ +#if defined(HAVE_UNCTRL_H) +#include <unctrl.h> +#endif + +/* possible conflicts with <term.h> which may be included in <curses.h> */ +#ifdef color_names +#undef color_names +#endif + +#ifdef buttons +#undef buttons +#endif + +#ifdef ENABLE_NLS +#include <libintl.h> +#include <langinfo.h> +#define _(s) dgettext(PACKAGE, s) +#else +#undef _ +#define _(s) s +#endif + +#ifndef GCC_NORETURN +#define GCC_NORETURN /*nothing*/ +#endif + +#ifndef GCC_UNUSED +#define GCC_UNUSED /*nothing*/ +#endif + +#ifndef HAVE_WGET_WCH +#undef USE_WIDE_CURSES +#endif + +/* + * FIXME: a configure check would be useful + */ +#ifdef __hpux +#undef ACS_UARROW +#undef ACS_DARROW +#undef ACS_BLOCK +#endif + +/* + * Change these if you want + */ +#define USE_SHADOW TRUE +#define USE_COLORS TRUE + +#ifdef HAVE_COLOR +#define SCOLS (COLS - (dialog_state.use_shadow ? 2 : 0)) +#define SLINES (LINES - (dialog_state.use_shadow ? 1 : 0)) +#else +#define SCOLS COLS +#define SLINES LINES +#endif + +#define DLG_EXIT_ESC 255 +#define DLG_EXIT_UNKNOWN -2 /* never return this (internal use) */ +#define DLG_EXIT_ERROR -1 /* the shell sees this as 255 */ +#define DLG_EXIT_OK 0 +#define DLG_EXIT_CANCEL 1 +#define DLG_EXIT_HELP 2 +#define DLG_EXIT_EXTRA 3 +#define DLG_EXIT_ITEM_HELP 4 /* actually DLG_EXIT_HELP */ + +#define DLG_CTRL(n) ((n) & 0x1f) /* CTRL is preferred, but conflicts */ + +#define CHR_BACKSPACE DLG_CTRL('H') +#define CHR_REPAINT DLG_CTRL('L') +#define CHR_KILL DLG_CTRL('U') +#define CHR_LITERAL DLG_CTRL('V') +#define CHR_DELETE 127 +#define CHR_NEXT DLG_CTRL('N') +#define CHR_PREVIOUS DLG_CTRL('P') +#define CHR_TRACE DLG_CTRL('T') + +#define ESC 27 +#define TAB DLG_CTRL('I') + +#define MARGIN 1 +#define GUTTER 2 +#define SHADOW_ROWS 1 +#define SHADOW_COLS 2 +#define ARROWS_COL 5 + +#define MAX_LEN 2048 +#define BUF_SIZE (10*1024) + +#undef MIN +#define MIN(x,y) ((x) < (y) ? (x) : (y)) + +#undef MAX +#define MAX(x,y) ((x) > (y) ? (x) : (y)) + +#define DEFAULT_SEPARATE_STR "\t" +#define DEFAULT_ASPECT_RATIO 9 +/* how many spaces is a tab long (default)? */ +#define TAB_LEN 8 +#define WTIMEOUT_VAL 10 + +#ifndef A_CHARTEXT +#define A_CHARTEXT 0xff +#endif + +#define CharOf(ch) ((ch) & 0xff) + +#ifndef ACS_ULCORNER +#define ACS_ULCORNER '+' +#endif +#ifndef ACS_LLCORNER +#define ACS_LLCORNER '+' +#endif +#ifndef ACS_URCORNER +#define ACS_URCORNER '+' +#endif +#ifndef ACS_LRCORNER +#define ACS_LRCORNER '+' +#endif +#ifndef ACS_HLINE +#define ACS_HLINE '-' +#endif +#ifndef ACS_VLINE +#define ACS_VLINE '|' +#endif +#ifndef ACS_LTEE +#define ACS_LTEE '+' +#endif +#ifndef ACS_RTEE +#define ACS_RTEE '+' +#endif +#ifndef ACS_UARROW +#define ACS_UARROW '^' +#endif +#ifndef ACS_DARROW +#define ACS_DARROW 'v' +#endif +#ifndef ACS_BLOCK +#define ACS_BLOCK '#' +#endif + +/* these definitions may work for antique versions of curses */ +#ifndef HAVE_GETBEGYX +#undef getbegyx +#define getbegyx(win,y,x) (y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR) +#endif + +#ifndef HAVE_GETMAXYX +#undef getmaxyx +#define getmaxyx(win,y,x) (y = (win)?(win)->_maxy:ERR, x = (win)?(win)->_maxx:ERR) +#endif + +#ifndef HAVE_GETPARYX +#undef getparyx +#define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* these definitions may be needed for bleeding-edge curses implementations */ +#if !(defined(HAVE_GETBEGX) && defined(HAVE_GETBEGY)) +#undef getbegx +#undef getbegy +#define getbegx(win) dlg_getbegx(win) +#define getbegy(win) dlg_getbegy(win) +extern int dlg_getbegx(WINDOW * /*win*/); +extern int dlg_getbegy(WINDOW * /*win*/); +#endif + +#if !(defined(HAVE_GETCURX) && defined(HAVE_GETCURY)) +#undef getcurx +#undef getcury +#define getcurx(win) dlg_getcurx(win) +#define getcury(win) dlg_getcury(win) +extern int dlg_getcurx(WINDOW * /*win*/); +extern int dlg_getcury(WINDOW * /*win*/); +#endif + +#if !(defined(HAVE_GETMAXX) && defined(HAVE_GETMAXY)) +#undef getmaxx +#undef getmaxy +#define getmaxx(win) dlg_getmaxx(win) +#define getmaxy(win) dlg_getmaxy(win) +extern int dlg_getmaxx(WINDOW * /*win*/); +extern int dlg_getmaxy(WINDOW * /*win*/); +#endif + +#if !(defined(HAVE_GETPARX) && defined(HAVE_GETPARY)) +#undef getparx +#undef getpary +#define getparx(win) dlg_getparx(win) +#define getpary(win) dlg_getpary(win) +extern int dlg_getparx(WINDOW * /*win*/); +extern int dlg_getpary(WINDOW * /*win*/); +#endif + +/* + * This is a list of "old" names, which should be helpful in updating + * applications that use libdialog. Starting with 2003/11/26, all exported + * symbols from libdialog have "dlg_" prefix, or "dialog_" prefix or "_dialog" + * suffix (or suffix "_dialog", e.g., init_dialog). + */ +#ifdef __DIALOG_OLD_NAMES__ +#define color_table dlg_color_table +#define attr_clear(win,h,w,a) dlg_attr_clear(win,h,w,a) +#define auto_size(t,s,h,w,xl,mc) dlg_auto_size(t,s,h,w,xl,mc) +#define auto_sizefile(t,f,h,w,xl,mc) dlg_auto_sizefile(t,f,h,w,xl,mc) +#define beeping() dlg_beeping() +#define box_x_ordinate(w) dlg_box_x_ordinate(w) +#define box_y_ordinate(h) dlg_box_y_ordinate(h) +#define calc_listh(h,lh,in) dlg_calc_listh(h,lh,in) +#define calc_listw(in,items,group) dlg_calc_listw(in,items,group) +#define color_setup() dlg_color_setup() +#define create_rc(f) dlg_create_rc(f) +#define ctl_size(h,w) dlg_ctl_size(h,w) +#define del_window(win) dlg_del_window(win) +#define dialog_clear() dlg_clear() +#define draw_bottom_box(win) dlg_draw_bottom_box(win) +#define draw_box(win,y,x,h,w,xc,bc) dlg_draw_box(win,y,x,h,w,xc,bc) +#define draw_shadow(win,h,w,y,x) dlg_draw_shadow(win,h,w,y,x) +#define draw_title(win,t) dlg_draw_title(win,t) +#define exiterr dlg_exiterr +#define killall_bg(n) dlg_killall_bg(n) +#define mouse_bigregion(y,x) dlg_mouse_bigregion(y,x) +#define mouse_free_regions() dlg_mouse_free_regions() +#define mouse_mkbigregion(y,x,h,w,n,ix,iy,m) dlg_mouse_mkbigregion(y,x,h,w,n,ix,iy,m) +#define mouse_mkregion(y,x,h,w,n) dlg_mouse_mkregion(y,x,h,w,n) +#define mouse_region(y,x) dlg_mouse_region(y,x) +#define mouse_setbase(x,y) dlg_mouse_setbase(x,y) +#define mouse_wgetch(w,c) dlg_mouse_wgetch(w,c) +#define new_window(h,w,y,x) dlg_new_window(h,w,y,x) +#define parse_rc() dlg_parse_rc() +#define print_autowrap(win,s,h,w) dlg_print_autowrap(win,s,h,w) +#define print_size(h,w) dlg_print_size(h,w) +#define put_backtitle() dlg_put_backtitle() +#define strclone(cprompt) dlg_strclone(cprompt) +#define sub_window(win,h,w,y,x) dlg_sub_window(win,h,w,y,x) +#define tab_correct_str(s) dlg_tab_correct_str(s) +#endif + +/* + * Attribute names + */ +#define DIALOG_ATR(n) dlg_color_table[n].atr + +#define screen_attr DIALOG_ATR(0) +#define shadow_attr DIALOG_ATR(1) +#define dialog_attr DIALOG_ATR(2) +#define title_attr DIALOG_ATR(3) +#define border_attr DIALOG_ATR(4) +#define button_active_attr DIALOG_ATR(5) +#define button_inactive_attr DIALOG_ATR(6) +#define button_key_active_attr DIALOG_ATR(7) +#define button_key_inactive_attr DIALOG_ATR(8) +#define button_label_active_attr DIALOG_ATR(9) +#define button_label_inactive_attr DIALOG_ATR(10) +#define inputbox_attr DIALOG_ATR(11) +#define inputbox_border_attr DIALOG_ATR(12) +#define searchbox_attr DIALOG_ATR(13) +#define searchbox_title_attr DIALOG_ATR(14) +#define searchbox_border_attr DIALOG_ATR(15) +#define position_indicator_attr DIALOG_ATR(16) +#define menubox_attr DIALOG_ATR(17) +#define menubox_border_attr DIALOG_ATR(18) +#define item_attr DIALOG_ATR(19) +#define item_selected_attr DIALOG_ATR(20) +#define tag_attr DIALOG_ATR(21) +#define tag_selected_attr DIALOG_ATR(22) +#define tag_key_attr DIALOG_ATR(23) +#define tag_key_selected_attr DIALOG_ATR(24) +#define check_attr DIALOG_ATR(25) +#define check_selected_attr DIALOG_ATR(26) +#define uarrow_attr DIALOG_ATR(27) +#define darrow_attr DIALOG_ATR(28) +#define itemhelp_attr DIALOG_ATR(29) +#define form_active_text_attr DIALOG_ATR(30) +#define form_text_attr DIALOG_ATR(31) +#define form_item_readonly_attr DIALOG_ATR(32) + +#define DLGK_max (KEY_MAX + 256) + +/* + * Callbacks are used to implement the "background" tailbox. + */ +struct _dlg_callback; + +typedef void (*DIALOG_FREEBACK) (struct _dlg_callback * /* p */); + +typedef struct _dlg_callback { + struct _dlg_callback *next; + FILE *input; + WINDOW *win; + bool keep_bg; /* keep in background, on exit */ + bool bg_task; /* true if this is background task */ + bool (*handle_getc)(struct _dlg_callback *p, int ch, int fkey, int *result); + bool keep_win; /* true to not erase window on exit */ + /* data for dlg_add_callback_ref */ + struct _dlg_callback **caller; + DIALOG_FREEBACK freeback; +} DIALOG_CALLBACK; + +typedef struct _dlg_windows { + struct _dlg_windows *next; + WINDOW *normal; + WINDOW *shadow; +} DIALOG_WINDOWS; + +/* + * Global variables, which are initialized as needed + */ +typedef struct { + DIALOG_CALLBACK *getc_callbacks; + DIALOG_CALLBACK *getc_redirect; + DIALOG_WINDOWS *all_windows; + FILE *output; /* option "--output-fd fd" */ + FILE *pipe_input; /* used for gauge widget */ + FILE *screen_output; /* newterm(), etc. */ + bool screen_initialized; + bool use_colors; /* use colors by default? */ + bool use_scrollbar; /* option "--scrollbar" */ + bool use_shadow; /* shadow dialog boxes by default? */ + bool visit_items; /* option "--visit-items" */ + char *separate_str; /* option "--separate-widget string" */ + int aspect_ratio; /* option "--aspect ratio" */ + int output_count; /* # of widgets that may have done output */ + int tab_len; /* option "--tab-len n" */ + /* 1.0-20070227 */ + FILE *input; /* option "--input-fd fd" */ +#ifdef HAVE_DLG_TRACE + FILE *trace_output; /* option "--trace file" */ +#endif +} DIALOG_STATE; + +extern DIALOG_STATE dialog_state; + +/* + * Global variables, which dialog resets before each widget + */ +typedef struct { + bool beep_after_signal; /* option "--beep-after" */ + bool beep_signal; /* option "--beep" */ + bool begin_set; /* option "--begin y x" was used */ + bool cant_kill; /* option "--no-kill" */ + bool colors; /* option "--colors" */ + bool cr_wrap; /* option "--cr-wrap" */ + bool defaultno; /* option "--defaultno" */ + bool dlg_clear_screen; /* option "--clear" */ + bool extra_button; /* option "--extra-button" */ + bool help_button; /* option "--help-button" */ + bool help_status; /* option "--help-status" */ + bool input_menu; /* menu vs inputmenu widget */ + bool insecure; /* option "--insecure" */ + bool item_help; /* option "--item-help" */ + bool keep_window; /* option "--keep-window" */ + bool nocancel; /* option "--no-cancel" */ + bool nocollapse; /* option "--no-collapse" */ + bool print_siz; /* option "--print-size" */ + bool separate_output; /* option "--separate-output" */ + bool single_quoted; /* option "--single-quoted" */ + bool size_err; /* option "--size-err" */ + bool tab_correct; /* option "--tab-correct" */ + bool trim_whitespace; /* option "--trim" */ + char *backtitle; /* option "--backtitle backtitle" */ + char *cancel_label; /* option "--cancel-label string" */ + char *default_item; /* option "--default-item string" */ + char *exit_label; /* option "--exit-label string" */ + char *extra_label; /* option "--extra-label string" */ + char *help_label; /* option "--help-label string" */ + char *input_result; + char *no_label; /* option "--no-label string" */ + char *ok_label; /* option "--ok-label string" */ + char *title; /* option "--title title" */ + char *yes_label; /* option "--yes-label string" */ + int begin_x; /* option "--begin y x" (second value) */ + int begin_y; /* option "--begin y x" (first value) */ + int max_input; /* option "--max-input size" */ + int scale_factor; /* RESERVED */ + int sleep_secs; /* option "--sleep secs" */ + int timeout_secs; /* option "--timeout secs" */ + unsigned input_length; /* nonzero if input_result is allocated */ + /* 1.0-20051207 */ + unsigned formitem_type; /* DIALOG_FORMITEM.type in dialog_form() */ + /* 1.1-20070227 */ + bool keep_tite; /* option "--keep-tite" */ + bool ascii_lines; /* option "--ascii-lines" */ + bool no_lines; /* option "--no-lines" */ + /* 1.1-20070930 */ + bool nook; /* option "--no-ok" */ + /* 1.1-20080727 */ + bool quoted; /* option "--quoted" */ + char *column_header; /* RESERVED "--column-header" */ + char *column_separator; /* option "--column-separator" */ + char *output_separator; /* option "--output-separator" */ + /* 1.1-20100118 */ + char *date_format; /* option "--date-format" */ + char *time_format; /* option "--time-format" */ +} DIALOG_VARS; + +#define USE_ITEM_HELP(s) (dialog_vars.item_help && (s) != 0) +#define CHECKBOX_TAGS (dialog_vars.item_help ? 4 : 3) +#define MENUBOX_TAGS (dialog_vars.item_help ? 3 : 2) +#define FORMBOX_TAGS (dialog_vars.item_help ? 9 : 8) +#define MIXEDFORM_TAGS (FORMBOX_TAGS + 1) +#define MIXEDGAUGE_TAGS 2 + +extern DIALOG_VARS dialog_vars; + +#ifndef HAVE_TYPE_CHTYPE +#define chtype long +#endif + +#define UCH(ch) ((unsigned char)(ch)) + +#define assert_ptr(ptr,msg) if ((ptr) == 0) dlg_exiterr("cannot allocate memory in " msg) + +#define dlg_malloc(t,n) (t *) malloc((n) * sizeof(t)) +#define dlg_calloc(t,n) (t *) calloc((n), sizeof(t)) +#define dlg_realloc(t,n,p) (t *) realloc((p), (n) * sizeof(t)) + +/* + * Table for attribute- and color-values. + */ +typedef struct { + chtype atr; +#ifdef HAVE_COLOR + int fg; + int bg; + int hilite; +#endif +#ifdef HAVE_RC_FILE + const char *name; + const char *comment; +#endif +} DIALOG_COLORS; + +extern DIALOG_COLORS dlg_color_table[]; + +/* + * Function prototypes + */ +extern const char *dialog_version(void); + +/* widgets, each in separate files */ +extern int dialog_calendar(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*day*/, int /*month*/, int /*year*/); +extern int dialog_checklist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*flag*/); +extern int dialog_dselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/); +extern int dialog_editbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/); +extern int dialog_form(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, char ** /*items*/); +extern int dialog_fselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/); +extern int dialog_gauge(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*percent*/); +extern int dialog_inputbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, const char * /*init*/, const int /*password*/); +extern int dialog_menu(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*menu_height*/, int /*item_no*/, char ** /*items*/); +extern int dialog_mixedform(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, char ** /*items*/); +extern int dialog_mixedgauge(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*percent*/, int /*item_no*/, char ** /*items*/); +extern int dialog_msgbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*pauseopt*/); +extern int dialog_pause(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*seconds*/); +extern int dialog_progressbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/); +extern int dialog_tailbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/, int /*bg_task*/); +extern int dialog_textbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/); +extern int dialog_timebox(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*hour*/, int /*minute*/, int /*second*/); +extern int dialog_yesno(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/); + +/* some widgets have alternate entrypoints, to allow list manipulation */ +typedef struct { + char *name; + char *text; + char *help; + int state; +} DIALOG_LISTITEM; + +typedef struct { + unsigned type; /* the field type (0=input, 1=password) */ + char *name; /* the field label */ + int name_len; /* ...its length */ + int name_y; /* ...its y-ordinate */ + int name_x; /* ...its x-ordinate */ + bool name_free; /* ...true if .name can be freed */ + char *text; /* the field contents */ + int text_len; /* ...its length on the screen */ + int text_y; /* ...its y-ordinate */ + int text_x; /* ...its x-ordinate */ + int text_flen; /* ...its length on screen, or 0 if no input allowed */ + int text_ilen; /* ...its limit on amount to be entered */ + bool text_free; /* ...true if .text can be freed */ + char *help; /* help-message, if any */ + bool help_free; /* ...true if .help can be freed */ +} DIALOG_FORMITEM; + +typedef int (DIALOG_INPUTMENU) (DIALOG_LISTITEM * /*items*/, int /*current*/, char * /*newtext*/); + +extern int dlg_checklist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, const char * /*states*/, int /*flag*/, int * /*current_item*/); +extern int dlg_form(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, DIALOG_FORMITEM * /*items*/, int * /*current_item*/); +extern int dlg_menu(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*menu_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, int * /*current_item*/, DIALOG_INPUTMENU /*rename_menu*/); + +/* arrows.c */ +extern void dlg_draw_arrows(WINDOW * /*dialog*/, int /*top_arrow*/, int /*bottom_arrow*/, int /*x*/, int /*top*/, int /*bottom*/); +extern void dlg_draw_arrows2(WINDOW * /*dialog*/, int /*top_arrow*/, int /*bottom_arrow*/, int /*x*/, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/); +extern void dlg_draw_scrollbar(WINDOW * /*dialog*/, long /* first_data */, long /* this_data */, long /* next_data */, long /* total_data */, int /* left */, int /* right */, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/); + +/* buttons.c */ +extern const char ** dlg_exit_label(void); +extern const char ** dlg_ok_label(void); +extern const char ** dlg_ok_labels(void); +extern const char ** dlg_yes_labels(void); +extern int dlg_button_count(const char ** /*labels*/); +extern int dlg_button_to_char(const char * /*label*/); +extern int dlg_button_x_step(const char ** /*labels*/, int /*limit*/, int * /*gap*/, int * /*margin*/, int * /*step*/); +extern int dlg_char_to_button(int /*ch*/, const char ** /*labels*/); +extern int dlg_exit_buttoncode(int /*button*/); +extern int dlg_match_char(int /*ch*/, const char * /*string*/); +extern int dlg_next_button(const char ** /*labels*/, int /*button*/); +extern int dlg_next_ok_buttonindex(int /*current*/, int /*extra*/); +extern int dlg_ok_buttoncode(int /*button*/); +extern int dlg_prev_button(const char ** /*labels*/, int /*button*/); +extern int dlg_prev_ok_buttonindex(int /*current*/, int /*extra*/); +extern int dlg_yes_buttoncode(int /*button*/); +extern void dlg_button_layout(const char ** /*labels*/, int * /*limit*/); +extern void dlg_button_sizes(const char ** /*labels*/, int /*vertical*/, int * /*longest*/, int * /*length*/); +extern void dlg_draw_buttons(WINDOW * /*win*/, int /*y*/, int /*x*/, const char ** /*labels*/, int /*selected*/, int /*vertical*/, int /*limit*/); + +/* columns.c */ +extern void dlg_align_columns(char ** /* target */, int /* per_row */, int /* num_rows */); +extern void dlg_free_columns(char ** /* target */, int /* per_row */, int /* num_rows */); + +/* editbox.c */ +extern int dlg_editbox(const char */*title*/, char ***/*list*/, int */*rows*/, int /*height*/, int /*width*/); + +/* formbox.c */ +extern int dlg_default_formitem(DIALOG_FORMITEM * /*items*/); +extern int dlg_ordinate(const char * /*s*/); +extern void dlg_free_formitems(DIALOG_FORMITEM * /*items*/); + +/* inputstr.c */ +extern bool dlg_edit_string(char * /*string*/, int * /*offset*/, int /*key*/, int /*fkey*/, bool /*force*/); +extern const int * dlg_index_columns(const char * /*string*/); +extern const int * dlg_index_wchars(const char * /*string*/); +extern int dlg_count_columns(const char * /*string*/); +extern int dlg_count_wchars(const char * /*string*/); +extern int dlg_edit_offset(char * /*string*/, int /*offset*/, int /*x_last*/); +extern int dlg_find_index(const int * /*list*/, int /*limit*/, int /*to_find*/); +extern int dlg_limit_columns(const char * /*string*/, int /*limit*/, int /*offset*/); +extern void dlg_show_string(WINDOW * /*win*/, const char * /*string*/, int /*offset*/, chtype /*attr*/, int /*y_base*/, int /*x_base*/, int /*x_last*/, bool /*hidden*/, bool /*force*/); + +/* rc.c */ +#ifdef HAVE_RC_FILE +extern int dlg_parse_rc(void); +extern void dlg_create_rc(const char * /*filename*/); +#endif + +/* ui_getc.c */ +extern int dlg_getc(WINDOW * /*win*/, int * /*fkey*/); +extern int dlg_getc_callbacks(int /*ch*/, int /*fkey*/, int * /*result*/); +extern int dlg_last_getc(void); +extern void dlg_add_callback(DIALOG_CALLBACK * /*p*/); +extern void dlg_add_callback_ref(DIALOG_CALLBACK ** /*p*/, DIALOG_FREEBACK /* cleanup */); +extern void dlg_flush_getc(void); +extern void dlg_remove_callback(DIALOG_CALLBACK * /*p*/); +extern void dlg_killall_bg(int *retval); + +/* util.c */ +extern WINDOW * dlg_new_modal_window(WINDOW * /*parent*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/); +extern WINDOW * dlg_new_window(int /*height*/, int /*width*/, int /*y*/, int /*x*/); +extern WINDOW * dlg_sub_window(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/); +extern bool dlg_need_separator(void); +extern char * dlg_set_result(const char * /*string*/); +extern char * dlg_strclone(const char * /*cprompt*/); +extern char * dlg_strempty(void); +extern chtype dlg_asciibox(chtype /*ch*/); +extern chtype dlg_boxchar(chtype /*ch*/); +extern const char * dlg_print_line(WINDOW */*win*/, chtype */*attr*/, const char */*prompt*/, int /*lm*/, int /*rm*/, int */*x*/); +extern int dlg_box_x_ordinate(int /*width*/); +extern int dlg_box_y_ordinate(int /*height*/); +extern int dlg_calc_list_width(int /*item_no*/, DIALOG_LISTITEM * /*items*/); +extern int dlg_calc_listw(int /*item_no*/, char ** /*items*/, int /*group*/); +extern int dlg_check_scrolled(int /* key */, int /* last */, int /* page */, bool */* show */, int */* offset */); +extern int dlg_default_item(char ** /*items*/, int /*llen*/); +extern int dlg_default_listitem(DIALOG_LISTITEM * /*items*/); +extern int dlg_defaultno_button(void); +extern int dlg_max_input(int /*max_len*/); +extern int dlg_print_scrolled(WINDOW * /* win */, const char * /* prompt */, int /* offset */, int /* height */, int /* width */, int /* pauseopt */); +extern void dlg_add_quoted(char * /*string*/); +extern void dlg_add_result(const char * /*string*/); +extern void dlg_add_separator(void); +extern void dlg_add_string(char * /*string*/); +extern void dlg_attr_clear(WINDOW * /*win*/, int /*height*/, int /*width*/, chtype /*attr*/); +extern void dlg_auto_size(const char * /*title*/, const char * /*prompt*/, int * /*height*/, int * /*width*/, int /*boxlines*/, int /*mincols*/); +extern void dlg_auto_sizefile(const char * /*title*/, const char * /*file*/, int * /*height*/, int * /*width*/, int /*boxlines*/, int /*mincols*/); +extern void dlg_beeping(void); +extern void dlg_calc_listh(int * /*height*/, int * /*list_height*/, int /*item_no*/); +extern void dlg_clear(void); +extern void dlg_clr_result(void); +extern void dlg_ctl_size(int /*height*/, int /*width*/); +extern void dlg_del_window(WINDOW * /*win*/); +extern void dlg_does_output(void); +extern void dlg_draw_bottom_box(WINDOW * /*win*/); +extern void dlg_draw_box(WINDOW * /*win*/, int /*y*/, int /*x*/, int /*height*/, int /*width*/, chtype /*boxchar*/, chtype /*borderchar*/); +extern void dlg_draw_title(WINDOW *win, const char *title); +extern void dlg_exit(int /*code*/) GCC_NORETURN; +extern void dlg_item_help(const char * /*txt*/); +extern void dlg_print_autowrap(WINDOW * /*win*/, const char * /*prompt*/, int /*height*/, int /*width*/); +extern void dlg_print_size(int /*height*/, int /*width*/); +extern void dlg_print_text(WINDOW * /*win*/, const char * /*txt*/, int /*len*/, chtype * /*attr*/); +extern void dlg_put_backtitle(void); +extern void dlg_restore_vars(DIALOG_VARS * /* save */); +extern void dlg_save_vars(DIALOG_VARS * /* save */); +extern void dlg_set_focus(WINDOW * /*parent*/, WINDOW * /*win*/); +extern void dlg_tab_correct_str(char * /*prompt*/); +extern void dlg_trim_string(char * /*src*/); +extern void end_dialog(void); +extern void init_dialog(FILE * /*input*/, FILE * /*output*/); + +extern void dlg_exiterr(const char *, ...) GCC_NORETURN +#if defined(__GNUC__) && !defined(printf) +__attribute__((format(printf,1,2))) +#endif +; + +#ifdef HAVE_COLOR +extern chtype dlg_color_pair(int /*foreground*/, int /*background*/); +extern int dlg_color_count(void); +extern void dlg_color_setup(void); +extern void dlg_draw_shadow(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/); +#endif + +#ifdef HAVE_STRCASECMP +#define dlg_strcmp(a,b) strcasecmp(a,b) +#else +extern int dlg_strcmp(const char * /*a*/, const char * /*b*/); +#endif + +#ifdef HAVE_DLG_TRACE +#define DLG_TRACE(params) dlg_trace_msg params +extern void dlg_trace_msg(const char *fmt, ...) +#ifdef GCC_PRINTF + __attribute__((format(printf,1,2))) +#endif +; +extern void dlg_trace_win(WINDOW * /*win*/); +extern void dlg_trace_chr(int /*ch*/, int /*fkey*/); +extern void dlg_trace(const char * /*fname*/); +#else +#define DLG_TRACE(params) /* nothing */ +#define dlg_trace_win(win) /* nothing */ +#define dlg_trace_chr(ch,fkey) /* nothing */ +#define dlg_trace(fname) /* nothing */ +#endif + +#ifdef KEY_RESIZE +extern void dlg_move_window(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/); +#endif + +/* + * The following stuff is needed for mouse support + */ +typedef struct mseRegion { + int x, y, X, Y, code; + int mode, step_x, step_y; + struct mseRegion *next; +} mseRegion; + +#if defined(NCURSES_MOUSE_VERSION) + +#define mouse_open() mousemask(BUTTON1_CLICKED, (mmask_t *) 0) +#define mouse_close() mousemask(0, (mmask_t *) 0) + +extern mseRegion * dlg_mouse_mkregion (int /*y*/, int /*x*/, int /*height*/, int /*width*/, int /*code*/); +extern void dlg_mouse_free_regions (void); +extern void dlg_mouse_mkbigregion (int /*y*/, int /*x*/, int /*height*/, int /*width*/, int /*code*/, int /*step_x*/, int /*step_y*/, int /*mode*/); +extern void dlg_mouse_setbase (int /*x*/, int /*y*/); + +#define USE_MOUSE 1 + +#else + +#define mouse_open() /*nothing*/ +#define mouse_close() /*nothing*/ +#define dlg_mouse_free_regions() /* nothing */ +#define dlg_mouse_mkregion(y, x, height, width, code) /*nothing*/ +#define dlg_mouse_mkbigregion(y, x, height, width, code, step_x, step_y, mode) /*nothing*/ +#define dlg_mouse_setbase(x, y) /*nothing*/ + +#define USE_MOUSE 0 + +#endif + +extern mseRegion *dlg_mouse_region (int /*y*/, int /*x*/); +extern mseRegion *dlg_mouse_bigregion (int /*y*/, int /*x*/); +extern int dlg_mouse_wgetch (WINDOW * /*win*/, int * /*fkey*/); +extern int dlg_mouse_wgetch_nowait (WINDOW * /*win*/, int * /*fkey*/); + +#define mouse_mkbutton(y,x,len,code) dlg_mouse_mkregion(y,x,1,len,code); + +/* + * This is the base for fictitious keys, which activate + * the buttons. + * + * Mouse-generated keys are the following: + * -- the first 32 are used as numbers, in addition to '0'-'9' + * -- uppercase chars are used to invoke the button (M_EVENT + 'O') + */ +#define M_EVENT (DLGK_max + 1) + +/* + * The `flag' parameter in checklist is used to select between + * radiolist and checklist + */ +#define FLAG_CHECK 1 +#define FLAG_RADIO 0 + +/* + * This is used only for debugging (FIXME: should have a separate header). + */ +#ifdef NO_LEAKS +extern void _dlg_inputstr_leaks(void); +#if defined(NCURSES_VERSION) && defined(HAVE__NC_FREE_AND_EXIT) +extern void _nc_free_and_exit(int); /* nc_alloc.h normally not installed */ +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* DIALOG_H_included */ Index: contrib/dialog/VERSION =================================================================== --- contrib/dialog/VERSION (revision 0) +++ contrib/dialog/VERSION (revision 0) @@ -0,0 +1 @@ +7:1:0 1.1 20100428 Index: contrib/dialog/dlg_keys.h =================================================================== --- contrib/dialog/dlg_keys.h (revision 0) +++ contrib/dialog/dlg_keys.h (revision 0) @@ -0,0 +1,148 @@ +/* + * $Id: dlg_keys.h,v 1.24 2010/01/19 00:57:36 tom Exp $ + * + * dlg_keys.h -- runtime binding support for dialog + * + * Copyright 2005-2007,2010 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. + */ + +#ifndef DLG_KEYS_H_included +#define DLG_KEYS_H_included 1 + +#include <dialog.h> + +#ifdef USE_WIDE_CURSES +#include <wctype.h> +#define dlg_toupper(ch) towupper((wint_t)ch) +#define dlg_isupper(ch) iswupper((wint_t)ch) +#else +#define dlg_toupper(ch) toupper(ch) +#define dlg_isupper(ch) (isalpha(ch) && isupper(ch)) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + int is_function_key; + int curses_key; + int dialog_key; +} DLG_KEYS_BINDING; + +#define DLG_KEYS_DATA(dialog, curses) { curses >= KEY_MIN, curses, dialog } + +#define END_KEYS_BINDING { -1, 0, 0 } + +/* + * Define dialog's internal function-keys past the range used by curses. + */ +typedef enum { + DLGK_MIN = KEY_MAX + 1, + /* predefined buttons */ + DLGK_OK, + DLGK_CANCEL, + DLGK_EXTRA, + DLGK_HELP, + DLGK_ESC, + /* moving from screen to screen (pages) */ + DLGK_PAGE_FIRST, + DLGK_PAGE_LAST, + DLGK_PAGE_NEXT, + DLGK_PAGE_PREV, + /* moving within a list */ + DLGK_ITEM_FIRST, + DLGK_ITEM_LAST, + DLGK_ITEM_NEXT, + DLGK_ITEM_PREV, + /* moving from field to field (or buttons) */ + DLGK_FIELD_FIRST, + DLGK_FIELD_LAST, + DLGK_FIELD_NEXT, + DLGK_FIELD_PREV, + /* moving within a grid */ + DLGK_GRID_UP, + DLGK_GRID_DOWN, + DLGK_GRID_LEFT, + DLGK_GRID_RIGHT, + /* delete */ + DLGK_DELETE_LEFT, + DLGK_DELETE_RIGHT, + DLGK_DELETE_ALL, + /* special */ + DLGK_ENTER, + DLGK_BEGIN, + DLGK_FINAL, + DLGK_SELECT, + DLGK_TRACE +} DLG_KEYS_ENUM; + +#define is_DLGK_MOUSE(code) ((code) >= M_EVENT) +#define DLGK_MOUSE(code) ((code) + M_EVENT) + +#define ENTERKEY_BINDINGS \ + DLG_KEYS_DATA( DLGK_ENTER, '\n' ), \ + DLG_KEYS_DATA( DLGK_ENTER, '\r' ), \ + DLG_KEYS_DATA( DLGK_ENTER, KEY_ENTER ) + +/* ^U == 21 */ +#define INPUTSTR_BINDINGS \ + DLG_KEYS_DATA( DLGK_BEGIN, KEY_HOME ), \ + DLG_KEYS_DATA( DLGK_DELETE_ALL, CHR_KILL ), \ + DLG_KEYS_DATA( DLGK_DELETE_LEFT, CHR_BACKSPACE ), \ + DLG_KEYS_DATA( DLGK_DELETE_LEFT, KEY_BACKSPACE ), \ + DLG_KEYS_DATA( DLGK_DELETE_RIGHT, CHR_DELETE ), \ + DLG_KEYS_DATA( DLGK_DELETE_RIGHT, KEY_DC ), \ + DLG_KEYS_DATA( DLGK_FINAL, KEY_END ), \ + DLG_KEYS_DATA( DLGK_GRID_LEFT, KEY_LEFT ), \ + DLG_KEYS_DATA( DLGK_GRID_RIGHT, KEY_RIGHT ) + +#define SCROLLKEY_BINDINGS \ + DLG_KEYS_DATA( DLGK_GRID_DOWN, 'J' ), \ + DLG_KEYS_DATA( DLGK_GRID_DOWN, 'j' ), \ + DLG_KEYS_DATA( DLGK_GRID_DOWN, KEY_DOWN ), \ + DLG_KEYS_DATA( DLGK_GRID_UP, 'K' ), \ + DLG_KEYS_DATA( DLGK_GRID_UP, 'k' ), \ + DLG_KEYS_DATA( DLGK_GRID_UP, KEY_UP ), \ + DLG_KEYS_DATA( DLGK_PAGE_FIRST, 'g' ), \ + DLG_KEYS_DATA( DLGK_PAGE_FIRST, KEY_HOME ), \ + DLG_KEYS_DATA( DLGK_PAGE_LAST, 'G' ), \ + DLG_KEYS_DATA( DLGK_PAGE_LAST, KEY_END ), \ + DLG_KEYS_DATA( DLGK_PAGE_NEXT, 'F' ), \ + DLG_KEYS_DATA( DLGK_PAGE_NEXT, 'f' ), \ + DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), \ + DLG_KEYS_DATA( DLGK_PAGE_PREV, 'B' ), \ + DLG_KEYS_DATA( DLGK_PAGE_PREV, 'b' ), \ + DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE ) + +extern int dlg_lookup_key(WINDOW * /*win*/, int /*curses_key*/, int * /*dialog_key*/); +extern int dlg_result_key(int /*dialog_key*/, int /*fkey*/, int * /*resultp*/); +extern void dlg_register_buttons(WINDOW * /*win*/, const char * /*name*/, const char ** /*buttons*/); +extern void dlg_register_window(WINDOW * /*win*/, const char * /*name*/, DLG_KEYS_BINDING * /*binding*/); +extern void dlg_unregister_window(WINDOW * /*win*/); + +#ifdef HAVE_RC_FILE +extern int dlg_parse_bindkey(char * /*params*/); +extern void dlg_dump_keys(FILE * /*fp*/); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* DLG_KEYS_H_included */ Index: contrib/dialog/headers-sh.in =================================================================== --- contrib/dialog/headers-sh.in (revision 0) +++ contrib/dialog/headers-sh.in (revision 0) @@ -0,0 +1,150 @@ +#! /bin/sh +# $Id: headers-sh.in,v 1.5 2007/07/05 00:20:18 tom Exp $ +############################################################################## +# Copyright (c) 2004,2007 Thomas E. Dickey # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Adjust includes for header files that reside in a subdirectory of +# /usr/include, etc. +# +# Parameters (the first case creates the sed script): +# $1 is the target directory +# $2 is the source directory +# or (the second case does the install, using the sed script): +# $1 is the script to use for installing +# $2 is the target directory +# $3 is the source directory +# $4 is the file to install, editing source/target/etc. + +PACKAGE=@PACKAGE@ +PKGNAME=@PACKAGE_PREFIX@ +CONFIGH=@PACKAGE_CONFIG@ + +TMPSED=headers.sed + +DIGIT=0123456789 +alpha=abcdefghijklmnopqrstuvwxyz +ALPHA=ABCDEFGHIJKLMNOPQRSTUVWXYZ + +alnum=_${DIGIT}${alpha} +ALNUM=_${DIGIT}${ALPHA} +MIXED=_${DIGIT}${ALPHA}${alpha} + +if test $# = 2 ; then + rm -f $TMPSED + DST=$1 + REF=$2 + LEAF=`basename $DST` + + # map the include-directory, if needed, to the subdirectory + case $DST in + /*/include/$LEAF) + END=`basename $DST` + for i in $REF/*.h + do + NAME=`basename $i` + echo "s/<$NAME>/<$END\/$NAME>/g" >> $TMPSED + done + ;; + *) + echo "" >> $TMPSED + ;; + esac + + # cannot do _this_ in -e options: + cat >headers.tmp <<EOF +s/^#[^ ][^ ]*// +s/[^'$MIXED']/ /g +s/[ ][ ]*/ /g +s/^ // +s/ $// +:split + h + s/ .*// + p + t next + b done +:next + x + s/^[^ ][^ ]* // + t split +:done +EOF + # pick up autoconf-style symbols used in the application's headers + for i in $REF/*.h + do + sed -e 's/^[ ][ ]*#[ ][ ]*/#/' $i \ + | egrep '^#(if|ifdef|ifndef|elif)' \ + | sed -f headers.tmp \ + | sort -u \ + | egrep '^(HAVE_|NEED_|NO_|ENABLE_|DISABLE_)' \ + | sed -e 's%^\(.*\)%s/\\<\1\\>/'${PKGNAME}'_\1/g%' >>$TMPSED + done + rm -f headers.tmp + + # pick up autoconf-defined symbols in the config.h file + for name in ` + egrep '^#define[ ][ ]*['$ALNUM']' $REF/$CONFIGH \ + | sed -e 's/^#define[ ][ ]*//' \ + -e 's/[ ].*//' \ + | egrep -v "^${PACKAGE}_" \ + | sort -u \ + | egrep -v "^${PKGNAME}_"` + do + echo "s/\\<$name\\>/${PKGNAME}_$name/g" >>$TMPSED + done + + # reduce the count if possible, since some old sed's limit is 100 lines + sort -u $TMPSED >headers.tmp + mv headers.tmp $TMPSED +else + PRG="" + while test $# != 3 + do + PRG="$PRG $1"; shift + done + + DST=$1 + REF=$2 + SRC=$3 + + SHOW=`basename $SRC` + TMPSRC=${TMPDIR-/tmp}/${SHOW}$$ + + echo " ... $SHOW" + test -f $REF/$SRC && SRC="$REF/$SRC" + + rm -f $TMPSRC + sed -f $TMPSED $SRC > $TMPSRC + NAME=`basename $SRC` + + # Just in case someone gzip'd manpages, remove the conflicting copy. + test -f $DST/$NAME.gz && rm -f $DST/$NAME.gz + + eval $PRG $TMPSRC $DST/$NAME + rm -f $TMPSRC +fi Property changes on: contrib/dialog/headers-sh.in ___________________________________________________________________ Added: svn:executable + * Index: contrib/dialog/inputbox.c =================================================================== --- contrib/dialog/inputbox.c (revision 0) +++ contrib/dialog/inputbox.c (revision 0) @@ -0,0 +1,233 @@ +/* + * $Id: inputbox.c,v 1.64 2010/01/19 01:03:39 tom Exp $ + * + * inputbox.c -- implements the input box + * + * Copyright 2000-2009,2010 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> + +#define sTEXT -1 + +#define NAVIGATE_BINDINGS \ + DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_DOWN ), \ + DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ), \ + DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ), \ + DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ), \ + DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ), \ + DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_UP ) + +/* + * Display a dialog box for entering a string + */ +int +dialog_inputbox(const char *title, const char *cprompt, int height, int width, + const char *init, const int password) +{ + /* *INDENT-OFF* */ + static DLG_KEYS_BINDING binding[] = { + ENTERKEY_BINDINGS, + NAVIGATE_BINDINGS, + END_KEYS_BINDING + }; + static DLG_KEYS_BINDING binding2[] = { + INPUTSTR_BINDINGS, + ENTERKEY_BINDINGS, + NAVIGATE_BINDINGS, + END_KEYS_BINDING + }; + /* *INDENT-ON* */ + +#ifdef KEY_RESIZE + int old_height = height; + int old_width = width; +#endif + int xorg, yorg; + int x, y, box_y, box_x, box_width; + int show_buttons; + int col_offset = 0; + int chr_offset = 0; + int key, fkey, code; + int result = DLG_EXIT_UNKNOWN; + int state; + int first; + char *input; + WINDOW *dialog; + WINDOW *editor; + char *prompt = dlg_strclone(cprompt); + const char **buttons = dlg_ok_labels(); + + dlg_does_output(); + + dlg_tab_correct_str(prompt); + + /* Set up the initial value */ + input = dlg_set_result(init); + +#ifdef KEY_RESIZE + retry: +#endif + show_buttons = TRUE; + state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT; + first = (state == sTEXT); + key = fkey = 0; + + if (init != NULL) { + dlg_auto_size(title, prompt, &height, &width, 5, + MIN(MAX(dlg_count_columns(init) + 7, 26), + SCOLS - (dialog_vars.begin_set ? + dialog_vars.begin_x : 0))); + chr_offset = (int) strlen(init); + } else { + dlg_auto_size(title, prompt, &height, &width, 5, 26); + } + dlg_button_layout(buttons, &width); + dlg_print_size(height, width); + dlg_ctl_size(height, width); + + xorg = dlg_box_x_ordinate(width); + yorg = dlg_box_y_ordinate(height); + + dialog = dlg_new_window(height, width, yorg, xorg); + dlg_register_window(dialog, "inputbox", binding); + dlg_register_buttons(dialog, "inputbox", buttons); + + dlg_mouse_setbase(xorg, yorg); + + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); + dlg_draw_title(dialog, title); + + wattrset(dialog, dialog_attr); + dlg_print_autowrap(dialog, prompt, height, width); + + /* Draw the input field box */ + box_width = width - 6; + getyx(dialog, y, x); + box_y = y + 2; + box_x = (width - box_width) / 2; + dlg_mouse_mkregion(y + 1, box_x - 1, 3, box_width + 2, 'i'); + dlg_draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, + border_attr, dialog_attr); + + /* Make a window for the input-field, to associate bindings */ + editor = dlg_sub_window(dialog, 1, box_width, yorg + box_y, xorg + box_x); + dlg_register_window(editor, "inputbox", binding2); + + while (result == DLG_EXIT_UNKNOWN) { + int edit = 0; + + /* + * The last field drawn determines where the cursor is shown: + */ + if (show_buttons) { + show_buttons = FALSE; + col_offset = dlg_edit_offset(input, chr_offset, box_width); + (void) wmove(dialog, box_y, box_x + col_offset); + dlg_draw_buttons(dialog, height - 2, 0, buttons, state, FALSE, width); + } + + if (!first) { + key = dlg_mouse_wgetch((state == sTEXT) ? editor : dialog, &fkey); + if (dlg_result_key(key, fkey, &result)) + break; + } + + /* + * Handle mouse clicks first, since we want to know if this is a button, + * or something that dlg_edit_string() should handle. + */ + if (fkey + && is_DLGK_MOUSE(key) + && (code = dlg_ok_buttoncode(key - M_EVENT)) >= 0) { + result = code; + continue; + } + + if (state == sTEXT) { /* Input box selected */ + edit = dlg_edit_string(input, &chr_offset, key, fkey, first); + + if (edit) { + dlg_show_string(dialog, input, chr_offset, inputbox_attr, + box_y, box_x, box_width, password, first); + first = FALSE; + continue; + } else if (first) { + first = FALSE; + continue; + } + } + + /* handle non-functionkeys */ + if (!fkey && (code = dlg_char_to_button(key, buttons)) >= 0) { + dlg_del_window(dialog); + result = dlg_ok_buttoncode(code); + continue; + } + + /* handle functionkeys */ + if (fkey) { + switch (key) { + case DLGK_MOUSE('i'): /* mouse enter events */ + state = 0; + /* FALLTHRU */ + case DLGK_FIELD_PREV: + show_buttons = TRUE; + state = dlg_prev_ok_buttonindex(state, sTEXT); + break; + case DLGK_FIELD_NEXT: + show_buttons = TRUE; + state = dlg_next_ok_buttonindex(state, sTEXT); + break; + case ' ': /* FIXME: conflict with inputstr.c */ + case DLGK_ENTER: + dlg_del_window(dialog); + result = (state >= 0) ? dlg_ok_buttoncode(state) : DLG_EXIT_OK; + break; +#ifdef KEY_RESIZE + case KEY_RESIZE: + /* reset data */ + height = old_height; + width = old_width; + /* repaint */ + dlg_clear(); + dlg_del_window(dialog); + refresh(); + dlg_mouse_free_regions(); + goto retry; +#endif + default: + beep(); + break; + } + } else { + beep(); + } + } + + dlg_unregister_window(editor); + dlg_del_window(dialog); + dlg_mouse_free_regions(); + free(prompt); + return result; +} Index: contrib/dialog/dialog.lsm =================================================================== --- contrib/dialog/dialog.lsm (revision 0) +++ contrib/dialog/dialog.lsm (revision 0) @@ -0,0 +1,23 @@ +Begin3 +Title: dialog - Display dialog boxes in scripts +Version: 1.0-20060221 +Entered-date: 21FEB06 +Description: Dialog is a program that will let you present a variety + of questions or display messages in nice looking color + non-graphical dialog boxes from a shell or perl script. + Various dialog boxes can be presented such as yes/no, menu, + input, message, checklist, radiolist, and more. + + This program is based on the no longer maintained cdialog, but + contains bug fixes and more features. +Keywords: dialog, cdialog, shell, script, window +Author: Originally Savio Lam for the ancient version +Maintained-by: Thomas E. Dickey <dickey@invisible-island.net> + Vila, Santiago <sanvila@debian.org> +Primary-site: http://invisible-island.net/dialog/ + http://packages.debian.org/ +Alternate-site: ftp://ftp.us.debian.org/debian/pool/main/d/dialog/ +Original-site: ftp://sunsite.unc.edu/pub/Linux/utils/shell +Platforms: Linux *nix, OS/2 EMX +Copying-policy: LGPL +End Index: contrib/dialog/config.guess =================================================================== --- contrib/dialog/config.guess (revision 0) +++ contrib/dialog/config.guess (revision 0) @@ -0,0 +1,1502 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +timestamp='2009-12-30' + +# This file 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 of the License, or +# (at your option) any later version. +# +# 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 +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to <config-patches@gnu.org> and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free +Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +and + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: Property changes on: contrib/dialog/config.guess ___________________________________________________________________ Added: svn:executable + * Index: contrib/dialog/checklist.c =================================================================== --- contrib/dialog/checklist.c (revision 0) +++ contrib/dialog/checklist.c (revision 0) @@ -0,0 +1,712 @@ +/* + * $Id: checklist.c,v 1.121 2010/01/17 19:32:17 tom Exp $ + * + * checklist.c -- implements the checklist box + * + * Copyright 2000-2009,2010 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) + * Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension + * Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two + */ + +#include <dialog.h> +#include <dlg_keys.h> + +static int list_width, check_x, item_x, checkflag; + +#define MIN_HIGH (1 + (5 * MARGIN)) + +#define LLEN(n) ((n) * CHECKBOX_TAGS) +#define ItemData(i) &items[LLEN(i)] +#define ItemName(i) items[LLEN(i)] +#define ItemText(i) items[LLEN(i) + 1] +#define ItemStatus(i) items[LLEN(i) + 2] +#define ItemHelp(i) items[LLEN(i) + 3] + +static void +print_arrows(WINDOW *win, + int box_x, + int box_y, + int scrollamt, + int choice, + int item_no, + int list_height) +{ + dlg_draw_scrollbar(win, + scrollamt, + scrollamt, + scrollamt + choice, + item_no, + box_x + check_x, + box_x + list_width, + box_y, + box_y + list_height + 1, + menubox_attr, + menubox_border_attr); +} + +/* + * Print list item. The 'selected' parameter is true if 'choice' is the + * current item. That one is colored differently from the other items. + */ +static void +print_item(WINDOW *win, + DIALOG_LISTITEM * item, + const char *states, + int choice, + int selected) +{ + chtype save = getattrs(win); + int i; + chtype attr = A_NORMAL; + const int *cols; + const int *indx; + int limit; + + /* Clear 'residue' of last item */ + wattrset(win, menubox_attr); + (void) wmove(win, choice, 0); + for (i = 0; i < list_width; i++) + (void) waddch(win, ' '); + + (void) wmove(win, choice, check_x); + wattrset(win, selected ? check_selected_attr : check_attr); + (void) wprintw(win, + (checkflag == FLAG_CHECK) ? "[%c]" : "(%c)", + states[item->state]); + wattrset(win, menubox_attr); + (void) waddch(win, ' '); + + if (strlen(item->name) != 0) { + + indx = dlg_index_wchars(item->name); + + wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); + (void) waddnstr(win, item->name, indx[1]); + + if ((int) strlen(item->name) > indx[1]) { + limit = dlg_limit_columns(item->name, (item_x - check_x - 6), 1); + if (limit > 1) { + wattrset(win, selected ? tag_selected_attr : tag_attr); + (void) waddnstr(win, + item->name + indx[1], + indx[limit] - indx[1]); + } + } + } + + if (strlen(item->text) != 0) { + cols = dlg_index_columns(item->text); + limit = dlg_limit_columns(item->text, (getmaxx(win) - item_x + 1), 0); + + if (limit > 0) { + (void) wmove(win, choice, item_x); + wattrset(win, selected ? item_selected_attr : item_attr); + dlg_print_text(win, item->text, cols[limit], &attr); + } + } + + if (selected) { + dlg_item_help(item->help); + } + wattrset(win, save); +} + +/* + * This is an alternate interface to 'checklist' which allows the application + * to read the list item states back directly without putting them in the + * output buffer. It also provides for more than two states over which the + * check/radio box can display. + */ +int +dlg_checklist(const char *title, + const char *cprompt, + int height, + int width, + int list_height, + int item_no, + DIALOG_LISTITEM * items, + const char *states, + int flag, + int *current_item) +{ + /* *INDENT-OFF* */ + static DLG_KEYS_BINDING binding[] = { + ENTERKEY_BINDINGS, + DLG_KEYS_DATA( DLGK_FIELD_NEXT, KEY_RIGHT ), + DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ), + DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ), + DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_LEFT ), + DLG_KEYS_DATA( DLGK_ITEM_FIRST, KEY_HOME ), + DLG_KEYS_DATA( DLGK_ITEM_LAST, KEY_END ), + DLG_KEYS_DATA( DLGK_ITEM_LAST, KEY_LL ), + DLG_KEYS_DATA( DLGK_ITEM_NEXT, '+' ), + DLG_KEYS_DATA( DLGK_ITEM_NEXT, KEY_DOWN ), + DLG_KEYS_DATA( DLGK_ITEM_NEXT, CHR_NEXT ), + DLG_KEYS_DATA( DLGK_ITEM_PREV, '-' ), + DLG_KEYS_DATA( DLGK_ITEM_PREV, KEY_UP ), + DLG_KEYS_DATA( DLGK_ITEM_PREV, CHR_PREVIOUS ), + DLG_KEYS_DATA( DLGK_PAGE_NEXT, KEY_NPAGE ), + DLG_KEYS_DATA( DLGK_PAGE_NEXT, DLGK_MOUSE(KEY_NPAGE) ), + DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE ), + DLG_KEYS_DATA( DLGK_PAGE_PREV, DLGK_MOUSE(KEY_PPAGE) ), + END_KEYS_BINDING + }; + /* *INDENT-ON* */ + +#ifdef KEY_RESIZE + int old_height = height; + int old_width = width; +#endif + int i, j, key2, found, x, y, cur_x, cur_y, box_x, box_y; + int key = 0, fkey; + int button = dialog_state.visit_items ? -1 : dlg_defaultno_button(); + int choice = dlg_default_listitem(items); + int scrollamt = 0; + int max_choice; + int was_mouse; + int use_height; + int use_width, name_width, text_width; + int result = DLG_EXIT_UNKNOWN; + int num_states; + WINDOW *dialog, *list; + char *prompt = dlg_strclone(cprompt); + const char **buttons = dlg_ok_labels(); + + dlg_does_output(); + dlg_tab_correct_str(prompt); + +#ifdef KEY_RESIZE + retry: +#endif + + use_height = list_height; + if (use_height == 0) { + use_width = dlg_calc_list_width(item_no, items) + 10; + /* calculate height without items (4) */ + dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MAX(26, use_width)); + dlg_calc_listh(&height, &use_height, item_no); + } else { + dlg_auto_size(title, prompt, &height, &width, MIN_HIGH + use_height, 26); + } + dlg_button_layout(buttons, &width); + dlg_print_size(height, width); + dlg_ctl_size(height, width); + + /* we need at least two states */ + if (states == 0 || strlen(states) < 2) + states = " *"; + num_states = (int) strlen(states); + + checkflag = flag; + + x = dlg_box_x_ordinate(width); + y = dlg_box_y_ordinate(height); + + dialog = dlg_new_window(height, width, y, x); + dlg_register_window(dialog, "checklist", binding); + dlg_register_buttons(dialog, "checklist", buttons); + + dlg_mouse_setbase(x, y); + + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); + dlg_draw_title(dialog, title); + + wattrset(dialog, dialog_attr); + dlg_print_autowrap(dialog, prompt, height, width); + + list_width = width - 6; + getyx(dialog, cur_y, cur_x); + box_y = cur_y + 1; + box_x = (width - list_width) / 2 - 1; + + /* + * After displaying the prompt, we know how much space we really have. + * Limit the list to avoid overwriting the ok-button. + */ + if (use_height + MIN_HIGH > height - cur_y) + use_height = height - MIN_HIGH - cur_y; + if (use_height <= 0) + use_height = 1; + + max_choice = MIN(use_height, item_no); + + /* create new window for the list */ + list = dlg_sub_window(dialog, use_height, list_width, + y + box_y + 1, x + box_x + 1); + + /* draw a box around the list items */ + dlg_draw_box(dialog, box_y, box_x, + use_height + 2 * MARGIN, + list_width + 2 * MARGIN, + menubox_border_attr, menubox_attr); + + text_width = 0; + name_width = 0; + /* Find length of longest item to center checklist */ + for (i = 0; i < item_no; i++) { + text_width = MAX(text_width, dlg_count_columns(items[i].text)); + name_width = MAX(name_width, dlg_count_columns(items[i].name)); + } + + /* If the name+text is wider than the list is allowed, then truncate + * one or both of them. If the name is no wider than 1/4 of the list, + * leave it intact. + */ + use_width = (list_width - 6); + if (text_width + name_width > use_width) { + int need = (int) (0.25 * use_width); + if (name_width > need) { + int want = (int) (use_width * ((double) name_width) / + (text_width + name_width)); + name_width = (want > need) ? want : need; + } + text_width = use_width - name_width; + } + + check_x = (use_width - (text_width + name_width)) / 2; + item_x = name_width + check_x + 6; + + /* ensure we are scrolled to show the current choice */ + if (choice >= (max_choice + scrollamt)) { + scrollamt = choice - max_choice + 1; + choice = max_choice - 1; + } + /* Print the list */ + for (i = 0; i < max_choice; i++) + print_item(list, + &items[i + scrollamt], + states, + i, i == choice); + (void) wnoutrefresh(list); + + /* register the new window, along with its borders */ + dlg_mouse_mkbigregion(box_y + 1, box_x, use_height, list_width + 2, + KEY_MAX, 1, 1, 1 /* by lines */ ); + + print_arrows(dialog, + box_x, box_y, + scrollamt, max_choice, item_no, use_height); + + dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); + + while (result == DLG_EXIT_UNKNOWN) { + if (button < 0) /* --visit-items */ + wmove(dialog, box_y + choice + 1, box_x + check_x + 2); + + key = dlg_mouse_wgetch(dialog, &fkey); + if (dlg_result_key(key, fkey, &result)) + break; + + was_mouse = (fkey && is_DLGK_MOUSE(key)); + if (was_mouse) + key -= M_EVENT; + + if (was_mouse && (key >= KEY_MAX)) { + getyx(dialog, cur_y, cur_x); + i = (key - KEY_MAX); + if (i < max_choice) { + /* De-highlight current item */ + print_item(list, + &items[scrollamt + choice], + states, + choice, FALSE); + /* Highlight new item */ + choice = (key - KEY_MAX); + print_item(list, + &items[scrollamt + choice], + states, + choice, TRUE); + (void) wnoutrefresh(list); + (void) wmove(dialog, cur_y, cur_x); + + key = ' '; /* force the selected item to toggle */ + } else { + beep(); + continue; + } + fkey = FALSE; + } else if (was_mouse && key >= KEY_MIN) { + key = dlg_lookup_key(dialog, key, &fkey); + } + + /* + * A space toggles the item status. We handle either a checklist + * (any number of items can be selected) or radio list (zero or one + * items can be selected). + */ + if (key == ' ') { + int current = scrollamt + choice; + int next = items[current].state + 1; + + if (next >= num_states) + next = 0; + + getyx(dialog, cur_y, cur_x); + if (flag == FLAG_CHECK) { /* checklist? */ + items[current].state = next; + print_item(list, + &items[scrollamt + choice], + states, + choice, TRUE); + } else { /* radiolist */ + for (i = 0; i < item_no; i++) { + if (i != current) { + items[i].state = 0; + } + } + if (items[current].state) { + items[current].state = next ? next : 1; + print_item(list, + &items[current], + states, + choice, TRUE); + } else { + items[current].state = 1; + for (i = 0; i < max_choice; i++) + print_item(list, + &items[scrollamt + i], + states, + i, i == choice); + } + } + (void) wnoutrefresh(list); + (void) wmove(dialog, cur_y, cur_x); + wrefresh(dialog); + continue; /* wait for another key press */ + } + + /* + * Check if key pressed matches first character of any item tag in + * list. If there is more than one match, we will cycle through + * each one as the same key is pressed repeatedly. + */ + found = FALSE; + if (!fkey) { + if (button < 0 || !dialog_state.visit_items) { + for (j = scrollamt + choice + 1; j < item_no; j++) { + if (dlg_match_char(dlg_last_getc(), items[j].name)) { + found = TRUE; + i = j - scrollamt; + break; + } + } + if (!found) { + for (j = 0; j <= scrollamt + choice; j++) { + if (dlg_match_char(dlg_last_getc(), items[j].name)) { + found = TRUE; + i = j - scrollamt; + break; + } + } + } + if (found) + dlg_flush_getc(); + } else if ((j = dlg_char_to_button(key, buttons)) >= 0) { + button = j; + ungetch('\n'); + continue; + } + } + + /* + * A single digit (1-9) positions the selection to that line in the + * current screen. + */ + if (!found + && (key <= '9') + && (key > '0') + && (key - '1' < max_choice)) { + found = TRUE; + i = key - '1'; + } + + if (!found) { + if (fkey) { + found = TRUE; + switch (key) { + case DLGK_ITEM_FIRST: + i = -scrollamt; + break; + case DLGK_ITEM_LAST: + i = item_no - 1 - scrollamt; + break; + case DLGK_PAGE_PREV: + if (choice) + i = 0; + else if (scrollamt != 0) + i = -MIN(scrollamt, max_choice); + else + continue; + break; + case DLGK_PAGE_NEXT: + i = MIN(choice + max_choice, item_no - scrollamt - 1); + break; + case DLGK_ITEM_PREV: + i = choice - 1; + if (choice == 0 && scrollamt == 0) + continue; + break; + case DLGK_ITEM_NEXT: + i = choice + 1; + if (scrollamt + choice >= item_no - 1) + continue; + break; + default: + found = FALSE; + break; + } + } + } + + if (found) { + if (i != choice) { + getyx(dialog, cur_y, cur_x); + if (i < 0 || i >= max_choice) { +#if defined(NCURSES_VERSION_MAJOR) && NCURSES_VERSION_MAJOR < 5 + /* + * Using wscrl to assist ncurses scrolling is not needed + * in version 5.x + */ + if (i == -1) { + if (use_height > 1) { + /* De-highlight current first item */ + print_item(list, + &items[scrollamt], + states, + 0, FALSE); + scrollok(list, TRUE); + wscrl(list, -1); + scrollok(list, FALSE); + } + scrollamt--; + print_item(list, + &items[scrollamt], + states, + 0, TRUE); + } else if (i == max_choice) { + if (use_height > 1) { + /* De-highlight current last item before scrolling up */ + print_item(list, + &items[scrollamt + max_choice - 1], + states, + max_choice - 1, FALSE); + scrollok(list, TRUE); + wscrl(list, 1); + scrollok(list, FALSE); + } + scrollamt++; + print_item(list, + &items[scrollamt + max_choice - 1], + states, + max_choice - 1, TRUE); + } else +#endif + { + if (i < 0) { + scrollamt += i; + choice = 0; + } else { + choice = max_choice - 1; + scrollamt += (i - max_choice + 1); + } + for (i = 0; i < max_choice; i++) { + print_item(list, + &items[scrollamt + i], + states, + i, i == choice); + } + } + (void) wnoutrefresh(list); + print_arrows(dialog, + box_x, box_y, + scrollamt, max_choice, item_no, use_height); + } else { + /* De-highlight current item */ + print_item(list, + &items[scrollamt + choice], + states, + choice, FALSE); + /* Highlight new item */ + choice = i; + print_item(list, + &items[scrollamt + choice], + states, + choice, TRUE); + (void) wnoutrefresh(list); + print_arrows(dialog, + box_x, box_y, + scrollamt, max_choice, item_no, use_height); + (void) wmove(dialog, cur_y, cur_x); + wrefresh(dialog); + } + } + continue; /* wait for another key press */ + } + + if (fkey) { + switch (key) { + case DLGK_ENTER: + result = dlg_ok_buttoncode(button); + break; + case DLGK_FIELD_PREV: + button = dlg_prev_button(buttons, button); + dlg_draw_buttons(dialog, height - 2, 0, buttons, button, + FALSE, width); + break; + case DLGK_FIELD_NEXT: + button = dlg_next_button(buttons, button); + dlg_draw_buttons(dialog, height - 2, 0, buttons, button, + FALSE, width); + break; +#ifdef KEY_RESIZE + case KEY_RESIZE: + /* reset data */ + height = old_height; + width = old_width; + /* repaint */ + dlg_clear(); + dlg_del_window(dialog); + refresh(); + dlg_mouse_free_regions(); + goto retry; +#endif + default: + if (was_mouse) { + if ((key2 = dlg_ok_buttoncode(key)) >= 0) { + result = key2; + break; + } + beep(); + } + } + } else { + beep(); + } + } + + dlg_del_window(dialog); + dlg_mouse_free_regions(); + free(prompt); + *current_item = (scrollamt + choice); + return result; +} + +/* + * Display a dialog box with a list of options that can be turned on or off + * The `flag' parameter is used to select between radiolist and checklist. + */ +int +dialog_checklist(const char *title, + const char *cprompt, + int height, + int width, + int list_height, + int item_no, + char **items, + int flag) +{ + int result; + int i; + DIALOG_LISTITEM *listitems; + bool separate_output = ((flag == FLAG_CHECK) + && (dialog_vars.separate_output)); + bool show_status = FALSE; + int current = 0; + + listitems = dlg_calloc(DIALOG_LISTITEM, (size_t) item_no + 1); + assert_ptr(listitems, "dialog_checklist"); + + for (i = 0; i < item_no; ++i) { + listitems[i].name = ItemName(i); + listitems[i].text = ItemText(i); + listitems[i].help = ((dialog_vars.item_help) + ? ItemHelp(i) + : dlg_strempty()); + listitems[i].state = !dlg_strcmp(ItemStatus(i), "on"); + } + dlg_align_columns(&listitems[0].text, sizeof(DIALOG_LISTITEM), item_no); + + result = dlg_checklist(title, + cprompt, + height, + width, + list_height, + item_no, + listitems, + NULL, + flag, + ¤t); + + switch (result) { + case DLG_EXIT_OK: /* FALLTHRU */ + case DLG_EXIT_EXTRA: + show_status = TRUE; + break; + case DLG_EXIT_HELP: + dlg_add_result("HELP "); + show_status = dialog_vars.help_status; + if (USE_ITEM_HELP(listitems[current].help)) { + if (show_status) { + if (separate_output) { + dlg_add_string(listitems[current].help); + dlg_add_separator(); + } else { + dlg_add_quoted(listitems[current].help); + } + } else { + dlg_add_string(listitems[current].help); + } + result = DLG_EXIT_ITEM_HELP; + } else { + if (show_status) { + if (separate_output) { + dlg_add_string(listitems[current].name); + dlg_add_separator(); + } else { + dlg_add_quoted(listitems[current].name); + } + } else { + dlg_add_string(listitems[current].name); + } + } + break; + } + + if (show_status) { + for (i = 0; i < item_no; i++) { + if (listitems[i].state) { + if (separate_output) { + dlg_add_string(listitems[i].name); + dlg_add_separator(); + } else { + if (dlg_need_separator()) + dlg_add_separator(); + dlg_add_string(listitems[i].name); + } + } + } + } + + dlg_free_columns(&listitems[0].text, sizeof(DIALOG_LISTITEM), item_no); + free(listitems); + return result; +} Index: contrib/dialog/calendar.c =================================================================== --- contrib/dialog/calendar.c (revision 0) +++ contrib/dialog/calendar.c (revision 0) @@ -0,0 +1,678 @@ +/* + * $Id: calendar.c,v 1.59 2010/01/18 09:50:44 tom Exp $ + * + * calendar.c -- implements the calendar box + * + * Copyright 2001-2009,2010 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. + */ + +#include <dialog.h> +#include <dlg_keys.h> + +#include <time.h> + +#define ONE_DAY (60 * 60 * 24) + +#define MON_WIDE 4 /* width of a month-name */ +#define DAY_HIGH 6 /* maximum lines in day-grid */ +#define DAY_WIDE (8 * MON_WIDE) /* width of the day-grid */ +#define HDR_HIGH 1 /* height of cells with month/year */ +#define BTN_HIGH 1 /* height of button-row excluding margin */ + +/* two more lines: titles for day-of-week and month/year boxes */ +#define MIN_HIGH (DAY_HIGH + 2 + HDR_HIGH + BTN_HIGH + (7 * MARGIN)) +#define MIN_WIDE (DAY_WIDE + (4 * MARGIN)) + +typedef enum { + sMONTH = -3 + ,sYEAR = -2 + ,sDAY = -1 +} STATES; + +struct _box; + +typedef int (*BOX_DRAW) (struct _box *, struct tm *); + +typedef struct _box { + WINDOW *parent; + WINDOW *window; + int x; + int y; + int width; + int height; + BOX_DRAW box_draw; +} BOX; + +static const char * +nameOfDayOfWeek(int n) +{ + static const char *table[7] +#ifndef ENABLE_NLS + = + { + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" + } +#endif + ; + const char *result = 0; + + if (n >= 0 && n < 7) { +#ifdef ENABLE_NLS + if (table[n] == 0) { + nl_item items[7] = + { + ABDAY_1, ABDAY_2, ABDAY_3, ABDAY_4, ABDAY_5, ABDAY_6, ABDAY_7 + }; + table[n] = nl_langinfo(items[n]); + } +#endif + result = table[n]; + } + if (result == 0) { + result = "?"; + } + return result; +} + +static const char * +nameOfMonth(int n) +{ + static const char *table[12] +#ifndef ENABLE_NLS + = + { + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + } +#endif + ; + const char *result = 0; + + if (n >= 0 && n < 12) { +#ifdef ENABLE_NLS + if (table[n] == 0) { + nl_item items[12] = + { + MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, + MON_7, MON_8, MON_9, MON_10, MON_11, MON_12 + }; + table[n] = nl_langinfo(items[n]); + } +#endif + result = table[n]; + } + if (result == 0) { + result = "?"; + } + return result; +} + +static int +days_in_month(struct tm *current, int offset /* -1, 0, 1 */ ) +{ + static const int nominal[] = + { + 31, 28, 31, 30, 31, 30, + 31, 31, 30, 31, 30, 31 + }; + int year = current->tm_year; + int month = current->tm_mon + offset; + int result; + + while (month < 0) { + month += 12; + year -= 1; + } + while (month >= 12) { + month -= 12; + year += 1; + } + result = nominal[month]; + if (month == 1) + result += ((year % 4) == 0); + return result; +} + +static int +days_in_year(struct tm *current, int offset /* -1, 0, 1 */ ) +{ + int year = current->tm_year + 1900 + offset; + + return ((year % 4) == 0) ? 366 : 365; +} + +static int +day_cell_number(struct tm *current) +{ + int cell; + cell = current->tm_mday - ((6 + current->tm_mday - current->tm_wday) % 7); + if ((current->tm_mday - 1) % 7 != current->tm_wday) + cell += 6; + else + cell--; + return cell; +} + +static int +next_or_previous(int key, int two_d) +{ + int result = 0; + + switch (key) { + case DLGK_GRID_UP: + result = two_d ? -7 : -1; + break; + case DLGK_GRID_LEFT: + result = -1; + break; + case DLGK_GRID_DOWN: + result = two_d ? 7 : 1; + break; + case DLGK_GRID_RIGHT: + result = 1; + break; + default: + beep(); + break; + } + return result; +} + +/* + * Draw the day-of-month selection box + */ +static int +draw_day(BOX * data, struct tm *current) +{ + int cell_wide = MON_WIDE; + int y, x, this_x = 0; + int save_y = 0, save_x = 0; + int day = current->tm_mday; + int mday; + int week; + int last = days_in_month(current, 0); + int prev = days_in_month(current, -1); + + werase(data->window); + dlg_draw_box(data->parent, + data->y - MARGIN, data->x - MARGIN, + data->height + (2 * MARGIN), data->width + (2 * MARGIN), + menubox_border_attr, menubox_attr); /* border of daybox */ + + wattrset(data->window, menubox_attr); /* daynames headline */ + for (x = 0; x < 7; x++) { + mvwprintw(data->window, + 0, (x + 1) * cell_wide, "%*.*s ", + cell_wide - 1, + cell_wide - 1, + nameOfDayOfWeek(x)); + } + + mday = ((6 + current->tm_mday - current->tm_wday) % 7) - 7; + if (mday <= -7) + mday += 7; + /* mday is now in the range -6 to 0. */ + week = (current->tm_yday + 6 + mday - current->tm_mday) / 7; + + for (y = 1; mday < last; y++) { + wattrset(data->window, menubox_attr); /* weeknumbers headline */ + mvwprintw(data->window, + y, 0, + "%*d ", + cell_wide - 1, + ++week); + for (x = 0; x < 7; x++) { + this_x = 1 + (x + 1) * cell_wide; + ++mday; + if (wmove(data->window, y, this_x) == ERR) + continue; + wattrset(data->window, item_attr); /* not selected days */ + if (mday == day) { + wattrset(data->window, item_selected_attr); /* selected day */ + save_y = y; + save_x = this_x; + } + if (mday > 0) { + if (mday <= last) { + wprintw(data->window, "%*d", cell_wide - 2, mday); + } else if (mday == day) { + wprintw(data->window, "%*d", cell_wide - 2, mday - last); + } + } else if (mday == day) { + wprintw(data->window, "%*d", cell_wide - 2, mday + prev); + } + } + wmove(data->window, save_y, save_x); + } + /* just draw arrows - scrollbar is unsuitable here */ + dlg_draw_arrows(data->parent, TRUE, TRUE, + data->x + ARROWS_COL, + data->y - 1, + data->y + data->height); + + return 0; +} + +/* + * Draw the month-of-year selection box + */ +static int +draw_month(BOX * data, struct tm *current) +{ + int month; + + month = current->tm_mon + 1; + + wattrset(data->parent, dialog_attr); /* Headline "Month" */ + (void) mvwprintw(data->parent, data->y - 2, data->x - 1, _("Month")); + dlg_draw_box(data->parent, + data->y - 1, data->x - 1, + data->height + 2, data->width + 2, + menubox_border_attr, menubox_attr); /* borders of monthbox */ + wattrset(data->window, item_attr); /* color the month selection */ + mvwprintw(data->window, 0, 0, "%s", nameOfMonth(month - 1)); + wmove(data->window, 0, 0); + return 0; +} + +/* + * Draw the year selection box + */ +static int +draw_year(BOX * data, struct tm *current) +{ + int year = current->tm_year + 1900; + + wattrset(data->parent, dialog_attr); /* Headline "Year" */ + (void) mvwprintw(data->parent, data->y - 2, data->x - 1, _("Year")); + dlg_draw_box(data->parent, + data->y - 1, data->x - 1, + data->height + 2, data->width + 2, + menubox_border_attr, menubox_attr); /* borders of yearbox */ + wattrset(data->window, item_attr); /* color the year selection */ + mvwprintw(data->window, 0, 0, "%4d", year); + wmove(data->window, 0, 0); + return 0; +} + +static int +init_object(BOX * data, + WINDOW *parent, + int x, int y, + int width, int height, + BOX_DRAW box_draw, + int code) +{ + data->parent = parent; + data->x = x; + data->y = y; + data->width = width; + data->height = height; + data->box_draw = box_draw; + + data->window = derwin(data->parent, + data->height, data->width, + data->y, data->x); + if (data->window == 0) + return -1; + (void) keypad(data->window, TRUE); + + dlg_mouse_setbase(getbegx(parent), getbegy(parent)); + if (code == 'D') { + dlg_mouse_mkbigregion(y + 1, x + MON_WIDE, height - 1, width - MON_WIDE, + KEY_MAX, 1, MON_WIDE, 3); + } else { + dlg_mouse_mkregion(y, x, height, width, code); + } + + return 0; +} + +static int +CleanupResult(int code, WINDOW *dialog, char *prompt, DIALOG_VARS * save_vars) +{ + if (dialog != 0) + dlg_del_window(dialog); + dlg_mouse_free_regions(); + if (prompt != 0) + free(prompt); + dlg_restore_vars(save_vars); + + return code; +} + +#define DrawObject(data) (data)->box_draw(data, ¤t) + +/* + * Display a dialog box for entering a date + */ +int +dialog_calendar(const char *title, + const char *subtitle, + int height, + int width, + int day, + int month, + int year) +{ + /* *INDENT-OFF* */ + static DLG_KEYS_BINDING binding[] = { + ENTERKEY_BINDINGS, + DLG_KEYS_DATA( DLGK_ENTER, ' ' ), + DLG_KEYS_DATA( DLGK_FIELD_NEXT, TAB ), + DLG_KEYS_DATA( DLGK_FIELD_PREV, KEY_BTAB ), + DLG_KEYS_DATA( DLGK_GRID_DOWN, 'j' ), + DLG_KEYS_DATA( DLGK_GRID_DOWN, DLGK_MOUSE(KEY_NPAGE) ), + DLG_KEYS_DATA( DLGK_GRID_DOWN, KEY_DOWN ), + DLG_KEYS_DATA( DLGK_GRID_DOWN, KEY_NPAGE ), + DLG_KEYS_DATA( DLGK_GRID_LEFT, '-' ), + DLG_KEYS_DATA( DLGK_GRID_LEFT, 'h' ), + DLG_KEYS_DATA( DLGK_GRID_LEFT, CHR_BACKSPACE ), + DLG_KEYS_DATA( DLGK_GRID_LEFT, CHR_PREVIOUS ), + DLG_KEYS_DATA( DLGK_GRID_LEFT, KEY_LEFT ), + DLG_KEYS_DATA( DLGK_GRID_RIGHT, '+' ), + DLG_KEYS_DATA( DLGK_GRID_RIGHT, 'l' ), + DLG_KEYS_DATA( DLGK_GRID_RIGHT, CHR_NEXT ), + DLG_KEYS_DATA( DLGK_GRID_RIGHT, KEY_NEXT ), + DLG_KEYS_DATA( DLGK_GRID_RIGHT, KEY_RIGHT ), + DLG_KEYS_DATA( DLGK_GRID_UP, 'k' ), + DLG_KEYS_DATA( DLGK_GRID_UP, KEY_PPAGE ), + DLG_KEYS_DATA( DLGK_GRID_UP, KEY_PREVIOUS ), + DLG_KEYS_DATA( DLGK_GRID_UP, KEY_UP ), + DLG_KEYS_DATA( DLGK_GRID_UP, DLGK_MOUSE(KEY_PPAGE) ), + END_KEYS_BINDING + }; + /* *INDENT-ON* */ + +#ifdef KEY_RESIZE + int old_height = height; + int old_width = width; +#endif + BOX dy_box, mn_box, yr_box; + int fkey; + int key = 0; + int key2; + int step; + int button; + int result = DLG_EXIT_UNKNOWN; + WINDOW *dialog; + time_t now_time = time((time_t *) 0); + struct tm current; + int state = dlg_defaultno_button(); + const char **buttons = dlg_ok_labels(); + char *prompt = dlg_strclone(subtitle); + int mincols = MIN_WIDE; + char buffer[MAX_LEN]; + DIALOG_VARS save_vars; + + dlg_save_vars(&save_vars); + dialog_vars.separate_output = TRUE; + + dlg_does_output(); + + now_time = time((time_t *) 0); + current = *localtime(&now_time); + if (day < 0) + day = current.tm_mday; + if (month < 0) + month = current.tm_mon + 1; + if (year < 0) + year = current.tm_year + 1900; + + /* compute a struct tm that matches the day/month/year parameters */ + if (((year -= 1900) > 0) && (year < 200)) { + /* ugly, but I'd like to run this on older machines w/o mktime -TD */ + for (;;) { + if (year > current.tm_year) { + now_time += ONE_DAY * days_in_year(¤t, 0); + } else if (year < current.tm_year) { + now_time -= ONE_DAY * days_in_year(¤t, -1); + } else if (month > current.tm_mon + 1) { + now_time += ONE_DAY * days_in_month(¤t, 0); + } else if (month < current.tm_mon + 1) { + now_time -= ONE_DAY * days_in_month(¤t, -1); + } else if (day > current.tm_mday) { + now_time += ONE_DAY; + } else if (day < current.tm_mday) { + now_time -= ONE_DAY; + } else { + break; + } + current = *localtime(&now_time); + } + } + dlg_button_layout(buttons, &mincols); + +#ifdef KEY_RESIZE + retry: +#endif + + dlg_auto_size(title, prompt, &height, &width, 0, mincols); + height += MIN_HIGH - 1; + dlg_print_size(height, width); + dlg_ctl_size(height, width); + + dialog = dlg_new_window(height, width, + dlg_box_y_ordinate(height), + dlg_box_x_ordinate(width)); + dlg_register_window(dialog, "calendar", binding); + dlg_register_buttons(dialog, "calendar", buttons); + + /* mainbox */ + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); + dlg_draw_title(dialog, title); + + wattrset(dialog, dialog_attr); /* text mainbox */ + dlg_print_autowrap(dialog, prompt, height, width); + + /* compute positions of day, month and year boxes */ + memset(&dy_box, 0, sizeof(dy_box)); + memset(&mn_box, 0, sizeof(mn_box)); + memset(&yr_box, 0, sizeof(yr_box)); + + if (init_object(&dy_box, + dialog, + (width - DAY_WIDE) / 2, + 1 + (height - (DAY_HIGH + BTN_HIGH + (5 * MARGIN))), + DAY_WIDE, + DAY_HIGH + 1, + draw_day, + 'D') < 0 + || DrawObject(&dy_box) < 0) { + return CleanupResult(DLG_EXIT_ERROR, dialog, prompt, &save_vars); + } + + if (init_object(&mn_box, + dialog, + dy_box.x, + dy_box.y - (HDR_HIGH + 2 * MARGIN), + (DAY_WIDE / 2) - MARGIN, + HDR_HIGH, + draw_month, + 'M') < 0 + || DrawObject(&mn_box) < 0) { + return CleanupResult(DLG_EXIT_ERROR, dialog, prompt, &save_vars); + } + + if (init_object(&yr_box, + dialog, + dy_box.x + mn_box.width + 2, + mn_box.y, + mn_box.width, + mn_box.height, + draw_year, + 'Y') < 0 + || DrawObject(&yr_box) < 0) { + return CleanupResult(DLG_EXIT_ERROR, dialog, prompt, &save_vars); + } + + while (result == DLG_EXIT_UNKNOWN) { + BOX *obj = (state == sDAY ? &dy_box + : (state == sMONTH ? &mn_box : + (state == sYEAR ? &yr_box : 0))); + + button = (state < 0) ? 0 : state; + dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); + if (obj != 0) + dlg_set_focus(dialog, obj->window); + + key = dlg_mouse_wgetch(dialog, &fkey); + if (dlg_result_key(key, fkey, &result)) + break; + + if (fkey && (key >= DLGK_MOUSE(KEY_MIN) && key <= DLGK_MOUSE(KEY_MAX))) { + key = dlg_lookup_key(dialog, key - M_EVENT, &fkey); + } + + if ((key2 = dlg_char_to_button(key, buttons)) >= 0) { + result = key2; + } else if (fkey) { + /* handle function-keys */ + switch (key) { + case DLGK_MOUSE('D'): + state = sDAY; + break; + case DLGK_MOUSE('M'): + state = sMONTH; + break; + case DLGK_MOUSE('Y'): + state = sYEAR; + break; + case DLGK_ENTER: + result = dlg_ok_buttoncode(button); + break; + case DLGK_FIELD_PREV: + state = dlg_prev_ok_buttonindex(state, sMONTH); + break; + case DLGK_FIELD_NEXT: + state = dlg_next_ok_buttonindex(state, sMONTH); + break; +#ifdef KEY_RESIZE + case KEY_RESIZE: + /* reset data */ + height = old_height; + width = old_width; + /* repaint */ + dlg_clear(); + dlg_del_window(dialog); + refresh(); + dlg_mouse_free_regions(); + goto retry; +#endif + default: + step = 0; + key2 = -1; + if (is_DLGK_MOUSE(key)) { + if ((key2 = dlg_ok_buttoncode(key - M_EVENT)) >= 0) { + result = key2; + break; + } else if (key >= DLGK_MOUSE(KEY_MAX)) { + state = sDAY; + obj = &dy_box; + key2 = 1; + step = (key + - DLGK_MOUSE(KEY_MAX) + - day_cell_number(¤t)); + } + } + if (obj != 0) { + if (key2 < 0) + step = next_or_previous(key, (obj == &dy_box)); + if (step != 0) { + struct tm old = current; + + /* see comment regarding mktime