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