source: rtems/cpukit/libmisc/shell/cat_file.c @ 26597fc1

4.11
Last change on this file since 26597fc1 was 26597fc1, checked in by Ralf Corsepius <ralf.corsepius@…>, on Dec 4, 2011 at 9:39:44 AM

2011-12-04 Ralf Corsépius <ralf.corsepius@…>

  • libmisc/shell/cat_file.c: #include <rtems/shell.h>.
  • libmisc/shell/filemode.c: #include "internal.h".
  • libmisc/shell/shell.h: Declare functions "extern".
  • Property mode set to 100644
File size: 634 bytes
Line 
1/*
2 *  CAT Command Implementation
3 *
4 *  Author:
5 *   WORK: fernando.ruiz@ctv.es
6 *   HOME: correo@fernando-ruiz.com
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 *
12 *  $Id$
13 */
14
15#ifdef HAVE_CONFIG_H
16#include "config.h"
17#endif
18
19#include <stdio.h>
20#include <rtems/shell.h>
21
22int rtems_shell_cat_file(FILE * out,const char * name) {
23  FILE * fd;
24  int c;
25
26  if (out) {
27    fd = fopen(name,"r");
28    if (!fd) {
29      return -1;
30    }
31    while ((c=fgetc(fd))!=EOF)
32      fputc(c,out);
33    fclose(fd);
34  }
35  return 0;
36}
37
38
Note: See TracBrowser for help on using the repository browser.