diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index 61c7f11..34c124c 100644 *** a/src/bin/psql/startup.c --- b/src/bin/psql/startup.c *************** PsqlSettings pset; *** 43,48 **** --- 43,50 ---- #define PSQLRC "psqlrc.conf" #endif + #define FILE_ALLOC_BLOCKS 16 + /* * Structures to pass information between the option parsing routine * and the main function *************** struct adhoc_opts *** 68,73 **** --- 70,77 ---- bool no_readline; bool no_psqlrc; bool single_txn; + int num_files; + char **files; }; static void parse_psql_options(int argc, char *argv[], *************** main(int argc, char *argv[]) *** 243,256 **** */ /* ! * process file given by -f */ if (options.action == ACT_FILE) { if (!options.no_psqlrc) process_psqlrc(argv[0]); ! successResult = process_file(options.action_string, options.single_txn); } /* --- 247,275 ---- */ /* ! * process file(s) given by -f ! * ! * not sure how to handle the successResult on this first */ if (options.action == ACT_FILE) { + int i; + if (!options.no_psqlrc) process_psqlrc(argv[0]); ! if (options.single_txn) ! PSQLexec("BEGIN", false); ! ! for (i = 0; ifiles = (char**)malloc(FILE_ALLOC_BLOCKS*sizeof(char*)); + memset(options->files, 0, FILE_ALLOC_BLOCKS*sizeof(char*)); while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:h:HlL:no:p:P:qR:sStT:U:v:VwWxX?1", long_options, &optindex)) != -1) *************** parse_psql_options(int argc, char *argv[ *** 398,404 **** break; case 'f': options->action = ACT_FILE; ! options->action_string = optarg; break; case 'F': pset.popt.topt.fieldSep = pg_strdup(optarg); --- 419,429 ---- break; case 'f': options->action = ACT_FILE; ! options->num_files++; ! if (!options->num_files % FILE_ALLOC_BLOCKS) { ! options->files = realloc(options->files, sizeof(char*) * (options->num_files + FILE_ALLOC_BLOCKS)); ! } ! options->files[options->num_files - 1] = optarg; break; case 'F': pset.popt.topt.fieldSep = pg_strdup(optarg);