Mercurial > ~darius > hgwebdir.cgi > stm32temp
diff sd.c @ 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 | f0563086040d |
children | fc21fb5b171b |
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);