diff --git a/dos2unix.c b/dos2unix.c
index 222c8f6..7f1c561 100644
--- a/dos2unix.c
+++ b/dos2unix.c
@@ -1,46 +1,152 @@
 /*
-    Mini dos2unix implementation for busybox
- 
-    Copyright 1994,1995  Patrick Volkerding, Moorhead, Minnesota USA
-    All rights reserved.
-
- Redistribution and use of this source code, with or without modification, is
- permitted provided that the following condition is met:
-
- 1. Redistributions of this source code must retain the above copyright
-    notice, this condition, and the following disclaimer.
-
-  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
-  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
+ * dos2unix for BusyBox
+ *
+ * dos2unix '\n' convertor 0.5.0
+ *   based on Unix2Dos 0.9.0 by Peter Hanecak (made 19.2.1997)
+ * Copyright 1997,.. by Peter Hanecak <hanecak@megaloman.sk>.
+ * All rights reserved.
+ *
+ * dos2unix filters reading input from stdin and writing output to stdout.
+ * Without arguments it reverts the format (e.i. if source is in UNIX format,
+ * output is in DOS format and vice versa).
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * See the COPYING file for license information.
+ */
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <getopt.h>
 #include "busybox.h"
 
-int dos2unix_main( int argc, char **argv ) {
- 	int c;
-	if (argc > 1) {
-	        c = *argv[1];
-		if (c == '-') {
-                show_usage();
-		} 
+#define CT_AUTO	0
+#define CT_UNIX2DOS	1
+#define CT_DOS2UNIX	2
+
+int convert(char *fn, int ConvType);
+
+int dos2unix_main(int argc, char *argv[]) {
+	int ConvType = CT_AUTO;
+	int o;
+
+	// process parameters
+	while ((o = getopt(argc, argv, "du")) != EOF) {
+		switch (o) {
+		case 'd':
+			ConvType = CT_UNIX2DOS;
+			break;
+		case 'u':
+			ConvType = CT_DOS2UNIX;
+			break;
+		default:
+			show_usage();
+		}
 	}
-	c = getchar();
-	while (c != EOF) {
-		/* Eat any \r's... they shouldn't be here */
-		while (c == '\r') c = getchar();
-		if (c == EOF) break;
-                putchar(c);
-                c = getchar();
-	} 
-	return EXIT_SUCCESS;
+
+	if (optind < argc) {
+		while(optind < argc)
+			if ((o = convert(argv[optind++], ConvType)) < 0)
+				break;
+	}
+	else
+		o = convert(NULL, ConvType);
+
+	return o;
+}
+
+// if fn is NULL then input is stdin and output is stdout
+int convert(char *fn, int ConvType) {
+	char c;
+	char *tempFn = NULL;
+	FILE *in = stdin, *out = stdout;
+
+	if (fn != NULL) {
+		if ((in = fopen(fn, "r")) == NULL) {
+			perror_msg(fn);
+			return -1;
+		}
+		tempFn = tmpnam(NULL);
+		if (tempFn == NULL || (out = fopen(tempFn, "w")) == NULL) {
+			perror_msg(NULL);
+			return -2;
+		}
+	}
+
+	while ((c = fgetc(in)) != EOF) {
+		if (c == '\r') {
+			if ((ConvType == CT_UNIX2DOS) && (fn != NULL)) {
+				// file is alredy in DOS format so it is not necessery to touch it
+				if (fclose(in) < 0 || fclose(out) < 0 || remove(tempFn) < 0) {
+					perror_msg(NULL);
+					return -2;
+				}
+				return 0;
+			}
+			if (!ConvType)
+				ConvType = CT_DOS2UNIX;
+			break;
+		}
+		if (c == '\n') {
+			if ((ConvType == CT_DOS2UNIX) && (fn != NULL)) {
+				// file is alredy in UNIX format so it is not necessery to touch it
+				if (fclose(in) < 0 || fclose(out) < 0 || remove(tempFn) < 0) {
+					perror_msg(NULL);
+					return -2;
+				}
+				return 0;
+			}
+			if (!ConvType)
+				ConvType = CT_UNIX2DOS;
+			if (ConvType == CT_UNIX2DOS)
+				fputc('\r', out);
+			fputc('\n', out);
+			break;
+		}
+		fputc(c, out);
+	}
+	if (c != EOF)
+		while ((c = fgetc(in)) != EOF) {
+			if (c == '\r')
+				continue;
+			if (c == '\n') {
+				if (ConvType == CT_UNIX2DOS)
+					fputc('\r', out);
+				fputc('\n', out);
+				continue;
+			}
+		fputc(c, out);
+	}
+
+	if (fn != NULL) {
+	    if (fclose(in) < 0 || fclose(out) < 0 || 
+		    (in = fopen(tempFn, "r")) == NULL || (out = fopen(fn, "w")) == NULL) {
+		perror_msg(NULL);
+		return -2;
+	    }
+
+	    while ((c = fgetc(in)) != EOF)
+		fputc(c, out);
+
+	    if (fclose(in) < 0 || fclose(out) < 0 || remove(tempFn) < 0) {
+		perror_msg(NULL);
+		return -2;
+	    }
+	}
+
+	return 0;
 }
