Definition in file arr_utils.c.
#include "arr_utils.h"
#include "globals.h"
#include <stdarg.h>
Go to the source code of this file.
Functions | |
| void | strip_crlf (char *string_in) |
| Strips control characters from end of a string. | |
| char * | trim_right (char *string_in) |
| Trimms white & control character from string end. | |
| char * | trim_left (char *string_in) |
| Trimms white & control character from string start. | |
| char * | strdup_noquot (char *src) |
| Duplicates a string without quotes. | |
| char * | strdup_trim (char *src) |
| Duplicates a string with trimming. | |
| char * | filename_from_path (char *pathname) |
| Returns file name only from given filename with path. | |
| short | format_map_fname (char *fname, const char *usrinput, const char *levels_path) |
| Creates map filename from given string. | |
| char * | prepare_short_fname (const char *fname, unsigned int maxlen) |
| Prepares short version of the given filename. | |
| short | format_data_fname (char **fullname, const char *data_path, const char *format,...) |
| Formats data file name. | |
| int | arr_ushort_pos (const unsigned short *arr, unsigned short arr_item, int array_count) |
| Searches for position of an item in array of unsigned short. | |
| int arr_ushort_pos | ( | const unsigned short * | arr, | |
| unsigned short | arr_item, | |||
| int | array_count | |||
| ) |
Searches for position of an item in array of unsigned short.
| arr | Pointer to the source array. | |
| arr_item | The searched item. | |
| array_count | Size of the array (number of elements in it). |
Definition at line 280 of file arr_utils.c.
Referenced by cube_wib_animate(), get_orientation_next(), is_animated_cube(), slab_is_door(), slab_is_liquid(), slab_is_room(), slab_is_short_unclmabl(), slab_is_space(), slab_is_tall_unclmabl(), slab_is_wall(), and slab_is_wealth().
| char* filename_from_path | ( | char * | pathname | ) |
Returns file name only from given filename with path.
| pathname | The source filename, possibly with path. |
Definition at line 146 of file arr_utils.c.
| short format_data_fname | ( | char ** | fullname, | |
| const char * | data_path, | |||
| const char * | format, | |||
| ... | ||||
| ) |
Formats data file name.
Allocates memory and prints formatted file name into it. fullname Pointer to the returned file name. data_path Path to the data directory, inserted before filename. format The string format used to create file name.
Definition at line 251 of file arr_utils.c.
Referenced by change_draw_data_texture(), and load_draw_data().
| short format_map_fname | ( | char * | fname, | |
| const char * | usrinput, | |||
| const char * | levels_path | |||
| ) |
Creates map filename from given string.
| fname | The output filename. | |
| usrinput | The input string used to create filename. | |
| levels_path | Directory path to the folder containing levels. |
Definition at line 168 of file arr_utils.c.
Referenced by format_lvl_fname(), and format_lvl_savfname().
| char* prepare_short_fname | ( | const char * | fname, | |
| unsigned int | maxlen | |||
| ) |
Prepares short version of the given filename.
Resulting string is never longer than maxlen. Allocates memory for the returned string - you should free() it after use.
| fname | The input (possibly long) file name. | |
| maxlen | Maximal size of the returned output string. |
Definition at line 214 of file arr_utils.c.
Referenced by add_stats_to_script(), load_mapfile(), load_mapfile_msg(), and save_mapfile().
| char* strdup_noquot | ( | char * | src | ) |
Duplicates a string without quotes.
Allocates memory and copies null-terminated string, skipping any quotes at start/end of the source. Any white/control character outside of quotes are skipped. All white/control characters inside quotes are preserved.
| src | The string which is duplicated. |
Definition at line 93 of file arr_utils.c.
Referenced by execute_adikted_command().
| char* strdup_trim | ( | char * | src | ) |
Duplicates a string with trimming.
Allocates memory and copies null-terminated string, skipping any white/control characters at start/end of the source.
| src | The string which is duplicated. |
Definition at line 124 of file arr_utils.c.
Referenced by load_lif().
| void strip_crlf | ( | char * | string_in | ) |
Strips control characters from end of a string.
| string_in | the string which is stripped. |
Definition at line 28 of file arr_utils.c.
| char* trim_left | ( | char * | string_in | ) |
Trimms white & control character from string start.
| string_in | The string which is trimmed. |
Definition at line 69 of file arr_utils.c.
| char* trim_right | ( | char * | string_in | ) |
Trimms white & control character from string end.
| string_in | The string which is trimmed. |
Definition at line 48 of file arr_utils.c.
1.5.6