svn commit: r221414 - in projects/pf/pf45: contrib/dialog contrib/dialog/po contrib/dialog/samples etc/periodic/daily etc/rc.d lib/libc/sys lib/libcrypt lib/libedit lib/libmd share/examples/kld/fir...

Bjoern A. Zeeb bz at FreeBSD.org
Wed May 4 00:43:06 UTC 2011


Author: bz
Date: Wed May  4 00:43:06 2011
New Revision: 221414
URL: http://svn.freebsd.org/changeset/base/221414

Log:
  Cleanup some of the previously merged but not really tracked files to
  reduce diffs to head.  Reflect properties from head on the (locally)
  added files.

Added:
  projects/pf/pf45/contrib/dialog/argv.c
  projects/pf/pf45/contrib/dialog/po/sl.po
  projects/pf/pf45/contrib/dialog/prgbox.c
  projects/pf/pf45/contrib/dialog/rename.sh   (contents, props changed)
  projects/pf/pf45/contrib/dialog/samples/msgbox-utf8   (contents, props changed)
  projects/pf/pf45/contrib/dialog/samples/pause-both   (contents, props changed)
  projects/pf/pf45/contrib/dialog/samples/pause-extra   (contents, props changed)
  projects/pf/pf45/contrib/dialog/samples/prgbox   (contents, props changed)
  projects/pf/pf45/contrib/dialog/samples/prgbox2   (contents, props changed)
  projects/pf/pf45/contrib/dialog/samples/programbox   (contents, props changed)
  projects/pf/pf45/contrib/dialog/samples/programbox2   (contents, props changed)
  projects/pf/pf45/contrib/dialog/samples/shortlist   (contents, props changed)
  projects/pf/pf45/contrib/dialog/samples/textbox-both   (contents, props changed)
  projects/pf/pf45/contrib/dialog/samples/textbox-help   (contents, props changed)
  projects/pf/pf45/etc/periodic/daily/220.backup-pkgdb   (contents, props changed)
  projects/pf/pf45/etc/rc.d/rctl   (contents, props changed)
  projects/pf/pf45/lib/libc/sys/posix_fallocate.2   (contents, props changed)
  projects/pf/pf45/lib/libcrypt/crypt-sha256.c   (contents, props changed)
  projects/pf/pf45/lib/libcrypt/crypt-sha512.c   (contents, props changed)
  projects/pf/pf45/lib/libedit/chartype.h   (contents, props changed)
  projects/pf/pf45/lib/libedit/histedit.h   (contents, props changed)
  projects/pf/pf45/lib/libedit/readline.c   (contents, props changed)
  projects/pf/pf45/lib/libmd/sha512.3   (contents, props changed)
  projects/pf/pf45/lib/libmd/sha512.h   (contents, props changed)
  projects/pf/pf45/lib/libmd/sha512c.c   (contents, props changed)
  projects/pf/pf45/share/examples/kld/firmware/fwimage/firmware.img.uu   (contents, props changed)
  projects/pf/pf45/share/man/man4/nvram2env.4   (contents, props changed)
  projects/pf/pf45/share/man/man5/rctl.conf.5   (contents, props changed)
  projects/pf/pf45/sys/arm/mv/orion/files.ts7800   (contents, props changed)
  projects/pf/pf45/sys/arm/mv/orion/std.ts7800   (contents, props changed)
  projects/pf/pf45/sys/boot/fdt/dts/ts7800.dts   (contents, props changed)
  projects/pf/pf45/sys/kern/kern_racct.c   (contents, props changed)
  projects/pf/pf45/sys/kern/kern_rctl.c   (contents, props changed)
  projects/pf/pf45/tools/regression/bin/sh/builtins/case4.0   (contents, props changed)
  projects/pf/pf45/tools/regression/bin/sh/execution/fork3.0   (contents, props changed)
  projects/pf/pf45/tools/regression/bin/sh/execution/redir6.0   (contents, props changed)
  projects/pf/pf45/tools/regression/bin/sh/execution/redir7.0   (contents, props changed)
  projects/pf/pf45/tools/regression/bin/sh/expansion/length4.0   (contents, props changed)
  projects/pf/pf45/tools/regression/bin/sh/expansion/length5.0   (contents, props changed)
  projects/pf/pf45/tools/regression/bin/sh/expansion/length6.0   (contents, props changed)
  projects/pf/pf45/usr.sbin/bsdinstall/scripts/mirrorselect   (contents, props changed)

