]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20100408 snapshot
authorChet Ramey <chet.ramey@case.edu>
Tue, 13 Dec 2011 02:56:51 +0000 (21:56 -0500)
committerChet Ramey <chet.ramey@case.edu>
Tue, 13 Dec 2011 02:56:51 +0000 (21:56 -0500)
12 files changed:
CWRU/CWRU.chlog
CWRU/CWRU.chlog~
builtins/declare.def
builtins/declare.def~ [new file with mode: 0644]
execute_cmd.c
execute_cmd.c~
lib/readline/input.c~ [new file with mode: 0644]
po/ja.po
subst.c
subst.c~
trap.c
trap.c~

index 220af121bbba102ba7d75a950caf03c839fd2b9b..ba68b82aa540532cabcffe302380e4381add426d 100644 (file)
@@ -9689,3 +9689,11 @@ parser.h
 
 subst.c
        - include parser.h
+
+                                   4/9
+                                   ---
+builtins/declare.def
+       - make sure declare_internal calls bind_assoc_variable with newly-
+         allocated memory for the key argument when using an implicit key
+         of "0".  Bug report and fix from Andreas Schwab
+         <schwab@linux-m68k.org>
index 02e11f7c398fbd9fd3b48d44e2e430e4b15f6b56..b5ad1aced4a6facad6a8df7074c0fc0bb9f6381d 100644 (file)
@@ -9682,3 +9682,18 @@ subst.h
        - new string_extract and extract_dollar_brace_string flag value:
          SX_POSIXEXP, set if the shell is expanding one of the new Posix
          pattern removal word expansions
+
+parser.h
+       - new definitions for "word expansion state", shared between parse.y
+         and subst.c
+
+subst.c
+       - include parser.h
+
+                                   4/8
+                                   ---
+builtins/declare.def
+       - make sure declare_internal calls bind_assoc_variable with newly-
+         allocated memory for the key argument when using an implicit key
+         of "0".  Bug report and fix from Andreas Schwab
+         <schwab@linux-m68k.org>
index a0ce605493446a460769d4991584387cf23a2a55..811d8e64d34eb3539e7c9edc89fba2a850598f81 100644 (file)
@@ -512,7 +512,7 @@ declare_internal (list, local_var)
            {
              /* let bind_{array,assoc}_variable take care of this. */
              if (assoc_p (var))
-               bind_assoc_variable (var, name, "0", value, aflags);
+               bind_assoc_variable (var, name, savestring ("0"), value, aflags);
              else
                bind_array_variable (name, 0, value, aflags);
            }
