mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 03:50:57 +01:00
updated pod
This commit is contained in:
80
src/pcp.c
80
src/pcp.c
@@ -54,6 +54,7 @@ int main (int argc, char **argv) {
|
||||
char *keyid = NULL;
|
||||
char *id = NULL;
|
||||
char *xpass = NULL;
|
||||
char *extra = NULL;
|
||||
plist_t *recipient = NULL;
|
||||
FILE *in;
|
||||
|
||||
@@ -263,6 +264,85 @@ int main (int argc, char **argv) {
|
||||
mode = PCP_MODE_ENCRYPT_ME;
|
||||
}
|
||||
|
||||
|
||||
if(argc >= 1) {
|
||||
/* ok, there are arguments left on the commandline.
|
||||
treat it as filename or recipient, depending on
|
||||
current mode and other given parameters */
|
||||
extra = ucmalloc(strlen(argv[0])+1);
|
||||
strncpy(extra, argv[0], strlen(argv[0])+1);
|
||||
|
||||
switch (mode) {
|
||||
case PCP_MODE_DECRYPT:
|
||||
if(infile == NULL)
|
||||
infile = extra;
|
||||
break;
|
||||
|
||||
case PCP_MODE_ENCRYPT:
|
||||
if(infile == NULL)
|
||||
infile = extra;
|
||||
else if(userec == 0 && useid == 0) {
|
||||
userec = 1;
|
||||
int i;
|
||||
for (i=0; i<argc; i++) {
|
||||
p_add(&recipient, argv[i]);
|
||||
}
|
||||
free(extra);
|
||||
}
|
||||
break;
|
||||
|
||||
case PCP_MODE_IMPORT_PUBLIC:
|
||||
case PCP_MODE_IMPORT_SECRET:
|
||||
if(infile == NULL)
|
||||
infile = extra;
|
||||
break;
|
||||
|
||||
case PCP_MODE_EXPORT_SECRET:
|
||||
case PCP_MODE_EXPORT_PUBLIC:
|
||||
if(outfile == NULL)
|
||||
outfile = extra;
|
||||
else if(useid == 0 && userec == 0) {
|
||||
p_add(&recipient, extra);
|
||||
userec = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCP_MODE_VERIFY:
|
||||
if(infile == NULL)
|
||||
infile = extra;
|
||||
else if (useid == 0) {
|
||||
id = extra;
|
||||
useid = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCP_MODE_SIGN:
|
||||
if(infile == NULL)
|
||||
infile = extra;
|
||||
else if(outfile == NULL && detach == 0)
|
||||
outfile = extra;
|
||||
break;
|
||||
|
||||
default:
|
||||
free(extra); /* not used */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* check if there's some enviroment we could use */
|
||||
if(usevault == 1) {
|
||||
char *_vaultfile = getenv("PCP_VAULT");
|
||||
if(_vaultfile != NULL) {
|
||||
strncpy(vaultfile, _vaultfile, strlen(_vaultfile)+1);
|
||||
}
|
||||
}
|
||||
if(debug == 0) {
|
||||
char *_debug = getenv("PCP_DEBUG");
|
||||
if(_debug != NULL) {
|
||||
debug = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(usevault == 1) {
|
||||
pcphash_init();
|
||||
vault = pcpvault_init(vaultfile);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
" [ --export-public | --export-secret | --import-public | --import-secret ]\n" \
|
||||
" [ --encrypt | --decrypt ]\n" \
|
||||
" [ --sign | --check-signature ]\n" \
|
||||
" [ arguments ]\n" \
|
||||
"\n" \
|
||||
"General Options:\n" \
|
||||
"-h --help Print this help message.\n" \
|
||||
@@ -42,5 +43,10 @@
|
||||
"\n" \
|
||||
"Encoding Options:\n" \
|
||||
"-z --z85-encode Armor with Z85 encoding.\n" \
|
||||
"\n" \
|
||||
"Arguments:\n" \
|
||||
"Extra arguments after options are treated as filenames or\n" \
|
||||
"recipients, depending on operation mode.\n" \
|
||||
"\n" \
|
||||
"\n"
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,7 @@ Usage: pcp1 [ --help | --version ]
|
||||
[ --export-public | --export-secret | --import-public | --import-secret ]
|
||||
[ --encrypt | --decrypt ]
|
||||
[ --sign | --check-signature ]
|
||||
[ arguments ]
|
||||
|
||||
General Options:
|
||||
-h --help Print this help message.
|
||||
@@ -40,3 +41,8 @@ Signature Options:
|
||||
|
||||
Encoding Options:
|
||||
-z --z85-encode Armor with Z85 encoding.
|
||||
|
||||
Arguments:
|
||||
Extra arguments after options are treated as filenames or
|
||||
recipients, depending on operation mode.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user