Created
August 21, 2012 09:02
-
-
Save aragaer/3413758 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String /org/freedesktop/systemd1/unit/spice_2dvdagentd_2eservice | |
Got /org/freedesktop/systemd1/unit/spice_2dvdagentd_2eservice | |
replacing 2d with - | |
interim /org/freedesktop/systemd1/unit/spice-??vdagentd_2eservice | |
crash??? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void fix_path(const char **path) { | |
char *ptr = *path; | |
char *end = ptr + strlen(ptr); | |
char c; | |
printf("String %s\n", *path); | |
for (;*ptr; ptr++) { | |
if (*ptr != '_') | |
continue; | |
printf("Got %s\n", *path); | |
printf("replacing %c%c with ", ptr[1], ptr[2]); | |
sscanf(ptr+1, "%02x", &c); | |
printf("%c\n", c); | |
*ptr = c; | |
ptr[1] = ptr[2] = '?'; | |
printf("interim %s\n", *path); | |
memmove(ptr + 1, ptr + 3, end - ptr - 3); | |
end -= 2; | |
printf("now %s\n", *path); | |
} | |
printf("Out with %s\n", *path); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment