{
if (argc < 3 || argc > 4) {
fprintf (stderr, "hivexget regfile path [key]\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
char *file = argv[1];
char *path = argv[2];
if (path[0] != '\\') {
fprintf (stderr, "hivexget: path must start with a \\ character\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
if (path[1] == '\\') {
doubled:
fprintf (stderr, "hivexget: %s: \\ characters in path are doubled - are you escaping the path parameter correctly?\n", path);
- exit (1);
+ exit (EXIT_FAILURE);
}
hive_h *h = hivex_open (file, 0);
if (h == NULL) {
error:
perror (file);
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Navigate to the desired node. */
if (hivex_close (h) == -1)
goto error;
- exit (0);
+ exit (EXIT_SUCCESS);
}
do { \
if ((proc args) == -1) { \
fprintf (stderr, "%s: failed to write XML document\n", #proc); \
- exit (1); \
+ exit (EXIT_FAILURE); \
} \
} while (0)
break;
default:
fprintf (stderr, "hivexml [-dk] regfile > output.xml\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
}
if (optind + 1 != argc) {
fprintf (stderr, "hivexml: missing name of input file\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
hive_h *h = hivex_open (argv[optind], open_flags);
if (h == NULL) {
perror (argv[optind]);
- exit (1);
+ exit (EXIT_FAILURE);
}
/* Note both this macro, and xmlTextWriterStartDocument leak memory. There
writer = xmlNewTextWriterFilename ("/dev/stdout", 0);
if (writer == NULL) {
fprintf (stderr, "xmlNewTextWriterFilename: failed to create XML writer\n");
- exit (1);
+ exit (EXIT_FAILURE);
}
XML_CHECK (xmlTextWriterStartDocument, (writer, NULL, "utf-8", NULL));
if (hivex_visit (h, &visitor, sizeof visitor, writer, visit_flags) == -1) {
perror (argv[optind]);
- exit (1);
+ exit (EXIT_FAILURE);
}
if (hivex_close (h) == -1) {
perror (argv[optind]);
- exit (1);
+ exit (EXIT_FAILURE);
}
XML_CHECK (xmlTextWriterEndElement, (writer));
XML_CHECK (xmlTextWriterEndDocument, (writer));
xmlFreeTextWriter (writer);
- exit (0);
+ exit (EXIT_SUCCESS);
}
static int