Commit a710f6ff authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Add strip_cp437_graphics() and have strip_ctrl() remove DEL chars too

strip_cp437_graphics() is like strip_exascii(), except it'll leave the foreign language characters and math symbols intact (removing just the common "block" and "line-drawing" characters).

DEL (0x7F) is a control character too, so have strip_ctrl() remove it.
parent 891f8c56
......@@ -68,7 +68,7 @@ char* strip_ctrl(const char *str, char* dest)
if(str[i]=='<' && j)
j--;
}
else if((uchar)str[i]>=' ')
else if((uchar)str[i]>=' ' && str[i] != DEL)
dest[j++]=str[i];
}
dest[j]=0;
......@@ -215,6 +215,20 @@ char* strip_exascii(const char *str, char* dest)
return dest;
}
char* strip_cp437_graphics(const char *str, char* dest)
{
int i,j;
if(dest==NULL && (dest=strdup(str))==NULL)
return NULL;
for(i=j=0;str[i];i++)
if((uchar)str[i] <= (uchar)CP437_INVERTED_EXCLAMATION_MARK
|| (uchar)str[i] >= (uchar)CP437_GREEK_SMALL_LETTER_ALPHA)
dest[j++]=str[i];
dest[j]=0;
return dest;
}
char* strip_space(const char *str, char* dest)
{
int i,j;
......
......@@ -55,6 +55,7 @@ DLLEXPORT str_list_t trashcan_list(scfg_t* cfg, const char* name);
DLLEXPORT char * convert_ansi(const char* src, char* dest, size_t, int width, BOOL ice_color);
DLLEXPORT char * strip_ansi(char* str);
DLLEXPORT char * strip_exascii(const char *str, char* dest);
DLLEXPORT char * strip_cp437_graphics(const char *str, char* dest);
DLLEXPORT char * strip_space(const char *str, char* dest);
DLLEXPORT char * strip_ctrl(const char *str, char* dest);
DLLEXPORT char * strip_char(const char* str, char* dest, char);
......
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