Added: projects/pf/pf45/contrib/dialog/argv.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/argv.c	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,128 @@
+/*
+ * $Id: argv.c,v 1.1 2011/03/02 09:56:39 tom Exp $
+ *
+ *  argv - Reusable functions for argv-parsing.
+ *
+ *  Copyright 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
+ *  as published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to
+ *	Free Software Foundation, Inc.
+ *	51 Franklin St., Fifth Floor
+ *	Boston, MA 02110, USA.
+ */
+
+#include <dialog.h>
+#include <string.h>
+
+/*
+ * Convert a string to an argv[], returning a char** index (which must be
+ * freed by the caller).  The string is modified (replacing gaps between
+ * tokens with nulls).
+ */
+char **
+dlg_string_to_argv(char *blob)
+{
+    size_t n;
+    int pass;
+    size_t length = strlen(blob);
+    char **result = 0;
+
+    for (pass = 0; pass < 2; ++pass) {
+	bool inparm = FALSE;
+	bool quoted = FALSE;
+	char *param = blob;
+	size_t count = 0;
+
+	for (n = 0; n < length; ++n) {
+	    if (quoted && blob[n] == '"') {
+		quoted = FALSE;
+	    } else if (blob[n] == '"') {
+		quoted = TRUE;
+		if (!inparm) {
+		    if (pass)
+			result[count] = param;
+		    ++count;
+		    inparm = TRUE;
+		}
+	    } else if (blob[n] == '\\') {
+		if (quoted && !isspace(UCH(blob[n + 1]))) {
+		    if (!inparm) {
+			if (pass)
+			    result[count] = param;
+			++count;
+			inparm = TRUE;
+		    }
+		    if (pass) {
+			*param++ = blob[n];
+			*param++ = blob[n + 1];
+		    }
+		}
+		++n;
+	    } else if (!quoted && isspace(UCH(blob[n]))) {
+		inparm = FALSE;
+		if (pass) {
+		    *param++ = '\0';
+		}
+	    } else {
+		if (!inparm) {
+		    if (pass)
+			result[count] = param;
+		    ++count;
+		    inparm = TRUE;
+		}
+		if (pass) {
+		    *param++ = blob[n];
+		}
+	    }
+	}
+
+	if (!pass) {
+	    if (count) {
+		result = dlg_calloc(char *, count + 1);
+		assert_ptr(result, "string_to_argv");
+	    } else {
+		break;		/* no tokens found */
+	    }
+	} else {
+	    *param = '\0';
+	}
+    }
+    return result;
+}
+
+/*
+ * Count the entries in an argv list.
+ */
+int
+dlg_count_argv(char **argv)
+{
+    int result = 0;
+
+    if (argv != 0) {
+	while (argv[result] != 0)
+	    ++result;
+    }
+    return result;
+}
+
+int
+dlg_eat_argv(int *argcp, char ***argvp, int start, int count)
+{
+    int k;
+
+    *argcp -= count;
+    for (k = start; k <= *argcp; k++)
+	(*argvp)[k] = (*argvp)[k + count];
+    (*argvp)[*argcp] = 0;
+    return TRUE;
+}

