#include #include #include #include #ifdef MYGETOPT char getopt( int argc, char *argv[], char *format ); #endif #define PATH_SEP '/' #ifndef SVR4 #define _BSD_ #endif #ifdef _BSD_ extern char *sys_errlist[]; # define raise(s) kill(getpid(),(s)) # define strerror(e) sys_errlist[(e)] #endif static char __ident[] = "@(#)(c)SPDsoft, Tue Jun 20, 1995"; #define VERS_STR ((char*)&__ident[4]) int verb=0; void usage(char *name); extern int errno; char *app; char *getpass(char*); void usage(char *name) { fprintf(stderr,"Use: %s [-h] file [...]\n", app); fprintf(stderr,"%s: -h : This text\n", app); exit(0); } main( int argc, char *argv[] , char **envp ) { int i,opt; char *passkey, *pager, key[256],cmd[512]; extern char *optarg; extern int optind,opterr; if ((app = strrchr(argv[0], PATH_SEP)) != NULL) app = app+1; else app = argv[0]; while ( (opt=getopt(argc,argv,"hv")) != EOF ) { switch(opt) { case 'h': default: usage(app); break; } } if ((argc-optind)<1) usage(app); if ( NULL == (passkey=getpass("Enter key: "))) { fprintf(stderr,"%s: can't get key (%s)\n", app, strerror(errno)); exit -1; } sprintf(key,"PGPPASS=%s",passkey); putenv(key); if ( NULL == (pager=getenv("HOME"))) pager=strdup("more"); for (i=optind; i