Rizin
unix-like reverse engineering framework and cli tools
main.h File Reference

Miscellaneous declarations. More...

Go to the source code of this file.

Enumerations

enum  exit_status_type { E_SUCCESS = 0 , E_ERROR = 1 , E_WARNING = 2 }
 Possible exit status values. These are the same as used by gzip and bzip2. More...
 

Functions

void set_exit_status (enum exit_status_type new_status)
 
void set_exit_no_warn (void)
 

Detailed Description

Miscellaneous declarations.

Definition in file main.h.

Enumeration Type Documentation

◆ exit_status_type

Possible exit status values. These are the same as used by gzip and bzip2.

Enumerator
E_SUCCESS 
E_ERROR 
E_WARNING 

Definition at line 14 of file main.h.

14  {
15  E_SUCCESS = 0,
16  E_ERROR = 1,
17  E_WARNING = 2,
18 };
@ E_ERROR
Definition: main.h:16
@ E_WARNING
Definition: main.h:17
@ E_SUCCESS
Definition: main.h:15

Function Documentation

◆ set_exit_no_warn()

void set_exit_no_warn ( void  )

Use E_SUCCESS instead of E_WARNING if something worth a warning occurs but nothing worth an error has occurred. This is called when –no-warn is specified.

Definition at line 51 of file main.c.

52 {
53  no_warn = true;
54  return;
55 }
static bool no_warn
Definition: main.c:27

References no_warn.

Referenced by parse_real().

◆ set_exit_status()

void set_exit_status ( enum exit_status_type  new_status)

Sets the exit status after a warning or error has occurred. If new_status is E_WARNING and the old exit status was already E_ERROR, the exit status is not changed.

Definition at line 31 of file main.c.

32 {
33  assert(new_status == E_WARNING || new_status == E_ERROR);
34 
35 #if defined(_WIN32) && !defined(__CYGWIN__)
36  EnterCriticalSection(&exit_status_cs);
37 #endif
38 
39  if (exit_status != E_ERROR)
40  exit_status = new_status;
41 
42 #if defined(_WIN32) && !defined(__CYGWIN__)
43  LeaveCriticalSection(&exit_status_cs);
44 #endif
45 
46  return;
47 }
assert(limit<=UINT32_MAX/2)
static enum exit_status_type exit_status
Exit status to use. This can be changed with set_exit_status().
Definition: main.c:17
@ E_ERROR
Definition: transport.h:23

References assert(), E_ERROR, E_WARNING, and exit_status.

Referenced by message_error(), message_warning(), and signals_exit().