diff options
Diffstat (limited to 'cpukit/libmisc/shell/cat_file.c')
-rw-r--r-- | cpukit/libmisc/shell/cat_file.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/cpukit/libmisc/shell/cat_file.c b/cpukit/libmisc/shell/cat_file.c new file mode 100644 index 0000000000..1a5efb4418 --- /dev/null +++ b/cpukit/libmisc/shell/cat_file.c @@ -0,0 +1,37 @@ +/* + * 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; +} + + |