4.115
Last change
on this file since 7eada71 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * CHDIR Shell Command Implmentation |
---|
3 | * |
---|
4 | * Author: Fernando RUIZ CASAS |
---|
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.org/license/LICENSE. |
---|
11 | */ |
---|
12 | |
---|
13 | #ifdef HAVE_CONFIG_H |
---|
14 | #include "config.h" |
---|
15 | #endif |
---|
16 | |
---|
17 | #include <stdio.h> |
---|
18 | #include <unistd.h> |
---|
19 | #include <string.h> |
---|
20 | #include <errno.h> |
---|
21 | |
---|
22 | #include <rtems.h> |
---|
23 | #include <rtems/shell.h> |
---|
24 | #include "internal.h" |
---|
25 | |
---|
26 | static int rtems_shell_main_chdir( |
---|
27 | int argc, |
---|
28 | char *argv[] |
---|
29 | ) |
---|
30 | { |
---|
31 | char *dir; |
---|
32 | |
---|
33 | dir = "/"; |
---|
34 | |
---|
35 | if (argc > 1) |
---|
36 | dir = argv[1]; |
---|
37 | |
---|
38 | if (chdir(dir)) { |
---|
39 | fprintf(stderr, "chdir to '%s' failed:%s\n", dir,strerror(errno)); |
---|
40 | return errno; |
---|
41 | } |
---|
42 | return 0; |
---|
43 | } |
---|
44 | |
---|
45 | rtems_shell_cmd_t rtems_shell_CHDIR_Command = { |
---|
46 | "chdir", /* name */ |
---|
47 | "chdir [dir] # change the current directory", /* usage */ |
---|
48 | "files", /* topic */ |
---|
49 | rtems_shell_main_chdir, /* command */ |
---|
50 | NULL, /* alias */ |
---|
51 | NULL /* next */ |
---|
52 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.