|
I'm trying to use Qp2RunPase to run GPG in batch to encrypt a file.
Here's my code: (note big thanks to Scott Klement for the prototype &
example code here
http://archive.midrange.com/midrange-l/200509/msg00148.html )
d Qp2RunPase PR 10I 0 extproc('Qp2RunPase')
d pathName * value options(*string)
d symbolName * value options(*string)
d symbolData * value
d symDataLen 10U 0 value
d ccsid 10I 0 value
d argv * dim(32767) options(*varsize)
d envp * dim(32767) options(*varsize)
//--------------------------------------------------------------------------
------------------
// Begin MAINLINE
//--------------------------------------------------------------------------
------------------
d Encrypt pi
d sourceFile 128a const varying
d destFile 128a const varying
d recipient 128a const varying
d ENCRYPT_PROGRAM...
d c '/QOpenSys/usr/local/bin/gpg'
d parms s 256A dim(9)
d argv s * dim(10)
d environ s 256A dim(3)
d envp s * dim(4)
d x s 10i 0
/free
parms(1) = ENCRYPT_PROGRAM + x'00';
parms(2) = '--no-tty' + x'00';
parms(3) = '--yes' + x'00';
parms(4) = '--batch' + x'00';
parms(5) = '-o' + destFile + x'00';
parms(6) = '-e' + x'00';
parms(7) = '-r' + recipient + x'00';
parms(8) = '--no-permission-warning' + x'00';
parms(9) = sourceFile + x'00';
for x = 1 to %elem(parms);
argv(x) = %addr(parms(x));
endfor;
argv(%elem(argv)) = *NULL;
environ(1) = 'PASE_SYSCALL_NOSIGILL=plock=0' + x'00';
environ(2) = 'PATH=/QOpenSys/usr/local/bin' + x'00';
environ(3) = 'GNUPGHOME=/QOpenSys/usr/local/bin/.gnupg' + x'00';
for x = 1 to %elem(environ);
envp(x) = %addr(environ(x));
endfor;
envp(%elem(envp)) = *NULL;
if Qp2RunPase( ENCRYPT_PROGRAM
: *NULL
: *NULL
: 0
: 819
: argv
: envp ) <> 0;
//error
dsply 'Error in PASE call';
endif;
*INLR = *ON;
return;
/end-free
Now what's weird is that if instead of using the short option form, ie. -o,
I try to use the long option form, --output, I get an error message saying
invalid option.
At the least, I get the error with the -o and the -r options. Perhaps
because the long options have a space, '--output myfile.gpg'.
But it works from the command line. Why doesn't it work from Qp2RunPase?
Ok I seemed to have a partial answer....
When I used '--output=myfile.gpg', it worked!
But I'm still curious as to why '--output myfile.gpg' works from the command
line but for Qp2RunPase it has to be --output=myfile.gpg'.
Thanks,
Charles Wilt
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.