diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html
index c0f5b6ea879..dbdf99614be 100644
--- a/Documentation/NuttShell.html
+++ b/Documentation/NuttShell.html
@@ -8,7 +8,7 @@
NuttShell (NSH)
- Last Updated: August 28, 2018
+ Last Updated: September 30, 2018
|
@@ -191,325 +191,331 @@
|
- 2.18 Execute User Code (exec)
+ 2.18 Show Environment Variables (env)
|
|
- 2.19 Exit NSH (exit)
+ 2.19 Execute User Code (exec)
|
|
- 2.20 Show Memory Manager Status (free)
+ 2.20 Exit NSH (exit)
|
|
- 2.21 Get File Via TFTP (get)
+ 2.21 Show Memory Manager Status (free)
|
|
- 2.22 Show Usage Command Usage (help)
+ 2.22 Get File Via TFTP (get)
|
|
- 2.23 Hexadecimal Dump of File or Device (hexdump)
+ 2.23 Show Usage Command Usage (help)
|
|
- 2.24 Manage Network Configuration (ifconfig)
+ 2.24 Hexadecimal Dump of File or Device (hexdump)
|
|
- 2.25 Take a network down (ifdown)
+ 2.25 Manage Network Configuration (ifconfig)
|
|
- 2.26 Bring a network up (ifup)
+ 2.26 Take a network down (ifdown)
|
|
- 2.27 Install an OS module (insmod)
+ 2.27 Bring a network up (ifup)
|
|
- 2.28 Show Interrupt Status (irqinfo)
+ 2.28 Install an OS module (insmod)
|
|
- 2.29 Send a signal to a task (kill)
+ 2.29 Show Interrupt Status (irqinfo)
|
|
- 2.30 Setup/teardown the Loop Device (losetup)
+ 2.30 Send a signal to a task (kill)
|
|
- 2.31 List to a File or Directory (ln)
+ 2.31 Setup/teardown the Loop Device (losetup)
|
|
- 2.32 List Directory Contents (ls)
+ 2.32 List to a File or Directory (ln)
|
|
- 2.33 Show information about installed OS modules (lsmod)
+ 2.33 List Directory Contents (ls)
|
|
- 2.34 Calculate MD5 (md5)
+ 2.34 Show information about installed OS modules (lsmod)
|
|
- 2.35 Access Memory (mb, mh, and mw)
+ 2.35 Calculate MD5 (md5)
|
|
- 2.36 Show Current Tasks and Threads (ps)
+ 2.36 Access Memory (mb, mh, and mw)
|
|
- 2.37 Create a Directory (mkdir)
+ 2.37 Show Current Tasks and Threads (ps)
|
|
- 2.38 Create a FAT File System (mkfatfs)
+ 2.38 Create a Directory (mkdir)
|
|
- 2.39 Create a FIFO (mkfifo)
+ 2.39 Create a FAT File System (mkfatfs)
|
|
- 2.40 Create a RAMDISK (mkrd)
+ 2.40 Create a FIFO (mkfifo)
|
|
- 2.41 Mount a File System (mount)
+ 2.41 Create a RAMDISK (mkrd)
|
|
- 2.42 Rename a File (mv)
+ 2.42 Mount a File System (mount)
|
|
- 2.43 Mount an NFS File System (nfsmount)
+ 2.43 Rename a File (mv)
|
|
- 2.44 Lookup a network address (nslookup)
+ 2.44 Mount an NFS File System (nfsmount)
|
|
- 2.45 Change a User's Password (passwd)
+ 2.45 Lookup a network address (nslookup)
|
|
- 2.46 Shut the system down (poweroff)
+ 2.46 Change a User's Password (passwd)
|
|
- 2.47 Send File Via TFTP (put)
+ 2.47 Shut the system down (poweroff)
|
|
- 2.48 Show Current Working Directory (pwd)
+ 2.48 Send File Via TFTP (put)
|
|
- 2.49 Show target of a link (readlink)
+ 2.49 Show Current Working Directory (pwd)
|
|
- 2.50 Reset and reboot the system (reboot)
+ 2.50 Show target of a link (readlink)
|
|
- 2.51 Remove a File (rm)
+ 2.51 Reset and reboot the system (reboot)
|
|
- 2.52 Remove a Directory (rmdir)
+ 2.52 Remove a File (rm)
|
|
- 2.53 Remove on OS Module (rmmod)
+ 2.53 Remove a Directory (rmdir)
|
|
- 2.54 Show routing table (route)
+ 2.54 Remove on OS Module (rmmod)
|
|
- 2.55 Set an Environment Variable (set)
+ 2.55 Show routing table (route)
|
|
- 2.56 Execute an NSH Script (sh)
+ 2.56 Set an Environment Variable (set)
|
|
- 2.57 Shut the system down (shutdown)
+ 2.57 Execute an NSH Script (sh)
|
|
- 2.58 Wait for Seconds (sleep)
+ 2.58 Shut the system down (shutdown)
|
|
- 2.59 Start the Telnet Daemon (telnetd)
+ 2.59 Wait for Seconds (sleep)
|
|
- 2.60 Time execution of another command (time)
+ 2.60 Start the Telnet Daemon (telnetd)
|
|
- 2.61 Set the Size of a File (truncate)
+ 2.61 Time execution of another command (time)
|
|
- 2.62 Unmount a File System (umount)
+ 2.62 Set the Size of a File (truncate)
|
|
- 2.63 Print system information (uname)
+ 2.63 Unmount a File System (umount)
|
|
- 2.64 Unset an Environment Variable (unset)
+ 2.64 Print system information (uname)
|
|
- 2.65 URL Decode (urldecode)
+ 2.65 Unset an Environment Variable (unset)
|
|
- 2.66 URL Encode (urlencode)
+ 2.66 URL Decode (urldecode)
|
|
- 2.67 Add a New User (useradd)
+ 2.67 URL Encode (urlencode)
|
|
- 2.68 Delete a user (userdel)
+ 2.68 Add a New User (useradd)
|
|
- 2.69 Wait for Microseconds (usleep)
+ 2.69 Delete a user (userdel)
|
|
- 2.70 Get File Via HTTP (wget)
+ 2.70 Wait for Microseconds (usleep)
|
|
- 2.71 Hexadecimal Dump of Memory (xd)
+ 2.71 Get File Via HTTP (wget)
+ |
+
+
+
|
+
+ 2.72 Hexadecimal Dump of Memory (xd)
|
@@ -1647,7 +1653,39 @@ echo [-n] [<string|$name> [<string|$name>...]]
+
+Command Syntax:
+
+env
+
+
+ Synopsis.
+ Show the current address environment. Example:.
+
+
+nsh> env
+PATH=/bin
+
+nsh> set foo bar
+nsh> env
+PATH=/bin
+foo=bar
+
+nsh> unset PATH
+nsh> env
+foo=bar
+
+nsh>
+
+
+
@@ -1666,7 +1704,7 @@ exec <hex-address>
@@ -1685,7 +1723,7 @@ exit
@@ -1727,7 +1765,7 @@ nsh>
@@ -1762,7 +1800,7 @@ get [-b|-n] [-f <local-path>] -h <ip-address> <remote-path>
@@ -1794,7 +1832,7 @@ help [-v] [<cmd>]
@@ -1824,7 +1862,7 @@ The skip and count options are only available if
- 2.24 Manage Network Configuration (ifconfig)
+ 2.25 Manage Network Configuration (ifconfig)
|
@@ -1886,7 +1924,7 @@ nsh> mount -t procfs /proc
@@ -1909,7 +1947,7 @@ ifdown eth0
@@ -1932,7 +1970,7 @@ ifup eth0
@@ -2002,7 +2040,7 @@ IRQ HANDLER ARGUMENT COUNT RATE
@@ -2049,7 +2087,7 @@ nsh>
@@ -2102,7 +2140,7 @@ losetup d <dev-path>
@@ -2127,7 +2165,7 @@ ln [-s] <target> <link>
@@ -2165,7 +2203,7 @@ ls [-lRs] <dir-path>
@@ -2198,7 +2236,7 @@ mydriver 20404659 20404625 0 20404580 552 204047a8 0
@@ -2215,7 +2253,7 @@ md5 [-f] <string or filepath>
@@ -2268,7 +2306,7 @@ nsh>
@@ -2302,7 +2340,7 @@ nsh> mount -t procfs /proc
@@ -2337,7 +2375,7 @@ nsh>
@@ -2369,7 +2407,7 @@ mkfatfs [-F <fatsize>] [-r <rootdirentries>] <block-driver>
@@ -2407,7 +2445,7 @@ nsh>
@@ -2458,7 +2496,7 @@ nsh>
@@ -2537,7 +2575,7 @@ nsh> mount
@@ -2555,7 +2593,7 @@ mv <old-path> <new-path>
@@ -2574,7 +2612,7 @@ nfsmount <server-address> <mount-point> <remote-path>
@@ -2591,7 +2629,7 @@ nslookup <host-name>
@@ -2608,7 +2646,7 @@ passwd <username> <password>
@@ -2632,7 +2670,7 @@ poweroff [<n>]
@@ -2667,7 +2705,7 @@ put [-b|-n] [-f <remote-path>] -h <ip-address> <local-path>
@@ -2697,7 +2735,7 @@ nsh>
@@ -2714,7 +2752,7 @@ readlink <link>
@@ -2736,7 +2774,7 @@ reboot [<n>]
@@ -2770,7 +2808,7 @@ nsh>
@@ -2805,7 +2843,7 @@ nsh>
@@ -2833,7 +2871,7 @@ nsh>
@@ -2853,7 +2891,7 @@ route ipv4|ipv6
@@ -2922,7 +2960,7 @@ nsh>
@@ -2940,7 +2978,7 @@ sh <script-path>
@@ -2961,7 +2999,7 @@ shutdown [--reboot]
@@ -2978,7 +3016,7 @@ sleep <sec>
@@ -3004,7 +3042,7 @@ telnetd
@@ -3062,7 +3100,7 @@ nsh>
@@ -3090,7 +3128,7 @@ truncate -s <length> <file-path>
@@ -3120,7 +3158,7 @@ nsh>
@@ -3187,7 +3225,7 @@ uname [-a | -imnoprsv]
@@ -3213,7 +3251,7 @@ nsh>
@@ -3230,7 +3268,7 @@ urldecode [-f] <string or filepath>
@@ -3247,7 +3285,7 @@ urlencode [-f] <string or filepath>
@@ -3264,7 +3302,7 @@ useradd <username> <password>
@@ -3281,7 +3319,7 @@ userdel <username>
@@ -3298,7 +3336,7 @@ usleep <usec>
@@ -3325,7 +3363,7 @@ wget [-o <local-path>] <url>
@@ -3531,6 +3569,11 @@ nsh>
|
CONFIG_NSH_DISABLE_ECHO |
+
+ env |
+ CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_PROCFS && !CONFIG_DISABLE_ENVIRON && !CONFIG_PROCFS_EXCLUDE_ENVIRON
+ | CONFIG_NSH_DISABLE_ENV |
+
exec |
|
@@ -5599,6 +5642,7 @@ xxd -i romfs_img >nsh_romfsimg.h
do
done
echo
+ env
Environment Variables
/etc/init.d/rcS
exec
diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c
index 2387f82f557..61412527dca 100644
--- a/fs/procfs/fs_procfsproc.c
+++ b/fs/procfs/fs_procfsproc.c
@@ -1091,7 +1091,7 @@ static int proc_groupenv_callback(FAR void *arg, FAR const char *pair)
/* Output the header */
- linesize = snprintf(info->procfile->line, STATUS_LINELEN, "%-16s %s\n",
+ linesize = snprintf(info->procfile->line, STATUS_LINELEN, "%s=%s\n",
name, value);
copysize = procfs_memcpy(info->procfile->line, linesize, info->buffer,
info->remaining, &info->offset);
@@ -1119,8 +1119,6 @@ static ssize_t proc_groupenv(FAR struct proc_file_s *procfile,
off_t offset)
{
FAR struct task_group_s *group = tcb->group;
- size_t linesize;
- size_t copysize;
struct proc_envinfo_s info;
DEBUGASSERT(group != NULL);
@@ -1134,22 +1132,6 @@ static ssize_t proc_groupenv(FAR struct proc_file_s *procfile,
info.remaining = buflen;
info.totalsize = 0;
- /* Output the header */
-
- linesize = snprintf(info.procfile->line, STATUS_LINELEN, "\n%-16s %s\n",
- "VAR", "VALUE");
- copysize = procfs_memcpy(info.procfile->line, linesize, info.buffer,
- info.remaining, &info.offset);
-
- info.totalsize += copysize;
- info.buffer += copysize;
- info.remaining -= copysize;
-
- if (info.totalsize >= info.buflen)
- {
- return info.totalsize;
- }
-
/* Generate output for each environment variable */
(void)env_foreach(group, proc_groupenv_callback, &info);