Rizin
unix-like reverse engineering framework and cli tools
oabextract.c
Go to the documentation of this file.
1 #ifdef HAVE_CONFIG_H
2 #include <config.h>
3 #endif
4 
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <mspack.h>
9 
10 #include <error.h>
11 
12 int main(int argc, char *argv[]) {
13  struct msoab_decompressor *oabd;
14  int err;
15 
16  setbuf(stdout, NULL);
17  setbuf(stderr, NULL);
18 
20  if (err) return 0;
21 
22  if ((oabd = mspack_create_oab_decompressor(NULL))) {
23  if (argc == 3) {
24  err = oabd->decompress(oabd, argv[1], argv[2]);
25  if (err) fprintf(stderr, "%s -> %s: %s\n", argv[1], argv[2], error_msg(err));
26  }
27  else if (argc == 4) {
28  err = oabd->decompress_incremental(oabd, argv[2], argv[1], argv[3]);
29  if (err) fprintf(stderr, "%s + %s -> %s: %s\n", argv[1], argv[2], argv[3], error_msg(err));
30  }
31  else {
32  fprintf(stderr, "Usage: %s <input> <output>\n", *argv);
33  fprintf(stderr, " or %s <base> <patch> <output>\n", *argv);
34  }
36  }
37  else {
38  fprintf(stderr, "%s: can't make OAB decompressor\n", *argv);
39  }
40  return 0;
41 }
static bool err
Definition: armass.c:435
struct msoab_decompressor * mspack_create_oab_decompressor(struct mspack_system *sys)
Definition: oabd.c:43
#define MSPACK_SYS_SELFTEST(result)
Definition: mspack.h:191
void mspack_destroy_oab_decompressor(struct msoab_decompressor *self)
Definition: oabd.c:60
#define NULL
Definition: cris-opc.c:27
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40
int main(int argc, char *argv[])
Definition: oabextract.c:12
int(* decompress_incremental)(struct msoab_decompressor *self, const char *input, const char *base, const char *output)
Definition: mspack.h:2352
int(* decompress)(struct msoab_decompressor *self, const char *input, const char *output)
Definition: mspack.h:2323