Imported from ../bash-2.02.tar.gz.
[platform/upstream/bash.git] / builtins / declare.def
index ae49b66..3bdca64 100644 (file)
@@ -57,6 +57,9 @@ $END
 #include <config.h>
 
 #if defined (HAVE_UNISTD_H)
+#  ifdef _MINIX
+#    include <sys/types.h>
+#  endif
 #  include <unistd.h>
 #endif
 
@@ -377,6 +380,18 @@ declare_internal (list, local_var)
              FREE (var->value);
              var->value = t;
            }
+
+         /* 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. */
+         if ((flags_on & (att_exported|att_readonly)) && tempvar_p (var))
+           {
+             SHELL_VAR *tv;
+             tv = bind_variable (var->name, var->value ? var->value : "");
+             tv->attributes = var->attributes & ~att_tempvar;
+             dispose_variable (var);
+           }
        }
 
       stupidly_hack_special_variables (name);