File src/commands.c changed (mode: 100644) (index 53098a471..41a5a7e2d) |
... |
... |
static const struct cmd_add commands[] = { |
342 |
342 |
{ .name = "screen", .abbr = NULL, .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0, |
{ .name = "screen", .abbr = NULL, .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0, |
343 |
343 |
.handler = screen_cmd, .qmark = 1, .expand = 0, .cust_sep = 0, .min_args = 0, .max_args = 0, .select = 0, }, |
.handler = screen_cmd, .qmark = 1, .expand = 0, .cust_sep = 0, .min_args = 0, .max_args = 0, .select = 0, }, |
344 |
344 |
{ .name = "set", .abbr = "se", .emark = 0, .id = COM_SET, .range = 0, .bg = 0, .quote = 0, .regexp = 0, |
{ .name = "set", .abbr = "se", .emark = 0, .id = COM_SET, .range = 0, .bg = 0, .quote = 0, .regexp = 0, |
345 |
|
.handler = set_cmd, .qmark = 0, .expand = 0, .cust_sep = 0, .min_args = 1, .max_args = NOT_DEF, .select = 0, }, |
|
|
345 |
|
.handler = set_cmd, .qmark = 0, .expand = 0, .cust_sep = 0, .min_args = 0, .max_args = NOT_DEF, .select = 0, }, |
346 |
346 |
{ .name = "shell", .abbr = "sh", .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0, |
{ .name = "shell", .abbr = "sh", .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0, |
347 |
347 |
.handler = shell_cmd, .qmark = 0, .expand = 0, .cust_sep = 0, .min_args = 0, .max_args = 0, .select = 0, }, |
.handler = shell_cmd, .qmark = 0, .expand = 0, .cust_sep = 0, .min_args = 0, .max_args = 0, .select = 0, }, |
348 |
348 |
{ .name = "sort", .abbr = "sor", .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0, |
{ .name = "sort", .abbr = "sor", .emark = 0, .id = -1, .range = 0, .bg = 0, .quote = 0, .regexp = 0, |
File src/options.c changed (mode: 100644) (index c79b90dc0..ec2dbbfa8) |
... |
... |
struct opt_t { |
45 |
45 |
|
|
46 |
46 |
static struct opt_t * add_option_inner(const char *name, enum opt_type type, |
static struct opt_t * add_option_inner(const char *name, enum opt_type type, |
47 |
47 |
int val_count, const char **vals, opt_handler handler); |
int val_count, const char **vals, opt_handler handler); |
|
48 |
|
static void print_changed_options(void); |
48 |
49 |
static const char * extract_option(const char *cmd, char *buf, int replace); |
static const char * extract_option(const char *cmd, char *buf, int replace); |
49 |
50 |
static int process_option(const char *cmd); |
static int process_option(const char *cmd); |
50 |
51 |
static const char * skip_alphas(const char *cmd); |
static const char * skip_alphas(const char *cmd); |
|
... |
... |
int |
192 |
193 |
set_options(const char *cmd) |
set_options(const char *cmd) |
193 |
194 |
{ |
{ |
194 |
195 |
int err = 0; |
int err = 0; |
|
196 |
|
|
|
197 |
|
if(*cmd == '\0') |
|
198 |
|
{ |
|
199 |
|
print_changed_options(); |
|
200 |
|
return 0; |
|
201 |
|
} |
|
202 |
|
|
195 |
203 |
while(*cmd != '\0') |
while(*cmd != '\0') |
196 |
204 |
{ |
{ |
197 |
205 |
char buf[1024]; |
char buf[1024]; |
|
... |
... |
set_options(const char *cmd) |
204 |
212 |
return err; |
return err; |
205 |
213 |
} |
} |
206 |
214 |
|
|
|
215 |
|
static void |
|
216 |
|
print_changed_options(void) |
|
217 |
|
{ |
|
218 |
|
int i; |
|
219 |
|
for(i = 0; i < options_count; i++) |
|
220 |
|
{ |
|
221 |
|
struct opt_t *opt = &options[i]; |
|
222 |
|
|
|
223 |
|
if(opt->full != NULL) |
|
224 |
|
continue; |
|
225 |
|
|
|
226 |
|
if(opt->type == OPT_STR || opt->type == OPT_STRLIST) |
|
227 |
|
{ |
|
228 |
|
if(strcmp(opt->val.str_val, opt->def.str_val) == 0) |
|
229 |
|
continue; |
|
230 |
|
} |
|
231 |
|
else if(opt->val.int_val == opt->def.int_val) |
|
232 |
|
{ |
|
233 |
|
continue; |
|
234 |
|
} |
|
235 |
|
|
|
236 |
|
set_print(&options[i]); |
|
237 |
|
} |
|
238 |
|
} |
|
239 |
|
|
207 |
240 |
static const char * |
static const char * |
208 |
241 |
extract_option(const char *cmd, char *buf, int replace) |
extract_option(const char *cmd, char *buf, int replace) |
209 |
242 |
{ |
{ |