source:
rtems/cpukit/libmisc/shell/cat_file.c
@
26597fc1
Last change on this file since 26597fc1 was 26597fc1, checked in by Ralf Corsepius <ralf.corsepius@…>, on 12/04/11 at 09:39:44 | |
---|---|
|
|
File size: 634 bytes |
Rev | Line | |
---|---|---|
[4e5299f] | 1 | /* |
[8fdadc8] | 2 | * CAT Command Implementation |
[4e5299f] | 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> | |
[26597fc1] | 20 | #include <rtems/shell.h> |
[4e5299f] | 21 | |
[e41eaa88] | 22 | int rtems_shell_cat_file(FILE * out,const char * name) { |
[4e5299f] | 23 | FILE * fd; |
24 | int c; | |
25 | ||
26 | if (out) { | |
27 | fd = fopen(name,"r"); | |
[dfe0e58] | 28 | if (!fd) { |
29 | return -1; | |
[4e5299f] | 30 | } |
[dfe0e58] | 31 | while ((c=fgetc(fd))!=EOF) |
32 | fputc(c,out); | |
33 | fclose(fd); | |
[4e5299f] | 34 | } |
[dfe0e58] | 35 | return 0; |
[4e5299f] | 36 | } |
37 | ||
38 |
Note: See TracBrowser
for help on using the repository browser.