summaryrefslogtreecommitdiff
path: root/funcs/func_env.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2008-11-01 21:10:07 +0000
committerRussell Bryant <russell@russellbryant.com>2008-11-01 21:10:07 +0000
commit5b168ee34babe562be856ec8f1dd14c0abd7c1a5 (patch)
tree9c836ac808552d20be6bd2baa3a3c29f642eda53 /funcs/func_env.c
parent1fef0f63bbbde9530837995c8790b839f73b74e7 (diff)
Merge changes from team/group/appdocsxml
This commit introduces the first phase of an effort to manage documentation of the interfaces in Asterisk in an XML format. Currently, a new format is available for applications and dialplan functions. A good number of conversions to the new format are also included. For more information, see the following message to asterisk-dev: http://lists.digium.com/pipermail/asterisk-dev/2008-October/034968.html git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153365 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs/func_env.c')
-rw-r--r--funcs/func_env.c79
1 files changed, 56 insertions, 23 deletions
diff --git a/funcs/func_env.c b/funcs/func_env.c
index 4eba211bb..401dc28e3 100644
--- a/funcs/func_env.c
+++ b/funcs/func_env.c
@@ -33,6 +33,59 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/utils.h"
#include "asterisk/app.h"
+/*** DOCUMENTATION
+ <function name="ENV" language="en_US">
+ <synopsis>
+ Gets or sets the environment variable specified.
+ </synopsis>
+ <syntax>
+ <parameter name="varname" required="true">
+ <para>Enviroment variable name</para>
+ </parameter>
+ </syntax>
+ <description>
+ </description>
+ </function>
+ <function name="STAT" language="en_US">
+ <synopsis>
+ Does a check on the specified file.
+ </synopsis>
+ <syntax>
+ <parameter name="flag" required="true">
+ <para>Flag may be one of the following:</para>
+ <para>d - Checks if the file is a directory.</para>
+ <para>e - Checks if the file exists.</para>
+ <para>f - Checks if the file is a regular file.</para>
+ <para>m - Returns the file mode (in octal)</para>
+ <para>s - Returns the size (in bytes) of the file</para>
+ <para>A - Returns the epoch at which the file was last accessed.</para>
+ <para>C - Returns the epoch at which the inode was last changed.</para>
+ <para>M - Returns the epoch at which the file was last modified.</para>
+ </parameter>
+ <parameter name="filename" required="true" />
+ </syntax>
+ <description>
+ </description>
+ </function>
+ <function name="FILE" language="en_US">
+ <synopsis>
+ Obtains the contents of a file.
+ </synopsis>
+ <syntax>
+ <parameter name="filename" required="true" />
+ <parameter name="offset" required="true">
+ <para>Maybe specified as any number. if negative <replaceable>offset</replaceable> specifies the number
+ of bytes back from the end of the file.</para>
+ </parameter>
+ <parameter name="length" required="true">
+ <para>If specified, will limit the length of the data read to that size.</para>
+ </parameter>
+ </syntax>
+ <description>
+ </description>
+ </function>
+ ***/
+
static int env_read(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
@@ -151,43 +204,23 @@ static int file_read(struct ast_channel *chan, const char *cmd, char *data, char
static struct ast_custom_function env_function = {
.name = "ENV",
- .synopsis = "Gets or sets the environment variable specified",
- .syntax = "ENV(<envname>)",
.read = env_read,
- .write = env_write,
+ .write = env_write
};
static struct ast_custom_function stat_function = {
.name = "STAT",
- .synopsis = "Does a check on the specified file",
- .syntax = "STAT(<flag>,<filename>)",
- .read = stat_read,
- .desc =
- "flag may be one of the following:\n"
- " d - Checks if the file is a directory\n"
- " e - Checks if the file exists\n"
- " f - Checks if the file is a regular file\n"
- " m - Returns the file mode (in octal)\n"
- " s - Returns the size (in bytes) of the file\n"
- " A - Returns the epoch at which the file was last accessed\n"
- " C - Returns the epoch at which the inode was last changed\n"
- " M - Returns the epoch at which the file was last modified\n",
+ .read = stat_read
};
static struct ast_custom_function file_function = {
.name = "FILE",
- .synopsis = "Obtains the contents of a file",
- .syntax = "FILE(<filename>,<offset>,<length>)",
- .read = file_read,
+ .read = file_read
/*
* Some enterprising programmer could probably add write functionality
* to FILE(), although I'm not sure how useful it would be. Hence why
* it's called FILE and not READFILE (like the app was).
*/
- .desc =
-"<offset> may be specified as any number. If negative, <offset> specifies\n"
-" the number of bytes back from the end of the file.\n"
-"<length>, if specified, will limit the length of the data read to that size.\n",
};
static int unload_module(void)