* util.c: Added the function str_replace, which replaces all occurences of a character in a string.

This commit is contained in:
Roland Illig 2004-08-19 11:26:48 +00:00
parent b328811d2a
commit c6e3dde5a5
3 changed files with 13 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2004-18-19 Roland Illig <roland.illig@gmx.de>
* util.c: Added the function str_replace, which replaces
all occurences of a character in a string.
2004-08-19 Pavel Shirshov <pavelsh@mail.ru>
* utilunix.c (mc_tmpdir): Fix typos in comment.

View File

@ -47,6 +47,14 @@
static const char app_text [] = "Midnight-Commander";
int easy_patterns = 1;
extern void str_replace(char *s, char from, char to)
{
for (; *s != '\0'; s++) {
if (*s == from)
*s = to;
}
}
static inline int
is_7bit_printable (unsigned char c)
{

View File

@ -6,6 +6,7 @@
/* String managing functions */
void str_replace(char *s, char from, char to);
int is_printable (int c);
int msglen (const char *text, int *lines);
char *trim (char *s, char *d, int len);