2 * Handling functions for command line options.
4 * Most options are handled by the generic code in option.c.
5 * But all string options, and a few non-string options, require
6 * special handling specific to the particular option.
7 * This special processing is done by the "handling functions" in this file.
9 * Each handling function is passed a "type" and, if it is a string
10 * option, the string which should be "assigned" to the option.
11 * The type may be one of:
12 * INIT The option is being initialized from the command line.
13 * TOGGLE The option is being changed from within the program.
14 * QUERY The setting of the option is merely being queried.
25 extern int plusoption;
26 extern char *prproto[];
28 extern IFILE curr_ifile;
30 extern char *namelogfile;
31 extern int force_logfile;
36 public int tagoption = 0;
38 extern char *tagpattern;
42 public char *window_box = NULL;
43 extern int directvideo;
44 extern int output_mode;
50 * Handler for -o option.
67 error("Input is not a pipe", NULL_PARG);
72 error("Log file is already in use", NULL_PARG);
76 namelogfile = glob(s);
77 if (namelogfile == NULL)
78 namelogfile = save(s);
84 error("No log file", NULL_PARG);
87 parg.p_string = namelogfile;
88 error("Log file \"%s\"", &parg);
95 * Handler for -O option.
107 * Handlers for obsolete -l and -L options.
114 error("The -l option is obsolete. Use -o", NULL_PARG);
122 error("The -L option is obsolete. Use -O", NULL_PARG);
140 error("Cannot use lesskey file \"%s\"", &parg);
145 error("Cannot query the -k flag", NULL_PARG);
153 * Handler for -t option.
172 curr_filename = get_filename(curr_ifile);
173 if (edit(tagfile, 0) == 0)
175 (void) edit(curr_filename, 0);
179 error("Tag is required after -t", NULL_PARG);
185 * Handler for -T option.
206 parg.p_string = tags;
207 error("Tags file \"%s\"", &parg);
214 * Handler for -p option.
225 * Unget a search command for the specified string.
226 * {{ This won't work if the "/" command is
227 * changed or invalidated by a .lesskey file. }}
234 error("Pattern is required after -p", NULL_PARG);
240 * Handler for -P option.
247 register char **proto;
255 * Figure out which prototype string should be changed.
259 case 'm': proto = &prproto[PR_MEDIUM]; s++; break;
260 case 'M': proto = &prproto[PR_LONG]; s++; break;
261 case '=': proto = &eqproto; s++; break;
262 default: proto = &prproto[pr_type]; break;
268 parg.p_string = prproto[pr_type];
275 * Handler for the -b option.
288 * Allocate the new number of buffers.
290 cbufs = ch_nbuf(cbufs);
299 * Handler for -v option. (use BIOS or direct video)
310 if (output_mode == 2)
321 * Handler for -W option. (set/modify window boundaries)
333 window_box = save(s);
334 break; /* get_term will take care of actually setting window */
337 if (window_box != NULL)
339 window_box = save(s);
344 parg.p_string = window_box;
352 * "-?" means display a help message.
353 * If from the command line, exit immediately.
367 error("Use \"h\" for help", NULL_PARG);