Lines 41-46
__FBSDID("$FreeBSD$");
Link Here
|
41 |
#include <signal.h> |
41 |
#include <signal.h> |
42 |
#include <unistd.h> |
42 |
#include <unistd.h> |
43 |
#include <stdlib.h> |
43 |
#include <stdlib.h> |
|
|
44 |
#include <stdbool.h> |
44 |
|
45 |
|
45 |
#include "shell.h" |
46 |
#include "shell.h" |
46 |
#define DEFINE_OPTIONS |
47 |
#define DEFINE_OPTIONS |
Lines 148-157
optschanged(void)
Link Here
|
148 |
static void |
149 |
static void |
149 |
options(int cmdline) |
150 |
options(int cmdline) |
150 |
{ |
151 |
{ |
|
|
152 |
bool saw_minus_c; |
151 |
char *kp, *p; |
153 |
char *kp, *p; |
152 |
int val; |
154 |
int val; |
153 |
int c; |
155 |
int c; |
154 |
|
156 |
|
|
|
157 |
saw_minus_c = false; |
158 |
|
155 |
if (cmdline) |
159 |
if (cmdline) |
156 |
minusc = NULL; |
160 |
minusc = NULL; |
157 |
while ((p = *argptr) != NULL) { |
161 |
while ((p = *argptr) != NULL) { |
Lines 186-201
options(int cmdline)
Link Here
|
186 |
val = 0; |
190 |
val = 0; |
187 |
} else { |
191 |
} else { |
188 |
argptr--; |
192 |
argptr--; |
|
|
193 |
if (saw_minus_c) |
194 |
minusc = *argptr++; |
189 |
break; |
195 |
break; |
190 |
} |
196 |
} |
191 |
while ((c = *p++) != '\0') { |
197 |
while ((c = *p++) != '\0') { |
192 |
if (c == 'c' && cmdline) { |
198 |
if (c == 'c' && cmdline) { |
193 |
char *q; |
199 |
saw_minus_c = true; |
194 |
|
|
|
195 |
q = *argptr++; |
196 |
if (q == NULL || minusc != NULL) |
197 |
error("Bad -c option"); |
198 |
minusc = q; |
199 |
} else if (c == 'o') { |
200 |
} else if (c == 'o') { |
200 |
minus_o(*argptr, val); |
201 |
minus_o(*argptr, val); |
201 |
if (*argptr) |
202 |
if (*argptr) |