aboutsummaryrefslogtreecommitdiff
path: root/coreutils/dos2unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/dos2unix.c')
-rw-r--r--coreutils/dos2unix.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c
index ccb74a113..6d2347163 100644
--- a/coreutils/dos2unix.c
+++ b/coreutils/dos2unix.c
@@ -10,7 +10,26 @@
10 * dos2unix filters reading input from stdin and writing output to stdout. 10 * dos2unix filters reading input from stdin and writing output to stdout.
11 * 11 *
12 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 12 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
13*/ 13 */
14//config:config DOS2UNIX
15//config: bool "dos2unix"
16//config: default y
17//config: help
18//config: dos2unix is used to convert a text file from DOS format to
19//config: UNIX format, and vice versa.
20//config:
21//config:config UNIX2DOS
22//config: bool "unix2dos"
23//config: default y
24//config: help
25//config: unix2dos is used to convert a text file from UNIX format to
26//config: DOS format, and vice versa.
27
28//applet:IF_DOS2UNIX(APPLET_NOEXEC(dos2unix, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, dos2unix))
29//applet:IF_UNIX2DOS(APPLET_NOEXEC(unix2dos, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, unix2dos))
30
31//kbuild:lib-$(CONFIG_DOS2UNIX) += dos2unix.o
32//kbuild:lib-$(CONFIG_UNIX2DOS) += dos2unix.o
14 33
15//usage:#define dos2unix_trivial_usage 34//usage:#define dos2unix_trivial_usage
16//usage: "[-ud] [FILE]" 35//usage: "[-ud] [FILE]"
@@ -92,9 +111,12 @@ int dos2unix_main(int argc UNUSED_PARAM, char **argv)
92 int o, conv_type; 111 int o, conv_type;
93 112
94 /* See if we are supposed to be doing dos2unix or unix2dos */ 113 /* See if we are supposed to be doing dos2unix or unix2dos */
95 conv_type = CT_UNIX2DOS; 114 if (ENABLE_DOS2UNIX
96 if (applet_name[0] == 'd') { 115 && (!ENABLE_UNIX2DOS || applet_name[0] == 'd')
116 ) {
97 conv_type = CT_DOS2UNIX; 117 conv_type = CT_DOS2UNIX;
118 } else {
119 conv_type = CT_UNIX2DOS;
98 } 120 }
99 121
100 /* -u convert to unix, -d convert to dos */ 122 /* -u convert to unix, -d convert to dos */