2004-04-17 Ralf Corsepius <ralf_corsepius@rtems.org>

* libmisc/capture/capture-cli.c, libmisc/cpuuse/cpuuse.c,
	libmisc/dumpbuf/dumpbuf.c, libmisc/fsmount/fsmount.c,
	libmisc/monitor/mon-command.c, libmisc/monitor/mon-config.c,
	libmisc/monitor/mon-dname.c, libmisc/monitor/mon-driver.c,
	libmisc/monitor/mon-extension.c, libmisc/monitor/mon-itask.c,
	libmisc/monitor/mon-monitor.c, libmisc/monitor/mon-mpci.c,
	libmisc/monitor/mon-object.c, libmisc/monitor/mon-prmisc.c,
	libmisc/monitor/mon-queue.c, libmisc/monitor/mon-symbols.c,
	libmisc/monitor/mon-task.c, libmisc/rtmonuse/rtmonuse.c,
	libmisc/shell/cmds.c, libmisc/shell/shell.c, libmisc/shell/shell.h,
	libmisc/stackchk/check.c, libmisc/untar/untar.c: Use
	fprintf(stdout,...) instead of printf.
This commit is contained in:
Ralf Corsepius
2004-04-17 08:12:02 +00:00
parent 0fdc099473
commit 714f06c7fa
24 changed files with 301 additions and 286 deletions

View File

@@ -1,3 +1,18 @@
2004-04-17 Ralf Corsepius <ralf_corsepius@rtems.org>
* libmisc/capture/capture-cli.c, libmisc/cpuuse/cpuuse.c,
libmisc/dumpbuf/dumpbuf.c, libmisc/fsmount/fsmount.c,
libmisc/monitor/mon-command.c, libmisc/monitor/mon-config.c,
libmisc/monitor/mon-dname.c, libmisc/monitor/mon-driver.c,
libmisc/monitor/mon-extension.c, libmisc/monitor/mon-itask.c,
libmisc/monitor/mon-monitor.c, libmisc/monitor/mon-mpci.c,
libmisc/monitor/mon-object.c, libmisc/monitor/mon-prmisc.c,
libmisc/monitor/mon-queue.c, libmisc/monitor/mon-symbols.c,
libmisc/monitor/mon-task.c, libmisc/rtmonuse/rtmonuse.c,
libmisc/shell/cmds.c, libmisc/shell/shell.c, libmisc/shell/shell.h,
libmisc/stackchk/check.c, libmisc/untar/untar.c: Use
fprintf(stdout,...) instead of printf.
2004-04-14 Ralf Corsepius <ralf_corsepius@rtems.org> 2004-04-14 Ralf Corsepius <ralf_corsepius@rtems.org>
* sapi/include/rtems/sptables.h: Remove _RTEMS_version. * sapi/include/rtems/sptables.h: Remove _RTEMS_version.

View File

@@ -75,7 +75,7 @@ rtems_capture_cli_open (
if (argc <= 1) if (argc <= 1)
{ {
printf (open_usage); fprintf(stdout,open_usage);
return; return;
} }
@@ -86,7 +86,7 @@ rtems_capture_cli_open (
if (argv[arg][1] == 'i') if (argv[arg][1] == 'i')
enable = 1; enable = 1;
else else
printf ("warning: option -%c ignored\n", argv[arg][1]); fprintf(stdout,"warning: option -%c ignored\n", argv[arg][1]);
} }
else else
{ {
@@ -94,7 +94,7 @@ rtems_capture_cli_open (
if (size < 100) if (size < 100)
{ {
printf ("error: size must be greater than or equal to 100\n"); fprintf(stdout,"error: size must be greater than or equal to 100\n");
return; return;
} }
} }
@@ -104,11 +104,11 @@ rtems_capture_cli_open (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: open failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: open failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("capture engine opened.\n"); fprintf(stdout,"capture engine opened.\n");
if (!enable) if (!enable)
return; return;
@@ -117,11 +117,11 @@ rtems_capture_cli_open (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: open enable failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: open enable failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("capture engine enabled.\n"); fprintf(stdout,"capture engine enabled.\n");
} }
/* /*
@@ -146,11 +146,11 @@ rtems_capture_cli_close (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: close failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: close failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("capture engine closed.\n"); fprintf(stdout,"capture engine closed.\n");
} }
/* /*
@@ -175,11 +175,11 @@ rtems_capture_cli_enable (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: enable failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: enable failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("capture engine enabled.\n"); fprintf(stdout,"capture engine enabled.\n");
} }
/* /*
@@ -204,11 +204,11 @@ rtems_capture_cli_disable (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: disable failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: disable failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("capture engine disabled.\n"); fprintf(stdout,"capture engine disabled.\n");
} }
/* /*
@@ -245,7 +245,7 @@ rtems_capture_cli_task_list (
total_time = (ticks * rtems_capture_task_time (task)) + tick_offset; total_time = (ticks * rtems_capture_task_time (task)) + tick_offset;
printf ("total %i\n", count); fprintf(stdout,"total %i\n", count);
while (task) while (task)
{ {
@@ -266,32 +266,32 @@ rtems_capture_cli_task_list (
priority = rtems_capture_task_real_priority (task); priority = rtems_capture_task_real_priority (task);
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_id (rtems_capture_task_id (task)); rtems_monitor_dump_id (rtems_capture_task_id (task));
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_name (rtems_capture_task_name (task)); rtems_monitor_dump_name (rtems_capture_task_name (task));
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_priority (rtems_capture_task_start_priority (task)); rtems_monitor_dump_priority (rtems_capture_task_start_priority (task));
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_priority (rtems_capture_task_real_priority (task)); rtems_monitor_dump_priority (rtems_capture_task_real_priority (task));
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_priority (rtems_capture_task_curr_priority (task)); rtems_monitor_dump_priority (rtems_capture_task_curr_priority (task));
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_state (rtems_capture_task_state (task)); rtems_monitor_dump_state (rtems_capture_task_state (task));
printf (" %c%c%c%c%c", fprintf(stdout," %c%c%c%c%c",
rtems_capture_task_valid (task) ? 'a' : 'd', rtems_capture_task_valid (task) ? 'a' : 'd',
rtems_capture_task_flags (task) & RTEMS_CAPTURE_TRACED ? 't' : '-', rtems_capture_task_flags (task) & RTEMS_CAPTURE_TRACED ? 't' : '-',
rtems_capture_task_control_flags (task) & RTEMS_CAPTURE_TO_ANY ? 'F' : '-', rtems_capture_task_control_flags (task) & RTEMS_CAPTURE_TO_ANY ? 'F' : '-',
rtems_capture_task_control_flags (task) & RTEMS_CAPTURE_FROM_ANY ? 'T' : '-', rtems_capture_task_control_flags (task) & RTEMS_CAPTURE_FROM_ANY ? 'T' : '-',
rtems_capture_task_control_flags (task) & RTEMS_CAPTURE_FROM_TO ? 'E' : '-'); rtems_capture_task_control_flags (task) & RTEMS_CAPTURE_FROM_TO ? 'E' : '-');
if ((floor > ceiling) && (ceiling > priority)) if ((floor > ceiling) && (ceiling > priority))
printf ("--"); fprintf(stdout,"--");
else else
printf ("%c%c", fprintf(stdout,"%c%c",
rtems_capture_task_control (task) ? rtems_capture_task_control (task) ?
(rtems_capture_task_control_flags (task) & RTEMS_CAPTURE_WATCH ? 'w' : '+') : '-', (rtems_capture_task_control_flags (task) & RTEMS_CAPTURE_WATCH ? 'w' : '+') : '-',
rtems_capture_watch_global_on () ? 'g' : '-'); rtems_capture_watch_global_on () ? 'g' : '-');
printf (" %3i%% %3i%% (%i)\n", fprintf(stdout," %3i%% %3i%% (%i)\n",
stack_used, time_used, rtems_capture_task_ticks (task)); stack_used, time_used, rtems_capture_task_ticks (task));
task = rtems_capture_next_task (task); task = rtems_capture_next_task (task);
@@ -314,8 +314,8 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg)
rtems_task_priority floor = rtems_capture_watch_get_floor (); rtems_task_priority floor = rtems_capture_watch_get_floor ();
int last_count = 0; int last_count = 0;
printf ("\x1b[2J Press ENTER to exit.\n\n"); fprintf(stdout,"\x1b[2J Press ENTER to exit.\n\n");
printf (" PID NAME RPRI CPRI STATE %%CPU %%STK FLGS EXEC TIME\n"); fprintf(stdout," PID NAME RPRI CPRI STATE %%CPU %%STK FLGS EXEC TIME\n");
for (;;) for (;;)
{ {
@@ -370,7 +370,7 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg)
task = rtems_capture_next_task (task); task = rtems_capture_next_task (task);
} }
printf ("\x1b[4;0H"); fprintf(stdout,"\x1b[4;0H");
total_time = 0; total_time = 0;
@@ -404,38 +404,38 @@ rtems_capture_cli_task_load_thread (rtems_task_argument arg)
priority = rtems_capture_task_real_priority (tasks[i]); priority = rtems_capture_task_real_priority (tasks[i]);
printf ("\x1b[K"); fprintf(stdout,"\x1b[K");
rtems_monitor_dump_id (rtems_capture_task_id (tasks[i])); rtems_monitor_dump_id (rtems_capture_task_id (tasks[i]));
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_name (rtems_capture_task_name (tasks[i])); rtems_monitor_dump_name (rtems_capture_task_name (tasks[i]));
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_priority (priority); rtems_monitor_dump_priority (priority);
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_priority (rtems_capture_task_curr_priority (tasks[i])); rtems_monitor_dump_priority (rtems_capture_task_curr_priority (tasks[i]));
printf (" "); fprintf(stdout," ");
k = rtems_monitor_dump_state (rtems_capture_task_state (tasks[i])); k = rtems_monitor_dump_state (rtems_capture_task_state (tasks[i]));
printf ("%*c %3i.%03i%% ", 6 - k, ' ', task_load / 1000, task_load % 1000); fprintf(stdout,"%*c %3i.%03i%% ", 6 - k, ' ', task_load / 1000, task_load % 1000);
printf ("%3i%% %c%c%c%c%c", stack_used, fprintf(stdout,"%3i%% %c%c%c%c%c", stack_used,
rtems_capture_task_valid (tasks[i]) ? 'a' : 'd', rtems_capture_task_valid (tasks[i]) ? 'a' : 'd',
rtems_capture_task_flags (tasks[i]) & RTEMS_CAPTURE_TRACED ? 't' : '-', rtems_capture_task_flags (tasks[i]) & RTEMS_CAPTURE_TRACED ? 't' : '-',
rtems_capture_task_control_flags (tasks[i]) & RTEMS_CAPTURE_TO_ANY ? 'F' : '-', rtems_capture_task_control_flags (tasks[i]) & RTEMS_CAPTURE_TO_ANY ? 'F' : '-',
rtems_capture_task_control_flags (tasks[i]) & RTEMS_CAPTURE_FROM_ANY ? 'T' : '-', rtems_capture_task_control_flags (tasks[i]) & RTEMS_CAPTURE_FROM_ANY ? 'T' : '-',
rtems_capture_task_control_flags (tasks[i]) & RTEMS_CAPTURE_FROM_TO ? 'E' : '-'); rtems_capture_task_control_flags (tasks[i]) & RTEMS_CAPTURE_FROM_TO ? 'E' : '-');
if ((floor > ceiling) && (ceiling > priority)) if ((floor > ceiling) && (ceiling > priority))
printf ("--"); fprintf(stdout,"--");
else else
printf ("%c%c", fprintf(stdout,"%c%c",
rtems_capture_task_control (tasks[i]) ? rtems_capture_task_control (tasks[i]) ?
(rtems_capture_task_control_flags (tasks[i]) & (rtems_capture_task_control_flags (tasks[i]) &
RTEMS_CAPTURE_WATCH ? 'w' : '+') : '-', RTEMS_CAPTURE_WATCH ? 'w' : '+') : '-',
rtems_capture_watch_global_on () ? 'g' : '-'); rtems_capture_watch_global_on () ? 'g' : '-');
printf (" %qi\n", rtems_capture_task_time (tasks[i])); fprintf(stdout," %qi\n", rtems_capture_task_time (tasks[i]));
} }
while (j) while (j)
{ {
printf ("\x1b[K\n"); fprintf(stdout,"\x1b[K\n");
j--; j--;
} }
@@ -472,7 +472,7 @@ rtems_capture_cli_task_load (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: cannot obtain the current priority: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: cannot obtain the current priority: %s\n", rtems_status_text (sc));
return; return;
} }
@@ -485,7 +485,7 @@ rtems_capture_cli_task_load (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: cannot create helper thread: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: cannot create helper thread: %s\n", rtems_status_text (sc));
return; return;
} }
@@ -493,7 +493,7 @@ rtems_capture_cli_task_load (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: cannot start helper thread: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: cannot start helper thread: %s\n", rtems_status_text (sc));
rtems_task_delete (id); rtems_task_delete (id);
return; return;
} }
@@ -511,7 +511,7 @@ rtems_capture_cli_task_load (
rtems_task_delete (id); rtems_task_delete (id);
printf ("load monitoring stopped.\n"); fprintf(stdout,"load monitoring stopped.\n");
return; return;
} }
@@ -538,11 +538,11 @@ rtems_capture_cli_watch_list (
rtems_task_priority ceiling = rtems_capture_watch_get_ceiling (); rtems_task_priority ceiling = rtems_capture_watch_get_ceiling ();
rtems_task_priority floor = rtems_capture_watch_get_floor (); rtems_task_priority floor = rtems_capture_watch_get_floor ();
printf ("watch priority ceiling is %i\n", ceiling); fprintf(stdout,"watch priority ceiling is %i\n", ceiling);
printf ("watch priority floor is %i\n", floor); fprintf(stdout,"watch priority floor is %i\n", floor);
printf ("global watch is %s\n", fprintf(stdout,"global watch is %s\n",
rtems_capture_watch_global_on () ? "enabled" : "disabled"); rtems_capture_watch_global_on () ? "enabled" : "disabled");
printf ("total %d\n", rtems_capture_control_count ()); fprintf(stdout,"total %d\n", rtems_capture_control_count ());
while (control) while (control)
{ {
@@ -550,11 +550,11 @@ rtems_capture_cli_watch_list (
int fshowed; int fshowed;
int lf; int lf;
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_id (rtems_capture_control_id (control)); rtems_monitor_dump_id (rtems_capture_control_id (control));
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_name (rtems_capture_control_name (control)); rtems_monitor_dump_name (rtems_capture_control_name (control));
printf (" %c%c%c%c%c", fprintf(stdout," %c%c%c%c%c",
rtems_capture_control_flags (control) & RTEMS_CAPTURE_WATCH ? 'w' : '-', rtems_capture_control_flags (control) & RTEMS_CAPTURE_WATCH ? 'w' : '-',
rtems_capture_watch_global_on () ? 'g' : '-', rtems_capture_watch_global_on () ? 'g' : '-',
rtems_capture_control_flags (control) & RTEMS_CAPTURE_TO_ANY ? 'F' : '-', rtems_capture_control_flags (control) & RTEMS_CAPTURE_TO_ANY ? 'F' : '-',
@@ -565,7 +565,7 @@ rtems_capture_cli_watch_list (
{ {
if (lf && ((fshowed % 16) == 0)) if (lf && ((fshowed % 16) == 0))
{ {
printf ("\n"); fprintf(stdout,"\n");
lf = 0; lf = 0;
} }
@@ -574,9 +574,9 @@ rtems_capture_cli_watch_list (
*/ */
if (rtems_capture_control_from_name (control, f)) if (rtems_capture_control_from_name (control, f))
{ {
printf (" %2i:", f); fprintf(stdout," %2i:", f);
rtems_monitor_dump_name (rtems_capture_control_from_name (control, f)); rtems_monitor_dump_name (rtems_capture_control_from_name (control, f));
printf ("/"); fprintf(stdout,"/");
rtems_monitor_dump_id (rtems_capture_control_from_id (control, f)); rtems_monitor_dump_id (rtems_capture_control_from_id (control, f));
fshowed++; fshowed++;
lf = 1; lf = 1;
@@ -584,7 +584,7 @@ rtems_capture_cli_watch_list (
} }
if (lf) if (lf)
printf ("\n"); fprintf(stdout,"\n");
control = rtems_capture_next_control (control); control = rtems_capture_next_control (control);
} }
@@ -612,7 +612,7 @@ rtems_capture_cli_get_name_id (char* arg,
if (*valid_name && *valid_id) if (*valid_name && *valid_id)
{ {
printf ("error: too many arguments\n"); fprintf(stdout,"error: too many arguments\n");
return 0; return 0;
} }
@@ -669,7 +669,7 @@ rtems_capture_cli_watch_add (
if (argc <= 1) if (argc <= 1)
{ {
printf (watch_add_usage); fprintf(stdout,watch_add_usage);
return; return;
} }
@@ -677,7 +677,7 @@ rtems_capture_cli_watch_add (
{ {
if (argv[arg][0] == '-') if (argv[arg][0] == '-')
{ {
printf ("warning: option -%c ignored\n", argv[arg][1]); fprintf(stdout,"warning: option -%c ignored\n", argv[arg][1]);
} }
else else
{ {
@@ -688,7 +688,7 @@ rtems_capture_cli_watch_add (
if (!valid_name && !valid_id) if (!valid_name && !valid_id)
{ {
printf("error: no valid name or task id located\n"); fprintf(stdout,"error: no valid name or task id located\n");
return; return;
} }
@@ -696,11 +696,11 @@ rtems_capture_cli_watch_add (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: watch add failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: watch add failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("watch added.\n"); fprintf(stdout,"watch added.\n");
} }
/* /*
@@ -731,7 +731,7 @@ rtems_capture_cli_watch_del (
if (argc <= 1) if (argc <= 1)
{ {
printf (watch_del_usage); fprintf(stdout,watch_del_usage);
return; return;
} }
@@ -739,7 +739,7 @@ rtems_capture_cli_watch_del (
{ {
if (argv[arg][0] == '-') if (argv[arg][0] == '-')
{ {
printf ("warning: option -%c ignored\n", argv[arg][1]); fprintf(stdout,"warning: option -%c ignored\n", argv[arg][1]);
} }
else else
{ {
@@ -750,7 +750,7 @@ rtems_capture_cli_watch_del (
if (!valid_name && !valid_id) if (!valid_name && !valid_id)
{ {
printf("error: no valid name or task id located\n"); fprintf(stdout,"error: no valid name or task id located\n");
return; return;
} }
@@ -758,11 +758,11 @@ rtems_capture_cli_watch_del (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: watch delete failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: watch delete failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("watch delete.\n"); fprintf(stdout,"watch delete.\n");
} }
/* /*
@@ -793,7 +793,7 @@ rtems_capture_cli_watch_control (
if (argc <= 2) if (argc <= 2)
{ {
printf (watch_control_usage); fprintf(stdout,watch_control_usage);
return; return;
} }
@@ -801,7 +801,7 @@ rtems_capture_cli_watch_control (
{ {
if (argv[arg][0] == '-') if (argv[arg][0] == '-')
{ {
printf ("warning: option -%c ignored\n", argv[arg][1]); fprintf(stdout,"warning: option -%c ignored\n", argv[arg][1]);
} }
else else
{ {
@@ -816,7 +816,7 @@ rtems_capture_cli_watch_control (
if (!valid_name && !valid_id) if (!valid_name && !valid_id)
{ {
printf("error: no valid name or task id located\n"); fprintf(stdout,"error: no valid name or task id located\n");
return; return;
} }
@@ -824,11 +824,11 @@ rtems_capture_cli_watch_control (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: watch control failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: watch control failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("watch %s.\n", enable ? "enabled" : "disabled"); fprintf(stdout,"watch %s.\n", enable ? "enabled" : "disabled");
} }
/* /*
@@ -855,7 +855,7 @@ rtems_capture_cli_watch_global (
if (argc <= 1) if (argc <= 1)
{ {
printf (watch_global_usage); fprintf(stdout,watch_global_usage);
return; return;
} }
@@ -863,7 +863,7 @@ rtems_capture_cli_watch_global (
{ {
if (argv[arg][0] == '-') if (argv[arg][0] == '-')
{ {
printf ("warning: option -%c ignored\n", argv[arg][1]); fprintf(stdout,"warning: option -%c ignored\n", argv[arg][1]);
} }
else else
{ {
@@ -878,11 +878,11 @@ rtems_capture_cli_watch_global (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: global watch failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: global watch failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("global watch %s.\n", enable ? "enabled" : "disabled"); fprintf(stdout,"global watch %s.\n", enable ? "enabled" : "disabled");
} }
/* /*
@@ -909,7 +909,7 @@ rtems_capture_cli_watch_ceiling (
if (argc <= 1) if (argc <= 1)
{ {
printf (watch_ceiling_usage); fprintf(stdout,watch_ceiling_usage);
return; return;
} }
@@ -917,7 +917,7 @@ rtems_capture_cli_watch_ceiling (
{ {
if (argv[arg][0] == '-') if (argv[arg][0] == '-')
{ {
printf ("warning: option -%c ignored\n", argv[arg][1]); fprintf(stdout,"warning: option -%c ignored\n", argv[arg][1]);
} }
else else
{ {
@@ -929,11 +929,11 @@ rtems_capture_cli_watch_ceiling (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: watch ceiling failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: watch ceiling failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("watch ceiling is %i.\n", priority); fprintf(stdout,"watch ceiling is %i.\n", priority);
} }
/* /*
@@ -960,7 +960,7 @@ rtems_capture_cli_watch_floor (
if (argc <= 1) if (argc <= 1)
{ {
printf (watch_floor_usage); fprintf(stdout,watch_floor_usage);
return; return;
} }
@@ -968,7 +968,7 @@ rtems_capture_cli_watch_floor (
{ {
if (argv[arg][0] == '-') if (argv[arg][0] == '-')
{ {
printf ("warning: option -%c ignored\n", argv[arg][1]); fprintf(stdout,"warning: option -%c ignored\n", argv[arg][1]);
} }
else else
{ {
@@ -980,11 +980,11 @@ rtems_capture_cli_watch_floor (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: watch floor failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: watch floor failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("watch floor is %i.\n", priority); fprintf(stdout,"watch floor is %i.\n", priority);
} }
/* /*
@@ -1024,7 +1024,7 @@ rtems_capture_cli_trigger_set (
if (argc <= 2) if (argc <= 2)
{ {
printf (trigger_set_usage); fprintf(stdout,trigger_set_usage);
return; return;
} }
@@ -1032,7 +1032,7 @@ rtems_capture_cli_trigger_set (
{ {
if (argv[arg][0] == '-') if (argv[arg][0] == '-')
{ {
printf ("warning: option -%c ignored\n", argv[arg][1]); fprintf(stdout,"warning: option -%c ignored\n", argv[arg][1]);
} }
else else
{ {
@@ -1046,7 +1046,7 @@ rtems_capture_cli_trigger_set (
trigger = rtems_capture_from_any; trigger = rtems_capture_from_any;
else else
{ {
printf ("error: the first argument is the trigger type (from/to/edge)\n"); fprintf(stdout,"error: the first argument is the trigger type (from/to/edge)\n");
return; return;
} }
trigger_set = 1; trigger_set = 1;
@@ -1056,7 +1056,7 @@ rtems_capture_cli_trigger_set (
if (trigger == rtems_capture_to_any) if (trigger == rtems_capture_to_any)
{ {
if (from_valid_name && from_valid_id) if (from_valid_name && from_valid_id)
printf ("warning: extra arguments ignored\n"); fprintf(stdout,"warning: extra arguments ignored\n");
else if (!rtems_capture_cli_get_name_id (argv[arg], &from_valid_name, &from_valid_id, else if (!rtems_capture_cli_get_name_id (argv[arg], &from_valid_name, &from_valid_id,
&from_name, &from_id)) &from_name, &from_id))
return; return;
@@ -1064,7 +1064,7 @@ rtems_capture_cli_trigger_set (
else if (trigger == rtems_capture_from_any) else if (trigger == rtems_capture_from_any)
{ {
if (to_valid_name && to_valid_id) if (to_valid_name && to_valid_id)
printf ("warning: extra arguments ignored\n"); fprintf(stdout,"warning: extra arguments ignored\n");
else if (!rtems_capture_cli_get_name_id (argv[arg], &to_valid_name, &to_valid_id, else if (!rtems_capture_cli_get_name_id (argv[arg], &to_valid_name, &to_valid_id,
&to_name, &to_id)) &to_name, &to_id))
return; return;
@@ -1072,7 +1072,7 @@ rtems_capture_cli_trigger_set (
else if (trigger == rtems_capture_from_to) else if (trigger == rtems_capture_from_to)
{ {
if (from_valid_name && from_valid_id && to_valid_name && to_valid_id) if (from_valid_name && from_valid_id && to_valid_name && to_valid_id)
printf ("warning: extra arguments ignored\n"); fprintf(stdout,"warning: extra arguments ignored\n");
else else
{ {
if (!rtems_capture_cli_get_name_id (argv[arg], &valid_name, &valid_id, if (!rtems_capture_cli_get_name_id (argv[arg], &valid_name, &valid_id,
@@ -1087,7 +1087,7 @@ rtems_capture_cli_trigger_set (
from_name = name; from_name = name;
} }
else if (to_valid_name) else if (to_valid_name)
printf ("warning: extra arguments ignored\n"); fprintf(stdout,"warning: extra arguments ignored\n");
else else
{ {
to_valid_name = 1; to_valid_name = 1;
@@ -1102,7 +1102,7 @@ rtems_capture_cli_trigger_set (
from_id = id; from_id = id;
} }
else if (to_valid_id) else if (to_valid_id)
printf ("warning: extra arguments ignored\n"); fprintf(stdout,"warning: extra arguments ignored\n");
else else
{ {
to_valid_id = 1; to_valid_id = 1;
@@ -1117,20 +1117,20 @@ rtems_capture_cli_trigger_set (
if ((trigger == rtems_capture_to_any) && !from_valid_name && !from_valid_id) if ((trigger == rtems_capture_to_any) && !from_valid_name && !from_valid_id)
{ {
printf ("error: a from trigger need a to name or id\n"); fprintf(stdout,"error: a from trigger need a to name or id\n");
return; return;
} }
if ((trigger == rtems_capture_from_any) && !to_valid_name && !to_valid_id) if ((trigger == rtems_capture_from_any) && !to_valid_name && !to_valid_id)
{ {
printf ("error: a to trigger need a from name or id\n"); fprintf(stdout,"error: a to trigger need a from name or id\n");
return; return;
} }
if ((trigger == rtems_capture_from_to) && if ((trigger == rtems_capture_from_to) &&
((!from_valid_name && !from_valid_id) || (!to_valid_name && !to_valid_id))) ((!from_valid_name && !from_valid_id) || (!to_valid_name && !to_valid_id)))
{ {
printf ("error: an edge trigger need a from and to name or id\n"); fprintf(stdout,"error: an edge trigger need a from and to name or id\n");
return; return;
} }
@@ -1138,11 +1138,11 @@ rtems_capture_cli_trigger_set (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: setting the trigger failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: setting the trigger failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("trigger set.\n"); fprintf(stdout,"trigger set.\n");
} }
/* /*
@@ -1184,7 +1184,7 @@ rtems_capture_cli_trace_records (
arg++; arg++;
if (arg == argc) if (arg == argc)
{ {
printf ("error: option -r requires number\n"); fprintf(stdout,"error: option -r requires number\n");
return; return;
} }
@@ -1193,14 +1193,14 @@ rtems_capture_cli_trace_records (
for (i = 0; i < l; i++) for (i = 0; i < l; i++)
if (!isdigit (argv[arg][i])) if (!isdigit (argv[arg][i]))
{ {
printf ("error: option -r requires number and currently it is not\n"); fprintf(stdout,"error: option -r requires number and currently it is not\n");
return; return;
} }
dump_total = strtoul (argv[arg], 0, 0); dump_total = strtoul (argv[arg], 0, 0);
} }
else else
printf ("warning: option -%c ignored\n", argv[arg][1]); fprintf(stdout,"warning: option -%c ignored\n", argv[arg][1]);
} }
} }
@@ -1212,7 +1212,7 @@ rtems_capture_cli_trace_records (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: trace read failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: trace read failed: %s\n", rtems_status_text (sc));
rtems_capture_flush (0); rtems_capture_flush (0);
return; return;
} }
@@ -1223,7 +1223,7 @@ rtems_capture_cli_trace_records (
for (count = 0; count < read; count++, rec++) for (count = 0; count < read; count++, rec++)
{ {
if (csv) if (csv)
printf ("%08x,%03d,%03d,%04x,%d,%d\n", fprintf(stdout,"%08x,%03d,%03d,%04x,%d,%d\n",
(uint32_t ) rec->task, (uint32_t ) rec->task,
(rec->events >> RTEMS_CAPTURE_REAL_PRIORITY_EVENT) & 0xff, (rec->events >> RTEMS_CAPTURE_REAL_PRIORITY_EVENT) & 0xff,
(rec->events >> RTEMS_CAPTURE_CURR_PRIORITY_EVENT) & 0xff, (rec->events >> RTEMS_CAPTURE_CURR_PRIORITY_EVENT) & 0xff,
@@ -1245,12 +1245,12 @@ rtems_capture_cli_trace_records (
{ {
if (event & 1) if (event & 1)
{ {
printf ("%9li.%06li ", (unsigned long) (t / 1000000), fprintf(stdout,"%9li.%06li ", (unsigned long) (t / 1000000),
(unsigned long) (t % 1000000)); (unsigned long) (t % 1000000));
rtems_monitor_dump_id (rtems_capture_task_id (rec->task)); rtems_monitor_dump_id (rtems_capture_task_id (rec->task));
printf (" "); fprintf(stdout," ");
rtems_monitor_dump_name (rtems_capture_task_name (rec->task)); rtems_monitor_dump_name (rtems_capture_task_name (rec->task));
printf (" %3i %3i %s\n", fprintf(stdout," %3i %3i %s\n",
(rec->events >> RTEMS_CAPTURE_REAL_PRIORITY_EVENT) & 0xff, (rec->events >> RTEMS_CAPTURE_REAL_PRIORITY_EVENT) & 0xff,
(rec->events >> RTEMS_CAPTURE_CURR_PRIORITY_EVENT) & 0xff, (rec->events >> RTEMS_CAPTURE_CURR_PRIORITY_EVENT) & 0xff,
rtems_capture_event_text (e)); rtems_capture_event_text (e));
@@ -1297,7 +1297,7 @@ rtems_capture_cli_flush (
if (argv[arg][1] == 'n') if (argv[arg][1] == 'n')
prime = 0; prime = 0;
else else
printf ("warning: option -%c ignored\n", argv[arg][1]); fprintf(stdout,"warning: option -%c ignored\n", argv[arg][1]);
} }
} }
@@ -1305,11 +1305,11 @@ rtems_capture_cli_flush (
if (sc != RTEMS_SUCCESSFUL) if (sc != RTEMS_SUCCESSFUL)
{ {
printf ("error: flush failed: %s\n", rtems_status_text (sc)); fprintf(stdout,"error: flush failed: %s\n", rtems_status_text (sc));
return; return;
} }
printf ("trace buffer flushed and %s.\n", prime ? "primed" : "not primed"); fprintf(stdout,"trace buffer flushed and %s.\n", prime ? "primed" : "not primed");
} }
static rtems_monitor_command_entry_t rtems_capture_cli_cmds[] = static rtems_monitor_command_entry_t rtems_capture_cli_cmds[] =

View File

@@ -60,11 +60,11 @@ void CPU_usage_Dump( void )
} }
} }
printf("CPU Usage by thread\n"); fprintf(stdout,"CPU Usage by thread\n");
#if defined(unix) || ( CPU_HARDWARE_FP == TRUE ) #if defined(unix) || ( CPU_HARDWARE_FP == TRUE )
printf( " ID NAME TICKS PERCENT\n" ); fprintf(stdout, " ID NAME TICKS PERCENT\n" );
#else #else
printf( " ID NAME TICKS\n" ); fprintf(stdout, " ID NAME TICKS\n" );
#endif #endif
for ( api_index = 1 ; for ( api_index = 1 ;
@@ -102,7 +102,7 @@ void CPU_usage_Dump( void )
if ( !isprint(name[3]) ) name[3] = '*'; if ( !isprint(name[3]) ) name[3] = '*';
#if defined(unix) || ( CPU_HARDWARE_FP == TRUE ) #if defined(unix) || ( CPU_HARDWARE_FP == TRUE )
printf( "0x%08x %4s %8d %5.3f\n", fprintf(stdout, "0x%08x %4s %8d %5.3f\n",
the_thread->Object.id, the_thread->Object.id,
name, name,
the_thread->ticks_executed, the_thread->ticks_executed,
@@ -111,7 +111,7 @@ void CPU_usage_Dump( void )
(double)total_units (double)total_units
); );
#else #else
printf( "0x%08x %4s %8d\n", fprintf(stdout, "0x%08x %4s %8d\n",
the_thread->Object.id, the_thread->Object.id,
name, name,
the_thread->ticks_executed the_thread->ticks_executed
@@ -121,11 +121,11 @@ void CPU_usage_Dump( void )
} }
} }
printf( fprintf(stdout,
"\nTicks since last reset = %d\n", "\nTicks since last reset = %d\n",
_Watchdog_Ticks_since_boot - CPU_usage_Ticks_at_last_reset _Watchdog_Ticks_since_boot - CPU_usage_Ticks_at_last_reset
); );
printf( "\nTotal Units = %d\n", total_units ); fprintf(stdout, "\nTotal Units = %d\n", total_units );
} }
/*PAGE /*PAGE

View File

@@ -75,5 +75,5 @@ static inline void Dump_Line(
strcat( line_buffer, "|\n" ); strcat( line_buffer, "|\n" );
printf( line_buffer ); fprintf(stdout, line_buffer );
} }

View File

@@ -136,7 +136,7 @@ int rtems_fsmount
tmp_rc = rtems_fsmount_create_mountpoint(fstab_ptr->mount_point); tmp_rc = rtems_fsmount_create_mountpoint(fstab_ptr->mount_point);
if (tmp_rc != 0) { if (tmp_rc != 0) {
if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNTPNT_CRTERR)) { if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNTPNT_CRTERR)) {
printf("fsmount: creation of mount point \"%s\" failed: %s\n", fprintf(stdout,"fsmount: creation of mount point \"%s\" failed: %s\n",
fstab_ptr->mount_point, fstab_ptr->mount_point,
strerror(errno)); strerror(errno));
} }
@@ -157,7 +157,7 @@ int rtems_fsmount
fstab_ptr->mount_point); fstab_ptr->mount_point);
if (tmp_rc != RTEMS_SUCCESSFUL) { if (tmp_rc != RTEMS_SUCCESSFUL) {
if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNT_FAILED)) { if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNT_FAILED)) {
printf("fsmount: mounting of \"%s\" to" fprintf(stdout,"fsmount: mounting of \"%s\" to"
" \"%s\" failed: %s\n", " \"%s\" failed: %s\n",
fstab_ptr->dev, fstab_ptr->dev,
fstab_ptr->mount_point, fstab_ptr->mount_point,
@@ -170,7 +170,7 @@ int rtems_fsmount
} }
else { else {
if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNT_OK)) { if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNT_OK)) {
printf("fsmount: mounting of \"%s\" to" fprintf(stdout,"fsmount: mounting of \"%s\" to"
" \"%s\" succeeded\n", " \"%s\" succeeded\n",
fstab_ptr->dev, fstab_ptr->dev,
fstab_ptr->mount_point); fstab_ptr->mount_point);

View File

@@ -235,9 +235,9 @@ rtems_monitor_line_editor (
pos = 0; pos = 0;
if (!logged_in) if (!logged_in)
printf ("\nMonitor ready, press enter to login.\n\n"); fprintf(stdout,"\nMonitor ready, press enter to login.\n\n");
else else
printf ("%s $ ", monitor_prompt); fprintf(stdout,"%s $ ", monitor_prompt);
while (1) while (1)
{ {
@@ -258,7 +258,7 @@ rtems_monitor_line_editor (
* The prompt has changed from `>' to `$' to help know * The prompt has changed from `>' to `$' to help know
* which version of the monitor code people are using. * which version of the monitor code people are using.
*/ */
printf("%s $ ", monitor_prompt); fprintf(stdout,"%s $ ", monitor_prompt);
} }
} }
else else
@@ -268,12 +268,12 @@ rtems_monitor_line_editor (
switch (c) switch (c)
{ {
case KEYS_END: case KEYS_END:
printf (buffer + pos); fprintf(stdout,buffer + pos);
pos = (int) strlen (buffer); pos = (int) strlen (buffer);
break; break;
case KEYS_HOME: case KEYS_HOME:
printf ("\r%s $ ", monitor_prompt); fprintf(stdout,"\r%s $ ", monitor_prompt);
pos = 0; pos = 0;
break; break;
@@ -312,8 +312,8 @@ rtems_monitor_line_editor (
memcpy (buffer, history_buffer[history], memcpy (buffer, history_buffer[history],
RTEMS_COMMAND_BUFFER_SIZE); RTEMS_COMMAND_BUFFER_SIZE);
pos = history_pos[history]; pos = history_pos[history];
printf ("\r%*c", RTEMS_COMMAND_BUFFER_SIZE, ' '); fprintf(stdout,"\r%*c", RTEMS_COMMAND_BUFFER_SIZE, ' ');
printf ("\r%s $ %s", monitor_prompt, buffer); fprintf(stdout,"\r%s $ %s", monitor_prompt, buffer);
end = (int) strlen (buffer); end = (int) strlen (buffer);
for (bs = 0; bs < (end - pos); bs++) for (bs = 0; bs < (end - pos); bs++)
putchar ('\b'); putchar ('\b');
@@ -329,8 +329,8 @@ rtems_monitor_line_editor (
memcpy (buffer, history_buffer[history], memcpy (buffer, history_buffer[history],
RTEMS_COMMAND_BUFFER_SIZE); RTEMS_COMMAND_BUFFER_SIZE);
pos = history_pos[history]; pos = history_pos[history];
printf ("\r%*c", RTEMS_COMMAND_BUFFER_SIZE, ' '); fprintf(stdout,"\r%*c", RTEMS_COMMAND_BUFFER_SIZE, ' ');
printf ("\r%s $ %s", monitor_prompt, buffer); fprintf(stdout,"\r%s $ %s", monitor_prompt, buffer);
end = (int) strlen (buffer); end = (int) strlen (buffer);
for (bs = 0; bs < (end - pos); bs++) for (bs = 0; bs < (end - pos); bs++)
putchar ('\b'); putchar ('\b');
@@ -343,7 +343,7 @@ rtems_monitor_line_editor (
int end; int end;
int bs; int bs;
strcpy (&buffer[pos], &buffer[pos + 1]); strcpy (&buffer[pos], &buffer[pos + 1]);
printf ("\r%s $ %s", monitor_prompt, buffer); fprintf(stdout,"\r%s $ %s", monitor_prompt, buffer);
end = (int) strlen (buffer); end = (int) strlen (buffer);
for (bs = 0; bs < (end - pos); bs++) for (bs = 0; bs < (end - pos); bs++)
putchar ('\b'); putchar ('\b');
@@ -363,7 +363,7 @@ rtems_monitor_line_editor (
int bs; int bs;
pos--; pos--;
strcpy (buffer + pos, buffer + pos + 1); strcpy (buffer + pos, buffer + pos + 1);
printf ("\b%s \b", buffer + pos); fprintf(stdout,"\b%s \b", buffer + pos);
for (bs = 0; bs < ((int) strlen (buffer) - pos); bs++) for (bs = 0; bs < ((int) strlen (buffer) - pos); bs++)
putchar ('\b'); putchar ('\b');
} }
@@ -373,7 +373,7 @@ rtems_monitor_line_editor (
/* /*
* Process the command. * Process the command.
*/ */
printf ("\n"); fprintf(stdout,"\n");
repeating = 1; repeating = 1;
/* /*
* Only process the history if we have a command and * Only process the history if we have a command and
@@ -431,7 +431,7 @@ rtems_monitor_line_editor (
int ch, bs; int ch, bs;
for (ch = end + 1; ch > pos; ch--) for (ch = end + 1; ch > pos; ch--)
buffer[ch] = buffer[ch - 1]; buffer[ch] = buffer[ch - 1];
printf (buffer + pos); fprintf(stdout,buffer + pos);
for (bs = 0; bs < (end - pos + 1); bs++) for (bs = 0; bs < (end - pos + 1); bs++)
putchar ('\b'); putchar ('\b');
} }
@@ -505,7 +505,7 @@ rtems_monitor_command_read(char *command,
#if defined(RTEMS_UNIX) #if defined(RTEMS_UNIX)
/* RTEMS on unix gets so many interrupt system calls this is hosed */ /* RTEMS on unix gets so many interrupt system calls this is hosed */
printf ("%s> ", monitor_prompt); fprintf(stdout,"%s> ", monitor_prompt);
fflush (stdout); fflush (stdout);
while (gets(command) == (char *) 0) while (gets(command) == (char *) 0)
; ;
@@ -589,20 +589,20 @@ rtems_monitor_show_help (
int line_one = 1; int line_one = 1;
int c; int c;
printf ("%s", help_cmd->command); fprintf(stdout,"%s", help_cmd->command);
if (help_len == 0) if (help_len == 0)
{ {
printf (" - No help associated.\n"); fprintf(stdout," - No help associated.\n");
return; return;
} }
while (help_len) while (help_len)
{ {
printf ("%*c", spaces, ' '); fprintf(stdout,"%*c", spaces, ' ');
if (line_one) if (line_one)
printf (" - "); fprintf(stdout," - ");
spaces = max_cmd_len + 2; spaces = max_cmd_len + 2;
line_one = 0; line_one = 0;
@@ -638,7 +638,7 @@ rtems_monitor_show_help (
else else
putchar (help[c]); putchar (help[c]);
printf ("\n"); fprintf(stdout,"\n");
help += show_this_line; help += show_this_line;
help_len -= show_this_line; help_len -= show_this_line;
@@ -688,7 +688,7 @@ rtems_monitor_command_usage(
if (command) if (command)
rtems_monitor_show_help (command, strlen (command_string)); rtems_monitor_show_help (command, strlen (command_string));
else else
printf ("Unrecognised command; try just 'help'\n"); fprintf(stdout,"Unrecognised command; try just 'help'\n");
return; return;
} }

View File

@@ -84,7 +84,7 @@ rtems_monitor_config_dump_header(
boolean verbose boolean verbose
) )
{ {
printf("\ fprintf(stdout,"\
INITIAL (startup) Configuration Info\n"); INITIAL (startup) Configuration Info\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0 1 2 3 4 5 6 7 */ 0 1 2 3 4 5 6 7 */
@@ -101,24 +101,24 @@ rtems_monitor_config_dump(
uint32_t length = 0; uint32_t length = 0;
length = 0; length = 0;
length += printf("WORKSPACE"); length += fprintf(stdout,"WORKSPACE");
length += rtems_monitor_pad(DATACOL, length); length += rtems_monitor_pad(DATACOL, length);
length += printf("start: %p; size: 0x%x\n", length += fprintf(stdout,"start: %p; size: 0x%x\n",
monitor_config->work_space_start, monitor_config->work_space_start,
monitor_config->work_space_size); monitor_config->work_space_size);
length = 0; length = 0;
length += printf("TIME"); length += fprintf(stdout,"TIME");
length += rtems_monitor_pad(DATACOL, length); length += rtems_monitor_pad(DATACOL, length);
length += printf("usec/tick: %d; tick/timeslice: %d; tick/sec: %d\n", length += fprintf(stdout,"usec/tick: %d; tick/timeslice: %d; tick/sec: %d\n",
monitor_config->microseconds_per_tick, monitor_config->microseconds_per_tick,
monitor_config->ticks_per_timeslice, monitor_config->ticks_per_timeslice,
1000000 / monitor_config->microseconds_per_tick); 1000000 / monitor_config->microseconds_per_tick);
length = 0; length = 0;
length += printf("MAXIMUMS"); length += fprintf(stdout,"MAXIMUMS");
length += rtems_monitor_pad(DATACOL, length); length += rtems_monitor_pad(DATACOL, length);
length += printf("tasks: %d; timers: %d; sems: %d; que's: %d; ext's: %d\n", length += fprintf(stdout,"tasks: %d; timers: %d; sems: %d; que's: %d; ext's: %d\n",
monitor_config->maximum_tasks, monitor_config->maximum_tasks,
monitor_config->maximum_timers, monitor_config->maximum_timers,
monitor_config->maximum_semaphores, monitor_config->maximum_semaphores,
@@ -126,7 +126,7 @@ rtems_monitor_config_dump(
monitor_config->maximum_extensions); monitor_config->maximum_extensions);
length = 0; length = 0;
length += rtems_monitor_pad(CONTCOL, length); length += rtems_monitor_pad(CONTCOL, length);
length += printf("partitions: %d; regions: %d; ports: %d; periods: %d\n", length += fprintf(stdout,"partitions: %d; regions: %d; ports: %d; periods: %d\n",
monitor_config->maximum_partitions, monitor_config->maximum_partitions,
monitor_config->maximum_regions, monitor_config->maximum_regions,
monitor_config->maximum_ports, monitor_config->maximum_ports,

View File

@@ -86,7 +86,7 @@ rtems_monitor_dname_dump_header(
boolean verbose boolean verbose
) )
{ {
printf("\ fprintf(stdout,"\
Major:Minor Name\n"); Major:Minor Name\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0 1 2 3 4 5 6 7 */ 0 1 2 3 4 5 6 7 */
@@ -103,14 +103,14 @@ rtems_monitor_dname_dump(
length += rtems_monitor_pad(6, length); length += rtems_monitor_pad(6, length);
length += rtems_monitor_dump_hex(monitor_dname->major); length += rtems_monitor_dump_hex(monitor_dname->major);
length += printf(":"); length += fprintf(stdout,":");
length += rtems_monitor_dump_hex(monitor_dname->minor); length += rtems_monitor_dump_hex(monitor_dname->minor);
length += rtems_monitor_pad(16, length); length += rtems_monitor_pad(16, length);
length += printf("%.*s", length += fprintf(stdout,"%.*s",
(int) sizeof(monitor_dname->name_string), (int) sizeof(monitor_dname->name_string),
(char *) monitor_dname->name_string); (char *) monitor_dname->name_string);
length += printf("\n"); length += fprintf(stdout,"\n");
length = 0; length = 0;
} }

View File

@@ -95,7 +95,7 @@ rtems_monitor_driver_dump_header(
boolean verbose boolean verbose
) )
{ {
printf("\ fprintf(stdout,"\
Major Entry points\n"); Major Entry points\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0 1 2 3 4 5 6 7 */ 0 1 2 3 4 5 6 7 */
@@ -110,31 +110,31 @@ rtems_monitor_driver_dump(
{ {
uint32_t length = 0; uint32_t length = 0;
length += printf(" %d", monitor_driver->id); length += fprintf(stdout," %d", monitor_driver->id);
length += rtems_monitor_pad(13, length); length += rtems_monitor_pad(13, length);
length += printf("init: "); length += fprintf(stdout,"init: ");
length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose); length += rtems_monitor_symbol_dump(&monitor_driver->initialization, verbose);
length += printf("; control: "); length += fprintf(stdout,"; control: ");
length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose); length += rtems_monitor_symbol_dump(&monitor_driver->control, verbose);
length += printf("\n"); length += fprintf(stdout,"\n");
length = 0; length = 0;
length += rtems_monitor_pad(13, length); length += rtems_monitor_pad(13, length);
length += printf("open: "); length += fprintf(stdout,"open: ");
length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose); length += rtems_monitor_symbol_dump(&monitor_driver->open, verbose);
length += printf("; close: "); length += fprintf(stdout,"; close: ");
length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose); length += rtems_monitor_symbol_dump(&monitor_driver->close, verbose);
length += printf("\n"); length += fprintf(stdout,"\n");
length = 0; length = 0;
length += rtems_monitor_pad(13, length); length += rtems_monitor_pad(13, length);
length += printf("read: "); length += fprintf(stdout,"read: ");
length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose); length += rtems_monitor_symbol_dump(&monitor_driver->read, verbose);
length += printf("; write: "); length += fprintf(stdout,"; write: ");
length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose); length += rtems_monitor_symbol_dump(&monitor_driver->write, verbose);
length += printf("\n"); length += fprintf(stdout,"\n");
length = 0; length = 0;
} }

View File

@@ -46,7 +46,7 @@ rtems_monitor_extension_dump_header(
boolean verbose boolean verbose
) )
{ {
printf("\ fprintf(stdout,"\
ID NAME\n"); ID NAME\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0 1 2 3 4 5 6 7 */ 0 1 2 3 4 5 6 7 */
@@ -72,31 +72,31 @@ rtems_monitor_extension_dump(
length += rtems_monitor_dump_name(monitor_extension->name); length += rtems_monitor_dump_name(monitor_extension->name);
length += rtems_monitor_pad(18, length); length += rtems_monitor_pad(18, length);
length += printf("create: "); length += fprintf(stdout,"create: ");
length += rtems_monitor_symbol_dump(&monitor_extension->e_create, verbose); length += rtems_monitor_symbol_dump(&monitor_extension->e_create, verbose);
length += printf("; start: "); length += fprintf(stdout,"; start: ");
length += rtems_monitor_symbol_dump(&monitor_extension->e_start, verbose); length += rtems_monitor_symbol_dump(&monitor_extension->e_start, verbose);
length += printf("; restart: "); length += fprintf(stdout,"; restart: ");
length += rtems_monitor_symbol_dump(&monitor_extension->e_restart, verbose); length += rtems_monitor_symbol_dump(&monitor_extension->e_restart, verbose);
length += printf("\n"); length += fprintf(stdout,"\n");
length = 0; length = 0;
length += rtems_monitor_pad(18, length); length += rtems_monitor_pad(18, length);
length += printf("delete: "); length += fprintf(stdout,"delete: ");
length += rtems_monitor_symbol_dump(&monitor_extension->e_delete, verbose); length += rtems_monitor_symbol_dump(&monitor_extension->e_delete, verbose);
length += printf("; switch: "); length += fprintf(stdout,"; switch: ");
length += rtems_monitor_symbol_dump(&monitor_extension->e_tswitch, verbose); length += rtems_monitor_symbol_dump(&monitor_extension->e_tswitch, verbose);
length += printf("; begin: "); length += fprintf(stdout,"; begin: ");
length += rtems_monitor_symbol_dump(&monitor_extension->e_begin, verbose); length += rtems_monitor_symbol_dump(&monitor_extension->e_begin, verbose);
length += printf("\n"); length += fprintf(stdout,"\n");
length = 0; length = 0;
length += rtems_monitor_pad(18, length); length += rtems_monitor_pad(18, length);
length += printf("exitted: "); length += fprintf(stdout,"exitted: ");
length += rtems_monitor_symbol_dump(&monitor_extension->e_exitted, verbose); length += rtems_monitor_symbol_dump(&monitor_extension->e_exitted, verbose);
length += printf("; fatal: "); length += fprintf(stdout,"; fatal: ");
length += rtems_monitor_symbol_dump(&monitor_extension->e_fatal, verbose); length += rtems_monitor_symbol_dump(&monitor_extension->e_fatal, verbose);
length += printf("\n"); length += fprintf(stdout,"\n");
length = 0; length = 0;
printf("\n"); fprintf(stdout,"\n");
} }

View File

@@ -74,7 +74,7 @@ rtems_monitor_init_task_dump_header(
boolean verbose boolean verbose
) )
{ {
printf("\ fprintf(stdout,"\
# NAME ENTRY ARGUMENT PRIO MODES ATTRIBUTES STACK SIZE\n"); # NAME ENTRY ARGUMENT PRIO MODES ATTRIBUTES STACK SIZE\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0 1 2 3 4 5 6 7 */ 0 1 2 3 4 5 6 7 */
@@ -101,7 +101,7 @@ rtems_monitor_init_task_dump(
length += rtems_monitor_symbol_dump(&monitor_itask->entry, verbose); length += rtems_monitor_symbol_dump(&monitor_itask->entry, verbose);
length += rtems_monitor_pad(25, length); length += rtems_monitor_pad(25, length);
length += printf("%d [0x%x]", monitor_itask->argument, monitor_itask->argument); length += fprintf(stdout,"%d [0x%x]", monitor_itask->argument, monitor_itask->argument);
length += rtems_monitor_pad(39, length); length += rtems_monitor_pad(39, length);
length += rtems_monitor_dump_priority(monitor_itask->priority); length += rtems_monitor_dump_priority(monitor_itask->priority);
@@ -113,7 +113,7 @@ rtems_monitor_init_task_dump(
length += rtems_monitor_dump_attributes(monitor_itask->attributes); length += rtems_monitor_dump_attributes(monitor_itask->attributes);
length += rtems_monitor_pad(66, length); length += rtems_monitor_pad(66, length);
length += printf("%d [0x%x]", monitor_itask->stack_size, monitor_itask->stack_size); length += fprintf(stdout,"%d [0x%x]", monitor_itask->stack_size, monitor_itask->stack_size);
printf("\n"); fprintf(stdout,"\n");
} }

View File

@@ -326,7 +326,7 @@ rtems_monitor_node_cmd(
break; break;
default: default:
printf("invalid syntax, try 'help node'\n"); fprintf(stdout,"invalid syntax, try 'help node'\n");
break; break;
} }
@@ -398,13 +398,13 @@ rtems_monitor_symbols_loadup(void)
(uint32_t ) strtoul(value, 0, 16)); (uint32_t ) strtoul(value, 0, 16));
if (sp == 0) if (sp == 0)
{ {
printf("could not define symbol '%s'\n", symbol); fprintf(stdout,"could not define symbol '%s'\n", symbol);
goto done; goto done;
} }
} }
else else
{ {
printf("parsing error on '%s'\n", buffer); fprintf(stdout,"parsing error on '%s'\n", buffer);
goto done; goto done;
} }
} }
@@ -478,7 +478,7 @@ rtems_monitor_task(
if (tcgetattr (STDIN_FILENO, &term) < 0) if (tcgetattr (STDIN_FILENO, &term) < 0)
{ {
printf("rtems-monitor: cannot get terminal attributes.\n"); fprintf(stdout,"rtems-monitor: cannot get terminal attributes.\n");
} }
else else
{ {
@@ -499,7 +499,7 @@ rtems_monitor_task(
if (tcsetattr (STDIN_FILENO, TCSANOW, &term) < 0) if (tcsetattr (STDIN_FILENO, TCSANOW, &term) < 0)
{ {
printf("cannot set terminal attributes\n"); fprintf(stdout,"cannot set terminal attributes\n");
} }
} }
@@ -526,7 +526,7 @@ rtems_monitor_task(
argv)) == 0) argv)) == 0)
{ {
/* no command */ /* no command */
printf("Unrecognised command; try 'help'\n"); fprintf(stdout,"Unrecognised command; try 'help'\n");
continue; continue;
} }

View File

@@ -97,7 +97,7 @@ rtems_monitor_mpci_dump_header(
boolean verbose boolean verbose
) )
{ {
printf("\ fprintf(stdout,"\
max max max default max\n\ max max max default max\n\
node nodes globals proxies timeout pktsize\n"); node nodes globals proxies timeout pktsize\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
@@ -116,9 +116,9 @@ rtems_monitor_mpci_dump(
uint32_t length = 0; uint32_t length = 0;
length += rtems_monitor_pad(2, length); length += rtems_monitor_pad(2, length);
length += printf(" %d", monitor_mpci->node); length += fprintf(stdout," %d", monitor_mpci->node);
length += rtems_monitor_pad(11, length); length += rtems_monitor_pad(11, length);
length += printf("%d", monitor_mpci->maximum_nodes); length += fprintf(stdout,"%d", monitor_mpci->maximum_nodes);
length += rtems_monitor_pad(18, length); length += rtems_monitor_pad(18, length);
length += rtems_monitor_dump_decimal(monitor_mpci->maximum_global_objects); length += rtems_monitor_dump_decimal(monitor_mpci->maximum_global_objects);
@@ -132,31 +132,31 @@ rtems_monitor_mpci_dump(
length += rtems_monitor_pad(46, length); length += rtems_monitor_pad(46, length);
length += rtems_monitor_dump_decimal(monitor_mpci->maximum_packet_size); length += rtems_monitor_dump_decimal(monitor_mpci->maximum_packet_size);
printf("\n"); fprintf(stdout,"\n");
length = 0; length = 0;
length += rtems_monitor_pad(DATACOL, length); length += rtems_monitor_pad(DATACOL, length);
length += printf("init: "); length += fprintf(stdout,"init: ");
length += rtems_monitor_symbol_dump(&monitor_mpci->initialization, verbose); length += rtems_monitor_symbol_dump(&monitor_mpci->initialization, verbose);
printf("\n"); fprintf(stdout,"\n");
length = 0; length = 0;
length += rtems_monitor_pad(DATACOL, length); length += rtems_monitor_pad(DATACOL, length);
length += printf("get: "); length += fprintf(stdout,"get: ");
length += rtems_monitor_symbol_dump(&monitor_mpci->get_packet, verbose); length += rtems_monitor_symbol_dump(&monitor_mpci->get_packet, verbose);
length += printf("; return: "); length += fprintf(stdout,"; return: ");
length += rtems_monitor_symbol_dump(&monitor_mpci->return_packet, verbose); length += rtems_monitor_symbol_dump(&monitor_mpci->return_packet, verbose);
printf("\n"); fprintf(stdout,"\n");
length = 0; length = 0;
length += rtems_monitor_pad(DATACOL, length); length += rtems_monitor_pad(DATACOL, length);
length += printf("send: "); length += fprintf(stdout,"send: ");
length += rtems_monitor_symbol_dump(&monitor_mpci->send_packet, verbose); length += rtems_monitor_symbol_dump(&monitor_mpci->send_packet, verbose);
length += printf("; receive: "); length += fprintf(stdout,"; receive: ");
length += rtems_monitor_symbol_dump(&monitor_mpci->receive_packet, verbose); length += rtems_monitor_symbol_dump(&monitor_mpci->receive_packet, verbose);
printf("\n"); fprintf(stdout,"\n");
length = 0; length = 0;
} }

View File

@@ -330,7 +330,7 @@ rtems_monitor_object_cmd(
{ {
if (type == RTEMS_MONITOR_OBJECT_INVALID) if (type == RTEMS_MONITOR_OBJECT_INVALID)
{ {
printf("A type must be specified to \"dump all\"\n"); fprintf(stdout,"A type must be specified to \"dump all\"\n");
goto done; goto done;
} }
@@ -371,7 +371,7 @@ rtems_monitor_object_cmd(
if (info == 0) if (info == 0)
{ {
not_found: printf("Invalid or unsupported type %d\n", type); not_found: fprintf(stdout,"Invalid or unsupported type %d\n", type);
goto done; goto done;
} }

View File

@@ -22,7 +22,7 @@
void void
rtems_monitor_separator(void) rtems_monitor_separator(void)
{ {
printf("------------------------------------------------------------------------------\n"); fprintf(stdout,"------------------------------------------------------------------------------\n");
} }
uint32_t uint32_t
@@ -38,28 +38,28 @@ rtems_monitor_pad(
else else
pad_length = destination_column - current_column; pad_length = destination_column - current_column;
return printf("%*s", pad_length, ""); return fprintf(stdout,"%*s", pad_length, "");
} }
uint32_t uint32_t
rtems_monitor_dump_char(uint8_t ch) rtems_monitor_dump_char(uint8_t ch)
{ {
if (isprint(ch)) if (isprint(ch))
return printf("%c", ch); return fprintf(stdout,"%c", ch);
else else
return printf("%02x", ch); return fprintf(stdout,"%02x", ch);
} }
uint32_t uint32_t
rtems_monitor_dump_decimal(uint32_t num) rtems_monitor_dump_decimal(uint32_t num)
{ {
return printf("%4d", num); return fprintf(stdout,"%4d", num);
} }
uint32_t uint32_t
rtems_monitor_dump_hex(uint32_t num) rtems_monitor_dump_hex(uint32_t num)
{ {
return printf("0x%x", num); return fprintf(stdout,"0x%x", num);
} }
uint32_t uint32_t
@@ -77,14 +77,14 @@ rtems_monitor_dump_assoc_bitfield(
if (b & value) if (b & value)
{ {
if (length) if (length)
length += printf("%s", separator); length += fprintf(stdout,"%s", separator);
name = rtems_assoc_name_by_local(ap, b); name = rtems_assoc_name_by_local(ap, b);
if (name) if (name)
length += printf("%s", name); length += fprintf(stdout,"%s", name);
else else
length += printf("0x%x", b); length += fprintf(stdout,"0x%x", b);
} }
return length; return length;
@@ -93,7 +93,7 @@ rtems_monitor_dump_assoc_bitfield(
uint32_t uint32_t
rtems_monitor_dump_id(rtems_id id) rtems_monitor_dump_id(rtems_id id)
{ {
return printf("%08x", id); return fprintf(stdout,"%08x", id);
} }
uint32_t uint32_t
@@ -121,7 +121,7 @@ rtems_monitor_dump_name(rtems_name name)
uint32_t uint32_t
rtems_monitor_dump_priority(rtems_task_priority priority) rtems_monitor_dump_priority(rtems_task_priority priority)
{ {
return printf("%3d", priority); return fprintf(stdout,"%3d", priority);
} }
@@ -152,7 +152,7 @@ rtems_monitor_dump_state(States_Control state)
uint32_t length = 0; uint32_t length = 0;
if (state == STATES_READY) /* assoc doesn't deal with this as it is 0 */ if (state == STATES_READY) /* assoc doesn't deal with this as it is 0 */
length += printf("READY"); length += fprintf(stdout,"READY");
length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_state_assoc, length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_state_assoc,
":", ":",
@@ -175,7 +175,7 @@ rtems_monitor_dump_attributes(rtems_attribute attributes)
uint32_t length = 0; uint32_t length = 0;
if (attributes == RTEMS_DEFAULT_ATTRIBUTES) /* value is 0 */ if (attributes == RTEMS_DEFAULT_ATTRIBUTES) /* value is 0 */
length += printf("DEFAULT"); length += fprintf(stdout,"DEFAULT");
length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_attribute_assoc, length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_attribute_assoc,
":", ":",
@@ -196,7 +196,7 @@ rtems_monitor_dump_modes(rtems_mode modes)
uint32_t length = 0; uint32_t length = 0;
if (modes == RTEMS_DEFAULT_MODES) /* value is 0 */ if (modes == RTEMS_DEFAULT_MODES) /* value is 0 */
length += printf("P:T:nA"); length += fprintf(stdout,"P:T:nA");
length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_modes_assoc, length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_modes_assoc,
":", ":",
@@ -246,7 +246,7 @@ rtems_monitor_dump_events(rtems_event_set events)
uint32_t length = 0; uint32_t length = 0;
if (events == EVENT_SETS_NONE_PENDING) /* value is 0 */ if (events == EVENT_SETS_NONE_PENDING) /* value is 0 */
length += printf("NONE"); length += fprintf(stdout,"NONE");
length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_events_assoc, length += rtems_monitor_dump_assoc_bitfield(rtems_monitor_events_assoc,
":", ":",
@@ -262,7 +262,7 @@ rtems_monitor_dump_notepad(uint32_t *notepad)
for (i=0; i < RTEMS_NUMBER_NOTEPADS; i++) for (i=0; i < RTEMS_NUMBER_NOTEPADS; i++)
if (notepad[i]) if (notepad[i])
length += printf("%d: 0x%x ", i, notepad[i]); length += fprintf(stdout,"%d: 0x%x ", i, notepad[i]);
return length; return length;
} }

View File

@@ -30,7 +30,7 @@ rtems_monitor_queue_dump_header(
boolean verbose boolean verbose
) )
{ {
printf("\ fprintf(stdout,"\
ID NAME ATTRIBUTES PEND MAXPEND MAXSIZE\n"); ID NAME ATTRIBUTES PEND MAXPEND MAXSIZE\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0 1 2 3 4 5 6 7 */ 0 1 2 3 4 5 6 7 */
@@ -64,5 +64,5 @@ rtems_monitor_queue_dump(
length += rtems_monitor_pad(48, length); length += rtems_monitor_pad(48, length);
length += rtems_monitor_dump_decimal(monitor_queue->maximum_message_size); length += rtems_monitor_dump_decimal(monitor_queue->maximum_message_size);
printf("\n"); fprintf(stdout,"\n");
} }

View File

@@ -396,19 +396,19 @@ rtems_monitor_symbol_dump(
if (canonical_symbol->name[0] && (canonical_symbol->value != 0)) if (canonical_symbol->name[0] && (canonical_symbol->value != 0))
{ {
if (canonical_symbol->offset == 0) if (canonical_symbol->offset == 0)
length += printf("%.*s", length += fprintf(stdout,"%.*s",
(int) sizeof(canonical_symbol->name), (int) sizeof(canonical_symbol->name),
canonical_symbol->name); canonical_symbol->name);
else else
length += printf("<%.*s+0x%x>", length += fprintf(stdout,"<%.*s+0x%x>",
(int) sizeof(canonical_symbol->name), (int) sizeof(canonical_symbol->name),
canonical_symbol->name, canonical_symbol->name,
canonical_symbol->offset); canonical_symbol->offset);
if (verbose) if (verbose)
length += printf(" [0x%x]", canonical_symbol->value); length += fprintf(stdout," [0x%x]", canonical_symbol->value);
} }
else else
length += printf("[0x%x]", canonical_symbol->value); length += fprintf(stdout,"[0x%x]", canonical_symbol->value);
return length; return length;
} }
@@ -439,7 +439,7 @@ rtems_monitor_symbol_dump_all(
rtems_monitor_symbol_canonical(&canonical_symbol, sp); rtems_monitor_symbol_canonical(&canonical_symbol, sp);
rtems_monitor_symbol_dump(&canonical_symbol, TRUE); rtems_monitor_symbol_dump(&canonical_symbol, TRUE);
printf("\n"); fprintf(stdout,"\n");
} }
} }
@@ -480,7 +480,7 @@ rtems_monitor_symbol_cmd(
{ {
rtems_monitor_symbol_canonical_by_name(&canonical_symbol, argv[arg]); rtems_monitor_symbol_canonical_by_name(&canonical_symbol, argv[arg]);
rtems_monitor_symbol_dump(&canonical_symbol, verbose); rtems_monitor_symbol_dump(&canonical_symbol, verbose);
printf("\n"); fprintf(stdout,"\n");
} }
} }
} }

View File

@@ -52,7 +52,7 @@ rtems_monitor_task_dump_header(
boolean verbose boolean verbose
) )
{ {
printf("\ fprintf(stdout,"\
ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES\n"); ID NAME PRIO STAT MODES EVENTS WAITID WAITARG NOTES\n");
/*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0 1 2 3 4 5 6 7 */ 0 1 2 3 4 5 6 7 */
@@ -92,5 +92,5 @@ rtems_monitor_task_dump(
length += rtems_monitor_pad(65, length); length += rtems_monitor_pad(65, length);
length += rtems_monitor_dump_notepad(monitor_task->notepad); length += rtems_monitor_dump_notepad(monitor_task->notepad);
printf("\n"); fprintf(stdout,"\n");
} }

View File

@@ -137,12 +137,12 @@ void Period_usage_Dump( void )
Objects_Information *information; Objects_Information *information;
if ( !Period_usage_Information ) { if ( !Period_usage_Information ) {
printf( "Period statistics library is not initialized\n" ); fprintf(stdout, "Period statistics library is not initialized\n" );
return; return;
} }
printf( "Period information by period\n" ); fprintf(stdout, "Period information by period\n" );
printf( " ID OWNER PERIODS MISSED CPU TIME WALL TIME\n" ); fprintf(stdout, " ID OWNER PERIODS MISSED CPU TIME WALL TIME\n" );
/* /*
* RTEMS does not use an index of zero for object ids. * RTEMS does not use an index of zero for object ids.
@@ -191,7 +191,7 @@ void Period_usage_Dump( void )
if ( !isprint(name[3]) ) name[3] = '*'; if ( !isprint(name[3]) ) name[3] = '*';
printf( fprintf(stdout,
"0x%08x %4s %6d %3d %d/%d/%5.2f %d/%d/%3.2f\n", "0x%08x %4s %6d %3d %d/%d/%5.2f %d/%d/%3.2f\n",
the_usage->id, the_usage->id,
name, name,

View File

@@ -130,14 +130,14 @@ int main_mdump(int argc,char * argv[]) {
max/=16; max/=16;
if (!max) max=20; if (!max) max=20;
for (m=0;m<max;m++) { for (m=0;m<max;m++) {
printf("0x%08X ",adr); fprintf(stdout,"0x%08X ",adr);
pb=(unsigned char*) adr; pb=(unsigned char*) adr;
for (n=0;n<16;n++) for (n=0;n<16;n++)
printf("%02X%c",pb[n],n==7?'-':' '); fprintf(stdout,"%02X%c",pb[n],n==7?'-':' ');
for (n=0;n<16;n++) { for (n=0;n<16;n++) {
printf("%c",isprint(pb[n])?pb[n]:'.'); fprintf(stdout,"%c",isprint(pb[n])?pb[n]:'.');
}; };
printf("\n"); fprintf(stdout,"\n");
adr+=16; adr+=16;
}; };
mdump_adr=adr; mdump_adr=adr;
@@ -153,15 +153,15 @@ int main_mwdump(int argc,char * argv[]) {
max/=16; max/=16;
if (!max) max=20; if (!max) max=20;
for (m=0;m<max;m++) { for (m=0;m<max;m++) {
printf("0x%08X ",adr); fprintf(stdout,"0x%08X ",adr);
pw=(unsigned short*) adr; pw=(unsigned short*) adr;
for (n=0;n<8;n++) for (n=0;n<8;n++)
printf("%02X %02X%c",pw[n]/0x100,pw[n]%0x100,n==3?'-':' '); fprintf(stdout,"%02X %02X%c",pw[n]/0x100,pw[n]%0x100,n==3?'-':' ');
for (n=0;n<8;n++) { for (n=0;n<8;n++) {
printf("%c",isprint(pw[n]/0x100)?pw[n]/0x100:'.'); fprintf(stdout,"%c",isprint(pw[n]/0x100)?pw[n]/0x100:'.');
printf("%c",isprint(pw[n]%0x100)?pw[n]%0x100:'.'); fprintf(stdout,"%c",isprint(pw[n]%0x100)?pw[n]%0x100:'.');
}; };
printf("\n"); fprintf(stdout,"\n");
adr+=16; adr+=16;
}; };
mdump_adr=adr; mdump_adr=adr;
@@ -172,7 +172,7 @@ int main_medit(int argc,char * argv[]) {
unsigned char * pb; unsigned char * pb;
int n,i; int n,i;
if (argc<3) { if (argc<3) {
printf("too few arguments\n"); fprintf(stdout,"too few arguments\n");
return 0; return 0;
}; };
pb=(unsigned char*)str2int(argv[1]); pb=(unsigned char*)str2int(argv[1]);
@@ -190,7 +190,7 @@ int main_mfill(int argc,char * argv[]) {
int size; int size;
unsigned char value; unsigned char value;
if (argc<4) { if (argc<4) {
printf("too few arguments\n"); fprintf(stdout,"too few arguments\n");
return 0; return 0;
}; };
adr =str2int(argv[1]); adr =str2int(argv[1]);
@@ -206,7 +206,7 @@ int main_mmove(int argc,char * argv[]) {
int dst; int dst;
int size; int size;
if (argc<4) { if (argc<4) {
printf("too few arguments\n"); fprintf(stdout,"too few arguments\n");
return 0; return 0;
}; };
dst =str2int(argv[1]); dst =str2int(argv[1]);
@@ -230,7 +230,7 @@ int main_malloc_dump(int argc,char * argv[]) {
int main_reset (int argc, char **argv) int main_reset (int argc, char **argv)
{ {
rtems_interrupt_level level; rtems_interrupt_level level;
printf ("Waiting for watchdog ... "); fprintf(stdout,"Waiting for watchdog ... ");
tcdrain(fileno(stdout)); tcdrain(fileno(stdout));
rtems_interrupt_disable (level); rtems_interrupt_disable (level);
@@ -244,11 +244,11 @@ int main_reset (int argc, char **argv)
int main_alias (int argc, char **argv) int main_alias (int argc, char **argv)
{ {
if (argc<3) { if (argc<3) {
printf("too few arguments\n"); fprintf(stdout,"too few arguments\n");
return 1; return 1;
}; };
if (!shell_alias_cmd(argv[1],argv[2])) { if (!shell_alias_cmd(argv[1],argv[2])) {
printf("unable to make an alias(%s,%s)\n",argv[1],argv[2]); fprintf(stdout,"unable to make an alias(%s,%s)\n",argv[1],argv[2]);
}; };
return 0; return 0;
} }
@@ -274,7 +274,7 @@ int main_ls(int argc, char *argv[])
if ((dirp = opendir(fname)) == NULL) if ((dirp = opendir(fname)) == NULL)
{ {
printf("%s: No such file or directory.\n", fname); fprintf(stdout,"%s: No such file or directory.\n", fname);
return errno; return errno;
} }
n=0; n=0;
@@ -291,7 +291,7 @@ int main_ls(int argc, char *argv[])
user=pwd?pwd->pw_name:"nouser"; user=pwd?pwd->pw_name:"nouser";
grp=getgrgid(stat_buf.st_gid); grp=getgrgid(stat_buf.st_gid);
group=grp?grp->gr_name:"nogrp"; group=grp?grp->gr_name:"nogrp";
printf("%c%c%c%c%c%c%c%c%c%c %3d %6.6s %6.6s %11d %s %s%c\n", fprintf(stdout,"%c%c%c%c%c%c%c%c%c%c %3d %6.6s %6.6s %11d %s %s%c\n",
(S_ISLNK(stat_buf.st_mode)?('l'): (S_ISLNK(stat_buf.st_mode)?('l'):
(S_ISDIR(stat_buf.st_mode)?('d'):('-'))), (S_ISDIR(stat_buf.st_mode)?('d'):('-'))),
(stat_buf.st_mode & S_IRUSR)?('r'):('-'), (stat_buf.st_mode & S_IRUSR)?('r'):('-'),
@@ -313,7 +313,7 @@ int main_ls(int argc, char *argv[])
size+=stat_buf.st_size; size+=stat_buf.st_size;
} }
} }
printf("%d files %d bytes occupied\n",n,size); fprintf(stdout,"%d files %d bytes occupied\n",n,size);
closedir(dirp); closedir(dirp);
return 0; return 0;
} }
@@ -321,7 +321,7 @@ int main_ls(int argc, char *argv[])
int main_pwd (int argc, char *argv[]) { int main_pwd (int argc, char *argv[]) {
char dir[1024]; char dir[1024];
getcwd(dir,1024); getcwd(dir,1024);
printf("%s\n",dir); fprintf(stdout,"%s\n",dir);
return 0; return 0;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@@ -330,7 +330,7 @@ int main_chdir (int argc, char *argv[]) {
dir="/"; dir="/";
if (argc>1) dir=argv[1]; if (argc>1) dir=argv[1];
if (chdir(dir)) { if (chdir(dir)) {
printf("chdir to '%s' failed:%s\n",dir,strerror(errno)); fprintf(stdout,"chdir to '%s' failed:%s\n",dir,strerror(errno));
return errno; return errno;
}; };
return 0; return 0;
@@ -343,7 +343,7 @@ int main_mkdir (int argc, char *argv[]) {
while (n<argc) { while (n<argc) {
dir=argv[n++]; dir=argv[n++];
if (mkdir(dir,S_IRWXU|S_IRWXG|S_IRWXO)) { if (mkdir(dir,S_IRWXU|S_IRWXG|S_IRWXO)) {
printf("mkdir '%s' failed:%s\n",dir,strerror(errno)); fprintf(stdout,"mkdir '%s' failed:%s\n",dir,strerror(errno));
}; };
}; };
return errno; return errno;
@@ -356,7 +356,7 @@ int main_rmdir (int argc, char *argv[])
n=1; n=1;
while (n<argc) { while (n<argc) {
dir=argv[n++]; dir=argv[n++];
if (rmdir(dir)) printf("rmdir '%s' failed:%s\n",dir,strerror(errno)); if (rmdir(dir)) fprintf(stdout,"rmdir '%s' failed:%s\n",dir,strerror(errno));
}; };
return errno; return errno;
} }
@@ -365,7 +365,7 @@ int main_chroot(int argc,char * argv[]) {
char * new_root="/"; char * new_root="/";
if (argc==2) new_root=argv[1]; if (argc==2) new_root=argv[1];
if (chroot(new_root)<0) { if (chroot(new_root)<0) {
printf("error %s:chroot(%s);\n",strerror(errno),new_root); fprintf(stdout,"error %s:chroot(%s);\n",strerror(errno),new_root);
return -1; return -1;
}; };
return 0; return 0;
@@ -385,7 +385,7 @@ int main_rm (int argc, char *argv[])
n=1; n=1;
while (n<argc) { while (n<argc) {
if (unlink(argv[n])) { if (unlink(argv[n])) {
printf("error %s:rm %s\n",strerror(errno),argv[n]); fprintf(stdout,"error %s:rm %s\n",strerror(errno),argv[n]);
return -1; return -1;
}; };
n++; n++;
@@ -399,20 +399,20 @@ int main_date(int argc,char *argv[])
{ {
time_t t; time_t t;
time(&t); time(&t);
printf("%s", ctime(&t)); fprintf(stdout,"%s", ctime(&t));
return 0; return 0;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
int main_logoff(int argc,char *argv[]) int main_logoff(int argc,char *argv[])
{ {
printf("logoff from the system..."); fprintf(stdout,"logoff from the system...");
current_shell_env->exit_shell=TRUE; current_shell_env->exit_shell=TRUE;
return 0; return 0;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
int main_tty (int argc,char *argv[]) int main_tty (int argc,char *argv[])
{ {
printf("%s\n",ttyname(fileno(stdin))); fprintf(stdout,"%s\n",ttyname(fileno(stdin)));
return 0; return 0;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@@ -420,7 +420,7 @@ int main_whoami(int argc,char *argv[])
{ {
struct passwd * pwd; struct passwd * pwd;
pwd=getpwuid(getuid()); pwd=getpwuid(getuid());
printf("%s\n",pwd?pwd->pw_name:"nobody"); fprintf(stdout,"%s\n",pwd?pwd->pw_name:"nobody");
return 0; return 0;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
@@ -430,12 +430,12 @@ int main_id (int argc,char *argv[])
struct group * grp; struct group * grp;
pwd=getpwuid(getuid()); pwd=getpwuid(getuid());
grp=getgrgid(getgid()); grp=getgrgid(getgid());
printf("uid=%d(%s),gid=%d(%s),", fprintf(stdout,"uid=%d(%s),gid=%d(%s),",
getuid(),pwd?pwd->pw_name:"", getuid(),pwd?pwd->pw_name:"",
getgid(),grp?grp->gr_name:""); getgid(),grp?grp->gr_name:"");
pwd=getpwuid(geteuid()); pwd=getpwuid(geteuid());
grp=getgrgid(getegid()); grp=getgrgid(getegid());
printf("euid=%d(%s),egid=%d(%s)\n", fprintf(stdout,"euid=%d(%s),egid=%d(%s)\n",
geteuid(),pwd?pwd->pw_name:"", geteuid(),pwd?pwd->pw_name:"",
getegid(),grp?grp->gr_name:""); getegid(),grp?grp->gr_name:"");
return 0; return 0;
@@ -447,7 +447,7 @@ int main_umask(int argc,char *argv[])
if (argc == 2) msk=str2int(argv[1]); if (argc == 2) msk=str2int(argv[1]);
umask(msk); umask(msk);
msk=umask(0); msk=umask(0);
printf("0%o\n", (unsigned int) msk); fprintf(stdout,"0%o\n", (unsigned int) msk);
umask(msk); umask(msk);
return 0; return 0;
} }

View File

@@ -180,11 +180,11 @@ int shell_make_args(char * cmd,
int shell_help_cmd(shell_cmd_t * shell_cmd) { int shell_help_cmd(shell_cmd_t * shell_cmd) {
char * pc; char * pc;
int col,line; int col,line;
printf("%-10.10s -",shell_cmd->name); fprintf(stdout,"%-10.10s -",shell_cmd->name);
col=12; col=12;
line=1; line=1;
if (shell_cmd->alias) { if (shell_cmd->alias) {
printf("is an <alias> for command '%s'",shell_cmd->alias->name); fprintf(stdout,"is an <alias> for command '%s'",shell_cmd->alias->name);
} else } else
if (shell_cmd->usage) { if (shell_cmd->usage) {
pc=shell_cmd->usage; pc=shell_cmd->usage;
@@ -206,7 +206,7 @@ int shell_help_cmd(shell_cmd_t * shell_cmd) {
}; };
}; };
if (!col && *pc) { if (!col && *pc) {
printf(" "); fprintf(stdout," ");
col=12;line++; col=12;line++;
}; };
}; };
@@ -224,51 +224,51 @@ int shell_help(int argc,char * argv[]) {
shell_topic_t *topic; shell_topic_t *topic;
shell_cmd_t * shell_cmd=shell_first_cmd; shell_cmd_t * shell_cmd=shell_first_cmd;
if (argc<2) { if (argc<2) {
printf("help: ('r' repeat last cmd - 'e' edit last cmd)\n" fprintf(stdout,"help: ('r' repeat last cmd - 'e' edit last cmd)\n"
" TOPIC? The topics are\n"); " TOPIC? The topics are\n");
topic=shell_first_topic; topic=shell_first_topic;
col=0; col=0;
while (topic) { while (topic) {
if (!col){ if (!col){
col=printf(" %s",topic->topic); col=fprintf(stdout," %s",topic->topic);
} else { } else {
if ((col+strlen(topic->topic)+2)>78){ if ((col+strlen(topic->topic)+2)>78){
printf("\n"); fprintf(stdout,"\n");
col=printf(" %s",topic->topic); col=fprintf(stdout," %s",topic->topic);
} else { } else {
col+=printf(", %s",topic->topic); col+=fprintf(stdout,", %s",topic->topic);
}; };
}; };
topic=topic->next; topic=topic->next;
}; };
printf("\n"); fprintf(stdout,"\n");
return 1; return 1;
}; };
line=0; line=0;
for (arg=1;arg<argc;arg++) { for (arg=1;arg<argc;arg++) {
if (line>16) { if (line>16) {
printf("Press any key to continue...");getchar(); fprintf(stdout,"Press any key to continue...");getchar();
printf("\n"); fprintf(stdout,"\n");
line=0; line=0;
}; };
topic=shell_lookup_topic(argv[arg]); topic=shell_lookup_topic(argv[arg]);
if (!topic){ if (!topic){
if ((shell_cmd=shell_lookup_cmd(argv[arg]))==NULL) { if ((shell_cmd=shell_lookup_cmd(argv[arg]))==NULL) {
printf("help: topic or cmd '%s' not found. Try <help> alone for a list\n",argv[arg]); fprintf(stdout,"help: topic or cmd '%s' not found. Try <help> alone for a list\n",argv[arg]);
line++; line++;
} else { } else {
line+=shell_help_cmd(shell_cmd); line+=shell_help_cmd(shell_cmd);
} }
continue; continue;
}; };
printf("help: list for the topic '%s'\n",argv[arg]); fprintf(stdout,"help: list for the topic '%s'\n",argv[arg]);
line++; line++;
while (shell_cmd) { while (shell_cmd) {
if (!strcmp(topic->topic,shell_cmd->topic)) if (!strcmp(topic->topic,shell_cmd->topic))
line+=shell_help_cmd(shell_cmd); line+=shell_help_cmd(shell_cmd);
if (line>16) { if (line>16) {
printf("Press any key to continue...");getchar(); fprintf(stdout,"Press any key to continue...");getchar();
printf("\n"); fprintf(stdout,"\n");
line=0; line=0;
}; };
shell_cmd=shell_cmd->next; shell_cmd=shell_cmd->next;
@@ -569,7 +569,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
setvbuf(stdout,NULL,_IONBF,0); /* Not buffered*/ setvbuf(stdout,NULL,_IONBF,0); /* Not buffered*/
stderr=fopen(devname,"r+"); stderr=fopen(devname,"r+");
if (!stderr) { if (!stderr) {
printf("shell:unable to open stderr.%s:%s\n",devname,strerror(errno)); fprintf(stdout,"shell:unable to open stderr.%s:%s\n",devname,strerror(errno));
}; };
/* when the future user environment runs ok /* when the future user environment runs ok
* a freopen() reopens the terminals. Now this don't work * a freopen() reopens the terminals. Now this don't work
@@ -588,7 +588,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
cat_file(stdout,"/etc/motd"); cat_file(stdout,"/etc/motd");
strcpy(last_cmd,""); strcpy(last_cmd,"");
strcpy(cmd,""); strcpy(cmd,"");
printf("\n" fprintf(stdout,"\n"
"RTEMS SHELL (Ver.1.0-FRC):%s. "__DATE__". 'help' to list commands.\n",devname); "RTEMS SHELL (Ver.1.0-FRC):%s. "__DATE__". 'help' to list commands.\n",devname);
chdir("/"); /* XXX: chdir to getpwent homedir */ chdir("/"); /* XXX: chdir to getpwent homedir */
shell_env->exit_shell=FALSE; shell_env->exit_shell=FALSE;
@@ -596,7 +596,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
/* Prompt section */ /* Prompt section */
/* XXX: show_prompt user adjustable */ /* XXX: show_prompt user adjustable */
getcwd(curdir,sizeof(curdir)); getcwd(curdir,sizeof(curdir));
printf("%s [%s] %c ",shell_env->taskname,curdir,geteuid()?'$':'#'); fprintf(stdout,"%s [%s] %c ",shell_env->taskname,curdir,geteuid()?'$':'#');
/* getcmd section */ /* getcmd section */
if (!shell_scanline(cmd,sizeof(cmd),stdin,stdout)) break; /*EOF*/ if (!shell_scanline(cmd,sizeof(cmd),stdin,stdout)) break; /*EOF*/
/* evaluate cmd section */ /* evaluate cmd section */
@@ -621,7 +621,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
if ((shell_cmd=shell_lookup_cmd(argv[0]))!=NULL) { if ((shell_cmd=shell_lookup_cmd(argv[0]))!=NULL) {
shell_env->errorlevel=shell_cmd->command(argc,argv); shell_env->errorlevel=shell_cmd->command(argc,argv);
} else { } else {
printf("shell:%s command not found\n",argv[0]); fprintf(stdout,"shell:%s command not found\n",argv[0]);
shell_env->errorlevel=-1; shell_env->errorlevel=-1;
}; };
}; };
@@ -629,7 +629,7 @@ rtems_task shell_shell(rtems_task_argument task_argument) {
if (shell_env->exit_shell) break; if (shell_env->exit_shell) break;
cmd[0]=0; cmd[0]=0;
}; };
printf("\nGoodbye from RTEMS SHELL :-(\n"); fprintf(stdout,"\nGoodbye from RTEMS SHELL :-(\n");
}; };
} while (shell_env->forever); } while (shell_env->forever);
fclose(stdin ); fclose(stdin );

View File

@@ -16,14 +16,14 @@
#ifndef __SHELL_H__ #ifndef __SHELL_H__
#define __SHELL_H__ #define __SHELL_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <rtems.h> #include <rtems.h>
#include <stdio.h> #include <stdio.h>
#include <termios.h> #include <termios.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int (*shell_command_t)(int argc,char * argv[]); typedef int (*shell_command_t)(int argc,char * argv[]);
struct shell_cmd_tt ; struct shell_cmd_tt ;

View File

@@ -480,7 +480,7 @@ void Stack_check_Dump_threads_usage(
name[ 4 ] = '\0'; name[ 4 ] = '\0';
} }
printf( "0x%08x %4s 0x%08x 0x%08x %8d %8d\n", fprintf(stdout, "0x%08x %4s 0x%08x 0x%08x %8d %8d\n",
the_thread ? the_thread->Object.id : ~0, the_thread ? the_thread->Object.id : ~0,
name, name,
(uint32_t ) stack->area, (uint32_t ) stack->area,
@@ -524,8 +524,8 @@ void Stack_check_Dump_usage( void )
if (stack_check_initialized == 0) if (stack_check_initialized == 0)
return; return;
printf("Stack usage by thread\n"); fprintf(stdout,"Stack usage by thread\n");
printf( fprintf(stdout,
" ID NAME LOW HIGH AVAILABLE USED\n" " ID NAME LOW HIGH AVAILABLE USED\n"
); );

View File

@@ -204,7 +204,7 @@ Untar_FromMemory(unsigned char *tar_buf, unsigned long size)
nblocks = (((file_size) + 511) & ~511) / 512; nblocks = (((file_size) + 511) & ~511) / 512;
if ((fp = fopen(fname, "w")) == NULL) if ((fp = fopen(fname, "w")) == NULL)
{ {
printf("Untar failed to create file %s\n", fname); fprintf(stdout,"Untar failed to create file %s\n", fname);
ptr += 512 * nblocks; ptr += 512 * nblocks;
} }
else else
@@ -222,7 +222,7 @@ Untar_FromMemory(unsigned char *tar_buf, unsigned long size)
n = fwrite(&tar_buf[ptr], 1, len, fp); n = fwrite(&tar_buf[ptr], 1, len, fp);
if (n != len) if (n != len)
{ {
printf("Error during write\n"); fprintf(stdout,"Error during write\n");
break; break;
} }
ptr += 512; ptr += 512;