aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-02-22 11:36:33 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2012-02-24 22:48:26 +0100
commit3bc9497fc84abca0493083c3c208f0d2738bed38 (patch)
tree5f50bbd93b1885298df17c1d24848547c7813aa1 /src/config.c
parentf76e1cce404418cef74772536f2f5ac3a79b7b99 (diff)
downloadcalcurse-3bc9497fc84abca0493083c3c208f0d2738bed38.tar.gz
calcurse-3bc9497fc84abca0493083c3c208f0d2738bed38.zip
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 <calcurse@cryptocrack.de>
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c13
1 files changed, 4 insertions, 9 deletions
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)