From 7b2a8252bd5401c3e02c290b7c54217a8780f48a Mon Sep 17 00:00:00 2001 From: Marc Kleine-Budde Date: Fri, 16 Nov 2007 16:23:32 +0100 Subject: [cat] use define for buffer size not hardcoded value With this patch a define is used for the buffer size not a hardcoded value in two places in the node. Signed-off-by: Marc Kleine-Budde --- commands/cat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/cat.c b/commands/cat.c index 6596612e95..0840fdfeae 100644 --- a/commands/cat.c +++ b/commands/cat.c @@ -32,6 +32,8 @@ #include #include +#define BUFSIZE 1024 + /** * @param[in] cmdtp FIXME * @param[in] argc Argument count from command line @@ -50,7 +52,7 @@ static int do_cat(cmd_tbl_t *cmdtp, int argc, char *argv[]) return 1; } - buf = xmalloc(1024); + buf = xmalloc(BUFSIZE); while (args < argc) { fd = open(argv[args], O_RDONLY); @@ -59,7 +61,7 @@ static int do_cat(cmd_tbl_t *cmdtp, int argc, char *argv[]) goto out; } - while((ret = read(fd, buf, 1024)) > 0) { + while((ret = read(fd, buf, BUFSIZE)) > 0) { for(i = 0; i < ret; i++) { if (isprint(buf[i]) || buf[i] == '\n' || buf[i] == '\t') putchar(buf[i]); -- cgit v1.2.3