Rizin
unix-like reverse engineering framework and cli tools
|
Checks filename suffix and creates the destination filename. More...
#include "private.h"
Go to the source code of this file.
Functions | |
static bool | is_dir_sep (char c) |
Test if the char is a directory separator. More... | |
static bool | has_dir_sep (const char *str) |
Test if the string contains a directory separator. More... | |
static size_t | test_suffix (const char *suffix, const char *src_name, size_t src_len) |
Checks if src_name has given compressed_suffix. More... | |
static char * | uncompressed_name (const char *src_name, const size_t src_len) |
Removes the filename suffix of the compressed file. More... | |
static void | msg_suffix (const char *src_name, const char *suffix) |
static char * | compressed_name (const char *src_name, size_t src_len) |
Appends suffix to src_name. More... | |
char * | suffix_get_dest_name (const char *src_name) |
Get the name of the destination file. More... | |
void | suffix_set (const char *suffix) |
Set a custom filename suffix. More... | |
Variables | |
static char * | custom_suffix = NULL |
Checks filename suffix and creates the destination filename.
Definition in file suffix.c.
Appends suffix to src_name.
In contrast to uncompressed_name(), we check only suffixes that are valid for the specified file format.
Definition at line 196 of file suffix.c.
References _, assert(), custom_suffix, FORMAT_AUTO, FORMAT_RAW, FORMAT_XZ, has_dir_sep(), i, memcpy(), message_error(), msg_suffix(), NULL, opt_format, suffix, test_suffix(), and xmalloc.
Referenced by suffix_get_dest_name().
Test if the string contains a directory separator.
Definition at line 42 of file suffix.c.
References NULL, and cmd_descs_generate::str.
Referenced by compressed_name(), and suffix_set().
|
static |
Test if the char is a directory separator.
Definition at line 30 of file suffix.c.
References c.
Referenced by test_suffix().
This message is needed in multiple places in compressed_name(), so the message has been put into its own function.
Definition at line 183 of file suffix.c.
References _, message_warning(), and suffix.
Referenced by compressed_name().
char* suffix_get_dest_name | ( | const char * | src_name | ) |
Get the name of the destination file.
Depending on the global variable opt_mode, this tries to find a matching counterpart for src_name. If the name can be constructed, it is allocated and returned (caller must free it). On error, a message is printed and NULL is returned.
Definition at line 373 of file suffix.c.
References assert(), compressed_name(), MODE_COMPRESS, NULL, opt_mode, and uncompressed_name().
Referenced by io_open_dest_real().
void suffix_set | ( | const char * | suffix | ) |
Set a custom filename suffix.
This function calls xstrdup() for the given suffix, thus the caller doesn't need to keep the memory allocated. There can be only one custom suffix, thus if this is called multiple times, the old suffixes are freed and forgotten.
Definition at line 388 of file suffix.c.
References _, custom_suffix, free(), has_dir_sep(), message_fatal(), suffix, and xstrdup().
Referenced by parse_real().
Checks if src_name has given compressed_suffix.
suffix | Filename suffix to look for |
src_name | Input filename |
src_len | strlen(src_name) |
Definition at line 87 of file suffix.c.
References is_dir_sep(), and suffix.
Referenced by compressed_name(), and uncompressed_name().
Removes the filename suffix of the compressed file.
Definition at line 110 of file suffix.c.
References _, ARRAY_SIZE, compressed, custom_suffix, FORMAT_RAW, i, memcpy(), message_error(), message_warning(), NULL, opt_format, test_suffix(), and xmalloc.
Referenced by suffix_get_dest_name().
|
static |
Definition at line 25 of file suffix.c.
Referenced by compressed_name(), suffix_set(), and uncompressed_name().