aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-26 14:50:31 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-05-26 14:51:20 +0300
commit1a1716dedf67740f21e6db479ce461fadcc05cc3 (patch)
treebda284b3fad8a1fe4e600ff4b5df3f66a866eceb
parenta863ad219450a41ed9b7c950e7006e4cf438b479 (diff)
downloadcfpeek-1a1716dedf67740f21e6db479ce461fadcc05cc3.tar.gz
cfpeek-1a1716dedf67740f21e6db479ce461fadcc05cc3.tar.bz2
* src/cfpeek.c: Assume descend flag if no keys are given.
-rw-r--r--doc/cfpeek.114
-rw-r--r--src/cfpeek.c1
2 files changed, 8 insertions, 7 deletions
diff --git a/doc/cfpeek.1 b/doc/cfpeek.1
index 3107500..bf85184 100644
--- a/doc/cfpeek.1
+++ b/doc/cfpeek.1
@@ -14,7 +14,7 @@
.\" You should have received a copy of the GNU General Public License
.\" along with cfpeek. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH CFPEEK 1 "May 24, 2011" "CFPEEK" "Cfpeek User Reference"
+.TH CFPEEK 1 "May 26, 2011" "CFPEEK" "Cfpeek User Reference"
.SH NAME
cfpeek \- retrieve values from a structured configuration file
.SH SYNOPSIS
@@ -274,7 +274,7 @@ The literal matching can be requested with the \fB\-L\fR
The scripting mode is enabled when at least one of
.BR \-f " (" \-\-file )
or
-.BR \-e " (" \-\-expr )
+.BR \-e " (" \-\-expression )
options is given. This is a highly useful advanced feature, which
allows you to apply programs of arbitrary complexity to each node of
the parsing tree. For a detailed discussion, see the section
@@ -395,14 +395,14 @@ Set a keyword \fIPATH\fR to \fIVALUE\fR. This will be reflected in
the output,
.SS Scripting
.TP
-\fB\-e\fR, \fB\-\-expr\fR=\fIEXPRESSION\fR
+\fB\-e\fR, \fB\-\-expression\fR=\fIEXPRESSION\fR
Apply this Scheme expression to each node found.
.TP
\fB\-f\fR, \fB\-\-file\fR=\fIFILE\fR
Apply the Scheme script \fIFILE\fR to each node found. The script must
define the function \fB(cfpeek node)\fR. See the section
.B SCRIPTING,
-for a detailed description. If both \fB\-\-file\fR and \fB\-\-expr\fR
+for a detailed description. If both \fB\-\-file\fR and \fB\-\-expression\fR
are given, the file is loaded first, and expression is applied to each
node.
.TP
@@ -451,7 +451,7 @@ Print a short usage message and a list of available options.
\fBCfpeek\fR enters the scripting mode when at least one of the
.BR \-f " (" \-\-file )
or
-.BR \-e " (" \-\-expr )
+.BR \-e " (" \-\-expression )
options is given.
.PP
So far only Scheme is supported as a scripting language.
@@ -486,7 +486,7 @@ A number of functions is provided to access the information stored in
a node. These are described below.
.PP
If the
-.BR \-e " (" \-\-expr )
+.BR \-e " (" \-\-expression )
option is given, its argument must be a valid Scheme expression. This
expression will be evaluated for each statement matching the search
criteria. Before evaluating, the global variable \fInode\fR is
@@ -786,7 +786,7 @@ Same as above, but initialize additional parameters for the script:
.nf
.B $ cfpeek --parser=bind --script=master-zone.scm \\\\
.ti +2
---expr '(set! indent 8) (cfpeek node)' /etc/named.conf
+--expression '(set! indent 8) (cfpeek node)' /etc/named.conf
.ti +2
.B .view=external.zone
.fi
diff --git a/src/cfpeek.c b/src/cfpeek.c
index 233d075..7136813 100644
--- a/src/cfpeek.c
+++ b/src/cfpeek.c
@@ -200,6 +200,7 @@ main(int argc, char **argv)
grecs_tree_sort(tree, node_ident_cmp);
if (argc < 2) {
+ flags |= GRECS_NODE_FLAG_DESCEND;
scan_tree(tree);
exit(EX_OK);
}

Return to:

Send suggestions and report system problems to the System administrator.