optfunc.c (a5f0fb151d90effe79714de0fa059954725fe57f) optfunc.c (c9346414d95d69f958210e825deb3b086dac3529)
1/*
2 * Copyright (C) 1984-2000 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 about less, or for information on how to
8 * contact the author, see the README file.

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

37extern int secure;
38extern int dohelp;
39extern int any_display;
40extern char openquote;
41extern char closequote;
42extern char *prproto[];
43extern char *eqproto;
44extern char *hproto;
1/*
2 * Copyright (C) 1984-2000 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 about less, or for information on how to
8 * contact the author, see the README file.

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

37extern int secure;
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;
45extern IFILE curr_ifile;
46extern char version[];
47#if LOGFILE
48extern char *namelogfile;
49extern int force_logfile;
50extern int logfile;
51#endif
52#if TAGS

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

286 */
287 switch (*s)
288 {
289 case 's': proto = &prproto[PR_SHORT]; s++; break;
290 case 'm': proto = &prproto[PR_MEDIUM]; s++; break;
291 case 'M': proto = &prproto[PR_LONG]; s++; break;
292 case '=': proto = &eqproto; s++; break;
293 case 'h': proto = &hproto; s++; break;
46extern IFILE curr_ifile;
47extern char version[];
48#if LOGFILE
49extern char *namelogfile;
50extern int force_logfile;
51extern int logfile;
52#endif
53#if TAGS

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

287 */
288 switch (*s)
289 {
290 case 's': proto = &prproto[PR_SHORT]; s++; break;
291 case 'm': proto = &prproto[PR_MEDIUM]; s++; break;
292 case 'M': proto = &prproto[PR_LONG]; s++; break;
293 case '=': proto = &eqproto; s++; break;
294 case 'h': proto = &hproto; s++; break;
295 case 'w': proto = &wproto; s++; break;
294 default: proto = &prproto[PR_SHORT]; break;
295 }
296 free(*proto);
297 *proto = save(s);
298 break;
299 case QUERY:
300 parg.p_string = prproto[pr_type];
301 error("%s", &parg);

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

363 break;
364 case INIT:
365 /*
366 * Force output to stdout per GNU standard for --version output.
367 */
368 any_display = 1;
369 putstr("less ");
370 putstr(version);
296 default: proto = &prproto[PR_SHORT]; break;
297 }
298 free(*proto);
299 *proto = save(s);
300 break;
301 case QUERY:
302 parg.p_string = prproto[pr_type];
303 error("%s", &parg);

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

365 break;
366 case INIT:
367 /*
368 * Force output to stdout per GNU standard for --version output.
369 */
370 any_display = 1;
371 putstr("less ");
372 putstr(version);
371 putstr("\nCopyright (C) 2000 Mark Nudelman\n\n");
373 putstr("\nCopyright (C) 2001 Mark Nudelman\n\n");
372 putstr("less comes with NO WARRANTY, to the extent permitted by law.\n");
373 putstr("For information about the terms of redistribution,\n");
374 putstr("see the file named README in the less distribution.\n");
374 putstr("less comes with NO WARRANTY, to the extent permitted by law.\n");
375 putstr("For information about the terms of redistribution,\n");
376 putstr("see the file named README in the less distribution.\n");
377 putstr("Homepage: http://www.greenwoodsoftware.com/less\n");
375 quit(QUIT_OK);
376 break;
377 }
378}
379
380#if MSDOS_COMPILER
381/*
382 * Parse an MSDOS color descriptor.

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

456 break;
457 case QUERY:
458 break;
459 }
460}
461#endif
462
463/*
378 quit(QUIT_OK);
379 break;
380 }
381}
382
383#if MSDOS_COMPILER
384/*
385 * Parse an MSDOS color descriptor.

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

459 break;
460 case QUERY:
461 break;
462 }
463}
464#endif
465
466/*
467 * Handler for the -x option.
468 */
469 public void
470opt_x(type, s)
471 int type;
472 register char *s;
473{
474 extern int tabstops[];
475 extern int ntabstops;
476 extern int tabdefault;
477 char msg[60+(4*TABSTOP_MAX)];
478 int i;
479 PARG p;
480
481 switch (type)
482 {
483 case INIT:
484 case TOGGLE:
485 /* Start at 1 because tabstops[0] is always zero. */
486 for (i = 1; i < TABSTOP_MAX; )
487 {
488 int n = 0;
489 while (*s >= '0' && *s <= '9')
490 n = (10 * n) + (*s++ - '0');
491 if (n > tabstops[i-1])
492 tabstops[i++] = n;
493 if (*s++ != ',')
494 break;
495 }
496 if (i < 2)
497 return;
498 ntabstops = i;
499 tabdefault = tabstops[ntabstops-1] - tabstops[ntabstops-2];
500 break;
501 case QUERY:
502 strcpy(msg, "Tab stops ");
503 if (ntabstops > 2)
504 {
505 for (i = 1; i < ntabstops; i++)
506 {
507 if (i > 1)
508 strcat(msg, ",");
509 sprintf(msg+strlen(msg), "%d", tabstops[i]);
510 }
511 sprintf(msg+strlen(msg), " and then ");
512 }
513 sprintf(msg+strlen(msg), "every %d spaces",
514 tabdefault);
515 p.p_string = msg;
516 error("%s", &p);
517 break;
518 }
519}
520
521
522/*
464 * Handler for the -" option.
465 */
466 public void
467opt_quote(type, s)
468 int type;
469 register char *s;
470{
471 char buf[3];

--- 59 unchanged lines hidden ---
523 * Handler for the -" option.
524 */
525 public void
526opt_quote(type, s)
527 int type;
528 register char *s;
529{
530 char buf[3];

--- 59 unchanged lines hidden ---