diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-02-17 09:14:12 -0800 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-02-17 09:14:12 -0800 |
commit | 520a2b417410bed7db6f08a3a69f3bcccc55910b (patch) | |
tree | 2365774545ed145c307630b63cb5f075fca71c21 /apps/nshlib/nsh_fscmds.c | |
parent | 2745c3276f5c2377a9713555c5941b17912b6ce7 (diff) | |
parent | caa11f0bbb7f30679c5c01a64e1d0f6d8627db9d (diff) | |
download | px4-firmware-520a2b417410bed7db6f08a3a69f3bcccc55910b.tar.gz px4-firmware-520a2b417410bed7db6f08a3a69f3bcccc55910b.tar.bz2 px4-firmware-520a2b417410bed7db6f08a3a69f3bcccc55910b.zip |
Merge pull request #198 from PX4/nuttx-merge-5596
Nuttx merge 5596
Diffstat (limited to 'apps/nshlib/nsh_fscmds.c')
-rw-r--r-- | apps/nshlib/nsh_fscmds.c | 67 |
1 files changed, 1 insertions, 66 deletions
diff --git a/apps/nshlib/nsh_fscmds.c b/apps/nshlib/nsh_fscmds.c index 1a9f2eb57..f47dca896 100644 --- a/apps/nshlib/nsh_fscmds.c +++ b/apps/nshlib/nsh_fscmds.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/nshlib/nsh_fscmds.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -1221,71 +1221,6 @@ int cmd_rmdir(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #endif /**************************************************************************** - * Name: nsh_script - ****************************************************************************/ - -#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0 && !defined(CONFIG_NSH_DISABLESCRIPT) -int nsh_script(FAR struct nsh_vtbl_s *vtbl, const char *cmd, const char *path) -{ - char *fullpath; - FILE *stream; - char *buffer; - char *pret; - int ret = ERROR; - - /* The path to the script may be relative to the current working directory */ - - fullpath = nsh_getfullpath(vtbl, path); - if (!fullpath) - { - return ERROR; - } - - /* Get a reference to the common input buffer */ - - buffer = nsh_linebuffer(vtbl); - if (buffer) - { - /* Open the file containing the script */ - - stream = fopen(fullpath, "r"); - if (!stream) - { - nsh_output(vtbl, g_fmtcmdfailed, cmd, "fopen", NSH_ERRNO); - nsh_freefullpath(fullpath); - return ERROR; - } - - /* Loop, processing each command line in the script file (or - * until an error occurs) - */ - - do - { - /* Get the next line of input from the file */ - - fflush(stdout); - pret = fgets(buffer, CONFIG_NSH_LINELEN, stream); - if (pret) - { - /* Parse process the command. NOTE: this is recursive... - * we got to cmd_sh via a call to nsh_parse. So some - * considerable amount of stack may be used. - */ - - ret = nsh_parse(vtbl, buffer); - } - } - while (pret && ret == OK); - fclose(stream); - } - - nsh_freefullpath(fullpath); - return ret; -} -#endif - -/**************************************************************************** * Name: cmd_sh ****************************************************************************/ |