diff --git a/builtins/declare.def~ b/builtins/declare.def~
new file mode 100644 (file)
index 0000000..a0ce605
--- /dev/null
@@ -0,0 +1,562 @@
+This file is declare.def, from which is created declare.c.
+It implements the builtins "declare" and "local" in Bash.
+
+Copyright (C) 1987-2009 Free Software Foundation, Inc.
+
+This file is part of GNU Bash, the Bourne Again SHell.
+
+Bash is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Bash is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Bash.  If not, see <http://www.gnu.org/licenses/>.
+
+$PRODUCES declare.c
+
+$BUILTIN declare
+$FUNCTION declare_builtin
+$SHORT_DOC declare [-aAfFilrtux] [-p] [name[=value] ...]
+Set variable values and attributes.
+
+Declare variables and give them attributes.  If no NAMEs are given,
+display the attributes and values of all variables.
+
+Options:
+  -f   restrict action or display to function names and definitions
+  -F   restrict display to function names only (plus line number and
+       source file when debugging)
+  -p   display the attributes and value of each NAME
+
+Options which set attributes:
+  -a   to make NAMEs indexed arrays (if supported)
+  -A   to make NAMEs associative arrays (if supported)
+  -i   to make NAMEs have the `integer' attribute
+  -l   to convert NAMEs to lower case on assignment
+  -r   to make NAMEs readonly
+  -t   to make NAMEs have the `trace' attribute
+  -u   to convert NAMEs to upper case on assignment
+  -x   to make NAMEs export
+
+Using `+' instead of `-' turns off the given attribute.
+
+Variables with the integer attribute have arithmetic evaluation (see
+the `let' command) performed when the variable is assigned a value.
+
+When used in a function, `declare' makes NAMEs local, as with the `local'
+command.
+
+Exit Status:
+Returns success unless an invalid option is supplied or an error occurs.
+$END
+
+$BUILTIN typeset
+$FUNCTION declare_builtin
+$SHORT_DOC typeset [-aAfFilrtux] [-p] name[=value] ...
+Set variable values and attributes.
+
+Obsolete.  See `help declare'.
+$END
+
+#include <config.h>
+
+#if defined (HAVE_UNISTD_H)
+#  ifdef _MINIX
+#    include <sys/types.h>
+#  endif
+#  include <unistd.h>
+#endif
+
+#include <stdio.h>
+
+#include "../bashansi.h"
+#include "../bashintl.h"
+
+#include "../shell.h"
+#include "common.h"
+#include "builtext.h"
+#include "bashgetopt.h"
+
+extern int array_needs_making;
+extern int posixly_correct;
+
+static int declare_internal __P((register WORD_LIST *, int));
+
+/* Declare or change variable attributes. */
+int
+declare_builtin (list)
+     register WORD_LIST *list;
+{
+  return (declare_internal (list, 0));
+}
+
+$BUILTIN local
+$FUNCTION local_builtin
+$SHORT_DOC local [option] name[=value] ...
+Define local variables.
+
+Create a local variable called NAME, and give it VALUE.  OPTION can
+be any option accepted by `declare'.
+
+Local variables can only be used within a function; they are visible
+only to the function where they are defined and its children.
+
+Exit Status:
+Returns success unless an invalid option is supplied, an error occurs,
+or the shell is not executing a function.
+$END
+int
+local_builtin (list)
+     register WORD_LIST *list;
+{
+  if (variable_context)
+    return (declare_internal (list, 1));
+  else
+    {
+      builtin_error (_("can only be used in a function"));
+      return (EXECUTION_FAILURE);
+    }
+}
+
+#if defined (ARRAY_VARS)
+#  define DECLARE_OPTS "+acfilprtuxAF"
+#else
+#  define DECLARE_OPTS "+cfilprtuxF"
+#endif
+
+/* The workhorse function. */
+static int
+declare_internal (list, local_var)
+     register WORD_LIST *list;
+     int local_var;
+{
+  int flags_on, flags_off, *flags;
+  int any_failed, assign_error, pflag, nodefs, opt;
+  char *t, *subscript_start;
+  SHELL_VAR *var;
+  FUNCTION_DEF *shell_fn;
+
+  flags_on = flags_off = any_failed = assign_error = pflag = nodefs = 0;
+  reset_internal_getopt ();
+  while ((opt = internal_getopt (list, DECLARE_OPTS)) != EOF)
+    {
+      flags = list_opttype == '+' ? &flags_off : &flags_on;
+
+      switch (opt)
+       {
+       case 'a':
+#if defined (ARRAY_VARS)
+         *flags |= att_array;
+         break;
+#else
+         builtin_usage ();
+         return (EX_USAGE);
+#endif
+       case 'A':
+#if defined (ARRAY_VARS)
+         *flags |= att_assoc;
+         break;
+#else
+         builtin_usage ();
+         return (EX_USAGE);
+#endif
+       case 'p':
+         if (local_var == 0)
+           pflag++;
+         break;
+        case 'F':
+         nodefs++;
+         *flags |= att_function;
+         break;
+       case 'f':
+         *flags |= att_function;
+         break;
+       case 'i':
+         *flags |= att_integer;
+         break;
+       case 'r':
+         *flags |= att_readonly;
+         break;
+       case 't':
+         *flags |= att_trace;
+         break;
+       case 'x':
+         *flags |= att_exported;
+         array_needs_making = 1;
+         break;
+#if defined (CASEMOD_ATTRS)
+#  if defined (CASEMOD_CAPCASE)
+        case 'c':
+         *flags |= att_capcase;
+         if (flags == &flags_on)
+           flags_off |= att_uppercase|att_lowercase;
+         break;
+#  endif
+       case 'l':
+         *flags |= att_lowercase;
+         if (flags == &flags_on)
+           flags_off |= att_capcase|att_uppercase;
+         break;
+       case 'u':
+         *flags |= att_uppercase;
+         if (flags == &flags_on)
+           flags_off |= att_capcase|att_lowercase;
+         break;
+#endif /* CASEMOD_ATTRS */
+       default:
+         builtin_usage ();
+         return (EX_USAGE);
+       }
+    }
+
+  list = loptend;
+
+  /* If there are no more arguments left, then we just want to show
+     some variables. */
+  if (list == 0)       /* declare -[aAfFirtx] */
+    {
+      /* Show local variables defined at this context level if this is
+        the `local' builtin. */
+      if (local_var)
+       {
+         register SHELL_VAR **vlist;
+         register int i;
+
+         vlist = all_local_variables ();
+
+         if (vlist)
+           {
+             for (i = 0; vlist[i]; i++)
+               print_assignment (vlist[i]);
+
+             free (vlist);
+           }
+       }
+      else if (pflag && (flags_on == 0 || flags_on == att_function))
+       show_all_var_attributes (flags_on == 0, nodefs);
+      else if (flags_on == 0)
+       return (set_builtin ((WORD_LIST *)NULL));
+      else
+       set_or_show_attributes ((WORD_LIST *)NULL, flags_on, nodefs);
+
+      return (sh_chkwrite (EXECUTION_SUCCESS));
+    }
+
+  if (pflag)   /* declare -p [-aAfFirtx] name [name...] */
+    {
+      for (any_failed = 0; list; list = list->next)
+       {
+         pflag = show_name_attributes (list->word->word, nodefs);
+         if (pflag)
+           {
+             sh_notfound (list->word->word);
+             any_failed++;
+           }
+       }
+      return (sh_chkwrite (any_failed ? EXECUTION_FAILURE : EXECUTION_SUCCESS));
+    }
+
+#define NEXT_VARIABLE() free (name); list = list->next; continue
+
+  /* There are arguments left, so we are making variables. */
+  while (list)         /* declare [-aAfFirx] name [name ...] */
+    {
+      char *value, *name;
+      int offset, aflags;
+#if defined (ARRAY_VARS)
+      int making_array_special, compound_array_assign, simple_array_assign;
+#endif
+
+      name = savestring (list->word->word);
+      offset = assignment (name, 0);
+      aflags = 0;
+
+      if (offset)      /* declare [-aAfFirx] name=value */
+       {
+         name[offset] = '\0';
+         value = name + offset + 1;
+         if (name[offset - 1] == '+')
+           {
+             aflags |= ASS_APPEND;
+             name[offset - 1] = '\0';
+           }
+       }
+      else
+       value = "";
+
+#if defined (ARRAY_VARS)
+      compound_array_assign = simple_array_assign = 0;
+      subscript_start = (char *)NULL;
+      if (t = strchr (name, '['))      /* ] */
+       {
+         /* If offset != 0 we have already validated any array reference */
+         if (offset == 0 && valid_array_reference (name) == 0)
+           {
+             sh_invalidid (name);
+             assign_error++;
+             NEXT_VARIABLE ();
+           }
+         subscript_start = t;
+         *t = '\0';
+         making_array_special = 1;
+       }
+      else
+       making_array_special = 0;
+#endif
+
+      /* If we're in posix mode or not looking for a shell function (since
+        shell function names don't have to be valid identifiers when the
+        shell's not in posix mode), check whether or not the argument is a
+        valid, well-formed shell identifier. */
+      if ((posixly_correct || (flags_on & att_function) == 0) && legal_identifier (name) == 0)
+       {
+         sh_invalidid (name);
+         assign_error++;
+         NEXT_VARIABLE ();
+       }
+
+      /* If VARIABLE_CONTEXT has a non-zero value, then we are executing
+        inside of a function.  This means we should make local variables,
+        not global ones. */
+
+      /* XXX - this has consequences when we're making a local copy of a
+              variable that was in the temporary environment.  Watch out
+              for this. */
+      if (variable_context && ((flags_on & att_function) == 0))
+       {
+#if defined (ARRAY_VARS)
+         if (flags_on & att_assoc)
+           var = make_local_assoc_variable (name);
+         else if ((flags_on & att_array) || making_array_special)
+           var = make_local_array_variable (name);
+         else
+#endif
+         var = make_local_variable (name);
+         if (var == 0)
+           {
+             any_failed++;
+             NEXT_VARIABLE ();
+           }
+       }
+      else
+       var = (SHELL_VAR *)NULL;
+
+      /* If we are declaring a function, then complain about it in some way.
+        We don't let people make functions by saying `typeset -f foo=bar'. */
+
+      /* There should be a way, however, to let people look at a particular
+        function definition by saying `typeset -f foo'. */
+
+      if (flags_on & att_function)
+       {
+         if (offset)   /* declare -f [-rix] foo=bar */
+           {
+             builtin_error (_("cannot use `-f' to make functions"));
+             free (name);
+             return (EXECUTION_FAILURE);
+           }
+         else          /* declare -f [-rx] name [name...] */
+           {
+             var = find_function (name);
+
+             if (var)
+               {
+                 if (readonly_p (var) && (flags_off & att_readonly))
+                   {
+                     builtin_error (_("%s: readonly function"), name);
+                     any_failed++;
+                     NEXT_VARIABLE ();
+                   }
+
+                 /* declare -[Ff] name [name...] */
+                 if (flags_on == att_function && flags_off == 0)
+                   {
+#if defined (DEBUGGER)
+                     if (nodefs && debugging_mode)
+                       {
+                         shell_fn = find_function_def (var->name);
+                         if (shell_fn)
+                           printf ("%s %d %s\n", var->name, shell_fn->line, shell_fn->source_file);
+                         else
+                           printf ("%s\n", var->name);
+                       }
+                     else
+#endif /* DEBUGGER */
+                       {       
+                         t = nodefs ? var->name
+                                    : named_function_string (name, function_cell (var), FUNC_MULTILINE|FUNC_EXTERNAL);
+                         printf ("%s\n", t);
+                         any_failed = sh_chkwrite (any_failed);
+                       }
+                   }
+                 else          /* declare -[fF] -[rx] name [name...] */
+                   {
+                     VSETATTR (var, flags_on);
+                     VUNSETATTR (var, flags_off);
+                   }
+               }
+             else
+               any_failed++;
+             NEXT_VARIABLE ();
+           }
+       }
+      else             /* declare -[aAirx] name [name...] */
+       {
+         /* Non-null if we just created or fetched a local variable. */
+         if (var == 0)
+           var = find_variable (name);
+
+         if (var == 0)
+           {
+#if defined (ARRAY_VARS)
+             if (flags_on & att_assoc)
+               var = make_new_assoc_variable (name);
+             else if ((flags_on & att_array) || making_array_special)
+               var = make_new_array_variable (name);
+             else
+#endif
+
+             if (offset)
+               var = bind_variable (name, "", 0);
+             else
+               {
+                 var = bind_variable (name, (char *)NULL, 0);
+                 VSETATTR (var, att_invisible);
+               }
+           }
+
+         /* Cannot use declare +r to turn off readonly attribute. */ 
+         if (readonly_p (var) && (flags_off & att_readonly))
+           {
+             sh_readonly (name);
+             any_failed++;
+             NEXT_VARIABLE ();
+           }
+
+         /* Cannot use declare to assign value to readonly or noassign
+            variable. */
+         if ((readonly_p (var) || noassign_p (var)) && offset)
+           {
+             if (readonly_p (var))
+               sh_readonly (name);
+             assign_error++;
+             NEXT_VARIABLE ();
+           }
+
+#if defined (ARRAY_VARS)
+         if ((making_array_special || (flags_on & (att_array|att_assoc)) || array_p (var) || assoc_p (var)) && offset)
+           {
+             int vlen;
+             vlen = STRLEN (value);
+
+             if (value[0] == '(' && value[vlen-1] == ')')
+               compound_array_assign = 1;
+             else
+               simple_array_assign = 1;
+           }
+
+         /* Cannot use declare +a name or declare +A name to remove an
+            array variable. */
+         if (((flags_off & att_array) && array_p (var)) || ((flags_off & att_assoc) && assoc_p (var)))
+           {
+             builtin_error (_("%s: cannot destroy array variables in this way"), name);
+             any_failed++;
+             NEXT_VARIABLE ();
+           }
+
+         if ((flags_on & att_array) && assoc_p (var))
+           {
+             builtin_error (_("%s: cannot convert associative to indexed array"), name);
+             any_failed++;
+             NEXT_VARIABLE ();
+           }
+         if ((flags_on & att_assoc) && array_p (var))
+           {
+             builtin_error (_("%s: cannot convert indexed to associative array"), name);
+             any_failed++;
+             NEXT_VARIABLE ();
+           }
+
+         /* declare -A name[[n]] makes name an associative array variable. */
+         if (flags_on & att_assoc)
+           {
+             if (assoc_p (var) == 0)
+               var = convert_var_to_assoc (var);
+           }
+         /* declare -a name[[n]] or declare name[n] makes name an indexed
+            array variable. */
+         else if ((making_array_special || (flags_on & att_array)) && array_p (var) == 0 && assoc_p (var) == 0)
+           var = convert_var_to_array (var);
+#endif /* ARRAY_VARS */
+
+         VSETATTR (var, flags_on);
+         VUNSETATTR (var, flags_off);
+
+#if defined (ARRAY_VARS)
+         if (offset && compound_array_assign)
+           assign_array_var_from_string (var, value, aflags);
+         else if (simple_array_assign && subscript_start)
+           {
+             /* declare [-aA] name[N]=value */
+             *subscript_start = '[';   /* ] */
+             var = assign_array_element (name, value, 0);      /* XXX - not aflags */
+             *subscript_start = '\0';
+           }
+         else if (simple_array_assign)
+           {
+             /* let bind_{array,assoc}_variable take care of this. */
+             if (assoc_p (var))
+               bind_assoc_variable (var, name, "0", value, aflags);
+             else
+               bind_array_variable (name, 0, value, aflags);
+           }
+         else
+#endif
+         /* bind_variable_value duplicates the essential internals of
+            bind_variable() */
+         if (offset)
+           bind_variable_value (var, value, aflags);
+
+         /* If we found this variable in the temporary environment, as with
+            `var=value declare -x var', make sure it is treated identically
+            to `var=value export var'.  Do the same for `declare -r' and
+            `readonly'.  Preserve the attributes, except for att_tempvar. */
+         /* XXX -- should this create a variable in the global scope, or
+            modify the local variable flags?  ksh93 has it modify the
+            global scope.
+            Need to handle case like in set_var_attribute where a temporary
+            variable is in the same table as the function local vars. */
+         if ((flags_on & (att_exported|att_readonly)) && tempvar_p (var))
+           {
+             SHELL_VAR *tv;
+             char *tvalue;
+
+             tv = find_tempenv_variable (var->name);
+             if (tv)
+               {
+                 tvalue = var_isset (var) ? savestring (value_cell (var)) : savestring ("");
+                 tv = bind_variable (var->name, tvalue, 0);
+                 tv->attributes |= var->attributes & ~att_tempvar;
+                 if (tv->context > 0)
+                   VSETATTR (tv, att_propagate);
+                 free (tvalue);
+               }
+             VSETATTR (var, att_propagate);
+           }
+       }
+
+      stupidly_hack_special_variables (name);
+
+      NEXT_VARIABLE ();
+    }
+
+  return (assign_error ? EX_BADASSIGN
+                      : ((any_failed == 0) ? EXECUTION_SUCCESS
+                                           : EXECUTION_FAILURE));
+}
index 7a429e8ee7fe95930f4a79feafd6125afa17164d..b61740b1ec6670b7d9e0fa6386ec1eecd977950b 100644 (file)
@@ -272,7 +272,7 @@ static int line_number_for_err_trap;
 
 /* A sort of function nesting level counter */
 static int funcnest = 0;
-int funcnest_max = 0;          /* XXX - for bash-4.2 */
+int funcnest_max = 0;          /* XXX - bash-4.2 */
 
 struct fd_bitmap *current_fds_to_close = (struct fd_bitmap *)NULL;
 
@@ -1390,7 +1390,15 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
 
   reset_terminating_signals ();                /* in sig.c */
   /* Cancel traps, in trap.c. */
+#if 0  /* XXX - bash-4.2 */
+  /* Reset the signal handlers in the child, but don't free the
+     trap strings.  Set a flag noting that we have to free the
+     trap strings if we run trap to change a signal disposition. */
+  reset_signal_handlers ();
+  subshell_environment |= SUBSHELL_RESETTRAP;
+#else
   restore_original_signals ();
+#endif
 
   /* Make sure restore_original_signals doesn't undo the work done by
      make_child to ensure that asynchronous children are immune to SIGINT
@@ -3804,8 +3812,16 @@ run_builtin:
       if (already_forked)
        {
          /* reset_terminating_signals (); */   /* XXX */
+#if 0  /* XXX - bash-4.2 */
+         /* Reset the signal handlers in the child, but don't free the
+            trap strings.  Set a flag noting that we have to free the
+            trap strings if we run trap to change a signal disposition. */
+         reset_signal_handlers ();
+         subshell_environment |= SUBSHELL_RESETTRAP;
+#else
          /* Cancel traps, in trap.c. */
          restore_original_signals ();
+#endif
 
          if (async)
            {
@@ -4033,7 +4049,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
 
   USE_VAR(fc);
 
-#if 0  /* for bash-4.2 */
+#if 0  /* XXX - bash-4.2 */
   if (funcnest_max > 0 && funcnest >= funcnest_max)
     {
       internal_error ("%s: maximum function nesting level exceeded (%d)", var->name, funcnest);
index 0773fbd206b694f564caa54cae7020127782c5da..37f348795cc1170ebf0438b00292e36dc8adcfcb 100644 (file)
@@ -272,7 +272,7 @@ static int line_number_for_err_trap;
 
 /* A sort of function nesting level counter */
 static int funcnest = 0;
-int funcnest_max = 0;          /* XXX - for bash-4.2 */
+int funcnest_max = 0;          /* XXX - bash-4.2 */
 
 struct fd_bitmap *current_fds_to_close = (struct fd_bitmap *)NULL;
 
@@ -1390,7 +1390,15 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
 
   reset_terminating_signals ();                /* in sig.c */
   /* Cancel traps, in trap.c. */
+#if 0  /* XXX - bash-4.2 */
+  /* Reset the signal handlers in the child, but don't free the
+     trap strings.  Set a flag noting that we have to free the
+     trap strings if we run trap to change a signal disposition. */
+  reset_signal_handlers ();
+  subshell_environment |= SUBSHELL_RESETTRAP;
+#else
   restore_original_signals ();
+#endif
 
   /* Make sure restore_original_signals doesn't undo the work done by
      make_child to ensure that asynchronous children are immune to SIGINT
@@ -3804,8 +3812,18 @@ run_builtin:
       if (already_forked)
        {
          /* reset_terminating_signals (); */   /* XXX */
+#if 1  /* XXX - bash-4.2 */
+itrace("execute_simple_command: forked builtin or shell function: calling restore_original_signals");
+         /* Reset the signal handlers in the child, but don't free the
+            trap strings.  Set a flag noting that we have to free the
+            trap strings if we run trap to change a signal disposition. */
+         reset_signal_handlers ();
+         subshell_environment |= SUBSHELL_RESETTRAP;
+#else
+itrace("execute_simple_command: forked builtin or shell function: calling restore_original_signals");
          /* Cancel traps, in trap.c. */
          restore_original_signals ();
+#endif
 
          if (async)
            {
@@ -4033,7 +4051,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
 
   USE_VAR(fc);
 
-#if 0  /* for bash-4.2 */
+#if 0  /* XXX - bash-4.2 */
   if (funcnest_max > 0 && funcnest >= funcnest_max)
     {
       internal_error ("%s: maximum function nesting level exceeded (%d)", var->name, funcnest);
@@ -4542,6 +4560,7 @@ execute_disk_command (words, redirects, command_line, pipe_in, pipe_out,
 #endif
 #endif
 
+      reset_terminating_signals ();    /* XXX */
       /* Cancel traps, in trap.c. */
       restore_original_signals ();
 
diff --git a/lib/readline/input.c~ b/lib/readline/input.c~
new file mode 100644 (file)
index 0000000..6d3181f
--- /dev/null
@@ -0,0 +1,595 @@
+/* input.c -- character input functions for readline. */
+
+/* Copyright (C) 1994-2009 Free Software Foundation, Inc.
+
+   This file is part of the GNU Readline Library (Readline), a library
+   for reading lines of text with interactive input and history editing.      
+
+   Readline is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   Readline is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with Readline.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#define READLINE_LIBRARY
+
+#if defined (__TANDEM)
+#  include <floss.h>
+#endif
+
+#if defined (HAVE_CONFIG_H)
+#  include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <fcntl.h>
+#if defined (HAVE_SYS_FILE_H)
+#  include <sys/file.h>
+#endif /* HAVE_SYS_FILE_H */
+
+#if defined (HAVE_UNISTD_H)
+#  include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+
+#if defined (HAVE_STDLIB_H)
+#  include <stdlib.h>
+#else
+#  include "ansi_stdlib.h"
+#endif /* HAVE_STDLIB_H */
+
+#include "posixselect.h"
+
+#if defined (FIONREAD_IN_SYS_IOCTL)
+#  include <sys/ioctl.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+
+#if !defined (errno)
+extern int errno;
+#endif /* !errno */
+
+/* System-specific feature definitions and include files. */
+#include "rldefs.h"
+#include "rlmbutil.h"
+
+/* Some standard library routines. */
+#include "readline.h"
+
+#include "rlprivate.h"
+#include "rlshell.h"
+#include "xmalloc.h"
+
+/* What kind of non-blocking I/O do we have? */
+#if !defined (O_NDELAY) && defined (O_NONBLOCK)
+#  define O_NDELAY O_NONBLOCK  /* Posix style */
+#endif
+
+/* Non-null means it is a pointer to a function to run while waiting for
+   character input. */
+rl_hook_func_t *rl_event_hook = (rl_hook_func_t *)NULL;
+
+rl_getc_func_t *rl_getc_function = rl_getc;
+
+static int _keyboard_input_timeout = 100000;           /* 0.1 seconds; it's in usec */
+
+static int ibuffer_space PARAMS((void));
+static int rl_get_char PARAMS((int *));
+static int rl_gather_tyi PARAMS((void));
+
+/* **************************************************************** */
+/*                                                                 */
+/*                     Character Input Buffering                   */
+/*                                                                 */
+/* **************************************************************** */
+
+static int pop_index, push_index;
+static unsigned char ibuffer[512];
+static int ibuffer_len = sizeof (ibuffer) - 1;
+
+#define any_typein (push_index != pop_index)
+
+int
+_rl_any_typein ()
+{
+  return any_typein;
+}
+
+/* Return the amount of space available in the buffer for stuffing
+   characters. */
+static int
+ibuffer_space ()
+{
+  if (pop_index > push_index)
+    return (pop_index - push_index - 1);
+  else
+    return (ibuffer_len - (push_index - pop_index));
+}
+
+/* Get a key from the buffer of characters to be read.
+   Return the key in KEY.
+   Result is KEY if there was a key, or 0 if there wasn't. */
+static int
+rl_get_char (key)
+     int *key;
+{
+  if (push_index == pop_index)
+    return (0);
+
+  *key = ibuffer[pop_index++];
+#if 0
+  if (pop_index >= ibuffer_len)
+#else
+  if (pop_index > ibuffer_len)
+#endif
+    pop_index = 0;
+
+fprintf(stderr, "rl_get_char: returning 1 (key = %d)\n", *key);
+  return (1);
+}
+
+/* Stuff KEY into the *front* of the input buffer.
+   Returns non-zero if successful, zero if there is
+   no space left in the buffer. */
+int
+_rl_unget_char (key)
+     int key;
+{
+  if (ibuffer_space ())
+    {
+      pop_index--;
+      if (pop_index < 0)
+       pop_index = ibuffer_len;
+      ibuffer[pop_index] = key;
+      return (1);
+    }
+  return (0);
+}
+
+int
+_rl_pushed_input_available ()
+{
+  return (push_index != pop_index);
+}
+
+/* If a character is available to be read, then read it and stuff it into
+   IBUFFER.  Otherwise, just return.  Returns number of characters read
+   (0 if none available) and -1 on error (EIO). */
+static int
+rl_gather_tyi ()
+{
+  int tty;
+  register int tem, result;
+  int chars_avail, k;
+  char input;
+#if defined(HAVE_SELECT)
+  fd_set readfds, exceptfds;
+  struct timeval timeout;
+#endif
+
+  chars_avail = 0;
+  tty = fileno (rl_instream);
+
+#if defined (HAVE_SELECT)
+  FD_ZERO (&readfds);
+  FD_ZERO (&exceptfds);
+  FD_SET (tty, &readfds);
+  FD_SET (tty, &exceptfds);
+  USEC_TO_TIMEVAL (_keyboard_input_timeout, timeout);
+  result = select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout);
+  if (result <= 0)
+    return 0;  /* Nothing to read. */
+#endif
+
+  result = -1;
+#if defined (FIONREAD)
+  errno = 0;
+  result = ioctl (tty, FIONREAD, &chars_avail);
+  if (result == -1 && errno == EIO)
+    return -1;
+#endif
+
+#if defined (O_NDELAY)
+  if (result == -1)
+    {
+      tem = fcntl (tty, F_GETFL, 0);
+
+      fcntl (tty, F_SETFL, (tem | O_NDELAY));
+      chars_avail = read (tty, &input, 1);
+
+      fcntl (tty, F_SETFL, tem);
+      if (chars_avail == -1 && errno == EAGAIN)
+       return 0;
+      if (chars_avail == 0)    /* EOF */
+       {
+         rl_stuff_char (EOF);
+         return (0);
+       }
+    }
+#endif /* O_NDELAY */
+
+#if defined (__MINGW32__)
+  /* Use getch/_kbhit to check for available console input, in the same way
+     that we read it normally. */
+   chars_avail = isatty (tty) ? _kbhit () : 0;
+   result = 0;
+#endif
+
+  /* If there's nothing available, don't waste time trying to read
+     something. */
+  if (chars_avail <= 0)
+    return 0;
+
+  tem = ibuffer_space ();
+
+  if (chars_avail > tem)
+    chars_avail = tem;
+
+  /* One cannot read all of the available input.  I can only read a single
+     character at a time, or else programs which require input can be
+     thwarted.  If the buffer is larger than one character, I lose.
+     Damn! */
+  if (tem < ibuffer_len)
+    chars_avail = 0;
+
+  if (result != -1)
+    {
+      while (chars_avail--)
+       {
+         RL_CHECK_SIGNALS ();
+         k = (*rl_getc_function) (rl_instream);
+         if (rl_stuff_char (k) == 0)
+           break;                      /* some problem; no more room */
+         if (k == NEWLINE || k == RETURN)
+           break;
+       }
+    }
+  else
+    {
+      if (chars_avail)
+       rl_stuff_char (input);
+    }
+
+  return 1;
+}
+
+int
+rl_set_keyboard_input_timeout (u)
+     int u;
+{
+  int o;
+
+  o = _keyboard_input_timeout;
+  if (u >= 0)
+    _keyboard_input_timeout = u;
+  return (o);
+}
+
+/* Is there input available to be read on the readline input file
+   descriptor?  Only works if the system has select(2) or FIONREAD.
+   Uses the value of _keyboard_input_timeout as the timeout; if another
+   readline function wants to specify a timeout and not leave it up to
+   the user, it should use _rl_input_queued(timeout_value_in_microseconds)
+   instead. */
+int
+_rl_input_available ()
+{
+#if defined(HAVE_SELECT)
+  fd_set readfds, exceptfds;
+  struct timeval timeout;
+#endif
+#if !defined (HAVE_SELECT) && defined(FIONREAD)
+  int chars_avail;
+#endif
+  int tty;
+
+  tty = fileno (rl_instream);
+
+#if defined (HAVE_SELECT)
+  FD_ZERO (&readfds);
+  FD_ZERO (&exceptfds);
+  FD_SET (tty, &readfds);
+  FD_SET (tty, &exceptfds);
+  timeout.tv_sec = 0;
+  timeout.tv_usec = _keyboard_input_timeout;
+  return (select (tty + 1, &readfds, (fd_set *)NULL, &exceptfds, &timeout) > 0);
+#else
+
+#if defined (FIONREAD)
+  if (ioctl (tty, FIONREAD, &chars_avail) == 0)
+    return (chars_avail);
+#endif
+
+#endif
+
+#if defined (__MINGW32__)
+  if (isatty (tty))
+    return (_kbhit ());
+#endif
+
+  return 0;
+}
+
+int
+_rl_input_queued (t)
+     int t;
+{
+  int old_timeout, r;
+
+  old_timeout = rl_set_keyboard_input_timeout (t);
+  r = _rl_input_available ();
+  rl_set_keyboard_input_timeout (old_timeout);
+  return r;
+}
+
+void
+_rl_insert_typein (c)
+     int c;     
+{      
+  int key, t, i;
+  char *string;
+
+  i = key = 0;
+  string = (char *)xmalloc (ibuffer_len + 1);
+  string[i++] = (char) c;
+
+  while ((t = rl_get_char (&key)) &&
+        _rl_keymap[key].type == ISFUNC &&
+        _rl_keymap[key].function == rl_insert)
+    string[i++] = key;
+
+  if (t)
+    _rl_unget_char (key);
+
+  string[i] = '\0';
+  rl_insert_text (string);
+  xfree (string);
+}
+
+/* Add KEY to the buffer of characters to be read.  Returns 1 if the
+   character was stuffed correctly; 0 otherwise. */
+int
+rl_stuff_char (key)
+     int key;
+{
+  if (ibuffer_space () == 0)
+    return 0;
+
+  if (key == EOF)
+    {
+      key = NEWLINE;
+      rl_pending_input = EOF;
+      RL_SETSTATE (RL_STATE_INPUTPENDING);
+    }
+  ibuffer[push_index++] = key;
+#if 0
+  if (push_index >= ibuffer_len)
+#else
+  if (push_index > ibuffer_len)
+#endif
+    push_index = 0;
+
+  return 1;
+}
+
+/* Make C be the next command to be executed. */
+int
+rl_execute_next (c)
+     int c;
+{
+  rl_pending_input = c;
+  RL_SETSTATE (RL_STATE_INPUTPENDING);
+  return 0;
+}
+
+/* Clear any pending input pushed with rl_execute_next() */
+int
+rl_clear_pending_input ()
+{
+  rl_pending_input = 0;
+  RL_UNSETSTATE (RL_STATE_INPUTPENDING);
+  return 0;
+}
+
+/* **************************************************************** */
+/*                                                                 */
+/*                          Character Input                        */
+/*                                                                 */
+/* **************************************************************** */
+
+/* Read a key, including pending input. */
+int
+rl_read_key ()
+{
+  int c;
+
+  rl_key_sequence_length++;
+
+  if (rl_pending_input)
+    {
+      c = rl_pending_input;
+      rl_clear_pending_input ();
+    }
+  else
+    {
+      /* If input is coming from a macro, then use that. */
+      if (c = _rl_next_macro_key ())
+       return (c);
+
+      /* If the user has an event function, then call it periodically. */
+      if (rl_event_hook)
+       {
+         while (rl_event_hook && rl_get_char (&c) == 0)
+           {
+             (*rl_event_hook) ();
+             RL_CHECK_SIGNALS ();
+             if (rl_done)              /* XXX - experimental */
+               return ('\n');
+             if (rl_gather_tyi () < 0) /* XXX - EIO */
+               {
+                 rl_done = 1;
+                 return ('\n');
+               }
+           }
+       }
+      else
+       {
+         if (rl_get_char (&c) == 0)
+           c = (*rl_getc_function) (rl_instream);
+         RL_CHECK_SIGNALS ();
+       }
+    }
+
+  return (c);
+}
+
+int
+rl_getc (stream)
+     FILE *stream;
+{
+  int result;
+  unsigned char c;
+
+  while (1)
+    {
+      RL_CHECK_SIGNALS ();
+
+#if defined (__MINGW32__)
+      if (isatty (fileno (stream)))
+       return (getch ());
+#endif
+      result = read (fileno (stream), &c, sizeof (unsigned char));
+
+      if (result == sizeof (unsigned char))
+       return (c);
+
+      /* If zero characters are returned, then the file that we are
+        reading from is empty!  Return EOF in that case. */
+      if (result == 0)
+       return (EOF);
+
+#if defined (__BEOS__)
+      if (errno == EINTR)
+       continue;
+#endif
+
+#if defined (EWOULDBLOCK)
+#  define X_EWOULDBLOCK EWOULDBLOCK
+#else
+#  define X_EWOULDBLOCK -99
+#endif
+
+#if defined (EAGAIN)
+#  define X_EAGAIN EAGAIN
+#else
+#  define X_EAGAIN -99
+#endif
+
+      if (errno == X_EWOULDBLOCK || errno == X_EAGAIN)
+       {
+         if (sh_unset_nodelay_mode (fileno (stream)) < 0)
+           return (EOF);
+         continue;
+       }
+
+#undef X_EWOULDBLOCK
+#undef X_EAGAIN
+
+      /* If the error that we received was SIGINT, then try again,
+        this is simply an interrupted system call to read ().
+        Otherwise, some error ocurred, also signifying EOF. */
+      if (errno != EINTR)
+       return (RL_ISSTATE (RL_STATE_READCMD) ? READERR : EOF);
+    }
+}
+
+#if defined (HANDLE_MULTIBYTE)
+/* read multibyte char */
+int
+_rl_read_mbchar (mbchar, size)
+     char *mbchar;
+     int size;
+{
+  int mb_len, c;
+  size_t mbchar_bytes_length;
+  wchar_t wc;
+  mbstate_t ps, ps_back;
+
+  memset(&ps, 0, sizeof (mbstate_t));
+  memset(&ps_back, 0, sizeof (mbstate_t));
+
+  mb_len = 0;  
+  while (mb_len < size)
+    {
+      RL_SETSTATE(RL_STATE_MOREINPUT);
+      c = rl_read_key ();
+      RL_UNSETSTATE(RL_STATE_MOREINPUT);
+
+      if (c < 0)
+       break;
+
+      mbchar[mb_len++] = c;
+
+      mbchar_bytes_length = mbrtowc (&wc, mbchar, mb_len, &ps);
+      if (mbchar_bytes_length == (size_t)(-1))
+       break;          /* invalid byte sequence for the current locale */
+      else if (mbchar_bytes_length == (size_t)(-2))
+       {
+         /* shorted bytes */
+         ps = ps_back;
+         continue;
+       } 
+      else if (mbchar_bytes_length == 0)
+       {
+         mbchar[0] = '\0';     /* null wide character */
+         mb_len = 1;
+         break;
+       }
+      else if (mbchar_bytes_length > (size_t)(0))
+       break;
+    }
+
+  return mb_len;
+}
+
+/* Read a multibyte-character string whose first character is FIRST into
+   the buffer MB of length MLEN.  Returns the last character read, which
+   may be FIRST.  Used by the search functions, among others.  Very similar
+   to _rl_read_mbchar. */
+int
+_rl_read_mbstring (first, mb, mlen)
+     int first;
+     char *mb;
+     int mlen;
+{
+  int i, c;
+  mbstate_t ps;
+
+  c = first;
+  memset (mb, 0, mlen);
+  for (i = 0; c >= 0 && i < mlen; i++)
+    {
+      mb[i] = (char)c;
+      memset (&ps, 0, sizeof (mbstate_t));
+      if (_rl_get_char_len (mb, &ps) == -2)
+       {
+         /* Read more for multibyte character */
+         RL_SETSTATE (RL_STATE_MOREINPUT);
+         c = rl_read_key ();
+         RL_UNSETSTATE (RL_STATE_MOREINPUT);
+       }
+      else
+       break;
+    }
+  return c;
+}
+#endif /* HANDLE_MULTIBYTE */
index 5056fe8df15aeccd15bf157b273462a4f46e7ada..371eaa375837c34d3a69b262972798b125b75417 100644 (file)
--- a/po/ja.po
+++ b/po/ja.po
@@ -1,4 +1,4 @@
-# Japanese message for GNU bash 4.1
+# Japanese messages for GNU bash
 # Copyright (C) 1999, 2010 Free Software Foundation, Inc.
 # This file is distributed under the same license as the bash package.
 # Kyoichi Ozaki <k@afromania.org>, 2000.
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: GNU bash 4.1\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2009-12-30 08:25-0500\n"
-"PO-Revision-Date: 2010-04-01 01:59+0900\n"
+"PO-Revision-Date: 2010-04-09 18:51+0900\n"
 "Last-Translator: Yasuaki Taniguchi <yasuakit@gmail.com>\n"
 "Language-Team: Japanese <translation-team-ja@lists.sourceforge.net>\n"
 "MIME-Version: 1.0\n"
@@ -101,7 +101,7 @@ msgstr "%s はどのキーにも割り当てられていません。\n"
 #: builtins/bind.def:307
 #, c-format
 msgid "%s can be invoked via "
-msgstr ""
+msgstr "%s は次を通して起動します "
 
 #: builtins/break.def:77 builtins/break.def:117
 msgid "loop count"
@@ -117,12 +117,17 @@ msgid ""
 "    \n"
 "    Without EXPR, returns "
 msgstr ""
+"現在のサブルーチン呼び出しのコンテキストを返します。\n"
+"    \n"
+"    EXPR が無い場合、次を返します "
 
 #: builtins/caller.def:135
 msgid ""
 ".  With EXPR, returns\n"
 "    "
 msgstr ""
+"。  EXPR が存在する場合、次を返します \n"
+"    "
 
 #: builtins/caller.def:136
 msgid ""
@@ -132,6 +137,11 @@ msgid ""
 "    The value of EXPR indicates how many call frames to go back before the\n"
 "    current one; the top frame is frame 0."
 msgstr ""
+"。この追加の情報はスタックトレース\n"
+"    を提供する時に利用します。\n"
+"\n"
+"    EXPR の値は現在のフレームに戻るまでに何回フレームが呼び出されているかを\n"
+"    意味します。最上位のフレームは 0 です。"
 
 #: builtins/cd.def:215
 msgid "HOME not set"
@@ -415,7 +425,7 @@ msgstr "%s: 一時ファイル %s を開くことができません"
 
 #: builtins/fg_bg.def:149 builtins/jobs.def:282
 msgid "current"
-msgstr ""
+msgstr "カレント"
 
 #: builtins/fg_bg.def:158
 #, c-format
@@ -444,14 +454,13 @@ msgstr "%s: ハッシュテーブルが空です\n"
 #: builtins/hash.def:244
 #, c-format
 msgid "hits\tcommand\n"
-msgstr ""
+msgstr "hits\tcommand\n"
 
 #: builtins/help.def:130
 #, c-format
 msgid "Shell commands matching keyword `"
 msgid_plural "Shell commands matching keywords `"
-msgstr[0] ""
-msgstr[1] ""
+msgstr[0] "キーワードに一致したシェルコマンド `"
 
 #: builtins/help.def:168
 #, c-format
@@ -496,9 +505,9 @@ msgid "%s: history expansion failed"
 msgstr "%s: ヒストリの展開に失敗しました"
 
 #: builtins/inlib.def:71
-#, fuzzy, c-format
+#, c-format
 msgid "%s: inlib failed"
-msgstr "%s: 指数の表現を期待"
+msgstr "%s: inlib が失敗しました"
 
 #: builtins/jobs.def:109
 msgid "no other options allowed with `-x'"
@@ -543,9 +552,9 @@ msgid "%s: invalid array origin"
 msgstr "%s: 無効な配列の原点です"
 
 #: builtins/mapfile.def:294
-#, fuzzy, c-format
+#, c-format
 msgid "%s: invalid callback quantum"
-msgstr "悪いシグナル番号"
+msgstr "%s: コールバックの quantum が無効です"
 
 #: builtins/mapfile.def:326
 msgid "empty array variable name"
@@ -1009,22 +1018,22 @@ msgstr "save_bash_input: 新規 fd %d のバッファはすでに存在します
 
 #: jobs.c:466
 msgid "start_pipeline: pgrp pipe"
-msgstr ""
+msgstr "start_pipeline: pgrp pipe"
 
 #: jobs.c:887
 #, c-format
 msgid "forked pid %d appears in running job %d"
-msgstr ""
+msgstr "実行中のジョブ %2$d で fork した pid %1$d が出現しました"
 
 #: jobs.c:1005
 #, c-format
 msgid "deleting stopped job %d with process group %ld"
-msgstr ""
+msgstr "プロセスグループ %2$ld のジョブ %1$d を削除しています"
 
 #: jobs.c:1110
 #, c-format
 msgid "add_process: process %5ld (%s) in the_pipeline"
-msgstr ""
+msgstr "add_process: プロセス %5ld (%s) が the_pipeline にあります"
 
 #: jobs.c:1113
 #, c-format
@@ -1172,50 +1181,50 @@ msgstr "不明"
 
 #: lib/malloc/malloc.c:797
 msgid "malloc: block on free list clobbered"
-msgstr ""
+msgstr "malloc: block on free リストにあるブロックが壊れています"
 
 #: lib/malloc/malloc.c:874
 msgid "free: called with already freed block argument"
-msgstr ""
+msgstr "free: 既に free されたブロックを引数として呼び出されました"
 
 #: lib/malloc/malloc.c:877
 msgid "free: called with unallocated block argument"
-msgstr ""
+msgstr "free: 未割当のブロックを引数として呼び出されました"
 
 #: lib/malloc/malloc.c:896
 msgid "free: underflow detected; mh_nbytes out of range"
-msgstr ""
+msgstr "free: アンダーフローを検出しました。 mh_nbytes が範囲外です。"
 
 #: lib/malloc/malloc.c:902
 msgid "free: start and end chunk sizes differ"
-msgstr ""
+msgstr "free: 開始と終了の塊の大きさが異なっています"
 
 #: lib/malloc/malloc.c:1001
 msgid "realloc: called with unallocated block argument"
-msgstr ""
+msgstr "realloc: 未割当のブロックを引数として呼び出されました"
 
 #: lib/malloc/malloc.c:1016
 msgid "realloc: underflow detected; mh_nbytes out of range"
-msgstr ""
+msgstr "realloc: アンダーフローを検出しました。 mh_nbytes が範囲外です。<"
 
 #: lib/malloc/malloc.c:1022
 msgid "realloc: start and end chunk sizes differ"
-msgstr ""
+msgstr "realloc: 開始と終了の塊の大きさが異なっています"
 
 #: lib/malloc/table.c:177
 #, c-format
 msgid "register_alloc: alloc table is full with FIND_ALLOC?\n"
-msgstr ""
+msgstr "register_alloc: FIND_ALLOC で割り当てテーブルがいっぱいです\n"
 
 #: lib/malloc/table.c:184
 #, c-format
 msgid "register_alloc: %p already in table as allocated?\n"
-msgstr ""
+msgstr "register_alloc: %p 既にテーブル上では割り当てられています\n"
 
 #: lib/malloc/table.c:220
 #, c-format
 msgid "register_free: %p already in table as free?\n"
-msgstr ""
+msgstr "register_free: %p テーブル上では既に解放されています\n"
 
 #: lib/sh/fmtulong.c:101
 msgid "invalid base"
@@ -1424,7 +1433,7 @@ msgstr "xtrace_set: NULL ファイルポインタです"
 #: print_cmd.c:372
 #, c-format
 msgid "xtrace fd (%d) != fileno xtrace fp (%d)"
-msgstr ""
+msgstr "xtrace fd (%d) != fileno xtrace fp (%d)"
 
 #: print_cmd.c:1461
 #, c-format
@@ -1558,7 +1567,7 @@ msgstr "不正な指定"
 
 #: siglist.c:67
 msgid "BPT trace/trap"
-msgstr ""
+msgstr "BPT trace/trap"
 
 #: siglist.c:75
 msgid "ABORT instruction"
@@ -1743,9 +1752,8 @@ msgid "cannot make pipe for command substitution"
 msgstr "コマンド代入ではパイプを作成できません"
 
 #: subst.c:5097
-#, fuzzy
 msgid "cannot make child for command substitution"
-msgstr "代理コマンドに子を作成できません: %s"
+msgstr "コマンド代入では子プロセスを作成できません"
 
 #: subst.c:5114
 msgid "command_substitute: cannot duplicate pipe as fd 1"
@@ -1857,29 +1865,29 @@ msgstr "all_local_variables: 現在のスコープは関数コンテキストで
 #: variables.c:3376
 #, c-format
 msgid "%s has null exportstr"
-msgstr ""
+msgstr "%s は null の exportstr を持っています"
 
 #: variables.c:3381 variables.c:3390
 #, c-format
 msgid "invalid character %d in exportstr for %s"
-msgstr ""
+msgstr "%2$s に対する exportstr で %1$d は無効な文字です"
 
 #: variables.c:3396
 #, c-format
 msgid "no `=' in exportstr for %s"
-msgstr ""
+msgstr "%s に対する exportstr に `=' がありません"
 
 #: variables.c:3835
 msgid "pop_var_context: head of shell_variables not a function context"
-msgstr ""
+msgstr "pop_var_context: shell_variables の先頭です。関数コンテキストではありません"
 
 #: variables.c:3848
 msgid "pop_var_context: no global_variables context"
-msgstr ""
+msgstr "pop_var_context: global_variables コンテキストではありません"
 
 #: variables.c:3922
 msgid "pop_scope: head of shell_variables not a temporary environment scope"
-msgstr ""
+msgstr "pop_scope: shell_variables の先頭です。一時環境スコープではありません"
 
 #: variables.c:4678
 #, c-format
@@ -1954,7 +1962,7 @@ msgstr "unalias [-a] name [name ...]"
 
 #: builtins.c:51
 msgid "bind [-lpvsPVS] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]"
-msgstr "bind [-lpvsPVS] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function or readline-command]"
+msgstr "bind [-lpvsPVS] [-m keymap] [-f filename] [-q name] [-u name] [-r keyseq] [-x keyseq:shell-command] [keyseq:readline-function または readline-command]"
 
 #: builtins.c:54
 msgid "break [n]"
@@ -2098,11 +2106,11 @@ msgstr "unset [-f] [-v] [name ...]"
 
 #: builtins.c:144
 msgid "export [-fn] [name[=value] ...] or export -p"
-msgstr "export [-fn] [name[=value] ...] or export -p"
+msgstr "export [-fn] [name[=value] ...] または export -p"
 
 #: builtins.c:146
 msgid "readonly [-af] [name[=value] ...] or readonly -p"
-msgstr "readonly [-af] [name[=value] ...] or readonly -p"
+msgstr "readonly [-af] [name[=value] ...] または readonly -p"
 
 #: builtins.c:148
 msgid "shift [n]"
@@ -2279,8 +2287,9 @@ msgstr ""
 "    引数がない場合、`alias` は再使用可能なエイリアス一覧を `alias 名前=値'\n"
 "    形式で標準出力に表示します。\n"
 "    \n"
-"    そうでなければ、与えられた名前と値でエイリアスを定義します。値の後続に空白が存在する\n"
-"    場合は次の語はエイリアス展開時にエイリアス代入対象として確認されます。\n"
+"    そうでなければ、与えられた名前と値でエイリアスを定義します。値の後続に空白\n"
+"    が存在する場合は次の語はエイリアス展開時にエイリアス代入対象として確認され\n"
+"    ます。\n"
 "\n"
 "    オプション:\n"
 "      -p\tすべての定義されたエイリアスを再利用可能な形式で表示します\n"
@@ -2454,8 +2463,7 @@ msgstr ""
 "    意味します。最上位のフレームは 0 です。\n"
 "    \n"
 "    終了ステータス:\n"
-"    シェルが関数を実行できないか式 EXPR が無効な場合を除き 0 を返します。\n"
-"    is invalid."
+"    シェルが関数を実行できないか式 EXPR が無効な場合を除き 0 を返します。"
 
 #: builtins.c:383
 msgid ""
@@ -2856,7 +2864,6 @@ msgstr ""
 "    返します。"
 
 #: builtins.c:626
-#, fuzzy
 msgid ""
 "Parse option arguments.\n"
 "    \n"
@@ -2898,41 +2905,40 @@ msgid ""
 msgstr ""
 "オプション引数を解析します。\n"
 "    \n"
-"    Getopts は位置パラメーターをオプションとして解析する際にシェルによっ\n"
+"    getopts は位置パラメーターをオプションとして解析する際にシェルによっ\n"
 "    て使用される手続です。\n"
 "    \n"
 "    OPTSTRING には認識されるオプションの文字が含まれます。文字の後に\n"
 "    コロン(:)が続く場合は、オプションは空白文字でオプションから区切\n"
 "    られた引数を持つと予期されます。\n"
 "    \n"
-"    Each time it is invoked, getopts will place the next option in the\n"
-"    shell variable $name, initializing name if it does not exist, and\n"
-"    the index of the next argument to be processed into the shell\n"
-"    variable OPTIND.  OPTIND is initialized to 1 each time the shell or\n"
-"    a shell script is invoked.  When an option requires an argument,\n"
-"    getopts places that argument into the shell variable OPTARG.\n"
-"    \n"
-"    getopts reports errors in one of two ways.  If the first character\n"
-"    of OPTSTRING is a colon, getopts uses silent error reporting.  In\n"
-"    this mode, no error messages are printed.  If an invalid option is\n"
-"    seen, getopts places the option character found into OPTARG.  If a\n"
-"    required argument is not found, getopts places a ':' into NAME and\n"
-"    sets OPTARG to the option character found.  If getopts is not in\n"
-"    silent mode, and an invalid option is seen, getopts places '?' into\n"
-"    NAME and unsets OPTARG.  If a required argument is not found, a '?'\n"
-"    is placed in NAME, OPTARG is unset, and a diagnostic message is\n"
-"    printed.\n"
-"    \n"
-"    If the shell variable OPTERR has the value 0, getopts disables the\n"
-"    printing of error messages, even if the first character of\n"
-"    OPTSTRING is not a colon.  OPTERR has the value 1 by default.\n"
+"    getopts は起動されるたびに、次のオプションをシェル変数 $name に保存\n"
+"    します。name が存在しない場合は初期化されます。そして処理する必要が\n"
+"    ある次の引数の位置をシェル変数 OPTIND に保存します。OPTIND はシェル\n"
+"    またはシェルスクリプトが起動するたびに 1 に初期化されます。オプショ\n"
+"    ンに引数が要求される場合、getopt は引数をシェル変数 OPTARG に保存し\n"
+"    ます。\n"
+"    \n"
+"    getopts はエラーを2つの方法のいずれかで報告します。OPTSTRINGの最初\n"
+"    の文字がコロン (:) の場合、getopts はサイレントエラー報告を使用し\n"
+"    ます。このモードではエラーメッセージは表示されません。無効なオプシ\n"
+"    ョンを見つけた時、 getopts はオプションの文字を OPTARG に設定しま\n"
+"    す。必要なオプション引数が見つからない場合は、getopts は NAME に\n"
+"    ':' を設定し、OPTARG にオプションの文字を設定します。getopts が\n"
+"    サイレントモードで無い場合、無効なオプションを見つけた時、getopts \n"
+"    は NAME に '?' を設定し、OPTARG を未定義状態にします。そして\n"
+"    診断メッセージを表示します。\n"
+"    \n"
+"    シェル変数 OPTERR の値が 0 の場合、getopts は OPTSTRING の最初が\n"
+"    コロン (:) か否かにかかわらずエラーメッセージの表示を抑止します。\n"
+"    OPTERR のデフォルト値は 1 です。\n"
+"    \n"
+"    getopts では通常位置パラメーター ($0 - $9) を解析します。しかし\n"
+"    他の引数が与えられた場合、それらが解析されます。\n"
 "    \n"
-"    Getopts normally parses the positional parameters ($0 - $9), but if\n"
-"    more arguments are given, they are parsed instead.\n"
-"    \n"
-"    Exit Status:\n"
-"    Returns success if an option is found; fails if the end of options is\n"
-"    encountered or an error occurs."
+"    終了ステータス:\n"
+"    オプションが見つかった場合に成功を返します。オプションの終わり\n"
+"    に到達するかエラーが発生した時に失敗を返します。"
 
 #: builtins.c:668
 msgid ""
@@ -3522,7 +3528,6 @@ msgstr ""
 "    返します。"
 
 #: builtins.c:1022
-#, fuzzy
 msgid ""
 "Set or unset values of shell options and positional parameters.\n"
 "    \n"
@@ -3608,68 +3613,67 @@ msgstr ""
 "    を表示します。\n"
 "    \n"
 "    オプション:\n"
-"      -a  Mark variables which are modified or created for export.\n"
-"      -b  Notify of job termination immediately.\n"
+"      -a  変数を変更または変更してエクスポートするようにマークします。\n"
+"      -b  ジョブ終了を即時通知します。\n"
 "      -e  コマンドの終了ステータスが 0 以外の場合は即時終了します。   \n"
-"      -f  Disable file name generation (globbing).\n"
-"      -h  Remember the location of commands as they are looked up.\n"
+"      -f  ファイル名生成 (globbing) を無効にします。\n"
+"      -h  検索したコマンドの位置を記憶します。\n"
 "      -k  All assignment arguments are placed in the environment for a\n"
 "          command, not just those that precede the command name.\n"
 "      -m  ジョブ制御を有効にします。\n"
 "      -n  コマンドを読み込みますが実行しません。\n"
 "      -o option-name\n"
-"          Set the variable corresponding to option-name:\n"
-"              allexport    same as -a\n"
-"              braceexpand  same as -B\n"
-"              emacs        use an emacs-style line editing interface\n"
-"              errexit      same as -e\n"
-"              errtrace     same as -E\n"
-"              functrace    same as -T\n"
-"              hashall      same as -h\n"
-"              histexpand   same as -H\n"
-"              history      enable command history\n"
-"              ignoreeof    the shell will not exit upon reading EOF\n"
+"          option-name に対応した変数を設定します:\n"
+"              allexport    -a と同様\n"
+"              braceexpand  -B と同様\n"
+"              emacs        emacs スタイルの行編集インターフェースを使用\n"
+"              errexit      -e と同様\n"
+"              errtrace     -E と同様\n"
+"              functrace    -T と同様\n"
+"              hashall      -h と同様\n"
+"              histexpand   -H と同様\n"
+"              history      コマンドヒストリを有効にする\n"
+"              ignoreeof    ファイル終了 (EOF) 読み込み時にシェルを終了\n"
+"                           しない\n"
 "              interactive-comments\n"
-"                           allow comments to appear in interactive commands\n"
-"              keyword      same as -k\n"
-"              monitor      same as -m\n"
-"              noclobber    same as -C\n"
-"              noexec       same as -n\n"
-"              noglob       same as -f\n"
-"              nolog        currently accepted but ignored\n"
-"              notify       same as -b\n"
-"              nounset      same as -u\n"
-"              onecmd       same as -t\n"
-"              physical     same as -P\n"
-"              pipefail     the return value of a pipeline is the status of\n"
-"                           the last command to exit with a non-zero status,\n"
-"                           or zero if no command exited with a non-zero status\n"
-"              posix        change the behavior of bash where the default\n"
-"                           operation differs from the Posix standard to\n"
-"                           match the standard\n"
-"              privileged   same as -p\n"
-"              verbose      same as -v\n"
-"              vi           use a vi-style line editing interface\n"
-"              xtrace       same as -x\n"
-"      -p  Turned on whenever the real and effective user ids do not match.\n"
-"          Disables processing of the $ENV file and importing of shell\n"
-"          functions.  Turning this option off causes the effective uid and\n"
-"          gid to be set to the real uid and gid.\n"
-"      -t  Exit after reading and executing one command.\n"
-"      -u  Treat unset variables as an error when substituting.\n"
-"      -v  Print shell input lines as they are read.\n"
-"      -x  Print commands and their arguments as they are executed.\n"
-"      -B  the shell will perform brace expansion\n"
-"      -C  If set, disallow existing regular files to be overwritten\n"
-"          by redirection of output.\n"
-"      -E  If set, the ERR trap is inherited by shell functions.\n"
-"      -H  Enable ! style history substitution.  This flag is on\n"
-"          by default when the shell is interactive.\n"
-"      -P  If set, do not follow symbolic links when executing commands\n"
-"          such as cd which change the current directory.\n"
-"      -T  If set, the DEBUG trap is inherited by shell functions.\n"
-"      -   Assign any remaining arguments to the positional parameters.\n"
-"          The -x and -v options are turned off.\n"
+"                           対話コマンドでコメントの使用を許可する\n"
+"              keyword      -k と同様\n"
+"              monitor      -m と同様\n"
+"              noclobber    -C と同様\n"
+"              noexec       -n と同様\n"
+"              noglob       -f と同様\n"
+"              nolog        受け付けられるが無視される\n"
+"              notify       -b と同様\n"
+"              nounset      -u と同様\n"
+"              onecmd       -t と同様\n"
+"              physical     -P と同様\n"
+"              pipefail     パイプラインの戻り値を最後に 0 以外で終了したコマ\n"
+"                           ンドの終了ステータスにする。0 以外のステータスで\n"
+"                           終了したコマンドが無い場合には 0 にする。\n"
+"              posix        Posix 標準とデフォルト動作が異なる bash の動作を\n"
+"                           Posix と一致するようにする\n"
+"              privileged   -p と同様\n"
+"              verbose      -v と同様\n"
+"              vi           vi スタイルの行編集インターフェースを使用\n"
+"              xtrace       -x と同様\n"
+"      -p  実 uid と実効 uid が異なる時に常にオンになります。$ENV ファイル\n"
+"          の処理およびシェル関数のインポートが無効になります。このオプショ\n"
+"          ンをオフにすると実効 uid, gid が実 uid, gid と同じに設定されます。\n"
+"      -t  一つのコマンドを読み込み、実行した後に終了します。\n"
+"      -u  代入時に変数を未設定にするとエラーとして扱います。\n"
+"      -v  シェルの入力行を読み込んだとおりに表示します。\n"
+"      -x  実行されるコマンドと引数をその通りに表示します。\n"
+"      -B  中括弧の展開をシェルで行います。\n"
+"      -C  設定した場合、リダイレクトで既存の通常ファイルを上書きすることを\n"
+"          禁止します。\n"
+"      -E  設定した場合 ERR トラップがシェル関数に継承されます。\n"
+"      -H  ! スタイルのヒストリ置換を有効にします。このフラグは対話的シェル\n"
+"          ではデフォルトでオンになっています。\n"
+"      -P  設定した場合、 cd などのカレントディレクトリを変更するコマンドを\n"
+"          実行した時にシンボリックリンクを辿りません。\n"
+"      -T  設定した場合、 DEBUG トラップがシェル関数に継承されます。\n"
+"      -   これ以降の引数を位置パラメーターとして割り当てます。-x と -v \n"
+"          オプションはオフになります。\n"
 "    \n"
 "    Using + rather than - causes these flags to be turned off.  The\n"
 "    flags can also be used upon invocation of the shell.  The current\n"
@@ -4425,9 +4429,15 @@ msgid ""
 "    Exit Status:\n"
 "    Returns the status of the last command executed."
 msgstr ""
+"パターン一致の結果に基づいてコマンドを実行します。\n"
+"    \n"
+"    WORD が PATTERN に一致するかどうかに基づいて選択的に COMMANDS を実行します。\n"
+"    複数のパターンを区切るために `|' が使用されます。\n"
+"    \n"
+"    終了ステータス:\n"
+"    最後に実行したコマンドのステータスを返します。"
 
 #: builtins.c:1563
-#, fuzzy
 msgid ""
 "Execute commands based on conditional.\n"
 "    \n"
@@ -4444,16 +4454,15 @@ msgid ""
 msgstr ""
 "条件に従ってコマンドを実行します。\n"
 "    \n"
-"    The `if COMMANDS' list is executed.  If its exit status is zero, then the\n"
-"    `then COMMANDS' list is executed.  Otherwise, each `elif COMMANDS' list is\n"
-"    executed in turn, and if its exit status is zero, the corresponding\n"
-"    `then COMMANDS' list is executed and the if command completes.  Otherwise,\n"
-"    the `else COMMANDS' list is executed, if present.  The exit status of the\n"
-"    entire construct is the exit status of the last command executed, or zero\n"
-"    if no condition tested true.\n"
+"    `if COMMANDS' を実行します。この終了ステータスが 0 の場合、`then COMMANDS'\n"
+"    を実行します。そうでない場合は、各 `elif COMMANDS' を順番に実行し、その\n"
+"    終了ステータスが 0 のの場合に、関連した `then COMMANDS' を実行し、if 文が\n"
+"    完了します。それ以外の場合、 `else COMMANDS' が存在する場合には実行され\n"
+"    ます。文全体の終了ステータスは、最後に実行したコマンドの終了ステータスか、\n"
+"    または、テストした条件に true となるものが無い場合は 0 です。\n"
 "    \n"
-"    Exit Status:\n"
-"    Returns the status of the last command executed."
+"    終了ステータス:\n"
+"    最後に実行したコマンドの終了ステータスを返します。"
 
 #: builtins.c:1580
 msgid ""
@@ -4566,6 +4575,15 @@ msgid ""
 "    Exit Status:\n"
 "    Returns the status of the resumed job."
 msgstr ""
+"ジョブをフォアグラウンドで再開します。\n"
+"    \n"
+"    `fg' コマンドの引数として与える JOB_SPEC と等価です。停止または\n"
+"    バックグラウンドのジョブを再開します。JOB_SPEC はジョブ名または\n"
+"    ジョブ番号で指定します。JOB_SPEC の後に `&' を続けると、`bg' の\n"
+"    引数として与えられたようにジョブをバックグラウンドにします。\n"
+"    \n"
+"    終了ステータス:\n"
+"    再開されたジョブの終了ステータスを返します。"
 
 #: builtins.c:1659
 msgid ""
@@ -4609,6 +4627,30 @@ msgid ""
 "    Exit Status:\n"
 "    0 or 1 depending on value of EXPRESSION."
 msgstr ""
+"条件式のコマンドを実行します。\n"
+"    \n"
+"    条件式 EXPRESSION の評価結果に基づいて 0 または 1 を返します。\n"
+"    条件式は test 組み込み関数と同じ優先順位で組み合わされます。また、\n"
+"    次の演算子とも組み合わされます。\n"
+"    \n"
+"      ( EXPRESSION )\tEXPRESSION の値を返します\n"
+"      ! EXPRESSION\t\tEXPRESSION が true の時 false を返します。それ\n"
+"                  \t\t以外は false を返します\n"
+"      EXPR1 && EXPR2\tEXPR1 および EXPR2 の両方が true の時 true を返します。\n"
+"      \tそれ以外は false を返します。\n"
+"      EXPR1 || EXPR2\tEXPR1 および EXPR2 のいずれかが true の時 true を返し\n"
+"      \tます。それ以外は false を返します。\n"
+"    \n"
+"    `==' および `!=' 演算子が使用された場合、演算子の右側の文字列をパターンと\n"
+"    した左側の文字列に対するパターン一致処理が行われます。\n"
+"    `=~' 演算子が使用された場合、演算子の右側の文字列が正規表現として扱われま\n"
+"    す。\n"
+"    \n"
+"    && および || 演算子は EXPR1 で式の値を決定するのに十分な場合は EXPR2 を\n"
+"    評価しません。\n"
+"    \n"
+"    終了ステータス:\n"
+"    EXPRESSION の値に基づいて 0 または 1 を返します。"
 
 #: builtins.c:1697
 msgid ""
@@ -4676,12 +4718,12 @@ msgstr ""
 "    HOME\tログインディレクトリの完全パス名。\n"
 "    HOSTNAME\t現在のホスト名。\n"
 "    HOSTTYPE\tこのバージョンの Bash を実行している CPU の種類。\n"
-"    IGNOREEOF\tControls the action of the shell on receipt of an EOF\n"
-"    \t\tcharacter as the sole input.  If set, then the value\n"
-"    \t\tof it is the number of EOF characters that can be seen\n"
-"    \t\tin a row on an empty line before the shell will exit\n"
-"    \t\t(default 10).  When unset, EOF signifies the end of input.\n"
-"    MACHTYPE\tA string describing the current system Bash is running on.\n"
+"    IGNOREEOF\tシェルがファイル終了 (EOF) 文字を単一の入力として受け\n"
+"    \t\t取った時の動作を制御します。設定されている場合、空白行\n"
+"    \t\tで EOF 文字をその数連続して受け取った時にシェルを終了\n"
+"    \t\tします (デフォルト 10)。設定が解除された場合、EOF で\n"
+"    \t\t入力が終了することを意味します。\n"
+"    MACHTYPE\tBash が実行されている現在のシステムを表す文字列。\n"
 "    MAILCHECK\tBash がメールを確認する頻度 (秒単位)。\n"
 "    MAILPATH\tBash が新規メールを確認するコロン (:) で区切られた\n"
 "    \t\tファイル名の一覧。\n"
@@ -4695,23 +4737,21 @@ msgstr ""
 "    PWD\t\t現在のディレクトリの完全パス名。\n"
 "    SHELLOPTS\tコロン (:) で区切られた有効なシェルオプション一覧。\n"
 "    TERM\t現在の端末種類名。\n"
-"    TIMEFORMAT\tThe output format for timing statistics displayed by the\n"
-"    \t\t`time' reserved word.\n"
-"    auto_resume\tNon-null means a command word appearing on a line by\n"
-"    \t\titself is first looked for in the list of currently\n"
-"    \t\tstopped jobs.  If found there, that job is foregrounded.\n"
-"    \t\tA value of `exact' means that the command word must\n"
-"    \t\texactly match a command in the list of stopped jobs.  A\n"
-"    \t\tvalue of `substring' means that the command word must\n"
-"    \t\tmatch a substring of the job.  Any other value means that\n"
-"    \t\tthe command must be a prefix of a stopped job.\n"
-"    histchars\tCharacters controlling history expansion and quick\n"
-"    \t\tsubstitution.  The first character is the history\n"
-"    \t\tsubstitution character, usually `!'.  The second is\n"
-"    \t\tthe `quick substitution' character, usually `^'.  The\n"
-"    \t\tthird is the `history comment' character, usually `#'.\n"
-"    HISTIGNORE\tA colon-separated list of patterns used to decide which\n"
-"    \t\tcommands should be saved on the history list.\n"
+"    TIMEFORMAT\t`time' 予約語による時間統計情報の表示書式。\n"
+"    auto_resume\tnull で無い場合、その行に現れたコマンドは、まず現在停止\n"
+"    \t\tされているジョブから検索されます。それで見つかった場合、\n"
+"    \t\tジョブがフォアグランドになります。値が `exact' の場合、\n"
+"    \t\tコマンドが停止しているジョブの一覧と厳密に一致していなけ\n"
+"    \t\tればなりません。値が `substring' の場合、コマンドがジョ\n"
+"    \t\tブの部分文字列に一致しなければなりません。その他の値の\n"
+"    \t\t場合はコマンドが停止しているジョブの先頭部分に一致しな\n"
+"    \t\tければなりません。\n"
+"    histchars\tヒストリ展開とクイック置換を制御する文字。最初の文字が\n"
+"    \t\tヒストリ展開の文字で通常は `!' です。二番目がクイック\n"
+"    \t\t置換で通常は `^' です。三番目がヒストリのコメントで\n"
+"    \t\t通常は `#' です。\n"
+"    HISTIGNORE\tヒストリ一覧に保存されるコマンドを決める時に使用される\n"
+"    \t\tコロン (:) で区切られたパターンの一覧。\n"
 
 #: builtins.c:1754
 msgid ""
@@ -4743,6 +4783,34 @@ msgid ""
 "    Returns success unless an invalid argument is supplied or the directory\n"
 "    change fails."
 msgstr ""
+"ディレクトリをディレクトリスタックに加えます。\n"
+"    \n"
+"    ディレクトリをディレクトリスタックの先頭に加える、またはディレ\n"
+"    クトリを回転してカレントディレクトリがスタックの先頭になるよう\n"
+"    にします。引数がない場合、先頭の二つのディレクトリを入れ替えま\n"
+"    す。\n"
+"    \n"
+"    オプション:\n"
+"      -n\tスタックに加えた時、通常のディレクトリ変更を抑止し\n"
+"    \tます。よってスタックのみ操作されます。\n"
+"    \n"
+"    引数:\n"
+"      +N\tN 番目のディレクトリが先頭になるようスタックを回転\n"
+"    \tします (`dirs' で表示される一覧の左から数えます。開始番号\n"
+"    \tは 0 です)。\n"
+"    \n"
+"      -N\tN 番目のディレクトリが先頭になるようスタックを回転\n"
+"    \tします (`dirs' で表示される一覧の右から数えます。開始番号\n"
+"    \tは 0 です)。\n"
+"    \n"
+"      dir\tDIR をディレクトリスタックの先頭に加え、カレント\n"
+"    \tディレクトリにします。\n"
+"    \n"
+"    `dirs' 組み込み関数でディレクトリスタックを表示します。\n"
+"    \n"
+"    終了ステータス:\n"
+"    無効な引数が与えられるかディレクトリ変更が失敗しない限り成功を\n"
+"    返します。"
 
 #: builtins.c:1788
 msgid ""
@@ -4770,6 +4838,29 @@ msgid ""
 "    Returns success unless an invalid argument is supplied or the directory\n"
 "    change fails."
 msgstr ""
+"ディレクトリスタックからディレクトリを削除します。\n"
+"    \n"
+"    ディレクトリスタックから要素を削除します。引数がない場合、ディレクトリ\n"
+"    スタックの先頭から削除し、新しいスタック先頭のディレクトリに移動します。\n"
+"    \n"
+"    オプション:\n"
+"      -n\tスタックからディレクトリを削除した時、通常のディレクトリ変\n"
+"    \t更を抑止します。よってスタックのみ操作されます。\n"
+"    \n"
+"    引数:\n"
+"      +N\t`dirs' で表示される一覧の左から数えて N 番目の要素を削除し\n"
+"    \tます。開始番号は 0 です。例えば、`popd +0' は先頭のディレクトリを\n"
+"    \t削除します。`popd +1' は二番目です。\n"
+"    \n"
+"      -N\t`dirs' で表示される一覧の右から数えて N 番目の要素を削除し\n"
+"    \tます。開始番号は 0 です。例えば、`popd -0' は最後のディレクトリを\n"
+"    \t削除します。`popd -1' は最後から二番目です。\n"
+"    \n"
+"    `dirs' 組み込み関数でディレクトリスタックを表示します。\n"
+"    \n"
+"    終了ステータス:\n"
+"    無効な引数が与えられるかディレクトリ変更が失敗しない限り成功を\n"
+"    返します。"
 
 #: builtins.c:1818
 msgid ""
@@ -4797,6 +4888,29 @@ msgid ""
 "    Exit Status:\n"
 "    Returns success unless an invalid option is supplied or an error occurs."
 msgstr ""
+"ディレクトリスタックを表示します。\n"
+"    \n"
+"    現在記憶されているディレクトリ一覧を表示します。ディレクトリは `pushd'\n"
+"    コマンドを使用して一覧に追加され、`popd' コマンドを通して一覧から取り\n"
+"    戻されます。\n"
+"    \n"
+"    オプション:\n"
+"      -c\t全ての要素を削除してディレクトリスタックを空にします\n"
+"      -l\tホームディレクトリからの相対パスを ~ を先頭にした形式で\n"
+"    \t表示しません\n"
+"      -p\t一行に一つのディレクトリスタック要素を表示します\n"
+"      -v\t一行に一つのディレクトリスタック要素を位置に関する番号\n"
+"    \tをつけて表示します\n"
+"    \n"
+"    引数:\n"
+"      +N\tdirs を引数無しで実行した時の一覧で左から数えて N 番目の\n"
+"    \t要素のみを表示します。開始番号は 0 です。\n"
+"    \n"
+"      -N\tdirs を引数無しで実行した時の一覧で右から数えて N 番目の\n"
+"    \t要素のみを表示します。開始番号は 0 です。\n"
+"    \n"
+"    終了ステータス:\n"
+"    無効なオプションが与えられるかエラーが発生しない限り成功を返します。"
 
 #: builtins.c:1847
 msgid ""
@@ -4817,6 +4931,21 @@ msgid ""
 "    Returns success if OPTNAME is enabled; fails if an invalid option is\n"
 "    given or OPTNAME is disabled."
 msgstr ""
+"シェルオプションを設定、および設定解除します。\n"
+"    \n"
+"    各シェルオプション OPTNAME の設定を変更します。引数がない場合、シェル\n"
+"    オプション全てを、それぞれ設定されているか否かを含めて表示します。\n"
+"    \n"
+"    オプション:\n"
+"      -o\trestrict OPTNAMEs to those defined for use with `set -o'\n"
+"      -p\tそれぞれのシェルオプションを、状態を含めて表示します\n"
+"      -q\t出力を抑止します\n"
+"      -s\tOPTNAME をそれぞれ有効 (設定) にします\n"
+"      -u\tOPTNAME をそれぞれ無効 (非設定) にします\n"
+"    \n"
+"    終了ステータス:\n"
+"    OPTNAME が有効な場合は成功を返します。無効なオプションが与えられた場合\n"
+"    または OPTNAME が無効な場合は失敗を返します。"
 
 #: builtins.c:1868
 msgid ""
@@ -4842,6 +4971,23 @@ msgid ""
 "    Returns success unless an invalid option is given or a write or assignment\n"
 "    error occurs."
 msgstr ""
+"ARGUMENTS を FORMAT で書式整形して表示します。\n"
+"    \n"
+"    オプション:\n"
+"      -v var\t標準出力に表示するのではなく、出力をシェル変数 VAR に代入します\n"
+"    \n"
+"    FORMAT は次の3種類のオブジェクトを含む文字列です。一つ目は普通の文字で単に\n"
+"    標準出力にコピーされます。二つ目はエスケープ文字で変換された後標準出力に\n"
+"    コピーされます。三つ目は書式指定文字で、各文字は後に続く引数を表示します。\n"
+"    \n"
+"    printf(1) および printf(3) に記述される標準の書式指定に加えて、printf は\n"
+"    次の文字を解釈します。\n"
+"    \n"
+"      %b\t対応する引数のバックスラッシュエスケープ文字を展開します\n"
+"      %q\tシェル入力として引数をクオートします\n"
+"    \n"
+"    終了ステータス:\n"
+"    無効な引数が与えられるか、書き込み、代入エラーが発生しない限り成功を返します。"
 
 #: builtins.c:1895
 msgid ""
@@ -4867,6 +5013,26 @@ msgid ""
 "    Exit Status:\n"
 "    Returns success unless an invalid option is supplied or an error occurs."
 msgstr ""
+"引数が Readline によってどのように補完されるかを指定します。\n"
+"    \n"
+"    各 NAME に対してどのように引数が補完されるかを指定します。オプションが与え\n"
+"    られない場合、既存の補完指定が入力として再利用可能な形式で表示されます。\n"
+"    \n"
+"    \n"
+"    オプション:\n"
+"      -p\t既存の補完指定を再利用可能な形式で表示します\n"
+"      -r\t補完指定 NAME を削除します。NAME が与えられない場合、全ての\n"
+"    \t補完指定を削除します。\n"
+"      -D\t補完指定が定義されていない時のコマンドに対するデフォルトの\n"
+"    \t補完と動作を適用します\n"
+"      -E\t\"空\" コマンドに対する補完 (空行に対する補完の試み) と動作\n"
+"    \tを適用します\n"
+"    \n"
+"    補完が試みられた時、上記オプションのうち大文字のオプションの動作が\n"
+"    行われます。-D オプションは -E オプションより優先されます。\n"
+"    \n"
+"    終了ステータス:\n"
+"    無効なオプションが与えられるかエラーが発生しない限り成功を返します。"
 
 #: builtins.c:1923
 msgid ""
@@ -4879,6 +5045,14 @@ msgid ""
 "    Exit Status:\n"
 "    Returns success unless an invalid option is supplied or an error occurs."
 msgstr ""
+"オプションに基づいた補完候補を表示します。\n"
+"    \n"
+"    シェル関数の中で補完候補をを生成するために使用するように意図されています。\n"
+"    オプション引数 WORD が与えられた場合、WORD に対して一致した候補が生成\n"
+"    されます。\n"
+"    \n"
+"    終了ステータス:\n"
+"    無効なオプションが与えられるかエラーが発生しない限り成功を返します。"
 
 #: builtins.c:1938
 msgid ""
@@ -4907,6 +5081,29 @@ msgid ""
 "    Returns success unless an invalid option is supplied or NAME does not\n"
 "    have a completion specification defined."
 msgstr ""
+"補完オプションを編集または表示します。\n"
+"    \n"
+"    各 NAME に対して補完オプションを変更します。NAME が与えられない場合、\n"
+"    補完が直ちに実行されます。もし OPTION が与えられない場合、各 NAME \n"
+"    または現在の補完に対する補完オプションを表示します。\n"
+"    \n"
+"    オプション:\n"
+"    \t-o option\t各 NAME に対して補完オプション OPTION を設定します\n"
+"    \t-D\t\t\"デフォルト\" コマンド補完オプションを変更します\n"
+"    \t-E\t\t\"空\" コマンド補完オプションを変更します\n"
+"    \n"
+"    `-o' の代わりに `+o' を使用すると指定したオプションをオフにします。\n"
+"    \n"
+"    引数:\n"
+"    \n"
+"    各 NAME は `complete' 組み込み関数を使って事前に定義された補完指定をコマ\n"
+"    ンドを指し示さなければなりません。NAME が与えられない場合、compopt は\n"
+"    補完をこれから生成する関数から呼び出されなければいけません。そして\n"
+"    補完をこれから生成する関数に対するオプションが変更されます。\n"
+"    \n"
+"    終了ステータス:\n"
+"    無効なオプションが与えられるか、 NAME が補完指定として定義されていない場合\n"
+"    を除き、成功を返します。"
 
 #: builtins.c:1968
 msgid ""
@@ -4939,6 +5136,32 @@ msgid ""
 "    Returns success unless an invalid option is given or ARRAY is readonly or\n"
 "    not an indexed array."
 msgstr ""
+"標準入力から行を読み込みインデックス型配列に代入します。\n"
+"    \n"
+"    標準入力、-u オプションが与えられた場合はファイル記述子 FD から行を読み込み、\n"
+"    インデックス型配列変数 ARRAY に代入します。変数 ARRAY のデフォルトは MAPFILE\n"
+"    です。\n"
+"    \n"
+"    オプション:\n"
+"      -n count\t最大 COUNT 行をコピーします。COUNT が 0 の場合、全ての行をコピーします。\n"
+"      -O origin\t配列の開始番号を ORIGIN にします。デフォルトは 0 です。\n"
+"      -s count \t最初の COUNT 行の読み込みを破棄します。\n"
+"      -t\t\t各行を読み込んだ時に最後の改行を削除します。\n"
+"      -u fd\t\t標準入力ではなくファイル記述子 FD から行を読み込みます\n"
+"      -C callback\tQUANTUM 行を読み込む毎に CALLBACK を評価します。\n"
+"      -c quantum\tCALLBACK を何行読み込む毎に実行するかを指定します。\n"
+"    \n"
+"    引数:\n"
+"      ARRAY\t\tデータを保存するために使用する配列変数名\n"
+"    \n"
+"    もし -c が指定されずに -C が与えられた場合、デフォルトの quantum は 5000 です。\n"
+"    CALLBACK が評価された時、追加の引数として配列の次要素のインデックスが渡されます。\n"
+"    \n"
+"    明示的に開始番号が与えられない場合、mapfile は代入前に ARRAY を空にします。\n"
+"    \n"
+"    終了ステータス:\n"
+"    無効なオプションが与えられる、配列が読み取り専用、またはインデックス型配列で無い\n"
+"    場合を除き成功を返します。"
 
 #: builtins.c:2001
 msgid ""
@@ -4946,6 +5169,9 @@ msgid ""
 "    \n"
 "    A synonym for `mapfile'."
 msgstr ""
+"ファイルから行を読み込み配列変数に代入します。\n"
+"    \n"
+"    `mapfile'の別名です。"
 
 #~ msgid "Missing `}'"
 #~ msgstr "`}'がありません"
diff --git a/subst.c b/subst.c
index e3dac4dc468cac2a1a30cdfab4a34e8fdaa7a93e..e642b4af7c385081892930808a0d2b44337adf79 100644 (file)
--- a/subst.c
+++ b/subst.c
@@ -4826,7 +4826,7 @@ process_substitute (string, open_for_read_in_child)
       reset_terminating_signals ();    /* XXX */
       free_pushed_string_input ();
       /* Cancel traps, in trap.c. */
-      restore_original_signals ();
+      restore_original_signals ();     /* XXX - what about special builtins? bash-4.2 */
       setup_async_signals ();
       subshell_environment |= SUBSHELL_COMSUB|SUBSHELL_PROCSUB;
     }
index 88c2077a4cb6927aae7fb58c59317f96f99a7d41..e642b4af7c385081892930808a0d2b44337adf79 100644 (file)
--- a/subst.c~
+++ b/subst.c~
@@ -4826,7 +4826,7 @@ process_substitute (string, open_for_read_in_child)
       reset_terminating_signals ();    /* XXX */
       free_pushed_string_input ();
       /* Cancel traps, in trap.c. */
-      restore_original_signals ();
+      restore_original_signals ();     /* XXX - what about special builtins? bash-4.2 */
       setup_async_signals ();
       subshell_environment |= SUBSHELL_COMSUB|SUBSHELL_PROCSUB;
     }
@@ -7059,7 +7059,6 @@ parameter_brace_expand (string, indexp, quoted, pflags, quoted_dollar_atp, conta
        {
          /* If the operator is `+', we don't want the value of the named
             variable for anything, just the value of the right hand side. */
-
          if (c == '+')
            {
              /* XXX -- if we're double-quoted and the named variable is "$@",
diff --git a/trap.c b/trap.c
index d0c932fc1f73dce3031bfd4c5feb6df646a0c9f6..7bf775982eb4c898931c2ab91765f18e0fbca108 100644 (file)
--- a/trap.c
+++ b/trap.c
@@ -952,7 +952,8 @@ free_trap_string (sig)
   sigmodes[sig] &= ~SIG_TRAPPED;
 }
 
-/* Reset the handler for SIG to the original value. */
+/* Reset the handler for SIG to the original value but leave the trap string
+   in place. */
 static void
 reset_signal (sig)
      int sig;
@@ -1017,7 +1018,8 @@ reset_or_restore_signal_handlers (reset)
 }
 
 /* Reset trapped signals to their original values, but don't free the
-   trap strings.  Called by the command substitution code. */
+   trap strings.  Called by the command substitution code and other places
+   that create a "subshell environment". */
 void
 reset_signal_handlers ()
 {
diff --git a/trap.c~ b/trap.c~
index 309bc622071c8d31631cffdb5ae6b76aa9c3ed4d..d0c932fc1f73dce3031bfd4c5feb6df646a0c9f6 100644 (file)
--- a/trap.c~
+++ b/trap.c~
@@ -1097,7 +1097,6 @@ void
 set_signal_ignored (sig)
      int sig;
 {
-itrace("set_signal_ignored: %d set to SIG_HARD_IGNORE", sig);
   sigmodes[sig] |= SIG_HARD_IGNORE;
   original_signals[sig] = SIG_IGN;
 }