Files
rtems/cpukit/libmisc/shell/cat_file.c
Joel Sherrill 5f8c41c389 Update email address of Fernando Ruiz Casas to <fruizcasas@gmail.com>
This was requested to be executed prior to relicensing to BSD-2.
2022-04-05 13:13:31 -05:00

39 lines
632 B
C

/**
* @file
*
* @brief CAT Command Implementation
*/
/*
* Copyright (c) 2001 Fernando Ruiz Casas <fruizcasas@gmail.com>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <rtems/shell.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;
}