Skip to content

Commit a1eceb4

Browse files
authored
Merge pull request #381 from fox0/noenv
Remove compile-time macro env!
2 parents 8a7cbe4 + 4ea3433 commit a1eceb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+191
-193
lines changed

.cargo/config.toml

-2
This file was deleted.

awk/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ fn exit_if_error<T, U: Display>(r: Result<T, U>) -> T {
5656

5757
fn main() -> Result<(), Box<dyn Error>> {
5858
setlocale(LocaleCategory::LcAll, "");
59-
textdomain(env!("PROJECT_NAME"))?;
60-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
59+
textdomain("posixutils-rs")?;
60+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
6161

6262
let args = Args::parse();
6363

calc/bc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ fn print_output_or_error(result: ExecutionResult<String>) {
4444

4545
fn main() -> Result<()> {
4646
setlocale(LocaleCategory::LcAll, "");
47-
textdomain(env!("PROJECT_NAME"))?;
48-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
47+
textdomain("posixutils-rs")?;
48+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
4949

5050
let args = Args::parse();
5151

calc/expr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ fn eval_expression(tokens: &[Token]) -> Result<Token, &'static str> {
370370

371371
fn main() -> Result<(), Box<dyn std::error::Error>> {
372372
setlocale(LocaleCategory::LcAll, "");
373-
textdomain(env!("PROJECT_NAME"))?;
374-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
373+
textdomain("posixutils-rs")?;
374+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
375375

376376
// tokenize and evaluate the expression
377377
let arg_tokens = tokenize();

datetime/cal.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ fn print_year(year: u32) {
9494

9595
fn main() -> Result<(), Box<dyn std::error::Error>> {
9696
setlocale(LocaleCategory::LcAll, "");
97-
textdomain(env!("PROJECT_NAME"))?;
98-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
97+
textdomain("posixutils-rs")?;
98+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
9999

100100
let mut args = Args::parse();
101101

datetime/date.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ fn set_time(utc: bool, timestr: &str) -> Result<(), &'static str> {
146146

147147
fn main() -> Result<(), Box<dyn std::error::Error>> {
148148
setlocale(LocaleCategory::LcAll, "");
149-
textdomain(env!("PROJECT_NAME"))?;
150-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
149+
textdomain("posixutils-rs")?;
150+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
151151

152152
let args = Args::parse();
153153

datetime/sleep.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ struct Args {
2323

2424
fn main() -> Result<(), Box<dyn std::error::Error>> {
2525
setlocale(LocaleCategory::LcAll, "");
26-
textdomain(env!("PROJECT_NAME"))?;
27-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
26+
textdomain("posixutils-rs")?;
27+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
2828

2929
let args = Args::parse();
3030

datetime/time.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ impl Status {
132132

133133
fn main() -> Result<(), Box<dyn std::error::Error>> {
134134
setlocale(LocaleCategory::LcAll, "");
135-
textdomain(env!("PROJECT_NAME"))?;
136-
bindtextdomain(env!("PROJECT_NAME"), "locale")?;
137-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
135+
textdomain("posixutils-rs")?;
136+
bindtextdomain("posixutils-rs", "locale")?;
137+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
138138

139139
let args = Args::parse();
140140

dev/nm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ fn show_object_file(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
143143

144144
fn main() -> Result<(), Box<dyn std::error::Error>> {
145145
setlocale(LocaleCategory::LcAll, "");
146-
textdomain(env!("PROJECT_NAME"))?;
147-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
146+
textdomain("posixutils-rs")?;
147+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
148148

149149
let args = Args::parse();
150150

dev/strings.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ where
187187

188188
fn main() -> StringsResult {
189189
setlocale(LocaleCategory::LcAll, "");
190-
textdomain(env!("PROJECT_NAME"))?;
191-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
190+
textdomain("posixutils-rs")?;
191+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
192192

193193
let args = Args::parse();
194194

dev/strip.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ fn strip_file(file: &OsStr) {
143143

144144
fn main() -> Result<(), Box<dyn std::error::Error>> {
145145
setlocale(LocaleCategory::LcAll, "");
146-
textdomain(env!("PROJECT_NAME"))?;
147-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
146+
textdomain("posixutils-rs")?;
147+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
148148

149149
let args = Args::parse();
150150

display/echo.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ fn translate_str(skip_nl: bool, s: &str) -> String {
7272

7373
fn main() -> Result<(), Box<dyn std::error::Error>> {
7474
setlocale(LocaleCategory::LcAll, "");
75-
textdomain(env!("PROJECT_NAME"))?;
76-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
75+
textdomain("posixutils-rs")?;
76+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
7777

7878
let mut args: Vec<String> = std::env::args().collect();
7979
args.remove(0);

display/printf.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,10 @@ fn main() -> ExitCode {
492492
setlocale(LocaleCategory::LcAll, "");
493493
// TODO
494494
// unwrap
495-
textdomain(env!("PROJECT_NAME")).unwrap();
495+
textdomain("posixutils-rs").unwrap();
496496
// TODO
497497
// unwrap
498-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8").unwrap();
498+
bind_textdomain_codeset("posixutils-rs", "UTF-8").unwrap();
499499

500500
let args = std::env::args_os().collect::<Vec<_>>();
501501

file/cat.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ fn cat_file(pathname: &PathBuf) -> io::Result<()> {
5353

5454
fn main() -> Result<(), Box<dyn std::error::Error>> {
5555
setlocale(LocaleCategory::LcAll, "");
56-
textdomain(env!("PROJECT_NAME"))?;
57-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
56+
textdomain("posixutils-rs")?;
57+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
5858

5959
let mut args = Args::parse();
6060

file/cmp.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ fn cmp_main(args: &Args) -> io::Result<u8> {
137137

138138
fn main() -> ExitCode {
139139
setlocale(LocaleCategory::LcAll, "");
140-
textdomain(env!("PROJECT_NAME")).unwrap();
141-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8").unwrap();
140+
textdomain("posixutils-rs").unwrap();
141+
bind_textdomain_codeset("posixutils-rs", "UTF-8").unwrap();
142142

143143
let args = Args::parse();
144144

file/dd.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@ fn parse_cmdline(args: &[String]) -> Result<Config, Box<dyn std::error::Error>>
383383

384384
fn main() -> Result<(), Box<dyn std::error::Error>> {
385385
setlocale(LocaleCategory::LcAll, "");
386-
textdomain(env!("PROJECT_NAME"))?;
387-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
386+
textdomain("posixutils-rs")?;
387+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
388388

389389
let args: Vec<String> = std::env::args().skip(1).collect();
390390
let config = parse_cmdline(&args)?;

file/file.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ fn analyze_file(mut path: String, args: &Args, magic_files: &Vec<PathBuf>) {
191191

192192
fn main() -> Result<(), Box<dyn std::error::Error>> {
193193
setlocale(LocaleCategory::LcAll, "");
194-
textdomain(env!("PROJECT_NAME"))?;
195-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
194+
textdomain("posixutils-rs")?;
195+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
196196

197197
let args = Args::parse();
198198

file/find.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ fn find(args: Vec<String>) -> Result<(), String> {
485485

486486
fn main() -> Result<(), Box<dyn std::error::Error>> {
487487
setlocale(LocaleCategory::LcAll, "");
488-
textdomain(env!("PROJECT_NAME"))?;
489-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
488+
textdomain("posixutils-rs")?;
489+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
490490

491491
let args: Vec<String> = env::args().collect();
492492

file/od.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1139,8 +1139,8 @@ fn od(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
11391139

11401140
fn main() -> Result<(), Box<dyn std::error::Error>> {
11411141
setlocale(LocaleCategory::LcAll, "");
1142-
textdomain(env!("PROJECT_NAME"))?;
1143-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
1142+
textdomain("posixutils-rs")?;
1143+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
11441144

11451145
let mut args = Args::parse();
11461146

file/split.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ fn split_by_lines(args: &Args, linesplit: u64) -> io::Result<()> {
261261

262262
fn main() -> Result<(), Box<dyn std::error::Error>> {
263263
setlocale(LocaleCategory::LcAll, "");
264-
textdomain(env!("PROJECT_NAME"))?;
265-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
264+
textdomain("posixutils-rs")?;
265+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
266266

267267
let mut args = Args::parse();
268268

file/tee.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ fn tee_stdin(info: &mut TeeInfo) -> io::Result<()> {
9494

9595
fn main() -> Result<(), Box<dyn std::error::Error>> {
9696
setlocale(LocaleCategory::LcAll, "");
97-
textdomain(env!("PROJECT_NAME"))?;
98-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
97+
textdomain("posixutils-rs")?;
98+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
9999

100100
let args = Args::parse();
101101

fs/df.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ fn mask_fs_by_file(info: &mut MountList, filename: &str) -> io::Result<()> {
364364

365365
fn main() -> Result<(), Box<dyn std::error::Error>> {
366366
setlocale(LocaleCategory::LcAll, "");
367-
textdomain(env!("PROJECT_NAME"))?;
368-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
367+
textdomain("posixutils-rs")?;
368+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
369369

370370
let args = Args::parse();
371371

i18n/gencat.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -775,8 +775,8 @@ impl MessageCatalog {
775775

776776
fn main() -> Result<(), Box<dyn std::error::Error>> {
777777
setlocale(LocaleCategory::LcAll, "");
778-
textdomain(env!("PROJECT_NAME"))?;
779-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
778+
textdomain("posixutils-rs")?;
779+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
780780

781781
let args = Args::parse();
782782

i18n/iconv.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ fn charmap_conversion(
481481

482482
fn main() -> Result<(), Box<dyn std::error::Error>> {
483483
setlocale(LocaleCategory::LcAll, "");
484-
textdomain(env!("PROJECT_NAME"))?;
485-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
484+
textdomain("posixutils-rs")?;
485+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
486486

487487
let args = Args::parse();
488488

make/src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ fn read_stdin() -> Result<String, ErrorCode> {
161161

162162
fn main() -> Result<(), Box<dyn std::error::Error>> {
163163
setlocale(LocaleCategory::LcAll, "");
164-
textdomain(env!("PROJECT_NAME"))?;
165-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
164+
textdomain("posixutils-rs")?;
165+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
166166

167167
let Args {
168168
directory,

misc/test.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ fn eval_binary(s1: &str, op_str: &str, s2: &str) -> bool {
279279

280280
fn main() -> Result<(), Box<dyn std::error::Error>> {
281281
setlocale(LocaleCategory::LcAll, "");
282-
textdomain(env!("PROJECT_NAME"))?;
283-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
282+
textdomain("posixutils-rs")?;
283+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
284284

285285
let mut args: Vec<String> = std::env::args().collect();
286286

pathnames/basename.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ fn show_basename(args: &Args) {
5353

5454
fn main() -> Result<(), Box<dyn std::error::Error>> {
5555
setlocale(LocaleCategory::LcAll, "");
56-
textdomain(env!("PROJECT_NAME"))?;
57-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
56+
textdomain("posixutils-rs")?;
57+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
5858

5959
let args = Args::parse();
6060

pathnames/dirname.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ fn show_dirname(args: &Args) {
4141

4242
fn main() -> Result<(), Box<dyn std::error::Error>> {
4343
setlocale(LocaleCategory::LcAll, "");
44-
textdomain(env!("PROJECT_NAME"))?;
45-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
44+
textdomain("posixutils-rs")?;
45+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
4646

4747
let args = Args::parse();
4848

pathnames/pathchk.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ fn check_path(args: &Args, pathname: &str) -> Result<(), &'static str> {
143143

144144
fn main() -> Result<(), Box<dyn std::error::Error>> {
145145
setlocale(LocaleCategory::LcAll, "");
146-
textdomain(env!("PROJECT_NAME"))?;
147-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
146+
textdomain("posixutils-rs")?;
147+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
148148

149149
let args = Args::parse();
150150

pathnames/realpath.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ fn normalize<P: AsRef<Path>>(path: P) -> std::io::Result<PathBuf> {
6464

6565
fn main() -> Result<(), Box<dyn std::error::Error>> {
6666
setlocale(LocaleCategory::LcAll, "");
67-
textdomain(env!("PROJECT_NAME"))?;
68-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
67+
textdomain("posixutils-rs")?;
68+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
6969

7070
let args = Args::parse();
7171

process/env.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ fn exec_util(envs: HashMap<String, String>, util_args: Vec<String>) -> io::Resul
9393

9494
fn main() -> Result<(), Box<dyn std::error::Error>> {
9595
setlocale(LocaleCategory::LcAll, "");
96-
textdomain(env!("PROJECT_NAME"))?;
97-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
96+
textdomain("posixutils-rs")?;
97+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
9898

9999
let args = Args::parse();
100100

process/fuser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1483,8 +1483,8 @@ fn timeout(path: &str, seconds: u32) -> Result<Metadata, io::Error> {
14831483

14841484
fn main() -> Result<(), Box<dyn std::error::Error>> {
14851485
setlocale(LocaleCategory::LcAll, "");
1486-
textdomain(env!("PROJECT_NAME"))?;
1487-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
1486+
textdomain("posixutils-rs")?;
1487+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
14881488

14891489
let Args {
14901490
mount, user, file, ..

process/kill.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ fn send_signal(prog_cfg: &Config, sig_no: i32) -> u32 {
8585

8686
fn main() -> Result<(), Box<dyn std::error::Error>> {
8787
setlocale(LocaleCategory::LcAll, "");
88-
textdomain(env!("PROJECT_NAME"))?;
89-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
88+
textdomain("posixutils-rs")?;
89+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
9090

9191
let prog_cfg = parse_cmdline()?;
9292

process/nice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ fn exec_util(util: &str, util_args: Vec<String>) -> io::Result<()> {
5252

5353
fn main() -> Result<(), Box<dyn std::error::Error>> {
5454
setlocale(LocaleCategory::LcAll, "");
55-
textdomain(env!("PROJECT_NAME"))?;
56-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
55+
textdomain("posixutils-rs")?;
56+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
5757

5858
let args = Args::parse();
5959

process/nohup.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ fn get_nohup_out_file() -> Result<(File, NohupDir), io::Error> {
5151

5252
fn main() -> Result<(), Box<dyn std::error::Error>> {
5353
setlocale(LocaleCategory::LcAll, "");
54-
textdomain(env!("PROJECT_NAME"))?;
55-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
54+
textdomain("posixutils-rs")?;
55+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
5656

5757
unsafe {
5858
// Ignore the SIGHUP signal

process/renice.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ fn parse_id(which: u32, input: &str) -> Result<u32, &'static str> {
102102

103103
fn main() -> Result<(), Box<dyn std::error::Error>> {
104104
setlocale(LocaleCategory::LcAll, "");
105-
textdomain(env!("PROJECT_NAME"))?;
106-
bind_textdomain_codeset(env!("PROJECT_NAME"), "UTF-8")?;
105+
textdomain("posixutils-rs")?;
106+
bind_textdomain_codeset("posixutils-rs", "UTF-8")?;
107107

108108
let args = Args::parse();
109109

0 commit comments

Comments
 (0)