[PATCH 23/27] console: Remove dputc()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The only use of dputc() is commands/echo.c and the code there can
easily be converted to dputs(). Do that and drop dputc() to avoid
duplicating fd selection logic already found in dputs().

Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 commands/echo.c         |  4 ++--
 common/console_common.c | 15 +--------------
 include/stdio.h         |  1 -
 3 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/commands/echo.c b/commands/echo.c
index 8853ee0a3..233f804a2 100644
--- a/commands/echo.c
+++ b/commands/echo.c
@@ -81,7 +81,7 @@ exit_parse:
 
 	for (i = optind; i < argc; i++) {
 		if (i > optind)
-			dputc(fd, ' ');
+			dputs(fd, " ");
 		if (process_escape) {
 			process_escape_sequence(argv[i], str, CONFIG_CBSIZE);
 			dputs(fd, str);
@@ -91,7 +91,7 @@ exit_parse:
 	}
 
 	if (newline)
-		dputc(fd, '\n');
+		dputs(fd, "\n");
 
 	if (file)
 		close(fd);
diff --git a/common/console_common.c b/common/console_common.c
index 296b181d9..ce7e50dbc 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -362,17 +362,4 @@ int dputs(int fd, const char *s)
 	else
 		return write(fd, s, strlen(s));
 }
-EXPORT_SYMBOL(dputs);
-
-int dputc(int fd, char c)
-{
-	if (fd == 1)
-		putchar(c);
-	else if (fd == 2)
-		console_putc(CONSOLE_STDERR, c);
-	else
-		return write(fd, &c, 1);
-
-	return 0;
-}
-EXPORT_SYMBOL(dputc);
+EXPORT_SYMBOL(dputs);
\ No newline at end of file
diff --git a/include/stdio.h b/include/stdio.h
index d918f3682..3b80b4bd7 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -95,6 +95,5 @@ static inline void putchar(char c)
 
 int dprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3)));
 int dputs(int file, const char *s);
-int dputc(int file, const char c);
 
 #endif /* __STDIO_H */
-- 
2.17.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux