Changeset 331

Show
Ignore:
Timestamp:
01/10/06 17:24:13
Author:
ben
Message:

Actually read the file.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openpgpsdk/trunk/examples/packet-dump.c

    r327 r331  
    1313#include <stdlib.h> 
    1414#include <string.h> 
     15#include <fcntl.h> 
    1516 
    1617static int indent=0; 
     
    868869static void usage() 
    869870    { 
    870     fprintf(stderr,"%s [-a]\n",pname); 
     871    fprintf(stderr,"%s [-a] [-b] <file name>\n\n",pname); 
     872    fprintf(stderr,"-a\tRead armoured data\n" 
     873            "-b\tDon't buffer stdout/stderr\n"); 
    871874    exit(1); 
    872875    } 
     
    878881    int ret; 
    879882    int ch; 
     883    int fd; 
    880884 
    881885    pname=argv[0]; 
     
    896900            usage(); 
    897901            } 
    898  
     902    argc-=optind; 
     903    argv+=optind; 
     904 
     905    if(argc != 1) 
     906        usage(); 
     907 
     908    fd=open(argv[0],O_RDONLY); 
     909    if(fd < 0) 
     910        { 
     911        perror(argv[0]); 
     912        exit(2); 
     913        } 
    899914 
    900915    pinfo=ops_parse_info_new(); 
     
    904919    ops_parse_cb_set(pinfo,callback,NULL); 
    905920 
    906     ops_reader_set_fd(pinfo,0); 
     921    ops_reader_set_fd(pinfo,fd); 
    907922 
    908923    if(armour)