summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-09-03 09:59:37 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-09-04 09:08:05 -0500
commit06ac8b7122cc2b7c660cb34beb82414630b8a306 (patch)
treed36c39da29fb7a32831b103115ad2cb98c8ba3b9
parentrtems-rfs-buffer.c: Correct printf() format specifiers to eliminate warnings (diff)
downloadrtems-06ac8b7122cc2b7c660cb34beb82414630b8a306.tar.bz2
shell.c: Add cast to match printf() expectations for width specifier
-rw-r--r--cpukit/libmisc/shell/shell.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index a94724f95a..eeb60dc285 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -306,7 +306,12 @@ static int rtems_shell_line_editor(
case 7: /* Control-G */
if (output) {
- fprintf(out,"\r%s%*c", prompt, strlen (line), ' ');
+ /*
+ * The (int) cast is needed because the width specifier (%*)
+ * must be an int, but strlen() returns a size_t. Without
+ * the case, the result is a printf() format warning.
+ */
+ fprintf(out,"\r%s%*c", prompt, (int) strlen (line), ' ');
fprintf(out,"\r%s\x7", prompt);
}
memset (line, '\0', strlen(line));