@@ -24,13 +24,13 @@ use nix::sys::signal::{SigHandler::SigIgn, Signal, signal};
2424use std:: borrow:: Cow ;
2525use std:: env;
2626use std:: ffi:: { OsStr , OsString } ;
27- use std:: io:: { self , Write } ;
27+ use std:: io;
2828#[ cfg( unix) ]
2929use std:: os:: unix:: ffi:: OsStrExt ;
3030#[ cfg( unix) ]
3131use std:: os:: unix:: process:: CommandExt ;
3232
33- use uucore:: display:: { OsWrite , Quotable } ;
33+ use uucore:: display:: { Quotable , print_all_env_vars } ;
3434use uucore:: error:: { ExitCode , UError , UResult , USimpleError , UUsageError } ;
3535use uucore:: line_ending:: LineEnding ;
3636#[ cfg( unix) ]
@@ -99,19 +99,6 @@ struct Options<'a> {
9999 ignore_signal : Vec < usize > ,
100100}
101101
102- /// print `name=value` env pairs on screen
103- fn print_env ( line_ending : LineEnding ) -> io:: Result < ( ) > {
104- let stdout_raw = io:: stdout ( ) ;
105- let mut stdout = stdout_raw. lock ( ) ;
106- for ( n, v) in env:: vars_os ( ) {
107- stdout. write_all_os ( & n) ?;
108- stdout. write_all ( b"=" ) ?;
109- stdout. write_all_os ( & v) ?;
110- write ! ( stdout, "{line_ending}" ) ?;
111- }
112- Ok ( ( ) )
113- }
114-
115102fn parse_name_value_opt < ' a > ( opts : & mut Options < ' a > , opt : & ' a OsStr ) -> UResult < bool > {
116103 // is it a NAME=VALUE like opt ?
117104 let wrap = NativeStr :: < ' a > :: new ( opt) ;
@@ -552,7 +539,7 @@ impl EnvAppData {
552539
553540 if opts. program . is_empty ( ) {
554541 // no program provided, so just dump all env vars to stdout
555- print_env ( opts. line_ending ) ?;
542+ print_all_env_vars ( opts. line_ending ) ?;
556543 } else {
557544 return self . run_program ( & opts, self . do_debug_printing ) ;
558545 }
0 commit comments