Commit 21796e0b authored by rswindell's avatar rswindell
Browse files

New truncate() str utility function - will truncate string at the first

occurance of any char in given set.
parent 1f3adf33
...@@ -769,7 +769,8 @@ extern "C" { ...@@ -769,7 +769,8 @@ extern "C" {
DLLEXPORT int DLLCALL update_uldate(scfg_t* cfg, file_t* f); DLLEXPORT int DLLCALL update_uldate(scfg_t* cfg, file_t* f);
/* str_util.c */ /* str_util.c */
DLLEXPORT void DLLCALL truncsp(char *str); /* Truncates white spaces off end of str */ DLLEXPORT void DLLCALL truncsp(char* str);
DLLEXPORT char * DLLCALL truncate(char* str, const char* set);
DLLEXPORT char * DLLCALL ascii_str(uchar* str); DLLEXPORT char * DLLCALL ascii_str(uchar* str);
DLLEXPORT BOOL DLLCALL findstr(char *insearch, char *fname); DLLEXPORT BOOL DLLCALL findstr(char *insearch, char *fname);
DLLEXPORT BOOL DLLCALL trashcan(scfg_t* cfg, char *insearch, char *name); DLLEXPORT BOOL DLLCALL trashcan(scfg_t* cfg, char *insearch, char *name);
......
...@@ -241,6 +241,20 @@ void DLLCALL truncsp(char *str) ...@@ -241,6 +241,20 @@ void DLLCALL truncsp(char *str)
str[c]=0; str[c]=0;
} }
/****************************************************************************/
/* Truncate string at first occurance of char in specified character set */
/****************************************************************************/
char* DLLCALL truncate(char* str, const char* set)
{
char* p;
p=strpbrk(str,set);
if(p!=NULL)
*p=0;
return(p);
}
/****************************************************************************/ /****************************************************************************/
/* Puts a backslash on path strings */ /* Puts a backslash on path strings */
/****************************************************************************/ /****************************************************************************/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment