diff options
| author | 童宗振 <[email protected]> | 2024-04-24 08:38:20 +0000 |
|---|---|---|
| committer | 童宗振 <[email protected]> | 2024-04-24 08:38:20 +0000 |
| commit | 3e5b0adb45e1c0f11d7f69a56947f51a5705dc52 (patch) | |
| tree | c635b2d36f5a805772b01a192af96de5de04593c /include/common.h | |
| parent | be47e141bfd2536cd674ae2666ea5ac95f7945b3 (diff) | |
Maat field mod
Diffstat (limited to 'include/common.h')
| -rw-r--r-- | include/common.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index 68c9989..da3884f 100644 --- a/include/common.h +++ b/include/common.h @@ -94,4 +94,25 @@ static inline char * paths_combine(const char * restrict prog_absolute_path, con realpath(combine_path, resolve_path); return resolve_path; +} + +static inline void backspace_remove(const char * input, char * output) +{ + int i, j; + + for (i = 0, j = 0; i < strlen(input) - 1; i++) + { + if (input[i] == '\\' && input[i + 1] == 'b') + { + i += 1; + output[j++] = ' '; + } + else + { + output[j++] = input[i]; + } + } + output[j++] = input[i]; + + output[j] = '\0'; }
\ No newline at end of file |
