Last change
on this file was
5f8c41c,
checked in by Joel Sherrill <joel@…>, on 04/01/22 at 18:18:49
|
Update email address of Fernando Ruiz Casas to <fruizcasas@…>
This was requested to be executed prior to relicensing to BSD-2.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief CHDIR Shell Command Implmentation |
---|
5 | */ |
---|
6 | |
---|
7 | /* |
---|
8 | * Copyright (c) 2001 Fernando Ruiz Casas <fruizcasas@gmail.com> |
---|
9 | * |
---|
10 | * The license and distribution terms for this file may be |
---|
11 | * found in the file LICENSE in this distribution or at |
---|
12 | * http://www.rtems.org/license/LICENSE. |
---|
13 | */ |
---|
14 | |
---|
15 | #ifdef HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <stdio.h> |
---|
20 | #include <unistd.h> |
---|
21 | #include <string.h> |
---|
22 | #include <errno.h> |
---|
23 | |
---|
24 | #include <rtems.h> |
---|
25 | #include <rtems/shell.h> |
---|
26 | #include "internal.h" |
---|
27 | |
---|
28 | static int rtems_shell_main_chdir( |
---|
29 | int argc, |
---|
30 | char *argv[] |
---|
31 | ) |
---|
32 | { |
---|
33 | char *dir; |
---|
34 | |
---|
35 | dir = "/"; |
---|
36 | |
---|
37 | if (argc > 1) |
---|
38 | dir = argv[1]; |
---|
39 | |
---|
40 | if (chdir(dir)) { |
---|
41 | fprintf(stderr, "chdir to '%s' failed:%s\n", dir,strerror(errno)); |
---|
42 | return errno; |
---|
43 | } |
---|
44 | return 0; |
---|
45 | } |
---|
46 | |
---|
47 | rtems_shell_cmd_t rtems_shell_CHDIR_Command = { |
---|
48 | "chdir", /* name */ |
---|
49 | "chdir [dir] # change the current directory", /* usage */ |
---|
50 | "files", /* topic */ |
---|
51 | rtems_shell_main_chdir, /* command */ |
---|
52 | NULL, /* alias */ |
---|
53 | NULL /* next */ |
---|
54 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.