mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.4 KiB

  1. /* simple program to insert a md5sum into application data area of */
  2. /* an iso9660 image */
  3. /* Copyright 2001 Red Hat, Inc. */
  4. /* Michael Fulbright msf@redhat.com */
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <popt.h>
  8. #include "md5.h"
  9. #include "libimplantisomd5.h"
  10. static void usage(void) {
  11. fprintf(stderr, "implantisomd5: implantisomd5 [--force] [--supported] <isofilename>\n");
  12. exit(1);
  13. }
  14. int main(int argc, char **argv) {
  15. int rc;
  16. char *errstr;
  17. const char **args;
  18. int forceit=0;
  19. int supported=0;
  20. int help=0;
  21. poptContext optCon;
  22. struct poptOption options[] = {
  23. { "force", 'f', POPT_ARG_NONE, &forceit, 0 },
  24. { "supported-iso", 'S', POPT_ARG_NONE, &supported, 0 },
  25. { "help", 'h', POPT_ARG_NONE, &help, 0},
  26. { 0, 0, 0, 0, 0}
  27. };
  28. optCon = poptGetContext("implantisomd5", argc, (const char **)argv, options, 0);
  29. if ((rc = poptGetNextOpt(optCon)) < -1) {
  30. fprintf(stderr, "bad option %s: %s\n",
  31. poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
  32. poptStrerror(rc));
  33. exit(1);
  34. }
  35. if (help)
  36. usage();
  37. args = poptGetArgs(optCon);
  38. if (!args || !args[0] || !args[0][0])
  39. usage();
  40. rc = implantISOFile((char *)args[0], supported, forceit, 0, &errstr);
  41. if (rc) {
  42. fprintf(stderr, "ERROR: %s\n", errstr);
  43. exit(1);
  44. } else {
  45. exit(0);
  46. }
  47. }