Rizin
unix-like reverse engineering framework and cli tools
oabextract.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mspack.h>
#include <error.h>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 12 of file oabextract.c.

12  {
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(* 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

References argv, msoab_decompressor::decompress, msoab_decompressor::decompress_incremental, err, mspack_create_oab_decompressor(), mspack_destroy_oab_decompressor(), MSPACK_SYS_SELFTEST, and NULL.