tweaks: reshuffle a declaration, adjust a comment, normalize indentation

This commit is contained in:
Benno Schulenberg
2024-05-10 11:23:42 +02:00
parent 54c8cb8c81
commit d64235eb6e

View File

@@ -2494,24 +2494,26 @@ int main(int argc, char **argv)
#endif
{
char *filename = argv[optind++];
char *colon = filename + (*filename ? 1 : 0);
struct stat fileinfo;
/* Search the filename for a colon. If the colon is preceded by
* a backslash, elide the backslash and skip the colon. If there
* is a valid number after the colon, chop colon and number off.
/* If the filename contains a colon and this file does not exist,
* then check if the filename ends with a number (while skipping
* any colon preceded by a backslash and eliding the backslash).
* If there is a valid trailing number, chop colon and number off.
* The number is later used to place the cursor on that line. */
if (strchr(filename, ':') && stat(filename, &fileinfo) < 0) {
while ((colon = strchr(colon, ':'))) {
if (*(colon - 1) == '\\')
memmove(colon - 1, colon, strlen(colon) + 1);
else if (parse_line_column(colon + 1, &givenline, &givencol)) {
*colon = '\0';
if (stat(filename, &fileinfo) < 0)
*colon++ = ':';
} else
++colon;
}
char *colon = filename + (*filename ? 1 : 0);
while ((colon = strchr(colon, ':'))) {
if (*(colon - 1) == '\\')
memmove(colon - 1, colon, strlen(colon) + 1);
else if (parse_line_column(colon + 1, &givenline, &givencol)) {
*colon = '\0';
if (stat(filename, &fileinfo) < 0)
*colon++ = ':';
} else
++colon;
}
}
if (!open_buffer(filename, TRUE))