Use PROGNAME
This commit is contained in:
parent
399b4b40d9
commit
5f49d177b3
16
src/deasm.c
16
src/deasm.c
|
@ -24,6 +24,10 @@
|
|||
#include <errno.h>
|
||||
#include "Asm.h"
|
||||
|
||||
#ifndef PROGNAME
|
||||
# define PROGNAME "deasm"
|
||||
#endif
|
||||
|
||||
|
||||
/* deasm */
|
||||
/* private */
|
||||
|
@ -53,9 +57,9 @@ static int _deasm(char const * arch, char const * format, char const * filename,
|
|||
size_t i;
|
||||
|
||||
if((a = asm_new(arch, format)) == NULL)
|
||||
return -error_print("deasm");
|
||||
return -error_print(PROGNAME);
|
||||
if((code = asm_open_deassemble(a, filename, raw)) == NULL)
|
||||
error_print("deasm");
|
||||
error_print(PROGNAME);
|
||||
else
|
||||
{
|
||||
ret = 0;
|
||||
|
@ -82,7 +86,7 @@ static int _deasm_section(AsmCode * code, AsmSection * section)
|
|||
printf("\nDisassembly of section %s:\n", section->name);
|
||||
if(asmcode_decode_section(code, section, &calls, &calls_cnt) != 0)
|
||||
{
|
||||
error_print("deasm");
|
||||
error_print(PROGNAME);
|
||||
return -1;
|
||||
}
|
||||
definition = asmcode_get_arch_definition(code);
|
||||
|
@ -119,7 +123,7 @@ static int _deasm_buffer(char const * arch, char const * buffer, size_t size)
|
|||
if((a = asm_new(arch, NULL)) == NULL)
|
||||
return -1;
|
||||
if((code = asm_deassemble(a, buffer, size, NULL, NULL)) == NULL)
|
||||
error_print("deasm");
|
||||
error_print(PROGNAME);
|
||||
else
|
||||
{
|
||||
/* FIXME implement */
|
||||
|
@ -148,7 +152,7 @@ static int _deasm_string(char const * arch, char const * format,
|
|||
format, string);
|
||||
#endif
|
||||
if((s = malloc(len + 1)) == NULL)
|
||||
return -error_set_print("deasm", 1, "%s", strerror(errno));
|
||||
return -error_set_print(PROGNAME, 1, "%s", strerror(errno));
|
||||
for(i = 0, j = 0; i < len; i++)
|
||||
{
|
||||
if(str[i] != '\\')
|
||||
|
@ -202,7 +206,7 @@ static int _deasm_list(void)
|
|||
/* usage */
|
||||
static int _usage(void)
|
||||
{
|
||||
fputs("Usage: deasm [-a arch][-f format][-D] filename\n"
|
||||
fputs("Usage: " PROGNAME " [-a arch][-f format][-D] filename\n"
|
||||
" deasm [-a arch] -s string\n"
|
||||
" deasm -l\n"
|
||||
" -a Force the given architecture\n"
|
||||
|
|
Loading…
Reference in New Issue
Block a user