Add get and put commands to NSH

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@880 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-09-06 00:16:09 +00:00
parent 22a680f2cf
commit 399e1a3981
2 changed files with 136 additions and 43 deletions

View File

@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1> <h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
<p>Last Updated: September 3, 2008</p> <p>Last Updated: September 5, 2008</p>
</td> </td>
</tr> </tr>
</table> </table>
@ -113,127 +113,139 @@
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdexit">2.7 Exit NSH (exit)</a> <a href="#cmdget">2.7 Get File Via TFTP (get)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdhelp">2.8 Show Usage Command Usage (help)</a> <a href="#cmdexit">2.8 Exit NSH (exit)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdifconfig">2.9 Show Network Configuration (ifconfig)</a> <a href="#cmdhelp">2.9 Show Usage Command Usage (help)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdls">2.10 List Directory Contents (ls)</a> <a href="#cmdifconfig">2.10 Show Network Configuration (ifconfig)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmbhw">2.11 Access Memory (mb, mh, and mw)</a> <a href="#cmdls">2.11 List Directory Contents (ls)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmem">2.12 Show Memory Manager Status (mem)</a> <a href="#cmdmbhw">2.12 Access Memory (mb, mh, and mw)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdps">2.13 Show Current Tasks and Threads (ps)</a> <a href="#cmdmem">2.13 Show Memory Manager Status (mem)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmkdir">2.14 Create a Directory (mkdir)</a> <a href="#cmdps">2.14 Show Current Tasks and Threads (ps)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmkfatfs">2.15 Create a FAT Filesystem (mkfatfs)</a> <a href="#cmdmkdir">2.15 Create a Directory (mkdir)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmkfifo">2.16 Create a FIFO (mkfifo)</a> <a href="#cmdmkfatfs">2.16 Create a FAT Filesystem (mkfatfs)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdmount">2.17 Mount a File System (mount)</a> <a href="#cmdmkfifo">2.17 Create a FIFO (mkfifo)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdping">2.18 Check Network Peer (ping)</a> <a href="#cmdmount">2.18 Mount a File System (mount)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdpwd">2.19 Show Current Working Directory (pwd)</a> <a href="#cmdping">2.19 Check Network Peer (ping)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdrm">2.20 Remove a File (rm)</a> <a href="#cmdput">2.20 Send File Via TFTP (put)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdrmdir">2.21 Remove a Directory (rmdir)</a> <a href="#cmdpwd">2.21 Show Current Working Directory (pwd)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdset">2.22 Set an Environment Variable (set)</a> <a href="#cmdrm">2.22 Remove a File (rm)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdsh">2.23 Execute an NSH Script (sh)</a> <a href="#cmdrmdir">2.23 Remove a Directory (rmdir)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdsleep">2.24 Wait for Seconds (sleep)</a> <a href="#cmdset">2.24 Set an Environment Variable (set)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdunmount">2.25 Unmount a File System (umount)</a> <a href="#cmdsh">2.25 Execute an NSH Script (sh)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdunset">2.26 Unset an Environment Variable (unset)</a> <a href="#cmdsleep">2.26 Wait for Seconds (sleep)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><br></td> <td><br></td>
<td> <td>
<a href="#cmdusleep">2.27 Wait for Microseconds (usleep)</a> <a href="#cmdunmount">2.27 Unmount a File System (umount)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdunset">2.28 Unset an Environment Variable (unset)</a>
</td>
</tr>
<tr>
<td><br></td>
<td>
<a href="#cmdusleep">2.29 Wait for Microseconds (usleep)</a>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -621,7 +633,42 @@ exec &lt;hex-address&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdexit"><h2>2.7 Exit NSH (exit)</h2></a> <a name="cmdget"><h2>2.7 Get File Via TFTP (get)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
get [-b|-n] [-f &lt;local-path&gt;] -h &lt;ip-address&gt; &lt;remote-path&gt;
</pre></ul>
<p>
<b>Synopsis</b>.
Copy the file at <code>&lt;remote-address&gt;</code> from the host whose IP address is
identified by <code>&lt;ip-address&gt;</code>.
</p>
<p><b>Other options:</b></p>
<ul><table>
<tr>
<td><b><code>-f &lt;local-path&gt;</code></b></td>
<td>
The file will be saved relative to the current working directory
unless <code>&lt;local-path&gt;</code> is provided.
</td>
</tr>
<tr>
<td><b><code>-b|-n</code></b></td>
<td>
Selects either binary (&quot;octect&quot;) or test (&quot;netascii&quot;) transfer
mode. Default: text.
</td>
</tr>
</table></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdexit"><h2>2.8 Exit NSH (exit)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -640,7 +687,7 @@ exit
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdhelp"><h2>2.8 Show Usage Command Usage (help)</h2></a> <a name="cmdhelp"><h2>2.9 Show Usage Command Usage (help)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -657,7 +704,7 @@ help
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdifconfig"><h2>2.9 Show Network Configuration (ifconfig)</h2></a> <a name="cmdifconfig"><h2>2.10 Show Network Configuration (ifconfig)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -683,7 +730,7 @@ eth0 HWaddr 00:18:11:80:10:06
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdls"><h2>2.10 List Directory Contents (ls)</h2></a> <a name="cmdls"><h2>2.11 List Directory Contents (ls)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -720,7 +767,7 @@ ls [-lRs] &lt;dir-path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmbhw"><h2>2.11 Access Memory (mb, mh, and mw)</h2></a> <a name="cmdmbhw"><h2>2.12 Access Memory (mb, mh, and mw)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -774,7 +821,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmem"><h2>2.12 Show Memory Manager Status (mem)</h2></a> <a name="cmdmem"><h2>2.13 Show Memory Manager Status (mem)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -823,7 +870,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdps"><h2>2.13 Show Current Tasks and Threads (ps)</h2></a> <a name="cmdps"><h2>2.14 Show Current Tasks and Threads (ps)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -849,7 +896,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmkdir"><h2>2.14 Create a Directory (mkdir)</h2></a> <a name="cmdmkdir"><h2>2.15 Create a Directory (mkdir)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -884,7 +931,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmkfatfs"><h2>2.15 Create a FAT Filesystem (mkfatfs)</h2></a> <a name="cmdmkfatfs"><h2>2.16 Create a FAT Filesystem (mkfatfs)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -904,7 +951,7 @@ mkfatfs &lt;path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmkfifo"><h2>2.16 Create a FIFO (mkfifo)</h2></a> <a name="cmdmkfifo"><h2>2.17 Create a FIFO (mkfifo)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -942,7 +989,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdmount"><h2>2.17 Mount a File System (mount)</h2></a> <a name="cmdmount"><h2>2.18 Mount a File System (mount)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1009,7 +1056,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdping"><h2>2.18 Check Network Peer (ping)</h2></a> <a name="cmdping"><h2>2.19 Check Network Peer (ping)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1042,7 +1089,42 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdpwd"><h2>2.19 Show Current Working Directory (pwd)</h2></a> <a name="cmdput"><h2>2.20 Send File Via TFTP (put)</h2></a>
</td>
</tr>
</table>
<a <p><b>Command Syntax:</b></p>
<ul><pre>
put [-b|-n] [-f &lt;remote-path&gt;] -h &lt;ip-address&gt; &lt;local-path&gt;
</pre></ul>
<p>
<b>Synopsis</b>.
Copy the file at <code>&lt;local-address&gt;</code> to the host whose IP address is
identified by <code>&lt;ip-address&gt;</code>.
</p>
<p><b>Other options:</b></p>
<ul><table>
<tr>
<td><b><code>-f &lt;remote-path&gt;</code></b></td>
<td>
The file will be saved relative with the same name on the host
unless <code>&lt;remote-path&gt;</code> is provided.
</td>
</tr>
<tr>
<td><b><code>-b|-n</code></b></td>
<td>
Selects either binary (&quot;octect&quot;) or test (&quot;netascii&quot;) transfer
mode. Default: text.
</td>
</tr>
</table></ul>
<table width ="100%">
<tr bgcolor="#e4e4e4">
<td>
<a name="cmdpwd"><h2>2.21 Show Current Working Directory (pwd)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1072,7 +1154,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdrm"><h2>2.20 Remove a File (rm)</h2></a> <a name="cmdrm"><h2>2.22 Remove a File (rm)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1106,7 +1188,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdrmdir"><h2>2.21 Remove a Directory (rmdir)</h2></a> <a name="cmdrmdir"><h2>2.23 Remove a Directory (rmdir)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1141,7 +1223,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdset"><h2>2.22 Set an Environment Variable (set)</h2></a> <a name="cmdset"><h2>2.24 Set an Environment Variable (set)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1167,7 +1249,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdsh"><h2>2.23 Execute an NSH Script (sh)</h2></a> <a name="cmdsh"><h2>2.25 Execute an NSH Script (sh)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1185,7 +1267,7 @@ sh &lt;script-path&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdsleep"><h2>2.24 Wait for Seconds (sleep)</h2></a> <a name="cmdsleep"><h2>2.26 Wait for Seconds (sleep)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1202,7 +1284,7 @@ sleep &lt;sec&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdunmount"><h2>2.25 Unmount a File System (umount)</h2></a> <a name="cmdunmount"><h2>2.27 Unmount a File System (umount)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1232,7 +1314,7 @@ nsh>
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdunset"><h2>2.26 Unset an Environment Variable (unset)</h2></a> <a name="cmdunset"><h2>2.28 Unset an Environment Variable (unset)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1258,7 +1340,7 @@ nsh&gt;
<table width ="100%"> <table width ="100%">
<tr bgcolor="#e4e4e4"> <tr bgcolor="#e4e4e4">
<td> <td>
<a name="cmdusleep"><h2>2.27 Wait for Microseconds (usleep)</h2></a> <a name="cmdusleep"><h2>2.29 Wait for Microseconds (usleep)</h2></a>
</td> </td>
</tr> </tr>
</table> </table>
@ -1331,6 +1413,10 @@ usleep &lt;usec&gt;
<td><b><code>exit</code></b></td> <td><b><code>exit</code></b></td>
<td><br></td> <td><br></td>
</tr> </tr>
<tr>
<td><b><code>get</code></b></td>
<td><code>CONFIG_NET</code> &amp;&amp; <code>CONFIG_NET_UDP</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td>
</tr>
<tr> <tr>
<td><b><code>help</code></b></td> <td><b><code>help</code></b></td>
<td><br></td> <td><br></td>
@ -1375,6 +1461,10 @@ usleep &lt;usec&gt;
<td><b><code>ps</code></b></td> <td><b><code>ps</code></b></td>
<td><br></td> <td><br></td>
</tr> </tr>
<tr>
<td><b><code>put</code></b></td>
<td><code>CONFIG_NET</code> &amp;&amp; <code>CONFIG_NET_UDP</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td>
</tr>
<tr> <tr>
<td><b><code>pwd</code></b></td> <td><b><code>pwd</code></b></td>
<td>!<code>CONFIG_DISABLE_ENVIRON</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td> <td>!<code>CONFIG_DISABLE_ENVIRON</code> &amp;&amp; <code>CONFIG_NFILE_DESCRIPTORS</code> &gt; 0</td>
@ -1602,6 +1692,7 @@ usleep &lt;usec&gt;
<li><a href="#environvars">Environment Variables</a></li> <li><a href="#environvars">Environment Variables</a></li>
<li><a href="#cmdexec"><code>exec</code></a></li> <li><a href="#cmdexec"><code>exec</code></a></li>
<li><a href="#cmdexit"><code>exit</code></a></li> <li><a href="#cmdexit"><code>exit</code></a></li>
<li><a href="#cmdget"><code>get</code></a></li>
</ul></td> </ul></td>
<td></ul> <td></ul>
<li><a href="#frontend">Greeting</a></li> <li><a href="#frontend">Greeting</a></li>
@ -1623,6 +1714,7 @@ usleep &lt;usec&gt;
<li><a href="#cmdping"><code>ping</code></a></li> <li><a href="#cmdping"><code>ping</code></a></li>
<li><a href="#frontend">Prompt</a></li> <li><a href="#frontend">Prompt</a></li>
<li><a href="#cmdps"><code>ps</code></a></li> <li><a href="#cmdps"><code>ps</code></a></li>
<li><a href="#cmdput"><code>put</code></a></li>
<li><a href="#cmdpwd"><code>pwd</code></a></li> <li><a href="#cmdpwd"><code>pwd</code></a></li>
<li><a href="#environvars"><code>PWD</code></a></li> <li><a href="#environvars"><code>PWD</code></a></li>
<li><a href="#cmdoverview">Re-directed commands</a></li> <li><a href="#cmdoverview">Re-directed commands</a></li>

View File

@ -1077,6 +1077,7 @@ nuttx-0.3.14 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;
* Correct IP checksum calculation in ICMP and UDP message send logic. * Correct IP checksum calculation in ICMP and UDP message send logic.
* NSH: Created an HTML document and a more detailed README file describing NSH. * NSH: Created an HTML document and a more detailed README file describing NSH.
* Added basic TFTP client logic (netutils/tftpc). Untested as of initial check-in. * Added basic TFTP client logic (netutils/tftpc). Untested as of initial check-in.
* NSH: Add get and put commands to support TFTP get and put operations.
pascal-0.1.3 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt; pascal-0.1.3 2008-xx-xx Gregory Nutt &lt;spudmonkey@racsa.co.cr&gt;