Commit cd319b09 authored by ASN.1 Documenter's avatar ASN.1 Documenter
Browse files

add id=>filename mode

parent 5ddd1f4c
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -33,12 +33,14 @@ int glob_pattern_p (const char *, int);


static const char * _outPath = "-";
static const char * _outPath = "-";
static int _canonicalize = 1;
static int _canonicalize = 1;
static int _fnames = 0;
static FILE * _out;
static FILE * _out;


static copt_t _options [] = {
static copt_t _options [] = {
	{ "h?", "help", COPT_HELP, NULL,                 "Print this help page" },
	{ "h?", "help", COPT_HELP, NULL,                 "Print this help page" },
	{ "o",  "out", COPT_STR, (void*)&_outPath,         "Output path [stdout by default]" },
	{ "o",  "out", COPT_STR, (void*)&_outPath,         "Output path [stdout by default]" },
	{ "c", "no-canonicalize", COPT_BOOLI, (void*)&_canonicalize,         "No canonicalize" },
	{ "C",  "no-canonicalize", COPT_BOOLI, (void*)&_canonicalize,         "No canonicalize" },
	{ "n",  "fnames", COPT_BOOL, (void*)&_fnames,         "Use file names instead of IDs" },
	{ NULL, NULL, COPT_END, NULL, NULL }
	{ NULL, NULL, COPT_END, NULL, NULL }
};
};


@@ -150,7 +152,7 @@ int main(int argc, char ** argv)
    	ebuf = cstrnload(buf, CERT_MAX_SIZE, argv[argi]);
    	ebuf = cstrnload(buf, CERT_MAX_SIZE, argv[argi]);
        if(ebuf && (ebuf - buf) > 0){
        if(ebuf && (ebuf - buf) > 0){
            const pchar_t* fname = cstrlastpathelement(argv[argi]);
            const pchar_t* fname = cstrlastpathelement(argv[argi]);
            *cstrpathextension(fname) = 0;
            if(!_fnames) *cstrpathextension(fname) = 0;
            process_cert(fname, buf, ebuf);
            process_cert(fname, buf, ebuf);
        }else{
        }else{
            // check if it is a mask
            // check if it is a mask
@@ -161,7 +163,7 @@ int main(int argc, char ** argv)
                    ebuf = cstrnload(buf, CERT_MAX_SIZE, gl.gl_pathv[i]);
                    ebuf = cstrnload(buf, CERT_MAX_SIZE, gl.gl_pathv[i]);
                    if (ebuf && (ebuf - buf) > 0) {
                    if (ebuf && (ebuf - buf) > 0) {
                        const pchar_t* fname = cstrlastpathelement(gl.gl_pathv[i]);
                        const pchar_t* fname = cstrlastpathelement(gl.gl_pathv[i]);
                        *cstrpathextension(fname) = 0;
                        if(!_fnames) *cstrpathextension(fname) = 0;
                        process_cert(fname, buf, ebuf);
                        process_cert(fname, buf, ebuf);
                    }
                    }
                }
                }
@@ -179,7 +181,7 @@ int main(int argc, char ** argv)
                cstrcpy(fname, fd.cFileName);
                cstrcpy(fname, fd.cFileName);
                ebuf = cstrnload(buf, CERT_MAX_SIZE, path);
                ebuf = cstrnload(buf, CERT_MAX_SIZE, path);
                if(ebuf && (ebuf - buf) > 0){
                if(ebuf && (ebuf - buf) > 0){
                    *cstrpathextension(fname) = 0;
                    if(!_fnames) *cstrpathextension(fname) = 0;
                    process_cert(fname, buf, ebuf);            
                    process_cert(fname, buf, ebuf);            
                }
                }
            }while(FindNextFile(h, &fd));
            }while(FindNextFile(h, &fd));