From 3bc9497fc84abca0493083c3c208f0d2738bed38 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Wed, 22 Feb 2012 11:36:33 +0100 Subject: Add a read-only option We don't save any configuration nor items if this is set. This should be used with care, and hence there's no short option for this. Signed-off-by: Lukas Fleischer --- src/config.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/config.c') diff --git a/src/config.c b/src/config.c index e965c1a..6355781 100644 --- a/src/config.c +++ b/src/config.c @@ -451,19 +451,11 @@ config_file_walk (config_fn_walk_cb_t fn_cb, config_fn_walk_junk_cb_t fn_junk_cb, void *data) { FILE *data_file; - char *mesg_line1 = _("Failed to open config file"); - char *mesg_line2 = _("Press [ENTER] to continue"); char buf[BUFSIZ], e_conf[BUFSIZ]; char *key, *value; data_file = fopen (path_conf, "r"); - if (data_file == NULL) - { - status_mesg (mesg_line1, mesg_line2); - wnoutrefresh (win[STA].p); - wins_doupdate (); - keys_getch (win[STA].p, NULL); - } + EXIT_IF (data_file == NULL, _("failed to open configuration file")); pthread_mutex_lock (&nbar.mutex); for (;;) @@ -561,6 +553,9 @@ config_save (void) struct config_save_status status; int i; + if (read_only) + return 1; + strncpy (tmppath, get_tempdir (), BUFSIZ); strncat (tmppath, "/" CONF_PATH_NAME ".", BUFSIZ - strlen (tmppath) - 1); if ((tmpext = new_tempfile (tmppath, TMPEXTSIZ)) == NULL) -- cgit v1.2.3