aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2005-09-25 15:16:08 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2005-09-25 15:16:08 +0000
commit48da77a9b7f2dd5484026314a4e64dc54781bdf5 (patch)
treecf16000e93cb16832de16f7444dad2d0212ffa27 /src
parent87170f8072ccdcaa24eaf2e5cf82f7cbf5b34948 (diff)
downloadcflow-48da77a9b7f2dd5484026314a4e64dc54781bdf5.tar.gz
cflow-48da77a9b7f2dd5484026314a4e64dc54781bdf5.tar.bz2
Handle new --emacs option.
Diffstat (limited to 'src')
-rw-r--r--src/gnu.c8
-rw-r--r--src/main.c9
-rw-r--r--src/posix.c3
3 files changed, 18 insertions, 2 deletions
diff --git a/src/gnu.c b/src/gnu.c
index cc6e1ad..eefc4b0 100644
--- a/src/gnu.c
+++ b/src/gnu.c
@@ -66,8 +66,14 @@ gnu_output_handler(cflow_output_command cmd,
void *data, void *handler_data)
{
switch (cmd) {
- case cflow_output_init:
case cflow_output_begin:
+ if (emacs_option) {
+ fprintf(outfile, ";; This file is generated by %s. -*- cflow -*-",
+ PACKAGE_STRING);
+ newline();
+ }
+ break;
+ case cflow_output_init:
case cflow_output_end:
case cflow_output_separator:
break;
diff --git a/src/main.c b/src/main.c
index 174445e..0e2c6aa 100644
--- a/src/main.c
+++ b/src/main.c
@@ -30,6 +30,7 @@ static char doc[] = N_("generate a program flowgraph");
#define OPT_DEBUG 258
#define OPT_PREPROCESS 259
#define OPT_NO_PREPROCESS 260
+#define OPT_EMACS 261
static struct argp_option options[] = {
#define GROUP_ID 0
@@ -112,6 +113,8 @@ static struct argp_option options[] = {
N_("Draw ASCII art tree"), GROUP_ID+1 },
{ "brief", 'b', N_("BOOL"), OPTION_ARG_OPTIONAL,
N_("Brief output"), GROUP_ID+1 },
+ { "emacs", OPT_EMACS, NULL, 0,
+ N_("Additionally format output for use with GNU Emacs"), GROUP_ID+1 },
#undef GROUP_ID
#define GROUP_ID 30
{ NULL, 0, NULL, 0,
@@ -168,6 +171,7 @@ int print_as_tree; /* Print as tree */
int brief_listing; /* Produce short listing */
int reverse_tree; /* Generate reverse tree */
int max_depth; /* The depth at which the flowgraph is cut off */
+int emacs_option; /* Format and check for use with Emacs cflow-mode */
#define SM_FUNCTIONS 0x0001
#define SM_DATA 0x0002
@@ -512,6 +516,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
case OPT_DEFINES:
record_defines = 1;
break;
+ case OPT_EMACS:
+ emacs_option = 1;
+ break;
case 'f':
if (select_output_driver(arg))
argp_error(state, _("%s: No such output driver"), optarg);
@@ -675,7 +682,7 @@ main(int argc, char **argv)
if (getenv ("POSIXLY_CORRECT")) {
if (select_output_driver("posix"))
- error(0, _("%s: No such output driver"), "posix");
+ error(1, 0, _("%s: No such output driver"), "posix");
output_init();
}
diff --git a/src/posix.c b/src/posix.c
index e9faf88..92edcbf 100644
--- a/src/posix.c
+++ b/src/posix.c
@@ -78,6 +78,9 @@ posix_output_handler(cflow_output_command cmd,
{
switch (cmd) {
case cflow_output_init:
+ /* Additional check for consistency */
+ if (emacs_option)
+ error(1, 0, _("--format=posix is not compatible with --emacs"));
brief_listing = print_line_numbers = 1;
break;
case cflow_output_begin:

Return to:

Send suggestions and report system problems to the System administrator.