summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/shell
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-05-20 18:39:50 +1000
committerChris Johns <chrisj@rtems.org>2016-05-25 15:47:34 +1000
commit24d0ee57a4d95f99be6e7e60bd162a30daf0638d (patch)
tree94239c8cc6b21813ca44b6ca89da73f9038914cc /cpukit/libmisc/shell
parentpsxtests/psxmsgq01: Fix typo (diff)
downloadrtems-24d0ee57a4d95f99be6e7e60bd162a30daf0638d.tar.bz2
cpukit, testsuite: Add rtems_printf and rtems_printer support.
This change adds rtems_printf and related functions and wraps the RTEMS print plugin support into a user API. All references to the plugin are removed and replaced with the rtems_printer interface. Printk and related functions are made to return a valid number of characters formatted and output. The function attribute to check printf functions has been added to rtems_printf and printk. No changes to remove warrnings are part of this patch set. The testsuite has been moved over to the rtems_printer. The testsuite has a mix of rtems_printer access and direct print control via the tmacros.h header file. The support for begink/endk has been removed as it served no purpose and only confused the code base. The testsuite has not been refactored to use rtems_printf. This is future work.
Diffstat (limited to 'cpukit/libmisc/shell')
-rw-r--r--cpukit/libmisc/shell/main_blkstats.c7
-rw-r--r--cpukit/libmisc/shell/main_cpuuse.c4
-rw-r--r--cpukit/libmisc/shell/main_perioduse.c5
-rw-r--r--cpukit/libmisc/shell/main_profreport.c5
-rw-r--r--cpukit/libmisc/shell/main_stackuse.c7
-rw-r--r--cpukit/libmisc/shell/main_top.c4
6 files changed, 20 insertions, 12 deletions
diff --git a/cpukit/libmisc/shell/main_blkstats.c b/cpukit/libmisc/shell/main_blkstats.c
index 50d783d76c..d814df673c 100644
--- a/cpukit/libmisc/shell/main_blkstats.c
+++ b/cpukit/libmisc/shell/main_blkstats.c
@@ -31,6 +31,7 @@ static int rtems_shell_main_blkstats(int argc, char **argv)
bool ok = false;
bool reset = false;
const char *device;
+ rtems_printer printer;
if (argc == 2) {
ok = true;
@@ -41,10 +42,12 @@ static int rtems_shell_main_blkstats(int argc, char **argv)
device = argv [2];
}
+ rtems_print_printer_printf(&printer);
+
if (ok) {
- rtems_blkstats(stdout, device, reset);
+ rtems_blkstats(&printer, device, reset);
} else {
- fprintf(stdout, "usage: %s\n", rtems_shell_BLKSTATS_Command.usage);
+ rtems_printf(&printer, "usage: %s\n", rtems_shell_BLKSTATS_Command.usage);
}
return 0;
diff --git a/cpukit/libmisc/shell/main_cpuuse.c b/cpukit/libmisc/shell/main_cpuuse.c
index c1f991a390..190fd039ff 100644
--- a/cpukit/libmisc/shell/main_cpuuse.c
+++ b/cpukit/libmisc/shell/main_cpuuse.c
@@ -30,7 +30,9 @@ static int rtems_shell_main_cpuuse(
* When invoked with no arguments, print the report.
*/
if ( argc == 1 ) {
- rtems_cpu_usage_report_with_plugin(stdout, (rtems_printk_plugin_t)fprintf);
+ rtems_printer printer;
+ rtems_print_printer_fprintf(&printer, stdout);
+ rtems_cpu_usage_report_with_plugin(&printer);
return 0;
}
diff --git a/cpukit/libmisc/shell/main_perioduse.c b/cpukit/libmisc/shell/main_perioduse.c
index 9b33a75446..023e154cbc 100644
--- a/cpukit/libmisc/shell/main_perioduse.c
+++ b/cpukit/libmisc/shell/main_perioduse.c
@@ -29,9 +29,10 @@ static int rtems_shell_main_perioduse(
* When invoked with no arguments, print the report.
*/
if ( argc == 1 ) {
+ rtems_printer printer;
+ rtems_print_printer_printf(&printer);
rtems_rate_monotonic_report_statistics_with_plugin(
- stdout,
- (rtems_printk_plugin_t)fprintf
+ &printer
);
return 0;
}
diff --git a/cpukit/libmisc/shell/main_profreport.c b/cpukit/libmisc/shell/main_profreport.c
index d6e4c5a843..a98b8ba9aa 100644
--- a/cpukit/libmisc/shell/main_profreport.c
+++ b/cpukit/libmisc/shell/main_profreport.c
@@ -24,10 +24,11 @@
static int rtems_shell_main_profreport(int argc, char **argv)
{
+ rtems_printer printer;
+ rtems_print_printer_printf(&printer);
rtems_profiling_report_xml(
"Shell",
- (rtems_profiling_printf) fprintf,
- stdout,
+ &printer,
0,
" "
);
diff --git a/cpukit/libmisc/shell/main_stackuse.c b/cpukit/libmisc/shell/main_stackuse.c
index 74d47e16b0..40fc711f49 100644
--- a/cpukit/libmisc/shell/main_stackuse.c
+++ b/cpukit/libmisc/shell/main_stackuse.c
@@ -25,10 +25,9 @@ static int rtems_shell_main_stackuse(
char *argv[] RTEMS_UNUSED
)
{
- rtems_stack_checker_report_usage_with_plugin(
- stdout,
- (rtems_printk_plugin_t)fprintf
- );
+ rtems_printer printer;
+ rtems_print_printer_printf(&printer);
+ rtems_stack_checker_report_usage_with_plugin( &printer );
return 0;
}
diff --git a/cpukit/libmisc/shell/main_top.c b/cpukit/libmisc/shell/main_top.c
index ad6223a560..aea50d80fb 100644
--- a/cpukit/libmisc/shell/main_top.c
+++ b/cpukit/libmisc/shell/main_top.c
@@ -30,7 +30,9 @@ static int rtems_shell_main_top(
* When invoked with no arguments, print the report.
*/
if ( argc == 1 ) {
- rtems_cpu_usage_top_with_plugin(stdout, (rtems_printk_plugin_t)fprintf);
+ rtems_printer printer;
+ rtems_print_printer_fprintf(&printer, stdout);
+ rtems_cpu_usage_top_with_plugin(&printer);
return 0;
}