Deleted Added
full compact
optfunc.c (238730) optfunc.c (293190)
1/*
1/*
2 * Copyright (C) 1984-2012 Mark Nudelman
2 * Copyright (C) 1984-2015 Mark Nudelman
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information, see the README file.
8 */
9
10

--- 27 unchanged lines hidden (view full) ---

38extern int dohelp;
39extern int any_display;
40extern char openquote;
41extern char closequote;
42extern char *prproto[];
43extern char *eqproto;
44extern char *hproto;
45extern char *wproto;
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Less License, as specified in the README file.
6 *
7 * For more information, see the README file.
8 */
9
10

--- 27 unchanged lines hidden (view full) ---

38extern int dohelp;
39extern int any_display;
40extern char openquote;
41extern char closequote;
42extern char *prproto[];
43extern char *eqproto;
44extern char *hproto;
45extern char *wproto;
46extern char *every_first_cmd;
46extern IFILE curr_ifile;
47extern char version[];
48extern int jump_sline;
49extern int jump_sline_fraction;
50extern int shift_count;
51extern int shift_count_fraction;
52extern int less_is_more;
53#if LOGFILE
54extern char *namelogfile;
55extern int force_logfile;
56extern int logfile;
57#endif
58#if TAGS
59public char *tagoption = NULL;
60extern char *tags;
47extern IFILE curr_ifile;
48extern char version[];
49extern int jump_sline;
50extern int jump_sline_fraction;
51extern int shift_count;
52extern int shift_count_fraction;
53extern int less_is_more;
54#if LOGFILE
55extern char *namelogfile;
56extern int force_logfile;
57extern int logfile;
58#endif
59#if TAGS
60public char *tagoption = NULL;
61extern char *tags;
62extern char ztags[];
61#endif
62#if MSDOS_COMPILER
63extern int nm_fg_color, nm_bg_color;
64extern int bo_fg_color, bo_bg_color;
65extern int ul_fg_color, ul_bg_color;
66extern int so_fg_color, so_bg_color;
67extern int bl_fg_color, bl_bg_color;
68#endif

--- 13 unchanged lines hidden (view full) ---

82 if (secure)
83 {
84 error("log file support is not available", NULL_PARG);
85 return;
86 }
87 switch (type)
88 {
89 case INIT:
63#endif
64#if MSDOS_COMPILER
65extern int nm_fg_color, nm_bg_color;
66extern int bo_fg_color, bo_bg_color;
67extern int ul_fg_color, ul_bg_color;
68extern int so_fg_color, so_bg_color;
69extern int bl_fg_color, bl_bg_color;
70#endif

--- 13 unchanged lines hidden (view full) ---

84 if (secure)
85 {
86 error("log file support is not available", NULL_PARG);
87 return;
88 }
89 switch (type)
90 {
91 case INIT:
90 namelogfile = s;
92 namelogfile = save(s);
91 break;
92 case TOGGLE:
93 if (ch_getflags() & CH_CANSEEK)
94 {
95 error("Input is not a pipe", NULL_PARG);
96 return;
97 }
98 if (logfile >= 0)
99 {
100 error("Log file is already in use", NULL_PARG);
101 return;
102 }
103 s = skipsp(s);
93 break;
94 case TOGGLE:
95 if (ch_getflags() & CH_CANSEEK)
96 {
97 error("Input is not a pipe", NULL_PARG);
98 return;
99 }
100 if (logfile >= 0)
101 {
102 error("Log file is already in use", NULL_PARG);
103 return;
104 }
105 s = skipsp(s);
106 if (namelogfile != NULL)
107 free(namelogfile);
104 namelogfile = lglob(s);
105 use_logfile(namelogfile);
106 sync_logfile();
107 break;
108 case QUERY:
109 if (logfile < 0)
110 error("No log file", NULL_PARG);
111 else

--- 59 unchanged lines hidden (view full) ---

171 if (jump_sline_fraction < 0)
172 {
173 parg.p_int = jump_sline;
174 error("Position target at screen line %d", &parg);
175 } else
176 {
177
178 sprintf(buf, ".%06d", jump_sline_fraction);
108 namelogfile = lglob(s);
109 use_logfile(namelogfile);
110 sync_logfile();
111 break;
112 case QUERY:
113 if (logfile < 0)
114 error("No log file", NULL_PARG);
115 else

--- 59 unchanged lines hidden (view full) ---

175 if (jump_sline_fraction < 0)
176 {
177 parg.p_int = jump_sline;
178 error("Position target at screen line %d", &parg);
179 } else
180 {
181
182 sprintf(buf, ".%06d", jump_sline_fraction);
179 len = strlen(buf);
183 len = (int) strlen(buf);
180 while (len > 2 && buf[len-1] == '0')
181 len--;
182 buf[len] = '\0';
183 parg.p_string = buf;
184 error("Position target at screen position %s", &parg);
185 }
186 break;
187 }

--- 48 unchanged lines hidden (view full) ---

236 if (shift_count_fraction < 0)
237 {
238 parg.p_int = shift_count;
239 error("Horizontal shift %d columns", &parg);
240 } else
241 {
242
243 sprintf(buf, ".%06d", shift_count_fraction);
184 while (len > 2 && buf[len-1] == '0')
185 len--;
186 buf[len] = '\0';
187 parg.p_string = buf;
188 error("Position target at screen position %s", &parg);
189 }
190 break;
191 }

--- 48 unchanged lines hidden (view full) ---

240 if (shift_count_fraction < 0)
241 {
242 parg.p_int = shift_count;
243 error("Horizontal shift %d columns", &parg);
244 } else
245 {
246
247 sprintf(buf, ".%06d", shift_count_fraction);
244 len = strlen(buf);
248 len = (int) strlen(buf);
245 while (len > 2 && buf[len-1] == '0')
246 len--;
247 buf[len] = '\0';
248 parg.p_string = buf;
249 error("Horizontal shift %s of screen width", &parg);
250 }
251 break;
252 }

