Hi,

patch attached.

Regards,
-- 
Pere
From dccfae45a5d3f38c40bd8741dbd40b0fc6ef59ce Mon Sep 17 00:00:00 2001
From: Pere Orga <[email protected]>
Date: Wed, 1 Feb 2012 15:25:15 +0100
Subject: [PATCH] applets_sh/: dos2unix, unix2dos, tac wrappers from toybox


Signed-off-by: Pere Orga <[email protected]>
---
 applets_sh/dos2unix |    5 +++++
 applets_sh/tac      |    7 +++++++
 applets_sh/unix2dos |    5 +++++
 3 files changed, 17 insertions(+), 0 deletions(-)
 create mode 100755 applets_sh/dos2unix
 create mode 100755 applets_sh/tac
 create mode 100755 applets_sh/unix2dos

diff --git a/applets_sh/dos2unix b/applets_sh/dos2unix
new file mode 100755
index 0000000..9eab664
--- /dev/null
+++ b/applets_sh/dos2unix
@@ -0,0 +1,5 @@
+#!/bin/sh
+#HELP usage: dos2unix [FILE...]\n\nRemove DOS newlines
+
+[ $# -ne 0 ] && DASH_I=-i
+sed $DASH_I -e 's/\r$//' "$@"
diff --git a/applets_sh/tac b/applets_sh/tac
new file mode 100755
index 0000000..6253b70
--- /dev/null
+++ b/applets_sh/tac
@@ -0,0 +1,7 @@
+#!/bin/sh
+# HELP usage: tac [FILE...]\n\nPrint input lines in reverse order
+
+for i in "$@"
+do
+  sed -e '1!G;h;$!d' "$i"
+done
diff --git a/applets_sh/unix2dos b/applets_sh/unix2dos
new file mode 100755
index 0000000..68c1859
--- /dev/null
+++ b/applets_sh/unix2dos
@@ -0,0 +1,5 @@
+#!/bin/sh
+#HELP usage: unix2dos [FILE...]\n\nAdd DOS newlines
+
+[ $# -ne 0 ] && DASH_I=-i
+sed $DASH_I -e 's/$/\r/' "$@"
-- 
1.7.8.3

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to