42 |
i = mkstemp(temp_fn); |
i = mkstemp(temp_fn); |
43 |
if (i == -1 |
if (i == -1 |
44 |
|| fchmod(i, st.st_mode) == -1 |
|| fchmod(i, st.st_mode) == -1 |
|
|| !(out = fdopen(i, "w+")) |
|
45 |
) { |
) { |
46 |
bb_simple_perror_msg_and_die(temp_fn); |
bb_simple_perror_msg_and_die(temp_fn); |
47 |
} |
} |
48 |
|
out = xfdopen_for_write(i); |
49 |
} |
} |
50 |
|
|
51 |
while ((i = fgetc(in)) != EOF) { |
while ((i = fgetc(in)) != EOF) { |
69 |
} |
} |
70 |
|
|
71 |
int dos2unix_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
int dos2unix_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
72 |
int dos2unix_main(int argc, char **argv) |
int dos2unix_main(int argc UNUSED_PARAM, char **argv) |
73 |
{ |
{ |
74 |
int o, conv_type; |
int o, conv_type; |
75 |
|
|
88 |
if (o) |
if (o) |
89 |
conv_type = o; |
conv_type = o; |
90 |
|
|
91 |
|
argv += optind; |
92 |
do { |
do { |
93 |
/* might be convert(NULL) if there is no filename given */ |
/* might be convert(NULL) if there is no filename given */ |
94 |
convert(argv[optind], conv_type); |
convert(*argv, conv_type); |
95 |
optind++; |
} while (*++argv); |
|
} while (optind < argc); |
|
96 |
|
|
97 |
return 0; |
return 0; |
98 |
} |
} |