NSS_Init(SECU_ConfigDirectory(NULL));
rv = NSS_Init(SECU_ConfigDirectory(NULL)); if (rv != SECSuccess) { SECU_PrintPRandOSError(progName); return -1; }
main(int argc, char **argv){    char *progName;    FILE *inFile, *outFile;    char *certName;    CERTCertDBHandle *certHandle;    CERTCertificate *cert;    struct recipient *recipients, *rcpt;    PLOptState *optstate;    PLOptStatus status;    progName = strrchr(argv[0], '/');    progName = progName ? progName+1 : argv[0];    inFile = NULL;    outFile = NULL;    certName = NULL;    recipients = NULL;    rcpt = NULL;    /*     * Parse command line arguments     * XXX This needs to be enhanced to allow selection of algorithms     * and key sizes (or to look up algorithms and key sizes for each     * recipient in the magic database).     */    optstate = PL_CreateOptState(argc, argv, "d:i:o:r:");    while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) {	switch (optstate->option) {	  case '?':	    Usage(progName);	    break;	  case 'd':	    SECU_ConfigDirectory(optstate->value);	    break;	  case 'i':	    inFile = fopen(optstate->value, "r");	    if (!inFile) {		fprintf(stderr, "%s: unable to open \"%s\" for reading\n",			progName, optstate->value);		return -1;	    }	    break;	  case 'o':	    outFile = fopen(optstate->value, "w");	    if (!outFile) {		fprintf(stderr, "%s: unable to open \"%s\" for writing\n",			progName, optstate->value);		return -1;	    }	    break;	  case 'r':	    if (rcpt == NULL) {		recipients = rcpt = PORT_Alloc (sizeof(struct recipient));	    } else {		rcpt->next = PORT_Alloc (sizeof(struct recipient));		rcpt = rcpt->next;	    }	    if (rcpt == NULL) {		fprintf(stderr, "%s: unable to allocate recipient struct\n",			progName);		return -1;	    }	    rcpt->nickname = strdup(optstate->value);	    rcpt->cert = NULL;	    rcpt->next = NULL;	    break;	}    }    if (!recipients) Usage(progName);    if (!inFile) inFile = stdin;    if (!outFile) outFile = stdout;    /* Call the libsec initialization routines */    PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);    NSS_Init(SECU_ConfigDirectory(NULL));    /* open cert database */    certHandle = CERT_GetDefaultCertDB();    if (certHandle == NULL) {	return -1;    }    /* find certs */    for (rcpt = recipients; rcpt != NULL; rcpt = rcpt->next) {	rcpt->cert = CERT_FindCertByNickname(certHandle, rcpt->nickname);	if (rcpt->cert == NULL) {	    SECU_PrintError(progName,			    "the cert for name \"%s\" not found in database",			    rcpt->nickname);	    return -1;	}    }    if (EncryptFile(outFile, inFile, recipients, progName)) {	SECU_PrintError(progName, "problem encrypting data");	return -1;    }    return 0;}