2008-06-04
* Fix bug where conky tries to free a already freed pointer when you
use gw_iface with a empty routingtable in linux
+ * Fix bug where conky tries to tries to display deleted chars in a
+ string (chars followed by a backspace-char) causing strange output.
2008-06-03
* Added NVIDIA Graficcard support patch (thanks meissna)
return strndup("<inf>", text_buffer_size);
}
+//remove backspaced chars, example: "dog^H^H^Hcat" becomes "cat"
+//string has to end with \0 and it's length should fit in a int
+#define BACKSPACE 8
+void remove_deleted_chars(char *string){
+ int i = 0;
+ while(string[i] != 0){
+ if(string[i] == BACKSPACE){
+ if(i != 0){
+ strcpy( &(string[i-1]), &(string[i+1]) );
+ i--;
+ }else strcpy( &(string[i]), &(string[i+1]) ); //necessary for ^H's at the start of a string
+ }else i++;
+ }
+}
+
static void generate_text_internal(char *p, int p_max_size,
struct text_object *objs, unsigned int object_count,
struct information *cur)
pclose(fp);
p[length] = '\0';
+ remove_deleted_chars(p);
if (length > 0 && p[length - 1] == '\n') {
p[length - 1] = '\0';
}