summaryrefslogtreecommitdiff
path: root/apps/nshlib/nsh_fscmds.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-29 22:11:04 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-01-29 22:11:04 +0000
commit7b78d906d966d2c2b266bce9c1c0c8fef19c3103 (patch)
treede34ca63f68a004de6c9d864ef380a56b870e84a /apps/nshlib/nsh_fscmds.c
parentf5308beae0c268fa2b27e3a524e76afe871b6234 (diff)
downloadpx4-nuttx-7b78d906d966d2c2b266bce9c1c0c8fef19c3103.tar.gz
px4-nuttx-7b78d906d966d2c2b266bce9c1c0c8fef19c3103.tar.bz2
px4-nuttx-7b78d906d966d2c2b266bce9c1c0c8fef19c3103.zip
Add support for a login script (in addition to the init script); Add logic so that a USB console session can connect and reconnect to the USB serial device
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5582 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/nshlib/nsh_fscmds.c')
-rw-r--r--apps/nshlib/nsh_fscmds.c67
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
****************************************************************************/