Added: projects/pf/pf45/contrib/dialog/po/sl.po
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/po/sl.po	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,112 @@
+# Slovenian translation for dialog.
+# Copyright (C) 2003-2007, 2008 Thomas Dickey
+# This file is distributed under the same license as the dialog package.
+# Klemen Košir <klemen.kosir at gmx.com>, 2011.
+msgid ""
+msgstr ""
+"Project-Id-Version: dialog 1.1.20080819\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-06-18 18:26-0400\n"
+"PO-Revision-Date: 2011-02-12 20:17+0100\n"
+"Last-Translator: Klemen Košir <klemen.kosir at gmx.com>\n"
+"Language-Team: Slovenian <translation-team-sl at lists.sourceforge.net>\n"
+"Language: sl\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: Slovenian\n"
+"X-Poedit-Country: SLOVENIA\n"
+
+#: buttons.c:385
+msgid "Yes"
+msgstr "Da"
+
+#: buttons.c:393
+msgid "No"
+msgstr "Ne"
+
+#: buttons.c:401
+msgid "OK"
+msgstr "V redu"
+
+#: buttons.c:409
+msgid "Cancel"
+msgstr "Prekliči"
+
+#: buttons.c:417
+msgid "EXIT"
+msgstr "IZHOD"
+
+#: buttons.c:425
+msgid "Extra"
+msgstr "Dodatno"
+
+#: buttons.c:433
+msgid "Help"
+msgstr "Pomoč"
+
+#. Headline "Month"
+#: calendar.c:273
+msgid "Month"
+msgstr "Mesec"
+
+#. Headline "Year"
+#: calendar.c:293
+msgid "Year"
+msgstr "Leto"
+
+#: dialog.c:741
+msgid "Rename"
+msgstr "Preimenuj"
+
+#: fselect.c:550
+msgid "Directories"
+msgstr "Imeniki"
+
+#: fselect.c:551
+msgid "Files"
+msgstr "Datoteke"
+
+#: mixedgauge.c:58
+msgid "Succeeded"
+msgstr "Uspelo"
+
+#: mixedgauge.c:61
+msgid "Failed"
+msgstr "Spodletelo"
+
+#: mixedgauge.c:64
+msgid "Passed"
+msgstr "Prestalo"
+
+#: mixedgauge.c:67
+msgid "Completed"
+msgstr "Končano"
+
+#: mixedgauge.c:70
+msgid "Checked"
+msgstr "Preverjeno"
+
+#: mixedgauge.c:73
+msgid "Done"
+msgstr "Opravljeno"
+
+#: mixedgauge.c:76
+msgid "Skipped"
+msgstr "Preskočeno"
+
+#: mixedgauge.c:79
+msgid "In Progress"
+msgstr "V teku"
+
+#: mixedgauge.c:85
+msgid "N/A"
+msgstr "N/A"
+
+#: mixedgauge.c:193
+msgid "Overall Progress"
+msgstr "Skupni napredek"
+
+#: textbox.c:489
+msgid "Search"
+msgstr "Iskanje"

Added: projects/pf/pf45/contrib/dialog/prgbox.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/prgbox.c	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,110 @@
+/*
+ *  $Id: prgbox.c,v 1.6 2011/03/02 09:59:26 tom Exp $
+ *
+ *  prgbox.c -- implements the prg box
+ *
+ *  Copyright 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 as
+ *  published by the Free Software Foundation; either version 2.1 of the
+ *  License, or (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this program; if not, write to
+ *	Free Software Foundation, Inc.
+ *	51 Franklin St., Fifth Floor
+ *	Boston, MA 02110, USA.
+ */
+
+#include <dialog.h>
+
+/*
+ * Open a pipe which ties stderr and stdout together.
+ */
+static FILE *
+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 (pid = fork()) {
+	case -1:		/* Error. */
+	    (void) close(fd[0]);
+	    (void) close(fd[1]);
+	    break;
+	case 0:		/* child. */
+	    if (*type == 'r') {
+		if (fd[1] != STDOUT_FILENO) {
+		    (void) dup2(fd[1], STDOUT_FILENO);
+		    (void) close(fd[1]);
+		}
+		(void) dup2(STDOUT_FILENO, STDERR_FILENO);
+		(void) close(fd[0]);
+	    } else {
+		if (fd[0] != STDIN_FILENO) {
+		    (void) dup2(fd[0], STDIN_FILENO);
+		    (void) close(fd[0]);
+		}
+		(void) close(fd[1]);
+		(void) close(STDERR_FILENO);
+	    }
+	    /*
+	     * Bourne shell needs "-c" option to force it to use only the
+	     * given command.  Also, it needs the command to be parsed into
+	     * tokens.
+	     */
+	    argv[0] = "sh";
+	    argv[1] = "-c";
+	    argv[2] = command;
+	    argv[3] = NULL;
+	    execvp("sh", (char **)argv);
+	    _exit(127);
+	    /* NOTREACHED */
+	default:		/* parent */
+	    if (*type == 'r') {
+		result = fdopen(fd[0], type);
+		(void) close(fd[1]);
+	    } else {
+		result = fdopen(fd[1], type);
+		(void) close(fd[0]);
+	    }
+	    break;
+	}
+    }
+
+    return result;
+}
+
+/*
+ * Display text from a pipe in a scrolling window.
+ */
+int
+dialog_prgbox(const char *title,
+	      const char *cprompt,
+	      const char *command,
+	      int height,
+	      int width,
+	      int pauseopt)
+{
+    int code;
+    FILE *fp;
+
+    fp = dlg_popen(command, "r");
+    if (fp == NULL)
+	dlg_exiterr("pipe open failed: %s", command);
+
+    code = dlg_progressbox(title, cprompt, height, width, pauseopt, fp);
+
+    pclose(fp);
+
+    return code;
+}

