--- src/dillo.c.orig 2005-05-14 11:16:28.000000000 +0200 +++ src/dillo.c 2005-07-10 12:39:46.000000000 +0200 @@ -70,6 +70,7 @@ DILLO_CLI_LOCAL = 1 << 5, DILLO_CLI_GEOMETRY = 1 << 6, DILLO_CLI_DBG_RENDERING = 1 << 7, + DILLO_CLI_RCFILE = 1 << 8, DILLO_CLI_ERROR = 1 << 15 }; @@ -81,6 +82,7 @@ * Global variables from command line options; */ gboolean dillo_dbg_rendering = FALSE; +char *rcfile = DILLO_RCFILE; /* * Forward declarations @@ -114,6 +116,9 @@ 0, DILLO_CLI_DBG_RENDERING, " -D, --debug-rendering Draw additionaly several lines in a web page,\n" " representing its structure. For debugging. "}, + {"-R", "--rcfile FILE", + 1, DILLO_CLI_RCFILE, + " -R, --rcfile FILE Use alternative rcfile."}, {NULL, NULL, 0, 0, NULL} }; @@ -252,6 +257,9 @@ case DILLO_CLI_GEOMETRY: if (a_Misc_parse_geometry(opt_argv[0], &xpos, &ypos, &width, &height)) break; + case DILLO_CLI_RCFILE: + rcfile = opt_argv[0]; + break; default: g_printerr("Error in command line options.\n"); return -1; --- src/dillo.h.orig 2005-07-10 12:47:54.000000000 +0200 +++ src/dillo.h 2005-07-10 12:31:33.000000000 +0200 @@ -5,5 +5,6 @@ #include "web.h" extern gboolean dillo_dbg_rendering; +#define DILLO_RCFILE ".dillo/dillorc" #endif /* __DILLO_H__ */ --- src/prefs.c.orig 2005-05-14 11:16:29.000000000 +0200 +++ src/prefs.c 2005-07-10 12:42:58.000000000 +0200 @@ -29,7 +29,10 @@ #include "prefs.h" #include "colors.h" #include "misc.h" +#include "dillo.h" +extern char* rcfile; + /* symbol array */ static const struct { gchar *name; @@ -277,9 +280,18 @@ gchar *file; /* Here we load and set options from dillorc */ - file = a_Misc_prepend_user_home(".dillo/dillorc"); - fd = open(file, O_RDONLY); - g_free(file); + if(strcmp(rcfile, DILLO_RCFILE) == 0) { + file = a_Misc_prepend_user_home(rcfile); + fd = open(file, O_RDONLY); + g_free(file); + } else { + /* or from an alternative file specified on the command line*/ + /* with the -R --rcfile switch */ + if((fd = open(rcfile, O_RDONLY)) < 0 ) { + g_printerr("Error: Cannot find: '%s'\n.", rcfile); + } + } + if (fd < 0 && (fd = open(DILLORC_SYS, O_RDONLY)) < 0) return FILE_NOT_FOUND; @@ -318,7 +330,7 @@ g_scanner_input_file(scanner, fd); /* give the error handler an idea on how the input is named */ - scanner->input_name = "dillorc"; + scanner->input_name = rcfile; /* * Scanning loop, we parse the input until it's end is reached,