Skip to content

Commit 57c97a9

Browse files
committed
SQL_CNF_FILE
1 parent c0de391 commit 57c97a9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sql.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ int main(int argc, const char *argv[])
353353
const char *defcsvcomma = csvcomma;
354354
poptContext popt; // context for parsing command-line options
355355
const struct poptOption optionsTable[] = {
356-
{ "sql-conf", 0, POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_STRING, &sqlconf, 0, "Client config file", "filename" },
356+
{ "sql-conf", 0, POPT_ARGFLAG_SHOW_DEFAULT | POPT_ARG_STRING, &sqlconf, 0, "Client config file ($SQL_CNF_FILE)", "filename" },
357357
{ "sql-host", 'h', POPT_ARG_STRING, &sqlhost, 0, "SQL server host", "hostname/ip" },
358358
{ "sql-port", 0, POPT_ARG_INT, &sqlport, 0, "SQL server port", "port" },
359359
{
@@ -458,6 +458,9 @@ int main(int argc, const char *argv[])
458458
if (expand && noexpand)
459459
errx(1, "Make your bloody mind up");
460460

461+
if (!sqlconf)
462+
sqlconf = getenv("SQL_CNF_FILE");
463+
461464
if (!expand)
462465
sql_real_connect(&sql, sqlhost, sqluser, sqlpass, sqldatabase, sqlport, 0, 0, 1, sqlconf);
463466

0 commit comments

Comments
 (0)