2 * printenv -- minimal builtin clone of BSD printenv(1).
4 * usage: printenv [varname]
13 #include "bashgetopt.h"
15 extern char **export_env
;
18 printenv_builtin (list
)
25 reset_internal_getopt ();
26 while ((opt
= internal_getopt (list
, "")) != -1)
40 maybe_make_export_env (); /* this allows minimal code */
41 for (envp
= export_env
; *envp
; envp
++)
42 printf ("%s\n", *envp
);
43 return (EXECUTION_SUCCESS
);
46 /* printenv varname */
47 var
= find_variable (list
->word
->word
);
48 if (var
== 0 || (exported_p (var
) == 0))
49 return (EXECUTION_FAILURE
);
52 print_var_function (var
);
54 print_var_value (var
, 0);
56 return (EXECUTION_SUCCESS
);
59 char *printenv_doc
[] = {
60 "print values of environment variables",
64 struct builtin printenv_struct
= {