summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2013-09-09 16:55:18 +0200
committerSven Eden <yamakuzure@gmx.net>2013-09-09 16:55:18 +0200
commitb474c18106323db3d7dfe867c7598defe3f2ddd9 (patch)
tree70f8dbbb7aa826a44f040a63320a9bbc57cc1925 /ufed-curses-checklist.c
parentThe warning issued when make.conf is not writable is now prefixed with a "WAR... (diff)
downloadufed-b474c18106323db3d7dfe867c7598defe3f2ddd9.tar.gz
ufed-b474c18106323db3d7dfe867c7598defe3f2ddd9.tar.bz2
ufed-b474c18106323db3d7dfe867c7598defe3f2ddd9.zip
Added prefixing of predefined configuration values and added read-only-mode as the first in use. When read-only-mode is set, the interface now changes both header lines to other colors and to show the user that flags are not saved.
Diffstat (limited to 'ufed-curses-checklist.c')
-rw-r--r--ufed-curses-checklist.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c
index 003fc9a..4a12968 100644
--- a/ufed-curses-checklist.c
+++ b/ufed-curses-checklist.c
@@ -51,6 +51,24 @@ static char *getline(FILE *fp)
if(fgets(lineBuf, size, fp) == NULL)
return NULL;
else {
+
+ /* See to configuration bytes if not read already */
+ if (!configDone) {
+ /* Byte 1: Whether read-only-mode is set or not */
+ if ( '0' != lineBuf[0] )
+ ro_mode = true;
+
+ configDone = true;
+
+ /* Remove the leading bytes transporting configuration values */
+ char *oldLine = lineBuf;
+ lineBuf = malloc(size);
+ if (NULL == lineBuf)
+ ERROR_EXIT(-1, "Can not allocate %lu bytes for line buffer\n", sizeof(char) * size);
+ memcpy(lineBuf, oldLine + 1, size - 1);
+ free(oldLine);
+ } /* End of having to read configuration bytes */
+
char *p = strchr(lineBuf, '\n');
if(p != NULL) {
*p = '\0';