From: hackbard Date: Sun, 15 Oct 2006 21:49:01 +0000 (+0000) Subject: more toolchain + stage 1 updates X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=793f79d0d200544e7193cdfd4b66dc2479bf7247;p=hdw-linux%2Fhdw-linux.git more toolchain + stage 1 updates --- diff --git a/packages/base/00-small-base-conf/00-small-base-conf b/packages/base/00-small-base-conf/00-small-base-conf index 6130609..452be0d 100644 --- a/packages/base/00-small-base-conf/00-small-base-conf +++ b/packages/base/00-small-base-conf/00-small-base-conf @@ -3,12 +3,12 @@ # author: hackbard@hackdaworld.dyndns.org # # we don't need source -# [S] 1-10 2-1 +# [S] 1-4 2-1 # [V] 0.1 custmain="1" -if [ "$hdw_status" = "1" ] ; then +if [ "$stage" = "1" ] ; then custmain() { for i in bash pwd cat stty; do ln -sf ../$tc_name/bin/$i $root/bin/$i diff --git a/packages/base/bash/avoid_wcontinued.patch b/packages/base/bash/avoid_wcontinued.patch deleted file mode 100644 index cd85f47..0000000 --- a/packages/base/bash/avoid_wcontinued.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff -Naur bash-3.0.orig/jobs.c bash-3.0/jobs.c ---- ./jobs.c 2004-10-12 08:50:11.643481280 +0000 -+++ ./jobs.c 2004-10-12 08:51:35.110792320 +0000 -@@ -2476,6 +2476,7 @@ - PROCESS *child; - pid_t pid; - int call_set_current, last_stopped_job, job, children_exited, waitpid_flags; -+ static int wcontinued_not_supported = 0; - - call_set_current = children_exited = 0; - last_stopped_job = NO_JOB; -@@ -2489,7 +2490,15 @@ - : 0; - if (sigchld || block == 0) - waitpid_flags |= WNOHANG; -+ retry: -+ if (wcontinued_not_supported) -+ waitpid_flags &= ~WCONTINUED; - pid = WAITPID (-1, &status, waitpid_flags); -+ if (pid == -1 && errno == EINVAL) -+ { -+ wcontinued_not_supported = 1; -+ goto retry; -+ } - - /* The check for WNOHANG is to make sure we decrement sigchld only - if it was non-zero before we called waitpid. */ diff --git a/packages/base/bash/bash b/packages/base/bash/bash index 57ce9ad..349b4c6 100644 --- a/packages/base/bash/bash +++ b/packages/base/bash/bash @@ -2,20 +2,20 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 3.0 -# [S] 1-7 2-11 -# [D] bash-3.0.tar.gz ftp://ftp.gnu.org/pub/gnu/bash/ -# [D] bash-doc-3.0.tar.gz ftp://ftp.gnu.org/pub/gnu/bash/ +# [V] 3.1 +# [S] 1-2 2-11 +# [D] bash-3.1.tar.gz ftp://ftp.gnu.org/pub/gnu/bash/ +# [D] bash-doc-3.1.tar.gz ftp://ftp.gnu.org/pub/gnu/bash/ confopt="$confopt --without-bash-malloc" -if [ "$hdw_status" = "1" ] ; then +if [ "$stage" = "1" ] ; then post_install() { ln -svf bash $prefix/bin/sh } fi -if [ "$hdw_status" = "2" ] ; then +if [ "$stage" = "2" ] ; then confopt=${confopt//--bindir* /--bindir=$root/bin } post_install() { ln -sf bash $root/bin/sh diff --git a/packages/base/bash/official_fixes.patch b/packages/base/bash/official_fixes.patch index 9f314ee..7aed9e8 100644 --- a/packages/base/bash/official_fixes.patch +++ b/packages/base/bash/official_fixes.patch @@ -1,703 +1,701 @@ -diff -Naur bash-3.0.orig/array.c bash-3.0/array.c ---- bash-3.0.orig/array.c 2004-05-06 12:24:13.000000000 +0000 -+++ bash-3.0/array.c 2005-01-08 05:40:02.059798512 +0000 -@@ -451,7 +451,7 @@ - */ - array_dispose_element(new); - free(element_value(ae)); -- ae->value = savestring(v); -+ ae->value = v ? savestring(v) : (char *)NULL; - return(0); - } else if (element_index(ae) > i) { - ADD_BEFORE(ae, new); -diff -Naur bash-3.0.orig/arrayfunc.c bash-3.0/arrayfunc.c ---- bash-3.0.orig/arrayfunc.c 2003-12-19 05:03:09.000000000 +0000 -+++ bash-3.0/arrayfunc.c 2005-01-08 05:40:01.679856272 +0000 -@@ -611,7 +611,7 @@ - var = find_variable (t); - +--- bash-3.1.orig/arrayfunc.c 2005-07-04 17:25:58.000000000 -0700 ++++ bash-3.1/arrayfunc.c 2006-04-19 15:59:29.000000000 -0700 +@@ -592,11 +592,7 @@ + exp = (char *)xmalloc (len); + strncpy (exp, s, len - 1); + exp[len - 1] = '\0'; +-#if 0 +- t = expand_string_to_string (exp, 0); +-#else +- t = expand_string_to_string (exp, Q_DOUBLE_QUOTES); +-#endif ++ t = expand_arith_string (exp, 0); + this_command_name = (char *)NULL; + val = evalexp (t, &expok); free (t); -- return var; -+ return (var == 0 || invisible_p (var)) ? (SHELL_VAR *)0 : var; - } - - /* Return a string containing the elements in the array and subscript -diff -Naur bash-3.0.orig/bashline.c bash-3.0/bashline.c ---- bash-3.0.orig/bashline.c 2004-07-06 03:22:12.000000000 +0000 -+++ bash-3.0/bashline.c 2005-01-08 05:40:42.016724136 +0000 -@@ -100,6 +100,7 @@ - #endif +--- bash-3.1.orig/doc/bash.1 2005-10-12 08:40:52.000000000 -0700 ++++ bash-3.1/doc/bash.1 2006-04-19 15:58:34.000000000 -0700 +@@ -6,12 +6,12 @@ + .\" Case Western Reserve University + .\" chet@po.cwru.edu + .\" +-.\" Last Change: Sat Aug 27 13:28:44 EDT 2005 ++.\" Last Change: Wed Dec 28 19:58:45 EST 2005 + .\" + .\" bash_builtins, strip all but Built-Ins section + .if \n(zZ=1 .ig zZ + .if \n(zY=1 .ig zY +-.TH BASH 1 "2005 Aug 27" "GNU Bash-3.1-beta1" ++.TH BASH 1 "2005 Dec 28" "GNU Bash-3.1" + .\" + .\" There's some problem with having a `@' + .\" in a tagged paragraph with the BSD man macros. +@@ -677,8 +677,8 @@ + .B nocasematch + is enabled, the match is performed without regard to the case + of alphabetic characters. +-The return value is 0 if the string matches or does not match +-the pattern, respectively, and 1 otherwise. ++The return value is 0 if the string matches (\fB==\fP) or does not match ++(\fB!=\fP) the pattern, and 1 otherwise. + Any part of the pattern may be quoted to force it to be matched as a + string. + .if t .sp 0.5 +@@ -807,6 +807,12 @@ + as for pathname expansion (see + .B Pathname Expansion + below). ++The \fIword\fP is expanded using tilde ++expansion, parameter and variable expansion, arithmetic substituion, ++command substitution, process substitution and quote removal. ++Each \fIpattern\fP examined is expanded using tilde ++expansion, parameter and variable expansion, arithmetic substituion, ++command substitution, and process substitution. + If the shell option + .B nocasematch + is enabled, the match is performed without regard to the case +@@ -8484,7 +8490,7 @@ + returns true if any of the arguments are found, false if + none are found. + .TP +-\fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]] ++\fBulimit\fP [\fB\-SHacdfilmnpqstuvx\fP [\fIlimit\fP]] + Provides control over the resources available to the shell and to + processes started by it, on systems that allow such control. + The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is +@@ -8523,6 +8529,9 @@ + .B \-f + The maximum size of files created by the shell + .TP ++.B \-i ++The maximum number of pending signals ++.TP + .B \-l + The maximum size that may be locked into memory + .TP +@@ -8536,6 +8545,9 @@ + .B \-p + The pipe size in 512-byte blocks (this may not be set) + .TP ++.B \-q ++The maximum number of bytes in POSIX message queues ++.TP + .B \-s + The maximum stack size + .TP +@@ -8547,6 +8559,9 @@ + .TP + .B \-v + The maximum amount of virtual memory available to the shell ++.TP ++.B \-x ++The maximum number of file locks + .PD + .PP + If +--- bash-3.1.orig/doc/bashref.texi 2005-10-03 12:07:21.000000000 -0700 ++++ bash-3.1/doc/bashref.texi 2006-04-19 15:58:34.000000000 -0700 +@@ -961,8 +961,8 @@ + (see the description of @code{shopt} in @ref{Bash Builtins}) + is enabled, the match is performed without regard to the case + of alphabetic characters. +-The return value is 0 if the string matches or does not match +-the pattern, respectively, and 1 otherwise. ++The return value is 0 if the string matches (@samp{==}) or does not ++match (@samp{!=})the pattern, and 1 otherwise. + Any part of the pattern may be quoted to force it to be matched as a + string. + +@@ -2598,7 +2598,7 @@ + Builtin commands are necessary to implement functionality impossible + or inconvenient to obtain with separate utilities. + +-This section briefly the builtins which Bash inherits from ++This section briefly describes the builtins which Bash inherits from + the Bourne Shell, as well as the builtin commands which are unique + to or have been extended in Bash. + +@@ -3833,7 +3833,7 @@ + @item ulimit + @btindex ulimit + @example +-ulimit [-acdflmnpstuvSH] [@var{limit}] ++ulimit [-acdfilmnpqstuvxSH] [@var{limit}] + @end example + @code{ulimit} provides control over the resources available to processes + started by the shell, on systems that allow such control. If an +@@ -3857,6 +3857,9 @@ + @item -f + The maximum size of files created by the shell. + ++@item -i ++The maximum number of pending signals. ++ + @item -l + The maximum size that may be locked into memory. - /* Helper functions for Readline. */ -+static int bash_directory_expansion __P((char **)); - static int bash_directory_completion_hook __P((char **)); - static int filename_completion_ignore __P((char **)); - static int bash_push_line __P((void)); -@@ -292,7 +293,7 @@ - /* See if we have anything to do. */ - at = strchr (rl_completer_word_break_characters, '@'); - if ((at == 0 && on_or_off == 0) || (at != 0 && on_or_off != 0)) -- return; -+ return old_value; - - /* We have something to do. Do it. */ - nval = (char *)xmalloc (strlen (rl_completer_word_break_characters) + 1 + on_or_off); -@@ -1406,10 +1407,19 @@ - filename. */ - if (*hint_text == '~') - { -- int l, tl, vl; -+ int l, tl, vl, dl; -+ char *rd; - vl = strlen (val); - tl = strlen (hint_text); -+#if 0 - l = vl - hint_len; /* # of chars added */ -+#else -+ rd = savestring (filename_hint); -+ bash_directory_expansion (&rd); -+ dl = strlen (rd); -+ l = vl - dl; /* # of chars added */ -+ free (rd); -+#endif - temp = (char *)xmalloc (l + 2 + tl); - strcpy (temp, hint_text); - strcpy (temp + tl, val + vl - l); -@@ -2187,6 +2197,27 @@ - return 0; - } +@@ -3869,6 +3872,9 @@ + @item -p + The pipe buffer size. -+/* Simulate the expansions that will be performed by -+ rl_filename_completion_function. This must be called with the address of -+ a pointer to malloc'd memory. */ -+static int -+bash_directory_expansion (dirname) -+ char **dirname; -+{ -+ char *d; -+ -+ d = savestring (*dirname); -+ -+ if (rl_directory_rewrite_hook) -+ (*rl_directory_rewrite_hook) (&d); ++@item -q ++The maximum number of bytes in POSIX message queues. + -+ if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&d)) -+ { -+ free (*dirname); -+ *dirname = d; -+ } -+} -+ - /* Handle symbolic link references and other directory name - expansions while hacking completion. */ - static int -@@ -2513,7 +2544,7 @@ - static char **matches = (char **)NULL; - static int ind; - int glen; -- char *ret; -+ char *ret, *ttext; - - if (state == 0) - { -@@ -2523,17 +2554,22 @@ - FREE (globorig); - FREE (globtext); + @item -s + The maximum stack size. -+ ttext = bash_tilde_expand (text, 0); +@@ -3881,6 +3887,9 @@ + @item -v + The maximum amount of virtual memory available to the process. + ++@item -x ++The maximum number of file locks. + - if (rl_explicit_arg) - { -- globorig = savestring (text); -- glen = strlen (text); -+ globorig = savestring (ttext); -+ glen = strlen (ttext); - globtext = (char *)xmalloc (glen + 2); -- strcpy (globtext, text); -+ strcpy (globtext, ttext); - globtext[glen] = '*'; - globtext[glen+1] = '\0'; + @end table + + If @var{limit} is given, it is the new value of the specified resource; +@@ -4089,8 +4098,8 @@ + Print shell input lines as they are read. + + @item -x +-Print a trace of simple commands, \fBfor\fP commands, \fBcase\fP +-commands, \fBselect\fP commands, and arithmetic \fBfor\fP commands ++Print a trace of simple commands, @code{for} commands, @code{case} ++commands, @code{select} commands, and arithmetic @code{for} commands + and their arguments or associated word lists after they are + expanded and before they are executed. The value of the @env{PS4} + variable is expanded and the resultant value is printed before +--- bash-3.1.orig/doc/version.texi 2005-09-20 11:52:56.000000000 -0700 ++++ bash-3.1/doc/version.texi 2006-04-19 15:58:34.000000000 -0700 +@@ -2,9 +2,9 @@ + Copyright (C) 1988-2005 Free Software Foundation, Inc. + @end ignore + +-@set LASTCHANGE Mon Sep 5 11:47:04 EDT 2005 ++@set LASTCHANGE Fri Dec 30 10:50:51 EST 2005 + +-@set EDITION 3.1-beta1 +-@set VERSION 3.1-beta1 +-@set UPDATED 5 September 2005 +-@set UPDATED-MONTH September 2005 ++@set EDITION 3.1 ++@set VERSION 3.1 ++@set UPDATED 30 December 2005 ++@set UPDATED-MONTH December 2005 +--- bash-3.1.orig/jobs.c 2005-11-11 20:13:27.000000000 -0800 ++++ bash-3.1/jobs.c 2006-04-19 15:58:34.000000000 -0700 +@@ -619,8 +619,11 @@ + * once in the parent and once in each child. This is where + * the parent gives it away. + * ++ * Don't give the terminal away if this shell is an asynchronous ++ * subshell. ++ * + */ +- if (job_control && newjob->pgrp) ++ if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0) + give_terminal_to (newjob->pgrp, 0); } - else -- globtext = globorig = savestring (text); -+ globtext = globorig = savestring (ttext); -+ -+ if (ttext != text) -+ free (ttext); - - matches = shell_glob_filename (globtext); - if (GLOB_FAILED (matches)) -diff -Naur bash-3.0.orig/braces.c bash-3.0/braces.c ---- bash-3.0.orig/braces.c 2003-12-04 16:09:52.000000000 +0000 -+++ bash-3.0/braces.c 2005-01-08 05:40:50.317462232 +0000 -@@ -340,8 +340,8 @@ - - if (lhs_t == ST_CHAR) - { -- lhs_v = lhs[0]; -- rhs_v = rhs[0]; -+ lhs_v = (unsigned char)lhs[0]; -+ rhs_v = (unsigned char)rhs[0]; } - else - { -@@ -402,6 +402,8 @@ - { - pass_next = 1; - i++; -+ if (quoted == 0) -+ level++; - continue; - } - #endif -diff -Naur bash-3.0.orig/builtins/trap.def bash-3.0/builtins/trap.def ---- bash-3.0.orig/builtins/trap.def 2004-05-28 02:26:19.000000000 +0000 -+++ bash-3.0/builtins/trap.def 2005-01-08 05:40:04.443436144 +0000 -@@ -23,7 +23,7 @@ - - $BUILTIN trap - $FUNCTION trap_builtin --$SHORT_DOC trap [-lp] [[arg] signal_spec ...] -+$SHORT_DOC trap [-lp] [arg signal_spec ...] - The command ARG is to be read and executed when the shell receives - signal(s) SIGNAL_SPEC. If ARG is absent (and a single SIGNAL_SPEC - is supplied) or `-', each specified signal is reset to its original -@@ -87,7 +87,7 @@ - trap_builtin (list) - WORD_LIST *list; +@@ -844,9 +847,10 @@ + realloc_jobs_list () { -- int list_signal_names, display, result, opt; -+ int list_signal_names, display, result, opt, first_signal; - - list_signal_names = display = 0; - result = EXECUTION_SUCCESS; -@@ -118,14 +118,19 @@ - else - { - char *first_arg; -- int operation, sig; -+ int operation, sig, first_signal; - - operation = SET; - first_arg = list->word->word; -+ first_signal = first_arg && *first_arg && all_digits (first_arg) && signal_object_p (first_arg, opt); + sigset_t set, oset; +- int nsize, i, j; ++ int nsize, i, j, ncur, nprev; + JOB **nlist; + ++ ncur = nprev = NO_JOB; + nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS); + nsize *= JOB_SLOTS; + i = js.j_njobs % JOB_SLOTS; +@@ -854,17 +858,51 @@ + nsize += JOB_SLOTS; + + BLOCK_CHILD (set, oset); +- nlist = (JOB **) xmalloc (nsize * sizeof (JOB *)); ++ nlist = (js.j_jobslots == nsize) ? jobs : (JOB **) xmalloc (nsize * sizeof (JOB *)); + -+ /* Backwards compatibility */ -+ if (first_signal) -+ operation = REVERT; - /* When in posix mode, the historical behavior of looking for a - missing first argument is disabled. To revert to the original - signal handling disposition, use `-' as the first argument. */ -- if (posixly_correct == 0 && first_arg && *first_arg && -+ else if (posixly_correct == 0 && first_arg && *first_arg && - (*first_arg != '-' || first_arg[1]) && - signal_object_p (first_arg, opt) && list->next == 0) - operation = REVERT; -diff -Naur bash-3.0.orig/doc/bashref.texi bash-3.0/doc/bashref.texi ---- bash-3.0.orig/doc/bashref.texi 2004-06-26 18:26:07.000000000 +0000 -+++ bash-3.0/doc/bashref.texi 2005-01-08 05:40:04.494428392 +0000 -@@ -5953,7 +5953,8 @@ - @item - The @code{trap} builtin doesn't check the first argument for a possible - signal specification and revert the signal handling to the original --disposition if it is. If users want to reset the handler for a given -+disposition if it is, unless that argument consists solely of digits and -+is a valid signal number. If users want to reset the handler for a given - signal to the original disposition, they should use @samp{-} as the - first argument. - -diff -Naur bash-3.0.orig/general.c bash-3.0/general.c ---- bash-3.0.orig/general.c 2004-04-15 03:20:13.000000000 +0000 -+++ bash-3.0/general.c 2005-01-08 05:40:51.913219640 +0000 -@@ -267,7 +267,7 @@ - c = string[indx = 0]; - - #if defined (ARRAY_VARS) -- if ((legal_variable_starter (c) == 0) && (flags && c != '[')) /* ] */ -+ if ((legal_variable_starter (c) == 0) && (flags == 0 || c != '[')) /* ] */ - #else - if (legal_variable_starter (c) == 0) - #endif -diff -Naur bash-3.0.orig/include/shmbutil.h bash-3.0/include/shmbutil.h ---- bash-3.0.orig/include/shmbutil.h 2004-04-19 13:59:42.000000000 +0000 -+++ bash-3.0/include/shmbutil.h 2005-01-08 05:40:05.724241432 +0000 -@@ -31,6 +31,8 @@ - extern size_t xmbsrtowcs __P((wchar_t *, const char **, size_t, mbstate_t *)); - extern size_t xdupmbstowcs __P((wchar_t **, char ***, const char *)); - -+extern size_t mbstrlen __P((const char *)); + for (i = j = 0; i < js.j_jobslots; i++) + if (jobs[i]) +- nlist[j++] = jobs[i]; ++ { ++ if (i == js.j_current) ++ ncur = j; ++ if (i == js.j_previous) ++ nprev = j; ++ nlist[j++] = jobs[i]; ++ } + - extern char *xstrchr __P((const char *, int)); - - #ifndef MB_INVALIDCH -@@ -38,6 +40,9 @@ - #define MB_NULLWCH(x) ((x) == 0) - #endif ++#if defined (DEBUG) ++ itrace ("realloc_jobs_list: resize jobs list from %d to %d", js.j_jobslots, nsize); ++ itrace ("realloc_jobs_list: j_lastj changed from %d to %d", js.j_lastj, (j > 0) ? j - 1 : 0); ++ itrace ("realloc_jobs_list: j_njobs changed from %d to %d", js.j_njobs, (j > 0) ? j - 1 : 0); ++#endif -+#define MBSLEN(s) (((s) && (s)[0]) ? ((s)[1] ? mbstrlen (s) : 1) : 0) -+#define MB_STRLEN(s) ((MB_CUR_MAX > 1) ? MBSLEN (s) : STRLEN (s)) + js.j_firstj = 0; +- js.j_lastj = (j > 0) ? j - 1: 0; ++ js.j_lastj = (j > 0) ? j - 1 : 0; ++ js.j_njobs = j; + js.j_jobslots = nsize; + +- free (jobs); +- jobs = nlist; ++ /* Zero out remaining slots in new jobs list */ ++ for ( ; j < nsize; j++) ++ nlist[j] = (JOB *)NULL; ++ ++ if (jobs != nlist) ++ { ++ free (jobs); ++ jobs = nlist; ++ } ++ ++ if (ncur != NO_JOB) ++ js.j_current = ncur; ++ if (nprev != NO_JOB) ++ js.j_previous = nprev; + - #else /* !HANDLE_MULTIBYTE */ ++ /* Need to reset these */ ++ if (js.j_current == NO_JOB || js.j_previous == NO_JOB || js.j_current > js.j_lastj || js.j_previous > js.j_lastj) ++ reset_current (); ++ ++#ifdef DEBUG ++ itrace ("realloc_jobs_list: reset js.j_current (%d) and js.j_previous (%d)", js.j_current, js.j_previous); ++#endif - #undef MB_LEN_MAX -@@ -54,6 +59,8 @@ - #define MB_NULLWCH(x) (0) - #endif + UNBLOCK_CHILD (oset); + } +@@ -1655,7 +1693,7 @@ + In this case, we don't want to give the terminal to the + shell's process group (we could be in the middle of a + pipeline, for example). */ +- if (async_p == 0 && pipeline_pgrp != shell_pgrp) ++ if (async_p == 0 && pipeline_pgrp != shell_pgrp && ((subshell_environment&SUBSHELL_ASYNC) == 0)) + give_terminal_to (pipeline_pgrp, 0); + + #if defined (PGRP_PIPE) +@@ -2198,7 +2236,11 @@ + /* This is possibly a race condition -- should it go in stop_pipeline? */ + wait_sigint_received = 0; + if (job_control == 0) +- old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler); ++ { ++ old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler); ++ if (old_sigint_handler == SIG_IGN) ++ set_signal_handler (SIGINT, old_sigint_handler); ++ } -+#define MB_STRLEN(s) (STRLEN(s)) -+ - #endif /* !HANDLE_MULTIBYTE */ - - /* Declare and initialize a multibyte state. Call must be terminated -diff -Naur bash-3.0.orig/jobs.c bash-3.0/jobs.c ---- bash-3.0.orig/jobs.c 2004-04-23 20:28:25.000000000 +0000 -+++ bash-3.0/jobs.c 2005-01-08 05:40:40.567944384 +0000 -@@ -1778,8 +1778,13 @@ - if (pipefail_opt) - { - fail = 0; -- for (p = jobs[job]->pipe; p->next != jobs[job]->pipe; p = p->next) -- if (p->status != EXECUTION_SUCCESS) fail = p->status; -+ p = jobs[job]->pipe; -+ do -+ { -+ if (p->status != EXECUTION_SUCCESS) fail = p->status; -+ p = p->next; -+ } -+ while (p != jobs[job]->pipe); - return fail; - } + termination_state = last_command_exit_value; -diff -Naur bash-3.0.orig/lib/readline/display.c bash-3.0/lib/readline/display.c ---- bash-3.0.orig/lib/readline/display.c 2004-05-28 02:57:51.000000000 +0000 -+++ bash-3.0/lib/readline/display.c 2005-01-08 05:40:08.574808080 +0000 -@@ -201,7 +201,7 @@ - int *lp, *lip, *niflp, *vlp; - { - char *r, *ret, *p; -- int l, rl, last, ignoring, ninvis, invfl, ind, pind, physchars; -+ int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars; +--- bash-3.1.orig/lib/glob/glob.c 2005-03-24 09:42:27.000000000 -0800 ++++ bash-3.1/lib/glob/glob.c 2006-04-19 15:58:34.000000000 -0700 +@@ -360,6 +360,7 @@ + count = lose = skip = 0; - /* Short-circuit if we can. */ - if ((MB_CUR_MAX <= 1 || rl_byte_oriented) && strchr (pmt, RL_PROMPT_START_IGNORE) == 0) -@@ -222,6 +222,7 @@ - r = ret = (char *)xmalloc (l + 1); + firstmalloc = 0; ++ nalloca = 0; - invfl = 0; /* invisible chars in first line of prompt */ -+ invflset = 0; /* we only want to set invfl once */ + /* If PAT is empty, skip the loop, but return one (empty) filename. */ + if (pat == 0 || *pat == '\0') +@@ -546,6 +547,8 @@ + firstmalloc = 0; + tmplink = lastlink; + } ++ else ++ tmplink = 0; + free (lastlink->name); + lastlink = lastlink->next; + FREE (tmplink); +--- bash-3.1.orig/lib/glob/sm_loop.c 2005-10-16 18:21:04.000000000 -0700 ++++ bash-3.1/lib/glob/sm_loop.c 2006-04-19 15:58:34.000000000 -0700 +@@ -638,12 +638,13 @@ + CHAR *psub; /* pointer to sub-pattern */ + CHAR *pnext; /* pointer to next sub-pattern */ + CHAR *srest; /* pointer to rest of string */ +- int m1, m2; ++ int m1, m2, xflags; /* xflags = flags passed to recursive matches */ + + #if DEBUG_MATCHING + fprintf(stderr, "extmatch: xc = %c\n", xc); + fprintf(stderr, "extmatch: s = %s; se = %s\n", s, se); + fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe); ++fprintf(stderr, "extmatch: flags = %d\n", flags); + #endif - for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++) - { -@@ -249,7 +250,10 @@ - while (l--) - *r++ = *p++; - if (!ignoring) -- rl += ind - pind; + prest = PATSCAN (p + (*p == L('(')), pe, 0); /* ) */ +@@ -677,8 +678,12 @@ + string matches the rest of the pattern. Also handle + multiple matches of the pattern. */ + if (m1) +- m2 = (GMATCH (srest, se, prest, pe, flags) == 0) || +- (s != srest && GMATCH (srest, se, p - 1, pe, flags) == 0); + { -+ rl += ind - pind; -+ physchars += _rl_col_width (pmt, pind, ind); ++ /* if srest > s, we are not at start of string */ ++ xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags; ++ m2 = (GMATCH (srest, se, prest, pe, xflags) == 0) || ++ (s != srest && GMATCH (srest, se, p - 1, pe, xflags) == 0); + } - else - ninvis += ind - pind; - p--; /* compensate for later increment */ -@@ -259,16 +263,19 @@ + if (m1 && m2) + return (0); + } +@@ -704,8 +709,10 @@ + srest = (prest == pe) ? se : s; + for ( ; srest <= se; srest++) { - *r++ = *p; - if (!ignoring) -- rl++; /* visible length byte counter */ -+ { -+ rl++; /* visible length byte counter */ -+ physchars++; -+ } - else - ninvis++; /* invisible chars byte counter */ ++ /* if srest > s, we are not at start of string */ ++ xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags; + if (GMATCH (s, srest, psub, pnext - 1, flags) == 0 && +- GMATCH (srest, se, prest, pe, flags) == 0) ++ GMATCH (srest, se, prest, pe, xflags) == 0) + return (0); } - -- if (rl >= _rl_screenwidth) -- invfl = ninvis; -- -- if (ignoring == 0) -- physchars++; -+ if (invflset == 0 && rl >= _rl_screenwidth) -+ { -+ invfl = ninvis; -+ invflset = 1; -+ } + if (pnext == prest) +@@ -726,7 +733,9 @@ + if (pnext == prest) + break; + } +- if (m1 == 0 && GMATCH (srest, se, prest, pe, flags) == 0) ++ /* if srest > s, we are not at start of string */ ++ xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags; ++ if (m1 == 0 && GMATCH (srest, se, prest, pe, xflags) == 0) + return (0); } + return (FNM_NOMATCH); +--- bash-3.1.orig/lib/readline/display.c 2005-11-30 11:05:02.000000000 -0800 ++++ bash-3.1/lib/readline/display.c 2006-04-19 15:58:34.000000000 -0700 +@@ -1983,11 +1983,15 @@ + int pchar; + { + int len; +- char *pmt; ++ char *pmt, *p; + + rl_save_prompt (); + +- if (saved_local_prompt == 0) ++ /* We've saved the prompt, and can do anything with the various prompt ++ strings we need before they're restored. We want the unexpanded ++ portion of the prompt string after any final newline. */ ++ p = rl_prompt ? strrchr (rl_prompt, '\n') : 0; ++ if (p == 0) + { + len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0; + pmt = (char *)xmalloc (len + 2); +@@ -1998,19 +2002,17 @@ } + else + { +- len = *saved_local_prompt ? strlen (saved_local_prompt) : 0; ++ p++; ++ len = strlen (p); + pmt = (char *)xmalloc (len + 2); + if (len) +- strcpy (pmt, saved_local_prompt); ++ strcpy (pmt, p); + pmt[len] = pchar; + pmt[len+1] = '\0'; +- local_prompt = savestring (pmt); +- prompt_last_invisible = saved_last_invisible; +- prompt_visible_length = saved_visible_length + 1; +- } ++ } -@@ -351,14 +358,14 @@ - local_prompt = expand_prompt (p, &prompt_visible_length, - &prompt_last_invisible, - (int *)NULL, -- (int *)NULL); -+ &prompt_physical_chars); - c = *t; *t = '\0'; - /* The portion of the prompt string up to and including the - final newline is now null-terminated. */ - local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length, - (int *)NULL, - &prompt_invis_chars_first_line, -- &prompt_physical_chars); -+ (int *)NULL); - *t = c; - return (prompt_prefix_length); - } -@@ -417,7 +424,7 @@ - register int in, out, c, linenum, cursor_linenum; - register char *line; - int c_pos, inv_botlin, lb_botlin, lb_linenum; -- int newlines, lpos, temp, modmark; -+ int newlines, lpos, temp, modmark, n0, num; - char *prompt_this_line; - #if defined (HANDLE_MULTIBYTE) - wchar_t wc; -@@ -573,6 +580,7 @@ - - #if defined (HANDLE_MULTIBYTE) - memset (_rl_wrapped_line, 0, vis_lbsize); -+ num = 0; - #endif ++ /* will be overwritten by expand_prompt, called from rl_message */ + prompt_physical_chars = saved_physical_chars + 1; +- + return pmt; + } + +--- bash-3.1.orig/lib/readline/readline.c 2005-07-04 19:29:35.000000000 -0700 ++++ bash-3.1/lib/readline/readline.c 2006-04-19 15:58:34.000000000 -0700 +@@ -282,6 +282,7 @@ + { + FREE (rl_prompt); + rl_prompt = prompt ? savestring (prompt) : (char *)NULL; ++ rl_display_prompt = rl_prompt ? rl_prompt : ""; - /* prompt_invis_chars_first_line is the number of invisible characters in -@@ -591,13 +599,32 @@ - probably too much work for the benefit gained. How many people have - prompts that exceed two physical lines? - Additional logic fix from Edward Catmur */ -+#if defined (HANDLE_MULTIBYTE) -+ n0 = num; -+ temp = local_prompt ? strlen (local_prompt) : 0; -+ while (num < temp) + rl_visible_prompt_length = rl_expand_prompt (rl_prompt); + return 0; +--- bash-3.1.orig/lib/readline/terminal.c 2005-11-12 17:46:54.000000000 -0800 ++++ bash-3.1/lib/readline/terminal.c 2006-04-19 15:58:34.000000000 -0700 +@@ -122,7 +122,7 @@ + static char *_rl_visible_bell; + + /* Non-zero means the terminal can auto-wrap lines. */ +-int _rl_term_autowrap; ++int _rl_term_autowrap = -1; + + /* Non-zero means that this terminal has a meta key. */ + static int term_has_meta; +@@ -274,6 +274,9 @@ + _rl_set_screen_size (rows, cols) + int rows, cols; + { ++ if (_rl_term_autowrap == -1) ++ _rl_init_terminal_io (rl_terminal_name); ++ + if (rows > 0) + _rl_screenheight = rows; + if (cols > 0) +--- bash-3.1.orig/parse.y 2005-11-11 20:14:18.000000000 -0800 ++++ bash-3.1/parse.y 2006-04-19 15:58:34.000000000 -0700 +@@ -2716,6 +2716,7 @@ + #define P_ALLOWESC 0x02 + #define P_DQUOTE 0x04 + #define P_COMMAND 0x08 /* parsing a command, so look for comments */ ++#define P_BACKQUOTE 0x10 /* parsing a backquoted command substitution */ + + static char matched_pair_error; + static char * +@@ -2725,12 +2726,12 @@ + int *lenp, flags; + { + int count, ch, was_dollar, in_comment, check_comment; +- int pass_next_character, nestlen, ttranslen, start_lineno; ++ int pass_next_character, backq_backslash, nestlen, ttranslen, start_lineno; + char *ret, *nestret, *ttrans; + int retind, retsize, rflags; + + count = 1; +- pass_next_character = was_dollar = in_comment = 0; ++ pass_next_character = backq_backslash = was_dollar = in_comment = 0; + check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0; + + /* RFLAGS is the set of flags we want to pass to recursive calls. */ +@@ -2742,11 +2743,8 @@ + start_lineno = line_number; + while (count) + { +-#if 0 +- ch = shell_getc ((qc != '\'' || (flags & P_ALLOWESC)) && pass_next_character == 0); +-#else +- ch = shell_getc (qc != '\'' && pass_next_character == 0); +-#endif ++ ch = shell_getc (qc != '\'' && pass_next_character == 0 && backq_backslash == 0); ++ + if (ch == EOF) + { + free (ret); +@@ -2771,9 +2769,16 @@ + continue; + } + /* Not exactly right yet */ +- else if (check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind -1]))) ++ else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1]))) + in_comment = 1; + ++ /* last char was backslash inside backquoted command substitution */ ++ if (backq_backslash) + { -+ if (_rl_col_width (local_prompt, n0, num) > _rl_screenwidth) -+ { -+ num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY); -+ break; -+ } -+ num++; ++ backq_backslash = 0; ++ /* Placeholder for adding special characters */ + } -+ temp = num + -+#else - temp = ((newlines + 1) * _rl_screenwidth) + -+#endif /* !HANDLE_MULTIBYTE */ - ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line - : ((newlines == 1) ? wrap_offset : 0)) - : ((newlines == 0) ? wrap_offset :0)); - - inv_lbreaks[++newlines] = temp; -+#if defined (HANDLE_MULTIBYTE) -+ lpos -= _rl_col_width (local_prompt, n0, num); -+#else - lpos -= _rl_screenwidth; -+#endif - } ++ + if (pass_next_character) /* last char was backslash */ + { + pass_next_character = 0; +@@ -2814,6 +2819,8 @@ + { + if MBTEST((flags & P_ALLOWESC) && ch == '\\') + pass_next_character++; ++ else if MBTEST((flags & P_BACKQUOTE) && ch == '\\') ++ backq_backslash++; + continue; + } - prompt_last_screen_line = newlines; -diff -Naur bash-3.0.orig/lib/readline/mbutil.c bash-3.0/lib/readline/mbutil.c ---- bash-3.0.orig/lib/readline/mbutil.c 2004-01-14 14:44:52.000000000 +0000 -+++ bash-3.0/lib/readline/mbutil.c 2005-01-08 05:40:39.252144416 +0000 -@@ -126,11 +126,11 @@ - if (find_non_zero) - { - tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); -- while (wcwidth (wc) == 0) -+ while (tmp > 0 && wcwidth (wc) == 0) +@@ -2898,7 +2905,11 @@ + } + else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0) { - point += tmp; - tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps); -- if (tmp == (size_t)(0) || tmp == (size_t)(-1) || tmp == (size_t)(-2)) -+ if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp)) - break; +- nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags); ++ /* Add P_BACKQUOTE so backslash quotes the next character and ++ shell_getc does the right thing with \. We do this for ++ a measure of backwards compatibility -- it's not strictly the ++ right POSIX thing. */ ++ nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_BACKQUOTE); + goto add_nestret; } + else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */ +@@ -2907,7 +2918,7 @@ + if (open == ch) /* undo previous increment */ + count--; + if (ch == '(') /* ) */ +- nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags); ++ nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags & ~P_DQUOTE); + else if (ch == '{') /* } */ + nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags); + else if (ch == '[') /* ] */ +@@ -3578,7 +3589,7 @@ + FREE (ttok); + all_digit_token = 0; + compound_assignment = 1; +-#if 0 ++#if 1 + goto next_character; + #else + goto got_token; /* ksh93 seems to do this */ +@@ -3695,7 +3706,9 @@ + struct builtin *b; + b = builtin_address_internal (token, 0); + if (b && (b->flags & ASSIGNMENT_BUILTIN)) +- parser_state |= PST_ASSIGNOK; ++ parser_state |= PST_ASSIGNOK; ++ else if (STREQ (token, "eval") || STREQ (token, "let")) ++ parser_state |= PST_ASSIGNOK; } -diff -Naur bash-3.0.orig/lib/readline/misc.c bash-3.0/lib/readline/misc.c ---- bash-3.0.orig/lib/readline/misc.c 2004-07-07 12:56:32.000000000 +0000 -+++ bash-3.0/lib/readline/misc.c 2005-01-08 05:40:07.040041400 +0000 -@@ -276,12 +276,6 @@ - _rl_saved_line_for_history->line = savestring (rl_line_buffer); - _rl_saved_line_for_history->data = (char *)rl_undo_list; + + yylval.word = the_word; +@@ -4686,18 +4699,21 @@ + int *retlenp; + { + WORD_LIST *wl, *rl; +- int tok, orig_line_number, orig_token_size; ++ int tok, orig_line_number, orig_token_size, orig_last_token, assignok; + char *saved_token, *ret; + + saved_token = token; + orig_token_size = token_buffer_size; + orig_line_number = line_number; ++ orig_last_token = last_read_token; + + last_read_token = WORD; /* WORD to allow reserved words here */ + + token = (char *)NULL; + token_buffer_size = 0; + ++ assignok = parser_state&PST_ASSIGNOK; /* XXX */ ++ + wl = (WORD_LIST *)NULL; /* ( */ + parser_state |= PST_COMPASSIGN; + +@@ -4740,7 +4756,7 @@ + jump_to_top_level (DISCARD); } -- else if (STREQ (rl_line_buffer, _rl_saved_line_for_history->line) == 0) -- { -- free (_rl_saved_line_for_history->line); -- _rl_saved_line_for_history->line = savestring (rl_line_buffer); -- _rl_saved_line_for_history->data = (char *)rl_undo_list; /* XXX possible memleak */ -- } - return 0; - } -diff -Naur bash-3.0.orig/lib/readline/vi_mode.c bash-3.0/lib/readline/vi_mode.c ---- bash-3.0.orig/lib/readline/vi_mode.c 2004-07-13 18:08:27.000000000 +0000 -+++ bash-3.0/lib/readline/vi_mode.c 2005-01-08 05:40:25.349257976 +0000 -@@ -272,10 +272,12 @@ - switch (key) +- last_read_token = WORD; ++ last_read_token = orig_last_token; /* XXX - was WORD? */ + if (wl) { - case '?': -+ _rl_free_saved_history_line (); - rl_noninc_forward_search (count, key); - break; + rl = REVERSE_LIST (wl, WORD_LIST *); +@@ -4752,6 +4768,10 @@ - case '/': -+ _rl_free_saved_history_line (); - rl_noninc_reverse_search (count, key); - break; + if (retlenp) + *retlenp = (ret && *ret) ? strlen (ret) : 0; ++ ++ if (assignok) ++ parser_state |= PST_ASSIGNOK; ++ + return ret; + } -@@ -690,7 +692,7 @@ - { - wchar_t wc; - char mb[MB_LEN_MAX+1]; -- int mblen; -+ int mblen, p; - mbstate_t ps; - - memset (&ps, 0, sizeof (mbstate_t)); -@@ -713,11 +715,14 @@ - /* Vi is kind of strange here. */ - if (wc) - { -+ p = rl_point; - mblen = wcrtomb (mb, wc, &ps); - if (mblen >= 0) - mb[mblen] = '\0'; - rl_begin_undo_group (); -- rl_delete (1, 0); -+ rl_vi_delete (1, 0); -+ if (rl_point < p) /* Did we retreat at EOL? */ -+ rl_point++; /* XXX - should we advance more than 1 for mbchar? */ - rl_insert_text (mb); - rl_end_undo_group (); - rl_vi_check (); -@@ -1310,12 +1315,16 @@ - rl_vi_delete (1, c); - #if defined (HANDLE_MULTIBYTE) - if (MB_CUR_MAX > 1 && rl_byte_oriented == 0) -- while (_rl_insert_char (1, c)) -- { -- RL_SETSTATE (RL_STATE_MOREINPUT); -- c = rl_read_key (); -- RL_UNSETSTATE (RL_STATE_MOREINPUT); -- } -+ { -+ if (rl_point < p) /* Did we retreat at EOL? */ -+ rl_point++; -+ while (_rl_insert_char (1, c)) -+ { -+ RL_SETSTATE (RL_STATE_MOREINPUT); -+ c = rl_read_key (); -+ RL_UNSETSTATE (RL_STATE_MOREINPUT); -+ } -+ } - else - #endif - { -diff -Naur bash-3.0.orig/patchlevel.h bash-3.0/patchlevel.h ---- bash-3.0.orig/patchlevel.h 2001-08-22 12:05:39.000000000 +0000 -+++ bash-3.0/patchlevel.h 2005-01-08 05:40:53.584965496 +0000 +--- bash-3.1.orig/patchlevel.h 2005-07-20 10:58:20.000000000 -0700 ++++ bash-3.1/patchlevel.h 2006-04-19 15:59:29.000000000 -0700 @@ -25,6 +25,6 @@ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh looks for to find the patch level (for the sccs version string). */ -#define PATCHLEVEL 0 -+#define PATCHLEVEL 16 ++#define PATCHLEVEL 17 #endif /* _PATCHLEVEL_H_ */ -diff -Naur bash-3.0.orig/pcomplete.c bash-3.0/pcomplete.c ---- bash-3.0.orig/pcomplete.c 2004-01-08 15:36:17.000000000 +0000 -+++ bash-3.0/pcomplete.c 2005-01-08 05:40:02.049800032 +0000 -@@ -863,6 +863,8 @@ - if (array_p (v) == 0) - v = convert_var_to_array (v); - v = assign_array_var_from_word_list (v, lwords); -+ -+ VUNSETATTR (v, att_invisible); - return v; - } - #endif /* ARRAY_VARS */ -@@ -1022,6 +1024,8 @@ - if (array_p (v) == 0) - v = convert_var_to_array (v); - -+ VUNSETATTR (v, att_invisible); -+ - a = array_cell (v); - if (a == 0 || array_empty (a)) - sl = (STRINGLIST *)NULL; -diff -Naur bash-3.0.orig/subst.c bash-3.0/subst.c ---- bash-3.0.orig/subst.c 2004-07-04 17:56:13.000000000 +0000 -+++ bash-3.0/subst.c 2005-01-08 05:40:53.574967016 +0000 -@@ -4691,6 +4691,26 @@ - legal_identifier (name + 1)); /* ${#PS1} */ +--- bash-3.1.orig/subst.c 2005-10-24 06:51:13.000000000 -0700 ++++ bash-3.1/subst.c 2006-04-19 15:59:29.000000000 -0700 +@@ -2187,7 +2187,7 @@ + if (mklocal && variable_context) + { + v = find_variable (name); +- if (v == 0 || array_p (v) == 0) ++ if (v == 0 || array_p (v) == 0 || v->context != variable_context) + v = make_local_array_variable (name); + v = assign_array_var_from_string (v, value, flags); + } +@@ -2575,6 +2575,13 @@ + return (expand_string_to_string_internal (string, quoted, expand_string_assignment)); } -+#if defined (HANDLE_MULTIBYTE) -+size_t -+mbstrlen (s) -+ const char *s; ++char * ++expand_arith_string (string, quoted) ++ char *string; +{ -+ size_t clen, nc; -+ mbstate_t mbs; -+ -+ nc = 0; -+ memset (&mbs, 0, sizeof (mbs)); -+ while ((clen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0 && (MB_INVALIDCH(clen) == 0)) -+ { -+ s += clen; -+ nc++; -+ } -+ return nc; ++ return (expand_string_if_necessary (string, quoted, expand_string)); +} -+#endif -+ + - /* Handle the parameter brace expansion that requires us to return the - length of a parameter. */ - static intmax_t -@@ -4746,14 +4766,14 @@ - if (legal_number (name + 1, &arg_index)) /* ${#1} */ - { - t = get_dollar_var_value (arg_index); -- number = STRLEN (t); -+ number = MB_STRLEN (t); - FREE (t); - } - #if defined (ARRAY_VARS) -- else if ((var = find_variable (name + 1)) && array_p (var)) -+ else if ((var = find_variable (name + 1)) && (invisible_p (var) == 0) && array_p (var)) - { - t = array_reference (array_cell (var), 0); -- number = STRLEN (t); -+ number = MB_STRLEN (t); - } - #endif - else /* ${#PS1} */ -@@ -4766,7 +4786,7 @@ - if (list) - dispose_words (list); - -- number = STRLEN (t); -+ number = MB_STRLEN (t); - FREE (t); - } - } -@@ -4871,7 +4891,7 @@ - { - case VT_VARIABLE: - case VT_ARRAYMEMBER: -- len = strlen (value); -+ len = MB_STRLEN (value); - break; - case VT_POSPARMS: - len = number_of_args () + 1; -@@ -4879,8 +4899,9 @@ - #if defined (ARRAY_VARS) - case VT_ARRAYVAR: - a = (ARRAY *)value; -- /* For arrays, the first value deals with array indices. */ -- len = array_max_index (a); /* arrays index from 0 to n - 1 */ -+ /* For arrays, the first value deals with array indices. Negative -+ offsets count from one past the array's maximum index. */ -+ len = array_max_index (a) + (*e1p < 0); /* arrays index from 0 to n - 1 */ - break; - #endif - } -@@ -4891,7 +4912,7 @@ - if (*e1p < 0) /* negative offsets count from end */ - *e1p += len; - -- if (*e1p >= len || *e1p < 0) -+ if (*e1p > len || *e1p < 0) - return (-1); - - #if defined (ARRAY_VARS) -@@ -4982,7 +5003,7 @@ - else - return -1; - } -- else if ((v = find_variable (varname)) && array_p (v)) -+ else if ((v = find_variable (varname)) && (invisible_p (v) == 0) && array_p (v)) + #if defined (COND_COMMAND) + /* Just remove backslashes in STRING. Returns a new string. */ + char * +@@ -5248,7 +5255,7 @@ + else + t = (char *)0; + +- temp1 = expand_string_if_necessary (substr, Q_DOUBLE_QUOTES, expand_string); ++ temp1 = expand_arith_string (substr, Q_DOUBLE_QUOTES); + *e1p = evalexp (temp1, &expok); + free (temp1); + if (expok == 0) +@@ -5293,7 +5300,7 @@ { - vtype = VT_ARRAYMEMBER; - *varp = v; -diff -Naur bash-3.0.orig/tests/array.right bash-3.0/tests/array.right ---- bash-3.0.orig/tests/array.right 2003-10-05 03:25:10.000000000 +0000 -+++ bash-3.0/tests/array.right 2005-01-08 05:40:53.582965800 +0000 -@@ -170,8 +170,8 @@ - three five seven - positive offset - expect five seven - five seven --negative offset - expect five seven --five seven -+negative offset to unset element - expect seven -+seven - positive offset 2 - expect seven - seven - negative offset 2 - expect seven -diff -Naur bash-3.0.orig/tests/array.tests bash-3.0/tests/array.tests ---- bash-3.0.orig/tests/array.tests 2003-10-05 03:25:00.000000000 +0000 -+++ bash-3.0/tests/array.tests 2005-01-08 05:40:53.580966104 +0000 -@@ -322,7 +322,7 @@ - - echo positive offset - expect five seven - echo ${av[@]:5:2} --echo negative offset - expect five seven -+echo negative offset to unset element - expect seven - echo ${av[@]: -2:2} - - echo positive offset 2 - expect seven -diff -Naur bash-3.0.orig/tests/dbg-support.tests bash-3.0/tests/dbg-support.tests ---- bash-3.0.orig/tests/dbg-support.tests 2003-03-25 20:33:03.000000000 +0000 -+++ bash-3.0/tests/dbg-support.tests 2005-01-08 05:40:02.065797600 +0000 -@@ -62,8 +62,8 @@ - trap 'print_debug_trap $LINENO' DEBUG - trap 'print_return_trap $LINENO' RETURN - --# Funcname is now an array. Vanilla Bash 2.05 doesn't have FUNCNAME array. --echo "FUNCNAME" ${FUNCNAME[0]} -+# Funcname is now an array, but you still can't see it outside a function -+echo "FUNCNAME" ${FUNCNAME[0]:-main} - - # We should trace into the below. - # Start easy with a simple function. -diff -Naur bash-3.0.orig/tests/errors.right bash-3.0/tests/errors.right ---- bash-3.0.orig/tests/errors.right 2004-05-28 02:26:03.000000000 +0000 -+++ bash-3.0/tests/errors.right 2005-01-08 05:40:04.502427176 +0000 -@@ -85,7 +85,7 @@ - ./errors.tests: line 213: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0") - ./errors.tests: line 216: trap: NOSIG: invalid signal specification - ./errors.tests: line 219: trap: -s: invalid option --trap: usage: trap [-lp] [[arg] signal_spec ...] -+trap: usage: trap [-lp] [arg signal_spec ...] - ./errors.tests: line 225: return: can only `return' from a function or sourced script - ./errors.tests: line 229: break: 0: loop count out of range - ./errors.tests: line 233: continue: 0: loop count out of range -diff -Naur bash-3.0.orig/variables.c bash-3.0/variables.c ---- bash-3.0.orig/variables.c 2004-07-04 17:57:26.000000000 +0000 -+++ bash-3.0/variables.c 2005-01-08 05:40:01.842831496 +0000 -@@ -1419,11 +1419,11 @@ - v = init_dynamic_array_var ("GROUPS", get_groupset, null_array_assign, att_noassign); - - # if defined (DEBUGGER) -- v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, (att_invisible|att_noassign)); -- v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, (att_invisible|att_noassign)); -+ v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, att_noassign); -+ v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, att_noassign); - # endif /* DEBUGGER */ -- v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, (att_invisible|att_noassign)); -- v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, (att_invisible|att_noassign)); -+ v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, att_noassign); -+ v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, att_noassign); - #endif + t++; + temp2 = savestring (t); +- temp1 = expand_string_if_necessary (temp2, Q_DOUBLE_QUOTES, expand_string); ++ temp1 = expand_arith_string (temp2, Q_DOUBLE_QUOTES); + free (temp2); + t[-1] = ':'; + *e2p = evalexp (temp1, &expok); +@@ -6435,7 +6442,7 @@ + temp2[t_index] = '\0'; + + /* Expand variables found inside the expression. */ +- temp1 = expand_string_if_necessary (temp2, Q_DOUBLE_QUOTES, expand_string); ++ temp1 = expand_arith_string (temp2, Q_DOUBLE_QUOTES); + free (temp2); + + arithsub: +@@ -6477,7 +6484,7 @@ + zindex = t_index; + + /* Do initial variable expansion. */ +- temp1 = expand_string_if_necessary (temp, Q_DOUBLE_QUOTES, expand_string); ++ temp1 = expand_arith_string (temp, Q_DOUBLE_QUOTES); + + goto arithsub; + +@@ -6795,6 +6802,12 @@ + if (temp && *temp && t_index > 0) + { + temp1 = bash_tilde_expand (temp, tflag); ++ if (temp1 && *temp1 == '~' && STREQ (temp, temp1)) ++ { ++ FREE (temp); ++ FREE (temp1); ++ goto add_character; /* tilde expansion failed */ ++ } + free (temp); + temp = temp1; + sindex += t_index; +--- bash-3.1.orig/subst.h 2004-11-07 12:12:28.000000000 -0800 ++++ bash-3.1/subst.h 2006-04-19 15:59:29.000000000 -0700 +@@ -151,6 +151,9 @@ + extern char *expand_string_unsplit_to_string __P((char *, int)); + extern char *expand_assignment_string_to_string __P((char *, int)); + ++/* Expand an arithmetic expression string */ ++extern char *expand_arith_string __P((char *, int)); ++ + /* De-quoted quoted characters in STRING. */ + extern char *dequote_string __P((char *)); - v = init_funcname_var (); -@@ -1599,7 +1599,10 @@ - /* local foo; local foo; is a no-op. */ - old_var = find_variable (name); - if (old_var && local_p (old_var) && old_var->context == variable_context) -- return (old_var); -+ { -+ VUNSETATTR (old_var, att_invisible); -+ return (old_var); -+ } +--- bash-3.1.orig/variables.c 2005-11-12 18:22:37.000000000 -0800 ++++ bash-3.1/variables.c 2006-04-19 15:58:34.000000000 -0700 +@@ -860,9 +860,11 @@ + { + char val[INT_STRLEN_BOUND(int) + 1], *v; + ++#if defined (READLINE) + /* If we are currently assigning to LINES or COLUMNS, don't do anything. */ + if (winsize_assignment) + return; ++#endif - was_tmpvar = old_var && tempvar_p (old_var); - if (was_tmpvar) + v = inttostr (lines, val, sizeof (val)); + bind_variable ("LINES", v, 0); diff --git a/packages/base/bison/bison b/packages/base/bison/bison index 18b67cc..4229156 100644 --- a/packages/base/bison/bison +++ b/packages/base/bison/bison @@ -2,6 +2,6 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 2.0 -# [S] 1-8 2-9 -# [D] bison-2.0.tar.gz ftp://ftp.gnu.org/pub/gnu/bison/ +# [V] 2.3 +# [S] 1-3 2-9 +# [D] bison-2.3.tar.bz2 ftp://ftp.gnu.org/pub/gnu/bison/ diff --git a/packages/base/bzip2/bzip2 b/packages/base/bzip2/bzip2 index 484583c..0e069a9 100644 --- a/packages/base/bzip2/bzip2 +++ b/packages/base/bzip2/bzip2 @@ -3,12 +3,12 @@ # author: hackbard@hackdaworld.dyndns.org # # [V] 1.0.3 -# [S] 1-3 2-12 +# [S] 1-2 2-12 # [D] bzip2-1.0.3.tar.gz http://www.bzip.org/1.0.3/ e_ver=`echo $ver | awk -F. '{ print $1 "." $2 }'` -if [ "$hdw_status" = "2" ] ; then +if [ "$stage" = "2" ] ; then pre_install() { make -f Makefile-libbz2_so make clean @@ -16,10 +16,10 @@ if [ "$hdw_status" = "2" ] ; then } post_install() { - cp bzip2-shared $root/bin/bzip2 && - cp -a libbz2.so* $root/lib && - ln -svf ../../lib/libbz2.so.${e_ver} $root/usr/lib/libbz2.so && - rm $root/usr/bin/{bunzip2,bzcat,bzip2} && + cp -v bzip2-shared $root/bin/bzip2 && + cp -av libbz2.so* $root/lib && + ln -svf ../../lib/libbz2.so.${e_ver} $prefix/lib/libbz2.so && + rm -v $prefix/bin/{bunzip2,bzcat,bzip2} && ln -svf bzip2 $root/bin/bunzip2 && ln -svf bzip2 $root/bin/bzcat } diff --git a/packages/base/coreutils/coreutils b/packages/base/coreutils/coreutils index 1d90999..2f368eb 100644 --- a/packages/base/coreutils/coreutils +++ b/packages/base/coreutils/coreutils @@ -1,27 +1,19 @@ # hdw - linux coreutils package # -# author: hackbard@hackdaworld.dyndns.org +# author: hackbard@hackdaworld.org # -# [V] 5.2.1 +# [V] 6.3 # [S] 1-2 2-6 -# [D] coreutils-5.2.1.tar.bz2 ftp://ftp.gnu.org/gnu/coreutils/ +# [D] coreutils-6.3.tar.bz2 ftp://ftp.gnu.org/gnu/coreutils/ -pre_install() { - # old syntax compatibility - export DEFAULT_POSIX2_VERSION="199209" - } - -if [ "$hdw_status" = "2" ] ; then +if [ "$stage" = "2" ] ; then post_install() { - for i in basename cat chgrp chmod chown cp dd df \ - dir dircolors du date echo false head \ - install ln ls mkdir mkfifo mknod mv pwd \ - rm rmdir shred sync sleep stty su test \ - touch true uname vdir tr cut; do + for i in basename cat chgrp chmod chown cp date dd df echo \ + false hostname ln ls mkdir mknod mv pwd rm \ + rmdir stty sync true uname head sleep nice; do [ -f $prefix/bin/$i ] && \ - mv $prefix/bin/$i $root/bin + mv -v $prefix/bin/$i $root/bin done - ln -sf test $root/bin/[ - ln -sf ../../bin/install $prefix/bin + mv -v $prefix/bin/chroot $prefix/sbin } fi diff --git a/packages/base/coreutils/coreutils_dupes.patch b/packages/base/coreutils/coreutils_dupes.patch deleted file mode 100644 index 4256c84..0000000 --- a/packages/base/coreutils/coreutils_dupes.patch +++ /dev/null @@ -1,292 +0,0 @@ ---- coreutils-5.2.1.orig/Makefile.in 2004-03-27 15:05:45.000000000 +0000 -+++ coreutils-5.2.1/Makefile.in 2004-03-27 15:05:58.000000000 +0000 -@@ -127,7 +127,7 @@ - $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \ - $(top_srcdir)/m4/unlink-busy.m4 \ -- $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \ -+ $(top_srcdir)/m4/unlocked-io.m4 \ - $(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \ - $(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utimens.m4 \ - $(top_srcdir)/m4/utimes-null.m4 $(top_srcdir)/m4/utimes.m4 \ ---- coreutils-5.2.1.orig/README 2004-03-27 15:05:45.000000000 +0000 -+++ coreutils-5.2.1/README 2004-03-27 15:05:58.000000000 +0000 -@@ -9,11 +9,11 @@ - - [ basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd - df dir dircolors dirname du echo env expand expr factor false fmt fold -- ginstall groups head hostid hostname id join kill link ln logname ls -+ ginstall groups head hostid id join link ln logname ls - md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr - printenv printf ptx pwd readlink rm rmdir seq sha1sum shred sleep sort - split stat stty su sum sync tac tail tee test touch tr true tsort tty -- uname unexpand uniq unlink uptime users vdir wc who whoami yes -+ uname unexpand uniq unlink users vdir wc who whoami yes - - See the file NEWS for a list of major changes in the current release. - ---- coreutils-5.2.1.orig/configure 2004-03-27 15:05:45.000000000 +0000 -+++ coreutils-5.2.1/configure 2004-03-27 15:05:58.000000000 +0000 -@@ -47462,8 +47462,7 @@ - echo "$as_me:$LINENO: result: $gnulib_cv_have_boot_time" >&5 - echo "${ECHO_T}$gnulib_cv_have_boot_time" >&6 - if test $gnulib_cv_have_boot_time = yes; then -- OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uptime\$(EXEEXT)" -- MAN="$MAN uptime.1" -+echo "uptime is surpressed" - fi - - ---- coreutils-5.2.1.orig/man/Makefile.in 2004-03-27 15:05:45.000000000 +0000 -+++ coreutils-5.2.1/man/Makefile.in 2004-03-27 15:05:58.000000000 +0000 -@@ -122,7 +122,7 @@ - $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \ - $(top_srcdir)/m4/unlink-busy.m4 \ -- $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \ -+ $(top_srcdir)/m4/unlocked-io.m4 \ - $(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \ - $(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utimens.m4 \ - $(top_srcdir)/m4/utimes-null.m4 $(top_srcdir)/m4/utimes.m4 \ -@@ -266,13 +266,13 @@ - basename.1 cat.1 chgrp.1 chmod.1 chown.1 chroot.1 cksum.1 comm.1 \ - cp.1 csplit.1 cut.1 date.1 dd.1 df.1 dir.1 dircolors.1 dirname.1 du.1 \ - echo.1 env.1 expand.1 expr.1 factor.1 false.1 fmt.1 fold.1 groups.1 \ -- head.1 hostid.1 hostname.1 id.1 install.1 join.1 kill.1 \ -+ head.1 hostid.1 id.1 install.1 join.1 \ - link.1 ln.1 logname.1 \ - ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nice.1 nl.1 nohup.1 od.1 \ - paste.1 pathchk.1 pinky.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \ - rm.1 rmdir.1 seq.1 sha1sum.1 shred.1 sleep.1 sort.1 split.1 stat.1 stty.1 \ - su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \ -- tty.1 uname.1 unexpand.1 uniq.1 unlink.1 uptime.1 users.1 vdir.1 wc.1 \ -+ tty.1 uname.1 unexpand.1 uniq.1 unlink.1 users.1 vdir.1 wc.1 \ - who.1 whoami.1 yes.1 - - man_aux = $(dist_man_MANS:.1=.x) -@@ -535,11 +535,9 @@ - groups.1: $(common_dep) $(srcdir)/groups.x ../src/groups.sh - head.1: $(common_dep) $(srcdir)/head.x ../src/head.c - hostid.1: $(common_dep) $(srcdir)/hostid.x ../src/hostid.c --hostname.1: $(common_dep) $(srcdir)/hostname.x ../src/hostname.c - id.1: $(common_dep) $(srcdir)/id.x ../src/id.c - install.1: $(common_dep) $(srcdir)/install.x ../src/install.c - join.1: $(common_dep) $(srcdir)/join.x ../src/join.c --kill.1: $(common_dep) $(srcdir)/kill.x ../src/kill.c - link.1: $(common_dep) $(srcdir)/link.x ../src/link.c - ln.1: $(common_dep) $(srcdir)/ln.x ../src/ln.c - logname.1: $(common_dep) $(srcdir)/logname.x ../src/logname.c -@@ -588,7 +586,6 @@ - unexpand.1: $(common_dep) $(srcdir)/unexpand.x ../src/unexpand.c - uniq.1: $(common_dep) $(srcdir)/uniq.x ../src/uniq.c - unlink.1: $(common_dep) $(srcdir)/unlink.x ../src/unlink.c --uptime.1: $(common_dep) $(srcdir)/uptime.x ../src/uptime.c - users.1: $(common_dep) $(srcdir)/users.x ../src/users.c - vdir.1: $(common_dep) $(srcdir)/vdir.x ../src/ls.c - wc.1: $(common_dep) $(srcdir)/wc.x ../src/wc.c -@@ -619,7 +616,7 @@ - check-x-vs-1: - PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \ - t=ls-files.$$$$; \ -- (cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\ -+ (cd $(srcdir) && ls -1 *.x) | grep -v 'hostname.x' | grep -v 'uptime.x' | grep -v 'kill.x' | sed 's/\.x$$//' | $(ASSORT) > $$t; \ - echo $(dist_man_MANS) | tr -s ' ' '\n' | sed 's/\.1$$//' \ - | $(ASSORT) | diff - $$t || { rm $$t; exit 1; }; \ - rm $$t ---- coreutils-5.2.1.orig/src/Makefile.in 2004-03-27 15:05:45.000000000 +0000 -+++ coreutils-5.2.1/src/Makefile.in 2004-03-27 15:05:58.000000000 +0000 -@@ -16,7 +16,7 @@ - - - --SOURCES = $(__SOURCES) basename.c cat.c $(chgrp_SOURCES) chmod.c $(chown_SOURCES) chroot.c cksum.c comm.c $(cp_SOURCES) csplit.c cut.c date.c dd.c df.c $(dir_SOURCES) dircolors.c dirname.c du.c echo.c env.c expand.c expr.c factor.c false.c fmt.c fold.c $(ginstall_SOURCES) head.c hostid.c hostname.c id.c join.c kill.c link.c ln.c logname.c $(ls_SOURCES) $(md5sum_SOURCES) mkdir.c mkfifo.c mknod.c $(mv_SOURCES) nice.c nl.c nohup.c od.c paste.c pathchk.c pinky.c pr.c printenv.c printf.c ptx.c pwd.c readlink.c $(rm_SOURCES) rmdir.c seq.c setuidgid.c $(sha1sum_SOURCES) shred.c sleep.c sort.c split.c stat.c stty.c su.c sum.c sync.c tac.c tail.c tee.c test.c touch.c tr.c true.c tsort.c tty.c uname.c unexpand.c uniq.c unlink.c uptime.c users.c $(vdir_SOURCES) wc.c who.c whoami.c yes.c -+SOURCES = $(__SOURCES) basename.c cat.c $(chgrp_SOURCES) chmod.c $(chown_SOURCES) chroot.c cksum.c comm.c $(cp_SOURCES) csplit.c cut.c date.c dd.c df.c $(dir_SOURCES) dircolors.c dirname.c du.c echo.c env.c expand.c expr.c factor.c false.c fmt.c fold.c $(ginstall_SOURCES) head.c hostid.c id.c join.c link.c ln.c logname.c $(ls_SOURCES) $(md5sum_SOURCES) mkdir.c mkfifo.c mknod.c $(mv_SOURCES) nice.c nl.c nohup.c od.c paste.c pathchk.c pinky.c pr.c printenv.c printf.c ptx.c pwd.c readlink.c $(rm_SOURCES) rmdir.c seq.c setuidgid.c $(sha1sum_SOURCES) shred.c sleep.c sort.c split.c stat.c stty.c su.c sum.c sync.c tac.c tail.c tee.c test.c touch.c tr.c true.c tsort.c tty.c uname.c unexpand.c uniq.c unlink.c users.c $(vdir_SOURCES) wc.c who.c whoami.c yes.c - - srcdir = @srcdir@ - top_srcdir = @top_srcdir@ -@@ -40,7 +40,7 @@ - host_triplet = @host@ - EXTRA_PROGRAMS = chroot$(EXEEXT) df$(EXEEXT) hostid$(EXEEXT) \ - nice$(EXEEXT) pinky$(EXEEXT) stty$(EXEEXT) su$(EXEEXT) \ -- uname$(EXEEXT) uptime$(EXEEXT) users$(EXEEXT) who$(EXEEXT) -+ uname$(EXEEXT) users$(EXEEXT) who$(EXEEXT) - bin_PROGRAMS = [$(EXEEXT) chgrp$(EXEEXT) chown$(EXEEXT) chmod$(EXEEXT) \ - cp$(EXEEXT) dd$(EXEEXT) dircolors$(EXEEXT) du$(EXEEXT) \ - ginstall$(EXEEXT) link$(EXEEXT) ln$(EXEEXT) dir$(EXEEXT) \ -@@ -56,8 +56,8 @@ - tail$(EXEEXT) tr$(EXEEXT) tsort$(EXEEXT) unexpand$(EXEEXT) \ - uniq$(EXEEXT) wc$(EXEEXT) basename$(EXEEXT) date$(EXEEXT) \ - dirname$(EXEEXT) echo$(EXEEXT) env$(EXEEXT) expr$(EXEEXT) \ -- factor$(EXEEXT) false$(EXEEXT) hostname$(EXEEXT) id$(EXEEXT) \ -- kill$(EXEEXT) logname$(EXEEXT) pathchk$(EXEEXT) \ -+ factor$(EXEEXT) false$(EXEEXT) id$(EXEEXT) \ -+ logname$(EXEEXT) pathchk$(EXEEXT) \ - printenv$(EXEEXT) printf$(EXEEXT) pwd$(EXEEXT) seq$(EXEEXT) \ - sleep$(EXEEXT) tee$(EXEEXT) test$(EXEEXT) true$(EXEEXT) \ - tty$(EXEEXT) whoami$(EXEEXT) yes$(EXEEXT) $(am__EXEEXT_1) \ -@@ -151,7 +151,7 @@ - $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ - $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \ - $(top_srcdir)/m4/unlink-busy.m4 \ -- $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \ -+ $(top_srcdir)/m4/unlocked-io.m4 \ - $(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \ - $(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utimens.m4 \ - $(top_srcdir)/m4/utimes-null.m4 $(top_srcdir)/m4/utimes.m4 \ -@@ -320,11 +320,6 @@ - hostid_LDADD = $(LDADD) - hostid_DEPENDENCIES = ../lib/libfetish.a $(am__DEPENDENCIES_1) \ - ../lib/libfetish.a --hostname_SOURCES = hostname.c --hostname_OBJECTS = hostname.$(OBJEXT) --hostname_LDADD = $(LDADD) --hostname_DEPENDENCIES = ../lib/libfetish.a $(am__DEPENDENCIES_1) \ -- ../lib/libfetish.a - id_SOURCES = id.c - id_OBJECTS = id.$(OBJEXT) - id_LDADD = $(LDADD) -@@ -335,11 +330,6 @@ - join_LDADD = $(LDADD) - join_DEPENDENCIES = ../lib/libfetish.a $(am__DEPENDENCIES_1) \ - ../lib/libfetish.a --kill_SOURCES = kill.c --kill_OBJECTS = kill.$(OBJEXT) --kill_LDADD = $(LDADD) --kill_DEPENDENCIES = ../lib/libfetish.a $(am__DEPENDENCIES_1) \ -- ../lib/libfetish.a - link_SOURCES = link.c - link_OBJECTS = link.$(OBJEXT) - link_LDADD = $(LDADD) -@@ -574,9 +564,6 @@ - unlink_LDADD = $(LDADD) - unlink_DEPENDENCIES = ../lib/libfetish.a $(am__DEPENDENCIES_1) \ - ../lib/libfetish.a --uptime_SOURCES = uptime.c --uptime_OBJECTS = uptime.$(OBJEXT) --uptime_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) - users_SOURCES = users.c - users_OBJECTS = users.$(OBJEXT) - users_LDADD = $(LDADD) -@@ -625,9 +612,9 @@ - @AMDEP_TRUE@ ./$(DEPDIR)/factor.Po ./$(DEPDIR)/false.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/fmt.Po ./$(DEPDIR)/fold.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/head.Po ./$(DEPDIR)/hostid.Po \ --@AMDEP_TRUE@ ./$(DEPDIR)/hostname.Po ./$(DEPDIR)/id.Po \ -+@AMDEP_TRUE@ ./$(DEPDIR)/id.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/install.Po ./$(DEPDIR)/join.Po \ --@AMDEP_TRUE@ ./$(DEPDIR)/kill.Po ./$(DEPDIR)/lbracket.Po \ -+@AMDEP_TRUE@ ./$(DEPDIR)/lbracket.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/link.Po ./$(DEPDIR)/ln.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/logname.Po ./$(DEPDIR)/ls-dir.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/ls-ls.Po ./$(DEPDIR)/ls-vdir.Po \ -@@ -655,7 +642,7 @@ - @AMDEP_TRUE@ ./$(DEPDIR)/tsort.Po ./$(DEPDIR)/tty.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/uname.Po ./$(DEPDIR)/unexpand.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/uniq.Po ./$(DEPDIR)/unlink.Po \ --@AMDEP_TRUE@ ./$(DEPDIR)/uptime.Po ./$(DEPDIR)/users.Po \ -+@AMDEP_TRUE@ ./$(DEPDIR)/users.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/wc.Po ./$(DEPDIR)/who.Po \ - @AMDEP_TRUE@ ./$(DEPDIR)/whoami.Po ./$(DEPDIR)/yes.Po - COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ -@@ -666,29 +653,29 @@ - $(chown_SOURCES) chroot.c cksum.c comm.c $(cp_SOURCES) \ - csplit.c cut.c date.c dd.c df.c $(dir_SOURCES) dircolors.c \ - dirname.c du.c echo.c env.c expand.c expr.c factor.c false.c \ -- fmt.c fold.c $(ginstall_SOURCES) head.c hostid.c hostname.c \ -- id.c join.c kill.c link.c ln.c logname.c $(ls_SOURCES) \ -+ fmt.c fold.c $(ginstall_SOURCES) head.c hostid.c \ -+ id.c join.c link.c ln.c logname.c $(ls_SOURCES) \ - $(md5sum_SOURCES) mkdir.c mkfifo.c mknod.c $(mv_SOURCES) \ - nice.c nl.c nohup.c od.c paste.c pathchk.c pinky.c pr.c \ - printenv.c printf.c ptx.c pwd.c readlink.c $(rm_SOURCES) \ - rmdir.c seq.c setuidgid.c $(sha1sum_SOURCES) shred.c sleep.c \ - sort.c split.c stat.c stty.c su.c sum.c sync.c tac.c tail.c \ - tee.c test.c touch.c tr.c true.c tsort.c tty.c uname.c \ -- unexpand.c uniq.c unlink.c uptime.c users.c $(vdir_SOURCES) \ -+ unexpand.c uniq.c unlink.c users.c $(vdir_SOURCES) \ - wc.c who.c whoami.c yes.c - DIST_SOURCES = $(__SOURCES) basename.c cat.c $(chgrp_SOURCES) chmod.c \ - $(chown_SOURCES) chroot.c cksum.c comm.c $(cp_SOURCES) \ - csplit.c cut.c date.c dd.c df.c $(dir_SOURCES) dircolors.c \ - dirname.c du.c echo.c env.c expand.c expr.c factor.c false.c \ -- fmt.c fold.c $(ginstall_SOURCES) head.c hostid.c hostname.c \ -- id.c join.c kill.c link.c ln.c logname.c $(ls_SOURCES) \ -+ fmt.c fold.c $(ginstall_SOURCES) head.c hostid.c \ -+ id.c join.c link.c ln.c logname.c $(ls_SOURCES) \ - $(md5sum_SOURCES) mkdir.c mkfifo.c mknod.c $(mv_SOURCES) \ - nice.c nl.c nohup.c od.c paste.c pathchk.c pinky.c pr.c \ - printenv.c printf.c ptx.c pwd.c readlink.c $(rm_SOURCES) \ - rmdir.c seq.c setuidgid.c $(sha1sum_SOURCES) shred.c sleep.c \ - sort.c split.c stat.c stty.c su.c sum.c sync.c tac.c tail.c \ - tee.c test.c touch.c tr.c true.c tsort.c tty.c uname.c \ -- unexpand.c uniq.c unlink.c uptime.c users.c $(vdir_SOURCES) \ -+ unexpand.c uniq.c unlink.c users.c $(vdir_SOURCES) \ - wc.c who.c whoami.c yes.c - HEADERS = $(noinst_HEADERS) - ETAGS = etags -@@ -860,7 +847,6 @@ - - sleep_LDADD = $(nanosec_libs) - tail_LDADD = $(nanosec_libs) --uptime_LDADD = $(LDADD) $(GETLOADAVG_LIBS) - su_LDADD = $(LDADD) $(LIB_CRYPT) - SUFFIXES = .sh - installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'` -@@ -1083,18 +1069,12 @@ - hostid$(EXEEXT): $(hostid_OBJECTS) $(hostid_DEPENDENCIES) - @rm -f hostid$(EXEEXT) - $(LINK) $(hostid_LDFLAGS) $(hostid_OBJECTS) $(hostid_LDADD) $(LIBS) --hostname$(EXEEXT): $(hostname_OBJECTS) $(hostname_DEPENDENCIES) -- @rm -f hostname$(EXEEXT) -- $(LINK) $(hostname_LDFLAGS) $(hostname_OBJECTS) $(hostname_LDADD) $(LIBS) - id$(EXEEXT): $(id_OBJECTS) $(id_DEPENDENCIES) - @rm -f id$(EXEEXT) - $(LINK) $(id_LDFLAGS) $(id_OBJECTS) $(id_LDADD) $(LIBS) - join$(EXEEXT): $(join_OBJECTS) $(join_DEPENDENCIES) - @rm -f join$(EXEEXT) - $(LINK) $(join_LDFLAGS) $(join_OBJECTS) $(join_LDADD) $(LIBS) --kill$(EXEEXT): $(kill_OBJECTS) $(kill_DEPENDENCIES) -- @rm -f kill$(EXEEXT) -- $(LINK) $(kill_LDFLAGS) $(kill_OBJECTS) $(kill_LDADD) $(LIBS) - link$(EXEEXT): $(link_OBJECTS) $(link_DEPENDENCIES) - @rm -f link$(EXEEXT) - $(LINK) $(link_LDFLAGS) $(link_OBJECTS) $(link_LDADD) $(LIBS) -@@ -1242,9 +1222,6 @@ - unlink$(EXEEXT): $(unlink_OBJECTS) $(unlink_DEPENDENCIES) - @rm -f unlink$(EXEEXT) - $(LINK) $(unlink_LDFLAGS) $(unlink_OBJECTS) $(unlink_LDADD) $(LIBS) --uptime$(EXEEXT): $(uptime_OBJECTS) $(uptime_DEPENDENCIES) -- @rm -f uptime$(EXEEXT) -- $(LINK) $(uptime_LDFLAGS) $(uptime_OBJECTS) $(uptime_LDADD) $(LIBS) - users$(EXEEXT): $(users_OBJECTS) $(users_DEPENDENCIES) - @rm -f users$(EXEEXT) - $(LINK) $(users_LDFLAGS) $(users_OBJECTS) $(users_LDADD) $(LIBS) -@@ -1333,11 +1310,9 @@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fold.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/head.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostid.Po@am__quote@ --@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostname.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/install.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/join.Po@am__quote@ --@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kill.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lbracket.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/link.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ln.Po@am__quote@ -@@ -1393,7 +1368,6 @@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unexpand.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uniq.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unlink.Po@am__quote@ --@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uptime.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/users.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wc.Po@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/who.Po@am__quote@ -@@ -1623,7 +1597,7 @@ - && can_create_suid_root_executable=yes; \ - rm -f $$TMPFILE; \ - if test $$can_create_suid_root_executable = yes; then \ -- $(INSTALL_SU); \ -+ echo "Installation of su is surpressed"; \ - else \ - echo "WARNING: insufficient access; not installing su"; \ - echo "NOTE: to install su, run 'make install-root' as root"; \ diff --git a/packages/base/coreutils/coreutils_i18n.patch b/packages/base/coreutils/coreutils_i18n.patch new file mode 100644 index 0000000..507e7e8 --- /dev/null +++ b/packages/base/coreutils/coreutils_i18n.patch @@ -0,0 +1,4052 @@ +diff -Naur coreutils-6.1.orig/lib/linebuffer.h coreutils-6.1/lib/linebuffer.h +--- coreutils-6.1.orig/lib/linebuffer.h 2005-05-14 07:58:06.000000000 +0000 ++++ coreutils-6.1/lib/linebuffer.h 2006-08-23 20:08:12.000000000 +0000 +@@ -22,6 +22,11 @@ + + # include + ++/* Get mbstate_t. */ ++# if HAVE_WCHAR_H ++# include ++# endif ++ + /* A `struct linebuffer' holds a line of text. */ + + struct linebuffer +@@ -29,6 +34,9 @@ + size_t size; /* Allocated. */ + size_t length; /* Used. */ + char *buffer; ++# if HAVE_WCHAR_H ++ mbstate_t state; ++# endif + }; + + /* Initialize linebuffer LINEBUFFER for use. */ +diff -Naur coreutils-6.1.orig/src/cut.c coreutils-6.1/src/cut.c +--- coreutils-6.1.orig/src/cut.c 2006-07-09 17:20:43.000000000 +0000 ++++ coreutils-6.1/src/cut.c 2006-08-23 20:08:12.000000000 +0000 +@@ -29,6 +29,11 @@ + #include + #include + #include ++ ++/* Get mbstate_t, mbrtowc(). */ ++#if HAVE_WCHAR_H ++# include ++#endif + #include "system.h" + + #include "error.h" +@@ -37,6 +42,18 @@ + #include "quote.h" + #include "xstrndup.h" + ++/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC ++ installation; work around this configuration error. */ ++#if !defined MB_LEN_MAX || MB_LEN_MAX < 2 ++# undef MB_LEN_MAX ++# define MB_LEN_MAX 16 ++#endif ++ ++/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ ++#if HAVE_MBRTOWC && defined mbstate_t ++# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) ++#endif ++ + /* The official name of this program (e.g., no `g' prefix). */ + #define PROGRAM_NAME "cut" + +@@ -67,6 +84,52 @@ + } \ + while (0) + ++/* Refill the buffer BUF to get a multibyte character. */ ++#define REFILL_BUFFER(BUF, BUFPOS, BUFLEN, STREAM) \ ++ do \ ++ { \ ++ if (BUFLEN < MB_LEN_MAX && !feof (STREAM) && !ferror (STREAM)) \ ++ { \ ++ memmove (BUF, BUFPOS, BUFLEN); \ ++ BUFLEN += fread (BUF + BUFLEN, sizeof(char), BUFSIZ, STREAM); \ ++ BUFPOS = BUF; \ ++ } \ ++ } \ ++ while (0) ++ ++/* Get wide character on BUFPOS. BUFPOS is not included after that. ++ If byte sequence is not valid as a character, CONVFAIL is 1. Otherwise 0. */ ++#define GET_NEXT_WC_FROM_BUFFER(WC, BUFPOS, BUFLEN, MBLENGTH, STATE, CONVFAIL) \ ++ do \ ++ { \ ++ mbstate_t state_bak; \ ++ \ ++ if (BUFLEN < 1) \ ++ { \ ++ WC = WEOF; \ ++ break; \ ++ } \ ++ \ ++ /* Get a wide character. */ \ ++ CONVFAIL = 0; \ ++ state_bak = STATE; \ ++ MBLENGTH = mbrtowc ((wchar_t *)&WC, BUFPOS, BUFLEN, &STATE); \ ++ \ ++ switch (MBLENGTH) \ ++ { \ ++ case (size_t)-1: \ ++ case (size_t)-2: \ ++ CONVFAIL++; \ ++ STATE = state_bak; \ ++ /* Fall througn. */ \ ++ \ ++ case 0: \ ++ MBLENGTH = 1; \ ++ break; \ ++ } \ ++ } \ ++ while (0) ++ + struct range_pair + { + size_t lo; +@@ -85,7 +148,7 @@ + /* The number of bytes allocated for FIELD_1_BUFFER. */ + static size_t field_1_bufsize; + +-/* The largest field or byte index used as an endpoint of a closed ++/* The largest byte, character or field index used as an endpoint of a closed + or degenerate range specification; this doesn't include the starting + index of right-open-ended ranges. For example, with either range spec + `2-5,9-', `2-3,5,9-' this variable would be set to 5. */ +@@ -97,10 +160,11 @@ + + /* This is a bit vector. + In byte mode, which bytes to output. ++ In character mode, which characters to output. + In field mode, which DELIM-separated fields to output. +- Both bytes and fields are numbered starting with 1, ++ Bytes, characters and fields are numbered starting with 1, + so the zeroth bit of this array is unused. +- A field or byte K has been selected if ++ A byte, character or field K has been selected if + (K <= MAX_RANGE_ENDPOINT and is_printable_field(K)) + || (EOL_RANGE_START > 0 && K >= EOL_RANGE_START). */ + static unsigned char *printable_field; +@@ -109,9 +173,12 @@ + { + undefined_mode, + +- /* Output characters that are in the given bytes. */ ++ /* Output bytes that are at the given positions. */ + byte_mode, + ++ /* Output characters that are at the given positions. */ ++ character_mode, ++ + /* Output the given delimeter-separated fields. */ + field_mode + }; +@@ -121,6 +188,13 @@ + + static enum operating_mode operating_mode; + ++/* If nonzero, when in byte mode, don't split multibyte characters. */ ++static int byte_mode_character_aware; ++ ++/* If nonzero, the function for single byte locale is work ++ if this program runs on multibyte locale. */ ++static int force_singlebyte_mode; ++ + /* If true do not output lines containing no delimeter characters. + Otherwise, all such lines are printed. This option is valid only + with field mode. */ +@@ -132,6 +206,9 @@ + + /* The delimeter character for field mode. */ + static unsigned char delim; ++#if HAVE_WCHAR_H ++static wchar_t wcdelim; ++#endif + + /* True if the --output-delimiter=STRING option was specified. */ + static bool output_delimiter_specified; +@@ -205,7 +282,7 @@ + -f, --fields=LIST select only these fields; also print any line\n\ + that contains no delimiter character, unless\n\ + the -s option is specified\n\ +- -n (ignored)\n\ ++ -n with -b: don't split multibyte characters\n\ + "), stdout); + fputs (_("\ + --complement complement the set of selected bytes, characters\n\ +@@ -360,7 +437,7 @@ + in_digits = false; + /* Starting a range. */ + if (dash_found) +- FATAL_ERROR (_("invalid byte or field list")); ++ FATAL_ERROR (_("invalid byte, character or field list")); + dash_found = true; + fieldstr++; + +@@ -385,14 +462,16 @@ + if (value == 0) + { + /* `n-'. From `initial' to end of line. */ +- eol_range_start = initial; ++ if (eol_range_start == 0 || ++ (eol_range_start != 0 && eol_range_start > initial)) ++ eol_range_start = initial; + field_found = true; + } + else + { + /* `m-n' or `-n' (1-n). */ + if (value < initial) +- FATAL_ERROR (_("invalid byte or field list")); ++ FATAL_ERROR (_("invalid byte, character or field list")); + + /* Is there already a range going to end of line? */ + if (eol_range_start != 0) +@@ -465,6 +544,9 @@ + if (operating_mode == byte_mode) + error (0, 0, + _("byte offset %s is too large"), quote (bad_num)); ++ else if (operating_mode == character_mode) ++ error (0, 0, ++ _("character offset %s is too large"), quote (bad_num)); + else + error (0, 0, + _("field number %s is too large"), quote (bad_num)); +@@ -475,7 +557,7 @@ + fieldstr++; + } + else +- FATAL_ERROR (_("invalid byte or field list")); ++ FATAL_ERROR (_("invalid byte, character or field list")); + } + + max_range_endpoint = 0; +@@ -568,6 +650,63 @@ + } + } + ++#if HAVE_MBRTOWC ++/* This function is in use for the following case. ++ ++ 1. Read from the stream STREAM, printing to standard output any selected ++ characters. ++ ++ 2. Read from stream STREAM, printing to standard output any selected bytes, ++ without splitting multibyte characters. */ ++ ++static void ++cut_characters_or_cut_bytes_no_split (FILE *stream) ++{ ++ int idx; /* number of bytes or characters in the line so far. */ ++ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */ ++ char *bufpos; /* Next read position of BUF. */ ++ size_t buflen; /* The length of the byte sequence in buf. */ ++ wint_t wc; /* A gotten wide character. */ ++ size_t mblength; /* The byte size of a multibyte character which shows ++ as same character as WC. */ ++ mbstate_t state; /* State of the stream. */ ++ int convfail; /* 1, when conversion is failed. Otherwise 0. */ ++ ++ idx = 0; ++ buflen = 0; ++ bufpos = buf; ++ memset (&state, '\0', sizeof(mbstate_t)); ++ ++ while (1) ++ { ++ REFILL_BUFFER (buf, bufpos, buflen, stream); ++ ++ GET_NEXT_WC_FROM_BUFFER (wc, bufpos, buflen, mblength, state, convfail); ++ ++ if (wc == WEOF) ++ { ++ if (idx > 0) ++ putchar ('\n'); ++ break; ++ } ++ else if (wc == L'\n') ++ { ++ putchar ('\n'); ++ idx = 0; ++ } ++ else ++ { ++ idx += (operating_mode == byte_mode) ? mblength : 1; ++ if (print_kth (idx, NULL)) ++ fwrite (bufpos, mblength, sizeof(char), stdout); ++ } ++ ++ buflen -= mblength; ++ bufpos += mblength; ++ } ++} ++#endif ++ + /* Read from stream STREAM, printing to standard output any selected fields. */ + + static void +@@ -689,13 +828,192 @@ + } + } + ++#if HAVE_MBRTOWC ++static void ++cut_fields_mb (FILE *stream) ++{ ++ int c; ++ unsigned int field_idx; ++ int found_any_selected_field; ++ int buffer_first_field; ++ int empty_input; ++ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */ ++ char *bufpos; /* Next read position of BUF. */ ++ size_t buflen; /* The length of the byte sequence in buf. */ ++ wint_t wc = 0; /* A gotten wide character. */ ++ size_t mblength; /* The byte size of a multibyte character which shows ++ as same character as WC. */ ++ mbstate_t state; /* State of the stream. */ ++ int convfail; /* 1, when conversion is failed. Otherwise 0. */ ++ ++ found_any_selected_field = 0; ++ field_idx = 1; ++ bufpos = buf; ++ buflen = 0; ++ memset (&state, '\0', sizeof(mbstate_t)); ++ ++ c = getc (stream); ++ empty_input = (c == EOF); ++ if (c != EOF) ++ ungetc (c, stream); ++ else ++ wc = WEOF; ++ ++ /* To support the semantics of the -s flag, we may have to buffer ++ all of the first field to determine whether it is `delimited.' ++ But that is unnecessary if all non-delimited lines must be printed ++ and the first field has been selected, or if non-delimited lines ++ must be suppressed and the first field has *not* been selected. ++ That is because a non-delimited line has exactly one field. */ ++ buffer_first_field = (suppress_non_delimited ^ !print_kth (1, NULL)); ++ ++ while (1) ++ { ++ if (field_idx == 1 && buffer_first_field) ++ { ++ int len = 0; ++ ++ while (1) ++ { ++ REFILL_BUFFER (buf, bufpos, buflen, stream); ++ ++ GET_NEXT_WC_FROM_BUFFER ++ (wc, bufpos, buflen, mblength, state, convfail); ++ ++ if (wc == WEOF) ++ break; ++ ++ field_1_buffer = xrealloc (field_1_buffer, len + mblength); ++ memcpy (field_1_buffer + len, bufpos, mblength); ++ len += mblength; ++ buflen -= mblength; ++ bufpos += mblength; ++ ++ if (!convfail && (wc == L'\n' || wc == wcdelim)) ++ break; ++ } ++ ++ if (wc == WEOF) ++ break; ++ ++ /* If the first field extends to the end of line (it is not ++ delimited) and we are printing all non-delimited lines, ++ print this one. */ ++ if (convfail || (!convfail && wc != wcdelim)) ++ { ++ if (suppress_non_delimited) ++ { ++ /* Empty. */ ++ } ++ else ++ { ++ fwrite (field_1_buffer, sizeof (char), len, stdout); ++ /* Make sure the output line is newline terminated. */ ++ if (convfail || (!convfail && wc != L'\n')) ++ putchar ('\n'); ++ } ++ continue; ++ } ++ ++ if (print_kth (1, NULL)) ++ { ++ /* Print the field, but not the trailing delimiter. */ ++ fwrite (field_1_buffer, sizeof (char), len - 1, stdout); ++ found_any_selected_field = 1; ++ } ++ ++field_idx; ++ } ++ ++ if (wc != WEOF) ++ { ++ if (print_kth (field_idx, NULL)) ++ { ++ if (found_any_selected_field) ++ { ++ fwrite (output_delimiter_string, sizeof (char), ++ output_delimiter_length, stdout); ++ } ++ found_any_selected_field = 1; ++ } ++ ++ while (1) ++ { ++ REFILL_BUFFER (buf, bufpos, buflen, stream); ++ ++ GET_NEXT_WC_FROM_BUFFER ++ (wc, bufpos, buflen, mblength, state, convfail); ++ ++ if (wc == WEOF) ++ break; ++ else if (!convfail && (wc == wcdelim || wc == L'\n')) ++ { ++ buflen -= mblength; ++ bufpos += mblength; ++ break; ++ } ++ ++ if (print_kth (field_idx, NULL)) ++ fwrite (bufpos, mblength, sizeof(char), stdout); ++ ++ buflen -= mblength; ++ bufpos += mblength; ++ } ++ } ++ ++ if ((!convfail || wc == L'\n') && buflen < 1) ++ wc = WEOF; ++ ++ if (!convfail && wc == wcdelim) ++ ++field_idx; ++ else if (wc == WEOF || (!convfail && wc == L'\n')) ++ { ++ if (found_any_selected_field ++ || (!empty_input && !(suppress_non_delimited && field_idx == 1))) ++ putchar ('\n'); ++ if (wc == WEOF) ++ break; ++ field_idx = 1; ++ found_any_selected_field = 0; ++ } ++ } ++} ++#endif ++ + static void + cut_stream (FILE *stream) + { +- if (operating_mode == byte_mode) +- cut_bytes (stream); ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1 && !force_singlebyte_mode) ++ { ++ switch (operating_mode) ++ { ++ case byte_mode: ++ if (byte_mode_character_aware) ++ cut_characters_or_cut_bytes_no_split (stream); ++ else ++ cut_bytes (stream); ++ break; ++ ++ case character_mode: ++ cut_characters_or_cut_bytes_no_split (stream); ++ break; ++ ++ case field_mode: ++ cut_fields_mb (stream); ++ break; ++ ++ default: ++ abort (); ++ } ++ } + else +- cut_fields (stream); ++#endif ++ { ++ if (operating_mode == field_mode) ++ cut_fields (stream); ++ else ++ cut_bytes (stream); ++ } + } + + /* Process file FILE to standard output. +@@ -745,6 +1063,8 @@ + bool ok; + bool delim_specified = false; + char *spec_list_string IF_LINT(= NULL); ++ char mbdelim[MB_LEN_MAX + 1]; ++ size_t delimlen = 0; + + initialize_main (&argc, &argv); + program_name = argv[0]; +@@ -767,7 +1087,6 @@ + switch (optc) + { + case 'b': +- case 'c': + /* Build the byte list. */ + if (operating_mode != undefined_mode) + FATAL_ERROR (_("only one type of list may be specified")); +@@ -775,6 +1094,14 @@ + spec_list_string = optarg; + break; + ++ case 'c': ++ /* Build the character list. */ ++ if (operating_mode != undefined_mode) ++ FATAL_ERROR (_("only one type of list may be specified")); ++ operating_mode = character_mode; ++ spec_list_string = optarg; ++ break; ++ + case 'f': + /* Build the field list. */ + if (operating_mode != undefined_mode) +@@ -786,10 +1113,35 @@ + case 'd': + /* New delimiter. */ + /* Interpret -d '' to mean `use the NUL byte as the delimiter.' */ +- if (optarg[0] != '\0' && optarg[1] != '\0') +- FATAL_ERROR (_("the delimiter must be a single character")); +- delim = optarg[0]; +- delim_specified = true; ++#if HAVE_MBRTOWC ++ { ++ if(MB_CUR_MAX > 1) ++ { ++ mbstate_t state; ++ ++ memset (&state, '\0', sizeof(mbstate_t)); ++ delimlen = mbrtowc (&wcdelim, optarg, strnlen(optarg, MB_LEN_MAX), &state); ++ ++ if (delimlen == (size_t)-1 || delimlen == (size_t)-2) ++ ++force_singlebyte_mode; ++ else ++ { ++ delimlen = (delimlen < 1) ? 1 : delimlen; ++ if (wcdelim != L'\0' && *(optarg + delimlen) != '\0') ++ FATAL_ERROR (_("the delimiter must be a single character")); ++ memcpy (mbdelim, optarg, delimlen); ++ } ++ } ++ ++ if (MB_CUR_MAX <= 1 || force_singlebyte_mode) ++#endif ++ { ++ if (optarg[0] != '\0' && optarg[1] != '\0') ++ FATAL_ERROR (_("the delimiter must be a single character")); ++ delim = (unsigned char) optarg[0]; ++ } ++ delim_specified = true; ++ } + break; + + case OUTPUT_DELIMITER_OPTION: +@@ -802,6 +1154,7 @@ + break; + + case 'n': ++ byte_mode_character_aware = 1; + break; + + case 's': +@@ -824,7 +1177,7 @@ + if (operating_mode == undefined_mode) + FATAL_ERROR (_("you must specify a list of bytes, characters, or fields")); + +- if (delim != '\0' && operating_mode != field_mode) ++ if (delim_specified && operating_mode != field_mode) + FATAL_ERROR (_("an input delimiter may be specified only\ + when operating on fields")); + +@@ -851,15 +1204,34 @@ + } + + if (!delim_specified) +- delim = '\t'; ++ { ++ delim = '\t'; ++#ifdef HAVE_MBRTOWC ++ wcdelim = L'\t'; ++ mbdelim[0] = '\t'; ++ mbdelim[1] = '\0'; ++ delimlen = 1; ++#endif ++ } + + if (output_delimiter_string == NULL) + { +- static char dummy[2]; +- dummy[0] = delim; +- dummy[1] = '\0'; +- output_delimiter_string = dummy; +- output_delimiter_length = 1; ++#ifdef HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1 && !force_singlebyte_mode) ++ { ++ output_delimiter_string = xstrdup(mbdelim); ++ output_delimiter_length = delimlen; ++ } ++ ++ if (MB_CUR_MAX <= 1 || force_singlebyte_mode) ++#endif ++ { ++ static char dummy[2]; ++ dummy[0] = delim; ++ dummy[1] = '\0'; ++ output_delimiter_string = dummy; ++ output_delimiter_length = 1; ++ } + } + + if (optind == argc) +diff -Naur coreutils-6.1.orig/src/expand.c coreutils-6.1/src/expand.c +--- coreutils-6.1.orig/src/expand.c 2006-07-09 17:03:29.000000000 +0000 ++++ coreutils-6.1/src/expand.c 2006-08-23 20:08:12.000000000 +0000 +@@ -38,11 +38,28 @@ + #include + #include + #include ++ ++/* Get mbstate_t, mbrtowc(), wcwidth(). */ ++#if HAVE_WCHAR_H ++# include ++#endif ++ + #include "system.h" + #include "error.h" + #include "quote.h" + #include "xstrndup.h" + ++/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC ++ installation; work around this configuration error. */ ++#if !defined MB_LEN_MAX || MB_LEN_MAX < 2 ++# define MB_LEN_MAX 16 ++#endif ++ ++/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ ++#if HAVE_MBRTOWC && defined mbstate_t ++# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) ++#endif ++ + /* The official name of this program (e.g., no `g' prefix). */ + #define PROGRAM_NAME "expand" + +@@ -183,6 +200,7 @@ + stops = num_start + len - 1; + } + } ++ + else + { + error (0, 0, _("tab size contains invalid character(s): %s"), +@@ -365,6 +383,142 @@ + } + } + ++#if HAVE_MBRTOWC ++static void ++expand_multibyte (void) ++{ ++ FILE *fp; /* Input strem. */ ++ mbstate_t i_state; /* Current shift state of the input stream. */ ++ mbstate_t i_state_bak; /* Back up the I_STATE. */ ++ mbstate_t o_state; /* Current shift state of the output stream. */ ++ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */ ++ char *bufpos; /* Next read position of BUF. */ ++ size_t buflen = 0; /* The length of the byte sequence in buf. */ ++ wchar_t wc; /* A gotten wide character. */ ++ size_t mblength; /* The byte size of a multibyte character ++ which shows as same character as WC. */ ++ int tab_index = 0; /* Index in `tab_list' of next tabstop. */ ++ int column = 0; /* Column on screen of the next char. */ ++ int next_tab_column; /* Column the next tab stop is on. */ ++ int convert = 1; /* If nonzero, perform translations. */ ++ ++ fp = next_file ((FILE *) NULL); ++ if (fp == NULL) ++ return; ++ ++ memset (&o_state, '\0', sizeof(mbstate_t)); ++ memset (&i_state, '\0', sizeof(mbstate_t)); ++ ++ for (;;) ++ { ++ /* Refill the buffer BUF. */ ++ if (buflen < MB_LEN_MAX && !feof(fp) && !ferror(fp)) ++ { ++ memmove (buf, bufpos, buflen); ++ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, fp); ++ bufpos = buf; ++ } ++ ++ /* No character is left in BUF. */ ++ if (buflen < 1) ++ { ++ fp = next_file (fp); ++ ++ if (fp == NULL) ++ break; /* No more files. */ ++ else ++ { ++ memset (&i_state, '\0', sizeof(mbstate_t)); ++ continue; ++ } ++ } ++ ++ /* Get a wide character. */ ++ i_state_bak = i_state; ++ mblength = mbrtowc (&wc, bufpos, buflen, &i_state); ++ ++ switch (mblength) ++ { ++ case (size_t)-1: /* illegal byte sequence. */ ++ case (size_t)-2: ++ mblength = 1; ++ i_state = i_state_bak; ++ if (convert) ++ { ++ ++column; ++ if (convert_entire_line == 0) ++ convert = 0; ++ } ++ putchar (*bufpos); ++ break; ++ ++ case 0: /* null. */ ++ mblength = 1; ++ if (convert && convert_entire_line == 0) ++ convert = 0; ++ putchar ('\0'); ++ break; ++ ++ default: ++ if (wc == L'\n') /* LF. */ ++ { ++ tab_index = 0; ++ column = 0; ++ convert = 1; ++ putchar ('\n'); ++ } ++ else if (wc == L'\t' && convert) /* Tab. */ ++ { ++ if (tab_size == 0) ++ { ++ /* Do not let tab_index == first_free_tab; ++ stop when it is 1 less. */ ++ while (tab_index < first_free_tab - 1 ++ && column >= tab_list[tab_index]) ++ tab_index++; ++ next_tab_column = tab_list[tab_index]; ++ if (tab_index < first_free_tab - 1) ++ tab_index++; ++ if (column >= next_tab_column) ++ next_tab_column = column + 1; ++ } ++ else ++ next_tab_column = column + tab_size - column % tab_size; ++ ++ while (column < next_tab_column) ++ { ++ putchar (' '); ++ ++column; ++ } ++ } ++ else /* Others. */ ++ { ++ if (convert) ++ { ++ if (wc == L'\b') ++ { ++ if (column > 0) ++ --column; ++ } ++ else ++ { ++ int width; /* The width of WC. */ ++ ++ width = wcwidth (wc); ++ column += (width > 0) ? width : 0; ++ if (convert_entire_line == 0) ++ convert = 0; ++ } ++ } ++ fwrite (bufpos, sizeof(char), mblength, stdout); ++ } ++ } ++ buflen -= mblength; ++ bufpos += mblength; ++ } ++} ++#endif ++ + int + main (int argc, char **argv) + { +@@ -429,7 +583,12 @@ + + file_list = (optind < argc ? &argv[optind] : stdin_argv); + +- expand (); ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ expand_multibyte (); ++ else ++#endif ++ expand (); + + if (have_read_stdin && fclose (stdin) != 0) + error (EXIT_FAILURE, errno, "-"); +diff -Naur coreutils-6.1.orig/src/fold.c coreutils-6.1/src/fold.c +--- coreutils-6.1.orig/src/fold.c 2006-07-09 17:20:43.000000000 +0000 ++++ coreutils-6.1/src/fold.c 2006-08-23 20:08:12.000000000 +0000 +@@ -23,11 +23,33 @@ + #include + #include + ++/* Get mbstate_t, mbrtowc(), wcwidth(). */ ++#if HAVE_WCHAR_H ++# include ++#endif ++ ++/* Get iswprint(), iswblank(), wcwidth(). */ ++#if HAVE_WCTYPE_H ++# include ++#endif ++ + #include "system.h" + #include "error.h" + #include "quote.h" + #include "xstrtol.h" + ++/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC ++ installation; work around this configuration error. */ ++#if !defined MB_LEN_MAX || MB_LEN_MAX < 2 ++# undef MB_LEN_MAX ++# define MB_LEN_MAX 16 ++#endif ++ ++/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ ++#if HAVE_MBRTOWC && defined mbstate_t ++# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) ++#endif ++ + #define TAB_WIDTH 8 + + /* The official name of this program (e.g., no `g' prefix). */ +@@ -35,23 +57,44 @@ + + #define AUTHORS "David MacKenzie" + ++#define FATAL_ERROR(Message) \ ++ do \ ++ { \ ++ error (0, 0, (Message)); \ ++ usage (2); \ ++ } \ ++ while (0) ++ ++enum operating_mode ++{ ++ /* Fold texts by columns that are at the given positions. */ ++ column_mode, ++ ++ /* Fold texts by bytes that are at the given positions. */ ++ byte_mode, ++ ++ /* Fold texts by characters that are at the given positions. */ ++ character_mode, ++}; ++ + /* The name this program was run with. */ + char *program_name; + ++/* The argument shows current mode. (Default: column_mode) */ ++static enum operating_mode operating_mode; ++ + /* If nonzero, try to break on whitespace. */ + static bool break_spaces; + +-/* If nonzero, count bytes, not column positions. */ +-static bool count_bytes; +- + /* If nonzero, at least one of the files we read was standard input. */ + static bool have_read_stdin; + +-static char const shortopts[] = "bsw:0::1::2::3::4::5::6::7::8::9::"; ++static char const shortopts[] = "bcsw:0::1::2::3::4::5::6::7::8::9::"; + + static struct option const longopts[] = + { + {"bytes", no_argument, NULL, 'b'}, ++ {"characters", no_argument, NULL, 'c'}, + {"spaces", no_argument, NULL, 's'}, + {"width", required_argument, NULL, 'w'}, + {GETOPT_HELP_OPTION_DECL}, +@@ -81,6 +124,7 @@ + "), stdout); + fputs (_("\ + -b, --bytes count bytes rather than columns\n\ ++ -c, --characters count characters rather than columns\n\ + -s, --spaces break at spaces\n\ + -w, --width=WIDTH use WIDTH columns instead of 80\n\ + "), stdout); +@@ -98,7 +142,7 @@ + static size_t + adjust_column (size_t column, char c) + { +- if (!count_bytes) ++ if (operating_mode != byte_mode) + { + if (c == '\b') + { +@@ -117,35 +161,14 @@ + return column; + } + +-/* Fold file FILENAME, or standard input if FILENAME is "-", +- to stdout, with maximum line length WIDTH. +- Return true if successful. */ +- +-static bool +-fold_file (char *filename, size_t width) ++static void ++fold_text (FILE *istream, size_t width, int *saved_errno) + { +- FILE *istream; + int c; + size_t column = 0; /* Screen column where next char will go. */ + size_t offset_out = 0; /* Index in `line_out' for next char. */ + static char *line_out = NULL; + static size_t allocated_out = 0; +- int saved_errno; +- +- if (STREQ (filename, "-")) +- { +- istream = stdin; +- have_read_stdin = true; +- } +- else +- istream = fopen (filename, "r"); +- +- if (istream == NULL) +- { +- error (0, errno, "%s", filename); +- return false; +- } +- + while ((c = getc (istream)) != EOF) + { + if (offset_out + 1 >= allocated_out) +@@ -172,6 +195,15 @@ + bool found_blank = false; + size_t logical_end = offset_out; + ++ /* If LINE_OUT has no wide character, ++ put a new wide character in LINE_OUT ++ if column is bigger than width. */ ++ if (offset_out == 0) ++ { ++ line_out[offset_out++] = c; ++ continue; ++ } ++ + /* Look for the last blank. */ + while (logical_end) + { +@@ -218,11 +250,225 @@ + line_out[offset_out++] = c; + } + +- saved_errno = errno; ++ *saved_errno = errno; ++ ++ if (offset_out) ++ fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); ++ ++ free(line_out); ++} ++ ++#if HAVE_MBRTOWC ++static void ++fold_multibyte_text (FILE *istream, int width, int *saved_errno) ++{ ++ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */ ++ size_t buflen = 0; /* The length of the byte sequence in buf. */ ++ char *bufpos; /* Next read position of BUF. */ ++ wint_t wc; /* A gotten wide character. */ ++ size_t mblength; /* The byte size of a multibyte character which shows ++ as same character as WC. */ ++ mbstate_t state, state_bak; /* State of the stream. */ ++ int convfail; /* 1, when conversion is failed. Otherwise 0. */ ++ ++ char *line_out = NULL; ++ size_t offset_out = 0; /* Index in `line_out' for next char. */ ++ size_t allocated_out = 0; ++ ++ int increment; ++ size_t column = 0; ++ ++ size_t last_blank_pos; ++ size_t last_blank_column; ++ int is_blank_seen; ++ int last_blank_increment; ++ int is_bs_following_last_blank; ++ size_t bs_following_last_blank_num; ++ int is_cr_after_last_blank; ++ ++#define CLEAR_FLAGS \ ++ do \ ++ { \ ++ last_blank_pos = 0; \ ++ last_blank_column = 0; \ ++ is_blank_seen = 0; \ ++ is_bs_following_last_blank = 0; \ ++ bs_following_last_blank_num = 0; \ ++ is_cr_after_last_blank = 0; \ ++ } \ ++ while (0) ++ ++#define START_NEW_LINE \ ++ do \ ++ { \ ++ putchar ('\n'); \ ++ column = 0; \ ++ offset_out = 0; \ ++ CLEAR_FLAGS; \ ++ } \ ++ while (0) ++ ++ CLEAR_FLAGS; ++ memset (&state, '\0', sizeof(mbstate_t)); ++ ++ for (;; bufpos += mblength, buflen -= mblength) ++ { ++ if (buflen < MB_LEN_MAX && !feof (istream) && !ferror (istream)) ++ { ++ memmove (buf, bufpos, buflen); ++ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, istream); ++ bufpos = buf; ++ } ++ ++ if (buflen < 1) ++ break; ++ ++ /* Get a wide character. */ ++ convfail = 0; ++ state_bak = state; ++ mblength = mbrtowc ((wchar_t *)&wc, bufpos, buflen, &state); ++ ++ switch (mblength) ++ { ++ case (size_t)-1: ++ case (size_t)-2: ++ convfail++; ++ state = state_bak; ++ /* Fall through. */ ++ ++ case 0: ++ mblength = 1; ++ break; ++ } ++ ++rescan: ++ if (operating_mode == byte_mode) /* byte mode */ ++ increment = mblength; ++ else if (operating_mode == character_mode) /* character mode */ ++ increment = 1; ++ else /* column mode */ ++ { ++ if (convfail) ++ increment = 1; ++ else ++ { ++ switch (wc) ++ { ++ case L'\n': ++ fwrite (line_out, sizeof(char), offset_out, stdout); ++ START_NEW_LINE; ++ continue; ++ ++ case L'\b': ++ increment = (column > 0) ? -1 : 0; ++ break; ++ ++ case L'\r': ++ increment = -1 * column; ++ break; ++ ++ case L'\t': ++ increment = 8 - column % 8; ++ break; ++ ++ default: ++ increment = wcwidth (wc); ++ increment = (increment < 0) ? 0 : increment; ++ } ++ } ++ } ++ ++ if (column + increment > width && break_spaces && last_blank_pos) ++ { ++ fwrite (line_out, sizeof(char), last_blank_pos, stdout); ++ putchar ('\n'); ++ ++ offset_out = offset_out - last_blank_pos; ++ column = column - last_blank_column + ((is_cr_after_last_blank) ++ ? last_blank_increment : bs_following_last_blank_num); ++ memmove (line_out, line_out + last_blank_pos, offset_out); ++ CLEAR_FLAGS; ++ goto rescan; ++ } ++ ++ if (column + increment > width && column != 0) ++ { ++ fwrite (line_out, sizeof(char), offset_out, stdout); ++ START_NEW_LINE; ++ goto rescan; ++ } ++ ++ if (allocated_out < offset_out + mblength) ++ { ++ allocated_out += 1024; ++ line_out = xrealloc (line_out, allocated_out); ++ } ++ ++ memcpy (line_out + offset_out, bufpos, mblength); ++ offset_out += mblength; ++ column += increment; ++ ++ if (is_blank_seen && !convfail && wc == L'\r') ++ is_cr_after_last_blank = 1; ++ ++ if (is_bs_following_last_blank && !convfail && wc == L'\b') ++ ++bs_following_last_blank_num; ++ else ++ is_bs_following_last_blank = 0; ++ ++ if (break_spaces && !convfail && iswblank (wc)) ++ { ++ last_blank_pos = offset_out; ++ last_blank_column = column; ++ is_blank_seen = 1; ++ last_blank_increment = increment; ++ is_bs_following_last_blank = 1; ++ bs_following_last_blank_num = 0; ++ is_cr_after_last_blank = 0; ++ } ++ } ++ ++ *saved_errno = errno; + + if (offset_out) + fwrite (line_out, sizeof (char), (size_t) offset_out, stdout); + ++ free(line_out); ++} ++#endif ++ ++/* Fold file FILENAME, or standard input if FILENAME is "-", ++ to stdout, with maximum line length WIDTH. ++ Return 0 if successful, 1 if an error occurs. */ ++ ++static int ++fold_file (char *filename, int width) ++{ ++ FILE *istream; ++ int saved_errno; ++ ++ if (STREQ (filename, "-")) ++ { ++ istream = stdin; ++ have_read_stdin = 1; ++ } ++ else ++ istream = fopen (filename, "r"); ++ ++ if (istream == NULL) ++ { ++ error (0, errno, "%s", filename); ++ return 1; ++ } ++ ++ /* Define how ISTREAM is being folded. */ ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ fold_multibyte_text (istream, width, &saved_errno); ++ else ++#endif ++ fold_text (istream, width, &saved_errno); ++ + if (ferror (istream)) + { + error (0, saved_errno, "%s", filename); +@@ -255,7 +501,8 @@ + + atexit (close_stdout); + +- break_spaces = count_bytes = have_read_stdin = false; ++ operating_mode = column_mode; ++ break_spaces = have_read_stdin = false; + + while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1) + { +@@ -264,7 +511,15 @@ + switch (optc) + { + case 'b': /* Count bytes rather than columns. */ +- count_bytes = true; ++ if (operating_mode != column_mode) ++ FATAL_ERROR (_("only one way of folding may be specified")); ++ operating_mode = byte_mode; ++ break; ++ ++ case 'c': ++ if (operating_mode != column_mode) ++ FATAL_ERROR (_("only one way of folding may be specified")); ++ operating_mode = character_mode; + break; + + case 's': /* Break at word boundaries. */ +diff -Naur coreutils-6.1.orig/src/join.c coreutils-6.1/src/join.c +--- coreutils-6.1.orig/src/join.c 2006-07-09 17:06:58.000000000 +0000 ++++ coreutils-6.1/src/join.c 2006-08-23 20:08:12.000000000 +0000 +@@ -23,16 +23,30 @@ + #include + #include + ++/* Get mbstate_t, mbrtowc(), mbrtowc(), wcwidth(). */ ++#if HAVE_WCHAR_H ++# include ++#endif ++ ++/* Get iswblank(), towupper. */ ++#if HAVE_WCTYPE_H ++# include ++#endif ++ + #include "system.h" + #include "error.h" + #include "hard-locale.h" + #include "linebuffer.h" +-#include "memcasecmp.h" + #include "quote.h" + #include "stdio--.h" + #include "xmemcoll.h" + #include "xstrtol.h" + ++/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ ++#if HAVE_MBRTOWC && defined mbstate_t ++# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) ++#endif ++ + /* The official name of this program (e.g., no `g' prefix). */ + #define PROGRAM_NAME "join" + +@@ -104,10 +118,12 @@ + /* Last element in `outlist', where a new element can be added. */ + static struct outlist *outlist_end = &outlist_head; + +-/* Tab character separating fields. If negative, fields are separated +- by any nonempty string of blanks, otherwise by exactly one +- tab character whose value (when cast to unsigned char) equals TAB. */ +-static int tab = -1; ++/* Tab character separating fields. If NULL, fields are separated ++ by any nonempty string of blanks. */ ++static char *tab = NULL; ++ ++/* The number of bytes used for tab. */ ++static size_t tablen = 0; + + static struct option const longopts[] = + { +@@ -190,6 +206,8 @@ + + /* Fill in the `fields' structure in LINE. */ + ++/* Fill in the `fields' structure in LINE. */ ++ + static void + xfields (struct line *line) + { +@@ -199,10 +217,11 @@ + if (ptr == lim) + return; + +- if (0 <= tab) ++ if (tab != NULL) + { ++ unsigned char t = tab[0]; + char *sep; +- for (; (sep = memchr (ptr, tab, lim - ptr)) != NULL; ptr = sep + 1) ++ for (; (sep = memchr (ptr, t, lim - ptr)) != NULL; ptr = sep + 1) + extract_field (line, ptr, sep - ptr); + } + else +@@ -229,6 +248,148 @@ + extract_field (line, ptr, lim - ptr); + } + ++#if HAVE_MBRTOWC ++static void ++xfields_multibyte (struct line *line) ++{ ++ char *ptr = line->buf.buffer; ++ char const *lim = ptr + line->buf.length - 1; ++ wchar_t wc = 0; ++ size_t mblength = 1; ++ mbstate_t state, state_bak; ++ ++ memset (&state, 0, sizeof (mbstate_t)); ++ ++ if (ptr == lim) ++ return; ++ ++ if (tab != NULL) ++ { ++ unsigned char t = tab[0]; ++ char *sep = ptr; ++ for (; ptr < lim; ptr = sep + mblength) ++ { ++ sep = ptr; ++ while (sep < lim) ++ { ++ state_bak = state; ++ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state); ++ ++ if (mblength == (size_t)-1 || mblength == (size_t)-2) ++ { ++ mblength = 1; ++ state = state_bak; ++ } ++ mblength = (mblength < 1) ? 1 : mblength; ++ ++ if (mblength == tablen && !memcmp (sep, tab, mblength)) ++ break; ++ else ++ { ++ sep += mblength; ++ continue; ++ } ++ } ++ ++ if (sep == lim) ++ break; ++ ++ extract_field (line, ptr, sep - ptr); ++ } ++ } ++ else ++ { ++ /* Skip leading blanks before the first field. */ ++ while(ptr < lim) ++ { ++ state_bak = state; ++ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state); ++ ++ if (mblength == (size_t)-1 || mblength == (size_t)-2) ++ { ++ mblength = 1; ++ state = state_bak; ++ break; ++ } ++ mblength = (mblength < 1) ? 1 : mblength; ++ ++ if (!iswblank(wc)) ++ break; ++ ptr += mblength; ++ } ++ ++ do ++ { ++ char *sep; ++ state_bak = state; ++ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state); ++ if (mblength == (size_t)-1 || mblength == (size_t)-2) ++ { ++ mblength = 1; ++ state = state_bak; ++ break; ++ } ++ mblength = (mblength < 1) ? 1 : mblength; ++ ++ sep = ptr + mblength; ++ while (sep != lim) ++ { ++ state_bak = state; ++ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state); ++ if (mblength == (size_t)-1 || mblength == (size_t)-2) ++ { ++ mblength = 1; ++ state = state_bak; ++ break; ++ } ++ mblength = (mblength < 1) ? 1 : mblength; ++ ++ if (iswblank (wc)) ++ break; ++ ++ sep += mblength; ++ } ++ ++ extract_field (line, ptr, sep - ptr); ++ if (sep == lim) ++ return; ++ ++ state_bak = state; ++ mblength = mbrtowc (&wc, sep, lim - sep + 1, &state); ++ if (mblength == (size_t)-1 || mblength == (size_t)-2) ++ { ++ mblength = 1; ++ state = state_bak; ++ break; ++ } ++ mblength = (mblength < 1) ? 1 : mblength; ++ ++ ptr = sep + mblength; ++ while (ptr != lim) ++ { ++ state_bak = state; ++ mblength = mbrtowc (&wc, ptr, lim - ptr + 1, &state); ++ if (mblength == (size_t)-1 || mblength == (size_t)-2) ++ { ++ mblength = 1; ++ state = state_bak; ++ break; ++ } ++ mblength = (mblength < 1) ? 1 : mblength; ++ ++ if (!iswblank (wc)) ++ break; ++ ++ ptr += mblength; ++ } ++ } ++ while (ptr != lim); ++ } ++ ++ extract_field (line, ptr, lim - ptr); ++} ++#endif ++ + /* Read a line from FP into LINE and split it into fields. + Return true if successful. */ + +@@ -249,6 +410,11 @@ + line->nfields_allocated = 0; + line->nfields = 0; + line->fields = NULL; ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ xfields_multibyte (line); ++ else ++#endif + xfields (line); + return true; + } +@@ -303,56 +469,114 @@ + keycmp (struct line const *line1, struct line const *line2) + { + /* Start of field to compare in each file. */ +- char *beg1; +- char *beg2; +- +- size_t len1; +- size_t len2; /* Length of fields to compare. */ ++ char *beg[2]; ++ char *copy[2]; ++ size_t len[2]; /* Length of fields to compare. */ + int diff; ++ int i, j; + + if (join_field_1 < line1->nfields) + { +- beg1 = line1->fields[join_field_1].beg; +- len1 = line1->fields[join_field_1].len; ++ beg[0] = line1->fields[join_field_1].beg; ++ len[0] = line1->fields[join_field_1].len; + } + else + { +- beg1 = NULL; +- len1 = 0; ++ beg[0] = NULL; ++ len[0] = 0; + } + + if (join_field_2 < line2->nfields) + { +- beg2 = line2->fields[join_field_2].beg; +- len2 = line2->fields[join_field_2].len; ++ beg[1] = line2->fields[join_field_2].beg; ++ len[1] = line2->fields[join_field_2].len; + } + else + { +- beg2 = NULL; +- len2 = 0; ++ beg[1] = NULL; ++ len[1] = 0; + } + +- if (len1 == 0) +- return len2 == 0 ? 0 : -1; +- if (len2 == 0) ++ if (len[0] == 0) ++ return len[1] == 0 ? 0 : -1; ++ if (len[1] == 0) + return 1; + + if (ignore_case) + { +- /* FIXME: ignore_case does not work with NLS (in particular, +- with multibyte chars). */ +- diff = memcasecmp (beg1, beg2, MIN (len1, len2)); ++#ifdef HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ { ++ size_t mblength; ++ wchar_t wc, uwc; ++ mbstate_t state, state_bak; ++ ++ memset (&state, '\0', sizeof (mbstate_t)); ++ ++ for (i = 0; i < 2; i++) ++ { ++ copy[i] = alloca (len[i] + 1); ++ ++ for (j = 0; j < MIN (len[0], len[1]);) ++ { ++ state_bak = state; ++ mblength = mbrtowc (&wc, beg[i] + j, len[i] - j, &state); ++ ++ switch (mblength) ++ { ++ case (size_t) -1: ++ case (size_t) -2: ++ state = state_bak; ++ /* Fall through */ ++ case 0: ++ mblength = 1; ++ break; ++ ++ default: ++ uwc = towupper (wc); ++ ++ if (uwc != wc) ++ { ++ mbstate_t state_wc; ++ ++ memset (&state_wc, '\0', sizeof (mbstate_t)); ++ wcrtomb (copy[i] + j, uwc, &state_wc); ++ } ++ else ++ memcpy (copy[i] + j, beg[i] + j, mblength); ++ } ++ j += mblength; ++ } ++ copy[i][j] = '\0'; ++ } ++ } ++ else ++#endif ++ { ++ for (i = 0; i < 2; i++) ++ { ++ copy[i] = alloca (len[i] + 1); ++ ++ for (j = 0; j < MIN (len[0], len[1]); j++) ++ copy[i][j] = toupper (beg[i][j]); ++ ++ copy[i][j] = '\0'; ++ } ++ } + } + else + { +- if (hard_LC_COLLATE) +- return xmemcoll (beg1, len1, beg2, len2); +- diff = memcmp (beg1, beg2, MIN (len1, len2)); ++ copy[0] = (unsigned char *) beg[0]; ++ copy[1] = (unsigned char *) beg[1]; + } + ++ if (HAVE_SETLOCALE && hard_LC_COLLATE) ++ return xmemcoll ((char *) copy[0], len[0], (char *) copy[1], len[1]); ++ diff = memcmp (copy[0], copy[1], MIN (len[0], len[1])); ++ + if (diff) + return diff; +- return len1 < len2 ? -1 : len1 != len2; ++ return len[0] - len[1]; + } + + /* Print field N of LINE if it exists and is nonempty, otherwise +@@ -377,11 +601,18 @@ + + /* Print the join of LINE1 and LINE2. */ + ++#define PUT_TAB_CHAR \ ++ do \ ++ { \ ++ (tab != NULL) ? \ ++ fwrite(tab, sizeof(char), tablen, stdout) : putchar (' '); \ ++ } \ ++ while (0) ++ + static void + prjoin (struct line const *line1, struct line const *line2) + { + const struct outlist *outlist; +- char output_separator = tab < 0 ? ' ' : tab; + + outlist = outlist_head.next; + if (outlist) +@@ -397,12 +628,12 @@ + if (o->file == 0) + { + if (line1 == &uni_blank) +- { ++ { + line = line2; + field = join_field_2; + } + else +- { ++ { + line = line1; + field = join_field_1; + } +@@ -416,7 +647,7 @@ + o = o->next; + if (o == NULL) + break; +- putchar (output_separator); ++ PUT_TAB_CHAR; + } + putchar ('\n'); + } +@@ -434,23 +665,23 @@ + prfield (join_field_1, line1); + for (i = 0; i < join_field_1 && i < line1->nfields; ++i) + { +- putchar (output_separator); ++ PUT_TAB_CHAR; + prfield (i, line1); + } + for (i = join_field_1 + 1; i < line1->nfields; ++i) + { +- putchar (output_separator); ++ PUT_TAB_CHAR; + prfield (i, line1); + } + + for (i = 0; i < join_field_2 && i < line2->nfields; ++i) + { +- putchar (output_separator); ++ PUT_TAB_CHAR; + prfield (i, line2); + } + for (i = join_field_2 + 1; i < line2->nfields; ++i) + { +- putchar (output_separator); ++ PUT_TAB_CHAR; + prfield (i, line2); + } + putchar ('\n'); +@@ -862,20 +1093,41 @@ + + case 't': + { +- unsigned char newtab = optarg[0]; +- if (! newtab) ++ char *newtab; ++ size_t newtablen; ++ if (! optarg[0]) + error (EXIT_FAILURE, 0, _("empty tab")); +- if (optarg[1]) ++ newtab = xstrdup (optarg); ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ { ++ mbstate_t state; ++ ++ memset (&state, 0, sizeof (mbstate_t)); ++ newtablen = mbrtowc (NULL, newtab, ++ strnlen (newtab, MB_LEN_MAX), ++ &state); ++ if (newtablen == (size_t) 0 ++ || newtablen == (size_t) -1 ++ || newtablen == (size_t) -2) ++ newtablen = 1; ++ } ++ else ++#endif ++ newtablen = 1; ++ ++ if (newtablen == 1 && newtab[1]) ++ { ++ if (STREQ (newtab, "\\0")) ++ newtab[0] = '\0'; ++ } ++ if (tab != NULL && strcmp (tab, newtab)) + { +- if (STREQ (optarg, "\\0")) +- newtab = '\0'; +- else +- error (EXIT_FAILURE, 0, _("multi-character tab %s"), +- quote (optarg)); ++ free (newtab); ++ error (EXIT_FAILURE, 0, _("incompatible tabs")); + } +- if (0 <= tab && tab != newtab) +- error (EXIT_FAILURE, 0, _("incompatible tabs")); + tab = newtab; ++ tablen = newtablen; + } + break; + +diff -Naur coreutils-6.1.orig/src/pr.c coreutils-6.1/src/pr.c +--- coreutils-6.1.orig/src/pr.c 2006-07-09 17:20:43.000000000 +0000 ++++ coreutils-6.1/src/pr.c 2006-08-23 20:08:12.000000000 +0000 +@@ -313,6 +313,32 @@ + + #include + #include ++ ++/* Get MB_LEN_MAX. */ ++#include ++/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC ++ installation; work around this configuration error. */ ++#if !defined MB_LEN_MAX || MB_LEN_MAX == 1 ++# define MB_LEN_MAX 16 ++#endif ++ ++/* Get MB_CUR_MAX. */ ++#include ++ ++/* Solaris 2.5 has a bug: must be included before . */ ++/* Get mbstate_t, mbrtowc(), wcwidth(). */ ++#if HAVE_WCHAR_H ++# include ++#endif ++ ++/* Get iswprint(). -- for wcwidth(). */ ++#if HAVE_WCTYPE_H ++# include ++#endif ++#if !defined iswprint && !HAVE_ISWPRINT ++# define iswprint(wc) 1 ++#endif ++ + #include "system.h" + #include "error.h" + #include "hard-locale.h" +@@ -324,6 +350,18 @@ + #include "strftime.h" + #include "xstrtol.h" + ++/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ ++#if HAVE_MBRTOWC && defined mbstate_t ++# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) ++#endif ++ ++#ifndef HAVE_DECL_WCWIDTH ++"this configure-time declaration test was not run" ++#endif ++#if !HAVE_DECL_WCWIDTH ++extern int wcwidth (); ++#endif ++ + /* The official name of this program (e.g., no `g' prefix). */ + #define PROGRAM_NAME "pr" + +@@ -416,7 +454,20 @@ + + #define NULLCOL (COLUMN *)0 + +-static int char_to_clump (char c); ++/* Funtion pointers to switch functions for single byte locale or for ++ multibyte locale. If multibyte functions do not exist in your sysytem, ++ these pointers always point the function for single byte locale. */ ++static void (*print_char) (char c); ++static int (*char_to_clump) (char c); ++ ++/* Functions for single byte locale. */ ++static void print_char_single (char c); ++static int char_to_clump_single (char c); ++ ++/* Functions for multibyte locale. */ ++static void print_char_multi (char c); ++static int char_to_clump_multi (char c); ++ + static bool read_line (COLUMN *p); + static bool print_page (void); + static bool print_stored (COLUMN *p); +@@ -426,6 +477,7 @@ + static void pad_across_to (int position); + static void add_line_number (COLUMN *p); + static void getoptarg (char *arg, char switch_char, char *character, ++ int *character_length, int *character_width, + int *number); + void usage (int status); + static void print_files (int number_of_files, char **av); +@@ -440,7 +492,6 @@ + static void pad_down (int lines); + static void read_rest_of_line (COLUMN *p); + static void skip_read (COLUMN *p, int column_number); +-static void print_char (char c); + static void cleanup (void); + static void print_sep_string (void); + static void separator_string (const char *optarg_S); +@@ -455,7 +506,7 @@ + we store the leftmost columns contiguously in buff. + To print a line from buff, get the index of the first character + from line_vector[i], and print up to line_vector[i + 1]. */ +-static char *buff; ++static unsigned char *buff; + + /* Index of the position in buff where the next character + will be stored. */ +@@ -559,7 +610,7 @@ + static bool untabify_input = false; + + /* (-e) The input tab character. */ +-static char input_tab_char = '\t'; ++static char input_tab_char[MB_LEN_MAX] = "\t"; + + /* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ... + where the leftmost column is 1. */ +@@ -569,7 +620,10 @@ + static bool tabify_output = false; + + /* (-i) The output tab character. */ +-static char output_tab_char = '\t'; ++static char output_tab_char[MB_LEN_MAX] = "\t"; ++ ++/* (-i) The byte length of output tab character. */ ++static int output_tab_char_length = 1; + + /* (-i) The width of the output tab. */ + static int chars_per_output_tab = 8; +@@ -643,7 +697,13 @@ + static bool numbered_lines = false; + + /* (-n) Character which follows each line number. */ +-static char number_separator = '\t'; ++static char number_separator[MB_LEN_MAX] = "\t"; ++ ++/* (-n) The byte length of the character which follows each line number. */ ++static int number_separator_length = 1; ++ ++/* (-n) The character width of the character which follows each line number. */ ++static int number_separator_width = 0; + + /* (-n) line counting starts with 1st line of input file (not with 1st + line of 1st page printed). */ +@@ -696,6 +756,7 @@ + -a|COLUMN|-m is a `space' and with the -J option a `tab'. */ + static char *col_sep_string = ""; + static int col_sep_length = 0; ++static int col_sep_width = 0; + static char *column_separator = " "; + static char *line_separator = "\t"; + +@@ -852,6 +913,13 @@ + col_sep_length = (int) strlen (optarg_S); + col_sep_string = xmalloc (col_sep_length + 1); + strcpy (col_sep_string, optarg_S); ++ ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ col_sep_width = mbswidth (col_sep_string, 0); ++ else ++#endif ++ col_sep_width = col_sep_length; + } + + int +@@ -877,6 +945,21 @@ + + atexit (close_stdout); + ++/* Define which functions are used, the ones for single byte locale or the ones ++ for multibyte locale. */ ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ { ++ print_char = print_char_multi; ++ char_to_clump = char_to_clump_multi; ++ } ++ else ++#endif ++ { ++ print_char = print_char_single; ++ char_to_clump = char_to_clump_single; ++ } ++ + n_files = 0; + file_names = (argc > 1 + ? xmalloc ((argc - 1) * sizeof (char *)) +@@ -949,8 +1032,12 @@ + break; + case 'e': + if (optarg) +- getoptarg (optarg, 'e', &input_tab_char, +- &chars_per_input_tab); ++ { ++ int dummy_length, dummy_width; ++ ++ getoptarg (optarg, 'e', input_tab_char, &dummy_length, ++ &dummy_width, &chars_per_input_tab); ++ } + /* Could check tab width > 0. */ + untabify_input = true; + break; +@@ -963,8 +1050,12 @@ + break; + case 'i': + if (optarg) +- getoptarg (optarg, 'i', &output_tab_char, +- &chars_per_output_tab); ++ { ++ int dummy_width; ++ ++ getoptarg (optarg, 'i', output_tab_char, &output_tab_char_length, ++ &dummy_width, &chars_per_output_tab); ++ } + /* Could check tab width > 0. */ + tabify_output = true; + break; +@@ -991,8 +1082,8 @@ + case 'n': + numbered_lines = true; + if (optarg) +- getoptarg (optarg, 'n', &number_separator, +- &chars_per_number); ++ getoptarg (optarg, 'n', number_separator, &number_separator_length, ++ &number_separator_width, &chars_per_number); + break; + case 'N': + skip_count = false; +@@ -1031,7 +1122,7 @@ + old_s = false; + /* Reset an additional input of -s, -S dominates -s */ + col_sep_string = ""; +- col_sep_length = 0; ++ col_sep_length = col_sep_width = 0; + use_col_separator = true; + if (optarg) + separator_string (optarg); +@@ -1188,10 +1279,45 @@ + a number. */ + + static void +-getoptarg (char *arg, char switch_char, char *character, int *number) ++getoptarg (char *arg, char switch_char, char *character, int *character_length, ++ int *character_width, int *number) + { + if (!ISDIGIT (*arg)) +- *character = *arg++; ++ { ++#ifdef HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) /* for multibyte locale. */ ++ { ++ wchar_t wc; ++ size_t mblength; ++ int width; ++ mbstate_t state = {'\0'}; ++ ++ mblength = mbrtowc (&wc, arg, strnlen(arg, MB_LEN_MAX), &state); ++ ++ if (mblength == (size_t)-1 || mblength == (size_t)-2) ++ { ++ *character_length = 1; ++ *character_width = 1; ++ } ++ else ++ { ++ *character_length = (mblength < 1) ? 1 : mblength; ++ width = wcwidth (wc); ++ *character_width = (width < 0) ? 0 : width; ++ } ++ ++ strncpy (character, arg, *character_length); ++ arg += *character_length; ++ } ++ else /* for single byte locale. */ ++#endif ++ { ++ *character = *arg++; ++ *character_length = 1; ++ *character_width = 1; ++ } ++ } ++ + if (*arg) + { + long int tmp_long; +@@ -1256,7 +1382,7 @@ + else + col_sep_string = column_separator; + +- col_sep_length = 1; ++ col_sep_length = col_sep_width = 1; + use_col_separator = true; + } + /* It's rather pointless to define a TAB separator with column +@@ -1288,11 +1414,11 @@ + TAB_WIDTH (chars_per_input_tab, chars_per_number); */ + + /* Estimate chars_per_text without any margin and keep it constant. */ +- if (number_separator == '\t') ++ if (number_separator[0] == '\t') + number_width = chars_per_number + + TAB_WIDTH (chars_per_default_tab, chars_per_number); + else +- number_width = chars_per_number + 1; ++ number_width = chars_per_number + number_separator_width; + + /* The number is part of the column width unless we are + printing files in parallel. */ +@@ -1307,7 +1433,7 @@ + } + + chars_per_column = (chars_per_line - chars_used_by_number - +- (columns - 1) * col_sep_length) / columns; ++ (columns - 1) * col_sep_width) / columns; + + if (chars_per_column < 1) + error (EXIT_FAILURE, 0, _("page width too narrow")); +@@ -1432,7 +1558,7 @@ + + /* Enlarge p->start_position of first column to use the same form of + padding_not_printed with all columns. */ +- h = h + col_sep_length; ++ h = h + col_sep_width; + + /* This loop takes care of all but the rightmost column. */ + +@@ -1466,7 +1592,7 @@ + } + else + { +- h = h_next + col_sep_length; ++ h = h_next + col_sep_width; + h_next = h + chars_per_column; + } + } +@@ -1756,9 +1882,9 @@ + align_column (COLUMN *p) + { + padding_not_printed = p->start_position; +- if (padding_not_printed - col_sep_length > 0) ++ if (padding_not_printed - col_sep_width > 0) + { +- pad_across_to (padding_not_printed - col_sep_length); ++ pad_across_to (padding_not_printed - col_sep_width); + padding_not_printed = ANYWHERE; + } + +@@ -2029,13 +2155,13 @@ + /* May be too generous. */ + buff = X2REALLOC (buff, &buff_allocated); + } +- buff[buff_current++] = c; ++ buff[buff_current++] = (unsigned char) c; + } + + static void + add_line_number (COLUMN *p) + { +- int i; ++ int i, j; + char *s; + int left_cut; + +@@ -2058,22 +2184,24 @@ + /* Tabification is assumed for multiple columns, also for n-separators, + but `default n-separator = TAB' hasn't been given priority over + equal column_width also specified by POSIX. */ +- if (number_separator == '\t') ++ if (number_separator[0] == '\t') + { + i = number_width - chars_per_number; + while (i-- > 0) + (p->char_func) (' '); + } + else +- (p->char_func) (number_separator); ++ for (j = 0; j < number_separator_length; j++) ++ (p->char_func) (number_separator[j]); + } + else + /* To comply with POSIX, we avoid any expansion of default TAB + separator with a single column output. No column_width requirement + has to be considered. */ + { +- (p->char_func) (number_separator); +- if (number_separator == '\t') ++ for (j = 0; j < number_separator_length; j++) ++ (p->char_func) (number_separator[j]); ++ if (number_separator[0] == '\t') + output_position = POS_AFTER_TAB (chars_per_output_tab, + output_position); + } +@@ -2234,7 +2362,7 @@ + while (goal - h_old > 1 + && (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal) + { +- putchar (output_tab_char); ++ fwrite (output_tab_char, sizeof(char), output_tab_char_length, stdout); + h_old = h_new; + } + while (++h_old <= goal) +@@ -2254,6 +2382,7 @@ + { + char *s; + int l = col_sep_length; ++ int not_space_flag; + + s = col_sep_string; + +@@ -2267,6 +2396,7 @@ + { + for (; separators_not_printed > 0; --separators_not_printed) + { ++ not_space_flag = 0; + while (l-- > 0) + { + /* 3 types of sep_strings: spaces only, spaces and chars, +@@ -2280,12 +2410,15 @@ + } + else + { ++ not_space_flag = 1; + if (spaces_not_printed > 0) + print_white_space (); + putchar (*s++); +- ++output_position; + } + } ++ if (not_space_flag) ++ output_position += col_sep_width; ++ + /* sep_string ends with some spaces */ + if (spaces_not_printed > 0) + print_white_space (); +@@ -2313,7 +2446,7 @@ + required number of tabs and spaces. */ + + static void +-print_char (char c) ++print_char_single (char c) + { + if (tabify_output) + { +@@ -2337,6 +2470,74 @@ + putchar (c); + } + ++#ifdef HAVE_MBRTOWC ++static void ++print_char_multi (char c) ++{ ++ static size_t mbc_pos = 0; ++ static unsigned char mbc[MB_LEN_MAX] = {'\0'}; ++ static mbstate_t state = {'\0'}; ++ mbstate_t state_bak; ++ wchar_t wc; ++ size_t mblength; ++ int width; ++ ++ if (tabify_output) ++ { ++ state_bak = state; ++ mbc[mbc_pos++] = (unsigned char)c; ++ mblength = mbrtowc (&wc, mbc, mbc_pos, &state); ++ ++ while (mbc_pos > 0) ++ { ++ switch (mblength) ++ { ++ case (size_t)-2: ++ state = state_bak; ++ return; ++ ++ case (size_t)-1: ++ state = state_bak; ++ ++output_position; ++ putchar (mbc[0]); ++ memmove (mbc, mbc + 1, MB_CUR_MAX - 1); ++ --mbc_pos; ++ break; ++ ++ case 0: ++ mblength = 1; ++ ++ default: ++ if (wc == L' ') ++ { ++ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength); ++ --mbc_pos; ++ ++spaces_not_printed; ++ return; ++ } ++ else if (spaces_not_printed > 0) ++ print_white_space (); ++ ++ /* Nonprintables are assumed to have width 0, except L'\b'. */ ++ if ((width = wcwidth (wc)) < 1) ++ { ++ if (wc == L'\b') ++ --output_position; ++ } ++ else ++ output_position += width; ++ ++ fwrite (mbc, sizeof(char), mblength, stdout); ++ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength); ++ mbc_pos -= mblength; ++ } ++ } ++ return; ++ } ++ putchar (c); ++} ++#endif ++ + /* Skip to page PAGE before printing. + PAGE may be larger than total number of pages. */ + +@@ -2517,9 +2718,9 @@ + align_empty_cols = false; + } + +- if (padding_not_printed - col_sep_length > 0) ++ if (padding_not_printed - col_sep_width > 0) + { +- pad_across_to (padding_not_printed - col_sep_length); ++ pad_across_to (padding_not_printed - col_sep_width); + padding_not_printed = ANYWHERE; + } + +@@ -2620,9 +2821,9 @@ + } + } + +- if (padding_not_printed - col_sep_length > 0) ++ if (padding_not_printed - col_sep_width > 0) + { +- pad_across_to (padding_not_printed - col_sep_length); ++ pad_across_to (padding_not_printed - col_sep_width); + padding_not_printed = ANYWHERE; + } + +@@ -2635,8 +2836,8 @@ + if (spaces_not_printed == 0) + { + output_position = p->start_position + end_vector[line]; +- if (p->start_position - col_sep_length == chars_per_margin) +- output_position -= col_sep_length; ++ if (p->start_position - col_sep_width == chars_per_margin) ++ output_position -= col_sep_width; + } + + return true; +@@ -2655,7 +2856,7 @@ + number of characters is 1.) */ + + static int +-char_to_clump (char c) ++char_to_clump_single (char c) + { + unsigned char uc = c; + char *s = clump_buff; +@@ -2665,10 +2866,10 @@ + int chars; + int chars_per_c = 8; + +- if (c == input_tab_char) ++ if (c == input_tab_char[0]) + chars_per_c = chars_per_input_tab; + +- if (c == input_tab_char || c == '\t') ++ if (c == input_tab_char[0] || c == '\t') + { + width = TAB_WIDTH (chars_per_c, input_position); + +@@ -2739,6 +2940,154 @@ + return chars; + } + ++#ifdef HAVE_MBRTOWC ++static int ++char_to_clump_multi (char c) ++{ ++ static size_t mbc_pos = 0; ++ static char mbc[MB_LEN_MAX] = {'\0'}; ++ static mbstate_t state = {'\0'}; ++ mbstate_t state_bak; ++ wchar_t wc; ++ size_t mblength; ++ int wc_width; ++ register int *s = clump_buff; ++ register int i, j; ++ char esc_buff[4]; ++ int width; ++ int chars; ++ int chars_per_c = 8; ++ ++ state_bak = state; ++ mbc[mbc_pos++] = c; ++ mblength = mbrtowc (&wc, mbc, mbc_pos, &state); ++ ++ width = 0; ++ chars = 0; ++ while (mbc_pos > 0) ++ { ++ switch (mblength) ++ { ++ case (size_t)-2: ++ state = state_bak; ++ return 0; ++ ++ case (size_t)-1: ++ state = state_bak; ++ mblength = 1; ++ ++ if (use_esc_sequence || use_cntrl_prefix) ++ { ++ width = +4; ++ chars = +4; ++ *s++ = '\\'; ++ sprintf (esc_buff, "%03o", mbc[0]); ++ for (i = 0; i <= 2; ++i) ++ *s++ = (int) esc_buff[i]; ++ } ++ else ++ { ++ width += 1; ++ chars += 1; ++ *s++ = mbc[0]; ++ } ++ break; ++ ++ case 0: ++ mblength = 1; ++ /* Fall through */ ++ ++ default: ++ if (memcmp (mbc, input_tab_char, mblength) == 0) ++ chars_per_c = chars_per_input_tab; ++ ++ if (memcmp (mbc, input_tab_char, mblength) == 0 || c == '\t') ++ { ++ int width_inc; ++ ++ width_inc = TAB_WIDTH (chars_per_c, input_position); ++ width += width_inc; ++ ++ if (untabify_input) ++ { ++ for (i = width_inc; i; --i) ++ *s++ = ' '; ++ chars += width_inc; ++ } ++ else ++ { ++ for (i = 0; i < mblength; i++) ++ *s++ = mbc[i]; ++ chars += mblength; ++ } ++ } ++ else if ((wc_width = wcwidth (wc)) < 1) ++ { ++ if (use_esc_sequence) ++ { ++ for (i = 0; i < mblength; i++) ++ { ++ width += 4; ++ chars += 4; ++ *s++ = '\\'; ++ sprintf (esc_buff, "%03o", c); ++ for (j = 0; j <= 2; ++j) ++ *s++ = (int) esc_buff[j]; ++ } ++ } ++ else if (use_cntrl_prefix) ++ { ++ if (wc < 0200) ++ { ++ width += 2; ++ chars += 2; ++ *s++ = '^'; ++ *s++ = wc ^ 0100; ++ } ++ else ++ { ++ for (i = 0; i < mblength; i++) ++ { ++ width += 4; ++ chars += 4; ++ *s++ = '\\'; ++ sprintf (esc_buff, "%03o", c); ++ for (j = 0; j <= 2; ++j) ++ *s++ = (int) esc_buff[j]; ++ } ++ } ++ } ++ else if (wc == L'\b') ++ { ++ width += -1; ++ chars += 1; ++ *s++ = c; ++ } ++ else ++ { ++ width += 0; ++ chars += mblength; ++ for (i = 0; i < mblength; i++) ++ *s++ = mbc[i]; ++ } ++ } ++ else ++ { ++ width += wc_width; ++ chars += mblength; ++ for (i = 0; i < mblength; i++) ++ *s++ = mbc[i]; ++ } ++ } ++ memmove (mbc, mbc + mblength, MB_CUR_MAX - mblength); ++ mbc_pos -= mblength; ++ } ++ ++ input_position += width; ++ return chars; ++} ++#endif ++ + /* We've just printed some files and need to clean up things before + looking for more options and printing the next batch of files. + +diff -Naur coreutils-6.1.orig/src/sort.c coreutils-6.1/src/sort.c +--- coreutils-6.1.orig/src/sort.c 2006-08-09 07:42:34.000000000 +0000 ++++ coreutils-6.1/src/sort.c 2006-08-23 20:08:12.000000000 +0000 +@@ -23,9 +23,18 @@ + + #include + ++#include + #include + #include + #include ++#if HAVE_WCHAR_H ++# include ++#endif ++/* Get isw* functions. */ ++#if HAVE_WCTYPE_H ++# include ++#endif ++ + #include "system.h" + #include "error.h" + #include "hard-locale.h" +@@ -98,14 +107,38 @@ + /* Thousands separator; if -1, then there isn't one. */ + static int thousands_sep; + ++static int force_general_numcompare = 0; ++ + /* Nonzero if the corresponding locales are hard. */ + static bool hard_LC_COLLATE; +-#if HAVE_NL_LANGINFO ++#if HAVE_LANGINFO_CODESET + static bool hard_LC_TIME; + #endif + + #define NONZERO(x) ((x) != 0) + ++/* get a multibyte character's byte length. */ ++#define GET_BYTELEN_OF_CHAR(LIM, PTR, MBLENGTH, STATE) \ ++ do \ ++ { \ ++ wchar_t wc; \ ++ mbstate_t state_bak; \ ++ \ ++ state_bak = STATE; \ ++ mblength = mbrtowc (&wc, PTR, LIM - PTR, &STATE); \ ++ \ ++ switch (MBLENGTH) \ ++ { \ ++ case (size_t)-1: \ ++ case (size_t)-2: \ ++ STATE = state_bak; \ ++ /* Fall through. */ \ ++ case 0: \ ++ MBLENGTH = 1; \ ++ } \ ++ } \ ++ while (0) ++ + /* The kind of blanks for '-b' to skip in various options. */ + enum blanktype { bl_start, bl_end, bl_both }; + +@@ -243,13 +276,11 @@ + they were read if all keys compare equal. */ + static bool stable; + +-/* If TAB has this value, blanks separate fields. */ +-enum { TAB_DEFAULT = CHAR_MAX + 1 }; +- +-/* Tab character separating fields. If TAB_DEFAULT, then fields are ++/* Tab character separating fields. If tab_length is 0, then fields are + separated by the empty string between a non-blank character and a blank + character. */ +-static int tab = TAB_DEFAULT; ++static char tab[MB_LEN_MAX + 1]; ++static size_t tab_length = 0; + + /* Flag to remove consecutive duplicate lines from the output. + Only the last of a sequence of equal lines will be output. */ +@@ -408,6 +439,44 @@ + static struct tempnode *volatile temphead; + static struct tempnode *volatile *temptail = &temphead; + ++/* Function pointers. */ ++static void ++(*inittables) (void); ++static char * ++(*begfield) (const struct line*, const struct keyfield *); ++static char * ++(*limfield) (const struct line*, const struct keyfield *); ++static int ++(*getmonth) (char const *, size_t); ++static int ++(*keycompare) (const struct line *, const struct line *); ++static int ++(*numcompare) (const char *, const char *); ++ ++/* Test for white space multibyte character. ++ Set LENGTH the byte length of investigated multibyte character. */ ++#if HAVE_MBRTOWC ++static int ++ismbblank (const char *str, size_t len, size_t *length) ++{ ++ size_t mblength; ++ wchar_t wc; ++ mbstate_t state; ++ ++ memset (&state, '\0', sizeof(mbstate_t)); ++ mblength = mbrtowc (&wc, str, len, &state); ++ ++ if (mblength == (size_t)-1 || mblength == (size_t)-2) ++ { ++ *length = 1; ++ return 0; ++ } ++ ++ *length = (mblength < 1) ? 1 : mblength; ++ return iswblank (wc); ++} ++#endif ++ + /* Clean up any remaining temporary files. */ + + static void +@@ -561,7 +630,7 @@ + free (node); + } + +-#if HAVE_NL_LANGINFO ++#if HAVE_LANGINFO_CODESET + + static int + struct_month_cmp (const void *m1, const void *m2) +@@ -576,7 +645,7 @@ + /* Initialize the character class tables. */ + + static void +-inittables (void) ++inittables_uni (void) + { + size_t i; + +@@ -588,7 +657,7 @@ + fold_toupper[i] = toupper (i); + } + +-#if HAVE_NL_LANGINFO ++#if HAVE_LANGINFO_CODESET + /* If we're not in the "C" locale, read different names for months. */ + if (hard_LC_TIME) + { +@@ -614,6 +683,64 @@ + #endif + } + ++#if HAVE_MBRTOWC ++static void ++inittables_mb (void) ++{ ++ int i, j, k, l; ++ char *name, *s; ++ size_t s_len, mblength; ++ char mbc[MB_LEN_MAX]; ++ wchar_t wc, pwc; ++ mbstate_t state_mb, state_wc; ++ ++ for (i = 0; i < MONTHS_PER_YEAR; i++) ++ { ++ s = (char *) nl_langinfo (ABMON_1 + i); ++ s_len = strlen (s); ++ monthtab[i].name = name = (char *) xmalloc (s_len + 1); ++ monthtab[i].val = i + 1; ++ ++ memset (&state_mb, '\0', sizeof (mbstate_t)); ++ memset (&state_wc, '\0', sizeof (mbstate_t)); ++ ++ for (j = 0; j < s_len;) ++ { ++ if (!ismbblank (s + j, s_len - j, &mblength)) ++ break; ++ j += mblength; ++ } ++ ++ for (k = 0; j < s_len;) ++ { ++ mblength = mbrtowc (&wc, (s + j), (s_len - j), &state_mb); ++ assert (mblength != (size_t)-1 && mblength != (size_t)-2); ++ if (mblength == 0) ++ break; ++ ++ pwc = towupper (wc); ++ if (pwc == wc) ++ { ++ memcpy (mbc, s + j, mblength); ++ j += mblength; ++ } ++ else ++ { ++ j += mblength; ++ mblength = wcrtomb (mbc, pwc, &state_wc); ++ assert (mblength != (size_t)0 && mblength != (size_t)-1); ++ } ++ ++ for (l = 0; l < mblength; l++) ++ name[k++] = mbc[l]; ++ } ++ name[k] = '\0'; ++ } ++ qsort ((void *) monthtab, MONTHS_PER_YEAR, ++ sizeof (struct month), struct_month_cmp); ++} ++#endif ++ + /* Specify the amount of main memory to use when sorting. */ + static void + specify_sort_size (char const *s) +@@ -824,7 +951,7 @@ + by KEY in LINE. */ + + static char * +-begfield (const struct line *line, const struct keyfield *key) ++begfield_uni (const struct line *line, const struct keyfield *key) + { + char *ptr = line->text, *lim = ptr + line->length - 1; + size_t sword = key->sword; +@@ -834,10 +961,10 @@ + /* The leading field separator itself is included in a field when -t + is absent. */ + +- if (tab != TAB_DEFAULT) ++ if (tab_length) + while (ptr < lim && sword--) + { +- while (ptr < lim && *ptr != tab) ++ while (ptr < lim && *ptr != tab[0]) + ++ptr; + if (ptr < lim) + ++ptr; +@@ -865,11 +992,70 @@ + return ptr; + } + ++#if HAVE_MBRTOWC ++static char * ++begfield_mb (const struct line *line, const struct keyfield *key) ++{ ++ int i; ++ char *ptr = line->text, *lim = ptr + line->length - 1; ++ size_t sword = key->sword; ++ size_t schar = key->schar; ++ size_t mblength; ++ mbstate_t state; ++ ++ memset (&state, '\0', sizeof(mbstate_t)); ++ ++ if (tab_length) ++ while (ptr < lim && sword--) ++ { ++ while (ptr < lim && memcmp (ptr, tab, tab_length) != 0) ++ { ++ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); ++ ptr += mblength; ++ } ++ if (ptr < lim) ++ { ++ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); ++ ptr += mblength; ++ } ++ } ++ else ++ while (ptr < lim && sword--) ++ { ++ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength)) ++ ptr += mblength; ++ if (ptr < lim) ++ { ++ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); ++ ptr += mblength; ++ } ++ while (ptr < lim && !ismbblank (ptr, lim - ptr, &mblength)) ++ ptr += mblength; ++ } ++ ++ if (key->skipsblanks) ++ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength)) ++ ptr += mblength; ++ ++ for (i = 0; i < schar; i++) ++ { ++ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); ++ ++ if (ptr + mblength > lim) ++ break; ++ else ++ ptr += mblength; ++ } ++ ++ return ptr; ++} ++#endif ++ + /* Return the limit of (a pointer to the first character after) the field + in LINE specified by KEY. */ + + static char * +-limfield (const struct line *line, const struct keyfield *key) ++limfield_uni (const struct line *line, const struct keyfield *key) + { + char *ptr = line->text, *lim = ptr + line->length - 1; + size_t eword = key->eword, echar = key->echar; +@@ -882,10 +1068,10 @@ + `beginning' is the first character following the delimiting TAB. + Otherwise, leave PTR pointing at the first `blank' character after + the preceding field. */ +- if (tab != TAB_DEFAULT) ++ if (tab_length) + while (ptr < lim && eword--) + { +- while (ptr < lim && *ptr != tab) ++ while (ptr < lim && *ptr != tab[0]) + ++ptr; + if (ptr < lim && (eword | echar)) + ++ptr; +@@ -931,10 +1117,10 @@ + */ + + /* Make LIM point to the end of (one byte past) the current field. */ +- if (tab != TAB_DEFAULT) ++ if (tab_length) + { + char *newlim; +- newlim = memchr (ptr, tab, lim - ptr); ++ newlim = memchr (ptr, tab[0], lim - ptr); + if (newlim) + lim = newlim; + } +@@ -967,6 +1153,107 @@ + return ptr; + } + ++#if HAVE_MBRTOWC ++static char * ++limfield_mb (const struct line *line, const struct keyfield *key) ++{ ++ char *ptr = line->text, *lim = ptr + line->length - 1; ++ size_t eword = key->eword, echar = key->echar; ++ int i; ++ size_t mblength; ++ mbstate_t state; ++ ++ memset (&state, '\0', sizeof(mbstate_t)); ++ ++ if (tab_length) ++ while (ptr < lim && eword--) ++ { ++ while (ptr < lim && memcmp (ptr, tab, tab_length) != 0) ++ { ++ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); ++ ptr += mblength; ++ } ++ if (ptr < lim && (eword | echar)) ++ { ++ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); ++ ptr += mblength; ++ } ++ } ++ else ++ while (ptr < lim && eword--) ++ { ++ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength)) ++ ptr += mblength; ++ if (ptr < lim) ++ { ++ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); ++ ptr += mblength; ++ } ++ while (ptr < lim && !ismbblank (ptr, lim - ptr, &mblength)) ++ ptr += mblength; ++ } ++ ++ ++# ifdef POSIX_UNSPECIFIED ++ /* Make LIM point to the end of (one byte past) the current field. */ ++ if (tab_length) ++ { ++ char *newlim, *p; ++ ++ newlim = NULL; ++ for (p = ptr; p < lim;) ++ { ++ if (memcmp (p, tab, tab_length) == 0) ++ { ++ newlim = p; ++ break; ++ } ++ ++ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); ++ p += mblength; ++ } ++ } ++ else ++ { ++ char *newlim; ++ newlim = ptr; ++ ++ while (newlim < lim && ismbblank (newlim, lim - newlim, &mblength)) ++ newlim += mblength; ++ if (ptr < lim) ++ { ++ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); ++ ptr += mblength; ++ } ++ while (newlim < lim && !ismbblank (newlim, lim - newlim, &mblength)) ++ newlim += mblength; ++ lim = newlim; ++ } ++# endif ++ ++ /* If we're skipping leading blanks, don't start counting characters ++ * until after skipping past any leading blanks. */ ++ if (key->skipsblanks) ++ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength)) ++ ptr += mblength; ++ ++ memset (&state, '\0', sizeof(mbstate_t)); ++ ++ /* Advance PTR by ECHAR (if possible), but no further than LIM. */ ++ for (i = 0; i < echar; i++) ++ { ++ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); ++ ++ if (ptr + mblength > lim) ++ break; ++ else ++ ptr += mblength; ++ } ++ ++ return ptr; ++} ++#endif ++ + /* Fill BUF reading from FP, moving buf->left bytes from the end + of buf->buf to the beginning first. If EOF is reached and the + file wasn't terminated by a newline, supply one. Set up BUF's line +@@ -1083,7 +1370,7 @@ + hideously fast. */ + + static int +-numcompare (const char *a, const char *b) ++numcompare_uni (const char *a, const char *b) + { + while (blanks[to_uchar (*a)]) + a++; +@@ -1093,6 +1380,25 @@ + return strnumcmp (a, b, decimal_point, thousands_sep); + } + ++#if HAVE_MBRTOWC ++static int ++numcompare_mb (const char *a, const char *b) ++{ ++ size_t mblength, len; ++ len = strlen (a); /* okay for UTF-8 */ ++ while (*a && ismbblank (a, len > MB_CUR_MAX ? MB_CUR_MAX : len, &mblength)) ++ { ++ a += mblength; ++ len -= mblength; ++ } ++ len = strlen (b); /* okay for UTF-8 */ ++ while (*b && ismbblank (b, len > MB_CUR_MAX ? MB_CUR_MAX : len, &mblength)) ++ b += mblength; ++ ++ return strnumcmp (a, b, decimal_point, thousands_sep); ++} ++#endif /* HAV_EMBRTOWC */ ++ + static int + general_numcompare (const char *sa, const char *sb) + { +@@ -1126,7 +1432,7 @@ + Return 0 if the name in S is not recognized. */ + + static int +-getmonth (char const *month, size_t len) ++getmonth_uni (char const *month, size_t len) + { + size_t lo = 0; + size_t hi = MONTHS_PER_YEAR; +@@ -1281,11 +1587,79 @@ + return diff; + } + ++#if HAVE_MBRTOWC ++static int ++getmonth_mb (const char *s, size_t len) ++{ ++ char *month; ++ register size_t i; ++ register int lo = 0, hi = MONTHS_PER_YEAR, result; ++ char *tmp; ++ size_t wclength, mblength; ++ const char **pp; ++ const wchar_t **wpp; ++ wchar_t *month_wcs; ++ mbstate_t state; ++ ++ while (len > 0 && ismbblank (s, len, &mblength)) ++ { ++ s += mblength; ++ len -= mblength; ++ } ++ ++ if (len == 0) ++ return 0; ++ ++ month = (char *) alloca (len + 1); ++ ++ tmp = (char *) alloca (len + 1); ++ memcpy (tmp, s, len); ++ tmp[len] = '\0'; ++ pp = (const char **)&tmp; ++ month_wcs = (wchar_t *) alloca ((len + 1) * sizeof (wchar_t)); ++ memset (&state, '\0', sizeof(mbstate_t)); ++ ++ wclength = mbsrtowcs (month_wcs, pp, len + 1, &state); ++ assert (wclength != (size_t)-1 && *pp == NULL); ++ ++ for (i = 0; i < wclength; i++) ++ { ++ month_wcs[i] = towupper(month_wcs[i]); ++ if (iswblank (month_wcs[i])) ++ { ++ month_wcs[i] = L'\0'; ++ break; ++ } ++ } ++ ++ wpp = (const wchar_t **)&month_wcs; ++ ++ mblength = wcsrtombs (month, wpp, len + 1, &state); ++ assert (mblength != (-1) && *wpp == NULL); ++ ++ do ++ { ++ int ix = (lo + hi) / 2; ++ ++ if (strncmp (month, monthtab[ix].name, strlen (monthtab[ix].name)) < 0) ++ hi = ix; ++ else ++ lo = ix; ++ } ++ while (hi - lo > 1); ++ ++ result = (!strncmp (month, monthtab[lo].name, strlen (monthtab[lo].name)) ++ ? monthtab[lo].val : 0); ++ ++ return result; ++} ++#endif ++ + /* Compare two lines A and B trying every key in sequence until there + are no more keys or a difference is found. */ + + static int +-keycompare (const struct line *a, const struct line *b) ++keycompare_uni (const struct line *a, const struct line *b) + { + struct keyfield const *key = keylist; + +@@ -1458,6 +1832,177 @@ + return key->reverse ? -diff : diff; + } + ++#if HAVE_MBRTOWC ++static int ++keycompare_mb (const struct line *a, const struct line *b) ++{ ++ struct keyfield *key = keylist; ++ ++ /* For the first iteration only, the key positions have been ++ precomputed for us. */ ++ char *texta = a->keybeg; ++ char *textb = b->keybeg; ++ char *lima = a->keylim; ++ char *limb = b->keylim; ++ ++ size_t mblength_a, mblength_b; ++ wchar_t wc_a, wc_b; ++ mbstate_t state_a, state_b; ++ ++ int diff; ++ ++ memset (&state_a, '\0', sizeof(mbstate_t)); ++ memset (&state_b, '\0', sizeof(mbstate_t)); ++ ++ for (;;) ++ { ++ unsigned char *translate = (unsigned char *) key->translate; ++ bool const *ignore = key->ignore; ++ ++ /* Find the lengths. */ ++ size_t lena = lima <= texta ? 0 : lima - texta; ++ size_t lenb = limb <= textb ? 0 : limb - textb; ++ ++ /* Actually compare the fields. */ ++ if (key->numeric | key->general_numeric) ++ { ++ char savea = *lima, saveb = *limb; ++ ++ *lima = *limb = '\0'; ++ if (force_general_numcompare) ++ diff = general_numcompare (texta, textb); ++ else ++ diff = ((key->numeric ? numcompare : general_numcompare) ++ (texta, textb)); ++ *lima = savea, *limb = saveb; ++ } ++ else if (key->month) ++ diff = getmonth (texta, lena) - getmonth (textb, lenb); ++ else ++ { ++ if (ignore || translate) ++ { ++ char *copy_a = (char *) alloca (lena + 1 + lenb + 1); ++ char *copy_b = copy_a + lena + 1; ++ size_t new_len_a, new_len_b; ++ size_t i, j; ++ ++ /* Ignore and/or translate chars before comparing. */ ++# define IGNORE_CHARS(NEW_LEN, LEN, TEXT, COPY, WC, MBLENGTH, STATE) \ ++ do \ ++ { \ ++ wchar_t uwc; \ ++ char mbc[MB_LEN_MAX]; \ ++ mbstate_t state_wc; \ ++ \ ++ for (NEW_LEN = i = 0; i < LEN;) \ ++ { \ ++ mbstate_t state_bak; \ ++ \ ++ state_bak = STATE; \ ++ MBLENGTH = mbrtowc (&WC, TEXT + i, LEN - i, &STATE); \ ++ \ ++ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1 \ ++ || MBLENGTH == 0) \ ++ { \ ++ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \ ++ STATE = state_bak; \ ++ if (!ignore) \ ++ COPY[NEW_LEN++] = TEXT[i++]; \ ++ continue; \ ++ } \ ++ \ ++ if (ignore) \ ++ { \ ++ if ((ignore == nonprinting && !iswprint (WC)) \ ++ || (ignore == nondictionary \ ++ && !iswalnum (WC) && !iswblank (WC))) \ ++ { \ ++ i += MBLENGTH; \ ++ continue; \ ++ } \ ++ } \ ++ \ ++ if (translate) \ ++ { \ ++ \ ++ uwc = towupper(WC); \ ++ if (WC == uwc) \ ++ { \ ++ memcpy (mbc, TEXT + i, MBLENGTH); \ ++ i += MBLENGTH; \ ++ } \ ++ else \ ++ { \ ++ i += MBLENGTH; \ ++ WC = uwc; \ ++ memset (&state_wc, '\0', sizeof (mbstate_t)); \ ++ \ ++ MBLENGTH = wcrtomb (mbc, WC, &state_wc); \ ++ assert (MBLENGTH != (size_t)-1 && MBLENGTH != 0); \ ++ } \ ++ \ ++ for (j = 0; j < MBLENGTH; j++) \ ++ COPY[NEW_LEN++] = mbc[j]; \ ++ } \ ++ else \ ++ for (j = 0; j < MBLENGTH; j++) \ ++ COPY[NEW_LEN++] = TEXT[i++]; \ ++ } \ ++ COPY[NEW_LEN] = '\0'; \ ++ } \ ++ while (0) ++ IGNORE_CHARS (new_len_a, lena, texta, copy_a, ++ wc_a, mblength_a, state_a); ++ IGNORE_CHARS (new_len_b, lenb, textb, copy_b, ++ wc_b, mblength_b, state_b); ++ diff = xmemcoll (copy_a, new_len_a, copy_b, new_len_b); ++ } ++ else if (lena == 0) ++ diff = - NONZERO (lenb); ++ else if (lenb == 0) ++ goto greater; ++ else ++ diff = xmemcoll (texta, lena, textb, lenb); ++ } ++ ++ if (diff) ++ goto not_equal; ++ ++ key = key->next; ++ if (! key) ++ break; ++ ++ /* Find the beginning and limit of the next field. */ ++ if (key->eword != -1) ++ lima = limfield (a, key), limb = limfield (b, key); ++ else ++ lima = a->text + a->length - 1, limb = b->text + b->length - 1; ++ ++ if (key->sword != -1) ++ texta = begfield (a, key), textb = begfield (b, key); ++ else ++ { ++ texta = a->text, textb = b->text; ++ if (key->skipsblanks) ++ { ++ while (texta < lima && ismbblank (texta, lima - texta, &mblength_a)) ++ texta += mblength_a; ++ while (textb < limb && ismbblank (textb, limb - textb, &mblength_b)) ++ textb += mblength_b; ++ } ++ } ++ } ++ ++ return 0; ++ ++greater: ++ diff = 1; ++not_equal: ++ return key->reverse ? -diff : diff; ++} ++#endif ++ + /* Compare two lines A and B, returning negative, zero, or positive + depending on whether A compares less than, equal to, or greater than B. */ + +@@ -2307,7 +2852,7 @@ + atexit (close_stdout); + + hard_LC_COLLATE = hard_locale (LC_COLLATE); +-#if HAVE_NL_LANGINFO ++#if HAVE_LANGINFO_CODESET + hard_LC_TIME = hard_locale (LC_TIME); + #endif + +@@ -2328,6 +2873,27 @@ + thousands_sep = -1; + } + ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ { ++ inittables = inittables_mb; ++ begfield = begfield_mb; ++ limfield = limfield_mb; ++ getmonth = getmonth_mb; ++ keycompare = keycompare_mb; ++ numcompare = numcompare_mb; ++ } ++ else ++#endif ++ { ++ inittables = inittables_uni; ++ begfield = begfield_uni; ++ limfield = limfield_uni; ++ getmonth = getmonth_uni; ++ keycompare = keycompare_uni; ++ numcompare = numcompare_uni; ++ } ++ + have_read_stdin = false; + inittables (); + +@@ -2542,13 +3108,35 @@ + + case 't': + { +- char newtab = optarg[0]; +- if (! newtab) ++ char newtab[MB_LEN_MAX + 1]; ++ size_t newtab_length = 1; ++ strncpy (newtab, optarg, MB_LEN_MAX); ++ if (! newtab[0]) + error (SORT_FAILURE, 0, _("empty tab")); +- if (optarg[1]) ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ { ++ wchar_t wc; ++ mbstate_t state; ++ size_t i; ++ ++ memset (&state, '\0', sizeof (mbstate_t)); ++ newtab_length = mbrtowc (&wc, newtab, strnlen (newtab, ++ MB_LEN_MAX), ++ &state); ++ switch (newtab_length) ++ { ++ case (size_t) -1: ++ case (size_t) -2: ++ case 0: ++ newtab_length = 1; ++ } ++ } ++#endif ++ if (newtab_length == 1 && optarg[1]) + { + if (STREQ (optarg, "\\0")) +- newtab = '\0'; ++ newtab[0] = '\0'; + else + { + /* Provoke with `sort -txx'. Complain about +@@ -2559,9 +3147,12 @@ + quote (optarg)); + } + } +- if (tab != TAB_DEFAULT && tab != newtab) ++ if (tab_length ++ && (tab_length != newtab_length ++ || memcmp (tab, newtab, tab_length) != 0)) + error (SORT_FAILURE, 0, _("incompatible tabs")); +- tab = newtab; ++ memcpy (tab, newtab, newtab_length); ++ tab_length = newtab_length; + } + break; + +diff -Naur coreutils-6.1.orig/src/unexpand.c coreutils-6.1/src/unexpand.c +--- coreutils-6.1.orig/src/unexpand.c 2006-07-09 17:06:58.000000000 +0000 ++++ coreutils-6.1/src/unexpand.c 2006-08-23 20:08:12.000000000 +0000 +@@ -39,11 +39,28 @@ + #include + #include + #include ++ ++/* Get mbstate_t, mbrtowc(), wcwidth(). */ ++#if HAVE_WCHAR_H ++# include ++#endif ++ + #include "system.h" + #include "error.h" + #include "quote.h" + #include "xstrndup.h" + ++/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC ++ installation; work around this configuration error. */ ++#if !defined MB_LEN_MAX || MB_LEN_MAX < 2 ++# define MB_LEN_MAX 16 ++#endif ++ ++/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ ++#if HAVE_MBRTOWC && defined mbstate_t ++# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) ++#endif ++ + /* The official name of this program (e.g., no `g' prefix). */ + #define PROGRAM_NAME "unexpand" + +@@ -110,6 +127,208 @@ + {NULL, 0, NULL, 0} + }; + ++static FILE *next_file (FILE *fp); ++ ++#if HAVE_MBRTOWC ++static void ++unexpand_multibyte (void) ++{ ++ FILE *fp; /* Input stream. */ ++ mbstate_t i_state; /* Current shift state of the input stream. */ ++ mbstate_t i_state_bak; /* Back up the I_STATE. */ ++ mbstate_t o_state; /* Current shift state of the output stream. */ ++ char buf[MB_LEN_MAX + BUFSIZ]; /* For spooling a read byte sequence. */ ++ char *bufpos; /* Next read position of BUF. */ ++ size_t buflen = 0; /* The length of the byte sequence in buf. */ ++ wint_t wc; /* A gotten wide character. */ ++ size_t mblength; /* The byte size of a multibyte character ++ which shows as same character as WC. */ ++ ++ /* Index in `tab_list' of next tabstop: */ ++ int tab_index = 0; /* For calculating width of pending tabs. */ ++ int print_tab_index = 0; /* For printing as many tabs as possible. */ ++ unsigned int column = 0; /* Column on screen of next char. */ ++ int next_tab_column; /* Column the next tab stop is on. */ ++ int convert = 1; /* If nonzero, perform translations. */ ++ unsigned int pending = 0; /* Pending columns of blanks. */ ++ ++ fp = next_file ((FILE *) NULL); ++ if (fp == NULL) ++ return; ++ ++ memset (&o_state, '\0', sizeof(mbstate_t)); ++ memset (&i_state, '\0', sizeof(mbstate_t)); ++ ++ for (;;) ++ { ++ if (buflen < MB_LEN_MAX && !feof(fp) && !ferror(fp)) ++ { ++ memmove (buf, bufpos, buflen); ++ buflen += fread (buf + buflen, sizeof(char), BUFSIZ, fp); ++ bufpos = buf; ++ } ++ ++ /* Get a wide character. */ ++ if (buflen < 1) ++ { ++ mblength = 1; ++ wc = WEOF; ++ } ++ else ++ { ++ i_state_bak = i_state; ++ mblength = mbrtowc ((wchar_t *)&wc, bufpos, buflen, &i_state); ++ } ++ ++ if (mblength == (size_t)-1 || mblength == (size_t)-2) ++ { ++ i_state = i_state_bak; ++ wc = L'\0'; ++ } ++ ++ if (wc == L' ' && convert && column < INT_MAX) ++ { ++ ++pending; ++ ++column; ++ } ++ else if (wc == L'\t' && convert) ++ { ++ if (tab_size == 0) ++ { ++ /* Do not let tab_index == first_free_tab; ++ stop when it is 1 less. */ ++ while (tab_index < first_free_tab - 1 ++ && column >= tab_list[tab_index]) ++ tab_index++; ++ next_tab_column = tab_list[tab_index]; ++ if (tab_index < first_free_tab - 1) ++ tab_index++; ++ if (column >= next_tab_column) ++ { ++ convert = 0; /* Ran out of tab stops. */ ++ goto flush_pend_mb; ++ } ++ } ++ else ++ { ++ next_tab_column = column + tab_size - column % tab_size; ++ } ++ pending += next_tab_column - column; ++ column = next_tab_column; ++ } ++ else ++ { ++flush_pend_mb: ++ /* Flush pending spaces. Print as many tabs as possible, ++ then print the rest as spaces. */ ++ if (pending == 1) ++ { ++ putchar (' '); ++ pending = 0; ++ } ++ column -= pending; ++ while (pending > 0) ++ { ++ if (tab_size == 0) ++ { ++ /* Do not let print_tab_index == first_free_tab; ++ stop when it is 1 less. */ ++ while (print_tab_index < first_free_tab - 1 ++ && column >= tab_list[print_tab_index]) ++ print_tab_index++; ++ next_tab_column = tab_list[print_tab_index]; ++ if (print_tab_index < first_free_tab - 1) ++ print_tab_index++; ++ } ++ else ++ { ++ next_tab_column = ++ column + tab_size - column % tab_size; ++ } ++ if (next_tab_column - column <= pending) ++ { ++ putchar ('\t'); ++ pending -= next_tab_column - column; ++ column = next_tab_column; ++ } ++ else ++ { ++ --print_tab_index; ++ column += pending; ++ while (pending != 0) ++ { ++ putchar (' '); ++ pending--; ++ } ++ } ++ } ++ ++ if (wc == WEOF) ++ { ++ fp = next_file (fp); ++ if (fp == NULL) ++ break; /* No more files. */ ++ else ++ { ++ memset (&i_state, '\0', sizeof(mbstate_t)); ++ continue; ++ } ++ } ++ ++ if (mblength == (size_t)-1 || mblength == (size_t)-2) ++ { ++ if (convert) ++ { ++ ++column; ++ if (convert_entire_line == 0) ++ convert = 0; ++ } ++ mblength = 1; ++ putchar (buf[0]); ++ } ++ else if (mblength == 0) ++ { ++ if (convert && convert_entire_line == 0) ++ convert = 0; ++ mblength = 1; ++ putchar ('\0'); ++ } ++ else ++ { ++ if (convert) ++ { ++ if (wc == L'\b') ++ { ++ if (column > 0) ++ --column; ++ } ++ else ++ { ++ int width; /* The width of WC. */ ++ ++ width = wcwidth (wc); ++ column += (width > 0) ? width : 0; ++ if (convert_entire_line == 0) ++ convert = 0; ++ } ++ } ++ ++ if (wc == L'\n') ++ { ++ tab_index = print_tab_index = 0; ++ column = pending = 0; ++ convert = 1; ++ } ++ fwrite (bufpos, sizeof(char), mblength, stdout); ++ } ++ } ++ buflen -= mblength; ++ bufpos += mblength; ++ } ++} ++#endif ++ ++ + void + usage (int status) + { +@@ -531,7 +750,12 @@ + + file_list = (optind < argc ? &argv[optind] : stdin_argv); + +- unexpand (); ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ unexpand_multibyte (); ++ else ++#endif ++ unexpand (); + + if (have_read_stdin && fclose (stdin) != 0) + error (EXIT_FAILURE, errno, "-"); +diff -Naur coreutils-6.1.orig/src/uniq.c coreutils-6.1/src/uniq.c +--- coreutils-6.1.orig/src/uniq.c 2006-07-09 17:20:43.000000000 +0000 ++++ coreutils-6.1/src/uniq.c 2006-08-23 20:08:12.000000000 +0000 +@@ -23,6 +23,16 @@ + #include + #include + ++/* Get mbstate_t, mbrtowc(). */ ++#if HAVE_WCHAR_H ++# include ++#endif ++ ++/* Get isw* functions. */ ++#if HAVE_WCTYPE_H ++# include ++#endif ++ + #include "system.h" + #include "argmatch.h" + #include "linebuffer.h" +@@ -32,7 +42,19 @@ + #include "quote.h" + #include "xmemcoll.h" + #include "xstrtol.h" +-#include "memcasecmp.h" ++#include "xmemcoll.h" ++ ++/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC ++ installation; work around this configuration error. */ ++#if !defined MB_LEN_MAX || MB_LEN_MAX < 2 ++# define MB_LEN_MAX 16 ++#endif ++ ++/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ ++#if HAVE_MBRTOWC && defined mbstate_t ++# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) ++#endif ++ + + /* The official name of this program (e.g., no `g' prefix). */ + #define PROGRAM_NAME "uniq" +@@ -109,6 +131,10 @@ + /* Select whether/how to delimit groups of duplicate lines. */ + static enum delimit_method delimit_groups; + ++/* Function pointers. */ ++static char * ++(*find_field) (struct linebuffer *line); ++ + static struct option const longopts[] = + { + {"count", no_argument, NULL, 'c'}, +@@ -189,7 +215,7 @@ + return a pointer to the beginning of the line's field to be compared. */ + + static char * +-find_field (const struct linebuffer *line) ++find_field_uni (struct linebuffer *line) + { + size_t count; + char *lp = line->buffer; +@@ -210,6 +236,83 @@ + return lp + i; + } + ++#if HAVE_MBRTOWC ++ ++# define MBCHAR_TO_WCHAR(WC, MBLENGTH, LP, POS, SIZE, STATEP, CONVFAIL) \ ++ do \ ++ { \ ++ mbstate_t state_bak; \ ++ \ ++ CONVFAIL = 0; \ ++ state_bak = *STATEP; \ ++ \ ++ MBLENGTH = mbrtowc (&WC, LP + POS, SIZE - POS, STATEP); \ ++ \ ++ switch (MBLENGTH) \ ++ { \ ++ case (size_t)-2: \ ++ case (size_t)-1: \ ++ *STATEP = state_bak; \ ++ CONVFAIL++; \ ++ /* Fall through */ \ ++ case 0: \ ++ MBLENGTH = 1; \ ++ } \ ++ } \ ++ while (0) ++ ++static char * ++find_field_multi (struct linebuffer *line) ++{ ++ size_t count; ++ char *lp = line->buffer; ++ size_t size = line->length - 1; ++ size_t pos; ++ size_t mblength; ++ wchar_t wc; ++ mbstate_t *statep; ++ int convfail; ++ ++ pos = 0; ++ statep = &(line->state); ++ ++ /* skip fields. */ ++ for (count = 0; count < skip_fields && pos < size; count++) ++ { ++ while (pos < size) ++ { ++ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail); ++ ++ if (convfail || !iswblank (wc)) ++ { ++ pos += mblength; ++ break; ++ } ++ pos += mblength; ++ } ++ ++ while (pos < size) ++ { ++ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail); ++ ++ if (!convfail && iswblank (wc)) ++ break; ++ ++ pos += mblength; ++ } ++ } ++ ++ /* skip fields. */ ++ for (count = 0; count < skip_chars && pos < size; count++) ++ { ++ MBCHAR_TO_WCHAR (wc, mblength, lp, pos, size, statep, convfail); ++ pos += mblength; ++ } ++ ++ return lp + pos; ++} ++#endif ++ + /* Return false if two strings OLD and NEW match, true if not. + OLD and NEW point not to the beginnings of the lines + but rather to the beginnings of the fields to compare. +@@ -218,6 +321,8 @@ + static bool + different (char *old, char *new, size_t oldlen, size_t newlen) + { ++ char *copy_old, *copy_new; ++ + if (check_chars < oldlen) + oldlen = check_chars; + if (check_chars < newlen) +@@ -225,14 +330,92 @@ + + if (ignore_case) + { +- /* FIXME: This should invoke strcoll somehow. */ +- return oldlen != newlen || memcasecmp (old, new, oldlen); ++ size_t i; ++ ++ copy_old = alloca (oldlen + 1); ++ copy_new = alloca (oldlen + 1); ++ ++ for (i = 0; i < oldlen; i++) ++ { ++ copy_old[i] = toupper (old[i]); ++ copy_new[i] = toupper (new[i]); ++ } + } +- else if (hard_LC_COLLATE) +- return xmemcoll (old, oldlen, new, newlen) != 0; + else +- return oldlen != newlen || memcmp (old, new, oldlen); ++ { ++ copy_old = (char *)old; ++ copy_new = (char *)new; ++ } ++ ++ return xmemcoll (copy_old, oldlen, copy_new, newlen); ++} ++ ++#if HAVE_MBRTOWC ++static int ++different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate) ++{ ++ size_t i, j, chars; ++ const char *str[2]; ++ char *copy[2]; ++ size_t len[2]; ++ mbstate_t state[2]; ++ size_t mblength; ++ wchar_t wc, uwc; ++ mbstate_t state_bak; ++ ++ str[0] = old; ++ str[1] = new; ++ len[0] = oldlen; ++ len[1] = newlen; ++ state[0] = oldstate; ++ state[1] = newstate; ++ ++ for (i = 0; i < 2; i++) ++ { ++ copy[i] = alloca (len[i] + 1); ++ ++ for (j = 0, chars = 0; j < len[i] && chars < check_chars; chars++) ++ { ++ state_bak = state[i]; ++ mblength = mbrtowc (&wc, str[i] + j, len[i] - j, &(state[i])); ++ ++ switch (mblength) ++ { ++ case (size_t)-1: ++ case (size_t)-2: ++ state[i] = state_bak; ++ /* Fall through */ ++ case 0: ++ mblength = 1; ++ break; ++ ++ default: ++ if (ignore_case) ++ { ++ uwc = towupper (wc); ++ ++ if (uwc != wc) ++ { ++ mbstate_t state_wc; ++ ++ memset (&state_wc, '\0', sizeof(mbstate_t)); ++ wcrtomb (copy[i] + j, uwc, &state_wc); ++ } ++ else ++ memcpy (copy[i] + j, str[i] + j, mblength); ++ } ++ else ++ memcpy (copy[i] + j, str[i] + j, mblength); ++ } ++ j += mblength; ++ } ++ copy[i][j] = '\0'; ++ len[i] = j; ++ } ++ ++ return xmemcoll (copy[0], len[0], copy[1], len[1]); + } ++#endif + + /* Output the line in linebuffer LINE to standard output + provided that the switches say it should be output. +@@ -286,15 +469,43 @@ + { + char *prevfield IF_LINT (= NULL); + size_t prevlen IF_LINT (= 0); ++#if HAVE_MBRTOWC ++ mbstate_t prevstate; ++ ++ memset (&prevstate, '\0', sizeof (mbstate_t)); ++#endif + + while (!feof (stdin)) + { + char *thisfield; + size_t thislen; ++#if HAVE_MBRTOWC ++ mbstate_t thisstate; ++#endif ++ + if (readlinebuffer (thisline, stdin) == 0) + break; + thisfield = find_field (thisline); + thislen = thisline->length - 1 - (thisfield - thisline->buffer); ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ { ++ thisstate = thisline->state; ++ ++ if (prevline->length == 0 || different_multi ++ (thisfield, prevfield, thislen, prevlen, thisstate, prevstate)) ++ { ++ fwrite (thisline->buffer, sizeof (char), ++ thisline->length, stdout); ++ ++ SWAP_LINES (prevline, thisline); ++ prevfield = thisfield; ++ prevlen = thislen; ++ prevstate = thisstate; ++ } ++ } ++ else ++#endif + if (prevline->length == 0 + || different (thisfield, prevfield, thislen, prevlen)) + { +@@ -313,17 +524,26 @@ + size_t prevlen; + uintmax_t match_count = 0; + bool first_delimiter = true; ++#if HAVE_MBRTOWC ++ mbstate_t prevstate; ++#endif + + if (readlinebuffer (prevline, stdin) == 0) + goto closefiles; + prevfield = find_field (prevline); + prevlen = prevline->length - 1 - (prevfield - prevline->buffer); ++#if HAVE_MBRTOWC ++ prevstate = prevline->state; ++#endif + + while (!feof (stdin)) + { + bool match; + char *thisfield; + size_t thislen; ++#if HAVE_MBRTOWC ++ mbstate_t thisstate; ++#endif + if (readlinebuffer (thisline, stdin) == 0) + { + if (ferror (stdin)) +@@ -332,6 +552,15 @@ + } + thisfield = find_field (thisline); + thislen = thisline->length - 1 - (thisfield - thisline->buffer); ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ { ++ thisstate = thisline->state; ++ match = !different_multi (thisfield, prevfield, ++ thislen, prevlen, thisstate, prevstate); ++ } ++ else ++#endif + match = !different (thisfield, prevfield, thislen, prevlen); + match_count += match; + +@@ -364,6 +593,9 @@ + SWAP_LINES (prevline, thisline); + prevfield = thisfield; + prevlen = thislen; ++#if HAVE_MBRTOWC ++ prevstate = thisstate; ++#endif + if (!match) + match_count = 0; + } +@@ -408,6 +640,19 @@ + + atexit (close_stdout); + ++#if HAVE_MBRTOWC ++ if (MB_CUR_MAX > 1) ++ { ++ find_field = find_field_multi; ++ } ++ else ++#endif ++ { ++ find_field = find_field_uni; ++ } ++ ++ ++ + skip_chars = 0; + skip_fields = 0; + check_chars = SIZE_MAX; +diff -Naur coreutils-6.1.orig/tests/sort/Makefile.am coreutils-6.1/tests/sort/Makefile.am +--- coreutils-6.1.orig/tests/sort/Makefile.am 2006-08-19 15:33:34.000000000 +0000 ++++ coreutils-6.1/tests/sort/Makefile.am 2006-08-23 20:11:34.000000000 +0000 +@@ -64,14 +64,16 @@ + nul-tab.E + ##test-files-end + +-EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) +-noinst_SCRIPTS = $x-tests ++run_gen += mb1.O mb2.O ++ ++EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) mb1.I mb1.X mb2.I mb2.X ++noinst_SCRIPTS = $x-tests # $x-mb-tests + TESTS_ENVIRONMENT = \ + PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" + + editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,$(srcdir),g' + +-TESTS = $x-tests ++TESTS = $x-tests $x-mb-tests + + mk_script = $(srcdir)/../mk-script + $(srcdir)/$x-tests: $(mk_script) Test.pm Makefile.am +diff -Naur coreutils-6.1.orig/tests/sort/Makefile.in coreutils-6.1/tests/sort/Makefile.in +--- coreutils-6.1.orig/tests/sort/Makefile.in 2006-08-19 17:42:34.000000000 +0000 ++++ coreutils-6.1/tests/sort/Makefile.in 2006-08-23 20:13:13.000000000 +0000 +@@ -402,13 +402,15 @@ + incompat2.E incompat3.O incompat3.E incompat4.O incompat4.E nul-tab.O \ + nul-tab.E + +-EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) +-noinst_SCRIPTS = $x-tests ++run_gen += mb1.O mb2.O ++ ++EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) mb1.I mb1.X mb2.I mb2.X ++noinst_SCRIPTS = $x-tests # $x-mb-tests + TESTS_ENVIRONMENT = \ + PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" + + editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,$(srcdir),g' +-TESTS = $x-tests ++TESTS = $x-tests $x-mb-tests + mk_script = $(srcdir)/../mk-script + MAINTAINERCLEANFILES = $x-tests $(maint_gen) + CLEANFILES = $(run_gen) +diff -Naur coreutils-6.1.orig/tests/sort/mb1.I coreutils-6.1/tests/sort/mb1.I +--- coreutils-6.1.orig/tests/sort/mb1.I 1970-01-01 00:00:00.000000000 +0000 ++++ coreutils-6.1/tests/sort/mb1.I 2006-08-23 20:08:12.000000000 +0000 +@@ -0,0 +1,4 @@ ++Appleï¼ 10 ++Bananaï¼ 5 ++Citrusï¼ 20 ++Cherryï¼ 30 +diff -Naur coreutils-6.1.orig/tests/sort/mb1.X coreutils-6.1/tests/sort/mb1.X +--- coreutils-6.1.orig/tests/sort/mb1.X 1970-01-01 00:00:00.000000000 +0000 ++++ coreutils-6.1/tests/sort/mb1.X 2006-08-23 20:08:12.000000000 +0000 +@@ -0,0 +1,4 @@ ++Bananaï¼ 5 ++Appleï¼ 10 ++Citrusï¼ 20 ++Cherryï¼ 30 +diff -Naur coreutils-6.1.orig/tests/sort/mb2.I coreutils-6.1/tests/sort/mb2.I +--- coreutils-6.1.orig/tests/sort/mb2.I 1970-01-01 00:00:00.000000000 +0000 ++++ coreutils-6.1/tests/sort/mb2.I 2006-08-23 20:08:12.000000000 +0000 +@@ -0,0 +1,4 @@ ++Apple@AA10ï¼ ï¼ 20 ++Banana@AA5ï¼ ï¼ 30 ++Citrus@AA20ï¼ ï¼ 5 ++Cherry@AA30ï¼ ï¼ 10 +diff -Naur coreutils-6.1.orig/tests/sort/mb2.X coreutils-6.1/tests/sort/mb2.X +--- coreutils-6.1.orig/tests/sort/mb2.X 1970-01-01 00:00:00.000000000 +0000 ++++ coreutils-6.1/tests/sort/mb2.X 2006-08-23 20:08:12.000000000 +0000 +@@ -0,0 +1,4 @@ ++Citrus@AA20ï¼ ï¼ 5 ++Cherry@AA30ï¼ ï¼ 10 ++Apple@AA10ï¼ ï¼ 20 ++Banana@AA5ï¼ ï¼ 30 +diff -Naur coreutils-6.1.orig/tests/sort/sort-mb-tests coreutils-6.1/tests/sort/sort-mb-tests +--- coreutils-6.1.orig/tests/sort/sort-mb-tests 1970-01-01 00:00:00.000000000 +0000 ++++ coreutils-6.1/tests/sort/sort-mb-tests 2006-08-23 20:08:12.000000000 +0000 +@@ -0,0 +1,58 @@ ++#! /bin/sh ++case $# in ++ 0) xx='../../src/sort';; ++ *) xx="$1";; ++esac ++test "$VERBOSE" && echo=echo || echo=: ++$echo testing program: $xx ++errors=0 ++test "$srcdir" || srcdir=. ++test "$VERBOSE" && $xx --version 2> /dev/null ++ ++export LC_ALL=en_US.UTF-8 ++locale -k LC_CTYPE 2>&1 | grep -q charmap.*UTF-8 || exit 77 ++errors=0 ++ ++$xx -t ï¼  -k2 -n mb1.I > mb1.O ++code=$? ++if test $code != 0; then ++ $echo "Test mb1 failed: $xx return code $code differs from expected value 0" 1>&2 ++ errors=`expr $errors + 1` ++else ++ cmp mb1.O $srcdir/mb1.X > /dev/null 2>&1 ++ case $? in ++ 0) if test "$VERBOSE"; then $echo "passed mb1"; fi;; ++ 1) $echo "Test mb1 failed: files mb1.O and $srcdir/mb1.X differ" 1>&2 ++ (diff -c mb1.O $srcdir/mb1.X) 2> /dev/null ++ errors=`expr $errors + 1`;; ++ 2) $echo "Test mb1 may have failed." 1>&2 ++ $echo The command "cmp mb1.O $srcdir/mb1.X" failed. 1>&2 ++ errors=`expr $errors + 1`;; ++ esac ++fi ++ ++$xx -t ï¼  -k4 -n mb2.I > mb2.O ++code=$? ++if test $code != 0; then ++ $echo "Test mb2 failed: $xx return code $code differs from expected value 0" 1>&2 ++ errors=`expr $errors + 1` ++else ++ cmp mb2.O $srcdir/mb2.X > /dev/null 2>&1 ++ case $? in ++ 0) if test "$VERBOSE"; then $echo "passed mb2"; fi;; ++ 1) $echo "Test mb2 failed: files mb2.O and $srcdir/mb2.X differ" 1>&2 ++ (diff -c mb2.O $srcdir/mb2.X) 2> /dev/null ++ errors=`expr $errors + 1`;; ++ 2) $echo "Test mb2 may have failed." 1>&2 ++ $echo The command "cmp mb2.O $srcdir/mb2.X" failed. 1>&2 ++ errors=`expr $errors + 1`;; ++ esac ++fi ++ ++if test $errors = 0; then ++ $echo Passed all 113 tests. 1>&2 ++else ++ $echo Failed $errors tests. 1>&2 ++fi ++test $errors = 0 || errors=1 ++exit $errors diff --git a/packages/base/coreutils/coreutils_uname.patch b/packages/base/coreutils/coreutils_uname.patch index b2bdd18..43ce03f 100644 --- a/packages/base/coreutils/coreutils_uname.patch +++ b/packages/base/coreutils/coreutils_uname.patch @@ -1,5 +1,5 @@ ---- coreutils-5.2.0.orig/src/uname.c 2004-01-21 17:27:02.000000000 -0500 -+++ coreutils-5.2.0/src/uname.c 2004-03-02 00:25:26.508518048 -0500 +--- coreutils-5.92.orig/src/uname.c 2005-09-15 20:34:42.000000000 +0000 ++++ coreutils-5.92/src/uname.c 2005-10-23 10:14:06.000000000 +0000 @@ -29,6 +29,12 @@ # include #endif @@ -10,10 +10,10 @@ +int has_sse( void ); +#endif + - #if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H - # include /* needed for OpenBSD 3.0 */ - # include -@@ -249,6 +252,96 @@ + #if HAVE_SYS_SYSCTL_H + # if HAVE_SYS_PARAM_H + # include /* needed for OpenBSD 3.0 */ +@@ -256,6 +262,96 @@ if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor)) element = processor; } @@ -110,7 +110,7 @@ #endif #ifdef UNAME_PROCESSOR if (element == unknown) -@@ -265,7 +358,7 @@ +@@ -293,7 +389,7 @@ if (toprint & PRINT_HARDWARE_PLATFORM) { @@ -119,7 +119,7 @@ #if HAVE_SYSINFO && defined SI_PLATFORM { static char hardware_platform[257]; -@@ -273,6 +366,15 @@ +@@ -301,6 +397,15 @@ hardware_platform, sizeof hardware_platform)) element = hardware_platform; } @@ -135,7 +135,7 @@ #endif #ifdef UNAME_HARDWARE_PLATFORM if (element == unknown) -@@ -294,3 +396,29 @@ +@@ -323,3 +428,29 @@ exit (EXIT_SUCCESS); } diff --git a/packages/base/coreutils/no_uptime_kill_su.patch b/packages/base/coreutils/no_uptime_kill_su.patch new file mode 100644 index 0000000..fd26e17 --- /dev/null +++ b/packages/base/coreutils/no_uptime_kill_su.patch @@ -0,0 +1,259 @@ +--- coreutils-6.1.orig/AUTHORS 2006-08-09 07:42:31.000000000 +0000 ++++ coreutils-6.1/AUTHORS 2006-08-23 19:55:17.000000000 +0000 +@@ -35,7 +35,6 @@ + hostname: Jim Meyering + id: Arnold Robbins, David MacKenzie + join: Mike Haertel +-kill: Paul Eggert + link: Michael Stone + ln: Mike Parker, David MacKenzie + logname: FIXME: unknown +@@ -89,7 +88,6 @@ + unexpand: David MacKenzie + uniq: Richard Stallman, David MacKenzie + unlink: Michael Stone +-uptime: Joseph Arceneaux, David MacKenzie, Kaveh Ghazi + users: Joseph Arceneaux, David MacKenzie + vdir: Richard Stallman, David MacKenzie + wc: Paul Rubin, David MacKenzie +--- coreutils-6.1.orig/Makefile.in 2006-08-19 17:42:35.000000000 +0000 ++++ coreutils-6.1/Makefile.in 2006-08-23 19:55:54.000000000 +0000 +@@ -182,7 +182,7 @@ + $(top_srcdir)/m4/ullong_max.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unlink-busy.m4 $(top_srcdir)/m4/unlinkdir.m4 \ +- $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \ ++ $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \ + $(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utimecmp.m4 \ + $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes-null.m4 \ +--- coreutils-6.1.orig/README 2006-08-19 16:52:25.000000000 +0000 ++++ coreutils-6.1/README 2006-08-23 19:56:17.000000000 +0000 +@@ -9,11 +9,11 @@ + + [ base64 basename cat chgrp chmod chown chroot cksum comm cp csplit cut date + dd df dir dircolors dirname du echo env expand expr factor false fmt fold +- ginstall groups head hostid hostname id join kill link ln logname ls ++ ginstall groups head hostid hostname id join link ln logname ls + md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr + printenv printf ptx pwd readlink rm rmdir seq sha1sum sha224sum sha256sum + sha384sum sha512sum shred shuf sleep sort split stat stty su sum sync tac +- tail tee test touch tr true tsort tty uname unexpand uniq unlink uptime ++ tail tee test touch tr true tsort tty uname unexpand uniq unlink + users vdir wc who whoami yes + + See the file NEWS for a list of major changes in the current release. +--- coreutils-6.1.orig/configure 2006-08-19 17:42:37.000000000 +0000 ++++ coreutils-6.1/configure 2006-08-23 19:57:41.000000000 +0000 +@@ -58901,8 +58901,7 @@ + { echo "$as_me:$LINENO: result: $gnulib_cv_have_boot_time" >&5 + echo "${ECHO_T}$gnulib_cv_have_boot_time" >&6; } + if test $gnulib_cv_have_boot_time = yes; then +- OPTIONAL_BIN_PROGS="$OPTIONAL_BIN_PROGS uptime\$(EXEEXT)" +- MAN="$MAN uptime.1" ++echo "uptime is suppressed" + fi + + +--- coreutils-6.1.orig/man/Makefile.in 2006-08-19 17:42:30.000000000 +0000 ++++ coreutils-6.1/man/Makefile.in 2006-08-23 20:00:19.000000000 +0000 +@@ -177,7 +177,7 @@ + $(top_srcdir)/m4/ullong_max.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unlink-busy.m4 $(top_srcdir)/m4/unlinkdir.m4 \ +- $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \ ++ $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \ + $(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utimecmp.m4 \ + $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes-null.m4 \ +@@ -364,14 +364,14 @@ + base64.1 basename.1 cat.1 chgrp.1 chmod.1 chown.1 chroot.1 cksum.1 comm.1 \ + cp.1 csplit.1 cut.1 date.1 dd.1 df.1 dir.1 dircolors.1 dirname.1 du.1 \ + echo.1 env.1 expand.1 expr.1 factor.1 false.1 fmt.1 fold.1 groups.1 \ +- head.1 hostid.1 hostname.1 id.1 install.1 join.1 kill.1 \ ++ head.1 hostid.1 hostname.1 id.1 install.1 join.1 \ + link.1 ln.1 logname.1 \ + ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nice.1 nl.1 nohup.1 od.1 \ + paste.1 pathchk.1 pinky.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \ + rm.1 rmdir.1 seq.1 sha1sum.1 sha224sum.1 sha256sum.1 sha384sum.1 sha512sum.1 \ + shred.1 shuf.1 sleep.1 sort.1 split.1 stat.1 stty.1 \ +- su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \ +- tty.1 uname.1 unexpand.1 uniq.1 unlink.1 uptime.1 users.1 vdir.1 wc.1 \ ++ sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \ ++ tty.1 uname.1 unexpand.1 uniq.1 unlink.1 users.1 vdir.1 wc.1 \ + who.1 whoami.1 yes.1 + + man_aux = $(dist_man_MANS:.1=.x) +@@ -638,7 +638,6 @@ + id.1: $(common_dep) $(srcdir)/id.x ../src/id.c + install.1: $(common_dep) $(srcdir)/install.x ../src/install.c + join.1: $(common_dep) $(srcdir)/join.x ../src/join.c +-kill.1: $(common_dep) $(srcdir)/kill.x ../src/kill.c + link.1: $(common_dep) $(srcdir)/link.x ../src/link.c + ln.1: $(common_dep) $(srcdir)/ln.x ../src/ln.c + logname.1: $(common_dep) $(srcdir)/logname.x ../src/logname.c +@@ -676,7 +675,6 @@ + split.1: $(common_dep) $(srcdir)/split.x ../src/split.c + stat.1: $(common_dep) $(srcdir)/stat.x ../src/stat.c + stty.1: $(common_dep) $(srcdir)/stty.x ../src/stty.c +-su.1: $(common_dep) $(srcdir)/su.x ../src/su.c + sum.1: $(common_dep) $(srcdir)/sum.x ../src/sum.c + sync.1: $(common_dep) $(srcdir)/sync.x ../src/sync.c + tac.1: $(common_dep) $(srcdir)/tac.x ../src/tac.c +@@ -692,7 +690,6 @@ + unexpand.1: $(common_dep) $(srcdir)/unexpand.x ../src/unexpand.c + uniq.1: $(common_dep) $(srcdir)/uniq.x ../src/uniq.c + unlink.1: $(common_dep) $(srcdir)/unlink.x ../src/unlink.c +-uptime.1: $(common_dep) $(srcdir)/uptime.x ../src/uptime.c + users.1: $(common_dep) $(srcdir)/users.x ../src/users.c + vdir.1: $(common_dep) $(srcdir)/vdir.x ../src/ls.c + wc.1: $(common_dep) $(srcdir)/wc.x ../src/wc.c +@@ -724,7 +721,7 @@ + check-x-vs-1: + PATH=../src$(PATH_SEPARATOR)$$PATH; export PATH; \ + t=ls-files.$$$$; \ +- (cd $(srcdir) && ls -1 *.x) | sed 's/\.x$$//' | $(ASSORT) > $$t;\ ++ (cd $(srcdir) && ls -1 *.x) | grep -v -e 'kill.x' -e 'su.x' -e 'uptime.x' | sed 's/\.x$$//' | $(ASSORT) > $$t;\ + echo $(dist_man_MANS) | tr -s ' ' '\n' | sed 's/\.1$$//' \ + | $(ASSORT) | diff - $$t || { rm $$t; exit 1; }; \ + rm $$t +--- coreutils-6.1.orig/src/Makefile.in 2006-08-19 17:44:28.000000000 +0000 ++++ coreutils-6.1/src/Makefile.in 2006-08-23 20:04:42.000000000 +0000 +@@ -39,7 +39,7 @@ + host_triplet = @host@ + EXTRA_PROGRAMS = chroot$(EXEEXT) df$(EXEEXT) hostid$(EXEEXT) \ + nice$(EXEEXT) pinky$(EXEEXT) stty$(EXEEXT) su$(EXEEXT) \ +- uname$(EXEEXT) uptime$(EXEEXT) users$(EXEEXT) who$(EXEEXT) ++ uname$(EXEEXT) users$(EXEEXT) who$(EXEEXT) + bin_PROGRAMS = [$(EXEEXT) chgrp$(EXEEXT) chown$(EXEEXT) chmod$(EXEEXT) \ + cp$(EXEEXT) dd$(EXEEXT) dircolors$(EXEEXT) du$(EXEEXT) \ + ginstall$(EXEEXT) link$(EXEEXT) ln$(EXEEXT) dir$(EXEEXT) \ +@@ -57,7 +57,7 @@ + tsort$(EXEEXT) unexpand$(EXEEXT) uniq$(EXEEXT) wc$(EXEEXT) \ + basename$(EXEEXT) date$(EXEEXT) dirname$(EXEEXT) echo$(EXEEXT) \ + env$(EXEEXT) expr$(EXEEXT) factor$(EXEEXT) false$(EXEEXT) \ +- hostname$(EXEEXT) id$(EXEEXT) kill$(EXEEXT) logname$(EXEEXT) \ ++ hostname$(EXEEXT) id$(EXEEXT) logname$(EXEEXT) \ + pathchk$(EXEEXT) printenv$(EXEEXT) printf$(EXEEXT) \ + pwd$(EXEEXT) seq$(EXEEXT) sleep$(EXEEXT) tee$(EXEEXT) \ + test$(EXEEXT) true$(EXEEXT) tty$(EXEEXT) whoami$(EXEEXT) \ +@@ -185,7 +185,7 @@ + $(top_srcdir)/m4/ullong_max.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \ + $(top_srcdir)/m4/unlink-busy.m4 $(top_srcdir)/m4/unlinkdir.m4 \ +- $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \ ++ $(top_srcdir)/m4/unlocked-io.m4 \ + $(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \ + $(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utimecmp.m4 \ + $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes-null.m4 \ +@@ -374,11 +374,6 @@ + join_LDADD = $(LDADD) + join_DEPENDENCIES = ../lib/libcoreutils.a $(am__DEPENDENCIES_1) \ + ../lib/libcoreutils.a +-kill_SOURCES = kill.c +-kill_OBJECTS = kill.$(OBJEXT) +-kill_LDADD = $(LDADD) +-kill_DEPENDENCIES = ../lib/libcoreutils.a $(am__DEPENDENCIES_1) \ +- ../lib/libcoreutils.a + link_SOURCES = link.c + link_OBJECTS = link.$(OBJEXT) + link_LDADD = $(LDADD) +@@ -627,10 +622,6 @@ + unlink_LDADD = $(LDADD) + unlink_DEPENDENCIES = ../lib/libcoreutils.a $(am__DEPENDENCIES_1) \ + ../lib/libcoreutils.a +-uptime_SOURCES = uptime.c +-uptime_OBJECTS = uptime.$(OBJEXT) +-uptime_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ +- $(am__DEPENDENCIES_1) + users_SOURCES = users.c + users_OBJECTS = users.$(OBJEXT) + users_LDADD = $(LDADD) +@@ -674,7 +665,7 @@ + csplit.c cut.c date.c dd.c df.c $(dir_SOURCES) dircolors.c \ + dirname.c du.c echo.c env.c expand.c expr.c factor.c false.c \ + fmt.c fold.c $(ginstall_SOURCES) head.c hostid.c hostname.c \ +- id.c join.c kill.c link.c ln.c logname.c $(ls_SOURCES) \ ++ id.c join.c link.c ln.c logname.c $(ls_SOURCES) \ + $(md5sum_SOURCES) mkdir.c mkfifo.c mknod.c $(mv_SOURCES) \ + nice.c nl.c nohup.c od.c paste.c pathchk.c pinky.c pr.c \ + printenv.c printf.c ptx.c pwd.c readlink.c $(rm_SOURCES) \ +@@ -683,14 +674,14 @@ + $(sha512sum_SOURCES) shred.c shuf.c sleep.c sort.c split.c \ + stat.c stty.c su.c sum.c sync.c tac.c tail.c tee.c test.c \ + touch.c tr.c true.c tsort.c tty.c uname.c unexpand.c uniq.c \ +- unlink.c uptime.c users.c $(vdir_SOURCES) wc.c who.c whoami.c \ ++ unlink.c users.c $(vdir_SOURCES) wc.c who.c whoami.c \ + yes.c + DIST_SOURCES = $(__SOURCES) base64.c basename.c cat.c $(chgrp_SOURCES) \ + chmod.c $(chown_SOURCES) chroot.c cksum.c comm.c $(cp_SOURCES) \ + csplit.c cut.c date.c dd.c df.c $(dir_SOURCES) dircolors.c \ + dirname.c du.c echo.c env.c expand.c expr.c factor.c false.c \ + fmt.c fold.c $(ginstall_SOURCES) head.c hostid.c hostname.c \ +- id.c join.c kill.c link.c ln.c logname.c $(ls_SOURCES) \ ++ id.c join.c link.c ln.c logname.c $(ls_SOURCES) \ + $(md5sum_SOURCES) mkdir.c mkfifo.c mknod.c $(mv_SOURCES) \ + nice.c nl.c nohup.c od.c paste.c pathchk.c pinky.c pr.c \ + printenv.c printf.c ptx.c pwd.c readlink.c $(rm_SOURCES) \ +@@ -699,7 +690,7 @@ + $(sha512sum_SOURCES) shred.c shuf.c sleep.c sort.c split.c \ + stat.c stty.c su.c sum.c sync.c tac.c tail.c tee.c test.c \ + touch.c tr.c true.c tsort.c tty.c uname.c unexpand.c uniq.c \ +- unlink.c uptime.c users.c $(vdir_SOURCES) wc.c who.c whoami.c \ ++ unlink.c users.c $(vdir_SOURCES) wc.c who.c whoami.c \ + yes.c + HEADERS = $(noinst_HEADERS) + ETAGS = etags +@@ -932,7 +923,6 @@ + tail_LDADD = $(nanosec_libs) + + # If necessary, add -lm to resolve use of pow in lib/strtod.c. +-uptime_LDADD = $(LDADD) $(POW_LIB) $(GETLOADAVG_LIBS) + su_LDADD = $(LDADD) $(LIB_CRYPT) + SUFFIXES = .sh + installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'` +@@ -1181,9 +1171,6 @@ + join$(EXEEXT): $(join_OBJECTS) $(join_DEPENDENCIES) + @rm -f join$(EXEEXT) + $(LINK) $(join_LDFLAGS) $(join_OBJECTS) $(join_LDADD) $(LIBS) +-kill$(EXEEXT): $(kill_OBJECTS) $(kill_DEPENDENCIES) +- @rm -f kill$(EXEEXT) +- $(LINK) $(kill_LDFLAGS) $(kill_OBJECTS) $(kill_LDADD) $(LIBS) + link$(EXEEXT): $(link_OBJECTS) $(link_DEPENDENCIES) + @rm -f link$(EXEEXT) + $(LINK) $(link_LDFLAGS) $(link_OBJECTS) $(link_LDADD) $(LIBS) +@@ -1346,9 +1333,6 @@ + unlink$(EXEEXT): $(unlink_OBJECTS) $(unlink_DEPENDENCIES) + @rm -f unlink$(EXEEXT) + $(LINK) $(unlink_LDFLAGS) $(unlink_OBJECTS) $(unlink_LDADD) $(LIBS) +-uptime$(EXEEXT): $(uptime_OBJECTS) $(uptime_DEPENDENCIES) +- @rm -f uptime$(EXEEXT) +- $(LINK) $(uptime_LDFLAGS) $(uptime_OBJECTS) $(uptime_LDADD) $(LIBS) + users$(EXEEXT): $(users_OBJECTS) $(users_DEPENDENCIES) + @rm -f users$(EXEEXT) + $(LINK) $(users_LDFLAGS) $(users_OBJECTS) $(users_LDADD) $(LIBS) +@@ -1443,7 +1427,6 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/id.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/install.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/join.Po@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kill.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lbracket.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/link.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ln.Po@am__quote@ +@@ -1503,7 +1486,6 @@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unexpand.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uniq.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unlink.Po@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uptime.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/users.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wc.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/who.Po@am__quote@ +@@ -1815,7 +1797,7 @@ + && can_create_suid_root_executable=yes; \ + rm -f $$TMPFILE; \ + if test $$can_create_suid_root_executable = yes; then \ +- $(INSTALL_SU); \ ++ echo "Installation of su is suppressed"; \ + else \ + echo "WARNING: insufficient access; not installing su"; \ + echo "NOTE: to install su, run 'make install-root' as root"; \ diff --git a/packages/base/diffutils/diffutils b/packages/base/diffutils/diffutils index c8a67b9..a27dedd 100644 --- a/packages/base/diffutils/diffutils +++ b/packages/base/diffutils/diffutils @@ -3,5 +3,5 @@ # author: hackbard@hackdaworld.dyndns.org # # [V] 2.8.1 -# [S] 1-4 2-12 +# [S] 1-2 2-12 # [D] diffutils-2.8.1.tar.gz ftp://ftp.gnu.org/pub/gnu/diffutils/ diff --git a/packages/base/findutils/findutils b/packages/base/findutils/findutils index c059429..1810f93 100644 --- a/packages/base/findutils/findutils +++ b/packages/base/findutils/findutils @@ -2,11 +2,11 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 4.2.23 -# [S] 1-4 2-7 -# [D] findutils-4.2.23.tar.gz ftp://ftp.gnu.org/pub/gnu/findutils/ +# [V] 4.2.28 +# [S] 1-2 2-7 +# [D] findutils-4.2.28.tar.gz ftp://ftp.gnu.org/pub/gnu/findutils/ -if [ "$hdw_status" = "2" ] ; then +if [ "$stage" = "2" ] ; then confopt=${confopt//--local* /--localstatedir=$root/var/lib/locate } confopt="$confopt --libexecdir=$prefix/lib/locate" mkdir -p $root/{usr,var}/lib/locate diff --git a/packages/base/flex/flex b/packages/base/flex/flex index a58fe84..907012a 100644 --- a/packages/base/flex/flex +++ b/packages/base/flex/flex @@ -2,15 +2,11 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 2.5.31 -# [S] 1-8 2-9 -# [D] flex-2.5.31.tar.bz2 http://surfnet.dl.sourceforge.net/sourceforge/lex/ +# [V] 2.5.33 +# [S] 1-3 2-9 +# [D] flex-2.5.33.tar.bz2 http://surfnet.dl.sourceforge.net/sourceforge/flex/ -pre_install() { - touch doc/flex.1 - } - -if [ "$hdw_status" = "2" ] ; then +if [ "$stage" = "2" ] ; then post_install() { ln -sfv libfl.a $prefix/lib/libl.a } diff --git a/packages/base/gawk/gawk b/packages/base/gawk/gawk index 3d2cf5b..bd16b9c 100644 --- a/packages/base/gawk/gawk +++ b/packages/base/gawk/gawk @@ -2,8 +2,15 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 3.1.4 -# [S] 1-1 2-7 -# [D] gawk-3.1.4.tar.bz2 ftp://ftp.gnu.org/pub/gnu/gawk/ +# [V] 3.1.5 +# [S] 1-2 2-7 +# [D] gawk-3.1.5.tar.bz2 ftp://ftp.gnu.org/pub/gnu/gawk/ -[ "$hdw_status" = "2" ] && confopt="$confopt --libexecdir=$root/usr/lib" +[ "$stage" = "2" ] && confopt="$confopt --libexecdir=$root/usr/lib" + +pre_install() { + cat >> config.h << "EOF" +#define HAVE_LANGINFO_CODESET 1 +#define HAVE_LC_MESSAGES 1 +EOF + } diff --git a/packages/base/gawk/gawk.patch b/packages/base/gawk/gawk.patch new file mode 100644 index 0000000..6cfd8c6 --- /dev/null +++ b/packages/base/gawk/gawk.patch @@ -0,0 +1,35 @@ +--- gawk-3.1.5.orig/io.c 2005-07-26 18:07:43.000000000 +0000 ++++ gawk-3.1.5/io.c 2005-09-24 14:43:13.771380264 +0000 +@@ -2480,9 +2480,12 @@ + { + struct stat sbuf; + struct open_hook *oh; ++ int iop_malloced = FALSE; + +- if (iop == NULL) ++ if (iop == NULL) { + emalloc(iop, IOBUF *, sizeof(IOBUF), "iop_alloc"); ++ iop_malloced = TRUE; ++ } + memset(iop, '\0', sizeof(IOBUF)); + iop->flag = 0; + iop->fd = fd; +@@ -2495,7 +2498,8 @@ + } + + if (iop->fd == INVALID_HANDLE) { +- free(iop); ++ if (iop_malloced) ++ free(iop); + return NULL; + } + if (isatty(iop->fd)) +@@ -2503,7 +2507,7 @@ + iop->readsize = iop->size = optimal_bufsize(iop->fd, & sbuf); + iop->sbuf = sbuf; + if (do_lint && S_ISREG(sbuf.st_mode) && sbuf.st_size == 0) +- lintwarn(_("data file `%s' is empty"), name); ++ lintwarn(_("data file `%s' is empty"), name); + errno = 0; + iop->count = iop->scanoff = 0; + emalloc(iop->buf, char *, iop->size += 2, "iop_alloc"); diff --git a/packages/base/gettext/gettext b/packages/base/gettext/gettext index a9b283d..65933e0 100644 --- a/packages/base/gettext/gettext +++ b/packages/base/gettext/gettext @@ -2,6 +2,6 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 0.14.5 +# [V] 0.15 # [S] 2-10 -# [D] gettext-0.14.5.tar.gz ftp://ftp.gnu.org/pub/gnu/gettext/ +# [D] gettext-0.15.tar.gz ftp://ftp.gnu.org/pub/gnu/gettext/ diff --git a/packages/base/grep/grep b/packages/base/grep/grep index b2ff7d5..e769672 100644 --- a/packages/base/grep/grep +++ b/packages/base/grep/grep @@ -3,9 +3,9 @@ # author: hackbard@hackdaworld.dyndns.org # # [V] 2.5.1 -# [S] 1-5 2-13 +# [S] 1-2 2-13 # [D] grep-2.5.1.tar.bz2 ftp://ftp.gnu.org/pub/gnu/grep/ confopt="$confopt --with-included-regex" -[ "$hdw_status" = "1" ] && confopt="$confopt --disable-perl-regexp" -[ "$hdw_status" = "2" ] && confopt=${confopt//--bindir* /--bindir=$root/bin } +[ "$stage" = "1" ] && confopt="$confopt --disable-perl-regexp" +[ "$stage" = "2" ] && confopt=${confopt//--bindir* /--bindir=$root/bin } diff --git a/packages/base/gzip/gzip b/packages/base/gzip/gzip index 2d83668..9a078ea 100644 --- a/packages/base/gzip/gzip +++ b/packages/base/gzip/gzip @@ -3,10 +3,10 @@ # author: hackbard@hackdaworld.dyndns.org # # [V] 1.3.5 -# [S] 1-3 2-13 +# [S] 1-2 2-13 # [D] gzip-1.3.5.tar.gz ftp://alpha.gnu.org/gnu/gzip/ -if [ "$hdw_status" = "2" ] ; then +if [ "$stage" = "2" ] ; then build_main() { ./configure $confopt diff --git a/packages/base/linux/linux b/packages/base/linux/linux index c07b6f2..5983615 100644 --- a/packages/base/linux/linux +++ b/packages/base/linux/linux @@ -2,9 +2,9 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 2.6.18 +# [V] 2.6.18.1 # [S] 2-2 -# [D] linux-2.6.18.tar.bz2 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/ +# [D] linux-2.6.18.1.tar.bz2 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/ custmain="1" custmain() { diff --git a/packages/base/m4/m4 b/packages/base/m4/m4 index a5552f5..4678df2 100644 --- a/packages/base/m4/m4 +++ b/packages/base/m4/m4 @@ -2,6 +2,6 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 1.4.3 -# [S] 1-7 2-8 -# [D] m4-1.4.3.tar.gz ftp://ftp.gnu.org/pub/gnu/m4/ +# [V] 1.4.7 +# [S] 1-2 2-8 +# [D] m4-1.4.7.tar.gz ftp://ftp.gnu.org/pub/gnu/m4/ diff --git a/packages/base/make/make b/packages/base/make/make index c5c362a..b81df00 100644 --- a/packages/base/make/make +++ b/packages/base/make/make @@ -2,6 +2,6 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 3.80 -# [S] 1-4 2-14 -# [D] make-3.80.tar.bz2 ftp://ftp.gnu.org/pub/gnu/make/ +# [V] 3.81 +# [S] 1-2 2-14 +# [D] make-3.81.tar.bz2 ftp://ftp.gnu.org/pub/gnu/make/ diff --git a/packages/base/ncurses/ncurses b/packages/base/ncurses/ncurses index 17de59d..b338aa0 100644 --- a/packages/base/ncurses/ncurses +++ b/packages/base/ncurses/ncurses @@ -2,17 +2,10 @@ # # author: hackbard@hackdaworld.dndns.org # -# [V] 5.4 -# [S] 1-6 2-7 -# [D] ncurses-5.4.tar.gz ftp://ftp.gnu.org/pub/gnu/ncurses/ +# [V] 5.5 +# [S] 1-1 2-7 +# [D] ncurses-5.5.tar.gz ftp://ftp.gnu.org/pub/gnu/ncurses/ confopt="$confopt --with-shared --without-debug" -[ "$hdw_status" = "1" ] && confopt="$confopt --without-ada --enable-overwrite" +[ "$stage" = "1" ] && confopt="$confopt --without-ada --enable-overwrite" -post_install() { - cd $prefix/lib && - chmod 755 *.${ver} - chmod 644 libncurses++.a - ln -sf libncurses.a libcurses.a - ln -sf libncurses.so libcurses.so - } diff --git a/packages/base/patch/patch b/packages/base/patch/patch index bb675f9..da49eff 100644 --- a/packages/base/patch/patch +++ b/packages/base/patch/patch @@ -3,10 +3,9 @@ # author: hackbard@hackdaworld.dyndns.org # # [V] 2.5.4 -# [S] 1-6 2-15 +# [S] 1-2 2-15 # [D] patch-2.5.4.tar.gz ftp://ftp.gnu.org/pub/gnu/patch/ - pre_install() { export CPPFLAGS=-D_GNU_SOURCE } diff --git a/packages/base/perl/perl b/packages/base/perl/perl index 9757ca2..d7bd4c8 100644 --- a/packages/base/perl/perl +++ b/packages/base/perl/perl @@ -1,21 +1,21 @@ # hdw - linux perl package # -# author: hackbard@hackdaworld.dyndns.org +# author: hackbard@hackdaworld.org # -# [V] 5.8.7 -# [S] 1-9 2-10 -# [D] perl-5.8.7.tar.gz ftp://ftp.cpan.org/pub/CPAN/src/ +# [V] 5.8.8 +# [S] 1-2 2-10 +# [D] perl-5.8.8.tar.gz ftp://ftp.cpan.org/pub/CPAN/src/ e_ver=`echo $ver | awk -F. '{ print $1 }'` -confopt="--prefix=$prefix -Dstatic_ext='IO Fcntl POSIX'" +confopt="--prefix=$prefix -Dstatic_ext='Data/Dumper Fcntl IO POSIX'" -if [ "$hdw_status" = "1" ] ; then +if [ "$stage" = "1" ] ; then build_main() { ./configure.gnu $confopt make perl utilities - cp perl pod/pod2man $prefix/bin - mkdir -p $prefix/lib/perl${e_ver}/$ver - cp -R lib/* $prefix/lib/perl${e_ver}/$ver + cp -v perl pod/pod2man $prefix/bin + mkdir -pv $prefix/lib/perl${e_ver}/$ver + cp -Rv lib/* $prefix/lib/perl${e_ver}/$ver } else build_main() { diff --git a/packages/base/perl/perl_libc.patch.1 b/packages/base/perl/perl_libc.patch.1 index 085e2b7..62b1a36 100644 --- a/packages/base/perl/perl_libc.patch.1 +++ b/packages/base/perl/perl_libc.patch.1 @@ -1,7 +1,7 @@ ---- perl-5.8.0.orig/hints/linux.sh 2002-06-05 23:46:00.000000000 +1000 -+++ perl-5.8.0/hints/linux.sh 2003-02-19 16:32:18.000000000 +1100 -@@ -51,9 +51,9 @@ - # We don't use __GLIBC__ and __GLIBC_MINOR__ because they +--- perl-5.8.8.orig/hints/linux.sh 2005-11-18 01:18:45.000000000 +0000 ++++ perl-5.8.8/hints/linux.sh 2006-02-12 12:20:32.000000000 +0000 +@@ -52,9 +52,9 @@ + # We don't use __GLIBC__ and __GLIBC_MINOR__ because they # are insufficiently precise to distinguish things like # libc-2.0.6 and libc-2.0.7. -if test -L /lib/libc.so.6; then @@ -13,10 +13,12 @@ fi # Configure may fail to find lstat() since it's a static/inline -@@ -282,3 +282,6 @@ - ;; +@@ -330,3 +330,8 @@ + libswanted="$*" + ;; esac - EOCBU ++ +locincpth="" +loclibpth="" +glibpth="${prefix}/lib" ++usrinc="${prefix}/include" diff --git a/packages/base/sed/sed b/packages/base/sed/sed index 0436236..4c96d82 100644 --- a/packages/base/sed/sed +++ b/packages/base/sed/sed @@ -1,9 +1,9 @@ # hdw - linux sed package # -# author: hackbard@hackdaworld.dyndns.org +# author: hackbard@hackdaworld.org # -# [V] 4.1.4 -# [S] 1-5 2-9 -# [D] sed-4.1.4.tar.gz ftp://ftp.gnu.org/pub/gnu/sed/ +# [V] 4.1.5 +# [S] 1-2 2-9 +# [D] sed-4.1.5.tar.gz ftp://ftp.gnu.org/pub/gnu/sed/ -[ "$hdw_status" = "2" ] && confopt=${confopt//--bindir* /--bindir=$root/bin } +[ "$stage" = "2" ] && confopt=${confopt//--bindir* /--bindir=$root/bin } diff --git a/packages/base/tar/tar b/packages/base/tar/tar index 4d84e29..5b098f9 100644 --- a/packages/base/tar/tar +++ b/packages/base/tar/tar @@ -3,5 +3,5 @@ # author: hackbard@hackdaworld.dyndns.org # # [V] 1.15.1 -# [S] 1-6 2-15 +# [S] 1-2 2-15 # [D] tar-1.15.1.tar.bz2 ftp://ftp.gnu.org/pub/gnu/tar/ diff --git a/packages/base/texinfo/texinfo b/packages/base/texinfo/texinfo index a2ac91e..073a1d2 100644 --- a/packages/base/texinfo/texinfo +++ b/packages/base/texinfo/texinfo @@ -1,12 +1,12 @@ # hdw - linux texinfo package # -# author: hackbard@hackdaworld.dyndns.org +# author: hackbard@hackdaworld.org # -# [V] 4.8 -# [S] 1-6 2-10 -# [D] texinfo-4.8.tar.bz2 ftp://ftp.gnu.org/pub/gnu/texinfo/ +# [V] 4.8a +# [S] 1-2 2-10 +# [D] texinfo-4.8a.tar.bz2 ftp://ftp.gnu.org/pub/gnu/texinfo/ -if [ "$hdw_status" = "2" ] ; then +if [ "$stage" = "2" ] ; then post_install() { # TEXMF specifies root of textree (hopefully not an install loc) make TEXMF=/usr/share/texmf install-tex diff --git a/packages/base/udev/udev b/packages/base/udev/udev index ea34f43..b715ebc 100644 --- a/packages/base/udev/udev +++ b/packages/base/udev/udev @@ -2,43 +2,39 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 081 -# [S] 1-9 2-15 -# [D] udev-081.tar.bz2 http://www.kernel.org/pub/linux/utils/kernel/hotplug/ +# [V] 102 +# [S] 1-3 2-15 +# [D] udev-102.tar.bz2 http://www.kernel.org/pub/linux/utils/kernel/hotplug/ -#extras="extras/cdrom_id extras/scsi_id extras/volume_id extras/usb_id" -#extras="$extras extras/ata_id extras/dasd_id extras/run_directory" -extras=extras/run_directory +extras="" +for i in ata_id cdrom_id dasd_id edd_id firmware floppy path_id \ + rule_generator run_directory scsi_id usb_id volume_id; do + extras="extras/$i $extras" +done -make_conf="udevdir=/dev EXTRAS=$extras $make_conf" -install_conf="udevdir=/dev EXTRAS=$extras" +make_conf="udevdir=/dev EXTRAS=\"$extras\" $make_conf" +install_conf="udevdir=/dev EXTRAS=\"$extras\"" u_root=$root -[ "$hdw_status" = "1" ] && u_root=/${tc_name} +[ "$stage" = "1" ] && u_root=/${tc_name} -if [ "$hdw_status" = "1" ] ; then +if [ "$stage" = "1" ] ; then make_conf="prefix=$prefix etcdir=$prefix/etc $make_conf" install_conf="DESTDIR=$prefix $install_conf" fi post_install() { - # subsys folder for locking - mkdir -p $root/var/lock/subsys # documentation rm -rf $docdir ; mkdir -p $docdir - cp -r docs FAQ README* TODO ChangeLog RELEASE-NOTES $docdir + cp -rv docs FAQ README* TODO ChangeLog RELEASE-NOTES $docdir # config stuff mkdir -p $u_root/etc/udev/rules.d cp -v $confdir/udev.rules* $u_root/etc/udev/rules.d/ - mkdir -p $u_root/etc/udev/scripts - cp -v ./extras/{path_id,*.sh} $u_root/etc/udev/scripts/ # init script - if [ "$hdw_status" = "2" ] ; then + if [ "$stage" = "2" ] ; then cp $confdir/init_udev.sh $u_root/etc/init.d/udev chmod 750 $u_root/etc/init.d/udev fi [ ! -f $u_root/etc/udev/udev.conf ] && \ cp -v $confdir/udev.conf $u_root/etc/udev/ - ln -sf $root/lib/udev/udev_run_devd $root/sbin/ - ln -sf $root/lib/udev/udev_run_hotplugd $root/sbin/ } diff --git a/packages/base/udev/udev.rules b/packages/base/udev/udev.rules index 3c34341..df890c0 100644 --- a/packages/base/udev/udev.rules +++ b/packages/base/udev/udev.rules @@ -1,5 +1,6 @@ # -# hdw-linux device naming rules for udev +# hdw-linux udev rules +# # # console @@ -8,14 +9,14 @@ KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", OPTI KERNEL=="vcs*", NAME="%k", GROUP="tty", OPTIONS="last_rule" KERNEL=="vcsa*", NAME="%k", GROUP="tty", OPTIONS="last_rule" KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="tty[0-9]", NAME="vc/%n", GROUP="tty", OPTIONS="last_rule" -KERNEL=="tty[0-9][0-9]", NAME="vc/%n", GROUP="tty", OPTIONS="last_rule" +KERNEL=="tty[0-9]", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="tty[0-9][0-9]", NAME="%k", GROUP="tty", OPTIONS="last_rule" KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" # tty devices -KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="%k", GROUP="users" -KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" +KERNEL=="ttyS[0-9]*", NAME="%k", SYMLINK="tts/%n", GROUP="tty" +KERNEL=="ttyUSB[0-9]*", NAME="%k", SYMLINK="tts/USB%n", GROUP="tty", MODE="0660" KERNEL=="ippp0", NAME="%k", GROUP="tty" KERNEL=="isdn*" NAME="%k", GROUP="tty" KERNEL=="dcbri*", NAME="%k", GROUP="tty" @@ -25,13 +26,14 @@ KERNEL=="ircomm*", NAME="%k", GROUP="tty" SUBSYSTEM=="block", GROUP="disk" # cdrom symlinks and other good cdrom naming -BUS=="ide", KERNEL=="hd[a-z]", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" -BUS=="scsi", KERNEL="sr[0-9]*", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" -BUS=="scsi", KERNEL="scd[a-z]", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" -ENV{ID_CDROM}=="?*", SYMLINK+="cdrom%e", GROUP="cdrom" -ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%e" -ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd%e" -ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="dvdrw%e" +BUS=="ide", KERNEL=="hd[a-z]", ACTION=="add", IMPORT="cdrom_id --export $tempnode" +BUS=="scsi", KERNEL=="sr[0-9]*", ACTION=="add", IMPORT="cdrom_id --export $tempnode" +BUS=="scsi", KERNEL=="scd[a-z]", ACTION=="add", IMPORT="cdrom_id --export $tempnode" +BUS=="scsi", KERNEL=="sg[0-9]*", ACTION=="add", DRIVERS=="sr", GROUP="cdrom" +ENV{ID_CDROM}=="?*", PROGRAM="seq_node.sh %r %k cdrom", SYMLINK+="%c", GROUP="cdrom" +ENV{ID_CDROM_CD_RW}=="?*", PROGRAM="seq_node.sh %r %k cdrw", SYMLINK+="%c" +ENV{ID_CDROM_DVD}=="?*", PROGRAM="seq_node.sh %r %k dvd", SYMLINK+="%c" +ENV{ID_CDROM_DVD_R}=="?*", PROGRAM="seq_node.sh %r %k dvdrw", SYMLINK+="%c" # disk devices KERNEL=="sd*", NAME="%k", GROUP="disk" @@ -39,11 +41,11 @@ KERNEL=="dasd*", NAME="%k", GROUP="disk" KERNEL=="ataraid*", NAME="%k", GROUP="disk" # compaq smart array -KERNEL=="cciss*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" -KERNEL=="ida*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" +KERNEL=="cciss*", NAME="%k" +KERNEL=="ida*", NAME="%k" # mylex -KERNEL=="rd*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" +KERNEL=="rd*", NAME="%k" # dri devices KERNEL=="card*", NAME="dri/card%n", GROUP="video" @@ -51,7 +53,7 @@ KERNEL=="nvidia*", NAME="%k", GROUP="video" KERNEL=="3dfx*", NAME="%k", GROUP="video" # alsa devices -SUBSYSTEM=="sound", GROUP="users" +SUBSYSTEM=="sound", GROUP="audio" KERNEL=="controlC[0-9]*", NAME="snd/%k" KERNEL=="hw[CD0-9]*", NAME="snd/%k" KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" @@ -72,7 +74,7 @@ KERNEL=="microcode", NAME="cpu/microcode" KERNEL=="dm-[0-9]*", OPTIONS="ignore_device" # create a symlink named after the device map name # note devmap_name comes with extras/multipath -#KERNEL=="dm-[0-9]*", PaudioROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" +#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" KERNEL=="device-mapper", NAME="mapper/control" # fb devices @@ -124,7 +126,7 @@ KERNEL=="dnrtmsg", NAME="netlink/%k" KERNEL=="tap*", NAME="netlink/%k" # network devices -KERNEL=="tun", NAME="net/%k" +KERNEL=="tun", NAME="net/%k", MODE="0600" # ramdisk devices KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" @@ -139,16 +141,16 @@ KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="ram*", NAME="%k", GROUP="disk" # sound devices -KERNEL=="adsp", NAME="sound/%k", SYMLINK+="%k", GROUP="users" -KERNEL=="adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="users" -KERNEL=="audio", NAME="sound/%k", SYMLINK+="%k", GROUP="users" -KERNEL=="audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="users" -KERNEL=="dsp", NAME="sound/%k", SYMLINK+="%k", GROUP="users" -KERNEL=="dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="users" -KERNEL=="mixer", NAME="sound/%k", SYMLINK+="%k", GROUP="users" -KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="users" -KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="users" -KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="users" +KERNEL=="adsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="audio", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="dsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="mixer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" # memory devices KERNEL=="random", NAME="%k", MODE="0666" @@ -169,12 +171,12 @@ BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" # v4l devices KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" -KERNEL=="radio[0-9]*", NAME="v4l/radio%n", GROUP="video" +KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" # dvb devices -KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video", MODE="0660" +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" # Asterisk Zaptel devices KERNEL=="zapctl", NAME="zap/ctl" @@ -201,6 +203,7 @@ KERNEL=="lp*", NAME="%k", GROUP="lp" KERNEL=="irlpt", NAME="%k", GROUP="lp" KERNEL=="usblp", NAME="%k", GROUP="lp" KERNEL=="lp*", NAME="%k", GROUP="lp" +KERNEL=="parport*", NAME="%k", GROUP="lp" # tape devices KERNEL=="ht*", NAME="%k", GROUP="tape" @@ -232,67 +235,42 @@ KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrw", MODE="0660" KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" -# tpm devices -KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" - -####################################### -# Persistant block device stuff - begin -####################################### - -# Skip all of this if we are not adding a block device -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" - -# skip accessing removable ide devices, cause the ide drivers are horrible broken -BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id" -BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id" - -# persistent disk device links /dev/disk/ -KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# Skip id for ram / loop / fd -KERNEL=="ram*", GOTO="no_volume_id" -KERNEL=="loop*", GOTO="no_volume_id" -KERNEL=="fd*", GOTO="no_volume_id" - -KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# volume-label/uuid -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" -KERNEL=="sr*", GOTO="no_volume_id" -KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" -KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -LABEL="no_volume_id" - -LABEL="persistent_end" - -##################################### -# Persistant block device stuff - end -##################################### # usbfs-like device nodes -SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" + + +# Module autoloading + +# Autoload modules that lack aliases but have them defined inutoload modules +SYSFS{modalias}=="?*", ACTION=="add", RUN+="/sbin/modprobe $env{MODALIAS}" + +# /etc/modprobe.conf. +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" +# If you have problems with some pnp modules being loaded, please enter the +# following aliases into the modprobe configuration files. These are needed by +# udev to autoload some modules +# alias pnp:dPNP0510 irtty-sir +# alias pnp:dPNP0511 irtty-sir +# alias pnp:dPNP0700 floppy +# alias pnp:dPNP0800 pcspkr +# alias pnp:dPNP0b00 rtc +# alias pnp:dPNP0303 atkbd +# alias pnp:dPNP0f13 psmouse +# alias pnp:dPNPb02f analog + + + +# Load firmware +SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems # run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart -ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" +ENV{UDEVD_EVENT}=="1", RUN+="udev_run_hotplugd $env{SUBSYSTEM}" # always run /etc/dev.d/ stuff for now. -RUN+="/sbin/udev_run_devd" +RUN+="udev_run_devd $env{SUBSYSTEM}" # debugging monitor RUN+="socket:/org/kernel/udev/monitor" diff --git a/packages/base/util-linux/cramfs.patch b/packages/base/util-linux/cramfs.patch index 05615bb..6c2ed80 100644 --- a/packages/base/util-linux/cramfs.patch +++ b/packages/base/util-linux/cramfs.patch @@ -1,4 +1,3 @@ -diff -Naur util-linux-2.12p/disk-utils/fsck.cramfs.c util-linux-2.12p-new/disk-utils/fsck.cramfs.c --- util-linux-2.12p/disk-utils/fsck.cramfs.c 2004-12-11 14:53:16.000000000 +0000 +++ util-linux-2.12p-new/disk-utils/fsck.cramfs.c 2004-12-26 00:53:10.665199086 +0000 @@ -76,16 +76,7 @@ @@ -52,7 +51,6 @@ diff -Naur util-linux-2.12p/disk-utils/fsck.cramfs.c util-linux-2.12p-new/disk-u /* command line options */ while ((c = getopt(argc, argv, "hx:v")) != EOF) { switch (c) { -diff -Naur util-linux-2.12p/disk-utils/mkfs.cramfs.c util-linux-2.12p-new/disk-utils/mkfs.cramfs.c --- util-linux-2.12p/disk-utils/mkfs.cramfs.c 2004-12-11 14:56:01.000000000 +0000 +++ util-linux-2.12p-new/disk-utils/mkfs.cramfs.c 2004-12-26 00:53:10.666198928 +0000 @@ -46,16 +46,8 @@ diff --git a/packages/base/util-linux/lseek.patch b/packages/base/util-linux/lseek.patch new file mode 100644 index 0000000..0fa3ad6 --- /dev/null +++ b/packages/base/util-linux/lseek.patch @@ -0,0 +1,255 @@ +--- util-linux-2.12r.orig/fdisk/Makefile 2004-09-06 20:28:58.000000000 +0000 ++++ util-linux-2.12r/fdisk/Makefile 2006-07-08 15:40:57.140375072 +0000 +@@ -39,7 +39,7 @@ else + endif + endif + +-cfdisk: cfdisk.o llseek.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o ++cfdisk: cfdisk.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o + ifeq "$(HAVE_SLANG)" "yes" + $(CC) $(LDFLAGS) $^ -o $@ $(LIBSLANG) + else +@@ -55,7 +55,7 @@ activate: sfdisk + rm -f activate + ln -s sfdisk activate + +-fdisk: fdisk.o llseek.o disksize.o fdiskbsdlabel.o fdisksgilabel.o \ ++fdisk: fdisk.o disksize.o fdiskbsdlabel.o fdisksgilabel.o \ + fdisksunlabel.o fdiskaixlabel.o i386_sys_types.o partname.o + fdisk.o: fdisk.c fdisk.h + fdiskbsdlabel.o: fdiskbsdlabel.c fdisk.h fdiskbsdlabel.h +--- util-linux-2.12r.orig/fdisk/cfdisk.c 2005-09-09 21:44:57.000000000 +0000 ++++ util-linux-2.12r/fdisk/cfdisk.c 2006-07-08 15:40:23.458901045 +0000 +@@ -84,9 +84,6 @@ + #include "xstrncpy.h" + #include "common.h" + +-extern long long ext2_llseek(unsigned int fd, long long offset, +- unsigned int origin); +- + #define VERSION UTIL_LINUX_VERSION + + #define DEFAULT_DEVICE "/dev/hda" +@@ -552,7 +549,7 @@ die_x(int ret) { + + static void + read_sector(char *buffer, long long sect_num) { +- if (ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0) ++ if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0) + fatal(_("Cannot seek on disk drive"), 2); + if (read(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE) + fatal(_("Cannot read disk drive"), 2); +@@ -560,7 +557,7 @@ read_sector(char *buffer, long long sect + + static void + write_sector(char *buffer, long long sect_num) { +- if (ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0) ++ if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0) + fatal(_("Cannot seek on disk drive"), 2); + if (write(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE) + fatal(_("Cannot write disk drive"), 2); +@@ -587,7 +584,7 @@ get_dos_label(int i) { + long long offset; + + offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE; +- if (ext2_llseek(fd, offset, SEEK_SET) == offset ++ if (lseek(fd, offset, SEEK_SET) == offset + && read(fd, §or, sizeof(sector)) == sizeof(sector)) { + dos_copy_to_info(p_info[i].ostype, OSTYPESZ, + sector+DOS_OSTYPE_OFFSET, DOS_OSTYPE_SZ); +@@ -672,7 +669,7 @@ get_linux_label(int i) { + + offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE + + 1024; +- if (ext2_llseek(fd, offset, SEEK_SET) == offset ++ if (lseek(fd, offset, SEEK_SET) == offset + && read(fd, &e2fsb, sizeof(e2fsb)) == sizeof(e2fsb) + && e2fsb.s_magic[0] + (e2fsb.s_magic[1]<<8) == EXT2_SUPER_MAGIC) { + label = e2fsb.s_volume_name; +@@ -688,7 +685,7 @@ get_linux_label(int i) { + } + + offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE + 0; +- if (ext2_llseek(fd, offset, SEEK_SET) == offset ++ if (lseek(fd, offset, SEEK_SET) == offset + && read(fd, &xfsb, sizeof(xfsb)) == sizeof(xfsb) + && !strncmp(xfsb.s_magic, XFS_SUPER_MAGIC, 4)) { + label = xfsb.s_fname; +@@ -702,7 +699,7 @@ get_linux_label(int i) { + /* jfs? */ + offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE + + JFS_SUPER1_OFF; +- if (ext2_llseek(fd, offset, SEEK_SET) == offset ++ if (lseek(fd, offset, SEEK_SET) == offset + && read(fd, &jfsb, sizeof(jfsb)) == sizeof(jfsb) + && !strncmp(jfsb.s_magic, JFS_MAGIC, strlen(JFS_MAGIC))) { + label = jfsb.s_label; +@@ -716,7 +713,7 @@ get_linux_label(int i) { + /* reiserfs? */ + offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE + + REISERFS_DISK_OFFSET_IN_BYTES; +- if (ext2_llseek(fd, offset, SEEK_SET) == offset ++ if (lseek(fd, offset, SEEK_SET) == offset + && read(fd, &reiserfsb, sizeof(reiserfsb)) == sizeof(reiserfsb) + && has_reiserfs_magic_string(&reiserfsb, &reiserfs_is_3_6)) { + if (reiserfs_is_3_6) { +@@ -1860,7 +1857,7 @@ write_part_table(void) { + + while (!done) { + mvaddstr(COMMAND_LINE_Y, COMMAND_LINE_X, +- _("Are you sure you want write the partition table " ++ _("Are you sure you want to write the partition table " + "to disk? (yes or no): ")); + len = get_string(response, LINE_LENGTH, NULL); + clear_warning(); +--- util-linux-2.12r.orig/fdisk/fdisk.c 2004-12-18 02:00:31.000000000 +0000 ++++ util-linux-2.12r/fdisk/fdisk.c 2006-07-08 15:40:23.461899841 +0000 +@@ -239,8 +239,8 @@ void fatal(enum failure why) { + + static void + seek_sector(int fd, unsigned int secno) { +- long long offset = (long long) secno * sector_size; +- if (ext2_llseek(fd, offset, SEEK_SET) == (long long) -1) ++ off_t offset = (off_t) secno * sector_size; ++ if (lseek(fd, offset, SEEK_SET) == (off_t) -1) + fatal(unable_to_seek); + } + +--- util-linux-2.12r.orig/fdisk/fdisk.h 2004-12-15 18:19:06.000000000 +0000 ++++ util-linux-2.12r/fdisk/fdisk.h 2006-07-08 15:40:23.462899439 +0000 +@@ -26,9 +26,6 @@ + #define cround(n) (display_in_cyl_units ? ((n)/units_per_sector)+1 : (n)) + #define scround(x) (((x)+units_per_sector-1)/units_per_sector) + +-extern long long ext2_llseek(unsigned int fd, long long offset, +- unsigned int origin); +- + #if defined(__GNUC__) && (defined(__arm__) || defined(__alpha__)) + # define PACKED __attribute__ ((packed)) + #else +--- util-linux-2.12r.orig/fdisk/fdiskbsdlabel.c 2003-07-13 21:12:47.000000000 +0000 ++++ util-linux-2.12r/fdisk/fdiskbsdlabel.c 2006-07-08 15:40:23.463899038 +0000 +@@ -566,7 +566,7 @@ xbsd_write_bootstrap (void) + sector = get_start_sect(xbsd_part); + #endif + +- if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1) ++ if (lseek (fd, (off_t) sector * SECTOR_SIZE, SEEK_SET) == -1) + fatal (unable_to_seek); + if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE)) + fatal (unable_to_write); +@@ -735,7 +735,7 @@ xbsd_readlabel (struct partition *p, str + sector = 0; + #endif + +- if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1) ++ if (lseek (fd, (off_t) sector * SECTOR_SIZE, SEEK_SET) == -1) + fatal (unable_to_seek); + if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE)) + fatal (unable_to_read); +@@ -781,12 +781,12 @@ xbsd_writelabel (struct partition *p, st + + #if defined (__alpha__) && BSD_LABELSECTOR == 0 + alpha_bootblock_checksum (disklabelbuffer); +- if (ext2_llseek (fd, (long long) 0, SEEK_SET) == -1) ++ if (lseek (fd, (off_t) 0, SEEK_SET) == -1) + fatal (unable_to_seek); + if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE)) + fatal (unable_to_write); + #else +- if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE + BSD_LABELOFFSET, ++ if (lseek (fd, (off_t) sector * SECTOR_SIZE + BSD_LABELOFFSET, + SEEK_SET) == -1) + fatal (unable_to_seek); + if (sizeof (struct xbsd_disklabel) != write (fd, d, sizeof (struct xbsd_disklabel))) +--- util-linux-2.12r.orig/fdisk/fdisksgilabel.c 2004-12-18 01:53:45.000000000 +0000 ++++ util-linux-2.12r/fdisk/fdisksgilabel.c 2006-07-08 15:40:23.464898637 +0000 +@@ -379,7 +379,7 @@ sgi_write_table(void) { + */ + sgiinfo *info = fill_sgiinfo(); + int infostartblock = SSWAP32(sgilabel->directory[0].vol_file_start); +- if (ext2_llseek(fd, (long long)infostartblock* ++ if (lseek(fd, (off_t) infostartblock* + SECTOR_SIZE, SEEK_SET) < 0) + fatal(unable_to_seek); + if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE) +--- util-linux-2.12r.orig/fdisk/sfdisk.c 2005-01-04 22:31:57.000000000 +0000 ++++ util-linux-2.12r/fdisk/sfdisk.c 2006-07-08 15:40:23.467897432 +0000 +@@ -164,36 +164,17 @@ fatal(char *s, ...) { + /* + * sseek: seek to specified sector - return 0 on failure + * +- * For >4GB disks lseek needs a > 32bit arg, and we have to use llseek. +- * On the other hand, a 32 bit sector number is OK until 2TB. +- * The routines _llseek and sseek below are the only ones that +- * know about the loff_t type. +- * + * Note: we use 512-byte sectors here, irrespective of the hardware ss. + */ +-#undef use_lseek +-#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__) +-#define use_lseek +-#endif +- +-#ifndef use_lseek +-static __attribute__used +-_syscall5(int, _llseek, unsigned int, fd, ulong, hi, ulong, lo, +- loff_t *, res, unsigned int, wh); +-#endif + + static int + sseek(char *dev, unsigned int fd, unsigned long s) { +- loff_t in, out; +- in = ((loff_t) s << 9); ++ off_t in, out; ++ in = ((off_t) s << 9); + out = 1; + +-#ifndef use_lseek +- if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0) { +-#else + if ((out = lseek(fd, in, SEEK_SET)) != in) { +-#endif +- perror("llseek"); ++ perror("lseek"); + error(_("seek error on %s - cannot seek to %lu\n"), dev, s); + return 0; + } +--- util-linux-2.12r.orig/partx/partx.c 2004-08-23 20:13:27.000000000 +0000 ++++ util-linux-2.12r/partx/partx.c 2006-07-08 15:40:23.469896630 +0000 +@@ -330,34 +330,15 @@ xmalloc (size_t size) { + return t; + } + +-/* +- * sseek: seek to specified sector +- */ +-#if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__) +-#define NEED__llseek +-#endif +- +-#ifdef NEED__llseek +-#include /* _syscall */ +-static +-_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, +- long long *, res, uint, wh); +-#endif +- + static int + sseek(int fd, unsigned int secnr) { + long long in, out; + in = ((long long) secnr << 9); + out = 1; + +-#ifdef NEED__llseek +- if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0 +- || out != in) +-#else + if ((out = lseek(fd, in, SEEK_SET)) != in) +-#endif + { +- fprintf(stderr, "llseek error\n"); ++ fprintf(stderr, "lseek error\n"); + return -1; + } + return 0; diff --git a/packages/base/util-linux/util-linux b/packages/base/util-linux/util-linux index 0eac9de..098c56e 100644 --- a/packages/base/util-linux/util-linux +++ b/packages/base/util-linux/util-linux @@ -2,14 +2,14 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 2.12q -# [S] 1-8 2-15 -# [D] util-linux-2.12q.tar.bz2 ftp://ftp.kernel.org/pub/linux/utils/util-linux/ +# [V] 2.12r +# [S] 1-2 2-15 +# [D] util-linux-2.12r.tar.bz2 ftp://ftp.kernel.org/pub/linux/utils/util-linux/ -if [ "$hdw_status" = "1" ]; then +if [ "$stage" = "1" ]; then pre_install() { - cp configure configure.orig - sed "s%/usr/include%$prefix/include%g" configure.orig configure + sed "s%/usr/include%$prefix/include%g" configure > tmp~ + mv tmp~ configure chmod 755 configure } build_main() { @@ -19,11 +19,11 @@ if [ "$hdw_status" = "1" ]; then make -C text-utils more } post_install() { - cp mount/{mount,umount} text-utils/more $prefix/bin + cp -v mount/{mount,umount} text-utils/more $prefix/bin } fi -if [ "$hdw_status" = "2" ]; then +if [ "$stage" = "2" ]; then pre_install() { sed 's%etc/adjtime%var/lib/hwclock/adjtime%' \ hwclock/hwclock.c > tmp~ && diff --git a/packages/base/wget/allow-tilde-in-url.patch b/packages/base/wget/allow-tilde-in-url.patch deleted file mode 100644 index 7cfa8b6..0000000 --- a/packages/base/wget/allow-tilde-in-url.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ./src/url.c.orig Sun May 27 21:35:10 2001 -+++ ./src/url.c Fri Jun 8 17:51:50 2001 -@@ -166,7 +166,7 @@ - U, 0, 0, 0, 0, 0, 0, 0, /* ` a b c d e f g */ - 0, 0, 0, 0, 0, 0, 0, 0, /* h i j k l m n o */ - 0, 0, 0, 0, 0, 0, 0, 0, /* p q r s t u v w */ -- 0, 0, 0, U, U, U, U, U, /* x y z { | } ~ DEL */ -+ 0, 0, 0, U, U, U, 0, U, /* x y z { | } ~ DEL */ - - U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, - U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, U, diff --git a/packages/base/wget/wget b/packages/base/wget/wget index b474b6f..e9a16ae 100644 --- a/packages/base/wget/wget +++ b/packages/base/wget/wget @@ -2,12 +2,12 @@ # author: hackbard@hackdaworld.dyndns.org -# [V] 1.9.1 +# [V] 1.10.2 -# [S] 1-9 2-7 -# [D] wget-1.9.1.tar.gz ftp://ftp.gnu.org/pub/gnu/wget/ +# [S] 1-3 2-7 +# [D] wget-1.10.2.tar.gz ftp://ftp.gnu.org/pub/gnu/wget/ -if [ "$hdw_status" = "1" ] ; then +if [ "$stage" = "1" ] ; then post_install() { [ -f /etc/resolv.conf ] && cp /etc/resolv.conf $root/etc } diff --git a/packages/toolchain/linux/linux b/packages/toolchain/linux/linux index d7248df..c8dca02 100644 --- a/packages/toolchain/linux/linux +++ b/packages/toolchain/linux/linux @@ -2,9 +2,9 @@ # # author: hackbard@hackdaworld.dyndns.org # -# [V] 2.6.18 +# [V] 2.6.18.1 # [S] 0-2 -# [D] linux-2.6.18.tar.bz2 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/ +# [D] linux-2.6.18.1.tar.bz2 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/ skip=1 s_reason="obsolete, there is a linux libc headers package now."