summaryrefslogtreecommitdiffstats
path: root/contrib/dialog/rc.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/dialog/rc.c')
-rw-r--r--contrib/dialog/rc.c45
1 files changed, 9 insertions, 36 deletions
diff --git a/contrib/dialog/rc.c b/contrib/dialog/rc.c
index cc6af29..2e2c7e6 100644
--- a/contrib/dialog/rc.c
+++ b/contrib/dialog/rc.c
@@ -1,5 +1,5 @@
/*
- * $Id: rc.c,v 1.49 2011/10/15 00:56:44 tom Exp $
+ * $Id: rc.c,v 1.47 2011/06/20 22:30:04 tom Exp $
*
* rc.c -- routines for processing the configuration file
*
@@ -203,10 +203,9 @@ attr_to_str(char *str, int fg, int bg, int hl)
/*
* Extract the foreground, background and highlight values from an attribute
- * represented as a string in one of two forms:
+ * represented as a string in this form:
*
* "(foreground,background,highlight)"
- " "xxxx_color"
*/
static int
str_to_attr(char *str, int *fg, int *bg, int *hl)
@@ -215,15 +214,8 @@ str_to_attr(char *str, int *fg, int *bg, int *hl)
unsigned j;
char tempstr[MAX_LEN + 1], *part;
- if (str[0] != '(' || lastch(str) != ')') {
- if ((i = find_color(str)) >= 0) {
- *fg = dlg_color_table[i].fg;
- *bg = dlg_color_table[i].bg;
- *hl = dlg_color_table[i].hilite;
- return 0;
- }
+ if (str[0] != '(' || lastch(str) != ')')
return -1; /* invalid representation */
- }
/* remove the parenthesis */
strcpy(tempstr, str + 1);
@@ -432,29 +424,13 @@ dlg_create_rc(const char *filename)
#ifdef HAVE_COLOR
for (i = 0; i < (unsigned) dlg_color_count(); ++i) {
char buffer[MAX_LEN + 1];
- unsigned j;
- bool repeat = FALSE;
fprintf(rc_file, "\n# %s\n", dlg_color_table[i].comment);
- for (j = 0; j != i; ++j) {
- if (dlg_color_table[i].fg == dlg_color_table[j].fg
- && dlg_color_table[i].bg == dlg_color_table[j].bg
- && dlg_color_table[i].hilite == dlg_color_table[j].hilite) {
- fprintf(rc_file, "%s = %s\n",
- dlg_color_table[i].name,
- dlg_color_table[j].name);
- repeat = TRUE;
- break;
- }
- }
-
- if (!repeat) {
- fprintf(rc_file, "%s = %s\n", dlg_color_table[i].name,
- attr_to_str(buffer,
- dlg_color_table[i].fg,
- dlg_color_table[i].bg,
- dlg_color_table[i].hilite));
- }
+ fprintf(rc_file, "%s = %s\n", dlg_color_table[i].name,
+ attr_to_str(buffer,
+ dlg_color_table[i].fg,
+ dlg_color_table[i].bg,
+ dlg_color_table[i].hilite));
}
#endif /* HAVE_COLOR */
dlg_dump_keys(rc_file);
@@ -531,10 +507,7 @@ dlg_parse_rc(void)
lastch(str) = '\0';
if (begins_with(str, "bindkey", &params)) {
- if (!dlg_parse_bindkey(params)) {
- fprintf(stderr, "\nParse error: line %d of configuration\n", l);
- result = -1;
- }
+ dlg_parse_bindkey(params);
continue;
}
parse = parse_line(str, &var, &value); /* parse current line */
OpenPOWER on IntegriCloud