diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2020-12-30 15:30:19 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2020-12-30 15:30:19 -0800 |
| commit | a07da1989d7ec515d4bb08051ea6940960577446 (patch) | |
| tree | 6f506818554fc205ddcc46a3c9bfe6054ae9cea7 /utils.c | |
| parent | 7d4bc36949cec8e5c791c352a264cd1dea4f8a1e (diff) | |
Simplified syntax for replacement: just =>, no need for {}
Diffstat (limited to 'utils.c')
| -rw-r--r-- | utils.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -75,6 +75,20 @@ int matchchar(const char **str, char c) } /* + * Check if a string is found and if so, move past it. + */ +int matchstr(const char **str, const char *target) +{ + const char *next = after_spaces(*str); + if (strncmp(next, target, strlen(target)) == 0) { + *str = &next[strlen(target)]; + return 1; + } else { + return 0; + } +} + +/* * Process a string escape sequence for a character and return the * character that was escaped. * Set *end = the first character past the end of the escape sequence. |