--- 37 unchanged lines hidden (view full) ---

290 char *s;
291{
292 IFILE save_ifile;
293 POSITION pos;
294
295 switch (type)
296 {
297 case INIT:
249 while (len > 2 && buf[len-1] == '0')
250 len--;
251 buf[len] = '\0';
252 parg.p_string = buf;
253 error("Horizontal shift %s of screen width", &parg);
254 }
255 break;
256 }

--- 37 unchanged lines hidden (view full) ---

294 char *s;
295{
296 IFILE save_ifile;
297 POSITION pos;
298
299 switch (type)
300 {
301 case INIT:
298 tagoption = s;
302 tagoption = save(s);
299 /* Do the rest in main() */
300 break;
301 case TOGGLE:
302 if (secure)
303 {
304 error("tags support is not available", NULL_PARG);
305 break;
306 }

--- 23 unchanged lines hidden (view full) ---

330 int type;
331 char *s;
332{
333 PARG parg;
334
335 switch (type)
336 {
337 case INIT:
303 /* Do the rest in main() */
304 break;
305 case TOGGLE:
306 if (secure)
307 {
308 error("tags support is not available", NULL_PARG);
309 break;
310 }

--- 23 unchanged lines hidden (view full) ---

334 int type;
335 char *s;
336{
337 PARG parg;
338
339 switch (type)
340 {
341 case INIT:
338 tags = s;
342 tags = save(s);
339 break;
340 case TOGGLE:
341 s = skipsp(s);
343 break;
344 case TOGGLE:
345 s = skipsp(s);
346 if (tags != NULL && tags != ztags)
347 free(tags);
342 tags = lglob(s);
343 break;
344 case QUERY:
345 parg.p_string = tags;
346 error("Tags file \"%s\"", &parg);
347 break;
348 }
349}

--- 6 unchanged lines hidden (view full) ---

356opt_p(type, s)
357 int type;
358 register char *s;
359{
360 switch (type)
361 {
362 case INIT:
363 /*
348 tags = lglob(s);
349 break;
350 case QUERY:
351 parg.p_string = tags;
352 error("Tags file \"%s\"", &parg);
353 break;
354 }
355}

--- 6 unchanged lines hidden (view full) ---

362opt_p(type, s)
363 int type;
364 register char *s;
365{
366 switch (type)
367 {
368 case INIT:
369 /*
364 * Unget a search command for the specified string.
365 * {{ This won't work if the "/" command is
366 * changed or invalidated by a .lesskey file. }}
370 * Unget a command for the specified string.
367 */
371 */
368 plusoption = TRUE;
369 ungetsc(s);
370 /*
371 * In "more" mode, the -p argument is a command,
372 * not a search string, so we don't need a slash.
373 */
374 if (!less_is_more)
372 if (less_is_more)
373 {
374 /*
375 * In "more" mode, the -p argument is a command,
376 * not a search string, so we don't need a slash.
377 */
378 every_first_cmd = save(s);
379 } else
380 {
381 plusoption = TRUE;
382 ungetcc(CHAR_END_COMMAND);
383 ungetsc(s);
384 /*
385 * {{ This won't work if the "/" command is
386 * changed or invalidated by a .lesskey file. }}
387 */
375 ungetsc("/");
388 ungetsc("/");
389 }
376 break;
377 }
378}
379
380/*
381 * Handler for -P option.
382 */
383 public void

--- 114 unchanged lines hidden (view full) ---

498#endif
499#if HAVE_V8_REGCOMP
500 putstr("Spencer V8 ");
501#endif
502#if !HAVE_GNU_REGEX && !HAVE_POSIX_REGCOMP && !HAVE_PCRE && !HAVE_RE_COMP && !HAVE_REGCMP && !HAVE_V8_REGCOMP
503 putstr("no ");
504#endif
505 putstr("regular expressions)\n");
390 break;
391 }
392}
393
394/*
395 * Handler for -P option.
396 */
397 public void

--- 114 unchanged lines hidden (view full) ---

512#endif
513#if HAVE_V8_REGCOMP
514 putstr("Spencer V8 ");
515#endif
516#if !HAVE_GNU_REGEX && !HAVE_POSIX_REGCOMP && !HAVE_PCRE && !HAVE_RE_COMP && !HAVE_REGCMP && !HAVE_V8_REGCOMP
517 putstr("no ");
518#endif
519 putstr("regular expressions)\n");
506 putstr("Copyright (C) 1984-2012 Mark Nudelman\n\n");
520 putstr("Copyright (C) 1984-2015 Mark Nudelman\n\n");
507 putstr("less comes with NO WARRANTY, to the extent permitted by law.\n");
508 putstr("For information about the terms of redistribution,\n");
509 putstr("see the file named README in the less distribution.\n");
510 putstr("Homepage: http://www.greenwoodsoftware.com/less\n");
511 quit(QUIT_OK);
512 break;
513 }
514}

--- 215 unchanged lines hidden ---
521 putstr("less comes with NO WARRANTY, to the extent permitted by law.\n");
522 putstr("For information about the terms of redistribution,\n");
523 putstr("see the file named README in the less distribution.\n");
524 putstr("Homepage: http://www.greenwoodsoftware.com/less\n");
525 quit(QUIT_OK);
526 break;
527 }
528}

--- 215 unchanged lines hidden ---