aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/builtin_set_color.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-07-25 18:16:00 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-07-25 18:16:34 -0700
commitf4d1657c22c81a7720a91026f915b80d2d6aa6e8 (patch)
tree03ebc46be5d18b98e2eecc76ccde83697a5b89cd /src/builtin_set_color.cpp
parentcaab298f723590fdaaff887ec32d1530da18920b (diff)
Eliminate wgetopt global variables
Replace them with a new struct wgetopter_t that uses instance variables instead.
Diffstat (limited to 'src/builtin_set_color.cpp')
-rw-r--r--src/builtin_set_color.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/builtin_set_color.cpp b/src/builtin_set_color.cpp
index 36ad7080..7f400543 100644
--- a/src/builtin_set_color.cpp
+++ b/src/builtin_set_color.cpp
@@ -67,6 +67,7 @@ static int set_color_builtin_outputter(char c)
*/
static int builtin_set_color(parser_t &parser, wchar_t **argv)
{
+ wgetopter_t w;
/** Variables used for parsing the argument list */
const struct woption long_options[] =
{
@@ -94,10 +95,10 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
int errret;
/* Parse options to obtain the requested operation and the modifiers */
- woptind = 0;
+ w.woptind = 0;
while (1)
{
- int c = wgetopt_long(argc, argv, short_options, long_options, 0);
+ int c = w.wgetopt_long(argc, argv, short_options, long_options, 0);
if (c == -1)
{
@@ -110,7 +111,7 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
break;
case 'b':
- bgcolor = woptarg;
+ bgcolor = w.woptarg;
break;
case 'h':
@@ -136,12 +137,12 @@ static int builtin_set_color(parser_t &parser, wchar_t **argv)
/* Remaining arguments are foreground color */
std::vector<rgb_color_t> fgcolors;
- for (; woptind < argc; woptind++)
+ for (; w.woptind < argc; w.woptind++)
{
- rgb_color_t fg = rgb_color_t(argv[woptind]);
+ rgb_color_t fg = rgb_color_t(argv[w.woptind]);
if (fg.is_none() || fg.is_ignore())
{
- append_format(stderr_buffer, _(L"%ls: Unknown color '%ls'\n"), argv[0], argv[woptind]);
+ append_format(stderr_buffer, _(L"%ls: Unknown color '%ls'\n"), argv[0], argv[w.woptind]);
return STATUS_BUILTIN_ERROR;
}
fgcolors.push_back(fg);