Added: projects/pf/pf45/contrib/dialog/rename.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/rename.sh	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,59 @@
+#! /bin/sh
+# $Id: rename.sh,v 1.3 2011/01/06 10:51:02 tom Exp $
+##############################################################################
+# Copyright (c) 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"), #
+# to deal in the Software without restriction, including without limitation  #
+# the rights to use, copy, modify, merge, publish, distribute, distribute    #
+# with modifications, sublicense, and/or sell copies of the Software, and to #
+# permit persons to whom the Software is furnished to do so, subject to the  #
+# following conditions:                                                      #
+#                                                                            #
+# The above copyright notice and this permission notice shall be included in #
+# all copies or substantial portions of the Software.                        #
+#                                                                            #
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
+# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
+# DEALINGS IN THE SOFTWARE.                                                  #
+#                                                                            #
+# Except as contained in this notice, the name(s) of the above copyright     #
+# holders shall not be used in advertising or otherwise to promote the sale, #
+# use or other dealings in this Software without prior written               #
+# authorization.                                                             #
+##############################################################################
+# install-helper for dialog's manpages, e.g., as "cdialog".
+#
+# $1 = input file
+# $2 = output file
+# $3 = actual program name that dialog is installed as
+# $4 = actual name that header/library are installed as
+# $5+ = install program and possible options
+
+LANG=C;     export LANG
+LC_ALL=C;   export LC_ALL
+LC_CTYPE=C; export LC_CTYPE
+LANGUAGE=C; export LANGUAGE
+
+SOURCE=$1; shift
+TARGET=$1; shift
+BINARY=$1; shift
+PACKAGE=$1; shift
+
+CHR_LEAD=`echo "$BINARY" | sed -e 's/^\(.\).*/\1/'`
+CHR_TAIL=`echo "$BINARY" | sed -e 's/^.//'`
+ONE_CAPS=`echo $CHR_LEAD | tr '[a-z]' '[A-Z]'`$CHR_TAIL
+ALL_CAPS=`echo "$BINARY" | tr '[a-z]' '[A-Z]'`
+
+sed	-e "s,^\.ds p dialog\>,.ds p $BINARY," \
+	-e "s,^\.ds l dialog\>,.ds l $PACKAGE," \
+	-e "s,^\.ds L Dialog\>,.ds L $ONE_CAPS," \
+	-e "s,^\.ds D DIALOG\>,.ds D $ALL_CAPS," \
+	<$SOURCE >source.tmp
+"$@" source.tmp $TARGET
+rm -f source.tmp

Added: projects/pf/pf45/contrib/dialog/samples/msgbox-utf8
==============================================================================
Binary file. No diff available.

