NSS_Shutdown();
if (NSS_Shutdown != SECSuccess) { exit(1); }
main(int argc, char *argv[], char *envp[]){    char *               certDir      = NULL;    char *               progName     = NULL;    char *               cipherString = NULL;    CERTCertificate *    cert;    CERTCertificate *    firstCert    = NULL;    CERTCertDBHandle *   defaultDB    = NULL;    PRBool               isAscii      = PR_FALSE;    SECStatus            secStatus;    SECCertUsage         certUsage    = certUsageSSLServer;    PLOptState *         optstate;    PLOptStatus          status;    PR_Init( PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);    progName = PL_strdup(argv[0]);    optstate = PL_CreateOptState(argc, argv, "ad:ru:w:v");    while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) {	switch(optstate->option) {	case  0  : /* positional parameter */  goto breakout;	case 'a' : isAscii  = PR_TRUE;                        break;	case 'd' : certDir  = PL_strdup(optstate->value);     break;	case 'r' : isAscii  = PR_FALSE;                       break;	case 'u' : certUsage = (SECCertUsage)PORT_Atoi(optstate->value); break;	case 'w' : password = PL_strdup(optstate->value);     break;	case 'v' : verbose++;                                 break;	default  : Usage(progName);                           break;	}    }breakout:    if (status != PL_OPT_OK)	Usage(progName);    /* Set our password function callback. */    PK11_SetPasswordFunc(myPasswd);    /* Initialize the NSS libraries. */    if (certDir) {	secStatus = NSS_Init(certDir);    } else {	secStatus = NSS_NoDB_Init(NULL);	/* load the builtins */	SECMOD_AddNewModule("Builtins", DLL_PREFIX"nssckbi."DLL_SUFFIX, 0, 0);    }    if (secStatus != SECSuccess) {	exitErr("NSS_Init");    }    while (status == PL_OPT_OK) {	switch(optstate->option) {	default  : Usage(progName);                           break;	case 'a' : isAscii  = PR_TRUE;                        break;	case 'r' : isAscii  = PR_FALSE;                       break;	case  0  : /* positional parameter */	    cert = readCertFile(optstate->value, isAscii);	    if (!cert) 	        goto punt;	    rememberCert(cert);	    if (!firstCert)	        firstCert = cert;	    break;	}        status = PL_GetNextOpt(optstate);    }    if (status == PL_OPT_BAD || !firstCert)	Usage(progName);    /* NOW, verify the cert chain. */    defaultDB = CERT_GetDefaultCertDB();    secStatus = CERT_VerifyCert(defaultDB, firstCert,                                 PR_TRUE /* check sig */,				certUsage, 				PR_Now(), 				NULL, 		/* wincx  */				NULL);		/* error log */    if (secStatus != SECSuccess) {	PRIntn err = PR_GetError();	fprintf(stderr, "Chain is bad, %d = %s\n", err, SECU_Strerror(err));	printCertProblems(stderr, defaultDB, firstCert, 			  PR_TRUE, certUsage, NULL);    } else {    	fprintf(stderr, "Chain is good!\n");    }punt:    forgetCerts();    NSS_Shutdown();    PR_Cleanup();    return 0;}