24 |
#include "strftime.h" |
#include "strftime.h" |
25 |
#include "xgethostname.h" |
#include "xgethostname.h" |
26 |
|
|
27 |
|
#include "sign.h" |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
const char *program_name; |
const char *program_name; |
32 |
const char *program_path; |
const char *program_path; |
33 |
const char *cvs_cmd_name; |
const char *cvs_cmd_name; |
304 |
" -a Authenticate all net traffic.\n", |
" -a Authenticate all net traffic.\n", |
305 |
#endif |
#endif |
306 |
" -s VAR=VAL Set CVS user variable.\n", |
" -s VAR=VAL Set CVS user variable.\n", |
307 |
|
"\n", |
308 |
|
" -g Force OpenPGP commit signatures (default autonegotiates).\n", |
309 |
|
" --sign[=(on | off | auto)] | --no-sign\n", |
310 |
|
" Force (or forbid) OpenPGP commit signatures\n", |
311 |
|
" (default autonegotiates).\n", |
312 |
|
" -G TEMPLATE\n", |
313 |
|
" --sign-template TEMPLATE\n", |
314 |
|
" Use TEMPLATE to generate OpenPGP signatures.\n", |
315 |
|
" --sign-arg ARG\n", |
316 |
|
" Pass ARG to OpenPGP TEMPLATE when sigining.\n", |
317 |
|
" --textmode ARG\n", |
318 |
|
" Pass ARG to OpenPGP TEMPLATE when verifying or\n", |
319 |
|
" generating signatures.\n", |
320 |
"(Specify the --help option for a list of other help options)\n", |
"(Specify the --help option for a list of other help options)\n", |
321 |
NULL |
NULL |
322 |
}; |
}; |
528 |
int help = 0; /* Has the user asked for help? This |
int help = 0; /* Has the user asked for help? This |
529 |
lets us support the `cvs -H cmd' |
lets us support the `cvs -H cmd' |
530 |
convention to give help for cmd. */ |
convention to give help for cmd. */ |
531 |
static const char short_options[] = "+QqrwtnRvb:T:e:d:Hfz:s:xa"; |
static const char short_options[] = "+QqrwtnRvb:T:e:d:Hfz:s:xag::G:"; |
532 |
static struct option long_options[] = |
static struct option long_options[] = |
533 |
{ |
{ |
534 |
{"help", 0, NULL, 'H'}, |
{"help", 0, NULL, 'H'}, |
536 |
{"help-commands", 0, NULL, 1}, |
{"help-commands", 0, NULL, 1}, |
537 |
{"help-synonyms", 0, NULL, 2}, |
{"help-synonyms", 0, NULL, 2}, |
538 |
{"help-options", 0, NULL, 4}, |
{"help-options", 0, NULL, 4}, |
539 |
|
{"sign", optional_argument, NULL, 'g'}, |
540 |
|
{"no-sign", 0, NULL, 5}, |
541 |
|
{"sign-template", required_argument, NULL, 'G'}, |
542 |
|
{"sign-arg", required_argument, NULL, '6'}, |
543 |
|
{"sign-textmode", required_argument, NULL, 7}, |
544 |
#ifdef SERVER_SUPPORT |
#ifdef SERVER_SUPPORT |
545 |
{"allow-root", required_argument, NULL, 3}, |
{"allow-root", required_argument, NULL, 3}, |
546 |
#endif /* SERVER_SUPPORT */ |
#endif /* SERVER_SUPPORT */ |
569 |
#endif |
#endif |
570 |
|
|
571 |
/* |
/* |
572 |
* Just save the last component of the path for error messages |
* Initialize globals. |
573 |
*/ |
*/ |
574 |
|
/* Just save the last component of the path for error messages. */ |
575 |
program_path = xstrdup (argv[0]); |
program_path = xstrdup (argv[0]); |
576 |
#ifdef ARGV0_NOT_PROGRAM_NAME |
#ifdef ARGV0_NOT_PROGRAM_NAME |
577 |
/* On some systems, e.g. VMS, argv[0] is not the name of the command |
/* On some systems, e.g. VMS, argv[0] is not the name of the command |
581 |
program_name = last_component (argv[0]); |
program_name = last_component (argv[0]); |
582 |
#endif |
#endif |
583 |
|
|
584 |
|
|
585 |
/* |
/* |
586 |
* Query the environment variables up-front, so that |
* Query the environment variables up-front, so that |
587 |
* they can be overridden by command line arguments |
* they can be overridden by command line arguments |
664 |
/* --help-options */ |
/* --help-options */ |
665 |
usage (opt_usage); |
usage (opt_usage); |
666 |
break; |
break; |
667 |
|
case 'g': |
668 |
|
/* --sign */ |
669 |
|
if (optarg) |
670 |
|
{ |
671 |
|
if (!strcasecmp (optarg, "auto") |
672 |
|
|| !strcasecmp (optarg, "server")) |
673 |
|
set_sign_commits (SIGN_DEFAULT); |
674 |
|
else if (!strcasecmp (optarg, "on")) |
675 |
|
set_sign_commits (SIGN_ALWAYS); |
676 |
|
else if (!strcasecmp (optarg, "off")) |
677 |
|
set_sign_commits (SIGN_NEVER); |
678 |
|
else |
679 |
|
error (1, 0, "Unrecognized argument to sign (`%s')", |
680 |
|
optarg); |
681 |
|
} |
682 |
|
else |
683 |
|
set_sign_commits (SIGN_ALWAYS); |
684 |
|
break; |
685 |
|
case 5: |
686 |
|
/* --no-sign */ |
687 |
|
set_sign_commits (SIGN_NEVER); |
688 |
|
break; |
689 |
|
case 'G': |
690 |
|
/* --sign-template */ |
691 |
|
set_sign_template (optarg); |
692 |
|
break; |
693 |
|
case 6: |
694 |
|
/* --sign-arg */ |
695 |
|
add_sign_arg (optarg); |
696 |
|
break; |
697 |
|
case 7: |
698 |
|
/* --sign-textmode */ |
699 |
|
set_sign_textmode (optarg); |
700 |
|
break; |
701 |
#ifdef SERVER_SUPPORT |
#ifdef SERVER_SUPPORT |
702 |
case 3: |
case 3: |
703 |
/* --allow-root */ |
/* --allow-root */ |