Added: projects/pf/pf45/contrib/dialog/samples/pause-both
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/samples/pause-both	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,14 @@
+#!/bin/sh
+# $Id: pause-both,v 1.1 2011/01/18 09:49:24 tom Exp $
+
+. ./setup-vars
+
+$DIALOG --title "PAUSE" \
+	--help-button \
+	--extra-button "$@" \
+	--pause "Hi, this is a pause widget" 20 70 10
+
+retval=$?
+echo return $retval
+
+. ./report-button

Added: projects/pf/pf45/contrib/dialog/samples/pause-extra
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/samples/pause-extra	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,13 @@
+#!/bin/sh
+# $Id: pause-extra,v 1.1 2011/01/18 09:49:07 tom Exp $
+
+. ./setup-vars
+
+$DIALOG --title "PAUSE" \
+	--extra-button "$@" \
+	--pause "Hi, this is a pause widget" 20 70 10
+
+retval=$?
+echo return $retval
+
+. ./report-button

Added: projects/pf/pf45/contrib/dialog/samples/prgbox
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/samples/prgbox	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $Id: prgbox,v 1.1 2011/03/02 00:10:54 tom Exp $
+
+. ./setup-vars
+
+$DIALOG --title "PRGBOX" "$@" --prgbox "./shortlist" 20 70

Added: projects/pf/pf45/contrib/dialog/samples/prgbox2
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/samples/prgbox2	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $Id: prgbox2,v 1.1 2011/03/02 01:25:54 tom Exp $
+
+. ./setup-vars
+
+$DIALOG --title "PRGBOX" "$@" --prgbox "./shortlist 3" 20 70

Added: projects/pf/pf45/contrib/dialog/samples/programbox
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/samples/programbox	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,19 @@
+#!/bin/sh
+# $Id: programbox,v 1.1 2011/03/02 01:17:28 tom Exp $
+
+. ./setup-vars
+
+. ./setup-tempfile
+
+ls -1 >$tempfile
+(
+while true
+do
+read text
+test -z "$text" && break
+ls -ld "$text"
+sleep 0.1
+done <$tempfile
+) |
+
+$DIALOG --title "PROGRAMBOX" "$@" --programbox 20 70

Added: projects/pf/pf45/contrib/dialog/samples/programbox2
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/samples/programbox2	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,19 @@
+#!/bin/sh
+# $Id: programbox2,v 1.1 2011/03/02 01:25:31 tom Exp $
+
+. ./setup-vars
+
+. ./setup-tempfile
+
+ls -1 >$tempfile
+(
+while true
+do
+read text
+test -z "$text" && break
+ls -ld "$text"
+sleep 0.1
+done <$tempfile
+) |
+
+$DIALOG --title "PROGRAMBOX" "$@" --programbox "ProgramBox" 20 70

Added: projects/pf/pf45/contrib/dialog/samples/shortlist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/samples/shortlist	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,19 @@
+#!/bin/sh
+# $Id: shortlist,v 1.2 2011/03/02 00:11:50 tom Exp $
+# make a short listing, which writes to both stdout and stderr.
+
+if test $# != 0
+then
+	count=$1
+else
+	count=10
+fi
+
+while test $count != 0
+do
+	echo "** $count -- `date`"
+	w >&2
+	sleep 1
+	count=`expr $count - 1 2>/dev/null`
+	test -z "$count" && count=0
+done

Added: projects/pf/pf45/contrib/dialog/samples/textbox-both
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/samples/textbox-both	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,21 @@
+#!/bin/sh
+# $Id: textbox-both,v 1.1 2011/01/18 09:59:47 tom Exp $
+
+. ./setup-vars
+
+. ./setup-tempfile
+
+TEXT=/usr/share/common-licenses/GPL
+test -f $TEXT || TEXT=../COPYING
+
+cat textbox.txt | expand > $tempfile
+cat $TEXT | expand >> $tempfile
+
+$DIALOG --clear --title "TEXT BOX" \
+	--help-button \
+	--extra-button "$@" \
+	--textbox "$tempfile" 22 77
+
+retval=$?
+
+. ./report-button

