From 2405ef9a4e44e7423f9c3debfec2a5d9b06c15ff Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Fri, 8 Jun 2001 00:49:17 +0000 Subject: 2001-06-07 Roland McGrath * 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. --- migcom.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'migcom.c') 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"); -- cgit v1.2.3