if (status < 0) return status; if (jar->valid < 0 || failed) return ERRX;
if (failed) return -1;
VerifyJar(char *filename){  FILE *fp;  int ret;  int status;  int failed = 0;  char *err;  JAR *jar;  JAR_Context *ctx;  JAR_Item *it;  jar = JAR_new();  if ((fp = fopen (filename, "r")) == NULL)    {    perror (filename);    exit (ERRX);    }  else    fclose (fp);  JAR_set_callback (JAR_CB_SIGNAL, jar, jar_cb);  status = JAR_pass_archive (jar, jarArchGuess, filename, "some-url");  if (status < 0 || jar->valid < 0)    {    PR_fprintf(outputFD, "\nNOTE -- \"%s\" archive DID NOT PASS crypto verification.\n", filename);    if (status < 0)      {      char *errtext;      if (status >= JAR_BASE && status <= JAR_BASE_END)        {        errtext = JAR_get_error (status);        }      else        {        errtext = SECU_ErrorString ((int16) PORT_GetError());        }      PR_fprintf(outputFD, "  (reported reason: %s)\n\n", errtext);       /* corrupt files should not have their contents listed */       if (status == JAR_ERR_CORRUPT)        return status;      }    PR_fprintf(outputFD,		"entries shown below will have their digests checked only.\n");     jar->valid = 0;    }  else    PR_fprintf(outputFD,		"archive \"%s\" has passed crypto verification.\n", filename);  if (verify_global (jar))    failed = 1;  PR_fprintf(outputFD, "\n");  PR_fprintf(outputFD, "%16s   %s\n", "status", "path");  PR_fprintf(outputFD, "%16s   %s\n", "------------", "-------------------");  ctx = JAR_find (jar, NULL, jarTypeMF);  while (JAR_find_next (ctx, &it) >= 0)    {    if (it && it->pathname)      {	rm_dash_r(TMP_OUTPUT);      ret = JAR_verified_extract (jar, it->pathname, TMP_OUTPUT);      /* if (ret < 0) printf ("error %d on %s\n", ret, it->pathname); */      if (ret < 0) failed = 1;      if (ret == JAR_ERR_PNF)        err = "NOT PRESENT";      else if (ret == JAR_ERR_HASH)        err = "HASH FAILED";      else        err = "NOT VERIFIED";      PR_fprintf(outputFD, "%16s   %s\n",         ret >= 0 ? "verified" : err, it->pathname);      if (ret != 0 && ret != JAR_ERR_PNF && ret != JAR_ERR_HASH)        PR_fprintf(outputFD, "      (reason: %s)\n", JAR_get_error (ret));      }    }  JAR_find_end (ctx);  if (status < 0 || jar->valid < 0)    {    PR_fprintf(outputFD,		"\nNOTE -- \"%s\" archive DID NOT PASS crypto verification.\n", filename);    give_help (status);    }  JAR_destroy (jar);  if (status < 0)    return status;  if (jar->valid < 0 || failed)    return ERRX;  return 0;}