Added: projects/pf/pf45/contrib/dialog/samples/textbox-help
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/contrib/dialog/samples/textbox-help	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,20 @@
+#!/bin/sh
+# $Id: textbox-help,v 1.1 2011/01/18 09:59:20 tom Exp $
+
+. ./setup-vars
+
+. ./setup-tempfile
+
+TEXT=/usr/share/common-licenses/GPL
+test -f $TEXT || TEXT=../COPYING
+
+cat textbox.txt | expand > $tempfile
+cat $TEXT | expand >> $tempfile
+
+$DIALOG --clear --title "TEXT BOX" \
+	--help-button "$@" \
+	--textbox "$tempfile" 22 77
+
+retval=$?
+
+. ./report-button

Added: projects/pf/pf45/etc/periodic/daily/220.backup-pkgdb
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/etc/periodic/daily/220.backup-pkgdb	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/periodic.conf ]
+then
+    . /etc/defaults/periodic.conf
+    source_periodic_confs
+fi
+
+rc=0
+
+case "$daily_backup_pkgdb_enable" in
+    [Yy][Ee][Ss])
+	bak="${daily_backup_pkgdb_dir:-/var/backups}"
+	bak_file="${bak}/pkgdb.bak.tbz"
+
+	pkg_dbdir=`make -f/usr/share/mk/bsd.port.mk -V PKG_DBDIR 2>/dev/null`
+
+	if [ ! -d "$bak" ]
+	then
+	    install -d -o root -g wheel -m 750 $bak || {
+		echo '$daily_backup_pkgdb_enable is enabled but' \
+		    "$daily_backup_pkgdb_dbdir doesn't exist" ;
+		exit 2 ; }
+	fi
+
+	echo ''
+	echo 'Backing up package db directory:'
+
+	new_bak_file=`mktemp ${bak_file}-XXXXX`
+
+	if tar -cjf "${new_bak_file}" "$pkg_dbdir"; then
+	    chmod 644 "${new_bak_file}"
+
+	    if [ -e "${bak_file}.2" -a -e "${bak_file}" ]; then
+		unlink "${bak_file}.2"
+		mv "${bak_file}" "${bak_file}.2"
+	    fi
+	    [ -e "${bak_file}" ] && mv "${bak_file}" "${bak_file}.2"
+	    mv "${new_bak_file}" "${bak_file}"
+	else
+	    rc=3
+	fi ;;
+esac
+
+exit $rc

Added: projects/pf/pf45/etc/rc.d/rctl
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/etc/rc.d/rctl	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: rctl
+# BEFORE: LOGIN
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="rctl"
+start_cmd="rctl_start"
+stop_cmd="rctl_stop"
+
+rctl_start()
+{
+	if [ -f /etc/rctl.conf ]; then
+		while read var comments
+		do
+			case ${var} in
+			\#*|'')
+				;;
+			*)
+				rctl -a "${var}"
+				;;
+			esac
+		done < /etc/rctl.conf
+	fi
+}
+
+rctl_stop()
+{
+
+	rctl -r :
+}
+
+load_rc_config $name
+run_rc_command "$1"

