changeset 59:488085e0c7e1

Don't print extra newlines when cat'ing a file.
author Daniel O'Connor <darius@dons.net.au>
date Mon, 08 Apr 2013 23:10:47 +0930
parents 0e7d687a2322
children bbdf5642a7b7
files sd.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/sd.c	Mon Apr 08 23:10:25 2013 +0930
+++ b/sd.c	Mon Apr 08 23:10:47 2013 +0930
@@ -240,7 +240,7 @@
     } else if (!strcmp(argv[0], "cat")) {
 	FRESULT fserr;
 	FIL f;
-	char buf[128], *tmp;
+	char buf[128];
 	
 	if (argc != 2) {
 	    printf("No file given\n");
@@ -252,9 +252,8 @@
 	    return;
 	}
 	
-	while ((tmp = f_gets(buf, sizeof(buf), &f)) != NULL) {
-	    puts(tmp);
-	}
+	while (f_gets(buf, sizeof(buf), &f) != NULL)
+	    fputs(buf, stdout);
 
 	f_close(&f);