less-compatible paging

This commit is contained in:
2025-11-27 13:08:41 -08:00
parent e079726ced
commit 2f198e611e
2 changed files with 14 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)
project(ke C) # Specify C language explicitly project(ke C) # Specify C language explicitly
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)
set(KE_VERSION "1.5.5") set(KE_VERSION "1.5.6")
set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Wshadow -Werror -std=c99 -g") set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Wshadow -Werror -std=c99 -g")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DEFAULT_SOURCE -D_XOPEN_SOURCE") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DEFAULT_SOURCE -D_XOPEN_SOURCE")

20
main.c
View File

@@ -3077,7 +3077,8 @@ install_signal_handlers(void)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char *arg = NULL; char *fname = NULL;
char *lnarg = NULL;
int lineno = 0; int lineno = 0;
int opt; int opt;
int debug = 0; int debug = 0;
@@ -3108,22 +3109,27 @@ main(int argc, char *argv[])
init_editor(); init_editor();
if (argc > 0) { if (argc > 0) {
open_file(argv[0]); fname = argv[0];
} }
if (argc > 1) { if (argc > 1) {
arg = argv[1]; lnarg = argv[0];
if (arg[0] == '+') { fname = argv[1];
arg++; if (lnarg[0] == '+') {
lnarg++;
} }
lineno = atoi(arg); lineno = atoi(lnarg);
jump = 0; jump = 0;
} }
if (fname != NULL) {
open_file(fname);
}
editor_set_status("C-k q to exit / C-k d to dump core"); editor_set_status("C-k q to exit / C-k d to dump core");
if (jump) { if (jump) {
if (lineno < 1) { if (lineno < 1) {
editor_set_status("Invalid line number %s", arg); editor_set_status("Invalid line number %s", lnarg);
} else { } else {
jump_to_position(0, lineno - 1); jump_to_position(0, lineno - 1);
} }