Implement redirection of output from NSH builtin commands to a file in a mounted volume

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5521 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2013-01-15 21:01:37 +00:00
parent 90a72e97d3
commit fcb316906d
16 changed files with 1018 additions and 693 deletions
+30 -17
View File
@@ -1,9 +1,16 @@
/****************************************************************************
* apps/include/apps.h
*
* Copyright(C) 2011 Uros Platise. All rights reserved.
* Originally by:
*
* Copyright (C) 2011 Uros Platise. All rights reserved.
* Author: Uros Platise <uros.platise@isotel.eu>
*
* With subsequent updates, modifications, and general maintenance by:
*
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -64,19 +71,6 @@ struct builtin_s
* Public Data
****************************************************************************/
/* The "bindir" is file system that supports access to the builtin applications.
* It is typically mounted under /bin.
*/
#ifdef CONFIG_APPS_BINDIR
struct mountpt_operations;
extern const struct mountpt_operations binfs_operations;
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
@@ -85,6 +79,19 @@ extern "C" {
#define EXTERN extern
#endif
/* The "bindir" is file system that supports access to the builtin applications.
* It is typically mounted under /bin.
*/
#ifdef CONFIG_APPS_BINDIR
EXTERN mountpt_operations;
EXTERN const struct mountpt_operations binfs_operations;
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: builtin_isavail
*
@@ -129,8 +136,13 @@ EXTERN const char *builtin_getname(int index);
* New application is run in a separate task context (and thread).
*
* Input Parameter:
* filename - Name of the linked-in binary to be started.
* argv - Argument list
* filename - Name of the linked-in binary to be started.
* argv - Argument list
* redirfile - If output if redirected, this parameter will be non-NULL
* and will provide the full path to the file.
* oflags - If output is redirected, this parameter will provide the
* open flags to use. This will support file replacement
* of appending to an existing file.
*
* Returned Value:
* This is an end-user function, so it follows the normal convention:
@@ -139,7 +151,8 @@ EXTERN const char *builtin_getname(int index);
*
****************************************************************************/
EXTERN int exec_builtin(FAR const char *appname, FAR const char **argv);
EXTERN int exec_builtin(FAR const char *appname, FAR const char **argv,
FAR const char *redirfile, int oflags);
#undef EXTERN
#if defined(__cplusplus)