Add rcfile support for quotestr and fix strcasestr

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1093 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2002-03-03 22:52:52 +00:00
parent e4f940dbaa
commit d76ca2bc9f
2 changed files with 22 additions and 6 deletions

View File

@ -67,6 +67,10 @@
# #
# set multibuffer # set multibuffer
# Use this as the quoting string. You shouldn't need to change this,
# but...... default "> "
# set quotestr "// "
# #
# Color setup # Color setup
# Format: color foreground,background "regex" ["regex"...] # Format: color foreground,background "regex" ["regex"...]

View File

@ -40,10 +40,8 @@
#define _(string) (string) #define _(string) (string)
#endif #endif
#define NUM_RCOPTS 20
/* Static stuff for the nanorc file */ /* Static stuff for the nanorc file */
rcoption rcopts[NUM_RCOPTS] = { rcoption rcopts[] = {
{"regexp", USE_REGEXP}, {"regexp", USE_REGEXP},
{"const", CONSTUPDATE}, {"const", CONSTUPDATE},
{"autoindent", AUTOINDENT}, {"autoindent", AUTOINDENT},
@ -63,7 +61,9 @@ rcoption rcopts[NUM_RCOPTS] = {
{"multibuffer", MULTIBUFFER}, {"multibuffer", MULTIBUFFER},
{"smooth", SMOOTHSCROLL}, {"smooth", SMOOTHSCROLL},
{"keypad", ALT_KEYPAD}, {"keypad", ALT_KEYPAD},
{"noconvert", NO_CONVERT} {"noconvert", NO_CONVERT},
{"quotestr", 0},
{"", 0}
}; };
static int errors = 0; static int errors = 0;
@ -147,7 +147,7 @@ int colortoint(char *colorname, int *bright)
if (colorname == NULL) if (colorname == NULL)
return -1; return -1;
if (strcasestr(colorname, "bright")) { if (stristr(colorname, "bright")) {
*bright = 1; *bright = 1;
colorname += 6; colorname += 6;
} }
@ -349,7 +349,7 @@ void parse_rcfile(FILE * rcstream)
/* We don't care if ptr == NULL, as it should if using proper syntax */ /* We don't care if ptr == NULL, as it should if using proper syntax */
if (set != 0) { if (set != 0) {
for (i = 0; i <= NUM_RCOPTS - 1; i++) { for (i = 0; rcopts[i].name != ""; i++) {
if (!strcasecmp(option, rcopts[i].name)) { if (!strcasecmp(option, rcopts[i].name)) {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, _("parse_rcfile: Parsing option %s\n"), fprintf(stderr, _("parse_rcfile: Parsing option %s\n"),
@ -361,6 +361,9 @@ void parse_rcfile(FILE * rcstream)
#ifndef DISABLE_WRAPJUSTIFY #ifndef DISABLE_WRAPJUSTIFY
!strcasecmp(rcopts[i].name, "fill") || !strcasecmp(rcopts[i].name, "fill") ||
#endif #endif
#ifndef DISABLE_JUSTIFY
!strcasecmp(rcopts[i].name, "quotestr") ||
#endif
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
!strcasecmp(rcopts[i].name, "speller") !strcasecmp(rcopts[i].name, "speller")
#else #else
@ -396,6 +399,15 @@ void parse_rcfile(FILE * rcstream)
} else { } else {
tabsize = i; tabsize = i;
} }
#ifndef DISABLE_JUSTIFY
} else
if (!strcasecmp(rcopts[i].name, "quotestr"))
{
quotestr = NULL;
quotestr =
charalloc(strlen(option) + 1);
strcpy(quotestr, option);
#endif
} else { } else {
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
alt_speller = alt_speller =