NAME
get_base_path - Strips suffix from file path
SYNOPSIS
#include "l/l_parse.h"
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-I/home/kobus/include
-L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
int get_base_path
(
const char *path,
char *base_path,
size_t base_path_size,
char *suffix,
size_t suffix_size,
const char **suffixes
);
DESCRIPTION
This routine strips the suffix from a file path, where suffix is defined as
a period followed by one of the strings in the NULL terminated array of
strings in the argument "suffixes". This is useful if you want to strip an
image file suffix like ".tiff" from a file name, but you don't want to
strip a non image file suffix ending like ".backup".
An example of how to set up suffixes is as follows:
static const char* suffixes[ ] =
{
"kiff", "kif", "mid", "miff", "tiff", "tif", "viff", "gif",
NULL
};
RETURNS
NO_ERROR on success, ERROR on failure.
RELATED
get_base_name
DISCLAIMER
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.
AUTHOR
Kobus Barnard
DOCUMENTER
Kobus Barnard
SEE ALSO
next_token
,
const_next_token
,
get_token
,
const_get_token
,
match_quote_get_token
,
const_match_quote_get_token
,
match_get_token
,
const_match_get_token
,
gen_get_token
,
const_gen_get_token
,
gen_char_get_token
,
gen_match_quote_get_token
,
const_gen_match_quote_get_token
,
gen_match_get_token
,
const_gen_match_get_token
,
alpha_get_token
,
gen_get_last_token
,
gen_get_last_token_2
,
gen_split_at_last_token
,
gen_split_at_last_token_2
,
parse_on_string
,
parse_positive_integer_list
,
parse_options
,
free_options
,
ic_parse_key_words
,
get_boolean_value
,
is_no_value_word
,
parse_path
,
get_base_name