diff options
author | attilio <attilio@FreeBSD.org> | 2013-01-09 11:58:47 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2013-01-09 11:58:47 +0000 |
commit | 561dd1163dbb481d204da7a526739ac6e43d08f2 (patch) | |
tree | a0bb5397cf6520f42738cd6bdab4a0dc32e343f2 | |
parent | fcadd67d75edc1dd5239b272370d22ec35df1669 (diff) | |
parent | b63b7017bb1a90be6087cf288cd64b04b1d65fe4 (diff) | |
download | FreeBSD-src-561dd1163dbb481d204da7a526739ac6e43d08f2.zip FreeBSD-src-561dd1163dbb481d204da7a526739ac6e43d08f2.tar.gz |
MFC
445 files changed, 9627 insertions, 18475 deletions
@@ -4,7 +4,7 @@ The compilation of software known as FreeBSD is distributed under the following terms: -Copyright (c) 1992-2012 The FreeBSD Project. All rights reserved. +Copyright (c) 1992-2013 The FreeBSD Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -11,3 +11,4 @@ releng/4.* Requires Security Officer approval. releng/5.* Requires Security Officer approval. releng/6.* Requires Security Officer approval. releng/7.* Requires Security Officer approval. +releng/8.* Requires Security Officer approval. diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 5f88516..740b92d 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -38,6 +38,12 @@ # xargs -n1 | sort | uniq -d; # done +# 20121230: libdisk removed +OLD_FILES+=usr/share/man/man3/libdisk.3.gz usr/include/libdisk.h +OLD_FILES+=usr/lib/libdisk.a usr/lib32/libdisk.a +# 20121230: remove wrongly created directories for auditdistd +OLD_DIRS+=var/dist +OLD_DIRS+=var/remote # 20121114: zpool-features manual page moved from section 5 to 7 OLD_FILES+=usr/share/man/man5/zpool-features.5.gz # 20121022: remove harp, hfa and idt man page diff --git a/bin/ln/ln.1 b/bin/ln/ln.1 index fcf97da..610f7bb 100644 --- a/bin/ln/ln.1 +++ b/bin/ln/ln.1 @@ -291,7 +291,7 @@ implementations. .Pp The .Fl F -option is +option is a .Fx extension and should not be used in portable scripts. .Sh SEE ALSO diff --git a/bin/ls/util.c b/bin/ls/util.c index a50eca4..f8466cd 100644 --- a/bin/ls/util.c +++ b/bin/ls/util.c @@ -184,7 +184,10 @@ prn_octal(const char *s) for (i = 0; i < (int)clen; i++) putchar((unsigned char)s[i]); len += wcwidth(wc); - } else if (goodchar && f_octal_escape && wc >= 0 && + } else if (goodchar && f_octal_escape && +#if WCHAR_MIN < 0 + wc >= 0 && +#endif wc <= (wchar_t)UCHAR_MAX && (p = strchr(esc, (char)wc)) != NULL) { putchar('\\'); diff --git a/bin/test/test.1 b/bin/test/test.1 index d73f794..885374e 100644 --- a/bin/test/test.1 +++ b/bin/test/test.1 @@ -32,7 +32,7 @@ .\" @(#)test.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd September 10, 2010 +.Dd December 27, 2012 .Dt TEST 1 .Os .Sh NAME @@ -331,6 +331,13 @@ missing. .It >1 An error occurred. .El +.Sh COMPATIBILITY +For compatibility with some other implementations, +the +.Cm = +primary can be substituted with +.Cm == +with the same meaning. .Sh SEE ALSO .Xr builtin 1 , .Xr expr 1 , diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c index 3c2a625..dd6c90b 100644 --- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c +++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c @@ -906,10 +906,11 @@ zpool_do_create(int argc, char **argv) /* * Check the validity of the mountpoint and direct the user to use the * '-m' mountpoint option if it looks like its in use. + * Ignore the checks if the '-f' option is given. */ - if (mountpoint == NULL || + if (!force && (mountpoint == NULL || (strcmp(mountpoint, ZFS_MOUNTPOINT_LEGACY) != 0 && - strcmp(mountpoint, ZFS_MOUNTPOINT_NONE) != 0)) { + strcmp(mountpoint, ZFS_MOUNTPOINT_NONE) != 0))) { char buf[MAXPATHLEN]; DIR *dirp; diff --git a/contrib/dialog/CHANGES b/contrib/dialog/CHANGES index ea89632..b839088 100644 --- a/contrib/dialog/CHANGES +++ b/contrib/dialog/CHANGES @@ -1,172 +1,9 @@ --- $Id: CHANGES,v 1.419 2012/07/06 18:18:48 tom Exp $ +-- $Id: CHANGES,v 1.360 2011/07/07 23:35:10 tom Exp $ -- Thomas E. Dickey <dickey@invisible-island.net> This version of dialog was originally from a Debian snapshot. I've done this to it: -2012/07/06 - + modify samples/setup-tempfile to work with Tru64's shell. - + modify inputmenu sample scripts to make them more portable: - + use "id" rather than "$GROUPS", use sed to work with Solaris. - + use sed to split-up the rename results to work with HPUX. - + fix regression in msgbox (ArchLinux #30574) - -2012/07/03 - + modify prgbox widget to work with --extra-button, etc. - + add case values to several widgets to allow for mouse-clicks with - "--extra-button" and "--help-button" additions. - + correct timebox widget's exit code for "--extra-button" when handing - the "enter" key. - + modify msgbox widget to honor "--extra-button". - + corrected processing of "--trace" option, which did not update the - index into command-line to point past its value. - + add a check in dialog program for valid characters used in option, - e.g., to generate an error if a script attempts to add option value - using "=" rather than with whitespace. - + add new command-line option --default-button and library function - dlg_default_button() to retrieve the value set by the option - to provide a way to set the default button directly rather than - by combining --nook, etc. (patch by Zoltan Kelemen). - + amend include of unctrl.h to apply only to the case where curses.h - is included, to avoid conflict of ncurses' unctrl.h with a system - implementation (report by Martin Roedlach) - + add limit-check to dlg_toupper() in non-wide curses mode to work - when non-character values such as arrow-key codes are passed to - it (patch by Zoltan Kelemen). - + override timeout value, e.g., as set via --timeout command-line - option in pause widget because that interferes with pause's behavior - (report by Jan Spitalnik). - + modify samples/inputmenu* to allow ":" in renamed text (report by - Andreas Stoewing). - + modify double-quoting to make it more consistent, i.e., checklist - output is quoted only when needed. This fixes the case where - single-quotes were used whether or not needed, but also modifies - older checklist behavior for double-quoting which always added those - (Debian #663664). - + correct exit-code used in inputmenu for "rename" button (Debian - #673041, forwarded from Ubuntu #333909, patch by Lebedev Vadim). - + update el.po and hr.po from - http://translationproject.org/latest/dialog/ - + use checkbashisms to clean up sample scripts. - -2012/02/15 - + modify menubox.c to use the same improvement as in checklist.c - + improve auto width computation for checklist widget by using - dlg_calc_list_width as in the non-auto case (Edho Arief). - + eliminate some bashisms in the sample scripts (Pedro Giffuni). - + makefile fixes from FreeBSD ports (Li-Wen Hsu): - + make --with-package option of configure script work. - + get LIBTOOL_VERSION from configure script, needed by - ${LIBTOOL_VERSION} in LIBTOOL_CREATE (LIB_CREATE in configure and - aclocal.m4) - + update cs.po and sr.po from - http://translationproject.org/latest/dialog/ - + updated configure script macros, improving CF_XOPEN_SOURCE among - other fixes. - -2011/10/20 - + fix --analyze warnings for clang versions 2.8, 2.9. - + add configure check for lint program. - + add check in dlg_getc() in case its window is freed as a side effect - of removing callbacks. - + fix logic in freeing subwindows (report by xDog Walker). - + fix a regression in logic distinguishing between inputmenu and menu - widgets (report by xDog Walker). - + minor fixes to library manpage. - -2011/10/18 - + modify header-sh.in to work around limit on sed script length on - HPUX. - + add a special case of parameter parsing for "--trace" to the - initialization done before calling init_dialog(), to allow users to - capture the initial state of the parameter list before any options - are processed and removed. This is only done if "--trace" is the - first option, otherwise it is handled in the common options as before - (report by xDog Walker). - + modify samples/testdata-8bit, discarding $1 from the parameter list - if it was used, so that the source'ing scripts can consistently use - "$@" to insert parameters before the widget, e.g., as an alternative - to using $DIALOGOPTS (report by xDog Walker). - + modify treatment of function pointers in menubox.c, make - dlg_renamed_menutext() and dlg_dummy_menutext() visible to library - users (request by xDog Walker). - + add dlg_count_real_columns(), use to modify centering for "--hline" - text to account for "\Z"s (report by xDog Walker). - + improve check in dlg_draw_arrows2() for conflict between the window - title and up-arrow marker to take into account that the given window - may not be the top-level window of the widget. - + change width of page up/down mouse areas in fselect panes to use the - full width of the panes rather than only the portion from the left - margin to the up/down arrow. - + add/use dlg_draw_box2() and dlg_draw_bottom_box2() to use the - secondary borders. - + modify rc-file read/write to accept/generate color values that refer - to previously-processed items in the color table. This reduces the - number of distinct colors that must be specified to set up a color - scheme. - + add color table entries for secondary borders, i.e., the ones that - are normally drawn with the dialog's text-colors (Debian #641168). - + modify fselect.c to scan the current directory if the input field - happens to be empty (Debian #640905). - + repeated the discussion of environment variables that can override - the exit-status values in the manpage's return-codes section - (Debian #642105). - + add an example to the manpage showing how to override the form - widget's keys used for field/button traversal (Debian #642108). - + modify call to dlg_register_window() in formbox.c so that the editing - bindings are attached to the form sub-window rather than the - top-level dialog window. Also change the name by which the editing - bindings are bound for editbox.c, fselect.c and inputbox.c, so that - the editing and navigation bindings can be different. - + correct logic in dlg_lookup_key() so that it matches the widget name - before using a binding from .dialogrc, allowing the inner/outer - windows of form and other editing widgets to have different bindings. - + modify dlg_register_window() to call dlg_dump_window_keys() after - its updates, via the --trace output, to supplement the manpage - description of key bindings (Debian #642108). - + add DLGK_FORM_PREV and DLGK_FORM_NEXT key-bindings to form.c, to - allow binding a single key to traverse both form-fields and buttons - (Debian #642108). - + modify dlg_parse_rc() to check for error return from - dlg_parse_bindkey(). - + add function dlg_dump_window_keys(), to help with debugging widgets. - + add CR, LF, TAB, FF and ESC to table of curses names to help make - key bindings more readable. - + update table of dialog key-names so that helpfile and trace are - dumped properly. - + correct dlg_dump_keys(), which was showing only the first item in - the matched binding table. - + save/restore window current position in dlg_update_mixedgauge(). - + pass return-code from pause_for_ok() from dlg_progressbox() when - pauseopt is set, rather than only DLG_OK. - + call setlocale() in init_dialog() rather than relying on on-demand - use within inputstr.c, since there are paths in textbox widget which - do not exercise the latter (report by xDog Walker). - + fix some places where checks for "\Z" were done without also checking - dialog_vars.colors (report by Moray Henderson). - + correct logic for DIALOGOPTS parsing so that the parse happens only - once unless memory leak checking is enabled (report by xDog Walker). - + remove an incorrect free() call in dlg_free_gauge() (report by xDog - Walker). - + modify dlg_trace_win() to log wide-characters (report by xDog Walker). - + make traces shorter by skipping repeated ERR's, but showing the - number skipped (report by xDog Walker). - + improve description in manpage to distinguish program box and - progress box from tailboxes (adapted from email by xDog Walker). - + modify dlg_trace_win() so that it looks for the topmost window in a - dialog. Because subwindows share space with the top window, tracing - the latter shows the whole widget (report by xDog Walker). - + expand tracing so that each window is traced before soliciting input, - making the ^T feature to print a window on demand partly redundant - (suggested by xDog Walker). - + cosmetic change in dialog.h to avoid "*/*" strings from comments next - to "*" (report by xDog Walker). - + ensure result from dlg_align_columns() has trailing null on each - string. Analysis was hindered by libc6's continuance of libc5's - early-1990s misfeature of clearing the result from malloc, noting - that libc6's documentation incorrectly claims that it does not do - this (report by xDog Walker). - 2011/07/07 + modify util.c to work better with old versions of ncurses: + suppress use of wchgat() before fix in 20060715 which is needed @@ -250,7 +87,7 @@ to it: + CF_XOPEN_SOURCE, workaround for cygwin to get ncurses' configure script to define _XOPEN_SOURCE_EXTENDED (cygwin's features.h doesn't do anything, so it needs a crutch). - + update config.guess, config.sub + + updated config.guess, config.sub 2011/03/02 + add --prgbox and --programbox (adapted from patch by David Boyd). @@ -318,7 +155,7 @@ to it: CF_ADD_LIBDIR for the curses-directory here, from CF_NCURSES_CPPFLAGS and CF_NCURSES_LDFLAGS, so it will work even with the default checking, e.g., no --with-ncurses, etc. - + update config.guess, config.sub + + updated config.guess, config.sub 2010/04/28 + several improvements to configure script: @@ -413,7 +250,7 @@ to it: libutf8 and libiconv. + update da.po, ru.po from http://translationproject.org/latest/dialog/ - + update config.guess, config.sub + + updated config.guess, config.sub 2008/08/19 + amend changes to quoting; by default, the checklist widget quotes its @@ -496,7 +333,7 @@ to it: ESC to be returned, quitting dialog (report by Reiner Huober). + add extern "C" declarations to dlg_keys.h so the corresponding function declarations are exported to C++ as C symbols. - + update config.guess, config.sub + + updated config.guess, config.sub 2007/06/04 + fix a memory leak in editbox.c @@ -599,7 +436,7 @@ to it: CF_CURSES_LIBS, CF_INCLUDE_DIRS, CF_LARGEFILE, CF_MAKEFLAGS, CF_PATH_SYNTAX, CF_SUBDIR_PATH, CF_SUBST, CF_WITH_DBMALLOC, CF_WITH_DMALLOC, CF_WITH_LIBTOOL and CF_XOPEN_SOURCE. - + update config.guess, config.sub + + updated config.guess, config.sub > adapted fixes from SuSE package (Werner Fink): + add some limit-checks in dlg_draw_shadow(). + make shadows resizable, using new dlg_move_window() in msgbox.c diff --git a/contrib/dialog/VERSION b/contrib/dialog/VERSION index 8c3a188..0462455 100644 --- a/contrib/dialog/VERSION +++ b/contrib/dialog/VERSION @@ -1 +1 @@ -10:4:0 1.1 20120706 +10:0:0 1.1 20110707 diff --git a/contrib/dialog/aclocal.m4 b/contrib/dialog/aclocal.m4 index 0c50c22..159b12f 100644 --- a/contrib/dialog/aclocal.m4 +++ b/contrib/dialog/aclocal.m4 @@ -1,7 +1,7 @@ dnl macros used for DIALOG configure script -dnl $Id: aclocal.m4,v 1.87 2012/02/16 02:11:26 tom Exp $ +dnl $Id: aclocal.m4,v 1.82 2011/06/28 22:48:31 tom Exp $ dnl --------------------------------------------------------------------------- -dnl Copyright 1999-2011,2012 -- Thomas E. Dickey +dnl Copyright 1999-2010,2011 -- Thomas E. Dickey dnl dnl Permission is hereby granted, free of charge, to any person obtaining a dnl copy of this software and associated documentation files (the @@ -592,31 +592,6 @@ changequote([,])dnl AC_SUBST(GENCAT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ACVERSION_CHECK version: 2 updated: 2011/05/08 11:22:03 -dnl ------------------ -dnl Conditionally generate script according to whether we're using a given autoconf. -dnl -dnl $1 = version to compare against -dnl $2 = code to use if AC_ACVERSION is at least as high as $1. -dnl $3 = code to use if AC_ACVERSION is older than $1. -define(CF_ACVERSION_CHECK, -[ -ifdef([m4_version_compare], -[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], -[CF_ACVERSION_COMPARE( -AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), -AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl -dnl --------------------------------------------------------------------------- -dnl CF_ACVERSION_COMPARE version: 2 updated: 2011/04/14 20:56:50 -dnl -------------------- -dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, -dnl MAJOR2, MINOR2, TERNARY2, -dnl PRINTABLE2, not FOUND, FOUND) -define(CF_ACVERSION_COMPARE, -[ifelse(builtin([eval], [$2 < $5]), 1, -[ifelse([$8], , ,[$8])], -[ifelse([$9], , ,[$9])])])dnl -dnl --------------------------------------------------------------------------- dnl CF_AC_PREREQ version: 2 updated: 1997/09/06 13:24:56 dnl ------------ dnl Conditionally generate script according to whether we're using the release @@ -1252,7 +1227,7 @@ fi AC_CHECK_HEADERS($cf_cv_ncurses_header) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_LIBS version: 35 updated: 2011/08/09 21:06:37 +dnl CF_CURSES_LIBS version: 34 updated: 2011/04/09 14:51:08 dnl -------------- dnl Look for the curses libraries. Older curses implementations may require dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. @@ -1332,7 +1307,7 @@ if test ".$ac_cv_func_initscr" != .yes ; then # Check for library containing tgoto. Do this before curses library # because it may be needed to link the test-case for initscr. AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ - for cf_term_lib in $cf_check_list otermcap termcap termlib unknown + for cf_term_lib in $cf_check_list termcap termlib unknown do AC_CHECK_LIB($cf_term_lib,tgoto,[break]) done @@ -1558,30 +1533,6 @@ fi test "$cf_cv_curses_wacs_symbols" != no && AC_DEFINE(CURSES_WACS_SYMBOLS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_WGETPARENT version: 2 updated: 2011/10/17 20:12:04 -dnl -------------------- -dnl Check for curses support for directly determining the parent of a given -dnl window. Some implementations make this difficult, so we provide for -dnl defining an application-specific function that gives this functionality. -dnl -dnl $1 = name of function to use if the feature is missing -AC_DEFUN([CF_CURSES_WGETPARENT],[ -CF_CURSES_FUNCS(wgetparent) -if test "x$cf_cv_func_wgetparent" != xyes -then - AC_MSG_CHECKING(if WINDOW has _parent member) - AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>], - [WINDOW *p = stdscr->_parent], - [cf_window__parent=yes], - [cf_window__parent=no]) - AC_MSG_RESULT($cf_window__parent) - if test "$cf_window__parent" = yes - then - AC_DEFINE(HAVE_WINDOW__PARENT) - fi -fi -])dnl -dnl --------------------------------------------------------------------------- dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 dnl ---------- dnl "dirname" is not portable, so we fake it with a shell script. @@ -2386,7 +2337,7 @@ ifdef([AC_FUNC_FSEEKO],[ ]) ]) dnl --------------------------------------------------------------------------- -dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41 +dnl CF_LD_RPATH_OPT version: 4 updated: 2011/06/04 20:09:13 dnl --------------- dnl For the given system and compiler, find the compiler flags to pass to the dnl loader to use the "rpath" feature. @@ -2410,7 +2361,7 @@ linux*|gnu*|k*bsd*-gnu) #(vi openbsd[[2-9]].*|mirbsd*) #(vi LD_RPATH_OPT="-Wl,-rpath," ;; -dragonfly*|freebsd*) #(vi +freebsd*) #(vi LD_RPATH_OPT="-rpath " ;; netbsd*) #(vi @@ -2469,11 +2420,11 @@ CF_SUBDIR_PATH($1,$2,lib) $1="$cf_library_path_list [$]$1" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIB_PREFIX version: 9 updated: 2012/01/21 19:28:10 +dnl CF_LIB_PREFIX version: 8 updated: 2008/09/13 11:34:16 dnl ------------- dnl Compute the library-prefix for the given host system dnl $1 = variable to set -define([CF_LIB_PREFIX], +AC_DEFUN([CF_LIB_PREFIX], [ case $cf_cv_system_name in #(vi OS/2*|os2*) #(vi @@ -2694,7 +2645,7 @@ printf("old\n"); ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CONFIG version: 9 updated: 2011/11/26 15:42:05 +dnl CF_NCURSES_CONFIG version: 8 updated: 2010/07/08 05:17:30 dnl ----------------- dnl Tie together the configure-script macros for ncurses. dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis. @@ -2706,10 +2657,7 @@ AC_DEFUN([CF_NCURSES_CONFIG], cf_ncuconfig_root=ifelse($1,,ncurses,$1) echo "Looking for ${cf_ncuconfig_root}-config" - -CF_ACVERSION_CHECK(2.52, - [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], - [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) +AC_PATH_PROGS(NCURSES_CONFIG,${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config,none) if test "$NCURSES_CONFIG" != none ; then @@ -3223,14 +3171,6 @@ AC_SUBST(PROG_EXT) test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT") ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14 -dnl ------------ -AC_DEFUN([CF_PROG_LINT], -[ -AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint) -AC_SUBST(LINT_OPTS) -])dnl -dnl --------------------------------------------------------------------------- dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 dnl ---------------- dnl Remove all -U and -D options that refer to the given symbol from a list @@ -3478,45 +3418,6 @@ ncursesw/term.h) esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50 -dnl ------------------- -dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we -dnl can define it successfully. -AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ -AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ - AC_TRY_COMPILE([ -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -],[ -#ifndef _XOPEN_SOURCE -make an error -#endif], - [cf_cv_xopen_source=no], - [cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" - AC_TRY_COMPILE([ -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -],[ -#ifdef _XOPEN_SOURCE -make an error -#endif], - [cf_cv_xopen_source=no], - [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) - CPPFLAGS="$cf_save" - ]) -]) - -if test "$cf_cv_xopen_source" != no ; then - CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) - CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) - cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" - CF_ADD_CFLAGS($cf_temp_xopen_source) -fi -]) -dnl --------------------------------------------------------------------------- dnl CF_UNION_WAIT version: 5 updated: 1997/11/23 14:49:44 dnl ------------- dnl Check to see if the BSD-style union wait is declared. Some platforms may @@ -3779,7 +3680,7 @@ if test "$with_dmalloc" = yes ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_LIBTOOL version: 28 updated: 2011/07/02 15:40:32 +dnl CF_WITH_LIBTOOL version: 27 updated: 2011/06/28 18:45:38 dnl --------------- dnl Provide a configure option to incorporate libtool. Define several useful dnl symbols for the makefile rules. @@ -3880,7 +3781,7 @@ ifdef([AC_PROG_LIBTOOL],[ # 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[[4-7]]) #(vi + cygwin*|mingw32*|uwin*|aix[[456]]) #(vi LT_UNDEF=-no-undefined ;; esac @@ -4049,7 +3950,7 @@ AC_TRY_LINK([ test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 42 updated: 2012/01/07 08:26:49 +dnl CF_XOPEN_SOURCE version: 35 updated: 2011/02/20 20:37:37 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -4065,7 +3966,7 @@ cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) cf_xopen_source= case $host_os in #(vi -aix[[4-7]]*) #(vi +aix[[456]]*) #(vi cf_xopen_source="-D_ALL_SOURCE" ;; cygwin) #(vi @@ -4076,7 +3977,6 @@ darwin[[0-8]].*) #(vi ;; darwin*) #(vi cf_xopen_source="-D_DARWIN_C_SOURCE" - cf_XOPEN_SOURCE= ;; freebsd*|dragonfly*) #(vi # 5.x headers associate @@ -4094,23 +3994,15 @@ hpux*) #(vi ;; irix[[56]].*) #(vi cf_xopen_source="-D_SGI_SOURCE" - cf_XOPEN_SOURCE= ;; linux*|gnu*|mint*|k*bsd*-gnu) #(vi CF_GNU_SOURCE ;; mirbsd*) #(vi - # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types - cf_XOPEN_SOURCE= - CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h> ;; netbsd*) #(vi - cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw - ;; -openbsd[[4-9]]*) #(vi - # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw - cf_xopen_source="-D_BSD_SOURCE" - cf_XOPEN_SOURCE=600 + # 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 @@ -4124,46 +4016,42 @@ nto-qnx*) #(vi sco*) #(vi # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; -solaris2.*) #(vi +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__" ;; *) - CF_TRY_XOPEN_SOURCE - CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) - ;; -esac - -if test -n "$cf_xopen_source" ; then - CF_ADD_CFLAGS($cf_xopen_source) -fi - -dnl In anything but the default case, we may have system-specific setting -dnl which is still not guaranteed to provide all of the entrypoints that -dnl _XOPEN_SOURCE would yield. -if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then - AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) - AC_TRY_COMPILE([#include <stdlib.h>],[ + AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ + AC_TRY_COMPILE([#include <sys/types.h>],[ #ifndef _XOPEN_SOURCE make an error #endif], - [cf_XOPEN_SOURCE_set=yes], - [cf_XOPEN_SOURCE_set=no]) - AC_MSG_RESULT($cf_XOPEN_SOURCE_set) - if test $cf_XOPEN_SOURCE_set = yes - then - AC_TRY_COMPILE([#include <stdlib.h>],[ -#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE + [cf_cv_xopen_source=no], + [cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + AC_TRY_COMPILE([#include <sys/types.h>],[ +#ifdef _XOPEN_SOURCE make an error #endif], - [cf_XOPEN_SOURCE_set_ok=yes], - [cf_XOPEN_SOURCE_set_ok=no]) - if test $cf_XOPEN_SOURCE_set_ok = no - then - AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) - fi - else - CF_TRY_XOPEN_SOURCE + [cf_cv_xopen_source=no], + [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) + CPPFLAGS="$cf_save" + ]) +]) + if test "$cf_cv_xopen_source" != no ; then + CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) + CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) + cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" + CF_ADD_CFLAGS($cf_temp_xopen_source) fi + CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) + ;; +esac + +if test -n "$cf_xopen_source" ; then + CF_ADD_CFLAGS($cf_xopen_source) fi ]) dnl --------------------------------------------------------------------------- diff --git a/contrib/dialog/arrows.c b/contrib/dialog/arrows.c index ff706ad..6a25fd9 100644 --- a/contrib/dialog/arrows.c +++ b/contrib/dialog/arrows.c @@ -1,5 +1,5 @@ /* - * $Id: arrows.c,v 1.41 2011/10/20 23:37:17 tom Exp $ + * $Id: arrows.c,v 1.36 2011/06/27 09:13:56 tom Exp $ * * arrows.c -- draw arrows to indicate end-of-range for lists * @@ -79,9 +79,9 @@ dlg_draw_helpline(WINDOW *win, bool decorations) const int *cols = dlg_index_columns(dialog_vars.help_line); int other = decorations ? (ON_LEFT + ON_RIGHT) : 0; int avail = (getmaxx(win) - other - 2); - int limit = dlg_count_real_columns(dialog_vars.help_line) + 2; + int limit = dlg_limit_columns(dialog_vars.help_line, avail, 0); - if (limit < avail) { + if (limit > 0) { getyx(win, cur_y, cur_x); other = decorations ? ON_LEFT : 0; (void) wmove(win, bottom, other + (avail - limit) / 2); @@ -107,14 +107,13 @@ dlg_draw_arrows2(WINDOW *win, int cur_x, cur_y; int limit_x = getmaxx(win); bool draw_top = TRUE; - bool is_toplevel = (wgetparent(win) == stdscr); getyx(win, cur_y, cur_x); /* * If we're drawing a centered title, do not overwrite with the arrows. */ - if (dialog_vars.title && is_toplevel && (top - getbegy(win)) < MARGIN) { + if (dialog_vars.title) { int have = (limit_x - dlg_count_columns(dialog_vars.title)) / 2; int need = x + 5; if (need > have) @@ -124,11 +123,11 @@ dlg_draw_arrows2(WINDOW *win, if (draw_top) { (void) wmove(win, top, x); if (top_arrow) { - (void) wattrset(win, merge_colors(uarrow_attr, attr)); + wattrset(win, merge_colors(uarrow_attr, attr)); (void) add_acs(win, ACS_UARROW); (void) waddstr(win, "(-)"); } else { - (void) wattrset(win, attr); + wattrset(win, attr); (void) whline(win, dlg_boxchar(ACS_HLINE), ON_LEFT); } } @@ -136,11 +135,11 @@ dlg_draw_arrows2(WINDOW *win, (void) wmove(win, bottom, x); if (bottom_arrow) { - (void) wattrset(win, merge_colors(darrow_attr, attr)); + wattrset(win, merge_colors(darrow_attr, attr)); (void) add_acs(win, ACS_DARROW); (void) waddstr(win, "(+)"); } else { - (void) wattrset(win, borderattr); + wattrset(win, borderattr); (void) whline(win, dlg_boxchar(ACS_HLINE), ON_LEFT); } mouse_mkbutton(bottom, x - 1, 6, KEY_NPAGE); @@ -148,7 +147,7 @@ dlg_draw_arrows2(WINDOW *win, (void) wmove(win, cur_y, cur_x); wrefresh(win); - (void) wattrset(win, save); + wattrset(win, save); } void @@ -167,13 +166,14 @@ dlg_draw_scrollbar(WINDOW *win, char buffer[80]; int percent; int len; - int oldy, oldx; + int oldy, oldx, maxy, maxx; chtype save = dlg_get_attrs(win); int top_arrow = (first_data != 0); int bottom_arrow = (next_data < total_data); getyx(win, oldy, oldx); + getmaxyx(win, maxy, maxx); dlg_draw_helpline(win, TRUE); if (bottom_arrow || top_arrow || dialog_state.use_scrollbar) { @@ -187,12 +187,12 @@ dlg_draw_scrollbar(WINDOW *win, else if (percent > 100) percent = 100; - (void) wattrset(win, position_indicator_attr); + wattrset(win, position_indicator_attr); (void) sprintf(buffer, "%d%%", percent); (void) wmove(win, bottom, right - 7); (void) waddstr(win, buffer); if ((len = dlg_count_columns(buffer)) < 4) { - (void) wattrset(win, border_attr); + wattrset(win, border_attr); whline(win, dlg_boxchar(ACS_HLINE), 4 - len); } } @@ -212,7 +212,7 @@ dlg_draw_scrollbar(WINDOW *win, if (bar_high < all_high) { wmove(win, top + 1, right); - (void) wattrset(win, save); + wattrset(win, save); wvline(win, ACS_VLINE | A_REVERSE, all_high); bar_y = BARSIZE(this_data); @@ -221,7 +221,7 @@ dlg_draw_scrollbar(WINDOW *win, wmove(win, top + 1 + bar_y, right); - (void) wattrset(win, position_indicator_attr); + wattrset(win, position_indicator_attr); wattron(win, A_REVERSE); wvline(win, ACS_BLOCK, bar_high); } @@ -236,7 +236,7 @@ dlg_draw_scrollbar(WINDOW *win, attr, borderattr); - (void) wattrset(win, save); + wattrset(win, save); wmove(win, oldy, oldx); } @@ -255,6 +255,6 @@ dlg_draw_arrows(WINDOW *win, x, top, bottom, - menubox_border2_attr, + menubox_attr, menubox_border_attr); } diff --git a/contrib/dialog/buttons.c b/contrib/dialog/buttons.c index 1799851..0241060 100644 --- a/contrib/dialog/buttons.c +++ b/contrib/dialog/buttons.c @@ -1,9 +1,9 @@ /* - * $Id: buttons.c,v 1.90 2012/07/01 20:42:05 tom Exp $ + * $Id: buttons.c,v 1.86 2011/06/28 10:46:46 tom Exp $ * * buttons.c -- draw buttons, e.g., OK/Cancel * - * Copyright 2000-2011,2012 Thomas E. Dickey + * Copyright 2000-2010,2011 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 @@ -104,11 +104,11 @@ print_button(WINDOW *win, char *label, int y, int x, int selected) : button_label_inactive_attr); (void) wmove(win, y, x); - (void) wattrset(win, selected - ? button_active_attr - : button_inactive_attr); + wattrset(win, selected + ? button_active_attr + : button_inactive_attr); (void) waddstr(win, "<"); - (void) wattrset(win, label_attr); + wattrset(win, label_attr); for (i = 0; i < limit; ++i) { int first = indx[i]; int last = indx[i + 1]; @@ -120,14 +120,14 @@ print_button(WINDOW *win, char *label, int y, int x, int selected) const char *temp = (label + first); int cmp = string_to_char(&temp); if (dlg_isupper(cmp)) { - (void) wattrset(win, key_attr); + wattrset(win, key_attr); state = 1; } break; } #endif if (dlg_isupper(UCH(label[first]))) { - (void) wattrset(win, key_attr); + wattrset(win, key_attr); state = 1; } break; @@ -138,9 +138,9 @@ print_button(WINDOW *win, char *label, int y, int x, int selected) } waddnstr(win, label + first, last - first); } - (void) wattrset(win, selected - ? button_active_attr - : button_inactive_attr); + wattrset(win, selected + ? button_active_attr + : button_inactive_attr); (void) waddstr(win, ">"); (void) wmove(win, y, x + ((int) strspn(label, " ")) + 1); } @@ -310,7 +310,7 @@ dlg_draw_buttons(WINDOW *win, (void) wmove(win, final_y, final_x); wrefresh(win); free(buffer); - (void) wattrset(win, save); + wattrset(win, save); } /* @@ -488,12 +488,10 @@ dlg_exit_buttoncode(int button) const char ** dlg_ok_label(void) { - static const char *labels[4]; + static const char *labels[3]; int n = 0; labels[n++] = my_ok_label(); - if (dialog_vars.extra_button) - labels[n++] = my_extra_label(); if (dialog_vars.help_button) labels[n++] = my_help_label(); labels[n] = 0; @@ -539,7 +537,6 @@ dlg_ok_buttoncode(int button) } else if (dialog_vars.help_button && (button == n)) { result = DLG_EXIT_HELP; } - dlg_trace_msg("# dlg_ok_buttoncode(%d) = %d\n", button, result); return result; } @@ -578,7 +575,7 @@ dlg_prev_ok_buttonindex(int current, int extra) /* * 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 the first button (usually "OK" unless --nook was used). + * the index for "OK". */ int dlg_defaultno_button(void) @@ -589,30 +586,6 @@ dlg_defaultno_button(void) while (dlg_ok_buttoncode(result) != DLG_EXIT_CANCEL) ++result; } - dlg_trace_msg("# dlg_defaultno_button() = %d\n", result); - return result; -} - -/* - * Find the button-index for a button named with --default-button. If the - * option was not specified, or if the selected button does not exist, return - * the index of the first button (usually "OK" unless --nook was used). - */ -int -dlg_default_button(void) -{ - int i, n; - int result = 0; - - if (dialog_vars.default_button >= 0) { - for (i = 0; (n = dlg_ok_buttoncode(i)) >= 0; i++) { - if (n == dialog_vars.default_button) { - result = i; - break; - } - } - } - dlg_trace_msg("# dlg_default_button() = %d\n", result); return result; } diff --git a/contrib/dialog/calendar.c b/contrib/dialog/calendar.c index dab4617..45a40ab 100644 --- a/contrib/dialog/calendar.c +++ b/contrib/dialog/calendar.c @@ -1,9 +1,9 @@ /* - * $Id: calendar.c,v 1.66 2012/07/01 18:13:07 Zoltan.Kelemen Exp $ + * $Id: calendar.c,v 1.62 2011/06/29 09:47:06 tom Exp $ * * calendar.c -- implements the calendar box * - * Copyright 2001-2011,2012 Thomas E. Dickey + * Copyright 2001-2010,2011 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 @@ -225,14 +225,12 @@ draw_day(BOX * data, struct tm *current) int prev = days_in_month(current, -1); werase(data->window); - dlg_draw_box2(data->parent, - data->y - MARGIN, data->x - MARGIN, - data->height + (2 * MARGIN), data->width + (2 * MARGIN), - menubox_attr, - menubox_border_attr, - menubox_border2_attr); - - (void) wattrset(data->window, menubox_attr); /* daynames headline */ + 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 ", @@ -248,7 +246,7 @@ draw_day(BOX * data, struct tm *current) week = (current->tm_yday + 6 + mday - current->tm_mday) / 7; for (y = 1; mday < last; y++) { - (void) wattrset(data->window, menubox_attr); /* weeknumbers headline */ + wattrset(data->window, menubox_attr); /* weeknumbers headline */ mvwprintw(data->window, y, 0, "%*d ", @@ -259,9 +257,9 @@ draw_day(BOX * data, struct tm *current) ++mday; if (wmove(data->window, y, this_x) == ERR) continue; - (void) wattrset(data->window, item_attr); /* not selected days */ + wattrset(data->window, item_attr); /* not selected days */ if (mday == day) { - (void) wattrset(data->window, item_selected_attr); /* selected day */ + wattrset(data->window, item_selected_attr); /* selected day */ save_y = y; save_x = this_x; } @@ -296,15 +294,13 @@ draw_month(BOX * data, struct tm *current) month = current->tm_mon + 1; - (void) wattrset(data->parent, dialog_attr); /* Headline "Month" */ + wattrset(data->parent, dialog_attr); /* Headline "Month" */ (void) mvwprintw(data->parent, data->y - 2, data->x - 1, _("Month")); - dlg_draw_box2(data->parent, - data->y - 1, data->x - 1, - data->height + 2, data->width + 2, - menubox_attr, - menubox_border_attr, - menubox_border2_attr); - (void) wattrset(data->window, item_attr); /* color the month selection */ + 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; @@ -318,15 +314,13 @@ draw_year(BOX * data, struct tm *current) { int year = current->tm_year + 1900; - (void) wattrset(data->parent, dialog_attr); /* Headline "Year" */ + wattrset(data->parent, dialog_attr); /* Headline "Year" */ (void) mvwprintw(data->parent, data->y - 2, data->x - 1, _("Year")); - dlg_draw_box2(data->parent, - data->y - 1, data->x - 1, - data->height + 2, data->width + 2, - menubox_attr, - menubox_border_attr, - menubox_border2_attr); - (void) wattrset(data->window, item_attr); /* color the year selection */ + 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; @@ -436,7 +430,7 @@ dialog_calendar(const char *title, WINDOW *dialog; time_t now_time = time((time_t *) 0); struct tm current; - int state = dlg_default_button(); + int state = dlg_defaultno_button(); const char **buttons = dlg_ok_labels(); char *prompt = dlg_strclone(subtitle); int mincols = MIN_WIDE; @@ -497,11 +491,11 @@ dialog_calendar(const char *title, dlg_register_buttons(dialog, "calendar", buttons); /* mainbox */ - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); dlg_draw_title(dialog, title); - (void) wattrset(dialog, dialog_attr); /* text mainbox */ + wattrset(dialog, dialog_attr); /* text mainbox */ dlg_print_autowrap(dialog, prompt, height, width); /* compute positions of day, month and year boxes */ @@ -545,7 +539,6 @@ dialog_calendar(const char *title, return CleanupResult(DLG_EXIT_ERROR, dialog, prompt, &save_vars); } - dlg_trace_win(dialog); while (result == DLG_EXIT_UNKNOWN) { BOX *obj = (state == sDAY ? &dy_box : (state == sMONTH ? &mn_box : diff --git a/contrib/dialog/checklist.c b/contrib/dialog/checklist.c index 3904e90..4b73ceb 100644 --- a/contrib/dialog/checklist.c +++ b/contrib/dialog/checklist.c @@ -1,9 +1,9 @@ /* - * $Id: checklist.c,v 1.135 2012/07/01 16:30:04 Zoltan.Kelemen Exp $ + * $Id: checklist.c,v 1.127 2011/06/29 23:04:09 tom Exp $ * * checklist.c -- implements the checklist box * - * Copyright 2000-2011,2012 Thomas E. Dickey + * Copyright 2000-2010,2011 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 @@ -58,7 +58,7 @@ print_arrows(WINDOW *win, box_x + list_width, box_y, box_y + list_height + 1, - menubox_border2_attr, + menubox_attr, menubox_border_attr); } @@ -81,30 +81,30 @@ print_item(WINDOW *win, int limit; /* Clear 'residue' of last item */ - (void) wattrset(win, menubox_attr); + 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); - (void) wattrset(win, selected ? check_selected_attr : check_attr); + wattrset(win, selected ? check_selected_attr : check_attr); (void) wprintw(win, (checkflag == FLAG_CHECK) ? "[%c]" : "(%c)", states[item->state]); - (void) wattrset(win, menubox_attr); + wattrset(win, menubox_attr); (void) waddch(win, ' '); if (strlen(item->name) != 0) { indx = dlg_index_wchars(item->name); - (void) wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); + 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) { - (void) wattrset(win, selected ? tag_selected_attr : tag_attr); + wattrset(win, selected ? tag_selected_attr : tag_attr); (void) waddnstr(win, item->name + indx[1], indx[limit] - indx[1]); @@ -118,7 +118,7 @@ print_item(WINDOW *win, if (limit > 0) { (void) wmove(win, choice, item_x); - (void) wattrset(win, selected ? item_selected_attr : item_attr); + wattrset(win, selected ? item_selected_attr : item_attr); dlg_print_text(win, item->text, cols[limit], &attr); } } @@ -126,7 +126,7 @@ print_item(WINDOW *win, if (selected) { dlg_item_help(item->help); } - (void) wattrset(win, save); + wattrset(win, save); } /* @@ -178,7 +178,7 @@ dlg_checklist(const char *title, #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_default_button(); + int button = dialog_state.visit_items ? -1 : dlg_defaultno_button(); int choice = dlg_default_listitem(items); int scrollamt = 0; int max_choice; @@ -190,7 +190,6 @@ dlg_checklist(const char *title, WINDOW *dialog, *list; char *prompt = dlg_strclone(cprompt); const char **buttons = dlg_ok_labels(); - const char *widget_name; dlg_does_output(); dlg_tab_correct_str(prompt); @@ -212,23 +211,19 @@ dlg_checklist(const char *title, } } } - widget_name = "radiolist"; - } else { - widget_name = "checklist"; } #ifdef KEY_RESIZE retry: #endif use_height = list_height; - use_width = dlg_calc_list_width(item_no, items) + 10; - use_width = MAX(26, use_width); 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, use_width); + 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, use_width); + dlg_auto_size(title, prompt, &height, &width, MIN_HIGH + use_height, 26); } dlg_button_layout(buttons, &width); dlg_print_size(height, width); @@ -245,16 +240,16 @@ dlg_checklist(const char *title, y = dlg_box_y_ordinate(height); dialog = dlg_new_window(height, width, y, x); - dlg_register_window(dialog, widget_name, binding); - dlg_register_buttons(dialog, widget_name, buttons); + dlg_register_window(dialog, "checklist", binding); + dlg_register_buttons(dialog, "checklist", buttons); dlg_mouse_setbase(x, y); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); dlg_draw_title(dialog, title); - (void) wattrset(dialog, dialog_attr); + wattrset(dialog, dialog_attr); dlg_print_autowrap(dialog, prompt, height, width); list_width = width - 6; @@ -281,7 +276,7 @@ dlg_checklist(const char *title, dlg_draw_box(dialog, box_y, box_x, use_height + 2 * MARGIN, list_width + 2 * MARGIN, - menubox_border_attr, menubox_border2_attr); + menubox_border_attr, menubox_attr); text_width = 0; name_width = 0; @@ -333,7 +328,6 @@ dlg_checklist(const char *title, dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); - dlg_trace_win(dialog); while (result == DLG_EXIT_UNKNOWN) { if (button < 0) /* --visit-items */ wmove(dialog, box_y + choice + 1, box_x + check_x + 2); @@ -726,10 +720,7 @@ dialog_checklist(const char *title, } else { if (dlg_need_separator()) dlg_add_separator(); - if (flag == FLAG_CHECK) - dlg_add_quoted(listitems[i].name); - else - dlg_add_string(listitems[i].name); + dlg_add_string(listitems[i].name); } } } diff --git a/contrib/dialog/columns.c b/contrib/dialog/columns.c index d03761f..8e5620c 100644 --- a/contrib/dialog/columns.c +++ b/contrib/dialog/columns.c @@ -1,5 +1,5 @@ /* - * $Id: columns.c,v 1.10 2011/10/20 20:53:55 tom Exp $ + * $Id: columns.c,v 1.8 2011/06/28 09:26:23 tom Exp $ * * columns.c -- implements column-alignment * @@ -45,7 +45,7 @@ next_row(char **target, int per_row) { char *result = (char *) target; result += per_row; - return (char **) (void *) result; + return (char **) result; } static char * @@ -148,7 +148,6 @@ dlg_align_columns(char **target, int per_row, int num_rows) memcpy(text + offset, *value + offsets[n], (size_t) widths[n]); offset += maxwidth[n] + 1; } - text[realwidth] = 0; *value = text; } diff --git a/contrib/dialog/configure b/contrib/dialog/configure index 416f055..44eaeb4 100755 --- a/contrib/dialog/configure +++ b/contrib/dialog/configure @@ -2166,47 +2166,10 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -for ac_prog in tdlint lint alint splint lclint -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:2173: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_LINT+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$LINT"; then - ac_cv_prog_LINT="$LINT" # 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_LINT="$ac_prog" -echo "$as_me:2188: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -LINT=$ac_cv_prog_LINT -if test -n "$LINT"; then - echo "$as_me:2196: result: $LINT" >&5 -echo "${ECHO_T}$LINT" >&6 -else - echo "$as_me:2199: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$LINT" && break -done - 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:2209: checking for $ac_word" >&5 +echo "$as_me:2172: 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 @@ -2221,7 +2184,7 @@ for ac_dir in $ac_dummy; do 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:2224: found $ac_dir/$ac_word" >&5 +echo "$as_me:2187: found $ac_dir/$ac_word" >&5 break done @@ -2229,10 +2192,10 @@ fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - echo "$as_me:2232: result: $AR" >&5 + echo "$as_me:2195: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else - echo "$as_me:2235: result: no" >&5 + echo "$as_me:2198: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2241,7 +2204,7 @@ 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:2244: checking for $ac_word" >&5 +echo "$as_me:2207: 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 @@ -2256,7 +2219,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_AR="ar" -echo "$as_me:2259: found $ac_dir/$ac_word" >&5 +echo "$as_me:2222: found $ac_dir/$ac_word" >&5 break done @@ -2265,10 +2228,10 @@ fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - echo "$as_me:2268: result: $ac_ct_AR" >&5 + echo "$as_me:2231: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6 else - echo "$as_me:2271: result: no" >&5 + echo "$as_me:2234: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2277,12 +2240,12 @@ else AR="$ac_cv_prog_AR" fi -echo "$as_me:2280: checking for POSIXized ISC" >&5 +echo "$as_me:2243: 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:2285: result: yes" >&5 + echo "$as_me:2248: result: yes" >&5 echo "${ECHO_T}yes" >&6 ISC=yes # If later tests want to check for ISC. @@ -2296,12 +2259,12 @@ EOF CC="$CC -Xp" fi else - echo "$as_me:2299: result: no" >&5 + echo "$as_me:2262: result: no" >&5 echo "${ECHO_T}no" >&6 ISC= fi -echo "$as_me:2304: checking for $CC option to accept ANSI C" >&5 +echo "$as_me:2267: 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 @@ -2309,7 +2272,7 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line 2312 "configure" +#line 2275 "configure" #include "confdefs.h" #include <stdarg.h> #include <stdio.h> @@ -2358,16 +2321,16 @@ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIO do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext -if { (eval echo "$as_me:2361: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2324: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2364: \$? = $ac_status" >&5 + echo "$as_me:2327: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2367: \"$ac_try\"") >&5 + { (eval echo "$as_me:2330: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2370: \$? = $ac_status" >&5 + echo "$as_me:2333: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break @@ -2384,21 +2347,21 @@ fi case "x$ac_cv_prog_cc_stdc" in x|xno) - echo "$as_me:2387: result: none needed" >&5 + echo "$as_me:2350: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) - echo "$as_me:2390: result: $ac_cv_prog_cc_stdc" >&5 + echo "$as_me:2353: 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:2395: checking for an ANSI C-conforming const" >&5 +echo "$as_me:2358: 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 2401 "configure" +#line 2364 "configure" #include "confdefs.h" int @@ -2456,16 +2419,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2459: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2422: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2462: \$? = $ac_status" >&5 + echo "$as_me:2425: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2465: \"$ac_try\"") >&5 + { (eval echo "$as_me:2428: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2468: \$? = $ac_status" >&5 + echo "$as_me:2431: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else @@ -2475,7 +2438,7 @@ ac_cv_c_const=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2478: result: $ac_cv_c_const" >&5 +echo "$as_me:2441: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then @@ -2485,7 +2448,7 @@ EOF fi -echo "$as_me:2488: checking for makeflags variable" >&5 +echo "$as_me:2451: 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 @@ -2519,10 +2482,10 @@ CF_EOF rm -f cf_makeflags.tmp fi -echo "$as_me:2522: result: $cf_cv_makeflags" >&5 +echo "$as_me:2485: result: $cf_cv_makeflags" >&5 echo "${ECHO_T}$cf_cv_makeflags" >&6 -echo "$as_me:2525: checking if filesystem supports mixed-case filenames" >&5 +echo "$as_me:2488: 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 @@ -2549,7 +2512,7 @@ else fi fi -echo "$as_me:2552: result: $cf_cv_mixedcase" >&5 +echo "$as_me:2515: 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 @@ -2559,7 +2522,7 @@ 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:2562: checking for $ac_word" >&5 +echo "$as_me:2525: 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 @@ -2574,7 +2537,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CTAGS="$ac_prog" -echo "$as_me:2577: found $ac_dir/$ac_word" >&5 +echo "$as_me:2540: found $ac_dir/$ac_word" >&5 break done @@ -2582,10 +2545,10 @@ fi fi CTAGS=$ac_cv_prog_CTAGS if test -n "$CTAGS"; then - echo "$as_me:2585: result: $CTAGS" >&5 + echo "$as_me:2548: result: $CTAGS" >&5 echo "${ECHO_T}$CTAGS" >&6 else - echo "$as_me:2588: result: no" >&5 + echo "$as_me:2551: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2596,7 +2559,7 @@ 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:2599: checking for $ac_word" >&5 +echo "$as_me:2562: 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 @@ -2611,7 +2574,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ETAGS="$ac_prog" -echo "$as_me:2614: found $ac_dir/$ac_word" >&5 +echo "$as_me:2577: found $ac_dir/$ac_word" >&5 break done @@ -2619,10 +2582,10 @@ fi fi ETAGS=$ac_cv_prog_ETAGS if test -n "$ETAGS"; then - echo "$as_me:2622: result: $ETAGS" >&5 + echo "$as_me:2585: result: $ETAGS" >&5 echo "${ECHO_T}$ETAGS" >&6 else - echo "$as_me:2625: result: no" >&5 + echo "$as_me:2588: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2631,7 +2594,7 @@ 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:2634: checking for $ac_word" >&5 +echo "$as_me:2597: 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 @@ -2646,7 +2609,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_LOWER_TAGS="yes" -echo "$as_me:2649: found $ac_dir/$ac_word" >&5 +echo "$as_me:2612: found $ac_dir/$ac_word" >&5 break done @@ -2655,17 +2618,17 @@ fi fi MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS if test -n "$MAKE_LOWER_TAGS"; then - echo "$as_me:2658: result: $MAKE_LOWER_TAGS" >&5 + echo "$as_me:2621: result: $MAKE_LOWER_TAGS" >&5 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 else - echo "$as_me:2661: result: no" >&5 + echo "$as_me:2624: 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:2668: checking for $ac_word" >&5 +echo "$as_me:2631: 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 @@ -2680,7 +2643,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_UPPER_TAGS="yes" -echo "$as_me:2683: found $ac_dir/$ac_word" >&5 +echo "$as_me:2646: found $ac_dir/$ac_word" >&5 break done @@ -2689,10 +2652,10 @@ fi fi MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS if test -n "$MAKE_UPPER_TAGS"; then - echo "$as_me:2692: result: $MAKE_UPPER_TAGS" >&5 + echo "$as_me:2655: result: $MAKE_UPPER_TAGS" >&5 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 else - echo "$as_me:2695: result: no" >&5 + echo "$as_me:2658: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2712,7 +2675,7 @@ else MAKE_LOWER_TAGS="#" fi -echo "$as_me:2715: checking if you want to see long compiling messages" >&5 +echo "$as_me:2678: 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. @@ -2746,16 +2709,16 @@ else ECHO_CC='' fi; -echo "$as_me:2749: result: $enableval" >&5 +echo "$as_me:2712: 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:2754: error: cannot run $ac_config_sub" >&5 + { { echo "$as_me:2717: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } -echo "$as_me:2758: checking build system type" >&5 +echo "$as_me:2721: 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 @@ -2764,16 +2727,16 @@ else test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && - { { echo "$as_me:2767: error: cannot guess build type; you must specify one" >&5 + { { echo "$as_me:2730: 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:2771: error: $ac_config_sub $ac_cv_build_alias failed." >&5 + { { echo "$as_me:2734: 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:2776: result: $ac_cv_build" >&5 +echo "$as_me:2739: 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/'` @@ -2781,7 +2744,7 @@ 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:2784: checking host system type" >&5 + echo "$as_me:2747: 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 @@ -2790,12 +2753,12 @@ else 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:2793: error: $ac_config_sub $ac_cv_host_alias failed" >&5 + { { echo "$as_me:2756: 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:2798: result: $ac_cv_host" >&5 +echo "$as_me:2761: 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/'` @@ -2820,13 +2783,13 @@ else fi test -z "$system_name" && system_name="$cf_cv_system_name" -test -n "$cf_cv_system_name" && echo "$as_me:2823: result: Configuring for $cf_cv_system_name" >&5 +test -n "$cf_cv_system_name" && echo "$as_me:2786: 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:2827: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 + echo "$as_me:2790: 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:2829: error: \"Please remove config.cache and try again.\"" >&5 + { { echo "$as_me:2792: 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 @@ -2866,7 +2829,7 @@ cf_POSIX_C_SOURCE=199506L cf_xopen_source= case $host_os in #(vi -aix[4-7]*) #(vi +aix[456]*) #(vi cf_xopen_source="-D_ALL_SOURCE" ;; cygwin) #(vi @@ -2877,7 +2840,6 @@ darwin[0-8].*) #(vi ;; darwin*) #(vi cf_xopen_source="-D_DARWIN_C_SOURCE" - cf_XOPEN_SOURCE= ;; freebsd*|dragonfly*) #(vi # 5.x headers associate @@ -2895,18 +2857,17 @@ hpux*) #(vi ;; irix[56].*) #(vi cf_xopen_source="-D_SGI_SOURCE" - cf_XOPEN_SOURCE= ;; linux*|gnu*|mint*|k*bsd*-gnu) #(vi -echo "$as_me:2902: checking if we must define _GNU_SOURCE" >&5 +echo "$as_me:2863: 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 2909 "configure" +#line 2870 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2921,16 +2882,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2924: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2885: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2927: \$? = $ac_status" >&5 + echo "$as_me:2888: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2930: \"$ac_try\"") >&5 + { (eval echo "$as_me:2891: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2933: \$? = $ac_status" >&5 + echo "$as_me:2894: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_gnu_source=no else @@ -2939,7 +2900,7 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 2942 "configure" +#line 2903 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -2954,16 +2915,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2957: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2918: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2960: \$? = $ac_status" >&5 + echo "$as_me:2921: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2963: \"$ac_try\"") >&5 + { (eval echo "$as_me:2924: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2966: \$? = $ac_status" >&5 + echo "$as_me:2927: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_gnu_source=no else @@ -2978,260 +2939,16 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2981: result: $cf_cv_gnu_source" >&5 +echo "$as_me:2942: 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 <sys/select.h> and other headers which use u_int / u_short types - cf_XOPEN_SOURCE= - -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:3003: 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}:3009: testing if the symbol is already defined go no further ..." 1>&5 - - cat >conftest.$ac_ext <<_ACEOF -#line 3012 "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:3027: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3030: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3033: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:3036: \$? = $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 3057 "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:3072: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3075: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3078: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:3081: \$? = $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}:3092: 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}:3097: testing if the second compile does not leave our definition intact error ..." 1>&5 - - cat >conftest.$ac_ext <<_ACEOF -#line 3100 "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:3115: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3118: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3121: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:3124: \$? = $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:3140: 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 - + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h> ;; netbsd*) #(vi - cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw - ;; -openbsd[4-9]*) #(vi - # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw - cf_xopen_source="-D_BSD_SOURCE" - cf_XOPEN_SOURCE=600 + # 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 @@ -3245,25 +2962,23 @@ nto-qnx*) #(vi sco*) #(vi # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; -solaris2.*) #(vi +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:3253: checking if we should define _XOPEN_SOURCE" >&5 + echo "$as_me:2972: 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 3260 "configure" +#line 2979 "configure" #include "confdefs.h" - -#include <stdlib.h> -#include <string.h> #include <sys/types.h> - int main () { @@ -3276,16 +2991,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3279: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2994: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3282: \$? = $ac_status" >&5 + echo "$as_me:2997: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3285: \"$ac_try\"") >&5 + { (eval echo "$as_me:3000: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3288: \$? = $ac_status" >&5 + echo "$as_me:3003: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -3294,13 +3009,9 @@ cat conftest.$ac_ext >&5 cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" cat >conftest.$ac_ext <<_ACEOF -#line 3297 "configure" +#line 3012 "configure" #include "confdefs.h" - -#include <stdlib.h> -#include <string.h> #include <sys/types.h> - int main () { @@ -3313,16 +3024,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3316: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3027: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3319: \$? = $ac_status" >&5 + echo "$as_me:3030: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3322: \"$ac_try\"") >&5 + { (eval echo "$as_me:3033: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3325: \$? = $ac_status" >&5 + echo "$as_me:3036: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_xopen_source=no else @@ -3337,10 +3048,9 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3340: result: $cf_cv_xopen_source" >&5 +echo "$as_me:3051: result: $cf_cv_xopen_source" >&5 echo "${ECHO_T}$cf_cv_xopen_source" >&6 - -if test "$cf_cv_xopen_source" != no ; then + if test "$cf_cv_xopen_source" != no ; then CFLAGS=`echo "$CFLAGS" | \ sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ @@ -3350,7 +3060,7 @@ 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_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" cf_fix_cppflags=no cf_new_cflags= @@ -3430,7 +3140,7 @@ if test -n "$cf_new_extra_cppflags" ; then EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" fi -fi + fi cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE @@ -3445,16 +3155,16 @@ 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:3448: checking if we should define _POSIX_C_SOURCE" >&5 +echo "$as_me:3158: 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}:3454: testing if the symbol is already defined go no further ..." 1>&5 +echo "${as_me:-configure}:3164: testing if the symbol is already defined go no further ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 3457 "configure" +#line 3167 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -3469,16 +3179,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3472: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3182: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3475: \$? = $ac_status" >&5 + echo "$as_me:3185: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3478: \"$ac_try\"") >&5 + { (eval echo "$as_me:3188: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3481: \$? = $ac_status" >&5 + echo "$as_me:3191: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_posix_c_source=no else @@ -3499,7 +3209,7 @@ cf_want_posix_source=no esac if test "$cf_want_posix_source" = yes ; then cat >conftest.$ac_ext <<_ACEOF -#line 3502 "configure" +#line 3212 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -3514,16 +3224,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3517: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3227: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3520: \$? = $ac_status" >&5 + echo "$as_me:3230: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3523: \"$ac_try\"") >&5 + { (eval echo "$as_me:3233: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3526: \$? = $ac_status" >&5 + echo "$as_me:3236: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3534,15 +3244,15 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "${as_me:-configure}:3537: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 +echo "${as_me:-configure}:3247: 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}:3542: testing if the second compile does not leave our definition intact error ..." 1>&5 +echo "${as_me:-configure}:3252: testing if the second compile does not leave our definition intact error ..." 1>&5 cat >conftest.$ac_ext <<_ACEOF -#line 3545 "configure" +#line 3255 "configure" #include "confdefs.h" #include <sys/types.h> int @@ -3557,16 +3267,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:3560: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3270: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:3563: \$? = $ac_status" >&5 + echo "$as_me:3273: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3566: \"$ac_try\"") >&5 + { (eval echo "$as_me:3276: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:3569: \$? = $ac_status" >&5 + echo "$as_me:3279: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -3582,7 +3292,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:3585: result: $cf_cv_posix_c_source" >&5 +echo "$as_me:3295: 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 @@ -3754,273 +3464,6 @@ fi fi -if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then - echo "$as_me:3758: checking if _XOPEN_SOURCE really is set" >&5 -echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 3761 "configure" -#include "confdefs.h" -#include <stdlib.h> -int -main () -{ - -#ifndef _XOPEN_SOURCE -make an error -#endif - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:3776: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3779: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3782: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:3785: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_XOPEN_SOURCE_set=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_XOPEN_SOURCE_set=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:3794: result: $cf_XOPEN_SOURCE_set" >&5 -echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 - if test $cf_XOPEN_SOURCE_set = yes - then - cat >conftest.$ac_ext <<_ACEOF -#line 3799 "configure" -#include "confdefs.h" -#include <stdlib.h> -int -main () -{ - -#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE -make an error -#endif - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:3814: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3817: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3820: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:3823: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_XOPEN_SOURCE_set_ok=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_XOPEN_SOURCE_set_ok=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - if test $cf_XOPEN_SOURCE_set_ok = no - then - { echo "$as_me:3834: WARNING: _XOPEN_SOURCE is lower than requested" >&5 -echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} - fi - else - -echo "$as_me:3839: 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 3846 "configure" -#include "confdefs.h" - -#include <stdlib.h> -#include <string.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:3865: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3868: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3871: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:3874: \$? = $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 3883 "configure" -#include "confdefs.h" - -#include <stdlib.h> -#include <string.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:3902: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:3905: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:3908: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:3911: \$? = $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:3926: 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 - - fi -fi - # Check whether --enable-largefile or --disable-largefile was given. if test "${enable_largefile+set}" = set; then enableval="$enable_largefile" @@ -4028,7 +3471,7 @@ if test "${enable_largefile+set}" = set; then fi; if test "$enable_largefile" != no; then - echo "$as_me:4031: checking for special C compiler options needed for large files" >&5 + echo "$as_me:3474: 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 @@ -4040,7 +3483,7 @@ else # 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 4043 "configure" +#line 3486 "configure" #include "confdefs.h" #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. @@ -4060,16 +3503,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4063: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3506: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4066: \$? = $ac_status" >&5 + echo "$as_me:3509: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4069: \"$ac_try\"") >&5 + { (eval echo "$as_me:3512: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4072: \$? = $ac_status" >&5 + echo "$as_me:3515: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -4079,16 +3522,16 @@ fi rm -f conftest.$ac_objext CC="$CC -n32" rm -f conftest.$ac_objext -if { (eval echo "$as_me:4082: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3525: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4085: \$? = $ac_status" >&5 + echo "$as_me:3528: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4088: \"$ac_try\"") >&5 + { (eval echo "$as_me:3531: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4091: \$? = $ac_status" >&5 + echo "$as_me:3534: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_largefile_CC=' -n32'; break else @@ -4102,13 +3545,13 @@ rm -f conftest.$ac_objext rm -f conftest.$ac_ext fi fi -echo "$as_me:4105: result: $ac_cv_sys_largefile_CC" >&5 +echo "$as_me:3548: 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:4111: checking for _FILE_OFFSET_BITS value needed for large files" >&5 + echo "$as_me:3554: 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 @@ -4116,7 +3559,7 @@ else while :; do ac_cv_sys_file_offset_bits=no cat >conftest.$ac_ext <<_ACEOF -#line 4119 "configure" +#line 3562 "configure" #include "confdefs.h" #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. @@ -4136,16 +3579,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4139: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3582: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4142: \$? = $ac_status" >&5 + echo "$as_me:3585: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4145: \"$ac_try\"") >&5 + { (eval echo "$as_me:3588: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4148: \$? = $ac_status" >&5 + echo "$as_me:3591: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -4154,7 +3597,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 4157 "configure" +#line 3600 "configure" #include "confdefs.h" #define _FILE_OFFSET_BITS 64 #include <sys/types.h> @@ -4175,16 +3618,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4178: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3621: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4181: \$? = $ac_status" >&5 + echo "$as_me:3624: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4184: \"$ac_try\"") >&5 + { (eval echo "$as_me:3627: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4187: \$? = $ac_status" >&5 + echo "$as_me:3630: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_file_offset_bits=64; break else @@ -4195,7 +3638,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext break done fi -echo "$as_me:4198: result: $ac_cv_sys_file_offset_bits" >&5 +echo "$as_me:3641: 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 @@ -4205,7 +3648,7 @@ EOF fi rm -rf conftest* - echo "$as_me:4208: checking for _LARGE_FILES value needed for large files" >&5 + echo "$as_me:3651: 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 @@ -4213,7 +3656,7 @@ else while :; do ac_cv_sys_large_files=no cat >conftest.$ac_ext <<_ACEOF -#line 4216 "configure" +#line 3659 "configure" #include "confdefs.h" #include <sys/types.h> /* Check that off_t can represent 2**63 - 1 correctly. @@ -4233,16 +3676,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4236: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3679: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4239: \$? = $ac_status" >&5 + echo "$as_me:3682: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4242: \"$ac_try\"") >&5 + { (eval echo "$as_me:3685: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4245: \$? = $ac_status" >&5 + echo "$as_me:3688: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -4251,7 +3694,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 4254 "configure" +#line 3697 "configure" #include "confdefs.h" #define _LARGE_FILES 1 #include <sys/types.h> @@ -4272,16 +3715,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4275: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3718: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4278: \$? = $ac_status" >&5 + echo "$as_me:3721: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4281: \"$ac_try\"") >&5 + { (eval echo "$as_me:3724: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4284: \$? = $ac_status" >&5 + echo "$as_me:3727: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_large_files=1; break else @@ -4292,7 +3735,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext break done fi -echo "$as_me:4295: result: $ac_cv_sys_large_files" >&5 +echo "$as_me:3738: 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 @@ -4305,7 +3748,7 @@ rm -rf conftest* fi if test "$enable_largefile" != no ; then - echo "$as_me:4308: checking for _LARGEFILE_SOURCE value needed for large files" >&5 + echo "$as_me:3751: 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 @@ -4313,7 +3756,7 @@ else while :; do ac_cv_sys_largefile_source=no cat >conftest.$ac_ext <<_ACEOF -#line 4316 "configure" +#line 3759 "configure" #include "confdefs.h" #include <stdio.h> int @@ -4325,16 +3768,16 @@ return !fseeko; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4328: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3771: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4331: \$? = $ac_status" >&5 + echo "$as_me:3774: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4334: \"$ac_try\"") >&5 + { (eval echo "$as_me:3777: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4337: \$? = $ac_status" >&5 + echo "$as_me:3780: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -4343,7 +3786,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 4346 "configure" +#line 3789 "configure" #include "confdefs.h" #define _LARGEFILE_SOURCE 1 #include <stdio.h> @@ -4356,16 +3799,16 @@ return !fseeko; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4359: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3802: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4362: \$? = $ac_status" >&5 + echo "$as_me:3805: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4365: \"$ac_try\"") >&5 + { (eval echo "$as_me:3808: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4368: \$? = $ac_status" >&5 + echo "$as_me:3811: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sys_largefile_source=1; break else @@ -4376,7 +3819,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext break done fi -echo "$as_me:4379: result: $ac_cv_sys_largefile_source" >&5 +echo "$as_me:3822: 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 @@ -4390,13 +3833,13 @@ rm -rf 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:4393: checking for fseeko" >&5 +echo "$as_me:3836: 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 4399 "configure" +#line 3842 "configure" #include "confdefs.h" #include <stdio.h> int @@ -4408,16 +3851,16 @@ return fseeko && fseeko (stdin, 0, 0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4411: \"$ac_link\"") >&5 +if { (eval echo "$as_me:3854: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4414: \$? = $ac_status" >&5 + echo "$as_me:3857: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4417: \"$ac_try\"") >&5 + { (eval echo "$as_me:3860: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4420: \$? = $ac_status" >&5 + echo "$as_me:3863: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_fseeko=yes else @@ -4427,7 +3870,7 @@ ac_cv_func_fseeko=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:4430: result: $ac_cv_func_fseeko" >&5 +echo "$as_me:3873: result: $ac_cv_func_fseeko" >&5 echo "${ECHO_T}$ac_cv_func_fseeko" >&6 if test $ac_cv_func_fseeko = yes; then @@ -4448,14 +3891,14 @@ fi 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:4451: checking whether to use struct dirent64" >&5 + echo "$as_me:3894: 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 4458 "configure" +#line 3901 "configure" #include "confdefs.h" #include <sys/types.h> @@ -4476,16 +3919,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4479: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:3922: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4482: \$? = $ac_status" >&5 + echo "$as_me:3925: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4485: \"$ac_try\"") >&5 + { (eval echo "$as_me:3928: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4488: \$? = $ac_status" >&5 + echo "$as_me:3931: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_struct_dirent64=yes else @@ -4496,7 +3939,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:4499: result: $cf_cv_struct_dirent64" >&5 +echo "$as_me:3942: 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 @@ -4506,17 +3949,17 @@ EOF GCC_VERSION=none if test "$GCC" = yes ; then - echo "$as_me:4509: checking version of $CC" >&5 + echo "$as_me:3952: 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:4513: result: $GCC_VERSION" >&5 + echo "$as_me:3956: result: $GCC_VERSION" >&5 echo "${ECHO_T}$GCC_VERSION" >&6 fi if ( test "$GCC" = yes || test "$GXX" = yes ) then -echo "$as_me:4519: checking if you want to check for gcc warnings" >&5 +echo "$as_me:3962: 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. @@ -4526,7 +3969,7 @@ if test "${with_warnings+set}" = set; then else cf_opt_with_warnings=no fi; -echo "$as_me:4529: result: $cf_opt_with_warnings" >&5 +echo "$as_me:3972: result: $cf_opt_with_warnings" >&5 echo "${ECHO_T}$cf_opt_with_warnings" >&6 if test "$cf_opt_with_warnings" != no ; then @@ -4548,10 +3991,10 @@ cat > conftest.i <<EOF EOF if test "$GCC" = yes then - { echo "$as_me:4551: checking for $CC __attribute__ directives..." >&5 + { echo "$as_me:3994: checking for $CC __attribute__ directives..." >&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > conftest.$ac_ext <<EOF -#line 4554 "${as_me:-configure}" +#line 3997 "${as_me:-configure}" #include "confdefs.h" #include "conftest.h" #include "conftest.i" @@ -4600,12 +4043,12 @@ EOF ;; esac - if { (eval echo "$as_me:4603: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4046: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4606: \$? = $ac_status" >&5 + echo "$as_me:4049: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4608: result: ... $cf_attribute" >&5 + test -n "$verbose" && echo "$as_me:4051: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h case $cf_attribute in #(vi @@ -4645,12 +4088,12 @@ INTEL_COMPILER=no if test "$GCC" = yes ; then case $host_os in linux*|gnu*) - echo "$as_me:4648: checking if this is really Intel C compiler" >&5 + echo "$as_me:4091: 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 4653 "configure" +#line 4096 "configure" #include "confdefs.h" int @@ -4667,16 +4110,16 @@ make an error } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4670: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4113: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4673: \$? = $ac_status" >&5 + echo "$as_me:4116: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4676: \"$ac_try\"") >&5 + { (eval echo "$as_me:4119: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4679: \$? = $ac_status" >&5 + echo "$as_me:4122: \$? = $ac_status" >&5 (exit $ac_status); }; }; then INTEL_COMPILER=yes cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" @@ -4687,14 +4130,14 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext CFLAGS="$cf_save_CFLAGS" - echo "$as_me:4690: result: $INTEL_COMPILER" >&5 + echo "$as_me:4133: result: $INTEL_COMPILER" >&5 echo "${ECHO_T}$INTEL_COMPILER" >&6 ;; esac fi cat > conftest.$ac_ext <<EOF -#line 4697 "${as_me:-configure}" +#line 4140 "${as_me:-configure}" int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; } EOF @@ -4711,7 +4154,7 @@ then # remark #981: operands are evaluated in unspecified order # warning #279: controlling expression is constant - { echo "$as_me:4714: checking for $CC warning options..." >&5 + { echo "$as_me:4157: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-Wall" @@ -4727,12 +4170,12 @@ echo "$as_me: checking for $CC warning options..." >&6;} wd981 do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:4730: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4173: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4733: \$? = $ac_status" >&5 + echo "$as_me:4176: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4735: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4178: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi @@ -4741,7 +4184,7 @@ echo "${ECHO_T}... -$cf_opt" >&6 elif test "$GCC" = yes then - { echo "$as_me:4744: checking for $CC warning options..." >&5 + { echo "$as_me:4187: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS= @@ -4761,12 +4204,12 @@ echo "$as_me: checking for $CC warning options..." >&6;} Wundef $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:4764: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:4207: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4767: \$? = $ac_status" >&5 + echo "$as_me:4210: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:4769: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:4212: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case $cf_opt in #(vi Wcast-qual) #(vi @@ -4777,7 +4220,7 @@ echo "${ECHO_T}... -$cf_opt" >&6 [34].*) test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 -echo "${as_me:-configure}:4780: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 +echo "${as_me:-configure}:4223: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 continue;; esac @@ -4802,7 +4245,7 @@ else fi; if test -f $srcdir/VERSION ; then - echo "$as_me:4805: checking for package version" >&5 + echo "$as_me:4248: 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... @@ -4814,39 +4257,39 @@ echo $ECHO_N "checking for package version... $ECHO_C" >&6 VERSION="$cf_field1" VERSION_MAJOR=`echo "$cf_field2" | sed -e 's/\..*//'` - test -z "$VERSION_MAJOR" && { { echo "$as_me:4817: error: missing major-version" >&5 + test -z "$VERSION_MAJOR" && { { echo "$as_me:4260: 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:4822: error: missing minor-version" >&5 + test -z "$VERSION_MINOR" && { { echo "$as_me:4265: error: missing minor-version" >&5 echo "$as_me: error: missing minor-version" >&2;} { (exit 1); exit 1; }; } - echo "$as_me:4826: result: ${VERSION_MAJOR}.${VERSION_MINOR}" >&5 + echo "$as_me:4269: result: ${VERSION_MAJOR}.${VERSION_MINOR}" >&5 echo "${ECHO_T}${VERSION_MAJOR}.${VERSION_MINOR}" >&6 - echo "$as_me:4829: checking for package patch date" >&5 + echo "$as_me:4272: 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:4834: error: missing patch-date $VERSION_PATCH" >&5 + { { echo "$as_me:4277: 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:4841: error: illegal patch-date $VERSION_PATCH" >&5 + { { echo "$as_me:4284: 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:4846: result: $VERSION_PATCH" >&5 + echo "$as_me:4289: result: $VERSION_PATCH" >&5 echo "${ECHO_T}$VERSION_PATCH" >&6 else - { { echo "$as_me:4849: error: did not find $srcdir/VERSION" >&5 + { { echo "$as_me:4292: error: did not find $srcdir/VERSION" >&5 echo "$as_me: error: did not find $srcdir/VERSION" >&2;} { (exit 1); exit 1; }; } fi @@ -4854,19 +4297,19 @@ fi # show the actual data that we have for versions: test -n "$verbose" && echo " VERSION $VERSION" 1>&6 -echo "${as_me:-configure}:4857: testing VERSION $VERSION ..." 1>&5 +echo "${as_me:-configure}:4300: testing VERSION $VERSION ..." 1>&5 test -n "$verbose" && echo " VERSION_MAJOR $VERSION_MAJOR" 1>&6 -echo "${as_me:-configure}:4861: testing VERSION_MAJOR $VERSION_MAJOR ..." 1>&5 +echo "${as_me:-configure}:4304: testing VERSION_MAJOR $VERSION_MAJOR ..." 1>&5 test -n "$verbose" && echo " VERSION_MINOR $VERSION_MINOR" 1>&6 -echo "${as_me:-configure}:4865: testing VERSION_MINOR $VERSION_MINOR ..." 1>&5 +echo "${as_me:-configure}:4308: testing VERSION_MINOR $VERSION_MINOR ..." 1>&5 test -n "$verbose" && echo " VERSION_PATCH $VERSION_PATCH" 1>&6 -echo "${as_me:-configure}:4869: testing VERSION_PATCH $VERSION_PATCH ..." 1>&5 +echo "${as_me:-configure}:4312: testing VERSION_PATCH $VERSION_PATCH ..." 1>&5 cf_PACKAGE=dialog PACKAGE=$PACKAGE @@ -4893,13 +4336,13 @@ else fi; EXTRAOBJS="" -echo "$as_me:4896: checking for ANSI C header files" >&5 +echo "$as_me:4339: 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 4902 "configure" +#line 4345 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -4907,13 +4350,13 @@ else #include <float.h> _ACEOF -if { (eval echo "$as_me:4910: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4353: \"$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:4916: \$? = $ac_status" >&5 + echo "$as_me:4359: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4935,7 +4378,7 @@ 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 4938 "configure" +#line 4381 "configure" #include "confdefs.h" #include <string.h> @@ -4953,7 +4396,7 @@ 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 4956 "configure" +#line 4399 "configure" #include "confdefs.h" #include <stdlib.h> @@ -4974,7 +4417,7 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line 4977 "configure" +#line 4420 "configure" #include "confdefs.h" #include <ctype.h> #if ((' ' & 0x0FF) == 0x020) @@ -5000,15 +4443,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5003: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4446: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5006: \$? = $ac_status" >&5 + echo "$as_me:4449: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5008: \"$ac_try\"") >&5 + { (eval echo "$as_me:4451: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5011: \$? = $ac_status" >&5 + echo "$as_me:4454: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -5021,7 +4464,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi -echo "$as_me:5024: result: $ac_cv_header_stdc" >&5 +echo "$as_me:4467: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then @@ -5031,7 +4474,7 @@ EOF fi -echo "$as_me:5034: checking for inline" >&5 +echo "$as_me:4477: 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 @@ -5039,7 +4482,7 @@ else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF -#line 5042 "configure" +#line 4485 "configure" #include "confdefs.h" #ifndef __cplusplus static $ac_kw int static_foo () {return 0; } @@ -5048,16 +4491,16 @@ $ac_kw int foo () {return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5051: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4494: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5054: \$? = $ac_status" >&5 + echo "$as_me:4497: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5057: \"$ac_try\"") >&5 + { (eval echo "$as_me:4500: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5060: \$? = $ac_status" >&5 + echo "$as_me:4503: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else @@ -5068,7 +4511,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:5071: result: $ac_cv_c_inline" >&5 +echo "$as_me:4514: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6 case $ac_cv_c_inline in inline | yes) ;; @@ -5089,28 +4532,28 @@ 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:5092: checking for $ac_header" >&5 +echo "$as_me:4535: 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 5098 "configure" +#line 4541 "configure" #include "confdefs.h" $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5104: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4547: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5107: \$? = $ac_status" >&5 + echo "$as_me:4550: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5110: \"$ac_try\"") >&5 + { (eval echo "$as_me:4553: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5113: \$? = $ac_status" >&5 + echo "$as_me:4556: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else @@ -5120,7 +4563,7 @@ eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:5123: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:4566: 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 @@ -5130,13 +4573,13 @@ EOF fi done -echo "$as_me:5133: checking for off_t" >&5 +echo "$as_me:4576: 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 5139 "configure" +#line 4582 "configure" #include "confdefs.h" $ac_includes_default int @@ -5151,16 +4594,16 @@ if (sizeof (off_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5154: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4597: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5157: \$? = $ac_status" >&5 + echo "$as_me:4600: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5160: \"$ac_try\"") >&5 + { (eval echo "$as_me:4603: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5163: \$? = $ac_status" >&5 + echo "$as_me:4606: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_off_t=yes else @@ -5170,7 +4613,7 @@ ac_cv_type_off_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:5173: result: $ac_cv_type_off_t" >&5 +echo "$as_me:4616: 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 : @@ -5182,13 +4625,13 @@ EOF fi -echo "$as_me:5185: checking for size_t" >&5 +echo "$as_me:4628: 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 5191 "configure" +#line 4634 "configure" #include "confdefs.h" $ac_includes_default int @@ -5203,16 +4646,16 @@ if (sizeof (size_t)) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:5206: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4649: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:5209: \$? = $ac_status" >&5 + echo "$as_me:4652: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:5212: \"$ac_try\"") >&5 + { (eval echo "$as_me:4655: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5215: \$? = $ac_status" >&5 + echo "$as_me:4658: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_size_t=yes else @@ -5222,7 +4665,7 @@ ac_cv_type_size_t=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:5225: result: $ac_cv_type_size_t" >&5 +echo "$as_me:4668: 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 : @@ -5236,13 +4679,13 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! -echo "$as_me:5239: checking for working alloca.h" >&5 +echo "$as_me:4682: 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 5245 "configure" +#line 4688 "configure" #include "confdefs.h" #include <alloca.h> int @@ -5254,16 +4697,16 @@ char *p = (char *) alloca (2 * sizeof (int)); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5257: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4700: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5260: \$? = $ac_status" >&5 + echo "$as_me:4703: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5263: \"$ac_try\"") >&5 + { (eval echo "$as_me:4706: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5266: \$? = $ac_status" >&5 + echo "$as_me:4709: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_working_alloca_h=yes else @@ -5273,7 +4716,7 @@ ac_cv_working_alloca_h=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5276: result: $ac_cv_working_alloca_h" >&5 +echo "$as_me:4719: 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 @@ -5283,13 +4726,13 @@ EOF fi -echo "$as_me:5286: checking for alloca" >&5 +echo "$as_me:4729: 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 5292 "configure" +#line 4735 "configure" #include "confdefs.h" #ifdef __GNUC__ # define alloca __builtin_alloca @@ -5321,16 +4764,16 @@ char *p = (char *) alloca (1); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5324: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4767: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5327: \$? = $ac_status" >&5 + echo "$as_me:4770: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5330: \"$ac_try\"") >&5 + { (eval echo "$as_me:4773: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5333: \$? = $ac_status" >&5 + echo "$as_me:4776: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_alloca_works=yes else @@ -5340,7 +4783,7 @@ ac_cv_func_alloca_works=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5343: result: $ac_cv_func_alloca_works" >&5 +echo "$as_me:4786: 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 @@ -5361,13 +4804,13 @@ cat >>confdefs.h <<\EOF #define C_ALLOCA 1 EOF -echo "$as_me:5364: checking whether \`alloca.c' needs Cray hooks" >&5 +echo "$as_me:4807: 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 5370 "configure" +#line 4813 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -5385,18 +4828,18 @@ fi rm -rf conftest* fi -echo "$as_me:5388: result: $ac_cv_os_cray" >&5 +echo "$as_me:4831: 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:5393: checking for $ac_func" >&5 +echo "$as_me:4836: 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 5399 "configure" +#line 4842 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -5427,16 +4870,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5430: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4873: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5433: \$? = $ac_status" >&5 + echo "$as_me:4876: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5436: \"$ac_try\"") >&5 + { (eval echo "$as_me:4879: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5439: \$? = $ac_status" >&5 + echo "$as_me:4882: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -5446,7 +4889,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5449: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:4892: 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 @@ -5460,7 +4903,7 @@ fi done fi -echo "$as_me:5463: checking stack direction for C alloca" >&5 +echo "$as_me:4906: 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 @@ -5469,7 +4912,7 @@ else ac_cv_c_stack_direction=0 else cat >conftest.$ac_ext <<_ACEOF -#line 5472 "configure" +#line 4915 "configure" #include "confdefs.h" int find_stack_direction () @@ -5492,15 +4935,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5495: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4938: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5498: \$? = $ac_status" >&5 + echo "$as_me:4941: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5500: \"$ac_try\"") >&5 + { (eval echo "$as_me:4943: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5503: \$? = $ac_status" >&5 + echo "$as_me:4946: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_stack_direction=1 else @@ -5512,7 +4955,7 @@ fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:5515: result: $ac_cv_c_stack_direction" >&5 +echo "$as_me:4958: result: $ac_cv_c_stack_direction" >&5 echo "${ECHO_T}$ac_cv_c_stack_direction" >&6 cat >>confdefs.h <<EOF @@ -5524,23 +4967,23 @@ 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:5527: checking for $ac_header" >&5 +echo "$as_me:4970: 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 5533 "configure" +#line 4976 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:5537: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4980: \"$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:5543: \$? = $ac_status" >&5 + echo "$as_me:4986: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -5559,7 +5002,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:5562: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:5005: 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 @@ -5572,13 +5015,13 @@ done for ac_func in getpagesize do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:5575: checking for $ac_func" >&5 +echo "$as_me:5018: 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 5581 "configure" +#line 5024 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -5609,16 +5052,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5612: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5055: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5615: \$? = $ac_status" >&5 + echo "$as_me:5058: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5618: \"$ac_try\"") >&5 + { (eval echo "$as_me:5061: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5621: \$? = $ac_status" >&5 + echo "$as_me:5064: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -5628,7 +5071,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5631: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:5074: 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 @@ -5638,7 +5081,7 @@ EOF fi done -echo "$as_me:5641: checking for working mmap" >&5 +echo "$as_me:5084: 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 @@ -5647,7 +5090,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat >conftest.$ac_ext <<_ACEOF -#line 5650 "configure" +#line 5093 "configure" #include "confdefs.h" $ac_includes_default /* Thanks to Mike Haertel and Jim Avera for this test. @@ -5774,15 +5217,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5777: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5220: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5780: \$? = $ac_status" >&5 + echo "$as_me:5223: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5782: \"$ac_try\"") >&5 + { (eval echo "$as_me:5225: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5785: \$? = $ac_status" >&5 + echo "$as_me:5228: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mmap_fixed_mapped=yes else @@ -5794,7 +5237,7 @@ fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:5797: result: $ac_cv_func_mmap_fixed_mapped" >&5 +echo "$as_me:5240: 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 @@ -5805,13 +5248,13 @@ EOF fi rm -f conftest.mmap - echo "$as_me:5808: checking whether we are using the GNU C Library 2.1 or newer" >&5 + echo "$as_me:5251: 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 5814 "configure" +#line 5257 "configure" #include "confdefs.h" #include <features.h> @@ -5831,7 +5274,7 @@ fi rm -rf conftest* fi -echo "$as_me:5834: result: $ac_cv_gnu_library_2_1" >&5 +echo "$as_me:5277: 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" @@ -5844,7 +5287,7 @@ test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && ec : ${CONFIG_H:=config.h} if test -z "$PACKAGE" ; then - { { echo "$as_me:5847: error: CF_BUNDLED_INTL used without setting PACKAGE variable" >&5 + { { echo "$as_me:5290: error: CF_BUNDLED_INTL used without setting PACKAGE variable" >&5 echo "$as_me: error: CF_BUNDLED_INTL used without setting PACKAGE variable" >&2;} { (exit 1); exit 1; }; } fi @@ -5861,23 +5304,23 @@ 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:5864: checking for $ac_header" >&5 +echo "$as_me:5307: 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 5870 "configure" +#line 5313 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:5874: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:5317: \"$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:5880: \$? = $ac_status" >&5 + echo "$as_me:5323: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -5896,7 +5339,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:5899: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:5342: 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 @@ -5911,13 +5354,13 @@ 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:5914: checking for $ac_func" >&5 +echo "$as_me:5357: 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 5920 "configure" +#line 5363 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -5948,16 +5391,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5951: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5394: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5954: \$? = $ac_status" >&5 + echo "$as_me:5397: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5957: \"$ac_try\"") >&5 + { (eval echo "$as_me:5400: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5960: \$? = $ac_status" >&5 + echo "$as_me:5403: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -5967,7 +5410,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5970: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:5413: 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 @@ -6015,7 +5458,7 @@ if test -n "$cf_searchpath/include" ; then cf_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat >conftest.$ac_ext <<_ACEOF -#line 6018 "configure" +#line 5461 "configure" #include "confdefs.h" #include <stdio.h> int @@ -6027,16 +5470,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6030: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5473: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6033: \$? = $ac_status" >&5 + echo "$as_me:5476: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6036: \"$ac_try\"") >&5 + { (eval echo "$as_me:5479: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6039: \$? = $ac_status" >&5 + echo "$as_me:5482: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -6053,7 +5496,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:6056: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:5499: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -6094,7 +5537,7 @@ if test -n "$cf_searchpath/../include" ; then cf_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat >conftest.$ac_ext <<_ACEOF -#line 6097 "configure" +#line 5540 "configure" #include "confdefs.h" #include <stdio.h> int @@ -6106,16 +5549,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6109: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5552: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6112: \$? = $ac_status" >&5 + echo "$as_me:5555: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6115: \"$ac_try\"") >&5 + { (eval echo "$as_me:5558: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6118: \$? = $ac_status" >&5 + echo "$as_me:5561: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -6132,7 +5575,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:6135: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:5578: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -6148,7 +5591,7 @@ echo "${as_me:-configure}:6135: testing adding $cf_add_incdir to include-path .. fi else -{ { echo "$as_me:6151: error: cannot find libiconv under $withval" >&5 +{ { echo "$as_me:5594: error: cannot find libiconv under $withval" >&5 echo "$as_me: error: cannot find libiconv under $withval" >&2;} { (exit 1); exit 1; }; } fi @@ -6173,7 +5616,7 @@ if test -n "$cf_searchpath/lib" ; then if test "$cf_have_libdir" = no ; then test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:6176: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:5619: testing adding $cf_add_libdir to library-path ..." 1>&5 LDFLAGS="-L$cf_add_libdir $LDFLAGS" fi @@ -6202,7 +5645,7 @@ if test -n "$cf_searchpath" ; then if test "$cf_have_libdir" = no ; then test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:6205: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:5648: testing adding $cf_add_libdir to library-path ..." 1>&5 LDFLAGS="-L$cf_add_libdir $LDFLAGS" fi @@ -6211,7 +5654,7 @@ echo "${as_me:-configure}:6205: testing adding $cf_add_libdir to library-path .. fi else -{ { echo "$as_me:6214: error: cannot find libiconv under $withval" >&5 +{ { echo "$as_me:5657: error: cannot find libiconv under $withval" >&5 echo "$as_me: error: cannot find libiconv under $withval" >&2;} { (exit 1); exit 1; }; } fi @@ -6222,7 +5665,7 @@ done fi; - echo "$as_me:6225: checking for iconv" >&5 + echo "$as_me:5668: 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 @@ -6233,12 +5676,12 @@ else cf_cv_header_path_iconv= cf_cv_library_path_iconv= -echo "${as_me:-configure}:6236: testing Starting FIND_LINKAGE(iconv,) ..." 1>&5 +echo "${as_me:-configure}:5679: testing Starting FIND_LINKAGE(iconv,) ..." 1>&5 cf_save_LIBS="$LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 6241 "configure" +#line 5684 "configure" #include "confdefs.h" #include <stdlib.h> @@ -6257,16 +5700,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6260: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5703: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6263: \$? = $ac_status" >&5 + echo "$as_me:5706: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6266: \"$ac_try\"") >&5 + { (eval echo "$as_me:5709: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6269: \$? = $ac_status" >&5 + echo "$as_me:5712: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_find_linkage_iconv=yes @@ -6280,7 +5723,7 @@ cat conftest.$ac_ext >&5 LIBS="-liconv $cf_save_LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 6283 "configure" +#line 5726 "configure" #include "confdefs.h" #include <stdlib.h> @@ -6299,16 +5742,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6302: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5745: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6305: \$? = $ac_status" >&5 + echo "$as_me:5748: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6308: \"$ac_try\"") >&5 + { (eval echo "$as_me:5751: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6311: \$? = $ac_status" >&5 + echo "$as_me:5754: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_find_linkage_iconv=yes @@ -6325,9 +5768,9 @@ cat conftest.$ac_ext >&5 test -n "$verbose" && echo " find linkage for iconv library" 1>&6 -echo "${as_me:-configure}:6328: testing find linkage for iconv library ..." 1>&5 +echo "${as_me:-configure}:5771: testing find linkage for iconv library ..." 1>&5 -echo "${as_me:-configure}:6330: testing Searching for headers in FIND_LINKAGE(iconv,) ..." 1>&5 +echo "${as_me:-configure}:5773: testing Searching for headers in FIND_LINKAGE(iconv,) ..." 1>&5 cf_save_CPPFLAGS="$CPPFLAGS" cf_test_CPPFLAGS="$CPPFLAGS" @@ -6440,11 +5883,11 @@ cf_search="$cf_search $cf_header_path_list" 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}:6443: testing ... testing $cf_cv_header_path_iconv ..." 1>&5 +echo "${as_me:-configure}:5886: 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 6447 "configure" +#line 5890 "configure" #include "confdefs.h" #include <stdlib.h> @@ -6463,21 +5906,21 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6466: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:5909: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6469: \$? = $ac_status" >&5 + echo "$as_me:5912: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6472: \"$ac_try\"") >&5 + { (eval echo "$as_me:5915: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6475: \$? = $ac_status" >&5 + echo "$as_me:5918: \$? = $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}:6480: testing ... found iconv headers in $cf_cv_header_path_iconv ..." 1>&5 +echo "${as_me:-configure}:5923: testing ... found iconv headers in $cf_cv_header_path_iconv ..." 1>&5 cf_cv_find_linkage_iconv=maybe cf_test_CPPFLAGS="$CPPFLAGS" @@ -6495,7 +5938,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_cv_find_linkage_iconv" = maybe ; then -echo "${as_me:-configure}:6498: testing Searching for iconv library in FIND_LINKAGE(iconv,) ..." 1>&5 +echo "${as_me:-configure}:5941: testing Searching for iconv library in FIND_LINKAGE(iconv,) ..." 1>&5 cf_save_LIBS="$LIBS" cf_save_LDFLAGS="$LDFLAGS" @@ -6592,13 +6035,13 @@ cf_search="$cf_library_path_list $cf_search" 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}:6595: testing ... testing $cf_cv_library_path_iconv ..." 1>&5 +echo "${as_me:-configure}:6038: 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 6601 "configure" +#line 6044 "configure" #include "confdefs.h" #include <stdlib.h> @@ -6617,21 +6060,21 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6620: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6063: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6623: \$? = $ac_status" >&5 + echo "$as_me:6066: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6626: \"$ac_try\"") >&5 + { (eval echo "$as_me:6069: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6629: \$? = $ac_status" >&5 + echo "$as_me:6072: \$? = $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}:6634: testing ... found iconv library in $cf_cv_library_path_iconv ..." 1>&5 +echo "${as_me:-configure}:6077: testing ... found iconv library in $cf_cv_library_path_iconv ..." 1>&5 cf_cv_find_linkage_iconv=yes cf_cv_library_file_iconv="-liconv" @@ -6671,7 +6114,7 @@ am_cv_func_iconv="no, consider installing GNU libiconv" fi fi -echo "$as_me:6674: result: $am_cv_func_iconv" >&5 +echo "$as_me:6117: result: $am_cv_func_iconv" >&5 echo "${ECHO_T}$am_cv_func_iconv" >&6 if test "$am_cv_func_iconv" = yes; then @@ -6680,14 +6123,14 @@ cat >>confdefs.h <<\EOF #define HAVE_ICONV 1 EOF - echo "$as_me:6683: checking if the declaration of iconv() needs const." >&5 + echo "$as_me:6126: 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 6690 "configure" +#line 6133 "configure" #include "confdefs.h" #include <stdlib.h> @@ -6712,16 +6155,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6715: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6158: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6718: \$? = $ac_status" >&5 + echo "$as_me:6161: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6721: \"$ac_try\"") >&5 + { (eval echo "$as_me:6164: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6724: \$? = $ac_status" >&5 + echo "$as_me:6167: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_proto_iconv_const=no else @@ -6731,7 +6174,7 @@ am_cv_proto_iconv_const=yes fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:6734: result: $am_cv_proto_iconv_const" >&5 +echo "$as_me:6177: 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 @@ -6773,7 +6216,7 @@ if test -n "$cf_cv_header_path_iconv" ; then cf_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat >conftest.$ac_ext <<_ACEOF -#line 6776 "configure" +#line 6219 "configure" #include "confdefs.h" #include <stdio.h> int @@ -6785,16 +6228,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6788: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6231: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6791: \$? = $ac_status" >&5 + echo "$as_me:6234: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6794: \"$ac_try\"") >&5 + { (eval echo "$as_me:6237: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6797: \$? = $ac_status" >&5 + echo "$as_me:6240: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -6811,7 +6254,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:6814: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:6257: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -6848,7 +6291,7 @@ if test -n "$cf_cv_library_path_iconv" ; then if test "$cf_have_libdir" = no ; then test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:6851: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:6294: testing adding $cf_add_libdir to library-path ..." 1>&5 LDFLAGS="-L$cf_add_libdir $LDFLAGS" fi @@ -6859,13 +6302,13 @@ fi fi fi - echo "$as_me:6862: checking for nl_langinfo and CODESET" >&5 + echo "$as_me:6305: 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 6868 "configure" +#line 6311 "configure" #include "confdefs.h" #include <langinfo.h> int @@ -6877,16 +6320,16 @@ char* cs = nl_langinfo(CODESET); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6880: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6323: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6883: \$? = $ac_status" >&5 + echo "$as_me:6326: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6886: \"$ac_try\"") >&5 + { (eval echo "$as_me:6329: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6889: \$? = $ac_status" >&5 + echo "$as_me:6332: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_langinfo_codeset=yes else @@ -6897,7 +6340,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6900: result: $am_cv_langinfo_codeset" >&5 +echo "$as_me:6343: result: $am_cv_langinfo_codeset" >&5 echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 if test $am_cv_langinfo_codeset = yes; then @@ -6908,13 +6351,13 @@ EOF fi if test $ac_cv_header_locale_h = yes; then - echo "$as_me:6911: checking for LC_MESSAGES" >&5 + echo "$as_me:6354: 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 6917 "configure" +#line 6360 "configure" #include "confdefs.h" #include <locale.h> int @@ -6926,16 +6369,16 @@ return LC_MESSAGES } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6929: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6372: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:6932: \$? = $ac_status" >&5 + echo "$as_me:6375: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6935: \"$ac_try\"") >&5 + { (eval echo "$as_me:6378: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6938: \$? = $ac_status" >&5 + echo "$as_me:6381: \$? = $ac_status" >&5 (exit $ac_status); }; }; then am_cv_val_LC_MESSAGES=yes else @@ -6945,7 +6388,7 @@ am_cv_val_LC_MESSAGES=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:6948: result: $am_cv_val_LC_MESSAGES" >&5 +echo "$as_me:6391: 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 @@ -6955,7 +6398,7 @@ EOF fi fi - echo "$as_me:6958: checking whether NLS is requested" >&5 + echo "$as_me:6401: 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. @@ -6965,7 +6408,7 @@ if test "${enable_nls+set}" = set; then else USE_NLS=no fi; - echo "$as_me:6968: result: $USE_NLS" >&5 + echo "$as_me:6411: result: $USE_NLS" >&5 echo "${ECHO_T}$USE_NLS" >&6 BUILD_INCLUDED_LIBINTL=no @@ -6978,7 +6421,7 @@ cat >>confdefs.h <<\EOF #define ENABLE_NLS 1 EOF - echo "$as_me:6981: checking whether included gettext is requested" >&5 + echo "$as_me:6424: 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. @@ -6988,7 +6431,7 @@ if test "${with_included_gettext+set}" = set; then else nls_cv_force_use_gnu_gettext=no fi; - echo "$as_me:6991: result: $nls_cv_force_use_gnu_gettext" >&5 + echo "$as_me:6434: 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" @@ -6997,7 +6440,7 @@ echo "${ECHO_T}$nls_cv_force_use_gnu_gettext" >&6 cf_save_LIBS_1="$LIBS" LIBS="$LIBICONV $LIBS" - echo "$as_me:7000: checking for libintl.h and gettext()" >&5 + echo "$as_me:6443: 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 @@ -7008,12 +6451,12 @@ else cf_cv_header_path_intl= cf_cv_library_path_intl= -echo "${as_me:-configure}:7011: testing Starting FIND_LINKAGE(intl,) ..." 1>&5 +echo "${as_me:-configure}:6454: testing Starting FIND_LINKAGE(intl,) ..." 1>&5 cf_save_LIBS="$LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 7016 "configure" +#line 6459 "configure" #include "confdefs.h" #include <libintl.h> @@ -7033,16 +6476,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7036: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6479: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7039: \$? = $ac_status" >&5 + echo "$as_me:6482: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7042: \"$ac_try\"") >&5 + { (eval echo "$as_me:6485: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7045: \$? = $ac_status" >&5 + echo "$as_me:6488: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_find_linkage_intl=yes @@ -7056,7 +6499,7 @@ cat conftest.$ac_ext >&5 LIBS="-lintl $cf_save_LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 7059 "configure" +#line 6502 "configure" #include "confdefs.h" #include <libintl.h> @@ -7076,16 +6519,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7079: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6522: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7082: \$? = $ac_status" >&5 + echo "$as_me:6525: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7085: \"$ac_try\"") >&5 + { (eval echo "$as_me:6528: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7088: \$? = $ac_status" >&5 + echo "$as_me:6531: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_find_linkage_intl=yes @@ -7102,9 +6545,9 @@ cat conftest.$ac_ext >&5 test -n "$verbose" && echo " find linkage for intl library" 1>&6 -echo "${as_me:-configure}:7105: testing find linkage for intl library ..." 1>&5 +echo "${as_me:-configure}:6548: testing find linkage for intl library ..." 1>&5 -echo "${as_me:-configure}:7107: testing Searching for headers in FIND_LINKAGE(intl,) ..." 1>&5 +echo "${as_me:-configure}:6550: testing Searching for headers in FIND_LINKAGE(intl,) ..." 1>&5 cf_save_CPPFLAGS="$CPPFLAGS" cf_test_CPPFLAGS="$CPPFLAGS" @@ -7217,11 +6660,11 @@ cf_search="$cf_search $cf_header_path_list" 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}:7220: testing ... testing $cf_cv_header_path_intl ..." 1>&5 +echo "${as_me:-configure}:6663: 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 7224 "configure" +#line 6667 "configure" #include "confdefs.h" #include <libintl.h> @@ -7241,21 +6684,21 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:7244: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6687: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7247: \$? = $ac_status" >&5 + echo "$as_me:6690: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7250: \"$ac_try\"") >&5 + { (eval echo "$as_me:6693: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7253: \$? = $ac_status" >&5 + echo "$as_me:6696: \$? = $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}:7258: testing ... found intl headers in $cf_cv_header_path_intl ..." 1>&5 +echo "${as_me:-configure}:6701: testing ... found intl headers in $cf_cv_header_path_intl ..." 1>&5 cf_cv_find_linkage_intl=maybe cf_test_CPPFLAGS="$CPPFLAGS" @@ -7273,7 +6716,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_cv_find_linkage_intl" = maybe ; then -echo "${as_me:-configure}:7276: testing Searching for intl library in FIND_LINKAGE(intl,) ..." 1>&5 +echo "${as_me:-configure}:6719: testing Searching for intl library in FIND_LINKAGE(intl,) ..." 1>&5 cf_save_LIBS="$LIBS" cf_save_LDFLAGS="$LDFLAGS" @@ -7370,13 +6813,13 @@ cf_search="$cf_library_path_list $cf_search" 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}:7373: testing ... testing $cf_cv_library_path_intl ..." 1>&5 +echo "${as_me:-configure}:6816: 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 7379 "configure" +#line 6822 "configure" #include "confdefs.h" #include <libintl.h> @@ -7396,21 +6839,21 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7399: \"$ac_link\"") >&5 +if { (eval echo "$as_me:6842: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7402: \$? = $ac_status" >&5 + echo "$as_me:6845: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7405: \"$ac_try\"") >&5 + { (eval echo "$as_me:6848: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7408: \$? = $ac_status" >&5 + echo "$as_me:6851: \$? = $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}:7413: testing ... found intl library in $cf_cv_library_path_intl ..." 1>&5 +echo "${as_me:-configure}:6856: testing ... found intl library in $cf_cv_library_path_intl ..." 1>&5 cf_cv_find_linkage_intl=yes cf_cv_library_file_intl="-lintl" @@ -7450,7 +6893,7 @@ cf_cv_func_gettext=no fi fi -echo "$as_me:7453: result: $cf_cv_func_gettext" >&5 +echo "$as_me:6896: result: $cf_cv_func_gettext" >&5 echo "${ECHO_T}$cf_cv_func_gettext" >&6 LIBS="$cf_save_LIBS_1" @@ -7489,7 +6932,7 @@ if test -n "$cf_cv_header_path_intl" ; then cf_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat >conftest.$ac_ext <<_ACEOF -#line 7492 "configure" +#line 6935 "configure" #include "confdefs.h" #include <stdio.h> int @@ -7501,16 +6944,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:7504: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6947: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7507: \$? = $ac_status" >&5 + echo "$as_me:6950: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7510: \"$ac_try\"") >&5 + { (eval echo "$as_me:6953: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7513: \$? = $ac_status" >&5 + echo "$as_me:6956: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -7527,7 +6970,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:7530: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:6973: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -7564,7 +7007,7 @@ if test -n "$cf_cv_library_path_intl" ; then if test "$cf_have_libdir" = no ; then test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:7567: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:7010: testing adding $cf_add_libdir to library-path ..." 1>&5 INTLLIBS="-L$cf_add_libdir $INTLLIBS" fi @@ -7580,13 +7023,13 @@ fi for ac_func in dcgettext do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:7583: checking for $ac_func" >&5 +echo "$as_me:7026: 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 7589 "configure" +#line 7032 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -7617,16 +7060,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7620: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7063: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7623: \$? = $ac_status" >&5 + echo "$as_me:7066: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7626: \"$ac_try\"") >&5 + { (eval echo "$as_me:7069: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7629: \$? = $ac_status" >&5 + echo "$as_me:7072: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -7636,7 +7079,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:7639: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:7082: 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 @@ -7651,7 +7094,7 @@ done # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 -echo "$as_me:7654: checking for $ac_word" >&5 +echo "$as_me:7097: 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 @@ -7678,16 +7121,16 @@ esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then - echo "$as_me:7681: result: $MSGFMT" >&5 + echo "$as_me:7124: result: $MSGFMT" >&5 echo "${ECHO_T}$MSGFMT" >&6 else - echo "$as_me:7684: result: no" >&5 + echo "$as_me:7127: 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:7690: checking for $ac_word" >&5 +echo "$as_me:7133: 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 @@ -7704,7 +7147,7 @@ for ac_dir in $ac_dummy; do 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:7707: found $ac_dir/$ac_word" >&5 + echo "$as_me:7150: found $ac_dir/$ac_word" >&5 break fi done @@ -7716,17 +7159,17 @@ fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then - echo "$as_me:7719: result: $GMSGFMT" >&5 + echo "$as_me:7162: result: $GMSGFMT" >&5 echo "${ECHO_T}$GMSGFMT" >&6 else - echo "$as_me:7722: result: no" >&5 + echo "$as_me:7165: 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:7729: checking for $ac_word" >&5 +echo "$as_me:7172: 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 @@ -7753,10 +7196,10 @@ esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then - echo "$as_me:7756: result: $XGETTEXT" >&5 + echo "$as_me:7199: result: $XGETTEXT" >&5 echo "${ECHO_T}$XGETTEXT" >&6 else - echo "$as_me:7759: result: no" >&5 + echo "$as_me:7202: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -7771,7 +7214,7 @@ fi if test "$nls_cv_use_gnu_gettext" = "yes"; then if test ! -d $srcdir/intl ; then - { { echo "$as_me:7774: error: no NLS library is packaged with this application" >&5 + { { echo "$as_me:7217: 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 @@ -7779,7 +7222,7 @@ echo "$as_me: error: no NLS library is packaged with this application" >&2;} # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 -echo "$as_me:7782: checking for $ac_word" >&5 +echo "$as_me:7225: 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 @@ -7806,16 +7249,16 @@ esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then - echo "$as_me:7809: result: $MSGFMT" >&5 + echo "$as_me:7252: result: $MSGFMT" >&5 echo "${ECHO_T}$MSGFMT" >&6 else - echo "$as_me:7812: result: no" >&5 + echo "$as_me:7255: 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:7818: checking for $ac_word" >&5 +echo "$as_me:7261: 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 @@ -7832,7 +7275,7 @@ for ac_dir in $ac_dummy; do 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:7835: found $ac_dir/$ac_word" >&5 + echo "$as_me:7278: found $ac_dir/$ac_word" >&5 break fi done @@ -7844,17 +7287,17 @@ fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then - echo "$as_me:7847: result: $GMSGFMT" >&5 + echo "$as_me:7290: result: $GMSGFMT" >&5 echo "${ECHO_T}$GMSGFMT" >&6 else - echo "$as_me:7850: result: no" >&5 + echo "$as_me:7293: 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:7857: checking for $ac_word" >&5 +echo "$as_me:7300: 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 @@ -7881,10 +7324,10 @@ esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then - echo "$as_me:7884: result: $XGETTEXT" >&5 + echo "$as_me:7327: result: $XGETTEXT" >&5 echo "${ECHO_T}$XGETTEXT" >&6 else - echo "$as_me:7887: result: no" >&5 + echo "$as_me:7330: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -7899,7 +7342,7 @@ fi if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then : ; else - echo "$as_me:7902: result: found msgfmt program is not GNU msgfmt; ignore it" >&5 + echo "$as_me:7345: 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 @@ -7909,7 +7352,7 @@ echo "${ECHO_T}found msgfmt program is not GNU msgfmt; ignore it" >&6 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then : ; else - echo "$as_me:7912: result: found xgettext program is not GNU xgettext; ignore it" >&5 + echo "$as_me:7355: 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 @@ -7929,7 +7372,7 @@ echo "${ECHO_T}found xgettext program is not GNU xgettext; ignore it" >&6 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:7932: checking for $ac_word" >&5 +echo "$as_me:7375: 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 @@ -7944,7 +7387,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_INTLBISON="$ac_prog" -echo "$as_me:7947: found $ac_dir/$ac_word" >&5 +echo "$as_me:7390: found $ac_dir/$ac_word" >&5 break done @@ -7952,10 +7395,10 @@ fi fi INTLBISON=$ac_cv_prog_INTLBISON if test -n "$INTLBISON"; then - echo "$as_me:7955: result: $INTLBISON" >&5 + echo "$as_me:7398: result: $INTLBISON" >&5 echo "${ECHO_T}$INTLBISON" >&6 else - echo "$as_me:7958: result: no" >&5 + echo "$as_me:7401: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -7965,7 +7408,7 @@ done if test -z "$INTLBISON"; then ac_verc_fail=yes else - echo "$as_me:7968: checking version of bison" >&5 + echo "$as_me:7411: 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 @@ -7974,7 +7417,7 @@ echo $ECHO_N "checking version of bison... $ECHO_C" >&6 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:7977: result: $ac_prog_version" >&5 + echo "$as_me:7420: result: $ac_prog_version" >&5 echo "${ECHO_T}$ac_prog_version" >&6 fi if test $ac_verc_fail = yes; then @@ -8000,7 +7443,7 @@ echo "${ECHO_T}$ac_prog_version" >&6 if test "x$ALL_LINGUAS" = "x"; then LINGUAS= else - echo "$as_me:8003: checking for catalogs to be installed" >&5 + echo "$as_me:7446: 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 @@ -8020,7 +7463,7 @@ echo $ECHO_N "checking for catalogs to be installed... $ECHO_C" >&6 fi done LINGUAS=$NEW_LINGUAS - echo "$as_me:8023: result: $LINGUAS" >&5 + echo "$as_me:7466: result: $LINGUAS" >&5 echo "${ECHO_T}$LINGUAS" >&6 fi @@ -8055,7 +7498,7 @@ cf_makefile=makefile use_our_messages=no if test "$USE_NLS" = yes ; then if test -d $srcdir/po ; then -echo "$as_me:8058: checking if we should use included message-library" >&5 +echo "$as_me:7501: 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. @@ -8066,7 +7509,7 @@ else use_our_messages=yes fi; fi -echo "$as_me:8069: result: $use_our_messages" >&5 +echo "$as_me:7512: result: $use_our_messages" >&5 echo "${ECHO_T}$use_our_messages" >&6 fi @@ -8107,23 +7550,23 @@ else for ac_header in libintl.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:8110: checking for $ac_header" >&5 +echo "$as_me:7553: 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 8116 "configure" +#line 7559 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:8120: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:7563: \"$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:8126: \$? = $ac_status" >&5 + echo "$as_me:7569: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -8142,7 +7585,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:8145: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:7588: 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 @@ -8187,14 +7630,14 @@ EOF fi fi -echo "$as_me:8190: checking if -lm needed for math functions" >&5 +echo "$as_me:7633: 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 8197 "configure" +#line 7640 "configure" #include "confdefs.h" #include <stdio.h> @@ -8209,16 +7652,16 @@ double x = rand(); printf("result = %g\n", sqrt(x)) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8212: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7655: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8215: \$? = $ac_status" >&5 + echo "$as_me:7658: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8218: \"$ac_try\"") >&5 + { (eval echo "$as_me:7661: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8221: \$? = $ac_status" >&5 + echo "$as_me:7664: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_need_libm=no else @@ -8228,7 +7671,7 @@ cf_cv_need_libm=yes fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:8231: result: $cf_cv_need_libm" >&5 +echo "$as_me:7674: result: $cf_cv_need_libm" >&5 echo "${ECHO_T}$cf_cv_need_libm" >&6 if test "$cf_cv_need_libm" = yes then @@ -8237,7 +7680,7 @@ then fi -echo "$as_me:8240: checking if you want to use dmalloc for testing" >&5 +echo "$as_me:7683: 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. @@ -8253,7 +7696,7 @@ EOF else with_dmalloc= fi; -echo "$as_me:8256: result: ${with_dmalloc:-no}" >&5 +echo "$as_me:7699: result: ${with_dmalloc:-no}" >&5 echo "${ECHO_T}${with_dmalloc:-no}" >&6 case .$with_cflags in #(vi @@ -8347,23 +7790,23 @@ fi esac if test "$with_dmalloc" = yes ; then - echo "$as_me:8350: checking for dmalloc.h" >&5 + echo "$as_me:7793: 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 8356 "configure" +#line 7799 "configure" #include "confdefs.h" #include <dmalloc.h> _ACEOF -if { (eval echo "$as_me:8360: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:7803: \"$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:8366: \$? = $ac_status" >&5 + echo "$as_me:7809: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -8382,11 +7825,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:8385: result: $ac_cv_header_dmalloc_h" >&5 +echo "$as_me:7828: 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:8389: checking for dmalloc_debug in -ldmalloc" >&5 +echo "$as_me:7832: 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 @@ -8394,7 +7837,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8397 "configure" +#line 7840 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -8413,16 +7856,16 @@ dmalloc_debug (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8416: \"$ac_link\"") >&5 +if { (eval echo "$as_me:7859: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8419: \$? = $ac_status" >&5 + echo "$as_me:7862: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8422: \"$ac_try\"") >&5 + { (eval echo "$as_me:7865: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8425: \$? = $ac_status" >&5 + echo "$as_me:7868: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else @@ -8433,7 +7876,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:8436: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "$as_me:7879: 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 @@ -8448,7 +7891,7 @@ fi fi -echo "$as_me:8451: checking if you want to use dbmalloc for testing" >&5 +echo "$as_me:7894: 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. @@ -8464,7 +7907,7 @@ EOF else with_dbmalloc= fi; -echo "$as_me:8467: result: ${with_dbmalloc:-no}" >&5 +echo "$as_me:7910: result: ${with_dbmalloc:-no}" >&5 echo "${ECHO_T}${with_dbmalloc:-no}" >&6 case .$with_cflags in #(vi @@ -8558,23 +8001,23 @@ fi esac if test "$with_dbmalloc" = yes ; then - echo "$as_me:8561: checking for dbmalloc.h" >&5 + echo "$as_me:8004: 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 8567 "configure" +#line 8010 "configure" #include "confdefs.h" #include <dbmalloc.h> _ACEOF -if { (eval echo "$as_me:8571: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:8014: \"$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:8577: \$? = $ac_status" >&5 + echo "$as_me:8020: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -8593,11 +8036,11 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:8596: result: $ac_cv_header_dbmalloc_h" >&5 +echo "$as_me:8039: 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:8600: checking for debug_malloc in -ldbmalloc" >&5 +echo "$as_me:8043: 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 @@ -8605,7 +8048,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8608 "configure" +#line 8051 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -8624,16 +8067,16 @@ debug_malloc (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8627: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8070: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8630: \$? = $ac_status" >&5 + echo "$as_me:8073: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8633: \"$ac_try\"") >&5 + { (eval echo "$as_me:8076: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8636: \$? = $ac_status" >&5 + echo "$as_me:8079: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else @@ -8644,7 +8087,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:8647: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "$as_me:8090: 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 @@ -8659,7 +8102,7 @@ fi fi -echo "$as_me:8662: checking if you want to use purify for testing" >&5 +echo "$as_me:8105: 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. @@ -8675,7 +8118,7 @@ EOF else with_purify= fi; -echo "$as_me:8678: result: ${with_purify:-no}" >&5 +echo "$as_me:8121: result: ${with_purify:-no}" >&5 echo "${ECHO_T}${with_purify:-no}" >&6 case .$with_cflags in #(vi @@ -8768,7 +8211,7 @@ fi ;; esac -echo "$as_me:8771: checking if you want to use valgrind for testing" >&5 +echo "$as_me:8214: 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. @@ -8784,7 +8227,7 @@ EOF else with_valgrind= fi; -echo "$as_me:8787: result: ${with_valgrind:-no}" >&5 +echo "$as_me:8230: result: ${with_valgrind:-no}" >&5 echo "${ECHO_T}${with_valgrind:-no}" >&6 case .$with_cflags in #(vi @@ -8877,7 +8320,7 @@ fi ;; esac -echo "$as_me:8880: checking if you want to perform memory-leak testing" >&5 +echo "$as_me:8323: 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. @@ -8899,10 +8342,10 @@ EOF else with_no_leaks= fi; -echo "$as_me:8902: result: $with_no_leaks" >&5 +echo "$as_me:8345: result: $with_no_leaks" >&5 echo "${ECHO_T}$with_no_leaks" >&6 -echo "$as_me:8905: checking if you want --trace option" >&5 +echo "$as_me:8348: 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. @@ -8912,7 +8355,7 @@ if test "${enable_trace+set}" = set; then else enableval=yes fi; -echo "$as_me:8915: result: $enableval" >&5 +echo "$as_me:8358: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if test "$enableval" != no ; then EXTRAOBJS="$EXTRAOBJS trace\$o" @@ -8926,7 +8369,7 @@ fi LIBTOOL_MAKE="#" -echo "$as_me:8929: checking if libtool -version-number should be used" >&5 +echo "$as_me:8372: checking if libtool -version-number should be used" >&5 echo $ECHO_N "checking if libtool -version-number should be used... $ECHO_C" >&6 # Check whether --enable-libtool-version or --disable-libtool-version was given. @@ -8943,7 +8386,7 @@ else cf_libtool_version=yes fi; -echo "$as_me:8946: result: $cf_libtool_version" >&5 +echo "$as_me:8389: result: $cf_libtool_version" >&5 echo "${ECHO_T}$cf_libtool_version" >&6 if test "$cf_libtool_version" = yes ; then @@ -8968,7 +8411,7 @@ LIB_LINK='${CC}' LIB_INSTALL= LIB_UNINSTALL= -echo "$as_me:8971: checking if you want to build libraries with libtool" >&5 +echo "$as_me:8414: 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. @@ -8978,7 +8421,7 @@ if test "${with_libtool+set}" = set; then else with_libtool=no fi; -echo "$as_me:8981: result: $with_libtool" >&5 +echo "$as_me:8424: result: $with_libtool" >&5 echo "${ECHO_T}$with_libtool" >&6 if test "$with_libtool" != "no"; then @@ -9009,7 +8452,7 @@ case ".$with_libtool" in #(vi with_libtool=`echo $with_libtool | sed -e s%NONE%$cf_path_syntax%` ;; *) - { { echo "$as_me:9012: error: expected a pathname, not \"$with_libtool\"" >&5 + { { echo "$as_me:8455: error: expected a pathname, not \"$with_libtool\"" >&5 echo "$as_me: error: expected a pathname, not \"$with_libtool\"" >&2;} { (exit 1); exit 1; }; } ;; @@ -9019,7 +8462,7 @@ esac 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:9022: checking for $ac_word" >&5 +echo "$as_me:8465: 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 @@ -9036,7 +8479,7 @@ for ac_dir in $ac_dummy; do 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:9039: found $ac_dir/$ac_word" >&5 + echo "$as_me:8482: found $ac_dir/$ac_word" >&5 break fi done @@ -9047,16 +8490,16 @@ fi LIBTOOL=$ac_cv_path_LIBTOOL if test -n "$LIBTOOL"; then - echo "$as_me:9050: result: $LIBTOOL" >&5 + echo "$as_me:8493: result: $LIBTOOL" >&5 echo "${ECHO_T}$LIBTOOL" >&6 else - echo "$as_me:9053: result: no" >&5 + echo "$as_me:8496: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$LIBTOOL" ; then - { { echo "$as_me:9059: error: Cannot find libtool" >&5 + { { echo "$as_me:8502: error: Cannot find libtool" >&5 echo "$as_me: error: Cannot find libtool" >&2;} { (exit 1); exit 1; }; } fi @@ -9071,17 +8514,17 @@ echo "$as_me: error: Cannot find libtool" >&2;} LIB_PREP=: # Show the version of libtool - echo "$as_me:9074: checking version of libtool" >&5 + echo "$as_me:8517: 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:9081: result: $cf_cv_libtool_version" >&5 + echo "$as_me:8524: 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:9084: error: This is not GNU libtool" >&5 + { { echo "$as_me:8527: error: This is not GNU libtool" >&5 echo "$as_me: error: This is not GNU libtool" >&2;} { (exit 1); exit 1; }; } fi @@ -9089,7 +8532,7 @@ echo "$as_me: error: This is not GNU libtool" >&2;} # 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[4-7]) #(vi + cygwin*|mingw32*|uwin*|aix[456]) #(vi LT_UNDEF=-no-undefined ;; esac @@ -9115,7 +8558,7 @@ if test "$with_libtool" = "yes" ; then OBJEXT="lo" LIBTOOL_MAKE= -echo "$as_me:9118: checking for additional libtool options" >&5 +echo "$as_me:8561: 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. @@ -9125,7 +8568,7 @@ if test "${with_libtool_opts+set}" = set; then else with_libtool_opts=no fi; -echo "$as_me:9128: result: $with_libtool_opts" >&5 +echo "$as_me:8571: result: $with_libtool_opts" >&5 echo "${ECHO_T}$with_libtool_opts" >&6 case .$with_libtool_opts in @@ -9138,7 +8581,7 @@ esac fi -echo "$as_me:9141: checking for specific curses-directory" >&5 +echo "$as_me:8584: checking for specific curses-directory" >&5 echo $ECHO_N "checking for specific curses-directory... $ECHO_C" >&6 # Check whether --with-curses-dir or --without-curses-dir was given. @@ -9148,7 +8591,7 @@ if test "${with_curses_dir+set}" = set; then else cf_cv_curses_dir=no fi; -echo "$as_me:9151: result: $cf_cv_curses_dir" >&5 +echo "$as_me:8594: result: $cf_cv_curses_dir" >&5 echo "${ECHO_T}$cf_cv_curses_dir" >&6 if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" ) @@ -9179,7 +8622,7 @@ case ".$withval" in #(vi withval=`echo $withval | sed -e s%NONE%$cf_path_syntax%` ;; *) - { { echo "$as_me:9182: error: expected a pathname, not \"$withval\"" >&5 + { { echo "$as_me:8625: error: expected a pathname, not \"$withval\"" >&5 echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} { (exit 1); exit 1; }; } ;; @@ -9212,7 +8655,7 @@ if test -n "$cf_cv_curses_dir/include" ; then cf_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat >conftest.$ac_ext <<_ACEOF -#line 9215 "configure" +#line 8658 "configure" #include "confdefs.h" #include <stdio.h> int @@ -9224,16 +8667,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9227: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:8670: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9230: \$? = $ac_status" >&5 + echo "$as_me:8673: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9233: \"$ac_try\"") >&5 + { (eval echo "$as_me:8676: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9236: \$? = $ac_status" >&5 + echo "$as_me:8679: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -9250,7 +8693,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:9253: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:8696: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -9284,7 +8727,7 @@ if test -n "$cf_cv_curses_dir/lib" ; then if test "$cf_have_libdir" = no ; then test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:9287: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:8730: testing adding $cf_add_libdir to library-path ..." 1>&5 LDFLAGS="-L$cf_add_libdir $LDFLAGS" fi @@ -9312,7 +8755,7 @@ if test $use_ncurses != no ; then cf_wide_curses=yes if test $use_ncurses = ncursesw ; then -echo "$as_me:9315: checking for multibyte character support" >&5 +echo "$as_me:8758: 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 @@ -9320,7 +8763,7 @@ else cf_save_LIBS="$LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 9323 "configure" +#line 8766 "configure" #include "confdefs.h" #include <stdlib.h> @@ -9333,16 +8776,16 @@ putwc(0,0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9336: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8779: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9339: \$? = $ac_status" >&5 + echo "$as_me:8782: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9342: \"$ac_try\"") >&5 + { (eval echo "$as_me:8785: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9345: \$? = $ac_status" >&5 + echo "$as_me:8788: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_utf8_lib=yes else @@ -9354,12 +8797,12 @@ cat conftest.$ac_ext >&5 cf_cv_header_path_utf8= cf_cv_library_path_utf8= -echo "${as_me:-configure}:9357: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 +echo "${as_me:-configure}:8800: testing Starting FIND_LINKAGE(utf8,) ..." 1>&5 cf_save_LIBS="$LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 9362 "configure" +#line 8805 "configure" #include "confdefs.h" #include <libutf8.h> @@ -9372,16 +8815,16 @@ putwc(0,0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9375: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8818: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9378: \$? = $ac_status" >&5 + echo "$as_me:8821: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9381: \"$ac_try\"") >&5 + { (eval echo "$as_me:8824: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9384: \$? = $ac_status" >&5 + echo "$as_me:8827: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_find_linkage_utf8=yes @@ -9395,7 +8838,7 @@ cat conftest.$ac_ext >&5 LIBS="-lutf8 $cf_save_LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 9398 "configure" +#line 8841 "configure" #include "confdefs.h" #include <libutf8.h> @@ -9408,16 +8851,16 @@ putwc(0,0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9411: \"$ac_link\"") >&5 +if { (eval echo "$as_me:8854: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9414: \$? = $ac_status" >&5 + echo "$as_me:8857: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9417: \"$ac_try\"") >&5 + { (eval echo "$as_me:8860: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9420: \$? = $ac_status" >&5 + echo "$as_me:8863: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_find_linkage_utf8=yes @@ -9434,9 +8877,9 @@ cat conftest.$ac_ext >&5 test -n "$verbose" && echo " find linkage for utf8 library" 1>&6 -echo "${as_me:-configure}:9437: testing find linkage for utf8 library ..." 1>&5 +echo "${as_me:-configure}:8880: testing find linkage for utf8 library ..." 1>&5 -echo "${as_me:-configure}:9439: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 +echo "${as_me:-configure}:8882: testing Searching for headers in FIND_LINKAGE(utf8,) ..." 1>&5 cf_save_CPPFLAGS="$CPPFLAGS" cf_test_CPPFLAGS="$CPPFLAGS" @@ -9549,11 +8992,11 @@ cf_search="$cf_search $cf_header_path_list" 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}:9552: testing ... testing $cf_cv_header_path_utf8 ..." 1>&5 +echo "${as_me:-configure}:8995: 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 9556 "configure" +#line 8999 "configure" #include "confdefs.h" #include <libutf8.h> @@ -9566,21 +9009,21 @@ putwc(0,0); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9569: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9012: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9572: \$? = $ac_status" >&5 + echo "$as_me:9015: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9575: \"$ac_try\"") >&5 + { (eval echo "$as_me:9018: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9578: \$? = $ac_status" >&5 + echo "$as_me:9021: \$? = $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}:9583: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 +echo "${as_me:-configure}:9026: testing ... found utf8 headers in $cf_cv_header_path_utf8 ..." 1>&5 cf_cv_find_linkage_utf8=maybe cf_test_CPPFLAGS="$CPPFLAGS" @@ -9598,7 +9041,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_cv_find_linkage_utf8" = maybe ; then -echo "${as_me:-configure}:9601: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 +echo "${as_me:-configure}:9044: testing Searching for utf8 library in FIND_LINKAGE(utf8,) ..." 1>&5 cf_save_LIBS="$LIBS" cf_save_LDFLAGS="$LDFLAGS" @@ -9695,13 +9138,13 @@ cf_search="$cf_library_path_list $cf_search" 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}:9698: testing ... testing $cf_cv_library_path_utf8 ..." 1>&5 +echo "${as_me:-configure}:9141: 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 9704 "configure" +#line 9147 "configure" #include "confdefs.h" #include <libutf8.h> @@ -9714,21 +9157,21 @@ putwc(0,0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9717: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9160: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9720: \$? = $ac_status" >&5 + echo "$as_me:9163: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9723: \"$ac_try\"") >&5 + { (eval echo "$as_me:9166: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9726: \$? = $ac_status" >&5 + echo "$as_me:9169: \$? = $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}:9731: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 +echo "${as_me:-configure}:9174: testing ... found utf8 library in $cf_cv_library_path_utf8 ..." 1>&5 cf_cv_find_linkage_utf8=yes cf_cv_library_file_utf8="-lutf8" @@ -9770,7 +9213,7 @@ fi fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:9773: result: $cf_cv_utf8_lib" >&5 +echo "$as_me:9216: 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 @@ -9804,7 +9247,7 @@ if test -n "$cf_cv_header_path_utf8" ; then cf_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat >conftest.$ac_ext <<_ACEOF -#line 9807 "configure" +#line 9250 "configure" #include "confdefs.h" #include <stdio.h> int @@ -9816,16 +9259,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9819: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9262: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9822: \$? = $ac_status" >&5 + echo "$as_me:9265: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9825: \"$ac_try\"") >&5 + { (eval echo "$as_me:9268: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9828: \$? = $ac_status" >&5 + echo "$as_me:9271: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -9842,7 +9285,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:9845: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:9288: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -9876,7 +9319,7 @@ if test -n "$cf_cv_library_path_utf8" ; then if test "$cf_have_libdir" = no ; then test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:9879: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:9322: testing adding $cf_add_libdir to library-path ..." 1>&5 LDFLAGS="-L$cf_add_libdir $LDFLAGS" fi @@ -9892,87 +9335,48 @@ fi cf_ncuconfig_root=$use_ncurses echo "Looking for ${cf_ncuconfig_root}-config" - -if test -n "$ac_tool_prefix"; then - for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config - 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:9901: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_NCURSES_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$NCURSES_CONFIG"; then - ac_cv_prog_NCURSES_CONFIG="$NCURSES_CONFIG" # 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_NCURSES_CONFIG="$ac_tool_prefix$ac_prog" -echo "$as_me:9916: found $ac_dir/$ac_word" >&5 -break -done - -fi -fi -NCURSES_CONFIG=$ac_cv_prog_NCURSES_CONFIG -if test -n "$NCURSES_CONFIG"; then - echo "$as_me:9924: result: $NCURSES_CONFIG" >&5 -echo "${ECHO_T}$NCURSES_CONFIG" >&6 -else - echo "$as_me:9927: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$NCURSES_CONFIG" && break - done -fi -if test -z "$NCURSES_CONFIG"; then - ac_ct_NCURSES_CONFIG=$NCURSES_CONFIG - for ac_prog in ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-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:9940: checking for $ac_word" >&5 +echo "$as_me:9342: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_NCURSES_CONFIG+set}" = set; then +if test "${ac_cv_path_NCURSES_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -n "$ac_ct_NCURSES_CONFIG"; then - ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_ct_NCURSES_CONFIG" # Let the user override the test. -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=. - $as_executable_p "$ac_dir/$ac_word" || continue -ac_cv_prog_ac_ct_NCURSES_CONFIG="$ac_prog" -echo "$as_me:9955: found $ac_dir/$ac_word" >&5 -break + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_NCURSES_CONFIG="$ac_dir/$ac_word" + echo "$as_me:9359: found $ac_dir/$ac_word" >&5 + break +fi done + ;; +esac fi -fi -ac_ct_NCURSES_CONFIG=$ac_cv_prog_ac_ct_NCURSES_CONFIG -if test -n "$ac_ct_NCURSES_CONFIG"; then - echo "$as_me:9963: result: $ac_ct_NCURSES_CONFIG" >&5 -echo "${ECHO_T}$ac_ct_NCURSES_CONFIG" >&6 +NCURSES_CONFIG=$ac_cv_path_NCURSES_CONFIG + +if test -n "$NCURSES_CONFIG"; then + echo "$as_me:9370: result: $NCURSES_CONFIG" >&5 +echo "${ECHO_T}$NCURSES_CONFIG" >&6 else - echo "$as_me:9966: result: no" >&5 + echo "$as_me:9373: result: no" >&5 echo "${ECHO_T}no" >&6 fi - test -n "$ac_ct_NCURSES_CONFIG" && break + test -n "$NCURSES_CONFIG" && break done -test -n "$ac_ct_NCURSES_CONFIG" || ac_ct_NCURSES_CONFIG="none" - - NCURSES_CONFIG=$ac_ct_NCURSES_CONFIG -fi +test -n "$NCURSES_CONFIG" || NCURSES_CONFIG="none" if test "$NCURSES_CONFIG" != none ; then @@ -9981,7 +9385,7 @@ LIBS="`$NCURSES_CONFIG --libs` $LIBS" # even with config script, some packages use no-override for curses.h -echo "$as_me:9984: checking if we have identified curses headers" >&5 +echo "$as_me:9388: 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 @@ -9995,7 +9399,7 @@ for cf_header in \ curses.h do cat >conftest.$ac_ext <<_ACEOF -#line 9998 "configure" +#line 9402 "configure" #include "confdefs.h" #include <${cf_header}> int @@ -10007,16 +9411,16 @@ initscr(); tgoto("?", 0,0) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10010: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9414: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10013: \$? = $ac_status" >&5 + echo "$as_me:9417: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10016: \"$ac_try\"") >&5 + { (eval echo "$as_me:9420: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10019: \$? = $ac_status" >&5 + echo "$as_me:9423: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_header=$cf_header; break else @@ -10027,11 +9431,11 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:10030: result: $cf_cv_ncurses_header" >&5 +echo "$as_me:9434: 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:10034: error: No curses header-files found" >&5 + { { echo "$as_me:9438: error: No curses header-files found" >&5 echo "$as_me: error: No curses header-files found" >&2;} { (exit 1); exit 1; }; } fi @@ -10041,23 +9445,23 @@ fi for ac_header in $cf_cv_ncurses_header do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:10044: checking for $ac_header" >&5 +echo "$as_me:9448: 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 10050 "configure" +#line 9454 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:10054: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:9458: \"$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:10060: \$? = $ac_status" >&5 + echo "$as_me:9464: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -10076,7 +9480,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:10079: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:9483: 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 @@ -10129,7 +9533,7 @@ if test -n "$cf_cv_curses_dir/include/$cf_ncuhdr_root" ; then cf_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat >conftest.$ac_ext <<_ACEOF -#line 10132 "configure" +#line 9536 "configure" #include "confdefs.h" #include <stdio.h> int @@ -10141,16 +9545,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10144: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9548: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10147: \$? = $ac_status" >&5 + echo "$as_me:9551: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10150: \"$ac_try\"") >&5 + { (eval echo "$as_me:9554: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10153: \$? = $ac_status" >&5 + echo "$as_me:9557: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -10167,7 +9571,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:10170: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:9574: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -10184,7 +9588,7 @@ fi } -echo "$as_me:10187: checking for $cf_ncuhdr_root header in include-path" >&5 +echo "$as_me:9591: 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 @@ -10196,7 +9600,7 @@ else do cat >conftest.$ac_ext <<_ACEOF -#line 10199 "configure" +#line 9603 "configure" #include "confdefs.h" #include <$cf_header> @@ -10220,16 +9624,16 @@ printf("old\n"); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10223: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9627: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10226: \$? = $ac_status" >&5 + echo "$as_me:9630: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10229: \"$ac_try\"") >&5 + { (eval echo "$as_me:9633: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10232: \$? = $ac_status" >&5 + echo "$as_me:9636: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_h=$cf_header @@ -10244,14 +9648,14 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:10247: result: $cf_cv_ncurses_h" >&5 +echo "$as_me:9651: 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:10254: checking for $cf_ncuhdr_root include-path" >&5 +echo "$as_me:9658: 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 @@ -10391,7 +9795,7 @@ if test -n "$cf_incdir" ; then cf_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat >conftest.$ac_ext <<_ACEOF -#line 10394 "configure" +#line 9798 "configure" #include "confdefs.h" #include <stdio.h> int @@ -10403,16 +9807,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10406: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9810: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10409: \$? = $ac_status" >&5 + echo "$as_me:9813: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10412: \"$ac_try\"") >&5 + { (eval echo "$as_me:9816: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10415: \$? = $ac_status" >&5 + echo "$as_me:9819: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -10429,7 +9833,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:10432: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:9836: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -10450,7 +9854,7 @@ fi do cat >conftest.$ac_ext <<_ACEOF -#line 10453 "configure" +#line 9857 "configure" #include "confdefs.h" #include <$cf_header> @@ -10474,16 +9878,16 @@ printf("old\n"); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10477: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9881: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10480: \$? = $ac_status" >&5 + echo "$as_me:9884: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10483: \"$ac_try\"") >&5 + { (eval echo "$as_me:9887: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10486: \$? = $ac_status" >&5 + echo "$as_me:9890: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_h2=$cf_header @@ -10504,12 +9908,12 @@ rm -f conftest.$ac_objext conftest.$ac_ext CPPFLAGS="$cf_save2_CPPFLAGS" test "$cf_cv_ncurses_h2" != no && break done - test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:10507: error: not found" >&5 + test "$cf_cv_ncurses_h2" = no && { { echo "$as_me:9911: error: not found" >&5 echo "$as_me: error: not found" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:10512: result: $cf_cv_ncurses_h2" >&5 +echo "$as_me:9916: 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%/[^/]*$%%'` @@ -10542,7 +9946,7 @@ if test -n "$cf_1st_incdir" ; then cf_save_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat >conftest.$ac_ext <<_ACEOF -#line 10545 "configure" +#line 9949 "configure" #include "confdefs.h" #include <stdio.h> int @@ -10554,16 +9958,16 @@ printf("Hello") } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10557: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9961: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10560: \$? = $ac_status" >&5 + echo "$as_me:9964: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10563: \"$ac_try\"") >&5 + { (eval echo "$as_me:9967: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10566: \$? = $ac_status" >&5 + echo "$as_me:9970: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -10580,7 +9984,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext if test "$cf_have_incdir" = no ; then test -n "$verbose" && echo " adding $cf_add_incdir to include-path" 1>&6 -echo "${as_me:-configure}:10583: testing adding $cf_add_incdir to include-path ..." 1>&5 +echo "${as_me:-configure}:9987: testing adding $cf_add_incdir to include-path ..." 1>&5 CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" @@ -10623,7 +10027,7 @@ EOF ;; esac -echo "$as_me:10626: checking for terminfo header" >&5 +echo "$as_me:10030: 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 @@ -10641,7 +10045,7 @@ esac for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" do cat >conftest.$ac_ext <<_ACEOF -#line 10644 "configure" +#line 10048 "configure" #include "confdefs.h" #include <stdio.h> #include <${cf_cv_ncurses_header:-curses.h}> @@ -10656,16 +10060,16 @@ int x = auto_left_margin } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10659: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10063: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10662: \$? = $ac_status" >&5 + echo "$as_me:10066: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10665: \"$ac_try\"") >&5 + { (eval echo "$as_me:10069: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10668: \$? = $ac_status" >&5 + echo "$as_me:10072: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_term_header="$cf_test" @@ -10681,7 +10085,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:10684: result: $cf_cv_term_header" >&5 +echo "$as_me:10088: result: $cf_cv_term_header" >&5 echo "${ECHO_T}$cf_cv_term_header" >&6 # Set definitions to allow ifdef'ing to accommodate subdirectories @@ -10715,7 +10119,7 @@ cat >>confdefs.h <<\EOF #define NCURSES 1 EOF -echo "$as_me:10718: checking for ncurses version" >&5 +echo "$as_me:10122: 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 @@ -10741,10 +10145,10 @@ Autoconf "old" #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" - { (eval echo "$as_me:10744: \"$cf_try\"") >&5 + { (eval echo "$as_me:10148: \"$cf_try\"") >&5 (eval $cf_try) 2>&5 ac_status=$? - echo "$as_me:10747: \$? = $ac_status" >&5 + echo "$as_me:10151: \$? = $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%".*%%'` @@ -10754,7 +10158,7 @@ EOF else cat >conftest.$ac_ext <<_ACEOF -#line 10757 "configure" +#line 10161 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> @@ -10779,15 +10183,15 @@ int main() } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:10782: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10186: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10785: \$? = $ac_status" >&5 + echo "$as_me:10189: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:10787: \"$ac_try\"") >&5 + { (eval echo "$as_me:10191: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10790: \$? = $ac_status" >&5 + echo "$as_me:10194: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_version=`cat $cf_tempfile` @@ -10801,7 +10205,7 @@ fi rm -f $cf_tempfile fi -echo "$as_me:10804: result: $cf_cv_ncurses_version" >&5 +echo "$as_me:10208: 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 @@ -10813,7 +10217,7 @@ cf_nculib_root=$use_ncurses # to link gpm. cf_ncurses_LIBS="" cf_ncurses_SAVE="$LIBS" -echo "$as_me:10816: checking for Gpm_Open in -lgpm" >&5 +echo "$as_me:10220: 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 @@ -10821,7 +10225,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lgpm $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 10824 "configure" +#line 10228 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -10840,16 +10244,16 @@ Gpm_Open (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10843: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10247: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10846: \$? = $ac_status" >&5 + echo "$as_me:10250: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10849: \"$ac_try\"") >&5 + { (eval echo "$as_me:10253: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10852: \$? = $ac_status" >&5 + echo "$as_me:10256: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gpm_Gpm_Open=yes else @@ -10860,10 +10264,10 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:10863: result: $ac_cv_lib_gpm_Gpm_Open" >&5 +echo "$as_me:10267: 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:10866: checking for initscr in -lgpm" >&5 + echo "$as_me:10270: 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 @@ -10871,7 +10275,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lgpm $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 10874 "configure" +#line 10278 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -10890,16 +10294,16 @@ initscr (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10893: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10297: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10896: \$? = $ac_status" >&5 + echo "$as_me:10300: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10899: \"$ac_try\"") >&5 + { (eval echo "$as_me:10303: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10902: \$? = $ac_status" >&5 + echo "$as_me:10306: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gpm_initscr=yes else @@ -10910,7 +10314,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:10913: result: $ac_cv_lib_gpm_initscr" >&5 +echo "$as_me:10317: 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" @@ -10925,7 +10329,7 @@ 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:10928: checking for tgoto in -lmytinfo" >&5 + echo "$as_me:10332: 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 @@ -10933,7 +10337,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lmytinfo $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 10936 "configure" +#line 10340 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -10952,16 +10356,16 @@ tgoto (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10955: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10359: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10958: \$? = $ac_status" >&5 + echo "$as_me:10362: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10961: \"$ac_try\"") >&5 + { (eval echo "$as_me:10365: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10964: \$? = $ac_status" >&5 + echo "$as_me:10368: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_mytinfo_tgoto=yes else @@ -10972,7 +10376,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:10975: result: $ac_cv_lib_mytinfo_tgoto" >&5 +echo "$as_me:10379: 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" @@ -10991,13 +10395,13 @@ else eval 'cf_cv_have_lib_'$cf_nculib_root'=no' cf_libdir="" - echo "$as_me:10994: checking for initscr" >&5 + echo "$as_me:10398: 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 11000 "configure" +#line 10404 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char initscr (); below. */ @@ -11028,16 +10432,16 @@ f = initscr; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11031: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10435: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11034: \$? = $ac_status" >&5 + echo "$as_me:10438: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11037: \"$ac_try\"") >&5 + { (eval echo "$as_me:10441: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11040: \$? = $ac_status" >&5 + echo "$as_me:10444: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_initscr=yes else @@ -11047,18 +10451,18 @@ ac_cv_func_initscr=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:11050: result: $ac_cv_func_initscr" >&5 +echo "$as_me:10454: 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:11057: checking for initscr in -l$cf_nculib_root" >&5 + echo "$as_me:10461: 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 11061 "configure" +#line 10465 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int @@ -11070,25 +10474,25 @@ initscr() } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11073: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10477: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11076: \$? = $ac_status" >&5 + echo "$as_me:10480: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11079: \"$ac_try\"") >&5 + { (eval echo "$as_me:10483: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11082: \$? = $ac_status" >&5 + echo "$as_me:10486: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:11084: result: yes" >&5 + echo "$as_me:10488: 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:11091: result: no" >&5 +echo "$as_me:10495: result: no" >&5 echo "${ECHO_T}no" >&6 cf_search= @@ -11178,11 +10582,11 @@ cf_search="$cf_library_path_list $cf_search" for cf_libdir in $cf_search do - echo "$as_me:11181: checking for -l$cf_nculib_root in $cf_libdir" >&5 + echo "$as_me:10585: 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 11185 "configure" +#line 10589 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int @@ -11194,25 +10598,25 @@ initscr() } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11197: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10601: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11200: \$? = $ac_status" >&5 + echo "$as_me:10604: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11203: \"$ac_try\"") >&5 + { (eval echo "$as_me:10607: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11206: \$? = $ac_status" >&5 + echo "$as_me:10610: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:11208: result: yes" >&5 + echo "$as_me:10612: 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:11215: result: no" >&5 +echo "$as_me:10619: result: no" >&5 echo "${ECHO_T}no" >&6 LIBS="$cf_save_LIBS" fi @@ -11227,7 +10631,7 @@ fi eval 'cf_found_library=$cf_cv_have_lib_'$cf_nculib_root if test $cf_found_library = no ; then - { { echo "$as_me:11230: error: Cannot link $cf_nculib_root library" >&5 + { { echo "$as_me:10634: error: Cannot link $cf_nculib_root library" >&5 echo "$as_me: error: Cannot link $cf_nculib_root library" >&2;} { (exit 1); exit 1; }; } fi @@ -11235,7 +10639,7 @@ fi fi if test -n "$cf_ncurses_LIBS" ; then - echo "$as_me:11238: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 + echo "$as_me:10642: 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 @@ -11245,7 +10649,7 @@ echo $ECHO_N "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS.. fi done cat >conftest.$ac_ext <<_ACEOF -#line 11248 "configure" +#line 10652 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int @@ -11257,23 +10661,23 @@ initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11260: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10664: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11263: \$? = $ac_status" >&5 + echo "$as_me:10667: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11266: \"$ac_try\"") >&5 + { (eval echo "$as_me:10670: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11269: \$? = $ac_status" >&5 + echo "$as_me:10673: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - echo "$as_me:11271: result: yes" >&5 + echo "$as_me:10675: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -echo "$as_me:11276: result: no" >&5 +echo "$as_me:10680: result: no" >&5 echo "${ECHO_T}no" >&6 LIBS="$cf_ncurses_SAVE" fi @@ -11291,7 +10695,7 @@ fi else cf_wide_curses=no -echo "$as_me:11294: checking for extra include directories" >&5 +echo "$as_me:10698: 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 @@ -11317,11 +10721,11 @@ sunos3*|sunos4*) esac fi -echo "$as_me:11320: result: $cf_cv_curses_incdir" >&5 +echo "$as_me:10724: 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:11324: checking if we have identified curses headers" >&5 +echo "$as_me:10728: 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 @@ -11333,7 +10737,7 @@ for cf_header in \ curses.h ncurses/ncurses.h ncurses/curses.h do cat >conftest.$ac_ext <<_ACEOF -#line 11336 "configure" +#line 10740 "configure" #include "confdefs.h" #include <${cf_header}> int @@ -11345,16 +10749,16 @@ initscr(); tgoto("?", 0,0) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11348: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10752: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11351: \$? = $ac_status" >&5 + echo "$as_me:10755: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11354: \"$ac_try\"") >&5 + { (eval echo "$as_me:10758: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11357: \$? = $ac_status" >&5 + echo "$as_me:10761: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_header=$cf_header; break else @@ -11365,11 +10769,11 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:11368: result: $cf_cv_ncurses_header" >&5 +echo "$as_me:10772: 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:11372: error: No curses header-files found" >&5 + { { echo "$as_me:10776: error: No curses header-files found" >&5 echo "$as_me: error: No curses header-files found" >&2;} { (exit 1); exit 1; }; } fi @@ -11379,23 +10783,23 @@ fi for ac_header in $cf_cv_ncurses_header do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:11382: checking for $ac_header" >&5 +echo "$as_me:10786: 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 11388 "configure" +#line 10792 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:11392: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:10796: \"$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:11398: \$? = $ac_status" >&5 + echo "$as_me:10802: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -11414,7 +10818,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:11417: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:10821: 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 @@ -11424,7 +10828,7 @@ EOF fi done -echo "$as_me:11427: checking for terminfo header" >&5 +echo "$as_me:10831: 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 @@ -11442,7 +10846,7 @@ esac for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h" do cat >conftest.$ac_ext <<_ACEOF -#line 11445 "configure" +#line 10849 "configure" #include "confdefs.h" #include <stdio.h> #include <${cf_cv_ncurses_header:-curses.h}> @@ -11457,16 +10861,16 @@ int x = auto_left_margin } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11460: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10864: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11463: \$? = $ac_status" >&5 + echo "$as_me:10867: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11466: \"$ac_try\"") >&5 + { (eval echo "$as_me:10870: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11469: \$? = $ac_status" >&5 + echo "$as_me:10873: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_term_header="$cf_test" @@ -11482,7 +10886,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:11485: result: $cf_cv_term_header" >&5 +echo "$as_me:10889: result: $cf_cv_term_header" >&5 echo "${ECHO_T}$cf_cv_term_header" >&6 # Set definitions to allow ifdef'ing to accommodate subdirectories @@ -11511,7 +10915,7 @@ EOF ;; esac -echo "$as_me:11514: checking for ncurses version" >&5 +echo "$as_me:10918: 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 @@ -11537,10 +10941,10 @@ Autoconf "old" #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" - { (eval echo "$as_me:11540: \"$cf_try\"") >&5 + { (eval echo "$as_me:10944: \"$cf_try\"") >&5 (eval $cf_try) 2>&5 ac_status=$? - echo "$as_me:11543: \$? = $ac_status" >&5 + echo "$as_me:10947: \$? = $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%".*%%'` @@ -11550,7 +10954,7 @@ EOF else cat >conftest.$ac_ext <<_ACEOF -#line 11553 "configure" +#line 10957 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> @@ -11575,15 +10979,15 @@ int main() } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:11578: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10982: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11581: \$? = $ac_status" >&5 + echo "$as_me:10985: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:11583: \"$ac_try\"") >&5 + { (eval echo "$as_me:10987: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11586: \$? = $ac_status" >&5 + echo "$as_me:10990: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ncurses_version=`cat $cf_tempfile` @@ -11597,16 +11001,16 @@ fi rm -f $cf_tempfile fi -echo "$as_me:11600: result: $cf_cv_ncurses_version" >&5 +echo "$as_me:11004: 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:11606: checking if we have identified curses libraries" >&5 +echo "$as_me:11010: 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 11609 "configure" +#line 11013 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int @@ -11618,16 +11022,16 @@ initscr(); tgoto("?", 0,0) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11621: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11025: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11624: \$? = $ac_status" >&5 + echo "$as_me:11028: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11627: \"$ac_try\"") >&5 + { (eval echo "$as_me:11031: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11630: \$? = $ac_status" >&5 + echo "$as_me:11034: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else @@ -11636,13 +11040,13 @@ cat conftest.$ac_ext >&5 cf_result=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -echo "$as_me:11639: result: $cf_result" >&5 +echo "$as_me:11043: 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:11645: checking for tgoto in -lmytinfo" >&5 + echo "$as_me:11049: 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 @@ -11650,7 +11054,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lmytinfo $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 11653 "configure" +#line 11057 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -11669,16 +11073,16 @@ tgoto (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11672: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11076: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11675: \$? = $ac_status" >&5 + echo "$as_me:11079: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11678: \"$ac_try\"") >&5 + { (eval echo "$as_me:11082: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11681: \$? = $ac_status" >&5 + echo "$as_me:11085: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_mytinfo_tgoto=yes else @@ -11689,7 +11093,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:11692: result: $ac_cv_lib_mytinfo_tgoto" >&5 +echo "$as_me:11096: 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" @@ -11703,7 +11107,7 @@ hpux10.*) #(vi # term.h) for cur_colr if test "x$cf_cv_screen" = "xcurses_colr" then - echo "$as_me:11706: checking for initscr in -lcur_colr" >&5 + echo "$as_me:11110: 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 @@ -11711,7 +11115,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lcur_colr $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 11714 "configure" +#line 11118 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -11730,16 +11134,16 @@ initscr (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11733: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11137: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11736: \$? = $ac_status" >&5 + echo "$as_me:11140: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11739: \"$ac_try\"") >&5 + { (eval echo "$as_me:11143: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11742: \$? = $ac_status" >&5 + echo "$as_me:11146: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_cur_colr_initscr=yes else @@ -11750,7 +11154,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:11753: result: $ac_cv_lib_cur_colr_initscr" >&5 +echo "$as_me:11157: 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 @@ -11759,7 +11163,7 @@ if test $ac_cv_lib_cur_colr_initscr = yes; then else - echo "$as_me:11762: checking for initscr in -lHcurses" >&5 + echo "$as_me:11166: 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 @@ -11767,7 +11171,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lHcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 11770 "configure" +#line 11174 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -11786,16 +11190,16 @@ initscr (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11789: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11193: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11792: \$? = $ac_status" >&5 + echo "$as_me:11196: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11795: \"$ac_try\"") >&5 + { (eval echo "$as_me:11199: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11798: \$? = $ac_status" >&5 + echo "$as_me:11202: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_Hcurses_initscr=yes else @@ -11806,7 +11210,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:11809: result: $ac_cv_lib_Hcurses_initscr" >&5 +echo "$as_me:11213: 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 @@ -11846,7 +11250,7 @@ if test -n "/lib64" ; then if test "$cf_have_libdir" = no ; then test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:11849: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:11253: testing adding $cf_add_libdir to library-path ..." 1>&5 LDFLAGS="-L$cf_add_libdir $LDFLAGS" fi @@ -11875,7 +11279,7 @@ if test -n "/lib" ; then if test "$cf_have_libdir" = no ; then test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:11878: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:11282: testing adding $cf_add_libdir to library-path ..." 1>&5 LDFLAGS="-L$cf_add_libdir $LDFLAGS" fi @@ -11906,7 +11310,7 @@ if test -n "/lib" ; then if test "$cf_have_libdir" = no ; then test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:11909: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:11313: testing adding $cf_add_libdir to library-path ..." 1>&5 LDFLAGS="-L$cf_add_libdir $LDFLAGS" fi @@ -11941,7 +11345,7 @@ if test -n "/usr/5lib" ; then if test "$cf_have_libdir" = no ; then test -n "$verbose" && echo " adding $cf_add_libdir to library-path" 1>&6 -echo "${as_me:-configure}:11944: testing adding $cf_add_libdir to library-path ..." 1>&5 +echo "${as_me:-configure}:11348: testing adding $cf_add_libdir to library-path ..." 1>&5 LDFLAGS="-L$cf_add_libdir $LDFLAGS" fi @@ -11970,13 +11374,13 @@ if test ".$ac_cv_func_initscr" != .yes ; then # 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:11973: checking for tgoto" >&5 + echo "$as_me:11377: 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 11979 "configure" +#line 11383 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char tgoto (); below. */ @@ -12007,16 +11411,16 @@ f = tgoto; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12010: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11414: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12013: \$? = $ac_status" >&5 + echo "$as_me:11417: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12016: \"$ac_try\"") >&5 + { (eval echo "$as_me:11420: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12019: \$? = $ac_status" >&5 + echo "$as_me:11423: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_tgoto=yes else @@ -12026,16 +11430,16 @@ ac_cv_func_tgoto=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:12029: result: $ac_cv_func_tgoto" >&5 +echo "$as_me:11433: 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 otermcap termcap termlib unknown + 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:12038: checking for tgoto in -l$cf_term_lib" >&5 +echo "$as_me:11442: 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 @@ -12043,7 +11447,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-l$cf_term_lib $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 12046 "configure" +#line 11450 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -12062,16 +11466,16 @@ tgoto (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12065: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11469: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12068: \$? = $ac_status" >&5 + echo "$as_me:11472: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12071: \"$ac_try\"") >&5 + { (eval echo "$as_me:11475: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12074: \$? = $ac_status" >&5 + echo "$as_me:11478: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Lib=yes" else @@ -12082,7 +11486,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:12085: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "$as_me:11489: 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 @@ -12097,7 +11501,7 @@ fi 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:12100: checking for initscr in -l$cf_curs_lib" >&5 +echo "$as_me:11504: 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 @@ -12105,7 +11509,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-l$cf_curs_lib $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 12108 "configure" +#line 11512 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -12124,16 +11528,16 @@ initscr (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12127: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11531: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12130: \$? = $ac_status" >&5 + echo "$as_me:11534: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12133: \"$ac_try\"") >&5 + { (eval echo "$as_me:11537: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12136: \$? = $ac_status" >&5 + echo "$as_me:11540: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Lib=yes" else @@ -12144,23 +11548,23 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:12147: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "$as_me:11551: 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:12154: error: no curses library found" >&5 + test $cf_curs_lib = unknown && { { echo "$as_me:11558: 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:12160: checking if we can link with $cf_curs_lib library" >&5 + echo "$as_me:11564: 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 12163 "configure" +#line 11567 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int @@ -12172,16 +11576,16 @@ initscr() } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12175: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11579: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12178: \$? = $ac_status" >&5 + echo "$as_me:11582: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12181: \"$ac_try\"") >&5 + { (eval echo "$as_me:11585: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12184: \$? = $ac_status" >&5 + echo "$as_me:11588: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else @@ -12190,18 +11594,18 @@ cat conftest.$ac_ext >&5 cf_result=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - echo "$as_me:12193: result: $cf_result" >&5 + echo "$as_me:11597: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 - test $cf_result = no && { { echo "$as_me:12195: error: Cannot link curses library" >&5 + test $cf_result = no && { { echo "$as_me:11599: 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:12201: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 + echo "$as_me:11605: 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 12204 "configure" +#line 11608 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int @@ -12213,16 +11617,16 @@ initscr(); tgoto((char *)0, 0, 0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12216: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11620: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12219: \$? = $ac_status" >&5 + echo "$as_me:11623: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12222: \"$ac_try\"") >&5 + { (eval echo "$as_me:11626: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12225: \$? = $ac_status" >&5 + echo "$as_me:11629: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=no else @@ -12231,7 +11635,7 @@ cat conftest.$ac_ext >&5 LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 12234 "configure" +#line 11638 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int @@ -12243,16 +11647,16 @@ initscr() } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12246: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11650: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12249: \$? = $ac_status" >&5 + echo "$as_me:11653: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12252: \"$ac_try\"") >&5 + { (eval echo "$as_me:11656: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12255: \$? = $ac_status" >&5 + echo "$as_me:11659: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else @@ -12264,7 +11668,7 @@ 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:12267: result: $cf_result" >&5 + echo "$as_me:11671: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 fi fi @@ -12274,7 +11678,7 @@ fi cf_all_widgets=yes -echo "$as_me:12277: checking if you want extra dialogs" >&5 +echo "$as_me:11681: 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. @@ -12284,7 +11688,7 @@ if test "${enable_extras+set}" = set; then else enableval=yes fi; -echo "$as_me:12287: result: $enableval" >&5 +echo "$as_me:11691: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if test "$enableval" != no ; then cf_all_widgets=yes @@ -12292,7 +11696,7 @@ else cf_all_widgets=no fi -echo "$as_me:12295: checking if you want config-file support" >&5 +echo "$as_me:11699: 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. @@ -12302,7 +11706,7 @@ if test "${enable_rc_file+set}" = set; then else enableval=$cf_all_widgets fi; -echo "$as_me:12305: result: $enableval" >&5 +echo "$as_me:11709: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if test "$enableval" != no ; then EXTRAOBJS="$EXTRAOBJS rc\$o" @@ -12314,7 +11718,7 @@ else : fi -echo "$as_me:12317: checking if you want Xdialog-style dialogs" >&5 +echo "$as_me:11721: 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. @@ -12324,7 +11728,7 @@ if test "${enable_Xdialog+set}" = set; then else enableval=$cf_all_widgets fi; -echo "$as_me:12327: result: $enableval" >&5 +echo "$as_me:11731: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if test "$enableval" != no ; then EXTRAOBJS="$EXTRAOBJS calendar\$o fselect\$o timebox\$o" @@ -12336,7 +11740,7 @@ else : fi -echo "$as_me:12339: checking if you want the form dialog" >&5 +echo "$as_me:11743: 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. @@ -12346,7 +11750,7 @@ if test "${enable_form+set}" = set; then else enableval=$cf_all_widgets fi; -echo "$as_me:12349: result: $enableval" >&5 +echo "$as_me:11753: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if test "$enableval" != no ; then EXTRAOBJS="$EXTRAOBJS formbox\$o" @@ -12358,7 +11762,7 @@ else : fi -echo "$as_me:12361: checking if you want the gauge dialog" >&5 +echo "$as_me:11765: 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. @@ -12368,7 +11772,7 @@ if test "${enable_gauge+set}" = set; then else enableval=$cf_all_widgets fi; -echo "$as_me:12371: result: $enableval" >&5 +echo "$as_me:11775: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if test "$enableval" != no ; then EXTRAOBJS="$EXTRAOBJS guage\$o pause\$o prgbox\$o progressbox\$o" @@ -12380,7 +11784,7 @@ else : fi -echo "$as_me:12383: checking if you want the tailbox dialog" >&5 +echo "$as_me:11787: 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. @@ -12390,7 +11794,7 @@ if test "${enable_tailbox+set}" = set; then else enableval=$cf_all_widgets fi; -echo "$as_me:12393: result: $enableval" >&5 +echo "$as_me:11797: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if test "$enableval" != no ; then EXTRAOBJS="$EXTRAOBJS tailbox\$o" @@ -12402,7 +11806,7 @@ else : fi -echo "$as_me:12405: checking if you want the mixedform dialog" >&5 +echo "$as_me:11809: 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. @@ -12412,7 +11816,7 @@ if test "${enable_mixedform+set}" = set; then else enableval=$cf_all_widgets fi; -echo "$as_me:12415: result: $enableval" >&5 +echo "$as_me:11819: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if test "$enableval" != no ; then EXTRAOBJS="$EXTRAOBJS mixedform\$o" @@ -12424,7 +11828,7 @@ else : fi -echo "$as_me:12427: checking if you want the mixedgauge dialog" >&5 +echo "$as_me:11831: 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. @@ -12434,7 +11838,7 @@ if test "${enable_mixedgauge+set}" = set; then else enableval=$cf_all_widgets fi; -echo "$as_me:12437: result: $enableval" >&5 +echo "$as_me:11841: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if test "$enableval" != no ; then EXTRAOBJS="$EXTRAOBJS mixedgauge\$o" @@ -12446,7 +11850,7 @@ else : fi -echo "$as_me:12449: checking if you want the wide-curses features" >&5 +echo "$as_me:11853: 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. @@ -12456,7 +11860,7 @@ if test "${enable_widec+set}" = set; then else enableval=$cf_wide_curses fi; -echo "$as_me:12459: result: $enableval" >&5 +echo "$as_me:11863: result: $enableval" >&5 echo "${ECHO_T}$enableval" >&6 if test "$enableval" != no ; then cat >>confdefs.h <<\EOF @@ -12467,13 +11871,13 @@ else : fi -echo "$as_me:12470: checking for ANSI C header files" >&5 +echo "$as_me:11874: 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 12476 "configure" +#line 11880 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -12481,13 +11885,13 @@ else #include <float.h> _ACEOF -if { (eval echo "$as_me:12484: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:11888: \"$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:12490: \$? = $ac_status" >&5 + echo "$as_me:11894: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -12509,7 +11913,7 @@ 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 12512 "configure" +#line 11916 "configure" #include "confdefs.h" #include <string.h> @@ -12527,7 +11931,7 @@ 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 12530 "configure" +#line 11934 "configure" #include "confdefs.h" #include <stdlib.h> @@ -12548,7 +11952,7 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line 12551 "configure" +#line 11955 "configure" #include "confdefs.h" #include <ctype.h> #if ((' ' & 0x0FF) == 0x020) @@ -12574,15 +11978,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:12577: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11981: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12580: \$? = $ac_status" >&5 + echo "$as_me:11984: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:12582: \"$ac_try\"") >&5 + { (eval echo "$as_me:11986: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12585: \$? = $ac_status" >&5 + echo "$as_me:11989: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -12595,7 +11999,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi -echo "$as_me:12598: result: $ac_cv_header_stdc" >&5 +echo "$as_me:12002: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then @@ -12605,13 +12009,13 @@ EOF fi -echo "$as_me:12608: checking whether time.h and sys/time.h may both be included" >&5 +echo "$as_me:12012: 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 12614 "configure" +#line 12018 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/time.h> @@ -12627,16 +12031,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12630: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12034: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12633: \$? = $ac_status" >&5 + echo "$as_me:12037: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12636: \"$ac_try\"") >&5 + { (eval echo "$as_me:12040: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12639: \$? = $ac_status" >&5 + echo "$as_me:12043: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else @@ -12646,7 +12050,7 @@ ac_cv_header_time=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:12649: result: $ac_cv_header_time" >&5 +echo "$as_me:12053: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then @@ -12659,13 +12063,13 @@ 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:12662: checking for $ac_hdr that defines DIR" >&5 +echo "$as_me:12066: 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 12668 "configure" +#line 12072 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -12680,16 +12084,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12683: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12087: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12686: \$? = $ac_status" >&5 + echo "$as_me:12090: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12689: \"$ac_try\"") >&5 + { (eval echo "$as_me:12093: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12692: \$? = $ac_status" >&5 + echo "$as_me:12096: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else @@ -12699,7 +12103,7 @@ eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:12702: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:12106: 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 @@ -12712,7 +12116,7 @@ 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:12715: checking for opendir in -ldir" >&5 + echo "$as_me:12119: 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 @@ -12720,7 +12124,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldir $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 12723 "configure" +#line 12127 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -12739,16 +12143,16 @@ opendir (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12742: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12146: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12745: \$? = $ac_status" >&5 + echo "$as_me:12149: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12748: \"$ac_try\"") >&5 + { (eval echo "$as_me:12152: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12751: \$? = $ac_status" >&5 + echo "$as_me:12155: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dir_opendir=yes else @@ -12759,14 +12163,14 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:12762: result: $ac_cv_lib_dir_opendir" >&5 +echo "$as_me:12166: 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:12769: checking for opendir in -lx" >&5 + echo "$as_me:12173: 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 @@ -12774,7 +12178,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lx $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 12777 "configure" +#line 12181 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -12793,16 +12197,16 @@ opendir (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:12796: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12200: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:12799: \$? = $ac_status" >&5 + echo "$as_me:12203: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:12802: \"$ac_try\"") >&5 + { (eval echo "$as_me:12206: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12805: \$? = $ac_status" >&5 + echo "$as_me:12209: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_x_opendir=yes else @@ -12813,7 +12217,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:12816: result: $ac_cv_lib_x_opendir" >&5 +echo "$as_me:12220: 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" @@ -12824,23 +12228,23 @@ 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:12827: checking for $ac_header" >&5 +echo "$as_me:12231: 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 12833 "configure" +#line 12237 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:12837: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:12241: \"$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:12843: \$? = $ac_status" >&5 + echo "$as_me:12247: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -12859,7 +12263,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:12862: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:12266: 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 @@ -12869,7 +12273,7 @@ EOF fi done -echo "$as_me:12872: checking for term.h" >&5 +echo "$as_me:12276: 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 @@ -12890,7 +12294,7 @@ esac for cf_header in $cf_header_list do cat >conftest.$ac_ext <<_ACEOF -#line 12893 "configure" +#line 12297 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> @@ -12904,16 +12308,16 @@ WINDOW *x } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12907: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12311: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12910: \$? = $ac_status" >&5 + echo "$as_me:12314: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12913: \"$ac_try\"") >&5 + { (eval echo "$as_me:12317: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12916: \$? = $ac_status" >&5 + echo "$as_me:12320: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_term_header=$cf_header break @@ -12932,7 +12336,7 @@ no) for cf_header in ncurses/term.h ncursesw/term.h do cat >conftest.$ac_ext <<_ACEOF -#line 12935 "configure" +#line 12339 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> @@ -12950,16 +12354,16 @@ WINDOW *x } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:12953: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12357: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:12956: \$? = $ac_status" >&5 + echo "$as_me:12360: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:12959: \"$ac_try\"") >&5 + { (eval echo "$as_me:12363: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:12962: \$? = $ac_status" >&5 + echo "$as_me:12366: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_term_header=$cf_header break @@ -12974,7 +12378,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext esac fi -echo "$as_me:12977: result: $cf_cv_term_header" >&5 +echo "$as_me:12381: result: $cf_cv_term_header" >&5 echo "${ECHO_T}$cf_cv_term_header" >&6 case $cf_cv_term_header in #(vi @@ -12998,13 +12402,13 @@ EOF ;; esac -echo "$as_me:13001: checking return type of signal handlers" >&5 +echo "$as_me:12405: 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 13007 "configure" +#line 12411 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -13026,16 +12430,16 @@ int i; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13029: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12433: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13032: \$? = $ac_status" >&5 + echo "$as_me:12436: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13035: \"$ac_try\"") >&5 + { (eval echo "$as_me:12439: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13038: \$? = $ac_status" >&5 + echo "$as_me:12442: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else @@ -13045,7 +12449,7 @@ ac_cv_type_signal=int fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:13048: result: $ac_cv_type_signal" >&5 +echo "$as_me:12452: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <<EOF @@ -13070,13 +12474,13 @@ wctomb \ do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:13073: checking for $ac_func" >&5 +echo "$as_me:12477: 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 13079 "configure" +#line 12483 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -13107,16 +12511,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13110: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12514: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13113: \$? = $ac_status" >&5 + echo "$as_me:12517: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13116: \"$ac_try\"") >&5 + { (eval echo "$as_me:12520: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13119: \$? = $ac_status" >&5 + echo "$as_me:12523: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -13126,7 +12530,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:13129: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:12533: 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 @@ -13136,14 +12540,14 @@ EOF fi done -echo "$as_me:13139: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5 +echo "$as_me:12543: 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 13146 "configure" +#line 12550 "configure" #include "confdefs.h" #include <stdlib.h> @@ -13165,23 +12569,23 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13168: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12572: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13171: \$? = $ac_status" >&5 + echo "$as_me:12575: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13174: \"$ac_try\"") >&5 + { (eval echo "$as_me:12578: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13177: \$? = $ac_status" >&5 + echo "$as_me:12581: \$? = $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 13184 "configure" +#line 12588 "configure" #include "confdefs.h" #define _XOPEN_SOURCE_EXTENDED @@ -13203,16 +12607,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13206: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12610: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13209: \$? = $ac_status" >&5 + echo "$as_me:12613: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13212: \"$ac_try\"") >&5 + { (eval echo "$as_me:12616: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13215: \$? = $ac_status" >&5 + echo "$as_me:12619: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_need_xopen_extension=yes else @@ -13224,11 +12628,11 @@ 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:13227: result: $cf_cv_need_xopen_extension" >&5 +echo "$as_me:12631: 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" -echo "$as_me:13231: checking for unctrl.h" >&5 +echo "$as_me:12635: checking for unctrl.h" >&5 echo $ECHO_N "checking for unctrl.h... $ECHO_C" >&6 if test "${cf_cv_unctrl_header+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13249,7 +12653,7 @@ esac for cf_header in $cf_header_list do cat >conftest.$ac_ext <<_ACEOF -#line 13252 "configure" +#line 12656 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> @@ -13263,16 +12667,16 @@ WINDOW *x } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13266: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12670: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13269: \$? = $ac_status" >&5 + echo "$as_me:12673: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13272: \"$ac_try\"") >&5 + { (eval echo "$as_me:12676: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13275: \$? = $ac_status" >&5 + echo "$as_me:12679: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_unctrl_header=$cf_header break @@ -13286,13 +12690,13 @@ done case $cf_cv_unctrl_header in #(vi no) - { echo "$as_me:13289: WARNING: unctrl.h header not found" >&5 + { echo "$as_me:12693: WARNING: unctrl.h header not found" >&5 echo "$as_me: WARNING: unctrl.h header not found" >&2;} ;; esac fi -echo "$as_me:13295: result: $cf_cv_unctrl_header" >&5 +echo "$as_me:12699: result: $cf_cv_unctrl_header" >&5 echo "${ECHO_T}$cf_cv_unctrl_header" >&6 case $cf_cv_unctrl_header in #(vi @@ -13338,10 +12742,10 @@ do cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - echo "$as_me:13341: checking for ${cf_func}" >&5 + echo "$as_me:12745: checking for ${cf_func}" >&5 echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6 -echo "${as_me:-configure}:13344: testing ${cf_func} ..." 1>&5 +echo "${as_me:-configure}:12748: testing ${cf_func} ..." 1>&5 if eval "test \"\${cf_cv_func_$cf_func+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13350,7 +12754,7 @@ else eval cf_result='$ac_cv_func_'$cf_func if test ".$cf_result" != ".no"; then cat >conftest.$ac_ext <<_ACEOF -#line 13353 "configure" +#line 12757 "configure" #include "confdefs.h" #ifdef HAVE_XCURSES @@ -13382,16 +12786,16 @@ if (foo + 1234 > 5678) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13385: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12789: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13388: \$? = $ac_status" >&5 + echo "$as_me:12792: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13391: \"$ac_try\"") >&5 + { (eval echo "$as_me:12795: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13394: \$? = $ac_status" >&5 + echo "$as_me:12798: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_result=yes else @@ -13407,7 +12811,7 @@ fi # use the computed/retrieved cache-value: eval 'cf_result=$cf_cv_func_'$cf_func - echo "$as_me:13410: result: $cf_result" >&5 + echo "$as_me:12814: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 if test $cf_result != no; then cat >>confdefs.h <<EOF @@ -13417,13 +12821,13 @@ EOF fi done -echo "$as_me:13420: checking for start_color" >&5 +echo "$as_me:12824: 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 13426 "configure" +#line 12830 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char start_color (); below. */ @@ -13454,16 +12858,16 @@ f = start_color; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13457: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12861: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13460: \$? = $ac_status" >&5 + echo "$as_me:12864: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13463: \"$ac_try\"") >&5 + { (eval echo "$as_me:12867: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13466: \$? = $ac_status" >&5 + echo "$as_me:12870: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_start_color=yes else @@ -13473,7 +12877,7 @@ ac_cv_func_start_color=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:13476: result: $ac_cv_func_start_color" >&5 +echo "$as_me:12880: 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 @@ -13482,14 +12886,14 @@ EOF fi -echo "$as_me:13485: checking for chtype typedef" >&5 +echo "$as_me:12889: 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 13492 "configure" +#line 12896 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int @@ -13501,16 +12905,16 @@ chtype foo } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13504: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12908: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13507: \$? = $ac_status" >&5 + echo "$as_me:12911: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13510: \"$ac_try\"") >&5 + { (eval echo "$as_me:12914: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13513: \$? = $ac_status" >&5 + echo "$as_me:12917: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_chtype_decl=yes else @@ -13520,21 +12924,21 @@ cf_cv_chtype_decl=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:13523: result: $cf_cv_chtype_decl" >&5 +echo "$as_me:12927: 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:13530: checking if chtype is scalar or struct" >&5 + echo "$as_me:12934: 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 13537 "configure" +#line 12941 "configure" #include "confdefs.h" #include <${cf_cv_ncurses_header:-curses.h}> int @@ -13546,16 +12950,16 @@ chtype foo; long x = foo } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:13549: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12953: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:13552: \$? = $ac_status" >&5 + echo "$as_me:12956: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13555: \"$ac_try\"") >&5 + { (eval echo "$as_me:12959: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13558: \$? = $ac_status" >&5 + echo "$as_me:12962: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_chtype_type=scalar else @@ -13565,7 +12969,7 @@ cf_cv_chtype_type=struct fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:13568: result: $cf_cv_chtype_type" >&5 +echo "$as_me:12972: 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 @@ -13575,7 +12979,7 @@ EOF fi fi -echo "$as_me:13578: checking for wide alternate character set array" >&5 +echo "$as_me:12982: checking for wide alternate character set array" >&5 echo $ECHO_N "checking for wide alternate character set array... $ECHO_C" >&6 if test "${cf_cv_curses_wacs_map+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13585,7 +12989,7 @@ else for name in wacs_map _wacs_map __wacs_map _nc_wacs _wacs_char do cat >conftest.$ac_ext <<_ACEOF -#line 13588 "configure" +#line 12992 "configure" #include "confdefs.h" #ifndef _XOPEN_SOURCE_EXTENDED @@ -13601,16 +13005,16 @@ void *foo = &($name['k']) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13604: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13008: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13607: \$? = $ac_status" >&5 + echo "$as_me:13011: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13610: \"$ac_try\"") >&5 + { (eval echo "$as_me:13014: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13613: \$? = $ac_status" >&5 + echo "$as_me:13017: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_curses_wacs_map=$name break @@ -13621,14 +13025,14 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi -echo "$as_me:13624: result: $cf_cv_curses_wacs_map" >&5 +echo "$as_me:13028: result: $cf_cv_curses_wacs_map" >&5 echo "${ECHO_T}$cf_cv_curses_wacs_map" >&6 test "$cf_cv_curses_wacs_map" != unknown && cat >>confdefs.h <<EOF #define CURSES_WACS_ARRAY $cf_cv_curses_wacs_map EOF -echo "$as_me:13631: checking for wide alternate character constants" >&5 +echo "$as_me:13035: checking for wide alternate character constants" >&5 echo $ECHO_N "checking for wide alternate character constants... $ECHO_C" >&6 if test "${cf_cv_curses_wacs_symbols+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -13638,7 +13042,7 @@ cf_cv_curses_wacs_symbols=no if test "$cf_cv_curses_wacs_map" != unknown then cat >conftest.$ac_ext <<_ACEOF -#line 13641 "configure" +#line 13045 "configure" #include "confdefs.h" #ifndef _XOPEN_SOURCE_EXTENDED @@ -13655,16 +13059,16 @@ cchar_t *foo = WACS_PLUS; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13658: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13062: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13661: \$? = $ac_status" >&5 + echo "$as_me:13065: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13664: \"$ac_try\"") >&5 + { (eval echo "$as_me:13068: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13667: \$? = $ac_status" >&5 + echo "$as_me:13071: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_curses_wacs_symbols=yes else @@ -13674,7 +13078,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF -#line 13677 "configure" +#line 13081 "configure" #include "confdefs.h" #ifndef _XOPEN_SOURCE_EXTENDED @@ -13690,16 +13094,16 @@ cchar_t *foo = WACS_PLUS } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13693: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13097: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:13696: \$? = $ac_status" >&5 + echo "$as_me:13100: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13699: \"$ac_try\"") >&5 + { (eval echo "$as_me:13103: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:13702: \$? = $ac_status" >&5 + echo "$as_me:13106: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_curses_wacs_symbols=yes else @@ -13710,163 +13114,33 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi fi -echo "$as_me:13713: result: $cf_cv_curses_wacs_symbols" >&5 +echo "$as_me:13117: result: $cf_cv_curses_wacs_symbols" >&5 echo "${ECHO_T}$cf_cv_curses_wacs_symbols" >&6 test "$cf_cv_curses_wacs_symbols" != no && cat >>confdefs.h <<\EOF #define CURSES_WACS_SYMBOLS 1 EOF -for cf_func in wgetparent -do - -cf_tr_func=`echo "$cf_func" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - - echo "$as_me:13725: checking for ${cf_func}" >&5 -echo $ECHO_N "checking for ${cf_func}... $ECHO_C" >&6 - -echo "${as_me:-configure}:13728: 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 13737 "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}); -if (foo + 1234 > 5678) - ${cf_cv_main_return:-return}(foo); -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:13769: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:13772: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:13775: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:13778: \$? = $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:13794: 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 - -if test "x$cf_cv_func_wgetparent" != xyes -then - echo "$as_me:13806: checking if WINDOW has _parent member" >&5 -echo $ECHO_N "checking if WINDOW has _parent member... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 13809 "configure" -#include "confdefs.h" -#include <${cf_cv_ncurses_header:-curses.h}> -int -main () -{ -WINDOW *p = stdscr->_parent - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:13821: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:13824: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:13827: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:13830: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_window__parent=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_window__parent=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:13839: result: $cf_window__parent" >&5 -echo "${ECHO_T}$cf_window__parent" >&6 - if test "$cf_window__parent" = yes - then - cat >>confdefs.h <<\EOF -#define HAVE_WINDOW__PARENT 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:13853: checking for $ac_header" >&5 +echo "$as_me:13127: 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 13859 "configure" +#line 13133 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:13863: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:13137: \"$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:13869: \$? = $ac_status" >&5 + echo "$as_me:13143: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -13885,7 +13159,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:13888: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:13162: 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 @@ -13906,23 +13180,23 @@ else for ac_header in wait.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:13909: checking for $ac_header" >&5 +echo "$as_me:13183: 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 13915 "configure" +#line 13189 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:13919: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:13193: \"$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:13925: \$? = $ac_status" >&5 + echo "$as_me:13199: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -13941,7 +13215,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:13944: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:13218: 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 @@ -13954,23 +13228,23 @@ done for ac_header in waitstatus.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:13957: checking for $ac_header" >&5 +echo "$as_me:13231: 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 13963 "configure" +#line 13237 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:13967: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:13241: \"$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:13973: \$? = $ac_status" >&5 + echo "$as_me:13247: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -13989,7 +13263,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:13992: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:13266: 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 @@ -14011,14 +13285,14 @@ cf_wait_headers="$cf_wait_headers fi fi -echo "$as_me:14014: checking for union wait" >&5 +echo "$as_me:13288: 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 14021 "configure" +#line 13295 "configure" #include "confdefs.h" $cf_wait_headers int @@ -14034,16 +13308,16 @@ int x; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14037: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13311: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14040: \$? = $ac_status" >&5 + echo "$as_me:13314: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:14043: \"$ac_try\"") >&5 + { (eval echo "$as_me:13317: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14046: \$? = $ac_status" >&5 + echo "$as_me:13320: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_type_unionwait=no echo compiles ok w/o union wait 1>&5 @@ -14053,7 +13327,7 @@ else cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 14056 "configure" +#line 13330 "configure" #include "confdefs.h" $cf_wait_headers int @@ -14073,16 +13347,16 @@ union wait x; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14076: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13350: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14079: \$? = $ac_status" >&5 + echo "$as_me:13353: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:14082: \"$ac_try\"") >&5 + { (eval echo "$as_me:13356: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14085: \$? = $ac_status" >&5 + echo "$as_me:13359: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_type_unionwait=yes echo compiles ok with union wait and possibly macros too 1>&5 @@ -14097,7 +13371,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:14100: result: $cf_cv_type_unionwait" >&5 +echo "$as_me:13374: 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 @@ -14105,14 +13379,14 @@ EOF if test $cf_cv_type_unionwait = yes; then - echo "$as_me:14108: checking if union wait can be used as wait-arg" >&5 + echo "$as_me:13382: 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 14115 "configure" +#line 13389 "configure" #include "confdefs.h" $cf_wait_headers int @@ -14124,16 +13398,16 @@ union wait x; wait(&x) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14127: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13401: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14130: \$? = $ac_status" >&5 + echo "$as_me:13404: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14133: \"$ac_try\"") >&5 + { (eval echo "$as_me:13407: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14136: \$? = $ac_status" >&5 + echo "$as_me:13410: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_arg_union_wait=yes else @@ -14145,20 +13419,20 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:14148: result: $cf_cv_arg_union_wait" >&5 + echo "$as_me:13422: 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:14154: checking if union wait can be used as waitpid-arg" >&5 + echo "$as_me:13428: 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 14161 "configure" +#line 13435 "configure" #include "confdefs.h" $cf_wait_headers int @@ -14170,16 +13444,16 @@ union wait x; waitpid(0, &x, 0) } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14173: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13447: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14176: \$? = $ac_status" >&5 + echo "$as_me:13450: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14179: \"$ac_try\"") >&5 + { (eval echo "$as_me:13453: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14182: \$? = $ac_status" >&5 + echo "$as_me:13456: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_arg_union_waitpid=yes else @@ -14191,7 +13465,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi - echo "$as_me:14194: result: $cf_cv_arg_union_waitpid" >&5 + echo "$as_me:13468: 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 @@ -14199,14 +13473,14 @@ EOF fi -echo "$as_me:14202: checking if we must include wchar.h to declare mbstate_t" >&5 +echo "$as_me:13476: 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 14209 "configure" +#line 13483 "configure" #include "confdefs.h" #include <stdlib.h> @@ -14223,23 +13497,23 @@ mbstate_t state } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14226: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13500: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14229: \$? = $ac_status" >&5 + echo "$as_me:13503: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14232: \"$ac_try\"") >&5 + { (eval echo "$as_me:13506: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14235: \$? = $ac_status" >&5 + echo "$as_me:13509: \$? = $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 14242 "configure" +#line 13516 "configure" #include "confdefs.h" #include <stdlib.h> @@ -14257,16 +13531,16 @@ mbstate_t value } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:14260: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:13534: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:14263: \$? = $ac_status" >&5 + echo "$as_me:13537: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:14266: \"$ac_try\"") >&5 + { (eval echo "$as_me:13540: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14269: \$? = $ac_status" >&5 + echo "$as_me:13543: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_mbstate_t=yes else @@ -14278,7 +13552,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:14281: result: $cf_cv_mbstate_t" >&5 +echo "$as_me:13555: result: $cf_cv_mbstate_t" >&5 echo "${ECHO_T}$cf_cv_mbstate_t" >&6 if test "$cf_cv_mbstate_t" = yes ; then @@ -14301,7 +13575,7 @@ PACKAGE_CONFIG=dlg_config.h EXTRA_OUTPUT="$EXTRA_OUTPUT headers-sh:$srcdir/headers-sh.in" cat >conftest.$ac_ext <<_ACEOF -#line 14304 "configure" +#line 13578 "configure" #include "confdefs.h" #include <locale.h> int @@ -14313,16 +13587,16 @@ setlocale(LC_ALL, "") } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14316: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13590: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14319: \$? = $ac_status" >&5 + echo "$as_me:13593: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:14322: \"$ac_try\"") >&5 + { (eval echo "$as_me:13596: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14325: \$? = $ac_status" >&5 + echo "$as_me:13599: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\EOF #define HAVE_SETLOCALE 1 @@ -14335,7 +13609,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LD_RPATH_OPT= -echo "$as_me:14338: checking for an rpath option" >&5 +echo "$as_me:13612: 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 @@ -14351,7 +13625,7 @@ linux*|gnu*|k*bsd*-gnu) #(vi openbsd[2-9].*|mirbsd*) #(vi LD_RPATH_OPT="-Wl,-rpath," ;; -dragonfly*|freebsd*) #(vi +freebsd*) #(vi LD_RPATH_OPT="-rpath " ;; netbsd*) #(vi @@ -14366,17 +13640,17 @@ solaris2*) #(vi *) ;; esac -echo "$as_me:14369: result: $LD_RPATH_OPT" >&5 +echo "$as_me:13643: result: $LD_RPATH_OPT" >&5 echo "${ECHO_T}$LD_RPATH_OPT" >&6 case "x$LD_RPATH_OPT" in #(vi x-R*) - echo "$as_me:14374: checking if we need a space after rpath option" >&5 + echo "$as_me:13648: 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 14379 "configure" +#line 13653 "configure" #include "confdefs.h" int @@ -14388,16 +13662,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14391: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13665: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14394: \$? = $ac_status" >&5 + echo "$as_me:13668: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:14397: \"$ac_try\"") >&5 + { (eval echo "$as_me:13671: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14400: \$? = $ac_status" >&5 + echo "$as_me:13674: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_rpath_space=no else @@ -14407,13 +13681,13 @@ cf_rpath_space=yes fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$cf_save_LIBS" - echo "$as_me:14410: result: $cf_rpath_space" >&5 + echo "$as_me:13684: 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:14416: checking if rpath-hack should be disabled" >&5 +echo "$as_me:13690: checking if rpath-hack should be disabled" >&5 echo $ECHO_N "checking if rpath-hack should be disabled... $ECHO_C" >&6 # Check whether --enable-rpath-hack or --disable-rpath-hack was given. @@ -14430,21 +13704,21 @@ else cf_disable_rpath_hack=no fi; -echo "$as_me:14433: result: $cf_disable_rpath_hack" >&5 +echo "$as_me:13707: 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:14437: checking for updated LDFLAGS" >&5 +echo "$as_me:13711: 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:14440: result: maybe" >&5 + echo "$as_me:13714: 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:14447: checking for $ac_word" >&5 +echo "$as_me:13721: 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 @@ -14459,7 +13733,7 @@ for ac_dir in $ac_dummy; do 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:14462: found $ac_dir/$ac_word" >&5 +echo "$as_me:13736: found $ac_dir/$ac_word" >&5 break done @@ -14467,10 +13741,10 @@ fi fi cf_ldd_prog=$ac_cv_prog_cf_ldd_prog if test -n "$cf_ldd_prog"; then - echo "$as_me:14470: result: $cf_ldd_prog" >&5 + echo "$as_me:13744: result: $cf_ldd_prog" >&5 echo "${ECHO_T}$cf_ldd_prog" >&6 else - echo "$as_me:14473: result: no" >&5 + echo "$as_me:13747: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -14484,7 +13758,7 @@ test -n "$cf_ldd_prog" || cf_ldd_prog="no" cf_rpath_oops= cat >conftest.$ac_ext <<_ACEOF -#line 14487 "configure" +#line 13761 "configure" #include "confdefs.h" #include <stdio.h> int @@ -14496,16 +13770,16 @@ printf("Hello"); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:14499: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13773: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:14502: \$? = $ac_status" >&5 + echo "$as_me:13776: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:14505: \"$ac_try\"") >&5 + { (eval echo "$as_me:13779: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:14508: \$? = $ac_status" >&5 + echo "$as_me:13782: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort -u` cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[ ]/%/%' -e 's%/[^/][^/]*$%%' |sort -u` @@ -14533,7 +13807,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext then test -n "$verbose" && echo " ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src" 1>&6 -echo "${as_me:-configure}:14536: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5 +echo "${as_me:-configure}:13810: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5 LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" break @@ -14545,11 +13819,11 @@ echo "${as_me:-configure}:14536: testing ...adding -L$cf_rpath_dir/lib to LDFLAG test -n "$verbose" && echo " ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 -echo "${as_me:-configure}:14548: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 +echo "${as_me:-configure}:13822: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 test -n "$verbose" && echo " ...checking LDFLAGS $LDFLAGS" 1>&6 -echo "${as_me:-configure}:14552: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5 +echo "${as_me:-configure}:13826: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5 cf_rpath_dst= for cf_rpath_src in $LDFLAGS @@ -14586,7 +13860,7 @@ do then test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 -echo "${as_me:-configure}:14589: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 +echo "${as_me:-configure}:13863: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" fi @@ -14599,11 +13873,11 @@ LDFLAGS=$cf_rpath_dst test -n "$verbose" && echo " ...checked LDFLAGS $LDFLAGS" 1>&6 -echo "${as_me:-configure}:14602: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5 +echo "${as_me:-configure}:13876: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5 test -n "$verbose" && echo " ...checking LIBS $LIBS" 1>&6 -echo "${as_me:-configure}:14606: testing ...checking LIBS $LIBS ..." 1>&5 +echo "${as_me:-configure}:13880: testing ...checking LIBS $LIBS ..." 1>&5 cf_rpath_dst= for cf_rpath_src in $LIBS @@ -14640,7 +13914,7 @@ do then test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 -echo "${as_me:-configure}:14643: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 +echo "${as_me:-configure}:13917: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" fi @@ -14653,11 +13927,11 @@ LIBS=$cf_rpath_dst test -n "$verbose" && echo " ...checked LIBS $LIBS" 1>&6 -echo "${as_me:-configure}:14656: testing ...checked LIBS $LIBS ..." 1>&5 +echo "${as_me:-configure}:13930: testing ...checked LIBS $LIBS ..." 1>&5 test -n "$verbose" && echo " ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 -echo "${as_me:-configure}:14660: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 +echo "${as_me:-configure}:13934: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 fi @@ -14744,7 +14018,7 @@ 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:14747: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:14021: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -14920,7 +14194,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:14923: error: ambiguous option: $1 + { { echo "$as_me:14197: 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;} @@ -14939,7 +14213,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:14942: error: unrecognized option: $1 + -*) { { echo "$as_me:14216: 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;} @@ -14989,7 +14263,7 @@ do "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:14992: error: invalid argument: $ac_config_target" >&5 + *) { { echo "$as_me:14266: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -15086,8 +14360,6 @@ 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,@LINT@,$LINT,;t t -s,@LINT_OPTS@,$LINT_OPTS,;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 @@ -15163,7 +14435,6 @@ 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,@ac_ct_NCURSES_CONFIG@,$ac_ct_NCURSES_CONFIG,;t t s,@EXTRAOBJS@,$EXTRAOBJS,;t t s,@PACKAGE_PREFIX@,$PACKAGE_PREFIX,;t t s,@PACKAGE_CONFIG@,$PACKAGE_CONFIG,;t t @@ -15283,7 +14554,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:15286: creating $ac_file" >&5 + { echo "$as_me:14557: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -15301,7 +14572,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:15304: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:14575: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -15314,7 +14585,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:15317: error: cannot find input file: $f" >&5 + { { echo "$as_me:14588: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -15380,7 +14651,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:15383: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:14654: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -15391,7 +14662,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:15394: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:14665: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -15404,7 +14675,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:15407: error: cannot find input file: $f" >&5 + { { echo "$as_me:14678: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -15462,7 +14733,7 @@ cat >>$CONFIG_STATUS <<\EOF 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:15465: $ac_file is unchanged" >&5 + { echo "$as_me:14736: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ diff --git a/contrib/dialog/configure.in b/contrib/dialog/configure.in index ea2d562..2feac73 100644 --- a/contrib/dialog/configure.in +++ b/contrib/dialog/configure.in @@ -1,4 +1,4 @@ -dnl $Id: configure.in,v 1.68 2011/10/20 21:02:43 tom Exp $ +dnl $Id: configure.in,v 1.65 2011/06/27 10:42:27 tom Exp $ dnl Process this file with autoconf to produce a configure script. dnl --------------------------------------------------------------------------- dnl Copyright 1999-2010,2011 -- Thomas E. Dickey @@ -45,7 +45,6 @@ AC_PROG_GCC_TRADITIONAL AC_PROG_MAKE_SET AC_PROG_RANLIB AC_PROG_INSTALL -CF_PROG_LINT dnl needed for CF_WITH_LIBTOOL AC_CHECK_TOOL(AR, ar, ar) @@ -233,7 +232,6 @@ wget_wch \ AC_CHECK_FUNC(start_color,[AC_DEFINE(HAVE_COLOR)]) CF_CURSES_CHTYPE CF_CURSES_WACS_SYMBOLS -CF_CURSES_WGETPARENT CF_FUNC_WAIT CF_MBSTATE_T diff --git a/contrib/dialog/dialog.1 b/contrib/dialog/dialog.1 index 89f4918..8fd4de1 100644 --- a/contrib/dialog/dialog.1 +++ b/contrib/dialog/dialog.1 @@ -1,6 +1,6 @@ '\" t -.\" $Id: dialog.1,v 1.145 2012/07/03 08:32:33 tom Exp $ -.\" Copyright 2005-2011,2012 Thomas E. Dickey +.\" $Id: dialog.1,v 1.133 2011/06/29 09:39:29 tom Exp $ +.\" Copyright 2005-2010,2011 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 @@ -27,17 +27,16 @@ .ne 8 .IP .. -.de Ex -.RS +7 -.PP +.de EX +.RS +10 .nf .. -.de Ee +.de EE .fi .RE .. . -.TH \*D 1 "" "$Date: 2012/07/03 08:32:33 $" +.TH \*D 1 "" "$Date: 2011/06/29 09:39:29 $" .SH NAME \*p \- display dialog boxes from shell scripts .SH SYNOPSIS @@ -173,39 +172,39 @@ To compare the effects, use these: . .ES All three widgets visible, staircase effect, ordered 1,2,3: -.Ex -\*p \\ +.EX +\*p \ --begin 2 2 --yesno "" 0 0 \\ --and-widget --begin 4 4 --yesno "" 0 0 \\ --and-widget --begin 6 6 --yesno "" 0 0 -.Ee +.EE . .ES Only the last widget is left visible: -.Ex -\*p \\ +.EX +\*p \ --clear --begin 2 2 --yesno "" 0 0 \\ --and-widget --clear --begin 4 4 --yesno "" 0 0 \\ --and-widget --begin 6 6 --yesno "" 0 0 -.Ee +.EE . .ES All three widgets visible, staircase effect, ordered 3,2,1: -.Ex -\*p \\ +.EX +\*p \ --keep-window --begin 2 2 --yesno "" 0 0 \\ --and-widget --keep-window --begin 4 4 --yesno "" 0 0 \\ --and-widget --begin 6 6 --yesno "" 0 0 -.Ee +.EE . .ES First and third widget visible, staircase effect, ordered 3,1: -.Ex -\*p \\ +.EX +\*p \ --keep-window --begin 2 2 --yesno "" 0 0 \\ --and-widget --clear --begin 4 4 --yesno "" 0 0 \\ --and-widget --begin 6 6 --yesno "" 0 0 -.Ee +.EE .IP Note, if you want to restore original console colors and send your cursor home after the dialog program has exited, use the \fBclear\fR\ (1) @@ -238,7 +237,6 @@ occurrences of the given string, and to align the split data into columns. .IP "\fB--cr-wrap" Interpret embedded newlines in the dialog text as a newline on the screen. Otherwise, \fB\*p\fR will only wrap lines where needed to fit inside the text box. -.IP Even though you can control line breaks with this, \fB\*L\fR will still wrap any lines that are too long for the width of the box. Without cr-wrap, the layout of your text may be formatted to look nice @@ -272,25 +270,6 @@ If "\fB--nocancel\fP" or "\fB--visit-items\fP" are given those options overrides this, making the default button always "Yes" (internally the same as "OK"). . -.IP "\fB--default-button \fIstring" -Set the default (preselected) button in a widget. -By preselecting a button, -a script makes it possible for the user to simply press \fIEnter\fP -to proceed through a dialog with minimum interaction. -.IP -The option's value is the name of the button: -.IR ok , -.IR yes , -.IR cancel , -.IR no , -.IR help "\ or" -.IR extra . -.IP -Normally the first button in each widget is the default. -The first button shown is determined by the widget -together with the "\fB--nook\fP" and "\fB--nocancel\fP options. -If this option is not given, there is no default button assigned. -. .IP "\fB--default-item \fIstring" Set the default item in a checklist, form or menu box. Normally the first item in the box is the default. @@ -359,14 +338,13 @@ adding a column which is displayed in the bottom line of the screen, for the currently selected item. . .IP "\fB--keep-tite" -When built with \fBncurses\fP, -\fB\*p\fP normally checks to see if it is running in an \fBxterm\fP, +Normally \fB\*p\fP checks to see if it is running in an \fBxterm\fP, and in that case tries to suppress the initialization strings that would make it switch to the alternate screen. Switching between the normal and alternate screens is visually distracting in a script which runs \fB\*p\fP several times. -Use this option to allow \fB\*p\fP to use those initialization strings. +Use this option to allow \fB\*p\fP to use those initialization strings. . .IP "\fB--keep-window" Normally when \fB\*p\fR performs several \fBtailboxbg\fR widgets @@ -455,11 +433,6 @@ Prints \fB\*p\fR's version to \fB\*p\fP's output. This may be used alone, without other options. It does not cause \fBdialog\fP to exit by itself. . -.IP "\fB--quoted" -Normally \fB\*p\fP quotes the strings returned by checklist's -as well as the item-help text. -Use this option to quote all string results. -. .IP "\fB--scrollbar" For widgets holding a scrollable set of data, draw a scrollbar on its right-margin. @@ -483,8 +456,8 @@ Draw a shadow to the right and bottom of each dialog box. Use single-quoting as needed (and no quotes if unneeded) for the output of checklist's as well as the item-help text. If this option is not set, \fB\*p\fP uses double quotes around each item. -In either case, -\fB\*p\fP adds backslashes to make the output useful in shell scripts. +That requires occasional use of backslashes to make the output useful in +shell scripts. . .IP "\fB--size-err" Check the resulting size of a dialog box before trying to use it, @@ -528,11 +501,8 @@ The day, month, year values in this case are for the current local time. .IP "\fB--timeout \fIsecs" Timeout (exit with error code) if no user response within the given number of seconds. +This is overridden if the background "\fB--tailboxbg\fP is used. A timeout of zero seconds is ignored. -.IP -This option is ignored by the "\fB--pause\fP" widget. -It is also overridden if the background "\fB--tailboxbg\fP" option is used -to setup multiple concurrent widgets. . .IP "\fB--title \fItitle" Specifies a @@ -540,16 +510,11 @@ Specifies a string to be displayed at the top of the dialog box. . .IP "\fB--trace \fIfilename" -logs the command-line parameters, -keystrokes and other information to the given file. +logs the command-line parameters and +keystrokes to the given file. If \fBdialog\fP reads a configure file, it is logged as well. Piped input to the \fIgauge\fP widget is logged. Use control/T to log a picture of the current dialog window. -.PP -The \fB\*p\fR program handles some command-line parameters specially, -and removes them from the parameter list as they are processed. -For example, if the first option is \fB--trace\fP, -then that is processed (and removed) before \fB\*p\fR initializes the display. . .IP "\fB--trim" eliminate leading blanks, @@ -624,10 +589,8 @@ The initial on/off state of each entry is specified by On exit, a list of the \fItag\fP strings of those entries that are turned on will be printed on \fB\*p\fP's output. -.IP If the "\fB--separate-output\fP" option is not given, -the strings will be quoted as needed to make it simple for scripts to separate them. -By default, this uses double-quotes. +the strings will be quoted to make it simple for scripts to separate them. See the "\fB--single-quoted\fP" option, which modifies the quoting behavior. . . @@ -658,7 +621,7 @@ On exit, the contents of the text-entry window are written to \fB\*p\fP's output . .IP "\fB--editbox \fIfilepath height width\fR" The edit-box dialog displays a copy of the file. -You may edit it using +You may edit it using the \fIbackspace\fP, \fIdelete\fP and cursor keys to correct typing errors. It also recognizes pageup/pagedown. @@ -884,7 +847,7 @@ On exit, no text is written to \fB\*p\fP's output. Only an "OK" button is provided for input, but an ESC exit status may be returned. . -.IP "\fB--pause \fItext height width seconds\fR" +.IP "\fB\-\-pause \fItext height width seconds\fR" A \fBpause\fP box displays a meter along the bottom of the box. @@ -936,8 +899,7 @@ If only two parameters are given, this text is omitted. .IP "\fB--programbox \fIheight width" A \fBprogrambox\fP is very similar to a \fBprogressbox\fP. The only difference between a \fBprogram\fP box and a \fBprogress\fP -box is that a \fBprogram\fP box displays an \fBOK\fP button -(but only after the command completes). +box is that a \fBprogram\fP box displays an \fBOK\fP button. .IP This dialog box is used to display the piped output of a command. After the command completes, the user can press the \fIENTER\fP key so that @@ -951,16 +913,7 @@ If only two parameters are given, this text is omitted. .IP "\fB--progressbox \fItext height width" .IP "\fB--progressbox \fIheight width" A \fBprogressbox\fP is similar to an \fBtailbox\fP, -except that -.RS -.TP 3 -a) rather than displaying the contents of a file, -it displays the piped output of a command and -.TP 3 -b) it will exit when it reaches the end of the file -(there is no "OK" button). -.RE -.IP +except that it will exit when it reaches the end of the file. If three parameters are given, it displays the text under the title, delineated from the scrolling file's contents. If only two parameters are given, this text is omitted. @@ -1141,10 +1094,9 @@ can find, as stated in step 2 above. You can override or add to key bindings in \fB\*p\fP by adding to the configuration file. \fB\*L\fP's \fBbindkey\fP command maps single keys to its internal coding. -.Ex +.EX bindkey \fIwidget\fP \fIcurses_key\fP \fIdialog_key\fP -.Ee -.PP +.EE The \fIwidget\fP name can be "*" (all widgets), or specific widgets such as \fBtextbox\fP. Specific widget bindings override the "*" bindings. @@ -1159,82 +1111,6 @@ Finally, it allows any single character to be escaped with a backslash. \fB\*L\fP's internal keycode names correspond to the \fBDLG_KEYS_ENUM\fP type in \fBdlg_keys.h\fP, e.g., "HELP" from "DLGK_HELP". -.SS Widget Names -.PP -Some widgets (such as the formbox) have an area where fields can be edited. -Those are managed in a subwindow of the widget, and -may have separate keybindings from the main widget -because the subwindows are registered using a different name. -.TS -center tab(/) ; -l l l -l l l . -\fIWidget\fR/\fIWindow name\fR/\fISubwindow Name\fR -calendar/calendar -checklist/checklist -editbox/editbox/editbox2 -form/formbox/formfield -fselect/fselect/fselect2 -inputbox/inputbox/inputbox2 -menu/menubox/menu -msgbox/msgbox -pause/pause -progressbox/progressbox -radiolist/radiolist -tailbox/tailbox -textbox/textbox/searchbox -timebox/timebox -yesno/yesno -.TE -.PP -Some widgets are actually other widgets, -using internal settings to modify the behavior. -Those use the same widget name as the actual widget: -.TS -center tab(/) ; -l l -l l . -\fIWidget\fR/\fIActual Widget\fR -dselect/fselect -infobox/msgbox -inputmenu/menu -mixedform/form -passwordbox/inputbox -passwordform/form -prgbox/progressbox -programbox/progressbox -tailboxbg/tailbox -.TE -.SS Built-in Bindings -This manual page does not list the key bindings for each widget, -because that detailed information can be obtained by running \fB\*p\fP. -If you have set the \fB--trace\fP option, -\fB\*p\fP writes the key-binding information for each widget -as it is registered. -.SS Example -Normally \fB\*p\fP uses different keys for navigating between the buttons -and editing part of a dialog versus navigating within the editing part. -That is, tab (and back-tab) traverse buttons -(or between buttons and the editing part), -while arrow keys traverse fields within the editing part. -Tabs are also recognized as a special case for traversing between -widgets, e.g., when using multiple tailboxbg widgets. -.PP -Some users may wish to use the same key for traversing within the -editing part as for traversing between buttons. -The form widget is written to support this sort of redefinition of -the keys, by adding a special group in <code>dlgk_keys.h</code> -for "form" (left/right/next/prev). -Here is an example binding demonstrating how to do this: -.Ex -bindkey formfield TAB form_NEXT -bindkey formbox TAB form_NEXT -bindkey formfield BTAB form_prev -bindkey formbox BTAB form_prev -.Ee -.PP -That type of redefinition would not be useful in other widgets, -e.g., calendar, due to the potentially large number of fields to traverse. . .\" ************************************************************************ .SH ENVIRONMENT @@ -1273,7 +1149,7 @@ error (-1), ESC (255), Extra (3), Help (2), -Help with \fB--item-help\fP (2), +Help with --item-help (2), or OK (0). Normally shell scripts cannot distinguish between -1 and 255. .TP 15 @@ -1291,39 +1167,35 @@ of how to use the different box options and how they look. Just take a look into the directory \fBsamples/\fP of the source. .SH DIAGNOSTICS Exit status is subject to being overridden by environment variables. -The default values and corresponding environment variables -that can override them are: +Normally they are: .TP 5 0 if .BR \*p " is exited by pressing the " Yes " or " OK -button (DIALOG_OK). +button. .TP 5 1 if the .BR No " or " Cancel -button is pressed (DIALOG_CANCEL). +button is pressed. .TP 5 2 if the .BR Help -button is pressed (DIALOG_HELP). +button is pressed. .TP 5 3 if the .BR Extra -button is pressed (DIALOG_EXTRA). -.TP 5 +button is pressed. 4 if the -.BR Help -button is pressed (DIALOG_HELP), -or the \fB--item-help\fP option is set -when the \fBHelp\fP button is pressed (DIALOG_ITEM_HELP), +.BR Item Help +button is pressed. .TP 5 -1 -if errors occur inside \fB\*p\fP (DIALOG_ERROR) -or \fB\*p\fP is exited by pressing the \fIESC\fP key (DIALOG_ESC). +if errors occur inside \fB\*p\fP +or \fB\*p\fP is exited by pressing the \fIESC\fP key. . .\" ************************************************************************ .SH PORTABILITY @@ -1398,8 +1270,7 @@ Its documentation claims .sp .nf whiptail(1) is a lightweight replacement for \*p(1), -to provide dialog boxes for shell scripts. -It is built on the +to provide dialog boxes for shell scripts. It is built on the newt windowing library rather than the ncurses library, allowing it to be smaller in embedded enviroments such as installers, rescue disks, etc. @@ -1427,7 +1298,7 @@ but oddly cites only \fB\*p\fP versions up to 0.4 (1996) as a source. That is, its manpage refers to features which were borrowed from more recent versions of \fB\*p\fP, e.g., the \fB--gauge\fP and \fB--password\fP boxes, -as well as options such as \fB--separate-output\fP (2008). +as well as options such as \fB-separate-output\fP (2008). Somewhat humorously, one may note that the \fBpopt\fP feature (undocumented in its manpage) of using a "--" as an escape was documented in \fB\*p\fP's manpage about diff --git a/contrib/dialog/dialog.3 b/contrib/dialog/dialog.3 index 737b577..62938af 100644 --- a/contrib/dialog/dialog.3 +++ b/contrib/dialog/dialog.3 @@ -1,5 +1,5 @@ -.\" $Id: dialog.3,v 1.76 2012/07/03 08:22:10 tom Exp $ -.\" Copyright 2005-2011,2012 Thomas E. Dickey +.\" $Id: dialog.3,v 1.68 2011/06/29 09:07:36 tom Exp $ +.\" Copyright 2005-2010,2011 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 @@ -38,7 +38,7 @@ .de bP .IP \(bu 4 .. -.TH \*D 3 "" "$Date: 2012/07/03 08:22:10 $" +.TH \*D 3 "" "$Date: 2011/06/29 09:07:36 $" .SH NAME \*l \- widgets and utilities for the \*p program .SH SYNOPSIS @@ -108,11 +108,6 @@ are designed for use by the calling application while variables beginning with "\fIdlg_\fP" are intended for lower levels, e.g., by the \fB\*l\fP library. .\" --------------------------------------------------------------------------- -.IP \fIDIALOG_STATE.all_subwindows -This is a linked list of all subwindows created by the library. -The \fBdlg_del_window\fP function uses this -to free storage for subwindows when deleting a window. -.\" --------------------------------------------------------------------------- .IP \fIDIALOG_STATE.all_windows This is a linked list of all windows created by the library. The \fBdlg_del_window\fP function uses this to locate windows which @@ -295,9 +290,6 @@ bright red. Restore normal settings with "\\Zn". .\" --------------------------------------------------------------------------- .IP \fIDIALOG_VARS.column_separator -This corresponds to the command-line option "\fB--column-separator\fP". -\fB\*L\fP splits data for radio/checkboxes and menus on the -occurrences of the given string, and aligns the split data into columns. .\" --------------------------------------------------------------------------- .IP \fIDIALOG_VARS.cr_wrap This corresponds to the command-line option "\fB--cr-wrap\fP". @@ -315,16 +307,11 @@ This corresponds to the command-line option "\fB--date-format\fP \fIstring\fP". If the host provides \fBstrftime\fP, and the value is nonnull, the calendar widget uses this to format its output. .\" --------------------------------------------------------------------------- -.IP \fIDIALOG_VARS.default_button -This is set by the command-line option "\fB--default-button\fP. -It is used by \fBdlg_default_button\fP. -.\" --------------------------------------------------------------------------- .IP \fIDIALOG_VARS.default_item This corresponds to the command-line option "\fB--default-item\fP \fIstring\fP". The given string is used as the default item in a checklist, form or menu box. Normally the first item in the box is the default. -.\" --------------------------------------------------------------------------- .IP \fIDIALOG_VARS.defaultno This corresponds to the command-line option "\fB--defaultno\fP". If true, @@ -490,8 +477,6 @@ Note that \fB\*p\fR will still wrap text, subject to the \fB--cr-wrap\fR option. .\" --------------------------------------------------------------------------- .IP \fIDIALOG_VARS.nook -This corresponds to the command-line option "\fB--nook\fP. -\fB\*L\fP will suppress the "ok" (or "yes") button from the widget. .\" --------------------------------------------------------------------------- .IP \fIDIALOG_VARS.ok_label This corresponds to the command-line option "\fB--ok-label\fP \fIstring\fP". @@ -503,7 +488,6 @@ If true, each widget prints its size to \fB\*p\fP's output when it is invoked. .\" --------------------------------------------------------------------------- .IP \fIDIALOG_VARS.quoted -This corresponds to the command-line option "\fB--quoted\fP. .\" --------------------------------------------------------------------------- .IP \fIDIALOG_VARS.separate_output This corresponds to the command-line option "\fB--separate-output\fP". @@ -517,9 +501,8 @@ If true, Use single-quoting as needed (and no quotes if unneeded) for the output of checklist's as well as the item-help text. If this option is not set, \fB\*p\fP uses double quotes around each item. -The latter requires occasional use of backslashes to make the output useful in +That requires occasional use of backslashes to make the output useful in shell scripts. -.\" --------------------------------------------------------------------------- .IP \fIDIALOG_VARS.size_err This corresponds to the command-line option "\fB--size-err\fP". If true, @@ -935,8 +918,7 @@ If zero, the height is based on the screen size. .B int \fIwidth is the desired width of the box. If zero, the height is based on the screen size. -.TP 5 -.B int \fIpercent +.IP percent is the percentage to show in the progress bar. .TP 5 .B int \fIitem_no @@ -1211,9 +1193,6 @@ function to call when input ends, e.g., to free caller's additional data. .TP 5 .B dlg_add_quoted Add a quoted string to the result buffer (see \fBdlg_add_result\fP). -If no quotes are necessary, none are used. -If \fBdialog_vars.single_quoted\fR is set, single-quotes are used. -Otherwise, double-quotes are used. .RS .TP 5 .B char * \fIstring @@ -1222,7 +1201,7 @@ is the string to add. .\" --------------------------------------------------------------------------- .TP 5 .B dlg_add_result -Add a string to the result buffer \fBdialog_vars.input_result\fP. +Add a quoted string to the result buffer \fBdialog_vars.input_result\fP. .RS .TP 5 .B char * \fIstring @@ -1297,10 +1276,6 @@ is the percentage to show in the progress bar. returns its parameter transformed to the corresponding "+" or "-", etc. for the line-drawing characters used in \fB\*p\fP. If the parameter is not a line-drawing or other special character such as ACS_DARROW, it returns 0. -.RS -.TP 5 -.B chtype \fIch -is the parameter, usually one of the \fBACS_\fP\fIxxx\fP constants. .RE .\" --------------------------------------------------------------------------- .TP 5 @@ -1362,13 +1337,13 @@ is the name of the file. .TP 5 .B int * \fIheight is the nominal height. -If it is -1, use the screen's height (after subtracting \fBdialog_vars.begin_y\fP -if \fBdialog_vars.begin_set\fP is true). +If it is -1, use the screen's height after subtracting \fBdialog_vars.begin_y\fP +if \fBdialog_vars.begin_set\fP is true. .TP 5 -.B int * \fIwidth +.B int \fI*width is the nominal width. -If it is -1, use the screen's width (after subtracting \fBdialog_vars.begin_x\fP -if \fBdialog_vars.begin_set\fP is true). +If it is -1, use the screen's width after subtracting \fBdialog_vars.begin_x\fP +if \fBdialog_vars.begin_set\fP is true. .TP 5 .B int \fIboxlines is the number of lines to reserve on the screen for drawing boxes. @@ -1385,7 +1360,7 @@ this calls \fBbeep\fP once and sets .\" --------------------------------------------------------------------------- .TP 5 .B dlg_boxchar -returns its \fBchtype\fP parameter transformed as follows: +returns its parameter transformed as follows: .RS .TP 3 .B - @@ -1710,18 +1685,6 @@ is the string to measure. .RE .\" --------------------------------------------------------------------------- .TP 5 -.B dlg_count_real_columns -Returns the number of columns used for a string, -accounting for "\\Z" sequences which can be used for -coloring the text if \fBdialog_vars.colors\fP is set. -This is not necessarily the number of bytes in a string. -.RS -.TP 5 -.B const char * \fIstring -is the string to measure. -.RE -.\" --------------------------------------------------------------------------- -.TP 5 .B dlg_count_wchars Returns the number of wide-characters in the string. .RS @@ -1756,13 +1719,6 @@ is the window's width .RE .\" --------------------------------------------------------------------------- .TP 5 -.B dlg_default_button -If \fBdialog_vars.default_button\fP is positive, -return the button-index for that button code, -using \fBdlg_ok_buttoncode\fP to test indices starting with zero. -Otherwise (or if no match was found for the button code), return zero. -.\" --------------------------------------------------------------------------- -.TP 5 .B dlg_default_formitem If \fBdialog_vars.default_item\fP is not null, find that name by matching the \fIname\fP field in the list of form \fIitems\fP. @@ -1874,34 +1830,12 @@ is the window's border attribute. Draw a partial box at the bottom of a window, e.g., to surround a row of buttons. It is designed to merge with an existing box around -the whole window (see \fBdlg_draw_box\fP), -so it uses tee-elements rather than corner-elements -on the top corners of this box. -.RS -.TP 5 -.B WINDOW * \fIwin -is the window to update. -.RE -.\" --------------------------------------------------------------------------- -.TP 5 -.B dlg_draw_bottom_box2 -Draw a partial box at the bottom of a window, -e.g., to surround a row of buttons. -It is designed to merge with an existing box around -the whole window (see \fBdlg_draw_box2\fP), -so it uses tee-elements rather than corner-elements +the whole window, so it uses tee-elements rather than corner-elements on the top corners of this box. .RS .TP 5 .B WINDOW * \fIwin is the window to update. -.B chtype \fIon_left -is used to color the upper/left edges of the box, i.e., the tee-element and -horizontal line -.B chtype \fIon_right -is used to color the right edge of the box, i.e., the tee-element -.B chtype \fIon_inside -is used to fill-color the inside of the box .RE .\" --------------------------------------------------------------------------- .TP 5 @@ -1933,36 +1867,6 @@ is used to color the upper/left edges. .RE .\" --------------------------------------------------------------------------- .TP 5 -.B dlg_draw_box2 -Draw a rectangular box with line drawing characters. -.RS -.TP 5 -.B WINDOW * \fIwin -is the window to update. -.TP 5 -.B int \fIy -is the top row of the box. -.TP 5 -.B int \fIx -is the left column of the box. -.TP 5 -.B int \fIheight -is the height of the box. -.TP 5 -.B int \fIwidth -is the width of the box. -.TP 5 -.B chtype \fIboxchar -is used to fill-color for the box contents. -.TP 5 -.B chtype \fIborderchar -is used to color the upper/left edges. -.TP 5 -.B chtype \fIborderchar2 -is used to color the right/lower edges. -.RE -.\" --------------------------------------------------------------------------- -.TP 5 .B dlg_draw_buttons Print a list of buttons at the given position. .RS @@ -2088,27 +1992,6 @@ is the title string to display at the top of the widget. .RE .\" --------------------------------------------------------------------------- .TP 5 -.B dlg_dummy_menutext -This is a utility function which supports the \fB--inputmenu\fP option of -the \fB\*p\fP program. -If \fBdialog_vars.input_menu\fP is set, \fBdialog_menu\fP passes this -pointer to \fBdlg_menu\fP as the \fIrename_menutext\fP parameter. -Otherwise, it passes \fBdlg_dummy_menutext\fP. -.IP -The function should only return \fBDLG_EXIT_ERROR\fP. -.RS -.TP 5 -.B DIALOG_LISTITEM * \fIitems -is the list of menu items -.TP 5 -.B int \fIcurrent -is the index of the currently-selected item -.TP 5 -.B char * \fInewtext -is the updated text for the menu item -.RE -.\" --------------------------------------------------------------------------- -.TP 5 .B dlg_dump_keys Write all user-defined key-bindings to the given stream, e.g., as part of \fBdlg_create_rc\fP. @@ -2119,20 +2002,6 @@ is the stream on which to write the bindings. .RE .\" --------------------------------------------------------------------------- .TP 5 -.B dlg_dump_window_keys -Write all user-defined key-bindings to the given stream, -e.g., as part of \fBdlg_create_rc\fP. -.RS -.TP 5 -.B FILE * \fIfp -is the stream on which to write the bindings. -.TP 5 -.B WINDOW * \fIwin -is the window for which bindings should be dumped. -If it is null, then only built-in bindings are dumped. -.RE -.\" --------------------------------------------------------------------------- -.TP 5 .B dlg_eat_argv Remove one or more items from an argument vector. .RS @@ -2547,10 +2416,6 @@ The widget sets the referenced location to the index of the current display item (cursor) when it returns. .TP 5 .B DIALOG_INPUTMENU \fIrename_menutext -If this is not \fBdlg_dummy_menutext\fP, -the widget acts like an \fIinputmenu\fP widget, -providing an extra "Rename" button, -which activates an edit feature on the selected menu item. .RE .\" --------------------------------------------------------------------------- .TP 5 @@ -3033,35 +2898,11 @@ is the binding table Remove a callback. .RS .TP 5 -.B DIALOG_CALLBACK * \fIp +.B DIALOG_CALLBACK \fI* p contains the callback information. .RE .\" --------------------------------------------------------------------------- .TP 5 -.B dlg_renamed_menutext -This is a utility function which supports the \fB--inputmenu\fP option of -the \fB\*p\fP program. -If \fBdialog_vars.input_menu\fP is set, \fBdialog_menu\fP passes this -pointer to \fBdlg_menu\fP as the \fIrename_menutext\fP parameter. -Otherwise, it passes \fBdlg_dummy_menutext\fP. -.IP -The function should add "RENAMED" to \fBdialog_vars.input_result\fP , -followed by the menu item's name and the \fInewtext\fP value -(with a space separating the three items), -and return \fBDLG_EXIT_EXTRA\fP. -.RS -.TP 5 -.B DIALOG_LISTITEM * \fIitems -is the list of menu items -.TP 5 -.B int \fIcurrent -is the index of the currently-selected item -.TP 5 -.B char * \fInewtext -is the updated text for the menu item -.RE -.\" --------------------------------------------------------------------------- -.TP 5 .B dlg_restore_vars Restore \fB\*p\fP's variables from the given variable (see \fBdialog_save_vars\fP). .RS @@ -3174,10 +3015,10 @@ is the string to duplicate compare two strings, ignoring case. .RS .TP 5 -.B const char * \fIa +.B const char \fI* a is one string .TP 5 -.B const char * \fIb +.B const char \fI* b is the other string .RE .\" --------------------------------------------------------------------------- diff --git a/contrib/dialog/dialog.c b/contrib/dialog/dialog.c index 249eaac..44a16db 100644 --- a/contrib/dialog/dialog.c +++ b/contrib/dialog/dialog.c @@ -1,9 +1,9 @@ /* - * $Id: dialog.c,v 1.202 2012/07/01 20:20:39 tom Exp $ + * $Id: dialog.c,v 1.193 2011/06/29 09:10:56 tom Exp $ * * cdialog - Display simple dialog boxes from shell scripts * - * Copyright 2000-2011,2012 Thomas E. Dickey + * Copyright 2000-2010,2011 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 @@ -57,7 +57,6 @@ typedef enum { ,o_cr_wrap ,o_create_rc ,o_date_format - ,o_default_button ,o_default_item ,o_defaultno ,o_dselect @@ -202,7 +201,6 @@ static const Options options[] = { { "cr-wrap", o_cr_wrap, 1, "" }, { "create-rc", o_create_rc, 1, NULL }, { "date-format", o_date_format, 1, "<str>" }, - { "default-button", o_default_button, 1, "<str>" }, { "default-item", o_default_item, 1, "<str>" }, { "defaultno", o_defaultno, 1, "" }, { "dselect", o_dselect, 2, "<directory> <height> <width>" }, @@ -433,12 +431,6 @@ unescape_argv(int *argcp, char ***argvp) dialog_argv = (*argvp); } -#define OptionChars "\ -0123456789\ --\ -abcdefghijklmnopqrstuvwxyz\ -" - /* * Check if the given string from main's argv is an option. */ @@ -457,11 +449,7 @@ isOption(const char *arg) } } } else if (!strncmp(arg, "--", (size_t) 2) && isalpha(UCH(arg[2]))) { - if (strlen(arg) == strspn(arg, OptionChars)) { - result = TRUE; - } else { - dlg_exiterr("Invalid option \"%s\"", arg); - } + result = TRUE; } } return result; @@ -471,19 +459,17 @@ static eOptions lookupOption(const char *name, int pass) { unsigned n; - eOptions result = o_unknown; 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)) { - result = options[n].code; - break; + return options[n].code; } } } - return result; + return o_unknown; } static void @@ -699,7 +685,9 @@ 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], @@ -707,6 +695,7 @@ call_checklist(CALLARGS) numeric_arg(av, 3), numeric_arg(av, 4), tags, av + 5, FLAG_CHECK); + dialog_vars.quoted = save_quoted; return code; } @@ -1063,43 +1052,6 @@ optionValue(char **argv, int *num) return result; } -/* Return exit-code for a named button */ -static int -button_code(const char *name) -{ - /* *INDENT-OFF* */ - static struct { - const char *name; - int code; - } table[] = { - { "ok", DLG_EXIT_OK }, - { "yes", DLG_EXIT_OK }, - { "cancel", DLG_EXIT_CANCEL }, - { "no", DLG_EXIT_CANCEL }, - { "help", DLG_EXIT_HELP }, - { "extra", DLG_EXIT_EXTRA }, - }; - /* *INDENT-ON* */ - - int code = DLG_EXIT_ERROR; - size_t i; - - for (i = 0; i < (sizeof(table) / sizeof(table[0])); i++) { - if (!dlg_strcmp(name, table[i].name)) { - code = table[i].code; - break; - } - } - - if (code == DLG_EXIT_ERROR) { - char temp[80]; - sprintf(temp, "Button name \"%.20s\" unknown", name); - Usage(temp); - } - - return code; -} - /* * Print parts of a message */ @@ -1163,7 +1115,7 @@ Help(void) static const char *const tbl_1[] = { "cdialog (ComeOn Dialog!) version %s", - "Copyright 2000-2011,2012 Thomas E. Dickey", + "Copyright 2000-2008,2011 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.", "", @@ -1227,29 +1179,6 @@ Help(void) dlg_exit(DLG_EXIT_OK); } -#ifdef HAVE_DLG_TRACE -/* - * Only the first call to dlg_trace will open a trace file. But each time - * --trace is parsed, we show the whole parameter list as it is at that moment, - * counting discarded parameters. The only way to capture the whole parameter - * list is if --trace is the first option. - */ -static void -process_trace_option(char **argv, int *offset) -{ - int j; - - if (dialog_state.trace_output == 0) - dlg_trace(optionString(argv, offset)); - - dlg_trace_msg("# Parameters:\n"); - for (j = 0; argv[j] != 0; ++j) { - dlg_trace_msg("# argv[%d] = %s\n", j, argv[j]); - } - *offset += 1; -} -#endif - /* * "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 @@ -1258,12 +1187,12 @@ process_trace_option(char **argv, int *offset) static int process_common_options(int argc, char **argv, int offset, bool output) { +#ifdef HAVE_DLG_TRACE + int n; +#endif bool done = FALSE; - dlg_trace_msg("# process_common_options, offset %d\n", offset); - while (offset < argc && !done) { /* Common options */ - dlg_trace_msg("#\targv[%d] = %s\n", offset, argv[offset]); switch (lookupOption(argv[offset], 1)) { case o_title: dialog_vars.title = optionString(argv, &offset); @@ -1321,11 +1250,6 @@ process_common_options(int argc, char **argv, int offset, bool output) break; case o_defaultno: dialog_vars.defaultno = TRUE; - dialog_vars.default_button = DLG_EXIT_CANCEL; - break; - case o_default_button: - dialog_vars.default_button = button_code(optionString(argv, &offset)); - dialog_vars.defaultno = dialog_vars.default_button == DLG_EXIT_CANCEL; break; case o_default_item: dialog_vars.default_item = optionString(argv, &offset); @@ -1492,7 +1416,10 @@ process_common_options(int argc, char **argv, int offset, bool output) break; #ifdef HAVE_DLG_TRACE case o_trace: - process_trace_option(argv, &offset); + dlg_trace(optionString(argv, &offset)); + for (n = 0; argv[n] != 0; ++n) { + dlg_trace_msg("argv[%d] = %s\n", n, argv[n]); + } break; #endif } @@ -1513,16 +1440,12 @@ init_result(char *buffer) static char **special_argv = 0; static int special_argc = 0; - dlg_trace_msg("# init_result\n"); - /* 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'; - dialog_vars.default_button = -1; - /* * The first time this is called, check for common options given by an * environment variable. @@ -1535,20 +1458,12 @@ init_result(char *buffer) special_argv = dlg_string_to_argv(env); special_argc = dlg_count_argv(special_argv); } - first = FALSE; } - - /* - * If we are not checking memory leaks, just do the parse of the - * environment once. - */ if (special_argv != 0) { process_common_options(special_argc, special_argv, 0, FALSE); #ifdef NO_LEAKS free(special_argv[0]); free(special_argv); - special_argv = 0; - special_argc = 0; first = TRUE; #endif } @@ -1624,28 +1539,10 @@ main(int argc, char *argv[]) case o_help: Help(); break; -#ifdef HAVE_DLG_TRACE - case o_trace: - /* - * Process/remove the --trace option if it is the first option. - * Otherwise, process it in more/less expected order as a - * "common" option. - */ - if (base == 1) { - process_trace_option(argv, &offset); - break; - } else { - ++offset; - continue; - } -#endif default: ++offset; continue; } - dlg_trace_msg("# discarding %d parameters starting with argv[%d] (%s)\n", - 1 + offset - base, base, - argv[base]); for (j = base; j < argc; ++j) { dialog_argv[j] = dialog_argv[j + 1 + (offset - base)]; if (dialog_opts != 0) @@ -1782,7 +1679,6 @@ main(int argc, char *argv[]) retval = show_result((*(modePtr->jumper)) (dialog_vars.title, argv + offset, &offset_add)); - dlg_trace_msg("# widget returns %d\n", retval); offset += offset_add; if (dialog_vars.input_result != my_buffer) { diff --git a/contrib/dialog/dialog.h b/contrib/dialog/dialog.h index 1e31b09..4e1b01c 100644 --- a/contrib/dialog/dialog.h +++ b/contrib/dialog/dialog.h @@ -1,9 +1,9 @@ /* - * $Id: dialog.h,v 1.245 2012/07/01 18:44:03 tom Exp $ + * $Id: dialog.h,v 1.231 2011/06/29 09:51:00 tom Exp $ * * dialog.h -- common declarations for all dialog modules * - * Copyright 2000-2011,2012 Thomas E. Dickey + * Copyright 2000-2010,2011 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 @@ -59,9 +59,11 @@ #include <ncurses.h> #else #include <curses.h> -#if defined(HAVE_UNCTRL_H) -#include <unctrl.h> /* most curses.h headers include this, some do not */ #endif + +/* most curses.h headers include this, some do not */ +#if defined(HAVE_UNCTRL_H) +#include <unctrl.h> #endif /* Solaris xpg4 renames these */ @@ -95,10 +97,6 @@ #define _(s) s #endif -#ifndef GCC_PRINTFLIKE -#define GCC_PRINTFLIKE(fmt,var) /*nothing*/ -#endif - #ifndef GCC_NORETURN #define GCC_NORETURN /*nothing*/ #endif @@ -235,11 +233,6 @@ #define getparyx(win,y,x) (y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR) #endif -#if !defined(HAVE_WGETPARENT) && defined(HAVE_WINDOW__PARENT) -#undef wgetparent -#define wgetparent(win) ((win) ? (win)->_parent : 0) -#endif - #ifdef __cplusplus extern "C" { #endif @@ -281,12 +274,6 @@ extern int dlg_getparx(WINDOW * /*win*/); extern int dlg_getpary(WINDOW * /*win*/); #endif -#if !(defined(HAVE_WGETPARENT) && defined(HAVE_WINDOW__PARENT)) -#undef wgetparent -#define wgetparent(win) dlg_wgetparent(win) -extern WINDOW * dlg_wgetparent(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 @@ -370,10 +357,6 @@ extern WINDOW * dlg_wgetparent(WINDOW * /*win*/); #define form_text_attr DIALOG_ATR(31) #define form_item_readonly_attr DIALOG_ATR(32) #define gauge_attr DIALOG_ATR(33) -#define border2_attr DIALOG_ATR(34) -#define inputbox_border2_attr DIALOG_ATR(35) -#define searchbox_border2_attr DIALOG_ATR(36) -#define menubox_border2_attr DIALOG_ATR(37) #define DLGK_max (KEY_MAX + 256) @@ -413,7 +396,6 @@ typedef struct { DIALOG_CALLBACK *getc_callbacks; DIALOG_CALLBACK *getc_redirect; DIALOG_WINDOWS *all_windows; - DIALOG_WINDOWS *all_subwindows; FILE *output; /* option "--output-fd fd" */ FILE *pipe_input; /* used for gauge widget */ FILE *screen_output; /* newterm(), etc. */ @@ -503,8 +485,6 @@ typedef struct { char *help_file; /* option "--hfile" */ bool in_helpfile; /* flag to prevent recursion in --hfile */ bool no_nl_expand; /* option "--no-nl-expand" */ - /* 1.1-20120701 */ - int default_button; /* option "--default-button" (exit code) */ } DIALOG_VARS; #define USE_ITEM_HELP(s) (dialog_vars.item_help && (s) != 0) @@ -643,7 +623,7 @@ extern void dlg_align_columns(char ** /* target */, int /* per_row */, int /* n 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*/); +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*/); @@ -666,10 +646,6 @@ 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*/); -/* menubox.c */ -extern int dlg_dummy_menutext(DIALOG_LISTITEM * /*items*/, int /*current*/, char * /*newtext*/); -extern int dlg_renamed_menutext(DIALOG_LISTITEM * /*items*/, int /*current*/, char * /*newtext*/); - /* rc.c */ #ifdef HAVE_RC_FILE extern int dlg_parse_rc(void); @@ -697,17 +673,15 @@ extern char * dlg_strempty(void); extern chtype dlg_asciibox(chtype /*ch*/); extern chtype dlg_boxchar(chtype /*ch*/); extern chtype dlg_get_attrs(WINDOW * /*win*/); -extern const char * dlg_print_line(WINDOW * /*win*/, chtype * /*attr*/, const char * /*prompt*/, int /*lm*/, int /*rm*/, int * /*x*/); +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_count_real_columns(const char * /*text*/); +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_default_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*/); @@ -725,9 +699,7 @@ 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_bottom_box2(WINDOW * /*win*/, chtype /*on_left*/, chtype /*on_right*/, chtype /*on_inside*/); extern void dlg_draw_box(WINDOW * /*win*/, int /*y*/, int /*x*/, int /*height*/, int /*width*/, chtype /*boxchar*/, chtype /*borderchar*/); -extern void dlg_draw_box2(WINDOW * /*win*/, int /*y*/, int /*x*/, int /*height*/, int /*width*/, chtype /*boxchar*/, chtype /*borderchar*/, chtype /*borderchar2*/); 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*/); @@ -743,7 +715,11 @@ 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 GCC_PRINTFLIKE(1,2); +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*/); @@ -760,7 +736,11 @@ extern int dlg_strcmp(const char * /*a*/, const char * /*b*/); #ifdef HAVE_DLG_TRACE #define DLG_TRACE(params) dlg_trace_msg params -extern void dlg_trace_msg(const char *fmt, ...) GCC_PRINTFLIKE(1,2); +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*/); diff --git a/contrib/dialog/dlg_colors.h b/contrib/dialog/dlg_colors.h index c047f72..84123dd 100644 --- a/contrib/dialog/dlg_colors.h +++ b/contrib/dialog/dlg_colors.h @@ -1,5 +1,5 @@ /* - * $Id: dlg_colors.h,v 1.17 2011/10/14 21:19:59 tom Exp $ + * $Id: dlg_colors.h,v 1.16 2011/01/17 00:20:32 tom Exp $ * * colors.h -- color attribute definitions * @@ -56,10 +56,6 @@ #define DLGC_BG_BORDER COLOR_WHITE #define DLGC_HL_BORDER TRUE -#define DLGC_FG_BORDER2 DLGC_FG_DIALOG -#define DLGC_BG_BORDER2 DLGC_BG_DIALOG -#define DLGC_HL_BORDER2 DLGC_HL_DIALOG - #define DLGC_FG_BUTTON_ACTIVE COLOR_WHITE #define DLGC_BG_BUTTON_ACTIVE COLOR_BLUE #define DLGC_HL_BUTTON_ACTIVE TRUE @@ -96,10 +92,6 @@ #define DLGC_BG_INPUTBOX_BORDER COLOR_WHITE #define DLGC_HL_INPUTBOX_BORDER FALSE -#define DLGC_FG_INPUTBOX_BORDER2 DLGC_FG_INPUTBOX -#define DLGC_BG_INPUTBOX_BORDER2 DLGC_BG_INPUTBOX -#define DLGC_HL_INPUTBOX_BORDER2 DLGC_HL_INPUTBOX - #define DLGC_FG_SEARCHBOX COLOR_BLACK #define DLGC_BG_SEARCHBOX COLOR_WHITE #define DLGC_HL_SEARCHBOX FALSE @@ -112,10 +104,6 @@ #define DLGC_BG_SEARCHBOX_BORDER COLOR_WHITE #define DLGC_HL_SEARCHBOX_BORDER TRUE -#define DLGC_FG_SEARCHBOX_BORDER2 DLGC_FG_SEARCHBOX -#define DLGC_BG_SEARCHBOX_BORDER2 DLGC_BG_SEARCHBOX -#define DLGC_HL_SEARCHBOX_BORDER2 DLGC_HL_SEARCHBOX - #define DLGC_FG_POSITION_INDICATOR COLOR_BLUE #define DLGC_BG_POSITION_INDICATOR COLOR_WHITE #define DLGC_HL_POSITION_INDICATOR TRUE @@ -128,10 +116,6 @@ #define DLGC_BG_MENUBOX_BORDER COLOR_WHITE #define DLGC_HL_MENUBOX_BORDER TRUE -#define DLGC_FG_MENUBOX_BORDER2 DLGC_FG_MENUBOX -#define DLGC_BG_MENUBOX_BORDER2 DLGC_BG_MENUBOX -#define DLGC_HL_MENUBOX_BORDER2 DLGC_HL_MENUBOX - #define DLGC_FG_ITEM COLOR_BLACK #define DLGC_BG_ITEM COLOR_WHITE #define DLGC_HL_ITEM FALSE diff --git a/contrib/dialog/dlg_keys.c b/contrib/dialog/dlg_keys.c index 4b59f6b..97ca865 100644 --- a/contrib/dialog/dlg_keys.c +++ b/contrib/dialog/dlg_keys.c @@ -1,9 +1,9 @@ /* - * $Id: dlg_keys.c,v 1.34 2011/10/14 00:41:08 tom Exp $ + * $Id: dlg_keys.c,v 1.26 2009/02/22 16:19:51 tom Exp $ * - * dlg_keys.c -- runtime binding support for dialog + * dlg_keys.c -- runtime binding support for dialog * - * Copyright 2006-2009,2011 Thomas E. Dickey + * 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 @@ -34,7 +34,6 @@ LIST_BINDINGS { DLG_KEYS_BINDING *binding; /* list of bindings */ }; -#define WILDNAME "*" static LIST_BINDINGS *all_bindings; static const DLG_KEYS_BINDING end_keys_binding = END_KEYS_BINDING; @@ -62,17 +61,6 @@ dlg_register_window(WINDOW *win, const char *name, DLG_KEYS_BINDING * binding) else all_bindings = p; } -#if defined(HAVE_DLG_TRACE) && defined(HAVE_RC_FILE) - /* - * Trace the binding information assigned to this window. For most widgets - * there is only one binding table. forms have two, so the trace will be - * longer. Since compiled-in bindings are only visible when the widget is - * registered, there is no other way to see what bindings are available, - * than by running dialog and tracing it. - */ - dlg_trace_msg("# dlg_register_window %s\n", name); - dlg_dump_window_keys(dialog_state.trace_output, win); -#endif } /* @@ -201,7 +189,7 @@ int dlg_lookup_key(WINDOW *win, int curses_key, int *fkey) { LIST_BINDINGS *p; - DLG_KEYS_BINDING *q; + int n; /* * Ignore mouse clicks, since they are already encoded properly. @@ -220,28 +208,19 @@ dlg_lookup_key(WINDOW *win, int curses_key, int *fkey) } else #endif if (*fkey == 0 || curses_key < KEY_MAX) { - const char *name = WILDNAME; - if (win != 0) { - for (p = all_bindings; p != 0; p = p->link) { - if (p->win == win) { - name = p->name; - break; - } - } - } for (p = all_bindings; p != 0; p = p->link) { - if (p->win == win || (p->win == 0 && !strcmp(p->name, name))) { + if (p->win == win || p->win == 0) { int function_key = (*fkey != 0); - for (q = p->binding; q->is_function_key >= 0; ++q) { + for (n = 0; p->binding[n].is_function_key >= 0; ++n) { if (p->buttons && !function_key - && q->curses_key == (int) dlg_toupper(curses_key)) { + && p->binding[n].curses_key == (int) dlg_toupper(curses_key)) { *fkey = 0; - return q->dialog_key; + return p->binding[n].dialog_key; } - if (q->curses_key == curses_key - && q->is_function_key == function_key) { - *fkey = q->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; } } @@ -316,18 +295,10 @@ typedef struct { int code; } CODENAME; -#define ASCII_NAME(name,code) { #name, code } #define CURSES_NAME(upper) { #upper, KEY_ ## upper } #define COUNT_CURSES sizeof(curses_names)/sizeof(curses_names[0]) static const CODENAME curses_names[] = { - ASCII_NAME(ESC, '\033'), - ASCII_NAME(CR, '\r'), - ASCII_NAME(LF, '\n'), - ASCII_NAME(FF, '\f'), - ASCII_NAME(TAB, '\t'), - ASCII_NAME(DEL, '\177'), - CURSES_NAME(DOWN), CURSES_NAME(UP), CURSES_NAME(LEFT), @@ -437,10 +408,6 @@ static const CODENAME dialog_names[] = DIALOG_NAME(FIELD_LAST), DIALOG_NAME(FIELD_NEXT), DIALOG_NAME(FIELD_PREV), - DIALOG_NAME(FORM_FIRST), - DIALOG_NAME(FORM_LAST), - DIALOG_NAME(FORM_NEXT), - DIALOG_NAME(FORM_PREV), DIALOG_NAME(GRID_UP), DIALOG_NAME(GRID_DOWN), DIALOG_NAME(GRID_LEFT), @@ -451,9 +418,7 @@ static const CODENAME dialog_names[] = DIALOG_NAME(ENTER), DIALOG_NAME(BEGIN), DIALOG_NAME(FINAL), - DIALOG_NAME(SELECT), - DIALOG_NAME(HELPFILE), - DIALOG_NAME(TRACE) + DIALOG_NAME(SELECT) }; static char * @@ -507,9 +472,9 @@ compare_bindings(LIST_BINDINGS * a, LIST_BINDINGS * b) 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, WILDNAME)) { + } else if (!strcmp(b->name, "*")) { result = -1; - } else if (!strcmp(a->name, WILDNAME)) { + } else if (!strcmp(a->name, "*")) { result = 1; } else { result = dlg_strcmp(a->name, b->name); @@ -607,7 +572,6 @@ dlg_parse_bindkey(char *params) p = skip_black(p); if (p != widget && *p != '\0') { *p++ = '\0'; - p = skip_white(p); q = p; while (*p != '\0' && curses_key < 0) { if (escaped) { @@ -649,7 +613,7 @@ dlg_parse_bindkey(char *params) for (xx = 0; xx < COUNT_CURSES; ++xx) { if (!dlg_strcmp(curses_names[xx].name, q)) { curses_key = curses_names[xx].code; - is_function = (curses_key >= KEY_MIN); + is_function = TRUE; break; } } @@ -736,53 +700,30 @@ dump_one_binding(FILE *fp, const char *widget, DLG_KEYS_BINDING * binding) fputc('\n', fp); } -/* - * Dump bindings for the given window. If it is a null, then this dumps the - * initial bindings which were loaded from the rc-file that are used as - * overall defaults. - */ void -dlg_dump_window_keys(FILE *fp, WINDOW *win) +dlg_dump_keys(FILE *fp) { - if (fp != 0) { - LIST_BINDINGS *p; - DLG_KEYS_BINDING *q; - const char *last = ""; + LIST_BINDINGS *p; + const char *last = ""; + unsigned n; + unsigned count = 0; - for (p = all_bindings; p != 0; p = p->link) { - if (p->win == win) { + 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, WILDNAME) ? "all" : p->name); + !strcmp(p->name, "*") ? "all" : p->name); last = p->name; } - for (q = p->binding; q->is_function_key >= 0; ++q) { - dump_one_binding(fp, p->name, q); - } + dump_one_binding(fp, p->name, p->binding); } } } } - -/* - * Dump all of the bindings which are not specific to a given widget, i.e., - * the "win" member is null. - */ -void -dlg_dump_keys(FILE *fp) -{ - if (fp != 0) { - LIST_BINDINGS *p; - unsigned count = 0; - - for (p = all_bindings; p != 0; p = p->link) { - if (p->win == 0) { - ++count; - } - } - if (count != 0) { - dlg_dump_window_keys(fp, 0); - } - } -} #endif /* HAVE_RC_FILE */ diff --git a/contrib/dialog/dlg_keys.h b/contrib/dialog/dlg_keys.h index 3469e40..34b4cba 100644 --- a/contrib/dialog/dlg_keys.h +++ b/contrib/dialog/dlg_keys.h @@ -1,9 +1,9 @@ /* - * $Id: dlg_keys.h,v 1.31 2012/07/02 23:57:52 tom Exp $ + * $Id: dlg_keys.h,v 1.26 2011/06/21 22:09:22 tom Exp $ * * dlg_keys.h -- runtime binding support for dialog * - * Copyright 2005-2011,2012 Thomas E. Dickey + * Copyright 2005-2010,2011 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 @@ -23,7 +23,6 @@ #ifndef DLG_KEYS_H_included #define DLG_KEYS_H_included 1 -/* *INDENT-OFF* */ #include <dialog.h> @@ -32,7 +31,7 @@ #define dlg_toupper(ch) towupper((wint_t)ch) #define dlg_isupper(ch) iswupper((wint_t)ch) #else -#define dlg_toupper(ch) (((ch) > 0 && (ch) <= 255) ? toupper(ch) : (ch)) +#define dlg_toupper(ch) toupper(ch) #define dlg_isupper(ch) (isalpha(ch) && isupper(ch)) #endif @@ -46,7 +45,7 @@ typedef struct { int dialog_key; } DLG_KEYS_BINDING; -#define DLG_KEYS_DATA(dialog, curses) { (curses) >= KEY_MIN, curses, dialog } +#define DLG_KEYS_DATA(dialog, curses) { curses >= KEY_MIN, curses, dialog } #define END_KEYS_BINDING { -1, 0, 0 } @@ -76,11 +75,6 @@ typedef enum { DLGK_FIELD_LAST, DLGK_FIELD_NEXT, DLGK_FIELD_PREV, - /* moving from form-field to form-field (or buttons) */ - DLGK_FORM_FIRST, - DLGK_FORM_LAST, - DLGK_FORM_NEXT, - DLGK_FORM_PREV, /* moving within a grid */ DLGK_GRID_UP, DLGK_GRID_DOWN, @@ -142,15 +136,6 @@ typedef enum { DLG_KEYS_DATA( DLGK_PAGE_PREV, 'b' ), \ DLG_KEYS_DATA( DLGK_PAGE_PREV, KEY_PPAGE ) -#define TRAVERSE_BINDINGS \ - DLG_KEYS_DATA( DLGK_ENTER, ' ' ), \ - 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 ) - 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*/); @@ -160,12 +145,10 @@ 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*/); -extern void dlg_dump_window_keys(FILE * /*fp*/, WINDOW * /*win*/); #endif #ifdef __cplusplus } #endif -/* *INDENT-ON* */ #endif /* DLG_KEYS_H_included */ diff --git a/contrib/dialog/editbox.c b/contrib/dialog/editbox.c index 7488d65..c7da10c 100644 --- a/contrib/dialog/editbox.c +++ b/contrib/dialog/editbox.c @@ -1,9 +1,9 @@ /* - * $Id: editbox.c,v 1.61 2012/07/01 18:13:32 Zoltan.Kelemen Exp $ + * $Id: editbox.c,v 1.55 2011/06/21 00:10:46 tom Exp $ * * editbox.c -- implements the edit box * - * Copyright 2007-2011,2012 Thomas E. Dickey + * Copyright 2007-2010,2011 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 @@ -43,10 +43,9 @@ grow_list(char ***list, int *have, int want) (*list) = dlg_realloc(char *, need, *list); if ((*list) == 0) { fail_list(); - } else { - while (++last < need) { - (*list)[last] = 0; - } + } + while (++last < need) { + (*list)[last] = 0; } } } @@ -69,47 +68,45 @@ load_list(const char *file, char ***list, int *rows) dlg_exiterr("Not a file: %s", file); size = (size_t) sb.st_size; - if ((blob = dlg_malloc(char, size + 1)) == 0) { - fail_list(); - } else { - blob[size] = '\0'; - - if ((fp = fopen(file, "r")) == 0) - dlg_exiterr("Cannot open: %s", file); - size = fread(blob, sizeof(char), size, fp); - fclose(fp); - - for (pass = 0; pass < 2; ++pass) { - int first = TRUE; - need = 0; - for (n = 0; n < size; ++n) { - if (first && pass) { - (*list)[need] = blob + n; - first = FALSE; - } - if (blob[n] == '\n') { - first = TRUE; - ++need; - if (pass) - blob[n] = '\0'; - } + if ((blob = dlg_malloc(char, size + 1)) == 0) + fail_list(); + blob[size] = '\0'; + + if ((fp = fopen(file, "r")) == 0) + dlg_exiterr("Cannot open: %s", file); + size = fread(blob, sizeof(char), size, fp); + fclose(fp); + + for (pass = 0; pass < 2; ++pass) { + int first = TRUE; + need = 0; + for (n = 0; n < size; ++n) { + if (first && pass) { + (*list)[need] = blob + n; + first = FALSE; } - if (pass) { - if (need == 0) { - (*list)[0] = dlg_strclone(""); - (*list)[1] = 0; - } else { - for (n = 0; n < need; ++n) { - (*list)[n] = dlg_strclone((*list)[n]); - } - (*list)[need] = 0; - } + if (blob[n] == '\n') { + first = TRUE; + ++need; + if (pass) + blob[n] = '\0'; + } + } + if (pass) { + if (need == 0) { + (*list)[0] = dlg_strclone(""); + (*list)[1] = 0; } else { - grow_list(list, rows, (int) need + 1); + for (n = 0; n < need; ++n) { + (*list)[n] = dlg_strclone((*list)[n]); + } + (*list)[need] = 0; } + } else { + grow_list(list, rows, (int) need + 1); } - free(blob); } + free(blob); } static void @@ -347,7 +344,6 @@ dlg_editbox(const char *title, size_t max_len = (size_t) dlg_max_input(widest_line(*list)); char *input, *buffer; bool show_all, show_one, was_mouse; - bool first_trace = TRUE; WINDOW *dialog; WINDOW *editing; DIALOG_VARS save_vars; @@ -368,8 +364,8 @@ dlg_editbox(const char *title, retry: #endif show_buttons = TRUE; - state = dialog_vars.default_button >= 0 ? dlg_default_button() : sTEXT; - fkey = 0; + state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT; + key = fkey = 0; dlg_button_layout(buttons, &mincols); dlg_auto_size(title, "", &height, &width, 3 * LINES / 4, mincols); @@ -385,11 +381,11 @@ dlg_editbox(const char *title, dlg_mouse_setbase(x, y); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); dlg_draw_title(dialog, title); - (void) wattrset(dialog, dialog_attr); + wattrset(dialog, dialog_attr); /* Draw the editing field in a box */ box_y = MARGIN + 0; @@ -402,7 +398,7 @@ dlg_editbox(const char *title, box_x, box_height, box_width, - border_attr, border2_attr); + border_attr, dialog_attr); dlg_mouse_mkbigregion(box_y + MARGIN, box_x + MARGIN, box_height - (2 * MARGIN), @@ -413,7 +409,7 @@ dlg_editbox(const char *title, box_width - (2 * MARGIN), getbegy(dialog) + box_y + 1, getbegx(dialog) + box_x + 1); - dlg_register_window(editing, "editbox2", binding2); + dlg_register_window(editing, "editbox", binding2); show_all = TRUE; show_one = FALSE; @@ -448,7 +444,7 @@ dlg_editbox(const char *title, box_x + getmaxx(editing), box_y + 0, box_y + getmaxy(editing) + 1, - border2_attr, + dialog_attr, border_attr); wmove(editing, y, x); show_one = FALSE; @@ -480,11 +476,6 @@ dlg_editbox(const char *title, } } - if (first_trace) { - first_trace = FALSE; - dlg_trace_win(dialog); - } - key = dlg_mouse_wgetch((state == sTEXT) ? editing : dialog, &fkey); if (key == ERR) { result = DLG_EXIT_ERROR; diff --git a/contrib/dialog/formbox.c b/contrib/dialog/formbox.c index 8cbe8a8..7ec798c 100644 --- a/contrib/dialog/formbox.c +++ b/contrib/dialog/formbox.c @@ -1,9 +1,9 @@ /* - * $Id: formbox.c,v 1.81 2012/07/01 18:13:51 Zoltan.Kelemen Exp $ + * $Id: formbox.c,v 1.73 2011/06/29 09:48:08 tom Exp $ * * formbox.c -- implements the form (i.e, some pairs label/editbox) * - * Copyright 2003-2011,2012 Thomas E. Dickey + * Copyright 2003-2010,2011 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 @@ -188,34 +188,6 @@ form_limit(DIALOG_FORMITEM item[]) return limit; } -static int -is_first_field(DIALOG_FORMITEM item[], int choice) -{ - int count = 0; - while (choice >= 0) { - if (item[choice].text_flen > 0) { - ++count; - } - --choice; - } - - return (count == 1); -} - -static int -is_last_field(DIALOG_FORMITEM item[], int choice, int item_no) -{ - int count = 0; - while (choice < item_no) { - if (item[choice].text_flen > 0) { - ++count; - } - ++choice; - } - - return (count == 1); -} - /* * Tab to the next field. */ @@ -482,9 +454,8 @@ dlg_form(const char *title, int form_width; int first = TRUE; - int first_trace = TRUE; int chr_offset = 0; - int state = dialog_vars.default_button >=0 ? dlg_default_button() : sTEXT; + int state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT; int x, y, cur_x, cur_y, box_x, box_y; int code; int key = 0; @@ -539,31 +510,30 @@ dlg_form(const char *title, dialog = dlg_new_window(height, width, y, x); dlg_register_window(dialog, "formbox", binding); + dlg_register_window(dialog, "formfield", binding2); dlg_register_buttons(dialog, "formbox", buttons); dlg_mouse_setbase(x, y); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); dlg_draw_title(dialog, title); - (void) wattrset(dialog, dialog_attr); + wattrset(dialog, dialog_attr); dlg_print_autowrap(dialog, prompt, height, width); form_width = width - 6; getyx(dialog, cur_y, cur_x); - (void) cur_x; box_y = cur_y + 1; box_x = (width - form_width) / 2 - 1; /* create new window for the form */ form = dlg_sub_window(dialog, form_height, form_width, y + box_y + 1, x + box_x + 1); - dlg_register_window(form, "formfield", binding2); /* draw a box around the form items */ dlg_draw_box(dialog, box_y, box_x, form_height + 2, form_width + 2, - menubox_border_attr, menubox_border2_attr); + menubox_border_attr, menubox_attr); /* register the new window, along with its borders */ dlg_mouse_mkbigregion(getbegy(form) - getbegy(dialog), @@ -594,7 +564,7 @@ dlg_form(const char *title, box_x + form_width, box_y, box_y + form_height + 1, - menubox_border2_attr, + menubox_attr, menubox_border_attr); scroll_changed = FALSE; } @@ -609,11 +579,6 @@ dlg_form(const char *title, show_buttons = FALSE; } - if (first_trace) { - first_trace = FALSE; - dlg_trace_win(dialog); - } - if (field_changed || state == sTEXT) { if (field_changed) chr_offset = 0; @@ -629,7 +594,7 @@ dlg_form(const char *title, field_changed = FALSE; } - key = dlg_mouse_wgetch((state == sTEXT) ? form : dialog, &fkey); + key = dlg_mouse_wgetch(dialog, &fkey); if (dlg_result_key(key, fkey, &result)) break; @@ -688,25 +653,6 @@ dlg_form(const char *title, continue; } - case DLGK_FORM_PREV: - if (state == sTEXT && !is_first_field(items, choice)) { - do_tab = TRUE; - move_by = -1; - break; - } else { - int old_state = state; - state = prev_valid_buttonindex(state, sTEXT, non_editable); - show_buttons = TRUE; - if (old_state >= 0 && state == sTEXT) { - new_choice = item_no - 1; - if (choice != new_choice) { - print_item(form, items + choice, scrollamt, FALSE); - choice = new_choice; - } - } - continue; - } - case DLGK_FIELD_PREV: state = prev_valid_buttonindex(state, sTEXT, non_editable); show_buttons = TRUE; @@ -733,21 +679,6 @@ dlg_form(const char *title, continue; } - case DLGK_FORM_NEXT: - if (state == sTEXT && !is_last_field(items, choice, item_no)) { - do_tab = TRUE; - move_by = 1; - break; - } else { - state = next_valid_buttonindex(state, sTEXT, non_editable); - show_buttons = TRUE; - if (state == sTEXT && choice) { - print_item(form, items + choice, scrollamt, FALSE); - choice = 0; - } - continue; - } - #ifdef KEY_RESIZE case KEY_RESIZE: /* reset data */ diff --git a/contrib/dialog/fselect.c b/contrib/dialog/fselect.c index 123605e..e082abf 100644 --- a/contrib/dialog/fselect.c +++ b/contrib/dialog/fselect.c @@ -1,9 +1,9 @@ /* - * $Id: fselect.c,v 1.87 2012/07/01 18:14:09 Zoltan.Kelemen Exp $ + * $Id: fselect.c,v 1.78 2011/06/29 09:48:21 tom Exp $ * * fselect.c -- implements the file-selector box * - * Copyright 2000-2011,2012 Thomas E. Dickey + * Copyright 2000-2010,2011 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 @@ -230,11 +230,11 @@ display_list(LIST * list) break; (void) wmove(list->win, y, 0); if (n == list->choice) - (void) wattrset(list->win, item_selected_attr); + wattrset(list->win, item_selected_attr); (void) waddstr(list->win, list->data[n]); - (void) wattrset(list->win, item_attr); + wattrset(list->win, item_attr); } - (void) wattrset(list->win, item_attr); + wattrset(list->win, item_attr); getparyx(list->win, y, x); @@ -249,7 +249,7 @@ display_list(LIST * list) x + getmaxx(list->win), top, bottom, - menubox_border2_attr, + menubox_attr, menubox_border_attr); (void) wmove(list->win, list->choice - list->offset, 0); @@ -270,20 +270,18 @@ fix_arrows(LIST * list) int x; int y; int top; - int right; int bottom; if (list->win != 0) { getparyx(list->win, y, x); top = y - 1; - right = getmaxx(list->win); bottom = y + getmaxy(list->win); - mouse_mkbutton(top, x, right, + mouse_mkbutton(top, x, 6, ((list->mousex == MOUSE_D) ? KEY_PREVIOUS : KEY_PPAGE)); - mouse_mkbutton(bottom, x, right, + mouse_mkbutton(bottom, x, 6, ((list->mousex == MOUSE_D) ? KEY_NEXT : KEY_NPAGE)); @@ -431,8 +429,6 @@ complete(char *name, LIST * d_list, LIST * f_list, char **buff_ptr) static bool fill_lists(char *current, char *input, LIST * d_list, LIST * f_list, int keep) { - bool result = TRUE; - bool rescan = FALSE; DIR *dp; DIRENT *de; struct stat sb; @@ -445,60 +441,51 @@ fill_lists(char *current, char *input, LIST * d_list, LIST * f_list, int keep) if (current[n] != input[n]) break; } - - if (current[n] == input[n]) { - result = FALSE; - rescan = (n == 0 && d_list->length == 0); - } else if (strchr(current + n, '/') == 0 - && strchr(input + n, '/') == 0) { - result = show_both_lists(input, d_list, f_list, keep); - } else { - rescan = TRUE; + if (current[n] == input[n]) + return FALSE; + if (strchr(current + n, '/') == 0 + && strchr(input + n, '/') == 0) { + return show_both_lists(input, d_list, f_list, keep); } - if (rescan) { + strcpy(current, input); - strcpy(current, input); - - /* refill the lists */ - free_list(d_list, TRUE); - free_list(f_list, TRUE); - strcpy(path, current); - if ((leaf = strrchr(path, '/')) != 0) { - *++leaf = 0; - } else { - strcpy(path, "./"); - leaf = path + strlen(path); - } - dlg_trace_msg("opendir '%s'\n", path); - if ((dp = opendir(path)) != 0) { - while ((de = readdir(dp)) != 0) { - strncpy(leaf, de->d_name, NAMLEN(de))[NAMLEN(de)] = 0; - if (stat(path, &sb) == 0) { - if ((sb.st_mode & S_IFMT) == S_IFDIR) - add_to_list(d_list, leaf); - else if (f_list->win) - add_to_list(f_list, leaf); - } + /* refill the lists */ + free_list(d_list, TRUE); + free_list(f_list, TRUE); + strcpy(path, current); + if ((leaf = strrchr(path, '/')) != 0) { + *++leaf = 0; + } else { + strcpy(path, "./"); + leaf = path + strlen(path); + } + if ((dp = opendir(path)) != 0) { + while ((de = readdir(dp)) != 0) { + strncpy(leaf, de->d_name, NAMLEN(de))[NAMLEN(de)] = 0; + if (stat(path, &sb) == 0) { + if ((sb.st_mode & S_IFMT) == S_IFDIR) + add_to_list(d_list, leaf); + else if (f_list->win) + add_to_list(f_list, leaf); } - (void) closedir(dp); - /* sort the lists */ - qsort(d_list->data, - (size_t) d_list->length, - sizeof(d_list->data[0]), - compar); - qsort(f_list->data, - (size_t) f_list->length, - sizeof(f_list->data[0]), - compar); } - - (void) show_both_lists(input, d_list, f_list, FALSE); - d_list->offset = d_list->choice; - f_list->offset = f_list->choice; - result = TRUE; + (void) closedir(dp); + /* sort the lists */ + qsort(d_list->data, + (size_t) d_list->length, + sizeof(d_list->data[0]), + compar); + qsort(f_list->data, + (size_t) f_list->length, + sizeof(f_list->data[0]), + compar); } - return result; + + (void) show_both_lists(input, d_list, f_list, FALSE); + d_list->offset = d_list->choice; + f_list->offset = f_list->choice; + return TRUE; } static bool @@ -573,10 +560,9 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel int fkey = FALSE; int code; int result = DLG_EXIT_UNKNOWN; - int state = dialog_vars.default_button >=0 ? dlg_default_button() : sTEXT; - int button; + int state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT; + int button = state; int first = (state == sTEXT); - int first_trace = TRUE; char *input; char *completed; char current[MAX_LEN + 1]; @@ -618,11 +604,11 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel dlg_mouse_setbase(0, 0); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); dlg_draw_title(dialog, title); - (void) wattrset(dialog, dialog_attr); + wattrset(dialog, dialog_attr); /* Draw the input field box */ tbox_height = 1; @@ -637,14 +623,14 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel (void) keypad(w_text, TRUE); dlg_draw_box(dialog, tbox_y - MARGIN, tbox_x - MARGIN, (2 * MARGIN + 1), tbox_width + (MARGIN + EXT_WIDE), - menubox_border_attr, menubox_border2_attr); + menubox_border_attr, menubox_attr); dlg_mouse_mkbigregion(getbegy(dialog) + tbox_y - MARGIN, getbegx(dialog) + tbox_x - MARGIN, 1 + (2 * MARGIN), tbox_width + (MARGIN + EXT_WIDE), MOUSE_T, 1, 1, 3 /* doesn't matter */ ); - dlg_register_window(w_text, "fselect2", binding2); + dlg_register_window(w_text, "fselect", binding2); /* Draw the directory listing box */ if (dselect) @@ -660,11 +646,11 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel return DLG_EXIT_ERROR; (void) keypad(w_work, TRUE); - (void) mvwaddstr(dialog, dbox_y - (MARGIN + 1), dbox_x - MARGIN, d_label); + (void) mvwprintw(dialog, dbox_y - (MARGIN + 1), dbox_x - MARGIN, d_label); dlg_draw_box(dialog, dbox_y - MARGIN, dbox_x - MARGIN, dbox_height + (MARGIN + 1), dbox_width + (MARGIN + 1), - menubox_border_attr, menubox_border2_attr); + menubox_border_attr, menubox_attr); init_list(&d_list, dialog, w_work, MOUSE_D); if (!dselect) { @@ -679,11 +665,11 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel return DLG_EXIT_ERROR; (void) keypad(w_work, TRUE); - (void) mvwaddstr(dialog, fbox_y - (MARGIN + 1), fbox_x - MARGIN, f_label); + (void) mvwprintw(dialog, fbox_y - (MARGIN + 1), fbox_x - MARGIN, f_label); dlg_draw_box(dialog, fbox_y - MARGIN, fbox_x - MARGIN, fbox_height + (MARGIN + 1), fbox_width + (MARGIN + 1), - menubox_border_attr, menubox_border2_attr); + menubox_border_attr, menubox_attr); init_list(&f_list, dialog, w_work, MOUSE_F); } else { memset(&f_list, 0, sizeof(f_list)); @@ -710,12 +696,6 @@ dlg_fselect(const char *title, const char *path, int height, int width, int dsel button = (state < 0) ? 0 : state; dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); } - - if (first_trace) { - first_trace = FALSE; - dlg_trace_win(dialog); - } - if (state < 0) { switch (state) { case sTEXT: diff --git a/contrib/dialog/guage.c b/contrib/dialog/guage.c index 1e2929c..b25052f 100644 --- a/contrib/dialog/guage.c +++ b/contrib/dialog/guage.c @@ -1,5 +1,5 @@ /* - * $Id: guage.c,v 1.64 2011/10/20 23:34:35 tom Exp $ + * $Id: guage.c,v 1.60 2011/06/27 00:52:28 tom Exp $ * * guage.c -- implements the gauge dialog * @@ -122,29 +122,27 @@ repaint_text(MY_OBJ * obj) if (dialog != 0 && obj->obj.input != 0) { (void) werase(dialog); - dlg_draw_box2(dialog, 0, 0, obj->height, obj->width, dialog_attr, - border_attr, border2_attr); + dlg_draw_box(dialog, 0, 0, obj->height, obj->width, dialog_attr, border_attr); dlg_draw_title(dialog, obj->title); - (void) wattrset(dialog, dialog_attr); + wattrset(dialog, dialog_attr); dlg_draw_helpline(dialog, FALSE); dlg_print_autowrap(dialog, obj->prompt, obj->height, obj->width); - dlg_draw_box2(dialog, - obj->height - 4, 2 + MARGIN, - 2 + MARGIN, obj->width - 2 * (2 + MARGIN), - dialog_attr, - border_attr, - border2_attr); + dlg_draw_box(dialog, + obj->height - 4, 2 + MARGIN, + 2 + MARGIN, obj->width - 2 * (2 + MARGIN), + dialog_attr, + border_attr); /* * Clear the area for the progress bar by filling it with spaces - * in the gauge-attribute, and write the percentage with that + * in the title-attribute, and write the percentage with that * attribute. */ (void) wmove(dialog, obj->height - 3, 4); - (void) wattrset(dialog, gauge_attr); + wattrset(dialog, gauge_attr); for (i = 0; i < (obj->width - 2 * (3 + MARGIN)); i++) (void) waddch(dialog, ' '); @@ -158,15 +156,15 @@ repaint_text(MY_OBJ * obj) * but requires some tweaks to reverse it. */ x = (obj->percent * (obj->width - 2 * (3 + MARGIN))) / 100; - if ((gauge_attr & A_REVERSE) != 0) { + if ((title_attr & A_REVERSE) != 0) { wattroff(dialog, A_REVERSE); } else { - (void) wattrset(dialog, A_REVERSE); + wattrset(dialog, A_REVERSE); } (void) wmove(dialog, obj->height - 3, 4); for (i = 0; i < x; i++) { chtype ch2 = winch(dialog); - if (gauge_attr & A_REVERSE) { + if (title_attr & A_REVERSE) { ch2 &= ~A_REVERSE; } (void) waddch(dialog, ch2); @@ -337,6 +335,7 @@ dlg_free_gauge(void *objptr) delink(obj); obj->obj.keep_win = FALSE; dlg_remove_callback(&(obj->obj)); + free(obj); } } @@ -363,7 +362,6 @@ dialog_gauge(const char *title, dlg_add_callback_ref((DIALOG_CALLBACK **) & obj, my_cleanup); dlg_update_gauge(obj, percent); - dlg_trace_win(obj->obj.win); do { ch = dlg_getc(obj->obj.win, &fkey); #ifdef KEY_RESIZE diff --git a/contrib/dialog/headers-sh.in b/contrib/dialog/headers-sh.in index 9bad19f..906c018 100755 --- a/contrib/dialog/headers-sh.in +++ b/contrib/dialog/headers-sh.in @@ -1,5 +1,5 @@ #! /bin/sh -# $Id: headers-sh.in,v 1.11 2011/10/18 23:49:13 tom Exp $ +# $Id: headers-sh.in,v 1.9 2011/01/06 09:38:25 tom Exp $ ############################################################################## # Copyright (c) 2004-2007,2011 Thomas E. Dickey # # # @@ -45,8 +45,6 @@ PKGNAME=@PACKAGE_PREFIX@ CONFIGH=@PACKAGE_CONFIG@ SUB_INC=@SUB_INC@ -: ${TMPDIR:=/tmp} - TMPSED=headers.sed DIGIT=0123456789 @@ -100,9 +98,9 @@ s/ $// :done EOF # pick up autoconf-style symbols used in the application's headers - for name in $REF/*.h + for i in $REF/*.h do - sed -e 's/^[ ][ ]*#[ ][ ]*/#/' $name \ + sed -e 's/^[ ][ ]*#[ ][ ]*/#/' $i \ | egrep '^#(if|ifdef|ifndef|elif)' \ | sed -f headers.tmp \ | sort -u \ @@ -118,7 +116,8 @@ EOF -e 's/^#define[ ][ ]*//' \ -e 's/[ ].*//' \ | egrep -v "^${PACKAGE}_" \ - | sort -u` + | sort -u \ + | egrep -v "^${PKGNAME}_"` do echo "s/\\<$name\\>/${PKGNAME}_$name/g" >>$TMPSED done @@ -128,8 +127,6 @@ EOF echo "s,#include <${pkgname}_,#include <${PACKAGE}/${pkgname}_," >>$TMPSED fi - echo '/_FILE_OFFSET_BITS/d' >>$TMPSED - # reduce the count if possible, since some old sed's limit is 100 lines sort -u $TMPSED >headers.tmp mv headers.tmp $TMPSED @@ -145,32 +142,13 @@ else SRC=$3 SHOW=`basename $SRC` - TMPSRC=$TMPDIR/${SHOW}-text$$ - TMPEDT=$TMPDIR/${SHOW}-edit$$ - TMPTMP=$TMPDIR/${SHOW}-temp$$ + TMPSRC=${TMPDIR-/tmp}/${SHOW}$$ echo " ... $SHOW" test -f $REF/$SRC && SRC="$REF/$SRC" rm -f $TMPSRC - cat $SRC >$TMPSRC - - tmp1=1 - while true - do - tmp2=`expr $tmp1 + 49` - if test $tmp1 = 1 - then - sed "${tmp2}q" $TMPSED >$TMPEDT - else - sed "1,${tmp1}d; ${tmp2}q" $TMPSED >$TMPEDT - fi - test -s $TMPEDT || break - sed -f $TMPEDT $TMPSRC > $TMPTMP - mv $TMPTMP $TMPSRC - tmp1=$tmp2 - done - + sed -f $TMPSED $SRC > $TMPSRC NAME=`basename $SRC` # Just in case someone gzip'd manpages, remove the conflicting copy. @@ -194,6 +172,6 @@ else fi eval $PRG $TMPSRC $DST/$NAME - rm -f $TMPEDT $TMPTMP $TMPSRC + rm -f $TMPSRC fi # vile:ts=4 sw=4 diff --git a/contrib/dialog/inputbox.c b/contrib/dialog/inputbox.c index 9d2eec2..14e2c28 100644 --- a/contrib/dialog/inputbox.c +++ b/contrib/dialog/inputbox.c @@ -1,9 +1,9 @@ /* - * $Id: inputbox.c,v 1.74 2012/07/01 18:13:40 Zoltan.Kelemen Exp $ + * $Id: inputbox.c,v 1.67 2011/06/29 09:48:34 tom Exp $ * * inputbox.c -- implements the input box * - * Copyright 2000-2011,2012 Thomas E. Dickey + * Copyright 2000-2010,2011 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 @@ -90,7 +90,7 @@ dialog_inputbox(const char *title, const char *cprompt, int height, int width, retry: #endif show_buttons = TRUE; - state = dialog_vars.default_button >= 0 ? dlg_default_button() : sTEXT; + state = dialog_vars.defaultno ? dlg_defaultno_button() : sTEXT; first = (state == sTEXT); key = fkey = 0; @@ -116,29 +116,27 @@ dialog_inputbox(const char *title, const char *cprompt, int height, int width, dlg_mouse_setbase(xorg, yorg); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); dlg_draw_title(dialog, title); - (void) wattrset(dialog, dialog_attr); + wattrset(dialog, dialog_attr); dlg_draw_helpline(dialog, FALSE); dlg_print_autowrap(dialog, prompt, height, width); /* Draw the input field box */ box_width = width - 6; getyx(dialog, y, x); - (void) 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, border2_attr); + 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, "inputbox2", binding2); + dlg_register_window(editor, "inputbox", binding2); - dlg_trace_win(dialog); while (result == DLG_EXIT_UNKNOWN) { int edit = 0; diff --git a/contrib/dialog/inputstr.c b/contrib/dialog/inputstr.c index aa719a1..685b126 100644 --- a/contrib/dialog/inputstr.c +++ b/contrib/dialog/inputstr.c @@ -1,5 +1,5 @@ /* - * $Id: inputstr.c,v 1.70 2011/10/20 23:42:49 tom Exp $ + * $Id: inputstr.c,v 1.69 2011/01/16 21:52:35 tom Exp $ * * inputstr.c -- functions for input/display of a string * @@ -261,6 +261,7 @@ dlg_count_wcbytes(const char *string, size_t len) load_cache(&cache, string); if (!same_cache1(&cache, string, len)) { while (len != 0) { + int part = 0; size_t code = 0; const char *src = cache.string; mbstate_t state; @@ -273,6 +274,7 @@ dlg_count_wcbytes(const char *string, size_t len) if ((int) code >= 0) { break; } + ++part; --len; } cache.i_len = len; @@ -698,7 +700,7 @@ dlg_show_string(WINDOW *win, compute_edit_offset(string, chr_offset, x_last, &input_x, &scrollamt); - (void) wattrset(win, attr); + wattrset(win, attr); (void) wmove(win, y_base, x_base); for (i = scrollamt, k = 0; i < limit && k < x_last; ++i) { int check = cols[i + 1] - cols[scrollamt]; diff --git a/contrib/dialog/makefile.in b/contrib/dialog/makefile.in index bef2d48..d05d74d 100644 --- a/contrib/dialog/makefile.in +++ b/contrib/dialog/makefile.in @@ -1,7 +1,7 @@ -# $Id: makefile.in,v 1.82 2012/02/16 00:35:37 Li-Wen.Hsu Exp $ +# $Id: makefile.in,v 1.79 2011/06/25 00:27:56 tom Exp $ # template makefile for DIALOG ############################################################################## -# Copyright (c) 1999-2011,2012 Thomas E. Dickey # +# Copyright (c) 1999-2010,2011 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"), # @@ -71,8 +71,7 @@ LIBS = @LIBS@ @INTLLIBS@ RANLIB = @LIB_PREP@ RM = rm -f -LINT = @LINT@ -LINT_OPTS = @LINT_OPTS@ +LINT = lint CTAGS = @CTAGS@ ETAGS = @ETAGS@ @@ -85,7 +84,6 @@ LIBTOOL_CREATE = @LIB_CREATE@ LIBTOOL_LINK = @LIB_LINK@ LIBTOOL_INSTALL = @LIB_INSTALL@ LIBTOOL_UNINSTALL = @LIB_UNINSTALL@ -LIBTOOL_VERSION = @LIBTOOL_VERSION@ INSTALL = @INSTALL@ INSTALL_PROGRAM = $(LIBTOOL_INSTALL) @INSTALL_PROGRAM@ @@ -103,7 +101,7 @@ LIB_CONFIG = @PACKAGE@-config # The library name $(LIB) is set at configure/make time, since it is used as a # makefile target. Ditto for $(PROG). LIB = @LIB_PREFIX@@PACKAGE@$a -PROG = @PACKAGE@$x +PROG = dialog$x # # Standard .c to .o compile line. # @@ -181,7 +179,7 @@ $(LIB) : $(LIB_OBJECT) $(LIBTOOL_CREATE) $(LIB) $(LIB_OBJECT) $(RANLIB) $@ -$(PROG)$x : $(LIB) dialog$o @INTLDIR_MAKE@ @INTLLIBS@ +dialog$x : $(LIB) dialog$o @INTLDIR_MAKE@ @INTLLIBS@ $(LINK) -o $@ dialog$o -L. -l@PACKAGE@ $(LDFLAGS) $(LIBS) clean \ @@ -251,20 +249,20 @@ install-lib :: $(LIB_DIRS) $(LIB) headers.sed @ echo "** installing library in $(LIBDIR)" @ $(LIBTOOL_INSTALL) $(INSTALL_DATA) $(LIB) $(LIBDIR) @ echo "** installing headers in $(INCLUDEDIR)" - @ $(SHELL) headers-sh $(INSTALL_DATA) $(INCLUDEDIR) $(srcdir) dialog.h - @ $(SHELL) headers-sh $(INSTALL_DATA) $(INCLUDEDIR) $(srcdir) dlg_colors.h - @ $(SHELL) headers-sh $(INSTALL_DATA) $(INCLUDEDIR) $(srcdir) dlg_keys.h - @ $(SHELL) headers-sh $(INSTALL_DATA) $(INCLUDEDIR) . dlg_config.h + @ $(SHELL) $(srcdir)/headers-sh $(INSTALL_DATA) $(INCLUDEDIR) $(srcdir) dialog.h + @ $(SHELL) $(srcdir)/headers-sh $(INSTALL_DATA) $(INCLUDEDIR) $(srcdir) dlg_colors.h + @ $(SHELL) $(srcdir)/headers-sh $(INSTALL_DATA) $(INCLUDEDIR) $(srcdir) dlg_keys.h + @ $(SHELL) $(srcdir)/headers-sh $(INSTALL_DATA) $(INCLUDEDIR) . dlg_config.h uninstall-lib :: $(BINDIR) $(RM) $(BINDIR)/$(LIB_CONFIG) uninstall-lib :: $(LIB_DIRS) - $(LIBTOOL_UNINSTALL) $(RM) $(LIBDIR)/$(LIB) - @ $(SHELL) headers-sh $(RM) $(INCLUDEDIR) $(srcdir) dialog.h - @ $(SHELL) headers-sh $(RM) $(INCLUDEDIR) $(srcdir) dlg_colors.h - @ $(SHELL) headers-sh $(RM) $(INCLUDEDIR) $(srcdir) dlg_keys.h - @ $(SHELL) headers-sh $(RM) $(INCLUDEDIR) . dlg_config.h + @ $(SHELL) $(srcdir)/headers-sh $(RM) $(INCLUDEDIR) $(srcdir) dialog.h + @ $(SHELL) $(srcdir)/headers-sh $(RM) $(INCLUDEDIR) $(srcdir) dlg_colors.h + @ $(SHELL) $(srcdir)/headers-sh $(RM) $(INCLUDEDIR) $(srcdir) dlg_keys.h + @ $(SHELL) $(srcdir)/headers-sh $(RM) $(INCLUDEDIR) . dlg_config.h install-lib :: $(MAN3DIR) @ echo "** installing @PACKAGE@.3" @@ -278,8 +276,8 @@ install-lib :: $(MAN3DIR) uninstall-lib :: $(RM) $(MAN3DIR)/@PACKAGE@.3 -headers.sed : headers-sh - $(SHELL) headers-sh $(INCLUDEDIR) $(srcdir) +headers.sed : $(srcdir)/headers-sh + $(SHELL) $(srcdir)/headers-sh $(INCLUDEDIR) $(srcdir) ################################################################################ TOP_DOCS = \ @@ -330,4 +328,4 @@ update-po: test -f $(PO_DIR)/makefile && cd $(PO_DIR) && $(MAKE) $@ lint: - $(LINT) $(LINT_OPTS) $(CPPFLAGS) *.c + $(LINT) $(CPPFLAGS) *.c diff --git a/contrib/dialog/menubox.c b/contrib/dialog/menubox.c index 58a714b..25005a4 100644 --- a/contrib/dialog/menubox.c +++ b/contrib/dialog/menubox.c @@ -1,9 +1,9 @@ /* - * $Id: menubox.c,v 1.132 2012/07/01 16:30:04 Zoltan.Kelemen Exp $ + * $Id: menubox.c,v 1.122 2011/06/29 09:48:46 tom Exp $ * * menubox.c -- implements the menu box * - * Copyright 2000-2011,2012 Thomas E. Dickey + * Copyright 2000-2010,2011 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 Licens, version 2.1e @@ -66,7 +66,7 @@ print_arrows(WINDOW *win, box_x + menu_width, box_y, box_y + menu_height + 1, - menubox_border2_attr, + menubox_attr, menubox_border_attr); } @@ -83,11 +83,14 @@ print_tag(WINDOW *win, int my_x = item_x; int my_y = ItemToRow(choice); int tag_width = (my_x - tag_x - GUTTER); + const int *cols; const int *indx; int limit; int prefix; + cols = dlg_index_columns(item->name); indx = dlg_index_wchars(item->name); + limit = dlg_count_wchars(item->name); prefix = (indx[1] - indx[0]); /* highlight first char of the tag to be special */ @@ -249,7 +252,7 @@ handle_button(int code, DIALOG_LISTITEM * items, int choice) return code; } -int +static int dlg_renamed_menutext(DIALOG_LISTITEM * items, int current, char *newtext) { if (dialog_vars.input_result) @@ -261,7 +264,7 @@ dlg_renamed_menutext(DIALOG_LISTITEM * items, int current, char *newtext) return DLG_EXIT_EXTRA; } -int +static int dlg_dummy_menutext(DIALOG_LISTITEM * items, int current, char *newtext) { (void) items; @@ -322,18 +325,17 @@ dlg_menu(const char *title, #endif int i, j, x, y, cur_x, cur_y, box_x, box_y; int key = 0, fkey; - int button = dialog_state.visit_items ? -1 : dlg_default_button(); + int button = dialog_state.visit_items ? -1 : dlg_defaultno_button(); int choice = dlg_default_listitem(items); int result = DLG_EXIT_UNKNOWN; int scrollamt = 0; - int max_choice; + int max_choice, min_width; int found; int use_height, use_width, name_width, text_width; WINDOW *dialog, *menu; char *prompt = dlg_strclone(cprompt); const char **buttons = dlg_ok_labels(); - bool is_inputmenu = ((rename_menutext != 0) - && (rename_menutext != dlg_dummy_menutext)); + bool is_inputmenu = (rename_menutext == dlg_renamed_menutext); dlg_does_output(); dlg_tab_correct_str(prompt); @@ -343,14 +345,13 @@ dlg_menu(const char *title, #endif use_height = menu_height; - use_width = dlg_calc_list_width(item_no, items) + 10; - use_width = MAX(26, use_width); if (use_height == 0) { + min_width = dlg_calc_list_width(item_no, items) + 10; /* calculate height without items (4) */ - dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, use_width); + dlg_auto_size(title, prompt, &height, &width, MIN_HIGH, MAX(26, min_width)); dlg_calc_listh(&height, &use_height, item_no); } else { - dlg_auto_size(title, prompt, &height, &width, MIN_HIGH + use_height, use_width); + dlg_auto_size(title, prompt, &height, &width, MIN_HIGH + use_height, 26); } dlg_button_layout(buttons, &width); dlg_print_size(height, width); @@ -365,8 +366,8 @@ dlg_menu(const char *title, dlg_mouse_setbase(x, y); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + 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); @@ -401,7 +402,7 @@ dlg_menu(const char *title, /* draw a box around the menu items */ dlg_draw_box(dialog, box_y, box_x, use_height + 2, menu_width + 2, - menubox_border_attr, menubox_border2_attr); + menubox_border_attr, menubox_attr); name_width = 0; text_width = 0; @@ -460,7 +461,6 @@ dlg_menu(const char *title, dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); - dlg_trace_win(dialog); while (result == DLG_EXIT_UNKNOWN) { if (button < 0) /* --visit-items */ wmove(dialog, box_y + ItemToRow(choice) + 1, box_x + tag_x + 1); @@ -687,14 +687,17 @@ dlg_menu(const char *title, FALSE, width); break; case DLGK_ENTER: - if (is_inputmenu) - result = dlg_ok_buttoncode(button); - else - result = dlg_enter_buttoncode(button); + result = dlg_enter_buttoncode(button); /* * If dlg_menu() is called from dialog_menu(), we want to - * capture the results into dialog_vars.input_result. + * capture the results into dialog_vars.input_result, but not + * if dlg_menu() is called directly from an application. We + * can check this by testing if rename_menutext is the function + * pointer owned by dialog_menu(). It would be nicer to have + * this logic inside dialog_menu(), but that cannot be done + * since we would lose compatibility for the results reported + * after input_menu_edit(). */ if (result == DLG_EXIT_ERROR) { result = DLG_EXIT_UNKNOWN; @@ -809,9 +812,7 @@ dialog_menu(const char *title, item_no, listitems, &choice, - (dialog_vars.input_menu - ? dlg_renamed_menutext - : dlg_dummy_menutext)); + dialog_vars.input_menu ? dlg_renamed_menutext : dlg_dummy_menutext); dlg_free_columns(&listitems[0].text, sizeof(DIALOG_LISTITEM), item_no); free(listitems); diff --git a/contrib/dialog/mixedform.c b/contrib/dialog/mixedform.c index 05ba7b1..b2fe538 100644 --- a/contrib/dialog/mixedform.c +++ b/contrib/dialog/mixedform.c @@ -1,9 +1,9 @@ /* - * $Id: mixedform.c,v 1.9 2011/10/10 00:49:43 tom Exp $ + * $Id: mixedform.c,v 1.8 2010/04/28 20:54:11 tom Exp $ * - * mixedform.c -- implements the mixed form (i.e, typed pairs label/editbox) + * formbox.c -- implements the form (i.e, some pairs label/editbox) * - * Copyright 2007-2010,2011 Thomas E. Dickey + * 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 diff --git a/contrib/dialog/mixedgauge.c b/contrib/dialog/mixedgauge.c index 6d78517..e15a4df 100644 --- a/contrib/dialog/mixedgauge.c +++ b/contrib/dialog/mixedgauge.c @@ -1,5 +1,5 @@ /* - * $Id: mixedgauge.c,v 1.29 2011/10/20 23:35:31 tom Exp $ + * $Id: mixedgauge.c,v 1.24 2011/06/27 08:16:38 tom Exp $ * * mixedgauge.c -- implements the mixedgauge dialog * @@ -113,6 +113,7 @@ myprint_status(DIALOG_MIXEDGAUGE * dlg) int y = MARGIN; int item; int cells = dlg->len_text - 2; + int rm = limit_x; /* right margin */ int lm = limit_x - dlg->len_text - 1; int bm = limit_y; /* bottom margin */ int last_y = 0, last_x = 0; @@ -122,6 +123,7 @@ myprint_status(DIALOG_MIXEDGAUGE * dlg) char *freeMe = 0; if (win) { + rm -= (2 * MARGIN); bm -= (2 * MARGIN); } if (win != 0) @@ -145,7 +147,7 @@ myprint_status(DIALOG_MIXEDGAUGE * dlg) (void) wmove(win, y, lm + (cells - (int) strlen(status)) / 2); if (freeMe) { (void) wmove(win, y, lm + 1); - (void) wattrset(win, title_attr); + wattrset(win, title_attr); for (j = 0; j < cells; j++) (void) waddch(win, ' '); @@ -155,7 +157,7 @@ myprint_status(DIALOG_MIXEDGAUGE * dlg) if ((title_attr & A_REVERSE) != 0) { wattroff(win, A_REVERSE); } else { - (void) wattrset(win, A_REVERSE); + wattrset(win, A_REVERSE); } (void) wmove(win, y, lm + 1); @@ -179,8 +181,6 @@ myprint_status(DIALOG_MIXEDGAUGE * dlg) (void) waddch(win, ']'); (void) wnoutrefresh(win); } - if (win != 0) - wmove(win, last_y, last_x); } static void @@ -192,10 +192,10 @@ mydraw_mixed_box(WINDOW *win, int y, int x, int height, int width, chtype attr = A_NORMAL; const char *message = _("Overall Progress"); chtype save2 = dlg_get_attrs(win); - (void) wattrset(win, title_attr); + wattrset(win, title_attr); (void) wmove(win, y, x + 2); dlg_print_text(win, message, width, &attr); - (void) wattrset(win, save2); + wattrset(win, save2); } } @@ -223,7 +223,7 @@ dlg_update_mixedgauge(DIALOG_MIXEDGAUGE * dlg, int percent) * attribute. */ (void) wmove(dlg->dialog, dlg->height - 3, 4); - (void) wattrset(dlg->dialog, gauge_attr); + wattrset(dlg->dialog, gauge_attr); for (i = 0; i < (dlg->width - 2 * (3 + MARGIN)); i++) (void) waddch(dlg->dialog, ' '); @@ -240,7 +240,7 @@ dlg_update_mixedgauge(DIALOG_MIXEDGAUGE * dlg, int percent) if ((title_attr & A_REVERSE) != 0) { wattroff(dlg->dialog, A_REVERSE); } else { - (void) wattrset(dlg->dialog, A_REVERSE); + wattrset(dlg->dialog, A_REVERSE); } (void) wmove(dlg->dialog, dlg->height - 3, 4); for (i = 0; i < x; i++) { @@ -251,7 +251,6 @@ dlg_update_mixedgauge(DIALOG_MIXEDGAUGE * dlg, int percent) (void) waddch(dlg->dialog, ch); } myprint_status(dlg); - dlg_trace_win(dlg->dialog); } /* @@ -325,11 +324,11 @@ dlg_begin_mixedgauge(DIALOG_MIXEDGAUGE * dlg, dlg->dialog = dlg_new_window(dlg->height, dlg->width, y, x); (void) werase(dlg->dialog); - dlg_draw_box2(dlg->dialog, - 0, 0, - dlg->height, - dlg->width, - dialog_attr, border_attr, border2_attr); + dlg_draw_box(dlg->dialog, + 0, 0, + dlg->height, + dlg->width, + dialog_attr, border_attr); dlg_draw_title(dlg->dialog, dlg->title); dlg_draw_helpline(dlg->dialog, FALSE); @@ -341,7 +340,7 @@ dlg_begin_mixedgauge(DIALOG_MIXEDGAUGE * dlg, dlg->width, y + dlg->item_no + (2 * MARGIN), x); - (void) wattrset(dlg->caption, dialog_attr); + wattrset(dlg->caption, dialog_attr); dlg_print_autowrap(dlg->caption, dlg->prompt, dlg->height, dlg->width); } diff --git a/contrib/dialog/msgbox.c b/contrib/dialog/msgbox.c index 1353209..25a021b 100644 --- a/contrib/dialog/msgbox.c +++ b/contrib/dialog/msgbox.c @@ -1,9 +1,9 @@ /* - * $Id: msgbox.c,v 1.74 2012/07/06 16:53:53 tom Exp $ + * $Id: msgbox.c,v 1.66 2011/06/27 08:36:28 tom Exp $ * * msgbox.c -- implements the message box and info box * - * Copyright 2000-2011,2012 Thomas E. Dickey + * Copyright 2000-2010,2011 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 @@ -39,14 +39,20 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width, static DLG_KEYS_BINDING binding[] = { HELPKEY_BINDINGS, ENTERKEY_BINDINGS, - TRAVERSE_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; + int button = 0; int key = 0, fkey; int result = DLG_EXIT_UNKNOWN; WINDOW *dialog = 0; @@ -56,18 +62,10 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width, int check; bool show = TRUE; int min_width = (pauseopt == 1 ? 12 : 0); - int save_nocancel = dialog_vars.nocancel; -#ifdef KEY_RESIZE - int req_high; - int req_wide; -#endif - - dialog_vars.nocancel = TRUE; - button = dlg_default_button(); #ifdef KEY_RESIZE - req_high = height; - req_wide = width; + int req_high = height; + int req_wide = width; restart: #endif @@ -97,13 +95,13 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width, dlg_mouse_setbase(x, y); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); + 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_box2(dialog, border_attr, border2_attr, dialog_attr); + 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); dlg_draw_helpline(dialog, FALSE); @@ -112,7 +110,6 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width, if (show) { last = dlg_print_scrolled(dialog, prompt, offset, page, width, pauseopt); - dlg_trace_win(dialog); show = FALSE; } key = dlg_mouse_wgetch(dialog, &fkey); @@ -120,7 +117,7 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width, break; if (!fkey && (check = dlg_char_to_button(key, buttons)) >= 0) { - result = dlg_ok_buttoncode(check); + result = check ? DLG_EXIT_HELP : DLG_EXIT_OK; break; } @@ -153,21 +150,22 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width, FALSE, width); break; case DLGK_ENTER: - result = dlg_ok_buttoncode(button); + 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 (is_DLGK_MOUSE(key)) { - result = dlg_ok_buttoncode(key - M_EVENT); - if (result < 0) - result = DLG_EXIT_OK; - } else if (dlg_check_scrolled(key, - last, - page, - &show, - &offset) == 0) { - } else { - beep(); - } + if (dlg_check_scrolled(key, + last, + page, + &show, + &offset) == 0) + break; + beep(); break; } } else { @@ -178,15 +176,11 @@ dialog_msgbox(const char *title, const char *cprompt, int height, int width, dlg_print_scrolled(dialog, prompt, offset, page, width, pauseopt); dlg_draw_helpline(dialog, FALSE); wrefresh(dialog); - dlg_trace_win(dialog); result = DLG_EXIT_OK; } dlg_del_window(dialog); dlg_mouse_free_regions(); free(prompt); - - dialog_vars.nocancel = save_nocancel; - return result; } diff --git a/contrib/dialog/package/debian/changelog b/contrib/dialog/package/debian/changelog index 62fe5da..51d497e 100644 --- a/contrib/dialog/package/debian/changelog +++ b/contrib/dialog/package/debian/changelog @@ -1,38 +1,3 @@ -cdialog (20120706) unstable; urgency=high - - * fix regression in msgbox (ArchLinux #30574) - - -- Thomas E. Dickey <dickey@invisible-island.net> Fri, 06 Jul 2012 12:52:46 -0400 - -cdialog (20120703) unstable; urgency=low - - * minor fixes - * add --default-button - - -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 30 Jun 2012 10:41:05 -0400 - -cdialog (20120215) unstable; urgency=low - - * minor fixes - - -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 15 Feb 2012 19:40:32 -0500 - -cdialog (20111020) unstable; urgency=high - - * fix regression in menubox.c logic for inputmenu vs menu. - - -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 19 Oct 2011 19:17:40 -0400 - -cdialog (20111018) unstable; urgency=high - - * improve color configurability - * misc bug-fixes. - * various improvements to tracing. - * remove an incorrect free() call in dlg_free_gauge() - * fix missing trailing null from dlg_align_columns - - -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 07 Sep 2011 20:04:04 -0400 - cdialog (20110707) unstable; urgency=high * fix a regression in dlg_getc() from 20110630 changes. diff --git a/contrib/dialog/package/dialog.spec b/contrib/dialog/package/dialog.spec index 5037ee6..f5df494 100644 --- a/contrib/dialog/package/dialog.spec +++ b/contrib/dialog/package/dialog.spec @@ -1,9 +1,9 @@ Summary: dialog - display dialog boxes from shell scripts %define AppProgram dialog %define AppVersion 1.1 -%define AppRelease 20120706 +%define AppRelease 20110707 %define ActualProg c%{AppProgram} -# $XTermId: dialog.spec,v 1.38 2012/07/06 16:51:44 tom Exp $ +# $XTermId: dialog.spec,v 1.24 2011/07/07 22:10:02 tom Exp $ Name: %{ActualProg} Version: %{AppVersion} Release: %{AppRelease} @@ -53,11 +53,8 @@ make [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT make install-full DESTDIR=$RPM_BUILD_ROOT -libtool --finish %{_libdir} strip $RPM_BUILD_ROOT%{_bindir}/%{ActualProg} -chmod 755 $RPM_BUILD_ROOT%{_libdir}/lib%{ActualProg}.so.*.*.* -rm -f $RPM_BUILD_ROOT%{_libdir}/lib%{ActualProg}.la %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT @@ -78,8 +75,5 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/lib%{ActualProg}.la %changelog # each patch should add its ChangeLog entries here -* Tue Oct 18 2011 Thomas Dickey -- add executable permissions for shared libraries, discard ".la" file. - * Thu Dec 30 2010 Thomas Dickey - initial version diff --git a/contrib/dialog/pause.c b/contrib/dialog/pause.c index acca9b7..c104a70 100644 --- a/contrib/dialog/pause.c +++ b/contrib/dialog/pause.c @@ -1,9 +1,9 @@ /* - * $Id: pause.c,v 1.36 2012/07/03 00:01:59 tom Exp $ + * $Id: pause.c,v 1.29 2011/06/29 09:48:53 tom Exp $ * * pause.c -- implements the pause dialog * - * Copyright 2004-2011,2012 Thomas E. Dickey + * Copyright 2004-2010,2011 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 @@ -55,7 +55,13 @@ dialog_pause(const char *title, static DLG_KEYS_BINDING binding[] = { HELPKEY_BINDINGS, ENTERKEY_BINDINGS, - TRAVERSE_BINDINGS, + DLG_KEYS_DATA( DLGK_ENTER, ' ' ), + 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* */ @@ -66,24 +72,21 @@ dialog_pause(const char *title, #endif int i, x, y, step; - int button = dlg_default_button(); + int button = 0; int seconds_orig; WINDOW *dialog; const char **buttons = dlg_ok_labels(); bool have_buttons = (dlg_button_count(buttons) != 0); - bool first; int key = 0, fkey; int result = DLG_EXIT_UNKNOWN; int button_high = (have_buttons ? BTN_HIGH : MARGIN); int gauge_y; char *prompt = dlg_strclone(cprompt); - int save_timeout = dialog_vars.timeout_secs; curs_set(0); dlg_tab_correct_str(prompt); - dialog_vars.timeout_secs = 0; seconds_orig = (seconds > 0) ? seconds : 1; #ifdef KEY_RESIZE @@ -117,23 +120,21 @@ dialog_pause(const char *title, dlg_mouse_setbase(x, y); nodelay(dialog, TRUE); - first = TRUE; do { (void) werase(dialog); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); dlg_draw_title(dialog, title); dlg_draw_helpline(dialog, FALSE); - (void) wattrset(dialog, dialog_attr); + wattrset(dialog, dialog_attr); dlg_print_autowrap(dialog, prompt, height, width); - dlg_draw_box2(dialog, - gauge_y, 2 + MARGIN, - 2 + MARGIN, width - 2 * (2 + MARGIN), - dialog_attr, - border_attr, - border2_attr); + dlg_draw_box(dialog, + gauge_y, 2 + MARGIN, + 2 + MARGIN, width - 2 * (2 + MARGIN), + dialog_attr, + border_attr); /* * Clear the area for the progress bar by filling it with spaces @@ -141,7 +142,7 @@ dialog_pause(const char *title, * attribute. */ (void) wmove(dialog, gauge_y + MARGIN, 4); - (void) wattrset(dialog, title_attr); + wattrset(dialog, title_attr); for (i = 0; i < (width - 2 * (3 + MARGIN)); i++) (void) waddch(dialog, ' '); @@ -158,7 +159,7 @@ dialog_pause(const char *title, if ((title_attr & A_REVERSE) != 0) { wattroff(dialog, A_REVERSE); } else { - (void) wattrset(dialog, A_REVERSE); + wattrset(dialog, A_REVERSE); } (void) wmove(dialog, gauge_y + MARGIN, 4); for (i = 0; i < x; i++) { @@ -171,14 +172,10 @@ dialog_pause(const char *title, mouse_mkbutton(height - 2, width / 2 - 4, 6, '\n'); if (have_buttons) { - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_bottom_box(dialog); dlg_draw_buttons(dialog, height - 2, 0, buttons, button, FALSE, width); } - if (first) { - (void) wrefresh(dialog); - dlg_trace_win(dialog); - first = FALSE; - } + (void) wrefresh(dialog); for (step = 0; (result == DLG_EXIT_UNKNOWN) && (step < 1000); @@ -222,25 +219,24 @@ dialog_pause(const char *title, case DLGK_ENTER: result = dlg_enter_buttoncode(button); break; + case DLGK_MOUSE(0): + result = DLG_EXIT_OK; + break; + case DLGK_MOUSE(1): + result = DLG_EXIT_CANCEL; + break; case ERR: break; default: - if (is_DLGK_MOUSE(key)) { - result = dlg_ok_buttoncode(key - M_EVENT); - if (result < 0) - result = DLG_EXIT_OK; - } break; } } } while ((result == DLG_EXIT_UNKNOWN) && (seconds-- > 0)); + nodelay(dialog, FALSE); curs_set(1); dlg_mouse_free_regions(); dlg_del_window(dialog); free(prompt); - - dialog_vars.timeout_secs = save_timeout; - return ((result == DLG_EXIT_UNKNOWN) ? DLG_EXIT_OK : result); } diff --git a/contrib/dialog/po/cs.po b/contrib/dialog/po/cs.po index 7986891..b4a40e9 100644 --- a/contrib/dialog/po/cs.po +++ b/contrib/dialog/po/cs.po @@ -1,23 +1,15 @@ -# Czech translations for dialog package. -# Copyright (C) 2011 THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the dialog package. -# -# Martin Povolny <martin@solnet.cz> -# Marek ÄŒernocký <marek@manet.cz>, 2011. -# +# From: Martin Povolny <martin@solnet.cz> msgid "" msgstr "" -"Project-Id-Version: dialog 1.1.20080819\n" +"Project-Id-Version: dialog 0.9a-20010527\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2008-06-18 18:26-0400\n" -"PO-Revision-Date: 2011-11-25 13:18+0100\n" -"Last-Translator: Marek ÄŒernocký <marek@manet.cz>\n" -"Language-Team: Czech <translation-team-cs@lists.sourceforge.net>\n" -"Language: cs\n" +"PO-Revision-Date: 2004-12-19 20:14-0500\n" +"Last-Translator: Martin Povolny <martin@solnet.cz>\n" +"Language-Team:\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" +"Content-Transfer-Encoding: 8-bit\n" #: buttons.c:385 msgid "Yes" @@ -29,7 +21,7 @@ msgstr "Ne" #: buttons.c:401 msgid "OK" -msgstr "Budiž" +msgstr "OK" #: buttons.c:409 msgid "Cancel" @@ -41,11 +33,11 @@ msgstr "Konec" #: buttons.c:425 msgid "Extra" -msgstr "DalÅ¡Ã" +msgstr "" #: buttons.c:433 msgid "Help" -msgstr "NápovÄ›da" +msgstr "" #. Headline "Month" #: calendar.c:273 @@ -59,11 +51,11 @@ msgstr "Rok" #: dialog.c:741 msgid "Rename" -msgstr "PÅ™ejmenovat" +msgstr "" #: fselect.c:550 msgid "Directories" -msgstr "Složky" +msgstr "Adresáře" #: fselect.c:551 msgid "Files" @@ -71,44 +63,46 @@ msgstr "Soubory" #: mixedgauge.c:58 msgid "Succeeded" -msgstr "Úspěšné" +msgstr "" #: mixedgauge.c:61 +#, fuzzy msgid "Failed" -msgstr "Selhalo" +msgstr "Soubory" #: mixedgauge.c:64 msgid "Passed" -msgstr "Pozastaveno" +msgstr "" #: mixedgauge.c:67 msgid "Completed" -msgstr "DokonÄeno" +msgstr "" #: mixedgauge.c:70 msgid "Checked" -msgstr "Zkontrolováno" +msgstr "" #: mixedgauge.c:73 msgid "Done" -msgstr "Hotovo" +msgstr "" #: mixedgauge.c:76 msgid "Skipped" -msgstr "PÅ™eskoÄeno" +msgstr "" #: mixedgauge.c:79 msgid "In Progress" -msgstr "ProbÃhá" +msgstr "" #: mixedgauge.c:85 msgid "N/A" -msgstr "Nenà známo" +msgstr "" #: mixedgauge.c:193 msgid "Overall Progress" -msgstr "Celkový průbÄ›h" +msgstr "" #: textbox.c:489 +#, fuzzy msgid "Search" -msgstr "Hledat" +msgstr "Search" diff --git a/contrib/dialog/po/el.po b/contrib/dialog/po/el.po index 2fadd9b..3b87e8e 100644 --- a/contrib/dialog/po/el.po +++ b/contrib/dialog/po/el.po @@ -1,20 +1,14 @@ -# Greek translation for dialog. -# This file is distributed under the same license as the dialog package. -# Copyright (C) 2008 Free Software Foundation, Inc. -# Savvas Radevic <vicedar@gmail.com>, 2012. -# msgid "" msgstr "" -"Project-Id-Version: dialog 1.1.20080819\n" +"Project-Id-Version: Dialog\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2008-06-18 18:26-0400\n" -"PO-Revision-Date: 2012-03-18 00:54+0100\n" -"Last-Translator: Savvas Radevic <vicedar@gmail.com>\n" -"Language-Team: Greek <team@lists.gnome.gr>\n" -"Language: el\n" +"PO-Revision-Date: 2002-06-05 10:00GMT+2\n" +"Last-Translator: kromJx <kromJx@crosswinds.net>\n" +"Language-Team: <i18ngr@hellug.gr>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" +"Content-Transfer-Encoding: 8-bit\n" #: buttons.c:385 msgid "Yes" @@ -26,7 +20,7 @@ msgstr "Όχι" #: buttons.c:401 msgid "OK" -msgstr "Εντάξει" +msgstr "OK" #: buttons.c:409 msgid "Cancel" @@ -38,7 +32,7 @@ msgstr "Έξοδος" #: buttons.c:425 msgid "Extra" -msgstr "Î Ïόσθετα" +msgstr "" #: buttons.c:433 msgid "Help" @@ -56,7 +50,7 @@ msgstr "Έτος" #: dialog.c:741 msgid "Rename" -msgstr "Μετονομασία" +msgstr "" #: fselect.c:550 msgid "Directories" @@ -68,44 +62,46 @@ msgstr "ΑÏχεία" #: mixedgauge.c:58 msgid "Succeeded" -msgstr "Επιτυχία" +msgstr "" #: mixedgauge.c:61 +#, fuzzy msgid "Failed" -msgstr "Αποτυχία" +msgstr "ΑÏχεία" #: mixedgauge.c:64 msgid "Passed" -msgstr "Î ÎÏασε" +msgstr "" #: mixedgauge.c:67 msgid "Completed" -msgstr "ΟλοκλήÏωση" +msgstr "" #: mixedgauge.c:70 msgid "Checked" -msgstr "Έλεγχος" +msgstr "" #: mixedgauge.c:73 msgid "Done" -msgstr "ΤÎλος" +msgstr "" #: mixedgauge.c:76 msgid "Skipped" -msgstr "ΠαÏάλειψη" +msgstr "" #: mixedgauge.c:79 msgid "In Progress" -msgstr "Σε εξÎλιξη" +msgstr "" #: mixedgauge.c:85 msgid "N/A" -msgstr "Μη ΔιαθÎσιμο" +msgstr "" #: mixedgauge.c:193 msgid "Overall Progress" -msgstr "Συνολική Ï€Ïόοδος" +msgstr "" #: textbox.c:489 +#, fuzzy msgid "Search" -msgstr "Αναζήτηση" +msgstr "Search" diff --git a/contrib/dialog/po/hr.po b/contrib/dialog/po/hr.po index c3661db..6f3f546 100644 --- a/contrib/dialog/po/hr.po +++ b/contrib/dialog/po/hr.po @@ -1,112 +1,110 @@ -# Dialog -# Copyright 2003-2007,2008 # Thomas Dickey +# Croatian translation of Dialog. # This file is distributed under the same license as the dialog package. -# Tomislav Krznar <tomislav.krznar@gmail.com>, 2012. +# Copyright (C) 2005 Thomas Dickey. # msgid "" msgstr "" -"Project-Id-Version: dialog 1.1.20080819\n" +"Project-Id-Version: Dialog 1.0-20050116\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-06-18 18:26-0400\n" -"PO-Revision-Date: 2012-03-31 00:10+0200\n" -"Last-Translator: Tomislav Krznar <tomislav.krznar@gmail.com>\n" +"POT-Creation-Date: 2011-01-16 17:57-0500\n" +"PO-Revision-Date: 2004-07-25 14:52+0200\n" +"Last-Translator: Krunoslav Gernhard <kruno@linux.hr>\n" "Language-Team: Croatian <lokalizacija@linux.hr>\n" "Language: hr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" -#: buttons.c:385 +#: buttons.c:387 msgid "Yes" msgstr "Da" -#: buttons.c:393 +#: buttons.c:395 msgid "No" msgstr "Ne" -#: buttons.c:401 +#: buttons.c:403 msgid "OK" msgstr "U redu" -#: buttons.c:409 +#: buttons.c:411 msgid "Cancel" msgstr "Otkaži" -#: buttons.c:417 +#: buttons.c:419 msgid "EXIT" -msgstr "IZLAZ" +msgstr "" -#: buttons.c:425 +#: buttons.c:427 msgid "Extra" -msgstr "Dodatno" +msgstr "" -#: buttons.c:433 +#: buttons.c:435 msgid "Help" -msgstr "Pomoć" +msgstr "" #. Headline "Month" -#: calendar.c:273 +#: calendar.c:298 msgid "Month" -msgstr "Mjesec" +msgstr "" #. Headline "Year" -#: calendar.c:293 +#: calendar.c:318 msgid "Year" -msgstr "Godina" +msgstr "" -#: dialog.c:741 +#: dialog.c:756 msgid "Rename" -msgstr "Preimenuj" +msgstr "" -#: fselect.c:550 +#: fselect.c:571 msgid "Directories" -msgstr "Direktoriji" +msgstr "" -#: fselect.c:551 +#: fselect.c:572 msgid "Files" -msgstr "Datoteke" +msgstr "" #: mixedgauge.c:58 msgid "Succeeded" -msgstr "Uspjeh" +msgstr "" #: mixedgauge.c:61 msgid "Failed" -msgstr "Neuspjeh" +msgstr "" #: mixedgauge.c:64 msgid "Passed" -msgstr "ProÅ¡lo" +msgstr "" #: mixedgauge.c:67 msgid "Completed" -msgstr "DovrÅ¡eno" +msgstr "" #: mixedgauge.c:70 msgid "Checked" -msgstr "Provjereno" +msgstr "" #: mixedgauge.c:73 msgid "Done" -msgstr "Gotovo" +msgstr "" #: mixedgauge.c:76 msgid "Skipped" -msgstr "PreskoÄeno" +msgstr "" #: mixedgauge.c:79 msgid "In Progress" -msgstr "U tijeku" +msgstr "" #: mixedgauge.c:85 msgid "N/A" -msgstr "Nedostupno" +msgstr "" #: mixedgauge.c:193 msgid "Overall Progress" -msgstr "Ukupni napredak" +msgstr "" -#: textbox.c:489 +#: textbox.c:468 msgid "Search" -msgstr "Pretraga" +msgstr "" diff --git a/contrib/dialog/po/sr.po b/contrib/dialog/po/sr.po index 46b049d..9414692 100644 --- a/contrib/dialog/po/sr.po +++ b/contrib/dialog/po/sr.po @@ -1,21 +1,18 @@ -# Serbian translation of dialog. +# Serbian translation of `dialog'. # Copyright (C) 2005 Free Software Foundation, Inc. -# This file is distributed under the same license as the dialog package. +# This file is distributed under the same license as the `dialog' package. # Aleksandar Jelenak <jelenak@verizon.net>, 2005. -# МироÑлав Ðиколић <miroslavnikolic@rocketmail.com>, 2011. msgid "" msgstr "" -"Project-Id-Version: dialog-1.1.20080819\n" +"Project-Id-Version: dialog 1.0-rel20041222\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2008-06-18 18:26-0400\n" -"PO-Revision-Date: 2011-12-24 21:29+0200\n" -"Last-Translator: МироÑлав Ðиколић <miroslavnikolic@rocketmail.com>\n" +"PO-Revision-Date: 2005-08-21 12:53-0400\n" +"Last-Translator: Aleksandar Jelenak <jelenak@verizon.net>\n" "Language-Team: Serbian <gnu@prevod.org>\n" -"Language: sr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #: buttons.c:385 msgid "Yes" @@ -69,43 +66,44 @@ msgstr "Датотеке" #: mixedgauge.c:58 msgid "Succeeded" -msgstr "УÑпешно" +msgstr "" #: mixedgauge.c:61 +#, fuzzy msgid "Failed" -msgstr "ÐеуÑпешно" +msgstr "Датотеке" #: mixedgauge.c:64 msgid "Passed" -msgstr "Прошло" +msgstr "" #: mixedgauge.c:67 msgid "Completed" -msgstr "Завршено" +msgstr "" #: mixedgauge.c:70 msgid "Checked" -msgstr "Проверено" +msgstr "" #: mixedgauge.c:73 msgid "Done" -msgstr "Урађено" +msgstr "" #: mixedgauge.c:76 msgid "Skipped" -msgstr "ПреÑкочено" +msgstr "" #: mixedgauge.c:79 msgid "In Progress" -msgstr "У току" +msgstr "" #: mixedgauge.c:85 msgid "N/A" -msgstr "Ð/Д" +msgstr "" #: mixedgauge.c:193 msgid "Overall Progress" -msgstr "Укупно напредовање" +msgstr "" #: textbox.c:489 msgid "Search" diff --git a/contrib/dialog/prgbox.c b/contrib/dialog/prgbox.c index cd7bb8c..a3b3ea6 100644 --- a/contrib/dialog/prgbox.c +++ b/contrib/dialog/prgbox.c @@ -1,5 +1,5 @@ /* - * $Id: prgbox.c,v 1.8 2011/10/20 23:42:32 tom Exp $ + * $Id: prgbox.c,v 1.7 2011/06/30 20:44:13 tom Exp $ * * prgbox.c -- implements the prg box * @@ -31,10 +31,11 @@ dlg_popen(const char *command, const char *type) { FILE *result = 0; int fd[2]; + int pid; const char *argv[4]; if ((*type == 'r' || *type != 'w') && pipe(fd) == 0) { - switch (fork()) { + switch (pid = fork()) { case -1: /* Error. */ (void) close(fd[0]); (void) close(fd[1]); diff --git a/contrib/dialog/progressbox.c b/contrib/dialog/progressbox.c index 077339c..024e288 100644 --- a/contrib/dialog/progressbox.c +++ b/contrib/dialog/progressbox.c @@ -1,5 +1,5 @@ /* - * $Id: progressbox.c,v 1.21 2012/07/03 00:12:52 tom Exp $ + * $Id: progressbox.c,v 1.13 2011/06/27 08:18:20 tom Exp $ * * progressbox.c -- implements the progress box * @@ -99,7 +99,6 @@ print_line(MY_OBJ * obj, WINDOW *win, int row, int width) #endif getyx(win, y, x); - (void) y; /* Clear 'residue' of previous line */ for (i = 0; i < width - x; i++) (void) waddch(win, ' '); @@ -112,79 +111,54 @@ pause_for_ok(WINDOW *dialog, int height, int width) static DLG_KEYS_BINDING binding[] = { HELPKEY_BINDINGS, ENTERKEY_BINDINGS, - TRAVERSE_BINDINGS, + DLG_KEYS_DATA( DLGK_ENTER, ' ' ), END_KEYS_BINDING }; /* *INDENT-ON* */ - int button; + int button = 0; int key = 0, fkey; int result = DLG_EXIT_UNKNOWN; const char **buttons = dlg_ok_label(); int check; - int save_nocancel = dialog_vars.nocancel; - bool redraw = TRUE; - - dialog_vars.nocancel = TRUE; - button = dlg_default_button(); dlg_register_window(dialog, "progressbox", binding); dlg_register_buttons(dialog, "progressbox", buttons); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + 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 (redraw) { - redraw = FALSE; - if (button < 0) - button = 0; - dlg_draw_buttons(dialog, - height - 2, 0, - buttons, button, - FALSE, width); - } - key = dlg_mouse_wgetch(dialog, &fkey); if (dlg_result_key(key, fkey, &result)) break; if (!fkey && (check = dlg_char_to_button(key, buttons)) >= 0) { - result = dlg_ok_buttoncode(check); + result = check ? DLG_EXIT_HELP : DLG_EXIT_OK; break; } if (fkey) { switch (key) { - case DLGK_FIELD_NEXT: - button = dlg_next_button(buttons, button); - redraw = TRUE; + case DLGK_ENTER: + result = button ? DLG_EXIT_HELP : DLG_EXIT_OK; break; - case DLGK_FIELD_PREV: - button = dlg_prev_button(buttons, button); - redraw = TRUE; + case DLGK_MOUSE(0): + result = DLG_EXIT_OK; break; - case DLGK_ENTER: - result = dlg_ok_buttoncode(button); + case DLGK_MOUSE(1): + result = DLG_EXIT_HELP; break; default: - if (is_DLGK_MOUSE(key)) { - result = dlg_ok_buttoncode(key - M_EVENT); - if (result < 0) - result = DLG_EXIT_OK; - } else { - beep(); - } + beep(); break; } - } else { beep(); } } dlg_unregister_window(dialog); - - dialog_vars.nocancel = save_nocancel; return result; } @@ -214,17 +188,16 @@ dlg_progressbox(const char *title, dialog = dlg_new_window(height, width, y, x); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); dlg_draw_title(dialog, title); dlg_draw_helpline(dialog, FALSE); if (*prompt != '\0') { int y2, x2; - (void) wattrset(dialog, dialog_attr); + wattrset(dialog, dialog_attr); dlg_print_autowrap(dialog, prompt, height, width); getyx(dialog, y2, x2); - (void) x2; ++y2; wmove(dialog, y2, MARGIN); for (i = 0; i < getmaxx(dialog) - 2 * MARGIN; i++) @@ -263,7 +236,6 @@ dlg_progressbox(const char *title, print_line(obj, text, thigh - 1, width - (2 * MARGIN)); } (void) wrefresh(text); - dlg_trace_win(dialog); if (obj->is_eof) break; } @@ -282,7 +254,7 @@ dlg_progressbox(const char *title, free(prompt); free(obj); - return result; + return DLG_EXIT_OK; } /* diff --git a/contrib/dialog/rc.c b/contrib/dialog/rc.c index cc6af29..2e2c7e6 100644 --- a/contrib/dialog/rc.c +++ b/contrib/dialog/rc.c @@ -1,5 +1,5 @@ /* - * $Id: rc.c,v 1.49 2011/10/15 00:56:44 tom Exp $ + * $Id: rc.c,v 1.47 2011/06/20 22:30:04 tom Exp $ * * rc.c -- routines for processing the configuration file * @@ -203,10 +203,9 @@ attr_to_str(char *str, int fg, int bg, int hl) /* * Extract the foreground, background and highlight values from an attribute - * represented as a string in one of two forms: + * represented as a string in this form: * * "(foreground,background,highlight)" - " "xxxx_color" */ static int str_to_attr(char *str, int *fg, int *bg, int *hl) @@ -215,15 +214,8 @@ str_to_attr(char *str, int *fg, int *bg, int *hl) unsigned j; char tempstr[MAX_LEN + 1], *part; - if (str[0] != '(' || lastch(str) != ')') { - if ((i = find_color(str)) >= 0) { - *fg = dlg_color_table[i].fg; - *bg = dlg_color_table[i].bg; - *hl = dlg_color_table[i].hilite; - return 0; - } + if (str[0] != '(' || lastch(str) != ')') return -1; /* invalid representation */ - } /* remove the parenthesis */ strcpy(tempstr, str + 1); @@ -432,29 +424,13 @@ dlg_create_rc(const char *filename) #ifdef HAVE_COLOR for (i = 0; i < (unsigned) dlg_color_count(); ++i) { char buffer[MAX_LEN + 1]; - unsigned j; - bool repeat = FALSE; fprintf(rc_file, "\n# %s\n", dlg_color_table[i].comment); - for (j = 0; j != i; ++j) { - if (dlg_color_table[i].fg == dlg_color_table[j].fg - && dlg_color_table[i].bg == dlg_color_table[j].bg - && dlg_color_table[i].hilite == dlg_color_table[j].hilite) { - fprintf(rc_file, "%s = %s\n", - dlg_color_table[i].name, - dlg_color_table[j].name); - repeat = TRUE; - break; - } - } - - if (!repeat) { - fprintf(rc_file, "%s = %s\n", dlg_color_table[i].name, - attr_to_str(buffer, - dlg_color_table[i].fg, - dlg_color_table[i].bg, - dlg_color_table[i].hilite)); - } + fprintf(rc_file, "%s = %s\n", dlg_color_table[i].name, + attr_to_str(buffer, + dlg_color_table[i].fg, + dlg_color_table[i].bg, + dlg_color_table[i].hilite)); } #endif /* HAVE_COLOR */ dlg_dump_keys(rc_file); @@ -531,10 +507,7 @@ dlg_parse_rc(void) lastch(str) = '\0'; if (begins_with(str, "bindkey", ¶ms)) { - if (!dlg_parse_bindkey(params)) { - fprintf(stderr, "\nParse error: line %d of configuration\n", l); - result = -1; - } + dlg_parse_bindkey(params); continue; } parse = parse_line(str, &var, &value); /* parse current line */ diff --git a/contrib/dialog/samples/copifuncs/admin.funcs b/contrib/dialog/samples/copifuncs/admin.funcs index ff1b80d..27800dc 100755 --- a/contrib/dialog/samples/copifuncs/admin.funcs +++ b/contrib/dialog/samples/copifuncs/admin.funcs @@ -1,5 +1,5 @@ -#!/usr/bin/env bash -# $Id: admin.funcs,v 1.3 2012/02/16 01:29:39 tom Exp $ +#!/bin/bash +# $Id: admin.funcs,v 1.2 2001/01/15 22:20:11 tom Exp $ # # ComeOn Point Functions! v0.9.2 # - usate da vari altri moduli ComeOn Point... diff --git a/contrib/dialog/samples/copifuncs/common.funcs b/contrib/dialog/samples/copifuncs/common.funcs index 63640c4..04eca9a 100755 --- a/contrib/dialog/samples/copifuncs/common.funcs +++ b/contrib/dialog/samples/copifuncs/common.funcs @@ -1,5 +1,3 @@ -#!/usr/bin/env bash -# $Id: common.funcs,v 1.2 2012/06/29 22:33:42 tom Exp $ # # ComeOn Point Functions! v0.9.2 # - usate da vari altri moduli ComeOn Point... diff --git a/contrib/dialog/samples/copifuncs/copi.funcs b/contrib/dialog/samples/copifuncs/copi.funcs index 87a623c..7be4bdb 100755 --- a/contrib/dialog/samples/copifuncs/copi.funcs +++ b/contrib/dialog/samples/copifuncs/copi.funcs @@ -1,5 +1,5 @@ -#!/usr/bin/env bash -# $Id: copi.funcs,v 1.4 2012/02/16 01:29:39 tom Exp $ +#!/bin/bash +# $Id: copi.funcs,v 1.3 2001/01/15 22:24:26 tom Exp $ # ComeOn Point Functions! v0.9.2 # - usate da vari altri moduli ComeOn Point... # @@ -244,7 +244,7 @@ create_innconf_newsfeeds_distrib() { save $INNCONF cat <<EOF >$INNCONF -## $Revision: 1.4 $ +## $Revision: 1.3 $ ## inn.conf -- inn configuration data ## Format: ## <parameter>:<whitespace><value> @@ -350,7 +350,7 @@ create_nnrpaccess() { save $NNRPACCESS cat <<EOF >$NNRPACCESS -## $Revision: 1.4 $ +## $Revision: 1.3 $ ## nnrp.access - access file for on-campus NNTP sites ## Format: ## <host>:<perm>:<user>:<pass>:<groups> @@ -386,7 +386,7 @@ create_hostsnntp() { save $HOSTSNNTP cat <<EOF >$HOSTSNNTP -## $Revision: 1.4 $ +## $Revision: 1.3 $ ## hosts.nntp - names and addresses that feed us news ## Format ## <host>: diff --git a/contrib/dialog/samples/copifuncs/copi.ifman2 b/contrib/dialog/samples/copifuncs/copi.ifman2 index 7a111bf..0b6dbb7 100755 --- a/contrib/dialog/samples/copifuncs/copi.ifman2 +++ b/contrib/dialog/samples/copifuncs/copi.ifman2 @@ -1,6 +1,3 @@ -# vile:perlmode -# $Id: copi.ifman2,v 1.2 2012/06/29 22:33:42 tom Exp $ - if ( getpwuid($<) ne $ifowner ) { print "You must be owner of ifmail\n"; exit 1; } if ( (@ARGV < 3) || $ARGV[0] eq "-?" || $ARGV[0] eq "-h" ) { diff --git a/contrib/dialog/samples/copifuncs/copi.ifpoll2 b/contrib/dialog/samples/copifuncs/copi.ifpoll2 index ea4deb1..216bff0 100755 --- a/contrib/dialog/samples/copifuncs/copi.ifpoll2 +++ b/contrib/dialog/samples/copifuncs/copi.ifpoll2 @@ -1,5 +1,3 @@ -#!/usr/bin/env bash -# $Id: copi.ifpoll2,v 1.2 2012/06/29 22:33:42 tom Exp $ # Packets backup directory - You have to CREATE this directory BAK=/var/spool/ifmail/BAK diff --git a/contrib/dialog/samples/copifuncs/copi.ifreq2 b/contrib/dialog/samples/copifuncs/copi.ifreq2 index 19ff08c..9ee78ff 100755 --- a/contrib/dialog/samples/copifuncs/copi.ifreq2 +++ b/contrib/dialog/samples/copifuncs/copi.ifreq2 @@ -1,6 +1,3 @@ -#!/usr/bin/perl -# $Id: copi.ifreq2,v 1.2 2012/06/29 22:33:42 tom Exp $ -# # this is the base directory, where the req-files are stored and the # default outbound $flo_path = "/var/spool/ifmail"; diff --git a/contrib/dialog/samples/copifuncs/copi.sendifm1 b/contrib/dialog/samples/copifuncs/copi.sendifm1 index dcf9c78..564b9c6 100755 --- a/contrib/dialog/samples/copifuncs/copi.sendifm1 +++ b/contrib/dialog/samples/copifuncs/copi.sendifm1 @@ -1,5 +1,5 @@ -#!/usr/bin/env bash -# $Id: copi.sendifm1,v 1.2 2012/06/29 22:33:42 tom Exp $ +#! /bin/sh +## $Revision: 1.1 $ ## SH script to send UUCP batches out. ## =()<. @<_PATH_SHELLVARS>@>()= diff --git a/contrib/dialog/samples/copifuncs/copi.wheel b/contrib/dialog/samples/copifuncs/copi.wheel index ecb5061..567e559 100755 --- a/contrib/dialog/samples/copifuncs/copi.wheel +++ b/contrib/dialog/samples/copifuncs/copi.wheel @@ -1,5 +1,5 @@ -#!/bin/sh -# $Id: copi.wheel,v 1.4 2012/06/29 10:53:52 tom Exp $ +#!/bin/bash +# $Id: copi.wheel,v 1.2 2001/01/15 22:26:33 tom Exp $ mkstemp size dialog --print-maxsize 2>$tmp_size @@ -9,10 +9,10 @@ rm $tmp_size # Takes an integer, multiplies it for COLS, divides for 132 scalex() { - expr $1 \* $COLS / 132 + echo $[$1*$COLS/132] } scaley() { - expr $1 \* $ROWS / 60 + echo $[$1*$ROWS/60] } dialog --backtitle "$TITLE" --no-shadow \ diff --git a/contrib/dialog/samples/copismall b/contrib/dialog/samples/copismall index 537c4ac..3dfb485 100755 --- a/contrib/dialog/samples/copismall +++ b/contrib/dialog/samples/copismall @@ -1,5 +1,5 @@ -#!/usr/bin/env bash -# $Id: copismall,v 1.9 2012/02/16 01:29:39 Pedro.Giffuni Exp $ +#!/bin/bash +# $Id: copismall,v 1.8 2010/01/13 10:26:52 tom Exp $ # # ComeOn Point Installer! v0.9a.small (small version for cdialog v0.9a) # - installa il point in modo visuale e auto-detecting. Versione light. diff --git a/contrib/dialog/samples/debian.rc b/contrib/dialog/samples/debian.rc index 195d798..3b42eb8 100644 --- a/contrib/dialog/samples/debian.rc +++ b/contrib/dialog/samples/debian.rc @@ -1,4 +1,4 @@ -# $Id: debian.rc,v 1.7 2011/10/15 01:00:09 tom Exp $ +# $Id: debian.rc,v 1.5 2011/01/17 00:14:53 tom Exp $ # vile:confmode # Run-time configuration file for dialog, matches Debian color scheme. # (these are the default values for dialog) @@ -47,10 +47,10 @@ border_color = (WHITE,WHITE,ON) button_active_color = (WHITE,BLUE,ON) # Inactive button color -button_inactive_color = dialog_color +button_inactive_color = (BLACK,WHITE,OFF) # Active button key color -button_key_active_color = button_active_color +button_key_active_color = (WHITE,BLUE,ON) # Inactive button key color button_key_inactive_color = (RED,WHITE,OFF) @@ -62,64 +62,64 @@ button_label_active_color = (YELLOW,BLUE,ON) button_label_inactive_color = (BLACK,WHITE,ON) # Input box color -inputbox_color = dialog_color +inputbox_color = (BLACK,WHITE,OFF) # Input box border color -inputbox_border_color = dialog_color +inputbox_border_color = (BLACK,WHITE,OFF) # Search box color -searchbox_color = dialog_color +searchbox_color = (BLACK,WHITE,OFF) # Search box title color -searchbox_title_color = title_color +searchbox_title_color = (BLUE,WHITE,ON) # Search box border color -searchbox_border_color = border_color +searchbox_border_color = (WHITE,WHITE,ON) # File position indicator color -position_indicator_color = title_color +position_indicator_color = (BLUE,WHITE,ON) # Menu box color -menubox_color = dialog_color +menubox_color = (BLACK,WHITE,OFF) # Menu box border color -menubox_border_color = border_color +menubox_border_color = (WHITE,WHITE,ON) # Item color -item_color = dialog_color +item_color = (BLACK,WHITE,OFF) # Selected item color -item_selected_color = button_active_color +item_selected_color = (WHITE,BLUE,ON) # Tag color -tag_color = title_color +tag_color = (BLUE,WHITE,ON) # Selected tag color -tag_selected_color = button_label_active_color +tag_selected_color = (YELLOW,BLUE,ON) # Tag key color -tag_key_color = button_key_inactive_color +tag_key_color = (RED,WHITE,OFF) # Selected tag key color tag_key_selected_color = (RED,BLUE,ON) # Check box color -check_color = dialog_color +check_color = (BLACK,WHITE,OFF) # Selected check box color -check_selected_color = button_active_color +check_selected_color = (WHITE,BLUE,ON) # Up arrow color uarrow_color = (GREEN,WHITE,ON) # Down arrow color -darrow_color = uarrow_color +darrow_color = (GREEN,WHITE,ON) # Item help-text color itemhelp_color = (WHITE,BLACK,OFF) # Active form text color -form_active_text_color = button_active_color +form_active_text_color = (WHITE,BLUE,ON) # Form text color form_text_color = (WHITE,CYAN,ON) @@ -128,16 +128,4 @@ form_text_color = (WHITE,CYAN,ON) form_item_readonly_color = (CYAN,WHITE,ON) # Dialog box gauge color -gauge_color = title_color - -# Dialog box border2 color -border2_color = dialog_color - -# Input box border2 color -inputbox_border2_color = dialog_color - -# Search box border2 color -searchbox_border2_color = dialog_color - -# Menu box border2 color -menubox_border2_color = dialog_color +gauge_color = (BLUE,WHITE,ON) diff --git a/contrib/dialog/samples/dft-cancel b/contrib/dialog/samples/dft-cancel deleted file mode 100755 index 2b317fc..0000000 --- a/contrib/dialog/samples/dft-cancel +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# $Id: dft-cancel,v 1.2 2012/07/03 09:44:02 tom Exp $ -DIALOGOPTS="$DIALOGOPTS --extra-button --help-button --default-button cancel" "$@" diff --git a/contrib/dialog/samples/dft-extra b/contrib/dialog/samples/dft-extra deleted file mode 100755 index de08cd7..0000000 --- a/contrib/dialog/samples/dft-extra +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# $Id: dft-extra,v 1.2 2012/07/03 09:44:02 tom Exp $ -DIALOGOPTS="$DIALOGOPTS --extra-button --help-button --default-button extra" "$@" diff --git a/contrib/dialog/samples/dft-help b/contrib/dialog/samples/dft-help deleted file mode 100755 index cade8a7..0000000 --- a/contrib/dialog/samples/dft-help +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# $Id: dft-help,v 1.2 2012/07/03 09:44:02 tom Exp $ -DIALOGOPTS="$DIALOGOPTS --extra-button --help-button --default-button help" "$@" diff --git a/contrib/dialog/samples/dft-no b/contrib/dialog/samples/dft-no deleted file mode 100755 index 172bcb2..0000000 --- a/contrib/dialog/samples/dft-no +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# $Id: dft-no,v 1.2 2012/07/03 09:44:02 tom Exp $ -DIALOGOPTS="$DIALOGOPTS --extra-button --help-button --defaultno" "$@" diff --git a/contrib/dialog/samples/dialog.py b/contrib/dialog/samples/dialog.py index 5286b41..db66fd7 100644 --- a/contrib/dialog/samples/dialog.py +++ b/contrib/dialog/samples/dialog.py @@ -1,5 +1,4 @@ -#!/usr/bin/python -# $Id: dialog.py,v 1.4 2012/06/29 09:33:18 tom Exp $ +# $Id: dialog.py,v 1.3 2004/09/21 00:52:15 tom Exp $ # Module: dialog.py # Copyright (c) 2000 Robb Shecter <robb@acm.org> # All rights reserved. diff --git a/contrib/dialog/samples/dselect b/contrib/dialog/samples/dselect new file mode 100755 index 0000000..22995b4 --- /dev/null +++ b/contrib/dialog/samples/dselect @@ -0,0 +1,11 @@ +#!/bin/sh +# $Id: dselect,v 1.6 2010/01/13 10:20:03 tom Exp $ + +. ./setup-vars + +exec 3>&1 +RESULT=`$DIALOG --title "Please choose a directory" "$@" --dselect $HOME/ 14 48 2>&1 1>&3` +retval=$? +exec 3>&- + +. ./report-string diff --git a/contrib/dialog/samples/form1 b/contrib/dialog/samples/form1 index 38e2364..cfa8a4a 100755 --- a/contrib/dialog/samples/form1 +++ b/contrib/dialog/samples/form1 @@ -1,5 +1,5 @@ #! /bin/sh -# $Id: form1,v 1.15 2011/10/04 23:36:53 tom Exp $ +# $Id: form1,v 1.14 2010/01/13 10:53:11 tom Exp $ . ./setup-vars @@ -63,8 +63,8 @@ $show" 10 40 echo "Button 3 (Extra) pressed." exit ;; - $DIALOG_ERROR) - echo "ERROR!$value" + $DIALOG_ERR) + echo "ERROR!" exit ;; $DIALOG_ESC) diff --git a/contrib/dialog/samples/fselect0 b/contrib/dialog/samples/fselect0 deleted file mode 100755 index 3bd5b6d..0000000 --- a/contrib/dialog/samples/fselect0 +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# $Id: fselect0,v 1.1 2011/10/14 08:32:48 tom Exp $ - -. ./setup-vars - -exec 3>&1 -RESULT=`$DIALOG --title "Please choose a file" "$@" --fselect '' 14 48 2>&1 1>&3` -retval=$? -exec 3>&- - -. ./report-string diff --git a/contrib/dialog/samples/inputmenu b/contrib/dialog/samples/inputmenu index 3c80811..5053cda 100755 --- a/contrib/dialog/samples/inputmenu +++ b/contrib/dialog/samples/inputmenu @@ -1,65 +1,60 @@ -#! /bin/sh -# $Id: inputmenu,v 1.15 2012/07/06 18:11:21 tom Exp $ +#! /bin/bash +# $Id: inputmenu,v 1.10 2010/01/13 10:29:22 tom Exp $ # 2002 - written by Tobias Rittweiler <tobrit@freebits.de> . ./setup-vars -user="$USER" -uid=`id|sed -e 's/^uid=//' -e 's/(.*//'` -gid=`id|sed -e 's/^.*gid=//' -e 's/(.*//'` -home="$HOME" +user="$USER" ; uid="$UID" ; +gid="$GROUPS" ; home="$HOME" ; while [ ${returncode:-99} -ne 1 -a ${returncode:-99} -ne 250 ]; do - exec 3>&1 - value=`$DIALOG \ - --clear --ok-label "Create" \ - --backtitle "An Example for the use of --inputmenu:" "$@" \ - --inputmenu "Originally I designed --inputmenu for a \ + exec 3>&1 + value=$("$DIALOG" --clear --ok-label "Create" \ + --backtitle "An Example for the use of --inputmenu:" "$@" \ + --inputmenu "Originally I designed --inputmenu for a \ configuration purpose. Here is a possible piece of a configuration program. \ " 20 50 10 \ "Username:" "$user" \ "UID:" "$uid" \ "GID:" "$gid" \ "HOME:" "$home" \ -2>&1 1>&3 ` - returncode=$? - exec 3>&- - case $returncode in - $DIALOG_CANCEL) - "$DIALOG" \ - --clear --backtitle "An Example for the use of --inputmenu:" \ - --yesno "Really quit?" 10 30 - case $? in - $DIALOG_OK) break;; - $DIALOG_CANCEL) returncode=99;; - esac - ;; - $DIALOG_OK) - "$DIALOG" \ - --clear --backtitle "An Example for the use of --inputmenu:" \ +2>&1 1>&3 ) + returncode=$? + exec 3>&- + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" --clear --backtitle "An Example for the use of --inputmenu:" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) break;; + $DIALOG_CANCEL) returncode=99;; + esac + ;; + $DIALOG_OK) + "$DIALOG" --clear --backtitle "An Example for the use of --inputmenu:" \ --msgbox "useradd \n\ -d $home \n\ -u $uid \n\ -g $gid \n\ $user" 10 40 - ;; - $DIALOG_EXTRA) - value=`echo "$value" | sed -e 's/^RENAMED //'` - tag=`echo "$value" | sed -e 's/:.*//'` - item=`echo "$value" | sed -e 's/^[^:]*:[ ][ ]*//'` + ;; + $DIALOG_EXTRA) + value="${value:8:${#value}}" + tag="${value%:*}" + item="${value#*: }" - case "$tag" in - Username) user="$item" ;; - UID) uid="$item" ;; - GID) gid="$item" ;; - HOME) home="$item" ;; - esac - ;; + case "$tag" in + Username) user="$item";; + UID) uid="$item";; + GID) gid="$item";; + HOME) home="$item";; + esac + ;; - $DIALOG_ESC) - echo "ESC pressed." - break - ;; + $DIALOG_ESC) + echo "ESC pressed." + break + ;; - esac + esac done diff --git a/contrib/dialog/samples/inputmenu-stdout b/contrib/dialog/samples/inputmenu-stdout index a778226..22fce04 100755 --- a/contrib/dialog/samples/inputmenu-stdout +++ b/contrib/dialog/samples/inputmenu-stdout @@ -1,63 +1,53 @@ -#! /bin/sh -# $Id: inputmenu-stdout,v 1.13 2012/07/06 18:11:12 tom Exp $ +#! /bin/bash +# $Id: inputmenu-stdout,v 1.8 2010/01/13 10:30:14 tom Exp $ # 2002 - written by Tobias Rittweiler <tobrit@freebits.de> . ./setup-vars -user="$USER" -uid=`id|sed -e 's/^uid=//' -e 's/(.*//'` -gid=`id|sed -e 's/^.*gid=//' -e 's/(.*//'` -home="$HOME" +user="$USER" ; uid="$UID" ; +gid="$GROUPS" ; home="$HOME" ; while [ ${returncode:-99} -ne 1 -a ${returncode:-99} -ne 250 ]; do - value=`$DIALOG \ - --stdout --clear --ok-label "Create" \ - --backtitle "An Example for the use of --inputmenu:" "$@" \ - --inputmenu "Originally I designed --inputmenu for a \ -configuration purpose. Here is a possible piece of a configuration program. \ -" 20 50 10 \ -"Username:" "$user" \ -"UID:" "$uid" \ -"GID:" "$gid" \ -"HOME:" "$home" \ -` - returncode=$? - case $returncode in - $DIALOG_CANCEL) - "$DIALOG" \ - --clear --backtitle "An Example for the use of --inputmenu:" \ - --yesno "Really quit?" 10 30 - case $? in - $DIALOG_OK) break;; - $DIALOG_CANCEL) returncode=99;; - esac - ;; - $DIALOG_OK) - "$DIALOG" \ - --clear --backtitle "An Example for the use of --inputmenu:" \ + value="$("$DIALOG" --stdout --clear --ok-label "Create" \ + --backtitle "An Example for the use of --inputmenu:" "$@" \ + --inputmenu "Originally I designed --inputmenu for a \ +configuration purpose. Here is a possible piece of a configuration program. +" 20 50 10 "Username:" "$user" "UID:" "$uid" "GID:" "$gid" "HOME:" "$home")" + returncode=$? + case $returncode in + $DIALOG_CANCEL) + "$DIALOG" --clear --backtitle "An Example for the use of --inputmenu:" \ + --yesno "Really quit?" 10 30 + case $? in + $DIALOG_OK) break;; + $DIALOG_CANCEL) returncode=99;; + esac + ;; + $DIALOG_OK) + "$DIALOG" --clear --backtitle "An Example for the use of --inputmenu:" \ --msgbox "useradd \n\ -d $home \n\ -u $uid \n\ -g $gid \n\ $user" 10 40 - ;; - $DIALOG_EXTRA) - value=`echo "$value" | sed -e 's/^RENAMED //'` - tag=`echo "$value" | sed -e 's/:.*//'` - item=`echo "$value" | sed -e 's/^[^:]*:[ ][ ]*//'` + ;; + $DIALOG_EXTRA) + value="${value:8:${#value}}" + tag="${value%:*}" + item="${value#*: }" - case "$tag" in - Username) user="$item" ;; - UID) uid="$item" ;; - GID) gid="$item" ;; - HOME) home="$item" ;; - esac - ;; + case "$tag" in + Username) user="$item";; + UID) uid="$item";; + GID) gid="$item";; + HOME) home="$item";; + esac + ;; - $DIALOG_ESC) - echo "ESC pressed." - break - ;; + $DIALOG_ESC) + echo "ESC pressed." + break + ;; - esac + esac done diff --git a/contrib/dialog/samples/inputmenu1 b/contrib/dialog/samples/inputmenu1 index 905c292..4e9bae2 100755 --- a/contrib/dialog/samples/inputmenu1 +++ b/contrib/dialog/samples/inputmenu1 @@ -1,5 +1,5 @@ #! /bin/sh -# $Id: inputmenu1,v 1.9 2012/07/01 00:59:54 tom Exp $ +# $Id: inputmenu1,v 1.8 2010/01/13 10:31:02 tom Exp $ # # "inputmenu" rewritten into Bourne shell. @@ -58,7 +58,7 @@ exec 3>&- ;; $DIALOG_EXTRA) tag=`echo "$value" |sed -e 's/^RENAMED //' -e 's/:.*//'` - item=`echo "$value" |sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'` + item=`echo "$value" |sed -e 's/^.*:[ ]*//' -e 's/[ ]*$//'` case "$tag" in Username) diff --git a/contrib/dialog/samples/inputmenu2 b/contrib/dialog/samples/inputmenu2 index ecef674..f560aba 100755 --- a/contrib/dialog/samples/inputmenu2 +++ b/contrib/dialog/samples/inputmenu2 @@ -1,5 +1,5 @@ #! /bin/sh -# $Id: inputmenu2,v 1.9 2012/07/01 01:00:34 tom Exp $ +# $Id: inputmenu2,v 1.8 2010/01/13 10:32:04 tom Exp $ # # "inputmenu1" with defaultitem, help-button. @@ -66,7 +66,7 @@ exec 3>&- ;; $DIALOG_EXTRA) tag=`echo "$value" |sed -e 's/^RENAMED //' -e 's/:.*/:/'` - item=`echo "$value" |sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'` + item=`echo "$value" |sed -e 's/^.*:[ ]*//' -e 's/[ ]*$//'` case "$tag" in Username:) diff --git a/contrib/dialog/samples/inputmenu3 b/contrib/dialog/samples/inputmenu3 index 4b9d522..e3250d8 100755 --- a/contrib/dialog/samples/inputmenu3 +++ b/contrib/dialog/samples/inputmenu3 @@ -1,5 +1,5 @@ #! /bin/sh -# $Id: inputmenu3,v 1.11 2012/07/01 01:00:34 tom Exp $ +# $Id: inputmenu3,v 1.10 2010/01/13 10:32:51 tom Exp $ # # "inputmenu1" with defaultitem, help-button and item-help. @@ -75,7 +75,7 @@ exec 3>&- ;; $DIALOG_EXTRA) tag=`echo "$value" |sed -e 's/^RENAMED //' -e 's/:.*/:/'` - item=`echo "$value" |sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'` + item=`echo "$value" |sed -e 's/^.*:[ ]*//' -e 's/[ ]*$//'` case "$tag" in Username:) diff --git a/contrib/dialog/samples/inputmenu4 b/contrib/dialog/samples/inputmenu4 index 6688c9c..a872527 100755 --- a/contrib/dialog/samples/inputmenu4 +++ b/contrib/dialog/samples/inputmenu4 @@ -1,5 +1,5 @@ #! /bin/sh -# $Id: inputmenu4,v 1.9 2012/07/01 01:00:34 tom Exp $ +# $Id: inputmenu4,v 1.8 2010/01/13 10:33:35 tom Exp $ # # "inputmenu1" with a different label for the extra-button @@ -59,7 +59,7 @@ exec 3>&- ;; $DIALOG_EXTRA) tag=`echo "$value" |sed -e 's/^RENAMED //' -e 's/:.*//'` - item=`echo "$value" |sed -e 's/^[^:]*:[ ]*//' -e 's/[ ]*$//'` + item=`echo "$value" |sed -e 's/^.*:[ ]*//' -e 's/[ ]*$//'` case "$tag" in Username) diff --git a/contrib/dialog/samples/killall b/contrib/dialog/samples/killall index 7030fe2..9d233f0 100755 --- a/contrib/dialog/samples/killall +++ b/contrib/dialog/samples/killall @@ -1,16 +1,13 @@ #! /bin/sh -# $Id: killall,v 1.3 2012/06/29 09:39:19 tom Exp $ +# $Id: killall,v 1.2 2004/09/17 19:56:18 tom Exp $ # Linux has a program that does this correctly. - -. ./setup-vars - for prog in $* do pid=`ps -a |fgrep $prog |fgrep -v fgrep|sed -e 's/^[ ]*//' -e 's/ .*//' ` if test -n "$pid" ; then echo killing pid=$pid, $prog - kill -$SIG_HUP $pid || \ - kill -$SIG_TERM $pid || \ - kill -$SIG_KILL $pid + kill -1 $pid || \ + kill -15 $pid || \ + kill -9 $pid fi done diff --git a/contrib/dialog/samples/prgbox b/contrib/dialog/samples/prgbox index c06a630..9170a36 100755 --- a/contrib/dialog/samples/prgbox +++ b/contrib/dialog/samples/prgbox @@ -1,9 +1,6 @@ #!/bin/sh -# $Id: prgbox,v 1.2 2012/07/02 09:46:24 tom Exp $ +# $Id: prgbox,v 1.1 2011/03/02 00:10:54 tom Exp $ . ./setup-vars $DIALOG --title "PRGBOX" "$@" --prgbox "./shortlist" 20 70 - -retval=$? -. ./report-button diff --git a/contrib/dialog/samples/prgbox2 b/contrib/dialog/samples/prgbox2 index ba94622..53f3daa 100755 --- a/contrib/dialog/samples/prgbox2 +++ b/contrib/dialog/samples/prgbox2 @@ -1,9 +1,6 @@ #!/bin/sh -# $Id: prgbox2,v 1.2 2012/07/02 09:46:24 tom Exp $ +# $Id: prgbox2,v 1.1 2011/03/02 01:25:54 tom Exp $ . ./setup-vars $DIALOG --title "PRGBOX" "$@" --prgbox "./shortlist 3" 20 70 - -retval=$? -. ./report-button diff --git a/contrib/dialog/samples/report-button b/contrib/dialog/samples/report-button index c6a1730..e13b03a 100644 --- a/contrib/dialog/samples/report-button +++ b/contrib/dialog/samples/report-button @@ -1,5 +1,4 @@ -#!/bin/sh -# $Id: report-button,v 1.3 2012/06/29 09:29:36 tom Exp $ +# $Id: report-button,v 1.2 2010/01/13 09:59:14 tom Exp $ # Report button-only, no $RESULT # vile:shmode diff --git a/contrib/dialog/samples/report-edit b/contrib/dialog/samples/report-edit index 37e3eb0..f17b6d3 100644 --- a/contrib/dialog/samples/report-edit +++ b/contrib/dialog/samples/report-edit @@ -1,5 +1,4 @@ -#!/bin/sh -# $Id: report-edit,v 1.4 2012/06/29 09:29:41 tom Exp $ +# $Id: report-edit,v 1.3 2010/01/13 09:59:43 tom Exp $ # Report results from editing. # vile:shmode diff --git a/contrib/dialog/samples/report-string b/contrib/dialog/samples/report-string index dc96c2f..a674517 100644 --- a/contrib/dialog/samples/report-string +++ b/contrib/dialog/samples/report-string @@ -1,5 +1,4 @@ -#!/bin/sh -# $Id: report-string,v 1.3 2012/06/29 09:32:17 tom Exp $ +# $Id: report-string,v 1.2 2010/01/13 10:00:11 tom Exp $ # Report result passed in a string $RESULT # vile:shmode diff --git a/contrib/dialog/samples/report-tempfile b/contrib/dialog/samples/report-tempfile index 32c04e0..5a88d44 100644 --- a/contrib/dialog/samples/report-tempfile +++ b/contrib/dialog/samples/report-tempfile @@ -1,5 +1,4 @@ -#!/bin/sh -# $Id: report-tempfile,v 1.4 2012/06/29 09:29:47 tom Exp $ +# $Id: report-tempfile,v 1.3 2010/01/13 09:59:05 tom Exp $ # Report results in a temporary-file. # vile:shmode diff --git a/contrib/dialog/samples/report-yesno b/contrib/dialog/samples/report-yesno index d22ebe4..81da89b 100644 --- a/contrib/dialog/samples/report-yesno +++ b/contrib/dialog/samples/report-yesno @@ -1,5 +1,4 @@ -#!/bin/sh -# $Id: report-yesno,v 1.2 2012/06/29 09:32:12 tom Exp $ +# $Id: report-yesno,v 1.1 2010/01/13 10:40:14 tom Exp $ # Report button-only, no $RESULT # vile:shmode diff --git a/contrib/dialog/samples/setup-edit b/contrib/dialog/samples/setup-edit index 8f9d284..df86297 100644 --- a/contrib/dialog/samples/setup-edit +++ b/contrib/dialog/samples/setup-edit @@ -1,7 +1,6 @@ -#!/bin/sh -# $Id: setup-edit,v 1.2 2012/06/29 09:31:49 tom Exp $ +# $Id: setup-edit,v 1.1 2010/01/13 01:56:07 tom Exp $ # vile:shmode input=`tempfile 2>/dev/null` || input=/tmp/input$$ output=`tempfile 2>/dev/null` || output=/tmp/test$$ -trap "rm -f $input $output" $SIG_NONE $SIG_HUP $SIG_INT $SIG_TRAP $SIG_TERM +trap "rm -f $input $output" 0 1 2 5 15 diff --git a/contrib/dialog/samples/setup-tempfile b/contrib/dialog/samples/setup-tempfile index 3a67ea6..6db551f 100644 --- a/contrib/dialog/samples/setup-tempfile +++ b/contrib/dialog/samples/setup-tempfile @@ -1,6 +1,5 @@ -#!/bin/sh -# $Id: setup-tempfile,v 1.3 2012/07/06 17:51:56 tom Exp $ +# $Id: setup-tempfile,v 1.1 2010/01/13 01:41:02 tom Exp $ # vile:shmode -tempfile=`(tempfile) 2>/dev/null` || tempfile=/tmp/test$$ -trap "rm -f $tempfile" 0 $SIG_NONE $SIG_HUP $SIG_INT $SIG_TRAP $SIG_TERM +tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$ +trap "rm -f $tempfile" 0 1 2 5 15 diff --git a/contrib/dialog/samples/setup-utf8 b/contrib/dialog/samples/setup-utf8 index 07cff39..2fd70d4 100644 --- a/contrib/dialog/samples/setup-utf8 +++ b/contrib/dialog/samples/setup-utf8 @@ -1,5 +1,4 @@ -#!/bin/sh -# $Id: setup-utf8,v 1.2 2012/06/29 09:50:32 tom Exp $ +# $Id: setup-utf8,v 1.1 2010/01/13 01:51:44 tom Exp $ # vile:shmode case none"$LANG$LC_ALL$LC_CTYPE" in diff --git a/contrib/dialog/samples/setup-vars b/contrib/dialog/samples/setup-vars index f0ea779..ae5e725 100644 --- a/contrib/dialog/samples/setup-vars +++ b/contrib/dialog/samples/setup-vars @@ -1,5 +1,4 @@ -#!/bin/sh -# $Id: setup-vars,v 1.3 2012/06/29 09:52:26 tom Exp $ +# $Id: setup-vars,v 1.2 2011/01/04 00:21:43 tom Exp $ # vile:shmode # These symbols are defined to use in the sample shell scripts to make them @@ -14,10 +13,3 @@ : ${DIALOG_EXTRA=3} : ${DIALOG_ITEM_HELP=4} : ${DIALOG_ESC=255} - -: ${SIG_NONE=0} -: ${SIG_HUP=1} -: ${SIG_INT=2} -: ${SIG_QUIT=3} -: ${SIG_KILL=9} -: ${SIG_TERM=15} diff --git a/contrib/dialog/samples/slackware.rc b/contrib/dialog/samples/slackware.rc index f12d27b..967147e 100644 --- a/contrib/dialog/samples/slackware.rc +++ b/contrib/dialog/samples/slackware.rc @@ -1,4 +1,4 @@ -# $Id: slackware.rc,v 1.9 2011/10/15 01:00:25 tom Exp $ +# $Id: slackware.rc,v 1.7 2011/01/17 00:14:41 tom Exp $ # vile:confmode # Run-time configuration file for dialog, matches Slackware color scheme. # @@ -46,16 +46,16 @@ border_color = (CYAN,CYAN,ON) button_active_color = (WHITE,BLUE,ON) # Inactive button color -button_inactive_color = dialog_color +button_inactive_color = (BLACK,CYAN,OFF) # Active button key color -button_key_active_color = button_active_color +button_key_active_color = (WHITE,BLUE,ON) # Inactive button key color button_key_inactive_color = (RED,CYAN,OFF) # Active button label color -button_label_active_color = button_active_color +button_label_active_color = (WHITE,BLUE,ON) # Inactive button label color button_label_inactive_color = (BLACK,CYAN,ON) @@ -64,46 +64,47 @@ button_label_inactive_color = (BLACK,CYAN,ON) inputbox_color = (BLUE,WHITE,OFF) # Input box border color -inputbox_border_color = border_color +inputbox_border_color = (CYAN,CYAN,ON) # Search box color searchbox_color = (YELLOW,WHITE,ON) # Search box title color +# FIXME searchbox_title_color = (WHITE,WHITE,ON) # Search box border color searchbox_border_color = (RED,WHITE,OFF) # File position indicator color -position_indicator_color = button_key_inactive_color +position_indicator_color = (RED,CYAN,OFF) # Menu box color -menubox_color = dialog_color +menubox_color = (BLACK,CYAN,OFF) # Menu box border color -menubox_border_color = border_color +menubox_border_color = (CYAN,CYAN,ON) # Item color -item_color = dialog_color +item_color = (BLACK,CYAN,OFF) # Selected item color -item_selected_color = screen_color +item_selected_color = (WHITE,BLUE,OFF) # Tag color -tag_color = title_color +tag_color = (YELLOW,CYAN,ON) # Selected tag color -tag_selected_color = screen_color +tag_selected_color = (WHITE,BLUE,OFF) # Tag key color -tag_key_color = button_key_inactive_color +tag_key_color = (RED,CYAN,OFF) # Selected tag key color tag_key_selected_color = (RED,BLUE,ON) # Check box color -check_color = dialog_color +check_color = (BLACK,CYAN,OFF) # Selected check box color check_selected_color = (WHITE,CYAN,ON) @@ -112,13 +113,13 @@ check_selected_color = (WHITE,CYAN,ON) uarrow_color = (GREEN,CYAN,ON) # Down arrow color -darrow_color = uarrow_color +darrow_color = (GREEN,CYAN,ON) # Item help-text color -itemhelp_color = shadow_color +itemhelp_color = (WHITE,BLACK,OFF) # Active form text color -form_active_text_color = inputbox_color +form_active_text_color = (BLUE,WHITE,OFF) # Form text color form_text_color = (CYAN,BLUE,ON) @@ -128,15 +129,3 @@ form_item_readonly_color = (CYAN,WHITE,ON) # Dialog box gauge color gauge_color = (BLUE,WHITE,ON) - -# Dialog box border2 color -border2_color = (BLACK,WHITE,OFF) - -# Input box border2 color -inputbox_border2_color = border2_color - -# Search box border2 color -searchbox_border2_color = border2_color - -# Menu box border2 color -menubox_border2_color = border2_color diff --git a/contrib/dialog/samples/sourcemage.rc b/contrib/dialog/samples/sourcemage.rc index 9384798..1ba826f 100644 --- a/contrib/dialog/samples/sourcemage.rc +++ b/contrib/dialog/samples/sourcemage.rc @@ -1,4 +1,4 @@ -# $Id: sourcemage.rc,v 1.6 2011/10/15 01:00:41 tom Exp $ +# $Id: sourcemage.rc,v 1.4 2011/01/17 00:14:25 tom Exp $ # vile:confmode # Run-time configuration file for dialog, matches SourceMage color scheme. # @@ -46,10 +46,10 @@ border_color = (WHITE,WHITE,ON) button_active_color = (WHITE,RED,ON) # Inactive button color -button_inactive_color = dialog_color +button_inactive_color = (BLACK,WHITE,OFF) # Active button key color -button_key_active_color = button_active_color +button_key_active_color = (WHITE,RED,ON) # Inactive button key color button_key_inactive_color = (RED,WHITE,OFF) @@ -61,82 +61,70 @@ button_label_active_color = (RED,RED,ON) button_label_inactive_color = (BLACK,WHITE,ON) # Input box color -inputbox_color = dialog_color +inputbox_color = (BLACK,WHITE,OFF) # Input box border color -inputbox_border_color = dialog_color +inputbox_border_color = (BLACK,WHITE,OFF) # Search box color -searchbox_color = dialog_color +searchbox_color = (BLACK,WHITE,OFF) # Search box title color -searchbox_title_color = title_color +searchbox_title_color = (RED,WHITE,ON) # Search box border color -searchbox_border_color = border_color +searchbox_border_color = (WHITE,WHITE,ON) # File position indicator color -position_indicator_color = title_color +position_indicator_color = (RED,WHITE,ON) # Menu box color -menubox_color = dialog_color +menubox_color = (BLACK,WHITE,OFF) # Menu box border color -menubox_border_color = border_color +menubox_border_color = (WHITE,WHITE,ON) # Item color -item_color = dialog_color +item_color = (BLACK,WHITE,OFF) # Selected item color -item_selected_color = button_active_color +item_selected_color = (WHITE,RED,ON) # Tag color -tag_color = title_color +tag_color = (RED,WHITE,ON) # Selected tag color -tag_selected_color = button_label_active_color +tag_selected_color = (RED,RED,ON) # Tag key color -tag_key_color = title_color +tag_key_color = (RED,WHITE,ON) # Selected tag key color -tag_key_selected_color = button_active_color +tag_key_selected_color = (WHITE,RED,ON) # Check box color -check_color = dialog_color +check_color = (BLACK,WHITE,OFF) # Selected check box color -check_selected_color = button_active_color +check_selected_color = (WHITE,RED,ON) # Up arrow color -uarrow_color = title_color +uarrow_color = (RED,WHITE,ON) # Down arrow color -darrow_color = title_color +darrow_color = (RED,WHITE,ON) # Item help-text color itemhelp_color = (WHITE,BLACK,OFF) # Active form text color -form_active_text_color = dialog_color +form_active_text_color = (BLACK,WHITE,OFF) # Form text color -form_text_color = screen_color +form_text_color = (RED,BLACK,ON) # Readonly form item color form_item_readonly_color = (CYAN,WHITE,ON) # Dialog box gauge color gauge_color = (BLUE,WHITE,ON) - -# Dialog box border2 color -border2_color = dialog_color - -# Input box border2 color -inputbox_border2_color = dialog_color - -# Search box border2 color -searchbox_border2_color = dialog_color - -# Menu box border2 color -menubox_border2_color = dialog_color diff --git a/contrib/dialog/samples/suse.rc b/contrib/dialog/samples/suse.rc index c8ff099..f2417b2 100644 --- a/contrib/dialog/samples/suse.rc +++ b/contrib/dialog/samples/suse.rc @@ -1,4 +1,4 @@ -# $Id: suse.rc,v 1.5 2011/10/15 01:01:00 tom Exp $ +# $Id: suse.rc,v 1.3 2011/01/17 00:15:27 tom Exp $ # vile:confmode # Run-time configuration file for dialog, matches SuSE color scheme. # @@ -46,10 +46,10 @@ border_color = (WHITE,WHITE,ON) button_active_color = (WHITE,BLUE,ON) # Inactive button color -button_inactive_color = dialog_color +button_inactive_color = (BLACK,WHITE,OFF) # Active button key color -button_key_active_color = button_active_color +button_key_active_color = (WHITE,BLUE,ON) # Inactive button key color button_key_inactive_color = (RED,WHITE,OFF) @@ -61,64 +61,64 @@ button_label_active_color = (YELLOW,BLUE,ON) button_label_inactive_color = (BLACK,WHITE,ON) # Input box color -inputbox_color = dialog_color +inputbox_color = (BLACK,WHITE,OFF) # Input box border color -inputbox_border_color = dialog_color +inputbox_border_color = (BLACK,WHITE,OFF) # Search box color -searchbox_color = dialog_color +searchbox_color = (BLACK,WHITE,OFF) # Search box title color -searchbox_title_color = title_color +searchbox_title_color = (YELLOW,WHITE,ON) # Search box border color -searchbox_border_color = border_color +searchbox_border_color = (WHITE,WHITE,ON) # File position indicator color -position_indicator_color = title_color +position_indicator_color = (YELLOW,WHITE,ON) # Menu box color -menubox_color = dialog_color +menubox_color = (BLACK,WHITE,OFF) # Menu box border color -menubox_border_color = border_color +menubox_border_color = (WHITE,WHITE,ON) # Item color -item_color = dialog_color +item_color = (BLACK,WHITE,OFF) # Selected item color -item_selected_color = button_active_color +item_selected_color = (WHITE,BLUE,ON) # Tag color -tag_color = title_color +tag_color = (YELLOW,WHITE,ON) # Selected tag color -tag_selected_color = button_label_active_color +tag_selected_color = (YELLOW,BLUE,ON) # Tag key color -tag_key_color = button_key_inactive_color +tag_key_color = (RED,WHITE,OFF) # Selected tag key color tag_key_selected_color = (RED,BLUE,ON) # Check box color -check_color = dialog_color +check_color = (BLACK,WHITE,OFF) # Selected check box color -check_selected_color = button_active_color +check_selected_color = (WHITE,BLUE,ON) # Up arrow color uarrow_color = (GREEN,WHITE,ON) # Down arrow color -darrow_color = uarrow_color +darrow_color = (GREEN,WHITE,ON) # Item help-text color itemhelp_color = (WHITE,BLACK,OFF) # Active form text color -form_active_text_color = button_active_color +form_active_text_color = (WHITE,BLUE,ON) # Form text color form_text_color = (WHITE,CYAN,ON) @@ -128,15 +128,3 @@ form_item_readonly_color = (CYAN,WHITE,ON) # Dialog box gauge color gauge_color = (BLUE,WHITE,ON) - -# Dialog box border2 color -border2_color = dialog_color - -# Input box border2 color -inputbox_border2_color = dialog_color - -# Search box border2 color -searchbox_border2_color = dialog_color - -# Menu box border2 color -menubox_border2_color = dialog_color diff --git a/contrib/dialog/samples/tailboxbg b/contrib/dialog/samples/tailboxbg index bcc3434..957d774 100755 --- a/contrib/dialog/samples/tailboxbg +++ b/contrib/dialog/samples/tailboxbg @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: tailboxbg,v 1.10 2012/06/29 09:48:28 tom Exp $ +# $Id: tailboxbg,v 1.9 2010/01/13 10:20:03 tom Exp $ . ./setup-vars @@ -16,7 +16,7 @@ $DIALOG --title "TAIL BOX" \ sleep 10 # now kill it -kill -$SIG_QUIT `cat $tempfile` 2>&1 >/dev/null 2>/dev/null +kill -3 `cat $tempfile` 2>&1 >/dev/null 2>/dev/null # ...and the process that is making the listing ./killall listing diff --git a/contrib/dialog/samples/tailboxbg1 b/contrib/dialog/samples/tailboxbg1 index f04567a..2955ad0 100755 --- a/contrib/dialog/samples/tailboxbg1 +++ b/contrib/dialog/samples/tailboxbg1 @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: tailboxbg1,v 1.10 2012/06/29 09:51:46 tom Exp $ +# $Id: tailboxbg1,v 1.9 2010/01/13 10:20:03 tom Exp $ . ./setup-vars @@ -24,7 +24,7 @@ if test -n "$pid" ; then sleep 10 # now kill it -kill -$SIG_QUIT $pid 2>&1 >/dev/null 2>/dev/null +kill -3 $pid 2>&1 >/dev/null 2>/dev/null echo "killed [$pid]" fi diff --git a/contrib/dialog/samples/tailboxbg2 b/contrib/dialog/samples/tailboxbg2 index 628cb05..0617708 100755 --- a/contrib/dialog/samples/tailboxbg2 +++ b/contrib/dialog/samples/tailboxbg2 @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: tailboxbg2,v 1.10 2012/06/29 09:51:11 tom Exp $ +# $Id: tailboxbg2,v 1.9 2010/01/13 10:20:03 tom Exp $ . ./setup-vars @@ -25,7 +25,7 @@ if test -n "$pid" ; then sleep 10 # now kill it -kill -$SIG_QUIT $pid 2>&1 >/dev/null 2>/dev/null +kill -3 $pid 2>&1 >/dev/null 2>/dev/null echo "killed [$pid]" fi diff --git a/contrib/dialog/samples/testdata-8bit b/contrib/dialog/samples/testdata-8bit index f09021d..7810f9e 100755 --- a/contrib/dialog/samples/testdata-8bit +++ b/contrib/dialog/samples/testdata-8bit @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: testdata-8bit,v 1.2 2011/10/16 23:26:32 tom Exp $ +# $Id: testdata-8bit,v 1.1 2004/12/19 16:19:12 tom Exp $ # Select one of the "SAMPLE=" lines, to test handling of characters which # are nonprinting in a POSIX locale: @@ -37,12 +37,3 @@ case .$1 in SAMPLE="" ;; esac - -# This script is source'd from other scripts, and uses the parameter list from -# those explicitly. But they may use the parameter list later, to set options -# specially for dialog. Work around the conflicting uses by removing the -# parameter which we just used to select a set of data. -if test $# != 0 -then - shift 1 -fi diff --git a/contrib/dialog/samples/valgrind.log b/contrib/dialog/samples/valgrind.log new file mode 100644 index 0000000..f33b862 --- /dev/null +++ b/contrib/dialog/samples/valgrind.log @@ -0,0 +1,847 @@ +==23273== Memcheck, a memory error detector. +==23273== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al. +==23273== Using LibVEX rev 1854, a library for dynamic binary translation. +==23273== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP. +==23273== Using valgrind-3.3.1-Debian, a dynamic binary instrumentation framework. +==23273== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al. +==23273== +--23273-- Command line +--23273-- /usr/build/dialog/dialog-1.1-20110707/dialog +--23273-- --title +--23273-- YES/NO BOX +--23273-- --clear +--23273-- --yesno +--23273-- 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. +--23273-- 15 +--23273-- 61 +--23273-- Startup, with flags: +--23273-- --suppressions=/usr/lib/valgrind/debian-libc6-dbg.supp +--23273-- -v +--23273-- --num-callers=10 +--23273-- --error-limit=no +--23273-- --show-reachable=yes +--23273-- --leak-resolution=high +--23273-- --leak-check=yes +--23273-- --show-reachable=yes +--23273-- --log-fd=2 +--23273-- Contents of /proc/version: +--23273-- Linux version 2.6.26-2-686 (Debian 2.6.26-26lenny3) (dannf@debian.org) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 SMP Sat Jun 11 14:54:10 UTC 2011 +--23273-- Arch and hwcaps: X86, x86-sse1-sse2 +--23273-- Page sizes: currently 4096, max supported 4096 +--23273-- Valgrind library directory: /usr/lib/valgrind +--23273-- Reading syms from /lib/ld-2.7.so (0x4000000) +--23273-- Reading debug info from /lib/ld-2.7.so... +--23273-- ... CRC mismatch (computed 0f4d8d49 wanted a869dbba) +--23273-- Reading debug info from /usr/lib/debug/lib/ld-2.7.so... +--23273-- Reading syms from /usr/build/dialog/dialog-1.1-20110707/dialog (0x8048000) +--23273-- Reading syms from /usr/lib/valgrind/x86-linux/memcheck (0x38000000) +--23273-- object doesn't have a dynamic symbol table +--23273-- Reading suppressions file: /usr/lib/valgrind/debian-libc6-dbg.supp +--23273-- Reading suppressions file: /usr/lib/valgrind/default.supp +--23273-- REDIR: 0x4015500 (index) redirected to 0x3802cf43 (vgPlain_x86_linux_REDIR_FOR_index) +--23273-- Reading syms from /usr/lib/valgrind/x86-linux/vgpreload_core.so (0x401E000) +--23273-- Reading syms from /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so (0x4020000) +==23273== WARNING: new redirection conflicts with existing -- ignoring it +--23273-- new: 0x04015500 (index ) R-> 0x040241e0 index +--23273-- REDIR: 0x40156f0 (strlen) redirected to 0x4024490 (strlen) +--23273-- Reading syms from /usr/lib/debug/libm-2.7.so (0x4027000) +--23273-- Reading syms from /usr/lib/debug/libc-2.7.so (0x404D000) +--23273-- REDIR: 0x40beaf0 (rindex) redirected to 0x40240c0 (rindex) +--23273-- REDIR: 0x40bf760 (memset) redirected to 0x4025380 (memset) +--23273-- REDIR: 0x40be160 (strcmp) redirected to 0x4024770 (strcmp) +--23273-- REDIR: 0x40be700 (strlen) redirected to 0x4024470 (strlen) +--23273-- REDIR: 0x40be910 (strncmp) redirected to 0x40246e0 (strncmp) +--23273-- REDIR: 0x40bdff0 (index) redirected to 0x40241b0 (index) +--23273-- REDIR: 0x40b9740 (free) redirected to 0x4022ad0 (free) +--23273-- REDIR: 0x40bb2c0 (calloc) redirected to 0x4021d60 (calloc) +--23273-- REDIR: 0x40c07e0 (strchrnul) redirected to 0x4025450 (strchrnul) +--23273-- REDIR: 0x40bb5e0 (malloc) redirected to 0x4023cb0 (malloc) +--23273-- REDIR: 0x40bfc80 (memcpy) redirected to 0x40248e0 (memcpy) +--23273-- REDIR: 0x40be7b0 (strnlen) redirected to 0x4024430 (strnlen) +--23273-- REDIR: 0x40bf7c0 (mempcpy) redirected to 0x40254b0 (mempcpy) +--23273-- REDIR: 0x40be1f0 (strcpy) redirected to 0x40244d0 (strcpy) +--23273-- REDIR: 0x40bba60 (realloc) redirected to 0x4023dc0 (realloc) +--23273-- REDIR: 0x40bea20 (strncpy) redirected to 0x40245a0 (strncpy) +--23273-- REDIR: 0x40bf690 (bcmp) redirected to 0x4025070 (bcmp) +--23273-- REDIR: 0x40bde40 (strcat) redirected to 0x4024240 (strcat) +==23273== +==23273== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 14 from 1) +--23273-- +--23273-- supp: 14 dl-hack3-cond-1 +==23273== malloc/free: in use at exit: 72,482 bytes in 382 blocks. +==23273== malloc/free: 419 allocs, 37 frees, 79,695 bytes allocated. +==23273== +==23273== searching for pointers to 382 not-freed blocks. +==23273== checked 149,580 bytes. +==23273== +==23273== 6 bytes in 1 blocks are still reachable in loss record 1 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8068E64: dlg_strclone (util.c:1740) +==23273== by 0x805FE72: same_cache2 (inputstr.c:212) +==23273== by 0x805FEE7: dlg_index_wchars (inputstr.c:342) +==23273== by 0x8059BBE: print_button (buttons.c:97) +==23273== by 0x805A265: dlg_draw_buttons (buttons.c:297) +==23273== by 0x806A2D0: dialog_yesno (yesno.c:98) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 6 bytes in 1 blocks are still reachable in loss record 2 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8068E64: dlg_strclone (util.c:1740) +==23273== by 0x805FE72: same_cache2 (inputstr.c:212) +==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x805A1F3: dlg_draw_buttons (buttons.c:296) +==23273== by 0x806A2D0: dialog_yesno (yesno.c:98) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 7 bytes in 2 blocks are still reachable in loss record 3 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8068E64: dlg_strclone (util.c:1740) +==23273== by 0x805FE72: same_cache2 (inputstr.c:212) +==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8059E3A: dlg_button_sizes (buttons.c:179) +==23273== by 0x8059F04: dlg_button_x_step (buttons.c:209) +==23273== by 0x805A02F: dlg_button_layout (buttons.c:234) +==23273== by 0x806A11F: dialog_yesno (yesno.c:71) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== +==23273== +==23273== 11 bytes in 1 blocks are still reachable in loss record 4 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8068E64: dlg_strclone (util.c:1740) +==23273== by 0x805FE72: same_cache2 (inputstr.c:212) +==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8067711: real_auto_size (util.c:1101) +==23273== by 0x8067A1F: dlg_auto_size (util.c:1167) +==23273== by 0x806A14E: dialog_yesno (yesno.c:72) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 12 bytes in 1 blocks are still reachable in loss record 5 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x807F18F: _nc_add_to_try (add_tries.c:90) +==23273== by 0x80885C6: _nc_init_keytry (init_keytry.c:74) +==23273== by 0x80807F4: _nc_keypad (lib_options.c:262) +==23273== by 0x808035F: keypad (lib_options.c:129) +==23273== by 0x8066340: init_dialog (util.c:330) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 16 bytes in 1 blocks are still reachable in loss record 6 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x41165D0: tsearch (tsearch.c:281) +==23273== by 0x805FC92: make_cache (inputstr.c:149) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8066FD3: dlg_print_scrolled (util.c:886) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 16 bytes in 1 blocks are still reachable in loss record 7 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x41165D0: tsearch (tsearch.c:281) +==23273== by 0x805FC92: make_cache (inputstr.c:149) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FECD: dlg_index_wchars (inputstr.c:341) +==23273== by 0x8059BBE: print_button (buttons.c:97) +==23273== by 0x805A265: dlg_draw_buttons (buttons.c:297) +==23273== by 0x806A2D0: dialog_yesno (yesno.c:98) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 16 bytes in 1 blocks are still reachable in loss record 8 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x41165D0: tsearch (tsearch.c:281) +==23273== by 0x805FC92: make_cache (inputstr.c:149) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x805A1F3: dlg_draw_buttons (buttons.c:296) +==23273== by 0x806A2D0: dialog_yesno (yesno.c:98) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 16 bytes in 1 blocks are still reachable in loss record 9 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x41165D0: tsearch (tsearch.c:281) +==23273== by 0x805FC92: make_cache (inputstr.c:149) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8067711: real_auto_size (util.c:1101) +==23273== by 0x8067A1F: dlg_auto_size (util.c:1167) +==23273== by 0x806A14E: dialog_yesno (yesno.c:72) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== +==23273== +==23273== 16 bytes in 1 blocks are still reachable in loss record 10 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x807F2D5: _nc_doalloc (doalloc.c:55) +==23273== by 0x8086167: _nc_trace_alloc (trace_buf.c:55) +==23273== by 0x8086261: _nc_trace_buf (trace_buf.c:90) +==23273== by 0x80864A7: _nc_visbuf2n (visbuf.c:94) +==23273== by 0x8086538: _nc_visbuf2 (visbuf.c:114) +==23273== by 0x8086553: _nc_visbuf (visbuf.c:120) +==23273== by 0x8088693: recur_tries (trace_tries.c:55) +==23273== by 0x80886D7: recur_tries (trace_tries.c:59) +==23273== by 0x80886D7: recur_tries (trace_tries.c:59) +==23273== +==23273== +==23273== 21 bytes in 1 blocks are still reachable in loss record 11 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x40BE45F: strdup (strdup.c:43) +==23273== by 0x8081EE0: setupterm (lib_setup.c:471) +==23273== by 0x8072292: newterm (lib_newterm.c:115) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 23 bytes in 1 blocks are still reachable in loss record 12 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8088526: _nc_home_terminfo (home_terminfo.c:57) +==23273== by 0x8085E1B: _nc_read_entry (read_entry.c:492) +==23273== by 0x8081834: grab_entry (lib_setup.c:255) +==23273== by 0x8081D46: setupterm (lib_setup.c:438) +==23273== by 0x8072292: newterm (lib_newterm.c:115) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 24 bytes in 1 blocks are still reachable in loss record 13 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x805FDE1: same_cache2 (inputstr.c:201) +==23273== by 0x805FEE7: dlg_index_wchars (inputstr.c:342) +==23273== by 0x8059BBE: print_button (buttons.c:97) +==23273== by 0x805A265: dlg_draw_buttons (buttons.c:297) +==23273== by 0x806A2D0: dialog_yesno (yesno.c:98) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 24 bytes in 1 blocks are still reachable in loss record 14 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x805FDE1: same_cache2 (inputstr.c:201) +==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x805A1F3: dlg_draw_buttons (buttons.c:296) +==23273== by 0x806A2D0: dialog_yesno (yesno.c:98) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 28 bytes in 1 blocks are still reachable in loss record 15 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x805FC0F: make_cache (inputstr.c:139) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8066FD3: dlg_print_scrolled (util.c:886) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 28 bytes in 1 blocks are still reachable in loss record 16 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x805FC0F: make_cache (inputstr.c:139) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FECD: dlg_index_wchars (inputstr.c:341) +==23273== by 0x8059BBE: print_button (buttons.c:97) +==23273== by 0x805A265: dlg_draw_buttons (buttons.c:297) +==23273== by 0x806A2D0: dialog_yesno (yesno.c:98) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 28 bytes in 1 blocks are still reachable in loss record 17 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x805FC0F: make_cache (inputstr.c:139) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x805A1F3: dlg_draw_buttons (buttons.c:296) +==23273== by 0x806A2D0: dialog_yesno (yesno.c:98) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 28 bytes in 1 blocks are still reachable in loss record 18 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x805FC0F: make_cache (inputstr.c:139) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8067711: real_auto_size (util.c:1101) +==23273== by 0x8067A1F: dlg_auto_size (util.c:1167) +==23273== by 0x806A14E: dialog_yesno (yesno.c:72) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 28 bytes in 2 blocks are still reachable in loss record 19 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x805FDE1: same_cache2 (inputstr.c:201) +==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8059E3A: dlg_button_sizes (buttons.c:179) +==23273== by 0x8059F04: dlg_button_x_step (buttons.c:209) +==23273== by 0x805A02F: dlg_button_layout (buttons.c:234) +==23273== by 0x806A11F: dialog_yesno (yesno.c:71) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 32 bytes in 2 blocks are still reachable in loss record 20 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x41165D0: tsearch (tsearch.c:281) +==23273== by 0x805FC92: make_cache (inputstr.c:149) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8059E3A: dlg_button_sizes (buttons.c:179) +==23273== by 0x8059F04: dlg_button_x_step (buttons.c:209) +==23273== by 0x805A02F: dlg_button_layout (buttons.c:234) +==23273== by 0x806A11F: dialog_yesno (yesno.c:71) +==23273== +==23273== +==23273== 33 bytes in 1 blocks are still reachable in loss record 21 of 62 +==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429) +==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50) +==23273== by 0x808620A: _nc_trace_alloc (trace_buf.c:63) +==23273== by 0x8086261: _nc_trace_buf (trace_buf.c:90) +==23273== by 0x80864A7: _nc_visbuf2n (visbuf.c:94) +==23273== by 0x8086538: _nc_visbuf2 (visbuf.c:114) +==23273== by 0x8086553: _nc_visbuf (visbuf.c:120) +==23273== by 0x8088693: recur_tries (trace_tries.c:55) +==23273== by 0x80886D7: recur_tries (trace_tries.c:59) +==23273== by 0x80886D7: recur_tries (trace_tries.c:59) +==23273== +==23273== +==23273== 44 bytes in 1 blocks are still reachable in loss record 22 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x805FDE1: same_cache2 (inputstr.c:201) +==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8067711: real_auto_size (util.c:1101) +==23273== by 0x8067A1F: dlg_auto_size (util.c:1167) +==23273== by 0x806A14E: dialog_yesno (yesno.c:72) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 47 bytes in 1 blocks are still reachable in loss record 23 of 62 +==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429) +==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50) +==23273== by 0x8085368: read_termtype (read_entry.c:283) +==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392) +==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413) +==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438) +==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500) +==23273== by 0x8081834: grab_entry (lib_setup.c:255) +==23273== by 0x8081D46: setupterm (lib_setup.c:438) +==23273== by 0x8072292: newterm (lib_newterm.c:115) +==23273== +==23273== +==23273== 55 bytes in 1 blocks are still reachable in loss record 24 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x8084EC3: read_termtype (read_entry.c:207) +==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392) +==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413) +==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438) +==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500) +==23273== by 0x8081834: grab_entry (lib_setup.c:255) +==23273== by 0x8081D46: setupterm (lib_setup.c:438) +==23273== by 0x8072292: newterm (lib_newterm.c:115) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== +==23273== +==23273== 56 bytes in 2 blocks are still reachable in loss record 25 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x805FC0F: make_cache (inputstr.c:139) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8059E3A: dlg_button_sizes (buttons.c:179) +==23273== by 0x8059F04: dlg_button_x_step (buttons.c:209) +==23273== by 0x805A02F: dlg_button_layout (buttons.c:234) +==23273== by 0x806A11F: dialog_yesno (yesno.c:71) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== +==23273== +==23273== 66 bytes in 1 blocks are still reachable in loss record 26 of 62 +==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429) +==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50) +==23273== by 0x808238C: get_space (lib_tparm.c:155) +==23273== by 0x8082443: save_number (lib_tparm.c:180) +==23273== by 0x8082D8B: tparam_internal (lib_tparm.c:564) +==23273== by 0x80833C4: tparm (lib_tparm.c:788) +==23273== by 0x80704CF: _nc_mvcur_init (lib_mvcur.c:358) +==23273== by 0x8072684: newterm (lib_newterm.c:191) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== +==23273== +==23273== 80 bytes in 1 blocks are still reachable in loss record 27 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x8072E08: _nc_makenew (lib_newwin.c:218) +==23273== by 0x807299B: newwin (lib_newwin.c:126) +==23273== by 0x8074F9A: _nc_setupscreen (lib_set_term.c:459) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 80 bytes in 1 blocks are still reachable in loss record 28 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x8072E08: _nc_makenew (lib_newwin.c:218) +==23273== by 0x807299B: newwin (lib_newwin.c:126) +==23273== by 0x8074CB3: _nc_setupscreen (lib_set_term.c:414) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 80 bytes in 1 blocks are still reachable in loss record 29 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x8072E08: _nc_makenew (lib_newwin.c:218) +==23273== by 0x807299B: newwin (lib_newwin.c:126) +==23273== by 0x8074C55: _nc_setupscreen (lib_set_term.c:410) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 80 bytes in 1 blocks are still reachable in loss record 30 of 62 +==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429) +==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50) +==23273== by 0x808538F: read_termtype (read_entry.c:284) +==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392) +==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413) +==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438) +==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500) +==23273== by 0x8081834: grab_entry (lib_setup.c:255) +==23273== by 0x8081D46: setupterm (lib_setup.c:438) +==23273== by 0x8072292: newterm (lib_newterm.c:115) +==23273== +==23273== +==23273== 112 bytes in 7 blocks are still reachable in loss record 31 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x41165D0: tsearch (tsearch.c:281) +==23273== by 0x805FC92: make_cache (inputstr.c:149) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396) +==23273== by 0x8066A0A: dlg_print_line (util.c:668) +==23273== by 0x8066E40: justify_text (util.c:813) +==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843) +==23273== by 0x806703E: dlg_print_scrolled (util.c:892) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== +==23273== +==23273== 118 bytes in 1 blocks are still reachable in loss record 32 of 62 +==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429) +==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50) +==23273== by 0x8082957: _nc_tparm_analyze (lib_tparm.c:374) +==23273== by 0x8082B5E: tparam_internal (lib_tparm.c:502) +==23273== by 0x80833C4: tparm (lib_tparm.c:788) +==23273== by 0x80782E6: vidputs (lib_vidattr.c:187) +==23273== by 0x8078B59: vidattr (lib_vidattr.c:270) +==23273== by 0x807ACE8: ClrToEOS (tty_update.c:957) +==23273== by 0x807AF54: ClrBottom (tty_update.c:1006) +==23273== by 0x807AB1C: ClrUpdate (tty_update.c:897) +==23273== +==23273== +==23273== 128 bytes in 8 blocks are still reachable in loss record 33 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x41165D0: tsearch (tsearch.c:281) +==23273== by 0x805FC92: make_cache (inputstr.c:149) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FECD: dlg_index_wchars (inputstr.c:341) +==23273== by 0x8066A18: dlg_print_line (util.c:669) +==23273== by 0x8066E40: justify_text (util.c:813) +==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843) +==23273== by 0x806703E: dlg_print_scrolled (util.c:892) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== +==23273== +==23273== 128 bytes in 1 blocks are still reachable in loss record 34 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x806BDE0: start_color (lib_color.c:238) +==23273== by 0x80663B1: dlg_color_setup (util.c:360) +==23273== by 0x806638E: init_dialog (util.c:342) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 128 bytes in 1 blocks are still reachable in loss record 35 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x806BDA7: start_color (lib_color.c:236) +==23273== by 0x80663B1: dlg_color_setup (util.c:360) +==23273== by 0x806638E: init_dialog (util.c:342) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 160 bytes in 1 blocks are still reachable in loss record 36 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x8087176: _nc_hash_map (hashmap.c:299) +==23273== by 0x80865F4: _nc_scroll_optimize (hardscroll.c:199) +==23273== by 0x807A762: doupdate (tty_update.c:778) +==23273== by 0x8073C0A: wrefresh (lib_refresh.c:58) +==23273== by 0x806D95D: _nc_wgetch (lib_getch.c:295) +==23273== by 0x806DD0D: wgetch (lib_getch.c:467) +==23273== by 0x80654FC: really_getch (ui_getc.c:352) +==23273== by 0x806566B: dlg_getc (ui_getc.c:423) +==23273== by 0x80627C4: mouse_wgetch (mousewget.c:35) +==23273== +==23273== +==23273== 160 bytes in 1 blocks are still reachable in loss record 37 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x8087141: _nc_hash_map (hashmap.c:297) +==23273== by 0x80865F4: _nc_scroll_optimize (hardscroll.c:199) +==23273== by 0x807A762: doupdate (tty_update.c:778) +==23273== by 0x8073C0A: wrefresh (lib_refresh.c:58) +==23273== by 0x806D95D: _nc_wgetch (lib_getch.c:295) +==23273== by 0x806DD0D: wgetch (lib_getch.c:467) +==23273== by 0x80654FC: really_getch (ui_getc.c:352) +==23273== by 0x806566B: dlg_getc (ui_getc.c:423) +==23273== by 0x80627C4: mouse_wgetch (mousewget.c:35) +==23273== +==23273== +==23273== 160 bytes in 1 blocks are still reachable in loss record 38 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x807F2D5: _nc_doalloc (doalloc.c:55) +==23273== by 0x80865CB: _nc_scroll_optimize (hardscroll.c:192) +==23273== by 0x807A762: doupdate (tty_update.c:778) +==23273== by 0x8073C0A: wrefresh (lib_refresh.c:58) +==23273== by 0x806D95D: _nc_wgetch (lib_getch.c:295) +==23273== by 0x806DD0D: wgetch (lib_getch.c:467) +==23273== by 0x80654FC: really_getch (ui_getc.c:352) +==23273== by 0x806566B: dlg_getc (ui_getc.c:423) +==23273== by 0x80627C4: mouse_wgetch (mousewget.c:35) +==23273== +==23273== +==23273== 172 bytes in 1 blocks are still reachable in loss record 39 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x8081CD7: setupterm (lib_setup.c:431) +==23273== by 0x8072292: newterm (lib_newterm.c:115) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 196 bytes in 7 blocks are still reachable in loss record 40 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x805FC0F: make_cache (inputstr.c:139) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FFB4: dlg_index_columns (inputstr.c:396) +==23273== by 0x8066A0A: dlg_print_line (util.c:668) +==23273== by 0x8066E40: justify_text (util.c:813) +==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843) +==23273== by 0x806703E: dlg_print_scrolled (util.c:892) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== +==23273== +==23273== 224 bytes in 8 blocks are still reachable in loss record 41 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x805FC0F: make_cache (inputstr.c:139) +==23273== by 0x805FCF7: load_cache (inputstr.c:161) +==23273== by 0x805FECD: dlg_index_wchars (inputstr.c:341) +==23273== by 0x8066A18: dlg_print_line (util.c:669) +==23273== by 0x8066E40: justify_text (util.c:813) +==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843) +==23273== by 0x806703E: dlg_print_scrolled (util.c:892) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== +==23273== +==23273== 252 bytes in 1 blocks are still reachable in loss record 42 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x80858B3: read_termtype (read_entry.c:345) +==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392) +==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413) +==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438) +==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500) +==23273== by 0x8081834: grab_entry (lib_setup.c:255) +==23273== by 0x8081D46: setupterm (lib_setup.c:438) +==23273== by 0x8072292: newterm (lib_newterm.c:115) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== +==23273== +==23273== 421 bytes in 1 blocks are still reachable in loss record 43 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8068E64: dlg_strclone (util.c:1740) +==23273== by 0x805FE72: same_cache2 (inputstr.c:212) +==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8066FD3: dlg_print_scrolled (util.c:886) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 480 bytes in 1 blocks are still reachable in loss record 44 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x8072E36: _nc_makenew (lib_newwin.c:223) +==23273== by 0x807299B: newwin (lib_newwin.c:126) +==23273== by 0x8074F9A: _nc_setupscreen (lib_set_term.c:459) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 480 bytes in 1 blocks are still reachable in loss record 45 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x8072E36: _nc_makenew (lib_newwin.c:223) +==23273== by 0x807299B: newwin (lib_newwin.c:126) +==23273== by 0x8074CB3: _nc_setupscreen (lib_set_term.c:414) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 480 bytes in 1 blocks are still reachable in loss record 46 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x8072E36: _nc_makenew (lib_newwin.c:223) +==23273== by 0x807299B: newwin (lib_newwin.c:126) +==23273== by 0x8074C55: _nc_setupscreen (lib_set_term.c:410) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 689 bytes in 1 blocks are still reachable in loss record 47 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8085659: read_termtype (read_entry.c:318) +==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392) +==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413) +==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438) +==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500) +==23273== by 0x8081834: grab_entry (lib_setup.c:255) +==23273== by 0x8081D46: setupterm (lib_setup.c:438) +==23273== by 0x8072292: newterm (lib_newterm.c:115) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== +==23273== +==23273== 780 bytes in 65 blocks are still reachable in loss record 48 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x807F1FF: _nc_add_to_try (add_tries.c:104) +==23273== by 0x80885C6: _nc_init_keytry (init_keytry.c:74) +==23273== by 0x80807F4: _nc_keypad (lib_options.c:262) +==23273== by 0x808035F: keypad (lib_options.c:129) +==23273== by 0x8066340: init_dialog (util.c:330) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 1,008 bytes in 84 blocks are still reachable in loss record 49 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x807F119: _nc_add_to_try (add_tries.c:77) +==23273== by 0x80885C6: _nc_init_keytry (init_keytry.c:74) +==23273== by 0x80807F4: _nc_keypad (lib_options.c:262) +==23273== by 0x808035F: keypad (lib_options.c:129) +==23273== by 0x8066340: init_dialog (util.c:330) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 1,338 bytes in 1 blocks are still reachable in loss record 50 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8084DF7: read_termtype (read_entry.c:193) +==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392) +==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413) +==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438) +==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500) +==23273== by 0x8081834: grab_entry (lib_setup.c:255) +==23273== by 0x8081D46: setupterm (lib_setup.c:438) +==23273== by 0x8072292: newterm (lib_newterm.c:115) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== +==23273== +==23273== 1,382 bytes in 7 blocks are still reachable in loss record 51 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8068E64: dlg_strclone (util.c:1740) +==23273== by 0x805FE72: same_cache2 (inputstr.c:212) +==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397) +==23273== by 0x8066A0A: dlg_print_line (util.c:668) +==23273== by 0x8066E40: justify_text (util.c:813) +==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843) +==23273== by 0x806703E: dlg_print_scrolled (util.c:892) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== +==23273== +==23273== 1,520 bytes in 1 blocks are still reachable in loss record 52 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x80747CF: _nc_setupscreen (lib_set_term.c:221) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 1,640 bytes in 1 blocks are still reachable in loss record 53 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8087007: _nc_hash_map (hashmap.c:277) +==23273== by 0x80865F4: _nc_scroll_optimize (hardscroll.c:199) +==23273== by 0x807A762: doupdate (tty_update.c:778) +==23273== by 0x8073C0A: wrefresh (lib_refresh.c:58) +==23273== by 0x806D95D: _nc_wgetch (lib_getch.c:295) +==23273== by 0x806DD0D: wgetch (lib_getch.c:467) +==23273== by 0x80654FC: really_getch (ui_getc.c:352) +==23273== by 0x806566B: dlg_getc (ui_getc.c:423) +==23273== by 0x80627C4: mouse_wgetch (mousewget.c:35) +==23273== +==23273== +==23273== 1,684 bytes in 1 blocks are still reachable in loss record 54 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x805FDE1: same_cache2 (inputstr.c:201) +==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397) +==23273== by 0x8060166: dlg_count_columns (inputstr.c:473) +==23273== by 0x8066FD3: dlg_print_scrolled (util.c:886) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 1,803 bytes in 8 blocks are still reachable in loss record 55 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8068E64: dlg_strclone (util.c:1740) +==23273== by 0x805FE72: same_cache2 (inputstr.c:212) +==23273== by 0x805FEE7: dlg_index_wchars (inputstr.c:342) +==23273== by 0x8066A18: dlg_print_line (util.c:669) +==23273== by 0x8066E40: justify_text (util.c:813) +==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843) +==23273== by 0x806703E: dlg_print_scrolled (util.c:892) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== +==23273== +==23273== 1,892 bytes in 1 blocks are still reachable in loss record 56 of 62 +==23273== at 0x4023E8C: realloc (vg_replace_malloc.c:429) +==23273== by 0x807F2A9: _nc_doalloc (doalloc.c:50) +==23273== by 0x80853BA: read_termtype (read_entry.c:285) +==23273== by 0x8085B64: _nc_read_file_entry (read_entry.c:392) +==23273== by 0x8085BF5: _nc_read_tic_entry (read_entry.c:413) +==23273== by 0x8085C8A: _nc_read_terminfo_dirs (read_entry.c:438) +==23273== by 0x8085E90: _nc_read_entry (read_entry.c:500) +==23273== by 0x8081834: grab_entry (lib_setup.c:255) +==23273== by 0x8081D46: setupterm (lib_setup.c:438) +==23273== by 0x8072292: newterm (lib_newterm.c:115) +==23273== +==23273== +==23273== 2,800 bytes in 1 blocks are still reachable in loss record 57 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x8085F59: _nc_set_buffer (setbuf.c:119) +==23273== by 0x807481F: _nc_setupscreen (lib_set_term.c:232) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 5,528 bytes in 7 blocks are still reachable in loss record 58 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x805FDE1: same_cache2 (inputstr.c:201) +==23273== by 0x805FFCE: dlg_index_columns (inputstr.c:397) +==23273== by 0x8066A0A: dlg_print_line (util.c:668) +==23273== by 0x8066E40: justify_text (util.c:813) +==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843) +==23273== by 0x806703E: dlg_print_scrolled (util.c:892) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 7,212 bytes in 8 blocks are still reachable in loss record 59 of 62 +==23273== at 0x4023D6E: malloc (vg_replace_malloc.c:207) +==23273== by 0x805FDE1: same_cache2 (inputstr.c:201) +==23273== by 0x805FEE7: dlg_index_wchars (inputstr.c:342) +==23273== by 0x8066A18: dlg_print_line (util.c:669) +==23273== by 0x8066E40: justify_text (util.c:813) +==23273== by 0x8066F5E: dlg_print_autowrap (util.c:843) +==23273== by 0x806703E: dlg_print_scrolled (util.c:892) +==23273== by 0x806A30C: dialog_yesno (yesno.c:104) +==23273== by 0x804A728: call_yesno (dialog.c:600) +==23273== by 0x804CC56: main (dialog.c:1679) +==23273== +==23273== +==23273== 12,800 bytes in 40 blocks are still reachable in loss record 60 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x80729EC: newwin (lib_newwin.c:130) +==23273== by 0x8074F9A: _nc_setupscreen (lib_set_term.c:459) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 12,800 bytes in 40 blocks are still reachable in loss record 61 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x80729EC: newwin (lib_newwin.c:130) +==23273== by 0x8074CB3: _nc_setupscreen (lib_set_term.c:414) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== +==23273== 12,800 bytes in 40 blocks are still reachable in loss record 62 of 62 +==23273== at 0x4021E22: calloc (vg_replace_malloc.c:397) +==23273== by 0x80729EC: newwin (lib_newwin.c:130) +==23273== by 0x8074C55: _nc_setupscreen (lib_set_term.c:410) +==23273== by 0x80723F1: newterm (lib_newterm.c:146) +==23273== by 0x806E82C: initscr (lib_initscr.c:83) +==23273== by 0x8066211: init_dialog (util.c:292) +==23273== by 0x804C880: main (dialog.c:1604) +==23273== +==23273== LEAK SUMMARY: +==23273== definitely lost: 0 bytes in 0 blocks. +==23273== possibly lost: 0 bytes in 0 blocks. +==23273== still reachable: 72,482 bytes in 382 blocks. +==23273== suppressed: 0 bytes in 0 blocks. +--23273-- memcheck: sanity checks: 8 cheap, 2 expensive +--23273-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use +--23273-- memcheck: auxmaps_L1: 0 searches, 0 cmps, ratio 0:10 +--23273-- memcheck: auxmaps_L2: 0 searches, 0 nodes +--23273-- memcheck: SMs: n_issued = 11 (176k, 0M) +--23273-- memcheck: SMs: n_deissued = 0 (0k, 0M) +--23273-- memcheck: SMs: max_noaccess = 65535 (1048560k, 1023M) +--23273-- memcheck: SMs: max_undefined = 0 (0k, 0M) +--23273-- memcheck: SMs: max_defined = 25 (400k, 0M) +--23273-- memcheck: SMs: max_non_DSM = 11 (176k, 0M) +--23273-- memcheck: max sec V bit nodes: 21 (1k, 0M) +--23273-- memcheck: set_sec_vbits8 calls: 130 (new: 21, updates: 109) +--23273-- memcheck: max shadow mem size: 481k, 0M +--23273-- translate: fast SP updates identified: 4,767 ( 83.0%) +--23273-- translate: generic_known SP updates identified: 612 ( 10.6%) +--23273-- translate: generic_unknown SP updates identified: 358 ( 6.2%) +--23273-- tt/tc: 11,509 tt lookups requiring 11,938 probes +--23273-- tt/tc: 11,509 fast-cache updates, 3 flushes +--23273-- transtab: new 5,099 (117,852 -> 1,563,594; ratio 132:10) [0 scs] +--23273-- transtab: dumped 0 (0 -> ??) +--23273-- transtab: discarded 9 (222 -> ??) +--23273-- scheduler: 864,676 jumps (bb entries). +--23273-- scheduler: 8/7,086 major/minor sched events. +--23273-- sanity: 9 cheap, 2 expensive checks. +--23273-- exectx: 769 lists, 102 contexts (avg 0 per list) +--23273-- exectx: 470 searches, 372 full compares (791 per 1000) +--23273-- exectx: 0 cmp2, 36 cmp4, 2,470 cmpAll +--23273-- errormgr: 69 supplist searches, 5,672 comparisons during search +--23273-- errormgr: 14 errlist searches, 36 comparisons during search diff --git a/contrib/dialog/samples/wheel b/contrib/dialog/samples/wheel index 4adef26..ff75f71 100755 --- a/contrib/dialog/samples/wheel +++ b/contrib/dialog/samples/wheel @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: wheel,v 1.8 2012/06/29 09:59:40 tom Exp $ +# $Id: wheel,v 1.7 2010/01/13 01:44:12 tom Exp $ . ./setup-vars @@ -17,10 +17,10 @@ COLS=`expr $COLS - 30` # Takes an integer, multiplies it for COLS, divides for 132 scalex() { - expr $1 \* $COLS / 132 + echo $[$1*$COLS/132] } scaley() { - expr $1 \* $ROWS / 60 + echo $[$1*$ROWS/60] } $DIALOG --backtitle "$TITLE" --no-shadow \ diff --git a/contrib/dialog/samples/whiptail.rc b/contrib/dialog/samples/whiptail.rc index b12e687..8515012 100644 --- a/contrib/dialog/samples/whiptail.rc +++ b/contrib/dialog/samples/whiptail.rc @@ -1,4 +1,4 @@ -# $Id: whiptail.rc,v 1.5 2011/10/15 01:01:16 tom Exp $ +# $Id: whiptail.rc,v 1.3 2011/01/17 00:15:54 tom Exp $ # vile:confmode # Run-time configuration file for dialog, matches whiptail's color scheme. # @@ -46,79 +46,79 @@ border_color = (WHITE,WHITE,ON) button_active_color = (WHITE,RED,ON) # Inactive button color -button_inactive_color = dialog_color +button_inactive_color = (BLACK,WHITE,OFF) # Active button key color -button_key_active_color = button_active_color +button_key_active_color = (WHITE,RED,ON) # Inactive button key color -button_key_inactive_color = dialog_color +button_key_inactive_color = (BLACK,WHITE,OFF) # Active button label color -button_label_active_color = button_active_color +button_label_active_color = (WHITE,RED,ON) # Inactive button label color button_label_inactive_color = (BLACK,WHITE,ON) # Input box color -inputbox_color = dialog_color +inputbox_color = (BLACK,WHITE,OFF) # Input box border color -inputbox_border_color = dialog_color +inputbox_border_color = (BLACK,WHITE,OFF) # Search box color -searchbox_color = dialog_color +searchbox_color = (BLACK,WHITE,OFF) # Search box title color -searchbox_title_color = title_color +searchbox_title_color = (RED,WHITE,ON) # Search box border color -searchbox_border_color = border_color +searchbox_border_color = (WHITE,WHITE,ON) # File position indicator color -position_indicator_color = title_color +position_indicator_color = (RED,WHITE,ON) # Menu box color menubox_color = (YELLOW,BLUE,OFF) # Menu box border color -menubox_border_color = screen_color +menubox_border_color = (YELLOW,BLUE,ON) # Item color -item_color = menubox_color +item_color = (YELLOW,BLUE,OFF) # Selected item color -item_selected_color = screen_color +item_selected_color = (YELLOW,BLUE,ON) # Tag color -tag_color = screen_color +tag_color = (YELLOW,BLUE,ON) # Selected tag color -tag_selected_color = screen_color +tag_selected_color = (YELLOW,BLUE,ON) # Tag key color -tag_key_color = menubox_color +tag_key_color = (YELLOW,BLUE,OFF) # Selected tag key color tag_key_selected_color = (WHITE,BLUE,ON) # Check box color -check_color = menubox_color +check_color = (YELLOW,BLUE,OFF) # Selected check box color -check_selected_color = screen_color +check_selected_color = (YELLOW,BLUE,ON) # Up arrow color -uarrow_color = screen_color +uarrow_color = (YELLOW,BLUE,ON) # Down arrow color -darrow_color = screen_color +darrow_color = (YELLOW,BLUE,ON) # Item help-text color itemhelp_color = (WHITE,BLACK,OFF) # Active form text color -form_active_text_color = tag_key_selected_color +form_active_text_color = (WHITE,BLUE,ON) # Form text color form_text_color = (WHITE,CYAN,ON) @@ -128,15 +128,3 @@ form_item_readonly_color = (CYAN,WHITE,ON) # Dialog box gauge color gauge_color = (BLUE,WHITE,ON) - -# Dialog box border2 color -border2_color = dialog_color - -# Input box border2 color -inputbox_border2_color = dialog_color - -# Search box border2 color -searchbox_border2_color = dialog_color - -# Menu box border2 color -menubox_border2_color = dialog_color diff --git a/contrib/dialog/samples/with-dquotes b/contrib/dialog/samples/with-dquotes deleted file mode 100755 index 604f51b..0000000 --- a/contrib/dialog/samples/with-dquotes +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# $Id: with-dquotes,v 1.1 2012/07/03 09:40:19 tom Exp $ -DIALOGOPTS="$DIALOGOPTS --quoted" "$@" diff --git a/contrib/dialog/samples/with-squotes b/contrib/dialog/samples/with-squotes deleted file mode 100755 index 6a08f9f..0000000 --- a/contrib/dialog/samples/with-squotes +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# $Id: with-squotes,v 1.1 2012/07/03 09:40:29 tom Exp $ -DIALOGOPTS="$DIALOGOPTS --single-quoted" "$@" diff --git a/contrib/dialog/tailbox.c b/contrib/dialog/tailbox.c index 0324009..c111f64 100644 --- a/contrib/dialog/tailbox.c +++ b/contrib/dialog/tailbox.c @@ -1,5 +1,5 @@ /* - * $Id: tailbox.c,v 1.67 2011/10/15 12:43:07 tom Exp $ + * $Id: tailbox.c,v 1.63 2011/06/27 08:19:43 tom Exp $ * * tailbox.c -- implements the tail box * @@ -96,7 +96,6 @@ print_line(MY_OBJ * obj, WINDOW *win, int row, int width) #endif getyx(win, y, x); - (void) y; /* Clear 'residue' of previous line */ for (i = 0; i < width - x; i++) (void) waddch(win, ' '); @@ -337,8 +336,8 @@ dialog_tailbox(const char *title, const char *file, int height, int width, int b y + MARGIN, x + MARGIN); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); dlg_draw_title(dialog, title); dlg_draw_helpline(dialog, FALSE); @@ -372,7 +371,6 @@ dialog_tailbox(const char *title, const char *file, int height, int width, int b dlg_attr_clear(text, thigh, getmaxx(text), dialog_attr); repaint_text(obj); - dlg_trace_win(dialog); if (bg_task) { result = DLG_EXIT_OK; } else { diff --git a/contrib/dialog/textbox.c b/contrib/dialog/textbox.c index bf89ca5..72a9b11 100644 --- a/contrib/dialog/textbox.c +++ b/contrib/dialog/textbox.c @@ -1,9 +1,9 @@ /* - * $Id: textbox.c,v 1.107 2012/07/01 18:13:24 Zoltan.Kelemen Exp $ + * $Id: textbox.c,v 1.101 2011/06/29 09:53:03 tom Exp $ * * textbox.c -- implements the text box * - * Copyright 2000-2011,2012 Thomas E. Dickey + * Copyright 2000-2010,2011 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 @@ -414,7 +414,6 @@ print_page(MY_OBJ * obj, int height, int width) passed_end = 1; } (void) wnoutrefresh(obj->text); - dlg_trace_win(obj->text); } /* @@ -489,10 +488,9 @@ get_search_term(WINDOW *dialog, char *input, int height, int width) keypad(widget, TRUE); dlg_register_window(widget, "searchbox", binding); - dlg_draw_box2(widget, 0, 0, box_height, box_width, - searchbox_attr, - searchbox_border_attr, - searchbox_border2_attr); + dlg_draw_box(widget, 0, 0, box_height, box_width, + searchbox_attr, + searchbox_border_attr); wattrset(widget, searchbox_title_attr); (void) wmove(widget, 0, (box_width - len_caption) / 2); @@ -500,6 +498,8 @@ get_search_term(WINDOW *dialog, char *input, int height, int width) limit = dlg_limit_columns(caption, len_caption, 0); (void) waddnstr(widget, caption + indx[0], indx[limit] - indx[0]); + box_y++; + box_x++; box_width -= 2; offset = dlg_count_columns(input); @@ -581,6 +581,7 @@ perform_search(MY_OBJ * obj, int height, int width, int key, char *search_term) back_lines(obj, (dir ? obj->page_length - 1 : obj->page_length + 1)); + found = FALSE; if (dir) { /* Forward search */ while ((found = match_string(obj, search_term)) == FALSE) { if (obj->end_reached) @@ -674,7 +675,7 @@ dialog_textbox(const char *title, const char *file, int height, int width) WINDOW *dialog; bool moved; int result = DLG_EXIT_UNKNOWN; - int button = dlg_default_button(); + int button = dialog_vars.extra_button ? dlg_defaultno_button() : 0; int min_width = 12; search_term[0] = '\0'; /* no search term entered yet */ @@ -724,8 +725,8 @@ dialog_textbox(const char *title, const char *file, int height, int width) /* register the new window, along with its borders */ dlg_mouse_mkbigregion(0, 0, PAGE_LENGTH + 2, width, KEY_MAX, 1, 1, 1 /* lines */ ); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); dlg_draw_title(dialog, title); dlg_draw_buttons(dialog, PAGE_LENGTH + 2, 0, obj.buttons, button, FALSE, width); @@ -914,6 +915,7 @@ dialog_textbox(const char *title, const char *file, int height, int width) height = old_height; width = old_width; back_lines(&obj, obj.page_length); + moved = TRUE; /* repaint */ dlg_clear(); dlg_del_window(dialog); diff --git a/contrib/dialog/timebox.c b/contrib/dialog/timebox.c index 439120b..5a6be3e 100644 --- a/contrib/dialog/timebox.c +++ b/contrib/dialog/timebox.c @@ -1,9 +1,9 @@ /* - * $Id: timebox.c,v 1.52 2012/07/02 09:34:04 tom Exp $ + * $Id: timebox.c,v 1.45 2011/06/27 08:20:22 tom Exp $ * * timebox.c -- implements the timebox dialog * - * Copyright 2001-2011,2012 Thomas E. Dickey + * Copyright 2001-2010,2011 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 @@ -82,9 +82,9 @@ draw_cell(BOX * data) dlg_draw_box(data->parent, data->y - MARGIN, data->x - MARGIN, data->height + (2 * MARGIN), data->width + (2 * MARGIN), - menubox_border_attr, menubox_border2_attr); + menubox_border_attr, menubox_attr); - (void) wattrset(data->window, item_attr); + wattrset(data->window, item_attr); wprintw(data->window, "%02d", data->value); return 0; } @@ -184,7 +184,7 @@ dialog_timebox(const char *title, WINDOW *dialog; time_t now_time = time((time_t *) 0); struct tm current; - int state = dlg_default_button(); + int state = dlg_defaultno_button(); const char **buttons = dlg_ok_labels(); char *prompt = dlg_strclone(subtitle); char buffer[MAX_LEN]; @@ -221,12 +221,12 @@ dialog_timebox(const char *title, dlg_register_window(dialog, "timebox", binding); dlg_register_buttons(dialog, "timebox", buttons); - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); dlg_draw_title(dialog, title); dlg_draw_helpline(dialog, FALSE); - (void) wattrset(dialog, dialog_attr); + wattrset(dialog, dialog_attr); dlg_print_autowrap(dialog, prompt, height, width); /* compute positions of hour, month and year boxes */ @@ -275,7 +275,6 @@ dialog_timebox(const char *title, return CleanupResult(DLG_EXIT_ERROR, dialog, prompt, &save_vars); } - dlg_trace_win(dialog); while (result == DLG_EXIT_UNKNOWN) { BOX *obj = (state == sHR ? &hr_box : (state == sMN ? &mn_box : @@ -296,6 +295,12 @@ dialog_timebox(const char *title, /* handle function-keys */ if (fkey) { switch (key) { + case DLGK_MOUSE(0): + result = DLG_EXIT_OK; + break; + case DLGK_MOUSE(1): + result = DLG_EXIT_CANCEL; + break; case DLGK_MOUSE('H'): state = sHR; break; @@ -306,7 +311,7 @@ dialog_timebox(const char *title, state = sSC; break; case DLGK_ENTER: - result = dlg_ok_buttoncode(button); + result = button; break; case DLGK_FIELD_PREV: state = dlg_prev_ok_buttonindex(state, sHR); @@ -356,11 +361,7 @@ dialog_timebox(const char *title, goto retry; #endif default: - if (is_DLGK_MOUSE(key)) { - result = dlg_ok_buttoncode(key - M_EVENT); - if (result < 0) - result = DLG_EXIT_OK; - } else if (obj != 0) { + if (obj != 0) { int step = next_or_previous(key); if (step != 0) { obj->value += step; diff --git a/contrib/dialog/trace.c b/contrib/dialog/trace.c index 50ccfac..a742ae8 100644 --- a/contrib/dialog/trace.c +++ b/contrib/dialog/trace.c @@ -1,5 +1,5 @@ /* - * $Id: trace.c,v 1.20 2011/10/18 10:47:26 tom Exp $ + * $Id: trace.c,v 1.14 2011/06/21 21:12:56 tom Exp $ * * trace.c -- implements screen-dump and keystroke-logging * @@ -24,10 +24,6 @@ #ifdef HAVE_DLG_TRACE -#ifdef NEED_WCHAR_H -#include <wchar.h> -#endif - #include <dlg_keys.h> #include <time.h> @@ -58,94 +54,38 @@ dlg_trace_win(WINDOW *win) if (myFP != 0) { int y, x; int j, k; - WINDOW *top = wgetparent(win); - - while (top != 0 && top != stdscr) { - win = top; - top = wgetparent(win); - } - - if (win != 0) { - 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) { -#ifdef USE_WIDE_CURSES - char buffer[80]; - - ch = mvwinch(win, j, k) & (A_CHARTEXT | A_ALTCHARSET); - if (ch & A_ALTCHARSET) { - c2 = dlg_asciibox(ch); - if (c2 != 0) { - ch = c2; - } - buffer[0] = (char) ch; - buffer[1] = '\0'; - } else { - cchar_t cch; - wchar_t *uc; - - if (win_wch(win, &cch) == ERR - || (uc = wunctrl(&cch)) == 0 - || uc[1] != 0 - || wcwidth(uc[0]) <= 0) { - buffer[0] = '.'; - buffer[1] = '\0'; - } else { - mbstate_t state; - const wchar_t *ucp = uc; - - memset(&state, 0, sizeof(state)); - wcsrtombs(buffer, &ucp, sizeof(buffer), &state); - k += wcwidth(uc[0]) - 1; - } - } - fputs(buffer, myFP); -#else - 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); -#endif + 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('\n', myFP); + fputc((int) (ch & 0xff), myFP); } - wmove(win, y, x); - fflush(myFP); + fputc('\n', myFP); } + wmove(win, y, x); + fflush(myFP); } } void dlg_trace_chr(int ch, int fkey) { - static int last_err = 0; - - /* - * Do not bother to trace ERR's indefinitely, since those are usually due - * to relatively short polling timeouts. - */ - if (last_err && !fkey && ch == ERR) { - ++last_err; - } else if (myFP != 0) { + if (myFP != 0) { const char *fkey_name = "?"; - - if (last_err) { - fprintf(myFP, "skipped %d ERR's\n", last_err); - last_err = 0; - } - if (fkey) { if (fkey > KEY_MAX || (fkey_name = keyname(fkey)) == 0) { #define CASE(name) case name: fkey_name = #name; break @@ -168,10 +108,6 @@ dlg_trace_chr(int ch, int fkey) CASE(DLGK_FIELD_LAST); CASE(DLGK_FIELD_NEXT); CASE(DLGK_FIELD_PREV); - CASE(DLGK_FORM_FIRST); - CASE(DLGK_FORM_LAST); - CASE(DLGK_FORM_NEXT); - CASE(DLGK_FORM_PREV); CASE(DLGK_GRID_UP); CASE(DLGK_GRID_DOWN); CASE(DLGK_GRID_LEFT); @@ -189,7 +125,6 @@ dlg_trace_chr(int ch, int fkey) } } else if (ch == ERR) { fkey_name = "ERR"; - last_err = 1; } else { fkey_name = unctrl((chtype) ch); if (fkey_name == 0) diff --git a/contrib/dialog/ui_getc.c b/contrib/dialog/ui_getc.c index b0ff15b..d9d5a93 100644 --- a/contrib/dialog/ui_getc.c +++ b/contrib/dialog/ui_getc.c @@ -1,5 +1,5 @@ /* - * $Id: ui_getc.c,v 1.65 2011/10/20 23:45:48 tom Exp $ + * $Id: ui_getc.c,v 1.63 2011/07/07 22:05:58 tom Exp $ * * ui_getc.c - user interface glue for getc() * @@ -294,7 +294,8 @@ valid_file(FILE *fp) int fd = fileno(fp); if (fd >= 0) { - if (fcntl(fd, F_GETFL, 0) >= 0) { + long result = 0; + if ((result = fcntl(fd, F_GETFL, 0)) >= 0) { code = TRUE; } } @@ -529,7 +530,6 @@ dlg_getc(WINDOW *win, int *fkey) if (handle_others) { if ((p = dialog_state.getc_redirect) != 0) { if (!(p->handle_getc(p, ch, *fkey, &result))) { - done = (p->win == save_win) && (!p->keep_win); dlg_remove_callback(p); dialog_state.getc_redirect = 0; win = save_win; diff --git a/contrib/dialog/util.c b/contrib/dialog/util.c index ab9c47c..82ef4fa 100644 --- a/contrib/dialog/util.c +++ b/contrib/dialog/util.c @@ -1,9 +1,9 @@ /* - * $Id: util.c,v 1.243 2012/06/30 12:58:04 tom Exp $ + * $Id: util.c,v 1.227 2011/07/07 23:42:30 tom Exp $ * * util.c -- miscellaneous utilities for dialog * - * Copyright 2000-2011,2012 Thomas E. Dickey + * Copyright 2000-2010,2011 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 @@ -27,14 +27,6 @@ #include <dialog.h> #include <dlg_keys.h> -#ifdef HAVE_SETLOCALE -#include <locale.h> -#endif - -#ifdef NEED_WCHAR_H -#include <wchar.h> -#endif - #ifdef NCURSES_VERSION #if defined(HAVE_NCURSESW_TERM_H) #include <ncursesw/term.h> @@ -63,12 +55,6 @@ DIALOG_STATE dialog_state; DIALOG_VARS dialog_vars; -#if !(defined(HAVE_WGETPARENT) && defined(HAVE_WINDOW__PARENT)) -#define NEED_WGETPARENT 1 -#else -#undef NEED_WGETPARENT -#endif - #define concat(a,b) a##b #ifdef HAVE_RC_FILE @@ -93,7 +79,6 @@ DIALOG_VARS dialog_vars; /* * Table of color and attribute values, default is for mono display. - * The order matches the DIALOG_ATR() values. */ /* *INDENT-OFF* */ DIALOG_COLORS dlg_color_table[] = @@ -131,57 +116,11 @@ DIALOG_COLORS dlg_color_table[] = DATA(A_BOLD, FORM_ACTIVE_TEXT, form_active_text, "Active form text"), DATA(A_REVERSE, FORM_TEXT, form_text, "Form text"), DATA(A_NORMAL, FORM_ITEM_READONLY, form_item_readonly, "Readonly form item"), - DATA(A_REVERSE, GAUGE, gauge, "Dialog box gauge"), - DATA(A_REVERSE, BORDER2, border2, "Dialog box border2"), - DATA(A_REVERSE, INPUTBOX_BORDER2, inputbox_border2, "Input box border2"), - DATA(A_REVERSE, SEARCHBOX_BORDER2, searchbox_border2, "Search box border2"), - DATA(A_REVERSE, MENUBOX_BORDER2, menubox_border2, "Menu box border2") + DATA(A_REVERSE, GAUGE, gauge, "Dialog box gauge") }; /* *INDENT-ON* */ /* - * Maintain a list of subwindows so that we can delete them to cleanup. - * More important, this provides a fallback when wgetparent() is not available. - */ -static void -add_subwindow(WINDOW *parent, WINDOW *child) -{ - DIALOG_WINDOWS *p = dlg_calloc(DIALOG_WINDOWS, 1); - - if (p != 0) { - p->normal = parent; - p->shadow = child; - p->next = dialog_state.all_subwindows; - dialog_state.all_subwindows = p; - } -} - -static void -del_subwindows(WINDOW *parent) -{ - DIALOG_WINDOWS *p = dialog_state.all_subwindows; - DIALOG_WINDOWS *q = 0; - DIALOG_WINDOWS *r; - - while (p != 0) { - if (p->normal == parent) { - delwin(p->shadow); - r = p->next; - if (q == 0) { - dialog_state.all_subwindows = r; - } else { - q->next = r; - } - free(p); - p = r; - } else { - q = p; - p = p->next; - } - } -} - -/* * Display background title if it exists ... */ void @@ -287,8 +226,6 @@ init_dialog(FILE *input, FILE *output) int fd1, fd2; char *device = 0; - setlocale(LC_ALL, ""); - dialog_state.output = output; dialog_state.tab_len = TAB_LEN; dialog_state.aspect_ratio = DEFAULT_ASPECT_RATIO; @@ -315,7 +252,7 @@ init_dialog(FILE *input, FILE *output) */ dialog_state.pipe_input = stdin; if (fileno(input) != fileno(stdin)) { - if (dup(fileno(input)) >= 0 + if ((fd1 = dup(fileno(input))) >= 0 && (fd2 = dup(fileno(stdin))) >= 0) { (void) dup2(fileno(input), fileno(stdin)); dialog_state.pipe_input = fdopen(fd2, "r"); @@ -324,7 +261,7 @@ init_dialog(FILE *input, FILE *output) } else dlg_exiterr("cannot open tty-input"); } else if (!isatty(fileno(stdin))) { - if (open_terminal(&device, O_RDONLY) >= 0 + if ((fd1 = open_terminal(&device, O_RDONLY)) >= 0 && (fd2 = dup(fileno(stdin))) >= 0) { dialog_state.pipe_input = fdopen(fd2, "r"); if (freopen(device, "r", stdin) == 0) @@ -569,32 +506,22 @@ end_dialog(void) #define ESCAPE_LEN 3 #define isOurEscape(p) (((p)[0] == '\\') && ((p)[1] == 'Z') && ((p)[2] != 0)) -int -dlg_count_real_columns(const char *text) -{ - int result = dlg_count_columns(text); - if (result && dialog_vars.colors) { - int hidden = 0; - while (*text) { - if (dialog_vars.colors && isOurEscape(text)) { - hidden += ESCAPE_LEN; - text += ESCAPE_LEN; - } else { - ++text; - } - } - result -= hidden; - } - return result; -} - static int centered(int width, const char *string) { - int need = dlg_count_real_columns(string); + int len = dlg_count_columns(string); int left; + int hide = 0; + int n; - left = (width - need) / 2 - 1; + if (dialog_vars.colors) { + for (n = 0; n < len; ++n) { + if (isOurEscape(string + n)) { + hide += ESCAPE_LEN; + } + } + } + left = (width - (len - hide)) / 2 - 1; if (left < 0) left = 0; return left; @@ -720,10 +647,8 @@ dlg_print_text(WINDOW *win, const char *txt, int cols, chtype *attr) * more blanks. */ thisTab = (CharOf(*txt) == TAB); - if (thisTab) { + if (thisTab) getyx(win, y_before, x_before); - (void) y_before; - } (void) waddch(win, CharOf(*txt++) | useattr); getyx(win, y_after, x_after); if (thisTab && (y_after == y_origin)) @@ -779,7 +704,7 @@ dlg_print_line(WINDOW *win, } else if (*test_ptr == ' ' && n != 0 && prompt[indx[n - 1]] != ' ') { wrap_inx = n; *x = cur_x; - } else if (dialog_vars.colors && isOurEscape(test_ptr)) { + } else if (isOurEscape(test_ptr)) { hide_ptr = test_ptr; hidden += ESCAPE_LEN; n += (ESCAPE_LEN - 1); @@ -826,7 +751,7 @@ dlg_print_line(WINDOW *win, hidden -= ESCAPE_LEN; test_ptr = wrap_ptr; while (test_ptr < wrap_ptr) { - if (dialog_vars.colors && isOurEscape(test_ptr)) { + if (isOurEscape(test_ptr)) { hidden -= ESCAPE_LEN; test_ptr += ESCAPE_LEN; } else { @@ -986,7 +911,6 @@ dlg_print_scrolled(WINDOW *win, werase(dummy); dlg_print_autowrap(dummy, prompt, high, width); getyx(dummy, y, x); - (void) x; copywin(dummy, /* srcwin */ win, /* dstwin */ @@ -1157,6 +1081,25 @@ longest_word(const char *string) return result; } +static int +count_real_columns(const char *text) +{ + int result = dlg_count_columns(text); + if (result && dialog_vars.colors) { + int hidden = 0; + while (*text) { + if (isOurEscape(text)) { + hidden += ESCAPE_LEN; + text += ESCAPE_LEN; + } else { + ++text; + } + } + result -= hidden; + } + return result; +} + /* * if (height or width == -1) Maximize() * if (height or width == 0), justify and return actual limits. @@ -1189,24 +1132,23 @@ real_auto_size(const char *title, high = SLINES - y; } - if (*width <= 0) { - if (prompt != 0) { - wide = MAX(title_length, mincols); - if (strchr(prompt, '\n') == 0) { - double val = (dialog_state.aspect_ratio * - dlg_count_real_columns(prompt)); - double xxx = sqrt(val); - int tmp = (int) xxx; - wide = MAX(wide, tmp); - wide = MAX(wide, longest_word(prompt)); - justify_text((WINDOW *) 0, prompt, high, wide, height, width); - } else { - auto_size_preformatted(prompt, height, width); - } - } else { - wide = SCOLS - x; + if (*width > 0) { + wide = *width; + } else if (prompt != 0) { + wide = MAX(title_length, mincols); + if (strchr(prompt, '\n') == 0) { + double val = dialog_state.aspect_ratio * count_real_columns(prompt); + double xxx = sqrt(val); + int tmp = (int) xxx; + wide = MAX(wide, tmp); + wide = MAX(wide, longest_word(prompt)); justify_text((WINDOW *) 0, prompt, high, wide, height, width); + } else { + auto_size_preformatted(prompt, height, width); } + } else { + wide = SCOLS - x; + justify_text((WINDOW *) 0, prompt, high, wide, height, width); } if (*width < title_length) { @@ -1349,8 +1291,8 @@ dlg_get_cell_attrs(WINDOW *win) * reverse this choice. */ void -dlg_draw_box2(WINDOW *win, int y, int x, int height, int width, - chtype boxchar, chtype borderchar, chtype borderchar2) +dlg_draw_box(WINDOW *win, int y, int x, int height, int width, + chtype boxchar, chtype borderchar) { int i, j; chtype save = dlg_get_attrs(win); @@ -1364,30 +1306,23 @@ dlg_draw_box2(WINDOW *win, int y, int x, int height, int width, else if (i == height - 1 && !j) (void) waddch(win, borderchar | dlg_boxchar(ACS_LLCORNER)); else if (!i && j == width - 1) - (void) waddch(win, borderchar2 | dlg_boxchar(ACS_URCORNER)); + (void) waddch(win, boxchar | dlg_boxchar(ACS_URCORNER)); else if (i == height - 1 && j == width - 1) - (void) waddch(win, borderchar2 | dlg_boxchar(ACS_LRCORNER)); + (void) waddch(win, boxchar | dlg_boxchar(ACS_LRCORNER)); else if (!i) (void) waddch(win, borderchar | dlg_boxchar(ACS_HLINE)); else if (i == height - 1) - (void) waddch(win, borderchar2 | dlg_boxchar(ACS_HLINE)); + (void) waddch(win, boxchar | dlg_boxchar(ACS_HLINE)); else if (!j) (void) waddch(win, borderchar | dlg_boxchar(ACS_VLINE)); else if (j == width - 1) - (void) waddch(win, borderchar2 | dlg_boxchar(ACS_VLINE)); + (void) waddch(win, boxchar | dlg_boxchar(ACS_VLINE)); else (void) waddch(win, boxchar | ' '); } wattrset(win, save); } -void -dlg_draw_box(WINDOW *win, int y, int x, int height, int width, - chtype boxchar, chtype borderchar) -{ - dlg_draw_box2(win, y, x, height, width, boxchar, borderchar, boxchar); -} - static DIALOG_WINDOWS * find_window(WINDOW *win) { @@ -1519,7 +1454,7 @@ repaint_cell(DIALOG_WINDOWS * dw, bool draw, int y, int x) #if USE_WCHGAT wchgat(cellwin, 1, the_attr & (chtype) (~A_COLOR), - (short) PAIR_NUMBER(the_attr), + PAIR_NUMBER(the_attr), NULL); #else { @@ -1909,31 +1844,24 @@ dlg_draw_title(WINDOW *win, const char *title) } void -dlg_draw_bottom_box2(WINDOW *win, chtype on_left, chtype on_right, chtype on_inside) +dlg_draw_bottom_box(WINDOW *win) { int width = getmaxx(win); int height = getmaxy(win); int i; - wattrset(win, on_left); + wattrset(win, border_attr); (void) wmove(win, height - 3, 0); (void) waddch(win, dlg_boxchar(ACS_LTEE)); for (i = 0; i < width - 2; i++) (void) waddch(win, dlg_boxchar(ACS_HLINE)); - wattrset(win, on_right); + wattrset(win, dialog_attr); (void) waddch(win, dlg_boxchar(ACS_RTEE)); - wattrset(win, on_inside); (void) wmove(win, height - 2, 1); for (i = 0; i < width - 2; i++) (void) waddch(win, ' '); } -void -dlg_draw_bottom_box(WINDOW *win) -{ - dlg_draw_bottom_box2(win, border_attr, dialog_attr, dialog_attr); -} - /* * Remove a window, repainting everything else. This would be simpler if we * used the panel library, but that is not _always_ available. @@ -1979,7 +1907,6 @@ dlg_del_window(WINDOW *win) if (q) { if (dialog_state.all_windows != 0) erase_childs_shadow(q); - del_subwindows(q->normal); delwin(q->normal); dlg_unregister_window(q->normal); free(q); @@ -2069,7 +1996,6 @@ dlg_sub_window(WINDOW *parent, int height, int width, int y, int x) y, x, height, width); } - add_subwindow(parent, win); (void) keypad(win, TRUE); return win; } @@ -2131,7 +2057,6 @@ dlg_item_help(const char *txt) if (itemhelp_attr & A_COLOR) { /* fill the remainder of the line with the window's attributes */ getyx(stdscr, y, x); - (void) y; while (x < COLS) { (void) addch(' '); ++x; @@ -2415,7 +2340,7 @@ dlg_add_quoted(char *string) ? FIX_SINGLE : FIX_DOUBLE); - if (must_quote(string)) { + if (dialog_vars.quoted || must_quote(string)) { temp[1] = '\0'; dlg_add_result(my_quote); while (*string != '\0') { @@ -2507,14 +2432,14 @@ dlg_does_output(void) */ #if !(defined(HAVE_GETBEGX) && defined(HAVE_GETBEGY)) int -dlg_getbegx(WINDOW *win) +getbegx(WINDOW *win) { int y, x; getbegyx(win, y, x); return x; } int -dlg_getbegy(WINDOW *win) +getbegy(WINDOW *win) { int y, x; getbegyx(win, y, x); @@ -2524,14 +2449,14 @@ dlg_getbegy(WINDOW *win) #if !(defined(HAVE_GETCURX) && defined(HAVE_GETCURY)) int -dlg_getcurx(WINDOW *win) +getcurx(WINDOW *win) { int y, x; getyx(win, y, x); return x; } int -dlg_getcury(WINDOW *win) +getcury(WINDOW *win) { int y, x; getyx(win, y, x); @@ -2541,14 +2466,14 @@ dlg_getcury(WINDOW *win) #if !(defined(HAVE_GETMAXX) && defined(HAVE_GETMAXY)) int -dlg_getmaxx(WINDOW *win) +getmaxx(WINDOW *win) { int y, x; getmaxyx(win, y, x); return x; } int -dlg_getmaxy(WINDOW *win) +getmaxy(WINDOW *win) { int y, x; getmaxyx(win, y, x); @@ -2558,35 +2483,17 @@ dlg_getmaxy(WINDOW *win) #if !(defined(HAVE_GETPARX) && defined(HAVE_GETPARY)) int -dlg_getparx(WINDOW *win) +getparx(WINDOW *win) { int y, x; getparyx(win, y, x); return x; } int -dlg_getpary(WINDOW *win) +getpary(WINDOW *win) { int y, x; getparyx(win, y, x); return y; } #endif - -#ifdef NEED_WGETPARENT -WINDOW * -dlg_wgetparent(WINDOW *win) -{ -#undef wgetparent - WINDOW *result = 0; - DIALOG_WINDOWS *p; - - for (p = dialog_state.all_subwindows; p != 0; p = p->next) { - if (p->shadow == win) { - result = p->normal; - break; - } - } - return result; -} -#endif diff --git a/contrib/dialog/yesno.c b/contrib/dialog/yesno.c index e97d760..4efb073 100644 --- a/contrib/dialog/yesno.c +++ b/contrib/dialog/yesno.c @@ -1,9 +1,9 @@ /* - * $Id: yesno.c,v 1.56 2012/07/02 23:58:08 tom Exp $ + * $Id: yesno.c,v 1.51 2011/06/27 08:20:57 tom Exp $ * * yesno.c -- implements the yes/no box * - * Copyright 1999-2011,2012 Thomas E. Dickey + * Copyright 1999-2010,2011 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 @@ -37,7 +37,13 @@ dialog_yesno(const char *title, const char *cprompt, int height, int width) static DLG_KEYS_BINDING binding[] = { HELPKEY_BINDINGS, ENTERKEY_BINDINGS, - TRAVERSE_BINDINGS, + DLG_KEYS_DATA( DLGK_ENTER, ' ' ), + 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 ), SCROLLKEY_BINDINGS, END_KEYS_BINDING }; @@ -46,7 +52,7 @@ dialog_yesno(const char *title, const char *cprompt, int height, int width) int x, y; int key = 0, fkey; int code; - int button = dlg_default_button(); + int button = dlg_defaultno_button(); WINDOW *dialog = 0; int result = DLG_EXIT_UNKNOWN; char *prompt = dlg_strclone(cprompt); @@ -81,8 +87,8 @@ dialog_yesno(const char *title, const char *cprompt, int height, int width) dlg_register_buttons(dialog, "yesno", buttons); } - dlg_draw_box2(dialog, 0, 0, height, width, dialog_attr, border_attr, border2_attr); - dlg_draw_bottom_box2(dialog, border_attr, border2_attr, dialog_attr); + dlg_draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); + dlg_draw_bottom_box(dialog); dlg_draw_title(dialog, title); dlg_draw_helpline(dialog, FALSE); @@ -97,7 +103,6 @@ dialog_yesno(const char *title, const char *cprompt, int height, int width) if (show) { last = dlg_print_scrolled(dialog, prompt, offset, page, width, TRUE); - dlg_trace_win(dialog); show = FALSE; } key = dlg_mouse_wgetch(dialog, &fkey); diff --git a/contrib/gcc/dwarf2out.c b/contrib/gcc/dwarf2out.c index 25a906b..5e4354a 100644 --- a/contrib/gcc/dwarf2out.c +++ b/contrib/gcc/dwarf2out.c @@ -10812,9 +10812,9 @@ add_byte_size_attribute (dw_die_ref die, tree tree_node) /* Note that `size' might be -1 when we get to this point. If it is, that indicates that the byte size of the entity in question is variable. We - have no good way of expressing this fact in Dwarf at the present time, - so just let the -1 pass on through. */ - add_AT_unsigned (die, DW_AT_byte_size, size); + have no good way of expressing this fact in Dwarf at the present time. + GCC/35998: Avoid passing negative sizes to Dtrace and gdb. */ + add_AT_unsigned (die, DW_AT_byte_size, (size != (unsigned)-1 ? size : 0)); } /* For a FIELD_DECL node which represents a bit-field, output an attribute diff --git a/contrib/one-true-awk/FIXES b/contrib/one-true-awk/FIXES index a708027..c78aabc 100644 --- a/contrib/one-true-awk/FIXES +++ b/contrib/one-true-awk/FIXES @@ -25,6 +25,22 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +Dec 20, 2012: + fiddled makefile to get correct yacc and bison flags. pick yacc + (linux) or bison (mac) as necessary. + + added __attribute__((__noreturn__)) to a couple of lines in + proto.h, to silence someone's enthusiastic checker. + + fixed obscure call by value bug in split(a[1],a) reported on + 9fans. the management of temporary values is just a mess; i + took a shortcut by making an extra string copy. thanks + to paul patience and arnold robbins for passing it on and for + proposed patches. + + tiny fiddle in setfval to eliminate -0 results in T.expr, which + has irritated me for 20+ years. + Aug 10, 2011: another fix to avoid core dump with delete(ARGV); again, many thanks to ruslan ermilov. diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index 8cc7057..ab01676 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -25,7 +25,7 @@ THIS SOFTWARE. #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -const char *version = "version 20110810 (FreeBSD)"; +const char *version = "version 20121220 (FreeBSD)"; #define DEBUG #include <stdio.h> diff --git a/contrib/one-true-awk/makefile b/contrib/one-true-awk/makefile index 52c7424..88f9924 100644 --- a/contrib/one-true-awk/makefile +++ b/contrib/one-true-awk/makefile @@ -26,15 +26,15 @@ CFLAGS = -g CFLAGS = -O2 CFLAGS = -CC = gcc -Wall -g -CC = cc CC = gcc -Wall -g -Wwrite-strings CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov +CC = gcc -g -Wall -pedantic CC = gcc -O4 -Wall -pedantic -fno-strict-aliasing -YACC = bison -y -YACC = yacc -YFLAGS = -d +YACC = bison -d -y +YACC = yacc -d -S +#YFLAGS = -d -S + # -S uses sprintf in yacc parser instead of sprint OFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o diff --git a/contrib/one-true-awk/proto.h b/contrib/one-true-awk/proto.h index e4de112..9a657ef 100644 --- a/contrib/one-true-awk/proto.h +++ b/contrib/one-true-awk/proto.h @@ -46,7 +46,7 @@ extern void freetr(Node *); extern int hexstr(uschar **); extern int quoted(uschar **); extern char *cclenter(const char *); -extern void overflo(const char *); +extern void overflo(const char *) __attribute__((__noreturn__)); extern void cfoll(fa *, Node *); extern int first(Node *); extern void follow(Node *); @@ -132,7 +132,7 @@ extern void fpecatch(int); extern void bracecheck(void); extern void bcheck2(int, int, int); extern void SYNTAX(const char *, ...); -extern void FATAL(const char *, ...); +extern void FATAL(const char *, ...) __attribute__((__noreturn__)); extern void WARNING(const char *, ...); extern void error(void); extern void eprint(void); diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 942f250..cafaff3 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -1213,13 +1213,13 @@ Cell *dopa2(Node **a, int n) /* a[0], a[1] { a[2] } */ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ { Cell *x = 0, *y, *ap; - char *s; + char *s, *origs; int sep; char *t, temp, num[50], *fs = 0; int n, tempstat, arg3type; y = execute(a[0]); /* source string */ - s = getsval(y); + origs = s = strdup(getsval(y)); arg3type = ptoi(a[3]); if (a[2] == 0) /* fs string */ fs = *FS; @@ -1339,6 +1339,7 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ } tempfree(ap); tempfree(y); + free(origs); if (a[2] != 0 && arg3type == STRING) { tempfree(x); } diff --git a/contrib/one-true-awk/tran.c b/contrib/one-true-awk/tran.c index e9d7750..a9fa325 100644 --- a/contrib/one-true-awk/tran.c +++ b/contrib/one-true-awk/tran.c @@ -298,6 +298,8 @@ Awkfloat setfval(Cell *vp, Awkfloat f) /* set float val of a Cell */ xfree(vp->sval); /* free any previous string */ vp->tval &= ~STR; /* mark string invalid */ vp->tval |= NUM; /* mark number ok */ + if (f == -0) /* who would have thought this possible? */ + f = 0; dprintf( ("setfval %p: %s = %g, t=%o\n", (void*)vp, NN(vp->nval), f, vp->tval) ); return vp->fval = f; } diff --git a/contrib/sendmail/FREEBSD-upgrade b/contrib/sendmail/FREEBSD-upgrade index cabeb2e..092148b 100644 --- a/contrib/sendmail/FREEBSD-upgrade +++ b/contrib/sendmail/FREEBSD-upgrade @@ -1,24 +1,12 @@ $FreeBSD$ -sendmail 8.14.5 +sendmail 8.14.6 originals can be found at: ftp://ftp.sendmail.org/pub/sendmail/ For the import of sendmail, the following directories were renamed: sendmail -> src -For the merge of sendmail, the following files were removed: - - Build - cf/cf/Build - cf/cf/generic-*.cf - devtools/* - doc/op/op.ps - */Build - [e-v]*/*.0 - sendmail/makesendmail - sendmail/sysexits.h - Imported using the instructions at: http://wiki.freebsd.org/SubversionPrimer/VendorImports @@ -39,9 +27,8 @@ Then merged using: % svn commit After importing, bump the version of src/etc/sendmail/freebsd*mc -so mergemaster will merge /etc/mail/freebsd*cf: - - (svn command TBD) cvs commit -f src/etc/sendmail/freebsd*mc +so mergemaster will merge /etc/mail/freebsd*cf by making a minor +change and committing. To make local changes to sendmail, simply patch and commit to the head. Never make local changes in the vendor area (/vendor/sendmail/). @@ -57,7 +44,7 @@ infrastructure in FreeBSD: bin/rmail/Makefile contrib/sendmail/ etc/Makefile - etc/defaults/make.conf (RELENG_4) + etc/defaults/make.conf (obsolete) etc/defaults/periodic.conf etc/defaults/rc.conf etc/mail/Makefile @@ -90,7 +77,7 @@ infrastructure in FreeBSD: share/Makefile share/doc/smm/Makefile share/doc/smm/08.sendmailop/Makefile - share/examples/etc/make.conf (HEAD) + share/examples/etc/make.conf share/man/man5/make.conf.5 share/man/man5/periodic.conf.5 share/man/man5/rc.conf.5 @@ -110,4 +97,4 @@ infrastructure in FreeBSD: usr.sbin/mailwrapper/Makefile gshapiro@FreeBSD.org -13-June-2011 +29-December-2012 diff --git a/contrib/sendmail/LICENSE b/contrib/sendmail/LICENSE index a0ad124..21e83e5 100644 --- a/contrib/sendmail/LICENSE +++ b/contrib/sendmail/LICENSE @@ -35,7 +35,7 @@ each of the following conditions is met: forth as paragraph 6 below, in the documentation and/or other materials provided with the distribution. For the purposes of binary distribution the "Copyright Notice" refers to the following language: - "Copyright (c) 1998-2010 Sendmail, Inc. All rights reserved." + "Copyright (c) 1998-2012 Sendmail, Inc. All rights reserved." 4. Neither the name of Sendmail, Inc. nor the University of California nor names of their contributors may be used to endorse or promote @@ -78,4 +78,4 @@ each of the following conditions is met: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -$Revision: 8.17 $, Last updated $Date: 2010/12/03 01:10:00 $, Document 139848.1 +$Revision: 8.18 $, Last updated $Date: 2012/05/15 21:49:03 $, Document 139848.1 diff --git a/contrib/sendmail/PGPKEYS b/contrib/sendmail/PGPKEYS index fd6daf8..10bd809 100644 --- a/contrib/sendmail/PGPKEYS +++ b/contrib/sendmail/PGPKEYS @@ -142,7 +142,149 @@ gpExpdV7qPrw9k01j5rod5PjZlG8zV0= -----END PGP PUBLIC KEY BLOCK----- Type Bits KeyID Created Expires Algorithm Use -pub 2048 A97884B0 2011-01-04 ------- RSA Sign & Encrypt +pub 2048 CEEEF43B 2011-12-14 ------- RSA Sign & Encrypt +fingerprint: CA7A 8F39 A241 9FFF B0A9 AB27 8E5A E9FB CEEE F43B +uid Sendmail Signing Key/2012 <sendmail@Sendmail.ORG> + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.9 (OpenBSD) + +mQENBE7pIE8BCACutGAvfg9rwfaVBRb6EKjcWABZUFsLt1yF+hzrhR6llVVAv/P9 +aYiSwJHYUSu/GfZ53HL12NhowhhmjkFt4MeIo67gmVmxlTkMVXrb+TROqr67f3H8 +pM/vCKMnc9iCBNXgv0QjeM4qr8gz+TIroxq3ip3RNcZXOMvSOEmflK3Ts56vhnMK +nzWMlfIhKXmXG6o57Qb6pwYLcT9Sp1rrJaal/GnkwEScDmFv90jBIk/RWVao1NAG +8sJruv4kLUTRwwddvd954/cC6S/3F3VNxisVXNEagNTaedTc+pBVXWv9yn2P4Jvm +gSYzrvq3QP8PH8hJdtiWvgOnm2YkrZ+Xz37TABEBAAG0MVNlbmRtYWlsIFNpZ25p +bmcgS2V5LzIwMTIgPHNlbmRtYWlsQFNlbmRtYWlsLk9SRz6JATkEEwECACMFAk7p +IE8CGwMHCwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRCOWun7zu70O4MSCACN +dAjK+prDB6YdIQZdjn1rV0Ba8pWX0PSv2HY7wlduBlec5HOV1s0Yram6yOQwv6Uj +Ns/3t/7+ikA5/HpvSHo5uuxKLjL+duprCUSQko8XlLVZCiKjpFyD/ZFsCBlbaVCc +u2OjjJ2Kg1FRwijIJdZfers4fbm9Aa+gLcMqdtmSa+gI7mkpEJJWIz3rPHbIcYPe +Hy2wMSSpk3eSQtU5JzA18vUhdVujzwcRvs925JOT6g3VZ7Qhf53QSo7IaoPPPEVT +g3BW3iQKaXz94k4EDhODBL3g2Q7zYOhxceNnL23vNxs+yWPcyg645nrcsfcK9osM +sHxlsh0zLl8dm6HnkUAxiQEcBBABAgAGBQJO6SCWAAoJEDmkx32peISwEUkH+wXg +N4/NlcKJwRgmXRqiiADEI8L3otyWI/v2Yp/8nFCyxzhSH8p+4ggDNDgngPHJuV5l +WGQuGr+UbqDAicIOPeyKD2/EAUFm41aN8ATN/KlAhxeW7iK4LxPWUlPLkfQu1Gng +dj0vzaYMR7v5B8y3bg0yJCo3PlHIkWmYhEJmv5xajKLMpz3+K6igrjH8GzUfoMp3 +Q6VrIdvVd+E6/wm/qZw3xu0bXclip/YYDxOLvKF/vpVfiHiLpI3lBoGQig1keHOw +0TD0ol3WwifqarwlMWdaLQCH41CnjMT01mkHd2ew78dAlfNkW4OiHxJd0AcQrqAO +WgxFMOX9JowFlIeCjoSJARwEEAECAAYFAk7pIK8ACgkQYE378oVBCr4dwAf9GOKz +d1CAGJgKtu3crfUvS6xBd66pFpsnGOm6xwjG+QSTIIRayev5i50LcYUr2LU0unnS +ZsSwYQiZ27wC2l3Y4WFVSrViif1x4CoDSM9CGleh8FBdctzeUU9huQmBHftq0Q3j +WzZSBoiDJBGT/Ug1rKiyN5J5eAufGIkSS/WQGvJaBirL0QtGBWSeHhTjpMKGp/ox +dJ+zvT2ZsHxsCROaA64jceNQOt+jrTGt043ABxdUaF2Pqr4CC7myRIhrVWlkPfs0 +V1N3SSQJsx8MgWUD5OeJLuQ10HjZ0GgYvofOo+ysG8/SEz3ltwvDwJwkrGsjM8y0 +DFcqosySncFHOcijC4icBBABAgAGBQJO6SC0AAoJEBKJbpunfyQpqX0EAJH2pzz0 +Vp5gGBVhyuJ5NKQe8rC7m6oj4p/2OAVee/+6/3YEA8v6J43iuuoIMhNH8nHGJxhJ +Xmh5Ho3RVgZE+G/Vyr63JwMZ/tMwaUX+Deh5czKW60A/bpX+CFAU7caqBZhbjNoq +yVdN/3f356xIJk0CXgCfkYywRg+h+KtwD1xciJwEEAECAAYFAk7pILgACgkQ2Krw +yvazBykUTAP/R4bhldibVY/6Q8ctxCA3DEnBK0d6qeA1kFydee3cu0fgBqrh70C0 +XFJIhuHW/bdkJdh41XYVWACANBY+1Uvt4GyoE+DB9Z779i2P4JG/bpl67D7/bjLg +gLuO8zze0NiKlylEWPtO5o1CFGi0O13HbzjF1UxY16OdnKPK1KJA2ZOInAQQAQIA +BgUCTukguwAKCRCXQwEYcJO4QctmA/0RRMOn5GA88kp70hF29HLMgB5zAw3ZjMC2 +p/pC/SiuPSzh9n8Fkode3qCeQ8Fm7z3UVrywV3373litYMcl+TG6Q3c14qo0BDIT +H6EZUjP4Msoo2fAkMM6XrBdyLYSCKilJGsqDS25Ox2BuJGKIbMHFnJy4SR5rrIAB +J1c/PIqNO4icBBABAgAGBQJO6SC/AAoJEB57s8ivlZYlILcD/j9DxcUcJbDeFDxj +KsuQpN2cWU+KItF6hPWgP+n4VXokPzCWQOxKZ72BoERukQB0zVuogUbFrDwPIVjp +bNK+n9A/CC+FvfBkm4nMBpnZRFRRaafcT3IwiqmWa21/hzvDqZI50NwBn7ev57sM +rCtg4n5uiNejGwwTQCgff48bd7aZiJwEEAECAAYFAk7pIMQACgkQcKAkTR75klE/ +8gP9G7BjyxYUDg+2F+GrLQGZEq8ijpMK930o3Vc8O33zhZFQqqCuUX3RRvHSDzqL +JI/7J5xIiAjWVo/8QyP7HKScLTiBV0r1iB6JTjVy/Y73GvInTi6y6jrlfpqg4lTw +b375/8ijdG9uCH6go5F0PH1vPI+ibrwgLVgpx552edzRbkaInAQQAQIABgUCTukg +xwAKCRDI1e0plfYXcVQYA/4svozwEiTmCvNGr22IOMqL1vr12sgzymIeISzjAXeR +9/kxwyi9Ah5UX4orLwQqXzOB7IZ+SEN4WRo6dCO8QzMG6alx2A+gU/14j0jvPhxk +jCtO+CBMoMc9lQ0yEpz0XIcO/FGJX3RUex8L4/mYyP4LTijseU8D8F3kqry/Iaxc +qYicBBABAgAGBQJO6SDKAAoJECGD4bE5bweJAhoEAJYXG6BkWixVK8XZw6oNIs/b +48oumiCgHxErlaT64QLQ/7qknzmJ+nF3VvkqHqxk0u+zQRf2+oOQlgAnFxwTBvAm +E5Zf3bzqOGcq2aKyQpyaOi40+lIZTV3mpjB4fRtWCiF52TVdh8dtZ156CkjpOupb +g7sKqV0h79X+x1FhiukYiJwEEAECAAYFAk7pINYACgkQiWliuGeMCgOx7wP9GXqz +C9Q2JhgNA/jig8SqtIn2EVHqtvNv5OYuxrgh6Xiy/5ZoBfghDfZP46cffsSUFrI6 +QI17QEg9t0rUIdipXRn7S7sUfz99lKGqKMszCqvECdnfuwnsYBO73XF89MDgIAH8 +Clm06seRjSPwqxOY2BU9egBHsWg7sIEqbQCGY1iInAQQAQIABgUCTukg2QAKCRA4 +IttHzDdPLfRuA/40Mk8Q6uw8IfWxNZh9q/tOMIo2Qzy0QIpTx5CyuuzlA9qUgZ8f +NpT9S7z78WLj+TuWoHrtFVRZaDkbMafT9VLDMPdveI62FI2z2mCaBHFGr3kOPo04 +xrRvwgdMCgbm/63fJl5264xfjS3b/iuNGAgOOcMPnV4WWdhBTmtTUXHVMoicBBAB +AgAGBQJO6SDcAAoJEJwcveLjXFY1bVsD/1FkSDWMeet7ZGjLplUHbyudbTqqq2Lk +tpBhOHANXvffJSLHVIcPiEIkUCtyCW1jsAWbNH5th/e08aNjNuHnA9sfoG+stlNc +9pAyd2c8MMXpe4DP1osggEKLSCJf7u3xU7SUsM86n5r9s4pNiZldWmMqYKkWOtyk +6HOWyaVeK7k4iJwEEAECAAYFAk7pIN8ACgkQb1KT2KObplUSQAQAqcAwuZnx+uZW +pKiT/FYUs/vCC3XFrnJ0iK/Sv6ScQiDZ8cdTk96ipCSEpV1i7iaTDK5PhpNhP9p6 +HQgyWme/w0I3s4g//3SYH9fmSAjm9m/U8v3tJjs/mRQIr3HUXck3K7oC71jANnhH +A0xlM2eT76EvN0ShnuZ0Ph5GL4umk/aInAQQAQIABgUCTukg4wAKCRDvWJZk1DLh +nSDQA/9pE5yzmw/S5hPN2n1u8CpWtyi1cDT0rmEe5Oc2cmcgNj++rMi6hOtUKnoM +y1A3GTkLiVnx9BhOAW4xGANRBTsuPfM7QOxBZKmDSsiH4Mgy+olbfW55Kgj1R4jF +bFOj8vDrS6toBUeFDA0WB6kHCjhhkE+xLypYN+xTQGrTeLsMKoicBBABAgAGBQJO +6SDmAAoJEMGcHSUS00YdIqYD/2mady6csrrS2myjDkom+r5P/LvA8fsGI5MyCRhQ +Rv1eRL0QFgbnl0dWw4Q1AKAl3XB9GTYssWk7orbgxrO+4ciWIjC2Btnkq1hZtc5C +boXvQXbX5vzW7xat7twh2lkhUi46x+qrIHrQ3vR3D9EbsuPDlxDqTg4v/u39xmFo +yFabiJwEEAECAAYFAk7pIOkACgkQwCnKQBb0zOlxWwP/SNfpUlVER1Rj2uoy24J/ +7k26lBxc84uqVRq+fowz7EYB/knQ+aL40AUsypXpSnJesDjAmx2Eyuz2nBuFjws7 +UZt8v6ALFJbLP3MFrfeM/mD2hijGOeVuGsord4OaAZ/9isuToMZijcOW2Fgdyc7c +HYPikO6FtNswXuKea2e4numIRgQQEQIABgUCTuo/DwAKCRAY9QOAJMJ4Amt/AKDv +QsB9bhJOfhCzMonD4LYq3bpmHgCgoW9RYrPyb7iSD1tHx0hM4n0sA6CInAQQAQIA +BgUCTuo/FgAKCRB8S2dtoA4VY0gwA/9LI9Kf/eXItmItIoCO51KmeG3w+twehwUp +Mgc3RI5hxF0J11nSRInuwKS5hC6jO8QnpWMjrL57JmwK+VTjJje+zjigt3tJVO+Q +rFdOE5Atla4yChjsXn++ffEI92ZFIhalYEEs5bWzOrBjcOQOkkZz84G3rHRbG49d +m2N8iY9ndoicBBABAgAGBQJO6j8aAAoJENbgof5PvirdNqgEAK2oImfkowMelxfb +WTLvHx2yX0vN56fpLgjAsZIcLKUJ8N9fm95vpG0Zz2J/KyXphTlcsJO/Hm+oHeos +7mx/9MjXsO+tmDmU7kI+0PFxWmucZR6wBoMbPmZtuC/GqIk9wFeKGtkEgr2+En10 +hChgGqIvE5LsmlVfaD2R8jFNs2jOiEYEEBECAAYFAk7qPx8ACgkQIfnFvPdqm/U5 +AgCgxe+sFly6JTaO1N2EwjLVxI8ErvYAnAj8lhOAkBEqnzVpeSt8mNw+sywFiEYE +EBECAAYFAk7qTvMACgkQCaeiStHlggd6IgCcCK5KjbY2e72mtDMne6VQwr2F/sAA +n3hBsophnhJjLGxEfblJc0XihWcriJwEEAECAAYFAk7qXhgACgkQzx61AyIyegE+ ++gP/blnJpgybp/4Swsrfqw5jnBzFzyvyOkQ2stAtmyCiEYJLhDQDZIYIc5viy4ay +i5D6f4yAUUaA5/V4dWGv1aEDiO27GU5tzUuUnBmzz6KJcAN0kmkiSG4eMwdAcspI +zZbGI16OpZVhO2N762Qfhf9yi6VQy7v5/b7FCqoHP1uAG3iInAQQAQIABgUCTutf +5gAKCRBfHshviAyeVTu8A/9rWm+tqZTM2Nb5lWh4H8XAYXH24TdXY3dWpEIFYy8r +vudLF/RhIx6UzMwMDiN7NEnb93ota78HQf6uRVIHBkCR8oHzhR7TCrSEC59IKGXL +IONCbF9IQOR+Yc0rT/Gz3lN53flSorhs6LIfXDLiiGmlOi13BIEhDbJ2f1ZZyiR5 +gYkCHAQQAQIABgUCTuyeYAAKCRBQg+yIQOhvcUvTD/9RagF2zavJM9PX2aQ6C/s7 +BcjF77n1Vt++H4NJ6wpAkVxlfY1v+y8b21F668R9DhFYNLepSvrasDgc8XAdnn9H +l/Mn66YVFyUDOYoTr96b/zk+GnBYPcFso/XkIBgmSOfNNs6n0WweR8QfDY4q0yHT +2nUSUGre0Hxs4awA1/dMHlAumSS4p7nqc7+q3b7LXKaxqGUVoShsokoYF+bsj1X+ +dI7c9R3kt2LmVtof0POn1P9sNf/FZrE/eKDYP8wYyJhhonMZAnlbWHxxMJJevXdQ +Bk6HF9UMx7R7a0cctZJQ013BIejGLZmR7kPZhLAyQabp6ILqJzNO3W+ckk+y6Z6/ +sqnC9bSEw21TDgk3q4+1wD/0Dqt+pddRtNyag1Ru3zFRYS6ok6g6smlrp/RVbpVg +cdXWps39LX7+UI8XoUyNQgxIYQ2xd0eMpFtFrgLAllIU7cCpD6w7Q7B+/C4ZwjCn +/Yt5jAtMsOJ121kfuUIAC4vnNwRYn0iGmkN86Ti7PSdR4rbn/5SpIU/FUUYwFNln +Jwy0As/+DhuBXmtEdb/AMvI2n3P1rrTvcEYycfCqAXGNO98i8jCSVOzjml3PTQfz +chhe8F74q/L3iOzFaS7FC2t/bZ9FaCWYJzMH6blSZ+yPK5x5KxedfQJo32c1oXnM +N7BO+MXyq4iTddCaRuIIYohGBBARAgAGBQJO6l4HAAoJEDEZgFHPGk0sYBMAoPhW +UodY6dFC+jbfua4wCm0SDxibAJ9cH0ocPU84mrTJUls6/05f5wKhiYkCHAQQAQIA +BgUCTvCQGAAKCRBvD514lfyZ1JLkEACODPksw2LebOLPjzqnEihvaf4FUHwSKYQ6 +VSn6ojZdNz2L1FJK1qTBEsFXfmqe5GiweVKk1N+AeTHFYXKoSmBfU4SgAOT3Q6ti +UHtyKuJhhzANUe0RjFT/LA1c2fOZrJYWkavqusA1nmOy6/AeCMjg44QIiSEF5ALJ +UYZp4npkU8nzAatdzMMVseKEDqKrUfSe+YC9N/P6yCxLdYYidlyg4MYsNBT+f4kl +mpJJk+RVi3AHKH5a+QShFJZMfHD6/rd2yOEq2DFAIO/wPIi4Emq1O96g4FBfwD9r +6FyTqiNcz8Y1SJsVa+1ScSDBlM5JcOWKj+JCoox6a5qjyr34i4o/TNOesEVtXVVw +bvSoikA2sQb5aVVTw0r0rGTy2V5ksN8rTXD8n5mGOKSVwQ88crHUI2JZkXapvWp3 +/jmwHUhjCZxBnOUUtnsILV7gB8ohCxLaTu2pt1obbHH8DPZ3kHBA6rrmyvyBM22U +Xmx92/XjbtrTHGUzdzGrxrxZHISwaFtneVCCAHhTYgESzwNZr61rA6DrCn3mRR9N +JuwZvhC0u42kGkC2ulEoAu/OgFjarmu/6dbgwYfvLAi3y7BAL+otrjjq5cJB8oQj +C80N1LqLuWfsatMOlgk1annhh/i5RdXiOmlg1WbW9zh9jRM1Sha7d7BlkoJ2LJzQ +ySc/sELhHIkBIgQTAQIADAUCTwWTigWDB4YfgAAKCRDvHmkz/z+rnHJyCACaELza +3TxkZtLhZlJxxorWt/AHZS2Uui5BRU36+A7plALIdgIqH7cah47EK/kG/AJH9uiX +Zd0cBM/QaigfSBVPdk+s9WBn1A9c7zAbUG5/VbR975g5txMhA5SC4LTVRIsw0Lau +tFHnlWSXs3ga/11oxEsOvplayFeNDDlZHo7bqNsKmL7PjbAqKola3zSy+/ARIQ4P +UpDEyAgUp/OAP0qZarzCQnZY884dzXcXMbaoyyYa8D2cDrrHFDAh5nlcv0jpRvGK +ze6i1ONwoW77QajoaJaRE3DPSG3LahFSeZassN4540cA7r6oS3q1fUkL6yfbFbN2 +8tTIWWWkYsFtZT0TuQENBE7pIE8BCADSaPflswYkibLPKss2XiKNpvBF66rDLuv7 +Y2dIRic38H0gVjBeFbGowesobgnKgTIe+zFtAzS1tw170Gp5osZNg1fLhXZezA02 +wbBuPZ7QIh1/Kxum9mP1uiB7ZYx3cu48zB3Ajf3GjGdsn7o92gXx1P+y71N6QZ1g +PtK2Wi871zT+J236LZUPhHfdG9zxsYKcGbPHWDI7iVlIl3/IU1kmQAjX74hbdLMN +erE5kEHfYqwQRBXUx299e4kjYWmPQcQqCOiWve016KwyJ19FzYcJM3PbRf/UO0aX ++KoYEkQqDqj4UHJpL9V5/8I6evI5Bx6I+e0GC4RxXyYN+2XL+MHFABEBAAGJAR8E +GAECAAkFAk7pIE8CGwwACgkQjlrp+87u9DsU7ggAkJ24CSgtqc2pWnQFGHAiyFHS +iYfaGQbg1evtI7nLtk4Wyskabu3FRQRyFGxOUSoBx9H6MlBlbxjRrQljKU7b6WCy +DSUcKW6IfcvKP5NXqArDnnBf1J454DRzip33CW3vKUROvgWPcxi+2wdj2yXcqM23 +nG/2klg4JJHEsvKH89fuu5wMf/gE/7opVpxm3G2tQw51rb0oNyCrReDHUnlvnWsZ ++7BKywQ6vFb9LrCWmnwuqOLkFqNQo4XB0HcHjGa3AY4+y/RXNuWNcL886FwD6R5G +qrpfZZmSAqWA5sdTeBXeJTOCvPrRgvDQod1kpyVNQHn0VFR4dT8XDGk2TBgmtA== +=qHzF +-----END PGP PUBLIC KEY BLOCK----- + +Type Bits KeyID Created Expires Algorithm Use +pub 2048 A97884B0 2011-01-04 ------- RSA Sign & Encrypt fingerprint: 5872 6218 A913 400D E660 3601 39A4 C77D A978 84B0 uid Sendmail Signing Key/2011 <sendmail@Sendmail.ORG> @@ -251,7 +393,7 @@ KH6d5q94eHcPD56A4cYD275DIZzAYqRpwzmB9O845HrHAPmQ -----END PGP PUBLIC KEY BLOCK----- Type Bits KeyID Created Expires Algorithm Use -pub 2048 85410ABE 2010-02-19 ------- RSA Sign +pub 2048 85410ABE 2010-02-19 ------- RSA Sign fingerprint: B175 9644 5303 5DCE DD7B E919 604D FBF2 8541 0ABE uid Sendmail Signing Key/2010 <sendmail@Sendmail.ORG> @@ -1453,13 +1595,79 @@ aBteGdu18ACeNXYmxUhQN/ogZuSaBhd/51aBD8SIRgQQEQIABgUCP9X7SwAKCRCk -----END PGP PUBLIC KEY BLOCK----- Type Bits KeyID Created Expires Algorithm Use +pub 2048 0x0C8B8333 2011-12-14 ---------- RSA Sign & Encrypt +f20 Fingerprint20 = B080 979F 4D04 3E19 D05A 369C 629E F8EE 0C8B 8333 +sub 2048 0x6763ED11 2011-12-14 ---------- RSA +uid Sendmail, Inc. Security Officer <security-officer@sendmail.com> + +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.11 (Darwin) + +mQENBE7o89QBCADOc3//yYNlUk1zTEPaiskclluwz6o+kkKp+k2x/rGYm+UYHMl1 +w5B1sLs3greR7eGNBmE3Eftr94v/YZrDqcq4mBzQL4qoS+4Bvrjl9GEbAc7Ke08s +ZG0QC5en6mdn0QY3ZSb98GTlImPjiGC0tVCBylJLeyvBSgUTSkkLmp4lsmH6aa2G +IhTatCIV7I/mAB2lM/KyfwmTf2/q8GsyszC4dwVRUSwfkQDfS+dxc60Krf8GNDsj +bPolwAQi+YWMb6renYV2pNA7n9A5nKAE0oq9pe43fv9Pvek+07JJ3YnP0nS2yS4P +PVewsRhEYllEYSmYmEwwCb0682A3HIVZWkalABEBAAG0P1NlbmRtYWlsLCBJbmMu +IFNlY3VyaXR5IE9mZmljZXIgPHNlY3VyaXR5LW9mZmljZXJAc2VuZG1haWwuY29t +PokBOQQTAQIAIwUCTujz1AIbAwcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAAoJ +EGKe+O4Mi4Mz80MH/0h6qv/sca1mTjy8vYSRYZiIWyYXpuHFUlr31+wF3cBmwCI1 +4qHoRI6MWj4JBnwQq2bAzglgY7GvXXn6TYEFju3gCs6hlvlE8/1z7+Ku/LVsyiCh +3T8tVAxBVeEandnJJgmOP7/dbLBq22/WI7tNi4UOmnqx9n2e2HpBSKk82a2+Z2Mi +9yI6StgTn1osKWTXxyauVJkNKnsoOm/pfH0aR2BbK4K+XtW8B55diGmgKn7o5dN+ +2A+tHqPeioTRgTnzywoSniQ2qOkODKjpNr8UVPVOUFHcO4upT6CQa2hijp3f57ns +GAJs9m/JJDSd8l98nbQZP7G4nZY6RK/NIEkWhECInAQQAQIABgUCTuj0XAAKCRDA +KcpAFvTM6fG9A/9Z9GL5OlfyBYP7XKzFadtg7MReYdcA67DiYpkmiIKnJPSN0X4v +H6Qr/mIjisAGm16UIMQTAIUPJCOm2et+55AA5INWiWrU4TKuCfOUJABMbdyvh5vI +HmBmXdmVartyZj99fCDWOwai1cpm+KQMWvO6FDopPAN+3xJiumIQ6KfO0YkBHAQQ +AQIABgUCTuj0fwAKCRA5pMd9qXiEsL51B/0QR4xgoCCaTzTYKTDYwNanLBa+J+Gm +wO7qU6jK6nnLT1TNyMoElCziVh+rGLELD3Nfw64p0ZG8F4bIJhVLTCpipmXsXnGj +86FrPXV2l/jglNIRv7CD12dBKuYN9AkGJz1Wt6NnaENu9GBciUyIkpVCpSEYTgD2 +jRhkyCqqOSGVj93ze39VPzw6xAGUEQl7+uVUm09lkONDHq4TDr3QcdpyfwntYKib +DfbwmamVwYias6cMxjxT9GPH2Fu0LF9564CGxW3/AUbr9s/Ze85cysAo9JrIHzAL +M9akedEg9Y/VVKH3d634OOXqRuddPjajDcohRZSg9PSrXRquvONR7LjIiJwEEAEC +AAYFAk7pOe0ACgkQzx61AyIyegG9DgQAs6RL4lY2LGaSWrMIHMmsHXEkUT4SNP9n +J8YFAqzhR88dEMC7s6OeCVGniAPnou07pHAez+hNqOvvqJ0HSsJAMaH7IaQKGvCM +6+/VDTBnOJz56r2yVlWqbeTwGKuwwK+nIn4Pdm1DogsN3YMsdfbP4gCcK86mCMef +aEbs75MGJOKIRgQQEQIABgUCTuo+sQAKCRAY9QOAJMJ4Ap/6AJ0W+lZpo0/ttlwI +CCfzyaABwLCRggCg3lKOKjbw52dM/fGQkuVv6VX/OrGInAQQAQIABgUCTuo+uwAK +CRB8S2dtoA4VYwPBA/9A7rXUPQep6yGORpF6KbIGUMNeotPkZp0FES5XbnGFAPJl +P6qUDbM9sPyupk3b+askqHanusmMXQsyKcbTsFzLgoRPU8gjkquEhrwnpWAOz85N +vvHNCNSo7U6Qnyo8B42wXOtumaOTWpko2PC/SkGh4dYA6J2LEftmkVRqZgA6xIic +BBABAgAGBQJO6j7CAAoJENbgof5PvirdnkQD/i8GBLaY97zgOXuoilxq3mQK0cn6 +TWIorrG2J9f1JZGZX6K3mv2G3KsjGs4cXzaFkp2hgD9yqTO/+BBQg0+OiCNxvs+l +zrkP7yIXk7uiUxMMHkXaKwxDUuQbf4V72LJqr5eLZiWNwuWJ2VdsVYoS9/gT4enw +YkZr2hdH/07k4TpDiEYEEBECAAYFAk7qPsgACgkQIfnFvPdqm/XkBQCgjDEuvinF +5lcGIWrERV4wqrgF+JMAoNbS0PaMoXJrVZYHIHhKxHABLP1ZiQEcBBABAgAGBQJO +6j7NAAoJEI5a6fvO7vQ7g8QIAI9j2FkhUN7J6Wk42i/z9vSXCcbXwOnntq8awUz+ +se7Bw1eSLmJs3oxWlL2vhHJVEbvNejh1lReRKDHb6vXZ+YkN/f8TXsj/q+mbCHe9 +NisN5a3BTawAgzVE/E3XvGneQVY1cgC8As8ZoYfRRTdtsEHdicYoCjHWMw1LXfo3 ++hBMsQNvsU1tuPQXjU/qsalfP9qRJe9OVNLo3fkxFSAcalNibB5PS86tyAes+T0k +/5LT30nbeX6ZfY98qDIoRGj7dBWpu73oi4aS713iy0AIyy/Kip5AERtGv+B0llTC +Y21AY0K2JXJGAS7IfVw2BrvbBZevzXe0AursqiLGMZ9Nokm5AQ0ETujz1AEIAM++ +iXuJkoVVvgEb7gxUbJurVDaedOjKVM2pHLuOorQBYI+gQYOZh+r7ZX3PpIGyoLWZ +dlpwEhrEsd/2+TY3nMPzkcfW1D+wkP6MIuD+Y8y1efNeBC7IzNnS5gG3+IItgzEX +Fuql/MMkwQ2xOybYvjzFB5I5cWEkGv1S2xp6uQvIhlD5bWT9R8/1A+9ZZYcP2Ozq +IWQKeBljDEolz7rTd04UgfQK6ROMNYQghTwWZxmBjsdBa7jtWlfjssqngLiuxP5N +XQVwN/vUEbryMfNNS4Stz7/ZrbCwtu9bHfx7sLn7fpcgJso14e42+PAXfnuoXtGm +32o4yUdJPMqwFIMnLS8AEQEAAYkBHwQYAQIACQUCTujz1AIbDAAKCRBinvjuDIuD +MxdPB/91RSXgG8IQDsOroKYNiZbeEHC75vxP3Rl0XOxU3IsN0mzz4ZjS7khLC1Pa +ATCIkx3GwNTjvJkiePpc4knc3ZlKx9fKJz0a+pt0ideMmzYwdcX3enG+Z6z0hEL3 +GJzNC6v7WnV0DsSp7hcT8l9hnqY6HkV497jJG8ztGK3KH943/6YL90RlXqaoRTgq ++bSXhbxHueImhjyYUrmJFTZ0ElSAcuVtJpCHnAEouTQAtshzyUnDXwgoQk9extth +Sn/xUlHB9VGWBAXlq6qJcx2jqWGrmRfz8gMBAwfLTUyNNeixt3TReTtos/HaZK3X +G09zJuZGoDdC9KhhogEVj4Ow+ydV +=qF87 +-----END PGP PUBLIC KEY BLOCK----- + +Type Bits KeyID Created Expires Algorithm Use pub 1024 0xA0F8AA0C 2006-03-17 ---------- DSA Sign & Encrypt f20 Fingerprint20 = 770E 4AC8 8A97 B69E 6E75 0605 1043 2518 A0F8 AA0C sub 2048 0x6E613854 2006-03-17 ---------- Diffie-Hellman -uid Sendmail, Inc. Security Officer <security-officer@sendmail.com> +uid Sendmail, Inc. Security Officer <security-officer@sendmail.com> [REVOKED] -----BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.2.4 (Darwin) +Version: GnuPG v1.4.11 (Darwin) mQGiBEQbQzgRBAC7QmIW2r0oJ9Ixk1ewPxfwN1CU15k2ORBzRVIcO1UcLm6I5t3Z Gorbj22J8xNyY67yQ3pi5O+pffl5LujEKTco3D3sHhHnpz8vIaBiLyVUG3dCHZwU @@ -1469,42 +1677,50 @@ LuhwZsvHbzie42JoroT/WI713JU3z1LrcwBYPxQGgVXlsyQi1ilJmd/JCsp9SpFN kqbog8zz7lZKD7PwRIduicPlXVft063DbABwTIi7YGv8xFnLt9vIix2gSco766KY rjPOA/9dlGIXq2HP6BGqYtZE6A6RwL2ujAXfene8hYLaMg8t52XyHvJDeay3siKy EhXt2tn+CyheTzKHXE7WdYGVIZq8OUBoJy/6eaL/paVbzw0SlhCuXNEP6J8SQClA -rXDAwbl2SODl9T9eVUUbm7bQxdD942qCv+jhvBzAJrrHmZ0KPbQ/U2VuZG1haWws -IEluYy4gU2VjdXJpdHkgT2ZmaWNlciA8c2VjdXJpdHktb2ZmaWNlckBzZW5kbWFp -bC5jb20+iGEEExECACEFAkQbQzgCGwMHCwkIBwMCAQQVAggDBBYCAwECHgECF4AA -CgkQEEMlGKD4qgwt0QCdHD2sFnc1cKILKClUR2Ad3x+OyysAoMTKNOPxq/burquo -qt0rN8QnPkctiEYEEBECAAYFAkQbS9wACgkQGPUDgCTCeAKDiwCfae3NkBOnjSBa -6E6ftmrDbzQYC9YAoN2Z8jaq1kM2pXmC0s/QTIIsPc3iiJwEEAECAAYFAkQbS+sA -CgkQfEtnbaAOFWNKEQQAgIKzIX/EvAj4BaG13i3EYdvcSG0mfYsV4NVIdrDPnV3U -mgbGBskgjkUyWHlUTJZ/AExcYyuTQNuivkH8pQKsXNUpm020PXvJg7t0/ZKTTv0t -Xyz2OT3OLKhw1O+qUOOrkxgSpfg7UgQLTbZ0Ol1faP8iSTM5649rAOpqbPi8tneI -nAQQAQIABgUCRBtL9QAKCRDAKcpAFvTM6cCsA/45MgCAYIr08/GKnFlBTZhAXQ6p -ZvV4OCdtgMIwcJXJtB2E+HSjOsn9Ismyy9n19Z5j961oGwyfZ/uYoRp1Q5rMEs/s -DmFyq0TAl3vRoblwuOKtOp2bvGah/TzdkMztMrftErM9MhddQDEIoS3PQ0QkSODR -Ci/m8eMtGLPX/m+Fu4icBBABAgAGBQJEG0wEAAoJENbgof5PvirdmR0EAJNHIszZ -ZnGx7jqUB2+tRLCsLctrm8Hpeltc2XkMeT0nx3K8XSDs/cigdQqTHq5oD2P/6Vp9 -e8X2UE/RfEhCDre9ADnSWzqASRtXktDVnFZZHuYnXl1d74bqS5RlWpbQUJ5VjAFu -ZaB1nhFRcRWuhl8UIqN9OKygtUAgzlR/FfiziEYEEBECAAYFAkQbTBwACgkQIfnF -vPdqm/XFxgCg8x357MlaxcLbnsbKZFN26nLDBqQAnAxqbkNoRKqF+IRV9aMBz0vS -t+baiJwEEAECAAYFAkQbTCgACgkQHnuzyK+VliXMAAP+NGQ+3rPnGHUyT02C5K9k -suqWt+7q0ZWHR3NP66H1XQCqrEUXqmcWtZpd0xTY8XWcyEzYntXje3epQMnA6/52 -ohFNehiGQG4FENsusTzu7+GNdpSqYTPcdUrUp6zOc3o5C30q+Y1tvBtyYlfeQSvH -3x47Ai8PrnVmHjJCltkGtgiIRgQTEQIABgUCRBtU7QAKCRAxGYBRzxpNLE6WAKCA -CCj678P/8pn+vG9JpgQWQgV7zgCfQ5409UHS5itySiyQ/atuUOAG0Qi5Ag0ERBtD -ThAIALL0nX9pRt5NDqi0wk1RIXAGPJCahPJ8h52CgAJUm/FAsmXdCIVHavpDKkHg -vcF7dixtm+8Jo4vhakQol7XZZgU5BETcSgBjNcwBJhFxAuB+Km/TtiXMK5U+36NG -SUS5EqR89vBiChth33KMvQZgQ/OfpmWk05lMhI0//o1sX+0QAGTbO9q7RGMf77V4 -CHJxLTU5ZYguSa+ILV9Gg4+KSLGHqk03LROn13K0cTEeWHWKRcoFtLrokmYqDd+F -qYaATa+SVCeS8PYDQ45R1ZaXJ7N15fRg0XM4pKsY4KAEUH5Y1ZfadPFd0LyDf1vh -yseogJQpJczvstUARjOQx7yD8J8AAwUH/19Tgj/HYEyBXKX9Awnb3nZWYGap3m25 -iA/bW//uUWKjYrc5oIT/qJ5QMcSBmyOAuclrf/VGSYQIRAOlpXmZQcjdnUuVDliS -wP77T4duMkfNiNgq8RAnM7cVUEJplbtGI5EapHFO8q88yq2ol8/urZIz5Qc3Va6H -LelvW1zhFAcp7lJRfuLAWq8Qa6f3Pm2uzScdaQIYrS+vmXXwbOqlygucnI8bBh0L -YTAjQqsG8YHklvXlrjfEjSas3l5UO45a48DWiSTXGyr5TsevSgfR6yabSHa8nUKO -gbGF4UU1f1Nn2xaasMRMiZER2uIo2Gs1zPwLleRwwVAjaUOWwRupx/6ISQQYEQIA -CQUCRBtDTgIbDAAKCRAQQyUYoPiqDP5SAJ4i92Z+F9bPVoX27UZS8xcmFOaxwQCg -3plWjAkK4jGDVnkcVv2eMGfTP20= -=Ylc5 +rXDAwbl2SODl9T9eVUUbm7bQxdD942qCv+jhvBzAJrrHmZ0KPYhJBCARAgAJBQJE +G1GyAh0DAAoJEBBDJRig+KoM86gAmgNUdUqrkiyji3OrzgzJOvvvGgPJAJ9mbH/M +PYHevtf0D4/YGAWDKIEkNrQ/U2VuZG1haWwsIEluYy4gU2VjdXJpdHkgT2ZmaWNl +ciA8c2VjdXJpdHktb2ZmaWNlckBzZW5kbWFpbC5jb20+iGEEExECACEFAkQbQzgC +GwMHCwkIBwMCAQQVAggDBBYCAwECHgECF4AACgkQEEMlGKD4qgwt0QCdHD2sFnc1 +cKILKClUR2Ad3x+OyysAoMTKNOPxq/burquoqt0rN8QnPkctiEYEEBECAAYFAkQb +S9wACgkQGPUDgCTCeAKDiwCfae3NkBOnjSBa6E6ftmrDbzQYC9YAoN2Z8jaq1kM2 +pXmC0s/QTIIsPc3iiJwEEAECAAYFAkQbS+sACgkQfEtnbaAOFWNKEQQAgIKzIX/E +vAj4BaG13i3EYdvcSG0mfYsV4NVIdrDPnV3UmgbGBskgjkUyWHlUTJZ/AExcYyuT +QNuivkH8pQKsXNUpm020PXvJg7t0/ZKTTv0tXyz2OT3OLKhw1O+qUOOrkxgSpfg7 +UgQLTbZ0Ol1faP8iSTM5649rAOpqbPi8tneInAQQAQIABgUCRBtL9QAKCRDAKcpA +FvTM6cCsA/45MgCAYIr08/GKnFlBTZhAXQ6pZvV4OCdtgMIwcJXJtB2E+HSjOsn9 +Ismyy9n19Z5j961oGwyfZ/uYoRp1Q5rMEs/sDmFyq0TAl3vRoblwuOKtOp2bvGah +/TzdkMztMrftErM9MhddQDEIoS3PQ0QkSODRCi/m8eMtGLPX/m+Fu4icBBABAgAG +BQJEG0wEAAoJENbgof5PvirdmR0EAJNHIszZZnGx7jqUB2+tRLCsLctrm8Hpeltc +2XkMeT0nx3K8XSDs/cigdQqTHq5oD2P/6Vp9e8X2UE/RfEhCDre9ADnSWzqASRtX +ktDVnFZZHuYnXl1d74bqS5RlWpbQUJ5VjAFuZaB1nhFRcRWuhl8UIqN9OKygtUAg +zlR/FfiziEYEEBECAAYFAkQbTBwACgkQIfnFvPdqm/XFxgCg8x357MlaxcLbnsbK +ZFN26nLDBqQAnAxqbkNoRKqF+IRV9aMBz0vSt+baiJwEEAECAAYFAkQbTCgACgkQ +HnuzyK+VliXMAAP+NGQ+3rPnGHUyT02C5K9ksuqWt+7q0ZWHR3NP66H1XQCqrEUX +qmcWtZpd0xTY8XWcyEzYntXje3epQMnA6/52ohFNehiGQG4FENsusTzu7+GNdpSq +YTPcdUrUp6zOc3o5C30q+Y1tvBtyYlfeQSvH3x47Ai8PrnVmHjJCltkGtgiIRgQT +EQIABgUCRBtU7QAKCRAxGYBRzxpNLE6WAKCACCj678P/8pn+vG9JpgQWQgV7zgCf +Q5409UHS5itySiyQ/atuUOAG0QiJASIEEAECAAwFAko7qxAFAwASdQAACgkQlxC4 +m8pXrXxfsAf+LBylo0S6W+hExP3s9jso7TJTM4hJGrVjRKZpVF/zj5Qk0Nocxo4D +YitmT08e+iBZerO7OcYvy16uiaTBQ2PCSYoLhen2AMjkKp7EPG+TF1VBrp7jj5aZ +GYROu8NZTKr28rCL8a2Ge+KrohjEeIJ80IZo7gSZRprQnO5LzDtBMp2T4HV6Gj4d +g2aa4tDhTj2EiU3ZOQ/A9AbOYBKAqipxXdBR20HdeJU8looTv5p7jZloawgblXqv +bvvSBXYGT7uJjx7tOl6yxPrjuu82PyauHI6bUUbrJcvuk9zd3mrvyS9OL9pTeR2A +VDK3PfX3g9z0OzR7owHZT627T36Jogult7kCDQREG0NOEAgAsvSdf2lG3k0OqLTC +TVEhcAY8kJqE8nyHnYKAAlSb8UCyZd0IhUdq+kMqQeC9wXt2LG2b7wmji+FqRCiX +tdlmBTkERNxKAGM1zAEmEXEC4H4qb9O2JcwrlT7fo0ZJRLkSpHz28GIKG2Hfcoy9 +BmBD85+mZaTTmUyEjT/+jWxf7RAAZNs72rtEYx/vtXgIcnEtNTlliC5Jr4gtX0aD +j4pIsYeqTTctE6fXcrRxMR5YdYpFygW0uuiSZioN34WphoBNr5JUJ5Lw9gNDjlHV +lpcns3Xl9GDRczikqxjgoARQfljVl9p08V3QvIN/W+HKx6iAlCklzO+y1QBGM5DH +vIPwnwADBQf/X1OCP8dgTIFcpf0DCdvedlZgZqnebbmID9tb/+5RYqNitzmghP+o +nlAxxIGbI4C5yWt/9UZJhAhEA6WleZlByN2dS5UOWJLA/vtPh24yR82I2CrxECcz +txVQQmmVu0YjkRqkcU7yrzzKraiXz+6tkjPlBzdVroct6W9bXOEUBynuUlF+4sBa +rxBrp/c+ba7NJx1pAhitL6+ZdfBs6qXKC5ycjxsGHQthMCNCqwbxgeSW9eWuN8SN +JqzeXlQ7jlrjwNaJJNcbKvlOx69KB9HrJptIdrydQo6BsYXhRTV/U2fbFpqwxEyJ +kRHa4ijYazXM/AuV5HDBUCNpQ5bBG6nH/ohJBBgRAgAJBQJEG0NOAhsMAAoJEBBD +JRig+KoM/lIAniL3Zn4X1s9WhfbtRlLzFyYU5rHBAKDemVaMCQriMYNWeRxW/Z4w +Z9M/bQ== +=nJIt -----END PGP PUBLIC KEY BLOCK----- Type Bits KeyID Created Expires Algorithm Use @@ -2082,4 +2298,4 @@ DnF3FZZEzV7oqPwC2jzv/1dD6GFhtgy0cnyoPGUJCyc= =nES8 -----END PGP PUBLIC KEY BLOCK----- -$Revision: 8.36 $, Last updated $Date: 2011/01/28 21:17:54 $ +$Revision: 8.40 $, Last updated $Date: 2012/01/09 04:44:59 $ diff --git a/contrib/sendmail/RELEASE_NOTES b/contrib/sendmail/RELEASE_NOTES index f96f8cf..1ded392 100644 --- a/contrib/sendmail/RELEASE_NOTES +++ b/contrib/sendmail/RELEASE_NOTES @@ -1,11 +1,60 @@ SENDMAIL RELEASE NOTES - $Id: RELEASE_NOTES,v 8.1991 2011/05/15 04:28:16 ca Exp $ + $Id: RELEASE_NOTES,v 8.2011 2012/12/21 18:42:16 ca Exp $ This listing shows the version of the sendmail binary, the version of the sendmail configuration files, the date of release, and a summary of the changes in that release. +8.14.6/8.14.6 2012/12/23 + Fix a regression introduced in 8.14.5: if a server offers + two AUTH lines, the MTA would not read them after + STARTTLS has been used and hence SMTP AUTH for + the client side would fail. Problem noted by Lena. + Do not cache hostnames internally in a non case sensitive way + as that may cause addresses to change from lower case + to upper case or vice versa. These header modifications + can cause problems with milters that rely on receiving + headers in the same way as they are being sent out such + as a DKIM signing milter. + If MaxQueueChildren is set then it was possible that new queue + runners could not be started anymore because an + internal counter was subject to a race condition. + If a milter decreases the timeout it waits for a communication + with the MTA, the MTA might experience a write() timeout. + In some situations, the resulting error might have been + ignored. Problem noted by Werner Wiethege. + Note: decreasing the communication timeout in a milter + should not be done without considering the potential + problems. + smfi_setsymlist() now properly sets the list of macros for + the milter which invoked it, instead of a global + list for all milters. Problem reported by + David Shrimpton of the University of Queensland. + If Timeout.resolver.retrans is set to a value larger than 20, + then resolver.retry was temporarily set to 0 for + gethostbyaddr() lookups. Now it is set to 1 instead. + Patch from Peter. + If sendmail could not lock the statistics file due to a system + error, and sendmail later sends a DSN for a mail that + triggered such an error, then sendmail tried to access + memory that was freed before (causing a crash on some + systems). Problem reported by Ryan Stone. + Do not log negative values for size= nor pri= to avoid confusing + log parsers, instead limit the values to LONG_MAX. + Account for an API change in newer versions of Cyrus-SASL. + Patch from Hajimu UMEMOTO from FreeBSD. + Do not try to resolve link-local addresses for IPv4 (just as it + is done for IPv6). Patch from John Beck of Oracle. + Improve logging of client and server STARTTLS connection failures + that may be due to incompatible cipher lists by including + the reason for the failure in a single log line. Suggested + by James Carey of Boeing. + Portability: + Add support for Darwin 11.x and 12.x (Mac OS X 10.7 and 10.8). + Add support for SunOS 5.12 (aka Solaris 12). Patch from + John Beck of Oracle. + 8.14.5/8.14.5 2011/05/17 Do not cache SMTP extensions across connections as the cache is based on hostname which may not be a unique identifier diff --git a/contrib/sendmail/cf/README b/contrib/sendmail/cf/README index e3496e9..6d34ac6 100644 --- a/contrib/sendmail/cf/README +++ b/contrib/sendmail/cf/README @@ -1144,7 +1144,7 @@ relay_hosts_only For example, if you specify ``foo.com'', then mail to or from foo.com, abc.foo.com, or a.very.deep.domain.foo.com will all be accepted for relaying. This feature changes - the behaviour to lookup individual host names only. + the behaviour to look up individual host names only. relay_based_on_MX Turns on the ability to allow relaying based on the MX @@ -2230,9 +2230,9 @@ command: FEATURE(`ldap_routing', <mailHost>, <mailRoutingAddress>, <bounce>, <detail>, <nodomain>, <tempfail>) -where <mailHost> is a map definition describing how to lookup an alternative +where <mailHost> is a map definition describing how to look up an alternative mail host for a particular address; <mailRoutingAddress> is a map definition -describing how to lookup an alternative address for a particular address; +describing how to look up an alternative address for a particular address; the <bounce> argument, if present and not the word "passthru", dictates that mail should be bounced if neither a mailHost nor mailRoutingAddress is found, if set to "sendertoo", the sender will be rejected if not @@ -4701,4 +4701,4 @@ M4 DIVERSIONS 8 DNS based blacklists 9 special local rulesets (1 and 2) -$Revision: 8.727 $, Last updated $Date: 2009/05/07 23:46:17 $ +$Revision: 8.728 $, Last updated $Date: 2012/09/07 16:29:13 $ diff --git a/contrib/sendmail/cf/cf/submit.cf b/contrib/sendmail/cf/cf/submit.cf index 6cc386a..62c05e9 100644 --- a/contrib/sendmail/cf/cf/submit.cf +++ b/contrib/sendmail/cf/cf/submit.cf @@ -16,8 +16,8 @@ ##### ##### SENDMAIL CONFIGURATION FILE ##### -##### built by ca@wiz.smi.sendmail.com on Sat May 14 21:31:14 PDT 2011 -##### in /extra/home/ca/sm-8.14.5/OpenSource/sendmail-8.14.5/cf/cf +##### built by ca@wiz.smi.sendmail.com on Fri Dec 21 10:45:15 PST 2012 +##### in /extra/home/ca/sm-8.14.6/OpenSource/sendmail-8.14.6/cf/cf ##### using ../ as configuration include directory ##### ###################################################################### @@ -35,7 +35,7 @@ ##### $Id: no_default_msa.m4,v 8.2 2001/02/14 05:03:22 gshapiro Exp $ ##### -##### $Id: proto.m4,v 8.744 2010/11/23 20:29:47 guenther Exp $ ##### +##### $Id: proto.m4,v 8.760 2012/09/07 16:30:15 ca Exp $ ##### # level 10 config file format V10/Berkeley @@ -114,7 +114,7 @@ D{MTAHost}[127.0.0.1] # Configuration version number -DZ8.14.5/Submit +DZ8.14.6/Submit ############### @@ -926,6 +926,8 @@ SParseLocal=98 + + ###################################################################### ### CanonAddr -- Convert an address into a standard form for ### relay checking. Route address syntax is diff --git a/contrib/sendmail/cf/feature/ldap_routing.m4 b/contrib/sendmail/cf/feature/ldap_routing.m4 index e9b4880..8959e20 100644 --- a/contrib/sendmail/cf/feature/ldap_routing.m4 +++ b/contrib/sendmail/cf/feature/ldap_routing.m4 @@ -10,7 +10,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: ldap_routing.m4,v 8.18 2010/01/05 00:57:27 ca Exp $') +VERSIONID(`$Id: ldap_routing.m4,v 8.20 2012/01/18 22:27:06 ca Exp $') divert(-1) # Check first two arguments. If they aren't set, may need to warn in proto.m4 diff --git a/contrib/sendmail/cf/m4/proto.m4 b/contrib/sendmail/cf/m4/proto.m4 index 8bfd9de..9eae488 100644 --- a/contrib/sendmail/cf/m4/proto.m4 +++ b/contrib/sendmail/cf/m4/proto.m4 @@ -13,7 +13,7 @@ divert(-1) # divert(0) -VERSIONID(`$Id: proto.m4,v 8.744 2010/11/23 20:29:47 guenther Exp $') +VERSIONID(`$Id: proto.m4,v 8.760 2012/09/07 16:30:15 ca Exp $') # level CF_LEVEL config file format V`'CF_LEVEL`'ifdef(`NO_VENDOR',`', `/ifdef(`VENDOR_NAME', `VENDOR_NAME', `Berkeley')') @@ -1532,8 +1532,9 @@ R<?> <e s> <$+> $#error $@ nouser $: "550 User unknown"') R<?> <$*> <$+> $@ $2', `dnl # return the original address -R<> <> <$+> <@ $+> <$*> $@ $1')', -`dnl') +R<> <> <$+> <@ $+> <$*> $@ $1') +') + ifelse(substr(confDELIVERY_MODE,0,1), `d', `errprint(`WARNING: Antispam rules not available in deferred delivery mode. ')') diff --git a/contrib/sendmail/cf/m4/version.m4 b/contrib/sendmail/cf/m4/version.m4 index 566c3a5..ae084d1 100644 --- a/contrib/sendmail/cf/m4/version.m4 +++ b/contrib/sendmail/cf/m4/version.m4 @@ -1,6 +1,6 @@ divert(-1) # -# Copyright (c) 1998-2011 Sendmail, Inc. and its suppliers. +# Copyright (c) 1998-2012 Sendmail, Inc. and its suppliers. # All rights reserved. # Copyright (c) 1983 Eric P. Allman. All rights reserved. # Copyright (c) 1988, 1993 @@ -11,8 +11,8 @@ divert(-1) # the sendmail distribution. # # -VERSIONID(`$Id: version.m4,v 8.214 2011/04/26 23:02:36 ca Exp $') +VERSIONID(`$Id: version.m4,v 8.222 2012/12/19 05:11:43 ca Exp $') # divert(0) # Configuration version number -DZ8.14.5`'ifdef(`confCF_VERSION', `/confCF_VERSION') +DZ8.14.6`'ifdef(`confCF_VERSION', `/confCF_VERSION') diff --git a/contrib/sendmail/doc/op/op.me b/contrib/sendmail/doc/op/op.me index 1e7d370..270d4cf 100644 --- a/contrib/sendmail/doc/op/op.me +++ b/contrib/sendmail/doc/op/op.me @@ -9,7 +9,7 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: op.me,v 8.747 2010/05/08 04:18:27 ca Exp $ +.\" $Id: op.me,v 8.749 2012/03/02 22:37:11 ca Exp $ .\" .\" eqn op.me | pic | troff -me .\" @@ -90,7 +90,7 @@ Sendmail, Inc. .de Ve Version \\$2 .. -.Ve $Revision: 8.747 $ +.Ve $Revision: 8.749 $ .rm Ve .sp For Sendmail Version 8.14 @@ -5999,7 +5999,7 @@ mailer. .ip @ Look up addresses in the user database. .ip % -Do not attempt delivery on initial recipient of a message +Do not attempt delivery on initial receipt of a message or on queue runs unless the queued message is selected using one of the -qI/-qR/-qS queue run modifiers @@ -7540,6 +7540,10 @@ This is intended to allow you to get responsiveness by processing the queue fairly frequently without thrashing your system by trying jobs too often. The default units are minutes. +Note: +This option is ignored for queue runs that select a subset +of the queue, i.e., +.q \-q[!][I|R|S|Q][string] .ip MustQuoteChars=\fIs\fP [no short name] Sets the list of characters that must be quoted if used in a full name @@ -11467,7 +11471,7 @@ replace it with a blank sheet for double-sided output. .\".sz 10 .\"Eric Allman .\".sp -.\"Version $Revision: 8.747 $ +.\"Version $Revision: 8.749 $ .\".ce 0 .bp 3 .ce diff --git a/contrib/sendmail/include/libmilter/mfapi.h b/contrib/sendmail/include/libmilter/mfapi.h index f56992f..3b8e7d7 100644 --- a/contrib/sendmail/include/libmilter/mfapi.h +++ b/contrib/sendmail/include/libmilter/mfapi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2004, 2006, 2008 Sendmail, Inc. and its suppliers. + * Copyright (c) 1999-2004, 2006, 2008, 2012 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -7,7 +7,7 @@ * the sendmail distribution. * * - * $Id: mfapi.h,v 8.80 2009/11/06 00:57:08 ca Exp $ + * $Id: mfapi.h,v 8.82 2012/11/16 20:25:04 ca Exp $ */ /* @@ -206,6 +206,7 @@ LIBMILTER_API int smfi_version __P((unsigned int *, unsigned int *, unsigned int ** (hence the list is not sorted by the SMT protocol steps). */ +#define SMFIM_NOMACROS (-1) /* Do NOT use, internal only */ #define SMFIM_FIRST 0 /* Do NOT use, internal marker only */ #define SMFIM_CONNECT 0 /* connect */ #define SMFIM_HELO 1 /* HELO/EHLO */ diff --git a/contrib/sendmail/include/sm/clock.h b/contrib/sendmail/include/sm/clock.h index ba7fd68..22ed171 100644 --- a/contrib/sendmail/include/sm/clock.h +++ b/contrib/sendmail/include/sm/clock.h @@ -9,7 +9,7 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * - * $Id: clock.h,v 1.12 2004/08/03 19:57:21 ca Exp $ + * $Id: clock.h,v 1.13 2011/11/03 03:13:24 ca Exp $ */ /* @@ -59,7 +59,7 @@ extern SIGFUNC_DECL sm_tick __P((int)); /* ** SM_SETEVENT -- set an event to happen at a specific time in seconds. ** -** Translates the seconds into millseconds and calls sm_seteventm() +** Translates the seconds into milliseconds and calls sm_seteventm() ** to get a specific event to happen in the future at a specific time. ** ** Parameters: diff --git a/contrib/sendmail/include/sm/tailq.h b/contrib/sendmail/include/sm/tailq.h index c8eeec4..ef67a97 100644 --- a/contrib/sendmail/include/sm/tailq.h +++ b/contrib/sendmail/include/sm/tailq.h @@ -36,7 +36,7 @@ #define SM_TAILQ_H_ /* - * $Id: tailq.h,v 1.2 2007/06/29 23:09:57 ca Exp $ + * $Id: tailq.h,v 1.3 2012/01/21 00:12:14 ashish Exp $ * * This file is a modified copy of queue.h from a BSD system: * we only need tail queues here. @@ -69,8 +69,8 @@ struct { \ struct type **tqe_prev; /* address of previous next element */ \ } -/* - * tail queue access methods +/* + * tail queue access methods */ #define SM_TAILQ_FIRST(head) ((head)->tqh_first) #define SM_TAILQ_END(head) NULL diff --git a/contrib/sendmail/libmilter/Makefile.m4 b/contrib/sendmail/libmilter/Makefile.m4 index bc9bc66..8f5da7d 100644 --- a/contrib/sendmail/libmilter/Makefile.m4 +++ b/contrib/sendmail/libmilter/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.85 2009/11/24 21:59:33 ca Exp $ +dnl $Id: Makefile.m4,v 8.88 2012/09/25 17:40:32 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') dnl only required for compilation of EXTRAS diff --git a/contrib/sendmail/libmilter/docs/api.html b/contrib/sendmail/libmilter/docs/api.html index 578e0ca..3c56746 100644 --- a/contrib/sendmail/libmilter/docs/api.html +++ b/contrib/sendmail/libmilter/docs/api.html @@ -2,7 +2,7 @@ <HEAD><TITLE>Milter API</TITLE></HEAD> <BODY> <!-- -$Id: api.html,v 1.37 2009/05/19 00:40:52 ca Exp $ +$Id: api.html,v 1.38 2012/03/29 03:18:37 ca Exp $ --> <H1>Milter API</H1> @@ -214,7 +214,6 @@ other callbacks are message-oriented. <TD>SMFIS_REJECT</TD> <TD>For a connection-oriented routine, reject this connection; call <A HREF="xxfi_close.html">xxfi_close</A>.<BR> For a message-oriented routine (except - <A HREF="xxfi_eom.html">xxfi_eom</A> or <A HREF="xxfi_abort.html">xxfi_abort</A>), reject this message.<BR> For a recipient-oriented routine, reject the current recipient (but continue processing the current message). </TD> diff --git a/contrib/sendmail/libmilter/docs/smfi_setsymlist.html b/contrib/sendmail/libmilter/docs/smfi_setsymlist.html index 7e8edff..80793f0 100644 --- a/contrib/sendmail/libmilter/docs/smfi_setsymlist.html +++ b/contrib/sendmail/libmilter/docs/smfi_setsymlist.html @@ -2,7 +2,7 @@ <HEAD><TITLE>smfi_setsymlist</TITLE></HEAD> <BODY> <!-- -$Id: smfi_setsymlist.html,v 1.5 2006/12/21 18:30:35 ca Exp $ +$Id: smfi_setsymlist.html,v 1.6 2012/05/11 17:34:23 ca Exp $ --> <H1>smfi_setsymlist</H1> @@ -86,8 +86,10 @@ Otherwise MI_SUCCESS is returned. <!----------- Notes ----------> <TR align="left" valign=top> <TH>NOTES</TH> -<TD>There is an internal limit on the number of macros that can be -set (currently 5), +<TD>There is an internal limit on the number of macros +that can be set +<!-- XREF: MAXFILTERMACROS --> +(currently 50), however, this limit is not enforced by libmilter, only by the MTA, but a possible violation of this restriction is not communicated back to the milter.</TD> @@ -97,7 +99,7 @@ the milter.</TD> <HR size="1"> <FONT size="-1"> -Copyright (c) 2006 Sendmail, Inc. and its suppliers. +Copyright (c) 2006, 2012 Sendmail, Inc. and its suppliers. All rights reserved. <BR> By using this file, you agree to the terms and conditions set diff --git a/contrib/sendmail/libmilter/docs/smfi_settimeout.html b/contrib/sendmail/libmilter/docs/smfi_settimeout.html index 97d41cb..5631499 100644 --- a/contrib/sendmail/libmilter/docs/smfi_settimeout.html +++ b/contrib/sendmail/libmilter/docs/smfi_settimeout.html @@ -2,7 +2,7 @@ <HEAD><TITLE>smfi_settimeout</TITLE></HEAD> <BODY> <!-- -$Id: smfi_settimeout.html,v 1.14 2006/12/21 18:30:35 ca Exp $ +$Id: smfi_settimeout.html,v 1.15 2011/10/03 16:21:33 ca Exp $ --> <H1>smfi_settimeout</H1> @@ -52,11 +52,24 @@ If smfi_settimeout is not called, a default timeout of 7210 seconds is used. <TD>smfi_settimeout always returns MI_SUCCESS.</TD> </TR> +<!----------- Notes ----------> +<TR> +<TH valign="top" align=left>NOTES</TH> +<TD> +Decreasing the timeout is strongly discouraged +and may break the communication with the MTA. +Do <EM>not</EM> decrease this value without making sure that +the MTA also uses lower timeouts for communication +(with the milter and with the SMTP client). +</TR> +</TABLE> + + </TABLE> <HR size="1"> <FONT size="-1"> -Copyright (c) 2000, 2002-2003, 2006 Sendmail, Inc. and its suppliers. +Copyright (c) 2000, 2002-2003, 2006, 2011 Sendmail, Inc. and its suppliers. All rights reserved. <BR> By using this file, you agree to the terms and conditions set diff --git a/contrib/sendmail/libmilter/worker.c b/contrib/sendmail/libmilter/worker.c index aa1bd57..50e8107 100644 --- a/contrib/sendmail/libmilter/worker.c +++ b/contrib/sendmail/libmilter/worker.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2004, 2007, 2009-2011 Sendmail, Inc. and its suppliers. + * Copyright (c) 2003-2004, 2007, 2009-2012 Sendmail, Inc. and its suppliers. * All rights reserved. * * By using this file, you agree to the terms and conditions set @@ -11,7 +11,7 @@ */ #include <sm/gen.h> -SM_RCSID("@(#)$Id: worker.c,v 8.19 2011/02/14 23:33:48 ca Exp $") +SM_RCSID("@(#)$Id: worker.c,v 8.24 2012/03/13 15:37:46 ca Exp $") #include "libmilter.h" @@ -141,7 +141,8 @@ static int mi_list_del_ctx __P((SMFICTX_PTR)); #if POOL_DEBUG # define POOL_LEV_DPRINTF(lev, x) \ - do { \ + do \ + { \ if ((lev) < ctx->ctx_dbg) \ sm_dprintf x; \ } while (0) @@ -377,7 +378,7 @@ mi_pool_controller(arg) for (;;) { SMFICTX_PTR ctx; - int nfd, rfd, i; + int nfd, r, i; time_t now; POOL_LEV_DPRINTF(4, ("Let's %s again...", WAITFN)); @@ -498,19 +499,19 @@ mi_pool_controller(arg) TASKMGR_UNLOCK(); /* Everything is ready, let's wait for an event */ - rfd = poll(pfd, nfd, POLL_TIMEOUT); + r = poll(pfd, nfd, POLL_TIMEOUT); POOL_LEV_DPRINTF(4, ("%s returned: at epoch %d value %d", WAITFN, now, nfd)); /* timeout */ - if (rfd == 0) + if (r == 0) continue; rebuild_set = true; /* error */ - if (rfd < 0) + if (r < 0) { if (errno == EINTR) continue; @@ -522,6 +523,7 @@ mi_pool_controller(arg) if (pcnt >= MAX_FAILS_S) goto err; + continue; } pcnt = 0; @@ -535,7 +537,7 @@ mi_pool_controller(arg) WAITFN, i, nfd, WAIT_FD(i))); - /* has a worker signaled an end of task ? */ + /* has a worker signaled an end of task? */ if (WAIT_FD(i) == RD_PIPE) { char evts[256]; @@ -563,7 +565,12 @@ mi_pool_controller(arg) continue; } - /* no ! sendmail wants to send a command */ + /* + ** Not the pipe for workers waking us, + ** so must be something on an MTA connection. + */ + + TASKMGR_LOCK(); SM_TAILQ_FOREACH(ctx, &WRK_CTX_HEAD, ctx_link) { if (ctx->ctx_wstate != WKST_WAITING) @@ -575,7 +582,6 @@ mi_pool_controller(arg) if (ctx->ctx_sd == pfd[i].fd) { - TASKMGR_LOCK(); POOL_LEV_DPRINTF(4, ("TASK: found %d for fd[%d]=%d", @@ -591,10 +597,10 @@ mi_pool_controller(arg) ctx->ctx_wstate = WKST_RUNNING; LAUNCH_WORKER(ctx); } - TASKMGR_UNLOCK(); break; } } + TASKMGR_UNLOCK(); POOL_LEV_DPRINTF(4, ("TASK %s FOUND - Checking PIPE for fd[%d]", @@ -607,6 +613,14 @@ mi_pool_controller(arg) free(pfd); Tskmgr.tm_signature = 0; +#if 0 + /* + ** Do not clean up ctx -- it can cause double-free()s. + ** The program is shutting down anyway, so it's not worth the trouble. + ** There is a more complex solution that prevents race conditions + ** while accessing ctx, but that's maybe for a later version. + */ + for (;;) { SMFICTX_PTR ctx; @@ -616,6 +630,7 @@ mi_pool_controller(arg) break; mi_close_session(ctx); } +#endif (void) smutex_destroy(&Tskmgr.tm_w_mutex); (void) scond_destroy(&Tskmgr.tm_w_cond); diff --git a/contrib/sendmail/src/Makefile.m4 b/contrib/sendmail/src/Makefile.m4 index 7bcd24d..5908b97 100644 --- a/contrib/sendmail/src/Makefile.m4 +++ b/contrib/sendmail/src/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.126 2010/11/24 19:59:54 gshapiro Exp $ +dnl $Id: Makefile.m4,v 8.132 2012/09/11 20:02:44 ca Exp $ include(confBUILDTOOLSDIR`/M4/switch.m4') define(`confREQUIRE_LIBSM', `true') diff --git a/contrib/sendmail/src/TRACEFLAGS b/contrib/sendmail/src/TRACEFLAGS index 6fdfdd9..c3f0266 100644 --- a/contrib/sendmail/src/TRACEFLAGS +++ b/contrib/sendmail/src/TRACEFLAGS @@ -1,4 +1,4 @@ -# $Id: TRACEFLAGS,v 8.48 2008/11/03 21:09:26 gshapiro Exp $ +# $Id: TRACEFLAGS,v 8.52 2012/03/03 00:10:42 ca Exp $ 0, 4 main.c main canonical name, UUCP node name, a.k.a.s 0, 15 main.c main print configuration 0, 44 util.c printav print address of each string @@ -77,12 +77,12 @@ 63 queue.c runqueue process watching 64 multiple Milter 65 main.c permission checks -#if _FFR_ADAPTIVE_EOL -66 srvrsmtp.c conformance checks -#endif /* _FFR_ADAPTIVE_EOL */ -#if _FFR_QUEUE_SCHED_DBG -69 queue.c scheduling -#endif /* _FFR_QUEUE_SCHED_DBG */ +#if _FFR_ADAPTIVE_EOL +66 srvrsmtp.c conformance checks +#endif /* _FFR_ADAPTIVE_EOL */ +#if _FFR_QUEUE_SCHED_DBG +69 queue.c scheduling +#endif /* _FFR_QUEUE_SCHED_DBG */ 70 queue.c quarantining 71,>99 milter.c quarantine on errors 73 queue.c shared memory updates @@ -92,6 +92,7 @@ 83 collect.c timeout 84 deliver.c timeout 85 map.c dprintf map +89 conf.c >=8 use sm_dprintf() instead of syslog() 91 mci.c syslogging of MCI cache information 93,>99 * Prevent daemon connection fork for profiling/debugging 94,>99 srvrsmtp.c cause commands to fail (for protocol testing) diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c index f5d7247..c8dcb8a 100644 --- a/contrib/sendmail/src/collect.c +++ b/contrib/sendmail/src/collect.c @@ -13,7 +13,7 @@ #include <sendmail.h> -SM_RCSID("@(#)$Id: collect.c,v 8.284 2008/08/06 05:26:24 ca Exp $") +SM_RCSID("@(#)$Id: collect.c,v 8.285 2012/06/14 23:54:02 ca Exp $") static void eatfrom __P((char *volatile, ENVELOPE *)); static void collect_doheader __P((ENVELOPE *)); @@ -869,7 +869,8 @@ readerr: if (LogLevel > 6) sm_syslog(LOG_NOTICE, e->e_id, "message size (%ld) exceeds maximum (%ld)", - e->e_msgsize, MaxMessageSize); + PRT_NONNEGL(e->e_msgsize), + MaxMessageSize); } } diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c index ffc6f20..9130455 100644 --- a/contrib/sendmail/src/conf.c +++ b/contrib/sendmail/src/conf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2010 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2012 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -13,7 +13,7 @@ #include <sendmail.h> -SM_RCSID("@(#)$Id: conf.c,v 8.1168 2011/01/25 18:31:30 ca Exp $") +SM_RCSID("@(#)$Id: conf.c,v 8.1176 2012/12/07 03:59:54 ca Exp $") #include <sm/sendmail.h> #include <sendmail/pathnames.h> @@ -53,7 +53,7 @@ static int add_hostnames __P((SOCKADDR *)); static struct hostent *sm_getipnodebyname __P((const char *, int, int, int *)); static struct hostent *sm_getipnodebyaddr __P((const void *, size_t, int, int *)); #else /* NETINET6 && NEEDSGETIPNODE */ -#define sm_getipnodebyname getipnodebyname +#define sm_getipnodebyname getipnodebyname #define sm_getipnodebyaddr getipnodebyaddr #endif /* NETINET6 && NEEDSGETIPNODE */ @@ -4602,6 +4602,10 @@ add_hostnames(sa) int save_errno = errno; if (LogLevel > 3 && +#if NETINET && defined(IN_LINKLOCAL) + !(sa->sa.sa_family == AF_INET && + IN_LINKLOCAL(ntohl(sa->sin.sin_addr.s_addr))) && +#endif /* NETINET && defined(IN_LINKLOCAL) */ #if NETINET6 !(sa->sa.sa_family == AF_INET6 && IN6_IS_ADDR_LINKLOCAL(&sa->sin6.sin6_addr)) && @@ -5374,14 +5378,30 @@ sm_syslog(level, id, fmt, va_alist) #if LOG if (*id == '\0') { - if (tTd(89, 8)) + if (tTd(89, 10)) + { + struct timeval tv; + + gettimeofday(&tv, NULL); + sm_dprintf("%ld.%06ld %s\n", (long) tv.tv_sec, + (long) tv.tv_usec, newstring); + } + else if (tTd(89, 8)) sm_dprintf("%s\n", newstring); else syslog(level, "%s", newstring); } else { - if (tTd(89, 8)) + if (tTd(89, 10)) + { + struct timeval tv; + + gettimeofday(&tv, NULL); + sm_dprintf("%ld.%06ld %s: %s\n", (long) tv.tv_sec, + (long) tv.tv_usec, id, newstring); + } + else if (tTd(89, 8)) sm_dprintf("%s: %s\n", id, newstring); else syslog(level, "%s: %s", id, newstring); diff --git a/contrib/sendmail/src/daemon.c b/contrib/sendmail/src/daemon.c index a1dcbe85..498f8c2 100644 --- a/contrib/sendmail/src/daemon.c +++ b/contrib/sendmail/src/daemon.c @@ -14,7 +14,7 @@ #include <sendmail.h> #include "map.h" -SM_RCSID("@(#)$Id: daemon.c,v 8.691 2011/01/25 18:31:30 ca Exp $") +SM_RCSID("@(#)$Id: daemon.c,v 8.694 2012/03/03 00:10:42 ca Exp $") #if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__) # define USE_SOCK_STREAM 1 @@ -827,6 +827,7 @@ getrequests(e) OutChannel = outchannel; DisConnected = false; + #if XLA if (!xla_host_ok(RealHostName)) { @@ -4405,6 +4406,8 @@ hostnamebyanyaddr(sap) saveretry = _res.retry; if (_res.retry * _res.retrans > 20) _res.retry = 20 / _res.retrans; + if (_res.retry == 0) + _res.retry = 1; # endif /* NAMED_BIND */ switch (sap->sa.sa_family) diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c index bb1d60e..581a98d 100644 --- a/contrib/sendmail/src/deliver.c +++ b/contrib/sendmail/src/deliver.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2010 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2010, 2012 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -14,7 +14,7 @@ #include <sendmail.h> #include <sm/time.h> -SM_RCSID("@(#)$Id: deliver.c,v 8.1024 2011/01/12 23:52:59 ca Exp $") +SM_RCSID("@(#)$Id: deliver.c,v 8.1027 2012/12/19 02:49:21 ca Exp $") #if HASSETUSERCONTEXT # include <login_cap.h> @@ -37,6 +37,7 @@ static void sendenvelope __P((ENVELOPE *, int)); static int coloncmp __P((const char *, const char *)); #if STARTTLS +# include <openssl/err.h> static int starttls __P((MAILER *, MCI *, ENVELOPE *)); static int endtlsclt __P((MCI *)); #endif /* STARTTLS */ @@ -4277,7 +4278,7 @@ logdelivery(m, mci, dsn, status, ctladdr, xstart, e) /* pri: changes with each delivery attempt */ (void) sm_snprintf(bp, SPACELEFT(buf, bp), ", pri=%ld", - e->e_msgpriority); + PRT_NONNEGL(e->e_msgpriority)); bp += strlen(bp); /* relay: max 66 bytes for IPv4 addresses */ @@ -6197,10 +6198,16 @@ ssl_retry: if (LogLevel > 5) { + unsigned long l; + const char *sr; + + l = ERR_peek_error(); + sr = ERR_reason_error_string(l); sm_syslog(LOG_WARNING, NOQID, - "STARTTLS=client, error: connect failed=%d, SSL_error=%d, errno=%d, retry=%d", - result, ssl_err, errno, i); - if (LogLevel > 8) + "STARTTLS=client, error: connect failed=%d, reason=%s, SSL_error=%d, errno=%d, retry=%d", + result, sr == NULL ? "unknown" : sr, ssl_err, + errno, i); + if (LogLevel > 9) tlslogerr("client"); } diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c index c4bdc87..02f9663 100644 --- a/contrib/sendmail/src/headers.c +++ b/contrib/sendmail/src/headers.c @@ -14,7 +14,7 @@ #include <sendmail.h> #include <sm/sendmail.h> -SM_RCSID("@(#)$Id: headers.c,v 8.317 2008/08/27 20:11:55 gshapiro Exp $") +SM_RCSID("@(#)$Id: headers.c,v 8.318 2012/06/14 23:54:02 ca Exp $") static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *, bool)); static size_t fix_mime_header __P((HDR *, ENVELOPE *)); @@ -1152,7 +1152,7 @@ logsender(e, msgid) (void) sm_snprintf(sbp, SPACELEFT(sbuf, sbp), "from=%.200s, size=%ld, class=%d, nrcpts=%d", e->e_from.q_paddr == NULL ? "<NONE>" : e->e_from.q_paddr, - e->e_msgsize, e->e_class, e->e_nrcpts); + PRT_NONNEGL(e->e_msgsize), e->e_class, e->e_nrcpts); sbp += strlen(sbp); if (msgid != NULL) { @@ -1191,7 +1191,7 @@ logsender(e, msgid) 83)); sm_syslog(LOG_INFO, e->e_id, "size=%ld, class=%ld, nrcpts=%d", - e->e_msgsize, e->e_class, e->e_nrcpts); + PRT_NONNEGL(e->e_msgsize), e->e_class, e->e_nrcpts); if (msgid != NULL) sm_syslog(LOG_INFO, e->e_id, "msgid=%s", diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c index e14ffa0..2294063 100644 --- a/contrib/sendmail/src/main.c +++ b/contrib/sendmail/src/main.c @@ -26,7 +26,7 @@ SM_UNUSED(static char copyright[]) = The Regents of the University of California. All rights reserved.\n"; #endif /* ! lint */ -SM_RCSID("@(#)$Id: main.c,v 8.976 2011/03/15 23:14:36 ca Exp $") +SM_RCSID("@(#)$Id: main.c,v 8.981 2012/06/14 23:54:02 ca Exp $") #if NETINET || NETINET6 @@ -2561,6 +2561,10 @@ main(argc, argv, envp) authinfo = getauthinfo(sm_io_getinfo(InChannel, SM_IO_WHAT_FD, NULL), &forged); macdefine(&BlankEnvelope.e_macro, A_TEMP, '_', authinfo); + if (tTd(75, 9)) + sm_syslog(LOG_INFO, NOQID, + "main: where=after_getauthinfo, RealHostAddr=%s", + anynet_ntoa(&RealHostAddr)); /* at this point we are in a child: reset state */ sm_rpool_free(MainEnvelope.e_rpool); @@ -2827,7 +2831,7 @@ main(argc, argv, envp) /* set message size */ (void) sm_snprintf(buf, sizeof(buf), "%ld", - MainEnvelope.e_msgsize); + PRT_NONNEGL(MainEnvelope.e_msgsize)); macdefine(&MainEnvelope.e_macro, A_TEMP, macid("{msg_size}"), buf); diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c index 2eb6958..01d79ff 100644 --- a/contrib/sendmail/src/map.c +++ b/contrib/sendmail/src/map.c @@ -13,7 +13,7 @@ #include <sendmail.h> -SM_RCSID("@(#)$Id: map.c,v 8.706 2010/07/27 03:35:42 ca Exp $") +SM_RCSID("@(#)$Id: map.c,v 8.709 2012/04/20 18:47:09 ca Exp $") #if LDAPMAP # include <sm/ldap.h> @@ -3434,7 +3434,7 @@ ldapmap_open(map, mode) { if (LogLevel > 1) sm_syslog(LOG_NOTICE, CurEnv->e_id, - "timeout conning to LDAP server %.100s", + "timeout connecting to LDAP server %.100s", id); } @@ -3763,11 +3763,11 @@ ldapmap_lookup(map, name, av, statp) if (!bitset(MF_OPTIONAL, map->map_mflags)) { if (bitset(MF_NODEFER, map->map_mflags)) - syserr("Error getting LDAP results in map %s", - map->map_mname); + syserr("Error getting LDAP results, map=%s, name=%s", + map->map_mname, name); else - syserr("451 4.3.5 Error getting LDAP results in map %s", - map->map_mname); + syserr("451 4.3.5 Error getting LDAP results, map=%s, name=%s", + map->map_mname, name); } errno = save_errno; return NULL; @@ -3781,7 +3781,7 @@ ldapmap_lookup(map, name, av, statp) { if (LogLevel > 9) sm_syslog(LOG_INFO, CurEnv->e_id, - "ldap %.100s => %s", name, + "ldap=%s, %.100s=>%s", map->map_mname, name, vp == NULL ? "<NULL>" : vp); if (bitset(MF_MATCHONLY, map->map_mflags)) result = map_rewrite(map, name, strlen(name), NULL); diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c index 773dfa8..9774a91 100644 --- a/contrib/sendmail/src/milter.c +++ b/contrib/sendmail/src/milter.c @@ -10,7 +10,7 @@ #include <sendmail.h> -SM_RCSID("@(#)$Id: milter.c,v 8.277 2009/11/06 00:57:06 ca Exp $") +SM_RCSID("@(#)$Id: milter.c,v 8.279 2012/11/16 20:25:03 ca Exp $") #if MILTER # include <sm/sendmail.h> @@ -42,7 +42,7 @@ static char *milter_write __P((struct milter *, int, char *, ssize_t, time_t, ENVELOPE *, const char *)); static char *milter_send_command __P((struct milter *, int, void *, ssize_t, ENVELOPE *, char *, const char *)); -static char *milter_command __P((int, void *, ssize_t, char **, +static char *milter_command __P((int, void *, ssize_t, int, ENVELOPE *, char *, const char *, bool)); static char *milter_body __P((struct milter *, ENVELOPE *, char *)); static int milter_reopen_df __P((ENVELOPE *)); @@ -79,13 +79,13 @@ static int milter_set_macros __P((char *, char **, char *, int)); # define SMFS_READY 'R' /* ready for action */ # define SMFS_SKIP 'S' /* skip body */ -static char *MilterConnectMacros[MAXFILTERMACROS + 1]; -static char *MilterHeloMacros[MAXFILTERMACROS + 1]; -static char *MilterEnvFromMacros[MAXFILTERMACROS + 1]; -static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1]; -static char *MilterDataMacros[MAXFILTERMACROS + 1]; -static char *MilterEOMMacros[MAXFILTERMACROS + 1]; -static char *MilterEOHMacros[MAXFILTERMACROS + 1]; +/* +** MilterMacros contains the milter macros for each milter and each stage. +** indices are (in order): stages, milter-index, macro +** milter-index == 0: "global" macros (not for a specific milter). +*/ + +static char *MilterMacros[SMFIM_LAST + 1][MAXFILTERS + 1][MAXFILTERMACROS + 1]; static size_t MilterMaxDataSize = MILTER_MAX_DATA_SIZE; # define MILTER_CHECK_DONE_MSG() \ @@ -98,6 +98,16 @@ static size_t MilterMaxDataSize = MILTER_MAX_DATA_SIZE; milter_abort(e); \ } +/* set state in case of an error */ +# define MILTER_SET_STATE \ + if (bitnset(SMF_TEMPFAIL, m->mf_flags)) \ + *state = SMFIR_TEMPFAIL; \ + else if (bitnset(SMF_TEMPDROP, m->mf_flags)) \ + *state = SMFIR_SHUTDOWN; \ + else if (bitnset(SMF_REJECT, m->mf_flags)) \ + *state = SMFIR_REJECT + +/* flow through code maybe using continue; don't wrap in do {} while */ # define MILTER_CHECK_ERROR(initial, action) \ if (!initial && tTd(71, 100)) \ { \ @@ -119,12 +129,7 @@ static size_t MilterMaxDataSize = MILTER_MAX_DATA_SIZE; e->e_quarmsg); \ } \ } \ - else if (bitnset(SMF_TEMPFAIL, m->mf_flags)) \ - *state = SMFIR_TEMPFAIL; \ - else if (bitnset(SMF_TEMPDROP, m->mf_flags)) \ - *state = SMFIR_SHUTDOWN; \ - else if (bitnset(SMF_REJECT, m->mf_flags)) \ - *state = SMFIR_REJECT; \ + else MILTER_SET_STATE; \ else \ action; @@ -1221,6 +1226,7 @@ milter_setup(line) char *p; struct milter *m; STAB *s; + static int idx = 0; /* collect the filter name */ for (p = line; @@ -1323,7 +1329,10 @@ milter_setup(line) if (s->s_milter != NULL) syserr("X%s: duplicate filter definition", m->mf_name); else + { s->s_milter = m; + m->mf_idx = ++idx; + } } /* @@ -1555,20 +1564,13 @@ static struct milteropt unsigned char mo_code; /* code for option */ } MilterOptTab[] = { -# define MO_MACROS_CONNECT SMFIM_CONNECT - { "macros.connect", MO_MACROS_CONNECT }, -# define MO_MACROS_HELO SMFIM_HELO - { "macros.helo", MO_MACROS_HELO }, -# define MO_MACROS_ENVFROM SMFIM_ENVFROM - { "macros.envfrom", MO_MACROS_ENVFROM }, -# define MO_MACROS_ENVRCPT SMFIM_ENVRCPT - { "macros.envrcpt", MO_MACROS_ENVRCPT }, -# define MO_MACROS_DATA SMFIM_DATA - { "macros.data", MO_MACROS_DATA }, -# define MO_MACROS_EOM SMFIM_EOM - { "macros.eom", MO_MACROS_EOM }, -# define MO_MACROS_EOH SMFIM_EOH - { "macros.eoh", MO_MACROS_EOH }, + { "macros.connect", SMFIM_CONNECT }, + { "macros.helo", SMFIM_HELO }, + { "macros.envfrom", SMFIM_ENVFROM }, + { "macros.envrcpt", SMFIM_ENVRCPT }, + { "macros.data", SMFIM_DATA }, + { "macros.eom", SMFIM_EOM }, + { "macros.eoh", SMFIM_EOH }, # define MO_LOGLEVEL 0x07 { "loglevel", MO_LOGLEVEL }, @@ -1655,39 +1657,14 @@ milter_set_option(name, val, sticky) break; # endif /* _FFR_MAXDATASIZE || _FFR_MDS_NEGOTIATE */ - case MO_MACROS_CONNECT: - if (macros == NULL) - macros = MilterConnectMacros; - /* FALLTHROUGH */ - - case MO_MACROS_HELO: - if (macros == NULL) - macros = MilterHeloMacros; - /* FALLTHROUGH */ - - case MO_MACROS_ENVFROM: - if (macros == NULL) - macros = MilterEnvFromMacros; - /* FALLTHROUGH */ - - case MO_MACROS_ENVRCPT: - if (macros == NULL) - macros = MilterEnvRcptMacros; - /* FALLTHROUGH */ - - case MO_MACROS_EOH: - if (macros == NULL) - macros = MilterEOHMacros; - /* FALLTHROUGH */ - - case MO_MACROS_EOM: - if (macros == NULL) - macros = MilterEOMMacros; - /* FALLTHROUGH */ - - case MO_MACROS_DATA: - if (macros == NULL) - macros = MilterDataMacros; + case SMFIM_CONNECT: + case SMFIM_HELO: + case SMFIM_ENVFROM: + case SMFIM_ENVRCPT: + case SMFIM_EOH: + case SMFIM_EOM: + case SMFIM_DATA: + macros = MilterMacros[mo->mo_code][0]; r = milter_set_macros(name, macros, val, nummac); if (r >= 0) @@ -2188,7 +2165,7 @@ milter_send_command(m, cmd, data, sz, e, state, where) sm_syslog(LOG_ERR, e->e_id, "milter_send_command(%s): action=%s returned bogus response %c", m->mf_name, action, rcmd); - milter_error(m, e); + milter_error(m, e); /* NO ERROR CHECK? */ break; } @@ -2218,11 +2195,11 @@ milter_send_command(m, cmd, data, sz, e, state, where) */ static char * -milter_command(cmd, data, sz, macros, e, state, where, cmd_error) +milter_command(cmd, data, sz, stage, e, state, where, cmd_error) int cmd; void *data; ssize_t sz; - char **macros; + int stage; ENVELOPE *e; char *state; const char *where; @@ -2254,14 +2231,27 @@ milter_command(cmd, data, sz, macros, e, state, where, cmd_error) (m->mf_state != SMFS_OPEN && m->mf_state != SMFS_INMSG)) continue; - /* send macros (regardless of whether we send command) */ - if (macros != NULL && macros[0] != NULL) + if (stage >= SMFIM_FIRST && stage <= SMFIM_LAST) { - milter_send_macros(m, macros, command, e); - if (m->mf_state == SMFS_ERROR) + int idx; + char **macros; + + if ((m->mf_lflags & MI_LFLAGS_SYM(stage)) != 0) + idx = m->mf_idx; + else + idx = 0; + SM_ASSERT(idx >= 0 && idx <= MAXFILTERS); + macros = MilterMacros[stage][idx]; + + /* send macros (regardless of whether we send cmd) */ + if (macros != NULL && macros[0] != NULL) { - MILTER_CHECK_ERROR(false, continue); - break; + milter_send_macros(m, macros, command, e); + if (m->mf_state == SMFS_ERROR) + { + MILTER_CHECK_ERROR(false, continue); + break; + } } } @@ -2329,40 +2319,17 @@ milter_getsymlist(m, buf, rlen, offset) switch (i) { - case MO_MACROS_CONNECT: - if (macros == NULL) - macros = MilterConnectMacros; - /* FALLTHROUGH */ - - case MO_MACROS_HELO: - if (macros == NULL) - macros = MilterHeloMacros; - /* FALLTHROUGH */ - - case MO_MACROS_ENVFROM: - if (macros == NULL) - macros = MilterEnvFromMacros; - /* FALLTHROUGH */ - - case MO_MACROS_ENVRCPT: - if (macros == NULL) - macros = MilterEnvRcptMacros; - /* FALLTHROUGH */ - - case MO_MACROS_EOM: - if (macros == NULL) - macros = MilterEOMMacros; - /* FALLTHROUGH */ - - case MO_MACROS_EOH: - if (macros == NULL) - macros = MilterEOHMacros; - /* FALLTHROUGH */ - - case MO_MACROS_DATA: - if (macros == NULL) - macros = MilterDataMacros; - + case SMFIM_CONNECT: + case SMFIM_HELO: + case SMFIM_ENVFROM: + case SMFIM_ENVRCPT: + case SMFIM_EOH: + case SMFIM_EOM: + case SMFIM_DATA: + SM_ASSERT(m->mf_idx > 0 && m->mf_idx < MAXFILTERS); + macros = MilterMacros[i][m->mf_idx]; + + m->mf_lflags |= MI_LFLAGS_SYM(i); len = strlen(buf + offset); if (len > 0) { @@ -2370,6 +2337,9 @@ milter_getsymlist(m, buf, rlen, offset) buf + offset, nummac); if (r >= 0) nummac = r; + if (tTd(64, 5)) + sm_dprintf("milter_getsymlist(%s, %s)=%d\n", + m->mf_name, buf + offset, r); } break; @@ -3989,7 +3959,7 @@ milter_connect(hostname, addr, e, state) (void) memcpy(bp, sockinfo, strlen(sockinfo) + 1); } - response = milter_command(SMFIC_CONNECT, buf, s, MilterConnectMacros, + response = milter_command(SMFIC_CONNECT, buf, s, SMFIM_CONNECT, e, state, "connect", false); sm_free(buf); /* XXX */ @@ -4078,7 +4048,7 @@ milter_helo(helo, e, state) } response = milter_command(SMFIC_HELO, helo, strlen(helo) + 1, - MilterHeloMacros, e, state, "helo", false); + SMFIM_EOH, e, state, "helo", false); milter_per_connection_check(e); return response; } @@ -4166,7 +4136,7 @@ milter_envfrom(args, e, state) sm_syslog(LOG_INFO, e->e_id, "Milter: sender: %s", buf); /* send it over */ - response = milter_command(SMFIC_MAIL, buf, s, MilterEnvFromMacros, + response = milter_command(SMFIC_MAIL, buf, s, SMFIM_ENVFROM, e, state, "mail", false); sm_free(buf); /* XXX */ @@ -4247,7 +4217,7 @@ milter_envrcpt(args, e, state, rcpt_error) sm_syslog(LOG_INFO, e->e_id, "Milter: rcpts: %s", buf); /* send it over */ - response = milter_command(SMFIC_RCPT, buf, s, MilterEnvRcptMacros, + response = milter_command(SMFIC_RCPT, buf, s, SMFIM_ENVRCPT, e, state, "rcpt", rcpt_error); sm_free(buf); /* XXX */ return response; @@ -4273,8 +4243,8 @@ milter_data_cmd(e, state) sm_dprintf("milter_data_cmd\n"); /* send it over */ - return milter_command(SMFIC_DATA, NULL, 0, MilterDataMacros, e, state, - "data", false); + return milter_command(SMFIC_DATA, NULL, 0, SMFIM_DATA, + e, state, "data", false); } /* @@ -4293,7 +4263,12 @@ milter_data_cmd(e, state) ** modify the envelope or message. */ +/* flow through code using continue; don't wrap in do {} while */ # define MILTER_CHECK_RESULTS() \ + if (m->mf_state == SMFS_ERROR && *state == SMFIR_CONTINUE) \ + { \ + MILTER_SET_STATE; \ + } \ if (*state == SMFIR_ACCEPT || \ m->mf_state == SMFS_DONE || \ m->mf_state == SMFS_ERROR) \ @@ -4339,6 +4314,8 @@ milter_data(e, state) for (i = 0; InputFilters[i] != NULL; i++) { + int idx; + char **macros; struct milter *m = InputFilters[i]; if (*state != SMFIR_CONTINUE && @@ -4383,10 +4360,16 @@ milter_data(e, state) if (tTd(64, 10)) sm_dprintf("milter_data: eoh\n"); - if (MilterEOHMacros[0] != NULL) + if ((m->mf_lflags & MI_LFLAGS_SYM(SMFIM_EOH)) != 0) + idx = m->mf_idx; + else + idx = 0; + SM_ASSERT(idx >= 0 && idx <= MAXFILTERS); + macros = MilterMacros[SMFIM_EOH][idx]; + + if (macros != NULL) { - milter_send_macros(m, MilterEOHMacros, - SMFIC_EOH, e); + milter_send_macros(m, macros, SMFIC_EOH, e); MILTER_CHECK_RESULTS(); } @@ -4405,10 +4388,15 @@ milter_data(e, state) MILTER_CHECK_RESULTS(); } - if (MilterEOMMacros[0] != NULL) + if ((m->mf_lflags & MI_LFLAGS_SYM(SMFIM_EOH)) != 0) + idx = m->mf_idx; + else + idx = 0; + SM_ASSERT(idx >= 0 && idx <= MAXFILTERS); + macros = MilterMacros[SMFIM_EOM][idx]; + if (macros != NULL) { - milter_send_macros(m, MilterEOMMacros, - SMFIC_BODYEOB, e); + milter_send_macros(m, macros, SMFIC_BODYEOB, e); MILTER_CHECK_RESULTS(); } @@ -4734,7 +4722,7 @@ milter_unknown(smtpcmd, e, state) sm_dprintf("milter_unknown(%s)\n", smtpcmd); return milter_command(SMFIC_UNKNOWN, smtpcmd, strlen(smtpcmd) + 1, - NULL, e, state, "unknown", false); + SMFIM_NOMACROS, e, state, "unknown", false); } /* diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c index 9135c22..930f61d 100644 --- a/contrib/sendmail/src/parseaddr.c +++ b/contrib/sendmail/src/parseaddr.c @@ -13,7 +13,7 @@ #include <sendmail.h> -SM_RCSID("@(#)$Id: parseaddr.c,v 8.404 2010/07/27 03:35:42 ca Exp $") +SM_RCSID("@(#)$Id: parseaddr.c,v 8.405 2012/02/27 22:49:08 ca Exp $") #include <sm/sendmail.h> #include "map.h" @@ -242,6 +242,7 @@ parseaddr(addr, a, flags, delim, delimptr, e, isrcpt) ** ** Parameters: ** addr -- the address to check. +** note: this is the complete address (including display part) ** delimptr -- if non-NULL: end of address to check, i.e., ** a pointer in the address string. ** isrcpt -- true iff the address is for a recipient. diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c index 16142d9..70b2965 100644 --- a/contrib/sendmail/src/queue.c +++ b/contrib/sendmail/src/queue.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2009, 2011 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2009, 2011, 2012 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -14,7 +14,7 @@ #include <sendmail.h> #include <sm/sem.h> -SM_RCSID("@(#)$Id: queue.c,v 8.991 2011/03/15 23:14:36 ca Exp $") +SM_RCSID("@(#)$Id: queue.c,v 8.997 2012/06/14 23:54:03 ca Exp $") #include <dirent.h> @@ -1493,6 +1493,7 @@ runqueue(forkflag, verbose, persistent, runall) for (i = 0; i < NumWorkGroups && !NoMoreRunners; i++) { int rwgflags = RWG_NONE; + int wasblocked; /* ** If MaxQueueChildren active then test whether the start @@ -1529,7 +1530,11 @@ runqueue(forkflag, verbose, persistent, runall) ** increase if some queue runners "hang" for a long time. */ + /* don't let proc_list_drop() change CurRunners */ + wasblocked = sm_blocksignal(SIGCHLD); CurRunners += WorkGrp[curnum].wg_maxact; + if (wasblocked == 0) + (void) sm_releasesignal(SIGCHLD); if (forkflag) rwgflags |= RWG_FORK; if (verbose) @@ -1549,7 +1554,13 @@ runqueue(forkflag, verbose, persistent, runall) if (!ret) { + /* don't let proc_list_drop() change CurRunners */ + wasblocked = sm_blocksignal(SIGCHLD); CurRunners -= WorkGrp[curnum].wg_maxact; + CHK_CUR_RUNNERS("runqueue", curnum, + WorkGrp[curnum].wg_maxact); + if (wasblocked == 0) + (void) sm_releasesignal(SIGCHLD); break; } @@ -2031,6 +2042,9 @@ run_work_group(wgrp, flags) { IgnoreHostStatus = true; MinQueueAge = 0; +#if _FFR_EXPDELAY + MaxQueueAge = 0; +#endif /* _FFR_EXPDELAY */ } /* @@ -2300,7 +2314,7 @@ run_work_group(wgrp, flags) if (bitset(RWG_PERSISTENT, flags)) { sequenceno = 1; - sm_setproctitle(true, CurEnv, "running queue: %s", + sm_setproctitle(true, NULL, "running queue: %s", qid_printqueue(qgrp, qdir)); /* @@ -2860,7 +2874,7 @@ gatherq(qgrp, qdir, doall, full, more, pnentries) #if _FFR_EXPDELAY if (MaxQueueAge > 0) { - time_t lasttry, delay; + time_t lasttry, delay; lasttry = (time_t) atol(&lbuf[1]); delay = MIN(lasttry - w->w_ctime, @@ -3704,6 +3718,7 @@ dowork(qgrp, qdir, id, forkflag, requeueflag, e) (void) dropenvelope(e, true, false); sm_rpool_free(rpool); e->e_rpool = NULL; + e->e_message = NULL; } } e->e_id = NULL; @@ -4577,7 +4592,7 @@ readqf(e, openonly) e->e_dfdev = st.st_dev; e->e_dfino = ST_INODE(st); (void) sm_snprintf(buf, sizeof(buf), "%ld", - e->e_msgsize); + PRT_NONNEGL(e->e_msgsize)); macdefine(&e->e_macro, A_TEMP, macid("{msg_size}"), buf); } diff --git a/contrib/sendmail/src/sasl.c b/contrib/sendmail/src/sasl.c index c3f561d..0e4e8e1 100644 --- a/contrib/sendmail/src/sasl.c +++ b/contrib/sendmail/src/sasl.c @@ -9,7 +9,7 @@ */ #include <sm/gen.h> -SM_RCSID("@(#)$Id: sasl.c,v 8.22 2006/08/15 23:24:57 ca Exp $") +SM_RCSID("@(#)$Id: sasl.c,v 8.23 2012/11/27 18:53:13 gshapiro Exp $") #if SASL # include <stdlib.h> @@ -20,15 +20,15 @@ SM_RCSID("@(#)$Id: sasl.c,v 8.22 2006/08/15 23:24:57 ca Exp $") ** In order to ensure that storage leaks are tracked, and to prevent ** conflicts between the sm_heap package and sasl, we tell sasl to ** use the following heap allocation functions. Unfortunately, -** the sasl package incorrectly specifies the size of a block +** older sasl packages incorrectly specifies the size of a block ** using unsigned long: for portability, it should be size_t. */ -#if defined(SASL_VERSION_FULL) && SASL_VERSION_FULL >= 0x02011a -#define SM_SASL_SIZE_T size_t -#else /* defined(SASL_VERSION_FULL) && SASL_VERSION_FULL >= 0x02011a */ -#define SM_SASL_SIZE_T unsigned long -#endif /* defined(SASL_VERSION_FULL) && SASL_VERSION_FULL >= 0x02011a */ +# if defined(SASL_VERSION_FULL) && SASL_VERSION_FULL >= 0x02011a +# define SM_SASL_SIZE_T size_t +# else /* defined(SASL_VERSION_FULL) && SASL_VERSION_FULL >= 0x02011a */ +# define SM_SASL_SIZE_T unsigned long +# endif /* defined(SASL_VERSION_FULL) && SASL_VERSION_FULL >= 0x02011a */ void *sm_sasl_malloc __P((SM_SASL_SIZE_T)); static void *sm_sasl_calloc __P((SM_SASL_SIZE_T, SM_SASL_SIZE_T)); diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c index 4178245..2413281 100644 --- a/contrib/sendmail/src/savemail.c +++ b/contrib/sendmail/src/savemail.c @@ -13,7 +13,7 @@ #include <sendmail.h> -SM_RCSID("@(#)$Id: savemail.c,v 8.314 2009/12/18 17:08:01 ca Exp $") +SM_RCSID("@(#)$Id: savemail.c,v 8.315 2012/02/27 17:43:03 gshapiro Exp $") static bool errbody __P((MCI *, ENVELOPE *, char *)); static bool pruneroute __P((char *)); @@ -506,6 +506,7 @@ returntosender(msg, returnq, flags, e) int flags; register ENVELOPE *e; { + int ret; register ENVELOPE *ee; ENVELOPE *oldcur = CurEnv; ENVELOPE errenvelope; @@ -703,24 +704,35 @@ returntosender(msg, returnq, flags, e) /* actually deliver the error message */ sendall(ee, SM_DELIVER); - - /* restore state */ (void) dropenvelope(ee, true, false); - sm_rpool_free(ee->e_rpool); - CurEnv = oldcur; - returndepth--; /* check for delivery errors */ + ret = -1; if (ee->e_parent == NULL || !bitset(EF_RESPONSE, ee->e_parent->e_flags)) - return 0; - for (q = ee->e_sendqueue; q != NULL; q = q->q_next) { - if (QS_IS_ATTEMPTED(q->q_state)) - return 0; + ret = 0; } - return -1; + else + { + for (q = ee->e_sendqueue; q != NULL; q = q->q_next) + { + if (QS_IS_ATTEMPTED(q->q_state)) + { + ret = 0; + break; + } + } + } + + /* restore state */ + sm_rpool_free(ee->e_rpool); + CurEnv = oldcur; + returndepth--; + + return ret; } + /* ** ERRBODY -- output the body of an error message. ** diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h index ecb3fa3..e114019 100644 --- a/contrib/sendmail/src/sendmail.h +++ b/contrib/sendmail/src/sendmail.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2011 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2012 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -52,7 +52,7 @@ #ifdef _DEFINE # ifndef lint -SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1089 2011/03/15 23:14:36 ca Exp $"; +SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1096 2012/11/16 20:25:03 ca Exp $"; # endif /* ! lint */ #endif /* _DEFINE */ @@ -946,6 +946,8 @@ struct envelope #endif /* _FFR_MILTER_ENHSC */ }; +#define PRT_NONNEGL(v) ((v) < 0 ? LONG_MAX : (v)) + /* values for e_flags */ #define EF_OLDSTYLE 0x00000001L /* use spaces (not commas) in hdrs */ #define EF_INQUEUE 0x00000002L /* this message is fully queued */ @@ -1486,7 +1488,6 @@ struct symtab union { BITMAP256 sv_class; /* bit-map of word classes */ - ADDRESS *sv_addr; /* pointer to address header */ MAILER *sv_mailer; /* pointer to mailer */ char *sv_alias; /* alias */ MAPCLASS sv_mapclass; /* mapping function class */ @@ -1516,7 +1517,7 @@ typedef struct symtab STAB; /* symbol types */ #define ST_UNDEF 0 /* undefined type */ #define ST_CLASS 1 /* class map */ -#define ST_ADDRESS 2 /* an address in parsed format */ +/* #define ST_unused 2 UNUSED */ #define ST_MAILER 3 /* a mailer header */ #define ST_ALIAS 4 /* an alias */ #define ST_MAPCLASS 5 /* mapping function class */ @@ -1543,7 +1544,6 @@ typedef struct symtab STAB; #define ST_MCI 17 /* mailer connection info (offset) */ #define s_class s_value.sv_class -#define s_address s_value.sv_addr #define s_mailer s_value.sv_mailer #define s_alias s_value.sv_alias #define s_mci s_value.sv_mci @@ -1785,6 +1785,8 @@ struct milter char *mf_conn; /* connection info */ int mf_sock; /* connected socket */ char mf_state; /* state of filter */ + char mf_lflags; /* "local" flags */ + int mf_idx; /* milter number (index) */ time_t mf_timeout[SMFTO_NUM_TO]; /* timeouts */ #if _FFR_MILTER_CHECK /* for testing only */ @@ -1794,6 +1796,9 @@ struct milter #endif /* _FFR_MILTER_CHECK */ }; +#define MI_LFL_NONE 0x00000000 +#define MI_LFLAGS_SYM(st) (1 << (st)) /* has its own symlist for stage st */ + struct milters { mi_int32 mis_flags; /* filter flags */ @@ -2241,6 +2246,19 @@ extern unsigned char tTdvect[100]; /* trace vector */ # define CHECK_RESTART _CHECK_RESTART +#define CHK_CUR_RUNNERS(fct, idx, count) \ + do \ + { \ + if (CurRunners < 0) \ + { \ + if (LogLevel > 3) \ + sm_syslog(LOG_ERR, NOQID, \ + "%s: CurRunners=%d, i=%d, count=%d, status=should not happen", \ + fct, CurRunners, idx, count); \ + CurRunners = 0; \ + } \ + } while (0) + /* reply types (text in SmtpMsgBuffer) */ #define XS_DEFAULT 0 #define XS_STARTTLS 1 diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c index 1e6a5d2..c4c045b 100644 --- a/contrib/sendmail/src/srvrsmtp.c +++ b/contrib/sendmail/src/srvrsmtp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2010 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2010, 2012 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -17,7 +17,7 @@ # include <libmilter/mfdef.h> #endif /* MILTER */ -SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.1008 2011/01/12 23:52:59 ca Exp $") +SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.1011 2012/12/19 02:49:21 ca Exp $") #include <sm/time.h> #include <sm/fdset.h> @@ -30,6 +30,7 @@ SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.1008 2011/01/12 23:52:59 ca Exp $") static int saslmechs __P((sasl_conn_t *, char **)); #endif /* SASL */ #if STARTTLS +# include <openssl/err.h> # include <sysexits.h> static SSL_CTX *srv_ctx = NULL; /* TLS server context */ @@ -1914,11 +1915,18 @@ smtp(nullserver, d_flags, e) if (LogLevel > 5) { + unsigned long l; + const char *sr; + + l = ERR_peek_error(); + sr = ERR_reason_error_string(l); sm_syslog(LOG_WARNING, NOQID, - "STARTTLS=server, error: accept failed=%d, SSL_error=%d, errno=%d, retry=%d, relay=%.100s", - r, ssl_err, errno, i, + "STARTTLS=server, error: accept failed=%d, reason=%s, SSL_error=%d, errno=%d, retry=%d, relay=%.100s", + r, sr == NULL ? "unknown" + : sr, + ssl_err, errno, i, CurSmtpClient); - if (LogLevel > 8) + if (LogLevel > 9) tlslogerr("server"); } tls_ok_srv = false; @@ -3481,7 +3489,7 @@ smtp_data(smtp, e) collect(InChannel, true, NULL, e, true); /* redefine message size */ - (void) sm_snprintf(buf, sizeof(buf), "%ld", e->e_msgsize); + (void) sm_snprintf(buf, sizeof(buf), "%ld", PRT_NONNEGL(e->e_msgsize)); macdefine(&e->e_macro, A_TEMP, macid("{msg_size}"), buf); /* rscheck() will set Errors or EF_DISCARD if it trips */ @@ -3559,7 +3567,7 @@ smtp_data(smtp, e) } /* Milter may have changed message size */ - (void) sm_snprintf(buf, sizeof(buf), "%ld", e->e_msgsize); + (void) sm_snprintf(buf, sizeof(buf), "%ld", PRT_NONNEGL(e->e_msgsize)); macdefine(&e->e_macro, A_TEMP, macid("{msg_size}"), buf); /* abort message filters that didn't get the body & log msg is OK */ diff --git a/contrib/sendmail/src/stab.c b/contrib/sendmail/src/stab.c index 6dacdfa..1c4c0c1 100644 --- a/contrib/sendmail/src/stab.c +++ b/contrib/sendmail/src/stab.c @@ -13,7 +13,7 @@ #include <sendmail.h> -SM_RCSID("@(#)$Id: stab.c,v 8.89 2006/08/15 23:24:58 ca Exp $") +SM_RCSID("@(#)$Id: stab.c,v 8.91 2011/08/08 17:33:34 ca Exp $") /* ** STAB -- manage the symbol table @@ -65,7 +65,7 @@ stab(name, type, op) sm_dprintf("(hfunc=%d) ", hfunc); ps = &SymTab[hfunc]; - if (type == ST_MACRO || type == ST_RULESET) + if (type == ST_MACRO || type == ST_RULESET || type == ST_NAMECANON) { while ((s = *ps) != NULL && (s->s_symtype != type || strcmp(name, s->s_name))) @@ -113,10 +113,6 @@ stab(name, type, op) len = sizeof(s->s_class); break; - case ST_ADDRESS: - len = sizeof(s->s_address); - break; - case ST_MAILER: len = sizeof(s->s_mailer); break; diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c index ab491fb..9bc28ec 100644 --- a/contrib/sendmail/src/util.c +++ b/contrib/sendmail/src/util.c @@ -13,7 +13,7 @@ #include <sendmail.h> -SM_RCSID("@(#)$Id: util.c,v 8.416 2009/12/18 17:05:26 ca Exp $") +SM_RCSID("@(#)$Id: util.c,v 8.425 2012/03/03 00:10:43 ca Exp $") #include <sm/sendmail.h> #include <sysexits.h> @@ -2638,7 +2638,13 @@ proc_list_drop(pid, st, other) mark_work_group_restart(ProcListVec[i].proc_other, st); } else if (type == PROC_QUEUE) + { CurRunners -= ProcListVec[i].proc_count; + + /* CHK_CUR_RUNNERS() can't be used here: uses syslog() */ + if (CurRunners < 0) + CurRunners = 0; + } } /* @@ -2702,6 +2708,14 @@ proc_list_probe() (int) ProcListVec[i].proc_pid); ProcListVec[i].proc_pid = NO_PID; SM_FREE_CLR(ProcListVec[i].proc_task); + + if (ProcListVec[i].proc_type == PROC_QUEUE) + { + CurRunners -= ProcListVec[i].proc_count; + CHK_CUR_RUNNERS("proc_list_probe", i, + ProcListVec[i].proc_count); + } + CurChildren--; } else @@ -2852,3 +2866,4 @@ count_open_connections(hostaddr) } return n; } + diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c index 4f156c2..2e9fe48 100644 --- a/contrib/sendmail/src/version.c +++ b/contrib/sendmail/src/version.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2011 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2012 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -13,6 +13,6 @@ #include <sm/gen.h> -SM_RCSID("@(#)$Id: version.c,v 8.227 2011/04/26 23:02:35 ca Exp $") +SM_RCSID("@(#)$Id: version.c,v 8.235 2012/12/19 05:11:44 ca Exp $") -char Version[] = "8.14.5"; +char Version[] = "8.14.6"; diff --git a/crypto/openssl/crypto/bn/bn_word.c b/crypto/openssl/crypto/bn/bn_word.c index ee7b87c..de83a15 100644 --- a/crypto/openssl/crypto/bn/bn_word.c +++ b/crypto/openssl/crypto/bn/bn_word.c @@ -144,26 +144,17 @@ int BN_add_word(BIGNUM *a, BN_ULONG w) a->neg=!(a->neg); return(i); } - /* Only expand (and risk failing) if it's possibly necessary */ - if (((BN_ULONG)(a->d[a->top - 1] + 1) == 0) && - (bn_wexpand(a,a->top+1) == NULL)) - return(0); - i=0; - for (;;) + for (i=0;w!=0 && i<a->top;i++) { - if (i >= a->top) - l=w; - else - l=(a->d[i]+w)&BN_MASK2; - a->d[i]=l; - if (w > l) - w=1; - else - break; - i++; + a->d[i] = l = (a->d[i]+w)&BN_MASK2; + w = (w>l)?1:0; } - if (i >= a->top) + if (w && i==a->top) + { + if (bn_wexpand(a,a->top+1) == NULL) return 0; a->top++; + a->d[i]=w; + } bn_check_top(a); return(1); } diff --git a/crypto/openssl/crypto/opensslv.h b/crypto/openssl/crypto/opensslv.h index ec87545..6f412b6 100644 --- a/crypto/openssl/crypto/opensslv.h +++ b/crypto/openssl/crypto/opensslv.h @@ -29,7 +29,7 @@ #ifdef OPENSSL_FIPS #define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c-fips 10 May 2012" #else -#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c 10 May 2012" +#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.1c-freebsd 10 May 2012" #endif #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT diff --git a/etc/mtree/BSD.var.dist b/etc/mtree/BSD.var.dist index 30b901d..6a9a7f4 100644 --- a/etc/mtree/BSD.var.dist +++ b/etc/mtree/BSD.var.dist @@ -18,11 +18,11 @@ /set mode=0750 /set gname=audit audit - .. dist uname=auditdistd gname=audit mode=0770 .. remote uname=auditdistd gname=wheel mode=0700 .. + .. /set gname=wheel backups .. diff --git a/etc/namedb/named.root b/etc/namedb/named.root index 1c8facf..adf5e79 100644 --- a/etc/namedb/named.root +++ b/etc/namedb/named.root @@ -7,14 +7,14 @@ ; (e.g. reference this file in the "cache . <file>" ; configuration file of BIND domain name servers). ; -; This file is made available by InterNIC +; This file is made available by InterNIC ; under anonymous FTP as -; file /domain/named.root +; file /domain/named.cache ; on server FTP.INTERNIC.NET ; -OR- RS.INTERNIC.NET ; -; last update: Jun 8, 2011 -; related version of root zone: 2011060800 +; last update: Jan 3, 2013 +; related version of root zone: 2013010300 ; ; formerly NS.INTERNIC.NET ; @@ -35,7 +35,7 @@ C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12 ; FORMERLY TERP.UMD.EDU ; . 3600000 NS D.ROOT-SERVERS.NET. -D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90 +D.ROOT-SERVERS.NET. 3600000 A 199.7.91.13 D.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2D::D ; ; FORMERLY NS.NASA.GOV diff --git a/etc/sendmail/freebsd.mc b/etc/sendmail/freebsd.mc index 1e28c47..92efee1 100644 --- a/etc/sendmail/freebsd.mc +++ b/etc/sendmail/freebsd.mc @@ -63,13 +63,13 @@ dnl DNS based black hole lists dnl -------------------------------- dnl DNS based black hole lists come and go on a regular basis dnl so this file will not serve as a database of the available servers. -dnl For that, visit -dnl http://www.google.com/Top/Computers/Internet/E-mail/Spam/Blacklists/ +dnl For more information, visit +dnl http://en.wikipedia.org/wiki/DNSBL dnl Uncomment to activate your chosen DNS based blacklist dnl FEATURE(dnsbl, `dnsbl.example.com') dnl Alternatively, you can provide your own server and rejection message: -dnl FEATURE(dnsbl, `dnsbl.example.com', ``"550 Mail from " $&{client_addr} " rejected'') +dnl FEATURE(dnsbl, `dnsbl.example.com', ``"550 Mail from " $&{client_addr} " rejected"'') dnl Dialup users should uncomment and define this appropriately dnl define(`SMART_HOST', `your.isp.mail.server') diff --git a/etc/sendmail/freebsd.submit.mc b/etc/sendmail/freebsd.submit.mc index c6ec655..fbb036c 100644 --- a/etc/sendmail/freebsd.submit.mc +++ b/etc/sendmail/freebsd.submit.mc @@ -9,6 +9,7 @@ divert(-1) # # + # # This is the FreeBSD configuration for a set-group-ID sm-msp sendmail # that acts as a initial mail submission program. diff --git a/etc/sendmail/freefall.mc b/etc/sendmail/freefall.mc index 74bc0f5..df07fea 100644 --- a/etc/sendmail/freefall.mc +++ b/etc/sendmail/freefall.mc @@ -43,5 +43,5 @@ divert(0)dnl VERSIONID(`$FreeBSD$') OSTYPE(freebsd6) -FEATURE(nullclient, smarthost.ysv.$m) +FEATURE(nullclient, smarthost.ysv.freebsd.org) MASQUERADE_AS(FreeBSD.org) diff --git a/gnu/lib/libdialog/dlg_config.h b/gnu/lib/libdialog/dlg_config.h index 3c73213..4dd6ab4 100644 --- a/gnu/lib/libdialog/dlg_config.h +++ b/gnu/lib/libdialog/dlg_config.h @@ -5,11 +5,9 @@ * $FreeBSD$ */ -#define CURSES_WACS_ARRAY _nc_wacs -#define DIALOG_PATCHDATE 20120706 +#define DIALOG_PATCHDATE 20100428 #define DIALOG_VERSION "1.1" #define HAVE_ALLOCA 1 -#define HAVE_BTOWC 1 #define HAVE_COLOR 1 #define HAVE_DIRENT_H 1 #define HAVE_DLG_FORMBOX 1 @@ -20,7 +18,6 @@ #define HAVE_FEOF_UNLOCKED 1 #define HAVE_FLUSHINP 1 #define HAVE_FSEEKO 1 -#define HAVE_GETATTRS 1 #define HAVE_GETBEGX 1 #define HAVE_GETBEGY 1 #define HAVE_GETBEGYX 1 @@ -42,18 +39,14 @@ #define HAVE_INTTYPES_H 1 #define HAVE_LANGINFO_CODESET 1 #define HAVE_LC_MESSAGES 1 +#define HAVE_LIBNCURSESW 1 #define HAVE_LIMITS_H 1 #define HAVE_LOCALE_H 1 -#define HAVE_MBLEN 1 -#define HAVE_MBRLEN 1 -#define HAVE_MBRTOWC 1 #define HAVE_MBSTATE_T 1 -#define HAVE_MBTOWC 1 #define HAVE_MEMORY_H 1 #define HAVE_MIXEDGAUGE 1 #define HAVE_MMAP 1 #define HAVE_MUNMAP 1 -#define HAVE_NCURSES_H 1 #define HAVE_NL_TYPES_H 1 #define HAVE_PUTENV 1 #define HAVE_RC_FILE 1 @@ -82,12 +75,7 @@ #define HAVE_UNISTD_H 1 #define HAVE_USE_DEFAULT_COLORS 1 #define HAVE_WAITPID 1 -#define HAVE_WCHGAT 1 -#define HAVE_WCSRTOMBS 1 -#define HAVE_WCSTOMBS 1 -#define HAVE_WCTOB 1 -#define HAVE_WCTOMB 1 -#define HAVE_WGETPARENT 1 +#define HAVE_WGET_WCH 1 #define HAVE_XDIALOG 1 #define HAVE__NC_FREE_AND_EXIT 1 #define ICONV_CONST const @@ -97,6 +85,7 @@ #define PACKAGE "dialog" #define RETSIGTYPE void #define STDC_HEADERS 1 -#define SYSTEM_NAME "freebsd10.0" +#define SYSTEM_NAME "freebsd9.0" #define TIME_WITH_SYS_TIME 1 #define TYPE_CHTYPE_IS_SCALAR 1 +#define USE_WIDE_CURSES 1 diff --git a/gnu/usr.bin/binutils/ld/armelf_fbsd.sh b/gnu/usr.bin/binutils/ld/armelf_fbsd.sh index a7f4740..0f888b0 100644 --- a/gnu/usr.bin/binutils/ld/armelf_fbsd.sh +++ b/gnu/usr.bin/binutils/ld/armelf_fbsd.sh @@ -1,6 +1,7 @@ # $FreeBSD$ . ${srcdir}/emulparams/armelf.sh . ${srcdir}/emulparams/elf_fbsd.sh +TARGET2_TYPE=got-rel MAXPAGESIZE=0x8000 GENERATE_PIE_SCRIPT=yes diff --git a/gnu/usr.bin/binutils/ld/armelfb_fbsd.sh b/gnu/usr.bin/binutils/ld/armelfb_fbsd.sh index 72aae15..39364ef 100644 --- a/gnu/usr.bin/binutils/ld/armelfb_fbsd.sh +++ b/gnu/usr.bin/binutils/ld/armelfb_fbsd.sh @@ -5,6 +5,7 @@ #OUTPUT_FORMAT="elf32-bigarm" . ${srcdir}/emulparams/armelf.sh . ${srcdir}/emulparams/elf_fbsd.sh +TARGET2_TYPE=got-rel MAXPAGESIZE=0x8000 GENERATE_PIE_SCRIPT=yes diff --git a/gnu/usr.bin/dialog/Makefile b/gnu/usr.bin/dialog/Makefile index 9b60974..e945b22 100644 --- a/gnu/usr.bin/dialog/Makefile +++ b/gnu/usr.bin/dialog/Makefile @@ -3,7 +3,7 @@ DIALOG= ${.CURDIR}/../../../contrib/dialog PROG= dialog -DPADD= ${LIBDIALOG} ${LIBNCURSES} ${LIBM} +DPADD= ${LIBDIALOG} ${LIBNCURSESW} ${LIBM} LDADD= -ldialog -lncursesw -lm CFLAGS+= -I${.CURDIR} -I${DIALOG} .PATH: ${DIALOG} diff --git a/lib/Makefile b/lib/Makefile index 6e1a402..3dd274e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -69,7 +69,6 @@ SUBDIR= ${SUBDIR_ORDERED} \ libcompat \ libdevinfo \ libdevstat \ - libdisk \ libdwarf \ libedit \ ${_libefi} \ diff --git a/lib/csu/amd64/crt1.c b/lib/csu/amd64/crt1.c index f33aad6..3740e73 100644 --- a/lib/csu/amd64/crt1.c +++ b/lib/csu/amd64/crt1.c @@ -61,9 +61,7 @@ _start(char **ap, void (*cleanup)(void)) argc = *(long *)(void *)ap; argv = ap + 1; env = ap + 2 + argc; - environ = env; - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); diff --git a/lib/csu/arm/crt1.c b/lib/csu/arm/crt1.c index 127c28d..e3529b8 100644 --- a/lib/csu/arm/crt1.c +++ b/lib/csu/arm/crt1.c @@ -98,10 +98,7 @@ __start(int argc, char **argv, char **env, struct ps_strings *ps_strings, const struct Struct_Obj_Entry *obj __unused, void (*cleanup)(void)) { - environ = env; - - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; diff --git a/lib/csu/common/ignore_init.c b/lib/csu/common/ignore_init.c index e3d2441..89b3734 100644 --- a/lib/csu/common/ignore_init.c +++ b/lib/csu/common/ignore_init.c @@ -87,14 +87,18 @@ handle_static_init(int argc, char **argv, char **env) } static inline void -handle_progname(const char *v) +handle_argv(int argc, char *argv[], char **env) { const char *s; - __progname = v; - for (s = __progname; *s != '\0'; s++) { - if (*s == '/') - __progname = s + 1; + if (environ == NULL) + environ = env; + if (argc > 0 && argv[0] != NULL) { + __progname = argv[0]; + for (s = __progname; *s != '\0'; s++) { + if (*s == '/') + __progname = s + 1; + } } } diff --git a/lib/csu/i386-elf/crt1_c.c b/lib/csu/i386-elf/crt1_c.c index 3249069..65de04c 100644 --- a/lib/csu/i386-elf/crt1_c.c +++ b/lib/csu/i386-elf/crt1_c.c @@ -61,10 +61,7 @@ _start1(fptr cleanup, int argc, char *argv[]) char **env; env = argv + argc + 1; - environ = env; - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); - + handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); else diff --git a/lib/csu/mips/crt1.c b/lib/csu/mips/crt1.c index 1968f06..95348b7 100644 --- a/lib/csu/mips/crt1.c +++ b/lib/csu/mips/crt1.c @@ -71,9 +71,7 @@ __start(char **ap, argc = * (long *) ap; argv = ap + 1; env = ap + 2 + argc; - environ = env; - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); diff --git a/lib/csu/powerpc/crt1.c b/lib/csu/powerpc/crt1.c index c3be90d..d1a3ea0 100644 --- a/lib/csu/powerpc/crt1.c +++ b/lib/csu/powerpc/crt1.c @@ -81,10 +81,8 @@ _start(int argc, char **argv, char **env, struct ps_strings *ps_strings) { - environ = env; - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; diff --git a/lib/csu/powerpc64/crt1.c b/lib/csu/powerpc64/crt1.c index a7c3581..35c5a6e 100644 --- a/lib/csu/powerpc64/crt1.c +++ b/lib/csu/powerpc64/crt1.c @@ -81,10 +81,7 @@ _start(int argc, char **argv, char **env, struct ps_strings *ps_strings) { - environ = env; - - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (ps_strings != (struct ps_strings *)0) __ps_strings = ps_strings; diff --git a/lib/csu/sparc64/crt1.c b/lib/csu/sparc64/crt1.c index 3b3ecc2..e11ae39 100644 --- a/lib/csu/sparc64/crt1.c +++ b/lib/csu/sparc64/crt1.c @@ -85,9 +85,7 @@ _start(char **ap, void (*cleanup)(void), struct Struct_Obj_Entry *obj __unused, argc = *(long *)(void *)ap; argv = ap + 1; env = ap + 2 + argc; - environ = env; - if (argc > 0 && argv[0] != NULL) - handle_progname(argv[0]); + handle_argv(argc, argv, env); if (&_DYNAMIC != NULL) atexit(cleanup); diff --git a/lib/libbsnmp/libbsnmp/Makefile b/lib/libbsnmp/libbsnmp/Makefile index f21f1d3..20015b9 100644 --- a/lib/libbsnmp/libbsnmp/Makefile +++ b/lib/libbsnmp/libbsnmp/Makefile @@ -15,6 +15,7 @@ CFLAGS+= -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DQUADFMT='"llu"' -DQUADXFMT='"llx"' .if ${MK_OPENSSL} != "no" CFLAGS+= -DHAVE_LIBCRYPTO +DPADD+= ${LIBCRYPTO} LDADD+= -lcrypto .endif diff --git a/lib/libc/arm/softfloat/arm-gcc.h b/lib/libc/arm/softfloat/arm-gcc.h index 1204108..15bc509 100644 --- a/lib/libc/arm/softfloat/arm-gcc.h +++ b/lib/libc/arm/softfloat/arm-gcc.h @@ -95,7 +95,7 @@ what the endianness of the CPU. VFP is sane. #define FLOAT64_DEMANGLE(a) (a) #define FLOAT64_MANGLE(a) (a) #else -#define FLOAT64_DEMANGLE(a) (((a) << 32) | ((a) >> 32)) +#define FLOAT64_DEMANGLE(a) ((((a) & 0xfffffffful) << 32) | ((a) >> 32)) #define FLOAT64_MANGLE(a) FLOAT64_DEMANGLE(a) #endif #endif diff --git a/lib/libc/nls/Makefile.inc b/lib/libc/nls/Makefile.inc index f5c6885..962d16b 100644 --- a/lib/libc/nls/Makefile.inc +++ b/lib/libc/nls/Makefile.inc @@ -36,3 +36,6 @@ NLS+= ru_RU.KOI8-R NLS+= sk_SK.ISO8859-2 NLS+= sv_SE.ISO8859-1 NLS+= uk_UA.UTF-8 +NLS+= zh_CN.GB18030 +NLS+= zh_CN.GB2312 +NLS+= zh_CN.UTF-8 diff --git a/lib/libc/nls/zh_CN.GB18030.msg b/lib/libc/nls/zh_CN.GB18030.msg new file mode 100644 index 0000000..0e35d7e --- /dev/null +++ b/lib/libc/nls/zh_CN.GB18030.msg @@ -0,0 +1,297 @@ +$ $FreeBSD$ +$ +$ Message catalog for zh_CN.GB18030 locale +$ +$ Derived from FreeBSD: head/lib/libc/nls/zh_CN.UTF-8.msg 244756 2012-12-28 01:09:30Z delphij +$ +$ strerror() support catalog +$ +$set 1 +$ EPERM +1 ²»ÔÊÐíµÄ²Ù×÷ +$ ENOENT +2 Îļþ»òĿ¼²»´æÔÚ +$ ESRCH +3 ½ø³Ì²»´æÔÚ +$ EINTR +4 ϵͳµ÷ÓÃÖÐÖ¹ +$ EIO +5 ÊäÈë/Êä³ö´íÎó +$ ENXIO +6 δÅäÖõÄÉ豸 +$ E2BIG +7 ²ÎÊý±í¹ý³¤ +$ ENOEXEC +8 ¿ÉÖ´ÐÐÎļþ¸ñʽ´íÎó +$ EBADF +9 ÎļþÃèÊö·ûÎÞЧ +$ ECHILD +10 Ö¸¶¨×Ó½ø³Ì²»´æÔÚ +$ EDEADLK +11 ´Ë²Ù×÷»áµ¼ÖÂËÀËø +$ ENOMEM +12 ÎÞ·¨·ÖÅäÄÚ´æ +$ EACCES +13 ¾Ü¾ø·ÃÎÊ +$ EFAULT +14 ÎÞЧµØÖ· +$ ENOTBLK +15 ¸Ã²Ù×÷ÐèÒª¿éÉ豸 +$ EBUSY +16 É豸ʹÓÃÖÐ +$ EEXIST +17 ÎļþÒÑ´æÔÚ +$ EXDEV +18 Á´½Ó¿çÉ豸 +$ ENODEV +19 É豸²»Ö§³Ö´Ë²Ù×÷ +$ ENOTDIR +20 ¶ÔÏó·ÇĿ¼ +$ EISDIR +21 ¶ÔÏóΪĿ¼ +$ EINVAL +22 ²ÎÊýÎÞЧ +$ ENFILE +23 ϵͳ´ò¿ªÎļþ¹ý¶à +$ EMFILE +24 ½ø³Ì´ò¿ªÎļþ¹ý¶à +$ ENOTTY +25 ÎÞЧÉ豸 ioctl +$ ETXTBSY +26 ¿ÉÖ´ÐÐÎļþæ +$ EFBIG +27 Îļþ¹ý´ó +$ ENOSPC +28 É豸ÎÞ¿ÉÓÿռä +$ ESPIPE +29 ²»ÔÊÐíÖ´ÐÐ seek ²Ù×÷ +$ EROFS +30 Îļþϵͳֻ¶Á +$ EMLINK +31 ÎļþÁ´½Ó¹ý¶à +$ EPIPE +32 ¹ÜµÀÒÑÖÐÖ¹ +$ EDOM +33 ÊýÖµ²ÎÊýÔ½½ç +$ ERANGE +34 ½á¹û¹ý´ó +$ EAGAIN, EWOULDBLOCK +35 ×ÊÔ´ÔÝʱ²»¿ÉÓà +$ EINPROGRESS +36 ²Ù×÷½øÐÐÖÐ +$ EALREADY +37 ²Ù×÷ÒÑ¿ªÊ¼ +$ ENOTSOCK +38 ³¢ÊÔÔÚ·Ç socket ÉÏÖ´ÐÐ socket ²Ù×÷ +$ EDESTADDRREQ +39 ÐèҪĿµÄµØÖ· +$ EMSGSIZE +40 ÏûÏ¢¹ý³¤ +$ EPROTOTYPE +41 socketÐÒéÀàÐÍ´íÎó +$ ENOPROTOOPT +42 ÐÒé²»¿ÉÓà +$ EPROTONOSUPPORT +43 ²»Ö§³ÖµÄÐÒé +$ ESOCKTNOSUPPORT +44 ²»Ö§³ÖµÄ socket ÀàÐÍ +$ EOPNOTSUPP +45 ²»Ö§³ÖµÄ²Ù×÷ +$ EPFNOSUPPORT +46 ²»Ö§³ÖµÄÐÒé×å +$ EAFNOSUPPORT +47 ÐÒé×å²»Ö§³ÖµÄµØÖ·×å +$ EADDRINUSE +48 µØÖ·Òѱ»Õ¼Óà +$ EADDRNOTAVAIL +49 ÎÞ·¨Ö¸¶¨ÇëÇóµÄµØÖ· +$ ENETDOWN +50 ÍøÂçÒÑ¹Ø±Õ +$ ENETUNREACH +51 ÍøÂç²»¿É´ï +$ ENETRESET +52 ¸´Î»µ¼ÖÂÍøÂçÁ¬½Ó¶ªÊ§ +$ ECONNABORTED +53 Èí¼þµ¼ÖµÄÁ¬½ÓÖÐÖ¹ +$ ECONNRESET +54 ¶Ô·½¸´Î»ÁËÁ¬½Ó +$ ENOBUFS +55 »º³åÇø¿Õ¼ä²»×ã +$ EISCONN +56 socket ÒÑÁ¬½Ó +$ ENOTCONN +57 socket δÁ¬½Ó +$ ESHUTDOWN +58 socket shutdown Ö®ºóÎÞ·¨·¢ËÍÊý¾Ý +$ ETOOMANYREFS +59 ÒýÓÃÊý¹ý¶à£ºÎÞ·¨Æ´½Ó +$ ETIMEDOUT +60 ²Ù×÷³¬Ê± +$ ECONNREFUSED +61 ¾Ü¾øÁ¬½Ó +$ ELOOP +62 ·ûºÅÁ´½Ó²ãÊý¹ý¶à +$ ENAMETOOLONG +63 ÎļþÃû¹ý³¤ +$ EHOSTDOWN +64 Ö÷»úÒÑ¹Ø±Õ +$ EHOSTUNREACH +65 ûÓе½Ö÷»úµÄ·ÓÉ +$ ENOTEMPTY +66 Ŀ¼·Ç¿Õ +$ EPROCLIM +67 ½ø³ÌÊý³¬ÏÞ +$ EUSERS +68 Óû§Êý³¬ÏÞ +$ EDQUOT +69 ´ÅÅÌ¿Õ¼äÅä¶î³¬ÏÞ +$ ESTALE +70 NFS Îļþ¾ä±úÒÑʧЧ +$ EREMOTE +71 Ô¶³ÌĿ¼²ãÊý¹ý¶à +$ EBADRPC +72 RPC ½á¹¹ÎÞЧ +$ ERPCMISMATCH +73 RPC °æ±¾´íÎó +$ EPROGUNAVAIL +74 RPC ³ÌÐò²»¿ÉÓà +$ EPROGMISMATCH +75 ³ÌÐò°æ±¾´íÎó +$ EPROCUNAVAIL +76 δÌṩµÄÔ¶³Ìº¯Êý +$ ENOLCK +77 ²»Ö§³ÖËø +$ ENOSYS +78 ¹¦ÄÜδʵÏÖ +$ EFTYPE +79 ÎļþÀàÐÍ»ò¸ñʽÎÞЧ +$ EAUTH +80 Éí·ÝÎÞЧ +$ ENEEDAUTH +81 ÎÞÐÅÈÎƾ¾Ý +$ EIDRM +82 ÎÞ±êʶ·û +$ ENOMSG +83 ÎÞÏûÏ¢ÀàÐÍ +$ EOVERFLOW +84 ÊýÖµÒç³ö +$ ECANCELED +85 ²Ù×÷ÒÑÈ¡Ïû +$ EILSEQ +86 ÎÞЧ×Ö·ûÐòÁÐ +$ ENOATTR +87 ÎÞÀ©Õ¹ÊôÐÔ +$ EDOOFUS +88 ³ÌÐòÉè¼Æ´íÎó +$ EBADMSG +89 ÎÞЧÏûÏ¢ +$ EMULTIHOP +90 Multihop attempted +$ ENOLINK +91 Link has been severed +$ EPROTO +92 ÐÒé´íÎó +$ ENOTCAPABLE +93 ȨÄܲ»×ã +$ +$ strsignal() support catalog +$ +$set 2 +$ SIGHUP +1 ÖÕ¶ËÏß·¹Ò¶Ï +$ SIGINT +2 ÖÐ¶Ï +$ SIGQUIT +3 Í˳ö +$ SIGILL +4 ÎÞЧָÁî +$ SIGTRAP +5 ¸ú×Ù/BPT ÏÝÚå +$ SIGABRT +6 ÖÕÖ¹ÏÝÚå +$ SIGEMT +7 EMT ÏÝÚå +$ SIGFPE +8 ¸¡µãÒì³£ +$ SIGKILL +9 Ç¿ÖÆÖÕÖ¹½ø³Ì +$ SIGBUS +10 ϵͳÄÚ´æ·ÃÎÊÔ½½ç +$ SIGSEGV +11 ÄÚ´æ·ÃÎÊÔ½½ç +$ SIGSYS +12 ÎÞЧϵͳµ÷Óà +$ SIGPIPE +13 д¹ÜµÀʱ¶ÁÈ¡Õß²»´æÔÚ +$ SIGALRM +14 ʵʱµ¹¼Æʱµ½ÆÚ +$ SIGTERM +15 ÖÕÖ¹ +$ SIGURG +16 ÐèÁ¢¼´´¦ÀíµÄ I/O ½ô¼±×´¿ö +$ SIGSTOP +17 ¹ÒÆð (ÐźÅ) +$ SIGTSTP +18 ¹ÒÆð +$ SIGCONT +19 ¼ÌÐøÔËÐÐ +$ SIGCHLD +20 ×Ó½ø³ÌÖÕÖ¹ +$ SIGTTIN +21 TTY ÊäÈë×èÈû +$ SIGTTOU +22 TTY Êä³ö×èÈû +$ SIGIO +23 I/O ¾ÍÐ÷ +$ SIGXCPU +24 CPU ʹÓÃʱ¼ä¹ý³¤ +$ SIGXFSZ +25 Îļþ³ß´ç¹ý´ó +$ SIGVTALRM +26 ÐéÄâµ¹¼Æʱµ½ÆÚ +$ SIGPROF +27 ÆÊÎöµ¹¼Æʱµ½ÆÚ +$ SIGWINCH +28 ´°¿Ú³ß´ç±ä»¯ +$ SIGINFO +29 ÇëÇóÐÅÏ¢ +$ SIGUSR1 +30 Óû§×Ô¶¨ÒåÐźŠ1 +$ SIGUSR2 +31 Óû§×Ô¶¨ÒåÐźŠ2 +$ +$ gai_strerror() support catalog +$ +$set 3 +$ 1 (obsolete) +1 Ö÷»úÃûʹÓÃÁ˲»Ö§³ÖµÄµØÖ·ÀàÐÍ +$ EAI_AGAIN +2 ÔÝʱÎÞ·¨½âÎöÃû³Æ +$ EAI_BADFLAGS +3 ÎÞЧµÄ ai_flags Öµ +$ EAI_FAIL +4 ½âÎöÃû³Æʱ³öÏÖÎÞ·¨»Ö¸´µÄ´íÎó +$ EAI_FAMILY +5 ²»Ö§³ÖµÄµØÖ·ÐÅÏ¢ÀàÐÍ +$ EAI_MEMORY +6 ÄÚ´æ·ÖÅäʧ°Ü +$ 7 (obsolete) +7 Ö÷»úÃûÎÞÏà¹ØÁªµÄµØÖ· +$ EAI_NONAME +8 δ֪µÄÖ÷»úÃû»ò·þÎñÃû +$ EAI_SERVICE +9 Ì×½Ó×ÖÀàÐͲ»Ö§³Ö´Ë·þÎñÃû +$ EAI_SOCKTYPE +10 ²»Ö§³ÖµÄÌ×½Ó×ÖÀàÐÍ +$ EAI_SYSTEM +11 ϵͳµ÷Ó÷µ»ØÁË errno ´íÎó +$ EAI_BADHINTS +12 ÎÞЧÌáʾ²ÎÊý +$ EAI_PROTOCOL +13 δ֪ÐÒé +$ EAI_OVERFLOW +14 ²ÎÊý»º³åÒç³ö +$ 0 +32766 ³É¹¦ +$ NL_MSGMAX +32767 δ֪´íÎó diff --git a/lib/libc/nls/zh_CN.GB2312.msg b/lib/libc/nls/zh_CN.GB2312.msg new file mode 100644 index 0000000..46ebb42 --- /dev/null +++ b/lib/libc/nls/zh_CN.GB2312.msg @@ -0,0 +1,297 @@ +$ $FreeBSD$ +$ +$ Message catalog for zh_CN.GB2312 locale +$ +$ Derived from FreeBSD: head/lib/libc/nls/zh_CN.UTF-8.msg 244756 2012-12-28 01:09:30Z delphij +$ +$ strerror() support catalog +$ +$set 1 +$ EPERM +1 ²»ÔÊÐíµÄ²Ù×÷ +$ ENOENT +2 Îļþ»òĿ¼²»´æÔÚ +$ ESRCH +3 ½ø³Ì²»´æÔÚ +$ EINTR +4 ϵͳµ÷ÓÃÖÐÖ¹ +$ EIO +5 ÊäÈë/Êä³ö´íÎó +$ ENXIO +6 δÅäÖõÄÉ豸 +$ E2BIG +7 ²ÎÊý±í¹ý³¤ +$ ENOEXEC +8 ¿ÉÖ´ÐÐÎļþ¸ñʽ´íÎó +$ EBADF +9 ÎļþÃèÊö·ûÎÞЧ +$ ECHILD +10 Ö¸¶¨×Ó½ø³Ì²»´æÔÚ +$ EDEADLK +11 ´Ë²Ù×÷»áµ¼ÖÂËÀËø +$ ENOMEM +12 ÎÞ·¨·ÖÅäÄÚ´æ +$ EACCES +13 ¾Ü¾ø·ÃÎÊ +$ EFAULT +14 ÎÞЧµØÖ· +$ ENOTBLK +15 ¸Ã²Ù×÷ÐèÒª¿éÉ豸 +$ EBUSY +16 É豸ʹÓÃÖÐ +$ EEXIST +17 ÎļþÒÑ´æÔÚ +$ EXDEV +18 Á´½Ó¿çÉ豸 +$ ENODEV +19 É豸²»Ö§³Ö´Ë²Ù×÷ +$ ENOTDIR +20 ¶ÔÏó·ÇĿ¼ +$ EISDIR +21 ¶ÔÏóΪĿ¼ +$ EINVAL +22 ²ÎÊýÎÞЧ +$ ENFILE +23 ϵͳ´ò¿ªÎļþ¹ý¶à +$ EMFILE +24 ½ø³Ì´ò¿ªÎļþ¹ý¶à +$ ENOTTY +25 ÎÞЧÉ豸 ioctl +$ ETXTBSY +26 ¿ÉÖ´ÐÐÎļþæ +$ EFBIG +27 Îļþ¹ý´ó +$ ENOSPC +28 É豸ÎÞ¿ÉÓÿռä +$ ESPIPE +29 ²»ÔÊÐíÖ´ÐÐ seek ²Ù×÷ +$ EROFS +30 Îļþϵͳֻ¶Á +$ EMLINK +31 ÎļþÁ´½Ó¹ý¶à +$ EPIPE +32 ¹ÜµÀÒÑÖÐÖ¹ +$ EDOM +33 ÊýÖµ²ÎÊýÔ½½ç +$ ERANGE +34 ½á¹û¹ý´ó +$ EAGAIN, EWOULDBLOCK +35 ×ÊÔ´ÔÝʱ²»¿ÉÓà +$ EINPROGRESS +36 ²Ù×÷½øÐÐÖÐ +$ EALREADY +37 ²Ù×÷ÒÑ¿ªÊ¼ +$ ENOTSOCK +38 ³¢ÊÔÔÚ·Ç socket ÉÏÖ´ÐÐ socket ²Ù×÷ +$ EDESTADDRREQ +39 ÐèҪĿµÄµØÖ· +$ EMSGSIZE +40 ÏûÏ¢¹ý³¤ +$ EPROTOTYPE +41 socketÐÒéÀàÐÍ´íÎó +$ ENOPROTOOPT +42 ÐÒé²»¿ÉÓà +$ EPROTONOSUPPORT +43 ²»Ö§³ÖµÄÐÒé +$ ESOCKTNOSUPPORT +44 ²»Ö§³ÖµÄ socket ÀàÐÍ +$ EOPNOTSUPP +45 ²»Ö§³ÖµÄ²Ù×÷ +$ EPFNOSUPPORT +46 ²»Ö§³ÖµÄÐÒé×å +$ EAFNOSUPPORT +47 ÐÒé×å²»Ö§³ÖµÄµØÖ·×å +$ EADDRINUSE +48 µØÖ·Òѱ»Õ¼Óà +$ EADDRNOTAVAIL +49 ÎÞ·¨Ö¸¶¨ÇëÇóµÄµØÖ· +$ ENETDOWN +50 ÍøÂçÒÑ¹Ø±Õ +$ ENETUNREACH +51 ÍøÂç²»¿É´ï +$ ENETRESET +52 ¸´Î»µ¼ÖÂÍøÂçÁ¬½Ó¶ªÊ§ +$ ECONNABORTED +53 Èí¼þµ¼ÖµÄÁ¬½ÓÖÐÖ¹ +$ ECONNRESET +54 ¶Ô·½¸´Î»ÁËÁ¬½Ó +$ ENOBUFS +55 »º³åÇø¿Õ¼ä²»×ã +$ EISCONN +56 socket ÒÑÁ¬½Ó +$ ENOTCONN +57 socket δÁ¬½Ó +$ ESHUTDOWN +58 socket shutdown Ö®ºóÎÞ·¨·¢ËÍÊý¾Ý +$ ETOOMANYREFS +59 ÒýÓÃÊý¹ý¶à£ºÎÞ·¨Æ´½Ó +$ ETIMEDOUT +60 ²Ù×÷³¬Ê± +$ ECONNREFUSED +61 ¾Ü¾øÁ¬½Ó +$ ELOOP +62 ·ûºÅÁ´½Ó²ãÊý¹ý¶à +$ ENAMETOOLONG +63 ÎļþÃû¹ý³¤ +$ EHOSTDOWN +64 Ö÷»úÒÑ¹Ø±Õ +$ EHOSTUNREACH +65 ûÓе½Ö÷»úµÄ·ÓÉ +$ ENOTEMPTY +66 Ŀ¼·Ç¿Õ +$ EPROCLIM +67 ½ø³ÌÊý³¬ÏÞ +$ EUSERS +68 Óû§Êý³¬ÏÞ +$ EDQUOT +69 ´ÅÅÌ¿Õ¼äÅä¶î³¬ÏÞ +$ ESTALE +70 NFS Îļþ¾ä±úÒÑʧЧ +$ EREMOTE +71 Ô¶³ÌĿ¼²ãÊý¹ý¶à +$ EBADRPC +72 RPC ½á¹¹ÎÞЧ +$ ERPCMISMATCH +73 RPC °æ±¾´íÎó +$ EPROGUNAVAIL +74 RPC ³ÌÐò²»¿ÉÓà +$ EPROGMISMATCH +75 ³ÌÐò°æ±¾´íÎó +$ EPROCUNAVAIL +76 δÌṩµÄÔ¶³Ìº¯Êý +$ ENOLCK +77 ²»Ö§³ÖËø +$ ENOSYS +78 ¹¦ÄÜδʵÏÖ +$ EFTYPE +79 ÎļþÀàÐÍ»ò¸ñʽÎÞЧ +$ EAUTH +80 Éí·ÝÎÞЧ +$ ENEEDAUTH +81 ÎÞÐÅÈÎƾ¾Ý +$ EIDRM +82 ÎÞ±êʶ·û +$ ENOMSG +83 ÎÞÏûÏ¢ÀàÐÍ +$ EOVERFLOW +84 ÊýÖµÒç³ö +$ ECANCELED +85 ²Ù×÷ÒÑÈ¡Ïû +$ EILSEQ +86 ÎÞЧ×Ö·ûÐòÁÐ +$ ENOATTR +87 ÎÞÀ©Õ¹ÊôÐÔ +$ EDOOFUS +88 ³ÌÐòÉè¼Æ´íÎó +$ EBADMSG +89 ÎÞЧÏûÏ¢ +$ EMULTIHOP +90 Multihop attempted +$ ENOLINK +91 Link has been severed +$ EPROTO +92 ÐÒé´íÎó +$ ENOTCAPABLE +93 ȨÄܲ»×ã +$ +$ strsignal() support catalog +$ +$set 2 +$ SIGHUP +1 ÖÕ¶ËÏß·¹Ò¶Ï +$ SIGINT +2 ÖÐ¶Ï +$ SIGQUIT +3 Í˳ö +$ SIGILL +4 ÎÞЧָÁî +$ SIGTRAP +5 ¸ú×Ù/BPT ÏÝÚå +$ SIGABRT +6 ÖÕÖ¹ÏÝÚå +$ SIGEMT +7 EMT ÏÝÚå +$ SIGFPE +8 ¸¡µãÒì³£ +$ SIGKILL +9 Ç¿ÖÆÖÕÖ¹½ø³Ì +$ SIGBUS +10 ϵͳÄÚ´æ·ÃÎÊÔ½½ç +$ SIGSEGV +11 ÄÚ´æ·ÃÎÊÔ½½ç +$ SIGSYS +12 ÎÞЧϵͳµ÷Óà +$ SIGPIPE +13 д¹ÜµÀʱ¶ÁÈ¡Õß²»´æÔÚ +$ SIGALRM +14 ʵʱµ¹¼Æʱµ½ÆÚ +$ SIGTERM +15 ÖÕÖ¹ +$ SIGURG +16 ÐèÁ¢¼´´¦ÀíµÄ I/O ½ô¼±×´¿ö +$ SIGSTOP +17 ¹ÒÆð (ÐźÅ) +$ SIGTSTP +18 ¹ÒÆð +$ SIGCONT +19 ¼ÌÐøÔËÐÐ +$ SIGCHLD +20 ×Ó½ø³ÌÖÕÖ¹ +$ SIGTTIN +21 TTY ÊäÈë×èÈû +$ SIGTTOU +22 TTY Êä³ö×èÈû +$ SIGIO +23 I/O ¾ÍÐ÷ +$ SIGXCPU +24 CPU ʹÓÃʱ¼ä¹ý³¤ +$ SIGXFSZ +25 Îļþ³ß´ç¹ý´ó +$ SIGVTALRM +26 ÐéÄâµ¹¼Æʱµ½ÆÚ +$ SIGPROF +27 ÆÊÎöµ¹¼Æʱµ½ÆÚ +$ SIGWINCH +28 ´°¿Ú³ß´ç±ä»¯ +$ SIGINFO +29 ÇëÇóÐÅÏ¢ +$ SIGUSR1 +30 Óû§×Ô¶¨ÒåÐźŠ1 +$ SIGUSR2 +31 Óû§×Ô¶¨ÒåÐźŠ2 +$ +$ gai_strerror() support catalog +$ +$set 3 +$ 1 (obsolete) +1 Ö÷»úÃûʹÓÃÁ˲»Ö§³ÖµÄµØÖ·ÀàÐÍ +$ EAI_AGAIN +2 ÔÝʱÎÞ·¨½âÎöÃû³Æ +$ EAI_BADFLAGS +3 ÎÞЧµÄ ai_flags Öµ +$ EAI_FAIL +4 ½âÎöÃû³Æʱ³öÏÖÎÞ·¨»Ö¸´µÄ´íÎó +$ EAI_FAMILY +5 ²»Ö§³ÖµÄµØÖ·ÐÅÏ¢ÀàÐÍ +$ EAI_MEMORY +6 ÄÚ´æ·ÖÅäʧ°Ü +$ 7 (obsolete) +7 Ö÷»úÃûÎÞÏà¹ØÁªµÄµØÖ· +$ EAI_NONAME +8 δ֪µÄÖ÷»úÃû»ò·þÎñÃû +$ EAI_SERVICE +9 Ì×½Ó×ÖÀàÐͲ»Ö§³Ö´Ë·þÎñÃû +$ EAI_SOCKTYPE +10 ²»Ö§³ÖµÄÌ×½Ó×ÖÀàÐÍ +$ EAI_SYSTEM +11 ϵͳµ÷Ó÷µ»ØÁË errno ´íÎó +$ EAI_BADHINTS +12 ÎÞЧÌáʾ²ÎÊý +$ EAI_PROTOCOL +13 δ֪ÐÒé +$ EAI_OVERFLOW +14 ²ÎÊý»º³åÒç³ö +$ 0 +32766 ³É¹¦ +$ NL_MSGMAX +32767 δ֪´íÎó diff --git a/lib/libc/nls/zh_CN.UTF-8.msg b/lib/libc/nls/zh_CN.UTF-8.msg new file mode 100644 index 0000000..9475ea8 --- /dev/null +++ b/lib/libc/nls/zh_CN.UTF-8.msg @@ -0,0 +1,295 @@ +$ $FreeBSD$ +$ +$ Message catalog for zh_CN.UTF-8 locale +$ +$ strerror() support catalog +$ +$set 1 +$ EPERM +1 ä¸å…许的æ“作 +$ ENOENT +2 文件或目录ä¸å˜åœ¨ +$ ESRCH +3 进程ä¸å˜åœ¨ +$ EINTR +4 系统调用ä¸æ¢ +$ EIO +5 输入/输出错误 +$ ENXIO +6 未é…置的设备 +$ E2BIG +7 å‚数表过长 +$ ENOEXEC +8 å¯æ‰§è¡Œæ–‡ä»¶æ ¼å¼é”™è¯¯ +$ EBADF +9 文件æè¿°ç¬¦æ— æ•ˆ +$ ECHILD +10 指定å进程ä¸å˜åœ¨ +$ EDEADLK +11 æ¤æ“作会导致æ»é” +$ ENOMEM +12 æ— æ³•åˆ†é…å†…å˜ +$ EACCES +13 æ‹’ç»è®¿é—® +$ EFAULT +14 æ— æ•ˆåœ°å€ +$ ENOTBLK +15 该æ“作需è¦å—设备 +$ EBUSY +16 è®¾å¤‡ä½¿ç”¨ä¸ +$ EEXIST +17 文件已å˜åœ¨ +$ EXDEV +18 链接跨设备 +$ ENODEV +19 设备ä¸æ”¯æŒæ¤æ“作 +$ ENOTDIR +20 对象éžç›®å½• +$ EISDIR +21 对象为目录 +$ EINVAL +22 å‚æ•°æ— æ•ˆ +$ ENFILE +23 系统打开文件过多 +$ EMFILE +24 进程打开文件过多 +$ ENOTTY +25 æ— æ•ˆè®¾å¤‡ ioctl +$ ETXTBSY +26 å¯æ‰§è¡Œæ–‡ä»¶å¿™ +$ EFBIG +27 文件过大 +$ ENOSPC +28 è®¾å¤‡æ— å¯ç”¨ç©ºé—´ +$ ESPIPE +29 ä¸å…许执行 seek æ“作 +$ EROFS +30 文件系统åªè¯» +$ EMLINK +31 文件链接过多 +$ EPIPE +32 管é“å·²ä¸æ¢ +$ EDOM +33 数值å‚数越界 +$ ERANGE +34 结果过大 +$ EAGAIN, EWOULDBLOCK +35 资æºæš‚æ—¶ä¸å¯ç”¨ +$ EINPROGRESS +36 æ“ä½œè¿›è¡Œä¸ +$ EALREADY +37 æ“作已开始 +$ ENOTSOCK +38 å°è¯•åœ¨éž socket 上执行 socket æ“作 +$ EDESTADDRREQ +39 需è¦ç›®çš„åœ°å€ +$ EMSGSIZE +40 消æ¯è¿‡é•¿ +$ EPROTOTYPE +41 socketå议类型错误 +$ ENOPROTOOPT +42 åè®®ä¸å¯ç”¨ +$ EPROTONOSUPPORT +43 ä¸æ”¯æŒçš„åè®® +$ ESOCKTNOSUPPORT +44 ä¸æ”¯æŒçš„ socket 类型 +$ EOPNOTSUPP +45 ä¸æ”¯æŒçš„æ“作 +$ EPFNOSUPPORT +46 ä¸æ”¯æŒçš„åè®®æ— +$ EAFNOSUPPORT +47 åè®®æ—ä¸æ”¯æŒçš„地å€æ— +$ EADDRINUSE +48 地å€å·²è¢«å 用 +$ EADDRNOTAVAIL +49 æ— æ³•æŒ‡å®šè¯·æ±‚çš„åœ°å€ +$ ENETDOWN +50 ç½‘ç»œå·²å…³é— +$ ENETUNREACH +51 网络ä¸å¯è¾¾ +$ ENETRESET +52 å¤ä½å¯¼è‡´ç½‘络连接丢失 +$ ECONNABORTED +53 软件导致的连接ä¸æ¢ +$ ECONNRESET +54 对方å¤ä½äº†è¿žæŽ¥ +$ ENOBUFS +55 缓冲区空间ä¸è¶³ +$ EISCONN +56 socket 已连接 +$ ENOTCONN +57 socket 未连接 +$ ESHUTDOWN +58 socket shutdown 之åŽæ— 法å‘é€æ•°æ® +$ ETOOMANYREFS +59 å¼•ç”¨æ•°è¿‡å¤šï¼šæ— æ³•æ‹¼æŽ¥ +$ ETIMEDOUT +60 æ“作超时 +$ ECONNREFUSED +61 æ‹’ç»è¿žæŽ¥ +$ ELOOP +62 符å·é“¾æŽ¥å±‚数过多 +$ ENAMETOOLONG +63 文件å过长 +$ EHOSTDOWN +64 ä¸»æœºå·²å…³é— +$ EHOSTUNREACH +65 没有到主机的路由 +$ ENOTEMPTY +66 目录éžç©º +$ EPROCLIM +67 è¿›ç¨‹æ•°è¶…é™ +$ EUSERS +68 ç”¨æˆ·æ•°è¶…é™ +$ EDQUOT +69 ç£ç›˜ç©ºé—´é…é¢è¶…é™ +$ ESTALE +70 NFS 文件å¥æŸ„已失效 +$ EREMOTE +71 远程目录层数过多 +$ EBADRPC +72 RPC ç»“æž„æ— æ•ˆ +$ ERPCMISMATCH +73 RPC 版本错误 +$ EPROGUNAVAIL +74 RPC 程åºä¸å¯ç”¨ +$ EPROGMISMATCH +75 程åºç‰ˆæœ¬é”™è¯¯ +$ EPROCUNAVAIL +76 未æ供的远程函数 +$ ENOLCK +77 ä¸æ”¯æŒé” +$ ENOSYS +78 功能未实现 +$ EFTYPE +79 æ–‡ä»¶ç±»åž‹æˆ–æ ¼å¼æ— 效 +$ EAUTH +80 èº«ä»½æ— æ•ˆ +$ ENEEDAUTH +81 æ— ä¿¡ä»»å‡æ® +$ EIDRM +82 æ— æ ‡è¯†ç¬¦ +$ ENOMSG +83 æ— æ¶ˆæ¯ç±»åž‹ +$ EOVERFLOW +84 数值溢出 +$ ECANCELED +85 æ“作已å–消 +$ EILSEQ +86 æ— æ•ˆå—符åºåˆ— +$ ENOATTR +87 æ— æ‰©å±•å±žæ€§ +$ EDOOFUS +88 程åºè®¾è®¡é”™è¯¯ +$ EBADMSG +89 æ— æ•ˆæ¶ˆæ¯ +$ EMULTIHOP +90 Multihop attempted +$ ENOLINK +91 Link has been severed +$ EPROTO +92 å议错误 +$ ENOTCAPABLE +93 æƒèƒ½ä¸è¶³ +$ +$ strsignal() support catalog +$ +$set 2 +$ SIGHUP +1 ç»ˆç«¯çº¿è·¯æŒ‚æ– +$ SIGINT +2 ä¸æ– +$ SIGQUIT +3 退出 +$ SIGILL +4 æ— æ•ˆæŒ‡ä»¤ +$ SIGTRAP +5 跟踪/BPT 陷阱 +$ SIGABRT +6 终æ¢é™·é˜± +$ SIGEMT +7 EMT 陷阱 +$ SIGFPE +8 浮点异常 +$ SIGKILL +9 强制终æ¢è¿›ç¨‹ +$ SIGBUS +10 系统内å˜è®¿é—®è¶Šç•Œ +$ SIGSEGV +11 内å˜è®¿é—®è¶Šç•Œ +$ SIGSYS +12 æ— æ•ˆç³»ç»Ÿè°ƒç”¨ +$ SIGPIPE +13 写管é“时读å–者ä¸å˜åœ¨ +$ SIGALRM +14 实时倒计时到期 +$ SIGTERM +15 ç»ˆæ¢ +$ SIGURG +16 需立å³å¤„ç†çš„ I/O 紧急状况 +$ SIGSTOP +17 挂起 (ä¿¡å·) +$ SIGTSTP +18 挂起 +$ SIGCONT +19 继ç»è¿è¡Œ +$ SIGCHLD +20 åè¿›ç¨‹ç»ˆæ¢ +$ SIGTTIN +21 TTY 输入阻塞 +$ SIGTTOU +22 TTY 输出阻塞 +$ SIGIO +23 I/O 就绪 +$ SIGXCPU +24 CPU 使用时间过长 +$ SIGXFSZ +25 文件尺寸过大 +$ SIGVTALRM +26 虚拟倒计时到期 +$ SIGPROF +27 剖æžå€’计时到期 +$ SIGWINCH +28 窗å£å°ºå¯¸å˜åŒ– +$ SIGINFO +29 è¯·æ±‚ä¿¡æ¯ +$ SIGUSR1 +30 ç”¨æˆ·è‡ªå®šä¹‰ä¿¡å· 1 +$ SIGUSR2 +31 ç”¨æˆ·è‡ªå®šä¹‰ä¿¡å· 2 +$ +$ gai_strerror() support catalog +$ +$set 3 +$ 1 (obsolete) +1 主机å使用了ä¸æ”¯æŒçš„地å€ç±»åž‹ +$ EAI_AGAIN +2 æš‚æ—¶æ— æ³•è§£æžå称 +$ EAI_BADFLAGS +3 æ— æ•ˆçš„ ai_flags 值 +$ EAI_FAIL +4 解æžåç§°æ—¶å‡ºçŽ°æ— æ³•æ¢å¤çš„错误 +$ EAI_FAMILY +5 ä¸æ”¯æŒçš„地å€ä¿¡æ¯ç±»åž‹ +$ EAI_MEMORY +6 内å˜åˆ†é…失败 +$ 7 (obsolete) +7 主机åæ— ç›¸å…³è”çš„åœ°å€ +$ EAI_NONAME +8 未知的主机å或æœåŠ¡å +$ EAI_SERVICE +9 套接å—类型ä¸æ”¯æŒæ¤æœåŠ¡å +$ EAI_SOCKTYPE +10 ä¸æ”¯æŒçš„套接å—类型 +$ EAI_SYSTEM +11 系统调用返回了 errno 错误 +$ EAI_BADHINTS +12 æ— æ•ˆæ示å‚æ•° +$ EAI_PROTOCOL +13 未知åè®® +$ EAI_OVERFLOW +14 å‚数缓冲溢出 +$ 0 +32766 æˆåŠŸ +$ NL_MSGMAX +32767 未知错误 diff --git a/lib/libdisk/Makefile b/lib/libdisk/Makefile deleted file mode 100644 index 9f3e093..0000000 --- a/lib/libdisk/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# $FreeBSD$ - -.if ${MACHINE_CPUARCH} == "ia64" -_open_disk= open_ia64_disk.c -.else -_change = change.c -_open_disk= open_disk.c -.endif - -LIB= disk -SRCS= blocks.c ${_change} chunk.c create_chunk.c disk.c ${_open_disk} \ - rules.c write_disk.c -SRCS+= write_${MACHINE}_disk.c - -INCS= libdisk.h - -WARNS?= 2 - -CFLAGS+= -I${.CURDIR}/../../sys/geom - -.if ${MACHINE} == "pc98" -CFLAGS+= -DPC98 -.endif - -CLEANFILES+= tmp.c tst01 tst01.o -NO_PROFILE= -NO_PIC= - -MAN= libdisk.3 - -.include <bsd.lib.mk> - -tst01: tst01.o libdisk.a - cc ${CFLAGS} -static tst01.o -o tst01 libdisk.a - -ad0: all install tst01 - ./tst01 ad0 - -da0: all install tst01 - ./tst01 da0 - -da1: all install tst01 - ./tst01 da1 diff --git a/lib/libdisk/blocks.c b/lib/libdisk/blocks.c deleted file mode 100644 index 313c5cc..0000000 --- a/lib/libdisk/blocks.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include "libdisk.h" - -void * -read_block(int fd, daddr_t block, u_long sector_size) -{ - void *foo; - int i; - - foo = malloc(sector_size); - if (foo == NULL) - return (NULL); - if (-1 == lseek(fd, (off_t)block * sector_size, SEEK_SET)) { - free (foo); - return (NULL); - } - i = read(fd, foo, sector_size); - if ((int)sector_size != i) { - free (foo); - return (NULL); - } - return foo; -} - -int -write_block(int fd, daddr_t block, const void *foo, u_long sector_size) -{ - int i; - - if (-1 == lseek(fd, (off_t)block * sector_size, SEEK_SET)) - return (-1); - i = write(fd, foo, sector_size); - if ((int)sector_size != i) - return (-1); - return 0; -} diff --git a/lib/libdisk/change.c b/lib/libdisk/change.c deleted file mode 100644 index 5f0c9c6..0000000 --- a/lib/libdisk/change.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <sys/types.h> -#include "libdisk.h" - -void -Set_Bios_Geom(struct disk *disk, u_long cyl, u_long hd, u_long sect) -{ - - disk->bios_cyl = cyl; - disk->bios_hd = hd; - disk->bios_sect = sect; -} - -void -Sanitize_Bios_Geom(struct disk *disk) -{ - int sane; - - sane = 1; - - if (disk->bios_cyl >= 65536) - sane = 0; -#ifdef PC98 - if (disk->bios_hd >= 256) - sane = 0; - if (disk->bios_sect >= 256) - sane = 0; -#else - if (disk->bios_hd > 256) - sane = 0; - if (disk->bios_sect > 63) - sane = 0; -#endif -#if 0 /* Disable a check on a disk size. It's too strict. */ - if (disk->bios_cyl * disk->bios_hd * disk->bios_sect != - disk->chunks->size) - sane = 0; -#endif - if (sane) - return; - - /* First try something that IDE can handle */ - disk->bios_sect = 63; - disk->bios_hd = 16; - disk->bios_cyl = disk->chunks->size / - (disk->bios_sect * disk->bios_hd); - -#ifdef PC98 - if (disk->bios_cyl < 65536) -#else - if (disk->bios_cyl < 1024) -#endif - return; - - /* Hmm, try harder... */ - /* Assume standard SCSI parameter */ -#ifdef PC98 - disk->bios_sect = 128; - disk->bios_hd = 8; -#else - disk->bios_hd = 255; -#endif - disk->bios_cyl = disk->chunks->size / - (disk->bios_sect * disk->bios_hd); - -#ifdef PC98 - if (disk->bios_cyl < 65536) - return; - - /* Assume UIDE-133/98-A Challenger BIOS 0.9821C parameter */ - disk->bios_sect = 255; - disk->bios_hd = 16; - disk->bios_cyl = disk->chunks->size / - (disk->bios_sect * disk->bios_hd); - - if (disk->bios_cyl < 65536) - return; - - /* BIG-na-Drive? */ - disk->bios_hd = 255; - disk->bios_cyl = disk->chunks->size / - (disk->bios_sect * disk->bios_hd); -#endif -} - -void -All_FreeBSD(struct disk *d, int force_all) -{ - struct chunk *c; - int type; - -#ifdef PC98 - type = 0xc494; -#else - type = 0xa5; -#endif - -again: - for (c = d->chunks->part; c; c = c->next) - if (c->type != unused) { - Delete_Chunk(d, c); - goto again; - } - c = d->chunks; - if (force_all) { - Sanitize_Bios_Geom(d); - Create_Chunk(d, c->offset, c->size, freebsd, type, - CHUNK_FORCE_ALL, "FreeBSD"); - } else { - Create_Chunk(d, c->offset, c->size, freebsd, type, 0, - "FreeBSD"); - } -} diff --git a/lib/libdisk/chunk.c b/lib/libdisk/chunk.c deleted file mode 100644 index fb43ef5..0000000 --- a/lib/libdisk/chunk.c +++ /dev/null @@ -1,595 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <err.h> -#include "libdisk.h" - -struct chunk * -New_Chunk(void) -{ - struct chunk *c; - - c = malloc(sizeof *c); - if (c != NULL) - memset(c, 0, sizeof *c); - return (c); -} - -/* Is c2 completely inside c1 ? */ - -static int -Chunk_Inside(const struct chunk *c1, const struct chunk *c2) -{ - /* if c1 ends before c2 do */ - if (c1->end < c2->end) - return 0; - /* if c1 starts after c2 do */ - if (c1->offset > c2->offset) - return 0; - return 1; -} - -static struct chunk * -Find_Mother_Chunk(struct chunk *chunks, daddr_t offset, daddr_t end, - chunk_e type) -{ - struct chunk *c1, *c2, ct; - - ct.offset = offset; - ct.end = end; - switch (type) { - case whole: - if (Chunk_Inside(chunks, &ct)) - return chunks; - case extended: - for (c1 = chunks->part; c1; c1 = c1->next) { - if (c1->type != type) - continue; - if (Chunk_Inside(c1, &ct)) - return c1; - } - return 0; - case freebsd: - for (c1 = chunks->part; c1; c1 = c1->next) { - if (c1->type == type) - if (Chunk_Inside(c1, &ct)) - return c1; - if (c1->type != extended) - continue; - for (c2 = c1->part; c2; c2 = c2->next) - if (c2->type == type && Chunk_Inside(c2, &ct)) - return c2; - } - return 0; -#ifdef __powerpc__ - case apple: - for (c1 = chunks->part; c1; c1 = c1->next) { - if (c1->type == type) - if (Chunk_Inside(c1, &ct)) - return c1; - } - return 0; -#endif - default: - warn("Unsupported mother type in Find_Mother_Chunk"); - return 0; - } -} - -void -Free_Chunk(struct chunk *c1) -{ - if(c1 == NULL) - return; - if(c1->private_data && c1->private_free) - (*c1->private_free)(c1->private_data); - if(c1->part != NULL) - Free_Chunk(c1->part); - if(c1->next != NULL) - Free_Chunk(c1->next); - if (c1->name != NULL) - free(c1->name); - if (c1->sname != NULL) - free(c1->sname); - free(c1); -} - -struct chunk * -Clone_Chunk(const struct chunk *c1) -{ - struct chunk *c2; - - if(!c1) - return NULL; - c2 = New_Chunk(); - if (c2 == NULL) - return NULL; - *c2 = *c1; - if (c1->private_data && c1->private_clone) - c2->private_data = c2->private_clone(c2->private_data); - c2->name = strdup(c2->name); - if (c2->sname != NULL) - c2->sname = strdup(c2->sname); - c2->next = Clone_Chunk(c2->next); - c2->part = Clone_Chunk(c2->part); - return c2; -} - -int -Insert_Chunk(struct chunk *c2, daddr_t offset, daddr_t size, const char *name, - chunk_e type, int subtype, u_long flags, const char *sname) -{ - struct chunk *ct,*cs; - - /* We will only insert into empty spaces */ - if (c2->type != unused) - return __LINE__; - - ct = New_Chunk(); - if (ct == NULL) - return __LINE__; - ct->disk = c2->disk; - ct->offset = offset; - ct->size = size; - ct->end = offset + size - 1; - ct->type = type; - if (sname != NULL) - ct->sname = strdup(sname); - ct->name = strdup(name); - ct->subtype = subtype; - ct->flags = flags; - - if (!Chunk_Inside(c2, ct)) { - Free_Chunk(ct); - return __LINE__; - } - - if ((type == freebsd || type == extended || type == apple)) { - cs = New_Chunk(); - if (cs == NULL) - return __LINE__; - cs->disk = c2->disk; - cs->offset = offset; - cs->size = size; - cs->end = offset + size - 1; - cs->type = unused; - if (sname != NULL) - cs->sname = strdup(sname); - cs->name = strdup("-"); - ct->part = cs; - } - - /* Make a new chunk for any trailing unused space */ - if (c2->end > ct->end) { - cs = New_Chunk(); - if (cs == NULL) - return __LINE__; - *cs = *c2; - cs->disk = c2->disk; - cs->offset = ct->end + 1; - cs->size = c2->end - ct->end; - if (c2->sname != NULL) - cs->sname = strdup(c2->sname); - if (c2->name) - cs->name = strdup(c2->name); - c2->next = cs; - c2->size -= c2->end - ct->end; - c2->end = ct->end; - } - /* If no leading unused space just occupy the old chunk */ - if (c2->offset == ct->offset) { - c2->sname = ct->sname; - c2->name = ct->name; - c2->type = ct->type; - c2->part = ct->part; - c2->subtype = ct->subtype; - c2->flags = ct->flags; - ct->sname = NULL; - ct->name = NULL; - ct->part = 0; - Free_Chunk(ct); - return 0; - } - /* else insert new chunk and adjust old one */ - c2->end = ct->offset - 1; - c2->size -= ct->size; - ct->next = c2->next; - c2->next = ct; - return 0; -} - -int -Add_Chunk(struct disk *d, daddr_t offset, daddr_t size, const char *name, - chunk_e type, int subtype, u_long flags, const char *sname) -{ - struct chunk *c1, *c2, ct; - daddr_t end = offset + size - 1; - ct.offset = offset; - ct.end = end; - ct.size = size; - - if (type == whole) { - d->chunks = c1 = New_Chunk(); - if (c1 == NULL) - return __LINE__; - c2 = c1->part = New_Chunk(); - if (c2 == NULL) - return __LINE__; - c2->disk = c1->disk = d; - c2->offset = c1->offset = offset; - c2->size = c1->size = size; - c2->end = c1->end = end; - c1->sname = strdup(sname); - c2->sname = strdup("-"); - c1->name = strdup(name); - c2->name = strdup("-"); - c1->type = type; - c2->type = unused; - c1->flags = flags; - c1->subtype = subtype; - return 0; - } - - c1 = 0; - /* PLATFORM POLICY BEGIN ------------------------------------- */ - switch(platform) { - case p_i386: - case p_amd64: - switch (type) { - case fat: - case gpt: - case mbr: - case extended: - case freebsd: - c1 = Find_Mother_Chunk(d->chunks, offset, end, whole); - break; - case part: - c1 = Find_Mother_Chunk(d->chunks, offset, end, freebsd); - break; - default: - return(-1); - } - break; - case p_ia64: - switch (type) { - case freebsd: - subtype = 0xa5; - /* FALL THROUGH */ - case fat: - case efi: - case mbr: - c1 = Find_Mother_Chunk(d->chunks, offset, end, whole); - break; - case part: - c1 = Find_Mother_Chunk(d->chunks, offset, end, - freebsd); - if (!c1) - c1 = Find_Mother_Chunk(d->chunks, offset, end, - whole); - break; - default: - return (-1); - } - break; - case p_pc98: - switch (type) { - case fat: - case pc98: - case freebsd: - c1 = Find_Mother_Chunk(d->chunks, offset, end, whole); - break; - case part: - c1 = Find_Mother_Chunk(d->chunks, offset, end, freebsd); - break; - default: - return(-1); - } - break; - case p_sparc64: - case p_alpha: - switch (type) { - case freebsd: - c1 = Find_Mother_Chunk(d->chunks, offset, end, whole); - break; - case part: - c1 = Find_Mother_Chunk(d->chunks, offset, end, freebsd); - break; - default: - return(-1); - } - break; - case p_ppc: - switch (type) { - case apple: - c1 = Find_Mother_Chunk(d->chunks, offset, end, whole); - break; - case part: - c1 = Find_Mother_Chunk(d->chunks, offset, end, apple); - break; - default: - return (-1); - } - break; - default: - return (-1); - } - /* PLATFORM POLICY END ---------------------------------------- */ - - if(!c1) - return __LINE__; - for(c2 = c1->part; c2; c2 = c2->next) { - if (c2->type != unused) - continue; - if(!Chunk_Inside(c2, &ct)) - continue; -/* PLATFORM POLICY BEGIN ------------------------------------- */ - if (platform == p_sparc64) { - offset = Prev_Cyl_Aligned(d, offset); - size = Next_Cyl_Aligned(d, size); - } else if (platform == p_i386 || platform == p_pc98 || - platform == p_amd64) { - if (type != freebsd) - break; - if (!(flags & CHUNK_ALIGN)) - break; - if (offset == d->chunks->offset && - end == d->chunks->end) - break; - - /* Round down to prev cylinder */ - offset = Prev_Cyl_Aligned(d,offset); - /* Stay inside the parent */ - if (offset < c2->offset) - offset = c2->offset; - /* Round up to next cylinder */ - offset = Next_Cyl_Aligned(d, offset); - /* Keep one track clear in front of parent */ - if (offset == c1->offset) - offset = Next_Track_Aligned(d, offset + 1); - /* Work on the (end+1) */ - size += offset; - /* Round up to cylinder */ - size = Next_Cyl_Aligned(d, size); - /* Stay inside parent */ - if ((size-1) > c2->end) - size = c2->end + 1; - /* Round down to cylinder */ - size = Prev_Cyl_Aligned(d, size); - - /* Convert back to size */ - size -= offset; - } - break; - -/* PLATFORM POLICY END ------------------------------------- */ - } - if (c2 == NULL) - return (__LINE__); - return Insert_Chunk(c2, offset, size, name, type, subtype, flags, - sname); -} - -char * -ShowChunkFlags(struct chunk *c) -{ - static char ret[10]; - int i = 0; - - if (c->flags & CHUNK_ACTIVE) - ret[i++] = 'A'; - if (c->flags & CHUNK_ALIGN) - ret[i++] = '='; - if (c->flags & CHUNK_IS_ROOT) - ret[i++] = 'R'; - ret[i++] = '\0'; - - return ret; -} - -static void -Print_Chunk(struct chunk *c1, int offset) -{ - int i; - - if (!c1) - return; - for (i = 0; i < offset - 2; i++) - putchar(' '); - for (; i < offset; i++) - putchar('-'); - putchar('>'); - for (; i < 10; i++) - putchar(' '); -#ifndef __ia64__ - printf("%p ", c1); -#endif - printf("%8jd %8jd %8jd %-8s %-16s %-8s 0x%02x %s", - (intmax_t)c1->offset, (intmax_t)c1->size, (intmax_t)c1->end, - c1->name, c1->sname, chunk_name(c1->type), c1->subtype, - ShowChunkFlags(c1)); - putchar('\n'); - Print_Chunk(c1->part, offset + 2); - Print_Chunk(c1->next, offset); -} - -void -Debug_Chunk(struct chunk *c1) -{ - - Print_Chunk(c1, 2); -} - -int -Delete_Chunk(struct disk *d, struct chunk *c) -{ - - return (Delete_Chunk2(d, c, 0)); -} - -int -Delete_Chunk2(struct disk *d, struct chunk *c, int rflags) -{ - struct chunk *c1, *c2, *c3; - daddr_t offset = c->offset; - - switch (c->type) { - case whole: - case unused: - return 1; - case extended: - c1 = Find_Mother_Chunk(d->chunks, c->offset, c->end, whole); - break; - case part: - c1 = Find_Mother_Chunk(d->chunks, c->offset, c->end, freebsd); -#ifdef __ia64__ - if (c1 == NULL) - c1 = Find_Mother_Chunk(d->chunks, c->offset, c->end, - whole); -#endif -#ifdef __powerpc__ - if (c1 == NULL) - c1 = Find_Mother_Chunk(d->chunks, c->offset, c->end, - apple); -#endif - break; - default: - c1 = Find_Mother_Chunk(d->chunks, c->offset, c->end, extended); - if (c1 == NULL) - c1 = Find_Mother_Chunk(d->chunks, c->offset, c->end, - whole); - break; - } - if (c1 == NULL) - return 1; - for (c2 = c1->part; c2; c2 = c2->next) { - if (c2 == c) { - c2->type = unused; - c2->subtype = 0; - c2->flags = 0; - if (c2->sname != NULL) - free(c2->sname); - c2->sname = strdup("-"); - free(c2->name); - c2->name = strdup("-"); - Free_Chunk(c2->part); - c2->part =0; - goto scan; - } - } - return 1; -scan: - /* - * Collapse multiple unused elements together, and attempt - * to extend the previous chunk into the freed chunk. - * - * We only extend non-unused elements which are marked - * for newfs (we can't extend working filesystems), and - * only if we are called with DELCHUNK_RECOVER. - */ - for (c2 = c1->part; c2; c2 = c2->next) { - if (c2->type != unused) { - if (c2->offset + c2->size != offset || - (rflags & DELCHUNK_RECOVER) == 0 || - (c2->flags & CHUNK_NEWFS) == 0) { - continue; - } - /* else extend into free area */ - } - if (!c2->next) - continue; - if (c2->next->type != unused) - continue; - c3 = c2->next; - c2->size += c3->size; - c2->end = c3->end; - c2->next = c3->next; - c3->next = 0; - Free_Chunk(c3); - goto scan; - } - Fixup_Names(d); - return 0; -} - -#if 0 -int -Collapse_Chunk(struct disk *d, struct chunk *c1) -{ - struct chunk *c2, *c3; - - if (c1->next && Collapse_Chunk(d, c1->next)) - return 1; - - if (c1->type == unused && c1->next && c1->next->type == unused) { - c3 = c1->next; - c1->size += c3->size; - c1->end = c3->end; - c1->next = c3->next; - c3->next = 0; - Free_Chunk(c3); - return 1; - } - c3 = c1->part; - if (!c3) - return 0; - if (Collapse_Chunk(d, c1->part)) - return 1; - - if (c1->type == whole) - return 0; - - if (c3->type == unused && c3->size == c1->size) { - Delete_Chunk(d, c1); - return 1; - } - if (c3->type == unused) { - c2 = New_Chunk(); - if (c2 == NULL) - barfout(1, "malloc failed"); - *c2 = *c1; - c1->next = c2; - c1->disk = d; - c1->sname = strdup("-"); - c1->name = strdup("-"); - c1->part = 0; - c1->type = unused; - c1->flags = 0; - c1->subtype = 0; - c1->size = c3->size; - c1->end = c3->end; - c2->offset += c1->size; - c2->size -= c1->size; - c2->part = c3->next; - c3->next = 0; - Free_Chunk(c3); - return 1; - } - for (c2 = c3; c2->next; c2 = c2->next) - c3 = c2; - if (c2 && c2->type == unused) { - c3->next = 0; - c2->next = c1->next; - c1->next = c2; - c1->size -= c2->size; - c1->end -= c2->size; - return 1; - } - - return 0; -} -#endif diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c deleted file mode 100644 index 7f1453e..0000000 --- a/lib/libdisk/create_chunk.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <ctype.h> -#include <fcntl.h> -#include <stdarg.h> -#include <sys/param.h> -#include <sys/disklabel.h> -#ifdef PC98 -#include <sys/diskpc98.h> -#else -#include <sys/diskmbr.h> -#endif -#include <sys/mount.h> -#include <sys/stat.h> -#include <sys/sysctl.h> -#include <grp.h> -#include <paths.h> -#include <pwd.h> -#include "libdisk.h" - -static int -Fixup_FreeBSD_Names(struct chunk *c) -{ - struct chunk *c1, *c3; - uint j; - - if (!strcmp(c->name, "X")) - return 0; - - /* reset all names to "X" */ - for (c1 = c->part; c1; c1 = c1->next) { - c1->oname = c1->name; - c1->name = malloc(12); - if (!c1->name) - return -1; - strcpy(c1->name,"X"); - } - - /* Allocate the first swap-partition we find */ - for (c1 = c->part; c1; c1 = c1->next) { - if (c1->type == unused) - continue; - if (c1->subtype != FS_SWAP) - continue; - sprintf(c1->name, "%s%c", c->name, SWAP_PART + 'a'); - break; - } - - /* Allocate the first root-partition we find */ - for (c1 = c->part; c1; c1 = c1->next) { - if (c1->type == unused) - continue; - if (!(c1->flags & CHUNK_IS_ROOT)) - continue; - sprintf(c1->name, "%s%c", c->name, 0 + 'a'); - break; - } - - /* Try to give them the same as they had before */ - for (c1 = c->part; c1; c1 = c1->next) { - if (strcmp(c1->name, "X")) - continue; - for (c3 = c->part; c3 ; c3 = c3->next) - if (c1 != c3 && !strcmp(c3->name, c1->oname)) - goto newname; - strcpy(c1->name, c1->oname); - newname: - ; - } - - /* Allocate the rest sequentially */ - for (c1 = c->part; c1; c1 = c1->next) { - const char order[] = "defghab"; - - if (c1->type == unused) - continue; - if (strcmp("X", c1->name)) - continue; - - for (j = 0; j < strlen(order); j++) { - sprintf(c1->name, "%s%c", c->name, order[j]); - for (c3 = c->part; c3 ; c3 = c3->next) - if (c1 != c3 && !strcmp(c3->name, c1->name)) - goto match; - break; - match: - strcpy(c1->name, "X"); - continue; - } - } - for (c1 = c->part; c1; c1 = c1->next) { - free(c1->oname); - c1->oname = 0; - } - return 0; -} - -#ifndef PC98 -static int -Fixup_Extended_Names(struct chunk *c) -{ - struct chunk *c1; - int j = 5; - - for (c1 = c->part; c1; c1 = c1->next) { - if (c1->type == unused) - continue; - free(c1->name); - c1->name = malloc(12); - if (!c1->name) - return -1; - sprintf(c1->name, "%ss%d", c->disk->chunks->name, j++); - if (c1->type == freebsd) - if (Fixup_FreeBSD_Names(c1) != 0) - return -1; - } - return 0; -} -#endif - -#ifdef __powerpc__ -static int -Fixup_Apple_Names(struct chunk *c) -{ - struct chunk *c1; - - for (c1 = c->part; c1; c1 = c1->next) { - if (c1->type == unused) - continue; - free(c1->name); - c1->name = strdup(c->name); - if (!c1->name) - return (-1); - } - return 0; -} -#endif - -int -Fixup_Names(struct disk *d) -{ - struct chunk *c1, *c2; -#if defined(__i386__) || defined(__ia64__) || defined(__amd64__) - struct chunk *c3; - int j, max; -#endif - - c1 = d->chunks; - for (c2 = c1->part; c2 ; c2 = c2->next) { - if (c2->type == unused) - continue; - if (strcmp(c2->name, "X")) - continue; -#if defined(__i386__) || defined(__ia64__) || defined(__amd64__) - c2->oname = malloc(12); - if (!c2->oname) - return -1; -#ifdef __ia64__ - max = d->gpt_size; -#else - max = NDOSPART; -#endif - for (j = 1; j <= max; j++) { -#ifdef __ia64__ - sprintf(c2->oname, "%s%c%d", c1->name, - (c1->type == whole) ? 'p' : 's', j); -#else - sprintf(c2->oname, "%ss%d", c1->name, j); -#endif - for (c3 = c1->part; c3; c3 = c3->next) - if (c3 != c2 && !strcmp(c3->name, c2->oname)) - goto match; - free(c2->name); - c2->name = c2->oname; - c2->oname = 0; - break; - match: - continue; - } - if (c2->oname) - free(c2->oname); -#else - free(c2->name); - c2->name = strdup(c1->name); -#endif /*__i386__*/ - } - for (c2 = c1->part; c2; c2 = c2->next) { - if (c2->type == freebsd) - Fixup_FreeBSD_Names(c2); -#ifdef __powerpc__ - else if (c2->type == apple) - Fixup_Apple_Names(c2); -#endif -#ifndef PC98 - else if (c2->type == extended) - Fixup_Extended_Names(c2); -#endif - } - return 0; -} - -int -Create_Chunk(struct disk *d, daddr_t offset, daddr_t size, chunk_e type, - int subtype, u_long flags, const char *sname) -{ - int i; - -#ifndef __ia64__ - if (!(flags & CHUNK_FORCE_ALL)) { - daddr_t l; -#ifdef PC98 - /* Never use the first cylinder */ - if (!offset) { - offset += (d->bios_sect * d->bios_hd); - size -= (d->bios_sect * d->bios_hd); - } -#else - /* Never use the first track */ - if (!offset) { - offset += d->bios_sect; - size -= d->bios_sect; - } -#endif /* PC98 */ - - /* Always end on cylinder boundary */ - l = (offset + size) % (d->bios_sect * d->bios_hd); - size -= l; - } -#endif - - i = Add_Chunk(d, offset, size, "X", type, subtype, flags, sname); - Fixup_Names(d); - return i; -} - -struct chunk * -Create_Chunk_DWIM(struct disk *d, struct chunk *parent, daddr_t size, - chunk_e type, int subtype, u_long flags) -{ - int i; - struct chunk *c1; - daddr_t offset; - - if (!parent) - parent = d->chunks; - - if ((parent->type == freebsd && type == part && parent->part == NULL) - || (parent->type == apple && type == part && parent->part == NULL)) { - c1 = New_Chunk(); - if (c1 == NULL) - return (NULL); - c1->disk = parent->disk; - c1->offset = parent->offset; - c1->size = parent->size; - c1->end = parent->offset + parent->size - 1; - c1->type = unused; - if (parent->sname != NULL) - c1->sname = strdup(parent->sname); - c1->name = strdup("-"); - parent->part = c1; - } - - for (c1 = parent->part; c1; c1 = c1->next) { - if (c1->type != unused) - continue; - if (c1->size < size) - continue; - offset = c1->offset; - goto found; - } - return 0; -found: - i = Add_Chunk(d, offset, size, "X", type, subtype, flags, "-"); - if (i) - return 0; - Fixup_Names(d); - for (c1 = parent->part; c1; c1 = c1->next) - if (c1->offset == offset) - return c1; - /* barfout(1, "Serious internal trouble"); */ - return 0; -} diff --git a/lib/libdisk/disk.c b/lib/libdisk/disk.c deleted file mode 100644 index c00e0e7..0000000 --- a/lib/libdisk/disk.c +++ /dev/null @@ -1,411 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <inttypes.h> -#include <err.h> -#include <sys/sysctl.h> -#include <sys/stdint.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/disklabel.h> -#include <sys/uuid.h> -#include <sys/gpt.h> -#include <paths.h> -#include "libdisk.h" - -#include <ctype.h> -#include <errno.h> -#include <assert.h> -#include <uuid.h> - -const enum platform platform = -#if defined (P_DEBUG) - P_DEBUG -#elif defined (PC98) - p_pc98 -#elif defined(__i386__) - p_i386 -#elif defined(__alpha__) - p_alpha -#elif defined(__sparc64__) - p_sparc64 -#elif defined(__ia64__) - p_ia64 -#elif defined(__ppc__) - p_ppc -#elif defined(__amd64__) - p_amd64 -#elif defined(__arm__) - p_arm -#elif defined(__mips__) - p_mips -#else - IHAVENOIDEA -#endif - ; - -const char * -chunk_name(chunk_e type) -{ - switch(type) { - case unused: return ("unused"); - case mbr: return ("mbr"); - case part: return ("part"); - case gpt: return ("gpt"); - case pc98: return ("pc98"); - case sun: return ("sun"); - case freebsd: return ("freebsd"); - case fat: return ("fat"); - case spare: return ("spare"); - case efi: return ("efi"); - case apple: return ("apple"); - default: return ("??"); - } -} - -struct disk * -Open_Disk(const char *name) -{ - struct disk *d; - char *conftxt; - size_t txtsize; - int error; - - error = sysctlbyname("kern.geom.conftxt", NULL, &txtsize, NULL, 0); - if (error) { - warn("kern.geom.conftxt sysctl not available, giving up!"); - return (NULL); - } - conftxt = malloc(txtsize+1); - if (conftxt == NULL) { - warn("cannot malloc memory for conftxt"); - return (NULL); - } - error = sysctlbyname("kern.geom.conftxt", conftxt, &txtsize, NULL, 0); - if (error) { - warn("error reading kern.geom.conftxt from the system"); - free(conftxt); - return (NULL); - } - conftxt[txtsize] = '\0'; /* in case kernel bug is still there */ - d = Int_Open_Disk(name, conftxt); - free(conftxt); - - return (d); -} - -void -Debug_Disk(struct disk *d) -{ - - printf("Debug_Disk(%s)", d->name); - -#ifndef __ia64__ - printf(" bios_geom=%lu/%lu/%lu = %lu\n", - d->bios_cyl, d->bios_hd, d->bios_sect, - d->bios_cyl * d->bios_hd * d->bios_sect); -#if defined(PC98) - printf(" boot1=%p, boot2=%p, bootipl=%p, bootmenu=%p\n", - d->boot1, d->boot2, d->bootipl, d->bootmenu); -#elif defined(__i386__) || defined(__amd64__) - printf(" boot1=%p, boot2=%p, bootmgr=%p\n", - d->boot1, d->boot2, d->bootmgr); -#elif defined(__alpha__) - printf(" boot1=%p, bootmgr=%p\n", - d->boot1, d->bootmgr); -#else -/* Should be: error "Debug_Disk: unknown arch"; */ -#endif -#else /* __ia64__ */ - printf(" media size=%lu, sector size=%lu\n", d->media_size, - d->sector_size); -#endif - - Debug_Chunk(d->chunks); -} - -void -Free_Disk(struct disk *d) -{ - if (d->chunks) - Free_Chunk(d->chunks); - if (d->name) - free(d->name); -#ifdef PC98 - if (d->bootipl) - free(d->bootipl); - if (d->bootmenu) - free(d->bootmenu); -#else -#if !defined(__ia64__) - if (d->bootmgr) - free(d->bootmgr); -#endif -#endif -#if !defined(__ia64__) - if (d->boot1) - free(d->boot1); -#endif -#if defined(__i386__) || defined(__amd64__) - if (d->boot2) - free(d->boot2); -#endif - free(d); -} - -#if 0 -void -Collapse_Disk(struct disk *d) -{ - - while (Collapse_Chunk(d, d->chunks)) - ; -} -#endif - -static int -qstrcmp(const void* a, const void* b) -{ - const char *str1 = *(char* const*)a; - const char *str2 = *(char* const*)b; - - return strcmp(str1, str2); -} - -char ** -Disk_Names() -{ - int disk_cnt; - char **disks; - int error; - size_t listsize; - char *disklist, *disk1, *disk2; - - error = sysctlbyname("kern.disks", NULL, &listsize, NULL, 0); - if (error) { - warn("kern.disks sysctl not available"); - return NULL; - } - - if (listsize == 0) - return (NULL); - - disks = malloc(sizeof *disks * (1 + MAX_NO_DISKS)); - if (disks == NULL) - return NULL; - disk1 = disklist = (char *)malloc(listsize + 1); - if (disklist == NULL) { - free(disks); - return NULL; - } - memset(disks,0,sizeof *disks * (1 + MAX_NO_DISKS)); - memset(disklist, 0, listsize + 1); - error = sysctlbyname("kern.disks", disklist, &listsize, NULL, 0); - if (error || disklist[0] == 0) { - free(disklist); - free(disks); - return NULL; - } - for (disk_cnt = 0; disk_cnt < MAX_NO_DISKS; disk_cnt++) { - disk2 = strsep(&disk1, " "); - if (disk2 == NULL) - break; - disks[disk_cnt] = strdup(disk2); - if (disks[disk_cnt] == NULL) { - for (disk_cnt--; disk_cnt >= 0; disk_cnt--) - free(disks[disk_cnt]); - free(disklist); - free(disks); - return (NULL); - } - } - qsort(disks, disk_cnt, sizeof(char*), qstrcmp); - free(disklist); - return disks; -} - -#ifdef PC98 -void -Set_Boot_Mgr(struct disk *d, const u_char *bootipl, const size_t bootipl_size, - const u_char *bootmenu, const size_t bootmenu_size) -#else -void -Set_Boot_Mgr(struct disk *d, const u_char *b, const size_t s) -#endif -{ -#if !defined(__ia64__) -#ifdef PC98 - if (d->sector_size == 0) - return; - if (bootipl_size % d->sector_size != 0) - return; - if (d->bootipl) - free(d->bootipl); - if (!bootipl) { - d->bootipl = NULL; - } else { - d->bootipl_size = bootipl_size; - d->bootipl = malloc(bootipl_size); - if (!d->bootipl) - return; - memcpy(d->bootipl, bootipl, bootipl_size); - } - - if (bootmenu_size % d->sector_size != 0) - return; - if (d->bootmenu) - free(d->bootmenu); - if (!bootmenu) { - d->bootmenu = NULL; - } else { - d->bootmenu_size = bootmenu_size; - d->bootmenu = malloc(bootmenu_size); - if (!d->bootmenu) - return; - memcpy(d->bootmenu, bootmenu, bootmenu_size); - } -#else - if (d->sector_size == 0) - return; - if (s % d->sector_size != 0) - return; - if (d->bootmgr) - free(d->bootmgr); - if (!b) { - d->bootmgr = NULL; - } else { - d->bootmgr_size = s; - d->bootmgr = malloc(s); - if (!d->bootmgr) - return; - memcpy(d->bootmgr, b, s); - } -#endif -#endif -} - -int -Set_Boot_Blocks(struct disk *d, const u_char *b1, const u_char *b2) -{ -#if defined(__i386__) || defined(__amd64__) - if (d->boot1) - free(d->boot1); - d->boot1 = malloc(512); - if (!d->boot1) - return -1; - memcpy(d->boot1, b1, 512); - if (d->boot2) - free(d->boot2); - d->boot2 = malloc(15 * 512); - if (!d->boot2) - return -1; - memcpy(d->boot2, b2, 15 * 512); -#elif defined(__alpha__) - if (d->boot1) - free(d->boot1); - d->boot1 = malloc(15 * 512); - if (!d->boot1) - return -1; - memcpy(d->boot1, b1, 15 * 512); -#elif defined(__sparc64__) - if (d->boot1 != NULL) - free(d->boot1); - d->boot1 = malloc(16 * 512); - if (d->boot1 == NULL) - return (-1); - memcpy(d->boot1, b1, 16 * 512); -#elif defined(__ia64__) - /* nothing */ -#else -/* Should be: #error "Set_Boot_Blocks: unknown arch"; */ -#endif - return 0; -} - -const char * -slice_type_name( int type, int subtype ) -{ - - switch (type) { - case whole: - return "whole"; - case mbr: - switch (subtype) { - case 1: return "fat (12-bit)"; - case 2: return "XENIX /"; - case 3: return "XENIX /usr"; - case 4: return "fat (16-bit,<=32Mb)"; - case 5: return "extended DOS"; - case 6: return "fat (16-bit,>32Mb)"; - case 7: return "NTFS/HPFS/QNX"; - case 8: return "AIX bootable"; - case 9: return "AIX data"; - case 10: return "OS/2 bootmgr"; - case 11: return "fat (32-bit)"; - case 12: return "fat (32-bit,LBA)"; - case 14: return "fat (16-bit,>32Mb,LBA)"; - case 15: return "extended DOS, LBA"; - case 18: return "Compaq Diagnostic"; - case 57: return "Plan 9"; - case 77: return "QNX 4.X"; - case 78: return "QNX 4.X 2nd part"; - case 79: return "QNX 4.X 3rd part"; - case 84: return "OnTrack diskmgr"; - case 100: return "Netware 2.x"; - case 101: return "Netware 3.x"; - case 115: return "SCO UnixWare"; - case 128: return "Minix 1.1"; - case 129: return "Minix 1.5"; - case 130: return "linux_swap"; - case 131: return "ext2fs"; - case 133: return "linux extended"; - case 166: return "OpenBSD FFS"; /* 0xA6 */ - case 168: return "Mac OS-X"; - case 169: return "NetBSD FFS"; /* 0xA9 */ - case 171: return "Mac OS-X Boot"; - case 182: return "OpenBSD"; /* dedicated */ - case 183: return "bsd/os"; - case 184: return "bsd/os swap"; - case 191: return "Solaris (new)"; - case 238: return "EFI GPT"; - case 239: return "EFI Sys. Part."; - default: return "unknown"; - } - case fat: - return "fat"; - case freebsd: - switch (subtype) { -#ifdef PC98 - case 0xc494: return "freebsd"; -#else - case 165: return "freebsd"; -#endif - default: return "unknown"; - } - case extended: - return "extended"; - case part: - return "part"; - case efi: - return "efi"; - case unused: - return "unused"; - default: - return "unknown"; - } -} diff --git a/lib/libdisk/libdisk.3 b/lib/libdisk/libdisk.3 deleted file mode 100644 index 1b436e2..0000000 --- a/lib/libdisk/libdisk.3 +++ /dev/null @@ -1,341 +0,0 @@ -.\" -.\" Copyright (c) 1996 Joerg Wunsch -.\" -.\" All rights reserved. -.\" -.\" This program is free software. -.\" -.\" 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. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 DEVELOPERS 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. -.\" -.\" $FreeBSD$ -.\" " -.Dd January 30, 2006 -.Dt LIBDISK 3 -.Os -.Sh NAME -.Nm Open_Disk , -.Nm Free_Disk , -.Nm Debug_Disk , -.Nm Set_Bios_Geom , -.Nm Delete_Chunk , -.Nm Collapse_Disk , -.Nm Collapse_Chunk , -.Nm Create_Chunk , -.Nm All_FreeBSD , -.Nm CheckRules , -.Nm Disk_Names , -.Nm Set_Boot_Mgr , -.Nm Set_Boot_Blocks , -.Nm Write_Disk , -.Nm Cyl_Aligned , -.Nm Next_Cyl_Aligned , -.Nm Prev_Cyl_Aligned , -.Nm Track_Aligned , -.Nm Next_Track_Aligned , -.Nm Prev_Track_Aligned , -.Nm Create_Chunk_DWIM , -.Nm MakeDev , -.Nm MakeDevDisk , -.Nm ShowChunkFlags , -.Nm chunk_name , -.Nm slice_type_name -.Nd library interface to slice and partition labels -.Sh LIBRARY -.Lb libdisk -.Sh SYNOPSIS -.In sys/types.h -.In libdisk.h -.Pp -.Ft struct disk * -.Fn Open_Disk "const char *devname" -.Ft void -.Fn Free_Disk "struct disk *disk" -.Ft void -.Fn Debug_Disk "struct disk *disk" -.Ft void -.Fn Set_Bios_Geom "struct disk *disk" "u_long cyl" "u_long heads" "u_long sects" -.Ft int -.Fn Delete_Chunk "struct disk *disk" "struct chunk *" -.Ft void -.Fn Collapse_Disk "struct disk *disk" -.Ft int -.Fn Collapse_Chunk "struct disk *disk" "struct chunk *chunk" -.Ft int -.Fn Create_Chunk "struct disk *disk" "daddr_t offset" "daddr_t size" "chunk_e type" "int subtype" "u_long flags" "const char *sname" -.Ft void -.Fn All_FreeBSD "struct disk *d" "int force_all" -.Ft char * -.Fn CheckRules "const struct disk *" -.Ft char ** -.Fn Disk_Names "void" -.Ft void -.Fn Set_Boot_Mgr "struct disk *d" "const u_char *bootmgr" "const size_t bootmgr_size" -.Ft int -.Fn Set_Boot_Blocks "struct disk *d" "const u_char *boot1" "const u_char *boot2" -.Ft int -.Fn Write_Disk "const struct disk *d" -.Ft int -.Fn Cyl_Aligned "struct disk *d" "daddr_t offset" -.Ft daddr_t -.Fn Next_Cyl_Aligned "const struct disk *d" "daddr_t offset" -.Ft daddr_t -.Fn Prev_Cyl_Aligned "const struct disk *d" "daddr_t offset" -.Ft int -.Fn Track_Aligned "const struct disk *d" "daddr_t offset" -.Ft daddr_t -.Fn Next_Track_Aligned "const struct disk *d" "daddr_t offset" -.Ft daddr_t -.Fn Prev_Track_Aligned "const struct disk *d" "daddr_t offset" -.Ft struct chunk * -.Fn Create_Chunk_DWIM "struct disk *d" "struct chunk *parent" "daddr_t size" "chunk_e type" "int subtype" "u_long flags" -.Ft int -.Fn MakeDev "struct chunk *c" "const char *path" -.Ft int -.Fn MakeDevDisk "struct disk *d" "const char *path" -.Ft char * -.Fn ShowChunkFlags "struct chunk *c" -.Ft const char * -.Fn chunk_name "chunk_e type" -.Ft const char * -.Fn slice_type_name "int type" "int subtype" -.Sh DESCRIPTION -.Bf Sy -.Nm libdisk -is just for the use of -.Xr sysinstall 8 . -You should consider using -.Xr libgeom 3 -instead. -.Ef -.Pp -The -.Nm libdisk -library provides an interface to the low-level disk slice and partition labels. -Most functions operate with arguments of the types -.Ql struct disk , -or -.Ql struct chunk . -.Pp -While both types are mostly opaque to the programmer, the internal -structure is mentioned below for the sake of completeness. -.Bd -literal -offset indent -struct disk { - char *name; - u_long flags; - u_long bios_cyl; - u_long bios_hd; - u_long bios_sect; - u_char *bootmgr; - u_char *boot1; - u_char *boot2; - struct chunk *chunks; - u_long sector_size; -}; -.Ed -The only flag value by now is -.Ql DISK_ON_TRACK , -meaning that this disk is handled by the On-Track Disk Manager. -.Bd -literal -offset indent -struct chunk { - struct chunk *next; - struct chunk *part; - struct disk *disk; - daddr_t offset; - daddr_t size; - daddr_t end; - char *name; - char *oname; - chunk_e type; - int subtype; - u_long flags; - void (*private_free)(void*); - void *(*private_clone)(void*); - void *private_data; -}; -.Ed -The -.Ql type -field can be one of the following values: -.Ql whole, unknown, fat, freebsd, extended, part, unused . -.Pp -These are the valid -.Ql flags -values for a -.Ql struct chunk . -.Bl -tag -offset indent -width CHUNK_AUTO_SIZEXX -.It CHUNK_ALIGN -This chunk should be aligned. -.It CHUNK_IS_ROOT -This -.Ql part -is a rootfs, allocate partition -.Sq a . -.It CHUNK_ACTIVE -This is the active slice in the MBR. -.It CHUNK_FORCE_ALL -Force a dedicated disk for -.Fx , -bypassing all BIOS geometry considerations. -.It CHUNK_AUTO_SIZE -This chunk was auto-sized and can fill out any deleted following chunks. -.It CHUNK_NEWFS -newfs pending, used to enable auto-resizing on delete (along with AUTO_SIZE). -.El -.Pp -The -.Ql private_data , -.Ql private_free , -and -.Ql private_clone -fields are for data private to the application, and the management -thereof. -If the functions are not provided, no storage management is -done, cloning will just copy the pointer and freeing will just forget -it. -.Pp -.Fn Open_Disk -will open the named disk, and return populated tree. -.Pp -.Fn Free_Disk -frees a tree made with -.Fn Open_Disk -or -.Fn Clone_Disk . -.Pp -.Fn Debug_Disk -prints the content of the tree to -.Dv stdout . -.Pp -.Fn Set_Bios_Geom -sets the geometry the bios uses. -.Pp -.Fn Delete_Chunk -frees a chunk of disk_space. -.Pp -.Fn Collapse_Disk -and -.Fn Collapse_Chunk -are experimental, do not use. -.Pp -.Fn Create_Chunk -creates a chunk with the specified parameters. -.Pp -.Fn All_FreeBSD -makes one -.Fx -chunk covering the entire disk; if -.Ql force_all -is set, bypass all BIOS geometry considerations. -.Pp -.Fn CheckRules -returns -.Ql char* -to warnings about broken design rules in this disklayout. -.Pp -.Fn Disk_Names -returns -.Ql char** -with all disk's names (wd0, wd1 ...). -You must free each pointer, as -well as the array by hand. -.Pp -.Fn Set_Boot_Mgr -sets this boot-manager for use on this disk. -Gets written when -.Fn Write_Disk -is called. -.Pp -.Fn Set_Boot_Blocks -sets the boot-blocks for use on this disk. -Gets written when -.Fn Write_Disk -is called. -.Pp -.Fn Write_Disk -writes all the MBRs, disklabels, bootblocks and boot managers. -.Pp -.Fn Cyl_Aligned -checks if -.Ql offset -is aligned on a cylinder according to the BIOS geometry. -.Pp -.Fn Next_Cyl_Aligned -rounds -.Ql offset -up to next cylinder according to the BIOS geometry. -.Pp -.Fn Prev_Cyl_Aligned -rounds -.Ql offset -down to previous cylinder according to the BIOS geometry. -.Pp -.Fn Track_Aligned -checks if -.Ql offset -is aligned on a track according to the BIOS geometry. -.Pp -.Fn Next_Track_Aligned -rounds -.Ql offset -up to next track according to the BIOS geometry. -.Pp -.Fn Prev_Track_Aligned -rounds -.Ql offset -up to previous track according to the BIOS geometry. -.Pp -.Fn Create_Chunk_DWIM -creates a partition inside the given parent of the given size, and -returns a pointer to it. -The first unused chunk big enough is used. -.Pp -.Fn MakeDev -makes the device nodes for this chunk. -.Pp -.Fn MakeDevDisk -makes the device nodes for all chunks on this disk. -.Pp -.Fn ShowChunkFlags -returns a string to show flags. -.Pp -The -.Fn chunk_name -function takes the enumerated chunk type and returns its name. -.Fn chunk_name -replaces the old external array -.Va chunk_n . -.Pp -.Fn slice_type_name -returns the name strings associated with the specified -.Ql type . -.Ql subtype . -If -.Fn slice_type_name -returns "unknown" for slices it is not familiar with. -.Sh AUTHORS -.An -nosplit -The -.Nm libdisk -library was written by -.An Poul-Henning Kamp . -.Pp -This manual page was written by -.An J\(:org Wunsch . diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h deleted file mode 100644 index a302c64..0000000 --- a/lib/libdisk/libdisk.h +++ /dev/null @@ -1,368 +0,0 @@ -/* -* ---------------------------------------------------------------------------- -* "THE BEER-WARE LICENSE" (Revision 42): -* <phk@FreeBSD.org> wrote this file. As long as you retain this notice you -* can do whatever you want with this stuff. If we meet some day, and you think -* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp -* ---------------------------------------------------------------------------- -* -* $FreeBSD$ -* -*/ - -#ifndef _LIBDISK_H_ -#define _LIBDISK_H_ - -/* #define DEBUG 1 */ -/* You can define a particular architecture here if you are debugging. */ -/* #define P_DEBUG p_sparc64 */ - -#define MAX_NO_DISKS 32 -/* Max # of disks Disk_Names() will return */ - -#define MAX_SEC_SIZE 2048 /* maximum sector size that is supported */ -#define MIN_SEC_SIZE 512 /* the sector size to end sensing at */ - -enum platform { - p_any, /* for debugging ! */ - p_alpha, - p_i386, - p_pc98, - p_sparc64, - p_ia64, - p_ppc, - p_amd64, - p_arm, - p_mips -}; -extern const enum platform platform; - -typedef enum { - whole, - unknown, - - sun, - pc98, - mbr, - gpt, - - efi, - fat, - freebsd, - extended, - part, - spare, - unused, - - apple -} chunk_e; - -__BEGIN_DECLS -#ifndef __ia64__ -struct disk { - char *name; - u_long bios_cyl; - u_long bios_hd; - u_long bios_sect; -#ifdef PC98 - u_char *bootipl; - size_t bootipl_size; - u_char *bootmenu; - size_t bootmenu_size; -#else - u_char *bootmgr; - size_t bootmgr_size; -#endif - u_char *boot1; -#if defined(__i386__) || defined(__amd64__) /* the i386 needs extra help... */ - u_char *boot2; -#endif - struct chunk *chunks; - u_long sector_size; /* media sector size, a power of 2 */ -}; -#else /* !__ia64__ */ -struct disk { - char *name; - struct chunk *chunks; - u_long media_size; - u_long sector_size; - u_long lba_start; - u_long lba_end; - u_int gpt_size; /* Number of entries */ -}; -#endif - -struct chunk { - struct chunk *next; - struct chunk *part; - struct disk *disk; - daddr_t offset; - daddr_t size; - daddr_t end; - char *sname; /* PC98 field */ - char *name; - char *oname; - /* Used during Fixup_Names() to avoid renaming more than - * absolutely needed. - */ - chunk_e type; - int subtype; - u_long flags; - void (*private_free)(void*); - void *(*private_clone)(void*); - void *private_data; - /* For data private to the application, and the management - * thereof. If the functions are not provided, no storage - * management is done, Cloning will just copy the pointer - * and freeing will just forget it. - */ -}; - -/* - * flags: - * - * ALIGN - This chunk should be aligned - * IS_ROOT - This 'part' is a rootfs, allocate 'a' - * ACTIVE - This is the active slice in the MBR - * FORCE_ALL - Force a dedicated disk for FreeBSD, bypassing - * all BIOS geometry considerations - * AUTO_SIZE - This chunk was auto-sized and can fill-out a - * following chunk if the following chunk is deleted. - * NEWFS - newfs pending, used to enable auto-resizing on - * delete (along with AUTO_SIZE). - */ - -#define CHUNK_ALIGN 0x0008 -#define CHUNK_IS_ROOT 0x0010 -#define CHUNK_ACTIVE 0x0020 -#define CHUNK_FORCE_ALL 0x0040 -#define CHUNK_AUTO_SIZE 0x0080 -#define CHUNK_NEWFS 0x0100 -#define CHUNK_HAS_INDEX 0x0200 -#define CHUNK_ITOF(i) ((i & 0xFFFF) << 16) -#define CHUNK_FTOI(f) ((f >> 16) & 0xFFFF) - -#define DELCHUNK_NORMAL 0x0000 -#define DELCHUNK_RECOVER 0x0001 - -const char *chunk_name(chunk_e); - -const char * -slice_type_name(int, int); -/* "chunk_n" for subtypes too */ - -struct disk * -Open_Disk(const char *); -/* Will open the named disk, and return populated tree. */ - -void -Free_Disk(struct disk *); -/* Free a tree made with Open_Disk() or Clone_Disk() */ - -void -Debug_Disk(struct disk *); -/* Print the content of the tree to stdout */ - -void -Set_Bios_Geom(struct disk *, u_long, u_long, u_long); -/* Set the geometry the bios uses. */ - -void -Sanitize_Bios_Geom(struct disk *); -/* Set the bios geometry to something sane */ - -int -Insert_Chunk(struct chunk *, daddr_t, daddr_t, const char *, chunk_e, int, - u_long, const char *); - -int -Delete_Chunk2(struct disk *, struct chunk *, int); -/* Free a chunk of disk_space modified by the passed flags. */ - -int -Delete_Chunk(struct disk *, struct chunk *); -/* Free a chunk of disk_space */ - -void -Collapse_Disk(struct disk *); -/* Experimental, do not use. */ - -int -Collapse_Chunk(struct disk *, struct chunk *); -/* Experimental, do not use. */ - -int -Create_Chunk(struct disk *, daddr_t, daddr_t, chunk_e, int, u_long, const char *); -/* Create a chunk with the specified paramters */ - -void -All_FreeBSD(struct disk *, int); -/* - * Make one FreeBSD chunk covering the entire disk; - * if force_all is set, bypass all BIOS geometry - * considerations. - */ - -char * -CheckRules(const struct disk *); -/* Return char* to warnings about broken design rules in this disklayout */ - -char ** -Disk_Names(void); -/* - * Return char** with all disk's names (wd0, wd1 ...). You must free - * each pointer, as well as the array by hand - */ - -#ifdef PC98 -void -Set_Boot_Mgr(struct disk *, const u_char *, const size_t, const u_char *, - const size_t); -#else -void -Set_Boot_Mgr(struct disk *, const u_char *, const size_t); -#endif -/* - * Use this boot-manager on this disk. Gets written when Write_Disk() - * is called - */ - -int -Set_Boot_Blocks(struct disk *, const u_char *, const u_char *); -/* - * Use these boot-blocks on this disk. Gets written when Write_Disk() - * is called. Returns nonzero upon failure. - */ - -int -Write_Disk(const struct disk *); -/* Write all the MBRs, disklabels, bootblocks and boot managers */ - -daddr_t -Next_Cyl_Aligned(const struct disk *, daddr_t); -/* Round offset up to next cylinder according to the bios-geometry */ - -daddr_t -Prev_Cyl_Aligned(const struct disk *, daddr_t); -/* Round offset down to previous cylinder according to the bios-geometry */ - -int -Track_Aligned(const struct disk *, daddr_t); -/* Check if offset is aligned on a track according to the bios geometry */ - -daddr_t -Next_Track_Aligned(const struct disk *, daddr_t); -/* Round offset up to next track according to the bios-geometry */ - -daddr_t -Prev_Track_Aligned(const struct disk *, daddr_t); -/* Check if offset is aligned on a track according to the bios geometry */ - -struct chunk * -Create_Chunk_DWIM(struct disk *, struct chunk *, daddr_t, chunk_e, int, - u_long); -/* - * This one creates a partition inside the given parent of the given - * size, and returns a pointer to it. The first unused chunk big - * enough is used. - */ - -char * -ShowChunkFlags(struct chunk *); -/* Return string to show flags. */ - -/* - * Implementation details >>> DO NOT USE <<< - */ - -struct disklabel; - -void Fill_Disklabel(struct disklabel *, const struct disk *, - const struct chunk *); -void Debug_Chunk(struct chunk *); -struct chunk *New_Chunk(void); -void Free_Chunk(struct chunk *); -struct chunk *Clone_Chunk(const struct chunk *); -int Add_Chunk(struct disk *, daddr_t, daddr_t, const char *, chunk_e, int, - u_long, const char *); -void *read_block(int, daddr_t, u_long); -int write_block(int, daddr_t, const void *, u_long); -struct disklabel *read_disklabel(int, daddr_t, u_long); -struct disk *Int_Open_Disk(const char *, char *); -int Fixup_Names(struct disk *); -int MakeDevChunk(const struct chunk *, const char *); -__END_DECLS - -/* TODO - * - * Need an error string mechanism from the functions instead of warn() - * - * Make sure only FreeBSD start at offset==0 - * - * Collapse must align. - * - * Make Write_Disk(struct disk*) - * - * Consider booting from OnTrack'ed disks. - * - * Get Bios-geom, ST506 & OnTrack from driver (or otherwise) - * - * Make Create_DWIM(). - * - * Make Is_Unchanged(struct disk *d1, struct chunk *c1) - * - * don't rename slices unless we have to - * - *Sample output from tst01: - * - * Debug_Disk(wd0) flags=0 bios_geom=0/0/0 - * >> 0x3d040 0 1411200 1411199 wd0 0 whole 0 0 - * >>>> 0x3d080 0 960120 960119 wd0s1 3 freebsd 0 8 - * >>>>>> 0x3d100 0 40960 40959 wd0s1a 5 part 0 0 - * >>>>>> 0x3d180 40960 131072 172031 wd0s1b 5 part 0 0 - * >>>>>> 0x3d1c0 172032 409600 581631 wd0s1e 5 part 0 0 - * >>>>>> 0x3d200 581632 378488 960119 wd0s1f 5 part 0 0 - * >>>> 0x3d140 960120 5670 965789 wd0s2 4 extended 0 8 - * >>>>>> 0x3d2c0 960120 63 960182 - 6 unused 0 0 - * >>>>>> 0x3d0c0 960183 5607 965789 wd0s5 2 fat 0 8 - * >>>> 0x3d280 965790 1890 967679 wd0s3 1 foo -2 8 - * >>>> 0x3d300 967680 443520 1411199 wd0s4 3 freebsd 0 8 - * >>>>>> 0x3d340 967680 443520 1411199 wd0s4a 5 part 0 0 - * - * ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ - * level chunkptr start size end name type subtype flags - * - * Underlying data structure: - * - * Legend: - * <struct chunk> --> part - * | - * v next - * - * <wd0> --> <wd0s1> --> <wd0s1a> - * | | - * | v - * | <wd0s1b> - * | | - * | v - * | <wd0s1e> - * | | - * | v - * | <wd0s1f> - * | - * v - * <wd0s2> --> <unused> - * | | - * | v - * | <wd0s5> - * | - * v - * <wd0s3> - * | - * v - * <wd0s4> --> <wd0s4a> - * - * - */ - -#endif /* _LIBDISK_H_ */ diff --git a/lib/libdisk/open_disk.c b/lib/libdisk/open_disk.c deleted file mode 100644 index 6cc9acb..0000000 --- a/lib/libdisk/open_disk.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <inttypes.h> -#include <err.h> -#include <sys/sysctl.h> -#include <sys/stdint.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/disklabel.h> -#include <sys/gpt.h> -#include <paths.h> -#include "libdisk.h" - -#include <ctype.h> -#include <errno.h> -#include <assert.h> - -#ifdef DEBUG -#define DPRINT(x) warn x -#define DPRINTX(x) warnx x -#else -#define DPRINT(x) -#define DPRINTX(x) -#endif - -struct disk * -Int_Open_Disk(const char *name, char *conftxt) -{ - struct disk *d; - int i, line = 1; - char *p, *q, *r, *a, *b, *n, *t, *sn; - daddr_t o, len, off; - u_int l, s, ty, sc, hd, alt; - daddr_t lo[10]; - - /* - * Locate the disk (by name) in our sysctl output - */ - for (p = conftxt; p != NULL && *p; p = strchr(p, '\n'), line++) { - if (*p == '\n') - p++; - a = strsep(&p, " "); - /* Skip anything not with index 0 */ - if (strcmp(a, "0")) - continue; - - /* Skip anything not a disk */ - a = strsep(&p, " "); - if (strcmp(a, "DISK")) - continue; - - a = strsep(&p, " "); - if (strcmp(a, name)) - continue; - break; - } - - q = strchr(p, '\n'); - if (q != NULL) - *q++ = '\0'; - - d = (struct disk *)calloc(sizeof *d, 1); - if(d == NULL) - return NULL; - - d->name = strdup(name); - - a = strsep(&p, " "); /* length in bytes */ - len = strtoimax(a, &r, 0); - if (*r) { - printf("libdisk: Int_Open_Disk(%s): can't parse length in line %d (r='%s')\n", - name, line, r); - return NULL; - } - - a = strsep(&p, " "); /* sectorsize */ - s = strtoul(a, &r, 0); - if (*r) { - printf("libdisk: Int_Open_Disk(%s): can't parse sector size in line %d (r='%s')\n", - name, line, r); - return NULL; - } - - if (s == 0) - return (NULL); - d->sector_size = s; - len /= s; /* media size in number of sectors. */ - - if (Add_Chunk(d, 0, len, name, whole, 0, 0, "-")) { - DPRINT(("Failed to add 'whole' chunk")); - } - - /* Try to parse any fields after the sector size in the DISK entry line */ - for (;;) { - a = strsep(&p, " "); - if (a == NULL) - break; - b = strsep(&p, " "); - o = strtoimax(b, &r, 0); - if (*r) { - printf("libdisk: Int_Open_Disk(%s): can't parse parameter '%s' in line %d (r='%s')\n", - name, a, line, r); - return NULL; - } - if (!strcmp(a, "hd")) - d->bios_hd = o; - else if (!strcmp(a, "sc")) - d->bios_sect = o; - else - printf("libdisk: Int_Open_Disk(%s): unknown parameter '%s' with value '%s' in line %d, ignored\n", - name, a, b, line); - } - - /* Sanitize the parameters. */ - Sanitize_Bios_Geom(d); - - /* - * Calculate the number of cylinders this disk must have. If we have - * an obvious insanity, we set the number of cylinders to zero. - */ - o = d->bios_hd * d->bios_sect; - d->bios_cyl = (o != 0) ? len / o : 0; - - p = q; line++; /* p is now the start of the line _after_ the DISK entry */ - lo[0] = 0; - - for (; p != NULL && *p; p = q, line++) { - sn = NULL; - q = strchr(p, '\n'); - if (q != NULL) - *q++ = '\0'; - a = strsep(&p, " "); /* Index */ - /* - * If we find index 0 again, this means we've encountered another disk, so it's safe to assume this disk - * has been processed. - */ - if (!strcmp(a, "0")) - break; - l = strtoimax(a, &r, 0); - if (*r) { - printf("libdisk: Int_Open_Disk(%s): can't parse depth '%s' in line %d (r='%s')\n", - name, a, line, r); - return NULL; - - } - t = strsep(&p, " "); /* Type {SUN, BSD, MBR, PC98, GPT} */ - n = strsep(&p, " "); /* name */ - a = strsep(&p, " "); /* len */ - len = strtoimax(a, &r, 0); - if (*r) { - printf("libdisk: Int_Open_Disk(%s): can't parse length '%s' in line %d (r='%s')\n", - name, a, line, r); - continue; - } - a = strsep(&p, " "); /* secsize */ - s = strtoimax(a, &r, 0); - if (*r) { - printf("libdisk: Int_Open_Disk(%s): can't parse sector size '%s' in line %d (r='%s')\n", - name, a, line, r); - continue; - } - for (;;) { - a = strsep(&p, " "); - if (a == NULL) - break; - /* XXX: Slice name may include a space. */ - if (!strcmp(a, "sn")) { - sn = p; - break; - } - b = strsep(&p, " "); - o = strtoimax(b, &r, 0); - /* APPLE have ty as a string */ - if ((*r) && strcmp(t, "APPLE") && - strcmp(t, "GPT") && strcmp(t, "PART")) { - printf("libdisk: Int_Open_Disk(%s): can't parse parameter '%s' in line %d (r='%s')\n", - name, a, line, r); - break; - } - if (!strcmp(a, "o")) - off = o; - else if (!strcmp(a, "i")) - i = (!strcmp(t, "PART")) ? o - 1 : o; - else if (!strcmp(a, "ty")) - ty = o; - else if (!strcmp(a, "sc")) - sc = o; - else if (!strcmp(a, "hd")) - hd = o; - else if (!strcmp(a, "alt")) - alt = o; - else if (!strcmp(a, "xs")) - t = b; - else if (!strcmp(a, "xt")) { - if (*r) - sn = b; - else - ty = o; - } - } - - /* PLATFORM POLICY BEGIN ----------------------------------- */ - if (platform == p_sparc64 && !strcmp(t, "SUN") && i == 2) - continue; - if (platform == p_sparc64 && !strcmp(t, "SUN") && - d->chunks->part->part == NULL) { - d->bios_hd = hd; - d->bios_sect = sc; - o = d->chunks->size / (hd * sc); - o *= (hd * sc); - o -= alt * hd * sc; - if (Add_Chunk(d, 0, o, name, freebsd, 0, 0, "-")) { - DPRINT(("Failed to add 'freebsd' chunk")); - } - } - if (platform == p_alpha && !strcmp(t, "BSD") && - d->chunks->part->part == NULL) { - if (Add_Chunk(d, 0, d->chunks->size, name, freebsd, - 0, 0, "-")) { - DPRINT(("Failed to add 'freebsd' chunk")); - } - } - if (!strcmp(t, "BSD") && i == RAW_PART) - continue; - /* PLATFORM POLICY END ------------------------------------- */ - - off /= s; - len /= s; - off += lo[l - 1]; - lo[l] = off; - if (!strcmp(t, "SUN")) - i = Add_Chunk(d, off, len, n, part, 0, 0, 0); - else if (!strncmp(t, "MBR", 3)) { - switch (ty) { - case 0xa5: - i = Add_Chunk(d, off, len, n, freebsd, ty, 0, 0); - break; - case 0x01: - case 0x04: - case 0x06: - case 0x0b: - case 0x0c: - case 0x0e: - i = Add_Chunk(d, off, len, n, fat, ty, 0, 0); - break; - case 0xef: /* EFI */ - i = Add_Chunk(d, off, len, n, efi, ty, 0, 0); - break; - default: - i = Add_Chunk(d, off, len, n, mbr, ty, 0, 0); - break; - } - } else if (!strcmp(t, "BSD")) - i = Add_Chunk(d, off, len, n, part, ty, 0, 0); - else if (!strcmp(t, "PC98")) { - switch (ty & 0x7f) { - case 0x14: - i = Add_Chunk(d, off, len, n, freebsd, ty, 0, - sn); - break; - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - i = Add_Chunk(d, off, len, n, fat, ty, 0, sn); - break; - default: - i = Add_Chunk(d, off, len, n, pc98, ty, 0, sn); - break; - } - } else if (!strcmp(t, "GPT")) - i = Add_Chunk(d, off, len, n, gpt, 0, 0, b); - else if (!strcmp(t, "APPLE")) - i = Add_Chunk(d, off, len, n, apple, 0, 0, sn); - else - ; /* Ignore unknown classes. */ - } - /* PLATFORM POLICY BEGIN ------------------------------------- */ - /* We have a chance to do things on a blank disk here */ - if (platform == p_sparc64 && d->chunks->part->part == NULL) { - hd = d->bios_hd; - sc = d->bios_sect; - o = d->chunks->size / (hd * sc); - o *= (hd * sc); - o -= 2 * hd * sc; - if (Add_Chunk(d, 0, o, name, freebsd, 0, 0, "-")) { - DPRINT(("Failed to add 'freebsd' chunk")); - } - } - /* PLATFORM POLICY END --------------------------------------- */ - - return (d); - i = 0; -} diff --git a/lib/libdisk/open_ia64_disk.c b/lib/libdisk/open_ia64_disk.c deleted file mode 100644 index 287757d..0000000 --- a/lib/libdisk/open_ia64_disk.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (c) 2003 Marcel Moolenaar - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/disklabel.h> -#include <sys/diskmbr.h> -#include <sys/gpt.h> -#include <sys/uuid.h> - -#include <fcntl.h> -#include <inttypes.h> -#include <paths.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#include "libdisk.h" - -static struct disk * -parse_disk(char *conftxt, const char *name) -{ - char devname[64]; - struct disk *disk; - struct dos_partition *part; - struct gpt_hdr *gpt; - char *buffer, *p, *q; - int fd, i; - - disk = (struct disk *)calloc(sizeof *disk, 1); - if (disk == NULL) - return (NULL); - - disk->name = strdup(name); - p = strsep(&conftxt, " "); /* media size */ - disk->media_size = strtoimax(p, &q, 0); - if (*q) - goto fail; - - p = strsep(&conftxt, " "); /* sector size */ - disk->sector_size = strtoul(p, &q, 0); - if (*q) - goto fail; - - if (disk->sector_size == 0) - disk->sector_size = 512; - - if (disk->media_size % disk->sector_size) - goto fail; - - /* - * We need to read the disk to get GPT specific information. - */ - - snprintf(devname, sizeof(devname), "%s%s", _PATH_DEV, name); - fd = open(devname, O_RDONLY); - if (fd == -1) - goto fail; - buffer = malloc(2 * disk->sector_size); - if (buffer == NULL) { - close (fd); - goto fail; - } - if (read(fd, buffer, 2 * disk->sector_size) == -1) { - free(buffer); - close(fd); - goto fail; - } - close(fd); - - gpt = (struct gpt_hdr *)(buffer + disk->sector_size); - if (memcmp(gpt->hdr_sig, GPT_HDR_SIG, sizeof(gpt->hdr_sig))) { - /* - * No GPT present. Check if the MBR is empty (if present) - * or is a PMBR before declaring this disk as empty. If - * the MBR isn't empty, bail out. Let's not risk nuking a - * disk. - */ - if (*(u_short *)(buffer + DOSMAGICOFFSET) == DOSMAGIC) { - for (i = 0; i < 4; i++) { - part = (struct dos_partition *) - (buffer + DOSPARTOFF + i * DOSPARTSIZE); - if (part->dp_typ != 0 && - part->dp_typ != DOSPTYP_PMBR) - break; - } - if (i < 4) { - free(buffer); - goto fail; - } - } - disk->gpt_size = 128; - disk->lba_start = (disk->gpt_size * sizeof(struct gpt_ent)) / - disk->sector_size + 2; - disk->lba_end = (disk->media_size / disk->sector_size) - - disk->lba_start; - } else { - disk->lba_start = gpt->hdr_lba_start; - disk->lba_end = gpt->hdr_lba_end; - disk->gpt_size = gpt->hdr_entries; - } - free(buffer); - Add_Chunk(disk, disk->lba_start, disk->lba_end - disk->lba_start + 1, - name, whole, 0, 0, "-"); - return (disk); - -fail: - free(disk->name); - free(disk); - return (NULL); -} - -struct disk * -Int_Open_Disk(const char *name, char *conftxt) -{ - struct chunk chunk; - struct disk *disk; - char *p, *q, *r, *s, *sd; - u_long i; - - p = conftxt; - while (p != NULL && *p != 0) { - q = strsep(&p, " "); - if (strcmp(q, "0") == 0) { - q = strsep(&p, " "); - if (strcmp(q, "DISK") == 0) { - q = strsep(&p, " "); - if (strcmp(q, name) == 0) - break; - } - } - p = strchr(p, '\n'); - if (p != NULL && *p == '\n') - p++; - conftxt = p; - } - if (p == NULL || *p == 0) - return (NULL); - - conftxt = strchr(p, '\n'); - if (conftxt != NULL) - *conftxt++ = '\0'; - - disk = parse_disk(p, name); - if (disk == NULL) - return (NULL); - - while (conftxt != NULL && *conftxt != 0) { - p = conftxt; - conftxt = strchr(p, '\n'); - if (conftxt != NULL) - *conftxt++ = '\0'; - - /* - * 1 PART da0p4 34359738368 512 - * i 4 o 52063912960 ty freebsd-ufs - * xs GPT xt 516e7cb6-6ecf-11d6-8ff8-00022d09712b - */ - sd = strsep(&p, " "); /* depth */ - if (strcmp(sd, "0") == 0) - break; - - q = strsep(&p, " "); /* type */ - if (strcmp(q, "PART") != 0) - continue; - - chunk.name = strsep(&p, " "); /* name */ - - q = strsep(&p, " "); /* length */ - i = strtoimax(q, &r, 0); - if (*r) - abort(); - chunk.end = i / disk->sector_size; - - q = strsep(&p, " "); /* sector size */ - - for (;;) { - q = strsep(&p, " "); - if (q == NULL) - break; - r = strsep(&p, " "); - i = strtoimax(r, &s, 0); - if (strcmp(q, "ty") == 0 && *s != '\0') { - if (!strcmp(r, "efi")) - chunk.type = efi; - else if (!strcmp(r, "freebsd")) { - chunk.type = freebsd; - chunk.subtype = 0xa5; - } else if (!strcmp(r, "freebsd-swap")) { - chunk.type = part; - chunk.subtype = FS_SWAP; - } else if (!strcmp(r, "freebsd-ufs")) { - chunk.type = part; - chunk.subtype = FS_BSDFFS; - } else { - chunk.type = part; - chunk.subtype = FS_OTHER; - } - } else { - if (!strcmp(q, "o")) - chunk.offset = i / disk->sector_size; - else if (!strcmp(q, "i")) - chunk.flags = CHUNK_ITOF(i) | - CHUNK_HAS_INDEX; - } - } - - Add_Chunk(disk, chunk.offset, chunk.end, chunk.name, - chunk.type, chunk.subtype, chunk.flags, 0); - } - - return (disk); -} diff --git a/lib/libdisk/rules.c b/lib/libdisk/rules.c deleted file mode 100644 index 1f12f4c..0000000 --- a/lib/libdisk/rules.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/stdint.h> -#include <sys/disklabel.h> -#ifdef PC98 -#include <sys/diskpc98.h> -#else -#include <sys/diskmbr.h> -#endif -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include "libdisk.h" - -int -Track_Aligned(const struct disk *d, daddr_t offset) -{ -#ifndef __ia64__ - if (!d->bios_sect) - return 1; - if (offset % d->bios_sect) - return 0; -#endif /* __ia64__ */ - return 1; -} - -daddr_t -Prev_Track_Aligned(const struct disk *d, daddr_t offset) -{ -#ifndef __ia64__ - if (!d->bios_sect) - return offset; - return (offset / d->bios_sect) * d->bios_sect; -#else - return 1; -#endif -} - -daddr_t -Next_Track_Aligned(const struct disk *d, daddr_t offset) -{ -#ifndef __ia64__ - if (!d->bios_sect) - return offset; - return Prev_Track_Aligned(d, offset + d->bios_sect-1); -#else - return 1; -#endif -} - -static int -Cyl_Aligned(const struct disk *d, daddr_t offset) -{ -#ifndef __ia64__ - if (!d->bios_sect || !d->bios_hd) - return 1; - if (offset % (d->bios_sect * d->bios_hd)) - return 0; -#endif - return 1; -} - -daddr_t -Prev_Cyl_Aligned(const struct disk *d, daddr_t offset) -{ -#ifndef __ia64__ - if (!d->bios_sect || !d->bios_hd) - return offset; - return (offset / (d->bios_sect * d->bios_hd)) * d->bios_sect * - d->bios_hd; -#else - return 1; -#endif -} - -daddr_t -Next_Cyl_Aligned(const struct disk *d, daddr_t offset) -{ -#ifndef __ia64__ - if (!d->bios_sect || !d->bios_hd) - return offset; - return Prev_Cyl_Aligned(d,offset + (d->bios_sect * d->bios_hd) - 1); -#else - return 1; -#endif -} - -/* - * Rule#0: - * Chunks of type 'whole' can have max NDOSPART children. - * Only one of them can have the "active" flag - */ -static void -Rule_000(__unused const struct disk *d, const struct chunk *c, char *msg) -{ -#ifdef PC98 - int i = 0; -#else - int i = 0, j = 0; -#endif - struct chunk *c1; - - if (c->type != whole) - return; - for (c1 = c->part; c1; c1 = c1->next) { - if (c1->type != unused) - continue; -#ifndef PC98 - if (c1->flags & CHUNK_ACTIVE) - j++; -#endif - i++; - } - if (i > NDOSPART) - sprintf(msg + strlen(msg), - "%d is too many children of the 'whole' chunk." - " Max is %d\n", i, NDOSPART); -#ifndef PC98 - if (j > 1) - sprintf(msg + strlen(msg), - "Too many active children of 'whole'"); -#endif -} - -/* - * Rule#1: - * All children of 'whole' and 'extended' must be track-aligned. - * Exception: the end can be unaligned if it matches the end of 'whole' - */ -static void -Rule_001(const struct disk *d, const struct chunk *c, char *msg) -{ - struct chunk *c1; - - if (c->type != whole && c->type != extended) - return; - for (c1 = c->part; c1; c1 = c1->next) { - if (c1->type == unused) - continue; - c1->flags |= CHUNK_ALIGN; -#ifdef PC98 - if (!Cyl_Aligned(d, c1->offset)) -#else - if (!Track_Aligned(d, c1->offset)) -#endif - sprintf(msg + strlen(msg), -#ifdef PC98 - "chunk '%s' [%jd..%jd] does not start" - " on a cylinder boundary\n", -#else - "chunk '%s' [%jd..%jd] does not start" - " on a track boundary\n", -#endif - c1->name, (intmax_t)c1->offset, (intmax_t)c1->end); - if ((c->type == whole || c->end == c1->end) - || Cyl_Aligned(d, c1->end + 1)) - ; - else - sprintf(msg + strlen(msg), - "chunk '%s' [%jd..%jd] does not end" - " on a cylinder boundary\n", - c1->name, (intmax_t)c1->offset, (intmax_t)c1->end); - } -} - -/* - * Rule#2: - * Max one 'fat' as child of 'whole' - */ -static void -Rule_002(__unused const struct disk *d, const struct chunk *c, char *msg) -{ - int i; - struct chunk *c1; - - if (c->type != whole) - return; - for (i = 0, c1 = c->part; c1; c1 = c1->next) { - if (c1->type != fat) - continue; - i++; - } - if (i > 1) { - sprintf(msg + strlen(msg), - "Max one 'fat' allowed as child of 'whole'\n"); - } -} - -/* - * Rule#3: - * Max one extended as child of 'whole' - */ -static void -Rule_003(__unused const struct disk *d, const struct chunk *c, char *msg) -{ - int i; - struct chunk *c1; - - if (c->type != whole) - return; - for (i = 0, c1 = c->part; c1; c1 = c1->next) { - if (c1->type != extended) - continue; - i++; - } - if (i > 1) { - sprintf(msg + strlen(msg), - "Max one 'extended' allowed as child of 'whole'\n"); - } -} - -/* - * Rule#4: - * Max seven 'part' as children of 'freebsd' - * Max one CHUNK_IS_ROOT child per 'freebsd' - */ -static void -Rule_004(__unused const struct disk *d, const struct chunk *c, char *msg) -{ - int i = 0, k = 0; - struct chunk *c1; - - if (c->type != freebsd) - return; - - for (c1 = c->part; c1; c1 = c1->next) { - if (c1->type != part) - continue; - if (c1->flags & CHUNK_IS_ROOT) - k++; - i++; - } - if (i > 7) { - sprintf(msg + strlen(msg), - "Max seven partitions per freebsd slice\n"); - } - if (k > 1) { - sprintf(msg + strlen(msg), - "Max one root partition child per freebsd slice\n"); - } -} - -static void -Check_Chunk(const struct disk *d, const struct chunk *c, char *msg) -{ - - switch (platform) { - case p_i386: - case p_amd64: - Rule_000(d, c, msg); - Rule_001(d, c, msg); - Rule_002(d, c, msg); - Rule_003(d, c, msg); - Rule_004(d, c, msg); - if (c->part) - Check_Chunk(d, c->part, msg); - if (c->next) - Check_Chunk(d, c->next, msg); - break; - case p_pc98: - Rule_000(d, c, msg); - Rule_001(d, c, msg); - Rule_004(d, c, msg); - if (c->part) - Check_Chunk(d, c->part, msg); - if (c->next) - Check_Chunk(d, c->next, msg); - break; - default: - break; - } -} - -char * -CheckRules(const struct disk *d) -{ - char msg[BUFSIZ]; - - *msg = '\0'; - Check_Chunk(d, d->chunks, msg); - if (*msg) - return strdup(msg); - return 0; -} diff --git a/lib/libdisk/tst01.c b/lib/libdisk/tst01.c deleted file mode 100644 index 7bb7579..0000000 --- a/lib/libdisk/tst01.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <err.h> -#ifdef READLINE -#include <readline/readline.h> -#include <readline/history.h> -#endif -#include <sys/types.h> -#include <paths.h> -#include "libdisk.h" - -#ifndef PC98 -u_char mbrboot[] = { -250,51,192,142,208,188,0,124,139,244,80,7,80,31,251,252,191,0,6,185,0,1, -242,165,234,29,6,0,0,190,190,7,179,4,128,60,128,116,14,128,60,0,117,28, -131,198,16,254,203,117,239,205,24,139,20,139,76,2,139,238,131,198,16,254, -203,116,26,128,60,0,116,244,190,139,6,172,60,0,116,11,86,187,7,0,180,14, -205,16,94,235,240,235,254,191,5,0,187,0,124,184,1,2,87,205,19,95,115,12, -51,192,205,19,79,117,237,190,163,6,235,211,190,194,6,191,254,125,129,61, -85,170,117,199,139,245,234,0,124,0,0,73,110,118,97,108,105,100,32,112,97, -114,116,105,116,105,111,110,32,116,97,98,108,101,0,69,114,114,111,114,32, -108,111,97,100,105,110,103,32,111,112,101,114,97,116,105,110,103,32,115, -121,115,116,101,109,0,77,105,115,115,105,110,103,32,111,112,101,114,97, -116,105,110,103,32,115,121,115,116,101,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128, -1,1,0,4,15,63,60,63,0,0,0,241,239,0,0,0,0,1,61,5,15,63,243,48,240,0,0,144, -208,2,0,0,0,1,244,165,15,63,170,192,192,3,0,144,208,2,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,85,170 -}; - -u_char bteasy17[] = { -51,192,142,192,142,216,142,208,188,0,124,252,139,244,191,0,6,185,0,1,242, -165,234,96,6,0,0,139,213,88,162,72,7,60,53,116,28,180,16,246,228,5,174, -4,150,246,68,4,255,116,62,198,4,128,232,218,0,138,116,1,139,76,2,235,8, -232,207,0,185,1,0,50,209,187,0,124,184,1,2,205,19,114,30,129,191,254,1, -85,170,117,22,234,0,124,0,0,128,250,129,116,2,178,128,139,234,66,128,242, -179,136,22,58,7,191,190,7,185,4,0,198,6,45,7,49,50,246,136,45,138,69,4, -60,0,116,35,60,5,116,31,254,198,190,42,7,232,113,0,190,72,7,70,70,139,28, -10,255,116,5,50,125,4,117,243,141,183,114,7,232,90,0,131,199,16,254,6,45, -7,226,203,128,62,117,4,2,116,11,190,59,7,10,246,117,10,205,24,235,172,190, -42,7,232,57,0,232,54,0,50,228,205,26,139,218,131,195,96,180,1,205,22,180, -0,117,11,205,26,59,211,114,242,160,72,7,235,10,205,22,138,196,60,28,116, -243,4,246,60,49,114,214,60,53,119,210,80,190,40,7,187,27,6,83,252,172,80, -36,127,180,14,205,16,88,168,128,116,242,195,86,184,1,3,187,0,6,185,1,0, -50,246,205,19,94,198,6,72,7,63,195,13,138,13,10,70,48,32,46,32,46,32,46, -160,100,105,115,107,32,49,13,10,10,68,101,102,97,117,108,116,58,32,70,63, -160,0,1,0,4,0,6,3,7,7,10,10,99,14,100,14,101,20,128,20,129,25,130,30,147, -36,165,39,159,43,117,47,82,47,219,50,64,55,242,61,0,100,111,243,72,80,70, -211,79,115,178,85,110,105,248,78,111,118,101,108,236,77,105,110,105,248, -76,105,110,117,248,65,109,111,101,98,225,66,83,196,66,83,68,233,80,67,73, -216,67,80,205,86,101,110,105,248,68,111,115,115,101,227,63,191,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,85,170 -}; -#endif - -int -scan_block(int fd, daddr_t block) -{ - u_char foo[512]; - - if (-1 == lseek(fd, (off_t)block * 512, SEEK_SET)) - err(1, "lseek"); - if (512 != read(fd, foo, 512)) - return 1; - return 0; -} - -void -Scan_Disk(struct disk *d) -{ - char device[64]; - u_long l; - int i, j, fd; - - strcpy(device, _PATH_DEV); - strcat(device, d->name); - - fd = open(device, O_RDWR); - if (fd < 0) { - warn("open(%s) failed", device); - return; - } - for (i = -1, l = 0; ; l++) { - j = scan_block(fd, l); - if (j != i) { - if (i == -1) { - printf("%c: %lu.",j ? 'B' : 'G', l); - fflush(stdout); - } else if (i == 0) { - printf(".%lu\nB: %lu.", l - 1, l); - fflush(stdout); - } else { - printf(".%lu\nG: %lu.", l - 1, l); - fflush(stdout); - } - i = j; - } - } - close(fd); -} - -int -main(int argc, char **argv) -{ - struct disk *d,*db; - char myprompt[BUFSIZ]; -#ifndef READLINE - char input[BUFSIZ]; -#endif - char *p,*q = 0; - char **cp, *cmds[200]; - int ncmd, i; - - if (argc < 2) { - fprintf(stderr, "Usage:\n\t%s diskname\n", argv[0]); - exit(1); - } - d = Open_Disk(argv[1]); - if (!d) - err(1, "Couldn't open disk %s", argv[1]); - - sprintf(myprompt, "%s %s> ", argv[0], argv[1]); - while (1) { - printf("--==##==--\n"); - p = CheckRules(d); - Debug_Disk(d); - if (p) { - printf("%s",p); - free(p); - } -#ifdef READLINE - if (q) - free(q); - q = p = readline(myprompt); -#else - printf("%s", myprompt); - fflush(stdout); - q = p = fgets(input, sizeof(input), stdin); -#endif - if(!p) - break; - for (cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;) - if (**cp != '\0') - cp++; - ncmd = cp - cmds; - if (!ncmd) - continue; - if (!strcasecmp(*cmds, "quit")) - break; - if (!strcasecmp(*cmds, "exit")) - break; - if (!strcasecmp(*cmds, "q")) - break; - if (!strcasecmp(*cmds, "x")) - break; - if (!strcasecmp(*cmds, "dwim") && ncmd == 6) { - printf("dwim = %p\n", - Create_Chunk_DWIM(d, - (struct chunk *)strtol(cmds[1], 0, 0), - strtol(cmds[2], 0, 0), - strtol(cmds[3], 0, 0), - strtol(cmds[4], 0, 0), - strtol(cmds[5], 0, 0))); - continue; - } - if (!strcasecmp(*cmds, "delete") && ncmd == 2) { - printf("delete = %d\n", - Delete_Chunk(d, - (struct chunk *)strtol(cmds[1], 0, 0))); - continue; - } -#ifndef __ia64__ - if (!strcasecmp(*cmds, "allfreebsd")) { - All_FreeBSD(d, 0); - continue; - } - if (!strcasecmp(*cmds, "dedicate")) { - All_FreeBSD(d, 1); - continue; - } - if (!strcasecmp(*cmds, "sanitize")) { - Sanitize_Bios_Geom(d); - continue; - } - if (!strcasecmp(*cmds, "bios") && ncmd == 4) { - Set_Bios_Geom(d, strtol(cmds[1], 0, 0), - strtol(cmds[2], 0, 0), - strtol(cmds[3], 0, 0)); - continue; - } -#endif - if (!strcasecmp(*cmds, "list")) { - cp = Disk_Names(); - printf("Disks:"); - for (i = 0; cp[i]; i++) { - printf(" %s", cp[i]); - free(cp[i]); - } - free(cp); - continue; - } -#ifdef PC98 - if (!strcasecmp(*cmds, "create") && ncmd == 7) { -#else - if (!strcasecmp(*cmds,"create") && ncmd == 6) { -#endif - - printf("Create=%d\n", - Create_Chunk(d, - strtol(cmds[1], 0, 0), - strtol(cmds[2], 0, 0), - strtol(cmds[3], 0, 0), - strtol(cmds[4], 0, 0), -#ifdef PC98 - strtol(cmds[5], 0, 0), cmds[6])); -#else - strtol(cmds[5], 0, 0), NULL)); -#endif - continue; - } - if (!strcasecmp(*cmds,"read")) { - db = d; - if (ncmd > 1) - d = Open_Disk(cmds[1]); - else - d = Open_Disk(argv[1]); - if (d) - Free_Disk(db); - else - d = db; - continue; - } - if (!strcasecmp(*cmds,"scan")) { - Scan_Disk(d); - continue; - } -#ifndef PC98 - if (!strcasecmp(*cmds,"bteasy")) { - Set_Boot_Mgr(d, bteasy17, sizeof (bteasy17)); - continue; - } - if (!strcasecmp(*cmds, "mbr")) { - Set_Boot_Mgr(d, mbrboot, sizeof (mbrboot)); - continue; - } -#endif -#if 0 /* XXX boot1 undefined, fix me */ - if (!strcasecmp(*cmds, "boot")) { - Set_Boot_Blocks(d, boot1, boot2); - continue; - } -#endif - if (!strcasecmp(*cmds, "write")) { - printf("Write=%d\n", - Write_Disk(d)); - Free_Disk(d); - d = Open_Disk(argv[1]); - continue; - } - if (strcasecmp(*cmds, "help")) - printf("\007ERROR\n"); - printf("CMDS:\n"); - printf("\tallfreebsd\n"); - printf("\tdedicate\n"); - printf("\tbios cyl hd sect\n"); - printf("\tboot\n"); -#ifndef PC98 - printf("\tbteasy17\n"); -#endif -#if 0 - printf("\tcollapse [pointer]\n"); -#endif -#ifdef PC98 - printf("\tcreate offset size enum subtype flags name\n"); -#else - printf("\tcreate offset size enum subtype flags\n"); -#endif - printf("\t\tsubtype(part): swap=1, ffs=7\n"); - printf("\tdelete pointer\n"); - printf("\tlist\n"); -#ifndef PC98 - printf("\tmbr\n"); -#endif -#if 0 - printf("\tphys cyl hd sect\n"); -#endif - printf("\tquit\n"); - printf("\tread [disk]\n"); - printf("\tscan\n"); - printf("\twrite\n"); - printf("\nENUM:\n\t"); -#if 0 - for (i = 0; chunk_n[i]; i++) - printf("%d = %s%s", i, chunk_n[i], - i == 4 ? "\n\t" : " "); -#endif - printf("\n"); - - } - exit (0); -} diff --git a/lib/libdisk/write_amd64_disk.c b/lib/libdisk/write_amd64_disk.c deleted file mode 100644 index 9899258..0000000 --- a/lib/libdisk/write_amd64_disk.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/disklabel.h> -#include <sys/diskmbr.h> -#include <paths.h> -#include "libdisk.h" - -/* - * XXX: A lot of hardcoded 512s probably should be foo->sector_size; - * I'm not sure which, so I leave it like it worked before. --schweikh - */ -static int -Write_FreeBSD(int fd, const struct disk *new, const struct chunk *c1) -{ - struct disklabel *dl; - int i; - void *p; - u_char buf[BBSIZE]; - - for (i = 0; i < BBSIZE/512; i++) { - if (!(p = read_block(fd, i + c1->offset, 512))) - return (1); - memcpy(buf + 512 * i, p, 512); - free(p); - } - if (new->boot1) - memcpy(buf, new->boot1, 512); - - if (new->boot2) - memcpy(buf + 512, new->boot2, BBSIZE - 512); - - dl = (struct disklabel *)(buf + 512 * LABELSECTOR + LABELOFFSET); - Fill_Disklabel(dl, new, c1); - - for (i = 0; i < BBSIZE / 512; i++) - write_block(fd, i + c1->offset, buf + 512 * i, 512); - - return 0; -} - -static void -Write_Int32(u_int32_t *p, u_int32_t v) -{ - u_int8_t *bp = (u_int8_t *)p; - - bp[0] = (v >> 0) & 0xff; - bp[1] = (v >> 8) & 0xff; - bp[2] = (v >> 16) & 0xff; - bp[3] = (v >> 24) & 0xff; -} - -/* - * Special install-time configuration for the i386 boot0 boot manager. - */ -static void -Cfg_Boot_Mgr(u_char *mbr, int edd) -{ - - if (mbr[0x1b0] == 0x66 && mbr[0x1b1] == 0xbb) { - if (edd) - mbr[0x1bb] |= 0x80; /* Packet mode on */ - else - mbr[0x1bb] &= 0x7f; /* Packet mode off */ - } -} - -int -Write_Disk(const struct disk *d1) -{ - int fd, j; - uint i; - struct chunk *c1; - int ret = 0; - char device[64]; - u_char *mbr; - struct dos_partition *dp,work[NDOSPART]; - int s[4]; - int need_edd = 0; /* Need EDD (packet interface) */ - - strcpy(device, _PATH_DEV); - strcat(device, d1->name); - - fd = open(device, O_RDWR); - if (fd < 0) - return 1; - - memset(s, 0, sizeof s); - if (!(mbr = read_block(fd, 0, d1->sector_size))) { - close (fd); - return (1); - } - dp = (struct dos_partition *)(mbr + DOSPARTOFF); - memcpy(work, dp, sizeof work); - dp = work; - free(mbr); - for (c1 = d1->chunks->part; c1; c1 = c1->next) { - if (c1->type == unused) - continue; - if (!strcmp(c1->name, "X")) - continue; - j = c1->name[strlen(d1->name) + 1] - '1'; - if (j < 0 || j > 3) - continue; - s[j]++; - if (c1->type == freebsd) - ret += Write_FreeBSD(fd, d1, c1); - - Write_Int32(&dp[j].dp_start, c1->offset); - Write_Int32(&dp[j].dp_size, c1->size); - - i = c1->offset; - if (i >= 1024 * d1->bios_sect * d1->bios_hd) { - dp[j].dp_ssect = 0xff; - dp[j].dp_shd = 0xff; - dp[j].dp_scyl = 0xff; - need_edd++; - } else { - dp[j].dp_ssect = i % d1->bios_sect; - i -= dp[j].dp_ssect++; - i /= d1->bios_sect; - dp[j].dp_shd = i % d1->bios_hd; - i -= dp[j].dp_shd; - i /= d1->bios_hd; - dp[j].dp_scyl = i; - i -= dp[j].dp_scyl; - dp[j].dp_ssect |= i >> 2; - } -#ifdef DEBUG - printf("S:%lu = (%x/%x/%x)", c1->offset, - dp[j].dp_scyl, dp[j].dp_shd, dp[j].dp_ssect); -#endif - - i = c1->end; - dp[j].dp_esect = i % d1->bios_sect; - i -= dp[j].dp_esect++; - i /= d1->bios_sect; - dp[j].dp_ehd = i % d1->bios_hd; - i -= dp[j].dp_ehd; - i /= d1->bios_hd; - if (i > 1023) - i = 1023; - dp[j].dp_ecyl = i; - i -= dp[j].dp_ecyl; - dp[j].dp_esect |= i >> 2; -#ifdef DEBUG - printf(" E:%lu = (%x/%x/%x)\n", c1->end, - dp[j].dp_ecyl, dp[j].dp_ehd, dp[j].dp_esect); -#endif - - dp[j].dp_typ = c1->subtype; - if (c1->flags & CHUNK_ACTIVE) - dp[j].dp_flag = 0x80; - else - dp[j].dp_flag = 0; - } - j = 0; - for (i = 0; i < NDOSPART; i++) { - if (!s[i]) - memset(dp + i, 0, sizeof *dp); - if (dp[i].dp_flag) - j++; - } - if (!j) - for(i = 0; i < NDOSPART; i++) - if (dp[i].dp_typ == 0xa5) - dp[i].dp_flag = 0x80; - - if (!(mbr = read_block(fd, 0, d1->sector_size))) { - close (fd); - return (1); - } - if (d1->bootmgr) { - memcpy(mbr, d1->bootmgr, DOSPARTOFF); - Cfg_Boot_Mgr(mbr, need_edd); - } - memcpy(mbr + DOSPARTOFF, dp, sizeof *dp * NDOSPART); - mbr[512-2] = 0x55; - mbr[512-1] = 0xaa; - write_block(fd, 0, mbr, d1->sector_size); - if (d1->bootmgr && d1->bootmgr_size > d1->sector_size) - for (i = 1; i * d1->sector_size <= d1->bootmgr_size; i++) - write_block(fd, i, &d1->bootmgr[i * d1->sector_size], - d1->sector_size); - - close(fd); - return 0; -} diff --git a/lib/libdisk/write_arm_disk.c b/lib/libdisk/write_arm_disk.c deleted file mode 100644 index 5dbb0ad..0000000 --- a/lib/libdisk/write_arm_disk.c +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * Copyright (c) 2006 Olivier Houchard - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <err.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/disklabel.h> -#include <paths.h> -#include "libdisk.h" - -int -Write_Disk(const struct disk *d1) -{ - return (0); -} diff --git a/lib/libdisk/write_disk.c b/lib/libdisk/write_disk.c deleted file mode 100644 index 024981b..0000000 --- a/lib/libdisk/write_disk.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/disklabel.h> -#include <paths.h> -#include "libdisk.h" - -void -Fill_Disklabel(struct disklabel *dl, const struct disk *new, - const struct chunk *c1) -{ - struct chunk *c2; - int j; - - memset(dl, 0, sizeof *dl); - - for (c2 = c1->part; c2; c2 = c2->next) { - if (c2->type == unused) - continue; - if (!strcmp(c2->name, "X")) - continue; - j = c2->name[strlen(c2->name) - 1] - 'a'; - if (j < 0 || j >= MAXPARTITIONS || j == RAW_PART) - continue; - dl->d_partitions[j].p_size = c2->size; - dl->d_partitions[j].p_offset = c2->offset; - dl->d_partitions[j].p_fstype = c2->subtype; - } - - dl->d_bbsize = BBSIZE; - /* - * Add in defaults for superblock size, interleave, and rpms - */ - dl->d_sbsize = 0; - - strcpy(dl->d_typename, c1->name); - - dl->d_secsize = 512; - dl->d_secperunit = new->chunks->size; -#ifndef __ia64__ - dl->d_ncylinders = new->bios_cyl; - dl->d_ntracks = new->bios_hd; - dl->d_nsectors = new->bios_sect; -#endif - dl->d_secpercyl = dl->d_ntracks * dl->d_nsectors; - - dl->d_npartitions = MAXPARTITIONS; - - dl->d_type = new->name[0] == 's' || new->name[0] == 'd' || - new->name[0] == 'o' ? DTYPE_SCSI : DTYPE_ESDI; - dl->d_partitions[RAW_PART].p_size = c1->size; - dl->d_partitions[RAW_PART].p_offset = c1->offset; - dl->d_rpm = 3600; - dl->d_interleave = 1; - - dl->d_magic = DISKMAGIC; - dl->d_magic2 = DISKMAGIC; - dl->d_checksum = dkcksum(dl); -} diff --git a/lib/libdisk/write_i386_disk.c b/lib/libdisk/write_i386_disk.c deleted file mode 100644 index 15317d3..0000000 --- a/lib/libdisk/write_i386_disk.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/disklabel.h> -#include <sys/diskmbr.h> -#include <paths.h> -#include "libdisk.h" - -/* - * XXX: A lot of hardcoded 512s probably should be foo->sector_size; - * I'm not sure which, so I leave it like it worked before. --schweikh - */ -static int -Write_FreeBSD(int fd, const struct disk *new, const struct chunk *c1) -{ - struct disklabel *dl; - int i; - void *p; - u_char buf[BBSIZE]; - - for (i = 0; i < BBSIZE/512; i++) { - if (!(p = read_block(fd, i + c1->offset, 512))) - return (1); - memcpy(buf + 512 * i, p, 512); - free(p); - } - if (new->boot1) - memcpy(buf, new->boot1, 512); - - if (new->boot2) - memcpy(buf + 512, new->boot2, BBSIZE - 512); - - dl = (struct disklabel *)(buf + 512 * LABELSECTOR + LABELOFFSET); - Fill_Disklabel(dl, new, c1); - - for (i = 0; i < BBSIZE / 512; i++) - write_block(fd, i + c1->offset, buf + 512 * i, 512); - - return 0; -} - -static void -Write_Int32(u_int32_t *p, u_int32_t v) -{ - u_int8_t *bp = (u_int8_t *)p; - - bp[0] = (v >> 0) & 0xff; - bp[1] = (v >> 8) & 0xff; - bp[2] = (v >> 16) & 0xff; - bp[3] = (v >> 24) & 0xff; -} - -/* - * Special install-time configuration for the i386 boot0 boot manager. - */ -static void -Cfg_Boot_Mgr(u_char *mbrblk, int edd) -{ - - if (mbrblk[0x1b0] == 0x66 && mbrblk[0x1b1] == 0xbb) { - if (edd) - mbrblk[0x1bb] |= 0x80; /* Packet mode on */ - else - mbrblk[0x1bb] &= 0x7f; /* Packet mode off */ - } -} - -int -Write_Disk(const struct disk *d1) -{ - int fd, j; - uint i; - struct chunk *c1; - int ret = 0; - char device[64]; - u_char *mbrblk; - struct dos_partition *dp,work[NDOSPART]; - int s[4]; - int need_edd = 0; /* Need EDD (packet interface) */ - - strcpy(device, _PATH_DEV); - strcat(device, d1->name); - - fd = open(device, O_RDWR); - if (fd < 0) - return 1; - - memset(s, 0, sizeof s); - if (!(mbrblk = read_block(fd, 0, d1->sector_size))) { - close (fd); - return (1); - } - dp = (struct dos_partition *)(mbrblk + DOSPARTOFF); - memcpy(work, dp, sizeof work); - dp = work; - free(mbrblk); - for (c1 = d1->chunks->part; c1; c1 = c1->next) { - if (c1->type == unused) - continue; - if (!strcmp(c1->name, "X")) - continue; - j = c1->name[strlen(d1->name) + 1] - '1'; - if (j < 0 || j > 3) - continue; - s[j]++; - if (c1->type == freebsd) - ret += Write_FreeBSD(fd, d1, c1); - - Write_Int32(&dp[j].dp_start, c1->offset); - Write_Int32(&dp[j].dp_size, c1->size); - - i = c1->offset; - if (i >= 1024 * d1->bios_sect * d1->bios_hd) { - dp[j].dp_ssect = 0xff; - dp[j].dp_shd = 0xff; - dp[j].dp_scyl = 0xff; - need_edd++; - } else { - dp[j].dp_ssect = i % d1->bios_sect; - i -= dp[j].dp_ssect++; - i /= d1->bios_sect; - dp[j].dp_shd = i % d1->bios_hd; - i -= dp[j].dp_shd; - i /= d1->bios_hd; - dp[j].dp_scyl = i; - i -= dp[j].dp_scyl; - dp[j].dp_ssect |= i >> 2; - } -#ifdef DEBUG - printf("S:%lu = (%x/%x/%x)", c1->offset, - dp[j].dp_scyl, dp[j].dp_shd, dp[j].dp_ssect); -#endif - - i = c1->end; - dp[j].dp_esect = i % d1->bios_sect; - i -= dp[j].dp_esect++; - i /= d1->bios_sect; - dp[j].dp_ehd = i % d1->bios_hd; - i -= dp[j].dp_ehd; - i /= d1->bios_hd; - if (i > 1023) - i = 1023; - dp[j].dp_ecyl = i; - i -= dp[j].dp_ecyl; - dp[j].dp_esect |= i >> 2; -#ifdef DEBUG - printf(" E:%lu = (%x/%x/%x)\n", c1->end, - dp[j].dp_ecyl, dp[j].dp_ehd, dp[j].dp_esect); -#endif - - dp[j].dp_typ = c1->subtype; - if (c1->flags & CHUNK_ACTIVE) - dp[j].dp_flag = 0x80; - else - dp[j].dp_flag = 0; - } - j = 0; - for (i = 0; i < NDOSPART; i++) { - if (!s[i]) - memset(dp + i, 0, sizeof *dp); - if (dp[i].dp_flag) - j++; - } - if (!j) - for(i = 0; i < NDOSPART; i++) - if (dp[i].dp_typ == 0xa5) - dp[i].dp_flag = 0x80; - - if (!(mbrblk = read_block(fd, 0, d1->sector_size))) { - close (fd); - return (1); - } - if (d1->bootmgr) { - memcpy(mbrblk, d1->bootmgr, DOSPARTOFF); - Cfg_Boot_Mgr(mbrblk, need_edd); - } - memcpy(mbrblk + DOSPARTOFF, dp, sizeof *dp * NDOSPART); - mbrblk[512-2] = 0x55; - mbrblk[512-1] = 0xaa; - write_block(fd, 0, mbrblk, d1->sector_size); - if (d1->bootmgr && d1->bootmgr_size > d1->sector_size) - for (i = 1; i * d1->sector_size <= d1->bootmgr_size; i++) - write_block(fd, i, &d1->bootmgr[i * d1->sector_size], - d1->sector_size); - - close(fd); - return 0; -} diff --git a/lib/libdisk/write_ia64_disk.c b/lib/libdisk/write_ia64_disk.c deleted file mode 100644 index 6a57322..0000000 --- a/lib/libdisk/write_ia64_disk.c +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Copyright (c) 2003 Marcel Moolenaar - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - * - * CRC32 code derived from work by Gary S. Brown. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/disklabel.h> -#include <sys/diskmbr.h> -#include <sys/gpt.h> -#include <sys/stat.h> - -#include <errno.h> -#include <fcntl.h> -#include <paths.h> -#include <stddef.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <uuid.h> - -#include "libdisk.h" - -static uuid_t _efi = GPT_ENT_TYPE_EFI; -static uuid_t _fbsd = GPT_ENT_TYPE_FREEBSD; -static uuid_t _swap = GPT_ENT_TYPE_FREEBSD_SWAP; -static uuid_t _ufs = GPT_ENT_TYPE_FREEBSD_UFS; - -static uint32_t crc32_tab[] = { - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, - 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, - 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, - 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, - 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, - 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, - 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, - 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, - 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, - 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, - 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, - 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, - 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, - 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, - 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, - 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, - 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, - 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, - 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, - 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, - 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, - 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, - 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, - 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, - 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, - 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, - 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, - 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, - 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, - 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, - 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, - 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, - 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d -}; - -static uint32_t -crc32(const void *buf, size_t size) -{ - const uint8_t *p; - uint32_t crc; - - p = buf; - crc = ~0U; - - while (size--) - crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8); - - return (crc ^ ~0U); -} - -static int -write_pmbr(int fd, const struct disk *disk) -{ - struct dos_partition dp; - char *buffer; - u_long nsects; - int error; - - error = 0; - nsects = disk->media_size / disk->sector_size; - nsects--; /* The GPT starts at LBA 1 */ - - buffer = calloc(disk->sector_size, 1); - if (buffer == NULL) - return (ENOMEM); - buffer[DOSMAGICOFFSET] = DOSMAGIC & 0xff; - buffer[DOSMAGICOFFSET + 1] = DOSMAGIC >> 8; - - dp.dp_flag = 0; - dp.dp_shd = dp.dp_ssect = dp.dp_scyl = 0xff; - dp.dp_typ = DOSPTYP_PMBR; - dp.dp_ehd = dp.dp_esect = dp.dp_ecyl = 0xff; - dp.dp_start = 1; - dp.dp_size = (nsects > 0xffffffffu) ? ~0u : nsects; - memcpy(buffer + DOSPARTOFF, &dp, DOSPARTSIZE); - - if (lseek(fd, 0L, SEEK_SET) != 0L || - write(fd, buffer, disk->sector_size) != disk->sector_size) - error = (errno) ? errno : EAGAIN; - - free(buffer); - return (error); -} - -static int -read_gpt(int fd, const struct disk *disk, struct gpt_hdr *hdr, - struct gpt_ent *tbl) -{ - char *buffer; - off_t off; - size_t nsects, sz; - int error, i; - - error = 0; - nsects = disk->gpt_size * sizeof(struct gpt_ent) / disk->sector_size; - nsects++; - sz = nsects * disk->sector_size; - buffer = malloc(sz); - if (buffer == NULL) - return (ENOMEM); - - if (lseek(fd, disk->sector_size, SEEK_SET) != disk->sector_size || - read(fd, buffer, disk->sector_size) != disk->sector_size) { - error = (errno) ? errno : EAGAIN; - goto bail; - } - if (memcmp(buffer, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0) { - /* - * No GPT on disk. Create one out of thin air. - */ - bzero(&hdr[0], sizeof(struct gpt_hdr)); - memcpy(hdr[0].hdr_sig, GPT_HDR_SIG, sizeof(hdr[0].hdr_sig)); - hdr[0].hdr_revision = GPT_HDR_REVISION; - hdr[0].hdr_size = offsetof(struct gpt_hdr, padding); - hdr[0].hdr_lba_self = 1; - hdr[0].hdr_lba_alt = disk->media_size / disk->sector_size - 1L; - hdr[0].hdr_lba_start = disk->lba_start; - hdr[0].hdr_lba_end = disk->lba_end; - uuid_create(&hdr[0].hdr_uuid, NULL); - hdr[0].hdr_lba_table = 2; - hdr[0].hdr_entries = disk->gpt_size; - hdr[0].hdr_entsz = sizeof(struct gpt_ent); - hdr[1] = hdr[0]; - hdr[1].hdr_lba_self = hdr[0].hdr_lba_alt; - hdr[1].hdr_lba_alt = hdr[0].hdr_lba_self; - hdr[1].hdr_lba_table = disk->lba_end + 1; - - for (i = 0; i < disk->gpt_size; i++) { - bzero(&tbl[i], sizeof(struct gpt_ent)); - uuid_create(&tbl[i].ent_uuid, NULL); - } - - goto bail; - } - - /* - * We have a GPT on disk. Read it. - */ - memcpy(&hdr[0], buffer, sizeof(struct gpt_hdr)); - off = hdr->hdr_lba_table * disk->sector_size; - if (lseek(fd, off, SEEK_SET) != off || - read(fd, buffer, sz) != sz) { - error = (errno) ? errno : EAGAIN; - goto bail; - } - memcpy(tbl, buffer, sizeof(struct gpt_ent) * disk->gpt_size); - off = hdr->hdr_lba_alt * disk->sector_size; - if (lseek(fd, off, SEEK_SET) != off || - read(fd, buffer, disk->sector_size) != disk->sector_size) { - error = (errno) ? errno : EAGAIN; - goto bail; - } - memcpy(&hdr[1], buffer, sizeof(struct gpt_hdr)); - -bail: - free(buffer); - return (error); -} - -static int -update_gpt(int fd, const struct disk *disk, struct gpt_hdr *hdr, - struct gpt_ent *tbl) -{ - struct gpt_ent *save; - char *buffer; - struct chunk *c; - off_t off; - size_t bufsz; - int error, idx, sav; - - error = 0; - - /* - * Save the entries of those chunks that have an index. They are - * the ones that exist on disk already. - */ - sav = 0; - for (c = disk->chunks->part; c != NULL; c = c->next) { - if ((c->flags & CHUNK_HAS_INDEX)) - sav++; - } - if (sav > 0) { - save = malloc(sav * sizeof(struct gpt_ent)); - if (save == NULL) - abort(); - sav = 0; - for (c = disk->chunks->part; c != NULL; c = c->next) { - if ((c->flags & CHUNK_HAS_INDEX)) { - idx = CHUNK_FTOI(c->flags); - save[sav] = tbl[idx]; - c->flags ^= CHUNK_ITOF(idx); - c->flags |= CHUNK_ITOF(sav); - sav++; - } - } - } else - save = NULL; - - /* - * Clear the table entries. - */ - for (idx = 0; idx < disk->gpt_size; idx++) { - uuid_create_nil(&tbl[idx].ent_type, NULL); - tbl[idx].ent_lba_start = 0; - tbl[idx].ent_lba_end = 0; - tbl[idx].ent_attr = 0; - bzero(tbl[idx].ent_name, sizeof(tbl[idx].ent_name)); - } - - /* - * Repopulate the table from the chunks, possibly using saved - * information. - */ - idx = 0; - for (c = disk->chunks->part; c != NULL; c = c->next) { - if (!(c->flags & CHUNK_HAS_INDEX)) { - switch (c->type) { - case freebsd: - tbl[idx].ent_type = _fbsd; - break; - case efi: - tbl[idx].ent_type = _efi; - break; - case part: - switch (c->subtype) { - case FS_SWAP: - tbl[idx].ent_type = _swap; - break; - case FS_BSDFFS: - tbl[idx].ent_type = _ufs; - break; - default: - return (EINVAL); - } - break; - default: - return (EINVAL); - } - } else { - sav = CHUNK_FTOI(c->flags); - tbl[idx].ent_type = save[sav].ent_type; - memcpy(tbl[idx].ent_name, save[sav].ent_name, - sizeof(tbl[idx].ent_name)); - } - tbl[idx].ent_lba_start = c->offset; - tbl[idx].ent_lba_end = c->end; - - idx++; - if (idx == disk->gpt_size) - return (ENOSPC); - } - if (save != NULL) - free(save); - - hdr[0].hdr_crc_table = crc32(tbl, - disk->gpt_size * sizeof(struct gpt_ent)); - hdr[0].hdr_crc_self = 0; - hdr[0].hdr_crc_self = crc32(&hdr[0], hdr[0].hdr_size); - - hdr[1].hdr_crc_table = hdr[0].hdr_crc_table; - hdr[1].hdr_crc_self = 0; - hdr[1].hdr_crc_self = crc32(&hdr[1], hdr[1].hdr_size); - - /* - * Write the new GPT back to the disk. - */ - bufsz = disk->gpt_size * sizeof(struct gpt_ent); - if (bufsz == 0 || bufsz % disk->sector_size) - bufsz += disk->sector_size; - bufsz = (bufsz / disk->sector_size) * disk->sector_size; - buffer = calloc(1, bufsz); - - memcpy(buffer, &hdr[0], sizeof(struct gpt_hdr)); - off = hdr[0].hdr_lba_self * disk->sector_size; - if (lseek(fd, off, SEEK_SET) != off || - write(fd, buffer, disk->sector_size) != disk->sector_size) { - error = (errno) ? errno : EAGAIN; - goto bail; - } - memcpy(buffer, &hdr[1], sizeof(struct gpt_hdr)); - off = hdr[1].hdr_lba_self * disk->sector_size; - if (lseek(fd, off, SEEK_SET) != off || - write(fd, buffer, disk->sector_size) != disk->sector_size) { - error = (errno) ? errno : EAGAIN; - goto bail; - } - memcpy(buffer, tbl, disk->gpt_size * sizeof(struct gpt_ent)); - off = hdr[0].hdr_lba_table * disk->sector_size; - if (lseek(fd, off, SEEK_SET) != off || - write(fd, buffer, bufsz) != bufsz) { - error = (errno) ? errno : EAGAIN; - goto bail; - } - off = hdr[1].hdr_lba_table * disk->sector_size; - if (lseek(fd, off, SEEK_SET) != off || - write(fd, buffer, bufsz) != bufsz) { - error = (errno) ? errno : EAGAIN; - goto bail; - } - -bail: - free(buffer); - return (error); -} - -int -Write_Disk(const struct disk *disk) -{ - char devname[64]; - struct gpt_hdr *hdr; - struct gpt_ent *tbl; - int error, fd; - - hdr = malloc(sizeof(struct gpt_hdr) * 2); - if (hdr == NULL) - return (ENOMEM); - tbl = malloc(sizeof(struct gpt_ent) * disk->gpt_size); - if (tbl == NULL) { - free(hdr); - return (ENOMEM); - } - - snprintf(devname, sizeof(devname), "%s%s", _PATH_DEV, disk->name); - fd = open(devname, O_RDWR); - if (fd == -1) { - free(tbl); - free(hdr); - return (errno); - } - - /* - * We can always write the PMBR, because we reject disks that do not - * have a PMBR and are not virgin. - */ - error = write_pmbr(fd, disk); - if (error) - goto bail; - - /* - * Read the existing GPT from disk or otherwise create one out of - * thin air. This way we can preserve the UUIDs and the entry names - * when updating it. - */ - error = read_gpt(fd, disk, hdr, tbl); - if (error) - goto bail; - - /* - * Update and write the in-memory copy of the GPT. - */ - error = update_gpt(fd, disk, hdr, tbl); - -bail: - close(fd); - free(tbl); - free(hdr); - return (error); -} diff --git a/lib/libdisk/write_mips_disk.c b/lib/libdisk/write_mips_disk.c deleted file mode 100644 index bd0cb87..0000000 --- a/lib/libdisk/write_mips_disk.c +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * Copyright (c) 2006 Olivier Houchard - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <err.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/disklabel.h> -#include <paths.h> -#include "libdisk.h" - -int -Write_Disk(const struct disk *d1) -{ - - return (0); -} diff --git a/lib/libdisk/write_pc98_disk.c b/lib/libdisk/write_pc98_disk.c deleted file mode 100644 index 8f2a45d..0000000 --- a/lib/libdisk/write_pc98_disk.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <err.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/disklabel.h> -#include <sys/diskpc98.h> -#include <paths.h> -#include "libdisk.h" - -/* - * XXX: A lot of hardcoded 512s probably should be foo->sector_size; - * I'm not sure which, so I leave it like it worked before. --schweikh - */ -static int -Write_FreeBSD(int fd, const struct disk *new, const struct chunk *c1) -{ - struct disklabel *dl; - int i; - void *p; - u_char buf[BBSIZE]; - - for (i = 0; i < BBSIZE / 512; i++) { - if (!(p = read_block(fd, i + c1->offset, 512))) - return (1); - memcpy(buf + 512 * i, p, 512); - free(p); - } - if (new->boot1) - memcpy(buf, new->boot1, 512); - - if (new->boot2) - memcpy(buf + 512, new->boot2, BBSIZE - 512); - - dl = (struct disklabel *)(buf + 512 * LABELSECTOR + LABELOFFSET); - Fill_Disklabel(dl, new, c1); - - for (i = 0; i < BBSIZE / 512; i++) - write_block(fd, i + c1->offset, buf + 512 * i, 512); - - return 0; -} - - -int -Write_Disk(const struct disk *d1) -{ - int fd, i, j; - struct chunk *c1; - int ret = 0; - char device[64]; - u_char *mbrblk; - struct pc98_partition *dp, work[NDOSPART]; - int s[7]; - int PC98_EntireDisk = 0; - - strcpy(device, _PATH_DEV); - strcat(device, d1->name); - - /* XXX - for entire FreeBSD(98) */ - for (c1 = d1->chunks->part; c1; c1 = c1->next) { - if ((c1->type == freebsd) || (c1->offset == 0)) - device[9] = 0; - } - - fd = open(device, O_RDWR); - if (fd < 0) { -#ifdef DEBUG - warn("open(%s) failed", device); -#endif - return 1; - } - - memset(s, 0, sizeof s); - if (!(mbrblk = read_block(fd, 1, d1->sector_size))) { - close (fd); - return (1); - } - dp = (struct pc98_partition *)(mbrblk + DOSPARTOFF); - memcpy(work, dp, sizeof work); - dp = work; - free(mbrblk); - for (c1 = d1->chunks->part; c1; c1 = c1->next) { - if (c1->type == unused) - continue; - if (!strcmp(c1->name, "X")) - continue; - j = c1->name[strlen(d1->name) + 1] - '1'; - if (j < 0 || j > 7) - continue; - s[j]++; - if (c1->type == freebsd) - ret += Write_FreeBSD(fd, d1, c1); - - i = c1->offset; - dp[j].dp_ssect = dp[j].dp_ipl_sct = i % d1->bios_sect; - i -= dp[j].dp_ssect; - i /= d1->bios_sect; - dp[j].dp_shd = dp[j].dp_ipl_head = i % d1->bios_hd; - i -= dp[j].dp_shd; - i /= d1->bios_hd; - dp[j].dp_scyl = dp[j].dp_ipl_cyl = i; -#ifdef DEBUG - printf("S:%lu = (%x/%x/%x)", c1->offset, - dp[j].dp_scyl, dp[j].dp_shd, dp[j].dp_ssect); -#endif - - i = c1->end; -#if 1 - dp[j].dp_esect = dp[j].dp_ehd = 0; - dp[j].dp_ecyl = i / (d1->bios_sect * d1->bios_hd); -#else - dp[j].dp_esect = i % d1->bios_sect; - i -= dp[j].dp_esect; - i /= d1->bios_sect; - dp[j].dp_ehd = i % d1->bios_hd; - i -= dp[j].dp_ehd; - i /= d1->bios_hd; - dp[j].dp_ecyl = i; -#endif -#ifdef DEBUG - printf(" E:%lu = (%x/%x/%x)\n", c1->end, - dp[j].dp_ecyl, dp[j].dp_ehd, dp[j].dp_esect); -#endif - - dp[j].dp_mid = c1->subtype & 0xff; - dp[j].dp_sid = c1->subtype >> 8; - if (c1->flags & CHUNK_ACTIVE) - dp[j].dp_mid |= 0x80; - - strncpy(dp[j].dp_name, c1->sname, 16); - } - j = 0; - for (i = 0; i < NDOSPART; i++) { - if (!s[i]) - memset(dp + i, 0, sizeof *dp); - } - - if (d1->bootipl) - write_block(fd, 0, d1->bootipl, d1->sector_size); - - if (!(mbrblk = read_block(fd, 1, d1->sector_size))) { - close (fd); - return (1); - } - memcpy(mbrblk + DOSPARTOFF, dp, sizeof *dp * NDOSPART); - /* XXX - for entire FreeBSD(98) */ - for (c1 = d1->chunks->part; c1; c1 = c1->next) - if (((c1->type == freebsd) || (c1->type == fat)) - && (c1->offset == 0)) - PC98_EntireDisk = 1; - if (PC98_EntireDisk == 0) - write_block(fd, 1, mbrblk, d1->sector_size); - - if (d1->bootmenu) - for (i = 0; i * d1->sector_size < d1->bootmenu_size; i++) - write_block(fd, 2 + i, - &d1->bootmenu[i * d1->sector_size], - d1->sector_size); - - close(fd); - return 0; -} diff --git a/lib/libdisk/write_powerpc_disk.c b/lib/libdisk/write_powerpc_disk.c deleted file mode 100644 index ec955e2..0000000 --- a/lib/libdisk/write_powerpc_disk.c +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * Copyright (c) 2004 Suleiman Souhlal. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <string.h> -#include <err.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/disklabel.h> -#include <paths.h> -#include "libdisk.h" - -int -Write_Disk(const struct disk *d1) -{ - /* - * We don't have to write any label, so we only check that we can - * open the disk. - */ - int fd; - char device[64]; - - strcpy(device, _PATH_DEV); - strcat(device, d1->name); - - fd = open(device, O_RDWR); - if (fd < 0) { - close(fd); - return 1; - } - - close(fd); - return 0; -} diff --git a/lib/libdisk/write_sparc64_disk.c b/lib/libdisk/write_sparc64_disk.c deleted file mode 100644 index 9832b0d..0000000 --- a/lib/libdisk/write_sparc64_disk.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <err.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/sun_disklabel.h> -#include <paths.h> -#include <errno.h> -#include "libdisk.h" - -#include "geom_sunlabel_enc.c" - -int -Write_Disk(const struct disk *d1) -{ - struct sun_disklabel *sl; - struct chunk *c, *c1, *c2; - int i; - char *p; - u_long secpercyl; - char device[64]; - u_char buf[SUN_SIZE]; - int fd; - - strcpy(device, _PATH_DEV); - strcat(device, d1->name); - - fd = open(device, O_RDWR); - if (fd < 0) { - warn("open(%s) failed", device); - return (1); - } - - sl = calloc(sizeof *sl, 1); - c = d1->chunks; - c2 = c->part; - secpercyl = d1->bios_sect * d1->bios_hd; - sl->sl_pcylinders = c->size / secpercyl; - sl->sl_ncylinders = c2->size / secpercyl; - sl->sl_acylinders = sl->sl_pcylinders - sl->sl_ncylinders; - sl->sl_magic = SUN_DKMAGIC; - sl->sl_nsectors = d1->bios_sect; - sl->sl_ntracks = d1->bios_hd; - if (c->size > 4999 * 1024 * 2) { - sprintf(sl->sl_text, "FreeBSD%luG cyl %u alt %u hd %u sec %u", - (c->size + 1024 * 1024) / (2 * 1024 * 1024), - sl->sl_ncylinders, sl->sl_acylinders, - sl->sl_ntracks, sl->sl_nsectors); - } else { - sprintf(sl->sl_text, "FreeBSD%luM cyl %u alt %u hd %u sec %u", - (c->size + 1024) / (2 * 1024), - sl->sl_ncylinders, sl->sl_acylinders, - sl->sl_ntracks, sl->sl_nsectors); - } - sl->sl_interleave = 1; - sl->sl_sparespercyl = 0; - sl->sl_rpm = 3600; - - for (c1 = c2->part; c1 != NULL; c1 = c1->next) { - p = c1->name; - p += strlen(p); - p--; - if (*p < 'a') - continue; - i = *p - 'a'; - if (i >= SUN_NPART) - continue; - sl->sl_part[i].sdkp_cyloffset = c1->offset / secpercyl; - sl->sl_part[i].sdkp_nsectors = c1->size; - for (i = 1; i < 16; i++) { - write_block(fd, c1->offset + i, d1->boot1 + (i * 512), - 512); - } - } - - /* - * We need to fill in the "RAW" partition as well. Emperical data - * seems to indicate that this covers the "obviously" visible part - * of the disk, ie: sl->sl_ncylinders. - */ - sl->sl_part[SUN_RAWPART].sdkp_cyloffset = 0; - sl->sl_part[SUN_RAWPART].sdkp_nsectors = sl->sl_ncylinders * secpercyl; - - memset(buf, 0, sizeof buf); - sunlabel_enc(buf, sl); - write_block(fd, 0, buf, sizeof buf); - - close(fd); - return 0; -} diff --git a/lib/libedit/map.c b/lib/libedit/map.c index 591118f..c70904a 100644 --- a/lib/libedit/map.c +++ b/lib/libedit/map.c @@ -1250,7 +1250,7 @@ map_bind(EditLine *el, int argc, const char **argv) char inbuf[EL_BUFSIZ]; char outbuf[EL_BUFSIZ]; const char *in = NULL; - char *out = NULL; + char *out; el_bindings_t *bp, *ep; int cmd; int key; @@ -1368,7 +1368,7 @@ map_bind(EditLine *el, int argc, const char **argv) return (-1); } if (key) - term_set_arrow(el, in, key_map_str(el, out), ntype); + term_set_arrow(el, in, key_map_cmd(el, cmd), ntype); else { if (in[1]) { key_add(el, in, key_map_cmd(el, cmd), ntype); diff --git a/lib/libutil/gr_util.c b/lib/libutil/gr_util.c index be34395..acb9767 100644 --- a/lib/libutil/gr_util.c +++ b/lib/libutil/gr_util.c @@ -44,11 +44,6 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <unistd.h> -struct group_storage { - struct group gr; - char *members[]; -}; - static int lockfd = -1; static char group_dir[PATH_MAX]; static char group_file[PATH_MAX]; @@ -106,10 +101,8 @@ gr_lock(void) for (;;) { struct stat st; - lockfd = open(group_file, O_RDONLY, 0); - if (lockfd < 0 || fcntl(lockfd, F_SETFD, 1) == -1) - err(1, "%s", group_file); - if (flock(lockfd, LOCK_EX|LOCK_NB) == -1) { + lockfd = flopen(group_file, O_RDONLY|O_NONBLOCK|O_CLOEXEC, 0); + if (lockfd == -1) { if (errno == EWOULDBLOCK) { errx(1, "the group file is busy"); } else { @@ -436,14 +429,14 @@ gr_make(const struct group *gr) struct group * gr_dup(const struct group *gr) { + struct group *newgr; char *dst; size_t len; - struct group_storage *gs; int ndx; int num_mem; /* Calculate size of the group. */ - len = sizeof(*gs); + len = sizeof(*newgr); if (gr->gr_name != NULL) len += strlen(gr->gr_name) + 1; if (gr->gr_passwd != NULL) @@ -454,30 +447,72 @@ gr_dup(const struct group *gr) len += (num_mem + 1) * sizeof(*gr->gr_mem); } else num_mem = -1; - /* Create new group and copy old group into it. */ - if ((gs = calloc(1, len)) == NULL) + if ((newgr = malloc(len)) == NULL) return (NULL); - dst = (char *)&gs->members[num_mem + 1]; + /* point new gr_mem to end of struct + 1 */ + if (gr->gr_mem != NULL) + newgr->gr_mem = (char **)(newgr + 1); + else + newgr->gr_mem = NULL; + /* point dst after the end of all the gr_mem pointers in newgr */ + dst = (char *)&newgr->gr_mem[num_mem + 1]; if (gr->gr_name != NULL) { - gs->gr.gr_name = dst; - dst = stpcpy(gs->gr.gr_name, gr->gr_name) + 1; + newgr->gr_name = dst; + dst = stpcpy(dst, gr->gr_name) + 1; + } else { + newgr->gr_name = NULL; } if (gr->gr_passwd != NULL) { - gs->gr.gr_passwd = dst; - dst = stpcpy(gs->gr.gr_passwd, gr->gr_passwd) + 1; + newgr->gr_passwd = dst; + dst = stpcpy(dst, gr->gr_passwd) + 1; + } else { + newgr->gr_passwd = NULL; } - gs->gr.gr_gid = gr->gr_gid; + newgr->gr_gid = gr->gr_gid; if (gr->gr_mem != NULL) { - gs->gr.gr_mem = gs->members; for (ndx = 0; ndx < num_mem; ndx++) { - gs->gr.gr_mem[ndx] = dst; - dst = stpcpy(gs->gr.gr_mem[ndx], gr->gr_mem[ndx]) + 1; + newgr->gr_mem[ndx] = dst; + dst = stpcpy(dst, gr->gr_mem[ndx]) + 1; } - gs->gr.gr_mem[ndx] = NULL; + newgr->gr_mem[ndx] = NULL; } + return (newgr); +} + +/* + * Add a new member name to a struct group. + */ +struct group * +gr_add(struct group *gr, char *newmember) +{ + size_t mlen; + int num_mem=0; + char **members; + struct group *newgr; - return (&gs->gr); + if (newmember == NULL) + return(gr_dup(gr)); + + if (gr->gr_mem != NULL) { + for (num_mem = 0; gr->gr_mem[num_mem] != NULL; num_mem++) { + if (strcmp(gr->gr_mem[num_mem], newmember) == 0) { + errno = EEXIST; + return (NULL); + } + } + } + /* Allocate enough for current pointers + 1 more and NULL marker */ + mlen = (num_mem + 2) * sizeof(*gr->gr_mem); + if ((members = malloc(mlen)) == NULL) + return (NULL); + memcpy(members, gr->gr_mem, num_mem * sizeof(*gr->gr_mem)); + members[num_mem++] = newmember; + members[num_mem] = NULL; + gr->gr_mem = members; + newgr = gr_dup(gr); + free(members); + return (newgr); } /* diff --git a/lib/libutil/libutil.h b/lib/libutil/libutil.h index bf42766..b1b2405 100644 --- a/lib/libutil/libutil.h +++ b/lib/libutil/libutil.h @@ -166,6 +166,8 @@ int gr_copy(int __ffd, int _tfd, const struct group *_gr, struct group *_old_gr); struct group * gr_dup(const struct group *_gr); +struct group * + gr_add(struct group *_gr, char *_newmember); int gr_equal(const struct group *_gr1, const struct group *_gr2); void gr_fini(void); int gr_init(const char *_dir, const char *_master); diff --git a/lib/libutil/pw_util.c b/lib/libutil/pw_util.c index 4bf3001..befd1fb 100644 --- a/lib/libutil/pw_util.c +++ b/lib/libutil/pw_util.c @@ -179,11 +179,8 @@ pw_lock(void) for (;;) { struct stat st; - lockfd = open(masterpasswd, O_RDONLY, 0); - if (lockfd < 0 || fcntl(lockfd, F_SETFD, 1) == -1) - err(1, "%s", masterpasswd); - /* XXX vulnerable to race conditions */ - if (flock(lockfd, LOCK_EX|LOCK_NB) == -1) { + lockfd = flopen(masterpasswd, O_RDONLY|O_NONBLOCK|O_CLOEXEC, 0); + if (lockfd == -1) { if (errno == EWOULDBLOCK) { errx(1, "the password db file is busy"); } else { diff --git a/release/amd64/mkisoimages.sh b/release/amd64/mkisoimages.sh index 74a34a9..105a073 100644 --- a/release/amd64/mkisoimages.sh +++ b/release/amd64/mkisoimages.sh @@ -36,9 +36,9 @@ if [ $# -lt 3 ]; then exit 1 fi -LABEL=$1; shift +LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift -echo "/dev/iso9660/`echo $LABEL | tr '[:lower:]' '[:upper:]'` / cd9660 ro 0 0" > $1/etc/fstab +echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* rm $1/etc/fstab diff --git a/release/i386/mkisoimages.sh b/release/i386/mkisoimages.sh index 74a34a9..105a073 100644 --- a/release/i386/mkisoimages.sh +++ b/release/i386/mkisoimages.sh @@ -36,9 +36,9 @@ if [ $# -lt 3 ]; then exit 1 fi -LABEL=$1; shift +LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift -echo "/dev/iso9660/`echo $LABEL | tr '[:lower:]' '[:upper:]'` / cd9660 ro 0 0" > $1/etc/fstab +echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* rm $1/etc/fstab diff --git a/release/ia64/mkisoimages.sh b/release/ia64/mkisoimages.sh index 59fe025..d4a0802 100644 --- a/release/ia64/mkisoimages.sh +++ b/release/ia64/mkisoimages.sh @@ -37,7 +37,7 @@ if [ $# -lt 3 ]; then exit 1 fi -LABEL=$1; shift +LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift BASE=$1; shift diff --git a/release/pc98/mkisoimages.sh b/release/pc98/mkisoimages.sh index 313641b..68f2196 100644 --- a/release/pc98/mkisoimages.sh +++ b/release/pc98/mkisoimages.sh @@ -36,9 +36,9 @@ if [ $# -lt 3 ]; then exit 1 fi -LABEL=$1; shift +LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift -echo "/dev/iso9660/`echo $LABEL | tr '[:lower:]' '[:upper:]'` / cd9660 ro 0 0" > $1/etc/fstab +echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* rm $1/etc/fstab diff --git a/release/powerpc/mkisoimages.sh b/release/powerpc/mkisoimages.sh index 9542d2f..6bd29a7 100644 --- a/release/powerpc/mkisoimages.sh +++ b/release/powerpc/mkisoimages.sh @@ -58,10 +58,10 @@ if [ $# -lt 3 ]; then exit 1 fi -LABEL=$1; shift +LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift -echo "/dev/iso9660/`echo $LABEL | tr '[:lower:]' '[:upper:]'` / cd9660 ro 0 0" > $1/etc/fstab +echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* rm $1/etc/fstab rm /tmp/hfs-boot-block diff --git a/release/sparc64/mkisoimages.sh b/release/sparc64/mkisoimages.sh index c2937cb..9ae6dcf 100644 --- a/release/sparc64/mkisoimages.sh +++ b/release/sparc64/mkisoimages.sh @@ -63,7 +63,7 @@ if [ $? -ne 0 ]; then fi fi -LABEL=$1; shift +LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift NAME=$1; shift echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab diff --git a/sbin/geom/class/journal/geom_journal_ufs.c b/sbin/geom/class/journal/geom_journal_ufs.c index c847a88..07d1922 100644 --- a/sbin/geom/class/journal/geom_journal_ufs.c +++ b/sbin/geom/class/journal/geom_journal_ufs.c @@ -73,6 +73,6 @@ g_journal_ufs_using_last_sector(const char *prov) /* Provider size in 512 bytes blocks. */ psize = g_get_mediasize(prov) / DEV_BSIZE; /* File system size in 512 bytes blocks. */ - fssize = fsbtodb(fs, dbtofsb(fs, psize)); - return (psize == fssize); + fssize = fsbtodb(fs, fs->fs_size); + return (psize <= fssize); } diff --git a/sbin/geom/class/part/gpart.8 b/sbin/geom/class/part/gpart.8 index 7a91d3d..61f8275 100644 --- a/sbin/geom/class/part/gpart.8 +++ b/sbin/geom/class/part/gpart.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 19, 2012 +.Dd January 3, 2013 .Dt GPART 8 .Os .Sh NAME @@ -453,8 +453,14 @@ about its use. .El .\" ==== SHOW ==== .It Cm show -Show the current partition information of the specified geoms -or all geoms if none are specified. +Show current partition information for the specified geoms, or all +geoms if none are specified. +The default output includes the logical starting block of each +partition, the partition size in blocks, the partition index number, +the partition type, and a human readable partition size. +Block sizes and locations are based on the device's Sectorsize +as shown by +.Cm gpart list . Additional options include: .Bl -tag -width 10n .It Fl l @@ -919,7 +925,7 @@ and .Cm list will report about corrupt tables. .Pp -If the size of the device has changed (e.g.\& volume expansion) the +If the size of the device has changed (e.g.,\& volume expansion) the secondary GPT header will no longer be located in the last sector. This is not a metadata corruption, but it is dangerous because any corruption of the primary GPT will lead to loss of the partition table. @@ -979,14 +985,14 @@ This may break a mirrored volume and lead to data damage. Exit status is 0 on success, and 1 if the command fails. .Sh EXAMPLES Create a GPT scheme on -.Pa ad0 : +.Pa ada0 : .Bd -literal -offset indent -/sbin/gpart create -s GPT ad0 +/sbin/gpart create -s GPT ada0 .Ed .Pp Embed GPT bootstrap code into a protective MBR: .Bd -literal -offset indent -/sbin/gpart bootcode -b /boot/pmbr ad0 +/sbin/gpart bootcode -b /boot/pmbr ada0 .Ed .Pp Create a dedicated @@ -1011,15 +1017,15 @@ aligned on a 64 kB boundary without the need to specify an explicit offset or alignment. The boot partition itself is aligned on a 4 kB boundary. .Bd -literal -offset indent -/sbin/gpart add -b 40 -s 88 -t freebsd-boot ad0 -/sbin/gpart bootcode -p /boot/gptboot -i 1 ad0 +/sbin/gpart add -b 40 -s 88 -t freebsd-boot ada0 +/sbin/gpart bootcode -p /boot/gptboot -i 1 ada0 .Ed .Pp Create a 512MB-sized .Cm freebsd-ufs partition to contain a UFS filesystem from which the system can boot. .Bd -literal -offset indent -/sbin/gpart add -s 512M -t freebsd-ufs ad0 +/sbin/gpart add -s 512M -t freebsd-ufs ada0 .Ed .Pp Create an MBR scheme on diff --git a/sbin/mount_nullfs/mount_nullfs.c b/sbin/mount_nullfs/mount_nullfs.c index c88db3d..aaf66e5 100644 --- a/sbin/mount_nullfs/mount_nullfs.c +++ b/sbin/mount_nullfs/mount_nullfs.c @@ -57,27 +57,35 @@ static const char rcsid[] = #include "mntopts.h" -static struct mntopt mopts[] = { - MOPT_STDOPTS, - MOPT_END -}; - int subdir(const char *, const char *); static void usage(void) __dead2; int main(int argc, char *argv[]) { - struct iovec iov[6]; - int ch, mntflags; + struct iovec *iov; + char *p, *val; char source[MAXPATHLEN]; char target[MAXPATHLEN]; + char errmsg[255]; + int ch, mntflags, iovlen; + char nullfs[] = "nullfs"; + iov = NULL; + iovlen = 0; mntflags = 0; + errmsg[0] = '\0'; while ((ch = getopt(argc, argv, "o:")) != -1) switch(ch) { case 'o': - getmntopts(optarg, mopts, &mntflags, 0); + val = strdup(""); + p = strchr(optarg, '='); + if (p != NULL) { + free(val); + *p = '\0'; + val = p + 1; + } + build_iovec(&iov, &iovlen, optarg, val, (size_t)-1); break; case '?': default: @@ -99,21 +107,16 @@ main(int argc, char *argv[]) errx(EX_USAGE, "%s (%s) and %s are not distinct paths", argv[0], target, argv[1]); - iov[0].iov_base = strdup("fstype"); - iov[0].iov_len = sizeof("fstype"); - iov[1].iov_base = strdup("nullfs"); - iov[1].iov_len = strlen(iov[1].iov_base) + 1; - iov[2].iov_base = strdup("fspath"); - iov[2].iov_len = sizeof("fspath"); - iov[3].iov_base = source; - iov[3].iov_len = strlen(source) + 1; - iov[4].iov_base = strdup("target"); - iov[4].iov_len = sizeof("target"); - iov[5].iov_base = target; - iov[5].iov_len = strlen(target) + 1; - - if (nmount(iov, 6, mntflags)) - err(1, NULL); + build_iovec(&iov, &iovlen, "fstype", nullfs, (size_t)-1); + build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1); + build_iovec(&iov, &iovlen, "target", target, (size_t)-1); + build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); + if (nmount(iov, iovlen, mntflags) < 0) { + if (errmsg[0] != 0) + err(1, "%s: %s", source, errmsg); + else + err(1, "%s", source); + } exit(0); } diff --git a/sbin/pflogd/Makefile b/sbin/pflogd/Makefile index ea37bd1..fcff8eb 100644 --- a/sbin/pflogd/Makefile +++ b/sbin/pflogd/Makefile @@ -9,7 +9,7 @@ MAN= pflogd.8 CFLAGS+=-include ${.CURDIR}/../../lib/libpcap/config.h LDADD= -lpcap -DPADD= ${LIBPCAP} ${LIBUTIL} +DPADD= ${LIBPCAP} WARNS?= 2 diff --git a/sbin/route/route.c b/sbin/route/route.c index 847f3ee..4637ba4 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -94,7 +94,7 @@ typedef union sockunion *sup; int pid, rtm_addrs; int s; int forcehost, forcenet, doflush, nflag, af, qflag, tflag; -int iflag, verbose, aflen = sizeof (struct sockaddr_in); +int verbose, aflen = sizeof (struct sockaddr_in); int locking, lockrest, debugonly; struct rt_metrics rt_metrics; u_long rtm_inits; @@ -107,7 +107,7 @@ static char *atalk_ntoa(struct at_addr); static void bprintf(FILE *, int, u_char *); static void flushroutes(int argc, char *argv[]); static int flushroutes_fib(int); -static int getaddr(int, char *, struct hostent **); +static int getaddr(int, char *, struct hostent **, int); static int keyword(const char *); static void inet_makenetandmask(u_long, struct sockaddr_in *, u_long); #ifdef INET6 @@ -833,34 +833,34 @@ newroute(int argc, char **argv) case K_IFA: if (!--argc) usage(NULL); - (void) getaddr(RTA_IFA, *++argv, 0); + getaddr(RTA_IFA, *++argv, 0, nrflags); break; case K_IFP: if (!--argc) usage(NULL); - (void) getaddr(RTA_IFP, *++argv, 0); + getaddr(RTA_IFP, *++argv, 0, nrflags); break; case K_GENMASK: if (!--argc) usage(NULL); - (void) getaddr(RTA_GENMASK, *++argv, 0); + getaddr(RTA_GENMASK, *++argv, 0, nrflags); break; case K_GATEWAY: if (!--argc) usage(NULL); - (void) getaddr(RTA_GATEWAY, *++argv, 0); + getaddr(RTA_GATEWAY, *++argv, 0, nrflags); break; case K_DST: if (!--argc) usage(NULL); - if (getaddr(RTA_DST, *++argv, &hp)) + if (getaddr(RTA_DST, *++argv, &hp, nrflags)) nrflags |= F_ISHOST; dest = *argv; break; case K_NETMASK: if (!--argc) usage(NULL); - (void) getaddr(RTA_NETMASK, *++argv, 0); + getaddr(RTA_NETMASK, *++argv, 0, nrflags); /* FALLTHROUGH */ case K_NET: nrflags |= F_FORCENET; @@ -895,13 +895,13 @@ newroute(int argc, char **argv) } else { if ((rtm_addrs & RTA_DST) == 0) { dest = *argv; - if (getaddr(RTA_DST, *argv, &hp)) + if (getaddr(RTA_DST, *argv, &hp, nrflags)) nrflags |= F_ISHOST; } else if ((rtm_addrs & RTA_GATEWAY) == 0) { gateway = *argv; - (void) getaddr(RTA_GATEWAY, *argv, &hp); + getaddr(RTA_GATEWAY, *argv, &hp, nrflags); } else { - (void) getaddr(RTA_NETMASK, *argv, 0); + getaddr(RTA_NETMASK, *argv, 0, nrflags); nrflags |= F_FORCENET; } } @@ -1116,7 +1116,7 @@ inet6_makenetandmask(struct sockaddr_in6 *sin6, const char *plen) * returning 1 if a host address, 0 if a network address. */ static int -getaddr(int which, char *str, struct hostent **hpp) +getaddr(int which, char *str, struct hostent **hpp, int nrflags) { sup su; struct hostent *hp; @@ -1137,7 +1137,7 @@ getaddr(int which, char *str, struct hostent **hpp) break; case RTA_GATEWAY: su = &so_gate; - if (iflag) { + if (nrflags & F_INTERFACE) { struct ifaddrs *ifap, *ifa; struct sockaddr_dl *sdl = NULL; @@ -1197,7 +1197,7 @@ getaddr(int which, char *str, struct hostent **hpp) #if 0 bzero(su, sizeof(*su)); /* for readability */ #endif - getaddr(RTA_NETMASK, str, 0); + getaddr(RTA_NETMASK, str, 0, nrflags); break; #if 0 case RTA_NETMASK: diff --git a/share/examples/Makefile b/share/examples/Makefile index 5cfd76b..5657d3e 100644 --- a/share/examples/Makefile +++ b/share/examples/Makefile @@ -52,7 +52,6 @@ XFILES= BSD_daemon/FreeBSD.pfa \ csh/dot.cshrc \ cvsup/README \ cvsup/cvs-supfile \ - cvsup/gnats-supfile \ cvsup/ports-supfile \ cvsup/refuse \ cvsup/refuse.README \ diff --git a/share/examples/cvsup/README b/share/examples/cvsup/README index e025e8f..19ae270 100644 --- a/share/examples/cvsup/README +++ b/share/examples/cvsup/README @@ -1,5 +1,15 @@ # $FreeBSD$ +BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. + +The primary development work happens in Subversion and is temporarily +exported to the legacy CVS system with significant time delays. + +You should NOT set up a new consumer of FreeBSD source code via CVS. +Please see: +http://www.freebsd.org/doc/handbook/svn.html +http://www.freebsd.org/doc/handbook/svn-mirrors.html + This directory contains sample "supfiles" for obtaining and updating the FreeBSD sources via the Internet. These supfiles will work with CVSup version 14.0 or later. For general information on CVSup @@ -20,10 +30,6 @@ FreeBSD, use: cvs-supfile Main source tree and ports collection -To maintain a copy of the FreeBSD bug database, use the file: - - gnats-supfile FreeBSD bug database - IMPORTANT: Before you use any of the supfiles in this directory, you will need to edit in an appropriate "host" setting. See: diff --git a/share/examples/cvsup/cvs-supfile b/share/examples/cvsup/cvs-supfile index b4edfdc..f46d051 100644 --- a/share/examples/cvsup/cvs-supfile +++ b/share/examples/cvsup/cvs-supfile @@ -1,7 +1,14 @@ # $FreeBSD$ # -# This file contains all of the "CVSup collections" that make up the -# CVS development tree of the FreeBSD system. +# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. +# +# The primary development work happens in Subversion and is temporarily +# exported to the legacy CVS system with significant time delays. +# +# You should NOT set up a new consumer of FreeBSD source code via CVS. +# Please see: +# http://www.freebsd.org/doc/handbook/svn.html +# http://www.freebsd.org/doc/handbook/svn-mirrors.html # # csup (CVS Update Protocol) allows you to download the latest CVS # tree (or any branch of development therefrom) to your system easily @@ -61,36 +68,6 @@ # mega-collection. It includes all of the individual "src-*" collections. src-all -# These are the individual collections that make up "src-all". If you -# use these, be sure to comment out "src-all" above. -#src-base -#src-bin -#src-cddl -#src-contrib -#src-etc -#src-games -#src-gnu -#src-include -#src-kerberos5 -#src-kerberosIV -#src-lib -#src-libexec -#src-release -#src-rescue -#src-sbin -#src-share -#src-sys -#src-tools -#src-usrbin -#src-usrsbin -# These are the individual collections that make up FreeBSD's crypto -# collection. They are no longer export-restricted and are a part of -# src-all -#src-crypto -#src-eBones -#src-secure -#src-sys-crypto - ## Ports Collection. # # The easiest way to get the ports tree is to use the "ports-all" @@ -98,77 +75,6 @@ src-all # collections, ports-all -# These are the individual collections that make up "ports-all". If you -# use these, be sure to comment out "ports-all" above and always include -# "ports-base" if you use any of the other individual collections below. -# Your ports may not build correctly without an up-to-date "ports-base". -# -#ports-base -# -#ports-accessibility -#ports-arabic -#ports-archivers -#ports-astro -#ports-audio -#ports-benchmarks -#ports-biology -#ports-cad -#ports-chinese -#ports-comms -#ports-converters -#ports-databases -#ports-deskutils -#ports-devel -#ports-dns -#ports-editors -#ports-emulators -#ports-finance -#ports-french -#ports-ftp -#ports-games -#ports-german -#ports-graphics -#ports-hebrew -#ports-hungarian -#ports-irc -#ports-japanese -#ports-java -#ports-korean -#ports-lang -#ports-mail -#ports-math -#ports-misc -#ports-multimedia -#ports-net -#ports-net-im -#ports-net-mgmt -#ports-net-p2p -#ports-news -#ports-palm -#ports-picobsd -#ports-polish -#ports-ports-mgmt -#ports-portuguese -#ports-print -#ports-russian -#ports-science -#ports-security -#ports-shells -#ports-sysutils -#ports-textproc -#ports-ukrainian -#ports-vietnamese -#ports-www -#ports-x11 -#ports-x11-clocks -#ports-x11-drivers -#ports-x11-fm -#ports-x11-fonts -#ports-x11-servers -#ports-x11-themes -#ports-x11-toolkits -#ports-x11-wm - ## Projects # # This collection retrieves the projects tree of the FreeBSD @@ -179,11 +85,3 @@ projects-all # # This is to get the control files that cvs(1) needs and the commit logs. cvsroot-all - -# These are the individual collections that make up "cvsroot-all" If you -# use these, be sure to comment out "cvsroot-all" above. "cvsroot-common" -# is a synthetic CVSROOT that has all the modules from the other CVSROOT-* -# directories merged into one, and merged commitlogs via symlinks. -#cvsroot-common -#cvsroot-src -#cvsroot-ports diff --git a/share/examples/cvsup/gnats-supfile b/share/examples/cvsup/gnats-supfile deleted file mode 100644 index 57e9666..0000000 --- a/share/examples/cvsup/gnats-supfile +++ /dev/null @@ -1,60 +0,0 @@ -# $FreeBSD$ -# -# This file contains all of the "CVSup collections" that make up the -# FreeBSD GNATS bug report database. -# -# csup (CVS Update Protocol) allows you to download the latest CVS -# tree (or any branch of development therefrom) to your system easily -# and efficiently -# -# To keep your CVS tree up-to-date run: -# -# csup gnats-supfile -# -# Note that this only updates the tree contents and does not -# update what is actually installed. -# -# You may wish to change some of the settings in this file to better -# suit your system: -# -# host=CHANGE_THIS.FreeBSD.org -# This specifies the server host which will supply the -# file updates. You must change it to one of the CVSup -# mirror sites listed in the FreeBSD Handbook at -# http://www.freebsd.org/doc/handbook/cvsup.html#CVSUP-MIRRORS. -# You can override this setting on the command line -# with cvsup's "-h host" option. -# -# base=/var/db -# This specifies the root where csup will store information -# about the collections you have transferred to your system. -# A setting of "/var/db" will generate this information in -# /var/db/sup. You can override the "base" setting on the -# command line with cvsup's "-b base" option. This directory -# must exist in order to run CVSup. -# -# prefix=/usr -# This specifies where to place the requested files. A -# setting of "/usr" will place all of the files requested -# in "/usr/gnats". -# The prefix directory must exist in order to run CVSup. - -# Defaults that apply to all the collections -# -# IMPORTANT: Change the next line to use one of the CVSup mirror sites -# listed at http://www.freebsd.org/doc/handbook/cvsup.html#CVSUP-MIRRORS. -*default host=CHANGE_THIS.FreeBSD.org -*default base=/var/db -*default prefix=/usr -*default release=current -*default delete use-rel-suffix - -# If you seem to be limited by CPU rather than network or disk bandwidth, try -# commenting out the following line. (Normally, today's CPUs are fast enough -# that you want to run compression.) -*default compress - -## GNATS database -# -gnats - diff --git a/share/examples/cvsup/ports-supfile b/share/examples/cvsup/ports-supfile index 582f29f..f37af41 100644 --- a/share/examples/cvsup/ports-supfile +++ b/share/examples/cvsup/ports-supfile @@ -1,7 +1,14 @@ # $FreeBSD$ # -# This file contains all of the "CVSup collections" that make up the -# ports collection. +# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. +# +# The primary development work happens in Subversion and is temporarily +# exported to the legacy CVS system with significant time delays. +# +# You should NOT set up a new consumer of FreeBSD source code via CVS. +# Please see: +# http://www.freebsd.org/doc/handbook/svn.html +# http://www.freebsd.org/doc/handbook/svn-mirrors.html # # csup (CVS Update Protocol) allows you to download the latest CVS # tree (or any branch of development therefrom) to your system easily @@ -65,76 +72,3 @@ # mega-collection. It includes all of the individual "ports-*" # collections, ports-all - -# These are the individual collections that make up "ports-all". If you -# use these, be sure to comment out "ports-all" above. - -# Be sure to ALWAYS cvsup the ports-base collection if you use any of the -# other individual collections below. ports-base is a mandatory collection -# for the ports collection, and your ports may not build correctly if it -# is not kept up to date. -# -# Use of individual collections is not a supported configuration. -#ports-base -#ports-accessibility -#ports-arabic -#ports-archivers -#ports-astro -#ports-audio -#ports-benchmarks -#ports-biology -#ports-cad -#ports-chinese -#ports-comms -#ports-converters -#ports-databases -#ports-deskutils -#ports-devel -#ports-dns -#ports-editors -#ports-emulators -#ports-finance -#ports-french -#ports-ftp -#ports-games -#ports-german -#ports-graphics -#ports-hebrew -#ports-hungarian -#ports-irc -#ports-japanese -#ports-java -#ports-korean -#ports-lang -#ports-mail -#ports-math -#ports-misc -#ports-multimedia -#ports-net -#ports-net-im -#ports-net-mgmt -#ports-net-p2p -#ports-news -#ports-palm -#ports-polish -#ports-ports-mgmt -#ports-portuguese -#ports-print -#ports-russian -#ports-science -#ports-security -#ports-shells -#ports-sysutils -#ports-textproc -#ports-ukrainian -#ports-vietnamese -#ports-www -#ports-x11 -#ports-x11-clocks -#ports-x11-drivers -#ports-x11-fm -#ports-x11-fonts -#ports-x11-servers -#ports-x11-themes -#ports-x11-toolkits -#ports-x11-wm diff --git a/share/examples/cvsup/stable-supfile b/share/examples/cvsup/stable-supfile index c747944..54f6e89 100644 --- a/share/examples/cvsup/stable-supfile +++ b/share/examples/cvsup/stable-supfile @@ -1,7 +1,14 @@ # $FreeBSD$ # -# This file contains all of the "CVSup collections" that make up the -# FreeBSD-stable source tree. +# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. +# +# The primary development work happens in Subversion and is temporarily +# exported to the legacy CVS system with significant time delays. +# +# You should NOT set up a new consumer of FreeBSD source code via CVS. +# Please see: +# http://www.freebsd.org/doc/handbook/svn.html +# http://www.freebsd.org/doc/handbook/svn-mirrors.html # # csup (CVS Update Protocol) allows you to download the latest CVS # tree (or any branch of development therefrom) to your system easily @@ -80,33 +87,3 @@ # mega-collection. It includes all of the individual "src-*" collections. # Please note: If you want to track -STABLE, leave this uncommented. src-all - -# These are the individual collections that make up "src-all". If you -# use these, be sure to comment out "src-all" above. -#src-base -#src-bin -#src-cddl -#src-contrib -#src-etc -#src-games -#src-gnu -#src-include -#src-kerberos5 -#src-kerberosIV -#src-lib -#src-libexec -#src-release -#src-rescue -#src-sbin -#src-share -#src-sys -#src-tools -#src-usrbin -#src-usrsbin -# These are the individual collections that make up FreeBSD's crypto -# collection. They are no longer export-restricted and are a part of -# src-all -#src-crypto -#src-eBones -#src-secure -#src-sys-crypto diff --git a/share/examples/cvsup/standard-supfile b/share/examples/cvsup/standard-supfile index b56068d..94eec5e 100644 --- a/share/examples/cvsup/standard-supfile +++ b/share/examples/cvsup/standard-supfile @@ -1,7 +1,14 @@ # $FreeBSD$ # -# This file contains all of the "CVSup collections" that make up the -# FreeBSD-current source tree. +# BEWARE, CVS is deprecated and no longer supported by the FreeBSD project. +# +# The primary development work happens in Subversion and is temporarily +# exported to the legacy CVS system with significant time delays. +# +# You should NOT set up a new consumer of FreeBSD source code via CVS. +# Please see: +# http://www.freebsd.org/doc/handbook/svn.html +# http://www.freebsd.org/doc/handbook/svn-mirrors.html # # csup (CVS Update Protocol) allows you to download the latest CVS # tree (or any branch of development therefrom) to your system easily @@ -59,33 +66,3 @@ # The easiest way to get the main source tree is to use the "src-all" # mega-collection. It includes all of the individual "src-*" collections. src-all - -# These are the individual collections that make up "src-all". If you -# use these, be sure to comment out "src-all" above. -#src-base -#src-bin -#src-cddl -#src-contrib -#src-etc -#src-games -#src-gnu -#src-include -#src-kerberos5 -#src-kerberosIV -#src-lib -#src-libexec -#src-release -#src-rescue -#src-sbin -#src-share -#src-sys -#src-tools -#src-usrbin -#src-usrsbin -# These are the individual collections that make up FreeBSD's crypto -# collection. They are no longer export-restricted and are a part of -# src-all -#src-crypto -#src-eBones -#src-secure -#src-sys-crypto diff --git a/share/man/man4/mps.4 b/share/man/man4/mps.4 index 2fbb669..6840c21 100644 --- a/share/man/man4/mps.4 +++ b/share/man/man4/mps.4 @@ -34,7 +34,7 @@ .\" $Id: //depot/SpectraBSD/head/share/man/man4/mps.4#6 $ .\" $FreeBSD$ .\" -.Dd June 30, 2012 +.Dd January 3, 2013 .Dt MPS 4 .Os .Sh NAME @@ -62,7 +62,7 @@ controllers and WarpDrive solid state storage cards. .Sh HARDWARE The .Nm -driver supports the following controllers: +driver supports the following hardware: .Pp .Bl -bullet -compact .It @@ -80,6 +80,19 @@ LSI Logic SAS2116 (16 Port .It LSI Logic SAS2208 (8 Port .Tn SAS ) +.It +LSI Logic SAS2308 (8 Port +.Tn SAS ) +.It +LSI Logic SSS6200 Solid State Storage +.It +Intel Integrated RAID Module RMS25JB040 +.It +Intel Integrated RAID Module RMS25JB080 +.It +Intel Integrated RAID Module RMS25KB040 +.It +Intel Integrated RAID Module RMS25KB080 .El .Sh CONFIGURATION To disable MSI interrupts for all diff --git a/share/man/man4/ng_ubt.4 b/share/man/man4/ng_ubt.4 index 6a39ddd..ef8a57e 100644 --- a/share/man/man4/ng_ubt.4 +++ b/share/man/man4/ng_ubt.4 @@ -25,7 +25,7 @@ .\" $Id: ng_ubt.4,v 1.3 2003/05/21 19:37:35 max Exp $ .\" $FreeBSD$ .\" -.Dd September 13, 2004 +.Dd December 26, 2012 .Dt NG_UBT 4 .Os .Sh NAME @@ -73,6 +73,8 @@ Mitsumi Bluetooth USB adapter MSI MS-6967 .It TDK Bluetooth USB adapter +.It +Broadcom Bluetooth USB adapter .El .Sh HOOKS This node type supports the following hooks: diff --git a/share/man/man4/stf.4 b/share/man/man4/stf.4 index 1178e03..5e32763 100644 --- a/share/man/man4/stf.4 +++ b/share/man/man4/stf.4 @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2011 +.Dd December 28, 2012 .Dt STF 4 .Os .Sh NAME @@ -180,6 +180,22 @@ Note, however, there are other security risks exist. If you wish to use the configuration, you must not advertise your 6to4 address to others. .\" +.Sh SYSCTL VARIABLES +The following +.Xr sysctl 8 +variables can be used to control the behavior of the +.Nm stf . +The default value is shown next to each variable. +.Bl -tag -width indent +.It Va net.link.stf.permit_rfc1918 : No 0 +The RFC3056 requires the use of globally unique 32-bit IPv4 +addresses. This sysctl variable controls the behaviour of this +requirement. When it set to not 0, +.Nm stf +allows the use of private IPv4 addresses described in the RFC1918. +This may be useful for an Intranet environment or when some mechanisms +of network address translation (NAT) are used. +.El .Sh EXAMPLES Note that .Li 8504:0506 diff --git a/share/man/man4/wbwd.4 b/share/man/man4/wbwd.4 index 67af2ec..49290ff 100644 --- a/share/man/man4/wbwd.4 +++ b/share/man/man4/wbwd.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 6, 2012 +.Dd December 28, 2012 .Dt WBWD 4 .Os .Sh NAME @@ -44,10 +44,6 @@ line in .Bd -literal -offset indent wbwd_load="YES" .Ed -.Pp -In -.Pa /boot/device.hints : -.Cd hint.wbwd.0.at="isa" .Sh DESCRIPTION The .Nm diff --git a/share/man/man9/sleep.9 b/share/man/man9/sleep.9 index 665aa1e..e65a189 100644 --- a/share/man/man9/sleep.9 +++ b/share/man/man9/sleep.9 @@ -102,12 +102,11 @@ If .Fa priority includes the .Dv PCATCH -flag, pending -signals are checked before and after sleeping, otherwise signals are -not checked. +flag, pending signals are allowed to interrupt the sleep, otherwise +pending signals are ignored during the sleep. If .Dv PCATCH -is set and a signal needs to be delivered, +is set and a signal becomes pending, .Er ERESTART is returned if the current system call should be restarted if possible, and @@ -119,9 +118,10 @@ If the .Dv PBDRY flag is specified in addition to .Dv PCATCH , -then the sleeping thread is not stopped upon delivery of +then the sleeping thread is not stopped when .Dv SIGSTOP -or other stop action while it is sleeping. +becomes pending +or some other stop action occurs while it is sleeping. Instead, it is woken up, with the assumption that the stop will occur on reaching a stop point when returning to usermode. diff --git a/share/misc/committers-ports.dot b/share/misc/committers-ports.dot index 99dcc14..af20fc0 100644 --- a/share/misc/committers-ports.dot +++ b/share/misc/committers-ports.dot @@ -140,6 +140,7 @@ maho [label="Maho Nakata\nmaho@FreeBSD.org\n2002/10/17"] makc [label="Max Brazhnikov\nmakc@FreeBSD.org\n2008/08/25"] mandree [label="Matthias Andree\nmandree@FreeBSD.org\n2009/11/18"] marcus [label="Joe Marcus Clarke\nmarcus@FreeBSD.org\n2002/04/05"] +marius [label="Marius Strobl\nmarius@FreeBSD.org\n2012/12/29"] markus [label="Markus Brueffer\nmarkus@FreeBSD.org\n2004/02/21"] martymac [label="Ganael Laplanche\nmartymac@FreeBSD.org\n2010/09/24"] mat [label="Mathieu Arnold\nmat@FreeBSD.org\n2003/08/15"] @@ -235,8 +236,10 @@ avilla -> rakuco bapt -> bdrewery bapt -> eadler bapt -> jlaffaye +bapt -> marius beat -> decke +beat -> marius beat -> sperber beat -> uqs diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk index 21e70ad..1b90603 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -97,13 +97,13 @@ _CPUCFLAGS = -march=${CPUTYPE} . if ${CPUTYPE} == "xscale" #XXX: gcc doesn't seem to like -mcpu=xscale, and dies while rebuilding itself #_CPUCFLAGS = -mcpu=xscale -_CPUCFLAGS = -march=armv5te -D__XSCALE__ -DARM_WANT_TP_ADDRESS +_CPUCFLAGS = -march=armv5te -D__XSCALE__ . elif ${CPUTYPE} == "armv6" _CPUCFLAGS = -march=${CPUTYPE} -DARM_ARCH_6=1 . elif ${CPUTYPE} == "cortexa" -_CPUCFLAGS = -march=armv6 -DARM_ARCH_6=1 -mfpu=vfp +_CPUCFLAGS = -DARM_ARCH_6=1 -mfpu=vfp . else -_CPUCFLAGS = -mcpu=${CPUTYPE} -DARM_WANT_TP_ADDRESS +_CPUCFLAGS = -mcpu=${CPUTYPE} . endif . elif ${MACHINE_ARCH} == "powerpc" . if ${CPUTYPE} == "e500" diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index aa3567b..1335964 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -165,19 +165,22 @@ SOBJS+= ${OBJS:.o=.So} .if defined(SHLIB_NAME) _LIBS+= ${SHLIB_NAME} +.if defined(DEBUG_FLAGS) +SHLIB_NAME_FULL=${SHLIB_NAME}.debug +.else +SHLIB_NAME_FULL=${SHLIB_NAME} +.endif + SOLINKOPTS= -shared -Wl,-x .if !defined(ALLOW_SHARED_TEXTREL) SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel .endif .if target(beforelinking) -${SHLIB_NAME}: beforelinking -.endif -.if defined(DEBUG_FLAGS) -${SHLIB_NAME}.debug: ${SOBJS} -.else -${SHLIB_NAME}: ${SOBJS} +beforelinking: ${SOBJS} +${SHLIB_NAME_FULL}: beforelinking .endif +${SHLIB_NAME_FULL}: ${SOBJS} @${ECHO} building shared library ${SHLIB_NAME} @rm -f ${SHLIB_NAME} ${SHLIB_LINK} .if defined(SHLIB_LINK) @@ -197,12 +200,12 @@ ${SHLIB_NAME}: ${SOBJS} .endif .if defined(DEBUG_FLAGS) -${SHLIB_NAME}: ${SHLIB_NAME}.debug ${SHLIB_NAME}.symbols +${SHLIB_NAME}: ${SHLIB_NAME_FULL} ${SHLIB_NAME}.symbols ${OBJCOPY} --strip-debug --add-gnu-debuglink=${SHLIB_NAME}.symbols \ - ${SHLIB_NAME}.debug ${.TARGET} + ${SHLIB_NAME_FULL} ${.TARGET} -${SHLIB_NAME}.symbols: ${SHLIB_NAME}.debug - ${OBJCOPY} --only-keep-debug ${SHLIB_NAME}.debug ${.TARGET} +${SHLIB_NAME}.symbols: ${SHLIB_NAME_FULL} + ${OBJCOPY} --only-keep-debug ${SHLIB_NAME_FULL} ${.TARGET} .endif .endif diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk index f3fba1c..4f8bedd 100644 --- a/share/mk/bsd.libnames.mk +++ b/share/mk/bsd.libnames.mk @@ -45,7 +45,6 @@ LIBCURSES?= ${DESTDIR}${LIBDIR}/libcurses.a LIBDEVINFO?= ${DESTDIR}${LIBDIR}/libdevinfo.a LIBDEVSTAT?= ${DESTDIR}${LIBDIR}/libdevstat.a LIBDIALOG?= ${DESTDIR}${LIBDIR}/libdialog.a -LIBDISK?= ${DESTDIR}${LIBDIR}/libdisk.a LIBDNS?= ${DESTDIR}${LIBDIR}/libdns.a LIBDTRACE?= ${DESTDIR}${LIBDIR}/libdtrace.a LIBDWARF?= ${DESTDIR}${LIBDIR}/libdwarf.a @@ -54,7 +53,6 @@ LIBELF?= ${DESTDIR}${LIBDIR}/libelf.a LIBFETCH?= ${DESTDIR}${LIBDIR}/libfetch.a LIBFL?= "don't use LIBFL, use LIBL" LIBFORM?= ${DESTDIR}${LIBDIR}/libform.a -LIBFTPIO?= ${DESTDIR}${LIBDIR}/libftpio.a LIBG2C?= ${DESTDIR}${LIBDIR}/libg2c.a LIBGCC?= ${DESTDIR}${LIBDIR}/libgcc.a LIBGCC_PIC?= ${DESTDIR}${LIBDIR}/libgcc_pic.a diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk index 950d381..cfa07a3 100644 --- a/share/mk/bsd.prog.mk +++ b/share/mk/bsd.prog.mk @@ -46,6 +46,7 @@ PROG= ${PROG_CXX} OBJS+= ${SRCS:N*.h:R:S/$/.o/g} .if target(beforelinking) +beforelinking: ${OBJS} ${PROG}: beforelinking .endif ${PROG}: ${OBJS} @@ -75,6 +76,7 @@ SRCS= ${PROG}.c OBJS= ${PROG}.o .if target(beforelinking) +beforelinking: ${OBJS} ${PROG}: beforelinking .endif ${PROG}: ${OBJS} diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 070d8c9..9883715 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -575,7 +575,8 @@ cpu_reset_proxy() cpu_reset_proxy_active = 1; while (cpu_reset_proxy_active == 1) - ; /* Wait for other cpu to see that we've started */ + ia32_pause(); /* Wait for other cpu to see that we've started */ + CPU_SETOF(cpu_reset_proxyid, &tcrp); stop_cpus(tcrp); printf("cpu_reset_proxy: Stopped CPU %d\n", cpu_reset_proxyid); @@ -611,14 +612,17 @@ cpu_reset() wmb(); cnt = 0; - while (cpu_reset_proxy_active == 0 && cnt < 10000000) + while (cpu_reset_proxy_active == 0 && cnt < 10000000) { + ia32_pause(); cnt++; /* Wait for BSP to announce restart */ + } if (cpu_reset_proxy_active == 0) printf("cpu_reset: Failed to restart BSP\n"); enable_intr(); cpu_reset_proxy_active = 2; - while (1); + while (1) + ia32_pause(); /* NOTREACHED */ } diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC index 7aff1e8..48f41b3 100644 --- a/sys/amd64/conf/GENERIC +++ b/sys/amd64/conf/GENERIC @@ -35,6 +35,7 @@ options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options UFS_GJOURNAL # Enable gjournal-based UFS journaling +options QUOTA # Enable disk quotas for UFS options MD_ROOT # MD is a potential root device options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server @@ -317,15 +318,6 @@ device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da -# FireWire support -device firewire # FireWire bus code -# sbp(4) works for some systems but causes boot failure on others -#device sbp # SCSI over FireWire (Requires scbus and da) -device fwe # Ethernet over FireWire (non-standard!) -device fwip # IP over FireWire (RFC 2734,3146) -device dcons # Dumb console driver -device dcons_crom # Configuration ROM for dcons - # Sound support device sound # Generic sound driver (required) device snd_cmi # CMedia CMI8338/CMI8738 diff --git a/sys/arm/arm/busdma_machdep-v6.c b/sys/arm/arm/busdma_machdep-v6.c index 1407fa1..2a7c23b 100644 --- a/sys/arm/arm/busdma_machdep-v6.c +++ b/sys/arm/arm/busdma_machdep-v6.c @@ -1347,35 +1347,49 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op) while (sl != NULL) { /* write back the unaligned portions */ vm_paddr_t physaddr; + register_t s = 0; + buf = sl->vaddr; len = sl->datacount; physaddr = sl->busaddr; bbuf = buf & ~arm_dcache_align_mask; ebuf = buf + len; physaddr = physaddr & ~arm_dcache_align_mask; - unalign = buf & arm_dcache_align_mask; - if (unalign) { - memcpy(_tmp_cl, (void *)bbuf, unalign); - len += unalign; /* inv entire cache line */ - } - unalign = ebuf & arm_dcache_align_mask; - if (unalign) { - unalign = arm_dcache_align - unalign; - memcpy(_tmp_clend, (void *)ebuf, unalign); - len += unalign; /* inv entire cache line */ + + + if ((buf & arm_dcache_align_mask) || + (ebuf & arm_dcache_align_mask)) { + s = intr_disable(); + unalign = buf & arm_dcache_align_mask; + if (unalign) { + memcpy(_tmp_cl, (void *)bbuf, unalign); + len += unalign; /* inv entire cache line */ + } + + unalign = ebuf & arm_dcache_align_mask; + if (unalign) { + unalign = arm_dcache_align - unalign; + memcpy(_tmp_clend, (void *)ebuf, unalign); + len += unalign; /* inv entire cache line */ + } } - /* inv are cache length aligned */ + + /* inv are cache length aligned */ cpu_dcache_inv_range(bbuf, len); l2cache_inv_range(bbuf, physaddr, len); - unalign = (vm_offset_t)buf & arm_dcache_align_mask; - if (unalign) { - memcpy((void *)bbuf, _tmp_cl, unalign); - } - unalign = ebuf & arm_dcache_align_mask; - if (unalign) { - unalign = arm_dcache_align - unalign; - memcpy((void *)ebuf, _tmp_clend, unalign); + if ((buf & arm_dcache_align_mask) || + (ebuf & arm_dcache_align_mask)) { + unalign = (vm_offset_t)buf & arm_dcache_align_mask; + if (unalign) + memcpy((void *)bbuf, _tmp_cl, unalign); + + unalign = ebuf & arm_dcache_align_mask; + if (unalign) + memcpy((void *)ebuf, _tmp_clend, + arm_dcache_align - unalign); + + intr_restore(s); } sl = STAILQ_NEXT(sl, slinks); } diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index e358f96..a1b5a8f 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include <sys/ptrace.h> #include <sys/signalvar.h> #include <sys/syscallsubr.h> +#include <sys/sysctl.h> #include <sys/sysent.h> #include <sys/sysproto.h> #include <sys/uio.h> @@ -162,8 +163,6 @@ const struct pmap_devmap *pmap_devmap_bootstrap_table; uint32_t board_id; struct arm_lbabi_tag *atag_list; -uint32_t revision; -uint64_t serial; char linux_command_line[LBABI_MAX_COMMAND_LINE + 1]; char atags[LBABI_MAX_COMMAND_LINE * 2]; uint32_t memstart[LBABI_MAX_BANKS]; @@ -171,6 +170,31 @@ uint32_t memsize[LBABI_MAX_BANKS]; uint32_t membanks; #endif +static uint32_t board_revision; +/* hex representation of uint64_t */ +static char board_serial[32]; + +SYSCTL_NODE(_hw, OID_AUTO, board, CTLFLAG_RD, 0, "Board attributes"); +SYSCTL_UINT(_hw_board, OID_AUTO, revision, CTLFLAG_RD, + &board_revision, 0, "Board revision"); +SYSCTL_STRING(_hw_board, OID_AUTO, serial, CTLFLAG_RD, + board_serial, 0, "Board serial"); + +void +board_set_serial(uint64_t serial) +{ + + snprintf(board_serial, sizeof(board_serial)-1, + "%016jx", serial); +} + +void +board_set_revision(uint32_t revision) +{ + + board_revision = revision; +} + void sendsig(catcher, ksi, mask) sig_t catcher; @@ -849,6 +873,8 @@ vm_offset_t linux_parse_boot_param(struct arm_boot_params *abp) { struct arm_lbabi_tag *walker; + uint32_t revision; + uint64_t serial; /* * Linux boot ABI: r0 = 0, r1 is the board type (!= 0) and r2 @@ -883,9 +909,11 @@ linux_parse_boot_param(struct arm_boot_params *abp) case ATAG_SERIAL: serial = walker->u.tag_sn.low | ((uint64_t)walker->u.tag_sn.high << 32); + board_set_serial(serial); break; case ATAG_REVISION: revision = walker->u.tag_rev.rev; + board_set_revision(revision); break; case ATAG_CMDLINE: /* XXX open question: Parse this for boothowto? */ diff --git a/sys/arm/arm/pl310.c b/sys/arm/arm/pl310.c index 7c43b31..9d4fc4a 100644 --- a/sys/arm/arm/pl310.c +++ b/sys/arm/arm/pl310.c @@ -39,69 +39,39 @@ __FBSDID("$FreeBSD$"); #include <sys/lock.h> #include <sys/mutex.h> #include <machine/intr.h> -#include <vm/vm.h> -#include <vm/pmap.h> -#include <machine/pl310.h> + #include <machine/bus.h> +#include <machine/pl310.h> #include <dev/fdt/fdt_common.h> #include <dev/ofw/openfirm.h> #include <dev/ofw/ofw_bus.h> #include <dev/ofw/ofw_bus_subr.h> -/** - * PL310 - L2 Cache Controller register offsets. - * +/* + * Define this if you need to disable PL310 for debugging purpose + * Spec: + * http://infocenter.arm.com/help/topic/com.arm.doc.ddi0246e/DDI0246E_l2c310_r3p1_trm.pdf + */ + +/* + * Hardcode errata for now + * http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0246b/pr01s02s02.html */ -#define PL310_CACHE_ID 0x000 -#define PL310_CACHE_TYPE 0x004 -#define PL310_CTRL 0x100 -#define PL310_AUX_CTRL 0x104 -#define PL310_EVENT_COUNTER_CTRL 0x200 -#define PL310_EVENT_COUNTER1_CONF 0x204 -#define PL310_EVENT_COUNTER0_CONF 0x208 -#define PL310_EVENT_COUNTER1_VAL 0x20C -#define PL310_EVENT_COUNTER0_VAL 0x210 -#define PL310_INTR_MASK 0x214 -#define PL310_MASKED_INTR_STAT 0x218 -#define PL310_RAW_INTR_STAT 0x21C -#define PL310_INTR_CLEAR 0x220 -#define PL310_CACHE_SYNC 0x730 -#define PL310_INV_LINE_PA 0x770 -#define PL310_INV_WAY 0x77C -#define PL310_CLEAN_LINE_PA 0x7B0 -#define PL310_CLEAN_LINE_IDX 0x7B8 -#define PL310_CLEAN_WAY 0x7BC -#define PL310_CLEAN_INV_LINE_PA 0x7F0 -#define PL310_CLEAN_INV_LINE_IDX 0x7F8 -#define PL310_CLEAN_INV_WAY 0x7FC -#define PL310_LOCKDOWN_D_WAY(x) (0x900 + ((x) * 8)) -#define PL310_LOCKDOWN_I_WAY(x) (0x904 + ((x) * 8)) -#define PL310_LOCKDOWN_LINE_ENABLE 0x950 -#define PL310_UNLOCK_ALL_LINES_WAY 0x954 -#define PL310_ADDR_FILTER_START 0xC00 -#define PL310_ADDR_FILTER_END 0xC04 -#define PL310_DEBUG_CTRL 0xF40 - - -#define PL310_AUX_CTRL_MASK 0xc0000fff -#define PL310_AUX_CTRL_ASSOCIATIVITY_SHIFT 16 -#define PL310_AUX_CTRL_WAY_SIZE_SHIFT 17 -#define PL310_AUX_CTRL_WAY_SIZE_MASK (0x7 << 17) -#define PL310_AUX_CTRL_SHARE_OVERRIDE_SHIFT 22 -#define PL310_AUX_CTRL_NS_LOCKDOWN_SHIFT 26 -#define PL310_AUX_CTRL_NS_INT_CTRL_SHIFT 27 -#define PL310_AUX_CTRL_DATA_PREFETCH_SHIFT 28 -#define PL310_AUX_CTRL_INSTR_PREFETCH_SHIFT 29 -#define PL310_AUX_CTRL_EARLY_BRESP_SHIFT 30 - - -void omap4_l2cache_wbinv_range(vm_paddr_t physaddr, vm_size_t size); -void omap4_l2cache_inv_range(vm_paddr_t physaddr, vm_size_t size); -void omap4_l2cache_wb_range(vm_paddr_t physaddr, vm_size_t size); -void omap4_l2cache_wbinv_all(void); -void omap4_l2cache_inv_all(void); -void omap4_l2cache_wb_all(void); +#define PL310_ERRATA_588369 +#define PL310_ERRATA_753970 +#define PL310_ERRATA_727915 + +#define PL310_LOCK(sc) do { \ + mtx_lock_spin(&(sc)->sc_mtx); \ +} while(0); + +#define PL310_UNLOCK(sc) do { \ + mtx_unlock_spin(&(sc)->sc_mtx); \ +} while(0); + +static int pl310_enabled = 1; +TUNABLE_INT("pl310.enabled", &pl310_enabled); static uint32_t g_l2cache_way_mask; @@ -112,34 +82,31 @@ static uint32_t g_l2cache_size; static struct pl310_softc *pl310_softc; -/** - * pl310_read4 - read a 32-bit value from the PL310 registers - * pl310_write4 - write a 32-bit value from the PL310 registers - * @off: byte offset within the register set to read from - * @val: the value to write into the register - * - * - * LOCKING: - * None - * - * RETURNS: - * nothing in case of write function, if read function returns the value read. - */ -static __inline uint32_t -pl310_read4(bus_size_t off) -{ - return bus_read_4(pl310_softc->sc_mem_res, off); -} -static __inline void -pl310_write4(bus_size_t off, uint32_t val) +static int +pl310_filter(void *arg) { - bus_write_4(pl310_softc->sc_mem_res, off, val); + struct pl310_softc *sc = arg; + uint32_t intr; + + intr = pl310_read4(sc, PL310_INTR_MASK); + + if (!sc->sc_enabled && (intr & INTR_MASK_ECNTR)) { + /* + * This is for debug purpose, so be blunt about it + * We disable PL310 only when something fishy is going + * on and we need to make sure L2 cache is 100% disabled + */ + panic("pl310: caches disabled but cache event detected\n"); + } + + return (FILTER_HANDLED); } static __inline void pl310_wait_background_op(uint32_t off, uint32_t mask) { - while (pl310_read4(off) & mask); + + while (pl310_read4(pl310_softc, off) & mask); } @@ -157,29 +124,51 @@ pl310_wait_background_op(uint32_t off, uint32_t mask) static __inline void pl310_cache_sync(void) { - pl310_write4(PL310_CACHE_SYNC, 0); + if ((pl310_softc == NULL) || !pl310_softc->sc_enabled) + return; + +#ifdef PL310_ERRATA_753970 + if (pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r3p0) + /* Write uncached PL310 register */ + pl310_write4(pl310_softc, 0x740, 0xffffffff); + else +#endif + pl310_write4(pl310_softc, PL310_CACHE_SYNC, 0xffffffff); } static void pl310_wbinv_all(void) { -#if 1 - pl310_write4(PL310_DEBUG_CTRL, 3); + + if ((pl310_softc == NULL) || !pl310_softc->sc_enabled) + return; + + PL310_LOCK(pl310_softc); +#ifdef PL310_ERRATA_727915 + if (pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r2p0 || + pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r3p0) + platform_pl310_write_debug(pl310_softc, 3); #endif - pl310_write4(PL310_CLEAN_INV_WAY, g_l2cache_way_mask); + pl310_write4(pl310_softc, PL310_CLEAN_INV_WAY, g_l2cache_way_mask); pl310_wait_background_op(PL310_CLEAN_INV_WAY, g_l2cache_way_mask); pl310_cache_sync(); -#if 1 - pl310_write4(PL310_DEBUG_CTRL, 0); +#ifdef PL310_ERRATA_727915 + if (pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r2p0 || + pl310_softc->sc_rtl_revision == CACHE_ID_RELEASE_r3p0) + platform_pl310_write_debug(pl310_softc, 0); #endif - + PL310_UNLOCK(pl310_softc); } static void pl310_wbinv_range(vm_paddr_t start, vm_size_t size) { - + + if ((pl310_softc == NULL) || !pl310_softc->sc_enabled) + return; + + PL310_LOCK(pl310_softc); if (start & g_l2cache_align_mask) { size += start & g_l2cache_align_mask; start &= ~g_l2cache_align_mask; @@ -188,61 +177,73 @@ pl310_wbinv_range(vm_paddr_t start, vm_size_t size) size &= ~g_l2cache_align_mask; size += g_l2cache_line_size; } -#if 1 - pl310_write4(PL310_DEBUG_CTRL, 3); + +#ifdef PL310_ERRATA_727915 + platform_pl310_write_debug(pl310_softc, 3); #endif while (size > 0) { -#if 1 - /* - * Errata 588369 says that clean + inv may keep the - * cache line if it was clean, the recommanded workaround - * is to clean then invalidate the cache line, with - * write-back and cache linefill disabled - */ - - pl310_write4(PL310_CLEAN_LINE_PA, start); - pl310_write4(PL310_INV_LINE_PA, start); -#else - pl310_write4(PL310_CLEAN_INV_LINE_PA, start); +#ifdef PL310_ERRATA_588369 + if (pl310_softc->sc_rtl_revision <= CACHE_ID_RELEASE_r1p0) { + /* + * Errata 588369 says that clean + inv may keep the + * cache line if it was clean, the recommanded + * workaround is to clean then invalidate the cache + * line, with write-back and cache linefill disabled. + */ + pl310_write4(pl310_softc, PL310_CLEAN_LINE_PA, start); + pl310_write4(pl310_softc, PL310_INV_LINE_PA, start); + } else #endif + pl310_write4(pl310_softc, PL310_CLEAN_INV_LINE_PA, + start); start += g_l2cache_line_size; size -= g_l2cache_line_size; } -#if 1 - pl310_write4(PL310_DEBUG_CTRL, 0); +#ifdef PL310_ERRATA_727915 + platform_pl310_write_debug(pl310_softc, 0); #endif - pl310_wait_background_op(PL310_CLEAN_INV_LINE_PA, 1); + pl310_cache_sync(); - + PL310_UNLOCK(pl310_softc); } static void pl310_wb_range(vm_paddr_t start, vm_size_t size) { - + + if ((pl310_softc == NULL) || !pl310_softc->sc_enabled) + return; + + PL310_LOCK(pl310_softc); if (start & g_l2cache_align_mask) { size += start & g_l2cache_align_mask; start &= ~g_l2cache_align_mask; } + if (size & g_l2cache_align_mask) { size &= ~g_l2cache_align_mask; size += g_l2cache_line_size; } + while (size > 0) { - pl310_write4(PL310_CLEAN_LINE_PA, start); + pl310_write4(pl310_softc, PL310_CLEAN_LINE_PA, start); start += g_l2cache_line_size; size -= g_l2cache_line_size; } - pl310_cache_sync(); - pl310_wait_background_op(PL310_CLEAN_LINE_PA, 1); + pl310_cache_sync(); + PL310_UNLOCK(pl310_softc); } static void pl310_inv_range(vm_paddr_t start, vm_size_t size) { + if ((pl310_softc == NULL) || !pl310_softc->sc_enabled) + return; + + PL310_LOCK(pl310_softc); if (start & g_l2cache_align_mask) { size += start & g_l2cache_align_mask; start &= ~g_l2cache_align_mask; @@ -252,13 +253,13 @@ pl310_inv_range(vm_paddr_t start, vm_size_t size) size += g_l2cache_line_size; } while (size > 0) { - pl310_write4(PL310_INV_LINE_PA, start); + pl310_write4(pl310_softc, PL310_INV_LINE_PA, start); start += g_l2cache_line_size; size -= g_l2cache_line_size; } - pl310_cache_sync(); - pl310_wait_background_op(PL310_INV_LINE_PA, 1); + pl310_cache_sync(); + PL310_UNLOCK(pl310_softc); } static int @@ -280,39 +281,100 @@ pl310_attach(device_t dev) uint32_t way_size; uint32_t ways_assoc; uint32_t ctrl_value; + uint32_t cache_id; + sc->sc_dev = dev; sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) panic("%s: Cannot map registers", device_get_name(dev)); - pl310_softc = sc; - platform_init_pl310(sc); - aux_value = pl310_read4(PL310_AUX_CTRL); - way_size = (aux_value & PL310_AUX_CTRL_WAY_SIZE_MASK) >> - PL310_AUX_CTRL_WAY_SIZE_SHIFT; + /* Allocate an IRQ resource */ + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE | RF_SHAREABLE); + if (sc->sc_irq_res == NULL) { + panic("Cannot allocate IRQ\n"); + } + + pl310_softc = sc; + mtx_init(&sc->sc_mtx, "pl310lock", NULL, MTX_SPIN); + sc->sc_enabled = pl310_enabled; + + /* activate the interrupt */ + bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + pl310_filter, NULL, sc, &sc->sc_irq_h); + + cache_id = pl310_read4(sc, PL310_CACHE_ID); + sc->sc_rtl_revision = (cache_id >> CACHE_ID_RELEASE_SHIFT) & + CACHE_ID_RELEASE_MASK; + device_printf(dev, "Part number: 0x%x, release: 0x%x\n", + (cache_id >> CACHE_ID_PARTNUM_SHIFT) & CACHE_ID_PARTNUM_MASK, + (cache_id >> CACHE_ID_RELEASE_SHIFT) & CACHE_ID_RELEASE_MASK); + aux_value = pl310_read4(sc, PL310_AUX_CTRL); + way_size = (aux_value & AUX_CTRL_WAY_SIZE_MASK) >> + AUX_CTRL_WAY_SIZE_SHIFT; way_size = 1 << (way_size + 13); - if (aux_value & (1 << PL310_AUX_CTRL_ASSOCIATIVITY_SHIFT)) + if (aux_value & (1 << AUX_CTRL_ASSOCIATIVITY_SHIFT)) ways_assoc = 16; else ways_assoc = 8; g_l2cache_way_mask = (1 << ways_assoc) - 1; g_l2cache_size = way_size * ways_assoc; /* Print the information */ - printf(" L2 Cache: %uKB/%dB %d ways\n", (g_l2cache_size / 1024), + device_printf(dev, "L2 Cache: %uKB/%dB %d ways\n", (g_l2cache_size / 1024), g_l2cache_line_size, ways_assoc); - ctrl_value = pl310_read4(PL310_CTRL); - if (!(ctrl_value & 0x1)) { + + ctrl_value = pl310_read4(sc, PL310_CTRL); + + if (sc->sc_enabled && !(ctrl_value & CTRL_ENABLED)) { /* Enable the L2 cache if disabled */ - pl310_write4(PL310_CTRL, ctrl_value & 0x1); + platform_pl310_write_ctrl(sc, CTRL_ENABLED); + } + + if (!sc->sc_enabled && (ctrl_value & CTRL_ENABLED)) { + /* + * Set counters so when cache event happens + * we'll get interrupt and be warned that something + * is off + */ + + /* Cache Line Eviction for Counter 0 */ + pl310_write4(sc, PL310_EVENT_COUNTER0_CONF, + EVENT_COUNTER_CONF_INCR | EVENT_COUNTER_CONF_CO); + /* Data Read Request for Counter 1 */ + pl310_write4(sc, PL310_EVENT_COUNTER1_CONF, + EVENT_COUNTER_CONF_INCR | EVENT_COUNTER_CONF_DRREQ); + + /* Temporary switch on for final flush*/ + sc->sc_enabled = 1; + pl310_wbinv_all(); + sc->sc_enabled = 0; + platform_pl310_write_ctrl(sc, CTRL_DISABLED); + + /* Enable and clear pending interrupts */ + pl310_write4(sc, PL310_INTR_CLEAR, INTR_MASK_ECNTR); + pl310_write4(sc, PL310_INTR_MASK, INTR_MASK_ALL); + + /* Enable counters and reset C0 and C1 */ + pl310_write4(sc, PL310_EVENT_COUNTER_CTRL, + EVENT_COUNTER_CTRL_ENABLED | + EVENT_COUNTER_CTRL_C0_RESET | + EVENT_COUNTER_CTRL_C1_RESET); + } + + if (sc->sc_enabled) + platform_pl310_init(sc); + pl310_wbinv_all(); - + /* Set the l2 functions in the set of cpufuncs */ cpufuncs.cf_l2cache_wbinv_all = pl310_wbinv_all; cpufuncs.cf_l2cache_wbinv_range = pl310_wbinv_range; cpufuncs.cf_l2cache_inv_range = pl310_inv_range; cpufuncs.cf_l2cache_wb_range = pl310_wb_range; + return (0); } @@ -330,4 +392,3 @@ static driver_t pl310_driver = { static devclass_t pl310_devclass; DRIVER_MODULE(pl310, simplebus, pl310_driver, pl310_devclass, 0, 0); - diff --git a/sys/arm/arm/pmap-v6.c b/sys/arm/arm/pmap-v6.c index 0df6281..d3e386d 100644 --- a/sys/arm/arm/pmap-v6.c +++ b/sys/arm/arm/pmap-v6.c @@ -193,6 +193,14 @@ int pmap_debug_level = 0; #define PMAP_INLINE __inline #endif /* PMAP_DEBUG */ +#ifdef ARM_L2_PIPT +#define pmap_l2cache_wbinv_range(va, pa, size) cpu_l2cache_wbinv_range((pa), (size)) +#define pmap_l2cache_inv_range(va, pa, size) cpu_l2cache_inv_range((pa), (size)) +#else +#define pmap_l2cache_wbinv_range(va, pa, size) cpu_l2cache_wbinv_range((va), (size)) +#define pmap_l2cache_inv_range(va, pa, size) cpu_l2cache_inv_range((va), (size)) +#endif + extern struct pv_addr systempage; /* @@ -786,11 +794,7 @@ pmap_l2ptp_ctor(void *mem, int size, void *arg, int flags) pte = *ptep; cpu_idcache_wbinv_range(va, PAGE_SIZE); -#ifdef ARM_L2_PIPT - cpu_l2cache_wbinv_range(pte & L2_S_FRAME, PAGE_SIZE); -#else - cpu_l2cache_wbinv_range(va, PAGE_SIZE); -#endif + pmap_l2cache_wbinv_range(va, pte & L2_S_FRAME, PAGE_SIZE); if ((pte & L2_S_CACHE_MASK) != pte_l2_s_cache_mode_pt) { /* * Page tables must have the cache-mode set to @@ -2121,6 +2125,7 @@ pmap_kremove(vm_offset_t va) cpu_tlb_flushD_SE(va); cpu_cpwait(); *pte = 0; + PTE_SYNC(pte); } } @@ -2387,11 +2392,7 @@ pmap_change_attr(vm_offset_t sva, vm_size_t len, int mode) pte = *ptep &~ L2_S_CACHE_MASK; cpu_idcache_wbinv_range(tmpva, PAGE_SIZE); -#ifdef ARM_L2_PIPT - cpu_l2cache_wbinv_range(pte & L2_S_FRAME, PAGE_SIZE); -#else - cpu_l2cache_wbinv_range(tmpva, PAGE_SIZE); -#endif + pmap_l2cache_wbinv_range(tmpva, pte & L2_S_FRAME, PAGE_SIZE); *ptep = pte; cpu_tlb_flushID_SE(tmpva); @@ -2754,6 +2755,9 @@ do_l2b_alloc: else if (PV_BEEN_REFD(oflags)) cpu_tlb_flushD_SE(va); } + + if ((pmap != pmap_kernel()) && (pmap == &curproc->p_vmspace->vm_pmap)) + cpu_icache_sync_range(va, PAGE_SIZE); } /* @@ -3197,6 +3201,16 @@ pmap_zero_page_gen(vm_page_t pg, int off, int size) else bzero_page(cdstp); + /* + * Although aliasing is not possible if we use + * cdstp temporary mappings with memory that + * will be mapped later as non-cached or with write-through + * caches we might end up overwriting it when calling wbinv_all + * So make sure caches are clean after copy operation + */ + cpu_idcache_wbinv_range(cdstp, size); + pmap_l2cache_wbinv_range(cdstp, phys, size); + mtx_unlock(&cmtx); } @@ -3276,12 +3290,23 @@ pmap_copy_page_generic(vm_paddr_t src, vm_paddr_t dst) *cdst_pte = L2_S_PROTO | dst | pte_l2_s_cache_mode; pmap_set_prot(cdst_pte, VM_PROT_READ | VM_PROT_WRITE, 0); PTE_SYNC(cdst_pte); + cpu_tlb_flushD_SE(csrcp); cpu_tlb_flushD_SE(cdstp); cpu_cpwait(); + /* + * Although aliasing is not possible if we use + * cdstp temporary mappings with memory that + * will be mapped later as non-cached or with write-through + * caches we might end up overwriting it when calling wbinv_all + * So make sure caches are clean after copy operation + */ bcopy_page(csrcp, cdstp); + cpu_idcache_wbinv_range(cdstp, PAGE_SIZE); + pmap_l2cache_wbinv_range(cdstp, dst, PAGE_SIZE); + mtx_unlock(&cmtx); } diff --git a/sys/arm/broadcom/bcm2835/bcm2835_fb.c b/sys/arm/broadcom/bcm2835/bcm2835_fb.c index 05c0bbb..35343c8 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_fb.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_fb.c @@ -94,6 +94,12 @@ static struct argb bcmfb_palette[16] = { {0x00, 0xff, 0xff, 0xff} }; +/* mouse pointer from dev/syscons/scgfbrndr.c */ +static u_char mouse_pointer[16] = { + 0x00, 0x40, 0x60, 0x70, 0x78, 0x7c, 0x7e, 0x68, + 0x0c, 0x0c, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 +}; + #define FB_WIDTH 640 #define FB_HEIGHT 480 #define FB_DEPTH 24 @@ -420,10 +426,141 @@ static video_switch_t bcmfbvidsw = { VIDEO_DRIVER(bcmfb, bcmfbvidsw, bcmfb_configure); -extern sc_rndr_sw_t txtrndrsw; -RENDERER(bcmfb, 0, txtrndrsw, gfb_set); +static vr_init_t bcmrend_init; +static vr_clear_t bcmrend_clear; +static vr_draw_border_t bcmrend_draw_border; +static vr_draw_t bcmrend_draw; +static vr_set_cursor_t bcmrend_set_cursor; +static vr_draw_cursor_t bcmrend_draw_cursor; +static vr_blink_cursor_t bcmrend_blink_cursor; +static vr_set_mouse_t bcmrend_set_mouse; +static vr_draw_mouse_t bcmrend_draw_mouse; + +/* + * We use our own renderer; this is because we must emulate a hardware + * cursor. + */ +static sc_rndr_sw_t bcmrend = { + bcmrend_init, + bcmrend_clear, + bcmrend_draw_border, + bcmrend_draw, + bcmrend_set_cursor, + bcmrend_draw_cursor, + bcmrend_blink_cursor, + bcmrend_set_mouse, + bcmrend_draw_mouse +}; + +RENDERER(bcmfb, 0, bcmrend, gfb_set); RENDERER_MODULE(bcmfb, gfb_set); +static void +bcmrend_init(scr_stat* scp) +{ +} + +static void +bcmrend_clear(scr_stat* scp, int c, int attr) +{ +} + +static void +bcmrend_draw_border(scr_stat* scp, int color) +{ +} + +static void +bcmrend_draw(scr_stat* scp, int from, int count, int flip) +{ + video_adapter_t* adp = scp->sc->adp; + int i, c, a; + + if (!flip) { + /* Normal printing */ + vidd_puts(adp, from, (uint16_t*)sc_vtb_pointer(&scp->vtb, from), count); + } else { + /* This is for selections and such: invert the color attribute */ + for (i = count; i-- > 0; ++from) { + c = sc_vtb_getc(&scp->vtb, from); + a = sc_vtb_geta(&scp->vtb, from) >> 8; + vidd_putc(adp, from, c, (a >> 4) | ((a & 0xf) << 4)); + } + } +} + +static void +bcmrend_set_cursor(scr_stat* scp, int base, int height, int blink) +{ +} + +static void +bcmrend_draw_cursor(scr_stat* scp, int off, int blink, int on, int flip) +{ + video_adapter_t* adp = scp->sc->adp; + struct video_adapter_softc *sc; + int row, col; + uint8_t *addr; + int i, j, bytes; + + sc = (struct video_adapter_softc *)adp; + + if (scp->curs_attr.height <= 0) + return; + + if (sc->fb_addr == 0) + return; + + if (off >= adp->va_info.vi_width * adp->va_info.vi_height) + return; + + /* calculate the coordinates in the video buffer */ + row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight; + col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth; + + addr = (uint8_t *)sc->fb_addr + + (row + sc->ymargin)*(sc->stride) + + (sc->depth/8) * (col + sc->xmargin); + + bytes = sc->depth/8; + + /* our cursor consists of simply inverting the char under it */ + for (i = 0; i < adp->va_info.vi_cheight; i++) { + for (j = 0; j < adp->va_info.vi_cwidth; j++) { + switch (sc->depth) { + case 32: + case 24: + addr[bytes*j + 2] ^= 0xff; + /* FALLTHROUGH */ + case 16: + addr[bytes*j + 1] ^= 0xff; + addr[bytes*j] ^= 0xff; + break; + default: + break; + } + } + + addr += sc->stride; + } +} + +static void +bcmrend_blink_cursor(scr_stat* scp, int at, int flip) +{ +} + +static void +bcmrend_set_mouse(scr_stat* scp) +{ +} + +static void +bcmrend_draw_mouse(scr_stat* scp, int x, int y, int on) +{ + vidd_putm(scp->sc->adp, x, y, mouse_pointer, 0xffffffff, 16, 8); +} + static uint16_t bcmfb_static_window[ROW*COL]; extern u_char dflt_font_16[]; @@ -754,7 +891,7 @@ bcmfb_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a) + (sc->depth/8) * (col + sc->xmargin); fg = a & 0xf ; - bg = (a >> 8) & 0xf; + bg = (a >> 4) & 0xf; for (i = 0; i < BCMFB_FONT_HEIGHT; i++) { for (j = 0, k = 7; j < 8; j++, k--) { diff --git a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c index 6baa8dd..7308c0f 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_machdep.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_machdep.c @@ -78,6 +78,25 @@ initarm_gpio_init(void) void initarm_late_init(void) { + phandle_t system; + pcell_t cells[2]; + int len; + + /* + * It seems there is no way to let syscons framework know + * that framebuffer resolution has changed. So just try + * to fetch data from FDT and go with defaults if failed + */ + system = OF_finddevice("/system"); + if (system != 0) { + len = OF_getprop(system, "linux,serial", &cells, sizeof(cells)); + if (len > 0) + board_set_serial(fdt64_to_cpu(*((uint64_t *)cells))); + + len = OF_getprop(system, "linux,revision", &cells, sizeof(cells)); + if (len > 0) + board_set_revision(fdt32_to_cpu(*((uint32_t *)cells))); + } } #define FDT_DEVMAP_MAX (2) // FIXME diff --git a/sys/arm/broadcom/bcm2835/bcm2835_systimer.c b/sys/arm/broadcom/bcm2835/bcm2835_systimer.c index 3f5b8da..97ec43a 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_systimer.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_systimer.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #define DEFAULT_TIMER 3 #define DEFAULT_FREQUENCY 1000000 +#define MIN_PERIOD 100LLU #define SYSTIMER_CS 0x00 #define SYSTIMER_CLO 0x04 @@ -123,17 +124,24 @@ bcm_systimer_start(struct eventtimer *et, struct bintime *first, struct systimer *st = et->et_priv; uint32_t clo; uint32_t count; + register_t s; if (first != NULL) { - st->enabled = 1; count = (st->et.et_frequency * (first->frac >> 32)) >> 32; if (first->sec != 0) count += st->et.et_frequency * first->sec; + s = intr_disable(); clo = bcm_systimer_tc_read_4(SYSTIMER_CLO); clo += count; + /* + * Clear pending interrupts + */ + bcm_systimer_tc_write_4(SYSTIMER_CS, (1 << st->index)); bcm_systimer_tc_write_4(SYSTIMER_C0 + st->index*4, clo); + st->enabled = 1; + intr_restore(s); return (0); } @@ -154,7 +162,13 @@ static int bcm_systimer_intr(void *arg) { struct systimer *st = (struct systimer *)arg; + uint32_t cs; + + cs = bcm_systimer_tc_read_4(SYSTIMER_CS); + if ((cs & (1 << st->index)) == 0) + return (FILTER_STRAY); + /* ACK interrupt */ bcm_systimer_tc_write_4(SYSTIMER_CS, (1 << st->index)); if (st->enabled) { if (st->et.et_active) { @@ -226,7 +240,7 @@ bcm_systimer_attach(device_t dev) sc->st[DEFAULT_TIMER].et.et_frequency = sc->sysclk_freq; sc->st[DEFAULT_TIMER].et.et_min_period.sec = 0; sc->st[DEFAULT_TIMER].et.et_min_period.frac = - ((0x00000002LLU << 32) / sc->st[DEFAULT_TIMER].et.et_frequency) << 32; + ((MIN_PERIOD << 32) / sc->st[DEFAULT_TIMER].et.et_frequency) << 32; sc->st[DEFAULT_TIMER].et.et_max_period.sec = 0xfffffff0U / sc->st[DEFAULT_TIMER].et.et_frequency; sc->st[DEFAULT_TIMER].et.et_max_period.frac = ((0xfffffffeLLU << 32) / sc->st[DEFAULT_TIMER].et.et_frequency) << 32; diff --git a/sys/arm/conf/BEAGLEBONE b/sys/arm/conf/BEAGLEBONE index 2874dfd..1481d92 100644 --- a/sys/arm/conf/BEAGLEBONE +++ b/sys/arm/conf/BEAGLEBONE @@ -62,11 +62,11 @@ options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed # NFS support #options NFSCL -#options NFSSERVER #Network Filesystem Server -#options NFSCLIENT #Network Filesystem Client +#options NFSD +#options NFSLOCKD # Uncomment this for NFS root -#options NFS_ROOT #NFS usable as /, requires NFSCLIENT +#options NFS_ROOT #NFS usable as /, requires NFSCL #options BOOTP_NFSROOT #options BOOTP_COMPAT #options BOOTP diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h index 1a96176..4862453 100644 --- a/sys/arm/include/atomic.h +++ b/sys/arm/include/atomic.h @@ -47,9 +47,25 @@ #include <machine/cpuconf.h> #endif -#define mb() -#define wmb() -#define rmb() +#if defined (__ARM_ARCH_7__) || defined (__ARM_ARCH_7A__) +#define isb() __asm __volatile("isb" : : : "memory") +#define dsb() __asm __volatile("dsb" : : : "memory") +#define dmb() __asm __volatile("dmb" : : : "memory") +#elif defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) || \ + defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) || \ + defined (__ARM_ARCH_6ZK__) +#define isb() __asm __volatile("mcr p15, 0, %0, c7, c5, 4" : : "r" (0) : "memory") +#define dsb() __asm __volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory") +#define dmb() __asm __volatile("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory") +#else +#define isb() +#define dsb() +#define dmb() +#endif + +#define mb() dmb() +#define wmb() dmb() +#define rmb() dmb() #ifndef I32_bit #define I32_bit (1 << 7) /* IRQ disable */ diff --git a/sys/arm/include/machdep.h b/sys/arm/include/machdep.h index 8ea5e2f..f50cde8 100644 --- a/sys/arm/include/machdep.h +++ b/sys/arm/include/machdep.h @@ -37,6 +37,10 @@ void initarm_gpio_init(void); void initarm_late_init(void); int platform_devmap_init(void); +/* Board-specific attributes */ +void board_set_serial(uint64_t); +void board_set_revision(uint32_t); + /* Needs to be initialised by platform_devmap_init */ extern const struct pmap_devmap *pmap_devmap_bootstrap_table; diff --git a/sys/arm/include/pcpu.h b/sys/arm/include/pcpu.h index f12f903..43ffb44 100644 --- a/sys/arm/include/pcpu.h +++ b/sys/arm/include/pcpu.h @@ -100,8 +100,8 @@ set_tls(void *tls) #define PCPU_GET(member) (get_pcpu()->pc_ ## member) #define PCPU_ADD(member, value) (get_pcpu()->pc_ ## member += (value)) #define PCPU_INC(member) PCPU_ADD(member, 1) -#define PCPU_PTR(member) (&pcpup->pc_ ## member) -#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) +#define PCPU_PTR(member) (&get_pcpu()->pc_ ## member) +#define PCPU_SET(member,value) (get_pcpu()->pc_ ## member = (value)) void pcpu0_init(void); #endif /* _KERNEL */ diff --git a/sys/arm/include/pl310.h b/sys/arm/include/pl310.h index 98df53c..a3c42d8 100644 --- a/sys/arm/include/pl310.h +++ b/sys/arm/include/pl310.h @@ -29,10 +29,140 @@ #ifndef PL310_H_ #define PL310_H_ + +/** + * PL310 - L2 Cache Controller register offsets. + * + */ +#define PL310_CACHE_ID 0x000 +#define CACHE_ID_RELEASE_SHIFT 0 +#define CACHE_ID_RELEASE_MASK 0x3f +#define CACHE_ID_RELEASE_r0p0 0x00 +#define CACHE_ID_RELEASE_r1p0 0x02 +#define CACHE_ID_RELEASE_r2p0 0x04 +#define CACHE_ID_RELEASE_r3p0 0x05 +#define CACHE_ID_RELEASE_r3p1 0x06 +#define CACHE_ID_RELEASE_r3p2 0x08 +#define CACHE_ID_RELEASE_r3p3 0x09 +#define CACHE_ID_PARTNUM_SHIFT 6 +#define CACHE_ID_PARTNUM_MASK 0xf +#define CACHE_ID_PARTNUM_VALUE 0x3 +#define PL310_CACHE_TYPE 0x004 +#define PL310_CTRL 0x100 +#define CTRL_ENABLED 0x01 +#define CTRL_DISABLED 0x00 +#define PL310_AUX_CTRL 0x104 +#define AUX_CTRL_MASK 0xc0000fff +#define AUX_CTRL_ASSOCIATIVITY_SHIFT 16 +#define AUX_CTRL_WAY_SIZE_SHIFT 17 +#define AUX_CTRL_WAY_SIZE_MASK (0x7 << 17) +#define AUX_CTRL_SHARE_OVERRIDE (1 << 22) +#define AUX_CTRL_NS_LOCKDOWN (1 << 26) +#define AUX_CTRL_NS_INT_CTRL (1 << 27) +#define AUX_CTRL_DATA_PREFETCH (1 << 28) +#define AUX_CTRL_INSTR_PREFETCH (1 << 29) +#define AUX_CTRL_EARLY_BRESP (1 << 30) +#define PL310_EVENT_COUNTER_CTRL 0x200 +#define EVENT_COUNTER_CTRL_ENABLED (1 << 0) +#define EVENT_COUNTER_CTRL_C0_RESET (1 << 1) +#define EVENT_COUNTER_CTRL_C1_RESET (1 << 2) +#define PL310_EVENT_COUNTER1_CONF 0x204 +#define PL310_EVENT_COUNTER0_CONF 0x208 +#define EVENT_COUNTER_CONF_NOINTR 0 +#define EVENT_COUNTER_CONF_INCR 1 +#define EVENT_COUNTER_CONF_OVFW 2 +#define EVENT_COUNTER_CONF_NOEV (0 << 2) +#define EVENT_COUNTER_CONF_CO (1 << 2) +#define EVENT_COUNTER_CONF_DRHIT (2 << 2) +#define EVENT_COUNTER_CONF_DRREQ (3 << 2) +#define EVENT_COUNTER_CONF_DWHIT (4 << 2) +#define EVENT_COUNTER_CONF_DWREQ (5 << 2) +#define EVENT_COUNTER_CONF_DWTREQ (6 << 2) +#define EVENT_COUNTER_CONF_DIRHIT (7 << 2) +#define EVENT_COUNTER_CONF_DIRREQ (8 << 2) +#define EVENT_COUNTER_CONF_WA (9 << 2) +#define PL310_EVENT_COUNTER1_VAL 0x20C +#define PL310_EVENT_COUNTER0_VAL 0x210 +#define PL310_INTR_MASK 0x214 +#define PL310_MASKED_INTR_STAT 0x218 +#define PL310_RAW_INTR_STAT 0x21C +#define PL310_INTR_CLEAR 0x220 +#define INTR_MASK_ALL ((1 << 9) - 1) +#define INTR_MASK_ECNTR (1 << 0) +#define INTR_MASK_PARRT (1 << 1) +#define INTR_MASK_PARRD (1 << 2) +#define INTR_MASK_ERRWT (1 << 3) +#define INTR_MASK_ERRWD (1 << 4) +#define INTR_MASK_ERRRT (1 << 5) +#define INTR_MASK_ERRRD (1 << 6) +#define INTR_MASK_SLVERR (1 << 7) +#define INTR_MASK_DECERR (1 << 8) +#define PL310_CACHE_SYNC 0x730 +#define PL310_INV_LINE_PA 0x770 +#define PL310_INV_WAY 0x77C +#define PL310_CLEAN_LINE_PA 0x7B0 +#define PL310_CLEAN_LINE_IDX 0x7B8 +#define PL310_CLEAN_WAY 0x7BC +#define PL310_CLEAN_INV_LINE_PA 0x7F0 +#define PL310_CLEAN_INV_LINE_IDX 0x7F8 +#define PL310_CLEAN_INV_WAY 0x7FC +#define PL310_LOCKDOWN_D_WAY(x) (0x900 + ((x) * 8)) +#define PL310_LOCKDOWN_I_WAY(x) (0x904 + ((x) * 8)) +#define PL310_LOCKDOWN_LINE_ENABLE 0x950 +#define PL310_UNLOCK_ALL_LINES_WAY 0x954 +#define PL310_ADDR_FILTER_STAR 0xC00 +#define PL310_ADDR_FILTER_END 0xC04 +#define PL310_DEBUG_CTRL 0xF40 +#define PL310_PREFETCH_CTRL 0xF60 +#define PREFETCH_CTRL_OFFSET_MASK (0x1f) +#define PREFETCH_CTRL_NOTSAMEID (1 << 21) +#define PREFETCH_CTRL_INCR_DL (1 << 23) +#define PREFETCH_CTRL_PREFETCH_DROP (1 << 24) +#define PREFETCH_CTRL_DL_ON_WRAP (1 << 27) +#define PREFETCH_CTRL_DATA_PREFETCH (1 << 28) +#define PREFETCH_CTRL_INSTR_PREFETCH (1 << 29) +#define PREFETCH_CTRL_DL (1 << 30) +#define PL310_POWER_CTRL 0xF60 + struct pl310_softc { + device_t sc_dev; struct resource *sc_mem_res; + struct resource *sc_irq_res; + void* sc_irq_h; + int sc_enabled; + struct mtx sc_mtx; + u_int sc_rtl_revision; }; -void platform_init_pl310(struct pl310_softc *sc); +/** + * pl310_read4 - read a 32-bit value from the PL310 registers + * pl310_write4 - write a 32-bit value from the PL310 registers + * @off: byte offset within the register set to read from + * @val: the value to write into the register + * + * + * LOCKING: + * None + * + * RETURNS: + * nothing in case of write function, if read function returns the value read. + */ +static __inline uint32_t +pl310_read4(struct pl310_softc *sc, bus_size_t off) +{ + + return bus_read_4(sc->sc_mem_res, off); +} + +static __inline void +pl310_write4(struct pl310_softc *sc, bus_size_t off, uint32_t val) +{ + + bus_write_4(sc->sc_mem_res, off, val); +} + +void platform_pl310_init(struct pl310_softc *); +void platform_pl310_write_ctrl(struct pl310_softc *, uint32_t); +void platform_pl310_write_debug(struct pl310_softc *, uint32_t); #endif /* PL310_H_ */ diff --git a/sys/arm/include/pmap.h b/sys/arm/include/pmap.h index da4571d..4f7566e 100644 --- a/sys/arm/include/pmap.h +++ b/sys/arm/include/pmap.h @@ -61,7 +61,7 @@ #else #define PTE_NOCACHE 1 #endif -#define PTE_CACHE 4 +#define PTE_CACHE 6 #define PTE_DEVICE 2 #define PTE_PAGETABLE 4 #else diff --git a/sys/arm/ti/cpsw/if_cpsw.c b/sys/arm/ti/cpsw/if_cpsw.c index 8ed0ce5..a47c131 100644 --- a/sys/arm/ti/cpsw/if_cpsw.c +++ b/sys/arm/ti/cpsw/if_cpsw.c @@ -95,10 +95,10 @@ static void cpsw_start(struct ifnet *ifp); static void cpsw_start_locked(struct ifnet *ifp); static void cpsw_stop_locked(struct cpsw_softc *sc); static int cpsw_ioctl(struct ifnet *ifp, u_long command, caddr_t data); -static int cpsw_allocate_dma(struct cpsw_softc *sc); -static int cpsw_free_dma(struct cpsw_softc *sc); -static int cpsw_new_rxbuf(struct cpsw_softc *sc, uint32_t i, uint32_t next); -static void cpsw_watchdog(struct cpsw_softc *sc); +static int cpsw_init_slot_lists(struct cpsw_softc *sc); +static void cpsw_free_slot(struct cpsw_softc *sc, struct cpsw_slot *slot); +static void cpsw_fill_rx_queue_locked(struct cpsw_softc *sc); +static void cpsw_tx_watchdog(struct cpsw_softc *sc); static void cpsw_intr_rx_thresh(void *arg); static void cpsw_intr_rx(void *arg); @@ -156,10 +156,10 @@ static struct { driver_intr_t *handler; char * description; } cpsw_intrs[CPSW_INTR_COUNT + 1] = { - { cpsw_intr_rx_thresh,"CPSW RX threshold interrupt" }, + { cpsw_intr_rx_thresh, "CPSW RX threshold interrupt" }, { cpsw_intr_rx, "CPSW RX interrupt" }, { cpsw_intr_tx, "CPSW TX interrupt" }, - { cpsw_intr_misc,"CPSW misc interrupt" }, + { cpsw_intr_misc, "CPSW misc interrupt" }, }; /* Locking macros */ @@ -199,6 +199,34 @@ static struct { } while (0) +#include <machine/stdarg.h> +static void +cpsw_debugf_head(const char *funcname) +{ + int t = (int)(time_second % (24 * 60 * 60)); + + printf("%02d:%02d:%02d %s ", t / (60 * 60), (t / 60) % 60, t % 60, funcname); +} + +static void +cpsw_debugf(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vprintf(fmt, ap); + va_end(ap); + printf("\n"); + +} + +#define CPSW_DEBUGF(a) do { \ + if (sc->cpsw_if_flags & IFF_DEBUG) { \ + cpsw_debugf_head(__func__); \ + cpsw_debugf a; \ + } \ +} while (0) + static int cpsw_probe(device_t dev) { @@ -213,18 +241,20 @@ cpsw_probe(device_t dev) static int cpsw_attach(device_t dev) { - struct cpsw_softc *sc; + struct cpsw_softc *sc = device_get_softc(dev); struct mii_softc *miisc; struct ifnet *ifp; + void *phy_sc; int i, error, phy; uint32_t reg; - sc = device_get_softc(dev); + CPSW_DEBUGF(("")); + sc->dev = dev; sc->node = ofw_bus_get_node(dev); /* Get phy address from fdt */ - if (fdt_get_phyaddr(sc->node, sc->dev, &phy, (void **)&sc->phy_sc) != 0) { + if (fdt_get_phyaddr(sc->node, sc->dev, &phy, &phy_sc) != 0) { device_printf(dev, "failed to get PHY address from FDT\n"); return (ENXIO); } @@ -246,14 +276,32 @@ cpsw_attach(device_t dev) device_printf(dev, "Version %d.%d (%d)\n", (reg >> 8 & 0x7), reg & 0xFF, (reg >> 11) & 0x1F); - /* Allocate DMA, buffers, buffer descriptors */ - error = cpsw_allocate_dma(sc); + //cpsw_add_sysctls(sc); TODO + + /* Allocate a busdma tag and DMA safe memory for mbufs. */ + error = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* parent */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filtfunc, filtfuncarg */ + MCLBYTES, 1, /* maxsize, nsegments */ + MCLBYTES, 0, /* maxsegsz, flags */ + NULL, NULL, /* lockfunc, lockfuncarg */ + &sc->mbuf_dtag); /* dmatag */ if (error) { + device_printf(dev, "bus_dma_tag_create failed\n"); cpsw_detach(dev); - return (ENXIO); + return (ENOMEM); } - //cpsw_add_sysctls(sc); TODO + /* Initialize the tx_avail and rx_avail lists. */ + error = cpsw_init_slot_lists(sc); + if (error) { + device_printf(dev, "failed to allocate dmamaps\n"); + cpsw_detach(dev); + return (ENOMEM); + } /* Allocate network interface */ ifp = sc->ifp = if_alloc(IFT_ETHER); @@ -294,7 +342,7 @@ cpsw_attach(device_t dev) /* Initialze MDIO - ENABLE, PREAMBLE=0, FAULTENB, CLKDIV=0xFF */ /* TODO Calculate MDCLK=CLK/(CLKDIV+1) */ - cpsw_write_4(MDIOCONTROL, (1<<30) | (1<<18) | 0xFF); + cpsw_write_4(MDIOCONTROL, 1 << 30 | 1 << 18 | 0xFF); /* Attach PHY(s) */ error = mii_attach(dev, &sc->miibus, ifp, cpsw_ifmedia_upd, @@ -310,7 +358,7 @@ cpsw_attach(device_t dev) miisc = LIST_FIRST(&sc->mii->mii_phys); /* Select PHY and enable interrupts */ - cpsw_write_4(MDIOUSERPHYSEL0, (1 << 6) | (miisc->mii_phy & 0x1F)); + cpsw_write_4(MDIOUSERPHYSEL0, 1 << 6 | (miisc->mii_phy & 0x1F)); /* Attach interrupt handlers */ for (i = 1; i <= CPSW_INTR_COUNT; ++i) { @@ -332,17 +380,22 @@ cpsw_attach(device_t dev) static int cpsw_detach(device_t dev) { - struct cpsw_softc *sc; - int error,i; + struct cpsw_softc *sc = device_get_softc(dev); + int error, i; - sc = device_get_softc(dev); + CPSW_DEBUGF(("")); /* Stop controller and free TX queue */ - if (sc->ifp) - cpsw_shutdown(dev); + if (device_is_attached(dev)) { + ether_ifdetach(sc->ifp); + CPSW_GLOBAL_LOCK(sc); + cpsw_stop_locked(sc); + CPSW_GLOBAL_UNLOCK(sc); + callout_drain(&sc->wd_callout); + } - /* Wait for stopping ticks */ - callout_drain(&sc->wd_callout); + bus_generic_detach(dev); + device_delete_child(dev, sc->miibus); /* Stop and release all interrupts */ for (i = 0; i < CPSW_INTR_COUNT; ++i) { @@ -355,14 +408,17 @@ cpsw_detach(device_t dev) cpsw_intrs[i + 1].description); } - /* Detach network interface */ - if (sc->ifp) { - ether_ifdetach(sc->ifp); - if_free(sc->ifp); + /* Free dmamaps and mbufs */ + for (i = 0; i < CPSW_MAX_TX_BUFFERS; i++) { + cpsw_free_slot(sc, &sc->_tx_slots[i]); + } + for (i = 0; i < CPSW_MAX_RX_BUFFERS; i++) { + cpsw_free_slot(sc, &sc->_rx_slots[i]); } - /* Free DMA resources */ - cpsw_free_dma(sc); + /* Free DMA tag */ + error = bus_dma_tag_destroy(sc->mbuf_dtag); + KASSERT(error == 0, ("Unable to destroy DMA tag")); /* Free IO memory handler */ bus_release_resources(dev, res_spec, sc->res); @@ -377,15 +433,19 @@ cpsw_detach(device_t dev) static int cpsw_suspend(device_t dev) { + struct cpsw_softc *sc = device_get_softc(dev); - device_printf(dev, "%s\n", __FUNCTION__); + CPSW_DEBUGF(("")); + CPSW_GLOBAL_LOCK(sc); + cpsw_stop_locked(sc); + CPSW_GLOBAL_UNLOCK(sc); return (0); } static int cpsw_resume(device_t dev) { - + /* XXX TODO XXX */ device_printf(dev, "%s\n", __FUNCTION__); return (0); } @@ -395,208 +455,132 @@ cpsw_shutdown(device_t dev) { struct cpsw_softc *sc = device_get_softc(dev); + CPSW_DEBUGF(("")); CPSW_GLOBAL_LOCK(sc); - cpsw_stop_locked(sc); - CPSW_GLOBAL_UNLOCK(sc); - return (0); } static int -cpsw_miibus_readreg(device_t dev, int phy, int reg) +cpsw_miibus_ready(struct cpsw_softc *sc) { - struct cpsw_softc *sc; - uint32_t r; - uint32_t retries = CPSW_MIIBUS_RETRIES; - - sc = device_get_softc(dev); + uint32_t r, retries = CPSW_MIIBUS_RETRIES; - /* Wait until interface is ready by watching GO bit */ - while(--retries && (cpsw_read_4(MDIOUSERACCESS0) & (1 << 31)) ) + while (--retries) { + r = cpsw_read_4(MDIOUSERACCESS0); + if ((r & 1 << 31) == 0) + return 1; DELAY(CPSW_MIIBUS_DELAY); - if (!retries) - device_printf(dev, "Timeout while waiting for MDIO.\n"); + } + return 0; +} - /* Set GO, phy and reg */ - cpsw_write_4(MDIOUSERACCESS0, (1 << 31) | - ((reg & 0x1F) << 21) | ((phy & 0x1F) << 16)); +static int +cpsw_miibus_readreg(device_t dev, int phy, int reg) +{ + struct cpsw_softc *sc = device_get_softc(dev); + uint32_t cmd, r; - while(--retries && (cpsw_read_4(MDIOUSERACCESS0) & (1 << 31)) ) - DELAY(CPSW_MIIBUS_DELAY); - if (!retries) - device_printf(dev, "Timeout while waiting for MDIO.\n"); + if (!cpsw_miibus_ready(sc)) { + device_printf(dev, "MDIO not ready to read\n"); + return 0; + } + + /* Set GO, reg, phy */ + cmd = 1 << 31 | (reg & 0x1F) << 21 | (phy & 0x1F) << 16; + cpsw_write_4(MDIOUSERACCESS0, cmd); + + if (!cpsw_miibus_ready(sc)) { + device_printf(dev, "MDIO timed out during read\n"); + return 0; + } r = cpsw_read_4(MDIOUSERACCESS0); - /* Check for ACK */ - if(r & (1<<29)) { - return (r & 0xFFFF); + if((r & 1 << 29) == 0) { + device_printf(dev, "Failed to read from PHY.\n"); + r = 0; } - device_printf(dev, "Failed to read from PHY.\n"); - return 0; + return (r & 0xFFFF); } static int cpsw_miibus_writereg(device_t dev, int phy, int reg, int value) { - struct cpsw_softc *sc; - uint32_t retries = CPSW_MIIBUS_RETRIES; - - sc = device_get_softc(dev); - - /* Wait until interface is ready by watching GO bit */ - while(--retries && (cpsw_read_4(MDIOUSERACCESS0) & (1 << 31)) ) - DELAY(CPSW_MIIBUS_DELAY); - if (!retries) - device_printf(dev, "Timeout while waiting for MDIO.\n"); + struct cpsw_softc *sc = device_get_softc(dev); + uint32_t cmd; - /* Set GO, WRITE, phy, reg and value */ - cpsw_write_4(MDIOUSERACCESS0, (value & 0xFFFF) | (3 << 30) | - ((reg & 0x1F) << 21) | ((phy & 0x1F) << 16)); + if (!cpsw_miibus_ready(sc)) { + device_printf(dev, "MDIO not ready to write\n"); + return 0; + } - while(--retries && (cpsw_read_4(MDIOUSERACCESS0) & (1 << 31)) ) - DELAY(CPSW_MIIBUS_DELAY); - if (!retries) - device_printf(dev, "Timeout while waiting for MDIO.\n"); + /* Set GO, WRITE, reg, phy, and value */ + cmd = 3 << 30 | (reg & 0x1F) << 21 | (phy & 0x1F) << 16 + | (value & 0xFFFF); + cpsw_write_4(MDIOUSERACCESS0, cmd); - /* Check for ACK */ - if(cpsw_read_4(MDIOUSERACCESS0) & (1<<29)) { + if (!cpsw_miibus_ready(sc)) { + device_printf(dev, "MDIO timed out during write\n"); return 0; } - device_printf(dev, "Failed to write to PHY.\n"); + + if((cpsw_read_4(MDIOUSERACCESS0) & (1 << 29)) == 0) + device_printf(dev, "Failed to write to PHY.\n"); return 0; } static int -cpsw_allocate_dma(struct cpsw_softc *sc) +cpsw_init_slot_lists(struct cpsw_softc *sc) { - int err; int i; - /* Allocate a busdma tag and DMA safe memory for tx mbufs. */ - err = bus_dma_tag_create( - bus_get_dma_tag(sc->dev), /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filtfunc, filtfuncarg */ - MCLBYTES, 1, /* maxsize, nsegments */ - MCLBYTES, 0, /* maxsegsz, flags */ - NULL, NULL, /* lockfunc, lockfuncarg */ - &sc->mbuf_dtag); /* dmatag */ + STAILQ_INIT(&sc->rx_active); + STAILQ_INIT(&sc->rx_avail); + STAILQ_INIT(&sc->tx_active); + STAILQ_INIT(&sc->tx_avail); - if (err) - return (ENOMEM); + /* Put the slot descriptors onto the avail lists. */ for (i = 0; i < CPSW_MAX_TX_BUFFERS; i++) { - if ( bus_dmamap_create(sc->mbuf_dtag, 0, &sc->tx_dmamap[i])) { - if_printf(sc->ifp, "failed to create dmamap for rx mbuf\n"); + struct cpsw_slot *slot = &sc->_tx_slots[i]; + slot->index = i; + /* XXX TODO: Remove this from here; allocate dmamaps lazily + in the encap routine to reduce memory usage. */ + if (bus_dmamap_create(sc->mbuf_dtag, 0, &slot->dmamap)) { + if_printf(sc->ifp, "failed to create dmamap for tx mbuf\n"); return (ENOMEM); } + STAILQ_INSERT_TAIL(&sc->tx_avail, slot, next); } for (i = 0; i < CPSW_MAX_RX_BUFFERS; i++) { - if ( bus_dmamap_create(sc->mbuf_dtag, 0, &sc->rx_dmamap[i])) { + struct cpsw_slot *slot = &sc->_rx_slots[i]; + slot->index = i; + if (bus_dmamap_create(sc->mbuf_dtag, 0, &slot->dmamap)) { if_printf(sc->ifp, "failed to create dmamap for rx mbuf\n"); return (ENOMEM); } + STAILQ_INSERT_TAIL(&sc->rx_avail, slot, next); } return (0); } -static int -cpsw_free_dma(struct cpsw_softc *sc) -{ - (void)sc; /* UNUSED */ - // TODO - return 0; -} - -static int -cpsw_new_rxbuf(struct cpsw_softc *sc, uint32_t i, uint32_t next) -{ - bus_dma_segment_t seg[1]; - struct cpsw_cpdma_bd bd; - int error; - int nsegs; - - sc->rx_mbuf[i] = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - if (sc->rx_mbuf[i] == NULL) - return (ENOBUFS); - - sc->rx_mbuf[i]->m_len = sc->rx_mbuf[i]->m_pkthdr.len = sc->rx_mbuf[i]->m_ext.ext_size; - - error = bus_dmamap_load_mbuf_sg(sc->mbuf_dtag, sc->rx_dmamap[i], - sc->rx_mbuf[i], seg, &nsegs, BUS_DMA_NOWAIT); - - KASSERT(nsegs == 1, ("Too many segments returned!")); - if (nsegs != 1 || error) - panic("%s: nsegs(%d), error(%d)",__func__, nsegs, error); - - bus_dmamap_sync(sc->mbuf_dtag, sc->rx_dmamap[i], BUS_DMASYNC_PREREAD); - - /* Create and submit new rx descriptor*/ - bd.next = next; - bd.bufptr = seg->ds_addr; - bd.buflen = MCLBYTES-1; - bd.bufoff = 2; /* make IP hdr aligned with 4 */ - bd.pktlen = 0; - bd.flags = CPDMA_BD_OWNER; - cpsw_cpdma_write_rxbd(i, &bd); - - return (0); -} - - -static int -cpsw_encap(struct cpsw_softc *sc, struct mbuf *m0) +static void +cpsw_free_slot(struct cpsw_softc *sc, struct cpsw_slot *slot) { - bus_dma_segment_t seg[1]; - struct cpsw_cpdma_bd bd; int error; - int nsegs; - int idx; - - if (sc->txbd_queue_size == CPSW_MAX_TX_BUFFERS) - return (ENOBUFS); - - idx = sc->txbd_head + sc->txbd_queue_size; - - if (idx >= (CPSW_MAX_TX_BUFFERS) ) - idx -= CPSW_MAX_TX_BUFFERS; - /* Create mapping in DMA memory */ - error = bus_dmamap_load_mbuf_sg(sc->mbuf_dtag, sc->tx_dmamap[idx], m0, seg, &nsegs, - BUS_DMA_NOWAIT); - sc->tc[idx]++; - if (error != 0 || nsegs != 1 ) { - bus_dmamap_unload(sc->mbuf_dtag, sc->tx_dmamap[idx]); - return ((error != 0) ? error : -1); + if (slot->dmamap) { + error = bus_dmamap_destroy(sc->mbuf_dtag, slot->dmamap); + KASSERT(error == 0, ("Mapping still active")); + slot->dmamap = NULL; + } + if (slot->mbuf) { + m_freem(slot->mbuf); + slot->mbuf = NULL; } - bus_dmamap_sync(sc->mbuf_dtag, sc->tx_dmamap[idx], BUS_DMASYNC_PREWRITE); - - /* Fill descriptor data */ - bd.next = 0; - bd.bufptr = seg->ds_addr; - bd.bufoff = 0; - bd.buflen = seg->ds_len; - bd.pktlen = seg->ds_len; - /* Set OWNERSHIP, SOP, EOP */ - bd.flags = (7<<13); - - /* Write descriptor */ - cpsw_cpdma_write_txbd(idx, &bd); - sc->tx_mbuf[idx] = m0; - - /* Previous descriptor should point to us */ - cpsw_cpdma_write_txbd_next(((idx-1<0)?(CPSW_MAX_TX_BUFFERS-1):(idx-1)), - cpsw_cpdma_txbd_paddr(idx)); - - sc->txbd_queue_size++; - - return (0); } /* @@ -655,10 +639,13 @@ cpsw_start(struct ifnet *ifp) static void cpsw_start_locked(struct ifnet *ifp) { + bus_dma_segment_t seg[1]; + struct cpsw_cpdma_bd bd; struct cpsw_softc *sc = ifp->if_softc; + struct cpsw_queue newslots = STAILQ_HEAD_INITIALIZER(newslots); + struct cpsw_slot *slot, *prev_slot = NULL, *first_new_slot; struct mbuf *m0, *mtmp; - uint32_t queued = 0; - int error; + int error, nsegs, enqueued = 0; CPSW_TX_LOCK_ASSERT(sc); @@ -666,44 +653,101 @@ cpsw_start_locked(struct ifnet *ifp) IFF_DRV_RUNNING) return; + /* Pull pending packets from IF queue and prep them for DMA. */ for (;;) { - /* Get packet from the queue */ + slot = STAILQ_FIRST(&sc->tx_avail); + if (slot == NULL) { + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + break; + } + IF_DEQUEUE(&ifp->if_snd, m0); if (m0 == NULL) break; if ((error = cpsw_pad(m0))) { + if_printf(ifp, + "%s: Dropping packet; could not pad\n", __func__); m_freem(m0); continue; } + /* TODO: don't defragment here, queue each + packet fragment as a separate entry. */ mtmp = m_defrag(m0, M_NOWAIT); if (mtmp) m0 = mtmp; - if (cpsw_encap(sc, m0)) { - IF_PREPEND(&ifp->if_snd, m0); - ifp->if_drv_flags |= IFF_DRV_OACTIVE; + slot->mbuf = m0; + /* Create mapping in DMA memory */ + error = bus_dmamap_load_mbuf_sg(sc->mbuf_dtag, slot->dmamap, + m0, seg, &nsegs, BUS_DMA_NOWAIT); + KASSERT(nsegs == 1, ("More than one segment (nsegs=%d)", nsegs)); + KASSERT(error == 0, ("DMA error (error=%d)", error)); + if (error != 0 || nsegs != 1) { + if_printf(ifp, + "%s: Can't load packet for DMA (nsegs=%d, error=%d), dropping packet\n", + __func__, nsegs, error); + bus_dmamap_unload(sc->mbuf_dtag, slot->dmamap); + m_freem(m0); break; } - queued++; + bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, + BUS_DMASYNC_PREWRITE); + + if (prev_slot != NULL) + cpsw_cpdma_write_txbd_next(prev_slot->index, + cpsw_cpdma_txbd_paddr(slot->index)); + bd.next = 0; + bd.bufptr = seg->ds_addr; + bd.bufoff = 0; + bd.buflen = seg->ds_len; + bd.pktlen = seg->ds_len; + bd.flags = 7 << 13; /* Set OWNERSHIP, SOP, EOP */ + cpsw_cpdma_write_txbd(slot->index, &bd); + ++enqueued; + + prev_slot = slot; + STAILQ_REMOVE_HEAD(&sc->tx_avail, next); + STAILQ_INSERT_TAIL(&newslots, slot, next); BPF_MTAP(ifp, m0); } - if (!queued) + if (STAILQ_EMPTY(&newslots)) return; - if (sc->eoq) { - cpsw_write_4(CPSW_CPDMA_TX_HDP(0), cpsw_cpdma_txbd_paddr(sc->txbd_head)); - sc->eoq = 0; + /* Attach the list of new buffers to the hardware TX queue. */ + prev_slot = STAILQ_LAST(&sc->tx_active, cpsw_slot, next); + first_new_slot = STAILQ_FIRST(&newslots); + STAILQ_CONCAT(&sc->tx_active, &newslots); + if (prev_slot == NULL) { + /* Start the TX queue fresh. */ + cpsw_write_4(CPSW_CPDMA_TX_HDP(0), + cpsw_cpdma_txbd_paddr(first_new_slot->index)); + } else { + /* Add buffers to end of current queue. */ + cpsw_cpdma_write_txbd_next(prev_slot->index, + cpsw_cpdma_txbd_paddr(first_new_slot->index)); + /* If underrun, restart queue. */ + if (cpsw_cpdma_read_txbd_flags(prev_slot->index) & CPDMA_BD_EOQ) + cpsw_write_4(CPSW_CPDMA_TX_HDP(0), + cpsw_cpdma_txbd_paddr(first_new_slot->index)); + } + sc->tx_enqueues += enqueued; + sc->tx_queued += enqueued; + if (sc->tx_queued > sc->tx_max_queued) { + sc->tx_max_queued = sc->tx_queued; + CPSW_DEBUGF(("New TX high water mark %d", sc->tx_queued)); } - sc->wd_timer = 5; } static void cpsw_stop_locked(struct cpsw_softc *sc) { struct ifnet *ifp; + int i; + + CPSW_DEBUGF(("")); CPSW_GLOBAL_LOCK_ASSERT(sc); @@ -712,15 +756,88 @@ cpsw_stop_locked(struct cpsw_softc *sc) if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; + /* Disable interface */ + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + /* Stop tick engine */ callout_stop(&sc->wd_callout); - /* Disable interface */ - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - sc->wd_timer = 0; + /* Wait for hardware to clear pending ops. */ + CPSW_GLOBAL_UNLOCK(sc); + CPSW_DEBUGF(("starting RX and TX teardown")); + cpsw_write_4(CPSW_CPDMA_RX_TEARDOWN, 0); + cpsw_write_4(CPSW_CPDMA_TX_TEARDOWN, 0); + i = 0; + cpsw_intr_rx(sc); // Try clearing without delay. + cpsw_intr_tx(sc); + while (sc->rx_running || sc->tx_running) { + DELAY(10); + cpsw_intr_rx(sc); + cpsw_intr_tx(sc); + ++i; + } + CPSW_DEBUGF(("finished RX and TX teardown (%d tries)", i)); + CPSW_GLOBAL_LOCK(sc); + + /* All slots are now available */ + STAILQ_CONCAT(&sc->rx_avail, &sc->rx_active); + STAILQ_CONCAT(&sc->tx_avail, &sc->tx_active); + CPSW_DEBUGF(("%d buffers dropped at TX reset", sc->tx_queued)); + sc->tx_queued = 0; + + /* Reset writer */ + cpsw_write_4(CPSW_WR_SOFT_RESET, 1); + while (cpsw_read_4(CPSW_WR_SOFT_RESET) & 1) + ; + + /* Reset SS */ + cpsw_write_4(CPSW_SS_SOFT_RESET, 1); + while (cpsw_read_4(CPSW_SS_SOFT_RESET) & 1) + ; + + /* Reset Sliver port 1 and 2 */ + for (i = 0; i < 2; i++) { + /* Reset */ + cpsw_write_4(CPSW_SL_SOFT_RESET(i), 1); + while (cpsw_read_4(CPSW_SL_SOFT_RESET(i)) & 1) + ; + } + + /* Reset CPDMA */ + cpsw_write_4(CPSW_CPDMA_SOFT_RESET, 1); + while (cpsw_read_4(CPSW_CPDMA_SOFT_RESET) & 1) + ; + + /* Disable TX & RX DMA */ + cpsw_write_4(CPSW_CPDMA_TX_CONTROL, 0); + cpsw_write_4(CPSW_CPDMA_RX_CONTROL, 0); + + /* Disable TX and RX interrupts for all cores. */ + for (i = 0; i < 3; ++i) { + cpsw_write_4(CPSW_WR_C_TX_EN(i), 0x00); + cpsw_write_4(CPSW_WR_C_RX_EN(i), 0x00); + cpsw_write_4(CPSW_WR_C_MISC_EN(i), 0x00); + } + + /* Clear all interrupt Masks */ + cpsw_write_4(CPSW_CPDMA_RX_INTMASK_CLEAR, 0xFFFFFFFF); + cpsw_write_4(CPSW_CPDMA_TX_INTMASK_CLEAR, 0xFFFFFFFF); +} - /* Disable interrupts TODO */ +static void +cpsw_set_promisc(struct cpsw_softc *sc, int set) +{ + if (set) { + printf("Promiscuous mode unimplemented\n"); + } +} +static void +cpsw_set_allmulti(struct cpsw_softc *sc, int set) +{ + if (set) { + printf("All-multicast mode unimplemented\n"); + } } static int @@ -729,53 +846,48 @@ cpsw_ioctl(struct ifnet *ifp, u_long command, caddr_t data) struct cpsw_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq *)data; int error; - uint32_t flags; + uint32_t changed; + CPSW_DEBUGF(("command=0x%lx", command)); error = 0; - // FIXME switch (command) { case SIOCSIFFLAGS: CPSW_GLOBAL_LOCK(sc); if (ifp->if_flags & IFF_UP) { if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - flags = ifp->if_flags ^ sc->cpsw_if_flags; - if (flags & IFF_PROMISC) - printf("%s: SIOCSIFFLAGS " - "IFF_PROMISC unimplemented\n", - __func__); - - if (flags & IFF_ALLMULTI) - printf("%s: SIOCSIFFLAGS " - "IFF_ALLMULTI unimplemented\n", - __func__); + changed = ifp->if_flags ^ sc->cpsw_if_flags; + CPSW_DEBUGF(("SIOCSIFFLAGS: UP & RUNNING (changed=0x%x)", changed)); + if (changed & IFF_PROMISC) + cpsw_set_promisc(sc, + ifp->if_flags & IFF_PROMISC); + if (changed & IFF_ALLMULTI) + cpsw_set_allmulti(sc, + ifp->if_flags & IFF_ALLMULTI); } else { - printf("%s: SIOCSIFFLAGS cpsw_init_locked\n", __func__); - //cpsw_init_locked(sc); + CPSW_DEBUGF(("SIOCSIFFLAGS: UP but not RUNNING")); + cpsw_init_locked(sc); } - } - else if (ifp->if_drv_flags & IFF_DRV_RUNNING) + } else if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + CPSW_DEBUGF(("SIOCSIFFLAGS: not UP but RUNNING")); cpsw_stop_locked(sc); + } sc->cpsw_if_flags = ifp->if_flags; CPSW_GLOBAL_UNLOCK(sc); break; case SIOCADDMULTI: - printf("%s: SIOCADDMULTI\n",__func__); + CPSW_DEBUGF(("SIOCADDMULTI unimplemented")); break; case SIOCDELMULTI: - printf("%s: SIOCDELMULTI\n",__func__); - break; - case SIOCSIFCAP: - printf("%s: SIOCSIFCAP\n",__func__); + CPSW_DEBUGF(("SIOCDELMULTI unimplemented")); break; case SIOCGIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &sc->mii->mii_media, command); - break; case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->mii->mii_media, command); break; default: + CPSW_DEBUGF(("ether ioctl")); error = ether_ioctl(ifp, command, data); } return (error); @@ -787,6 +899,7 @@ cpsw_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) struct cpsw_softc *sc = ifp->if_softc; struct mii_data *mii; + CPSW_DEBUGF(("")); CPSW_TX_LOCK(sc); mii = sc->mii; @@ -804,13 +917,12 @@ cpsw_ifmedia_upd(struct ifnet *ifp) { struct cpsw_softc *sc = ifp->if_softc; + CPSW_DEBUGF(("")); if (ifp->if_flags & IFF_UP) { CPSW_GLOBAL_LOCK(sc); - sc->cpsw_media_status = sc->mii->mii_media.ifm_media; mii_mediachg(sc->mii); cpsw_init_locked(sc); - CPSW_GLOBAL_UNLOCK(sc); } @@ -820,15 +932,18 @@ cpsw_ifmedia_upd(struct ifnet *ifp) static void cpsw_intr_rx_thresh(void *arg) { - (void)arg; /* UNUSED */ + struct cpsw_softc *sc = arg; + CPSW_DEBUGF(("")); } static void cpsw_intr_rx(void *arg) { struct cpsw_softc *sc = arg; + CPSW_RX_LOCK(sc); cpsw_intr_rx_locked(arg); + cpsw_write_4(CPSW_CPDMA_CPDMA_EOI_VECTOR, 1); CPSW_RX_UNLOCK(sc); } @@ -837,63 +952,151 @@ cpsw_intr_rx_locked(void *arg) { struct cpsw_softc *sc = arg; struct cpsw_cpdma_bd bd; + struct cpsw_slot *slot, *last_slot = NULL; struct ifnet *ifp; - int i; ifp = sc->ifp; + if (!sc->rx_running) + return; - i = sc->rxbd_head; - cpsw_cpdma_read_rxbd(i, &bd); - - while (bd.flags & CPDMA_BD_SOP) { - cpsw_write_4(CPSW_CPDMA_RX_CP(0), cpsw_cpdma_rxbd_paddr(i)); + /* Pull completed packets off hardware RX queue. */ + slot = STAILQ_FIRST(&sc->rx_active); + while (slot != NULL) { + cpsw_cpdma_read_rxbd(slot->index, &bd); + if (bd.flags & CPDMA_BD_OWNER) + break; /* Still in use by hardware */ + + if (bd.flags & CPDMA_BD_TDOWNCMPLT) { + CPSW_DEBUGF(("RX teardown in progress")); + cpsw_write_4(CPSW_CPDMA_RX_CP(0), 0xfffffffc); + sc->rx_running = 0; + return; + } - bus_dmamap_sync(sc->mbuf_dtag, sc->rx_dmamap[i], BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->mbuf_dtag, sc->rx_dmamap[i]); + bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->mbuf_dtag, slot->dmamap); /* Fill mbuf */ - sc->rx_mbuf[i]->m_hdr.mh_data += bd.bufoff; - sc->rx_mbuf[i]->m_hdr.mh_len = bd.pktlen - 4; - sc->rx_mbuf[i]->m_pkthdr.len = bd.pktlen - 4; - sc->rx_mbuf[i]->m_flags |= M_PKTHDR; - sc->rx_mbuf[i]->m_pkthdr.rcvif = ifp; + /* TODO: track SOP/EOP bits to assemble a full mbuf + out of received fragments. */ + slot->mbuf->m_hdr.mh_data += bd.bufoff; + slot->mbuf->m_hdr.mh_len = bd.pktlen - 4; + slot->mbuf->m_pkthdr.len = bd.pktlen - 4; + slot->mbuf->m_flags |= M_PKTHDR; + slot->mbuf->m_pkthdr.rcvif = ifp; if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) { /* check for valid CRC by looking into pkt_err[5:4] */ - if ( (bd.flags & CPDMA_BD_PKT_ERR_MASK) == 0 ) { - sc->rx_mbuf[i]->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; - sc->rx_mbuf[i]->m_pkthdr.csum_flags |= CSUM_IP_VALID; - sc->rx_mbuf[i]->m_pkthdr.csum_data = 0xffff; + if ((bd.flags & CPDMA_BD_PKT_ERR_MASK) == 0) { + slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; + slot->mbuf->m_pkthdr.csum_flags |= CSUM_IP_VALID; + slot->mbuf->m_pkthdr.csum_data = 0xffff; } } /* Handover packet */ CPSW_RX_UNLOCK(sc); - (*ifp->if_input)(ifp, sc->rx_mbuf[i]); - sc->rx_mbuf[i] = NULL; + (*ifp->if_input)(ifp, slot->mbuf); + slot->mbuf = NULL; CPSW_RX_LOCK(sc); - /* Allocate new buffer for current descriptor */ - cpsw_new_rxbuf(sc, i, 0); + last_slot = slot; + STAILQ_REMOVE_HEAD(&sc->rx_active, next); + STAILQ_INSERT_TAIL(&sc->rx_avail, slot, next); + slot = STAILQ_FIRST(&sc->rx_active); + } + + /* Tell hardware last slot we processed. */ + if (last_slot) + cpsw_write_4(CPSW_CPDMA_RX_CP(0), + cpsw_cpdma_rxbd_paddr(last_slot->index)); - /* we are not at tail so old tail BD should point to new one */ - cpsw_cpdma_write_rxbd_next(sc->rxbd_tail, - cpsw_cpdma_rxbd_paddr(i)); + /* Repopulate hardware RX queue. */ + cpsw_fill_rx_queue_locked(sc); +} - /* Check if EOQ is reached */ - if (cpsw_cpdma_read_rxbd_flags(sc->rxbd_tail) & CPDMA_BD_EOQ) { - cpsw_write_4(CPSW_CPDMA_RX_HDP(0), cpsw_cpdma_rxbd_paddr(i)); +static void +cpsw_fill_rx_queue_locked(struct cpsw_softc *sc) +{ + bus_dma_segment_t seg[1]; + struct cpsw_queue tmpqueue = STAILQ_HEAD_INITIALIZER(tmpqueue); + struct cpsw_cpdma_bd bd; + struct cpsw_slot *slot, *prev_slot, *next_slot; + int error, nsegs; + + /* Try to allocate new mbufs. */ + STAILQ_FOREACH(slot, &sc->rx_avail, next) { + if (slot->mbuf != NULL) + continue; + slot->mbuf = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + if (slot->mbuf == NULL) { + if_printf(sc->ifp, "Unable to fill RX queue\n"); + break; + } + slot->mbuf->m_len = slot->mbuf->m_pkthdr.len = slot->mbuf->m_ext.ext_size; + } + + /* Register new mbufs with hardware. */ + prev_slot = NULL; + while (!STAILQ_EMPTY(&sc->rx_avail)) { + slot = STAILQ_FIRST(&sc->rx_avail); + if (slot->mbuf == NULL) + break; + + error = bus_dmamap_load_mbuf_sg(sc->mbuf_dtag, slot->dmamap, + slot->mbuf, seg, &nsegs, BUS_DMA_NOWAIT); + + KASSERT(nsegs == 1, ("More than one segment (nsegs=%d)", nsegs)); + KASSERT(error == 0, ("DMA error (error=%d)", error)); + if (nsegs != 1 || error) { + if_printf(sc->ifp, + "%s: Can't prep RX buf for DMA (nsegs=%d, error=%d)\n", + __func__, nsegs, error); + m_freem(slot->mbuf); + slot->mbuf = NULL; + break; } - sc->rxbd_tail = i; - /* read next descriptor */ - if (++i == CPSW_MAX_RX_BUFFERS) - i = 0; - cpsw_cpdma_read_rxbd(i, &bd); - sc->rxbd_head = i; + bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, BUS_DMASYNC_PREREAD); + + /* Create and submit new rx descriptor*/ + bd.next = 0; + bd.bufptr = seg->ds_addr; + bd.buflen = MCLBYTES-1; + bd.bufoff = 2; /* make IP hdr aligned with 4 */ + bd.pktlen = 0; + bd.flags = CPDMA_BD_OWNER; + cpsw_cpdma_write_rxbd(slot->index, &bd); + + if (prev_slot) { + cpsw_cpdma_write_rxbd_next(prev_slot->index, + cpsw_cpdma_rxbd_paddr(slot->index)); + } + prev_slot = slot; + STAILQ_REMOVE_HEAD(&sc->rx_avail, next); + STAILQ_INSERT_TAIL(&tmpqueue, slot, next); } - cpsw_write_4(CPSW_CPDMA_CPDMA_EOI_VECTOR, 1); + /* Link new entries to hardware RX queue. */ + prev_slot = STAILQ_LAST(&sc->rx_active, cpsw_slot, next); + next_slot = STAILQ_FIRST(&tmpqueue); + if (next_slot == NULL) { + return; + } else if (prev_slot == NULL) { + /* Start a fresh RX queue. */ + cpsw_write_4(CPSW_CPDMA_RX_HDP(0), + cpsw_cpdma_rxbd_paddr(next_slot->index)); + } else { + /* Add buffers to end of current queue. */ + cpsw_cpdma_write_rxbd_next(prev_slot->index, + cpsw_cpdma_rxbd_paddr(next_slot->index)); + /* If underrun, restart queue. */ + if (cpsw_cpdma_read_rxbd_flags(prev_slot->index) & CPDMA_BD_EOQ) { + cpsw_write_4(CPSW_CPDMA_RX_HDP(0), + cpsw_cpdma_rxbd_paddr(next_slot->index)); + } + } + STAILQ_CONCAT(&sc->rx_active, &tmpqueue); } static void @@ -902,6 +1105,7 @@ cpsw_intr_tx(void *arg) struct cpsw_softc *sc = arg; CPSW_TX_LOCK(sc); cpsw_intr_tx_locked(arg); + cpsw_write_4(CPSW_CPDMA_CPDMA_EOI_VECTOR, 2); CPSW_TX_UNLOCK(sc); } @@ -909,45 +1113,58 @@ static void cpsw_intr_tx_locked(void *arg) { struct cpsw_softc *sc = arg; - uint32_t flags; + struct cpsw_slot *slot, *last_slot = NULL; + uint32_t flags, last_flags = 0, retires = 0; - if(sc->txbd_head == -1) + if (!sc->tx_running) return; - if(sc->txbd_queue_size<1) { - /* in some casses interrupt happens even when there is no - data in transmit queue */ + slot = STAILQ_FIRST(&sc->tx_active); + if (slot == NULL && + cpsw_read_4(CPSW_CPDMA_TX_CP(0)) == 0xfffffffc) { + CPSW_DEBUGF(("TX teardown of an empty queue")); + cpsw_write_4(CPSW_CPDMA_TX_CP(0), 0xfffffffc); + sc->tx_running = 0; return; } - /* Disable watchdog */ - sc->wd_timer = 0; - - flags = cpsw_cpdma_read_txbd_flags(sc->txbd_head); - - /* After BD is transmitted CPDMA will set OWNER to 0 */ - if (flags & CPDMA_BD_OWNER) - return; - - if(flags & CPDMA_BD_EOQ) - sc->eoq=1; - - /* release dmamap and mbuf */ - bus_dmamap_sync(sc->mbuf_dtag, sc->tx_dmamap[sc->txbd_head], - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->mbuf_dtag, sc->tx_dmamap[sc->txbd_head]); - m_freem(sc->tx_mbuf[sc->txbd_head]); - sc->tx_mbuf[sc->txbd_head] = NULL; - - cpsw_write_4(CPSW_CPDMA_TX_CP(0), cpsw_cpdma_txbd_paddr(sc->txbd_head)); - - if (++sc->txbd_head == CPSW_MAX_TX_BUFFERS) - sc->txbd_head = 0; + /* Pull completed segments off the hardware TX queue. */ + while (slot != NULL) { + flags = cpsw_cpdma_read_txbd_flags(slot->index); + if (flags & CPDMA_BD_OWNER) + break; /* Hardware is still using this. */ + + if (flags & CPDMA_BD_TDOWNCMPLT) { + CPSW_DEBUGF(("TX teardown in progress")); + cpsw_write_4(CPSW_CPDMA_TX_CP(0), 0xfffffffc); + sc->tx_running = 0; + return; + } - --sc->txbd_queue_size; + /* Release dmamap, free mbuf. */ + bus_dmamap_sync(sc->mbuf_dtag, slot->dmamap, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->mbuf_dtag, slot->dmamap); + m_freem(slot->mbuf); + slot->mbuf = NULL; + + STAILQ_REMOVE_HEAD(&sc->tx_active, next); + STAILQ_INSERT_TAIL(&sc->tx_avail, slot, next); + sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + + last_slot = slot; + last_flags = flags; + ++retires; + slot = STAILQ_FIRST(&sc->tx_active); + } - cpsw_write_4(CPSW_CPDMA_CPDMA_EOI_VECTOR, 2); - cpsw_write_4(CPSW_CPDMA_CPDMA_EOI_VECTOR, 1); + if (retires != 0) { + /* Tell hardware the last item we dequeued. */ + cpsw_write_4(CPSW_CPDMA_TX_CP(0), + cpsw_cpdma_txbd_paddr(last_slot->index)); + sc->tx_retires += retires; + sc->tx_queued -= retires; + } } static void @@ -955,7 +1172,8 @@ cpsw_intr_misc(void *arg) { struct cpsw_softc *sc = arg; uint32_t stat = cpsw_read_4(CPSW_WR_C_MISC_STAT(0)); - printf("%s: stat=%x\n",__func__,stat); + + CPSW_DEBUGF(("stat=%x", stat)); /* EOI_RX_PULSE */ cpsw_write_4(CPSW_CPDMA_CPDMA_EOI_VECTOR, 3); } @@ -966,13 +1184,13 @@ cpsw_tick(void *msc) struct cpsw_softc *sc = msc; /* Check for TX timeout */ - cpsw_watchdog(sc); + cpsw_tx_watchdog(sc); mii_tick(sc->mii); /* Check for media type change */ if(sc->cpsw_media_status != sc->mii->mii_media.ifm_media) { - printf("%s: media type changed (ifm_media=%x)\n",__func__, + printf("%s: media type changed (ifm_media=%x)\n", __func__, sc->mii->mii_media.ifm_media); cpsw_ifmedia_upd(sc->ifp); } @@ -982,25 +1200,28 @@ cpsw_tick(void *msc) } static void -cpsw_watchdog(struct cpsw_softc *sc) +cpsw_tx_watchdog(struct cpsw_softc *sc) { - struct ifnet *ifp; - - ifp = sc->ifp; + struct ifnet *ifp = sc->ifp; CPSW_GLOBAL_LOCK(sc); - - if (sc->wd_timer == 0 || --sc->wd_timer) { - CPSW_GLOBAL_UNLOCK(sc); - return; + if (sc->tx_retires > sc->tx_retires_at_last_tick) { + sc->tx_wd_timer = 0; /* Stuff got sent. */ + } else if (sc->tx_queued == 0) { + sc->tx_wd_timer = 0; /* Nothing to send. */ + } else { + /* There was something to send but we didn't. */ + ++sc->tx_wd_timer; + if (sc->tx_wd_timer > 3) { + sc->tx_wd_timer = 0; + ifp->if_oerrors++; + if_printf(ifp, "watchdog timeout\n"); + cpsw_stop_locked(sc); + cpsw_init_locked(sc); + CPSW_DEBUGF(("watchdog reset completed\n")); + } } - - ifp->if_oerrors++; - if_printf(ifp, "watchdog timeout\n"); - - cpsw_stop_locked(sc); - cpsw_init_locked(sc); - + sc->tx_retires_at_last_tick = sc->tx_retires; CPSW_GLOBAL_UNLOCK(sc); } @@ -1008,6 +1229,8 @@ static void cpsw_init(void *arg) { struct cpsw_softc *sc = arg; + + CPSW_DEBUGF(("")); CPSW_GLOBAL_LOCK(sc); cpsw_init_locked(arg); CPSW_GLOBAL_UNLOCK(sc); @@ -1021,53 +1244,56 @@ cpsw_init_locked(void *arg) struct ifnet *ifp; struct cpsw_softc *sc = arg; uint8_t broadcast_address[6] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - uint32_t next_bdp; uint32_t i; + CPSW_DEBUGF(("")); ifp = sc->ifp; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) return; - printf("%s: start\n",__func__); - /* Reset writer */ cpsw_write_4(CPSW_WR_SOFT_RESET, 1); - while(cpsw_read_4(CPSW_WR_SOFT_RESET) & 1); + while (cpsw_read_4(CPSW_WR_SOFT_RESET) & 1) + ; /* Reset SS */ cpsw_write_4(CPSW_SS_SOFT_RESET, 1); - while(cpsw_read_4(CPSW_SS_SOFT_RESET) & 1); + while (cpsw_read_4(CPSW_SS_SOFT_RESET) & 1) + ; /* Clear table (30) and enable ALE(31) */ if (once) - cpsw_write_4(CPSW_ALE_CONTROL, (3 << 30)); + cpsw_write_4(CPSW_ALE_CONTROL, 3 << 30); else - cpsw_write_4(CPSW_ALE_CONTROL, (1 << 31)); + cpsw_write_4(CPSW_ALE_CONTROL, 1 << 31); once = 0; // FIXME /* Reset and init Sliver port 1 and 2 */ - for(i=0;i<2;i++) { + for (i = 0; i < 2; i++) { /* Reset */ cpsw_write_4(CPSW_SL_SOFT_RESET(i), 1); - while(cpsw_read_4(CPSW_SL_SOFT_RESET(i)) & 1); + while (cpsw_read_4(CPSW_SL_SOFT_RESET(i)) & 1) + ; /* Set Slave Mapping */ - cpsw_write_4(CPSW_SL_RX_PRI_MAP(i),0x76543210); - cpsw_write_4(CPSW_PORT_P_TX_PRI_MAP(i+1),0x33221100); - cpsw_write_4(CPSW_SL_RX_MAXLEN(i),0x5f2); + cpsw_write_4(CPSW_SL_RX_PRI_MAP(i), 0x76543210); + cpsw_write_4(CPSW_PORT_P_TX_PRI_MAP(i + 1), 0x33221100); + cpsw_write_4(CPSW_SL_RX_MAXLEN(i), 0x5f2); /* Set MAC Address */ - cpsw_write_4(CPSW_PORT_P_SA_HI(i+1), sc->mac_addr[0] | - (sc->mac_addr[1] << 8) | - (sc->mac_addr[2] << 16) | - (sc->mac_addr[3] << 24)); - cpsw_write_4(CPSW_PORT_P_SA_LO(i+1), sc->mac_addr[4] | - (sc->mac_addr[5] << 8)); + cpsw_write_4(CPSW_PORT_P_SA_HI(i + 1), + sc->mac_addr[3] << 24 | + sc->mac_addr[2] << 16 | + sc->mac_addr[1] << 8 | + sc->mac_addr[0]); + cpsw_write_4(CPSW_PORT_P_SA_LO(i+1), + sc->mac_addr[5] << 8 | + sc->mac_addr[4]); /* Set MACCONTROL for ports 0,1: FULLDUPLEX(1), GMII_EN(5), IFCTL_A(15), IFCTL_B(16) FIXME */ - cpsw_write_4(CPSW_SL_MACCONTROL(i), 1 | (1<<5) | (1<<15)); + cpsw_write_4(CPSW_SL_MACCONTROL(i), 1 << 15 | 1 << 5 | 1); /* Set ALE port to forwarding(3) */ - cpsw_write_4(CPSW_ALE_PORTCTL(i+1), 3); + cpsw_write_4(CPSW_ALE_PORTCTL(i + 1), 3); } /* Set Host Port Mapping */ @@ -1087,37 +1313,22 @@ cpsw_init_locked(void *arg) /* Reset CPDMA */ cpsw_write_4(CPSW_CPDMA_SOFT_RESET, 1); - while(cpsw_read_4(CPSW_CPDMA_SOFT_RESET) & 1); + while (cpsw_read_4(CPSW_CPDMA_SOFT_RESET) & 1) + ; + + /* Make IP hdr aligned with 4 */ + cpsw_write_4(CPSW_CPDMA_RX_BUFFER_OFFSET, 2); - for(i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) { cpsw_write_4(CPSW_CPDMA_TX_HDP(i), 0); cpsw_write_4(CPSW_CPDMA_RX_HDP(i), 0); cpsw_write_4(CPSW_CPDMA_TX_CP(i), 0); cpsw_write_4(CPSW_CPDMA_RX_CP(i), 0); - } - - cpsw_write_4(CPSW_CPDMA_RX_FREEBUFFER(0), 0); - - /* Initialize RX Buffer Descriptors */ - i = CPSW_MAX_RX_BUFFERS; - next_bdp = 0; - while (i--) { - cpsw_new_rxbuf(sc, i, next_bdp); - /* Increment number of free RX buffers */ - //cpsw_write_4(CPSW_CPDMA_RX_FREEBUFFER(0), 1); - next_bdp = cpsw_cpdma_rxbd_paddr(i); } - sc->rxbd_head = 0; - sc->rxbd_tail = CPSW_MAX_RX_BUFFERS-1; - sc->txbd_head = 0; - sc->eoq = 1; - sc->txbd_queue_size = 0; - - /* Make IP hdr aligned with 4 */ - cpsw_write_4(CPSW_CPDMA_RX_BUFFER_OFFSET, 2); - /* Write channel 0 RX HDP */ - cpsw_write_4(CPSW_CPDMA_RX_HDP(0), cpsw_cpdma_rxbd_paddr(0)); + /* Initialize RX Buffer Descriptors */ + cpsw_write_4(CPSW_CPDMA_RX_FREEBUFFER(0), 0); + cpsw_fill_rx_queue_locked(sc); /* Clear all interrupt Masks */ cpsw_write_4(CPSW_CPDMA_RX_INTMASK_CLEAR, 0xFFFFFFFF); @@ -1147,16 +1358,18 @@ cpsw_init_locked(void *arg) /* Initialze MDIO - ENABLE, PREAMBLE=0, FAULTENB, CLKDIV=0xFF */ /* TODO Calculate MDCLK=CLK/(CLKDIV+1) */ - cpsw_write_4(MDIOCONTROL, (1<<30) | (1<<18) | 0xFF); + cpsw_write_4(MDIOCONTROL, 1 << 30 | 1 << 18 | 0xFF); /* Select MII in GMII_SEL, Internal Delay mode */ //ti_scm_reg_write_4(0x650, 0); /* Activate network interface */ + sc->rx_running = 1; + sc->tx_running = 1; + sc->tx_wd_timer = 0; + callout_reset(&sc->wd_callout, hz, cpsw_tick, sc); sc->ifp->if_drv_flags |= IFF_DRV_RUNNING; sc->ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - sc->wd_timer = 0; - callout_reset(&sc->wd_callout, hz, cpsw_tick, sc); } static void @@ -1174,7 +1387,7 @@ cpsw_ale_write_entry(struct cpsw_softc *sc, uint16_t idx, uint32_t *ale_entry) cpsw_write_4(CPSW_ALE_TBLW0, ale_entry[0]); cpsw_write_4(CPSW_ALE_TBLW1, ale_entry[1]); cpsw_write_4(CPSW_ALE_TBLW2, ale_entry[2]); - cpsw_write_4(CPSW_ALE_TBLCTL, (idx & 1023) | (1 << 31)); + cpsw_write_4(CPSW_ALE_TBLCTL, 1 << 31 | (idx & 1023)); } static int @@ -1182,7 +1395,7 @@ cpsw_ale_find_entry_by_mac(struct cpsw_softc *sc, uint8_t *mac) { int i; uint32_t ale_entry[3]; - for(i=0; i< CPSW_MAX_ALE_ENTRIES; i++) { + for (i = 0; i < CPSW_MAX_ALE_ENTRIES; i++) { cpsw_ale_read_entry(sc, i, ale_entry); if ((((ale_entry[1] >> 8) & 0xFF) == mac[0]) && (((ale_entry[1] >> 0) & 0xFF) == mac[1]) && @@ -1201,7 +1414,7 @@ cpsw_ale_find_free_entry(struct cpsw_softc *sc) { int i; uint32_t ale_entry[3]; - for(i=0; i< CPSW_MAX_ALE_ENTRIES; i++) { + for (i = 0; i < CPSW_MAX_ALE_ENTRIES; i++) { cpsw_ale_read_entry(sc, i, ale_entry); /* Entry Type[61:60] is 0 for free entry */ if (((ale_entry[1] >> 28) & 3) == 0) { @@ -1226,11 +1439,11 @@ cpsw_ale_uc_entry_set(struct cpsw_softc *sc, uint8_t port, uint8_t *mac) return (ENOMEM); /* Set MAC address */ - ale_entry[0] = mac[2]<<24 | mac[3]<<16 | mac[4]<<8 | mac[5]; - ale_entry[1] = mac[0]<<8 | mac[1]; + ale_entry[0] = mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5]; + ale_entry[1] = mac[0] << 8 | mac[1]; /* Entry type[61:60] is addr entry(1) */ - ale_entry[1] |= 0x10<<24; + ale_entry[1] |= 0x10 << 24; /* Set portmask [67:66] */ ale_entry[2] = (port & 3) << 2; @@ -1254,11 +1467,11 @@ cpsw_ale_mc_entry_set(struct cpsw_softc *sc, uint8_t portmap, uint8_t *mac) return (ENOMEM); /* Set MAC address */ - ale_entry[0] = mac[2]<<24 | mac[3]<<16 | mac[4]<<8 | mac[5]; - ale_entry[1] = mac[0]<<8 | mac[1]; + ale_entry[0] = mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5]; + ale_entry[1] = mac[0] << 8 | mac[1]; /* Entry type[61:60] is addr entry(1), Mcast fwd state[63:62] is fw(3)*/ - ale_entry[1] |= 0xd0<<24; + ale_entry[1] |= 0xd0 << 24; /* Set portmask [68:66] */ ale_entry[2] = (portmap & 7) << 2; @@ -1273,11 +1486,11 @@ static void cpsw_ale_dump_table(struct cpsw_softc *sc) { int i; uint32_t ale_entry[3]; - for(i=0; i< CPSW_MAX_ALE_ENTRIES; i++) { + for (i = 0; i < CPSW_MAX_ALE_ENTRIES; i++) { cpsw_ale_read_entry(sc, i, ale_entry); if (ale_entry[0] || ale_entry[1] || ale_entry[2]) { printf("ALE[%4u] %08x %08x %08x ", i, ale_entry[0], - ale_entry[1],ale_entry[2]); + ale_entry[1], ale_entry[2]); printf("mac: %02x:%02x:%02x:%02x:%02x:%02x ", (ale_entry[1] >> 8) & 0xFF, (ale_entry[1] >> 0) & 0xFF, @@ -1285,9 +1498,9 @@ cpsw_ale_dump_table(struct cpsw_softc *sc) { (ale_entry[0] >>16) & 0xFF, (ale_entry[0] >> 8) & 0xFF, (ale_entry[0] >> 0) & 0xFF); - printf( ((ale_entry[1]>>8)&1) ? "mcast " : "ucast "); - printf("type: %u ", (ale_entry[1]>>28)&3); - printf("port: %u ", (ale_entry[2]>>2)&7); + printf(((ale_entry[1] >> 8) & 1) ? "mcast " : "ucast "); + printf("type: %u ", (ale_entry[1] >> 28) & 3); + printf("port: %u ", (ale_entry[2] >> 2) & 7); printf("\n"); } } diff --git a/sys/arm/ti/cpsw/if_cpswreg.h b/sys/arm/ti/cpsw/if_cpswreg.h index a4264d4..dab4f36 100644 --- a/sys/arm/ti/cpsw/if_cpswreg.h +++ b/sys/arm/ti/cpsw/if_cpswreg.h @@ -44,7 +44,9 @@ #define CPSW_CPDMA_OFFSET 0x0800 #define CPSW_CPDMA_TX_CONTROL (CPSW_CPDMA_OFFSET + 0x04) +#define CPSW_CPDMA_TX_TEARDOWN (CPSW_CPDMA_OFFSET + 0x08) #define CPSW_CPDMA_RX_CONTROL (CPSW_CPDMA_OFFSET + 0x14) +#define CPSW_CPDMA_RX_TEARDOWN (CPSW_CPDMA_OFFSET + 0x18) #define CPSW_CPDMA_SOFT_RESET (CPSW_CPDMA_OFFSET + 0x1c) #define CPSW_CPDMA_DMACONTROL (CPSW_CPDMA_OFFSET + 0x20) #define CPSW_CPDMA_DMASTATUS (CPSW_CPDMA_OFFSET + 0x24) @@ -63,10 +65,14 @@ #define CPSW_CPDMA_DMA_INTMASK_SET (CPSW_CPDMA_OFFSET + 0xB8) #define CPSW_CPDMA_DMA_INTMASK_CLEAR (CPSW_CPDMA_OFFSET + 0xBC) #define CPSW_CPDMA_RX_FREEBUFFER(p) (CPSW_CPDMA_OFFSET + 0x0e0 + ((p) * 0x04)) -#define CPSW_CPDMA_TX_HDP(p) (CPSW_CPDMA_OFFSET + 0x200 + ((p) * 0x04)) -#define CPSW_CPDMA_RX_HDP(p) (CPSW_CPDMA_OFFSET + 0x220 + ((p) * 0x04)) -#define CPSW_CPDMA_TX_CP(p) (CPSW_CPDMA_OFFSET + 0x240 + ((p) * 0x04)) -#define CPSW_CPDMA_RX_CP(p) (CPSW_CPDMA_OFFSET + 0x260 + ((p) * 0x04)) + +#define CPSW_STATS_OFFSET 0x0900 + +#define CPSW_STATERAM_OFFSET 0x0A00 +#define CPSW_CPDMA_TX_HDP(p) (CPSW_STATERAM_OFFSET + 0x00 + ((p) * 0x04)) +#define CPSW_CPDMA_RX_HDP(p) (CPSW_STATERAM_OFFSET + 0x20 + ((p) * 0x04)) +#define CPSW_CPDMA_TX_CP(p) (CPSW_STATERAM_OFFSET + 0x40 + ((p) * 0x04)) +#define CPSW_CPDMA_RX_CP(p) (CPSW_STATERAM_OFFSET + 0x60 + ((p) * 0x04)) #define CPSW_CPTS_OFFSET 0x0C00 diff --git a/sys/arm/ti/cpsw/if_cpswvar.h b/sys/arm/ti/cpsw/if_cpswvar.h index 836bc2d..35024c6 100644 --- a/sys/arm/ti/cpsw/if_cpswvar.h +++ b/sys/arm/ti/cpsw/if_cpswvar.h @@ -39,6 +39,14 @@ #define CPSW_MAX_RX_BUFFERS 128 #define CPSW_MAX_ALE_ENTRIES 1024 +struct cpsw_slot { + bus_dmamap_t dmamap; + struct mbuf *mbuf; + int index; + STAILQ_ENTRY(cpsw_slot) next; +}; +STAILQ_HEAD(cpsw_queue, cpsw_slot); + struct cpsw_softc { struct ifnet *ifp; phandle_t node; @@ -55,31 +63,38 @@ struct cpsw_softc { int cpsw_media_status; struct callout wd_callout; - int wd_timer; + int tx_wd_timer; - /* buffers */ bus_dma_tag_t mbuf_dtag; - bus_dmamap_t tx_dmamap[CPSW_MAX_TX_BUFFERS]; - bus_dmamap_t rx_dmamap[CPSW_MAX_RX_BUFFERS]; - struct mbuf *tx_mbuf[CPSW_MAX_TX_BUFFERS]; - struct mbuf *rx_mbuf[CPSW_MAX_RX_BUFFERS]; - int txbd_head; - int txbd_queue_size; - int rxbd_head; - int rxbd_tail; - - int tmp; - int eoq; - int tc[CPSW_MAX_TX_BUFFERS]; - int tc_unload[CPSW_MAX_TX_BUFFERS]; - - struct cpsw_softc *phy_sc; + + /* RX buffer tracking */ + int rx_running; + struct cpsw_queue rx_active; + struct cpsw_queue rx_avail; + struct cpsw_slot _rx_slots[CPSW_MAX_RX_BUFFERS]; + + /* TX buffer tracking. */ + int tx_running; + struct cpsw_queue tx_active; + struct cpsw_queue tx_avail; + struct cpsw_slot _tx_slots[CPSW_MAX_TX_BUFFERS]; + + /* Statistics */ + uint32_t tx_enqueues; /* total TX bufs added to queue */ + uint32_t tx_retires; /* total TX bufs removed from queue */ + uint32_t tx_retires_at_last_tick; /* used for watchdog */ + /* Note: tx_queued != tx_enqueues - tx_retires + At driver reset, packets can be discarded + from TX queue without being retired. */ + int tx_queued; /* Current bufs in TX queue */ + int tx_max_queued; }; #define CPDMA_BD_SOP (1<<15) #define CPDMA_BD_EOP (1<<14) #define CPDMA_BD_OWNER (1<<13) #define CPDMA_BD_EOQ (1<<12) +#define CPDMA_BD_TDOWNCMPLT (1<<11) #define CPDMA_BD_PKT_ERR_MASK (3<< 4) struct cpsw_cpdma_bd { diff --git a/sys/arm/ti/omap4/omap4_l2cache.c b/sys/arm/ti/omap4/omap4_l2cache.c index b663a1a..67678bf 100644 --- a/sys/arm/ti/omap4/omap4_l2cache.c +++ b/sys/arm/ti/omap4/omap4_l2cache.c @@ -27,13 +27,88 @@ __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> +#include <sys/bus.h> +#include <sys/rman.h> +#include <sys/lock.h> +#include <sys/mutex.h> + #include <arm/ti/ti_smc.h> #include <arm/ti/omap4/omap4_smc.h> +#include <machine/bus.h> #include <machine/pl310.h> void -platform_init_pl310(struct pl310_softc *softc) +platform_pl310_init(struct pl310_softc *sc) +{ + uint32_t aux, prefetch; + + aux = pl310_read4(sc, PL310_AUX_CTRL); + prefetch = pl310_read4(sc, PL310_PREFETCH_CTRL); + + if (bootverbose) { + device_printf(sc->sc_dev, "Early BRESP response: %s\n", + (aux & AUX_CTRL_EARLY_BRESP) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Instruction prefetch: %s\n", + (aux & AUX_CTRL_INSTR_PREFETCH) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Data prefetch: %s\n", + (aux & AUX_CTRL_DATA_PREFETCH) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Non-secure interrupt control: %s\n", + (aux & AUX_CTRL_NS_INT_CTRL) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Non-secure lockdown: %s\n", + (aux & AUX_CTRL_NS_LOCKDOWN) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Share override: %s\n", + (aux & AUX_CTRL_SHARE_OVERRIDE) ? "enabled" : "disabled"); + + device_printf(sc->sc_dev, "Double linefil: %s\n", + (prefetch & PREFETCH_CTRL_DL) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Instruction prefetch: %s\n", + (prefetch & PREFETCH_CTRL_INSTR_PREFETCH) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Data prefetch: %s\n", + (prefetch & PREFETCH_CTRL_DATA_PREFETCH) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Double linefill on WRAP request: %s\n", + (prefetch & PREFETCH_CTRL_DL_ON_WRAP) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Prefetch drop: %s\n", + (prefetch & PREFETCH_CTRL_PREFETCH_DROP) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Incr double Linefill: %s\n", + (prefetch & PREFETCH_CTRL_INCR_DL) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Not same ID on exclusive sequence: %s\n", + (prefetch & PREFETCH_CTRL_NOTSAMEID) ? "enabled" : "disabled"); + device_printf(sc->sc_dev, "Prefetch offset: %d\n", + (prefetch & PREFETCH_CTRL_OFFSET_MASK)); + } + + /* + * Disable instruction prefetch + */ + prefetch &= ~PREFETCH_CTRL_INSTR_PREFETCH; + aux &= ~AUX_CTRL_INSTR_PREFETCH; + + // prefetch &= ~PREFETCH_CTRL_DATA_PREFETCH; + // aux &= ~AUX_CTRL_DATA_PREFETCH; + + /* + * Make sure data prefetch is on + */ + prefetch |= PREFETCH_CTRL_DATA_PREFETCH; + aux |= AUX_CTRL_DATA_PREFETCH; + + /* + * TODO: add tunable for prefetch offset + * and experiment with performance + */ + + ti_smc0(aux, 0, WRITE_AUXCTRL_REG); + ti_smc0(prefetch, 0, WRITE_PREFETCH_CTRL_REG); +} + +void +platform_pl310_write_ctrl(struct pl310_softc *sc, uint32_t val) { - ti_smc0(1, 0, L2CACHE_ENABLE_L2); + ti_smc0(val, 0, L2CACHE_WRITE_CTRL_REG); } +void +platform_pl310_write_debug(struct pl310_softc *sc, uint32_t val) +{ + ti_smc0(val, 0, L2CACHE_WRITE_DEBUG_REG); +} diff --git a/sys/arm/ti/omap4/omap4_smc.h b/sys/arm/ti/omap4/omap4_smc.h index 11ff853..5fd14aa 100644 --- a/sys/arm/ti/omap4/omap4_smc.h +++ b/sys/arm/ti/omap4/omap4_smc.h @@ -31,7 +31,7 @@ /* Define the various function IDs used by the OMAP4 */ #define L2CACHE_WRITE_DEBUG_REG 0x100 #define L2CACHE_CLEAN_INV_RANG 0x101 -#define L2CACHE_ENABLE_L2 0x102 +#define L2CACHE_WRITE_CTRL_REG 0x102 #define READ_AUX_CORE_REGS 0x103 #define MODIFY_AUX_CORE_0 0x104 #define WRITE_AUX_CORE_1 0x105 diff --git a/sys/arm/ti/omap4/std.omap4 b/sys/arm/ti/omap4/std.omap4 index 056a823..bbdd432 100644 --- a/sys/arm/ti/omap4/std.omap4 +++ b/sys/arm/ti/omap4/std.omap4 @@ -19,3 +19,7 @@ options STARTUP_PAGETABLE_ADDR=0x80000000 options SOC_OMAP4 options ARM_L2_PIPT + +options IPI_IRQ_START=0 +options IPI_IRQ_END=15 + diff --git a/sys/arm/ti/ti_cpuid.c b/sys/arm/ti/ti_cpuid.c index 16de8aa..89046c4 100644 --- a/sys/arm/ti/ti_cpuid.c +++ b/sys/arm/ti/ti_cpuid.c @@ -129,27 +129,75 @@ omap4_get_revision(void) switch (hawkeye) { case 0xB852: - if (revision == 0) + switch (revision) { + case 0: chip_revision = OMAP4430_REV_ES1_0; - else - chip_revision = OMAP4430_REV_ES2_0; + break; + case 1: + chip_revision = OMAP4430_REV_ES2_1; + break; + default: + chip_revision = OMAP4430_REV_UNKNOWN; + break; + } break; + case 0xB95C: - if (revision == 3) + switch (revision) { + case 3: chip_revision = OMAP4430_REV_ES2_1; - else if (revision == 4) + break; + case 4: chip_revision = OMAP4430_REV_ES2_2; - else + break; + case 6: chip_revision = OMAP4430_REV_ES2_3; + break; + default: + chip_revision = OMAP4430_REV_UNKNOWN; + break; + } break; + + case 0xB94E: + switch (revision) { + case 0: + chip_revision = OMAP4460_REV_ES1_0; + break; + case 2: + chip_revision = OMAP4460_REV_ES1_1; + break; + default: + chip_revision = OMAP4460_REV_UNKNOWN; + break; + } + break; + + case 0xB975: + switch (revision) { + case 0: + chip_revision = OMAP4470_REV_ES1_0; + break; + default: + chip_revision = OMAP4470_REV_UNKNOWN; + break; + } + break; + default: /* Default to the latest revision if we can't determine type */ - chip_revision = OMAP4430_REV_ES2_3; + chip_revision = OMAP_UNKNOWN_DEV; break; } - printf("Texas Instruments OMAP%04x Processor, Revision ES%u.%u\n", - OMAP_REV_DEVICE(chip_revision), OMAP_REV_MAJOR(chip_revision), - OMAP_REV_MINOR(chip_revision)); + if (chip_revision != OMAP_UNKNOWN_DEV) { + printf("Texas Instruments OMAP%04x Processor, Revision ES%u.%u\n", + OMAP_REV_DEVICE(chip_revision), OMAP_REV_MAJOR(chip_revision), + OMAP_REV_MINOR(chip_revision)); + } + else { + printf("Texas Instruments unknown OMAP chip: %04x, rev %d\n", + hawkeye, revision); + } } /** diff --git a/sys/arm/ti/ti_cpuid.h b/sys/arm/ti/ti_cpuid.h index f68f54c..6efbf32 100644 --- a/sys/arm/ti/ti_cpuid.h +++ b/sys/arm/ti/ti_cpuid.h @@ -30,34 +30,46 @@ #ifndef _TI_CPUID_H_ #define _TI_CPUID_H_ -#define OMAP_MAKEREV(d, a, b, c) \ +#define OMAP_MAKEREV(d, a, b, c) \ (uint32_t)(((d) << 16) | (((a) & 0xf) << 8) | (((b) & 0xf) << 4) | ((c) & 0xf)) -#define OMAP_REV_DEVICE(x) (((x) >> 16) & 0xffff) -#define OMAP_REV_MAJOR(x) (((x) >> 8) & 0xf) -#define OMAP_REV_MINOR(x) (((x) >> 4) & 0xf) -#define OMAP_REV_MINOR_MINOR(x) (((x) >> 0) & 0xf) +#define OMAP_REV_DEVICE(x) (((x) >> 16) & 0xffff) +#define OMAP_REV_MAJOR(x) (((x) >> 8) & 0xf) +#define OMAP_REV_MINOR(x) (((x) >> 4) & 0xf) +#define OMAP_REV_MINOR_MINOR(x) (((x) >> 0) & 0xf) #define OMAP3350_DEV 0x3530 -#define OMAP3350_REV_ES1_0 OMAP_MAKEREV(OMAP3350_DEV, 1, 0, 0) -#define OMAP3530_REV_ES2_0 OMAP_MAKEREV(OMAP3350_DEV, 2, 0, 0) -#define OMAP3530_REV_ES2_1 OMAP_MAKEREV(OMAP3350_DEV, 2, 1, 0) -#define OMAP3530_REV_ES3_0 OMAP_MAKEREV(OMAP3350_DEV, 3, 0, 0) -#define OMAP3530_REV_ES3_1 OMAP_MAKEREV(OMAP3350_DEV, 3, 1, 0) -#define OMAP3530_REV_ES3_1_2 OMAP_MAKEREV(OMAP3350_DEV, 3, 1, 2) +#define OMAP3350_REV_ES1_0 OMAP_MAKEREV(OMAP3350_DEV, 1, 0, 0) +#define OMAP3530_REV_ES2_0 OMAP_MAKEREV(OMAP3350_DEV, 2, 0, 0) +#define OMAP3530_REV_ES2_1 OMAP_MAKEREV(OMAP3350_DEV, 2, 1, 0) +#define OMAP3530_REV_ES3_0 OMAP_MAKEREV(OMAP3350_DEV, 3, 0, 0) +#define OMAP3530_REV_ES3_1 OMAP_MAKEREV(OMAP3350_DEV, 3, 1, 0) +#define OMAP3530_REV_ES3_1_2 OMAP_MAKEREV(OMAP3350_DEV, 3, 1, 2) #define OMAP4430_DEV 0x4430 -#define OMAP4430_REV_ES1_0 OMAP_MAKEREV(OMAP4430_DEV, 1, 0, 0) -#define OMAP4430_REV_ES2_0 OMAP_MAKEREV(OMAP4430_DEV, 2, 0, 0) -#define OMAP4430_REV_ES2_1 OMAP_MAKEREV(OMAP4430_DEV, 2, 1, 0) -#define OMAP4430_REV_ES2_2 OMAP_MAKEREV(OMAP4430_DEV, 2, 2, 0) -#define OMAP4430_REV_ES2_3 OMAP_MAKEREV(OMAP4430_DEV, 2, 3, 0) +#define OMAP4430_REV_ES1_0 OMAP_MAKEREV(OMAP4430_DEV, 1, 0, 0) +#define OMAP4430_REV_ES2_0 OMAP_MAKEREV(OMAP4430_DEV, 2, 0, 0) +#define OMAP4430_REV_ES2_1 OMAP_MAKEREV(OMAP4430_DEV, 2, 1, 0) +#define OMAP4430_REV_ES2_2 OMAP_MAKEREV(OMAP4430_DEV, 2, 2, 0) +#define OMAP4430_REV_ES2_3 OMAP_MAKEREV(OMAP4430_DEV, 2, 3, 0) +#define OMAP4430_REV_UNKNOWN OMAP_MAKEREV(OMAP4430_DEV, 9, 9, 9) -#define AM335X_DEVREV(x) ((x) >> 28) +#define OMAP4460_DEV 0x4460 +#define OMAP4460_REV_ES1_0 OMAP_MAKEREV(OMAP4460_DEV, 1, 0, 0) +#define OMAP4460_REV_ES1_1 OMAP_MAKEREV(OMAP4460_DEV, 1, 1, 0) +#define OMAP4460_REV_UNKNOWN OMAP_MAKEREV(OMAP4460_DEV, 9, 9, 9) -#define CHIP_OMAP_3 0 -#define CHIP_OMAP_4 1 -#define CHIP_AM335X 2 +#define OMAP4470_DEV 0x4470 +#define OMAP4470_REV_ES1_0 OMAP_MAKEREV(OMAP4470_DEV, 1, 0, 0) +#define OMAP4470_REV_UNKNOWN OMAP_MAKEREV(OMAP4470_DEV, 9, 9, 9) + +#define OMAP_UNKNOWN_DEV OMAP_MAKEREV(0x9999, 9, 9, 9) + +#define AM335X_DEVREV(x) ((x) >> 28) + +#define CHIP_OMAP_3 0 +#define CHIP_OMAP_4 1 +#define CHIP_AM335X 2 static __inline int ti_chip(void) { diff --git a/sys/arm/versatile/versatile_clcd.c b/sys/arm/versatile/versatile_clcd.c index 9b1ceff..34d29fa 100644 --- a/sys/arm/versatile/versatile_clcd.c +++ b/sys/arm/versatile/versatile_clcd.c @@ -194,6 +194,12 @@ static struct argb versatilefb_palette[16] = { {0x00, 0xff, 0xff, 0xff} }; +/* mouse pointer from dev/syscons/scgfbrndr.c */ +static u_char mouse_pointer[16] = { + 0x00, 0x40, 0x60, 0x70, 0x78, 0x7c, 0x7e, 0x68, + 0x0c, 0x0c, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00 +}; + #define FB_WIDTH 640 #define FB_HEIGHT 480 #define FB_DEPTH 16 @@ -450,10 +456,131 @@ static video_switch_t versatilefbvidsw = { VIDEO_DRIVER(versatilefb, versatilefbvidsw, versatilefb_configure); -extern sc_rndr_sw_t txtrndrsw; -RENDERER(versatilefb, 0, txtrndrsw, gfb_set); +static vr_init_t clcdr_init; +static vr_clear_t clcdr_clear; +static vr_draw_border_t clcdr_draw_border; +static vr_draw_t clcdr_draw; +static vr_set_cursor_t clcdr_set_cursor; +static vr_draw_cursor_t clcdr_draw_cursor; +static vr_blink_cursor_t clcdr_blink_cursor; +static vr_set_mouse_t clcdr_set_mouse; +static vr_draw_mouse_t clcdr_draw_mouse; + +/* + * We use our own renderer; this is because we must emulate a hardware + * cursor. + */ +static sc_rndr_sw_t clcdrend = { + clcdr_init, + clcdr_clear, + clcdr_draw_border, + clcdr_draw, + clcdr_set_cursor, + clcdr_draw_cursor, + clcdr_blink_cursor, + clcdr_set_mouse, + clcdr_draw_mouse +}; + +RENDERER(versatilefb, 0, clcdrend, gfb_set); RENDERER_MODULE(versatilefb, gfb_set); +static void +clcdr_init(scr_stat* scp) +{ +} + +static void +clcdr_clear(scr_stat* scp, int c, int attr) +{ +} + +static void +clcdr_draw_border(scr_stat* scp, int color) +{ +} + +static void +clcdr_draw(scr_stat* scp, int from, int count, int flip) +{ + video_adapter_t* adp = scp->sc->adp; + int i, c, a; + + if (!flip) { + /* Normal printing */ + vidd_puts(adp, from, (uint16_t*)sc_vtb_pointer(&scp->vtb, from), count); + } else { + /* This is for selections and such: invert the color attribute */ + for (i = count; i-- > 0; ++from) { + c = sc_vtb_getc(&scp->vtb, from); + a = sc_vtb_geta(&scp->vtb, from) >> 8; + vidd_putc(adp, from, c, (a >> 4) | ((a & 0xf) << 4)); + } + } +} + +static void +clcdr_set_cursor(scr_stat* scp, int base, int height, int blink) +{ +} + +static void +clcdr_draw_cursor(scr_stat* scp, int off, int blink, int on, int flip) +{ + video_adapter_t* adp = scp->sc->adp; + struct video_adapter_softc *sc; + int row, col; + uint8_t *addr; + int i,j; + + sc = (struct video_adapter_softc *)adp; + + if (scp->curs_attr.height <= 0) + return; + + if (sc->fb_addr == 0) + return; + + if (off >= adp->va_info.vi_width * adp->va_info.vi_height) + return; + + /* calculate the coordinates in the video buffer */ + row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight; + col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth; + + addr = (uint8_t *)sc->fb_addr + + (row + sc->ymargin)*(sc->stride) + + (sc->depth/8) * (col + sc->xmargin); + + /* our cursor consists of simply inverting the char under it */ + for (i = 0; i < adp->va_info.vi_cheight; i++) { + for (j = 0; j < adp->va_info.vi_cwidth; j++) { + + addr[2*j] ^= 0xff; + addr[2*j + 1] ^= 0xff; + } + + addr += sc->stride; + } +} + +static void +clcdr_blink_cursor(scr_stat* scp, int at, int flip) +{ +} + +static void +clcdr_set_mouse(scr_stat* scp) +{ +} + +static void +clcdr_draw_mouse(scr_stat* scp, int x, int y, int on) +{ + vidd_putm(scp->sc->adp, x, y, mouse_pointer, 0xffffffff, 16, 8); + +} + static uint16_t versatilefb_static_window[ROW*COL]; extern u_char dflt_font_16[]; @@ -629,6 +756,7 @@ versatilefb_read_hw_cursor(video_adapter_t *adp, int *col, int *row) static int versatilefb_set_hw_cursor(video_adapter_t *adp, int col, int row) { + return (0); } @@ -753,6 +881,9 @@ versatilefb_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a) if (sc->fb_addr == 0) return (0); + if (off >= adp->va_info.vi_width * adp->va_info.vi_height) + return (0); + row = (off / adp->va_info.vi_width) * adp->va_info.vi_cheight; col = (off % adp->va_info.vi_width) * adp->va_info.vi_cwidth; p = sc->font + c*VERSATILE_FONT_HEIGHT; @@ -761,7 +892,7 @@ versatilefb_putc(video_adapter_t *adp, vm_offset_t off, uint8_t c, uint8_t a) + (sc->depth/8) * (col + sc->xmargin); fg = a & 0xf ; - bg = (a >> 8) & 0xf; + bg = (a >> 4) & 0xf; for (i = 0; i < VERSATILE_FONT_HEIGHT; i++) { for (j = 0, k = 7; j < 8; j++, k--) { diff --git a/sys/boot/common/interp_forth.c b/sys/boot/common/interp_forth.c index b53da43..1c37e2b 100644 --- a/sys/boot/common/interp_forth.c +++ b/sys/boot/common/interp_forth.c @@ -51,6 +51,13 @@ extern char bootprog_rev[]; #define BF_PARSE 100 /* + * FreeBSD loader default dictionary cells + */ +#ifndef BF_DICTSIZE +#define BF_DICTSIZE 10000 +#endif + +/* * BootForth Interface to Ficl Forth interpreter. */ @@ -239,8 +246,8 @@ bf_init(void) struct bootblk_command **cmdp; char create_buf[41]; /* 31 characters-long builtins */ int fd; - - bf_sys = ficlInitSystem(10000); /* Default dictionary ~4000 cells */ + + bf_sys = ficlInitSystem(BF_DICTSIZE); bf_vm = ficlNewVM(bf_sys); /* Put all private definitions in a "builtins" vocabulary */ diff --git a/sys/boot/fdt/dts/pandaboard.dts b/sys/boot/fdt/dts/pandaboard.dts index 0f262b1..d1fa803 100644 --- a/sys/boot/fdt/dts/pandaboard.dts +++ b/sys/boot/fdt/dts/pandaboard.dts @@ -67,6 +67,8 @@ pl310@48242000 { compatible = "arm,pl310"; reg = < 0x48242000 0x1000 >; + interrupts = < 32 >; + interrupt-parent = < &GIC >; }; mp_tmr@48240200 { compatible = "arm,mpcore-timers"; diff --git a/sys/boot/userboot/userboot/Makefile b/sys/boot/userboot/userboot/Makefile index bc0a309..a4bec5c 100644 --- a/sys/boot/userboot/userboot/Makefile +++ b/sys/boot/userboot/userboot/Makefile @@ -45,6 +45,7 @@ CLEANFILES= vers.c .if ${MK_FORTH} != "no" BOOT_FORTH= yes CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 +CFLAGS+= -DBF_DICTSIZE=15000 LIBFICL= ${.OBJDIR}/../ficl/libficl.a LIBSTAND= ${.OBJDIR}/../libstand/libstand.a .endif diff --git a/sys/boot/userboot/userboot/main.c b/sys/boot/userboot/userboot/main.c index b9b1337..39f6012 100644 --- a/sys/boot/userboot/userboot/main.c +++ b/sys/boot/userboot/userboot/main.c @@ -69,7 +69,7 @@ exit(int v) void loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks) { - static char malloc[512*1024]; + static char malloc[1024*1024]; const char *var; int i; @@ -85,7 +85,7 @@ loader_main(struct loader_callbacks *cb, void *arg, int version, int ndisks) * alloc() is usable. The stack is buried inside us, so this is * safe. */ - setheap((void *)malloc, (void *)(malloc + 512*1024)); + setheap((void *)malloc, (void *)(malloc + 1024*1024)); /* * Hook up the console diff --git a/sys/conf/files b/sys/conf/files index f2c356e..04718e8 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -726,6 +726,8 @@ dev/ath/if_ath_rx.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/if_ath_rx_edma.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" +dev/ath/if_ath_spectral.c optional ath \ + compile-with "${NORMAL_C} -I$S/dev/ath" dev/ath/ah_osdep.c optional ath \ compile-with "${NORMAL_C} -I$S/dev/ath" # @@ -918,6 +920,10 @@ dev/ath/ath_hal/ar5416/ar5416_reset.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" +dev/ath/ath_hal/ar5416/ar5416_spectral.c \ + optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ + ath_ar9287 \ + compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal" dev/ath/ath_hal/ar5416/ar5416_xmit.c \ optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \ ath_ar9287 \ @@ -2182,7 +2188,7 @@ dev/usb/net/if_udav.c optional udav dev/usb/net/if_usie.c optional usie dev/usb/net/ruephy.c optional rue dev/usb/net/usb_ethernet.c optional aue | axe | cdce | cue | kue | mos | \ - rue | smsc | udav + rue | smsc | udav | ipheth dev/usb/net/uhso.c optional uhso # # USB WLAN drivers diff --git a/sys/conf/options.mips b/sys/conf/options.mips index a86a749..2f27206 100644 --- a/sys/conf/options.mips +++ b/sys/conf/options.mips @@ -73,6 +73,7 @@ MAXMEM opt_global.h # OCTEON_MODEL opt_cvmx.h OCTEON_VENDOR_LANNER opt_cvmx.h +OCTEON_VENDOR_UBIQUITI opt_cvmx.h OCTEON_VENDOR_RADISYS opt_cvmx.h OCTEON_BOARD_CAPK_0100ND opt_cvmx.h diff --git a/sys/contrib/octeon-sdk/cvmx-app-init.h b/sys/contrib/octeon-sdk/cvmx-app-init.h index a986814..605f43e 100644 --- a/sys/contrib/octeon-sdk/cvmx-app-init.h +++ b/sys/contrib/octeon-sdk/cvmx-app-init.h @@ -299,6 +299,9 @@ enum cvmx_board_types_enum { CVMX_BOARD_TYPE_CUST_LANNER_MR320= 20002, CVMX_BOARD_TYPE_CUST_LANNER_MR321X=20007, #endif +#if defined(OCTEON_VENDOR_UBIQUITI) + CVMX_BOARD_TYPE_CUST_UBIQUITI_E100=20002, +#endif #if defined(OCTEON_VENDOR_RADISYS) CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE=20002, #endif @@ -426,6 +429,9 @@ static inline const char *cvmx_board_type_to_string(enum cvmx_board_types_enum t ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR320) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_LANNER_MR321X) #endif +#if defined(OCTEON_VENDOR_UBIQUITI) + ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_UBIQUITI_E100) +#endif #if defined(OCTEON_VENDOR_RADISYS) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE) #endif diff --git a/sys/contrib/octeon-sdk/cvmx-helper-board.c b/sys/contrib/octeon-sdk/cvmx-helper-board.c index deb6018..8d2b0bd 100644 --- a/sys/contrib/octeon-sdk/cvmx-helper-board.c +++ b/sys/contrib/octeon-sdk/cvmx-helper-board.c @@ -592,6 +592,12 @@ int cvmx_helper_board_get_mii_address(int ipd_port) return -1; } #endif +#if defined(OCTEON_VENDOR_UBIQUITI) + case CVMX_BOARD_TYPE_CUST_UBIQUITI_E100: + if (ipd_port > 2) + return -1; + return (7 - ipd_port); +#endif #if defined(OCTEON_VENDOR_RADISYS) case CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE: /* No MII. */ @@ -1463,6 +1469,9 @@ cvmx_helper_board_usb_clock_types_t __cvmx_helper_board_usb_get_clock_type(void) case CVMX_BOARD_TYPE_CUST_LANNER_MR320: case CVMX_BOARD_TYPE_CUST_LANNER_MR321X: #endif +#if defined(OCTEON_VENDOR_UBIQUITI) + case CVMX_BOARD_TYPE_CUST_UBIQUITI_E100: +#endif #if defined(OCTEON_BOARD_CAPK_0100ND) case CVMX_BOARD_TYPE_CN3010_EVB_HS5: #endif diff --git a/sys/dev/agp/agp_ali.c b/sys/dev/agp/agp_ali.c index 7cd16ba..8aad840 100644 --- a/sys/dev/agp/agp_ali.c +++ b/sys/dev/agp/agp_ali.c @@ -69,7 +69,7 @@ agp_ali_match(device_t dev) return ("Ali M1541 host to AGP bridge"); case 0x162110b9: return ("Ali M1621 host to AGP bridge"); - }; + } return NULL; } diff --git a/sys/dev/agp/agp_amd.c b/sys/dev/agp/agp_amd.c index 5e0d6d0..2b58a3e 100644 --- a/sys/dev/agp/agp_amd.c +++ b/sys/dev/agp/agp_amd.c @@ -191,7 +191,7 @@ agp_amd_match(device_t dev) return ("AMD 761 host to AGP bridge"); case 0x700c1022: return ("AMD 762 host to AGP bridge"); - }; + } return NULL; } diff --git a/sys/dev/agp/agp_amd64.c b/sys/dev/agp/agp_amd64.c index d4d11ac..5423d5a 100644 --- a/sys/dev/agp/agp_amd64.c +++ b/sys/dev/agp/agp_amd64.c @@ -113,7 +113,7 @@ agp_amd64_match(device_t dev) return ("VIA K8T800Pro host to PCI bridge"); case 0x31881106: return ("VIA 8385 host to PCI bridge"); - }; + } return (NULL); } diff --git a/sys/dev/agp/agp_ati.c b/sys/dev/agp/agp_ati.c index 350d846..c8e35ef 100644 --- a/sys/dev/agp/agp_ati.c +++ b/sys/dev/agp/agp_ati.c @@ -99,7 +99,7 @@ agp_ati_match(device_t dev) return ("ATI RS300_166 AGP bridge"); case 0x58331002: return ("ATI RS300_200 AGP bridge"); - }; + } return NULL; } @@ -199,7 +199,7 @@ agp_ati_attach(device_t dev) default: /* Unknown chipset */ return EINVAL; - }; + } rid = ATI_GART_MMADDR; sc->regs = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); diff --git a/sys/dev/agp/agp_intel.c b/sys/dev/agp/agp_intel.c index 34ea66c..7197580 100644 --- a/sys/dev/agp/agp_intel.c +++ b/sys/dev/agp/agp_intel.c @@ -105,7 +105,7 @@ agp_intel_match(device_t dev) return ("Intel 82845G host to AGP bridge"); case 0x35808086: return ("Intel 82855GM host to AGP bridge"); - }; + } return (NULL); } diff --git a/sys/dev/agp/agp_sis.c b/sys/dev/agp/agp_sis.c index e087ba9..91620de 100644 --- a/sys/dev/agp/agp_sis.c +++ b/sys/dev/agp/agp_sis.c @@ -101,7 +101,7 @@ agp_sis_match(device_t dev) return ("SiS 745 host to AGP bridge"); case 0x07461039: return ("SiS 746 host to AGP bridge"); - }; + } return NULL; } diff --git a/sys/dev/agp/agp_via.c b/sys/dev/agp/agp_via.c index a6f3918..8b054fe 100644 --- a/sys/dev/agp/agp_via.c +++ b/sys/dev/agp/agp_via.c @@ -135,7 +135,7 @@ agp_via_match(device_t dev) return ("VIA PT880 host to PCI bridge"); case 0xb1981106: return ("VIA VT83xx/VT87xx/KTxxx/Px8xx host to PCI bridge"); - }; + } return NULL; } diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c index 43ec254..5882c86 100644 --- a/sys/dev/ahci/ahci.c +++ b/sys/dev/ahci/ahci.c @@ -179,6 +179,14 @@ static struct { {0x1e078086, 0x00, "Intel Panther Point", 0}, {0x1e0e8086, 0x00, "Intel Panther Point", 0}, {0x1e0f8086, 0x00, "Intel Panther Point", 0}, + {0x8c028086, 0x00, "Intel Lynx Point", 0}, + {0x8c038086, 0x00, "Intel Lynx Point", 0}, + {0x8c048086, 0x00, "Intel Lynx Point", 0}, + {0x8c058086, 0x00, "Intel Lynx Point", 0}, + {0x8c068086, 0x00, "Intel Lynx Point", 0}, + {0x8c078086, 0x00, "Intel Lynx Point", 0}, + {0x8c0e8086, 0x00, "Intel Lynx Point", 0}, + {0x8c0f8086, 0x00, "Intel Lynx Point", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, diff --git a/sys/dev/ata/ata-pci.h b/sys/dev/ata/ata-pci.h index 9aaa39f..d918528 100644 --- a/sys/dev/ata/ata-pci.h +++ b/sys/dev/ata/ata-pci.h @@ -260,6 +260,19 @@ struct ata_pci_controller { #define ATA_PPT_R5 0x1e0e8086 #define ATA_PPT_R6 0x1e0f8086 +#define ATA_LPT_S1 0x8c008086 +#define ATA_LPT_S2 0x8c018086 +#define ATA_LPT_AH1 0x8c028086 +#define ATA_LPT_AH2 0x8c038086 +#define ATA_LPT_R1 0x8c048086 +#define ATA_LPT_R2 0x8c058086 +#define ATA_LPT_R3 0x8c068086 +#define ATA_LPT_R4 0x8c078086 +#define ATA_LPT_S3 0x8c088086 +#define ATA_LPT_S4 0x8c098086 +#define ATA_LPT_R5 0x8c0e8086 +#define ATA_LPT_R6 0x8c0f8086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 #define ATA_DH89XXCC 0x23238086 diff --git a/sys/dev/ata/chipsets/ata-intel.c b/sys/dev/ata/chipsets/ata-intel.c index 6888e3c..b2cd714 100644 --- a/sys/dev/ata/chipsets/ata-intel.c +++ b/sys/dev/ata/chipsets/ata-intel.c @@ -211,6 +211,18 @@ ata_intel_probe(device_t dev) { ATA_PPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_PPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_LPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R4, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, + { ATA_LPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Lynx Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { ATA_DH89XXCC, 0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" }, diff --git a/sys/dev/ath/ath_dfs/null/dfs_null.c b/sys/dev/ath/ath_dfs/null/dfs_null.c index 11b3d8a..36b2042 100644 --- a/sys/dev/ath/ath_dfs/null/dfs_null.c +++ b/sys/dev/ath/ath_dfs/null/dfs_null.c @@ -146,6 +146,26 @@ ath_dfs_radar_enable(struct ath_softc *sc, struct ieee80211_channel *chan) } /* + * Explicity disable radar reporting. + * + * Return 0 if it was disabled, < 0 on error. + */ +int +ath_dfs_radar_disable(struct ath_softc *sc) +{ +#if 0 + HAL_PHYERR_PARAM pe; + + (void) ath_hal_getdfsthresh(sc->sc_ah, &pe); + pe.pe_enabled = 0; + (void) ath_hal_enabledfs(sc->sc_ah, &pe); + return (0); +#else + return (0); +#endif +} + +/* * Process DFS related PHY errors * * The mbuf is not "ours" and if we want a copy, we have diff --git a/sys/dev/ath/ath_hal/ah.c b/sys/dev/ath/ath_hal/ah.c index b9ad649..d1ce7a8 100644 --- a/sys/dev/ath/ath_hal/ah.c +++ b/sys/dev/ath/ath_hal/ah.c @@ -734,6 +734,8 @@ ath_hal_getcapability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, return HAL_OK; case HAL_CAP_BT_COEX: return pCap->halBtCoexSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_SPECTRAL_SCAN: + return pCap->halSpectralScanSupport ? HAL_OK : HAL_ENOTSUPP; case HAL_CAP_HT20_SGI: return pCap->halHTSGI20Support ? HAL_OK : HAL_ENOTSUPP; case HAL_CAP_RXTSTAMP_PREC: /* rx desc tstamp precision (bits) */ diff --git a/sys/dev/ath/ath_hal/ah.h b/sys/dev/ath/ath_hal/ah.h index 8a71450..19beffe 100644 --- a/sys/dev/ath/ath_hal/ah.h +++ b/sys/dev/ath/ath_hal/ah.h @@ -156,6 +156,7 @@ typedef enum { HAL_CAP_RXBUFSIZE = 81, /* Receive Buffer Length */ HAL_CAP_NUM_MR_RETRIES = 82, /* limit on multirate retries */ HAL_CAP_OL_PWRCTRL = 84, /* Open loop TX power control */ + HAL_CAP_SPECTRAL_SCAN = 90, /* Hardware supports spectral scan */ HAL_CAP_BB_PANIC_WATCHDOG = 92, @@ -930,6 +931,20 @@ typedef struct { #define HAL_PHYERR_PARAM_NOVAL 65535 +typedef struct { + u_int16_t ss_fft_period; /* Skip interval for FFT reports */ + u_int16_t ss_period; /* Spectral scan period */ + u_int16_t ss_count; /* # of reports to return from ss_active */ + u_int16_t ss_short_report;/* Set to report ony 1 set of FFT results */ + u_int8_t radar_bin_thresh_sel; /* strong signal radar FFT threshold configuration */ + u_int16_t ss_spectral_pri; /* are we doing a noise power cal ? */ + int8_t ss_nf_cal[AH_MAX_CHAINS*2]; /* nf calibrated values for ctl+ext from eeprom */ + int8_t ss_nf_pwr[AH_MAX_CHAINS*2]; /* nf pwr values for ctl+ext from eeprom */ + int32_t ss_nf_temp_data; /* temperature data taken during nf scan */ +} HAL_SPECTRAL_PARAM; +#define HAL_SPECTRAL_PARAM_NOVAL 0xFFFF +#define HAL_SPECTRAL_PARAM_ENABLE 0x8000 /* Enable/Disable if applicable */ + /* * DFS operating mode flags. */ @@ -1433,6 +1448,17 @@ struct ath_hal { const char *buf, HAL_DFS_EVENT *event); HAL_BOOL __ahdecl(*ah_isFastClockEnabled)(struct ath_hal *ah); + /* Spectral Scan functions */ + void __ahdecl(*ah_spectralConfigure)(struct ath_hal *ah, + HAL_SPECTRAL_PARAM *sp); + void __ahdecl(*ah_spectralGetConfig)(struct ath_hal *ah, + HAL_SPECTRAL_PARAM *sp); + void __ahdecl(*ah_spectralStart)(struct ath_hal *); + void __ahdecl(*ah_spectralStop)(struct ath_hal *); + HAL_BOOL __ahdecl(*ah_spectralIsEnabled)(struct ath_hal *); + HAL_BOOL __ahdecl(*ah_spectralIsActive)(struct ath_hal *); + /* XXX getNfPri() and getNfExt() */ + /* Key Cache Functions */ uint32_t __ahdecl(*ah_getKeyCacheSize)(struct ath_hal*); HAL_BOOL __ahdecl(*ah_resetKeyCacheEntry)(struct ath_hal*, uint16_t); diff --git a/sys/dev/ath/ath_hal/ah_internal.h b/sys/dev/ath/ath_hal/ah_internal.h index 2d1087a..e3263f9 100644 --- a/sys/dev/ath/ath_hal/ah_internal.h +++ b/sys/dev/ath/ath_hal/ah_internal.h @@ -278,7 +278,8 @@ typedef struct { hal49GhzSupport : 1, halAntDivCombSupport : 1, halAntDivCombSupportOrg : 1, - halRadioRetentionSupport : 1; + halRadioRetentionSupport : 1, + halSpectralScanSupport : 1; uint32_t halWirelessModes; uint16_t halTotalQueues; diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416.h b/sys/dev/ath/ath_hal/ar5416/ar5416.h index 90397aa..d570588 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416.h +++ b/sys/dev/ath/ath_hal/ar5416/ar5416.h @@ -265,6 +265,16 @@ extern HAL_BOOL ar5416ProcessRadarEvent(struct ath_hal *ah, HAL_DFS_EVENT *event); extern HAL_BOOL ar5416IsFastClockEnabled(struct ath_hal *ah); +/* ar9280_spectral.c */ +extern void ar5416ConfigureSpectralScan(struct ath_hal *ah, HAL_SPECTRAL_PARAM *ss); +extern void ar5416GetSpectralParams(struct ath_hal *ah, HAL_SPECTRAL_PARAM *ss); +extern HAL_BOOL ar5416IsSpectralActive(struct ath_hal *ah); +extern HAL_BOOL ar5416IsSpectralEnabled(struct ath_hal *ah); +extern void ar5416StartSpectralScan(struct ath_hal *ah); +extern void ar5416StopSpectralScan(struct ath_hal *ah); +extern uint32_t ar5416GetSpectralConfig(struct ath_hal *ah); +extern void ar5416RestoreSpectralConfig(struct ath_hal *ah, uint32_t restoreval); + extern HAL_BOOL ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip); extern HAL_POWER_MODE ar5416GetPowerMode(struct ath_hal *ah); diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c index 2a76b4b..d165540 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c @@ -161,6 +161,14 @@ ar5416InitState(struct ath_hal_5416 *ahp5416, uint16_t devid, HAL_SOFTC sc, ah->ah_procRadarEvent = ar5416ProcessRadarEvent; ah->ah_isFastClockEnabled = ar5416IsFastClockEnabled; + /* Spectral Scan Functions */ + ah->ah_spectralConfigure = ar5416ConfigureSpectralScan; + ah->ah_spectralGetConfig = ar5416GetSpectralParams; + ah->ah_spectralStart = ar5416StartSpectralScan; + ah->ah_spectralStop = ar5416StopSpectralScan; + ah->ah_spectralIsEnabled = ar5416IsSpectralEnabled; + ah->ah_spectralIsActive = ar5416IsSpectralActive; + /* Power Management Functions */ ah->ah_setPowerMode = ar5416SetPowerMode; @@ -918,6 +926,7 @@ ar5416FillCapabilityInfo(struct ath_hal *ah) pCap->halMcastKeySrchSupport = AH_TRUE; /* Works on AR5416 and later */ pCap->halTsfAddSupport = AH_TRUE; pCap->hal4AddrAggrSupport = AH_FALSE; /* Broken in Owl */ + pCap->halSpectralScanSupport = AH_FALSE; /* AR9280 and later */ if (ath_hal_eepromGet(ah, AR_EEP_MAXQCU, &val) == HAL_OK) pCap->halTotalQueues = val; diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c b/sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c new file mode 100644 index 0000000..6bdd722 --- /dev/null +++ b/sys/dev/ath/ath_hal/ar5416/ar5416_spectral.c @@ -0,0 +1,244 @@ +/* + * Copyright (c) 2012 Qualcomm Atheros, All Rights Reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ +#include "opt_ah.h" + +#include "ah.h" +#include "ah_internal.h" +#include "ah_devid.h" +#include "ah_desc.h" /* NB: for HAL_PHYERR* */ + +#include "ar5416/ar5416.h" +#include "ar5416/ar5416reg.h" +#include "ar5416/ar5416phy.h" + +/* + * Default AR9280 spectral scan parameters + */ +#define AR5416_SPECTRAL_SCAN_ENA 0 +#define AR5416_SPECTRAL_SCAN_ACTIVE 0 +#define AR5416_SPECTRAL_SCAN_FFT_PERIOD 8 +#define AR5416_SPECTRAL_SCAN_PERIOD 1 +#define AR5416_SPECTRAL_SCAN_COUNT 16 //used to be 128 +#define AR5416_SPECTRAL_SCAN_SHORT_REPEAT 1 + +/* constants */ +#define MAX_RADAR_RSSI_THRESH 0x3f +#define MAX_RADAR_HEIGHT 0x3f +#define ENABLE_ALL_PHYERR 0xffffffff + +static void ar5416DisableRadar(struct ath_hal *ah); +static void ar5416PrepSpectralScan(struct ath_hal *ah); + +static void +ar5416DisableRadar(struct ath_hal *ah) +{ + uint32_t val; + + // Enable radar FFT + val = OS_REG_READ(ah, AR_PHY_RADAR_0); + val |= AR_PHY_RADAR_0_FFT_ENA; + + // set radar detect thresholds to max to effectively disable radar + val &= ~AR_PHY_RADAR_0_RRSSI; + val |= SM(MAX_RADAR_RSSI_THRESH, AR_PHY_RADAR_0_RRSSI); + + val &= ~AR_PHY_RADAR_0_HEIGHT; + val |= SM(MAX_RADAR_HEIGHT, AR_PHY_RADAR_0_HEIGHT); + + val &= ~(AR_PHY_RADAR_0_ENA); + OS_REG_WRITE(ah, AR_PHY_RADAR_0, val); + + // disable extension radar detect + val = OS_REG_READ(ah, AR_PHY_RADAR_EXT); + OS_REG_WRITE(ah, AR_PHY_RADAR_EXT, val & ~AR_PHY_RADAR_EXT_ENA); + + val = OS_REG_READ(ah, AR_RX_FILTER); + val |= (1<<13); + OS_REG_WRITE(ah, AR_RX_FILTER, val); +} + +static void +ar5416PrepSpectralScan(struct ath_hal *ah) +{ + + ar5416DisableRadar(ah); + OS_REG_WRITE(ah, AR_PHY_ERR, ENABLE_ALL_PHYERR); +} + +void +ar5416ConfigureSpectralScan(struct ath_hal *ah, HAL_SPECTRAL_PARAM *ss) +{ + uint32_t val; + + ar5416PrepSpectralScan(ah); + + val = OS_REG_READ(ah, AR_PHY_SPECTRAL_SCAN); + + if (ss->ss_fft_period != HAL_SPECTRAL_PARAM_NOVAL) { + val &= ~AR_PHY_SPECTRAL_SCAN_FFT_PERIOD; + val |= SM(ss->ss_fft_period, AR_PHY_SPECTRAL_SCAN_FFT_PERIOD); + } + + if (ss->ss_period != HAL_SPECTRAL_PARAM_NOVAL) { + val &= ~AR_PHY_SPECTRAL_SCAN_PERIOD; + val |= SM(ss->ss_period, AR_PHY_SPECTRAL_SCAN_PERIOD); + } + + if (ss->ss_period != HAL_SPECTRAL_PARAM_NOVAL) { + val &= ~AR_PHY_SPECTRAL_SCAN_PERIOD; + val |= SM(ss->ss_period, AR_PHY_SPECTRAL_SCAN_PERIOD); + } + + /* This section is different for Kiwi and Merlin */ + if (AR_SREV_MERLIN(ah) ) { + if (ss->ss_count != HAL_SPECTRAL_PARAM_NOVAL) { + val &= ~AR_PHY_SPECTRAL_SCAN_COUNT; + val |= SM(ss->ss_count, AR_PHY_SPECTRAL_SCAN_COUNT); + } + + if (ss->ss_short_report == AH_TRUE) { + val |= AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT; + } else if (ss->ss_short_report != HAL_SPECTRAL_PARAM_NOVAL) { + val &= ~AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT; + } + } else { + if (ss->ss_count != HAL_SPECTRAL_PARAM_NOVAL) { + /* + * In Merlin, for continous scan, scan_count = 128. + * In case of Kiwi, this value should be 0 + */ + if (ss->ss_count == 128) + ss->ss_count = 0; + val &= ~AR_PHY_SPECTRAL_SCAN_COUNT_KIWI; + val |= SM(ss->ss_count, AR_PHY_SPECTRAL_SCAN_COUNT_KIWI); + } + + if (ss->ss_short_report == AH_TRUE) { + val |= AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI; + } else if (ss->ss_short_report != HAL_SPECTRAL_PARAM_NOVAL) { + val &= ~AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI; + } + + //Select the mask to be same as before + val |= AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT_KIWI; + } + // Enable spectral scan + OS_REG_WRITE(ah, AR_PHY_SPECTRAL_SCAN, val | AR_PHY_SPECTRAL_SCAN_ENA); + + ar5416GetSpectralParams(ah, ss); +} + +/* + * Get the spectral parameter values and return them in the pe + * structure + */ +void +ar5416GetSpectralParams(struct ath_hal *ah, HAL_SPECTRAL_PARAM *ss) +{ + uint32_t val; + + val = OS_REG_READ(ah, AR_PHY_SPECTRAL_SCAN); + + ss->ss_fft_period = MS(val, AR_PHY_SPECTRAL_SCAN_FFT_PERIOD); + ss->ss_period = MS(val, AR_PHY_SPECTRAL_SCAN_PERIOD); + if (AR_SREV_MERLIN(ah) ) { + ss->ss_count = MS(val, AR_PHY_SPECTRAL_SCAN_COUNT); + ss->ss_short_report = MS(val, AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT); + } else { + ss->ss_count = MS(val, AR_PHY_SPECTRAL_SCAN_COUNT_KIWI); + ss->ss_short_report = MS(val, AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI); + } + val = OS_REG_READ(ah, AR_PHY_RADAR_1); + ss->radar_bin_thresh_sel = MS(val, AR_PHY_RADAR_1_BIN_THRESH_SELECT); +} + +HAL_BOOL +ar5416IsSpectralActive(struct ath_hal *ah) +{ + uint32_t val; + + val = OS_REG_READ(ah, AR_PHY_SPECTRAL_SCAN); + return MS(val, AR_PHY_SPECTRAL_SCAN_ACTIVE); +} + +HAL_BOOL +ar5416IsSpectralEnabled(struct ath_hal *ah) +{ + uint32_t val; + + val = OS_REG_READ(ah, AR_PHY_SPECTRAL_SCAN); + return MS(val,AR_PHY_SPECTRAL_SCAN_ENA); +} + +void +ar5416StartSpectralScan(struct ath_hal *ah) +{ + uint32_t val; + + ar5416PrepSpectralScan(ah); + + // Activate spectral scan + val = OS_REG_READ(ah, AR_PHY_SPECTRAL_SCAN); + val |= AR_PHY_SPECTRAL_SCAN_ENA; + val |= AR_PHY_SPECTRAL_SCAN_ACTIVE; + OS_REG_WRITE(ah, AR_PHY_SPECTRAL_SCAN, val); + val = OS_REG_READ(ah, AR_PHY_SPECTRAL_SCAN); + val = OS_REG_READ(ah, AR_PHY_ERR_MASK_REG); + OS_REG_WRITE(ah, AR_PHY_ERR_MASK_REG, val | AR_PHY_ERR_RADAR); +} + +void +ar5416StopSpectralScan(struct ath_hal *ah) +{ + uint32_t val; + val = OS_REG_READ(ah, AR_PHY_SPECTRAL_SCAN); + + // Deactivate spectral scan + val &= ~AR_PHY_SPECTRAL_SCAN_ENA; + val &= ~AR_PHY_SPECTRAL_SCAN_ACTIVE; + OS_REG_WRITE(ah, AR_PHY_SPECTRAL_SCAN, val); + val = OS_REG_READ(ah, AR_PHY_SPECTRAL_SCAN); + val = OS_REG_READ(ah, AR_PHY_ERR_MASK_REG) & (~AR_PHY_ERR_RADAR); + OS_REG_WRITE(ah, AR_PHY_ERR_MASK_REG, val); +} + +uint32_t +ar5416GetSpectralConfig(struct ath_hal *ah) +{ + uint32_t val; + + val = OS_REG_READ(ah, AR_PHY_SPECTRAL_SCAN); + return val; +} + +void +ar5416RestoreSpectralConfig(struct ath_hal *ah, uint32_t restoreval) +{ + uint32_t curval; + + ar5416PrepSpectralScan(ah); + + curval = OS_REG_READ(ah, AR_PHY_SPECTRAL_SCAN); + + if (restoreval != curval) { + restoreval |= AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT; + OS_REG_WRITE(ah, AR_PHY_SPECTRAL_SCAN, restoreval); + } + return; +} + diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416phy.h b/sys/dev/ath/ath_hal/ar5416/ar5416phy.h index b68e2ca..4884dac 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416phy.h +++ b/sys/dev/ath/ath_hal/ar5416/ar5416phy.h @@ -57,6 +57,37 @@ #define AR_BT_DISABLE_BT_ANT 0x00100000 #define AR_BT_DISABLE_BT_ANT_S 20 +#define AR_PHY_SPECTRAL_SCAN 0x9910 +#define AR_PHY_SPECTRAL_SCAN_ENA 0x00000001 +#define AR_PHY_SPECTRAL_SCAN_ENA_S 0 +#define AR_PHY_SPECTRAL_SCAN_ACTIVE 0x00000002 +#define AR_PHY_SPECTRAL_SCAN_ACTIVE_S 1 +#define AR_PHY_SPECTRAL_SCAN_FFT_PERIOD 0x000000F0 +#define AR_PHY_SPECTRAL_SCAN_FFT_PERIOD_S 4 +#define AR_PHY_SPECTRAL_SCAN_PERIOD 0x0000FF00 +#define AR_PHY_SPECTRAL_SCAN_PERIOD_S 8 + +/* Scan count and Short repeat flags are different for Kiwi and Merlin */ +#define AR_PHY_SPECTRAL_SCAN_COUNT 0x00FF0000 +#define AR_PHY_SPECTRAL_SCAN_COUNT_S 16 +#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI 0x0FFF0000 +#define AR_PHY_SPECTRAL_SCAN_COUNT_KIWI_S 16 + +#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT 0x01000000 +#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_S 24 +#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI 0x10000000 +#define AR_PHY_SPECTRAL_SCAN_SHORT_REPEAT_KIWI_S 28 + +/* + * Kiwi only, bit 30 is used to set the error type, if set it is 0x5 (HAL_PHYERR_RADAR) + * Else it is 38 (new error type) + */ +#define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT_KIWI 0x40000000 /* Spectral Error select bit mask */ +#define AR_PHY_SPECTRAL_SCAN_PHYERR_MASK_SELECT_KIWI_S 30 /* Spectral Error select bit 30 */ + +#define AR_PHY_SPECTRAL_SCAN_PRIORITY_SELECT_KIWI 0x20000000 /* Spectral Error select bit mask */ +#define AR_PHY_SPECTRAL_SCAN_PRIORITY_SELECT_SELECT_KIWI_S 29 /* Spectral Error select bit 30 */ + /* For AR_PHY_RADAR0 */ #define AR_PHY_RADAR_0_FFT_ENA 0x80000000 @@ -64,6 +95,8 @@ #define AR_PHY_RADAR_EXT_ENA 0x00004000 #define AR_PHY_RADAR_1 0x9958 +#define AR_PHY_RADAR_1_BIN_THRESH_SELECT 0x07000000 +#define AR_PHY_RADAR_1_BIN_THRESH_SELECT_S 24 #define AR_PHY_RADAR_1_RELPWR_ENA 0x00800000 #define AR_PHY_RADAR_1_USE_FIR128 0x00400000 #define AR_PHY_RADAR_1_RELPWR_THRESH 0x003F0000 diff --git a/sys/dev/ath/ath_hal/ar5416/ar5416reg.h b/sys/dev/ath/ath_hal/ar5416/ar5416reg.h index 483d29d..13b7da6 100644 --- a/sys/dev/ath/ath_hal/ar5416/ar5416reg.h +++ b/sys/dev/ath/ath_hal/ar5416/ar5416reg.h @@ -179,6 +179,7 @@ #define AR_2040_MODE 0x8318 #define AR_EXTRCCNT 0x8328 /* extension channel rx clear count */ #define AR_SELFGEN_MASK 0x832c /* rx and cal chain masks */ +#define AR_PHY_ERR_MASK_REG 0x8338 #define AR_PCU_TXBUF_CTRL 0x8340 #define AR_PCU_MISC_MODE2 0x8344 diff --git a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c index 5d79418..2a67fe5 100644 --- a/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c +++ b/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c @@ -900,6 +900,7 @@ ar9280FillCapabilityInfo(struct ath_hal *ah) pCap->halHasRxSelfLinkedTail = AH_FALSE; pCap->halMbssidAggrSupport = AH_TRUE; pCap->hal4AddrAggrSupport = AH_TRUE; + pCap->halSpectralScanSupport = AH_TRUE; if (AR_SREV_MERLIN_20(ah)) { pCap->halPSPollBroken = AH_FALSE; diff --git a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c index 863fcd9..5f6a2a9 100644 --- a/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c +++ b/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c @@ -524,6 +524,7 @@ ar9285FillCapabilityInfo(struct ath_hal *ah) pCap->halHasRxSelfLinkedTail = AH_FALSE; pCap->halMbssidAggrSupport = AH_TRUE; pCap->hal4AddrAggrSupport = AH_TRUE; + pCap->halSpectralScanSupport = AH_TRUE; if (AR_SREV_KITE_12_OR_LATER(ah)) pCap->halPSPollBroken = AH_FALSE; diff --git a/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c b/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c index b6b8c2c..010e2c3 100644 --- a/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c +++ b/sys/dev/ath/ath_hal/ar9002/ar9287_attach.c @@ -453,6 +453,7 @@ ar9287FillCapabilityInfo(struct ath_hal *ah) /* Disable this so Block-ACK works correctly */ pCap->halHasRxSelfLinkedTail = AH_FALSE; pCap->halPSPollBroken = AH_FALSE; + pCap->halSpectralScanSupport = AH_TRUE; /* Hardware supports (at least) single-stream STBC TX/RX */ pCap->halRxStbcSupport = 1; diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 2dee99b..bd2580f 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -111,6 +111,7 @@ __FBSDID("$FreeBSD$"); #include <dev/ath/if_ath_rx_edma.h> #include <dev/ath/if_ath_tx_edma.h> #include <dev/ath/if_ath_beacon.h> +#include <dev/ath/if_ath_spectral.h> #include <dev/ath/if_athdfs.h> #ifdef ATH_TX99_DIAG @@ -510,6 +511,14 @@ ath_attach(u_int16_t devid, struct ath_softc *sc) goto bad2; } + /* Attach spectral module */ + if (ath_spectral_attach(sc) < 0) { + device_printf(sc->sc_dev, + "%s: unable to attach spectral\n", __func__); + error = EIO; + goto bad2; + } + /* Start DFS processing tasklet */ TASK_INIT(&sc->sc_dfstask, 0, ath_dfs_tasklet, sc); @@ -967,6 +976,7 @@ ath_detach(struct ath_softc *sc) if_ath_alq_tidyup(&sc->sc_alq); #endif + ath_spectral_detach(sc); ath_dfs_detach(sc); ath_desc_free(sc); ath_txdma_teardown(sc); @@ -1489,6 +1499,9 @@ ath_resume(struct ath_softc *sc) /* Let DFS at it in case it's a DFS channel */ ath_dfs_radar_enable(sc, ic->ic_curchan); + /* Let spectral at in case spectral is enabled */ + ath_spectral_enable(sc, ic->ic_curchan); + /* Restore the LED configuration */ ath_led_config(sc); ath_hal_setledstate(ah, HAL_LED_INIT); @@ -1918,6 +1931,9 @@ ath_init(void *arg) /* Let DFS at it in case it's a DFS channel */ ath_dfs_radar_enable(sc, ic->ic_curchan); + /* Let spectral at in case spectral is enabled */ + ath_spectral_enable(sc, ic->ic_curchan); + /* * Likewise this is set during reset so update * state cached in the driver. @@ -2226,6 +2242,9 @@ ath_reset(struct ifnet *ifp, ATH_RESET_TYPE reset_type) /* Let DFS at it in case it's a DFS channel */ ath_dfs_radar_enable(sc, ic->ic_curchan); + /* Let spectral at in case spectral is enabled */ + ath_spectral_enable(sc, ic->ic_curchan); + if (ath_startrecv(sc) != 0) /* restart recv */ if_printf(ifp, "%s: unable to start recv logic\n", __func__); /* @@ -4402,6 +4421,9 @@ ath_chan_set(struct ath_softc *sc, struct ieee80211_channel *chan) /* Let DFS at it in case it's a DFS channel */ ath_dfs_radar_enable(sc, chan); + /* Let spectral at in case spectral is enabled */ + ath_spectral_enable(sc, chan); + /* * Re-enable rx framework. */ @@ -5384,6 +5406,9 @@ ath_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ath_ioctl_phyerr(sc,(struct ath_diag*) ifr); break; #endif + case SIOCGATHSPECTRAL: + error = ath_ioctl_spectral(sc,(struct ath_diag*) ifr); + break; case SIOCGATHNODERATESTATS: error = ath_ioctl_ratestats(sc, (struct ath_rateioctl *) ifr); break; @@ -5620,7 +5645,7 @@ ath_node_set_tim(struct ieee80211_node *ni, int enable) struct ath_vap *avp = ATH_VAP(ni->ni_vap); /* - * Some operating omdes don't set av_set_tim(), so don't + * Some operating modes don't set av_set_tim(), so don't * update it here. */ if (avp->av_set_tim == NULL) diff --git a/sys/dev/ath/if_ath_rx.c b/sys/dev/ath/if_ath_rx.c index 543ba43..5a39d16 100644 --- a/sys/dev/ath/if_ath_rx.c +++ b/sys/dev/ath/if_ath_rx.c @@ -210,6 +210,13 @@ ath_calcrxfilter(struct ath_softc *sc) if (sc->sc_dodfs) rfilt |= HAL_RX_FILTER_PHYRADAR; + /* + * Enable spectral PHY errors if requested by the + * spectral module. + */ + if (sc->sc_dospectral) + rfilt |= HAL_RX_FILTER_PHYRADAR; + DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x, %s if_flags 0x%x\n", __func__, rfilt, ieee80211_opmode_name[ic->ic_opmode], ifp->if_flags); return rfilt; @@ -423,7 +430,21 @@ ath_rx_tap(struct ifnet *ifp, struct mbuf *m, sc->sc_rx_th.wr_flags = sc->sc_hwmap[rix].rxflags; #ifdef AH_SUPPORT_AR5416 sc->sc_rx_th.wr_chan_flags &= ~CHAN_HT; - if (sc->sc_rx_th.wr_rate & IEEE80211_RATE_MCS) { /* HT rate */ + if (rs->rs_status & HAL_RXERR_PHY) { + struct ieee80211com *ic = ifp->if_l2com; + + /* + * PHY error - make sure the channel flags + * reflect the actual channel configuration, + * not the received frame. + */ + if (IEEE80211_IS_CHAN_HT40U(ic->ic_curchan)) + sc->sc_rx_th.wr_chan_flags |= CHAN_HT40U; + else if (IEEE80211_IS_CHAN_HT40D(ic->ic_curchan)) + sc->sc_rx_th.wr_chan_flags |= CHAN_HT40D; + else if (IEEE80211_IS_CHAN_HT20(ic->ic_curchan)) + sc->sc_rx_th.wr_chan_flags |= CHAN_HT20; + } else if (sc->sc_rx_th.wr_rate & IEEE80211_RATE_MCS) { /* HT rate */ struct ieee80211com *ic = ifp->if_l2com; if ((rs->rs_flags & HAL_RX_2040) == 0) @@ -435,6 +456,7 @@ ath_rx_tap(struct ifnet *ifp, struct mbuf *m, if ((rs->rs_flags & HAL_RX_GI) == 0) sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_SHORTGI; } + #endif sc->sc_rx_th.wr_tsf = htole64(ath_extend_tsf(sc, rs->rs_tstamp, tsf)); if (rs->rs_status & HAL_RXERR_CRC) diff --git a/sys/dev/ath/if_ath_spectral.c b/sys/dev/ath/if_ath_spectral.c new file mode 100644 index 0000000..5cfb1a9 --- /dev/null +++ b/sys/dev/ath/if_ath_spectral.c @@ -0,0 +1,288 @@ +/*- + * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org> + * All rights reserved. + * + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +/* + * Implement some basic spectral scan control logic. + */ +#include "opt_ath.h" +#include "opt_inet.h" +#include "opt_wlan.h" + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/sysctl.h> +#include <sys/kernel.h> +#include <sys/lock.h> +#include <sys/mutex.h> +#include <sys/errno.h> + +#include <machine/bus.h> +#include <machine/resource.h> +#include <sys/bus.h> + +#include <sys/socket.h> + +#include <net/if.h> +#include <net/if_media.h> +#include <net/if_arp.h> +#include <net/ethernet.h> /* XXX for ether_sprintf */ + +#include <net80211/ieee80211_var.h> + +#include <net/bpf.h> + +#ifdef INET +#include <netinet/in.h> +#include <netinet/if_ether.h> +#endif + +#include <dev/ath/if_athvar.h> +#include <dev/ath/if_ath_spectral.h> + +#include <dev/ath/ath_hal/ah_desc.h> + +struct ath_spectral_state { + HAL_SPECTRAL_PARAM spectral_state; + + /* + * Should we enable spectral scan upon + * each network interface reset/change? + * + * This is intended to allow spectral scan + * frame reporting during channel scans. + * + * Later on it can morph into a larger + * scale config method where it pushes + * a "channel scan" config into the hardware + * rather than just the spectral_state + * config. + */ + int spectral_enable_after_reset; +}; + +/* + * Methods which are required + */ + +/* + * Attach spectral to the given interface + */ +int +ath_spectral_attach(struct ath_softc *sc) +{ + struct ath_spectral_state *ss; + + /* + * If spectral isn't supported, don't error - just + * quietly complete. + */ + if (! ath_hal_spectral_supported(sc->sc_ah)) + return (0); + + ss = malloc(sizeof(struct ath_spectral_state), + M_TEMP, M_WAITOK | M_ZERO); + + if (ss == NULL) { + device_printf(sc->sc_dev, "%s: failed to alloc memory\n", + __func__); + return (-ENOMEM); + } + + sc->sc_spectral = ss; + + (void) ath_hal_spectral_get_config(sc->sc_ah, &ss->spectral_state); + + return (0); +} + +/* + * Detach spectral from the given interface + */ +int +ath_spectral_detach(struct ath_softc *sc) +{ + + if (! ath_hal_spectral_supported(sc->sc_ah)) + return (0); + + if (sc->sc_spectral != NULL) { + free(sc->sc_spectral, M_TEMP); + } + return (0); +} + +/* + * Check whether spectral needs enabling and if so, + * flip it on. + */ +int +ath_spectral_enable(struct ath_softc *sc, struct ieee80211_channel *ch) +{ + struct ath_spectral_state *ss = sc->sc_spectral; + + /* Default to disable spectral PHY reporting */ + sc->sc_dospectral = 0; + + if (ss == NULL) + return (0); + + if (ss->spectral_enable_after_reset) { + ath_hal_spectral_configure(sc->sc_ah, + &ss->spectral_state); + (void) ath_hal_spectral_start(sc->sc_ah); + sc->sc_dospectral = 1; + } + return (0); +} + +/* + * Handle ioctl requests from the diagnostic interface. + * + * The initial part of this code resembles ath_ioctl_diag(); + * it's likely a good idea to reduce duplication between + * these two routines. + */ +int +ath_ioctl_spectral(struct ath_softc *sc, struct ath_diag *ad) +{ + unsigned int id = ad->ad_id & ATH_DIAG_ID; + void *indata = NULL; + void *outdata = NULL; + u_int32_t insize = ad->ad_in_size; + u_int32_t outsize = ad->ad_out_size; + int error = 0; + HAL_SPECTRAL_PARAM peout; + HAL_SPECTRAL_PARAM *pe; + struct ath_spectral_state *ss = sc->sc_spectral; + int val; + + if (! ath_hal_spectral_supported(sc->sc_ah)) + return (EINVAL); + + if (ad->ad_id & ATH_DIAG_IN) { + /* + * Copy in data. + */ + indata = malloc(insize, M_TEMP, M_NOWAIT); + if (indata == NULL) { + error = ENOMEM; + goto bad; + } + error = copyin(ad->ad_in_data, indata, insize); + if (error) + goto bad; + } + if (ad->ad_id & ATH_DIAG_DYN) { + /* + * Allocate a buffer for the results (otherwise the HAL + * returns a pointer to a buffer where we can read the + * results). Note that we depend on the HAL leaving this + * pointer for us to use below in reclaiming the buffer; + * may want to be more defensive. + */ + outdata = malloc(outsize, M_TEMP, M_NOWAIT); + if (outdata == NULL) { + error = ENOMEM; + goto bad; + } + } + switch (id) { + case SPECTRAL_CONTROL_GET_PARAMS: + memset(&peout, 0, sizeof(peout)); + outsize = sizeof(HAL_SPECTRAL_PARAM); + ath_hal_spectral_get_config(sc->sc_ah, &peout); + pe = (HAL_SPECTRAL_PARAM *) outdata; + memcpy(pe, &peout, sizeof(*pe)); + break; + case SPECTRAL_CONTROL_SET_PARAMS: + if (insize < sizeof(HAL_SPECTRAL_PARAM)) { + error = EINVAL; + break; + } + pe = (HAL_SPECTRAL_PARAM *) indata; + ath_hal_spectral_configure(sc->sc_ah, pe); + /* Save a local copy of the updated parameters */ + ath_hal_spectral_get_config(sc->sc_ah, + &ss->spectral_state); + break; + case SPECTRAL_CONTROL_START: + ath_hal_spectral_configure(sc->sc_ah, + &ss->spectral_state); + (void) ath_hal_spectral_start(sc->sc_ah); + sc->sc_dospectral = 1; + /* XXX need to update the PHY mask in the driver */ + break; + case SPECTRAL_CONTROL_STOP: + (void) ath_hal_spectral_stop(sc->sc_ah); + sc->sc_dospectral = 0; + /* XXX need to update the PHY mask in the driver */ + break; + case SPECTRAL_CONTROL_ENABLE_AT_RESET: + if (insize < sizeof(int)) { + device_printf(sc->sc_dev, "%d != %d\n", + insize, + (int) sizeof(int)); + error = EINVAL; + break; + } + if (indata == NULL) { + device_printf(sc->sc_dev, "indata=NULL\n"); + error = EINVAL; + break; + } + val = * ((int *) indata); + if (val == 0) + ss->spectral_enable_after_reset = 0; + else + ss->spectral_enable_after_reset = 1; + break; + case SPECTRAL_CONTROL_ENABLE: + /* XXX TODO */ + case SPECTRAL_CONTROL_DISABLE: + /* XXX TODO */ + break; + default: + error = EINVAL; + } + if (outsize < ad->ad_out_size) + ad->ad_out_size = outsize; + if (outdata && copyout(outdata, ad->ad_out_data, ad->ad_out_size)) + error = EFAULT; +bad: + if ((ad->ad_id & ATH_DIAG_IN) && indata != NULL) + free(indata, M_TEMP); + if ((ad->ad_id & ATH_DIAG_DYN) && outdata != NULL) + free(outdata, M_TEMP); + return (error); +} + diff --git a/sys/dev/ath/if_ath_spectral.h b/sys/dev/ath/if_ath_spectral.h new file mode 100644 index 0000000..3e069db --- /dev/null +++ b/sys/dev/ath/if_ath_spectral.h @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org> + * All rights reserved. + * + * 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, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. + * + * $FreeBSD$ + */ +#ifndef __IF_ATH_SPECTRAL_H__ +#define __IF_ATH_SPECTRAL_H__ + +extern int ath_spectral_attach(struct ath_softc *sc); +extern int ath_spectral_detach(struct ath_softc *sc); +extern int ath_ioctl_spectral(struct ath_softc *sc, struct ath_diag *ad); +extern int ath_spectral_enable(struct ath_softc *sc, + struct ieee80211_channel *ch); + +#endif /* __IF_ATH_SPECTRAL_H__ */ diff --git a/sys/dev/ath/if_athdfs.h b/sys/dev/ath/if_athdfs.h index 3529671..cc4db15 100644 --- a/sys/dev/ath/if_athdfs.h +++ b/sys/dev/ath/if_athdfs.h @@ -35,6 +35,7 @@ extern int ath_dfs_attach(struct ath_softc *sc); extern int ath_dfs_detach(struct ath_softc *sc); extern int ath_dfs_radar_enable(struct ath_softc *, struct ieee80211_channel *chan); +extern int ath_dfs_radar_disable(struct ath_softc *sc); extern void ath_dfs_process_phy_err(struct ath_softc *sc, struct mbuf *m, uint64_t tsf, struct ath_rx_status *rxstat); extern int ath_dfs_process_radar_event(struct ath_softc *sc, diff --git a/sys/dev/ath/if_athioctl.h b/sys/dev/ath/if_athioctl.h index 911bb97..f7b8600 100644 --- a/sys/dev/ath/if_athioctl.h +++ b/sys/dev/ath/if_athioctl.h @@ -406,4 +406,28 @@ struct ath_tx_radiotap_header { #define DFS_PARAM_ENABLE 32 #define DFS_PARAM_EN_EXTCH 33 +/* + * Spectral ioctl parameter types + */ +#define SPECTRAL_PARAM_FFT_PERIOD 1 +#define SPECTRAL_PARAM_SS_PERIOD 2 +#define SPECTRAL_PARAM_SS_COUNT 3 +#define SPECTRAL_PARAM_SS_SHORT_RPT 4 +#define SPECTRAL_PARAM_ENABLED 5 +#define SPECTRAL_PARAM_ACTIVE 6 + +/* + * Spectral control parameters + */ +#define SIOCGATHSPECTRAL _IOWR('i', 151, struct ath_diag) + +#define SPECTRAL_CONTROL_ENABLE 2 +#define SPECTRAL_CONTROL_DISABLE 3 +#define SPECTRAL_CONTROL_START 4 +#define SPECTRAL_CONTROL_STOP 5 +#define SPECTRAL_CONTROL_GET_PARAMS 6 +#define SPECTRAL_CONTROL_SET_PARAMS 7 +#define SPECTRAL_CONTROL_ENABLE_AT_RESET 8 +#define SPECTRAL_CONTROL_DISABLE_AT_RESET 9 + #endif /* _DEV_ATH_ATHIOCTL_H */ diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index 9edf8e1..2e170a3 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -750,6 +750,10 @@ struct ath_softc { int sc_dodfs; /* Whether to enable DFS rx filter bits */ struct task sc_dfstask; /* DFS processing task */ + /* Spectral related state */ + void *sc_spectral; + int sc_dospectral; + /* ALQ */ #ifdef ATH_DEBUG_ALQ struct if_ath_alq sc_alq; @@ -1299,4 +1303,15 @@ void ath_intr(void *); #define ath_hal_get_chan_ext_busy(_ah) \ ((*(_ah)->ah_get11nExtBusy)((_ah))) +#define ath_hal_spectral_supported(_ah) \ + (ath_hal_getcapability(_ah, HAL_CAP_SPECTRAL_SCAN, 0, NULL) == HAL_OK) +#define ath_hal_spectral_get_config(_ah, _p) \ + ((*(_ah)->ah_spectralGetConfig)((_ah), (_p))) +#define ath_hal_spectral_configure(_ah, _p) \ + ((*(_ah)->ah_spectralConfigure)((_ah), (_p))) +#define ath_hal_spectral_start(_ah) \ + ((*(_ah)->ah_spectralStart)((_ah))) +#define ath_hal_spectral_stop(_ah) \ + ((*(_ah)->ah_spectralStop)((_ah))) + #endif /* _DEV_ATH_ATHVAR_H */ diff --git a/sys/dev/fdt/fdtbus.c b/sys/dev/fdt/fdtbus.c index 2ca7ab5..770c4c8 100644 --- a/sys/dev/fdt/fdtbus.c +++ b/sys/dev/fdt/fdtbus.c @@ -257,6 +257,8 @@ newbus_device_destroy(device_t dev) struct fdtbus_devinfo *di; di = device_get_ivars(dev); + if (di == NULL) + return; free(di->di_name, M_OFWPROP); free(di->di_type, M_OFWPROP); diff --git a/sys/dev/ichsmb/ichsmb_pci.c b/sys/dev/ichsmb/ichsmb_pci.c index d4fb777..083338f 100644 --- a/sys/dev/ichsmb/ichsmb_pci.c +++ b/sys/dev/ichsmb/ichsmb_pci.c @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #define ID_PATSBURG 0x1d228086 #define ID_CPT 0x1c228086 #define ID_PPT 0x1e228086 +#define ID_LPT 0x8c228086 #define PCIS_SERIALBUS_SMBUS_PROGIF 0x00 @@ -188,6 +189,9 @@ ichsmb_pci_probe(device_t dev) case ID_PPT: device_set_desc(dev, "Intel Panther Point SMBus controller"); break; + case ID_LPT: + device_set_desc(dev, "Intel Lynx Point SMBus controller"); + break; default: return (ENXIO); } diff --git a/sys/dev/ichwd/ichwd.c b/sys/dev/ichwd/ichwd.c index 904c44d..2a0feb0 100644 --- a/sys/dev/ichwd/ichwd.c +++ b/sys/dev/ichwd/ichwd.c @@ -191,6 +191,9 @@ static struct ichwd_device ichwd_devices[] = { { DEVICEID_PPT29, "Intel Panther Point watchdog timer", 10 }, { DEVICEID_PPT30, "Intel Panther Point watchdog timer", 10 }, { DEVICEID_PPT31, "Intel Panther Point watchdog timer", 10 }, + { DEVICEID_LPT0, "Intel Lynx Point watchdog timer", 10 }, + { DEVICEID_LPT1, "Intel Lynx Point watchdog timer", 10 }, + { DEVICEID_LPT2, "Intel Lynx Point watchdog timer", 10 }, { DEVICEID_DH89XXCC_LPC, "Intel DH89xxCC watchdog timer", 10 }, { 0, NULL, 0 }, }; diff --git a/sys/dev/ichwd/ichwd.h b/sys/dev/ichwd/ichwd.h index 5c5b068..858e3bc 100644 --- a/sys/dev/ichwd/ichwd.h +++ b/sys/dev/ichwd/ichwd.h @@ -177,6 +177,38 @@ struct ichwd_softc { #define DEVICEID_3400 0x3b12 #define DEVICEID_3420 0x3b14 #define DEVICEID_3450 0x3b16 +#define DEVICEID_LPT0 0x8c40 +#define DEVICEID_LPT1 0x8c41 +#define DEVICEID_LPT2 0x8c42 +#define DEVICEID_LPT3 0x8c43 +#define DEVICEID_LPT4 0x8c44 +#define DEVICEID_LPT5 0x8c45 +#define DEVICEID_LPT6 0x8c46 +#define DEVICEID_LPT7 0x8c47 +#define DEVICEID_LPT8 0x8c48 +#define DEVICEID_LPT9 0x8c49 +#define DEVICEID_LPT10 0x8c4a +#define DEVICEID_LPT11 0x8c4b +#define DEVICEID_LPT12 0x8c4c +#define DEVICEID_LPT13 0x8c4d +#define DEVICEID_LPT14 0x8c4e +#define DEVICEID_LPT15 0x8c4f +#define DEVICEID_LPT16 0x8c50 +#define DEVICEID_LPT17 0x8c51 +#define DEVICEID_LPT18 0x8c52 +#define DEVICEID_LPT19 0x8c53 +#define DEVICEID_LPT20 0x8c54 +#define DEVICEID_LPT21 0x8c55 +#define DEVICEID_LPT22 0x8c56 +#define DEVICEID_LPT23 0x8c57 +#define DEVICEID_LPT24 0x8c58 +#define DEVICEID_LPT25 0x8c59 +#define DEVICEID_LPT26 0x8c5a +#define DEVICEID_LPT27 0x8c5b +#define DEVICEID_LPT28 0x8c5c +#define DEVICEID_LPT29 0x8c5d +#define DEVICEID_LPT30 0x8c5e +#define DEVICEID_LPT31 0x8c5f /* ICH LPC Interface Bridge Registers (ICH5 and older) */ #define ICH_GEN_STA 0xd4 diff --git a/sys/dev/nvme/nvme_test.c b/sys/dev/nvme/nvme_test.c index 3d04ea5..4177227 100644 --- a/sys/dev/nvme/nvme_test.c +++ b/sys/dev/nvme/nvme_test.c @@ -287,10 +287,10 @@ nvme_ns_test(struct nvme_namespace *ns, u_long cmd, caddr_t arg) for (i = 0; i < io_test->num_threads; i++) #if __FreeBSD_version >= 800004 kthread_add(fn, io_test_internal, - curproc, NULL, 0, 0, "nvme_io_test[%d]", i); + NULL, NULL, 0, 0, "nvme_io_test[%d]", i); #else kthread_create(fn, io_test_internal, - curproc, 0, 0, "nvme_io_test[%d]", i); + NULL, 0, 0, "nvme_io_test[%d]", i); #endif tsleep(io_test_internal, 0, "nvme_test", io_test->time * 2 * hz); diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 649a494..7632e73 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -244,6 +244,7 @@ static const struct pci_quirk pci_quirks[] = { * but support MSI just fine. QEMU uses the Intel 82440. */ { 0x12378086, PCI_QUIRK_ENABLE_MSI_VM, 0, 0 }, + { 0x12751275, PCI_QUIRK_ENABLE_MSI_VM, 0, 0 }, /* bhyve */ /* * HPET MMIO base address may appear in Bar1 for AMD SB600 SMBus diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index b8756a6..a5b58c3 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -425,12 +425,12 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *t #ifdef COMPAT_FREEBSD32 struct pci_conf_io32 *cio32 = NULL; struct pci_conf_old32 conf_old32; - struct pci_match_conf_old32 *pattern_buf_old32; + struct pci_match_conf_old32 *pattern_buf_old32 = NULL; #endif struct pci_conf_old conf_old; struct pci_io iodata; struct pci_io_old *io_old; - struct pci_match_conf_old *pattern_buf_old; + struct pci_match_conf_old *pattern_buf_old = NULL; io_old = NULL; @@ -470,10 +470,8 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *t #ifdef PRE7_COMPAT #ifdef COMPAT_FREEBSD32 case PCIOCGETCONF_OLD32: - pattern_buf_old32 = NULL; #endif case PCIOCGETCONF_OLD: - pattern_buf_old = NULL; #endif case PCIOCGETCONF: diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c index 79c6149..1a60266 100644 --- a/sys/dev/sound/pci/hda/hdac.c +++ b/sys/dev/sound/pci/hda/hdac.c @@ -81,6 +81,8 @@ static const struct { { HDA_INTEL_CPT, "Intel Cougar Point", 0, 0 }, { HDA_INTEL_PATSBURG,"Intel Patsburg", 0, 0 }, { HDA_INTEL_PPT1, "Intel Panther Point", 0, 0 }, + { HDA_INTEL_LPT1, "Intel Lynx Point", 0, 0 }, + { HDA_INTEL_LPT2, "Intel Lynx Point", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, diff --git a/sys/dev/sound/pci/hda/hdac.h b/sys/dev/sound/pci/hda/hdac.h index 642e379..9f9d687 100644 --- a/sys/dev/sound/pci/hda/hdac.h +++ b/sys/dev/sound/pci/hda/hdac.h @@ -54,6 +54,8 @@ #define HDA_INTEL_PCH HDA_MODEL_CONSTRUCT(INTEL, 0x3b56) #define HDA_INTEL_PCH2 HDA_MODEL_CONSTRUCT(INTEL, 0x3b57) #define HDA_INTEL_SCH HDA_MODEL_CONSTRUCT(INTEL, 0x811b) +#define HDA_INTEL_LPT1 HDA_MODEL_CONSTRUCT(INTEL, 0x8c20) +#define HDA_INTEL_LPT2 HDA_MODEL_CONSTRUCT(INTEL, 0x8c21) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index f32e89a..c62f781 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -1440,26 +1440,37 @@ void xhci_interrupt(struct xhci_softc *sc) { uint32_t status; - uint32_t temp; + uint32_t iman; USB_BUS_LOCK(&sc->sc_bus); status = XREAD4(sc, oper, XHCI_USBSTS); + if (status == 0) + goto done; /* acknowledge interrupts */ XWRITE4(sc, oper, XHCI_USBSTS, status); - temp = XREAD4(sc, runt, XHCI_IMAN(0)); + DPRINTFN(16, "real interrupt (status=0x%08x)\n", status); + + if (status & XHCI_STS_EINT) { - /* acknowledge pending event */ + /* acknowledge pending event */ + iman = XREAD4(sc, runt, XHCI_IMAN(0)); - XWRITE4(sc, runt, XHCI_IMAN(0), temp); + /* reset interrupt */ + XWRITE4(sc, runt, XHCI_IMAN(0), iman); + + DPRINTFN(16, "real interrupt (iman=0x%08x)\n", iman); + + /* check for event(s) */ + xhci_interrupt_poll(sc); + } - DPRINTFN(16, "real interrupt (sts=0x%08x, " - "iman=0x%08x)\n", status, temp); + if (status & (XHCI_STS_PCD | XHCI_STS_HCH | + XHCI_STS_HSE | XHCI_STS_HCE)) { - if (status != 0) { if (status & XHCI_STS_PCD) { xhci_root_intr(sc); } @@ -1479,9 +1490,7 @@ xhci_interrupt(struct xhci_softc *sc) __FUNCTION__); } } - - xhci_interrupt_poll(sc); - +done: USB_BUS_UNLOCK(&sc->sc_bus); } diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index 8f35584..b8f07aa 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -482,6 +482,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { * after issuing non-supported commands: */ USB_QUIRK(ALCOR, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_TEST_UNIT_READY, UQ_MATCH_VENDOR_ONLY), + USB_QUIRK(APPLE, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), USB_QUIRK(FEIYA, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), USB_QUIRK(REALTEK, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), USB_QUIRK(INITIO, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c index 08a64be..dc670d66 100644 --- a/sys/dev/usb/serial/u3g.c +++ b/sys/dev/usb/serial/u3g.c @@ -342,6 +342,7 @@ static const STRUCT_USB_HOST_ID u3g_devs[] = { U3G_DEV(NOVATEL, MC760, 0), U3G_DEV(NOVATEL, MC547, 0), U3G_DEV(NOVATEL, MC950D, 0), + U3G_DEV(NOVATEL, MIFI2200, U3GINIT_SCSIEJECT), U3G_DEV(NOVATEL, U720, 0), U3G_DEV(NOVATEL, U727, 0), U3G_DEV(NOVATEL, U727_2, 0), diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 8a30a6d..0cd43ef 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -1050,6 +1050,7 @@ product AOX USB101 0x0008 Ethernet product APC UPS 0x0002 Uninterruptible Power Supply /* Apple Computer products */ +product APPLE DUMMY 0x0000 Dummy product product APPLE IMAC_KBD 0x0201 USB iMac Keyboard product APPLE KBD 0x0202 USB Keyboard M2452 product APPLE EXT_KBD 0x020c Apple Extended USB Keyboard @@ -3057,6 +3058,7 @@ product NOVATEL U727 0x4100 Merlin U727 CDMA product NOVATEL MC950D 0x4400 Novatel MC950D HSUPA product NOVATEL ZEROCD 0x5010 Novatel ZeroCD product NOVATEL ZEROCD2 0x5030 Novatel ZeroCD +product NOVATEL MIFI2200 0x5041 Novatel MiFi 2200 CDMA product NOVATEL U727_2 0x5100 Merlin U727 CDMA product NOVATEL U760 0x6000 Novatel U760 product NOVATEL MC760 0x6002 Novatel MC760 diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index 3d2577f..3940636 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -2019,7 +2019,8 @@ run_key_set_cb(void *arg) wcid = 0; /* NB: update WCID0 for group keys */ base = RT2860_SKEY(RUN_VAP(vap)->rvp_id, k->wk_keyix); } else { - wcid = RUN_AID2WCID(associd); + wcid = (vap->iv_opmode == IEEE80211_M_STA) ? + 1 : RUN_AID2WCID(associd); base = RT2860_PKEY(wcid); } @@ -2374,9 +2375,12 @@ run_newassoc(struct ieee80211_node *ni, int isnew) struct run_softc *sc = ic->ic_ifp->if_softc; uint8_t rate; uint8_t ridx; - uint8_t wcid = RUN_AID2WCID(ni->ni_associd); + uint8_t wcid; int i, j; + wcid = (vap->iv_opmode == IEEE80211_M_STA) ? + 1 : RUN_AID2WCID(ni->ni_associd); + if (wcid > RT2870_WCID_MAX) { device_printf(sc->sc_dev, "wcid=%d out of range\n", wcid); return; @@ -3044,8 +3048,12 @@ run_tx(struct run_softc *sc, struct mbuf *m, struct ieee80211_node *ni) txd->flags = qflags; txwi = (struct rt2860_txwi *)(txd + 1); txwi->xflags = xflags; - txwi->wcid = IEEE80211_IS_MULTICAST(wh->i_addr1) ? - 0 : RUN_AID2WCID(ni->ni_associd); + if (IEEE80211_IS_MULTICAST(wh->i_addr1)) { + txwi->wcid = 0; + } else { + txwi->wcid = (vap->iv_opmode == IEEE80211_M_STA) ? + 1 : RUN_AID2WCID(ni->ni_associd); + } /* clear leftover garbage bits */ txwi->flags = 0; txwi->txop = 0; diff --git a/sys/dev/wbwd/wbwd.c b/sys/dev/wbwd/wbwd.c index 539d5bb..dfd8f3c 100644 --- a/sys/dev/wbwd/wbwd.c +++ b/sys/dev/wbwd/wbwd.c @@ -1,5 +1,6 @@ /*- * Copyright (c) 2011 Sandvine Incorporated ULC. + * Copyright (c) 2012 iXsystems, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,15 +94,6 @@ __FBSDID("$FreeBSD$"); #define WB_LDN8_CRF7_CLEAR_MASK \ (WB_LDN8_CRF7_MOUSE|WB_LDN8_CRF7_KEYB|WB_LDN8_CRF7_TS|WB_LDN8_CRF7_IRQS) -#define write_efir_1(sc, value) \ - bus_space_write_1((sc)->bst, (sc)->bsh, 0, (value)) -#define read_efir_1(sc) \ - bus_space_read_1((sc)->bst, (sc)->bsh, 0) -#define write_efdr_1(sc, value) \ - bus_space_write_1((sc)->bst, (sc)->bsh, 1, (value)) -#define read_efdr_1(sc) \ - bus_space_read_1((sc)->bst, (sc)->bsh, 1) - struct wb_softc { device_t dev; struct resource *portres; @@ -109,8 +101,8 @@ struct wb_softc { bus_space_handle_t bsh; int rid; eventhandler_tag ev_tag; - int (*ext_cfg_enter_f)(struct wb_softc *); - void (*ext_cfg_exit_f)(struct wb_softc *); + int (*ext_cfg_enter_f)(struct wb_softc *, u_short); + void (*ext_cfg_exit_f)(struct wb_softc *, u_short); int debug_verbose; /* @@ -131,13 +123,13 @@ struct wb_softc { uint8_t reg_2; }; -static int ext_cfg_enter_0x87_0x87(struct wb_softc *); -static void ext_cfg_exit_0xaa(struct wb_softc *); +static int ext_cfg_enter_0x87_0x87(struct wb_softc *, u_short); +static void ext_cfg_exit_0xaa(struct wb_softc *, u_short); struct winbond_superio_cfg { uint8_t efer; /* and efir */ - int (*ext_cfg_enter_f)(struct wb_softc *); - void (*ext_cfg_exit_f)(struct wb_softc *); + int (*ext_cfg_enter_f)(struct wb_softc *, u_short); + void (*ext_cfg_exit_f)(struct wb_softc *, u_short); } probe_addrs[] = { { .efer = 0x2e, @@ -189,6 +181,50 @@ struct winbond_vendor_device_id { }, }; +static void +write_efir_1(struct wb_softc *sc, u_short baseport, uint8_t value) +{ + + MPASS(sc != NULL || baseport != 0); + if (sc != NULL) + bus_space_write_1((sc)->bst, (sc)->bsh, 0, (value)); + else + outb(baseport, value); +} + +static uint8_t __unused +read_efir_1(struct wb_softc *sc, u_short baseport) +{ + + MPASS(sc != NULL || baseport != 0); + if (sc != NULL) + return (bus_space_read_1((sc)->bst, (sc)->bsh, 0)); + else + return (inb(baseport)); +} + +static void +write_efdr_1(struct wb_softc *sc, u_short baseport, uint8_t value) +{ + + MPASS(sc != NULL || baseport != 0); + if (sc != NULL) + bus_space_write_1((sc)->bst, (sc)->bsh, 1, (value)); + else + outb(baseport + 1, value); +} + +static uint8_t +read_efdr_1(struct wb_softc *sc, u_short baseport) +{ + + MPASS(sc != NULL || baseport != 0); + if (sc != NULL) + return (bus_space_read_1((sc)->bst, (sc)->bsh, 1)); + else + return (inb(baseport + 1)); +} + /* * Return the watchdog related registers as we last read them. This will * usually not give the current timeout or state on whether the watchdog @@ -231,19 +267,19 @@ sysctl_wb_debug_current(SYSCTL_HANDLER_ARGS) * Enter extended function mode in case someone else has been * poking on the registers. We will not leave it though. */ - if ((*sc->ext_cfg_enter_f)(sc) != 0) + if ((*sc->ext_cfg_enter_f)(sc, 0) != 0) return (ENXIO); /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog). */ - write_efir_1(sc, WB_LDN_REG); - write_efdr_1(sc, WB_LDN_REG_LDN8); + write_efir_1(sc, 0, WB_LDN_REG); + write_efdr_1(sc, 0, WB_LDN_REG_LDN8); - write_efir_1(sc, WB_LDN8_CRF5); - sc->reg_1 = read_efdr_1(sc); - write_efir_1(sc, WB_LDN8_CRF6); - sc->reg_timeout = read_efdr_1(sc); - write_efir_1(sc, WB_LDN8_CRF7); - sc->reg_2 = read_efdr_1(sc); + write_efir_1(sc, 0, WB_LDN8_CRF5); + sc->reg_1 = read_efdr_1(sc, 0); + write_efir_1(sc, 0, WB_LDN8_CRF6); + sc->reg_timeout = read_efdr_1(sc, 0); + write_efir_1(sc, 0, WB_LDN8_CRF7); + sc->reg_2 = read_efdr_1(sc, 0); return (sysctl_wb_debug(oidp, arg1, arg2, req)); } @@ -288,7 +324,7 @@ sysctl_wb_force_test_nmi(SYSCTL_HANDLER_ARGS) * Enter extended function mode in case someone else has been * poking on the registers. We will not leave it though. */ - if ((*sc->ext_cfg_enter_f)(sc) != 0) + if ((*sc->ext_cfg_enter_f)(sc, 0) != 0) return (ENXIO); #ifdef notyet @@ -301,16 +337,16 @@ sysctl_wb_force_test_nmi(SYSCTL_HANDLER_ARGS) #endif /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog). */ - write_efir_1(sc, WB_LDN_REG); - write_efdr_1(sc, WB_LDN_REG_LDN8); + write_efir_1(sc, 0, WB_LDN_REG); + write_efdr_1(sc, 0, WB_LDN_REG_LDN8); /* Force watchdog to fire. */ - write_efir_1(sc, WB_LDN8_CRF7); - sc->reg_2 = read_efdr_1(sc); + write_efir_1(sc, 0, WB_LDN8_CRF7); + sc->reg_2 = read_efdr_1(sc, 0); sc->reg_2 |= WB_LDN8_CRF7_FORCE; - write_efir_1(sc, WB_LDN8_CRF7); - write_efdr_1(sc, sc->reg_2); + write_efir_1(sc, 0, WB_LDN8_CRF7); + write_efdr_1(sc, 0, sc->reg_2); return (0); } @@ -344,24 +380,24 @@ wb_print_state(struct wb_softc *sc, const char *msg) * between different chips. */ static int -ext_cfg_enter_0x87_0x87(struct wb_softc *sc) +ext_cfg_enter_0x87_0x87(struct wb_softc *sc, u_short baseport) { /* * Enable extended function mode. * Winbond does not allow us to validate so always return success. */ - write_efir_1(sc, 0x87); - write_efir_1(sc, 0x87); + write_efir_1(sc, baseport, 0x87); + write_efir_1(sc, baseport, 0x87); return (0); } static void -ext_cfg_exit_0xaa(struct wb_softc *sc) +ext_cfg_exit_0xaa(struct wb_softc *sc, u_short baseport) { - write_efir_1(sc, 0xaa); + write_efir_1(sc, baseport, 0xaa); } /* @@ -379,22 +415,22 @@ wb_set_watchdog(struct wb_softc *sc, unsigned int timeout) * Enter extended function mode in case someone else has been * poking on the registers. We will not leave it though. */ - if ((*sc->ext_cfg_enter_f)(sc) != 0) + if ((*sc->ext_cfg_enter_f)(sc, 0) != 0) return (ENXIO); /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog) */ - write_efir_1(sc, WB_LDN_REG); - write_efdr_1(sc, WB_LDN_REG_LDN8); + write_efir_1(sc, 0, WB_LDN_REG); + write_efdr_1(sc, 0, WB_LDN_REG_LDN8); /* Disable and validate or arm/reset watchdog. */ if (timeout == 0) { /* Disable watchdog. */ - write_efir_1(sc, WB_LDN8_CRF6); - write_efdr_1(sc, 0x00); + write_efir_1(sc, 0, WB_LDN8_CRF6); + write_efdr_1(sc, 0, 0x00); /* Re-check. */ - write_efir_1(sc, WB_LDN8_CRF6); - sc->reg_timeout = read_efdr_1(sc); + write_efir_1(sc, 0, WB_LDN8_CRF6); + sc->reg_timeout = read_efdr_1(sc, 0); if (sc->reg_timeout != 0x00) { device_printf(sc->dev, "Failed to disable watchdog: " @@ -415,8 +451,8 @@ wb_set_watchdog(struct wb_softc *sc, unsigned int timeout) return (EINVAL); /* Read current scaling factor. */ - write_efir_1(sc, WB_LDN8_CRF5); - sc->reg_1 = read_efdr_1(sc); + write_efir_1(sc, 0, WB_LDN8_CRF5); + sc->reg_1 = read_efdr_1(sc, 0); if (timeout > 255) { /* Set scaling factor to 60s. */ @@ -431,21 +467,21 @@ wb_set_watchdog(struct wb_softc *sc, unsigned int timeout) } /* In case we fired before we need to clear to fire again. */ - write_efir_1(sc, WB_LDN8_CRF7); - sc->reg_2 = read_efdr_1(sc); + write_efir_1(sc, 0, WB_LDN8_CRF7); + sc->reg_2 = read_efdr_1(sc, 0); if (sc->reg_2 & WB_LDN8_CRF7_TS) { sc->reg_2 &= ~WB_LDN8_CRF7_TS; - write_efir_1(sc, WB_LDN8_CRF7); - write_efdr_1(sc, sc->reg_2); + write_efir_1(sc, 0, WB_LDN8_CRF7); + write_efdr_1(sc, 0, sc->reg_2); } /* Write back scaling factor. */ - write_efir_1(sc, WB_LDN8_CRF5); - write_efdr_1(sc, sc->reg_1); + write_efir_1(sc, 0, WB_LDN8_CRF5); + write_efdr_1(sc, 0, sc->reg_1); /* Set timer and arm/reset the watchdog. */ - write_efir_1(sc, WB_LDN8_CRF6); - write_efdr_1(sc, sc->reg_timeout); + write_efir_1(sc, 0, WB_LDN8_CRF6); + write_efdr_1(sc, 0, sc->reg_timeout); } if (sc->debug_verbose) @@ -515,62 +551,71 @@ wb_probe_enable(device_t dev, int probe) int error, found, i, j; uint8_t dev_id, dev_rev, cr26; - sc = device_get_softc(dev); - bzero(sc, sizeof(*sc)); - sc->dev = dev; + if (dev == NULL) + sc = NULL; + else { + sc = device_get_softc(dev); + bzero(sc, sizeof(*sc)); + sc->dev = dev; + } error = ENXIO; for (i = 0; i < sizeof(probe_addrs) / sizeof(*probe_addrs); i++) { - /* Allocate bus resources for IO index/data register access. */ - sc->portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->rid, - probe_addrs[i].efer, probe_addrs[i].efer + 1, 2, RF_ACTIVE); - if (sc->portres == NULL) - continue; - sc->bst = rman_get_bustag(sc->portres); - sc->bsh = rman_get_bushandle(sc->portres); + if (sc != NULL) { + /* Allocate bus resources for IO index/data register access. */ + sc->portres = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->rid, + probe_addrs[i].efer, probe_addrs[i].efer + 1, 2, RF_ACTIVE); + if (sc->portres == NULL) + continue; + sc->bst = rman_get_bustag(sc->portres); + sc->bsh = rman_get_bushandle(sc->portres); + } found = 0; - error = (*probe_addrs[i].ext_cfg_enter_f)(sc); + error = (*probe_addrs[i].ext_cfg_enter_f)(sc, probe_addrs[i].efer); if (error != 0) goto cleanup; /* Identify the SuperIO chip. */ - write_efir_1(sc, WB_DEVICE_ID_REG); - dev_id = read_efdr_1(sc); - write_efir_1(sc, WB_DEVICE_REV_REG); - dev_rev = read_efdr_1(sc); - write_efir_1(sc, WB_CR26); - cr26 = read_efdr_1(sc); + write_efir_1(sc, probe_addrs[i].efer, WB_DEVICE_ID_REG); + dev_id = read_efdr_1(sc, probe_addrs[i].efer); + write_efir_1(sc, probe_addrs[i].efer, WB_DEVICE_REV_REG); + dev_rev = read_efdr_1(sc, probe_addrs[i].efer); + write_efir_1(sc, probe_addrs[i].efer, WB_CR26); + cr26 = read_efdr_1(sc, probe_addrs[i].efer); /* HEFRAS of 0 means EFER at 0x2e, 1 means EFER at 0x4e. */ if (((cr26 & 0x40) == 0x00 && probe_addrs[i].efer != 0x2e) || ((cr26 & 0x40) == 0x40 && probe_addrs[i].efer != 0x4e)) { - device_printf(dev, "HEFRAS and EFER do not align: EFER " - "0x%02x DevID 0x%02x DevRev 0x%02x CR26 0x%02x\n", - probe_addrs[i].efer, dev_id, dev_rev, cr26); + if (dev != NULL) + device_printf(dev, "HEFRAS and EFER do not " + "align: EFER 0x%02x DevID 0x%02x DevRev " + "0x%02x CR26 0x%02x\n", + probe_addrs[i].efer, dev_id, dev_rev, cr26); goto cleanup; } for (j = 0; j < sizeof(wb_devs) / sizeof(*wb_devs); j++) { if (wb_devs[j].device_id == dev_id && wb_devs[j].device_rev == dev_rev) { - if (probe) + if (probe && dev != NULL) device_set_desc(dev, wb_devs[j].descr); found++; break; } } - if (probe && found && bootverbose) + if (probe && found && bootverbose && dev != NULL) device_printf(dev, "%s EFER 0x%02x ID 0x%02x Rev 0x%02x" " CR26 0x%02x (probing)\n", device_get_desc(dev), probe_addrs[i].efer, dev_id, dev_rev, cr26); cleanup: if (probe || !found) { - (*probe_addrs[i].ext_cfg_exit_f)(sc); + (*probe_addrs[i].ext_cfg_exit_f)(sc, probe_addrs[i].efer); - (void) bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, - sc->portres); + if (sc != NULL) + (void) bus_release_resource(dev, SYS_RES_IOPORT, + sc->rid, sc->portres); } /* @@ -579,8 +624,10 @@ cleanup: * for operations. */ if (found) { - sc->ext_cfg_enter_f = probe_addrs[i].ext_cfg_enter_f; - sc->ext_cfg_exit_f = probe_addrs[i].ext_cfg_exit_f; + if (sc != NULL) { + sc->ext_cfg_enter_f = probe_addrs[i].ext_cfg_enter_f; + sc->ext_cfg_exit_f = probe_addrs[i].ext_cfg_exit_f; + } error = BUS_PROBE_DEFAULT; break; } else @@ -590,6 +637,21 @@ cleanup: return (error); } +static void +wb_identify(driver_t *driver, device_t parent) +{ + device_t dev; + + if ((dev = device_find_child(parent, driver->name, 0)) == NULL) { + if (wb_probe_enable(dev, 1) != BUS_PROBE_DEFAULT) { + if (bootverbose) + device_printf(dev, "can not find compatible Winbond chip.\n"); + } else + dev = BUS_ADD_CHILD(parent, 0, driver->name, 0); + return; + } +} + static int wb_probe(device_t dev) { @@ -619,20 +681,20 @@ wb_attach(device_t dev) ("%s: successfull probe result but not setup correctly", __func__)); /* Watchdog is configured as part of LDN 8 (GPIO Port2, Watchdog). */ - write_efir_1(sc, WB_LDN_REG); - write_efdr_1(sc, WB_LDN_REG_LDN8); + write_efir_1(sc, 0, WB_LDN_REG); + write_efdr_1(sc, 0, WB_LDN_REG_LDN8); /* Make sure LDN8 is enabled (Do we need to? Also affects GPIO). */ - write_efir_1(sc, WB_LDN8_CR30); - write_efdr_1(sc, WB_LDN8_CR30_ACTIVE); + write_efir_1(sc, 0, WB_LDN8_CR30); + write_efdr_1(sc, 0, WB_LDN8_CR30_ACTIVE); /* Read the current watchdog configuration. */ - write_efir_1(sc, WB_LDN8_CRF5); - sc->reg_1 = read_efdr_1(sc); - write_efir_1(sc, WB_LDN8_CRF6); - sc->reg_timeout = read_efdr_1(sc); - write_efir_1(sc, WB_LDN8_CRF7); - sc->reg_2 = read_efdr_1(sc); + write_efir_1(sc, 0, WB_LDN8_CRF5); + sc->reg_1 = read_efdr_1(sc, 0); + write_efir_1(sc, 0, WB_LDN8_CRF6); + sc->reg_timeout = read_efdr_1(sc, 0); + write_efir_1(sc, 0, WB_LDN8_CRF7); + sc->reg_2 = read_efdr_1(sc, 0); /* Print current state if bootverbose or watchdog already enabled. */ if (bootverbose || (sc->reg_timeout > 0x00)) @@ -644,12 +706,12 @@ wb_attach(device_t dev) */ sc->reg_1 &= ~(WB_LDN8_CRF5_KEYB_P20); sc->reg_1 |= WB_LDN8_CRF5_KBRST; - write_efir_1(sc, WB_LDN8_CRF5); - write_efdr_1(sc, sc->reg_1); + write_efir_1(sc, 0, WB_LDN8_CRF5); + write_efdr_1(sc, 0, sc->reg_1); sc->reg_2 &= ~WB_LDN8_CRF7_CLEAR_MASK; - write_efir_1(sc, WB_LDN8_CRF7); - write_efdr_1(sc, sc->reg_2); + write_efir_1(sc, 0, WB_LDN8_CRF7); + write_efdr_1(sc, 0, sc->reg_2); /* Read global timeout override tunable, Add per device sysctls. */ if (TUNABLE_ULONG_FETCH("hw.wbwd.timeout_override", &timeout)) { @@ -698,7 +760,7 @@ wb_detach(device_t dev) wb_set_watchdog(sc, 0); /* Disable extended function mode. */ - (*sc->ext_cfg_exit_f)(sc); + (*sc->ext_cfg_exit_f)(sc, 0); /* Cleanup resources. */ (void) bus_release_resource(dev, SYS_RES_IOPORT, sc->rid, sc->portres); @@ -710,11 +772,12 @@ wb_detach(device_t dev) static device_method_t wb_methods[] = { /* Device interface */ + DEVMETHOD(device_identify, wb_identify), DEVMETHOD(device_probe, wb_probe), DEVMETHOD(device_attach, wb_attach), DEVMETHOD(device_detach, wb_detach), - { 0, 0 } + DEVMETHOD_END }; static driver_t wb_isa_driver = { diff --git a/sys/dev/xen/control/control.c b/sys/dev/xen/control/control.c index 63ece1e..18f42bb 100644 --- a/sys/dev/xen/control/control.c +++ b/sys/dev/xen/control/control.c @@ -125,7 +125,6 @@ __FBSDID("$FreeBSD$"); #include <sys/smp.h> #endif - #include <geom/geom.h> #include <machine/_inttypes.h> @@ -145,8 +144,6 @@ __FBSDID("$FreeBSD$"); #include <xen/xenbus/xenbusvar.h> -#define NUM_ELEMENTS(x) (sizeof(x) / sizeof(*(x))) - /*--------------------------- Forward Declarations --------------------------*/ /** Function signature for shutdown event handlers. */ typedef void (xctrl_shutdown_handler_t)(void); @@ -165,7 +162,7 @@ struct xctrl_shutdown_reason { }; /** Lookup table for shutdown event name to handler. */ -static struct xctrl_shutdown_reason xctrl_shutdown_reasons[] = { +static const struct xctrl_shutdown_reason xctrl_shutdown_reasons[] = { { "poweroff", xctrl_poweroff }, { "reboot", xctrl_reboot }, { "suspend", xctrl_suspend }, @@ -198,7 +195,6 @@ extern void xencons_resume(void); static void xctrl_suspend() { - u_int cpuid; int i, j, k, fpp; unsigned long max_pfn, start_info_mfn; @@ -207,6 +203,8 @@ xctrl_suspend() #ifdef SMP struct thread *td; cpuset_t map; + u_int cpuid; + /* * Bind us to CPU 0 and stop any other VCPUs. */ @@ -231,7 +229,7 @@ xctrl_suspend() mtx_lock(&Giant); if (DEVICE_SUSPEND(root_bus) != 0) { mtx_unlock(&Giant); - printf("xen_suspend: device_suspend failed\n"); + printf("%s: device_suspend failed\n", __func__); #ifdef SMP if (!CPU_EMPTY(&map)) restart_cpus(map); @@ -343,9 +341,9 @@ xctrl_suspend() * drivers need this. */ mtx_lock(&Giant); - if (DEVICE_SUSPEND(root_bus)) { + if (DEVICE_SUSPEND(root_bus) != 0) { mtx_unlock(&Giant); - printf("xen_suspend: device_suspend failed\n"); + printf("%s: device_suspend failed\n", __func__); return; } mtx_unlock(&Giant); @@ -396,8 +394,8 @@ xctrl_halt() static void xctrl_on_watch_event(struct xs_watch *watch, const char **vec, unsigned int len) { - struct xctrl_shutdown_reason *reason; - struct xctrl_shutdown_reason *last_reason; + const struct xctrl_shutdown_reason *reason; + const struct xctrl_shutdown_reason *last_reason; char *result; int error; int result_len; @@ -408,7 +406,7 @@ xctrl_on_watch_event(struct xs_watch *watch, const char **vec, unsigned int len) return; reason = xctrl_shutdown_reasons; - last_reason = reason + NUM_ELEMENTS(xctrl_shutdown_reasons); + last_reason = reason + nitems(xctrl_shutdown_reasons); while (reason < last_reason) { if (!strcmp(result, reason->name)) { @@ -511,10 +509,10 @@ static device_method_t xctrl_methods[] = { DEVMETHOD(device_attach, xctrl_attach), DEVMETHOD(device_detach, xctrl_detach), - { 0, 0 } + DEVMETHOD_END }; DEFINE_CLASS_0(xctrl, xctrl_driver, xctrl_methods, sizeof(struct xctrl_softc)); devclass_t xctrl_devclass; -DRIVER_MODULE(xctrl, xenstore, xctrl_driver, xctrl_devclass, 0, 0); +DRIVER_MODULE(xctrl, xenstore, xctrl_driver, xctrl_devclass, NULL, NULL); diff --git a/sys/dev/xen/evtchn/evtchn_dev.c b/sys/dev/xen/evtchn/evtchn_dev.c deleted file mode 100644 index 6925a22..0000000 --- a/sys/dev/xen/evtchn/evtchn_dev.c +++ /dev/null @@ -1,394 +0,0 @@ -/****************************************************************************** - * evtchn.c - * - * Xenolinux driver for receiving and demuxing event-channel signals. - * - * Copyright (c) 2004, K A Fraser - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/uio.h> -#include <sys/bus.h> -#include <sys/malloc.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/selinfo.h> -#include <sys/poll.h> -#include <sys/conf.h> -#include <sys/fcntl.h> -#include <sys/ioccom.h> - -#include <machine/cpufunc.h> -#include <machine/intr_machdep.h> -#include <machine/xen-os.h> -#include <xen/xen_intr.h> -#include <machine/bus.h> -#include <sys/rman.h> -#include <machine/resource.h> -#include <machine/synch_bitops.h> - -#include <xen/hypervisor.h> - - -typedef struct evtchn_sotfc { - - struct selinfo ev_rsel; -} evtchn_softc_t; - - -#ifdef linuxcrap -/* NB. This must be shared amongst drivers if more things go in /dev/xen */ -static devfs_handle_t xen_dev_dir; -#endif - -/* Only one process may open /dev/xen/evtchn at any time. */ -static unsigned long evtchn_dev_inuse; - -/* Notification ring, accessed via /dev/xen/evtchn. */ - -#define EVTCHN_RING_SIZE 2048 /* 2048 16-bit entries */ - -#define EVTCHN_RING_MASK(_i) ((_i)&(EVTCHN_RING_SIZE-1)) -static uint16_t *ring; -static unsigned int ring_cons, ring_prod, ring_overflow; - -/* Which ports is user-space bound to? */ -static uint32_t bound_ports[32]; - -/* Unique address for processes to sleep on */ -static void *evtchn_waddr = ˚ - -static struct mtx lock, upcall_lock; - -static d_read_t evtchn_read; -static d_write_t evtchn_write; -static d_ioctl_t evtchn_ioctl; -static d_poll_t evtchn_poll; -static d_open_t evtchn_open; -static d_close_t evtchn_close; - - -void -evtchn_device_upcall(int port) -{ - mtx_lock(&upcall_lock); - - mask_evtchn(port); - clear_evtchn(port); - - if ( ring != NULL ) { - if ( (ring_prod - ring_cons) < EVTCHN_RING_SIZE ) { - ring[EVTCHN_RING_MASK(ring_prod)] = (uint16_t)port; - if ( ring_cons == ring_prod++ ) { - wakeup(evtchn_waddr); - } - } - else { - ring_overflow = 1; - } - } - - mtx_unlock(&upcall_lock); -} - -static void -__evtchn_reset_buffer_ring(void) -{ - /* Initialise the ring to empty. Clear errors. */ - ring_cons = ring_prod = ring_overflow = 0; -} - -static int -evtchn_read(struct cdev *dev, struct uio *uio, int ioflag) -{ - int rc; - unsigned int count, c, p, sst = 0, bytes1 = 0, bytes2 = 0; - count = uio->uio_resid; - - count &= ~1; /* even number of bytes */ - - if ( count == 0 ) - { - rc = 0; - goto out; - } - - if ( count > PAGE_SIZE ) - count = PAGE_SIZE; - - for ( ; ; ) { - if ( (c = ring_cons) != (p = ring_prod) ) - break; - - if ( ring_overflow ) { - rc = EFBIG; - goto out; - } - - if (sst != 0) { - rc = EINTR; - goto out; - } - - /* PCATCH == check for signals before and after sleeping - * PWAIT == priority of waiting on resource - */ - sst = tsleep(evtchn_waddr, PWAIT|PCATCH, "evchwt", 10); - } - - /* Byte lengths of two chunks. Chunk split (if any) is at ring wrap. */ - if ( ((c ^ p) & EVTCHN_RING_SIZE) != 0 ) { - bytes1 = (EVTCHN_RING_SIZE - EVTCHN_RING_MASK(c)) * sizeof(uint16_t); - bytes2 = EVTCHN_RING_MASK(p) * sizeof(uint16_t); - } - else { - bytes1 = (p - c) * sizeof(uint16_t); - bytes2 = 0; - } - - /* Truncate chunks according to caller's maximum byte count. */ - if ( bytes1 > count ) { - bytes1 = count; - bytes2 = 0; - } - else if ( (bytes1 + bytes2) > count ) { - bytes2 = count - bytes1; - } - - if ( uiomove(&ring[EVTCHN_RING_MASK(c)], bytes1, uio) || - ((bytes2 != 0) && uiomove(&ring[0], bytes2, uio))) - /* keeping this around as its replacement is not equivalent - * copyout(&ring[0], &buf[bytes1], bytes2) - */ - { - rc = EFAULT; - goto out; - } - - ring_cons += (bytes1 + bytes2) / sizeof(uint16_t); - - rc = bytes1 + bytes2; - - out: - - return rc; -} - -static int -evtchn_write(struct cdev *dev, struct uio *uio, int ioflag) -{ - int rc, i, count; - - count = uio->uio_resid; - - uint16_t *kbuf = (uint16_t *)malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK); - - - if ( kbuf == NULL ) - return ENOMEM; - - count &= ~1; /* even number of bytes */ - - if ( count == 0 ) { - rc = 0; - goto out; - } - - if ( count > PAGE_SIZE ) - count = PAGE_SIZE; - - if ( uiomove(kbuf, count, uio) != 0 ) { - rc = EFAULT; - goto out; - } - - mtx_lock_spin(&lock); - for ( i = 0; i < (count/2); i++ ) - if ( test_bit(kbuf[i], &bound_ports[0]) ) - unmask_evtchn(kbuf[i]); - mtx_unlock_spin(&lock); - - rc = count; - - out: - free(kbuf, M_DEVBUF); - return rc; -} - -static int -evtchn_ioctl(struct cdev *dev, unsigned long cmd, caddr_t arg, - int mode, struct thread *td __unused) -{ - int rc = 0; - - mtx_lock_spin(&lock); - - switch ( cmd ) - { - case EVTCHN_RESET: - __evtchn_reset_buffer_ring(); - break; - case EVTCHN_BIND: - if ( !synch_test_and_set_bit((int)arg, &bound_ports[0]) ) - unmask_evtchn((int)arg); - else - rc = EINVAL; - break; - case EVTCHN_UNBIND: - if ( synch_test_and_clear_bit((int)arg, &bound_ports[0]) ) - mask_evtchn((int)arg); - else - rc = EINVAL; - break; - default: - rc = ENOSYS; - break; - } - - mtx_unlock_spin(&lock); - - return rc; -} - -static int -evtchn_poll(struct cdev *dev, int poll_events, struct thread *td) -{ - - evtchn_softc_t *sc; - unsigned int mask = POLLOUT | POLLWRNORM; - - sc = dev->si_drv1; - - if ( ring_cons != ring_prod ) - mask |= POLLIN | POLLRDNORM; - else if ( ring_overflow ) - mask = POLLERR; - else - selrecord(td, &sc->ev_rsel); - - - return mask; -} - - -static int -evtchn_open(struct cdev *dev, int flag, int otyp, struct thread *td) -{ - uint16_t *_ring; - - if (flag & O_NONBLOCK) - return EBUSY; - - if ( synch_test_and_set_bit(0, &evtchn_dev_inuse) ) - return EBUSY; - - if ( (_ring = (uint16_t *)malloc(PAGE_SIZE, M_DEVBUF, M_WAITOK)) == NULL ) - return ENOMEM; - - mtx_lock_spin(&lock); - ring = _ring; - __evtchn_reset_buffer_ring(); - mtx_unlock_spin(&lock); - - - return 0; -} - -static int -evtchn_close(struct cdev *dev, int flag, int otyp, struct thread *td __unused) -{ - int i; - - mtx_lock_spin(&lock); - if (ring != NULL) { - free(ring, M_DEVBUF); - ring = NULL; - } - for ( i = 0; i < NR_EVENT_CHANNELS; i++ ) - if ( synch_test_and_clear_bit(i, &bound_ports[0]) ) - mask_evtchn(i); - mtx_unlock_spin(&lock); - - evtchn_dev_inuse = 0; - - return 0; -} - -static struct cdevsw evtchn_devsw = { - d_version: D_VERSION, - d_open: evtchn_open, - d_close: evtchn_close, - d_read: evtchn_read, - d_write: evtchn_write, - d_ioctl: evtchn_ioctl, - d_poll: evtchn_poll, - d_name: "evtchn", - d_flags: 0, -}; - - -/* XXX - if this device is ever supposed to support use by more than one process - * this global static will have to go away - */ -static struct cdev *evtchn_dev; - - - -static int -evtchn_init(void *dummy __unused) -{ - /* XXX I believe we don't need these leaving them here for now until we - * have some semblance of it working - */ - mtx_init(&upcall_lock, "evtchup", NULL, MTX_DEF); - - /* (DEVFS) create '/dev/misc/evtchn'. */ - evtchn_dev = make_dev(&evtchn_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "xen/evtchn"); - - mtx_init(&lock, "evch", NULL, MTX_SPIN | MTX_NOWITNESS); - - evtchn_dev->si_drv1 = malloc(sizeof(evtchn_softc_t), M_DEVBUF, M_WAITOK); - bzero(evtchn_dev->si_drv1, sizeof(evtchn_softc_t)); - - /* XXX I don't think we need any of this rubbish */ -#if 0 - if ( err != 0 ) - { - printk(KERN_ALERT "Could not register /dev/misc/evtchn\n"); - return err; - } - - /* (DEVFS) create directory '/dev/xen'. */ - xen_dev_dir = devfs_mk_dir(NULL, "xen", NULL); - - /* (DEVFS) &link_dest[pos] == '../misc/evtchn'. */ - pos = devfs_generate_path(evtchn_miscdev.devfs_handle, - &link_dest[3], - sizeof(link_dest) - 3); - if ( pos >= 0 ) - strncpy(&link_dest[pos], "../", 3); - /* (DEVFS) symlink '/dev/xen/evtchn' -> '../misc/evtchn'. */ - (void)devfs_mk_symlink(xen_dev_dir, - "evtchn", - DEVFS_FL_DEFAULT, - &link_dest[pos], - &symlink_handle, - NULL); - - /* (DEVFS) automatically destroy the symlink with its destination. */ - devfs_auto_unregister(evtchn_miscdev.devfs_handle, symlink_handle); -#endif - printk("Event-channel device installed.\n"); - - return 0; -} - - -SYSINIT(evtchn_init, SI_SUB_DRIVERS, SI_ORDER_FIRST, evtchn_init, NULL); - - diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c index 856c988..88641e3 100644 --- a/sys/dev/xen/netfront/netfront.c +++ b/sys/dev/xen/netfront/netfront.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. */ - #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); @@ -208,8 +207,6 @@ struct xn_chain_data { struct mbuf *xn_rx_chain[NET_RX_RING_SIZE+1]; }; -#define NUM_ELEMENTS(x) (sizeof(x)/sizeof(*x)) - struct net_device_stats { u_long rx_packets; /* total packets received */ @@ -244,7 +241,6 @@ struct net_device_stats }; struct netfront_info { - struct ifnet *xn_ifp; #if __FreeBSD_version >= 700000 struct lro_ctrl xn_lro; @@ -329,12 +325,6 @@ struct netfront_rx_info { /* Access macros for acquiring freeing slots in xn_free_{tx,rx}_idxs[]. */ - - -/* - * Access macros for acquiring freeing slots in tx_skbs[]. - */ - static inline void add_id_to_freelist(struct mbuf **list, uintptr_t id) { @@ -517,7 +507,6 @@ netfront_resume(device_t dev) return (0); } - /* Common code used when first setting up, and when resuming. */ static int talk_to_backend(device_t dev, struct netfront_info *info) @@ -605,7 +594,6 @@ talk_to_backend(device_t dev, struct netfront_info *info) return err; } - static int setup_device(device_t dev, struct netfront_info *info) { @@ -794,7 +782,7 @@ netif_release_tx_bufs(struct netfront_info *np) add_id_to_freelist(np->tx_mbufs, i); np->xn_cdata.xn_tx_chain_cnt--; if (np->xn_cdata.xn_tx_chain_cnt < 0) { - panic("netif_release_tx_bufs: tx_chain_cnt must be >= 0"); + panic("%s: tx_chain_cnt must be >= 0", __func__); } m_free(m); } @@ -946,7 +934,6 @@ refill: reservation.domid = DOMID_SELF; if (!xen_feature(XENFEAT_auto_translated_physmap)) { - /* After all PTEs have been zapped, flush the TLB. */ sc->rx_mcl[i-1].args[MULTI_UVMFLAGS_INDEX] = UVMF_TLB_FLUSH|UVMF_ALL; @@ -958,15 +945,11 @@ refill: /* Zap PTEs and give away pages in one big multicall. */ (void)HYPERVISOR_multicall(sc->rx_mcl, i+1); - /* Check return status of HYPERVISOR_dom_mem_op(). */ - if (unlikely(sc->rx_mcl[i].result != i)) - panic("Unable to reduce memory reservation\n"); - } else { - if (HYPERVISOR_memory_op( - XENMEM_decrease_reservation, &reservation) - != i) - panic("Unable to reduce memory " - "reservation\n"); + if (unlikely(sc->rx_mcl[i].result != i || + HYPERVISOR_memory_op(XENMEM_decrease_reservation, + &reservation) != i)) + panic("%s: unable to reduce memory " + "reservation\n", __func__); } } else { wmb(); @@ -1169,8 +1152,8 @@ xn_txeof(struct netfront_info *np) ifp->if_opackets++; if (unlikely(gnttab_query_foreign_access( np->grant_tx_ref[id]) != 0)) { - panic("grant id %u still in use by the backend", - id); + panic("%s: grant id %u still in use by the " + "backend", __func__, id); } gnttab_end_foreign_access_ref( np->grant_tx_ref[id]); @@ -1210,7 +1193,6 @@ xn_txeof(struct netfront_info *np) netif_wake_queue(dev); #endif } - } static void @@ -1240,7 +1222,6 @@ xn_intr(void *xsc) xn_start(ifp); } - static void xennet_move_rx_slot(struct netfront_info *np, struct mbuf *m, grant_ref_t ref) @@ -1319,17 +1300,15 @@ xennet_get_responses(struct netfront_info *np, m0 = m = m_prev = xennet_get_rx_mbuf(np, *cons); - if (rx->flags & NETRXF_extra_info) { err = xennet_get_extras(np, extras, rp, cons); } - if (m0 != NULL) { m0->m_pkthdr.len = 0; m0->m_next = NULL; } - + for (;;) { u_long mfn; @@ -1468,10 +1447,8 @@ xn_tick_locked(struct netfront_info *sc) callout_reset(&sc->xn_stat_ch, hz, xn_tick, sc); /* XXX placeholder for printing debug information */ - } - static void xn_tick(void *xsc) { @@ -1481,7 +1458,6 @@ xn_tick(void *xsc) XN_RX_LOCK(sc); xn_tick_locked(sc); XN_RX_UNLOCK(sc); - } /** @@ -1595,10 +1571,12 @@ xn_assemble_tx_request(struct netfront_info *sc, struct mbuf *m_head) tx = RING_GET_REQUEST(&sc->tx, sc->tx.req_prod_pvt); id = get_id_from_freelist(sc->tx_mbufs); if (id == 0) - panic("xn_start_locked: was allocated the freelist head!\n"); + panic("%s: was allocated the freelist head!\n", + __func__); sc->xn_cdata.xn_tx_chain_cnt++; if (sc->xn_cdata.xn_tx_chain_cnt > NET_TX_RING_SIZE) - panic("xn_start_locked: tx_chain_cnt must be <= NET_TX_RING_SIZE\n"); + panic("%s: tx_chain_cnt must be <= NET_TX_RING_SIZE\n", + __func__); sc->tx_mbufs[id] = m; tx->id = id; ref = gnttab_claim_grant_reference(&sc->gref_tx_head); @@ -1710,7 +1688,6 @@ xn_start_locked(struct ifnet *ifp) } } - static void xn_start(struct ifnet *ifp) { @@ -1744,10 +1721,8 @@ xn_ifinit_locked(struct netfront_info *sc) if_link_state_change(ifp, LINK_STATE_UP); callout_reset(&sc->xn_stat_ch, hz, xn_tick, sc); - } - static void xn_ifinit(void *xsc) { @@ -1756,10 +1731,8 @@ xn_ifinit(void *xsc) XN_LOCK(sc); xn_ifinit_locked(sc); XN_UNLOCK(sc); - } - static int xn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { @@ -2261,7 +2234,7 @@ static device_method_t netfront_methods[] = { /* Xenbus interface */ DEVMETHOD(xenbus_otherend_changed, netfront_backend_changed), - { 0, 0 } + DEVMETHOD_END }; static driver_t netfront_driver = { @@ -2271,4 +2244,5 @@ static driver_t netfront_driver = { }; devclass_t netfront_devclass; -DRIVER_MODULE(xe, xenbusb_front, netfront_driver, netfront_devclass, 0, 0); +DRIVER_MODULE(xe, xenbusb_front, netfront_driver, netfront_devclass, NULL, + NULL); diff --git a/sys/dev/xen/xenpci/machine_reboot.c b/sys/dev/xen/xenpci/machine_reboot.c deleted file mode 100644 index 4036554..0000000 --- a/sys/dev/xen/xenpci/machine_reboot.c +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * Copyright (c) 2008 Citrix Systems, Inc. - * All rights reserved. - * - * 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. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/bus.h> -#include <sys/kernel.h> -#include <sys/interrupt.h> - -#include <machine/atomic.h> -#include <machine/xen/xen-os.h> -#include <xen/hypervisor.h> -#include <xen/xen_intr.h> - -#include <dev/xen/xenpci/xenpcivar.h> - -void -xen_suspend() -{ - int suspend_cancelled; - - if (DEVICE_SUSPEND(root_bus)) { - printf("xen_suspend: device_suspend failed\n"); - return; - } - - /* - * Make sure we don't change cpus or switch to some other - * thread. for the duration. - */ - critical_enter(); - - /* - * Prevent any races with evtchn_interrupt() handler. - */ - irq_suspend(); - disable_intr(); - - suspend_cancelled = HYPERVISOR_suspend(0); - if (!suspend_cancelled) - xenpci_resume(); - - /* - * Re-enable interrupts and put the scheduler back to normal. - */ - enable_intr(); - critical_exit(); - - /* - * FreeBSD really needs to add DEVICE_SUSPEND_CANCEL or - * similar. - */ - if (!suspend_cancelled) - DEVICE_RESUME(root_bus); -} diff --git a/sys/fs/ext2fs/ext2_dinode.h b/sys/fs/ext2fs/ext2_dinode.h index 9a87fc4..7d97bb8 100755 --- a/sys/fs/ext2fs/ext2_dinode.h +++ b/sys/fs/ext2fs/ext2_dinode.h @@ -29,8 +29,6 @@ #ifndef _FS_EXT2FS_EXT2_DINODE_H_ #define _FS_EXT2FS_EXT2_DINODE_H_ -#define e2di_size_high e2di_dacl - /* * Special inode numbers * The root inode is the root of the file system. Inode 0 can't be used for @@ -87,11 +85,11 @@ struct ext2fs_dinode { uint16_t e2di_mode; /* 0: IFMT, permissions; see below. */ uint16_t e2di_uid; /* 2: Owner UID */ - uint32_t e2di_size; /* 4: Size (in bytes) */ - uint32_t e2di_atime; /* 8: Access time */ - uint32_t e2di_ctime; /* 12: Change time */ - uint32_t e2di_mtime; /* 16: Modification time */ - uint32_t e2di_dtime; /* 20: Deletion time */ + uint32_t e2di_size; /* 4: Size (in bytes) */ + uint32_t e2di_atime; /* 8: Access time */ + uint32_t e2di_ctime; /* 12: Change time */ + uint32_t e2di_mtime; /* 16: Modification time */ + uint32_t e2di_dtime; /* 20: Deletion time */ uint16_t e2di_gid; /* 24: Owner GID */ uint16_t e2di_nlink; /* 26: File link count */ uint32_t e2di_nblock; /* 28: Blocks count */ @@ -99,22 +97,23 @@ struct ext2fs_dinode { uint32_t e2di_version; /* 36: Low 32 bits inode version */ uint32_t e2di_blocks[EXT2_N_BLOCKS]; /* 40: disk blocks */ uint32_t e2di_gen; /* 100: generation number */ - uint32_t e2di_facl; /* 104: file ACL (not implemented) */ - uint32_t e2di_dacl; /* 108: dir ACL (not implemented) */ - uint32_t e2di_faddr; /* 112: fragment address */ + uint32_t e2di_facl; /* 104: Low EA block */ + uint32_t e2di_size_high; /* 108: Upper bits of file size */ + uint32_t e2di_faddr; /* 112: Fragment address (obsolete) */ uint16_t e2di_nblock_high; /* 116: Blocks count bits 47:32 */ - uint16_t e2di_facl_high; /* 118: file ACL bits 47:32 */ + uint16_t e2di_facl_high; /* 118: File EA bits 47:32 */ uint16_t e2di_uid_high; /* 120: Owner UID top 16 bits */ uint16_t e2di_gid_high; /* 122: Owner GID top 16 bits */ - uint32_t e2di_linux_reserved3; /* 124 */ - uint16_t e2di_extra_isize; - uint16_t e2di_pad1; - uint32_t e2di_ctime_extra; /* Extra change time */ - uint32_t e2di_mtime_extra; /* Extra modification time */ - uint32_t e2di_atime_extra; /* Extra access time */ - uint32_t e2di_crtime; /* Creation (birth)time */ - uint32_t e2di_crtime_extra; /* Extra creation (birth)time */ - uint32_t e2di_version_hi; /* High 30 bits of inode version */ + uint16_t e2di_chksum_lo; /* 124: Lower inode checksum */ + uint16_t e2di_lx_reserved; /* 126: Unused */ + uint16_t e2di_extra_isize; /* 128: Size of this inode */ + uint16_t e2di_chksum_hi; /* 130: High inode checksum */ + uint32_t e2di_ctime_extra; /* 132: Extra change time */ + uint32_t e2di_mtime_extra; /* 136: Extra modification time */ + uint32_t e2di_atime_extra; /* 140: Extra access time */ + uint32_t e2di_crtime; /* 144: Creation (birth)time */ + uint32_t e2di_crtime_extra; /* 148: Extra creation (birth)time */ + uint32_t e2di_version_hi; /* 152: High bits of inode version */ }; #endif /* !_FS_EXT2FS_EXT2_DINODE_H_ */ diff --git a/sys/fs/fuse/fuse_io.c b/sys/fs/fuse/fuse_io.c index 5b71a6b..e576568 100644 --- a/sys/fs/fuse/fuse_io.c +++ b/sys/fs/fuse/fuse_io.c @@ -113,7 +113,7 @@ fuse_write_directbackend(struct vnode *vp, struct uio *uio, struct ucred *cred, struct fuse_filehandle *fufh); static int fuse_write_biobackend(struct vnode *vp, struct uio *uio, - struct ucred *cred, struct fuse_filehandle *fufh); + struct ucred *cred, struct fuse_filehandle *fufh, int ioflag); int fuse_io_dispatch(struct vnode *vp, struct uio *uio, int ioflag, @@ -162,7 +162,7 @@ fuse_io_dispatch(struct vnode *vp, struct uio *uio, int ioflag, } else { FS_DEBUG("buffered write of vnode %ju\n", (uintmax_t)VTOILLU(vp)); - err = fuse_write_biobackend(vp, uio, cred, fufh); + err = fuse_write_biobackend(vp, uio, cred, fufh, ioflag); } break; default: @@ -371,7 +371,7 @@ fuse_write_directbackend(struct vnode *vp, struct uio *uio, static int fuse_write_biobackend(struct vnode *vp, struct uio *uio, - struct ucred *cred, struct fuse_filehandle *fufh) + struct ucred *cred, struct fuse_filehandle *fufh, int ioflag) { struct fuse_vnode_data *fvdat = VTOFUD(vp); struct buf *bp; @@ -390,6 +390,8 @@ fuse_write_biobackend(struct vnode *vp, struct uio *uio, return (EINVAL); if (uio->uio_resid == 0) return (0); + if (ioflag & IO_APPEND) + uio_setoffset(uio, fvdat->filesize); /* * Find all of this file's B_NEEDCOMMIT buffers. If our writes diff --git a/sys/fs/nandfs/nandfs_segment.c b/sys/fs/nandfs/nandfs_segment.c index 836bead..7433e77 100644 --- a/sys/fs/nandfs/nandfs_segment.c +++ b/sys/fs/nandfs/nandfs_segment.c @@ -478,39 +478,19 @@ nandfs_iterate_dirty_vnodes(struct mount *mp, struct nandfs_seginfo *seginfo) struct nandfs_node *nandfs_node; struct vnode *vp, *mvp; struct thread *td; - int error, lockreq, update; + int error, update; td = curthread; - lockreq = LK_EXCLUSIVE | LK_INTERLOCK | LK_RETRY; - MNT_ILOCK(mp); - - MNT_VNODE_FOREACH(vp, mp, mvp) { + MNT_VNODE_FOREACH_ACTIVE(vp, mp, mvp) { update = 0; - if (mp->mnt_syncer == vp) - continue; - if (VOP_ISLOCKED(vp)) - continue; - - VI_LOCK(vp); - MNT_IUNLOCK(mp); - if (vp->v_iflag & VI_DOOMED) { + if (mp->mnt_syncer == vp || VOP_ISLOCKED(vp)) { VI_UNLOCK(vp); - MNT_ILOCK(mp); - continue; - } - - if ((error = vget(vp, lockreq, td)) != 0) { - MNT_ILOCK(mp); continue; } - - if (vp->v_iflag & VI_DOOMED) { - vput(vp); - MNT_ILOCK(mp); + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK | LK_NOWAIT, td) != 0) continue; - } nandfs_node = VTON(vp); if (nandfs_node->nn_flags & IN_MODIFIED) { @@ -532,12 +512,8 @@ nandfs_iterate_dirty_vnodes(struct mount *mp, struct nandfs_seginfo *seginfo) if (update) nandfs_node_update(nandfs_node); - - MNT_ILOCK(mp); } - MNT_IUNLOCK(mp); - return (0); } diff --git a/sys/fs/nullfs/null.h b/sys/fs/nullfs/null.h index 0878e55..4f37020 100644 --- a/sys/fs/nullfs/null.h +++ b/sys/fs/nullfs/null.h @@ -34,9 +34,15 @@ * $FreeBSD$ */ +#ifndef FS_NULL_H +#define FS_NULL_H + +#define NULLM_CACHE 0x0001 + struct null_mount { struct mount *nullm_vfs; struct vnode *nullm_rootvp; /* Reference to root null_node */ + uint64_t nullm_flags; }; #ifdef _KERNEL @@ -80,3 +86,5 @@ MALLOC_DECLARE(M_NULLFSNODE); #endif /* NULLFS_DEBUG */ #endif /* _KERNEL */ + +#endif diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index b2c7a75..0b72249 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -224,6 +224,9 @@ null_nodeget(mp, lowervp, vpp) * provide ready to use vnode. */ if (VOP_ISLOCKED(lowervp) != LK_EXCLUSIVE) { + KASSERT((MOUNTTONULLMOUNT(mp)->nullm_flags & NULLM_CACHE) != 0, + ("lowervp %p is not excl locked and cache is disabled", + lowervp)); vn_lock(lowervp, LK_UPGRADE | LK_RETRY); if ((lowervp->v_iflag & VI_DOOMED) != 0) { vput(lowervp); diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 7d84d51..5abfa49 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -67,6 +67,15 @@ static vfs_vget_t nullfs_vget; static vfs_extattrctl_t nullfs_extattrctl; static vfs_reclaim_lowervp_t nullfs_reclaim_lowervp; +/* Mount options that we support. */ +static const char *nullfs_opts[] = { + "cache", + "export", + "from", + "target", + NULL +}; + /* * Mount null layer */ @@ -86,9 +95,11 @@ nullfs_mount(struct mount *mp) if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_NULLFS)) return (EPERM); - if (mp->mnt_flag & MNT_ROOTFS) return (EOPNOTSUPP); + if (vfs_filteropt(mp->mnt_optnew, nullfs_opts)) + return (EINVAL); + /* * Update is a no-op */ @@ -149,7 +160,7 @@ nullfs_mount(struct mount *mp) } xmp = (struct null_mount *) malloc(sizeof(struct null_mount), - M_NULLFSMNT, M_WAITOK); + M_NULLFSMNT, M_WAITOK | M_ZERO); /* * Save reference to underlying FS @@ -187,16 +198,27 @@ nullfs_mount(struct mount *mp) mp->mnt_flag |= MNT_LOCAL; MNT_IUNLOCK(mp); } + + xmp->nullm_flags |= NULLM_CACHE; + if (vfs_getopt(mp->mnt_optnew, "nocache", NULL, NULL) == 0) + xmp->nullm_flags &= ~NULLM_CACHE; + MNT_ILOCK(mp); - mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & - (MNTK_SHARED_WRITES | MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED); + if ((xmp->nullm_flags & NULLM_CACHE) != 0) { + mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & + (MNTK_SHARED_WRITES | MNTK_LOOKUP_SHARED | + MNTK_EXTENDED_SHARED); + } mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT; MNT_IUNLOCK(mp); mp->mnt_data = xmp; vfs_getnewfsid(mp); - MNT_ILOCK(xmp->nullm_vfs); - TAILQ_INSERT_TAIL(&xmp->nullm_vfs->mnt_uppers, mp, mnt_upper_link); - MNT_IUNLOCK(xmp->nullm_vfs); + if ((xmp->nullm_flags & NULLM_CACHE) != 0) { + MNT_ILOCK(xmp->nullm_vfs); + TAILQ_INSERT_TAIL(&xmp->nullm_vfs->mnt_uppers, mp, + mnt_upper_link); + MNT_IUNLOCK(xmp->nullm_vfs); + } vfs_mountedfrom(mp, target); @@ -234,13 +256,15 @@ nullfs_unmount(mp, mntflags) */ mntdata = mp->mnt_data; ump = mntdata->nullm_vfs; - MNT_ILOCK(ump); - while ((ump->mnt_kern_flag & MNTK_VGONE_UPPER) != 0) { - ump->mnt_kern_flag |= MNTK_VGONE_WAITER; - msleep(&ump->mnt_uppers, &ump->mnt_mtx, 0, "vgnupw", 0); + if ((mntdata->nullm_flags & NULLM_CACHE) != 0) { + MNT_ILOCK(ump); + while ((ump->mnt_kern_flag & MNTK_VGONE_UPPER) != 0) { + ump->mnt_kern_flag |= MNTK_VGONE_WAITER; + msleep(&ump->mnt_uppers, &ump->mnt_mtx, 0, "vgnupw", 0); + } + TAILQ_REMOVE(&ump->mnt_uppers, mp, mnt_upper_link); + MNT_IUNLOCK(ump); } - TAILQ_REMOVE(&ump->mnt_uppers, mp, mnt_upper_link); - MNT_IUNLOCK(ump); mp->mnt_data = NULL; free(mntdata, M_NULLFSMNT); return (0); diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index f530ed2..cc35d81 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -692,7 +692,22 @@ null_unlock(struct vop_unlock_args *ap) static int null_inactive(struct vop_inactive_args *ap __unused) { + struct vnode *vp; + struct mount *mp; + struct null_mount *xmp; + vp = ap->a_vp; + mp = vp->v_mount; + xmp = MOUNTTONULLMOUNT(mp); + if ((xmp->nullm_flags & NULLM_CACHE) == 0) { + /* + * If this is the last reference and caching of the + * nullfs vnodes is not enabled, then free up the + * vnode so as not to tie up the lower vnodes. + */ + vp->v_object = NULL; + vrecycle(vp); + } return (0); } diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index 1c6d714..8073c64 100644 --- a/sys/fs/tmpfs/tmpfs.h +++ b/sys/fs/tmpfs/tmpfs.h @@ -49,6 +49,7 @@ /* --------------------------------------------------------------------- */ #include <sys/malloc.h> #include <sys/systm.h> +#include <sys/tree.h> #include <sys/vmmeter.h> #include <vm/swap_pager.h> @@ -60,104 +61,81 @@ MALLOC_DECLARE(M_TMPFSNAME); /* * Internal representation of a tmpfs directory entry. */ + +LIST_HEAD(tmpfs_dir_duphead, tmpfs_dirent); + struct tmpfs_dirent { - TAILQ_ENTRY(tmpfs_dirent) td_entries; + /* + * Depending on td_cookie flag entry can be of 3 types: + * - regular -- no hash collisions, stored in RB-Tree + * - duphead -- synthetic linked list head for dup entries + * - dup -- stored in linked list instead of RB-Tree + */ + union { + /* regular and duphead entry types */ + RB_ENTRY(tmpfs_dirent) td_entries; - /* Length of the name stored in this directory entry. This avoids - * the need to recalculate it every time the name is used. */ - uint16_t td_namelen; + /* dup entry type */ + struct { + LIST_ENTRY(tmpfs_dirent) entries; + LIST_ENTRY(tmpfs_dirent) index_entries; + } td_dup; + } uh; - /* The name of the entry, allocated from a string pool. This - * string is not required to be zero-terminated; therefore, the - * td_namelen field must always be used when accessing its value. */ - char * td_name; + uint32_t td_cookie; + uint32_t td_hash; + u_int td_namelen; /* Pointer to the node this entry refers to. In case this field * is NULL, the node is a whiteout. */ struct tmpfs_node * td_node; + + union { + /* + * The name of the entry, allocated from a string pool. This + * string is not required to be zero-terminated. + */ + char * td_name; /* regular, dup */ + struct tmpfs_dir_duphead td_duphead; /* duphead */ + } ud; }; -/* A directory in tmpfs holds a sorted list of directory entries, which in +/* A directory in tmpfs holds a list of directory entries, which in * turn point to other files (which can be directories themselves). * - * In tmpfs, this list is managed by a tail queue, whose head is defined by + * In tmpfs, this list is managed by a RB-Tree, whose head is defined by * the struct tmpfs_dir type. * - * It is imporant to notice that directories do not have entries for . and + * It is important to notice that directories do not have entries for . and * .. as other file systems do. These can be generated when requested * based on information available by other means, such as the pointer to * the node itself in the former case or the pointer to the parent directory * in the latter case. This is done to simplify tmpfs's code and, more * importantly, to remove redundancy. */ -TAILQ_HEAD(tmpfs_dir, tmpfs_dirent); +RB_HEAD(tmpfs_dir, tmpfs_dirent); /* Each entry in a directory has a cookie that identifies it. Cookies * supersede offsets within directories because, given how tmpfs stores - * directories in memory, there is no such thing as an offset. (Emulating - * a real offset could be very difficult.) - * + * directories in memory, there is no such thing as an offset. + * * The '.', '..' and the end of directory markers have fixed cookies which * cannot collide with the cookies generated by other entries. The cookies - * fot the other entries are generated based on the memory address on which - * stores their information is stored. - * - * Ideally, using the entry's memory pointer as the cookie would be enough - * to represent it and it wouldn't cause collisions in any system. - * Unfortunately, this results in "offsets" with very large values which - * later raise problems in the Linux compatibility layer (and maybe in other - * places) as described in PR kern/32034. Hence we need to workaround this - * with a rather ugly hack. - * - * Linux 32-bit binaries, unless built with _FILE_OFFSET_BITS=64, have off_t - * set to 'long', which is a 32-bit *signed* long integer. Regardless of - * the macro value, GLIBC (2.3 at least) always uses the getdents64 - * system call (when calling readdir) which internally returns off64_t - * offsets. In order to make 32-bit binaries work, *GLIBC* converts the - * 64-bit values returned by the kernel to 32-bit ones and aborts with - * EOVERFLOW if the conversion results in values that won't fit in 32-bit - * integers (which it assumes is because the directory is extremely large). - * This wouldn't cause problems if we were dealing with unsigned integers, - * but as we have signed integers, this check fails due to sign expansion. + * for the other entries are generated based on the file name hash value or + * unique number in case of name hash collision. * - * For example, consider that the kernel returns the 0xc1234567 cookie to - * userspace in a off64_t integer. Later on, GLIBC casts this value to - * off_t (remember, signed) with code similar to: - * system call returns the offset in kernel_value; - * off_t casted_value = kernel_value; - * if (sizeof(off_t) != sizeof(off64_t) && - * kernel_value != casted_value) - * error! - * In this case, casted_value still has 0xc1234567, but when it is compared - * for equality against kernel_value, it is promoted to a 64-bit integer and - * becomes 0xffffffffc1234567, which is different than 0x00000000c1234567. - * Then, GLIBC assumes this is because the directory is very large. - * - * Given that all the above happens in user-space, we have no control over - * it; therefore we must workaround the issue here. We do this by - * truncating the pointer value to a 32-bit integer and hope that there - * won't be collisions. In fact, this will not cause any problems in - * 32-bit platforms but some might arise in 64-bit machines (I'm not sure - * if they can happen at all in practice). - * - * XXX A nicer solution shall be attempted. */ -#ifdef _KERNEL -#define TMPFS_DIRCOOKIE_DOT 0 -#define TMPFS_DIRCOOKIE_DOTDOT 1 -#define TMPFS_DIRCOOKIE_EOF 2 -static __inline -off_t -tmpfs_dircookie(struct tmpfs_dirent *de) -{ - off_t cookie; - - cookie = ((off_t)(uintptr_t)de >> 1) & 0x7FFFFFFF; - MPASS(cookie != TMPFS_DIRCOOKIE_DOT); - MPASS(cookie != TMPFS_DIRCOOKIE_DOTDOT); - MPASS(cookie != TMPFS_DIRCOOKIE_EOF); + * To preserve compatibility cookies are limited to 31 bits. + */ - return cookie; -} -#endif +#define TMPFS_DIRCOOKIE_DOT 0 +#define TMPFS_DIRCOOKIE_DOTDOT 1 +#define TMPFS_DIRCOOKIE_EOF 2 +#define TMPFS_DIRCOOKIE_MASK ((off_t)0x3fffffffU) +#define TMPFS_DIRCOOKIE_MIN ((off_t)0x00000004U) +#define TMPFS_DIRCOOKIE_DUP ((off_t)0x40000000U) +#define TMPFS_DIRCOOKIE_DUPHEAD ((off_t)0x80000000U) +#define TMPFS_DIRCOOKIE_DUP_MIN TMPFS_DIRCOOKIE_DUP +#define TMPFS_DIRCOOKIE_DUP_MAX \ + (TMPFS_DIRCOOKIE_DUP | TMPFS_DIRCOOKIE_MASK) /* --------------------------------------------------------------------- */ @@ -243,29 +221,31 @@ struct tmpfs_node { dev_t tn_rdev; /* Valid when tn_type == VDIR. */ - struct tn_dir{ + struct tn_dir { /* Pointer to the parent directory. The root * directory has a pointer to itself in this field; * this property identifies the root node. */ struct tmpfs_node * tn_parent; - /* Head of a tail-queue that links the contents of - * the directory together. See above for a - * description of its contents. */ + /* Head of a tree that links the contents of + * the directory together. */ struct tmpfs_dir tn_dirhead; + /* Head of a list the contains fake directory entries + * heads, i.e. entries with TMPFS_DIRCOOKIE_DUPHEAD + * flag. */ + struct tmpfs_dir_duphead tn_dupindex; + /* Number and pointer of the first directory entry * returned by the readdir operation if it were * called again to continue reading data from the * same directory as before. This is used to speed * up reads of long directories, assuming that no * more than one read is in progress at a given time. - * Otherwise, these values are discarded and a linear - * scan is performed from the beginning up to the - * point where readdir starts returning values. */ + * Otherwise, these values are discarded. */ off_t tn_readdir_lastn; struct tmpfs_dirent * tn_readdir_lastp; - }tn_dir; + } tn_dir; /* Valid when tn_type == VLNK. */ /* The link's target, allocated from a string pool. */ @@ -419,9 +399,9 @@ int tmpfs_alloc_node(struct tmpfs_mount *, enum vtype, char *, dev_t, struct tmpfs_node **); void tmpfs_free_node(struct tmpfs_mount *, struct tmpfs_node *); int tmpfs_alloc_dirent(struct tmpfs_mount *, struct tmpfs_node *, - const char *, uint16_t, struct tmpfs_dirent **); -void tmpfs_free_dirent(struct tmpfs_mount *, struct tmpfs_dirent *, - boolean_t); + const char *, u_int, struct tmpfs_dirent **); +void tmpfs_free_dirent(struct tmpfs_mount *, struct tmpfs_dirent *); +void tmpfs_dirent_init(struct tmpfs_dirent *, const char *, u_int); int tmpfs_alloc_vp(struct mount *, struct tmpfs_node *, int, struct vnode **); void tmpfs_free_vp(struct vnode *); @@ -429,13 +409,12 @@ int tmpfs_alloc_file(struct vnode *, struct vnode **, struct vattr *, struct componentname *, char *); void tmpfs_dir_attach(struct vnode *, struct tmpfs_dirent *); void tmpfs_dir_detach(struct vnode *, struct tmpfs_dirent *); +void tmpfs_dir_destroy(struct tmpfs_mount *, struct tmpfs_node *); struct tmpfs_dirent * tmpfs_dir_lookup(struct tmpfs_node *node, struct tmpfs_node *f, struct componentname *cnp); -int tmpfs_dir_getdotdent(struct tmpfs_node *, struct uio *); -int tmpfs_dir_getdotdotdent(struct tmpfs_node *, struct uio *); -struct tmpfs_dirent * tmpfs_dir_lookupbycookie(struct tmpfs_node *, off_t); -int tmpfs_dir_getdents(struct tmpfs_node *, struct uio *, off_t *); +int tmpfs_dir_getdents(struct tmpfs_node *, struct uio *, int, + u_long *, int *); int tmpfs_dir_whiteout_add(struct vnode *, struct componentname *); void tmpfs_dir_whiteout_remove(struct vnode *, struct componentname *); int tmpfs_reg_resize(struct vnode *, off_t, boolean_t); @@ -467,8 +446,8 @@ int tmpfs_truncate(struct vnode *, off_t); * with a length of 'len'. */ #define TMPFS_DIRENT_MATCHES(de, name, len) \ - (de->td_namelen == (uint16_t)len && \ - bcmp((de)->td_name, (name), (de)->td_namelen) == 0) + (de->td_namelen == len && \ + bcmp((de)->ud.td_name, (name), (de)->td_namelen) == 0) /* --------------------------------------------------------------------- */ @@ -476,11 +455,10 @@ int tmpfs_truncate(struct vnode *, off_t); * Ensures that the node pointed by 'node' is a directory and that its * contents are consistent with respect to directories. */ -#define TMPFS_VALIDATE_DIR(node) \ - MPASS((node)->tn_type == VDIR); \ - MPASS((node)->tn_size % sizeof(struct tmpfs_dirent) == 0); \ - MPASS((node)->tn_dir.tn_readdir_lastp == NULL || \ - tmpfs_dircookie((node)->tn_dir.tn_readdir_lastp) == (node)->tn_dir.tn_readdir_lastn); +#define TMPFS_VALIDATE_DIR(node) do { \ + MPASS((node)->tn_type == VDIR); \ + MPASS((node)->tn_size % sizeof(struct tmpfs_dirent) == 0); \ +} while (0) /* --------------------------------------------------------------------- */ diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 5f1616c..47ac2e6 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> +#include <sys/fnv_hash.h> #include <sys/namei.h> #include <sys/priv.h> #include <sys/proc.h> @@ -58,6 +59,11 @@ __FBSDID("$FreeBSD$"); #include <fs/tmpfs/tmpfs_fifoops.h> #include <fs/tmpfs/tmpfs_vnops.h> +struct tmpfs_dir_cursor { + struct tmpfs_dirent *tdc_current; + struct tmpfs_dirent *tdc_tree; +}; + SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmpfs file system"); static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; @@ -87,6 +93,10 @@ SYSCTL_PROC(_vfs_tmpfs, OID_AUTO, memory_reserved, CTLTYPE_LONG|CTLFLAG_RW, &tmpfs_pages_reserved, 0, sysctl_mem_reserved, "L", "Amount of available memory and swap below which tmpfs growth stops"); +static __inline int tmpfs_dirtree_cmp(struct tmpfs_dirent *a, + struct tmpfs_dirent *b); +RB_PROTOTYPE_STATIC(tmpfs_dir, tmpfs_dirent, uh.td_entries, tmpfs_dirtree_cmp); + size_t tmpfs_mem_avail(void) { @@ -188,7 +198,8 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp, enum vtype type, break; case VDIR: - TAILQ_INIT(&nnode->tn_dir.tn_dirhead); + RB_INIT(&nnode->tn_dir.tn_dirhead); + LIST_INIT(&nnode->tn_dir.tn_dupindex); MPASS(parent != nnode); MPASS(IMPLIES(parent == NULL, tmp->tm_root == NULL)); nnode->tn_dir.tn_parent = (parent == NULL) ? nnode : parent; @@ -309,6 +320,49 @@ tmpfs_free_node(struct tmpfs_mount *tmp, struct tmpfs_node *node) /* --------------------------------------------------------------------- */ +static __inline uint32_t +tmpfs_dirent_hash(const char *name, u_int len) +{ + uint32_t hash; + + hash = fnv_32_buf(name, len, FNV1_32_INIT + len) & TMPFS_DIRCOOKIE_MASK; +#ifdef TMPFS_DEBUG_DIRCOOKIE_DUP + hash &= 0xf; +#endif + if (hash < TMPFS_DIRCOOKIE_MIN) + hash += TMPFS_DIRCOOKIE_MIN; + + return (hash); +} + +static __inline off_t +tmpfs_dirent_cookie(struct tmpfs_dirent *de) +{ + MPASS(de->td_cookie >= TMPFS_DIRCOOKIE_MIN); + + return (de->td_cookie); +} + +static __inline boolean_t +tmpfs_dirent_dup(struct tmpfs_dirent *de) +{ + return ((de->td_cookie & TMPFS_DIRCOOKIE_DUP) != 0); +} + +static __inline boolean_t +tmpfs_dirent_duphead(struct tmpfs_dirent *de) +{ + return ((de->td_cookie & TMPFS_DIRCOOKIE_DUPHEAD) != 0); +} + +void +tmpfs_dirent_init(struct tmpfs_dirent *de, const char *name, u_int namelen) +{ + de->td_hash = de->td_cookie = tmpfs_dirent_hash(name, namelen); + memcpy(de->ud.td_name, name, namelen); + de->td_namelen = namelen; +} + /* * Allocates a new directory entry for the node node with a name of name. * The new directory entry is returned in *de. @@ -320,17 +374,17 @@ tmpfs_free_node(struct tmpfs_mount *tmp, struct tmpfs_node *node) */ int tmpfs_alloc_dirent(struct tmpfs_mount *tmp, struct tmpfs_node *node, - const char *name, uint16_t len, struct tmpfs_dirent **de) + const char *name, u_int len, struct tmpfs_dirent **de) { struct tmpfs_dirent *nde; - nde = (struct tmpfs_dirent *)uma_zalloc( - tmp->tm_dirent_pool, M_WAITOK); - nde->td_name = malloc(len, M_TMPFSNAME, M_WAITOK); - nde->td_namelen = len; - memcpy(nde->td_name, name, len); - + nde = uma_zalloc(tmp->tm_dirent_pool, M_WAITOK); nde->td_node = node; + if (name != NULL) { + nde->ud.td_name = malloc(len, M_TMPFSNAME, M_WAITOK); + tmpfs_dirent_init(nde, name, len); + } else + nde->td_namelen = 0; if (node != NULL) node->tn_links++; @@ -351,20 +405,17 @@ tmpfs_alloc_dirent(struct tmpfs_mount *tmp, struct tmpfs_node *node, * directory entry, as it may already have been released from the outside. */ void -tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpfs_dirent *de, - boolean_t node_exists) +tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpfs_dirent *de) { - if (node_exists) { - struct tmpfs_node *node; + struct tmpfs_node *node; - node = de->td_node; - if (node != NULL) { - MPASS(node->tn_links > 0); - node->tn_links--; - } + node = de->td_node; + if (node != NULL) { + MPASS(node->tn_links > 0); + node->tn_links--; } - - free(de->td_name, M_TMPFSNAME); + if (!tmpfs_dirent_duphead(de) && de->ud.td_name != NULL) + free(de->ud.td_name, M_TMPFSNAME); uma_zfree(tmp->tm_dirent_pool, de); } @@ -586,7 +637,7 @@ tmpfs_alloc_file(struct vnode *dvp, struct vnode **vpp, struct vattr *vap, /* Allocate a vnode for the new file. */ error = tmpfs_alloc_vp(dvp->v_mount, node, LK_EXCLUSIVE, vpp); if (error != 0) { - tmpfs_free_dirent(tmp, de, TRUE); + tmpfs_free_dirent(tmp, de); tmpfs_free_node(tmp, node); goto out; } @@ -605,6 +656,215 @@ out: /* --------------------------------------------------------------------- */ +static struct tmpfs_dirent * +tmpfs_dir_first(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) +{ + struct tmpfs_dirent *de; + + de = RB_MIN(tmpfs_dir, &dnode->tn_dir.tn_dirhead); + dc->tdc_tree = de; + if (de != NULL && tmpfs_dirent_duphead(de)) + de = LIST_FIRST(&de->ud.td_duphead); + dc->tdc_current = de; + + return (dc->tdc_current); +} + +static struct tmpfs_dirent * +tmpfs_dir_next(struct tmpfs_node *dnode, struct tmpfs_dir_cursor *dc) +{ + struct tmpfs_dirent *de; + + MPASS(dc->tdc_tree != NULL); + if (tmpfs_dirent_dup(dc->tdc_current)) { + dc->tdc_current = LIST_NEXT(dc->tdc_current, uh.td_dup.entries); + if (dc->tdc_current != NULL) + return (dc->tdc_current); + } + dc->tdc_tree = dc->tdc_current = RB_NEXT(tmpfs_dir, + &dnode->tn_dir.tn_dirhead, dc->tdc_tree); + if ((de = dc->tdc_current) != NULL && tmpfs_dirent_duphead(de)) { + dc->tdc_current = LIST_FIRST(&de->ud.td_duphead); + MPASS(dc->tdc_current != NULL); + } + + return (dc->tdc_current); +} + +/* Lookup directory entry in RB-Tree. Function may return duphead entry. */ +static struct tmpfs_dirent * +tmpfs_dir_xlookup_hash(struct tmpfs_node *dnode, uint32_t hash) +{ + struct tmpfs_dirent *de, dekey; + + dekey.td_hash = hash; + de = RB_FIND(tmpfs_dir, &dnode->tn_dir.tn_dirhead, &dekey); + return (de); +} + +/* Lookup directory entry by cookie, initialize directory cursor accordingly. */ +static struct tmpfs_dirent * +tmpfs_dir_lookup_cookie(struct tmpfs_node *node, off_t cookie, + struct tmpfs_dir_cursor *dc) +{ + struct tmpfs_dir *dirhead = &node->tn_dir.tn_dirhead; + struct tmpfs_dirent *de, dekey; + + MPASS(cookie >= TMPFS_DIRCOOKIE_MIN); + + if (cookie == node->tn_dir.tn_readdir_lastn && + (de = node->tn_dir.tn_readdir_lastp) != NULL) { + /* Protect against possible race, tn_readdir_last[pn] + * may be updated with only shared vnode lock held. */ + if (cookie == tmpfs_dirent_cookie(de)) + goto out; + } + + if ((cookie & TMPFS_DIRCOOKIE_DUP) != 0) { + LIST_FOREACH(de, &node->tn_dir.tn_dupindex, + uh.td_dup.index_entries) { + MPASS(tmpfs_dirent_dup(de)); + if (de->td_cookie == cookie) + goto out; + /* dupindex list is sorted. */ + if (de->td_cookie < cookie) { + de = NULL; + goto out; + } + } + MPASS(de == NULL); + goto out; + } + + MPASS((cookie & TMPFS_DIRCOOKIE_MASK) == cookie); + dekey.td_hash = cookie; + /* Recover if direntry for cookie was removed */ + de = RB_NFIND(tmpfs_dir, dirhead, &dekey); + dc->tdc_tree = de; + dc->tdc_current = de; + if (de != NULL && tmpfs_dirent_duphead(de)) { + dc->tdc_current = LIST_FIRST(&de->ud.td_duphead); + MPASS(dc->tdc_current != NULL); + } + return (dc->tdc_current); + +out: + dc->tdc_tree = de; + dc->tdc_current = de; + if (de != NULL && tmpfs_dirent_dup(de)) + dc->tdc_tree = tmpfs_dir_xlookup_hash(node, + de->td_hash); + return (dc->tdc_current); +} + +/* + * Looks for a directory entry in the directory represented by node. + * 'cnp' describes the name of the entry to look for. Note that the . + * and .. components are not allowed as they do not physically exist + * within directories. + * + * Returns a pointer to the entry when found, otherwise NULL. + */ +struct tmpfs_dirent * +tmpfs_dir_lookup(struct tmpfs_node *node, struct tmpfs_node *f, + struct componentname *cnp) +{ + struct tmpfs_dir_duphead *duphead; + struct tmpfs_dirent *de; + uint32_t hash; + + MPASS(IMPLIES(cnp->cn_namelen == 1, cnp->cn_nameptr[0] != '.')); + MPASS(IMPLIES(cnp->cn_namelen == 2, !(cnp->cn_nameptr[0] == '.' && + cnp->cn_nameptr[1] == '.'))); + TMPFS_VALIDATE_DIR(node); + + hash = tmpfs_dirent_hash(cnp->cn_nameptr, cnp->cn_namelen); + de = tmpfs_dir_xlookup_hash(node, hash); + if (de != NULL && tmpfs_dirent_duphead(de)) { + duphead = &de->ud.td_duphead; + LIST_FOREACH(de, duphead, uh.td_dup.entries) { + if (TMPFS_DIRENT_MATCHES(de, cnp->cn_nameptr, + cnp->cn_namelen)) + break; + } + } else if (de != NULL) { + if (!TMPFS_DIRENT_MATCHES(de, cnp->cn_nameptr, + cnp->cn_namelen)) + de = NULL; + } + if (de != NULL && f != NULL && de->td_node != f) + de = NULL; + + return (de); +} + +/* + * Attach duplicate-cookie directory entry nde to dnode and insert to dupindex + * list, allocate new cookie value. + */ +static void +tmpfs_dir_attach_dup(struct tmpfs_node *dnode, + struct tmpfs_dir_duphead *duphead, struct tmpfs_dirent *nde) +{ + struct tmpfs_dir_duphead *dupindex; + struct tmpfs_dirent *de, *pde; + + dupindex = &dnode->tn_dir.tn_dupindex; + de = LIST_FIRST(dupindex); + if (de == NULL || de->td_cookie < TMPFS_DIRCOOKIE_DUP_MAX) { + if (de == NULL) + nde->td_cookie = TMPFS_DIRCOOKIE_DUP_MIN; + else + nde->td_cookie = de->td_cookie + 1; + MPASS(tmpfs_dirent_dup(nde)); + LIST_INSERT_HEAD(dupindex, nde, uh.td_dup.index_entries); + LIST_INSERT_HEAD(duphead, nde, uh.td_dup.entries); + return; + } + + /* + * Cookie numbers are near exhaustion. Scan dupindex list for unused + * numbers. dupindex list is sorted in descending order. Keep it so + * after inserting nde. + */ + while (1) { + pde = de; + de = LIST_NEXT(de, uh.td_dup.index_entries); + if (de == NULL && pde->td_cookie != TMPFS_DIRCOOKIE_DUP_MIN) { + /* + * Last element of the index doesn't have minimal cookie + * value, use it. + */ + nde->td_cookie = TMPFS_DIRCOOKIE_DUP_MIN; + LIST_INSERT_AFTER(pde, nde, uh.td_dup.index_entries); + LIST_INSERT_HEAD(duphead, nde, uh.td_dup.entries); + return; + } else if (de == NULL) { + /* + * We are so lucky have 2^30 hash duplicates in single + * directory :) Return largest possible cookie value. + * It should be fine except possible issues with + * VOP_READDIR restart. + */ + nde->td_cookie = TMPFS_DIRCOOKIE_DUP_MAX; + LIST_INSERT_HEAD(dupindex, nde, + uh.td_dup.index_entries); + LIST_INSERT_HEAD(duphead, nde, uh.td_dup.entries); + return; + } + if (de->td_cookie + 1 == pde->td_cookie || + de->td_cookie >= TMPFS_DIRCOOKIE_DUP_MAX) + continue; /* No hole or invalid cookie. */ + nde->td_cookie = de->td_cookie + 1; + MPASS(tmpfs_dirent_dup(nde)); + MPASS(pde->td_cookie > nde->td_cookie); + MPASS(nde->td_cookie > de->td_cookie); + LIST_INSERT_BEFORE(de, nde, uh.td_dup.index_entries); + LIST_INSERT_HEAD(duphead, nde, uh.td_dup.entries); + return; + }; +} + /* * Attaches the directory entry de to the directory represented by vp. * Note that this does not change the link count of the node pointed by @@ -614,10 +874,38 @@ void tmpfs_dir_attach(struct vnode *vp, struct tmpfs_dirent *de) { struct tmpfs_node *dnode; + struct tmpfs_dirent *xde, *nde; ASSERT_VOP_ELOCKED(vp, __func__); + MPASS(de->td_namelen > 0); + MPASS(de->td_hash >= TMPFS_DIRCOOKIE_MIN); + MPASS(de->td_cookie == de->td_hash); + dnode = VP_TO_TMPFS_DIR(vp); - TAILQ_INSERT_TAIL(&dnode->tn_dir.tn_dirhead, de, td_entries); + dnode->tn_dir.tn_readdir_lastn = 0; + dnode->tn_dir.tn_readdir_lastp = NULL; + + MPASS(!tmpfs_dirent_dup(de)); + xde = RB_INSERT(tmpfs_dir, &dnode->tn_dir.tn_dirhead, de); + if (xde != NULL && tmpfs_dirent_duphead(xde)) + tmpfs_dir_attach_dup(dnode, &xde->ud.td_duphead, de); + else if (xde != NULL) { + /* + * Allocate new duphead. Swap xde with duphead to avoid + * adding/removing elements with the same hash. + */ + MPASS(!tmpfs_dirent_dup(xde)); + tmpfs_alloc_dirent(VFS_TO_TMPFS(vp->v_mount), NULL, NULL, 0, + &nde); + /* *nde = *xde; XXX gcc 4.2.1 may generate invalid code. */ + memcpy(nde, xde, sizeof(*xde)); + xde->td_cookie |= TMPFS_DIRCOOKIE_DUPHEAD; + LIST_INIT(&xde->ud.td_duphead); + xde->td_namelen = 0; + xde->td_node = NULL; + tmpfs_dir_attach_dup(dnode, &xde->ud.td_duphead, nde); + tmpfs_dir_attach_dup(dnode, &xde->ud.td_duphead, de); + } dnode->tn_size += sizeof(struct tmpfs_dirent); dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \ TMPFS_NODE_MODIFIED; @@ -633,58 +921,61 @@ tmpfs_dir_attach(struct vnode *vp, struct tmpfs_dirent *de) void tmpfs_dir_detach(struct vnode *vp, struct tmpfs_dirent *de) { + struct tmpfs_mount *tmp; + struct tmpfs_dir *head; struct tmpfs_node *dnode; + struct tmpfs_dirent *xde; ASSERT_VOP_ELOCKED(vp, __func__); - dnode = VP_TO_TMPFS_DIR(vp); - if (dnode->tn_dir.tn_readdir_lastp == de) { - dnode->tn_dir.tn_readdir_lastn = 0; - dnode->tn_dir.tn_readdir_lastp = NULL; - } + dnode = VP_TO_TMPFS_DIR(vp); + head = &dnode->tn_dir.tn_dirhead; + dnode->tn_dir.tn_readdir_lastn = 0; + dnode->tn_dir.tn_readdir_lastp = NULL; + + if (tmpfs_dirent_dup(de)) { + /* Remove duphead if de was last entry. */ + if (LIST_NEXT(de, uh.td_dup.entries) == NULL) { + xde = tmpfs_dir_xlookup_hash(dnode, de->td_hash); + MPASS(tmpfs_dirent_duphead(xde)); + } else + xde = NULL; + LIST_REMOVE(de, uh.td_dup.entries); + LIST_REMOVE(de, uh.td_dup.index_entries); + if (xde != NULL) { + if (LIST_EMPTY(&xde->ud.td_duphead)) { + RB_REMOVE(tmpfs_dir, head, xde); + tmp = VFS_TO_TMPFS(vp->v_mount); + MPASS(xde->td_node == NULL); + tmpfs_free_dirent(tmp, xde); + } + } + } else + RB_REMOVE(tmpfs_dir, head, de); - TAILQ_REMOVE(&dnode->tn_dir.tn_dirhead, de, td_entries); dnode->tn_size -= sizeof(struct tmpfs_dirent); dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \ TMPFS_NODE_MODIFIED; } -/* --------------------------------------------------------------------- */ - -/* - * Looks for a directory entry in the directory represented by node. - * 'cnp' describes the name of the entry to look for. Note that the . - * and .. components are not allowed as they do not physically exist - * within directories. - * - * Returns a pointer to the entry when found, otherwise NULL. - */ -struct tmpfs_dirent * -tmpfs_dir_lookup(struct tmpfs_node *node, struct tmpfs_node *f, - struct componentname *cnp) +void +tmpfs_dir_destroy(struct tmpfs_mount *tmp, struct tmpfs_node *dnode) { - boolean_t found; - struct tmpfs_dirent *de; - - MPASS(IMPLIES(cnp->cn_namelen == 1, cnp->cn_nameptr[0] != '.')); - MPASS(IMPLIES(cnp->cn_namelen == 2, !(cnp->cn_nameptr[0] == '.' && - cnp->cn_nameptr[1] == '.'))); - TMPFS_VALIDATE_DIR(node); - - found = 0; - TAILQ_FOREACH(de, &node->tn_dir.tn_dirhead, td_entries) { - if (f != NULL && de->td_node != f) - continue; - MPASS(cnp->cn_namelen < 0xffff); - if (de->td_namelen == (uint16_t)cnp->cn_namelen && - bcmp(de->td_name, cnp->cn_nameptr, de->td_namelen) == 0) { - found = 1; - break; + struct tmpfs_dirent *de, *dde, *nde; + + RB_FOREACH_SAFE(de, tmpfs_dir, &dnode->tn_dir.tn_dirhead, nde) { + RB_REMOVE(tmpfs_dir, &dnode->tn_dir.tn_dirhead, de); + /* Node may already be destroyed. */ + de->td_node = NULL; + if (tmpfs_dirent_duphead(de)) { + while ((dde = LIST_FIRST(&de->ud.td_duphead)) != NULL) { + LIST_REMOVE(dde, uh.td_dup.entries); + dde->td_node = NULL; + tmpfs_free_dirent(tmp, dde); + } } + tmpfs_free_dirent(tmp, de); } - node->tn_status |= TMPFS_NODE_ACCESSED; - - return found ? de : NULL; } /* --------------------------------------------------------------------- */ @@ -696,7 +987,7 @@ tmpfs_dir_lookup(struct tmpfs_node *node, struct tmpfs_node *f, * hold the directory entry or an appropriate error code if another * error happens. */ -int +static int tmpfs_dir_getdotdent(struct tmpfs_node *node, struct uio *uio) { int error; @@ -713,12 +1004,9 @@ tmpfs_dir_getdotdent(struct tmpfs_node *node, struct uio *uio) dent.d_reclen = GENERIC_DIRSIZ(&dent); if (dent.d_reclen > uio->uio_resid) - error = -1; - else { + error = EJUSTRETURN; + else error = uiomove(&dent, dent.d_reclen, uio); - if (error == 0) - uio->uio_offset = TMPFS_DIRCOOKIE_DOTDOT; - } node->tn_status |= TMPFS_NODE_ACCESSED; @@ -734,7 +1022,7 @@ tmpfs_dir_getdotdent(struct tmpfs_node *node, struct uio *uio) * hold the directory entry or an appropriate error code if another * error happens. */ -int +static int tmpfs_dir_getdotdotdent(struct tmpfs_node *node, struct uio *uio) { int error; @@ -763,19 +1051,9 @@ tmpfs_dir_getdotdotdent(struct tmpfs_node *node, struct uio *uio) dent.d_reclen = GENERIC_DIRSIZ(&dent); if (dent.d_reclen > uio->uio_resid) - error = -1; - else { + error = EJUSTRETURN; + else error = uiomove(&dent, dent.d_reclen, uio); - if (error == 0) { - struct tmpfs_dirent *de; - - de = TAILQ_FIRST(&node->tn_dir.tn_dirhead); - if (de == NULL) - uio->uio_offset = TMPFS_DIRCOOKIE_EOF; - else - uio->uio_offset = tmpfs_dircookie(de); - } - } node->tn_status |= TMPFS_NODE_ACCESSED; @@ -785,30 +1063,6 @@ tmpfs_dir_getdotdotdent(struct tmpfs_node *node, struct uio *uio) /* --------------------------------------------------------------------- */ /* - * Lookup a directory entry by its associated cookie. - */ -struct tmpfs_dirent * -tmpfs_dir_lookupbycookie(struct tmpfs_node *node, off_t cookie) -{ - struct tmpfs_dirent *de; - - if (cookie == node->tn_dir.tn_readdir_lastn && - node->tn_dir.tn_readdir_lastp != NULL) { - return node->tn_dir.tn_readdir_lastp; - } - - TAILQ_FOREACH(de, &node->tn_dir.tn_dirhead, td_entries) { - if (tmpfs_dircookie(de) == cookie) { - break; - } - } - - return de; -} - -/* --------------------------------------------------------------------- */ - -/* * Helper function for tmpfs_readdir. Returns as much directory entries * as can fit in the uio space. The read starts at uio->uio_offset. * The function returns 0 on success, -1 if there was not enough space @@ -816,27 +1070,47 @@ tmpfs_dir_lookupbycookie(struct tmpfs_node *node, off_t cookie) * error code if another error happens. */ int -tmpfs_dir_getdents(struct tmpfs_node *node, struct uio *uio, off_t *cntp) +tmpfs_dir_getdents(struct tmpfs_node *node, struct uio *uio, int cnt, + u_long *cookies, int *ncookies) { - int error; - off_t startcookie; + struct tmpfs_dir_cursor dc; struct tmpfs_dirent *de; + off_t off; + int error; TMPFS_VALIDATE_DIR(node); - /* Locate the first directory entry we have to return. We have cached - * the last readdir in the node, so use those values if appropriate. - * Otherwise do a linear scan to find the requested entry. */ - startcookie = uio->uio_offset; - MPASS(startcookie != TMPFS_DIRCOOKIE_DOT); - MPASS(startcookie != TMPFS_DIRCOOKIE_DOTDOT); - if (startcookie == TMPFS_DIRCOOKIE_EOF) { - return 0; - } else { - de = tmpfs_dir_lookupbycookie(node, startcookie); - } - if (de == NULL) { - return EINVAL; + off = 0; + switch (uio->uio_offset) { + case TMPFS_DIRCOOKIE_DOT: + error = tmpfs_dir_getdotdent(node, uio); + if (error != 0) + return (error); + uio->uio_offset = TMPFS_DIRCOOKIE_DOTDOT; + if (cnt != 0) + cookies[(*ncookies)++] = off = uio->uio_offset; + case TMPFS_DIRCOOKIE_DOTDOT: + error = tmpfs_dir_getdotdotdent(node, uio); + if (error != 0) + return (error); + de = tmpfs_dir_first(node, &dc); + if (de == NULL) + uio->uio_offset = TMPFS_DIRCOOKIE_EOF; + else + uio->uio_offset = tmpfs_dirent_cookie(de); + if (cnt != 0) + cookies[(*ncookies)++] = off = uio->uio_offset; + if (de == NULL) + return (0); + break; + case TMPFS_DIRCOOKIE_EOF: + return (0); + default: + de = tmpfs_dir_lookup_cookie(node, uio->uio_offset, &dc); + if (de == NULL) + return (EINVAL); + if (cnt != 0) + off = tmpfs_dirent_cookie(de); } /* Read as much entries as possible; i.e., until we reach the end of @@ -887,14 +1161,14 @@ tmpfs_dir_getdents(struct tmpfs_node *node, struct uio *uio, off_t *cntp) } d.d_namlen = de->td_namelen; MPASS(de->td_namelen < sizeof(d.d_name)); - (void)memcpy(d.d_name, de->td_name, de->td_namelen); + (void)memcpy(d.d_name, de->ud.td_name, de->td_namelen); d.d_name[de->td_namelen] = '\0'; d.d_reclen = GENERIC_DIRSIZ(&d); /* Stop reading if the directory entry we are treating is * bigger than the amount of data that can be returned. */ if (d.d_reclen > uio->uio_resid) { - error = -1; + error = EJUSTRETURN; break; } @@ -902,21 +1176,30 @@ tmpfs_dir_getdents(struct tmpfs_node *node, struct uio *uio, off_t *cntp) * advance pointers. */ error = uiomove(&d, d.d_reclen, uio); if (error == 0) { - (*cntp)++; - de = TAILQ_NEXT(de, td_entries); + de = tmpfs_dir_next(node, &dc); + if (cnt != 0) { + if (de == NULL) + off = TMPFS_DIRCOOKIE_EOF; + else + off = tmpfs_dirent_cookie(de); + MPASS(*ncookies < cnt); + cookies[(*ncookies)++] = off; + } } } while (error == 0 && uio->uio_resid > 0 && de != NULL); /* Update the offset and cache. */ - if (de == NULL) { - uio->uio_offset = TMPFS_DIRCOOKIE_EOF; - node->tn_dir.tn_readdir_lastn = 0; - node->tn_dir.tn_readdir_lastp = NULL; - } else { - node->tn_dir.tn_readdir_lastn = uio->uio_offset = tmpfs_dircookie(de); - node->tn_dir.tn_readdir_lastp = de; + if (cnt == 0) { + if (de == NULL) + off = TMPFS_DIRCOOKIE_EOF; + else + off = tmpfs_dirent_cookie(de); } + uio->uio_offset = off; + node->tn_dir.tn_readdir_lastn = off; + node->tn_dir.tn_readdir_lastp = de; + node->tn_status |= TMPFS_NODE_ACCESSED; return error; } @@ -943,7 +1226,7 @@ tmpfs_dir_whiteout_remove(struct vnode *dvp, struct componentname *cnp) de = tmpfs_dir_lookup(VP_TO_TMPFS_DIR(dvp), NULL, cnp); MPASS(de != NULL && de->td_node == NULL); tmpfs_dir_detach(dvp, de); - tmpfs_free_dirent(VFS_TO_TMPFS(dvp->v_mount), de, TRUE); + tmpfs_free_dirent(VFS_TO_TMPFS(dvp->v_mount), de); } /* --------------------------------------------------------------------- */ @@ -1436,3 +1719,15 @@ out: return error; } + +static __inline int +tmpfs_dirtree_cmp(struct tmpfs_dirent *a, struct tmpfs_dirent *b) +{ + if (a->td_hash > b->td_hash) + return (1); + else if (a->td_hash < b->td_hash) + return (-1); + return (0); +} + +RB_GENERATE_STATIC(tmpfs_dir, tmpfs_dirent, uh.td_entries, tmpfs_dirtree_cmp); diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index b2aa786..8cf8693 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -294,19 +294,8 @@ tmpfs_unmount(struct mount *mp, int mntflags) while (node != NULL) { struct tmpfs_node *next; - if (node->tn_type == VDIR) { - struct tmpfs_dirent *de; - - de = TAILQ_FIRST(&node->tn_dir.tn_dirhead); - while (de != NULL) { - struct tmpfs_dirent *nde; - - nde = TAILQ_NEXT(de, td_entries); - tmpfs_free_dirent(tmp, de, FALSE); - de = nde; - node->tn_size -= sizeof(struct tmpfs_dirent); - } - } + if (node->tn_type == VDIR) + tmpfs_dir_destroy(tmp, node); next = LIST_NEXT(node, tn_entries); tmpfs_free_node(tmp, node); diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 3f21cba..7ffff53 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -862,7 +862,7 @@ tmpfs_remove(struct vop_remove_args *v) /* Free the directory entry we just deleted. Note that the node * referred by it will not be removed until the vnode is really * reclaimed. */ - tmpfs_free_dirent(tmp, de, TRUE); + tmpfs_free_dirent(tmp, de); node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED; error = 0; @@ -1278,26 +1278,25 @@ tmpfs_rename(struct vop_rename_args *v) fdnode->tn_links--; TMPFS_NODE_UNLOCK(fdnode); } - - /* Do the move: just remove the entry from the source directory - * and insert it into the target one. */ - tmpfs_dir_detach(fdvp, de); - if (fcnp->cn_flags & DOWHITEOUT) - tmpfs_dir_whiteout_add(fdvp, fcnp); - if (tcnp->cn_flags & ISWHITEOUT) - tmpfs_dir_whiteout_remove(tdvp, tcnp); - tmpfs_dir_attach(tdvp, de); } + /* Do the move: just remove the entry from the source directory + * and insert it into the target one. */ + tmpfs_dir_detach(fdvp, de); + + if (fcnp->cn_flags & DOWHITEOUT) + tmpfs_dir_whiteout_add(fdvp, fcnp); + if (tcnp->cn_flags & ISWHITEOUT) + tmpfs_dir_whiteout_remove(tdvp, tcnp); + /* If the name has changed, we need to make it effective by changing * it in the directory entry. */ if (newname != NULL) { MPASS(tcnp->cn_namelen <= MAXNAMLEN); - free(de->td_name, M_TMPFSNAME); - de->td_namelen = (uint16_t)tcnp->cn_namelen; - memcpy(newname, tcnp->cn_nameptr, tcnp->cn_namelen); - de->td_name = newname; + free(de->ud.td_name, M_TMPFSNAME); + de->ud.td_name = newname; + tmpfs_dirent_init(de, tcnp->cn_nameptr, tcnp->cn_namelen); fnode->tn_status |= TMPFS_NODE_CHANGED; tdnode->tn_status |= TMPFS_NODE_MODIFIED; @@ -1306,15 +1305,20 @@ tmpfs_rename(struct vop_rename_args *v) /* If we are overwriting an entry, we have to remove the old one * from the target directory. */ if (tvp != NULL) { + struct tmpfs_dirent *tde; + /* Remove the old entry from the target directory. */ - de = tmpfs_dir_lookup(tdnode, tnode, tcnp); - tmpfs_dir_detach(tdvp, de); + tde = tmpfs_dir_lookup(tdnode, tnode, tcnp); + tmpfs_dir_detach(tdvp, tde); /* Free the directory entry we just deleted. Note that the * node referred by it will not be removed until the vnode is * really reclaimed. */ - tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), de, TRUE); + tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), tde); } + + tmpfs_dir_attach(tdvp, de); + cache_purge(fvp); if (tvp != NULL) cache_purge(tvp); @@ -1442,7 +1446,7 @@ tmpfs_rmdir(struct vop_rmdir_args *v) /* Free the directory entry we just deleted. Note that the node * referred by it will not be removed until the vnode is really * reclaimed. */ - tmpfs_free_dirent(tmp, de, TRUE); + tmpfs_free_dirent(tmp, de); /* Release the deleted vnode (will destroy the node, notify * interested parties and clean it from the cache). */ @@ -1488,8 +1492,8 @@ tmpfs_readdir(struct vop_readdir_args *v) int *ncookies = v->a_ncookies; int error; - off_t startoff; - off_t cnt = 0; + ssize_t startresid; + int cnt = 0; struct tmpfs_node *node; /* This operation only makes sense on directory nodes. */ @@ -1498,69 +1502,29 @@ tmpfs_readdir(struct vop_readdir_args *v) node = VP_TO_TMPFS_DIR(vp); - startoff = uio->uio_offset; + startresid = uio->uio_resid; - if (uio->uio_offset == TMPFS_DIRCOOKIE_DOT) { - error = tmpfs_dir_getdotdent(node, uio); - if (error != 0) - goto outok; - cnt++; - } - - if (uio->uio_offset == TMPFS_DIRCOOKIE_DOTDOT) { - error = tmpfs_dir_getdotdotdent(node, uio); - if (error != 0) - goto outok; - cnt++; + if (cookies != NULL && ncookies != NULL) { + cnt = howmany(node->tn_size, sizeof(struct tmpfs_dirent)) + 2; + *cookies = malloc(cnt * sizeof(**cookies), M_TEMP, M_WAITOK); + *ncookies = 0; } - error = tmpfs_dir_getdents(node, uio, &cnt); + if (cnt == 0) + error = tmpfs_dir_getdents(node, uio, 0, NULL, NULL); + else + error = tmpfs_dir_getdents(node, uio, cnt, *cookies, ncookies); -outok: - MPASS(error >= -1); + if (error == EJUSTRETURN) + error = (uio->uio_resid != startresid) ? 0 : EINVAL; - if (error == -1) - error = (cnt != 0) ? 0 : EINVAL; + if (error != 0 && cnt != 0) + free(*cookies, M_TEMP); if (eofflag != NULL) *eofflag = (error == 0 && uio->uio_offset == TMPFS_DIRCOOKIE_EOF); - /* Update NFS-related variables. */ - if (error == 0 && cookies != NULL && ncookies != NULL) { - off_t i; - off_t off = startoff; - struct tmpfs_dirent *de = NULL; - - *ncookies = cnt; - *cookies = malloc(cnt * sizeof(off_t), M_TEMP, M_WAITOK); - - for (i = 0; i < cnt; i++) { - MPASS(off != TMPFS_DIRCOOKIE_EOF); - if (off == TMPFS_DIRCOOKIE_DOT) { - off = TMPFS_DIRCOOKIE_DOTDOT; - } else { - if (off == TMPFS_DIRCOOKIE_DOTDOT) { - de = TAILQ_FIRST(&node->tn_dir.tn_dirhead); - } else if (de != NULL) { - de = TAILQ_NEXT(de, td_entries); - } else { - de = tmpfs_dir_lookupbycookie(node, - off); - MPASS(de != NULL); - de = TAILQ_NEXT(de, td_entries); - } - if (de == NULL) - off = TMPFS_DIRCOOKIE_EOF; - else - off = tmpfs_dircookie(de); - } - - (*cookies)[i] = off; - } - MPASS(uio->uio_offset == off); - } - return error; } diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 0294887..c6a5da8 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -567,6 +567,9 @@ g_io_deliver(struct bio *bp, int error) printf("ENOMEM %p on %p(%s)\n", bp, pp, pp->name); bp->bio_children = 0; bp->bio_inbed = 0; + bp->bio_driver1 = NULL; + bp->bio_driver2 = NULL; + bp->bio_pflags = 0; g_io_request(bp, cp); pace++; return; diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC index 76d09dd..3a808ba 100644 --- a/sys/i386/conf/GENERIC +++ b/sys/i386/conf/GENERIC @@ -37,6 +37,7 @@ options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options UFS_GJOURNAL # Enable gjournal-based UFS journaling +options QUOTA # Enable disk quotas for UFS options MD_ROOT # MD is a potential root device options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server @@ -331,15 +332,6 @@ device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da -# FireWire support -device firewire # FireWire bus code -# sbp(4) works for some systems but causes boot failure on others -#device sbp # SCSI over FireWire (Requires scbus and da) -device fwe # Ethernet over FireWire (non-standard!) -device fwip # IP over FireWire (RFC 2734,3146) -device dcons # Dumb console driver -device dcons_crom # Configuration ROM for dcons - # Sound support device sound # Generic sound driver (required) device snd_cmi # CMedia CMI8338/CMI8738 diff --git a/sys/i386/xen/xen_machdep.c b/sys/i386/xen/xen_machdep.c index f197976..3b3da6f 100644 --- a/sys/i386/xen/xen_machdep.c +++ b/sys/i386/xen/xen_machdep.c @@ -216,7 +216,9 @@ static mmu_update_t xpq_queue[MAX_VIRT_CPUS][XPQUEUE_SIZE]; #else static mmu_update_t xpq_queue[XPQUEUE_SIZE]; +#ifdef INVARIANTS static struct mmu_log xpq_queue_log[XPQUEUE_SIZE]; +#endif static int xpq_idx = 0; #define XPQ_QUEUE_LOG xpq_queue_log diff --git a/sys/ia64/conf/GENERIC b/sys/ia64/conf/GENERIC index e22450b..196e5be 100644 --- a/sys/ia64/conf/GENERIC +++ b/sys/ia64/conf/GENERIC @@ -60,6 +60,7 @@ options SYSVSHM # SYSV-style shared memory options UFS_ACL # Support for access control lists options UFS_DIRHASH # Hash-based directory lookup scheme options UFS_GJOURNAL # Enable gjournal-based UFS journaling +options QUOTA # Enable disk quotas for UFS options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B RT extensions # Debugging support. Always need this: @@ -77,7 +78,6 @@ options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones # Various "busses" -device firewire # FireWire bus code device miibus # MII bus support (Ethernet) device pci # PCI bus support device scbus # SCSI bus (required for ATA/SCSI) @@ -190,11 +190,6 @@ options IEEE80211_SUPPORT_MESH # builds everything including AR5416 (and later 11n NIC) support. options AH_SUPPORT_AR5416 -# FireWire support -device fwip # IP over FireWire (RFC 2734,3146) -# sbp(4) works for some systems but causes boot failure on others -#device sbp # SCSI over FireWire (need scbus & da) - # Various (pseudo) devices device ether # Ethernet support device faith # IPv6-to-IPv4 relaying (translation) diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 3dd6521..50b47fb 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1074,7 +1074,9 @@ kern_wait6(struct thread *td, idtype_t idtype, id_t id, int *status, q = td->td_proc; if ((pid_t)id == WAIT_MYPGRP && (idtype == P_PID || idtype == P_PGID)) { + PROC_LOCK(q); id = (id_t)q->p_pgid; + PROC_UNLOCK(q); idtype = P_PGID; } diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 98f0156..7962ae1 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -498,6 +498,8 @@ __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk, case LK_DOWNGRADE: _lockmgr_assert(lk, KA_XLOCKED | KA_NOTRECURSED, file, line); + if (flags & LK_INTERLOCK) + class->lc_unlock(ilk); return (0); } } diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index e2e4081..73dfd70 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -133,10 +133,10 @@ sleepinit(void) * General sleep call. Suspends the current thread until a wakeup is * performed on the specified identifier. The thread will then be made * runnable with the specified priority. Sleeps at most timo/hz seconds - * (0 means no timeout). If pri includes PCATCH flag, signals are checked - * before and after sleeping, else signals are not checked. Returns 0 if + * (0 means no timeout). If pri includes the PCATCH flag, let signals + * interrupt the sleep, otherwise ignore them while sleeping. Returns 0 if * awakened, EWOULDBLOCK if the timeout expires. If PCATCH is set and a - * signal needs to be delivered, ERESTART is returned if the current system + * signal becomes pending, ERESTART is returned if the current system * call should be restarted if possible, and EINTR is returned if the system * call should be interrupted by the signal (return EINTR). * diff --git a/sys/kern/subr_param.c b/sys/kern/subr_param.c index 1f4f6b3..fe10a87 100644 --- a/sys/kern/subr_param.c +++ b/sys/kern/subr_param.c @@ -160,6 +160,7 @@ static const char *const vm_bnames[] = { "Plex86", /* Plex86 */ "Bochs", /* Bochs */ "Xen", /* Xen */ + "BHYVE", /* bhyve */ NULL }; diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 3dcfcf5..3d6dc5a 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -78,7 +78,7 @@ syscallenter(struct thread *td, struct syscall_args *sa) ktrsyscall(sa->code, sa->narg, sa->args); #endif KTR_START4(KTR_SYSC, "syscall", syscallname(p, sa->code), - td, "pid:%d", td->td_proc->p_pid, "arg0:%p", sa->args[0], + (uintptr_t)td, "pid:%d", td->td_proc->p_pid, "arg0:%p", sa->args[0], "arg1:%p", sa->args[1], "arg2:%p", sa->args[2]); if (error == 0) { @@ -152,7 +152,7 @@ syscallenter(struct thread *td, struct syscall_args *sa) } retval: KTR_STOP4(KTR_SYSC, "syscall", syscallname(p, sa->code), - td, "pid:%d", td->td_proc->p_pid, "error:%d", error, + (uintptr_t)td, "pid:%d", td->td_proc->p_pid, "error:%d", error, "retval0:%#lx", td->td_retval[0], "retval1:%#lx", td->td_retval[1]); if (traced) { diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 97b92f8..3f10669 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1705,103 +1705,6 @@ vfs_copyopt(opts, name, dest, len) return (ENOENT); } -/* - * These are helper functions for filesystems to traverse all - * their vnodes. See MNT_VNODE_FOREACH() in sys/mount.h. - * - * This interface has been deprecated in favor of MNT_VNODE_FOREACH_ALL. - */ - -MALLOC_DECLARE(M_VNODE_MARKER); - -struct vnode * -__mnt_vnode_next(struct vnode **mvp, struct mount *mp) -{ - struct vnode *vp; - - mtx_assert(MNT_MTX(mp), MA_OWNED); - - KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch")); - if (should_yield()) { - MNT_IUNLOCK(mp); - kern_yield(PRI_USER); - MNT_ILOCK(mp); - } - vp = TAILQ_NEXT(*mvp, v_nmntvnodes); - while (vp != NULL && vp->v_type == VMARKER) - vp = TAILQ_NEXT(vp, v_nmntvnodes); - - /* Check if we are done */ - if (vp == NULL) { - __mnt_vnode_markerfree(mvp, mp); - return (NULL); - } - TAILQ_REMOVE(&mp->mnt_nvnodelist, *mvp, v_nmntvnodes); - TAILQ_INSERT_AFTER(&mp->mnt_nvnodelist, vp, *mvp, v_nmntvnodes); - return (vp); -} - -struct vnode * -__mnt_vnode_first(struct vnode **mvp, struct mount *mp) -{ - struct vnode *vp; - - mtx_assert(MNT_MTX(mp), MA_OWNED); - - vp = TAILQ_FIRST(&mp->mnt_nvnodelist); - while (vp != NULL && vp->v_type == VMARKER) - vp = TAILQ_NEXT(vp, v_nmntvnodes); - - /* Check if we are done */ - if (vp == NULL) { - *mvp = NULL; - return (NULL); - } - MNT_REF(mp); - MNT_IUNLOCK(mp); - *mvp = (struct vnode *) malloc(sizeof(struct vnode), - M_VNODE_MARKER, - M_WAITOK | M_ZERO); - MNT_ILOCK(mp); - (*mvp)->v_type = VMARKER; - - vp = TAILQ_FIRST(&mp->mnt_nvnodelist); - while (vp != NULL && vp->v_type == VMARKER) - vp = TAILQ_NEXT(vp, v_nmntvnodes); - - /* Check if we are done */ - if (vp == NULL) { - MNT_IUNLOCK(mp); - free(*mvp, M_VNODE_MARKER); - MNT_ILOCK(mp); - *mvp = NULL; - MNT_REL(mp); - return (NULL); - } - (*mvp)->v_mount = mp; - TAILQ_INSERT_AFTER(&mp->mnt_nvnodelist, vp, *mvp, v_nmntvnodes); - return (vp); -} - - -void -__mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp) -{ - - if (*mvp == NULL) - return; - - mtx_assert(MNT_MTX(mp), MA_OWNED); - - KASSERT((*mvp)->v_mount == mp, ("marker vnode mount list mismatch")); - TAILQ_REMOVE(&mp->mnt_nvnodelist, *mvp, v_nmntvnodes); - MNT_IUNLOCK(mp); - free(*mvp, M_VNODE_MARKER); - MNT_ILOCK(mp); - *mvp = NULL; - MNT_REL(mp); -} - int __vfs_statfs(struct mount *mp, struct statfs *sbp) { diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 683daed..7c243b6 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -4724,12 +4724,6 @@ mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *mp) *mvp = NULL; } -#ifdef SMP -#define ALWAYS_YIELD (mp_ncpus == 1) -#else -#define ALWAYS_YIELD 1 -#endif - static struct vnode * mnt_vnode_next_active(struct vnode **mvp, struct mount *mp) { @@ -4746,7 +4740,7 @@ restart: continue; } if (!VI_TRYLOCK(vp)) { - if (ALWAYS_YIELD || should_yield()) { + if (mp_ncpus == 1 || should_yield()) { TAILQ_INSERT_BEFORE(vp, *mvp, v_actfreelist); mtx_unlock(&vnode_free_list_mtx); kern_yield(PRI_USER); @@ -4777,7 +4771,6 @@ restart: KASSERT((vp->v_iflag & VI_ACTIVE) != 0, ("Non-active vp %p", vp)); return (vp); } -#undef ALWAYS_YIELD struct vnode * __mnt_vnode_next_active(struct vnode **mvp, struct mount *mp) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 3f65b05..bbe837a 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1434,6 +1434,40 @@ vn_closefile(fp, td) * proceed. If a suspend request is in progress, we wait until the * suspension is over, and then proceed. */ +static int +vn_start_write_locked(struct mount *mp, int flags) +{ + int error; + + mtx_assert(MNT_MTX(mp), MA_OWNED); + error = 0; + + /* + * Check on status of suspension. + */ + if ((curthread->td_pflags & TDP_IGNSUSP) == 0 || + mp->mnt_susp_owner != curthread) { + while ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { + if (flags & V_NOWAIT) { + error = EWOULDBLOCK; + goto unlock; + } + error = msleep(&mp->mnt_flag, MNT_MTX(mp), + (PUSER - 1) | (flags & PCATCH), "suspfs", 0); + if (error) + goto unlock; + } + } + if (flags & V_XSLEEP) + goto unlock; + mp->mnt_writeopcount++; +unlock: + if (error != 0 || (flags & V_XSLEEP) != 0) + MNT_REL(mp); + MNT_IUNLOCK(mp); + return (error); +} + int vn_start_write(vp, mpp, flags) struct vnode *vp; @@ -1470,30 +1504,7 @@ vn_start_write(vp, mpp, flags) if (vp == NULL) MNT_REF(mp); - /* - * Check on status of suspension. - */ - if ((curthread->td_pflags & TDP_IGNSUSP) == 0 || - mp->mnt_susp_owner != curthread) { - while ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { - if (flags & V_NOWAIT) { - error = EWOULDBLOCK; - goto unlock; - } - error = msleep(&mp->mnt_flag, MNT_MTX(mp), - (PUSER - 1) | (flags & PCATCH), "suspfs", 0); - if (error) - goto unlock; - } - } - if (flags & V_XSLEEP) - goto unlock; - mp->mnt_writeopcount++; -unlock: - if (error != 0 || (flags & V_XSLEEP) != 0) - MNT_REL(mp); - MNT_IUNLOCK(mp); - return (error); + return (vn_start_write_locked(mp, flags)); } /* @@ -1639,8 +1650,7 @@ vfs_write_suspend(mp) * Request a filesystem to resume write operations. */ void -vfs_write_resume(mp) - struct mount *mp; +vfs_write_resume_flags(struct mount *mp, int flags) { MNT_ILOCK(mp); @@ -1652,10 +1662,26 @@ vfs_write_resume(mp) wakeup(&mp->mnt_writeopcount); wakeup(&mp->mnt_flag); curthread->td_pflags &= ~TDP_IGNSUSP; + if ((flags & VR_START_WRITE) != 0) { + MNT_REF(mp); + mp->mnt_writeopcount++; + } MNT_IUNLOCK(mp); - VFS_SUSP_CLEAN(mp); - } else + if ((flags & VR_NO_SUSPCLR) == 0) + VFS_SUSP_CLEAN(mp); + } else if ((flags & VR_START_WRITE) != 0) { + MNT_REF(mp); + vn_start_write_locked(mp, 0); + } else { MNT_IUNLOCK(mp); + } +} + +void +vfs_write_resume(struct mount *mp) +{ + + vfs_write_resume_flags(mp, 0); } /* diff --git a/sys/mips/atheros/ar71xx_pci.c b/sys/mips/atheros/ar71xx_pci.c index 126537c..9b88f60 100644 --- a/sys/mips/atheros/ar71xx_pci.c +++ b/sys/mips/atheros/ar71xx_pci.c @@ -81,6 +81,7 @@ struct ar71xx_pci_softc { device_t sc_dev; int sc_busno; + int sc_baseslot; struct rman sc_mem_rman; struct rman sc_irq_rman; @@ -395,6 +396,16 @@ ar71xx_pci_attach(device_t dev) AR71XX_PCI_IRQ_END) != 0) panic("ar71xx_pci_attach: failed to set up IRQ rman"); + /* + * Check if there is a base slot hint. Otherwise use default value. + */ + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "baseslot", &sc->sc_baseslot) != 0) { + device_printf(dev, + "%s: missing hint '%s', default to AR71XX_PCI_BASE_SLOT\n", + __func__, "baseslot"); + sc->sc_baseslot = AR71XX_PCI_BASE_SLOT; + } ATH_WRITE_REG(AR71XX_PCI_INTR_STATUS, 0); ATH_WRITE_REG(AR71XX_PCI_INTR_MASK, 0); @@ -648,11 +659,13 @@ ar71xx_pci_maxslots(device_t dev) static int ar71xx_pci_route_interrupt(device_t pcib, device_t device, int pin) { - if (pci_get_slot(device) < AR71XX_PCI_BASE_SLOT) + struct ar71xx_pci_softc *sc = device_get_softc(pcib); + + if (pci_get_slot(device) < sc->sc_baseslot) panic("%s: PCI slot %d is less then AR71XX_PCI_BASE_SLOT", __func__, pci_get_slot(device)); - return (pci_get_slot(device) - AR71XX_PCI_BASE_SLOT); + return (pci_get_slot(device) - sc->sc_baseslot); } static device_method_t ar71xx_pci_methods[] = { diff --git a/sys/mips/beri/beri_machdep.c b/sys/mips/beri/beri_machdep.c index 8bcd529..f2ef5a7 100644 --- a/sys/mips/beri/beri_machdep.c +++ b/sys/mips/beri/beri_machdep.c @@ -1,7 +1,12 @@ /*- * Copyright (c) 2006 Wojciech A. Koszek <wkoszek@FreeBSD.org> + * Copyright (c) 2012 Robert N. M. Watson * All rights reserved. * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -27,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include "opt_ddb.h" +#include "opt_platform.h" #include <sys/param.h> #include <sys/conf.h> @@ -49,6 +55,11 @@ __FBSDID("$FreeBSD$"); #include <sys/sysproto.h> #include <sys/user.h> +#ifdef FDT +#include <dev/fdt/fdt_common.h> +#include <dev/ofw/openfirm.h> +#endif + #include <vm/vm.h> #include <vm/vm_object.h> #include <vm/vm_page.h> @@ -76,6 +87,17 @@ mips_init(void) { int i; +#ifdef FDT +#ifndef FDT_DTB_STATIC +#error "mips_init with FDT requires FDT_DTB_STATIC" +#endif + + if (OF_install(OFW_FDT, 0) == FALSE) + while (1); + if (OF_init(&fdt_static_dtb) != 0) + while (1); +#endif + for (i = 0; i < 10; i++) { phys_avail[i] = 0; } diff --git a/sys/mips/conf/OCTEON1 b/sys/mips/conf/OCTEON1 index 1d637d8..3ddb164 100644 --- a/sys/mips/conf/OCTEON1 +++ b/sys/mips/conf/OCTEON1 @@ -39,6 +39,7 @@ makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols # Board-specific support that cannot be auto-detected at runtime. #options OCTEON_VENDOR_LANNER # Support for Lanner boards. #options OCTEON_VENDOR_RADISYS # Support for Radisys boards. +#options OCTEON_VENDOR_UBIQUITI # Support for Ubiquiti boards. #options OCTEON_BOARD_CAPK_0100ND # Support for CAPK-0100nd. # Compile for a specified Octeon model. If not specified, support for diff --git a/sys/modules/ath/Makefile b/sys/modules/ath/Makefile index dcd6423..7e65785 100644 --- a/sys/modules/ath/Makefile +++ b/sys/modules/ath/Makefile @@ -37,7 +37,7 @@ ATH_RATE?= sample # tx rate control algorithm KMOD= if_ath SRCS= if_ath.c if_ath_alq.c if_ath_debug.c if_ath_keycache.c if_ath_sysctl.c SRCS+= if_ath_tx.c if_ath_tx_ht.c if_ath_led.c if_ath_rx.c if_ath_tdma.c -SRCS+= if_ath_beacon.c if_ath_rx_edma.c if_ath_tx_edma.c +SRCS+= if_ath_beacon.c if_ath_rx_edma.c if_ath_tx_edma.c if_ath_spectral.c # NB: v3 eeprom support used by both AR5211 and AR5212; just include it SRCS+= ah_osdep.c ah.c ah_regdomain.c ah_eeprom_v3.c SRCS+= device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h @@ -89,7 +89,7 @@ SRCS+= ah_eeprom_v14.c ah_eeprom_v4k.c \ ar5416_ani.c ar5416_attach.c ar5416_beacon.c ar5416_btcoex.c \ ar5416_cal.c ar5416_cal_iq.c ar5416_cal_adcgain.c ar5416_cal_adcdc.c \ ar5416_eeprom.c ar5416_gpio.c ar5416_interrupts.c ar5416_keycache.c \ - ar5416_misc.c ar5416_phy.c ar5416_power.c ar5416_radar.c \ + ar5416_misc.c ar5416_phy.c ar5416_power.c ar5416_radar.c ar5416_spectral.c \ ar5416_recv.c ar5416_reset.c ar5416_xmit.c # RF backend for 5416, 9130 and 9160 diff --git a/sys/net/if_pfsync.h b/sys/net/if_pfsync.h index 5e71dd8..a84a0b8 100644 --- a/sys/net/if_pfsync.h +++ b/sys/net/if_pfsync.h @@ -1,6 +1,4 @@ -/* $OpenBSD: if_pfsync.h,v 1.35 2008/06/29 08:42:15 mcbride Exp $ */ - -/* +/*- * Copyright (c) 2001 Michael Shalayeff * All rights reserved. * @@ -26,7 +24,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 2008 David Gwynne <dlg@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any @@ -42,6 +40,12 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +/* + * $OpenBSD: if_pfsync.h,v 1.35 2008/06/29 08:42:15 mcbride Exp $ + * $FreeBSD$ + */ + + #ifndef _NET_IF_PFSYNC_H_ #define _NET_IF_PFSYNC_H_ @@ -63,20 +67,6 @@ #define PFSYNC_ACT_EOF 12 /* end of frame */ #define PFSYNC_ACT_MAX 13 -#define PFSYNC_ACTIONS "CLR ST", \ - "INS ST", \ - "INS ST ACK", \ - "UPD ST", \ - "UPD ST COMP", \ - "UPD ST REQ", \ - "DEL ST", \ - "DEL ST COMP", \ - "INS FR", \ - "DEL FR", \ - "BULK UPD STAT", \ - "TDB UPD", \ - "EOF" - #define PFSYNC_HMAC_LEN 20 /* diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index c7ea06c..c8f2ec8 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -127,6 +127,11 @@ static int stf_route_cache = 1; SYSCTL_INT(_net_link_stf, OID_AUTO, route_cache, CTLFLAG_RW, &stf_route_cache, 0, "Caching of IPv4 routes for 6to4 Output"); +static int stf_permit_rfc1918 = 0; +TUNABLE_INT("net.link.stf.permit_rfc1918", &stf_permit_rfc1918); +SYSCTL_INT(_net_link_stf, OID_AUTO, permit_rfc1918, CTLFLAG_RW | CTLFLAG_TUN, + &stf_permit_rfc1918, 0, "Permit the use of private IPv4 addresses"); + #define STFUNIT 0 #define IN6_IS_ADDR_6TO4(x) (ntohs((x)->s6_addr16[0]) == 0x2002) @@ -581,9 +586,10 @@ isrfc1918addr(in) * returns 1 if private address range: * 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 */ - if ((ntohl(in->s_addr) & 0xff000000) >> 24 == 10 || + if (stf_permit_rfc1918 == 0 && ( + (ntohl(in->s_addr) & 0xff000000) >> 24 == 10 || (ntohl(in->s_addr) & 0xfff00000) >> 16 == 172 * 256 + 16 || - (ntohl(in->s_addr) & 0xffff0000) >> 16 == 192 * 256 + 168) + (ntohl(in->s_addr) & 0xffff0000) >> 16 == 192 * 256 + 168)) return 1; return 0; diff --git a/sys/net/zlib.c b/sys/net/zlib.c index 8fc8cab..b348248 100644 --- a/sys/net/zlib.c +++ b/sys/net/zlib.c @@ -25,7 +25,14 @@ #define MY_ZCALLOC #if defined(__FreeBSD__) && defined(_KERNEL) -#define inflate inflate_ppp /* FreeBSD already has an inflate :-( */ +#define _tr_init _zlib104_tr_init +#define _tr_align _zlib104_tr_align +#define _tr_tally _zlib104_tr_tally +#define _tr_flush_block _zlib104_tr_flush_block +#define _tr_stored_block _zlib104_tr_stored_block +#define inflate_fast _zlib104_inflate_fast +#define inflate _zlib104_inflate +#define zlibVersion _zlib104_Version #endif diff --git a/sys/net/zlib.h b/sys/net/zlib.h index 44aa425..04941df 100644 --- a/sys/net/zlib.h +++ b/sys/net/zlib.h @@ -511,7 +511,7 @@ extern int EXPORT inflateInit OF((z_streamp strm)); */ #if defined(__FreeBSD__) && defined(_KERNEL) -#define inflate inflate_ppp /* FreeBSD already has an inflate :-( */ +#define inflate _zlib104_inflate /* FreeBSD already has an inflate :-( */ #endif extern int EXPORT inflate OF((z_streamp strm, int flush)); diff --git a/sys/net80211/ieee80211_hostap.c b/sys/net80211/ieee80211_hostap.c index 675f3da..7087748 100644 --- a/sys/net80211/ieee80211_hostap.c +++ b/sys/net80211/ieee80211_hostap.c @@ -2324,5 +2324,19 @@ ieee80211_recv_pspoll(struct ieee80211_node *ni, struct mbuf *m0) ifp = vap->iv_ic->ic_ifp; else ifp = vap->iv_ifp; - (void) ifp->if_transmit(ifp, m); + + /* + * Free any node ref which this mbuf may have. + * + * Much like psq_mfree(), we assume that M_ENCAP nodes have + * node references. + */ + if (ifp->if_transmit(ifp, m) != 0) { + /* + * XXX m is invalid (freed) at this point, determine M_ENCAP + * an alternate way. + */ + if (ifp == vap->iv_ic->ic_ifp) + ieee80211_free_node(ni); + } } diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index fcc4af1..2f8ec85 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -1227,6 +1227,8 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, struct mbuf *m, *next; uint32_t metric = 0; const uint8_t *addr; + int is_encap; + struct ieee80211_node *ni_encap; if (ni == vap->iv_bss || ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) @@ -1403,11 +1405,21 @@ hwmp_recv_prep(struct ieee80211vap *vap, struct ieee80211_node *ni, (struct ieee80211_node *)(uintptr_t) ieee80211_mac_hash(ic, addr)); /* either dest or ext_dest */ for (; m != NULL; m = next) { + is_encap = !! (m->m_flags & M_ENCAP); + ni_encap = (struct ieee80211_node *) m->m_pkthdr.rcvif; next = m->m_nextpkt; m->m_nextpkt = NULL; IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni, "flush queued frame %p len %d", m, m->m_pkthdr.len); - ifp->if_transmit(ifp, m); + + /* + * If the mbuf has M_ENCAP set, ensure we free it. + * Note that after if_transmit() is called, m is invalid. + */ + if (ifp->if_transmit(ifp, m) != 0) { + if (is_encap) + ieee80211_free_node(ni_encap); + } } #undef IS_PROXY #undef PROXIED_BY_US diff --git a/sys/net80211/ieee80211_radiotap.h b/sys/net80211/ieee80211_radiotap.h index f11ba73..388d70e 100644 --- a/sys/net80211/ieee80211_radiotap.h +++ b/sys/net80211/ieee80211_radiotap.h @@ -194,9 +194,20 @@ enum ieee80211_radiotap_type { IEEE80211_RADIOTAP_ANTENNA = 11, IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, IEEE80211_RADIOTAP_DB_ANTNOISE = 13, - /* NB: gap for netbsd definitions */ + /* + * 14-17 are from Linux, they overlap the netbsd-specific + * fields. + */ + IEEE80211_RADIOTAP_RX_FLAGS = 14, + IEEE80211_RADIOTAP_TX_FLAGS = 15, + IEEE80211_RADIOTAP_RTS_RETRIES = 16, + IEEE80211_RADIOTAP_DATA_RETRIES = 17, + IEEE80211_RADIOTAP_XCHANNEL = 18, IEEE80211_RADIOTAP_MCS = 19, + IEEE80211_RADIOTAP_AMPDU_STATUS = 20, + + IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29, IEEE80211_RADIOTAP_VENDOREXT = 30, IEEE80211_RADIOTAP_EXT = 31, }; diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index 6de270f..d43d51b 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -398,6 +398,12 @@ static const STRUCT_USB_HOST_ID ubt_devs[] = /* AVM USB Bluetooth-Adapter BlueFritz! v2.0 */ { USB_VPI(USB_VENDOR_AVM, 0x3800, 0) }, + + /* Broadcom USB dongles, mostly BCM20702 and BCM20702A0 */ + { USB_VENDOR(USB_VENDOR_BROADCOM), + USB_IFACE_CLASS(UICLASS_VENDOR), + USB_IFACE_SUBCLASS(UDSUBCLASS_RF), + USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) }, }; /* @@ -1760,7 +1766,7 @@ static device_method_t ubt_methods[] = DEVMETHOD(device_probe, ubt_probe), DEVMETHOD(device_attach, ubt_attach), DEVMETHOD(device_detach, ubt_detach), - { 0, 0 } + DEVMETHOD_END }; static driver_t ubt_driver = diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 6cb37e5..2b805c6 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -819,19 +819,14 @@ in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin, return (error); /* - * Give the interface a chance to initialize if this is its first - * address, and to validate the address if necessary. - * - * Historically, drivers managed IFF_UP flag theirselves, so we - * need to check whether driver did that. + * Give the interface a chance to initialize + * if this is its first address, + * and to validate the address if necessary. */ - flags = ifp->if_flags; if (ifp->if_ioctl != NULL && (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia)) != 0) /* LIST_REMOVE(ia, ia_hash) is done in in_control */ return (error); - if ((ifp->if_flags & IFF_UP) && (flags & IFF_UP) == 0) - if_up(ifp); /* * Be compatible with network classes, if netmask isn't supplied, diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c index 04ac4b5..4bd8cb8 100644 --- a/sys/netinet/sctp_pcb.c +++ b/sys/netinet/sctp_pcb.c @@ -2694,9 +2694,9 @@ sctp_inpcb_bind(struct socket *so, struct sockaddr *addr, ip_inp = (struct inpcb *)so->so_pcb; #ifdef SCTP_DEBUG if (addr) { - SCTPDBG(SCTP_DEBUG_PCB1, "Bind called port:%d\n", + SCTPDBG(SCTP_DEBUG_PCB1, "Bind called port: %d\n", ntohs(((struct sockaddr_in *)addr)->sin_port)); - SCTPDBG(SCTP_DEBUG_PCB1, "Addr :"); + SCTPDBG(SCTP_DEBUG_PCB1, "Addr: "); SCTPDBG_ADDR(SCTP_DEBUG_PCB1, addr); } #endif diff --git a/sys/netinet/sctp_usrreq.c b/sys/netinet/sctp_usrreq.c index 3d1e31d..0596f87 100644 --- a/sys/netinet/sctp_usrreq.c +++ b/sys/netinet/sctp_usrreq.c @@ -547,27 +547,21 @@ try_again: static int sctp_bind(struct socket *so, struct sockaddr *addr, struct thread *p) { - struct sctp_inpcb *inp = NULL; - int error; + struct sctp_inpcb *inp; -#ifdef INET - if (addr && addr->sa_family != AF_INET) { - /* must be a v4 address! */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); - return (EINVAL); - } -#endif /* INET6 */ - if (addr && (addr->sa_len != sizeof(struct sockaddr_in))) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); - return (EINVAL); - } inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } - error = sctp_inpcb_bind(so, addr, NULL, p); - return (error); + if (addr != NULL) { + if ((addr->sa_family != AF_INET) || + (addr->sa_len != sizeof(struct sockaddr_in))) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); + return (EINVAL); + } + } + return (sctp_inpcb_bind(so, addr, NULL, p)); } #endif diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c index 2f16782..1fadf6b 100644 --- a/sys/netinet/sctputil.c +++ b/sys/netinet/sctputil.c @@ -4955,7 +4955,7 @@ sctp_get_ifa_hash_val(struct sockaddr *addr) } #endif #ifdef INET6 - case INET6: + case AF_INET6: { struct sockaddr_in6 *sin6; uint32_t hash_of_addr; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 08dd259..e260e5d 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1874,18 +1874,9 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia, ia->ia_addr = *sin6; if (ifacount <= 1 && ifp->if_ioctl) { - int flags; - - /* - * Historically, drivers managed IFF_UP flag theirselves, so we - * need to check whether driver did that. - */ - flags = ifp->if_flags; error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia); if (error) return (error); - if ((ifp->if_flags & IFF_UP) && (flags & IFF_UP) == 0) - if_up(ifp); } ia->ia_ifa.ifa_metric = ifp->if_metric; diff --git a/sys/netinet6/scope6.c b/sys/netinet6/scope6.c index 060fe59..74d034e 100644 --- a/sys/netinet6/scope6.c +++ b/sys/netinet6/scope6.c @@ -420,33 +420,34 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, u_int32_t *ret_id) u_int32_t zoneid = 0; struct scope6_id *sid; - IF_AFDATA_RLOCK(ifp); - - sid = SID(ifp); - -#ifdef DIAGNOSTIC - if (sid == NULL) { /* should not happen */ - panic("in6_setscope: scope array is NULL"); - /* NOTREACHED */ - } -#endif - /* * special case: the loopback address can only belong to a loopback * interface. */ if (IN6_IS_ADDR_LOOPBACK(in6)) { if (!(ifp->if_flags & IFF_LOOPBACK)) { - IF_AFDATA_RUNLOCK(ifp); return (EINVAL); } else { if (ret_id != NULL) *ret_id = 0; /* there's no ambiguity */ - IF_AFDATA_RUNLOCK(ifp); return (0); } } + if (ret_id == NULL && !IN6_IS_SCOPE_EMBED(in6)) + return (0); + + IF_AFDATA_RLOCK(ifp); + + sid = SID(ifp); + +#ifdef DIAGNOSTIC + if (sid == NULL) { /* should not happen */ + panic("in6_setscope: scope array is NULL"); + /* NOTREACHED */ + } +#endif + scope = in6_addrscope(in6); switch (scope) { case IPV6_ADDR_SCOPE_INTFACELOCAL: /* should be interface index */ @@ -474,7 +475,7 @@ in6_setscope(struct in6_addr *in6, struct ifnet *ifp, u_int32_t *ret_id) if (ret_id != NULL) *ret_id = zoneid; - if (IN6_IS_SCOPE_LINKLOCAL(in6) || IN6_IS_ADDR_MC_INTFACELOCAL(in6)) + if (IN6_IS_SCOPE_EMBED(in6)) in6->s6_addr16[1] = htons(zoneid & 0xffff); /* XXX */ return (0); diff --git a/sys/netpfil/pf/if_pflog.c b/sys/netpfil/pf/if_pflog.c index 4714543..b9e716b 100644 --- a/sys/netpfil/pf/if_pflog.c +++ b/sys/netpfil/pf/if_pflog.c @@ -1,5 +1,4 @@ -/* $OpenBSD: if_pflog.c,v 1.26 2007/10/18 21:58:18 mpf Exp $ */ -/* +/*- * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and * Niels Provos (provos@physnet.uni-hamburg.de). @@ -31,6 +30,8 @@ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR * PURPOSE. + * + * $OpenBSD: if_pflog.c,v 1.26 2007/10/18 21:58:18 mpf Exp $ */ #include <sys/cdefs.h> diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index f45ca85..141ee6d 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1,7 +1,6 @@ -/* $OpenBSD: if_pfsync.c,v 1.110 2009/02/24 05:39:19 dlg Exp $ */ - -/* +/*- * Copyright (c) 2002 Michael Shalayeff + * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +25,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -/* +/*- * Copyright (c) 2009 David Gwynne <dlg@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any @@ -43,6 +42,8 @@ */ /* + * $OpenBSD: if_pfsync.c,v 1.110 2009/02/24 05:39:19 dlg Exp $ + * * Revisions picked from OpenBSD after revision 1.110 import: * 1.119 - don't m_copydata() beyond the len of mbuf in pfsync_input() * 1.118, 1.124, 1.148, 1.149, 1.151, 1.171 - fixes to bulk updates diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 5d5e797..6667d7a 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1,8 +1,7 @@ -/* $OpenBSD: pf.c,v 1.634 2009/02/27 12:37:45 henning Exp $ */ - -/* +/*- * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2002 - 2008 Henning Brauer + * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,10 +32,10 @@ * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F30602-01-2-0537. * + * $OpenBSD: pf.c,v 1.634 2009/02/27 12:37:45 henning Exp $ */ #include <sys/cdefs.h> - __FBSDID("$FreeBSD$"); #include "opt_inet.h" diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 8b93d1b..91fbeb8 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -1,10 +1,9 @@ -/* $OpenBSD: pf_if.c,v 1.54 2008/06/14 16:55:28 mk Exp $ */ - -/* - * Copyright 2005 Henning Brauer <henning@openbsd.org> - * Copyright 2005 Ryan McBride <mcbride@openbsd.org> +/*- * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2003 Cedric Berger + * Copyright (c) 2005 Henning Brauer <henning@openbsd.org> + * Copyright (c) 2005 Ryan McBride <mcbride@openbsd.org> + * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,10 +29,11 @@ * 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. + * + * $OpenBSD: pf_if.c,v 1.54 2008/06/14 16:55:28 mk Exp $ */ #include <sys/cdefs.h> - __FBSDID("$FreeBSD$"); #include "opt_inet.h" diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index beb7ff8..a6d7ca5 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1,8 +1,7 @@ -/* $OpenBSD: pf_ioctl.c,v 1.213 2009/02/15 21:46:12 mbalmer Exp $ */ - -/* +/*- * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2002,2003 Henning Brauer + * Copyright (c) 2012 Gleb Smirnoff <glebius@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,6 +32,7 @@ * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F30602-01-2-0537. * + * $OpenBSD: pf_ioctl.c,v 1.213 2009/02/15 21:46:12 mbalmer Exp $ */ #include <sys/cdefs.h> diff --git a/sys/netpfil/pf/pf_lb.c b/sys/netpfil/pf/pf_lb.c index 47ad5a3..c82a121 100644 --- a/sys/netpfil/pf/pf_lb.c +++ b/sys/netpfil/pf/pf_lb.c @@ -1,6 +1,4 @@ -/* $OpenBSD: pf_lb.c,v 1.2 2009/02/12 02:13:15 sthen Exp $ */ - -/* +/*- * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2002 - 2008 Henning Brauer * All rights reserved. @@ -33,6 +31,7 @@ * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F30602-01-2-0537. * + * $OpenBSD: pf_lb.c,v 1.2 2009/02/12 02:13:15 sthen Exp $ */ #include <sys/cdefs.h> diff --git a/sys/netpfil/pf/pf_norm.c b/sys/netpfil/pf/pf_norm.c index 8683d6d..e1e9d5d 100644 --- a/sys/netpfil/pf/pf_norm.c +++ b/sys/netpfil/pf/pf_norm.c @@ -1,6 +1,4 @@ -/* $OpenBSD: pf_norm.c,v 1.114 2009/01/29 14:11:45 henning Exp $ */ - -/* +/*- * Copyright 2001 Niels Provos <provos@citi.umich.edu> * All rights reserved. * @@ -23,6 +21,8 @@ * 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. + * + * $OpenBSD: pf_norm.c,v 1.114 2009/01/29 14:11:45 henning Exp $ */ #include <sys/cdefs.h> diff --git a/sys/netpfil/pf/pf_osfp.c b/sys/netpfil/pf/pf_osfp.c index 29d4a40..b20a64e 100644 --- a/sys/netpfil/pf/pf_osfp.c +++ b/sys/netpfil/pf/pf_osfp.c @@ -1,6 +1,4 @@ -/* $OpenBSD: pf_osfp.c,v 1.14 2008/06/12 18:17:01 henning Exp $ */ - -/* +/*- * Copyright (c) 2003 Mike Frantzen <frantzen@w4g.org> * * Permission to use, copy, modify, and distribute this software for any @@ -15,6 +13,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * + * $OpenBSD: pf_osfp.c,v 1.14 2008/06/12 18:17:01 henning Exp $ */ #include <sys/cdefs.h> diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 77652a6..384e42b 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -1,6 +1,4 @@ -/* $OpenBSD: pf_ruleset.c,v 1.2 2008/12/18 15:31:37 dhill Exp $ */ - -/* +/*- * Copyright (c) 2001 Daniel Hartmeier * Copyright (c) 2002,2003 Henning Brauer * All rights reserved. @@ -33,6 +31,7 @@ * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F30602-01-2-0537. * + * $OpenBSD: pf_ruleset.c,v 1.2 2008/12/18 15:31:37 dhill Exp $ */ #include <sys/cdefs.h> diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index ac22f82..595a365 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1,6 +1,4 @@ -/* $OpenBSD: pf_table.c,v 1.79 2008/10/08 06:24:50 mcbride Exp $ */ - -/* +/*- * Copyright (c) 2002 Cedric Berger * All rights reserved. * @@ -28,6 +26,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * + * $OpenBSD: pf_table.c,v 1.79 2008/10/08 06:24:50 mcbride Exp $ */ #include <sys/cdefs.h> diff --git a/sys/pc98/conf/GENERIC b/sys/pc98/conf/GENERIC index d2f6bc0..2b048a9 100644 --- a/sys/pc98/conf/GENERIC +++ b/sys/pc98/conf/GENERIC @@ -238,45 +238,11 @@ device bpf # Berkeley packet filter #device ohci # OHCI PCI->USB interface #device ehci # EHCI PCI->USB interface (USB 2.0) #device usb # USB Bus (required) -#device udbp # USB Double Bulk Pipe devices (needs netgraph) -#device uhid # "Human Interface Devices" #device ukbd # Keyboard -#device ulpt # Printer #device umass # Disks/Mass storage - Requires scbus and da -#device ums # Mouse -#device urio # Diamond Rio 500 MP3 player -# USB Serial devices -#device uark # Technologies ARK3116 based serial adapters -#device ubsa # Belkin F5U103 and compatible serial adapters -#device ubser # BWCT console serial adapters -#device uftdi # For FTDI usb serial adapters -#device uipaq # Some WinCE based devices -#device uplcom # Prolific PL-2303 serial adapters -#device uslcom # SI Labs CP2101/CP2102 serial adapters -#device uvisor # Visor and Palm devices -#device uvscom # USB serial support for DDI pocket's PHS -# USB Ethernet, requires miibus -#device aue # ADMtek USB Ethernet -#device axe # ASIX Electronics USB Ethernet -#device cdce # Generic USB over Ethernet -#device cue # CATC USB Ethernet -#device kue # Kawasaki LSI USB Ethernet -#device rue # RealTek RTL8150 USB Ethernet -#device udav # Davicom DM9601E USB -# USB Wireless -#device rum # Ralink Technology RT2501USB wireless NICs -#device uath # Atheros AR5523 wireless NICs -#device ural # Ralink Technology RT2500USB wireless NICs -#device zyd # ZyDAS zd1211/zd1211b wireless NICs - -# FireWire support -#device firewire # FireWire bus code -#device sbp # SCSI over FireWire (Requires scbus and da) -#device fwe # Ethernet over FireWire (non-standard!) # Sound support #device sound # Generic sound driver (required) #device snd_mss # Microsoft Sound System #device "snd_sb16" # Sound Blaster 16 #device snd_sbc # Sound Blaster -#device snd_uaudio # USB Audio diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC index 7f31d43..f7c3511 100644 --- a/sys/powerpc/conf/GENERIC +++ b/sys/powerpc/conf/GENERIC @@ -41,6 +41,7 @@ options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories options UFS_GJOURNAL #Enable gjournal-based UFS journaling +options QUOTA #Enable disk quotas for UFS options MD_ROOT #MD is a potential root device options NFSCL #New Network Filesystem Client options NFSD #New Network Filesystem Server @@ -183,12 +184,6 @@ device kue # Kawasaki LSI USB Ethernet options IEEE80211_SUPPORT_MESH options AH_SUPPORT_AR5416 -# FireWire support -device firewire # FireWire bus code -# sbp(4) works for some systems but causes boot failure on others -device sbp # SCSI over FireWire (Requires scbus and da) -device fwe # Ethernet over FireWire (non-standard!) - # Misc device iicbus # I2C bus code device kiic # Keywest I2C diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64 index 0e1555d..a2a283f 100644 --- a/sys/powerpc/conf/GENERIC64 +++ b/sys/powerpc/conf/GENERIC64 @@ -40,6 +40,7 @@ options SOFTUPDATES #Enable FFS soft updates support options UFS_ACL #Support for access control lists options UFS_DIRHASH #Improve performance on big directories options UFS_GJOURNAL #Enable gjournal-based UFS journaling +options QUOTA #Enable disk quotas for UFS options MD_ROOT #MD is a potential root device options NFSCL #New Network Filesystem Client options NFSD #New Network Filesystem Server diff --git a/sys/sparc64/conf/GENERIC b/sys/sparc64/conf/GENERIC index bcd94cd..f9d3b93 100644 --- a/sys/sparc64/conf/GENERIC +++ b/sys/sparc64/conf/GENERIC @@ -36,6 +36,7 @@ options SOFTUPDATES # Enable FFS soft updates support options UFS_ACL # Support for access control lists options UFS_DIRHASH # Improve performance on big directories options UFS_GJOURNAL # Enable gjournal-based UFS journaling +options QUOTA # Enable disk quotas for UFS options MD_ROOT # MD is a potential root device options NFSCL # New Network Filesystem Client options NFSD # New Network Filesystem Server @@ -238,15 +239,6 @@ device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da -# FireWire support -device firewire # FireWire bus code -# sbp(4) works for some systems but causes boot failure on others -#device sbp # SCSI over FireWire (Requires scbus and da) -device fwe # Ethernet over FireWire (non-standard!) -device fwip # IP over FireWire (RFC 2734,3146) -device dcons # Dumb console driver -device dcons_crom # Configuration ROM for dcons - # Sound support device sound # Generic sound driver (required) device snd_audiocs # Crystal Semiconductor CS4231 diff --git a/sys/sparc64/sparc64/interrupt.S b/sys/sparc64/sparc64/interrupt.S index fc144f4..179eeb6 100644 --- a/sys/sparc64/sparc64/interrupt.S +++ b/sys/sparc64/sparc64/interrupt.S @@ -83,13 +83,13 @@ ENTRY(intr_vector) * The 2nd word points to code to execute and the 3rd is an argument * to pass. Jump to it. */ - brnz,a,pt %g3, 1f - srlx %g3, 60, %g6 + brnz,pt %g3, 1f /* * NB: Zeus CPUs set some undocumented bits in the first data word. */ - jmpl %g4, %g0 and %g3, IV_MAX - 1, %g3 + jmpl %g4, %g0 + nop /* NOTREACHED */ /* @@ -98,7 +98,8 @@ ENTRY(intr_vector) * 4 bits of the 1st data word specify a priority, and the 2nd and * 3rd a function and argument. */ -1: brnz,a,pn %g6, 2f +1: srlx %g3, 60, %g6 + brnz,a,pn %g6, 2f clr %g3 /* diff --git a/sys/sys/buf_ring.h b/sys/sys/buf_ring.h index 9f99fa2..b660d9b 100644 --- a/sys/sys/buf_ring.h +++ b/sys/sys/buf_ring.h @@ -47,25 +47,14 @@ struct buf_ring { int br_prod_size; int br_prod_mask; uint64_t br_drops; - uint64_t br_prod_bufs; - /* - * Pad out to next L2 cache line - */ - uint64_t _pad0[11]; - - volatile uint32_t br_cons_head; + volatile uint32_t br_cons_head __aligned(CACHE_LINE_SIZE); volatile uint32_t br_cons_tail; int br_cons_size; int br_cons_mask; - - /* - * Pad out to next L2 cache line - */ - uint64_t _pad1[14]; #ifdef DEBUG_BUFRING struct mtx *br_lock; #endif - void *br_ring[0]; + void *br_ring[0] __aligned(CACHE_LINE_SIZE); }; /* @@ -77,7 +66,6 @@ buf_ring_enqueue(struct buf_ring *br, void *buf) { uint32_t prod_head, prod_next; uint32_t cons_tail; - int success; #ifdef DEBUG_BUFRING int i; for (i = br->br_cons_head; i != br->br_prod_head; @@ -98,16 +86,18 @@ buf_ring_enqueue(struct buf_ring *br, void *buf) critical_exit(); return (ENOBUFS); } - - success = atomic_cmpset_int(&br->br_prod_head, prod_head, - prod_next); - } while (success == 0); + } while (!atomic_cmpset_int(&br->br_prod_head, prod_head, prod_next)); #ifdef DEBUG_BUFRING if (br->br_ring[prod_head] != NULL) panic("dangling value in enqueue"); #endif br->br_ring[prod_head] = buf; - wmb(); + + /* + * The full memory barrier also avoids that br_prod_tail store + * is reordered before the br_ring[prod_head] is full setup. + */ + mb(); /* * If there are other enqueues in progress @@ -116,7 +106,6 @@ buf_ring_enqueue(struct buf_ring *br, void *buf) */ while (br->br_prod_tail != prod_head) cpu_spinwait(); - br->br_prod_bufs++; br->br_prod_tail = prod_next; critical_exit(); return (0); @@ -154,7 +143,12 @@ buf_ring_dequeue_mc(struct buf_ring *br) #ifdef DEBUG_BUFRING br->br_ring[cons_head] = NULL; #endif - rmb(); + + /* + * The full memory barrier also avoids that br_ring[cons_read] + * load is reordered after br_cons_tail is set. + */ + mb(); /* * If there are other dequeues in progress diff --git a/sys/sys/copyright.h b/sys/sys/copyright.h index 0bc59b7..08d0ec0 100644 --- a/sys/sys/copyright.h +++ b/sys/sys/copyright.h @@ -1,5 +1,5 @@ /*- - * Copyright (C) 1992-2012 The FreeBSD Project. All rights reserved. + * Copyright (C) 1992-2013 The FreeBSD Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,7 +30,7 @@ /* FreeBSD */ #define COPYRIGHT_FreeBSD \ - "Copyright (c) 1992-2012 The FreeBSD Project.\n" + "Copyright (c) 1992-2013 The FreeBSD Project.\n" /* Foundation */ #define TRADEMARK_Foundation \ diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 6444b07..22742c9 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -396,7 +396,7 @@ extern uma_zone_t zone_ext_refcnt; static __inline struct mbuf *m_getcl(int how, short type, int flags); static __inline struct mbuf *m_get(int how, short type); static __inline struct mbuf *m_get2(int how, short type, int flags, - int size); + u_int size); static __inline struct mbuf *m_gethdr(int how, short type); static __inline struct mbuf *m_getjcl(int how, short type, int flags, int size); @@ -548,7 +548,7 @@ m_getcl(int how, short type, int flags) * XXX: This is rather large, should be real function maybe. */ static __inline struct mbuf * -m_get2(int how, short type, int flags, int size) +m_get2(int how, short type, int flags, u_int size) { struct mb_args args; struct mbuf *m, *n; diff --git a/sys/sys/mount.h b/sys/sys/mount.h index ed2b002..992227c 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -225,29 +225,6 @@ void __mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *); #define MNT_VNODE_FOREACH_ACTIVE_ABORT(mp, mvp) \ __mnt_vnode_markerfree_active(&(mvp), (mp)) -/* - * Definitions for MNT_VNODE_FOREACH. - * - * This interface has been deprecated in favor of MNT_VNODE_FOREACH_ALL. - */ -struct vnode *__mnt_vnode_next(struct vnode **mvp, struct mount *mp); -struct vnode *__mnt_vnode_first(struct vnode **mvp, struct mount *mp); -void __mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp); - -#define MNT_VNODE_FOREACH(vp, mp, mvp) \ - for (vp = __mnt_vnode_first(&(mvp), (mp)); \ - (vp) != NULL; vp = __mnt_vnode_next(&(mvp), (mp))) - -#define MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp) \ - __mnt_vnode_markerfree(&(mvp), (mp)) - -#define MNT_VNODE_FOREACH_ABORT(mp, mvp) \ - do { \ - MNT_ILOCK(mp); \ - MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp); \ - MNT_IUNLOCK(mp); \ - } while (0) - #define MNT_ILOCK(mp) mtx_lock(&(mp)->mnt_mtx) #define MNT_ITRYLOCK(mp) mtx_trylock(&(mp)->mnt_mtx) #define MNT_IUNLOCK(mp) mtx_unlock(&(mp)->mnt_mtx) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 42f9e5f..f487f37 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -392,6 +392,9 @@ extern int vttoif_tab[]; #define V_NOWAIT 0x0002 /* vn_start_write: don't sleep for suspend */ #define V_XSLEEP 0x0004 /* vn_start_write: just return after sleep */ +#define VR_START_WRITE 0x0001 /* vfs_write_resume: start write atomically */ +#define VR_NO_SUSPCLR 0x0002 /* vfs_write_resume: do not clear suspension */ + #define VREF(vp) vref(vp) #ifdef DIAGNOSTIC @@ -701,6 +704,7 @@ int vn_io_fault_uiomove(char *data, int xfersize, struct uio *uio); int vfs_cache_lookup(struct vop_lookup_args *ap); void vfs_timestamp(struct timespec *); void vfs_write_resume(struct mount *mp); +void vfs_write_resume_flags(struct mount *mp, int flags); int vfs_write_suspend(struct mount *mp); int vop_stdbmap(struct vop_bmap_args *); int vop_stdfsync(struct vop_fsync_args *); diff --git a/sys/tools/vnode_if.awk b/sys/tools/vnode_if.awk index fc12ce9..c991458 100644 --- a/sys/tools/vnode_if.awk +++ b/sys/tools/vnode_if.awk @@ -270,7 +270,7 @@ while ((getline < srcfile) > 0) { ctrargs = 4; else ctrargs = numargs; - ctrstr = ctrargs "(KTR_VOP, \"VOP\", \"" uname "\", a,\n\t "; + ctrstr = ctrargs "(KTR_VOP, \"VOP\", \"" uname "\", (uintptr_t)a,\n\t "; ctrstr = ctrstr "\"" args[0] ":0x%jX\", (uintptr_t)a->a_" args[0]; for (i = 1; i < ctrargs; ++i) ctrstr = ctrstr ", \"" args[i] ":0x%jX\", a->a_" args[i]; diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index e528509..5f67ae5 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -687,8 +687,7 @@ out1: /* * Resume operation on filesystem. */ - vfs_write_resume(vp->v_mount); - vn_start_write(NULL, &wrtmp, V_WAIT); + vfs_write_resume_flags(vp->v_mount, VR_START_WRITE | VR_NO_SUSPCLR); if (collectsnapstats && starttime.tv_sec > 0) { nanotime(&endtime); timespecsub(&endtime, &starttime); diff --git a/sys/x86/include/specialreg.h b/sys/x86/include/specialreg.h index 0f5d0b9..dbf9ba0 100644 --- a/sys/x86/include/specialreg.h +++ b/sys/x86/include/specialreg.h @@ -68,6 +68,7 @@ #define CR4_PCE 0x00000100 /* Performance monitoring counter enable */ #define CR4_FXSR 0x00000200 /* Fast FPU save/restore used by OS */ #define CR4_XMM 0x00000400 /* enable SIMD/MMX2 to use except 16 */ +#define CR4_VMXE 0x00002000 /* enable VMX operation (Intel-specific) */ #define CR4_FSGSBASE 0x00010000 /* Enable FS/GS BASE accessing instructions */ #define CR4_PCIDE 0x00020000 /* Enable Context ID */ #define CR4_XSAVE 0x00040000 /* XSETBV/XGETBV */ @@ -310,6 +311,7 @@ #define MSR_APICBASE 0x01b #define MSR_EBL_CR_POWERON 0x02a #define MSR_TEST_CTL 0x033 +#define MSR_IA32_FEATURE_CONTROL 0x03a #define MSR_BIOS_UPDT_TRIG 0x079 #define MSR_BBL_CR_D0 0x088 #define MSR_BBL_CR_D1 0x089 diff --git a/tools/build/make_check/Makefile b/tools/build/make_check/Makefile index 3a0f6ad..9df224f 100644 --- a/tools/build/make_check/Makefile +++ b/tools/build/make_check/Makefile @@ -24,7 +24,7 @@ SMAKE= MAKEFLAGS= ${MAKE} -C ${.CURDIR} all: @echo '1..16' - @${SMAKE} C_check || { cd ${.CURDIR} ; ${MAKE} failure ; } + @${SMAKE} C_check || { ${MAKE} -C ${.CURDIR} failure ; } @echo "ok 1 - C_check # Test of -C flag existence detected no regression." @echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \ diff -u ${.CURDIR}/regress.variables.out - || \ diff --git a/tools/build/options/WITHOUT_LZMA_SUPPORT b/tools/build/options/WITHOUT_LZMA_SUPPORT new file mode 100644 index 0000000..627d464 --- /dev/null +++ b/tools/build/options/WITHOUT_LZMA_SUPPORT @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build some programs without optional lzma compression support. diff --git a/tools/tools/ath/Makefile b/tools/tools/ath/Makefile index 0faadbf..c4c81ba 100644 --- a/tools/tools/ath/Makefile +++ b/tools/tools/ath/Makefile @@ -3,6 +3,6 @@ SUBDIR= arcode athdebug athdecode athkey athpoke athprom athrd athregs SUBDIR+= athstats ath_prom_read athradar athaggrstats SUBDIR+= ath_ee_v14_print ath_ee_v4k_print ath_ee_9287_print -SUBDIR+= athsurvey athratestats +SUBDIR+= athsurvey athratestats athspectral .include <bsd.subdir.mk> diff --git a/tools/tools/ath/arcode/arcode.c b/tools/tools/ath/arcode/arcode.c index 31e02cd..463b954 100644 --- a/tools/tools/ath/arcode/arcode.c +++ b/tools/tools/ath/arcode/arcode.c @@ -106,7 +106,7 @@ main(int argc, const char *argv[]) op_mark(&a); break; default: - printf("op: %s; reg: %x; val: %x\n", + printf("op: %d; reg: 0x%x; val: 0x%x\n", a.op, a.reg, a.val); } } diff --git a/tools/tools/ath/ath_prom_read/ath_prom_read.c b/tools/tools/ath/ath_prom_read/ath_prom_read.c index f123aaa..3111021 100644 --- a/tools/tools/ath/ath_prom_read/ath_prom_read.c +++ b/tools/tools/ath/ath_prom_read/ath_prom_read.c @@ -123,7 +123,7 @@ main(int argc, char *argv[]) atd.ad_out_data = (caddr_t) eep; atd.ad_out_size = sizeof(eep); if (ioctl(s, SIOCGATHDIAG, &atd) < 0) - err(1, atd.ad_name); + err(1, "ioctl: %s", atd.ad_name); /* Dump file? Then just write to it */ if (dumpname != NULL) { diff --git a/tools/tools/ath/athdebug/athdebug.c b/tools/tools/ath/athdebug/athdebug.c index 4f8f7c8..b118939 100644 --- a/tools/tools/ath/athdebug/athdebug.c +++ b/tools/tools/ath/athdebug/athdebug.c @@ -206,20 +206,20 @@ main(int argc, char *argv[]) bit = strtoul(cp, NULL, 0); else errx(1, "unknown flag %.*s", - tp-cp, cp); + (int) (tp-cp), cp); } ndebug = bit; } } while (*(cp = tp) != '\0'); } if (debug != ndebug) { - printf("%s: 0x%x => ", oid, debug); + printf("%s: 0x%llx => ", oid, (long long) debug); if (sysctlbyname(oid, NULL, NULL, &ndebug, sizeof(ndebug)) < 0) err(1, "sysctl-set(%s)", oid); - printf("0x%x", ndebug); + printf("0x%llx", (long long) ndebug); debug = ndebug; } else - printf("%s: 0x%x", oid, debug); + printf("%s: 0x%llx", oid, (long long) debug); sep = "<"; for (i = 0; i < N(flags); i++) if (debug & flags[i].bit) { diff --git a/tools/tools/ath/athdecode/main.c b/tools/tools/ath/athdecode/main.c index 1ab5c6d..701f835 100644 --- a/tools/tools/ath/athdecode/main.c +++ b/tools/tools/ath/athdecode/main.c @@ -69,7 +69,7 @@ main(int argc, char *argv[]) filename = argv[1]; fd = open(filename, O_RDONLY); if (fd < 0) - err(1, filename); + err(1, "open: %s", filename); if (fstat(fd, &sb) < 0) err(1, "fstat"); addr = mmap(0, sb.st_size, PROT_READ, MAP_PRIVATE|MAP_NOCORE, fd, 0); @@ -192,6 +192,7 @@ opmark(FILE *fd, int i, const struct athregrec *r) fprintf(fd, "mark #%u value %u/0x%x", r->reg, r->val, r->val); break; } + exit(0); } #include "ah_devid.h" @@ -302,8 +303,8 @@ register_regs(struct dumpreg *chipregs, u_int nchipregs, */ if (nr->addr == r->addr && (nr->name == r->name || - nr->name != NULL && r->name != NULL && - strcmp(nr->name, r->name) == 0)) { + (nr->name != NULL && r->name != NULL && + strcmp(nr->name, r->name) == 0))) { if (nr->srevMin < r->srevMin && (r->srevMin <= nr->srevMax && nr->srevMax+1 <= r->srevMax)) { diff --git a/tools/tools/ath/athkey/athkey.c b/tools/tools/ath/athkey/athkey.c index d254105..7604e4e 100644 --- a/tools/tools/ath/athkey/athkey.c +++ b/tools/tools/ath/athkey/athkey.c @@ -83,8 +83,8 @@ getdata(const char *arg, u_int8_t *data, size_t maxlen) } if (len > maxlen) { fprintf(stderr, - "%s: too much data in %s, max %u bytes\n", - progname, arg, maxlen); + "%s: too much data in %s, max %llu bytes\n", + progname, arg, (unsigned long long) maxlen); } data[len++] = (b0<<4) | b1; } @@ -178,7 +178,7 @@ main(int argc, char *argv[]) atd.ad_in_data = (caddr_t) &keyix; atd.ad_in_size = sizeof(u_int16_t); if (ioctl(s, SIOCGATHDIAG, &atd) < 0) - err(1, atd.ad_name); + err(1, "ioctl: %s", atd.ad_name); return 0; case HAL_DIAG_SETKEY: if (argc != 3 && argc != 4) @@ -196,7 +196,7 @@ main(int argc, char *argv[]) atd.ad_in_data = (caddr_t) &setkey; atd.ad_in_size = sizeof(setkey); if (ioctl(s, SIOCGATHDIAG, &atd) < 0) - err(1, atd.ad_name); + err(1, "ioctl: %s", atd.ad_name); return 0; } return -1; diff --git a/tools/tools/ath/athprom/athprom.c b/tools/tools/ath/athprom/athprom.c index 6f2b32b..e295fd1 100644 --- a/tools/tools/ath/athprom/athprom.c +++ b/tools/tools/ath/athprom/athprom.c @@ -159,7 +159,7 @@ main(int argc, char *argv[]) atd.ad_out_data = (caddr_t) &eep; atd.ad_out_size = sizeof(eep); if (ioctl(s, SIOCGATHDIAG, &atd) < 0) - err(1, atd.ad_name); + err(1, "ioctl: %s", atd.ad_name); if (fd == NULL) { fd = opentemplate(DIR_TEMPLATE); if (fd == NULL) @@ -186,7 +186,7 @@ eeread(u_int16_t off) atd.ad_out_size = sizeof(eedata); atd.ad_out_data = (caddr_t) &eedata; if (ioctl(s, SIOCGATHDIAG, &atd) < 0) - err(1, atd.ad_name); + err(1, "ioctl: %s", atd.ad_name); return eedata; } @@ -204,7 +204,7 @@ eewrite(uint16_t off, uint16_t value) atd.ad_out_size = 0; atd.ad_out_data = NULL; if (ioctl(s, SIOCGATHDIAG, &atd) < 0) - err(1, atd.ad_name); + err(1, "ioctl: %s", atd.ad_name); } #define MAXID 128 @@ -332,7 +332,7 @@ setmode(int mode) + sizeof(EXPN_DATA_PER_CHANNEL_5112) * exp->numChannels; atd.ad_out_data = (caddr_t) malloc(atd.ad_out_size); if (ioctl(s, SIOCGATHDIAG, &atd) < 0) - err(1, atd.ad_name); + err(1, "ioctl: %s", atd.ad_name); exp->pChannels = (void *) atd.ad_out_data; exp->pDataPerChannel = (void *)((char *)atd.ad_out_data + roundup(sizeof(u_int16_t) * exp->numChannels, sizeof(u_int32_t))); diff --git a/tools/tools/ath/athratestats/main.c b/tools/tools/ath/athratestats/main.c index 4203c9b..8d146ca 100644 --- a/tools/tools/ath/athratestats/main.c +++ b/tools/tools/ath/athratestats/main.c @@ -118,9 +118,9 @@ ath_sample_stats(struct ath_ratestats *r, struct ath_rateioctl_rt *rt, uint32_t mask; int rix, y; - PRINTMSG("static_rix (%d) ratemask 0x%x\n", + PRINTMSG("static_rix (%d) ratemask 0x%llx\n", sn->static_rix, - sn->ratemask); + (long long) sn->ratemask); for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { PRINTATTR_ON(COLOR_PAIR(y+4) | A_BOLD); @@ -203,7 +203,7 @@ ath_setifname(struct ath_ratestats *r, const char *ifname) } static void -ath_setsta(struct ath_ratestats *r, const char *mac) +ath_setsta(struct ath_ratestats *r, uint8_t *mac) { memcpy(&r->re.is_u.macaddr, mac, sizeof(r->re.is_u.macaddr)); @@ -224,7 +224,7 @@ rate_node_stats(struct ath_ratestats *r, struct ether_addr *e) struct sample_node *sn = NULL; struct ath_rateioctl_rt *rt = NULL; int error = 0; - uint8_t *buf = r->re.buf; + uint8_t *buf = (uint8_t *) r->re.buf; /* * For now, hard-code the TLV order and contents. Ew! @@ -241,7 +241,7 @@ rate_node_stats(struct ath_ratestats *r, struct ether_addr *e) fprintf(stderr, "unexpected TLV len (got %d bytes, " "expected %d bytes\n", av->tlv_len, - sizeof(struct ath_rateioctl_rt)); + (int) sizeof(struct ath_rateioctl_rt)); exit(127); } rt = (void *) (buf + sizeof(struct ath_rateioctl_tlv)); @@ -260,7 +260,7 @@ rate_node_stats(struct ath_ratestats *r, struct ether_addr *e) fprintf(stderr, "unexpected TLV len (got %d bytes, " "expected %d bytes\n", av->tlv_len, - sizeof(struct sample_node)); + (int) sizeof(struct sample_node)); exit(127); } sn = (void *) (buf + sizeof(struct ath_rateioctl_tlv) + @@ -268,6 +268,8 @@ rate_node_stats(struct ath_ratestats *r, struct ether_addr *e) sizeof(struct ath_rateioctl_tlv)); ath_sample_stats(r, rt, sn); + + return (0); } static void @@ -353,7 +355,7 @@ main(int argc, char *argv[]) if (buf == NULL) err(1, "calloc"); - r.re.buf = buf; + r.re.buf = (char *) buf; r.re.len = STATS_BUF_SIZE; r.s = socket(AF_INET, SOCK_DGRAM, 0); diff --git a/tools/tools/ath/athspectral/Makefile b/tools/tools/ath/athspectral/Makefile new file mode 100644 index 0000000..8aebde6 --- /dev/null +++ b/tools/tools/ath/athspectral/Makefile @@ -0,0 +1,16 @@ +# $FreeBSD$ + +PROG= athspectral + +.include <../Makefile.inc> + +SRCS= athspectral.c +SRCS+= opt_ah.h +CLEANFILES+= opt_ah.h + +opt_ah.h: + echo "#define AH_DEBUG 1" > opt_ah.h + echo "#define AH_DEBUG_COUNTRY 1" >> opt_ah.h + echo "#define AH_SUPPORT_AR5416 1" >> opt_ah.h + +.include <bsd.prog.mk> diff --git a/tools/tools/ath/athspectral/athspectral.c b/tools/tools/ath/athspectral/athspectral.c new file mode 100644 index 0000000..8e6962a --- /dev/null +++ b/tools/tools/ath/athspectral/athspectral.c @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2013 Adrian Chadd <adrian@FreeBSD.org> + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD$ + */ + +#include "diag.h" + +#include "ah.h" +#include "ah_internal.h" + +#ifndef ATH_DEFAULT +#define ATH_DEFAULT "ath0" +#endif + +#include <getopt.h> +#include <errno.h> +#include <err.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <unistd.h> + +struct spectralhandler { + struct ath_diag atd; + int s; + struct ifreq ifr; + int ah_devid; +}; + +int +spectral_opendev(struct spectralhandler *spectral, const char *devid) +{ + HAL_REVS revs; + + spectral->s = socket(AF_INET, SOCK_DGRAM, 0); + if (spectral->s < 0) { + warn("socket"); + return 0; + } + + strncpy(spectral->atd.ad_name, devid, sizeof (spectral->atd.ad_name)); + + /* Get the hardware revision, just to verify things are working */ + spectral->atd.ad_id = HAL_DIAG_REVS; + spectral->atd.ad_out_data = (caddr_t) &revs; + spectral->atd.ad_out_size = sizeof(revs); + if (ioctl(spectral->s, SIOCGATHDIAG, &spectral->atd) < 0) { + warn(spectral->atd.ad_name); + return 0; + } + spectral->ah_devid = revs.ah_devid; + return 1; +} + +void +spectral_closedev(struct spectralhandler *spectral) +{ + close(spectral->s); + spectral->s = -1; +} + +void +spectralset(struct spectralhandler *spectral, int op, u_int32_t param) +{ + HAL_SPECTRAL_PARAM pe; + + pe.ss_fft_period = HAL_SPECTRAL_PARAM_NOVAL; + pe.ss_period = HAL_SPECTRAL_PARAM_NOVAL; + pe.ss_count = HAL_SPECTRAL_PARAM_NOVAL; + pe.ss_short_report = HAL_SPECTRAL_PARAM_NOVAL; + pe.ss_spectral_pri = HAL_SPECTRAL_PARAM_NOVAL; + pe.ss_fft_period = HAL_SPECTRAL_PARAM_NOVAL; + pe.ss_enabled = HAL_SPECTRAL_PARAM_NOVAL; + pe.ss_active = HAL_SPECTRAL_PARAM_NOVAL; + + switch (op) { + case SPECTRAL_PARAM_FFT_PERIOD: + pe.ss_fft_period = param; + break; + case SPECTRAL_PARAM_SS_PERIOD: + pe.ss_period = param; + break; + case SPECTRAL_PARAM_SS_COUNT: + pe.ss_count = param; + break; + case SPECTRAL_PARAM_SS_SHORT_RPT: + pe.ss_short_report = param; + break; + } + + spectral->atd.ad_id = SPECTRAL_CONTROL_SET_PARAMS | ATH_DIAG_IN; + spectral->atd.ad_out_data = NULL; + spectral->atd.ad_out_size = 0; + spectral->atd.ad_in_data = (caddr_t) &pe; + spectral->atd.ad_in_size = sizeof(HAL_SPECTRAL_PARAM); + if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0) + err(1, spectral->atd.ad_name); +} + +static void +spectral_get(struct spectralhandler *spectral) +{ + HAL_SPECTRAL_PARAM pe; + + spectral->atd.ad_id = SPECTRAL_CONTROL_GET_PARAMS | ATH_DIAG_DYN; + memset(&pe, 0, sizeof(pe)); + + spectral->atd.ad_in_data = NULL; + spectral->atd.ad_in_size = 0; + spectral->atd.ad_out_data = (caddr_t) &pe; + spectral->atd.ad_out_size = sizeof(pe); + + if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0) + err(1, spectral->atd.ad_name); + + printf("Spectral parameters (raw):\n"); + printf(" ss_enabled: %d\n", pe.ss_enabled); + printf(" ss_active: %d\n", pe.ss_active); + printf(" ss_count: %d\n", pe.ss_count); + printf(" ss_fft_period: %d\n", pe.ss_fft_period); + printf(" ss_period: %d\n", pe.ss_period); + printf(" ss_short_report: %d\n", pe.ss_short_report); + printf(" radar_bin_thresh_sel: %d\n", pe.radar_bin_thresh_sel); +} + +static void +spectral_start(struct spectralhandler *spectral) +{ + HAL_SPECTRAL_PARAM pe; + + spectral->atd.ad_id = SPECTRAL_CONTROL_START | ATH_DIAG_DYN; + memset(&pe, 0, sizeof(pe)); + + /* + * XXX don't need these, but need to eliminate the ATH_DIAG_DYN flag + * and debug + */ + spectral->atd.ad_in_data = NULL; + spectral->atd.ad_in_size = 0; + spectral->atd.ad_out_data = (caddr_t) &pe; + spectral->atd.ad_out_size = sizeof(pe); + + if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0) + err(1, spectral->atd.ad_name); +} + +static void +spectral_stop(struct spectralhandler *spectral) +{ + HAL_SPECTRAL_PARAM pe; + + spectral->atd.ad_id = SPECTRAL_CONTROL_STOP | ATH_DIAG_DYN; + memset(&pe, 0, sizeof(pe)); + + /* + * XXX don't need these, but need to eliminate the ATH_DIAG_DYN flag + * and debug + */ + spectral->atd.ad_in_data = NULL; + spectral->atd.ad_in_size = 0; + spectral->atd.ad_out_data = (caddr_t) &pe; + spectral->atd.ad_out_size = sizeof(pe); + + if (ioctl(spectral->s, SIOCGATHSPECTRAL, &spectral->atd) < 0) + err(1, spectral->atd.ad_name); +} + +static int +spectral_set_param(struct spectralhandler *spectral, const char *param, + const char *val) +{ + int v; + + v = atoi(val); + + if (strcmp(param, "ss_short_report") == 0) { + spectralset(spectral, SPECTRAL_PARAM_SS_SHORT_RPT, v); + } else if (strcmp(param, "ss_fft_period") == 0) { + spectralset(spectral, SPECTRAL_PARAM_FFT_PERIOD, v); + } else if (strcmp(param, "ss_period") == 0) { + spectralset(spectral, SPECTRAL_PARAM_SS_PERIOD, v); + } else if (strcmp(param, "ss_count") == 0) { + spectralset(spectral, SPECTRAL_PARAM_SS_COUNT, v); + } else { + return (0); + } + +#if 0 + if (strcmp(param, "enabled") == 0) { + spectralset(spectral, DFS_PARAM_ENABLE, v); + } else if (strcmp(param, "firpwr") == 0) { + spectralset(spectral, DFS_PARAM_FIRPWR, v); + } else if (strcmp(param, "rrssi") == 0) { + spectralset(spectral, DFS_PARAM_RRSSI, v); + } else if (strcmp(param, "height") == 0) { + spectralset(spectral, DFS_PARAM_HEIGHT, v); + } else if (strcmp(param, "prssi") == 0) { + spectralset(spectral, DFS_PARAM_PRSSI, v); + } else if (strcmp(param, "inband") == 0) { + spectralset(spectral, DFS_PARAM_INBAND, v); + } else if (strcmp(param, "relpwr") == 0) { + spectralset(spectral, DFS_PARAM_RELPWR, v); + } else if (strcmp(param, "relstep") == 0) { + spectralset(spectral, DFS_PARAM_RELSTEP, v); + } else if (strcmp(param, "maxlen") == 0) { + spectralset(spectral, DFS_PARAM_MAXLEN, v); + } else if (strcmp(param, "usefir128") == 0) { + spectralset(spectral, DFS_PARAM_USEFIR128, v); + } else if (strcmp(param, "blockspectral") == 0) { + spectralset(spectral, DFS_PARAM_BLOCKRADAR, v); + } else if (strcmp(param, "enmaxrssi") == 0) { + spectralset(spectral, DFS_PARAM_MAXRSSI_EN, v); + } else if (strcmp(param, "extchannel") == 0) { + spectralset(spectral, DFS_PARAM_EN_EXTCH, v); + } else if (strcmp(param, "enrelpwr") == 0) { + spectralset(spectral, DFS_PARAM_RELPWR_EN, v); + } else if (strcmp(param, "en_relstep_check") == 0) { + spectralset(spectral, DFS_PARAM_RELSTEP_EN, v); + } else { + return 0; + } +#endif + + return 1; +} + +void +usage(const char *progname) +{ + printf("Usage:\n"); + printf("\t%s: [-i <interface>] <cmd> (<arg>)\n", progname); + printf("\t%s: [-h]\n", progname); + printf("\n"); + printf("Valid commands:\n"); + printf("\tget:\t\tGet current spectral parameters\n"); + printf("\tset <param> <value>:\t\tSet spectral parameter\n"); + printf("\tstart: Start spectral scan\n"); + printf("\tstop: Stop spectral scan\n"); +} + +int +main(int argc, char *argv[]) +{ + struct spectralhandler spectral; + const char *devname = ATH_DEFAULT; + const char *progname = argv[0]; + + memset(&spectral, 0, sizeof(spectral)); + + /* Parse command line options */ + if (argc >= 2 && strcmp(argv[1], "-h") == 0) { + usage(progname); + exit(0); + } + if (argc >= 2 && strcmp(argv[1], "-?") == 0) { + usage(progname); + exit(0); + } + + if (argc >= 2 && strcmp(argv[1], "-i") == 0) { + if (argc == 2) { + usage(progname); + exit(127); + } + devname = argv[2]; + argc -= 2; argv += 2; + } + + /* At this point we require at least one command */ + if (argc == 1) { + usage(progname); + exit(127); + } + + if (spectral_opendev(&spectral, devname) == 0) + exit(127); + + if (strcasecmp(argv[1], "get") == 0) { + spectral_get(&spectral); + } else if (strcasecmp(argv[1], "set") == 0) { + if (argc < 4) { + usage(progname); + exit(127); + } + if (spectral_set_param(&spectral, argv[2], argv[3]) == 0) { + usage(progname); + exit(127); + } + } else if (strcasecmp(argv[1], "start") == 0) { + spectral_start(&spectral); + } else if (strcasecmp(argv[1], "stop") == 0) { + spectral_stop(&spectral); + } else { + usage(progname); + exit(127); + } + + /* wrap up */ + spectral_closedev(&spectral); + exit(0); +} diff --git a/tools/tools/ath/athstats/Makefile b/tools/tools/ath/athstats/Makefile index 4a88eb1..1db2dc1 100644 --- a/tools/tools/ath/athstats/Makefile +++ b/tools/tools/ath/athstats/Makefile @@ -4,6 +4,10 @@ PROG= athstats +# Because of a clang preprocessor parser limitation causing this +# to not compile, use gcc for now. +CC= gcc + SRCS= main.c statfoo.c athstats.c opt_ah.h ah_osdep.h CLEANFILES+= opt_ah.h diff --git a/tools/tools/ath/athstats/athstats.c b/tools/tools/ath/athstats/athstats.c index c36dfa0..ef815bd 100644 --- a/tools/tools/ath/athstats/athstats.c +++ b/tools/tools/ath/athstats/athstats.c @@ -490,7 +490,7 @@ ath_zerostats(struct athstatfoo *wf0) struct athstatfoo_p *wf = (struct athstatfoo_p *) wf0; if (ioctl(wf->s, SIOCZATHSTATS, &wf->ifr) < 0) - err(-1, wf->ifr.ifr_name); + err(-1, "ioctl: %s", wf->ifr.ifr_name); } static void @@ -498,21 +498,21 @@ ath_collect(struct athstatfoo_p *wf, struct _athstats *stats) { wf->ifr.ifr_data = (caddr_t) &stats->ath; if (ioctl(wf->s, SIOCGATHSTATS, &wf->ifr) < 0) - err(1, wf->ifr.ifr_name); + err(1, "ioctl: %s", wf->ifr.ifr_name); #ifdef ATH_SUPPORT_ANI if (wf->optstats & ATHSTATS_ANI) { wf->atd.ad_id = 5; wf->atd.ad_out_data = (caddr_t) &stats->ani_state; wf->atd.ad_out_size = sizeof(stats->ani_state); if (ioctl(wf->s, SIOCGATHDIAG, &wf->atd) < 0) { - warn(wf->atd.ad_name); + warn("ioctl: %s", wf->atd.ad_name); wf->optstats &= ~ATHSTATS_ANI; } wf->atd.ad_id = 8; wf->atd.ad_out_data = (caddr_t) &stats->ani_stats; wf->atd.ad_out_size = sizeof(stats->ani_stats); if (ioctl(wf->s, SIOCGATHDIAG, &wf->atd) < 0) - warn(wf->atd.ad_name); + warn("ioctl: %s", wf->atd.ad_name); } #endif /* ATH_SUPPORT_ANI */ } @@ -574,12 +574,14 @@ ath_get_curstat(struct statfoo *sf, int s, char b[], size_t bs) switch (s) { case S_INPUT: snprintf(b, bs, "%lu", - (wf->cur.ath.ast_rx_packets - wf->total.ath.ast_rx_packets) - - (wf->cur.ath.ast_rx_mgt - wf->total.ath.ast_rx_mgt)); + (unsigned long) + ((wf->cur.ath.ast_rx_packets - wf->total.ath.ast_rx_packets) - + (wf->cur.ath.ast_rx_mgt - wf->total.ath.ast_rx_mgt))); return 1; case S_OUTPUT: snprintf(b, bs, "%lu", - wf->cur.ath.ast_tx_packets - wf->total.ath.ast_tx_packets); + (unsigned long) + (wf->cur.ath.ast_tx_packets - wf->total.ath.ast_tx_packets)); return 1; case S_RATE: snprintrate(b, bs, wf->cur.ath.ast_tx_rate); diff --git a/tools/tools/ath/athsurvey/athsurvey.c b/tools/tools/ath/athsurvey/athsurvey.c index e0a4cf3..df2ae4d 100644 --- a/tools/tools/ath/athsurvey/athsurvey.c +++ b/tools/tools/ath/athsurvey/athsurvey.c @@ -66,7 +66,7 @@ get_survey_stats(int s, const char *ifname, HAL_CHANNEL_SURVEY *hs) strncpy(atd.ad_name, ifname, sizeof(atd.ad_name)); if (ioctl(s, SIOCGATHDIAG, &atd) < 0) { - err(1, atd.ad_name); + err(1, "ioctl: %s", atd.ad_name); return (0); } return (1); diff --git a/tools/tools/netrate/netsend/netsend.c b/tools/tools/netrate/netsend/netsend.c index 0558253..683c823 100644 --- a/tools/tools/netrate/netsend/netsend.c +++ b/tools/tools/netrate/netsend/netsend.c @@ -144,7 +144,7 @@ timing_loop(struct _a *a) long finishtime; long send_errors, send_calls; /* do not call gettimeofday more than every 20us */ - long minres_ns = 20000; + long minres_ns = 200000; int ic, gettimeofday_cycles; int cur_port; uint64_t n, ns; @@ -154,17 +154,22 @@ timing_loop(struct _a *a) return (-1); } + ns = a->interval.tv_nsec; if (timespec_ge(&tmptime, &a->interval)) fprintf(stderr, "warning: interval (%jd.%09ld) less than resolution (%jd.%09ld)\n", (intmax_t)a->interval.tv_sec, a->interval.tv_nsec, (intmax_t)tmptime.tv_sec, tmptime.tv_nsec); - if (a->interval.tv_nsec < minres_ns) { - gettimeofday_cycles = minres_ns/(tmptime.tv_nsec + 1); - fprintf(stderr, - "calling time every %d cycles\n", gettimeofday_cycles); - } else - gettimeofday_cycles = 0; + /* interval too short, limit the number of gettimeofday() + * calls, but also make sure there is at least one every + * some 100 packets. + */ + if ((long)ns < minres_ns/100) + gettimeofday_cycles = 100; + else + gettimeofday_cycles = minres_ns/ns; + fprintf(stderr, + "calling time every %d cycles\n", gettimeofday_cycles); if (clock_gettime(CLOCK_REALTIME, &starttime) == -1) { perror("clock_gettime"); diff --git a/usr.bin/apply/apply.c b/usr.bin/apply/apply.c index f63ba31..c886660 100644 --- a/usr.bin/apply/apply.c +++ b/usr.bin/apply/apply.c @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #define EXEC "exec " -static int exec_shell(const char *, char *, char *); +static int exec_shell(const char *, const char *, const char *); static void usage(void); int @@ -222,7 +222,7 @@ main(int argc, char *argv[]) * arguments. */ static int -exec_shell(const char *command, char *use_shell, char *use_name) +exec_shell(const char *command, const char *use_shell, const char *use_name) { pid_t pid; int omask, pstat; @@ -250,7 +250,7 @@ exec_shell(const char *command, char *use_shell, char *use_name) return(pid == -1 ? -1 : pstat); } -void +static void usage(void) { diff --git a/usr.bin/dc/bcode.c b/usr.bin/dc/bcode.c index 022cf87..f17a0da 100644 --- a/usr.bin/dc/bcode.c +++ b/usr.bin/dc/bcode.c @@ -29,8 +29,6 @@ __FBSDID("$FreeBSD$"); #include "extern.h" -BIGNUM zero; - #define __inline #define MAX_ARRAY_INDEX 2048 @@ -250,8 +248,12 @@ init_bmachine(bool extended_registers) if (bmachine.readstack == NULL) err(1, NULL); bmachine.obase = bmachine.ibase = 10; - BN_init(&zero); - bn_check(BN_zero(&zero)); +} + +u_int +bmachine_scale(void) +{ + return (bmachine.scale); } /* Reset the things needed before processing a (new) file */ @@ -407,7 +409,7 @@ split_number(const struct number *n, BIGNUM *i, BIGNUM *f) } } -__inline void +void normalize(struct number *n, u_int s) { @@ -427,7 +429,7 @@ void negate(struct number *n) { - bn_check(BN_sub(n->number, &zero, n->number)); + BN_set_negative(n->number, !BN_is_negative(n->number)); } static __inline void @@ -581,7 +583,7 @@ set_scale(void) n = pop_number(); if (n != NULL) { - if (BN_cmp(n->number, &zero) < 0) + if (BN_is_negative(n->number)) warnx("scale must be a nonnegative number"); else { scale = get_ulong(n); @@ -878,7 +880,7 @@ load_array(void) if (inumber == NULL) return; idx = get_ulong(inumber); - if (BN_cmp(inumber->number, &zero) < 0) + if (BN_is_negative(inumber->number)) warnx("negative idx"); else if (idx == BN_MASK2 || idx > MAX_ARRAY_INDEX) warnx("idx too big"); @@ -917,7 +919,7 @@ store_array(void) return; } idx = get_ulong(inumber); - if (BN_cmp(inumber->number, &zero) < 0) { + if (BN_is_negative(inumber->number)) { warnx("negative idx"); stack_free_value(value); } else if (idx == BN_MASK2 || idx > MAX_ARRAY_INDEX) { @@ -1009,7 +1011,7 @@ bsub(void) } void -bmul_number(struct number *r, struct number *a, struct number *b) +bmul_number(struct number *r, struct number *a, struct number *b, u_int scale) { BN_CTX *ctx; @@ -1023,11 +1025,9 @@ bmul_number(struct number *r, struct number *a, struct number *b) bn_check(BN_mul(r->number, a->number, b->number, ctx)); BN_CTX_free(ctx); - if (rscale > bmachine.scale && rscale > ascale && rscale > bscale) { - r->scale = rscale; - normalize(r, max(bmachine.scale, max(ascale, bscale))); - } else - r->scale = rscale; + r->scale = rscale; + if (rscale > bmachine.scale && rscale > ascale && rscale > bscale) + normalize(r, max(scale, max(ascale, bscale))); } static void @@ -1046,7 +1046,7 @@ bmul(void) } r = new_number(); - bmul_number(r, a, b); + bmul_number(r, a, b, bmachine.scale); push_number(r); free_number(a); @@ -1172,7 +1172,7 @@ static void bexp(void) { struct number *a, *p, *r; - u_int scale; + u_int rscale; bool neg; p = pop_number(); @@ -1185,15 +1185,27 @@ bexp(void) return; } - if (p->scale != 0) - warnx("Runtime warning: non-zero scale in exponent"); + if (p->scale != 0) { + BIGNUM *i, *f; + i = BN_new(); + bn_checkp(i); + f = BN_new(); + bn_checkp(f); + split_number(p, i, f); + if (!BN_is_zero(f)) + warnx("Runtime warning: non-zero fractional part " + "in exponent"); + BN_free(i); + BN_free(f); + } + normalize(p, 0); neg = false; - if (BN_cmp(p->number, &zero) < 0) { + if (BN_is_negative(p->number)) { neg = true; negate(p); - scale = bmachine.scale; + rscale = bmachine.scale; } else { /* Posix bc says min(a.scale * b, max(a.scale, scale) */ u_long b; @@ -1201,30 +1213,37 @@ bexp(void) b = BN_get_word(p->number); m = max(a->scale, bmachine.scale); - scale = a->scale * (u_int)b; - if (scale > m || (a->scale > 0 && (b == BN_MASK2 || + rscale = a->scale * (u_int)b; + if (rscale > m || (a->scale > 0 && (b == BN_MASK2 || b > UINT_MAX))) - scale = m; + rscale = m; } if (BN_is_zero(p->number)) { r = new_number(); bn_check(BN_one(r->number)); - normalize(r, scale); + normalize(r, rscale); } else { + u_int ascale, mscale; + + ascale = a->scale; while (!BN_is_bit_set(p->number, 0)) { - bmul_number(a, a, a); + ascale *= 2; + bmul_number(a, a, a, ascale); bn_check(BN_rshift1(p->number, p->number)); } r = dup_number(a); - normalize(r, scale); bn_check(BN_rshift1(p->number, p->number)); + mscale = ascale; while (!BN_is_zero(p->number)) { - bmul_number(a, a, a); - if (BN_is_bit_set(p->number, 0)) - bmul_number(r, r, a); + ascale *= 2; + bmul_number(a, a, a, ascale); + if (BN_is_bit_set(p->number, 0)) { + mscale += ascale; + bmul_number(r, r, a, mscale); + } bn_check(BN_rshift1(p->number, p->number)); } @@ -1237,13 +1256,18 @@ bexp(void) bn_check(BN_one(one)); ctx = BN_CTX_new(); bn_checkp(ctx); - scale_number(one, r->scale + scale); - normalize(r, scale); - bn_check(BN_div(r->number, NULL, one, r->number, ctx)); + scale_number(one, r->scale + rscale); + + if (BN_is_zero(r->number)) + warnx("divide by zero"); + else + bn_check(BN_div(r->number, NULL, one, + r->number, ctx)); BN_free(one); BN_CTX_free(ctx); + r->scale = rscale; } else - normalize(r, scale); + normalize(r, rscale); } push_number(r); free_number(a); @@ -1282,7 +1306,7 @@ bsqrt(void) if (BN_is_zero(n->number)) { r = new_number(); push_number(r); - } else if (BN_cmp(n->number, &zero) < 0) + } else if (BN_is_negative(n->number)) warnx("square root of negative number"); else { scale = max(bmachine.scale, n->scale); diff --git a/usr.bin/dc/bcode.h b/usr.bin/dc/bcode.h index 9290cf1..7dc5d2d 100644 --- a/usr.bin/dc/bcode.h +++ b/usr.bin/dc/bcode.h @@ -85,6 +85,7 @@ struct source { void init_bmachine(bool); void reset_bmachine(struct source *); +u_int bmachine_scale(void); void scale_number(BIGNUM *, int); void normalize(struct number *, u_int); void eval(void); @@ -93,6 +94,4 @@ void pbn(const char *, const BIGNUM *); void negate(struct number *); void split_number(const struct number *, BIGNUM *, BIGNUM *); void bmul_number(struct number *, struct number *, - struct number *); - -extern BIGNUM zero; + struct number *, u_int); diff --git a/usr.bin/dc/inout.c b/usr.bin/dc/inout.c index 4a2bb70..e35f0ad 100644 --- a/usr.bin/dc/inout.c +++ b/usr.bin/dc/inout.c @@ -322,7 +322,7 @@ printnumber(FILE *f, const struct number *b, u_int base) i++; } sz = i; - if (BN_cmp(b->number, &zero) < 0) + if (BN_is_negative(b->number)) putcharwrap(f, '-'); for (i = 0; i < sz; i++) { p = stack_popstring(&stack); @@ -353,7 +353,8 @@ printnumber(FILE *f, const struct number *b, u_int base) putcharwrap(f, ' '); i = 1; - bmul_number(fract_part, fract_part, num_base); + bmul_number(fract_part, fract_part, num_base, + bmachine_scale()); split_number(fract_part, int_part->number, NULL); rem = BN_get_word(int_part->number); p = get_digit(rem, digits, base); @@ -402,8 +403,8 @@ print_ascii(FILE *f, const struct number *n) v = BN_dup(n->number); bn_checkp(v); - if (BN_cmp(v, &zero) < 0) - bn_check(BN_sub(v, &zero, v)); + if (BN_is_negative(v)) + BN_set_negative(v, 0); numbits = BN_num_bytes(v) * 8; while (numbits > 0) { diff --git a/usr.bin/grep/Makefile b/usr.bin/grep/Makefile index 3d4b67b..359954b 100644 --- a/usr.bin/grep/Makefile +++ b/usr.bin/grep/Makefile @@ -40,17 +40,24 @@ MLINKS= grep.1 egrep.1 \ grep.1 lzfgrep.1 .endif +LDADD= -lz +DPADD= ${LIBZ} + +.if !defined(WITHOUT_LZMA_SUPPORT) +LDADD+= -llzma +DPADD+= ${LIBLZMA} + LINKS+= ${BINDIR}/${PROG} ${BINDIR}/xzgrep \ ${BINDIR}/${PROG} ${BINDIR}/xzegrep \ ${BINDIR}/${PROG} ${BINDIR}/xzfgrep \ ${BINDIR}/${PROG} ${BINDIR}/lzgrep \ ${BINDIR}/${PROG} ${BINDIR}/lzegrep \ ${BINDIR}/${PROG} ${BINDIR}/lzfgrep +.else +CFLAGS+= -DWITHOUT_LZMA +.endif -LDADD= -lz -llzma -DPADD= ${LIBZ} ${LIBLZMA} - -.if !defined(WITHOUT_BZIP2) +.if !defined(WITHOUT_BZIP2_SUPPORT) LDADD+= -lbz2 DPADD+= ${LIBBZ2} diff --git a/usr.bin/grep/file.c b/usr.bin/grep/file.c index 8cee2c0..6bcaa52 100644 --- a/usr.bin/grep/file.c +++ b/usr.bin/grep/file.c @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include <err.h> #include <errno.h> #include <fcntl.h> -#include <lzma.h> #include <stddef.h> #include <stdlib.h> #include <string.h> @@ -50,6 +49,10 @@ __FBSDID("$FreeBSD$"); #include <wctype.h> #include <zlib.h> +#ifndef WITHOUT_LZMA +#include <lzma.h> +#endif + #ifndef WITHOUT_BZIP2 #include <bzlib.h> #endif @@ -60,7 +63,9 @@ __FBSDID("$FreeBSD$"); #define LNBUFBUMP 80 static gzFile gzbufdesc; +#ifndef WITHOUT_LZMA static lzma_stream lstrm = LZMA_STREAM_INIT; +#endif #ifndef WITHOUT_BZIP2 static BZFILE* bzbufdesc; #endif @@ -116,6 +121,7 @@ grep_refill(struct file *f) nr = -1; } #endif +#ifndef WITHOUT_LZMA } else if ((filebehave == FILE_XZ) || (filebehave == FILE_LZMA)) { lzma_action action = LZMA_RUN; uint8_t in_buf[MAXBUFSIZ]; @@ -146,6 +152,7 @@ grep_refill(struct file *f) return (-1); bufrem = MAXBUFSIZ - lstrm.avail_out; return (0); +#endif /* WIHTOUT_LZMA */ } else nr = read(f->fd, buffer, MAXBUFSIZ); diff --git a/usr.bin/grep/grep.c b/usr.bin/grep/grep.c index 7c69d5d..70fd9bd 100644 --- a/usr.bin/grep/grep.c +++ b/usr.bin/grep/grep.c @@ -479,7 +479,13 @@ main(int argc, char *argv[]) grepbehave = GREP_EXTENDED; break; case 'e': - add_pattern(optarg, strlen(optarg)); + { + char *token; + char *string = strdup(optarg); + + while ((token = strsep(&string, "\n")) != NULL) + add_pattern(token, strlen(token)); + } needpattern = 0; break; case 'F': @@ -668,7 +674,11 @@ main(int argc, char *argv[]) /* Process patterns from command line */ if (aargc != 0 && needpattern) { - add_pattern(*aargv, strlen(*aargv)); + char *token; + char *string = strdup(*aargv); + + while ((token = strsep(&string, "\n")) != NULL) + add_pattern(token, strlen(token)); --aargc; ++aargv; } diff --git a/usr.bin/grep/regex/tre-fastmatch.c b/usr.bin/grep/regex/tre-fastmatch.c index 6f1aec6..b7a7c91 100644 --- a/usr.bin/grep/regex/tre-fastmatch.c +++ b/usr.bin/grep/regex/tre-fastmatch.c @@ -468,7 +468,7 @@ static int fastcmp(const fastmatch_t *fg, const void *data, fg->nosub = (cflags & REG_NOSUB); \ \ /* Cannot handle REG_ICASE with MB string */ \ - if (fg->icase && (TRE_MB_CUR_MAX > 1)) \ + if (fg->icase && (TRE_MB_CUR_MAX > 1) && n > 0) \ { \ DPRINT(("Cannot use fast matcher for MBS with REG_ICASE\n")); \ return REG_BADPAT; \ diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile index ce50d6c..1f1ec5e 100644 --- a/usr.bin/m4/Makefile +++ b/usr.bin/m4/Makefile @@ -6,6 +6,7 @@ PROG= m4 CFLAGS+=-DEXTENDED -I${.CURDIR} -I${.CURDIR}/lib +DPADD= ${LIBY} ${LIBL} ${LIBM} LDADD= -ly -ll -lm # clang needs 1 while with gcc we can use 2 #WARNS= 1 diff --git a/usr.bin/tail/read.c b/usr.bin/tail/read.c index 2cff3a3..79c4fa5 100644 --- a/usr.bin/tail/read.c +++ b/usr.bin/tail/read.c @@ -143,9 +143,8 @@ lines(FILE *fp, const char *fn, off_t off) char *p, *sp; int blen, cnt, recno, wrap; - if ((llines = malloc(off * sizeof(*llines))) == NULL) - err(1, "malloc"); - bzero(llines, off * sizeof(*llines)); + if ((llines = calloc(off, sizeof(*llines))) == NULL) + err(1, "calloc"); p = sp = NULL; blen = cnt = recno = wrap = 0; rc = 0; diff --git a/usr.bin/ul/ul.c b/usr.bin/ul/ul.c index 4796956..7aecf6c 100644 --- a/usr.bin/ul/ul.c +++ b/usr.bin/ul/ul.c @@ -280,7 +280,7 @@ filter(FILE *f) obuf[col].c_width = w; for (i = 1; i < w; i++) obuf[col + i].c_width = -1; - } else if (obuf[col].c_char == c) { + } else if ((wint_t)obuf[col].c_char == c) { for (i = 0; i < w; i++) obuf[col + i].c_mode |= BOLD|mode; } else { diff --git a/usr.bin/xargs/strnsubst.c b/usr.bin/xargs/strnsubst.c index 33366b6..304e47b 100644 --- a/usr.bin/xargs/strnsubst.c +++ b/usr.bin/xargs/strnsubst.c @@ -48,7 +48,7 @@ strnsubst(char **str, const char *match, const char *replstr, size_t maxsize) match = NULL; maxsize = strlen(s1) + 1; } - s2 = calloc(maxsize, 1); + s2 = calloc(1, maxsize); if (s2 == NULL) err(1, "calloc"); diff --git a/usr.sbin/Makefile.amd64 b/usr.sbin/Makefile.amd64 index 26eb2b0..1a1bffe 100644 --- a/usr.sbin/Makefile.amd64 +++ b/usr.sbin/Makefile.amd64 @@ -23,7 +23,4 @@ SUBDIR+= ndiscvt .endif SUBDIR+= sicontrol SUBDIR+= spkrtest -.if ${MK_SYSINSTALL} != "no" -SUBDIR+= sade -.endif SUBDIR+= zzz diff --git a/usr.sbin/Makefile.i386 b/usr.sbin/Makefile.i386 index 9588eb8..901c2d9 100644 --- a/usr.sbin/Makefile.i386 +++ b/usr.sbin/Makefile.i386 @@ -17,9 +17,6 @@ SUBDIR+= mptable SUBDIR+= ndiscvt .endif SUBDIR+= pnpinfo -.if ${MK_SYSINSTALL} != "no" -SUBDIR+= sade -.endif SUBDIR+= sicontrol SUBDIR+= spkrtest SUBDIR+= zzz diff --git a/usr.sbin/Makefile.sparc64 b/usr.sbin/Makefile.sparc64 index 479dafc..81f7a9b 100644 --- a/usr.sbin/Makefile.sparc64 +++ b/usr.sbin/Makefile.sparc64 @@ -2,6 +2,3 @@ SUBDIR+= eeprom SUBDIR+= ofwdump -.if ${MK_SYSINSTALL} != "no" -SUBDIR+= sade -.endif diff --git a/usr.sbin/bsdconfig/USAGE b/usr.sbin/bsdconfig/USAGE index 86355b0..eac7dbe 100644 --- a/usr.sbin/bsdconfig/USAGE +++ b/usr.sbin/bsdconfig/USAGE @@ -1,5 +1,5 @@ # Copyright (c) 2012 Ron McDowell -# Copyright (c) 2012 Devin Teske +# Copyright (c) 2012-2013 Devin Teske # All Rights Reserved. # # Redistribution and use in source and binary forms, with or without @@ -31,6 +31,9 @@ Usage: @PROGRAM_NAME@ [OPTIONS] [command [OPTIONS]] OPTIONS: + -f file Load file as script and then exit. If multiple occurrences, + program will only exit after last occurrence. If file is a + single dash (`-'), @PROGRAM_NAME@ reads from standard input. -h Print usage statement and exit. -S Secure X11 mode (implies `-X'). As root, always prompt-for and validate sudo(8) username/password before starting. diff --git a/usr.sbin/bsdconfig/bsdconfig b/usr.sbin/bsdconfig/bsdconfig index 11ea8fc..436b8a4 100755 --- a/usr.sbin/bsdconfig/bsdconfig +++ b/usr.sbin/bsdconfig/bsdconfig @@ -1,7 +1,7 @@ #!/bin/sh #- # Copyright (c) 2012 Ron McDowell -# Copyright (c) 2012 Devin Teske +# Copyright (c) 2012-2013 Devin Teske # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -204,25 +204,45 @@ dialog_menu_main() ############################################################ MAIN # -# If $0 is not "bsdconfig", interpret it as a keyword to a menuitem +# If $0 is not "bsdconfig", interpret it either as a keyword to a menuitem or +# as a valid resword (see script.subr for additional details about reswords). # -if [ "$pgm" != "bsdconfig" ] && - indexfile=$( f_index_file "$pgm" ) && - cmd=$( f_index_menusel_command "$indexfile" "$pgm" ) -then - exec "$cmd" "$@" || exit 1 +if [ "$pgm" != "bsdconfig" ]; then + if indexfile=$( f_index_file "$pgm" ) && + cmd=$( f_index_menusel_command "$indexfile" "$pgm" ) + then + f_dprintf "pgm=[%s] indexfile=[%s] cmd=[%s]" \ + "$pgm" "$indexfile" "$cmd" + exec "$cmd" "$@" || exit 1 + else + f_include $BSDCFG_SHARE/script.subr + for resword in $RESWORDS; do + [ "$pgm" = "$resword" ] || continue + # Found a match + f_dprintf "pgm=[%s] A valid resWord!" "$pgm" + f_dispatch $resword + exit $? + done + fi fi # # Process command-line arguments # -while getopts hSX flag; do +scripts_loaded=0 +while getopts f:hSX flag; do case "$flag" in + f) [ $scripts_loaded -eq 0 ] && f_include $BSDCFG_SHARE/script.subr + f_script_load "$OPTARG" + scripts_loaded=$(( $scripts_loaded + 1 ));; h|\?) usage;; esac done shift $(( $OPTIND -1 )) +# If we've loaded any scripts, do not continue any further +[ $scripts_loaded -gt 0 ] && exit + # # Initialize # diff --git a/usr.sbin/bsdconfig/bsdconfig.8 b/usr.sbin/bsdconfig/bsdconfig.8 index 5bb3e73..1c1150b 100644 --- a/usr.sbin/bsdconfig/bsdconfig.8 +++ b/usr.sbin/bsdconfig/bsdconfig.8 @@ -1,5 +1,5 @@ .\" Copyright (c) 2012 Ron McDowell -.\" Copyright (c) 2012 Devin Teske +.\" Copyright (c) 2012-2013 Devin Teske .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -59,7 +59,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Mar 20, 2012 +.Dd Jan 5, 2013 .Dt BSDCONFIG 8 .Os .Sh NAME @@ -85,6 +85,17 @@ a master menu listing the available commands. .Pp The following options are available: .Bl -tag -width indent+ +.It Fl f Ar file +Load +.Ar file +as script and then exit. +If multiple occurrences, program will only exit after last occurrence. +If +.Ar file +is a single dash +.Pq Sq Fl , +.Nm +reads from standard input. .It Fl h Print usage statement and exit. .It Fl S diff --git a/usr.sbin/bsdconfig/include/messages.subr b/usr.sbin/bsdconfig/include/messages.subr index ec988ad..dc7c246 100644 --- a/usr.sbin/bsdconfig/include/messages.subr +++ b/usr.sbin/bsdconfig/include/messages.subr @@ -34,6 +34,7 @@ msg_becoming_root_via_sudo="Becoming root via sudo(8)..." msg_cancel="Cancel" msg_cancel_exit="Cancel/Exit" msg_cannot_create_permission_denied="%s: cannot create %s: Permission denied" +msg_command_failed_rest_of_script_aborted="Command \`%s' failed - rest of script aborted." msg_created_path="Created %s" msg_directory_not_found="%s: Directory not found." msg_exit="Exit" @@ -56,6 +57,7 @@ msg_secure_mode_requires_x11="Secure-mode requires X11 (use \`-X')!" msg_secure_mode_requires_root="Secure-mode requires root-access!" msg_sorry_try_again="Sorry, try again." msg_try_sudo_only_this_once="Try sudo(8) only this once" +msg_unable_to_open="Unable to open %s" msg_unknown_user="Unknown user: %s" msg_usage="Usage" msg_user_disallowed="User disallowed: %s" diff --git a/usr.sbin/bsdconfig/networking/share/hostname.subr b/usr.sbin/bsdconfig/networking/share/hostname.subr index 751cfa5..959c7df 100644 --- a/usr.sbin/bsdconfig/networking/share/hostname.subr +++ b/usr.sbin/bsdconfig/networking/share/hostname.subr @@ -190,7 +190,7 @@ f_dialog_input_hostname() # the stored configuration (in rc.conf(5)). # if [ "$( hostname )" != "$( f_sysrc_get hostname )" ]; then - [ ! "$USE_XDIALOG" ] && dialog_clear + [ ! "$USE_XDIALOG" ] && f_dialog_clear # # If connected via ssh(1) and performing X11-Forwarding, don't diff --git a/usr.sbin/bsdconfig/networking/share/ipaddr.subr b/usr.sbin/bsdconfig/networking/share/ipaddr.subr index 29863d5..d5398e5 100644 --- a/usr.sbin/bsdconfig/networking/share/ipaddr.subr +++ b/usr.sbin/bsdconfig/networking/share/ipaddr.subr @@ -104,6 +104,7 @@ f_validate_ipaddr() [ $noctets -eq 4 ] || exit 4 ) } + # f_dialog_iperror $error $ipaddr # # Display a msgbox with the appropriate error message for an error returned by diff --git a/usr.sbin/bsdconfig/share/Makefile b/usr.sbin/bsdconfig/share/Makefile index 7f299ec..cd56dfc 100644 --- a/usr.sbin/bsdconfig/share/Makefile +++ b/usr.sbin/bsdconfig/share/Makefile @@ -3,7 +3,8 @@ NO_OBJ= FILESDIR= ${SHAREDIR}/bsdconfig -FILES= common.subr dialog.subr mustberoot.subr strings.subr sysrc.subr +FILES= common.subr dialog.subr mustberoot.subr script.subr \ + strings.subr sysrc.subr variable.subr beforeinstall: mkdir -p ${DESTDIR}${FILESDIR} diff --git a/usr.sbin/bsdconfig/share/common.subr b/usr.sbin/bsdconfig/share/common.subr index 6d56ecf..05531aa 100644 --- a/usr.sbin/bsdconfig/share/common.subr +++ b/usr.sbin/bsdconfig/share/common.subr @@ -64,15 +64,26 @@ export UNAME_R="$(uname -r)" # Release Level (i.e. X.Y-RELEASE) ############################################################ FUNCTIONS +# f_dprintf $fmt [ $opts ... ] # # Sensible debug function. Override in ~/.bsdconfigrc if desired. # See /usr/share/examples/bsdconfig/bsdconfigrc for example. # +# If $debug is set and non-NULL, prints DEBUG info using printf(1) syntax: +# + To $debugFile, if set and non-NULL +# + To standard output if $debugFile is either NULL or unset +# + To both if $debugFile begins with a single plus-sign (`+') +# f_dprintf() { [ "$debug" ] || return $SUCCESS local fmt="$1"; shift + case "$debugFile" in ""|+*) printf "DEBUG: $fmt${fmt:+\n}" "$@" >&${TERMINAL_STDOUT_PASSTHRU:-1} + esac + [ "${debugFile#+}" ] && + printf "DEBUG: $fmt${fmt:+\n}" "$@" >> "${debugFile#+}" + return $SUCCESS } # f_err $fmt [ $opts ... ] @@ -103,6 +114,30 @@ f_have() f_quietly type "$@" } +# f_getvar $var_to_get [$var_to_set] +# +# Utility function designed to go along with the already-builtin setvar. +# Allows clean variable name indirection without forking or sub-shells. +# +# Returns error status if the requested variable ($var_to_get) is not set. +# +# If $var_to_set is missing or NULL, the value of $var_to_get is printed to +# standard output for capturing in a sub-shell (which is less-recommended +# because of performance degredation; for example, when called in a loop). +# +f_getvar() +{ + local var_to_get="$1" var_to_set="$2" + [ "$var_to_set" ] || local value + eval ${var_to_set:-value}=\"\${$var_to_get}\" + eval [ \"\${$var_to_get+set}\" ] + local retval=$? + eval f_dprintf '"f_getvar: var=[%s] value=[%s] r=%u"' \ + \"\$var_to_get\" \"\$${var_to_set:-value}\" \$retval + [ "$var_to_set" ] || { [ "$value" ] && echo "$value"; } + return $retval +} + # f_die [ $status [ $fmt [ $opts ... ]]] # # Abruptly terminate due to an error optionally displaying a message in a @@ -517,6 +552,25 @@ eval exec $TERMINAL_STDERR_PASSTHRU\>\&2 [ "$debug" ] && export debug # +# Truncate the debug file upon initialization (now). Note that we will trim a +# leading plus (`+') from the value of debugFile to support persistant meaning +# that f_dprintf() should print both to standard output and $debugFile (minus +# the leading plus, of course). +# +_debug_file="${debugFile#+}" +if [ "$_debug_file" ]; then + if ( umask 022 && :> "$_debug_file" ); then + f_dprintf "Successfully initialized debugFile \`%s'" \ + "$_debug_file" + else + unset debugFile + f_dprintf "Unable to initialize debugFile \`%s'" \ + "$_debug_file" + fi +fi +unset _debug_file + +# # Log our operating environment for debugging purposes # f_dprintf "UNAME_S=[%s] UNAME_P=[%s] UNAME_R=[%s]" \ diff --git a/usr.sbin/bsdconfig/share/dialog.subr b/usr.sbin/bsdconfig/share/dialog.subr index 58888cb..78286267 100644 --- a/usr.sbin/bsdconfig/share/dialog.subr +++ b/usr.sbin/bsdconfig/share/dialog.subr @@ -1,6 +1,6 @@ if [ ! "$_DIALOG_SUBR" ]; then _DIALOG_SUBR=1 # -# Copyright (c) 2006-2012 Devin Teske +# Copyright (c) 2006-2013 Devin Teske # All Rights Reserved. # # Redistribution and use in source and binary forms, with or without @@ -32,6 +32,7 @@ BSDCFG_SHARE="/usr/share/bsdconfig" . $BSDCFG_SHARE/common.subr || exit 1 f_dprintf "%s: loading includes..." dialog.subr f_include $BSDCFG_SHARE/strings.subr +f_include $BSDCFG_SHARE/variable.subr BSDCFG_LIBE="/usr/libexec/bsdconfig" f_include_lang $BSDCFG_LIBE/include/messages.subr @@ -77,6 +78,11 @@ unset XDIALOG_INFOBOX_TIMEOUT # : ${DIALOG_SELF_INITIALIZE=1} +# +# Default terminal size (used if/when running without a controlling terminal) +# +: ${DEFAULT_TERMINAL_SIZE:=24 80} + ############################################################ GENERIC FUNCTIONS # f_dialog_title [$new_title] @@ -193,7 +199,8 @@ f_dialog_infobox_size() max_size="$XDIALOG_MAXSIZE" # see CONFIGURATION else min_width=24 - max_size=$( stty size ) # usually "24 80" + max_size=$( stty size 2> /dev/null ) # usually "24 80" + : ${max_size:=$DEFAULT_TERMINAL_SIZE} fi local max_height="${max_size%%[$IFS]*}" @@ -325,7 +332,8 @@ f_dialog_buttonbox_size() if [ "$USE_XDIALOG" ]; then max_size="$XDIALOG_MAXSIZE" # see CONFIGURATION else - max_size=$( stty size ) # usually "24 80" + max_size=$( stty size 2> /dev/null ) # usually "24 80" + : ${max_size:=$DEFAULT_TERMINAL_SIZE} fi local max_height="${max_size%%[$IFS]*}" [ $height -le $max_height ] || height=$max_height @@ -363,7 +371,8 @@ f_dialog_inputbox_size() max_size="$XDIALOG_MAXSIZE" # see CONFIGURATION else min_width=24 - max_size=$( stty size ) # usually "24 80" + max_size=$( stty size 2> /dev/null ) # usually "24 80" + : ${max_size:=$DEFAULT_TERMINAL_SIZE} fi local max_height="${max_size%%[$IFS]*}" local max_width="${max_size##*[$IFS]}" @@ -472,6 +481,7 @@ f_xdialog_2inputsbox_size() # Add height for a second inputbox height=$(( $height + 2 )) + [ $height -le $max_height ] || height=$max_height # # Bump width for second initial text (if not already at maximum width). @@ -521,7 +531,8 @@ f_dialog_menu_size() else min_width=24 min_rows=0 - max_size=$( stty size ) # usually "24 80" + max_size=$( stty size 2> /dev/null ) # usually "24 80" + : ${max_size:=$DEFAULT_TERMINAL_SIZE} fi local max_width="${max_size##*[$IFS]}" @@ -603,7 +614,8 @@ f_dialog_menu_with_help_size() else min_width=24 min_rows=0 - max_size=$( stty size ) # usually "24 80" + max_size=$( stty size 2> /dev/null ) # usually "24 80" + : ${max_size:=$DEFAULT_TERMINAL_SIZE} fi local max_width="${max_size##*[$IFS]}" @@ -702,7 +714,8 @@ f_dialog_radiolist_size() else min_width=24 min_rows=0 - max_size=$( stty size ) # usually "24 80" + max_size=$( stty size 2> /dev/null ) # usually "24 80" + : ${max_size:=$DEFAULT_TERMINAL_SIZE} fi local max_width="${max_size##*[$IFS]}" @@ -788,7 +801,8 @@ f_dialog_calendar_size() else min_height=0 min_width=40 - max_size=$( stty size ) # usually "24 80" + max_size=$( stty size 2> /dev/null ) # usually "24 80" + : ${max_size:=$DEFAULT_TERMINAL_SIZE} fi local max_height="${max_size%%[$IFS]*}" local max_width="${max_size##*[$IFS]}" @@ -866,7 +880,8 @@ f_dialog_timebox_size() else min_height=0 min_width=20 - max_size=$( stty size ) # usually "24 80" + max_size=$( stty size 2> /dev/null ) # usually "24 80" + : ${max_size:=$DEFAULT_TERMINAL_SIZE} fi local max_height="${max_size%%[$IFS]*}" local max_width="${max_size##*[$IFS]}" @@ -924,7 +939,7 @@ f_dialog_clear() # f_dialog_info $info_text ... # # Throw up a dialog(1) infobox. The infobox remains until another dialog is -# displayed or `dialog --clear' (or dialog_clear) is called. +# displayed or `dialog --clear' (or f_dialog_clear) is called. # f_dialog_info() { @@ -1044,6 +1059,9 @@ f_dialog_yesno() { local msg_text="$*" local hline="$hline_arrows_tab_enter" + + f_interactive || return 0 # If non-interactive, return YES all the time + local size="$( f_dialog_buttonbox_size \ "$DIALOG_TITLE" \ "$DIALOG_BACKTITLE" \ @@ -1084,6 +1102,9 @@ f_dialog_noyes() { local msg_text="$*" local hline="$hline_arrows_tab_enter" + + f_interactive || return 1 # If non-interactive, return NO all the time + local size="$( f_dialog_buttonbox_size \ "$DIALOG_TITLE" \ "$DIALOG_BACKTITLE" \ @@ -1480,6 +1501,9 @@ f_dialog_init() ############################################################ MAIN +# +# Self-initialize unless requested otherwise +# f_dprintf "%s: DIALOG_SELF_INITIALIZE=[%s]" \ dialog.subr "$DIALOG_SELF_INITIALIZE" case "$DIALOG_SELF_INITIALIZE" in diff --git a/usr.sbin/bsdconfig/share/script.subr b/usr.sbin/bsdconfig/share/script.subr new file mode 100644 index 0000000..d5a2e93 --- /dev/null +++ b/usr.sbin/bsdconfig/share/script.subr @@ -0,0 +1,139 @@ +if [ ! "$_SCRIPT_SUBR" ]; then _SCRIPT_SUBR=1 +# +# Copyright (c) 2012 Devin Teske +# All Rights Reserved. +# +# 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. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INLUDING, 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. +# +# $FreeBSD$ +# +############################################################ INCLUDES + +BSDCFG_SHARE="/usr/share/bsdconfig" +. $BSDCFG_SHARE/common.subr || exit 1 +f_dprintf "%s: loading includes..." script.subr +f_include $BSDCFG_SHARE/variable.subr + +############################################################ GLOBALS + +RESWORDS= + +############################################################ FUNCTIONS + +# f_resword_new $resword $function +# +# Create a new `reserved' word for scripting purposes. Reswords call pre- +# defined functions but differ from those functions in the following ways: +# +# + Reswords do not take arguments but instead get all their data from +# the environment variable namespace. +# + Unless noError is set (must be non-NULL), if calling the resword +# results in failure, the application will terminate prematurely. +# + noError is unset after each/every resword is called. +# +# Reswords should not be used in bsdconfig itself (hence the name `reserved +# word') but instead only in scripts loaded through f_script_load()). +# +f_resword_new() +{ + local resword="$1" func="$2" + [ "$resword" ] || return $FAILURE + f_dprintf "script.subr: New resWord %s -> %s" "$resword" "$func" + eval $resword\(\){ f_dispatch $func $resword\; } + RESWORDS="$RESWORDS${RESWORDS:+ }$resword" +} + +# f_dispatch $func [$resword] +# +# Wrapper function used by `reserved words' (reswords) to call other functions. +# If $noError is set and non-NULL, a failure result from $func is ignored, +# otherwise the application is prematurely terminated using f_die(). +# +# NOTE: $noError is unset after every call. +# +f_dispatch() +{ + local func="$1" resword="${2:-$1}" + f_dprintf "f_dispatch: calling resword \`%s'" "$resword" + eval $func + local retval=$? _ignore_this_error + f_getvar $VAR_NO_ERROR _ignore_this_error + [ $retval -eq $SUCCESS ] || + [ "$_ignore_this_error" ] || f_die $retval \ + "$msg_command_failed_rest_of_script_aborted" "$resword" + unset $VAR_NO_ERROR +} + +# f_script_load [$file] +# +# Load a script (usually filled with reswords). If $file is missing or NULL, +# use one of the following instead (in order): +# +# $configFile +# install.cfg +# /stand/install.fg +# /tmp/install.cfg +# +# Unknown/unregistered reswords will generate sh(1) syntax errors but not cause +# premature termination. +# +# Returns success if a script was loaded and itself returned success. +# +f_script_load() +{ + local script="$1" config_file + + f_dprintf "f_script_load: script=[%s]" "$script" + if [ ! "$script" ]; then + f_getvar $VAR_CONFIG_FILE config_file + for script in \ + $config_file \ + install.cfg \ + /stand/install.cfg \ + /tmp/install.cfg \ + ; do + [ -e "$script" ] && break + done + elif [ "$script" = "-" ]; then + f_dprintf "f_script_load: Loading script from stdin" + eval "$( cat )" + else + f_dprintf "f_script_load: Loading script \`%s'" "$script" + if [ ! -e "$script" ]; then + f_show_msg "$msg_unable_to_open" "$script" + return $FAILURE + fi + . "$script" + fi +} + +############################################################ MAIN + +# +# Reserved words meant for scripting +# +f_resword_new dumpVariables f_dump_variables +f_resword_new loadConfig f_script_load + +f_dprintf "%s: Successfully loaded." script.subr + +fi # ! $_SCRIPT_SUBR diff --git a/usr.sbin/bsdconfig/share/variable.subr b/usr.sbin/bsdconfig/share/variable.subr new file mode 100644 index 0000000..f63a5f8 --- /dev/null +++ b/usr.sbin/bsdconfig/share/variable.subr @@ -0,0 +1,185 @@ +if [ ! "$_VARIABLE_SUBR" ]; then _VARIABLE_SUBR=1 +# +# Copyright (c) 2012 Devin Teske +# All Rights Reserved. +# +# 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. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INLUDING, 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. +# +# $FreeBSD$ +# +############################################################ INCLUDES + +BSDCFG_SHARE="/usr/share/bsdconfig" +. $BSDCFG_SHARE/common.subr || exit 1 +f_dprintf "%s: loading includes..." variable.subr +f_include $BSDCFG_SHARE/dialog.subr + +############################################################ GLOBALS + +VARIABLES= + +# +# Default behavior is to call f_variable_set_defaults() when loaded. +# +: ${VARIABLE_SELF_INITIALIZE=1} + +# +# File to write when f_dump_variables() is called. +# +: ${VARIABLE_DUMPFILE:=/etc/bsdconfig.vars} + +############################################################ FUNCTIONS + +# f_variable_new $handle $variable +# +# Register a new variable named $variable with the given reference-handle +# $handle. The environment variable $handle is set to $variable allowing you to +# use the f_getvar() function (from common.subr) with $handle to get the value +# of environment variable $variable. For example: +# +# f_variable_new VAR_ABC abc +# +# allows the later indirection: +# +# f_getvar $VAR_ABC +# +# to return the value of environment variable `abc'. Variables registered in +# this manner are recorded in the $VARIABLES environment variable for later +# allowing dynamic enumeration of so-called `registered/advertised' variables. +# +f_variable_new() +{ + local handle="$1" variable="$2" + [ "$handle" ] || return $FAILURE + f_dprintf "variable.subr: New variable %s -> %s" "$handle" "$variable" + setvar $handle $variable + VARIABLES="$VARIABLES${VARIABLES:+ }$handle" +} + +# f_variable_get_value $var [ $fmt [ $opts ... ] ] +# +# Unless nonInteractive is set, prompt the user with a given value (pre-filled +# with the value of $var) and give them the chance to change the value. +# +# Unlike f_getvar() (from common.subr) which can return a variable to the +# caller on standard output, this function has no [meaningful] output. +# +# Returns success unless $var is either NULL or missing. +# +f_variable_get_value() +{ + local var="$1" cp + + [ "$var" ] || return $FAILURE + + if ! { f_getvar $var cp && ! f_interactive; }; then + shift 1 # var + cp=$( f_dialog_input "$( printf "$@" )" "$cp" ) && + setvar $var "$cp" + fi + + return $SUCCESS +} + +# f_variable_set_defaults +# +# Installs sensible defaults for registered/advertised variables. +# +f_variable_set_defaults() +{ + # + # Initialize various user-edittable values to their defaults + # + setvar $VAR_RELNAME "$UNAME_R" + + f_dprintf "f_variable_set_defaults: Defaults initialized." +} + +# f_dump_variables +# +# Dump a list of registered/advertised variables and their respective values to +# $VARIABLE_DUMPFILE. Returns success unless the file couldn't be written. If +# an error occurs, it is displayed using f_show_msg() (from common.subr). +# +f_dump_variables() +{ + local err sanitize_awk="{ gsub(/'/, \"'\\\\''\"); print }" + if ! err=$( + ( for handle in $VARIABLES; do + f_getvar $handle var || continue + f_getvar $var value || continue + value=$( echo "$value" | awk "$sanitize_awk" ) + printf "%s='%s'\n" "$var" "$value" + done > "$VARIABLE_DUMPFILE" ) 2>&1 + ); then + f_show_msg "%s" "$err" + return $FAILURE + fi +} + +# f_debugging +# +# Are we in debug mode? Returns success if extra DEBUG information has been +# requested (by setting $debug to non-NULL), otherwise false. +# +f_debugging() +{ + local value + f_getvar $VAR_DEBUG value && [ "$value" ] +} + +# f_interactive() +# +# Are we running interactively? Return error if $nonInteractive is set and non- +# NULL, otherwise return success. +# +f_interactive() +{ + local value + ! f_getvar $VAR_NONINTERACTIVE value || [ ! "$value" ] +} + +############################################################ MAIN + +# +# Variables that can be tweaked from config files +# +f_variable_new VAR_CONFIG_FILE configFile +f_variable_new VAR_DEBUG debug +f_variable_new VAR_DEBUG_FILE debugFile +f_variable_new VAR_NO_ERROR noError +f_variable_new VAR_NONINTERACTIVE nonInteractive +f_variable_new VAR_RELNAME releaseName + +# +# Self-initialize unless requested otherwise +# +f_dprintf "%s: VARIABLE_SELF_INITIALIZE=[%s]" \ + variable.subr "$VARIABLE_SELF_INITIALIZE" +case "$VARIABLE_SELF_INITIALIZE" in +""|0|[Nn][Oo]|[Oo][Ff][Ff]|[Ff][Aa][Ll][Ss][Ee]) : do nothing ;; +*) f_variable_set_defaults +esac + +f_dprintf "%s: Successfully loaded." variable.subr + +fi # ! $_VARIABLE_SUBR diff --git a/usr.sbin/bsdconfig/startup/share/rcvar.subr b/usr.sbin/bsdconfig/startup/share/rcvar.subr index bb54523..702c5e9 100644 --- a/usr.sbin/bsdconfig/startup/share/rcvar.subr +++ b/usr.sbin/bsdconfig/startup/share/rcvar.subr @@ -107,11 +107,11 @@ f_startup_rcvar_map() )" # - # Calculate a digest given the checksums of all dependencies (scripts and - # the defaults file). This digest will be used to determine if an on-disk - # global persistant cache file (containg this digest on the first line) - # is valid and can be used to quickly populate the cache value for - # immediate return. + # Calculate a digest given the checksums of all dependencies (scripts + # and the defaults file). This digest will be used to determine if an + # on-disk global persistant cache file (containg this digest on the + # first line) is valid and can be used to quickly populate the cache + # value for immediate return. # local rc_script_list_digest rc_script_list_digest=$( cd "$ETC_RC_D" && @@ -131,11 +131,12 @@ f_startup_rcvar_map() read digest rest_ignored # - # If the stored digest matches the calculated-one - # populate the in-memory cache from the on-disk - # cache and provide success exit status. + # If the stored digest matches the calculated- + # one populate the in-memory cache from the on- + # disk cache and provide success exit status. # - if [ "$digest" = "$rc_script_list_digest" ]; then + if [ "$digest" = "$rc_script_list_digest" ] + then cat exit $SUCCESS else @@ -151,7 +152,7 @@ f_startup_rcvar_map() echo "$STARTUP_RCVAR_MAP" return $SUCCESS fi - # Otherwise, fall-through to create in-memory cache from scratch + # Otherwise, fall-thru to create in-memory cache from scratch fi # diff --git a/usr.sbin/bsdinstall/partedit/Makefile b/usr.sbin/bsdinstall/partedit/Makefile index 9618b09..21eaf91 100644 --- a/usr.sbin/bsdinstall/partedit/Makefile +++ b/usr.sbin/bsdinstall/partedit/Makefile @@ -3,6 +3,7 @@ BINDIR= /usr/libexec/bsdinstall PROG= partedit LINKS= ${BINDIR}/partedit ${BINDIR}/autopart +SYMLINKS= ${BINDIR}/partedit /usr/sbin/sade LDADD= -lgeom -lncursesw -lutil -ldialog -lm PARTEDIT_ARCH= ${MACHINE} @@ -17,6 +18,6 @@ SRCS= diskeditor.c partedit.c gpart_ops.c partedit_${PARTEDIT_ARCH}.c \ part_wizard.c WARNS?= 3 -NO_MAN= true +MAN= sade.8 .include <bsd.prog.mk> diff --git a/usr.sbin/bsdinstall/partedit/partedit.c b/usr.sbin/bsdinstall/partedit/partedit.c index 2436f08..d470c80 100644 --- a/usr.sbin/bsdinstall/partedit/partedit.c +++ b/usr.sbin/bsdinstall/partedit/partedit.c @@ -41,6 +41,7 @@ #include "partedit.h" struct pmetadata_head part_metadata; +static int sade_mode = 0; static int apply_changes(struct gmesh *mesh); static struct partedit_item *read_geom_mesh(struct gmesh *mesh, int *nitems); @@ -75,12 +76,15 @@ main(int argc, const char **argv) int i, op, nitems, nscroll; int error; + if (strcmp(basename(argv[0]), "sade") == 0) + sade_mode = 1; + TAILQ_INIT(&part_metadata); init_fstab_metadata(); init_dialog(stdin, stdout); - if (strcmp(basename(argv[0]), "sade") != 0) + if (!sade_mode) dialog_vars.backtitle = __DECONST(char *, "FreeBSD Installer"); dialog_vars.item_help = TRUE; nscroll = i = 0; @@ -261,7 +265,7 @@ validate_setup(void) * Check for root partitions that we aren't formatting, which is * usually a mistake */ - if (root->newfs == NULL) { + if (root->newfs == NULL && !sade_mode) { dialog_vars.defaultno = TRUE; cancel = dialog_yesno("Warning", "The chosen root partition " "has a preexisting filesystem. If it contains an existing " diff --git a/usr.sbin/sade/sade.8 b/usr.sbin/bsdinstall/partedit/sade.8 index 8acda90..8b2af49 100644 --- a/usr.sbin/sade/sade.8 +++ b/usr.sbin/bsdinstall/partedit/sade.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 8, 2006 +.Dd December 30, 2012 .Dt SADE 8 .Os .Sh NAME @@ -46,28 +46,30 @@ The .Nm utility aims to provide a handy tool for disk management tasks on an already installed system. -The goal is to save -some of the useful functionality of the old -.Xr sysinstall 8 -which -will be removed from the system in favor of the new installer. +The goal is to provide the same text interface for disk management in +.Xr bsdinstall 8 +in the post-installation environment. .Sh SEE ALSO -.Xr sysinstall 8 +.Xr bsdinstall 8 , +.Xr gpart 8 .Sh HISTORY -This version of +A program called .Nm first appeared in -.Fx 6.3 . -The code is extracted from the +.Fx 6.3 +as a utility encapsulating features from the .Xr sysinstall 8 -utility. +installer. It was replaced in +.Fx 10.0 +with the equivalent part of +.Xr bsdinstall 8 . .Sh AUTHORS -.An Jordan K. Hubbard Aq jkh@FreeBSD.org +.An Nathan Whitehorn Aq nwhitehorn@FreeBSD.org .Sh BUGS The utility misses a lot of nice features, such as tools for manipulating .Xr gmirror 8 or -.Xr gvinum 8 -stuff. +.Xr zfs 8 +. These will be added later. diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 7c8e9fe..b012c88 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -62,7 +62,7 @@ main(int argc, char *argv[]) nochdir = noclose = 1; restart = 0; pidfile = user = NULL; - while ((ch = getopt(argc, argv, "-cfp:ru:")) != -1) { + while ((ch = getopt(argc, argv, "cfp:ru:")) != -1) { switch (ch) { case 'c': nochdir = 0; diff --git a/usr.sbin/gssd/Makefile b/usr.sbin/gssd/Makefile index 28e8f7d..3663bf9 100644 --- a/usr.sbin/gssd/Makefile +++ b/usr.sbin/gssd/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +.include <bsd.own.mk> + PROG= gssd MAN= gssd.8 SRCS= gssd.c gssd.h gssd_svc.c gssd_xdr.c gssd_prot.c @@ -7,8 +9,14 @@ SRCS= gssd.c gssd.h gssd_svc.c gssd_xdr.c gssd_prot.c CFLAGS+= -I. WARNS?= 1 -DPADD= ${LIBGSSAPI} ${LIBKRB5} ${LIBHX509} ${LIBASN1} ${LIBROKEN} ${LIBCOM_ERR} ${LIBCRYPT} ${LIBCRYPTO} -LDADD= -lgssapi -lkrb5 -lhx509 -lasn1 -lroken -lcom_err -lcrypt -lcrypto +DPADD= ${LIBGSSAPI} +LDADD= -lgssapi +.if ${MK_KERBEROS_SUPPORT} != "no" +DPADD+= ${LIBKRB5} ${LIBHX509} ${LIBASN1} ${LIBROKEN} ${LIBCOM_ERR} ${LIBCRYPT} ${LIBCRYPTO} +LDADD+= -lkrb5 -lhx509 -lasn1 -lroken -lcom_err -lcrypt -lcrypto +.else +CFLAGS+= -DWITHOUT_KERBEROS +.endif CLEANFILES= gssd_svc.c gssd.h diff --git a/usr.sbin/gssd/gssd.8 b/usr.sbin/gssd/gssd.8 index 7b006e8..73eb6e3 100644 --- a/usr.sbin/gssd/gssd.8 +++ b/usr.sbin/gssd/gssd.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 22, 2012 +.Dd December 30, 2012 .Dt GSSD 8 .Os .Sh NAME @@ -53,25 +53,22 @@ will not fork when it starts. Look for an appropriate credential cache file in this list of directories. The list should be full pathnames from root, separated by ':' characters. Usually this list will simply be "/tmp". -Without this option, the +Without this option, .Nm -daemon assumes that the credential cache file is called /tmp/krb5cc_<uid>, +assumes that the credential cache file is called /tmp/krb5cc_<uid>, where <uid> is the effective uid for the RPC caller. .It Fl c Ar file-substring Set a file-substring for the credential cache file names. Only files with this substring embedded in their names will be -selected as candidates when the +selected as candidates when .Fl s has been specified. If not specified, it defaults to "krb5cc_". .It Fl r Ar preferred-realm -Set a preferred Kerberos realm for the search of the directory list for -a credentials cache file. -When set, files with TGT credentials for this realm will be selected over -other credential files. -This option is only meaningful when the -.Fl s -option has been specified. +Use Kerberos credentials for this realm when searching for +credentials in directories specified with +.Fl s . +If not specified, the default Kerberos realm will be used. .El .Sh FILES .Bl -tag -width ".Pa /etc/krb5.keytab" -compact diff --git a/usr.sbin/gssd/gssd.c b/usr.sbin/gssd/gssd.c index 78ca859..9777943 100644 --- a/usr.sbin/gssd/gssd.c +++ b/usr.sbin/gssd/gssd.c @@ -37,7 +37,9 @@ __FBSDID("$FreeBSD$"); #include <ctype.h> #include <dirent.h> #include <err.h> +#ifndef WITHOUT_KERBEROS #include <krb5.h> +#endif #include <pwd.h> #include <stdio.h> #include <stdlib.h> @@ -102,12 +104,17 @@ main(int argc, char **argv) debug_level++; break; case 's': +#ifndef WITHOUT_KERBEROS /* * Set the directory search list. This enables use of * find_ccache_file() to search the directories for a * suitable credentials cache file. */ strlcpy(ccfile_dirlist, optarg, sizeof(ccfile_dirlist)); +#else + errx(1, "This option not available when built" + " without MK_KERBEROS\n"); +#endif break; case 'c': /* @@ -814,6 +821,7 @@ static int is_a_valid_tgt_cache(const char *filepath, uid_t uid, int *retrating, time_t *retexptime) { +#ifndef WITHOUT_KERBEROS krb5_context context; krb5_principal princ; krb5_ccache ccache; @@ -913,5 +921,8 @@ is_a_valid_tgt_cache(const char *filepath, uid_t uid, int *retrating, *retexptime = exptime; } return (ret); +#else /* WITHOUT_KERBEROS */ + return (0); +#endif /* !WITHOUT_KERBEROS */ } diff --git a/usr.sbin/ifmcstat/ifmcstat.c b/usr.sbin/ifmcstat/ifmcstat.c index 9f58680..599e850 100644 --- a/usr.sbin/ifmcstat/ifmcstat.c +++ b/usr.sbin/ifmcstat/ifmcstat.c @@ -296,7 +296,8 @@ in_ifinfo(struct igmp_ifinfo *igi) printf("igmpv?(%d)", igi->igi_version); break; } - printb(" flags", igi->igi_flags, "\020\1SILENT\2LOOPBACK"); + if (igi->igi_flags) + printb(" flags", igi->igi_flags, "\020\1SILENT\2LOOPBACK"); if (igi->igi_version == IGMP_VERSION_3) { printf(" rv %u qi %u qri %u uri %u", igi->igi_rv, igi->igi_qi, igi->igi_qri, igi->igi_uri); @@ -752,7 +753,8 @@ in6_ifinfo(struct mld_ifinfo *mli) printf("mldv?(%d)", mli->mli_version); break; } - printb(" flags", mli->mli_flags, "\020\1SILENT\2USEALLOW"); + if (mli->mli_flags) + printb(" flags", mli->mli_flags, "\020\1SILENT\2USEALLOW"); if (mli->mli_version == MLD_VERSION_2) { printf(" rv %u qi %u qri %u uri %u", mli->mli_rv, mli->mli_qi, mli->mli_qri, mli->mli_uri); @@ -1129,7 +1131,14 @@ ifmcstat_getifmaddrs(void) break; } - fprintf(stdout, "\t%s %s\n", pafname, addrbuf); + fprintf(stdout, "\t%s %s", pafname, addrbuf); +#ifdef INET6 + if (pifasa->sa.sa_family == AF_INET6 && + pifasa->sin6.sin6_scope_id) + fprintf(stdout, " scopeid 0x%x", + pifasa->sin6.sin6_scope_id); +#endif + fprintf(stdout, "\n"); #ifdef INET /* * Print per-link IGMP information, if available. @@ -1202,6 +1211,12 @@ next_ifnet: } fprintf(stdout, "\t\tgroup %s", addrbuf); +#ifdef INET6 + if (pgsa->sa.sa_family == AF_INET6 && + pgsa->sin6.sin6_scope_id) + fprintf(stdout, " scopeid 0x%x", + pgsa->sin6.sin6_scope_id); +#endif #ifdef INET if (pgsa->sa.sa_family == AF_INET) { inm_print_sources_sysctl(thisifindex, diff --git a/usr.sbin/newsyslog/newsyslog.8 b/usr.sbin/newsyslog/newsyslog.8 index 82fe5b7..87f60ac 100644 --- a/usr.sbin/newsyslog/newsyslog.8 +++ b/usr.sbin/newsyslog/newsyslog.8 @@ -125,7 +125,9 @@ reasons for either trimming that log or skipping it. Cause .Nm not to trim the logs, but to print out what it would do if this option -were not specified. +were not specified. This option implies the +.Fl r +option. .It Fl r Remove the restriction that .Nm diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index 875f911..42cc013 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -644,7 +644,7 @@ parse_args(int argc, char **argv) break; case 'n': noaction++; - break; + /* FALLTHROUGH */ case 'r': needroot = 0; break; @@ -1582,7 +1582,7 @@ delete_oldest_timelog(const struct conf_entry *ent, const char *archive_dir) oldlogs[i].fname); else if (unlinkat(dir_fd, oldlogs[i].fname, 0) != 0) { snprintf(errbuf, sizeof(errbuf), - "Could not delet old logfile '%s'", + "Could not delete old logfile '%s'", oldlogs[i].fname); perror(errbuf); } @@ -1814,12 +1814,21 @@ do_rotate(const struct conf_entry *ent) printf("\tcp %s %s\n", ent->log, file1); else printf("\tln %s %s\n", ent->log, file1); + printf("\ttouch %s\t\t" + "# Update mtime for 'when'-interval processing\n", + file1); } else { if (!(flags & CE_BINARY)) { /* Report the trimming to the old log */ log_trim(ent->log, ent); } savelog(ent->log, file1); + /* + * Interval-based rotations are done using the mtime of + * the most recently archived log, so make sure it gets + * updated during a rotation. + */ + utimes(file1, NULL); } change_attrs(file1, ent); } diff --git a/usr.sbin/pw/pw_group.c b/usr.sbin/pw/pw_group.c index fda62b2..3259412 100644 --- a/usr.sbin/pw/pw_group.c +++ b/usr.sbin/pw/pw_group.c @@ -407,7 +407,7 @@ print_group(struct group * grp, int pretty) char *buf = NULL; buf = gr_make(grp); - fputs(buf, stdout); + printf("%s\n", buf); free(buf); } else { int i; diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 23a7856..38f21ce 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -745,25 +745,20 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) */ if (mode == M_ADD || getarg(args, 'G') != NULL) { - int i, j; + int i; for (i = 0; cnf->groups[i] != NULL; i++) { grp = GETGRNAM(cnf->groups[i]); - for (j = 0; grp->gr_mem[j] != NULL; j++) { - if (!strcmp(grp->gr_mem[j], pwd->pw_name)) - break; - } - if (grp->gr_mem[j] != NULL) /* user already member of group */ + grp = gr_add(grp, pwd->pw_name); + /* + * grp can only be NULL in 2 cases: + * - the new member is already a member + * - a problem with memory occurs + * in both cases we want to skip now. + */ + if (grp == NULL) continue; - - if (j == 0) - grp->gr_mem = NULL; - - grp->gr_mem = reallocf(grp->gr_mem, sizeof(*grp->gr_mem) * - (j + 2)); - - grp->gr_mem[j] = pwd->pw_name; - grp->gr_mem[j+1] = NULL; chggrent(cnf->groups[i], grp); + free(grp); } } diff --git a/usr.sbin/pw/pw_vpw.c b/usr.sbin/pw/pw_vpw.c index 674b64f..99663be 100644 --- a/usr.sbin/pw/pw_vpw.c +++ b/usr.sbin/pw/pw_vpw.c @@ -30,6 +30,10 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include <pwd.h> +#include <grp.h> +#include <libutil.h> +#define _WITH_GETLINE #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -55,101 +59,44 @@ vsetpwent(void) } static struct passwd * -vnextpwent(char const * nam, uid_t uid, int doclose) +vnextpwent(char const *nam, uid_t uid, int doclose) { - struct passwd * pw = NULL; - static char pwtmp[1024]; - - strlcpy(pwtmp, getpwpath(_MASTERPASSWD), sizeof(pwtmp)); - - if (pwd_fp != NULL || (pwd_fp = fopen(pwtmp, "r")) != NULL) { - int done = 0; - - static struct passwd pwd; - - while (!done && fgets(pwtmp, sizeof pwtmp, pwd_fp) != NULL) - { - int i, quickout = 0; - char * q; - char * p = strchr(pwtmp, '\n'); - - if (p == NULL) { - while (fgets(pwtmp, sizeof pwtmp, pwd_fp) != NULL && strchr(pwtmp, '\n')==NULL) - ; /* Skip long lines */ - continue; - } - - /* skip comments & empty lines */ - if (*pwtmp =='\n' || *pwtmp == '#') + struct passwd *pw; + char *line; + size_t linecap; + ssize_t linelen; + + pw = NULL; + line = NULL; + linecap = 0; + linelen = 0; + + if (pwd_fp != NULL || (pwd_fp = fopen(getpwpath(_MASTERPASSWD), "r")) != NULL) { + while ((linelen = getline(&line, &linecap, pwd_fp)) > 0) { + /* Skip comments and empty lines */ + if (*line == '\n' || *line == '#') continue; - - i = 0; - q = p = pwtmp; - bzero(&pwd, sizeof pwd); - while (!quickout && (p = strsep(&q, ":\n")) != NULL) { - switch (i++) - { - case 0: /* username */ - pwd.pw_name = p; - if (nam) { - if (strcmp(nam, p) == 0) - done = 1; - else - quickout = 1; - } - break; - case 1: /* password */ - pwd.pw_passwd = p; - break; - case 2: /* uid */ - pwd.pw_uid = atoi(p); - if (uid != (uid_t)-1) { - if (uid == pwd.pw_uid) - done = 1; - else - quickout = 1; - } - break; - case 3: /* gid */ - pwd.pw_gid = atoi(p); - break; - case 4: /* class */ - if (nam == NULL && uid == (uid_t)-1) - done = 1; - pwd.pw_class = p; - break; - case 5: /* change */ - pwd.pw_change = (time_t)atol(p); - break; - case 6: /* expire */ - pwd.pw_expire = (time_t)atol(p); - break; - case 7: /* gecos */ - pwd.pw_gecos = p; - break; - case 8: /* directory */ - pwd.pw_dir = p; - break; - case 9: /* shell */ - pwd.pw_shell = p; - break; - } - } - } + /* trim latest \n */ + if (line[linelen - 1 ] == '\n') + line[linelen - 1] = '\0'; + pw = pw_scan(line, PWSCAN_MASTER); + if (uid != (uid_t)-1) { + if (uid == pw->pw_uid) + break; + } else if (nam != NULL) { + if (strcmp(nam, pw->pw_name) == 0) + break; + } else + break; + free(pw); + pw = NULL; + } if (doclose) vendpwent(); - if (done && pwd.pw_name) { - pw = &pwd; + } + free(line); - #define CKNULL(s) s = s ? s : "" - CKNULL(pwd.pw_passwd); - CKNULL(pwd.pw_class); - CKNULL(pwd.pw_gecos); - CKNULL(pwd.pw_dir); - CKNULL(pwd.pw_shell); - } - } - return pw; + return (pw); } struct passwd * @@ -192,93 +139,44 @@ vsetgrent(void) } static struct group * -vnextgrent(char const * nam, gid_t gid, int doclose) +vnextgrent(char const *nam, gid_t gid, int doclose) { - struct group * gr = NULL; - - static char * grtmp = NULL; - static int grlen = 0; - static char ** mems = NULL; - static int memlen = 0; - - extendline(&grtmp, &grlen, MAXPATHLEN); - strlcpy(grtmp, getgrpath(_GROUP), MAXPATHLEN); - - if (grp_fp != NULL || (grp_fp = fopen(grtmp, "r")) != NULL) { - int done = 0; - - static struct group grp; - - while (!done && fgets(grtmp, grlen, grp_fp) != NULL) - { - int i, quickout = 0; - int mno = 0; - char * q, * p; - const char * sep = ":\n"; - - if ((p = strchr(grtmp, '\n')) == NULL) { - int l; - extendline(&grtmp, &grlen, grlen + PWBUFSZ); - l = strlen(grtmp); - if (fgets(grtmp + l, grlen - l, grp_fp) == NULL) - break; /* No newline terminator on last line */ - } + struct group *gr; + char *line; + size_t linecap; + ssize_t linelen; + + gr = NULL; + line = NULL; + linecap = 0; + linelen = 0; + + if (grp_fp != NULL || (grp_fp = fopen(getgrpath(_GROUP), "r")) != NULL) { + while ((linelen = getline(&line, &linecap, grp_fp)) > 0) { /* Skip comments and empty lines */ - if (*grtmp == '\n' || *grtmp == '#') + if (*line == '\n' || *line == '#') continue; - i = 0; - q = p = grtmp; - bzero(&grp, sizeof grp); - extendarray(&mems, &memlen, 200); - while (!quickout && (p = strsep(&q, sep)) != NULL) { - switch (i++) - { - case 0: /* groupname */ - grp.gr_name = p; - if (nam) { - if (strcmp(nam, p) == 0) - done = 1; - else - quickout = 1; - } - break; - case 1: /* password */ - grp.gr_passwd = p; + /* trim latest \n */ + if (line[linelen - 1 ] == '\n') + line[linelen - 1] = '\0'; + gr = gr_scan(line); + if (gid != (gid_t)-1) { + if (gid == gr->gr_gid) break; - case 2: /* gid */ - grp.gr_gid = atoi(p); - if (gid != (gid_t)-1) { - if (gid == (gid_t)grp.gr_gid) - done = 1; - else - quickout = 1; - } else if (nam == NULL) - done = 1; + } else if (nam != NULL) { + if (strcmp(nam, gr->gr_name) == 0) break; - case 3: - q = p; - sep = ",\n"; - break; - default: - if (*p) { - extendarray(&mems, &memlen, mno + 2); - mems[mno++] = p; - } - break; - } - } - grp.gr_mem = mems; - mems[mno] = NULL; - } + } else + break; + free(gr); + gr = NULL; + } if (doclose) vendgrent(); - if (done && grp.gr_name) { - gr = &grp; - - CKNULL(grp.gr_passwd); - } } - return gr; + free(line); + + return (gr); } struct group * diff --git a/usr.sbin/pw/pwupd.c b/usr.sbin/pw/pwupd.c index 0f2df7a..22662db 100644 --- a/usr.sbin/pw/pwupd.c +++ b/usr.sbin/pw/pwupd.c @@ -146,7 +146,11 @@ pw_update(struct passwd * pwd, char const * user) pw_fini(); err(1, "pw_copy()"); } - if (pw_mkdb(user) == -1) { + /* + * in case of deletion of a user, the whole database + * needs to be regenerated + */ + if (pw_mkdb(pw != NULL ? user : NULL) == -1) { pw_fini(); err(1, "pw_mkdb()"); } diff --git a/usr.sbin/sade/Makefile b/usr.sbin/sade/Makefile deleted file mode 100644 index 1a7c8b2..0000000 --- a/usr.sbin/sade/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# $FreeBSD$ - -.if ${MACHINE_CPUARCH} != "ia64" -_wizard= wizard.c -.endif - -PROG= sade -MAN= sade.8 -SRCS= command.c devices.c \ - disks.c dmenu.c \ - globals.c install.c \ - label.c main.c menus.c misc.c \ - msg.c system.c termcap.c \ - variable.c ${_wizard} -WARNS?= 3 - -# command.c - -.if ${MACHINE} == "pc98" -CFLAGS+= -DPC98 -.endif -CFLAGS+= -I${.CURDIR}/../../contrib/dialog -I. - -DPADD= ${LIBDIALOG} ${LIBNCURSESW} ${LIBM} ${LIBUTIL} ${LIBDISK} -LDADD= -ldialog -lncursesw -lm -lutil -ldisk - -.include <bsd.prog.mk> diff --git a/usr.sbin/sade/command.c b/usr.sbin/sade/command.c deleted file mode 100644 index b3968df..0000000 --- a/usr.sbin/sade/command.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include "sade.h" - -#define MAX_NUM_COMMANDS 10 - -typedef struct { - char key[FILENAME_MAX]; - struct { - enum { CMD_SHELL, CMD_FUNCTION } type; - void *ptr, *data; - } cmds[MAX_NUM_COMMANDS]; - int ncmds; -} Command; - -#define MAX_CMDS 200 -static Command *commandStack[MAX_CMDS]; -int numCommands; - -/* Nuke the command stack */ -void -command_clear(void) -{ - int i, j; - - for (i = 0; i < numCommands; i++) - for (j = 0; j < commandStack[i]->ncmds; j++) - if (commandStack[i]->cmds[j].type == CMD_SHELL) - free(commandStack[i]->cmds[j].ptr); - free(commandStack[i]); - numCommands = 0; -} - -static void -addit(char *key, int type, void *cmd, void *data) -{ - int i; - - /* First, look for the key already present and add a command to it if found */ - for (i = 0; i < numCommands; i++) { - if (!strcmp(commandStack[i]->key, key)) { - if (commandStack[i]->ncmds == MAX_NUM_COMMANDS) - msgFatal("More than %d commands stacked up behind %s??", MAX_NUM_COMMANDS, key); - commandStack[i]->cmds[commandStack[i]->ncmds].type = type; - commandStack[i]->cmds[commandStack[i]->ncmds].ptr = cmd; - commandStack[i]->cmds[commandStack[i]->ncmds].data = data; - ++(commandStack[i]->ncmds); - return; - } - } - if (numCommands == MAX_CMDS) - msgFatal("More than %d commands accumulated??", MAX_CMDS); - - /* If we fell to here, it's a new key */ - commandStack[numCommands] = safe_malloc(sizeof(Command)); - strcpy(commandStack[numCommands]->key, key); - commandStack[numCommands]->ncmds = 1; - commandStack[numCommands]->cmds[0].type = type; - commandStack[numCommands]->cmds[0].ptr = cmd; - commandStack[numCommands]->cmds[0].data = data; - ++numCommands; -} - -/* Add a shell command under a given key */ -void -command_shell_add(char *key, const char *fmt, ...) -{ - va_list args; - char *cmd; - - cmd = (char *)safe_malloc(256); - va_start(args, fmt); - vsnprintf(cmd, 256, fmt, args); - va_end(args); - - addit(key, CMD_SHELL, cmd, NULL); -} - -/* Add a shell command under a given key */ -void -command_func_add(char *key, commandFunc func, void *data) -{ - addit(key, CMD_FUNCTION, func, data); -} - -static int -sort_compare(Command *p1, Command *p2) -{ - if (!p1 && !p2) - return 0; - else if (!p1 && p2) /* NULL has a "greater" value for commands */ - return 1; - else if (p1 && !p2) - return -1; - else - return strcmp(p1->key, p2->key); -} - -void -command_sort(void) -{ - int i, j; - - commandStack[numCommands] = NULL; - /* Just do a crude bubble sort since the list is small */ - for (i = 0; i < numCommands; i++) { - for (j = 0; j < numCommands; j++) { - if (sort_compare(commandStack[j], commandStack[j + 1]) > 0) { - Command *tmp = commandStack[j]; - - commandStack[j] = commandStack[j + 1]; - commandStack[j + 1] = tmp; - } - } - } -} - -/* Run all accumulated commands in sorted order */ -void -command_execute(void) -{ - int i, j, ret; - commandFunc func; - - for (i = 0; i < numCommands; i++) { - for (j = 0; j < commandStack[i]->ncmds; j++) { - /* If it's a shell command, run system on it */ - if (commandStack[i]->cmds[j].type == CMD_SHELL) { - msgNotify("Doing %s", (char *)commandStack[i]->cmds[j].ptr); - ret = vsystem("%s", (char *)commandStack[i]->cmds[j].ptr); - if (isDebug()) - msgDebug("Command `%s' returns status %d\n", - (char *)commandStack[i]->cmds[j].ptr, ret); - } - else { - /* It's a function pointer - call it with the key and - the data */ - func = (commandFunc)commandStack[i]->cmds[j].ptr; - if (isDebug()) - msgDebug("%p: Execute(%s, %s)\n", - func, commandStack[i]->key, - (char *)commandStack[i]->cmds[j].data); - ret = (*func)(commandStack[i]->key, commandStack[i]->cmds[j].data); - if (isDebug()) - msgDebug("Function @ %p returns status %d\n", - commandStack[i]->cmds[j].ptr, ret); - } - } - } -} diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c deleted file mode 100644 index 672ee20..0000000 --- a/usr.sbin/sade/devices.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include <sys/fcntl.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <sys/errno.h> -#include <sys/time.h> -#include <sys/stat.h> -#include <ctype.h> -#include <libdisk.h> - -#include "sade.h" - -/* how much to bias minor number for a given /dev/<ct#><un#>s<s#> slice */ -#define SLICE_DELTA (0x10000) - -static Device *Devices[DEV_MAX]; -static int numDevs; - -#define DEVICE_ENTRY(type, name, descr, max) { type, name, descr, max } - -#define DISK(name, descr, max) \ - DEVICE_ENTRY(DEVICE_TYPE_DISK, name, descr, max) - -static struct _devname { - DeviceType type; - char *name; - char *description; - int max; -} device_names[] = { - DISK("da%d", "SCSI disk device", 16), - DISK("ad%d", "ATA/IDE disk device", 16), - DISK("ar%d", "ATA/IDE RAID device", 16), - DISK("afd%d", "ATAPI/IDE floppy device", 4), - DISK("mlxd%d", "Mylex RAID disk", 4), - DISK("amrd%d", "AMI MegaRAID drive", 4), - DISK("idad%d", "Compaq RAID array", 4), - DISK("twed%d", "3ware ATA RAID array", 4), - DISK("aacd%d", "Adaptec FSA RAID array", 4), - DISK("ipsd%d", "IBM ServeRAID RAID array", 4), - DISK("mfid%d", "LSI MegaRAID SAS array", 4), - { 0, NULL, NULL, 0 }, -}; - -Device * -new_device(char *name) -{ - Device *dev; - - dev = safe_malloc(sizeof(Device)); - bzero(dev, sizeof(Device)); - if (name) - SAFE_STRCPY(dev->name, name); - return dev; -} - -/* Stubs for unimplemented strategy routines */ -Boolean -dummyInit(Device *dev) -{ - return TRUE; -} - -FILE * -dummyGet(Device *dev, char *dist, Boolean probe) -{ - return NULL; -} - -void -dummyShutdown(Device *dev) -{ - return; -} - -static int -deviceTry(struct _devname dev, char *try, int i) -{ - int fd; - char unit[80]; - - snprintf(unit, sizeof unit, dev.name, i); - snprintf(try, FILENAME_MAX, "/dev/%s", unit); - if (isDebug()) - msgDebug("deviceTry: attempting to open %s\n", try); - fd = open(try, O_RDONLY); - if (fd >= 0) { - if (isDebug()) - msgDebug("deviceTry: open of %s succeeded.\n", try); - } - return fd; -} - -/* Register a new device in the devices array */ -Device * -deviceRegister(char *name, char *desc, char *devname, DeviceType type, - Boolean (*init)(Device *), FILE * (*get)(Device *, char *, Boolean), - void (*shutdown)(Device *), void *private) -{ - Device *newdev = NULL; - - if (numDevs == DEV_MAX) - msgFatal("Too many devices found!"); - else { - newdev = new_device(name); - newdev->description = desc; - newdev->devname = devname; - newdev->type = type; - newdev->init = init ? init : dummyInit; - newdev->get = get ? get : dummyGet; - newdev->shutdown = shutdown ? shutdown : dummyShutdown; - newdev->private = private; - Devices[numDevs] = newdev; - Devices[++numDevs] = NULL; - } - return newdev; -} - -/* Reset the registered device chain */ -void -deviceReset(void) -{ - int i; - - for (i = 0; i < numDevs; i++) { - DEVICE_SHUTDOWN(Devices[i]); - - /* XXX this potentially leaks Devices[i]->private if it's being - * used to point to something dynamic, but you're not supposed - * to call this routine at such times that some open instance - * has its private ptr pointing somewhere anyway. XXX - */ - free(Devices[i]); - } - Devices[numDevs = 0] = NULL; -} - -/* Get all device information for devices we have attached */ -void -deviceGetAll(void) -{ - int i, j; - char **names; - - msgNotify("Probing devices, please wait (this can take a while)..."); - - /* Next, try to find all the types of devices one might need - * during the second stage of the installation. - */ - for (i = 0; device_names[i].name; i++) { - for (j = 0; j < device_names[i].max; j++) { - char try[FILENAME_MAX]; - - switch(device_names[i].type) { - case DEVICE_TYPE_DISK: - deviceTry(device_names[i], try, j); - break; - - default: - break; - } - } - } - - /* Finally, go get the disks and look for DOS partitions to register */ - if ((names = Disk_Names()) != NULL) { - int i; - - for (i = 0; names[i]; i++) { - Disk *d; - - /* Ignore memory disks */ - if (!strncmp(names[i], "md", 2)) - continue; - - /* - * XXX - * Due to unknown reasons, Disk_Names() returns SCSI CDROM as a - * valid disk. This is main reason why sysinstall presents SCSI - * CDROM to available disks in Fdisk/Label menu. In addition, - * adding a blank SCSI CDROM to the menu generates floating point - * exception in sparc64. Disk_Names() just extracts sysctl - * "kern.disks". Why GEOM treats SCSI CDROM as a disk is beyond - * me and that should be investigated. - * For temporary workaround, ignore SCSI CDROM device. - */ - if (!strncmp(names[i], "cd", 2)) - continue; - - d = Open_Disk(names[i]); - if (!d) { - msgDebug("Unable to open disk %s\n", names[i]); - continue; - } - - deviceRegister(names[i], names[i], d->name, DEVICE_TYPE_DISK, - dummyInit, dummyGet, dummyShutdown, d); - if (isDebug()) - msgDebug("Found a disk device named %s\n", names[i]); - -#if 0 - /* Look for existing DOS partitions to register as "DOS media devices" */ - for (c1 = d->chunks->part; c1; c1 = c1->next) { - if (c1->type == fat || c1->type == efi || c1->type == extended) { - Device *dev; - char devname[80]; - - /* Got one! */ - snprintf(devname, sizeof devname, "/dev/%s", c1->name); - dev = deviceRegister(c1->name, c1->name, strdup(devname), DEVICE_TYPE_DOS, - mediaInitDOS, mediaGetDOS, mediaShutdownDOS, NULL); - dev->private = c1; - if (isDebug()) - msgDebug("Found a DOS partition %s on drive %s\n", c1->name, d->name); - } - } -#endif - } - free(names); - } - dlg_clear(); -} - -/* Rescan all devices, after closing previous set - convenience function */ -void -deviceRescan(void) -{ - deviceReset(); - deviceGetAll(); -} - -/* - * Find all devices that match the criteria, allowing "wildcarding" as well - * by allowing NULL or ANY values to match all. The array returned is static - * and may be used until the next invocation of deviceFind(). - */ -Device ** -deviceFind(char *name, DeviceType class) -{ - static Device *found[DEV_MAX]; - int i, j; - - j = 0; - for (i = 0; i < numDevs; i++) { - if ((!name || !strcmp(Devices[i]->name, name)) - && (class == DEVICE_TYPE_ANY || class == Devices[i]->type)) - found[j++] = Devices[i]; - } - found[j] = NULL; - return j ? found : NULL; -} - -Device ** -deviceFindDescr(char *name, char *desc, DeviceType class) -{ - static Device *found[DEV_MAX]; - int i, j; - - j = 0; - for (i = 0; i < numDevs; i++) { - if ((!name || !strcmp(Devices[i]->name, name)) && - (!desc || !strcmp(Devices[i]->description, desc)) && - (class == DEVICE_TYPE_ANY || class == Devices[i]->type)) - found[j++] = Devices[i]; - } - found[j] = NULL; - return j ? found : NULL; -} - -int -deviceCount(Device **devs) -{ - int i; - - if (!devs) - return 0; - for (i = 0; devs[i]; i++); - return i; -} - -/* - * Create a menu listing all the devices of a certain type in the system. - * The passed-in menu is expected to be a "prototype" from which the new - * menu is cloned. - */ -DMenu * -deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d)) -{ - Device **devs; - int numdevs; - DMenu *tmp = NULL; - int i, j; - - devs = deviceFind(NULL, type); - numdevs = deviceCount(devs); - if (!numdevs) - return NULL; - tmp = (DMenu *)safe_malloc(sizeof(DMenu) + (sizeof(dialogMenuItem) * (numdevs + 1))); - bcopy(menu, tmp, sizeof(DMenu)); - for (i = 0; devs[i]; i++) { - tmp->items[i].prompt = devs[i]->name; - for (j = 0; j < numDevs; j++) { - if (devs[i] == Devices[j]) { - tmp->items[i].title = Devices[j]->description; - break; - } - } - if (j == numDevs) - tmp->items[i].title = "<unknown device type>"; - tmp->items[i].fire = hook; - } - tmp->items[i].title = NULL; - return tmp; -} diff --git a/usr.sbin/sade/disks.c b/usr.sbin/sade/disks.c deleted file mode 100644 index 513643b..0000000 --- a/usr.sbin/sade/disks.c +++ /dev/null @@ -1,972 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include "sade.h" -#include <ctype.h> -#include <fcntl.h> -#include <inttypes.h> -#include <libdisk.h> -#include <sys/stat.h> -#include <sys/disklabel.h> - -#ifdef WITH_SLICES -enum size_units_t { UNIT_BLOCKS, UNIT_KILO, UNIT_MEG, UNIT_GIG, UNIT_SIZE }; - -#ifdef PC98 -#define SUBTYPE_FREEBSD 50324 -#define SUBTYPE_FAT 37218 -#else -#define SUBTYPE_FREEBSD 165 -#define SUBTYPE_FAT 6 -#endif -#define SUBTYPE_EFI 239 - -#ifdef PC98 -#define OTHER_SLICE_VALUES \ - "Other popular values are 37218 for a\n" \ - "DOS FAT partition.\n\n" -#else -#define OTHER_SLICE_VALUES \ - "Other popular values are 6 for a\n" \ - "DOS FAT partition, 131 for a Linux ext2fs partition, or\n" \ - "130 for a Linux swap partition.\n\n" -#endif -#define NON_FREEBSD_NOTE \ - "Note: If you choose a non-FreeBSD partition type, it will not\n" \ - "be formatted or otherwise prepared, it will simply reserve space\n" \ - "for you to use another tool, such as DOS format, to later format\n" \ - "and actually use the partition." - -/* Where we start displaying chunk information on the screen */ -#define CHUNK_START_ROW 5 - -/* Where we keep track of MBR chunks */ -#define CHUNK_INFO_ENTRIES 16 -static struct chunk *chunk_info[CHUNK_INFO_ENTRIES]; -static int current_chunk; - -static void diskPartitionNonInteractive(Device *dev); -#if !defined(__ia64__) -static u_char * bootalloc(char *name, size_t *size); -#endif - -static void -record_chunks(Disk *d) -{ - struct chunk *c1 = NULL; - int i = 0; - daddr_t last_free = 0; - - if (!d->chunks) - msgFatal("No chunk list found for %s!", d->name); - - for (c1 = d->chunks->part; c1; c1 = c1->next) { - if (c1->type == unused && c1->size > last_free) { - last_free = c1->size; - current_chunk = i; - } - chunk_info[i++] = c1; - } - chunk_info[i] = NULL; - if (current_chunk >= i) - current_chunk = i - 1; -} - -static daddr_t Total; - -static void -check_geometry(Disk *d) -{ - int sg; - -#ifdef PC98 - if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) -#else - if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) -#endif - { - dlg_clear(); - sg = msgYesNo("WARNING: It is safe to use a geometry of %lu/%lu/%lu for %s on\n" - "computers with modern BIOS versions. If this disk is to be used\n" - "on an old machine it is recommended that it does not have more\n" - "than 65535 cylinders, more than 255 heads, or more than\n" -#ifdef PC98 - "255" -#else - "63" -#endif - " sectors per track.\n" - "\n" - "Would you like to keep using the current geometry?\n", - d->bios_cyl, d->bios_hd, d->bios_sect, d->name); - if (sg == 1) { - Sanitize_Bios_Geom(d); - msgConfirm("A geometry of %lu/%lu/%lu was calculated for %s.\n" - "\n" - "If you are not sure about this, please consult the Hardware Guide\n" - "in the Documentation submenu or use the (G)eometry command to\n" - "change it. Remember: you need to enter whatever your BIOS thinks\n" - "the geometry is! For IDE, it's what you were told in the BIOS\n" - "setup. For SCSI, it's the translation mode your controller is\n" - "using. Do NOT use a ``physical geometry''.\n", - d->bios_cyl, d->bios_hd, d->bios_sect, d->name); - } - } -} - -static void -print_chunks(Disk *d, int u) -{ - int row; - int i; - daddr_t sz; - char *szstr; - - szstr = (u == UNIT_GIG ? "GB" : (u == UNIT_MEG ? "MB" : - (u == UNIT_KILO ? "KB" : "ST"))); - - Total = 0; - for (i = 0; chunk_info[i]; i++) - Total += chunk_info[i]->size; - attrset(A_NORMAL); - mvaddstr(0, 0, "Disk name:\t"); - clrtobot(); - attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL); - attrset(A_REVERSE); mvaddstr(0, 55, "FDISK Partition Editor"); attrset(A_NORMAL); - mvprintw(1, 0, - "DISK Geometry:\t%lu cyls/%lu heads/%lu sectors = %jd sectors (%jdMB)", - d->bios_cyl, d->bios_hd, d->bios_sect, - (intmax_t)d->bios_cyl * d->bios_hd * d->bios_sect, - (intmax_t)d->bios_cyl * d->bios_hd * d->bios_sect / (1024/512) / 1024); - mvprintw(3, 0, "%6s %10s(%s) %10s %8s %6s %10s %8s %8s", - "Offset", "Size", szstr, "End", "Name", "PType", "Desc", - "Subtype", "Flags"); - for (i = 0, row = CHUNK_START_ROW; chunk_info[i]; i++, row++) { - switch(u) { - default: /* fall thru */ - case UNIT_BLOCKS: - sz = chunk_info[i]->size; - break; - case UNIT_KILO: - sz = chunk_info[i]->size / (1024/512); - break; - case UNIT_MEG: - sz = chunk_info[i]->size / (1024/512) / 1024; - break; - case UNIT_GIG: - sz = chunk_info[i]->size / (1024/512) / 1024 / 1024; - break; - } - if (i == current_chunk) - attrset(ATTR_SELECTED); - mvprintw(row, 0, "%10jd %10jd %10jd %8s %6d %10s %8d\t%-6s", - (intmax_t)chunk_info[i]->offset, (intmax_t)sz, - (intmax_t)chunk_info[i]->end, chunk_info[i]->name, - chunk_info[i]->type, - slice_type_name(chunk_info[i]->type, chunk_info[i]->subtype), - chunk_info[i]->subtype, ShowChunkFlags(chunk_info[i])); - if (i == current_chunk) - attrset(A_NORMAL); - } -} - -static void -print_command_summary(void) -{ - mvprintw(14, 0, "The following commands are supported (in upper or lower case):"); - mvprintw(16, 0, "A = Use Entire Disk G = set Drive Geometry C = Create Slice"); - mvprintw(17, 0, "D = Delete Slice Z = Toggle Size Units S = Set Bootable | = Expert m."); - mvprintw(18, 0, "T = Change Type U = Undo All Changes W = Write Changes Q = Finish"); - mvprintw(21, 0, "Use F1 or ? to get more help, arrow keys to select."); - move(0, 0); -} - -#ifdef PC98 -static void -getBootMgr(char *dname, u_char **bootipl, size_t *bootipl_size, - u_char **bootmenu, size_t *bootmenu_size) -{ - static u_char *boot0; - static size_t boot0_size; - static u_char *boot05; - static size_t boot05_size; - - char str[80]; - char *cp; - int i = 0; - - dlg_clr_result(); - cp = variable_get(VAR_BOOTMGR); - if (!cp) { - /* Figure out what kind of IPL the user wants */ - sprintf(str, "Install Boot Manager for drive %s?", dname); - MenuIPLType.title = str; - i = dmenuOpen(&MenuIPLType); - } else { - if (!strncmp(cp, "boot", 4)) - dlg_add_result(MenuIPLType.items[0].prompt); - else - dlg_add_result(MenuIPLType.items[1].prompt); - } - if (cp || i) { - if (!strcmp(dialog_vars.input_result, MenuIPLType.items[0].prompt)) { - if (!boot0) boot0 = bootalloc("boot0", &boot0_size); - *bootipl = boot0; - *bootipl_size = boot0_size; - if (!boot05) boot05 = bootalloc("boot0.5", &boot05_size); - *bootmenu = boot05; - *bootmenu_size = boot05_size; - return; - } - } - *bootipl = NULL; - *bootipl_size = 0; - *bootmenu = NULL; - *bootmenu_size = 0; -} -#else -static void -getBootMgr(char *dname, u_char **bootCode, size_t *bootCodeSize) -{ -#if defined(__i386__) || defined(__amd64__) /* only meaningful on x86 */ - static u_char *mbr, *boot0; - static size_t mbr_size, boot0_size; - char str[80]; - char *cp; - int i = 0; - - dlg_clr_result(); - cp = variable_get(VAR_BOOTMGR); - if (!cp) { - /* Figure out what kind of MBR the user wants */ - sprintf(str, "Install Boot Manager for drive %s?", dname); - MenuMBRType.title = str; - i = dmenuOpen(&MenuMBRType); - } - else { - if (!strcmp(cp, "standard")) - dlg_add_result(MenuMBRType.items[0].prompt); - if (!strncmp(cp, "boot", 4)) - dlg_add_result(MenuMBRType.items[1].prompt); - else - dlg_add_result(MenuMBRType.items[2].prompt); - } - if (cp || i) { - if (!strcmp(dialog_vars.input_result, MenuMBRType.items[0].prompt)) { - if (!mbr) mbr = bootalloc("mbr", &mbr_size); - *bootCode = mbr; - *bootCodeSize = mbr_size; - return; - } else if (!strcmp(dialog_vars.input_result, MenuMBRType.items[1].prompt)) { - if (!boot0) boot0 = bootalloc("boot0", &boot0_size); - *bootCode = boot0; - *bootCodeSize = boot0_size; - return; - } - } -#endif - *bootCode = NULL; - *bootCodeSize = 0; -} -#endif -#endif /* WITH_SLICES */ - -#ifdef WITH_SLICES -void -diskPartition(Device *dev) -{ - char *cp, *p; - int rv, key = 0; - int i; - Boolean chunking; - char *msg = NULL; -#ifdef PC98 - u_char *bootipl; - size_t bootipl_size; - u_char *bootmenu; - size_t bootmenu_size; -#else - u_char *mbrContents; - size_t mbrSize; -#endif - WINDOW *w = savescr(); - Disk *d = (Disk *)dev->private; - int size_unit; - - size_unit = UNIT_BLOCKS; - chunking = TRUE; - keypad(stdscr, TRUE); - - /* Flush both the dialog and curses library views of the screen - since we don't always know who called us */ - dlg_clear(), clear(); - current_chunk = 0; - - /* Set up the chunk array */ - record_chunks(d); - - /* Give the user a chance to sanitize the disk geometry, if necessary */ - check_geometry(d); - - while (chunking) { - char *val, geometry[80]; - - /* Now print our overall state */ - if (d) - print_chunks(d, size_unit); - print_command_summary(); - if (msg) { - attrset(title_attr); mvprintw(23, 0, msg); attrset(A_NORMAL); - beep(); - msg = NULL; - } - else { - move(23, 0); - clrtoeol(); - } - - /* Get command character */ - key = getch(); - switch (toupper(key)) { - case '\014': /* ^L (redraw) */ - clear(); - msg = NULL; - break; - - case '\020': /* ^P */ - case KEY_UP: - case '-': - if (current_chunk != 0) - --current_chunk; - break; - - case '\016': /* ^N */ - case KEY_DOWN: - case '+': - case '\r': - case '\n': - if (chunk_info[current_chunk + 1]) - ++current_chunk; - break; - - case KEY_HOME: - current_chunk = 0; - break; - - case KEY_END: - while (chunk_info[current_chunk + 1]) - ++current_chunk; - break; - - case KEY_F(1): - case '?': - systemDisplayHelp("slice"); - clear(); - break; - - case 'A': - case 'F': /* Undocumented magic Dangerously Dedicated mode */ -#if !defined(__i386__) && !defined(__amd64__) - rv = 1; -#else /* The rest is only relevant on x86 */ - cp = variable_get(VAR_DEDICATE_DISK); - if (cp && !strcasecmp(cp, "always")) - rv = 1; - else if (toupper(key) == 'A') - rv = 0; - else { - rv = msgYesNo("Do you want to do this with a true partition entry\n" - "so as to remain cooperative with any future possible\n" - "operating systems on the drive(s)?\n" - "(See also the section about ``dangerously dedicated''\n" - "disks in the FreeBSD FAQ.)"); - if (rv == -1) - rv = 0; - } -#endif - All_FreeBSD(d, rv); - variable_set2(DISK_PARTITIONED, "yes", 0); - record_chunks(d); - clear(); - break; - - case 'C': - if (chunk_info[current_chunk]->type != unused) - msg = "Slice in use, delete it first or move to an unused one."; - else { - char *val, tmp[20], name[16], *cp; - daddr_t size; - int subtype; - chunk_e partitiontype; -#ifdef PC98 - snprintf(name, sizeof (name), "%s", "FreeBSD"); - val = msgGetInput(name, - "Please specify the name for new FreeBSD slice."); - if (val) - strncpy(name, val, sizeof (name)); -#else - name[0] = '\0'; -#endif - snprintf(tmp, 20, "%jd", (intmax_t)chunk_info[current_chunk]->size); - val = msgGetInput(tmp, "Please specify the size for new FreeBSD slice in blocks\n" - "or append a trailing `M' for megabytes (e.g. 20M)."); - if (val && (size = strtoimax(val, &cp, 0)) > 0) { - if (*cp && toupper(*cp) == 'M') - size *= ONE_MEG; - else if (*cp && toupper(*cp) == 'G') - size *= ONE_GIG; - sprintf(tmp, "%d", SUBTYPE_FREEBSD); - val = msgGetInput(tmp, "Enter type of partition to create:\n\n" - "Pressing Enter will choose the default, a native FreeBSD\n" - "slice (type %u). " - OTHER_SLICE_VALUES - NON_FREEBSD_NOTE, SUBTYPE_FREEBSD); - if (val && (subtype = strtol(val, NULL, 0)) > 0) { - if (subtype == SUBTYPE_FREEBSD) - partitiontype = freebsd; - else if (subtype == SUBTYPE_FAT) - partitiontype = fat; - else if (subtype == SUBTYPE_EFI) - partitiontype = efi; - else -#ifdef PC98 - partitiontype = pc98; -#else - partitiontype = mbr; -#endif - Create_Chunk(d, chunk_info[current_chunk]->offset, size, partitiontype, subtype, - (chunk_info[current_chunk]->flags & CHUNK_ALIGN), name); - variable_set2(DISK_PARTITIONED, "yes", 0); - record_chunks(d); - } - } - clear(); - } - break; - - case KEY_DC: - case 'D': - if (chunk_info[current_chunk]->type == unused) - msg = "Slice is already unused!"; - else { - Delete_Chunk(d, chunk_info[current_chunk]); - variable_set2(DISK_PARTITIONED, "yes", 0); - record_chunks(d); - } - break; - - case 'T': - if (chunk_info[current_chunk]->type == unused) - msg = "Slice is currently unused (use create instead)"; - else { - char *val, tmp[20]; - int subtype; - chunk_e partitiontype; - - sprintf(tmp, "%d", chunk_info[current_chunk]->subtype); - val = msgGetInput(tmp, "New partition type:\n\n" - "Pressing Enter will use the current type. To choose a native\n" - "FreeBSD slice enter %u. " - OTHER_SLICE_VALUES - NON_FREEBSD_NOTE, SUBTYPE_FREEBSD); - if (val && (subtype = strtol(val, NULL, 0)) > 0) { - if (subtype == SUBTYPE_FREEBSD) - partitiontype = freebsd; - else if (subtype == SUBTYPE_FAT) - partitiontype = fat; - else if (subtype == SUBTYPE_EFI) - partitiontype = efi; - else -#ifdef PC98 - partitiontype = pc98; -#else - partitiontype = mbr; -#endif - chunk_info[current_chunk]->type = partitiontype; - chunk_info[current_chunk]->subtype = subtype; - } - } - break; - - case 'G': - snprintf(geometry, 80, "%lu/%lu/%lu", d->bios_cyl, d->bios_hd, d->bios_sect); - val = msgGetInput(geometry, "Please specify the new geometry in cyl/hd/sect format.\n" - "Don't forget to use the two slash (/) separator characters!\n" - "It's not possible to parse the field without them."); - if (val) { - long nc, nh, ns; - nc = strtol(val, &val, 0); - nh = strtol(val + 1, &val, 0); - ns = strtol(val + 1, 0, 0); - Set_Bios_Geom(d, nc, nh, ns); - } - clear(); - break; - - case 'S': - /* Clear active states so we won't have two */ - for (i = 0; (chunk_info[i] != NULL) && (i < CHUNK_INFO_ENTRIES); i++) - chunk_info[i]->flags &= !CHUNK_ACTIVE; - - /* Set Bootable */ - chunk_info[current_chunk]->flags |= CHUNK_ACTIVE; - break; - - case 'U': - if (!variable_cmp(DISK_LABELLED, "written")) { - msgConfirm("You've already written this information out - you\n" - "can't undo it."); - } - else if (!msgNoYes("Are you SURE you want to Undo everything?")) { - char cp[BUFSIZ]; - - sstrncpy(cp, d->name, sizeof cp); - Free_Disk(dev->private); - d = Open_Disk(cp); - if (!d) - msgConfirm("Can't reopen disk %s! Internal state is probably corrupted", cp); - dev->private = d; - variable_unset(DISK_PARTITIONED); - variable_unset(DISK_LABELLED); - if (d) - record_chunks(d); - } - clear(); - break; - - case 'W': - if (!msgNoYes("WARNING: You are about to modify an EXISTING installation.\n" - "You should simply type Q when you are finished\n" - "here and write to the disk from the label editor.\n\n" - "Are you absolutely sure you want to continue?")) { - variable_set2(DISK_PARTITIONED, "yes", 0); - -#ifdef PC98 - /* - * Don't trash the IPL if the first (and therefore only) chunk - * is marked for a truly dedicated disk (i.e., the disklabel - * starts at sector 0), even in cases where the user has - * requested a FreeBSD Boot Manager -- both would be fatal in - * this case. - */ - /* - * Don't offer to update the IPL on this disk if the first - * "real" chunk looks like a FreeBSD "all disk" partition, - * or the disk is entirely FreeBSD. - */ - if ((d->chunks->part->type != freebsd) || - (d->chunks->part->offset > 1)) - getBootMgr(d->name, &bootipl, &bootipl_size, - &bootmenu, &bootmenu_size); - else { - bootipl = NULL; - bootipl_size = 0; - bootmenu = NULL; - bootmenu_size = 0; - } - Set_Boot_Mgr(d, bootipl, bootipl_size, bootmenu, bootmenu_size); -#else - /* - * Don't trash the MBR if the first (and therefore only) chunk - * is marked for a truly dedicated disk (i.e., the disklabel - * starts at sector 0), even in cases where the user has - * requested booteasy or a "standard" MBR -- both would be - * fatal in this case. - */ - /* - * Don't offer to update the MBR on this disk if the first - * "real" chunk looks like a FreeBSD "all disk" partition, - * or the disk is entirely FreeBSD. - */ - if ((d->chunks->part->type != freebsd) || - (d->chunks->part->offset > 1)) - getBootMgr(d->name, &mbrContents, &mbrSize); - else { - mbrContents = NULL; - mbrSize = 0; - } - Set_Boot_Mgr(d, mbrContents, mbrSize); -#endif - - if (DITEM_STATUS(diskPartitionWrite(dev)) != DITEM_SUCCESS) - msgConfirm("Disk partition write returned an error status!"); - else - msgConfirm("Wrote FDISK partition information out successfully."); - } - clear(); - break; - - case '|': - if (!msgNoYes("Are you SURE you want to go into Wizard mode?\n" - "No seat belts whatsoever are provided!")) { - clear(); - refresh(); - slice_wizard(d); - variable_set2(DISK_PARTITIONED, "yes", 0); - record_chunks(d); - } - else - msg = "Wise choice!"; - clear(); - break; - - case '\033': /* ESC */ - case 'Q': - chunking = FALSE; -#ifdef PC98 - /* - * Don't trash the IPL if the first (and therefore only) chunk - * is marked for a truly dedicated disk (i.e., the disklabel - * starts at sector 0), even in cases where the user has requested - * a FreeBSD Boot Manager -- both would be fatal in this case. - */ - /* - * Don't offer to update the IPL on this disk if the first "real" - * chunk looks like a FreeBSD "all disk" partition, or the disk is - * entirely FreeBSD. - */ - if ((d->chunks->part->type != freebsd) || - (d->chunks->part->offset > 1)) { - if (variable_cmp(DISK_PARTITIONED, "written")) { - getBootMgr(d->name, &bootipl, &bootipl_size, - &bootmenu, &bootmenu_size); - if (bootipl != NULL && bootmenu != NULL) - Set_Boot_Mgr(d, bootipl, bootipl_size, - bootmenu, bootmenu_size); - } - } -#else - /* - * Don't trash the MBR if the first (and therefore only) chunk - * is marked for a truly dedicated disk (i.e., the disklabel - * starts at sector 0), even in cases where the user has requested - * booteasy or a "standard" MBR -- both would be fatal in this case. - */ - /* - * Don't offer to update the MBR on this disk if the first "real" - * chunk looks like a FreeBSD "all disk" partition, or the disk is - * entirely FreeBSD. - */ - if ((d->chunks->part->type != freebsd) || - (d->chunks->part->offset > 1)) { - if (variable_cmp(DISK_PARTITIONED, "written")) { - getBootMgr(d->name, &mbrContents, &mbrSize); - if (mbrContents != NULL) - Set_Boot_Mgr(d, mbrContents, mbrSize); - } - } -#endif - break; - - case 'Z': - size_unit = (size_unit + 1) % UNIT_SIZE; - break; - - default: - beep(); - msg = "Type F1 or ? for help"; - break; - } - } - p = CheckRules(d); - if (p) { - char buf[FILENAME_MAX]; - DIALOG_VARS save_vars; - - dlg_save_vars(&save_vars); - dialog_vars.help_line = "Press F1 to read more about disk slices."; - dialog_vars.help_file = systemHelpFile("partition", buf); - if (!variable_get(VAR_NO_WARN)) - xdialog_msgbox("Disk slicing warning:", p, -1, -1, 1); - free(p); - dlg_restore_vars(&save_vars); - } - restorescr(w); -} -#endif /* WITH_SLICES */ - -#if !defined(__ia64__) -static u_char * -bootalloc(char *name, size_t *size) -{ - char buf[FILENAME_MAX]; - struct stat sb; - - snprintf(buf, sizeof buf, "/boot/%s", name); - if (stat(buf, &sb) != -1) { - int fd; - - fd = open(buf, O_RDONLY); - if (fd != -1) { - u_char *cp; - - cp = malloc(sb.st_size); - if (read(fd, cp, sb.st_size) != sb.st_size) { - free(cp); - close(fd); - msgDebug("bootalloc: couldn't read %ld bytes from %s\n", (long)sb.st_size, buf); - return NULL; - } - close(fd); - if (size != NULL) - *size = sb.st_size; - return cp; - } - msgDebug("bootalloc: couldn't open %s\n", buf); - } - else - msgDebug("bootalloc: can't stat %s\n", buf); - return NULL; -} -#endif /* !__ia64__ */ - -#ifdef WITH_SLICES -static int -partitionHook(dialogMenuItem *selected) -{ - Device **devs = NULL; - - devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK); - if (!devs) { - msgConfirm("Unable to find disk %s!", selected->prompt); - return DITEM_FAILURE; - } - diskPartition(devs[0]); - return DITEM_SUCCESS; -} - -int -diskPartitionEditor(dialogMenuItem *self) -{ - DMenu *menu; - Device **devs; - - devs = deviceFind(variable_get(VAR_DISK), DEVICE_TYPE_DISK); - if (devs == NULL) { - msgConfirm("No disks found! Please verify that your disk controller is being\n" - "properly probed at boot time. See the Hardware Guide on the\n" - "Documentation menu for clues on diagnosing this type of problem."); - return DITEM_FAILURE; - } - else { - /* No disks are selected, fall-back case now */ - int cnt = deviceCount(devs); - - if (cnt == 1) { - if (variable_get(VAR_NONINTERACTIVE) && - !variable_get(VAR_DISKINTERACTIVE)) - diskPartitionNonInteractive(devs[0]); - else - diskPartition(devs[0]); - return DITEM_SUCCESS; - } - else { - int result; - - menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, partitionHook); - if (!menu) { - msgConfirm("No devices suitable for installation found!\n\n" - "Please verify that your disk controller (and attached drives)\n" - "were detected properly. This can be done by pressing the\n" - "[Scroll Lock] key and using the Arrow keys to move back to\n" - "the boot messages. Press [Scroll Lock] again to return."); - return DITEM_FAILURE; - } - - result = dmenuOpen(menu) ? DITEM_SUCCESS : DITEM_FAILURE; - free(menu); - return result; - } - } - return DITEM_SUCCESS; -} -#endif /* WITH_SLICES */ - -int -diskPartitionWrite(Device *dev) -{ - Disk *d = (Disk *)dev->private; -#if !defined(__ia64__) - static u_char *boot1; -#endif -#if defined(__i386__) || defined(__amd64__) - static u_char *boot2; -#endif - - if (!variable_cmp(DISK_PARTITIONED, "written")) - return DITEM_SUCCESS; - -#if defined(__i386__) || defined(__amd64__) - if (!boot1) boot1 = bootalloc("boot1", NULL); - if (!boot2) boot2 = bootalloc("boot2", NULL); - Set_Boot_Blocks(d, boot1, boot2); -#elif !defined(__ia64__) - if (!boot1) boot1 = bootalloc("boot1", NULL); - Set_Boot_Blocks(d, boot1, NULL); -#endif - - msgNotify("Writing partition information to drive %s", d->name); - if (!Fake && Write_Disk(d)) { - msgConfirm("ERROR: Unable to write data to disk %s!", d->name); - return DITEM_FAILURE; - } - - /* Now it's not "yes", but "written" */ - variable_set2(DISK_PARTITIONED, "written", 0); - return DITEM_SUCCESS | DITEM_RESTORE; -} - -#ifdef WITH_SLICES -/* Partition a disk based wholly on which variables are set */ -static void -diskPartitionNonInteractive(Device *dev) -{ - char *cp; - int i, all_disk = 0; - daddr_t sz; -#ifdef PC98 - u_char *bootipl; - size_t bootipl_size; - u_char *bootmenu; - size_t bootmenu_size; -#else - u_char *mbrContents; - size_t mbrSize; -#endif - Disk *d = (Disk *)dev->private; - - record_chunks(d); - cp = variable_get(VAR_GEOMETRY); - if (cp) { - if (!strcasecmp(cp, "sane")) { -#ifdef PC98 - if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) -#else - if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) -#endif - { - msgDebug("Warning: A geometry of %lu/%lu/%lu for %s is incorrect.\n", - d->bios_cyl, d->bios_hd, d->bios_sect, d->name); - Sanitize_Bios_Geom(d); - msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n", - d->name, d->bios_cyl, d->bios_hd, d->bios_sect); - } - } else { - msgDebug("Setting geometry from script to: %s\n", cp); - d->bios_cyl = strtol(cp, &cp, 0); - d->bios_hd = strtol(cp + 1, &cp, 0); - d->bios_sect = strtol(cp + 1, 0, 0); - } - } - - cp = variable_get(VAR_PARTITION); - if (cp) { - if (!strcmp(cp, "free")) { - /* Do free disk space case */ - for (i = 0; chunk_info[i]; i++) { - /* If a chunk is at least 10MB in size, use it. */ - if (chunk_info[i]->type == unused && chunk_info[i]->size > (10 * ONE_MEG)) { - Create_Chunk(d, chunk_info[i]->offset, chunk_info[i]->size, - freebsd, 3, - (chunk_info[i]->flags & CHUNK_ALIGN), - "FreeBSD"); - variable_set2(DISK_PARTITIONED, "yes", 0); - break; - } - } - if (!chunk_info[i]) { - msgConfirm("Unable to find any free space on this disk!"); - return; - } - } - else if (!strcmp(cp, "all")) { - /* Do all disk space case */ - msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name); - - All_FreeBSD(d, FALSE); - } - else if (!strcmp(cp, "exclusive")) { - /* Do really-all-the-disk-space case */ - msgDebug("Warning: Devoting all of disk %s to FreeBSD.\n", d->name); - - All_FreeBSD(d, all_disk = TRUE); - } - else if ((sz = strtoimax(cp, &cp, 0))) { - /* Look for sz bytes free */ - if (*cp && toupper(*cp) == 'M') - sz *= ONE_MEG; - else if (*cp && toupper(*cp) == 'G') - sz *= ONE_GIG; - for (i = 0; chunk_info[i]; i++) { - /* If a chunk is at least sz MB, use it. */ - if (chunk_info[i]->type == unused && chunk_info[i]->size >= sz) { - Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3, - (chunk_info[i]->flags & CHUNK_ALIGN), - "FreeBSD"); - variable_set2(DISK_PARTITIONED, "yes", 0); - break; - } - } - if (!chunk_info[i]) { - msgConfirm("Unable to find %jd free blocks on this disk!", - (intmax_t)sz); - return; - } - } - else if (!strcmp(cp, "existing")) { - /* Do existing FreeBSD case */ - for (i = 0; chunk_info[i]; i++) { - if (chunk_info[i]->type == freebsd) - break; - } - if (!chunk_info[i]) { - msgConfirm("Unable to find any existing FreeBSD partitions on this disk!"); - return; - } - } - else { - msgConfirm("`%s' is an invalid value for %s - is config file valid?", cp, VAR_PARTITION); - return; - } - if (!all_disk) { -#ifdef PC98 - getBootMgr(d->name, &bootipl, &bootipl_size, - &bootmenu, &bootmenu_size); - Set_Boot_Mgr(d, bootipl, bootipl_size, bootmenu, bootmenu_size); -#else - getBootMgr(d->name, &mbrContents, &mbrSize); - Set_Boot_Mgr(d, mbrContents, mbrSize); -#endif - } - variable_set2(DISK_PARTITIONED, "yes", 0); - } -} -#endif /* WITH_SLICES */ diff --git a/usr.sbin/sade/dmenu.c b/usr.sbin/sade/dmenu.c deleted file mode 100644 index 186c1e9..0000000 --- a/usr.sbin/sade/dmenu.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include "sade.h" -#include <errno.h> - -#define MAX_MENU 15 - -static int -menu_height(DMenu *menu, int n) -{ - int max; - char *t; - - max = MAX_MENU; - if (StatusLine > 24) - max += StatusLine - 24; - for (t = menu->prompt; *t; t++) { - if (*t == '\n') - --max; - } - return n > max ? max : n; -} - -/* Traverse over an internal menu */ -Boolean -dmenuOpen(DMenu *menu) -{ - int n, rval = 0; - - /* Count up all the items */ - for (n = 0; menu->items[n].title; n++) - ; - - while (1) { - char buf[FILENAME_MAX]; - DIALOG_VARS save_vars; - WINDOW *w = savescr(); - - /* Any helpful hints, put 'em up! */ - dlg_save_vars(&save_vars); - dialog_vars.help_line = menu->helpline; - dialog_vars.help_file = systemHelpFile(menu->helpfile, buf); - dlg_clear(); - /* Pop up that dialog! */ - if (menu->type & DMENU_NORMAL_TYPE) { - rval = xdialog_menu(menu->title, menu->prompt, - -1, -1, menu_height(menu, n), n, menu->items); - } else if (menu->type & DMENU_RADIO_TYPE) { - rval = xdialog_radiolist(menu->title, menu->prompt, - -1, -1, menu_height(menu, n), n, menu->items); - } else { - msgFatal("Menu: `%s' is of an unknown type\n", menu->title); - } - dlg_restore_vars(&save_vars); - if (rval) { - restorescr(w); - return FALSE; - } else if (menu->type & DMENU_SELECTION_RETURNS) { - restorescr(w); - return TRUE; - } else - delwin(w); - } -} diff --git a/usr.sbin/sade/globals.c b/usr.sbin/sade/globals.c deleted file mode 100644 index 0b08da3..0000000 --- a/usr.sbin/sade/globals.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include "sade.h" - -/* - * Various global variables and an initialization hook to set them to - * whatever values we feel are appropriate. - */ - -int DebugFD; /* Where diagnostic output goes */ -Boolean Fake; /* Only pretend to be useful */ -Boolean DialogActive; /* Is libdialog initialized? */ -Boolean ColorDisplay; /* Are we on a color display? */ -Boolean OnVTY; /* Are we on a VTY? */ -Boolean Restarting; /* Are we restarting sysinstall? */ -Variable *VarHead; /* The head of the variable chain */ -int BootMgr; /* Which boot manager we're using */ -int StatusLine; /* Where to stick our status messages */ -jmp_buf BailOut; /* Beam me up, scotty! The natives are pissed! */ - -Chunk *HomeChunk; -Chunk *RootChunk; -Chunk *SwapChunk; -Chunk *TmpChunk; -Chunk *UsrChunk; -Chunk *VarChunk; -#ifdef __ia64__ -Chunk *EfiChunk; -#endif - -/* - * Yes, I know some of these are already automatically initialized as - * globals. I simply find it clearer to set everything explicitly. - */ -void -globalsInit(void) -{ - DebugFD = -1; - ColorDisplay = FALSE; - Fake = FALSE; - Restarting = FALSE; - OnVTY = FALSE; - DialogActive = FALSE; - VarHead = NULL; - - HomeChunk = NULL; - RootChunk = NULL; - SwapChunk = NULL; - TmpChunk = NULL; - UsrChunk = NULL; - VarChunk = NULL; -#ifdef __ia64__ - EfiChunk = NULL; -#endif -} diff --git a/usr.sbin/sade/help/partition.hlp b/usr.sbin/sade/help/partition.hlp deleted file mode 100644 index 3d13b34..0000000 --- a/usr.sbin/sade/help/partition.hlp +++ /dev/null @@ -1,169 +0,0 @@ -This is the FreeBSD DiskLabel Editor. - -NOTE: If you're entering this editor from the update procedure then -you probably shouldn't (C)reate anything at all but rather use only -the (M)ount command to check and mount existing partitions for -upgrading. - -If you would like the label editor to do most of the following for -you, simply type `A' for automatic partitioning of the disk. - -If you wish to create partitions manually you may do so by moving the -highlighted selection bar with the arrow keys over the FreeBSD -partition(s) displayed at the top of the screen. Typing (C)reate -while a partition with available free space is selected will allow you -to create a BSD partition inside of it using some or all of its -available space. - -Typing (M)ount over an existing partition entry (displayed in the -middle of the screen) will allow you to set a mount point for it -without initializing it. If you want it initialized, use the (T)oggle -command to flip the Newfs flag. When Newfs is set to "Y", the -filesystem in question will be ERASED and rebuilt from scratch! - - -You should use this editor to create at least the following -filesystems: - - Name Purpose Min Size? Optional? - ---- ------- --------- --------- - / Root filesystem 118MB No - swap Swap space 2 * MEM No - /usr System & user files 128MB or more Yes - -Note: If you do not create a /usr filesystem then your / filesystem -will need to be bigger - at least 240MB. This is not recommended as -any media errors that may occur during disk I/O to user files will -corrupt the filesystem containing vital system files as well. It is -for this reason that / is generally kept on its own filesystem, where -it should be considered essentially "read only" in your administration -of it. - -Swap space is a little tricker, and the rule of "2 * MEM" is simply a -best-guess approximation and not necessarily accurate for your -intended usage of the system. If you intend to use the system heavily -in a server or multi-user application, you may be well advised to -increase this size. You may also create swap space on multiple drives -for a larger "total" swap and this is, in fact, recommended if you -have multiple, fast drives for which such load-balancing can only help -overall I/O performance. - -The /usr filesystem should be sized according to what kind of -distributions you're trying to load and how many packages you intend -to install in locations like /usr/local. You can also make /usr/local -a separate filesystem if you don't want to risk filling up your /usr -by mistake. - -Another useful filesystem to create is /var, which contains mail, news -printer spool files and other temporary items. It is a popular -candidate for a separate partition and should be sized according to -your estimates of the amount of mail, news or spooled print jobs that -may be stored there. - -WARNING: If you do not create a separate filesystem for /var, space -for such files will be allocated out of the root (/) filesystem -instead. You may therefore wish to make the / partition bigger if you -expect a lot of mail or news and do not want to make /var its own -partition. - -If you're new to this installation, you might also want to read the -following explanation of how FreeBSD's new "slice" paradigm for -looking at disk storage works: - - -In FreeBSD's new system, a device name can be broken up into up to 3 -parts. Take a typical name like ``/dev/da0s1a'': - - The first three characters represent the drive name. If we had - a system with two SCSI drives on it then we'd see /dev/da0 and - /dev/da1 as the device entries representing the entire drives. - - Next you have the "slice" (or "FDISK Partition") number, - as seen in the Partition Editor. Assuming that our da0 - contained two slices, a FreeBSD slice and a DOS slice, that - would give us /dev/da0s1 and /dev/da0s2 as device entries pointing - to the entire slices. - - Next, if a slice is a FreeBSD slice, you can have a number of - (confusingly named) "partitions" inside of it. - - These partitions are where various filesystems or swap areas live, - and using our hypothetical two-SCSI-disk machine again, we might - have something like the following layout on da0: - - Name Mountpoint - ---- ---------- - da0s1a / - da0s1b <swap space> - da0s1e /usr - -Once you understand all this, then the purpose of the label editor -becomes fairly clear: You're carving up the FreeBSD slices displayed -at the top of the screen into smaller pieces, which are displayed in -the middle of the screen, and then assigning FreeBSD file system names -(mount points) to them. - -You can also use the label editor to mount existing partitions/slices -into your filesystem hierarchy, as is frequently done for DOS FAT -slices. For FreeBSD partitions, you can also toggle the "newfs" state -so that the partitions are either (re)created from scratch or simply -checked and mounted (the contents are preserved). - -If you set (S)oftUpdates on a filesystem, it will cause the -"Soft Updates" policy to be in effect for it. This basically causes -both metadata and data blocks to be written asynchronously to disk, -but with extra state information which causes the metadata and any -related data blocks to be committed in a single transaction. This -results in async metadata update speeds (which are considerably -faster than the default sync) without the potential for data loss -which could occur if you simply mounted the filesystem with purely -"async" update policy and then had a power failure. If you wish -to later turn the softupdates policy back off, use the command -"tunefs -n disable devicename". NOTE: It is probably not wise -to use this on your root filesystem unless you have a large -(e.g. non-standard size) root. The reason is that smaller filesystems -with significant activity can temporarily overflow if the soft updates -policy results in free'd blocks not being "garbage collected" as fast -as they're being requested. - -The UNIX File System (UFS) on FreeBSD supports two different on-disk -layouts: UFS1 and UFS2. UFS1 was the default file system in use -through FreeBSD 5.0-RELEASE; as of FreeBSD 5.1-RELEASE, the default -is now UFS2, with the exception of the PC98 platform. UFS2 provides -sparse inode allocation (faster fsck), 64-bit storage pointers (larger -maximum size), and native extended attributes (required for ACLs, MAC, -and other advanced security and file system services). The selection -of UFS1 or UFS2 must be made when the file system is created--later -conversion is not currently possible. UFS2 is the recommended file -system, but if disks are to be used on older FreeBSD systems, UFS1 -improves portability. When dual-booting between FreeBSD 4.x or -earlier and FreeBSD 5.x, UFS1 file systems will be accessible from -both. To toggle a file system to UFS1, press '1'. To restore it to -UFS2, press '2'. - -WARNING: FreeBSD on i386 is currently unable to boot from root file -systems larger than 1.5TB. - -To add additional flags to the newfs command line for UFS file -systems, press 'N'. These options will be specified before the -device argument of the command line, but after any other options -placed there by sysinstall, such as the UFS version and soft -updates flag; as such, arguments provided may override existing -settings. To completely replace the newfs command used by -sysinstall, press 'Z' to convert a partition to a Custom -partition type. Sysinstall will prompt you with the newfs -command line that it would have used based on existing settings -prior to the change, but allow you to modify any aspect of the -command line. Once a partition has been converted to a custom -partition in the label editor, you will need to restart the -labeling process or delete and recreate the partition to restore -it to a non-custom state. Custom partitions are represented by -the letters "CST" instead of "UFS" or "FAT. - -When you're done, type `Q' to exit. - -No actual changes will be made to the disk until you (C)ommit from the -Install menu or (W)rite directly from this one. You're working with -what is essentially a copy of the disk label(s), both here and in the -FDISK Partition Editor, and the actual on-disk labels won't be -affected by any changes you make until you explicitly say so. diff --git a/usr.sbin/sade/help/slice.hlp b/usr.sbin/sade/help/slice.hlp deleted file mode 100644 index e9f3abb..0000000 --- a/usr.sbin/sade/help/slice.hlp +++ /dev/null @@ -1,57 +0,0 @@ -This is the Main Slice (``FDISK'' or PC-style Partition) Editor. - -Possible commands are printed at the bottom and the Master Boot Record -contents are shown at the top. You can move up and down with the -arrow keys and (C)reate a new slice whenever the highlighted -selection bar is over a slice whose type is marked as "unused." - -You are expected to leave this screen with at least one slice -marked "FreeBSD." Note that unlike Linux, you don't need to create -multiple FreeBSD FDISK partition entries for different things like -swap, file systems, etc. The usual convention is to create ONE -FreeBSD slice (FDISK partition) per drive and then subsection this slice -into swap and file systems with the Label editor. - -No actual changes will be made to the disk until you (C)ommit from the -Install menu or use the (W)rite option here! You're working with what -is essentially a copy of the disk label(s), both here and in the Label -Editor. - -If you want to use the entire disk for FreeBSD, type `A'. Slices will -be aligned to fictitious cylinder boundaries and space will be reserved -in front of the FreeBSD slice for a [future] possible boot manager. - -For the truly dedicated disk case, type `F'. You'll be asked whether or -not you wish to keep the disk (potentially) compatible with other -operating systems, i.e. the information in the FDISK table should be -kept valid. A truly dedicated disk can be achieved by selecting `No'. -In that case, all BIOS geometry considerations will no longer be in -effect and you can safely ignore any ``The detected geometry is -invalid'' warning messages you may later see. It is also not necessary -in this case to set a slice bootable or install an MBR boot manager as -both things are then irrelevant. The FreeBSD slice will start at -absolute sector 0 of the disk (so that FreeBSD's disk label is identical -to the Master Boot Record) and extend to the very last sector of the -disk medium. Needless to say, such a disk cannot have any sort of a -boot manager, `disk manager', or anything else that has to interact with -the BIOS. This option is therefore only considered safe for SCSI disks -and most IDE disks and is primarily intended for people who are going to -set up a dedicated FreeBSD server or workstation, not a typical `home PC'. - -If you select the default of `Yes' at the compatibility, slices will be -aligned to fictitious cylinder boundaries and space will be reserved -in front of the FreeBSD slice for a [future] possible boot manager. -This is pretty much equivalent to having chosen `A' originally. - -The flags field has the following legend: - - '=' -- This slice is properly aligned. - 'A' -- This slice is marked active. - 'R' -- This slice contains the root (/) filesystem - -If no slice is marked Active, you will need to either install -a Boot Manager (the option for which will be presented later in the -installation) or set one Active before leaving this screen. - -To leave the slice editor, type `Q'. - diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c deleted file mode 100644 index e3364fe..0000000 --- a/usr.sbin/sade/install.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include <ctype.h> -#include <sys/consio.h> -#include <sys/disklabel.h> -#include <sys/errno.h> -#include <sys/ioctl.h> -#include <sys/fcntl.h> -#include <sys/wait.h> -#include <sys/uio.h> -#include <sys/param.h> -#define MSDOSFS -#include <sys/mount.h> -#include <ufs/ufs/ufsmount.h> -#include <fs/msdosfs/msdosfsmount.h> -#undef MSDOSFS -#include <sys/stat.h> -#include <sys/sysctl.h> -#include <libdisk.h> -#include <limits.h> -#include <unistd.h> -#include <termios.h> - -#include "sade.h" - -#define TERMCAP_FILE "/usr/share/misc/termcap" - -Boolean -checkLabels(Boolean whinge) -{ - Boolean status; - - /* Don't allow whinging if noWarn is set */ - if (variable_get(VAR_NO_WARN)) - whinge = FALSE; - - status = TRUE; - HomeChunk = RootChunk = SwapChunk = NULL; - TmpChunk = UsrChunk = VarChunk = NULL; -#ifdef __ia64__ - EfiChunk = NULL; -#endif - - /* We don't need to worry about root/usr/swap if we're already multiuser */ - return status; -} - -#define QUEUE_YES 1 -#define QUEUE_NO 0 -static int -performNewfs(PartInfo *pi, char *dname, int queue) -{ - char buffer[LINE_MAX]; - - if (pi->do_newfs) { - switch(pi->newfs_type) { - case NEWFS_UFS: - snprintf(buffer, LINE_MAX, "%s %s %s %s %s", - NEWFS_UFS_CMD, - pi->newfs_data.newfs_ufs.softupdates ? "-U" : "", - pi->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2", - pi->newfs_data.newfs_ufs.user_options, - dname); - break; - - case NEWFS_MSDOS: - snprintf(buffer, LINE_MAX, "%s %s", NEWFS_MSDOS_CMD, - dname); - break; - - case NEWFS_CUSTOM: - snprintf(buffer, LINE_MAX, "%s %s", - pi->newfs_data.newfs_custom.command, dname); - break; - } - - if (queue == QUEUE_YES) { - command_shell_add(pi->mountpoint, "%s", buffer); - return (0); - } else - return (vsystem("%s", buffer)); - } - return (0); -} - -/* Go newfs and/or mount all the filesystems we've been asked to */ -int -installFilesystems(Device *dev) -{ - Disk *disk = (Disk *)dev->private; - Chunk *c1, *c2; - PartInfo *root; - char dname[80]; - Boolean upgrade = FALSE; - - /* If we've already done this, bail out */ - if (!variable_cmp(DISK_LABELLED, "written")) - return DITEM_SUCCESS; - - upgrade = !variable_cmp(SYSTEM_STATE, "upgrade"); - if (!checkLabels(TRUE)) - return DITEM_FAILURE; - - root = (RootChunk != NULL) ? (PartInfo *)RootChunk->private_data : NULL; - - command_clear(); - - /* Now buzz through the rest of the partitions and mount them too */ - if (!disk->chunks) { - msgConfirm("No chunk list found for %s!", disk->name); - return DITEM_FAILURE | DITEM_RESTORE; - } - for (c1 = disk->chunks->part; c1; c1 = c1->next) { -#ifdef __ia64__ - if (c1->type == part) { - c2 = c1; - { -#elif defined(__powerpc__) - if (c1->type == apple) { - for (c2 = c1->part; c2; c2 = c2->next) { -#else - if (c1->type == freebsd) { - for (c2 = c1->part; c2; c2 = c2->next) { -#endif - if (c2->type == part && c2->subtype != FS_SWAP && c2->private_data) { - PartInfo *tmp = (PartInfo *)c2->private_data; - - /* Already did root */ - if (c2 == RootChunk) - continue; - - sprintf(dname, "/dev/%s", c2->name); - - if (tmp->do_newfs && (!upgrade || - !msgNoYes("You are upgrading - are you SURE you" - " want to newfs /dev/%s?", c2->name))) - performNewfs(tmp, dname, QUEUE_YES); - else - command_shell_add(tmp->mountpoint, - "fsck_ffs -y /dev/%s", c2->name); - command_func_add(tmp->mountpoint, Mount, c2->name); - } - else if (c2->type == part && c2->subtype == FS_SWAP) { - char fname[80]; - int i; - - if (c2 == SwapChunk) - continue; - sprintf(fname, "/dev/%s", c2->name); - i = (Fake || swapon(fname)); - if (!i) { - dlg_clear(); - msgNotify("Added %s as an additional swap device", fname); - } - else { - msgConfirm("Unable to add %s as a swap device: %s", fname, strerror(errno)); - } - } - } - } - else if (c1->type == fat && c1->private_data && - (root->do_newfs || upgrade)) { - char name[FILENAME_MAX]; - - sprintf(name, "/%s", ((PartInfo *)c1->private_data)->mountpoint); - Mkdir(name); - } -#if defined(__ia64__) - else if (c1->type == efi && c1->private_data) { - PartInfo *pi = (PartInfo *)c1->private_data; - - sprintf(dname, "/dev/%s", c1->name); - - if (pi->do_newfs && (!upgrade || - !msgNoYes("You are upgrading - are you SURE you want to " - "newfs /dev/%s?", c1->name))) - performNewfs(pi, dname, QUEUE_YES); - } -#endif - } - - command_sort(); - command_execute(); - dlg_clear(); - return DITEM_SUCCESS | DITEM_RESTORE; -} - -static char * -getRelname(void) -{ - static char buf[64]; - size_t sz = (sizeof buf) - 1; - - if (sysctlbyname("kern.osrelease", buf, &sz, NULL, 0) != -1) { - buf[sz] = '\0'; - return buf; - } - else - return "<unknown>"; -} - -/* Initialize various user-settable values to their defaults */ -int -installVarDefaults(dialogMenuItem *self) -{ - - /* Set default startup options */ - variable_set2(VAR_RELNAME, getRelname(), 0); - variable_set2(SYSTEM_STATE, "update", 0); - variable_set2(VAR_NEWFS_ARGS, "-b 16384 -f 2048", 0); - variable_set2(VAR_CONSTERM, "NO", 0); - return DITEM_SUCCESS; -} - -/* Load the environment up from various system configuration files */ -void -installEnvironment(void) -{ -} - diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c deleted file mode 100644 index d6b03b5..0000000 --- a/usr.sbin/sade/label.c +++ /dev/null @@ -1,1646 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include <sys/types.h> -#include <ctype.h> -#include <inttypes.h> -#include <libdisk.h> -#include <sys/disklabel.h> -#include <sys/param.h> -#include <sys/sysctl.h> - -#include "sade.h" - -#define AUTO_HOME 0 /* do not create /home automatically */ - -/* - * Everything to do with editing the contents of disk labels. - */ - -/* A nice message we use a lot in the disklabel editor */ -#define MSG_NOT_APPLICABLE "That option is not applicable here" - -/* Where to start printing the freebsd slices */ -#define CHUNK_SLICE_START_ROW 2 -#define CHUNK_PART_START_ROW 11 - -/* The smallest filesystem we're willing to create */ -#define FS_MIN_SIZE ONE_MEG - -/* - * Minimum partition sizes - */ -#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || defined(__amd64__) -#define ROOT_MIN_SIZE 128 -#else -#define ROOT_MIN_SIZE 118 -#endif -#define SWAP_MIN_SIZE 32 -#define USR_MIN_SIZE 128 -#define VAR_MIN_SIZE 20 -#define TMP_MIN_SIZE 20 -#define HOME_MIN_SIZE 20 - -/* - * Swap size limit for auto-partitioning (4G). - */ -#define SWAP_AUTO_LIMIT_SIZE 4096 - -/* - * Default partition sizes. If we do not have sufficient disk space - * for this configuration we scale things relative to the NOM vs DEFAULT - * sizes. If the disk is larger then /home will get any remaining space. - */ -#define ROOT_DEFAULT_SIZE 512 -#define USR_DEFAULT_SIZE 8192 -#define VAR_DEFAULT_SIZE 1024 -#define TMP_DEFAULT_SIZE 512 -#define HOME_DEFAULT_SIZE USR_DEFAULT_SIZE - -/* - * Nominal partition sizes. These are used to scale the default sizes down - * when we have insufficient disk space. If this isn't sufficient we scale - * down using the MIN sizes instead. - */ -#define ROOT_NOMINAL_SIZE 256 -#define USR_NOMINAL_SIZE 1536 -#define VAR_NOMINAL_SIZE 128 -#define TMP_NOMINAL_SIZE 128 -#define HOME_NOMINAL_SIZE USR_NOMINAL_SIZE - -/* The bottom-most row we're allowed to scribble on */ -#define CHUNK_ROW_MAX 16 - - -/* All the chunks currently displayed on the screen */ -static struct { - struct chunk *c; - PartType type; -} label_chunk_info[MAX_CHUNKS + 1]; -static int here; - -/*** with this value we try to track the most recently added label ***/ -static int label_focus = 0, pslice_focus = 0; - -static int diskLabel(Device *dev); -static int diskLabelNonInteractive(Device *dev); -static char *try_auto_label(Device *dev, int perc, int *req); - -static int -labelHook(dialogMenuItem *selected) -{ - Device **devs = NULL; - - devs = deviceFind(selected->prompt, DEVICE_TYPE_DISK); - if (!devs) { - msgConfirm("Unable to find disk %s!", selected->prompt); - return DITEM_FAILURE; - } - diskLabel(devs[0]); - return DITEM_SUCCESS; -} - -int -diskLabelEditor(dialogMenuItem *self) -{ - DMenu *menu; - Device **devs; - int result; - - devs = deviceFind(variable_get(VAR_DISK), DEVICE_TYPE_DISK); - if (devs == NULL) { - msgConfirm("No disks found! Please verify that your disk controller is being\n" - "properly probed at boot time. See the Hardware Guide on the\n" - "Documentation menu for clues on diagnosing this type of problem."); - return DITEM_FAILURE; - } - else { - /* No disks are selected, fall-back case now */ - int cnt = deviceCount(devs); - if (cnt == 1) { - if (variable_get(VAR_NONINTERACTIVE) && - !variable_get(VAR_DISKINTERACTIVE)) - result = diskLabelNonInteractive(devs[0]); - else - result = diskLabel(devs[0]); - } - else { - menu = deviceCreateMenu(&MenuDiskDevices, DEVICE_TYPE_DISK, labelHook); - if (!menu) { - msgConfirm("No devices suitable for installation found!\n\n" - "Please verify that your disk controller (and attached drives)\n" - "were detected properly. This can be done by pressing the\n" - "[Scroll Lock] key and using the Arrow keys to move back to\n" - "the boot messages. Press [Scroll Lock] again to return."); - result = DITEM_FAILURE; - } - else { - result = dmenuOpen(menu) ? DITEM_SUCCESS : DITEM_FAILURE; - free(menu); - } - } - } - if (DITEM_STATUS(result) != DITEM_FAILURE) { - if (variable_cmp(DISK_LABELLED, "written")) - variable_set2(DISK_LABELLED, "yes", 0); - } - return result; -} - -int -diskLabelCommit(Device *dev) -{ - char *cp; - int i; - - /* Already done? */ - if ((cp = variable_get(DISK_LABELLED)) && strcmp(cp, "yes")) - i = DITEM_SUCCESS; - else if (!cp) { - msgConfirm("You must assign disk labels before this option can be used."); - i = DITEM_FAILURE; - } - /* The routine will guard against redundant writes, just as this one does */ - else if (DITEM_STATUS(diskPartitionWrite(dev)) != DITEM_SUCCESS) - i = DITEM_FAILURE; - else if (DITEM_STATUS(installFilesystems(dev)) != DITEM_SUCCESS) - i = DITEM_FAILURE; - else { - msgInfo("All filesystem information written successfully."); - variable_set2(DISK_LABELLED, "written", 0); - i = DITEM_SUCCESS; - } - return i; -} - -/* See if we're already using a desired partition name */ -static Boolean -check_conflict(char *name) -{ - int i; - - for (i = 0; label_chunk_info[i].c; i++) - if ((label_chunk_info[i].type == PART_FILESYSTEM || label_chunk_info[i].type == PART_FAT - || label_chunk_info[i].type == PART_EFI) && label_chunk_info[i].c->private_data - && !strcmp(((PartInfo *)label_chunk_info[i].c->private_data)->mountpoint, name)) - return TRUE; - return FALSE; -} - -/* How much space is in this FreeBSD slice? */ -static daddr_t -space_free(struct chunk *c) -{ - struct chunk *c1; - daddr_t sz = c->size; - - for (c1 = c->part; c1; c1 = c1->next) { - if (c1->type != unused) - sz -= c1->size; - } - if (sz < 0) - msgFatal("Partitions are larger than actual chunk??"); - return sz; -} - -/* Snapshot the current situation into the displayed chunks structure */ -static void -record_label_chunks(Device *dev) -{ - int j, p; - struct chunk *c1, *c2; - Disk *d = (Disk *)dev->private; - - j = p = 0; - /* First buzz through and pick up the FreeBSD slices */ - if (!d->chunks) - msgFatal("No chunk list found for %s!", d->name); - -#ifdef __ia64__ - label_chunk_info[j].type = PART_SLICE; - label_chunk_info[j].c = d->chunks; - j++; -#endif - - /* Put the slice entries first */ - for (c1 = d->chunks->part; c1; c1 = c1->next) { - if (c1->type == freebsd) { - label_chunk_info[j].type = PART_SLICE; - label_chunk_info[j].c = c1; - ++j; - } -#ifdef __powerpc__ - if (c1->type == apple) { - label_chunk_info[j].type = PART_SLICE; - label_chunk_info[j].c = c1; - ++j; - } -#endif - } - - /* Then buzz through and pick up the partitions */ - for (c1 = d->chunks->part; c1; c1 = c1->next) { - if (c1->type == freebsd) { - for (c2 = c1->part; c2; c2 = c2->next) { - if (c2->type == part) { - if (c2->subtype == FS_SWAP) - label_chunk_info[j].type = PART_SWAP; - else - label_chunk_info[j].type = PART_FILESYSTEM; - label_chunk_info[j].c = c2; - ++j; - } - } - } - else if (c1->type == fat) { - label_chunk_info[j].type = PART_FAT; - label_chunk_info[j].c = c1; - ++j; - } -#ifdef __ia64__ - else if (c1->type == efi) { - label_chunk_info[j].type = PART_EFI; - label_chunk_info[j].c = c1; - ++j; - } - else if (c1->type == part) { - if (c1->subtype == FS_SWAP) - label_chunk_info[j].type = PART_SWAP; - else - label_chunk_info[j].type = PART_FILESYSTEM; - label_chunk_info[j].c = c1; - ++j; - } -#endif -#ifdef __powerpc__ - else if (c1->type == apple) { - for (c2 = c1->part; c2; c2 = c2->next) { - if (c2->type == part) { - if (c2->subtype == FS_SWAP) - label_chunk_info[j].type = PART_SWAP; - else - label_chunk_info[j].type = PART_FILESYSTEM; - label_chunk_info[j].c = c2; - ++j; - } - } - } -#endif - } - label_chunk_info[j].c = NULL; - if (here >= j) { - here = j ? j - 1 : 0; - } -} - -/* A new partition entry */ -static PartInfo * -new_part(PartType type, char *mpoint, Boolean newfs) -{ - PartInfo *pi; - - if (!mpoint) - mpoint = (type == PART_EFI) ? "/efi" : "/change_me"; - - pi = (PartInfo *)safe_malloc(sizeof(PartInfo)); - sstrncpy(pi->mountpoint, mpoint, FILENAME_MAX); - - pi->do_newfs = newfs; - - if (type == PART_EFI) { - pi->newfs_type = NEWFS_MSDOS; - } else { - pi->newfs_type = NEWFS_UFS; - strcpy(pi->newfs_data.newfs_ufs.user_options, ""); - pi->newfs_data.newfs_ufs.acls = FALSE; - pi->newfs_data.newfs_ufs.multilabel = FALSE; - pi->newfs_data.newfs_ufs.softupdates = strcmp(mpoint, "/"); -#ifdef PC98 - pi->newfs_data.newfs_ufs.ufs1 = TRUE; -#else - pi->newfs_data.newfs_ufs.ufs1 = FALSE; -#endif - } - - return pi; -} - -/* Get the mountpoint for a partition and save it away */ -static PartInfo * -get_mountpoint(PartType type, struct chunk *old) -{ - char *val; - PartInfo *tmp; - Boolean newfs; - - if (old && old->private_data) - tmp = old->private_data; - else - tmp = NULL; - val = (tmp != NULL) ? tmp->mountpoint : (type == PART_EFI) ? "/efi" : NULL; - val = msgGetInput(val, "Please specify a mount point for the partition"); - if (!val || !*val) { - if (!old) - return NULL; - else { - free(old->private_data); - old->private_data = NULL; - } - return NULL; - } - - /* Is it just the same value? */ - if (tmp && !strcmp(tmp->mountpoint, val)) - return NULL; - - /* Did we use it already? */ - if (check_conflict(val)) { - msgConfirm("You already have a mount point for %s assigned!", val); - return NULL; - } - - /* Is it bogus? */ - if (*val != '/') { - msgConfirm("Mount point must start with a / character"); - return NULL; - } - - /* Is it going to be mounted on root? */ - if (!strcmp(val, "/")) { - if (old) - old->flags |= CHUNK_IS_ROOT; - } - else if (old) - old->flags &= ~CHUNK_IS_ROOT; - - newfs = TRUE; - if (tmp) { - newfs = tmp->do_newfs; - safe_free(tmp); - } - val = string_skipwhite(string_prune(val)); - tmp = new_part(type, val, newfs); - if (old) { - old->private_data = tmp; - old->private_free = safe_free; - } - return tmp; -} - -/* Get the type of the new partiton */ -static PartType -get_partition_type(void) -{ - int i; - static char *fs_types[] = { -#ifdef __ia64__ - "EFI", "An EFI system partition", -#endif - "FS", "A file system", - "Swap", "A swap partition.", - }; - WINDOW *w = savescr(); - - dlg_clr_result(); - i = dialog_menu("Please choose a partition type", - "If you want to use this partition for swap space, select Swap.\n" - "If you want to put a filesystem on it, choose FS.", - -1, -1, -#ifdef __ia64__ - 3, 3, -#else - 2, 2, -#endif - fs_types); - restorescr(w); - if (!i) { -#ifdef __ia64__ - if (!strcmp(dialog_vars.input_result, "EFI")) - return PART_EFI; -#endif - if (!strcmp(dialog_vars.input_result, "FS")) - return PART_FILESYSTEM; - else if (!strcmp(dialog_vars.input_result, "Swap")) - return PART_SWAP; - } - return PART_NONE; -} - -/* If the user wants a special newfs command for this, set it */ -static void -getNewfsCmd(PartInfo *p) -{ - char buffer[NEWFS_CMD_ARGS_MAX]; - char *val; - - switch (p->newfs_type) { - case NEWFS_UFS: - snprintf(buffer, NEWFS_CMD_ARGS_MAX, "%s %s %s %s", - NEWFS_UFS_CMD, p->newfs_data.newfs_ufs.softupdates ? "-U" : "", - p->newfs_data.newfs_ufs.ufs1 ? "-O1" : "-O2", - p->newfs_data.newfs_ufs.user_options); - break; - case NEWFS_MSDOS: - snprintf(buffer, NEWFS_CMD_ARGS_MAX, "%s", NEWFS_MSDOS_CMD); - break; - case NEWFS_CUSTOM: - strcpy(buffer, p->newfs_data.newfs_custom.command); - break; - } - - val = msgGetInput(buffer, - "Please enter the newfs command and options you'd like to use in\n" - "creating this file system."); - if (val != NULL) { - p->newfs_type = NEWFS_CUSTOM; - strlcpy(p->newfs_data.newfs_custom.command, val, NEWFS_CMD_ARGS_MAX); - } -} - -static void -getNewfsOptionalArguments(PartInfo *p) -{ - char buffer[NEWFS_CMD_ARGS_MAX]; - char *val; - - /* Must be UFS, per argument checking in I/O routines. */ - - strlcpy(buffer, p->newfs_data.newfs_ufs.user_options, - NEWFS_CMD_ARGS_MAX); - val = msgGetInput(buffer, - "Please enter any additional UFS newfs options you'd like to\n" - "use in creating this file system."); - if (val != NULL) - strlcpy(p->newfs_data.newfs_ufs.user_options, val, - NEWFS_CMD_ARGS_MAX); -} - -#define MAX_MOUNT_NAME 9 - -#define PART_PART_COL 0 -#define PART_MOUNT_COL 10 -#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 3) -#define PART_NEWFS_COL (PART_SIZE_COL + 8) -#define PART_OFF 38 - -#define TOTAL_AVAIL_LINES (10) -#define PSLICE_SHOWABLE (4) - - -/* stick this all up on the screen */ -static void -print_label_chunks(void) -{ - int i, j, srow, prow, pcol; - daddr_t sz; - char clrmsg[80]; - int ChunkPartStartRow; - WINDOW *ChunkWin; - - /*********************************************************/ - /*** These values are for controlling screen resources ***/ - /*** Each label line holds up to 2 labels, so beware! ***/ - /*** strategy will be to try to always make sure the ***/ - /*** highlighted label is in the active display area. ***/ - /*********************************************************/ - int pslice_max, label_max; - int pslice_count, label_count, label_focus_found, pslice_focus_found; - - attrset(A_REVERSE); - mvaddstr(0, 25, "FreeBSD Disklabel Editor"); - attrset(A_NORMAL); - - /*** Count the number of partition slices ***/ - pslice_count = 0; - for (i = 0; label_chunk_info[i].c ; i++) { - if (label_chunk_info[i].type == PART_SLICE) - ++pslice_count; - } - pslice_max = pslice_count; - - /*** 4 line max for partition slices ***/ - if (pslice_max > PSLICE_SHOWABLE) { - pslice_max = PSLICE_SHOWABLE; - } - ChunkPartStartRow = CHUNK_SLICE_START_ROW + 3 + pslice_max; - - /*** View partition slices modulo pslice_max ***/ - label_max = TOTAL_AVAIL_LINES - pslice_max; - - for (i = 0; i < 2; i++) { - mvaddstr(ChunkPartStartRow - 2, PART_PART_COL + (i * PART_OFF), "Part"); - mvaddstr(ChunkPartStartRow - 1, PART_PART_COL + (i * PART_OFF), "----"); - - mvaddstr(ChunkPartStartRow - 2, PART_MOUNT_COL + (i * PART_OFF), "Mount"); - mvaddstr(ChunkPartStartRow - 1, PART_MOUNT_COL + (i * PART_OFF), "-----"); - - mvaddstr(ChunkPartStartRow - 2, PART_SIZE_COL + (i * PART_OFF) + 3, "Size"); - mvaddstr(ChunkPartStartRow - 1, PART_SIZE_COL + (i * PART_OFF) + 3, "----"); - - mvaddstr(ChunkPartStartRow - 2, PART_NEWFS_COL + (i * PART_OFF), "Newfs"); - mvaddstr(ChunkPartStartRow - 1, PART_NEWFS_COL + (i * PART_OFF), "-----"); - } - srow = CHUNK_SLICE_START_ROW; - prow = 0; - pcol = 0; - - /*** these variables indicate that the focused item is shown currently ***/ - label_focus_found = 0; - pslice_focus_found = 0; - - label_count = 0; - pslice_count = 0; - mvprintw(CHUNK_SLICE_START_ROW - 1, 0, " "); - mvprintw(CHUNK_SLICE_START_ROW + pslice_max, 0, " "); - - ChunkWin = newwin(CHUNK_ROW_MAX - ChunkPartStartRow, 76, ChunkPartStartRow, 0); - - wclear(ChunkWin); - /*** wrefresh(ChunkWin); ***/ - - for (i = 0; label_chunk_info[i].c; i++) { - /* Is it a slice entry displayed at the top? */ - if (label_chunk_info[i].type == PART_SLICE) { - /*** This causes the new pslice to replace the previous display ***/ - /*** focus must remain on the most recently active pslice ***/ - if (pslice_count == pslice_max) { - if (pslice_focus_found) { - /*** This is where we can mark the more following ***/ - attrset(A_BOLD); - mvprintw(CHUNK_SLICE_START_ROW + pslice_max, 0, "***MORE***"); - attrset(A_NORMAL); - continue; - } - else { - /*** this is where we set the more previous ***/ - attrset(A_BOLD); - mvprintw(CHUNK_SLICE_START_ROW - 1, 0, "***MORE***"); - attrset(A_NORMAL); - pslice_count = 0; - srow = CHUNK_SLICE_START_ROW; - } - } - - sz = space_free(label_chunk_info[i].c); - if (i == here) - attrset(ATTR_SELECTED); - if (i == pslice_focus) - pslice_focus_found = -1; - - if (label_chunk_info[i].c->type == whole) { - if (sz >= 100 * ONE_GIG) - mvprintw(srow++, 0, - "Disk: %s\t\tFree: %jd blocks (%jdGB)", - label_chunk_info[i].c->disk->name, (intmax_t)sz, - (intmax_t)(sz / ONE_GIG)); - else - mvprintw(srow++, 0, - "Disk: %s\t\tFree: %jd blocks (%jdMB)", - label_chunk_info[i].c->disk->name, (intmax_t)sz, - (intmax_t)(sz / ONE_MEG)); - } else { - if (sz >= 100 * ONE_GIG) - mvprintw(srow++, 0, - "Disk: %s\tPartition name: %s\tFree: %jd blocks (%jdGB)", - label_chunk_info[i].c->disk->name, - label_chunk_info[i].c->name, - (intmax_t)sz, (intmax_t)(sz / ONE_GIG)); - else - mvprintw(srow++, 0, - "Disk: %s\tPartition name: %s\tFree: %jd blocks (%jdMB)", - label_chunk_info[i].c->disk->name, - label_chunk_info[i].c->name, - (intmax_t)sz, (intmax_t)(sz / ONE_MEG)); - } - attrset(A_NORMAL); - clrtoeol(); - move(0, 0); - /*** refresh(); ***/ - ++pslice_count; - } - /* Otherwise it's a DOS, swap or filesystem entry in the Chunk window */ - else { - char onestr[PART_OFF], num[10], *mountpoint, newfs[12]; - - /* - * We copy this into a blank-padded string so that it looks like - * a solid bar in reverse-video - */ - memset(onestr, ' ', PART_OFF - 1); - onestr[PART_OFF - 1] = '\0'; - - /*** Track how many labels have been displayed ***/ - if (label_count == ((label_max - 1 ) * 2)) { - if (label_focus_found) { - continue; - } - else { - label_count = 0; - prow = 0; - pcol = 0; - } - } - - /* Go for two columns if we've written one full columns worth */ - /*** if (prow == (CHUNK_ROW_MAX - ChunkPartStartRow)) ***/ - if (label_count == label_max - 1) { - pcol = PART_OFF; - prow = 0; - } - memcpy(onestr + PART_PART_COL, label_chunk_info[i].c->name, strlen(label_chunk_info[i].c->name)); - /* If it's a filesystem, display the mountpoint */ - if (label_chunk_info[i].c->private_data && (label_chunk_info[i].type == PART_FILESYSTEM - || label_chunk_info[i].type == PART_FAT || label_chunk_info[i].type == PART_EFI)) - mountpoint = ((PartInfo *)label_chunk_info[i].c->private_data)->mountpoint; - else if (label_chunk_info[i].type == PART_SWAP) - mountpoint = "swap"; - else - mountpoint = "<none>"; - - /* Now display the newfs field */ - if (label_chunk_info[i].type == PART_FAT) - strcpy(newfs, "DOS"); -#if defined(__ia64__) - else if (label_chunk_info[i].type == PART_EFI) { - strcpy(newfs, "EFI"); - if (label_chunk_info[i].c->private_data) { - strcat(newfs, " "); - PartInfo *pi = (PartInfo *)label_chunk_info[i].c->private_data; - strcat(newfs, pi->do_newfs ? " Y" : " N"); - } - } -#endif - else if (label_chunk_info[i].c->private_data && label_chunk_info[i].type == PART_FILESYSTEM) { - PartInfo *pi = (PartInfo *)label_chunk_info[i].c->private_data; - - switch (pi->newfs_type) { - case NEWFS_UFS: - strcpy(newfs, NEWFS_UFS_STRING); - if (pi->newfs_data.newfs_ufs.ufs1) - strcat(newfs, "1"); - else - strcat(newfs, "2"); - if (pi->newfs_data.newfs_ufs.softupdates) - strcat(newfs, "+S"); - else - strcat(newfs, " "); - - break; - case NEWFS_MSDOS: - strcpy(newfs, "FAT"); - break; - case NEWFS_CUSTOM: - strcpy(newfs, "CUST"); - break; - } - strcat(newfs, pi->do_newfs ? " Y" : " N "); - } - else if (label_chunk_info[i].type == PART_SWAP) - strcpy(newfs, "SWAP"); - else - strcpy(newfs, "*"); - for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++) - onestr[PART_MOUNT_COL + j] = mountpoint[j]; - if (label_chunk_info[i].c->size == 0) - snprintf(num, 10, "%5dMB", 0); - else if (label_chunk_info[i].c->size < (100 * ONE_GIG)) - snprintf(num, 10, "%5jdMB", - (intmax_t)label_chunk_info[i].c->size / ONE_MEG); - else - snprintf(num, 10, "%5jdGB", - (intmax_t)label_chunk_info[i].c->size / ONE_GIG); - memcpy(onestr + PART_SIZE_COL, num, strlen(num)); - memcpy(onestr + PART_NEWFS_COL, newfs, strlen(newfs)); - onestr[PART_NEWFS_COL + strlen(newfs)] = '\0'; - if (i == label_focus) { - label_focus_found = -1; - wattrset(ChunkWin, A_BOLD); - } - if (i == here) - wattrset(ChunkWin, ATTR_SELECTED); - - /*** lazy man's way of expensively padding this string ***/ - while (strlen(onestr) < 37) - strcat(onestr, " "); - - mvwaddstr(ChunkWin, prow, pcol, onestr); - wattrset(ChunkWin, A_NORMAL); - move(0, 0); - ++prow; - ++label_count; - } - } - - /*** this will erase all the extra stuff ***/ - memset(clrmsg, ' ', 37); - clrmsg[37] = '\0'; - - while (pslice_count < pslice_max) { - mvprintw(srow++, 0, clrmsg); - clrtoeol(); - ++pslice_count; - } - while (label_count < (2 * (label_max - 1))) { - mvwaddstr(ChunkWin, prow++, pcol, clrmsg); - ++label_count; - if (prow == (label_max - 1)) { - prow = 0; - pcol = PART_OFF; - } - } - refresh(); - wrefresh(ChunkWin); -} - -static void -print_command_summary(void) -{ - mvprintw(17, 0, "The following commands are valid here (upper or lower case):"); - mvprintw(18, 0, "C = Create D = Delete M = Mount pt."); - mvprintw(18, 56, "W = Write"); - mvprintw(19, 0, "N = Newfs Opts Q = Finish S = Toggle SoftUpdates Z = Custom Newfs"); - mvprintw(20, 0, "T = Toggle Newfs U = Undo A = Auto Defaults R = Delete+Merge"); - mvprintw(22, 0, "Use F1 or ? to get more help, arrow keys to select."); - move(0, 0); -} - -static void -clear_wins(void) -{ - - clear(); - print_label_chunks(); -} - -static int -diskLabel(Device *dev) -{ - daddr_t sz; - int key = 0; - Boolean labeling; - char *msg = NULL; - PartInfo *p, *oldp; - PartType type; - WINDOW *w = savescr(); - - label_focus = 0; - pslice_focus = 0; - here = 0; - - labeling = TRUE; - keypad(stdscr, TRUE); - record_label_chunks(dev); - - clear(); - while (labeling) { - char *cp; - int rflags = DELCHUNK_NORMAL; - - print_label_chunks(); - print_command_summary(); - if (msg) { - attrset(title_attr); mvprintw(23, 0, msg); attrset(A_NORMAL); - clrtoeol(); - beep(); - msg = NULL; - } - else { - move(23, 0); - clrtoeol(); - } - - refresh(); - key = getch(); - switch (toupper(key)) { - static char _msg[40]; - - case '\014': /* ^L */ - clear_wins(); - break; - - case '\020': /* ^P */ - case KEY_UP: - case '-': - if (here != 0) - --here; - else - while (label_chunk_info[here + 1].c) - ++here; - break; - - case '\016': /* ^N */ - case KEY_DOWN: - case '+': - case '\r': - case '\n': - if (label_chunk_info[here + 1].c) - ++here; - else - here = 0; - break; - - case KEY_HOME: - here = 0; - break; - - case KEY_END: - while (label_chunk_info[here + 1].c) - ++here; - break; - - case KEY_F(1): - case '?': - systemDisplayHelp("partition"); - clear_wins(); - break; - - case '1': - if (label_chunk_info[here].type == PART_FILESYSTEM) { - PartInfo *pi = - ((PartInfo *)label_chunk_info[here].c->private_data); - - if ((pi != NULL) && - (pi->newfs_type == NEWFS_UFS)) { - pi->newfs_data.newfs_ufs.ufs1 = true; - } else - msg = MSG_NOT_APPLICABLE; - } else - msg = MSG_NOT_APPLICABLE; - break; - break; - - case '2': - if (label_chunk_info[here].type == PART_FILESYSTEM) { - PartInfo *pi = - ((PartInfo *)label_chunk_info[here].c->private_data); - - if ((pi != NULL) && - (pi->newfs_type == NEWFS_UFS)) { - pi->newfs_data.newfs_ufs.ufs1 = false; - } else - msg = MSG_NOT_APPLICABLE; - } else - msg = MSG_NOT_APPLICABLE; - break; - break; - - case 'A': - if (label_chunk_info[here].type != PART_SLICE) { - msg = "You can only do this in a disk slice (at top of screen)"; - break; - } - /* - * Generate standard partitions automatically. If we do not - * have sufficient space we attempt to scale-down the size - * of the partitions within certain bounds. - */ - { - int perc; - int req = 0; - - for (perc = 100; perc > 0; perc -= 5) { - req = 0; /* reset for each loop */ - if ((msg = try_auto_label(dev, perc, &req)) == NULL) - break; - } - if (msg) { - if (req) { - msgConfirm("%s", msg); - clear_wins(); - msg = NULL; - } - } - } - break; - - case 'C': - if (label_chunk_info[here].type != PART_SLICE) { - msg = "You can only do this in a master partition (see top of screen)"; - break; - } - sz = space_free(label_chunk_info[here].c); - if (sz <= FS_MIN_SIZE) { - msg = "Not enough space to create an additional FreeBSD partition"; - break; - } - else { - char *val; - daddr_t size; - struct chunk *tmp; - char osize[80]; - u_long flags = 0; - -#ifdef __powerpc__ - /* Always use the maximum size for apple partitions */ - if (label_chunk_info[here].c->type == apple) - size = sz; - else { -#endif - sprintf(osize, "%jd", (intmax_t)sz); - val = msgGetInput(osize, - "Please specify the partition size in blocks or append a trailing G for\n" -#ifdef __ia64__ - "gigabytes, M for megabytes.\n" -#else - "gigabytes, M for megabytes, or C for cylinders.\n" -#endif - "%jd blocks (%jdMB) are free.", - (intmax_t)sz, (intmax_t)sz / ONE_MEG); - if (!val || (size = strtoimax(val, &cp, 0)) <= 0) { - clear_wins(); - break; - } - - if (*cp) { - if (toupper(*cp) == 'M') - size *= ONE_MEG; - else if (toupper(*cp) == 'G') - size *= ONE_GIG; -#ifndef __ia64__ - else if (toupper(*cp) == 'C') - size *= (label_chunk_info[here].c->disk->bios_hd * label_chunk_info[here].c->disk->bios_sect); -#endif - } - if (size <= FS_MIN_SIZE) { - msgConfirm("The minimum filesystem size is %dMB", FS_MIN_SIZE / ONE_MEG); - clear_wins(); - break; - } -#ifdef __powerpc__ - } -#endif - type = get_partition_type(); - if (type == PART_NONE) { - clear_wins(); - beep(); - break; - } - - if (type == PART_FILESYSTEM || type == PART_EFI) { - if ((p = get_mountpoint(type, NULL)) == NULL) { - clear_wins(); - beep(); - break; - } - else if (!strcmp(p->mountpoint, "/")) { - if (type != PART_FILESYSTEM) { - clear_wins(); - beep(); - break; - } - else - flags |= CHUNK_IS_ROOT; - } - else - flags &= ~CHUNK_IS_ROOT; - } - else - p = NULL; - - if ((flags & CHUNK_IS_ROOT) && (size < (ROOT_MIN_SIZE * ONE_MEG))) { - msgConfirm("Warning: This is smaller than the recommended size for a\n" - "root partition. For a variety of reasons, root\n" - "partitions should usually be at least %dMB in size", ROOT_MIN_SIZE); - } - tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk, - label_chunk_info[here].c, size, -#ifdef __ia64__ - (type == PART_EFI) ? efi : part, - (type == PART_EFI) ? 0 : (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, -#else - part, (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, -#endif - flags); - if (!tmp) { - msgConfirm("Unable to create the partition. Too big?"); - clear_wins(); - break; - } - -#ifdef __alpha__ - /* - * SRM requires that the root partition is at the - * beginning of the disk and cannot boot otherwise. - * Warn Alpha users if they are about to shoot themselves in - * the foot in this way. - * - * Since partitions may not start precisely at offset 0 we - * check for a "close to 0" instead. :-( - */ - if ((flags & CHUNK_IS_ROOT) && (tmp->offset > 1024)) { - msgConfirm("Your root partition `a' does not seem to be the first\n" - "partition. The Alpha's firmware can only boot from the\n" - "first partition. So it is unlikely that your current\n" - "disk layout will be bootable boot after installation.\n" - "\n" - "Please allocate the root partition before allocating\n" - "any others.\n"); - } -#endif /* alpha */ - - tmp->private_data = p; - tmp->private_free = safe_free; - if (variable_cmp(DISK_LABELLED, "written")) - variable_set2(DISK_LABELLED, "yes", 0); - record_label_chunks(dev); - clear_wins(); - /* This is where we assign focus to new label so it shows. */ - { - int i; - label_focus = -1; - for (i = 0; label_chunk_info[i].c; ++i) { - if (label_chunk_info[i].c == tmp) { - label_focus = i; - break; - } - } - if (label_focus == -1) - label_focus = i - 1; - } - } - break; - - case KEY_DC: - case 'R': /* recover space (delete w/ recover) */ - /* - * Delete the partition w/ space recovery. - */ - rflags = DELCHUNK_RECOVER; - /* fall through */ - case 'D': /* delete */ - if (label_chunk_info[here].type == PART_SLICE) { - msg = MSG_NOT_APPLICABLE; - break; - } - else if (label_chunk_info[here].type == PART_FAT) { - msg = "Use the Disk Partition Editor to delete DOS partitions"; - break; - } - Delete_Chunk2(label_chunk_info[here].c->disk, label_chunk_info[here].c, rflags); - if (variable_cmp(DISK_LABELLED, "written")) - variable_set2(DISK_LABELLED, "yes", 0); - record_label_chunks(dev); - break; - - case 'M': /* mount */ - switch(label_chunk_info[here].type) { - case PART_SLICE: - msg = MSG_NOT_APPLICABLE; - break; - - case PART_SWAP: - msg = "You don't need to specify a mountpoint for a swap partition."; - break; - - case PART_FAT: - case PART_EFI: - case PART_FILESYSTEM: - oldp = label_chunk_info[here].c->private_data; - p = get_mountpoint(label_chunk_info[here].type, label_chunk_info[here].c); - if (p) { - if (!oldp) - p->do_newfs = FALSE; - if ((label_chunk_info[here].type == PART_FAT || - label_chunk_info[here].type == PART_EFI) && - (!strcmp(p->mountpoint, "/") || - !strcmp(p->mountpoint, "/usr") || - !strcmp(p->mountpoint, "/var"))) { - msgConfirm("%s is an invalid mount point for a DOS partition!", p->mountpoint); - strcpy(p->mountpoint, "/bogus"); - } - } - if (variable_cmp(DISK_LABELLED, "written")) - variable_set2(DISK_LABELLED, "yes", 0); - record_label_chunks(dev); - clear_wins(); - break; - - default: - msgFatal("Bogus partition under cursor???"); - break; - } - break; - - case 'N': /* Set newfs options */ - if (label_chunk_info[here].c->private_data && - ((PartInfo *)label_chunk_info[here].c->private_data)->do_newfs) - getNewfsOptionalArguments( - label_chunk_info[here].c->private_data); - else - msg = MSG_NOT_APPLICABLE; - clear_wins(); - break; - - case 'S': /* Toggle soft updates flag */ - if (label_chunk_info[here].type == PART_FILESYSTEM) { - PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private_data); - if (pi != NULL && - pi->newfs_type == NEWFS_UFS) - pi->newfs_data.newfs_ufs.softupdates = - !pi->newfs_data.newfs_ufs.softupdates; - else - msg = MSG_NOT_APPLICABLE; - } - else - msg = MSG_NOT_APPLICABLE; - break; - - case 'T': /* Toggle newfs state */ - if ((label_chunk_info[here].type == PART_FILESYSTEM || - label_chunk_info[here].type == PART_EFI) && - (label_chunk_info[here].c->private_data)) { - PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private_data); - if (!pi->do_newfs) - label_chunk_info[here].c->flags |= CHUNK_NEWFS; - else - label_chunk_info[here].c->flags &= ~CHUNK_NEWFS; - - label_chunk_info[here].c->private_data = - new_part(label_chunk_info[here].type, pi ? pi->mountpoint : NULL, pi ? !pi->do_newfs - : TRUE); - if (pi != NULL && - pi->newfs_type == NEWFS_UFS) { - PartInfo *pi_new = label_chunk_info[here].c->private_data; - - pi_new->newfs_data.newfs_ufs = pi->newfs_data.newfs_ufs; - } - safe_free(pi); - label_chunk_info[here].c->private_free = safe_free; - if (variable_cmp(DISK_LABELLED, "written")) - variable_set2(DISK_LABELLED, "yes", 0); - } - else - msg = MSG_NOT_APPLICABLE; - break; - - case 'U': - clear(); - if (!variable_cmp(DISK_LABELLED, "written")) { - msgConfirm("You've already written out your changes -\n" - "it's too late to undo!"); - } - else if (!msgNoYes("Are you SURE you want to Undo everything?")) { - Disk *d; - - variable_unset(DISK_PARTITIONED); - variable_unset(DISK_LABELLED); - if ((d = Open_Disk(dev->name)) != NULL) { - Free_Disk(dev->private); - dev->private = d; -#ifdef WITH_SLICES - diskPartition(dev); -#endif - } - record_label_chunks(dev); - } - clear_wins(); - break; - - case 'W': - if (!variable_cmp(DISK_LABELLED, "written")) { - msgConfirm("You've already written out your changes - if you\n" - "wish to overwrite them, you'll have to restart\n" - "%s first.", ProgName); - } - else if (!msgNoYes("WARNING: You are about to modify an EXISTING\n" - "installation.\n\n" - "Are you absolutely sure you want to continue?")) { - variable_set2(DISK_LABELLED, "yes", 0); - diskLabelCommit(dev); - } - clear_wins(); - break; - - case 'Z': /* Set newfs command line */ - if (label_chunk_info[here].c->private_data && - ((PartInfo *)label_chunk_info[here].c->private_data)->do_newfs) - getNewfsCmd(label_chunk_info[here].c->private_data); - else - msg = MSG_NOT_APPLICABLE; - clear_wins(); - break; - -#ifndef __ia64__ - case '|': - if (!msgNoYes("Are you sure you want to go into Wizard mode?\n\n" - "This is an entirely undocumented feature which you are not\n" - "expected to understand!")) { - dlg_clear(); - end_dialog(); - DialogActive = FALSE; - if (dev->private) { - slice_wizard(((Disk *)dev->private)); - } - if (variable_cmp(DISK_LABELLED, "written")) - variable_set2(DISK_LABELLED, "yes", 0); - DialogActive = TRUE; - record_label_chunks(dev); - clear_wins(); - } - else - msg = "A most prudent choice!"; - break; -#endif - - case '\033': /* ESC */ - case 'Q': - labeling = FALSE; - break; - - default: - beep(); - sprintf(_msg, "Invalid key %d - Type F1 or ? for help", key); - msg = _msg; - break; - } - if (label_chunk_info[here].type == PART_SLICE) - pslice_focus = here; - else - label_focus = here; - } - restorescr(w); - return DITEM_SUCCESS; -} - -static __inline daddr_t -requested_part_size(char *varName, daddr_t nom, int def, int perc) -{ - char *cp; - daddr_t sz; - - if ((cp = variable_get(varName)) != NULL) - sz = strtoimax(cp, NULL, 0); - else - sz = nom + (def - nom) * perc / 100; - return(sz * ONE_MEG); -} - -/* - * Attempt to auto-label the disk. 'perc' (0-100) scales - * the size of the various partitions within appropriate - * bounds (NOMINAL through DEFAULT sizes). The procedure - * succeeds of NULL is returned. A non-null return message - * is either a failure-status message (*req == 0), or - * a confirmation requestor (*req == 1). *req is 0 on - * entry to this call. - * - * As a special exception to the usual sizing rules, /var is given - * additional space equal to the amount of physical memory present - * if perc == 100 in order to ensure that users with large hard drives - * will have enough space to store a crashdump in /var/crash. - * - * We autolabel the following partitions: /, swap, /var, /tmp, /usr, - * and /home. /home receives any extra left over disk space. - */ -static char * -try_auto_label(Device *dev, int perc, int *req) -{ - daddr_t sz; - Chunk *AutoHome, *AutoRoot, *AutoSwap; - Chunk *AutoTmp, *AutoUsr, *AutoVar; -#ifdef __ia64__ - Chunk *AutoEfi; -#endif - int mib[2]; - unsigned long physmem; - size_t size; - char *msg = NULL; - - sz = space_free(label_chunk_info[here].c); - if (sz <= FS_MIN_SIZE) - return("Not enough free space to create a new partition in the slice"); - - (void)checkLabels(FALSE); - AutoHome = AutoRoot = AutoSwap = NULL; - AutoTmp = AutoUsr = AutoVar = NULL; - -#ifdef __ia64__ - AutoEfi = NULL; - if (EfiChunk == NULL) { - sz = 100 * ONE_MEG; - AutoEfi = Create_Chunk_DWIM(label_chunk_info[here].c->disk, - label_chunk_info[here].c, sz, efi, 0, 0); - if (AutoEfi == NULL) { - *req = 1; - msg = "Unable to create the EFI system partition. Too big?"; - goto done; - } - AutoEfi->private_data = new_part(PART_EFI, "/efi", TRUE); - AutoEfi->private_free = safe_free; - AutoEfi->flags |= CHUNK_NEWFS; - record_label_chunks(dev); - } -#endif - - if (RootChunk == NULL) { - sz = requested_part_size(VAR_ROOT_SIZE, ROOT_NOMINAL_SIZE, ROOT_DEFAULT_SIZE, perc); - - AutoRoot = Create_Chunk_DWIM(label_chunk_info[here].c->disk, - label_chunk_info[here].c, sz, part, - FS_BSDFFS, CHUNK_IS_ROOT | CHUNK_AUTO_SIZE); - if (!AutoRoot) { - *req = 1; - msg = "Unable to create the root partition. Too big?"; - goto done; - } - AutoRoot->private_data = new_part(PART_FILESYSTEM, "/", TRUE); - AutoRoot->private_free = safe_free; - AutoRoot->flags |= CHUNK_NEWFS; - record_label_chunks(dev); - } - if (SwapChunk == NULL) { - sz = requested_part_size(VAR_SWAP_SIZE, 0, 0, perc); - if (sz == 0) { - daddr_t nom; - daddr_t def; - - mib[0] = CTL_HW; - mib[1] = HW_PHYSMEM; - size = sizeof physmem; - sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0); - def = 2 * (int)(physmem / 512); - if (def < SWAP_MIN_SIZE * ONE_MEG) - def = SWAP_MIN_SIZE * ONE_MEG; - if (def > SWAP_AUTO_LIMIT_SIZE * ONE_MEG) - def = SWAP_AUTO_LIMIT_SIZE * ONE_MEG; - nom = (int)(physmem / 512) / 8; - sz = nom + (def - nom) * perc / 100; - } - AutoSwap = Create_Chunk_DWIM(label_chunk_info[here].c->disk, - label_chunk_info[here].c, sz, part, - FS_SWAP, CHUNK_AUTO_SIZE); - if (!AutoSwap) { - *req = 1; - msg = "Unable to create the swap partition. Too big?"; - goto done; - } - AutoSwap->private_data = 0; - AutoSwap->private_free = safe_free; - record_label_chunks(dev); - } - if (VarChunk == NULL) { - /* Work out how much extra space we want for a crash dump */ - unsigned long crashdumpsz; - - mib[0] = CTL_HW; - mib[1] = HW_PHYSMEM; - size = sizeof(physmem); - sysctl(mib, 2, &physmem, &size, (void *)0, (size_t)0); - - if (perc == 100) - crashdumpsz = physmem / 1048576; - else - crashdumpsz = 0; - - sz = requested_part_size(VAR_VAR_SIZE, VAR_NOMINAL_SIZE, \ - VAR_DEFAULT_SIZE + crashdumpsz, perc); - - AutoVar = Create_Chunk_DWIM(label_chunk_info[here].c->disk, - label_chunk_info[here].c, sz, part, - FS_BSDFFS, CHUNK_AUTO_SIZE); - if (!AutoVar) { - *req = 1; - msg = "Not enough free space for /var - you will need to\n" - "partition your disk manually with a custom install!"; - goto done; - } - AutoVar->private_data = new_part(PART_FILESYSTEM, "/var", TRUE); - AutoVar->private_free = safe_free; - AutoVar->flags |= CHUNK_NEWFS; - record_label_chunks(dev); - } - if (TmpChunk == NULL && !variable_get(VAR_NO_TMP)) { - sz = requested_part_size(VAR_TMP_SIZE, TMP_NOMINAL_SIZE, TMP_DEFAULT_SIZE, perc); - - AutoTmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk, - label_chunk_info[here].c, sz, part, - FS_BSDFFS, CHUNK_AUTO_SIZE); - if (!AutoTmp) { - *req = 1; - msg = "Not enough free space for /tmp - you will need to\n" - "partition your disk manually with a custom install!"; - goto done; - } - AutoTmp->private_data = new_part(PART_FILESYSTEM, "/tmp", TRUE); - AutoTmp->private_free = safe_free; - AutoTmp->flags |= CHUNK_NEWFS; - record_label_chunks(dev); - } - if (UsrChunk == NULL && !variable_get(VAR_NO_USR)) { - sz = requested_part_size(VAR_USR_SIZE, USR_NOMINAL_SIZE, USR_DEFAULT_SIZE, perc); -#if AUTO_HOME == 0 - if (sz < space_free(label_chunk_info[here].c)) - sz = space_free(label_chunk_info[here].c); -#endif - if (sz) { - if (sz < (USR_MIN_SIZE * ONE_MEG)) { - *req = 1; - msg = "Not enough free space for /usr - you will need to\n" - "partition your disk manually with a custom install!"; - } - - AutoUsr = Create_Chunk_DWIM(label_chunk_info[here].c->disk, - label_chunk_info[here].c, sz, part, - FS_BSDFFS, CHUNK_AUTO_SIZE); - if (!AutoUsr) { - msg = "Unable to create the /usr partition. Not enough space?\n" - "You will need to partition your disk manually with a custom install!"; - goto done; - } - AutoUsr->private_data = new_part(PART_FILESYSTEM, "/usr", TRUE); - AutoUsr->private_free = safe_free; - AutoUsr->flags |= CHUNK_NEWFS; - record_label_chunks(dev); - } - } -#if AUTO_HOME == 1 - if (HomeChunk == NULL && !variable_get(VAR_NO_HOME)) { - sz = requested_part_size(VAR_HOME_SIZE, HOME_NOMINAL_SIZE, HOME_DEFAULT_SIZE, perc); - if (sz < space_free(label_chunk_info[here].c)) - sz = space_free(label_chunk_info[here].c); - if (sz) { - if (sz < (HOME_MIN_SIZE * ONE_MEG)) { - *req = 1; - msg = "Not enough free space for /home - you will need to\n" - "partition your disk manually with a custom install!"; - goto done; - } - - AutoHome = Create_Chunk_DWIM(label_chunk_info[here].c->disk, - label_chunk_info[here].c, sz, part, - FS_BSDFFS, CHUNK_AUTO_SIZE); - if (!AutoHome) { - msg = "Unable to create the /home partition. Not enough space?\n" - "You will need to partition your disk manually with a custom install!"; - goto done; - } - AutoHome->private_data = new_part(PART_FILESYSTEM, "/home", TRUE); - AutoHome->private_free = safe_free; - AutoHome->flags |= CHUNK_NEWFS; - record_label_chunks(dev); - } - } -#endif - - /* At this point, we're reasonably "labelled" */ - if (variable_cmp(DISK_LABELLED, "written")) - variable_set2(DISK_LABELLED, "yes", 0); - -done: - if (msg) { - if (AutoRoot != NULL) - Delete_Chunk(AutoRoot->disk, AutoRoot); - if (AutoSwap != NULL) - Delete_Chunk(AutoSwap->disk, AutoSwap); - if (AutoVar != NULL) - Delete_Chunk(AutoVar->disk, AutoVar); - if (AutoTmp != NULL) - Delete_Chunk(AutoTmp->disk, AutoTmp); - if (AutoUsr != NULL) - Delete_Chunk(AutoUsr->disk, AutoUsr); - if (AutoHome != NULL) - Delete_Chunk(AutoHome->disk, AutoHome); - record_label_chunks(dev); - } - return(msg); -} - -static int -diskLabelNonInteractive(Device *dev) -{ - char *cp; - PartType type; - PartInfo *p; - u_long flags; - int i, status; - Device **devs; - Disk *d; - - status = DITEM_SUCCESS; - cp = variable_get(VAR_DISK); - if (!cp) { - msgConfirm("diskLabel: No disk selected - can't label automatically."); - return DITEM_FAILURE; - } - devs = deviceFind(cp, DEVICE_TYPE_DISK); - if (!devs) { - msgConfirm("diskLabel: No disk device %s found!", cp); - return DITEM_FAILURE; - } - if (dev) - d = dev->private; - else - d = devs[0]->private; - record_label_chunks(dev); - for (i = 0; label_chunk_info[i].c; i++) { - Chunk *c1 = label_chunk_info[i].c; - - if (label_chunk_info[i].type == PART_SLICE) { - char name[512]; - char typ[10], mpoint[50]; - int entries; - - for (entries = 1;; entries++) { - intmax_t sz; - int soft = 0; - snprintf(name, sizeof name, "%s-%d", c1->name, entries); - if ((cp = variable_get(name)) == NULL) - break; - if (sscanf(cp, "%s %jd %s %d", typ, &sz, mpoint, &soft) < 3) { - msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp); - status = DITEM_FAILURE; - break; - } else { - Chunk *tmp; - - flags = 0; - if (!strcmp(typ, "swap")) { - type = PART_SWAP; - strcpy(mpoint, "SWAP"); - } else { - type = PART_FILESYSTEM; - if (!strcmp(mpoint, "/")) - flags |= CHUNK_IS_ROOT; - } - if (!sz) - sz = space_free(c1); - if (sz > space_free(c1)) { - msgConfirm("Not enough free space to create partition: %s", mpoint); - status = DITEM_FAILURE; - break; - } - if (!(tmp = Create_Chunk_DWIM(d, c1, sz, part, - (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS, flags))) { - msgConfirm("Unable to create from partition spec: %s. Too big?", cp); - status = DITEM_FAILURE; - break; - } else { - PartInfo *pi; - pi = tmp->private_data = new_part(PART_FILESYSTEM, mpoint, TRUE); - tmp->private_free = safe_free; - pi->newfs_data.newfs_ufs.softupdates = soft; - } - } - } - } else { - /* Must be something we can set a mountpoint for */ - cp = variable_get(c1->name); - if (cp) { - char mpoint[50], do_newfs[8]; - Boolean newfs = FALSE; - - do_newfs[0] = '\0'; - if (sscanf(cp, "%s %s", mpoint, do_newfs) != 2) { - msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp); - status = DITEM_FAILURE; - break; - } - newfs = toupper(do_newfs[0]) == 'Y' ? TRUE : FALSE; - if (c1->private_data) { - p = c1->private_data; - p->do_newfs = newfs; - strcpy(p->mountpoint, mpoint); - } - else { - c1->private_data = new_part(PART_FILESYSTEM, mpoint, newfs); - c1->private_free = safe_free; - } - if (!strcmp(mpoint, "/")) - c1->flags |= CHUNK_IS_ROOT; - else - c1->flags &= ~CHUNK_IS_ROOT; - } - } - } - if (status == DITEM_SUCCESS) - variable_set2(DISK_LABELLED, "yes", 0); - return status; -} diff --git a/usr.sbin/sade/list.h b/usr.sbin/sade/list.h deleted file mode 100644 index 8c5cf2a..0000000 --- a/usr.sbin/sade/list.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1997 FreeBSD, Inc. - * All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY PAUL TRAINA ``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 PAUL TRAINA OR HIS KILLER RATS 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, LIFE 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. - * - */ - -/* The structure */ -typedef struct _qelement { - struct _qelement *q_forw; - struct _qelement *q_back; -} qelement; - -#define INITQUE(Xhead) { \ - (Xhead).q_forw = &(Xhead); \ - (Xhead).q_back = &(Xhead); \ -} - -#define EMPTYQUE(Xhead) \ - ((Xhead).q_forw == &(Xhead)) - -#define INSQUEUE(elem, pred) { \ - register qelement *Xe = (qelement *) (elem); \ - register qelement *Xp = (qelement *) (pred); \ - Xp->q_forw = (Xe->q_forw = (Xe->q_back = Xp)->q_forw)->q_back = Xe; \ -} - -#define REMQUE(elem) { \ - register qelement *Xe = (qelement *) (elem); \ - (Xe->q_back->q_forw = Xe->q_forw)->q_back = Xe->q_back; \ -} diff --git a/usr.sbin/sade/main.c b/usr.sbin/sade/main.c deleted file mode 100644 index cb493f3..0000000 --- a/usr.sbin/sade/main.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include "sade.h" -#include <sys/signal.h> -#include <sys/fcntl.h> - -const char *StartName; /* Initial contents of argv[0] */ -const char *ProgName = "sade"; - -int -main(int argc, char **argv) -{ - int status; - - /* Record name to be able to restart */ - StartName = argv[0]; - - signal(SIGPIPE, SIG_IGN); - - /* We don't work too well when running as non-root anymore */ - if (geteuid() != 0) { - fprintf(stderr, "Error: This utility should only be run as root.\n"); - return 1; - } - -#ifdef PC98 - { - /* XXX */ - char *p = getenv("TERM"); - if (p && strcmp(p, "cons25") == 0) - setenv("TERM", "cons25w", 1); - } -#endif - - /* Set up whatever things need setting up */ - systemInitialize(argc, argv); - - /* Set default flag and variable values */ - installVarDefaults(NULL); - - if (argc > 1 && !strcmp(argv[1], "-fake")) { - variable_set2(VAR_DEBUG, "YES", 0); - Fake = TRUE; - msgConfirm("I'll be just faking it from here on out, OK?"); - } - if (argc > 1 && !strcmp(argv[1], "-restart")) - Restarting = TRUE; - - /* Try to preserve our scroll-back buffer */ - if (OnVTY) { - int i; - - for (i = 0; i < 25; i++) - putchar('\n'); - } - /* Move stderr aside */ - if (DebugFD) - dup2(DebugFD, 2); - - /* Initialize driver modules, if we haven't already done so (ie, - the user hit Ctrl-C -> Restart. */ - if (!pvariable_get("modulesInitialize")) { - pvariable_set("modulesInitialize=1"); - } - - /* Probe for all relevant devices on the system */ - deviceGetAll(); - - /* First, see if we have any arguments to process (and argv[0] counts if it's not "sysinstall") */ - - status = setjmp(BailOut); - if (status) { - msgConfirm("A signal %d was caught - I'm saving what I can and shutting\n" - "down. If you can reproduce the problem, please turn Debug on\n" - "in the Options menu for the extra information it provides\n" - "in debugging problems like this.", status); - ; - } - - /* Begin user dialog at outer menu */ - dlg_clear(); - while (1) { - dmenuOpen(&MenuMain); - if (getpid() != 1 - || !msgNoYes("Are you sure you wish to exit?") - ) - break; - } - - /* Shut down curses */ - endwin(); - - return 0; -} diff --git a/usr.sbin/sade/menus.c b/usr.sbin/sade/menus.c deleted file mode 100644 index 886f80c..0000000 --- a/usr.sbin/sade/menus.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#ifndef lint -static const char rcsid[] = - "$FreeBSD$"; -#endif - -#include "sade.h" - -/* All the system menus go here. - * - * Hardcoded things like version number strings will disappear from - * these menus just as soon as I add the code for doing inline variable - * expansion. - */ - -DMenu MenuDiskDevices = { - DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, - "Select Drive(s)", - "Please select the drive on which you wish to perform this\n" - "operation. If you are attempting to install a boot partition\n" - "on a drive other than the first one or have multiple operating\n" - "systems on your machine, you will have the option to install a boot\n" - "manager later. To select a drive, use the arrow keys to move to it\n" - "and press [SPACE] or [ENTER].\n\n" - "Use [TAB] to get to the buttons and leave this menu.", - "Press F1 for important information regarding disk geometry!", - "drives", - { { NULL, NULL, NULL } }, -}; - -DMenu MenuMain = { - DMENU_NORMAL_TYPE, - "Disklabel and partitioning utility", - "This is a utility for partitioning and/or labelling your disks.", - "DISKUTIL", - "main", - { -#ifdef WITH_SLICES - { "1 Partition", "Managing disk partitions", diskPartitionEditor }, -#endif - { "2 Label", "Label allocated disk partitions", diskLabelEditor }, - { NULL, NULL, NULL } - }, -}; - -#if defined(__i386__) || defined(__amd64__) -#ifdef PC98 -/* IPL type menu */ -DMenu MenuIPLType = { - DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, - "overwrite me", /* will be disk specific label */ - "If you want a FreeBSD Boot Manager, select \"BootMgr\". If you would\n" - "prefer your Boot Manager to remain untouched then select \"None\".\n\n", - "Press F1 to read about drive setup", - "drives", - { { "BootMgr", "Install the FreeBSD Boot Manager", NULL }, - { "None", "Leave the IPL untouched", NULL }, - { NULL, NULL, NULL } }, -}; -#else -/* MBR type menu */ -DMenu MenuMBRType = { - DMENU_RADIO_TYPE | DMENU_SELECTION_RETURNS, - "overwrite me", /* will be disk specific label */ - "FreeBSD comes with a boot manager that allows you to easily\n" - "select between FreeBSD and any other operating systems on your machine\n" - "at boot time. If you have more than one drive and want to boot\n" - "from the second one, the boot manager will also make it possible\n" - "to do so (limitations in the PC BIOS usually prevent this otherwise).\n" - "If you have other operating systems installed and would like a choice when\n" - "booting, choose \"BootMgr\". If you would prefer to keep your existing\n" - "boot manager, select \"None\".\n", - "", - "drives", - { { "Standard", "Install a standard MBR (non-interactive boot manager)", NULL }, - { "BootMgr", "Install the FreeBSD boot manager", NULL }, - { "None", "Do not install a boot manager", NULL }, - { NULL, NULL, NULL } } -}; -#endif /* PC98 */ -#endif /* __i386__ */ diff --git a/usr.sbin/sade/misc.c b/usr.sbin/sade/misc.c deleted file mode 100644 index 3279e63..0000000 --- a/usr.sbin/sade/misc.c +++ /dev/null @@ -1,426 +0,0 @@ -/* - * Miscellaneous support routines.. - * - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include <ctype.h> -#include <unistd.h> -#include <sys/stat.h> -#include <sys/errno.h> -#include <sys/file.h> -#include <sys/types.h> -#include <dirent.h> -#include <sys/wait.h> -#include <sys/param.h> -#include <sys/mount.h> -#include <ufs/ufs/ufsmount.h> -#include <sys/reboot.h> -#include <sys/disklabel.h> -#include <fs/msdosfs/msdosfsmount.h> - -#include "sade.h" - -/* Quick check to see if a file is readable */ -Boolean -file_readable(char *fname) -{ - if (!access(fname, F_OK)) - return TRUE; - return FALSE; -} - -/* sane strncpy() function */ -char * -sstrncpy(char *dst, const char *src, int size) -{ - dst[size] = '\0'; - return strncpy(dst, src, size); -} - -/* Clip the whitespace off the end of a string */ -char * -string_prune(char *str) -{ - int len = str ? strlen(str) : 0; - - while (len && isspace(str[len - 1])) - str[--len] = '\0'; - return str; -} - -/* run the whitespace off the front of a string */ -char * -string_skipwhite(char *str) -{ - while (*str && isspace(*str)) - ++str; - return str; -} - -Boolean -directory_exists(const char *dirname) -{ - DIR *tptr; - - if (!dirname) - return FALSE; - if (!strlen(dirname)) - return FALSE; - - tptr = opendir(dirname); - if (!tptr) - return (FALSE); - - closedir(tptr); - return (TRUE); -} - -/* A free guaranteed to take NULL ptrs */ -void -safe_free(void *ptr) -{ - if (ptr) - free(ptr); -} - -/* A malloc that checks errors */ -void * -safe_malloc(size_t size) -{ - void *ptr; - - if (size <= 0) - msgFatal("Invalid malloc size of %ld!", (long)size); - ptr = malloc(size); - if (!ptr) - msgFatal("Out of memory!"); - bzero(ptr, size); - return ptr; -} - -int -Mkdir(char *ipath) -{ - struct stat sb; - int final; - char *p, *path; - - if (file_readable(ipath) || Fake) - return DITEM_SUCCESS; - - path = strcpy(alloca(strlen(ipath) + 1), ipath); - if (isDebug()) - msgDebug("mkdir(%s)\n", path); - p = path; - if (p[0] == '/') /* Skip leading '/'. */ - ++p; - for (final = FALSE; !final; ++p) { - if (p[0] == '\0' || (p[0] == '/' && p[1] == '\0')) - final = TRUE; - else if (p[0] != '/') - continue; - *p = '\0'; - if (stat(path, &sb)) { - if (errno != ENOENT) { - msgConfirm("Couldn't stat directory %s: %s", path, strerror(errno)); - return DITEM_FAILURE; - } - if (isDebug()) - msgDebug("mkdir(%s..)\n", path); - if (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) { - msgConfirm("Couldn't create directory %s: %s", path,strerror(errno)); - return DITEM_FAILURE; - } - } - *p = '/'; - } - return DITEM_SUCCESS; -} - -int -Mount(char *mountp, void *dev) -{ - struct ufs_args ufsargs; - char device[80]; - char mountpoint[FILENAME_MAX]; - - if (Fake) - return DITEM_SUCCESS; - - if (*((char *)dev) != '/') { - sprintf(device, "/dev/%s", (char *)dev); - sprintf(mountpoint, "%s", mountp); - } - else { - strcpy(device, dev); - strcpy(mountpoint, mountp); - } - memset(&ufsargs,0,sizeof ufsargs); - - if (Mkdir(mountpoint)) { - msgConfirm("Unable to make directory mountpoint for %s!", mountpoint); - return DITEM_FAILURE; - } - if (isDebug()) - msgDebug("mount %s %s\n", device, mountpoint); - - ufsargs.fspec = device; - if (mount("ufs", mountpoint, 0, - (caddr_t)&ufsargs) == -1) { - msgConfirm("Error mounting %s on %s : %s", device, mountpoint, strerror(errno)); - return DITEM_FAILURE; - } - return DITEM_SUCCESS; -} - -WINDOW * -savescr(void) -{ - WINDOW *w; - - w = dupwin(newscr); - return w; -} - -void -restorescr(WINDOW *w) -{ - touchwin(w); - wrefresh(w); - delwin(w); -} - -static int -xdialog_count_rows(const char *p) -{ - int rows = 0; - - while ((p = strchr(p, '\n')) != NULL) { - p++; - if (*p == '\0') - break; - rows++; - } - - return rows ? rows : 1; -} - -static int -xdialog_count_columns(const char *p) -{ - int len; - int max_len = 0; - const char *q; - - for (; (q = strchr(p, '\n')) != NULL; p = q + 1) { - len = q - p; - max_len = MAX(max_len, len); - } - - len = strlen(p); - max_len = MAX(max_len, len); - return max_len; -} - -int -xdialog_menu(const char *title, const char *cprompt, int height, int width, - int menu_height, int item_no, dialogMenuItem *ditems) -{ - int i, result, choice = 0; - DIALOG_LISTITEM *listitems; - DIALOG_VARS save_vars; - - dlg_save_vars(&save_vars); - - /* initialize list items */ - listitems = dlg_calloc(DIALOG_LISTITEM, item_no + 1); - assert_ptr(listitems, "xdialog_menu"); - for (i = 0; i < item_no; i++) { - listitems[i].name = ditems[i].prompt; - listitems[i].text = ditems[i].title; - } - - /* calculate height */ - if (height < 0) - height = xdialog_count_rows(cprompt) + menu_height + 4 + 2; - if (height > LINES) - height = LINES; - - /* calculate width */ - if (width < 0) { - int tag_x = 0; - - for (i = 0; i < item_no; i++) { - int j, l; - - l = strlen(listitems[i].name); - for (j = 0; j < item_no; j++) { - int k = strlen(listitems[j].text); - tag_x = MAX(tag_x, l + k + 2); - } - } - width = MAX(xdialog_count_columns(cprompt), title != NULL ? xdialog_count_columns(title) : 0); - width = MAX(width, tag_x + 4) + 4; - } - width = MAX(width, 24); - if (width > COLS) - width = COLS; - - /* show menu */ - dialog_vars.default_item = listitems[choice].name; - result = dlg_menu(title, cprompt, height, width, - menu_height, item_no, listitems, &choice, NULL); - switch (result) { - case DLG_EXIT_ESC: - result = -1; - break; - case DLG_EXIT_OK: - if (ditems[choice].fire != NULL) { - int status; - WINDOW *save; - - save = savescr(); - status = ditems[choice].fire(ditems + choice); - restorescr(save); - } - result = 0; - break; - case DLG_EXIT_CANCEL: - default: - result = 1; - break; - } - - free(listitems); - dlg_restore_vars(&save_vars); - return result; -} - -int -xdialog_radiolist(const char *title, const char *cprompt, int height, int width, - int menu_height, int item_no, dialogMenuItem *ditems) -{ - int i, result, choice = 0; - DIALOG_LISTITEM *listitems; - DIALOG_VARS save_vars; - - dlg_save_vars(&save_vars); - - /* initialize list items */ - listitems = dlg_calloc(DIALOG_LISTITEM, item_no + 1); - assert_ptr(listitems, "xdialog_menu"); - for (i = 0; i < item_no; i++) { - listitems[i].name = ditems[i].prompt; - listitems[i].text = ditems[i].title; - listitems[i].state = i == choice; - } - - /* calculate height */ - if (height < 0) - height = xdialog_count_rows(cprompt) + menu_height + 4 + 2; - if (height > LINES) - height = LINES; - - /* calculate width */ - if (width < 0) { - int check_x = 0; - - for (i = 0; i < item_no; i++) { - int j, l; - - l = strlen(listitems[i].name); - for (j = 0; j < item_no; j++) { - int k = strlen(listitems[j].text); - check_x = MAX(check_x, l + k + 6); - } - } - width = MAX(xdialog_count_columns(cprompt), title != NULL ? xdialog_count_columns(title) : 0); - width = MAX(width, check_x + 4) + 4; - } - width = MAX(width, 24); - if (width > COLS) - width = COLS; - - /* show menu */ - dialog_vars.default_item = listitems[choice].name; - result = dlg_checklist(title, cprompt, height, width, - menu_height, item_no, listitems, NULL, FLAG_RADIO, &choice); - switch (result) { - case DLG_EXIT_ESC: - result = -1; - break; - case DLG_EXIT_OK: - if (ditems[choice].fire != NULL) { - int status; - WINDOW *save; - - save = savescr(); - status = ditems[choice].fire(ditems + choice); - restorescr(save); - } - result = 0; - break; - case DLG_EXIT_CANCEL: - default: - result = 1; - break; - } - - /* save result */ - if (result == 0) - dlg_add_result(listitems[choice].name); - free(listitems); - dlg_restore_vars(&save_vars); - return result; -} - -int -xdialog_msgbox(const char *title, const char *cprompt, - int height, int width, int pauseopt) -{ - /* calculate height */ - if (height < 0) - height = 2 + xdialog_count_rows(cprompt) + 2 + !!pauseopt; - if (height > LINES) - height = LINES; - - /* calculate width */ - if (width < 0) { - width = title != NULL ? xdialog_count_columns(title) : 0; - width = MAX(width, xdialog_count_columns(cprompt)) + 4; - } - if (pauseopt) - width = MAX(width, 10); - if (width > COLS) - width = COLS; - - return dialog_msgbox(title, cprompt, height, width, pauseopt); -} diff --git a/usr.sbin/sade/msg.c b/usr.sbin/sade/msg.c deleted file mode 100644 index fb3368e..0000000 --- a/usr.sbin/sade/msg.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include "sade.h" -#include <stdarg.h> -#include <sys/ioctl.h> -#include <sys/consio.h> - -Boolean -isDebug(void) -{ - char *cp; - - return (cp = variable_get(VAR_DEBUG)) && strcmp(cp, "no"); -} - -/* Whack up an informational message on the status line, in stand-out */ -void -msgYap(const char *fmt, ...) -{ - va_list args; - char *errstr; - int attrs; - - errstr = (char *)alloca(FILENAME_MAX); - va_start(args, fmt); - vsnprintf(errstr, FILENAME_MAX, fmt, args); - va_end(args); - attrs = getattrs(stdscr); - attrset(A_REVERSE); - mvaddstr(StatusLine, 0, errstr); - attrset(attrs); - refresh(); -} - -/* Whack up an informational message on the status line */ -void -msgInfo(const char *fmt, ...) -{ - va_list args; - char *errstr; - int i, attrs; - char line[81]; - - attrs = getattrs(stdscr); - /* NULL is a special convention meaning "erase the old stuff" */ - if (!fmt) { - move(StatusLine, 0); - clrtoeol(); - return; - } - errstr = (char *)alloca(FILENAME_MAX); - va_start(args, fmt); - vsnprintf(errstr, FILENAME_MAX, fmt, args); - va_end(args); - memset(line, ' ', 80); - for (i = 0; i < 80; i++) { - if (errstr[i]) - line[i] = errstr[i]; - else - break; - } - line[80] = '\0'; - attrset(ATTR_TITLE); - mvaddstr(StatusLine, 0, line); - attrset(attrs); - move(StatusLine, 79); - refresh(); -} - -/* Whack up a warning on the status line */ -void -msgWarn(const char *fmt, ...) -{ - va_list args; - char *errstr; - int attrs; - - errstr = (char *)alloca(FILENAME_MAX); - strcpy(errstr, "Warning: "); - va_start(args, fmt); - vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args); - va_end(args); - attrs = getattrs(stdscr); - beep(); - attrset(ATTR_TITLE); - mvaddstr(StatusLine, 0, errstr); - attrset(attrs); - refresh(); - if (OnVTY && isDebug()) - msgDebug("Warning message `%s'\n", errstr); -} - -/* Whack up an error on the status line */ -void -msgError(const char *fmt, ...) -{ - va_list args; - char *errstr; - int attrs; - - errstr = (char *)alloca(FILENAME_MAX); - strcpy(errstr, "Error: "); - va_start(args, fmt); - vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args); - va_end(args); - beep(); - attrs = getattrs(stdscr); - attrset(ATTR_TITLE); - mvaddstr(StatusLine, 0, errstr); - attrset(attrs); - refresh(); - if (OnVTY && isDebug()) - msgDebug("Error message `%s'\n", errstr); -} - -/* Whack up a fatal error on the status line */ -void -msgFatal(const char *fmt, ...) -{ - va_list args; - char *errstr; - int attrs; - - errstr = (char *)alloca(FILENAME_MAX); - strcpy(errstr, "Fatal Error: "); - va_start(args, fmt); - vsnprintf((char *)(errstr + strlen(errstr)), FILENAME_MAX, fmt, args); - va_end(args); - beep(); - attrs = getattrs(stdscr); - attrset(ATTR_TITLE); - mvaddstr(StatusLine, 0, errstr); - addstr(" - "); - addstr("PRESS ANY KEY TO "); - if (getpid() == 1) - addstr("REBOOT"); - else - addstr("QUIT"); - attrset(attrs); - refresh(); - if (OnVTY) - msgDebug("Fatal error `%s'!\n", errstr); - getch(); -} - -/* Put up a message in a popup confirmation box */ -void -msgConfirm(const char *fmt, ...) -{ - va_list args; - char *errstr; - WINDOW *w = savescr(); - - errstr = (char *)alloca(FILENAME_MAX); - va_start(args, fmt); - vsnprintf(errstr, FILENAME_MAX, fmt, args); - va_end(args); - dialog_vars.help_line = NULL; - dialog_vars.help_file = NULL; - if (OnVTY) { - ioctl(0, VT_ACTIVATE, 1); - msgInfo(NULL); - } - dialog_vars.help_line = "Press Enter or Space"; - xdialog_msgbox("Message", errstr, -1, -1, 1); - dialog_vars.help_line = NULL; - - restorescr(w); -} - -/* Put up a message in a popup information box */ -void -msgNotify(const char *fmt, ...) -{ - va_list args; - char *errstr; - - errstr = (char *)alloca(FILENAME_MAX); - va_start(args, fmt); - vsnprintf(errstr, FILENAME_MAX, fmt, args); - va_end(args); - dialog_vars.help_line = NULL; - dialog_vars.help_file = NULL; - if (isDebug()) - msgDebug("Notify: %s\n", errstr); - xdialog_msgbox(NULL, errstr, -1, -1, 0); -} - -/* Put up a message in a popup yes/no box and return 0 for YES, 1 for NO */ -int -msgYesNo(const char *fmt, ...) -{ - va_list args; - char *errstr; - int ret; - WINDOW *w = savescr(); - - errstr = (char *)alloca(FILENAME_MAX); - va_start(args, fmt); - vsnprintf(errstr, FILENAME_MAX, fmt, args); - va_end(args); - dialog_vars.help_line = NULL; - dialog_vars.help_file = NULL; - if (OnVTY) { - ioctl(0, VT_ACTIVATE, 1); /* Switch back */ - msgInfo(NULL); - } - if (variable_get(VAR_NONINTERACTIVE)) - return 0; /* If non-interactive, return YES all the time */ - ret = dialog_yesno("User Confirmation Requested", errstr, -1, -1); - restorescr(w); - return ret; -} - -/* Put up a message in a popup no/yes box and return 0 for YES, 1 for NO */ -int -msgNoYes(const char *fmt, ...) -{ - va_list args; - char *errstr; - int ret; - WINDOW *w = savescr(); - DIALOG_VARS save_vars; - - errstr = (char *)alloca(FILENAME_MAX); - va_start(args, fmt); - vsnprintf(errstr, FILENAME_MAX, fmt, args); - va_end(args); - dialog_vars.help_line = NULL; - dialog_vars.help_file = NULL; - if (OnVTY) { - ioctl(0, VT_ACTIVATE, 1); /* Switch back */ - msgInfo(NULL); - } - if (variable_get(VAR_NONINTERACTIVE)) - return 1; /* If non-interactive, return NO all the time */ - dlg_save_vars(&save_vars); - dialog_vars.defaultno = TRUE; - ret = dialog_yesno("User Confirmation Requested", errstr, -1, -1); - dlg_restore_vars(&save_vars); - restorescr(w); - return ret; -} - -/* Put up a message in an input box and return the value */ -char * -msgGetInput(char *buf, const char *fmt, ...) -{ - va_list args; - char *errstr; - static char input_buffer[256]; - int rval; - WINDOW *w = savescr(); - - errstr = (char *)alloca(FILENAME_MAX); - va_start(args, fmt); - vsnprintf(errstr, FILENAME_MAX, fmt, args); - va_end(args); - dialog_vars.help_line = NULL; - dialog_vars.help_file = NULL; - if (buf) - SAFE_STRCPY(input_buffer, buf); - else - input_buffer[0] = '\0'; - if (OnVTY) { - ioctl(0, VT_ACTIVATE, 1); /* Switch back */ - msgInfo(NULL); - } - rval = dialog_inputbox("Value Required", errstr, -1, -1, input_buffer, 0); - restorescr(w); - if (!rval) - return dialog_vars.input_result; - else - return NULL; -} - -/* Write something to the debugging port */ -void -msgDebug(const char *fmt, ...) -{ - va_list args; - char *dbg; - - if (DebugFD == -1) - return; - dbg = (char *)alloca(FILENAME_MAX); - strcpy(dbg, "DEBUG: "); - va_start(args, fmt); - vsnprintf((char *)(dbg + strlen(dbg)), FILENAME_MAX, fmt, args); - va_end(args); - write(DebugFD, dbg, strlen(dbg)); -} - -/* Tell the user there's some output to go look at */ -void -msgWeHaveOutput(const char *fmt, ...) -{ - va_list args; - char *errstr; - WINDOW *w = savescr(); - - errstr = (char *)alloca(FILENAME_MAX); - va_start(args, fmt); - vsnprintf(errstr, FILENAME_MAX, fmt, args); - va_end(args); - dialog_vars.help_line = NULL; - dialog_vars.help_file = NULL; - msgDebug("Notify: %s\n", errstr); - dlg_clear(); - sleep(2); - xdialog_msgbox(NULL, errstr, -1, -1, 0); - restorescr(w); -} - -/* Simple versions of msgConfirm() and msgNotify() for calling from scripts */ -int -msgSimpleConfirm(const char *str) -{ - msgConfirm("%s", str); - return DITEM_SUCCESS; -} - -int -msgSimpleNotify(const char *str) -{ - msgNotify("%s", str); - return DITEM_SUCCESS; -} diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h deleted file mode 100644 index 3e163ad..0000000 --- a/usr.sbin/sade/sade.h +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - * $FreeBSD$ - */ - -#ifndef _SADE_H_INCLUDE -#define _SADE_H_INCLUDE - -#include <sys/types.h> -#include <sys/wait.h> -#include <errno.h> -#include <setjmp.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <dialog.h> - -/*** Defines ***/ - -#if defined(__i386__) || defined(__amd64__) -#define WITH_SYSCONS -#define WITH_MICE -#endif - -#if defined(__i386__) || defined(__amd64__) -#define WITH_SLICES -#endif - -#if defined(__i386__) -#define WITH_LINUX -#endif - -/* device limits */ -#define DEV_NAME_MAX 128 /* The maximum length of a device name */ -#define DEV_MAX 100 /* The maximum number of devices we'll deal with */ -#define IO_ERROR -2 /* Status code for I/O error rather than normal EOF */ - -/* - * I make some pretty gross assumptions about having a max of 50 chunks - * total - 8 slices and 42 partitions. I can't easily display many more - * than that on the screen at once! - * - * For 2.1 I'll revisit this and try to make it more dynamic, but since - * this will catch 99.99% of all possible cases, I'm not too worried. - */ -#define MAX_CHUNKS 40 - -/* Internal environment variable names */ -#define DISK_PARTITIONED "_diskPartitioned" -#define DISK_LABELLED "_diskLabelled" -#define DISK_SELECTED "_diskSelected" -#define SYSTEM_STATE "_systemState" -#define RUNNING_ON_ROOT "_runningOnRoot" - -/* Ones that can be tweaked from config files */ -#define VAR_BLANKTIME "blanktime" -#define VAR_BOOTMGR "bootManager" -#define VAR_DEBUG "debug" -#define VAR_DISK "disk" -#define VAR_DISKINTERACTIVE "diskInteractive" -#define VAR_DEDICATE_DISK "dedicateDisk" -#define VAR_COMMAND "command" -#define VAR_CONFIG_FILE "configFile" -#define VAR_GEOMETRY "geometry" -#define VAR_INSTALL_CFG "installConfig" -#define VAR_INSTALL_ROOT "installRoot" -#define VAR_LABEL "label" -#define VAR_LABEL_COUNT "labelCount" -#define VAR_NEWFS_ARGS "newfsArgs" -#define VAR_NO_CONFIRM "noConfirm" -#define VAR_NO_ERROR "noError" -#define VAR_NO_WARN "noWarn" -#define VAR_NO_USR "noUsr" -#define VAR_NO_TMP "noTmp" -#define VAR_NO_HOME "noHome" -#define VAR_NONINTERACTIVE "nonInteractive" -#define VAR_PARTITION "partition" -#define VAR_RELNAME "releaseName" -#define VAR_ROOT_SIZE "rootSize" -#define VAR_SWAP_SIZE "swapSize" -#define VAR_TAPE_BLOCKSIZE "tapeBlocksize" -#define VAR_UFS_PATH "ufs" -#define VAR_USR_SIZE "usrSize" -#define VAR_VAR_SIZE "varSize" -#define VAR_TMP_SIZE "tmpSize" -#define VAR_TERM "TERM" -#define VAR_CONSTERM "_consterm" - -#define DEFAULT_TAPE_BLOCKSIZE "20" - -/* One MB worth of blocks */ -#define ONE_MEG 2048 -#define ONE_GIG (ONE_MEG * 1024) - -/* Which selection attributes to use */ -#define ATTR_SELECTED (ColorDisplay ? item_selected_attr : item_attr) -#define ATTR_TITLE button_active_attr - -/* Handy strncpy() macro */ -#define SAFE_STRCPY(to, from) sstrncpy((to), (from), sizeof (to) - 1) - -/*** Types ***/ -typedef int Boolean; -typedef struct disk Disk; -typedef struct chunk Chunk; - -/* 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_RESTORE (1 << 19) - -/* for use in describing more exotic behaviors */ -typedef struct _dmenu_item { - char *prompt; - char *title; - int (*fire)(struct _dmenu_item *self); -} dialogMenuItem; - -/* Bitfields for menu options */ -#define DMENU_NORMAL_TYPE 0x1 /* Normal dialog menu */ -#define DMENU_RADIO_TYPE 0x2 /* Radio dialog menu */ -#define DMENU_SELECTION_RETURNS 0x8 /* Immediate return on item selection */ - -typedef struct _dmenu { - int type; /* What sort of menu we are */ - char *title; /* Our title */ - char *prompt; /* Our prompt */ - char *helpline; /* Line of help at bottom */ - char *helpfile; /* Help file for "F1" */ - dialogMenuItem items[]; /* Array of menu items */ -} DMenu; - -/* An rc.conf variable */ -typedef struct _variable { - struct _variable *next; - char *name; - char *value; - int dirty; -} Variable; - -#define NO_ECHO_OBJ(type) ((type) | (DITEM_NO_ECHO << 16)) -#define TYPE_OF_OBJ(type) ((type) & 0xff) -#define ATTR_OF_OBJ(type) ((type) >> 16) - -/* A screen layout structure */ -typedef struct _layout { - int y; /* x & Y co-ordinates */ - int x; - int len; /* The size of the dialog on the screen */ - int maxlen; /* How much the user can type in ... */ - char *prompt; /* The string for the prompt */ - char *help; /* The display for the help line */ - void *var; /* The var to set when this changes */ - int type; /* The type of the dialog to create */ - void *obj; /* The obj pointer returned by libdialog */ -} Layout; - -typedef enum { - DEVICE_TYPE_NONE, - DEVICE_TYPE_DISK, - DEVICE_TYPE_DOS, - DEVICE_TYPE_UFS, - DEVICE_TYPE_ANY, -} DeviceType; - -/* A "device" from sade's point of view */ -typedef struct _device { - char name[DEV_NAME_MAX]; - char *description; - char *devname; - DeviceType type; - Boolean (*init)(struct _device *dev); - FILE * (*get)(struct _device *dev, char *file, Boolean probe); - void (*shutdown)(struct _device *dev); - void *private; - unsigned int flags; - unsigned int volume; -} Device; - -/* Some internal representations of partitions */ -typedef enum { - PART_NONE, - PART_SLICE, - PART_SWAP, - PART_FILESYSTEM, - PART_FAT, - PART_EFI -} PartType; - -#define NEWFS_UFS_CMD "newfs" -#define NEWFS_MSDOS_CMD "newfs_msdos" - -enum newfs_type { NEWFS_UFS, NEWFS_MSDOS, NEWFS_CUSTOM }; -#define NEWFS_UFS_STRING "UFS" -#define NEWFS_MSDOS_STRING "FAT" -#define NEWFS_CUSTOM_STRING "CST" - -/* The longest set of custom command line arguments we'll pass. */ -#define NEWFS_CMD_ARGS_MAX 256 - -typedef struct _part_info { - char mountpoint[FILENAME_MAX]; - - /* Is invocation of newfs desired? */ - Boolean do_newfs; - - enum newfs_type newfs_type; - union { - struct { - char user_options[NEWFS_CMD_ARGS_MAX]; - Boolean acls; /* unused */ - Boolean multilabel; /* unused */ - Boolean softupdates; - Boolean ufs1; - } newfs_ufs; - struct { - /* unused */ - } newfs_msdos; - struct { - char command[NEWFS_CMD_ARGS_MAX]; - } newfs_custom; - } newfs_data; -} PartInfo; - -/* An option */ -typedef struct _opt { - char *name; - char *desc; - enum { OPT_IS_STRING, OPT_IS_INT, OPT_IS_FUNC, OPT_IS_VAR } type; - void *data; - void *aux; - char *(*check)(void); -} Option; - -typedef int (*commandFunc)(char *key, void *data); - -#define EXTRAS_FIELD_LEN 128 - -/*** Externs ***/ -extern jmp_buf BailOut; /* Used to get the heck out */ -extern int DebugFD; /* Where diagnostic output goes */ -extern Boolean Fake; /* Don't actually modify anything - testing */ -extern Boolean Restarting; /* Are we restarting sysinstall? */ -extern Boolean SystemWasInstalled; /* Did we install it? */ -extern Boolean RunningAsInit; /* Are we running stand-alone? */ -extern Boolean DialogActive; /* Is the dialog() stuff up? */ -extern Boolean ColorDisplay; /* Are we on a color display? */ -extern Boolean OnVTY; /* On a syscons VTY? */ -extern Variable *VarHead; /* The head of the variable chain */ -extern int BootMgr; /* Which boot manager to use */ -extern int StatusLine; /* Where to print our status messages */ -#if defined(__i386__) || defined(__amd64__) -#ifdef PC98 -extern DMenu MenuIPLType; /* Type of IPL to write on the disk */ -#else -extern DMenu MenuMBRType; /* Type of MBR to write on the disk */ -#endif -#endif -extern DMenu MenuMain; /* New main menu */ -extern DMenu MenuDiskDevices; /* Disk type devices */ -extern const char * StartName; /* Which name we were started as */ -extern const char * ProgName; /* Program's proper name */ - -/* Important chunks. */ -extern Chunk *HomeChunk; -extern Chunk *RootChunk; -extern Chunk *SwapChunk; -extern Chunk *TmpChunk; -extern Chunk *UsrChunk; -extern Chunk *VarChunk; -#ifdef __ia64__ -extern Chunk *EfiChunk; -#endif - -/* Stuff from libdialog which isn't properly declared outside */ -extern void display_helpfile(void); -extern void display_helpline(WINDOW *w, int y, int width); - -/*** Prototypes ***/ - -/* command.c */ -extern void command_clear(void); -extern void command_sort(void); -extern void command_execute(void); -extern void command_shell_add(char *key, const char *fmt, ...) __printflike(2, 3); -extern void command_func_add(char *key, commandFunc func, void *data); - -/* devices.c */ -extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d)); -extern void deviceGetAll(void); -extern void deviceReset(void); -extern void deviceRescan(void); -extern Device **deviceFind(char *name, DeviceType type); -extern Device **deviceFindDescr(char *name, char *desc, DeviceType class); -extern int deviceCount(Device **devs); -extern Device *new_device(char *name); -extern Device *deviceRegister(char *name, char *desc, char *devicename, DeviceType type, - Boolean (*init)(Device *mediadev), - FILE * (*get)(Device *dev, char *file, Boolean probe), - void (*shutDown)(Device *mediadev), - void *private); -extern Boolean dummyInit(Device *dev); -extern FILE *dummyGet(Device *dev, char *dist, Boolean probe); -extern void dummyShutdown(Device *dev); - -/* disks.c */ -#ifdef WITH_SLICES -extern void diskPartition(Device *dev); -extern int diskPartitionEditor(dialogMenuItem *self); -#endif -extern int diskPartitionWrite(Device *dev); - -/* dispatch.c */ -extern int dispatchCommand(char *command); -extern int dispatch_load_floppy(dialogMenuItem *self); -extern int dispatch_load_file_int(int); -extern int dispatch_load_file(dialogMenuItem *self); - -/* dmenu.c */ -extern int dmenuSetValue(dialogMenuItem *tmp); -extern Boolean dmenuOpen(DMenu *menu); -extern int dmenuRadioCheck(dialogMenuItem *item); - -/* dos.c */ -extern Boolean mediaCloseDOS(Device *dev, FILE *fp); -extern Boolean mediaInitDOS(Device *dev); -extern FILE *mediaGetDOS(Device *dev, char *file, Boolean probe); -extern void mediaShutdownDOS(Device *dev); - -/* globals.c */ -extern void globalsInit(void); - -/* install.c */ -extern Boolean checkLabels(Boolean whinge); -extern int installCommit(dialogMenuItem *self); -extern int installCustomCommit(dialogMenuItem *self); -extern int installFilesystems(Device *dev); -extern int installVarDefaults(dialogMenuItem *self); -extern void installEnvironment(void); -extern Boolean copySelf(void); - -/* kget.c */ -extern int kget(char *out); - -/* label.c */ -extern int diskLabelEditor(dialogMenuItem *self); -extern int diskLabelCommit(Device *dev); - -/* misc.c */ -extern Boolean file_readable(char *fname); -extern Boolean directory_exists(const char *dirname); -extern char *string_prune(char *str); -extern char *string_skipwhite(char *str); -extern void safe_free(void *ptr); -extern void *safe_malloc(size_t size); -extern int Mkdir(char *); -extern int Mount(char *, void *data); - -extern WINDOW *savescr(void); -extern void restorescr(WINDOW *w); -extern char *sstrncpy(char *dst, const char *src, int size); - -extern int xdialog_menu(const char *title, const char *cprompt, - int height, int width, int menu_height, - int item_no, dialogMenuItem *ditems); -extern int xdialog_radiolist(const char *title, const char *cprompt, - int height, int width, int menu_height, - int item_no, dialogMenuItem *ditems); -extern int xdialog_msgbox(const char *title, const char *cprompt, - int height, int width, int pauseopt); - -/* msg.c */ -extern Boolean isDebug(void); -extern void msgInfo(const char *fmt, ...) __printf0like(1, 2); -extern void msgYap(const char *fmt, ...) __printflike(1, 2); -extern void msgWarn(const char *fmt, ...) __printflike(1, 2); -extern void msgDebug(const char *fmt, ...) __printflike(1, 2); -extern void msgError(const char *fmt, ...) __printflike(1, 2); -extern void msgFatal(const char *fmt, ...) __printflike(1, 2); -extern void msgConfirm(const char *fmt, ...) __printflike(1, 2); -extern void msgNotify(const char *fmt, ...) __printflike(1, 2); -extern void msgWeHaveOutput(const char *fmt, ...) __printflike(1, 2); -extern int msgYesNo(const char *fmt, ...) __printflike(1, 2); -extern int msgNoYes(const char *fmt, ...) __printflike(1, 2); -extern char *msgGetInput(char *buf, const char *fmt, ...) __printflike(2, 3); -extern int msgSimpleConfirm(const char *); -extern int msgSimpleNotify(const char *); - -/* pccard.c */ -extern void pccardInitialize(void); - -/* system.c */ -extern void systemInitialize(int argc, char **argv); -extern void systemShutdown(int status); -extern int execExecute(char *cmd, char *name); -extern int systemExecute(char *cmd); -extern void systemSuspendDialog(void); -extern void systemResumeDialog(void); -extern int systemDisplayHelp(char *file); -extern char *systemHelpFile(char *file, char *buf); -extern void systemChangeFont(const u_char font[]); -extern void systemChangeLang(char *lang); -extern void systemChangeTerminal(char *color, const u_char c_termcap[], char *mono, const u_char m_termcap[]); -extern void systemChangeScreenmap(const u_char newmap[]); -extern int vsystem(const char *fmt, ...) __printflike(1, 2); - -/* termcap.c */ -extern int set_termcap(void); - -/* variable.c */ -extern void variable_set(char *var, int dirty); -extern void variable_set2(char *name, char *value, int dirty); -extern char *variable_get(char *var); -extern int variable_cmp(char *var, char *value); -extern void variable_unset(char *var); -extern char *variable_get_value(char *var, char *prompt, int dirty); -extern int variable_check(char *data); -extern int variable_check2(char *data); -extern int dump_variables(dialogMenuItem *self); -extern void free_variables(void); -extern void pvariable_set(char *var); -extern char *pvariable_get(char *var); - -/* wizard.c */ -extern void slice_wizard(Disk *d); - -/* - * Macros. Please find a better place for us! - */ -#define DEVICE_INIT(d) ((d) != NULL ? (d)->init((d)) : (Boolean)0) -#define DEVICE_GET(d, b, f) ((d) != NULL ? (d)->get((d), (b), (f)) : NULL) -#define DEVICE_SHUTDOWN(d) ((d) != NULL ? (d)->shutdown((d)) : (void)0) - -#endif -/* _SYSINSTALL_H_INCLUDE */ diff --git a/usr.sbin/sade/system.c b/usr.sbin/sade/system.c deleted file mode 100644 index 1e0e52f..0000000 --- a/usr.sbin/sade/system.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * $FreeBSD$ - * - * Jordan Hubbard - * - * My contributions are in the public domain. - * - * Parts of this file are also blatently stolen from Poul-Henning Kamp's - * previous version of sysinstall, and as such fall under his "BEERWARE license" - * so buy him a beer if you like it! Buy him a beer for me, too! - * Heck, get him completely drunk and send me pictures! :-) - */ - -#include <signal.h> -#include <termios.h> -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/consio.h> -#include <sys/fcntl.h> -#include <sys/ioctl.h> -#include <sys/mount.h> -#include <sys/stat.h> -#include <sys/sysctl.h> -#include <ufs/ufs/ufsmount.h> - -#include "sade.h" - -/* Where we stick our temporary expanded doc file */ -#define DOC_TMP_DIR "/tmp/.doc" -#define DOC_TMP_FILE "/tmp/.doc/doc.tmp" - -/* - * Handle interrupt signals - this probably won't work in all cases - * due to our having bogotified the internal state of dialog or curses, - * but we'll give it a try. - */ -static int -intr_continue(dialogMenuItem *self) -{ - return DITEM_LEAVE_MENU; -} - -static int -intr_restart(dialogMenuItem *self) -{ - int ret, fd, fdmax; - - free_variables(); - fdmax = getdtablesize(); - for (fd = 3; fd < fdmax; fd++) - close(fd); - ret = execl(StartName, StartName, "-restart", (char *)NULL); - msgDebug("execl failed (%s)\n", strerror(errno)); - /* NOTREACHED */ - return -1; -} - -static dialogMenuItem intrmenu[] = { - { "Restart", "Restart the program", intr_restart }, - { "Continue", "Continue without restarting", intr_continue }, -}; - - -static void -handle_intr(int sig) -{ - WINDOW *save = savescr(); - - dialog_vars.help_line = NULL; - dialog_vars.help_file = NULL; - if (OnVTY) { - ioctl(0, VT_ACTIVATE, 1); /* Switch back */ - msgInfo(NULL); - } - (void)xdialog_menu("Installation interrupt", - "Do you want to abort the installation?", - -1, -1, 2, 2, intrmenu); - restorescr(save); -} - -/* Expand a file into a convenient location, nuking it each time */ -static char * -expand(char *fname) -{ - char *gunzip = "/usr/bin/gunzip"; - - if (!directory_exists(DOC_TMP_DIR)) { - Mkdir(DOC_TMP_DIR); - if (chown(DOC_TMP_DIR, 0, 0) < 0) - return NULL; - if (chmod(DOC_TMP_DIR, S_IRWXU) < 0) - return NULL; - } - else - unlink(DOC_TMP_FILE); - if (!file_readable(fname) || vsystem("%s < %s > %s", gunzip, fname, DOC_TMP_FILE)) - return NULL; - return DOC_TMP_FILE; -} - -/* Initialize system defaults */ -void -systemInitialize(int argc, char **argv) -{ - size_t i; - int boothowto; - sigset_t signalset; - - signal(SIGINT, SIG_IGN); - globalsInit(); - - i = sizeof(boothowto); - if (!sysctlbyname("debug.boothowto", &boothowto, &i, NULL, 0) && - (i == sizeof(boothowto)) && (boothowto & RB_VERBOSE)) - variable_set2(VAR_DEBUG, "YES", 0); - - if (set_termcap() == -1) { - printf("Can't find terminal entry\n"); - exit(-1); - } - - /* XXX - libdialog has particularly bad return value checking */ - init_dialog(stdin, stdout); - - /* If we haven't crashed I guess dialog is running ! */ - DialogActive = TRUE; - - /* Make sure HOME is set for those utilities that need it */ - signal(SIGINT, handle_intr); - /* - * Make sure we can be interrupted even if we were re-executed - * from an interrupt. - */ - sigemptyset(&signalset); - sigaddset(&signalset, SIGINT); - sigprocmask(SIG_UNBLOCK, &signalset, NULL); - - (void)vsystem("rm -rf %s", DOC_TMP_DIR); -} - -/* Run some general command */ -int -systemExecute(char *command) -{ - int status; - struct termios foo; - WINDOW *w = savescr(); - - dlg_clear(); - end_dialog(); - DialogActive = FALSE; - if (tcgetattr(0, &foo) != -1) { - foo.c_cc[VERASE] = '\010'; - tcsetattr(0, TCSANOW, &foo); - } - if (!Fake) - status = system(command); - else { - status = 0; - msgDebug("systemExecute: Faked execution of `%s'\n", command); - } - DialogActive = TRUE; - restorescr(w); - return status; -} - -/* suspend/resume libdialog/curses screen */ -static WINDOW *oldW; - -void -systemSuspendDialog(void) -{ - - oldW = savescr(); - dlg_clear(); - end_dialog(); - DialogActive = FALSE; -} - -void -systemResumeDialog(void) -{ - - DialogActive = TRUE; - restorescr(oldW); -} - -/* Display a help file in a filebox */ -int -systemDisplayHelp(char *file) -{ - char *fname = NULL; - char buf[FILENAME_MAX]; - int ret = 0; - WINDOW *w = savescr(); - - fname = systemHelpFile(file, buf); - if (!fname) { - snprintf(buf, FILENAME_MAX, "The %s file is not provided on this particular floppy image.", file); - dialog_vars.help_line = NULL; - dialog_vars.help_file = NULL; - xdialog_msgbox("Sorry!", buf, -1, -1, 1); - ret = 1; - } - else { - dialog_vars.help_line = NULL; - dialog_vars.help_file = NULL; - dialog_textbox(file, fname, LINES, COLS); - } - restorescr(w); - return ret; -} - -char * -systemHelpFile(char *file, char *buf) -{ - if (!file) - return NULL; - if (file[0] == '/') - return file; - snprintf(buf, FILENAME_MAX, "/stand/help/%s.hlp.gz", file); - if (file_readable(buf)) - return expand(buf); - snprintf(buf, FILENAME_MAX, "/stand/help/%s.hlp", file); - if (file_readable(buf)) - return expand(buf); - snprintf(buf, FILENAME_MAX, "/stand/help/%s.TXT.gz", file); - if (file_readable(buf)) - return expand(buf); - snprintf(buf, FILENAME_MAX, "/stand/help/%s.TXT", file); - if (file_readable(buf)) - return expand(buf); - snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/%s/help/%s.hlp", ProgName, - file); - if (file_readable(buf)) - return buf; - snprintf(buf, FILENAME_MAX, "/usr/src/usr.sbin/%s/help/%s.TXT", ProgName, - file); - if (file_readable(buf)) - return buf; - return NULL; -} - -int -vsystem(const char *fmt, ...) -{ - va_list args; - int pstat; - pid_t pid; - int omask; - sig_t intsave, quitsave; - char *cmd; - int i; - struct stat sb; - - cmd = (char *)alloca(FILENAME_MAX); - cmd[0] = '\0'; - va_start(args, fmt); - vsnprintf(cmd, FILENAME_MAX, fmt, args); - va_end(args); - - omask = sigblock(sigmask(SIGCHLD)); - if (Fake) { - msgDebug("vsystem: Faked execution of `%s'\n", cmd); - return 0; - } - if (isDebug()) - msgDebug("Executing command `%s'\n", cmd); - pid = fork(); - if (pid == -1) { - (void)sigsetmask(omask); - i = 127; - } - else if (!pid) { /* Junior */ - (void)sigsetmask(omask); - if (DebugFD != -1) { - dup2(DebugFD, 0); - dup2(DebugFD, 1); - dup2(DebugFD, 2); - } - else { - close(1); open("/dev/null", O_WRONLY); - dup2(1, 2); - } - if (stat("/stand/sh", &sb) == 0) - execl("/stand/sh", "/stand/sh", "-c", cmd, (char *)NULL); - else - execl("/bin/sh", "/bin/sh", "-c", cmd, (char *)NULL); - exit(1); - } - else { - intsave = signal(SIGINT, SIG_IGN); - quitsave = signal(SIGQUIT, SIG_IGN); - pid = waitpid(pid, &pstat, 0); - (void)sigsetmask(omask); - (void)signal(SIGINT, intsave); - (void)signal(SIGQUIT, quitsave); - i = (pid == -1) ? -1 : WEXITSTATUS(pstat); - if (isDebug()) - msgDebug("Command `%s' returns status of %d\n", cmd, i); - } - return i; -} - diff --git a/usr.sbin/sade/termcap.c b/usr.sbin/sade/termcap.c deleted file mode 100644 index 1c2f39b..0000000 --- a/usr.sbin/sade/termcap.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1994, Paul Richards. - * - * 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. - * - * $FreeBSD$ - */ - -#include "sade.h" -#include <stdarg.h> -#include <fcntl.h> -#include <sys/errno.h> -#include <sys/ioctl.h> -#include <sys/consio.h> - -#define VTY_STATUS_LINE 24 -#define TTY_STATUS_LINE 23 - -static void -prompt_term(char **termp) -{ - char str[80]; - - printf("\nPlease set your TERM variable before running this program.\n"); - printf("Defaulting to an ANSI compatible terminal - please press RETURN\n"); - fgets(str, sizeof(str), stdin); /* Just to make it interactive */ - *termp = (char *)"ansi"; -} - -int -set_termcap(void) -{ - char *term; - int stat; - struct winsize ws; - - term = getenv("TERM"); - stat = ioctl(STDERR_FILENO, GIO_COLOR, &ColorDisplay); - - if (isDebug()) - DebugFD = open("sade.debug", O_WRONLY|O_CREAT|O_TRUNC, 0644); - else - DebugFD = -1; - if (DebugFD < 0) - DebugFD = open("/dev/null", O_RDWR, 0); - - if (!OnVTY || (stat < 0)) { - if (!term) { - char *term; - - prompt_term(&term); - if (setenv("TERM", term, 1) < 0) - return -1; - } - if (DebugFD < 0) - DebugFD = open("/dev/null", O_RDWR, 0); - } - else { - int i, on; - - if (getpid() == 1) { - DebugFD = open("/dev/ttyv1", O_WRONLY); - if (DebugFD != -1) { - on = 1; - i = ioctl(DebugFD, TIOCCONS, (char *)&on); - msgDebug("ioctl(%d, TIOCCONS, NULL) = %d (%s)\n", - DebugFD, i, !i ? "success" : strerror(errno)); - } - } - -#ifdef PC98 - if (!term) { - if (setenv("TERM", "cons25w", 1) < 0) - return -1; - } -#else - if (ColorDisplay) { - if (!term) { - if (setenv("TERM", "xterm", 1) < 0) - return -1; - } - } - else { - if (!term) { - if (setenv("TERM", "vt100", 1) < 0) - return -1; - } - } -#endif - } - if (ioctl(0, TIOCGWINSZ, &ws) == -1) { - msgDebug("Unable to get terminal size - errno %d\n", errno); - ws.ws_row = 0; - } - StatusLine = ws.ws_row ? ws.ws_row - 1: (OnVTY ? VTY_STATUS_LINE : TTY_STATUS_LINE); - return 0; -} diff --git a/usr.sbin/sade/variable.c b/usr.sbin/sade/variable.c deleted file mode 100644 index ae3a6e0..0000000 --- a/usr.sbin/sade/variable.c +++ /dev/null @@ -1,324 +0,0 @@ -/* - * $FreeBSD$ - * - * Copyright (c) 1995 - * Jordan Hubbard. All rights reserved. - * Copyright (c) 2001 - * Murray Stokely. All rights reserved. - * - * 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, - * verbatim and that no modifications are made prior to this - * point in the file. - * 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. - * - * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. - * - */ - -#include "sade.h" - -/* Routines for dealing with variable lists */ - -static void -make_variable(char *var, char *value, int dirty) -{ - Variable *vp; - - /* Trim leading and trailing whitespace */ - var = string_skipwhite(string_prune(var)); - - if (!var || !*var) - return; - - - /* Now search to see if it's already in the list */ - for (vp = VarHead; vp; vp = vp->next) { - if (!strcmp(vp->name, var)) { - if (vp->dirty && !dirty) - return; - setenv(var, value, 1); - free(vp->value); - vp->value = strdup(value); - if (dirty != -1) - vp->dirty = dirty; - return; - } - } - - setenv(var, value, 1); - /* No? Create a new one */ - vp = (Variable *)safe_malloc(sizeof(Variable)); - vp->name = strdup(var); - vp->value = strdup(value); - if (dirty == -1) - dirty = 0; - vp->dirty = dirty; - vp->next = VarHead; - VarHead = vp; -} - -void -variable_set(char *var, int dirty) -{ - char tmp[1024], *cp; - - if (!var) - msgFatal("NULL variable name & value passed."); - else if (!*var) - msgDebug("Warning: Zero length name & value passed to variable_set()\n"); - SAFE_STRCPY(tmp, var); - if ((cp = strchr(tmp, '=')) == NULL) - msgFatal("Invalid variable format: %s", var); - *(cp++) = '\0'; - make_variable(tmp, string_skipwhite(cp), dirty); -} - -void -variable_set2(char *var, char *value, int dirty) -{ - if (!var || !value) - msgFatal("Null name or value passed to set_variable2(%s) = %s!", - var ? var : "", value ? value : ""); - else if (!*var || !*value) - msgDebug("Warning: Zero length name or value passed to variable_set2(%s) = %s\n", - var, value); - make_variable(var, value, dirty); -} - -char * -variable_get(char *var) -{ - return getenv(var); -} - -int -variable_cmp(char *var, char *value) -{ - char *val; - - if ((val = variable_get(var))) - return strcmp(val, value); - return -1; -} - -void -variable_unset(char *var) -{ - Variable *vp; - char name[512], *cp; - - if ((cp = strchr(var, '=')) != NULL) - sstrncpy(name, var, cp - var); - else - SAFE_STRCPY(name, var); - unsetenv(name); - /* Now search to see if it's in our list, if we have one.. */ - if (!VarHead) - return; - else if (!VarHead->next && !strcmp(VarHead->name, name)) { - safe_free(VarHead->name); - safe_free(VarHead->value); - free(VarHead); - VarHead = NULL; - } - else { - for (vp = VarHead; vp; vp = vp->next) { - if (!strcmp(vp->name, name)) { - Variable *save = vp->next; - - safe_free(vp->name); - safe_free(vp->value); - *vp = *save; - safe_free(save); - break; - } - } - } -} - -/* Prompt user for the name of a variable */ -char * -variable_get_value(char *var, char *prompt, int dirty) -{ - char *cp; - - cp = variable_get(var); - if (cp && variable_get(VAR_NONINTERACTIVE)) - return cp; - else if ((cp = msgGetInput(cp, "%s", prompt)) != NULL) - variable_set2(var, cp, dirty); - else - cp = NULL; - return cp; -} - -/* Check if value passed in data (in the form "variable=value") is - * valid, and it's status compared to the value of variable stored in - * env - * - * Possible return values : - * -3: Invalid line, the data string is NOT set as an env variable - * -2: Invalid line, the data string is set as an env variable - * -1: Invalid line - * 0: Valid line, is NOT equal to env version - * 1: Valid line, is equal to env version - * 2: Valid line, value empty - e.g. foo="" - * 3: Valid line, does not exist in env -*/ -int -variable_check2(char *data) -{ - char *cp, *cp2, *cp3, tmp[256]; - - if (data == NULL) - return -1; - SAFE_STRCPY(tmp, data); - if ((cp = strchr(tmp, '=')) != NULL) { - *(cp++) = '\0'; - if (*cp == '"') { /* smash quotes if present */ - ++cp; - if ((cp3 = strchr(cp, '"')) != NULL) - *cp3 = '\0'; - } - else if ((cp3 = strchr(cp, ',')) != NULL) - *cp3 = '\0'; - cp2 = variable_get(tmp); - if (cp2 != NULL) { - if (*cp == '\0') - return 2; - else - return strcmp(cp, cp2) == 0 ? 1 : 0; - } - else - return 3; - } - else - return variable_get(tmp) != NULL ? -2 : -3; -} - -/* Check if the value passed in data (in the form "variable=value") is - equal to the value of variable stored in env */ -int -variable_check(char *data) -{ - int ret; - ret = variable_check2(data); - - switch(ret) { - case -2: - case 1: - case 2: - return TRUE; - /* NOT REACHED */ - default: - return FALSE; - } -} - -int -dump_variables(dialogMenuItem *unused) -{ - FILE *fp; - Variable *vp; - - if (isDebug()) - msgDebug("Writing %s variables to file..\n", ProgName); - - fp = fopen("/etc/sade.vars", "w"); - if (!fp) { - msgConfirm("Unable to write to /etc/%s.vars: %s", - ProgName, strerror(errno)); - return DITEM_FAILURE; - } - - for (vp = VarHead; vp; vp = vp->next) - fprintf(fp, "%s=\"%s\" (%d)\n", vp->name, vp->value, vp->dirty); - - fclose(fp); - - return DITEM_SUCCESS; -} - -/* Free all of the variables, useful to really start over as when the - user selects "restart" from the interrupt menu. */ -void -free_variables(void) -{ - Variable *vp; - - /* Free the variables from our list, if we have one.. */ - if (!VarHead) - return; - else if (!VarHead->next) { - unsetenv(VarHead->name); - safe_free(VarHead->name); - safe_free(VarHead->value); - free(VarHead); - VarHead = NULL; - } - else { - for (vp = VarHead; vp; ) { - Variable *save = vp; - unsetenv(vp->name); - safe_free(vp->name); - safe_free(vp->value); - vp = vp->next; - safe_free(save); - } - VarHead = NULL; - } -} - -/* - * Persistent variables. The variables modified by these functions - * are not cleared between invocations of sysinstall. This is useful - * to allow the user to completely restart sysinstall, without having - * it load all of the modules again from the installation media which - * are still in memory. - */ - -void -pvariable_set(char *var) -{ - char *p; - char tmp[1024]; - - if (!var) - msgFatal("NULL variable name & value passed."); - else if (!*var) - msgDebug("Warning: Zero length name & value passed to variable_set()\n"); - /* Add a trivial namespace to whatever name the caller chooses. */ - SAFE_STRCPY(tmp, "SYSINSTALL_PVAR"); - if (strchr(var, '=') == NULL) - msgFatal("Invalid variable format: %s", var); - strlcat(tmp, var, 1024); - p = strchr(tmp, '='); - *p = '\0'; - setenv(tmp, p + 1, 1); -} - -char * -pvariable_get(char *var) -{ - char tmp[1024]; - - SAFE_STRCPY(tmp, "SYSINSTALL_PVAR"); - strlcat(tmp, var, 1024); - return getenv(tmp); -} diff --git a/usr.sbin/sade/wizard.c b/usr.sbin/sade/wizard.c deleted file mode 100644 index 5edd872..0000000 --- a/usr.sbin/sade/wizard.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - * - * $FreeBSD$ - */ - -#include "sade.h" -#include <fcntl.h> -#include <err.h> -#include <libdisk.h> - -static int -scan_block(int fd, daddr_t block) -{ - u_char foo[512]; - - if (-1 == lseek(fd,block * 512,SEEK_SET)) - err(1,"lseek"); - if (512 != read(fd,foo, 512)) - return 1; - return 0; -} - -static void -Scan_Disk(Disk *d) -{ - char device[64]; - u_long l; - int i,j,fd; - - strcpy(device,"/dev/"); - strcat(device,d->name); - - fd = open(device,O_RDWR); - if (fd < 0) { - msgWarn("open(%s) failed", device); - return; - } - for(i=-1,l=0;;l++) { - j = scan_block(fd,l); - if (j != i) { - if (i == -1) { - printf("%c: %lu.",j ? 'B' : 'G', l); - fflush(stdout); - } else if (i == 0) { - printf(".%lu\nB: %lu.",l-1,l); - fflush(stdout); - } else { - printf(".%lu\nG: %lu.",l-1,l); - fflush(stdout); - } - i = j; - } - } - close(fd); -} - -void -slice_wizard(Disk *d) -{ - Disk *db; - char myprompt[BUFSIZ]; - char input[BUFSIZ]; - char *p,*q=0; - char **cp,*cmds[200]; - int ncmd,i; - - systemSuspendDialog(); - sprintf(myprompt,"%s> ", d->name); - while(1) { - printf("--==##==--\n"); - Debug_Disk(d); - p = CheckRules(d); - if (p) { - printf("%s",p); - free(p); - } - printf("%s", myprompt); - fflush(stdout); - q = p = fgets(input,sizeof(input),stdin); - if(!p) - break; - for(cp = cmds; (*cp = strsep(&p, " \t\n")) != NULL;) - if (**cp != '\0') - cp++; - ncmd = cp - cmds; - if(!ncmd) - continue; - if (!strcasecmp(*cmds,"quit")) { break; } - if (!strcasecmp(*cmds,"exit")) { break; } - if (!strcasecmp(*cmds,"q")) { break; } - if (!strcasecmp(*cmds,"x")) { break; } - if (!strcasecmp(*cmds,"delete") && ncmd == 2) { - printf("delete = %d\n", - Delete_Chunk(d, - (struct chunk *)strtol(cmds[1],0,0))); - continue; - } - if (!strcasecmp(*cmds,"allfreebsd")) { - All_FreeBSD(d, 0); - continue; - } - if (!strcasecmp(*cmds,"dedicate")) { - All_FreeBSD(d, 1); - continue; - } - if (!strcasecmp(*cmds,"bios") && ncmd == 4) { - Set_Bios_Geom(d, - strtol(cmds[1],0,0), - strtol(cmds[2],0,0), - strtol(cmds[3],0,0)); - continue; - } - if (!strcasecmp(*cmds,"list")) { - cp = Disk_Names(); - printf("Disks:"); - for(i=0;cp[i];i++) { - printf(" %s",cp[i]); - free(cp[i]); - } - free(cp); - continue; - } -#ifdef PC98 - if (!strcasecmp(*cmds,"create") && ncmd == 7) { - printf("Create=%d\n", - Create_Chunk(d, - strtol(cmds[1],0,0), - strtol(cmds[2],0,0), - strtol(cmds[3],0,0), - strtol(cmds[4],0,0), - strtol(cmds[5],0,0), - cmds[6])); - continue; - } -#else - if (!strcasecmp(*cmds,"create") && ncmd == 6) { - printf("Create=%d\n", - Create_Chunk(d, - strtol(cmds[1],0,0), - strtol(cmds[2],0,0), - strtol(cmds[3],0,0), - strtol(cmds[4],0,0), - strtol(cmds[5],0,0), "")); - continue; - } -#endif - if (!strcasecmp(*cmds,"read")) { - db = d; - if (ncmd > 1) - d = Open_Disk(cmds[1]); - else - d = Open_Disk(d->name); - if (d) - Free_Disk(db); - else - d = db; - continue; - } - if (!strcasecmp(*cmds,"scan")) { - Scan_Disk(d); - continue; - } - if (!strcasecmp(*cmds,"write")) { - printf("Write=%d\n", - Fake ? 0 : Write_Disk(d)); - q = strdup(d->name); - Free_Disk(d); - d = Open_Disk(q); - continue; - } - if (strcasecmp(*cmds,"help")) - printf("\007ERROR\n"); - printf("CMDS:\n"); - printf("allfreebsd\t\t"); - printf("dedicate\t\t"); - printf("bios cyl hd sect\n"); - printf("collapse [pointer]\t\t"); -#ifdef PC98 - printf("create offset size enum subtype flags name\n"); -#else - printf("create offset size enum subtype flags\n"); -#endif - printf("subtype(part): swap=1, ffs=7\t\t"); - printf("delete pointer\n"); - printf("list\t\t"); - printf("quit\n"); - printf("read [disk]\t\t"); - printf("scan\n"); - printf("write\t\t"); - printf("\n"); - - } - systemResumeDialog(); -} |