Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-02-26 19:47:43 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-02-26 19:47:43 +0400
commit97ad248f0cbd87cb1e351961b632bf9764f608fe (patch)
tree5f9415bd848801a9961cca01c16be3336855bc1a /winsup/cygwin/environ.cc
parentb0af77452cad7e92c10ff095cc4a25a5133c03ab (diff)
* environ.cc (enum settings): Add setbool. Rename justset to setdword
to avoid future problems. (struct parse_thing): Change all justset to setbool for bool variables. (parse_options): Add a case for setbool setting for bool variables since justset (now setdword) always writes a DWORD value, thus potentially overwriting adjacent memory locations. * external.cc (cygwin_internal): Drop extern declaration.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index a99f97cf8..33289d2f5 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -40,8 +40,9 @@ static NO_COPY bool export_settings = false;
enum settings
{
- justset,
isfunc,
+ setdword,
+ setbool,
setbit
};
@@ -111,16 +112,16 @@ static struct parse_thing
} values[2];
} known[] NO_COPY =
{
- {"detect_bloda", {&detect_bloda}, justset, NULL, {{false}, {true}}},
- {"dosfilewarning", {&dos_file_warning}, justset, NULL, {{false}, {true}}},
+ {"detect_bloda", {&detect_bloda}, setbool, NULL, {{false}, {true}}},
+ {"dosfilewarning", {&dos_file_warning}, setbool, NULL, {{false}, {true}}},
{"error_start", {func: error_start_init}, isfunc, NULL, {{0}, {0}}},
- {"export", {&export_settings}, justset, NULL, {{false}, {true}}},
+ {"export", {&export_settings}, setbool, NULL, {{false}, {true}}},
{"glob", {func: glob_init}, isfunc, NULL, {{0}, {s: "normal"}}},
{"proc_retry", {func: set_proc_retry}, isfunc, NULL, {{0}, {5}}},
- {"reset_com", {&reset_com}, justset, NULL, {{false}, {true}}},
+ {"reset_com", {&reset_com}, setbool, NULL, {{false}, {true}}},
{"tty", {func: tty_is_gone}, isfunc, NULL, {{0}, {0}}},
- {"winsymlinks", {&allow_winsymlinks}, justset, NULL, {{false}, {true}}},
- {NULL, {0}, justset, 0, {{0}, {0}}}
+ {"winsymlinks", {&allow_winsymlinks}, setbool, NULL, {{false}, {true}}},
+ {NULL, {0}, setdword, 0, {{0}, {0}}}
};
/* Parse a string of the form "something=stuff somethingelse=more-stuff",
@@ -180,13 +181,20 @@ parse_options (const char *inbuf)
k->values[istrue].s : eq);
debug_printf ("%s (called func)", k->name);
break;
- case justset:
+ case setdword:
if (!istrue || !eq)
*k->setting.x = k->values[istrue].i;
else
*k->setting.x = strtol (eq, NULL, 0);
debug_printf ("%s %d", k->name, *k->setting.x);
break;
+ case setbool:
+ if (!istrue || !eq)
+ *k->setting.b = k->values[istrue].i;
+ else
+ *k->setting.b = !!strtol (eq, NULL, 0);
+ debug_printf ("%s%s", *k->setting.b ? "" : "no", k->name);
+ break;
case setbit:
*k->setting.x &= ~k->values[istrue].i;
if (istrue || (eq && strtol (eq, NULL, 0)))