summaryrefslogtreecommitdiff
path: root/migcom.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-06-08 00:49:17 +0000
committerRoland McGrath <roland@gnu.org>2001-06-08 00:49:17 +0000
commit2405ef9a4e44e7423f9c3debfec2a5d9b06c15ff (patch)
tree62568dac635a0edd5265e791d5bbdff1461da469 /migcom.c
parent1a10fa88882c793dd77cb11a2c70760a970ffbec (diff)
2001-06-07 Roland McGrath <roland@frob.com>
* header.c (WriteRoutineList): New function. * write.h: Declare it. * migcom.c (RoutineListFileName): New variable. (parseArgs): New option -list to set it. (main): If set, write the named output file with WriteRoutineList. * mig.in: Grok -list and put it in the usage message. * global.c (DefaultFiles): New variable, boolean initialized to true. (more_global): Leave null file name variables alone if it's false. * global.h (DefaultFiles): Declare it. * migcom.c (parseArgs): New option -n clears it. * mig.in: Grok -n (pass it through) and put it in the usage message.
Diffstat (limited to 'migcom.c')
-rw-r--r--migcom.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/migcom.c b/migcom.c
index 14b9dd6..db04455 100644
--- a/migcom.c
+++ b/migcom.c
@@ -80,6 +80,8 @@
extern int yyparse();
static FILE *myfopen(const char *name, const char *mode);
+static string_t RoutineListFileName;
+
static void
parseArgs(int argc, char **argv)
{
@@ -88,6 +90,9 @@ parseArgs(int argc, char **argv)
{
switch (argv[0][1])
{
+ case 'n':
+ DefaultFiles = FALSE;
+ break;
case 'q':
BeQuiet = TRUE;
break;
@@ -106,6 +111,15 @@ parseArgs(int argc, char **argv)
case 'R':
UseMsgRPC = FALSE;
break;
+ case 'l':
+ if (streql(argv[0], "-list"))
+ {
+ --argc; ++argv;
+ if (argc == 0)
+ fatal("missing name for -list option");
+ RoutineListFileName = strmake(argv[0]);
+ }
+ break;
case 's':
if (streql(argv[0], "-server"))
{
@@ -272,6 +286,14 @@ main(int argc, char **argv)
}
WriteServer(server, StatementList);
fclose(server);
+
+ if (RoutineListFileName != strNULL)
+ {
+ FILE *listfile = myfopen (RoutineListFileName, "w");
+ WriteRoutineList (listfile, StatementList);
+ fclose (listfile);
+ }
+
if (BeVerbose)
printf("done.\n");