Skip to content
Snippets Groups Projects
Commit 88586297 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Create a version of truncstr() that returns the truncated string

No immediate use/need, but I *almost* did. :-)
parent 93208aa9
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1285 passed
......@@ -399,6 +399,8 @@ char* ultoac(ulong l, char *string)
/****************************************************************************/
/* Truncate string at first occurrence of char in specified character set */
/* Returns a pointer to the terminating NUL if the string was truncated, */
/* NULL otherwise. */
/****************************************************************************/
char* truncstr(char* str, const char* set)
{
......@@ -411,6 +413,16 @@ char* truncstr(char* str, const char* set)
return(p);
}
/****************************************************************************/
/* Truncate string at first occurrence of char in specified character set */
/* Returns a pointer to the start of the string. */
/****************************************************************************/
char* truncated_str(char* str, const char* set)
{
truncstr(str, set);
return str;
}
/****************************************************************************/
/* rot13 encoder/decoder - courtesy of Mike Acar */
/****************************************************************************/
......
......@@ -38,6 +38,7 @@ DLLEXPORT int strsame(const char *str1, const char *str2); /* Compares number o
DLLEXPORT char * remove_ctrl_a(const char* instr, char* outstr);
DLLEXPORT char ctrl_a_to_ascii_char(char code);
DLLEXPORT char * truncstr(char* str, const char* set);
DLLEXPORT char * truncated_str(char* str, const char* set);
DLLEXPORT char * ascii_str(uchar* str);
DLLEXPORT char * replace_named_values(const char* src ,char* buf, size_t buflen,
const char* escape_seq, named_string_t* string_list,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment