forked from Imagelibrary/rtems
* libmisc/serdbg/termios_printk.c, libmisc/serdbg/termios_printk.h: Fixed incompatible return value. * libmisc/cpuuse/cpuusagereport.c: Changed output format. * libmisc/Makefile.am, libmisc/monitor/mon-editor.c: New file. * libmisc/capture/capture-cli.c, libmisc/monitor/mon-command.c, libmisc/monitor/mon-monitor.c, libmisc/monitor/mon-object.c, libmisc/monitor/mon-prmisc.c, libmisc/monitor/mon-symbols.c, libmisc/monitor/monitor.h, libmisc/shell/cat_file.c, libmisc/shell/cmds.c, libmisc/shell/internal.h, libmisc/shell/main_help.c, libmisc/shell/shell.c, libmisc/shell/shell.h, libmisc/shell/shell_cmdset.c, libmisc/shell/shell_getchar.c, libmisc/shell/str2int.c: Various global data is now read only. Added 'const' qualifier to many pointer parameters. It is no longer possible to remove monitor commands. Moved monitor line editor into a separate file to avoid unnecessary dependencies.
38 lines
609 B
C
38 lines
609 B
C
/*
|
|
* CAT Command Implementation
|
|
*
|
|
* Author:
|
|
* WORK: fernando.ruiz@ctv.es
|
|
* HOME: correo@fernando-ruiz.com
|
|
*
|
|
* The license and distribution terms for this file may be
|
|
* found in the file LICENSE in this distribution or at
|
|
* http://www.rtems.com/license/LICENSE.
|
|
*
|
|
* $Id$
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include <stdio.h>
|
|
|
|
int rtems_shell_cat_file(FILE * out,const char * name) {
|
|
FILE * fd;
|
|
int c;
|
|
|
|
if (out) {
|
|
fd = fopen(name,"r");
|
|
if (!fd) {
|
|
return -1;
|
|
}
|
|
while ((c=fgetc(fd))!=EOF)
|
|
fputc(c,out);
|
|
fclose(fd);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
|