Advance *cursor past leading blanks and return the next whitespace-delimited * token (NUL-terminated in place), or NULL when the line is exhausted. */
| 1006 | /* Advance *cursor past leading blanks and return the next whitespace-delimited |
| 1007 | * token (NUL-terminated in place), or NULL when the line is exhausted. */ |
| 1008 | static char *shebang_next_token(char **cursor) { |
| 1009 | char *p = *cursor; |
| 1010 | while (*p == ' ' || *p == '\t') { |
| 1011 | p++; |
| 1012 | } |
| 1013 | if (*p == '\0') { |
| 1014 | *cursor = p; |
| 1015 | return NULL; |
| 1016 | } |
| 1017 | char *start = p; |
| 1018 | while (*p && *p != ' ' && *p != '\t') { |
| 1019 | p++; |
| 1020 | } |
| 1021 | if (*p) { |
| 1022 | *p = '\0'; |
| 1023 | p++; |
| 1024 | } |
| 1025 | *cursor = p; |
| 1026 | return start; |
| 1027 | } |
| 1028 | |
| 1029 | CBMLanguage cbm_language_from_shebang(const char *path) { |
| 1030 | if (!path) { |
no outgoing calls
no test coverage detected