diff --git a/src/utils.c b/src/utils.c index 4411499..6a923c5 100644 --- a/src/utils.c +++ b/src/utils.c @@ -84,10 +84,28 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column) { bool retval = TRUE; const char *comma; + int i; + bool found_digit = FALSE; assert(str != NULL); - comma = strchr(str, ','); + /* If we have any character other than '+', '-' or alphabets, it is + * comma between line and column number. */ + for (i = 0; i < strlen(str) - 1; ++i) { + /* Skip whitespace at the beginning. */ + if (!found_digit && (str[i] >= '0' && str[i] <= '9')) { + found_digit = TRUE; + } + + if (found_digit && !(str[i] == '+' || str[i] == '-' + || (str[i] >= '0' && str[i] <= '9'))) { + comma = strrchr(str, str[i]); + break; + } + } + + if (i >= (strlen(str) - 1)) + comma = NULL; if (comma != NULL && column != NULL) { if (!parse_num(comma + 1, column))