Commit Graph

105 Commits

Author SHA1 Message Date
Gregory Nutt
3257ea42d5 apps/nshlib/nsh_parrse.c: Correct some coding standard problems in last PR. 2019-01-06 10:00:19 -06:00
Daniel Agar
c700bf9739 Merged in dagar/nuttx-apps/pr-nshlib (pull request #163)
[WIP] nshlib add var expansion in nsh parse

Approved-by: GregoryN <gnutt@nuttx.org>
2019-01-06 15:52:18 +00:00
GregoryN
3bf4b6d245 Merged altconsole into master 2018-12-08 18:53:54 -06:00
Gregory Nutt
cb982ea8df apps/nshlib: Eliminate more new warnings found in build testing. 2018-10-02 11:16:15 -06:00
Gregory Nutt
2bc4d1e8e2 apps/nshlib/nsh_parse.c: Fix a warning (really a bug) detected in build testing. 2018-10-02 11:08:17 -06:00
Gregory Nutt
7f7b728231 apps/nshlib/nsh_parse.c: Correct an error in conditional compilation found in build testing. 2018-10-02 10:21:33 -06:00
Gregory Nutt
e9edfd064f apps/nshlib: Add support for NSH local variables if CONFIG_NSH_VARS are set. These are like environment variables but are local to NSH. The importance of this is that these variables are *not* inherited when NSH creates a new task. The new command 'export' was added. In this case, the NSH variable will be promoted to an environment variable and will then be inherited by any tasks executed by NSH. 2018-10-01 13:30:25 -06:00
Xiang Xiao
dbf152cbeb apps/nshlib: (1) NSH prompt string is now configurable. nsh> is still the default. (2) Increase the default configuration for the maximum number of command line arguments to 7 (CONFIG_NSH_MAXARGUMENTS). This is needed for 'mount' with the -o option. 2018-08-23 07:34:30 -06:00
Gregory Nutt
f2ef84f048 apps/nshlib: Back out 516a743344. While the change is fuly functional and adds a pleasing symmetry to the control commands, it is also redundant and serves no real purpose other than requiring more FLASH. 2018-08-12 06:15:29 -06:00
Gregory Nutt
ff192a4a58 apps/nshlib: I was able to cause an assertion with some typos in an testing the 'fi' command. Not an important thing, but this will protect against the assertion. 2018-08-11 09:30:53 -06:00
Gregory Nutt
516a743344 apps/nshlib: Extend Beat Küng's commit 888ad352eb so that inverted logic may also be used in repeat and while loops. 2018-08-11 07:53:22 -06:00
Beat Küng
888ad352eb Merged in bkueng/nuttx-apps (pull request #150)
nsh: add inverted logic support in the form of 'if ! <cmd>'

Approved-by: GregoryN <gnutt@nuttx.org>
2018-08-11 13:14:41 +00:00
Gregory Nutt
303629dbe4 apps/nshlib: Small parsing improvement plus some added comments. 2018-08-06 15:52:02 -06:00
Gregory Nutt
cb556d6236 apps/nshlib: Add parsing support for back-slash quoted characters. Currenlty only implemented properly if CONFIG_NSH_ARGCAT is also selected. This commit is in response to Bitbucket Issue 11 opened by Maciej Wójcik 2018-08-06 13:28:31 -06:00
Beat Küng
c6697c150d Merged in bkueng/nuttx-apps (pull request #138)
nsh_parse.c: fix 'while' and 'until' loop condition

The loop condition logic was inverted:
  while true; do echo "test"; done
would exit immediately, while using 'until' would stay in the loop.
This is the opposite of how it is supposed to work.
The reason is that 'state' was set wrong because 'whilematch' is a bool.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2018-06-06 12:50:41 +00:00
Gregory Nutt
bb6877ed78 apps/nshlib: Fix compile error when CONFIG_NSH_DISABLESCRIPT is not defined. The field np_flags does not exist if scripting is disabled. 2018-01-22 08:32:40 -06:00
Gregory Nutt
ef353ed632 Fix parsing of empty strings when CONFIG_NSH_CMDPARMS is not defined. Problem noted by Juha Niskanen. 2017-10-27 06:41:26 -06:00
Bruno Herrera
3fe720d1e2 Fixes for problems found by Coverity in the apps/ repository:
nshlib/nsh_parse.c: Avoid truncating the strcmp result into a unsigned char variable.

    nshlib/nsh_netcmds.c: Check for valid hostip before using it.

    nshlib/nsh_ddcmd.c: Fix resouce leak when 'if=' or 'of=' params are repeated in the command line.  For example:

       dd if=/dev/null if=/dev/zero of=/dev/null or
       dd if=/dev/zero of=/dev/zero of=/dev/null
2017-09-25 07:34:34 -06:00
Gregory Nutt
1cdf4ad8d1 Fix a warning found in build testing 2017-08-12 11:14:30 -06:00
David Sidrane
35cf98d4df Print expanded variables if -x 2017-04-05 18:31:47 -06:00
Gregory Nutt
2ef46ce4ba NSH library: In nsh_argexand(), if CONFIG_NSH_ARGCAT is defined but CONFIG_NSH_CMDPARMS defined and/or CONFIG_DISABLE_ENVIRON not defined, then there is a situation that causes an infinite loop in the parser. Noted by Freddie Chopin. 2017-03-09 08:07:22 -06:00
Gregory Nutt
bab5df0966 Eliminate a warning about an unused variable. 2017-02-27 07:30:52 -06:00
Sebastien Lorquet
2cbad44f1d This is the Pokemon patch to change all includes fronm <apps/bla/bla.h> to "bla/bla.h" 2016-07-11 10:11:18 -06:00
Gregory Nutt
0e76ca7474 Move apps/include/nsh.h to apps/include/nshlib/nshlib.h 2016-07-01 06:59:23 -06:00
Gregory Nutt
5098539063 Add _ to front of remaining debug macros 2016-06-16 12:12:34 -06:00
Gregory Nutt
586b0aa7e0 Change names of *dbg() * *err() 2016-06-11 15:51:27 -06:00
Gregory Nutt
93d9d5e4ca apps/nshlib: All NSH sessions may now be protected with passwords stored in the encrypted /etc/passwd file 2016-01-20 14:42:39 -06:00
Gregory Nutt
3dad8a29a2 NSH now supports an MOTD string that will be presented after the greeting 2016-01-20 11:18:08 -06:00
Gregory Nutt
7f5a7a07a5 Costmetic alignment 2016-01-17 08:12:51 -06:00
Gregory Nutt
b5c5055c41 NSH: Remove partial implementation of the use of IOBJ/IPTR in NSH. There are some complications 2016-01-17 07:53:52 -06:00
Gregory Nutt
16ed293417 Revert "Revert "NSH: All nsh_output strings tagged with IOBJ so that they may be stored in FLASH on AVR""
This reverts commit fd083ee981.
2016-01-17 07:41:51 -06:00
Gregory Nutt
fd083ee981 Revert "NSH: All nsh_output strings tagged with IOBJ so that they may be stored in FLASH on AVR"
This reverts commit cb6a914d08.
2016-01-17 07:39:17 -06:00
Gregory Nutt
cb6a914d08 NSH: All nsh_output strings tagged with IOBJ so that they may be stored in FLASH on AVR 2016-01-05 16:38:50 -06:00
Gregory Nutt
23075e0b30 Allow NSH date command with no RTC. This command is useful without an RTC too. Also, this permits testing on the simulator which never has an RTC 2015-04-11 12:13:18 -06:00
Gregory Nutt
131b8c5946 Move CONFIG_NSH_TMPDIR to CONFIG_LIBC_TMPDIR 2014-11-05 07:49:20 -06:00
Gregory Nutt
ddc799d049 Fix some cloned errors in SAM GPIO interrupt setup 2014-07-07 15:54:37 -06:00
Gregory Nutt
58424404f0 NSH: if # appears on line, need to comment ignore additinal commands on the line 2014-07-01 13:43:40 -06:00
Gregory Nutt
05d21a62e7 Updates to the serialrx example from Bob Doison 2014-04-22 09:31:25 -06:00
Gregory Nutt
138f6a627e Fix version number display in NSH prompt 2014-03-23 13:10:05 -06:00
Gregory Nutt
95a646b8d0 QEMU i486: New QEMU keyboard and VGA drivers from Lizhuoyi 2014-03-08 09:24:24 -06:00
Gregory Nutt
2bc6d67866 unlink/rm can now be used on nodes in the pseudo-filesystem. There is new configuration option to suppress these costly and mostly useless operations on the pseudo-filesystem 2014-02-20 18:14:02 -06:00
Gregory Nutt
c4c49ffbb3 More changes for a correct NSH Windows natvie build 2014-02-07 10:56:24 -06:00
Gregory Nutt
612d8ed14c NSH: Add a break command; if-then-else and looping behavior can not be configured out of the build for small systems that need minimal scripting capability 2014-01-18 09:39:16 -06:00
Gregory Nutt
45121c8709 NSH: Loosen up if-then-else-fi syntx so that a command can be on the same line as the 'then' and 'else' tokens. This allows, as an example, 'if true; then echo true; else echo false; fi' which is much more bash-like 2014-01-17 18:03:23 -06:00
Gregory Nutt
cfb7c77ed3 NSH: Add support for while-do-done and until-do-done loops 2014-01-17 15:56:32 -06:00
Gregory Nutt
97e1d8b535 Add true and false commands; repartition some logic to better support forthcoming looping 2014-01-17 13:24:44 -06:00
Gregory Nutt
dd9c8ab4f9 NSH: Fix redirection of output to a file. That was broken with recent changes 2014-01-16 07:30:15 -06:00
Gregory Nutt
b889cae796 Cosmetic clean-up in preparation for TCP write buffering change 2014-01-13 08:21:18 -06:00
Gregory Nutt
3698289943 Recent NSH changes broke the minimal NSH configuration 2014-01-12 18:09:19 -06:00
Gregory Nutt
5cc656d71d Fix a memory leak in last NSH change: Forgot to close a temporary file 2014-01-12 14:16:05 -06:00