Added: projects/pf/pf45/lib/libc/sys/posix_fallocate.2
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/lib/libc/sys/posix_fallocate.2	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,146 @@
+.\" Copyright (c) 1980, 1991, 1993
+.\"	The Regents of the University of California.  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.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"     @(#)open.2	8.2 (Berkeley) 11/16/93
+.\" $FreeBSD$
+.\"
+.Dd April 13, 2011
+.Dt POSIX_FALLOCATE 2
+.Os
+.Sh NAME
+.Nm posix_fallocate
+.Nd pre-allocate storage for a range in a file
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In fcntl.h
+.Ft int
+.Fn posix_fallocate "int fd" "off_t offset" "off_t len"
+.Sh DESCRIPTION
+Required storage for the range
+.Fa offset
+to
+.Fa offset +
+.Fa len
+in the file referenced by
+.Fa fd
+is guarateed to be allocated upon successful return.
+That is, if
+.Fn posix_fallocate
+returns successfully, subsequent writes to the specified file data
+will not fail due to lack of free space on the file system storage
+media.
+Any existing file data in the specified range is unmodified.
+If
+.Fa offset +
+.Fa len
+is beyond the current file size, then
+.Fn posix_fallocate
+will adjust the file size to
+.Fa offset +
+.Fa len .
+Otherwise, the file size will not be changed.
+.Pp
+Space allocated by
+.Fn posix_fallocate
+will be freed by a successful call to
+.Xr creat 2
+or
+.Xr open 2
+that truncates the size of the file.
+Space allocated via
+.Fn posix_fallocate
+may be freed by a successful call to
+.Xr ftruncate 2
+that reduces the file size to a size smaller than
+.Fa offset +
+.Fa len .
+.Pp
+.Sh RETURN VALUES
+If successful,
+.Fn posix_fallocate
+returns zero.
+It returns -1 on failure, and sets
+.Va errno
+to indicate the error.
+.Sh ERRORS
+Possible failure conditions:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa fd
+argument is not a valid file descriptor.
+.It Bq Er EBADF
+The
+.Fa fd
+argument references a file that was opened without write permission.
+.It Bq Er EFBIG
+The value of
+.Fa offset +
+.Fa len
+is greater than the maximum file size.
+.It Bq Er EINTR
+A signal was caught during execution.
+.It Bq Er EINVAL
+The
+.Fa len
+argument was zero or the
+.Fa offset
+argument was less than zero.
+.It Bq Er EIO
+An I/O error occurred while reading from or writing to a file system.
+.It Bq Er ENODEV
+The
+.Fa fd
+argument does not refer to a regular file.
+.It Bq Er ENOSPC
+There is insufficient free space remaining on the file system storage
+media.
+.It Bq Er ESPIPE
+The
+.Fa fd
+argument is associated with a pipe or FIFO.
+.El
+.Sh SEE ALSO
+.Xr creat 2 ,
+.Xr ftruncate 2 ,
+.Xr open 2 ,
+.Xr unlink 2
+.Sh STANDARDS
+The
+.Fn posix_fallocate
+system call conforms to
+.St -p1003.1-2004 .
+.Sh HISTORY
+The
+.Fn posix_fallocate
+function appeared in
+.Fx 9.0 .
+.Sh AUTHORS
+.Fn posix_fallocate
+and this manual page were initially written by
+.An Matthew Fleming Aq mdf at FreeBSD.org .

Added: projects/pf/pf45/lib/libcrypt/crypt-sha256.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/pf/pf45/lib/libcrypt/crypt-sha256.c	Wed May  4 00:43:06 2011	(r221414)
@@ -0,0 +1,477 @@
+/*
+ * Copyright (c) 2011 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
+ * 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.
+ */
+
+/* Based on:
+ * SHA256-based Unix crypt implementation. Released into the Public Domain by
+ * Ulrich Drepper <drepper at redhat.com>. */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/endian.h>
+#include <sys/param.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <sha256.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "crypt.h"
+
+/* Define our magic string to mark salt for SHA256 "encryption" replacement. */
+static const char sha256_salt_prefix[] = "$5$";
+
+/* Prefix for optional rounds specification. */
+static const char sha256_rounds_prefix[] = "rounds=";
+
+/* Maximum salt string length. */
+#define SALT_LEN_MAX 16
+/* Default number of rounds if not explicitly specified. */
+#define ROUNDS_DEFAULT 5000
+/* Minimum number of rounds. */
+#define ROUNDS_MIN 1000
+/* Maximum number of rounds. */
+#define ROUNDS_MAX 999999999
+
+static char *
+sha256_crypt_r(const char *key, const char *salt, char *buffer, int buflen)
+{
+	u_long srounds;
+	int n;
+	uint8_t alt_result[32], temp_result[32];
+	SHA256_CTX ctx, alt_ctx;
+	size_t salt_len, key_len, cnt, rounds;
+	char *cp, *copied_key, *copied_salt, *p_bytes, *s_bytes, *endp;
+	const char *num;
+	bool rounds_custom;
+
+	copied_key = NULL;
+	copied_salt = NULL;
+
+	/* Default number of rounds. */
+	rounds = ROUNDS_DEFAULT;
+	rounds_custom = false;
+
+	/* Find beginning of salt string. The prefix should normally always
+	 * be present. Just in case it is not. */
+	if (strncmp(sha256_salt_prefix, salt, sizeof(sha256_salt_prefix) - 1) == 0)
+		/* Skip salt prefix. */
+		salt += sizeof(sha256_salt_prefix) - 1;
+
+	if (strncmp(salt, sha256_rounds_prefix, sizeof(sha256_rounds_prefix) - 1)
+	    == 0) {
+		num = salt + sizeof(sha256_rounds_prefix) - 1;
+		srounds = strtoul(num, &endp, 10);
+
+		if (*endp == '$') {
+			salt = endp + 1;
+			rounds = MAX(ROUNDS_MIN, MIN(srounds, ROUNDS_MAX));
+			rounds_custom = true;
+		}
+	}
+
+	salt_len = MIN(strcspn(salt, "$"), SALT_LEN_MAX);
+	key_len = strlen(key);
+
+	/* Prepare for the real work. */
+	SHA256_Init(&ctx);
+
+	/* Add the key string. */
+	SHA256_Update(&ctx, key, key_len);
+
+	/* The last part is the salt string. This must be at most 8
+	 * characters and it ends at the first `$' character (for
+	 * compatibility with existing implementations). */
+	SHA256_Update(&ctx, salt, salt_len);
+
+	/* Compute alternate SHA256 sum with input KEY, SALT, and KEY. The
+	 * final result will be added to the first context. */
+	SHA256_Init(&alt_ctx);
+
+	/* Add key. */
+	SHA256_Update(&alt_ctx, key, key_len);
+
+	/* Add salt. */
+	SHA256_Update(&alt_ctx, salt, salt_len);
+
+	/* Add key again. */
+	SHA256_Update(&alt_ctx, key, key_len);
+
+	/* Now get result of this (32 bytes) and add it to the other context. */
+	SHA256_Final(alt_result, &alt_ctx);
+
+	/* Add for any character in the key one byte of the alternate sum. */
+	for (cnt = key_len; cnt > 32; cnt -= 32)
+		SHA256_Update(&ctx, alt_result, 32);
+	SHA256_Update(&ctx, alt_result, cnt);
+
+	/* Take the binary representation of the length of the key and for
+	 * every 1 add the alternate sum, for every 0 the key. */
+	for (cnt = key_len; cnt > 0; cnt >>= 1)
+		if ((cnt & 1) != 0)
+			SHA256_Update(&ctx, alt_result, 32);
+		else
+			SHA256_Update(&ctx, key, key_len);
+
+	/* Create intermediate result. */
+	SHA256_Final(alt_result, &ctx);
+
+	/* Start computation of P byte sequence. */
+	SHA256_Init(&alt_ctx);
+
+	/* For every character in the password add the entire password. */
+	for (cnt = 0; cnt < key_len; ++cnt)
+		SHA256_Update(&alt_ctx, key, key_len);
+
+	/* Finish the digest. */
+	SHA256_Final(temp_result, &alt_ctx);
+
+	/* Create byte sequence P. */
+	cp = p_bytes = alloca(key_len);
+	for (cnt = key_len; cnt >= 32; cnt -= 32) {
+		memcpy(cp, temp_result, 32);
+		cp += 32;
+	}
+	memcpy(cp, temp_result, cnt);
+
+	/* Start computation of S byte sequence. */
+	SHA256_Init(&alt_ctx);
+
+	/* For every character in the password add the entire password. */
+	for (cnt = 0; cnt < 16 + alt_result[0]; ++cnt)
+		SHA256_Update(&alt_ctx, salt, salt_len);

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-projects mailing list