} while (isdigit(my_str[idx]));
my_str[idx] = 0;
*line = atoi(my_str);
- *regex = NULL;
}
else if (my_str[idx] == '$') {
*line = -1;
- *regex = NULL;
idx++;
}
else if (my_str[idx] == '/') {
my_str[idx] = '\0';
*regex = (regex_t *)xmalloc(sizeof(regex_t));
xregcomp(*regex, my_str+1, REG_NEWLINE);
+ idx++; /* so it points to the next character after the last '/' */
}
else {
fprintf(stderr, "sed.c:get_address: no address found in string\n");
} while (isdigit(my_str[idx]));
my_str[idx] = 0;
*line = atoi(my_str);
- *regex = NULL;
}
else if (my_str[idx] == '$') {
*line = -1;
- *regex = NULL;
idx++;
}
else if (my_str[idx] == '/') {
my_str[idx] = '\0';
*regex = (regex_t *)xmalloc(sizeof(regex_t));
xregcomp(*regex, my_str+1, REG_NEWLINE);
+ idx++; /* so it points to the next character after the last '/' */
}
else {
fprintf(stderr, "sed.c:get_address: no address found in string\n");