×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Just guessing from my limitted experience in the Linux world: the
'newer' form of passing the parameters (so by using the long form)
always (or nearly always) takes these kind of parameters with an
'='-sign. Comparing with $/sbin/tar for instance: tar -xf file in newer
form is tar --extract --file=file.

But perhaps somebody here has a more scientifically (or factually for
that matter) explanation.

Cor

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx 
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Charles Wilt
Sent: maandag 19 maart 2007 6:03
To: rpg400-l@xxxxxxxxxxxx
Subject: Weird problems with Qp2RunPase

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



--
This is the RPG programming on the AS400 / iSeries (RPG400-L) 
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx 
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives 
at http://archive.midrange.com/rpg400-l.




This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.