diff --git a/Makefile b/Makefile index 9767652..f5f6cfb 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,43 @@ -# splinter -- POSIX make, no GNU extensions, no shell helpers. +# splinter -- POSIX make for our own code, GNU make only for the vendored curses. # -# `make` builds the binary -# `make check` builds and runs every test binary -# `make clean` removes generated files only +# make builds the binary (with the curses TUI) +# make check builds and runs every test binary +# make curses builds the vendored NetBSD curses explicitly +# make clean removes generated files only # # Generated files never mix with handwritten ones, and nothing here needs a -# configure step: the dependency set is libc, plus curl(1) at runtime if you -# use --endpoint. +# configure step: the dependency set is libc, the vendored NetBSD curses, and +# curl(1) at runtime if you use --endpoint. CC ?= cc -CFLAGS ?= -std=c99 -O2 -Wall -Wextra -Werror -D_POSIX_C_SOURCE=200809L -Iinclude +CFLAGS ?= -std=c99 -O2 -Wall -Wextra -Werror -D_POSIX_C_SOURCE=200809L \ + -Iinclude -Isrc -Ivendor/netbsd-curses/libcurses LDFLAGS ?= LIBS ?= +PREFIX ?= /usr/local + +CURSES_DIR = vendor/netbsd-curses +CURSES_A = $(CURSES_DIR)/libcurses/libcurses.a \ + $(CURSES_DIR)/libterminfo/libterminfo.a BIN = splinter OBJ = src/buf.o src/tool.o src/session.o src/transport.o src/transport_curl.o \ - src/builtin.o src/agent.o + src/builtin.o src/agent.o src/theme.o src/palettes.o src/ui.o TESTS = tests/test_buf tests/test_tool tests/test_session tests/test_transport \ - tests/test_agent + tests/test_agent tests/test_theme all: $(BIN) -$(BIN): $(OBJ) src/main.o - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) src/main.o $(LIBS) +# The vendored tree ships a GNUmakefile; this is the only place that needs GNU +# make, and it is why the comment above says so out loud. +$(CURSES_A): + cd $(CURSES_DIR) && $(MAKE) -f GNUmakefile libcurses/libcurses.a \ + libterminfo/libterminfo.a + +curses: $(CURSES_A) + +$(BIN): $(OBJ) src/main.o $(CURSES_A) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJ) src/main.o $(CURSES_A) $(LIBS) src/buf.o: src/buf.c include/splinter.h $(CC) $(CFLAGS) -c -o $@ src/buf.c @@ -45,23 +60,35 @@ src/builtin.o: src/builtin.c include/splinter.h src/agent.o: src/agent.c include/splinter.h $(CC) $(CFLAGS) -c -o $@ src/agent.c -src/main.o: src/main.c include/splinter.h +src/theme.o: src/theme.c src/theme.h src/palettes.h include/splinter.h + $(CC) $(CFLAGS) -c -o $@ src/theme.c + +src/palettes.o: src/palettes.c src/palettes.h + $(CC) $(CFLAGS) -c -o $@ src/palettes.c + +src/ui.o: src/ui.c src/ui.h src/theme.h include/splinter.h + $(CC) $(CFLAGS) -c -o $@ src/ui.c + +src/main.o: src/main.c include/splinter.h src/ui.h src/theme.h $(CC) $(CFLAGS) -c -o $@ src/main.c tests/test_buf: tests/test_buf.c $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_buf.c $(OBJ) $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_buf.c $(OBJ) $(CURSES_A) $(LIBS) tests/test_tool: tests/test_tool.c $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_tool.c $(OBJ) $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_tool.c $(OBJ) $(CURSES_A) $(LIBS) tests/test_session: tests/test_session.c $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_session.c $(OBJ) $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_session.c $(OBJ) $(CURSES_A) $(LIBS) tests/test_transport: tests/test_transport.c $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_transport.c $(OBJ) $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_transport.c $(OBJ) $(CURSES_A) $(LIBS) tests/test_agent: tests/test_agent.c $(OBJ) - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_agent.c $(OBJ) $(LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_agent.c $(OBJ) $(CURSES_A) $(LIBS) + +tests/test_theme: tests/test_theme.c $(OBJ) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ tests/test_theme.c $(OBJ) $(CURSES_A) $(LIBS) check: $(BIN) $(TESTS) @set -e; for t in $(TESTS); do echo "== $$t"; ./$$t; done; \ @@ -71,9 +98,7 @@ install: $(BIN) mkdir -p $(DESTDIR)$(PREFIX)/bin cp $(BIN) $(DESTDIR)$(PREFIX)/bin/ -PREFIX ?= /usr/local - clean: rm -f $(BIN) $(OBJ) src/main.o $(TESTS) -.PHONY: all check install clean +.PHONY: all check curses install clean diff --git a/src/main.c b/src/main.c index 96bb658..c315109 100644 --- a/src/main.c +++ b/src/main.c @@ -15,6 +15,8 @@ #include #include "splinter.h" +#include "theme.h" +#include "ui.h" static void usage(FILE *f) @@ -82,10 +84,11 @@ main(int argc, char **argv) struct sp_session_info sess; struct sp_buf answer = { 0 }, err = { 0 }; const char *prompt = NULL, *endpoint = NULL, *script = NULL; - const char *sessdir = NULL, *sessid = NULL; + const char *sessdir = NULL, *sessid = NULL, *theme = NULL; + int list_themes = 0; char default_id[64]; struct script_ctx sctx = { NULL, 0 }; - int i, rc; + int i, rc, chatmode = 0; memset(®, 0, sizeof(reg)); memset(&ag, 0, sizeof(ag)); @@ -113,6 +116,8 @@ main(int argc, char **argv) if (!need_value(argc, i, argv[i])) return 2; script = argv[++i]; + } else if (!strcmp(argv[i], "--chat")) { + chatmode = 1; } else if (!strcmp(argv[i], "--autonomous")) { cfg.autonomous = 1; } else if (!strcmp(argv[i], "--steps")) { @@ -123,6 +128,12 @@ main(int argc, char **argv) if (!need_value(argc, i, argv[i])) return 2; cfg.max_bytes = (size_t)strtoul(argv[++i], NULL, 10); + } else if (!strcmp(argv[i], "--theme")) { + if (!need_value(argc, i, argv[i])) + return 2; + theme = argv[++i]; + } else if (!strcmp(argv[i], "--list-themes")) { + list_themes = 1; } else if (!strcmp(argv[i], "--session")) { if (!need_value(argc, i, argv[i])) return 2; @@ -137,6 +148,16 @@ main(int argc, char **argv) } } + if (list_themes) { + const char **names; + size_t count, k; + + sp_theme_list(&names, &count); + for (k = 0; k < count; k++) + printf("%s\n", names[k]); + return 0; + } + if (endpoint != NULL && script != NULL) { fprintf(stderr, "splinter: choose one transport, not two\n"); return 2; @@ -146,9 +167,9 @@ main(int argc, char **argv) "--script)\n"); return 2; } - if (prompt == NULL) { - fprintf(stderr, "splinter: -p/--prompt is required in %s\n", - SP_VERSION); + if (prompt == NULL && !chatmode) { + fprintf(stderr, "splinter: -p/--prompt is required unless you " + "pass --chat\n"); return 2; } @@ -197,6 +218,16 @@ main(int argc, char **argv) ag.reg = ® ag.cfg = &cfg; + if (chatmode) { + rc = sp_ui_run(&ag, endpoint, theme); + if (sctx.f != NULL) + fclose(sctx.f); + sp_buf_free(&answer); + sp_buf_free(&err); + sp_registry_free(®); + return rc; + } + rc = sp_agent_run(&ag, prompt, &answer, &err); if (rc == 0) { printf("%s\n", answer.p); diff --git a/src/palettes.c b/src/palettes.c new file mode 100644 index 0000000..5a4e33a --- /dev/null +++ b/src/palettes.c @@ -0,0 +1,52 @@ +/* + * Generated by tools/genpalettes.py from the CDE palette files. + * Do not edit by hand: change the .dp source or the generator. + */ +#include "palettes.h" + +const struct sp_palette sp_palettes[] = { + { "Alpine", { {0xaf,0xbf,0xfb}, {0x78,0xaa,0xb8}, {0x7a,0xb9,0xd8}, {0xbf,0xc0,0xc5}, {0xbf,0x92,0x79}, {0xbf,0xc0,0xc5}, {0xbd,0xbd,0xeb}, {0xbf,0xc0,0xc5} } }, + { "Arizona", { {0xff,0xab,0x78}, {0xa8,0x6b,0x79}, {0xde,0xb3,0x94}, {0x88,0x57,0x70}, {0xc3,0x7d,0x79}, {0xcd,0x78,0x6a}, {0x64,0x60,0x47}, {0x84,0x54,0x5f} } }, + { "BeigeRose", { {0x61,0x88,0x88}, {0xd1,0xc0,0xae}, {0xb7,0x89,0x89}, {0xf0,0xec,0xeb}, {0x91,0x91,0x91}, {0xb9,0xb9,0xb9}, {0x87,0x93,0xae}, {0x90,0xb0,0xac} } }, + { "Black", { {0x00,0x00,0x00}, {0x00,0x00,0x00}, {0x00,0x00,0x00}, {0x00,0x00,0x00}, {0x00,0x00,0x00}, {0x00,0x00,0x00}, {0x00,0x00,0x00}, {0x00,0x00,0x00} } }, + { "BlackWhite", { {0x00,0x00,0x00}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0x00,0x00,0x00}, {0x00,0x00,0x00}, {0x00,0x00,0x00}, {0x00,0x00,0x00}, {0x00,0x00,0x00} } }, + { "Broica", { {0xed,0xa8,0x70}, {0x99,0x99,0x99}, {0x89,0x98,0xaa}, {0x68,0x6f,0x82}, {0xc6,0xb2,0xa8}, {0x49,0x92,0xa7}, {0xb7,0x87,0x8d}, {0x93,0xab,0xbf} } }, + { "Cabernet", { {0xd8,0x87,0x75}, {0x63,0x8a,0x7a}, {0x45,0x62,0x56}, {0x4b,0x5e,0x61}, {0xb6,0x5c,0x71}, {0x83,0x3b,0x47}, {0x79,0x46,0x55}, {0x49,0x5c,0x65} } }, + { "Camouflage", { {0xac,0xbe,0xb4}, {0x6e,0x7d,0x76}, {0x90,0x7b,0x7b}, {0x82,0x82,0x9b}, {0x8e,0x8e,0x77}, {0x7f,0x6c,0x6c}, {0x8e,0x8e,0x85}, {0x4e,0x6b,0x65} } }, + { "Charcoal", { {0x87,0xb4,0xb0}, {0x76,0x72,0x79}, {0x69,0x63,0x63}, {0x89,0x6d,0x6d}, {0x82,0x85,0x85}, {0x63,0x6f,0x6d}, {0x91,0x91,0x91}, {0xaf,0x96,0x96} } }, + { "Chocolate", { {0xa9,0xa9,0xff}, {0x70,0x8c,0x8d}, {0x87,0x87,0xaf}, {0x96,0x78,0x78}, {0xb9,0xa0,0xa0}, {0xa5,0x82,0x82}, {0xbb,0xbb,0xd9}, {0x96,0x96,0xb9} } }, + { "Cinnamon", { {0xb1,0x4b,0x50}, {0x92,0x68,0x66}, {0x79,0x6e,0x6d}, {0x83,0x69,0x60}, {0x9b,0x68,0x62}, {0xa2,0x8d,0x8c}, {0x84,0x75,0x74}, {0x78,0x69,0x5d} } }, + { "Clay", { {0xff,0xaa,0xaa}, {0x96,0x82,0x82}, {0x5a,0x8b,0x8d}, {0x8c,0x64,0x64}, {0xaf,0x91,0x91}, {0xa5,0x6e,0x6e}, {0xac,0x83,0x83}, {0x2f,0x8b,0x8d} } }, + { "Crimson", { {0xb2,0x4d,0x7a}, {0xae,0xb2,0xc3}, {0x71,0x8b,0xa5}, {0xff,0xf7,0xe9}, {0x68,0xa6,0xa0}, {0x8d,0xad,0xc7}, {0xd3,0x97,0x98}, {0x97,0x93,0xb5} } }, + { "DarkGold", { {0xb8,0x96,0x63}, {0x7a,0x7c,0x7f}, {0x53,0x55,0x70}, {0xff,0xff,0xe2}, {0xa8,0xa8,0xa8}, {0x79,0x9c,0xa1}, {0x86,0x7f,0xb5}, {0x6b,0x94,0xb2} } }, + { "Default", { {0xed,0xa8,0x70}, {0x99,0x99,0x99}, {0x89,0x98,0xaa}, {0x68,0x6f,0x82}, {0xc6,0xb2,0xa8}, {0x49,0x92,0xa7}, {0xb7,0x87,0x8d}, {0x93,0xab,0xbf} } }, + { "Delphinium", { {0x85,0xc4,0xed}, {0xc8,0xc8,0xc8}, {0x85,0x8c,0xd9}, {0xff,0xff,0xe6}, {0x78,0xb4,0xbe}, {0x55,0x86,0xc3}, {0xba,0x9d,0x91}, {0x90,0xa0,0xbe} } }, + { "Desert", { {0xe5,0xb7,0x93}, {0xc2,0xbb,0xa7}, {0x8c,0x8f,0x98}, {0xfd,0xfd,0xfa}, {0x9f,0xae,0xb5}, {0x6f,0x98,0xa2}, {0x73,0x9e,0xbd}, {0xc4,0x92,0x9b} } }, + { "Golden", { {0xfa,0xad,0x49}, {0x4d,0x64,0x8d}, {0xbe,0x82,0x6f}, {0x47,0x63,0x4f}, {0x75,0x7c,0xa6}, {0x3d,0x77,0x77}, {0x2b,0x79,0x85}, {0xb1,0x70,0x5f} } }, + { "Grass", { {0xd4,0xc7,0x7d}, {0xbe,0xc6,0xb7}, {0x5e,0x9c,0x7b}, {0xe2,0xf3,0xe2}, {0xa4,0xa9,0xaa}, {0x90,0xa7,0x93}, {0x60,0x87,0x9e}, {0x82,0x96,0x94} } }, + { "GrayScale", { {0xc3,0xc3,0xc3}, {0x78,0x77,0x77}, {0xbd,0xbd,0xbd}, {0x94,0x94,0x93}, {0xbc,0xbc,0xbc}, {0x93,0x93,0x93}, {0x7f,0x7f,0x7f}, {0x93,0x93,0x93} } }, + { "Lilac", { {0xd3,0xd1,0x78}, {0xa5,0xa5,0xac}, {0xa6,0x92,0xb7}, {0xc3,0xc3,0xc9}, {0xa5,0xa5,0xac}, {0xc6,0xb1,0xb1}, {0xc2,0xc2,0xd2}, {0x91,0x7e,0x9f} } }, + { "MakroSlate", { {0x18,0x1f,0x26}, {0x2b,0x3a,0x44}, {0x45,0x5a,0x66}, {0x60,0x78,0x88}, {0x8e,0xa8,0xb8}, {0xb8,0xcc,0xd8}, {0xd8,0xe8,0xf0}, {0xf8,0xfc,0xff} } }, + { "Mustard", { {0xd5,0x80,0x2e}, {0xb7,0x5f,0x5f}, {0x4d,0x64,0x8d}, {0x5c,0x6a,0x58}, {0x88,0x7c,0xa3}, {0xbe,0x82,0x6f}, {0x46,0x79,0x76}, {0x2a,0x68,0x89} } }, + { "Neptune", { {0xa2,0xe5,0xc6}, {0x3f,0x93,0x8d}, {0x2d,0x4e,0x76}, {0x78,0x89,0xa5}, {0x63,0x7e,0x95}, {0x3e,0x70,0x8a}, {0x3d,0x7d,0x84}, {0x61,0x6d,0x8e} } }, + { "NorthernSky", { {0xa4,0x75,0x91}, {0x1b,0x5d,0x6c}, {0x0c,0x5a,0x87}, {0x00,0x57,0x7a}, {0x41,0x52,0x5c}, {0x4b,0x7b,0x82}, {0x27,0x70,0x8b}, {0x3d,0x40,0x7c} } }, + { "Nutmeg", { {0xce,0xc2,0xbb}, {0x25,0x65,0x93}, {0x9f,0x88,0x81}, {0xcd,0xb2,0xa6}, {0xb3,0x9c,0x8f}, {0xcf,0xb8,0xaa}, {0x90,0xac,0xdb}, {0x45,0x72,0x93} } }, + { "Olive", { {0x83,0x83,0x5a}, {0xc3,0xc3,0xb9}, {0x87,0x79,0x87}, {0xce,0xc2,0xb8}, {0xcd,0xbd,0xaa}, {0xe1,0xa8,0x97}, {0xb5,0xa1,0xb5}, {0x9a,0x91,0x9a} } }, + { "Orchid", { {0xb9,0xb9,0xff}, {0x9b,0x9b,0xb9}, {0xa8,0xa8,0xcd}, {0x82,0x82,0xab}, {0x9b,0xbe,0xd7}, {0x98,0x98,0xc8}, {0x8c,0x8c,0xaa}, {0xb0,0xb0,0xbf} } }, + { "PBNJ", { {0xb6,0x5c,0x61}, {0xd9,0xc1,0xb2}, {0xde,0xa1,0x7f}, {0xf1,0xe3,0xd2}, {0xc6,0x90,0x76}, {0xcb,0xa0,0x8d}, {0x9e,0x86,0xb5}, {0xeb,0xd7,0xbf} } }, + { "Sand", { {0xea,0xbe,0x93}, {0xc7,0xaf,0xaf}, {0x8e,0xa2,0xc1}, {0xd4,0xd4,0xda}, {0xaf,0x81,0x81}, {0xbb,0xb5,0xa8}, {0xbf,0xbe,0xd6}, {0x96,0x96,0x96} } }, + { "SantaFe", { {0xef,0x9d,0x9d}, {0x7e,0xab,0xab}, {0xbd,0xa2,0x8d}, {0xce,0xaf,0x9a}, {0x83,0xa5,0xb6}, {0x7f,0x9c,0x8c}, {0x72,0xab,0xc8}, {0x9c,0x99,0x92} } }, + { "Savannah", { {0xda,0x9a,0x68}, {0xb4,0xaa,0x94}, {0xa0,0xb2,0xc8}, {0xd2,0xbf,0xa8}, {0xc6,0xb2,0xa8}, {0x97,0xa7,0x92}, {0xb7,0xae,0xaa}, {0x93,0xab,0xbf} } }, + { "SeaFoam", { {0xaa,0xcb,0xdb}, {0xa7,0xa8,0xa7}, {0x7d,0xb7,0xbb}, {0x97,0xb0,0xb2}, {0xaf,0xbf,0xba}, {0xc5,0xaf,0xa4}, {0x98,0xaa,0xa5}, {0xc8,0xad,0xa0} } }, + { "SkyRed", { {0xcc,0x68,0x6f}, {0xaf,0xc0,0xc2}, {0x6d,0xa7,0xb4}, {0xe1,0xeb,0xe1}, {0x6e,0x91,0xaa}, {0x8b,0x97,0x9f}, {0xb7,0xb5,0x8d}, {0x5e,0x84,0xb9} } }, + { "SoftBlue", { {0x7f,0xa9,0xeb}, {0x76,0xa9,0x9c}, {0x5b,0x85,0xd0}, {0x6c,0x6c,0x6c}, {0x94,0xd5,0xdf}, {0xb8,0xce,0xbc}, {0xbd,0xbd,0xeb}, {0x5d,0x7c,0xb8} } }, + { "SouthWest", { {0xff,0x7d,0x79}, {0xa9,0x75,0x61}, {0xc0,0x9b,0x80}, {0xb1,0x88,0x85}, {0xb8,0x6f,0x4b}, {0x88,0x72,0x61}, {0xb8,0x8a,0x75}, {0x98,0x9c,0xa8} } }, + { "Summer", { {0xff,0x56,0x64}, {0xff,0xd6,0x90}, {0x82,0x9f,0xff}, {0xff,0xff,0xff}, {0x86,0xea,0xe7}, {0xb8,0xc8,0xff}, {0x64,0xc1,0xff}, {0xbc,0xc5,0xdb} } }, + { "Tundra", { {0xf1,0xbc,0x7f}, {0xa5,0x96,0x80}, {0x7c,0x92,0xb9}, {0x76,0x7e,0x63}, {0x85,0x96,0x80}, {0x7a,0x93,0x95}, {0x82,0x7a,0x8f}, {0x83,0x7e,0x75} } }, + { "Urchin", { {0xd5,0xa5,0x91}, {0x0f,0x7c,0x7a}, {0x70,0x68,0x89}, {0x0c,0x68,0x64}, {0x37,0x92,0xa2}, {0x12,0x8e,0x89}, {0x88,0x9a,0x8e}, {0x32,0x83,0x92} } }, + { "Wheat", { {0xd1,0xa5,0x7a}, {0xdb,0xc2,0x91}, {0x48,0x6d,0x7f}, {0xbf,0xc0,0xc5}, {0x94,0xd5,0xdf}, {0xb8,0xce,0xbc}, {0xbd,0xbd,0xeb}, {0x5d,0x7c,0xb8} } }, + { "White", { {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff} } }, + { "WhiteBlack", { {0xff,0xff,0xff}, {0x00,0x00,0x00}, {0x00,0x00,0x00}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff}, {0xff,0xff,0xff} } }, +}; + +const size_t sp_palette_count = sizeof(sp_palettes) / sizeof(sp_palettes[0]); diff --git a/src/palettes.h b/src/palettes.h new file mode 100644 index 0000000..ae9d0f4 --- /dev/null +++ b/src/palettes.h @@ -0,0 +1,15 @@ +/* splinter -- CDE palettes, generated by tools/genpalettes.py. */ +#ifndef SPLINTER_PALETTES_H +#define SPLINTER_PALETTES_H + +#include + +struct sp_palette { + const char *name; + unsigned char c[8][3]; /* eight CDE colour sets, RGB 0-255 */ +}; + +extern const struct sp_palette sp_palettes[]; +extern const size_t sp_palette_count; + +#endif /* SPLINTER_PALETTES_H */ diff --git a/src/theme.c b/src/theme.c new file mode 100644 index 0000000..6048ea6 --- /dev/null +++ b/src/theme.c @@ -0,0 +1,174 @@ +/* + * splinter -- CDE palettes as terminal themes. + * + * Copyright (c) 2026 Konrad Lother + * SPDX-License-Identifier: BSD-3-Clause + */ +#include +#include + +#include "theme.h" +#include "palettes.h" + +static int +luma(const unsigned char *c) +{ + /* integer Rec.601 luma, so the ordering is deterministic and testable */ + return 299 * c[0] + 587 * c[1] + 114 * c[2]; +} + +static int +saturation(const unsigned char *c) +{ + int hi = c[0], lo = c[0]; + + if (c[1] > hi) + hi = c[1]; + if (c[2] > hi) + hi = c[2]; + if (c[1] < lo) + lo = c[1]; + if (c[2] < lo) + lo = c[2]; + return hi - lo; +} + +static const struct sp_palette * +find_palette(const char *name) +{ + size_t i; + + for (i = 0; i < sp_palette_count; i++) { + if (strcmp(sp_palettes[i].name, name) == 0) + return &sp_palettes[i]; + } + return NULL; +} + +int +sp_theme_load(const char *name, struct sp_theme *out, struct sp_buf *err) +{ + const struct sp_palette *p; + int order[8], i, j; + int darkest, lightest, second, accent; + int best; + + if (name == NULL || *name == '\0') + name = SP_THEME_DEFAULT; + p = find_palette(name); + if (p == NULL) { + sp_buf_printf(err, "theme: unknown palette '%s' (%zu known)", + name, sp_palette_count); + return -1; + } + + for (i = 0; i < 8; i++) + order[i] = i; + for (i = 1; i < 8; i++) { + int v = order[i]; + + for (j = i - 1; j >= 0 && luma(p->c[order[j]]) > luma(p->c[v]); + j--) + order[j + 1] = order[j]; + order[j + 1] = v; + } + + darkest = order[0]; + lightest = order[7]; + second = order[1]; + + accent = -1; + best = -1; + for (i = 0; i < 8; i++) { + int idx = order[i], s; + + if (idx == darkest || idx == lightest || idx == second) + continue; + s = saturation(p->c[idx]); + if (s > best) { + best = s; + accent = idx; + } + } + if (accent < 0) + accent = lightest; /* a fully grey palette has no accent */ + + memset(out, 0, sizeof(*out)); + out->name = p->name; + memcpy(out->bg, p->c[darkest], 3); + memcpy(out->fg, p->c[lightest], 3); + memcpy(out->border, p->c[second], 3); + memcpy(out->accent, p->c[accent], 3); + for (i = 0; i < 3; i++) + out->status[i] = (unsigned char)(p->c[accent][i] * 2 / 3); + return 0; +} + +size_t +sp_theme_list(const char ***names, size_t *count) +{ + static const char *list[256]; + size_t i, n = 0; + + for (i = 0; i < sp_palette_count && n < 256; i++) + list[n++] = sp_palettes[i].name; + *names = list; + *count = n; + return n; +} + +short +sp_color_rgb(unsigned char r, unsigned char g, unsigned char b, short colors) +{ + static const unsigned char base[16][3] = { + { 0, 0, 0}, {128, 0, 0}, { 0, 128, 0}, {128, 128, 0}, + { 0, 0, 128}, {128, 0, 128}, { 0, 128, 128}, {192, 192, 192}, + {128, 128, 128}, {255, 0, 0}, { 0, 255, 0}, {255, 255, 0}, + { 0, 0, 255}, {255, 0, 255}, { 0, 255, 255}, {255, 255, 255} + }; + static const int level[6] = { 0, 95, 135, 175, 215, 255 }; + int i, best = 0, bestd = 1 << 30; + + if (colors >= 256) { + int ri = 0, gi = 0, bi = 0, dr, dg, db; + + for (i = 1; i < 6; i++) { + if (r >= level[i]) + ri = i; + } + for (i = 1; i < 6; i++) { + if (g >= level[i]) + gi = i; + } + for (i = 1; i < 6; i++) { + if (b >= level[i]) + bi = i; + } + dr = r - level[ri]; + dg = g - level[gi]; + db = b - level[bi]; + if (dr * dr + dg * dg + db * db > 3 * 32 * 32) { + /* closer to a grey than to a cube corner: use the ramp */ + int grey = (r + g + b) / 3; + int gi2 = (grey - 8) / 10; + + if (gi2 < 0) + gi2 = 0; + if (gi2 > 23) + gi2 = 23; + return (short)(232 + gi2); + } + return (short)(16 + 36 * ri + 6 * gi + bi); + } + + for (i = 0; i < (colors >= 16 ? 16 : 8); i++) { + int dr = r - base[i][0], dg = g - base[i][1], db = b - base[i][2]; + int d = dr * dr + dg * dg + db * db; + + if (d < bestd) { + bestd = d; + best = i; + } + } + return (short)best; +} diff --git a/src/theme.h b/src/theme.h new file mode 100644 index 0000000..073edbd --- /dev/null +++ b/src/theme.h @@ -0,0 +1,47 @@ +/* + * splinter -- CDE palettes as terminal themes. + * + * Copyright (c) 2026 Konrad Lother + * SPDX-License-Identifier: BSD-3-Clause + * + * A CDE palette is eight colour sets, not a set of named roles. Roles are + * therefore derived, not looked up, and the derivation is stated so it can be + * checked: + * + * background darkest of the eight + * foreground lightest of the eight + * border second darkest + * accent the most saturated of the remaining six + * status the accent, darkened by a third (a bar has to read as a bar) + * + * The default palette is Delphinium, the CDE desktop default. + */ +#ifndef SPLINTER_THEME_H +#define SPLINTER_THEME_H + +#include + +#include "splinter.h" + +struct sp_theme { + const char *name; + unsigned char bg[3]; + unsigned char fg[3]; + unsigned char border[3]; + unsigned char accent[3]; + unsigned char status[3]; +}; + +#define SP_THEME_DEFAULT "Delphinium" + +/* Load a palette by name; NULL selects the default. Returns 0 or -1. */ +int sp_theme_load(const char *name, struct sp_theme *out, struct sp_buf *err); + +/* List palette names, alphabetical. Returns the number written. */ +size_t sp_theme_list(const char ***names, size_t *count); + +/* Nearest xterm colour index for an RGB triple, for `colors` palette entries. */ +short sp_color_rgb(unsigned char r, unsigned char g, unsigned char b, + short colors); + +#endif /* SPLINTER_THEME_H */ diff --git a/src/ui.c b/src/ui.c new file mode 100644 index 0000000..0e0c813 --- /dev/null +++ b/src/ui.c @@ -0,0 +1,361 @@ +/* + * splinter -- curses chat interface. + * + * Copyright (c) 2026 Konrad Lother + * SPDX-License-Identifier: BSD-3-Clause + * + * Layout, fixed and deliberate: + * + * +---------------------------------+------------+ + * | history | sidebar | + * | three quarters | one quarter| + * +---------------------------------+------------+ + * | status bar | + * +----------------------------------------------+ + * + * Only the UI thread ever calls into curses. Anything that wants to appear in + * the sidebar hands over finished text and never touches a WINDOW. + * + * Redraws happen when something changed -- after a turn, after a key -- so an + * idle splinter burns no CPU. + * + * Keys: Enter sends, Ctrl-L redraws, Ctrl-C drops the input line, Ctrl-D quits. + */ +#include +#include +#include +#include + +#include "splinter.h" +#include "theme.h" +#include "ui.h" + +#define MAX_ENTRIES 512 + +struct entry { + char *role; + char *text; +}; + +struct ui_state { + struct entry entries[MAX_ENTRIES]; + size_t n; + long last_ms; + size_t last_steps; + size_t last_calls; + const char *endpoint; + int quit; + struct sp_theme theme; +}; + +static WINDOW *ui_hist; +static WINDOW *ui_side; +static WINDOW *ui_input; +static WINDOW *ui_status; + +enum { + PAIR_MAIN = 1, /* fg on bg */ + PAIR_ACCENT, /* accent on bg */ + PAIR_DIM, /* border on bg */ + PAIR_STATUS /* bg on status */ +}; + +static void +init_colors(const struct sp_theme *t) +{ + short n = (short)(COLORS > 0 ? COLORS : 8); + + if (!has_colors()) + return; + start_color(); + use_default_colors(); + init_pair(PAIR_MAIN, sp_color_rgb(t->fg[0], t->fg[1], t->fg[2], n), + sp_color_rgb(t->bg[0], t->bg[1], t->bg[2], n)); + init_pair(PAIR_ACCENT, sp_color_rgb(t->accent[0], t->accent[1], + t->accent[2], n), sp_color_rgb(t->bg[0], t->bg[1], t->bg[2], n)); + init_pair(PAIR_DIM, sp_color_rgb(t->border[0], t->border[1], + t->border[2], n), sp_color_rgb(t->bg[0], t->bg[1], t->bg[2], n)); + init_pair(PAIR_STATUS, sp_color_rgb(t->bg[0], t->bg[1], t->bg[2], n), + sp_color_rgb(t->status[0], t->status[1], t->status[2], n)); +} + +static int +entry_height(int width, size_t len) +{ + if (width < 2) + return 1; + return (int)((len + (size_t)width - 1) / (size_t)width); +} + +static void +draw_history(struct ui_state *s) +{ + int rows, cols, y = 0; + size_t idx, start, used = 0; + + getmaxyx(ui_hist, rows, cols); + werase(ui_hist); + + /* the newest entries that fit, then painted top-down */ + start = s->n; + for (idx = s->n; idx > 0; idx--) { + const struct entry *e = &s->entries[idx - 1]; + size_t need = (size_t)entry_height(cols, + strlen(e->role) + strlen(e->text) + 2); + + if (used + need > (size_t)rows) + break; + used += need; + start = idx - 1; + } + + for (idx = start; idx < s->n && y >= 0 && y < rows; idx++) { + const struct entry *e = &s->entries[idx]; + int ny, nx; + + wmove(ui_hist, y, 0); + if (strcmp(e->role, "you") == 0) + wattron(ui_hist, COLOR_PAIR(PAIR_ACCENT) | A_BOLD); + else if (strcmp(e->role, "agent") == 0) + wattron(ui_hist, COLOR_PAIR(PAIR_MAIN)); + else if (strcmp(e->role, "error") == 0) + wattron(ui_hist, COLOR_PAIR(PAIR_ACCENT) | A_BOLD); + else + wattron(ui_hist, COLOR_PAIR(PAIR_DIM)); + waddstr(ui_hist, e->role); + wattroff(ui_hist, A_BOLD); + waddstr(ui_hist, ": "); + waddnstr(ui_hist, e->text, rows * cols); + wattrset(ui_hist, A_NORMAL); + getyx(ui_hist, ny, nx); + y = nx == 0 ? ny : ny + 1; + } + wnoutrefresh(ui_hist); +} + +static void +sidebar_heading(int *y, int cols, const char *text) +{ + wattron(ui_side, COLOR_PAIR(PAIR_DIM) | A_BOLD); + mvwaddnstr(ui_side, *y, 0, text, cols - 1); + wattroff(ui_side, A_BOLD); + (*y)++; + wattron(ui_side, COLOR_PAIR(PAIR_MAIN)); +} + +static void +draw_sidebar(struct ui_state *s, const char *id, const char *dir) +{ + int cols, y = 0; + + cols = getmaxx(ui_side); + werase(ui_side); + + sidebar_heading(&y, cols, "session"); + mvwaddnstr(ui_side, y++, 0, id != NULL ? id : "-", cols - 1); + if (dir != NULL) + mvwaddnstr(ui_side, y++, 0, dir, cols - 1); + y++; + + sidebar_heading(&y, cols, "transport"); + mvwaddnstr(ui_side, y++, 0, s->endpoint != NULL ? s->endpoint : "script", + cols - 1); + y++; + + sidebar_heading(&y, cols, "theme"); + wattron(ui_side, COLOR_PAIR(PAIR_ACCENT)); + mvwaddnstr(ui_side, y++, 0, s->theme.name, cols - 1); + wattron(ui_side, COLOR_PAIR(PAIR_MAIN)); + y++; + + sidebar_heading(&y, cols, "last turn"); + mvwprintw(ui_side, y++, 0, "%ld ms", s->last_ms); + mvwprintw(ui_side, y++, 0, "%zu steps", s->last_steps); + mvwprintw(ui_side, y++, 0, "%zu tool calls", s->last_calls); + y++; + + sidebar_heading(&y, cols, "widgets"); + wattron(ui_side, COLOR_PAIR(PAIR_DIM)); + mvwaddnstr(ui_side, y, 0, "none loaded", cols - 1); + wattrset(ui_side, A_NORMAL); + wnoutrefresh(ui_side); +} + +static void +draw_status(struct ui_state *s) +{ + int cols = getmaxx(ui_status); + + werase(ui_status); + wattron(ui_status, COLOR_PAIR(PAIR_STATUS)); + mvwhline(ui_status, 0, 0, ' ', cols); + mvwaddnstr(ui_status, 0, 1, "splinter " SP_VERSION, cols - 2); + { + char right[96]; + + snprintf(right, sizeof(right), "%s %ldms ", s->theme.name, + s->last_ms); + if ((int)strlen(right) + 1 < cols) + mvwaddnstr(ui_status, 0, cols - (int)strlen(right) - 1, + right, cols - 1); + } + wattroff(ui_status, COLOR_PAIR(PAIR_STATUS)); + wnoutrefresh(ui_status); +} + +static void +add_entry(struct ui_state *s, const char *role, const char *text) +{ + struct entry *e; + + if (s->n == MAX_ENTRIES) { + free(s->entries[0].role); + free(s->entries[0].text); + memmove(&s->entries[0], &s->entries[1], + sizeof(s->entries[0]) * (MAX_ENTRIES - 1)); + s->n--; + } + e = &s->entries[s->n++]; + e->role = strdup(role); + e->text = strdup(text != NULL ? text : ""); +} + +static void +layout(void) +{ + int rows, cols, chat_w, side_w; + + getmaxyx(stdscr, rows, cols); + chat_w = cols * 3 / 4; + if (cols - chat_w < 12) + chat_w = cols > 24 ? cols - 16 : cols; + side_w = cols - chat_w; + ui_hist = newwin(rows - 2, chat_w, 0, 0); + ui_side = newwin(rows - 2, side_w, 0, chat_w); + ui_input = newwin(1, cols, rows - 2, 0); + ui_status = newwin(1, cols, rows - 1, 0); + keypad(ui_input, TRUE); +} + +int +sp_ui_run(struct sp_agent *ag, const char *endpoint, const char *theme_name) +{ + struct ui_state s; + struct sp_buf answer = { 0 }, err = { 0 }; + char input[1024]; + int rc = 0; + + memset(&s, 0, sizeof(s)); + s.endpoint = endpoint; + if (sp_buf_init(&answer) != 0 || sp_buf_init(&err) != 0) + return 1; + if (sp_theme_load(theme_name, &s.theme, &err) != 0) { + fprintf(stderr, "splinter: %s\n", + err.p != NULL ? err.p : "theme"); + return 1; + } + + initscr(); + cbreak(); + noecho(); + keypad(stdscr, TRUE); + curs_set(1); + init_colors(&s.theme); + layout(); + + add_entry(&s, "splinter", "ready. Enter sends, Ctrl-D quits."); + + for (;;) { + struct timespec t0, t1; + int ch; + + draw_history(&s); + draw_sidebar(&s, ag->sess != NULL ? ag->sess->id : NULL, + ag->sess != NULL ? ag->sess->dir : NULL); + draw_status(&s); + werase(ui_input); + mvwaddstr(ui_input, 0, 0, "> "); + wnoutrefresh(ui_input); + doupdate(); + + { + size_t len = 0; + + wmove(ui_input, 0, 2); + wrefresh(ui_input); + for (;;) { + ch = wgetch(ui_input); + if (ch == '\n' || ch == '\r' || ch == KEY_ENTER) + break; + if (ch == 4) { + s.quit = 1; + break; + } + if (ch == 12) + break; + if (ch == 3) { + len = 0; + werase(ui_input); + mvwaddstr(ui_input, 0, 0, "> "); + wrefresh(ui_input); + continue; + } + if (ch == KEY_BACKSPACE || ch == 127 || ch == 8) { + if (len > 0) { + len--; + mvwaddch(ui_input, 0, + (int)len + 2, ' '); + wmove(ui_input, 0, + (int)len + 2); + wrefresh(ui_input); + } + continue; + } + if (ch >= 32 && ch < 127 && + len < sizeof(input) - 1) { + input[len++] = (char)ch; + waddch(ui_input, (chtype)ch); + wrefresh(ui_input); + } + } + input[len] = '\0'; + } + + if (s.quit) + break; + if (input[0] == '\0') + continue; + + add_entry(&s, "you", input); + draw_history(&s); + draw_sidebar(&s, ag->sess != NULL ? ag->sess->id : NULL, + ag->sess != NULL ? ag->sess->dir : NULL); + draw_status(&s); + werase(ui_input); + mvwaddstr(ui_input, 0, 0, " working..."); + wrefresh(ui_input); + doupdate(); + + sp_buf_clear(&answer); + sp_buf_clear(&err); + clock_gettime(CLOCK_MONOTONIC, &t0); + rc = sp_agent_run(ag, input, &answer, &err); + clock_gettime(CLOCK_MONOTONIC, &t1); + + s.last_ms = (long)((t1.tv_sec - t0.tv_sec) * 1000 + + (t1.tv_nsec - t0.tv_nsec) / 1000000); + s.last_steps = ag->stats.steps; + s.last_calls = ag->stats.tool_calls; + + if (rc == 0) + add_entry(&s, "agent", answer.p); + else + add_entry(&s, "error", err.p != NULL ? err.p : + "turn failed"); + } + + endwin(); + sp_buf_free(&answer); + sp_buf_free(&err); + return rc; +} diff --git a/src/ui.h b/src/ui.h new file mode 100644 index 0000000..6ee22f6 --- /dev/null +++ b/src/ui.h @@ -0,0 +1,14 @@ +/* splinter -- curses chat interface entry point. */ +#ifndef SPLINTER_UI_H +#define SPLINTER_UI_H + +#include "splinter.h" + +/* + * Run the interactive chat loop until the user quits. `theme_name` is a CDE + * palette name; NULL selects the default. Returns 0 on a clean quit. + */ +int sp_ui_run(struct sp_agent *ag, const char *endpoint, + const char *theme_name); + +#endif /* SPLINTER_UI_H */ diff --git a/tests/test_theme b/tests/test_theme new file mode 100755 index 0000000..a12012d Binary files /dev/null and b/tests/test_theme differ diff --git a/tests/test_theme.c b/tests/test_theme.c new file mode 100644 index 0000000..b4d9117 --- /dev/null +++ b/tests/test_theme.c @@ -0,0 +1,76 @@ +/* splinter -- CDE theme derivation tests. */ +#include +#include + +#include "theme.h" +#include "palettes.h" + +static int failures; + +#define CHECK(cond) do { \ + if (!(cond)) { \ + fprintf(stderr, "FAIL %s:%d: %s\n", __FILE__, __LINE__, #cond); \ + failures++; \ + } \ +} while (0) + +static int +luma(const unsigned char *c) +{ + return 299 * c[0] + 587 * c[1] + 114 * c[2]; +} + +int +main(void) +{ + struct sp_theme t, t2; + struct sp_buf err; + const char **names; + size_t count, i; + int seen_delphinium = 0; + + if (sp_buf_init(&err) != 0) + return 1; + + /* every palette in the CDE tree is present, and sorted by name */ + CHECK(sp_theme_list(&names, &count) == count); + CHECK(count == sp_palette_count); + CHECK(count >= 40); + for (i = 1; i < count; i++) + CHECK(strcmp(names[i - 1], names[i]) < 0); + + /* the default is Delphinium, and NULL means the default */ + CHECK(sp_theme_load(NULL, &t, &err) == 0); + CHECK(strcmp(t.name, SP_THEME_DEFAULT) == 0); + CHECK(strcmp(t.name, "Delphinium") == 0); + CHECK(sp_theme_load("Delphinium", &t2, &err) == 0); + CHECK(memcmp(&t, &t2, sizeof(t)) == 0); + + /* roles are derived by luminance, so bg is darker than fg in every one */ + for (i = 0; i < count; i++) { + CHECK(sp_theme_load(names[i], &t, &err) == 0); + CHECK(luma(t.bg) <= luma(t.fg)); + CHECK(luma(t.border) >= luma(t.bg)); + CHECK(luma(t.status) <= luma(t.accent)); + } + (void)seen_delphinium; + + /* an unknown palette is an error, never a silent fallback */ + sp_buf_clear(&err); + CHECK(sp_theme_load("NoSuchPalette", &t, &err) == -1); + CHECK(strstr(err.p, "unknown palette") != NULL); + + /* colour mapping stays inside the terminal's palette */ + CHECK(sp_color_rgb(0, 0, 0, 256) >= 16); + CHECK(sp_color_rgb(0, 0, 0, 256) <= 255); + CHECK(sp_color_rgb(255, 255, 255, 256) >= 16); + CHECK(sp_color_rgb(255, 255, 255, 256) <= 255); + CHECK(sp_color_rgb(0, 0, 0, 8) >= 0 && sp_color_rgb(0, 0, 0, 8) < 8); + CHECK(sp_color_rgb(255, 255, 255, 16) >= 0); + CHECK(sp_color_rgb(255, 255, 255, 16) < 16); + + sp_buf_free(&err); + if (failures == 0) + printf("test_theme: ok (%zu palettes)\n", count); + return failures == 0 ? 0 : 1; +} diff --git a/tools/genpalettes.py b/tools/genpalettes.py new file mode 100644 index 0000000..90f226d --- /dev/null +++ b/tools/genpalettes.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python3 +"""Turn CDE palette files (*.dp) into a C table for splinter. + +A CDE palette file holds eight colours, one per line, in the order the desktop +numbers its colour sets. Two encodings occur in the CDE tree: + + #RRRRGGGGBBBB 16 bits per channel, 48 bits total + Black / White a colour name (only four files use this) + +Both are handled. Anything that is neither is a hard error: a palette that +silently turns grey hides a broken file, and the palette is what the user sees +first. + +Usage: genpalettes.py > palettes.c +""" +import os +import re +import sys + +NAMED = { + "black": (0, 0, 0), + "white": (255, 255, 255), +} + +HEX48 = re.compile(r"^#([0-9a-fA-F]{12})$") + + +def parse_line(text: str, path: str, lineno: int): + tok = text.strip() + if not tok: + return None + m = HEX48.match(tok) + if m: + v = m.group(1) + return tuple(int(v[i:i + 4], 16) >> 8 for i in (0, 4, 8)) + low = tok.lower() + if low in NAMED: + return NAMED[low] + raise SystemExit("%s:%d: neither #RRRRGGGGBBBB nor a known name: %r" + % (path, lineno, tok)) + + +def load(path: str): + out = [] + with open(path, "r", encoding="utf-8") as fh: + for lineno, line in enumerate(fh, 1): + rgb = parse_line(line, path, lineno) + if rgb is not None: + out.append(rgb) + if len(out) != 8: + raise SystemExit("%s: %d colours, expected 8" % (path, len(out))) + return out + + +def main() -> int: + if len(sys.argv) != 2: + raise SystemExit(__doc__) + src = sys.argv[1] + names = sorted(f[:-3] for f in os.listdir(src) if f.endswith(".dp")) + if not names: + raise SystemExit("%s: no .dp files" % src) + + w = sys.stdout.write + w("/*\n" + " * Generated by tools/genpalettes.py from the CDE palette files.\n" + " * Do not edit by hand: change the .dp source or the generator.\n" + " */\n" + "#include \"palettes.h\"\n\n" + "const struct sp_palette sp_palettes[] = {\n") + for name in names: + cols = load(os.path.join(src, name + ".dp")) + body = ", ".join("{0x%02x,0x%02x,0x%02x}" % c for c in cols) + w("\t{ \"%s\", { %s } },\n" % (name, body)) + w("};\n\n" + "const size_t sp_palette_count = " + "sizeof(sp_palettes) / sizeof(sp_palettes[0]);\n") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/vendor/netbsd-curses/.gitignore b/vendor/netbsd-curses/.gitignore new file mode 100644 index 0000000..def5f05 --- /dev/null +++ b/vendor/netbsd-curses/.gitignore @@ -0,0 +1,19 @@ +*.o +*.lo +*.ho +*.so +*.a +*.xz +infocmp/infocmp +tabs/tabs +nbperf/nbperf +tic/tic +tic/host_tic +tic/hash.c +tput/tput +tset/tset +config.mak +terminfo/terminfo.cdb +libterminfo/compiled_terms.c +libterminfo/termcap_hash.c +libterminfo/hash.c diff --git a/vendor/netbsd-curses/COPYING b/vendor/netbsd-curses/COPYING new file mode 100644 index 0000000..698c105 --- /dev/null +++ b/vendor/netbsd-curses/COPYING @@ -0,0 +1,54 @@ +Copyright (c) 1980-1994 +The Regents of the University of California. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Copyright (c) 1999-2016 The NetBSD Foundation, Inc. +Copyright (c) 2016 other Contributors. +All rights reserved. + +This code is derived from software contributed to The NetBSD Foundation +by Roy Marples. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/netbsd-curses/GNUmakefile b/vendor/netbsd-curses/GNUmakefile new file mode 100644 index 0000000..d302ce1 --- /dev/null +++ b/vendor/netbsd-curses/GNUmakefile @@ -0,0 +1,569 @@ +HOSTCC ?= $(CC) +AWK ?= awk +AR ?= ar +RANLIB ?= ranlib +HOST_SH ?= /bin/sh +LN ?= ln +INSTALL ?= ./install.sh +MKDIR ?= mkdir + +SO_SUFFIX ?= .so + +PIC = -fPIC + +PREFIX=/usr/local +BINDIR=$(PREFIX)/bin +LIBDIR=$(PREFIX)/lib +INCDIR=$(PREFIX)/include +MANDIR=$(PREFIX)/share/man +MAN1DIR=$(MANDIR)/man1 +MAN3DIR=$(MANDIR)/man3 + +-include config.mak + +ifneq ($(HOSTCC),$(CC)) +CROSSCOMPILING=1 +else +CROSSCOMPILING=0 +CFLAGS_HOST=$(CFLAGS) +endif + +ifneq (,$(findstring $(PIC),$(CFLAGS))) +#CFLAGS contains -fPIC, so we can use the same obj files for dyn/static lib +ALLPIC=1 +else +ALLPIC=0 +endif + +ifneq (,$(findstring -static,$(LDFLAGS))) +#LDFLAGS contains -static, so the user wants to build static binaries +STATIC_BINS=1 +else +STATIC_BINS=0 +endif + +CFLAGS+=-Werror-implicit-function-declaration +CPPFLAGS+= -I. -I./libterminfo + +TOOL_NBPERF= nbperf/nbperf +NBPERF_SRCS= nbperf/nbperf.c +NBPERF_SRCS+= nbperf/nbperf-bdz.c nbperf/nbperf-chm.c nbperf/nbperf-chm3.c +NBPERF_SRCS+= nbperf/graph2.c nbperf/graph3.c +NBPERF_SRCS+= nbperf/mi_vector_hash.c +NBPERF_OBJS= $(NBPERF_SRCS:.c=.o) + +TOOL_HOSTTIC=tic/host_tic +TOOL_TTIC=tic/tic +TIC_SRCS=tic/tic.c +TIC_SRCS+=tic/cdbw.c tic/mi_vector_hash.c tic/compile.c tic/hash.c +CLEANFILES+=tic/hash.c +TIC_OBJS=$(TIC_SRCS:.c=.o) +TIC_HOBJS=$(TIC_SRCS:.c=.ho) +TOOL_TIC=$(TOOL_HOSTTIC) +TIC_MAN=$(sort $(wildcard tic/*.1)) + +tic/compile.o: CPPFLAGS+= -DTERMINFO_COMPILE -DTERMINFO_DB -DTERMINFO_COMPAT + +TI_SRCS= libterminfo/term.c libterminfo/ti.c libterminfo/setupterm.c \ + libterminfo/curterm.c libterminfo/tparm.c libterminfo/tputs.c +TI_SRCS+=libterminfo/compile.c libterminfo/hash.c +TI_SRCS+=libterminfo/cdbr.c +TI_SRCS+=libterminfo/mi_vector_hash.c +# Build in termcap emulation +TI_SRCS+=libterminfo/termcap.c +TI_LIBA=libterminfo/libterminfo.a +TI_LIBSO=libterminfo/libterminfo$(SO_SUFFIX) +TI_OBJS=$(TI_SRCS:.c=.o) +TI_LOBJS=$(TI_SRCS:.c=.lo) +TI_MAN =$(sort $(wildcard libterminfo/*.3)) + +libterminfo/term.o: CPPFLAGS+=-DINSTALL_PREFIX=\"$(PREFIX)\" -DTERMINFO_COMPILE -DTERMINFO_DB -DTERMINFO_COMPAT +libterminfo/term.lo: CPPFLAGS+=-DINSTALL_PREFIX=\"$(PREFIX)\" -DTERMINFO_COMPILE -DTERMINFO_DB -DTERMINFO_COMPAT +libterminfo/compile.o: CPPFLAGS+= -DTERMINFO_COMPILE -DTERMINFO_DB -DTERMINFO_COMPAT +libterminfo/compile.lo: CPPFLAGS+= -DTERMINFO_COMPILE -DTERMINFO_DB -DTERMINFO_COMPAT +libterminfo/termcap.o: CPPFLAGS+= -DTERMINFO_COMPILE -DTERMINFO_DB -DTERMINFO_COMPAT +libterminfo/termcap.lo: CPPFLAGS+= -DTERMINFO_COMPILE -DTERMINFO_DB -DTERMINFO_COMPAT + +CU_SRCS_=acs.c addbytes.c addch.c addchnstr.c addnstr.c attributes.c \ + background.c bell.c border.c box.c chgat.c clear.c clearok.c \ + clrtobot.c clrtoeol.c color.c copywin.c cr_put.c \ + ctrace.c cur_hash.c curs_set.c \ + curses.c delch.c deleteln.c delwin.c echochar.c erase.c fileio.c \ + flushok.c fullname.c getch.c getstr.c getyx.c id_subwins.c idlok.c \ + idcok.c inch.c inchstr.c initscr.c insch.c insdelln.c insertln.c \ + instr.c keypad.c keyname.c leaveok.c line.c meta.c move.c \ + mvwin.c newwin.c nodelay.c notimeout.c overlay.c overwrite.c pause.c \ + printw.c putchar.c refresh.c resize.c scanw.c screen.c scroll.c \ + scrollok.c setterm.c standout.c timeout.c toucholap.c touchwin.c \ + tstp.c tty.c unctrl.c underscore.c immedok.c syncok.c ripoffline.c \ + slk.c version.c mouse.c + + +ifndef DISABLE_WCHAR +CPPFLAGS+=-DHAVE_WCHAR +CU_SRCS_+= cchar.c add_wch.c add_wchstr.c addwstr.c echo_wchar.c ins_wch.c \ + insstr.c ins_wstr.c get_wch.c get_wstr.c in_wch.c in_wchstr.c \ + inwstr.c +else +CPPFLAGS+=-DDISABLE_WCHAR +endif + +CU_SRCS=$(patsubst %,libcurses/%,$(CU_SRCS_)) +CU_INCS=libcurses/curses.h libcurses/unctrl.h +CU_OBJS=$(CU_SRCS:.c=.o) +CU_LIBA=libcurses/libcurses.a +CU_LIBSO=libcurses/libcurses$(SO_SUFFIX) +CU_LOBJS=$(CU_SRCS:.c=.lo) +CU_MAN =$(sort $(wildcard libcurses/*.3)) + +PA_SRCS_ = _deck.c above.c below.c bottom.c del.c getuser.c hidden.c +PA_SRCS_+= hide.c move.c new.c replace.c setuser.c show.c top.c +PA_SRCS_+= update.c window.c +PA_SRCS=$(patsubst %,libpanel/%,$(PA_SRCS_)) +PA_INCS=libpanel/panel.h +PA_OBJS=$(PA_SRCS:.c=.o) +PA_LIBA=libpanel/libpanel.a +PA_LIBSO=libpanel/libpanel$(SO_SUFFIX) +PA_LOBJS=$(PA_SRCS:.c=.lo) +PA_MAN =$(sort $(wildcard libpanel/*.3)) + +ME_SRCS_=menu.c item.c userptr.c internals.c driver.c post.c attributes.c +ME_MAN = $(sort $(wildcard libmenu/*.3)) +ME_SRCS=$(patsubst %,libmenu/%,$(ME_SRCS_)) +ME_INCS=libmenu/menu.h libmenu/eti.h +ME_OBJS=$(ME_SRCS:.c=.o) +ME_LIBA=libmenu/libmenu.a +ME_LIBSO=libmenu/libmenu$(SO_SUFFIX) +ME_LOBJS=$(ME_SRCS:.c=.lo) + +FO_SRCS_=driver.c field_types.c internals.c field.c form.c post.c type_alnum.c \ + type_alpha.c type_integer.c type_numeric.c type_enum.c type_regex.c \ + type_ipv4.c type_ipv6.c +FO_MAN= $(sort $(wildcard libform/*.3)) +FO_SRCS=$(patsubst %,libform/%,$(FO_SRCS_)) +FO_INCS=libform/form.h +FO_OBJS=$(FO_SRCS:.c=.o) +FO_LIBA=libform/libform.a +FO_LIBSO=libform/libform$(SO_SUFFIX) +FO_LOBJS=$(FO_SRCS:.c=.lo) + +TS_SRCS_=map.c misc.c set.c term.c tset.c +TS_SRCS=$(patsubst %,tset/%,$(TS_SRCS_)) +TS_OBJS=$(TS_SRCS:.c=.o) +TS_MAN= $(sort $(wildcard tset/*.1)) + +TP_SRCS=tput/tput.c +TP_OBJS=tput/tput.o +TP_MAN =$(sort $(wildcard tput/*.1)) + +IC_SRCS=infocmp/infocmp.c +IC_OBJS=infocmp/infocmp.o +IC_MAN =$(sort $(wildcard infocmp/*.1)) + +TA_SRCS=tabs/tabs.c +TA_OBJS=tabs/tabs.o +TA_MAN =$(sort $(wildcard tabs/*.1)) + +STALIBS=$(TI_LIBA) $(CU_LIBA) $(PA_LIBA) $(ME_LIBA) $(FO_LIBA) +DYNLIBS=$(TI_LIBSO) $(CU_LIBSO) $(PA_LIBSO) $(ME_LIBSO) $(FO_LIBSO) +PROGS=$(TOOL_TTIC) tset/tset tput/tput infocmp/infocmp tabs/tabs + +ifeq ($(STATIC_BINS),0) +TI_LINKLIB=$(TI_LIBSO) +else +TI_LINKLIB=$(TI_LIBA) +endif + +all: $(STALIBS) $(DYNLIBS) $(PROGS) + +all-static: $(STALIBS) $(PROGS) + +all-dynamic: $(DYNLIBS) $(PROGS) + +install-tic: $(TOOL_TTIC) + $(INSTALL) -Dm 755 $(TOOL_TTIC) $(DESTDIR)$(BINDIR)/tic + +install-tset: tset/tset + $(INSTALL) -Dm 755 tset/tset $(DESTDIR)$(BINDIR)/tset + $(LN) -sf $(notdir $<) $(DESTDIR)$(BINDIR)/reset + +install-tput: tput/tput tput/clear.sh + $(INSTALL) -Dm 755 tput/tput $(DESTDIR)$(BINDIR)/tput + $(INSTALL) -Dm 755 tput/clear.sh $(DESTDIR)$(BINDIR)/clear + +install-infocmp: infocmp/infocmp + $(INSTALL) -Dm 755 infocmp/infocmp $(DESTDIR)$(BINDIR)/infocmp + +install-tabs: tabs/tabs + $(INSTALL) -Dm 755 tabs/tabs $(DESTDIR)$(BINDIR)/tabs + +install-progs: install-tic install-tset install-tput install-infocmp install-tabs + +install-headers-curses: libcurses/curses.h libcurses/unctrl.h + $(INSTALL) -Dm 644 libcurses/curses.h $(DESTDIR)$(INCDIR)/curses.h + $(INSTALL) -Dm 644 libcurses/unctrl.h $(DESTDIR)$(INCDIR)/unctrl.h + $(LN) -sf curses.h $(DESTDIR)$(INCDIR)/ncurses.h + +install-headers-terminfo: libterminfo/term.h libterminfo/termcap.h + $(INSTALL) -Dm 644 libterminfo/term.h $(DESTDIR)$(INCDIR)/term.h + $(INSTALL) -Dm 644 libterminfo/termcap.h $(DESTDIR)$(INCDIR)/termcap.h + +install-headers-panel: libpanel/panel.h + $(INSTALL) -Dm 644 libpanel/panel.h $(DESTDIR)$(INCDIR)/panel.h + +install-headers-menu: libmenu/menu.h libmenu/eti.h + $(INSTALL) -Dm 644 libmenu/menu.h $(DESTDIR)$(INCDIR)/menu.h + $(INSTALL) -Dm 644 libmenu/eti.h $(DESTDIR)$(INCDIR)/eti.h + +install-headers-form: libform/form.h + $(INSTALL) -Dm 644 libform/form.h $(DESTDIR)$(INCDIR)/form.h + +install-headers: install-headers-terminfo install-headers-curses install-headers-panel install-headers-menu install-headers-form + +install-stalib-curses: $(CU_LIBA) + $(INSTALL) -Dm 644 $< $(DESTDIR)$(LIBDIR)/$(notdir $<) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/libncurses.a + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/libncursesw.a + +install-stalib-terminfo: $(TI_LIBA) + $(INSTALL) -Dm 644 $< $(DESTDIR)$(LIBDIR)/$(notdir $<) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/libtermcap.a + +install-stalib-panel: $(PA_LIBA) + $(INSTALL) -Dm 644 $< $(DESTDIR)$(LIBDIR)/$(notdir $<) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/$(basename $(notdir $<))w.a + +install-stalib-menu: $(ME_LIBA) + $(INSTALL) -Dm 644 $< $(DESTDIR)$(LIBDIR)/$(notdir $<) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/$(basename $(notdir $<))w.a + +install-stalib-form: $(FO_LIBA) + $(INSTALL) -Dm 644 $< $(DESTDIR)$(LIBDIR)/$(notdir $<) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/$(basename $(notdir $<))w.a + +install-stalibs: install-stalib-terminfo install-stalib-curses install-stalib-panel install-stalib-menu install-stalib-form + +install-dynlib-curses: $(CU_LIBSO) + $(INSTALL) -Dm 644 $< $(DESTDIR)$(LIBDIR)/$(notdir $<) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/libncurses$(SO_SUFFIX) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/libncursesw$(SO_SUFFIX) + +install-dynlib-terminfo: $(TI_LIBSO) + $(INSTALL) -Dm 644 $< $(DESTDIR)$(LIBDIR)/$(notdir $<) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/libtermcap$(SO_SUFFIX) + +install-dynlib-panel: $(PA_LIBSO) + $(INSTALL) -Dm 644 $< $(DESTDIR)$(LIBDIR)/$(notdir $<) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/$(basename $(notdir $<))w$(SO_SUFFIX) + +install-dynlib-menu: $(ME_LIBSO) + $(INSTALL) -Dm 644 $< $(DESTDIR)$(LIBDIR)/$(notdir $<) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/$(basename $(notdir $<))w$(SO_SUFFIX) + +install-dynlib-form: $(FO_LIBSO) + $(INSTALL) -Dm 644 $< $(DESTDIR)$(LIBDIR)/$(notdir $<) + $(LN) -sf $(notdir $<) $(DESTDIR)$(LIBDIR)/$(basename $(notdir $<))w$(SO_SUFFIX) + +install-dynlibs: install-dynlib-terminfo install-dynlib-curses install-dynlib-panel install-dynlib-menu install-dynlib-form +install-libs: install-stalibs install-dynlibs + +install-pc-dir: + $(MKDIR) -p $(DESTDIR)$(LIBDIR)/pkgconfig + +install-pc-curses: install-pc-dir + ./genpc curses "curses terminal library" "-lcurses -lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/curses.pc + ./genpc ncurses "ncurses terminal library" "-lncurses -lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/ncurses.pc + ./genpc ncursesw "ncurses terminal library" "-lncurses -lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/ncursesw.pc + +install-pc-terminfo: install-pc-dir + ./genpc terminfo "terminfo library" "-lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/terminfo.pc + ./genpc termcap "termcap library" "-lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/termcap.pc + +install-pc-panel: install-pc-dir + ./genpc panel "curses panel library" "-lpanel -lcurses -lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/panel.pc + ./genpc panelw "curses panel library" "-lpanel -lncurses -lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/panelw.pc + +install-pc-menu: install-pc-dir + ./genpc menu "curses menu library" "-lmenu -lcurses -lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/menu.pc + ./genpc menuw "curses menu library" "-lmenu -lcurses -lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/menuw.pc + +install-pc-form: install-pc-dir + ./genpc form "curses form library" "-lform -lcurses -lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/form.pc + ./genpc formw "curses form library" "-lform -lcurses -lterminfo" > $(DESTDIR)$(LIBDIR)/pkgconfig/formw.pc + +install-pcs: install-pc-form install-pc-menu install-pc-panel install-pc-terminfo install-pc-curses + +INSTALL_MANPAGES_COMMAND=test -L $< && $(INSTALL) -Dl `readlink $<` $@ || $(INSTALL) -Dm 644 $< $@ + +$(DESTDIR)$(MAN1DIR)/%: tic/% + $(INSTALL_MANPAGES_COMMAND) +$(DESTDIR)$(MAN1DIR)/%: tset/% + $(INSTALL_MANPAGES_COMMAND) +$(DESTDIR)$(MAN1DIR)/%: tput/% + $(INSTALL_MANPAGES_COMMAND) +$(DESTDIR)$(MAN1DIR)/%: infocmp/% + $(INSTALL_MANPAGES_COMMAND) +$(DESTDIR)$(MAN1DIR)/%: tabs/% + $(INSTALL_MANPAGES_COMMAND) + +$(DESTDIR)$(MAN3DIR)/%: libterminfo/% + $(INSTALL_MANPAGES_COMMAND) +$(DESTDIR)$(MAN3DIR)/%: libcurses/% + $(INSTALL_MANPAGES_COMMAND) +$(DESTDIR)$(MAN3DIR)/%: libpanel/% + $(INSTALL_MANPAGES_COMMAND) +$(DESTDIR)$(MAN3DIR)/%: libmenu/% + $(INSTALL_MANPAGES_COMMAND) +$(DESTDIR)$(MAN3DIR)/%: libform/% + $(INSTALL_MANPAGES_COMMAND) + +install-man-tic: $(TIC_MAN:tic/%=$(DESTDIR)$(MAN1DIR)/%) +install-man-tset: $(TS_MAN:tset/%=$(DESTDIR)$(MAN1DIR)/%) +install-man-tput: $(TP_MAN:tput/%=$(DESTDIR)$(MAN1DIR)/%) +install-man-infocmp: $(IC_MAN:infocmp/%=$(DESTDIR)$(MAN1DIR)/%) +install-man-tabs: $(TA_MAN:tabs/%=$(DESTDIR)$(MAN1DIR)/%) + +install-prog-manpages: install-man-tic install-man-tset install-man-tput \ + install-man-infocmp install-man-tabs + +install-man-terminfo: $(TI_MAN:libterminfo/%=$(DESTDIR)$(MAN3DIR)/%) +install-man-curses: $(CU_MAN:libcurses/%=$(DESTDIR)$(MAN3DIR)/%) +install-man-panel: $(PA_MAN:libpanel/%=$(DESTDIR)$(MAN3DIR)/%) +install-man-menu: $(ME_MAN:libmenu/%=$(DESTDIR)$(MAN3DIR)/%) +install-man-form: $(FO_MAN:libform/%=$(DESTDIR)$(MAN3DIR)/%) + +install-lib-manpages: install-man-terminfo install-man-curses \ + install-man-panel install-man-menu install-man-form + +install-manpages: install-prog-manpages install-lib-manpages + +install: install-headers install-libs install-progs install-pcs install-manpages + +install-static: install-headers install-progs install-pcs install-stalibs +install-dynamic: TI_LINKLIB=$(TI_LIBSO) +install-dynamic: install-headers install-progs install-pcs install-dynlibs + +# TODO: gen (if necessary) and install manpages + +clean: + rm -f $(NBPERF_OBJS) $(TOOL_NBPERF) $(TIC_OBJS) $(TIC_HOBJS) \ + $(TOOL_TTIC) $(TOOL_TIC) $(CLEANFILES) $(TI_LIBA) \ + $(CU_LIBA) $(TI_OBJS) $(CU_OBJS) $(CU_LOBJS) $(TI_LOBJS) \ + $(CU_LIBSO) $(TI_LIBSO) \ + $(PA_LIBA) $(PA_LIBSO) $(PA_OBJS) $(PA_LOBJS) \ + $(ME_LIBA) $(ME_LIBSO) $(ME_OBJS) $(ME_LOBJS) \ + $(FO_LIBA) $(FO_LIBSO) $(FO_OBJS) $(FO_LOBJS) \ + $(TS_OBJS) tset/tset $(TP_OBJS) tput/tput \ + $(IC_OBJS) infocmp/infocmp $(TA_OBJS) tabs/tabs + +$(TOOL_NBPERF): $(NBPERF_OBJS) + $(HOSTCC) $(LDFLAGS_HOST) $^ -o $@ + +tset/tset: $(TI_LINKLIB) +tset/tset: $(TS_OBJS) + $(CC) -o $@ $^ $(LDFLAGS) + +tput/tput: $(TI_LINKLIB) +tput/tput: $(TP_OBJS) + $(CC) -o $@ $^ $(LDFLAGS) + +infocmp/infocmp: $(TI_LINKLIB) +infocmp/infocmp: $(IC_OBJS) + $(CC) -o $@ $^ $(LDFLAGS) + +tabs/tabs: $(TI_LINKLIB) +tabs/tabs: $(TA_OBJS) + $(CC) -o $@ $^ $(LDFLAGS) + +tset/%.o: tset/%.c + $(CC) $(CPPFLAGS) -I./tset -I. -I./libterminfo $(CFLAGS) -c -o $@ $< +tput/%.o: tput/%.c + $(CC) $(CPPFLAGS) -I./tset -I. -I./libterminfo $(CFLAGS) -c -o $@ $< +infocmp/%.o: infocmp/%.c + $(CC) $(CPPFLAGS) -I. -I./libterminfo $(CFLAGS) -c -o $@ $< +tabs/%.o: tabs/%.c + $(CC) $(CPPFLAGS) -I. -I./libterminfo $(CFLAGS) -c -o $@ $< +nbperf/%.o: nbperf/%.c + $(HOSTCC) $(CPPFLAGS) -O0 -g0 $(CFLAGS_HOST) -c -o $@ $< + +ifeq ($(CROSSCOMPILING),0) +tic/%.ho: tic/%.o + $(LN) -sf $(notdir $<) $@ + +$(TOOL_HOSTTIC): $(TOOL_TTIC) + $(LN) -sf $(notdir $<) $@ +else +tic/%.ho: tic/%.c + $(HOSTCC) $(CPPFLAGS) -I./tic -O0 -g0 $(CFLAGS_HOST) -c -o $@ $< + +$(TOOL_HOSTTIC): $(TIC_HOBJS) + $(HOSTCC) $(LDFLAGS_HOST) $^ -o $@ +endif + +tic/%.o: tic/%.c + $(CC) $(CPPFLAGS) -I./tic $(CFLAGS) -c -o $@ $< + +libcurses/%.o: libcurses/%.c + $(CC) $(CPPFLAGS) -I./libcurses $(CFLAGS) -c -o $@ $< + +libterminfo/%.o: libterminfo/%.c + $(CC) $(CPPFLAGS) -I./libcurses $(CFLAGS) -c -o $@ $< + +libmenu/%.o: libmenu/%.c + $(CC) $(CPPFLAGS) -I./libcurses -I./libmenu $(CFLAGS) -c -o $@ $< + +libpanel/%.o: libpanel/%.c + $(CC) $(CPPFLAGS) -I./libcurses -I./libpanel $(CFLAGS) -c -o $@ $< + +libform/%.o: libform/%.c + $(CC) $(CPPFLAGS) -I./libcurses -I./libmenu -I./libform $(CFLAGS) -c -o $@ $< + +ifeq ($(ALLPIC),1) + +$(CU_LOBJS): $(CU_OBJS) +libcurses/%.lo: libcurses/%.o + $(LN) -sf $(notdir $<) $@ + +$(TI_LOBJS): $(TI_OBJS) +libterminfo/%.lo: libterminfo/%.o + $(LN) -sf $(notdir $<) $@ + +$(PA_LOBJS): $(PA_OBJS) +libpanel/%.lo: libpanel/%.o + $(LN) -sf $(notdir $<) $@ + +$(ME_LOBJS): $(ME_OBJS) +libmenu/%.lo: libmenu/%.o + $(LN) -sf $(notdir $<) $@ + +$(FO_LOBJS): $(FO_OBJS) +libform/%.lo: libform/%.o + $(LN) -sf $(notdir $<) $@ +else +libcurses/%.lo: libcurses/%.c + $(CC) $(CPPFLAGS) -I./libcurses $(CFLAGS) $(PIC) -c -o $@ $< + +libterminfo/%.lo: libterminfo/%.c + $(CC) $(CPPFLAGS) -I./libcurses $(CFLAGS) $(PIC) -c -o $@ $< + +libpanel/%.lo: libpanel/%.c + $(CC) $(CPPFLAGS) -I./libcurses -I./libpanel $(CFLAGS) $(PIC) -c -o $@ $< + +libmenu/%.lo: libmenu/%.c + $(CC) $(CPPFLAGS) -I./libcurses -I./libmenu $(CFLAGS) $(PIC) -c -o $@ $< + +libform/%.lo: libform/%.c + $(CC) $(CPPFLAGS) -I./libcurses -I./libmenu -I./libform $(CFLAGS) $(PIC) -c -o $@ $< +endif + +tic/hash.c: libterminfo/hash.c + cp libterminfo/hash.c tic/hash.c + +$(TOOL_TTIC): $(TIC_OBJS) + $(CC) $(LDFLAGS) $^ -o $@ + +TERMINFODIR=./terminfo +SCRIPT_ENV= \ + TERMINFODIR=$(TERMINFODIR) \ + TOOL_AWK=awk \ + TOOL_NBPERF=$(TOOL_NBPERF) \ + TOOL_SED=sed \ + TOOL_SORT=sort \ + TOOL_TIC=$(TOOL_TIC) + +$(TI_LIBA): $(TI_OBJS) + rm -f $@ + $(AR) crs $@ $^ + $(RANLIB) $@ + +$(TI_LIBSO): $(TI_LOBJS) + $(CC) -shared -o $@ $^ -Wl,-soname=$(notdir $@) + +libterminfo/hash.c: libterminfo/genhash libterminfo/term.h + @echo "Generating terminfo hash" + $(SCRIPT_ENV) $(HOST_SH) $^ > $@ + +libterminfo/termcap_hash.c: libterminfo/genthash libterminfo/termcap_map.c + @echo "Generating termcap hash" + ${SCRIPT_ENV} ${HOST_SH} $^ > $@ + +# Allow terminfo descriptions to be compiled into libterminfo +libterminfo/compiled_terms.c: libterminfo/genterms libterminfo/term.h ${TERMINFODIR}/terminfo + @echo "Generating compiled terminfo descriptions" + ${SCRIPT_ENV} ${HOST_SH} $^ > $@ + +libterminfo/hash.c: $(TOOL_NBPERF) +libterminfo/termcap_hash.c: $(TOOL_NBPERF) +libterminfo/compiled_terms.c: $(TOOL_TIC) +libterminfo/term.c: libterminfo/compiled_terms.c +libterminfo/term.o: libterminfo/compiled_terms.c +libterminfo/termcap.c: libterminfo/termcap_hash.c + +CLEANFILES+=libterminfo/hash.c libterminfo/termcap_hash.c \ + libterminfo/compiled_terms.c + +# Generate our man pages +#terminfo.5: genman terminfo.5.in term.h termcap_map.c +# @echo "Generating terminfo man pages" +# ${SCRIPT_ENV} ${HOST_SH} $^ > $@ + +$(CU_LIBA): $(CU_OBJS) + rm -f $@ + $(AR) crs $@ $^ + $(RANLIB) $@ + +$(CU_LIBSO): $(TI_LIBSO) +$(CU_LIBSO): $(CU_LOBJS) + $(CC) -shared -o $@ $^ -Wl,-soname=$(notdir $@) + +libcurses/fileio.h: libcurses/shlib_version libcurses/genfileioh.awk + $(AWK) -f ./genfileioh.awk < ./shlib_version > ./fileio.h + +$(PA_LIBA): $(PA_OBJS) + rm -f $@ + $(AR) crs $@ $^ + $(RANLIB) $@ + +$(PA_LIBSO): $(CU_LIBSO) +$(PA_LIBSO): $(PA_LOBJS) + $(CC) -shared -o $@ $^ -Wl,-soname=$(notdir $@) + +$(ME_LIBA): $(ME_OBJS) + rm -f $@ + $(AR) crs $@ $^ + $(RANLIB) $@ + +$(ME_LIBSO): $(CU_LIBSO) +$(ME_LIBSO): $(ME_LOBJS) + $(CC) -shared -o $@ $^ -Wl,-soname=$(notdir $@) + +$(FO_LIBA): $(FO_OBJS) + rm -f $@ + $(AR) crs $@ $^ + $(RANLIB) $@ + +$(FO_LIBSO): $(CU_LIBSO) +$(FO_LIBSO): $(FO_LOBJS) + $(CC) -shared -o $@ $^ -Wl,-soname=$(notdir $@) + +# Allow terminfo descriptions to be compiled into libterminfo +${TERMINFODIR}/terminfo.cdb: $(TOOL_TIC) ${TERMINFODIR}/terminfo + @echo "Generating compiled terminfo database" + $^ + +.PHONY: all all-static all-dynamic install install-tic install-tset \ + install-tput install-infocmp install-tabs install-progs \ + install-headers-curses install-headers-terminfo \ + install-headers-panel install-headers-menu install-headers-form \ + install-headers install-stalib-curses install-stalib-terminfo \ + install-stalib-panel install-stalib-menu install-stalib-form \ + install-stalibs install-dynlib-curses install-dynlib-terminfo \ + install-dynlib-panel install-dynlib-menu install-dynlib-form \ + install-dynlibs install-libs install-pc-dir install-pc-curses \ + install-pc-terminfo install-pc-panel install-pc-menu \ + install-pc-form install-pcs install-static install-dynamic clean \ + install-man-tic install-man-tset install-man-tput \ + install-man-infocmp install-man-tabs install-prog-manpages \ + install-man-terminfo install-man-curses install-man-panel \ + install-man-menu install-man-form install-lib-manpages \ + install-manpages diff --git a/vendor/netbsd-curses/PROVENANCE.md b/vendor/netbsd-curses/PROVENANCE.md new file mode 100644 index 0000000..3a31234 --- /dev/null +++ b/vendor/netbsd-curses/PROVENANCE.md @@ -0,0 +1,27 @@ +# vendor/netbsd-curses — provenance + +**What this is.** NetBSD's curses and terminfo implementation, ported to Linux +and other POSIX systems ("netbsd-libcurses portable edition"). Wide-character +capable, close to a drop-in replacement for ncurses. + +**Where it came from.** `https://github.com/sabotage-linux/netbsd-curses`, +vendored on 2026-11-07 from the copy already in use at +`~/src/matriks/src/curses/netbsd-curses` (the same tree OpenITT planned to use +for its client layer). + +**What was removed and why.** Compiled objects (`*.o`, `*.lo`), shared objects +(`*.so`) and static archives (`*.a`) were left out: they are build output, they +carry the build machine's paths, and a checked-in binary is a binary nobody can +audit. `make` in `splinter/` rebuilds them. + +**How it is built.** The vendored tree ships a `GNUmakefile`, so this one +directory needs GNU make; `splinter`'s own `Makefile` stays POSIX make. The +target `$(CURSES_A)` in `splinter/Makefile` is the only place that crosses over. + +**License.** NetBSD's BSD-2-Clause-style COPYING is kept verbatim at +`vendor/netbsd-curses/COPYING`. Nothing here was modified. + +**Why it is vendored at all.** The alternative is ncurses, which is a different +implementation with different behaviour on redraw and wide characters. Using +NetBSD's curses keeps the terminal behaviour identical to the NetBSD tools this +machine already runs, and removes a system dependency from the build. diff --git a/vendor/netbsd-curses/README.md b/vendor/netbsd-curses/README.md new file mode 100644 index 0000000..d6a46d1 --- /dev/null +++ b/vendor/netbsd-curses/README.md @@ -0,0 +1,218 @@ +netbsd-libcurses portable edition +================================= + +this is a port of netbsd's curses library for usage on Linux systems +(tested and developed on sabotage linux, based on musl libc). +It should be possible to use on other POSIX platforms as well with minor +changes. + +it supports widechar (like the ncursesw build variant) and is close to being +a 100% feature-complete drop-in replacement for ncurses. + +to this date, there are only 3 implementations of the curses API: + +- the ubiquitous ncurses library, which is used on almost every UNIX system + (Linux, Mac OS X, FreeBSD, OpenBSD and others). +- netbsd curses, previously used on netbsd only. +- pdcurses, targetting the windows terminal, SDL and X11 (unusable on UNIX + terminals). + +Why do we need an ncurses replacement ? +--------------------------------------- +- Competition is good. +- Ncurses is one of the most used libraries in the linux ecosystem and + therefore it's usually one of the first libraries built in a source-based + distro. + There's basically no way around it, unless you're building a single-purpose + appliance. +- Readability/Hacking. + even though ncurses is free software, it is very hard to change its source + code: + - extremely complicated build process with several layers of preprocessing + using tools like awk, sed and the output of the C preprocessor with reliance + on implementation details, [as shown by the recent breakage when distros + updated to GCC 5][0]. + - heavy use of macros, making the code hard to read. + - very much code (bloat). +- Usability. + the default configuration of ncurses is usually not what one wants, and it + features several dozens of configure options to customize the build, + for example making it split up in several smaller libraries, with or without + widechar support, etc. + + this makes it hard to guess which files to link against and which headers to + use when building a package against ncurses. + `-lncurses`? `-lncursesw -lterminfo -ltic`? `curses.h`? `ncurses/ncursesw.h`? + this filename chaos [is often fixed in a distro-specific manner][1]. + + to accomodate for this, ncurses ships its own config tool ncurses(w)5-config + instead of a standardized pkg-config description file (disabled by default) + to query the necessary CFLAGS and LDFLAGS. + unfortunately like every other homebrewed pkg-config replacement, this config + utility was designed without cross-compilation in mind, so many packages + using ncurses and autoconf fail to cross-compile when unpatched. +- Size and build time. + +Table 1: Comparison between ncurses and netbsd curses +----------------------------------------------------- +| | NCURSES | NETBSD CURSES | +|:----------------------------|:------------:|:-------------:| +| Size of extracted source | 15.8 MB | 3.3 MB | +| Installed size | 15.9 MB | 1.3 MB | +| Installed size w/debuginfo | 128.3 MB | 19.9 MB | +| Build time (make -j2) | 59 sec | 9 sec | +| size of libncursesw.so | 346 KB | 150 KB | +| size of static linked nano | 334 KB | 288 KB | + + + when scaling up to more build jobs, it is expected that netbsd curses fares a + lot better since its Makefile is fully parallelizable, while ncurses spends a + lot of time in a single process executing the configure script. + +Differences from ncurses +------------------------ +- the structures used differ. some programs access ncurses structure members directly, + they must be patched to use a portable approach. +- mouse handling is lacking. ncurses mouse handling routines are provided as no-op + macros, so software using it builds without having to patch it. +- some rarely used functions like vidputs() are missing. users must be patched. +- the terminfo database is compiled (via tic) into a binary database in CDB format. +- "only" 510 color pairs are supported. +- some functionality like tgetent() lives in libterminfo rather than in libcurses. + it may be necessary to add -lterminfo to LDFLAGS for packages using those functions. + +TODO +---- +- installation of global terminfo db + (rather than just a small built-in, handpicked set) + +Compilation +----------- +netbsd-curses ships without a configure script, and requires GNU make. +variables for compilation can be passed directly to make, or be saved into config.mak. +recognized variables are: + +- CC - the C compiler +- HOSTCC - the C compiler used for host programs when crosscompiling. + if set, and different from CC, cross-compilation is assumed. +- CFLAGS - flags for the compiler +- CPPFLAGS - flags for the preprocessor +- LDFLAGS - flags for the linker +- PREFIX - filesystem prefix used for hardcoded paths and installation +- DESTDIR - staging directory for installation + +examples: + + make CFLAGS="-Os -Wall -fPIC" PREFIX=/usr/local -j4 all install + make CFLAGS=-O2 LDFLAGS=-static PREFIX=/usr all-static install-static + +example config.mak: + + CFLAGS = -O3 -Wall + PREFIX = /usr + DESTDIR = foo + +if you're using config.mak, you can just run `make && make install` and the +variables will be picked up automatically. + +the `all` and `install` Makefile targets will build/install all programs, +shared and static libs, and headers. +the `all-static` and `install-static` targets will build/install all programs, +static libs, and headers. +the `all-dynamic` and `install-dynamic` targets will build/install all programs +shared libs, and headers. + +the `all` build can be sped up by putting `-fPIC` in CFLAGS. +this has the effect that the same object files will be used for the dynamic and +static libs; otherwise they will be compiled twice with different CFLAGS. + +Compiled-in terminal database +----------------------------- +support for about a dozen common TERMs is built-in already. if you need one +that's not included, you can either add yours to `libterminfo/genterms` or +`make terminfo/terminfo.cdb` and install the result to either +`$PREFIX/share/terminfo.cdb` or `$HOME/.terminfo.cdb`. + +Compiling software against netbsd-curses +---------------------------------------- +the functionality that ncurses offers is usually (if not configured to split +into several separate libs) available in a single `libncurses` library. +netbsd-curses on the other hand has it always split into `libcurses` and +`libterminfo`. +this difference requires to give the build system a hint that it needs to +link to both libcurses and libterminfo. + +- programs using pkg-config(1) automatically get the right options + due to the supplied .pc files. + +- for autoconf based software (using a configure script) it is usually + sufficient to invoke configure like this: + + LIBS="-lcurses -lterminfo" ./configure ... + +- for Makefile-only based build systems, it should be sufficient to add + the libs to LDFLAGS: + + make LDFLAGS="-lcurses -lterminfo" ... + +with these instructions it is easy to compile the majority of ncurses apps +without problems against netbsd-curses. + +a small percentage of apps written for ncurses poke at internals and need +light patching: + +- [patch for midnight commander][2] - merged upstream as rev 38d4c655d +- [patch for python 2.7.x and 3.6][3] + +if you have trouble compiling a specific package, first look at the +[sabotage linux build recipes][4]. +if you still can't get the package to compile, feel free to open an issue +[at the netbsd-curses issue tracker][5]. + +License +------- +libcurses, tset and tput are (C) 1980-1994 +"The Regents of the University of California" licensed under the 3-clause BSD +license. +Everything else is (C) 1999-2016 The NetBSD Foundation, Inc. and Contributors, +licensed under the 2-clause BSD license. +see COPYING for the full text, and in doubt, consult the copyright clauses in +the respective .c files. Files without copyright clauses in the file header +are explicitly released under the terms of the 2-clause BSD license as well. + + +APPENDIX A: Test Setup used for comparison in Table 1 +----------------------------------------------------- +All tests were done on a dual core x86_64 sabotage linux system, with the following +features: +installation of shared and static libs, headers, etc, +i.e. make -j2 all install. +ncurses and netbsd curses were both configured with support for widechars, and +built-in terminfo database for a handful of terminals. + + CFLAGS (optimized for size): + -g0 -fdata-sections -ffunction-sections -Os -fno-unwind-tables + -fno-asynchronous-unwind-tables -Wa,--noexecstack + + LDFLAGS: + -s -Wl,--gc-sections -Wl,-z,relro,-z,now + +netbsd curses was installed without manpages (ncurses: 1.1 MB) and terminfo +database (ncurses: 6.4MB). +the debug info build was created with -g3 and debuginfo stripped into external +files via objcopy. + +APPENDIX B: History of NetBSD curses +------------------------------------ + +Thomas Dickey did a [thorough investigation][6] on the history of NetBSD curses. + + +[0]:http://trac.sagemath.org/ticket/18301 +[1]:https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/log/scripts/kconfig/lxdialog/check-lxdialog.sh +[2]:https://github.com/MidnightCommander/mc/commit/38d4c655d322837574e957b4a824f4a0d1bb3b86 +[3]:https://github.com/sabotage-linux/sabotage/blob/06a4a815/KEEP/python2710-curses.patch +[4]:https://github.com/sabotage-linux/sabotage/tree/master/pkg +[5]:https://github.com/sabotage-linux/netbsd-curses/issues +[6]:http://invisible-island.net/ncurses/ncurses-netbsd.html + diff --git a/vendor/netbsd-curses/genpc b/vendor/netbsd-curses/genpc new file mode 100755 index 0000000..d10e567 --- /dev/null +++ b/vendor/netbsd-curses/genpc @@ -0,0 +1,10 @@ +#!/bin/sh +cat << EOF +Name: $1 +Description: $2 +Version: 5.9 +Requires: +Conflicts: +Libs: $3 +Cflags: +EOF diff --git a/vendor/netbsd-curses/infocmp/Makefile b/vendor/netbsd-curses/infocmp/Makefile new file mode 100644 index 0000000..d0bffbf --- /dev/null +++ b/vendor/netbsd-curses/infocmp/Makefile @@ -0,0 +1,9 @@ +# $NetBSD: Makefile,v 1.2 2013/08/11 06:48:46 dholland Exp $ + +PROG= infocmp + +CPPFLAGS+= -I${.CURDIR}/../../lib/libterminfo +LDADD+= -lterminfo +DPADD+= ${LIBTERMINFO} + +.include diff --git a/vendor/netbsd-curses/infocmp/infocmp.1 b/vendor/netbsd-curses/infocmp/infocmp.1 new file mode 100644 index 0000000..9f4d10b --- /dev/null +++ b/vendor/netbsd-curses/infocmp/infocmp.1 @@ -0,0 +1,131 @@ +.\" $NetBSD: infocmp.1,v 1.7 2014/03/18 18:20:45 riastradh Exp $ +.\" +.\" Copyright (c) 2009 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Roy Marples. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd February 5, 2010 +.Dt INFOCMP 1 +.Os +.Sh NAME +.Nm infocmp +.Nd compare or print compiled terminfo descriptions +.Sh SYNOPSIS +.Nm infocmp +.Op Fl 1acnqux +.Op Fl A Ar database +.Op Fl B Ar database +.Op Fl w Ar cols +.Op Ar term ... +.Sh DESCRIPTION +The +.Nm +reconstructs the first available +.Xr terminfo 5 +definition found for +.Ar term +and prints the result in a +.Xr terminfo 5 +format. +Capability types are grouped together and new types start new lines, +first flags, then numbers, then strings. +Capabilities are sorted by their name. +If a second +.Ar term +is given then the capabilities are compared against each other. +.Pp +The following options are available: +.Bl -tag -width Ev +.It Fl 1 +Print one capability per line. +.It Fl A Ar database +Use this database to load the first terminal definition. +.It Fl B Ar database +Use this database to load subsequent terminal definitions. +.It Fl a +Include commented out capabilities. +This only works if the database was compiled with the +.Fl a +flag passed to +.Xr tic 1 . +This also sets the +.Fl x +flag as +.Nm +retains commented out capabilities as non standard. +.It Fl c +Print capabilities common to each definition. +.It Fl n +Print capabilities that do not exist in either definition. +.It Fl q +Make the comparison listing shorter by omitting subheadings and using +- for absent capabilities, @ for canceled capabilities rather than +.Dv NULL . +.It Fl u +Build a new terminal description for the first terminal description, +using subsequent terminal descriptions. +This also sets the +.Fl a +flag. +.It Fl w Ar cols +Limit the width to +.Ar cols . +.It Fl x +Include non-standard capabilities. +More +.Fl x +only handles non-standard capabilities. +This only works if the database was compiled with the +.Fl x +flag passed to +.Xr tic 1 . +.El +.Sh ENVIRONMENT +.Bl -tag -width Ev +.It Ev COLUMNS +Override columns returned by the output terminal. +.Fl w +.Ar cols +supersedes this. +.It Ev TERM +.Nm +uses the contents of the +.Ev TERM +environment variable if no terminal name is given on the command line. +.El +.Sh EXIT STATUS +.Ex -std infocmp +.Sh SEE ALSO +.Xr tic 1 , +.Xr terminfo 5 +.Sh STANDARDS +The +.Nm +utility outputs information that conforms to the +.St -xcurses4.2 +standard. +.Sh AUTHORS +.An Roy Marples Aq Mt roy@NetBSD.org diff --git a/vendor/netbsd-curses/infocmp/infocmp.c b/vendor/netbsd-curses/infocmp/infocmp.c new file mode 100644 index 0000000..21e073c --- /dev/null +++ b/vendor/netbsd-curses/infocmp/infocmp.c @@ -0,0 +1,809 @@ +/* $NetBSD: infocmp.c,v 1.17 2020/03/31 12:44:15 roy Exp $ */ + +/* + * Copyright (c) 2009, 2010, 2020 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define SW 8 + +typedef struct tient { + char type; + const char *id; + signed char flag; + int num; + const char *str; +} TIENT; + +static size_t cols; +static int aflag, cflag, nflag, qflag, xflag; + +static size_t +outstr(FILE *f, const char *str) +{ + unsigned char ch; + size_t r, l; + + r = 0; + l = strlen(str); + while ((ch = (unsigned char)(*str++)) != '\0') { + switch (ch) { + case 128: + ch = '0'; + break; + case '\033': + ch = 'E'; + break; + case '\014': + ch = 'f'; + break; + case '^': /* FALLTHROUGH */ + case ',': /* escape these */ + break; + case ' ': + ch = 's'; + break; + default: + if (ch == '\177') { + if (f != NULL) + fputc('^', f); + ch = '?'; + r++; + } else if (iscntrl(ch) && + ch < 128 && + ch != '\\' && + (l < 4 || isdigit((unsigned char)*str))) + { + if (f != NULL) + fputc('^', f); + ch += '@'; + r++; + } else if (!isprint(ch)) { + if (f != NULL) + fprintf(f, "\\%03o", ch); + r += 4; + continue; + } + goto prnt; + } + + if (f != NULL) + fputc('\\', f); + r++; +prnt: + if (f != NULL) + fputc(ch, f); + r++; + } + return r; +} + +static int +ent_compare(const void *a, const void *b) +{ + const TIENT *ta, *tb; + + ta = (const TIENT *)a; + tb = (const TIENT *)b; + return strcmp(ta->id, tb->id); +} + +static void +setdb(char *db) +{ + static const char *ext[] = { ".cdb", ".db" }; + + for (size_t i = 0; i < __arraycount(ext); i++) { + char *ptr = strstr(db, ext[i]); + if (ptr == NULL || ptr[strlen(ext[i])] != '\0') + continue; + *ptr = '\0'; + break; + } + setenv("TERMINFO", db, 1); +} + +static void +print_ent(const TIENT *ents, size_t nents) +{ + size_t col, i, l; + char nbuf[64]; + + if (nents == 0) + return; + + col = SW; + printf("\t"); + for (i = 0; i < nents; i++) { + if (*ents[i].id == '.' && aflag == 0) + continue; + switch (ents[i].type) { + case 'f': + if (ents[i].flag == ABSENT_BOOLEAN) + continue; + l = strlen(ents[i].id) + 2; + if (ents[i].flag == CANCELLED_BOOLEAN) + l++; + break; + case 'n': + if (ents[i].num == ABSENT_NUMERIC) + continue; + if (VALID_NUMERIC(ents[i].num)) + l = snprintf(nbuf, sizeof(nbuf), "%s#%d,", + ents[i].id, ents[i].num); + else + l = snprintf(nbuf, sizeof(nbuf), "%s@,", + ents[i].id); + break; + case 's': + if (ents[i].str == ABSENT_STRING) + continue; + if (VALID_STRING(ents[i].str)) + l = strlen(ents[i].id) + + outstr(NULL, ents[i].str) + 7; + else + l = strlen(ents[i].id) + 3; + break; + default: + errx(EXIT_FAILURE, "invalid type"); + } + if (col != SW) { + if (col + l > cols) { + printf("\n\t"); + col = SW; + } else + col += printf(" "); + } + switch (ents[i].type) { + case 'f': + col += printf("%s", ents[i].id); + if (ents[i].flag == ABSENT_BOOLEAN || + ents[i].flag == CANCELLED_BOOLEAN) + col += printf("@"); + col += printf(","); + break; + case 'n': + col += printf("%s", nbuf); + break; + case 's': + col += printf("%s", ents[i].id); + if (VALID_STRING(ents[i].str)) { + col += printf("="); + col += outstr(stdout, ents[i].str); + } else + col += printf("@"); + col += printf(","); + break; + } + } + printf("\n"); +} + +static size_t +load_ents(TIENT *ents, TERMINAL *t, char type) +{ + size_t i, n, max; + TERMUSERDEF *ud; + + switch (type) { + case 'f': + max = TIFLAGMAX; + break; + case 'n': + max = TINUMMAX; + break; + default: + max = TISTRMAX; + } + + n = 0; + for (i = 0; i <= max; i++) { + switch (type) { + case 'f': + if (t->flags[i] == 1 || + (aflag && t->flags[i] == CANCELLED_BOOLEAN)) + { + ents[n].id = _ti_flagid(i); + ents[n].type = 'f'; + ents[n++].flag = t->flags[i]; + } + break; + case 'n': + if (VALID_NUMERIC(t->nums[i]) || + (aflag && t->nums[i] == CANCELLED_NUMERIC)) + { + ents[n].id = _ti_numid(i); + ents[n].type = 'n'; + ents[n++].num = t->nums[i]; + } + break; + default: + if (VALID_STRING(t->strs[i]) || + (aflag && t->strs[i] == CANCELLED_STRING)) + { + ents[n].id = _ti_strid(i); + ents[n].type = 's'; + ents[n++].str = t->strs[i]; + } + break; + } + } + + if (xflag != 0 && t->_nuserdefs != 0) { + for (i = 0; i < t->_nuserdefs; i++) { + ud = &t->_userdefs[i]; + if (ud->type == type) { + switch (type) { + case 'f': + if (!aflag && + !VALID_BOOLEAN(ud->flag)) + continue; + break; + case 'n': + if (!aflag && + !VALID_NUMERIC(ud->num)) + continue; + break; + case 's': + if (!aflag && + !VALID_STRING(ud->str)) + continue; + break; + } + ents[n].id = ud->id; + ents[n].type = ud->type; + ents[n].flag = ud->flag; + ents[n].num = ud->num; + ents[n++].str = ud->str; + } + } + } + + qsort(ents, n, sizeof(TIENT), ent_compare); + return n; +} + +static void +cprint_ent(TIENT *ent) +{ + + if (ent == NULL) { + if (qflag == 0) + printf("NULL"); + else + printf("-"); + } + + switch (ent->type) { + case 'f': + if (VALID_BOOLEAN(ent->flag)) + printf(ent->flag == 1 ? "T" : "F"); + else if (qflag == 0) + printf("F"); + else if (ent->flag == CANCELLED_BOOLEAN) + printf("@"); + else + printf("-"); + break; + case 'n': + if (VALID_NUMERIC(ent->num)) + printf("%d", ent->num); + else if (qflag == 0) + printf("NULL"); + else if (ent->num == CANCELLED_NUMERIC) + printf("@"); + else + printf("-"); + break; + case 's': + if (VALID_STRING(ent->str)) { + printf("'"); + outstr(stdout, ent->str); + printf("'"); + } else if (qflag == 0) + printf("NULL"); + else if (ent->str == CANCELLED_STRING) + printf("@"); + else + printf("-"); + break; + } +} + +static void +compare_ents(TIENT *ents1, size_t n1, TIENT *ents2, size_t n2) +{ + size_t i1, i2; + TIENT *e1, *e2, ee; + int c; + + i1 = i2 = 0; + ee.type = 'f'; + ee.flag = ABSENT_BOOLEAN; + ee.num = ABSENT_NUMERIC; + ee.str = ABSENT_STRING; + while (i1 != n1 || i2 != n2) { + if (i1 == n1) + c = 1; + else if (i2 == n2) + c = -1; + else + c = strcmp(ents1[i1].id, ents2[i2].id); + if (c == 0) { + e1 = &ents1[i1++]; + e2 = &ents2[i2++]; + } else if (c < 0) { + e1 = &ents1[i1++]; + e2 = ⅇ + ee.id = e1->id; + ee.type = e1->type; + } else { + e1 = ⅇ + e2 = &ents2[i2++]; + ee.id = e2->id; + ee.type = e2->type; + } + switch (e1->type) { + case 'f': + if (cflag != 0) { + if (e1->flag == e2->flag) + printf("\t%s\n", ents1[i1].id); + continue; + } + if (e1->flag == e2->flag) + continue; + break; + case 'n': + if (cflag != 0) { + if (e1->num == e2->num) + printf("\t%s#%d\n", + ents1[i1].id, ents1[i1].num); + continue; + } + if (e1->num == e2->num) + continue; + break; + case 's': + if (cflag != 0) { + if (VALID_STRING(e1->str) && + VALID_STRING(e2->str) && + strcmp(e1->str, e2->str) == 0) { + printf("\t%s=", ents1[i1].id); + outstr(stdout, ents1[i1].str); + printf("\n"); + } + continue; + } + if (VALID_STRING(e1->str) && + VALID_STRING(e2->str) && + strcmp(e1->str, e2->str) == 0) + continue; + break; + } + printf("\t%s: ", e1->id); + cprint_ent(e1); + if (e1->type == 'f') + printf(":"); + else + printf(", "); + cprint_ent(e2); + printf(".\n"); + } +} + +static TERMINAL * +load_term(const char *name) +{ + TERMINAL *t; + + t = ecalloc(1, sizeof(*t)); + if (name == NULL) + name = getenv("TERM"); + if (name == NULL) + name = "dumb"; + if (_ti_getterm(t, name, 1) == 1) + return t; + + if (_ti_database == NULL) + errx(EXIT_FAILURE, + "no terminal definition found in internal database"); + else + errx(EXIT_FAILURE, + "no terminal definition found in %s.db", _ti_database); +} + +static void +show_missing(TERMINAL *t1, TERMINAL *t2, char type) +{ + ssize_t i, max; + const char *id; + + switch (type) { + case 'f': + max = TIFLAGMAX; + break; + case 'n': + max = TINUMMAX; + break; + default: + max = TISTRMAX; + } + + for (i = 0; i <= max; i++) { + switch (type) { + case 'f': + if (t1->flags[i] != ABSENT_BOOLEAN || + t2->flags[i] != ABSENT_BOOLEAN) + continue; + id = _ti_flagid(i); + break; + case 'n': + if (t1->nums[i] != ABSENT_NUMERIC || + t2->nums[i] != ABSENT_NUMERIC) + continue; + id = _ti_numid(i); + break; + default: + if (t1->strs[i] != ABSENT_STRING || + t2->strs[i] != ABSENT_STRING) + continue; + id = _ti_strid(i); + break; + } + printf("\t!%s.\n", id); + } +} + +static TERMUSERDEF * +find_userdef(TERMINAL *term, const char *id) +{ + size_t i; + + for (i = 0; i < term->_nuserdefs; i++) + if (strcmp(term->_userdefs[i].id, id) == 0) + return &term->_userdefs[i]; + return NULL; +} + +static void +use_terms(TERMINAL *term, size_t nuse, char **uterms) +{ + TERMINAL **terms; + TERMUSERDEF *ud, *tud; + size_t i, j, agree, absent, data; + + terms = ecalloc(nuse, sizeof(*terms)); + for (i = 0; i < nuse; i++) { + if (strcmp(term->name, *uterms) == 0) + errx(EXIT_FAILURE, "cannot use same terminal"); + for (j = 0; j < i; j++) + if (strcmp(terms[j]->name, *uterms) == 0) + errx(EXIT_FAILURE, "cannot use same terminal"); + terms[i] = load_term(*uterms++); + } + + for (i = 0; i < TIFLAGMAX + 1; i++) { + agree = absent = data = 0; + for (j = 0; j < nuse; j++) { + if (terms[j]->flags[i] == ABSENT_BOOLEAN || + terms[j]->flags[i] == CANCELLED_BOOLEAN) + absent++; + else { + data++; + if (term->flags[i] == terms[j]->flags[i]) + agree++; + } + } + if (data == 0) + continue; + if (agree > 0 && agree + absent == nuse) + term->flags[i] = ABSENT_BOOLEAN; + else if (term->flags[i] == ABSENT_BOOLEAN) + term->flags[i] = CANCELLED_BOOLEAN; + } + + for (i = 0; i < TINUMMAX + 1; i++) { + agree = absent = data = 0; + for (j = 0; j < nuse; j++) { + if (terms[j]->nums[i] == ABSENT_NUMERIC || + terms[j]->nums[i] == CANCELLED_NUMERIC) + absent++; + else { + data++; + if (term->nums[i] == terms[j]->nums[i]) + agree++; + } + } + if (data == 0) + continue; + if (agree > 0 && agree + absent == nuse) + term->nums[i] = ABSENT_NUMERIC; + else if (term->nums[i] == ABSENT_NUMERIC) + term->nums[i] = CANCELLED_NUMERIC; + } + + for (i = 0; i < TISTRMAX + 1; i++) { + agree = absent = data = 0; + for (j = 0; j < nuse; j++) { + if (terms[j]->strs[i] == ABSENT_STRING || + terms[j]->strs[i] == CANCELLED_STRING) + absent++; + else { + data++; + if (VALID_STRING(term->strs[i]) && + strcmp(term->strs[i], + terms[j]->strs[i]) == 0) + agree++; + } + } + if (data == 0) + continue; + if (agree > 0 && agree + absent == nuse) + term->strs[i] = ABSENT_STRING; + else if (term->strs[i] == ABSENT_STRING) + term->strs[i] = CANCELLED_STRING; + } + + /* User defined caps are more tricky. + First we set any to absent that agree. */ + for (i = 0; i < term->_nuserdefs; i++) { + agree = absent = data = 0; + ud = &term->_userdefs[i]; + for (j = 0; j < nuse; j++) { + tud = find_userdef(terms[j], ud->id); + if (tud == NULL) + absent++; + else { + data++; + switch (ud->type) { + case 'f': + if (tud->type == 'f' && + tud->flag == ud->flag) + agree++; + break; + case 'n': + if (tud->type == 'n' && + tud->num == ud->num) + agree++; + break; + case 's': + if (tud->type == 's' && + VALID_STRING(tud->str) && + VALID_STRING(ud->str) && + strcmp(ud->str, tud->str) == 0) + agree++; + break; + } + } + } + if (data == 0) + continue; + if (agree > 0 && agree + absent == nuse) { + ud->flag = ABSENT_BOOLEAN; + ud->num = ABSENT_NUMERIC; + ud->str = ABSENT_STRING; + } + } + + /* Now add any that we don't have as cancelled */ + for (i = 0; i < nuse; i++) { + for (j = 0; j < terms[i]->_nuserdefs; j++) { + ud = find_userdef(term, terms[i]->_userdefs[j].id); + if (ud != NULL) + continue; /* We have handled this */ + term->_userdefs = erealloc(term->_userdefs, + sizeof(*term->_userdefs) * (term->_nuserdefs + 1)); + tud = &term->_userdefs[term->_nuserdefs++]; + tud->id = terms[i]->_userdefs[j].id; + tud->type = terms[i]->_userdefs[j].flag; + tud->flag = CANCELLED_BOOLEAN; + tud->num = CANCELLED_NUMERIC; + tud->str = CANCELLED_STRING; + } + } +} + +int +main(int argc, char **argv) +{ + char *term, *Barg; + int ch, uflag; + TERMINAL *t, *t2; + size_t n, n2; + struct winsize ws; + TIENT ents[TISTRMAX + 1], ents2[TISTRMAX + 1]; + + cols = 80; /* default */ + term = getenv("COLUMNS"); + if (term != NULL) + cols = strtoul(term, NULL, 10); + else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == 0) + cols = ws.ws_col; + + uflag = xflag = 0; + Barg = NULL; + while ((ch = getopt(argc, argv, "1A:B:acnquw:x")) != -1) + switch (ch) { + case '1': + cols = 1; + break; + case 'A': + setdb(optarg); + break; + case 'B': + Barg = optarg; + break; + case 'a': + aflag = 1; + break; + case 'c': + cflag = 1; + break; + case 'n': + nflag = 1; + break; + case 'q': + qflag = 1; + break; + case 'u': + uflag = 1; + aflag = 1; + break; + case 'w': + cols = strtoul(optarg, NULL, 10); + break; + case 'x': + xflag = 1; + break; + case '?': + default: + fprintf(stderr, + "usage: %s [-1acnqux] [-A database] [-B database] " + "[-w cols] [term]\n", + argv[0]); + return EXIT_FAILURE; + } + cols--; + + if (optind + 1 < argc) + aflag = 1; + + if (optind < argc) + term = argv[optind++]; + else + term = NULL; + t = load_term(term); + + if (uflag != 0) + use_terms(t, argc - optind, argv + optind); + + if ((optind + 1 != argc && nflag == 0) || uflag != 0) { + if (uflag == 0) + printf("# Reconstructed from %s\n", + _ti_database == NULL ? + "internal database" : _ti_database); + /* Strip internal versioning */ + term = strchr(t->name, TERMINFO_VDELIM); + if (term != NULL) + *term = '\0'; + printf("%s", t->name); + if (t->_alias != NULL) { + char *alias, *aliascpy, *delim; + + alias = aliascpy = estrdup(t->_alias); + while (alias != NULL && *alias != '\0') { + putchar('|'); + delim = strchr(alias, TERMINFO_VDELIM); + if (delim != NULL) + *delim++ = '\0'; + printf("%s", alias); + if (delim != NULL) { + while (*delim != '\0' && *delim != '|') + delim++; + if (*delim == '\0') + alias = NULL; + else + alias = delim + 1; + } else + alias = NULL; + } + free(aliascpy); + } + if (t->desc != NULL && *t->desc != '\0') + printf("|%s", t->desc); + printf(",\n"); + + n = load_ents(ents, t, 'f'); + print_ent(ents, n); + n = load_ents(ents, t, 'n'); + print_ent(ents, n); + n = load_ents(ents, t, 's'); + print_ent(ents, n); + + if (uflag != 0) { + printf("\t"); + n = SW; + for (; optind < argc; optind++) { + n2 = 5 + strlen(argv[optind]); + if (n != SW) { + if (n + n2 > cols) { + printf("\n\t"); + n = SW; + } else + n += printf(" "); + } + n += printf("use=%s,", argv[optind]); + } + printf("\n"); + } + return EXIT_SUCCESS; + } + + if (Barg == NULL) + unsetenv("TERMINFO"); + else + setdb(Barg); + t2 = load_term(argv[optind++]); + printf("comparing %s to %s.\n", t->name, t2->name); + if (qflag == 0) + printf(" comparing booleans.\n"); + if (nflag == 0) { + n = load_ents(ents, t, 'f'); + n2 = load_ents(ents2, t2, 'f'); + compare_ents(ents, n, ents2, n2); + } else + show_missing(t, t2, 'f'); + if (qflag == 0) + printf(" comparing numbers.\n"); + if (nflag == 0) { + n = load_ents(ents, t, 'n'); + n2 = load_ents(ents2, t2, 'n'); + compare_ents(ents, n, ents2, n2); + } else + show_missing(t, t2, 'n'); + if (qflag == 0) + printf(" comparing strings.\n"); + if (nflag == 0) { + n = load_ents(ents, t, 's'); + n2 = load_ents(ents2, t2, 's'); + compare_ents(ents, n, ents2, n2); + } else + show_missing(t, t2, 's'); + return EXIT_SUCCESS; +} diff --git a/vendor/netbsd-curses/install.sh b/vendor/netbsd-curses/install.sh new file mode 100755 index 0000000..d913b60 --- /dev/null +++ b/vendor/netbsd-curses/install.sh @@ -0,0 +1,64 @@ +#!/bin/sh +# +# This is an actually-safe install command which installs the new +# file atomically in the new location, rather than overwriting +# existing files. +# + +usage() { +printf "usage: %s [-D] [-l] [-m mode] src dest\n" "$0" 1>&2 +exit 1 +} + +mkdirp= +symlink= +mode=755 + +while getopts Dlm: name ; do +case "$name" in +D) mkdirp=yes ;; +l) symlink=yes ;; +m) mode=$OPTARG ;; +?) usage ;; +esac +done +shift $(($OPTIND - 1)) + +test "$#" -eq 2 || usage +src=$1 +dst=$2 +tmp="$dst.tmp.$$" + +case "$dst" in +*/) printf "%s: %s ends in /\n", "$0" "$dst" 1>&2 ; exit 1 ;; +esac + +set -C +set -e + +if test "$mkdirp" ; then +umask 022 +case "$2" in +*/*) mkdir -p "${dst%/*}" ;; +esac +fi + +trap 'rm -f "$tmp"' EXIT INT QUIT TERM HUP + +umask 077 + +if test "$symlink" ; then +ln -s "$1" "$tmp" +else +cat < "$1" > "$tmp" +chmod "$mode" "$tmp" +fi + +mv -f "$tmp" "$2" +test -d "$2" && { +rm -f "$2/$tmp" +printf "%s: %s is a directory\n" "$0" "$dst" 1>&2 +exit 1 +} + +exit 0 diff --git a/vendor/netbsd-curses/libcurses/EXAMPLES/Makefile b/vendor/netbsd-curses/libcurses/EXAMPLES/Makefile new file mode 100644 index 0000000..b3759fd --- /dev/null +++ b/vendor/netbsd-curses/libcurses/EXAMPLES/Makefile @@ -0,0 +1,54 @@ +#$Id: Makefile,v 1.2 2007/05/28 15:01:58 blymn Exp $ +#$Log: Makefile,v $ +#Revision 1.2 2007/05/28 15:01:58 blymn +#Merge in wide curses code done as a Summer of Code project by +#Ruibiao Qiu. +# +#Revision 1.1.2.2 2007/01/31 10:08:47 blymn +#Fix up build errors. +# +#Revision 1.1.2.1 2007/01/21 12:05:54 blymn +#Merge wide curses. +# +#Revision 1.1 2007/01/21 11:38:59 blymn +#Wide curses merge +# +#Revision 1.1 2005/08/31 14:52:08 ruibiao +# +#A patach for the current source +# +#Revision 1.2 2005/08/23 21:29:08 ruibiao +# +#Changed to the right libraries +# +#Revision 1.1 2005/08/23 16:38:22 ruibiao +# +#Initial version, to build all versions of file views and the unit tester +# + +RM = /bin/rm -f +CFLAGS = + +.if defined(DEBUG) +CFLAGS+= -g +.endif + +all: wcview nwview ccview tcview ncview ex1 + +wcview: view.c + gcc -DHAVE_WCHAR -o wcview view.c -I.. $(CFLAGS) -lcurses -Wl,-rpath,.. -L.. + +nwview: view.c + gcc -DHAVE_WCHAR -o nwview view.c -DNCURSES -I/usr/pkg/include $(CFLAGS) -lcurses -Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib + +ccview: view.c + gcc -o ccview view.c -I.. $(CFLAGS) -lcurses -Wl,-rpath,.. -L.. + +tcview: view.c + gcc -o tcview view.c -L/usr/lib -Wl,-rpath,/usr/lib $(CFLAGS) -lcurses + +ncview: view.c + gcc -o ncview view.c -I/usr/pkg/include -DNCURSES -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib $(CFLAGS) -lncurses + +ex1: ex1.c + gcc -DHAVE_WCHAR -o ex1 ex1.c -I.. $(CFLAGS) -lcurses -Wl,-rpath,.. -L.. diff --git a/vendor/netbsd-curses/libcurses/EXAMPLES/ex1.c b/vendor/netbsd-curses/libcurses/EXAMPLES/ex1.c new file mode 100644 index 0000000..05b00a5 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/EXAMPLES/ex1.c @@ -0,0 +1,333 @@ +/* $NetBSD: ex1.c,v 1.5 2007/05/28 15:01:58 blymn Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define YSIZE 4 +#define XSIZE 30 + +void quit( int ); + +main() +{ + int i, j, c, n = 0, ac = 0; + size_t len; + char id[100]; + FILE *fp; + char *s; + cchar_t cc, ncc, cstr[ 128 ], icc, icstr[ 128 ], bcc; + int wc_on = 0, wgc_on = 0; + char mbs[] = "´ó"; + char mbstr[] = "´óѧ֮µÀ£¬ÔÚÃ÷Ã÷µÂ£¬ÔÚÇ×Ãñ£¬ÔÚÖ¹ÓÚÖÁÉÆ¡£ (Liji)"; + wchar_t wstr[ 128 ], owstr[ 4 ], gwstr[ 128 ], iwstr[ 128 ]; + int wslen = 0; + wint_t wc; + char nostr[ 128 ]; + attr_t al[ 15 ] = { WA_BLINK, + WA_BOLD, + WA_DIM, + WA_LOW, + WA_TOP, + WA_INVIS, + WA_HORIZONTAL, + WA_VERTICAL, + WA_LEFT, + WA_RIGHT, + WA_PROTECT, + WA_REVERSE, + WA_STANDOUT, + WA_UNDERLINE }; + + fprintf( stderr, "Current locale: %s\n", setlocale(LC_ALL, "")); + if (( wslen = mbstowcs( &cc.vals[ 0 ], mbs, strlen( mbs ))) < 0 ) { + fprintf( stderr, "mbstowcs() failed\n" ); + return -1; + } + fprintf( stderr, "WC string length: %d\n", wslen ); + fprintf( stderr, "WC width: %d\n", wcwidth( cc.vals[ 0 ])); + cc.elements = ncc.elements = 8; + cc.attributes = ncc.attributes = 0; + ncc.vals[ 0 ] = 0xda00; + cc.vals[ 1 ] = ncc.vals[ 1 ] = 0xda01; + cc.vals[ 2 ] = ncc.vals[ 2 ] = 0xda02; + cc.vals[ 3 ] = ncc.vals[ 3 ] = 0xda03; + cc.vals[ 4 ] = ncc.vals[ 4 ] = 0xda04; + cc.vals[ 5 ] = ncc.vals[ 5 ] = 0xda05; + cc.vals[ 6 ] = ncc.vals[ 6 ] = 0xda06; + cc.vals[ 7 ] = ncc.vals[ 7 ] = 0xda07; + + if (( wslen = mbstowcs( wstr, mbstr, strlen( mbstr ))) < 0 ) { + fprintf( stderr, "mbstowcs() failed\n" ); + return -1; + } + + for ( i = 0; i < wslen; i++ ) { + cstr[ i ].vals[ 0 ] = wstr[ i ]; + } + cstr[ wslen ].vals[ 0 ] = 0; + + bcc.elements = 8; + bcc.attributes = 0; + bcc.vals[ 0 ] = L'_'; + bcc.vals[ 1 ] = 0xda01; + bcc.vals[ 2 ] = 0xda02; + bcc.vals[ 3 ] = 0xda03; + bcc.vals[ 4 ] = 0xda04; + bcc.vals[ 5 ] = 0xda05; + bcc.vals[ 6 ] = 0xda06; + bcc.vals[ 7 ] = 0xda07; + + initscr(); /* Always call initscr() first */ + signal(SIGINT, quit); /* Make sure wou have a 'cleanup' fn */ + crmode(); /* We want cbreak mode */ + noecho(); /* We want to have control of chars */ + delwin(stdscr); /* Create our own stdscr */ + stdscr = newwin(YSIZE, XSIZE, 1, 1); + flushok(stdscr, TRUE); /* Enable flushing of stdout */ + scrollok(stdscr, TRUE); /* Enable scrolling */ + erase(); /* Initially, clear the screen */ + + standout(); + move(0,0); + while (1) { + if ( !wgc_on ) { + c = getchar(); + switch(c) { + case 'q': /* Quit on 'q' */ + quit( 0 ); + break; + case 'p': + keypad( stdscr, TRUE ); + break; + case 'P': + keypad( stdscr, FALSE ); + break; + case 'g': + wgc_on = 1; + echo(); + break; + case 'b': + get_wstr( gwstr ); + move( 1, 0 ); + addstr( "Input:" ); + addwstr( gwstr ); + refresh(); + break; + case 'h': + move( 0, 0 ); + in_wch( &icc ); + move( 1, 0 ); + add_wch( &icc ); + refresh(); + break; + case 'y': + move( 0, 0 ); + in_wchstr( icstr ); + move( 1, 0 ); + add_wchstr( icstr ); + refresh(); + break; + case 'u': + move( 0, 0 ); + inwstr( iwstr ); + move( 1, 0 ); + addwstr( iwstr ); + refresh(); + break; + case 'i': + move( 0, 0 ); + hline_set( &cc, 20 ); + move( 0, 0 ); + vline_set( &cc, 20 ); + refresh(); + break; + case 'o': + clrtobot(); + refresh(); + break; + case 's': /* Go into standout mode on 's' */ + standout(); + break; + case 'e': /* Exit standout mode on 'e' */ + standend(); + break; + case 'r': /* Force a refresh on 'r' */ + wrefresh(curscr); + break; + case 'w': /* Turn on/off add_wch() tests */ + wc_on = 1 - wc_on; + break; + case 'd': + add_wchstr(( const cchar_t *)&cstr ); + refresh(); + break; + case 'c': + addwstr(( const wchar_t *)&wstr ); + refresh(); + break; + case 'z': + move( 0, 1 ); + if ( wc_on ) + add_wch( &cc ); + else + addch( c ); + refresh(); + break; + case 'x': + move( 0, 3 ); + if ( wc_on ) + add_wch( &cc ); + else + addch( c ); + refresh(); + break; + case 'n': + add_wch( &ncc ); + refresh(); + break; + case 'm': + //border( 0, 0, 0, 0, 0, 0, 0, 0 ); + border_set( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); + refresh(); + break; + case 'j': + box_set( stdscr, &cc, &cc ); + refresh(); + break; + case 'k': + erase(); + refresh(); + break; + case '1': + move( 0, 0 ); + clrtoeol(); + refresh(); + break; + case '2': + move( 0, 0 ); + sprintf( nostr, "Orig:%x", al[ ac ]); + addstr( nostr ); + ac = ( ac + 1 ) % 16; + bcc.attributes = al[ ac ]; + bkgrnd( &bcc ); + move( 1, 0 ); + sprintf( nostr, "New:%x", al[ ac ]); + //addstr( nostr ); + insstr( nostr ); + refresh(); + break; + case 'v': + if ( wc_on ) + ins_wch( &cc ); + else + insch( c ); + refresh(); + break; + case 'f': + ins_wstr(( const wchar_t *)&wstr ); + refresh(); + break; + case 't': + for ( i = 0; i < 4; i++ ) { + owstr[ i ] = wstr[ i + 5 ]; + wstr[ i + 5 ] = i + 0xda05; + } + ins_wstr(( const wchar_t *)&wstr ); + refresh(); + for ( i = 0; i < 4; i++ ) + wstr[ i + 5 ] = owstr[ i ]; + break; + default: /* By default output the character */ + if ( wc_on ) + add_wch( &cc ); + else { + if ( c < 0x7F ) + addch( c ); + else { + addstr( keyname( c )); + } + } + refresh(); + } + } else { + get_wch( &wc ); + switch ( wc ) { + case L'w': + wgc_on = 0; + noecho(); + break; + case L'q': + quit( 0 ); + break; + case L't': + notimeout( stdscr, TRUE ); + break; + case L'T': + notimeout( stdscr, FALSE ); + break; + case L'd': + nodelay( stdscr, TRUE ); + break; + case L'D': + nodelay( stdscr, FALSE ); + break; + case L'p': + keypad( stdscr, TRUE ); + break; + case L'P': + keypad( stdscr, FALSE ); + break; + default: + break; + } + } + } +} + +void quit( int sig ) +{ + erase(); /* Terminate by erasing the screen */ + refresh(); + endwin(); /* Always end with endwin() */ + delwin(curscr); /* Return storage */ + delwin(stdscr); + putchar('\n'); + exit( sig ); +} + diff --git a/vendor/netbsd-curses/libcurses/EXAMPLES/view.c b/vendor/netbsd-curses/libcurses/EXAMPLES/view.c new file mode 100644 index 0000000..74df2a8 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/EXAMPLES/view.c @@ -0,0 +1,527 @@ +/* + * view.c -- a silly little viewer program + * + * written by Eric S. Raymond December 1994 + * to test the scrolling code in ncurses. + * + * modified by Thomas Dickey July 1995 to demonstrate + * the use of 'resizeterm()', and May 2000 to illustrate wide-character + * handling. + * + * Takes a filename argument. It's a simple file-viewer with various + * scroll-up and scroll-down commands. + * + * n -- scroll one line forward + * p -- scroll one line back + * + * Either command accepts a numeric prefix interpreted as a repeat count. + * Thus, typing `5n' should scroll forward 5 lines in the file. + * + * The way you can tell this is working OK is that, in the trace file, + * there should be one scroll operation plus a small number of line + * updates, as opposed to a whole-page update. This means the physical + * scroll operation worked, and the refresh() code only had to do a + * partial repaint. + * + * $Id: view.c,v 1.2 2007/05/28 15:01:58 blymn Exp $ + */ + +#include +#include +#include +#include +#ifdef NCURSES +#define _XOPEN_SOURCE_EXTENDED +#include +#include +#else +#include +#endif /* NCURSES */ +#include +#include +#include +#include +#include +#include +#ifdef HAVE_WCHAR +#include +#endif /* HAVE_WCHAR */ +#ifdef DEBUG +#include +#endif /* DEBUG */ + +#define UChar(c) ((unsigned char)(c)) +#define SIZEOF(table) (sizeof(table)/sizeof(table[0])) +#define typeMalloc(type,n) (type *) malloc((n) * sizeof(type)) + +#define my_pair 1 + +#undef CURSES_CH_T +#ifdef HAVE_WCHAR +#define CURSES_CH_T cchar_t +#else +#define CURSES_CH_T chtype +#endif /* HAVE_WCHAR */ + +static void finish(int sig); +static void show_all(const char *tag); + +static int shift = 0; +static bool try_color = FALSE; + +static char *fname; +static CURSES_CH_T **my_lines; +static CURSES_CH_T **lptr; +static unsigned num_lines; + +static void usage(void) +{ + static const char *msg[] = { + "Usage: view [options] file" + ,"" + ,"Options:" + ," -c use color if terminal supports it" + ," -i ignore INT, QUIT, TERM signals" + ," -n NUM specify maximum number of lines (default 1000)" +#if defined(KEY_RESIZE) + ," -r use old-style sigwinch handler rather than KEY_RESIZE" +#endif +#ifdef TRACE + ," -t trace screen updates" + ," -T NUM specify trace mask" +#endif + }; + size_t n; + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + exit( 1 ); +} + +static int ch_len(CURSES_CH_T * src) +{ + int result = 0; + +#ifdef HAVE_WCHAR + while (getcchar(src++, NULL, NULL, NULL, NULL) > 0) + result++; +#else + while (*src++) + result++; +#endif + return result; +} + +/* + * Allocate a string into an array of chtype's. If UTF-8 mode is + * active, translate the string accordingly. + */ +static CURSES_CH_T * ch_dup(char *src) +{ + unsigned len = strlen(src); + CURSES_CH_T *dst = typeMalloc(CURSES_CH_T, len + 1); + unsigned j, k; +#ifdef HAVE_WCHAR + wchar_t wstr[CCHARW_MAX + 1]; + wchar_t wch; + int l = 0; + mbstate_t state; + size_t rc; + int width; +#endif + +#ifdef HAVE_WCHAR + mbrtowc( NULL, NULL, 1, &state ); +#endif + for (j = k = 0; j < len; j++) { +#ifdef HAVE_WCHAR + rc = mbrtowc(&wch, src + j, len - j, &state); +#ifdef DEBUG + syslog( LOG_INFO, "[ch_dup]mbrtowc() returns %d", rc ); +#endif /* DEBUG */ + if (rc == (size_t) -1 || rc == (size_t) -2) + break; + j += rc - 1; + if ((width = wcwidth(wch)) < 0) + break; + if ((width > 0 && l > 0) || l == CCHARW_MAX) { + wstr[l] = L'\0'; + l = 0; + if (setcchar(dst + k, wstr, 0, 0, NULL) != OK) + break; + ++k; + } + if (width == 0 && l == 0) + wstr[l++] = L' '; + wstr[l++] = wch; +#ifdef DEBUG + syslog( LOG_INFO, "[ch_dup]wch=%x", wch ); +#endif /* DEBUG */ +#else + dst[k++] = src[j]; +#endif + } +#ifdef HAVE_WCHAR + if (l > 0) { + wstr[l] = L'\0'; + if (setcchar(dst + k, wstr, 0, 0, NULL) == OK) + ++k; + } + setcchar(dst + k, L"", 0, 0, NULL); +#else + dst[k] = 0; +#endif + return dst; +} + +int main(int argc, char *argv[]) +{ + int MAXLINES = 1000; + FILE *fp; + char buf[BUFSIZ]; + int i; + int my_delay = 0; + CURSES_CH_T **olptr; + int length = 0; + int value = 0; + bool done = FALSE; + bool got_number = FALSE; + const char *my_label = "Input"; +#ifdef HAVE_WCHAR + cchar_t icc; +#endif /* HAVE_WCHAR */ + + setlocale(LC_ALL, ""); + + (void) signal(SIGINT, finish); /* arrange interrupts to terminate */ + + while ((i = getopt(argc, argv, "cin:rtT:")) != EOF) { + switch (i) { + case 'c': + try_color = TRUE; + break; + case 'i': + signal(SIGINT, SIG_IGN); + signal(SIGQUIT, SIG_IGN); + signal(SIGTERM, SIG_IGN); + break; + case 'n': + if ((MAXLINES = atoi(optarg)) < 1) + usage(); + break; +#ifdef TRACE + case 'T': + trace(atoi(optarg)); + break; + case 't': + trace(TRACE_CALLS); + break; +#endif + default: + usage(); + } + } + if (optind + 1 != argc) + usage(); + + if ((my_lines = typeMalloc(CURSES_CH_T *, MAXLINES + 2)) == 0) + usage(); + + fname = argv[optind]; + if ((fp = fopen(fname, "r")) == 0) { + perror(fname); + exit( 1 ); + } + + /* slurp the file */ + num_lines = 0; + for (lptr = &my_lines[0]; (lptr - my_lines) < MAXLINES; lptr++) { + char temp[BUFSIZ], *s, *d; + int col; + + if (fgets(buf, sizeof(buf), fp) == 0) + break; + + /* convert tabs so that shift will work properly */ + for (s = buf, d = temp, col = 0; (*d = *s) != '\0'; s++) { + if (*d == '\n') { + *d = '\0'; + break; + } else if (*d == '\t') { + col = (col | 7) + 1; + while ((d - temp) != col) + *d++ = ' '; + } else +#ifdef HAVE_WCHAR + col++, d++; +#else + if (isprint(UChar(*d))) { + col++; + d++; + } else { + sprintf(d, "\\%03o", UChar(*s)); + d += strlen(d); + col = (d - temp); + } +#endif + } + *lptr = ch_dup(temp); + num_lines++; + } + (void) fclose(fp); + length = lptr - my_lines; + + (void) initscr(); /* initialize the curses library */ + keypad(stdscr, TRUE); /* enable keyboard mapping */ + (void) nonl(); /* tell curses not to do NL->CR/NL on output */ + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + nodelay(stdscr, TRUE); + idlok(stdscr, TRUE); /* allow use of insert/delete line */ + + if (try_color) { + if (has_colors()) { + start_color(); + init_pair(my_pair, COLOR_WHITE, COLOR_BLUE); + bkgd(COLOR_PAIR(my_pair)); + } else { + try_color = FALSE; + } + } + + lptr = my_lines; + while (!done) { + int n; +#ifdef HAVE_WCHAR + wint_t c = 0; + int ret; +#else + int c = 0; +#endif /* HAVE_WCHAR */ + + if (!got_number) + show_all(my_label); + + n = 0; + for (;;) { + c = 0; +#ifdef HAVE_WCHAR + ret = get_wch( &c ); + if ( ret == ERR ) { + if (!my_delay) + napms(50); + continue; + } +#ifdef DEBUG + else if ( ret == KEY_CODE_YES ) + syslog( LOG_INFO, "[main]Func key(%x)", c ); + else + syslog( LOG_INFO, "[main]c=%x", c ); +#endif /* DEBUG */ +#else + c = getch(); +#ifdef DEBUG + syslog( LOG_INFO, "[main]c='%c'", c ); +#endif /* DEBUG */ +#endif /* HAVE_WCHAR */ + if ((c < 127) && isdigit(c)) { + if (!got_number) { + mvprintw(0, 0, "Count: "); + clrtoeol(); + } + addch(c); + value = 10 * value + (c - '0'); + got_number = TRUE; + } else + break; + } + if (got_number && value) { + n = value; + } else { + n = 1; + } + +#ifdef HAVE_WCHAR + if (ret != ERR) + my_label = key_name( c ); + else + if (!my_delay) + napms(50); +#else + if (c != ERR) + my_label = keyname(c); +#endif /* HAVE_WCHAR */ + switch (c) { + case KEY_DOWN: +#ifdef HAVE_WCHAR + case L'n': +#else + case 'n': +#endif /* HAVE_WCHAR */ + olptr = lptr; + for (i = 0; i < n; i++) + if ((lptr - my_lines) < (length - LINES + 1)) + lptr++; + else + break; + wscrl(stdscr, lptr - olptr); + break; + + case KEY_UP: +#ifdef HAVE_WCHAR + case L'p': +#else + case 'p': +#endif /* HAVE_WCHAR */ + olptr = lptr; + for (i = 0; i < n; i++) + if (lptr > my_lines) + lptr--; + else + break; + wscrl(stdscr, lptr - olptr); + break; + +#ifdef HAVE_WCHAR + case L'h': +#else + case 'h': +#endif /* HAVE_WCHAR */ + case KEY_HOME: + lptr = my_lines; + break; + +#ifdef HAVE_WCHAR + case L'e': +#else + case 'e': +#endif /* HAVE_WCHAR */ + case KEY_END: + if (length > LINES) + lptr = my_lines + length - LINES + 1; + else + lptr = my_lines; + break; + +#ifdef HAVE_WCHAR + case L'r': +#else + case 'r': +#endif /* HAVE_WCHAR */ + case KEY_RIGHT: + shift += n; + break; + +#ifdef HAVE_WCHAR + case L'l': +#else + case 'l': +#endif /* HAVE_WCHAR */ + case KEY_LEFT: + shift -= n; + if (shift < 0) { + shift = 0; + beep(); + } + break; + +#ifdef HAVE_WCHAR + case L'q': +#else + case 'q': +#endif /* HAVE_WCHAR */ + done = TRUE; + break; + +#ifdef KEY_RESIZE + case KEY_RESIZE: + //refresh(); + break; +#endif +#ifdef HAVE_WCHAR + case L's': +#else + case 's': +#endif /* HAVE_WCHAR */ + if (got_number) { + halfdelay(my_delay = n); + } else { + nodelay(stdscr, FALSE); + my_delay = -1; + } + break; +#ifdef HAVE_WCHAR + case L' ': +#else + case ' ': +#endif /* HAVE_WCHAR */ + nodelay(stdscr, TRUE); + my_delay = 0; + break; +#ifndef HAVE_WCHAR + case ERR: + if (!my_delay) + napms(50); + break; +#endif /* HAVE_WCHAR */ + default: + beep(); + break; + } + if (c >= KEY_MIN || (c > 0 && !isdigit(c))) { + got_number = FALSE; + value = 0; + } + } + + finish(0); /* we're done */ +} + +static void finish(int sig) +{ + endwin(); + exit(sig != 0 ? 1 : 0 ); +} + +static void show_all(const char *tag) +{ + int i; + char temp[BUFSIZ]; + CURSES_CH_T *s; + time_t this_time; + + sprintf(temp, "%s (%3dx%3d) col %d ", tag, LINES, COLS, shift); + i = strlen(temp); + sprintf(temp + i, "view %.*s", (int) (sizeof(temp) - 7 - i), fname); + move(0, 0); + printw("%.*s", COLS, temp); + clrtoeol(); + this_time = time((time_t *) 0); + strcpy(temp, ctime(&this_time)); + if ((i = strlen(temp)) != 0) { + temp[--i] = 0; + if (move(0, COLS - i - 2) != ERR) + printw(" %s", temp); + } + + scrollok(stdscr, FALSE); /* prevent screen from moving */ + for (i = 1; i < LINES; i++) { + move(i, 0); + printw("%3ld:", (long) (lptr + i - my_lines)); + clrtoeol(); + if ((s = lptr[i - 1]) != 0) { + if (i < num_lines) { + int len = ch_len(s); + if (len > shift) { +#ifdef HAVE_WCHAR + add_wchstr(s + shift); +#else + addchstr(s + shift); +#endif + } + } + } + } + setscrreg(1, LINES - 1); + scrollok(stdscr, TRUE); + refresh(); +} diff --git a/vendor/netbsd-curses/libcurses/GNUmakefile b/vendor/netbsd-curses/libcurses/GNUmakefile new file mode 100644 index 0000000..aeaec83 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/GNUmakefile @@ -0,0 +1,195 @@ +# $NetBSD: Makefile,v 1.71 2014/07/05 22:31:32 dholland Exp $ +# @(#)Makefile 8.2 (Berkeley) 1/2/94 + + +WARNS= 2 +AWK ?= awk +AR ?= ar +CPPFLAGS+=-I. -I.. -I../libterminfo +CFLAGS+=-Werror-implicit-function-declaration +ifdef DEBUG_CURSES +CPPFLAGS+=-g -DDEBUG +endif +ifdef SMALL +CPPFLAGS+=-DSMALL +endif +LIB= curses +SRCS= acs.c addbytes.c addch.c addchnstr.c addnstr.c attributes.c \ + background.c bell.c border.c box.c chgat.c clear.c clearok.c \ + clrtobot.c clrtoeol.c color.c copywin.c cr_put.c \ + ctrace.c cur_hash.c curs_set.c \ + curses.c delch.c deleteln.c delwin.c echochar.c erase.c fileio.c \ + flushok.c fullname.c getch.c getstr.c getyx.c id_subwins.c idlok.c \ + idcok.c inch.c inchstr.c initscr.c insch.c insdelln.c insertln.c \ + instr.c keypad.c keyname.c leaveok.c line.c meta.c move.c \ + mvwin.c newwin.c nodelay.c notimeout.c overlay.c overwrite.c pause.c \ + printw.c putchar.c refresh.c resize.c scanw.c screen.c scroll.c \ + scrollok.c setterm.c standout.c timeout.c toucholap.c touchwin.c \ + tstp.c tty.c unctrl.c underscore.c + +MAN= curses.3 curses_addch.3 curses_addchstr.3 curses_addstr.3 \ + curses_attributes.3 curses_background.3 curses_border.3 \ + curses_chgat.3 curses_clear.3 curses_color.3 \ + curses_cursor.3 curses_default_colors.3 \ + curses_delch.3 curses_deleteln.3 curses_echochar.3 curses_fileio.3 \ + curses_inch.3 curses_input.3 curses_insertch.3 curses_insertln.3 \ + curses_insdelln.3 curses_keyname.3 curses_line.3 curses_pad.3 \ + curses_print.3 curses_refresh.3 curses_scanw.3 curses_screen.3 \ + curses_scroll.3 curses_standout.3 curses_termcap.3 curses_touch.3 \ + curses_tty.3 curses_underscore.3 curses_window.3 +INCS= curses.h unctrl.h +INCSDIR=/usr/include + +LIBDPLIBS+= terminfo ${.CURDIR}/../libterminfo + +ifndef DISABLE_WCHAR +CPPFLAGS+=-DHAVE_WCHAR +SRCS+= cchar.c add_wch.c add_wchstr.c addwstr.c echo_wchar.c ins_wch.c \ + insstr.c ins_wstr.c get_wch.c get_wstr.c in_wch.c in_wchstr.c \ + inwstr.c +else +CPPFLAGS+=-DDISABLE_WCHAR +endif + +MLINKS+= curses_addch.3 addch.3 curses_addchstr.3 addchnstr.3 \ + curses_addchstr.3 addchstr.3 curses_addstr.3 addnstr.3 \ + curses_addstr.3 addstr.3 \ + curses_default_colors.3 assume_default_colors.3 \ + curses_attributes.3 attr_get.3 curses_attributes.3 attr_off.3 \ + curses_attributes.3 attr_on.3 curses_attributes.3 attr_set.3 \ + curses_attributes.3 attron.3 curses_attributes.3 attroff.3 \ + curses_attributes.3 attrset.3 curses_tty.3 beep.3 \ + curses_background.3 bkgd.3 curses_background.3 bkgdset.3 \ + curses_border.3 border.3 curses_border.3 box.3 \ + curses_chgat.3 chgat.3 curses_chgat.3 mvchgat.3 \ + curses_chgat.3 mvwchgat.3 curses_chgat.3 wchgat.3 \ + curses_color.3 can_change_color.3 curses_tty.3 cbreak.3 \ + curses_clear.3 clear.3 curses_clear.3 clearok.3 \ + curses_clear.3 clrtobot.3 curses_clear.3 clrtoeol.3 \ + curses_color.3 color_content.3 curses_attributes.3 color_set.3 \ + curses_window.3 copywin.3 curses_tty.3 curs_set.3 \ + curses_input.3 define_key.3 \ + curses_tty.3 delay_output.3 curses_tty.3 def_prog_mode.3 \ + curses_tty.3 def_shell_mode.3 curses_delch.3 delch.3 \ + curses_deleteln.3 deleteln.3 curses_screen.3 delscreen.3 \ + curses_window.3 delwin.3 curses_window.3 derwin.3 \ + curses_refresh.3 doupdate.3 curses_window.3 dupwin.3 \ + curses_tty.3 echo.3 curses_echochar.3 echochar.3 \ + curses_screen.3 endwin.3 curses_clear.3 erase.3 \ + curses_tty.3 erasechar.3 \ + curses_tty.3 flash.3 curses_tty.3 flushinp.3 \ + curses_refresh.3 flushok.3 \ + curses_termcap.3 fullname.3 curses_attributes.3 getattrs.3 \ + curses_background.3 getbkgd.3 \ + curses_input.3 getch.3 curses_cursor.3 getcury.3 \ + curses_cursor.3 getcurx.3 curses_cursor.3 getbegy.3 \ + curses_cursor.3 getbegx.3 curses_cursor.3 getmaxx.3 \ + curses_cursor.3 getmaxy.3 curses_cursor.3 getmaxyx.3 \ + curses_input.3 getnstr.3 \ + curses_cursor.3 getpary.3 curses_cursor.3 getparx.3 \ + curses_cursor.3 getparyx.3 curses_fileio.3 getwin.3 \ + curses_input.3 getstr.3 \ + curses_tty.3 gettmode.3 curses_cursor.3 getyx.3 \ + curses_color.3 has_colors.3 curses_tty.3 has_ic.3 \ + curses_tty.3 halfdelay.3 curses_tty.3 has_il.3 \ + curses_line.3 hline.3 curses_tty.3 idcok.3 \ + curses_tty.3 idlok.3 curses_inch.3 inch.3 \ + curses_inch.3 inchnstr.3 curses_inch.3 inchstr.3 \ + curses_inch.3 innstr.3 curses_color.3 init_color.3 \ + curses_color.3 init_pair.3 curses_screen.3 initscr.3 \ + curses_insertch.3 insch.3 curses_insdelln.3 insdelln.3 \ + curses_insertln.3 insertln.3 curses_inch.3 instr.3 \ + curses_tty.3 intrflush.3 curses_touch.3 is_linetouched.3 \ + curses_touch.3 is_wintouched.3 curses_screen.3 isendwin.3 \ + curses_keyname.3 keyname.3 \ + curses_input.3 keypad.3 curses_tty.3 killchar.3 \ + curses_refresh.3 leaveok.3 \ + curses_tty.3 meta.3 curses_cursor.3 move.3 \ + curses_addch.3 mvaddch.3 curses_addchstr.3 mvaddchnstr.3 \ + curses_addchstr.3 mvaddchstr.3 curses_addstr.3 mvaddnstr.3 \ + curses_addstr.3 mvaddstr.3 \ + curses_cursor.3 mvcur.3 curses_window.3 mvderwin.3 \ + curses_input.3 mvgetch.3 \ + curses_input.3 mvgetnstr.3 curses_input.3 mvgetstr.3 \ + curses_line.3 mvhline.3 curses_print.3 mvprintw.3 \ + curses_line.3 mvvline.3 curses_addch.3 mvwaddch.3 \ + curses_addchstr.3 mvwaddchnstr.3 curses_addchstr.3 mvwaddchstr.3 \ + curses_addstr.3 mvwaddnstr.3 curses_addstr.3 mvwaddstr.3 \ + curses_input.3 mvwgetch.3 \ + curses_input.3 mvwgetnstr.3 curses_input.3 mvwgetstr.3 \ + curses_line.3 mvwhline.3 curses_window.3 mvwin.3 \ + curses_inch.3 mvinchnstr.3 \ + curses_inch.3 mvinchstr.3 curses_inch.3 mvinnstr.3 \ + curses_inch.3 mvinstr.3 curses_inch.3 mvwinchnstr.3 \ + curses_inch.3 mvwinchstr.3 curses_inch.3 mvwinnstr.3 \ + curses_inch.3 mvwinstr.3 curses_print.3 mvwprintw.3 \ + curses_line.3 mvwvline.3 curses_tty.3 napms.3 \ + curses_pad.3 newpad.3 curses_screen.3 newterm.3 \ + curses_window.3 newwin.3 curses_tty.3 nl.3 \ + curses_tty.3 nocbreak.3 curses_input.3 nodelay.3 \ + curses_tty.3 noecho.3 curses_tty.3 nonl.3 \ + curses_tty.3 noqiflush.3 \ + curses_tty.3 noraw.3 curses_input.3 notimeout.3 \ + curses_window.3 overlay.3 curses_window.3 overwrite.3 \ + curses_color.3 pair_content.3 curses_echochar.3 pechochar.3 \ + curses_pad.3 pnoutrefresh.3 \ + curses_pad.3 prefresh.3 curses_print.3 printw.3 \ + curses_fileio.3 putwin.3 curses_tty.3 qiflush.3 \ + curses_tty.3 raw.3 curses_refresh.3 refresh.3 \ + curses_tty.3 reset_prog_mode.3 curses_tty.3 reset_shell_mode.3 \ + curses_tty.3 resetty.3 curses_screen.3 resizeterm.3 \ + curses_tty.3 savetty.3 curses_scanw.3 scanw.3 \ + curses_scroll.3 scrl.3 curses_scroll.3 scroll.3 \ + curses_scroll.3 scrollok.3 curses_scroll.3 setscrreg.3 \ + curses_screen.3 set_term.3 curses_screen.3 setterm.3 \ + curses_standout.3 standend.3 curses_standout.3 standout.3 \ + curses_color.3 start_color.3 curses_pad.3 subpad.3 \ + curses_window.3 subwin.3 curses_input.3 timeout.3 \ + curses_touch.3 touchline.3 curses_touch.3 touchoverlap.3 \ + curses_touch.3 touchwin.3 curses_print.3 unctrl.3 \ + curses_underscore.3 underend.3 curses_underscore.3 underscore.3 \ + curses_input.3 ungetch.3 curses_touch.3 untouchwin.3 \ + curses_default_colors.3 use_default_colors.3 curses_line.3 vline.3 \ + curses_addch.3 waddch.3 curses_addchstr.3 waddchnstr.3 \ + curses_addchstr.3 waddchstr.3 curses_addstr.3 waddnstr.3 \ + curses_addstr.3 waddstr.3 \ + curses_attributes.3 wattr_get.3 curses_attributes.3 wattr_off.3 \ + curses_attributes.3 wattr_on.3 curses_attributes.3 wattr_set.3 \ + curses_attributes.3 wattron.3 curses_attributes.3 wattroff.3 \ + curses_attributes.3 wattrset.3 curses_background.3 wbkgd.3 \ + curses_background.3 wbkgdset.3 curses_border.3 wborder.3 \ + curses_clear.3 wclear.3 curses_clear.3 wclrtobot.3 \ + curses_clear.3 wclrtoeol.3 curses_attributes.3 wcolor_set.3 \ + curses_delch.3 wdelch.3 curses_deleteln.3 wdeleteln.3 \ + curses_echochar.3 wechochar.3 \ + curses_clear.3 werase.3 curses_input.3 wgetch.3 \ + curses_input.3 wgetnstr.3 curses_input.3 wgetstr.3 \ + curses_line.3 whline.3 curses_inch.3 winch.3 \ + curses_inch.3 winchnstr.3 curses_inch.3 winchstr.3 \ + curses_inch.3 winnstr.3 curses_insertch.3 winsch.3 \ + curses_insdelln.3 winsdelln.3 curses_insertln.3 winsertln.3 \ + curses_inch.3 winstr.3 curses_cursor.3 wmove.3 \ + curses_refresh.3 wnoutrefresh.3 curses_print.3 wprintw.3 \ + curses_refresh.3 wrefresh.3 curses_window.3 wresize.3 \ + curses_scanw.3 wscanw.3 curses_scroll.3 wscrl.3 \ + curses_scroll.3 wsetscrreg.3 curses_standout.3 wstandend.3 \ + curses_standout.3 wstandout.3 curses_input.3 wtimeout.3 \ + curses_touch.3 wtouchln.3 curses_underscore.3 wunderend.3 \ + curses_underscore.3 wunderscore.3 curses_line.3 wvline.3 + +OBJS = $(SRCS:.c=.o) + +all: libcurses.a + +clean: + rm -f $(OBJS) libcurses.a + +fileio.h: shlib_version genfileioh.awk + $(AWK) -f ./genfileioh.awk < ./shlib_version > ./fileio.h + +libcurses.a: $(OBJS) + $(AR) cru $@ $^ + +%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $< + diff --git a/vendor/netbsd-curses/libcurses/Makefile b/vendor/netbsd-curses/libcurses/Makefile new file mode 100644 index 0000000..9a52699 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/Makefile @@ -0,0 +1,219 @@ +# $NetBSD: Makefile,v 1.94 2020/03/23 13:37:36 roy Exp $ +# @(#)Makefile 8.2 (Berkeley) 1/2/94 + +.include + +WARNS= 2 + +CPPFLAGS+=-I${.CURDIR} -I${NETBSDSRCDIR}/lib/libterminfo +.if defined(DEBUG_CURSES) +CPPFLAGS+=-g -DDEBUG +.endif +.if defined(SMALL) +CPPFLAGS+=-DSMALL +.endif +LIB= curses +SRCS= acs.c addbytes.c addch.c addchnstr.c addnstr.c attributes.c \ + background.c bell.c border.c box.c chgat.c clear.c clearok.c \ + clrtobot.c clrtoeol.c color.c copywin.c cr_put.c \ + ctrace.c cur_hash.c curs_set.c \ + curses.c delch.c deleteln.c delwin.c echochar.c erase.c fileio.c \ + flushok.c fullname.c getch.c getstr.c getyx.c id_subwins.c idlok.c \ + idcok.c immedok.c inch.c inchstr.c initscr.c insch.c insdelln.c \ + insertln.c insstr.c instr.c keypad.c keyname.c leaveok.c line.c \ + meta.c mouse.c move.c \ + mvwin.c newwin.c nodelay.c notimeout.c overlay.c overwrite.c pause.c \ + printw.c putchar.c refresh.c resize.c ripoffline.c scanw.c screen.c \ + scroll.c scrollok.c setterm.c slk.c standout.c syncok.c timeout.c \ + toucholap.c touchwin.c tstp.c tty.c unctrl.c underscore.c version.c + +MAN= curses.3 curses_addch.3 curses_addchstr.3 curses_addstr.3 \ + curses_attributes.3 curses_background.3 curses_border.3 \ + curses_cchar.3 \ + curses_chgat.3 curses_clear.3 curses_color.3 \ + curses_cursor.3 curses_default_colors.3 \ + curses_delch.3 curses_deleteln.3 curses_echochar.3 curses_fileio.3 \ + curses_inch.3 curses_input.3 curses_insch.3 curses_insertln.3 \ + curses_insdelln.3 curses_keyname.3 curses_line.3 \ + curses_mouse.3 curses_pad.3 \ + curses_print.3 curses_refresh.3 curses_scanw.3 curses_screen.3 \ + curses_scroll.3 curses_slk.3 curses_standout.3 curses_termcap.3 \ + curses_touch.3 curses_tty.3 curses_underscore.3 curses_version.3 \ + curses_window.3 +INCS= curses.h unctrl.h +INCSDIR=/usr/include + +LIBDPLIBS+= terminfo ${.CURDIR}/../libterminfo + +.if !defined(DISABLE_WCHAR) +CPPFLAGS+=-DHAVE_WCHAR +SRCS+= cchar.c add_wch.c add_wchstr.c addwstr.c echo_wchar.c ins_wch.c \ + ins_wstr.c get_wch.c get_wstr.c in_wch.c in_wchstr.c \ + inwstr.c +.else +CPPFLAGS+=-DDISABLE_WCHAR +.endif + +MLINKS+= curses_addch.3 addch.3 curses_addchstr.3 addchnstr.3 \ + curses_addchstr.3 addchstr.3 curses_addstr.3 addnstr.3 \ + curses_addstr.3 addstr.3 \ + curses_default_colors.3 assume_default_colors.3 \ + curses_attributes.3 attr_get.3 curses_attributes.3 attr_off.3 \ + curses_attributes.3 attr_on.3 curses_attributes.3 attr_set.3 \ + curses_attributes.3 attron.3 curses_attributes.3 attroff.3 \ + curses_attributes.3 attrset.3 curses_tty.3 beep.3 \ + curses_background.3 bkgd.3 curses_background.3 bkgdset.3 \ + curses_border.3 border.3 curses_border.3 box.3 \ + curses_cchar.3 getcchar.3 \ + curses_cchar.3 setcchar.3 \ + curses_chgat.3 chgat.3 curses_chgat.3 mvchgat.3 \ + curses_chgat.3 mvwchgat.3 curses_chgat.3 wchgat.3 \ + curses_color.3 can_change_color.3 curses_tty.3 cbreak.3 \ + curses_clear.3 clear.3 curses_clear.3 clearok.3 \ + curses_clear.3 clrtobot.3 curses_clear.3 clrtoeol.3 \ + curses_color.3 color_content.3 curses_attributes.3 color_set.3 \ + curses_window.3 copywin.3 curses_tty.3 curs_set.3 \ + curses_input.3 define_key.3 \ + curses_tty.3 delay_output.3 curses_tty.3 def_prog_mode.3 \ + curses_tty.3 def_shell_mode.3 curses_delch.3 delch.3 \ + curses_deleteln.3 deleteln.3 curses_screen.3 delscreen.3 \ + curses_window.3 delwin.3 curses_window.3 derwin.3 \ + curses_refresh.3 doupdate.3 curses_window.3 dupwin.3 \ + curses_tty.3 echo.3 curses_echochar.3 echochar.3 \ + curses_screen.3 endwin.3 curses_clear.3 erase.3 \ + curses_tty.3 erasechar.3 curses_screen.3 filter.3 \ + curses_tty.3 flash.3 curses_tty.3 flushinp.3 \ + curses_refresh.3 flushok.3 \ + curses_termcap.3 fullname.3 curses_attributes.3 getattrs.3 \ + curses_background.3 getbkgd.3 \ + curses_input.3 getch.3 curses_cursor.3 getcury.3 \ + curses_cursor.3 getcurx.3 curses_cursor.3 getbegy.3 \ + curses_cursor.3 getbegx.3 curses_cursor.3 getmaxx.3 \ + curses_cursor.3 getmaxy.3 curses_cursor.3 getmaxyx.3 \ + curses_input.3 getnstr.3 \ + curses_cursor.3 getpary.3 curses_cursor.3 getparx.3 \ + curses_cursor.3 getparyx.3 curses_fileio.3 getwin.3 \ + curses_input.3 getstr.3 \ + curses_tty.3 gettmode.3 \ + curses_cursor.3 getyx.3 curses_cursor.3 getsyx.3 \ + curses_color.3 has_colors.3 curses_tty.3 has_ic.3 \ + curses_tty.3 halfdelay.3 curses_input.3 has_key.3 \ + curses_tty.3 has_il.3 \ + curses_line.3 hline.3 curses_tty.3 idcok.3 \ + curses_tty.3 idlok.3 curses_refresh.3 immedok.3 curses_inch.3 inch.3 \ + curses_inch.3 inchnstr.3 curses_inch.3 inchstr.3 \ + curses_inch.3 innstr.3 curses_color.3 init_color.3 \ + curses_color.3 init_pair.3 curses_screen.3 initscr.3 \ + curses_insch.3 insch.3 curses_insdelln.3 insdelln.3 \ + curses_insertln.3 insertln.3 curses_inch.3 instr.3 \ + curses_tty.3 intrflush.3 \ + curses_input.3 is_keypad.3 \ + curses_refresh.3 is_leaveok.3 curses_touch.3 is_linetouched.3 \ + curses_pad.3 is_pad.3 curses_screen.3 is_term_resized.3 \ + curses_touch.3 is_wintouched.3 curses_screen.3 isendwin.3 \ + curses_keyname.3 keyname.3 \ + curses_input.3 keypad.3 curses_tty.3 killchar.3 \ + curses_refresh.3 leaveok.3 \ + curses_tty.3 meta.3 curses_cursor.3 move.3 \ + curses_addch.3 mvaddch.3 curses_addchstr.3 mvaddchnstr.3 \ + curses_addchstr.3 mvaddchstr.3 curses_addstr.3 mvaddnstr.3 \ + curses_addstr.3 mvaddstr.3 \ + curses_cursor.3 mvcur.3 curses_window.3 mvderwin.3 \ + curses_input.3 mvgetch.3 \ + curses_input.3 mvgetnstr.3 curses_input.3 mvgetstr.3 \ + curses_line.3 mvhline.3 curses_print.3 mvprintw.3 \ + curses_line.3 mvvline.3 curses_addch.3 mvwaddch.3 \ + curses_addchstr.3 mvwaddchnstr.3 curses_addchstr.3 mvwaddchstr.3 \ + curses_addstr.3 mvwaddnstr.3 curses_addstr.3 mvwaddstr.3 \ + curses_input.3 mvwgetch.3 \ + curses_input.3 mvwgetnstr.3 curses_input.3 mvwgetstr.3 \ + curses_line.3 mvwhline.3 curses_window.3 mvwin.3 \ + curses_inch.3 mvinchnstr.3 \ + curses_inch.3 mvinchstr.3 curses_inch.3 mvinnstr.3 \ + curses_insch.3 mvinsch.3 \ + curses_inch.3 mvinstr.3 curses_inch.3 mvwinchnstr.3 \ + curses_inch.3 mvwinchstr.3 curses_inch.3 mvwinnstr.3 \ + curses_insch.3 mvwinsch.3 \ + curses_inch.3 mvwinstr.3 curses_print.3 mvwprintw.3 \ + curses_line.3 mvwvline.3 curses_tty.3 napms.3 \ + curses_pad.3 newpad.3 curses_screen.3 newterm.3 \ + curses_window.3 newwin.3 curses_tty.3 nl.3 \ + curses_tty.3 nocbreak.3 curses_input.3 nodelay.3 \ + curses_tty.3 noecho.3 curses_tty.3 nonl.3 \ + curses_tty.3 noqiflush.3 \ + curses_tty.3 noraw.3 curses_input.3 notimeout.3 \ + curses_window.3 overlay.3 curses_window.3 overwrite.3 \ + curses_color.3 pair_content.3 curses_echochar.3 pechochar.3 \ + curses_pad.3 pnoutrefresh.3 \ + curses_pad.3 prefresh.3 curses_print.3 printw.3 \ + curses_fileio.3 putwin.3 curses_tty.3 qiflush.3 \ + curses_tty.3 raw.3 curses_refresh.3 refresh.3 \ + curses_tty.3 reset_prog_mode.3 curses_tty.3 reset_shell_mode.3 \ + curses_tty.3 resetty.3 \ + curses_screen.3 resizeterm.3 curses_screen.3 resize_term.3 \ + curses_screen.3 ripoffline.3 \ + curses_tty.3 savetty.3 curses_scanw.3 scanw.3 \ + curses_scroll.3 scrl.3 curses_scroll.3 scroll.3 \ + curses_scroll.3 scrollok.3 curses_scroll.3 setscrreg.3 \ + curses_cursor.3 setsyx.3 \ + curses_input.3 set_escdelay.3 curses_screen.3 set_tabsize.3 \ + curses_screen.3 set_term.3 curses_screen.3 setterm.3 \ + curses_slk.3 slk_attroff.3 curses_slk.3 slk_attr_off.3 \ + curses_slk.3 slk_attron.3 curses_slk.3 slk_attr_on.3 \ + curses_slk.3 slk_attrset.3 curses_slk.3 slk_attr_set.3 \ + curses_slk.3 slk_clear.3 curses_slk.3 slk_color.3 \ + curses_slk.3 slk_init.3 curses_slk.3 slk_label.3 \ + curses_slk.3 slk_noutrefresh.3 curses_slk.3 slk_refresh.3 \ + curses_slk.3 slk_restore.3 curses_slk.3 slk_set.3 \ + curses_slk.3 slk_touch.3 curses_slk.3 slk_wset.3 \ + curses_standout.3 standend.3 curses_standout.3 standout.3 \ + curses_color.3 start_color.3 curses_pad.3 subpad.3 \ + curses_window.3 subwin.3 curses_touch.3 syncok.3 \ + curses_input.3 timeout.3 \ + curses_touch.3 touchline.3 curses_touch.3 touchoverlap.3 \ + curses_touch.3 touchwin.3 curses_tty.3 typeahead.3 \ + curses_print.3 unctrl.3 \ + curses_underscore.3 underend.3 curses_underscore.3 underscore.3 \ + curses_input.3 ungetch.3 curses_touch.3 untouchwin.3 \ + curses_default_colors.3 use_default_colors.3 \ + curses_screen.3 use_env.3 curses_line.3 vline.3 \ + curses_addch.3 waddch.3 curses_addchstr.3 waddchnstr.3 \ + curses_addchstr.3 waddchstr.3 curses_addstr.3 waddnstr.3 \ + curses_addstr.3 waddstr.3 \ + curses_attributes.3 wattr_get.3 curses_attributes.3 wattr_off.3 \ + curses_attributes.3 wattr_on.3 curses_attributes.3 wattr_set.3 \ + curses_attributes.3 wattron.3 curses_attributes.3 wattroff.3 \ + curses_attributes.3 wattrset.3 curses_background.3 wbkgd.3 \ + curses_background.3 wbkgdset.3 curses_border.3 wborder.3 \ + curses_clear.3 wclear.3 curses_clear.3 wclrtobot.3 \ + curses_clear.3 wclrtoeol.3 curses_attributes.3 wcolor_set.3 \ + curses_cursor.3 wcursyncup.3 \ + curses_delch.3 wdelch.3 curses_deleteln.3 wdeleteln.3 \ + curses_echochar.3 wechochar.3 \ + curses_clear.3 werase.3 curses_input.3 wgetch.3 \ + curses_input.3 wgetnstr.3 curses_input.3 wgetstr.3 \ + curses_line.3 whline.3 curses_inch.3 winch.3 \ + curses_inch.3 winchnstr.3 curses_inch.3 winchstr.3 \ + curses_inch.3 winnstr.3 curses_insch.3 winsch.3 \ + curses_insdelln.3 winsdelln.3 curses_insertln.3 winsertln.3 \ + curses_inch.3 winstr.3 curses_cursor.3 wmove.3 \ + curses_refresh.3 wnoutrefresh.3 curses_print.3 wprintw.3 \ + curses_refresh.3 wrefresh.3 curses_window.3 wresize.3 \ + curses_scanw.3 wscanw.3 curses_scroll.3 wscrl.3 \ + curses_scroll.3 wsetscrreg.3 curses_standout.3 wstandend.3 \ + curses_standout.3 wstandout.3 curses_touch.3 wsyncup.3 \ + curses_input.3 wtimeout.3 \ + curses_touch.3 wtouchln.3 curses_underscore.3 wunderend.3 \ + curses_underscore.3 wunderscore.3 curses_line.3 wvline.3 \ + curses_mouse.3 has_mouse.3 \ + curses_mouse.3 getmouse.3 curses_mouse.3 ungetmouse.3 \ + curses_mouse.3 mouse_trafo.3 curses_mouse.3 wmouse_trafo.3 \ + curses_mouse.3 wenclose.3 curses_mouse.3 mouseinterval.3 + +SUBDIR.roff+= PSD.doc + +fileio.h: shlib_version genfileioh.awk + ${TOOL_AWK} -f ${.CURDIR}/genfileioh.awk < ${.CURDIR}/shlib_version > ${.CURDIR}/fileio.h + +.include +.include diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/Makefile b/vendor/netbsd-curses/libcurses/PSD.doc/Makefile new file mode 100644 index 0000000..256b6c2 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/Makefile @@ -0,0 +1,32 @@ +# $NetBSD: Makefile,v 1.14 2014/07/15 13:27:58 christos Exp $ +# from: @(#)Makefile 8.2 (Berkeley) 5/23/94 + +SECTION=reference/ref3 +ARTICLE=curses +SRCS= Master +CEXAMPLES= ex1.gr ex2.gr life.gr twinkle1.gr twinkle2.gr win_st.gr +DEPSRCS=appen.A appen.B appen.C doc.I doc.II doc.III doc.IV fns.doc \ + intro.0 intro.1 intro.2.tbl intro.3 intro.4 intro.5 intro.6 \ + macros c_macros $(CEXAMPLES) +MACROS= -me +CLEANFILES+= ${CEXAMPLES} intro.2.tbl + +.SUFFIXES: +.SUFFIXES: .c .gr + +# +# this section formats C input source into nice troffable (or nroffable) +# versions. It uses the capabilites of "vgrind", which sets keywords in +# bold font, and comments in italics. +# + +# Don't re-run vgrind unless you want to patch the output files. + +.c.gr: + ${TOOL_VFONTEDPR} ${.IMPSRC} | grep -v "^'wh" > ${.TARGET} + +# Unfortunately our make doesn't handle single-suffix rules. +intro.2.tbl: intro.2 + ${TOOL_TBL} ${.ALLSRC} > ${.TARGET} + +.include diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/Master b/vendor/netbsd-curses/libcurses/PSD.doc/Master new file mode 100644 index 0000000..0af37df --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/Master @@ -0,0 +1,52 @@ +.\" $NetBSD: Master,v 1.5 2003/08/07 16:44:26 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)Master 8.2 (Berkeley) 5/24/94 +.\" +.ds Ln Screen Package +.so macros +.so c_macros +.so intro.0 +.pn 3 +.bp +.so intro.1 +.so intro.2.tbl +.so intro.3 +.so intro.4 +.so intro.5 +.so intro.6 +.bp +.so appen.A +.pn 2 +.oh '\*(Ln''PSD:19-%' +.eh 'PSD:19-%''\*(Ln' +.bp +.bi Contents +.sp +.xp diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/appen.A b/vendor/netbsd-curses/libcurses/PSD.doc/appen.A new file mode 100644 index 0000000..c707d85 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/appen.A @@ -0,0 +1,77 @@ +.\" $NetBSD: appen.A,v 1.7 2003/08/07 16:44:26 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)appen.A 8.1 (Berkeley) 6/8/93 +.\" +.ie t .oh '\*(Ln Appendix A''PS1:19-%' +.eh 'PS1:19-%''\*(Ln Appendix A' +.el .he ''\fIAppendix A\fR'' +.bp +.(x +.ti 0 +.b "Appendix A" +.)x +.sh 1 "Examples" 1 +.pp +Here we present a few examples +of how to use the package. +They attempt to be representative, +though not comprehensive. +Further examples can be found in the games section +of the source tree and in various utilities that use the screen such as +.i systat(1) . +.pp +The following examples are intended to demonstrate +the basic structure of a program +using the package. +An additional, more comprehensive, program can be found in +the source code in the +\fIexamples\fP subdirectory. +.sh 2 "Simple Character Output" +.pp +This program demonstrates how to set up a window and output characters to it. +Also, it demonstrates how one might control the output to the window. +If you run this program, you will get a demonstration of the character output +chracteristics discussed in the above Character Output section. +.(l I +.so ex1.gr +.)l +.sh 2 "Twinkle" +.pp +This is a moderately simple program which prints +patterns on the screen. +It switches between patterns of asterisks, +putting them on one by one in random order, +and then taking them off in the same fashion. +It is more efficient to write this +using only the motion optimization, +as is demonstrated below. +.(l I +.so twinkle1.gr +.)l diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/appen.B b/vendor/netbsd-curses/libcurses/PSD.doc/appen.B new file mode 100644 index 0000000..5a41fe0 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/appen.B @@ -0,0 +1,199 @@ +.\" $NetBSD: appen.B,v 1.5 2003/08/07 16:44:26 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)appen.B 8.1 (Berkeley) 6/8/93 +.\" +.ie t .oh '\*(Ln Appendix B''PS1:19-%' +.eh 'PS1:19-%''\*(Ln Appendix B' +.el .he ''\fIAppendix B\fR'' +.bp +.(x +.ti 0 +.b "Appendix B" +.)x +.nr $1 0 +.sh 1 "The WINDOW structure" +.pp +The WINDOW structure is defined as follows: +.(l I +.so win_st.gr +.)l +.pp +.Vn \*_cury \\* +.(f +\** +All variables not normally accessed directly by the user +are named with an initial +.Bq \*_ +to avoid conflicts with the user's variables. +.)f +and +.Vn \*_curx +are the current \*y for the window. +New characters added to the screen +are added at this point. +.Vn \*_maxy +and +.Vn \*_maxx +are the maximum values allowed for +.Vn \*_cury\*,\*_curx ). ( +.Vn \*_begy +and +.Vn \*_begx +are the starting \*y on the terminal for the window, +.i i.e. , +the window's home. +.Vn \*_cury , +.Vn \*_curx , +.Vn \*_maxy , +and +.Vn \*_maxx +are measured relative to +.Vn \*_begy\*,\*_begx ), ( +not the terminal's home. +.pp +.Vn \*_clear +tells if a clear-screen sequence is to be generated +on the next +.Fn refresh +call. +This is only meaningful for screens. +The initial clear-screen for the first +.Fn refresh +call is generated by initially setting clear to be TRUE for +.Vn curscr , +which always generates a clear-screen if set, +irrelevant of the dimensions of the window involved. +.Vn \*_leave +is TRUE if the current \*y and the cursor +are to be left after the last character changed on the terminal, +or not moved if there is no change. +.Vn \*_scroll +is TRUE +if scrolling is allowed. +.pp +.Vn \*_y +is a pointer to an array of lines which describe the terminal. +Thus: +.(l +\*_y[i] +.)l +.lp +is a pointer to the +.Vn i th +line, and +.(l +\*_y[i][j] +.)l +.lp +is the +.Vn j th +character on the +.Vn i th +line. +.Vn \*_flags +can have one or more values +or'd into it. +.pp +For windows that are not subwindows, +.Vn \*_orig +is +NULL . +For subwindows, +it points to the main window +to which the window is subsidiary. +.Vn \*_nextp +is a pointer in a circularly linked list +of all the windows which are subwindows of the same main window, +plus the main window itself. +.pp +.Vn \*_firstch +and +.Vn \*_lastch +are +.Fn malloc ed +arrays which contain the index of the +first and last changed characters +on the line. +.Vn \*_ch\*_off +is the x offset for the window +in the +.Vn \*_firstch +and +.Vn \*_lastch +arrays for this window. +For main windows, +this is always 0; +for subwindows +it is the difference between the starting point of the main window +and that of the subindow, +so that change markers can be set relative to the main window. +This makes these markers global in scope. +.pp +All subwindows share the appropriate portions of +.Vn _y , +.Vn _firstch , +.Vn _lastch , +and +.Vn _insdel +with their main window. +.pp +.b \*_ENDLINE +says that the end of the line for this window +is also the end of a screen. +.b \*_FULLWIN +says that this window is a screen. +.b \*_SCROLLWIN +indicates that the last character of this screen +is at the lower right-hand corner of the terminal; +.i i.e. , +if a character was put there, +the terminal would scroll. +.b \*_FULLLINE +says that the width of a line is the same as the width of the terminal. +If +.b \*_FLUSH +is set, +it says that +.Fn fflush "" "" stdout +should be called at the end of each +.Fn refresh +.b \*_STANDOUT +says that all characters added to the screen +are in standout mode. +.b \*_INSDEL +is reserved for future use, +and is set by +.Fn idlok . +.Vn \*_firstch +is set to +.b \*_NOCHANGE +for lines on which there has been no change +since the last +.Fn refresh . diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/appen.C b/vendor/netbsd-curses/libcurses/PSD.doc/appen.C new file mode 100644 index 0000000..ce12a2e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/appen.C @@ -0,0 +1,126 @@ +.\" $NetBSD: appen.C,v 1.7 2003/08/07 16:44:26 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)appen.C 8.1 (Berkeley) 6/8/93 +.\" +.ie t .oh '\*(Ln Appendix A''PS1:19-%' +.eh 'PS1:19-%''\*(Ln Appendix A' +.el .he ''\fIAppendix A\fR'' +.bp +.(x +.ti 0 +.b "Appendix A" +.)x +.sh 1 "Examples" 1 +.pp +Here we present a few examples +of how to use the package. +They attempt to be representative, +though not comprehensive. +Further examples can be found in the games section +of the source tree and in various utilities that use the screen such as +.i systat(1) . +.sh 2 "Screen Updating" +.pp +The following examples are intended to demonstrate +the basic structure of a program +using the screen updating sections of the package. +Several of the programs require calculational sections +which are irrelevant of to the example, +and are therefore usually not included. +It is hoped that the data structure definitions +give enough of an idea to allow understanding +of what the relevant portions do. +.sh 3 "Simple Character Output" +.pp +This program demonstrates how to set up a window and output characters to it. +Also, it demonstrates how one might control the output to the window. +If you run this program, you will get a demonstration of the character output +chracteristics discussed in the above Character Output section. +.(l I +.so t2.gr +.)l +.sh 3 "A Small Screen Manipulator" +.pp +The next example follows the lines of the previous one but extends then to +demonstrate the various othe uses of the package. +Make sure you understand how this program works as it encompasses most of +anything you will need to do with the package. +.(l I +.so t3.gr +.)l +.sh 3 "Twinkle" +.pp +This is a moderately simple program which prints +patterns on the screen. +It switches between patterns of asterisks, +putting them on one by one in random order, +and then taking them off in the same fashion. +It is more efficient to write this +using only the motion optimization, +as is demonstrated below. +.(l I +.so twinkle1.gr +.)l +.sh 3 "Life" +.pp +This program fragment models the famous computer pattern game of life +(Scientific American, May, 1974). +The calculational routines create a linked list of structures +defining where each piece is. +Nothing here claims to be optimal, +merely demonstrative. +This code, however, +is a very good place to use the screen updating routines, +as it allows them to worry about what the last position looked like, +so you don't have to. +It also demonstrates some of the input routines. +.(l I +.so life.gr +.)l +.sh 2 "Motion optimization" +.pp +The following example shows how motion optimization +is written on its own. +Programs which flit from one place to another without +regard for what is already there +usually do not need the overhead of both space and time +associated with screen updating. +They should instead use motion optimization. +.sh 3 "Twinkle" +.pp +The +.b twinkle +program +is a good candidate for simple motion optimization. +Here is how it could be written +(only the routines that have been changed are shown): +.(l +.so twinkle2.gr +.)l diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/c_macros b/vendor/netbsd-curses/libcurses/PSD.doc/c_macros new file mode 100644 index 0000000..ba03936 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/c_macros @@ -0,0 +1,68 @@ +.\" $NetBSD: c_macros,v 1.5 2003/08/07 16:44:26 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)c_macros 8.1 (Berkeley) 6/4/93 +.\" +'ie t 'ds _ \d\(mi\u +'el 'ds _ _ +'tr *\(** +'ps 9p +'vs 10p +'ds - \(mi +'ds /* \\h'\\w' 'u-\\w'/'u'/* +'bd B 3 +'bd S B 3 +'nr cm 0 +'nf +'de () +'pn 1 +.. +'de +C +'nr cm 1 +'ft 2 +'ds +K +'ds -K +.. +'de -C +'nr cm 0 +'ft 1 +.ie t 'ds +K \f3 +.el 'ds +K \fI +'ds -K \fP +.. +'+C +'-C +'am +C +'ne 3 +.. +'de -F +'rm =f +.. +'ft 1 +'lg 0 diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/doc.I b/vendor/netbsd-curses/libcurses/PSD.doc/doc.I new file mode 100644 index 0000000..01bb3fc --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/doc.I @@ -0,0 +1,347 @@ +.\" $NetBSD: doc.I,v 1.5 2003/08/07 16:44:27 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)doc.I 8.1 (Berkeley) 6/4/93 +.\" +.Ds +.Fd addch ch \*m +char ch; +.Fd waddch win\*,ch +WINDOW *win; +char ch; +.De +Add the character +.Vn ch +on the window +at the current \*y. +If the character is a newline +(\'\en\') +the line will be cleared to the end, +and the current \*y will be changed to the +beginning off the next line +if newline mapping is on, +or to the next line at the same x co-ordinate +if it is off. +A return +(\'\er\') +will move to the beginning of the line on the window. +Tabs +(\'\et\') +will be expanded into spaces +in the normal tabstop positions of +every eight characters. +\*(Es +.Ds +.Fd addstr str \*m +char *str; +.Fd waddstr win\*,str +WINDOW *win; +char *str; +.De +Add the string pointed to by +.Vn str +on the window at the current \*y. +\*(Es +In this case, it will put on as much as it can. +.Ds +.Fd box win\*,vert\*,hor +WINDOW *win; +char vert\*,hor; +.De +.Pp +Draws a box around the window using +.Vn vert +as the character for drawing the vertical sides, and +.Vn hor +for drawing the horizontal lines. +If scrolling is not allowed, +and the window encompasses the lower right-hand corner of the terminal, +the corners are left blank to avoid a scroll. +.Ds +.Fd clear "" \*m +.Fd wclear win +WINDOW *win; +.De +Resets the entire window to blanks. +If +.Vn win +is a screen, +this sets the clear flag, +which will cause a clear-screen sequence to be sent +on the next +.Fn refresh +call. +This also moves the current \*y +to (0\*,0). +.Ds +.Fd clearok scr\*,boolf \*m +WINDOW *scr; +bool boolf; +.De +Sets the clear flag for the screen +.Vn scr . +If +.Vn boolf +is TRUE, +this will force a clear-screen to be printed on the next +.Fn refresh , +or stop it from doing so if +.Vn boolf +is FALSE. +This only works on screens, +and, +unlike +.Fn clear , +does not alter the contents of the screen. +If +.Vn scr +is +.Vn curscr , +the next +.Fn refresh +call will cause a clear-screen, +even if the window passed to +.Fn refresh +is not a screen. +.Ds +.Fd clrtobot "" \*m +.Fd wclrtobot win +WINDOW *win; +.De +Wipes the window clear from the current \*y to the bottom. +This does not force a clear-screen sequence on the next refresh +under any circumstances. +\*(Nm +.Ds +.Fd clrtoeol "" \*m +.Fd wclrtoeol win +WINDOW *win; +.De +Wipes the window clear from the current \*y to the end of the line. +\*(Nm +.Ds +.Fd delch +.Fd wdelch win +WINDOW *win; +.De +Delete the character at the current \*y. +Each character after it on the line shifts to the left, +and the last character becomes blank. +.Ds +.Fd deleteln +.Fd wdeleteln win +WINDOW *win; +.De +Delete the current line. +Every line below the current one will move up, +and the bottom line will become blank. +The current \*y will remain unchanged. +.Ds +.Fd erase "" \*m +.Fd werase win +WINDOW *win; +.De +Erases the window to blanks without setting the clear flag. +This is analagous to +.Fn clear , +except that it never causes a clear-screen sequence to be generated +on a +.Fn refresh . +\*(Nm +.Ds +.Fd flushok win\*,boolf \*m +WINDOW *win; +bool boolf; +.De +Normally, +.Fn refresh +.Fn fflush 's +.Vn stdout +when it is finished. +.Fn flushok +allows you to control this. +if +.Vn boolf +is TRUE +(\c +.i i.e. , +non-zero) +it will do the +.Fn fflush ; +if it is FALSE. +it will not. +.Ds +.Fd idlok win\*,boolf +WINDOW *win; +bool boolf; +.De +Reserved for future use. +This will eventually signal to +.Fn refresh +that it is all right to use the insert and delete line sequences +when updating the window. +.Ds +.Fd insch c +char c; +.Fd winsch win\*,c +WINDOW *win; +char c; +.De +Insert +.Vn c +at the current \*y +Each character after it shifts to the right, +and the last character disappears. +\*(Es +.Ds +.Fd insertln +.Fd winsertln win +WINDOW *win; +.De +Insert a line above the current one. +Every line below the current line +will be shifted down, +and the bottom line will disappear. +The current line will become blank, +and the current \*y will remain unchanged. +.Ds +.Fd move y\*,x \*m +int y\*,x; +.Fd wmove win\*,y\*,x +WINDOW *win; +int y\*,x; +.De +Change the current \*y of the window to +.Vn y\*,x ). ( +\*(Es +.Ds +.Fd overlay win1\*,win2 +WINDOW *win1\*,*win2; +.De +Overlay +.Vn win1 +on +.Vn win2 . +The contents of +.Vn win1 , +insofar as they fit, +are placed on +.Vn win2 +at their starting \*y. +This is done non-destructively, +i.e., blanks on +.Vn win1 +leave the contents of the space on +.Vn win2 +untouched. +.Ds +.Fd overwrite win1\*,win2 +WINDOW *win1\*,*win2; +.De +Overwrite +.Vn win1 +on +.Vn win2 . +The contents of +.Vn win1 , +insofar as they fit, +are placed on +.Vn win2 +at their starting \*y. +This is done destructively, +.i i.e. , +blanks on +.Vn win1 +become blank on +.Vn win2 . +.Ds +.Fd printw fmt\*,arg1\*,arg2\*,... +char *fmt; +.Fd wprintw win\*,fmt\*,arg1\*,arg2\*,... +WINDOW *win; +char *fmt; +.De +Performs a +.Fn printf +on the window starting at the current \*y. +It uses +.Fn addstr +to add the string on the window. +It is often advisable to use the field width options of +.Fn printf +to avoid leaving things on the window from earlier calls. +\*(Es +.Ds +.Fd refresh "" \*m +.Fd wrefresh win +WINDOW *win; +.De +Synchronize the terminal screen with the desired window. +If the window is not a screen, +only that part covered by it is updated. +\*(Es +In this case, it will update whatever it can +without causing the scroll. +.sp +As a special case, +if +.Fn wrefresh +is called with the window +.Vn curscr +the screen is cleared +and repainted as it is currently. +This is very useful for allowing the redrawing of the screen +when the user has garbage dumped on his terminal. +.Ds +.Fd standout "" \*m +.Fd wstandout win +WINDOW *win; +.Fd standend "" \*m +.Fd wstandend win +WINDOW *win; +.De +Start and stop putting characters onto +.i win +in standout mode. +.Fn standout +causes any characters added to the window +to be put in standout mode on the terminal +(if it has that capability). +.Fn standend +stops this. +The sequences +.Vn SO +and +.Vn SE +(or +.Vn US +and +.Vn UE +if they are not defined) +are used (see Appendix A). diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/doc.II b/vendor/netbsd-curses/libcurses/PSD.doc/doc.II new file mode 100644 index 0000000..7209da0 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/doc.II @@ -0,0 +1,140 @@ +.\" $NetBSD: doc.II,v 1.5 2003/08/07 16:44:27 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)doc.II 8.1 (Berkeley) 6/4/93 +.\" +.Ds +.Fd cbreak "" \*m +.Fd nocbreak "" \*m +.Fd crmode "" \*m +.Fd nocrmode "" \*m +.De +Set or unset the terminal to/from cbreak mode. +The misnamed macros +.Fn crmode +and +.Fn nocrmode +are retained for backwards compatibility +with ealier versions of the library. +.Ds +.Fd echo "" \*m +.Fd noecho "" \*m +.De +Sets the terminal to echo or not echo characters. +.Ds +.Fd getch "" \*m +.Fd wgetch win +WINDOW *win; +.De +Gets a character from the terminal and (if necessary) +echos it on the window. +\*(Es +Otherwise, the character gotten is returned. +If +.i noecho +has been set, then the window is left unaltered. +In order to retain control of the terminal, +it is necessary to have one of +.i noecho , +.i cbreak , +or +.i rawmode +set. +If you do not set one, +whatever routine you call to read characters will set +.i cbreak +for you, +and then reset to the original mode when finished. +.Ds +.Fd getstr str \*m +char *str; +.Fd wgetstr win\*,str +WINDOW *win; +char *str; +.De +Get a string through the window +and put it in the location pointed to by +.Vn str , +which is assumed to be large enough to handle it. +It sets tty modes if necessary, +and then calls +.Fn getch +(or +.Fn wgetch ) "" win +to get the characters needed to fill in the string +until a newline or EOF is encountered. +The newline stripped off the string. +\*(Es +.Ds +.Fd \*_putchar c +char c; +.De +Put out a character using the +.Fn putchar +macro. +This function is used to output every character +that +.b curses +generates. +Thus, +it can be redefined by the user who wants to do non-standard things +with the output. +It is named with an initial \*(lq\*_\*(rq +because it usually should be invisible to the programmer. +.Ds +.Fd raw "" \*m +.Fd noraw "" \*m +.De +Set or unset the terminal to/from raw mode. +On version 7 +.Un \** +.(f +\** +.Un +is a trademark of Bell Laboratories. +.)f +this also turns of newline mapping +(see +.Fn nl ). +.Ds +.Fd scanw fmt\*,arg1\*,arg2\*,... +char *fmt; +.Fd wscanw win\*,fmt\*,arg1\*,arg2\*,... +WINDOW *win; +char *fmt; +.De +Perform a +.Fn scanf +through the window using +.Vn fmt . +It does this using consecutive +.Fn getch 's +(or +.Fn wgetch 's). "" win +\*(Es diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/doc.III b/vendor/netbsd-curses/libcurses/PSD.doc/doc.III new file mode 100644 index 0000000..94d4dd2 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/doc.III @@ -0,0 +1,341 @@ +.\" $NetBSD: doc.III,v 1.5 2003/08/07 16:44:27 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)doc.III 8.1 (Berkeley) 6/4/93 +.\" +.Ds +.Fd baudrate "" \*m +.De +Returns the output baud rate of the terminal. +This is a system dependent constant +(defined in +.b +on BSD systems, +which is included by +.b ). +.Ds +.Fd delwin win +WINDOW *win; +.De +Deletes the window from existence. +All resources are freed for future use by +.b calloc (3). +If a window has a +.Fn subwin +allocated window inside of it, +deleting the outer window +the subwindow is not affected, +even though this does invalidate it. +Therefore, +subwindows should be deleted before their +outer windows are. +.Ds +.Fd endwin +.De +Finish up window routines before exit. +This restores the terminal to the state it was before +.Fn initscr +(or +.Fn gettmode +and +.Fn setterm ) +was called. +It should always be called before exiting. +It does not exit. +This is especially useful for resetting tty stats +when trapping rubouts via +.b signal (2). +.Ds +.Fd erasechar "" \*m +.De +Returns the erase character +for the terminal, +.i i.e. , +the character used by the user to erase a single character from the input. +.Ds +.Fd getcap str "" "char *" +char *str; +.De +Return a pointer to the +.b termcap +capability described by +.Vn str +(see +.b termcap (5) +for details). +.Ds +.Fd getyx win\*,y\*,x \*m +WINDOW *win; +int y\*,x; +.De +Puts the current \*y of +.Vn win +in the variables +.Vn y +and +.Vn x . +Since it is a macro, +not a function, +you do not pass the address +of +.Vn y +and +.Vn x . +.Ds +.Fd inch "" \*m +.Fd winch win \*m +WINDOW *win; +.De +Returns the character at the current \*(y +on the given window. +This does not make any changes to the window. +.Ds +.Fd initscr +.De +Initialize the screen routines. +This must be called before any of the screen routines are used. +It initializes the terminal-type data and such, +and without it none of the routines can operate. +If standard input is not a tty, +it sets the specifications to the terminal +whose name is pointed to by +.Vn Def\*_term +(initialy "dumb"). +If the boolean +.Vn My\*_term +is true, +.Vn Def\*_term +is always used. +If the system supports the +.b TIOCGWINSZ +.Fn ioctl "" "" 2 +call, +it is used to get the number of lines and columns for the terminal, +otherwise it is taken from the +.b termcap +description. +.Ds +.Fd killchar "" \*m +.De +Returns the line kill character +for the terminal, +.i i.e. , +the character used by the user to erase an entire line from the input. +.Ds +.Fd leaveok win\*,boolf \*m +WINDOW *win; +bool boolf; +.De +Sets the boolean flag for leaving the cursor after the last change. +If +.Vn boolf +is TRUE, +the cursor will be left after the last update on the terminal, +and the current \*y for +.Vn win +will be changed accordingly. +If it is FALSE, +it will be moved to the current \*y. +This flag +(initialy FALSE) +retains its value until changed by the user. +.Ds +.Fd longname termbuf\*,name +char *termbuf\*,*name; +.Fd fullname termbuf\*,name +char *termbuf\*,*name; +.De +.Fn longname +fills in +.Vn name +with the long name of the terminal described by the +.b termcap +entry in +.Vn termbuf . +It is generally of little use, +but is nice for telling the user in a readable format what terminal +we think he has. +This is available in the global variable +.Vn ttytype . +.Vn termbuf +is usually set via the termlib routine +.Fn tgetent . +.Fn fullname +is the same as +.Fn longname , +except that it gives the fullest name given in the entry, +which can be quite verbose. +.Ds +.Fd mvwin win\*,y\*,x +WINDOW *win; +int y, x; +.De +Move the home position of the window +.Vn win +from its current starting coordinates +to +.Vn y\*,x ). ( +If that would put part or all of the window +off the edge of the terminal screen, +.Fn mvwin +returns ERR and does not change anything. +For subwindows, +.Fn mvwin +also returns ERR if you attempt to move it off its main window. +If you move a main window, +all subwindows are moved along with it. +.Ds +.Fd newwin lines\*,cols\*,begin\*_y\*,begin\*_x "" "WINDOW *" +int lines\*,cols\*,begin\*_y\*,begin\*_x; +.De +Create a new window with +.Vn lines +lines and +.Vn cols +columns starting at position +.Vn begin\*_y\*,begin\*_x ). ( +If either +.Vn lines +or +.Vn cols +is 0 (zero), +that dimension will be set to +.Vn "LINES \- begin\*_y" ) ( +or +.Vn "COLS \- begin\*_x" ) ( +respectively. +Thus, to get a new window of dimensions +.Vn LINES +\(mu +.Vn COLS , +use +.Fn newwin . "" 0\*,0\*,0\*,0 +.Ds +.Fd nl "" \*m +.Fd nonl "" \*m +.De +Set or unset the terminal to/from nl mode, +.i i.e. , +start/stop the system from mapping +.b +to +.b . +If the mapping is not done, +.Fn refresh +can do more optimization, +so it is recommended, but not required, to turn it off. +.Ds +.Fd scrollok win\*,boolf \*m +WINDOW *win; +bool boolf; +.De +Set the scroll flag for the given window. +If +.Vn boolf +is FALSE, scrolling is not allowed. +This is its default setting. +.Ds +.Fd touchline win\*,y\*,startx\*,endx +WINDOW *win; +int y\*,startx\*,endx; +.De +This function performs a function similar to +.Fn touchwin +on a single line. +It marks the first change for the given line +to be +.Vn startx , +if it is before the current first change mark, +and +the last change mark is set to be +.Vn endx +if it is currently less than +.Vn endx . +.Ds +.Fd touchoverlap win1\*,win2 +WINDOW *win1, *win2; +.De +Touch the window +.Vn win2 +in the area which overlaps with +.Vn win1 . +If they do not overlap, +no changes are made. +.Ds +.Fd touchwin win +WINDOW *win; +.De +Make it appear that the every location on the window +has been changed. +This is usually only needed for refreshes with overlapping windows. +.Ds +.Fd subwin win\*,lines\*,cols\*,begin\*_y\*,begin\*_x "" "WINDOW *" +WINDOW *win; +int lines\*,cols\*,begin\*_y\*,begin\*_x; +.De +Create a new window with +.Vn lines +lines and +.Vn cols +columns starting at position +.Vn begin\*_y\*,begin\*_x ) ( +inside the window +.i win . +This means that any change made to either window +in the area covered +by the subwindow will be made on both windows. +.Vn begin\*_y\*,begin\*_x +are specified relative to the overall screen, +not the relative (0\*,0) of +.Vn win . +If either +.Vn lines +or +.Vn cols +is 0 (zero), +that dimension will be set to +.Vn "LINES \- begin\*_y" ) ( +or +.Vn "COLS \- begin\*_x" ) ( +respectively. +.Ds +.Fd unctrl ch \*m +char ch; +.De +This is actually a debug function for the library, +but it is of general usefulness. +It returns a string which is a representation of +.Vn ch . +Control characters become their upper-case equivalents preceded by a "^". +Other letters stay just as they are. +To use +.Fn unctrl , +you may have to have +.b #include\ +in your file. diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/doc.IV b/vendor/netbsd-curses/libcurses/PSD.doc/doc.IV new file mode 100644 index 0000000..8f60c0e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/doc.IV @@ -0,0 +1,108 @@ +.\" $NetBSD: doc.IV,v 1.5 2003/08/07 16:44:27 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)doc.IV 8.1 (Berkeley) 6/4/93 +.\" +.Ds +.Fd gettmode +.De +Get the tty stats. +This is normally called by +.Fn initscr . +.Ds +.Fd mvcur lasty\*,lastx\*,newy\*,newx +int lasty\*,lastx\*,newy\*,newx; +.De +Moves the terminal's cursor from +.Vn lasty\*,lastx ) ( +to +.Vn newy\*,newx ) ( +in an approximation of optimal fashion. +This routine uses the functions borrowed from +.i ex +version 2.6. +It is possible to use this optimization +without the benefit of the screen routines. +With the screen routines, this should not be called by the user. +.Fn move +and +.Fn refresh +should be used to move the cursor position, +so that the routines know what's going on. +.Ds +.Fd scroll win +WINDOW *win; +.De +Scroll the window upward one line. +This is normally not used by the user. +.Ds +.Fd savetty "" \*m +.Fd resetty "" \*m +.De +.Fn savetty +saves the current tty characteristic flags. +.Fn resetty +restores them to what +.Fn savetty +stored. +These functions are performed automatically by +.Fn initscr +and +.Fn endwin . +.Ds +.Fd setterm name +char *name; +.De +Set the terminal characteristics to be those of the terminal named +.Vn name , +getting the terminal size from the +.b TIOCGWINSZ +.Fn ioctl "" "" 2 +if it exists, +otherwise from the environment. +This is normally called by +.Fn initscr . +.Ds +.Fd tstp +.De +If the new +.b tty (4) +driver is in use, +this function +will save the current tty state +and then put the process to sleep. +When the process gets restarted, +it restores the tty state +and then calls +.Fn wrefresh "" "" curscr +to redraw the screen. +.Fn initscr +sets the signal +SIGTSTP +to trap to this routine. diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/ex1.c b/vendor/netbsd-curses/libcurses/PSD.doc/ex1.c new file mode 100644 index 0000000..27f2583 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/ex1.c @@ -0,0 +1,100 @@ +.\" $NetBSD: ex1.c,v 1.6 2003/08/07 16:44:27 agc Exp $ +.\" +.\" Copyright (c) 1992, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)ex1.c 8.1 (Berkeley) 6/8/93 +.\" +#include +#include +#include +#include + + +#define YSIZE 10 +#define XSIZE 20 + +int quit(); + +main() +{ + int i, j, c; + size_t len; + char id[100]; + FILE *fp; + char *s; + + initscr(); /* Always call initscr() first */ + signal(SIGINT, quit); /* Make sure wou have a 'cleanup' fn */ + crmode(); /* We want cbreak mode */ + noecho(); /* We want to have control of chars */ + delwin(stdscr); /* Create our own stdscr */ + stdscr = newwin(YSIZE, XSIZE, 10, 35); + flushok(stdscr, TRUE); /* Enable flushing of stdout */ + scrollok(stdscr, TRUE); /* Enable scrolling */ + erase(); /* Initially, clear the screen */ + + standout(); + move(0,0); + while (1) { + c = getchar(); + switch(c) { + case 'q': /* Quit on 'q' */ + quit(); + break; + case 's': /* Go into standout mode on 's' */ + standout(); + break; + case 'e': /* Exit standout mode on 'e' */ + standend(); + break; + case 'r': /* Force a refresh on 'r' */ + wrefresh(curscr); + break; + default: /* By default output the character */ + addch(c); + refresh(); + } + } +} + + +int +quit() +{ + erase(); /* Terminate by erasing the screen */ + refresh(); + endwin(); /* Always end with endwin() */ + delwin(curscr); /* Return storage */ + delwin(stdscr); + putchar('\n'); + exit(0); +} + + + + diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/ex2.c b/vendor/netbsd-curses/libcurses/PSD.doc/ex2.c new file mode 100644 index 0000000..f2e6e7d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/ex2.c @@ -0,0 +1,208 @@ +.\" $NetBSD: ex2.c,v 1.7 2003/08/07 16:44:27 agc Exp $ +.\" +.\" Copyright (c) 1992, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)ex2.c 8.1 (Berkeley) 6/8/93 +.\" +#include +#include +#include + +#define YSIZE LINES +#define XSIZE COLS + +static int quit(); + +/* + * This program fills the screen up with characters and the allows the user to + * manipulate the text on the screen using some basic commands. + * Nothing fancy, just a demonstration of the elementary features of the + * curses(3) package. + */ +main() +{ + int i, j, c, n, d = 0; + char id[100]; + int hh = 0; + int curx, cury, base, arg; + + initscr(); + signal(SIGINT, quit); + crmode(); + noecho(); + nonl(); + delwin(stdscr); + stdscr = newwin(YSIZE, XSIZE, 0, 0); + flushok(stdscr, TRUE); + scrollok(stdscr, TRUE); + erase(); + refresh(); + + move(0,0); + refresh(); + for (i = 0; i < YSIZE + 2; i++) { + (void)snprintf(id, sizeof id, "%d: ", i); + addstr(id); + for (j = 0; j < XSIZE - strlen(id); j++) + addch('0' + (i % 10)); + } + c = getchar(); + base = 2; + curx = cury = 0; + move(0, 0); + refresh(); + + /* + * The screen manipulator has the following commands: + * 'D' - clear to the end of the current line. + * 'B' - clear to the bottom of the screen. + * 'E' - erase the screen. + * 's' - enter standout mode. + * 'e' - exit standout mode. + * 'd' n - delete n lines below cursor line. + * 'i' n - insert n lines below cursor line. + * 'q' - quit. + * 'f' - move cursor one position to the right. + * 'b' - move cursor one position to the left. + * 'n' - move cursor one line down. + * 'p' - move cursor one line up. + * 'h' - home cusor. + * 'l' - force refresh. + * 'r' - simulate a carriage return. + * + * All other characters are ignored. + */ + for(;;) { + switch(c = getchar()) { + case 'D': + clrtoeol(); + refresh(); + continue; + case 'B': + clrtobot(); + refresh(); + continue; + case 'E': + erase(); + refresh(); + continue; + case 's': + standout(); + continue; + case 'e': + standend(); + continue; + case 'd': + arg = getchar() - '0'; + for (i = 0; i < arg; i++) + deleteln(); + refresh(); + continue; + case 'i': + arg = getchar() - '0'; + for (i = 0; i < arg; i++) + insertln(); + refresh(); + continue; + case 'q': + quit(); + case 'f': + if (curx < XSIZE - 1) + curx++; + else { + cury++; + curx = 0; + } + break; + case 'b': + if (curx == 0) { + cury--; + curx = XSIZE - 1; + } else + curx--; + break; + case 'n': + cury++; + break; + case 'p': + cury--; + break; + case 'h': + curx = cury = 0; + break; + case 'l': + wrefresh(curscr); + continue; + case 'r': /* return */ + { + int x, y; + getyx(stdscr, y, x); + move(y+1, 0); + insertln(); + move(y, x); + clrtoeol(); + refresh(); + continue; + } + default: + continue; + } + + if (cury < 0) { + base--; + move(0, 0); + insertln(); + (void)snprintf(id, sizeof id, "%d: ", base); + addstr(id); + for (j = 0; j < XSIZE - strlen(id) - 2; j++) + addch('0' + (base % 10)); + cury++; + } else if (cury >= YSIZE) { + move(0, 0); + deleteln(); + move(YSIZE - 1, 0); + (void)snprintf(id, sizeof id, "%d: ", base + YSIZE); + addstr(id); + for (j = 0; j < XSIZE - strlen(id) - 2; j++) + addch('0' + ((base + YSIZE) % 10)); + cury--; + base++; + } + move(cury, curx); + refresh(); + } +} + +int +quit() +{ + erase(); + refresh(); + endwin(); + exit(0); +} diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/fns.doc b/vendor/netbsd-curses/libcurses/PSD.doc/fns.doc new file mode 100644 index 0000000..8880dcf --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/fns.doc @@ -0,0 +1,1757 @@ +.\" Copyright (c) 1992, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)fns.doc 8.2 (Berkeley) 6/1/94 +.\" +.Ds +.Fn addbytes "char *str" "int len" +.De +This function is the low level character output function. +.Vn Len +characters of the string +.Vn str +are output to the current \*y position of the window. +.Ds +.Fn addch "chtype ch" \(dg +.De +Add the character +.Vn ch +on the window +at the current \*y. +If the character is a newline +(\'\en\') +the line will be cleared to the end, +and the current \*y will be changed to the +beginning off the next line +if newline mapping is on, +or to the next line at the same x co-ordinate +if it is off. +A return +(\'\er\') +will move to the beginning of the line on the window. +Tabs +(\'\et\') +will be expanded into spaces +in the normal tabstop positions of +every eight characters. +\*(Es +.Ds +.Fn addchstr "chtype *str" \(dg +.De +Add the characters and attributes in the string pointed to by +.Vn str +on the window at the current \*y. +\*(Es +In this case, it will put on as much as it can. +.Ds +.Fn addchnstr "chtype *str" "int len" \(dg +.De +Add no more than +.Vn len +characters and attributes of the string pointed to by +.Vn str +on the window at the current \*y. +\*(Es +In this case, it will put on as much as it can. +.Ds +.Fn addstr "char *str" \(dg +.De +Add the string pointed to by +.Vn str +on the window at the current \*y. +\*(Es +In this case, it will put on as much as it can. +.Ds +.Fn addnstr "char *str" "int len" \(dg +.De +Add no more than +.Vn len +characters of the string pointed to by +.Vn str +on the window at the current \*y. +\*(Es +In this case, it will put on as much as it can. +.Ds +.Fn assume_default_colors "short fore" "short back" +.De +Set the curses default foreground and background colors to +.Vn fore +and +.Vn back . +.Ds +.Fn attr_get "attr_t *attr" "short *pair" "void *opt" \(dg +.De +Get the attributes and colour pair for the window. +Either +.Vn attr +or +.Vn pair +may be NULL. +The +.Vn opt +argument is not used. +.Ds +.Fn attr_off "attr_t attr" "void *opt" \(dg +.De +Remove character attributes set by +.Fn attr_on +or +.Fn attr_set . +.Ds +.Fn attr_on "attr_t attr" "void *opt" \(dg +.De +Add character attributes for any characters +added to the window (if it has that capability). +The attributes that can be set are \fBA_UNDERLINE\fR, +\fBA_REVERSE\fR, \fBA_BLINK\fR, \fBA_DIM\fR, +\fBA_BOLD\fR, \fBA_BLANK\fR, \fBA_PROTECT\fB, +\fBA_ALTCHARSET\fR and \fBCOLOR_PAIR(n)\fR. +.Ds +.Fn attr_set "attr_t attr" "short pair" "void *opt" \(dg +.De +Set character attributes and color pair for any characters +added to the window (if it has that capability). +.Ds +.Fn attroff "int attribute" \(dg +.De +Remove character attributes set by +.Fn attron +or +.Fn attrset . +To clear all character attributes, use +.Fn attroff "A_ATTRIBUTES" . +.Fn attroff "A_STANDOUT" +is equivalent to +.Fn standend . +.Fn attroff "A_UNDERLINE" +is equivalent to +.Fn underend . +.Ds +.Fn attron "int attribute" \(dg +.De +Add character attributes for any characters +added to the window (if it has that capability). +.Fn attron "A_STANDOUT" +is equivalent to +.Fn standout . +.Fn attron "A_UNDERLINE" +is equivalent to +.Fn underscore . +.Ds +.Fn attrset "int attribute" \(dg +.De +Set character attributes for any characters +added to the window (if it has that capability). +.Ds +.Fn baudrate "" \(dg +.De +Returns the output baud rate of the terminal. +This is a system dependent constant +(defined in +.b +on BSD systems, +which is included by +.b ). +.Ds +.Fn beep "" +.De +Sound the terminal bell. If the terminal has no bell capability, +but has the ability to flash the screen, do that instead. See also +.Fn flash +.Ds +.Fn bkgd "chtype ch" +.De +Sets the background rendition to +.Vn ch . +.Ds +.Fn bkgdset "chtype ch" +.De +Sets the background rendition to +.Vn ch +and applies this rendition to the window. +.Ds +.Fn border "chtype left" "chtype right" "chtype top" "chtype bottom" "chtype topleft" "chtype topright" "chtype botleft" "chtype botright" +.De +.Pp +Draws a border around the window using the characters: +.Vn left +for drawing the left side, +.Vn right +for drawing the left side, +.Vn top +for drawing the top edge, +.Vn bottom +for drawing the top edge, +.Vn topleft +for drawing the top-left corner, +.Vn topright +for drawing the top-right corner, +.Vn botleft +for drawing the bottom-left corner, and +.Vn botright +for drawing the bottom-right corner. If scrolling is not allowed, +and the window encompasses the lower right-hand corner of the terminal, +the corners are left blank to avoid a scroll. +.Ds +.Fn box "WINDOW win" "chtype vert" "chtype hor" +.De +.Pp +Draws a box around the window using +.Vn vert +as the character for drawing the vertical sides, and +.Vn hor +for drawing the horizontal lines. +If scrolling is not allowed, +and the window encompasses the lower right-hand corner of the terminal, +the corners are left blank to avoid a scroll. +.Ds +.Fn can_change_color "" +.De +Check if terminal can change colors. +.Ds +.Fn cbreak "" +.De +Set the terminal to cbreak mode. +.Ds +.Fn clear "" \(dg +.De +Resets the entire window to blanks. +If +.Vn win +is a screen, +this sets the clear flag, +which will cause a clear-screen sequence to be sent +on the next +.Fn refresh +call. +This also moves the current \*y +to (0\*,0). +.Ds +.Fn clearok "WINDOW *scr" "int boolf" \(dg +.De +Sets the clear flag for the screen +.Vn scr . +If +.Vn boolf +is non-zero, +this will force a clear-screen to be printed on the next +.Fn refresh , +or stop it from doing so if +.Vn boolf +is 0. +This only works on screens, +and, +unlike +.Fn clear , +does not alter the contents of the screen. +If +.Vn scr +is +.Vn curscr , +the next +.Fn refresh +call will cause a clear-screen, +even if the window passed to +.Fn refresh +is not a screen. +.Ds +.Fn clrtobot "" \(dg +.De +Wipes the window clear from the current \*y to the bottom. +This does not force a clear-screen sequence on the next refresh +under any circumstances. +\*(Nm +.Ds +.Fn clrtoeol "" \(dg +.De +Wipes the window clear from the current \*y to the end of the line. +\*(Nm +.Ds +.Fn color_content "short color" "short *red" "short *green" "short *blue" +.De +Get the red, green and blue values of color +.Vn color . +.Ds +.Fn color_set "short pair" "void *opt" \(dg +.De +Set color pair for any characters added to the window (if it has +that capability). +.Ds +.Fn copywin "const WINDOW *src" "WINDOW *dst" "int sminrow" "int smincol" "int dminrow" "int dmincol" "int dmaxrow" "int dmaxcol" "int overlay" +.De +Copies the contents of the window +.Vn src +starting at ( +.Vn sminrow , +.Vn smincol ) +to the destination window +.Vn dst +starting at ( +.Vn dminrow , +.Vn dmincol ) +and ending at either the end of the source window or ( +.Vn dmaxrow , +.Vn dmaxcol ) +whichever is the lesser. The parameter +.Vn overlay +determines the nature of the copy. If +.Vn overlay +is TRUE then only the non-space characters from +.Vn src +are copied to +.Vn dst . +If +.Vn overlay +is FALSE then all characters are copied from +.Vn src +to +.Vn dst. +.Ds +.Fn curs_set "int visibility" +.De +Sets the visibility of the screen cursor. The parameter +.Vn visibility +can be one of three values, 0 means make the cursor invisible, 1 means +set the cursor to normal visibility and 2 sets the cursor to high +visibility. In all cases the old mode of the cursor is returned if +the call was successful and +.b ERR +is returned if the terminal cannot support the requested visibility +mode. +.Ds +.Fn crmode "" \(dg +.De +Identical to +.Fn cbreak . +The misnamed macro +.Fn crmode +and +.Fn nocrmode +is retained for backwards compatibility +with ealier versions of the library. +.Ds +.Fn delay_output "int ms" +.De +Pause output for +.Vn ms +milliseconds using the terminal pad character. +.Ds +.Fn def_prog_mode "" +.De +Save the current terminal modes as the \'in curses\' state for use with +.Fn reset_prog_mode . +.Ds +.Fn def_shell_mode "" +.De +Save the current terminal modes as the \'not in curses\' state for use with +.Fn reset_shell_mode . +.Ds +.Fn define_key "char *sequence" "int key_symbol" +.De +Assigns the character sequence given in +.Vn sequence +to the key symbol +.Vn key_symbol . +If +.Fn keypad +has set been set TRUE and the character sequence is found in the input +stream then the key symbol defined will be returned. Normally the +sequences are found in the +.b termcap +database but this function allows extensions to be added by the +application. If +.Vn sequence +is a NULL pointer then all the sequences associated with +.Vn key_symbol +will be removed, including any definitions inserted by +.b termcap . +.Ds +.Fn delch "" +.De +Delete the character at the current \*y. +Each character after it on the line shifts to the left, +and the last character becomes blank. +.Ds +.Fn deleteln "" +.De +Delete the current line. +Every line below the current one will move up, +and the bottom line will become blank. +The current \*y will remain unchanged. +.Ds +.Fn delscreen "SCREEN *screen" +.De +Delete the screen and frees all associated resources. +.Ds +.Fn delwin "WINDOW *win" +.De +Deletes the window from existence. +All resources are freed for future use by +.b calloc (3). +If a window has a +.Fn subwin +allocated window inside of it, +deleting the outer window +the subwindow is not affected, +even though this does invalidate it. +Therefore, +subwindows should be deleted before their +outer windows are. +.Ds +.Fn derwin "WINDOW *orig" "int nlines" "int ncols" "int by" "int bx" +.De +Performs a function very similar to that of +.Fn subwin . +The difference being that with +.Fn derwin +the origin of the child window given by ( +.Vn by , +.Vn bx ) +is relative to the origin of the parent window +.Vn orig +instead of being absolute screen coordinates as they are in +.Fn subwin . +.Ds +.Fn doupdate "" +.De +Synchronize the terminal screen with the virtual screen that +has had window contents added to it by calls to +.Fn wnoutrefresh . +.Ds +.Fn dupwin "WINDOW *win" +.De +Creates an exact copy of the window +.Vn win . +.Ds +.Fn echo "" \(dg +.De +Sets the terminal to echo characters. +.Ds +.Fn echochar "const chtype ch" \(dg +.De +Add the character +.Vn ch +on the window +at the current \*y and immediately refresh the window. +.Ds +.Fn endwin "" +.De +Finish up window routines before exit. +This restores the terminal to the state it was before +.Fn initscr +(or +.Fn gettmode +and +.Fn setterm ) +was called. +It should always be called before exiting and before the final calls to +.Fn delwin . +It does not exit. +This is especially useful for resetting tty stats +when trapping rubouts via +.b signal (2). +.Ds +.Fn erase "" \(dg +.De +Erases the window to blanks without setting the clear flag. +This is analagous to +.Fn clear , +except that it never causes a clear-screen sequence to be generated +on a +.Fn refresh . +\*(Nm +.Ds +.Fn erasechar "" \(dg +.De +Returns the erase character +for the terminal, +.i i.e. , +the character used by the user to erase a single character from the input. +.Ds +.Fn flash "" +.De +Flash the terminal screen. If the terminal has no flash capability, +but has the ability to sound the bell, do that instead. See also +.Fn bell +.Ds +.Fn flushinp "" +.De +Throw away any input that has been typed by the user but has not yet +been read by the program. +.Ds +.Fn flushok "WINDOW *win" "int boolf" +.De +Normally, +.Fn refresh +.Fn fflush 's +.Vn stdout +when it is finished. +.Fn flushok +allows you to control this. +if +.Vn boolf +is non-zero +(\c +.i i.e. , +non-zero) +it will do the +.Fn fflush , +otherwise it will not. +.Ds +.Fn getattrs "WINDOW *win" +.De +Gets the attributes for +.Vn win . +.Ds +.Fn getbkgd "WINDOW *win" +.De +Gets the background rendition for +.Vn win . +.Ds +.Fn getcap "char *name" +.De +Get the terminal capability +.Vn name . +.Ds +.Fn getch "" \(dg +.De +Gets a character from the terminal and (if necessary) +echos it on the window. +\*(Es +Otherwise, the character gotten is returned. +If +.i noecho +has been set, then the window is left unaltered. +In order to retain control of the terminal, +it is necessary to have one of +.i noecho , +.i cbreak , +or +.i rawmode +set. +If you do not set one, +whatever routine you call to read characters will set +.i cbreak +for you, +and then reset to the original mode when finished. +.Ds +.Fn getcury "WINDOW *win" +.De +Get current y position on +.Vn win . +.Ds +.Fn getcurx "WINDOW *win" +.De +Get current x position on +.Vn win . +.Ds +.Fn getbegy "WINDOW *win" +.De +Get start y position on +.Vn win . +.Ds +.Fn getbegx "WINDOW *win" +.De +Get start x position on +.Vn win . +.Ds +.Fn getmaxy "WINDOW *win" +.De +Get maximum y position on +.Vn win . +.Ds +.Fn getmaxx "WINDOW *win" +.De +Get maximum x position on +.Vn win . +.Ds +.Fn getnstr "char *str" \(dg +.De +Get a string through the window +and put it in the location pointed to by +.Vn str . +A maximum of +.Vn n +characters is returned (including the trailing null). +It sets tty modes if necessary, +and then calls +.Fn getch +(or +.Fn wgetch ) +to get the characters needed to fill in the string +until a newline or EOF is encountered. +The newline stripped off the string. +\*(Es +.Ds +.Fn getstr "char *str" \(dg +.De +Get a string through the window +and put it in the location pointed to by +.Vn str , +which is assumed to be large enough to handle it. +It sets tty modes if necessary, +and then calls +.Fn getch +(or +.Fn wgetch ) +to get the characters needed to fill in the string +until a newline or EOF is encountered. +The newline stripped off the string. +\*(Es +.Ds +.Fn getparx "WINDOW *win" +.De +Returns the x location of the given subwindow relative to the parent +window. If the window is not a subwindow then -1 is returned. +.Ds +.Fn getpary "WINDOW *win" +.De +Returns the y location of the given subwindow relative to the parent +window. If the window is not a subwindow then -1 is returned. +.Ds +.Fn getpary "WINDOW *win" "int y" "int x" +.De +Is a macro that sets the +.Vn y +and +.Vn x +parameters to the respective coordinates of the top left hand corner +of the subwindow relative to the parent window. If the given window +.Vn win +is not a subwindow then both +.Vn y +and +.Vn x +will be set to -1. +.Ds +.Fn gettmode "" +.De +Get the tty stats. +This is normally called by +.Fn initscr . +.Ds +.Fn getwin "FILE *fp" +.De +Creates a window from a file written by +.Fn putwin . +.Ds +.Fn getyx "WINDOW *win" "int y" "int x" +.De +Puts the current \*y of +.Vn win +in the variables +.Vn y +and +.Vn x . +Since it is a macro, +not a function, +you do not pass the address +of +.Vn y +and +.Vn x . +.Ds +.Fn halfdelay "int timeout" +.De +Sets the terminal into a mode similar to that done by +.Fn cbreak +with the exception that the input routines will wait for +.Vn timeout +number of tenths of a second, if at this time there is no input then +ERR will be returned. +.Ds +.Fn has_colors "" +.De +Check if terminal has colors. +.Ds +.Fn hline "chtype ch" "int count" +.De +Draw a horizontal line of the character ch starting at the current +cursor position and moving towards the rightmost column. At most +.Vn count +characters will be written, less if the edge of the screen is reached +before +.Vn count +is reached. +.Ds +.Fn idcok "WINDOW *win" "int boolf" +.De +Reserved for future use. +This will eventually signal to +.Fn refresh +that it is all right to use the insert and delete char sequences +when updating the window. +.Ds +.Fn idlok "WINDOW *win" "int boolf" +.De +Reserved for future use. +This will eventually signal to +.Fn refresh +that it is all right to use the insert and delete line sequences +when updating the window. +.ne 1i +.Ds +.Fn inch "" \(dg +.De +Returns the character at the current position on the given window. +This does not make any changes to the window. +.Ds +.Fn inchnstr "chtype *chstr" "int n" +.De +Get an array of at most +.Vn n +characters and renditions starting at the current cursor position and +ending at the end of the line and put it in the location pointed to by +.Vn chstr . +.Ds +.Fn inchstr "chtype *chstr" +.De +Get an array of characters and renditions starting at the current cursor +position and ending at the end of the line and put it in the location +pointed to by +.Vn chstr , +which is assumed to be large enough to handle it. +.Ds +.Fn innstr "char *str" "int n" +.De +Get a string of at most +.Vn n +characters starting at the current cursor position and ending at the end +of the line and put it in the location pointed to by +.Vn str . +.Ds +.Fn init_color "short color" "short red" "short green" "short blue" +.De +Set the red, green and blue values of color +.Vn color . +.Ds +.Fn init_pair "short pair" "short fore" "short back" +.De +Set the foreground and background colors of pair +.Vn pair . +.Ds +.Fn initscr "" +.De +Initialize the screen routines. +This must be called before any of the screen routines are used. +It initializes the terminal-type data and such, +and without it none of the routines can operate. +If standard input is not a tty, +it sets the specifications to the terminal +whose name is pointed to by +.Vn Def\*_term +(initially "dumb"). +If the boolean +.Vn My\*_term +is non-zero, +.Vn Def\*_term +is always used. +If the system supports the +.b TIOCGWINSZ +.i ioctl(2) +call, +it is used to get the number of lines and columns for the terminal, +otherwise it is taken from the +.b termcap +description. +.Ds +.Fn insch "char c" +.De +Insert +.Vn c +at the current \*y +Each character after it shifts to the right, +and the last character disappears. +\*(Es +.Ds +.Fn insdelln "int n" +.De +If +.Vn n +is positive insert +.Vn n +lines above the current one. +Every line below the current line +will be shifted down, +and the last +.Vn n +lines will disappear. +If +.Vn n +is negative, delete +.Vn n +lines starting from the current one. +The last +.Vn n +lines are cleared. +The current \*y will remain unchanged. +.Ds +.Fn insertln "" +.De +Insert a line above the current one. +Every line below the current line +will be shifted down, +and the bottom line will disappear. +The current line will become blank, +and the current \*y will remain unchanged. +.Ds +.Fn instr "char *str" +.De +Get an string starting at the current cursor position and ending at the +end of the line and put it in the location pointed to by +.Vn str , +which is assumed to be large enough to handle it. +.Ds +.Fn is_linetouched "WINDOW *win" "int line" +.De +Returns TRUE if +.Vn line +in the window +.Vn win +has been modified since the last call to +.Fn wrefresh . +.Ds +.Fn is_wintouched "WINDOW *win" "int line" +.De +Returns TRUE if the window +.Vn win +has been modified since the last call to +.Fn wrefresh . +.Ds +.Fn isendwin "" +.De +Returns TRUE if +.Fn endwin +has been called without a subsequent call to +.Fn wrefresh , +and FALSE otherwise. +.Ds +.Fn intrflush "WINDOW *win" "int boolf" +.De +Sets the terminal flush on interrupt mode. If +.Vn boolf +is non-zero, flushing of the output buffer will occur when an +interrupt key is pressed. The default is inherited from the +terminal settings. +.Ds +.Fn keyok "int key_symbol" "bool flag" +.De +Controls the recognition of the key symbol +.Vn key_symbol . +By setting +.Vn flag +to FALSE the recognition of any sequence of characters +that have been associated with the key symbol will be disabled. +By default, this flag is TRUE so sequences will be recognised. +.Ds +.Fn keyname "int key" +.De +Returns a description of the key +.Vn key . +.Ds +.Fn keypad "WINDOW *win" "int boolf" +.De +Sets the boolean flag for interpretation of escape sequences. If +.Vn boolf +is non-zero, escape sequences from terminal keypad and function +keys will be interpreted by the library. Escape sequences are not +interpreted by default. The include file +.b +contains the list of recognised keypad and function keys. See also +.Fn notimeout . +.Ds +.Fn killchar "" \(dg +.De +Returns the line kill character +for the terminal, +.i i.e. , +the character used by the user to erase an entire line from the input. +.Ds +.Fn leaveok "WINDOW *win" "int boolf" \(dg +.De +Sets the boolean flag for leaving the cursor after the last change. +If +.Vn boolf +is non-zero, +the cursor will be left after the last update on the terminal, +and the current \*y for +.Vn win +will be changed accordingly. +If +.Vn boolf + is 0 the cursor will be moved to the current \*y. +This flag +(initially 0) +retains its value until changed by the user. +.Ds +.Fn longname "" \(dg +.De +Returns a string containing the verbose description of the terminal. +.Ds +.Fn meta "WINDOW *win" "bool bf" +.De +Manipulates the meta mode on terminals that support this capability. +Note that +.Vn win +is always ignored. +.Ds +.Fn move "int y" "int x" +.De +Change the current \*y of the window to +.Vn y\*,x ). ( +\*(Es +.Ds +.Fn mvaddch "int y" "int x" "chtype ch" +.De +Moves the cursor to the position +.Vn (y , +.Vn x ) +and then adds a character in the same manner as +.Fn addch . +.Ds +.Fn mvaddchstr "int y" "int x" "chtype *str" \(dg +.De +Moves the cursor to the position +.Vn (y , +.Vn x ) +and then adds characters and attributes in the same manner as +.Fn addchstr . +.Ds +.Fn mvaddchnstr "int y" "int x" "chtype *str" \(dg +.De +Moves the cursor to the position +.Vn (y , +.Vn x ) +and then adds characters and attributes in the same manner as +.Fn addchnstr . +.Ds +.Fn mvaddstr "int y" "int x" "char *str" \(dg +.De +Moves the cursor to the position +.Vn (y , +.Vn x ) +and then adds a string in the same manner as +.Fn addstr . +.Ds +.Fn mvaddnstr "int y" "int x" "char *str" \(dg +.De +Moves the cursor to the position +.Vn (y , +.Vn x ) +and then adds a string in the same manner as +.Fn addnstr . +.Ds +.Fn mvcur "int lasty" "int lastx" "int newy" "int newx" +.De +Moves the terminal's cursor from +.Vn lasty\*,lastx ) ( +to +.Vn newy\*,newx ) ( +in an approximation of optimal fashion. +This routine uses the functions borrowed from +.i ex +version 2.6. +It is possible to use this optimization +without the benefit of the screen routines. +With the screen routines, this should not be called by the user. +.Fn move +and +.Fn refresh +should be used to move the cursor position, +so that the routines know what's going on. +.Ds +.Fn mvderwin "WINDOW *win" "int y" "int x" +.De +Moves the subwindow +.Vn win +to the location +.Vn y\*,x ) ( +where the location is relative to the top left hand corner of the +parent window. This call will return ERR if +.Vn win +is not a subwindow or if the relocated window would lie outside the +parent window. +.Ds +.Fn mvhline "int y" "int x" "chtype ch" "int count" +.De +Moves the cursor to the position +.Vn (y , +.Vn x ) +and then draws a horizontal line in the same manner as +.Fn hline . +.Ds +.Fn mvprintw "int y" "int x" "const char *fmt" "..." +.De +Equivalent to: +.(l +move(y, x); +printw(fmt, ...); +.)l +.Ds +.Fn mvscanw "int y" "int x" "const char *fmt" "..." +.De +Equivalent to: +.(l +move(y, x); +scanw(fmt, ...); +.)l +.Ds +.Fn mvvline "int y" "int x" "chtype ch" "int count" +.De +Moves the cursor to the position +.Vn (y , +.Vn x ) +and then draws a vertical line in the same manner as +.Fn vline . +.Ds +.Fn mvwhline "WINDOW *win" "int y" "int x" "chtype ch" "int count" +.De +Moves the cursor to the position +.Vn (y , +.Vn x ) +on window +.Vn win +and then draws a horizontal line in the same manner as +.Fn whline . +.Ds +.Fn mvwvline "WINDOW *win" "int y" "int x" "chtype ch" "int count" +.De +Moves the cursor to the position +.Vn (y , +.Vn x ) +on window +.Vn win +and then draws a horizontal line in the same manner as +.Fn wvline . +.Ds +.Fn mvwin "WINDOW *win" "int y" "int x" +.De +Move the home position of the window +.Vn win +from its current starting coordinates +to +.Vn y\*,x ). ( +If that would put part or all of the window +off the edge of the terminal screen, +.Fn mvwin +returns ERR and does not change anything. +For subwindows, +.Fn mvwin +also returns ERR if you attempt to move it off its main window. +If you move a main window, +all subwindows are moved along with it. +.Ds +.Fn mvwprintw "WINDOW *win" "int y" "int x" "const char *fmt" "..." +.De +Equivalent to: +.(l +wmove(win, y, x); +printw(fmt, ...); +.)l +.Ds +.Fn mvwscanw "WINDOW *win" "int y" "int x" "const char *fmt" "..." +.De +Equivalent to: +.(l +wmove(win, y, x); +scanw(fmt, ...); +.)l +.Ds +.Fn napms "int ms" +.De +Sleep for +.Vn ms +milliseconds. +.Ds +.Ft "WINDOW *" +.Fn newpad "int lines" "int cols" +.De +Create a new pad with +.Vn lines +lines and +.Vn cols +columns. +.Ds +.Ft "SCREEN *" +.Fn newterm "char *type" "FILE *outfd" "FILE *infd" +.De +Iinitialise the curses subsystem to use the terminal of type +.Vn type +connected via the input and output streams +.Vn infd,outfd. +The +.Fn newterm +is used in multi-terminal applications and returns a pointer to a +.Ft "SCREEN" +structure that holds the state for that particular terminal. The +application may swap between the terminals by calling the +.Fn set_term +function. If the +.Vn type +parameter is NULL then the $TERM variable is used as the terminal type. +.Ds +.Ft "WINDOW *" +.Fn newwin "int lines" "int cols" "int begin_y" "int begin_x" +.De +Create a new window with +.Vn lines +lines and +.Vn cols +columns starting at position +.Vn begin\*_y\*,begin\*_x ). ( +If either +.Vn lines +or +.Vn cols +is 0 (zero), +that dimension will be set to +.Vn "LINES \- begin\*_y" ) ( +or +.Vn "COLS \- begin\*_x" ) ( +respectively. +Thus, to get a new window of dimensions +.Vn LINES +\(mu +.Vn COLS , +use +.Fn newwin 0 0 0 0 . +.Ds +.Fn nl "" +.De +Set the terminal to nl mode, +.i i.e. , +start/stop the system from mapping +.b +to +.b . +If the mapping is not done, +.Fn refresh +can do more optimization, +so it is recommended, but not required, to turn it off. +.Ds +.Fn no_color_video "" +.De +Return attributes that cannot be combined with color. +.Ds +.Fn nocbreak "" +.De +Unset the terminal from cbreak mode. +.Ds +.Fn nocrmode "" \(dg +.De +Identical to +.Fn nocbreak . +The misnamed macro +.Fn nocrmode +is retained for backwards compatibility +with ealier versions of the library. +.Ds +.Fn nodelay "WINDOW *win1" "int boolf" +.De +Sets the boolean flag for non-blocking +.Fn getch . +If +.Vn boolf +is non-zero, +.Fn getch +will return ERR is no input is waiting. The default +is to for +.Fn getch +to block indefinitely. See also +.Fn timeout . +.Ds +.Fn noecho "" \(dg +.De +Turn echoing of characters off. +.Ds +.Fn nonl "" +.De +Unset the terminal to from nl mode. See +.Fn nl . +.ne 1i +.Ds +.Fn noqiflush \(dg +.De +Unset the terminal flush on interrupt mode. +This is equivalent to +.Fn intrflush stdscr FALSE . +.Ds +.Fn noraw "" +.De +Unset the terminal from raw mode. See +.Fn raw . +.Ds +.Fn notimeout "WINDOW *win1" "int boolf" +.De +Sets the boolean flag for inter-key timeouts +for escape sequences interpreted when +.Fn keypad +is set. +By default, +.Fn keypad +sets a timer while waiting for the next character of +an escape sequence. +If +.Vn boolf +is non-zero, +.Fn getch +will wait indefinitely between escape sequence characters, +or until a delay set by +.Fn timeout +expires. +.Ds +.Fn overlay "WINDOW *win1" "WINDOW *win2" +.De +Overlay +.Vn win1 +on +.Vn win2 . +The contents of +.Vn win1 , +insofar as they fit, +are placed on +.Vn win2 +at their starting \*y. +This is done non-destructively, +i.e., blanks on +.Vn win1 +leave the contents of the space on +.Vn win2 +untouched. Note that all non-blank characters are overwritten +destructively in the overlay. +.Ds +.Fn overwrite "WINDOW *win1" "WINDOW *win2" +.De +Overwrite +.Vn win1 +on +.Vn win2 . +The contents of +.Vn win1 , +insofar as they fit, +are placed on +.Vn win2 +at their starting \*y. +This is done destructively, +.i i.e. , +blanks on +.Vn win1 +become blank on +.Vn win2 . +.Ds +.Fn pair_content "short pair" "short *fore" "short *back" +.De +Get the foreground and background colors of pair +.Vn pair . +.Ds +.Fn pechochar "const chtype ch" \(dg +.De +Add the character +.Vn ch +on the pad +at the current \*y and immediately refresh the pad. +.Ds +.Fn pnoutrefresh "WINDOW *pad" "int pbeg_y" "int pbeg_x" "int sbeg_y" "int sbeg_x" "int smax_y" "int smax_x" +.De +Add the pad contents to a virtual screen. Several pads can be added +before a call to +.Fn doupdate , +thus allowing the screen to updated in an efficient manner. +.Ds +.Fn prefresh "WINDOW *pad" "int pbeg_y" "int pbeg_x" "int sbeg_y" "int sbeg_x" "int smax_y" "int smax_x" +.De +Synchronize the terminal screen with the desired pad. +.Ds +.Fn printw "char *fmt" "..." +.De +Performs a +.Fn printf +on the window starting at the current \*y. +It uses +.Fn addstr +to add the string on the window. +It is often advisable to use the field width options of +.Fn printf +to avoid leaving things on the window from earlier calls. +\*(Es +.Ds +.Fn putwin "WINDOW *win" "FILE *fp" +.De +Writes the window data to a file. +.Ds +.Fn qiflush \(dg +.De +Set the terminal flush on interrupt mode. +This is equivalent to +.Fn intrflush stdscr TRUE . +.Ds +.Fn raw "" +.De +Set the terminal to raw mode. +On version 7 +.Un \** +.(f +\** +.Un +is a trademark of Unix System Laboratories. +.)f +this also turns off newline mapping +(see +.Fn nl ). +.Ds +.Fn redrawwin "WINDOW *win" \(dg +.De +Mark the entire window as having been corrupted. +This is equivalent to the +.Fn touchwin +function. +.Ds +.Fn refresh "" \(dg +.De +Synchronize the terminal screen with the desired window. +If the window is not a screen, +only that part covered by it is updated. +\*(Es +In this case, it will update whatever it can +without causing the scroll. +.sp +As a special case, +if +.Fn wrefresh +is called with the window +.Vn curscr +the screen is cleared +and repainted as it is currently. +This is very useful for allowing the redrawing of the screen +when the user has garbage dumped on his terminal. +.Ds +.Fn reset_prog_mode "" +.De +Restore the terminal to the \'in curses\' state. +.Ds +.Fn reset_shell_mode "" +.De +Restore the terminal to the \'not in curses\' state. +.Ds +.Fn resetty "" \(dg +.De +.Fn resetty +restores them to what +.Fn savetty +stored. +These functions are performed automatically by +.Fn initscr +and +.Fn endwin . +This function should not be used by the user. +.Ds +.Fn resizeterm "int lines" "int columns" \(dg +.De +Resizes the curses terminal to the given size. All internal curses +structures are resized to the new dimensions and all curses windows that +would have boundaries outside the new terminal size will be resized to fit +within the new boundaries. All windows will be cleared and it is expected +that the application will redraw the window contents. +.Ds +.Fn savetty "" \(dg +.De +.Fn savetty +saves the current tty characteristic flags. See +.Fn resetty . +This function should not be used by the user. +.Ds +.Fn scanw "char *fmt" "..." +.De +Perform a +.Fn scanf +through the window using +.Vn fmt . +It does this using consecutive calls to +.Fn getch +(or +.Fn wgetch ). +\*(Es +.ne 1i +.Ds +.Fn scrl "int n" +.De +Scroll the window by +.Vn n +lines. If +.Vn n +is positive, scroll upward, otherwise +scroll downward. +.Ds +.Fn scroll "WINDOW *win" +.De +Scroll the window upward one line. +This is normally not used by the user. +.Ds +.Fn scrollok "WINDOW *win" "int boolf" \(dg +.De +Set the scroll flag for the given window. +If +.Vn boolf +is 0, scrolling is not allowed. +This is its default setting. +.Ds +.Ft "SCREEN *" +.Fn set_term "SCREEN *new" +.De +Sets the current screen for input and output to be the one given. The +.Vn new +structure must be one that has been previously created by the +.Fn newterm +function. The +.Fn set_term +function returns the previous screen on successful completion. +.Ds +.Fn standend "" \(dg +.De +End standout mode initiated by +.Fn standout . +This function is provided for compatibility +with older curses implementations. +.Ds +.Fn standout "" \(dg +.De +Causes any characters added to the window +to be put in standout mode on the terminal +(if it has that capability). This function +is provided for compatibility with older curses +implementations. A larger range of character +attributes supported by modern terminals can be +accessed using +.Fn attron +and +.Fn attrset . +.Ds +.Fn start_color "" +.De +Initialize the color routines. +This must be called before any of the color routines are used. +The terminal is setup to use the curses default colors of white foreground +on black background, unless +.Fn assume_default_colors +or +.Fn use_default_colors +are called. +.Ds +.Ft "WINDOW *" +.Fn subpad "WINDOW *win" "int lines" "int cols" "int begin_y" "int begin_x" +.De +Create a new pad with +.Vn lines +lines and +.Vn cols +columns starting at position +.Vn begin\*_y\*,begin\*_x ) ( +inside the pad +.i win . +This means that any change made to either pad +in the area covered +by the subpad will be made on both pads. +.Vn begin\*_y\*,begin\*_x +are specified relative to the relative (0\*,0) of +.Vn win . +.Ds +.Ft "WINDOW *" +.Fn subwin "WINDOW *win" "int lines" "int cols" "int begin_y" "int begin_x" +.De +Create a new window with +.Vn lines +lines and +.Vn cols +columns starting at position +.Vn begin\*_y\*,begin\*_x ) ( +inside the window +.i win . +This means that any change made to either window +in the area covered +by the subwindow will be made on both windows. +.Vn begin\*_y\*,begin\*_x +are specified relative to the overall screen, +not the relative (0\*,0) of +.Vn win . +If either +.Vn lines +or +.Vn cols +is 0 (zero), +that dimension will be set to +.Vn "LINES \- begin\*_y" ) ( +or +.Vn "COLS \- begin\*_x" ) ( +respectively. +.Ds +.Fn termattrs "" +.De +Returns the attributes that can be applied to the screen. +.Ds +.Fn term_attrs "" +.De +Returns the wide attributes that can be applied to the screen. +.Ds +.Fn timeout "int delay" \(dg +.De +Sets blocking or non-blocking +.Fn getch . +If +.Vn delay +is positive, +.Fn getch +will block for +.Vn delay +milliseconds before returning. If +.Vn delay +is zero, +.Fn getch +will return ERR is no input is waiting. If +.Vn delay +is negative, +.Fn getch +will block indefinitely. See also +.Fn keypad , +.Fn nodelay +and +.Fn notimeout . +.Ds +.Fn touchline "WINDOW *win" "int y" "int startx" "int endx" +.De +This function performs a function similar to +.Fn touchwin +on a single line. +It marks the first change for the given line +to be +.Vn startx , +if it is before the current first change mark, +and +the last change mark is set to be +.Vn endx +if it is currently less than +.Vn endx . +.Ds +.Fn touchoverlap "WINDOW *win1" "WINDOW *win2" +.De +Touch the window +.Vn win2 +in the area which overlaps with +.Vn win1 . +If they do not overlap, +no changes are made. +.Ds +.Fn touchwin "WINDOW *win" +.De +Make it appear that the every location on the window +has been changed. +This is usually only needed for refreshes with overlapping windows. +.Ds +.Fn tstp +.De +This function +will save the current tty state +and then put the process to sleep. +When the process gets restarted, +it restores the saved tty state +and then calls +.Fn wrefresh "curscr" +to redraw the screen. +.Fn Initscr +sets the signal +SIGTSTP +to trap to this routine. +.Ds +.Fn unctrl "char *ch" \(dg +.De +Returns a string which is an ASCII representation of +.Vn ch . +Characters are 8 bits long. +.Ds +.Fn unctrllen "char *ch" \(dg +.De +Returns the length of the ASCII representation of +.Vn ch . +.ne 1i +.Ds +.Fn underend "" \(dg +.De +End underscore mode initiated by +.Fn underscore . +This is equivalent to +.Fn attroff "A_UNDERLINE" . +.Ds +.Fn underscore "" \(dg +.De +Causes any characters added to the window +to be put in underscore mode on the terminal +(if it has that capability). +This is equivalent to +.Fn attron "A_UNDERLINE" . +.Ds +.Fn ungetch "int c" +.De +Places the contents of +.Vn c +converted to a character back into the input queue. Only one +character of push back before a subsequent call to +.Fn getch +or +.Fn wgetch +is guaranteed to function correctly. The results of attempting more +than one character of push back is undefined. +.Ds +.Fn untouchwin "WINDOW *win" +.De +Make the window appear to have not been updated even if it has been. +.Ds +.Fn use_default_colors "" +.De +Use the terminal foreground and background colors as the curses default +foreground and background colors. +.Ds +.Fn vline "chtype ch" "int count" +.De +Draws a vertical line of character +.Vn ch +starting at the current cursor location and moving towards the bottom +of the screen. At most +.Vn count +characters are drawn, less if the bottom of the screen is reached +before +.Vn count +expires. +.Ds +.Fn vwprintw "WINDOW *win" "const char *fmt" "va_list ap" +.De +Identical to +.Fn printw +except that it takes both a window specification and a pointer to a variable +length argument list. +.Ds +.Fn vwscanw "WINDOW *win" "const char *fmt" "va_list ap" +.De +Identical to +.Fn scanw +except that it takes both a window specification and a pointer to a variable +length argument list. +.Ds +.Fn wnoutrefresh "WINDOW *win" +.De +Add the window contents to a virtual screen. Several windows can be added +before a call to +.Fn doupdate , +thus allowing the screen to updated in an efficient manner. +.Ds +.Fn wredrawln "WINDOW *win" "int line" "int n" \(dg +.De +Mark +.Vn n +lines starting at +.Vn line +in the window as corrupted. +This is equivalent to +.Fn wtouchln "win" "line" "n" "1" . +.Ds +.Fn wresize "WINDOW *win" "int lines" "int columns" +.De +Resize the specified window to the given dimensions. The window will be +cleared and the application is expected to redraw the window contents. +.Ds +.Fn wtouchln "WINDOW *win" "int line" "int n" "int changed" +.De +If +.Vn changed +is 1 then +.Vn n +lines starting at +.Vn line +in the window are touched. If +.Vn changed +is 0 then +.Vn n +lines starting at +.Vn line +in the window are untouched. +.sp 2 +.pp +\fIThe following functions differ from the standard functions only in their +specification of a window, rather than the use of the default +.Vn stdscr.\fP +.Ds +.Fn waddbytes "WINDOW *win" "char* str" "int len" +.Fn waddch "WINDOW *win" "chtype ch" +.Fn waddchnstr "WINDOW *win" "chtype *str" "int len" +.Fn waddchstr "WINDOW *win" "chtype *str" "int len" +.Fn waddnstr "WINDOW *win" "char *str" "int len" +.Fn waddstr "WINDOW *win" "char *str" +.Fn wattroff "WINDOW *win" "int attr" +.Fn wattron "WINDOW *win" "int attr" +.Fn wattrset "WINDOW *win" "int attr" +.Fn wbkgd "WINDOW *win" "chtype ch" +.Fn wbkgdset "WINDOW *win" "chtype ch" +.Fn wborder "WINDOW *win" "chtype left" "chtype right" "chtype top" "chtype bottom" "chtype topleft" "chtype topright" "chtype botleft" "chtype botright" +.Fn wclear "WINDOW *win" +.Fn wclrtobot "WINDOW *win" +.Fn wclrtoeol "WINDOW *win" +.Fn wdelch "WINDOW *win" +.Fn wdeleteln "WINDOW *win" +.Fn wechochar "WINDOW *win" "chtype ch" +.Fn werase "WINDOW *win" +.Fn wgetch "WINDOW *win" +.Fn wgetnstr "WINDOW *win" "char *str" "int len" +.Fn wgetstr "WINDOW *win" "char *str" +.Fn whline "WINDOW *win" "chtype ch" "int count" +.Fn winch "WINDOW *win" \(dg +.Fn winchnstr "WINDOW *win" "chtype *chstr" "int n" +.Fn winchstr "WINDOW *win" "chtype *chstr" +.Fn winnstr "WINDOW *win" "char *str" "int n" +.Fn winsch "WINDOW *win" "char c" +.Fn winsdelln "WINDOW *win" "int n" +.Fn winsertln "WINDOW *win" +.Fn winstr "WINDOW *win" "char *str" +.Fn wmove "WINDOW *win" "int y" int x" +.Fn wprintw "WINDOW *win" "char *fmt" "..." +.Fn wrefresh "WINDOW *win" +.Fn wscanw "WINDOW *win" "char *fmt" "..." +.Fn wscrl "WINDOW *win" "int n" +.Fn wstandend "WINDOW *win" +.Fn wstandout "WINDOW *win" +.Fn wtimeout "WINDOW *win" "int delay" +.Fn wunderend "WINDOW *win" +.Fn wunderscore "WINDOW *win" +.Fn wvline "WINDOW *win" "chtype ch" "int count" +.Fn mvwaddch "WINDOW *win" "int y" "int x" "chtype ch" +.Fn mvwaddchstr "WINDOW *win" "int y" "int x" "chtype *str" \(dg +.Fn mvwaddchnstr "WINDOW *win" "int y" "int x" "chtype *str" \(dg +.Fn mvwaddnstr "WINDOW *win" "int y" "int x" "char *str" "int len" +.Fn mvwaddstr "WINDOW *win" "int y" "int x" "char *str" +.Fn mvwgetnstr "WINDOW *win" "int y" "int x" "char *str" "int len" +.Fn mvwgetstr "WINDOW *win" "int y" "int x" "char *str" +.Fn mvwhline "WINDOW *win" "int y" "int x" "chtype ch" "int count" +.Fn mvwvline "WINDOW *win" "int y" "int x" "chtype ch" "int count" + +.Dg diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/intro.0 b/vendor/netbsd-curses/libcurses/PSD.doc/intro.0 new file mode 100644 index 0000000..ae6b808 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/intro.0 @@ -0,0 +1,104 @@ +.\" $NetBSD: intro.0,v 1.6 2003/08/07 16:44:27 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.0 8.1 (Berkeley) 6/4/93 +.\" +.tp +.(l C +.ps 12 +.ft B +Screen Updating and Cursor Movement Optimization: +.fl +A Library Package +.ft +.ps +.sp +.i "Kenneth C. R. C. Arnold" +.i "Elan Amir" +.sp +Computer Science Division +Department of Electrical Engineering and Computer Science +University of California, Berkeley +Berkeley, California 94720 +.sp 3 +.bi ABSTRACT +.sp 2 +.)l +.(q +.pp +This document describes a package of C library functions +which allow the user to: +.ie t .ip \ \ \ \(bu +.el .ip 1) +update a screen with reasonable optimization, +.ie t .ip \ \ \ \(bu +.el .ip 2) +get input from the terminal +in a screen-oriented fashion, +and +.ie t .ip \ \ \ \(bu +.el .ip 3) +independent from the above, move the cursor optimally +from one point to another. +.pp +These routines all use the +\*(tc \*(db to describe the capabilities of the terminal. +.)q +.b Acknowledgements +.pp +This package would not exist +without the work of Bill Joy, +who, +in writing his editor, +created the capability to generally describe terminals, +wrote the routines which read this \*(db, +and, most importantly, +those which implement optimal cursor movement, +which routines I have simply lifted nearly intact. +Doug Merritt and Kurt Shoens also were extremely important, +as were both willing to waste time listening to me rant and rave. +The help and/or support of +Ken Abrams, +Alan Char, +Mark Horton, +and +Joe Kalash, +was, and is, +also greatly appreciated. +.i "Ken Arnold 16 April 1986" +.pp +The help and/or support of Kirk McKusick and Keith Bostic (public vi!) +was invaluable in bringing the package ``into the 90's'', which now +includes completely new data structures and screen refresh optimization +routines. +.i "Elan Amir 29 December 1992" + + + + diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/intro.1 b/vendor/netbsd-curses/libcurses/PSD.doc/intro.1 new file mode 100644 index 0000000..14d1e39 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/intro.1 @@ -0,0 +1,247 @@ +.\" $NetBSD: intro.1,v 1.7 2003/08/07 16:44:27 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.1 8.1 (Berkeley) 6/4/93 +.\" +.bp +.sh 1 Overview +.pp +In making available the generalized terminal descriptions in \*(tc, +much information was made available to the programmer, +but little work was taken out of one's hands. +The purpose of this package is to allow the C programmer +to do the most common type of terminal dependent functions, +those of movement optimization and optimal screen updating, +without doing any of the dirty work, +and with nearly as much ease as is necessary to simply print +or read things. +.sh 2 "Terminology" +.pp +In this document, the following terminology is used: +.de Ip +.sp +.in 5n +.ti 0n +.b "\\$1" : +.. +.Ip window +An internal representation +containing an image of what a section of the terminal screen may look like +at some point in time. +This subsection can either encompass the entire terminal screen, +or any smaller portion down to a single character within that screen. +.Ip terminal +Sometimes called +.b terminal +.b screen . +The package's idea of what the terminal's screen currently looks like, +.i i.e. , +what the user sees now. +This is a special +.i screen : +.Ip screen +This is a subset of windows which are as large as the terminal screen, +.i i.e. , +they start at the upper left hand corner +and encompass the lower right hand corner. +One of these, +.Vn stdscr , +is automatically provided for the programmer. +.rm Ip +.sh 2 "Compiling Applications" +.pp +In order to use the library, +it is necessary to have certain types and variables defined. +Therefore, the programmer must have a line: +.(l +.b "#include " +.)l +at the top of the program source. +Compilations should have the following form: +.(l +.ie t \fBcc\fR [ \fIflags\fR ] file ... \fB\-lcurses \-ltermcap\fR +.el \fIcc\fR [ flags ] file ... \fI\-lcurses \-ltermcap\fR +.)l +.sh 2 "Screen Updating" +.pp +In order to update the screen optimally, +it is necessary for the routines to know what the screen currently looks like +and what the programmer wants it to look like next. +For this purpose, +a data type +(structure) +named +.Vn WINDOW +is defined +which describes a window image to the routines, +including its starting position on the screen +(the \*y of the upper left hand corner) +and its size. +One of these +(called +.Vn curscr +for +.i "current screen" ) +is a screen image of what the terminal currently looks like. +Another screen +(called +.Vn stdscr , +for +.i "standard screen" ) +is provided +by default +to make changes on. +.pp +A window is a purely internal representation. +It is used to build and store +a potential image of a portion of the terminal. +It doesn't bear any necessary relation +to what is really on the terminal screen. +It is more like an array of characters on which to make changes. +.pp +When one has a window which describes +what some part the terminal should look like, +the routine +.Fn refresh +(or +.Fn wrefresh +if the window is not +.Vn stdscr ) +is called. +.Fn refresh +makes the terminal, +in the area covered by the window, +look like that window. +Note, therefore, that changing something on a window +.i does +.bi not +.i "change the terminal" . +Actual updates to the terminal screen +are made only by calling +.Fn refresh +or +.Fn wrefresh . +This allows the programmer to maintain several different ideas +of what a portion of the terminal screen should look like. +Also, changes can be made to windows in any order, +without regard to motion efficiency. +Then, at will, +the programmer can effectively say +.q "make it look like this" , +and the package will execute the changes in an optimal way. +.sh 2 "Naming Conventions" +.pp +As hinted above, +the routines can use several windows, +but two are always available: +.Vn curscr , +which is the image of what the terminal looks like at present, +and +.Vn stdscr , +which is the image of what the programmer wants the terminal to look like next. +The user should not access +.Vn curscr +directly. +Changes should be made to +the appropriate screen, +and then the routine +.Fn refresh +(or +.Fn wrefresh ) +should be called. +.pp +Many functions are set up to deal with +.Vn stdscr +as a default screen. +For example, to add a character to +.Vn stdscr , +one calls +.Fn addch +with the desired character. +If a different window is to be used, +the routine +.Fn waddch +(for +.b w indow-specific +.Fn addch ) +is provided\**. +.(f +\** +Actually, +.Fn addch +is really a +.q #define +macro with arguments, +as are most of the "functions" which act upon +.Vn stdscr . +.)f +This convention of prepending function names with a +.Bq w +when they are to be applied to specific windows +is consistent. +The only routines which do +.i not +do this are those +to which a window must always be specified. +.pp +In order to move the current \*y from one point to another, +the routines +.Fn move +and +.Fn wmove +are provided. +However, +it is often desirable to first move and then perform some I/O operation. +In order to avoid clumsiness, +most I/O routines can be preceded by the prefix +.Bq mv +and the desired \*y can then be added to the arguments to the function. +For example, +the calls +.(l +move(y\*,x); +addch(ch); +.)l +can be replaced by +.(l +mvaddch(y\*,x\*,ch); +.)l +and +.(l +wmove(win\*,y\*,x); +waddch(win\*,ch); +.)l +can be replaced by +.(l +mvwaddch(win\*,y\*,x\*,ch); +.)l +Note that the window description pointer +.Vn win ) ( +comes before the added \*y. +If a window pointer is needed, it is always the first parameter passed. diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/intro.2 b/vendor/netbsd-curses/libcurses/PSD.doc/intro.2 new file mode 100644 index 0000000..be3d468 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/intro.2 @@ -0,0 +1,82 @@ +.\" $NetBSD: intro.2,v 1.8 2003/08/07 16:44:28 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.2 8.1 (Berkeley) 6/4/93 +.\" +.sh 1 Variables +.pp +Many variables which are used to describe the terminal environment +are available to the programmer. +They are: +.(b +.TS +expand; +lw(6m) lw(8n) lw(50n). +type name description +_ +WINDOW * curscr T{ +.fi +current version of the screen (terminal screen). +T} +WINDOW * stdscr T{ +standard screen. +Most updates are usually done here. +T} +char * Def\*_term T{ +default terminal type if type cannot be determined +T} +bool My\*_term T{ +use the terminal specification in \fIDef\*_term\fR as terminal, +irrelevant of real terminal type +T} +char * ttytype T{ +full name of the current terminal. +T} +int LINES T{ +number of lines on the terminal +T} +int COLS T{ +number of columns on the terminal +T} +int COLORS T{ +number of colors on the terminal +T} +int COLOR_PAIRS T{ +number of color pairs on the terminal +T} +int ERR T{ +error flag returned by routines on a fail. +T} +int OK T{ +flag returned by routines upon success. +T} +.TE +.fi +.)b +.lp diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/intro.3 b/vendor/netbsd-curses/libcurses/PSD.doc/intro.3 new file mode 100644 index 0000000..2d67b82 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/intro.3 @@ -0,0 +1,228 @@ +.\" $NetBSD: intro.3,v 1.9 2003/11/02 11:16:03 wiz Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.3 8.1 (Berkeley) 6/4/93 +.\" +.sh 1 Usage +.pp +This is a description of how to actually use the screen package. +For simplicity, we assume all updating, reading, etc. +is applied to +.Vn stdscr , +although a different window can of course be specified. +.sh 2 "Initialization" +.pp +In order to use the screen package, +the routines must know about terminal characteristics, +and the space for +.Vn curscr +and +.Vn stdscr +must be allocated. +These functions are performed by +.Fn initscr . +Since it must allocate space for the windows, +it can overflow core when attempting to do so. +On this rather rare occasion, +.Fn initscr +returns ERR. +.Fn initscr +must +.bi always +be called before any of the routines which affect windows are used. +If it is not, +the program will core dump as soon as either +.Vn curscr +or +.Vn stdscr +are referenced. +However, it is usually best to wait to call it +until after you are sure you will need it, +like after checking for startup errors. +Terminal status changing routines +like +.Fn nl +and +.Fn cbreak +should be called after +.Fn initscr . +.pp +After the initial window allocation done by +.Fn initscr , +specific window characteristics can be set. +Scrolling can be enabled by calling +.Fn scrollok . +If you want the cursor to be left after the last change, use +.Fn leaveok . +If this isn't done, +.Fn refresh +will move the cursor to the window's current \*y after updating it. +Additional windows can be created by using the functions +.Fn newwin +and +.Fn subwin . +.Fn delwin +allows you to delete an existing window. +The variables +.Vn LINES +and +.Vn COLS +control the size of the terminal. +They are initially implicitly set by +.Fn initscr , +but can be altered explicitly by the user followed by a call to +.Fn initscr . +Note that any call to +.Fn initscr , +will always delete any existing +.Vn stdscr +and/or +.Vn curscr +before creating new ones so this change is best done before the initial call to +.Fn initscr . +.pp +.sh 2 "Output" +.pp +The basic functions +used to change what will go on a window are +.Fn addch +and +.Fn move . +.Fn addch +adds a character at the current \*y, +returning ERR if it would cause the window to illegally scroll, +.i i.e. , +printing a character in the lower right-hand corner +of a terminal which automatically scrolls +if scrolling is not allowed. +.Fn move +changes the current \*y to whatever you want them to be. +It returns ERR if you try to move off the window. +As mentioned above, you can combine the two into +.Fn mvaddch +to do both things in one call. +.pp +The other output functions +(such as +.Fn addstr +and +.Fn printw ) +all call +.Fn addch +to add characters to the window. +.pp +After a change has been made to the window, +you must call +.Fn refresh . +when you want the portion of the terminal covered by the window +to reflect the change. +In order to optimize finding changes, +.Fn refresh +assumes that any part of the window not changed +since the last +.Fn refresh +of that window has not been changed on the terminal, +.i i.e. , +that you have not refreshed a portion of the terminal +with an overlapping window. +If this is not the case, +the routines +.Fn touchwin , +.Fn touchline , +and +.Fn touchoverlap +are provided to make it look like a desired part of window has been changed, +thus forcing +.Fn refresh +to check that whole subsection of the terminal for changes. +.pp +If you call +.Fn wrefresh +with +.Vn curscr , +it will make the screen look like the image of +.Vn curscr . +This is useful for implementing a command +which would redraw the screen in case it got messed up. +.sh 2 Input +.pp +Input is essentially a mirror image of output. +The complementary function to +.Fn addch +is +.Fn getch +which, +if echo is set, +will call +.Fn addch +to echo the character. +Since the screen package needs to know what is on the terminal at all times, +if characters are to be echoed, +the tty must be in raw or cbreak mode. +If it is not, +.Fn getch +sets it to be cbreak, +and then reads in the character. +.sh 2 "Termination" +.pp +In order to perform certain optimizations, +and, +on some terminals, +to work at all, +some things must be done +before the screen routines start up. +These functions are performed in +.Fn getttmode +and +.Fn setterm , +which are called by +.Fn initscr . +In order to clean up after the routines, +the routine +.Fn endwin +is provided. +It restores tty modes to what they were +when +.Fn initscr +was first called. +The terminal state module uses the variable +.Vn curses_termios +to save the original terminal state which is then restored upon a call to +.Fn endwin . +Thus, +anytime after the call to initscr, +.Fn endwin +should be called before exiting. +Note however, that +.Fn endwin +should always be called +.b before +the final calls to +.Fn delwin , +which free the storage of the windows. diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/intro.4 b/vendor/netbsd-curses/libcurses/PSD.doc/intro.4 new file mode 100644 index 0000000..af62690 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/intro.4 @@ -0,0 +1,67 @@ +.\" $NetBSD: intro.4,v 1.5 2003/08/07 16:44:28 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.4 8.1 (Berkeley) 6/4/93 +.\" +.sh 1 "Cursor Movement Optimizations" +.pp +One of the most difficult things to do properly is motion optimization. +After using +.Fn gettmode +and +.Fn setterm +to get the terminal descriptions, +the function +.Fn mvcur +deals with this task. +It usage is simple: +simply tell it where you are now and where you want to go. +For example +.(l +mvcur(0\*,0\*,LINES/2\*,COLS/2); +.)l +.lp +would move the cursor from the home position (0\*,0) +to the middle of the screen. +If you wish to force absolute addressing, +you can use the function +.Fn tgoto +from the +.b termlib (7) +routines, +or you can tell +.Fn mvcur +that you are impossibly far away, +For example, +to absolutely address the lower left hand corner of the screen +from anywhere +just claim that you are in the upper right hand corner: +.(l +mvcur(0\*,COLS\-1\*,LINES\-1\*,0); +.)l diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/intro.5 b/vendor/netbsd-curses/libcurses/PSD.doc/intro.5 new file mode 100644 index 0000000..50bd75a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/intro.5 @@ -0,0 +1,90 @@ +.\" $NetBSD: intro.5,v 1.8 2003/11/02 11:16:03 wiz Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.5 8.1 (Berkeley) 6/4/93 +.\" +.sh 1 "Character Output and Scrolling" +.pp +The character output policy deals with the following problems. +First, where is the location of the cursor after a character is printed, and +secondly, when does the screen scroll if scrolling is enabled. +.pp +In the normal case the characters are output as expected, with the cursor +occupying the position of the next character to be output. +However, when the +cursor is on the last column of the line, the cursor will remain on that +position after the last character on the line is output and will only assume +the position on the next line when the next character (the first on the next +line) is output. +.pp +Likewise, if scrolling is enabled, a scroll will be invoked only when the +first character on he first line past the bottom line of the window is +output. +If scrolling is not enabled the chracters will to be output to the +bottom right corner of the window which is the cursor location. +.pp +This policy allows consistent behavior of the cursor at the boundary +conditions. +Furthermore, it prevents a scroll from happening before it is +actually needed (the old package used to scroll when the bottom right position +was output a character). +As a precedent, it models the +.i xterm +character output conventions. +.sh 1 "Terminal State Handling" +.pp +The variable +.Vn curses_termios +contains the terminal state of the terminal. +Certain historical routines return information: +.Fn baudrate , +.Fn erasechar , +.Fn killchar , +and +.Fn ospeed . +These routines are obsolete and exist only for backward compatibility. +If you wish to use the information in the +.Vn curses_termios +structure, you should use the +\fItsetattr\fP(3) +routines. +.sh 1 "Subwindows" +.pp +Subwindows are windows which do not have an independent text structure, +.i i.e. , +they are windows whose text is a subset of the text of a larger window: the +.i parent +window. +One consequence of this is that changes to either the parent or the +child window are destructive to the other, +.i i.e. , +a change to the subwindow is also a change to the parent window and a change +to the parent window in the region defined by the subwindow is implicitly a +change to the subwindow as well. +Apart from this detail, subwindows function like any other window. diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/intro.6 b/vendor/netbsd-curses/libcurses/PSD.doc/intro.6 new file mode 100644 index 0000000..7a16eba --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/intro.6 @@ -0,0 +1,44 @@ +.\" $NetBSD: intro.6,v 1.6 2003/08/07 16:44:28 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)intro.6 8.1 (Berkeley) 6/4/93 +.\" +.sh 1 "The Functions" +.pp +In the following definitions, +.q \*m +means that if +.Vn _CURSES_USE_MACROS +is defined, the +.q function +is really a +.q #define +macro with arguments. +.ta 11m 17m 25m 33m 41m 49m 57m 65m 73m +.so fns.doc diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/life.c b/vendor/netbsd-curses/libcurses/PSD.doc/life.c new file mode 100644 index 0000000..72a1594 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/life.c @@ -0,0 +1,161 @@ +.\" $NetBSD: life.c,v 1.6 2003/08/07 16:44:28 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)life.c 8.1 (Berkeley) 6/8/93 +.\" +# include +# include + +/* + * Run a life game. This is a demonstration program for + * the Screen Updating section of the -lcurses cursor package. + */ + +typedef struct lst_st { /* linked list element */ + int y, x; /* (y, x) position of piece */ + struct lst_st *next, *last; /* doubly linked */ +} LIST; + +LIST *Head; /* head of linked list */ + +int die(); + +main(ac, av) +int ac; +char *av[]; +{ + evalargs(ac, av); /* evaluate arguments */ + + initscr(); /* initialize screen package */ + signal(SIGINT, die); /* set to restore tty stats */ + cbreak(); /* set for char-by-char */ + noecho(); /* input */ + nonl(); /* for optimization */ + + getstart(); /* get starting position */ + for (;;) { + prboard(); /* print out current board */ + update(); /* update board position */ + } +} + +/* + * This is the routine which is called when rubout is hit. + * It resets the tty stats to their original values. This + * is the normal way of leaving the program. + */ +die() +{ + signal(SIGINT, SIG_IGN); /* ignore rubouts */ + mvcur(0, COLS - 1, LINES - 1, 0); /* go to bottom of screen */ + endwin(); /* set terminal to good state */ + exit(0); +} + +/* + * Get the starting position from the user. They keys u, i, o, j, l, + * m, ,, and . are used for moving their relative directions from the + * k key. Thus, u move diagonally up to the left, , moves directly down, + * etc. x places a piece at the current position, " " takes it away. + * The input can also be from a file. The list is built after the + * board setup is ready. + */ +getstart() +{ + reg char c; + reg int x, y; + auto char buf[100]; + + box(stdscr, '|', '_'); /* box in the screen */ + move(1, 1); /* move to upper left corner */ + + for (;;) { + refresh(); /* print current position */ + if ((c = getch()) == 'q') + break; + switch (c) { + case 'u': + case 'i': + case 'o': + case 'j': + case 'l': + case 'm': + case ',': + case '.': + adjustyx(c); + break; + case 'f': + mvaddstr(0, 0, "File name: "); + getstr(buf); + readfile(buf); + break; + case 'x': + addch('X'); + break; + case ' ': + addch(' '); + break; + } + } + + if (Head != NULL) /* start new list */ + dellist(Head); + Head = malloc(sizeof (LIST)); + + /* + * loop through the screen looking for 'x's, and add a list + * element for each one + */ + for (y = 1; y < LINES - 1; y++) + for (x = 1; x < COLS - 1; x++) { + move(y, x); + if (inch() == 'x') + addlist(y, x); + } +} + +/* + * Print out the current board position from the linked list + */ +prboard() { + + reg LIST *hp; + + erase(); /* clear out last position */ + box(stdscr, '|', '_'); /* box in the screen */ + + /* + * go through the list adding each piece to the newly + * blank board + */ + for (hp = Head; hp; hp = hp->next) + mvaddch(hp->y, hp->x, 'X'); + + refresh(); +} diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/macros b/vendor/netbsd-curses/libcurses/PSD.doc/macros new file mode 100644 index 0000000..a4773b4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/macros @@ -0,0 +1,143 @@ +.\" $NetBSD: macros,v 1.8 2004/04/27 02:15:04 uwe Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)macros 8.1 (Berkeley) 8/14/93 +.\" +.\" this is the uncommented version. The commented one is in "macros.coms" +.ie t .ds _ \d\(mi\u +.el .ds _ _ +.ds , ,\ \" attention: trailing space +.ds y (y\*,x) co-ordinates +.ds db database +.ie n .ds f \fI +.el .ds f \fB +.ds tc \*ftermcap\fP(5) +.ds Es This returns ERR if it would cause the screen to scroll illegally. +.ds Nm This has no associated \*(lq\fBmv\fP\*(rq command. +.ie t .ds m \fB\s-2\(dg\s+2\fP +.el .ds m [*] +.\" .hy WINDOW +.\".he ''\*(Ln'' +.\".fo ''\- % \-'' +.oh '\*(Ln''PS1:19-%' +.eh 'PS1:19-%''\*(Ln' +.de Un +.b +\s-2\\$2UNIX\\$1\s+2 +.ft +.. +.de Ds +.sp +.lp +.ev 1 +.nf +.ft I +.in 0 +.di +.Df +.. +.de De +.di +.Df +.ne \n(dn+2 +.ev +.ip +.. +.de Dg +.di +.Df +.ne \n(dn+2 +.ev +.. +.de Fd +.br +\&\\$4 +.fi +.b +\&\\$1(\\$2) +.ft +\&\\$3 +.br +.nf +.. +.de Vn +\&\\$3\c +.i "\\$1" \\$2 +.. +.de Bq +.ie t \&\*(lq\fB\\$1\fP\*(rq +.el \&\*(lq\fI\\$1\fP\*(rq +.. +.de $0 +.(x +.in \\n(Xs +\\*($n \\$1 +.)x +.. +.de $1 +.nr Xs 0 +.. +.de $2 +.nr Xs 3 +.. +.de $3 +.nr Xs 6 +.. +.de Fn +.if \\n(.$==0 .tm error +.nr ll 0 +.nr dg 0 +.ft R +.if '\\$\\n(.$'.' .nr ll 1 +.if '\\$\\n(.$',' .nr ll 1 +.if '\\$\\n(.$')' .nr ll 1 +.if '\\$\\n(.$').' .nr ll 1 +.if '\\$\\n(.$';' .nr ll 1 +.if '\\$\\n(.$':' .nr ll 1 +.if '\\$\\n(.$'\'s' .nr ll 1 +.if '\\$\\n(.$'\(dg' .nr ll 1 +.\" .if '\\$\\n(.$'' .nr ll 1 +.nr al \\n(.$-\\n(ll +.ds ot \f(CB\\$1\fP( +.if \\n(al>1 .as ot \fI\\$2\fP +.if \\n(al>2 .as ot ", \fI\\$3\fP +.if \\n(al>3 .as ot ", \fI\\$4\fP +.if \\n(al>4 .as ot ", \fI\\$5\fP +.if \\n(al>5 .as ot ", \fI\\$6\fP +.if \\n(al>6 .as ot ", \fI\\$7\fP +.if \\n(al>7 .as ot ", \fI\\$8\fP +.if \\n(al>8 .as ot ", \fI\\$9\fP +.as ot ) +.if \\n(.$>1 \{\ +. if \\n(ll==0 .as ot ; +. if '\\$\\n(.$'\(dg' .as ot ; +.\} +.if \\n(ll==1 .as ot \\$\\n(.$ +\\*(ot +.. diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/twinkle1.c b/vendor/netbsd-curses/libcurses/PSD.doc/twinkle1.c new file mode 100644 index 0000000..c37d2a0 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/twinkle1.c @@ -0,0 +1,161 @@ +/* $NetBSD: twinkle1.c,v 1.6 2005/05/23 04:04:49 christos Exp $ */ + +/* + * + * Copyright (c) 1980, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)twinkle1.c 8.1 (Berkeley) 6/8/93 + */ +#include +#include + +/* + * the idea for this program was a product of the imagination of + * Kurt Schoens. Not responsible for minds lost or stolen. + */ + +#define NCOLS 80 +#define NLINES 24 +#define MAXPATTERNS 4 + +typedef struct { + int y, x; +} LOCS; + +static LOCS Layout[NCOLS * NLINES]; /* current board layout */ + +static int Pattern, /* current pattern number */ + Numstars; /* number of stars in pattern */ + +static void puton(char); +static void makeboard(void); +static int ison(int, int); +static void die(int); + +int +main(void) +{ + srand(getpid()); /* initialize random sequence */ + + initscr(); + signal(SIGINT, die); + noecho(); + nonl(); + leaveok(stdscr, TRUE); + scrollok(stdscr, FALSE); + + for (;;) { + makeboard(); /* make the board setup */ + puton('*'); /* put on '*'s */ + puton(' '); /* cover up with ' 's */ + } +} + +/* + * On program exit, move the cursor to the lower left corner by + * direct addressing, since current location is not guaranteed. + * We lie and say we used to be at the upper right corner to guarantee + * absolute addressing. + */ +static void +die(int n) +{ + signal(SIGINT, SIG_IGN); + mvcur(0, COLS - 1, LINES - 1, 0); + endwin(); + exit(n); +} + + +/* + * Make the current board setup. It picks a random pattern and + * calls ison() to determine if the character is on that pattern + * or not. + */ +static void +makeboard(void) +{ + int y, x; + LOCS *lp; + + Pattern = rand() % MAXPATTERNS; + lp = Layout; + for (y = 0; y < NLINES; y++) + for (x = 0; x < NCOLS; x++) + if (ison(y, x)) { + lp->y = y; + lp->x = x; + lp++; + } + Numstars = lp - Layout; +} + +/* + * Return TRUE if (y, x) is on the current pattern. + */ +static int +ison(int y, int x) +{ + switch (Pattern) { + case 0: /* alternating lines */ + return !(y & 01); + case 1: /* box */ + if (x >= LINES && y >= NCOLS) + return FALSE; + if (y < 3 || y >= NLINES - 3) + return TRUE; + return (x < 3 || x >= NCOLS - 3); + case 2: /* holy pattern! */ + return ((x + y) & 01); + case 3: /* bar across center */ + return (y >= 9 && y <= 15); + } + /* NOTREACHED */ +} + +static void +puton(char ch) +{ + LOCS *lp; + int r; + LOCS *end; + LOCS temp; + + end = &Layout[Numstars]; + for (lp = Layout; lp < end; lp++) { + r = rand() % Numstars; + temp = *lp; + *lp = Layout[r]; + Layout[r] = temp; + } + + for (lp = Layout; lp < end; lp++) { + mvaddch(lp->y, lp->x, ch); + refresh(); + } +} diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/twinkle2.c b/vendor/netbsd-curses/libcurses/PSD.doc/twinkle2.c new file mode 100644 index 0000000..6fdc769 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/twinkle2.c @@ -0,0 +1,207 @@ +/* $NetBSD: twinkle2.c,v 1.6 2005/05/23 04:04:49 christos Exp $ */ + +/* + * + * Copyright (c) 1980, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)twinkle2.c 8.1 (Berkeley) 6/8/93 + */ + +#include +#include +#include +#include + +#define NCOLS 80 +#define NLINES 24 +#define MAXPATTERNS 4 + +typedef struct { + int y, x; +} LOCS; + +static LOCS Layout[NCOLS * NLINES]; /* current board layout */ + +static int Pattern, /* current pattern number */ + Numstars; /* number of stars in pattern */ + +static void puton(char); +static void die(int); +static void makeboard(void); +static int ison(int, int); + +static int AM; +static char *VS; +static char *TI; +static char *CL; + +int +main(void) +{ + char *sp; + char buf[1024]; + char *ptr = buf; + + srand(getpid()); /* initialize random sequence */ + + if (isatty(0)) { + initscr(); + gettmode(); + if ((sp = getenv("TERM")) != NULL) + setterm(sp); + signal(SIGINT, die); + } + else { + printf("Need a terminal on fd=%d\n", 0); + exit(1); + } + + tgetent(buf, sp); + + AM = tgetflag("am"); + TI = tgetstr("ti", &ptr); + if (TI == NULL) { + printf("terminal does not have the ti capability\n"); + exit(1); + } + VS = tgetstr("vs", &ptr); + if (VS == NULL) { + printf("terminal does not have the vs capability\n"); + exit(1); + } + CL = tgetstr("cl", &ptr); + if (CL == NULL) { + printf("terminal does not have the cl capability\n"); + exit(1); + } + puts(TI); + puts(VS); + + noecho(); + nonl(); + tputs(CL, NLINES, putchar); + for (;;) { + makeboard(); /* make the board setup */ + puton('*'); /* put on '*'s */ + puton(' '); /* cover up with ' 's */ + } +} + +/* + * On program exit, move the cursor to the lower left corner by + * direct addressing, since current location is not guaranteed. + * We lie and say we used to be at the upper right corner to guarantee + * absolute addressing. + */ +static void +die(int n) +{ + signal(SIGINT, SIG_IGN); + mvcur(0, COLS - 1, LINES - 1, 0); + endwin(); + exit(n); +} + +static void +puton(char ch) +{ + LOCS *lp; + int r; + LOCS *end; + LOCS temp; + static int lasty, lastx; + + end = &Layout[Numstars]; + for (lp = Layout; lp < end; lp++) { + r = rand() % Numstars; + temp = *lp; + *lp = Layout[r]; + Layout[r] = temp; + } + + for (lp = Layout; lp < end; lp++) + /* prevent scrolling */ + if (!AM || (lp->y < NLINES - 1 || lp->x < NCOLS - 1)) { + mvcur(lasty, lastx, lp->y, lp->x); + putchar(ch); + lasty = lp->y; + if ((lastx = lp->x + 1) >= NCOLS) + if (AM) { + lastx = 0; + lasty++; + } + else + lastx = NCOLS - 1; + } +} + +/* + * Make the current board setup. It picks a random pattern and + * calls ison() to determine if the character is on that pattern + * or not. + */ +static void +makeboard(void) +{ + int y, x; + LOCS *lp; + + Pattern = rand() % MAXPATTERNS; + lp = Layout; + for (y = 0; y < NLINES; y++) + for (x = 0; x < NCOLS; x++) + if (ison(y, x)) { + lp->y = y; + lp->x = x; + lp++; + } + Numstars = lp - Layout; +} + +/* + * Return TRUE if (y, x) is on the current pattern. + */ +static int +ison(int y, int x) +{ + switch (Pattern) { + case 0: /* alternating lines */ + return !(y & 01); + case 1: /* box */ + if (x >= LINES && y >= NCOLS) + return FALSE; + if (y < 3 || y >= NLINES - 3) + return TRUE; + return (x < 3 || x >= NCOLS - 3); + case 2: /* holy pattern! */ + return ((x + y) & 01); + case 3: /* bar across center */ + return (y >= 9 && y <= 15); + } + /* NOTREACHED */ +} diff --git a/vendor/netbsd-curses/libcurses/PSD.doc/win_st.c b/vendor/netbsd-curses/libcurses/PSD.doc/win_st.c new file mode 100644 index 0000000..2bca054 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/PSD.doc/win_st.c @@ -0,0 +1,56 @@ +.\" $NetBSD: win_st.c,v 1.5 2003/08/07 16:44:29 agc Exp $ +.\" +.\" Copyright (c) 1980, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)win_st.c 8.1 (Berkeley) 6/8/93 +.\" +# define WINDOW struct _win_st + +struct _win_st { + short _cury, _curx; + short _maxy, _maxx; + short _begy, _begx; + short _flags; + short _ch_off; + bool _clear; + bool _leave; + bool _scroll; + char **_y; + short *_firstch; + short *_lastch; + struct _win_st *_nextp, *_orig; +}; + +# define _ENDLINE 001 +# define _FULLWIN 002 +# define _SCROLLWIN 004 +# define _FLUSH 010 +# define _FULLLINE 020 +# define _IDLINE 040 +# define _STANDOUT 0200 +# define _NOCHANGE -1 diff --git a/vendor/netbsd-curses/libcurses/acs.c b/vendor/netbsd-curses/libcurses/acs.c new file mode 100644 index 0000000..8c1db4e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/acs.c @@ -0,0 +1,306 @@ +/* $NetBSD: acs.c,v 1.21 2017/01/06 13:53:18 roy Exp $ */ + +/* + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "curses.h" +#include "curses_private.h" +#include +#include "term.h" +#include +chtype _acs_char[NUM_ACS]; +#ifdef HAVE_WCHAR +#include +#include +#include +#include + +cchar_t _wacs_char[ NUM_ACS ]; +#endif /* HAVE_WCHAR */ + +/* + * __init_acs -- + * Fill in the ACS characters. The 'acs_chars' terminfo entry is a list of + * character pairs - ACS definition then terminal representation. + */ +void +__init_acs(SCREEN *screen) +{ + int count; + const char *aofac; /* Address of 'ac' */ + unsigned char acs, term; + + /* Default value '+' for all ACS characters */ + for (count=0; count < NUM_ACS; count++) + _acs_char[count]= '+'; + + /* Add the SUSv2 defaults (those that are not '+') */ + ACS_RARROW = '>'; + ACS_LARROW = '<'; + ACS_UARROW = '^'; + ACS_DARROW = 'v'; + ACS_BLOCK = '#'; +/* ACS_DIAMOND = '+'; */ + ACS_CKBOARD = ':'; + ACS_DEGREE = 39; /* ' */ + ACS_PLMINUS = '#'; + ACS_BOARD = '#'; + ACS_LANTERN = '#'; +/* ACS_LRCORNER = '+'; */ +/* ACS_URCORNER = '+'; */ +/* ACS_ULCORNER = '+'; */ +/* ACS_LLCORNER = '+'; */ +/* ACS_PLUS = '+'; */ + ACS_HLINE = '-'; + ACS_S1 = '-'; + ACS_S9 = '_'; +/* ACS_LTEE = '+'; */ +/* ACS_RTEE = '+'; */ +/* ACS_BTEE = '+'; */ +/* ACS_TTEE = '+'; */ + ACS_VLINE = '|'; + ACS_BULLET = 'o'; + /* Add the extensions defaults */ + ACS_S3 = '-'; + ACS_S7 = '-'; + ACS_LEQUAL = '<'; + ACS_GEQUAL = '>'; + ACS_PI = '*'; + ACS_NEQUAL = '!'; + ACS_STERLING = 'f'; + + if (t_acs_chars(screen->term) == NULL) + goto out; + + aofac = t_acs_chars(screen->term); + + while (*aofac != '\0') { + if ((acs = *aofac) == '\0') + return; + if ((term = *++aofac) == '\0') + return; + /* Only add characters 1 to 127 */ + if (acs < NUM_ACS) + _acs_char[acs] = term | __ALTCHARSET; + aofac++; +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, "__init_acs: %c = %c\n", acs, term); +#endif + } + + if (t_ena_acs(screen->term) != NULL) + ti_puts(screen->term, t_ena_acs(screen->term), 0, + __cputchar_args, screen->outfd); + +out: + for (count=0; count < NUM_ACS; count++) + screen->acs_char[count]= _acs_char[count]; +} + +void +_cursesi_reset_acs(SCREEN *screen) +{ + int count; + + for (count=0; count < NUM_ACS; count++) + _acs_char[count]= screen->acs_char[count]; +} + +#ifdef HAVE_WCHAR +/* + * __init_wacs -- + * Fill in the ACS characters. The 'acs_chars' terminfo entry is a list of + * character pairs - ACS definition then terminal representation. + */ +void +__init_wacs(SCREEN *screen) +{ + int count; + const char *aofac; /* Address of 'ac' */ + unsigned char acs, term; + char *lstr; + + /* Default value '+' for all ACS characters */ + for (count=0; count < NUM_ACS; count++) { + _wacs_char[ count ].vals[ 0 ] = ( wchar_t )btowc( '+' ); + _wacs_char[ count ].attributes = 0; + _wacs_char[ count ].elements = 1; + } + + /* Add the SUSv2 defaults (those that are not '+') */ + if (!strcmp(setlocale(LC_CTYPE, NULL), "C")) + setlocale(LC_CTYPE, ""); + lstr = nl_langinfo(CODESET); + _DIAGASSERT(lstr); + if (strcasecmp(lstr, "UTF-8")) { +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, "__init_wacs: setting defaults\n" ); +#endif /* DEBUG */ + WACS_RARROW->vals[0] = ( wchar_t )btowc( '>' ); + WACS_LARROW->vals[0] = ( wchar_t )btowc( '<' ); + WACS_UARROW->vals[0] = ( wchar_t )btowc( '^' ); + WACS_DARROW->vals[0] = ( wchar_t )btowc( 'v' ); + WACS_BLOCK->vals[0] = ( wchar_t )btowc( '#' ); + WACS_CKBOARD->vals[0] = ( wchar_t )btowc( ':' ); + WACS_DEGREE->vals[0] = ( wchar_t )btowc( 39 ); /* ' */ + WACS_PLMINUS->vals[0] = ( wchar_t )btowc( '#' ); + WACS_BOARD->vals[0] = ( wchar_t )btowc( '#' ); + WACS_LANTERN->vals[0] = ( wchar_t )btowc( '#' ); + WACS_HLINE->vals[0] = ( wchar_t )btowc( '-' ); + WACS_S1->vals[0] = ( wchar_t )btowc( '-' ); + WACS_S9->vals[0] = ( wchar_t )btowc( '_' ); + WACS_VLINE->vals[0] = ( wchar_t )btowc( '|' ); + WACS_BULLET->vals[0] = ( wchar_t )btowc( 'o' ); + WACS_S3->vals[0] = ( wchar_t )btowc( 'p' ); + WACS_S7->vals[0] = ( wchar_t )btowc( 'r' ); + WACS_LEQUAL->vals[0] = ( wchar_t )btowc( 'y' ); + WACS_GEQUAL->vals[0] = ( wchar_t )btowc( 'z' ); + WACS_PI->vals[0] = ( wchar_t )btowc( '{' ); + WACS_NEQUAL->vals[0] = ( wchar_t )btowc( '|' ); + WACS_STERLING->vals[0]= ( wchar_t )btowc( '}' ); + } else { + /* Unicode defaults */ +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, + "__init_wacs: setting Unicode defaults\n" ); +#endif /* DEBUG */ + WACS_RARROW->vals[0] = 0x2192; + ACS_RARROW = '+' | __ACS_IS_WACS; + WACS_LARROW->vals[0] = 0x2190; + ACS_LARROW = ',' | __ACS_IS_WACS; + WACS_UARROW->vals[0] = 0x2191; + ACS_UARROW = '-' | __ACS_IS_WACS; + WACS_DARROW->vals[0] = 0x2193; + ACS_DARROW = '.' | __ACS_IS_WACS; + WACS_BLOCK->vals[0] = 0x25ae; + ACS_BLOCK = '0' | __ACS_IS_WACS; + WACS_DIAMOND->vals[0] = 0x25c6; + ACS_DIAMOND = '`' | __ACS_IS_WACS; + WACS_CKBOARD->vals[0] = 0x2592; + ACS_CKBOARD = 'a' | __ACS_IS_WACS; + WACS_DEGREE->vals[0] = 0x00b0; + ACS_DEGREE = 'f' | __ACS_IS_WACS; + WACS_PLMINUS->vals[0] = 0x00b1; + ACS_PLMINUS = 'g' | __ACS_IS_WACS; + WACS_BOARD->vals[0] = 0x2592; + ACS_BOARD = 'h' | __ACS_IS_WACS; + WACS_LANTERN->vals[0] = 0x2603; + ACS_LANTERN = 'i' | __ACS_IS_WACS; + WACS_LRCORNER->vals[0]= 0x2518; + ACS_LRCORNER = 'j' | __ACS_IS_WACS; + WACS_URCORNER->vals[0]= 0x2510; + ACS_URCORNER = 'k' | __ACS_IS_WACS; + WACS_ULCORNER->vals[0]= 0x250c; + ACS_ULCORNER = 'l' | __ACS_IS_WACS; + WACS_LLCORNER->vals[0]= 0x2514; + ACS_LLCORNER = 'm' | __ACS_IS_WACS; + WACS_PLUS->vals[0] = 0x253c; + ACS_PLUS = 'n' | __ACS_IS_WACS; + WACS_HLINE->vals[0] = 0x2500; + ACS_HLINE = 'q' | __ACS_IS_WACS; + WACS_S1->vals[0] = 0x23ba; + ACS_S1 = 'o' | __ACS_IS_WACS; + WACS_S9->vals[0] = 0x23bd; + ACS_S9 = 's' | __ACS_IS_WACS; + WACS_LTEE->vals[0] = 0x251c; + ACS_LTEE = 't' | __ACS_IS_WACS; + WACS_RTEE->vals[0] = 0x2524; + ACS_RTEE = 'u' | __ACS_IS_WACS; + WACS_BTEE->vals[0] = 0x2534; + ACS_BTEE = 'v' | __ACS_IS_WACS; + WACS_TTEE->vals[0] = 0x252c; + ACS_TTEE = 'w' | __ACS_IS_WACS; + WACS_VLINE->vals[0] = 0x2502; + ACS_VLINE = 'x' | __ACS_IS_WACS; + WACS_BULLET->vals[0] = 0x00b7; + ACS_BULLET = '~' | __ACS_IS_WACS; + WACS_S3->vals[0] = 0x23bb; + ACS_S3 = 'p' | __ACS_IS_WACS; + WACS_S7->vals[0] = 0x23bc; + ACS_S7 = 'r' | __ACS_IS_WACS; + WACS_LEQUAL->vals[0] = 0x2264; + ACS_LEQUAL = 'y' | __ACS_IS_WACS; + WACS_GEQUAL->vals[0] = 0x2265; + ACS_GEQUAL = 'z' | __ACS_IS_WACS; + WACS_PI->vals[0] = 0x03C0; + ACS_PI = '{' | __ACS_IS_WACS; + WACS_NEQUAL->vals[0] = 0x2260; + ACS_NEQUAL = '|' | __ACS_IS_WACS; + WACS_STERLING->vals[0]= 0x00A3; + ACS_STERLING = '}' | __ACS_IS_WACS; + } + + if (t_acs_chars(screen->term) == NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, + "__init_wacs: no alternative characters\n" ); +#endif /* DEBUG */ + goto out; + } + + aofac = t_acs_chars(screen->term); + + while (*aofac != '\0') { + if ((acs = *aofac) == '\0') + return; + if ((term = *++aofac) == '\0') + return; + /* Only add characters 1 to 127 */ + if (acs < NUM_ACS) { + _wacs_char[acs].vals[ 0 ] = term; + _wacs_char[acs].attributes |= WA_ALTCHARSET; + } + aofac++; +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, "__init_wacs: %c = %c\n", acs, term); +#endif + } + + if (t_ena_acs(screen->term) != NULL) + ti_puts(screen->term, t_ena_acs(screen->term), 0, + __cputchar_args, screen->outfd); + +out: + for (count=0; count < NUM_ACS; count++) { + memcpy(&screen->wacs_char[count], &_wacs_char[count], + sizeof(cchar_t)); + screen->acs_char[count]= _acs_char[count]; + } +} + +void +_cursesi_reset_wacs(SCREEN *screen) +{ + int count; + + for (count=0; count < NUM_ACS; count++) + memcpy( &_wacs_char[count], &screen->wacs_char[count], + sizeof( cchar_t )); +} +#endif /* HAVE_WCHAR */ diff --git a/vendor/netbsd-curses/libcurses/add_wch.c b/vendor/netbsd-curses/libcurses/add_wch.c new file mode 100644 index 0000000..1dfaec3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/add_wch.c @@ -0,0 +1,107 @@ +/* $NetBSD: add_wch.c,v 1.9 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include "curses.h" +#include "curses_private.h" +#ifdef DEBUG +#include +#endif + +/* + * add_wch -- + * Add the wide character to the current position in stdscr. + * + */ +int +add_wch(const cchar_t *wch) +{ + return wadd_wch(stdscr, wch); +} + + +/* + * mvadd_wch -- + * Add the wide character to stdscr at the given location. + */ +int +mvadd_wch(int y, int x, const cchar_t *wch) +{ + return mvwadd_wch(stdscr, y, x, wch); +} + + +/* + * mvwadd_wch -- + * Add the character to the given window at the given location. + */ +int +mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wadd_wch(win, wch); +} + + +/* + * wadd_wch -- + * Add the wide character to the current position in the + * given window. + * + */ +int +wadd_wch(WINDOW *win, const cchar_t *wch) +{ + int y = win->cury; + __LINE *lnp = NULL; + +#ifdef DEBUG + int i; + int x = win->curx; + + for (i = 0; i < win->maxy; i++) { + assert(win->alines[i]->sentinel == SENTINEL_VALUE); + } + __CTRACE(__CTRACE_INPUT, "wadd_wch: win(%p), x: %d, y: %d\n", + win, x, y); +#endif + lnp = win->alines[y]; + return _cursesi_addwchar(win, &lnp, &(win->cury), &(win->curx), wch, 1); +} diff --git a/vendor/netbsd-curses/libcurses/add_wchstr.c b/vendor/netbsd-curses/libcurses/add_wchstr.c new file mode 100644 index 0000000..432e05f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/add_wchstr.c @@ -0,0 +1,304 @@ +/* $NetBSD: add_wchstr.c,v 1.8 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 700 +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * add_wchstr -- + * Add a wide string to stdscr starting at (_cury, _curx). + */ +int +add_wchstr(const cchar_t *wchstr) +{ + return wadd_wchnstr(stdscr, wchstr, -1); +} + + +/* + * wadd_wchstr -- + * Add a string to the given window starting at (_cury, _curx). + */ +int +wadd_wchstr(WINDOW *win, const cchar_t *wchstr) +{ + return wadd_wchnstr(win, wchstr, -1); +} + + +/* + * add_wchnstr -- + * Add a string (at most n characters) to stdscr starting + * at (_cury, _curx). If n is negative, add the entire string. + */ +int +add_wchnstr(const cchar_t *wchstr, int n) +{ + return wadd_wchnstr(stdscr, wchstr, n); +} + + +/* + * mvadd_wchstr -- + * Add a string to stdscr starting at (y, x) + */ +int +mvadd_wchstr(int y, int x, const cchar_t *wchstr) +{ + return mvwadd_wchnstr(stdscr, y, x, wchstr, -1); +} + + +/* + * mvwadd_wchstr -- + * Add a string to the given window starting at (y, x) + */ +int +mvwadd_wchstr(WINDOW *win, int y, int x, const cchar_t *wchstr) +{ + return mvwadd_wchnstr(win, y, x, wchstr, -1); +} + + +/* + * mvadd_wchnstr -- + * Add a string of at most n characters to stdscr + * starting at (y, x). + */ +int +mvadd_wchnstr(int y, int x, const cchar_t *wchstr, int n) +{ + return mvwadd_wchnstr(stdscr, y, x, wchstr, n); +} + + +/* + * mvwadd_wchnstr -- + * Add a string of at most n characters to the given window + * starting at (y, x). + */ +int +mvwadd_wchnstr(WINDOW *win, int y, int x, const cchar_t *wchstr, int n) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wadd_wchnstr(win, wchstr, n); +} + + +/* + * wadd_wchnstr -- + * Add a string (at most n wide characters) to the given window + * starting at (_cury, _curx). If n is -1, add the entire string. + */ +int +wadd_wchnstr(WINDOW *win, const cchar_t *wchstr, int n) +{ + const cchar_t *chp; + wchar_t wc; + int cw, x, y, sx, ex, newx, i, cnt; + __LDATA *lp, *tp; + nschar_t *np, *tnp; + __LINE *lnp; + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "wadd_wchnstr: win = %p, wchstr = %p, n = %d\n", win, wchstr, n); +#endif + + if (!wchstr) + return OK; + + /* compute length of the cchar string */ + if (n < -1) + return ERR; + if (n >= 0) + for (chp = wchstr, cnt = 0; n && chp->vals[0]; + n--, chp++, ++cnt); + else + for (chp = wchstr, cnt = 0; chp->vals[0]; chp++, ++cnt); +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wadd_wchnstr: len=%d\n", cnt); +#endif /* DEBUG */ + chp = wchstr; + x = win->curx; + y = win->cury; + lp = &win->alines[y]->line[x]; + lnp = win->alines[y]; + + cw = WCOL(*lp); + if (cw >= 0) { + sx = x; + } else { + if (wcwidth(chp->vals[0])) { + /* clear the partial character before cursor */ + for (tp = lp + cw; tp < lp; tp++) { + tp->ch = (wchar_t) btowc((int) win->bch); + if (_cursesi_copy_nsp(win->bnsp, tp) == ERR) + return ERR; + tp->attr = win->battr; + SET_WCOL(*tp, 1); + np = tp->nsp; + } + } else { + /* move to the start of current char */ + lp += cw; + x += cw; + } + sx = x + cw; + } + lnp->flags |= __ISDIRTY; + newx = sx + win->ch_off; + if (newx < *lnp->firstchp) + *lnp->firstchp = newx; + + /* add characters in the string */ + ex = x; + while (cnt) { + x = ex; + wc = chp->vals[0]; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wadd_wchnstr: adding %x", wc); +#endif /* DEBUG */ + cw = wcwidth(wc); + if (cw < 0) + cw = 1; + if (cw) { + /* spacing character */ +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + " as a spacing char(width=%d)\n", cw); +#endif /* DEBUG */ + if (cw > win->maxx - ex) { + /* clear to EOL */ + while (ex < win->maxx) { + lp->ch = (wchar_t) + btowc((int) win->bch); + if (_cursesi_copy_nsp(win->bnsp, lp) + == ERR) + return ERR; + lp->attr = win->battr; + SET_WCOL(*lp, 1); + lp++, ex++; + } + ex = win->maxx - 1; + break; + } + /* this could combine with the insertion of + * non-spacing char */ + np = lp->nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + lp->nsp = NULL; + } + lp->ch = chp->vals[0]; + lp->attr = chp->attributes & WA_ATTRIBUTES; + SET_WCOL(*lp, cw); + if (chp->elements > 1) { + for (i = 1; i < chp->elements; i++) { + np = (nschar_t *) + malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = chp->vals[i]; + np->next = lp->nsp; + lp->nsp = np; + } + } + lp++, ex++; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "wadd_wchnstr: ex = %d, x = %d, cw = %d\n", + ex, x, cw); +#endif /* DEBUG */ + while (ex - x <= cw - 1) { + np = lp->nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + lp->nsp = NULL; + } + lp->ch = chp->vals[0]; + lp->attr = chp->attributes & WA_ATTRIBUTES; + SET_WCOL(*lp, x - ex); + lp++, ex++; + } + } else { + /* non-spacing character */ +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "wadd_wchnstr: as non-spacing char"); +#endif /* DEBUG */ + for (i = 0; i < chp->elements; i++) { + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = chp->vals[i]; + np->next = lp->nsp; + lp->nsp = np; + } + } + cnt--, chp++; + } +#ifdef DEBUG + for (i = sx; i < ex; i++) { + __CTRACE(__CTRACE_INPUT, "wadd_wchnstr: (%d,%d)=(%x,%x,%p)\n", + win->cury, i, win->alines[win->cury]->line[i].ch, + win->alines[win->cury]->line[i].attr, + win->alines[win->cury]->line[i].nsp); + } +#endif /* DEBUG */ + lnp->flags |= __ISDIRTY; + newx = ex + win->ch_off; + if (newx > *lnp->lastchp) + *lnp->lastchp = newx; + __touchline(win, y, sx, ex); + + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/addbytes.c b/vendor/netbsd-curses/libcurses/addbytes.c new file mode 100644 index 0000000..e2463c8 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/addbytes.c @@ -0,0 +1,598 @@ +/* $NetBSD: addbytes.c,v 1.54 2021/02/13 14:30:37 rillig Exp $ */ + +/* + * Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 700 +#include + +#include +#include +#include +#include "curses.h" +#include "curses_private.h" +#ifdef DEBUG +#include +#endif + +#ifndef _CURSES_USE_MACROS + +/* + * addbytes -- + * Add the characters to the current position in stdscr. + */ +int +addbytes(const char *bytes, int count) +{ + + return _cursesi_waddbytes(stdscr, bytes, count, 0, 1); +} + +/* + * waddbytes -- + * Add the characters to the current position in the given window. + */ +int +waddbytes(WINDOW *win, const char *bytes, int count) +{ + + return _cursesi_waddbytes(win, bytes, count, 0, 1); +} + +/* + * mvaddbytes -- + * Add the characters to stdscr at the location given. + */ +int +mvaddbytes(int y, int x, const char *bytes, int count) +{ + + return mvwaddbytes(stdscr, y, x, bytes, count); +} + +/* + * mvwaddbytes -- + * Add the characters to the given window at the location given. + */ +int +mvwaddbytes(WINDOW *win, int y, int x, const char *bytes, int count) +{ + + if (wmove(win, y, x) == ERR) + return ERR; + + return _cursesi_waddbytes(win, bytes, count, 0, 1); +} + +#endif + +int +__waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr) +{ + + return _cursesi_waddbytes(win, bytes, count, attr, 1); +} + +/* + * _cursesi_waddbytes -- + * Add the characters to the current position in the given window. + * if char_interp is non-zero then character interpretation is done on + * the byte (i.e. \n to newline, \r to carriage return, \b to backspace + * and so on). + */ +int +_cursesi_waddbytes(WINDOW *win, const char *bytes, int count, attr_t attr, + int char_interp) +{ + int *py = &win->cury, *px = &win->curx, err; + __LINE *lp; +#ifdef HAVE_WCHAR + int n; + cchar_t cc; + wchar_t wc; + mbstate_t st; +#else + int c; +#endif +#ifdef DEBUG + int i; + + for (i = 0; i < win->maxy; i++) { + assert(win->alines[i]->sentinel == SENTINEL_VALUE); + } + + __CTRACE(__CTRACE_INPUT, "ADDBYTES: add %d bytes\n", count); +#endif + + err = OK; + lp = win->alines[*py]; + +#ifdef HAVE_WCHAR + (void)memset(&st, 0, sizeof(st)); +#endif + while (count > 0) { +#ifndef HAVE_WCHAR + c = *bytes++; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "ADDBYTES('%c', %x) at (%d, %d)\n", + c, attr, *py, *px); +#endif + err = _cursesi_addbyte(win, &lp, py, px, c, attr, char_interp); + count--; +#else + /* + * For wide-character support only, try to convert the + * given string into a wide character - we do this because + * this is how ncurses behaves (not that I think this is + * actually the correct thing to do but if we don't do it + * a lot of things that rely on this behaviour will break + * and we will be blamed). If the conversion succeeds + * then we eat the n characters used to make the wide char + * from the string. + */ + n = (int)mbrtowc(&wc, bytes, (size_t)count, &st); + if (n < 0) { + /* not a valid conversion just eat a char */ + wc = *bytes; + n = 1; + (void)memset(&st, 0, sizeof(st)); + } else if (wc == 0) { + break; + } +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "ADDBYTES WIDE(0x%x [%s], %x) at (%d, %d), ate %d bytes\n", + (unsigned)wc, unctrl((unsigned)wc), attr, *py, *px, n); +#endif + cc.vals[0] = wc; + cc.elements = 1; + cc.attributes = attr; + err = _cursesi_addwchar(win, &lp, py, px, &cc, char_interp); + bytes += n; + count -= n; +#endif + } + +#ifdef DEBUG + for (i = 0; i < win->maxy; i++) { + assert(win->alines[i]->sentinel == SENTINEL_VALUE); + } +#endif + + return (err); +} + +/* + * _cursesi_addbyte - + * Internal function to add a byte and update the row and column + * positions as appropriate. If char_interp is non-zero then + * character interpretation is done on the byte. This function is + * only used in the narrow character version of curses. + */ +int +_cursesi_addbyte(WINDOW *win, __LINE **lp, int *y, int *x, int c, + attr_t attr, int char_interp) +{ + static char blank[] = " "; + int tabsize; + int newx, i; + attr_t attributes; + + if (char_interp) { + switch (c) { + case '\t': + tabsize = win->screen->TABSIZE; + newx = tabsize - (*x % tabsize); + for (i = 0; i < newx; i++) { + if (waddbytes(win, blank, 1) == ERR) + return ERR; + } + return OK; + + case '\n': + wclrtoeol(win); + (*lp)->flags |= __ISPASTEOL; + break; + + case '\r': + *x = 0; + return OK; + + case '\b': + if (--(*x) < 0) + *x = 0; + return OK; + } + } + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "ADDBYTES(%p, %d, %d)\n", win, *y, *x); +#endif + + if (char_interp && ((*lp)->flags & __ISPASTEOL)) { + *x = 0; + (*lp)->flags &= ~__ISPASTEOL; + if (*y == win->scr_b) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "ADDBYTES - on bottom " + "of scrolling region\n"); +#endif + if (!(win->flags & __SCROLLOK)) + return ERR; + scroll(win); + } else { + (*y)++; + } + *lp = win->alines[*y]; + if (c == '\n') + return OK; + } + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "ADDBYTES: 1: y = %d, x = %d, firstch = %d, lastch = %d\n", + *y, *x, *win->alines[*y]->firstchp, + *win->alines[*y]->lastchp); +#endif + + attributes = (win->wattr | attr) & (__ATTRIBUTES & ~__COLOR); + if (attr & __COLOR) + attributes |= attr & __COLOR; + else if (win->wattr & __COLOR) + attributes |= win->wattr & __COLOR; + + /* + * Always update the change pointers. Otherwise, + * we could end up not displaying 'blank' characters + * when overlapping windows are displayed. + */ + newx = *x + win->ch_off; + (*lp)->flags |= __ISDIRTY; + /* + * firstchp/lastchp are shared between + * parent window and sub-window. + */ + if (newx < *(*lp)->firstchp) + *(*lp)->firstchp = newx; + if (newx > *(*lp)->lastchp) + *(*lp)->lastchp = newx; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "ADDBYTES: change gives f/l: %d/%d [%d/%d]\n", + *(*lp)->firstchp, *(*lp)->lastchp, + *(*lp)->firstchp - win->ch_off, + *(*lp)->lastchp - win->ch_off); +#endif + if (win->bch != ' ' && c == ' ') + (*lp)->line[*x].ch = win->bch; + else + (*lp)->line[*x].ch = c; + + if (attributes & __COLOR) + (*lp)->line[*x].attr = + attributes | (win->battr & ~__COLOR); + else + (*lp)->line[*x].attr = attributes | win->battr; + + if (*x == win->maxx - 1) + (*lp)->flags |= __ISPASTEOL; + else + (*x)++; + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "ADDBYTES: 2: y = %d, x = %d, firstch = %d, lastch = %d\n", + *y, *x, *win->alines[*y]->firstchp, + *win->alines[*y]->lastchp); +#endif + __sync(win); + return OK; +} + +/* + * _cursesi_addwchar - + * Internal function to add a wide character and update the row + * and column positions. + */ +int +_cursesi_addwchar(WINDOW *win, __LINE **lnp, int *y, int *x, + const cchar_t *wch, int char_interp) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + int sx = 0, ex = 0, cw = 0, i = 0, newx = 0, tabsize; + __LDATA *lp = &win->alines[*y]->line[*x], *tp = NULL; + nschar_t *np = NULL; + cchar_t cc; + attr_t attributes; + + if (char_interp) { + /* special characters handling */ + switch (wch->vals[0]) { + case L'\b': + if (--*x < 0) + *x = 0; + return OK; + case L'\r': + *x = 0; + return OK; + case L'\n': + wclrtoeol(win); + *x = 0; + (*lnp)->flags &= ~__ISPASTEOL; + if (*y == win->scr_b) { + if (!(win->flags & __SCROLLOK)) + return ERR; + scroll(win); + } else { + (*y)++; + } + return OK; + case L'\t': + cc.vals[0] = L' '; + cc.elements = 1; + cc.attributes = win->wattr; + tabsize = win->screen->TABSIZE; + newx = tabsize - (*x % tabsize); + for (i = 0; i < newx; i++) { + if (wadd_wch(win, &cc) == ERR) + return ERR; + } + return OK; + } + } + + /* check for non-spacing character */ + if (!wcwidth(wch->vals[0])) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "_cursesi_addwchar: char '%c' is non-spacing\n", + wch->vals[0]); +#endif /* DEBUG */ + cw = WCOL(*lp); + if (cw < 0) { + lp += cw; + *x += cw; + } + for (i = 0; i < wch->elements; i++) { + if (!(np = (nschar_t *) malloc(sizeof(nschar_t)))) + return ERR;; + np->ch = wch->vals[i]; + np->next = lp->nsp; + lp->nsp = np; + } + (*lnp)->flags |= __ISDIRTY; + newx = *x + win->ch_off; + if (newx < *(*lnp)->firstchp) + *(*lnp)->firstchp = newx; + if (newx > *(*lnp)->lastchp) + *(*lnp)->lastchp = newx; + __touchline(win, *y, *x, *x); + return OK; + } + /* check for new line first */ + if (char_interp && ((*lnp)->flags & __ISPASTEOL)) { + *x = 0; + (*lnp)->flags &= ~__ISPASTEOL; + if (*y == win->scr_b) { + if (!(win->flags & __SCROLLOK)) + return ERR; + scroll(win); + } else { + (*y)++; + } + (*lnp) = win->alines[*y]; + lp = &win->alines[*y]->line[*x]; + } + /* clear out the current character */ + cw = WCOL(*lp); + if (cw >= 0) { + sx = *x; + } else { + for (sx = *x - 1; sx >= max(*x + cw, 0); sx--) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "_cursesi_addwchar: clear current char (%d,%d)\n", + *y, sx); +#endif /* DEBUG */ + tp = &win->alines[*y]->line[sx]; + tp->ch = (wchar_t) btowc((int) win->bch); + if (_cursesi_copy_nsp(win->bnsp, tp) == ERR) + return ERR; + + tp->attr = win->battr; + SET_WCOL(*tp, 1); + } + sx = *x + cw; + (*lnp)->flags |= __ISDIRTY; + newx = sx + win->ch_off; + if (newx < *(*lnp)->firstchp) + *(*lnp)->firstchp = newx; + } + + /* check for enough space before the end of line */ + cw = wcwidth(wch->vals[0]); + if (cw < 0) + cw = 1; + + if (cw > win->maxx - *x) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "_cursesi_addwchar: clear EOL (%d,%d)\n", + *y, *x); +#endif /* DEBUG */ + (*lnp)->flags |= __ISDIRTY; + newx = *x + win->ch_off; + if (newx < *(*lnp)->firstchp) + *(*lnp)->firstchp = newx; + for (tp = lp; *x < win->maxx; tp++, (*x)++) { + tp->ch = (wchar_t) btowc((int) win->bch); + if (_cursesi_copy_nsp(win->bnsp, tp) == ERR) + return ERR; + tp->attr = win->battr; + SET_WCOL(*tp, 1); + } + newx = win->maxx - 1 + win->ch_off; + if (newx > *(*lnp)->lastchp) + *(*lnp)->lastchp = newx; + __touchline(win, *y, sx, (int) win->maxx - 1); + sx = *x = 0; + if (*y == win->scr_b) { + if (!(win->flags & __SCROLLOK)) + return ERR; + scroll(win); + } else { + (*y)++; + } + lp = &win->alines[*y]->line[0]; + (*lnp) = win->alines[*y]; + } + + /* add spacing character */ +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "_cursesi_addwchar: add character (%d,%d) 0x%x\n", + *y, *x, wch->vals[0]); +#endif /* DEBUG */ + (*lnp)->flags |= __ISDIRTY; + newx = *x + win->ch_off; + if (newx < *(*lnp)->firstchp) + *(*lnp)->firstchp = newx; + if (lp->nsp) { + __cursesi_free_nsp(lp->nsp); + lp->nsp = NULL; + } + + lp->ch = wch->vals[0]; + + attributes = (win->wattr | wch->attributes) + & (WA_ATTRIBUTES & ~__COLOR); + if (wch->attributes & __COLOR) + attributes |= wch->attributes & __COLOR; + else if (win->wattr & __COLOR) + attributes |= win->wattr & __COLOR; + if (attributes & __COLOR) + lp->attr = attributes | (win->battr & ~__COLOR); + else + lp->attr = attributes | win->battr; + + SET_WCOL(*lp, cw); + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "_cursesi_addwchar: add spacing char 0x%x, attr 0x%x\n", + lp->ch, lp->attr); +#endif /* DEBUG */ + + if (wch->elements > 1) { + for (i = 1; i < wch->elements; i++) { + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR;; + np->ch = wch->vals[i]; + np->next = lp->nsp; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "_cursesi_addwchar: add non-spacing char 0x%x\n", np->ch); +#endif /* DEBUG */ + lp->nsp = np; + } + } +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: non-spacing list header: %p\n", + lp->nsp); + __CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: add rest columns (%d:%d)\n", + sx + 1, sx + cw - 1); + __CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: *x = %d, win->maxx = %d\n", *x, win->maxx); +#endif /* DEBUG */ + for (tp = lp + 1, *x = sx + 1; *x - sx <= cw - 1; tp++, (*x)++) { + if (tp->nsp) { + __cursesi_free_nsp(tp->nsp); + tp->nsp = NULL; + } + tp->ch = wch->vals[0]; + tp->attr = lp->attr & WA_ATTRIBUTES; + /* Mark as "continuation" cell */ + tp->attr |= __WCWIDTH; + } + + if (*x == win->maxx) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: do line wrap\n"); +#endif /* DEBUG */ + newx = win->maxx - 1 + win->ch_off; + if (newx > *(*lnp)->lastchp) + *(*lnp)->lastchp = newx; + __touchline(win, *y, sx, (int) win->maxx - 1); + *x = sx = 0; + if (*y == win->scr_b) { + if (!(win->flags & __SCROLLOK)) + return ERR; + scroll(win); + } else { + (*y)++; + } + lp = &win->alines[*y]->line[0]; + (*lnp) = win->alines[*y]; + } else { + + /* clear the remaining of the current character */ + if (*x && *x < win->maxx) { + ex = sx + cw; + tp = &win->alines[*y]->line[ex]; + while (ex < win->maxx && WCOL(*tp) < 0) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "_cursesi_addwchar: clear " + "remaining of current char (%d,%d)nn", + *y, ex); +#endif /* DEBUG */ + tp->ch = (wchar_t) btowc((int) win->bch); + if (_cursesi_copy_nsp(win->bnsp, tp) == ERR) + return ERR; + tp->attr = win->battr; + SET_WCOL(*tp, 1); + tp++, ex++; + } + newx = ex - 1 + win->ch_off; + if (newx > *(*lnp)->lastchp) + *(*lnp)->lastchp = newx; + __touchline(win, *y, sx, ex - 1); + } + } + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: %d : 0x%x\n", lp->ch, lp->attr); + __CTRACE(__CTRACE_INPUT, "_cursesi_addwchar: *x = %d, *y = %d, win->maxx = %d\n", *x, *y, win->maxx); +#endif /* DEBUG */ + __sync(win); + return OK; +#endif +} diff --git a/vendor/netbsd-curses/libcurses/addch.3 b/vendor/netbsd-curses/libcurses/addch.3 new file mode 120000 index 0000000..b047dd4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/addch.3 @@ -0,0 +1 @@ +curses_addch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/addch.c b/vendor/netbsd-curses/libcurses/addch.c new file mode 100644 index 0000000..94fa971 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/addch.c @@ -0,0 +1,126 @@ +/* $NetBSD: addch.c,v 1.21 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * addch -- + * Add the character to the current position in stdscr. + * + */ +int +addch(chtype ch) +{ + + return waddch(stdscr, ch); +} + +/* + * mvaddch -- + * Add the character to stdscr at the given location. + */ +int +mvaddch(int y, int x, chtype ch) +{ + + return mvwaddch(stdscr, y, x, ch); +} + +/* + * mvwaddch -- + * Add the character to the given window at the given location. + */ +int +mvwaddch(WINDOW *win, int y, int x, chtype ch) +{ + + if (wmove(win, y, x) == ERR) + return ERR; + + return waddch(win, ch); +} + +#endif + +#ifdef HAVE_WCHAR +/* + * waddch -- + * Add the character to the current position in the given window. + */ +int +waddch(WINDOW *win, chtype ch) +{ + cchar_t cc; + + __cursesi_chtype_to_cchar(ch, &cc); +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "addch: %d : 0x%x (adding char as wide char)\n", + cc.vals[0], cc.attributes); +#endif + + return wadd_wch(win, &cc); +} + +#else /* !HAVE_WCHAR */ + +/* + * waddch -- + * Add the character to the current position in the given window. + */ +int +waddch(WINDOW *win, chtype ch) +{ + __LDATA buf; + + buf.ch = (wchar_t)ch & __CHARTEXT; + buf.attr = (attr_t)ch & __ATTRIBUTES; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "addch: %d : 0x%x\n", buf.ch, buf.attr); +#endif + return __waddch(win, &buf); +} +#endif /* !HAVE_WCHAR */ + +int +__waddch(WINDOW *win, __LDATA *dp) +{ + char buf[2]; + + buf[0] = dp->ch; + buf[1] = '\0'; + return _cursesi_waddbytes(win, buf, 1, dp->attr, 1); +} diff --git a/vendor/netbsd-curses/libcurses/addchnstr.3 b/vendor/netbsd-curses/libcurses/addchnstr.3 new file mode 120000 index 0000000..889b3b3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/addchnstr.3 @@ -0,0 +1 @@ +curses_addchstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/addchnstr.c b/vendor/netbsd-curses/libcurses/addchnstr.c new file mode 100644 index 0000000..cbe037b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/addchnstr.c @@ -0,0 +1,182 @@ +/* $NetBSD: addchnstr.c,v 1.8 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 2003 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Douwe Kiela (virtus@wanadoo.nl). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * addchstr -- + * Add a string to stdscr starting at (_cury, _curx). + */ +int +addchstr(const chtype *chstr) +{ + return waddchnstr(stdscr, chstr, -1); +} + +/* + * waddchstr -- + * Add a string to the given window starting at (_cury, _curx). + */ +int +waddchstr(WINDOW *win, const chtype *chstr) +{ + return waddchnstr(win, chstr, -1); +} + +/* + * addchnstr -- + * Add a string (at most n characters) to stdscr starting + * at (_cury, _curx). If n is negative, add the entire string. + */ +int +addchnstr(const chtype *chstr, int n) +{ + return waddchnstr(stdscr, chstr, n); +} + +/* + * mvaddchstr -- + * Add a string to stdscr starting at (y, x) + */ +int +mvaddchstr(int y, int x, const chtype *chstr) +{ + return mvwaddchnstr(stdscr, y, x, chstr, -1); +} + +/* + * mvwaddchstr -- + * Add a string to the given window starting at (y, x) + */ +int +mvwaddchstr(WINDOW *win, int y, int x, const chtype *chstr) +{ + return mvwaddchnstr(win, y, x, chstr, -1); +} + +/* + * mvaddchnstr -- + * Add a string of at most n characters to stdscr + * starting at (y, x). + */ +int +mvaddchnstr(int y, int x, const chtype *chstr, int n) +{ + return mvwaddchnstr(stdscr, y, x, chstr, n); +} + +/* + * mvwaddchnstr -- + * Add a string of at most n characters to the given window + * starting at (y, x). + */ +int +mvwaddchnstr(WINDOW *win, int y, int x, const chtype *chstr, int n) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return waddchnstr(win, chstr, n); +} + +#endif + +/* + * waddchnstr -- + * Add a string (at most n characters) to the given window + * starting at (_cury, _curx) until the end of line is reached or + * n characters have been added. If n is negative, add as much + * of the string that will fit on the current line. SUSv2 says + * that the addchnstr family does not wrap and strings are truncated + * to the RHS of the window. + */ +int +waddchnstr(WINDOW *win, const chtype *chstr, int n) +{ + size_t len; + const chtype *chp; + attr_t attr; + char *ocp, *cp, *start; + int i, ret, ox, oy; + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "waddchnstr: win = %p, chstr = %p, n = %d\n", + win, chstr, n); +#endif + + if (n >= 0) + for (chp = chstr, len = 0; n-- && *chp++; ++len); + else + for (chp = chstr, len = 0; *chp++; ++len); + + /* check if string is too long for current location */ + if (len > (win->maxx - win->curx)) + len = win->maxx - win->curx; + + if ((ocp = malloc(len + 1)) == NULL) + return ERR; + chp = chstr; + cp = ocp; + start = ocp; + i = 0; + attr = (*chp) & __ATTRIBUTES; + ox = win->curx; + oy = win->cury; + while (len) { + *cp = (*chp) & __CHARTEXT; + cp++; + chp++; + i++; + len--; + if (((*chp) & __ATTRIBUTES) != attr) { + *cp = '\0'; + if (_cursesi_waddbytes(win, start, i, attr, 0) == ERR) { + free(ocp); + return ERR; + } + attr = (*chp) & __ATTRIBUTES; + start = cp; + i = 0; + } + } + *cp = '\0'; + ret = _cursesi_waddbytes(win, start, i, attr, 0); + free(ocp); + wmove(win, oy, ox); + return ret; +} diff --git a/vendor/netbsd-curses/libcurses/addchstr.3 b/vendor/netbsd-curses/libcurses/addchstr.3 new file mode 120000 index 0000000..889b3b3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/addchstr.3 @@ -0,0 +1 @@ +curses_addchstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/addnstr.3 b/vendor/netbsd-curses/libcurses/addnstr.3 new file mode 120000 index 0000000..ba1150b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/addnstr.3 @@ -0,0 +1 @@ +curses_addstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/addnstr.c b/vendor/netbsd-curses/libcurses/addnstr.c new file mode 100644 index 0000000..c0ece05 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/addnstr.c @@ -0,0 +1,150 @@ +/* $NetBSD: addnstr.c,v 1.17 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * addstr -- + * Add a string to stdscr starting at (_cury, _curx). + */ +int +addstr(const char *s) +{ + return waddnstr(stdscr, s, -1); +} + +/* + * waddstr -- + * Add a string to the given window starting at (_cury, _curx). + */ +int +waddstr(WINDOW *win, const char *s) +{ + return waddnstr(win, s, -1); +} + +/* + * addnstr -- + * Add a string (at most n characters) to stdscr starting + * at (_cury, _curx). If n is negative, add the entire string. + */ +int +addnstr(const char *str, int n) +{ + return waddnstr(stdscr, str, n); +} + +/* + * mvaddstr -- + * Add a string to stdscr starting at (y, x) + */ +int +mvaddstr(int y, int x, const char *str) +{ + return mvwaddnstr(stdscr, y, x, str, -1); +} + +/* + * mvwaddstr -- + * Add a string to the given window starting at (y, x) + */ +int +mvwaddstr(WINDOW *win, int y, int x, const char *str) +{ + return mvwaddnstr(win, y, x, str, -1); +} + +/* + * mvaddnstr -- + * Add a string of at most n characters to stdscr + * starting at (y, x). + */ +int +mvaddnstr(int y, int x, const char *str, int count) +{ + return mvwaddnstr(stdscr, y, x, str, count); +} + +/* + * mvwaddnstr -- + * Add a string of at most n characters to the given window + * starting at (y, x). + */ +int +mvwaddnstr(WINDOW *win, int y, int x, const char *str, int count) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return waddnstr(win, str, count); +} + +#endif + +/* + * waddnstr -- + * Add a string (at most n characters) to the given window + * starting at (_cury, _curx). If n is negative, add the + * entire string. + */ +int +waddnstr(WINDOW *win, const char *s, int n) +{ + size_t len; + const char *p; + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "ADDNSTR: win %p, length %d\n", + win, n); +#endif + /* + * behavior changed from traditional BSD curses, for better XCURSES + * conformance. + * + * BSD curses: if (n > 0) then "at most n", else "len = strlen(s)" + * ncurses: if (n >= 0) then "at most n", else "len = strlen(s)" + * XCURSES: if (n != -1) then "at most n", else "len = strlen(s)" + * + */ + if (n >= 0) + for (p = s, len = 0; n-- && *p++; ++len); + else + len = strlen(s); + + return waddbytes(win, s, (int) len); +} diff --git a/vendor/netbsd-curses/libcurses/addstr.3 b/vendor/netbsd-curses/libcurses/addstr.3 new file mode 120000 index 0000000..ba1150b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/addstr.3 @@ -0,0 +1 @@ +curses_addstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/addwstr.c b/vendor/netbsd-curses/libcurses/addwstr.c new file mode 100644 index 0000000..e5e0e85 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/addwstr.c @@ -0,0 +1,166 @@ +/* $NetBSD: addwstr.c,v 1.6 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * addwstr -- + * Add a string to stdscr starting at (_cury, _curx). + */ +int +addwstr(const wchar_t *s) +{ + return waddnwstr(stdscr, s, -1); +} + +/* + * waddwstr -- + * Add a string to the given window starting at (_cury, _curx). + */ +int +waddwstr(WINDOW *win, const wchar_t *s) +{ + return waddnwstr(win, s, -1); +} + +/* + * addnwstr -- + * Add a string (at most n characters) to stdscr starting + * at (_cury, _curx). If n is negative, add the entire string. + */ +int +addnwstr(const wchar_t *str, int n) +{ + return waddnwstr(stdscr, str, n); +} + +/* + * mvaddwstr -- + * Add a string to stdscr starting at (y, x) + */ +int +mvaddwstr(int y, int x, const wchar_t *str) +{ + return mvwaddnwstr(stdscr, y, x, str, -1); +} + +/* + * mvwaddwstr -- + * Add a string to the given window starting at (y, x) + */ +int +mvwaddwstr(WINDOW *win, int y, int x, const wchar_t *str) +{ + return mvwaddnwstr(win, y, x, str, -1); +} + +/* + * mvaddnwstr -- + * Add a string of at most n characters to stdscr + * starting at (y, x). + */ +int +mvaddnwstr(int y, int x, const wchar_t *str, int count) +{ + return mvwaddnwstr(stdscr, y, x, str, count); +} + +/* + * mvwaddnwstr -- + * Add a string of at most n characters to the given window + * starting at (y, x). + */ +int +mvwaddnwstr(WINDOW *win, int y, int x, const wchar_t *str, int count) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return waddnwstr(win, str, count); +} + +/* + * waddnwstr -- + * Add a string (at most n characters) to the given window + * starting at (_cury, _curx). If n is negative, add the + * entire string. + */ +int +waddnwstr(WINDOW *win, const wchar_t *s, int n) +{ + size_t len; + const wchar_t *p; + cchar_t cc; + wchar_t wc[2]; + + /* + * BSD curses: if (n > 0) then "at most n", else "len = strlen(s)" + * ncurses: if (n >= 0) then "at most n", else "len = strlen(s)" + * XCURSES: if (n != -1) then "at most n", else "len = strlen(s)" + */ + /* compute the length and column width of string */ + if (n < -1) + return ERR; + if (n >= 0) + for (p = s, len = 0; n-- && *p++; ++len); + else + len = wcslen(s); +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "waddnwstr: string len=%ld\n", (long) len); +#endif /* DEBUG */ + + p = s; + while (len) { + wc[0] = *p; + wc[1] = L'\0'; + if (setcchar( &cc, wc, win->wattr, 0, NULL ) == ERR) + return ERR; + if (wadd_wch( win, &cc ) == ERR) + return ERR; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "waddnwstr: (%x,%x,%d) added\n", + cc.vals[ 0 ], cc.attributes, cc.elements ); +#endif /* DEBUG */ + p++, len--; + } + + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/assume_default_colors.3 b/vendor/netbsd-curses/libcurses/assume_default_colors.3 new file mode 120000 index 0000000..d46f50d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/assume_default_colors.3 @@ -0,0 +1 @@ +curses_default_colors.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/attr_get.3 b/vendor/netbsd-curses/libcurses/attr_get.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/attr_get.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/attr_off.3 b/vendor/netbsd-curses/libcurses/attr_off.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/attr_off.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/attr_on.3 b/vendor/netbsd-curses/libcurses/attr_on.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/attr_on.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/attr_set.3 b/vendor/netbsd-curses/libcurses/attr_set.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/attr_set.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/attributes.c b/vendor/netbsd-curses/libcurses/attributes.c new file mode 100644 index 0000000..ea8e27b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/attributes.c @@ -0,0 +1,486 @@ +/* $NetBSD: attributes.c,v 1.31 2019/07/25 20:18:50 uwe Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +static int __wattr_off(WINDOW *, attr_t); +static int __wattr_on(WINDOW *, attr_t); +static void __wcolor_set(WINDOW *, attr_t); + + +#ifndef _CURSES_USE_MACROS +#ifdef HAVE_WCHAR +/* + * attr_get -- + * Get wide attributes and color pair from stdscr + */ +/* ARGSUSED */ +int +attr_get(attr_t *attr, short *pair, void *opts) +{ + return wattr_get(stdscr, attr, pair, opts); +} + +/* + * attr_on -- + * Test and set wide attributes on stdscr + */ +/* ARGSUSED */ +int +attr_on(attr_t attr, void *opts) +{ + return wattr_on(stdscr, attr, opts); +} + +/* + * attr_off -- + * Test and unset wide attributes on stdscr + */ +/* ARGSUSED */ +int +attr_off(attr_t attr, void *opts) +{ + return wattr_off(stdscr, attr, opts); +} + +/* + * attr_set -- + * Set wide attributes and color pair on stdscr + */ +/* ARGSUSED */ +int +attr_set(attr_t attr, short pair, void *opts) +{ + return wattr_set(stdscr, attr, pair, opts); +} + +/* + * color_set -- + * Set color pair on stdscr + */ +/* ARGSUSED */ +int +color_set(short pair, void *opts) +{ + return wcolor_set(stdscr, pair, opts); +} +#endif /* HAVE_WCHAR */ + +/* + * attron -- + * Test and set attributes on stdscr + */ +int +attron(int attr) +{ + return wattron(stdscr, attr); +} + +/* + * attroff -- + * Test and unset attributes on stdscr. + */ +int +attroff(int attr) +{ + return wattroff(stdscr, attr); +} + +/* + * attrset -- + * Set specific attribute modes. + * Unset others. On stdscr. + */ +int +attrset(int attr) +{ + return wattrset(stdscr, attr); +} +#endif /* _CURSES_USE_MACROS */ + + +#ifdef HAVE_WCHAR +/* + * wattr_get -- + * Get wide attributes and colour pair from window + * Note that attributes also includes colour. + */ +/* ARGSUSED */ +int +wattr_get(WINDOW *win, attr_t *attr, short *pair, void *opts) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wattr_get: win %p\n", win); +#endif + if (attr != NULL) { + *attr = win->wattr; +#ifdef HAVE_WCHAR + *attr &= WA_ATTRIBUTES; +#endif + } + + if (pair != NULL) + *pair = PAIR_NUMBER(win->wattr); + return OK; +} + +/* + * wattr_on -- + * Test and set wide attributes on window + */ +int +wattr_on(WINDOW *win, attr_t attr, void *opts) +{ + if (__predict_false(opts != NULL)) + return ERR; + + return __wattr_on(win, attr); +} + +/* + * wattr_off -- + * Test and unset wide attributes on window + * + * Note that the 'me' sequence unsets all attributes. We handle + * which attributes should really be set in refresh.c:makech(). + */ +int +wattr_off(WINDOW *win, attr_t attr, void *opts) +{ + if (__predict_false(opts != NULL)) + return ERR; + + return __wattr_off(win, attr); +} + + +/* + * wattr_set -- + * Set wide attributes and color pair on window + */ +int +wattr_set(WINDOW *win, attr_t attr, short pair, void *opts) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wattr_set: win %p, attr %08x, pair %d\n", + win, attr, pair); +#endif + if (__predict_false(opts != NULL)) + return ERR; + + /* + * This overwrites any colour setting from the attributes + * and is compatible with ncurses. + */ + attr = (attr & ~__COLOR) | COLOR_PAIR(pair); + + __wattr_off(win, WA_ATTRIBUTES); + __wattr_on(win, attr); + return OK; +} + +/* + * wcolor_set -- + * Set color pair on window + */ +/* ARGSUSED */ +int +wcolor_set(WINDOW *win, short pair, void *opts) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, "wolor_set: win %p, pair %d\n", win, pair); +#endif + __wcolor_set(win, (attr_t) COLOR_PAIR(pair)); + return OK; +} +#endif /* HAVE_WCHAR */ + + +/* + * getattrs -- + * Get window attributes. + */ +chtype +getattrs(WINDOW *win) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "getattrs: win %p\n", win); +#endif + return((chtype) win->wattr); +} + +/* + * wattron -- + * Test and set attributes. + */ +int +wattron(WINDOW *win, int attr) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wattron: win %p, attr %08x\n", win, attr); +#endif + return __wattr_on(win, (attr_t) attr); +} + +/* + * wattroff -- + * Test and unset attributes. + */ +int +wattroff(WINDOW *win, int attr) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wattroff: win %p, attr %08x\n", win, attr); +#endif + return __wattr_off(win, (attr_t) attr); +} + +/* + * wattrset -- + * Set specific attribute modes. + * Unset others. + */ +int +wattrset(WINDOW *win, int attr) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wattrset: win %p, attr %08x\n", win, attr); +#endif + __wattr_off(win, __ATTRIBUTES); + __wattr_on(win, (attr_t) attr); + return OK; +} + +/* + * termattrs -- + * Get terminal attributes + */ +chtype +termattrs(void) +{ + chtype ch = 0; + +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "termattrs\n"); +#endif + if (exit_attribute_mode != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "termattrs: have exit attribute mode\n"); +#endif + if (enter_blink_mode != NULL) + ch |= __BLINK; + if (enter_bold_mode != NULL) + ch |= __BOLD; + if (enter_dim_mode != NULL) + ch |= __DIM; + if (enter_secure_mode != NULL) + ch |= __BLANK; + if (enter_protected_mode != NULL) + ch |= __PROTECT; + if (enter_reverse_mode != NULL) + ch |= __REVERSE; + } + if (enter_standout_mode != NULL && exit_standout_mode != NULL) + ch |= __STANDOUT; + if (enter_underline_mode != NULL && exit_underline_mode != NULL) + ch |= __UNDERSCORE; + if (enter_alt_charset_mode != NULL && exit_alt_charset_mode != NULL) + ch |= __ALTCHARSET; + + return ch; +} + + +#ifdef HAVE_WCHAR +/* + * term_attrs -- + * Get terminal wide attributes + */ +attr_t +term_attrs(void) +{ + attr_t attr = 0; + +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "term_attrs\n"); +#endif + if (exit_attribute_mode != NULL) { + if (enter_blink_mode != NULL) + attr |= __BLINK; + if (enter_bold_mode != NULL) + attr |= __BOLD; + if (enter_dim_mode != NULL) + attr |= __DIM; + if (enter_secure_mode != NULL) + attr |= __BLANK; + if (enter_protected_mode != NULL) + attr |= __PROTECT; + if (enter_reverse_mode != NULL) + attr |= __REVERSE; +#ifdef HAVE_WCHAR + if (enter_low_hl_mode != NULL) + attr |= WA_LOW; + if (enter_top_hl_mode != NULL) + attr |= WA_TOP; + if (enter_left_hl_mode != NULL) + attr |= WA_LEFT; + if (enter_right_hl_mode != NULL) + attr |= WA_RIGHT; + if (enter_horizontal_hl_mode != NULL) + attr |= WA_HORIZONTAL; + if (enter_vertical_hl_mode != NULL) + attr |= WA_VERTICAL; +#endif /* HAVE_WCHAR */ + } + if (enter_standout_mode != NULL && exit_standout_mode != NULL) + attr |= __STANDOUT; + if (enter_underline_mode != NULL && exit_underline_mode != NULL) + attr |= __UNDERSCORE; + if (enter_alt_charset_mode != NULL && exit_alt_charset_mode != NULL) + attr |= __ALTCHARSET; + + return attr; +} +#endif /* HAVE_WCHAR */ + + +static int +__wattr_on(WINDOW *win, attr_t attr) +{ + const TERMINAL *t = win->screen->term; + +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wattr_on: win %p, attr %08x\n", win, attr); +#endif + /* If can enter modes, set the relevent attribute bits. */ + if (t_exit_attribute_mode(t) != NULL) { + if (attr & __BLINK && t_enter_blink_mode(t) != NULL) + win->wattr |= __BLINK; + if (attr & __BOLD && t_enter_bold_mode(t) != NULL) + win->wattr |= __BOLD; + if (attr & __DIM && t_enter_dim_mode(t) != NULL) + win->wattr |= __DIM; + if (attr & __BLANK && t_enter_secure_mode(t) != NULL) + win->wattr |= __BLANK; + if (attr & __PROTECT && t_enter_protected_mode(t) != NULL) + win->wattr |= __PROTECT; + if (attr & __REVERSE && t_enter_reverse_mode(t) != NULL) + win->wattr |= __REVERSE; +#ifdef HAVE_WCHAR + if (attr & WA_LOW && t_enter_low_hl_mode(t) != NULL) + win->wattr |= WA_LOW; + if (attr & WA_TOP && t_enter_top_hl_mode(t) != NULL) + win->wattr |= WA_TOP; + if (attr & WA_LEFT && t_enter_left_hl_mode(t) != NULL) + win->wattr |= WA_LEFT; + if (attr & WA_RIGHT && t_enter_right_hl_mode(t) != NULL) + win->wattr |= WA_RIGHT; + if (attr & WA_HORIZONTAL && t_enter_horizontal_hl_mode(t) != NULL) + win->wattr |= WA_HORIZONTAL; + if (attr & WA_VERTICAL && t_enter_vertical_hl_mode(t) != NULL) + win->wattr |= WA_VERTICAL; +#endif /* HAVE_WCHAR */ + } + if (attr & __STANDOUT && t_enter_standout_mode(t) != NULL && + t_exit_standout_mode(t) != NULL) + wstandout(win); + if (attr & __UNDERSCORE && t_enter_underline_mode(t) != NULL && + t_exit_underline_mode(t) != NULL) + wunderscore(win); + if (attr & __COLOR) + __wcolor_set(win, attr); + return OK; +} + + +static int +__wattr_off(WINDOW *win, attr_t attr) +{ + const TERMINAL *t = win->screen->term; + +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wattr_off: win %p, attr %08x\n", win, attr); +#endif + /* If can do exit modes, unset the relevent attribute bits. */ + if (t_exit_attribute_mode(t) != NULL) { + if (attr & __BLINK) + win->wattr &= ~__BLINK; + if (attr & __BOLD) + win->wattr &= ~__BOLD; + if (attr & __DIM) + win->wattr &= ~__DIM; + if (attr & __BLANK) + win->wattr &= ~__BLANK; + if (attr & __PROTECT) + win->wattr &= ~__PROTECT; + if (attr & __REVERSE) + win->wattr &= ~__REVERSE; +#ifdef HAVE_WCHAR + if (attr & WA_LOW) + win->wattr &= ~WA_LOW; + if (attr & WA_TOP) + win->wattr &= ~WA_TOP; + if (attr & WA_LEFT) + win->wattr &= ~WA_LEFT; + if (attr & WA_RIGHT) + win->wattr &= ~WA_RIGHT; + if (attr & WA_HORIZONTAL) + win->wattr &= ~WA_HORIZONTAL; + if (attr & WA_VERTICAL) + win->wattr &= ~WA_VERTICAL; +#endif /* HAVE_WCHAR */ + } + if (attr & __STANDOUT) + wstandend(win); + if (attr & __UNDERSCORE) + wunderend(win); + if (attr & __COLOR) { + if (max_colors != 0) + win->wattr &= ~__COLOR; + } + return OK; +} + + +static void +__wcolor_set(WINDOW *win, attr_t attr) +{ + const TERMINAL *t = win->screen->term; + + /* If another color pair is set, turn that off first. */ + win->wattr &= ~__COLOR; + /* If can do color video, set the color pair bits. */ + if (t_max_colors(t) != 0 && attr & __COLOR) + win->wattr |= attr & __COLOR; +} diff --git a/vendor/netbsd-curses/libcurses/attroff.3 b/vendor/netbsd-curses/libcurses/attroff.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/attroff.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/attron.3 b/vendor/netbsd-curses/libcurses/attron.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/attron.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/attrset.3 b/vendor/netbsd-curses/libcurses/attrset.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/attrset.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/background.c b/vendor/netbsd-curses/libcurses/background.c new file mode 100644 index 0000000..265335d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/background.c @@ -0,0 +1,308 @@ +/* $NetBSD: background.c,v 1.25 2018/11/19 20:37:04 uwe Exp $ */ + +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 700 +#include + +#include +#include "curses.h" +#include "curses_private.h" + +/* + * bkgdset + * Set new background attributes on stdscr. + */ +void +bkgdset(chtype ch) +{ + wbkgdset(stdscr, ch); +} + +/* + * bkgd -- + * Set new background attributes on stdscr and apply them to its + * contents. + */ +int +bkgd(chtype ch) +{ + return(wbkgd(stdscr, ch)); +} + +/* + * wbkgdset + * Set new background attributes on the specified window. + */ +void +wbkgdset(WINDOW *win, chtype ch) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wbkgdset: (%p), '%s', %08x\n", + win, unctrl(ch & __CHARTEXT), ch & __ATTRIBUTES); +#endif + + /* Background character. */ + if (ch & __CHARTEXT) + win->bch = (wchar_t) ch & __CHARTEXT; + + /* Background attributes (check colour). */ + if (__using_color && !(ch & __COLOR)) + ch |= __default_color; + win->battr = (attr_t) ch & __ATTRIBUTES; +} + +/* + * wbkgd -- + * Set new background attributes on the specified window and + * apply them to its contents. + */ +int +wbkgd(WINDOW *win, chtype ch) +{ + chtype obch; + int y, x; + +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wbkgd: (%p), '%s', %08x\n", + win, unctrl(ch & __CHARTEXT), ch & __ATTRIBUTES); +#endif + obch = win->bch; + wbkgdset(win, ch); + + for (y = 0; y < win->maxy; y++) { + for (x = 0; x < win->maxx; x++) { + __LDATA *cp = &win->alines[y]->line[x]; + + /* Update/switch background characters */ + if (cp->ch == obch) + cp->ch = win->bch; + + /* Update/merge attributes */ + cp->attr = win->battr | (cp->attr & __ALTCHARSET); +#ifdef HAVE_WCHAR + SET_WCOL(*cp, 1); +#endif + } + } + __touchwin(win); + return OK; +} + +/* + * getbkgd -- + * Get current background attributes. + */ +chtype +getbkgd(WINDOW *win) +{ + attr_t battr; + + /* Background attributes (check colour). */ + battr = win->battr & A_ATTRIBUTES; + if (__using_color && ((battr & __COLOR) == __default_color)) + battr &= ~__COLOR; + + return ((chtype) ((win->bch & A_CHARTEXT) | battr)); +} + + +#ifdef HAVE_WCHAR + +void +bkgrndset(const cchar_t *wch) +{ + wbkgrndset(stdscr, wch); +} + + +int +bkgrnd(const cchar_t *wch) +{ + return wbkgrnd(stdscr, wch); +} + + +int +getbkgrnd(cchar_t *wch) +{ + return wgetbkgrnd(stdscr, wch); +} + + +void +wbkgrndset(WINDOW *win, const cchar_t *wch) +{ + attr_t battr; + nschar_t *np, *tnp; + int i; + +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wbkgrndset: (%p), '%s', %x\n", + win, (const char *) wunctrl(wch), wch->attributes); +#endif + + /* ignore multi-column characters */ + if (!wch->elements || wcwidth(wch->vals[0]) > 1) + return; + + /* Background character. */ + tnp = np = win->bnsp; + if (wcwidth( wch->vals[0])) + win->bch = wch->vals[0]; + else { + if (!np) { + np = malloc(sizeof(nschar_t)); + if (!np) + return; + np->next = NULL; + win->bnsp = np; + } + np->ch = wch->vals[0]; + tnp = np; + np = np->next; + } + /* add non-spacing characters */ + if (wch->elements > 1) { + for (i = 1; i < wch->elements; i++) { + if ( !np ) { + np = malloc(sizeof(nschar_t)); + if (!np) + return; + np->next = NULL; + if (tnp) + tnp->next = np; + else + win->bnsp = np; + } + np->ch = wch->vals[i]; + tnp = np; + np = np->next; + } + } + /* clear the old non-spacing characters */ + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + + /* Background attributes (check colour). */ + battr = wch->attributes & WA_ATTRIBUTES; + if (__using_color && !( battr & __COLOR)) + battr |= __default_color; + win->battr = battr; + SET_BGWCOL((*win), 1); +} + + +int +wbkgrnd(WINDOW *win, const cchar_t *wch) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wbkgrnd: (%p), '%s', %x\n", + win, (const char *) wunctrl(wch), wch->attributes); +#endif + + /* ignore multi-column characters */ + if (!wch->elements || wcwidth( wch->vals[ 0 ]) > 1) + return ERR; + + wbkgrndset(win, wch); + __touchwin(win); + return OK; +} + + +int +wgetbkgrnd(WINDOW *win, cchar_t *wch) +{ + nschar_t *np; + + /* Background attributes (check colour). */ + wch->attributes = win->battr & WA_ATTRIBUTES; + if (__using_color && ((wch->attributes & __COLOR) == __default_color)) + wch->attributes &= ~__COLOR; + wch->vals[0] = win->bch; + wch->elements = 1; + np = win->bnsp; + if (np) { + while (np && wch->elements < CURSES_CCHAR_MAX) { + wch->vals[wch->elements++] = np->ch; + np = np->next; + } + } + + return OK; +} + +#else /* !HAVE_WCHAR */ + +void +bkgrndset(const cchar_t *wch) +{ + return; +} + +int +bkgrnd(const cchar_t *wch) +{ + return ERR; +} + + +int +getbkgrnd(cchar_t *wch) +{ + return ERR; +} + + +void +wbkgrndset(WINDOW *win, const cchar_t *wch) +{ + return; +} + + +int +wbkgrnd(WINDOW *win, const cchar_t *wch) +{ + return ERR; +} + + +int +wgetbkgrnd(WINDOW *win, cchar_t *wch) +{ + return ERR; +} + +#endif /* !HAVE_WCHAR */ diff --git a/vendor/netbsd-curses/libcurses/beep.3 b/vendor/netbsd-curses/libcurses/beep.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/beep.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/bell.c b/vendor/netbsd-curses/libcurses/bell.c new file mode 100644 index 0000000..405dc3d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/bell.c @@ -0,0 +1,77 @@ +/* $NetBSD: bell.c,v 1.9 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * beep + * Ring the terminal bell + */ +int +beep(void) +{ + if (bell != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "beep: bl\n"); +#endif + tputs(bell, 0, __cputchar); + } else if (flash_screen != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "beep: vb\n"); +#endif + tputs(flash_screen, 0, __cputchar); + } + return OK; +} + +/* + * flash + * Flash the terminal screen + */ +int +flash(void) +{ + if (flash_screen != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "flash: vb\n"); +#endif + tputs(flash_screen, 0, __cputchar); + } else if (bell != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "flash: bl\n"); +#endif + tputs(bell, 0, __cputchar); + } + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/bkgd.3 b/vendor/netbsd-curses/libcurses/bkgd.3 new file mode 120000 index 0000000..b438d24 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/bkgd.3 @@ -0,0 +1 @@ +curses_background.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/bkgdset.3 b/vendor/netbsd-curses/libcurses/bkgdset.3 new file mode 120000 index 0000000..b438d24 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/bkgdset.3 @@ -0,0 +1 @@ +curses_background.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/border.3 b/vendor/netbsd-curses/libcurses/border.3 new file mode 120000 index 0000000..dd41763 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/border.3 @@ -0,0 +1 @@ +curses_border.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/border.c b/vendor/netbsd-curses/libcurses/border.c new file mode 100644 index 0000000..5c233db --- /dev/null +++ b/vendor/netbsd-curses/libcurses/border.c @@ -0,0 +1,613 @@ +/* $NetBSD: border.c,v 1.18 2017/01/09 21:17:29 blymn Exp $ */ + +/* + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 700 +#include + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * border -- + * Draw a border around stdscr using the specified + * delimiting characters. + */ +int +border(chtype left, chtype right, chtype top, chtype bottom, chtype topleft, + chtype topright, chtype botleft, chtype botright) +{ + return wborder(stdscr, left, right, top, bottom, topleft, topright, + botleft, botright); +} + +#endif + +/* + * wborder -- + * Draw a border around the given window using the specified delimiting + * characters. + */ +int +wborder(WINDOW *win, chtype left, chtype right, chtype top, chtype bottom, + chtype topleft, chtype topright, chtype botleft, chtype botright) +{ +#ifndef HAVE_WCHAR + int endy, endx, i; + __LDATA *fp, *lp; + + if (!(left & __CHARTEXT)) + left |= ACS_VLINE; + if (!(right & __CHARTEXT)) + right |= ACS_VLINE; + if (!(top & __CHARTEXT)) + top |= ACS_HLINE; + if (!(bottom & __CHARTEXT)) + bottom |= ACS_HLINE; + if (!(topleft & __CHARTEXT)) + topleft |= ACS_ULCORNER; + if (!(topright & __CHARTEXT)) + topright |= ACS_URCORNER; + if (!(botleft & __CHARTEXT)) + botleft |= ACS_LLCORNER; + if (!(botright & __CHARTEXT)) + botright |= ACS_LRCORNER; + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wborder: left = %c, 0x%x\n", + left & __CHARTEXT, left & __ATTRIBUTES); + __CTRACE(__CTRACE_INPUT, "wborder: right = %c, 0x%x\n", + right & __CHARTEXT, right & __ATTRIBUTES); + __CTRACE(__CTRACE_INPUT, "wborder: top = %c, 0x%x\n", + top & __CHARTEXT, top & __ATTRIBUTES); + __CTRACE(__CTRACE_INPUT, "wborder: bottom = %c, 0x%x\n", + bottom & __CHARTEXT, bottom & __ATTRIBUTES); + __CTRACE(__CTRACE_INPUT, "wborder: topleft = %c, 0x%x\n", + topleft & __CHARTEXT, topleft & __ATTRIBUTES); + __CTRACE(__CTRACE_INPUT, "wborder: topright = %c, 0x%x\n", + topright & __CHARTEXT, topright & __ATTRIBUTES); + __CTRACE(__CTRACE_INPUT, "wborder: botleft = %c, 0x%x\n", + botleft & __CHARTEXT, botleft & __ATTRIBUTES); + __CTRACE(__CTRACE_INPUT, "wborder: botright = %c, 0x%x\n", + botright & __CHARTEXT, botright & __ATTRIBUTES); +#endif + + /* Merge window and background attributes */ + left |= (left & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + left |= (left & __COLOR) ? (win->battr & ~__COLOR) : win->battr; + right |= (right & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + right |= (right & __COLOR) ? (win->battr & ~__COLOR) : win->battr; + top |= (top & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + top |= (top & __COLOR) ? (win->battr & ~__COLOR) : win->battr; + bottom |= (bottom & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + bottom |= (bottom & __COLOR) ? (win->battr & ~__COLOR) : win->battr; + topleft |= (topleft & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + topleft |= (topleft & __COLOR) ? (win->battr & ~__COLOR) : win->battr; + topright |= (topright & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + topright |= (topright & __COLOR) ? (win->battr & ~__COLOR) : win->battr; + botleft |= (botleft & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + botleft |= (botleft & __COLOR) ? (win->battr & ~__COLOR) : win->battr; + botright |= (botright & __COLOR) ? (win->wattr & ~__COLOR) : win->wattr; + botright |= (botright & __COLOR) ? (win->battr & ~__COLOR) : win->battr; + + endx = win->maxx - 1; + endy = win->maxy - 1; + fp = win->alines[0]->line; + lp = win->alines[endy]->line; + + /* Sides */ + for (i = 1; i < endy; i++) { + win->alines[i]->line[0].ch = (wchar_t) left & __CHARTEXT; + win->alines[i]->line[0].attr = (attr_t) left & __ATTRIBUTES; + win->alines[i]->line[endx].ch = (wchar_t) right & __CHARTEXT; + win->alines[i]->line[endx].attr = (attr_t) right & __ATTRIBUTES; + } + for (i = 1; i < endx; i++) { + fp[i].ch = (wchar_t) top & __CHARTEXT; + fp[i].attr = (attr_t) top & __ATTRIBUTES; + lp[i].ch = (wchar_t) bottom & __CHARTEXT; + lp[i].attr = (attr_t) bottom & __ATTRIBUTES; + } + + /* Corners */ + if (!(win->maxy == LINES && win->maxx == COLS && + (win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN))) { + fp[0].ch = (wchar_t) topleft & __CHARTEXT; + fp[0].attr = (attr_t) topleft & __ATTRIBUTES; + fp[endx].ch = (wchar_t) topright & __CHARTEXT; + fp[endx].attr = (attr_t) topright & __ATTRIBUTES; + lp[0].ch = (wchar_t) botleft & __CHARTEXT; + lp[0].attr = (attr_t) botleft & __ATTRIBUTES; + lp[endx].ch = (wchar_t) botright & __CHARTEXT; + lp[endx].attr = (attr_t) botright & __ATTRIBUTES; + } + __touchwin(win); + return OK; +#else /* HAVE_WCHAR */ + cchar_t ls, rs, ts, bs, tl, tr, bl, br; + cchar_t *lsp, *rsp, *tsp, *bsp, *tlp, *trp, *blp, *brp; + +#define S(in, out, def) \ + if (in & __CHARTEXT) { \ + __cursesi_chtype_to_cchar(in, &out); \ + } else { \ + memcpy(&out, def, sizeof(cchar_t)); \ + out.attributes |= in & __ATTRIBUTES; \ + } \ + out##p = &out; + + S(left, ls, WACS_VLINE); + S(right, rs, WACS_VLINE); + S(top, ts, WACS_HLINE); + S(bottom, bs, WACS_HLINE); + S(topleft, tl, WACS_ULCORNER); + S(topright, tr, WACS_URCORNER); + S(botleft, bl, WACS_LLCORNER); + S(botright, br, WACS_LRCORNER); +#undef S + return wborder_set(win, lsp, rsp, tsp, bsp, tlp, trp, blp, brp); +#endif /* HAVE_WCHAR */ +} + +int border_set(const cchar_t *ls, const cchar_t *rs, const cchar_t *ts, + const cchar_t *bs, const cchar_t *tl, const cchar_t *tr, + const cchar_t *bl, const cchar_t *br) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + return wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br); +#endif /* HAVE_WCHAR */ +} + +int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs, + const cchar_t *ts, const cchar_t *bs, + const cchar_t *tl, const cchar_t *tr, + const cchar_t *bl, const cchar_t *br) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + int endy, endx, i, j, k, cw, pcw, tlcw, blcw, trcw, brcw; + cchar_t left, right, bottom, top, topleft, topright, botleft, botright; + nschar_t *np, *tnp; + + if (ls && wcwidth(ls->vals[0])) + memcpy(&left, ls, sizeof(cchar_t)); + else + memcpy(&left, WACS_VLINE, sizeof(cchar_t)); + if (rs && wcwidth( rs->vals[0])) + memcpy(&right, rs, sizeof(cchar_t)); + else + memcpy(&right, WACS_VLINE, sizeof(cchar_t)); + if (ts && wcwidth( ts->vals[0])) + memcpy(&top, ts, sizeof(cchar_t)); + else + memcpy( &top, WACS_HLINE, sizeof(cchar_t)); + if (bs && wcwidth( bs->vals[0])) + memcpy(&bottom, bs, sizeof(cchar_t)); + else + memcpy(&bottom, WACS_HLINE, sizeof(cchar_t)); + if (tl && wcwidth(tl->vals[0])) + memcpy( &topleft, tl, sizeof(cchar_t)); + else + memcpy(&topleft, WACS_ULCORNER, sizeof(cchar_t)); + if (tr && wcwidth( tr->vals[0])) + memcpy(&topright, tr, sizeof(cchar_t)); + else + memcpy(&topright, WACS_URCORNER, sizeof( cchar_t )); + if (bl && wcwidth( bl->vals[0])) + memcpy(&botleft, bl, sizeof(cchar_t)); + else + memcpy(&botleft, WACS_LLCORNER, sizeof(cchar_t)); + if (br && wcwidth( br->vals[0])) + memcpy(&botright, br, sizeof(cchar_t)); + else + memcpy(&botright, WACS_LRCORNER, sizeof(cchar_t)); + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wborder_set: left = %c, 0x%x\n", + left.vals[0], left.attributes ); + __CTRACE(__CTRACE_INPUT, "wborder_set: right = %c, 0x%x\n", + right.vals[0], right.attributes ); + __CTRACE(__CTRACE_INPUT, "wborder_set: top = %c, 0x%x\n", + top.vals[0], top.attributes ); + __CTRACE(__CTRACE_INPUT, "wborder_set: bottom = %c, 0x%x\n", + bottom.vals[0], bottom.attributes ); + __CTRACE(__CTRACE_INPUT, "wborder_set: topleft = %c, 0x%x\n", + topleft.vals[0], topleft.attributes ); + __CTRACE(__CTRACE_INPUT, "wborder_set: topright = %c, 0x%x\n", + topright.vals[0], topright.attributes ); + __CTRACE(__CTRACE_INPUT, "wborder_set: botleft = %c, 0x%x\n", + botleft.vals[0], botleft.attributes ); + __CTRACE(__CTRACE_INPUT, "wborder_set: botright = %c, 0x%x\n", + botright.vals[0], botright.attributes ); +#endif + + /* Merge window attributes */ + left.attributes |= (left.attributes & __COLOR) ? + (win->wattr & ~__COLOR) : win->wattr; + left.attributes |= (left.attributes & __COLOR) ? + (win->battr & ~__COLOR) : win->battr; + right.attributes |= (right.attributes & __COLOR) ? + (win->wattr & ~__COLOR) : win->wattr; + right.attributes |= (right.attributes & __COLOR) ? + (win->battr & ~__COLOR) : win->battr; + top.attributes |= (top.attributes & __COLOR) ? + (win->wattr & ~__COLOR) : win->wattr; + top.attributes |= (top.attributes & __COLOR) ? + (win->battr & ~__COLOR) : win->battr; + bottom.attributes |= (bottom.attributes & __COLOR) ? + (win->wattr & ~__COLOR) : win->wattr; + bottom.attributes |= (bottom.attributes & __COLOR) ? + (win->battr & ~__COLOR) : win->battr; + topleft.attributes |= (topleft.attributes & __COLOR) ? + (win->wattr & ~__COLOR) : win->wattr; + topleft.attributes |= (topleft.attributes & __COLOR) ? + (win->battr & ~__COLOR) : win->battr; + topright.attributes |= (topright.attributes & __COLOR) ? + (win->wattr & ~__COLOR) : win->wattr; + topright.attributes |= (topright.attributes & __COLOR) ? + (win->battr & ~__COLOR) : win->battr; + botleft.attributes |= (botleft.attributes & __COLOR) ? + (win->wattr & ~__COLOR) : win->wattr; + botleft.attributes |= (botleft.attributes & __COLOR) ? + (win->battr & ~__COLOR) : win->battr; + botright.attributes |= (botright.attributes & __COLOR) ? + (win->wattr & ~__COLOR) : win->wattr; + botright.attributes |= (botright.attributes & __COLOR) ? + (win->battr & ~__COLOR) : win->battr; + + endx = win->maxx - 1; + endy = win->maxy - 1; + + /* Sides */ + for (i = 1; i < endy; i++) { + /* left border */ + cw = wcwidth(left.vals[0]); + if (cw < 0) + cw = 1; + for ( j = 0; j < cw; j++ ) { + win->alines[i]->line[j].ch = left.vals[0]; + win->alines[i]->line[j].attr = left.attributes; + np = win->alines[i]->line[j].nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + win->alines[i]->line[j].nsp = NULL; + } + if (j) + SET_WCOL(win->alines[i]->line[j], -j); + else { + SET_WCOL(win->alines[i]->line[j], cw); + if (left.elements > 1) { + for (k = 1; k < left.elements; k++) { + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = left.vals[ k ]; + np->next = win->alines[i]->line[j].nsp; + win->alines[i]->line[j].nsp + = np; + } + } + } + } + for (j = cw; WCOL(win->alines[i]->line[j]) < 0; j++) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "wborder_set: clean out partial char[%d]", j); +#endif /* DEBUG */ + win->alines[i]->line[j].ch = ( wchar_t )btowc(win->bch); + if (_cursesi_copy_nsp(win->bnsp, + &win->alines[i]->line[j]) == ERR) + return ERR; + SET_WCOL(win->alines[i]->line[j], 1); + } + /* right border */ + cw = wcwidth(right.vals[0]); + if (cw < 0) + cw = 1; + pcw = WCOL( win->alines[i]->line[endx - cw]); + for ( j = endx - cw + 1; j <= endx; j++ ) { + win->alines[i]->line[j].ch = right.vals[0]; + win->alines[i]->line[j].attr = right.attributes; + np = win->alines[i]->line[j].nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + win->alines[i]->line[j].nsp = NULL; + } + if (j == endx - cw + 1) { + SET_WCOL(win->alines[i]->line[j], cw); + if (right.elements > 1) { + for (k = 1; k < right.elements; k++) { + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = right.vals[ k ]; + np->next = win->alines[i]->line[j].nsp; + win->alines[i]->line[j].nsp + = np; + } + } + } else + SET_WCOL(win->alines[i]->line[j], + endx - cw + 1 - j); + } + if (pcw != 1) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "wborder_set: clean out partial chars[%d:%d]", + endx - cw + pcw, endx - cw ); +#endif /* DEBUG */ + k = pcw < 0 ? endx -cw + pcw : endx - cw; + for (j = endx - cw; j >= k; j--) { + win->alines[i]->line[j].ch + = (wchar_t)btowc(win->bch); + if (_cursesi_copy_nsp(win->bnsp, + &win->alines[i]->line[j]) == ERR) + return ERR; + win->alines[i]->line[j].attr = win->battr; + SET_WCOL(win->alines[i]->line[j], 1); + } + } + } + tlcw = wcwidth(topleft.vals[0]); + if (tlcw < 0) + tlcw = 1; + blcw = wcwidth(botleft.vals[0]); + if (blcw < 0) + blcw = 1; + trcw = wcwidth(topright.vals[0]); + if (trcw < 0) + trcw = 1; + brcw = wcwidth(botright.vals[0]); + if (brcw < 0) + brcw = 1; + /* upper border */ + cw = wcwidth(top.vals[0]); + if (cw < 0) + cw = 1; + for (i = tlcw; i <= min( endx - cw, endx - trcw); i += cw) { + for (j = 0; j < cw; j++) { + win->alines[0]->line[i + j].ch = top.vals[0]; + win->alines[0]->line[i + j].attr = top.attributes; + np = win->alines[0]->line[i + j].nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + win->alines[0]->line[i + j].nsp = NULL; + } + if (j) + SET_WCOL(win->alines[ 0 ]->line[ i + j ], -j); + else { + SET_WCOL(win->alines[ 0 ]->line[ i + j ], cw); + if ( top.elements > 1 ) { + for (k = 1; k < top.elements; k++) { + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = top.vals[k]; + np->next = win->alines[0]->line[i + j].nsp; + win->alines[0]->line[i + j].nsp + = np; + } + } + } + } + } + while (i <= endx - trcw) { + win->alines[0]->line[i].ch = + (wchar_t)btowc((int) win->bch); + if (_cursesi_copy_nsp(win->bnsp, + &win->alines[0]->line[i]) == ERR) + return ERR; + win->alines[0]->line[i].attr = win->battr; + SET_WCOL(win->alines[0]->line[i], 1); + i++; + } + /* lower border */ + for (i = blcw; i <= min( endx - cw, endx - brcw); i += cw) { + for (j = 0; j < cw; j++) { + win->alines[endy]->line[i + j].ch = bottom.vals[0]; + win->alines[endy]->line[i + j].attr = bottom.attributes; + np = win->alines[endy]->line[i + j].nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + win->alines[endy]->line[i + j].nsp = NULL; + } + if (j) + SET_WCOL(win->alines[endy]->line[i + j], -j); + else { + SET_WCOL(win->alines[endy]->line[i + j], cw); + if (bottom.elements > 1) { + for (k = 1; k < bottom.elements; k++) { + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = bottom.vals[ k ]; + np->next = win->alines[endy]->line[i + j].nsp; + win->alines[endy]->line[i + j].nsp = np; + } + } + } + } + } + while (i <= endx - brcw) { + win->alines[endy]->line[i].ch = (wchar_t)btowc((int) win->bch ); + if (_cursesi_copy_nsp(win->bnsp, + &win->alines[endy]->line[i]) == ERR) + return ERR; + win->alines[endy]->line[i].attr = win->battr; + SET_WCOL(win->alines[endy]->line[ i ], 1); + i++; + } + + /* Corners */ + if (!(win->maxy == LINES && win->maxx == COLS && + (win->flags & __SCROLLOK) && (win->flags & __SCROLLWIN))) { + for (i = 0; i < tlcw; i++) { + win->alines[0]->line[i].ch = topleft.vals[0]; + win->alines[0]->line[i].attr = topleft.attributes; + np = win->alines[0]->line[i].nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + win->alines[0]->line[i].nsp = NULL; + } + if (i) + SET_WCOL(win->alines[0]->line[i], -i); + else { + SET_WCOL(win->alines[0]->line[i], tlcw); + if (topleft.elements > 1) { + for (k = 1; k < topleft.elements; k++) + { + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = topleft.vals[k]; + np->next = win->alines[0]->line[i].nsp; + win->alines[0]->line[i].nsp = np; + } + } + } + } + for (i = endx - trcw + 1; i <= endx; i++) { + win->alines[0]->line[i].ch = topright.vals[0]; + win->alines[0]->line[i].attr = topright.attributes; + np = win->alines[0]->line[i].nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + win->alines[0]->line[i].nsp = NULL; + } + if (i == endx - trcw + 1) { + SET_WCOL(win->alines[0]->line[i], trcw); + if (topright.elements > 1) { + for (k = 1; k < topright.elements;k ++) + { + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = topright.vals[k]; + np->next = win->alines[0]->line[i].nsp; + win->alines[ 0 ]->line[i].nsp = np; + } + } + } else + SET_WCOL(win->alines[0]->line[i], + endx - trcw + 1 - i); + } + for (i = 0; i < blcw; i++) { + win->alines[endy]->line[i].ch = botleft.vals[0]; + win->alines[endy]->line[i].attr = botleft.attributes; + np = win->alines[ endy ]->line[i].nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + win->alines[endy]->line[i].nsp = NULL; + } + if (i) + SET_WCOL(win->alines[endy]->line[i], -i); + else { + SET_WCOL(win->alines[endy]->line[i], blcw); + if (botleft.elements > 1) { + for (k = 1; k < botleft.elements; k++) { + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = botleft.vals[ k ]; + np->next = win->alines[endy]->line[i].nsp; + win->alines[endy]->line[i].nsp = np; + } + } + } + } + for (i = endx - brcw + 1; i <= endx; i++) { + win->alines[endy]->line[i].ch = botright.vals[0]; + win->alines[endy]->line[i].attr = botright.attributes; + np = win->alines[endy]->line[i].nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + win->alines[endy]->line[i].nsp = NULL; + } + if (i == endx - brcw + 1) { + SET_WCOL(win->alines[endy]->line[i], brcw); + if (botright.elements > 1) { + for (k = 1; k < botright.elements; k++){ + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = botright.vals[k]; + np->next = win->alines[endy]->line[i].nsp; + win->alines[endy]->line[i].nsp = np; + } + } + } else + SET_WCOL(win->alines[endy]->line[i], + endx - brcw + 1 - i); + } + } + __touchwin(win); + return OK; +#endif /* HAVE_WCHAR */ +} diff --git a/vendor/netbsd-curses/libcurses/box.3 b/vendor/netbsd-curses/libcurses/box.3 new file mode 120000 index 0000000..dd41763 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/box.3 @@ -0,0 +1 @@ +curses_border.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/box.c b/vendor/netbsd-curses/libcurses/box.c new file mode 100644 index 0000000..d9f778d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/box.c @@ -0,0 +1,56 @@ +/* $NetBSD: box.c,v 1.15 2017/01/06 13:53:18 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" + +/* + * box -- + * Draw a box around the given window with "vert" as the vertical + * delimiting char, and "hor", as the horizontal one. Uses wborder(). + */ +int +box(WINDOW *win, chtype vert, chtype hor) +{ + return (wborder(win, vert, vert, hor, hor, 0, 0, 0, 0)); +} + +int +box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + return wborder_set(win, verch, verch, horch, horch, + NULL, NULL, NULL, NULL); +#endif /* HAVE_WCHAR */ +} diff --git a/vendor/netbsd-curses/libcurses/can_change_color.3 b/vendor/netbsd-curses/libcurses/can_change_color.3 new file mode 120000 index 0000000..1f101c9 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/can_change_color.3 @@ -0,0 +1 @@ +curses_color.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/cbreak.3 b/vendor/netbsd-curses/libcurses/cbreak.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/cbreak.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/cchar.c b/vendor/netbsd-curses/libcurses/cchar.c new file mode 100644 index 0000000..f5769db --- /dev/null +++ b/vendor/netbsd-curses/libcurses/cchar.c @@ -0,0 +1,137 @@ +/* $NetBSD: cchar.c,v 1.12 2020/07/02 23:43:01 uwe Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 700 +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * getcchar -- + * get a wide-character string and rendition from a cchar_t + */ +int +getcchar(const cchar_t *wcval, wchar_t *wch, attr_t *attrs, + short *color_pair, void *opts) +{ + wchar_t *wp; + size_t len; + + if (__predict_false(opts != NULL)) + return ERR; + + wp = wmemchr(wcval->vals, L'\0', CCHARW_MAX); + len = wp ? wp - wcval->vals : CCHARW_MAX; + + if (wch == NULL) + return (int)len; + + if (attrs == NULL || color_pair == NULL) + return ERR; + + if (len > 0) { + *attrs = wcval->attributes; + if (__using_color) + *color_pair = PAIR_NUMBER(wcval->attributes); + else + *color_pair = 0; + wmemcpy(wch, wcval->vals, len); + wch[len] = L'\0'; + } + return OK; +} + +/* + * setcchar -- + * set cchar_t from a wide-character string and rendition + */ +int +setcchar(cchar_t *wcval, const wchar_t *wch, const attr_t attrs, + short color_pair, const void *opts) +{ + int i; + size_t len; + + if (__predict_false(opts != NULL)) + return ERR; + + len = wcslen(wch); + if (len > CCHARW_MAX || (len > 1 && wcwidth(wch[0]) < 0)) + return ERR; + + /* + * If we have a following spacing-character, stop at that point. We + * are only interested in adding non-spacing characters. + */ + for (i = 1; i < len; ++i) { + if (wcwidth(wch[i]) != 0) { + len = i; + break; + } + } + + memset(wcval, 0, sizeof(*wcval)); + if (len != 0) { + wcval->attributes = attrs & ~__COLOR; + if (__using_color && color_pair) + wcval->attributes |= COLOR_PAIR(color_pair); + wcval->elements = len; + memcpy(&wcval->vals, wch, len * sizeof(wchar_t)); + } + + return OK; +} + +void +__cursesi_chtype_to_cchar(chtype in, cchar_t *out) +{ + unsigned int idx; + + if (in & __ACS_IS_WACS) { + idx = in & __CHARTEXT; + if (idx < NUM_ACS) { + memcpy(out, &_wacs_char[idx], sizeof(cchar_t)); + out->attributes |= in & __ATTRIBUTES; + return; + } + } + out->vals[0] = in & __CHARTEXT; + out->attributes = in & __ATTRIBUTES; + out->elements = 1; +} diff --git a/vendor/netbsd-curses/libcurses/chgat.3 b/vendor/netbsd-curses/libcurses/chgat.3 new file mode 120000 index 0000000..dc7fec3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/chgat.3 @@ -0,0 +1 @@ +curses_chgat.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/chgat.c b/vendor/netbsd-curses/libcurses/chgat.c new file mode 100644 index 0000000..878988a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/chgat.c @@ -0,0 +1,97 @@ +/* $NetBSD: chgat.c,v 1.5 2012/09/28 06:05:19 blymn Exp $ */ + +/* + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +int +chgat(int n, attr_t attr, short color, const void *opts) +{ + return wchgat(stdscr, n, attr, color, opts); +} + +int +mvchgat(int y, int x, int n, attr_t attr, short color, + const void *opts) +{ + return mvwchgat(stdscr, y, x, n, attr, color, opts); +} + +int +wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts) +{ + return mvwchgat(win, win->cury, win->curx, n, attr, color, opts); +} + +int +mvwchgat(WINDOW *win , int y, int x, int count, attr_t attr, short color, + const void *opts) +{ + __LINE *lp; + __LDATA *lc; + + if (x < 0 || y < 0) + return (ERR); + if (x >= win->maxx || y >= win->maxy) + return (ERR); + + attr = (attr & ~__COLOR) | COLOR_PAIR(color); + + if (count < 0 || count > win->maxx - x) + count = win->maxx - x; + +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "mvwchgat: x: %d y: %d count: %d attr: 0x%x " + "color pair %d\n", x, y, count, (attr & ~__COLOR), + PAIR_NUMBER(color)); +#endif + lp = win->alines[y]; + lc = &lp->line[x]; + + if (x + win->ch_off < *lp->firstchp) + *lp->firstchp = x + win->ch_off; + if (x + win->ch_off + count > *lp->lastchp) + *lp->lastchp = x + win->ch_off + count; + + while (count-- > 0) { + lp->flags |= __ISDIRTY; +#ifdef HAVE_WCHAR + lc->attr = (lc->attr & ~WA_ATTRIBUTES) | attr; +#else + lc->attr = attr; +#endif + ++lc; + } + + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/clear.3 b/vendor/netbsd-curses/libcurses/clear.3 new file mode 120000 index 0000000..a92e1eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/clear.3 @@ -0,0 +1 @@ +curses_clear.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/clear.c b/vendor/netbsd-curses/libcurses/clear.c new file mode 100644 index 0000000..f37eb54 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/clear.c @@ -0,0 +1,63 @@ +/* $NetBSD: clear.c,v 1.13 2003/08/07 16:44:19 agc Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * clear -- + * Clear stdscr + */ +int +clear(void) +{ + return wclear(_cursesi_screen->stdscr); +} + +#endif + +/* + * wclear -- + * Clear the window. + */ +int +wclear(WINDOW *win) +{ + if (werase(win) == OK) { + win->flags |= __CLEAROK; + return (OK); + } + return (ERR); +} diff --git a/vendor/netbsd-curses/libcurses/clearok.3 b/vendor/netbsd-curses/libcurses/clearok.3 new file mode 120000 index 0000000..a92e1eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/clearok.3 @@ -0,0 +1 @@ +curses_clear.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/clearok.c b/vendor/netbsd-curses/libcurses/clearok.c new file mode 100644 index 0000000..23e89c9 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/clearok.c @@ -0,0 +1,49 @@ +/* $NetBSD: clearok.c,v 1.5 2008/04/28 20:23:01 martin Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * clearok -- + * Turn on and off clear before refresh for the given window. + */ +int +clearok(WINDOW *win, bool bf) +{ + if (bf) + win->flags |= __CLEAROK; + else + win->flags &= ~__CLEAROK; + return (OK); +} diff --git a/vendor/netbsd-curses/libcurses/clrtobot.3 b/vendor/netbsd-curses/libcurses/clrtobot.3 new file mode 120000 index 0000000..a92e1eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/clrtobot.3 @@ -0,0 +1 @@ +curses_clear.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/clrtobot.c b/vendor/netbsd-curses/libcurses/clrtobot.c new file mode 100644 index 0000000..139e2d6 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/clrtobot.c @@ -0,0 +1,113 @@ +/* $NetBSD: clrtobot.c,v 1.27 2020/03/15 01:18:43 uwe Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * clrtobot -- + * Erase everything on stdscr. + */ +int +clrtobot(void) +{ + return wclrtobot(stdscr); +} + +#endif + +/* + * wclrtobot -- + * Erase everything on the window. + */ +int +wclrtobot(WINDOW *win) +{ + int minx, startx, starty, y; + __LDATA *sp, *end, *maxx; + wchar_t bch; + attr_t battr; + +#ifdef HAVE_WCHAR + bch = (wchar_t)btowc((int)win->bch); +#else + bch = win->bch; +#endif + if (win != curscr) + battr = win->battr & __ATTRIBUTES; + else + battr = 0; + +#ifdef __GNUC__ + maxx = NULL; /* XXX gcc -Wuninitialized */ +#endif + if (win->alines[win->cury]->flags & __ISPASTEOL) { + starty = win->cury + 1; + startx = 0; + } else { + starty = win->cury; + startx = win->curx; + } + + for (y = starty; y < win->maxy; y++) { + minx = -1; + end = &win->alines[y]->line[win->maxx]; + for (sp = &win->alines[y]->line[startx]; sp < end; sp++) { + if (!(__NEED_ERASE(sp, bch, battr))) + continue; + + maxx = sp; + if (minx == -1) + minx = (int)(sp - win->alines[y]->line); + + sp->ch = bch; + sp->attr = battr | (sp->attr & __ALTCHARSET); +#ifdef HAVE_WCHAR + if (_cursesi_copy_nsp(win->bnsp, sp) == ERR) + return ERR; + SET_WCOL(*sp, 1); +#endif + } + + if (minx != -1) + __touchline(win, y, minx, + (int)(maxx - win->alines[y]->line)); + startx = 0; + } + + __sync(win); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/clrtoeol.3 b/vendor/netbsd-curses/libcurses/clrtoeol.3 new file mode 120000 index 0000000..a92e1eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/clrtoeol.3 @@ -0,0 +1 @@ +curses_clear.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/clrtoeol.c b/vendor/netbsd-curses/libcurses/clrtoeol.c new file mode 100644 index 0000000..ab16721 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/clrtoeol.c @@ -0,0 +1,117 @@ +/* $NetBSD: clrtoeol.c,v 1.31 2020/03/15 01:18:43 uwe Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * clrtoeol -- + * Clear up to the end of line. + */ +int +clrtoeol(void) +{ + return wclrtoeol(stdscr); +} + +#endif + +/* + * wclrtoeol -- + * Clear up to the end of line. + */ +int +wclrtoeol(WINDOW *win) +{ + int minx, x, y; + __LDATA *end, *maxx, *sp; + wchar_t bch; + attr_t battr; + +#ifdef HAVE_WCHAR + bch = (wchar_t)btowc((int)win->bch); +#else + bch = win->bch; +#endif + if (win != curscr) + battr = win->battr & __ATTRIBUTES; + else + battr = 0; + + y = win->cury; + x = win->curx; + if (win->alines[y]->flags & __ISPASTEOL) { + if (y < win->maxy - 1) { + win->alines[y]->flags &= ~__ISPASTEOL; + y++; + x = 0; + win->cury = y; + win->curx = x; + } else + return OK; + } + end = &win->alines[y]->line[win->maxx]; + minx = -1; + maxx = &win->alines[y]->line[x]; + + for (sp = maxx; sp < end; sp++) { + if (!(__NEED_ERASE(sp, bch, battr))) + continue; + + maxx = sp; + if (minx == -1) + minx = (int)(sp - win->alines[y]->line); + + sp->ch = bch; + sp->attr = battr | (sp->attr & __ALTCHARSET); +#ifdef HAVE_WCHAR + if (_cursesi_copy_nsp(win->bnsp, sp) == ERR) + return ERR; + SET_WCOL(*sp, 1); +#endif + } + +#ifdef DEBUG + __CTRACE(__CTRACE_ERASE, "CLRTOEOL: y = %d, minx = %d, maxx = %d, " + "firstch = %d, lastch = %d\n", + y, minx, (int)(maxx - win->alines[y]->line), + *win->alines[y]->firstchp, *win->alines[y]->lastchp); +#endif + /* Update firstch and lastch for the line. */ + __touchline(win, y, x, (int)win->maxx - 1); + __sync(win); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/color.c b/vendor/netbsd-curses/libcurses/color.c new file mode 100644 index 0000000..69dd00f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/color.c @@ -0,0 +1,701 @@ +/* $NetBSD: color.c,v 1.41 2017/01/06 13:53:18 roy Exp $ */ + +/* + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +/* Have we initialised colours? */ +int __using_color = 0; + +/* Default colour number */ +attr_t __default_color = 0; + +/* Default colour pair values - white on black. */ +struct __pair __default_pair = {COLOR_WHITE, COLOR_BLACK, 0}; + +/* Default colour values */ +/* Flags for colours and pairs */ +#define __USED 0x01 + +static void +__change_pair(short); + +static int +init_color_value(short, short, short, short); + +/* + * has_colors -- + * Check if terminal has colours. + */ +bool +has_colors(void) +{ + if (max_colors > 0 && max_pairs > 0 && + ((set_a_foreground != NULL && set_a_background != NULL) || + initialize_pair != NULL || initialize_color != NULL || + (set_background != NULL && set_foreground != NULL))) + return true; + else + return false; +} + +/* + * can_change_color -- + * Check if terminal can change colours. + */ +bool +can_change_color(void) +{ + return can_change ? true : false; +} + +/* + * start_color -- + * Initialise colour support. + */ +int +start_color(void) +{ + int i; + attr_t temp_nc; + struct __winlist *wlp; + WINDOW *win; + int y, x; + + if (has_colors() == FALSE) + return ERR; + + /* Max colours and colour pairs */ + if (max_colors == -1) + COLORS = 0; + else { + COLORS = max_colors > MAX_COLORS ? MAX_COLORS : max_colors; + if (max_pairs == -1) { + COLOR_PAIRS = 0; + COLORS = 0; + } else { + COLOR_PAIRS = (max_pairs > MAX_PAIRS - 1 ? + MAX_PAIRS - 1 : max_pairs); + /* Use the last colour pair for curses default. */ + __default_color = COLOR_PAIR(MAX_PAIRS - 1); + } + } + if (!COLORS) + return ERR; + + _cursesi_screen->COLORS = COLORS; + _cursesi_screen->COLOR_PAIRS = COLOR_PAIRS; + + /* Reset terminal colour and colour pairs. */ + if (orig_colors != NULL) + tputs(orig_colors, 0, __cputchar); + if (orig_pair != NULL) { + tputs(orig_pair, 0, __cputchar); + curscr->wattr &= _cursesi_screen->mask_op; + } + + /* Type of colour manipulation - ANSI/TEK/HP/other */ + if (set_a_foreground != NULL && set_a_background != NULL) + _cursesi_screen->color_type = COLOR_ANSI; + else if (initialize_pair != NULL) + _cursesi_screen->color_type = COLOR_HP; + else if (initialize_color != NULL) + _cursesi_screen->color_type = COLOR_TEK; + else if (set_foreground != NULL && set_background != NULL) + _cursesi_screen->color_type = COLOR_OTHER; + else + return(ERR); /* Unsupported colour method */ + +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, "start_color: COLORS = %d, COLOR_PAIRS = %d", + COLORS, COLOR_PAIRS); + switch (_cursesi_screen->color_type) { + case COLOR_ANSI: + __CTRACE(__CTRACE_COLOR, " (ANSI style)\n"); + break; + case COLOR_HP: + __CTRACE(__CTRACE_COLOR, " (HP style)\n"); + break; + case COLOR_TEK: + __CTRACE(__CTRACE_COLOR, " (Tektronics style)\n"); + break; + case COLOR_OTHER: + __CTRACE(__CTRACE_COLOR, " (Other style)\n"); + break; + } +#endif + + /* + * Attributes that cannot be used with color. + * Store these in an attr_t for wattrset()/wattron(). + */ + _cursesi_screen->nca = __NORMAL; + if (no_color_video != -1) { + temp_nc = (attr_t)t_no_color_video(_cursesi_screen->term); + if (temp_nc & 0x0001) + _cursesi_screen->nca |= __STANDOUT; + if (temp_nc & 0x0002) + _cursesi_screen->nca |= __UNDERSCORE; + if (temp_nc & 0x0004) + _cursesi_screen->nca |= __REVERSE; + if (temp_nc & 0x0008) + _cursesi_screen->nca |= __BLINK; + if (temp_nc & 0x0010) + _cursesi_screen->nca |= __DIM; + if (temp_nc & 0x0020) + _cursesi_screen->nca |= __BOLD; + if (temp_nc & 0x0040) + _cursesi_screen->nca |= __BLANK; + if (temp_nc & 0x0080) + _cursesi_screen->nca |= __PROTECT; + if (temp_nc & 0x0100) + _cursesi_screen->nca |= __ALTCHARSET; + } +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, "start_color: _cursesi_screen->nca = %08x\n", + _cursesi_screen->nca); +#endif + + /* Set up initial 8 colours */ +#define RGB_ON 680 /* Allow for bright colours */ + if (COLORS >= COLOR_BLACK) + (void)init_color_value(COLOR_BLACK, 0, 0, 0); + if (COLORS >= COLOR_RED) + (void)init_color_value(COLOR_RED, RGB_ON, 0, 0); + if (COLORS >= COLOR_GREEN) + (void)init_color_value(COLOR_GREEN, 0, RGB_ON, 0); + if (COLORS >= COLOR_YELLOW) + (void)init_color_value(COLOR_YELLOW, RGB_ON, RGB_ON, 0); + if (COLORS >= COLOR_BLUE) + (void)init_color_value(COLOR_BLUE, 0, 0, RGB_ON); + if (COLORS >= COLOR_MAGENTA) + (void)init_color_value(COLOR_MAGENTA, RGB_ON, 0, RGB_ON); + if (COLORS >= COLOR_CYAN) + (void)init_color_value(COLOR_CYAN, 0, RGB_ON, RGB_ON); + if (COLORS >= COLOR_WHITE) + (void)init_color_value(COLOR_WHITE, RGB_ON, RGB_ON, RGB_ON); + + /* Initialise other colours */ + for (i = 8; i < COLORS; i++) { + _cursesi_screen->colours[i].red = 0; + _cursesi_screen->colours[i].green = 0; + _cursesi_screen->colours[i].blue = 0; + _cursesi_screen->colours[i].flags = 0; + } + + /* Initialise pair 0 to default colours. */ + _cursesi_screen->colour_pairs[0].fore = -1; + _cursesi_screen->colour_pairs[0].back = -1; + _cursesi_screen->colour_pairs[0].flags = 0; + + /* Initialise user colour pairs to default (white on black) */ + for (i = 0; i < COLOR_PAIRS; i++) { + _cursesi_screen->colour_pairs[i].fore = COLOR_WHITE; + _cursesi_screen->colour_pairs[i].back = COLOR_BLACK; + _cursesi_screen->colour_pairs[i].flags = 0; + } + + /* Initialise default colour pair. */ + _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].fore = + __default_pair.fore; + _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].back = + __default_pair.back; + _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].flags = + __default_pair.flags; + + __using_color = 1; + + /* Set all positions on all windows to curses default colours. */ + for (wlp = _cursesi_screen->winlistp; wlp != NULL; wlp = wlp->nextp) { + win = wlp->winp; + if (wlp->winp != __virtscr && wlp->winp != curscr) { + /* Set color attribute on other windows */ + win->battr |= __default_color; + for (y = 0; y < win->maxy; y++) { + for (x = 0; x < win->maxx; x++) { + win->alines[y]->line[x].attr &= ~__COLOR; + win->alines[y]->line[x].attr |= __default_color; + } + } + __touchwin(win); + } + } + + return(OK); +} + +/* + * init_pair -- + * Set pair foreground and background colors. + * Our default colour ordering is ANSI - 1 = red, 4 = blue, 3 = yellow, + * 6 = cyan. The older style (Sb/Sf) uses 1 = blue, 4 = red, 3 = cyan, + * 6 = yellow, so we swap them here and in pair_content(). + */ +int +init_pair(short pair, short fore, short back) +{ + int changed; + +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, "init_pair: %d, %d, %d\n", pair, fore, back); +#endif + + if (pair < 0 || pair >= COLOR_PAIRS) + return ERR; + + if (pair == 0) /* Ignore request for pair 0, it is default. */ + return OK; + + if (fore >= COLORS) + return ERR; + if (back >= COLORS) + return ERR; + + /* Swap red/blue and yellow/cyan */ + if (_cursesi_screen->color_type == COLOR_OTHER) { + switch (fore) { + case COLOR_RED: + fore = COLOR_BLUE; + break; + case COLOR_BLUE: + fore = COLOR_RED; + break; + case COLOR_YELLOW: + fore = COLOR_CYAN; + break; + case COLOR_CYAN: + fore = COLOR_YELLOW; + break; + } + switch (back) { + case COLOR_RED: + back = COLOR_BLUE; + break; + case COLOR_BLUE: + back = COLOR_RED; + break; + case COLOR_YELLOW: + back = COLOR_CYAN; + break; + case COLOR_CYAN: + back = COLOR_YELLOW; + break; + } + } + + if ((_cursesi_screen->colour_pairs[pair].flags & __USED) && + (fore != _cursesi_screen->colour_pairs[pair].fore || + back != _cursesi_screen->colour_pairs[pair].back)) + changed = 1; + else + changed = 0; + + _cursesi_screen->colour_pairs[pair].flags |= __USED; + _cursesi_screen->colour_pairs[pair].fore = fore; + _cursesi_screen->colour_pairs[pair].back = back; + + /* XXX: need to initialise HP style (Ip) */ + + if (changed) + __change_pair(pair); + return OK; +} + +/* + * pair_content -- + * Get pair foreground and background colours. + */ +int +pair_content(short pair, short *forep, short *backp) +{ + if (pair < 0 || pair > _cursesi_screen->COLOR_PAIRS) + return ERR; + + *forep = _cursesi_screen->colour_pairs[pair].fore; + *backp = _cursesi_screen->colour_pairs[pair].back; + + /* Swap red/blue and yellow/cyan */ + if (_cursesi_screen->color_type == COLOR_OTHER) { + switch (*forep) { + case COLOR_RED: + *forep = COLOR_BLUE; + break; + case COLOR_BLUE: + *forep = COLOR_RED; + break; + case COLOR_YELLOW: + *forep = COLOR_CYAN; + break; + case COLOR_CYAN: + *forep = COLOR_YELLOW; + break; + } + switch (*backp) { + case COLOR_RED: + *backp = COLOR_BLUE; + break; + case COLOR_BLUE: + *backp = COLOR_RED; + break; + case COLOR_YELLOW: + *backp = COLOR_CYAN; + break; + case COLOR_CYAN: + *backp = COLOR_YELLOW; + break; + } + } + return OK; +} + +/* + * init_color_Value -- + * Set colour red, green and blue values. + */ +static int +init_color_value(short color, short red, short green, short blue) +{ + if (color < 0 || color >= _cursesi_screen->COLORS) + return ERR; + + _cursesi_screen->colours[color].red = red; + _cursesi_screen->colours[color].green = green; + _cursesi_screen->colours[color].blue = blue; + return OK; +} + +/* + * init_color -- + * Set colour red, green and blue values. + * Change color on screen. + */ +int +init_color(short color, short red, short green, short blue) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, "init_color: %d, %d, %d, %d\n", + color, red, green, blue); +#endif + if (init_color_value(color, red, green, blue) == ERR) + return ERR; + if (!can_change || t_initialize_color(_cursesi_screen->term) == NULL) + return ERR; + tputs(tiparm(t_initialize_color(_cursesi_screen->term), + color, red, green, blue), 0, __cputchar); + return OK; +} + +/* + * color_content -- + * Get colour red, green and blue values. + */ +int +color_content(short color, short *redp, short *greenp, short *bluep) +{ + if (color < 0 || color >= _cursesi_screen->COLORS) + return ERR; + + *redp = _cursesi_screen->colours[color].red; + *greenp = _cursesi_screen->colours[color].green; + *bluep = _cursesi_screen->colours[color].blue; + return OK; +} + +/* + * use_default_colors -- + * Use terminal default colours instead of curses default colour. + */ +int +use_default_colors() +{ +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, "use_default_colors\n"); +#endif + + return (assume_default_colors(-1, -1)); +} + +/* + * assume_default_colors -- + * Set the default foreground and background colours. + */ +int +assume_default_colors(short fore, short back) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, "assume_default_colors: %d, %d\n", + fore, back); + __CTRACE(__CTRACE_COLOR, "assume_default_colors: default_colour = %d, pair_number = %d\n", __default_color, PAIR_NUMBER(__default_color)); +#endif + + /* Swap red/blue and yellow/cyan */ + if (_cursesi_screen->color_type == COLOR_OTHER) { + switch (fore) { + case COLOR_RED: + fore = COLOR_BLUE; + break; + case COLOR_BLUE: + fore = COLOR_RED; + break; + case COLOR_YELLOW: + fore = COLOR_CYAN; + break; + case COLOR_CYAN: + fore = COLOR_YELLOW; + break; + } + switch (back) { + case COLOR_RED: + back = COLOR_BLUE; + break; + case COLOR_BLUE: + back = COLOR_RED; + break; + case COLOR_YELLOW: + back = COLOR_CYAN; + break; + case COLOR_CYAN: + back = COLOR_YELLOW; + break; + } + } + __default_pair.fore = fore; + __default_pair.back = back; + __default_pair.flags = __USED; + + if (COLOR_PAIRS) { + _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].fore = fore; + _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].back = back; + _cursesi_screen->colour_pairs[PAIR_NUMBER(__default_color)].flags = __USED; + } + + /* + * If we've already called start_color(), make sure all instances + * of the curses default colour pair are dirty. + */ + if (__using_color) + __change_pair(PAIR_NUMBER(__default_color)); + + return(OK); +} + +/* no_color_video is a terminfo macro, but we need to retain binary compat */ +#ifdef __strong_alias +#undef no_color_video +__strong_alias(no_color_video, no_color_attributes) +#endif +/* + * no_color_attributes -- + * Return attributes that cannot be combined with color. + */ +attr_t +no_color_attributes(void) +{ + return(_cursesi_screen->nca); +} + +/* + * __set_color -- + * Set terminal foreground and background colours. + */ +void +__set_color( /*ARGSUSED*/ WINDOW *win, attr_t attr) +{ + short pair; + + if ((curscr->wattr & __COLOR) == (attr & __COLOR)) + return; + + pair = PAIR_NUMBER((uint32_t)attr); +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, "__set_color: %d, %d, %d\n", pair, + _cursesi_screen->colour_pairs[pair].fore, + _cursesi_screen->colour_pairs[pair].back); +#endif + switch (_cursesi_screen->color_type) { + /* Set ANSI forground and background colours */ + case COLOR_ANSI: + if (_cursesi_screen->colour_pairs[pair].fore < 0 || + _cursesi_screen->colour_pairs[pair].back < 0) + __unset_color(curscr); + if (_cursesi_screen->colour_pairs[pair].fore >= 0) + tputs(tiparm(t_set_a_foreground(_cursesi_screen->term), + (int)_cursesi_screen->colour_pairs[pair].fore), + 0, __cputchar); + if (_cursesi_screen->colour_pairs[pair].back >= 0) + tputs(tiparm(t_set_a_background(_cursesi_screen->term), + (int)_cursesi_screen->colour_pairs[pair].back), + 0, __cputchar); + break; + case COLOR_HP: + /* XXX: need to support HP style */ + break; + case COLOR_TEK: + /* XXX: need to support Tek style */ + break; + case COLOR_OTHER: + if (_cursesi_screen->colour_pairs[pair].fore < 0 || + _cursesi_screen->colour_pairs[pair].back < 0) + __unset_color(curscr); + if (_cursesi_screen->colour_pairs[pair].fore >= 0) + tputs(tiparm(t_set_foreground(_cursesi_screen->term), + (int)_cursesi_screen->colour_pairs[pair].fore), + 0, __cputchar); + if (_cursesi_screen->colour_pairs[pair].back >= 0) + tputs(tiparm(t_set_background(_cursesi_screen->term), + (int)_cursesi_screen->colour_pairs[pair].back), + 0, __cputchar); + break; + } + curscr->wattr &= ~__COLOR; + curscr->wattr |= attr & __COLOR; +} + +/* + * __unset_color -- + * Clear terminal foreground and background colours. + */ +void +__unset_color(WINDOW *win) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, "__unset_color\n"); +#endif + switch (_cursesi_screen->color_type) { + /* Clear ANSI forground and background colours */ + case COLOR_ANSI: + if (orig_pair != NULL) { + tputs(orig_pair, 0, __cputchar); + win->wattr &= __mask_op; + } + break; + case COLOR_HP: + /* XXX: need to support HP style */ + break; + case COLOR_TEK: + /* XXX: need to support Tek style */ + break; + case COLOR_OTHER: + if (orig_pair != NULL) { + tputs(orig_pair, 0, __cputchar); + win->wattr &= __mask_op; + } + break; + } +} + +/* + * __restore_colors -- + * Redo color definitions after restarting 'curses' mode. + */ +void +__restore_colors(void) +{ + if (can_change != 0) + switch (_cursesi_screen->color_type) { + case COLOR_HP: + /* XXX: need to re-initialise HP style (Ip) */ + break; + case COLOR_TEK: + /* XXX: need to re-initialise Tek style (Ic) */ + break; + } +} + +/* + * __change_pair -- + * Mark dirty all positions using pair. + */ +void +__change_pair(short pair) +{ + struct __winlist *wlp; + WINDOW *win; + int y, x; + __LINE *lp; + uint32_t cl = COLOR_PAIR(pair); + + + for (wlp = _cursesi_screen->winlistp; wlp != NULL; wlp = wlp->nextp) { +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, "__change_pair: win = %p\n", + wlp->winp); +#endif + win = wlp->winp; + if (win == __virtscr) + continue; + else if (win == curscr) { + /* Reset colour attribute on curscr */ +#ifdef DEBUG + __CTRACE(__CTRACE_COLOR, + "__change_pair: win == curscr\n"); +#endif + for (y = 0; y < curscr->maxy; y++) { + lp = curscr->alines[y]; + for (x = 0; x < curscr->maxx; x++) { + if ((lp->line[x].attr & __COLOR) == cl) + lp->line[x].attr &= ~__COLOR; + } + } + } else { + /* Mark dirty those positions with colour pair "pair" */ + for (y = 0; y < win->maxy; y++) { + lp = win->alines[y]; + for (x = 0; x < win->maxx; x++) + if ((lp->line[x].attr & + __COLOR) == cl) { + if (!(lp->flags & __ISDIRTY)) + lp->flags |= __ISDIRTY; + /* + * firstchp/lastchp are shared + * between parent window and + * sub-window. + */ + if (*lp->firstchp > x) + *lp->firstchp = x; + if (*lp->lastchp < x) + *lp->lastchp = x; + } +#ifdef DEBUG + if ((win->alines[y]->flags & __ISDIRTY)) + __CTRACE(__CTRACE_COLOR, + "__change_pair: first = %d, " + "last = %d\n", + *win->alines[y]->firstchp, + *win->alines[y]->lastchp); +#endif + } + } + } +} diff --git a/vendor/netbsd-curses/libcurses/color_content.3 b/vendor/netbsd-curses/libcurses/color_content.3 new file mode 120000 index 0000000..1f101c9 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/color_content.3 @@ -0,0 +1 @@ +curses_color.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/color_set.3 b/vendor/netbsd-curses/libcurses/color_set.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/color_set.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/copywin.3 b/vendor/netbsd-curses/libcurses/copywin.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/copywin.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/copywin.c b/vendor/netbsd-curses/libcurses/copywin.c new file mode 100644 index 0000000..852bc4c --- /dev/null +++ b/vendor/netbsd-curses/libcurses/copywin.c @@ -0,0 +1,144 @@ +/* $NetBSD: copywin.c,v 1.19 2019/06/09 07:40:14 blymn Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include +#include +#include "curses.h" +#include "curses_private.h" + +/* + * copywin -- + * Copy the box starting at (sminrow, smincol) with a size that + * matches the destination box (dminrow, dmincol) by (dmaxrow, dmaxcol) + * from the source window srcwin to the destination window dstwin. + * All these coordindinates are relative to the relevant window. + * If dooverlay is true then the copy is nondestructive otherwise the + * copy is destructive. + */ +int copywin(const WINDOW *srcwin, WINDOW *dstwin, + int sminrow, int smincol, + int dminrow, int dmincol, int dmaxrow, int dmaxcol, int dooverlay) +{ + int dcol; + __LDATA *sp, *end; +#ifdef HAVE_WCHAR + cchar_t cc; + nschar_t *np; +#endif /* HAVE_WCHAR */ + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, + "copywin %s mode: from (%d,%d) to (%d,%d-%d,%d)\n", + dooverlay ? "overlay" : "overwrite", + sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol); +#endif + + /* overwrite() and overlay() can come here with -ve srcwin coords */ + if (sminrow < 0) { + dminrow -= sminrow; + sminrow = 0; + } + if (smincol < 0) { + dmincol -= smincol; + smincol = 0; + } + + /* for symmetry allow dstwin coords to be -ve as well */ + if (dminrow < 0) { + sminrow -= dminrow; + dminrow = 0; + } + if (dmincol < 0) { + smincol -= dmincol; + dmincol = 0; + } + + /* Bound dmaxcol for both windows (should be ok for dstwin) */ + if (dmaxcol >= dstwin->maxx) + dmaxcol = dstwin->maxx - 1; + if (smincol + (dmaxcol - dmincol) >= srcwin->maxx) + dmaxcol = srcwin->maxx + dmincol - smincol - 1; + if (dmaxcol < dmincol) + /* nothing in the intersection */ + return OK; + + /* Bound dmaxrow for both windows (should be ok for dstwin) */ + if (dmaxrow >= dstwin->maxy) + dmaxrow = dstwin->maxy - 1; + if (sminrow + (dmaxrow - dminrow) >= srcwin->maxy) + dmaxrow = srcwin->maxy + dminrow - sminrow - 1; + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, + "copywin %s mode: from (%d,%d) to (%d,%d-%d,%d)\n", + dooverlay ? "overlay" : "overwrite", + sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol); +#endif + + for (; dminrow <= dmaxrow; sminrow++, dminrow++) { + sp = &srcwin->alines[sminrow]->line[smincol]; + end = sp + dmaxcol - dmincol; +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "copywin: row %d\n", sminrow); +#endif + for (dcol = dmincol; sp <= end; dcol++, sp++) { + /* XXX: Perhaps this should check for the + * background character + */ + if ((dooverlay && !isspace(sp->ch)) || !dooverlay) { + wmove(dstwin, dminrow, dcol); +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "copywin: dcol = %d\n", dcol); +#endif +#ifndef HAVE_WCHAR + __waddch(dstwin, sp); +#else + cc.vals[0] = sp->ch; + cc.attributes = sp->attr; + cc.elements = 1; + np = sp->nsp; + if (np) { + while (np && cc.elements <= + CURSES_CCHAR_MAX) { + cc.vals[cc.elements++] = np->ch; + np = np->next; + } + } + wadd_wch(dstwin, &cc); +#endif /* HAVE_WCHAR */ + } + } + } + __touchwin(dstwin); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/cr_put.c b/vendor/netbsd-curses/libcurses/cr_put.c new file mode 100644 index 0000000..dfe5cab --- /dev/null +++ b/vendor/netbsd-curses/libcurses/cr_put.c @@ -0,0 +1,473 @@ +/* $NetBSD: cr_put.c,v 1.34 2019/05/20 22:17:41 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +#define HARDTABS 8 + +/* + * Terminal driving and line formatting routines. Basic motion optimizations + * are done here as well as formatting lines (printing of control characters, + * line numbering and the like). + */ + +/* Stub function for the users. */ +int +mvcur(int ly, int lx, int y, int x) +{ + return (__mvcur(ly, lx, y, x, 0)); +} + +static void fgoto(int); +static int plod(int, int); +static int plodput(int); +static int tabcol(int, int); + +static int outcol, outline, destcol, destline; + +/* + * Sync the position of the output cursor. Most work here is rounding for + * terminal boundaries getting the column position implied by wraparound or + * the lack thereof and rolling up the screen to get destline on the screen. + */ +int +__mvcur(int ly, int lx, int y, int x, int in_refresh) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_OUTPUT, + "mvcur: moving cursor from (%d, %d) to (%d, %d) in refresh %d\n", ly, lx, y, x, in_refresh); +#endif + destcol = x; + destline = y; + outcol = lx; + outline = ly; + fgoto(in_refresh); + return (OK); +} + +static void +fgoto(int in_refresh) +{ + int c, l; + char *cgp; + +#ifdef DEBUG + __CTRACE(__CTRACE_OUTPUT, "fgoto: in_refresh=%d\n", in_refresh); +#endif /* DEBUG */ + if (destcol >= COLS) { + destline += destcol / COLS; + destcol %= COLS; + } + if (outcol >= COLS) { + l = (outcol + 1) / COLS; + outline += l; + outcol %= COLS; + if (auto_left_margin == 0) { + while (l > 0) { + if (__pfast) { + if (carriage_return) + tputs(carriage_return, + 0, __cputchar); + else + __cputchar('\r'); + } + if (cursor_down) + tputs(cursor_down, 0, __cputchar); + else + __cputchar('\n'); + l--; + } + outcol = 0; + } + if (outline > LINES - 1) { + destline -= outline - (LINES - 1); + outline = LINES - 1; + } + } + if (destline >= LINES) { + l = destline; + destline = LINES - 1; + if (outline < LINES - 1) { + c = destcol; + if (__pfast == 0 && !cursor_address) + destcol = 0; + fgoto(in_refresh); + destcol = c; + } + while (l >= LINES) { + /* The following linefeed (or simulation thereof) is + * supposed to scroll up the screen, since we are on + * the bottom line. We make the assumption that + * linefeed will scroll. If ns is in the capability + * list this won't work. We should probably have an + * sc capability but sf will generally take the place + * if it works. + * + * Superbee glitch: in the middle of the screen have to + * use esc B (down) because linefeed screws up in + * "Efficient Paging" (what a joke) mode (which is + * essential in some SB's because CRLF mode puts + * garbage in at end of memory), but you must use + * linefeed to scroll since down arrow won't go past + * memory end. I turned this off after recieving Paul + * Eggert's Superbee description which wins better. */ + if (cursor_down /* && !__tc_xb */ && __pfast) + tputs(cursor_down, 0, __cputchar); + else + __cputchar('\n'); + l--; + if (__pfast == 0) + outcol = 0; + } + } + if (destline < outline && !(cursor_address || cursor_up)) + destline = outline; + + if (cursor_address && + (cgp = tiparm(cursor_address, destline, destcol))) + { + /* + * Need this condition due to inconsistent behavior + * of backspace on the last column. + */ +#ifdef DEBUG + __CTRACE(__CTRACE_OUTPUT, "fgoto: cgp=%s\n", cgp); +#endif /* DEBUG */ + if (outcol != COLS - 1 && + plod((int) strlen(cgp), in_refresh) > 0) + plod(0, in_refresh); + else + tputs(cgp, 0, __cputchar); + } else + plod(0, in_refresh); + outline = destline; + outcol = destcol; +} + +/* + * Move (slowly) to destination. + * Hard thing here is using home cursor on really deficient terminals. + * Otherwise just use cursor motions, hacking use of tabs and overtabbing + * and backspace. + * + * XXX this needs to be revisited for wide characters since we may output + * XXX more than one byte for a character. + */ + +static int plodcnt, plodflg; + +static int +plodput(int c) +{ + if (plodflg) + --plodcnt; + else + __cputchar(c); + return 0; +} + +static int +plod(int cnt, int in_refresh) +{ + int i, j, k, soutcol, soutline; + +#ifdef DEBUG + __CTRACE(__CTRACE_OUTPUT, "plod: cnt=%d, in_refresh=%d\n", + cnt, in_refresh); +#endif /* DEBUG */ + plodcnt = plodflg = cnt; + soutcol = outcol; + soutline = outline; + + /* + * Consider homing and moving down/right from there, vs. moving + * directly with local motions to the right spot. + */ + if (cursor_home) { + /* + * i is the cost to home and tab/space to the right to get to + * the proper column. This assumes nd space costs 1 char. So + * i + destcol is cost of motion with home. + */ + if (__GT) + i = (destcol / HARDTABS) + (destcol % HARDTABS); + else + i = destcol; + + /* j is cost to move locally without homing. */ + if (destcol >= outcol) { /* if motion is to the right */ + j = destcol / HARDTABS - outcol / HARDTABS; + if (__GT && j) + j += destcol % HARDTABS; + else + j = destcol - outcol; + } else + /* leftward motion only works if we can backspace. */ + if (outcol - destcol <= i) + /* Cheaper to backspace. */ + i = j = outcol - destcol; + else + /* Impossibly expensive. */ + j = i + 1; + + /* k is the absolute value of vertical distance. */ + k = outline - destline; + if (k < 0) + k = -k; + j += k; + + /* Decision. We may not have a choice if no up. */ + if (i + destline < j || (!cursor_up && destline < outline)) { + /* + * Cheaper to home. Do it now and pretend it's a + * regular local motion. + */ + tputs(cursor_home, 0, plodput); + outcol = outline = 0; + } else + if (cursor_to_ll) { + /* + * Quickly consider homing down and moving from + * there. Assume cost of ll is 2. + */ + k = (LINES - 1) - destline; + if (i + k + 2 < j && (k <= 0 || cursor_up)) { + tputs(cursor_to_ll, 0, plodput); + outcol = 0; + outline = LINES - 1; + } + } + } else + /* No home and no up means it's impossible. */ + if (!cursor_up && destline < outline) + return (-1); + if (__GT) + i = destcol % HARDTABS + destcol / HARDTABS; + else + i = destcol; +#ifdef notdef + if (back_tab && outcol > destcol && + (j = (((outcol + 7) & ~7) - destcol - 1) >> 3)) { + j *= (k = strlen(back_tab)); + if ((k += (destcol & 7)) > 4) + j += 8 - (destcol & 7); + else + j += k; + } else +#endif + j = outcol - destcol; + + /* + * If we will later need a \n which will turn into a \r\n by the + * system or the terminal, then don't bother to try to \r. + */ + if ((__NONL || !__pfast) && outline < destline) + goto dontcr; + + /* + * If the terminal will do a \r\n and there isn't room for it, then + * we can't afford a \r. + */ + if (!carriage_return && outline >= destline) + goto dontcr; + + /* + * If it will be cheaper, or if we can't back up, then send a return + * preliminarily. + */ + if (j > i + 1 || outcol > destcol) { + /* + * BUG: this doesn't take the (possibly long) length of cr + * into account. + */ + if (carriage_return) + tputs(carriage_return, 0, plodput); + else + plodput('\r'); + if (!carriage_return) { + if (cursor_down) + tputs(cursor_down, 0, plodput); + else + plodput('\n'); + outline++; + } + outcol = 0; + } +dontcr:while (outline < destline) { + outline++; + if (cursor_down) + tputs(cursor_down, 0, plodput); + else + plodput('\n'); + if (plodcnt < 0) + goto out; + if (__NONL || __pfast == 0) + outcol = 0; + } +#ifdef notdef + if (back_tab) + k = (int) strlen(back_tab); +#endif + while (outcol > destcol) { + if (plodcnt < 0) + goto out; +#ifdef notdef + if (back_tab && outcol - destcol > k + 4) { + tputs(back_tab, 0, plodput); + outcol--; + outcol &= ~7; + continue; + } +#endif + outcol--; + if (cursor_left) + tputs(cursor_left, 0, plodput); + else + plodput('\b'); + } + while (outline > destline) { + outline--; + tputs(cursor_up, 0, plodput); + if (plodcnt < 0) + goto out; + } + if (__GT && destcol - outcol > 1) { + for (;;) { + i = tabcol(outcol, HARDTABS); + if (i > destcol) + break; + if (tab) + tputs(tab, 0, plodput); + else + plodput('\t'); + outcol = i; + } + if (destcol - outcol > 4 && i < COLS) { + if (tab) + tputs(tab, 0, plodput); + else + plodput('\t'); + outcol = i; + while (outcol > destcol) { + outcol--; + if (cursor_left) + tputs(cursor_left, 0, plodput); + else + plodput('\b'); + } + } + } + while (outcol < destcol) { + /* + * Move one char to the right. We don't use nd space because + * it's better to just print the char we are moving over. + */ + if (in_refresh) + if (plodflg) /* Avoid a complex calculation. */ + plodcnt--; + else { +#ifndef HAVE_WCHAR + i = curscr->alines[outline]->line[outcol].ch + & __CHARTEXT; + if (curscr->alines[outline]->line[outcol].attr + == curscr->wattr) + __cputchar(i); +#else + if ((curscr->alines[outline]->line[outcol].attr + & WA_ATTRIBUTES) + == curscr->wattr) { + switch (WCOL(curscr->alines[outline]->line[outcol])) { + case 1: + __cputwchar(curscr->alines[outline]->line[outcol].ch); + __cursesi_putnsp(curscr->alines[outline]->line[outcol].nsp, + outline, + outcol); +#ifdef DEBUG + __CTRACE(__CTRACE_OUTPUT, + "plod: (%d,%d)WCOL(%d), " + "putwchar(%x)\n", + outline, outcol, + WCOL(curscr->alines[outline]->line[outcol]), + curscr->alines[outline]->line[outcol].ch); +#endif /* DEBUG */ + /*FALLTHROUGH*/ + case 0: + break; + default: + goto nondes; + } + } +#endif /* HAVE_WCHAR */ + else + goto nondes; + } + else + nondes: if (cursor_right) + tputs(cursor_right, 0, plodput); + else + plodput(' '); + outcol++; + if (plodcnt < 0) + goto out; + } + +out: if (plodflg) { + outcol = soutcol; + outline = soutline; + } +#ifdef DEBUG + __CTRACE(__CTRACE_OUTPUT, "plod: returns %d\n", plodcnt); +#endif /* DEBUG */ + return plodcnt; +} + +/* + * Return the column number that results from being in column col and + * hitting a tab, where tabs are set every ts columns. Work right for + * the case where col > COLS, even if ts does not divide COLS. + */ +static int +tabcol(int col, int ts) +{ + int offset; + + if (col >= COLS) { + offset = COLS * (col / COLS); + col -= offset; + } else + offset = 0; + return (col + ts - (col % ts) + offset); +} diff --git a/vendor/netbsd-curses/libcurses/ctrace.c b/vendor/netbsd-curses/libcurses/ctrace.c new file mode 100644 index 0000000..8d266bb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/ctrace.c @@ -0,0 +1,111 @@ +/* $NetBSD: ctrace.c,v 1.23 2018/10/29 00:31:57 uwe Exp $ */ + +/*- + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#ifdef DEBUG +#include +#include +#include + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +static FILE *tracefp = NULL; /* Curses debugging file descriptor. */ + +static int tracemask; /* Areas of trace output we want. */ + +static int init_done = 0; + +static void +__CTRACE_init(void) +{ + char *tf, *tm; + + tm = getenv("CURSES_TRACE_MASK"); + if (tm == NULL) + tracemask = __CTRACE_ALL; + else + tracemask = (int)strtol(tm, NULL, 0); + if (tracemask < 0) + tracemask = (0 - tracemask) ^ __CTRACE_ALL; + if (tracemask == 0) + return; + + tf = getenv("CURSES_TRACE_FILE"); + + if ((tf != NULL) && !strcmp( tf, "")) + tf = NULL; + + if (tf != NULL) + tracefp = fopen(tf, "w"); + + init_done = 1; + __CTRACE(__CTRACE_ALL, "Trace mask: 0x%08x\n", tracemask); +} + +void +__CTRACE(int area, const char *fmt,...) +{ + static int seencr = 1; + va_list ap; + + if (!init_done) + __CTRACE_init(); + if (tracefp == NULL || !(tracemask & area)) + return; + + if (seencr && (tracemask & __CTRACE_TSTAMP)) { + struct timeval tv; + gettimeofday(&tv, NULL); + (void)fprintf(tracefp, "%llu.%06lu: ", + (long long)tv.tv_sec, (long)tv.tv_usec); + } + va_start(ap, fmt); + (void)vfprintf(tracefp, fmt, ap); + seencr = (strchr(fmt, '\n') != NULL); + va_end(ap); + (void)fflush(tracefp); +} +#else +/* this kills the empty translation unit message from lint... */ +void +__cursesi_make_lint_shut_up_if_debug_not_defined(void); + +void +__cursesi_make_lint_shut_up_if_debug_not_defined(void) +{ + return; +} +#endif diff --git a/vendor/netbsd-curses/libcurses/cur_hash.c b/vendor/netbsd-curses/libcurses/cur_hash.c new file mode 100644 index 0000000..fa785ce --- /dev/null +++ b/vendor/netbsd-curses/libcurses/cur_hash.c @@ -0,0 +1,58 @@ +/* $NetBSD: cur_hash.c,v 1.13 2017/01/06 09:14:07 roy Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * __hash_more() is "hashpjw" from the Dragon Book, Aho, Sethi & Ullman, p.436. + */ +unsigned int +__hash_more(const void *v_s, size_t len, unsigned int h) +{ + unsigned int g; + size_t i = 0; + const char *s = v_s; + + while (i < len) { + h = (h << 4) + s[i]; + if ((g = h & 0xf0000000) != 0) { + h = h ^ (g >> 24); + h = h ^ g; + } + i++; + } + return h; +} diff --git a/vendor/netbsd-curses/libcurses/curs_set.3 b/vendor/netbsd-curses/libcurses/curs_set.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curs_set.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/curs_set.c b/vendor/netbsd-curses/libcurses/curs_set.c new file mode 100644 index 0000000..3f5ff4b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curs_set.c @@ -0,0 +1,105 @@ +/* $NetBSD: curs_set.c,v 1.10 2011/03/30 09:47:02 blymn Exp $ */ + +/*- + * Copyright (c) 1998-2000 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * curs_set -- + * Set the visibility of the cursor, 0 means invisible, 1 means normal + * visibility and 2 means high visibility. Return the previous + * visibility iff the terminal supports the new visibility otherwise + * return ERR. + */ +int +curs_set(int visibility) +{ + int old_one; + + old_one = _cursesi_screen->old_mode; + switch (visibility) { + case 0: /* invisible */ + if (cursor_invisible != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "curs_set: invisible\n"); +#endif + _cursesi_screen->old_mode = 0; + tputs(cursor_invisible, 0, __cputchar); + fflush(_cursesi_screen->outfd); + return old_one; + } + break; + + case 1: /* normal */ + if (cursor_normal != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "curs_set: normal\n"); +#endif + _cursesi_screen->old_mode = 1; + tputs(cursor_normal, 0, __cputchar); + fflush(_cursesi_screen->outfd); + return old_one; + } + break; + + case 2: /* high visibility */ + if (cursor_visible != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "curs_set: high vis\n"); +#endif + _cursesi_screen->old_mode = 2; + tputs(cursor_visible, 0, __cputchar); + fflush(_cursesi_screen->outfd); + return old_one; + } + break; + + default: + break; + } + + return ERR; +} + +/* + * __restore_cursor_vis -- + * Restore the old cursor visibility. + */ +void +__restore_cursor_vis(void) +{ + curs_set(_cursesi_screen->old_mode); +} + diff --git a/vendor/netbsd-curses/libcurses/curses.3 b/vendor/netbsd-curses/libcurses/curses.3 new file mode 100644 index 0000000..1569455 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses.3 @@ -0,0 +1,379 @@ +.\" $NetBSD: curses.3,v 1.74 2019/09/02 09:08:29 roy Exp $ +.\" +.\" Copyright (c) 1985, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)curses.3 8.1 (Berkeley) 6/4/93 +.\" +.Dd August 29, 2019 +.Dt CURSES 3 +.Os +.Sh NAME +.Nm curses +.Nd screen functions with +.Dq optimal +cursor motion +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.Nm cc +.Op Ar flags +.Ar files +.Fl lcurses +.Op Ar libraries +.Sh DESCRIPTION +These routines give the user a method of updating screens with reasonable +optimization. +They keep an image of the current screen, +and the user sets up an image of a new one. +Then the +.Fn refresh +tells the routines to make the current screen look like the new one. +In order to initialize the routines, the routine +.Fn initscr +must be called before any of the other routines that deal with windows and +screens are used. +The routine +.Fn endwin +should be called before exiting. +The routine +.Fn start_color +must be called before any of the other routines that deal with color are used. +.Sh FUNCTIONS +.Bl -column "subwin(win,lines,cols,begin_y,begin_x)" +.It Sy "Function Name" Ta Sy "Manual Page Name" +.It addch Ta Xr curses_addch 3 +.It addchnstr Ta Xr curses_addchstr 3 +.It addchstr Ta Xr curses_addchstr 3 +.It addnstr Ta Xr curses_addstr 3 +.It addstr Ta Xr curses_addstr 3 +.It assume_default_colors Ta Xr curses_default_colors 3 +.It attr_get Ta Xr curses_attributes 3 +.It attr_off Ta Xr curses_attributes 3 +.It attr_on Ta Xr curses_attributes 3 +.It attr_set Ta Xr curses_attributes 3 +.It attroff Ta Xr curses_attributes 3 +.It attron Ta Xr curses_attributes 3 +.It attrset Ta Xr curses_attributes 3 +.It baudrate Ta Xr curses_tty 3 +.It beep Ta Xr curses_tty 3 +.It bkgd Ta Xr curses_background 3 +.It bkgdset Ta Xr curses_background 3 +.It border Ta Xr curses_border 3 +.It box Ta Xr curses_border 3 +.It can_change_color Ta Xr curses_color 3 +.It cbreak Ta Xr curses_tty 3 +.It chgat Ta Xr curses_chgat 3 +.It clear Ta Xr curses_clear 3 +.It clearok Ta Xr curses_clear 3 +.It clrtobot Ta Xr curses_clear 3 +.It clrtoeol Ta Xr curses_clear 3 +.It color_content Ta Xr curses_color 3 +.It color_set Ta Xr curses_attributes 3 +.It copywin Ta Xr curses_window 3 +.It curs_set Ta Xr curses_tty 3 +.It curses_version Ta Xr curses_version 3 +.It def_prog_mode Ta Xr curses_tty 3 +.It def_shell_mode Ta Xr curses_tty 3 +.It define_key Ta Xr curses_input 3 +.It delay_output Ta Xr curses_tty 3 +.It delch Ta Xr curses_delch 3 +.It deleteln Ta Xr curses_deleteln 3 +.It delscreen Ta Xr curses_screen 3 +.It delwin Ta Xr curses_window 3 +.It derwin Ta Xr curses_window 3 +.It doupdate Ta Xr curses_refresh 3 +.It dupwin Ta Xr curses_window 3 +.It echo Ta Xr curses_tty 3 +.It endwin Ta Xr curses_screen 3 +.It erase Ta Xr curses_clear 3 +.It erasechar Ta Xr curses_tty 3 +.It filter Ta Xr curses_screen 3 +.It flash Ta Xr curses_tty 3 +.It flushinp Ta Xr curses_tty 3 +.It flushok Ta Xr curses_refresh 3 +.It fullname Ta Xr curses_termcap 3 +.It getattrs Ta Xr curses_attributes 3 +.It getbegx Ta Xr curses_cursor 3 +.It getbegy Ta Xr curses_cursor 3 +.It getbkgd Ta Xr curses_background 3 +.It getch Ta Xr curses_input 3 +.It getcurx Ta Xr curses_cursor 3 +.It getcury Ta Xr curses_cursor 3 +.It getmaxx Ta Xr curses_cursor 3 +.It getmaxy Ta Xr curses_cursor 3 +.It getnstr Ta Xr curses_input 3 +.It getparx Ta Xr curses_cursor 3 +.It getpary Ta Xr curses_cursor 3 +.It getparyx Ta Xr curses_cursor 3 +.It getstr Ta Xr curses_input 3 +.It gettmode Ta Xr curses_tty 3 +.It getwin Ta Xr curses_fileio 3 +.It getyx Ta Xr curses_cursor 3 +.It has_colors Ta Xr curses_color 3 +.It has_ic Ta Xr curses_tty 3 +.It has_il Ta Xr curses_tty 3 +.It has_key Ta Xr curses_input 3 +.It hline Ta Xr curses_line 3 +.It idcok Ta Xr curses_tty 3 +.It idlok Ta Xr curses_tty 3 +.It immedok Ta Xr curses_refresh 3 +.It inch Ta Xr curses_inch 3 +.It inchnstr Ta Xr curses_inch 3 +.It inchstr Ta Xr curses_inch 3 +.It init_color Ta Xr curses_color 3 +.It init_pair Ta Xr curses_color 3 +.It initscr Ta Xr curses_screen 3 +.It innstr Ta Xr curses_inch 3 +.It insch Ta Xr curses_insch 3 +.It insdelln Ta Xr curses_insdelln 3 +.It insertln Ta Xr curses_insertln 3 +.It instr Ta Xr curses_inch 3 +.It intrflush Ta Xr curses_tty 3 +.It is_keypad Ta Xr curses_input 3 +.It is_leaveok Ta Xr curses_refresh 3 +.It is_linetouched Ta Xr curses_touch 3 +.It is_pad Ta Xr curses_pad 3 +.It is_term_resized Ta Xr curses_screen 3 +.It is_wintouched Ta Xr curses_touch 3 +.It isendwin Ta Xr curses_screen 3 +.It keyname Ta Xr curses_keyname 3 +.It keyok Ta Xr curses_input 3 +.It keypad Ta Xr curses_input 3 +.It killchar Ta Xr curses_tty 3 +.It leaveok Ta Xr curses_tty 3 +.It meta Ta Xr curses_tty 3 +.It move Ta Xr curses_cursor 3 +.It mvaddch Ta Xr curses_addch 3 +.It mvaddchnstr Ta Xr curses_addchstr 3 +.It mvaddchstr Ta Xr curses_addchstr 3 +.It mvaddnstr Ta Xr curses_addstr 3 +.It mvaddstr Ta Xr curses_addstr 3 +.It mvchgat Ta Xr curses_chgat 3 +.It mvcur Ta Xr curses_cursor 3 +.It mvderwin Ta Xr curses_window 3 +.It mvgetnstr Ta Xr curses_input 3 +.It mvgetstr Ta Xr curses_input 3 +.It mvhline Ta Xr curses_line 3 +.It mvinchstr Ta Xr curses_inch 3 +.It mvinchnstr Ta Xr curses_inch 3 +.It mvinsch Ta Xr curses_insch 3 +.It mvprintw Ta Xr curses_print 3 +.It mvscanw Ta Xr curses_scanw 3 +.It mvvline Ta Xr curses_line 3 +.It mvwaddch Ta Xr curses_addch 3 +.It mvwaddchnstr Ta Xr curses_addchstr 3 +.It mvwaddchstr Ta Xr curses_addchstr 3 +.It mvwaddnstr Ta Xr curses_addstr 3 +.It mvwaddstr Ta Xr curses_addstr 3 +.It mvwchgat Ta Xr curses_chgat 3 +.It mvwgetnstr Ta Xr curses_input 3 +.It mvwgetstr Ta Xr curses_input 3 +.It mvwhline Ta Xr curses_line 3 +.It mvwinchstr Ta Xr curses_inch 3 +.It mvwinchnstr Ta Xr curses_inch 3 +.It mvwinsch Ta Xr curses_insch 3 +.It mvwprintw Ta Xr curses_print 3 +.It mvwscanw Ta Xr curses_scanw 3 +.It mvwvline Ta Xr curses_line 3 +.It napms Ta Xr curses_tty 3 +.It newpad Ta Xr curses_pad 3 +.It newterm Ta Xr curses_screen 3 +.It newwin Ta Xr curses_window 3 +.It \&nl Ta Xr curses_tty 3 +.It nocbreak Ta Xr curses_tty 3 +.It nodelay Ta Xr curses_input 3 +.It noecho Ta Xr curses_tty 3 +.It nonl Ta Xr curses_tty 3 +.It noqiflush Ta Xr curses_tty 3 +.It noraw Ta Xr curses_tty 3 +.It notimeout Ta Xr curses_input 3 +.It overlay Ta Xr curses_window 3 +.It overwrite Ta Xr curses_window 3 +.It pair_content Ta Xr curses_color 3 +.It pnoutrefresh Ta Xr curses_pad 3 +.It prefresh Ta Xr curses_pad 3 +.It printw Ta Xr curses_print 3 +.It putwin Ta Xr curses_fileio 3 +.It qiflush Ta Xr curses_tty 3 +.It raw Ta Xr curses_tty 3 +.It redrawwin Ta Xr curses_touch 3 +.It refresh Ta Xr curses_refresh 3 +.It reset_prog_mode Ta Xr curses_tty 3 +.It reset_shell_mode Ta Xr curses_tty 3 +.It resetty Ta Xr curses_tty 3 +.It resize_term Ta Xr curses_screen 3 +.It resizeterm Ta Xr curses_screen 3 +.It ripoffline Ta Xr curses_screen 3 +.It savetty Ta Xr curses_tty 3 +.It scanw Ta Xr curses_scanw 3 +.It scrl Ta Xr curses_scroll 3 +.It scroll Ta Xr curses_scroll 3 +.It scrollok Ta Xr curses_scroll 3 +.It set_escdelay Ta Xr curses_input 3 +.It set_tabsize Ta Xr curses_screen 3 +.It set_term Ta Xr curses_screen 3 +.It setscrreg Ta Xr curses_scroll 3 +.It setterm Ta Xr curses_screen 3 +.It slk_attroff Ta Xr curses_slk 3 +.It slk_attr_off Ta Xr curses_slk 3 +.It slk_attron Ta Xr curses_slk 3 +.It slk_attr_on Ta Xr curses_slk 3 +.It slk_attrset Ta Xr curses_slk 3 +.It slk_attr_set Ta Xr curses_slk 3 +.It slk_clear Ta Xr curses_slk 3 +.It slk_color Ta Xr curses_slk 3 +.It slk_init Ta Xr curses_slk 3 +.It slk_label Ta Xr curses_slk 3 +.It slk_noutrefresh Ta Xr curses_slk 3 +.It slk_refresh Ta Xr curses_slk 3 +.It slk_restore Ta Xr curses_slk 3 +.It slk_set Ta Xr curses_slk 3 +.It slk_touch Ta Xr curses_slk 3 +.It slk_wset Ta Xr curses_slk 3 +.It standend Ta Xr curses_standout 3 +.It standout Ta Xr curses_standout 3 +.It start_color Ta Xr curses_color 3 +.It syncok Ta Xr curses_touch 3 +.It subpad Ta Xr curses_pad 3 +.It subwin Ta Xr curses_window 3 +.It termattrs Ta Xr curses_attributes 3 +.It timeout Ta Xr curses_input 3 +.It touchline Ta Xr curses_touch 3 +.It touchoverlap Ta Xr curses_touch 3 +.It touchwin Ta Xr curses_touch 3 +.It typeahead Ta Xr curses_tty 3 +.It unctrl Ta Xr curses_print 3 +.It underend Ta Xr curses_underscore 3 +.It underscore Ta Xr curses_underscore 3 +.It ungetch Ta Xr curses_input 3 +.It untouchwin Ta Xr curses_touch 3 +.It use_default_colors Ta Xr curses_default_colors 3 +.It use_env Ta Xr curses_screen 3 +.It vline Ta Xr curses_line 3 +.It waddch Ta Xr curses_addch 3 +.It waddchnstr Ta Xr curses_addchstr 3 +.It waddchstr Ta Xr curses_addchstr 3 +.It waddnstr Ta Xr curses_addstr 3 +.It waddstr Ta Xr curses_addstr 3 +.It wattr_get Ta Xr curses_attributes 3 +.It wattr_off Ta Xr curses_attributes 3 +.It wattr_on Ta Xr curses_attributes 3 +.It wattr_set Ta Xr curses_attributes 3 +.It wattroff Ta Xr curses_attributes 3 +.It wattron Ta Xr curses_attributes 3 +.It wattrset Ta Xr curses_attributes 3 +.It wbkgd Ta Xr curses_background 3 +.It wbkgdset Ta Xr curses_background 3 +.It wborder Ta Xr curses_border 3 +.It wchgat Ta Xr curses_chgat 3 +.It wclear Ta Xr curses_clear 3 +.It wclrtobot Ta Xr curses_clear 3 +.It wclrtoeol Ta Xr curses_clear 3 +.It wcolor_set Ta Xr curses_attributes 3 +.It wcursyncup Ta Xr curses_cursor 3 +.It wdelch Ta Xr curses_delch 3 +.It wdeleteln Ta Xr curses_deleteln 3 +.It werase Ta Xr curses_clear 3 +.It wgetch Ta Xr curses_input 3 +.It wgetnstr Ta Xr curses_input 3 +.It wgetstr Ta Xr curses_input 3 +.It whline Ta Xr curses_line 3 +.It winch Ta Xr curses_inch 3 +.It winchnstr Ta Xr curses_inch 3 +.It winchstr Ta Xr curses_inch 3 +.It winnstr Ta Xr curses_inch 3 +.It winsch Ta Xr curses_insch 3 +.It winsdelln Ta Xr curses_insdelln 3 +.It winsertln Ta Xr curses_insertln 3 +.It winstr Ta Xr curses_inch 3 +.It wmove Ta Xr curses_cursor 3 +.It wnoutrefresh Ta Xr curses_refresh 3 +.It wprintw Ta Xr curses_print 3 +.It wredrawln Ta Xr curses_touch 3 +.It wrefresh Ta Xr curses_refresh 3 +.It wresize Ta Xr curses_window 3 +.It wscanw Ta Xr curses_scanw 3 +.It wscrl Ta Xr curses_scroll 3 +.It wsetscrreg Ta Xr curses_scroll 3 +.It wstandend Ta Xr curses_standout 3 +.It wstandout Ta Xr curses_standout 3 +.It wsyncup Ta Xr curses_touch 3 +.It wsyncdown Ta Xr curses_touch 3 +.It wtimeout Ta Xr curses_input 3 +.It wtouchln Ta Xr curses_touch 3 +.It wunderend Ta Xr curses_underscore 3 +.It wunderscore Ta Xr curses_underscore 3 +.It wvline Ta Xr curses_line 3 +.El +.Sh ENVIRONMENT +.Bl -tag -width CURSES_TRACE_MASK +.It Ev COLUMNS +The number of columns in the terminal if set. +This is usually automatically configured by querying the kernel. +.It Ev CURSES_TRACE_MASK +An integer mask that enables specific debugging traces. +Enabled only in the debug build of curses. +.It Ev CURSES_TRACE_FILE +A file where to output debugging information. +Enabled only in the debug build of curses. +.It Ev ESCDELAY +The maximum delay in milliseconds between characters in multi-character +keystrokes (such are arrow keys) where the adjacent characters are considered +part of the same multi-character sequence. +The default is 300 milliseconds. +.It Ev LINES +The number of lines in the terminal if set. +is usually automatically configured by querying the kernel. +.It Ev TABSIZE +The number of spaces making up a tab. +The default is 8 if not specified by the terminal description. +.It Ev TERM +The terminal type of the current terminal. +.El +.Sh SEE ALSO +.Xr ioctl 2 , +.Xr getenv 3 , +.Xr tty 4 , +.Xr terminfo 5 +.Rs +.%T Screen Updating and Cursor Movement Optimization: A Library Package +.%A Ken Arnold +.Re +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . +.Sh AUTHORS +.An Ken Arnold +.An Julian Coleman +.An Brett Lymn +.An Roy Marples diff --git a/vendor/netbsd-curses/libcurses/curses.c b/vendor/netbsd-curses/libcurses/curses.c new file mode 100644 index 0000000..d393cf4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses.c @@ -0,0 +1,156 @@ +/* $NetBSD: curses.c,v 1.28 2017/01/31 09:17:53 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +/* Private. */ +int __echoit = 1; /* If stty indicates ECHO. */ +int __pfast; +int __rawmode = 0; /* If stty indicates RAW mode. */ +int __noqch = 0; + /* If terminal doesn't have + * insert/delete line capabilities + * for quick change on refresh. + */ +char __CA; + +/* + * Public. + * + * XXX + * UPPERCASE isn't used by libcurses, and is left for backward + * compatibility only. + */ +WINDOW *curscr; /* Current screen. */ +WINDOW *stdscr; /* Standard screen. */ +WINDOW *__virtscr; /* Virtual screen (for doupdate()). */ +SCREEN *_cursesi_screen; /* the current screen we are using */ +volatile bool _reentrant; /* If true, some global vars are ro. */ +int COLS; /* Columns on the screen. */ +int LINES; /* Lines on the screen. */ +int ESCDELAY; /* ms delay between keys for esc seq */ +int TABSIZE; /* Size of a tab. */ +int COLORS; /* Maximum colors on the screen */ +int COLOR_PAIRS = 0; /* Maximum color pairs on the screen */ +int My_term = 0; /* Use Def_term regardless. */ +const char *Def_term = "unknown"; /* Default terminal type. */ +char __GT; /* Gtty indicates tabs. */ +char __NONL; /* Term can't hack LF doing a CR. */ +char __UPPERCASE; /* Terminal is uppercase only. */ + +#ifdef HAVE_WCHAR +/* + * Copy the non-spacing character list (src_nsp) to the given character, + * allocate or free storage as required. + */ +int +_cursesi_copy_nsp(nschar_t *src_nsp, struct __ldata *ch) +{ + nschar_t *np, *tnp, *pnp; + + pnp = NULL; + np = src_nsp; + if (np) { + tnp = ch->nsp; + while (np) { + if (tnp) { + tnp->ch = np->ch; + pnp = tnp; + tnp = tnp->next; + } else { + tnp = malloc(sizeof(nschar_t)); + if (!tnp) + return ERR; + tnp->ch = np->ch; + pnp->next = tnp; + tnp->next = NULL; + pnp = tnp; + tnp = NULL; + } + np = np->next; + } + np = tnp; + if (np) { + pnp->next = NULL; + __cursesi_free_nsp(np); + } + } else { + if (ch->nsp) { + __cursesi_free_nsp(ch->nsp); + ch->nsp = NULL; + } + } + + return OK; +} + +/* + * Free the storage associated with a non-spacing character - traverse the + * linked list until all storage is done. + */ +void +__cursesi_free_nsp(nschar_t *inp) +{ + nschar_t *tnp, *np; + + np = inp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + } +} + +/* + * Traverse all the cells in the given window free'ing the non-spacing + * character storage. + */ +void +__cursesi_win_free_nsp(WINDOW *win) +{ + int i, j; + __LDATA *sp; + + for (i = 0; i < win->maxy; i++) { + for (sp = win->alines[i]->line, j = 0; j < win->maxx; + j++, sp++) { + __cursesi_free_nsp(sp->nsp); + } + } +} + +#endif diff --git a/vendor/netbsd-curses/libcurses/curses.h b/vendor/netbsd-curses/libcurses/curses.h new file mode 100644 index 0000000..c12d02c --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses.h @@ -0,0 +1,1079 @@ +/* $NetBSD: curses.h,v 1.130 2021/02/13 10:37:00 rillig Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)curses.h 8.5 (Berkeley) 4/29/95 + * + * Modified by Ruibiao Qiu 2005 + * to add wide-character support + * - Add complex character structure (cchar_t) + * - Add definitions of wide-character routines + * - Add KEY_CODE_YES + */ + +#ifndef _CURSES_H_ +#define _CURSES_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include +#include + +/* + * following snippet is netbsd-curses portable specific + */ + +#include +#define __va_list va_list +#ifndef __printflike +#if __GNUC__ >= 3 +#define __printflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) +#define __scanflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) +#else +#define __printflike(fmtarg, firstvararg) /* nothing */ +#define __scanflike(fmtarg, firstvararg) /* nothing */ +#endif +#endif + +/* + * attr_t must be the same size as wchar_t (see ) to avoid padding + * in __LDATA. + */ +typedef wchar_t chtype; +typedef wchar_t attr_t; + +#if !defined(HAVE_WCHAR) && !defined(DISABLE_WCHAR) +#define HAVE_WCHAR 1 +#endif + +#ifdef HAVE_WCHAR +/* + * The complex character structure required by the X/Open reference and used + * in functions such as in_wchstr(). It includes a string of up to 8 wide + * characters and its length, an attribute, and a color-pair. + */ +#define CURSES_CCHAR_MAX 8 +#define CCHARW_MAX 5 +typedef struct { + attr_t attributes; /* character attributes */ + unsigned elements; /* number of wide chars in + vals[] */ + wchar_t vals[CURSES_CCHAR_MAX]; /* wide chars including + non-spacing */ +} cchar_t; +#else +typedef chtype cchar_t; +#endif /* HAVE_WCHAR */ + +#ifndef TRUE +#define TRUE (/*CONSTCOND*/1) +#endif +#ifndef FALSE +#define FALSE (/*CONSTCOND*/0) +#endif + +#ifndef _CURSES_PRIVATE + +#define _puts(s) tputs(s, 0, __cputchar) +#define _putchar(c) __cputchar(c) + +/* Old-style terminal modes access. */ +#define crmode() cbreak() +#define nocrmode() nocbreak() +#endif /* _CURSES_PRIVATE */ + + +/* symbols for values returned by getch in keypad mode */ +#define KEY_MIN 0x101 /* minimum extended key value */ +#define KEY_BREAK 0x101 /* break key */ +#define KEY_DOWN 0x102 /* down arrow */ +#define KEY_UP 0x103 /* up arrow */ +#define KEY_LEFT 0x104 /* left arrow */ +#define KEY_RIGHT 0x105 /* right arrow*/ +#define KEY_HOME 0x106 /* home key */ +#define KEY_BACKSPACE 0x107 /* Backspace */ + +/* First function key (block of 64 follow) */ +#define KEY_F0 0x108 +/* Function defining other function key values */ +#define KEY_F(n) (KEY_F0+(n)) + +#define KEY_DL 0x148 /* Delete Line */ +#define KEY_IL 0x149 /* Insert Line*/ +#define KEY_DC 0x14A /* Delete Character */ +#define KEY_IC 0x14B /* Insert Character */ +#define KEY_EIC 0x14C /* Exit Insert Char mode */ +#define KEY_CLEAR 0x14D /* Clear screen */ +#define KEY_EOS 0x14E /* Clear to end of screen */ +#define KEY_EOL 0x14F /* Clear to end of line */ +#define KEY_SF 0x150 /* Scroll one line forward */ +#define KEY_SR 0x151 /* Scroll one line back */ +#define KEY_NPAGE 0x152 /* Next Page */ +#define KEY_PPAGE 0x153 /* Prev Page */ +#define KEY_STAB 0x154 /* Set Tab */ +#define KEY_CTAB 0x155 /* Clear Tab */ +#define KEY_CATAB 0x156 /* Clear All Tabs */ +#define KEY_ENTER 0x157 /* Enter or Send */ +#define KEY_SRESET 0x158 /* Soft Reset */ +#define KEY_RESET 0x159 /* Hard Reset */ +#define KEY_PRINT 0x15A /* Print */ +#define KEY_LL 0x15B /* Home Down */ + +/* + * "Keypad" keys are arranged like this: + * + * A1 up A3 + * left B2 right + * C1 down C3 + * + */ +#define KEY_A1 0x15C /* Keypad upper left */ +#define KEY_A3 0x15D /* Keypad upper right */ +#define KEY_B2 0x15E /* Keypad centre key */ +#define KEY_C1 0x15F /* Keypad lower left */ +#define KEY_C3 0x160 /* Keypad lower right */ + +#define KEY_BTAB 0x161 /* Back Tab */ +#define KEY_BEG 0x162 /* Begin key */ +#define KEY_CANCEL 0x163 /* Cancel key */ +#define KEY_CLOSE 0x164 /* Close Key */ +#define KEY_COMMAND 0x165 /* Command Key */ +#define KEY_COPY 0x166 /* Copy key */ +#define KEY_CREATE 0x167 /* Create key */ +#define KEY_END 0x168 /* End key */ +#define KEY_EXIT 0x169 /* Exit key */ +#define KEY_FIND 0x16A /* Find key */ +#define KEY_HELP 0x16B /* Help key */ +#define KEY_MARK 0x16C /* Mark key */ +#define KEY_MESSAGE 0x16D /* Message key */ +#define KEY_MOVE 0x16E /* Move key */ +#define KEY_NEXT 0x16F /* Next Object key */ +#define KEY_OPEN 0x170 /* Open key */ +#define KEY_OPTIONS 0x171 /* Options key */ +#define KEY_PREVIOUS 0x172 /* Previous Object key */ +#define KEY_REDO 0x173 /* Redo key */ +#define KEY_REFERENCE 0x174 /* Ref Key */ +#define KEY_REFRESH 0x175 /* Refresh key */ +#define KEY_REPLACE 0x176 /* Replace key */ +#define KEY_RESTART 0x177 /* Restart key */ +#define KEY_RESUME 0x178 /* Resume key */ +#define KEY_SAVE 0x179 /* Save key */ +#define KEY_SBEG 0x17A /* Shift Begin key */ +#define KEY_SCANCEL 0x17B /* Shift Cancel key */ +#define KEY_SCOMMAND 0x17C /* Shift Command key */ +#define KEY_SCOPY 0x17D /* Shift Copy key */ +#define KEY_SCREATE 0x17E /* Shift Create key */ +#define KEY_SDC 0x17F /* Shift Delete Character */ +#define KEY_SDL 0x180 /* Shift Delete Line */ +#define KEY_SELECT 0x181 /* Select key */ +#define KEY_SEND 0x182 /* Send key */ +#define KEY_SEOL 0x183 /* Shift Clear Line key */ +#define KEY_SEXIT 0x184 /* Shift Exit key */ +#define KEY_SFIND 0x185 /* Shift Find key */ +#define KEY_SHELP 0x186 /* Shift Help key */ +#define KEY_SHOME 0x187 /* Shift Home key */ +#define KEY_SIC 0x188 /* Shift Input key */ +#define KEY_SLEFT 0x189 /* Shift Left Arrow key */ +#define KEY_SMESSAGE 0x18A /* Shift Message key */ +#define KEY_SMOVE 0x18B /* Shift Move key */ +#define KEY_SNEXT 0x18C /* Shift Next key */ +#define KEY_SOPTIONS 0x18D /* Shift Options key */ +#define KEY_SPREVIOUS 0x18E /* Shift Previous key */ +#define KEY_SPRINT 0x18F /* Shift Print key */ +#define KEY_SREDO 0x190 /* Shift Redo key */ +#define KEY_SREPLACE 0x191 /* Shift Replace key */ +#define KEY_SRIGHT 0x192 /* Shift Right Arrow key */ +#define KEY_SRSUME 0x193 /* Shift Resume key */ +#define KEY_SSAVE 0x194 /* Shift Save key */ +#define KEY_SSUSPEND 0x195 /* Shift Suspend key */ +#define KEY_SUNDO 0x196 /* Shift Undo key */ +#define KEY_SUSPEND 0x197 /* Suspend key */ +#define KEY_UNDO 0x198 /* Undo key */ +#define KEY_MOUSE 0x199 /* Mouse event has occurred */ +#define KEY_RESIZE 0x200 /* Resize event has occurred */ +#define KEY_MAX 0x240 /* maximum extended key value */ +#define KEY_CODE_YES 0x241 /* A function key was pressed */ + +#include + +/* + * A window is an array of __LINE structures pointed to by the 'lines' pointer. + * A line is an array of __LDATA structures pointed to by the 'line' pointer. + */ + +/* + * Definitions for characters and attributes in __LDATA + */ +#define __CHARTEXT 0x000000ff /* bits for 8-bit characters */ +#define __NORMAL 0x00000000 /* Added characters are normal. */ +#define __STANDOUT 0x00000100 /* Added characters are standout. */ +#define __UNDERSCORE 0x00000200 /* Added characters are underscored. */ +#define __REVERSE 0x00000400 /* Added characters are reverse + video. */ +#define __BLINK 0x00000800 /* Added characters are blinking. */ +#define __DIM 0x00001000 /* Added characters are dim. */ +#define __BOLD 0x00002000 /* Added characters are bold. */ +#define __BLANK 0x00004000 /* Added characters are blanked. */ +#define __PROTECT 0x00008000 /* Added characters are protected. */ +#define __ALTCHARSET 0x00010000 /* Added characters are ACS */ +#define __COLOR 0x03fe0000 /* Color bits */ +#define __ATTRIBUTES 0x03ffff00 /* All 8-bit attribute bits */ +#ifdef HAVE_WCHAR +#define __ACS_IS_WACS 0x04000000 /* internal: use wacs table for ACS char */ +#endif + +typedef struct __ldata __LDATA; +typedef struct __line __LINE; +typedef struct __window WINDOW; +typedef struct __screen SCREEN; + +/* + * Attribute definitions + */ +#define A_NORMAL __NORMAL +#define A_STANDOUT __STANDOUT +#define A_UNDERLINE __UNDERSCORE +#define A_REVERSE __REVERSE +#define A_BLINK __BLINK +#define A_DIM __DIM +#define A_BOLD __BOLD +#define A_BLANK __BLANK +#define A_INVIS __BLANK +#define A_PROTECT __PROTECT +#define A_ALTCHARSET __ALTCHARSET +#define A_ATTRIBUTES __ATTRIBUTES +#define A_CHARTEXT __CHARTEXT +#define A_COLOR __COLOR + +#ifdef HAVE_WCHAR +#define WA_ATTRIBUTES 0x03ffffff /* Wide character attributes mask */ +#define WA_NORMAL __NORMAL +#define WA_STANDOUT __STANDOUT /* Best highlighting mode */ +#define WA_UNDERLINE __UNDERSCORE /* Underlining */ +#define WA_REVERSE __REVERSE /* Reverse video */ +#define WA_BLINK __BLINK /* Blinking */ +#define WA_DIM __DIM /* Half bright */ +#define WA_BOLD __BOLD /* Extra bright or bold */ +#define WA_INVIS __BLANK /* Invisible */ +#define WA_PROTECT __PROTECT /* Protected */ +#define WA_ALTCHARSET __ALTCHARSET /* Alternate character set */ +#define WA_LOW 0x00000002 /* Low highlight */ +#define WA_TOP 0x00000004 /* Top highlight */ +#define WA_HORIZONTAL 0x00000008 /* Horizontal highlight */ +#define WA_VERTICAL 0x00000010 /* Vertical highlight */ +#define WA_LEFT 0x00000020 /* Left highlight */ +#define WA_RIGHT 0x00000040 /* Right highlight */ +#endif /* HAVE_WCHAR */ + +/* + * Alternate character set definitions + */ + +#define NUM_ACS 128 + +extern chtype _acs_char[NUM_ACS]; +#ifdef __cplusplus +#define __UC_CAST(a) static_cast(a) +#else +#define __UC_CAST(a) (unsigned char)(a) +#endif + +/* Standard definitions */ +#define ACS_RARROW _acs_char[__UC_CAST('+')] +#define ACS_LARROW _acs_char[__UC_CAST(',')] +#define ACS_UARROW _acs_char[__UC_CAST('-')] +#define ACS_DARROW _acs_char[__UC_CAST('.')] +#define ACS_BLOCK _acs_char[__UC_CAST('0')] +#define ACS_DIAMOND _acs_char[__UC_CAST('`')] +#define ACS_CKBOARD _acs_char[__UC_CAST('a')] +#define ACS_DEGREE _acs_char[__UC_CAST('f')] +#define ACS_PLMINUS _acs_char[__UC_CAST('g')] +#define ACS_BOARD _acs_char[__UC_CAST('h')] +#define ACS_LANTERN _acs_char[__UC_CAST('i')] +#define ACS_LRCORNER _acs_char[__UC_CAST('j')] +#define ACS_URCORNER _acs_char[__UC_CAST('k')] +#define ACS_ULCORNER _acs_char[__UC_CAST('l')] +#define ACS_LLCORNER _acs_char[__UC_CAST('m')] +#define ACS_PLUS _acs_char[__UC_CAST('n')] +#define ACS_HLINE _acs_char[__UC_CAST('q')] +#define ACS_S1 _acs_char[__UC_CAST('o')] +#define ACS_S9 _acs_char[__UC_CAST('s')] +#define ACS_LTEE _acs_char[__UC_CAST('t')] +#define ACS_RTEE _acs_char[__UC_CAST('u')] +#define ACS_BTEE _acs_char[__UC_CAST('v')] +#define ACS_TTEE _acs_char[__UC_CAST('w')] +#define ACS_VLINE _acs_char[__UC_CAST('x')] +#define ACS_BULLET _acs_char[__UC_CAST('~')] + +/* Extensions */ +#define ACS_S3 _acs_char[__UC_CAST('p')] +#define ACS_S7 _acs_char[__UC_CAST('r')] +#define ACS_LEQUAL _acs_char[__UC_CAST('y')] +#define ACS_GEQUAL _acs_char[__UC_CAST('z')] +#define ACS_PI _acs_char[__UC_CAST('{')] +#define ACS_NEQUAL _acs_char[__UC_CAST('|')] +#define ACS_STERLING _acs_char[__UC_CAST('}')] + +#ifdef HAVE_WCHAR +extern cchar_t _wacs_char[NUM_ACS]; + +#define WACS_RARROW (&_wacs_char[(unsigned char)'+']) +#define WACS_LARROW (&_wacs_char[(unsigned char)',']) +#define WACS_UARROW (&_wacs_char[(unsigned char)'-']) +#define WACS_DARROW (&_wacs_char[(unsigned char)'.']) +#define WACS_BLOCK (&_wacs_char[(unsigned char)'0']) +#define WACS_DIAMOND (&_wacs_char[(unsigned char)'`']) +#define WACS_CKBOARD (&_wacs_char[(unsigned char)'a']) +#define WACS_DEGREE (&_wacs_char[(unsigned char)'f']) +#define WACS_PLMINUS (&_wacs_char[(unsigned char)'g']) +#define WACS_BOARD (&_wacs_char[(unsigned char)'h']) +#define WACS_LANTERN (&_wacs_char[(unsigned char)'i']) +#define WACS_LRCORNER (&_wacs_char[(unsigned char)'j']) +#define WACS_URCORNER (&_wacs_char[(unsigned char)'k']) +#define WACS_ULCORNER (&_wacs_char[(unsigned char)'l']) +#define WACS_LLCORNER (&_wacs_char[(unsigned char)'m']) +#define WACS_PLUS (&_wacs_char[(unsigned char)'n']) +#define WACS_HLINE (&_wacs_char[(unsigned char)'q']) +#define WACS_S1 (&_wacs_char[(unsigned char)'o']) +#define WACS_S9 (&_wacs_char[(unsigned char)'s']) +#define WACS_LTEE (&_wacs_char[(unsigned char)'t']) +#define WACS_RTEE (&_wacs_char[(unsigned char)'u']) +#define WACS_BTEE (&_wacs_char[(unsigned char)'v']) +#define WACS_TTEE (&_wacs_char[(unsigned char)'w']) +#define WACS_VLINE (&_wacs_char[(unsigned char)'x']) +#define WACS_BULLET (&_wacs_char[(unsigned char)'~']) +#define WACS_S3 (&_wacs_char[(unsigned char)'p']) +#define WACS_S7 (&_wacs_char[(unsigned char)'r']) +#define WACS_LEQUAL (&_wacs_char[(unsigned char)'y']) +#define WACS_GEQUAL (&_wacs_char[(unsigned char)'z']) +#define WACS_PI (&_wacs_char[(unsigned char)'{']) +#define WACS_NEQUAL (&_wacs_char[(unsigned char)'|']) +#define WACS_STERLING (&_wacs_char[(unsigned char)'}']) +#endif /* HAVE_WCHAR */ + +/* System V compatibility */ +#define ACS_SBBS ACS_LRCORNER +#define ACS_BBSS ACS_URCORNER +#define ACS_BSSB ACS_ULCORNER +#define ACS_SSBB ACS_LLCORNER +#define ACS_SSSS ACS_PLUS +#define ACS_BSBS ACS_HLINE +#define ACS_SSSB ACS_LTEE +#define ACS_SBSS ACS_RTEE +#define ACS_SSBS ACS_BTEE +#define ACS_BSSS ACS_TTEE +#define ACS_SBSB ACS_VLINE +#define _acs_map _acs_char +#define acs_map _acs_char + +/* + * Color definitions (ANSI color numbers) + */ + +#define COLOR_BLACK 0x00 +#define COLOR_RED 0x01 +#define COLOR_GREEN 0x02 +#define COLOR_YELLOW 0x03 +#define COLOR_BLUE 0x04 +#define COLOR_MAGENTA 0x05 +#define COLOR_CYAN 0x06 +#define COLOR_WHITE 0x07 + +#ifdef __cplusplus +#define __UINT32_CAST(a) static_cast(a) +#else +#define __UINT32_CAST(a) (uint32_t)(a) +#endif +#define COLOR_PAIR(n) (((__UINT32_CAST(n)) << 17) & A_COLOR) +#define PAIR_NUMBER(n) (((__UINT32_CAST(n)) & A_COLOR) >> 17) + +/* Curses external declarations. */ +extern WINDOW *curscr; /* Current screen. */ +extern WINDOW *stdscr; /* Standard screen. */ + +extern int __tcaction; /* If terminal hardware set. */ + +extern int COLS; /* Columns on the screen. */ +extern int LINES; /* Lines on the screen. */ +extern int COLORS; /* Max colors on the screen. */ +extern int COLOR_PAIRS; /* Max color pairs on the screen. */ + +extern int ESCDELAY; /* Delay between keys in esc seq's. */ +extern int TABSIZE; /* Size of a tab. */ + +#ifndef OK +#define ERR (-1) /* Error return. */ +#define OK (0) /* Success return. */ +#endif + +/* + * The following have, traditionally, been macros but X/Open say they + * need to be functions. Keep the old macros for debugging. + */ +#ifdef _CURSES_USE_MACROS +/* Standard screen pseudo functions. */ +#define addbytes(s, n) __waddbytes(stdscr, s, n, 0) +#define addch(ch) waddch(stdscr, ch) +#define addchnstr(s, n) waddchnstr(stdscr, s, n) +#define addchstr(s) waddchnstr(stdscr, s, -1) +#define addnstr(s, n) waddnstr(stdscr, s, n) +#define addstr(s) waddnstr(stdscr, s, -1) +#define attr_get(a, p, o) wattr_get(stdscr, a, p, o) +#define attr_off(a, o) wattr_off(stdscr, a, o) +#define attr_on(a, o) wattr_on(stdscr, a, o) +#define attr_set(a, p, o) wattr_set(stdscr, a, p, o) +#define attroff(attr) wattroff(stdscr, attr) +#define attron(attr) wattron(stdscr, attr) +#define attrset(attr) wattrset(stdscr, attr) +#define bkgd(ch) wbkgd(stdscr, ch) +#define bkgdset(ch) wbkgdset(stdscr, ch) +#define border(l, r, t, b, tl, tr, bl, br) \ + wborder(stdscr, l, r, t, b, tl, tr, bl, br) +#define clear() wclear(stdscr) +#define clrtobot() wclrtobot(stdscr) +#define clrtoeol() wclrtoeol(stdscr) +#define color_set(c, o) wcolor_set(stdscr, c, o) +#define delch() wdelch(stdscr) +#define deleteln() wdeleteln(stdscr) +#define echochar(c) wechochar(stdscr, c) +#define erase() werase(stdscr) +#define getch() wgetch(stdscr) +#define getnstr(s, n) wgetnstr(stdscr, s, n) +#define getstr(s) wgetstr(stdscr, s) +#define inch() winch(stdscr) +#define inchnstr(c) winchnstr(stdscr, c) +#define inchstr(c) winchstr(stdscr, c) +#define innstr(s, n) winnstr(stdscr, s, n) +#define insch(ch) winsch(stdscr, ch) +#define insdelln(n) winsdelln(stdscr, n) +#define insertln() winsertln(stdscr) +#define instr(s) winstr(stdscr, s) +#define move(y, x) wmove(stdscr, y, x) +#define refresh() wrefresh(stdscr) +#define scrl(n) wscrl(stdscr, n) +#define setscrreg(t, b) wsetscrreg(stdscr, t, b) +#define standend() wstandend(stdscr) +#define standout() wstandout(stdscr) +#define timeout(delay) wtimeout(stdscr, delay) +#define underscore() wunderscore(stdscr) +#define underend() wunderend(stdscr) +#define waddbytes(w, s, n) __waddbytes(w, s, n, 0) +#define waddstr(w, s) waddnstr(w, s, -1) + +/* Standard screen plus movement pseudo functions. */ +#define mvaddbytes(y, x, s, n) mvwaddbytes(stdscr, y, x, s, n) +#define mvaddch(y, x, ch) mvwaddch(stdscr, y, x, ch) +#define mvaddchnstr(y, x, s, n) mvwaddchnstr(stdscr, y, x, s, n) +#define mvaddchstr(y, x, s) mvwaddchstr(stdscr, y, x, s) +#define mvaddnstr(y, x, s, n) mvwaddnstr(stdscr, y, x, s, n) +#define mvaddstr(y, x, s) mvwaddstr(stdscr, y, x, s) +#define mvdelch(y, x) mvwdelch(stdscr, y, x) +#define mvgetch(y, x) mvwgetch(stdscr, y, x) +#define mvgetnstr(y, x, s, n) mvwgetnstr(stdscr, y, x, s, n) +#define mvgetstr(y, x, s) mvwgetstr(stdscr, y, x, s) +#define mvinch(y, x) mvwinch(stdscr, y, x) +#define mvinchnstr(y, x, c, n) mvwinchnstr(stdscr, y, x, c, n) +#define mvinchstr(y, x, c) mvwinchstr(stdscr, y, x, c) +#define mvinnstr(y, x, s, n) mvwinnstr(stdscr, y, x, s, n) +#define mvinsch(y, x, c) mvwinsch(stdscr, y, x, c) +#define mvinstr(y, x, s) mvwinstr(stdscr, y, x, s) +#define mvwaddbytes(w, y, x, s, n) \ + (wmove(w, y, x) == ERR ? ERR : __waddbytes(w, s, n, 0)) +#define mvwaddch(w, y, x, ch) \ + (wmove(w, y, x) == ERR ? ERR : waddch(w, ch)) +#define mvwaddchnstr(w, y, x, s, n) \ + (wmove(w, y, x) == ERR ? ERR : waddchnstr(w, s, n)) +#define mvwaddchstr(w, y, x, s) \ + (wmove(w, y, x) == ERR ? ERR : waddchnstr(w, s, -1)) +#define mvwaddnstr(w, y, x, s, n) \ + (wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, n)) +#define mvwaddstr(w, y, x, s) \ + (wmove(w, y, x) == ERR ? ERR : waddnstr(w, s, -1)) +#define mvwdelch(w, y, x) \ + (wmove(w, y, x) == ERR ? ERR : wdelch(w)) +#define mvwgetch(w, y, x) \ + (wmove(w, y, x) == ERR ? ERR : wgetch(w)) +#define mvwgetnstr(w, y, x, s, n) \ + (wmove(w, y, x) == ERR ? ERR : wgetnstr(w, s, n)) +#define mvwgetstr(w, y, x, s) \ + (wmove(w, y, x) == ERR ? ERR : wgetstr(w, s)) +#define mvwinch(w, y, x) \ + (wmove(w, y, x) == ERR ? ERR : winch(w)) +#define mvwinchnstr(w, y, x, c, n) \ + (wmove(w, y, x) == ERR ? ERR : winchnstr(w, c, n)) +#define mvwinchstr(w, y, x, s) \ + (wmove(w, y, x) == ERR ? ERR : winchstr(w, c)) +#define mvwinnstr(w, y, x, s, n) \ + (wmove(w, y, x) == ERR ? ERR : winnstr(w, s, n)) +#define mvwinsch(w, y, x, c) \ + (wmove(w, y, x) == ERR ? ERR : winsch(w, c)) +#define mvwinstr(w, y, x, s) \ + (wmove(w, y, x) == ERR ? ERR : winstr(w, s)) + +/* Miscellaneous. */ +#define noqiflush() intrflush(stdscr, FALSE) +#define qiflush() intrflush(stdscr, TRUE) + +#else +/* Use functions not macros... */ +int addbytes(const char *, int); +int addch(chtype); +int addchnstr(const chtype *, int); +int addchstr(const chtype *); +int addnstr(const char *, int); +int addstr(const char *); +int attr_get(attr_t *, short *, void *); +int attr_off(attr_t, void *); +int attr_on(attr_t, void *); +int attr_set(attr_t, short, void *); +int attroff(int); +int attron(int); +int attrset(int); +int bkgd(chtype); +void bkgdset(chtype); +int border(chtype, chtype, chtype, chtype, + chtype, chtype, chtype, chtype); +int clear(void); +int clrtobot(void); +int clrtoeol(void); +int color_set(short, void *); +int delch(void); +int deleteln(void); +int echochar(const chtype); +int erase(void); +int getch(void); +int getnstr(char *, int); +int getstr(char *); +chtype inch(void); +int inchnstr(chtype *, int); +int inchstr(chtype *); +int innstr(char *, int); +int insch(chtype); +int insdelln(int); +int insertln(void); +int instr(char *); +int move(int, int); +int refresh(void); +int scrl(int); +int setscrreg(int, int); +int standend(void); +int standout(void); +void timeout(int); +int underscore(void); +int underend(void); +int waddbytes(WINDOW *, const char *, int); +int waddstr(WINDOW *, const char *); + +/* Standard screen plus movement functions. */ +int mvaddbytes(int, int, const char *, int); +int mvaddch(int, int, chtype); +int mvaddchnstr(int, int, const chtype *, int); +int mvaddchstr(int, int, const chtype *); +int mvaddnstr(int, int, const char *, int); +int mvaddstr(int, int, const char *); +int mvdelch(int, int); +int mvgetch(int, int); +int mvgetnstr(int, int, char *, int); +int mvgetstr(int, int, char *); +chtype mvinch(int, int); +int mvinchnstr(int, int, chtype *, int); +int mvinchstr(int, int, chtype *); +int mvinnstr(int, int, char *, int); +int mvinsch(int, int, chtype); +int mvinstr(int, int, char *); + +int mvwaddbytes(WINDOW *, int, int, const char *, int); +int mvwaddch(WINDOW *, int, int, chtype); +int mvwaddchnstr(WINDOW *, int, int, const chtype *, int); +int mvwaddchstr(WINDOW *, int, int, const chtype *); +int mvwaddnstr(WINDOW *, int, int, const char *, int); +int mvwaddstr(WINDOW *, int, int, const char *); +int mvwdelch(WINDOW *, int, int); +int mvwgetch(WINDOW *, int, int); +int mvwgetnstr(WINDOW *, int, int, char *, int); +int mvwgetstr(WINDOW *, int, int, char *); +chtype mvwinch(WINDOW *, int, int); +int mvwinsch(WINDOW *, int, int, chtype); +#endif /* _CURSES_USE_MACROS */ + +#define getyx(w, y, x) (y) = getcury(w), (x) = getcurx(w) +#define getbegyx(w, y, x) (y) = getbegy(w), (x) = getbegx(w) +#define getmaxyx(w, y, x) (y) = getmaxy(w), (x) = getmaxx(w) +#define getparyx(w, y, x) (y) = getpary(w), (x) = getparx(w) + +#define getsyx(y, x) \ + do { \ + if (is_leaveok(curscr)) \ + (y) = (x) = -1; \ + else \ + getyx(curscr,(y), (x)); \ + } while(0 /* CONSTCOND */) +#define setsyx(y, x) \ + do { \ + if ((y) == -1 && (x) == -1) \ + leaveok(curscr, TRUE); \ + else { \ + leaveok(curscr, FALSE); \ + wmove(curscr, (y), (x)); \ + } \ + } while(0 /* CONSTCOND */) + + +/* Public functions. */ +int assume_default_colors(short, short); +int baudrate(void); +int beep(void); +int box(WINDOW *, chtype, chtype); +bool can_change_color(void); +int cbreak(void); +int clearok(WINDOW *, bool); +int color_content(short, short *, short *, short *); +int copywin(const WINDOW *, WINDOW *, int, int, int, int, int, int, int); +int curs_set(int); +int def_prog_mode(void); +int def_shell_mode(void); +int define_key(char *, int); +int delay_output(int); +void delscreen(SCREEN *); +int delwin(WINDOW *); +WINDOW *derwin(WINDOW *, int, int, int, int); +WINDOW *dupwin(WINDOW *); +int doupdate(void); +int echo(void); +int endwin(void); +char erasechar(void); +void filter(void); +int flash(void); +int flushinp(void); +int flushok(WINDOW *, bool); +char *fullname(const char *, char *); +chtype getattrs(WINDOW *); +chtype getbkgd(WINDOW *); +int getcury(WINDOW *); +int getcurx(WINDOW *); +int getbegy(WINDOW *); +int getbegx(WINDOW *); +int getmaxy(WINDOW *); +int getmaxx(WINDOW *); +int getpary(WINDOW *); +int getparx(WINDOW *); +int gettmode(void); +WINDOW *getwin(FILE *); +int halfdelay(int); +bool has_colors(void); +bool has_ic(void); +bool has_il(void); +int has_key(int); +int hline(chtype, int); +int idcok(WINDOW *, bool); +int idlok(WINDOW *, bool); +int immedok(WINDOW *, bool); +int init_color(short, short, short, short); +int init_pair(short, short, short); +WINDOW *initscr(void); +int intrflush(WINDOW *, bool); +bool isendwin(void); +bool is_linetouched(WINDOW *, int); +bool is_wintouched(WINDOW *); +bool is_term_resized(int, int); +int keyok(int, bool); +int keypad(WINDOW *, bool); +char *keyname(int); +char killchar(void); +int leaveok(WINDOW *, bool); +int meta(WINDOW *, bool); +int mvcur(int, int, int, int); +int mvderwin(WINDOW *, int, int); +int mvhline(int, int, chtype, int); +int mvprintw(int, int, const char *, ...) __printflike(3, 4); +int mvscanw(int, int, const char *, ...) __scanflike(3, 4); +int mvvline(int, int, chtype, int); +int mvwhline(WINDOW *, int, int, chtype, int); +int mvwvline(WINDOW *, int, int, chtype, int); +int mvwin(WINDOW *, int, int); +int mvwinchnstr(WINDOW *, int, int, chtype *, int); +int mvwinchstr(WINDOW *, int, int, chtype *); +int mvwinnstr(WINDOW *, int, int, char *, int); +int mvwinstr(WINDOW *, int, int, char *); +int mvwprintw(WINDOW *, int, int, const char *, ...) __printflike(4, 5); +int mvwscanw(WINDOW *, int, int, const char *, ...) __scanflike(4, 5); +int napms(int); +WINDOW *newpad(int, int); +SCREEN *newterm(char *, FILE *, FILE *); +WINDOW *newwin(int, int, int, int); +int nl(void); +attr_t no_color_attributes(void); +int nocbreak(void); +int nodelay(WINDOW *, bool); +int noecho(void); +int nonl(void); +void noqiflush(void); +int noraw(void); +int notimeout(WINDOW *, bool); +int overlay(const WINDOW *, WINDOW *); +int overwrite(const WINDOW *, WINDOW *); +int pair_content(short, short *, short *); +int pechochar(WINDOW *, const chtype); +int pnoutrefresh(WINDOW *, int, int, int, int, int, int); +int prefresh(WINDOW *, int, int, int, int, int, int); +int printw(const char *, ...) __printflike(1, 2); +int putwin(WINDOW *, FILE *); +void qiflush(void); +int raw(void); +int redrawwin(WINDOW *); +int reset_prog_mode(void); +int reset_shell_mode(void); +int resetty(void); +int resizeterm(int, int); +int resize_term(int, int); +int ripoffline(int, int (*)(WINDOW *, int)); +int savetty(void); +int scanw(const char *, ...) __scanflike(1, 2); +int scroll(WINDOW *); +int scrollok(WINDOW *, bool); +int setterm(char *); +int set_escdelay(int); +int set_tabsize(int); +SCREEN *set_term(SCREEN *); +int start_color(void); +WINDOW *subpad(WINDOW *, int, int, int, int); +WINDOW *subwin(WINDOW *, int, int, int, int); +int syncok(WINDOW *, bool); +chtype termattrs(void); +attr_t term_attrs(void); +int touchline(WINDOW *, int, int); +int touchoverlap(WINDOW *, WINDOW *); +int touchwin(WINDOW *); +int typeahead(int); +int ungetch(int); +int untouchwin(WINDOW *); +int use_default_colors(void); +void use_env(bool); +int vline(chtype, int); +int vw_printw(WINDOW *, const char *, __va_list) __printflike(2, 0); +int vw_scanw(WINDOW *, const char *, __va_list) __scanflike(2, 0); +int vwprintw(WINDOW *, const char *, __va_list) __printflike(2, 0); +int vwscanw(WINDOW *, const char *, __va_list) __scanflike(2, 0); +int waddch(WINDOW *, chtype); +int waddchnstr(WINDOW *, const chtype *, int); +int waddchstr(WINDOW *, const chtype *); +int waddnstr(WINDOW *, const char *, int); +int wattr_get(WINDOW *, attr_t *, short *, void *); +int wattr_off(WINDOW *, attr_t, void *); +int wattr_on(WINDOW *, attr_t, void *); +int wattr_set(WINDOW *, attr_t, short, void *); +int wattroff(WINDOW *, int); +int wattron(WINDOW *, int); +int wattrset(WINDOW *, int); +int wbkgd(WINDOW *, chtype); +void wbkgdset(WINDOW *, chtype); +int wborder(WINDOW *, chtype, chtype, chtype, chtype, chtype, chtype, + chtype, chtype); +int wclear(WINDOW *); +int wclrtobot(WINDOW *); +int wclrtoeol(WINDOW *); +int wcolor_set(WINDOW *, short, void *); +void wcursyncup(WINDOW *); +int wdelch(WINDOW *); +int wdeleteln(WINDOW *); +int wechochar(WINDOW *, const chtype); +int werase(WINDOW *); +int wgetch(WINDOW *); +int wgetnstr(WINDOW *, char *, int); +int wgetstr(WINDOW *, char *); +int whline(WINDOW *, chtype, int); +chtype winch(WINDOW *); +int winchnstr(WINDOW *, chtype *, int); +int winchstr(WINDOW *, chtype *); +int winnstr(WINDOW *, char *, int); +int winsch(WINDOW *, chtype); +int winsdelln(WINDOW *, int); +int winsertln(WINDOW *); +int winstr(WINDOW *, char *); +int wmove(WINDOW *, int, int); +int wnoutrefresh(WINDOW *); +int wprintw(WINDOW *, const char *, ...) __printflike(2, 3); +int wredrawln(WINDOW *, int, int); +int wrefresh(WINDOW *); +int wresize(WINDOW *, int, int); +int wscanw(WINDOW *, const char *, ...) __scanflike(2, 3); +int wscrl(WINDOW *, int); +int wsetscrreg(WINDOW *, int, int); +int wstandend(WINDOW *); +int wstandout(WINDOW *); +void wsyncdown(WINDOW *); +void wsyncup(WINDOW *); +void wtimeout(WINDOW *, int); +int wtouchln(WINDOW *, int, int, int); +int wunderend(WINDOW *); +int wunderscore(WINDOW *); +int wvline(WINDOW *, chtype, int); + +int insnstr(const char *, int); +int insstr(const char *); +int mvinsnstr(int, int, const char *, int); +int mvinsstr(int, int, const char *); +int mvwinsnstr(WINDOW *, int, int, const char *, int); +int mvwinsstr(WINDOW *, int, int, const char *); +int winsnstr(WINDOW *, const char *, int); +int winsstr(WINDOW *, const char *); + +int chgat(int, attr_t, short, const void *); +int wchgat(WINDOW *, int, attr_t, short, const void *); +int mvchgat(int, int, int, attr_t, short, const void *); +int mvwchgat(WINDOW *, int, int, int, attr_t, short, const void *); + +/* Soft Label Keys. */ +int slk_attroff(const chtype); +int slk_attr_off(const attr_t, void *); +int slk_attron(const chtype); +int slk_attr_on(const attr_t, void *); +int slk_attrset(const chtype); +int slk_attr_set(const attr_t, short, void *); +int slk_clear(void); +int slk_color(short); +int slk_init(int); +char *slk_label(int); +int slk_noutrefresh(void); +int slk_refresh(void); +int slk_restore(void); +int slk_set(int, const char *, int); +int slk_touch(void); +int slk_wset(int, const wchar_t *, int); + +/* wide-character support routines */ +/* return ERR when HAVE_WCHAR is not defined */ +/* add */ +int add_wch(const cchar_t *); +int wadd_wch(WINDOW *, const cchar_t *); +int mvadd_wch(int, int, const cchar_t *); +int mvwadd_wch(WINDOW *, int, int, const cchar_t *); + +int add_wchnstr(const cchar_t *, int); +int add_wchstr(const cchar_t *); +int wadd_wchnstr(WINDOW *, const cchar_t *, int); +int wadd_wchstr(WINDOW *, const cchar_t *); +int mvadd_wchnstr(int, int, const cchar_t *, int); +int mvadd_wchstr(int, int, const cchar_t *); +int mvwadd_wchnstr(WINDOW *, int, int, const cchar_t *, int); +int mvwadd_wchstr(WINDOW *, int, int, const cchar_t *); + +int addnwstr(const wchar_t *, int); +int addwstr(const wchar_t *); +int mvaddnwstr(int, int x, const wchar_t *, int); +int mvaddwstr(int, int x, const wchar_t *); +int mvwaddnwstr(WINDOW *, int, int, const wchar_t *, int); +int mvwaddwstr(WINDOW *, int, int, const wchar_t *); +int waddnwstr(WINDOW *, const wchar_t *, int); +int waddwstr(WINDOW *, const wchar_t *); + +int echo_wchar(const cchar_t *); +int wecho_wchar(WINDOW *, const cchar_t *); +int pecho_wchar(WINDOW *, const cchar_t *); + +/* insert */ +int ins_wch(const cchar_t *); +int wins_wch(WINDOW *, const cchar_t *); +int mvins_wch(int, int, const cchar_t *); +int mvwins_wch(WINDOW *, int, int, const cchar_t *); + +int ins_nwstr(const wchar_t *, int); +int ins_wstr(const wchar_t *); +int mvins_nwstr(int, int, const wchar_t *, int); +int mvins_wstr(int, int, const wchar_t *); +int mvwins_nwstr(WINDOW *, int, int, const wchar_t *, int); +int mvwins_wstr(WINDOW *, int, int, const wchar_t *); +int wins_nwstr(WINDOW *, const wchar_t *, int); +int wins_wstr(WINDOW *, const wchar_t *); + +/* input */ +int get_wch(wint_t *); +int unget_wch(const wchar_t); +int mvget_wch(int, int, wint_t *); +int mvwget_wch(WINDOW *, int, int, wint_t *); +int wget_wch(WINDOW *, wint_t *); + +int getn_wstr(wchar_t *, int); +int get_wstr(wchar_t *); +int mvgetn_wstr(int, int, wchar_t *, int); +int mvget_wstr(int, int, wchar_t *); +int mvwgetn_wstr(WINDOW *, int, int, wchar_t *, int); +int mvwget_wstr(WINDOW *, int, int, wchar_t *); +int wgetn_wstr(WINDOW *, wchar_t *, int); +int wget_wstr(WINDOW *, wchar_t *); + +int in_wch(cchar_t *); +int mvin_wch(int, int, cchar_t *); +int mvwin_wch(WINDOW *, int, int, cchar_t *); +int win_wch(WINDOW *, cchar_t *); + +int in_wchnstr(cchar_t *, int); +int in_wchstr(cchar_t *); +int mvin_wchnstr(int, int, cchar_t *, int); +int mvin_wchstr(int, int, cchar_t *); +int mvwin_wchnstr(WINDOW *, int, int, cchar_t *, int); +int mvwin_wchstr(WINDOW *, int, int, cchar_t *); +int win_wchnstr(WINDOW *, cchar_t *, int); +int win_wchstr(WINDOW *, cchar_t *); + +int innwstr(wchar_t *, int); +int inwstr(wchar_t *); +int mvinnwstr(int, int, wchar_t *, int); +int mvinwstr(int, int, wchar_t *); +int mvwinnwstr(WINDOW *, int, int, wchar_t *, int); +int mvwinwstr(WINDOW *, int, int, wchar_t *); +int winnwstr(WINDOW *, wchar_t *, int); +int winwstr(WINDOW *, wchar_t *); + +/* cchar handling */ +int setcchar(cchar_t *, const wchar_t *, const attr_t, short, const void *); +int getcchar(const cchar_t *, wchar_t *, attr_t *, short *, void *); + +/* misc */ +char *key_name( wchar_t ); +int border_set(const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *); +int wborder_set(WINDOW *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *, + const cchar_t *, const cchar_t *, const cchar_t *); +int box_set(WINDOW *, const cchar_t *, const cchar_t *); +int erasewchar(wchar_t *); +int killwchar(wchar_t *); +int hline_set(const cchar_t *, int); +int mvhline_set(int, int, const cchar_t *, int); +int mvvline_set(int, int, const cchar_t *, int); +int mvwhline_set(WINDOW *, int, int, const cchar_t *, int); +int mvwvline_set(WINDOW *, int, int, const cchar_t *, int); +int vline_set(const cchar_t *, int); +int whline_set(WINDOW *, const cchar_t *, int); +int wvline_set(WINDOW *, const cchar_t *, int); +int bkgrnd(const cchar_t *); +void bkgrndset(const cchar_t *); +int getbkgrnd(cchar_t *); +int wbkgrnd(WINDOW *, const cchar_t *); +void wbkgrndset(WINDOW *, const cchar_t *); +int wgetbkgrnd(WINDOW *, cchar_t *); + +/* ncurses window tests */ +bool is_keypad(const WINDOW *); +bool is_leaveok(const WINDOW *); +bool is_pad(const WINDOW *); + +/* ncurses mouse support */ +#define NB_MOUSE_MASK(b, m) ((m) << (((b) - 1) * 5)) +#define NB_BUTTON_RELEASED 001L +#define NB_BUTTON_PRESSED 002L +#define NB_BUTTON_CLICKED 004L +#define NB_DOUBLE_CLICKED 010L +#define NB_TRIPLE_CLICKED 020L +#define NB_RESERVED_EVENT 040L + +#define BUTTON1_RELEASED NB_MOUSE_MASK(1, NB_BUTTON_RELEASED) +#define BUTTON1_PRESSED NB_MOUSE_MASK(1, NB_BUTTON_PRESSED) +#define BUTTON1_CLICKED NB_MOUSE_MASK(1, NB_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NB_MOUSE_MASK(1, NB_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NB_MOUSE_MASK(1, NB_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NB_MOUSE_MASK(2, NB_BUTTON_RELEASED) +#define BUTTON2_PRESSED NB_MOUSE_MASK(2, NB_BUTTON_PRESSED) +#define BUTTON2_CLICKED NB_MOUSE_MASK(2, NB_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NB_MOUSE_MASK(2, NB_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NB_MOUSE_MASK(2, NB_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NB_MOUSE_MASK(3, NB_BUTTON_RELEASED) +#define BUTTON3_PRESSED NB_MOUSE_MASK(3, NB_BUTTON_PRESSED) +#define BUTTON3_CLICKED NB_MOUSE_MASK(3, NB_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NB_MOUSE_MASK(3, NB_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NB_MOUSE_MASK(3, NB_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NB_MOUSE_MASK(4, NB_BUTTON_RELEASED) +#define BUTTON4_PRESSED NB_MOUSE_MASK(4, NB_BUTTON_PRESSED) +#define BUTTON4_CLICKED NB_MOUSE_MASK(4, NB_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NB_MOUSE_MASK(4, NB_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NB_MOUSE_MASK(4, NB_TRIPLE_CLICKED) + +#define BUTTON5_RELEASED NB_MOUSE_MASK(5, NB_BUTTON_RELEASED) +#define BUTTON5_PRESSED NB_MOUSE_MASK(5, NB_BUTTON_PRESSED) +#define BUTTON5_CLICKED NB_MOUSE_MASK(5, NB_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NB_MOUSE_MASK(5, NB_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NB_MOUSE_MASK(5, NB_TRIPLE_CLICKED) + +#define BUTTON_CTRL NB_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NB_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NB_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NB_MOUSE_MASK(6, 0010L) +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) + +#define BUTTON_RELEASE(e, x) ((e) & NB_MOUSE_MASK(x, 001)) +#define BUTTON_PRESS(e, x) ((e) & NB_MOUSE_MASK(x, 002)) +#define BUTTON_CLICK(e, x) ((e) & NB_MOUSE_MASK(x, 004)) +#define BUTTON_DOUBLE_CLICK(e, x) ((e) & NB_MOUSE_MASK(x, 010)) +#define BUTTON_TRIPLE_CLICK(e, x) ((e) & NB_MOUSE_MASK(x, 020)) +#define BUTTON_RESERVED_EVENT(e, x) ((e) & NB_MOUSE_MASK(x, 040)) + +typedef unsigned long mmask_t; +typedef struct { + short id; /* ID to distinguish multiple devices */ + int x, y, z; /* event coordinates */ + mmask_t bstate; /* button state bits */ +} MEVENT; + +bool has_mouse(void); +int getmouse(MEVENT *); +int ungetmouse(MEVENT *); +mmask_t mousemask(mmask_t, mmask_t *); +bool wenclose(const WINDOW *, int, int); +bool mouse_trafo(int *, int *, bool); +bool wmouse_trafo(const WINDOW *, int *, int *, bool); +int mouseinterval(int); + +/* ncurses version for compat */ +const char *curses_version(void); + +/* Private functions that are needed for user programs prototypes. */ +int __cputchar(int); +int __waddbytes(WINDOW *, const char *, int, attr_t); +#ifdef HAVE_WCHAR +int __cputwchar(wchar_t); +#endif /* HAVE_WCHAR */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_CURSES_H_ */ diff --git a/vendor/netbsd-curses/libcurses/curses_addch.3 b/vendor/netbsd-curses/libcurses/curses_addch.3 new file mode 100644 index 0000000..e0825ef --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_addch.3 @@ -0,0 +1,187 @@ +.\" $NetBSD: curses_addch.3,v 1.10 2018/10/25 10:36:56 uwe Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd October 25, 2018 +.Dt CURSES_ADDCH 3 +.Os +.Sh NAME +.Nm curses_addch , +.Nm addch , +.Nm waddch , +.Nm mvaddch , +.Nm mvwaddch +.Nd curses add characters to windows routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn addch "chtype ch" +.Ft int +.Fn waddch "WINDOW *win" "chtype ch" +.Ft int +.Fn mvaddch "int y" "int x" "chtype ch" +.Ft int +.Fn mvwaddch "WINDOW *win" "int y" "int x" "chtype ch" +.Sh DESCRIPTION +These functions add characters to +.Dv stdscr +or to the specified window. +.Pp +The +.Fn addch +function adds the character given in +.Fa ch +to +.Dv stdscr +at the current cursor position and advances the current cursor position by one. +Any character attributes set in +.Fa ch +will be merged with the background attributes currently set on +.Dv stdscr . +.Pp +The +.Fn waddch +function is the same as the +.Fn addch +function, excepting that the character is added to the window specified by +.Fa win . +.Pp +The +.Fn mvaddch +and +.Fn mvwaddch +functions are the same as the +.Fn addch +and +.Fn waddch +functions, respectively, excepting that +.Fn wmove +is called to move the cursor to the position specified by +.Fa y , +.Fa x +before the character is added to the window. +.Ss LINE DRAWING CHARACTERS +Some terminals support the display of line drawing and graphics characters. +These characters can be added using their defined names, as shown in the +table below. +Where the terminal does not support a specific character, the default +(non-graphics) character is displayed instead. +.Bl -column -offset indent ".Sy System V Name" ".Sy Default" +.It Sy "Name" Ta Sy "Default" Ta Sy "Description" +.It ACS_RARROW Ta > Ta "Arrow pointing right" +.It ACS_LARROW Ta < Ta "Arrow pointing left" +.It ACS_UARROW Ta ^ Ta "Arrow pointing up" +.It ACS_DARROW Ta v Ta "Arrow pointing down" +.It ACS_BLOCK Ta # Ta "Solid square block" +.It ACS_DIAMOND Ta + Ta "Diamond" +.It ACS_CKBOARD Ta : Ta "Checker board (stipple)" +.It ACS_DEGREE Ta ' Ta "Degree symbol" +.It ACS_PLMINUS Ta # Ta "Plus/minus" +.It ACS_BOARD Ta # Ta "Board of squares" +.It ACS_LANTERN Ta # Ta "Lantern symbol" +.It ACS_LRCORNER Ta + Ta "Lower right-hand corner" +.It ACS_URCORNER Ta + Ta "Upper right-hand corner" +.It ACS_ULCORNER Ta + Ta "Upper left-hand corner" +.It ACS_LLCORNER Ta + Ta "Lower left-hand corner" +.It ACS_PLUS Ta + Ta "Plus" +.It ACS_HLINE Ta - Ta "Horizontal line" +.It ACS_S1 Ta - Ta "Scan line 1" +.It ACS_S9 Ta - Ta "Scan line 9" +.It ACS_LTEE Ta + Ta "Left tee" +.It ACS_RTEE Ta + Ta "Right tee" +.It ACS_BTEE Ta + Ta "Bottom tee" +.It ACS_TTEE Ta + Ta "Top tee" +.It ACS_VLINE Ta | Ta "Vertical line" +.It ACS_BULLET Ta o Ta "Bullet" +.El +.Pp +The following additional, +.Em ncurses +compatible, characters are also supported. +.Bl -column -offset indent ".Sy System V Name" ".Sy Default" +.It Sy "Name" Ta Sy "Default" Ta Sy "Description" +.It ACS_S3 Ta - Ta "Scan line 3" +.It ACS_S7 Ta - Ta "Scan line 7" +.It ACS_LEQUAL Ta < Ta "Less than or equal to" +.It ACS_GEQUAL Ta > Ta "Greater than or equal to" +.It ACS_PI Ta * Ta "Pi symbol" +.It ACS_NEQUAL Ta ! Ta "Not equal to" +.It ACS_STERLING Ta f Ta "Sterling symbol" +.El +.Pp +For compatibility with some +.Em System V +implementations, the following definitions are also supported. +.Bl -column -offset indent ".Sy System V Name" ".Sy Default" +.It Sy "System V Name" Ta Sy "NetBSD Curses Name" +.It ACS_SBBS Ta ACS_LRCORNER +.It ACS_BBSS Ta ACS_URCORNER +.It ACS_BSSB Ta ACS_ULCORNER +.It ACS_SSBB Ta ACS_LLCORNER +.It ACS_SSSS Ta ACS_PLUS +.It ACS_BSBS Ta ACS_HLINE +.It ACS_SSSB Ta ACS_LTEE +.It ACS_SBSS Ta ACS_RTEE +.It ACS_SSBS Ta ACS_BTEE +.It ACS_BSSS Ta ACS_TTEE +.It ACS_SBSB Ta ACS_VLINE +.El +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_addchstr 3 , +.Xr curses_addstr 3 , +.Xr curses_attributes 3 , +.Xr curses_cursor 3 , +.Xr curses_delch 3 , +.Xr curses_inch 3 , +.Xr curses_insch 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_addchstr.3 b/vendor/netbsd-curses/libcurses/curses_addchstr.3 new file mode 100644 index 0000000..82df0f2 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_addchstr.3 @@ -0,0 +1,155 @@ +.\" $NetBSD: curses_addchstr.3,v 1.3 2008/04/30 13:10:51 martin Exp $ +.\" +.\" Copyright (c) 2003 +.\" Douwe Kiela (virtus@wanadoo.nl) +.\" Copyright (c) 2003 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Douwe Kiela (virtus@wanadoo.nl). +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" +.Dd May 21, 2003 +.Dt CURSES_ADDCHSTR 3 +.Os +.Sh NAME +.Nm curses_addchstr , +.Nm addchstr , +.Nm waddchstr , +.Nm addchnstr , +.Nm waddchnstr , +.Nm mvaddchstr , +.Nm mvwaddchstr , +.Nm mvaddchnstr , +.Nm mvwaddchnstr +.Nd curses add character strings to windows routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn addchstr "const chtype *chstr" +.Ft int +.Fn waddchstr "WINDOW *win" "const chtype *chstr" +.Ft int +.Fn mvaddchstr "int y" "int x" "const chtype *chstr" +.Ft int +.Fn mvwaddchstr "WINDOW *win" "int y" "int x" "const chtype *chstr" +.Ft int +.Fn addchnstr "const chtype *chstr" "int n" +.Ft int +.Fn waddchnstr "WINDOW *win" "const chtype *chstr" "int n" +.Ft int +.Fn mvaddchnstr "int y" "int x" "const chtype *chstr" "int n" +.Ft int +.Fn mvwaddchnstr "WINDOW *win" "int y" "int x" "const chtype *chstr" "int n" +.Sh DESCRIPTION +These functions add character strings and attributes to +.Dv stdscr +or to the specified window. +.Pp +The +.Fn addchstr +function will add the characters and their attributes passed in +.Fa chstr +to +.Dv stdscr +starting at the current cursor position. +Any character attributes set in +.Fa chstr +will be merged with the background attributes currently set on +.Dv stdscr . +The +.Fn waddstr +function does the same as +.Fn addchstr +but adds the string to the window specified by +.Fn win . +.Pp +The +.Fn addchnstr +function will add the contents of +.Fa string +to +.Dv stdscr +but will limit the number of characters added to be, at most, +.Fa n . +If +.Fa n +is \-1 then +.Fa addchnstr +will add the number of characters contained in the null terminated string +.Fa chstr . +Any character attributes set in +.Fa chstr +will be merged with the background attributes currently set on +.Dv stdscr . +.Pp +The +.Fn waddchnstr +function does the same as +.Fa addchnstr +but adds the string to the window specified by +.Fa win . +.Pp +The functions +.Fn mvaddchstr , +.Fn mwaddchnstr , +.Fn mvwaddchstr +and +.Fn mvwaddchnstr +are the same as the functions +.Fn addchstr , +.Fn waddchstr , +.Fn waddchstr +and +.Fn waddchnstr , +respectively, except that +.Fn wmove +is called to move the cursor to the position specified by +.Fa y , +.Fa x +before the string is added to the window. +.Sh RETURN VALUES +The functions will return one of the following values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_addch 3 , +.Xr curses_addstr 3 , +.Xr curses_attributes 3 , +.Xr curses_cursor 3 , +.Xr curses_inch 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +These functions first appeared in +.Nx 2.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_addstr.3 b/vendor/netbsd-curses/libcurses/curses_addstr.3 new file mode 100644 index 0000000..febf66e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_addstr.3 @@ -0,0 +1,183 @@ +.\" $NetBSD: curses_addstr.3,v 1.7 2019/07/28 14:28:50 sevan Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd July 28, 2019 +.Dt CURSES_ADDSTR 3 +.Os +.Sh NAME +.Nm curses_addstr , +.Nm addstr , +.Nm addwstr , +.Nm waddstr , +.Nm waddwstr , +.Nm addnstr , +.Nm addnwstr , +.Nm waddnstr , +.Nm waddnwstr , +.Nm mvaddstr , +.Nm mvaddwstr , +.Nm mvwaddstr , +.Nm mvwaddwstr , +.Nm mvaddnstr , +.Nm mvaddnwstr , +.Nm mvwaddnstr , +.Nm mvwaddnwstr +.Nd curses add character strings to windows routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn addstr "const char *string" +.Ft int +.Fn addwstr "const wchar_t *string" +.Ft int +.Fn waddstr "WINDOW *win" "const char *string" +.Ft int +.Fn waddwstr "WINDOW *win" "const wchar_t *string" +.Ft int +.Fn mvaddstr "int y" "int x" "const char *string" +.Ft int +.Fn mvaddwstr "int y" "int x" "const wchar_t *string" +.Ft int +.Fn mvwaddstr "WINDOW *win" "int y" "int x" "const char *string" +.Ft int +.Fn mvwaddwstr "WINDOW *win" "int y" "int x" "const wchar_t *string" "int len" +.Ft int +.Fn addnstr "const char *string" "int len" +.Ft int +.Fn addnwstr "const wchar_t *string" "int len" +.Ft int +.Fn waddnstr "WINDOW *win" "const char *string" "int len" +.Ft int +.Fn waddnwstr "WINDOW *win" "const wchar_t *string" "int len" +.Ft int +.Fn mvaddnstr "int y" "int x" "const char *string" "int len" +.Ft int +.Fn mvaddnwstr "int y" "int x" "const wchar_t *string" "int len" +.Ft int +.Fn mvwaddnstr "WINDOW *win" "int y" "int x" "const char *string" "int len" +.Ft int +.Fn mvwaddnwstr "WINDOW *win" "int y" "int x" "const wchar_t *string" "int len" +.Sh DESCRIPTION +These functions add character strings to +.Dv stdscr +or to the specified window. +.Pp +The +.Fn addstr +function +will add the characters passed in +.Fa string +to +.Dv stdscr +starting at the current cursor position. +Any background attributes currently set on +.Dv stdscr +will be applied to the added character. +The +.Fn waddstr +function does the same as +.Fn addstr +but adds the string to the window specified by +.Fn win . +.Pp +The +.Fn addnstr +function will add the contents of +.Fa string +to +.Dv stdscr +but will limit the number of characters added to be, at most, +.Fa len . +If +.Fa len +is \-1 then +.Fa addnstr +will add the number of characters contained in the null terminated string +.Fa string . +Any background attributes currently set on +.Dv stdscr +will be applied to the added character. +The +.Fn waddnstr +function +does the same as +.Fa addnstr +but adds the string to the window specified by +.Fa win . +.Pp +The functions +.Fn mvaddstr , +.Fn mwaddnstr , +.Fn mvwaddstr +and +.Fn mvwaddnstr +are the same as the functions +.Fn addstr , +.Fn waddstr , +.Fn waddstr +and +.Fn waddnstr , +respectively, excepting that +.Fn wmove +is called to move the cursor to the position specified by +.Fa y , +.Fa x +before the string is added to the window. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_addch 3 , +.Xr curses_addchstr 3 , +.Xr curses_attributes 3 , +.Xr curses_cursor 3 , +.Xr curses_inch 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_attributes.3 b/vendor/netbsd-curses/libcurses/curses_attributes.3 new file mode 100644 index 0000000..4938891 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_attributes.3 @@ -0,0 +1,342 @@ +.\" $NetBSD: curses_attributes.3,v 1.9 2018/10/25 10:36:56 uwe Exp $ +.\" Copyright (c) 2002 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Julian Coleman. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 25, 2018 +.Dt CURSES_ATTRIBUTES 3 +.Os +.Sh NAME +.Nm curses_attributes , +.Nm attron , +.Nm attroff , +.Nm attrset , +.Nm color_set , +.Nm getattrs , +.Nm termattrs , +.Nm wattron , +.Nm wattroff , +.Nm wattrset , +.Nm wcolor_set , +.Nm attr_on , +.Nm attr_off , +.Nm attr_set , +.Nm attr_get , +.Nm term_attrs , +.Nm wattr_on , +.Nm wattr_off , +.Nm wattr_set , +.Nm wattr_get +.Nd curses general attribute manipulation routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn attron "int attr" +.Ft int +.Fn attroff "int attr" +.Ft int +.Fn attrset "int attr" +.Ft int +.Fn color_set "short pair" "void *opt" +.Ft chtype +.Fn getattrs "WINDOW *win" +.Ft chtype +.Fn termattrs "void" +.Ft int +.Fn wcolor_set "WINDOW *win" "short pair" "void *opt" +.Ft int +.Fn wattron "WINDOW * win" "int attr" +.Ft int +.Fn wattroff "WINDOW * win" "int attr" +.Ft int +.Fn wattrset "WINDOW * win" "int attr" +.Ft int +.Fn attr_on "attr_t attr" "void *opt" +.Ft int +.Fn attr_off "attr_t attr" "void *opt" +.Ft int +.Fn attr_set "attr_t attr" "short pair" "void *opt" +.Ft int +.Fn attr_get "attr_t *attr" "short *pair" "void *opt" +.Ft attr_t +.Fn term_attrs "void" +.Ft int +.Fn wattr_on "WINDOW *win" "attr_t attr" "void *opt" +.Ft int +.Fn wattr_off "WINDOW *win" "attr_t attr" "void *opt" +.Ft int +.Fn wattr_set "WINDOW *win" "attr_t attr" "short pair" "void *opt" +.Ft int +.Fn wattr_get "WINDOW *win" "attr_t *attr" "short *pair" "void *opt" +.Sh DESCRIPTION +These functions manipulate attributes on +.Dv stdscr +or on the specified window. +The attributes that can be manipulated are: +.Pp +.Bl -tag -width "COLOR_PAIR(n)" -compact -offset indent +.It A_NORMAL +no special attributes are applied +.It A_STANDOUT +characters are displayed in standout mode +.It A_UNDERLINE +characters are displayed underlined +.It A_REVERSE +characters are displayed in inverse video +.It A_BLINK +characters blink +.It A_DIM +characters are displayed at a lower intensity +.It A_BOLD +characters are displayed at a higher intensity +.It A_INVIS +characters are added invisibly +.It A_PROTECT +characters are protected from modification +.It A_ALTCHARSET +characters are displayed using the alternate character set (ACS) +.It COLOR_PAIR(n) +characters are displayed using color pair n. +.El +.Pp +The +.Fn attron +function turns on the attributes specified in +.Fa attr +on +.Dv stdscr , +while the +.Fn attroff +function turns off the attributes specified in +.Fa attr +on +.Dv stdscr . +.Pp +The function +.Fn attrset +sets the attributes of +.Dv stdscr +to those specified in +.Fa attr , +turning off any others. +To turn off all the attributes (including color and alternate character set), +use +.Fn attrset A_NORMAL . +.Pp +Multiple attributes can be manipulated by combining the attributes +using a logical +.Em OR . +For example, +.Fn attron "A_REVERSE | A_BOLD" +will turn on both inverse video and higher intensity. +.Pp +The function +.Fn color_set +sets the color pair attribute to the pair specified in +.Fa pair . +.Pp +The function +.Fn getattrs +returns the attributes that are currently applied to window specified by +.Fa win . +.Pp +The function +.Fn termattrs +returns the logical +.Em OR +of attributes that can be applied to the screen. +.Pp +The functions +.Fn wattron , +.Fn wattroff , +.Fn wattrset , +and +.Fn wcolor_set +are equivalent to +.Fn attron , +.Fn attroff +.Fn attrset , +and +.Fn color_set +respectively, excepting that the attributes are applied to the window +specified by +.Fa win . +.Pp +The following functions additionally manipulate wide attributes on +.Dv stdscr +or on the specified window. +The additional wide attributes that can be manipulated are: +.Pp +.Bl -tag -width "COLOR_PAIR(n)" -compact -offset indent +.It WA_STANDOUT +characters are displayed in standout mode +.It WA_UNDERLINE +characters are displayed underlined +.It WA_REVERSE +characters are displayed in inverse video +.It WA_BLINK +characters blink +.It WA_DIM +characters are displayed at a lower intensity +.It WA_BOLD +characters are displayed at a higher intensity +.It WA_INVIS +characters are added invisibly +.It WA_PROTECT +characters are protected from modification +.It WA_ALTCHARSET +characters are displayed using the alternate character set (ACS) +.It WA_LOW +characters are displayed with low highlight +.It WA_TOP +characters are displayed with top highlight +.It WA_HORIZONTAL +characters are displayed with horizontal highlight +.It WA_VERTICAL +characters are displayed with vertical highlight +.It WA_LEFT +characters are displayed with left highlight +.It WA_RIGHT +characters are displayed with right highlight +.El +.Pp +The +.Fn attr_on +function turns on the wide attributes specified in +.Fa attr +on +.Dv stdscr , +while the +.Fn attr_off +function turns off the wide attributes specified in +.Fa attr +on +.Dv stdscr . +.Pp +The function +.Fn attr_set +sets the wide attributes of +.Dv stdscr +to those specified in +.Fa attr +and +.Fa pair , +turning off any others. +Note that a color pair specified in +.Fa pair +will override any color pair specified in +.Fa attr . +.Pp +The function +.Fn attr_get +sets +.Fa attr +to the wide attributes and +.Fa pair +to the color pair currently applied to +.Dv stdscr . +Either of +.Fa attr +and +.Fa pair +can be +.Dv NULL , +if the relevant value is of no interest. +.Pp +The function +.Fn term_attrs +returns the logical +.Em OR +of wide attributes that can be applied to the screen. +.Pp +The functions +.Fn wattr_on , +.Fn wattr_off +and +.Fn wattr_set +are equivalent to +.Fn attr_on , +.Fn attr_off +and +.Fn attr_set +respectively, excepting that the character is added to the window specified by +.Fa win . +.Pp +The function +.Fn wattr_get +is equivalent to +.Fn attr_get , +excepting that the wide attributes and color pair currently applied to +.Fa win +are set. +.Pp +The following constants can be used to extract the components of a +.Dv chtype : +.Pp +.Bl -tag -width "COLOR_PAIR(n)" -compact -offset indent +.It A_ATTRIBUTES +bit-mask containing attributes part +.It A_CHARTEXT +bit-mask containing character part +.It A_COLOR +bit-mask containing color-pair part +.El +.Sh RETURN VALUES +These functions return OK on success and ERR on failure. +.Sh SEE ALSO +.Xr curses_addch 3 , +.Xr curses_addchstr 3 , +.Xr curses_addstr 3 , +.Xr curses_background 3 , +.Xr curses_color 3 , +.Xr curses_insch 3 , +.Xr curses_standout 3 , +.Xr curses_underscore 3 +.Sh NOTES +The +.Fa opt +argument is not currently used but is reserved for a future version of the +specification. +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Pp +The +.Fn getattrs +function +is a +.Nx +extension. +.Sh HISTORY +These functions first appeared in +.Nx 1.5 . +.Sh BUGS +Some terminals do not support characters with both color and other attributes +set. +In this case, the other attribute is displayed instead of the color attribute. diff --git a/vendor/netbsd-curses/libcurses/curses_background.3 b/vendor/netbsd-curses/libcurses/curses_background.3 new file mode 100644 index 0000000..5f0cccb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_background.3 @@ -0,0 +1,124 @@ +.\" $NetBSD: curses_background.3,v 1.7 2018/09/29 11:23:18 kamil Exp $ +.\" Copyright (c) 2002 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Julian Coleman. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 29, 2018 +.Dt CURSES_BACKGROUND 3 +.Os +.Sh NAME +.Nm curses_background , +.Nm bkgd , +.Nm bkgdset , +.Nm getbkgd , +.Nm wbkgd , +.Nm wbkgdset +.Nd curses attribute manipulation routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn bkgd chtype +.Ft void +.Fn bkgdset chtype +.Ft chtype +.Fn getbkgd "WINDOW *" +.Ft int +.Fn wbkgd "WINDOW *" chtype +.Ft void +.Fn wbkgdset "WINDOW *" chtype +.Sh DESCRIPTION +These functions manipulate the background attributes on +.Dv stdscr +or on the specified window. +.Pp +The function +.Fn wbkgdset win ch +sets the background attributes of the specified window +.Fa win +to +.Fa ch . +.Pp +When the background attributes are set on a window, characters are added to +the window with the logical +.Em OR +of the background attributes and the character's attributes. +If both the background attribute and the character attribute contain color, +the color of the character attribute is rendered. +If the background attribute contains a non-space character, then this +character is added where the foreground character is a space character. +.Pp +Note that subwindows created from +.Fa win +inherit the background attributes of +.Fa win . +.Pp +The function +.Fn wbkgd win ch +sets the background attributes of the specified window +.Fa win +to +.Fa ch +and also sets the rendition of every character position on that window, +as if the characters had been newly added to +.Fa win . +The rendition of characters on subwindows of +.Fa win +is also set to +.Fa ch . +.Pp +The functions +.Fn bkgdset ch +and +.Fn bkgd ch +are equivalent to +.Fn wbkgdset stdscr ch +and +.Fn wbkgd stdscr ch , +respectively. +.Pp +The function +.Fn getbkgd win +returns the background attributes for the window +.Fa win . +.Sh RETURN VALUES +The functions +.Fn wbkgdset +and +.Fn wbkgd +return OK on success and ERR on failure. +.Sh SEE ALSO +.Xr curses_attributes 3 , +.Xr curses_color 3 , +.Xr curses_window 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +These functions first appeared in +.Nx 1.6 . diff --git a/vendor/netbsd-curses/libcurses/curses_border.3 b/vendor/netbsd-curses/libcurses/curses_border.3 new file mode 100644 index 0000000..25098e2 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_border.3 @@ -0,0 +1,159 @@ +.\" $NetBSD: curses_border.3,v 1.4 2004/03/16 19:20:20 snj Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd August 12, 2002 +.Dt CURSES_BORDER 3 +.Os +.Sh NAME +.Nm curses_border , +.Nm border , +.Nm box , +.Nm wborder +.Nd curses border drawing routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fo border +.Fa "chtype ls" +.Fa "chtype rs" +.Fa "chtype ts" +.Fa "chtype bs" +.Fa "chtype tl" +.Fa "chtype tr" +.Fa "chtype bl" +.Fa "chtype br" +.Fc +.Ft int +.Fn box "WINDOW *win" "chtype vertical" "chtype horizontal" +.Ft int +.Fo wborder +.Fa "WINDOW *win" +.Fa "chtype ls" +.Fa "chtype rs" +.Fa "chtype ts" +.Fa "chtype bs" +.Fa "chtype tl" +.Fa "chtype tr" +.Fa "chtype bl" +.Fa "chtype br" +.Fc +.Sh DESCRIPTION +These functions draw borders around +.Dv stdscr +or around the specified window. +.Pp +The +.Fn border +function draws a border around +.Dv stdscr +using the characters given as arguments to the function. +The +.Fa ls , +.Fa rs , +.Fa ts +and +.Fa bs +are the characters used to draw the left, right, top and bottom sides, +respectively. +The +.Fa tl , +.Fa tr , +.Fa bl +and +.Fa br +are the characters used to draw the top-left, top-right, bottom-left +and bottom-right corners, respectively. +If any of the characters have a text portion that is 0 then a default +alternate character set character is used for that character. +Note that even though the text portion of the argument is 0, the argument +can still be used to specify the attributes for that portion of the border. +The following table shows the default characters for each argument: +.Pp +.Bl -column "ls" -offset indent +.It ls ACS_VLINE +.It rs ACS_VLINE +.It ts ACS_HLINE +.It bs ACS_HLINE +.It tl ACS_ULCORNER +.It tr ACS_URCORNER +.It bl ACS_LLCORNER +.It br ACS_LRCORNER +.El +.Pp +.Fn wborder +is the same as +.Fn border +excepting that the border is drawn around the specified window. +.Pp +The +.Fn box +command draws a box around the window given in +.Fa win +using the +.Fa vertical +character for the vertical lines and the +.Fa horizontal +character for the horizontal lines. +The corner characters of this box will be the defaults as described for +.Fn border +above. +Passing characters with text portion that is 0 to +.Fn box +will result in the same defaults as those for +.Fn border +as described above. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_attributes 3 , +.Xr curses_line 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_cchar.3 b/vendor/netbsd-curses/libcurses/curses_cchar.3 new file mode 100644 index 0000000..9ce2ec4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_cchar.3 @@ -0,0 +1,154 @@ +.\" $NetBSD: curses_cchar.3,v 1.2 2018/11/24 11:04:39 wiz Exp $ +.\" +.\" Copyright (c) 2018 Valery Ushakov +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd November 19, 2018 +.Dt CURSES_CCHAR 3 +.Os +.Sh NAME +.Nm curses_cchar , +.Nm getcchar , +.Nm setcchar +.Nd curses representation of wide characters +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.\" +.In curses.h +.\" +.Ft int +.Fo getcchar +.Fa "const cchar_t *wcval" +.Fa "wchar_t *wch" +.Fa "attr_t *attrs" +.Fa "short *color_pair" +.Fa "void *opts" +.Fc +.\" +.Ft int +.Fo setcchar +.Fa "cchar_t *wcval" +.Fa "const wchar_t *wch" +.Fa "const attr_t attrs" +.Fa "short color_pair" +.Fa "const void *opts" +.Fc +.Sh DESCRIPTION +Curses uses the opaque type +.Vt cchar_t +to represent a string of wide characters up to an +implementation-dependent length along with a color pair and zero or +more attributes. +A null +.Vt cchar_t +object is an object that references an empty wide-character string. +Arrays of +.Vt cchar_t +objects are terminated by a null +.Vt cchar_t +object. +.Pp +Objects of type +.Vt cchar_t +can be manipulated using the +.Nm getcchar +and +.Nm setcchar +functions. +Both these functions take as their last parameter the +.Fa opts +argument which is reserved for future extensions. +Currently, the application must provide a null pointer as +.Fa opts . +.\" +.Pp +When the +.Nm getcchar +function is called with non-null +.Fa wch +it extracts the information from the +.Fa wcval +object. +The string of wide characters in +.Fa wcval +is copied to the +.Fa wch +array. +The attributes are stored in +.Fa attrs +and the color pair is stored in +.Fa color_pair . +In this case it returns +.Er OK +upon successful completion, and +.Er ERR +otherwise. +.Pp +When +.Nm getcchar +is called with null +.Fa wch +it doesn't store any information but returns the number of wide +characters referenced by +.Fa wcval , +including the null terminator. +.\" +.Pp +.Nm setcchar +initializes +.Fa wcval +with the wide-character string +.Fa wch , +attributes +.Fa attrs , +and color pair +.Fa color_pair . +.Sh RETURN VALUES +.Nm getchar +called with null +.Fa wch +returns the the number of wide characters referenced by +.Fa wcval , +including the null terminator. +.Pp +Otherwise these functions return one of the following values: +.Bl -tag -width "Er ERR" -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.\" .Sh SEE ALSO +.\" XXX no other man pages yet for HAVE_WCHAR functions +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of +the Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . +.Pp +Wide characters support appeared in +.Nx 5.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_chgat.3 b/vendor/netbsd-curses/libcurses/curses_chgat.3 new file mode 100644 index 0000000..db726ef --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_chgat.3 @@ -0,0 +1,119 @@ +.\" $NetBSD: curses_chgat.3,v 1.5 2011/02/10 08:54:12 blymn Exp $ +.\" +.\" Copyright (c) 2009 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Joerg Sonnenberger. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd July 6, 2009 +.Dt CURSES_CHGAT 3 +.Os +.Sh NAME +.Nm chgat , +.Nm wchgat , +.Nm mvchgat , +.Nm mvwchgat +.Nd curses on-screen attribute manipulation routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn chgat "int n" "attr_t attr" "short color" "const void *opts" +.Ft int +.Fn wchgat "WINDOW *win" "int n" "attr_t attr" "short color" \ +"const void *opts" +.Ft int +.Fn mvchgat "int y" "int x" "int n" "attr_t attr" "short color" \ +"const void *opts" +.Ft int +.Fn mvwchgat "WINDOW *win" "int y" "int x" "int n" "attr_t attr" \ +"short color" "const void *opts" +.Sh DESCRIPTION +These functions modify the attributes of the drawn content on stdscr or +on the specified window. +.Pp +The +.Fn chgat +function sets the attributes of the next +.Fa n +characters to +.Fa attr +and the color pair to +.Fa color . +If +.Fa n +is negative or larger than the remainder of the line, it gets truncated. +.Pp +The +.Fn wchgat +is the same as the +.Fn chgat +function, excepting that the attributes are changed in the window specified by +.Fa win . +.Pp +The +.Fn mvchgat +and +.Fn mvwchgat +functions are the same as the +.Fn chgat +and +.Fn wchgat +functions, respectively, excepting that they operate from the position +specified by +.Fa y , +.Fa x . +.Pp +These functions do not perform wrapping. +They do not update the cursor position. +.Sh RETURN VALUES +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_attributes 3 +.Sh STANDARDS +The +.Fn chgat , +.Fn wchgat , +.Fn mvchgat , +and +.Fn mvwchgat +functions conform to +.St -xcurses4.2 . +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . +Support for the +.Fn chgat +family was added in +.Nx 6.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_clear.3 b/vendor/netbsd-curses/libcurses/curses_clear.3 new file mode 100644 index 0000000..f5c9c70 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_clear.3 @@ -0,0 +1,148 @@ +.\" $NetBSD: curses_clear.3,v 1.4 2019/01/11 06:14:39 dholland Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd January 11, 2019 +.Dt CURSES_CLEAR 3 +.Os +.Sh NAME +.Nm curses_clear , +.Nm clear , +.Nm wclear , +.Nm clearok , +.Nm clrtobot , +.Nm clrtoeol , +.Nm erase , +.Nm werase , +.Nm wclrtobot , +.Nm wclrtoeol +.Nd curses clear window routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn clear "void" +.Ft int +.Fn clearok "WINDOW *win" "bool flag" +.Ft int +.Fn clrtobot "void" +.Ft int +.Fn clrtoeol "void" +.Ft int +.Fn erase "void" +.Ft int +.Fn wclear "WINDOW *win" +.Ft int +.Fn werase "WINDOW *win" +.Ft int +.Fn wclrtobot "WINDOW *win" +.Ft int +.Fn wclrtoeol "WINDOW *win" +.Sh DESCRIPTION +These functions clear all or part of +.Dv stdscr +or of the specified window. +.Pp +The +.Fn clear +and +.Fn erase +functions erase all characters on +.Dv stdscr . +These differ in that +.Fn clear +uses +.Fn clearok +to force a complete redraw on the next refresh, and +.Fn erase +does not. +.Fn wclear +and +.Fn werase +perform the same function as +.Fn clear +and +.Fn erase , +respectively, excepting that the specified window is cleared. +.Pp +By setting +.Fa flag +to +.Dv TRUE , +the +.Fn clearok +function is used to force the next call to +.Fn wrefresh +to clear and completely redraw the window given in +.Fa win . +.Pp +The function +.Fn clrtobot +will clear +.Dv stdscr +from the current row to the bottom of the screen. +.Fn clrtoeol +will clear +.Dv stdscr +from the current column position to the end of the line. +.Fn wclrtobot +and +.Fn wclrtoeol +are the same as +.Fn clrtobot +and +.Fn clrtoeol , +respectively, excepting the window specified is operated on instead of +.Dv stdscr . +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_refresh 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_color.3 b/vendor/netbsd-curses/libcurses/curses_color.3 new file mode 100644 index 0000000..7278c95 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_color.3 @@ -0,0 +1,232 @@ +.\" $NetBSD: curses_color.3,v 1.13 2017/07/03 21:32:50 wiz Exp $ +.\" Copyright (c) 2002 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Julian Coleman. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd July 20, 2009 +.Dt CURSES_COLOR 3 +.Os +.Sh NAME +.Nm curses_color , +.Nm has_colors , +.Nm can_change_color , +.Nm start_color , +.Nm init_pair , +.Nm pair_content , +.Nm COLOR_PAIR , +.Nm PAIR_NUMBER , +.Nm init_color , +.Nm color_content , +.Nm no_color_attributes +.Nd curses color manipulation routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft bool +.Fn has_colors void +.Ft bool +.Fn can_change_color void +.Ft int +.Fn start_color void +.Ft int +.Fn init_pair "short pair" "short fore" "short back" +.Ft int +.Fn pair_content "short pair" "short *fore" "short *back" +.Ft int +.Fn COLOR_PAIR "int n" +.Ft int +.Fn PAIR_NUMBER "int val" +.Ft int +.Fn init_color "short color" "short red" "short green" "short blue" +.Ft int +.Fn color_content "short color" "short *red" "short *green" "short *blue" +.Ft attr_t +.Fn no_color_attributes void +.Pp +.Va extern int COLOR_PAIRS ; +.Pp +.Va extern int COLORS ; +.Sh DESCRIPTION +These functions manipulate color on terminals that support color attributes. +.Pp +The function +.Fn has_colors +indicates whether a terminal is capable of displaying color attributes. +It returns +.Dv TRUE +if the terminal is capable of displaying color attributes and +.Dv FALSE +otherwise. +.Pp +The function +.Fn can_change_color +indicates whether a terminal is capable of redefining colors. +It returns +.Dv TRUE +if colors can be redefined and +.Dv FALSE +if they can not. +.Pp +The function +.Fn start_color +initializes the curses color support on a terminal. +It must be called before any color manipulation functions are called on that +terminal. +The function initializes the eight basic colors (black, red, green, yellow, +blue, magenta, cyan and white) that are specified using the color macros +(such as +.Dv COLOR_BLACK ) +defined in +.Em . +.Fn start_color +also initializes the global external variables +.Va COLORS +and +.Va COLOR_PAIRS . +.Va COLORS +defines the number of colors that the terminal supports and +.Va COLOR_PAIRS +defines the number of color-pairs that the terminal supports. +These color-pairs are initialized to white foreground on black background. +.Fn start_color +sets the colors on the terminal to the curses defaults of white +foreground on black background unless the functions +.Fn assume_default_colors +or +.Fn use_default_colors +have been called previously. +.Pp +The function +.Fn init_pair pair fore back +sets foreground color +.Fa fore +and background color +.Fa back +for color-pair number +.Fa pair . +The valid range for the color-pair +.Fa pair +is from 1 to +.Va COLOR_PAIRS +\&- 1 +and the valid range for the colors is any number less than +.Va COLORS . +Specifying a negative number will set that color to the default foreground +or background color. +The 8 initial colors are defined as: +.Bl -tag -width "COLOR_MAGENTA" -compact -offset indent +.It COLOR_BLACK +.It COLOR_RED +.It COLOR_GREEN +.It COLOR_YELLOW +.It COLOR_BLUE +.It COLOR_MAGENTA +.It COLOR_CYAN +.It COLOR_WHITE +.El +Color-pair 0 is used as the default color pair, so changing this will +have no effect. +Use the function +.Fn assume_default_colors +to change the default colors. +.Pp +The function +.Fn pair_content pair *fore *back +stores the foreground and background color numbers of color-pair +.Fa pair +in the variables +.Fa fore +and +.Fa back , +respectively. +.Pp +The macro +.Fn COLOR_PAIR n +gives the attribute value of color-pair number +.Fa n . +This is the value that is used to set the attribute of a character to this +color-pair. +For example, +.Dl attrset(COLOR_PAIR(2)) +will display characters using color-pair 2. +.Pp +The macro +.Fn PAIR_NUMBER val +gives the color-pair number associated with the attribute value +.Fa val . +.Pp +The function +.Fn init_color color red green blue +sets the red, green and blue intensity components of color +.Fa color +to the values +.Fa red , +.Fa green +and +.Fa blue , +respectively. +The minimum intensity value is 0 and the maximum intensity value is 1000. +.Pp +The function +.Fn color_content color *red *green *blue +stores the red, green and blue intensity components of color +.Fa color +in the variables +.Fa red , +.Fa green , +and +.Fa blue , +respectively. +.Pp +The function +.Fn no_color_attributes +returns those attributes that a terminal is unable to combine with color. +.Sh RETURN VALUES +The functions +.Fn start_color , +.Fn init_pair , +.Fn pair_content , +.Fn init_color +and +.Fn color_content +return OK on success and ERR on failure. +.Sh SEE ALSO +.Xr curses_attributes 3 , +.Xr curses_background 3 , +.Xr curses_default_colors 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Pp +The function +.Fn no_color_attributes +and the use of negative color numbers +are extensions to the X/Open Curses specification. +.Sh HISTORY +These functions first appeared in +.Nx 1.5 . diff --git a/vendor/netbsd-curses/libcurses/curses_cursor.3 b/vendor/netbsd-curses/libcurses/curses_cursor.3 new file mode 100644 index 0000000..2dcd301 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_cursor.3 @@ -0,0 +1,261 @@ +.\" $NetBSD: curses_cursor.3,v 1.9 2017/01/05 09:46:32 wiz Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd December 31, 2016 +.Dt CURSES 3 +.Os +.Sh NAME +.Nm curses_cursor , +.Nm getcury , +.Nm getcurx , +.Nm getsyx , +.Nm getyx , +.Nm getbegy , +.Nm getbegx , +.Nm getbegyx , +.Nm getmaxy , +.Nm getmaxx , +.Nm getmaxyx , +.Nm getpary , +.Nm getparx , +.Nm getparyx , +.Nm move , +.Nm setsyx , +.Nm wmove , +.Nm mvcur , +.Nm wcursyncup +.Nd curses cursor and window location and positioning routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn getcury "WINDOW *win" +.Ft int +.Fn getcurx "WINDOW *win" +.Ft int +.Fn getsyx "int y" "int x" +.Ft void +.Fn getyx "WINDOW *win" "int y" "int x" +.Ft int +.Fn getbegy "WINDOW *win" +.Ft int +.Fn getbegx "WINDOW *win" +.Ft void +.Fn getbegyx "WINDOW *win" "int y" "int x" +.Ft int +.Fn getmaxy "WINDOW *win" +.Ft int +.Fn getmaxx "WINDOW *win" +.Ft void +.Fn getmaxyx "WINDOW *win" "int y" "int x" +.Ft int +.Fn getpary "WINDOW *win" +.Ft int +.Fn getparx "WINDOW *win" +.Ft void +.Fn getparyx "WINDOW *win" "int y" "int x" +.Ft int +.Fn move "int y" "int x" +.Ft int +.Fn setsyx "int y" "int x" +.Ft int +.Fn wmove "WINDOW *win" "int y" "int x" +.Ft int +.Fn mvcur "int oldy" "int oldx" "int y" "int x" +.Ft void +.Fn wcursyncup "WINDOW *win" +.Sh DESCRIPTION +These functions and macros locate and position cursors and windows. +.Pp +The +.Fn getcury +and +.Fn getcurx +functions get the current row and column positions, respectively, of the cursor in +the window +.Fa win . +The +.Fn getyx +macro sets the values of +.Fa y +and +.Fa x +to the current row and column positions of the cursor in the window +.Fa win . +.Pp +The +.Fn getsyx +macro sets the values of +.Fa y +and +.Fa x +of the current window if +.Fn is_leaveok +is false, otherwise \-1, \-1. +The +.Fn setsyx +macro sets the row and column positions, respectively, of the cursor in the +current window to the values of +.Fa y +and +.Fa x . +If both +.Fa y +and +.Fa x +are both \-1 then +.Fn leaveok +is set. +.Pp +The origin row and columns of a window +.Fa win +can be +determined by calling the +.Fn getbegy +and +.Fn getbegx +functions, respectively, and the maximum row and column for the window can be +found by calling the functions +.Fn getmaxy +and +.Fn getmaxx , +respectively. +The +.Fn getbegyx +and +.Fn getmaxyx +macros set the values of +.Fa y +and +.Fa x +to the origin and maximum row and column positions, respectively, for the window +.Fa win . +.Pp +The +.Fn getpary +and +.Fn getparx +functions return the row and column position of the given subwindow relative to +the window's parent. +The macro +.Fn getparyx +sets the values of +.Fa y +and +.Fa x +to the origin of the subwindow relative to the window's parent. +.Pp +The +.Fn move +function positions the cursor on the current window at the position given by +.Fa y , +.Fa x . +The cursor position is not changed on the screen until the next +.Fn refresh . +.Pp +The +.Fn wmove +function is the same as the +.Fn move +function, excepting that the cursor is moved in the window specified by +.Fa win . +.Pp +The function +.Fn mvcur +moves the cursor to +.Fa y , +.Fa x +on the screen. +The arguments +.Fa oldy , +.Fa oldx +define the previous cursor position for terminals that do not support +absolute cursor motions. +The curses library may optimise the cursor motion based on these values. +If the +.Fn mvcur +succeeds then the curses internal structures are updated with the new +position of the cursor. +If the destination arguments for +.Fn mvcur +exceed the terminal bounds an error will be returned and the cursor +position will be unchanged. +.Pp +The +.Fn wcursyncup +function sets the cursor positions of all ancestors of +.Fa win +to that of +.Fa win . +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_refresh 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of +the Single Unix Specification. +The +.Fn getbegx , +.Fn getbegy , +.Fn getcurx , +.Fn getcury , +.Fn getmaxx , +.Fn getmaxy , +.Fn getparx , +and +.Fn getpary +functions are extensions. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . +The +.Fn getsyx +and +.Fn setsyx +functions are +.Em ncurses +extensions to the Curses library and were added in +.Nx 8.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_default_colors.3 b/vendor/netbsd-curses/libcurses/curses_default_colors.3 new file mode 100644 index 0000000..2efd8c3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_default_colors.3 @@ -0,0 +1,73 @@ +.\" $NetBSD: curses_default_colors.3,v 1.6 2008/04/30 13:10:51 martin Exp $ +.\" Copyright (c) 2002 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Julian Coleman. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 13, 2002 +.Dt CURSES_DEFAULT_COLORS 3 +.Os +.Sh NAME +.Nm curses_default_colors , +.Nm assume_default_colors , +.Nm use_default_colors +.Nd curses default colors setting routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn assume_default_colors "short fore" "short back" +.Ft int +.Fn use_default_colors "" +.Sh DESCRIPTION +These functions tell the curses library to set the default colors or to use +the terminal's default colors instead of using the default colors for curses +applications (which are white foreground on black background). +.Pp +The function +.Fn assume_default_colors fore back +sets the default colors to foreground color +.Fa fore +and background color +.Fa back . +If a value of \-1 is used for a color, then the terminal default color is used +for that color. +.Pp +The function +.Fn use_default_colors +sets both the foreground and background colors to the terminal default colors. +This is equivalent to +.Fn assume_default_colors \-1 \-1 . +.Sh RETURN VALUES +These functions return OK on success and ERR on failure. +.Sh SEE ALSO +.Xr curses_color 3 +.Sh STANDARDS +These functions are based on +.Em ncurses +extensions to the curses standards. +.Sh HISTORY +These functions first appeared in +.Nx 2.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_delch.3 b/vendor/netbsd-curses/libcurses/curses_delch.3 new file mode 100644 index 0000000..364fcb4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_delch.3 @@ -0,0 +1,90 @@ +.\" $NetBSD: curses_delch.3,v 1.4 2018/10/25 10:36:56 uwe Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd October 25, 2018 +.Dt CURSES_DELCH 3 +.Os +.Sh NAME +.Nm curses_delch , +.Nm delch , +.Nm wdelch +.Nd curses delete characters routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn delch "void" +.Ft int +.Fn wdelch "WINDOW *win" +.Sh DESCRIPTION +These functions delete characters from +.Dv stdscr +or from the specified window. +.Pp +The +.Fn delch +function deletes the character at the current cursor position on +.Dv stdscr . +Characters to the right of the deleted character are moved one position +to the left. +The cursor position is unchanged. +.Pp +The +.Fn wdelch +function is the same as the +.Fn delch +function, excepting that the character is deleted from the specified window. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_addch 3 , +.Xr curses_insch 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_deleteln.3 b/vendor/netbsd-curses/libcurses/curses_deleteln.3 new file mode 100644 index 0000000..c0324be --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_deleteln.3 @@ -0,0 +1,110 @@ +.\" $NetBSD: curses_deleteln.3,v 1.4 2003/04/16 13:35:01 wiz Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd August 12, 2002 +.Dt CURSES_DELETELN 3 +.Os +.Sh NAME +.Nm curses_deleteln , +.Nm deleteln , +.Nm wdeleteln +.Nd curses delete single line routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn deleteln "void" +.Ft int +.Fn wdeleteln "WINDOW *win" +.Sh DESCRIPTION +These functions delete a single line from +.Dv stdscr +or from the specified window. +.Pp +The +.Fn deleteln +function deletes the screen line containing the cursor in the +.Dv stdscr . +The +.Fn wdeleteln +function is the same as the +.Fn deleteln +function, excepting that the line is deleted from the window specified by +.Fa win . +.Pp +All lines following the deleted line are moved up one line toward the cursor. +The last line of the window is cleared. +The cursor position is unchanged. +.Pp +If a scrolling region has been set with the +.Fn setscrreg +or +.Fn wsetscrreg +functions and the current cursor position is inside the scrolling region, +then only the lines from the current line to the bottom of the scrolling +region are moved up and the bottom line of the scrolling region cleared. +.Pp +The functions +.Fn deleteln +and +.Fn wdeleteln win +are equivalent to +.Fn winsdelln stdscr \-1 +and +.Fn winsdelln win \-1 +respectively. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_insdelln 3 , +.Xr curses_insertln 3 , +.Xr curses_scroll 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_echochar.3 b/vendor/netbsd-curses/libcurses/curses_echochar.3 new file mode 100644 index 0000000..d2f8d4f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_echochar.3 @@ -0,0 +1,123 @@ +.\" $NetBSD: curses_echochar.3,v 1.3 2008/04/30 13:10:51 martin Exp $ +.\" Copyright (c) 2004 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Julian Coleman. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd March 27, 2004 +.Dt CURSES_ECHOCHAR 3 +.Os +.Sh NAME +.Nm curses_echochar , +.Nm echochar , +.Nm wechochar , +.Nm pechochar +.Nd curses add characters and then refresh routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn echochar "const chtype ch" +.Ft int +.Fn wechochar "WINDOW *win" "const chtype ch" +.Ft int +.Fn pechochar "WINDOW *pad" "const chtype ch" +.Sh DESCRIPTION +These functions add characters to +.Dv stdscr +or to the specified window or pad and then cause an immediate +.Fn refresh +of that window or pad. +.Pp +The +.Fn echochar +function adds the character given in +.Fa ch +to +.Dv stdscr +at the current cursor position and advances the current cursor position by one. +Any character attributes set in +.Fa ch +will be merged with the background attributes currently set on +.Dv stdscr . +.Dv stdscr +is then refreshed. +Calling +.Fn echochar +is equivalent to calling +.Fn addch +followed by +.Fn refresh . +.Pp +The +.Fn wechochar +function is the same as the +.Fn echochar +function, excepting that the character is added to the window specified by +.Fa win +and +.Fa win +is refreshed. +.Pp +The +.Fn pechochar +function is the similar to the +.Fn echochar +function, excepting that the character is added to the pad specified by +.Fa pad +and +.Fa pad +is refreshed at its previous location on the screen. +Calling +.Fn pechochar +is equivalent to calling +.Fn addch +followed by +.Fn prefresh . +.Sh RETURN VALUES +These functions will return one of the following values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_addch 3 , +.Xr curses_attributes 3 , +.Xr curses_pad 3 , +.Xr curses_refresh 3 +.Sh STANDARDS +The +.Fn echochar , +.Fn wechochar , +and +.Fn pechochar +functions comply with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_fileio.3 b/vendor/netbsd-curses/libcurses/curses_fileio.3 new file mode 100644 index 0000000..f85c248 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_fileio.3 @@ -0,0 +1,93 @@ +.\" $NetBSD: curses_fileio.3,v 1.4 2010/12/09 11:21:49 njoly Exp $ +.\" Copyright (c) 2008 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Julian Coleman. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd March 31, 2008 +.Dt CURSES_FILEIO 3 +.Os +.Sh NAME +.Nm curses_fileio , +.Nm getwin , +.Nm putwin +.Nd curses file input/output routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft WINDOW * +.Fn getwin "FILE *fp" +.Ft int +.Fn putwin "WINDOW *win" "FILE *fp" +.Sh DESCRIPTION +These functions read and write data to and from files. +.Pp +The +.Fn getwin +function reads window data that has been stored in the file to which +.Fa fp +points, and then creates a new window using that data. +.Pp +The +.Fn putwin +function writes window data from the window +.Fa win +to the file pointed to by +.Fa fp . +.Sh RETURN VALUES +The +.Fn getwin +function returns one of the following values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Pp +The +.Fn putwin +function returns +.Dv NULL +if an error is detected. +.Sh SEE ALSO +.Xr curses_window 3 , +.Xr fread 3 , +.Xr fwrite 3 +.Sh NOTES +Subwindows can not be created by the +.Fn getwin +function, nor written by the +.Fn putwin +function. +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +These functions first appeared in +.Nx 5.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_inch.3 b/vendor/netbsd-curses/libcurses/curses_inch.3 new file mode 100644 index 0000000..7e3117d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_inch.3 @@ -0,0 +1,264 @@ +.\" $NetBSD: curses_inch.3,v 1.14 2018/10/29 21:06:13 wiz Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd October 25, 2018 +.Dt CURSES_INCH 3 +.Os +.Sh NAME +.Nm curses_inch , +.Nm inch , +.Nm winch , +.Nm inchnstr , +.Nm mvinchnstr , +.Nm winchnstr , +.Nm mvwinchnstr , +.Nm inchstr , +.Nm mvinchstr , +.Nm winchstr , +.Nm mvwinchstr , +.Nm innstr , +.Nm winnstr , +.Nm mvinnstr , +.Nm mvwinnstr , +.Nm instr , +.Nm winstr , +.Nm mvinstr , +.Nm mvwinstr +.Nd curses read screen contents routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft chtype +.Fn inch "void" +.Ft chtype +.Fn winch "WINDOW *win" +.Ft int +.Fn inchnstr "chtype *chars" "int n" +.Ft int +.Fn mvinchnstr "int y" "int x" "chtype *chstr" "int n" +.Ft int +.Fn winchnstr "WINDOW *win" "chtype *chars" "int n" +.Ft int +.Fn mvwinchnstr "WINDOW *win" "int y" "int x" "chtype *chstr" "int n" +.Ft int +.Fn inchstr "chtype *chars" +.Ft int +.Fn mvinchstr "int y" "int x" "chtype *chstr" +.Ft int +.Fn winchstr "WINDOW *win" "chtype *chars" +.Ft int +.Ft mvwinchstr "WINDOW *win" "int y" "int x" "chtype *chstr" +.Ft int +.Fn innstr "char *str" "int n" +.Ft int +.Fn winnstr "WINDOW *win" "char *str" "int n" +.Ft int +.Fn mvinnstr "int y" "int x" "char *str" "int n" +.Ft int +.Fn mvwinnstr "WINDOW *win" "int y" "int x" "char *str" "int n" +.Ft int +.Fn instr "char *str" +.Ft int +.Fn winstr "WINDOW *win" "char *str" +.Ft int +.Fn mvinstr "int y" "int x" "char *str" +.Ft int +.Fn mvwinstr "WINDOW *win" "int y" "int x" "char *str" +.Sh DESCRIPTION +These functions read the contents of +.Dv stdscr +or of the specified window. +.Pp +The +.Fn inch +function returns the character that is displayed on +.Dv stdscr +at the current cursor position. +.Pp +The +.Fn winch +function is the same as the +.Fn inch +function, excepting that the character is read from window specified by +.Fa win . +.Pp +The +.Fn inchnstr +function fills an array of +.Ft chtype +with characters read from +.Dv stdscr , +the characters are read starting from the current cursor position and +continuing until either n \- 1 characters are read or the right hand +side of the screen is reached. +The resulting character array will be +.Dv NULL +terminated. +.Pp +The +.Fn winchnstr +function is the same as +.Fn inchnstr +excepting that the characters are read from the window specified by +.Fa win . +.Pp +The +.Fn inchstr +and +.Fn winchstr +functions are the same as the +.Fn inchnstr +and +.Fn winchnstr +functions, respectively, excepting that they do not limit the number +of characters read. +The characters returned are those from the current starting position to +the right hand side of the screen. +The use of +.Fn inchstr +and +.Fn winchstr +is not recommended as the character buffer can be overflowed. +.Pp +The +.Fn innstr +function +is similar to the +.Fn inchstr +function, excepting that the array of characters returned is stripped of all +the curses attributes making it a plain character string. +.Pp +The +.Fn mvinchstr , +.Fn mvinchnstr , +.Fn mvwinchstr , +and +.Fn mvwinchnstr +functions are the same as the +.Fn inchstr , +.Fn inchnstr , +.Fn winchstr , +and +.Fn winchstr +functions, respectively, except that +.Fn wmove +is called to move the cursor to the position specified by +.Fa y , +.Fa x +before the output is printed on the window. +Likewise, the +.Fn mvinstr , +.Fn mvinnstr , +.Fn mvwinstr , +and +.Fn mvwinnstr +functions are the same as the +.Fn instr , +.Fn innstr , +.Fn winstr , +and +.Fn winstr +functions, respectively, except that +.Fn wmove +is called to move the cursor to the position specified by +.Fa y , +.Fa x +before the output is printed on the window. +.Pp +The +.Fn winnstr +function is the same as the +.Fn innstr +function, excepting that characters are read from the window specified by +.Fa win . +.Pp +The +.Fn instr +and +.Fn winstr +functions +are the same as the +.Fn innstr +and +.Fn winnstr +functions, respectively, excepting that there are no limits placed on the +size of the returned string, which may cause buffer overflows. +For this reason, the use of +.Fn instr +and +.Fn winstr +is not recommended. +.Sh RETURN VALUES +If the calls +.Fn innstr , +.Fn mvinnstr , +.Fn mvwinnstr , +and +.Fn winnstr +succeed then they will return the number of characters actually read. +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_addch 3 , +.Xr curses_addstr 3 , +.Xr curses_attributes 3 , +.Xr curses_insch 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part +of the Single Unix Specification. +.Sh NOTES +The +.Fn inchnstr +and +.Fn innstr +function read at most n \- 1 characters from the screen so as to leave +room for +.Dv NULL +termination. +The X/Open specification is unclear as to whether or not this is the correct +behaviour. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_input.3 b/vendor/netbsd-curses/libcurses/curses_input.3 new file mode 100644 index 0000000..5773afd --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_input.3 @@ -0,0 +1,624 @@ +.\" $NetBSD: curses_input.3,v 1.27 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd January 5, 2017 +.Dt CURSES_INPUT 3 +.Os +.Sh NAME +.Nm curses_input , +.Nm getch , +.Nm wgetch , +.Nm mvgetch , +.Nm mvwgetch , +.Nm define_key , +.Nm keyok , +.Nm has_key , +.Nm getnstr , +.Nm wgetnstr , +.Nm mvgetnstr , +.Nm mvwgetnstr , +.Nm getstr , +.Nm wgetstr , +.Nm mvgetstr , +.Nm mvwgetstr , +.Nm keypad , +.Nm is_keypad , +.Nm notimeout , +.Nm timeout , +.Nm wtimeout , +.Nm nodelay , +.Nm ungetch , +.Nm set_escdelay +.Nd curses input stream routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn getch "void" +.Ft int +.Fn wgetch "WINDOW *win" +.Ft int +.Fn mvgetch "int y" "int x" +.Ft int +.Fn mvwgetch "WINDOW *win" "int y" "int x" +.Ft int +.Fn keyok "int key_symbol" "bool flag" +.Ft int +.Fn has_key "int key_symbol" +.Ft int +.Fn define_key "char *sequence" "int key_symbol" +.Ft int +.Fn getnstr "char *str" "int limit" +.Ft int +.Fn wgetnstr "WINDOW *win" "char *str" "int limit" +.Ft int +.Fn mvgetnstr "int y" "int x" "char *str" "int limit" +.Ft int +.Fn mvwgetnstr "WINDOW *win" "int y" "int x" "char *str" "int limit" +.Ft int +.Fn getstr "char *str" +.Ft int +.Fn wgetstr "WINDOW *win" "char *str" +.Ft int +.Fn mvgetstr "int y" "int x" "char *str" +.Ft int +.Fn mvwgetstr "WINDOW *win" "int y" "int x" "char *str" +.Ft int +.Fn keypad "WINDOW *win" "boolf flag" +.Ft bool +.Fn is_keypad "const WINDOW *win" +.Ft int +.Fn notimeout "WINDOW *win" "boolf flag" +.Ft int +.Fn timeout "int delay" +.Ft int +.Fn wtimeout "WINDOW *win" "int delay" +.Ft int +.Fn nodelay "WINDOW *win" "boolf flag" +.Ft int +.Fn ungetch "int c" +.Ft int +.Fn set_escdelay "int escdelay" +.Pp +.Va extern int ESCDELAY ; +.Sh DESCRIPTION +These functions read characters and strings from the window input file +descriptor. +.Pp +The +.Fn getch +function reads a character from the +.Dv stdscr +input file descriptor and returns it. +If the +.Fn keypad +flag has been set to +.Dv TRUE , +then +.Fn getch +will assemble multi-character key sequences into key symbols, +If the terminal is resized, +.Fn getch +will return +.Dv KEY_RESIZE , +regardless of the setting of +.Fn keypad . +Calling +.Fn getch +will cause an implicit +.Fn refresh +on +.Dv stdscr . +.Pp +The +.Fn wgetch +function is the same as the +.Fn getch +function, excepting that it reads from the input file descriptor associated +with the window specified by +.Fa win . +.Pp +If the +.Fn keypad +flag is +.Dv TRUE +then the assembly of specific key symbols can be disabled by using the +.Fn keyok +function. +If the +.Fa flag +is set to +.Dv FALSE +on a key symbol then +.Fn getch +will behave as if the character sequence associated with that key symbol +was not recognised and will return the component characters one at a time to +the caller. +The +.Fn is_keypad +function returns +.Dv TRUE +if the +.Fn +keypad +flag is set for the window specified by +.Fa win . +.Pp +The +.Fn has_key +function takes a key value and returns +.Dv TRUE +if the current terminal recognises a key with that value, otherwise +.Dv FALSE . +.Pp +Custom associations between sequences of characters and a key symbol can +be made by using the +.Fn define_key +function. +Normally, these associations are made by the information in the +.Xr terminfo 5 +database but the +.Fn define_key +function gives the capability to remove or add more associations. +If +.Fn define_key +is passed a non-NULL string in +.Fa sequence +it will associate that sequence with the key symbol passed in +.Fa key_symbol . +The key symbol may be one of the ones listed below or a custom value that +is application defined. +It is valid to have multiple character sequences map to the same key +symbol and there are no constraints on the length of the sequence allowed. +The assembly of custom sequences follow the same rules for inter-character +timing and so forth as the +.Xr terminfo 5 +derived ones. +If +.Fn define_key +is passed a NULL in +.Fa sequence +then all associations for the key symbol in +.Fa key_symbol +will be deleted, this includes any associations that were derived from +.Xr terminfo 5 . +.Pp +The +.Fn mvgetch +and +.Fn mvwgetch +functions are the same as the +.Fn getch +and +.Fn wgetch +functions, respectively, excepting that +.Fn wmove +is called to move the cursor to the position specified by +.Fa y , +.Fa x +before the character is read. +.Pp +Calling +.Fn getnstr , +.Fn wgetnstr , +.Fn mvgetnstr +or +.Fn mvwgetnstr +is effectively the same as calling +.Fn getch +repeatedly until a newline is received or the character limit +.Fa limit +is reached. +Once this happens the string is +.Dv NULL +terminated and returned in +.Fa str . +During input, the normal curses input key processing is performed and +affects the input buffer. +The +.Fn mvgetnstr +function calls +.Fn wmove +to move the cursor to the position given by +.Fa y , +.Fa x +before getting the string, +.Fn wgetnstr +reads the input from the designated window, +.Fn mvwgetnstr +moves the cursor to the position given by +.Fa y , +.Fa x +before getting the input from the designated window. +.Pp +The functions +.Fn getstr , +.Fn wgetstr , +.Fn mvgetstr , +and +.Fn mvwgetstr +are similar to +.Fn getnstr , +.Fn wgetnstr , +.Fn mvgetnstr , +and +.Fn mvwgetnstr , +respectively, excepting that there is no limit on the number of characters +that may be inserted into +.Fa str . +This may cause the buffer to be overflowed, so their use is not recommended. +.Pp +The +.Fn keypad +function is used to affect how +.Fn getch +processes input characters. +If +.Fa flag +is set to +.Dv TRUE , +then +.Fn getch +will scan the input stream looking for multi-character key sequences +that are emitted by some terminal function keys. +If a recognised sequence of characters is found, then +.Fn getch +will collapse that sequence into an integer key symbol, as shown below. +The default setting for the flag is +.Dv FALSE . +.Pp +The +.Fn notimeout +function controls whether or not +.Fn getch +will wait indefinitely between characters in a multi-character key +sequence or not. +If +.Fa flag +is +.Dv TRUE , +then there is no timeout applied between characters comprising a +multi-character key sequence. +If +.Fa flag +is +.Dv FALSE , +then the component characters of a multi-character sequence must not +have an inter-character gap of more than +.Va ESCDELAY . +If this timing is exceeded, then the multi-character key assembly is +deemed to have failed and the characters read thus far are returned +one at a time when +.Fn getch +is called. +The default setting for the flag is +.Dv FALSE . +The default value of +.Va ESCDELAY +is 300ms. +If +.Va ESCDELAY +is negative, no timeout is applied between characters comprising a +multi-character key sequence. +.Pp +The +.Fn timeout +function affects the behaviour of +.Fn getch +when reading a character from +.Dv stdscr . +If +.Fa delay +is negative, then +.Fn getch +will block indefinitely on a read. +If +.Fa delay +is 0, then +.Fn getch +will return immediately with +.Dv ERR +if there are no characters immediately available. +If +.Fa delay +is a positive number, then +.Fn getch +will wait for that many milliseconds before returning and, if no character +was available, then +.Dv ERR +will be returned. +Note that for a positive number, the timeout is only accurate to the nearest +tenth of a second. +Also, the maximum value of +.Fa delay +is 25500 milliseconds. +The +.Fn wtimeout +function does the same as +.Fn timeout +but applies to the specified window +.Fa win . +.Pp +The +.Fn nodelay +function turns on and off blocking reads for +.Fn getch . +If +.Fa flag +is +.Dv TRUE , +then +.Fn getch +will not block on reads, if +.Fa flag +is +.Dv FALSE , +then reads will block. +The default setting for the flag is +.Dv FALSE . +.Fn nodelay win TRUE +is equivalent to +.Fn wtimeout win 0 +and +.Fn nodelay win FALSE +is equivalent to +.Fn wtimeout win \-1 . +.Pp +.Fn ungetch +will convert +.Fa c +into an unsigned char and push that character back onto the input stream. +Only one character of push-back is guaranteed to work, more may be possible +depending on system resources. +.Pp +The +.Fn set_escdelay +function sets the +.Va ESCDELAY +value of the current screen to +.Fa escdelay . +.Sh RETURN VALUES +The functions +.Fn getch , +.Fn wgetch , +.Fn mvgetch , +and +.Fn mvwgetch +will return the value of the key pressed or +.Dv ERR +in the case of an error or a timeout. +Additionally, if +.Fn keypad TRUE +has been called on a window, then it may return one of the following values: +.Pp +.Bl -column "Termcap entry" "getch Return Value" "Key Function" -offset indent +.It Sy "Termcap entry" Ta Sy "getch Return Value" Ta Sy "Key Function" +.It \&!1 Ta KEY_SSAVE Ta Shift Save +.It \&!2 Ta KEY_SSUSPEND Ta Shift Suspend +.It \&!3 Ta KEY_SUNDO Ta Shift Undo +.It \ Ta KEY_SHELP Ta Shift Help +.It \ Ta KEY_SHOME Ta Shift Home +.It \ Ta KEY_SIC Ta Shift Insert Character +.It \ Ta KEY_SLEFT Ta Shift Left Arrow +.It \&%0 Ta KEY_REDO Ta Redo +.It \&%1 Ta KEY_HELP Ta Help +.It \&%2 Ta KEY_MARK Ta Mark +.It \&%3 Ta KEY_MESSAGE Ta Message +.It \&%4 Ta KEY_MOVE Ta Move +.It \&%5 Ta KEY_NEXT Ta Next Object +.It \&%6 Ta KEY_OPEN Ta Open +.It \&%7 Ta KEY_OPTIONS Ta Options +.It \&%8 Ta KEY_PREVIOUS Ta Previous Object +.It \&%9 Ta KEY_PRINT Ta Print +.It \&%a Ta KEY_SMESSAGE Ta Shift Message +.It \&%b Ta KEY_SMOVE Ta Shift Move +.It \&%c Ta KEY_SNEXT Ta Shift Next Object +.It \&%d Ta KEY_SOPTIONS Ta Shift Options +.It \&%e Ta KEY_SPREVIOUS Ta Shift Previous Object +.It \&%f Ta KEY_SPRINT Ta Shift Print +.It \&%g Ta KEY_SREDO Ta Shift Redo +.It \&%h Ta KEY_SREPLACE Ta Shift Replace +.It \&%i Ta KEY_SRIGHT Ta Shift Right Arrow +.It \&%j Ta KEY_SRSUME Ta Shift Resume +.It \&&0 Ta KEY_SCANCEL Ta Shift Cancel +.It \&&1 Ta KEY_REFERENCE Ta Reference +.It \&&2 Ta KEY_REFRESH Ta Refresh +.It \&&3 Ta KEY_REPLACE Ta Replace +.It \&&4 Ta KEY_RESTART Ta Restart +.It \&&5 Ta KEY_RESUME Ta Resume +.It \&&6 Ta KEY_SAVE Ta Save +.It \&&7 Ta KEY_SUSPEND Ta Suspend +.It \&&8 Ta KEY_UNDO Ta Undo +.It \&&9 Ta KEY_SBEG Ta Shift Begin +.It \&*0 Ta KEY_SFIND Ta Shift Find +.It \&*1 Ta KEY_SCOMMAND Ta Shift Command +.It \&*2 Ta KEY_SCOPY Ta Shift Copy +.It \&*3 Ta KEY_SCREATE Ta Shift Create +.It \&*4 Ta KEY_SDC Ta Shift Delete Character +.It \&*5 Ta KEY_SDL Ta Shift Delete Line +.It \&*6 Ta KEY_SELECT Ta Select +.It \&*7 Ta KEY_SEND Ta Shift End +.It \&*8 Ta KEY_SEOL Ta Shift Clear to EOL +.It \&*9 Ta KEY_SEXIT Ta Shift Exit +.It \&@0 Ta KEY_FIND Ta Find +.It \&@1 Ta KEY_BEG Ta Begin +.It \&@2 Ta KEY_CANCEL Ta Cancel +.It \&@3 Ta KEY_CLOSE Ta Close +.It \&@4 Ta KEY_COMMAND Ta Command +.It \&@5 Ta KEY_COPY Ta Copy +.It \&@6 Ta KEY_CREATE Ta Create +.It \&@7 Ta KEY_END Ta End +.It \&@8 Ta KEY_ENTER Ta Enter +.It \&@9 Ta KEY_EXIT Ta Exit +.It \&F1 Ta KEY_F(11) Ta Function Key 11 +.It \&F2 Ta KEY_F(12) Ta Function Key 12 +.It \&F3 Ta KEY_F(13) Ta Function Key 13 +.It \&F4 Ta KEY_F(14) Ta Function Key 14 +.It \&F5 Ta KEY_F(15) Ta Function Key 15 +.It \&F6 Ta KEY_F(16) Ta Function Key 16 +.It \&F7 Ta KEY_F(17) Ta Function Key 17 +.It \&F8 Ta KEY_F(18) Ta Function Key 18 +.It \&F9 Ta KEY_F(19) Ta Function Key 19 +.It \&FA Ta KEY_F(20) Ta Function Key 20 +.It \&FB Ta KEY_F(21) Ta Function Key 21 +.It \&FC Ta KEY_F(22) Ta Function Key 22 +.It \&FD Ta KEY_F(23) Ta Function Key 23 +.It \&FE Ta KEY_F(24) Ta Function Key 24 +.It \&FF Ta KEY_F(25) Ta Function Key 25 +.It \&FG Ta KEY_F(26) Ta Function Key 26 +.It \&FH Ta KEY_F(27) Ta Function Key 27 +.It \&FI Ta KEY_F(28) Ta Function Key 28 +.It \&FJ Ta KEY_F(29) Ta Function Key 29 +.It \&FK Ta KEY_F(30) Ta Function Key 30 +.It \&FL Ta KEY_F(31) Ta Function Key 31 +.It \&FM Ta KEY_F(32) Ta Function Key 32 +.It \&FN Ta KEY_F(33) Ta Function Key 33 +.It \&FO Ta KEY_F(34) Ta Function Key 34 +.It \&FP Ta KEY_F(35) Ta Function Key 35 +.It \&FQ Ta KEY_F(36) Ta Function Key 36 +.It \&FR Ta KEY_F(37) Ta Function Key 37 +.It \&FS Ta KEY_F(38) Ta Function Key 38 +.It \&FT Ta KEY_F(39) Ta Function Key 39 +.It \&FU Ta KEY_F(40) Ta Function Key 40 +.It \&FV Ta KEY_F(41) Ta Function Key 41 +.It \&FW Ta KEY_F(42) Ta Function Key 42 +.It \&FX Ta KEY_F(43) Ta Function Key 43 +.It \&FY Ta KEY_F(44) Ta Function Key 44 +.It \&FZ Ta KEY_F(45) Ta Function Key 45 +.It \&Fa Ta KEY_F(46) Ta Function Key 46 +.It \&Fb Ta KEY_F(47) Ta Function Key 47 +.It \&Fc Ta KEY_F(48) Ta Function Key 48 +.It \&Fd Ta KEY_F(49) Ta Function Key 49 +.It \&Fe Ta KEY_F(50) Ta Function Key 50 +.It \&Ff Ta KEY_F(51) Ta Function Key 51 +.It \&Fg Ta KEY_F(52) Ta Function Key 52 +.It \&Fh Ta KEY_F(53) Ta Function Key 53 +.It \&Fi Ta KEY_F(54) Ta Function Key 54 +.It \&Fj Ta KEY_F(55) Ta Function Key 55 +.It \&Fk Ta KEY_F(56) Ta Function Key 56 +.It \&Fl Ta KEY_F(57) Ta Function Key 57 +.It \&Fm Ta KEY_F(58) Ta Function Key 58 +.It \&Fn Ta KEY_F(59) Ta Function Key 59 +.It \&Fo Ta KEY_F(60) Ta Function Key 60 +.It \&Fp Ta KEY_F(61) Ta Function Key 61 +.It \&Fq Ta KEY_F(62) Ta Function Key 62 +.It \&Fr Ta KEY_F(63) Ta Function Key 63 +.It \&K1 Ta KEY_A1 Ta Upper left key in keypad +.It \&K2 Ta KEY_B2 Ta Centre key in keypad +.It \&K3 Ta KEY_A3 Ta Upper right key in keypad +.It \&K4 Ta KEY_C1 Ta Lower left key in keypad +.It \&K5 Ta KEY_C3 Ta Lower right key in keypad +.It \&Km Ta KEY_MOUSE Ta Mouse Event +.It \&k0 Ta KEY_F0 Ta Function Key 0 +.It \&k1 Ta KEY_F(1) Ta Function Key 1 +.It \&k2 Ta KEY_F(2) Ta Function Key 2 +.It \&k3 Ta KEY_F(3) Ta Function Key 3 +.It \&k4 Ta KEY_F(4) Ta Function Key 4 +.It \&k5 Ta KEY_F(5) Ta Function Key 5 +.It \&k6 Ta KEY_F(6) Ta Function Key 6 +.It \&k7 Ta KEY_F(7) Ta Function Key 7 +.It \&k8 Ta KEY_F(8) Ta Function Key 8 +.It \&k9 Ta KEY_F(9) Ta Function Key 9 +.It \&k; Ta KEY_F(10) Ta Function Key 10 +.It \&kA Ta KEY_IL Ta Insert Line +.It \&ka Ta KEY_CATAB Ta Clear All Tabs +.It \&kB Ta KEY_BTAB Ta Back Tab +.It \&kb Ta KEY_BACKSPACE Ta Backspace +.It \&kC Ta KEY_CLEAR Ta Clear +.It \&kD Ta KEY_DC Ta Delete Character +.It \&kd Ta KEY_DOWN Ta Down Arrow +.It \&kE Ta KEY_EOL Ta Clear to End Of Line +.It \&kF Ta KEY_SF Ta Scroll Forward one line +.It \&kH Ta KEY_LL Ta Home Down +.It \&kh Ta KEY_HOME Ta Home +.It \&kI Ta KEY_IC Ta Insert Character +.It \&kL Ta KEY_DL Ta Delete Line +.It \&kl Ta KEY_LEFT Ta Left Arrow +.It \&kM Ta KEY_EIC Ta Exit Insert Character Mode +.It \&kN Ta KEY_NPAGE Ta Next Page +.It \&kP Ta KEY_PPAGE Ta Previous Page +.It \&kR Ta KEY_SR Ta Scroll One Line Back +.It \&kr Ta KEY_RIGHT Ta Right Arrow +.It \&kS Ta KEY_EOS Ta Clear to End Of Screen +.It \&kT Ta KEY_STAB Ta Set Tab +.It \&kt Ta KEY_CTAB Ta Clear Tab +.It \&ku Ta KEY_UP Ta Up Arrow +.El +.Pp +Note that not all terminals are capable of generating all the keycodes +listed above nor are terminfo entries normally configured with all the +above capabilities defined. +.Pp +Other functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Pp +Functions returning pointers will return +.Dv NULL +if an error is detected. +.Sh SEE ALSO +.Xr curses_cursor 3 , +.Xr curses_keyname 3 , +.Xr curses_refresh 3 , +.Xr curses_tty 3 , +.Xr terminfo 5 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh NOTES +The +.Fn keyok +and +.Fn define_key +functions are implementations of extensions made by the NCurses library +to the Curses standard. +Portable implementations should avoid the use of these functions. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . +The +.Fn is_keypad +and +.Fn set_tabsize +functions are +.Em ncurses +extension to the Curses library and was added in +.Nx 8.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_insch.3 b/vendor/netbsd-curses/libcurses/curses_insch.3 new file mode 100644 index 0000000..c73f30e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_insch.3 @@ -0,0 +1,113 @@ +.\" $NetBSD: curses_insch.3,v 1.2 2018/10/25 10:41:00 uwe Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd October 25, 2018 +.Dt CURSES_INSCH 3 +.Os +.Sh NAME +.Nm curses_insch , +.Nm insch , +.Nm winsch , +.Nm mvinsch , +.Nm mvwinsch +.Nd curses insert characters routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn insch "chtype ch" +.Ft int +.Fn winsch "WINDOW *win" "chtype ch" +.Ft int +.Fn mvinsch "int y" "int x" "chtype ch" +.Ft int +.Fn mvwinsch "WINDOW *win" "int y" "int x" "chtype ch" +.Sh DESCRIPTION +These functions insert characters on +.Dv stdscr +or on the specified window. +.Pp +The +.Fn insch +function inserts the character given in +.Fa ch +at the current cursor position on +.Dv stdscr . +The cursor is not advanced and wrapping is not performed. +.Pp +The +.Fn winsch +function is the same as the +.Fn insch +function, excepting that the character is inserted on the window specified by +.Fa win . +.Pp +The +.Fn mvinsch +and +.Fn mvwinsch +functions are the same as the +.Fn insch +and +.Fn insch +functions, respectively, excepting that +.Fn wmove +is called to move the cursor to the position specified by +.Fa y , +.Fa x +before the character is inserted on the window. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_addch 3 , +.Xr curses_cursor 3 , +.Xr curses_delch 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of +the Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_insdelln.3 b/vendor/netbsd-curses/libcurses/curses_insdelln.3 new file mode 100644 index 0000000..b590d12 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_insdelln.3 @@ -0,0 +1,115 @@ +.\" $NetBSD: curses_insdelln.3,v 1.3 2003/04/16 13:35:01 wiz Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd August 12, 2002 +.Dt CURSES_INSDEL 3 +.Os +.Sh NAME +.Nm curses_insdelln , +.Nm insdelln , +.Nm winsdelln +.Nd curses insert or delete lines routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn insdelln "int n" +.Ft int +.Fn winsdelln "WINDOW *win" "int n" +.Sh DESCRIPTION +These functions insert or delete lines on +.Dv stdscr +or on the specified window. +.Pp +If +.Fn insdelln +is called with a positive number in +.Fa n , +then the specified number of lines are inserted before the current line on +.Dv stdscr . +The last +.Fa n +lines of the screen are no longer displayed. +If +.Fa n +is negative, then +.Fa n +lines are deleted from +.Dv stdscr , +starting at the current line. +The last +.Fa n +lines of +.Dv stdscr +are cleared. +.Pp +The +.Fn winsdelln +function is the same as the +.Fn insdelln +function, excepting that lines are inserted or deleted from the window +specified by +.Fa win . +.Pp +If a scrolling region has been set with the +.Fn setscrreg +or +.Fn wsetscrreg +functions and the current cursor position is inside the scrolling region, +then only the lines from the current line to the bottom of the scrolling +region are affected. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_deleteln 3 , +.Xr curses_insertln 3 , +.Xr curses_scroll 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of +the Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_insertln.3 b/vendor/netbsd-curses/libcurses/curses_insertln.3 new file mode 100644 index 0000000..6cd325e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_insertln.3 @@ -0,0 +1,109 @@ +.\" $NetBSD: curses_insertln.3,v 1.4 2006/02/05 17:07:13 jdc Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd February 5, 2006 +.Dt CURSES_INSERTLN 3 +.Os +.Sh NAME +.Nm curses_insertln , +.Nm insertln , +.Nm winsertln +.Nd curses insert single line routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn insertln "void" +.Ft int +.Fn winsertln "WINDOW *win" +.Sh DESCRIPTION +These functions insert a single line on +.Dv stdscr +or on the specified window. +.Pp +The +.Fn insertln +function inserts a blank line before the current line on +.Dv stdscr . +The current line and all lines below are moved down one line away from +the cursor and the bottom line of the window is lost. +.Pp +The +.Fn winsertln +function is the same as the +.Fn insertln +function, excepting that the line is inserted on the window +.Fa win . +.Pp +If a scrolling region has been set with the +.Fn setscrreg +or +.Fn wsetscrreg +functions and the current cursor position is inside the scrolling region, +then only the lines from the current line to the bottom of the scrolling +region are moved down and the bottom line of the scrolling region lost. +.Pp +The functions +.Fn insertln +and +.Fn winsertln win +are equivalent to +.Fn insdelln 1 +and +.Fn winsdelln win 1 , +respectively. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_deleteln 3 , +.Xr curses_insdelln 3 , +.Xr curses_scroll 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of +the Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_keyname.3 b/vendor/netbsd-curses/libcurses/curses_keyname.3 new file mode 100644 index 0000000..bb0bda0 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_keyname.3 @@ -0,0 +1,72 @@ +.\" $NetBSD: curses_keyname.3,v 1.5 2008/04/30 13:10:51 martin Exp $ +.\" Copyright (c) 2002 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Julian Coleman. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 17, 2007 +.Dt CURSES_KEYNAME 3 +.Os +.Sh NAME +.Nm curses_keyname , +.Nm keyname +.Nd curses report key name routine +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft "char *" +.Fn keyname "int key" +.Sh DESCRIPTION +The function +.Fn keyname +generates a character string containing a description of the key specified in +.Fa key . +.Pp +The string is formatted according to the following table: +.Bl -column "Meta + control character" "KEY_MIN - KEY_MAX" "String format" +.It "Description" Ta "Key range" Ta "String format" +.It Li "Control character" Ta "0 - 31" Ta "^X" +.It Li "Visible character" Ta "32 - 126" Ta "X" +.It Li "Delete character" Ta "127" Ta "^?" +.It Li "Meta + control character" Ta "128 - 158" Ta "M-^X" +.It Li "Meta + visible character" Ta "159 - 254" Ta "M-X" +.It Li "Meta + delete character" Ta "255" Ta "M-^?" +.It Li "Named key" Ta "KEY_MIN - KEY_MAX" Ta "KEY_EXIT" +.It Li "Unknown key" Ta "" Ta "-1" +.El +.Sh SEE ALSO +.Xr curses_input 3 +.Sh NOTE +The return value of +.Fn keyname +is a static buffer, which will be overwritten on a subsequent call. +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +These functions first appeared in +.Nx 2.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_line.3 b/vendor/netbsd-curses/libcurses/curses_line.3 new file mode 100644 index 0000000..7da7b53 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_line.3 @@ -0,0 +1,171 @@ +.\" $NetBSD: curses_line.3,v 1.6 2010/02/20 10:23:04 wiz Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd February 19, 2010 +.Dt CURSES_LINE 3 +.Os +.Sh NAME +.Nm curses_line , +.Nm hline , +.Nm whline , +.Nm vline , +.Nm wvline , +.Nm mvhline , +.Nm mvwhline , +.Nm mvvline , +.Nm mvwvline +.Nd curses draw lines on windows routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn hline "chtype ch" "int n" +.Ft int +.Fn whline "WINDOW *win" "chtype ch" "int n" +.Ft int +.Fn mvhline "int y" "int x" "chtype ch" "int n" +.Ft int +.Fn mvwvline "WINDOW *win" "int y" "int x" "chtype c" "int n" +.Ft int +.Fn vline "chtype c" "int n" +.Ft int +.Fn wvline "WINDOW *win" "chtype c" "int n" +.Ft int +.Fn mvvline "int y" "int x" "chtype ch" "int n" +.Ft int +.Fn mvwhline "WINDOW *win" "int y" "int x" "chtype c" "int n" +.Sh DESCRIPTION +These functions draw lines on +.Dv stdscr +or on the specified window. +.Pp +The +.Fn hline +function draws a horizontal line of the character +.Fa ch +on +.Dv stdscr +starting at the current cursor position and extending for +.Fa n +characters, or until the right hand side of +.Dv stdscr +is reached. +If the text portion of +.Fa ch +is 0 then the line will be drawn with the +.Dv ACS_HLINE +character. +.Pp +The +.Fn whline +function is the same as the +.Fn hline +function, excepting that the line is drawn in the window specified by +.Fa win . +.Pp +The +.Fn vline +function draws a vertical line of character +.Fa ch +on +.Dv stdscr +starting at the current cursor position and moving down until either +.Fa n +characters have been drawn or the bottom of +.Dv stdscr +is reached. +If the text portion of +.Fa ch +is 0 then the line will be drawn with the +.Dv ACS_VLINE +character. +.Pp +The +.Fn wvline +function is the same as the +.Fn vline +function, excepting that the line is drawn on the given window. +.Pp +The +.Fn mvhline , +.Fn mvwhline , +.Fn mvvline +and +.Fn mvwvline +functions are the same as the +.Fn hline , +.Fn whline , +.Fn vline +and +.Fn wvline +functions, respectively, excepting that +.Fn wmove +is called to move the cursor to the position specified by +.Fa y , +.Fa x +before the line is drawn on the window. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_border 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of +the Single Unix Specification. +.Pp +The use of +.Dv ACS_HLINE +and +.Dv ACS_VLINE +as default drawing character in +.Fn hline +and +.Fn vline +is a +.Nx +extension which should not be relied on in portable code. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_mouse.3 b/vendor/netbsd-curses/libcurses/curses_mouse.3 new file mode 100644 index 0000000..05e1e15 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_mouse.3 @@ -0,0 +1,162 @@ +.\" $NetBSD: curses_mouse.3,v 1.2 2020/03/23 16:14:20 wiz Exp $ +.\" +.\" Copyright (c) 2020 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Roy Marples. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" +.Dd March 22, 2020 +.Dt CURSES_MOUSE 3 +.Os +.Sh NAME +.Nm has_mouse , +.Nm getmouse , +.Nm ungetmouse , +.Nm mousemask , +.Nm wenclose , +.Nm mouse_trafo , +.Nm wmouse_trafo , +.Nm mouseinterval +.Nd Curses mouse interface +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft bool +.Fn has_mouse "void" +.Ft int +.Fn getmouse "MEVENT *event" +.Ft int +.Fn ungetmouse "MEVENT *event" +.Ft mmask_t +.Fn mousemask "mmask_t newmask" "mmask_t *oldmask" +.Ft bool +.Fn wenclose "const WINDOW *win" "int y" "int x" +.Ft bool +.Fn mouse_trafo "int *y" "int *x" "bool to_screen" +.Ft bool +.Fn wmouse_trafo "const WINDOW *win" "int *y" "int *x" "bool to_screen" +.Ft int +.Fn mouseinterval "int erval" +.Sh DESCRIPTION +This is the curses interface to mouse events. +Mouse events are reported via the +.Dv KEY_MOUSE +value in the +.Xr wgetch 3 +input stream. +.Pp +The +.Fn has_mouse +function returns true if the mouse support has been initialised for the +terminal, otherwise false. +.Pp +The +.Fn getmouse +function reads a mouse event. +The +.Fa x +and +.Fa y +values are screen relative and the state mask will have exactly one bit set +to represent the event type. +The +.Fn ungetmouse +function behave like +.Xr ungetch 3 +and pushes the mouse event into the input stream. +.Pp +The +.Fn mousemask +function sets the mouse events to be reported. +By default, there are no mouse events reported. +It returns a mask indicating which of the specified mouse events can be +reported, zero indicating a failure. +If oldmask is given, it is filled with the previous mouse event mask. +.Pp +The +.Fn wenclose +function returns true if the screen relative +.Fa x +and +.Fa y +co-ordinates are enclosed by the window +.Fa win , +otherwise false. +.Pp +The +.Fn wmouse_trafo +function transforms the +.Fa x +and +.Fa y +co-ordinates from screen relative to window relative or vice versa +depending on the value of +.Fa to_screen . +If the co-ordinates are not enclosed by the window +.Fa win +then false is returned, otherwise the +.Fa x +and +.Fa y +values are transformed and true is returned. +The +.Fn mouse_trainfo +function calls +.Fn wmouse_trainfo +using +.Va stdscr +for +.Fa win . +.Pp +The +.Fn mouseinterval +function sets the maximum time that can elapse between press and release +events, which determins a click. +The value is in thousands of seconds. +The default value is one fifth of a second. +The returned value is the old value. +.Sh RETURN VALUES +Unless otherwise noted, the functions that return an int will return one of +the following values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr wsmouse 4 +.Sh STANDARDS +These functions are ncurses extensions to the Curses library. +.Sh HISTORY +The mouse functions were added in +.Nx 10.0 . +.Sh BUGS +There is currently no actual mouse support, +.Fn has_mouse +will always return false. diff --git a/vendor/netbsd-curses/libcurses/curses_pad.3 b/vendor/netbsd-curses/libcurses/curses_pad.3 new file mode 100644 index 0000000..d2e6b00 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_pad.3 @@ -0,0 +1,156 @@ +.\" $NetBSD: curses_pad.3,v 1.6 2017/01/05 23:15:43 roy Exp $ +.\" Copyright (c) 2002 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Julian Coleman. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd January 5, 2016 +.Dt CURSES_PAD 3 +.Os +.Sh NAME +.Nm curses_pad , +.Nm newpad , +.Nm subpad , +.Nm prefresh , +.Nm pnoutrefresh +.Nd curses pad routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft WINDOW * +.Fn newpad "int lines" "int cols" +.Ft WINDOW * +.Fn subpad "WINDOW *pad" "int lines" "int cols" "int begin_y" "int begin_x" +.Ft int +.Fn prefresh "WINDOW *pad" "int pbeg_y" "int pbeg_x" "int sbeg_y" "int sbeg_x" "int smax_y" "int smax_x" +.Ft int +.Fn pnoutrefresh "WINDOW *pad" "int pbeg_y" "int pbeg_x" "int sbeg_y" "int sbeg_x" "int smax_y" "int smax_x" +.Ft bool +.Fn is_pad "const WINDOW *pad" +.Sh DESCRIPTION +These functions create and display pads on the current screen. +.Pp +The +.Fn newpad +function creates a new pad of size +.Fa lines , +.Fa cols . +.Pp +.Fn subpad +is similar to +.Fn newpad +excepting that the size of the subpad is bounded by the parent +pad +.Fa pad . +The subpad shares internal data structures with the parent pad +and will be refreshed when the parent pad is refreshed. +The starting column and row +.Fa begin_y , +.Fa begin_x +are relative to the parent pad origin. +.Pp +The +.Fn pnoutrefresh +function performs the internal processing required by curses to determine +what changes need to be made to synchronise the internal screen buffer +and the terminal but does not modify the terminal display. +A rectangular area of the pad starting at column and row +.Fa pbeg_y , +.Fa pbeg_x +is copied to the corresponding rectangular area of the screen buffer starting +at column and row +.Fa sbeg_y , +.Fa sbeg_x +and extending to +.Fa smax_y , +.Fa smax_x . +.Pp +The +.Fn prefresh +function causes curses to propagate changes made to the pad specified by +.Fa pad +to the terminal display. +A rectangular area of the pad starting at column and row +.Fa pbeg_y , +.Fa pbeg_x +is copied to the corresponding rectangular area of the terminal starting +at column and row +.Fa sbeg_y , +.Fa sbeg_x +and extending to +.Fa smax_y , +.Fa smax_x . +.Pp +The +.Fn pnoutrefresh +and +.Fn doupdate +functions can be used together to speed up terminal redraws by +deferring the actual terminal updates until after a batch of updates +to multiple pads has been done. +.Pp +The +.Fn is_pad +function returns true if the given window was created by +.Fn newpad , +otherwise false. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_refresh 3 , +.Xr curses_window 3 +.Sh NOTES +The +.Fn subpad +function is similar to the +.Xr derwin 3 +function, and not the +.Xr subwin 3 +function. +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . +The +.Fn is_pad +function is a +.Em ncurses +extension to the Curses library and was added in +.Nx 8.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_print.3 b/vendor/netbsd-curses/libcurses/curses_print.3 new file mode 100644 index 0000000..7047693 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_print.3 @@ -0,0 +1,125 @@ +.\" $NetBSD: curses_print.3,v 1.7 2011/04/06 08:38:43 jruoho Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd April 6, 2011 +.Dt CURSES_PRINT 3 +.Os +.Sh NAME +.Nm curses_print , +.Nm printw , +.Nm wprintw , +.Nm mvprintw , +.Nm mvwprintw , +.Nm unctrl +.Nd curses print formatted strings on windows routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn printw "const char *fmt" "..." +.Ft int +.Fn wprintw "WINDOW *win" "const char *fmt" "..." +.Ft int +.Fn mvprintw "int y" "int x" "const char *fmt" "..." +.Ft int +.Fn mvwprintw "WINDOW *win" "int y" "int x" "const char *fmt" "..." +.Ft char * +.Fn unctrl "chtype ch" +.Sh DESCRIPTION +These functions print formatted strings on +.Dv stdscr +or on the specified window. +.Pp +The +.Fn printw +function formats and prints its arguments on +.Dv stdscr . +The behavior is deliberately similar to that of +.Xr printf 3 , +but, notably, the return value differs. +.Pp +The +.Fn wprintw +function is the same as the +.Fn printw +function, excepting that the resulting output is printed on the window +specified by +.Fa win . +.Pp +The +.Fn mvprintw +and +.Fn mvwprintw +functions are the same as the +.Fn printw +and +.Fn wprintw +functions, respectively, excepting that +.Fn wmove +is called to move the cursor to the position specified by +.Fa y , +.Fa x +before the output is printed on the window. +.Pp +The +.Fn unctrl +function returns a printable string representation of the character +.Fa ch . +If +.Fa ch +is a control character then it will be converted to the form ^Y. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -offset indent +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_cursor 3 , +.Xr curses_scanw 3 , +.Xr printf 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_private.h b/vendor/netbsd-curses/libcurses/curses_private.h new file mode 100644 index 0000000..1275e43 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_private.h @@ -0,0 +1,439 @@ +/* $NetBSD: curses_private.h,v 1.73 2020/03/15 01:12:47 uwe Exp $ */ + +/*- + * Copyright (c) 1998-2000 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +/* Modified by Ruibiao Qiu + * to add support for wide characters + * Changes: + * - Add a compiler variable HAVE_WCHAR for wide character only code + * - Add a pointer to liked list of non-spacing characters in __ldata + * and the macro to access the width field in the attribute field + * - Add a circular input character buffer in __screen to handle + * wide-character input (used in get_wch()) + */ + +#include +#include +#include + +/* Private structure definitions for curses. */ + +/* Termcap capabilities. */ +#ifdef HAVE_WCHAR +/* + * Add a list of non-spacing characters to each spacing + * character in a singly linked list + */ +typedef struct nschar_t { + wchar_t ch; /* Non-spacing character */ + struct nschar_t *next; /* Next non-spacing character */ +} nschar_t; +#endif /* HAVE_WCHAR */ + +/* + * A window is an array of __LINE structures pointed to by the 'lines' pointer. + * A line is an array of __LDATA structures pointed to by the 'line' pointer. + * + * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new + * fields are added -- padding fields with *constant values* should ensure + * that the compiler will not generate any padding when storing an array of + * __LDATA structures. This is to enable consistent use of memcmp, and memcpy + * for comparing and copying arrays. + */ + +struct __ldata { + wchar_t ch; /* Character */ + attr_t attr; /* Attributes */ +#ifdef HAVE_WCHAR + nschar_t *nsp; /* Foreground non-spacing character pointer */ +#endif /* HAVE_WCHAR */ +}; + +#ifdef HAVE_WCHAR +/* macros to extract the width of a wide character */ +#define __WCWIDTH 0xfc000000 +#define WCW_SHIFT 26 +#define WCOL(wc) ((((unsigned) (wc).attr) >> WCW_SHIFT ) > MB_LEN_MAX ? ((int)(((unsigned) (wc).attr ) >> WCW_SHIFT )) - 64 : ((int)(((unsigned) (wc).attr ) >> WCW_SHIFT))) +#define SET_WCOL(c, w) do { \ + ((c).attr) = ((((c).attr) & WA_ATTRIBUTES ) | ((w) << WCW_SHIFT )); \ +} while(/*CONSTCOND*/0) +#define BGWCOL(wc) ((((wc).battr) >> WCW_SHIFT ) > MB_LEN_MAX ? (((wc).battr ) >> WCW_SHIFT ) - 64 : (((wc).battr ) >> WCW_SHIFT )) +#define SET_BGWCOL(c, w) do { \ + ((c).battr) = ((((c).battr) & WA_ATTRIBUTES ) | ((w) << WCW_SHIFT )); \ +} while(/*CONSTCOND*/0) +#endif /* HAVE_WCHAR */ + +#define __LDATASIZE (sizeof(__LDATA)) + +struct __line { +#ifdef DEBUG +#define SENTINEL_VALUE 0xaac0ffee + + unsigned int sentinel; /* try to catch line overflows */ +#endif +#define __ISDIRTY 0x01 /* Line is dirty. */ +#define __ISPASTEOL 0x02 /* Cursor is past end of line */ +#define __ISFORCED 0x04 /* Force update, no optimisation */ + unsigned int flags; + unsigned int hash; /* Hash value for the line. */ + int *firstchp, *lastchp; /* First and last chngd columns ptrs */ + int firstch, lastch; /* First and last changed columns. */ + __LDATA *line; /* Pointer to the line text. */ +}; + +struct __window { /* Window structure. */ + struct __window *nextp, *orig; /* Subwindows list and parent. */ + int begy, begx; /* Window home. */ + int cury, curx; /* Current x, y coordinates. */ + int maxy, maxx; /* Maximum values for curx, cury. */ + int reqy, reqx; /* Size requested when created */ + int ch_off; /* x offset for firstch/lastch. */ + __LINE **alines; /* Array of pointers to the lines */ + __LINE *lspace; /* line space (for cleanup) */ + __LDATA *wspace; /* window space (for cleanup) */ + +#define __ENDLINE 0x00000001 /* End of screen. */ +#define __FLUSH 0x00000002 /* Fflush(stdout) after refresh. */ +#define __FULLWIN 0x00000004 /* Window is a screen. */ +#define __IDLINE 0x00000008 /* Insert/delete sequences. */ +#define __SCROLLWIN 0x00000010 /* Last char will scroll window. */ +#define __SCROLLOK 0x00000020 /* Scrolling ok. */ +#define __CLEAROK 0x00000040 /* Clear on next refresh. */ +#define __LEAVEOK 0x00000100 /* If cursor left */ +#define __KEYPAD 0x00010000 /* If interpreting keypad codes */ +#define __NOTIMEOUT 0x00020000 /* Wait indefinitely for func keys */ +#define __IDCHAR 0x00040000 /* insert/delete char sequences */ +#define __ISPAD 0x00080000 /* "window" is a pad */ +#define __ISDERWIN 0x00100000 /* "window" is derived from parent */ +#define __IMMEDOK 0x00200000 /* refreshed when changed */ +#define __SYNCOK 0x00400000 /* sync when changed */ +#define __HALFDELAY 0x00800000 /* In half delay mode */ + unsigned int flags; + int delay; /* delay for getch() */ + attr_t wattr; /* Character attributes */ + wchar_t bch; /* Background character */ + attr_t battr; /* Background attributes */ + int scr_t, scr_b; /* Scrolling region top, bottom */ + SCREEN *screen; /* Screen for this window */ + int pbegy, pbegx, + sbegy, sbegx, + smaxy, smaxx; /* Saved prefresh() values */ + int dery, derx; /* derived window coordinates + - top left corner of source + relative to parent win */ +#ifdef HAVE_WCHAR + nschar_t *bnsp; /* Background non-spacing char list */ +#endif /* HAVE_WCHAR */ + FILE *fp; /* for window formatted printf */ + char *buf; /* buffer for window formatted printf */ + size_t buflen; /* length of above buffer */ +}; + +/* Set of attributes unset by 'me' - 'mb', 'md', 'mh', 'mk', 'mp' and 'mr'. */ +#ifndef HAVE_WCHAR +#define __TERMATTR \ + (__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT) +#else +#define __TERMATTR \ + (__REVERSE | __BLINK | __DIM | __BOLD | __BLANK | __PROTECT \ + | WA_TOP | WA_LOW | WA_LEFT | WA_RIGHT | WA_HORIZONTAL | WA_VERTICAL) +#endif /* HAVE_WCHAR */ + +struct __winlist { + struct __window *winp; /* The window. */ + struct __winlist *nextp; /* Next window. */ +}; + +struct __color { + short num; + short red; + short green; + short blue; + int flags; +}; + +/* List of colour pairs */ +struct __pair { + short fore; + short back; + int flags; +}; + +/* Maximum colours */ +#define MAX_COLORS 256 +/* Maximum colour pairs - determined by number of colour bits in attr_t */ +#define MAX_PAIRS PAIR_NUMBER(__COLOR) + +typedef struct keymap keymap_t; + +/* POSIX allows up to 8 columns in a label. */ +#define MAX_SLK_COLS 8 +#ifdef HAVE_WCHAR +#define MAX_SLK_LABEL sizeof(wchar_t) * MAX_SLK_COLS +#else +#define MAX_SLK_LABEL MAX_SLK_COLS +#endif +struct __slk_label { + char *text; + int justify; +#define SLK_JUSTIFY_LEFT 0 +#define SLK_JUSTIFY_CENTER 1 +#define SLK_JUSTIFY_RIGHT 2 + char label[MAX_SLK_LABEL + 1]; + int x; +}; + +#define MAX_RIPS 5 +struct __ripoff { + int nlines; + WINDOW *win; +}; + +/* this is the encapsulation of the terminal definition, one for + * each terminal that curses talks to. + */ +struct __screen { + FILE *infd, *outfd; /* input and output file descriptors */ + WINDOW *curscr; /* Current screen. */ + WINDOW *stdscr; /* Standard screen. */ + WINDOW *__virtscr; /* Virtual screen (for doupdate()). */ + int curwin; /* current window for refresh */ + int lx, ly; /* loop parameters for refresh */ + int COLS; /* Columns on the screen. */ + int LINES; /* Lines on the screen. */ + int nripped; /* Number of ripofflines. */ + struct __ripoff ripped[MAX_RIPS]; /* ripofflines. */ + int ESCDELAY; /* Delay between keys in esc seq's. */ +#define ESCDELAY_DEFAULT 300 /* milliseconds. */ + int TABSIZE; /* Size of a tab. */ +#define TABSIZE_DEFAULT 8 /* spaces. */ + int COLORS; /* Maximum colors on the screen */ + int COLOR_PAIRS; /* Maximum color pairs on the screen */ + int My_term; /* Use Def_term regardless. */ + char GT; /* Gtty indicates tabs. */ + char NONL; /* Term can't hack LF doing a CR. */ + char UPPERCASE; /* Terminal is uppercase only. */ + + chtype acs_char[NUM_ACS]; +#ifdef HAVE_WCHAR + cchar_t wacs_char[ NUM_ACS ]; +#endif /* HAVE_WCHAR */ + struct __color colours[MAX_COLORS]; + struct __pair colour_pairs[MAX_PAIRS]; + attr_t nca; + +/* Style of colour manipulation */ +#define COLOR_NONE 0 +#define COLOR_ANSI 1 /* ANSI/DEC-style colour manipulation */ +#define COLOR_HP 2 /* HP-style colour manipulation */ +#define COLOR_TEK 3 /* Tektronix-style colour manipulation */ +#define COLOR_OTHER 4 /* None of the others but can set fore/back */ + int color_type; + + attr_t mask_op; + attr_t mask_me; + attr_t mask_ue; + attr_t mask_se; + TERMINAL *term; + int old_mode; /* old cursor visibility state for terminal */ + keymap_t *base_keymap; + int echoit; + int pfast; + int rawmode; + int nl; + int noqch; + int clearok; + int useraw; + struct __winlist *winlistp; + struct termios cbreakt, rawt, *curt, save_termios; + struct termios orig_termios, baset, savedtty; + int ovmin; + int ovtime; + char *stdbuf; + unsigned int len; + int meta_state; + char padchar; + int endwin; + int notty; + int resized; + wchar_t *unget_list; + int unget_len, unget_pos; + int filtered; + int checkfd; + + /* soft label key */ + bool is_term_slk; + WINDOW *slk_window; + int slk_format; +#define SLK_FMT_INVAL -1 +#define SLK_FMT_3_2_3 0 +#define SLK_FMT_4_4 1 + int slk_nlabels; + int slk_label_len; + bool slk_hidden; + struct __slk_label *slk_labels; + +#ifdef HAVE_WCHAR +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 8 +#endif +#define MAX_CBUF_SIZE MB_LEN_MAX + int cbuf_head; /* header to cbuf */ + int cbuf_tail; /* tail to cbuf */ + int cbuf_cur; /* the current char in cbuf */ + mbstate_t sp; /* wide char processing state */ + char cbuf[ MAX_CBUF_SIZE ]; /* input character buffer */ +#endif /* HAVE_WCHAR */ +}; + + +extern char __GT; /* Gtty indicates tabs. */ +extern char __NONL; /* Term can't hack LF doing a CR. */ +extern char __UPPERCASE; /* Terminal is uppercase only. */ +extern int My_term; /* Use Def_term regardless. */ +extern const char *Def_term; /* Default terminal type. */ +extern SCREEN *_cursesi_screen; /* The current screen in use */ + +/* Debugging options/functions. */ +#ifdef DEBUG +#define __CTRACE_TSTAMP 0x00000001 +#define __CTRACE_MISC 0x00000002 +#define __CTRACE_INIT 0x00000004 +#define __CTRACE_SCREEN 0x00000008 +#define __CTRACE_WINDOW 0x00000010 +#define __CTRACE_REFRESH 0x00000020 +#define __CTRACE_COLOR 0x00000040 +#define __CTRACE_INPUT 0x00000080 +#define __CTRACE_OUTPUT 0x00000100 +#define __CTRACE_LINE 0x00000200 +#define __CTRACE_ATTR 0x00000400 +#define __CTRACE_ERASE 0x00000800 +#define __CTRACE_FILEIO 0x00001000 +#define __CTRACE_ALL 0x7fffffff +void __CTRACE(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3))); +#endif + +/* Common erase logic */ +#ifdef HAVE_WCHAR +#define __NEED_ERASE(_sp, _bch, _battr) \ + ((_sp)->ch != (_bch) || \ + ((_sp)->attr & WA_ATTRIBUTES) != (_battr) || \ + (_sp)->nsp != NULL || \ + WCOL(*_sp) < 0) +#else +#define __NEED_ERASE(_sp, _bch, _battr) \ + ((_sp)->ch != (_bch) || (_sp)->attr != (_battr)) +#endif + +/* Private functions. */ +int __cputchar_args(int, void *); +void _cursesi_free_keymap(keymap_t *); +int _cursesi_gettmode(SCREEN *); +void _cursesi_reset_acs(SCREEN *); +int _cursesi_addbyte(WINDOW *, __LINE **, int *, int *, int , attr_t, int); +int _cursesi_addwchar(WINDOW *, __LINE **, int *, int *, const cchar_t *, + int); +int _cursesi_waddbytes(WINDOW *, const char *, int, attr_t, int); +#ifdef HAVE_WCHAR +void _cursesi_reset_wacs(SCREEN *); +#endif /* HAVE_WCHAR */ +void _cursesi_resetterm(SCREEN *); +int _cursesi_setterm(char *, SCREEN *); +int __delay(void); +unsigned int __hash_more(const void *, size_t, unsigned int); +#define __hash(s, len) __hash_more((s), (len), 0u) +void __id_subwins(WINDOW *); +void __init_getch(SCREEN *); +void __init_acs(SCREEN *); +#ifdef HAVE_WCHAR +void __init_get_wch(SCREEN *); +void __init_wacs(SCREEN *); +int __cputwchar_args( wchar_t, void * ); +int _cursesi_copy_nsp(nschar_t *, struct __ldata *); +void __cursesi_free_nsp(nschar_t *); +void __cursesi_win_free_nsp(WINDOW *); +void __cursesi_putnsp(nschar_t *, const int, const int); +void __cursesi_chtype_to_cchar(chtype, cchar_t *); +#endif /* HAVE_WCHAR */ +int __fgetc_resize(FILE *); +int __unget(wint_t); +int __mvcur(int, int, int, int, int); +WINDOW *__newwin(SCREEN *, int, int, int, int, int, int); +int __nodelay(void); +int __notimeout(void); +void __restartwin(void); +void __restore_colors(void); +void __restore_cursor_vis(void); +void __restore_meta_state(void); +void __restore_termios(void); +void __restore_stophandler(void); +void __restore_winchhandler(void); +int __ripoffscreen(SCREEN *); +int __ripoffresize(SCREEN *); +void __ripofftouch(SCREEN *); +int __rippedlines(const SCREEN *, int); +void __save_termios(void); +void __set_color(WINDOW *win, attr_t attr); +void __set_stophandler(void); +void __set_winchhandler(void); +void __set_subwin(WINDOW *, WINDOW *); +int __slk_init(SCREEN *); +void __slk_free(SCREEN *); +int __slk_resize(SCREEN *, int cols); +int __slk_noutrefresh(SCREEN *); +void __startwin(SCREEN *); +void __stop_signal_handler(int); +int __stopwin(void); +void __swflags(WINDOW *); +void __sync(WINDOW *); +int __timeout(int); +int __touchline(WINDOW *, int, int, int); +int __touchwin(WINDOW *); +int __unripoffline(int (*)(WINDOW *, int)); +void __unsetattr(int); +void __unset_color(WINDOW *win); +int __waddch(WINDOW *, __LDATA *); +int __wgetnstr(WINDOW *, char *, int); +void __winch_signal_handler(int); + +/* Private #defines. */ +#define min(a,b) ((a) < (b) ? (a) : (b)) +#define max(a,b) ((a) > (b) ? (a ): (b)) + +/* Private externs. */ +extern int __echoit; +extern int __endwin; +extern int __pfast; +extern int __rawmode; +extern int __noqch; +extern attr_t __mask_op, __mask_me, __mask_ue, __mask_se; +extern WINDOW *__virtscr; +extern int __using_color; +extern attr_t __default_color; diff --git a/vendor/netbsd-curses/libcurses/curses_refresh.3 b/vendor/netbsd-curses/libcurses/curses_refresh.3 new file mode 100644 index 0000000..0d8822a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_refresh.3 @@ -0,0 +1,179 @@ +.\" $NetBSD: curses_refresh.3,v 1.13 2017/01/05 09:46:32 wiz Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd January 2, 2017 +.Dt CURSES_REFRESH 3 +.Os +.Sh NAME +.Nm curses_refresh , +.Nm refresh , +.Nm wrefresh , +.Nm wnoutrefresh , +.Nm doupdate , +.Nm immedok , +.Nm flushok , +.Nm leaveok , +.Nm is_leaveok +.Nd curses terminal update routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn refresh "void" +.Ft int +.Fn wrefresh "WINDOW *win" +.Ft int +.Fn wnoutrefresh "WINDOW *win" +.Ft int +.Fn doupdate "void" +.Ft int +.Fn immedok "WINDOW *win" "boolf flag" +.Ft int +.Fn flushok "WINDOW *win" "boolf flag" +.Ft int +.Fn leaveok "WINDOW *win" "boolf flag" +.Ft bool +.Fn is_leaveok "const WINDOW *win" +.Sh DESCRIPTION +These functions update the terminal with the contents of +.Dv stdscr +or of the specified window(s). +.Pp +The +.Fn refresh +function causes curses to propagate changes made to +.Dv stdscr +to the terminal display. +Any changes made to subwindows of +.Dv stdscr +are also propagated. +.Pp +The +.Fn wrefresh +function is the same as the +.Fn refresh +function, excepting that changes are propagated to the terminal from the +window specified by +.Fa win . +.Pp +The +.Fn wnoutrefresh +function performs the internal processing required by curses to determine +what changes need to be made to synchronise the internal screen buffer +and the terminal but does not modify the terminal display. +.Pp +The +.Fn doupdate +function updates the terminal display to match the internal curses +representation of the display. +.Pp +The +.Fn wnoutrefresh +and +.Fn doupdate +functions can be used together to speed up terminal redraws by +deferring the actual terminal updates until after a batch of updates +to multiple windows has been done. +.Pp +The +.Fn refresh +function is equivalent to +.Fn wnoutrefresh stdscr +followed by +.Fn doupdate . +.Pp +The +.Fn immedok +function determines whether the screen is refreshed whenever the window is +changed. +The initial state is +.Dv FALSE . +.Pp +The +.Fn flushok +function is used to determine whether or not the screen's output file +descriptor will be flushed on refresh. +Setting +.Fa flag +to +.Dv TRUE +will cause the output to be flushed. +.Pp +The +.Fn leaveok +function determines whether refresh operations may leave the screen cursor +in an arbitrary position on the screen. +Setting +.Fa flag +to +.Dv FALSE +ensures that the screen cursor is positioned at the current cursor +position after a refresh operation has taken place. +The +.Fn is_leaveok +function returns the setting. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_pad 3 , +.Xr curses_touch 3 , +.Xr getch 3 +.Sh NOTES +Calling +.Fn wrefresh +on a new, unchanged window has no effect. +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . +The +.Fn is_leaveok +function is a +.Em ncurses +extension to the Curses library and was added in +.Nx 8.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_scanw.3 b/vendor/netbsd-curses/libcurses/curses_scanw.3 new file mode 100644 index 0000000..b6c1ab7 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_scanw.3 @@ -0,0 +1,114 @@ +.\" $NetBSD: curses_scanw.3,v 1.5 2003/04/16 13:35:01 wiz Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd August 12, 2002 +.Dt CURSES_SCANW 3 +.Os +.Sh NAME +.Nm curses_scanw , +.Nm scanw , +.Nm wscanw , +.Nm mvscanw , +.Nm mvwscanw +.Nd curses read formatted data from screen routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn scanw "const char *fmt" "..." +.Ft int +.Fn wscanw "WINDOW *win" "const char *fmt" "..." +.Ft int +.Fn mvscanw "int y" "int x" "const char *fmt" "..." +.Ft int +.Fn mvwscanw "WINDOW *win" "int y" "int x" "const char *fmt" "..." +.Sh DESCRIPTION +These functions read formatted data from +.Dv stdscr +or from the specified window. +.Pp +The +.Fn scanw +function is the same as the +.Fn scanf +function, excepting that the input data stream is read from the current +cursor position on +.Dv stdscr , +.Pp +The +.Fn wscanw +function is the same +as the +.Fn scanw +function, excepting that the data stream is read from the window specified by +.Fa win . +.Pp +The +.Fn mvscanw +and +.Fn mvwscanw +functions are the same as the +.Fn scanw +and +.Fn mvscanw +functions, respectively, excepting that +.Fn wmove +is called to move the cursor to the position specified by +.Fa y , +.Fa x +before the data is read from the window. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_cursor 3 , +.Xr curses_print 3 , +.Xr scanf 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_screen.3 b/vendor/netbsd-curses/libcurses/curses_screen.3 new file mode 100644 index 0000000..52b277f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_screen.3 @@ -0,0 +1,315 @@ +.\" $NetBSD: curses_screen.3,v 1.28 2021/02/07 23:00:57 rillig Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd March 12, 2020 +.Dt CURSES_SCREEN 3 +.Os +.Sh NAME +.Nm curses_screen , +.Nm filter , +.Nm ripoffline , +.Nm use_env , +.Nm newterm , +.Nm set_term , +.Nm delscreen , +.Nm endwin , +.Nm initscr , +.Nm isendwin , +.Nm is_term_resized , +.Nm resize_term , +.Nm resizeterm , +.Nm setterm , +.Nm set_tabsize +.Nd curses terminal and screen routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft void +.Fn filter "void" +.Ft int +.Fn ripoffline "int line" "int (*init)(WINDOW *win, int cols)" +.Ft void +.Fn use_env "bool value" +.Ft SCREEN * +.Fn newterm "char *type" "FILE *outfd" "FILE *infd" +.Ft SCREEN * +.Fn set_term "SCREEN *screen" +.Ft void +.Fn delscreen "SCREEN *screen" +.Ft int +.Fn endwin "void" +.Ft WINDOW * +.Fn initscr "void" +.Ft bool +.Fn isendwin "void" +.Ft bool +.Fn is_term_resized "int lines" "int cols" +.Ft int +.Fn resize_term "int lines" "int cols" +.Ft int +.Fn resizeterm "int lines" "int cols" +.Ft int +.Fn setterm "char *name" +.Ft int +.Fn set_tabsize "int value" +.Pp +.Va extern int LINES ; +.Pp +.Va extern int COLS ; +.Sh DESCRIPTION +These functions initialize terminals and screens. +.Pp +The +.Fn newterm +function initialises the curses data structures and pointers ready for +use by curses. +The +.Fa type +argument points to a +.Xr terminfo 5 +entry, or it may be +.Dv NULL +in which case the TERM environment variable is used. +The +.Fa outfd +and +.Fa infd +are the output and input file descriptors for the terminal. +The +.Fn newterm +function must only be called once per terminal. +.Pp +The +.Fn set_term +function can be used to switch between the screens defined by calling +.Fn newterm , +a pointer to the previous screen structure that was in use will be +returned on success. +.Pp +Calling +.Fn delscreen +will destroy the given screen and free all allocated resources. +.Pp +Calling +.Fn endwin +will end the curses session and restore the saved terminal settings. +.Pp +The curses session must be initialised by calling +.Fn initscr +which saves the current terminal state and sets up the terminal and +internal data structures to support the curses application. +This +function call must be, with few exceptions, the first Curses library +call made. +The exception to this rule is the +.Fn newterm +call which may be called prior to +.Fn initscr . +The size of the curses screen is determined by checking the +.Xr tty 4 +size and then the +.Xr terminfo 5 +entries for the terminal type. +If the environment variables +.Ev LINES +or +.Ev COLUMNS +are set, then these will be used instead. +.Pp +When either +.Fn newterm +or +.Fn initscr +are called, the Curses library sets up signal handlers for +.Dv SIGTSTP +and +.Dv SIGWINCH . +If a signal handler is already installed for +.Dv SIGWINCH , +this will also be called when the Curses library handler is called. +.Pp +The +.Fn isendwin +function can be used to determine whether or not a refresh of the +screen has occurred since the last call to +.Fn endwin . +.Pp +The size of the screen may be changed by calling +.Fn resize_term +with the updated number of lines and columns. +This will resize the curses internal data structures to accommodate the +changed terminal geometry. +The +.Dv curscr +and +.Dv stdscr +windows and any of their subwindows will be resized to fit the new +screen size. +The application must redraw the screen after a call to +.Fn resize_term . +The +.Fn resizeterm +function is a wrapper for +.Fn resize_term +and adjusts other structure data that handles window dimensions. +The +.Fn is_term_resized +function tests if either of the above functions need to be called. +.Pp +The +.Fn setterm +function sets the terminal type for the current screen to the one +passed, initialising all the curses internal data structures with +information related to the named terminal. +The +.Fa name +argument must be a valid name or alias in the +.Xr terminfo 5 +database for this function to succeed. +.Pp +The +.Fn filter +function changes the way the terminal is initialised. +A subsequent call to +.Fn initscr +or +.Fn newterm +performs the following additional actions: +.Bl -bullet -compact +.It +Disable use of clear, cud, cud1, cup, cuu, cuu1 and vpa. +.It +Set the value of the home string to the value of the cr string. +.It +Set lines equal to 1. +.El +.Pp +The +.Fn ripoffline +function will rip a line from +.Dv stdscr +at the top if +.Fa line +is positive, or at the bottom if negative. +When +.Fn initscr +or +.Fn newterm +is called, a window will be created for each line ripped and passed +to the +.Fa init +function pointer alongwith the number of columns in the window. +This init function cannot use the +.Dv LINES +or +.Dv COLS +variables and cannot call +.Xr wrefresh 3 +or +.Xr doupdate 3 , +but may call +.Xr wnoutrefresh 3 . +.Fn ripoffline +can be called up to five times. +.Pp +The +.Fn use_env +function determines whether the environment variables +.Ev LINES +and +.Ev COLUMNS +override the normal values. +The default is true. +Any call to +.Fn use_env +must precede calls to +.Fn initscr , +.Fn newterm , +or +.Fn setupterm . +.Pp +The +.Fn set_tabsize +function will set +.Va TABSIZE +of the current screen to +.Va tabsize . +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected with the exception of +.Fn initscr +which will log a diagnostic to standard error output and then call +.Xr exit 3 . +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_window 3 , +.Xr tty 4 , +.Xr terminfo 5 , +.Xr signal 7 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . +The +.Fn resizeterm +function is an +.Em ncurses +extension to the Curses library and was added in +.Nx 1.6 . +The +.Fn is_term_resized , +.Fn resize_term +and +.Fn set_tabsize +functions are +.Em ncurses +extensions to the Curses library and were added in +.Nx 8.0 . +.Sh BUGS +There is currently an issue with cursor movement in a 1 line sized window +which causes the screen to scroll up. +This can obviously be seen when using +.Fn ripoffline . diff --git a/vendor/netbsd-curses/libcurses/curses_scroll.3 b/vendor/netbsd-curses/libcurses/curses_scroll.3 new file mode 100644 index 0000000..459de9a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_scroll.3 @@ -0,0 +1,169 @@ +.\" $NetBSD: curses_scroll.3,v 1.4 2003/04/16 13:35:01 wiz Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd August 12, 2002 +.Dt CURSES_SCROLL 3 +.Os +.Sh NAME +.Nm curses_scroll , +.Nm scrl , +.Nm wscrl +.Nm scroll , +.Nm scrollok , +.Nm setscrreg , +.Nm wsetscrreg +.Nd curses window scrolling routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn scrl "int n" +.Ft int +.Fn wscrl "WINDOW *win" "int n" +.Ft int +.Fn scroll "WINDOW *win" +.Ft int +.Fn scrollok "WINDOW *win" "boolf flag" +.Ft int +.Fn setscrreg "int top" "int bottom" +.Ft int +.Fn wsetscrreg "WINDOW *win" "int top" "int bottom" +.Sh DESCRIPTION +These functions scroll areas on +.Dv stdscr +or on the specified window. +.Pp +The +.Fn scrl +function scrolls +.Dv stdscr +by +.Fa n +lines. +If +.Fa n +is positive then then +.Dv stdscr +is scrolled up. +.Fa n +lines are lost from the top of +.Dv stdscr +and +.Fa n +blank lines are inserted at the bottom. +If +.Fa n +is negative then +.Dv stdscr +is scrolled down. +.Fa n +blank lines are inserted at the top of +.Dv stdscr +and +.Fa n +lines are lost from the bottom. +.Pp +The +.Fn wscrl +function is the same as the +.Fn scrl +function, excepting that it scrolls the window specified by +.Fa win . +.Pp +The +.Fn scroll +function scrolls the window +.Fa win +up by one line. +.Pp +The scrolling behaviour of a window can be controlled by using the +.Fn scrollok +function. +If the +.Fa flag +argument is +.Dv TRUE +then a line wrap at the bottom of the window will cause the window to +be scrolled up one line, if +.Fa flag +is +.Dv FALSE +then lines that would force a scroll will be truncated. +.Pp +The +.Fn setscrreg +function sets up a software scrolling region on +.Dv stdscr +which will define a region of the screen that will be scrolled. +The scrolling of this region is also controlled by the +.Fn scrollok +function. +.Pp +The +.Fn wsetscrreg +function does the same as the +.Fn setscrreg +function, except that the scrolling region is set on the window specified by +.Fa win . +.Pp +If a scrolling region has been set with the +.Fn setscrreg +or +.Fn wsetscrreg +functions and the current cursor position is inside the scrolling region, +then only the area inside the scrolling region is scrolled. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_deleteln 3 , +.Xr curses_insdelln 3 , +.Xr curses_insertln 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_slk.3 b/vendor/netbsd-curses/libcurses/curses_slk.3 new file mode 100644 index 0000000..0b8137f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_slk.3 @@ -0,0 +1,244 @@ +.\" $NetBSD: curses_slk.3,v 1.2 2018/09/29 22:04:57 kamil Exp $ +.\" +.\" Copyright (c) 2017 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Roy Marples. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" +.Dd September 29, 2018 +.Dt CURSES_SLK 3 +.Os +.Sh NAME +.Nm slk_attroff , +.Nm slk_attr_off , +.Nm slk_attron , +.Nm slk_attr_on , +.Nm slk_attrset , +.Nm slk_attr_set , +.Nm slk_clear , +.Nm slk_color , +.Nm slk_init , +.Nm slk_label , +.Nm slk_noutrefresh , +.Nm slk_refresh , +.Nm slk_restore , +.Nm slk_set , +.Nm slk_touch , +.Nm slk_wset +.Nd Curses soft label key routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn slk_attroff "const chtype attr" +.Ft int +.Fn slk_attr_off "const attr_t attr" "void *opt" +.Ft int +.Fn slk_attron "const chtype attr" +.Ft int +.Fn slk_attr_on "const attr_t attr" "void *opt" +.Ft int +.Fn slk_attrset "const chtype attr" +.Ft int +.Fn slk_attr_set "const attr_t attr" "short pair" "void *opt" +.Ft void +.Fn slk_clear "void" +.Ft int +.Fn slk_color "short pair" +.Ft int +.Fn slk_init "int fmt" +.Ft char * +.Fn slk_label "int labnum" +.Ft int +.Fn slk_noutrefresh "void" +.Ft int +.Fn slk_refresh "void" +.Ft int +.Fn slk_restore "void" +.Ft int +.Fn slk_set "int labnum" "const char *label" "int justify" +.Ft int +.Fn slk_touch "void" +.Ft int +.Fn slk_wset "int labnum" "const wchar_t *label" "int justify" +.Sh DESCRIPTION +This Curses interface manipulates the set of soft function-key labels that +exist on some terminals. +For those terminals that do not have soft labels, Curses takes over the bottom +line of +.Dv stdstr , +reducing the size of +.Dv stdscr +and the value of the +.Dv LINES +external variable. +There can be up to eight labels of up to eight display columns each. +.Pp +To use soft labels, +.Fn slk_init +must be called before +.Xr initscr 3 , +.Xr newterm 3 , +or +.Xr ripoffline 3 +is called. +If +.Xr newterm 3 +eventually uses a line from +.Dv stdscr +to emulate the soft labels, then +.Fa fmt +determines how the labels are arranged on the screen from the following list: +.Bl -tag -width ERR -compact +.It 0 +indicates a 3-2-3 arrangement. +.It 1 +indicates a 4-4 arrangement. +.El +.Pp +The +.Fn slk_set +and +.Fn slk_wset +functions specify the text of soft label number +.Fa labnum , +within the range from 1 to 8 inclusive. +The +.Fa label +argument is the string to be put on the label. +The +.Fa justify +argument can have the following values to indicate how to justify +.Fa label +within the space reserved for it: +.Bl -tag -width ERR -compact +.It 0 +Left align. +.It 1 +Center align. +.It 2 +Right align. +.El +.Pp +The +.Fn slk_refresh +and +.Fn slk_noutrefresh +functions correspond to the +.Xr wrefresh 3 +and +.Xr wnoutrefresh 3 +functions. +.Pp +The +.Fn slk_label +function returns a pointer to the text displayed in the label. +.Pp +The +.Fn slk_clear +function immediately clears the soft labels from the screen. +.Pp +The +.Fn slk_restore +function immediately restores the soft labels to the screen after a call to +.Fn slk_clear . +.Pp +The +.Fn slk_touch +function forces all soft labels to be output the next time +.Fn slk_noutrefresh +or +.Fn slk_refresh +is called. +.Pp +The +.Fn slk_attron , +.Fn slk_attrset +and +.Fn slk_attroff +functions correspond to +.Xr attron 3 , +.Xr attrset 3 +and +.Xr attroff 3 . +The have an effect only if soft labels are simulated on the bottom line of the +screen. +.Pp +The +.Fn slk_attr_on , +.Fn slk_attr_set , +.Fn slk_color +and +.Fn slk_attr_off +functions correspond to +.Xr attr_on 3 , +.Xr attr_set 3 , +.Xr color_set 3 +and +.Xr attr_off 3 +and thus support the attribute constants with the WA_ prefix and color. +The have an effect only if soft labels are simulated on the bottom line of the +screen. +.Pp +The +.Fa opt +argument is reserved for future use. +Currently the application must provide a NULL pointer as +.Fa opt . +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr terminfo 5 +.Sh NOTES +This has not been tested on a terminal with real soft label keys. +.Dv label_height , +.Dv label_width , +.Dv label_format +and +.Dv lab_f* +are currently not used. +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . +The soft label key functions were added in +.Nx 8.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_standout.3 b/vendor/netbsd-curses/libcurses/curses_standout.3 new file mode 100644 index 0000000..6679120 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_standout.3 @@ -0,0 +1,108 @@ +.\" $NetBSD: curses_standout.3,v 1.7 2016/11/29 17:33:48 christos Exp $ +.\" Copyright (c) 2002 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Julian Coleman. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd November 29, 2016 +.Dt CURSES_STANDOUT 3 +.Os +.Sh NAME +.Nm curses_standout , +.Nm standout , +.Nm standend , +.Nm wstandout , +.Nm wstandend +.Nd curses standout attribute manipulation routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn standout void +.Ft int +.Fn standend void +.Ft int +.Fo wstandout +.Fa "WINDOW *win" +.Fc +.Ft int +.Fo wstandend +.Fa "WINDOW *win" +.Fc +.Sh DESCRIPTION +These functions manipulate the standout attribute on +.Dv stdscr +or on the specified window. +.Pp +The +.Fn standout +function turns on the standout attribute +on +.Dv stdscr . +The +.Fn standend +function turns off all attributes +on +.Dv stdscr . +.Pp +The +.Fn wstandout +and +.Fn wstandend +functions are equivalent to +.Fn standout +and +.Fn standend , +respectively, excepting that the attribute is manipulated on the +window specified by +.Fa win . +.Pp +The +.Fn standout +and +.Fn standend +functions are equivalent to +.Fn attron A_STANDOUT +and +.Fn attroff A_STANDOUT , +respectively. +.Sh RETURN VALUES +These functions always return 1. +.Sh SEE ALSO +.Xr curses_attributes 3 , +.Xr curses_underscore 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . +.Sh BUGS +On modern terminals that support other attributes, there is no difference +between characters displayed with the standout attribute set and those +displayed with one of the other attributes set (usually bold). +It is best to avoid using standout if the terminal supports other attributes. diff --git a/vendor/netbsd-curses/libcurses/curses_termcap.3 b/vendor/netbsd-curses/libcurses/curses_termcap.3 new file mode 100644 index 0000000..19247b6 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_termcap.3 @@ -0,0 +1,81 @@ +.\" $NetBSD: curses_termcap.3,v 1.6 2012/04/21 12:27:28 roy Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd October 4, 2011 +.Dt CURSES_TERMCAP 3 +.Os +.Sh NAME +.Nm curses_termcap , +.Nm fullname +.Nd curses termcap querying routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft char * +.Fn fullname "char *termbuf" "char *name" +.Sh DESCRIPTION +The +.Fn fullname +function takes the termcap entry in +.Fa termbuf +and copies the full name of the terminal from the entry into the +target variable +.Fa name . +The full name of the terminal is assumed to be the last alias in the +termcap entry name. +It is assumed that the +.Fa name +variable has sufficient storage to hold the full name of the terminal. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr terminfo 5 +.Sh STANDARDS +The +.Lb libcurses +library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_touch.3 b/vendor/netbsd-curses/libcurses/curses_touch.3 new file mode 100644 index 0000000..2449701 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_touch.3 @@ -0,0 +1,209 @@ +.\" $NetBSD: curses_touch.3,v 1.10 2018/02/08 09:05:16 dholland Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd January 2, 2017 +.Dt CURSES_TOUCH 3 +.Os +.Sh NAME +.Nm curses_touch , +.Nm touchline , +.Nm touchoverlap , +.Nm touchwin , +.Nm untouchwin , +.Nm wtouchln , +.Nm is_linetouched , +.Nm is_wintouched , +.Nm redrawwin , +.Nm wredrawln , +.Nm syncok , +.Nm wsyncup , +.Nm wsyncdown +.Nd curses window modification routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn touchline "WINDOW *win" "int start" "int count" +.Ft int +.Fn touchoverlap "WINDOW *win1" "WINDOW *win2" +.Ft int +.Fn touchwin "WINDOW *win" +.Ft int +.Fn untouchwin "WINDOW *win" +.Ft int +.Fn wtouchln "WINDOW *win" "int line" "int n" "boolf changed" +.Ft bool +.Fn is_linetouched "WINDOW *win" "int line" +.Ft bool +.Fn is_wintouched "WINDOW *win" +.Ft int +.Fn redrawwin "WINDOW *win" +.Ft int +.Fn wredrawln "WINDOW *win" "int line" "int n" +.Ft int +.Fn syncok "WINDOW *win" +.Ft void +.Fn wsyncup "WINDOW *win" +.Ft void +.Fn wsyncdown "WINDOW *win" +.Sh DESCRIPTION +These functions mark lines and windows as modified and check the modification +status of lines and windows. +.Pp +The +.Fn touchline +function marks +.Fa count +lines starting from +.Fa start +in window +.Fa win +as having been modified. +These characters will be synced to the terminal on the next call to +.Fn wrefresh . +.Pp +The +.Fn touchoverlap +function marks the portion of +.Fa win2 +that overlaps +.Fa win1 +as being modified. +.Pp +The +.Fn touchwin +function marks the entire window +.Fa win +as having been modified. +Conversely, +the +.Fn untouchwin +function marks the window +.Fa win +as being unmodified, so that any changes made to that window will +not be synced to the terminal during a +.Fn wrefresh . +.Pp +The +.Fn wtouchln +function performs one of two operations on +.Fa n +lines starting at +.Fa line +in the given window. +If +.Fa changed +is 1 then the given line range is marked as being modified, if +.Fa changed +is 0 then the given line range is set to being unmodified. +.Pp +The +.Fn is_linetouched +function returns +.Dv TRUE +if +.Fa line +in window +.Fa win +has been modified since the last refresh was done, otherwise +.Dv FALSE +is returned. +.Pp +.Fn is_wintouched +returns +.Dv TRUE +if the window +.Fa win +has been modified since the last refresh, otherwise +.Dv FALSE +is returned. +.Pp +The +.Fn redrawwin +function marks the entire window +.Fa win +as having been corrupted. +Is is equivalent to the +.Fn touchwin +function. +.Pp +The +.Fn wredrawln +function marks +.Fa n +lines starting at +.Fa line +in the given window as corrupted. +It is equivalent to +.Fn wtouchln win line n 1 . +.Pp +The +.Fn syncok +function determines whether all the ancestors of the specified window are +implicitly touched whenever there is a change in the window. +The initial state is +.Dv FALSE . +.Pp +The +.Fn wsyncup +function touches all ancestors of +.Fa win . +.Pp +The +.Fn wsyncdown +function touches +.Fa win +if any of its ancestors is touched. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_refresh 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_tty.3 b/vendor/netbsd-curses/libcurses/curses_tty.3 new file mode 100644 index 0000000..83cd416 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_tty.3 @@ -0,0 +1,393 @@ +.\" $NetBSD: curses_tty.3,v 1.14 2017/09/18 08:49:20 wiz Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd February 17, 2017 +.Dt CURSES_TTY 3 +.Os +.Sh NAME +.Nm curses_tty , +.Nm baudrate , +.Nm beep , +.Nm flash , +.Nm curs_set , +.Nm def_prog_mode , +.Nm reset_prog_mode , +.Nm def_shell_mode , +.Nm reset_shell_mode , +.Nm echo , +.Nm noecho , +.Nm delay_output , +.Nm erasechar , +.Nm flushinp , +.Nm gettmode , +.Nm halfdelay , +.Nm has_ic , +.Nm has_il , +.Nm idcok , +.Nm idlok , +.Nm intrflush , +.Nm noqiflush , +.Nm qiflush , +.Nm killchar , +.Nm meta , +.Nm napms , +.Nm nl , +.Nm nonl , +.Nm cbreak , +.Nm nocbreak , +.Nm raw , +.Nm noraw , +.Nm typeahead , +.Nm savetty , +.Nm resetty +.Nd curses terminal manipulation routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn baudrate "void" +.Ft int +.Fn beep "void" +.Ft int +.Fn flash "void" +.Ft int +.Fn curs_set "int visibility" +.Ft int +.Fn def_prog_mode "void" +.Ft int +.Fn reset_prog_mode "void" +.Ft int +.Fn def_shell_mode "void" +.Ft int +.Fn reset_shell_mode "void" +.Ft int +.Fn echo "void" +.Ft int +.Fn noecho "void" +.Ft int +.Fn delay_output "int ms" +.Ft char +.Fn erasechar "void" +.Ft int +.Fn flushinp "void" +.Ft int +.Fn gettmode "void" +.Ft bool +.Fn has_ic "void" +.Ft bool +.Fn has_il "void" +.Ft int +.Fn idcok "WINDOW *win" "bool flag" +.Ft int +.Fn idlok "WINDOW *win" "bool flag" +.Ft int +.Fn intrflush "WINDOW *win" "bool flag" +.Ft void +.Fn noqiflush "void" +.Ft void +.Fn qiflush "void" +.Ft char +.Fn killchar "void" +.Ft int +.Fn meta "WINDOW *win" "bool flag" +.Ft int +.Fn napms "int ms" +.Ft int +.Fn nl "void" +.Ft int +.Fn nonl "void" +.Ft int +.Fn cbreak "void" +.Ft int +.Fn nocbreak "void" +.Ft int +.Fn halfdelay "int" +.Ft int +.Fn raw "void" +.Ft int +.Fn noraw "void" +.Ft int +.Fn typeahead "int filedes" +.Ft int +.Fn savetty "void" +.Ft int +.Fn resetty "void" +.Sh DESCRIPTION +These functions manipulate curses terminal settings. +.Pp +The +.Fn baudrate +function extracts the output speed of the terminal +and returns it in bits per second. +.Pp +The +.Fn beep +function rings the terminal bell, if this is possible. +Failing that, the terminal screen will be flashed. +If neither of these are possible, then no action will be taken. +.Fn flash +will flash the terminal screen if possible. +Failing that, the terminal bell will be rung. +If neither of these are possible then no action will be taken. +.Pp +The cursor +visibility can be set by calling +.Fn curs_set . +The following visibility settings are valid for +.Fn curs_set : +.Pp +.Bl -tag -width visibility -compact -offset indent +.It Visibility +Effect +.It 0 +cursor is invisible. +.It 1 +cursor is normal visibility +.It 2 +cursor is high visibility +.El +.Pp +A successful call to +.Fn curs_set +will return the previous visibility setting for the cursor. +.Pp +The +.Fn delay_output +function pauses the output to the terminal by sending the appropriate +number of terminal pad characters such that the transmission time of +the pad characters will take +.Fa ms +milliseconds. +.Pp +Calling +.Fn def_prog_mode +will cause the current terminal curses setting to be saved. +A subsequent call to +.Fn reset_prog_mode , +will restore the saved settings. +This is useful when calls to external programs are made that may +reset the terminal characteristics. +.Pp +The +.Fn def_shell_mode +function saves the current terminal line settings. +These settings are the ones that will be restored when the curses +application exits. +Conversely, +.Fn reset_shell_mode +will save the current terminal curses settings for later restoration and +restores the previously saved terminal line settings. +.Pp +The +.Fn echo +function turns on curses echo mode, characters entered will be echoed +to the terminal by curses. +The +.Fn noecho +function disables this feature. +.Pp +The current erase character for the terminal can be determined by +calling the +.Fn erasechar +function. +.Pp +The +.Fn flushinp +function discards any pending input for the current screen. +.Pp +The modes +for the current terminal can be reset by calling +.Fn gettmode , +this will perform the initialisation on the terminal that is normally +done by curses at start up. +.Pp +The +.Fn has_ic +function returns either +.Dv TRUE +or +.Dv FALSE +depending on whether or not the terminal has a insert character +capability or not. +Similarly the +.Fn has_il +function does the same test but for a insert line capability. +.Pp +The use of the insert character capability in curses operations can be +enabled or disabled by calling +.Fn idcok +on the desired window. +Similarly, the use of the insert line capability can be controlled using the +.Fn idlok +function. +.Pp +The +.Fn intrflush +function controls whether or not a flush of the input buffer is +performed when an interrupt key (kill, suspend or quit) is pressed. +The +.Fa win +parameter is ignored. +The +.Fn noqiflush +function is equivalent to +.Fn intrflush stdscr FALSE . +The +.Fn qiflush +function is equivalent to +.Fn intrflush stdscr TRUE . +.Pp +The character that performs the line kill function can be determined +by calling the +.Fn killchar +function. +.Pp +The +.Fn meta +function turns on and off the generation of 8 bit characters by the +terminal, if +.Fa flag +is +.Dv FALSE +then only 7 bit characters will be returned, if +.Fa flag +is +.Dv TRUE +then 8 bit characters will be returned by the terminal. +.Pp +The +.Fn napms +causes the application to sleep for the number of milliseconds +specified by +.Fa ms . +.Pp +Calling +.Fn nl +will cause curses to map all carriage returns to newlines on input, +this functionality is enabled by default. +The +.Fn nonl +function disables this behaviour. +.Pp +The +.Fn cbreak +function will put the terminal into cbreak mode, which means that +characters will be returned one at a time instead of waiting for a +newline character, line discipline processing will be performed. +The +.Fn nocbreak +function disables this mode. +.Pp +Calling +.Fn halfdelay +puts the terminal into the same mode as +.Fn cbreak +with the exception that if no character is received within the specified +number of tenths of a second then the input routine will return +.Er ERR . +This mode can be cancelled by calling +.Fn nocbreak . +The valid range for the timeout is from 1 to 255 tenths of a second. +.Pp +The +.Fn noraw +function sets the input mode for the current terminal into Cooked mode, +that is input character translation and signal character processing is +performed. +The +.Fn raw +function puts the terminal into Raw mode, no input character +translation is done nor is signal character processing. +.Pp +The +.Fn typeahead +function controls the detection of typeahead during a refresh based on the +value of +.Va filedes : +.Bl -bullet -compact +.It +If +.Ar filedes +is a valid file descriptor, typeahead is enabled during refresh; +Curses periodically checks +.Ar filedes +for input and aborts the refresh if any character is available. +The value of +.Ar filedes +need not be the file descriptor on which the refresh is occurring. +.It +If +.Ar filedes +is \-1, Curses does not check for typeahead during refresh. +.El +.Pp +The terminal +tty flags can be saved by calling +.Fn savetty +and may be restored by calling +.Fn resetty , +the use of these functions is discouraged as they may cause the +terminal to be put into a state that is incompatible with curses +operation. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Dv OK +The function completed successfully. +.It Dv ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr getch 3 , +.Xr termios 4 +.Sh NOTES +The +.Fn idcok +and +.Fn idlok +currently have no effect on the curses code at all, currently curses +will always use the terminal insert character and insert line +capabilities if available. +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_underscore.3 b/vendor/netbsd-curses/libcurses/curses_underscore.3 new file mode 100644 index 0000000..4b3cfe4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_underscore.3 @@ -0,0 +1,100 @@ +.\" $NetBSD: curses_underscore.3,v 1.6 2018/09/29 21:52:29 kamil Exp $ +.\" Copyright (c) 2002 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Julian Coleman. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 29, 2018 +.Dt CURSES_UNDERSCORE 3 +.Os +.Sh NAME +.Nm curses_underscore , +.Nm underscore , +.Nm underend , +.Nm wunderscore , +.Nm wunderend +.Nd curses underscore attribute manipulation routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fn underscore void +.Ft int +.Fn underend void +.Ft int +.Fn wunderscore "WINDOW *" +.Ft int +.Fn wunderend "WINDOW *" +.Sh DESCRIPTION +These functions manipulate the underscore attribute on +.Dv stdscr +or on the specified window. +.Pp +The +.Fn underscore +function turns on the underscore attribute +on +.Dv stdscr . +The +.Fn underend +function turns off the underscore attribute on +.Dv stdscr . +.Pp +The +.Fn wunderscore +and +.Fn wunderend +functions +are equivalent to +.Fn underscore +and +.Fn underend , +respectively, excepting that the attribute is manipulated on the +window specified by +.Fa win . +.Pp +The +.Fn underscore +and +.Fn underend +functions +are equivalent to +.Fn wattron A_UNDERLINE +and +.Fn wattroff A_UNDERLINE , +respectively. +.Sh RETURN VALUES +These functions always return 1. +.Sh SEE ALSO +.Xr curses_attributes 3 , +.Xr curses_standout 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +These functions first appeared in +.Nx 1.5 . diff --git a/vendor/netbsd-curses/libcurses/curses_version.3 b/vendor/netbsd-curses/libcurses/curses_version.3 new file mode 100644 index 0000000..a0d01e8 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_version.3 @@ -0,0 +1,60 @@ +.\" $NetBSD: curses_version.3,v 1.1 2019/09/02 09:08:29 roy Exp $ +.\" +.\" Copyright (c) 2019 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Roy Marples. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" +.Dd August 29, 2019 +.Dt CURSES_VERSION 3 +.Os +.Sh NAME +.Nm curses_version +.Nd Curses version information +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft const char * +.Fn curses_version "void" +.Sh DESCRIPTION +The +.Fn curses_version +function returns a read-only string representing the version of the +.Nx +curses library. +This has no relation to the +.Nx +release it might have been taken from. +.Sh SEE ALSO +.Xr curses 3 +.Sh HISTORY +The +.Fn curses_version +function is a +.Em ncurses +extension to the Curses library and was added in +.Nx 10.0 . diff --git a/vendor/netbsd-curses/libcurses/curses_window.3 b/vendor/netbsd-curses/libcurses/curses_window.3 new file mode 100644 index 0000000..f13ab32 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/curses_window.3 @@ -0,0 +1,274 @@ +.\" $NetBSD: curses_window.3,v 1.16 2013/10/15 22:15:17 roy Exp $ +.\" +.\" Copyright (c) 2002 +.\" Brett Lymn (blymn@NetBSD.org, brett_lymn@yahoo.com.au) +.\" +.\" This code is donated to the NetBSD Foundation by the Author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" +.Dd October 15, 2013 +.Dt CURSES_WINDOW 3 +.Os +.Sh NAME +.Nm curses_window , +.Nm copywin , +.Nm dupwin , +.Nm delwin , +.Nm derwin , +.Nm mvwin , +.Nm mvderwin , +.Nm newwin , +.Nm overlay , +.Nm overwrite , +.Nm subwin , +.Nm wresize +.Nd curses window routines +.Sh LIBRARY +.Lb libcurses +.Sh SYNOPSIS +.In curses.h +.Ft int +.Fo copywin +.Fa "WINDOW *source" +.Fa "WINDOW *dest" +.Fa "int sminrow" +.Fa "int smincol" +.Fa "int dminrow" +.Fa "int dmincol" +.Fa "int dmaxrow" +.Fa "int dmaxcol" +.Fa "int overlay" +.Fc +.Ft WINDOW * +.Fn dupwin "WINDOW *win" +.Ft WINDOW * +.Fn derwin "WINDOW *win" "int lines" "int cols" "int y" "int x" +.Ft int +.Fn delwin "WINDOW *win" +.Ft int +.Fn mvwin "WINDOW *win" "int y" "int x" +.Ft int +.Fn mvderwin "WINDOW *win" "int y" "int x" +.Ft WINDOW * +.Fn newwin "int lines" "int cols" "int begin_y" "int begin_x" +.Ft WINDOW * +.Fn subwin "WINDOW *win" "int lines" "int cols" "int begin_y" "int begin_x" +.Ft int +.Fn overlay "WINDOW *source" "WINDOW *dest" +.Ft int +.Fn overwrite "WINDOW *source" "WINDOW *dest" +.Ft int +.Fn wresize "WINDOW *win" "int lines" "int cols" +.Sh DESCRIPTION +These functions create, modify and delete windows on the current screen. +.Pp +The contents of a window may be copied to another window by using the +.Fn copywin +function, a section of the destination window +.Fa dest +bounded by +.Fa (dminrow , +.Fa dmincol ) +and +.Fa (dmaxrow , +.Fa dmaxcol ) +will be overwritten with the contents of the window +.Fa source +starting at the coordinates +.Fa (sminrow , +.Fa smincol ) . +If the +.Fa overlay +flag is +.Dv TRUE +then only non-blank characters from +.Fa source +will be copied to +.Fa dest , +if +.Fa overlay +is +.Dv FALSE +then all characters from +.Fa source +will be copied to +.Fa dest . +If the bounding rectangles of either the source or the destination +windows lay outside the maximum size of the respective windows then +the size of the window copied will be adjusted to be within the bounds +of both the source and destination windows. +.Pp +The +.Fn dupwin +function creates an exact duplicate of +.Fa win +and returns a pointer to it. +.Pp +Calling +.Fn derwin +will create a subwindow of +.Fa win +in the same manner as +.Fn subwin +excepting that the starting column and row +.Fa y , +.Fa x +are relative to the parent window origin. +.Pp +A window may deleted and all resources freed by calling the +.Fn delwin +function with the pointer to the window to be deleted in +.Fa win . +If +.Fa win +is +.Dv NULL , +then no action occurs. +.Pp +A window can be moved to a new position by calling the +.Fn mvwin +function. +The +.Fa y +and +.Fa x +positions are the new origin of the window on the screen. +If the new position would cause the any part of the window to lie outside +the screen, it is an error and the window is not moved. +.Pp +A mapping of a region relative to the parent window may be created by +calling the +.Fn mvderwin +function, the +.Fa y +and +.Fa x +positions are relative to the origin of the parent window. +The screen offset of +.Fa win +is not updated, the characters beginning at +.Fa y , +.Fa x +for the area the size of +.Fa win +will be displayed at the screen offset of +.Fa win . +If the given window in +.Fa win +is not a subwindow then an error will be returned. +If the new position would cause the any part of the window to lie outside +the parent window, it is an error and the mapping is not updated. +.Pp +The +.Fn newwin +function creates a new window of size +.Fa lines , +.Fa cols +with an origin at +.Fa begin_y , +.Fa begin_x . +If +.Fa lines +is less than or equal to zero then the number of rows +for the window is set to +.Dv LINES - +.Fa begin_x ++ +.Fa lines . +Similarly if +.Fa cols +is less than or equal to zero then the number of columns +for the window is set to +.Dv COLS - +.Fa begin_y ++ +.Fa cols . +.Pp +.Fn subwin +is similar to +.Fn newwin +excepting that the size of the subwindow is bounded by the parent +window +.Fa win . +The subwindow shares internal data structures with the parent window +and will be refreshed when the parent window is refreshed. +The subwindow inherits the background character and attributes of the +parent window. +.Pp +The +.Fn overlay +function copies the contents of the source window +.Fa source +to the destination window +.Fa dest , +only the characters that are not the background character in the +source window are copied to the destination. +The windows need not be the same size, only the overlapping portion of both +windows will be copied. +The +.Fn overwrite +function performs the same functions as +.Fn overlay +excepting that characters from the source window are copied to the +destination without exception. +.Pp +.Fn wresize +resizes the specified window to the new number of lines and columns +given, all internal curses structures are resized. +Any subwindows of the specified window will also be resized if any part +of them falls outside the new parent window size. +The application must redraw the window after it has been resized. +Note that +.Dv curscr +and +.Dv stdscr +can not be resized to be larger than the size of the screen. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ERR -compact +.It Er OK +The function completed successfully. +.It Er ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr curses_fileio 3 , +.Xr curses_pad 3 , +.Xr curses_screen 3 +.Sh STANDARDS +The +.Nx +Curses library complies with the X/Open Curses specification, part of the +Single Unix Specification. +.Sh HISTORY +The Curses package appeared in +.Bx 4.0 . diff --git a/vendor/netbsd-curses/libcurses/def_prog_mode.3 b/vendor/netbsd-curses/libcurses/def_prog_mode.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/def_prog_mode.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/def_shell_mode.3 b/vendor/netbsd-curses/libcurses/def_shell_mode.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/def_shell_mode.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/define_key.3 b/vendor/netbsd-curses/libcurses/define_key.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/define_key.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/delay_output.3 b/vendor/netbsd-curses/libcurses/delay_output.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/delay_output.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/delch.3 b/vendor/netbsd-curses/libcurses/delch.3 new file mode 120000 index 0000000..ab881dc --- /dev/null +++ b/vendor/netbsd-curses/libcurses/delch.3 @@ -0,0 +1 @@ +curses_delch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/delch.c b/vendor/netbsd-curses/libcurses/delch.c new file mode 100644 index 0000000..89f4745 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/delch.c @@ -0,0 +1,141 @@ +/* $NetBSD: delch.c,v 1.26 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS +/* + * delch -- + * Do a delete-char on the line, leaving (cury, curx) unchanged. + */ +int +delch(void) +{ + return wdelch(stdscr); +} + +/* + * mvdelch -- + * Do a delete-char on the line at (y, x) on stdscr. + */ +int +mvdelch(int y, int x) +{ + return mvwdelch(stdscr, y, x); +} + +/* + * mvwdelch -- + * Do a delete-char on the line at (y, x) of the given window. + */ +int +mvwdelch(WINDOW *win, int y, int x) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wdelch(win); +} + +#endif + +/* + * wdelch -- + * Do a delete-char on the line, leaving (cury, curx) unchanged. + */ +int +wdelch(WINDOW *win) +{ + __LDATA *end, *temp1, *temp2; + +#ifndef HAVE_WCHAR + end = &win->alines[win->cury]->line[win->maxx - 1]; + temp1 = &win->alines[win->cury]->line[win->curx]; + temp2 = temp1 + 1; + while (temp1 < end) { + (void)memcpy(temp1, temp2, sizeof(__LDATA)); + temp1++, temp2++; + } + temp1->ch = win->bch; + if (__using_color && win != curscr) + temp1->attr = win->battr & __COLOR; + else + temp1->attr = 0; + __touchline(win, (int)win->cury, (int)win->curx, (int)win->maxx - 1); + return OK; +#else + int cw, sx; + nschar_t *np, *tnp; + + end = &win->alines[win->cury]->line[win->maxx - 1]; + sx = win->curx; + temp1 = &win->alines[win->cury]->line[win->curx]; + cw = WCOL(*temp1); + if (cw < 0) { + temp1 += cw; + sx += cw; + cw = WCOL(*temp1); + } + np = temp1->nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + temp1->nsp = NULL; + } + if (sx + cw < win->maxx) { + temp2 = temp1 + cw; + while (temp1 < end - (cw - 1)) { + (void)memcpy(temp1, temp2, sizeof(__LDATA)); + temp1++, temp2++; + } + } + while (temp1 <= end) { + temp1->ch = ( wchar_t )btowc((int) win->bch); + temp1->attr = 0; + if (_cursesi_copy_nsp(win->bnsp, temp1) == ERR) + return ERR; + SET_WCOL(*temp1, 1); + temp1++; + } + __touchline(win, (int)win->cury, sx, (int)win->maxx - 1); + __sync(win); + return OK; +#endif /* HAVE_WCHAR */ +} diff --git a/vendor/netbsd-curses/libcurses/deleteln.3 b/vendor/netbsd-curses/libcurses/deleteln.3 new file mode 120000 index 0000000..a4dda2a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/deleteln.3 @@ -0,0 +1 @@ +curses_deleteln.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/deleteln.c b/vendor/netbsd-curses/libcurses/deleteln.c new file mode 100644 index 0000000..4d704e1 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/deleteln.c @@ -0,0 +1,58 @@ +/* $NetBSD: deleteln.c,v 1.15 2017/01/06 13:53:18 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS +/* + * deleteln -- + * Delete a line from stdscr. It leaves (cury, curx) unchanged. + */ +int +deleteln(void) +{ + return winsdelln(stdscr, -1); +} + +#endif + +/* + * wdeleteln -- + * Delete a line from the screen. It leaves (cury, curx) unchanged. + */ +int +wdeleteln(WINDOW *win) +{ + return winsdelln(win, -1); +} diff --git a/vendor/netbsd-curses/libcurses/delscreen.3 b/vendor/netbsd-curses/libcurses/delscreen.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/delscreen.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/delwin.3 b/vendor/netbsd-curses/libcurses/delwin.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/delwin.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/delwin.c b/vendor/netbsd-curses/libcurses/delwin.c new file mode 100644 index 0000000..7afb2cd --- /dev/null +++ b/vendor/netbsd-curses/libcurses/delwin.c @@ -0,0 +1,113 @@ +/* $NetBSD: delwin.c,v 1.21 2019/04/01 11:39:15 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * delwin -- + * Delete a window and release it back to the system. + */ +int +delwin(WINDOW *win) +{ + WINDOW *wp, *np; + struct __winlist *wl, *pwl; + SCREEN *screen; + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "delwin(%p)\n", win); +#endif + + if (win == NULL) + return OK; + + /* + * Free any storage used by non-spacing characters in the window. + */ +#ifdef HAVE_WCHAR + __cursesi_win_free_nsp(win); +#endif + + if (win->orig == NULL) { + /* + * If we are the original window, delete the space for all + * the subwindows and the window space. + */ + free(win->wspace); + wp = win->nextp; + while (wp != win) { + np = wp->nextp; + delwin(wp); + wp = np; + } + /* Remove ourselves from the list of windows on the screen. */ + pwl = NULL; + screen = win->screen; + for (wl = screen->winlistp; wl; pwl = wl, wl = wl->nextp) { + if (wl->winp != win) + continue; + if (pwl != NULL) + pwl->nextp = wl->nextp; + else + screen->winlistp = wl->nextp; + free(wl); + break; + } + } else { + /* + * If we are a subwindow, take ourselves out of the list. + * NOTE: if we are a subwindow, the minimum list is orig + * followed by this subwindow, so there are always at least + * two windows in the list. + */ + for (wp = win->nextp; wp->nextp != win; wp = wp->nextp) + continue; + wp->nextp = win->nextp; + } + free(win->lspace); + free(win->alines); + if (win == _cursesi_screen->curscr) + _cursesi_screen->curscr = NULL; + if (win == _cursesi_screen->stdscr) + _cursesi_screen->stdscr = NULL; + if (win == _cursesi_screen->__virtscr) + _cursesi_screen->__virtscr = NULL; + if (win->fp) + fclose(win->fp); + free(win->buf); + free(win); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/derwin.3 b/vendor/netbsd-curses/libcurses/derwin.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/derwin.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/doupdate.3 b/vendor/netbsd-curses/libcurses/doupdate.3 new file mode 120000 index 0000000..7a991d5 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/doupdate.3 @@ -0,0 +1 @@ +curses_refresh.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/dupwin.3 b/vendor/netbsd-curses/libcurses/dupwin.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/dupwin.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/echo.3 b/vendor/netbsd-curses/libcurses/echo.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/echo.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/echo_wchar.c b/vendor/netbsd-curses/libcurses/echo_wchar.c new file mode 100644 index 0000000..516345e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/echo_wchar.c @@ -0,0 +1,82 @@ +/* $NetBSD: echo_wchar.c,v 1.3 2018/11/22 22:16:45 uwe Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * echo_wchar -- + * Echo wide character and attributes on stdscr and refresh stdscr. + */ +int +echo_wchar(const cchar_t *wch) +{ + return wecho_wchar(stdscr, wch); +} + +/* + * echo_wchar -- + * Echo wide character and attributes on "win" and refresh "win". + */ +int +wecho_wchar(WINDOW *win, const cchar_t *wch) +{ + int retval; + + retval = wadd_wch(win, wch); + if (retval == OK) + retval = wrefresh(win); + return retval; +} + +/* + * pecho_wchar -- + * Echo character and attributes on "pad" and refresh "pad" at + * its previous position on the screen. + */ +int +pecho_wchar(WINDOW *pad, const cchar_t *wch) +{ + int retval; + + retval = wadd_wch(pad, wch); + if (retval == OK) + retval = prefresh(pad, pad->pbegy, pad->pbegx, + pad->sbegy, pad->sbegx, pad->smaxy, pad->smaxx); + return retval; +} diff --git a/vendor/netbsd-curses/libcurses/echochar.3 b/vendor/netbsd-curses/libcurses/echochar.3 new file mode 120000 index 0000000..2572961 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/echochar.3 @@ -0,0 +1 @@ +curses_echochar.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/echochar.c b/vendor/netbsd-curses/libcurses/echochar.c new file mode 100644 index 0000000..f7acb8b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/echochar.c @@ -0,0 +1,80 @@ +/* $NetBSD: echochar.c,v 1.2 2008/04/29 06:53:01 martin Exp $ */ + +/*- + * Copyright (c) 2004 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS +/* + * echochar -- + * Echo character and attributes on stdscr and refresh stdscr. + */ +int +echochar(const chtype ch) +{ + + return wechochar(stdscr, ch); +} +#endif /* _CURSES_USE_MACROS */ + +/* + * echochar -- + * Echo character and attributes on "win" and refresh "win". + */ +int +wechochar(WINDOW *win, const chtype ch) +{ + int retval; + + retval = waddch(win, ch); + if (retval == OK) + retval = wrefresh(win); + return retval; +} + +/* + * pechochar -- + * Echo character and attributes on "pad" and refresh "pad" at + * its previous position on the screen. + */ +int +pechochar(WINDOW *pad, const chtype ch) +{ + int retval; + + retval = waddch(pad, ch); + if (retval == OK) + retval = prefresh(pad, pad->pbegy, pad->pbegx, + pad->sbegy, pad->sbegx, pad->smaxy, pad->smaxx); + return retval; +} diff --git a/vendor/netbsd-curses/libcurses/endwin.3 b/vendor/netbsd-curses/libcurses/endwin.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/endwin.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/erase.3 b/vendor/netbsd-curses/libcurses/erase.3 new file mode 120000 index 0000000..a92e1eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/erase.3 @@ -0,0 +1 @@ +curses_clear.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/erase.c b/vendor/netbsd-curses/libcurses/erase.c new file mode 100644 index 0000000..910c8cb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/erase.c @@ -0,0 +1,102 @@ +/* $NetBSD: erase.c,v 1.32 2020/03/15 01:18:43 uwe Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * erase -- + * Erases everything on stdscr. + */ +int +erase(void) +{ + return werase(stdscr); +} + +#endif + +/* + * werase -- + * Erases everything on the window. + */ +int +werase(WINDOW *win) +{ + int y; + __LDATA *sp, *end, *start; + wchar_t bch; + attr_t battr; + +#ifdef DEBUG + __CTRACE(__CTRACE_ERASE, "werase: (%p)\n", win); +#endif +#ifdef HAVE_WCHAR + bch = (wchar_t)btowc((int)win->bch); +#else + bch = win->bch; +#endif + if (win != curscr) + battr = win->battr & __ATTRIBUTES; + else + battr = 0; + + for (y = 0; y < win->maxy; y++) { + start = win->alines[y]->line; + end = &start[win->maxx]; + for (sp = start; sp < end; sp++) { + if (!(__NEED_ERASE(sp, bch, battr))) + continue; + + sp->ch = bch; + sp->attr = battr | (sp->attr & __ALTCHARSET); +#ifdef HAVE_WCHAR + if (_cursesi_copy_nsp(win->bnsp, sp) == ERR) + return ERR; + SET_WCOL(*sp, 1); +#endif + } + } + + /* + * Mark the whole window as changed in case we have overlapping + * windows - this will result in the (intended) clearing of the + * screen over the area covered by the window. */ + __touchwin(win); + wmove(win, 0, 0); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/erasechar.3 b/vendor/netbsd-curses/libcurses/erasechar.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/erasechar.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/fileio.c b/vendor/netbsd-curses/libcurses/fileio.c new file mode 100644 index 0000000..747526d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/fileio.c @@ -0,0 +1,246 @@ +/* $NetBSD: fileio.c,v 1.7 2020/02/24 12:20:29 rin Exp $ */ + +/*- + * Copyright (c) 2008 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" +#include "fileio.h" +#include +#include + +#ifdef HAVE_WCHAR +static int __putnsp(nschar_t *, FILE *); +static int __getnsp(nschar_t *, FILE *); +#endif /* HAVE_WCHAR */ + +#ifdef HAVE_WCHAR +/* + * __putnsp -- + * Write non-spacing character chain to file, consisting of: + * ((int) 1, (wchar_t) ch) pairs followed by (int) 0. + */ +static int +__putnsp(nschar_t *nsp, FILE *fp) +{ + int n; + + n = 1; + while (nsp != NULL) { + if (fwrite(&n, sizeof(int), 1, fp) != 1) + return ERR; + if (fwrite(&nsp->ch, sizeof(wchar_t), 1, fp) != 1) + return ERR; + } + n = 0; + if (fwrite(&n, sizeof(int), 1, fp) != 1) + return ERR; + + return OK; +} +#endif /* HAVE_WCHAR */ + +/* + * putwin -- + * Write window data to file + */ +int +putwin(WINDOW *win, FILE *fp) +{ + int major = CURSES_LIB_MAJOR; + int minor = CURSES_LIB_MINOR; + int y, x; + __LDATA *sp; + +#ifdef DEBUG + __CTRACE(__CTRACE_FILEIO, "putwin: win %p\n", win); +#endif + + if (win == NULL) + return ERR; + + /* win can't be a subwin */ + if (win->orig != NULL) + return ERR; + + /* Library version */ + if (fwrite(&major, sizeof(int), 1, fp) != 1) + return ERR; + if (fwrite(&minor, sizeof(int), 1, fp) != 1) + return ERR; + + /* Window parameters */ + if (fwrite(win, sizeof(WINDOW), 1, fp) != 1) + return ERR; +#ifdef HAVE_WCHAR + /* Background non-spacing character */ + if (__putnsp(win->bnsp, fp) == ERR) + return ERR; +#endif /* HAVE_WCHAR */ + + /* Lines and line data */ + for (y = 0; y < win->maxy; y++) + for (sp = win->alines[y]->line, x = 0; x < win->maxx; + x++, sp++) { + if (fwrite(&sp->ch, sizeof(wchar_t), 1, fp) != 1) + return ERR; + if (fwrite(&sp->attr, sizeof(attr_t), 1, fp) != 1) + return ERR; +#ifdef HAVE_WCHAR + if (sp->nsp != NULL) { + if (__putnsp(win->bnsp, fp) == ERR) + return ERR; + } +#endif /* HAVE_WCHAR */ + } + + return OK; +} + +#ifdef HAVE_WCHAR +/* + * __getnsp -- + * Read non-spacing character chain from file + */ +static int +__getnsp(nschar_t *nsp, FILE *fp) +{ + int n; + nschar_t *onsp, *tnsp; + + if (fread(&n, sizeof(int), 1, fp) != 1) + return ERR; + onsp = nsp; + while (n != 0) { + tnsp = malloc(sizeof(nschar_t)); + if (tnsp == NULL) { + __cursesi_free_nsp(nsp); + return OK; + } + if (fread(&tnsp->ch, sizeof(wchar_t), 1, fp) != 1) { + __cursesi_free_nsp(nsp); + return OK; + } + tnsp->next = NULL; + onsp->next = tnsp; + onsp = onsp->next; + if (fread(&n, sizeof(int), 1, fp) != 1) { + __cursesi_free_nsp(nsp); + return ERR; + } + } + return OK; +} +#endif /* HAVE_WCHAR */ + +/* + * getwin -- + * Read window data from file + */ +WINDOW * +getwin(FILE *fp) +{ + int major, minor; + WINDOW *wtmp, *win; + int y, x; + __LDATA *sp; + +#ifdef DEBUG + __CTRACE(__CTRACE_FILEIO, "getwin\n"); +#endif + + /* Check library version */ + if (fread(&major, sizeof(int), 1, fp) != 1) + return NULL; + if (fread(&minor, sizeof(int), 1, fp) != 1) + return NULL; + if(major != CURSES_LIB_MAJOR || minor != CURSES_LIB_MINOR) + return NULL; + + /* Window parameters */ + wtmp = malloc(sizeof(WINDOW)); + if (wtmp == NULL) + return NULL; + if (fread(wtmp, sizeof(WINDOW), 1, fp) != 1) + goto error0; + win = __newwin(_cursesi_screen, wtmp->maxy, wtmp->maxx, + wtmp->begy, wtmp->begx, FALSE, FALSE); + if (win == NULL) + goto error0; + win->cury = wtmp->cury; + win->curx = wtmp->curx; + win->reqy = wtmp->reqy; + win->reqx = wtmp->reqx; + win->flags = wtmp->flags; + win->delay = wtmp->delay; + win->wattr = wtmp->wattr; + win->bch = wtmp->bch; + win->battr = wtmp->battr; + win->scr_t = wtmp->scr_t; + win->scr_b = wtmp->scr_b; + free(wtmp); + wtmp = NULL; + __swflags(win); + +#ifdef HAVE_WCHAR + if (__getnsp(win->bnsp, fp) == ERR) + goto error1; +#endif /* HAVE_WCHAR */ + + /* Lines and line data */ + for (y = 0; y < win->maxy; y++) { + for (sp = win->alines[y]->line, x = 0; x < win->maxx; + x++, sp++) { + if (fread(&sp->ch, sizeof(wchar_t), 1, fp) != 1) + goto error1; + if (fread(&sp->attr, sizeof(attr_t), 1, fp) != 1) + goto error1; +#ifdef HAVE_WCHAR + if (sp->nsp != NULL) { + if (__getnsp(win->bnsp, fp) == ERR) + goto error1; + } +#endif /* HAVE_WCHAR */ + } + __touchline(win, y, 0, (int) win->maxx - 1); + } +#ifdef DEBUG + __CTRACE(__CTRACE_FILEIO, "getwin: win = %p\n", win); +#endif + return win; + +error1: + delwin(win); +error0: + if (wtmp) + free(wtmp); + return NULL; +} diff --git a/vendor/netbsd-curses/libcurses/fileio.h b/vendor/netbsd-curses/libcurses/fileio.h new file mode 100644 index 0000000..bd44b09 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/fileio.h @@ -0,0 +1,8 @@ +/* + * Do not edit! Automatically generated file: + * from: NetBSD: shlib_version,v 1.43 2018/11/16 10:12:00 blymn Exp + * by : NetBSD: genfileioh.awk,v 1.2 2008/05/02 11:13:02 martin Exp + */ + +#define CURSES_LIB_MAJOR 8 +#define CURSES_LIB_MINOR 2 diff --git a/vendor/netbsd-curses/libcurses/filter.3 b/vendor/netbsd-curses/libcurses/filter.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/filter.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/flash.3 b/vendor/netbsd-curses/libcurses/flash.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/flash.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/flushinp.3 b/vendor/netbsd-curses/libcurses/flushinp.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/flushinp.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/flushok.3 b/vendor/netbsd-curses/libcurses/flushok.3 new file mode 120000 index 0000000..7a991d5 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/flushok.3 @@ -0,0 +1 @@ +curses_refresh.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/flushok.c b/vendor/netbsd-curses/libcurses/flushok.c new file mode 100644 index 0000000..41b923c --- /dev/null +++ b/vendor/netbsd-curses/libcurses/flushok.c @@ -0,0 +1,49 @@ +/* $NetBSD: flushok.c,v 1.6 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * flushok -- + * Turn on and off Fflush(stdout) after refresh for the given window. + */ +int +flushok(WINDOW *win, bool bf) +{ + if (bf) + win->flags |= __FLUSH; + else + win->flags &= ~__FLUSH; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/fullname.3 b/vendor/netbsd-curses/libcurses/fullname.3 new file mode 120000 index 0000000..c25ebb6 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/fullname.3 @@ -0,0 +1 @@ +curses_termcap.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/fullname.c b/vendor/netbsd-curses/libcurses/fullname.c new file mode 100644 index 0000000..ded8fe4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/fullname.c @@ -0,0 +1,57 @@ +/* $NetBSD: fullname.c,v 1.12 2017/01/06 13:53:18 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" + +/* + * fullname -- + * This routine fills in "def" with the full name of the terminal. + * This is assumed to be the last name in the list of aliases. + */ +char * +fullname(const char *bp, char *def) +{ + char *cp; + + *def = '\0'; /* In case no name. */ + + while (*bp && *bp != ':') { + cp = def; /* Start of answer. */ + while (*bp && *bp != ':' && *bp != '|') + *cp++ = *bp++; /* Copy name over. */ + *cp = '\0'; /* Zero end of name. */ + if (*bp == '|') + bp++; /* Skip over '|' if that is case. */ + } + return def; +} diff --git a/vendor/netbsd-curses/libcurses/genfileioh.awk b/vendor/netbsd-curses/libcurses/genfileioh.awk new file mode 100644 index 0000000..3106d4d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/genfileioh.awk @@ -0,0 +1,66 @@ +#!/usr/bin/awk -F +# +# $NetBSD: genfileioh.awk,v 1.2 2008/05/02 11:13:02 martin Exp $ +# +# Copyright (c) 2008 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Julian Coleman. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +function mangle_vers(vers) { + sub("^.*\\$NetBSD", "NetBSD", vers); + sub("\\$[^$]*$", "", vers); + return vers; +} + +BEGIN { + MYVER="$NetBSD: genfileioh.awk,v 1.2 2008/05/02 11:13:02 martin Exp $"; + MYVER=mangle_vers(MYVER); +} + +{ + if ($0 ~/\$NetBSD:/) { + SHVER=mangle_vers($0); + } + if ($1 ~ /^major=/) { + MAJ=$1; + sub("^major=", "", MAJ); + } + if ($1 ~ /^minor=/) { + MIN=$1; + sub("^minor=", "", MIN); + } +} + +END { + printf("/*\n"); + printf(" * Do not edit! Automatically generated file:\n"); + printf(" * from: %s\n", SHVER); + printf(" * by : %s\n", MYVER); + printf(" */\n"); + printf("\n"); + printf("#define CURSES_LIB_MAJOR %s\n", MAJ); + printf("#define CURSES_LIB_MINOR %s\n", MIN); +} diff --git a/vendor/netbsd-curses/libcurses/get_wch.c b/vendor/netbsd-curses/libcurses/get_wch.c new file mode 100644 index 0000000..7f99c68 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/get_wch.c @@ -0,0 +1,663 @@ +/* $NetBSD: get_wch.c,v 1.24 2020/07/06 23:33:38 uwe Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include "curses.h" +#include "curses_private.h" +#include "keymap.h" + +static short wstate; /* state of the wcinkey function */ +extern short _cursesi_state; /* storage declared in getch.c */ + +/* prototypes for private functions */ +static int inkey(wchar_t *wc, int to, int delay); +static wint_t __fgetwc_resize(FILE *infd, bool *resized); + +/* + * __init_get_wch - initialise all the pointers & structures needed to make + * get_wch work in keypad mode. + * + */ +void +__init_get_wch(SCREEN *screen) +{ + wstate = INKEY_NORM; + memset(&screen->cbuf, 0, sizeof(screen->cbuf)); + screen->cbuf_head = screen->cbuf_tail = screen->cbuf_cur = 0; +} + + +/* + * inkey - do the work to process keyboard input, check for multi-key + * sequences and return the appropriate symbol if we get a match. + * + */ +static int +inkey(wchar_t *wc, int to, int delay) +{ + wchar_t k = 0; + int c, mapping, ret = 0; + size_t mlen = 0; + keymap_t *current = _cursesi_screen->base_keymap; + FILE *infd = _cursesi_screen->infd; + int *start = &_cursesi_screen->cbuf_head, + *working = &_cursesi_screen->cbuf_cur, + *end = &_cursesi_screen->cbuf_tail; + char *inbuf = &_cursesi_screen->cbuf[ 0 ]; + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "inkey (%p, %d, %d)\n", wc, to, delay); +#endif + for (;;) { /* loop until we get a complete key sequence */ + if (wstate == INKEY_NORM) { + if (delay && __timeout(delay) == ERR) + return ERR; + c = __fgetc_resize(infd); + if (c == ERR || c == KEY_RESIZE) { + clearerr(infd); + return c; + } + + if (delay && (__notimeout() == ERR)) + return ERR; + + k = (wchar_t)c; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey (wstate normal) got '%s'\n", unctrl(k)); +#endif + + inbuf[*end] = k; + *end = (*end + 1) % MAX_CBUF_SIZE; + *working = *start; + wstate = INKEY_ASSEMBLING; /* go to assembling state */ +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: NORM=>ASSEMBLING: start(%d), " + "current(%d), end(%d)\n", *start, *working, *end); +#endif /* DEBUG */ + } else if (wstate == INKEY_BACKOUT) { + k = inbuf[*working]; + *working = (*working + 1) % MAX_CBUF_SIZE; + if (*working == *end) { /* see if run out of keys */ + /* if so, switch to assembling */ + wstate = INKEY_ASSEMBLING; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: BACKOUT=>ASSEMBLING, start(%d), " + "current(%d), end(%d)\n", + *start, *working, *end); +#endif /* DEBUG */ + } + } else if (wstate == INKEY_ASSEMBLING) { + /* assembling a key sequence */ + if (delay) { + if (__timeout(to ? (ESCDELAY / 100) : delay) + == ERR) + return ERR; + } else { + if (to && (__timeout(ESCDELAY / 100) == ERR)) + return ERR; + } + + c = __fgetc_resize(infd); + if (ferror(infd)) { + clearerr(infd); + return c; + } + + if ((to || delay) && (__notimeout() == ERR)) + return ERR; + + k = (wchar_t)c; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey (wstate assembling) got '%s'\n", unctrl(k)); +#endif /* DEBUG */ + if (feof(infd)) { /* inter-char T/O, start backout */ + clearerr(infd); + if (*start == *end) + /* no chars in the buffer, restart */ + continue; + + k = inbuf[*start]; + wstate = INKEY_TIMEOUT; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: ASSEMBLING=>TIMEOUT, start(%d), " + "current(%d), end(%d)\n", + *start, *working, *end); +#endif /* DEBUG */ + } else { + inbuf[*end] = k; + *working = *end; + *end = (*end + 1) % MAX_CBUF_SIZE; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: ASSEMBLING: start(%d), " + "current(%d), end(%d)", + *start, *working, *end); +#endif /* DEBUG */ + } + } else if (wstate == INKEY_WCASSEMBLING) { + /* assembling a wide-char sequence */ + if (delay) { + if (__timeout(to ? (ESCDELAY / 100) : delay) + == ERR) + return ERR; + } else { + if (to && (__timeout(ESCDELAY / 100) == ERR)) + return ERR; + } + + c = __fgetc_resize(infd); + if (ferror(infd)) { + clearerr(infd); + return c; + } + + if ((to || delay) && (__notimeout() == ERR)) + return ERR; + + k = (wchar_t)c; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey (wstate wcassembling) got '%s'\n", + unctrl(k)); +#endif + if (feof(infd)) { /* inter-char T/O, start backout */ + clearerr(infd); + if (*start == *end) + /* no chars in the buffer, restart */ + continue; + + *wc = inbuf[*start]; + *working = *start = (*start +1) % MAX_CBUF_SIZE; + if (*start == *end) { + _cursesi_state = wstate = INKEY_NORM; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: WCASSEMBLING=>NORM, " + "start(%d), current(%d), end(%d)", + *start, *working, *end); +#endif /* DEBUG */ + } else { + _cursesi_state = wstate = INKEY_BACKOUT; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: WCASSEMBLING=>BACKOUT, " + "start(%d), current(%d), end(%d)", + *start, *working, *end); +#endif /* DEBUG */ + } + return OK; + } else { + /* assembling wide characters */ + inbuf[*end] = k; + *working = *end; + *end = (*end + 1) % MAX_CBUF_SIZE; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: WCASSEMBLING[head(%d), " + "urrent(%d), tail(%d)]\n", + *start, *working, *end); +#endif /* DEBUG */ + ret = (int)mbrtowc(wc, inbuf + (*working), 1, + &_cursesi_screen->sp); +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: mbrtowc returns %d, wc(%x)\n", + ret, *wc); +#endif /* DEBUG */ + if (ret == -2) { + *working = (*working+1) % MAX_CBUF_SIZE; + continue; + } + if ( ret == 0 ) + ret = 1; + if ( ret == -1 ) { + /* return the 1st character we know */ + *wc = inbuf[*start]; + *working = *start = (*start + 1) % MAX_CBUF_SIZE; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: Invalid wide char(%x) " + "[head(%d), current(%d), " + "tail(%d)]\n", + *wc, *start, *working, *end); +#endif /* DEBUG */ + } else { /* > 0 */ + /* return the wide character */ + *start = *working + = (*working + ret)%MAX_CBUF_SIZE; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: Wide char found(%x) " + "[head(%d), current(%d), " + "tail(%d)]\n", + *wc, *start, *working, *end); +#endif /* DEBUG */ + } + + if (*start == *end) { + /* only one char processed */ + _cursesi_state = wstate = INKEY_NORM; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: WCASSEMBLING=>NORM, " + "start(%d), current(%d), end(%d)", + *start, *working, *end); +#endif /* DEBUG */ + } else { + /* otherwise we must have more than + * one char to backout */ + _cursesi_state = wstate = INKEY_BACKOUT; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: WCASSEMBLING=>BACKOUT, " + "start(%d), current(%d), end(%d)", + *start, *working, *end); +#endif /* DEBUG */ + } + return OK; + } + } else { + fprintf(stderr, "Inkey wstate screwed - exiting!!!"); + exit(2); + } + + /* + * Check key has no special meaning and we have not + * timed out and the key has not been disabled + */ + mapping = current->mapping[k]; + if (((wstate == INKEY_TIMEOUT) || (mapping < 0)) + || ((current->key[mapping]->type + == KEYMAP_LEAF) + && (current->key[mapping]->enable == FALSE))) + { + /* wide-character specific code */ +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: Checking for wide char\n"); +#endif /* DEBUG */ + mbrtowc( NULL, NULL, 1, &_cursesi_screen->sp ); + *working = *start; + mlen = *end > *working ? + *end - *working : MAX_CBUF_SIZE - *working; + if (!mlen) + return ERR; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: Check wide char[head(%d), " + "current(%d), tail(%d), mlen(%ld)]\n", + *start, *working, *end, (long) mlen); +#endif /* DEBUG */ + ret = (int)mbrtowc(wc, inbuf + (*working), mlen, + &_cursesi_screen->sp); +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: mbrtowc returns %d, wc(%x)\n", ret, *wc); +#endif /* DEBUG */ + if (ret == -2 && *end < *working) { + /* second half of a wide character */ + *working = 0; + mlen = *end; + if (mlen) + ret = (int)mbrtowc(wc, inbuf, mlen, + &_cursesi_screen->sp); + } + if (ret == -2 && wstate != INKEY_TIMEOUT) { + *working = (*working + (int) mlen) + % MAX_CBUF_SIZE; + wstate = INKEY_WCASSEMBLING; + continue; + } + if (ret == 0) + ret = 1; + if (ret == -1) { + /* return the first key we know about */ + *wc = inbuf[*start]; + *working = *start + = (*start + 1) % MAX_CBUF_SIZE; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: Invalid wide char(%x)[head(%d), " + "current(%d), tail(%d)]\n", + *wc, *start, *working, *end); +#endif /* DEBUG */ + } else { /* > 0 */ + /* return the wide character */ + *start = *working + = (*working + ret) % MAX_CBUF_SIZE; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: Wide char found(%x)[head(%d), " + "current(%d), tail(%d)]\n", + *wc, *start, *working, *end); +#endif /* DEBUG */ + } + + if (*start == *end) { /* only one char processed */ + _cursesi_state = wstate = INKEY_NORM; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: Empty cbuf=>NORM, " + "start(%d), current(%d), end(%d)\n", + *start, *working, *end); +#endif /* DEBUG */ + } else { + /* otherwise we must have more than one + * char to backout */ + _cursesi_state = wstate = INKEY_BACKOUT; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: Non-empty cbuf=>BACKOUT, " + "start(%d), current(%d), end(%d)\n", + *start, *working, *end); +#endif /* DEBUG */ + } + return OK; + } else { /* must be part of a multikey sequence */ + /* check for completed key sequence */ + if (current->key[current->mapping[k]]->type + == KEYMAP_LEAF) { + /* eat the key sequence in cbuf */ + *start = *working = ( *working + 1 ) + % MAX_CBUF_SIZE; + + /* check if inbuf empty now */ +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey: Key found(%s)\n", + key_name(current->key[mapping]->value.symbol)); +#endif /* DEBUG */ + if (*start == *end) { + /* if it is go back to normal */ + _cursesi_state = wstate = INKEY_NORM; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "[inkey]=>NORM, start(%d), " + "current(%d), end(%d)", + *start, *working, *end); +#endif /* DEBUG */ + } else { + /* otherwise go to backout state */ + _cursesi_state = wstate = INKEY_BACKOUT; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "[inkey]=>BACKOUT, start(%d), " + "current(%d), end(%d)", + *start, *working, *end ); +#endif /* DEBUG */ + } + + /* return the symbol */ + *wc = current->key[mapping]->value.symbol; + return KEY_CODE_YES; + } else { + /* Step to next part of multi-key sequence */ + current = current->key[current->mapping[k]]->value.next; + } + } + } +} + +/* + * get_wch -- + * Read in a wide character from stdscr. + */ +int +get_wch(wint_t *ch) +{ + return wget_wch(stdscr, ch); +} + +/* + * mvget_wch -- + * Read in a character from stdscr at the given location. + */ +int +mvget_wch(int y, int x, wint_t *ch) +{ + return mvwget_wch(stdscr, y, x, ch); +} + +/* + * mvwget_wch -- + * Read in a character from stdscr at the given location in the + * given window. + */ +int +mvwget_wch(WINDOW *win, int y, int x, wint_t *ch) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wget_wch(win, ch); +} + +/* + * wget_wch -- + * Read in a wide character from the window. + */ +int +wget_wch(WINDOW *win, wint_t *ch) +{ + int ret, weset; + int c; + FILE *infd = _cursesi_screen->infd; + cchar_t wc; + wchar_t inp, ws[2]; + + if (!(win->flags & __SCROLLOK) + && (win->flags & __FULLWIN) + && win->curx == win->maxx - 1 + && win->cury == win->maxy - 1 + && __echoit) + return ERR; + + if (!(win->flags & __ISPAD) && is_wintouched(win)) + wrefresh(win); +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wget_wch: __echoit = %d, " + "__rawmode = %d, __nl = %d, flags = %#.4x\n", + __echoit, __rawmode, _cursesi_screen->nl, win->flags); +#endif + if (_cursesi_screen->resized) { + resizeterm(LINES, COLS); + _cursesi_screen->resized = 0; + *ch = KEY_RESIZE; + return KEY_CODE_YES; + } + if (_cursesi_screen->unget_pos) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wget_wch returning char at %d\n", + _cursesi_screen->unget_pos); +#endif + _cursesi_screen->unget_pos--; + *ch = _cursesi_screen->unget_list[_cursesi_screen->unget_pos]; + if (__echoit) { + ws[0] = *ch, ws[1] = L'\0'; + setcchar(&wc, ws, win->wattr, 0, NULL); + wadd_wch(win, &wc); + } + return KEY_CODE_YES; + } + if (__echoit && !__rawmode) { + cbreak(); + weset = 1; + } else + weset = 0; + + __save_termios(); + + if (win->flags & __KEYPAD) { + switch (win->delay) { + case -1: + ret = inkey(&inp, + win->flags & __NOTIMEOUT ? 0 : 1, 0); + break; + case 0: + if (__nodelay() == ERR) + return ERR; + ret = inkey(&inp, 0, 0); + break; + default: + ret = inkey(&inp, + win->flags & __NOTIMEOUT ? 0 : 1, + win->delay); + break; + } + if ( ret == ERR ) + return ERR; + } else { + bool resized; + + switch (win->delay) { + case -1: + break; + case 0: + if (__nodelay() == ERR) + return ERR; + break; + default: + if (__timeout(win->delay) == ERR) + return ERR; + break; + } + + c = __fgetwc_resize(infd, &resized); + if (c == WEOF) { + clearerr(infd); + __restore_termios(); + if (resized) { + *ch = KEY_RESIZE; + return KEY_CODE_YES; + } else + return ERR; + } else { + ret = c; + inp = c; + } + } +#ifdef DEBUG + if (inp > 255) + /* we have a key symbol - treat it differently */ + /* XXXX perhaps __unctrl should be expanded to include + * XXXX the keysyms in the table.... + */ + __CTRACE(__CTRACE_INPUT, "wget_wch assembled keysym 0x%x\n", + inp); + else + __CTRACE(__CTRACE_INPUT, "wget_wch got '%s'\n", unctrl(inp)); +#endif + if (win->delay > -1) { + if (__delay() == ERR) + return ERR; + } + + __restore_termios(); + + if (__echoit) { + if ( ret == KEY_CODE_YES ) { + /* handle [DEL], [BS], and [LEFT] */ + if ( win->curx && + ( inp == KEY_DC || + inp == KEY_BACKSPACE || + inp == KEY_LEFT )) { + wmove( win, win->cury, win->curx - 1); + wdelch( win ); + } + } else { + ws[ 0 ] = inp, ws[ 1 ] = L'\0'; + setcchar( &wc, ws, win->wattr, 0, NULL ); + wadd_wch( win, &wc ); + } + } + + if (weset) + nocbreak(); + + if (_cursesi_screen->nl && inp == 13) + inp = 10; + + *ch = inp; + + if ( ret == KEY_CODE_YES ) + return KEY_CODE_YES; + return inp < 0 ? ERR : OK; +} + +/* + * unget_wch -- + * Put the wide character back into the input queue. + */ +int +unget_wch(const wchar_t c) +{ + return __unget((wint_t)c); +} + +/* + * __fgetwc_resize -- + * Any call to fgetwc(3) should use this function instead. + */ +static wint_t +__fgetwc_resize(FILE *infd, bool *resized) +{ + wint_t c; + + c = fgetwc(infd); + if (c != WEOF) + return c; + + if (!ferror(infd) || errno != EINTR || !_cursesi_screen->resized) + return ERR; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "__fgetwc_resize returning KEY_RESIZE\n"); +#endif + resizeterm(LINES, COLS); + _cursesi_screen->resized = 0; + *resized = true; + return c; +} diff --git a/vendor/netbsd-curses/libcurses/get_wstr.c b/vendor/netbsd-curses/libcurses/get_wstr.c new file mode 100644 index 0000000..7b2ca1f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/get_wstr.c @@ -0,0 +1,252 @@ +/* $NetBSD: get_wstr.c,v 1.8 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* prototypes for private functions */ +static int __wgetn_wstr(WINDOW *, wchar_t *, int); + +/* + * getn_wstr -- + * Get a string (of maximum n) characters from stdscr starting at + * (cury, curx). + */ +int +getn_wstr(wchar_t *wstr, int n) +{ + return wgetn_wstr(stdscr, wstr, n); +} + +/* + * get_wstr -- + * Get a string from stdscr starting at (cury, curx). + */ +__warn_references(get_wstr, + "warning: this program uses get_wstr(), which is unsafe."); +int +get_wstr(wchar_t *wstr) +{ + return wget_wstr(stdscr, wstr); +} + +/* + * mvgetn_wstr -- + * Get a string (of maximum n) characters from stdscr starting at (y, x). + */ +int +mvgetn_wstr(int y, int x, wchar_t *wstr, int n) +{ + return mvwgetn_wstr(stdscr, y, x, wstr, n); +} + +/* + * mvget_wstr -- + * Get a string from stdscr starting at (y, x). + */ +__warn_references(mvget_wstr, + "warning: this program uses mvget_wstr(), which is unsafe."); +int +mvget_wstr(int y, int x, wchar_t *wstr) +{ + return mvwget_wstr(stdscr, y, x, wstr); +} + +/* + * mvwgetn_wstr -- + * Get a string (of maximum n) characters from the given window starting + * at (y, x). + */ +int +mvwgetn_wstr(WINDOW *win, int y, int x, wchar_t *wstr, int n) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wgetn_wstr(win, wstr, n); +} + +/* + * mvwget_wstr -- + * Get a string from the given window starting at (y, x). + */ +__warn_references(mvget_wstr, + "warning: this program uses mvget_wstr(), which is unsafe."); +int +mvwget_wstr(WINDOW *win, int y, int x, wchar_t *wstr) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wget_wstr(win, wstr); +} + +/* + * wget_wstr -- + * Get a string starting at (cury, curx). + */ +__warn_references(wget_wstr, + "warning: this program uses wget_wstr(), which is unsafe."); +int +wget_wstr(WINDOW *win, wchar_t *wstr) +{ + return __wgetn_wstr(win, wstr, -1); +} + +/* + * wgetn_wstr -- + * Get a string starting at (cury, curx). + * Note that n < 2 means that we return ERR (SUSv2 specification). + */ +int +wgetn_wstr(WINDOW *win, wchar_t *wstr, int n) +{ + if (n < 1) + return ERR; + if (n == 1) { + wstr[0] = L'\0'; + return ERR; + } + return __wgetn_wstr(win, wstr, n); +} + +/* + * __wgetn_wstr -- + * The actual implementation. + * Note that we include a trailing L'\0' for safety, so str will contain + * at most n - 1 other characters. + */ +int +__wgetn_wstr(WINDOW *win, wchar_t *wstr, int n) +{ + wchar_t *ostr, ec, kc, sc[ 2 ]; + int oldx, remain; + wint_t wc; + cchar_t cc; + + ostr = wstr; + if (erasewchar(&ec) == ERR) + return ERR; + if (killwchar(&kc) == ERR) + return ERR; + sc[0] = (wchar_t)btowc( ' ' ); + sc[1] = L'\0'; + setcchar(&cc, sc, win->wattr, 0, NULL); + oldx = win->curx; + remain = n - 1; + + while (wget_wch(win, &wc) != ERR + && wc != L'\n' && wc != L'\r') { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "__wgetn_wstr: win %p, char 0x%x, remain %d\n", + win, wc, remain); +#endif + *wstr = wc; + touchline(win, win->cury, 1); + if (wc == ec || wc == KEY_BACKSPACE || wc == KEY_LEFT) { + *wstr = L'\0'; + if (wstr != ostr) { + if ((wchar_t)wc == ec) { + mvwadd_wch(win, win->cury, + win->curx, &cc); + wmove(win, win->cury, win->curx - 1); + } + if (wc == KEY_BACKSPACE || wc == KEY_LEFT) { + /* getch() displays the key sequence */ + mvwadd_wch(win, win->cury, + win->curx - 1, &cc); + mvwadd_wch(win, win->cury, + win->curx - 2, &cc); + wmove(win, win->cury, win->curx - 1); + } + wstr--; + if (n != -1) { + /* We're counting chars */ + remain++; + } + } else { /* str == ostr */ + if (wc == KEY_BACKSPACE || wc == KEY_LEFT) + /* getch() displays the other keys */ + mvwadd_wch(win, win->cury, + win->curx - 1, &cc); + wmove(win, win->cury, oldx); + } + } else if (wc == kc) { + *wstr = L'\0'; + if (wstr != ostr) { + /* getch() displays the kill character */ + mvwadd_wch(win, win->cury, win->curx - 1, &cc); + /* Clear the characters from screen and str */ + while (wstr != ostr) { + mvwadd_wch(win, win->cury, + win->curx - 1, &cc); + wmove(win, win->cury, win->curx - 1); + wstr--; + if (n != -1) + /* We're counting chars */ + remain++; + } + mvwadd_wch(win, win->cury, win->curx - 1, &cc); + wmove(win, win->cury, win->curx - 1); + } else + /* getch() displays the kill character */ + mvwadd_wch( win, win->cury, oldx, &cc ); + wmove(win, win->cury, oldx); + } else if (wc >= KEY_MIN && wc <= KEY_MAX) { + /* get_wch() displays these characters */ + mvwadd_wch( win, win->cury, win->curx - 1, &cc ); + wmove(win, win->cury, win->curx - 1); + } else { + if (remain) { + wstr++; + remain--; + } else { + mvwadd_wch(win, win->cury, win->curx - 1, &cc); + wmove(win, win->cury, win->curx - 1); + } + } + } + + if (wc == ERR) { + *wstr = L'\0'; + return ERR; + } + *wstr = L'\0'; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/getattrs.3 b/vendor/netbsd-curses/libcurses/getattrs.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getattrs.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getbegx.3 b/vendor/netbsd-curses/libcurses/getbegx.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getbegx.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getbegy.3 b/vendor/netbsd-curses/libcurses/getbegy.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getbegy.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getbkgd.3 b/vendor/netbsd-curses/libcurses/getbkgd.3 new file mode 120000 index 0000000..b438d24 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getbkgd.3 @@ -0,0 +1 @@ +curses_background.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getcchar.3 b/vendor/netbsd-curses/libcurses/getcchar.3 new file mode 120000 index 0000000..5372b4f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getcchar.3 @@ -0,0 +1 @@ +curses_cchar.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getch.3 b/vendor/netbsd-curses/libcurses/getch.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getch.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getch.c b/vendor/netbsd-curses/libcurses/getch.c new file mode 100644 index 0000000..c7893e1 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getch.c @@ -0,0 +1,1018 @@ +/* $NetBSD: getch.c,v 1.75 2020/07/06 23:33:38 uwe Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include "term.h" + +#include "curses.h" +#include "curses_private.h" +#include "keymap.h" + +short _cursesi_state; /* state of the inkey function */ + +static const struct tcdata tc[] = { + {TICODE_kSAV, KEY_SSAVE}, + {TICODE_kSPD, KEY_SSUSPEND}, + {TICODE_kUND, KEY_SUNDO}, + {TICODE_kHLP, KEY_SHELP}, + {TICODE_kHOM, KEY_SHOME}, + {TICODE_kIC, KEY_SIC}, + {TICODE_kLFT, KEY_SLEFT}, + {TICODE_krdo, KEY_REDO}, + {TICODE_khlp, KEY_HELP}, + {TICODE_kmrk, KEY_MARK}, + {TICODE_kmsg, KEY_MESSAGE}, + {TICODE_kmov, KEY_MOVE}, + {TICODE_knxt, KEY_NEXT}, + {TICODE_kopn, KEY_OPEN}, + {TICODE_kopt, KEY_OPTIONS}, + {TICODE_kprv, KEY_PREVIOUS}, + {TICODE_kprt, KEY_PRINT}, + {TICODE_kMSG, KEY_SMESSAGE}, + {TICODE_kMOV, KEY_SMOVE}, + {TICODE_kNXT, KEY_SNEXT}, + {TICODE_kOPT, KEY_SOPTIONS}, + {TICODE_kPRV, KEY_SPREVIOUS}, + {TICODE_kPRT, KEY_SPRINT}, + {TICODE_kRDO, KEY_SREDO}, + {TICODE_kRPL, KEY_SREPLACE}, + {TICODE_kRIT, KEY_SRIGHT}, + {TICODE_kRES, KEY_SRSUME}, + {TICODE_kCAN, KEY_SCANCEL}, + {TICODE_kref, KEY_REFERENCE}, + {TICODE_krfr, KEY_REFRESH}, + {TICODE_krpl, KEY_REPLACE}, + {TICODE_krst, KEY_RESTART}, + {TICODE_kres, KEY_RESUME}, + {TICODE_ksav, KEY_SAVE}, + {TICODE_kspd, KEY_SUSPEND}, + {TICODE_kund, KEY_UNDO}, + {TICODE_kBEG, KEY_SBEG}, + {TICODE_kFND, KEY_SFIND}, + {TICODE_kCMD, KEY_SCOMMAND}, + {TICODE_kCPY, KEY_SCOPY}, + {TICODE_kCRT, KEY_SCREATE}, + {TICODE_kDC, KEY_SDC}, + {TICODE_kDL, KEY_SDL}, + {TICODE_kslt, KEY_SELECT}, + {TICODE_kEND, KEY_SEND}, + {TICODE_kEOL, KEY_SEOL}, + {TICODE_kEXT, KEY_SEXIT}, + {TICODE_kfnd, KEY_FIND}, + {TICODE_kbeg, KEY_BEG}, + {TICODE_kcan, KEY_CANCEL}, + {TICODE_kclo, KEY_CLOSE}, + {TICODE_kcmd, KEY_COMMAND}, + {TICODE_kcpy, KEY_COPY}, + {TICODE_kcrt, KEY_CREATE}, + {TICODE_kend, KEY_END}, + {TICODE_kent, KEY_ENTER}, + {TICODE_kext, KEY_EXIT}, + {TICODE_kf11, KEY_F(11)}, + {TICODE_kf12, KEY_F(12)}, + {TICODE_kf13, KEY_F(13)}, + {TICODE_kf14, KEY_F(14)}, + {TICODE_kf15, KEY_F(15)}, + {TICODE_kf16, KEY_F(16)}, + {TICODE_kf17, KEY_F(17)}, + {TICODE_kf18, KEY_F(18)}, + {TICODE_kf19, KEY_F(19)}, + {TICODE_kf20, KEY_F(20)}, + {TICODE_kf21, KEY_F(21)}, + {TICODE_kf22, KEY_F(22)}, + {TICODE_kf23, KEY_F(23)}, + {TICODE_kf24, KEY_F(24)}, + {TICODE_kf25, KEY_F(25)}, + {TICODE_kf26, KEY_F(26)}, + {TICODE_kf27, KEY_F(27)}, + {TICODE_kf28, KEY_F(28)}, + {TICODE_kf29, KEY_F(29)}, + {TICODE_kf30, KEY_F(30)}, + {TICODE_kf31, KEY_F(31)}, + {TICODE_kf32, KEY_F(32)}, + {TICODE_kf33, KEY_F(33)}, + {TICODE_kf34, KEY_F(34)}, + {TICODE_kf35, KEY_F(35)}, + {TICODE_kf36, KEY_F(36)}, + {TICODE_kf37, KEY_F(37)}, + {TICODE_kf38, KEY_F(38)}, + {TICODE_kf39, KEY_F(39)}, + {TICODE_kf40, KEY_F(40)}, + {TICODE_kf41, KEY_F(41)}, + {TICODE_kf42, KEY_F(42)}, + {TICODE_kf43, KEY_F(43)}, + {TICODE_kf44, KEY_F(44)}, + {TICODE_kf45, KEY_F(45)}, + {TICODE_kf46, KEY_F(46)}, + {TICODE_kf47, KEY_F(47)}, + {TICODE_kf48, KEY_F(48)}, + {TICODE_kf49, KEY_F(49)}, + {TICODE_kf50, KEY_F(50)}, + {TICODE_kf51, KEY_F(51)}, + {TICODE_kf52, KEY_F(52)}, + {TICODE_kf53, KEY_F(53)}, + {TICODE_kf54, KEY_F(54)}, + {TICODE_kf55, KEY_F(55)}, + {TICODE_kf56, KEY_F(56)}, + {TICODE_kf57, KEY_F(57)}, + {TICODE_kf58, KEY_F(58)}, + {TICODE_kf59, KEY_F(59)}, + {TICODE_kf60, KEY_F(60)}, + {TICODE_kf61, KEY_F(61)}, + {TICODE_kf62, KEY_F(62)}, + {TICODE_kf63, KEY_F(63)}, + {TICODE_ka1, KEY_A1}, + {TICODE_kb2, KEY_B2}, + {TICODE_ka3, KEY_A3}, + {TICODE_kc1, KEY_C1}, + {TICODE_kc3, KEY_C3}, + {TICODE_kmous, KEY_MOUSE}, + {TICODE_kf0, KEY_F0}, + {TICODE_kf1, KEY_F(1)}, + {TICODE_kf2, KEY_F(2)}, + {TICODE_kf3, KEY_F(3)}, + {TICODE_kf4, KEY_F(4)}, + {TICODE_kf5, KEY_F(5)}, + {TICODE_kf6, KEY_F(6)}, + {TICODE_kf7, KEY_F(7)}, + {TICODE_kf8, KEY_F(8)}, + {TICODE_kf9, KEY_F(9)}, + {TICODE_kf10, KEY_F(10)}, + {TICODE_kil1, KEY_IL}, + {TICODE_ktbc, KEY_CATAB}, + {TICODE_kcbt, KEY_BTAB}, + {TICODE_kbs, KEY_BACKSPACE}, + {TICODE_kclr, KEY_CLEAR}, + {TICODE_kdch1, KEY_DC}, + {TICODE_kcud1, KEY_DOWN}, + {TICODE_kel, KEY_EOL}, + {TICODE_kind, KEY_SF}, + {TICODE_kll, KEY_LL}, + {TICODE_khome, KEY_HOME}, + {TICODE_kich1, KEY_IC}, + {TICODE_kdl1, KEY_DL}, + {TICODE_kcub1, KEY_LEFT}, + {TICODE_krmir, KEY_EIC}, + {TICODE_knp, KEY_NPAGE}, + {TICODE_kpp, KEY_PPAGE}, + {TICODE_kri, KEY_SR}, + {TICODE_kcuf1, KEY_RIGHT}, + {TICODE_ked, KEY_EOS}, + {TICODE_khts, KEY_STAB}, + {TICODE_kctab, KEY_CTAB}, + {TICODE_kcuu1, KEY_UP} +}; +/* Number of TC entries .... */ +static const int num_tcs = (sizeof(tc) / sizeof(struct tcdata)); + +/* Key buffer */ +#define INBUF_SZ 16 /* size of key buffer - must be larger than + * longest multi-key sequence */ +static wchar_t inbuf[INBUF_SZ]; +static int start, end, working; /* pointers for manipulating inbuf data */ + +/* prototypes for private functions */ +static void add_key_sequence(SCREEN *screen, const char *sequence, int key_type, size_t sequence_len); +static key_entry_t *add_new_key(keymap_t *current, char ch, int key_type, + int symbol); +static void delete_key_sequence(keymap_t *current, int key_type); +static void do_keyok(keymap_t *current, int key_type, bool set, bool flag, + int *retval); +static keymap_t *new_keymap(void); /* create a new keymap */ +static key_entry_t *new_key(void); /* create a new key entry */ +static wchar_t inkey(int to, int delay); + +/* + * Free the storage associated with the given keymap + */ +void +_cursesi_free_keymap(keymap_t *map) +{ + int i; + + /* check for, and free, child keymaps */ + for (i = 0; i < MAX_CHAR; i++) { + if (map->mapping[i] >= 0) { + if (map->key[map->mapping[i]]->type == KEYMAP_MULTI) + _cursesi_free_keymap( + map->key[map->mapping[i]]->value.next); + } + } + + /* now free any allocated keymap structs */ + for (i = 0; i < map->count; i += KEYMAP_ALLOC_CHUNK) { + free(map->key[i]); + } + + free(map->key); + free(map); +} + + +/* + * Add a new key entry to the keymap pointed to by current. Entry + * contains the character to add to the keymap, type is the type of + * entry to add (either multikey or leaf) and symbol is the symbolic + * value for a leaf type entry. The function returns a pointer to the + * new keymap entry. + */ +static key_entry_t * +add_new_key(keymap_t *current, char chr, int key_type, int symbol) +{ + key_entry_t *the_key; + int i, ki; + +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "Adding character %s of type %d, symbol 0x%x\n", + unctrl(chr), key_type, symbol); +#endif + if (current->mapping[(unsigned char)chr] < 0) { + if (current->mapping[(unsigned char)chr] == MAPPING_UNUSED) { + /* first time for this char */ + current->mapping[(unsigned char)chr] = + current->count; /* map new entry */ + ki = current->count; + + /* make sure we have room in the key array first */ + if ((current->count & (KEYMAP_ALLOC_CHUNK - 1)) == 0) + { + if ((current->key = + realloc(current->key, + ki * sizeof(key_entry_t *) + + KEYMAP_ALLOC_CHUNK * sizeof(key_entry_t *))) == NULL) { + fprintf(stderr, + "Could not malloc for key entry\n"); + exit(1); + } + + the_key = new_key(); + for (i = 0; i < KEYMAP_ALLOC_CHUNK; i++) { + current->key[ki + i] = &the_key[i]; + } + } + } else { + /* the mapping was used but freed, reuse it */ + ki = - current->mapping[(unsigned char) chr]; + current->mapping[(unsigned char) chr] = ki; + } + + current->count++; + + /* point at the current key array element to use */ + the_key = current->key[ki]; + + the_key->type = key_type; + + switch (key_type) { + case KEYMAP_MULTI: + /* need for next key */ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "Creating new keymap\n"); +#endif + the_key->value.next = new_keymap(); + the_key->enable = TRUE; + break; + + case KEYMAP_LEAF: + /* the associated symbol for the key */ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "Adding leaf key\n"); +#endif + the_key->value.symbol = symbol; + the_key->enable = TRUE; + break; + + default: + fprintf(stderr, "add_new_key: bad type passed\n"); + exit(1); + } + } else { + /* the key is already known - just return the address. */ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "Keymap already known\n"); +#endif + the_key = current->key[current->mapping[(unsigned char)chr]]; + } + + return the_key; +} + +/* + * Delete the given key symbol from the key mappings for the screen. + * + */ +static void +delete_key_sequence(keymap_t *current, int key_type) +{ + key_entry_t *key; + int i; + + /* + * we need to iterate over all the keys as there may be + * multiple instances of the leaf symbol. + */ + for (i = 0; i < MAX_CHAR; i++) { + if (current->mapping[i] < 0) + continue; /* no mapping for the key, next! */ + + key = current->key[current->mapping[i]]; + + if (key->type == KEYMAP_MULTI) { + /* have not found the leaf, recurse down */ + delete_key_sequence(key->value.next, key_type); + /* if we deleted the last key in the map, free */ + if (key->value.next->count == 0) + _cursesi_free_keymap(key->value.next); + } else if ((key->type == KEYMAP_LEAF) + && (key->value.symbol == key_type)) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "delete_key_sequence: found keysym %d, deleting\n", + key_type); +#endif + key->enable = FALSE; + } + } +} + +/* + * Add the sequence of characters given in sequence as the key mapping + * for the given key symbol. + */ +static void +add_key_sequence(SCREEN *screen, const char *sequence, int key_type, size_t sequence_len) +{ + key_entry_t *tmp_key; + keymap_t *current; + unsigned length, j; + int key_ent; + +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "add_key_sequence: add key sequence: %s(%s)\n", + sequence, keyname(key_type)); +#endif /* DEBUG */ + current = screen->base_keymap; /* always start with + * base keymap. */ + length = sequence_len; + + /* + * OK - we really should never get a zero length string here, either + * the terminfo entry is there and it has a value or we are not called + * at all. Unfortunately, if someone assigns a terminfo string to the + * ^@ value we get passed a null string which messes up our length. + * So, if we get a null string then just insert a leaf value in + * the 0th char position of the root keymap. Note that we are + * totally screwed if someone terminates a multichar sequence + * with ^@... oh well. + */ + if (length == 0) + length = 1; + + for (j = 0; j < length - 1; j++) { + /* add the entry to the struct */ + tmp_key = add_new_key(current, sequence[j], KEYMAP_MULTI, 0); + + /* index into the key array - it's + clearer if we stash this */ + key_ent = current->mapping[(unsigned char) sequence[j]]; + + current->key[key_ent] = tmp_key; + + /* next key uses this map... */ + current = current->key[key_ent]->value.next; + } + + /* + * This is the last key in the sequence (it may have been the + * only one but that does not matter) this means it is a leaf + * key and should have a symbol associated with it. + */ + tmp_key = add_new_key(current, sequence[length - 1], KEYMAP_LEAF, + key_type); + current->key[current->mapping[(int)sequence[length - 1]]] = tmp_key; +} + +/* + * Init_getch - initialise all the pointers & structures needed to make + * getch work in keypad mode. + * + */ +void +__init_getch(SCREEN *screen) +{ + const char *s; + int i; + size_t limit = 1023, l; + + /* init the inkey state variable */ + _cursesi_state = INKEY_NORM; + + /* init the base keymap */ + screen->base_keymap = new_keymap(); + + /* key input buffer pointers */ + start = end = working = 0; + + /* now do the terminfo snarfing ... */ + + for (i = 0; i < num_tcs; i++) { + s = screen->term->strs[tc[i].code]; + if (!s) continue; + l = strlen(s) + 1; + if (limit < l) continue; + add_key_sequence(screen, s, tc[i].symbol, l-1); + } +} + + +/* + * new_keymap - allocates & initialises a new keymap structure. This + * function returns a pointer to the new keymap. + * + */ +static keymap_t * +new_keymap(void) +{ + int i; + keymap_t *new_map; + + if ((new_map = malloc(sizeof(keymap_t))) == NULL) { + perror("Inkey: Cannot allocate new keymap"); + exit(2); + } + + /* Initialise the new map */ + new_map->count = 0; + for (i = 0; i < MAX_CHAR; i++) { + new_map->mapping[i] = MAPPING_UNUSED; /* no mapping for char */ + } + + /* key array will be allocated when first key is added */ + new_map->key = NULL; + + return new_map; +} + +/* + * new_key - allocates & initialises a new key entry. This function returns + * a pointer to the newly allocated key entry. + * + */ +static key_entry_t * +new_key(void) +{ + key_entry_t *new_one; + int i; + + new_one = malloc(KEYMAP_ALLOC_CHUNK * sizeof(key_entry_t)); + if (new_one == NULL) { + perror("inkey: Cannot allocate new key entry chunk"); + exit(2); + } + + for (i = 0; i < KEYMAP_ALLOC_CHUNK; i++) { + new_one[i].type = 0; + new_one[i].value.next = NULL; + } + + return new_one; +} + +/* + * inkey - do the work to process keyboard input, check for multi-key + * sequences and return the appropriate symbol if we get a match. + * + */ + +static wchar_t +inkey(int to, int delay) +{ + wchar_t k; + int c, mapping; + keymap_t *current = _cursesi_screen->base_keymap; + FILE *infd = _cursesi_screen->infd; + + k = 0; /* XXX gcc -Wuninitialized */ + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "inkey (%d, %d)\n", to, delay); +#endif + for (;;) { /* loop until we get a complete key sequence */ +reread: + if (_cursesi_state == INKEY_NORM) { + if (delay && __timeout(delay) == ERR) + return ERR; + c = __fgetc_resize(infd); + if (c == ERR || c == KEY_RESIZE) { + clearerr(infd); + return c; + } + + if (delay && (__notimeout() == ERR)) + return ERR; + + k = (wchar_t)c; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey (state normal) got '%s'\n", unctrl(k)); +#endif + + working = start; + inbuf[working] = k; + INC_POINTER(working); + end = working; + + /* go to the assembling state now */ + _cursesi_state = INKEY_ASSEMBLING; + + } else if (_cursesi_state == INKEY_BACKOUT) { + k = inbuf[working]; + INC_POINTER(working); + if (working == end) { /* see if we have run + * out of keys in the + * backlog */ + + /* if we have then switch to assembling */ + _cursesi_state = INKEY_ASSEMBLING; + } + } else if (_cursesi_state == INKEY_ASSEMBLING) { + /* assembling a key sequence */ + if (delay) { + if (__timeout(to ? (ESCDELAY / 100) : delay) + == ERR) + return ERR; + } else { + if (to && (__timeout(ESCDELAY / 100) == ERR)) + return ERR; + } + + c = __fgetc_resize(infd); + if (ferror(infd)) { + clearerr(infd); + return c; + } + + if ((to || delay) && (__notimeout() == ERR)) + return ERR; + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "inkey (state assembling) got '%s'\n", unctrl(k)); +#endif + if (feof(infd) || c == -1) { /* inter-char timeout, + * start backing out */ + clearerr(infd); + if (start == end) + /* no chars in the buffer, restart */ + goto reread; + + k = inbuf[start]; + _cursesi_state = INKEY_TIMEOUT; + } else { + k = (wchar_t) c; + inbuf[working] = k; + INC_POINTER(working); + end = working; + } + } else { + fprintf(stderr, "Inkey state screwed - exiting!!!"); + exit(2); + } + + /* + * Check key has no special meaning and we have not + * timed out and the key has not been disabled + */ + mapping = current->mapping[k]; + if (((_cursesi_state == INKEY_TIMEOUT) || (mapping < 0)) + || ((current->key[mapping]->type == KEYMAP_LEAF) + && (current->key[mapping]->enable == FALSE))) { + /* return the first key we know about */ + k = inbuf[start]; + + INC_POINTER(start); + working = start; + + if (start == end) { /* only one char processed */ + _cursesi_state = INKEY_NORM; + } else {/* otherwise we must have more than one char + * to backout */ + _cursesi_state = INKEY_BACKOUT; + } + return k; + } else { /* must be part of a multikey sequence */ + /* check for completed key sequence */ + if (current->key[current->mapping[k]]->type == KEYMAP_LEAF) { + start = working; /* eat the key sequence + * in inbuf */ + + /* check if inbuf empty now */ + if (start == end) { + /* if it is go back to normal */ + _cursesi_state = INKEY_NORM; + } else { + /* otherwise go to backout state */ + _cursesi_state = INKEY_BACKOUT; + } + + /* return the symbol */ + return current->key[current->mapping[k]]->value.symbol; + + } else { + /* + * Step on to next part of the multi-key + * sequence. + */ + current = current->key[current->mapping[k]]->value.next; + } + } + } +} + +#ifndef _CURSES_USE_MACROS +/* + * getch -- + * Read in a character from stdscr. + */ +int +getch(void) +{ + return wgetch(stdscr); +} + +/* + * mvgetch -- + * Read in a character from stdscr at the given location. + */ +int +mvgetch(int y, int x) +{ + return mvwgetch(stdscr, y, x); +} + +/* + * mvwgetch -- + * Read in a character from stdscr at the given location in the + * given window. + */ +int +mvwgetch(WINDOW *win, int y, int x) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wgetch(win); +} + +#endif + +/* + * keyok -- + * Set the enable flag for a keysym, if the flag is false then + * getch will not return this keysym even if the matching key sequence + * is seen. + */ +int +keyok(int key_type, bool flag) +{ + int result = ERR; + + if (_cursesi_screen != NULL) + do_keyok(_cursesi_screen->base_keymap, key_type, + true, flag, &result); + return result; +} + +/* + * do_keyok -- + * Does the actual work for keyok, we need to recurse through the + * keymaps finding the passed key symbol. + */ +static void +do_keyok(keymap_t *current, int key_type, bool set, bool flag, int *retval) +{ + key_entry_t *key; + int i; + + /* + * we need to iterate over all the keys as there may be + * multiple instances of the leaf symbol. + */ + for (i = 0; i < MAX_CHAR; i++) { + if (current->mapping[i] < 0) + continue; /* no mapping for the key, next! */ + + key = current->key[current->mapping[i]]; + + if (key->type == KEYMAP_MULTI) + do_keyok(key->value.next, key_type, set, flag, retval); + else if ((key->type == KEYMAP_LEAF) + && (key->value.symbol == key_type)) { + if (set) + key->enable = flag; + *retval = OK; /* we found at least one instance, ok */ + } + } +} + +/* + * define_key -- + * Add a custom mapping of a key sequence to key symbol. + * + */ +int +define_key(char *sequence, int symbol) +{ + + if (symbol <= 0 || _cursesi_screen == NULL) + return ERR; + + if (sequence == NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "define_key: deleting keysym %d\n", + symbol); +#endif + delete_key_sequence(_cursesi_screen->base_keymap, symbol); + } else + add_key_sequence(_cursesi_screen, sequence, symbol, strlen(sequence)); + + return OK; +} + +/* + * wgetch -- + * Read in a character from the window. + */ +int +wgetch(WINDOW *win) +{ + int inp, weset; + int c; + FILE *infd = _cursesi_screen->infd; + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wgetch: win(%p)\n", win); +#endif + if (win == NULL) + return ERR; + if (!(win->flags & __SCROLLOK) && (win->flags & __FULLWIN) + && win->curx == win->maxx - 1 && win->cury == win->maxy - 1 + && __echoit) + return ERR; + + if (!(win->flags & __ISPAD)) { + if (is_wintouched(win)) + wrefresh(win); + else if ((_cursesi_screen->curscr->cury != (win->begy + win->cury)) + || (_cursesi_screen->curscr->curx != (win->begx + win->curx))) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wgetch: curscr cury %d cury %d curscr curx %d curx %d\n", + _cursesi_screen->curscr->cury, win->begy + win->cury, + _cursesi_screen->curscr->curx, win->begx + win->curx); +#endif + /* + * Just in case the window is not dirty but the + * cursor was moved, check and update the + * cursor location. + */ + mvcur(_cursesi_screen->curscr->cury, + _cursesi_screen->curscr->curx, + win->cury + win->begy, win->curx + win->begx); + _cursesi_screen->curscr->cury = + win->cury + win->begy; + _cursesi_screen->curscr->curx = + win->curx + win->begx; + } + } + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wgetch: __echoit = %d, " + "__rawmode = %d, __nl = %d, flags = %#.4x, delay = %d\n", + __echoit, __rawmode, _cursesi_screen->nl, win->flags, win->delay); +#endif + if (_cursesi_screen->resized) { + resizeterm(LINES, COLS); + _cursesi_screen->resized = 0; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wgetch returning KEY_RESIZE\n"); +#endif + return KEY_RESIZE; + } + if (_cursesi_screen->unget_pos) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wgetch returning char at %d\n", + _cursesi_screen->unget_pos); +#endif + _cursesi_screen->unget_pos--; + c = _cursesi_screen->unget_list[_cursesi_screen->unget_pos]; + if (__echoit) + waddch(win, (chtype) c); + return c; + } + if (__echoit && !__rawmode) { + cbreak(); + weset = 1; + } else + weset = 0; + + __save_termios(); + + if (win->flags & __KEYPAD) { + switch (win->delay) { + case -1: + inp = inkey (win->flags & __NOTIMEOUT ? 0 : 1, 0); + break; + case 0: + if (__nodelay() == ERR) + return ERR; + inp = inkey(0, 0); + break; + default: + inp = inkey(win->flags & __NOTIMEOUT ? 0 : 1, win->delay); + break; + } + } else { + switch (win->delay) { + case -1: + if (__delay() == ERR) + return ERR; + break; + case 0: + if (__nodelay() == ERR) + return ERR; + break; + default: + if (__timeout(win->delay) == ERR) + return ERR; + break; + } + + inp = __fgetc_resize(infd); + if (inp == ERR || inp == KEY_RESIZE) { + clearerr(infd); + __restore_termios(); + return inp; + } + } +#ifdef DEBUG + if (inp > 255) + /* we have a key symbol - treat it differently */ + /* XXXX perhaps __unctrl should be expanded to include + * XXXX the keysyms in the table.... + */ + __CTRACE(__CTRACE_INPUT, "wgetch assembled keysym 0x%x\n", inp); + else + __CTRACE(__CTRACE_INPUT, "wgetch got '%s'\n", unctrl(inp)); +#endif + if (win->delay > -1) { + if (__delay() == ERR) + return ERR; + } + + __restore_termios(); + + if ((__echoit) && (inp < KEY_MIN)) + waddch(win, (chtype) inp); + + if (weset) + nocbreak(); + + if (_cursesi_screen->nl && inp == 13) + inp = 10; + + return ((inp < 0) || (inp == ERR) ? ERR : inp); +} + +/* + * ungetch -- + * Put the character back into the input queue. + */ +int +ungetch(int c) +{ + return __unget((wint_t)c); +} + +/* + * __unget -- + * Do the work for ungetch() and unget_wch(); + */ +int +__unget(wint_t c) +{ + wchar_t *p; + int len; + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "__unget(%x)\n", c); +#endif + if (_cursesi_screen == NULL) + return ERR; + if (_cursesi_screen->unget_pos >= _cursesi_screen->unget_len) { + len = _cursesi_screen->unget_len + 32; + if ((p = realloc(_cursesi_screen->unget_list, + sizeof(wchar_t) * len)) == NULL) { + /* Can't realloc(), so just lose the oldest entry */ + memmove(_cursesi_screen->unget_list, + _cursesi_screen->unget_list + sizeof(wchar_t), + _cursesi_screen->unget_len - 1); + _cursesi_screen->unget_list[_cursesi_screen->unget_len + - 1] = c; + _cursesi_screen->unget_pos = + _cursesi_screen->unget_len; + return OK; + } else { + _cursesi_screen->unget_pos = + _cursesi_screen->unget_len; + _cursesi_screen->unget_len = len; + _cursesi_screen->unget_list = p; + } + } + _cursesi_screen->unget_list[_cursesi_screen->unget_pos] = c; + _cursesi_screen->unget_pos++; + return OK; +} + +int +has_key(int key_type) +{ + int result = ERR; + + if (_cursesi_screen != NULL) + do_keyok(_cursesi_screen->base_keymap, key_type, + false, false, &result); + return result; +} + +/* + * set_escdelay -- + * Sets the escape delay for the current screen. + */ +int +set_escdelay(int escdelay) +{ + + if (_cursesi_screen == NULL) + return ERR; + _cursesi_screen->ESCDELAY = escdelay; + ESCDELAY = escdelay; + return OK; +} + +/* + * __fgetc_resize -- + * Any call to fgetc(3) should use this function instead + * and test for the return value of KEY_RESIZE as well as ERR. + */ +int +__fgetc_resize(FILE *infd) +{ + int c; + + c = fgetc(infd); + if (c != EOF) + return c; + + if (!ferror(infd) || errno != EINTR || !_cursesi_screen->resized) + return ERR; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "__fgetc_resize returning KEY_RESIZE\n"); +#endif + resizeterm(LINES, COLS); + _cursesi_screen->resized = 0; + return KEY_RESIZE; +} diff --git a/vendor/netbsd-curses/libcurses/getcurx.3 b/vendor/netbsd-curses/libcurses/getcurx.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getcurx.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getcury.3 b/vendor/netbsd-curses/libcurses/getcury.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getcury.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getmaxx.3 b/vendor/netbsd-curses/libcurses/getmaxx.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getmaxx.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getmaxy.3 b/vendor/netbsd-curses/libcurses/getmaxy.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getmaxy.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getmaxyx.3 b/vendor/netbsd-curses/libcurses/getmaxyx.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getmaxyx.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getnstr.3 b/vendor/netbsd-curses/libcurses/getnstr.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getnstr.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getparx.3 b/vendor/netbsd-curses/libcurses/getparx.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getparx.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getpary.3 b/vendor/netbsd-curses/libcurses/getpary.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getpary.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getparyx.3 b/vendor/netbsd-curses/libcurses/getparyx.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getparyx.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getstr.3 b/vendor/netbsd-curses/libcurses/getstr.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getstr.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getstr.c b/vendor/netbsd-curses/libcurses/getstr.c new file mode 100644 index 0000000..2eec2fa --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getstr.c @@ -0,0 +1,254 @@ +/* $NetBSD: getstr.c,v 1.27 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +#include + +#include +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * getnstr -- + * Get a string (of maximum n) characters from stdscr starting at + * (cury, curx). + */ +int +getnstr(char *str, int n) +{ + return wgetnstr(stdscr, str, n); +} + +/* + * getstr -- + * Get a string from stdscr starting at (cury, curx). + */ +__warn_references(getstr, + "warning: this program uses getstr(), which is unsafe."); +int +getstr(char *str) +{ + return wgetstr(stdscr, str); +} + +/* + * mvgetnstr -- + * Get a string (of maximum n) characters from stdscr starting at (y, x). + */ +int +mvgetnstr(int y, int x, char *str, int n) +{ + return mvwgetnstr(stdscr, y, x, str, n); +} + +/* + * mvgetstr -- + * Get a string from stdscr starting at (y, x). + */ +__warn_references(mvgetstr, + "warning: this program uses mvgetstr(), which is unsafe."); +int +mvgetstr(int y, int x, char *str) +{ + return mvwgetstr(stdscr, y, x, str); +} + +/* + * mvwgetnstr -- + * Get a string (of maximum n) characters from the given window starting + * at (y, x). + */ +int +mvwgetnstr(WINDOW *win, int y, int x, char *str, int n) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wgetnstr(win, str, n); +} + +/* + * mvwgetstr -- + * Get a string from the given window starting at (y, x). + */ +__warn_references(mvgetstr, + "warning: this program uses mvgetstr(), which is unsafe."); +int +mvwgetstr(WINDOW *win, int y, int x, char *str) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wgetstr(win, str); +} + +#endif + +/* + * wgetstr -- + * Get a string starting at (cury, curx). + */ +__warn_references(wgetstr, + "warning: this program uses wgetstr(), which is unsafe."); +int +wgetstr(WINDOW *win, char *str) +{ + return __wgetnstr(win, str, -1); +} + +/* + * wgetnstr -- + * Get a string starting at (cury, curx). + * Note that n < 2 means that we return ERR (SUSv2 specification). + */ +int +wgetnstr(WINDOW *win, char *str, int n) +{ + if (n < 1) + return ERR; + if (n == 1) { + str[0] = '\0'; + return ERR; + } + return __wgetnstr(win, str, n); +} + +/* + * __wgetnstr -- + * The actual implementation. + * Note that we include a trailing '\0' for safety, so str will contain + * at most n - 1 other characters. + * XXX: character deletion from screen is based on how the characters + * are displayed by wgetch(). + */ +int +__wgetnstr(WINDOW *win, char *str, int n) +{ + char *ostr, ec, kc; + int c, xpos, oldx, remain; + + ostr = str; + ec = erasechar(); + kc = killchar(); + xpos = oldx = win->curx; + _DIAGASSERT(n == -1 || n > 1); + remain = n - 1; + + while ((c = wgetch(win)) != ERR && c != '\n' && c != '\r') { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "__wgetnstr: win %p, char 0x%x, remain %d\n", + win, c, remain); +#endif + *str = c; + __touchline(win, win->cury, 0, (int) win->maxx - 1); + if (c == ec || c == KEY_BACKSPACE || c == KEY_LEFT) { + *str = '\0'; + if (str != ostr) { + if ((char) c == ec) { + mvwaddch(win, win->cury, xpos, ' '); + if (xpos > oldx) + mvwaddch(win, win->cury, + xpos - 1, ' '); + if (win->curx > xpos - 1) + wmove(win, win->cury, xpos - 1); + xpos--; + } + if (c == KEY_BACKSPACE || c == KEY_LEFT) { + /* getch() displays the key sequence */ + mvwaddch(win, win->cury, win->curx, + ' '); + mvwaddch(win, win->cury, win->curx - 1, + ' '); + if (win->curx > xpos) + wmove(win, win->cury, xpos - 1); + xpos--; + } + str--; + if (n != -1) { + /* We're counting chars */ + remain++; + } + } else { /* str == ostr */ + /* getch() displays the other keys */ + if (win->curx > oldx) + mvwaddch(win, win->cury, win->curx - 1, + ' '); + wmove(win, win->cury, oldx); + xpos = oldx; + } + } else if (c == kc) { + *str = '\0'; + if (str != ostr) { + /* getch() displays the kill character */ + mvwaddch(win, win->cury, win->curx - 1, ' '); + /* Clear the characters from screen and str */ + while (str != ostr) { + mvwaddch(win, win->cury, win->curx - 1, + ' '); + wmove(win, win->cury, win->curx - 1); + str--; + if (n != -1) + /* We're counting chars */ + remain++; + } + mvwaddch(win, win->cury, win->curx - 1, ' '); + wmove(win, win->cury, win->curx - 1); + } else + /* getch() displays the kill character */ + mvwaddch(win, win->cury, oldx, ' '); + wmove(win, win->cury, oldx); + } else if (c >= KEY_MIN && c <= KEY_MAX) { + /* getch() displays these characters */ + mvwaddch(win, win->cury, xpos, ' '); + wmove(win, win->cury, xpos); + } else { + if (remain) { + if (iscntrl((unsigned char)c)) + mvwaddch(win, win->cury, xpos, ' '); + str++; + xpos++; + remain--; + } else + mvwaddch(win, win->cury, xpos, ' '); + wmove(win, win->cury, xpos); + } + } + + if (c == ERR) { + *str = '\0'; + return ERR; + } + *str = '\0'; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/getsyx.3 b/vendor/netbsd-curses/libcurses/getsyx.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getsyx.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/gettmode.3 b/vendor/netbsd-curses/libcurses/gettmode.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/gettmode.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getwin.3 b/vendor/netbsd-curses/libcurses/getwin.3 new file mode 120000 index 0000000..8a51090 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getwin.3 @@ -0,0 +1 @@ +curses_fileio.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getyx.3 b/vendor/netbsd-curses/libcurses/getyx.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getyx.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/getyx.c b/vendor/netbsd-curses/libcurses/getyx.c new file mode 100644 index 0000000..7171254 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/getyx.c @@ -0,0 +1,139 @@ +/* $NetBSD: getyx.c,v 1.6 2017/01/06 13:53:18 roy Exp $ */ + +/* + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * getpary -- + * Get the y postion of the window relative to the parent window + * return -1 if not a subwindow. + */ +int +getpary(WINDOW *win) +{ + + if (win == NULL) + return -1; + + if (win->orig == NULL) + return -1; + + return win->begy - win->orig->begy; +} + +/* + * getparx -- + * Get the x postion of the window relative to the parent window + * return -1 if not a subwindow. + */ +int +getparx(WINDOW *win) +{ + + if (win == NULL) + return -1; + + if (win->orig == NULL) + return -1; + + return win->begx - win->orig->begx; +} + +/* + * getcury -- + * Get current y position on window. + */ +int +getcury(WINDOW *win) +{ + + return win->cury; +} + +/* + * getcurx -- + * Get current x position on window. + */ +int +getcurx(WINDOW *win) +{ + + return win->curx; +} + +/* + * getbegy -- + * Get begin y position on window. + */ +int +getbegy(WINDOW *win) +{ + + return win->begy; +} + +/* + * getbegx -- + * Get begin x position on window. + */ +int +getbegx(WINDOW *win) +{ + + return win->begx; +} + +/* + * getmaxy -- + * Get maximum y position on window. + */ +int +getmaxy(WINDOW *win) +{ + + return win->maxy; +} + +/* + * getmaxx -- + * Get maximum x position on window. + */ +int +getmaxx(WINDOW *win) +{ + + return win->maxx; +} diff --git a/vendor/netbsd-curses/libcurses/halfdelay.3 b/vendor/netbsd-curses/libcurses/halfdelay.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/halfdelay.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/has_colors.3 b/vendor/netbsd-curses/libcurses/has_colors.3 new file mode 120000 index 0000000..1f101c9 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/has_colors.3 @@ -0,0 +1 @@ +curses_color.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/has_ic.3 b/vendor/netbsd-curses/libcurses/has_ic.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/has_ic.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/has_il.3 b/vendor/netbsd-curses/libcurses/has_il.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/has_il.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/has_key.3 b/vendor/netbsd-curses/libcurses/has_key.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/has_key.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/hline.3 b/vendor/netbsd-curses/libcurses/hline.3 new file mode 120000 index 0000000..fa3776d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/hline.3 @@ -0,0 +1 @@ +curses_line.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/id_subwins.c b/vendor/netbsd-curses/libcurses/id_subwins.c new file mode 100644 index 0000000..e3db7cd --- /dev/null +++ b/vendor/netbsd-curses/libcurses/id_subwins.c @@ -0,0 +1,53 @@ +/* $NetBSD: id_subwins.c,v 1.14 2009/07/22 16:57:14 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * __id_subwins -- + * Re-sync the pointers to lines for all the subwindows. + */ +void +__id_subwins(WINDOW *orig) +{ + WINDOW *win; + int oy, y; + + for (win = orig->nextp; win != orig; win = win->nextp) { + oy = win->begy - orig->begy; + for (y = 0; y < win->maxy; y++) + win->alines[y]->line = + &orig->alines[oy + y]->line[win->ch_off]; + } +} diff --git a/vendor/netbsd-curses/libcurses/idcok.3 b/vendor/netbsd-curses/libcurses/idcok.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/idcok.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/idcok.c b/vendor/netbsd-curses/libcurses/idcok.c new file mode 100644 index 0000000..5475a8f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/idcok.c @@ -0,0 +1,51 @@ +/* $NetBSD: idcok.c,v 1.2 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com) + * All rights reserved. + * + * This software has been donated to the NetBSD Foundation by the + * Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * idcok -- + * Turn on and off using insert/delete char sequences for the + * given window. Note, currently, the ic/dc capabilities are not + * used, this function is only provided for compatibility. + */ +int +idcok(WINDOW *win, bool bf) +{ + if (bf) + win->flags |= __IDCHAR; + else + win->flags &= ~__IDCHAR; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/idlok.3 b/vendor/netbsd-curses/libcurses/idlok.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/idlok.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/idlok.c b/vendor/netbsd-curses/libcurses/idlok.c new file mode 100644 index 0000000..490b603 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/idlok.c @@ -0,0 +1,50 @@ +/* $NetBSD: idlok.c,v 1.12 2017/01/06 13:53:18 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * idlok -- + * Turn on and off using insert/deleteln sequences for the + * given window. + */ +int +idlok(WINDOW *win, bool bf) +{ + if (bf) + win->flags |= __IDLINE; + else + win->flags &= ~__IDLINE; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/immedok.3 b/vendor/netbsd-curses/libcurses/immedok.3 new file mode 120000 index 0000000..7a991d5 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/immedok.3 @@ -0,0 +1 @@ +curses_refresh.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/immedok.c b/vendor/netbsd-curses/libcurses/immedok.c new file mode 100644 index 0000000..988a990 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/immedok.c @@ -0,0 +1,47 @@ +/* $NetBSD: immedok.c,v 1.2 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 2017 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "curses.h" +#include "curses_private.h" + +/* + * immedok -- + * Refresh the window when changed. + */ +int +immedok(WINDOW *win, bool bf) +{ + if (bf) + win->flags |= __IMMEDOK; + else + win->flags &= ~__IMMEDOK; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/in_wch.c b/vendor/netbsd-curses/libcurses/in_wch.c new file mode 100644 index 0000000..7f43f9a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/in_wch.c @@ -0,0 +1,100 @@ +/* $NetBSD: in_wch.c,v 1.7 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * in_wch -- + * Return wide character at cursor position from stdscr. + */ +int +in_wch(cchar_t *wcval) +{ + return win_wch(stdscr, wcval); +} + +/* + * mvin_wch -- + * Return wide character at position (y, x) from stdscr. + */ +int +mvin_wch(int y, int x, cchar_t *wcval) +{ + return mvwin_wch(stdscr, y, x, wcval); +} + +/* + * mvwin_wch -- + * Return wide character at position (y, x) from the given window. + */ +int +mvwin_wch(WINDOW *win, int y, int x, cchar_t *wcval) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return win_wch(win, wcval); +} + +/* + * win_wch -- + * Return wide character at cursor position. + */ +int +win_wch(WINDOW *win, cchar_t *wcval) +{ + nschar_t *np; + __LDATA *lp = &win->alines[win->cury]->line[win->curx]; + int cw = WCOL(*lp); + + if (cw < 0) + lp += cw; + wcval->vals[0] = lp->ch; + wcval->attributes = lp->attr; + wcval->elements = 1; + np = lp->nsp; + if (np) { + do { + wcval->vals[wcval->elements++] = np->ch; + np = np-> next; + } while (np); + } + + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/in_wchstr.c b/vendor/netbsd-curses/libcurses/in_wchstr.c new file mode 100644 index 0000000..ba661d0 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/in_wchstr.c @@ -0,0 +1,162 @@ +/* $NetBSD: in_wchstr.c,v 1.8 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * in_wchstr, in_wchnstr -- + * Return an array of wide characters at cursor position from stdscr. + */ +__warn_references(in_wchstr, + "warning: this program uses in_wchstr(), which is unsafe."); +int +in_wchstr(cchar_t *wchstr) +{ + return win_wchstr(stdscr, wchstr); +} + +int +in_wchnstr(cchar_t *wchstr, int n) +{ + return win_wchnstr(stdscr, wchstr, n); +} + +/* + * mvin_wchstr, mv_winchnstr -- + * Return an array of wide characters at position (y, x) from stdscr. + */ +__warn_references(mvin_wchstr, + "warning: this program uses mvin_wchstr(), which is unsafe."); +int +mvin_wchstr(int y, int x, cchar_t *wchstr) +{ + return mvwin_wchstr(stdscr, y, x, wchstr); +} + +int +mvin_wchnstr(int y, int x, cchar_t *wchstr, int n) +{ + return mvwin_wchnstr(stdscr, y, x, wchstr, n); +} + +/* + * mvwin_wchstr, mvwin_wchnstr -- + * Return an array wide characters at position (y, x) from the given window. + */ +__warn_references(mvwin_wchstr, + "warning: this program uses mvwin_wchstr(), which is unsafe."); +int +mvwin_wchstr(WINDOW *win, int y, int x, cchar_t *wchstr) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return win_wchstr(win, wchstr); +} + +int +mvwin_wchnstr(WINDOW *win, int y, int x, cchar_t *wchstr, int n) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return win_wchnstr(win, wchstr, n); +} + +/* + * win_wchstr, win_wchnstr -- + * Return an array of characters at cursor position. + */ +__warn_references(win_wchstr, + "warning: this program uses win_wchstr(), which is unsafe."); +int +win_wchstr(WINDOW *win, cchar_t *wchstr) +{ + + return win_wchnstr(win, wchstr, -1); +} + +/* + * - SUSv2/xcurses doesn't document whether the trailing 0 is included + * in the length count or not. For safety's sake it _is_ included. + */ +int +win_wchnstr(WINDOW *win, cchar_t *wchstr, int n) +{ + __LDATA *start; + int x = 0, cw = 0, cnt = 0; + cchar_t *wcp; + nschar_t *np; + + if (wchstr == NULL) + return ERR; + + start = &win->alines[win->cury]->line[win->curx]; + x = win->curx; + cw = WCOL(*start); + if (cw < 0) { + start += cw; + x += cw; + } + wcp = wchstr; + /* (n - 1) to leave room for the trailing 0 element */ + while ((x < win->maxx) && ((n < 0) || ((n > 1) && (cnt < n - 1)))) { + cw = WCOL(*start); + wcp->vals[0] = start->ch; + wcp->attributes = start->attr; + wcp->elements = 1; + np = start->nsp; + if (np) { + do { + wcp->vals[wcp->elements++] = np->ch; + np = np->next; + } while (np); + } + wcp++; + cnt++; + x += cw; + if (x < win->maxx) + start += cw; + } + wcp->vals[0] = L'\0'; + wcp->elements = 1; + wcp->attributes = win->wattr; + + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/inch.3 b/vendor/netbsd-curses/libcurses/inch.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/inch.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/inch.c b/vendor/netbsd-curses/libcurses/inch.c new file mode 100644 index 0000000..02fca53 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/inch.c @@ -0,0 +1,94 @@ +/* $NetBSD: inch.c,v 1.14 2019/06/09 07:40:14 blymn Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * inch -- + * Return character at cursor position from stdscr. + */ +chtype +inch(void) +{ + + return winch(stdscr); +} + +/* + * mvinch -- + * Return character at position (y, x) from stdscr. + */ +chtype +mvinch(int y, int x) +{ + + return mvwinch(stdscr, y, x); +} + +/* + * mvwinch -- + * Return character at position (y, x) from the given window. + */ +chtype +mvwinch(WINDOW *win, int y, int x) +{ + + if (wmove(win, y, x) == ERR) + return ERR; + + return winch(win); +} + +#endif + +/* + * winch -- + * Return character at cursor position. + */ +chtype +winch(WINDOW *win) +{ + chtype ch; + attr_t attr; + + ch = (chtype) ((win)->alines[(win)->cury]->line[(win)->curx].ch & + __CHARTEXT); + attr = (attr_t) ((win)->alines[(win)->cury]->line[(win)->curx].attr & + __ATTRIBUTES); + if (__using_color && ((attr & __COLOR) == __default_color)) + attr &= ~__COLOR; + return (ch | attr); +} diff --git a/vendor/netbsd-curses/libcurses/inchnstr.3 b/vendor/netbsd-curses/libcurses/inchnstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/inchnstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/inchstr.3 b/vendor/netbsd-curses/libcurses/inchstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/inchstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/inchstr.c b/vendor/netbsd-curses/libcurses/inchstr.c new file mode 100644 index 0000000..343b1c8 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/inchstr.c @@ -0,0 +1,162 @@ +/* $NetBSD: inchstr.c,v 1.10 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright 2001 Wasabi Systems, Inc. + * All rights reserved. + * + * Written by Simon Burge for Wasabi Systems, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the NetBSD Project by + * Wasabi Systems, Inc. + * 4. The name of Wasabi Systems, Inc. may not be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC. BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * inchstr, inchnstr -- + * Return an array of characters at cursor position from stdscr. + */ +__warn_references(inchstr, + "warning: this program uses inchstr(), which is unsafe."); +int +inchstr(chtype *chstr) +{ + + return winchstr(stdscr, chstr); +} + +int +inchnstr(chtype *chstr, int n) +{ + + return winchnstr(stdscr, chstr, n); +} + +/* + * mvinchstr, mvinchnstr -- + * Return an array of characters at position (y, x) from stdscr. + */ +__warn_references(mvinchstr, + "warning: this program uses mvinchstr(), which is unsafe."); +int +mvinchstr(int y, int x, chtype *chstr) +{ + + return mvwinchstr(stdscr, y, x, chstr); +} + +int +mvinchnstr(int y, int x, chtype *chstr, int n) +{ + + return mvwinchnstr(stdscr, y, x, chstr, n); +} + +/* + * mvwinchstr, mvwinchnstr -- + * Return an array characters at position (y, x) from the given window. + */ +__warn_references(mvwinchstr, + "warning: this program uses mvwinchstr(), which is unsafe."); +int +mvwinchstr(WINDOW *win, int y, int x, chtype *chstr) +{ + + if (wmove(win, y, x) == ERR) + return ERR; + + return winchstr(win, chstr); +} + +int +mvwinchnstr(WINDOW *win, int y, int x, chtype *chstr, int n) +{ + + if (wmove(win, y, x) == ERR) + return ERR; + + return winchnstr(win, chstr, n); +} + +#endif /* _CURSES_USE_MACROS */ + +/* + * winchstr, winchnstr -- + * Return an array of characters at cursor position. + */ +__warn_references(winchstr, + "warning: this program uses winchstr(), which is unsafe."); +int +winchstr(WINDOW *win, chtype *chstr) +{ + + return winchnstr(win, chstr, -1); +} + +/* + * XXX: This should go in a manpage! + * - SUSv2/xcurses doesn't document whether the trailing 0 is included + * in the length count or not. For safety's sake it _is_ included. + */ +int +winchnstr(WINDOW *win, chtype *chstr, int n) +{ + __LDATA *end, *start; + int epos; + + if (chstr == NULL) + return ERR; + + start = &win->alines[win->cury]->line[win->curx]; + /* (n - 1) to leave room for the trailing 0 element */ + if (n < 0 || (n - 1) > win->maxx - win->curx - 1) + epos = win->maxx - 1; + else + /* extra -1 for trailing NUL */ + epos = win->curx + n -1 - 1; + end = &win->alines[win->cury]->line[epos]; + + while (start <= end) { + /* or in the attributes but strip out internal flags */ +#ifdef HAVE_WCHAR + *chstr = start->ch | (start->attr & ~__ACS_IS_WACS); +#else + *chstr = start->ch | start->attr; +#endif + chstr++; + start++; + } + *chstr = 0; + + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/init_color.3 b/vendor/netbsd-curses/libcurses/init_color.3 new file mode 120000 index 0000000..1f101c9 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/init_color.3 @@ -0,0 +1 @@ +curses_color.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/init_pair.3 b/vendor/netbsd-curses/libcurses/init_pair.3 new file mode 120000 index 0000000..1f101c9 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/init_pair.3 @@ -0,0 +1 @@ +curses_color.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/initscr.3 b/vendor/netbsd-curses/libcurses/initscr.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/initscr.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/initscr.c b/vendor/netbsd-curses/libcurses/initscr.c new file mode 100644 index 0000000..af2fe47 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/initscr.c @@ -0,0 +1,76 @@ +/* $NetBSD: initscr.c,v 1.35 2020/03/12 15:50:11 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + + +/* + * initscr -- + * Initialize the current and standard screen. + */ +WINDOW * +initscr(void) +{ + const char *sp; + +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, "initscr\n"); +#endif + + /* + * If My_term is set, or can't find a terminal in the environment, + * use Def_term. + */ + if (My_term || (sp = getenv("TERM")) == NULL) + sp = Def_term; + + /* LINTED const castaway; newterm does not modify sp! */ + if ((_cursesi_screen = newterm((char *) sp, stdout, stdin)) == NULL) { + /* + * POSIX says we should write a diagnostic and exit on error. + * As such some applications don't bother checking the return + * value at all. + */ + perror("initscr"); + exit(EXIT_FAILURE); + } + + set_term(_cursesi_screen); + wrefresh(curscr); + __ripofftouch(_cursesi_screen); + + return stdscr; +} diff --git a/vendor/netbsd-curses/libcurses/innstr.3 b/vendor/netbsd-curses/libcurses/innstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/innstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/ins_wch.c b/vendor/netbsd-curses/libcurses/ins_wch.c new file mode 100644 index 0000000..3288ae5 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/ins_wch.c @@ -0,0 +1,235 @@ +/* $NetBSD: ins_wch.c,v 1.15 2020/07/06 22:46:50 uwe Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 700 +#include + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * ins_wch -- + * Do an insert-char on the line, leaving (cury, curx) unchanged. + */ +int +ins_wch(const cchar_t *wch) +{ + return wins_wch(stdscr, wch); +} + +/* + * mvins_wch -- + * Do an insert-char on the line at (y, x). + */ +int +mvins_wch(int y, int x, const cchar_t *wch) +{ + return mvwins_wch(stdscr, y, x, wch); +} + +/* + * mvwins_wch -- + * Do an insert-char on the line at (y, x) in the given window. + */ +int +mvwins_wch(WINDOW *win, int y, int x, const cchar_t *wch) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wins_wch(win, wch); +} + +/* + * wins_wch -- + * Do an insert-char on the line, leaving (cury, curx) unchanged. + */ +int +wins_wch(WINDOW *win, const cchar_t *wch) +{ + __LDATA *start, *temp1, *temp2; + __LINE *lnp; + int cw, pcw, x, y, sx, ex, newx, i; + nschar_t *np, *tnp; + wchar_t ws[] = L" "; + + /* check for non-spacing characters */ + if (!wch) + return OK; + cw = wcwidth(wch->vals[0]); + if (cw < 0) + cw = 1; + if (!cw) + return wadd_wch( win, wch ); + +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "--before--\n"); + for (x = 0; x < win->maxx; x++) + __CTRACE(__CTRACE_INPUT, "wins_wch: (0,%d)=(%x,%x,%p)\n", x, + win->alines[0]->line[x].ch, + win->alines[0]->line[x].attr, + win->alines[0]->line[x].nsp); +#endif /* DEBUG */ + x = win->curx; + y = win->cury; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wins_wch: (%d,%d)\n", y, x); +#endif /* DEBUG */ + switch (wch->vals[0]) { + case L'\b': + if (--x < 0) + x = 0; + win->curx = x; + return OK; + case L'\r': + win->curx = 0; + return OK; + case L'\n': + wclrtoeol(win); + if (y == win->scr_b) { + if (!(win->flags & __SCROLLOK)) + return ERR; + scroll(win); + } + return OK; + case L'\t': + if (wins_nwstr(win, ws, min(win->maxx - x, + TABSIZE - (x % TABSIZE))) == ERR) + return ERR; + return OK; + } + + /* locate current cell */ + x = win->curx; + y = win->cury; + lnp = win->alines[y]; + start = &win->alines[y]->line[x]; + sx = x; + pcw = WCOL(*start); + if (pcw < 0) { + start += pcw; + sx += pcw; + } + if (cw > win->maxx - sx) + return ERR; + lnp->flags |= __ISDIRTY; + newx = sx + win->ch_off; + if (newx < *lnp->firstchp) + *lnp->firstchp = newx; + + /* shift all complete characters */ +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wins_wch: shift all characters\n"); +#endif /* DEBUG */ + temp1 = &win->alines[y]->line[win->maxx - 1]; + temp2 = temp1 - cw; + pcw = WCOL(*(temp2 + 1)); + if (pcw < 0) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wins_wch: clear EOL\n"); +#endif /* DEBUG */ + temp2 += pcw; + while (temp1 > temp2 + cw) { + np = temp1->nsp; + if (np) { + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + temp1->nsp = NULL; + } + temp1->ch = (wchar_t)btowc((int)win->bch ); + if (_cursesi_copy_nsp(win->bnsp, temp1) == ERR) + return ERR; + temp1->attr = win->battr; + SET_WCOL(*temp1, 1); + temp1--; + } + } + while (temp2 >= start) { + (void)memcpy(temp1, temp2, sizeof(__LDATA)); + temp1--, temp2--; + } + + /* update character under cursor */ + start->nsp = NULL; + start->ch = wch->vals[0]; + start->attr = wch->attributes & WA_ATTRIBUTES; + SET_WCOL(*start, cw); + if (wch->elements > 1) { + for (i = 1; i < wch->elements; i++) { + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = wch->vals[i]; + np->next = start->nsp; + start->nsp = np; + } + } +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wins_wch: insert (%x,%x,%p)\n", + start->ch, start->attr, start->nsp); +#endif /* DEBUG */ + temp1 = start + 1; + ex = x + 1; + while (ex - x < cw) { + temp1->ch = wch->vals[0]; + SET_WCOL(*temp1, x - ex); + temp1->nsp = NULL; + ex++, temp1++; + } +#ifdef DEBUG + { + __CTRACE(__CTRACE_INPUT, "--after---\n"); + for (x = 0; x < win->maxx; x++) + __CTRACE(__CTRACE_INPUT, + "wins_wch: (0,%d)=(%x,%x,%p)\n", x, + win->alines[0]->line[x].ch, + win->alines[0]->line[x].attr, + win->alines[0]->line[x].nsp); + } +#endif /* DEBUG */ + newx = win->maxx - 1 + win->ch_off; + if (newx > *lnp->lastchp) + *lnp->lastchp = newx; + __touchline(win, y, sx, (int)win->maxx - 1); + __sync(win); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/ins_wstr.c b/vendor/netbsd-curses/libcurses/ins_wstr.c new file mode 100644 index 0000000..bf39bc1 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/ins_wstr.c @@ -0,0 +1,328 @@ +/* $NetBSD: ins_wstr.c,v 1.15 2020/07/06 22:46:50 uwe Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 700 +#include + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * ins_wstr -- + * insert a multi-character wide-character string into the current window + */ +int +ins_wstr(const wchar_t *wstr) +{ + return wins_wstr(stdscr, wstr); +} + +/* + * ins_nwstr -- + * insert a multi-character wide-character string into the current window + * with at most n characters + */ +int +ins_nwstr(const wchar_t *wstr, int n) +{ + return wins_nwstr(stdscr, wstr, n); +} + +/* + * mvins_wstr -- + * Do an insert-string on the line at (y, x). + */ +int +mvins_wstr(int y, int x, const wchar_t *wstr) +{ + return mvwins_wstr(stdscr, y, x, wstr); +} + +/* + * mvins_nwstr -- + * Do an insert-n-string on the line at (y, x). + */ +int +mvins_nwstr(int y, int x, const wchar_t *wstr, int n) +{ + return mvwins_nwstr(stdscr, y, x, wstr, n); +} + +/* + * mvwins_wstr -- + * Do an insert-string on the line at (y, x) in the given window. + */ +int +mvwins_wstr(WINDOW *win, int y, int x, const wchar_t *wstr) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wins_wstr(win, wstr); +} + +/* + * mvwins_nwstr -- + * Do an insert-n-string on the line at (y, x) in the given window. + */ +int +mvwins_nwstr(WINDOW *win, int y, int x, const wchar_t *wstr, int n) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return wins_nwstr(win, wstr, n); +} + + +/* + * wins_wstr -- + * Do an insert-string on the line, leaving (cury, curx) unchanged. + */ +int +wins_wstr(WINDOW *win, const wchar_t *wstr) +{ + return wins_nwstr(win, wstr, -1); +} + +/* + * wins_nwstr -- + * Do an insert-n-string on the line, leaving (cury, curx) unchanged. + */ +int +wins_nwstr(WINDOW *win, const wchar_t *wstr, int n) +{ + __LDATA *start, *temp1, *temp2; + __LINE *lnp; + const wchar_t *scp; + int width, len, sx, x, y, cw, pcw, newx; + nschar_t *np; + wchar_t ws[] = L" "; + + /* check for leading non-spacing character */ + if (!wstr) + return OK; + cw = wcwidth(*wstr); + if (cw < 0) + cw = 1; + if (!cw) + return ERR; + + scp = wstr + 1; + width = cw; + len = 1; + n--; + while (*scp) { + int w; + if (!n) + break; + w = wcwidth(*scp); + if (w < 0) + w = 1; + n--, len++, width += w; + scp++; + } +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wins_nwstr: width=%d,len=%d\n", width, len); +#endif /* DEBUG */ + + if (cw > win->maxx - win->curx + 1) + return ERR; + start = &win->alines[win->cury]->line[win->curx]; + sx = win->curx; + lnp = win->alines[win->cury]; + pcw = WCOL(*start); + if (pcw < 0) { + sx += pcw; + start += pcw; + } +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wins_nwstr: start@(%d)\n", sx); +#endif /* DEBUG */ + pcw = WCOL(*start); + lnp->flags |= __ISDIRTY; + newx = sx + win->ch_off; + if (newx < *lnp->firstchp) + *lnp->firstchp = newx; +#ifdef DEBUG + { + __CTRACE(__CTRACE_INPUT, "========before=======\n"); + for (x = 0; x < win->maxx; x++) + __CTRACE(__CTRACE_INPUT, + "wins_nwstr: (%d,%d)=(%x,%x,%p)\n", + (int) win->cury, x, + win->alines[win->cury]->line[x].ch, + win->alines[win->cury]->line[x].attr, + win->alines[win->cury]->line[x].nsp); + } +#endif /* DEBUG */ + + /* shift all complete characters */ + if (sx + width + pcw <= win->maxx) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "wins_nwstr: shift all characters\n"); +#endif /* DEBUG */ + temp1 = &win->alines[win->cury]->line[win->maxx - 1]; + temp2 = temp1 - width; + pcw = WCOL(*(temp2 + 1)); + if (pcw < 0) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "wins_nwstr: clear from %d to EOL(%d)\n", + win->maxx + pcw, win->maxx - 1); +#endif /* DEBUG */ + temp2 += pcw; + while (temp1 > temp2 + width) { + temp1->ch = (wchar_t)btowc((int) win->bch); + if (_cursesi_copy_nsp(win->bnsp, temp1) == ERR) + return ERR; + temp1->attr = win->battr; + SET_WCOL(*temp1, 1); +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "wins_nwstr: empty cell(%p)\n", temp1); +#endif /* DEBUG */ + temp1--; + } + } + while (temp2 >= start) { + (void)memcpy(temp1, temp2, sizeof(__LDATA)); + temp1--, temp2--; + } +#ifdef DEBUG + { + __CTRACE(__CTRACE_INPUT, "=====after shift====\n"); + for (x = 0; x < win->maxx; x++) + __CTRACE(__CTRACE_INPUT, + "wins_nwstr: (%d,%d)=(%x,%x,%p)\n", + (int) win->cury, x, + win->alines[win->cury]->line[x].ch, + win->alines[win->cury]->line[x].attr, + win->alines[win->cury]->line[x].nsp); + } +#endif /* DEBUG */ + } + + /* update string columns */ + x = win->curx; + y = win->cury; + for (scp = wstr, temp1 = start; len; len--, scp++) { + switch (*scp) { + case L'\b': + if (--x < 0) + x = 0; + win->curx = x; + continue;; + case L'\r': + win->curx = 0; + continue; + case L'\n': + wclrtoeol(win); + if (y == win->scr_b) { + if (!(win->flags & __SCROLLOK)) + return ERR; + scroll(win); + } + continue; + case L'\t': + if (wins_nwstr(win, ws, + min(win->maxx - x, TABSIZE - (x % TABSIZE))) + == ERR) + return ERR; + continue; + } + cw = wcwidth(*scp); + if (cw < 0) + cw = 1; + if (cw) { + /* 1st column */ + temp1->ch = (wchar_t)*scp; + temp1->attr = win->wattr; + SET_WCOL(*temp1, cw); + temp1->nsp = NULL; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "wins_nwstr: add spacing char(%x)\n", temp1->ch); +#endif /* DEBUG */ + temp2 = temp1++; + if (cw > 1) { + x = -1; + while (temp1 < temp2 + cw) { + /* the rest columns */ + temp1->ch = (wchar_t)*scp; + temp1->attr = win->wattr; + temp1->nsp = NULL; + SET_WCOL(*temp1, x); + temp1++, x--; + } + temp1--; + } + } else { + /* non-spacing character */ + np = malloc(sizeof(nschar_t)); + if (!np) + return ERR; + np->ch = *scp; + np->next = temp1->nsp; + temp1->nsp = np; +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, + "wins_nstr: add non-spacing char(%x)\n", np->ch); +#endif /* DEBUG */ + } + } +#ifdef DEBUG + { + __CTRACE(__CTRACE_INPUT, "========after=======\n"); + for (x = 0; x < win->maxx; x++) + __CTRACE(__CTRACE_INPUT, + "wins_nwstr: (%d,%d)=(%x,%x,%p)\n", + (int) win->cury, x, + win->alines[win->cury]->line[x].ch, + win->alines[win->cury]->line[x].attr, + win->alines[win->cury]->line[x].nsp); + } +#endif /* DEBUG */ + newx = win->maxx - 1 + win->ch_off; + if (newx > *lnp->lastchp) + *lnp->lastchp = newx; + __touchline(win, (int) win->cury, sx, (int) win->maxx - 1); + __sync(win); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/insch.3 b/vendor/netbsd-curses/libcurses/insch.3 new file mode 120000 index 0000000..9d46b67 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/insch.3 @@ -0,0 +1 @@ +curses_insch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/insch.c b/vendor/netbsd-curses/libcurses/insch.c new file mode 100644 index 0000000..f89b5ff --- /dev/null +++ b/vendor/netbsd-curses/libcurses/insch.c @@ -0,0 +1,126 @@ +/* $NetBSD: insch.c,v 1.26 2020/07/06 22:46:50 uwe Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * insch -- + * Do an insert-char on the line, leaving (cury, curx) unchanged. + */ +int +insch(chtype ch) +{ + + return winsch(stdscr, ch); +} + +/* + * mvinsch -- + * Do an insert-char on the line at (y, x). + */ +int +mvinsch(int y, int x, chtype ch) +{ + + return mvwinsch(stdscr, y, x, ch); +} + +/* + * mvwinsch -- + * Do an insert-char on the line at (y, x) in the given window. + */ +int +mvwinsch(WINDOW *win, int y, int x, chtype ch) +{ + + if (wmove(win, y, x) == ERR) + return ERR; + + return winsch(win, ch); +} + +#endif + +/* + * winsch -- + * Do an insert-char on the line, leaving (cury, curx) unchanged. + */ +int +winsch(WINDOW *win, chtype ch) +{ + __LDATA *end, *temp1, *temp2; + attr_t attr; + + if (__using_color) + attr = win->battr & __COLOR; + else + attr = 0; + end = &win->alines[win->cury]->line[win->curx]; + temp1 = &win->alines[win->cury]->line[win->maxx - 1]; + temp2 = temp1 - 1; + while (temp1 > end) { + (void)memcpy(temp1, temp2, sizeof(__LDATA)); + temp1--, temp2--; + } + temp1->ch = (wchar_t)ch & __CHARTEXT; + if (temp1->ch == ' ') + temp1->ch = win->bch; + temp1->attr = (attr_t) ch & __ATTRIBUTES; + if (temp1->attr & __COLOR) + temp1->attr |= (win->battr & ~__COLOR); + else + temp1->attr |= win->battr; +#ifdef HAVE_WCHAR + if (_cursesi_copy_nsp(win->bnsp, temp1) == ERR) + return ERR; + SET_WCOL(*temp1, 1); +#endif /* HAVE_WCHAR */ + __touchline(win, (int)win->cury, (int)win->curx, (int)win->maxx - 1); + if (win->cury == LINES - 1 && + (win->alines[LINES - 1]->line[COLS - 1].ch != ' ' || + win->alines[LINES - 1]->line[COLS - 1].attr != attr)) { + if (win->flags & __SCROLLOK) { + wrefresh(win); + scroll(win); + win->cury--; + } else + return ERR; + } + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/insdelln.3 b/vendor/netbsd-curses/libcurses/insdelln.3 new file mode 120000 index 0000000..58d27ba --- /dev/null +++ b/vendor/netbsd-curses/libcurses/insdelln.3 @@ -0,0 +1 @@ +curses_insdelln.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/insdelln.c b/vendor/netbsd-curses/libcurses/insdelln.c new file mode 100644 index 0000000..1ab23a8 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/insdelln.c @@ -0,0 +1,180 @@ +/* $NetBSD: insdelln.c,v 1.18 2017/01/06 13:53:18 roy Exp $ */ + +/* + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +/* + * Based on deleteln.c and insertln.c - + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + */ + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * insdelln -- + * Insert or delete lines on stdscr, leaving (cury, curx) unchanged. + */ +int +insdelln(int nlines) +{ + + return winsdelln(stdscr, nlines); +} + +#endif + +/* + * winsdelln -- + * Insert or delete lines on the window, leaving (cury, curx) unchanged. + */ +int +winsdelln(WINDOW *win, int nlines) +{ + int y, i, last; + __LINE *temp; +#ifdef HAVE_WCHAR + __LDATA *lp; +#endif /* HAVE_WCHAR */ + attr_t attr; + +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, + "winsdelln: (%p) cury=%d lines=%d\n", win, win->cury, nlines); +#endif + + if (!nlines) + return OK; + + if (__using_color && win != curscr) + attr = win->battr & __COLOR; + else + attr = 0; + + if (nlines > 0) { + /* Insert lines */ + if (win->cury < win->scr_t || win->cury > win->scr_b) { + /* Outside scrolling region */ + if (nlines > win->maxy - win->cury) + nlines = win->maxy - win->cury; + last = win->maxy - 1; + } else { + /* Inside scrolling region */ + if (nlines > win->scr_b + 1 - win->cury) + nlines = win->scr_b + 1 - win->cury; + last = win->scr_b; + } + for (y = last - nlines; y >= win->cury; --y) { + win->alines[y]->flags &= ~__ISPASTEOL; + win->alines[y + nlines]->flags &= ~__ISPASTEOL; + if (win->orig == NULL) { + temp = win->alines[y + nlines]; + win->alines[y + nlines] = win->alines[y]; + win->alines[y] = temp; + } else { + (void)memcpy(win->alines[y + nlines]->line, + win->alines[y]->line, + (size_t)win->maxx * __LDATASIZE); + } + } + for (y = win->cury - 1 + nlines; y >= win->cury; --y) + for (i = 0; i < win->maxx; i++) { + win->alines[y]->line[i].ch = win->bch; + win->alines[y]->line[i].attr = attr; +#ifndef HAVE_WCHAR + win->alines[y]->line[i].ch = win->bch; +#else + win->alines[y]->line[i].ch + = (wchar_t)btowc((int)win->bch ); + lp = &win->alines[y]->line[i]; + if (_cursesi_copy_nsp(win->bnsp, lp) == ERR) + return ERR; + SET_WCOL(*lp, 1); +#endif /* HAVE_WCHAR */ + } + for (y = last; y >= win->cury; --y) + __touchline(win, y, 0, (int)win->maxx - 1); + } else { + /* Delete nlines */ + nlines = 0 - nlines; + if (win->cury < win->scr_t || win->cury > win->scr_b) { + /* Outside scrolling region */ + if (nlines > win->maxy - win->cury) + nlines = win->maxy - win->cury; + last = win->maxy; + } else { + /* Inside scrolling region */ + if (nlines > win->scr_b + 1 - win->cury) + nlines = win->scr_b + 1 - win->cury; + last = win->scr_b + 1; + } + for (y = win->cury; y < last - nlines; y++) { + win->alines[y]->flags &= ~__ISPASTEOL; + win->alines[y + nlines]->flags &= ~__ISPASTEOL; + if (win->orig == NULL) { + temp = win->alines[y]; + win->alines[y] = win->alines[y + nlines]; + win->alines[y + nlines] = temp; + } else { + (void)memcpy(win->alines[y]->line, + win->alines[y + nlines]->line, + (size_t)win->maxx * __LDATASIZE); + } + } + for (y = last - nlines; y < last; y++) + for (i = 0; i < win->maxx; i++) { + win->alines[y]->line[i].ch = win->bch; + win->alines[y]->line[i].attr = attr; +#ifndef HAVE_WCHAR + win->alines[y]->line[i].ch = win->bch; +#else + win->alines[y]->line[i].ch + = (wchar_t)btowc((int)win->bch); + lp = &win->alines[y]->line[i]; + SET_WCOL( *lp, 1 ); + if (_cursesi_copy_nsp(win->bnsp, lp) == ERR) + return ERR; +#endif /* HAVE_WCHAR */ + } + for (y = win->cury; y < last; y++) + __touchline(win, y, 0, (int)win->maxx - 1); + } + if (win->orig != NULL) + __id_subwins(win->orig); + __sync(win); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/insertln.3 b/vendor/netbsd-curses/libcurses/insertln.3 new file mode 120000 index 0000000..0e46445 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/insertln.3 @@ -0,0 +1 @@ +curses_insertln.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/insertln.c b/vendor/netbsd-curses/libcurses/insertln.c new file mode 100644 index 0000000..abb8a0c --- /dev/null +++ b/vendor/netbsd-curses/libcurses/insertln.c @@ -0,0 +1,61 @@ +/* $NetBSD: insertln.c,v 1.14 2017/01/06 13:53:18 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * insertln -- + * Do an insert-line on stdscr, leaving (cury, curx) unchanged. + */ +int +insertln(void) +{ + + return winsdelln(stdscr, 1); +} + +#endif + +/* + * winsertln -- + * Do an insert-line on the window, leaving (cury, curx) unchanged. + */ +int +winsertln(WINDOW *win) +{ + + return winsdelln(win, 1); +} diff --git a/vendor/netbsd-curses/libcurses/insstr.c b/vendor/netbsd-curses/libcurses/insstr.c new file mode 100644 index 0000000..4bf1fcf --- /dev/null +++ b/vendor/netbsd-curses/libcurses/insstr.c @@ -0,0 +1,215 @@ +/* $NetBSD: insstr.c,v 1.8 2020/07/06 22:46:50 uwe Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * insstr -- + * insert a multi-byte character string into the current window + */ +int +insstr(const char *str) +{ + + return winsstr(stdscr, str); +} + +/* + * insnstr -- + * insert a multi-byte character string into the current window + * with at most n characters + */ +int +insnstr(const char *str, int n) +{ + + return winsnstr(stdscr, str, n); +} + +/* + * mvinsstr -- + * Do an insert-string on the line at (y, x). + */ +int +mvinsstr(int y, int x, const char *str) +{ + + return mvwinsstr(stdscr, y, x, str); +} + +/* + * mvinsnstr -- + * Do an insert-n-string on the line at (y, x). + */ +int +mvinsnstr(int y, int x, const char *str, int n) +{ + + return mvwinsnstr(stdscr, y, x, str, n); +} + +/* + * mvwinsstr -- + * Do an insert-string on the line at (y, x) in the given window. + */ +int +mvwinsstr(WINDOW *win, int y, int x, const char *str) +{ + + if (wmove(win, y, x) == ERR) + return ERR; + + return winsstr(win, str); +} + +/* + * mvwinsnstr -- + * Do an insert-n-string on the line at (y, x) in the given window. + */ +int +mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n) +{ + + if (wmove(win, y, x) == ERR) + return ERR; + + return winsnstr(win, str, n); +} + +#endif + +/* + * winsstr -- + * Do an insert-string on the line, leaving (cury, curx) unchanged. + * No wrapping. + */ +int +winsstr(WINDOW *win, const char *str) +{ + + return winsnstr(win, str, -1); +} + +/* + * winsnstr -- + * Do an insert-n-string on the line, leaving (cury, curx) unchanged. + * Performs wrapping. + */ +int +winsnstr(WINDOW *win, const char *str, int n) +{ + __LDATA *end, *temp1, *temp2; + const char *scp; + int len, x; + __LINE *lnp; +#ifdef HAVE_WCHAR + nschar_t *np, *tnp; +#endif /* HAVE_WCHAR */ + + /* find string length */ + if (n > 0) + for (scp = str, len = 0; n-- && *scp++; ++len); + else + for (scp = str, len = 0; *scp++; ++len); +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "winsnstr: len = %d\n", len); +#endif /* DEBUG */ + + /* move string */ + end = &win->alines[win->cury]->line[win->curx]; + if (len < win->maxx - win->curx) { +#ifdef DEBUG + __CTRACE(__CTRACE_INPUT, "winsnstr: shift %d cells\n", len); +#endif /* DEBUG */ + temp1 = &win->alines[win->cury]->line[win->maxx - 1]; + temp2 = temp1 - len; + while (temp2 >= end) { +#ifdef HAVE_WCHAR + np = temp1->nsp; + if (np){ + while (np) { + tnp = np->next; + free(np); + np = tnp; + } + temp1->nsp = NULL; + } +#endif /* HAVE_WCHAR */ + (void)memcpy(temp1, temp2, sizeof(__LDATA)); + temp1--, temp2--; + } + } + + for (scp = str, temp1 = end, x = win->curx; + *scp && x < len + win->curx && x < win->maxx; + scp++, temp1++, x++) + { + temp1->ch = (wchar_t)*scp & __CHARTEXT; + temp1->attr = win->wattr; +#ifdef HAVE_WCHAR + SET_WCOL(*temp1, 1); +#endif /* HAVE_WCHAR */ + } +#ifdef DEBUG + { + int i; + + for (i = win->curx; i < win->curx + len; i++) { + __CTRACE(__CTRACE_INPUT, + "winsnstr: (%d,%d)=('%c',%x)\n", win->cury, i, + win->alines[win->cury]->line[i].ch, + win->alines[win->cury]->line[i].attr); + } + } +#endif /* DEBUG */ + lnp = win->alines[win->cury]; + lnp->flags |= __ISDIRTY; + if (win->ch_off < *lnp->firstchp) + *lnp->firstchp = win->ch_off; + if (win->ch_off + win->maxx - 1 > *lnp->lastchp) + *lnp->lastchp = win->ch_off + win->maxx - 1; + __touchline(win, (int)win->cury, (int)win->curx, (int)win->maxx - 1); + __sync(win); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/instr.3 b/vendor/netbsd-curses/libcurses/instr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/instr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/instr.c b/vendor/netbsd-curses/libcurses/instr.c new file mode 100644 index 0000000..d76c7c1 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/instr.c @@ -0,0 +1,166 @@ +/* $NetBSD: instr.c,v 1.7 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright 2001 Wasabi Systems, Inc. + * All rights reserved. + * + * Written by Simon Burge for Wasabi Systems, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed for the NetBSD Project by + * Wasabi Systems, Inc. + * 4. The name of Wasabi Systems, Inc. may not be used to endorse + * or promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC. BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * instr, innstr -- + * Return a string of characters at cursor position from stdscr. + */ +__warn_references(instr, + "warning: this program uses instr(), which is unsafe."); +int +instr(char *str) +{ + return winstr(stdscr, str); +} + +int +innstr(char *str, int n) +{ + return winnstr(stdscr, str, n); +} + +/* + * mvinstr, mvinnstr -- + * Return a string of characters at position (y, x) from stdscr. + * XXX: should be multi-byte characters for SUSv2. + */ +__warn_references(mvinstr, + "warning: this program uses mvinstr(), which is unsafe."); +int +mvinstr(int y, int x, char *str) +{ + return mvwinstr(stdscr, y, x, str); +} + +int +mvinnstr(int y, int x, char *str, int n) +{ + return mvwinnstr(stdscr, y, x, str, n); +} + +/* + * mvwinstr, mvwinnstr -- + * Return an array characters at position (y, x) from the given window. + * XXX: should be multi-byte characters for SUSv2. + */ +__warn_references(mvwinstr, + "warning: this program uses mvwinstr(), which is unsafe."); +int +mvwinstr(WINDOW *win, int y, int x, char *str) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return winstr(win, str); +} + +int +mvwinnstr(WINDOW *win, int y, int x, char *str, int n) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return winnstr(win, str, n); +} + +#endif /* _CURSES_USE_MACROS */ + +/* + * winstr, winnstr -- + * Return a string of characters at cursor position. + * XXX: should be multi-byte characters for SUSv2. + */ +__warn_references(winstr, + "warning: this program uses winstr(), which is unsafe."); +int +winstr(WINDOW *win, char *str) +{ + + return winnstr(win, str, -1); +} + +/* + * XXX: This should go in a manpage! + * - winnstr() returns the number of characters copied only of if it is + * called with n >= 0 (ie, as inchnstr(), mvinchnstr(), mvwinchnstr() + * or winchnstr()). If N < 0, it returns `OK'. + * - SUSv2/xcurses doesn't document whether the trailing NUL is included + * in the length count or not. For safety's sake it _is_ included. + * - This implementation does not (yet) support multi-byte characters + * strings. + */ +int +winnstr(WINDOW *win, char *str, int n) +{ + __LDATA *end, *start; + int epos, sn; + + if (str == NULL) + return ERR; + + sn = n; + start = &win->alines[win->cury]->line[win->curx]; + /* (n - 1) to leave room for the trailing NUL */ + if (n < 0 || (n - 1) > win->maxx - win->curx - 1) { + epos = win->maxx - 1; + n = win->maxx - win->curx; + } else { + /* extra -1 for trailing NUL */ + epos = win->curx + n - 1 - 1; + n--; + } + end = &win->alines[win->cury]->line[epos]; + + while (start <= end) { + *str = start->ch & __CHARTEXT; + str++; + start++; + } + *str = '\0'; + + if (sn < 0) + return OK; + else + return n; +} diff --git a/vendor/netbsd-curses/libcurses/intrflush.3 b/vendor/netbsd-curses/libcurses/intrflush.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/intrflush.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/inwstr.c b/vendor/netbsd-curses/libcurses/inwstr.c new file mode 100644 index 0000000..93f32ca --- /dev/null +++ b/vendor/netbsd-curses/libcurses/inwstr.c @@ -0,0 +1,159 @@ +/* $NetBSD: inwstr.c,v 1.8 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * inwstr, innwstr -- + * Return a string of wide characters at cursor position from stdscr. + */ +__warn_references(inwstr, + "warning: this program uses inwstr(), which is unsafe."); +int +inwstr(wchar_t *wstr) +{ + return winwstr(stdscr, wstr); +} + +int +innwstr(wchar_t *wstr, int n) +{ + return winnwstr(stdscr, wstr, n); +} + +/* + * mvinwstr, mvinnwstr -- + * Return a string of wide characters at position (y, x) from stdscr. + */ +__warn_references(mvinwstr, + "warning: this program uses mvinwstr(), which is unsafe."); +int +mvinwstr(int y, int x, wchar_t *wstr) +{ + return mvwinwstr(stdscr, y, x, wstr); +} + +int +mvinnwstr(int y, int x, wchar_t *wstr, int n) +{ + return mvwinnwstr(stdscr, y, x, wstr, n); +} + +/* + * mvwinwstr, mvwinnwstr -- + * Return an array wide characters at position (y, x) from the given window. + */ +__warn_references(mvwinwstr, + "warning: this program uses mvwinwstr(), which is unsafe."); +int +mvwinwstr(WINDOW *win, int y, int x, wchar_t *wstr) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return winwstr(win, wstr); +} + +int +mvwinnwstr(WINDOW *win, int y, int x, wchar_t *wstr, int n) +{ + if (wmove(win, y, x) == ERR) + return ERR; + + return winnwstr(win, wstr, n); +} + +/* + * winwstr, winnwstr -- + * Return a string of wide characters at cursor position. + */ +__warn_references(winwstr, + "warning: this program uses winwstr(), which is unsafe."); +int +winwstr(WINDOW *win, wchar_t *wstr) +{ + + return winnwstr(win, wstr, -1); +} + +/* + * - winnwstr() returns the number of characters copied only of if it is + * called with n >= 0 (ie, as in_wchnstr(), mvin_wchnstr(), mvwin_wchnstr() + * or win_wchnstr()). If N < 0, it returns `OK'. + * - SUSv2/xcurses doesn't document whether the trailing NUL is included + * in the length count or not. For safety's sake it _is_ included. + * - This implementation does not (yet) support multi-byte characters + * strings. + */ +int +winnwstr(WINDOW *win, wchar_t *wstr, int n) +{ + __LDATA *start; + int x, cw, cnt; + wchar_t *wcp; + + if (wstr == NULL) + return ERR; + + start = &win->alines[win->cury]->line[win->curx]; + x = win->curx; + cw = WCOL(*start); + if (cw < 0) { + start += cw; + x += cw; + } + cnt = 0; + wcp = wstr; + /* (n - 1) to leave room for the trailing 0 element */ + while ((x < win->maxx) && ((n < 0) || ((n > 1) && (cnt < n - 1)))) { + cw = WCOL(*start); + *wcp = start->ch; + wcp++; + cnt++; + x += cw; + if (x < win->maxx) + start += cw; + } + *wcp = L'\0'; + + if (n < 0) + return OK; + else + return cnt; +} diff --git a/vendor/netbsd-curses/libcurses/is_keypad.3 b/vendor/netbsd-curses/libcurses/is_keypad.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/is_keypad.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/is_leaveok.3 b/vendor/netbsd-curses/libcurses/is_leaveok.3 new file mode 120000 index 0000000..7a991d5 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/is_leaveok.3 @@ -0,0 +1 @@ +curses_refresh.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/is_linetouched.3 b/vendor/netbsd-curses/libcurses/is_linetouched.3 new file mode 120000 index 0000000..52075e3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/is_linetouched.3 @@ -0,0 +1 @@ +curses_touch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/is_pad.3 b/vendor/netbsd-curses/libcurses/is_pad.3 new file mode 120000 index 0000000..3904c3b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/is_pad.3 @@ -0,0 +1 @@ +curses_pad.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/is_term_resized.3 b/vendor/netbsd-curses/libcurses/is_term_resized.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/is_term_resized.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/is_wintouched.3 b/vendor/netbsd-curses/libcurses/is_wintouched.3 new file mode 120000 index 0000000..52075e3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/is_wintouched.3 @@ -0,0 +1 @@ +curses_touch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/isendwin.3 b/vendor/netbsd-curses/libcurses/isendwin.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/isendwin.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/keymap.h b/vendor/netbsd-curses/libcurses/keymap.h new file mode 100644 index 0000000..c6c44c3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/keymap.h @@ -0,0 +1,116 @@ +/* $NetBSD: keymap.h,v 1.4 2012/04/21 12:27:28 roy Exp $ */ + +/* + * Copyright (c) 2005 The NetBSD Foundation Inc. + * All rights reserved. + * + * This code is derived from code donated to the NetBSD Foundation + * by Ruibiao Qiu . + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _KEYMAP_H_ +#define _KEYMAP_H_ + +#include +#ifndef lint +__RCSID("$NetBSD: keymap.h,v 1.4 2012/04/21 12:27:28 roy Exp $"); +#endif /* not lint */ + +/* keymap related stuff */ +/* + * moved here by Ruibiao Qiu + * because it is needed by both getch() and get_wch() + * + * Keyboard input handler. Do this by snarfing + * all the info we can out of the terminfo entry for TERM and putting it + * into a set of keymaps. A keymap is an array the size of all the possible + * single characters we can get, the contents of the array is a structure + * that contains the type of entry this character is (i.e. part/end of a + * multi-char sequence or a plain char) and either a pointer which will point + * to another keymap (in the case of a multi-char sequence) OR the data value + * that this key should return. + * + */ + +/* private data structures for holding the key definitions */ +typedef struct key_entry key_entry_t; + +struct key_entry { + short type; /* type of key this is */ + bool enable; /* true if the key is active */ + union { + keymap_t *next; /* next keymap is key is multi-key sequence */ + wchar_t symbol; /* key symbol if key is a leaf entry */ + } value; +}; +/* Types of key structures we can have */ +#define KEYMAP_MULTI 1 /* part of a multi char sequence */ +#define KEYMAP_LEAF 2 /* key has a symbol associated with it, either + * it is the end of a multi-char sequence or a + * single char key that generates a symbol */ + +/* allocate this many key_entry structs at once to speed start up must + * be a power of 2. + */ +#define KEYMAP_ALLOC_CHUNK 4 + +/* The max number of different chars we can receive */ +#define MAX_CHAR 256 + +/* + * Unused mapping flag. + */ +#define MAPPING_UNUSED (0 - MAX_CHAR) /* never been used */ + +struct keymap { + int count; /* count of number of key structs allocated */ + short mapping[MAX_CHAR]; /* mapping of key to allocated structs */ + key_entry_t **key; /* dynamic array of keys */ +}; + +#define INC_POINTER(ptr) do { \ + (ptr)++; \ + (ptr) %= INBUF_SZ; \ +} while(/*CONSTCOND*/0) + +#define INKEY_NORM 0 /* no key backlog to process */ +#define INKEY_ASSEMBLING 1 /* assembling a multi-key sequence */ +#define INKEY_BACKOUT 2 /* recovering from an unrecognised key */ +#define INKEY_TIMEOUT 3 /* multi-key sequence timeout */ +#ifdef HAVE_WCHAR +#define INKEY_WCASSEMBLING 4 /* assembling a wide char sequence */ +#endif /* HAVE_WCHAR */ + +/* The terminfo data we are interested in and the symbols they map to */ +struct tcdata { + int code; /* code of the terminfo entry */ + wchar_t symbol; /* the symbol associated with it */ +}; + +#endif /* _KEYMAP_H_ */ diff --git a/vendor/netbsd-curses/libcurses/keyname.3 b/vendor/netbsd-curses/libcurses/keyname.3 new file mode 120000 index 0000000..19772ac --- /dev/null +++ b/vendor/netbsd-curses/libcurses/keyname.3 @@ -0,0 +1 @@ +curses_keyname.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/keyname.c b/vendor/netbsd-curses/libcurses/keyname.c new file mode 100644 index 0000000..932bc31 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/keyname.c @@ -0,0 +1,241 @@ +/* $NetBSD: keyname.c,v 1.8 2019/06/11 10:17:24 blymn Exp $ */ + +/*- + * Copyright (c) 2003 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +#define KEYNAMEMAX (size_t) 14 /* "KEY_BACKSPACE\0" */ +static char name[KEYNAMEMAX + 1]; + +#define KT_ENTRY(START, KV, KEY) [KV - START] = KEY + +static const char keytab1[][5] = { + KT_ENTRY(0x101, KEY_BREAK, "BREAK"), + KT_ENTRY(0x101, KEY_DOWN, "DOWN"), + KT_ENTRY(0x101, KEY_UP, "UP"), + KT_ENTRY(0x101, KEY_LEFT, "LEFT"), + KT_ENTRY(0x101, KEY_RIGHT, "RIGHT"), + KT_ENTRY(0x101, KEY_HOME, "HOME"), +}; + +static const char keytab2[][6] = { + KT_ENTRY(0x148, KEY_DL, "DL"), + KT_ENTRY(0x148, KEY_IL, "IL"), + KT_ENTRY(0x148, KEY_DC, "DC"), + KT_ENTRY(0x148, KEY_IC, "IC"), + KT_ENTRY(0x148, KEY_EIC, "EIC"), + KT_ENTRY(0x148, KEY_CLEAR, "CLEAR"), + KT_ENTRY(0x148, KEY_EOS, "EOS"), + KT_ENTRY(0x148, KEY_EOL, "EOL"), + KT_ENTRY(0x148, KEY_SF, "SF"), + KT_ENTRY(0x148, KEY_SR, "SR"), + KT_ENTRY(0x148, KEY_NPAGE, "NPAGE"), + KT_ENTRY(0x148, KEY_PPAGE, "PPAGE"), + KT_ENTRY(0x148, KEY_STAB, "STAB"), + KT_ENTRY(0x148, KEY_CTAB, "CTAB"), + KT_ENTRY(0x148, KEY_CATAB, "CATAB"), + KT_ENTRY(0x148, KEY_ENTER, "ENTER"), + KT_ENTRY(0x148, KEY_SRESET, "SRESET"), + KT_ENTRY(0x148, KEY_RESET, "RESET"), + KT_ENTRY(0x148, KEY_PRINT, "PRINT"), + KT_ENTRY(0x148, KEY_LL, "LL"), + KT_ENTRY(0x148, KEY_A1, "A1"), + KT_ENTRY(0x148, KEY_A3, "A3"), + KT_ENTRY(0x148, KEY_B2, "B2"), + KT_ENTRY(0x148, KEY_C1, "C1"), + KT_ENTRY(0x148, KEY_C3, "C3"), + KT_ENTRY(0x148, KEY_BTAB, "BTAB"), + KT_ENTRY(0x148, KEY_BEG, "BEG"), + KT_ENTRY(0x148, KEY_CANCEL, "CANCEL"), + KT_ENTRY(0x148, KEY_CLOSE, "CLOSE"), +}; + +#define KEYTAB3_START KEY_COMMAND +static const char keytab3[][9] = { + KT_ENTRY(KEYTAB3_START, KEY_COMMAND, "COMMAND"), + KT_ENTRY(KEYTAB3_START, KEY_COPY, "COPY"), + KT_ENTRY(KEYTAB3_START, KEY_CREATE, "CREATE"), + KT_ENTRY(KEYTAB3_START, KEY_END, "END"), + KT_ENTRY(KEYTAB3_START, KEY_EXIT, "EXIT"), + KT_ENTRY(KEYTAB3_START, KEY_FIND, "FIND"), + KT_ENTRY(KEYTAB3_START, KEY_HELP, "HELP"), + KT_ENTRY(KEYTAB3_START, KEY_MARK, "MARK"), + KT_ENTRY(KEYTAB3_START, KEY_MESSAGE, "MESSAGE"), + KT_ENTRY(KEYTAB3_START, KEY_MOVE, "MOVE"), + KT_ENTRY(KEYTAB3_START, KEY_NEXT, "NEXT"), + KT_ENTRY(KEYTAB3_START, KEY_OPEN, "OPEN"), + KT_ENTRY(KEYTAB3_START, KEY_OPTIONS, "OPTIONS"), + KT_ENTRY(KEYTAB3_START, KEY_PREVIOUS, "PREVIOUS"), + KT_ENTRY(KEYTAB3_START, KEY_REDO, "REDO"), + KT_ENTRY(KEYTAB3_START, KEY_REFERENCE, "REFERENCE"), + KT_ENTRY(KEYTAB3_START, KEY_REFRESH, "REFRESH"), + KT_ENTRY(KEYTAB3_START, KEY_REPLACE, "REPLACE"), + KT_ENTRY(KEYTAB3_START, KEY_RESTART, "RESTART"), + KT_ENTRY(KEYTAB3_START, KEY_RESUME, "RESUME"), + KT_ENTRY(KEYTAB3_START, KEY_SAVE, "SAVE"), + KT_ENTRY(KEYTAB3_START, KEY_SBEG, "SBEG"), + KT_ENTRY(KEYTAB3_START, KEY_SCANCEL, "SCANCEL"), + KT_ENTRY(KEYTAB3_START, KEY_SCOMMAND, "SCOMMAND"), + KT_ENTRY(KEYTAB3_START, KEY_SCOPY, "SCOPY"), + KT_ENTRY(KEYTAB3_START, KEY_SCREATE, "SCREATE"), + KT_ENTRY(KEYTAB3_START, KEY_SDC, "SDC"), + KT_ENTRY(KEYTAB3_START, KEY_SDL, "SDL"), + KT_ENTRY(KEYTAB3_START, KEY_SELECT, "SELECT"), + KT_ENTRY(KEYTAB3_START, KEY_SEND, "SEND"), + KT_ENTRY(KEYTAB3_START, KEY_SEOL, "SEOL"), + KT_ENTRY(KEYTAB3_START, KEY_SEXIT, "SEXIT"), + KT_ENTRY(KEYTAB3_START, KEY_SFIND, "SFIND"), + KT_ENTRY(KEYTAB3_START, KEY_SHELP, "SHELP"), + KT_ENTRY(KEYTAB3_START, KEY_SHOME, "SHOME"), + KT_ENTRY(KEYTAB3_START, KEY_SIC, "SIC"), + KT_ENTRY(KEYTAB3_START, KEY_SLEFT, "SLEFT"), + KT_ENTRY(KEYTAB3_START, KEY_SMESSAGE, "SMESSAGE"), + KT_ENTRY(KEYTAB3_START, KEY_SMOVE, "SMOVE"), + KT_ENTRY(KEYTAB3_START, KEY_SNEXT, "SNEXT"), + KT_ENTRY(KEYTAB3_START, KEY_SOPTIONS, "SOPTIONS"), + KT_ENTRY(KEYTAB3_START, KEY_SPREVIOUS, "SPREVIOUS"), + KT_ENTRY(KEYTAB3_START, KEY_SPRINT, "SPRINT"), + KT_ENTRY(KEYTAB3_START, KEY_SREDO, "SREDO"), + KT_ENTRY(KEYTAB3_START, KEY_SREPLACE, "SREPLACE"), + KT_ENTRY(KEYTAB3_START, KEY_SRIGHT, "SRIGHT"), + KT_ENTRY(KEYTAB3_START, KEY_SRSUME, "SRSUME"), + KT_ENTRY(KEYTAB3_START, KEY_SSAVE, "SSAVE"), + KT_ENTRY(KEYTAB3_START, KEY_SSUSPEND, "SSUSPEND"), + KT_ENTRY(KEYTAB3_START, KEY_SUNDO, "SUNDO"), + KT_ENTRY(KEYTAB3_START, KEY_SUSPEND, "SUSPEND"), + KT_ENTRY(KEYTAB3_START, KEY_UNDO, "UNDO"), + KT_ENTRY(KEYTAB3_START, KEY_MOUSE, "MOUSE"), +}; + +static char *make_key(const char* s, size_t l) { + memcpy(name, "KEY_", 4); + memcpy(name+4,s,l); + name[4+l]=0; + return name; +} + +/* + * keyname -- + * Return name of key or NULL; + */ +char * +keyname(int key) +{ + if (key < 0 || key == 0x100 /* No name. */) + return "-1"; + + /* Control codes */ + if (key < 0x20) { + name[0] = '^'; + name[1] = (char) (key + 64); /* Offset of '@' */ + name[2] = '\0'; + return name; + } + + /* "Normal" keys */ + if (key < 0x7F) { + name[0] = (char) key; + name[1] = '\0'; + return name; + } + + /* Delete key */ + if (key == 0x7F) return "^?"; + + /* Meta + control codes */ + if (key < 0x9F) { + memcpy(name, "M-^", 4); + name[3] = (char) (key - 64); /* Offset of '@' */ + name[4] = '\0'; + return name; + } + + /* Meta + "normal" keys */ + if (key < 0xFF) { + name[0] = 'M'; + name[1] = '-'; + name[2] = (char) (key - 128); + name[3] = '\0'; + return name; + } + + /* Meta + delete key */ + if (key == 0xFF) return "M-^?"; + + /* Key names. Synchronise this with curses.h. */ + if (key <= 0x106) + return make_key(keytab1[key-0x101], 5); + + if (key == 0x107) + return "KEY_BACKSPACE"; + + /* Function key block (64 keys). */ + if (key < 0x148) { + snprintf(name, sizeof name, "KEY_F(%d)", key - 0x108); + return name; + } + if(key < KEYTAB3_START) + return make_key(keytab2[key-0x148], 6); + + if(key <= 0x199) + return make_key(keytab3[key-KEYTAB3_START], 9); + + if(key == KEY_RESIZE) + return "KEY_RESIZE"; + + /* No more names. */ + return "UNKNOWN KEY"; +} +/* + * key_name -- + * Return name of key or NULL; + */ +char * +key_name(wchar_t key) +{ +#ifndef HAVE_WCHAR + return NULL; +#else + char *s = keyname((int) key); + if (s[0] == 'M' && s[1] == '-') { + /* Remove the "M-" */ + name[0] = s[2]; + name[1] = 0; + s = name; + } + return s; +#endif /* HAVE_WCHAR */ +} diff --git a/vendor/netbsd-curses/libcurses/keypad.3 b/vendor/netbsd-curses/libcurses/keypad.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/keypad.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/keypad.c b/vendor/netbsd-curses/libcurses/keypad.c new file mode 100644 index 0000000..72f09bb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/keypad.c @@ -0,0 +1,67 @@ +/* $NetBSD: keypad.c,v 1.14 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * keypad -- + * Turn on and off interpretation of function/keypad keys in the + * given window. + */ +int +keypad(WINDOW *win, bool bf) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "keypad: win %p, %s\n", win, bf ? "TRUE" : "FALSE"); +#endif + if (bf) { + win->flags |= __KEYPAD; + if (!(curscr->flags & __KEYPAD)) { + tputs(keypad_xmit, 0, __cputchar); + curscr->flags |= __KEYPAD; + } + } else + win->flags &= ~__KEYPAD; + + return OK; +} + +/* + * is_keypad -- + * Return true if window is set for keypad. + */ +bool +is_keypad(const WINDOW *win) +{ + + return win->flags & __KEYPAD ? true : false; +} diff --git a/vendor/netbsd-curses/libcurses/killchar.3 b/vendor/netbsd-curses/libcurses/killchar.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/killchar.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/leaveok.3 b/vendor/netbsd-curses/libcurses/leaveok.3 new file mode 120000 index 0000000..7a991d5 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/leaveok.3 @@ -0,0 +1 @@ +curses_refresh.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/leaveok.c b/vendor/netbsd-curses/libcurses/leaveok.c new file mode 100644 index 0000000..7dd66a2 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/leaveok.c @@ -0,0 +1,60 @@ +/* $NetBSD: leaveok.c,v 1.7 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * leaveok -- + * Turn on and off leave cursor after refresh for the given window. + */ +int +leaveok(WINDOW *win, bool bf) +{ + if (bf) + win->flags |= __LEAVEOK; + else + win->flags &= ~__LEAVEOK; + return OK; +} + +/* + * is_leaveok -- + * Return true if window is set for leaveok. + */ +bool +is_leaveok(const WINDOW *win) +{ + + return win->flags & __LEAVEOK ? true : false; +} diff --git a/vendor/netbsd-curses/libcurses/line.c b/vendor/netbsd-curses/libcurses/line.c new file mode 100644 index 0000000..5d7eac2 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/line.c @@ -0,0 +1,309 @@ +/* $NetBSD: line.c,v 1.16 2020/07/01 02:57:01 uwe Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#define _XOPEN_SOURCE 700 +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * hline -- + * Draw a horizontal line of character c on stdscr. + */ +int +hline(chtype ch, int count) +{ + + return whline(stdscr, ch, count); +} + +/* + * mvhline -- + * Move to location (y, x) and draw a horizontal line of character c + * on stdscr. + */ +int +mvhline(int y, int x, chtype ch, int count) +{ + + return mvwhline(stdscr, y, x, ch, count); +} + +/* + * mvwhline -- + * Move to location (y, x) and draw a horizontal line of character c + * in the given window. + */ +int +mvwhline(WINDOW *win, int y, int x, chtype ch, int count) +{ + + if (wmove(win, y, x) == ERR) + return ERR; + + return whline(win, ch, count); +} + +/* + * whline -- + * Draw a horizontal line of character c in the given window moving + * towards the rightmost column. At most count characters are drawn + * or until the edge of the screen, whichever comes first. + */ +int +whline(WINDOW *win, chtype ch, int count) +{ +#ifndef HAVE_WCHAR + int ocury, ocurx, n, i; + + n = min(count, win->maxx - win->curx); + ocury = win->cury; + ocurx = win->curx; + + if (!(ch & __CHARTEXT)) + ch |= ACS_HLINE; + for (i = 0; i < n; i++) + mvwaddch(win, ocury, ocurx + i, ch); + + wmove(win, ocury, ocurx); + return OK; +#else + cchar_t cch; + + __cursesi_chtype_to_cchar(ch, &cch); + return whline_set(win, &cch, count); +#endif +} + +/* + * vline -- + * Draw a vertical line of character ch on stdscr. + */ +int +vline(chtype ch, int count) +{ + + return wvline(stdscr, ch, count); +} + +/* + * mvvline -- + * Move to the given location an draw a vertical line of character ch. + */ +int +mvvline(int y, int x, chtype ch, int count) +{ + + return mvwvline(stdscr, y, x, ch, count); +} + +/* + * mvwvline -- + * Move to the given location and draw a vertical line of character ch + * on the given window. + */ +int +mvwvline(WINDOW *win, int y, int x, chtype ch, int count) +{ + + if (wmove(win, y, x) == ERR) + return ERR; + + return wvline(win, ch, count); +} + +/* + * wvline -- + * Draw a vertical line of character ch in the given window moving + * towards the bottom of the screen. At most count characters are drawn + * or until the edge of the screen, whichever comes first. + */ +int +wvline(WINDOW *win, chtype ch, int count) +{ +#ifndef HAVE_WCHAR + int ocury, ocurx, n, i; + + n = min(count, win->maxy - win->cury); + ocury = win->cury; + ocurx = win->curx; + + if (!(ch & __CHARTEXT)) + ch |= ACS_VLINE; + for (i = 0; i < n; i++) + mvwaddch(win, ocury + i, ocurx, ch); + + wmove(win, ocury, ocurx); + return OK; +#else + cchar_t cch; + + __cursesi_chtype_to_cchar(ch, &cch); + return wvline_set(win, &cch, count); +#endif +} + +int hline_set(const cchar_t *wch, int n) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + return whline_set( stdscr, wch, n ); +#endif /* HAVE_WCHAR */ +} + +int mvhline_set(int y, int x, const cchar_t *wch, int n) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + return mvwhline_set( stdscr, y, x, wch, n ); +#endif /* HAVE_WCHAR */ +} + +int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + if ( wmove( win, y , x ) == ERR ) + return ERR; + + return whline_set( win, wch, n ); +#endif /* HAVE_WCHAR */ +} + +int whline_set(WINDOW *win, const cchar_t *wch, int n) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + int ocury, ocurx, wcn, i, cw; + cchar_t cc; + + cc = *wch; + if (!cc.vals[0]) { + cc.vals[0] = WACS_HLINE->vals[0]; + cc.attributes |= WACS_HLINE->attributes; + } + + cw = wcwidth(cc.vals[0]); + if (cw <= 0) + cw = 1; + if ( ( win->maxx - win->curx ) < cw ) + return ERR; + wcn = min( n, ( win->maxx - win->curx ) / cw ); +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "whline_set: line of %d\n", wcn); +#endif /* DEBUG */ + ocury = win->cury; + ocurx = win->curx; + + for (i = 0; i < wcn; i++ ) { +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "whline_set: (%d,%d)\n", + ocury, ocurx + i * cw); +#endif /* DEBUG */ + mvwadd_wch(win, ocury, ocurx + i * cw, &cc); + } + + wmove(win, ocury, ocurx); + __sync(win); + return OK; +#endif /* HAVE_WCHAR */ +} + +int vline_set(const cchar_t *wch, int n) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + return wvline_set(stdscr, wch, n); +#endif /* HAVE_WCHAR */ +} + +int mvvline_set(int y, int x, const cchar_t *wch, int n) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + return mvwvline_set(stdscr, y, x, wch, n); +#endif /* HAVE_WCHAR */ +} + +int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + if (wmove(win, y, x) == ERR) + return ERR; + + return wvline_set(win, wch, n); +#endif /* HAVE_WCHAR */ +} + +int wvline_set(WINDOW *win, const cchar_t *wch, int n) +{ +#ifndef HAVE_WCHAR + return ERR; +#else + int ocury, ocurx, wcn, i; + cchar_t cc; + + wcn = min(n, win->maxy - win->cury); +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "wvline_set: line of %d\n", wcn); +#endif /* DEBUG */ + ocury = win->cury; + ocurx = win->curx; + + cc = *wch; + if (!cc.vals[0]) { + cc.vals[0] = WACS_VLINE->vals[0]; + cc.attributes |= WACS_VLINE->attributes; + } + for (i = 0; i < wcn; i++) { + mvwadd_wch(win, ocury + i, ocurx, &cc); +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "wvline_set: (%d,%d)\n", + ocury + i, ocurx); +#endif /* DEBUG */ + } + + wmove(win, ocury, ocurx); + __sync(win); + return OK; +#endif /* HAVE_WCHAR */ +} diff --git a/vendor/netbsd-curses/libcurses/meta.3 b/vendor/netbsd-curses/libcurses/meta.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/meta.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/meta.c b/vendor/netbsd-curses/libcurses/meta.c new file mode 100644 index 0000000..b49bd72 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/meta.c @@ -0,0 +1,78 @@ +/* $NetBSD: meta.c,v 1.9 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1998-2000 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * meta -- + * Turn on or off the terminal meta mode. + */ +int +meta(/*ARGSUSED*/ WINDOW *win, bool bf) +{ + + if (bf == TRUE) { + if (meta_on != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "meta: TRUE\n"); +#endif + tputs(meta_on, 0, __cputchar); + _cursesi_screen->meta_state = TRUE; + fflush(_cursesi_screen->outfd); + } + } else { + if (meta_off != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "meta: FALSE\n"); +#endif + tputs(meta_off, 0, __cputchar); + _cursesi_screen->meta_state = FALSE; + fflush(_cursesi_screen->outfd); + } + } + + return OK; +} + +/* + * __restore_meta_state -- + * Restore old meta state. + */ +void +__restore_meta_state(void) +{ + + meta(NULL, _cursesi_screen->meta_state); +} + diff --git a/vendor/netbsd-curses/libcurses/mouse.c b/vendor/netbsd-curses/libcurses/mouse.c new file mode 100644 index 0000000..3b3173f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mouse.c @@ -0,0 +1,126 @@ +/* $NetBSD: mouse.c,v 1.1 2020/03/23 13:37:36 roy Exp $ */ + +/*- + * Copyright (c) 2020 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef __unused +#define __unused +#endif + +#define DEFAULT_MAXCLICK 166 /* ncurses default */ + +/* + * Return true if screen relative y and x are enclosed by the window. + */ +bool +wenclose(const WINDOW *win, int y, int x) +{ + + if (y < win->begy || y > win->begy + win->maxy || + x < win->begx || x > win->begx + win->maxx) + return false; + return true; +} + +bool +mouse_trafo(int *y, int *x, bool to_screen) +{ + + return wmouse_trafo(stdscr, y, x, to_screen); +} + +/* + * Transform y and x from screen relative to window relative + */ +bool wmouse_trafo(const WINDOW *win, int *y, int *x, bool to_screen) +{ + int wy = *y, wx = *x; + + if (to_screen) { + wy += win->begy; + wx += win->begx; + } + + if (!wenclose(win, wy, wx)) + return false; + + if (!to_screen) { + wy -= win->begy; + wx -= win->begx; + } + + *y = wy; + *x = wx; + return true; +} + +/* + * The below functions actually need some kind of mouse support. + * We should look into wsmouse(4) support at least as well as xterm. + */ + +bool +has_mouse(void) +{ + + return false; +} + +int +getmouse(__unused MEVENT *event) +{ + + return ERR; +} + +int +ungetmouse(__unused MEVENT *event) +{ + + return ERR; +} + +mmask_t +mousemask(__unused mmask_t newmask, __unused mmask_t *oldmask) +{ + + return 0; +} + +int +mouseinterval(__unused int erval) +{ + + return DEFAULT_MAXCLICK; +} diff --git a/vendor/netbsd-curses/libcurses/move.3 b/vendor/netbsd-curses/libcurses/move.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/move.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/move.c b/vendor/netbsd-curses/libcurses/move.c new file mode 100644 index 0000000..98ed7d8 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/move.c @@ -0,0 +1,81 @@ +/* $NetBSD: move.c,v 1.21 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS +/* + * move -- + * Moves the cursor to the given point on stdscr. + */ +int +move(int y, int x) +{ + + return wmove(stdscr, y, x); +} + +#endif + +/* + * wmove -- + * Moves the cursor to the given point. + */ +int +wmove(WINDOW *win, int y, int x) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "wmove: (%d, %d)\n", y, x); +#endif + if (x < 0 || y < 0) + return ERR; + if (x >= win->maxx || y >= win->maxy) + return ERR; + + win->curx = x; + win->cury = y; + + return OK; +} + +void +wcursyncup(WINDOW *win) +{ + + while (win->orig) { + wmove(win->orig, win->cury + win->begy - win->orig->begy, + win->curx + win->begx - win->orig->begx); + win = win->orig; + } +} diff --git a/vendor/netbsd-curses/libcurses/mvaddch.3 b/vendor/netbsd-curses/libcurses/mvaddch.3 new file mode 120000 index 0000000..b047dd4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvaddch.3 @@ -0,0 +1 @@ +curses_addch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvaddchnstr.3 b/vendor/netbsd-curses/libcurses/mvaddchnstr.3 new file mode 120000 index 0000000..889b3b3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvaddchnstr.3 @@ -0,0 +1 @@ +curses_addchstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvaddchstr.3 b/vendor/netbsd-curses/libcurses/mvaddchstr.3 new file mode 120000 index 0000000..889b3b3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvaddchstr.3 @@ -0,0 +1 @@ +curses_addchstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvaddnstr.3 b/vendor/netbsd-curses/libcurses/mvaddnstr.3 new file mode 120000 index 0000000..ba1150b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvaddnstr.3 @@ -0,0 +1 @@ +curses_addstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvaddstr.3 b/vendor/netbsd-curses/libcurses/mvaddstr.3 new file mode 120000 index 0000000..ba1150b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvaddstr.3 @@ -0,0 +1 @@ +curses_addstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvchgat.3 b/vendor/netbsd-curses/libcurses/mvchgat.3 new file mode 120000 index 0000000..dc7fec3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvchgat.3 @@ -0,0 +1 @@ +curses_chgat.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvcur.3 b/vendor/netbsd-curses/libcurses/mvcur.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvcur.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvderwin.3 b/vendor/netbsd-curses/libcurses/mvderwin.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvderwin.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvgetch.3 b/vendor/netbsd-curses/libcurses/mvgetch.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvgetch.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvgetnstr.3 b/vendor/netbsd-curses/libcurses/mvgetnstr.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvgetnstr.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvgetstr.3 b/vendor/netbsd-curses/libcurses/mvgetstr.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvgetstr.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvhline.3 b/vendor/netbsd-curses/libcurses/mvhline.3 new file mode 120000 index 0000000..fa3776d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvhline.3 @@ -0,0 +1 @@ +curses_line.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvinchnstr.3 b/vendor/netbsd-curses/libcurses/mvinchnstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvinchnstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvinchstr.3 b/vendor/netbsd-curses/libcurses/mvinchstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvinchstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvinnstr.3 b/vendor/netbsd-curses/libcurses/mvinnstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvinnstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvinsch.3 b/vendor/netbsd-curses/libcurses/mvinsch.3 new file mode 120000 index 0000000..9d46b67 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvinsch.3 @@ -0,0 +1 @@ +curses_insch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvinstr.3 b/vendor/netbsd-curses/libcurses/mvinstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvinstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvprintw.3 b/vendor/netbsd-curses/libcurses/mvprintw.3 new file mode 120000 index 0000000..614d94b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvprintw.3 @@ -0,0 +1 @@ +curses_print.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvvline.3 b/vendor/netbsd-curses/libcurses/mvvline.3 new file mode 120000 index 0000000..fa3776d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvvline.3 @@ -0,0 +1 @@ +curses_line.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwaddch.3 b/vendor/netbsd-curses/libcurses/mvwaddch.3 new file mode 120000 index 0000000..b047dd4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwaddch.3 @@ -0,0 +1 @@ +curses_addch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwaddchnstr.3 b/vendor/netbsd-curses/libcurses/mvwaddchnstr.3 new file mode 120000 index 0000000..889b3b3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwaddchnstr.3 @@ -0,0 +1 @@ +curses_addchstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwaddchstr.3 b/vendor/netbsd-curses/libcurses/mvwaddchstr.3 new file mode 120000 index 0000000..889b3b3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwaddchstr.3 @@ -0,0 +1 @@ +curses_addchstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwaddnstr.3 b/vendor/netbsd-curses/libcurses/mvwaddnstr.3 new file mode 120000 index 0000000..ba1150b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwaddnstr.3 @@ -0,0 +1 @@ +curses_addstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwaddstr.3 b/vendor/netbsd-curses/libcurses/mvwaddstr.3 new file mode 120000 index 0000000..ba1150b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwaddstr.3 @@ -0,0 +1 @@ +curses_addstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwchgat.3 b/vendor/netbsd-curses/libcurses/mvwchgat.3 new file mode 120000 index 0000000..dc7fec3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwchgat.3 @@ -0,0 +1 @@ +curses_chgat.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwgetch.3 b/vendor/netbsd-curses/libcurses/mvwgetch.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwgetch.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwgetnstr.3 b/vendor/netbsd-curses/libcurses/mvwgetnstr.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwgetnstr.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwgetstr.3 b/vendor/netbsd-curses/libcurses/mvwgetstr.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwgetstr.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwhline.3 b/vendor/netbsd-curses/libcurses/mvwhline.3 new file mode 120000 index 0000000..fa3776d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwhline.3 @@ -0,0 +1 @@ +curses_line.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwin.3 b/vendor/netbsd-curses/libcurses/mvwin.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwin.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwin.c b/vendor/netbsd-curses/libcurses/mvwin.c new file mode 100644 index 0000000..208941b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwin.c @@ -0,0 +1,124 @@ +/* $NetBSD: mvwin.c,v 1.21 2017/01/11 20:43:03 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * mvderwin -- + * Move a derived window. This does not change the physical screen + * coordinates of the subwin, rather maps the characters in the subwin + * sized part of the parent window starting at dy, dx into the subwin. + * + */ +int +mvderwin(WINDOW *win, int dy, int dx) +{ + WINDOW *parent; + int x, i; + __LINE *plp; + + if (win == NULL) + return ERR; + + parent = win->orig; + + if (parent == NULL) + return ERR; + + if (((win->maxx + dx) > parent->maxx) || + ((win->maxy + dy) > parent->maxy)) + return ERR; + + win->flags |= __ISDERWIN; + win->derx = dx; + win->dery = dy; + + x = parent->begx + dx; + + /* + * Mark the source area for the derwin as changed so it will be + * copied to the destination window on refresh. + */ + for (i = 0; i < win->maxy; i++) { + plp = parent->alines[i + dy]; + plp->flags = __ISDIRTY; + if (*plp->firstchp > x) + *plp->firstchp = x; + if (*plp->lastchp < x + win->maxx) + *plp->lastchp = x + win->maxx; +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "mvderwin: firstchp = %d, lastchp = %d\n", *plp->firstchp, *plp->lastchp); +#endif + } + + return OK; +} + +/* + * mvwin -- + * Relocate the starting position of a window. + */ +int +mvwin(WINDOW *win, int by, int bx) +{ + WINDOW *orig; + int dy, dx; + + if (by < 0 || by + win->maxy > win->screen->LINES || + bx < 0 || bx + win->maxx > win->screen->COLS) + return ERR; + dy = by - win->begy; + dx = bx - win->begx; + orig = win->orig; + if (orig == NULL) { + orig = win; + do { + win->begy += dy; + win->begx += dx; + __swflags(win); + win = win->nextp; + } while (win != orig); + } else { + if (by < orig->begy || win->maxy + dy > orig->maxy) + return ERR; + if (bx < orig->begx || win->maxx + dx > orig->maxx) + return ERR; + win->begy = by; + win->begx = bx; + __swflags(win); + __set_subwin(orig, win); + } + __touchwin(win); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/mvwinchnstr.3 b/vendor/netbsd-curses/libcurses/mvwinchnstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwinchnstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwinchstr.3 b/vendor/netbsd-curses/libcurses/mvwinchstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwinchstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwinnstr.3 b/vendor/netbsd-curses/libcurses/mvwinnstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwinnstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwinsch.3 b/vendor/netbsd-curses/libcurses/mvwinsch.3 new file mode 120000 index 0000000..9d46b67 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwinsch.3 @@ -0,0 +1 @@ +curses_insch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwinstr.3 b/vendor/netbsd-curses/libcurses/mvwinstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwinstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwprintw.3 b/vendor/netbsd-curses/libcurses/mvwprintw.3 new file mode 120000 index 0000000..614d94b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwprintw.3 @@ -0,0 +1 @@ +curses_print.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/mvwvline.3 b/vendor/netbsd-curses/libcurses/mvwvline.3 new file mode 120000 index 0000000..fa3776d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/mvwvline.3 @@ -0,0 +1 @@ +curses_line.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/napms.3 b/vendor/netbsd-curses/libcurses/napms.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/napms.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/newpad.3 b/vendor/netbsd-curses/libcurses/newpad.3 new file mode 120000 index 0000000..3904c3b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/newpad.3 @@ -0,0 +1 @@ +curses_pad.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/newterm.3 b/vendor/netbsd-curses/libcurses/newterm.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/newterm.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/newwin.3 b/vendor/netbsd-curses/libcurses/newwin.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/newwin.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/newwin.c b/vendor/netbsd-curses/libcurses/newwin.c new file mode 100644 index 0000000..853471b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/newwin.c @@ -0,0 +1,444 @@ +/* $NetBSD: newwin.c,v 1.58 2020/07/14 04:39:39 uwe Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + + +static WINDOW *__makenew(SCREEN *screen, int nlines, int ncols, int by, + int bx, int sub, int ispad); +static WINDOW *__subwin(WINDOW *orig, int nlines, int ncols, int by, int bx, + int ispad); + +/* + * derwin -- + * Create a new window in the same manner as subwin but (by, bx) + * are relative to the origin of window orig instead of absolute. + */ +WINDOW * +derwin(WINDOW *orig, int nlines, int ncols, int by, int bx) +{ + + return __subwin(orig, nlines, ncols, orig->begy + by, orig->begx + bx, + FALSE); +} + +/* + * subpad -- + * Create a new pad in the same manner as subwin but (by, bx) + * are relative to the origin of window orig instead of absolute. + */ +WINDOW * +subpad(WINDOW *orig, int nlines, int ncols, int by, int bx) +{ + + return __subwin(orig, nlines, ncols, orig->begy + by, orig->begx + bx, + TRUE); +} + +/* + * dupwin -- + * Create a copy of the given window. + */ +WINDOW * +dupwin(WINDOW *win) +{ + WINDOW *new_one; + + if ((new_one = __newwin(_cursesi_screen, win->maxy, win->maxx, + win->begy, win->begx, FALSE, + win == stdscr ? TRUE : FALSE)) == NULL) + return NULL; + + overwrite(win, new_one); + return new_one; +} + +/* + * newwin -- + * Allocate space for and set up defaults for a new window. + */ +WINDOW * +newwin(int nlines, int ncols, int by, int bx) +{ + + return __newwin(_cursesi_screen, nlines, ncols, by, bx, FALSE, FALSE); +} + +/* + * newpad -- + * Allocate space for and set up defaults for a new pad. + */ +WINDOW * +newpad(int nlines, int ncols) +{ + + if (nlines < 1 || ncols < 1) + return NULL; + return __newwin(_cursesi_screen, nlines, ncols, 0, 0, TRUE, FALSE); +} + +WINDOW * +__newwin(SCREEN *screen, int nlines, int ncols, int by, int bx, int ispad, + int isstdscr) +{ + WINDOW *win; + __LINE *lp; + int i, j; + int ry, maxy, maxx; + __LDATA *sp; + + if (by < 0 || bx < 0) + return NULL; + + if (isstdscr) { + ry = __rippedlines(screen, -1); + by += __rippedlines(screen, 1); + } else + ry = 0; + + maxy = nlines > 0 ? nlines : LINES - by - ry + nlines; + maxx = ncols > 0 ? ncols : COLS - bx + ncols; + + if ((win = __makenew(screen, maxy, maxx, by, bx, 0, ispad)) == NULL) + return NULL; + + win->bch = ' '; + if (__using_color) + win->battr = __default_color; + else + win->battr = 0; + win->nextp = win; + win->ch_off = 0; + win->orig = NULL; + win->reqy = nlines; + win->reqx = ncols; + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "newwin: win->ch_off = %d\n", win->ch_off); +#endif + + for (i = 0; i < maxy; i++) { + lp = win->alines[i]; + if (ispad) + lp->flags = __ISDIRTY; + else + lp->flags = 0; + for (sp = lp->line, j = 0; j < maxx; j++, sp++) { + sp->attr = 0; +#ifndef HAVE_WCHAR + sp->ch = win->bch; +#else + sp->ch = (wchar_t)btowc((int) win->bch); + sp->nsp = NULL; + SET_WCOL(*sp, 1); +#endif /* HAVE_WCHAR */ + } + lp->hash = __hash((char *)(void *)lp->line, + (size_t)(maxx * __LDATASIZE)); + } + return (win); +} + +WINDOW * +subwin(WINDOW *orig, int nlines, int ncols, int by, int bx) +{ + + return __subwin(orig, nlines, ncols, by, bx, FALSE); +} + +static WINDOW * +__subwin(WINDOW *orig, int nlines, int ncols, int by, int bx, int ispad) +{ + int i; + __LINE *lp; + WINDOW *win; + int maxy, maxx; + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "subwin: (%p, %d, %d, %d, %d, %d)\n", + orig, nlines, ncols, by, bx, ispad); +#endif + if (orig == NULL) + return NULL; + + /* Make sure window fits inside the original one. */ + maxy = nlines > 0 ? nlines : orig->maxy + orig->begy - by + nlines; + maxx = ncols > 0 ? ncols : orig->maxx + orig->begx - bx + ncols; + if (by < orig->begy || bx < orig->begx + || by + maxy > orig->maxy + orig->begy + || bx + maxx > orig->maxx + orig->begx) + return NULL; + if ((win = __makenew(_cursesi_screen, maxy, maxx, + by, bx, 1, ispad)) == NULL) + return NULL; + win->bch = orig->bch; + win->battr = orig->battr; + win->reqy = nlines; + win->reqx = ncols; + win->nextp = orig->nextp; + orig->nextp = win; + win->orig = orig; + + /* Initialize flags here so that refresh can also use __set_subwin. */ + for (lp = win->lspace, i = 0; i < win->maxy; i++, lp++) + lp->flags = 0; + __set_subwin(orig, win); + return win; +} +/* + * This code is shared with mvwin(). + */ +void +__set_subwin(WINDOW *orig, WINDOW *win) +{ + int i; + __LINE *lp, *olp; +#ifdef HAVE_WCHAR + __LDATA *cp; + int j; + nschar_t *np; +#endif /* HAVE_WCHAR */ + + win->ch_off = win->begx - orig->begx; + /* Point line pointers to line space. */ + for (lp = win->lspace, i = 0; i < win->maxy; i++, lp++) { + win->alines[i] = lp; + olp = orig->alines[i + win->begy - orig->begy]; +#ifdef DEBUG + lp->sentinel = SENTINEL_VALUE; +#endif + lp->line = &olp->line[win->ch_off]; + lp->firstchp = &olp->firstch; + lp->lastchp = &olp->lastch; +#ifndef HAVE_WCHAR + lp->hash = __hash((char *)(void *)lp->line, + (size_t)(win->maxx * __LDATASIZE)); +#else + for (cp = lp->line, j = 0; j < win->maxx; j++, cp++) { + lp->hash = __hash_more( &cp->ch, + sizeof( wchar_t ), lp->hash ); + lp->hash = __hash_more( &cp->attr, + sizeof( wchar_t ), lp->hash ); + if ( cp->nsp ) { + np = cp->nsp; + while ( np ) { + lp->hash = __hash_more( &np->ch, + sizeof( wchar_t ), lp->hash ); + np = np->next; + } + } + } +#endif /* HAVE_WCHAR */ + } + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "__set_subwin: win->ch_off = %d\n", + win->ch_off); +#endif +} +/* + * __makenew -- + * Set up a window buffer and returns a pointer to it. + */ +static WINDOW * +__makenew(SCREEN *screen, int nlines, int ncols, int by, int bx, int sub, + int ispad) +{ + WINDOW *win; + __LINE *lp; + struct __winlist *wlp, *wlp2; + int i; + + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "makenew: (%d, %d, %d, %d)\n", + nlines, ncols, by, bx); +#endif + if (nlines <= 0 || ncols <= 0) + return NULL; + + if ((win = malloc(sizeof(WINDOW))) == NULL) + return NULL; +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "makenew: win = %p\n", win); +#endif + win->fp = NULL; + win->buf = NULL; + win->buflen = 0; + + /* Set up line pointer array and line space. */ + if ((win->alines = malloc(nlines * sizeof(__LINE *))) == NULL) { + free(win); + return NULL; + } + if ((win->lspace = malloc(nlines * sizeof(__LINE))) == NULL) { + free(win->alines); + free(win); + return NULL; + } + /* Don't allocate window and line space if it's a subwindow */ + if (sub) + win->wspace = NULL; + else { + /* + * Allocate window space in one chunk. + */ + if ((win->wspace = + malloc(ncols * nlines * sizeof(__LDATA))) == NULL) { + free(win->lspace); + free(win->alines); + free(win); + return NULL; + } + /* + * Append window to window list. + */ + if ((wlp = malloc(sizeof(struct __winlist))) == NULL) { + free(win->wspace); + free(win->lspace); + free(win->alines); + free(win); + return NULL; + } + wlp->winp = win; + wlp->nextp = NULL; + if (screen->winlistp == NULL) + screen->winlistp = wlp; + else { + wlp2 = screen->winlistp; + while (wlp2->nextp != NULL) + wlp2 = wlp2->nextp; + wlp2->nextp = wlp; + } + /* + * Point line pointers to line space, and lines themselves into + * window space. + */ + for (lp = win->lspace, i = 0; i < nlines; i++, lp++) { + win->alines[i] = lp; + lp->line = &win->wspace[i * ncols]; +#ifdef DEBUG + lp->sentinel = SENTINEL_VALUE; +#endif + lp->firstchp = &lp->firstch; + lp->lastchp = &lp->lastch; + if (ispad) { + lp->firstch = 0; + lp->lastch = ncols; + } else { + lp->firstch = ncols; + lp->lastch = 0; + } + } + } +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "makenew: ncols = %d\n", ncols); +#endif + win->screen = screen; + win->cury = win->curx = 0; + win->maxy = nlines; + win->maxx = ncols; + win->reqy = nlines; + win->reqx = ncols; + + win->begy = by; + win->begx = bx; + win->flags = (__IDLINE | __IDCHAR); + win->delay = -1; + win->wattr = 0; +#ifdef HAVE_WCHAR + win->bnsp = NULL; + SET_BGWCOL(*win, 1); +#endif /* HAVE_WCHAR */ + win->scr_t = 0; + win->scr_b = win->maxy - 1; + if (ispad) { + win->flags |= __ISPAD; + win->pbegy = 0; + win->pbegx = 0; + win->sbegy = 0; + win->sbegx = 0; + win->smaxy = 0; + win->smaxx = 0; + } else + __swflags(win); +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "makenew: win->wattr = %08x\n", win->wattr); + __CTRACE(__CTRACE_WINDOW, "makenew: win->flags = %#.4x\n", win->flags); + __CTRACE(__CTRACE_WINDOW, "makenew: win->maxy = %d\n", win->maxy); + __CTRACE(__CTRACE_WINDOW, "makenew: win->maxx = %d\n", win->maxx); + __CTRACE(__CTRACE_WINDOW, "makenew: win->begy = %d\n", win->begy); + __CTRACE(__CTRACE_WINDOW, "makenew: win->begx = %d\n", win->begx); + __CTRACE(__CTRACE_WINDOW, "makenew: win->scr_t = %d\n", win->scr_t); + __CTRACE(__CTRACE_WINDOW, "makenew: win->scr_b = %d\n", win->scr_b); +#endif + return win; +} + +void +__swflags(WINDOW *win) +{ + TERMINAL *term = win->screen->term; + + win->flags &= ~(__ENDLINE | __FULLWIN | __SCROLLWIN | __LEAVEOK); + if (win->begx + win->maxx == win->screen->COLS && + !(win->flags & __ISPAD)) + { + win->flags |= __ENDLINE; + if (win->begx == 0 && + win->maxy == win->screen->LINES && + win->begy == 0) + win->flags |= __FULLWIN; + if (win->begy + win->maxy == win->screen->LINES && + t_auto_right_margin(term) && + !(t_insert_character(term) != NULL || + t_parm_ich(term) != NULL || + (t_enter_insert_mode(term) != NULL && + t_exit_insert_mode(term) != NULL))) + win->flags |= __SCROLLWIN; + } +} + +/* + * is_pad -- + * Return true if window was created by newpad. + */ +bool +is_pad(const WINDOW *win) +{ + + return win->flags & __ISPAD ? true : false; +} diff --git a/vendor/netbsd-curses/libcurses/nl.3 b/vendor/netbsd-curses/libcurses/nl.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/nl.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/nocbreak.3 b/vendor/netbsd-curses/libcurses/nocbreak.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/nocbreak.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/nodelay.3 b/vendor/netbsd-curses/libcurses/nodelay.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/nodelay.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/nodelay.c b/vendor/netbsd-curses/libcurses/nodelay.c new file mode 100644 index 0000000..cd0ec7f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/nodelay.c @@ -0,0 +1,48 @@ +/* $NetBSD: nodelay.c,v 1.7 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * nodelay -- + * Turn on and off blocking reads in getch for a + * given window. + */ +int +nodelay(WINDOW *win, bool bf) +{ + + if (bf) + win->delay = 0; + else + win->delay = -1; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/noecho.3 b/vendor/netbsd-curses/libcurses/noecho.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/noecho.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/nonl.3 b/vendor/netbsd-curses/libcurses/nonl.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/nonl.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/noqiflush.3 b/vendor/netbsd-curses/libcurses/noqiflush.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/noqiflush.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/noraw.3 b/vendor/netbsd-curses/libcurses/noraw.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/noraw.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/notimeout.3 b/vendor/netbsd-curses/libcurses/notimeout.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/notimeout.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/notimeout.c b/vendor/netbsd-curses/libcurses/notimeout.c new file mode 100644 index 0000000..9a31f81 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/notimeout.c @@ -0,0 +1,49 @@ +/* $NetBSD: notimeout.c,v 1.7 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1998-2014 Brett Lymn (blymn@netbsd.org) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * notimeout -- + * Turn on and off inter-key timeout when assembling function keys for a + * given window. + */ +int +notimeout(WINDOW *win, bool bf) +{ + + if (bf) + win->flags |= __NOTIMEOUT; + else + win->flags &= ~__NOTIMEOUT; + + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/overlay.3 b/vendor/netbsd-curses/libcurses/overlay.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/overlay.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/overlay.c b/vendor/netbsd-curses/libcurses/overlay.c new file mode 100644 index 0000000..4062bcc --- /dev/null +++ b/vendor/netbsd-curses/libcurses/overlay.c @@ -0,0 +1,53 @@ +/* $NetBSD: overlay.c,v 1.17 2007/01/21 13:25:36 jdc Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * overlay -- + * Writes win1 on win2 non-destructively. + */ +int +overlay(const WINDOW *win1, WINDOW *win2) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "overlay: (%p, %p);\n", win1, win2); +#endif + return copywin(win1, win2, + win2->begy - win1->begy, win2->begx - win1->begx, + 0, 0, win2->maxy - 1, win2->maxx - 1, TRUE); +} diff --git a/vendor/netbsd-curses/libcurses/overwrite.3 b/vendor/netbsd-curses/libcurses/overwrite.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/overwrite.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/overwrite.c b/vendor/netbsd-curses/libcurses/overwrite.c new file mode 100644 index 0000000..7f4049a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/overwrite.c @@ -0,0 +1,53 @@ +/* $NetBSD: overwrite.c,v 1.18 2007/01/21 13:25:36 jdc Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * overwrite -- + * Writes win1 on win2 destructively. + */ +int +overwrite(const WINDOW *win1, WINDOW *win2) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "overwrite: (%p, %p);\n", win1, win2); +#endif + return copywin(win1, win2, + win2->begy - win1->begy, win2->begx - win1->begx, + 0, 0, win2->maxy - 1, win2->maxx - 1, FALSE); +} diff --git a/vendor/netbsd-curses/libcurses/pair_content.3 b/vendor/netbsd-curses/libcurses/pair_content.3 new file mode 120000 index 0000000..1f101c9 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/pair_content.3 @@ -0,0 +1 @@ +curses_color.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/pause.c b/vendor/netbsd-curses/libcurses/pause.c new file mode 100644 index 0000000..804fa37 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/pause.c @@ -0,0 +1,81 @@ +/* $NetBSD: pause.c,v 1.10 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define _GNU_SOURCE +#include + +#include +#include +#include +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * napms -- + * Sleep for ms milliseconds. + */ +int +napms(int ms) +{ + struct timespec ts; + +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "napms: %d\n", ms); +#endif + ts.tv_sec = ms / 1000; + ts.tv_nsec = (ms % 1000) * 1000000; + (void)nanosleep(&ts, NULL); + return OK; +} + +/* + * delay_output -- + * Pause output using terminal pad character. + */ +int +delay_output(int ms) +{ + char *delstr; + +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "delay_output: %d\n", ms); +#endif + if (!_cursesi_screen->padchar) + return napms(ms); + + if (asprintf(&delstr, "%d", ms) == -1) + return ERR; + tputs(delstr, 0, __cputchar); + free(delstr); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/pechochar.3 b/vendor/netbsd-curses/libcurses/pechochar.3 new file mode 120000 index 0000000..2572961 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/pechochar.3 @@ -0,0 +1 @@ +curses_echochar.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/pnoutrefresh.3 b/vendor/netbsd-curses/libcurses/pnoutrefresh.3 new file mode 120000 index 0000000..3904c3b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/pnoutrefresh.3 @@ -0,0 +1 @@ +curses_pad.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/prefresh.3 b/vendor/netbsd-curses/libcurses/prefresh.3 new file mode 120000 index 0000000..3904c3b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/prefresh.3 @@ -0,0 +1 @@ +curses_pad.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/printw.3 b/vendor/netbsd-curses/libcurses/printw.3 new file mode 120000 index 0000000..614d94b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/printw.3 @@ -0,0 +1 @@ +curses_print.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/printw.c b/vendor/netbsd-curses/libcurses/printw.c new file mode 100644 index 0000000..d121c20 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/printw.c @@ -0,0 +1,134 @@ +/* $NetBSD: printw.c,v 1.29 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * printw and friends. + */ + +/* + * printw -- + * Printf on the standard screen. + */ +int +printw(const char *fmt,...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vw_printw(stdscr, fmt, ap); + va_end(ap); + return ret; +} +/* + * wprintw -- + * Printf on the given window. + */ +int +wprintw(WINDOW *win, const char *fmt,...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vw_printw(win, fmt, ap); + va_end(ap); + return ret; +} +/* + * mvprintw, mvwprintw -- + * Implement the mvprintw commands. Due to the variable number of + * arguments, they cannot be macros. Sigh.... + */ +int +mvprintw(int y, int x, const char *fmt,...) +{ + va_list ap; + int ret; + + if (move(y, x) != OK) + return ERR; + va_start(ap, fmt); + ret = vw_printw(stdscr, fmt, ap); + va_end(ap); + return ret; +} + +int +mvwprintw(WINDOW * win, int y, int x, const char *fmt,...) +{ + va_list ap; + int ret; + + if (wmove(win, y, x) != OK) + return ERR; + + va_start(ap, fmt); + ret = vw_printw(win, fmt, ap); + va_end(ap); + return ret; +} + +/* + * vw_printw -- + * This routine actually executes the printf and adds it to the window. + */ +int +vw_printw(WINDOW *win, const char *fmt, va_list ap) +{ + int n; + + if (win->fp == NULL) { + win->fp = open_memstream(&win->buf, &win->buflen); + if (__predict_false(win->fp == NULL)) + return ERR; + } else + rewind(win->fp); + + n = vfprintf(win->fp, fmt, ap); + if (__predict_false(n == 0)) + return OK; + if (__predict_false(n == -1)) + return ERR; + if (__predict_false(fflush(win->fp) != 0)) + return ERR; + return waddnstr(win, win->buf, n); +} + +__strong_alias(vwprintw, vw_printw) + diff --git a/vendor/netbsd-curses/libcurses/putchar.c b/vendor/netbsd-curses/libcurses/putchar.c new file mode 100644 index 0000000..941ee0e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/putchar.c @@ -0,0 +1,96 @@ +/* $NetBSD: putchar.c,v 1.23 2019/05/20 22:17:41 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +int +__cputchar(int ch) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_OUTPUT, "__cputchar: %s\n", unctrl(ch)); +#endif + return __cputchar_args(ch, _cursesi_screen->outfd); +} + +/* + * This is the same as __cputchar but the extra argument holds the file + * descriptor to write the output to. This function can only be used with + * the "new" libterm interface. + */ +int +__cputchar_args(int ch, void *args) +{ + FILE *outfd = (FILE *)args; + int status; + +#ifdef DEBUG + __CTRACE(__CTRACE_OUTPUT, "__cputchar_args: %s on fd %d\n", + unctrl(ch), outfd->_file); +#endif + status = putc(ch, outfd); + fflush(outfd); + return status; +} + +#ifdef HAVE_WCHAR +int +__cputwchar(wchar_t wch) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_OUTPUT, "__cputwchar: 0x%x\n", wch); +#endif + return __cputwchar_args(wch, _cursesi_screen->outfd); +} + +/* + * This is the same as __cputchar but the extra argument holds the file + * descriptor to write the output to. This function can only be used with + * the "new" libterm interface. + */ +int +__cputwchar_args(wchar_t wch, void *args) +{ + FILE *outfd = (FILE *)args; + int status; + +#ifdef DEBUG + __CTRACE(__CTRACE_OUTPUT, "__cputwchar_args: 0x%x on fd %d\n", + wch, outfd->_file); +#endif + status = putwc(wch, outfd); + fflush(outfd); + return status; +} +#endif /* HAVE_WCHAR */ diff --git a/vendor/netbsd-curses/libcurses/putwin.3 b/vendor/netbsd-curses/libcurses/putwin.3 new file mode 120000 index 0000000..8a51090 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/putwin.3 @@ -0,0 +1 @@ +curses_fileio.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/qiflush.3 b/vendor/netbsd-curses/libcurses/qiflush.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/qiflush.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/raw.3 b/vendor/netbsd-curses/libcurses/raw.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/raw.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/refresh.3 b/vendor/netbsd-curses/libcurses/refresh.3 new file mode 120000 index 0000000..7a991d5 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/refresh.3 @@ -0,0 +1 @@ +curses_refresh.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/refresh.c b/vendor/netbsd-curses/libcurses/refresh.c new file mode 100644 index 0000000..20e9522 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/refresh.c @@ -0,0 +1,2071 @@ +/* $NetBSD: refresh.c,v 1.113 2021/05/08 04:29:07 mrg Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 700 +#include + +#include +#include +#include +#include + +#include "curses.h" +#include "curses_private.h" + +static void domvcur(WINDOW *, int, int, int, int); +static void putattr(__LDATA *); +static void putattr_out(__LDATA *); +static int putch(__LDATA *, __LDATA *, int, int); +static int putchbr(__LDATA *, __LDATA *, __LDATA *, int, int); +static int makech(int); +static void quickch(void); +static void scrolln(int, int, int, int, int); + +static int _wnoutrefresh(WINDOW *, int, int, int, int, int, int); + +#ifdef HAVE_WCHAR +static int celleq(__LDATA *, __LDATA *); +static int lineeq(__LDATA *, __LDATA *, size_t); +#else /* !HAVE_WCHAR */ +static inline int +celleq(__LDATA *x, __LDATA *y) +{ + return memcmp(x, y, sizeof(__LDATA)) == 0; +} + +static int +lineeq(__LDATA *xl, __LDATA *yl, size_t len) +{ + return memcmp(xl, yl, len * __LDATASIZE) == 0; +} +#endif /* HAVE_WCHAR */ + +#define CHECK_INTERVAL 5 /* Change N lines before checking typeahead */ + +#ifndef _CURSES_USE_MACROS + +/* + * refresh -- + * Make the current screen look like "stdscr" over the area covered by + * stdscr. + */ +int +refresh(void) +{ + + return wrefresh(stdscr); +} + +#endif + +/* + * wnoutrefresh -- + * Add the contents of "win" to the virtual window. + */ +int +wnoutrefresh(WINDOW *win) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "wnoutrefresh: win %p, begy %d, begx %d, maxy %d, maxx %d\n", win, win->begy, win->begx, win->maxy, win->maxx); +#endif + + return _wnoutrefresh(win, 0, 0, win->begy, win->begx, + win->maxy, win->maxx); +} + +/* + * pnoutrefresh -- + * Add the contents of "pad" to the virtual window. + */ +int +pnoutrefresh(WINDOW *pad, int pbegy, int pbegx, int sbegy, int sbegx, + int smaxy, int smaxx) +{ + int pmaxy, pmaxx; + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "pnoutrefresh: pad %p, flags 0x%08x\n", + pad, pad->flags); + __CTRACE(__CTRACE_REFRESH, + "pnoutrefresh: (%d, %d), (%d, %d), (%d, %d)\n", + pbegy, pbegx, sbegy, sbegx, smaxy, smaxx); +#endif + + /* SUS says if these are negative, they should be treated as zero */ + if (pbegy < 0) + pbegy = 0; + if (pbegx < 0) + pbegx = 0; + if (sbegy < 0) + sbegy = 0; + if (sbegx < 0) + sbegx = 0; + + /* Calculate rectangle on pad - used by _wnoutrefresh */ + pmaxy = pbegy + smaxy - sbegy + 1; + pmaxx = pbegx + smaxx - sbegx + 1; + + /* Check rectangle fits in pad */ + if (pmaxy > pad->maxy - pad->begy) + pmaxy = pad->maxy - pad->begy; + if (pmaxx > pad->maxx - pad->begx) + pmaxx = pad->maxx - pad->begx; + + if (smaxy - sbegy < 0 || smaxx - sbegx < 0 ) + return ERR; + + return _wnoutrefresh(pad, + pad->begy + pbegy, pad->begx + pbegx, pad->begy + sbegy, + pad->begx + sbegx, pmaxy, pmaxx); +} + +/* + * _wnoutrefresh -- + * Does the grunt work for wnoutrefresh to the given screen. + * Copies the part of the window given by the rectangle + * (begy, begx) to (maxy, maxx) at screen position (wbegy, wbegx). + */ +static int +_wnoutrefresh(WINDOW *win, int begy, int begx, int wbegy, int wbegx, + int maxy, int maxx) +{ + SCREEN *screen = win->screen; + short sy, wy, wx, y_off, x_off, mx, dy_off, dx_off, endy; + int newy, newx; + __LINE *wlp, *vlp, *dwlp; + WINDOW *sub_win, *orig, *swin, *dwin; + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "_wnoutrefresh: win %p, flags 0x%08x\n", + win, win->flags); + __CTRACE(__CTRACE_REFRESH, + "_wnoutrefresh: (%d, %d), (%d, %d), (%d, %d)\n", + begy, begx, wbegy, wbegx, maxy, maxx); +#endif + + if (screen->curwin) + return OK; + + swin = dwin = win; + if (win->flags & __ISDERWIN) + swin = win->orig; + + /* + * Recurse through any sub-windows, mark as dirty lines on the parent + * window that are dirty on the sub-window and clear the dirty flag on + * the sub-window. + */ + if (dwin->orig == 0) { + orig = dwin; + for (sub_win = dwin->nextp; sub_win != orig; + sub_win = sub_win->nextp) { + if (sub_win->flags & __ISDERWIN) + continue; +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "wnout_refresh: win %p, sub_win %p\n", + orig, sub_win); +#endif + for (sy = 0; sy < sub_win->maxy; sy++) { + if (sub_win->alines[sy]->flags & __ISDIRTY) { + orig->alines[sy + sub_win->begy - orig->begy]->flags + |= __ISDIRTY; + sub_win->alines[sy]->flags + &= ~__ISDIRTY; + } + if (sub_win->alines[sy]->flags & __ISFORCED) { + orig->alines[sy + sub_win->begy - orig->begy]->flags + |= __ISFORCED; + sub_win->alines[sy]->flags + &= ~__ISFORCED; + } + } + } + } + + /* Check that cursor position on "win" is valid for "__virtscr" */ + newy = wbegy + dwin->cury - begy; + newx = wbegx + dwin->curx - begx; + if (begy <= dwin->cury && dwin->cury < maxy + && 0 <= newy && newy < screen->__virtscr->maxy) + screen->__virtscr->cury = newy; + if (begx <= dwin->curx && dwin->curx < maxx + && 0 <= newx && newx < screen->__virtscr->maxx) + screen->__virtscr->curx = newx; + + /* Copy the window flags from "win" to "__virtscr" */ + if (dwin->flags & __CLEAROK) { + if (dwin->flags & __FULLWIN) + screen->__virtscr->flags |= __CLEAROK; + dwin->flags &= ~__CLEAROK; + } + screen->__virtscr->flags &= ~__LEAVEOK; + screen->__virtscr->flags |= dwin->flags; + + if ((dwin->flags & __ISDERWIN) != 0) + endy = begy + maxy; + else + endy = maxy; + + for (wy = begy, y_off = wbegy, dy_off = 0; wy < endy && + y_off < screen->__virtscr->maxy; wy++, y_off++, dy_off++) + { + wlp = swin->alines[wy]; + dwlp = dwin->alines[dy_off]; +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "_wnoutrefresh: wy %d\tf %d\tl %d\tflags %x\n", + wy, *wlp->firstchp, *wlp->lastchp, wlp->flags); + + char *_wintype; + + if ((dwin->flags & __ISDERWIN) != 0) + _wintype = "derwin"; + else + _wintype = "dwin"; + + __CTRACE(__CTRACE_REFRESH, + "_wnoutrefresh: %s wy %d\tf %d\tl %d\tflags %x\n", + _wintype, dy_off, *dwlp->firstchp, *dwlp->lastchp, dwlp->flags); + __CTRACE(__CTRACE_REFRESH, + "_wnoutrefresh: %s maxx %d\tch_off %d wlp %p\n", + _wintype, dwin->maxx, dwin->ch_off, wlp); +#endif + if (((wlp->flags & (__ISDIRTY | __ISFORCED)) == 0) && + ((dwlp->flags & (__ISDIRTY | __ISFORCED)) == 0)) + continue; +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "_wnoutrefresh: line y_off %d (dy_off %d) is dirty\n", + y_off, dy_off); +#endif + + wlp = swin->alines[wy]; + vlp = screen->__virtscr->alines[y_off]; + + if ((*wlp->firstchp < maxx + swin->ch_off && + *wlp->lastchp >= swin->ch_off) || + ((((dwin->flags & __ISDERWIN) != 0) && + (*dwlp->firstchp < dwin->maxx + dwin->ch_off && + *dwlp->lastchp >= dwin->ch_off)))) + { + /* Set start column */ + wx = begx; + x_off = wbegx; + dx_off = 0; + /* + * if a derwin then source change pointers aren't + * relevant. + */ + if ((dwin->flags & __ISDERWIN) != 0) + mx = wx + maxx; + else { + if (*wlp->firstchp - swin->ch_off > 0) { + wx += *wlp->firstchp - swin->ch_off; + x_off += *wlp->firstchp - swin->ch_off; + } + mx = maxx; + if (mx > *wlp->lastchp - swin->ch_off + 1) + mx = *dwlp->lastchp - dwin->ch_off + 1; + if (x_off + (mx - wx) > screen->__virtscr->maxx) + mx -= (x_off + maxx) - + screen->__virtscr->maxx; + } + + /* Copy line from "win" to "__virtscr". */ + while (wx < mx) { +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "_wnoutrefresh: copy from %d, " + "%d to %d, %d: %s, 0x%x", + wy, wx, y_off, x_off, + unctrl(wlp->line[wx].ch), + wlp->line[wx].attr); + __CTRACE(__CTRACE_REFRESH, " (curdest %s, 0x%x)", + unctrl(vlp->line[x_off].ch), + vlp->line[x_off].attr); +#endif + /* Copy character */ + vlp->line[x_off].ch = wlp->line[wx].ch; + /* Copy attributes */ + vlp->line[x_off].attr = wlp->line[wx].attr; + /* Check for nca conflict with colour */ + if ((vlp->line[x_off].attr & __COLOR) && + (vlp->line[x_off].attr & screen->nca)) + vlp->line[x_off].attr &= ~__COLOR; + if (win->flags & __ISDERWIN) { + dwlp->line[dx_off].ch = + wlp->line[wx].ch; + dwlp->line[dx_off].attr = + wlp->line[wx].attr; + } + +#ifdef HAVE_WCHAR + if (wlp->line[wx].ch + == (wchar_t)btowc((int) win->bch)) { + vlp->line[x_off].ch = win->bch; + SET_WCOL(vlp->line[x_off], 1); + if (_cursesi_copy_nsp(win->bnsp, + &vlp->line[x_off]) + == ERR) + return ERR; + if (win->flags & __ISDERWIN) { + dwlp->line[dx_off].ch = + win->bch; + SET_WCOL(dwlp->line[dx_off], 1); + if (_cursesi_copy_nsp(win->bnsp, + &dwlp->line[dx_off]) + == ERR) + return ERR; + } + } +#endif /* HAVE_WCHAR */ +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, " = %s, 0x%x\n", + unctrl(vlp->line[x_off].ch), + vlp->line[x_off].attr); +#endif + wx++; + x_off++; + dx_off++; + } + + /* Set flags on "__virtscr" and unset on "win". */ + if (wlp->flags & __ISPASTEOL) + vlp->flags |= __ISPASTEOL; + else + vlp->flags &= ~__ISPASTEOL; + if (wlp->flags & __ISDIRTY) + vlp->flags |= __ISDIRTY; + if (wlp->flags & __ISFORCED) + vlp->flags |= __ISFORCED; + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "win: firstch = %d, lastch = %d\n", + *wlp->firstchp, *wlp->lastchp); + if (win->flags & __ISDERWIN) { + __CTRACE(__CTRACE_REFRESH, + "derwin: fistch = %d, lastch = %d\n", + *dwlp->firstchp, *dwlp->lastchp); + } +#endif + /* Set change pointers on "__virtscr". */ + if (*vlp->firstchp > + *wlp->firstchp + wbegx - win->ch_off) + *vlp->firstchp = + *wlp->firstchp + wbegx - win->ch_off; + if (*vlp->lastchp < + *wlp->lastchp + wbegx - win->ch_off) + *vlp->lastchp = + *wlp->lastchp + wbegx - win->ch_off; + + if (win->flags & __ISDERWIN) { + if (*vlp->firstchp > + *dwlp->firstchp + wbegx - dwin->ch_off) + { + *vlp->firstchp = + *dwlp->firstchp + wbegx + - dwin->ch_off; + vlp->flags |= __ISDIRTY; + } + + if (*vlp->lastchp < + *dwlp->lastchp + wbegx - dwin->ch_off) + { + *vlp->lastchp = *dwlp->lastchp + + wbegx - dwin->ch_off; + vlp->flags |= __ISDIRTY; + } + } + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "__virtscr: firstch = %d, lastch = %d\n", + *vlp->firstchp, *vlp->lastchp); +#endif + /* + * Unset change pointers only if a window and we + * are not forcing a redraw. A pad can be displayed + * again without any of the contents changing. + */ + if ((!(win->flags & __ISPAD)) || + ((wlp->flags & __ISFORCED) == __ISFORCED)) + { + /* Set change pointers on "win". */ + if (*wlp->firstchp >= win->ch_off) + *wlp->firstchp = maxx + win->ch_off; + if (*wlp->lastchp < maxx + win->ch_off) + *wlp->lastchp = win->ch_off; + if ((*wlp->lastchp < *wlp->firstchp) || + (*wlp->firstchp >= maxx + win->ch_off) || + (*wlp->lastchp <= win->ch_off)) { +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "_wnoutrefresh: " + "line %d notdirty\n", wy); +#endif + wlp->flags &= ~(__ISDIRTY | __ISFORCED); + } + } + } + } + return OK; +} + +/* + * wrefresh -- + * Make the current screen look like "win" over the area covered by + * win. + */ +int +wrefresh(WINDOW *win) +{ + int retval; + int pbegx, pbegy; + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "wrefresh: win %p\n", win); +#endif + + _cursesi_screen->curwin = (win == _cursesi_screen->curscr); + if (!_cursesi_screen->curwin) { + pbegx = pbegy = 0; + if ((win->flags & __ISDERWIN) == __ISDERWIN) { + pbegx = win->derx; + pbegy = win->dery; +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "wrefresh: derwin, begy = %d, begx = %x\n", + pbegy, pbegx); +#endif + } + retval = _wnoutrefresh(win, pbegy, pbegx, win->begy, win->begx, + win->maxy, win->maxx); + } else + retval = OK; + if (retval == OK) { + retval = doupdate(); + if (!(win->flags & __LEAVEOK)) { + win->cury = max(0, curscr->cury - win->begy); + win->curx = max(0, curscr->curx - win->begx); + } + } + _cursesi_screen->curwin = 0; + return retval; +} + + /* + * prefresh -- + * Make the current screen look like "pad" over the area coverd by + * the specified area of pad. + */ +int +prefresh(WINDOW *pad, int pbegy, int pbegx, int sbegy, int sbegx, + int smaxy, int smaxx) +{ + int retval; + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "prefresh: pad %p, flags 0x%08x\n", + pad, pad->flags); +#endif + /* Retain values in case pechochar() is called. */ + pad->pbegy = pbegy; + pad->pbegx = pbegx; + pad->sbegy = sbegy; + pad->sbegx = sbegx; + pad->smaxy = smaxy; + pad->smaxx = smaxx; + + /* Use pnoutrefresh() to avoid duplicating code here */ + retval = pnoutrefresh(pad, pbegy, pbegx, sbegy, sbegx, smaxy, smaxx); + if (retval == OK) { + retval = doupdate(); + if (!(pad->flags & __LEAVEOK)) { + pad->cury = max(0, pbegy + (curscr->cury - sbegy)); + pad->curx = max(0, pbegx + (curscr->curx - sbegx)); + } + } + return retval; +} + +/* + * doupdate -- + * Make the current screen look like the virtual window "__virtscr". + */ +int +doupdate(void) +{ + WINDOW *win; + __LINE *wlp, *vlp; + short wy; + int dnum, was_cleared, changed; +#ifdef HAVE_WCHAR + __LDATA *lp; + nschar_t *np; + int x; +#endif /* HAVE_WCHAR */ + + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + if (_cursesi_screen->curwin) + win = curscr; + else + win = _cursesi_screen->__virtscr; + + /* Initialize loop parameters. */ + _cursesi_screen->ly = curscr->cury; + _cursesi_screen->lx = curscr->curx; + wy = 0; + + if (!_cursesi_screen->curwin) { + for (wy = 0; wy < win->maxy; wy++) { + wlp = win->alines[wy]; + if (wlp->flags & __ISDIRTY) { +#ifndef HAVE_WCHAR + wlp->hash = __hash(wlp->line, + (size_t)(win->maxx * __LDATASIZE)); +#else + wlp->hash = 0; + for ( x = 0; x < win->maxx; x++ ) { + lp = &wlp->line[ x ]; + wlp->hash = __hash_more( &lp->ch, + sizeof(wchar_t), wlp->hash ); + wlp->hash = __hash_more( &lp->attr, + sizeof(attr_t), wlp->hash ); + np = lp->nsp; + if (np) { + while (np) { + wlp->hash + = __hash_more( + &np->ch, + sizeof(wchar_t), + wlp->hash); + np = np->next; + } + } + } +#endif /* HAVE_WCHAR */ + } + } + } + + was_cleared = 0; + if ((win->flags & __CLEAROK) || (curscr->flags & __CLEAROK) || + _cursesi_screen->curwin) + { + if (curscr->wattr & __COLOR) + __unsetattr(0); + tputs(clear_screen, 0, __cputchar); + _cursesi_screen->ly = 0; + _cursesi_screen->lx = 0; + if (!_cursesi_screen->curwin) { + curscr->flags &= ~__CLEAROK; + curscr->cury = 0; + curscr->curx = 0; + werase(curscr); + } + __touchwin(win); + win->flags &= ~__CLEAROK; + /* note we cleared for later */ + was_cleared = 1; + } + if (!cursor_address) { + if (win->curx != 0) + __cputchar('\n'); + if (!_cursesi_screen->curwin) + werase(curscr); + } +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "doupdate: (%p): curwin = %d\n", win, + _cursesi_screen->curwin); + __CTRACE(__CTRACE_REFRESH, "doupdate: \tfirstch\tlastch\n"); +#endif + + if (!_cursesi_screen->curwin) { + /* + * Invoke quickch() only if more than a quarter of the lines + * in the window are dirty. + */ + for (wy = 0, dnum = 0; wy < win->maxy; wy++) + if (win->alines[wy]->flags & __ISDIRTY) + dnum++; + if (!__noqch && dnum > (int) win->maxy / 4) + quickch(); + } + +#ifdef DEBUG + { + int i, j; + + __CTRACE(__CTRACE_REFRESH, + "#####################################\n"); + __CTRACE(__CTRACE_REFRESH, + "stdscr(%p)-curscr(%p)-__virtscr(%p)\n", + stdscr, curscr, _cursesi_screen->__virtscr); + for (i = 0; i < curscr->maxy; i++) { + __CTRACE(__CTRACE_REFRESH, "C: %d:", i); + __CTRACE(__CTRACE_REFRESH, " 0x%x \n", + curscr->alines[i]->hash); + for (j = 0; j < curscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, "%c", + curscr->alines[i]->line[j].ch); + __CTRACE(__CTRACE_REFRESH, "\n"); + __CTRACE(__CTRACE_REFRESH, " attr:"); + for (j = 0; j < curscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, " %x", + curscr->alines[i]->line[j].attr); + __CTRACE(__CTRACE_REFRESH, "\n"); + __CTRACE(__CTRACE_REFRESH, "W: %d:", i); + __CTRACE(__CTRACE_REFRESH, " 0x%x \n", + win->alines[i]->hash); + __CTRACE(__CTRACE_REFRESH, " 0x%x ", + win->alines[i]->flags); + for (j = 0; j < win->maxx; j++) + __CTRACE(__CTRACE_REFRESH, "%c", + win->alines[i]->line[j].ch); + __CTRACE(__CTRACE_REFRESH, "\n"); + __CTRACE(__CTRACE_REFRESH, " attr:"); + for (j = 0; j < win->maxx; j++) + __CTRACE(__CTRACE_REFRESH, " %x", + win->alines[i]->line[j].attr); + __CTRACE(__CTRACE_REFRESH, "\n"); +#ifdef HAVE_WCHAR + __CTRACE(__CTRACE_REFRESH, " nsp:"); + for (j = 0; j < curscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, " %p", + win->alines[i]->line[j].nsp); + __CTRACE(__CTRACE_REFRESH, "\n"); + __CTRACE(__CTRACE_REFRESH, " bnsp:"); + for (j = 0; j < curscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, " %p", + win->bnsp); + __CTRACE(__CTRACE_REFRESH, "\n"); +#endif /* HAVE_WCHAR */ + } + } +#endif /* DEBUG */ + + changed = 0; + for (wy = 0; wy < win->maxy; wy++) { + wlp = win->alines[wy]; + vlp = _cursesi_screen->__virtscr->alines[win->begy + wy]; +/* XXX: remove this debug */ +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "doupdate: wy %d\tf: %d\tl:%d\tflags %x\n", + wy, *wlp->firstchp, *wlp->lastchp, wlp->flags); +#endif /* DEBUG */ + if (!_cursesi_screen->curwin) + curscr->alines[wy]->hash = wlp->hash; + if (wlp->flags & __ISDIRTY || wlp->flags & __ISFORCED) { +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "doupdate: [ISDIRTY]wy:%d\tf:%d\tl:%d\n", wy, + *wlp->firstchp, *wlp->lastchp); +#endif /* DEBUG */ + /* + * We have just cleared so don't force an update + * otherwise we spray neeedless blanks to a cleared + * screen. + */ + if (was_cleared == 1) + win->alines[wy]->flags &= ~__ISFORCED; + + if (makech(wy) == ERR) + return ERR; + else { + if (*wlp->firstchp >= 0) + *wlp->firstchp = win->maxx; + if (*wlp->lastchp < win->maxx) + *wlp->lastchp = win->ch_off; + if (*wlp->lastchp < *wlp->firstchp) { +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "doupdate: line %d notdirty\n", wy); +#endif /* DEBUG */ + wlp->flags &= ~(__ISDIRTY | __ISFORCED); + } + + /* Check if we have input after + * changing N lines. */ + if (_cursesi_screen->checkfd != -1 && + ++changed == CHECK_INTERVAL) + { + struct pollfd fds[1]; + + /* If we have input, abort. */ + fds[0].fd = _cursesi_screen->checkfd; + fds[0].events = POLLIN; + if (poll(fds, 1, 0) > 0) + goto cleanup; + changed = 0; + } + } + } + + /* + * virtscr is now synced for the line, unset the change + * pointers. + */ + if (*vlp->firstchp >= 0) + *vlp->firstchp = _cursesi_screen->__virtscr->maxx; + if (*vlp->lastchp <= _cursesi_screen->__virtscr->maxx) + *vlp->lastchp = 0; + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "\t%d\t%d\n", + *wlp->firstchp, *wlp->lastchp); +#endif /* DEBUG */ + } + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "doupdate: ly=%d, lx=%d\n", + _cursesi_screen->ly, _cursesi_screen->lx); +#endif /* DEBUG */ + + if (_cursesi_screen->curwin) + domvcur(win, _cursesi_screen->ly, _cursesi_screen->lx, + win->cury, win->curx); + else { + if (win->flags & __LEAVEOK) { + curscr->cury = _cursesi_screen->ly; + curscr->curx = _cursesi_screen->lx; + } else { + domvcur(win, _cursesi_screen->ly, _cursesi_screen->lx, + win->cury, win->curx); + curscr->cury = win->cury; + curscr->curx = win->curx; + } + } + +cleanup: + /* Don't leave the screen with attributes set. */ + __unsetattr(0); +#ifdef DEBUG +#ifdef HAVE_WCHAR + { + int i, j; + + __CTRACE(__CTRACE_REFRESH, + "***********after*****************\n"); + __CTRACE(__CTRACE_REFRESH, + "stdscr(%p)-curscr(%p)-__virtscr(%p)\n", + stdscr, curscr, _cursesi_screen->__virtscr); + for (i = 0; i < curscr->maxy; i++) { + for (j = 0; j < curscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, + "[%d,%d](%x,%x,%p)-(%x,%x,%p)\n", + i, j, + curscr->alines[i]->line[j].ch, + curscr->alines[i]->line[j].attr, + curscr->alines[i]->line[j].nsp, + _cursesi_screen->__virtscr->alines[i]->line[j].ch, + _cursesi_screen->__virtscr->alines[i]->line[j].attr, + _cursesi_screen->__virtscr->alines[i]->line[j].nsp); + } + } +#endif /* HAVE_WCHAR */ +#endif /* DEBUG */ + return fflush(_cursesi_screen->outfd) == EOF ? ERR : OK; +} + +static void +putattr(__LDATA *nsp) +{ + attr_t off, on; + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "makech: have attr %08x, need attr %08x\n", + curscr->wattr +#ifndef HAVE_WCHAR + & __ATTRIBUTES +#else + & WA_ATTRIBUTES +#endif + , nsp->attr +#ifndef HAVE_WCHAR + & __ATTRIBUTES +#else + & WA_ATTRIBUTES +#endif + ); +#endif + + off = (~nsp->attr & curscr->wattr) +#ifndef HAVE_WCHAR + & __ATTRIBUTES +#else + & WA_ATTRIBUTES +#endif + ; + + /* + * Unset attributes as appropriate. Unset first + * so that the relevant attributes can be reset + * (because 'me' unsets 'mb', 'md', 'mh', 'mk', + * 'mp' and 'mr'). Check to see if we also turn off + * standout, attributes and colour. + */ + if (off & __TERMATTR && exit_attribute_mode != NULL) { + tputs(exit_attribute_mode, 0, __cputchar); + curscr->wattr &= __mask_me; + off &= __mask_me; + } + + /* + * Exit underscore mode if appropriate. + * Check to see if we also turn off standout, + * attributes and colour. + */ + if (off & __UNDERSCORE && exit_underline_mode != NULL) { + tputs(exit_underline_mode, 0, __cputchar); + curscr->wattr &= __mask_ue; + off &= __mask_ue; + } + + /* + * Exit standout mode as appropriate. + * Check to see if we also turn off underscore, + * attributes and colour. + * XXX + * Should use uc if so/se not available. + */ + if (off & __STANDOUT && exit_standout_mode != NULL) { + tputs(exit_standout_mode, 0, __cputchar); + curscr->wattr &= __mask_se; + off &= __mask_se; + } + + if (off & __ALTCHARSET && exit_alt_charset_mode != NULL) { + tputs(exit_alt_charset_mode, 0, __cputchar); + curscr->wattr &= ~__ALTCHARSET; + } + + /* Set/change colour as appropriate. */ + if (__using_color) + __set_color(curscr, nsp->attr & __COLOR); + + on = (nsp->attr & ~curscr->wattr) +#ifndef HAVE_WCHAR + & __ATTRIBUTES +#else + & WA_ATTRIBUTES +#endif + ; + + /* + * Enter standout mode if appropriate. + */ + if (on & __STANDOUT && + enter_standout_mode != NULL && + exit_standout_mode != NULL) + { + tputs(enter_standout_mode, 0, __cputchar); + curscr->wattr |= __STANDOUT; + } + + /* + * Enter underscore mode if appropriate. + * XXX + * Should use uc if us/ue not available. + */ + if (on & __UNDERSCORE && + enter_underline_mode != NULL && + exit_underline_mode != NULL) + { + tputs(enter_underline_mode, 0, __cputchar); + curscr->wattr |= __UNDERSCORE; + } + + /* + * Set other attributes as appropriate. + */ + if (exit_attribute_mode != NULL) { + if (on & __BLINK && enter_blink_mode != NULL) + { + tputs(enter_blink_mode, 0, __cputchar); + curscr->wattr |= __BLINK; + } + if (on & __BOLD && enter_bold_mode != NULL) + { + tputs(enter_bold_mode, 0, __cputchar); + curscr->wattr |= __BOLD; + } + if (on & __DIM && enter_dim_mode != NULL) + { + tputs(enter_dim_mode, 0, __cputchar); + curscr->wattr |= __DIM; + } + if (on & __BLANK && enter_secure_mode != NULL) + { + tputs(enter_secure_mode, 0, __cputchar); + curscr->wattr |= __BLANK; + } + if (on & __PROTECT && enter_protected_mode != NULL) + { + tputs(enter_protected_mode, 0, __cputchar); + curscr->wattr |= __PROTECT; + } + if (on & __REVERSE && enter_reverse_mode != NULL) + { + tputs(enter_reverse_mode, 0, __cputchar); + curscr->wattr |= __REVERSE; + } +#ifdef HAVE_WCHAR + if (on & WA_TOP && enter_top_hl_mode != NULL) + { + tputs(enter_top_hl_mode, 0, __cputchar); + curscr->wattr |= WA_TOP; + } + if (on & WA_LOW && enter_low_hl_mode != NULL) + { + tputs(enter_low_hl_mode, 0, __cputchar); + curscr->wattr |= WA_LOW; + } + if (on & WA_LEFT && enter_left_hl_mode != NULL) + { + tputs(enter_left_hl_mode, 0, __cputchar); + curscr->wattr |= WA_LEFT; + } + if (on & WA_RIGHT && enter_right_hl_mode != NULL) + { + tputs(enter_right_hl_mode, 0, __cputchar); + curscr->wattr |= WA_RIGHT; + } + if (on & WA_HORIZONTAL && enter_horizontal_hl_mode != NULL) + { + tputs(enter_horizontal_hl_mode, 0, __cputchar); + curscr->wattr |= WA_HORIZONTAL; + } + if (on & WA_VERTICAL && enter_vertical_hl_mode != NULL) + { + tputs(enter_vertical_hl_mode, 0, __cputchar); + curscr->wattr |= WA_VERTICAL; + } +#endif /* HAVE_WCHAR */ + } + + /* Enter/exit altcharset mode as appropriate. */ + if (on & __ALTCHARSET && enter_alt_charset_mode != NULL && + exit_alt_charset_mode != NULL) { + tputs(enter_alt_charset_mode, 0, __cputchar); + curscr->wattr |= __ALTCHARSET; + } +} + +static void +putattr_out(__LDATA *nsp) +{ + + if (underline_char && + ((nsp->attr & __STANDOUT) || (nsp->attr & __UNDERSCORE))) + { + __cputchar('\b'); + tputs(underline_char, 0, __cputchar); + } +} + +static int +putch(__LDATA *nsp, __LDATA *csp, int wy, int wx) +{ + + if (csp != NULL) + putattr(nsp); + + if (!_cursesi_screen->curwin && csp) { + csp->attr = nsp->attr; + csp->ch = nsp->ch; +#ifdef HAVE_WCHAR + if (_cursesi_copy_nsp(nsp->nsp, csp) == ERR) + return ERR; +#endif /* HAVE_WCHAR */ + } + +#ifndef HAVE_WCHAR + __cputchar((int)nsp->ch); +#else + if (WCOL(*nsp) <= 0) + goto out; + __cputwchar((int)nsp->ch); +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "makech: (%d,%d)putwchar(0x%x)\n", wy, wx - 1, nsp->ch); +#endif /* DEBUG */ + + /* Output non-spacing characters for the cell. */ + __cursesi_putnsp(nsp->nsp, wy, wx); +out: +#endif /* HAVE_WCHAR */ + + if (csp != NULL) + putattr_out(nsp); + return OK; +} + +static int +putchbr(__LDATA *nsp, __LDATA *csp, __LDATA *psp, int wy, int wx) +{ + int error, cw, pcw; + + /* Can safely print to bottom right corner. */ + if (!auto_right_margin) + return putch(nsp, csp, wy, wx); + + /* Disable auto margins temporarily. */ + if (enter_am_mode && exit_am_mode) { + tputs(exit_am_mode, 0, __cputchar); + error = putch(nsp, csp, wy, wx); + tputs(enter_am_mode, 0, __cputchar); + return error; + } + + /* We need to insert characters. */ +#ifdef HAVE_WCHAR + cw = WCOL(*nsp); + pcw = WCOL(*psp); + if (cw < 1 || pcw < 1) + return ERR; /* Nothing to insert */ + + /* When inserting a wide character, we need something other than + * insert_character. */ + if (pcw > 1 && + !(parm_ich != NULL || + (enter_insert_mode != NULL && exit_insert_mode != NULL))) + return ERR; +#else + cw = pcw = 1; +#endif /* HAVE_WCHAR */ + + /* Write the corner character at wx - pcw. */ + __mvcur(wy, wx, wy, wx - pcw, 1); + if (putch(nsp, csp, wy, wx) == ERR) + return ERR; + + /* Move cursor back. */ + __mvcur(wy, wx - pcw + cw, wy, wx - cw, 1); + + putattr(psp); + + /* Enter insert mode. */ + if (pcw == 1 && insert_character != NULL) + tputs(insert_character, 0, __cputchar); + else if (parm_ich != NULL) + tputs(tiparm(parm_ich, (long)pcw), 0, __cputchar); + else if (enter_insert_mode != NULL && exit_insert_mode != NULL) + tputs(enter_insert_mode, 0, __cputchar); + else + return ERR; + + /* Insert the old character back. */ + error = putch(psp, NULL, wy, wx - pcw); + + /* Exit insert mode. */ + if (insert_character != NULL || parm_ich != NULL) + ; + else if (enter_insert_mode != NULL && exit_insert_mode != NULL) + tputs(exit_insert_mode, 0, __cputchar); + + putattr_out(psp); + + return error; +} + +/* + * makech -- + * Make a change on the screen. + */ +static int +makech(int wy) +{ + WINDOW *win; + static __LDATA blank; + __LDATA *nsp, *csp, *cp, *cep, *fsp; + __LINE *wlp; + size_t clsp, nlsp; /* Last space in lines. */ + int lch, wx, chw; + const char *ce; + attr_t lspc; /* Last space colour */ + +#ifdef __GNUC__ + nlsp = lspc = 0; /* XXX gcc -Wuninitialized */ +#endif + if (_cursesi_screen->curwin) + win = curscr; + else + win = __virtscr; +#ifdef HAVE_WCHAR + blank.ch = (wchar_t)btowc((int) win->bch); + blank.attr = 0; + if (_cursesi_copy_nsp(win->bnsp, &blank) == ERR) + return ERR; + SET_WCOL(blank, 1); +#endif /* HAVE_WCHAR */ +#ifdef DEBUG +#if HAVE_WCHAR + { + int x; + __LDATA *lp, *vlp; + + __CTRACE(__CTRACE_REFRESH, + "[makech-before]wy=%d,curscr(%p)-__virtscr(%p)\n", + wy, curscr, __virtscr); + for (x = 0; x < curscr->maxx; x++) { + lp = &curscr->alines[wy]->line[x]; + vlp = &__virtscr->alines[wy]->line[x]; + __CTRACE(__CTRACE_REFRESH, + "[%d,%d](%x,%x,%x,%x,%p)-" + "(%x,%x,%x,%x,%p)\n", + wy, x, lp->ch, lp->attr, + win->bch, win->battr, lp->nsp, + vlp->ch, vlp->attr, + win->bch, win->battr, vlp->nsp); + } + } +#endif /* HAVE_WCHAR */ +#endif /* DEBUG */ + /* Is the cursor still on the end of the last line? */ + if (wy > 0 && curscr->alines[wy - 1]->flags & __ISPASTEOL) { + domvcur(win, _cursesi_screen->ly, _cursesi_screen->lx, + _cursesi_screen->ly + 1, 0); + _cursesi_screen->ly++; + _cursesi_screen->lx = 0; + } + wlp = win->alines[wy]; + wx = *win->alines[wy]->firstchp; + if (wx < 0) + wx = 0; + else + if (wx >= win->maxx) + return (OK); + lch = *win->alines[wy]->lastchp; + if (lch < 0) + return OK; + else + if (lch >= (int) win->maxx) + lch = win->maxx - 1; + + if (_cursesi_screen->curwin) { + csp = ␣ +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "makech: csp is blank\n"); +#endif /* DEBUG */ + } else { + csp = &curscr->alines[wy]->line[wx]; +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "makech: csp is on curscr:(%d,%d)\n", wy, wx); +#endif /* DEBUG */ + } + + nsp = fsp = &win->alines[wy]->line[wx]; +#ifdef DEBUG + if (_cursesi_screen->curwin) + __CTRACE(__CTRACE_REFRESH, + "makech: nsp is at curscr:(%d,%d)\n", wy, wx); + else + __CTRACE(__CTRACE_REFRESH, + "makech: nsp is at __virtscr:(%d,%d)\n", wy, wx); +#endif /* DEBUG */ + if (clr_eol && !_cursesi_screen->curwin) { + cp = &win->alines[wy]->line[win->maxx - 1]; + lspc = cp->attr & __COLOR; +#ifndef HAVE_WCHAR + while (cp->ch == ' ' && cp->attr == lspc) /* XXX */ + if (cp-- <= win->alines[wy]->line) + break; +#else + while (cp->ch == ( wchar_t )btowc(( int )' ' ) + && ( cp->attr & WA_ATTRIBUTES ) == lspc) + if (cp-- <= win->alines[wy]->line) + break; +#endif /* HAVE_WCHAR */ + if (win->alines[wy]->line > cp) + nlsp = 0; + else + nlsp = cp - win->alines[wy]->line; + } + if (!_cursesi_screen->curwin) + ce = clr_eol; + else + ce = NULL; + + while (wx <= lch) { +#ifdef DEBUG +#ifndef HAVE_WCHAR + __CTRACE(__CTRACE_REFRESH, "makech: wx=%d,lch=%d\n", wx, lch); +#else + __CTRACE(__CTRACE_REFRESH, "makech: nsp=(%x,%x,%x,%x,%p)\n", + nsp->ch, nsp->attr, win->bch, win->battr, nsp->nsp); + __CTRACE(__CTRACE_REFRESH, "makech: csp=(%x,%x,%x,%x,%p)\n", + csp->ch, csp->attr, win->bch, win->battr, csp->nsp); +#endif +#endif /* DEBUG */ + if (!(wlp->flags & __ISFORCED) && +#ifdef HAVE_WCHAR + ((nsp->attr & __WCWIDTH) != __WCWIDTH) && +#endif + celleq(nsp, csp)) + { + if (wx <= lch) { + while (wx <= lch && celleq(nsp, csp)) { + nsp++; + if (!_cursesi_screen->curwin) + ++csp; + ++wx; + } + continue; + } + break; + } + + domvcur(win, _cursesi_screen->ly, _cursesi_screen->lx, wy, wx); + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "makech: 1: wx = %d, ly= %d, " + "lx = %d, newy = %d, newx = %d\n", + wx, _cursesi_screen->ly, _cursesi_screen->lx, wy, wx); +#endif + _cursesi_screen->ly = wy; + _cursesi_screen->lx = wx; + while (wx <= lch && + ((wlp->flags & __ISFORCED) || !celleq(nsp, csp))) + { +#ifndef HAVE_WCHAR + if (ce != NULL && wx >= nlsp + && nsp->ch == ' ' && nsp->attr == lspc) +#else + if (ce != NULL && wx >= nlsp + && nsp->ch == (wchar_t)btowc((int)' ') /* XXX */ + && (nsp->attr & WA_ATTRIBUTES) == lspc) +#endif + { + /* Check for clear to end-of-line. */ + cep = &curscr->alines[wy]->line[win->maxx - 1]; +#ifndef HAVE_WCHAR + while (cep->ch == ' ' && cep->attr == lspc) /* XXX */ +#else + while (cep->ch == (wchar_t)btowc((int)' ') + && (cep->attr & WA_ATTRIBUTES) == lspc) +#endif /* HAVE_WCHAR */ + if (cep-- <= csp) + break; + if (cep > (curscr->alines[wy]->line + win->begx * __LDATASIZE)) + clsp = cep - curscr->alines[wy]->line - + win->begx * __LDATASIZE; + else + clsp = 0; +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "makech: clsp = %zu, nlsp = %zu\n", + clsp, nlsp); + __CTRACE(__CTRACE_REFRESH, + "makech: line = %p, cep = %p, begx = %u\n", + curscr->alines[wy]->line, cep, win->begx); +#endif + if (((clsp - nlsp >= strlen(ce) && + clsp < win->maxx * __LDATASIZE) || + wy == win->maxy - 1) && + (!(lspc & __COLOR) || + ((lspc & __COLOR) && back_color_erase))) + { + __unsetattr(0); + if (__using_color && + ((lspc & __COLOR) != + (curscr->wattr & __COLOR))) + __set_color(curscr, lspc & + __COLOR); + tputs(ce, 0, __cputchar); + _cursesi_screen->lx = wx + win->begx; + while (wx++ <= clsp) { + csp->attr = lspc; +#ifndef HAVE_WCHAR + csp->ch = ' '; /* XXX */ +#else + csp->ch = (wchar_t)btowc((int)' '); + SET_WCOL( *csp, 1 ); +#endif /* HAVE_WCHAR */ + assert(csp != &blank); + csp++; + } + return OK; + } + ce = NULL; + } + +#ifdef HAVE_WCHAR + chw = WCOL(*nsp); + if (chw < 0) + chw = 0; /* match putch() */ +#else + chw = 1; +#endif /* HAVE_WCHAR */ + if (wx + chw >= win->maxx && + wy == win->maxy - 1 && !_cursesi_screen->curwin) + { + if (win->flags & __ENDLINE) + __unsetattr(1); + if (!(win->flags & __SCROLLWIN)) { + int e; + + if (win->flags & __SCROLLOK) + e = putch(nsp, csp, wy, wx); + else + e = putchbr(nsp, csp, + nsp == fsp ? NULL : nsp - 1, + wy, wx); + if (e == ERR) + return ERR; + } + if (wx + chw < curscr->maxx) { + domvcur(win, + _cursesi_screen->ly, wx, + (int)(win->maxy - 1), + (int)(win->maxx - 1)); + } + _cursesi_screen->ly = win->maxy - 1; + _cursesi_screen->lx = win->maxx - 1; + return OK; + } + if (wx + chw < win->maxx || wy < win->maxy - 1 || + !(win->flags & __SCROLLWIN)) + { + if (putch(nsp, csp, wy, wx) == ERR) + return ERR; + if (!_cursesi_screen->curwin) { + assert(csp != &blank); + csp++; + } + } else { + putattr(nsp); + putattr_out(nsp); + } + wx += chw; + nsp++; +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "makech: 2: wx = %d, lx = %d\n", + wx, _cursesi_screen->lx); +#endif + } + if (_cursesi_screen->lx == wx) /* If no change. */ + break; + _cursesi_screen->lx = wx; + if (_cursesi_screen->lx >= COLS && auto_right_margin) + _cursesi_screen->lx = COLS - 1; + else + if (wx >= win->maxx) { + domvcur(win, + _cursesi_screen->ly, + _cursesi_screen->lx, + _cursesi_screen->ly, + (int)(win->maxx - 1)); + _cursesi_screen->lx = win->maxx - 1; + } +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "makech: 3: wx = %d, lx = %d\n", + wx, _cursesi_screen->lx); +#endif + } +#ifdef DEBUG +#if HAVE_WCHAR + { + int x; + __LDATA *lp, *vlp; + + __CTRACE(__CTRACE_REFRESH, + "makech-after: curscr(%p)-__virtscr(%p)\n", + curscr, __virtscr ); + for (x = 0; x < curscr->maxx; x++) { + lp = &curscr->alines[wy]->line[x]; + vlp = &__virtscr->alines[wy]->line[x]; + __CTRACE(__CTRACE_REFRESH, + "[%d,%d](%x,%x,%x,%x,%p)-" + "(%x,%x,%x,%x,%p)\n", + wy, x, lp->ch, lp->attr, + win->bch, win->battr, lp->nsp, + vlp->ch, vlp->attr, + win->bch, win->battr, vlp->nsp); + } + } +#endif /* HAVE_WCHAR */ +#endif /* DEBUG */ + + return OK; +} + +/* + * domvcur -- + * Do a mvcur, leaving attributes if necessary. + */ +static void +domvcur(WINDOW *win, int oy, int ox, int ny, int nx) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "domvcur: (%d,%d)=>(%d,%d) win %p\n", + oy, ox, ny, nx, win ); +#endif /* DEBUG */ + + __unsetattr(1); + + /* Don't move the cursor unless we need to. */ + if (oy == ny && ox == nx) { + /* Check EOL. */ + if (!(win->alines[oy]->flags & __ISPASTEOL)) + return; + } + + /* Clear EOL flags. */ + win->alines[oy]->flags &= ~__ISPASTEOL; + win->alines[ny]->flags &= ~__ISPASTEOL; + + __mvcur(oy, ox, ny, nx, 1); +} + +/* + * Quickch() attempts to detect a pattern in the change of the window + * in order to optimize the change, e.g., scroll n lines as opposed to + * repainting the screen line by line. + */ + +static __LDATA buf[128]; +static unsigned int last_hash; +static size_t last_hash_len; +#define BLANKSIZE (sizeof(buf) / sizeof(buf[0])) + +static void +quickch(void) +{ +#define THRESH (int) __virtscr->maxy / 4 + + __LINE *clp, *tmp1, *tmp2; + int bsize, curs, curw, starts, startw, i, j; + int n, target, cur_period, bot, top, sc_region; + unsigned int blank_hash; + attr_t bcolor; + +#ifdef __GNUC__ + curs = curw = starts = startw = 0; /* XXX gcc -Wuninitialized */ +#endif + /* + * Find how many lines from the top of the screen are unchanged. + */ + for (top = 0; top < __virtscr->maxy; top++) { + if (__virtscr->alines[top]->flags & __ISDIRTY && + (__virtscr->alines[top]->hash != curscr->alines[top]->hash || + !lineeq(__virtscr->alines[top]->line, + curscr->alines[top]->line, + (size_t) __virtscr->maxx))) + break; + else + __virtscr->alines[top]->flags &= ~__ISDIRTY; + } + /* + * Find how many lines from bottom of screen are unchanged. + */ + for (bot = __virtscr->maxy - 1; bot >= 0; bot--) { + if (__virtscr->alines[bot]->flags & __ISDIRTY && + (__virtscr->alines[bot]->hash != curscr->alines[bot]->hash || + !lineeq(__virtscr->alines[bot]->line, + curscr->alines[bot]->line, + (size_t) __virtscr->maxx))) + break; + else + __virtscr->alines[bot]->flags &= ~__ISDIRTY; + } + + /* + * Work round an xterm bug where inserting lines causes all the + * inserted lines to be covered with the background colour we + * set on the first line (even if we unset it for subsequent + * lines). + */ + bcolor = __virtscr->alines[min(top, + __virtscr->maxy - 1)]->line[0].attr & __COLOR; + for (i = top + 1, j = 0; i < bot; i++) { + if ((__virtscr->alines[i]->line[0].attr & __COLOR) != bcolor) { + bcolor = __virtscr->alines[i]->line[__virtscr->maxx]. + attr & __COLOR; + j = i - top; + } else + break; + } + top += j; + +#ifdef NO_JERKINESS + /* + * If we have a bottom unchanged region return. Scrolling the + * bottom region up and then back down causes a screen jitter. + * This will increase the number of characters sent to the screen + * but it looks better. + */ + if (bot < __virtscr->maxy - 1) + return; +#endif /* NO_JERKINESS */ + + /* + * Search for the largest block of text not changed. + * Invariants of the loop: + * - Startw is the index of the beginning of the examined block in + * __virtscr. + * - Starts is the index of the beginning of the examined block in + * curscr. + * - Curw is the index of one past the end of the exmined block in + * __virtscr. + * - Curs is the index of one past the end of the exmined block in + * curscr. + * - bsize is the current size of the examined block. + */ + + for (bsize = bot - top; bsize >= THRESH; bsize--) { + for (startw = top; startw <= bot - bsize; startw++) + for (starts = top; starts <= bot - bsize; starts++) { + for (curw = startw, curs = starts; + curs < starts + bsize; curw++, curs++) + if (__virtscr->alines[curw]->hash != + curscr->alines[curs]->hash) + break; + if (curs != starts + bsize) + continue; + for (curw = startw, curs = starts; + curs < starts + bsize; curw++, curs++) + if (!lineeq(__virtscr->alines[curw]->line, + curscr->alines[curs]->line, + (size_t) __virtscr->maxx)) + break; + if (curs == starts + bsize) + goto done; + } + } +done: + + /* Did not find anything */ + if (bsize < THRESH) + return; + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "quickch:bsize=%d, starts=%d, startw=%d, " + "curw=%d, curs=%d, top=%d, bot=%d\n", + bsize, starts, startw, curw, curs, top, bot); +#endif + + /* + * Make sure that there is no overlap between the bottom and top + * regions and the middle scrolled block. + */ + if (bot < curs) + bot = curs - 1; + if (top > starts) + top = starts; + + n = startw - starts; + +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "#####################################\n"); + for (i = 0; i < curscr->maxy; i++) { + __CTRACE(__CTRACE_REFRESH, "C: %d:", i); + __CTRACE(__CTRACE_REFRESH, " 0x%x \n", curscr->alines[i]->hash); + for (j = 0; j < curscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, "%c", + curscr->alines[i]->line[j].ch); + __CTRACE(__CTRACE_REFRESH, "\n"); + __CTRACE(__CTRACE_REFRESH, " attr:"); + for (j = 0; j < curscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, " %x", + curscr->alines[i]->line[j].attr); + __CTRACE(__CTRACE_REFRESH, "\n"); + __CTRACE(__CTRACE_REFRESH, "W: %d:", i); + __CTRACE(__CTRACE_REFRESH, " 0x%x \n", + __virtscr->alines[i]->hash); + __CTRACE(__CTRACE_REFRESH, " 0x%x ", + __virtscr->alines[i]->flags); + for (j = 0; j < __virtscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, "%c", + __virtscr->alines[i]->line[j].ch); + __CTRACE(__CTRACE_REFRESH, "\n"); + __CTRACE(__CTRACE_REFRESH, " attr:"); + for (j = 0; j < __virtscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, " %x", + __virtscr->alines[i]->line[j].attr); + __CTRACE(__CTRACE_REFRESH, "\n"); + } +#endif + +#ifndef HAVE_WCHAR + if (buf[0].ch != ' ') { + for (i = 0; i < BLANKSIZE; i++) { + buf[i].ch = ' '; + buf[i].attr = 0; + } + } +#else + if (buf[0].ch != (wchar_t)btowc((int)curscr->bch )) { + for (i = 0; i < BLANKSIZE; i++) { + buf[i].ch = (wchar_t)btowc((int)curscr->bch); + if (_cursesi_copy_nsp(curscr->bnsp, &buf[i]) == ERR) + return; + buf[i].attr = 0; + SET_WCOL(buf[i], 1); + } + } +#endif /* HAVE_WCHAR */ + + if (__virtscr->maxx != last_hash_len) { + blank_hash = 0; + for (i = __virtscr->maxx; i > BLANKSIZE; i -= BLANKSIZE) { + blank_hash = __hash_more(buf, sizeof(buf), blank_hash); + } + blank_hash = __hash_more((char *)(void *)buf, + i * sizeof(buf[0]), blank_hash); + /* cache result in static data - screen width doesn't change often */ + last_hash_len = __virtscr->maxx; + last_hash = blank_hash; + } else + blank_hash = last_hash; + + /* + * Perform the rotation to maintain the consistency of curscr. + * This is hairy since we are doing an *in place* rotation. + * Invariants of the loop: + * - I is the index of the current line. + * - Target is the index of the target of line i. + * - Tmp1 points to current line (i). + * - Tmp2 and points to target line (target); + * - Cur_period is the index of the end of the current period. + * (see below). + * + * There are 2 major issues here that make this rotation non-trivial: + * 1. Scrolling in a scrolling region bounded by the top + * and bottom regions determined (whose size is sc_region). + * 2. As a result of the use of the mod function, there may be a + * period introduced, i.e., 2 maps to 4, 4 to 6, n-2 to 0, and + * 0 to 2, which then causes all odd lines not to be rotated. + * To remedy this, an index of the end ( = beginning) of the + * current 'period' is kept, cur_period, and when it is reached, + * the next period is started from cur_period + 1 which is + * guaranteed not to have been reached since that would mean that + * all records would have been reached. (think about it...). + * + * Lines in the rotation can have 3 attributes which are marked on the + * line so that curscr is consistent with the visual screen. + * 1. Not dirty -- lines inside the scrolled block, top region or + * bottom region. + * 2. Blank lines -- lines in the differential of the scrolling + * region adjacent to top and bot regions + * depending on scrolling direction. + * 3. Dirty line -- all other lines are marked dirty. + */ + sc_region = bot - top + 1; + i = top; + tmp1 = curscr->alines[top]; + cur_period = top; + for (j = top; j <= bot; j++) { + target = (i - top + n + sc_region) % sc_region + top; + tmp2 = curscr->alines[target]; + curscr->alines[target] = tmp1; + /* Mark block as clean and blank out scrolled lines. */ + clp = curscr->alines[target]; +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "quickch: n=%d startw=%d curw=%d i = %d target=%d ", + n, startw, curw, i, target); +#endif + if ((target >= startw && target < curw) || target < top + || target > bot) + { +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, " notdirty\n"); +#endif + __virtscr->alines[target]->flags &= ~__ISDIRTY; + } else + if ((n > 0 && target >= top && target < top + n) || + (n < 0 && target <= bot && target > bot + n)) + { + if (clp->hash != blank_hash || + !lineeq(clp->line, clp->line + 1, + (__virtscr->maxx - 1)) || + !celleq(clp->line, buf)) + { + for (i = __virtscr->maxx; + i > BLANKSIZE; + i -= BLANKSIZE) { + (void) memcpy(clp->line + i - + BLANKSIZE, buf, sizeof(buf)); + } + (void) memcpy(clp->line , buf, i * + sizeof(buf[0])); +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + " blanked out: dirty\n"); +#endif + clp->hash = blank_hash; + __touchline(__virtscr, target, 0, (int) __virtscr->maxx - 1); + } else { +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + " -- blank line already: dirty\n"); +#endif + __touchline(__virtscr, target, 0, (int) __virtscr->maxx - 1); + } + } else { +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, " -- dirty\n"); +#endif + __touchline(__virtscr, target, 0, (int) __virtscr->maxx - 1); + } + if (target == cur_period) { + i = target + 1; + tmp1 = curscr->alines[i]; + cur_period = i; + } else { + tmp1 = tmp2; + i = target; + } + } +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n"); + for (i = 0; i < curscr->maxy; i++) { + __CTRACE(__CTRACE_REFRESH, "C: %d:", i); + for (j = 0; j < curscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, "%c", + curscr->alines[i]->line[j].ch); + __CTRACE(__CTRACE_REFRESH, "\n"); + __CTRACE(__CTRACE_REFRESH, "W: %d:", i); + for (j = 0; j < __virtscr->maxx; j++) + __CTRACE(__CTRACE_REFRESH, "%c", + __virtscr->alines[i]->line[j].ch); + __CTRACE(__CTRACE_REFRESH, "\n"); + } +#endif + if (n != 0) + scrolln(starts, startw, curs, bot, top); +} + +/* + * scrolln -- + * Scroll n lines, where n is starts - startw. + */ +static void /* ARGSUSED */ +scrolln(int starts, int startw, int curs, int bot, int top) +{ + int i, oy, ox, n; + + oy = curscr->cury; + ox = curscr->curx; + n = starts - startw; + + /* + * XXX + * The initial tests that set __noqch don't let us reach here unless + * we have either cs + ho + SF/sf/SR/sr, or AL + DL. SF/sf and SR/sr + * scrolling can only shift the entire scrolling region, not just a + * part of it, which means that the quickch() routine is going to be + * sadly disappointed in us if we don't have cs as well. + * + * If cs, ho and SF/sf are set, can use the scrolling region. Because + * the cursor position after cs is undefined, we need ho which gives us + * the ability to move to somewhere without knowledge of the current + * location of the cursor. Still call __mvcur() anyway, to update its + * idea of where the cursor is. + * + * When the scrolling region has been set, the cursor has to be at the + * last line of the region to make the scroll happen. + * + * Doing SF/SR or AL/DL appears faster on the screen than either sf/sr + * or AL/DL, and, some terminals have AL/DL, sf/sr, and cs, but not + * SF/SR. So, if we're scrolling almost all of the screen, try and use + * AL/DL, otherwise use the scrolling region. The "almost all" is a + * shameless hack for vi. + */ + if (n > 0) { + if (change_scroll_region != NULL && cursor_home != NULL && + (parm_index != NULL || + ((parm_insert_line == NULL || parm_delete_line == NULL || + top > 3 || bot + 3 < __virtscr->maxy) && + scroll_forward != NULL))) + { + tputs(tiparm(change_scroll_region, top, bot), + 0, __cputchar); + __mvcur(oy, ox, 0, 0, 1); + tputs(cursor_home, 0, __cputchar); + __mvcur(0, 0, bot, 0, 1); + if (parm_index != NULL) + tputs(tiparm(parm_index, n), + 0, __cputchar); + else + for (i = 0; i < n; i++) + tputs(scroll_forward, 0, __cputchar); + tputs(tiparm(change_scroll_region, + 0, (int)__virtscr->maxy - 1), 0, __cputchar); + __mvcur(bot, 0, 0, 0, 1); + tputs(cursor_home, 0, __cputchar); + __mvcur(0, 0, oy, ox, 1); + return; + } + + /* Scroll up the block. */ + if (parm_index != NULL && top == 0) { + __mvcur(oy, ox, bot, 0, 1); + tputs(tiparm(parm_index, n), 0, __cputchar); + } else + if (parm_delete_line != NULL) { + __mvcur(oy, ox, top, 0, 1); + tputs(tiparm(parm_delete_line, n), + 0, __cputchar); + } else + if (delete_line != NULL) { + __mvcur(oy, ox, top, 0, 1); + for (i = 0; i < n; i++) + tputs(delete_line, 0, + __cputchar); + } else + if (scroll_forward != NULL && top == 0) { + __mvcur(oy, ox, bot, 0, 1); + for (i = 0; i < n; i++) + tputs(scroll_forward, 0, + __cputchar); + } else + abort(); + + /* Push down the bottom region. */ + __mvcur(top, 0, bot - n + 1, 0, 1); + if (parm_insert_line != NULL) + tputs(tiparm(parm_insert_line, n), 0, __cputchar); + else { + if (insert_line != NULL) { + for (i = 0; i < n; i++) + tputs(insert_line, 0, __cputchar); + } else + abort(); + } + __mvcur(bot - n + 1, 0, oy, ox, 1); + } else { + /* + * !!! + * n < 0 + * + * If cs, ho and SR/sr are set, can use the scrolling region. + * See the above comments for details. + */ + if (change_scroll_region != NULL && cursor_home != NULL && + (parm_rindex != NULL || + ((parm_insert_line == NULL || parm_delete_line == NULL || + top > 3 || + bot + 3 < __virtscr->maxy) && scroll_reverse != NULL))) + { + tputs(tiparm(change_scroll_region, top, bot), + 0, __cputchar); + __mvcur(oy, ox, 0, 0, 1); + tputs(cursor_home, 0, __cputchar); + __mvcur(0, 0, top, 0, 1); + + if (parm_rindex != NULL) + tputs(tiparm(parm_rindex, -n), + 0, __cputchar); + else + for (i = n; i < 0; i++) + tputs(scroll_reverse, 0, __cputchar); + tputs(tiparm(change_scroll_region, + 0, (int) __virtscr->maxy - 1), 0, __cputchar); + __mvcur(top, 0, 0, 0, 1); + tputs(cursor_home, 0, __cputchar); + __mvcur(0, 0, oy, ox, 1); + return; + } + + /* Preserve the bottom lines. */ + __mvcur(oy, ox, bot + n + 1, 0, 1); + if (parm_rindex != NULL && bot == __virtscr->maxy) + tputs(tiparm(parm_rindex, -n), 0, __cputchar); + else { + if (parm_delete_line != NULL) + tputs(tiparm(parm_delete_line, -n), + 0, __cputchar); + else { + if (delete_line != NULL) + for (i = n; i < 0; i++) + tputs(delete_line, + 0, __cputchar); + else { + if (scroll_reverse != NULL && + bot == __virtscr->maxy) + for (i = n; i < 0; i++) + tputs(scroll_reverse, 0, + __cputchar); + else + abort(); + } + } + } + /* Scroll the block down. */ + __mvcur(bot + n + 1, 0, top, 0, 1); + if (parm_insert_line != NULL) + tputs(tiparm(parm_insert_line, -n), 0, __cputchar); + else + if (insert_line != NULL) + for (i = n; i < 0; i++) + tputs(insert_line, 0, __cputchar); + else + abort(); + __mvcur(top, 0, oy, ox, 1); + } +} + +/* + * __unsetattr -- + * Unset attributes on curscr. Leave standout, attribute and colour + * modes if necessary (!ms). Always leave altcharset (xterm at least + * ignores a cursor move if we don't). + */ +void /* ARGSUSED */ +__unsetattr(int checkms) +{ + int isms; + + if (checkms) { + if (!move_standout_mode) + isms = 1; + else + isms = 0; + } else + isms = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "__unsetattr: checkms = %d, ms = %s, wattr = %08x\n", + checkms, move_standout_mode ? "TRUE" : "FALSE", curscr->wattr); +#endif + + /* + * Don't leave the screen in standout mode (check against ms). Check + * to see if we also turn off underscore, attributes and colour. + */ + if (curscr->wattr & __STANDOUT && isms) { + tputs(exit_standout_mode, 0, __cputchar); + curscr->wattr &= __mask_se; + } + /* + * Don't leave the screen in underscore mode (check against ms). + * Check to see if we also turn off attributes. Assume that we + * also turn off colour. + */ + if (curscr->wattr & __UNDERSCORE && isms) { + tputs(exit_underline_mode, 0, __cputchar); + curscr->wattr &= __mask_ue; + } + /* + * Don't leave the screen with attributes set (check against ms). + * Assume that also turn off colour. + */ + if (curscr->wattr & __TERMATTR && isms) { + tputs(exit_attribute_mode, 0, __cputchar); + curscr->wattr &= __mask_me; + } + /* Don't leave the screen with altcharset set (don't check ms). */ + if (curscr->wattr & __ALTCHARSET) { + tputs(exit_alt_charset_mode, 0, __cputchar); + curscr->wattr &= ~__ALTCHARSET; + } + /* Don't leave the screen with colour set (check against ms). */ + if (__using_color && isms) + __unset_color(curscr); +} + +#ifdef HAVE_WCHAR +/* compare two cells on screen, must have the same forground/background, + * and the same sequence of non-spacing characters */ +static int +celleq(__LDATA *x, __LDATA *y) +{ + nschar_t *xnp = x->nsp, *ynp = y->nsp; + int ret = ( x->ch == y->ch ) && ( x->attr == y->attr ); + + if (!ret) + return 0; + if (!xnp && !ynp) + return 1; + if ((xnp && !ynp) || (!xnp && ynp)) + return 0; + + while (xnp && ynp) { + if (xnp->ch != ynp->ch) + return 0; + xnp = xnp->next; + ynp = ynp->next; + } + return !xnp && !ynp; +} + +/* compare two line segments */ +static int +lineeq(__LDATA *xl, __LDATA *yl, size_t len) +{ + int i = 0; + __LDATA *xp = xl, *yp = yl; + + for (i = 0; i < len; i++, xp++, yp++) { + if (!celleq(xp, yp)) + return 0; + } + return 1; +} + +/* + * Output the non-spacing characters associated with the given character + * cell to the screen. + */ + +void +__cursesi_putnsp(nschar_t *nsp, const int wy, const int wx) +{ + nschar_t *p; + + /* this shuts up gcc warnings about wx and wy not being used */ + if (wx > wy) { + } + + p = nsp; + while (p != NULL) { + __cputwchar((int)p->ch); +#ifdef DEBUG + __CTRACE(__CTRACE_REFRESH, + "_cursesi_putnsp: (%d,%d) non-spacing putwchar(0x%x)\n", + wy, wx - 1, p->ch); +#endif + p = p->next; + } +} + +#endif /* HAVE_WCHAR */ diff --git a/vendor/netbsd-curses/libcurses/reset_prog_mode.3 b/vendor/netbsd-curses/libcurses/reset_prog_mode.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/reset_prog_mode.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/reset_shell_mode.3 b/vendor/netbsd-curses/libcurses/reset_shell_mode.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/reset_shell_mode.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/resetty.3 b/vendor/netbsd-curses/libcurses/resetty.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/resetty.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/resize.c b/vendor/netbsd-curses/libcurses/resize.c new file mode 100644 index 0000000..4a9431e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/resize.c @@ -0,0 +1,405 @@ +/* $NetBSD: resize.c,v 1.30 2018/11/02 04:17:39 blymn Exp $ */ + +/* + * Copyright (c) 2001 + * Brett Lymn. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +static int __resizeterm(WINDOW *win, int nlines, int ncols); +static int __resizewin(WINDOW *win, int nlines, int ncols); + +/* + * wresize -- + * Resize the given window to the new size. + */ +int +wresize(WINDOW *win, int req_nlines, int req_ncols) +{ + int nlines = req_nlines; + int ncols = req_ncols; + + if (win == NULL) + return ERR; + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "wresize: (%p, %d, %d)\n", + win, nlines, ncols); +#endif + if (win->orig == NULL) { + /* bound "our" windows by the screen size */ + if (win == curscr || win == __virtscr || win == stdscr) { + if (nlines > LINES) + nlines = LINES; + if (nlines < 1) + nlines = 1; + if (ncols > COLS) + ncols = COLS; + if (ncols < 1) + ncols = 1; + } else { + if (win->begy > LINES) + win->begy = 0; + if (win->begy + nlines > LINES) + nlines = 0; + if (nlines <= 0) + nlines += LINES - win->begy; + if (nlines < 1) + nlines = 1; + if (win->begx > COLS) + win->begx = 0; + if (win->begx + ncols > COLS) + ncols = 0; + if (ncols <= 0) + ncols += COLS - win->begx; + if (ncols < 1) + ncols = 1; + } + } else { + /* subwins must fit inside the parent - check this */ + if (win->begy > win->orig->begy + win->orig->maxy) + win->begy = win->orig->begy + win->orig->maxy - 1; + if (win->begy + nlines > win->orig->begy + win->orig->maxy) + nlines = 0; + if (nlines <= 0) + nlines += win->orig->begy + win->orig->maxy - win->begy; + if (nlines < 1) + nlines = 1; + if (win->begx > win->orig->begx + win->orig->maxx) + win->begx = win->orig->begx + win->orig->maxx - 1; + if (win->begx + ncols > win->orig->begx + win->orig->maxx) + ncols = 0; + if (ncols <= 0) + ncols += win->orig->begx + win->orig->maxx - win->begx; + if (ncols < 1) + ncols = 1; + } + + if ((__resizewin(win, nlines, ncols)) == ERR) + return ERR; + + win->reqy = req_nlines; + win->reqx = req_ncols; + + /* If someone resizes curscr, we must also resize __virtscr */ + if (win == curscr) { + if ((__resizewin(__virtscr, nlines, ncols)) == ERR) + return ERR; + __virtscr->reqy = req_nlines; + __virtscr->reqx = req_ncols; + } + + return OK; +} + +/* + * is_term_resized -- + * Return true if the given dimensions do not match the + * internal structures. + */ +bool +is_term_resized(int nlines, int ncols) +{ + + return (nlines > 0 && ncols > 0 && + (nlines != _cursesi_screen->LINES || + ncols != _cursesi_screen->COLS)); +} + +/* + * resizeterm -- + * Resize the terminal window, resizing the dependent windows. + * Handles internal book-keeping. + */ +int +resizeterm(int nlines, int ncols) +{ + int result; + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "resizeterm: (%d, %d)\n", nlines, ncols); +#endif + + /* Unconditionally inform application screen has been resized. */ + _cursesi_screen->resized = 1; + + if (!is_term_resized(nlines, ncols)) + return OK; + + result = resize_term(nlines, ncols); + + /* Screen contents are unknown, libcurses is not libpanel, we don't + * know the correct draw order. */ + clearok(curscr, TRUE); + + if (result == OK) { + /* Redraw the soft label keys to the new size. */ + __slk_resize(_cursesi_screen, ncols); + __slk_noutrefresh(_cursesi_screen); + } + + return result; +} + +/* + * resize_term -- + * Resize the terminal window, resizing the dependent windows. + */ +int +resize_term(int nlines, int ncols) +{ + WINDOW *win; + struct __winlist *list; + int rlines; + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "resize_term: (%d, %d)\n", nlines, ncols); +#endif + + if (!is_term_resized(nlines, ncols)) + return OK; + + if (__resizeterm(curscr, nlines, ncols) == ERR) + return ERR; + if (__resizeterm(__virtscr, nlines, ncols) == ERR) + return ERR; + rlines = nlines - __rippedlines(_cursesi_screen, 0); + if (__resizeterm(stdscr, rlines, ncols) == ERR) + return ERR; + + _cursesi_screen->LINES = nlines; + _cursesi_screen->COLS = ncols; + LINES = nlines; + COLS = ncols; + + /* tweak the flags now that we have updated the LINES and COLS */ + for (list = _cursesi_screen->winlistp; list != NULL; list = list->nextp) { + win = list->winp; + + if (!(win->flags & __ISPAD)) + __swflags(win); + } + + /* Resize and re-position the ripped off windows. */ + if (__ripoffresize(_cursesi_screen) == ERR) + return ERR; + + return OK; +} + +/* + * __resizeterm + * Setup window for resizing. + */ +static int +__resizeterm(WINDOW *win, int nlines, int ncols) +{ + int newlines, newcols; + + newlines = win->reqy; + if (win->begy + newlines >= nlines) + newlines = 0; + if (newlines == 0) + newlines = nlines - win->begy; + + newcols = win->reqx; + if (win->begx + newcols >= ncols) + newcols = 0; + if (newcols == 0) + newcols = ncols - win->begx; + + return __resizewin(win, newlines, newcols); +} + +/* + * __resizewin -- + * Resize the given window. + */ +static int +__resizewin(WINDOW *win, int nlines, int ncols) +{ + __LINE *lp, *olp, **newlines, *newlspace; + __LDATA *sp; + __LDATA *newwspace; + int i, j; + int y, x; + WINDOW *swin; + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "resize: (%p, %d, %d)\n", win, nlines, ncols); + __CTRACE(__CTRACE_WINDOW, "resize: win->wattr = %08x\n", win->wattr); + __CTRACE(__CTRACE_WINDOW, "resize: win->flags = %#.4x\n", win->flags); + __CTRACE(__CTRACE_WINDOW, "resize: win->maxy = %d\n", win->maxy); + __CTRACE(__CTRACE_WINDOW, "resize: win->maxx = %d\n", win->maxx); + __CTRACE(__CTRACE_WINDOW, "resize: win->begy = %d\n", win->begy); + __CTRACE(__CTRACE_WINDOW, "resize: win->begx = %d\n", win->begx); + __CTRACE(__CTRACE_WINDOW, "resize: win->scr_t = %d\n", win->scr_t); + __CTRACE(__CTRACE_WINDOW, "resize: win->scr_b = %d\n", win->scr_b); +#endif + + /* + * free up any non-spacing storage before we lose the + * pointers... + */ +#ifdef HAVE_WCHAR + __cursesi_win_free_nsp(win); +#endif + + if (nlines <= 0 || ncols <= 0) + nlines = ncols = 0; + else { + /* Reallocate line pointer array and line space. */ + newlines = realloc(win->alines, nlines * sizeof(__LINE *)); + if (newlines == NULL) + return ERR; + win->alines = newlines; + + newlspace = realloc(win->lspace, nlines * sizeof(__LINE)); + if (newlspace == NULL) + return ERR; + win->lspace = newlspace; + } + + /* Don't allocate window and line space if it's a subwindow */ + if (win->orig == NULL) { + /* + * Allocate window space in one chunk. + */ + if (ncols != 0) { + newwspace = realloc(win->wspace, + ncols * nlines * sizeof(__LDATA)); + if (newwspace == NULL) + return ERR; + win->wspace = newwspace; + } + + /* + * Point line pointers to line space, and lines themselves into + * window space. + */ + for (lp = win->lspace, i = 0; i < nlines; i++, lp++) { + win->alines[i] = lp; + lp->line = &win->wspace[i * ncols]; +#ifdef DEBUG + lp->sentinel = SENTINEL_VALUE; +#endif + lp->firstchp = &lp->firstch; + lp->lastchp = &lp->lastch; + lp->firstch = 0; + lp->lastch = ncols - 1; + lp->flags = __ISDIRTY; + } + } else { + + win->ch_off = win->begx - win->orig->begx; + /* Point line pointers to line space. */ + for (lp = win->lspace, i = 0; i < nlines; i++, lp++) { + win->alines[i] = lp; + olp = win->orig->alines[i + win->begy - win->orig->begy]; + lp->line = &olp->line[win->ch_off]; +#ifdef DEBUG + lp->sentinel = SENTINEL_VALUE; +#endif + lp->firstchp = &olp->firstch; + lp->lastchp = &olp->lastch; + lp->flags = __ISDIRTY; + } + } + + win->cury = win->curx = 0; + win->maxy = nlines; + win->maxx = ncols; + win->scr_b = win->maxy - 1; + __swflags(win); + + /* + * we must zot the window contents otherwise lines may pick + * up attributes from the previous line when the window is + * made smaller. The client will redraw the window anyway + * so this is no big deal. + */ + for (i = 0; i < win->maxy; i++) { + lp = win->alines[i]; + for (sp = lp->line, j = 0; j < win->maxx; j++, sp++) { + sp->attr = 0; +#ifndef HAVE_WCHAR + sp->ch = win->bch; +#else + sp->ch = (wchar_t)btowc((int)win->bch); + sp->nsp = NULL; + if (_cursesi_copy_nsp(win->bnsp, sp) == ERR) + return ERR; + SET_WCOL(*sp, 1); +#endif /* HAVE_WCHAR */ + } + lp->hash = __hash((char *)(void *)lp->line, + (size_t)(ncols * __LDATASIZE)); + } + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "resize: win->wattr = %08x\n", win->wattr); + __CTRACE(__CTRACE_WINDOW, "resize: win->flags = %#.4x\n", win->flags); + __CTRACE(__CTRACE_WINDOW, "resize: win->maxy = %d\n", win->maxy); + __CTRACE(__CTRACE_WINDOW, "resize: win->maxx = %d\n", win->maxx); + __CTRACE(__CTRACE_WINDOW, "resize: win->begy = %d\n", win->begy); + __CTRACE(__CTRACE_WINDOW, "resize: win->begx = %d\n", win->begx); + __CTRACE(__CTRACE_WINDOW, "resize: win->scr_t = %d\n", win->scr_t); + __CTRACE(__CTRACE_WINDOW, "resize: win->scr_b = %d\n", win->scr_b); +#endif + + if (win->orig == NULL) { + /* bound subwindows to new size and fixup their pointers */ + for (swin = win->nextp; swin != win; swin = swin->nextp) { + y = swin->reqy; + if (swin->begy > win->begy + win->maxy) + swin->begy = win->begy + win->maxy - 1; + if (swin->begy + y > win->begy + win->maxy) + y = 0; + if (y <= 0) + y += win->begy + win->maxy - swin->begy; + if (y < 1) + y = 1; + x = swin->reqx; + if (swin->begx > win->begx + win->maxx) + swin->begx = win->begx + win->maxx - 1; + if (swin->begx + x > win->begx + win->maxx) + x = 0; + if (x <= 0) + x += win->begy + win->maxx - swin->begx; + if (x < 1) + x = 1; + __resizewin(swin, y, x); + } + } + + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/resize_term.3 b/vendor/netbsd-curses/libcurses/resize_term.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/resize_term.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/resizeterm.3 b/vendor/netbsd-curses/libcurses/resizeterm.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/resizeterm.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/ripoffline.3 b/vendor/netbsd-curses/libcurses/ripoffline.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/ripoffline.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/ripoffline.c b/vendor/netbsd-curses/libcurses/ripoffline.c new file mode 100644 index 0000000..2762c20 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/ripoffline.c @@ -0,0 +1,196 @@ +/* $NetBSD: ripoffline.c,v 1.5 2018/10/03 13:22:29 roy Exp $ */ + +/*- + * Copyright (c) 2017 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* List of ripoffline calls */ +static struct ripoff { + int nlines; + int (*init)(WINDOW *, int); +} ripoffs[MAX_RIPS]; +static int nrips; + +/* + * ripoffline -- + * Ripoff a line from the top of bottom of stdscr. + * Must be called before initscr or newterm. + */ +int +ripoffline(int line, int (*init)(WINDOW *, int)) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "ripoffline: %d\n", line); +#endif + + if (nrips >= MAX_RIPS || init == NULL) + return ERR; /* This makes sense, but not standards compliant. */ + if (line == 0) + return OK; + ripoffs[nrips].nlines = line < 0 ? -1 : 1; + ripoffs[nrips++].init = init; + return OK; +} + +/* + * __rippedlines -- + * Returns the number of ripped lines from the screen. + */ +int +__rippedlines(const SCREEN *screen, int line) +{ + const struct __ripoff *rip; + int i, n; + + n = 0; + for (i = 0, rip = screen->ripped; i < screen->nripped; i++, rip++) { + if (line < 1 && rip->nlines < 0) + n += -rip->nlines; + else if (line > 0 && rip->nlines > 0) + n += rip->nlines; + } + return n; +} + +/* + * __ripoffscreen -- + * Rips lines from the screen by creating a WINDOW per ripoffline call. + * Although the POSIX API only allows for one line WINDOWS to be created, + * this implemenation allows for N lines if needed. + */ +int +__ripoffscreen(SCREEN *screen) +{ + int i, nlines, rbot, rtop; + const struct ripoff *srip; + struct __ripoff *rip; + WINDOW *w; + + rip = screen->ripped; + rbot = LINES; + rtop = 0; + for (i = 0, srip = ripoffs; i < nrips; i++, srip++) { + if (srip->nlines == 0) + continue; + nlines = srip->nlines < 0 ? -srip->nlines : srip->nlines; + w = __newwin(screen, nlines, 0, + srip->nlines < 0 ? rbot - nlines : rtop, + 0, FALSE, FALSE); + if (w != NULL) { + rip->win = w; + rip->nlines = srip->nlines; + rip++; + screen->nripped++; + if (srip->nlines > 0) + rtop += nlines; + else + rbot -= nlines; + } + if (srip->init(w, COLS) == ERR) + return ERR; +#ifdef DEBUG + if (w != NULL) + __CTRACE(__CTRACE_WINDOW, + "newterm: %p ripped %d line(s) from the %s\n", + w, nlines, srip->nlines < 0 ? "bottom" : "top"); +#endif + } + nrips = 0; /* Reset the stack. */ + return OK; +} + +/* + * __ripoffresize -- + * Called from resizeterm to ensure the ripped off lines are correctly + * placed and refreshed. + */ +int +__ripoffresize(SCREEN *screen) +{ + int rbot = screen->LINES, i, nlines, ret = OK; + struct __ripoff *rip; + + for (i = 0, rip = screen->ripped; i < screen->nripped; i++, rip++) { + if (rip->nlines == 0) + continue; + nlines = rip->nlines < 0 ? -rip->nlines : rip->nlines; + if (wresize(rip->win, nlines, screen->COLS) == ERR) + ret = ERR; + if (rip->nlines < 0) { + /* Reposition the lower windows. */ + if (mvwin(rip->win, rbot + rip->nlines, 0) == ERR) + ret = ERR; + else + rbot += rip->nlines; + } + } + + return ret; +} + +/* + * __ripofftouch -- + * Displays the ripped off lines from initscr. + */ +void +__ripofftouch(SCREEN *screen) +{ + int i; + struct __ripoff *rip; + + for (i = 0, rip = screen->ripped; i < screen->nripped; i++, rip++) { + touchwin(rip->win); + wnoutrefresh(rip->win); + } +} + +/* + * __unripoffline -- + * Used by __slk_init to remove the ripoffline reservation it made + * because the terminal natively supports soft label keys. + */ +int +__unripoffline(int (*init)(WINDOW *, int)) +{ + struct ripoff *rip; + int i, unripped = 0; + + for (i = 0, rip = ripoffs; i < nrips; i++, rip++) { + if (rip->init == init) { + rip->nlines = 0; + unripped++; + } + } + return unripped; +} diff --git a/vendor/netbsd-curses/libcurses/savetty.3 b/vendor/netbsd-curses/libcurses/savetty.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/savetty.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/scanw.3 b/vendor/netbsd-curses/libcurses/scanw.3 new file mode 120000 index 0000000..ce3be5d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/scanw.3 @@ -0,0 +1 @@ +curses_scanw.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/scanw.c b/vendor/netbsd-curses/libcurses/scanw.c new file mode 100644 index 0000000..352cc57 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/scanw.c @@ -0,0 +1,125 @@ +/* $NetBSD: scanw.c,v 1.23 2019/06/30 22:16:20 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define _XOPEN_SOURCE 700 +#include + +/* + * scanw and friends. + */ + +#include + +#include "curses.h" + +/* + * scanw -- + * Implement a scanf on the standard screen. + */ +int +scanw(const char *fmt,...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vw_scanw(stdscr, fmt, ap); + va_end(ap); + return ret; +} +/* + * wscanw -- + * Implements a scanf on the given window. + */ +int +wscanw(WINDOW *win, const char *fmt,...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vw_scanw(win, fmt, ap); + va_end(ap); + return ret; +} +/* + * mvscanw, mvwscanw -- + * Implement the mvscanw commands. Due to the variable number of + * arguments, they cannot be macros. Another sigh.... + */ +int +mvscanw(int y, int x, const char *fmt,...) +{ + va_list ap; + int ret; + + if (move(y, x) != OK) + return ERR; + va_start(ap, fmt); + ret = vw_scanw(stdscr, fmt, ap); + va_end(ap); + return ret; +} + +int +mvwscanw(WINDOW * win, int y, int x, const char *fmt,...) +{ + va_list ap; + int ret; + + if (move(y, x) != OK) + return ERR; + va_start(ap, fmt); + ret = vw_scanw(win, fmt, ap); + va_end(ap); + return ret; +} +/* + * vwscanw -- + * This routine actually executes the scanf from the window. + */ +int +vw_scanw(WINDOW *win, const char *fmt, va_list ap) +{ + char buf[1024]; + int ret; + + ret = ERR; + if (wgetnstr(win, buf, (int) sizeof(buf)) == OK) { + if (vsscanf(buf, fmt, ap) > 0) { + ret = OK; + } + } + + return ret; +} + +__strong_alias(vwscanw, vw_scanw) diff --git a/vendor/netbsd-curses/libcurses/screen.c b/vendor/netbsd-curses/libcurses/screen.c new file mode 100644 index 0000000..9c9e70f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/screen.c @@ -0,0 +1,285 @@ +/* $NetBSD: screen.c,v 1.35 2018/11/16 10:12:00 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include "curses.h" +#include "curses_private.h" + +static int filtered; + +static void __delscreen(SCREEN *); + +/* + * filter has to be called before either initscr or newterm. + */ +void +filter(void) +{ + + filtered = TRUE; +} + +/* + * set_term -- + * Change the term to the given screen. + * + */ +SCREEN * +set_term(SCREEN *new) +{ + SCREEN *old_screen = _cursesi_screen; + + if (_cursesi_screen != NULL) { + /* save changes made to the current screen... */ + old_screen->echoit = __echoit; + old_screen->pfast = __pfast; + old_screen->rawmode = __rawmode; + old_screen->noqch = __noqch; + old_screen->COLS = COLS; + old_screen->LINES = LINES; + old_screen->ESCDELAY = ESCDELAY; + old_screen->TABSIZE = TABSIZE; + old_screen->COLORS = COLORS; + old_screen->COLOR_PAIRS = COLOR_PAIRS; + old_screen->GT = __GT; + old_screen->NONL = __NONL; + old_screen->UPPERCASE = __UPPERCASE; + } + + _cursesi_screen = new; + + __echoit = new->echoit; + __pfast = new->pfast; + __rawmode = new->rawmode; + __noqch = new->noqch; + COLS = new->COLS; + LINES = new->LINES; + ESCDELAY = new->ESCDELAY; + TABSIZE = new->TABSIZE; + COLORS = new->COLORS; + COLOR_PAIRS = new->COLOR_PAIRS; + __GT = new->GT; + __NONL = new->NONL; + __UPPERCASE = new->UPPERCASE; + + _cursesi_resetterm(new); + + curscr = new->curscr; + clearok(curscr, new->clearok); + stdscr = new->stdscr; + __virtscr = new->__virtscr; + + _cursesi_reset_acs(new); +#ifdef HAVE_WCHAR + _cursesi_reset_wacs(new); +#endif /* HAVE_WCHAR */ + +#ifdef DEBUG + __CTRACE(__CTRACE_SCREEN, "set_term: LINES = %d, COLS = %d\n", + LINES, COLS); +#endif + + return old_screen; +} + +/* + * newterm -- + * Set up a new screen. + * + */ +SCREEN * +newterm(char *type, FILE *outfd, FILE *infd) +{ + SCREEN *new_screen; + char *sp; + + sp = type; + if (type == NULL && (sp = getenv("TERM")) == NULL) + return NULL; + + if ((new_screen = calloc(1, sizeof(SCREEN))) == NULL) + return NULL; + +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, "newterm\n"); +#endif + + new_screen->infd = infd; + /* + * POSIX standard says this should be set to infd by default, + * but this seems to break nvi by leaving an unrefreshed screen. + * Also, the line breakout optimisation advertised in ncurses + * doesn't actually do anything, so explicitly disabling it here makes + * sense for the time being. + * A caller can always enable it by calling typeahead(3) anyway. + */ + new_screen->checkfd = -1; // fileno(infd); + new_screen->outfd = outfd; + new_screen->echoit = new_screen->nl = 1; + new_screen->pfast = new_screen->rawmode = new_screen->noqch = 0; + new_screen->filtered = filtered; + filtered = FALSE; /* filter() must preceed each newterm() */ + new_screen->nca = A_NORMAL; + new_screen->color_type = COLOR_NONE; + new_screen->COLOR_PAIRS = 0; + new_screen->old_mode = 2; + new_screen->stdbuf = NULL; + new_screen->stdscr = NULL; + new_screen->curscr = NULL; + new_screen->__virtscr = NULL; + new_screen->curwin = 0; + new_screen->notty = FALSE; + new_screen->resized = 0; + new_screen->unget_len = 32; + + if ((new_screen->unget_list = + malloc(sizeof(wchar_t) * new_screen->unget_len)) == NULL) + { + goto error_exit; + } + new_screen->unget_pos = 0; + + if (_cursesi_gettmode(new_screen) == ERR) + goto error_exit; + + if (_cursesi_setterm((char *)sp, new_screen) == ERR) + goto error_exit; + + /* Need either homing or cursor motion for refreshes */ + if (!t_cursor_home(new_screen->term) && + !t_cursor_address(new_screen->term)) + goto error_exit; + + new_screen->winlistp = NULL; + + if ((new_screen->curscr = __newwin(new_screen, 0, + 0, 0, 0, FALSE, FALSE)) == NULL) + goto error_exit; + + if ((new_screen->__virtscr = __newwin(new_screen, 0, + 0, 0, 0, FALSE, FALSE)) == NULL) + goto error_exit; + + /* If Soft Label Keys are setup, they will ripoffline. */ + if (__slk_init(new_screen) == ERR) + goto error_exit; + + if (__ripoffscreen(new_screen) == ERR) + goto error_exit; + + new_screen->stdscr = __newwin(new_screen, 0, 0, 0, 0, FALSE, TRUE); + if (new_screen->stdscr == NULL) + goto error_exit; + + clearok(new_screen->stdscr, 1); + + __init_getch(new_screen); + __init_acs(new_screen); +#ifdef HAVE_WCHAR + __init_get_wch(new_screen); + __init_wacs(new_screen); +#endif /* HAVE_WCHAR */ + + __set_stophandler(); + __set_winchhandler(); + + /* + * bleh - it seems that apps expect the first newterm to set + * up the curses screen.... emulate this. + */ + if (_cursesi_screen == NULL || _cursesi_screen->endwin) { + set_term(new_screen); + } + +#ifdef DEBUG + __CTRACE(__CTRACE_SCREEN, "newterm: LINES = %d, COLS = %d\n", + LINES, COLS); +#endif + __startwin(new_screen); + + return new_screen; + + error_exit: + __delscreen(new_screen); + free(new_screen->unget_list); + + free(new_screen); + return NULL; +} + +/* + * delscreen -- + * Free resources used by the given screen and destroy it. + * + */ +void +delscreen(SCREEN *screen) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_SCREEN, "delscreen(%p)\n", screen); +#endif + + __delscreen(screen); + + /* free the storage of the keymaps */ + _cursesi_free_keymap(screen->base_keymap); + + /* free the Soft Label Keys */ + __slk_free(screen); + + free(screen->stdbuf); + free(screen->unget_list); + if (_cursesi_screen == screen) + _cursesi_screen = NULL; + free(screen); +} + +static void +__delscreen(SCREEN *screen) +{ + struct __winlist *list; + + /* free up the terminfo stuff */ + if (screen->term != NULL) + del_curterm(screen->term); + + /* walk the window list and kill all the parent windows */ + while ((list = screen->winlistp) != NULL) { + delwin(list->winp); + if (list == screen->winlistp) + /* sanity - abort if window didn't remove itself */ + break; + } +} diff --git a/vendor/netbsd-curses/libcurses/scrl.3 b/vendor/netbsd-curses/libcurses/scrl.3 new file mode 120000 index 0000000..087dafb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/scrl.3 @@ -0,0 +1 @@ +curses_scroll.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/scroll.3 b/vendor/netbsd-curses/libcurses/scroll.3 new file mode 120000 index 0000000..087dafb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/scroll.3 @@ -0,0 +1 @@ +curses_scroll.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/scroll.c b/vendor/netbsd-curses/libcurses/scroll.c new file mode 100644 index 0000000..258460e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/scroll.c @@ -0,0 +1,150 @@ +/* $NetBSD: scroll.c,v 1.26 2019/06/09 07:40:14 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * scroll -- + * Scroll the window up a line. + */ +int +scroll(WINDOW *win) +{ + + return wscrl(win, 1); +} + +#ifndef _CURSES_USE_MACROS + +/* + * scrl -- + * Scroll stdscr n lines - up if n is positive, down if n is negative. + */ +int +scrl(int nlines) +{ + + return wscrl(stdscr, nlines); +} + +/* + * setscrreg -- + * Set the top and bottom of the scrolling region for stdscr. + */ +int +setscrreg(int top, int bottom) +{ + + return wsetscrreg(stdscr, top, bottom); +} + +#endif + +/* + * wscrl -- + * Scroll a window n lines - up if n is positive, down if n is negative. + */ +int +wscrl(WINDOW *win, int nlines) +{ + int oy, ox; + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "wscrl: (%p) lines=%d\n", win, nlines); +#endif + + if (!(win->flags & __SCROLLOK)) + return ERR; + if (!nlines) + return OK; + + getyx(win, oy, ox); +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "wscrl: y=%d\n", oy); +#endif + wmove(win, win->scr_t, 1); + winsdelln(win, 0 - nlines); + wmove(win, oy, ox); + + if (win == curscr) { + __cputchar('\n'); + if (!__NONL) + win->curx = 0; +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "scroll: win == curscr\n"); +#endif + } + return OK; +} + +/* + * wsetscrreg -- + * Set the top and bottom of the scrolling region for win. + */ +int +wsetscrreg(WINDOW *win, int top, int bottom) +{ + if (top < 0 || bottom >= win->maxy || bottom - top < 1) + return ERR; + win->scr_t = top; + win->scr_b = bottom; + return OK; +} + +/* + * has_ic -- + * Does the terminal have insert- and delete-character? + */ +bool +has_ic(void) +{ + + if (insert_character != NULL && delete_character != NULL) + return true; + else + return false; +} + +/* + * has_ic -- + * Does the terminal have insert- and delete-line? + */ +bool +has_il(void) +{ + if (insert_line !=NULL && delete_line != NULL) + return true; + else + return false; +} diff --git a/vendor/netbsd-curses/libcurses/scrollok.3 b/vendor/netbsd-curses/libcurses/scrollok.3 new file mode 120000 index 0000000..087dafb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/scrollok.3 @@ -0,0 +1 @@ +curses_scroll.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/scrollok.c b/vendor/netbsd-curses/libcurses/scrollok.c new file mode 100644 index 0000000..bbb458c --- /dev/null +++ b/vendor/netbsd-curses/libcurses/scrollok.c @@ -0,0 +1,50 @@ +/* $NetBSD: scrollok.c,v 1.6 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * scrollok -- + * Turn on and off scrolling for the given window. + */ +int +scrollok(WINDOW *win, bool bf) +{ + + if (bf) + win->flags |= __SCROLLOK; + else + win->flags &= ~__SCROLLOK; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/set_escdelay.3 b/vendor/netbsd-curses/libcurses/set_escdelay.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/set_escdelay.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/set_tabsize.3 b/vendor/netbsd-curses/libcurses/set_tabsize.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/set_tabsize.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/set_term.3 b/vendor/netbsd-curses/libcurses/set_term.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/set_term.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/setcchar.3 b/vendor/netbsd-curses/libcurses/setcchar.3 new file mode 120000 index 0000000..5372b4f --- /dev/null +++ b/vendor/netbsd-curses/libcurses/setcchar.3 @@ -0,0 +1 @@ +curses_cchar.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/setscrreg.3 b/vendor/netbsd-curses/libcurses/setscrreg.3 new file mode 120000 index 0000000..087dafb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/setscrreg.3 @@ -0,0 +1 @@ +curses_scroll.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/setsyx.3 b/vendor/netbsd-curses/libcurses/setsyx.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/setsyx.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/setterm.3 b/vendor/netbsd-curses/libcurses/setterm.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/setterm.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/setterm.c b/vendor/netbsd-curses/libcurses/setterm.c new file mode 100644 index 0000000..5ba4735 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/setterm.c @@ -0,0 +1,408 @@ +/* $NetBSD: setterm.c,v 1.68 2018/10/26 22:22:24 uwe Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include + +#include "curses.h" +#include "curses_private.h" + +static int does_esc_m(const char *cap); +static int does_ctrl_o(const char *exit_cap, const char *acs_cap); + +attr_t __mask_op, __mask_me, __mask_ue, __mask_se; + +int +setterm(char *type) +{ + + return _cursesi_setterm(type, _cursesi_screen); +} + +int +_cursesi_setterm(char *type, SCREEN *screen) +{ + int unknown, r; + char *p; + + if (type[0] == '\0') + type = "xx"; + unknown = 0; + if (screen->term) + del_curterm(screen->term); + (void)ti_setupterm(&screen->term, type, fileno(screen->outfd), &r); + if (screen->term == NULL) { + unknown++; + (void)ti_setupterm(&screen->term, "dumb", + fileno(screen->outfd), &r); + /* No dumb term? We can't continue */ + if (screen->term == NULL) + return ERR; + } +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, "setterm: tty = %s\n", type); +#endif + + /* lines and cols will have been setup correctly by ti_setupterm(3). */ + screen->LINES = t_lines(screen->term); + screen->COLS = t_columns(screen->term); + + if (screen->filtered) { + /* Disable use of clear, cud, cud1, cup, cuu1 and vpa. */ + screen->term->strs[TICODE_clear] = NULL; + screen->term->strs[TICODE_cud] = NULL; + screen->term->strs[TICODE_cud1] = NULL; + screen->term->strs[TICODE_cup] = NULL; + screen->term->strs[TICODE_cuu] = NULL; + screen->term->strs[TICODE_cuu1] = NULL; + screen->term->strs[TICODE_vpa] = NULL; + /* Set the value of the home string to the value of + * the cr string. */ + screen->term->strs[TICODE_home] = screen->term->strs[TICODE_cr]; + /* Set lines equal to 1. */ + screen->LINES = 1; + t_lines(screen->term) = 1; + } +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, "setterm: filtered %d", screen->filtered); +#endif + + if ((p = getenv("ESCDELAY")) != NULL) + screen->ESCDELAY = (int)strtol(p, NULL, 0); + else + screen->ESCDELAY = ESCDELAY_DEFAULT; + if ((p = getenv("TABSIZE")) != NULL) + screen->TABSIZE = (int)strtol(p, NULL, 0); + else if (t_init_tabs(screen->term) >= 0) + screen->TABSIZE = (int)t_init_tabs(screen->term); + else + screen->TABSIZE = TABSIZE_DEFAULT; + /* + * Want cols > 4, otherwise things will fail. + */ + if (screen->COLS <= 4) + return ERR; + + LINES = screen->LINES; + COLS = screen->COLS; + ESCDELAY = screen->ESCDELAY; + TABSIZE = screen->TABSIZE; + +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, + "setterm: LINES = %d, COLS = %d, TABSIZE = %d\n", + LINES, COLS, TABSIZE); +#endif + + /* + * set the pad char, only take the first char of the pc capability + * as this is all we can use. + */ + screen->padchar = t_pad_char(screen->term) ? + t_pad_char(screen->term)[0] : 0; + + /* If no scrolling commands, no quick change. */ + screen->noqch = + (t_change_scroll_region(screen->term) == NULL || + t_cursor_home(screen->term) == NULL || + (t_parm_index(screen->term) == NULL && + t_scroll_forward(screen->term) == NULL) || + (t_parm_rindex(screen->term) == NULL && + t_scroll_reverse(screen->term) == NULL)) && + ((t_parm_insert_line(screen->term) == NULL && + t_insert_line(screen->term) == NULL) || + (t_parm_delete_line(screen->term) == NULL && + t_delete_line(screen->term) == NULL)); + + /* + * Precalculate conflict info for color/attribute end commands. + */ +#ifndef HAVE_WCHAR + screen->mask_op = __ATTRIBUTES & ~__COLOR; +#else + screen->mask_op = WA_ATTRIBUTES & ~__COLOR; +#endif /* HAVE_WCHAR */ + + const char *t_op = t_orig_pair(screen->term); + const char *t_esm = t_exit_standout_mode(screen->term); + const char *t_eum = t_exit_underline_mode(screen->term); + const char *t_eam = t_exit_attribute_mode(screen->term); + + if (t_op != NULL) { + if (does_esc_m(t_op)) + screen->mask_op &= + ~(__STANDOUT | __UNDERSCORE | __TERMATTR); + else { + if (t_esm != NULL && !strcmp(t_op, t_esm)) + screen->mask_op &= ~__STANDOUT; + + if (t_eum != NULL && !strcmp(t_op, t_eum)) + screen->mask_op &= ~__UNDERSCORE; + + if (t_eam != NULL && !strcmp(t_op, t_eam)) + screen->mask_op &= ~__TERMATTR; + } + } + /* + * Assume that "me" turns off all attributes apart from ACS. + * It might turn off ACS, so check for that. + */ + if (t_exit_attribute_mode(screen->term) != NULL && + t_exit_alt_charset_mode(screen->term) != NULL && + does_ctrl_o(t_exit_attribute_mode(screen->term), + t_exit_alt_charset_mode(screen->term))) + screen->mask_me = 0; + else + screen->mask_me = __ALTCHARSET; + + /* Check what turning off the attributes also turns off */ +#ifndef HAVE_WCHAR + screen->mask_ue = __ATTRIBUTES & ~__UNDERSCORE; +#else + screen->mask_ue = WA_ATTRIBUTES & ~__UNDERSCORE; +#endif /* HAVE_WCHAR */ + if (t_eum != NULL) { + if (does_esc_m(t_eum)) + screen->mask_ue &= + ~(__STANDOUT | __TERMATTR | __COLOR); + else { + if (t_esm && !strcmp(t_eum, t_esm)) + screen->mask_ue &= ~__STANDOUT; + + if (t_eam != NULL && !strcmp(t_eum, t_eam)) + screen->mask_ue &= ~__TERMATTR; + + if (t_op != NULL && !strcmp(t_eum, t_op)) + screen->mask_ue &= ~__COLOR; + } + } +#ifndef HAVE_WCHAR + screen->mask_se = __ATTRIBUTES & ~__STANDOUT; +#else + screen->mask_se = WA_ATTRIBUTES & ~__STANDOUT; +#endif /* HAVE_WCHAR */ + if (t_esm != NULL) { + if (does_esc_m(t_esm)) + screen->mask_se &= + ~(__UNDERSCORE | __TERMATTR | __COLOR); + else { + if (t_eum != NULL && !strcmp(t_esm, t_eum)) + screen->mask_se &= ~__UNDERSCORE; + + if (t_eam != NULL && !strcmp(t_esm, t_eam)) + screen->mask_se &= ~__TERMATTR; + + if (t_op != NULL && !strcmp(t_esm, t_op)) + screen->mask_se &= ~__COLOR; + } + } + + return unknown ? ERR : OK; +} + +/* + * _cursesi_resetterm -- + * Copy the terminal instance data for the given screen to the global + * variables. + */ +void +_cursesi_resetterm(SCREEN *screen) +{ + + LINES = screen->LINES; + COLS = screen->COLS; + ESCDELAY = screen->ESCDELAY; + TABSIZE = screen->TABSIZE; + __GT = screen->GT; + + __noqch = screen->noqch; + __mask_op = screen->mask_op; + __mask_me = screen->mask_me; + __mask_ue = screen->mask_ue; + __mask_se = screen->mask_se; + + set_curterm(screen->term); +} + +/* + * does_esc_m -- + * A hack for xterm-like terminals where "\E[m" or "\E[0m" will turn off + * other attributes, so we check for this in the capability passed to us. + * Note that we can't just do simple string comparison, as the capability + * may contain multiple, ';' separated sequence parts. + */ +static int +does_esc_m(const char *cap) +{ +#define WAITING 0 +#define PARSING 1 +#define NUMBER 2 +#define FOUND 4 + const char *capptr; + int seq; + +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, "does_esc_m: Checking %s\n", cap); +#endif + /* Is it just "\E[m" or "\E[0m"? */ + if (!strcmp(cap, "\x1b[m") || !strcmp(cap, "\x1b[0m")) + return 1; + + /* Does it contain a "\E[...m" sequence? */ + if (strlen(cap) < 4) + return 0; + capptr = cap; + seq = WAITING; + while (*capptr != 0) { + switch (seq) { + /* Start of sequence */ + case WAITING: + if (!strncmp(capptr, "\x1b[", 2)) { + capptr+=2; + if (*capptr == 'm') + return 1; + else { + seq=PARSING; + continue; + } + } + break; + /* Looking for '0' */ + case PARSING: + if (*capptr == '0') + seq=FOUND; + else if (*capptr > '0' && *capptr <= '9') + seq=NUMBER; + else if (*capptr != ';') + seq=WAITING; + break; + /* Some other number */ + case NUMBER: + if (*capptr == ';') + seq=PARSING; + else if (!(*capptr >= '0' && *capptr <= '9')) + seq=WAITING; + break; + /* Found a '0' */ + case FOUND: + if (*capptr == 'm') + return 1; + else if (!((*capptr >= '0' && *capptr <= '9') || + *capptr == ';')) + seq=WAITING; + break; + default: + break; + } + capptr++; + } + return 0; +} + +/* + * capdup_nodelay -- + * A helper for does_ctrl_o below that creates a copy of the given + * capability with delay specifications dropped. + */ +static char * +capdup_nodelay(const char *src) +{ + char *clean, *dst; + + dst = clean = malloc(strlen(src) + 1); + if (__predict_false(clean == NULL)) + return NULL; + + while (*src != '\0') { + if (src[0] == '$' && src[1] == '<') { + const char *end = strchr(src + 2, '>'); + if (__predict_true(end != NULL)) { + src = end + 1; + continue; + } + } + *dst++ = *src++; + } + + *dst = '\0'; + return clean; +} + +/* + * does_ctrl_o -- + * A hack for vt100/xterm-like terminals where the "me" capability also + * unsets acs. + */ +static int +does_ctrl_o(const char *exit_cap, const char *acs_cap) +{ + char *eptr, *aptr; + int res; + +#ifdef DEBUG + __CTRACE(__CTRACE_INIT, "does_ctrl_o: Testing %s for %s\n", exit_cap, acs_cap); +#endif + + eptr = capdup_nodelay(exit_cap); + if (__predict_false(eptr == NULL)) + return 0; + + aptr = capdup_nodelay(acs_cap); + if (__predict_false(aptr == NULL)) { + free(eptr); + return 0; + } + + res = strstr(eptr, aptr) != NULL; + + free(eptr); + free(aptr); + return res; +} + +/* + * set_tabsize -- + * Sets the tabsize for the current screen. + */ +int +set_tabsize(int tabsize) +{ + + if (_cursesi_screen == NULL) + return ERR; + _cursesi_screen->TABSIZE = tabsize; + TABSIZE = tabsize; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/shlib_version b/vendor/netbsd-curses/libcurses/shlib_version new file mode 100644 index 0000000..140f6cb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/shlib_version @@ -0,0 +1,8 @@ +# $NetBSD: shlib_version,v 1.43 2018/11/16 10:12:00 blymn Exp $ +# Remember to update distrib/sets/lists/base/shl.* when changing +# Remember to run `make fileio.h` when changing +# Remember to increment the major numbers of libform, libmenu and +# libpanel when the libcurses major number increments. +# +major=7 +minor=2 diff --git a/vendor/netbsd-curses/libcurses/slk.c b/vendor/netbsd-curses/libcurses/slk.c new file mode 100644 index 0000000..4d602ee --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk.c @@ -0,0 +1,836 @@ +/* $NetBSD: slk.c,v 1.8 2019/07/28 00:51:59 uwe Exp $ */ + +/*- + * Copyright (c) 2017 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#undef _XOPEN_SOURCE +#define _XOPEN_SOURCE 700 +#undef _GNU_SOURCE +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#ifdef HAVE_WCHAR +#include +#endif + +#include "curses.h" +#include "curses_private.h" + +/* Terminals with real soft labels have NOT been tested. + * If you have such a device, please let us know so this comment + * can be adjusted. */ + +/* POSIX says that each label can be up to 8 columns. + * However, our implementation can allow labels to expand beyond that. */ +//#define SLK_SIZE_DYNAMIC +#ifdef SLK_SIZE_DYNAMIC +#define SLK_SIZE MAX_SLK_LABEL +#else +#define SLK_SIZE MAX_SLK_COLS +#endif + +static int slk_fmt = SLK_FMT_INVAL; /* fmt of slk_init */ + +/* Safe variants of public functions. */ +static int __slk_attroff(SCREEN *, const chtype); +static int __slk_attron(SCREEN *, const chtype); +static int __slk_attrset(SCREEN *, const chtype); +#ifdef HAVE_WCHAR +static int __slk_attr_off(SCREEN *, const attr_t, void *); +static int __slk_attr_on(SCREEN *, const attr_t, void *); +static int __slk_attr_set(SCREEN *, const attr_t, short, void *opt); +static int __slk_color(SCREEN *, short); +#endif + +static int __slk_clear(SCREEN *); +static char *__slk_label(SCREEN *, int); +static int __slk_restore(SCREEN *); +static int __slk_set(SCREEN *, int, const char *, int); +static int __slk_touch(SCREEN *); +#ifdef HAVE_WCHAR +static int __slk_wset(SCREEN *, int, const wchar_t *, int); +#endif + +/* Internal engine parts. */ +static int __slk_ripoffline(WINDOW *, int); +static int __slk_set_finalise(SCREEN *, int); +static int __slk_draw(SCREEN *, int); +static int __slk_redraw(SCREEN *); + +/* + * slk_init -- + * Init Soft Label Keys. + */ +int +slk_init(int fmt) +{ + + switch(fmt) { + case SLK_FMT_3_2_3: + case SLK_FMT_4_4: + break; + default: + return ERR; + } + + slk_fmt = fmt; + /* Even if the terminal supports soft label keys directly, + * we need to reserve a line. */ + return ripoffline(-1, __slk_ripoffline); +} + +/* + * slk_attron -- + * Test and set attributes on ripped off slk window. + */ +int +slk_attron(const chtype attr) +{ + + return __slk_attron(_cursesi_screen, attr); +} + +#ifdef HAVE_WCHAR +/* + * slk_attr_on -- + * Test and set wide attributes on ripped off slk window. + */ +int +slk_attr_on(const attr_t attr, void *opt) +{ + + return __slk_attr_on(_cursesi_screen, attr, opt); +} +#endif /* HAVE_WCHAR */ + +/* + * slk_attroff -- + * Test and unset attributes on ripped off slk window. + */ +int +slk_attroff(const chtype attr) +{ + + return __slk_attroff(_cursesi_screen, attr); +} + +#ifdef HAVE_WCHAR +/* + * slk_attr_off -- + * Test and unset wide attributes on ripped off slk window. + */ +int +slk_attr_off(const attr_t attr, void *opt) +{ + + return __slk_attr_off(_cursesi_screen, attr, opt); +} +#endif /* HAVE_WCHAR */ + +/* + * slk_attrset -- + * Set attributes and color pair on ripped off slk window. + */ +int +slk_attrset(const chtype attr) +{ + + return __slk_attrset(_cursesi_screen, attr); +} + +#ifdef HAVE_WCHAR +/* + * slk_attr_set -- + * Set wide attributes and color pair on ripped off slk window. + */ +int +slk_attr_set(const attr_t attr, short pair, void *opt) +{ + + return __slk_attr_set(_cursesi_screen, attr, pair, opt); +} +#endif /* HAVE_WCHAR */ + +/* + * slk_clear -- + * Clear slk from the current screen. + */ +int +slk_clear(void) +{ + + return __slk_clear(_cursesi_screen); +} + +#ifdef HAVE_WCHAR +/* + * slk_color -- + * Set color pair on ripped off slk window. + */ +int +slk_color(short pair) +{ + + return __slk_color(_cursesi_screen, pair); +} +#endif /* HAVE_WCHAR */ + +/* + * slk_label -- + * Return a pointer to the saved label for key labnum. + */ +char * +slk_label(int labnum) +{ + + return __slk_label(_cursesi_screen, labnum); +} + +/* + * slk_wnoutrefresh -- + * Add the contents of the ripped off slk window to the virtual window. + */ +int +slk_noutrefresh(void) +{ + + return __slk_noutrefresh(_cursesi_screen); +} + +/* + * slk_refresh -- + * Force a refresh for the ripped off slk window. + */ +int +slk_refresh(void) +{ + + if (slk_noutrefresh() == ERR) + return ERR; + return doupdate(); +} + +/* + * slk_restore -- + * Retore slk to the screen after a slk_clear. + */ +int +slk_restore(void) +{ + + return __slk_restore(_cursesi_screen); +} + +/* + * slk_set -- + * Sets the text of the label specified by labnum + * and how it is displayed. + */ +int +slk_set(int labnum, const char *label, int justify) +{ + + return __slk_set(_cursesi_screen, labnum, label, justify); +} + +/* + * slk_touch -- + * Sets the ripped off slk window as modified. + */ +int +slk_touch(void) +{ + + return __slk_touch(_cursesi_screen); +} + +#ifdef HAVE_WCHAR +/* + * slk_wset -- + * Sets the wide text of the label specified by labnum + * and how it is displayed. + */ +int +slk_wset(int labnum, const wchar_t *label, int justify) +{ + + return __slk_wset(_cursesi_screen, labnum, label, justify); +} +#endif /* HAVE_WCHAR */ + +/* + * __slk_attron -- + * Test and set attributes on ripped off slk window. + */ +static int +__slk_attron(SCREEN *screen, const chtype attr) +{ + + if (screen == NULL || screen->slk_window == NULL) + return ERR; + return wattron(screen->slk_window, attr); +} + +#ifdef HAVE_WCHAR +/* + * __slk_attr_on -- + * Test and set wide attributes on ripped off slk window. + */ +static int +__slk_attr_on(SCREEN *screen, const attr_t attr, void *opt) +{ + + if (screen == NULL || screen->slk_window == NULL) + return ERR; + return wattr_on(screen->slk_window, attr, opt); +} +#endif /* HAVE_WCHAR */ + +/* + * __slk_attroff -- + * Test and unset attributes on ripped off slk window. + */ +static int +__slk_attroff(SCREEN *screen, const chtype attr) +{ + + if (screen == NULL || screen->slk_window == NULL) + return ERR; + return wattroff(screen->slk_window, attr); +} + +#ifdef HAVE_WCHAR +/* + * __slk_attr_off -- + * Test and unset wide attributes on ripped off slk window. + */ +static int +__slk_attr_off(SCREEN *screen, const attr_t attr, void *opt) +{ + + if (screen == NULL || screen->slk_window == NULL) + return ERR; + return wattr_off(screen->slk_window, attr, opt); +} +#endif /* HAVE_WCHAR */ + +/* + * __slk_attrset -- + * Set attributes and color pair on ripped off slk window. + */ +static int +__slk_attrset(SCREEN *screen, const chtype attr) +{ + + if (screen == NULL || screen->slk_window == NULL) + return ERR; + return wattrset(screen->slk_window, attr); +} + +#ifdef HAVE_WCHAR +/* + * __slk_attr_set -- + * Set wide attributes and color pair on ripped off slk window. + */ +static int +__slk_attr_set(SCREEN *screen, const attr_t attr, short pair, void *opt) +{ + + if (screen == NULL || screen->slk_window == NULL) + return ERR; + return wattr_set(screen->slk_window, attr, pair, opt); +} +#endif /* HAVE_WCHAR */ + +/* + * __slk_clear -- + * Clear slk from the current screen. + */ +static int +__slk_clear(SCREEN *screen) +{ + + if (screen == NULL) + return ERR; + screen->slk_hidden = true; + if (screen->is_term_slk) { + if (t_label_off(screen->term) == NULL) + return ERR; + return ti_putp(screen->term, + ti_tiparm(screen->term, t_label_off(screen->term))); + } + if (screen->slk_window == NULL) + return ERR; + werase(screen->slk_window); + return wrefresh(screen->slk_window); +} + +#ifdef HAVE_WCHAR +/* + * __slk_color -- + * Set color pair on ripped off slk window. + */ +static int +__slk_color(SCREEN *screen, short pair) +{ + + if (screen == NULL || screen->slk_window == NULL) + return ERR; + return wcolor_set(screen->slk_window, pair, NULL); +} +#endif /* HAVE_WCHAR */ + +/* + * __slk_label -- + * Return a pointer to the saved label for key labnum. + */ +static char * +__slk_label(SCREEN *screen, int labnum) +{ + + if (screen == NULL || labnum < 1 || labnum > screen->slk_nlabels) + return NULL; + return screen->slk_labels[--labnum].text; +} + +/* + * __slk_wnoutrefresh -- + * Add the contents of the ripped off slk window to the virtual window. + */ +int +__slk_noutrefresh(SCREEN *screen) +{ + + if (screen == NULL || screen->slk_window == NULL) + return ERR; + return wnoutrefresh(screen->slk_window); +} + +/* + * __slk_restore -- + * Retore slk to the screen after a slk_clear. + */ +static int +__slk_restore(SCREEN *screen) +{ + + if (screen == NULL) + return ERR; + screen->slk_hidden = false; + if (screen->is_term_slk) { + if (t_label_on(screen->term) == NULL) + return ERR; + return ti_putp(screen->term, + ti_tiparm(screen->term, t_label_on(screen->term))); + } + if (screen->slk_window == NULL) + return ERR; + if (__slk_redraw(screen) == ERR) + return ERR; + return wrefresh(screen->slk_window); +} + +/* + * __slk_set -- + * Sets the text of the label specified by labnum + * and how it is displayed. + */ +static int +__slk_set(SCREEN *screen, int labnum, const char *label, int justify) +{ + struct __slk_label *l; + const char *end; + size_t len; + char *text; +#ifdef HAVE_WCHAR + wchar_t wc; + size_t wc_len; +#endif + + /* Check args. */ + if (screen == NULL || labnum < 1 || labnum > screen->slk_nlabels) + return ERR; + switch(justify) { + case SLK_JUSTIFY_LEFT: + case SLK_JUSTIFY_CENTER: + case SLK_JUSTIFY_RIGHT: + break; + default: + return ERR; + } + if (label == NULL) + label = ""; + + /* Skip leading whitespace. */ + while(isspace((unsigned char)*label)) + label++; + /* Grab end. */ + end = label; + +#ifdef HAVE_WCHAR + size_t endlen = strlen(end); + while (*end != '\0') { + wc_len = mbrtowc(&wc, end, endlen, &screen->sp); + if ((ssize_t)wc_len < 0) + return ERR; + if (!iswprint((wint_t)wc)) + break; + end += wc_len; + endlen -= wc_len; + } +#else + while(isprint((unsigned char)*end)) + end++; +#endif + len = end - label; + + /* Take a backup, in-case we can grow the label. */ + if ((text = strndup(label, len)) == NULL) + return ERR; + + /* All checks out, assign. */ + l = &screen->slk_labels[--labnum]; /* internal zero based index */ + l->text = text; + l->justify = justify; + + __slk_set_finalise(screen, labnum); + return OK; +} + +/* + * __slk_touch -- + * Sets the ripped off slk window as modified. + */ +static int +__slk_touch(SCREEN *screen) +{ + + if (screen == NULL || screen->slk_window == NULL) + return ERR; + return touchwin(screen->slk_window); +} + + +#ifdef HAVE_WCHAR +/* + * __slk_wset -- + * Sets the wide text of the label specified by labnum + * and how it is displayed. + */ +static int +__slk_wset(SCREEN *screen, int labnum, const wchar_t *label, int justify) +{ + const wchar_t *olabel; + size_t len; + char *str; + int result = ERR; + + if (screen == NULL) + return ERR; + olabel = label; + if ((len = wcsrtombs(NULL, &olabel, 0, &screen->sp)) == -1) + return ERR; + len++; /* We need to store the NULL character. */ + if ((str = malloc(len)) == NULL) + return ERR; + olabel = label; + if (wcsrtombs(str, &olabel, len, &screen->sp) == -1) + goto out; + result = __slk_set(screen, labnum, str, justify); +out: + free(str); + return result; +} +#endif /* HAVE_WCHAR */ + + +/* + * __slk_init -- + * Allocate structures. + */ +int +__slk_init(SCREEN *screen) +{ + + __slk_free(screen); /* safety */ + + screen->slk_format = slk_fmt; + if (slk_fmt == SLK_FMT_INVAL) + return OK; + slk_fmt = SLK_FMT_INVAL; + + switch(screen->slk_format) { + case SLK_FMT_3_2_3: + case SLK_FMT_4_4: + screen->slk_nlabels = 8; + break; + default: /* impossible */ + return ERR; + } + + screen->slk_labels = calloc(screen->slk_nlabels, + sizeof(*screen->slk_labels)); + if (screen->slk_labels == NULL) + return ERR; + + screen->is_term_slk = + t_plab_norm(screen->term) != NULL && + t_num_labels(screen->term) > 0; + if (screen->is_term_slk) { + __unripoffline(__slk_ripoffline); + screen->slk_nlabels = t_num_labels(screen->term); + screen->slk_label_len = t_label_width(screen->term); + /* XXX label_height, label_format? */ + } + + return OK; +} + +/* + * __slk_free -- + * Free allocates resources. + */ +void +__slk_free(SCREEN *screen) +{ + int i; + + if (screen->slk_window != NULL) + delwin(screen->slk_window); + for (i = 0; i < screen->slk_nlabels; i++) + free(screen->slk_labels[i].text); + free(screen->slk_labels); +} + +/* + * __slk_ripoffline -- + * ripoffline callback to accept a WINDOW to create our keys. + */ +static int +__slk_ripoffline(WINDOW *window, int cols) +{ + + if (window == NULL) + return ERR; + window->screen->slk_window = window; + wattron(window, + (t_no_color_video(window->screen->term) & 1) == 0 + ? A_STANDOUT : A_REVERSE); + __slk_resize(window->screen, cols); + return OK; +} + +/* + * __slk_resize -- + * Size and position the labels in the ripped off slk window. + */ +int +__slk_resize(SCREEN *screen, int cols) +{ + int x = 0; + struct __slk_label *l; + + if (screen == NULL) + return ERR; + if (screen->is_term_slk || screen->slk_nlabels == 0) + return OK; + + screen->slk_label_len = (cols / screen->slk_nlabels) - 1; + if (screen->slk_label_len > SLK_SIZE) + screen->slk_label_len = SLK_SIZE; + + l = screen->slk_labels; + + switch(screen->slk_format) { + case SLK_FMT_3_2_3: + /* Left 3 */ + (l++)->x = x; + (l++)->x = (x += screen->slk_label_len + 1); + (l++)->x = (x += screen->slk_label_len + 1); + + /* Middle 2 */ + x = cols / 2; + (l++)->x = x -(screen->slk_label_len + 1); + (l++)->x = x + 1; + + /* Right 3 */ + x = (cols - ((screen->slk_label_len + 1) * 3)) + 1; + (l++)->x = x; + (l++)->x = (x += screen->slk_label_len + 1); + (l++)->x = (x += screen->slk_label_len + 1); + break; + + case SLK_FMT_4_4: + { + int i, half; + + half = screen->slk_nlabels / 2; + for (i = 0; i < screen->slk_nlabels; i++) { + (l++)->x = x; + x += screen->slk_label_len; + /* Split labels in half */ + if (i == half - 1) + x = cols - (screen->slk_label_len * half) + 1; + } + break; + } + } + + /* Write text to the labels. */ + for (x = 0; x < screen->slk_nlabels; x++) + __slk_set_finalise(screen, x); + + return __slk_redraw(screen); +} + +/* + * __slk_set_finalise -- + * Does the grunt work of positioning and sizing the text in the label. + */ +static int +__slk_set_finalise(SCREEN *screen, int labnum) +{ + struct __slk_label *l; + size_t spc, len, width, x; + char *p; + + l = &screen->slk_labels[labnum]; + spc = screen->slk_label_len; + +#ifdef HAVE_WCHAR + len = 0; + width = 0; + if (l->text != NULL) { + size_t plen; + + p = l->text; + plen = strlen(l->text); + while (*p != '\0') { + size_t mblen; + wchar_t wc; + int w; + + mblen = mbrtowc(&wc, p, plen, &screen->sp); + if ((ssize_t)mblen < 0) + return ERR; + w = wcwidth(wc); + if (width + w > spc) + break; + width += w; + len += mblen; + p += mblen; + plen -= mblen; + } + } +#else + len = l->text == NULL ? 0 : strlen(l->text); + if (len > spc) + len = spc; + width = len; +#endif + + switch(l->justify) { + case SLK_JUSTIFY_LEFT: + x = 0; + break; + case SLK_JUSTIFY_CENTER: + x = (spc - width) / 2; + if (x + width > spc) + x--; + break; + case SLK_JUSTIFY_RIGHT: + x = spc - width; + break; + default: + return ERR; /* impossible */ + } + + p = l->label; + if (x != 0) { + memset(p, ' ', x); + p += x; + spc -= x; + } + if (len != 0) { + memcpy(p, l->text, len); + p += len; + spc -= width; + } + if (spc != 0) { + memset(p, ' ', spc); + p += spc; + } + *p = '\0'; /* Terminate for plab_norm. */ + + return __slk_draw(screen, labnum); +} + +/* + * __slk_draw -- + * Draws the specified key. + */ +static int +__slk_draw(SCREEN *screen, int labnum) +{ + const struct __slk_label *l; + + if (screen->slk_hidden) + return OK; + + l = &screen->slk_labels[labnum]; + if (screen->is_term_slk) + return ti_putp(screen->term, + ti_tiparm(screen->term, + t_plab_norm(screen->term), labnum + 1, l->label)); + else if (screen->slk_window != NULL) + return mvwaddnstr(screen->slk_window, 0, l->x, + l->label, screen->slk_label_len); + else + return ERR; +} + +/* + * __slk_draw -- + * Draws all the keys. + */ +static int +__slk_redraw(SCREEN *screen) +{ + int i, result = OK; + + for (i = 0; i < screen->slk_nlabels; i++) { + if (__slk_draw(screen, i) == ERR) + result = ERR; + } + return result; +} diff --git a/vendor/netbsd-curses/libcurses/slk_attr_off.3 b/vendor/netbsd-curses/libcurses/slk_attr_off.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_attr_off.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_attr_on.3 b/vendor/netbsd-curses/libcurses/slk_attr_on.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_attr_on.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_attr_set.3 b/vendor/netbsd-curses/libcurses/slk_attr_set.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_attr_set.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_attroff.3 b/vendor/netbsd-curses/libcurses/slk_attroff.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_attroff.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_attron.3 b/vendor/netbsd-curses/libcurses/slk_attron.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_attron.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_attrset.3 b/vendor/netbsd-curses/libcurses/slk_attrset.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_attrset.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_clear.3 b/vendor/netbsd-curses/libcurses/slk_clear.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_clear.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_color.3 b/vendor/netbsd-curses/libcurses/slk_color.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_color.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_init.3 b/vendor/netbsd-curses/libcurses/slk_init.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_init.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_label.3 b/vendor/netbsd-curses/libcurses/slk_label.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_label.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_noutrefresh.3 b/vendor/netbsd-curses/libcurses/slk_noutrefresh.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_noutrefresh.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_refresh.3 b/vendor/netbsd-curses/libcurses/slk_refresh.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_refresh.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_restore.3 b/vendor/netbsd-curses/libcurses/slk_restore.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_restore.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_set.3 b/vendor/netbsd-curses/libcurses/slk_set.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_set.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_touch.3 b/vendor/netbsd-curses/libcurses/slk_touch.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_touch.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/slk_wset.3 b/vendor/netbsd-curses/libcurses/slk_wset.3 new file mode 120000 index 0000000..d109756 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/slk_wset.3 @@ -0,0 +1 @@ +curses_slk.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/standend.3 b/vendor/netbsd-curses/libcurses/standend.3 new file mode 120000 index 0000000..2b482c3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/standend.3 @@ -0,0 +1 @@ +curses_standout.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/standout.3 b/vendor/netbsd-curses/libcurses/standout.3 new file mode 120000 index 0000000..2b482c3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/standout.3 @@ -0,0 +1 @@ +curses_standout.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/standout.c b/vendor/netbsd-curses/libcurses/standout.c new file mode 100644 index 0000000..3866ef4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/standout.c @@ -0,0 +1,94 @@ +/* $NetBSD: standout.c,v 1.19 2017/01/10 23:49:20 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * standout -- + * Enter standout mode on stdscr. + */ +int +standout(void) +{ + + return wstandout(stdscr); +} + +/* + * standend -- + * Exit standout mode on stdscr. + */ +int +standend(void) +{ + + return wstandend(stdscr); +} + +#endif + +/* + * wstandout -- + * Enter standout mode in window win. + */ +int +wstandout(WINDOW *win) +{ + const TERMINAL *t = win->screen->term; + + /* + * If standout/standend strings, or can underline, set the + * screen standout bit. + */ + if ((t_enter_standout_mode(t) != NULL && + t_exit_standout_mode(t) != NULL) || + t_underline_char(t) != NULL) + win->wattr |= __STANDOUT; + return 1; +} + +/* + * wstandend -- + * Exit standout mode in window win. + */ +int +wstandend(WINDOW *win) +{ + + // http://pubs.opengroup.org/onlinepubs/7908799/xcurses/wstandend.html + win->wattr = __NORMAL; + return 1; +} diff --git a/vendor/netbsd-curses/libcurses/start_color.3 b/vendor/netbsd-curses/libcurses/start_color.3 new file mode 120000 index 0000000..1f101c9 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/start_color.3 @@ -0,0 +1 @@ +curses_color.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/subpad.3 b/vendor/netbsd-curses/libcurses/subpad.3 new file mode 120000 index 0000000..3904c3b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/subpad.3 @@ -0,0 +1 @@ +curses_pad.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/subwin.3 b/vendor/netbsd-curses/libcurses/subwin.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/subwin.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/syncok.3 b/vendor/netbsd-curses/libcurses/syncok.3 new file mode 120000 index 0000000..52075e3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/syncok.3 @@ -0,0 +1 @@ +curses_touch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/syncok.c b/vendor/netbsd-curses/libcurses/syncok.c new file mode 100644 index 0000000..e44c832 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/syncok.c @@ -0,0 +1,48 @@ +/* $NetBSD: syncok.c,v 1.2 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 2017 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "curses.h" +#include "curses_private.h" + +/* + * immedok -- + * Refresh the window when changed. + */ +int +syncok(WINDOW *win, bool bf) +{ + + if (bf) + win->flags |= __SYNCOK; + else + win->flags &= ~__SYNCOK; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/timeout.3 b/vendor/netbsd-curses/libcurses/timeout.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/timeout.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/timeout.c b/vendor/netbsd-curses/libcurses/timeout.c new file mode 100644 index 0000000..41c0193 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/timeout.c @@ -0,0 +1,74 @@ +/* $NetBSD: timeout.c,v 1.9 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * timeout -- + * Set the getch() delay for stdscr. + */ +void +timeout(int delay) +{ + + wtimeout(stdscr, delay); +} + +#endif + +/* + * wtimeout -- + * Set the getch() delay for a window. + */ +void +wtimeout(WINDOW *win, int delay) +{ + + if (delay < 0) + win->delay = -1; + else if (!delay) + win->delay = delay; + else { + /* + * 1. VTIME is a char + * 2. timeout granularity is ms but VTIME is 0.1s + */ + if (delay > 25500) + win->delay = 255; + else + win->delay = (delay - 1)/ 100 + 1; + } +} diff --git a/vendor/netbsd-curses/libcurses/touchline.3 b/vendor/netbsd-curses/libcurses/touchline.3 new file mode 120000 index 0000000..52075e3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/touchline.3 @@ -0,0 +1 @@ +curses_touch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/toucholap.c b/vendor/netbsd-curses/libcurses/toucholap.c new file mode 100644 index 0000000..abbf606 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/toucholap.c @@ -0,0 +1,72 @@ +/* $NetBSD: toucholap.c,v 1.17 2017/01/06 13:53:18 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * touchoverlap -- + * Touch, on win2, the part that overlaps with win1. + */ +int +touchoverlap(WINDOW *win1, WINDOW *win2) +{ + int y, endy, endx, starty, startx; + +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "touchoverlap: (%p, %p);\n", win1, win2); +#endif + starty = max(win1->begy, win2->begy); + startx = max(win1->begx, win2->begx); + endy = min(win1->maxy + win1->begy, win2->maxy + win2->begy); + endx = min(win1->maxx + win1->begx, win2->maxx + win2->begx); +#ifdef DEBUG + __CTRACE(__CTRACE_WINDOW, "touchoverlap: from (%d,%d) to (%d,%d)\n", + starty, startx, endy, endx); + __CTRACE(__CTRACE_WINDOW, "touchoverlap: win1 (%d,%d) to (%d,%d)\n", + win1->begy, win1->begx, win1->begy + win1->maxy, + win1->begx + win1->maxx); + __CTRACE(__CTRACE_WINDOW, "touchoverlap: win2 (%d,%d) to (%d,%d)\n", + win2->begy, win2->begx, win2->begy + win2->maxy, + win2->begx + win2->maxx); +#endif + if (starty >= endy || startx >= endx) + return OK; + starty -= win2->begy; + startx -= win2->begx; + endy -= win2->begy; + endx -= win2->begx; + for (--endx, y = starty; y < endy; y++) + __touchline(win2, y, startx, endx); + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/touchoverlap.3 b/vendor/netbsd-curses/libcurses/touchoverlap.3 new file mode 120000 index 0000000..52075e3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/touchoverlap.3 @@ -0,0 +1 @@ +curses_touch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/touchwin.3 b/vendor/netbsd-curses/libcurses/touchwin.3 new file mode 120000 index 0000000..52075e3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/touchwin.3 @@ -0,0 +1 @@ +curses_touch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/touchwin.c b/vendor/netbsd-curses/libcurses/touchwin.c new file mode 100644 index 0000000..cb6441e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/touchwin.c @@ -0,0 +1,276 @@ +/* $NetBSD: touchwin.c,v 1.32 2020/07/03 23:28:51 uwe Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +static int _cursesi_touchline_force(WINDOW *, int, int, int, int); + +/* + * __sync -- + * To be called after each window change. + */ +void +__sync(WINDOW *win) +{ + + if (win->flags & __IMMEDOK) + wrefresh(win); + if (win->flags & __SYNCOK) + wsyncup(win); +} + +/* + * is_linetouched -- + * Indicate if line has been touched or not. + */ +bool +is_linetouched(WINDOW *win, int line) +{ + if (line > win->maxy) + return FALSE; + +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "is_linetouched: (%p, line %d, dirty %d)\n", + win, line, (win->alines[line]->flags & __ISDIRTY)); +#endif + return (win->alines[line]->flags & __ISDIRTY) != 0; +} + +/* + * touchline -- + * Touch count lines starting at start. This is the SUS v2 compliant + * version. + */ +int +touchline(WINDOW *win, int start, int count) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "touchline: (%p, %d, %d)\n", win, start, count); +#endif + return wtouchln(win, start, count, 1); +} + +/* + * wredrawln -- + * Mark count lines starting at start as corrupted. Implemented using + * wtouchln(). + */ +int wredrawln(WINDOW *win, int start, int count) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "wredrawln: (%p, %d, %d)\n", win, start, count); +#endif + return wtouchln(win, start, count, 1); +} + +/* + * is_wintouched -- + * Check if the window has been touched. + */ +bool +is_wintouched(WINDOW *win) +{ + int y, maxy; + +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "is_wintouched: (%p, maxy %d)\n", win, + win->maxy); +#endif + maxy = win->maxy; + for (y = 0; y < maxy; y++) { + if (is_linetouched(win, y) == TRUE) + return TRUE; + } + + return FALSE; +} + +/* + * touchwin -- + * Make it look like the whole window has been changed. + */ +int +touchwin(WINDOW *win) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "touchwin: (%p)\n", win); +#endif + return wtouchln(win, 0, win->maxy, 1); +} + +/* + * redrawwin -- + * Mark entire window as corrupted. Implemented using wtouchln(). + */ +int +redrawwin(WINDOW *win) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "redrawwin: (%p)\n", win); +#endif + return wtouchln(win, 0, win->maxy, 1); +} + +/* + * untouchwin -- + * Make it look like the window has not been changed. + */ +int +untouchwin(WINDOW *win) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "untouchwin: (%p)\n", win); +#endif + return wtouchln(win, 0, win->maxy, 0); +} + +/* + * wtouchln -- + * If changed is 1 then touch n lines starting at line. If changed + * is 0 then mark the lines as unchanged. + */ +int +wtouchln(WINDOW *win, int line, int n, int changed) +{ + int y; + __LINE *wlp; + +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "wtouchln: (%p) %d, %d, %d\n", + win, line, n, changed); +#endif + if (line < 0 || win->maxy <= line) + return ERR; + if (n < 0) + return ERR; + if (n > win->maxy - line) + n = win->maxy - line; + + for (y = line; y < line + n; y++) { + if (changed == 1) + _cursesi_touchline_force(win, y, 0, + (int) win->maxx - 1, 1); + else { + wlp = win->alines[y]; + if (*wlp->firstchp >= win->ch_off && + *wlp->firstchp < win->maxx + win->ch_off) + *wlp->firstchp = win->maxx + win->ch_off; + if (*wlp->lastchp >= win->ch_off && + *wlp->lastchp < win->maxx + win->ch_off) + *wlp->lastchp = win->ch_off; + wlp->flags &= ~(__ISDIRTY | __ISFORCED); + } + } + + return OK; +} + +int +__touchwin(WINDOW *win) +{ + int y, maxy; + +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "__touchwin: (%p)\n", win); +#endif + maxy = win->maxy; + for (y = 0; y < maxy; y++) + __touchline(win, y, 0, (int) win->maxx - 1); + return OK; +} + +int +__touchline(WINDOW *win, int y, int sx, int ex) +{ + + return _cursesi_touchline_force(win, y, sx, ex, 0); +} + +/* + * Touch line y on window win starting from column sx and ending at + * column ex. If force is 1 then we mark this line as a forced update + * which will bypass screen optimisation in the refresh code to rewrite + * this line unconditionally (even if refresh thinks the screen matches + * what is in the virtscr) + */ +static int +_cursesi_touchline_force(WINDOW *win, int y, int sx, int ex, int force) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "__touchline: (%p, %d, %d, %d, %d)\n", + win, y, sx, ex, force); + __CTRACE(__CTRACE_LINE, "__touchline: first = %d, last = %d\n", + *win->alines[y]->firstchp, *win->alines[y]->lastchp); +#endif + sx += win->ch_off; + ex += win->ch_off; + win->alines[y]->flags |= __ISDIRTY; + if (force == 1) + win->alines[y]->flags |= __ISFORCED; + /* firstchp/lastchp are shared between parent window and sub-window. */ + if (*win->alines[y]->firstchp > sx) + *win->alines[y]->firstchp = sx; + if (*win->alines[y]->lastchp < ex) + *win->alines[y]->lastchp = ex; +#ifdef DEBUG + __CTRACE(__CTRACE_LINE, "__touchline: first = %d, last = %d\n", + *win->alines[y]->firstchp, *win->alines[y]->lastchp); +#endif + return OK; +} + +void +wsyncup(WINDOW *win) +{ + + do { + __touchwin(win); + win = win->orig; + } while (win); +} + +void +wsyncdown(WINDOW *win) +{ + WINDOW *w = win->orig; + + while (w) { + if (is_wintouched(w)) { + __touchwin(win); + break; + } + w = w->orig; + } +} diff --git a/vendor/netbsd-curses/libcurses/tscroll.c b/vendor/netbsd-curses/libcurses/tscroll.c new file mode 100644 index 0000000..7e9b9c1 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/tscroll.c @@ -0,0 +1,246 @@ +/* $NetBSD: tscroll.c,v 1.14 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include "curses.h" +#include "curses_private.h" + +#define MAXRETURNSIZE 64 + +char * +__tscroll(const char *cap, int n1, int n2) +{ + + return __parse_cap(cap, n1, n2); +} + +/* + * Routines to parse capabilities. Derived from tgoto.c in termcap(3) + * library. Cap is a string containing printf type escapes to allow + * scrolling. The following escapes are defined for substituting n: + * + * %d as in printf + * %2 like %2d + * %3 like %3d + * %. gives %c hacking special case characters + * %+x like %c but adding x first + * + * The codes below affect the state but don't use up a value. + * + * %>xy if value > x add y + * %i increments n + * %% gives % + * %B BCD (2 decimal digits encoded in one byte) + * %D Delta Data (backwards bcd) + * + * all other characters are ``self-inserting''. + * + * XXX: + * %r reverse order of two parameters + * is also defined but we don't support it (yet). + */ +char * +__parse_cap (char const *cap, ...) +{ + va_list ap; + static char result[MAXRETURNSIZE]; + int c, n; + char *dp; + int have_input; + + va_start (ap, cap); + n = 0; /* XXX gcc -Wuninitialized */ + + if (cap == NULL) + goto err; +#ifdef DEBUG + { + int i; + + __CTRACE(__CTRACE_MISC, "__parse_cap: cap = "); + for (i = 0; i < strlen(cap); i++) + __CTRACE(__CTRACE_MISC, "%s", unctrl(cap[i])); + __CTRACE(__CTRACE_MISC, "\n"); + } +#endif + have_input = 0; + for (dp = result; (c = *cap++) != '\0';) { + if (c != '%') { + *dp++ = c; + continue; + } + switch (c = *cap++) { + case 'n': + if (!have_input) { + n = va_arg(ap, int); + have_input = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__parse_cap: %%n, val = %d\n", n); +#endif + } + n ^= 0140; + continue; + case 'd': + if (!have_input) { + n = va_arg(ap, int); + have_input = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__parse_cap: %%d, val = %d\n", n); +#endif + } + if (n < 10) + goto one; + if (n < 100) + goto two; + /* FALLTHROUGH */ + case '3': + if (!have_input) { + n = va_arg(ap, int); + have_input = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__parse_cap: %%3, val = %d\n", n); +#endif + } + *dp++ = (n / 100) | '0'; + n %= 100; + /* FALLTHROUGH */ + case '2': + if (!have_input) { + n = va_arg(ap, int); + have_input = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__parse_cap: %%2, val = %d\n", n); +#endif + } + two: *dp++ = n / 10 | '0'; + one: *dp++ = n % 10 | '0'; + have_input = 0; + continue; + case '>': + if (!have_input) { + n = va_arg(ap, int); + have_input = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__parse_cap: %%>, val = %d\n", n); +#endif + } + if (n > *cap++) + n += *cap++; + else + cap++; + continue; + case '+': + if (!have_input) { + n = va_arg(ap, int); + have_input = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__parse_cap: %%+, val = %d\n", n); +#endif + } + n += *cap++; + /* FALLTHROUGH */ + case '.': + if (!have_input) { + n = va_arg(ap, int); + have_input = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__parse_cap: %%., val = %d\n", n); +#endif + } + *dp++ = n; + have_input = 0; + continue; + case 'i': + if (!have_input) { + n = va_arg(ap, int); + have_input = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__parse_cap: %%i, val = %d\n", n); +#endif + } + n++; + continue; + case '%': + *dp++ = c; + continue; + case 'B': + if (!have_input) { + n = va_arg(ap, int); + have_input = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__parse_cap: %%B, val = %d\n", n); +#endif + } + n = (n / 10 << 4) + n % 10; + continue; + case 'D': + if (!have_input) { + n = va_arg(ap, int); + have_input = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__parse_cap: %%D, val = %d\n", n); +#endif + } + n = n - 2 * (n % 16); + continue; + /* + * XXX + * System V terminfo files have lots of extra gunk. + * The only other one we've seen in capability strings + * is %pN, and it seems to work okay if we ignore it. + */ + case 'p': + ++cap; + continue; + default: + goto err; + } + } + *dp = '\0'; + va_end(ap); + return result; + +err: va_end(ap); + return (char *)"\0"; +} diff --git a/vendor/netbsd-curses/libcurses/tstp.c b/vendor/netbsd-curses/libcurses/tstp.c new file mode 100644 index 0000000..e5d3301 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/tstp.c @@ -0,0 +1,363 @@ +/* $NetBSD: tstp.c,v 1.44 2018/10/18 07:53:13 roy Exp $ */ + +/* + * Copyright (c) 1981, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define _GNU_SOURCE +#define _BSD_SOURCE +#include + +#include +#include + +#include +#include +#include +#include + +#include "curses.h" +#include "curses_private.h" + +static int tstp_set; +static int winch_set; + +static void (*otstpfn)(int) = SIG_DFL; + +static struct sigaction owsa; +#ifndef TCSASOFT +#define TCSASOFT 0 +#endif + +/* + * stop_signal_handler -- + * Handle stop signals. + */ +void +__stop_signal_handler(/*ARGSUSED*/int signo) +{ + sigset_t oset, set; + + /* + * Block window change and timer signals. The latter is because + * applications use timers to decide when to repaint the screen. + */ + (void)sigemptyset(&set); + (void)sigaddset(&set, SIGALRM); + (void)sigaddset(&set, SIGWINCH); + (void)sigprocmask(SIG_BLOCK, &set, &oset); + + /* + * End the window, which also resets the terminal state to the + * original modes. + */ + __stopwin(); + + /* Unblock SIGTSTP. */ + (void)sigemptyset(&set); + (void)sigaddset(&set, SIGTSTP); + (void)sigprocmask(SIG_UNBLOCK, &set, NULL); + + /* Stop ourselves. */ + (void)kill(0, SIGTSTP); + + /* Time passes ... */ + + /* restart things */ + __restartwin(); + + /* Reset the signals. */ + (void)sigprocmask(SIG_SETMASK, &oset, NULL); +} + +/* + * Set the TSTP handler. + */ +void +__set_stophandler(void) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "__set_stophandler: %d\n", tstp_set); +#endif + if (!tstp_set) { + otstpfn = signal(SIGTSTP, __stop_signal_handler); + tstp_set = 1; + } +} + +/* + * Restore the TSTP handler. + */ +void +__restore_stophandler(void) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "__restore_stophandler: %d\n", tstp_set); +#endif + if (tstp_set) { + (void)signal(SIGTSTP, otstpfn); + tstp_set = 0; + } +} + +/* + * winch_signal_handler -- + * Handle winch signals by pushing KEY_RESIZE into the input stream. + */ +void +__winch_signal_handler(/*ARGSUSED*/int signo) +{ + struct winsize win; + + if (ioctl(fileno(_cursesi_screen->outfd), TIOCGWINSZ, &win) != -1 && + win.ws_row != 0 && win.ws_col != 0) + { + LINES = win.ws_row; + COLS = win.ws_col; + } + /* + * If there was a previous handler, call that, + * otherwise tell getch() to send KEY_RESIZE. + */ + if (owsa.sa_handler != SIG_DFL && + owsa.sa_handler != SIG_IGN && + owsa.sa_handler != SIG_ERR && + owsa.sa_handler != SIG_HOLD) + owsa.sa_handler(signo); + else + _cursesi_screen->resized = 1; +} + +/* + * Set the WINCH handler. + */ +void +__set_winchhandler(void) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "__set_winchhandler: %d\n", winch_set); +#endif + if (!winch_set) { + struct sigaction sa; + + sa.sa_handler = __winch_signal_handler; + sa.sa_flags = 0; + sigemptyset(&sa.sa_mask); + sigaction(SIGWINCH, &sa, &owsa); + winch_set = 1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, + "__set_winchhandler: owsa.sa_handler=%p\n", + owsa.sa_handler); +#endif + } +} + +/* + * Restore the WINCH handler. + */ +void +__restore_winchhandler(void) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "__restore_winchhandler: %d\n", winch_set); +#endif + if (winch_set > 0) { + struct sigaction cwsa; + + sigaction(SIGWINCH, NULL, &cwsa); + if (cwsa.sa_handler == owsa.sa_handler) { + sigaction(SIGWINCH, &owsa, NULL); + winch_set = 0; + } else { + /* + * We're now using the programs WINCH handler, + * so don't restore the previous one. + */ + winch_set = -1; +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "cwsa.sa_handler = %p\n", + cwsa.sa_handler); +#endif + } + } +} + +/* To allow both SIGTSTP and endwin() to come back nicely, we provide + the following routines. */ + +int +__stopwin(void) +{ + +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "__stopwin\n"); +#endif + if (_cursesi_screen == NULL) + return ERR; + if (_cursesi_screen->endwin) + return OK; + + /* Get the current terminal state (which the user may have changed). */ + (void)tcgetattr(fileno(_cursesi_screen->infd), + &_cursesi_screen->save_termios); + + __restore_stophandler(); + __restore_winchhandler(); + + if (curscr != NULL) { + __unsetattr(0); + __mvcur((int)curscr->cury, (int)curscr->curx, + (int)curscr->maxy - 1, 0, 0); + } + + if (meta_on != NULL) + (void)tputs(meta_on, 0, __cputchar); + + if ((curscr != NULL) && (curscr->flags & __KEYPAD)) + (void)tputs(keypad_local, 0, __cputchar); + (void)tputs(cursor_normal, 0, __cputchar); + (void)tputs(exit_ca_mode, 0, __cputchar); + (void)fflush(_cursesi_screen->outfd); +#ifdef BSD + (void)setvbuf(_cursesi_screen->outfd, NULL, _IOLBF, 0); +#endif + + _cursesi_screen->endwin = 1; + + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + &_cursesi_screen->orig_termios) ? ERR : OK; +} + +void +__restartwin(void) +{ + struct winsize win; + int nlines, ncols; + +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "__restartwin\n"); +#endif + if (!_cursesi_screen->endwin) + return; + + /* Reset the curses SIGTSTP and SIGWINCH signal handlers. */ + __set_stophandler(); + __set_winchhandler(); + + /* + * Check to see if the window size has changed. + * If the application didn't update LINES and COLS, + * set the * resized flag to tell getch() to push KEY_RESIZE. + * Update curscr (which also updates __virtscr) and stdscr + * to match the new size. + */ + if (ioctl(fileno(_cursesi_screen->outfd), TIOCGWINSZ, &win) != -1 && + win.ws_row != 0 && win.ws_col != 0) + { + if (win.ws_row != LINES) { + LINES = win.ws_row; + _cursesi_screen->resized = 1; + } + if (win.ws_col != COLS) { + COLS = win.ws_col; + _cursesi_screen->resized = 1; + } + } + /* + * We need to make local copies of LINES and COLS, otherwise we + * could lose if they are changed between wresize() calls. + */ + nlines = LINES; + ncols = COLS; + if (curscr->maxy != nlines || curscr->maxx != ncols) + wresize(curscr, nlines, ncols); + if (stdscr->maxy != nlines || stdscr->maxx != ncols) + wresize(stdscr, nlines, ncols); + + /* save the new "default" terminal state */ + (void)tcgetattr(fileno(_cursesi_screen->infd), + &_cursesi_screen->orig_termios); + + /* Reset the terminal state to the mode just before we stopped. */ + (void)tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + &_cursesi_screen->save_termios); + + /* Restore colours */ + __restore_colors(); + + /* Reset meta */ + __restore_meta_state(); + + /* Restart the screen. */ + __startwin(_cursesi_screen); + + /* Reset cursor visibility */ + __restore_cursor_vis(); + + /* Repaint the screen. */ + wrefresh(curscr); +} + +int +def_prog_mode(void) +{ + + if (_cursesi_screen->endwin) + return ERR; + + return tcgetattr(fileno(_cursesi_screen->infd), + &_cursesi_screen->save_termios) ? ERR : OK; +} + +int +reset_prog_mode(void) +{ + + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + &_cursesi_screen->save_termios) ? ERR : OK; +} + +int +def_shell_mode(void) +{ + + return tcgetattr(fileno(_cursesi_screen->infd), + &_cursesi_screen->orig_termios) ? ERR : OK; +} + +int +reset_shell_mode(void) +{ + + return __stopwin(); +} diff --git a/vendor/netbsd-curses/libcurses/tty.c b/vendor/netbsd-curses/libcurses/tty.c new file mode 100644 index 0000000..7dcdb9a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/tty.c @@ -0,0 +1,705 @@ +/* $NetBSD: tty.c,v 1.48 2018/11/16 10:12:00 blymn Exp $ */ + +/*- + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include "curses.h" +#include "curses_private.h" + +/* + * In general, curses should leave tty hardware settings alone (speed, parity, + * word size). This is most easily done in BSD by using TCSASOFT on all + * tcsetattr calls. On other systems, it would be better to get and restore + * those attributes at each change, or at least when stopped and restarted. + * See also the comments in getterm(). + */ +#ifndef TCSASOFT +#define TCSASOFT 0 +#endif + +int __tcaction = TCSASOFT != 0; /* Ignore hardware settings */ + +#ifndef OXTABS +#ifdef XTABS /* SMI uses XTABS. */ +#define OXTABS XTABS +#else +#define OXTABS 0 +#endif +#endif + +/* + * baudrate -- + * Return the current baudrate + */ +int +baudrate(void) +{ + + if (_cursesi_screen->notty == TRUE) + return 0; + + return cfgetospeed(&_cursesi_screen->baset); +} + +/* + * gettmode -- + * Do terminal type initialization. + */ +int +gettmode(void) +{ + + if (_cursesi_gettmode(_cursesi_screen) == ERR) + return ERR; + + __GT = _cursesi_screen->GT; + __NONL = _cursesi_screen->NONL; + return OK; +} + +/* + * _cursesi_gettmode -- + * Do the terminal type initialisation for the tty attached to the + * given screen. + */ +int +_cursesi_gettmode(SCREEN *screen) +{ + screen->useraw = 0; + + if (tcgetattr(fileno(screen->infd), &screen->orig_termios)) { + /* if the input fd is not a tty try the output */ + if (tcgetattr(fileno(screen->infd), &screen->orig_termios)) { + /* not a tty ... we will disable tty related stuff */ + screen->notty = TRUE; + __GT = 0; + __NONL = 0; + return OK; + } + } + + screen->baset = screen->orig_termios; + screen->baset.c_oflag &= ~OXTABS; + + screen->GT = 0; /* historical. was used before we wired OXTABS off */ + screen->NONL = (screen->baset.c_oflag & ONLCR) == 0; + + /* + * XXX + * System V and SMI systems overload VMIN and VTIME, such that + * VMIN is the same as the VEOF element, and VTIME is the same + * as the VEOL element. This means that, if VEOF was ^D, the + * default VMIN is 4. Majorly stupid. + */ + screen->cbreakt = screen->baset; + screen->cbreakt.c_lflag &= ~(ECHO | ECHONL | ICANON); + screen->cbreakt.c_cc[VMIN] = 1; + screen->cbreakt.c_cc[VTIME] = 0; + + screen->rawt = screen->cbreakt; + screen->rawt.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | INLCR | IGNCR | + ICRNL | IXON); + screen->rawt.c_oflag &= ~OPOST; + screen->rawt.c_lflag &= ~(ISIG | IEXTEN); + +#if TCSASOFT == 0 + /* + * In general, curses should leave hardware-related settings alone. + * This includes parity and word size. Older versions set the tty + * to 8 bits, no parity in raw(), but this is considered to be an + * artifact of the old tty interface. If it's desired to change + * parity and word size, the TCSASOFT bit has to be removed from the + * calls that switch to/from "raw" mode. + */ + screen->rawt.c_iflag &= ~ISTRIP; + screen->rawt.c_cflag &= ~(CSIZE | PARENB); + screen->rawt.c_cflag |= CS8; +#endif + + screen->curt = &screen->baset; + return tcsetattr(fileno(screen->infd), TCSASOFT | TCSADRAIN, + screen->curt) ? ERR : OK; +} + +/* + * raw -- + * Put the terminal into raw mode + */ +int +raw(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "raw()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + _cursesi_screen->useraw = __pfast = __rawmode = 1; + _cursesi_screen->curt = &_cursesi_screen->rawt; + if (_cursesi_screen->notty == TRUE) + return OK; + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + _cursesi_screen->curt) ? ERR : OK; +} + +/* + * noraw -- + * Put the terminal into cooked mode + */ +int +noraw(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "noraw()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + _cursesi_screen->useraw = __pfast = __rawmode = 0; + if (_cursesi_screen->notty == TRUE) + return OK; + _cursesi_screen->curt = &_cursesi_screen->baset; + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + _cursesi_screen->curt) ? ERR : OK; +} + +/* + * cbreak -- + * Enable cbreak mode + */ +int +cbreak(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "cbreak()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + __rawmode = 1; + if (_cursesi_screen->notty == TRUE) + return OK; + _cursesi_screen->curt = _cursesi_screen->useraw ? + &_cursesi_screen->rawt : &_cursesi_screen->cbreakt; + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + _cursesi_screen->curt) ? ERR : OK; +} + +/* + * nocbreak -- + * Disable cbreak mode + */ +int +nocbreak(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "nocbreak()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + __rawmode = 0; + if (_cursesi_screen->notty == TRUE) + return OK; + /* if we were in halfdelay mode then nuke the timeout */ + if ((stdscr->flags & __HALFDELAY) && + (__notimeout() == ERR)) + return ERR; + + stdscr->flags &= ~__HALFDELAY; + _cursesi_screen->curt = _cursesi_screen->useraw ? + &_cursesi_screen->rawt : &_cursesi_screen->baset; + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + _cursesi_screen->curt) ? ERR : OK; +} + +/* + * halfdelay -- + * Put the terminal into cbreak mode with the specified timeout. + * + */ +int +halfdelay(int duration) +{ + if ((duration < 1) || (duration > 255)) + return ERR; + + if (cbreak() == ERR) + return ERR; + + if (duration > 255) + stdscr->delay = 255; + else + stdscr->delay = duration; + + stdscr->flags |= __HALFDELAY; + return OK; +} + +int +__delay(void) + { +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "__delay()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + if (_cursesi_screen->notty == TRUE) + return OK; + _cursesi_screen->rawt.c_cc[VMIN] = 1; + _cursesi_screen->rawt.c_cc[VTIME] = 0; + _cursesi_screen->cbreakt.c_cc[VMIN] = 1; + _cursesi_screen->cbreakt.c_cc[VTIME] = 0; + _cursesi_screen->baset.c_cc[VMIN] = 1; + _cursesi_screen->baset.c_cc[VTIME] = 0; + + if (tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSANOW, + _cursesi_screen->curt)) { + __restore_termios(); + return ERR; + } + + return OK; +} + +int +__nodelay(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "__nodelay()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + if (_cursesi_screen->notty == TRUE) + return OK; + _cursesi_screen->rawt.c_cc[VMIN] = 0; + _cursesi_screen->rawt.c_cc[VTIME] = 0; + _cursesi_screen->cbreakt.c_cc[VMIN] = 0; + _cursesi_screen->cbreakt.c_cc[VTIME] = 0; + _cursesi_screen->baset.c_cc[VMIN] = 0; + _cursesi_screen->baset.c_cc[VTIME] = 0; + + if (tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSANOW, + _cursesi_screen->curt)) { + __restore_termios(); + return ERR; + } + + return OK; +} + +void +__save_termios(void) +{ + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + if (_cursesi_screen->notty == TRUE) + return; + _cursesi_screen->ovmin = _cursesi_screen->cbreakt.c_cc[VMIN]; + _cursesi_screen->ovtime = _cursesi_screen->cbreakt.c_cc[VTIME]; +} + +void +__restore_termios(void) +{ + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + if (_cursesi_screen->notty == TRUE) + return; + _cursesi_screen->rawt.c_cc[VMIN] = _cursesi_screen->ovmin; + _cursesi_screen->rawt.c_cc[VTIME] = _cursesi_screen->ovtime; + _cursesi_screen->cbreakt.c_cc[VMIN] = _cursesi_screen->ovmin; + _cursesi_screen->cbreakt.c_cc[VTIME] = _cursesi_screen->ovtime; + _cursesi_screen->baset.c_cc[VMIN] = _cursesi_screen->ovmin; + _cursesi_screen->baset.c_cc[VTIME] = _cursesi_screen->ovtime; +} + +int +__timeout(int delay) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "__timeout()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + if (_cursesi_screen->notty == TRUE) + return OK; + _cursesi_screen->ovmin = _cursesi_screen->cbreakt.c_cc[VMIN]; + _cursesi_screen->ovtime = _cursesi_screen->cbreakt.c_cc[VTIME]; + _cursesi_screen->rawt.c_cc[VMIN] = 0; + _cursesi_screen->rawt.c_cc[VTIME] = delay; + _cursesi_screen->cbreakt.c_cc[VMIN] = 0; + _cursesi_screen->cbreakt.c_cc[VTIME] = delay; + _cursesi_screen->baset.c_cc[VMIN] = 0; + _cursesi_screen->baset.c_cc[VTIME] = delay; + + if (tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSANOW, + _cursesi_screen->curt)) { + __restore_termios(); + return ERR; + } + + return OK; +} + +int +__notimeout(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "__notimeout()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + if (_cursesi_screen->notty == TRUE) + return OK; + _cursesi_screen->rawt.c_cc[VMIN] = 1; + _cursesi_screen->rawt.c_cc[VTIME] = 0; + _cursesi_screen->cbreakt.c_cc[VMIN] = 1; + _cursesi_screen->cbreakt.c_cc[VTIME] = 0; + _cursesi_screen->baset.c_cc[VMIN] = 1; + _cursesi_screen->baset.c_cc[VTIME] = 0; + + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSANOW, + _cursesi_screen->curt) ? ERR : OK; +} + +int +echo(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "echo()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + __echoit = 1; + return OK; +} + +int +noecho(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "noecho()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + __echoit = 0; + return OK; +} + +int +nl(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "nl()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + if (_cursesi_screen->notty == TRUE) + return OK; + _cursesi_screen->rawt.c_iflag |= ICRNL; + _cursesi_screen->rawt.c_oflag |= ONLCR; + _cursesi_screen->cbreakt.c_iflag |= ICRNL; + _cursesi_screen->cbreakt.c_oflag |= ONLCR; + _cursesi_screen->baset.c_iflag |= ICRNL; + _cursesi_screen->baset.c_oflag |= ONLCR; + + _cursesi_screen->nl = 1; + _cursesi_screen->pfast = _cursesi_screen->rawmode; + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + _cursesi_screen->curt) ? ERR : OK; +} + +int +nonl(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "nonl()\n"); +#endif + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + if (_cursesi_screen->notty == TRUE) + return OK; + _cursesi_screen->rawt.c_iflag &= ~ICRNL; + _cursesi_screen->rawt.c_oflag &= ~ONLCR; + _cursesi_screen->cbreakt.c_iflag &= ~ICRNL; + _cursesi_screen->cbreakt.c_oflag &= ~ONLCR; + _cursesi_screen->baset.c_iflag &= ~ICRNL; + _cursesi_screen->baset.c_oflag &= ~ONLCR; + + _cursesi_screen->nl = 0; + __pfast = 1; + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + _cursesi_screen->curt) ? ERR : OK; +} + +#ifndef _CURSES_USE_MACROS +void +noqiflush(void) +{ + + (void)intrflush(stdscr, FALSE); +} + +void +qiflush(void) +{ + + (void)intrflush(stdscr, TRUE); +} +#endif /* _CURSES_USE_MACROS */ + +/*ARGSUSED*/ +int +intrflush(WINDOW *win, bool bf) +{ + /* Check if we need to restart ... */ + if (_cursesi_screen->endwin) + __restartwin(); + + if (_cursesi_screen->notty == TRUE) + return OK; + if (bf) { + _cursesi_screen->rawt.c_lflag &= ~NOFLSH; + _cursesi_screen->cbreakt.c_lflag &= ~NOFLSH; + _cursesi_screen->baset.c_lflag &= ~NOFLSH; + } else { + _cursesi_screen->rawt.c_lflag |= NOFLSH; + _cursesi_screen->cbreakt.c_lflag |= NOFLSH; + _cursesi_screen->baset.c_lflag |= NOFLSH; + } + + __pfast = 1; + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + _cursesi_screen->curt) ? ERR : OK; +} + +void +__startwin(SCREEN *screen) +{ + + (void)fflush(screen->infd); + +#ifdef BSD + /* + * Some C libraries default to a 1K buffer when talking to a tty. + * With a larger screen, especially across a network, we'd like + * to get it to all flush in a single write. Make it twice as big + * as just the characters (so that we have room for cursor motions + * and attribute information) but no more than 8K. + * + * However, setvbuf may only be used after opening a stream and + * before any operations have been performed on it. + * This means we cannot work portably if an application wants + * to stop curses and start curses after a resize. + * Curses resizing is not standard, and thus not strictly portable + * even though all curses today support it. + * The BSD systems do not suffer from this limitation on setvbuf. + */ + if (screen->stdbuf == NULL) { + screen->len = LINES * COLS * 2; + if (screen->len > 8192) + screen->len = 8192; + if ((screen->stdbuf = malloc(screen->len)) == NULL) + screen->len = 0; + } + (void)setvbuf(screen->outfd, screen->stdbuf, _IOFBF, screen->len); +#endif + + ti_puts(screen->term, t_enter_ca_mode(screen->term), 0, + __cputchar_args, (void *) screen->outfd); + ti_puts(screen->term, t_cursor_normal(screen->term), 0, + __cputchar_args, (void *) screen->outfd); + if (screen->curscr->flags & __KEYPAD) + ti_puts(screen->term, t_keypad_xmit(screen->term), 0, + __cputchar_args, (void *) screen->outfd); + screen->endwin = 0; +} + +int +endwin(void) +{ +#ifdef DEBUG + __CTRACE(__CTRACE_MISC, "endwin\n"); +#endif + return __stopwin(); +} + +bool +isendwin(void) +{ + + return _cursesi_screen->endwin ? TRUE : FALSE; +} +#ifndef __FreeBSD__ +static int fpurge(FILE *f) { + //dprintf(666, "warning: called fpurge\n"); + fflush(f); + return 0; +} +#endif + +int +flushinp(void) +{ + + (void)fpurge(_cursesi_screen->infd); + return OK; +} + +/* + * The following routines, savetty and resetty are completely useless and + * are left in only as stubs. If people actually use them they will almost + * certainly screw up the state of the world. + */ +/*static struct termios savedtty;*/ +int +savetty(void) +{ + + if (_cursesi_screen->notty == TRUE) + return OK; + return tcgetattr(fileno(_cursesi_screen->infd), + &_cursesi_screen->savedtty) ? ERR : OK; +} + +int +resetty(void) +{ + + if (_cursesi_screen->notty == TRUE) + return OK; + return tcsetattr(fileno(_cursesi_screen->infd), TCSASOFT | TCSADRAIN, + &_cursesi_screen->savedtty) ? ERR : OK; +} + +/* + * erasechar -- + * Return the character of the erase key. + */ +char +erasechar(void) +{ + + if (_cursesi_screen->notty == TRUE) + return 0; + return _cursesi_screen->baset.c_cc[VERASE]; +} + +/* + * killchar -- + * Return the character of the kill key. + */ +char +killchar(void) +{ + + if (_cursesi_screen->notty == TRUE) + return 0; + return _cursesi_screen->baset.c_cc[VKILL]; +} + +/* + * erasewchar -- + * Return the wide character of the erase key. + */ +int +erasewchar(wchar_t *ch) +{ + +#ifndef HAVE_WCHAR + return ERR; +#else + if (_cursesi_screen->notty == TRUE) + return ERR; + *ch = _cursesi_screen->baset.c_cc[VERASE]; + return OK; +#endif /* HAVE_WCHAR */ +} + +/* + * killwchar -- + * Return the wide character of the kill key. + */ +int +killwchar( wchar_t *ch ) +{ + +#ifndef HAVE_WCHAR + return ERR; +#else + if (_cursesi_screen->notty == TRUE) + return 0; + *ch = _cursesi_screen->baset.c_cc[VKILL]; + return OK; +#endif /* HAVE_WCHAR */ +} + +int +typeahead(int filedes) +{ + + _cursesi_screen->checkfd = filedes; + return OK; +} diff --git a/vendor/netbsd-curses/libcurses/typeahead.3 b/vendor/netbsd-curses/libcurses/typeahead.3 new file mode 120000 index 0000000..b365c51 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/typeahead.3 @@ -0,0 +1 @@ +curses_tty.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/unctrl.3 b/vendor/netbsd-curses/libcurses/unctrl.3 new file mode 120000 index 0000000..614d94b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/unctrl.3 @@ -0,0 +1 @@ +curses_print.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/unctrl.c b/vendor/netbsd-curses/libcurses/unctrl.c new file mode 100644 index 0000000..8f7ce43 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/unctrl.c @@ -0,0 +1,143 @@ +/* $NetBSD: unctrl.c,v 1.11 2007/05/28 15:01:58 blymn Exp $ */ + +/* + * Copyright (c) 1981, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +const char * const __unctrl[256] = { + "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", + "^H", "^I", "^J", "^K", "^L", "^M", "^N", "^O", + "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W", + "^X", "^Y", "^Z", "^[", "^\\", "^]", "^~", "^_", + " ", "!", "\"", "#", "$", "%", "&", "'", + "(", ")", "*", "+", ",", "-", ".", "/", + "0", "1", "2", "3", "4", "5", "6", "7", + "8", "9", ":", ";", "<", "=", ">", "?", + "@", "A", "B", "C", "D", "E", "F", "G", + "H", "I", "J", "K", "L", "M", "N", "O", + "P", "Q", "R", "S", "T", "U", "V", "W", + "X", "Y", "Z", "[", "\\", "]", "^", "_", + "`", "a", "b", "c", "d", "e", "f", "g", + "h", "i", "j", "k", "l", "m", "n", "o", + "p", "q", "r", "s", "t", "u", "v", "w", + "x", "y", "z", "{", "|", "}", "~", "^?", + + "0x80", "0x81", "0x82", "0x83", "0x84", "0x85", "0x86", "0x87", + "0x88", "0x89", "0x8a", "0x8b", "0x8c", "0x8d", "0x8e", "0x8f", + "0x90", "0x91", "0x92", "0x93", "0x94", "0x95", "0x96", "0x97", + "0x98", "0x99", "0x9a", "0x9b", "0x9c", "0x9d", "0x9e", "0x9f", + "0xa0", "0xa1", "0xa2", "0xa3", "0xa4", "0xa5", "0xa6", "0xa7", + "0xa8", "0xa9", "0xaa", "0xab", "0xac", "0xad", "0xae", "0xaf", + "0xb0", "0xb1", "0xb2", "0xb3", "0xb4", "0xb5", "0xb6", "0xb7", + "0xb8", "0xb9", "0xba", "0xbb", "0xbc", "0xbd", "0xbe", "0xbf", + "0xc0", "0xc1", "0xc2", "0xc3", "0xc4", "0xc5", "0xc6", "0xc7", + "0xc8", "0xc9", "0xca", "0xcb", "0xcc", "0xcd", "0xce", "0xcf", + "0xd0", "0xd1", "0xd2", "0xd3", "0xd4", "0xd5", "0xd6", "0xd7", + "0xd8", "0xd9", "0xda", "0xdb", "0xdc", "0xdd", "0xde", "0xdf", + "0xe0", "0xe1", "0xe2", "0xe3", "0xe4", "0xe5", "0xe6", "0xe7", + "0xe8", "0xe9", "0xea", "0xeb", "0xec", "0xed", "0xee", "0xef", + "0xf0", "0xf1", "0xf2", "0xf3", "0xf4", "0xf5", "0xf6", "0xf7", + "0xf8", "0xf9", "0xfa", "0xfb", "0xfc", "0xfd", "0xfe", "0xff", +}; + +const unsigned char __unctrllen[256] = { + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 2, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, +}; + +#ifdef HAVE_WCHAR +const wchar_t * const __wunctrl[256] = { + L"^@", L"^A", L"^B", L"^C", L"^D", L"^E", L"^F", L"^G", + L"^H", L"^I", L"^J", L"^K", L"^L", L"^M", L"^N", L"^O", + L"^P", L"^Q", L"^R", L"^S", L"^T", L"^U", L"^V", L"^W", + L"^X", L"^Y", L"^Z", L"^[", L"^\\", L"^]", L"^~", L"^_", + L" ", L"!", L"\"", L"#", L"$", L"%", L"&", L"'", + L"(", L")", L"*", L"+", L",", L"-", L".", L"/", + L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", + L"8", L"9", L":", L";", L"<", L"=", L">", L"?", + L"@", L"A", L"B", L"C", L"D", L"E", L"F", L"G", + L"H", L"I", L"J", L"K", L"L", L"M", L"N", L"O", + L"P", L"Q", L"R", L"S", L"T", L"U", L"V", L"W", + L"X", L"Y", L"Z", L"[", L"\\", L"]", L"^", L"_", + L"`", L"a", L"b", L"c", L"d", L"e", L"f", L"g", + L"h", L"i", L"j", L"k", L"l", L"m", L"n", L"o", + L"p", L"q", L"r", L"s", L"t", L"u", L"v", L"w", + L"x", L"y", L"z", L"{", L"|", L"}", L"~", L"^?", + + L"0x80", L"0x81", L"0x82", L"0x83", L"0x84", L"0x85", L"0x86", L"0x87", + L"0x88", L"0x89", L"0x8a", L"0x8b", L"0x8c", L"0x8d", L"0x8e", L"0x8f", + L"0x90", L"0x91", L"0x92", L"0x93", L"0x94", L"0x95", L"0x96", L"0x97", + L"0x98", L"0x99", L"0x9a", L"0x9b", L"0x9c", L"0x9d", L"0x9e", L"0x9f", + L"0xa0", L"0xa1", L"0xa2", L"0xa3", L"0xa4", L"0xa5", L"0xa6", L"0xa7", + L"0xa8", L"0xa9", L"0xaa", L"0xab", L"0xac", L"0xad", L"0xae", L"0xaf", + L"0xb0", L"0xb1", L"0xb2", L"0xb3", L"0xb4", L"0xb5", L"0xb6", L"0xb7", + L"0xb8", L"0xb9", L"0xba", L"0xbb", L"0xbc", L"0xbd", L"0xbe", L"0xbf", + L"0xc0", L"0xc1", L"0xc2", L"0xc3", L"0xc4", L"0xc5", L"0xc6", L"0xc7", + L"0xc8", L"0xc9", L"0xca", L"0xcb", L"0xcc", L"0xcd", L"0xce", L"0xcf", + L"0xd0", L"0xd1", L"0xd2", L"0xd3", L"0xd4", L"0xd5", L"0xd6", L"0xd7", + L"0xd8", L"0xd9", L"0xda", L"0xdb", L"0xdc", L"0xdd", L"0xde", L"0xdf", + L"0xe0", L"0xe1", L"0xe2", L"0xe3", L"0xe4", L"0xe5", L"0xe6", L"0xe7", + L"0xe8", L"0xe9", L"0xea", L"0xeb", L"0xec", L"0xed", L"0xee", L"0xef", + L"0xf0", L"0xf1", L"0xf2", L"0xf3", L"0xf4", L"0xf5", L"0xf6", L"0xf7", + L"0xf8", L"0xf9", L"0xfa", L"0xfb", L"0xfc", L"0xfd", L"0xfe", L"0xff", +}; +#endif /* HAVE_WCHAR */ diff --git a/vendor/netbsd-curses/libcurses/unctrl.h b/vendor/netbsd-curses/libcurses/unctrl.h new file mode 100644 index 0000000..e195acd --- /dev/null +++ b/vendor/netbsd-curses/libcurses/unctrl.h @@ -0,0 +1,61 @@ +/* $NetBSD: unctrl.h,v 1.5 2015/05/28 06:28:37 wiz Exp $ */ + +/* + * Copyright (c) 1982, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)unctrl.h 8.1 (Berkeley) 5/31/93 + */ + +#ifndef _UNCTRL_H_ +#define _UNCTRL_H_ + +#ifdef HAVE_WCHAR +#include +#include +#endif /* HAVE_WCHAR */ + +#ifdef __cplusplus +extern "C" { +#endif +extern const char * const __unctrl[]; /* Control strings. */ +extern const unsigned char __unctrllen[]; /* Control strings length. */ +#ifdef HAVE_WCHAR +extern const wchar_t * const __wunctrl[]; /* Wide char control strings. */ +#endif /* HAVE_WCHAR */ +#ifdef __cplusplus +} +#endif + +/* 8-bit ASCII characters. */ +#define unctrl(c) __unctrl[((unsigned char)c) & 0xff] +#define unctrllen(c) __unctrllen[((unsigned char)c) & 0xff] + +#ifdef HAVE_WCHAR +#define wunctrl(wc) __wunctrl[( int )((wc)->vals[ 0 ]) & 0xff] +#endif /* HAVE_WCHAR */ +#endif /* _UNCTRL_H_ */ diff --git a/vendor/netbsd-curses/libcurses/underend.3 b/vendor/netbsd-curses/libcurses/underend.3 new file mode 120000 index 0000000..5302fbe --- /dev/null +++ b/vendor/netbsd-curses/libcurses/underend.3 @@ -0,0 +1 @@ +curses_underscore.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/underscore.3 b/vendor/netbsd-curses/libcurses/underscore.3 new file mode 120000 index 0000000..5302fbe --- /dev/null +++ b/vendor/netbsd-curses/libcurses/underscore.3 @@ -0,0 +1 @@ +curses_underscore.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/underscore.c b/vendor/netbsd-curses/libcurses/underscore.c new file mode 100644 index 0000000..2241810 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/underscore.c @@ -0,0 +1,99 @@ +/* $NetBSD: underscore.c,v 1.12 2017/01/06 13:53:18 roy Exp $ */ + +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julian Coleman. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "curses.h" +#include "curses_private.h" + +#ifndef _CURSES_USE_MACROS + +/* + * underscore -- + * Enter underscore mode on stdscr. + */ +int +underscore(void) +{ + + return wunderscore(stdscr); +} + + +/* + * underend -- + * Exit underscore mode on stdscr. + */ +int +underend(void) +{ + + return wunderend(stdscr); +} + +#endif + +/* + * wunderscore -- + * Enter underscore mode. + */ +int +wunderscore(WINDOW *win) +{ + + /* If can underscore, set the screen underscore bit. */ + if ((enter_underline_mode != NULL && exit_underline_mode != NULL) || + underline_char != NULL) + { +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wunderscore\n"); +#endif + win->wattr |= __UNDERSCORE; + } + return 1; +} + +/* + * wunderend -- + * Exit underscore mode. + */ +int +wunderend(WINDOW *win) +{ + + if (exit_underline_mode != NULL) { +#ifdef DEBUG + __CTRACE(__CTRACE_ATTR, "wunderend\n"); +#endif + win->wattr &= ~__UNDERSCORE; + } + return 1; +} diff --git a/vendor/netbsd-curses/libcurses/ungetch.3 b/vendor/netbsd-curses/libcurses/ungetch.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/ungetch.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/untouchwin.3 b/vendor/netbsd-curses/libcurses/untouchwin.3 new file mode 120000 index 0000000..52075e3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/untouchwin.3 @@ -0,0 +1 @@ +curses_touch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/use_default_colors.3 b/vendor/netbsd-curses/libcurses/use_default_colors.3 new file mode 120000 index 0000000..d46f50d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/use_default_colors.3 @@ -0,0 +1 @@ +curses_default_colors.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/use_env.3 b/vendor/netbsd-curses/libcurses/use_env.3 new file mode 120000 index 0000000..3a6d7eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/use_env.3 @@ -0,0 +1 @@ +curses_screen.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/version.c b/vendor/netbsd-curses/libcurses/version.c new file mode 100644 index 0000000..507a44d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/version.c @@ -0,0 +1,65 @@ +/* $NetBSD: version.c,v 1.3 2019/09/03 13:43:34 roy Exp $ */ + +/*- + * Copyright (c) 2019 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CURSES_VERSION +#define CURSES_VERSION "portable 0.3.2-git" +#endif + +#include "curses.h" + +#ifndef CURSES_VERSION +/* + * Bikeshed about what the version should be, if any: + * https://mail-index.netbsd.org/tech-userlevel/2019/09/02/msg012101.html + * This is the end result and should at least provide some amusement :) + */ +#define CURSES_VERSION "believe in unicorns" +#endif + +#ifdef CURSES_VERSION +/* + * Any version given should be braced to give some indication it's not + * really a version recognised by NetBSD. + * It should also have some product branding to indicate from whence + * if came. For example, if FrobozzCo packaged it: + * CFLAGS+= -DCURSES_VERSION="\"FrobozzCo 1.2.3\"" + */ +#define _CURSES_VERSION " (" CURSES_VERSION ")" +#else +#define _CURSES_VERSION +#endif + +const char * +curses_version() +{ + + return "NetBSD-Curses " _CURSES_VERSION; +} diff --git a/vendor/netbsd-curses/libcurses/vline.3 b/vendor/netbsd-curses/libcurses/vline.3 new file mode 120000 index 0000000..fa3776d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/vline.3 @@ -0,0 +1 @@ +curses_line.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/waddch.3 b/vendor/netbsd-curses/libcurses/waddch.3 new file mode 120000 index 0000000..b047dd4 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/waddch.3 @@ -0,0 +1 @@ +curses_addch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/waddchnstr.3 b/vendor/netbsd-curses/libcurses/waddchnstr.3 new file mode 120000 index 0000000..889b3b3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/waddchnstr.3 @@ -0,0 +1 @@ +curses_addchstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/waddchstr.3 b/vendor/netbsd-curses/libcurses/waddchstr.3 new file mode 120000 index 0000000..889b3b3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/waddchstr.3 @@ -0,0 +1 @@ +curses_addchstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/waddnstr.3 b/vendor/netbsd-curses/libcurses/waddnstr.3 new file mode 120000 index 0000000..ba1150b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/waddnstr.3 @@ -0,0 +1 @@ +curses_addstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/waddstr.3 b/vendor/netbsd-curses/libcurses/waddstr.3 new file mode 120000 index 0000000..ba1150b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/waddstr.3 @@ -0,0 +1 @@ +curses_addstr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wattr_get.3 b/vendor/netbsd-curses/libcurses/wattr_get.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wattr_get.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wattr_off.3 b/vendor/netbsd-curses/libcurses/wattr_off.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wattr_off.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wattr_on.3 b/vendor/netbsd-curses/libcurses/wattr_on.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wattr_on.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wattr_set.3 b/vendor/netbsd-curses/libcurses/wattr_set.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wattr_set.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wattroff.3 b/vendor/netbsd-curses/libcurses/wattroff.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wattroff.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wattron.3 b/vendor/netbsd-curses/libcurses/wattron.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wattron.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wattrset.3 b/vendor/netbsd-curses/libcurses/wattrset.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wattrset.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wbkgd.3 b/vendor/netbsd-curses/libcurses/wbkgd.3 new file mode 120000 index 0000000..b438d24 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wbkgd.3 @@ -0,0 +1 @@ +curses_background.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wbkgdset.3 b/vendor/netbsd-curses/libcurses/wbkgdset.3 new file mode 120000 index 0000000..b438d24 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wbkgdset.3 @@ -0,0 +1 @@ +curses_background.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wborder.3 b/vendor/netbsd-curses/libcurses/wborder.3 new file mode 120000 index 0000000..dd41763 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wborder.3 @@ -0,0 +1 @@ +curses_border.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wchgat.3 b/vendor/netbsd-curses/libcurses/wchgat.3 new file mode 120000 index 0000000..dc7fec3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wchgat.3 @@ -0,0 +1 @@ +curses_chgat.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wclear.3 b/vendor/netbsd-curses/libcurses/wclear.3 new file mode 120000 index 0000000..a92e1eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wclear.3 @@ -0,0 +1 @@ +curses_clear.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wclrtobot.3 b/vendor/netbsd-curses/libcurses/wclrtobot.3 new file mode 120000 index 0000000..a92e1eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wclrtobot.3 @@ -0,0 +1 @@ +curses_clear.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wclrtoeol.3 b/vendor/netbsd-curses/libcurses/wclrtoeol.3 new file mode 120000 index 0000000..a92e1eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wclrtoeol.3 @@ -0,0 +1 @@ +curses_clear.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wcolor_set.3 b/vendor/netbsd-curses/libcurses/wcolor_set.3 new file mode 120000 index 0000000..4fef2ec --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wcolor_set.3 @@ -0,0 +1 @@ +curses_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wcursyncup.3 b/vendor/netbsd-curses/libcurses/wcursyncup.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wcursyncup.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wdelch.3 b/vendor/netbsd-curses/libcurses/wdelch.3 new file mode 120000 index 0000000..ab881dc --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wdelch.3 @@ -0,0 +1 @@ +curses_delch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wdeleteln.3 b/vendor/netbsd-curses/libcurses/wdeleteln.3 new file mode 120000 index 0000000..a4dda2a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wdeleteln.3 @@ -0,0 +1 @@ +curses_deleteln.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wechochar.3 b/vendor/netbsd-curses/libcurses/wechochar.3 new file mode 120000 index 0000000..2572961 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wechochar.3 @@ -0,0 +1 @@ +curses_echochar.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/werase.3 b/vendor/netbsd-curses/libcurses/werase.3 new file mode 120000 index 0000000..a92e1eb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/werase.3 @@ -0,0 +1 @@ +curses_clear.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wgetch.3 b/vendor/netbsd-curses/libcurses/wgetch.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wgetch.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wgetnstr.3 b/vendor/netbsd-curses/libcurses/wgetnstr.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wgetnstr.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wgetstr.3 b/vendor/netbsd-curses/libcurses/wgetstr.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wgetstr.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/whline.3 b/vendor/netbsd-curses/libcurses/whline.3 new file mode 120000 index 0000000..fa3776d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/whline.3 @@ -0,0 +1 @@ +curses_line.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/winch.3 b/vendor/netbsd-curses/libcurses/winch.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/winch.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/winchnstr.3 b/vendor/netbsd-curses/libcurses/winchnstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/winchnstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/winchstr.3 b/vendor/netbsd-curses/libcurses/winchstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/winchstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/winnstr.3 b/vendor/netbsd-curses/libcurses/winnstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/winnstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/winsch.3 b/vendor/netbsd-curses/libcurses/winsch.3 new file mode 120000 index 0000000..9d46b67 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/winsch.3 @@ -0,0 +1 @@ +curses_insch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/winsdelln.3 b/vendor/netbsd-curses/libcurses/winsdelln.3 new file mode 120000 index 0000000..58d27ba --- /dev/null +++ b/vendor/netbsd-curses/libcurses/winsdelln.3 @@ -0,0 +1 @@ +curses_insdelln.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/winsertln.3 b/vendor/netbsd-curses/libcurses/winsertln.3 new file mode 120000 index 0000000..0e46445 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/winsertln.3 @@ -0,0 +1 @@ +curses_insertln.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/winstr.3 b/vendor/netbsd-curses/libcurses/winstr.3 new file mode 120000 index 0000000..cb13746 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/winstr.3 @@ -0,0 +1 @@ +curses_inch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wmove.3 b/vendor/netbsd-curses/libcurses/wmove.3 new file mode 120000 index 0000000..13ae77a --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wmove.3 @@ -0,0 +1 @@ +curses_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wnoutrefresh.3 b/vendor/netbsd-curses/libcurses/wnoutrefresh.3 new file mode 120000 index 0000000..7a991d5 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wnoutrefresh.3 @@ -0,0 +1 @@ +curses_refresh.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wprintw.3 b/vendor/netbsd-curses/libcurses/wprintw.3 new file mode 120000 index 0000000..614d94b --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wprintw.3 @@ -0,0 +1 @@ +curses_print.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wrefresh.3 b/vendor/netbsd-curses/libcurses/wrefresh.3 new file mode 120000 index 0000000..7a991d5 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wrefresh.3 @@ -0,0 +1 @@ +curses_refresh.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wresize.3 b/vendor/netbsd-curses/libcurses/wresize.3 new file mode 120000 index 0000000..822c623 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wresize.3 @@ -0,0 +1 @@ +curses_window.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wscanw.3 b/vendor/netbsd-curses/libcurses/wscanw.3 new file mode 120000 index 0000000..ce3be5d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wscanw.3 @@ -0,0 +1 @@ +curses_scanw.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wscrl.3 b/vendor/netbsd-curses/libcurses/wscrl.3 new file mode 120000 index 0000000..087dafb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wscrl.3 @@ -0,0 +1 @@ +curses_scroll.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wsetscrreg.3 b/vendor/netbsd-curses/libcurses/wsetscrreg.3 new file mode 120000 index 0000000..087dafb --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wsetscrreg.3 @@ -0,0 +1 @@ +curses_scroll.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wstandend.3 b/vendor/netbsd-curses/libcurses/wstandend.3 new file mode 120000 index 0000000..2b482c3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wstandend.3 @@ -0,0 +1 @@ +curses_standout.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wstandout.3 b/vendor/netbsd-curses/libcurses/wstandout.3 new file mode 120000 index 0000000..2b482c3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wstandout.3 @@ -0,0 +1 @@ +curses_standout.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wsyncup.3 b/vendor/netbsd-curses/libcurses/wsyncup.3 new file mode 120000 index 0000000..52075e3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wsyncup.3 @@ -0,0 +1 @@ +curses_touch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wtimeout.3 b/vendor/netbsd-curses/libcurses/wtimeout.3 new file mode 120000 index 0000000..3e74b7e --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wtimeout.3 @@ -0,0 +1 @@ +curses_input.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wtouchln.3 b/vendor/netbsd-curses/libcurses/wtouchln.3 new file mode 120000 index 0000000..52075e3 --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wtouchln.3 @@ -0,0 +1 @@ +curses_touch.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wunderend.3 b/vendor/netbsd-curses/libcurses/wunderend.3 new file mode 120000 index 0000000..5302fbe --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wunderend.3 @@ -0,0 +1 @@ +curses_underscore.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wunderscore.3 b/vendor/netbsd-curses/libcurses/wunderscore.3 new file mode 120000 index 0000000..5302fbe --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wunderscore.3 @@ -0,0 +1 @@ +curses_underscore.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libcurses/wvline.3 b/vendor/netbsd-curses/libcurses/wvline.3 new file mode 120000 index 0000000..fa3776d --- /dev/null +++ b/vendor/netbsd-curses/libcurses/wvline.3 @@ -0,0 +1 @@ +curses_line.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/GNUmakefile b/vendor/netbsd-curses/libform/GNUmakefile new file mode 100644 index 0000000..52a84d7 --- /dev/null +++ b/vendor/netbsd-curses/libform/GNUmakefile @@ -0,0 +1,95 @@ +# $NetBSD: Makefile,v 1.10 2012/03/21 05:38:49 matt Exp $ +# + +WARNS= 2 + +CPPFLAGS+=-I. -I.. -I../libmenu +LIB= form + +LIBDPLIBS+= curses ${.CURDIR}/../libcurses + +SRCS= driver.c field_types.c internals.c field.c form.c post.c type_alnum.c \ + type_alpha.c type_integer.c type_numeric.c type_enum.c type_regex.c \ + type_ipv4.c type_ipv6.c +MAN= form_cursor.3 form_data.3 form_driver.3 form_field.3 \ + form_field_attributes.3 form_field_buffer.3 form_field_info.3 \ + form_field_just.3 form_field_new.3 form_field_opts.3 \ + form_field_userptr.3 form_field_validation.3 form_fieldtype.3 \ + form_hook.3 form_new.3 form_new_page.3 form_opts.3 form_page.3 \ + form_post.3 form_userptr.3 form_win.3 forms.3 +MLINKS+= forms.3 form.3 form_page.3 current_field.3 \ + form_data.3 data_ahead.3 form_field_new.3 dup_field.3 \ + form_field_info.3 dynamic_field_info.3 \ + form_page.3 current_field.3 form_data.3 data_ahead.3 \ + form_data.3 data_behind.3 form_field_new.3 dup_field.3 \ + form_field_info.3 dynamic_field_info.3 \ + form_field_validation.3 field_arg.3 \ + form_field_attributes.3 field_back.3 \ + form_field_buffer.3 field_buffer.3 \ + form_field.3 field_count.3 \ + form_field_attributes.3 field_fore.3 \ + form_page.3 field_index.3 form_field_info.3 field_info.3 \ + form_hook.3 field_init.3 form_field_just.3 field_just.3 \ + form_field_opts.3 field_opts.3 \ + form_field_opts.3 field_opts_off.3 \ + form_field_opts.3 field_opts_on.3 \ + form_field_attributes.3 field_pad.3 \ + form_field_buffer.3 field_status.3 form_hook.3 field_term.3 \ + form_field_validation.3 field_type.3 \ + form_field_userptr.3 field_userptr.3 \ + form_field.3 form_fields.3 \ + form_hook.3 form_init.3 form_page.3 form_max_page.3 \ + form_opts.3 form_opts_off.3 \ + form_opts.3 form_opts_on.3 \ + form_win.3 form_sub.3 form_hook.3 form_term.3 \ + form_field_new.3 free_field.3 \ + form_fieldtype.3 free_fieldtype.3 \ + form_new.3 free_form.3 form_field_new.3 link_field.3 \ + form_fieldtype.3 link_fieldtype.3 form_field.3 move_field.3 \ + form_field_new.3 new_field.3 \ + form_fieldtype.3 new_fieldtype.3 \ + form_new.3 new_form.3 form_new_page.3 new_page.3 \ + form_cursor.3 pos_form_cursor.3 form_post.3 post_form.3 \ + form_win.3 scale_form.3 form_page.3 set_current_field.3 \ + form_field_attributes.3 set_field_back.3 \ + form_field_buffer.3 set_field_buffer.3 \ + form_field_attributes.3 set_field_fore.3 \ + form_hook.3 set_field_init.3 \ + form_field_just.3 set_field_just.3 \ + form_field_opts.3 set_field_opts.3 \ + form_field_attributes.3 set_field_pad.3 \ + form_field_buffer.3 set_field_printf.3 \ + form_field_buffer.3 set_field_status.3 \ + form_hook.3 set_field_term.3 \ + form_field_validation.3 set_field_type.3 \ + form_field_userptr.3 set_field_userptr.3 \ + form_fieldtype.3 set_fieldtype_arg.3 \ + form_fieldtype.3 set_fieldtype_choice.3 \ + form_field.3 set_form_fields.3 \ + form_hook.3 set_form_init.3 form_opts.3 set_form_opts.3 \ + form_page.3 set_form_page.3 form_win.3 set_form_sub.3 \ + form_hook.3 set_form_term.3 form_userptr.3 set_form_userptr.3 \ + form_win.3 set_form_win.3 form_field_buffer.3 set_max_field.3 \ + form_new_page.3 set_new_page.3 form_post.3 unpost_form.3 + +INCS= form.h +INCSDIR=/usr/include +CFLAGS+=-Werror-implicit-function-declaration + +AR?=ar +RANLIB?=ranlib +OBJS = $(SRCS:.c=.o) +LIBA=lib$(LIB).a +all: $(LIBA) + +clean: + rm -f $(OBJS) $(LIBA) + +$(LIBA): $(OBJS) + rm -f $(LIBA) + $(AR) cr $@ $^ + $(RANLIB) $@ + +%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $< + diff --git a/vendor/netbsd-curses/libform/Makefile b/vendor/netbsd-curses/libform/Makefile new file mode 100644 index 0000000..4b50b99 --- /dev/null +++ b/vendor/netbsd-curses/libform/Makefile @@ -0,0 +1,84 @@ +# $NetBSD: Makefile,v 1.11 2017/10/23 15:34:45 abhinav Exp $ +# + +WARNS= 2 + +CPPFLAGS+=-I${.CURDIR} +.if defined(DEBUG_FORMS) +CFLAGS+=-gdwarf-2 +CPPFLAGS+=-DDEBUG +LDFLAGS+=-g +.endif +LIB= form + +LIBDPLIBS+= curses ${.CURDIR}/../libcurses + +SRCS= driver.c field_types.c internals.c field.c form.c post.c type_alnum.c \ + type_alpha.c type_integer.c type_numeric.c type_enum.c type_regex.c \ + type_ipv4.c type_ipv6.c +MAN= form_cursor.3 form_data.3 form_driver.3 form_field.3 \ + form_field_attributes.3 form_field_buffer.3 form_field_info.3 \ + form_field_just.3 form_field_new.3 form_field_opts.3 \ + form_field_userptr.3 form_field_validation.3 form_fieldtype.3 \ + form_hook.3 form_new.3 form_new_page.3 form_opts.3 form_page.3 \ + form_post.3 form_userptr.3 form_win.3 forms.3 +MLINKS+= forms.3 form.3 form_page.3 current_field.3 \ + form_data.3 data_ahead.3 form_field_new.3 dup_field.3 \ + form_field_info.3 dynamic_field_info.3 \ + form_page.3 current_field.3 form_data.3 data_ahead.3 \ + form_data.3 data_behind.3 \ + form_field_info.3 dynamic_field_info.3 \ + form_field_validation.3 field_arg.3 \ + form_field_attributes.3 field_back.3 \ + form_field_buffer.3 field_buffer.3 \ + form_field.3 field_count.3 \ + form_field_attributes.3 field_fore.3 \ + form_page.3 field_index.3 form_field_info.3 field_info.3 \ + form_hook.3 field_init.3 form_field_just.3 field_just.3 \ + form_field_opts.3 field_opts.3 \ + form_field_opts.3 field_opts_off.3 \ + form_field_opts.3 field_opts_on.3 \ + form_field_attributes.3 field_pad.3 \ + form_field_buffer.3 field_status.3 form_hook.3 field_term.3 \ + form_field_validation.3 field_type.3 \ + form_field_userptr.3 field_userptr.3 \ + form_field.3 form_fields.3 \ + form_hook.3 form_init.3 form_page.3 form_max_page.3 \ + form_opts.3 form_opts_off.3 \ + form_opts.3 form_opts_on.3 \ + form_win.3 form_sub.3 form_hook.3 form_term.3 \ + form_field_new.3 free_field.3 \ + form_fieldtype.3 free_fieldtype.3 \ + form_new.3 free_form.3 form_field_new.3 link_field.3 \ + form_fieldtype.3 link_fieldtype.3 form_field.3 move_field.3 \ + form_field_new.3 new_field.3 \ + form_fieldtype.3 new_fieldtype.3 \ + form_new.3 new_form.3 form_new_page.3 new_page.3 \ + form_cursor.3 pos_form_cursor.3 form_post.3 post_form.3 \ + form_win.3 scale_form.3 form_page.3 set_current_field.3 \ + form_field_attributes.3 set_field_back.3 \ + form_field_buffer.3 set_field_buffer.3 \ + form_field_attributes.3 set_field_fore.3 \ + form_hook.3 set_field_init.3 \ + form_field_just.3 set_field_just.3 \ + form_field_opts.3 set_field_opts.3 \ + form_field_attributes.3 set_field_pad.3 \ + form_field_buffer.3 set_field_printf.3 \ + form_field_buffer.3 set_field_status.3 \ + form_hook.3 set_field_term.3 \ + form_field_validation.3 set_field_type.3 \ + form_field_userptr.3 set_field_userptr.3 \ + form_fieldtype.3 set_fieldtype_arg.3 \ + form_fieldtype.3 set_fieldtype_choice.3 \ + form_field.3 set_form_fields.3 \ + form_hook.3 set_form_init.3 form_opts.3 set_form_opts.3 \ + form_page.3 set_form_page.3 form_win.3 set_form_sub.3 \ + form_hook.3 set_form_term.3 form_userptr.3 set_form_userptr.3 \ + form_win.3 set_form_win.3 form_field_buffer.3 set_max_field.3 \ + form_new_page.3 set_new_page.3 form_post.3 unpost_form.3 + +INCS= form.h +INCSDIR=/usr/include + +.include +.include diff --git a/vendor/netbsd-curses/libform/current_field.3 b/vendor/netbsd-curses/libform/current_field.3 new file mode 120000 index 0000000..c7d47c5 --- /dev/null +++ b/vendor/netbsd-curses/libform/current_field.3 @@ -0,0 +1 @@ +form_page.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/data_ahead.3 b/vendor/netbsd-curses/libform/data_ahead.3 new file mode 120000 index 0000000..2aeae60 --- /dev/null +++ b/vendor/netbsd-curses/libform/data_ahead.3 @@ -0,0 +1 @@ +form_data.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/data_behind.3 b/vendor/netbsd-curses/libform/data_behind.3 new file mode 120000 index 0000000..2aeae60 --- /dev/null +++ b/vendor/netbsd-curses/libform/data_behind.3 @@ -0,0 +1 @@ +form_data.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/driver.c b/vendor/netbsd-curses/libform/driver.c new file mode 100644 index 0000000..4a67cb1 --- /dev/null +++ b/vendor/netbsd-curses/libform/driver.c @@ -0,0 +1,469 @@ +/* $NetBSD: driver.c,v 1.18 2013/11/26 01:17:00 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#define _XOPEN_SOURCE 700 +#include + +#include +#include +#include "form.h" +#include "internals.h" + +static int +traverse_form_links(FORM *form, int direction); + +/* + * Traverse the links of the current field in the given direction until + * either a active & visible field is found or we return to the current + * field. Direction is the REQ_{LEFT,RIGHT,UP,DOWN}_FIELD driver commands. + * The function returns E_OK if a valid field is found, E_REQUEST_DENIED + * otherwise. + */ +static int +traverse_form_links(FORM *form, int direction) +{ + unsigned idx; + + idx = form->cur_field; + + do { + switch (direction) { + case REQ_LEFT_FIELD: + if (form->fields[idx]->left == NULL) + return E_REQUEST_DENIED; + idx = form->fields[idx]->left->index; + break; + + case REQ_RIGHT_FIELD: + if (form->fields[idx]->right == NULL) + return E_REQUEST_DENIED; + idx = form->fields[idx]->right->index; + break; + + case REQ_UP_FIELD: + if (form->fields[idx]->up == NULL) + return E_REQUEST_DENIED; + idx = form->fields[idx]->up->index; + break; + + case REQ_DOWN_FIELD: + if (form->fields[idx]->down == NULL) + return E_REQUEST_DENIED; + idx = form->fields[idx]->down->index; + break; + + default: + return E_REQUEST_DENIED; + } + + if ((form->fields[idx]->opts & (O_ACTIVE | O_VISIBLE)) + == (O_ACTIVE | O_VISIBLE)) { + form->cur_field = idx; + return E_OK; + } + } while (idx != form->cur_field); + + return E_REQUEST_DENIED; +} + +int +form_driver(FORM *form, int c) +{ + FIELD *fieldp; + int update_page, update_field, old_field, old_page, status; + int start_field; + unsigned int pos; + + if (form == NULL) + return E_BAD_ARGUMENT; + + if ((form->fields == NULL) || (*(form->fields) == NULL)) + return E_INVALID_FIELD; + + if (form->posted != 1) + return E_NOT_POSTED; + + if (form->in_init == 1) + return E_BAD_STATE; + + + old_field = start_field = form->cur_field; + fieldp = form->fields[form->cur_field]; + update_page = update_field = 0; + status = E_OK; + + if (c < REQ_MIN_REQUEST) { + if (isprint(c) || isblank(c)) { + do { + pos = fieldp->start_char + fieldp->row_xpos; + + /* check if we are allowed to edit this field */ + if ((fieldp->opts & O_EDIT) != O_EDIT) + return E_REQUEST_DENIED; + + if ((status = + (_formi_add_char(fieldp, pos, c))) + == E_REQUEST_DENIED) { + + /* + * Need to check here if we + * want to autoskip. we + * call the form driver + * recursively to pos us on + * the next field and then + * we loop back to ensure + * the next field selected + * can have data added to it + */ + if ((fieldp->opts & O_AUTOSKIP) + != O_AUTOSKIP) + return E_REQUEST_DENIED; + status = form_driver(form, + REQ_NEXT_FIELD); + if (status != E_OK) + return status; + + /* + * check if we have looped + * around all the fields. + * This can easily happen if + * all the fields are full. + */ + if (start_field == form->cur_field) + return E_REQUEST_DENIED; + + old_field = form->cur_field; + fieldp = form->fields[form->cur_field]; + status = _formi_add_char(fieldp, + fieldp->start_char + + fieldp->cursor_xpos, + c); + } else if (status == E_INVALID_FIELD) + /* char failed validation, just + * return the status. + */ + return status; + else if (status == E_NO_ROOM) + /* we will get this if the line + * wrapping fails. Deny the + * request. + */ + return E_REQUEST_DENIED; + } + while (status != E_OK); + update_field = (status == E_OK); + } else + return E_REQUEST_DENIED; + } else { + if (c > REQ_MAX_COMMAND) + return E_UNKNOWN_COMMAND; + + if ((c >= REQ_NEXT_PAGE) && (c <= REQ_DOWN_FIELD)) { + /* first check the field we are in is ok */ + if (_formi_validate_field(form) != E_OK) + return E_INVALID_FIELD; + + if (form->field_term != NULL) + form->field_term(form); + + /* + * if we have a page movement then the form term + * needs to be called too + */ + if ((c <= REQ_LAST_PAGE) && (form->form_term != NULL)) + form->form_term(form); + } + + + switch (c) { + case REQ_NEXT_PAGE: + if (form->page < form->max_page) { + old_page = form->page; + form->page++; + update_page = 1; + if (_formi_pos_first_field(form) != E_OK) { + form->page = old_page; + status = E_REQUEST_DENIED; + } + } else + status = E_REQUEST_DENIED; + break; + + case REQ_PREV_PAGE: + if (form->page > 0) { + old_page = form->page; + form->page--; + update_page = 1; + if (_formi_pos_first_field(form) != E_OK) { + form->page = old_page; + status = E_REQUEST_DENIED; + } + } else + status = E_REQUEST_DENIED; + break; + + case REQ_FIRST_PAGE: + old_page = form->page; + form->page = 0; + update_page = 1; + if (_formi_pos_first_field(form) != E_OK) { + form->page = old_page; + status = E_REQUEST_DENIED; + } + break; + + case REQ_LAST_PAGE: + old_page = form->page; + form->page = form->max_page - 1; + update_page = 1; + if (_formi_pos_first_field(form) != E_OK) { + form->page = old_page; + status = E_REQUEST_DENIED; + } + break; + + case REQ_NEXT_FIELD: + status = _formi_pos_new_field(form, _FORMI_FORWARD, + FALSE); + update_field = 1; + break; + + case REQ_PREV_FIELD: + status = _formi_pos_new_field(form, _FORMI_BACKWARD, + FALSE); + update_field = 1; + break; + + case REQ_FIRST_FIELD: + form->cur_field = 0; + update_field = 1; + break; + + case REQ_LAST_FIELD: + form->cur_field = form->field_count - 1; + update_field = 1; + break; + + case REQ_SNEXT_FIELD: + status = _formi_pos_new_field(form, _FORMI_FORWARD, + TRUE); + update_field = 1; + break; + + case REQ_SPREV_FIELD: + status = _formi_pos_new_field(form, _FORMI_BACKWARD, + TRUE); + update_field = 1; + break; + + case REQ_SFIRST_FIELD: + fieldp = TAILQ_FIRST(&form->sorted_fields); + form->cur_field = fieldp->index; + update_field = 1; + break; + + case REQ_SLAST_FIELD: + fieldp = TAILQ_LAST(&form->sorted_fields, + _formi_sort_head); + form->cur_field = fieldp->index; + update_field = 1; + break; + + /* + * The up, down, left and right field traversals + * are rolled up into a single function, allow a + * fall through to that function. + */ + case REQ_LEFT_FIELD: + case REQ_RIGHT_FIELD: + case REQ_UP_FIELD: + case REQ_DOWN_FIELD: + status = traverse_form_links(form, c); + update_field = 1; + break; + + /* the following commands modify the buffer, check if + this is allowed first before falling through. */ + + case REQ_DEL_PREV: + /* + * need to check for the overloading of this + * request. If overload flag set and we are + * at the start of field this request turns + * into a previous field request. Otherwise + * fallthrough to the field handler. + */ + if ((form->opts & O_BS_OVERLOAD) == O_BS_OVERLOAD) { + if ((fieldp->start_char == 0) && + (fieldp->start_line == 0) && + (fieldp->row_xpos == 0)) { + update_field = + _formi_manipulate_field(form, + REQ_PREV_FIELD); + break; + } + } + + /* FALLTHROUGH */ + case REQ_NEW_LINE: + /* + * need to check for the overloading of this + * request. If overload flag set and we are + * at the start of field this request turns + * into a next field request. Otherwise + * fallthrough to the field handler. + */ + if ((form->opts & O_NL_OVERLOAD) == O_NL_OVERLOAD) { + if ((fieldp->start_char == 0) && + (fieldp->start_line == 0) && + (fieldp->row_xpos == 0)) { + update_field = + _formi_manipulate_field(form, + REQ_NEXT_FIELD); + break; + } + } + + /* FALLTHROUGH */ + case REQ_INS_CHAR: + case REQ_INS_LINE: + case REQ_DEL_CHAR: + case REQ_DEL_LINE: + case REQ_DEL_WORD: + case REQ_CLR_EOL: + case REQ_CLR_EOF: + case REQ_CLR_FIELD: + case REQ_OVL_MODE: + case REQ_INS_MODE: + /* check if we are allowed to edit the field and fall + * through if we are. + */ + if ((form->fields[form->cur_field]->opts & O_EDIT) != O_EDIT) + return E_REQUEST_DENIED; + + /* the following manipulate the field contents, bundle + them into one function.... */ + /* FALLTHROUGH */ + case REQ_NEXT_CHAR: + case REQ_PREV_CHAR: + case REQ_NEXT_LINE: + case REQ_PREV_LINE: + case REQ_NEXT_WORD: + case REQ_PREV_WORD: + case REQ_BEG_FIELD: + case REQ_END_FIELD: + case REQ_BEG_LINE: + case REQ_END_LINE: + case REQ_LEFT_CHAR: + case REQ_RIGHT_CHAR: + case REQ_UP_CHAR: + case REQ_DOWN_CHAR: + case REQ_SCR_FLINE: + case REQ_SCR_BLINE: + case REQ_SCR_FPAGE: + case REQ_SCR_BPAGE: + case REQ_SCR_FHPAGE: + case REQ_SCR_BHPAGE: + case REQ_SCR_FCHAR: + case REQ_SCR_BCHAR: + case REQ_SCR_HFLINE: + case REQ_SCR_HBLINE: + case REQ_SCR_HFHALF: + case REQ_SCR_HBHALF: + update_field = _formi_manipulate_field(form, c); + break; + + case REQ_VALIDATION: + return _formi_validate_field(form); + /* NOTREACHED */ + break; + + case REQ_PREV_CHOICE: + case REQ_NEXT_CHOICE: + update_field = _formi_field_choice(form, c); + /* reinit the cursor pos just in case */ + if (update_field == 1) { + _formi_init_field_xpos(fieldp); + fieldp->row_xpos = 0; + } + break; + + default: /* should not need to do this, but.... */ + return E_UNKNOWN_COMMAND; + /* NOTREACHED */ + break; + } + } + + /* call the field and form init functions if required. */ + if ((c >= REQ_NEXT_PAGE) && (c <= REQ_DOWN_FIELD)) { + if (form->field_init != NULL) + form->field_init(form); + + /* + * if we have a page movement then the form init + * needs to be called too + */ + if ((c <= REQ_LAST_PAGE) && (form->form_init != NULL)) + form->form_init(form); + + /* + * if there was an error just return now... + */ + if (status != E_OK) + return status; + + /* if we have no error, reset the various offsets */ + fieldp = form->fields[form->cur_field]; + fieldp->start_char = 0; + fieldp->start_line = fieldp->alines; + fieldp->cur_line = fieldp->alines; + fieldp->row_xpos = 0; + fieldp->cursor_ypos = 0; + _formi_init_field_xpos(fieldp); + } + + if (update_field < 0) + return update_field; + + if (update_field == 1) + update_page |= _formi_update_field(form, old_field); + + if (update_page == 1) + _formi_draw_page(form); + + pos_form_cursor(form); + + if ((update_page == 1) || (update_field == 1)) + wrefresh(form->scrwin); + + return E_OK; +} diff --git a/vendor/netbsd-curses/libform/dup_field.3 b/vendor/netbsd-curses/libform/dup_field.3 new file mode 120000 index 0000000..2375069 --- /dev/null +++ b/vendor/netbsd-curses/libform/dup_field.3 @@ -0,0 +1 @@ +form_field_new.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/dynamic_field_info.3 b/vendor/netbsd-curses/libform/dynamic_field_info.3 new file mode 120000 index 0000000..315db04 --- /dev/null +++ b/vendor/netbsd-curses/libform/dynamic_field_info.3 @@ -0,0 +1 @@ +form_field_info.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field.c b/vendor/netbsd-curses/libform/field.c new file mode 100644 index 0000000..5adc56b --- /dev/null +++ b/vendor/netbsd-curses/libform/field.c @@ -0,0 +1,927 @@ +/* $NetBSD: field.c,v 1.32 2021/04/13 13:13:03 christos Exp $ */ +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include +#include +#include "internals.h" + +extern FORM _formi_default_form; + +FIELD _formi_default_field = { + 0, /* rows in the field */ + 0, /* columns in the field */ + 0, /* dynamic rows */ + 0, /* dynamic columns */ + 0, /* maximum growth */ + 0, /* starting row in the form subwindow */ + 0, /* starting column in the form subwindow */ + 0, /* number of off screen rows */ + 0, /* index of this field in form fields array. */ + 0, /* number of buffers associated with this field */ + FALSE, /* set to true if buffer 0 has changed. */ + NO_JUSTIFICATION, /* justification style of the field */ + FALSE, /* set to true if field is in overlay mode */ + NULL, /* pointer to the current line cursor is on */ + 0, /* starting char in string (horiz scroll) */ + NULL, /* starting line in field (vert scroll) */ + 0, /* number of rows actually used in field */ + 0, /* actual pos of cursor in row, not same as x pos due to tabs */ + 0, /* x pos of cursor in field */ + 0, /* y pos of cursor in field */ + 0, /* start of a new page on the form if 1 */ + 0, /* number of the page this field is on */ + A_NORMAL, /* character attributes for the foreground */ + A_NORMAL, /* character attributes for the background */ + ' ', /* padding character */ + DEFAULT_FORM_OPTS, /* options for the field */ + NULL, /* the form this field is bound to, if any */ + NULL, /* field above this one */ + NULL, /* field below this one */ + NULL, /* field to the left of this one */ + NULL, /* field to the right of this one */ + NULL, /* user defined pointer. */ + NULL, /* used if fields are linked */ + NULL, /* type struct for the field */ + {NULL, NULL}, /* circle queue glue for sorting fields */ + NULL, /* args for field type. */ + NULL, /* pointer to the array of lines structures. */ + NULL, /* list of lines available for reuse */ + NULL, /* array of buffers for the field */ +}; + +/* internal function prototypes */ +static int +field_buffer_init(FIELD *field, int buffer, unsigned int len); +static FIELD * +_formi_create_field(FIELD *, int, int, int, int, int, int); + + +/* + * Set the userptr for the field + */ +int +set_field_userptr(FIELD *field, void *ptr) +{ + FIELD *fp = (field == NULL) ? &_formi_default_field : field; + + fp->userptr = ptr; + + return E_OK; +} + +/* + * Return the userptr for the field. + */ + +void * +field_userptr(FIELD *field) +{ + if (field == NULL) + return _formi_default_field.userptr; + else + return field->userptr; +} + +/* + * Set the options for the designated field. + */ +int +set_field_opts(FIELD *field, Form_Options options) +{ + int i; + + FIELD *fp = (field == NULL) ? &_formi_default_field : field; + + /* not allowed to set opts if the field is the current one */ + if ((field != NULL) && (field->parent != NULL) && + (field->parent->cur_field == field->index)) + return E_CURRENT; + + if ((options & O_STATIC) == O_STATIC) { + for (i = 0; i < fp->nbuf; i++) { + if (fp->buffers[i].length > fp->cols) + fp->buffers[i].string[fp->cols] = '\0'; + } + } + + fp->opts = options; + + /* if appropriate, redraw the field */ + if ((field != NULL) && (field->parent != NULL) + && (field->parent->posted == 1)) { + _formi_redraw_field(field->parent, field->index); + pos_form_cursor(field->parent); + wrefresh(field->parent->scrwin); + } + + return E_OK; +} + +/* + * Turn on the passed field options. + */ +int +field_opts_on(FIELD *field, Form_Options options) +{ + int i; + + FIELD *fp = (field == NULL) ? &_formi_default_field : field; + + /* not allowed to set opts if the field is the current one */ + if ((field != NULL) && (field->parent != NULL) && + (field->parent->cur_field == field->index)) + return E_CURRENT; + + if ((options & O_STATIC) == O_STATIC) { + for (i = 0; i < fp->nbuf; i++) { + if (fp->buffers[i].length > fp->cols) + fp->buffers[i].string[fp->cols] = '\0'; + } + } + + fp->opts |= options; + + /* if appropriate, redraw the field */ + if ((field != NULL) && (field->parent != NULL) + && (field->parent->posted == 1)) { + _formi_redraw_field(field->parent, field->index); + pos_form_cursor(field->parent); + wrefresh(field->parent->scrwin); + } + + return E_OK; +} + +/* + * Turn off the passed field options. + */ +int +field_opts_off(FIELD *field, Form_Options options) +{ + FIELD *fp = (field == NULL) ? &_formi_default_field : field; + + /* not allowed to set opts if the field is the current one */ + if ((field != NULL) && (field->parent != NULL) && + (field->parent->cur_field == field->index)) + return E_CURRENT; + + fp->opts &= ~options; + + /* if appropriate, redraw the field */ + if ((field != NULL) && (field->parent != NULL) + && (field->parent->posted == 1)) { + _formi_redraw_field(field->parent, field->index); + pos_form_cursor(field->parent); + wrefresh(field->parent->scrwin); + } + + return E_OK; +} + +/* + * Return the field options associated with the passed field. + */ +Form_Options +field_opts(FIELD *field) +{ + if (field == NULL) + return _formi_default_field.opts; + else + return field->opts; +} + +/* + * Set the justification for the passed field. + */ +int +set_field_just(FIELD *field, int justification) +{ + FIELD *fp = (field == NULL) ? &_formi_default_field : field; + + /* + * not allowed to set justification if the field is + * the current one + */ + if ((field != NULL) && (field->parent != NULL) && + (field->parent->cur_field == field->index)) + return E_CURRENT; + + if ((justification < MIN_JUST_STYLE) /* check justification valid */ + || (justification > MAX_JUST_STYLE)) + return E_BAD_ARGUMENT; + + /* only allow justification on static, single row fields */ + if (((fp->opts & O_STATIC) != O_STATIC) || + ((fp->rows + fp->nrows) > 1)) + return E_BAD_ARGUMENT; + + fp->justification = justification; + + _formi_init_field_xpos(fp); + + return E_OK; +} + +/* + * Return the justification style of the field passed. + */ +int +field_just(FIELD *field) +{ + if (field == NULL) + return _formi_default_field.justification; + else + return field->justification; +} + +/* + * Return information about the field passed. + */ +int +field_info(FIELD *field, int *rows, int *cols, int *frow, int *fcol, + int *nrow, int *nbuf) +{ + if (field == NULL) + return E_BAD_ARGUMENT; + + *rows = field->rows; + *cols = field->cols; + *frow = field->form_row; + *fcol = field->form_col; + *nrow = field->nrows; + *nbuf = field->nbuf; + + return E_OK; +} + +/* + * Report the dynamic field information. + */ +int +dynamic_field_info(FIELD *field, int *drows, int *dcols, int *max) +{ + if (field == NULL) + return E_BAD_ARGUMENT; + + if ((field->opts & O_STATIC) == O_STATIC) { + *drows = field->rows; + *dcols = field->cols; + } else { + *drows = field->drows; + *dcols = field->dcols; + } + + *max = field->max; + + return E_OK; +} + +/* + * Init all the field variables, perform wrapping and other tasks + * after the field buffer is set. + */ +static int +field_buffer_init(FIELD *field, int buffer, unsigned int len) +{ + int status; + char *newp; + + if (buffer == 0) { + field->start_char = 0; + field->start_line = 0; + field->row_xpos = 0; + field->cursor_xpos = 0; + field->cursor_ypos = 0; + field->row_count = 1; /* must be at least one row XXX need to shift old rows (if any) to free list??? */ + field->alines->length = len; + if ((newp = realloc(field->alines->string, + (size_t) len + 1)) == NULL) + return E_SYSTEM_ERROR; + field->alines->string = newp; + field->alines->allocated = len + 1; + snprintf(field->alines->string, len + 1, "%s", field->buffers[buffer].string); + field->alines->expanded = + _formi_tab_expanded_length(field->alines->string, + 0, field->alines->length); + + field->start_line = field->alines; + field->cur_line = field->alines; + + /* we have to hope the wrap works - if it does not then the + buffer is pretty much borked */ + status = _formi_wrap_field(field, field->cur_line); + if (status != E_OK) + return status; + + /* + * calculate the tabs for a single row field, the + * multiline case is handled when the wrap is done. + */ + if (field->row_count == 1) + _formi_calculate_tabs(field->alines); + + /* redraw the field to reflect the new contents. If the field + * is attached.... + */ + if ((field->parent != NULL) && (field->parent->posted == 1)) { + _formi_redraw_field(field->parent, field->index); + /* make sure cursor goes back to current field */ + pos_form_cursor(field->parent); + } + } + + return E_OK; +} + + +/* + * Set the field buffer to the string that results from processing + * the given format (fmt) using sprintf. + */ +int +set_field_printf(FIELD *field, int buffer, char *fmt, ...) +{ + int len; + va_list args; + + if (field == NULL) + return E_BAD_ARGUMENT; + + if (buffer >= field->nbuf) + return E_BAD_ARGUMENT; + + va_start(args, fmt); + /* check for buffer already existing, free the storage */ + if (field->buffers[buffer].allocated != 0) + free(field->buffers[buffer].string); + + len = vasprintf(&field->buffers[buffer].string, fmt, args); + va_end(args); + if (len < 0) + return E_SYSTEM_ERROR; + + field->buffers[buffer].length = len; + field->buffers[buffer].allocated = len + 1; + if (((field->opts & O_STATIC) == O_STATIC) && (len > field->cols) + && ((field->rows + field->nrows) == 1)) + len = field->cols; + + field->buffers[buffer].string[len] = '\0'; + return field_buffer_init(field, buffer, (unsigned int) len); +} + +/* + * Set the value of the field buffer to the value given. + */ + +int +set_field_buffer(FIELD *field, int buffer, const char *value) +{ + unsigned int len; + int status; + + if (field == NULL) + return E_BAD_ARGUMENT; + + if (buffer >= field->nbuf) /* make sure buffer is valid */ + return E_BAD_ARGUMENT; + + len = (unsigned int) strlen(value); + if (((field->opts & O_STATIC) == O_STATIC) && (len > field->cols) + && ((field->rows + field->nrows) == 1)) + len = field->cols; + + _formi_dbg_printf( "%s: len = %d, value = %s, buffer=%d\n", __func__, + len, value, buffer); + if (field->buffers[buffer].string != NULL) + _formi_dbg_printf("%s: string=%s, len = %d\n", __func__, + field->buffers[buffer].string, + field->buffers[buffer].length); + else + _formi_dbg_printf("%s: string=(null), len = 0\n", __func__); + _formi_dbg_printf("%s: lines.len = %d\n", __func__, + field->alines[0].length); + + if ((field->buffers[buffer].string = realloc( + field->buffers[buffer].string, (size_t) len + 1)) == NULL) + return E_SYSTEM_ERROR; + + snprintf(field->buffers[buffer].string, len + 1, "%s", value); + field->buffers[buffer].length = len; + field->buffers[buffer].allocated = len + 1; + status = field_buffer_init(field, buffer, len); + + _formi_dbg_printf("%s: len = %d, value = %s\n", __func__, len, value); + _formi_dbg_printf("%s: string = %s, len = %d\n", __func__, + field->buffers[buffer].string, field->buffers[buffer].length); + _formi_dbg_printf("%s: lines.len = %d\n", __func__, + field->alines[0].length); + + return status; +} + +/* + * Return the requested field buffer to the caller. + */ +char * +field_buffer(FIELD *field, int buffer) +{ + + char *reformat, *p; + _FORMI_FIELD_LINES *linep; + size_t bufsize, pos; + + if (field == NULL) + return NULL; + + if (buffer >= field->nbuf) + return NULL; + + /* + * We force a sync from the line structs to the buffer here. + * Traditional libform say we don't need to because it is + * done on a REQ_VALIDATE but NetBSD libform previously did + * not enforce this because the buffer contents were always + * current. Changes to line handling make this no longer so + * - the line structs may contain different data to the + * buffer if unsynced. + */ + if (_formi_sync_buffer(field) != E_OK) + return NULL; + + if ((field->opts & O_REFORMAT) != O_REFORMAT) + return field->buffers[buffer].string; + + if (field->row_count <= 1) + return strdup(field->buffers[buffer].string); + + /* + * create a single string containing each line, + * separated by newline, last line having no + * newline, but NUL terminated. + */ + bufsize = pos = 0; + reformat = NULL; + for (linep = field->alines; linep; linep = linep->next) { + size_t len = strlen(linep->string); + if (len + 1 >= bufsize - pos) { + bufsize += MAX(1024, 2 * len); + p = realloc(reformat, bufsize); + if (p == NULL) { + free(reformat); + return NULL; + } + reformat = p; + } + memcpy(reformat + pos, linep->string, len); + pos += len; + reformat[pos++] = linep->next ? '\n' : '\0'; + } + return reformat; +} + +/* + * Set the buffer 0 field status. + */ +int +set_field_status(FIELD *field, int status) +{ + + if (field == NULL) + return E_BAD_ARGUMENT; + + if (status != FALSE) + field->buf0_status = TRUE; + else + field->buf0_status = FALSE; + + return E_OK; +} + +/* + * Return the buffer 0 status flag for the given field. + */ +int +field_status(FIELD *field) +{ + + if (field == NULL) /* the default buffer 0 never changes :-) */ + return FALSE; + + return field->buf0_status; +} + +/* + * Set the maximum growth for a dynamic field. + */ +int +set_max_field(FIELD *fptr, int max) +{ + FIELD *field = (fptr == NULL)? &_formi_default_field : fptr; + + if ((field->opts & O_STATIC) == O_STATIC) /* check if field dynamic */ + return E_BAD_ARGUMENT; + + if (max < 0) /* negative numbers are bad.... */ + return E_BAD_ARGUMENT; + + field->max = max; + return E_OK; +} + +/* + * Set the field foreground character attributes. + */ +int +set_field_fore(FIELD *fptr, chtype attribute) +{ + FIELD *field = (fptr == NULL)? &_formi_default_field : fptr; + + field->fore = attribute; + return E_OK; +} + +/* + * Return the foreground character attribute for the given field. + */ +chtype +field_fore(FIELD *field) +{ + if (field == NULL) + return _formi_default_field.fore; + else + return field->fore; +} + +/* + * Set the background character attribute for the given field. + */ +int +set_field_back(FIELD *field, chtype attribute) +{ + if (field == NULL) + _formi_default_field.back = attribute; + else + field->back = attribute; + + return E_OK; +} + +/* + * Get the background character attribute for the given field. + */ +chtype +field_back(FIELD *field) +{ + if (field == NULL) + return _formi_default_field.back; + else + return field->back; +} + +/* + * Set the pad character for the given field. + */ +int +set_field_pad(FIELD *field, int pad) +{ + if (field == NULL) + _formi_default_field.pad = pad; + else + field->pad = pad; + + return E_OK; +} + +/* + * Return the padding character for the given field. + */ +int +field_pad(FIELD *field) +{ + if (field == NULL) + return _formi_default_field.pad; + else + return field->pad; +} + +/* + * Set the field initialisation function hook. + */ +int +set_field_init(FORM *form, Form_Hook function) +{ + if (form == NULL) + _formi_default_form.field_init = function; + else + form->field_init = function; + + return E_OK; +} + +/* + * Return the function hook for the field initialisation. + */ +Form_Hook +field_init(FORM *form) +{ + if (form == NULL) + return _formi_default_form.field_init; + else + return form->field_init; +} + +/* + * Set the field termination function hook. + */ +int +set_field_term(FORM *form, Form_Hook function) +{ + if (form == NULL) + _formi_default_form.field_term = function; + else + form->field_term = function; + + return E_OK; +} + +/* + * Return the function hook defined for the field termination. + */ +Form_Hook +field_term(FORM *form) +{ + if (form == NULL) + return _formi_default_form.field_term; + else + return form->field_term; +} + +/* + * Set the page flag on the given field to indicate it is the start of a + * new page. + */ +int +set_new_page(FIELD *fptr, int page) +{ + FIELD *field = (fptr == NULL)? &_formi_default_field : fptr; + + if (field->parent != NULL) /* check if field is connected to a form */ + return E_CONNECTED; + + field->page_break = (page != FALSE); + return E_OK; +} + +/* + * Return the page status for the given field. TRUE is returned if the + * field is the start of a new page. + */ +int +new_page(FIELD *field) +{ + if (field == NULL) + return _formi_default_field.page_break; + else + return field->page_break; +} + +/* + * Return the index of the field in the form fields array. + */ +int +field_index(FIELD *field) +{ + if (field == NULL) + return E_BAD_ARGUMENT; + + if (field->parent == NULL) + return E_NOT_CONNECTED; + + return field->index; +} + +/* + * Internal function that does most of the work to create a new field. + * The new field is initialised from the information in the prototype + * field passed. + * Returns NULL on error. + */ +static FIELD * +_formi_create_field(FIELD *prototype, int rows, int cols, int frow, + int fcol, int nrows, int nbuf) +{ + FIELD *new; + + if ((rows <= 0) || (cols <= 0) || (frow < 0) || (fcol < 0) || + (nrows < 0) || (nbuf < 0)) + return NULL; + + if ((new = malloc(sizeof(*new))) == NULL) { + return NULL; + } + + /* copy in the default field info */ + memcpy(new, prototype, sizeof(*new)); + + new->nbuf = nbuf + 1; + new->rows = rows; + new->cols = cols; + new->form_row = frow; + new->form_col = fcol; + new->nrows = nrows; + new->link = new; + return new; +} + +/* + * Create a new field structure. + */ +FIELD * +new_field(int rows, int cols, int frow, int fcol, int nrows, int nbuf) +{ + FIELD *new; + int i; + + + if ((new = _formi_create_field(&_formi_default_field, rows, cols, + frow, fcol, nrows, nbuf)) == NULL) + return NULL; + + if ((new->buffers = calloc(nbuf + 1, sizeof(*new->buffers))) == NULL) { + free(new); + return NULL; + } + + /* Initialise the strings to a zero length string */ + for (i = 0; i < nbuf + 1; i++) { + if ((new->buffers[i].string = + malloc(sizeof(*new->buffers[i].string))) == NULL) { + goto out; + } + new->buffers[i].string[0] = '\0'; + new->buffers[i].length = 0; + new->buffers[i].allocated = 1; + } + + if ((new->alines = malloc(sizeof(*new->alines))) == NULL) { + goto out; + } + + new->alines->prev = NULL; + new->alines->next = NULL; + new->alines->allocated = 0; + new->alines->length = 0; + new->alines->expanded = 0; + new->alines->string = NULL; + new->alines->hard_ret = FALSE; + new->alines->tabs = NULL; + new->start_line = new->alines; + new->cur_line = new->alines; + + return new; +out: + while (--i >= 0) { + free(new->buffers[i].string); + } + free(new->buffers); + free(new); + return NULL; +} + +/* + * Duplicate the given field, including its buffers. + */ +FIELD * +dup_field(FIELD *field, int frow, int fcol) +{ + FIELD *new; + size_t row_len, buf_len; + + if (field == NULL) + return NULL; + + /* XXX: this right???? */ + if ((new = _formi_create_field(field, (int) field->rows, + (int) field->cols, + frow, fcol, (int) field->nrows, + field->nbuf - 1)) == NULL) + return NULL; + + row_len = (field->rows + field->nrows + 1) * field->cols; + buf_len = (field->nbuf + 1) * row_len * sizeof(*new->buffers); + + /* XXX: dups buffers but not their strings? */ + if ((new->buffers = malloc(buf_len)) == NULL) { + free(new); + return NULL; + } + + /* copy the buffers from the source field into the new copy */ + memcpy(new->buffers, field->buffers, buf_len); + + return new; +} + +/* + * Create a new field at the specified location by duplicating the given + * field. The buffers are shared with the parent field. + */ +FIELD * +link_field(FIELD *field, int frow, int fcol) +{ + FIELD *new; + + if (field == NULL) + return NULL; + + if ((new = _formi_create_field(field, (int) field->rows, + (int) field->cols, + frow, fcol, (int) field->nrows, + field->nbuf - 1)) == NULL) + return NULL; + + new->link = field->link; + field->link = new; + + /* we are done. The buffer pointer was copied during the field + creation. */ + return new; +} + +/* + * Release all storage allocated to the field + */ +int +free_field(FIELD *field) +{ + FIELD *flink; + unsigned int i; + _formi_tab_t *ts, *nts; + + if (field == NULL) + return E_BAD_ARGUMENT; + + if (field->parent != NULL) + return E_CONNECTED; + + if (field->link == field) { /* check if field linked */ + /* no it is not - release the buffers */ + free(field->buffers); + /* free the tab structures */ + for (i = 0; i + 1 < field->row_count; i++) { + if (field->alines[i].tabs != NULL) { + ts = field->alines[i].tabs; + while (ts != NULL) { + nts = ts->fwd; + free(ts); + ts = nts; + } + } + } + } else { + /* is linked, traverse the links to find the field referring + * to the one to be freed. + */ + for (flink = field->link; flink != field; flink = flink->link); + flink->link = field->link; + } + + free(field); + return E_OK; +} + + diff --git a/vendor/netbsd-curses/libform/field_arg.3 b/vendor/netbsd-curses/libform/field_arg.3 new file mode 120000 index 0000000..28e31c8 --- /dev/null +++ b/vendor/netbsd-curses/libform/field_arg.3 @@ -0,0 +1 @@ +form_field_validation.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_back.3 b/vendor/netbsd-curses/libform/field_back.3 new file mode 120000 index 0000000..0a8d84c --- /dev/null +++ b/vendor/netbsd-curses/libform/field_back.3 @@ -0,0 +1 @@ +form_field_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_buffer.3 b/vendor/netbsd-curses/libform/field_buffer.3 new file mode 120000 index 0000000..4e098fe --- /dev/null +++ b/vendor/netbsd-curses/libform/field_buffer.3 @@ -0,0 +1 @@ +form_field_buffer.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_count.3 b/vendor/netbsd-curses/libform/field_count.3 new file mode 120000 index 0000000..454d191 --- /dev/null +++ b/vendor/netbsd-curses/libform/field_count.3 @@ -0,0 +1 @@ +form_field.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_fore.3 b/vendor/netbsd-curses/libform/field_fore.3 new file mode 120000 index 0000000..0a8d84c --- /dev/null +++ b/vendor/netbsd-curses/libform/field_fore.3 @@ -0,0 +1 @@ +form_field_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_index.3 b/vendor/netbsd-curses/libform/field_index.3 new file mode 120000 index 0000000..c7d47c5 --- /dev/null +++ b/vendor/netbsd-curses/libform/field_index.3 @@ -0,0 +1 @@ +form_page.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_info.3 b/vendor/netbsd-curses/libform/field_info.3 new file mode 120000 index 0000000..315db04 --- /dev/null +++ b/vendor/netbsd-curses/libform/field_info.3 @@ -0,0 +1 @@ +form_field_info.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_init.3 b/vendor/netbsd-curses/libform/field_init.3 new file mode 120000 index 0000000..762e14b --- /dev/null +++ b/vendor/netbsd-curses/libform/field_init.3 @@ -0,0 +1 @@ +form_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_just.3 b/vendor/netbsd-curses/libform/field_just.3 new file mode 120000 index 0000000..d312d75 --- /dev/null +++ b/vendor/netbsd-curses/libform/field_just.3 @@ -0,0 +1 @@ +form_field_just.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_opts.3 b/vendor/netbsd-curses/libform/field_opts.3 new file mode 120000 index 0000000..f1bebb3 --- /dev/null +++ b/vendor/netbsd-curses/libform/field_opts.3 @@ -0,0 +1 @@ +form_field_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_opts_off.3 b/vendor/netbsd-curses/libform/field_opts_off.3 new file mode 120000 index 0000000..f1bebb3 --- /dev/null +++ b/vendor/netbsd-curses/libform/field_opts_off.3 @@ -0,0 +1 @@ +form_field_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_opts_on.3 b/vendor/netbsd-curses/libform/field_opts_on.3 new file mode 120000 index 0000000..f1bebb3 --- /dev/null +++ b/vendor/netbsd-curses/libform/field_opts_on.3 @@ -0,0 +1 @@ +form_field_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_pad.3 b/vendor/netbsd-curses/libform/field_pad.3 new file mode 120000 index 0000000..0a8d84c --- /dev/null +++ b/vendor/netbsd-curses/libform/field_pad.3 @@ -0,0 +1 @@ +form_field_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_status.3 b/vendor/netbsd-curses/libform/field_status.3 new file mode 120000 index 0000000..4e098fe --- /dev/null +++ b/vendor/netbsd-curses/libform/field_status.3 @@ -0,0 +1 @@ +form_field_buffer.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_term.3 b/vendor/netbsd-curses/libform/field_term.3 new file mode 120000 index 0000000..762e14b --- /dev/null +++ b/vendor/netbsd-curses/libform/field_term.3 @@ -0,0 +1 @@ +form_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_type.3 b/vendor/netbsd-curses/libform/field_type.3 new file mode 120000 index 0000000..28e31c8 --- /dev/null +++ b/vendor/netbsd-curses/libform/field_type.3 @@ -0,0 +1 @@ +form_field_validation.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/field_types.c b/vendor/netbsd-curses/libform/field_types.c new file mode 100644 index 0000000..85ae1dd --- /dev/null +++ b/vendor/netbsd-curses/libform/field_types.c @@ -0,0 +1,273 @@ +/* $NetBSD: field_types.c,v 1.7 2006/03/19 20:02:27 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include +#include +#include "form.h" +#include "internals.h" + +extern FIELD _formi_default_field; + +/* function prototypes.... */ +static void +_formi_create_field_args(FIELDTYPE *type, char **type_args, + formi_type_link **link, va_list *args, int *error); +static FIELDTYPE * +_formi_create_fieldtype(void); + +/* + * Process the arguments, if any, for the field type. + */ +static void +_formi_create_field_args(FIELDTYPE *type, char **type_args, + formi_type_link **link, va_list *args, int *error) +{ + formi_type_link *l; + + l = NULL; + if ((type != NULL) + && ((type->flags & _TYPE_HAS_ARGS) == _TYPE_HAS_ARGS)) { + if ((type->flags & _TYPE_IS_LINKED) == _TYPE_IS_LINKED) { + l = malloc(sizeof(*l)); + if (l != NULL) { + _formi_create_field_args(type->link->next, + type_args, + &type->link->next->link, + args, + error); + _formi_create_field_args(type->link->prev, + type_args, + &type->link->prev->link, + args, + error); + (*link) = l; + } + + (*error)++; + } else { + if ((*type_args = (char *) type->make_args(args)) + == NULL) + (*error)++; + } + } +} + +/* + * Allocate a new fieldtype structure, initialise it and return the + * struct to the caller. + */ +static FIELDTYPE * +_formi_create_fieldtype(void) +{ + FIELDTYPE *new; + + if ((new = malloc(sizeof(*new))) == NULL) + return NULL; + + new->flags = _TYPE_NO_FLAGS; + new->refcount = 0; + new->link = NULL; + new->make_args = NULL; + new->copy_args = NULL; + new->free_args = NULL; + new->field_check = NULL; + new->char_check = NULL; + new->next_choice = NULL; + new->prev_choice = NULL; + + return new; +} + +/* + * Set the field type of the field to be the one given. + */ +int +set_field_type(FIELD *fptr, FIELDTYPE *type, ...) +{ + va_list args; + FIELD *field; + int error = 0; + + va_start(args, type); + + field = (fptr == NULL)? &_formi_default_field : fptr; + + field->type = type; + _formi_create_field_args(type, &field->args, &type->link, &args, + &error); + va_end(args); + + if (error) + return E_BAD_ARGUMENT; + + return E_OK; +} + +/* + * Return the field type associated with the given field + */ +FIELDTYPE * +field_type(FIELD *fptr) +{ + FIELD *field; + + field = (fptr == NULL)? &_formi_default_field : fptr; + + return field->type; +} + + +/* + * Return the field arguments for the given field. + */ +char * +field_arg(FIELD *fptr) +{ + FIELD *field; + + field = (fptr == NULL)? &_formi_default_field : fptr; + + return field->args; +} + +/* + * Create a new field type. Caller must specify a field_check routine + * and char_check routine. + */ +FIELDTYPE * +new_fieldtype(int (*field_check)(FIELD *, char *), + int (*char_check)(int, char *)) +{ + FIELDTYPE *new; + + if ((field_check == NULL) && (char_check == NULL)) + return NULL; + + if ((new = _formi_create_fieldtype()) != NULL) { + new->field_check = field_check; + new->char_check = char_check; + } + + return new; +} + +/* + * Free the storage used by the fieldtype. + */ +int +free_fieldtype(FIELDTYPE *fieldtype) +{ + if (fieldtype == NULL) + return E_BAD_ARGUMENT; + + if (fieldtype->refcount > 0) + return E_CONNECTED; + + if ((fieldtype->flags & _TYPE_IS_BUILTIN) == _TYPE_IS_BUILTIN) + return E_BAD_ARGUMENT; /* don't delete builtin types! */ + + if ((fieldtype->flags & _TYPE_IS_LINKED) == _TYPE_IS_LINKED) + { + fieldtype->link->next->refcount--; + fieldtype->link->prev->refcount--; + } + + free(fieldtype); + + return E_OK; +} + +/* + * Set the field type arguments for the given field type. + */ +int +set_fieldtype_arg(FIELDTYPE *fieldtype, char * (*make_args)(va_list *), + char * (*copy_args)(char*), void (*free_args)(char *)) +{ + if ((fieldtype == NULL) || (make_args == NULL) + || (copy_args == NULL) || (free_args == NULL)) + return E_BAD_ARGUMENT; + + fieldtype->make_args = make_args; + fieldtype->copy_args = copy_args; + fieldtype->free_args = free_args; + + return E_OK; +} + +/* + * Set up the choice list functions for the given fieldtype. + */ +int +set_fieldtype_choice(FIELDTYPE *fieldtype, int (*next_choice)(FIELD *, char *), + int (*prev_choice)(FIELD *, char *)) +{ + if ((fieldtype == NULL) || (next_choice == NULL) + || (prev_choice == NULL)) + return E_BAD_ARGUMENT; + + fieldtype->next_choice = next_choice; + fieldtype->prev_choice = prev_choice; + + return E_OK; +} + +/* + * Link the two given types to produce a new type, return this new type. + */ +FIELDTYPE * +link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2) +{ + FIELDTYPE *new; + + if ((type1 == NULL) || (type2 == NULL)) + return NULL; + + if ((new = _formi_create_fieldtype()) == NULL) + return NULL; + + new->flags = _TYPE_IS_LINKED; + new->flags |= ((type1->flags & _TYPE_HAS_ARGS) + | (type2->flags & _TYPE_HAS_ARGS)); + if ((new->link = malloc(sizeof(*new->link))) == NULL) { + free(new); + return NULL; + } + + new->link->prev = type1; + new->link->next = type2; + type1->refcount++; + type2->refcount++; + + return new; +} diff --git a/vendor/netbsd-curses/libform/field_userptr.3 b/vendor/netbsd-curses/libform/field_userptr.3 new file mode 120000 index 0000000..6f4ce49 --- /dev/null +++ b/vendor/netbsd-curses/libform/field_userptr.3 @@ -0,0 +1 @@ +form_field_userptr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/form.3 b/vendor/netbsd-curses/libform/form.3 new file mode 120000 index 0000000..c2a26c2 --- /dev/null +++ b/vendor/netbsd-curses/libform/form.3 @@ -0,0 +1 @@ +forms.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/form.c b/vendor/netbsd-curses/libform/form.c new file mode 100644 index 0000000..b3c0ecd --- /dev/null +++ b/vendor/netbsd-curses/libform/form.c @@ -0,0 +1,611 @@ +/* $NetBSD: form.c,v 1.17 2021/04/13 13:13:04 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include +#include + +#include +#include +#include +#include "internals.h" + +extern FIELD _formi_default_field; + +FORM _formi_default_form = { + FALSE, /* true if performing a init or term function */ + FALSE, /* the form is posted */ + FALSE, /* make field list circular if true */ + NULL, /* window for the form */ + NULL, /* subwindow for the form */ + NULL, /* use this window for output */ + NULL, /* user defined pointer */ + 0, /* options for the form */ + NULL, /* function called when form posted and + after page change */ + NULL, /* function called when form is unposted and + before page change */ + NULL, /* function called when form posted and after + current field changes */ + NULL, /* function called when form unposted and + before current field changes */ + 0, /* number of fields attached */ + 0, /* current field */ + 0, /* current page of form */ + 0, /* number of pages in the form */ + NULL, /* dynamic array of fields that start + the pages */ + {NULL, NULL}, /* sorted field list */ + NULL /* array of fields attached to this form. */ +}; + +/* + * Set the window associated with the form + */ +int +set_form_win(FORM *form, WINDOW *win) +{ + if (form == NULL) { + _formi_default_form.win = win; + _formi_default_form.scrwin = win; + } else { + if (form->posted == TRUE) + return E_POSTED; + else { + form->win = win; + form->scrwin = win; + } + } + + return E_OK; +} + +/* + * Return the window used by the given form + */ +WINDOW * +form_win(FORM *form) +{ + if (form == NULL) + return _formi_default_form.win; + else + return form->win; +} + +/* + * Set the subwindow for the form. + */ +int +set_form_sub(FORM *form, WINDOW *window) +{ + if (form == NULL) { + _formi_default_form.subwin = window; + _formi_default_form.scrwin = window; + } else { + if (form->posted == TRUE) + return E_POSTED; + else { + form->subwin = window; + form->scrwin = window; + } + } + + return E_OK; +} + +/* + * Return the subwindow for the given form. + */ +WINDOW * +form_sub(FORM *form) +{ + if (form == NULL) + return _formi_default_form.subwin; + else + return form->subwin; +} + +/* + * Return the minimum size required to contain the form. + */ +int +scale_form(FORM *form, int *rows, int *cols) +{ + int i, max_row, max_col, temp; + + if ((form->fields == NULL) || (form->fields[0] == NULL)) + return E_NOT_CONNECTED; + + max_row = 0; + max_col = 0; + + for (i = 0; i < form->field_count; i++) { + temp = form->fields[i]->form_row + form->fields[i]->rows; + max_row = (temp > max_row)? temp : max_row; + temp = form->fields[i]->form_col + form->fields[i]->cols; + max_col = (temp > max_col)? temp : max_col; + } + + (*rows) = max_row; + (*cols) = max_col; + + return E_OK; +} + +/* + * Set the user defined pointer for the form given. + */ +int +set_form_userptr(FORM *form, void *ptr) +{ + if (form == NULL) + _formi_default_form.userptr = ptr; + else + form->userptr = ptr; + + return E_OK; +} + +/* + * Return the user defined pointer associated with the given form. + */ +void * +form_userptr(FORM *form) +{ + + if (form == NULL) + return _formi_default_form.userptr; + else + return form->userptr; +} + +/* + * Set the form options to the given ones. + */ +int +set_form_opts(FORM *form, Form_Options options) +{ + if (form == NULL) + _formi_default_form.opts = options; + else + form->opts = options; + + return E_OK; +} + +/* + * Turn the given options on for the form. + */ +int +form_opts_on(FORM *form, Form_Options options) +{ + if (form == NULL) + _formi_default_form.opts |= options; + else + form->opts |= options; + + return E_OK; +} + +/* + * Turn the given options off for the form. + */ +int +form_opts_off(FORM *form, Form_Options options) +{ + if (form == NULL) + _formi_default_form.opts &= ~options; + else + form->opts &= ~options; + + + return E_OK; +} + +/* + * Return the options set for the given form. + */ +Form_Options +form_opts(FORM *form) +{ + if (form == NULL) + return _formi_default_form.opts; + else + return form->opts; +} + +/* + * Set the form init function for the given form + */ +int +set_form_init(FORM *form, Form_Hook func) +{ + if (form == NULL) + _formi_default_form.form_init = func; + else + form->form_init = func; + + return E_OK; +} + +/* + * Return the init function associated with the given form. + */ +Form_Hook +form_init(FORM *form) +{ + if (form == NULL) + return _formi_default_form.form_init; + else + return form->form_init; +} + +/* + * Set the function to be called on form termination. + */ +int +set_form_term(FORM *form, Form_Hook function) +{ + if (form == NULL) + _formi_default_form.form_term = function; + else + form->form_term = function; + + return E_OK; +} + +/* + * Return the function defined for the termination function. + */ +Form_Hook +form_term(FORM *form) +{ + + if (form == NULL) + return _formi_default_form.form_term; + else + return form->form_term; +} + + +/* + * Attach the given fields to the form. + */ +int +set_form_fields(FORM *form, FIELD **fields) +{ + int num_fields = 0, i, maxpg = 1, status; + + if (form == NULL) + return E_BAD_ARGUMENT; + + if (form->posted == TRUE) + return E_POSTED; + + if (fields == NULL) + return E_BAD_ARGUMENT; + + while (fields[num_fields] != NULL) { + if ((fields[num_fields]->parent != NULL) && + (fields[num_fields]->parent != form)) + return E_CONNECTED; + num_fields++; + } + + /* disconnect old fields, if any */ + if (form->fields != NULL) { + for (i = 0; i < form->field_count; i++) { + form->fields[i]->parent = NULL; + form->fields[i]->index = -1; + } + } + + /* kill old page pointers if any */ + if (form->page_starts != NULL) + free(form->page_starts); + + form->field_count = num_fields; + + /* now connect the new fields to the form */ + for (i = 0; i < num_fields; i++) { + fields[i]->parent = form; + fields[i]->index = i; + /* set the page number of the field */ + if (fields[i]->page_break == 1) + maxpg++; + fields[i]->page = maxpg; + } + + form->fields = fields; + form->cur_field = 0; + form->max_page = maxpg; + if ((status = _formi_find_pages(form)) != E_OK) + return status; + + /* sort the fields and set the navigation pointers */ + _formi_sort_fields(form); + _formi_stitch_fields(form); + + return E_OK; +} + +/* + * Return the fields attached to the form given. + */ +FIELD ** +form_fields(FORM *form) +{ + if (form == NULL) + return NULL; + + return form->fields; +} + +/* + * Return the number of fields attached to the given form. + */ +int +field_count(FORM *form) +{ + if (form == NULL) + return -1; + + return form->field_count; +} + +/* + * Move the given field to the row and column given. + */ +int +move_field(FIELD *fptr, int frow, int fcol) +{ + FIELD *field = (fptr == NULL) ? &_formi_default_field : fptr; + + if (field->parent != NULL) + return E_CONNECTED; + + field->form_row = frow; + field->form_col = fcol; + + return E_OK; +} + +/* + * Set the page of the form to the given page. + */ +int +set_form_page(FORM *form, int page) +{ + if (form == NULL) + return E_BAD_ARGUMENT; + + if (form->in_init == TRUE) + return E_BAD_STATE; + + if (page > form->max_page) + return E_BAD_ARGUMENT; + + form->page = page; + return E_OK; +} + +/* + * Return the maximum page of the form. + */ +int +form_max_page(FORM *form) +{ + if (form == NULL) + return _formi_default_form.max_page; + else + return form->max_page; +} + +/* + * Return the current page of the form. + */ +int +form_page(FORM *form) +{ + if (form == NULL) + return E_BAD_ARGUMENT; + + return form->page; +} + +/* + * Set the current field to the field given. + */ +int +set_current_field(FORM *form, FIELD *field) +{ + if (form == NULL) + return E_BAD_ARGUMENT; + + if (form->in_init == TRUE) + return E_BAD_STATE; + + if (field == NULL) + return E_INVALID_FIELD; + + if ((field->parent == NULL) || (field->parent != form)) + return E_INVALID_FIELD; /* field is not of this form */ + + form->cur_field = field->index; + + /* XXX update page if posted??? */ + return E_OK; +} + +/* + * Return the current field of the given form. + */ +FIELD * +current_field(FORM *form) +{ + if (form == NULL) + return NULL; + + if (form->fields == NULL) + return NULL; + + return form->fields[form->cur_field]; +} + +/* + * Allocate a new form with the given fields. + */ +FORM * +new_form(FIELD **fields) +{ + FORM *new; + + if ((new = malloc(sizeof(*new))) == NULL) + return NULL; + + + /* copy in the defaults... */ + memcpy(new, &_formi_default_form, sizeof(*new)); + + if (new->win == NULL) + new->scrwin = stdscr; /* something for curses to write to */ + + if (fields != NULL) { /* attach the fields, if any */ + if (set_form_fields(new, fields) < 0) { + free(new); /* field attach failed, back out */ + return NULL; + } + } + + return new; +} + +/* + * Free the given form. + */ +int +free_form(FORM *form) +{ + int i; + + if (form == NULL) + return E_BAD_ARGUMENT; + + if (form->posted == TRUE) + return E_POSTED; + + for (i = 0; i < form->field_count; i++) { + /* detach all the fields from the form */ + form->fields[i]->parent = NULL; + form->fields[i]->index = -1; + } + + free(form); + + return E_OK; +} + +/* + * Tell if the current field of the form has offscreen data ahead + */ +int +data_ahead(FORM *form) +{ + FIELD *cur; + + if ((form == NULL) || (form->fields == NULL) + || (form->fields[0] == NULL)) + return FALSE; + + cur = form->fields[form->cur_field]; + + /*XXXX wrong */ + if (cur->cur_line->expanded > cur->cols) + return TRUE; + + return FALSE; +} + +/* + * Tell if current field of the form has offscreen data behind + */ +int +data_behind(FORM *form) +{ + FIELD *cur; + + if ((form == NULL) || (form->fields == NULL) + || (form->fields[0] == NULL)) + return FALSE; + + cur = form->fields[form->cur_field]; + + if (cur->start_char > 0) + return TRUE; + + return FALSE; +} + +/* + * Position the form cursor. + */ +int +pos_form_cursor(FORM *form) +{ + FIELD *cur; + int row, col; + + if ((form == NULL) || (form->fields == NULL) || + (form->fields[0] == NULL)) + return E_BAD_ARGUMENT; + + if (form->posted != 1) + return E_NOT_POSTED; + + cur = form->fields[form->cur_field]; + row = cur->form_row; + col = cur->form_col; + + /* if the field is public then show the cursor pos */ + if ((cur->opts & O_PUBLIC) == O_PUBLIC) { + row += cur->cursor_ypos; + col += cur->cursor_xpos; + if (cur->cursor_xpos >= cur->cols) { + col = cur->form_col; + row++; + } + } + + _formi_dbg_printf("%s: row=%d, col=%d\n", __func__, row, col); + + wmove(form->scrwin, row, col); + + return E_OK; +} diff --git a/vendor/netbsd-curses/libform/form.h b/vendor/netbsd-curses/libform/form.h new file mode 100644 index 0000000..ae4e094 --- /dev/null +++ b/vendor/netbsd-curses/libform/form.h @@ -0,0 +1,414 @@ +/* $NetBSD: form.h,v 1.23 2015/09/07 15:50:49 joerg Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#ifndef FORM_H +#define FORM_H 1 +#if 0 +#include +#endif +#include +#include +#include + +#ifndef __printflike +#if __GNUC__ >= 3 +#define __printflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) +#define __scanflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) +#else +#define __printflike(fmtarg, firstvararg) /* nothing */ +#define __scanflike(fmtarg, firstvararg) /* nothing */ +#endif +#endif + +/* Define the types of field justification that can be used. */ +#define NO_JUSTIFICATION (0) +#define JUSTIFY_RIGHT (1) +#define JUSTIFY_LEFT (2) +#define JUSTIFY_CENTER (3) + +/* Define the max and min valid justification styles for range checking */ +#define MIN_JUST_STYLE NO_JUSTIFICATION +#define MAX_JUST_STYLE JUSTIFY_CENTER + +/* Options for the fields */ +typedef unsigned int Form_Options; + +/* form options */ +#define O_BS_OVERLOAD (0x001) +#define O_NL_OVERLOAD (0x002) + +/* field options */ +#define O_VISIBLE (0x001) /* Field is visible */ +#define O_ACTIVE (0x002) /* Field is active in the form */ +#define O_PUBLIC (0x004) /* The contents entered into the field is echoed */ +#define O_EDIT (0x008) /* Can edit the field */ +#define O_WRAP (0x010) /* The field contents can line wrap */ +#define O_BLANK (0x020) /* Blank the field on modification */ +#define O_AUTOSKIP (0x040) /* Skip to next field when current is full */ +#define O_NULLOK (0x080) /* Field is allowed to contain no data */ +#define O_STATIC (0x100) /* Field is not dynamic */ +#define O_PASSOK (0x200) /* An umodified field is OK */ +#define O_REFORMAT (0x400) /* Insert newlines at linebreaks on buffer get */ + +/* + * Form driver requests - be VERY careful about changing the ordering + * of the requests below. The form driver code depends on a particular + * order for the requests. + */ +#define REQ_MIN_REQUEST (KEY_MAX + 0x101) /* must equal value of the + first request */ + +#define REQ_NEXT_PAGE (KEY_MAX + 0x101) /* next page in form */ +#define REQ_PREV_PAGE (KEY_MAX + 0x102) /* previous page in form */ +#define REQ_FIRST_PAGE (KEY_MAX + 0x103) /* goto first page in form */ +#define REQ_LAST_PAGE (KEY_MAX + 0x104) /* goto last page in form */ + +#define REQ_NEXT_FIELD (KEY_MAX + 0x105) /* move to the next field */ +#define REQ_PREV_FIELD (KEY_MAX + 0x106) /* move to the previous field */ +#define REQ_FIRST_FIELD (KEY_MAX + 0x107) /* goto the first field */ +#define REQ_LAST_FIELD (KEY_MAX + 0x108) /* goto the last field */ + +#define REQ_SNEXT_FIELD (KEY_MAX + 0x109) /* move to the next field + in sorted order */ +#define REQ_SPREV_FIELD (KEY_MAX + 0x10a) /* move to the prev field + in sorted order */ +#define REQ_SFIRST_FIELD (KEY_MAX + 0x10b) /* move to the first + sorted field */ +#define REQ_SLAST_FIELD (KEY_MAX + 0x10c) /* move to the last sorted + field */ + +#define REQ_LEFT_FIELD (KEY_MAX + 0x10d) /* go left one field */ +#define REQ_RIGHT_FIELD (KEY_MAX + 0x10e) /* go right one field */ +#define REQ_UP_FIELD (KEY_MAX + 0x10f) /* go up one field */ +#define REQ_DOWN_FIELD (KEY_MAX + 0x110) /* go down one field */ + +#define REQ_NEXT_CHAR (KEY_MAX + 0x111) /* move to the next char + in field */ +#define REQ_PREV_CHAR (KEY_MAX + 0x112) /* move to the previous + char in field */ +#define REQ_NEXT_LINE (KEY_MAX + 0x113) /* go to the next line in + the field */ +#define REQ_PREV_LINE (KEY_MAX + 0x114) /* go to the previous line + in the field */ +#define REQ_NEXT_WORD (KEY_MAX + 0x115) /* go to the next word in + the field */ +#define REQ_PREV_WORD (KEY_MAX + 0x116) /* go to the previous word + in the field */ +#define REQ_BEG_FIELD (KEY_MAX + 0x117) /* go to the beginning of + the field */ +#define REQ_END_FIELD (KEY_MAX + 0x118) /* go to the end of the field */ +#define REQ_BEG_LINE (KEY_MAX + 0x119) /* go to the beginning of + the line */ +#define REQ_END_LINE (KEY_MAX + 0x11a) /* go to the end of the + line */ +#define REQ_LEFT_CHAR (KEY_MAX + 0x11b) /* move left in the field */ +#define REQ_RIGHT_CHAR (KEY_MAX + 0x11c) /* move right in the field */ +#define REQ_UP_CHAR (KEY_MAX + 0x11d) /* move up in the field */ +#define REQ_DOWN_CHAR (KEY_MAX + 0x11e) /* move down in the field */ + +#define REQ_NEW_LINE (KEY_MAX + 0x11f) /* insert/overlay a new line */ +#define REQ_INS_CHAR (KEY_MAX + 0x120) /* insert a blank char at + the cursor */ +#define REQ_INS_LINE (KEY_MAX + 0x121) /* insert a blank line at + the cursor */ + +#define REQ_DEL_CHAR (KEY_MAX + 0x122) /* delete the current character */ +#define REQ_DEL_PREV (KEY_MAX + 0x123) /* delete the character + before the current */ +#define REQ_DEL_LINE (KEY_MAX + 0x124) /* delete the current line */ +#define REQ_DEL_WORD (KEY_MAX + 0x125) /* delete the word at the cursor */ +#define REQ_CLR_EOL (KEY_MAX + 0x126) /* clear to the end of the line */ +#define REQ_CLR_EOF (KEY_MAX + 0x127) /* clear to the end of the field */ +#define REQ_CLR_FIELD (KEY_MAX + 0x128) /* clear the field */ + +#define REQ_OVL_MODE (KEY_MAX + 0x129) /* overlay mode */ +#define REQ_INS_MODE (KEY_MAX + 0x12a) /* insert mode */ + +#define REQ_SCR_FLINE (KEY_MAX + 0x12b) /* scroll field forward one line */ +#define REQ_SCR_BLINE (KEY_MAX + 0x12c) /* scroll field backward + one line */ +#define REQ_SCR_FPAGE (KEY_MAX + 0x12d) /* scroll field forward one page */ +#define REQ_SCR_BPAGE (KEY_MAX + 0x12e) /* scroll field backward + one page */ +#define REQ_SCR_FHPAGE (KEY_MAX + 0x12f) /* scroll field forward + half a page */ +#define REQ_SCR_BHPAGE (KEY_MAX + 0x130) /* scroll field backward + half a page */ + +#define REQ_SCR_FCHAR (KEY_MAX + 0x131) /* horizontal scroll + forward a character */ +#define REQ_SCR_BCHAR (KEY_MAX + 0x132) /* horizontal scroll + backward a character */ +#define REQ_SCR_HFLINE (KEY_MAX + 0x133) /* horizontal scroll + forward a line */ +#define REQ_SCR_HBLINE (KEY_MAX + 0x134) /* horizontal scroll + backward a line */ +#define REQ_SCR_HFHALF (KEY_MAX + 0x135) /* horizontal scroll + forward half a line */ +#define REQ_SCR_HBHALF (KEY_MAX + 0x136) /* horizontal scroll + backward half a line */ + +#define REQ_VALIDATION (KEY_MAX + 0x137) /* validate the field */ +#define REQ_PREV_CHOICE (KEY_MAX + 0x138) /* display previous field choice */ +#define REQ_NEXT_CHOICE (KEY_MAX + 0x139) /* display next field choice */ + +#define REQ_MAX_COMMAND (KEY_MAX + 0x139) /* must match the last + driver command */ + +/* The following defines are for ncurses compatibility */ +#define MIN_FORM_COMMAND REQ_MIN_REQUEST +#define MAX_FORM_COMMAND REQ_MAX_COMMAND + + +typedef struct _form_string { + size_t allocated; + unsigned int length; + char *string; +} FORM_STR; + +typedef struct _form_field FIELD; +typedef struct _form_struct FORM; +typedef struct _form_fieldtype FIELDTYPE; + +typedef struct _formi_page_struct _FORMI_PAGE_START; +typedef struct formi_type_link_struct _FORMI_TYPE_LINK; +typedef struct _formi_field_lines _FORMI_FIELD_LINES; + + +typedef void (*Form_Hook)(FORM *); + +/* definition of a field in the form */ +struct _form_field { + unsigned int rows; /* rows in the field */ + unsigned int cols; /* columns in the field */ + unsigned int drows; /* dynamic rows */ + unsigned int dcols; /* dynamic columns */ + unsigned int max; /* maximum growth */ + unsigned int form_row; /* starting row in the form subwindow */ + unsigned int form_col; /* starting column in the form subwindow */ + unsigned int nrows; /* number of off screen rows */ + int index; /* index of this field in form fields array. */ + int nbuf; /* number of buffers associated with this field */ + int buf0_status; /* set to true if buffer 0 has changed. */ + int justification; /* justification style of the field */ + int overlay; /* set to true if field is in overlay mode */ + _FORMI_FIELD_LINES *cur_line; /* pointer to the current line cursor + is on */ + unsigned int start_char; /* starting char in string (horiz scroll) */ + _FORMI_FIELD_LINES *start_line; /* start line in field (vert scroll) */ + unsigned int row_count; /* number of rows actually used in field */ + unsigned int row_xpos; /* char offset of cursor in field, not same + as cursor_xpos due to tab expansion */ + unsigned int cursor_xpos; /* x pos of cursor in field */ + unsigned int cursor_ypos; /* y pos of cursor in field */ + short page_break; /* start of a new page on the form if 1 */ + short page; /* number of the page this field is on */ + chtype fore; /* character attributes for the foreground */ + chtype back; /* character attributes for the background */ + int pad; /* padding character */ + Form_Options opts; /* options for the field */ + FORM *parent; /* the form this field is bound to, if any */ + FIELD *up; /* field above this one */ + FIELD *down; /* field below this one */ + FIELD *left; /* field to the left of this one */ + FIELD *right; /* field to the right of this one */ + void *userptr; /* user defined pointer. */ + FIELD *link; /* used if fields are linked */ + FIELDTYPE *type; /* type struct for the field */ +#if 0 + TAILQ_ENTRY(_form_field) glue; /* tail queue glue for sorting fields */ +#else + struct { + struct _form_field* tqe_next; + struct _form_field** tqe_prev; + } glue; +#endif + char *args; /* args for field type. */ + _FORMI_FIELD_LINES *alines; /* array of the starts and ends of lines */ + _FORMI_FIELD_LINES *free; /* list of lines available for reuse */ + FORM_STR *buffers; /* array of buffers for the field */ +}; + +/* define the types of fields we can have */ +extern FIELDTYPE *TYPE_ALNUM; +extern FIELDTYPE *TYPE_ALPHA; +extern FIELDTYPE *TYPE_ENUM; +extern FIELDTYPE *TYPE_INTEGER; +extern FIELDTYPE *TYPE_NUMERIC; +extern FIELDTYPE *TYPE_REGEXP; +extern FIELDTYPE *TYPE_IPV4; +extern FIELDTYPE *TYPE_IPV6; +extern FIELDTYPE *TYPE_USER; + +/* definition of a field type. */ +struct _form_fieldtype { + unsigned flags; /* status of the type */ + unsigned refcount; /* in use if > 0 */ + _FORMI_TYPE_LINK *link; /* set if this type is linked */ + + char * (*make_args)(va_list *); /* make the args for the type */ + char * (*copy_args)(char *); /* copy the args for the type */ + void (*free_args)(char *); /* free storage used by the args */ + int (*field_check)(FIELD *, char *); /* field validation routine */ + int (*char_check)(int, char *); /* char validation routine */ + int (*next_choice)(FIELD *, char *); /* function to select next + choice */ + int (*prev_choice)(FIELD *, char *); /* function to select prev + choice */ +}; + +/*definition of a form */ + +struct _form_struct { + int in_init; /* true if performing a init or term function */ + int posted; /* the form is posted */ + int wrap; /* wrap from last field to first field if true */ + WINDOW *win; /* window for the form */ + WINDOW *subwin; /* subwindow for the form */ + WINDOW *scrwin; /* this is the window to use for output */ + void *userptr; /* user defined pointer */ + Form_Options opts; /* options for the form */ + Form_Hook form_init; /* function called when form posted and + after page change */ + Form_Hook form_term; /* function called when form is unposted and + before page change */ + Form_Hook field_init; /* function called when form posted and after + current field changes */ + Form_Hook field_term; /* function called when form unposted and + before current field changes */ + int field_count; /* number of fields attached */ + int cur_field; /* current field */ + int page; /* current page of form */ + int max_page; /* number of pages in the form */ + _FORMI_PAGE_START *page_starts; /* dynamic array of fields that start + the pages */ +#if 0 + TAILQ_HEAD(_formi_sort_head, _form_field) sorted_fields; /* sorted field + list */ +#else + struct _formi_sort_head { \ + struct _form_field *tqh_first; /* first element */ \ + struct _form_field **tqh_last; /* addr of last next element */ \ + } sorted_fields; /* sorted field list */ +#endif + FIELD **fields; /* array of fields attached to this form. */ +}; + +/* Public function prototypes. */ +#ifdef __cplusplus +extern "C" { +#endif + +FIELD *current_field(FORM *); +int data_ahead(FORM *); +int data_behind(FORM *); +FIELD *dup_field(FIELD *, int, int); +int dynamic_field_info(FIELD *, int *, int *, int *); +char *field_arg(FIELD *); +chtype field_back(FIELD *); +char *field_buffer(FIELD *, int); +int field_count(FORM *); +chtype field_fore(FIELD *); +int field_index(FIELD *); +int field_info(FIELD *, int *, int *, int *, int *, int *, int *); +Form_Hook field_init(FORM *); +int field_just(FIELD *); +Form_Options field_opts(FIELD *); +int field_opts_off(FIELD *, Form_Options); +int field_opts_on(FIELD *, Form_Options); +int field_pad(FIELD *); +int field_status(FIELD *); +Form_Hook field_term(FORM *); +FIELDTYPE *field_type(FIELD *); +void *field_userptr(FIELD *); +int form_driver(FORM *, int); +FIELD **form_fields(FORM *); +Form_Hook form_init(FORM *); +int form_max_page(FORM *); +Form_Options form_opts(FORM *); +int form_opts_off(FORM *, Form_Options); +int form_opts_on(FORM *, Form_Options); +int form_page(FORM *); +WINDOW *form_sub(FORM *); +Form_Hook form_term(FORM *); +void *form_userptr(FORM *); +WINDOW *form_win(FORM *); +int free_field(FIELD *); +int free_fieldtype(FIELDTYPE *); +int free_form(FORM *); +FIELD *link_field(FIELD *, int, int); +FIELDTYPE *link_fieldtype(FIELDTYPE *, FIELDTYPE *); +int move_field(FIELD *, int, int); +FIELD *new_field(int, int, int, int, int, int); +FIELDTYPE *new_fieldtype(int (* field_check)(FIELD *, char *), + int (* char_check)(int, char *)); +FORM *new_form(FIELD **); +int new_page(FIELD *); +int pos_form_cursor(FORM *); +int post_form(FORM *); +int scale_form(FORM *, int *, int *); +int set_current_field(FORM *, FIELD *); +int set_field_back(FIELD *, chtype); +int set_field_buffer(FIELD *, int, const char *); +int set_field_fore(FIELD *, chtype); +int set_field_init(FORM *, Form_Hook); +int set_field_just(FIELD *, int); +int set_field_opts(FIELD *, Form_Options); +int set_field_pad(FIELD *, int); +int set_field_printf(FIELD *, int, char *, ...) __printflike(3, 4); +int set_field_status(FIELD *, int); +int set_field_term(FORM *, Form_Hook); +int set_field_type(FIELD *, FIELDTYPE *, ...); +int set_field_userptr(FIELD *, void *); +int set_fieldtype_arg(FIELDTYPE *, char *(*)(va_list *), + char *(*)(char *), + void (*)(char *)); +int set_fieldtype_choice(FIELDTYPE *, int (*)(FIELD *, char *), + int (*)(FIELD *, char *)); +int set_form_fields(FORM *, FIELD **); +int set_form_init(FORM *, Form_Hook); +int set_form_opts(FORM *, Form_Options); +int set_form_page(FORM *, int); +int set_form_sub(FORM *, WINDOW *); +int set_form_term(FORM *, Form_Hook); +int set_form_userptr(FORM *, void *); +int set_form_win(FORM *, WINDOW *); +int set_max_field(FIELD *, int); +int set_new_page(FIELD *, int); +int unpost_form(FORM *); + +#ifdef __cplusplus +} +#endif + +#endif /* FORM_H */ diff --git a/vendor/netbsd-curses/libform/form_cursor.3 b/vendor/netbsd-curses/libform/form_cursor.3 new file mode 100644 index 0000000..dbb6a39 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_cursor.3 @@ -0,0 +1,71 @@ +.\" $NetBSD: form_cursor.3,v 1.9 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm pos_form_cursor +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft int +.Fn pos_form_cursor "FORM *form" +.Sh DESCRIPTION +The function +.Fn pos_form_cursor +positions the screen cursor at the correct position for the form. +This function can be used to restore the cursor state after using +other curses routines. +.Sh RETURN VALUES +.Fn pos_form_cursor +will return one of the following error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +A bad argument was passed to the function. +.It Er E_NOT_POSTED +The form is not posted to the screen. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_data.3 b/vendor/netbsd-curses/libform/form_data.3 new file mode 100644 index 0000000..c69d236 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_data.3 @@ -0,0 +1,76 @@ +.\" $NetBSD: form_data.3,v 1.10 2017/10/23 15:23:55 abhinav Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORM_DATA 3 +.Os +.Sh NAME +.Nm data_ahead , +.Nm data_behind +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft int +.Fn data_ahead "FORM *form" +.Ft int +.Fn data_behind "FORM *form" +.Sh DESCRIPTION +If there is data offscreen to the right of the current field of the +given form then +.Fn data_ahead +will return +.Dv TRUE , +otherwise +.Dv FALSE +is returned. +Similarly, if there is +data offscreen to the left of the current field of the given form then +.Fn data_behind +will return +.Dv TRUE . +.Sh RETURN VALUES +If the condition is met then the functions will return +.Dv TRUE , +if there +is an error or there is no data offscreen the functions will return +.Dv FALSE . +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_driver.3 b/vendor/netbsd-curses/libform/form_driver.3 new file mode 100644 index 0000000..3c18991 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_driver.3 @@ -0,0 +1,226 @@ +.\" $NetBSD: form_driver.3,v 1.11 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm form_driver +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft int +.Fn form_driver "FORM *form" "int request" +.Sh DESCRIPTION +The +.Fn form_driver +is the heart of the forms library, it takes commands in the +.Fa request +parameter that is either a request to the driver to perform some +action or is a character to be inserted into the current field. +The form driver will attempt to insert any printable character passed to +it into the current field. +This may or may not succeed depending on the state of the current field. +If the character passed is not +printable then the driver attempts to process it as a driver request. +If the character passed is not a valid request then the driver will +return an unknown command error. +.Sh PARAMETERS +The forms driver recognizes the following requests: +.Pp +.Bl -tag -width REQ_SFIRST_FIELD -compact +.It REQ_NEXT_PAGE +Change to the next page in the form. +.It REQ_PREV_PAGE +Change to the previous page in the form. +.It REQ_FIRST_PAGE +Select the first page in the form. +.It REQ_LAST_PAGE +Go to the last page in the form. +.It REQ_NEXT_FIELD +Move to the next field in the form field array. +.It REQ_PREV_FIELD +Move to the previous field in the form field array. +.It REQ_FIRST_FIELD +Go to the first field in the form field array. +.It REQ_LAST_FIELD +Go to the last field in the form field array. +.It REQ_SNEXT_FIELD +Move to the next sorted field on the form. +.It REQ_SPREV_FIELD +Move to the previous sorted field on the form. +.It REQ_SFIRST_FIELD +Go to the first field in the sorted list. +.It REQ_SLAST_FIELD +Move to the last field in the sorted list. +.It REQ_LEFT_FIELD +Go one field to the left on the form page. +.It REQ_RIGHT_FIELD +Go one field to the right on the form page. +.It REQ_UP_FIELD +Go up one field on the form page. +.It REQ_DOWN_FIELD +Go down one field on the form page. +.It REQ_NEXT_CHAR +Move one char to the right within the field +.It REQ_PREV_CHAR +Move one char to the left within the current field. +.It REQ_NEXT_LINE +Go down one line in the current field. +.It REQ_PREV_LINE +Go up one line in the current field. +.It REQ_NEXT_WORD +Go forward one word in the current field +.It REQ_PREV_WORD +Go backward one word in the current field. +.It REQ_BEG_FIELD +Move the cursor to the beginning of the current field. +.It REQ_END_FIELD +Move the cursor to the end of the current field. +.It REQ_BEG_LINE +Move the cursor to the beginning of the line in the current field. +.It REQ_END_LINE +Move the cursor to the end of the line. +.It REQ_LEFT_CHAR +Move the cursor left one character +.It REQ_RIGHT_CHAR +Move the cursor right one character +.It REQ_UP_CHAR +Move the cursor up one line. +.It REQ_DOWN_CHAR +Move the cursor down one line. +.It REQ_NEW_LINE +Insert a new line at the current cursor position. +.It REQ_INS_CHAR +Insert a blank character at the current cursor position +.It REQ_INS_LINE +Open a blank line at the current cursor position. +.It REQ_DEL_CHAR +Delete the character at the current cursor position. +.It REQ_DEL_PREV +Delete the character to the left of the current cursor position. +.It REQ_DEL_LINE +Delete the current line. +.It REQ_DEL_WORD +Delete the word at the current cursor position. +.It REQ_CLR_EOL +Clear the field from the current cursor position to the end of the +current line. +.It REQ_CLR_EOF +Clear the field from the current cursor position to the end of the field. +.It REQ_CLR_FIELD +Clear the field. +.It REQ_OVL_MODE +Enter overlay mode, characters added to the field will replace the +ones already there. +.It REQ_INS_MODE +Enter insert mode, characters will be inserted at the current cursor +position. +Any characters to the right of the cursor will be moved +right to accommodate the new characters. +.It REQ_SCR_FLINE +Scroll the field forward one line. +.It REQ_SCR_BLINE +Scroll the field backward one line. +.It REQ_SCR_FPAGE +Scroll the field forward one field page. +.It REQ_SCR_BPAGE +Scroll the field backward one field page. +.It REQ_SCR_FHPAGE +Scroll the field forward half one field page. +.It REQ_SCR_BHPAGE +Scroll the field backward half one field page. +.It REQ_SCR_FCHAR +Scroll the field horizontally forward one character +.It REQ_SCR_BCHAR +Scroll the field horizontally backward one character +.It REQ_SCR_HFLINE +Scroll the field horizontally forward one field line. +.It REQ_SCR_HBLINE +Scroll the field horizontally backward one field line. +.It REQ_SCR_HFHALF +Scroll the field horizontally forward half a field line. +.It REQ_SCR_HBHALF +Scroll the field horizontally backward half a field line. +.It REQ_VALIDATION +Request the contents of the current field be validated using any field +validation function that has been set for the field. +Normally, the field is validated before the current field changes. +This request allows the current field to be validated. +.It REQ_PREV_CHOICE +Select the previous choice in an enumerated type field. +.It REQ_NEXT_CHOICE +Select the next choice in an enumerated type field. +.El +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_REQUEST_DENIED +The forms driver request could not be fulfilled +.It Er E_UNKNOWN_COMMAND +The passed character is not a printable character and is not a valid +forms driver request. +.It Er E_BAD_ARGUMENT +A bad argument was passed to the forms driver. +.It Er E_INVALID_FIELD +The form passed to the driver has no valid attached fields. +.It Er E_NOT_POSTED +The given form is not currently posted to the screen. +.It Er E_BAD_STATE +The forms driver was called from within an init or term function. +.It Er E_INVALID_FIELD +The character passed to the forms driver fails the character +validation for the current field. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +Field sorting is done by location of the field on the form page, the +fields are sorted by position starting with the top-most, left-most +field and progressing left to right. +For the purposes of sorting, the +fields top left corner is used as the sort criteria. +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_field.3 b/vendor/netbsd-curses/libform/form_field.3 new file mode 100644 index 0000000..4432bb2 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_field.3 @@ -0,0 +1,111 @@ +.\" $NetBSD: form_field.3,v 1.12 2012/10/08 18:15:09 njoly Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm field_count , +.Nm form_fields , +.Nm move_field , +.Nm set_form_fields +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft int +.Fn field_count "FORM *form" +.Ft FIELD ** +.Fn form_fields "FORM *form" +.Ft int +.Fn move_field "FIELD *field" "int frow" "int fcol" +.Ft int +.Fn set_form_fields "FORM *form" "FIELD **fields" +.Sh DESCRIPTION +The +.Fn field_count +function returns the number of fields that are attached to the given +form, if the form argument passed is +.Dv NULL +then +.Fn field_count +will return \-1. +The function +.Fn form_fields +will return a pointer to array of attach fields for the given form, +this array is not +.Dv NULL +terminated, fields may be attached to the given +form by calling +.Fn set_form_fields . +The +.Fa fields +argument in this function is a pointer to a +.Dv NULL +terminated array of +fields that will be attached to the form. +If there are already fields attached to the form then they will be +detached before the new fields are attached. +The new fields given must not be attached to any other form. +The +.Fn move_field +function will move the given field to the location specified by +.Fa frow +and +.Fa fcol . +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_CONNECTED +The field is connected to a form. +.It Er E_POSTED +The form is currently posted to the screen. +.It Er E_BAD_ARGUMENT +The function was passed a bad argument. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_field_attributes.3 b/vendor/netbsd-curses/libform/form_field_attributes.3 new file mode 100644 index 0000000..11b1bab --- /dev/null +++ b/vendor/netbsd-curses/libform/form_field_attributes.3 @@ -0,0 +1,100 @@ +.\" $NetBSD: form_field_attributes.3,v 1.10 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm field_back , +.Nm field_fore , +.Nm field_pad , +.Nm set_field_back , +.Nm set_field_fore , +.Nm set_field_pad +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft chtype +.Fn field_back "FIELD *field" +.Ft chtype +.Fn field_fore "FIELD *field" +.Ft int +.Fn field_pad "FIELD *field" +.Ft int +.Fn set_field_back "FIELD *field" "chtype attribute" +.Ft int +.Fn set_field_fore "FIELD *field" "chtype attribute" +.Ft int +.Fn set_field_pad "FIELD *field" "int pad" +.Sh DESCRIPTION +Calling the function +.Fn field_back +will return the character attributes that will be applied to a field +that is not the current field, these attributes can be set by the +.Fn set_field_back +function. +The +.Fn field_fore +function returns the character attributes that will be used to +indicate that a field is the currently active one on the form, this +attribute may be set by using the +.Fn set_field_fore +function. +The pad character for a field is the character that will be printed in all +field locations not occupied with actual field contents. +The pad character can be retrieved by calling the +.Fn field_pad +function, the pad character is set by using the +.Fn set_field_pad +function. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_field_buffer.3 b/vendor/netbsd-curses/libform/form_field_buffer.3 new file mode 100644 index 0000000..7b17104 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_field_buffer.3 @@ -0,0 +1,134 @@ +.\" $NetBSD: form_field_buffer.3,v 1.13 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd October 15, 2005 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm field_buffer , +.Nm field_status , +.Nm set_field_buffer , +.Nm set_field_printf , +.Nm set_field_status , +.Nm set_max_field +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft char * +.Fn field_buffer "FIELD *field" "int buffer" +.Ft int +.Fn field_status "FIELD *field" +.Ft int +.Fn set_field_buffer "FIELD *field" "int buffer" "char *value" +.Ft int +.Fn set_field_printf "FIELD *field" "int buffer" "char *fmt" "..." +.Ft int +.Fn set_field_status "FIELD *field" "int status" +.Ft int +.Fn set_max_field "FIELD *field" "int max" +.Sh DESCRIPTION +The +.Fn field_buffer +function returns the contents of the buffer number specified by +.Fa buffer +for the given field. +If the requested buffer number exceeds the +number of buffers attached to the field then +.Dv NULL +will be returned. +If the field option +.Dv O_REFORMAT +is enabled on the given field then +storage will be allocated to hold the reformatted buffer. +This storage must be release by calling +.Xr free 3 +when it is no longer required. +If the +.Dv O_REFORMAT +field option is not set then no extra storage is allocated. +The field buffer may be set by calling +.Fn set_field_buffer +which will set the given buffer number to the contents of the string +passed. +A buffer may also be set by calling +.Fn set_field_printf +which sets the buffer using the format arg +.Fa fmt +after being expanded using the subsequent arguments in the same manner +as +.Xr sprintf 3 +does. +Calling +.Fn field_status +will return the status of the first buffer attached to the field. +If the field has been modified then the function will return +.Dv TRUE +otherwise +.Dv FALSE +is returned, the status of the first buffer may be +programmatically set by calling +.Fn set_field_status . +The maximum growth of a dynamic field can be set by calling +.Fn set_max_field +which limits the fields rows if the field is a multiline field or the +fields columns if the field only has a single row. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +A bad parameter was passed to the function. +.It Er E_SYSTEM_ERROR +A system error occurred performing the function. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . +The function +.Fn set_field_printf +is a +.Nx +extension and must not be used in portable code. diff --git a/vendor/netbsd-curses/libform/form_field_info.3 b/vendor/netbsd-curses/libform/form_field_info.3 new file mode 100644 index 0000000..f299cf3 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_field_info.3 @@ -0,0 +1,89 @@ +.\" $NetBSD: form_field_info.3,v 1.9 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm dynamic_field_info , +.Nm field_info +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft int +.Fn dynamic_field_info "FIELD *field" "int *drows" "int *dcols" "int *max" +.Ft int +.Fn field_info "FIELD *field" "int *rows" "int *cols" "int *frow" "int *fcol" \ +"int *nrow" "int *nbuf" +.Sh DESCRIPTION +The function +.Fn dynamic_field_info +returns the sizing information for the field given. +The function will return the number of rows, columns and the maximum +growth of the field in the storage pointed to by the drows, dcols and max +parameters respectively. +Dynamic field information cannot be requested for the default field. +If the field given is not dynamic then +.Fn dynamic_field_info +will simply return the size of the actual field. +The +.Fn field_info +will return the number or rows, columns, field starting row, field +starting column, number of off screen rows and number of buffers in +.Fa rows , +.Fa cols , +.Fa frow , +.Fa fcol , +.Fa nrow +and +.Fa nbuf +respectively. +.Sh RETURN VALUES +The functions will return one of the following error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +A bad argument was passed to the function. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_field_just.3 b/vendor/netbsd-curses/libform/form_field_just.3 new file mode 100644 index 0000000..e0e0dfb --- /dev/null +++ b/vendor/netbsd-curses/libform/form_field_just.3 @@ -0,0 +1,97 @@ +.\" $NetBSD: form_field_just.3,v 1.11 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm field_just , +.Nm set_field_just +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft int +.Fn field_just "FIELD *field" +.Ft int +.Fn set_field_just "FIELD *field" "int justification" +.Sh DESCRIPTION +Field justification is only applied to static fields, a dynamic field +will not be justified. +The default justification for a field is +NO_JUSTIFICATION. +The +.Fn field_just +will return the current justification value of the given field and the +justification may be set by calling the +.Fn set_field_just +function. +.Sh PARAMETERS +The following are the valid justifications for a field: +.Pp +.Bl -tag -width NO_JUSTIFICATION -compact +.It NO_JUSTIFICATION +No justification is to be applied to the field. +In practice, this is the same as JUSTIFY_LEFT. +.It JUSTIFY_RIGHT +The field will be right justified. +That is, the end of each line will +be butted up against the right hand side of the field. +.It JUSTIFY_LEFT +The field will be left justified. +That is, the start of each line +will be butted up against the left hand side of the field. +.It JUSTIFY_CENTER +The field will be centre justified, padding will be applied to either +end of the line to make the line centred in the field. +.El +.Sh RETURN VALUES +The functions will return one of the following error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_CURRENT +The field specified is the currently active one on the form. +.It Er E_BAD_ARGUMENT +A bad argument was passed to the function. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_field_new.3 b/vendor/netbsd-curses/libform/form_field_new.3 new file mode 100644 index 0000000..f3e4a1c --- /dev/null +++ b/vendor/netbsd-curses/libform/form_field_new.3 @@ -0,0 +1,117 @@ +.\" $NetBSD: form_field_new.3,v 1.11 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm dup_field , +.Nm free_field , +.Nm link_field , +.Nm new_field +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft FIELD * +.Fn dup_field "FIELD *field" "int frow" "int fcol" +.Ft int +.Fn free_field "FIELD *field" +.Ft FIELD * +.Fn link_field "FIELD *field" "int frow" "int fcol" +.Ft FIELD * +.Fo new_field +.Fa "int rows" +.Fa "int cols" +.Fa "int frow" +.Fa "int fcol" +.Fa "int nrows" +.Fa "int nbuf" +.Fc +.Sh DESCRIPTION +The +.Fn dup_field +function duplicates the given field, including any buffers associated +with the field and returns the pointer to the newly created field. +.Fn free_field +destroys the field and frees any allocated resources associated with +the field. +The function +.Fn link_field +copies the given field to a new field at the location +.Fa frow +and +.Fa fcol +but shares the buffers with the original field. +.Fn new_field +creates a new field of size +.Fa rows +by +.Fa cols +at location +.Fa frow , +.Fa fcol +on the page, the argument +.Fa nrows +specified the number of off screen rows the field has and the +.Fa nbuf +parameter specifies the number of extra buffers attached to the +field. +There will always be one buffer associated with a field. +.Sh RETURN VALUES +On error +.Fn dup_field +and +.Fn new_field +will return +.Dv NULL . +The functions will one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +A bad argument was passed to the function. +.It Er E_CONNECTED +The field is connected to a form. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_field_opts.3 b/vendor/netbsd-curses/libform/form_field_opts.3 new file mode 100644 index 0000000..1de3e2a --- /dev/null +++ b/vendor/netbsd-curses/libform/form_field_opts.3 @@ -0,0 +1,157 @@ +.\" $NetBSD: form_field_opts.3,v 1.11 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd November 24, 2004 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm field_opts , +.Nm field_opts_off , +.Nm field_opts_on , +.Nm set_field_opts +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft Form_Options +.Fn field_opts "FIELD *field" +.Ft int +.Fn field_opts_off "FIELD *field" "Form_Options options" +.Ft int +.Fn field_opts_on "FIELD *field" "Form_Options options" +.Ft int +.Fn set_field_opts "FIELD *field" "Form_Options options" +.Sh DESCRIPTION +The function +.Fn field_opts +returns the current options settings for the given field. +The +.Fn field_opts_off +will turn the options given in +.Fa options +off for the given field, options not specified in +.Fa options +will remain unchanged. +Conversely, the function +.Fn field_opts_on +will turn on the options given in +.Fa options +for the specified field, again, any options not specified will remain +unchanged. +The options for a field may be set to a specific set of +options by calling the +.Fn set_field_opts +function. +Options may only be changed if the field given is not the +currently active one. +.Sh PARAMETERS +The following options are available for a field: +.Pp +.Bl -tag -width O_REFORMAT -compact +.It Dv O_VISIBLE +The field is visible, hence is displayed when the form is posted. +.It Dv O_ACTIVE +The field is active in the form, meaning that it can be visited during +form processing. +.It Dv O_PUBLIC +The contents of the field are echoed to the screen. +.It Dv O_EDIT +The contents of the field can be modified +.It Dv O_WRAP +The contents of the field are wrapped on a word boundary, if this +option is off then the field will be wrapped on a character boundary. +.It Dv O_BLANK +Blank the field on new data being entered if and only if the field +cursor is at the left hand side of the field. +.It Dv O_AUTOSKIP +Skip to the next field when the current field reaches its maximum +size. +.It Dv O_NULLOK +The field is allowed to contain no data +.It Dv O_STATIC +The field is not dynamic, it has a fixed size. +.It Dv O_PASSOK +An unmodified field is allowed. +.It Dv O_REFORMAT +Retain the formatting of a field when the buffer is retrieved. +If this option is not set then the buffer returned will be a single string +with no line breaks. +When this option is set newline characters will be inserted at the point +where the string has been wrapped in a multiline field. +This option is an extension to the forms library and must not be used +in portable code. +See the +.Xr field_buffer 3 +man page for how this option modifies the behaviour of +.Fn field_buffer . +.El +.Pp +The following options are on by default for a field: +.Dv O_VISIBLE , +.Dv O_ACTIVE , +.Dv O_PUBLIC , +.Dv O_EDIT , +.Dv O_WRAP , +.Dv O_BLANK , +.Dv O_AUTOSKIP , +.Dv O_NULLOK , +.Dv O_PASSOK , +and +.Dv O_STATIC . +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_CURRENT +The field specified is the currently active one in the form. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . +The option +.Dv O_REFORMAT +is a +.Nx + extension and must not be used in portable code. diff --git a/vendor/netbsd-curses/libform/form_field_userptr.3 b/vendor/netbsd-curses/libform/form_field_userptr.3 new file mode 100644 index 0000000..4aff31c --- /dev/null +++ b/vendor/netbsd-curses/libform/form_field_userptr.3 @@ -0,0 +1,74 @@ +.\" $NetBSD: form_field_userptr.3,v 1.9 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm field_userptr , +.Nm set_field_userptr +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft void * +.Fn field_userptr "FIELD *field" +.Ft int +.Fn set_field_userptr "FIELD *field" "void *ptr" +.Sh DESCRIPTION +The +.Fn field_userptr +function returns the pointer to the user defined data for the field, +this pointer may be set by calling the +.Fn set_field_userptr +function. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_field_validation.3 b/vendor/netbsd-curses/libform/form_field_validation.3 new file mode 100644 index 0000000..928896e --- /dev/null +++ b/vendor/netbsd-curses/libform/form_field_validation.3 @@ -0,0 +1,82 @@ +.\" $NetBSD: form_field_validation.3,v 1.10 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm field_arg , +.Nm field_type , +.Nm set_field_type +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft char * +.Fn field_arg "FIELD *field" +.Ft FIELDTYPE * +.Fn field_type "FIELD *field" +.Ft int +.Fn set_field_type "FIELD *field" "FIELDTYPE *type" "..." +.Sh DESCRIPTION +The +.Fn field_arg +function returns the field type arguments that are associated with the +given field. +The +.Fn field_type +function returns the field type structure associated with the given +field, this type can be set by calling the +.Fn set_field_type +function which associates the given field type with the field, the +third and subsequent parameters are field dependent arguments. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_fields.3 b/vendor/netbsd-curses/libform/form_fields.3 new file mode 120000 index 0000000..454d191 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_fields.3 @@ -0,0 +1 @@ +form_field.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/form_fieldtype.3 b/vendor/netbsd-curses/libform/form_fieldtype.3 new file mode 100644 index 0000000..c4faa0b --- /dev/null +++ b/vendor/netbsd-curses/libform/form_fieldtype.3 @@ -0,0 +1,150 @@ +.\" $NetBSD: form_fieldtype.3,v 1.11 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm free_fieldtype , +.Nm link_fieldtype , +.Nm new_fieldtype , +.Nm set_fieldtype_arg , +.Nm set_fieldtype_choice +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft int +.Fn free_fieldtype "FIELDTYPE *fieldtype" +.Ft FIELDTYPE * +.Fn link_fieldtype "FIELDTYPE *type1" "FIELDTYPE *type2" +.Ft FIELDTYPE * +.Fo new_fieldtype +.Fa "int (*field_check)(FIELD *, char *)" +.Fa "int (*char_check)(int, char *)" +.Fc +.Ft int +.Fo "set_fieldtype_arg" +.Fa "FIELDTYPE *fieldtype" +.Fa "char * (*make_args)(va_list *)" +.Fa "char * (*copy_args)(char *)" +.Fa "void (*free_args)(char *)" +.Fc +.Ft int +.Fo set_fieldtype_choice +.Fa "FIELDTYPE *fieldtype" +.Fa "int (*next_choice)(FIELD *, char *)" +.Fa "int (*prev_choice)(FIELD *, char *)" +.Fc +.Sh DESCRIPTION +The function +.Fn free_fieldtype +frees the storage associated with the field type and destroys it. +The function +.Fn link_fieldtype +links together the two given field types to produce a new field type. +A new field type can be created by calling +.Fn new_fieldtype +which requires pointers to two functions which perform validation, the +.Fa field_check +function must validate the field contents and return +.Dv TRUE +if they are acceptable and +.Dv FALSE +if they are not. +The +.Fa char_check +validates the character input into the field, this function will be +called for each character entered, if the character can be entered +into the field then +.Fa char_check +must return +.Dv TRUE . +Neither +.Fa field_check +nor +.Fa char_check +may be +.Dv NULL . +The functions for handling the field type arguments can +be defined by using the +.Fn set_fieldtype_arg +function, the +.Fa make_args +function is used to create new arguments for the fieldtype, the +.Fa copy_args +is used to copy the fieldtype arguments to a new arguments structure +and +.Fa free_args +is used to destroy the fieldtype arguments and release any associated +storage, none of these function pointers may be +.Dv NULL . +The field type choice functions can be set by calling +.Fn set_fieldtype_choice , +the +.Fa next_choice +and +.Fa prev_choice +specify the next and previous choice functions for the field type. +These functions must perform the necessary actions to select the next +or previous choice for the field, updating the field buffer if +necessary. +The choice functions must return +.Dv TRUE +if the function succeeded and +.Dv FALSE +otherwise. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +The function was passed a bad argument. +.It Er E_CONNECTED +The field is connected to a form. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_hook.3 b/vendor/netbsd-curses/libform/form_hook.3 new file mode 100644 index 0000000..2c70455 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_hook.3 @@ -0,0 +1,116 @@ +.\" $NetBSD: form_hook.3,v 1.10 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm field_init , +.Nm field_term , +.Nm form_init , +.Nm form_term , +.Nm set_field_init , +.Nm set_field_term , +.Nm set_form_init , +.Nm set_form_term +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft void (*)(FORM *) +.Fn field_init "FORM *form" +.Ft void (*)(FORM *) +.Fn field_term "FORM *form" +.Ft void (*)(FORM *) +.Fn form_init "FORM *form" +.Ft void (*)(FORM *) +.Fn form_term "FORM *form" +.Ft int +.Fn set_field_init "FORM *form" "void (*function)(FORM *)" +.Ft int +.Fn set_field_term "FORM *form" "void (*function)(FORM *)" +.Ft int +.Fn set_form_init "FORM *form" "void (*function)(FORM *)" +.Ft int +.Fn set_form_term "FORM *form" "void (*function)(FORM *)" +.Sh DESCRIPTION +The +.Fn field_init +function returns a pointer to the function that will be called just +after the current field changes and just before the form is posted, +this function may be set by using the +.Fn set_field_init +function. +Similarly, the function +.Fn field_term +will return a pointer to the function that will be called just before +the current field changes and just after the form is unposted, this +function pointer may be set by using the +.Fn set_field_term +function. +The +.Fn form_init +function will return a pointer to the function that will be called +just before the form is posted to the screen, this function can be set +by calling the +.Fn set_form_init +function. +The +.Fn form_term +function will return a pointer to the function that will be called +just after the form is unposted from the screen, this function may be +set by using the +.Fn set_form_term +function. +By default, the init and term function pointers are +.Dv NULL . +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_init.3 b/vendor/netbsd-curses/libform/form_init.3 new file mode 120000 index 0000000..762e14b --- /dev/null +++ b/vendor/netbsd-curses/libform/form_init.3 @@ -0,0 +1 @@ +form_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/form_max_page.3 b/vendor/netbsd-curses/libform/form_max_page.3 new file mode 120000 index 0000000..c7d47c5 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_max_page.3 @@ -0,0 +1 @@ +form_page.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/form_new.3 b/vendor/netbsd-curses/libform/form_new.3 new file mode 100644 index 0000000..7d4b841 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_new.3 @@ -0,0 +1,85 @@ +.\" $NetBSD: form_new.3,v 1.9 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm free_form , +.Nm new_form +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft int +.Fn free_form "FORM *form" +.Ft FORM * +.Fn new_form "FIELD **fields" +.Sh DESCRIPTION +The function +.Fn free_form +frees all the resources associated with the form and destroys the +form. +Calling +.Fn new_form +will create a new form, set the form parameters to the current +defaults and attach the passed fields to the form. +The array of fields passed to +.Fn new_form +must be terminated with a +.Dv NULL +pointer to indicate the end of the fields. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +The function was passed a bad argument. +.It Er E_POSTED +The form is posted to the screen. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_new_page.3 b/vendor/netbsd-curses/libform/form_new_page.3 new file mode 100644 index 0000000..0a1ae42 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_new_page.3 @@ -0,0 +1,75 @@ +.\" $NetBSD: form_new_page.3,v 1.11 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm new_page , +.Nm set_new_page +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft int +.Fn new_page "FIELD *field" +.Ft int +.Fn set_new_page "FIELD *field" "int page" +.Sh DESCRIPTION +The +.Fn new_page +function returns +.Dv TRUE +if the given field is the start of a new page, otherwise it returns +.Dv FALSE , +the new page status of a field can be set or unset using the +.Fn set_new_page +function. +.Sh RETURN VALUES +The functions will return one of the following error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_CONNECTED +The field is connected to a form. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_opts.3 b/vendor/netbsd-curses/libform/form_opts.3 new file mode 100644 index 0000000..180d160 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_opts.3 @@ -0,0 +1,104 @@ +.\" $NetBSD: form_opts.3,v 1.10 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm form_opts , +.Nm form_opts_off , +.Nm form_opts_on , +.Nm set_form_opts +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft Form_Options +.Fn form_opts "FORM *form" +.Ft int +.Fn form_opts_off "FORM *form" "Form_Options options" +.Ft int +.Fn form_opts_on "FORM *form" "Form_Options options" +.Ft int +.Fn set_form_opts "FORM *form" "Form_Options options" +.Sh DESCRIPTION +The function +.Fn form_opts +returns the current options that are set on the given form. +The +.Fn form_opts_off +will turn off the form options given in +.Fa options +for the form, similarly, +.Fn form_opts_on +will turn on the options specified in +.Fa options +for the given form. +The form options can be set to an explicit set by calling +.Fn set_form_opts . +.Sh PARAMETERS +The following form options are valid: +.Pp +.Bl -tag -width O_BS_OVERLOAD -compact +.It O_BS_OVERLOAD +If this option is set and the cursor is at the first character in the +field then the backspace character will perform the same function as a +REQ_PREV_FIELD driver request, moving to the previous field in the +form. +.It O_NL_OVERLOAD +If this option is set and the cursor is at the end of the field then +the new line character will perform the same function as a +REQ_NEXT_FIELD driver request, moving to the next field in the form. +.El +.Pp +By default no form options are set. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_opts_off.3 b/vendor/netbsd-curses/libform/form_opts_off.3 new file mode 120000 index 0000000..efbebb3 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_opts_off.3 @@ -0,0 +1 @@ +form_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/form_opts_on.3 b/vendor/netbsd-curses/libform/form_opts_on.3 new file mode 120000 index 0000000..efbebb3 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_opts_on.3 @@ -0,0 +1 @@ +form_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/form_page.3 b/vendor/netbsd-curses/libform/form_page.3 new file mode 100644 index 0000000..39a59e3 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_page.3 @@ -0,0 +1,119 @@ +.\" $NetBSD: form_page.3,v 1.10 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORM_PAGE 3 +.Os +.Sh NAME +.Nm current_field , +.Nm field_index , +.Nm form_page , +.Nm form_max_page , +.Nm set_current_field , +.Nm set_form_page +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft FIELD * +.Fn current_field "FORM *form" +.Ft int +.Fn field_index "FIELD *field" +.Ft int +.Fn form_page "FORM *form" +.Ft int +.Fn form_max_page "FORM *form" +.Ft int +.Fn set_current_field "FORM *form" "FIELD *field" +.Ft int +.Fn set_form_page "FORM *form" "int page" +.Sh DESCRIPTION +The +.Fn current_field +returns a pointer to the structure for the field that is currently +active on the page. +If there is an error, +.Fn current_field +will return +.Dv NULL . +Calling +.Fn field_index +will return the index of the given field in the form field array. +The +current page the form is on can be determined by using +.Fn form_page , +the current page of a form can be programmatically set by calling +.Fn set_form_page . +The maximum page number for a form can be found by +calling the function +.Fn form_max_page +but note that this function is a +.Nx +extension and must not be used in portable forms library programs. +The current field on the form may be set by calling +.Fn set_current_field +which will set the current field to the one given. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +The function was passed a bad argument. +.It Er E_NOT_CONNECTED +The given field is not associated with a form. +.It Er E_BAD_STATE +The function was called from within an init or term function. +.It Er E_INVALID_FIELD +The field given is not part of the given form. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . +.Pp +The +.Nm form_max_page +is a +.Nx +extension and should not be used in portable applications. diff --git a/vendor/netbsd-curses/libform/form_post.3 b/vendor/netbsd-curses/libform/form_post.3 new file mode 100644 index 0000000..ed71b5f --- /dev/null +++ b/vendor/netbsd-curses/libform/form_post.3 @@ -0,0 +1,85 @@ +.\" $NetBSD: form_post.3,v 1.10 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm post_form , +.Nm unpost_form +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft int +.Fn post_form "FORM *form" +.Ft int +.Fn unpost_form "FORM *form" +.Sh DESCRIPTION +The +.Fn post_form +function performs the actions necessary to present the form on the +curses screen. +If there are any init functions that need to be called +then they will be called prior to the form being posted and the cursor +will be positioned on the first active field that can be visited. +Conversely, the function +.Fn unpost_form +removes the form from the screen and calls any termination functions +that were specified. +.Sh RETURN VALUES +The functions will return one of the following error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +A bad argument was passed to the function. +.It Er E_POSTED +The form is already posted to the screen. +.It Er E_NOT_POSTED +The form was not posted to the screen. +.It Er E_NOT_CONNECTED +There are no fields associated with the form. +.It Er E_BAD_STATE +The function was called from within a init or term function. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_sub.3 b/vendor/netbsd-curses/libform/form_sub.3 new file mode 120000 index 0000000..49bbf85 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_sub.3 @@ -0,0 +1 @@ +form_win.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/form_term.3 b/vendor/netbsd-curses/libform/form_term.3 new file mode 120000 index 0000000..762e14b --- /dev/null +++ b/vendor/netbsd-curses/libform/form_term.3 @@ -0,0 +1 @@ +form_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/form_userptr.3 b/vendor/netbsd-curses/libform/form_userptr.3 new file mode 100644 index 0000000..0fc4212 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_userptr.3 @@ -0,0 +1,74 @@ +.\" $NetBSD: form_userptr.3,v 1.9 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm form_userptr , +.Nm set_form_userptr +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft void * +.Fn form_userptr "FORM *form" +.Ft int +.Fn set_form_userptr "FORM *form" "void *ptr" +.Sh DESCRIPTION +The +.Fn form_userptr +function returns the pointer to the user defined data associated with +the form, this pointer may be set using the +.Fn set_form_userptr +call. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/form_win.3 b/vendor/netbsd-curses/libform/form_win.3 new file mode 100644 index 0000000..0d065f2 --- /dev/null +++ b/vendor/netbsd-curses/libform/form_win.3 @@ -0,0 +1,109 @@ +.\" $NetBSD: form_win.3,v 1.10 2010/03/22 21:58:31 joerg Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd January 1, 2001 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm form_sub , +.Nm form_win , +.Nm scale_form , +.Nm set_form_sub , +.Nm set_form_win +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Ft WINDOW * +.Fn form_sub "FORM *form" +.Ft WINDOW * +.Fn form_win "FORM *form" +.Ft int +.Fn scale_form "FORM *form" "int *rows" "int *cols" +.Ft int +.Fn set_form_sub "FORM *form" "WINDOW *window" +.Ft int +.Fn set_form_win "FORM *form" "WINDOW *window" +.Sh DESCRIPTION +All output to the screen done by the forms library is handled by the +curses library routines. +By default, the forms library will output to the curses +.Fa stdscr , +but if the forms window has been set via +.Fn set_form_win +then output will be sent to the window specified by +.Fn set_form_win , +unless the forms subwindow has been set using +.Fn set_form_sub . +If a subwindow has been specified using +.Fn set_form_sub +then it will be used by the forms library to for screen output. +The current setting for the form window can be retrieved by calling +.Fn form_win . +If the forms window has not been set then +.Dv NULL +will be returned. +Similarly, the forms subwindow can be found by calling the +.Fn form_sub +function, again, if the subwindow has not been set then +.Dv NULL +will be +returned. +The +.Fn scale_form +function will return the minimum number of rows and columns that will +entirely contain the given form. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following error +values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_NOT_CONNECTED +The form has no fields connected to it. +.It Er E_POSTED +The form is posted to the screen. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr forms 3 +.Sh NOTES +The header +.In form.h +automatically includes both +.In curses.h +and +.In eti.h . diff --git a/vendor/netbsd-curses/libform/forms.3 b/vendor/netbsd-curses/libform/forms.3 new file mode 100644 index 0000000..e715110 --- /dev/null +++ b/vendor/netbsd-curses/libform/forms.3 @@ -0,0 +1,235 @@ +.\" $NetBSD: forms.3,v 1.17 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 2001 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd November 24, 2004 +.Dt FORMS 3 +.Os +.Sh NAME +.Nm form +.Nd form library +.Sh LIBRARY +.Lb libform +.Sh SYNOPSIS +.In form.h +.Sh DESCRIPTION +The +.Nm +library provides a terminal independent form system using the +.Xr curses 3 +library. +Before using the +.Nm +functions the terminal must be set up by +.Xr curses 3 +using the +.Fn initscr +function or similar. +Programs using +.Nm +functions must be linked with the +.Xr curses 3 +library +.Fl lcurses . +.Pp +The +.Nm +library provides facilities for defining form fields, placing a form on the +terminal screen, assign pre and post change operations and setting the +attributes of both the form and its fields. +.Ss Defining default attributes for forms and fields +The +.Nm +library allows any settable attribute or option of both the form and field +objects to be defined such that any new form or field automatically inherits +the value as default. +Setting the default value will not affect any field or +form that has already been created but will be applied to subsequent objects. +To set the default attribute or option the set routine is passed a +.Dv NULL +pointer in the field or form parameter when calling the set routine. +The current default value can be retrieved by calling the get routine with a +.Dv NULL +pointer for the field or form parameter. +.Pp +.Bl -column set_fieldtype_choiceXX +.It Sy "Form Routine Name" Ta Sy "Manual Page Name" +.It current_field Ta Xr form_page 3 +.It data_ahead Ta Xr form_data 3 +.It data_behind Ta Xr form_data 3 +.It dup_field Ta Xr form_field_new 3 +.It dynamic_field_info Ta Xr form_field_info 3 +.It field_arg Ta Xr form_field_validation 3 +.It field_back Ta Xr form_field_attributes 3 +.It field_buffer Ta Xr form_field_buffer 3 +.It field_count Ta Xr form_field 3 +.It field_fore Ta Xr form_field_attributes 3 +.It field_index Ta Xr form_page 3 +.It field_info Ta Xr form_field_info 3 +.It field_init Ta Xr form_hook 3 +.It field_just Ta Xr form_field_just 3 +.It field_opts Ta Xr form_field_opts 3 +.It field_opts_off Ta Xr form_field_opts 3 +.It field_opts_on Ta Xr form_field_opts 3 +.It field_pad Ta Xr form_field_attributes 3 +.It field_status Ta Xr form_field_buffer 3 +.It field_term Ta Xr form_hook 3 +.It field_type Ta Xr form_field_validation 3 +.It field_userptr Ta Xr form_field_userptr 3 +.It form_driver Ta Xr form_driver 3 +.It form_fields Ta Xr form_field 3 +.It form_init Ta Xr form_hook 3 +.It form_max_page Ta Xr form_page 3 +.It form_opts Ta Xr form_opts 3 +.It form_opts_off Ta Xr form_opts 3 +.It form_opts_on Ta Xr form_opts 3 +.It form_page Ta Xr form_page 3 +.It form_sub Ta Xr form_win 3 +.It form_term Ta Xr form_hook 3 +.It form_userptr Ta Xr form_userptr 3 +.It form_win Ta Xr form_win 3 +.It free_field Ta Xr form_field_new 3 +.It free_fieldtype Ta Xr form_fieldtype 3 +.It free_form Ta Xr form_new 3 +.It link_field Ta Xr form_field_new 3 +.It link_fieldtype Ta Xr form_fieldtype 3 +.It move_field Ta Xr form_field 3 +.It new_field Ta Xr form_field_new 3 +.It new_fieldtype Ta Xr form_fieldtype 3 +.It new_form Ta Xr form_new 3 +.It new_page Ta Xr form_new_page 3 +.It pos_form_cursor Ta Xr form_cursor 3 +.It post_form Ta Xr form_post 3 +.It scale_form Ta Xr form_win 3 +.It set_current_field Ta Xr form_page 3 +.It set_field_back Ta Xr form_field_attributes 3 +.It set_field_buffer Ta Xr form_field_buffer 3 +.It set_field_fore Ta Xr form_field_attributes 3 +.It set_field_init Ta Xr form_hook 3 +.It set_field_just Ta Xr form_field_just 3 +.It set_field_opts Ta Xr form_field_opts 3 +.It set_field_pad Ta Xr form_field_attributes 3 +.It set_field_printf Ta Xr form_field_buffer 3 +.It set_field_status Ta Xr form_field_buffer 3 +.It set_field_term Ta Xr form_hook 3 +.It set_field_type Ta Xr form_field_validation 3 +.It set_field_userptr Ta Xr form_field_userptr 3 +.It set_fieldtype_arg Ta Xr form_fieldtype 3 +.It set_fieldtype_choice Ta Xr form_fieldtype 3 +.It set_form_fields Ta Xr form_field 3 +.It set_form_init Ta Xr form_hook 3 +.It set_form_opts Ta Xr form_opts 3 +.It set_form_page Ta Xr form_page 3 +.It set_form_sub Ta Xr form_win 3 +.It set_form_term Ta Xr form_hook 3 +.It set_form_userptr Ta Xr form_userptr 3 +.It set_form_win Ta Xr form_win 3 +.It set_max_field Ta Xr form_field_buffer 3 +.It set_new_page Ta Xr form_new_page 3 +.It unpost_form Ta Xr form_post 3 +.El +.Sh RETURN VALUES +Any function returning a string pointer will return +.Dv NULL +if an error occurs. +Functions returning an integer will return one of the following: +.Bl -column set_fieldtype_choiceXX +.It Dv E_OK Ta No The function was successful. +.It Dv E_SYSTEM_ERROR Ta No There was a system error during the call. +.It Dv E_BAD_ARGUMENT Ta No One or more of the arguments passed to \ +the function was incorrect. +.It Dv E_POSTED Ta No The form is already posted. +.It Dv E_CONNECTED Ta No A field was already connected to a form. +.It Dv E_BAD_STATE Ta No The function was called from within an \ +initialization or termination routine. +.It Dv E_NO_ROOM Ta No The form does not fit within the subwindow. +.It Dv E_NOT_POSTED Ta No The form is not posted. +.It Dv E_UNKNOWN_COMMAND Ta No The form driver does not recognize the \ +request passed to it. +.It Dv E_NOT_SELECTABLE Ta No The field could not be selected. +.It Dv E_NOT_CONNECTED Ta No The field is not connected to a form. +.It Dv E_REQUEST_DENIED Ta No The form driver could not process the request. +.It Dv E_INVALID_FIELD Ta No The field is invalid. +.It Dv E_CURRENT Ta No The field is the active one on the form. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +This implementation of the forms library does depart in behavior +subtly from the original AT&T implementation. +Some of the more notable departures are: +.Pp +.Bl -tag -width "The TAB character" -compact +.It field wrapping +For multi-line fields the data will be wrapped as it is entered, this +does not happen in the AT&T implementation. +.It buffer 0 +In this implementation, the contents of buffer 0 are always current +regardless of whether the field has been validated or not. +.It circular fields +In the AT&T implementation fields are circular on a page, that is, a +next field from the last field will go to the first field on the +current page. +In this implementation a next field request on the last +field of a page will result in the forms library positioning the +cursor on the first field of the next page. +If the field is the last +field in the form then going to the next field will be denied, in the +AT&T it would result in the cursor being placed on the first field of +the first page. +.It buffer returns +In this implementation only the data entered by the user in the form +field will be returned, unlike the AT&T library which would return the +contents of the field padded to the size of the field with the pad +character. +.It The TAB character +The handling of the TAB character in fields varies between +implementations. +In ncurses attempting to set a field contents with a +string containing a TAB will result in an error and will not allow a +TAB to be entered into a field. +The AT&T library statically +converts tabs to the equivalent number of spaces when the field buffer +is set but the form driver will not allow a TAB to be inserted into +the field buffer. +This implementation allows TAB when setting the +field buffer and also will allow TAB to be inserted into a field +buffer via the form driver and correctly calculates the cursor +position allowing for expansion of the TAB character. +.It set_field_printf +This function is a +.Nx +extension and must not be used in portable code. +.It Dv O_REFORMAT +This field option is a +.Nx +extension and must not be used in portable code. +.El diff --git a/vendor/netbsd-curses/libform/free_field.3 b/vendor/netbsd-curses/libform/free_field.3 new file mode 120000 index 0000000..2375069 --- /dev/null +++ b/vendor/netbsd-curses/libform/free_field.3 @@ -0,0 +1 @@ +form_field_new.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/free_fieldtype.3 b/vendor/netbsd-curses/libform/free_fieldtype.3 new file mode 120000 index 0000000..999206b --- /dev/null +++ b/vendor/netbsd-curses/libform/free_fieldtype.3 @@ -0,0 +1 @@ +form_fieldtype.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/free_form.3 b/vendor/netbsd-curses/libform/free_form.3 new file mode 120000 index 0000000..2f7d452 --- /dev/null +++ b/vendor/netbsd-curses/libform/free_form.3 @@ -0,0 +1 @@ +form_new.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/gdbinit b/vendor/netbsd-curses/libform/gdbinit new file mode 100644 index 0000000..6a8d423 --- /dev/null +++ b/vendor/netbsd-curses/libform/gdbinit @@ -0,0 +1,20 @@ +# +# Print out the line structs +# +define lstructs + set $lstruct=(_FORMI_FIELD_LINES *)$arg0 + while ($lstruct) + print *($lstruct) + if ($lstruct->prev != 0x0) + if ($lstruct->prev->next != $lstruct) + print "WARNING: backward pointers inconsistent" + end + end + if ($lstruct->next != 0x0) + if ($lstruct->next->prev != $lstruct) + print "WARNING: forward pointers inconsistent" + end + end + set $lstruct = $lstruct->next + end +end diff --git a/vendor/netbsd-curses/libform/internals.c b/vendor/netbsd-curses/libform/internals.c new file mode 100644 index 0000000..512d14a --- /dev/null +++ b/vendor/netbsd-curses/libform/internals.c @@ -0,0 +1,3580 @@ +/* $NetBSD: internals.c,v 1.40 2021/04/13 13:13:04 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#define _XOPEN_SOURCE 600 +#define _BSD_SOURCE +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "internals.h" +#include "form.h" + +#ifdef DEBUG +/* + * file handle to write debug info to, this will be initialised when + * the form is first posted. + */ + +/* + * map the request numbers to strings for debug + */ +static const char *reqs[] = { + "NEXT_PAGE", "PREV_PAGE", "FIRST_PAGE", "LAST_PAGE", "NEXT_FIELD", + "PREV_FIELD", "FIRST_FIELD", "LAST_FIELD", "SNEXT_FIELD", + "SPREV_FIELD", "SFIRST_FIELD", "SLAST_FIELD", "LEFT_FIELD", + "RIGHT_FIELD", "UP_FIELD", "DOWN_FIELD", "NEXT_CHAR", "PREV_CHAR", + "NEXT_LINE", "PREV_LINE", "NEXT_WORD", "PREV_WORD", "BEG_FIELD", + "END_FIELD", "BEG_LINE", "END_LINE", "LEFT_CHAR", "RIGHT_CHAR", + "UP_CHAR", "DOWN_CHAR", "NEW_LINE", "INS_CHAR", "INS_LINE", + "DEL_CHAR", "DEL_PREV", "DEL_LINE", "DEL_WORD", "CLR_EOL", + "CLR_EOF", "CLR_FIELD", "OVL_MODE", "INS_MODE", "SCR_FLINE", + "SCR_BLINE", "SCR_FPAGE", "SCR_BPAGE", "SCR_FHPAGE", "SCR_BHPAGE", + "SCR_FCHAR", "SCR_BCHAR", "SCR_HFLINE", "SCR_HBLINE", "SCR_HFHALF", + "SCR_HBHALF", "VALIDATION", "PREV_CHOICE", "NEXT_CHOICE" }; +#endif + +/* define our own min function - this is not generic but will do here + * (don't believe me? think about what value you would get + * from min(x++, y++) + */ +#define min(a,b) (((a) > (b))? (b) : (a)) + +/* for the line joining function... */ +#define JOIN_NEXT 1 +#define JOIN_NEXT_NW 2 /* next join, don't wrap the joined line */ +#define JOIN_PREV 3 +#define JOIN_PREV_NW 4 /* previous join, don't wrap the joined line */ + +/* for the bump_lines function... */ +#define _FORMI_USE_CURRENT -1 /* indicates current cursor pos to be used */ + +/* used in add_char for initial memory allocation for string in row */ +#define INITIAL_LINE_ALLOC 16 + +unsigned +field_skip_blanks(unsigned int start, _FORMI_FIELD_LINES **rowp); +static void +_formi_do_char_validation(FIELD *field, FIELDTYPE *type, char c, int *ret_val); +static void +_formi_do_validation(FIELD *field, FIELDTYPE *type, int *ret_val); +static int +_formi_join_line(FIELD *field, _FORMI_FIELD_LINES **rowp, int direction); +void +_formi_hscroll_back(FIELD *field, _FORMI_FIELD_LINES *row, unsigned int amt); +void +_formi_hscroll_fwd(FIELD *field, _FORMI_FIELD_LINES *row, unsigned int amt); +static void +_formi_scroll_back(FIELD *field, unsigned int amt); +static void +_formi_scroll_fwd(FIELD *field, unsigned int amt); +static int +_formi_set_cursor_xpos(FIELD *field, int no_scroll); +static int +find_sow(unsigned int offset, _FORMI_FIELD_LINES **rowp); +static int +split_line(FIELD *field, bool hard_split, unsigned pos, + _FORMI_FIELD_LINES **rowp); +static bool +check_field_size(FIELD *field); +static int +add_tab(FORM *form, _FORMI_FIELD_LINES *row, unsigned int i, char c); +static int +tab_size(_FORMI_FIELD_LINES *row, unsigned int i); +static unsigned int +tab_fit_len(_FORMI_FIELD_LINES *row, unsigned int len); +static int +tab_fit_window(FIELD *field, unsigned int pos, unsigned int window); +static void +add_to_free(FIELD *field, _FORMI_FIELD_LINES *line); +static void +adjust_ypos(FIELD *field, _FORMI_FIELD_LINES *line); +static _FORMI_FIELD_LINES * +copy_row(_FORMI_FIELD_LINES *row); +static void +destroy_row_list(_FORMI_FIELD_LINES *start); + +/* + * Calculate the cursor y position to make the given row appear on the + * field. This may be as simple as just changing the ypos (if at all) but + * may encompass resetting the start_line of the field to place the line + * at the bottom of the field. The field is assumed to be a multi-line one. + */ +static void +adjust_ypos(FIELD *field, _FORMI_FIELD_LINES *line) +{ + unsigned ypos; + _FORMI_FIELD_LINES *rs; + + ypos = 0; + rs = field->alines; + while (rs != line) { + rs = rs->next; + ypos++; + } + + field->cursor_ypos = ypos; + field->start_line = field->alines; + if (ypos > (field->rows - 1)) { + /* + * cur_line off the end of the field, + * adjust start_line so fix this. + */ + field->cursor_ypos = field->rows - 1; + ypos = ypos - (field->rows - 1); + while (ypos > 0) { + ypos--; + field->start_line = field->start_line->next; + } + } +} + + +/* + * Delete the given row and add it to the free list of the given field. + */ +static void +add_to_free(FIELD *field, _FORMI_FIELD_LINES *line) +{ + _FORMI_FIELD_LINES *saved; + + saved = line; + + /* don't remove if only one line... */ + if ((line->prev == NULL) && (line->next == NULL)) + return; + + if (line->prev == NULL) { + /* handle top of list */ + field->alines = line->next; + field->alines->prev = NULL; + + if (field->cur_line == saved) + field->cur_line = field->alines; + if (field->start_line == saved) + field->start_line = saved; + } else if (line->next == NULL) { + /* handle bottom of list */ + line->prev->next = NULL; + if (field->cur_line == saved) + field->cur_line = saved->prev; + if (field->start_line == saved) + field->cur_line = saved->prev; + } else { + saved->next->prev = saved->prev; + saved->prev->next = saved->next; + if (field->cur_line == saved) + field->cur_line = saved->prev; + if (field->start_line == saved) + field->start_line = saved; + } + + saved->next = field->free; + field->free = saved; + saved->prev = NULL; + if (saved->next != NULL) + saved->next->prev = line; +} + +/* + * Duplicate the given row, return the pointer to the new copy or + * NULL if the copy fails. + */ +static _FORMI_FIELD_LINES * +copy_row(_FORMI_FIELD_LINES *row) +{ + _FORMI_FIELD_LINES *new; + _formi_tab_t *tp, *newt; + + if ((new = malloc(sizeof(*new))) == NULL) { + return NULL; + } + + memcpy(new, row, sizeof(*new)); + + /* nuke the pointers from the source row so we don't get confused */ + new->next = NULL; + new->prev = NULL; + new->tabs = NULL; + + if ((new->string = malloc((size_t)new->allocated)) == NULL) { + free(new); + return NULL; + } + + memcpy(new->string, row->string, (size_t) row->length + 1); + + if (row->tabs != NULL) { + tp = row->tabs; + if ((new->tabs = malloc(sizeof(*new->tabs))) == NULL) { + free(new->string); + free(new); + return NULL; + } + + memcpy(new->tabs, row->tabs, sizeof(*new->tabs)); + new->tabs->back = NULL; + new->tabs->fwd = NULL; + + tp = tp->fwd; + newt = new->tabs; + + while (tp != NULL) { + if ((newt->fwd = malloc(sizeof(*newt->fwd))) == NULL) { + /* error... unwind allocations */ + tp = new->tabs; + while (tp != NULL) { + newt = tp->fwd; + free(tp); + tp = newt; + } + + free(new->string); + free(new); + return NULL; + } + + memcpy(newt->fwd, tp, sizeof(*newt->fwd)); + newt->fwd->back = newt; + newt = newt->fwd; + newt->fwd = NULL; + tp = tp->fwd; + } + } + + return new; +} + +/* + * Initialise the row offset for a field, depending on the type of + * field it is and the type of justification used. The justification + * is only used on static single line fields, everything else will + * have the cursor_xpos set to 0. + */ +void +_formi_init_field_xpos(FIELD *field) +{ + /* not static or is multi-line which are not justified, so 0 it is */ + if (((field->opts & O_STATIC) != O_STATIC) || + ((field->rows + field->nrows) != 1)) { + field->cursor_xpos = 0; + return; + } + + switch (field->justification) { + case JUSTIFY_RIGHT: + field->cursor_xpos = field->cols - 1; + break; + + case JUSTIFY_CENTER: + field->cursor_xpos = (field->cols - 1) / 2; + break; + + default: /* assume left justify */ + field->cursor_xpos = 0; + break; + } +} + + +/* + * Open the debug file if it is not already open.... + */ +#ifdef DEBUG +static FILE *dbg; +static const char dbg_file[] = "___form_dbg.out"; + +void +_formi_dbg_printf(const char *fmt, ...) +{ + va_list ap; + + if (dbg == NULL && (dbg = fopen(dbg_file, "w")) == NULL) { + warn("Cannot open debug file `%s'", dbg_file); + return; + } + va_start(ap, fmt); + vfprintf(dbg, fmt, ap); + va_end(ap); +} +#endif + +/* + * Check the sizing of the field, if the maximum size is set for a + * dynamic field then check that the number of rows or columns does + * not exceed the set maximum. The decision to check the rows or + * columns is made on the basis of how many rows are in the field - + * one row means the max applies to the number of columns otherwise it + * applies to the number of rows. If the row/column count is less + * than the maximum then return TRUE. + * + */ +static bool +check_field_size(FIELD *field) +{ + if ((field->opts & O_STATIC) != O_STATIC) { + /* dynamic field */ + if (field->max == 0) /* unlimited */ + return TRUE; + + if (field->rows == 1) { + return (field->alines->length < field->max); + } else { + return (field->row_count <= field->max); + } + } else { + if ((field->rows + field->nrows) == 1) { + return (field->alines->length <= field->cols); + } else { + return (field->row_count <= (field->rows + + field->nrows)); + } + } +} + +/* + * Set the form's current field to the first valid field on the page. + * Assume the fields have been sorted and stitched. + */ +int +_formi_pos_first_field(FORM *form) +{ + FIELD *cur; + int old_page; + + old_page = form->page; + + /* scan forward for an active page....*/ + while (form->page_starts[form->page].in_use == 0) { + form->page++; + if (form->page > form->max_page) { + form->page = old_page; + return E_REQUEST_DENIED; + } + } + + /* then scan for a field we can use */ + cur = form->fields[form->page_starts[form->page].first]; + while ((cur->opts & (O_VISIBLE | O_ACTIVE)) + != (O_VISIBLE | O_ACTIVE)) { + cur = TAILQ_NEXT(cur, glue); + if (cur == NULL) { + form->page = old_page; + return E_REQUEST_DENIED; + } + } + + form->cur_field = cur->index; + return E_OK; +} + +/* + * Set the field to the next active and visible field, the fields are + * traversed in index order in the direction given. If the parameter + * use_sorted is TRUE then the sorted field list will be traversed instead + * of using the field index. + */ +int +_formi_pos_new_field(FORM *form, unsigned direction, unsigned use_sorted) +{ + FIELD *cur; + int i; + + i = form->cur_field; + cur = form->fields[i]; + + do { + if (direction == _FORMI_FORWARD) { + if (use_sorted == TRUE) { + if ((form->wrap == FALSE) && + (cur == TAILQ_LAST(&form->sorted_fields, + _formi_sort_head))) + return E_REQUEST_DENIED; + cur = TAILQ_NEXT(cur, glue); + i = cur->index; + } else { + if ((form->wrap == FALSE) && + ((i + 1) >= form->field_count)) + return E_REQUEST_DENIED; + i++; + if (i >= form->field_count) + i = 0; + } + } else { + if (use_sorted == TRUE) { + if ((form->wrap == FALSE) && + (cur == TAILQ_FIRST(&form->sorted_fields))) + return E_REQUEST_DENIED; + cur = TAILQ_PREV(cur, _formi_sort_head, glue); + i = cur->index; + } else { + if ((form->wrap == FALSE) && (i <= 0)) + return E_REQUEST_DENIED; + i--; + if (i < 0) + i = form->field_count - 1; + } + } + + if ((form->fields[i]->opts & (O_VISIBLE | O_ACTIVE)) + == (O_VISIBLE | O_ACTIVE)) { + form->cur_field = i; + return E_OK; + } + } + while (i != form->cur_field); + + return E_REQUEST_DENIED; +} + +/* + * Destroy the list of line structs passed by freeing all allocated + * memory. + */ +static void +destroy_row_list(_FORMI_FIELD_LINES *start) +{ + _FORMI_FIELD_LINES *temp, *row; + _formi_tab_t *tt, *tp; + + row = start; + while (row != NULL) { + if (row->tabs != NULL) { + /* free up the tab linked list... */ + tp = row->tabs; + while (tp != NULL) { + tt = tp->fwd; + free(tp); + tp = tt; + } + } + + if (row->string != NULL) + free(row->string); + + temp = row->next; + free(row); + row = temp; + } +} + +/* + * Word wrap the contents of the field's buffer 0 if this is allowed. + * If the wrap is successful, that is, the row count nor the buffer + * size is exceeded then the function will return E_OK, otherwise it + * will return E_REQUEST_DENIED. + */ +int +_formi_wrap_field(FIELD *field, _FORMI_FIELD_LINES *loc) +{ + int width, wrap_err; + unsigned int pos, saved_xpos, saved_ypos, saved_cur_xpos; + unsigned int saved_row_count; + _FORMI_FIELD_LINES *saved_row, *row, *row_backup, *saved_cur_line; + _FORMI_FIELD_LINES *saved_start_line, *temp; + + if ((field->opts & O_STATIC) == O_STATIC) { + if ((field->rows + field->nrows) == 1) { + return E_OK; /* cannot wrap a single line */ + } + width = field->cols; + } else { + /* if we are limited to one line then don't try to wrap */ + if ((field->drows + field->nrows) == 1) { + return E_OK; + } + + /* + * hueristic - if a dynamic field has more than one line + * on the screen then the field grows rows, otherwise + * it grows columns, effectively a single line field. + * This is documented AT&T behaviour. + */ + if (field->rows > 1) { + width = field->cols; + } else { + return E_OK; + } + } + + row = loc; + + /* if we are not at the top of the field then back up one + * row because we may be able to merge the current row into + * the one above. + */ + if (row->prev != NULL) + row = row->prev; + + saved_row = row; + saved_xpos = field->row_xpos; + saved_cur_xpos = field->cursor_xpos; + saved_ypos = field->cursor_ypos; + saved_row_count = field->row_count; + + /* + * Save a copy of the lines affected, just in case things + * don't work out. + */ + if ((row_backup = copy_row(row)) == NULL) + return E_SYSTEM_ERROR; + + temp = row_backup; + row = row->next; + + saved_cur_line = temp; + saved_start_line = temp; + + while (row != NULL) { + if ((temp->next = copy_row(row)) == NULL) { + /* a row copy failed... free up allocations */ + destroy_row_list(row_backup); + return E_SYSTEM_ERROR; + } + + temp->next->prev = temp; + temp = temp->next; + + if (row == field->start_line) + saved_start_line = temp; + if (row == field->cur_line) + saved_cur_line = temp; + + row = row->next; + } + + row = saved_row; + while (row != NULL) { + pos = row->length - 1; + if (row->expanded < width) { + /* line may be too short, try joining some lines */ + if ((row->hard_ret == TRUE) && (row->next != NULL)) { + /* + * Skip the line if it has a hard return + * and it is not the last, we cannot join + * anything to it. + */ + row = row->next; + continue; + } + + if (row->next == NULL) { + /* + * If there are no more lines and this line + * is too short then our job is over. + */ + break; + } + + if (_formi_join_line(field, &row, + JOIN_NEXT_NW) == E_OK) { + continue; + } else + break; + } else if (row->expanded > width) { + /* line is too long, split it */ + + /* + * split on first whitespace before current word + * if the line has tabs we need to work out where + * the field border lies when the tabs are expanded. + */ + if (row->tabs == NULL) { + pos = width - 1; + if (pos >= row->expanded) + pos = row->expanded - 1; + } else { + pos = tab_fit_len(row, field->cols); + } + + if ((!isblank((unsigned char)row->string[pos])) && + ((field->opts & O_WRAP) == O_WRAP)) { + if (!isblank((unsigned char)row->string[pos - 1])) + pos = find_sow((unsigned int) pos, + &row); + /* + * If we cannot split the line then return + * NO_ROOM so the driver can tell that it + * should not autoskip (if that is enabled) + */ + if ((pos == 0) + || (!isblank((unsigned char)row->string[pos - 1]))) { + wrap_err = E_NO_ROOM; + goto restore_and_exit; + } + } + + /* if we are at the end of the string and it has + * a trailing blank, don't wrap the blank. + */ + if ((row->next == NULL) && (pos == row->length - 1) && + (isblank((unsigned char)row->string[pos])) && + row->expanded <= field->cols) + continue; + + /* + * otherwise, if we are still sitting on a + * blank but not at the end of the line + * move forward one char so the blank + * is on the line boundary. + */ + if ((isblank((unsigned char)row->string[pos])) && + (pos != row->length - 1)) + pos++; + + if (split_line(field, FALSE, pos, &row) != E_OK) { + wrap_err = E_REQUEST_DENIED; + goto restore_and_exit; + } + } else + /* line is exactly the right length, do next one */ + row = row->next; + } + + /* Check if we have not run out of room */ + if ((((field->opts & O_STATIC) == O_STATIC) && + field->row_count > (field->rows + field->nrows)) || + ((field->max != 0) && (field->row_count > field->max))) { + + wrap_err = E_REQUEST_DENIED; + + restore_and_exit: + if (saved_row->prev == NULL) { + field->alines = row_backup; + } else { + saved_row->prev->next = row_backup; + row_backup->prev = saved_row->prev; + } + + field->row_xpos = saved_xpos; + field->cursor_xpos = saved_cur_xpos; + field->cursor_ypos = saved_ypos; + field->row_count = saved_row_count; + field->start_line = saved_start_line; + field->cur_line = saved_cur_line; + + destroy_row_list(saved_row); + return wrap_err; + } + + destroy_row_list(row_backup); + return E_OK; +} + +/* + * Join the two lines that surround the location pos, the type + * variable indicates the direction of the join, JOIN_NEXT will join + * the next line to the current line, JOIN_PREV will join the current + * line to the previous line, the new lines will be wrapped unless the + * _NW versions of the directions are used. Returns E_OK if the join + * was successful or E_REQUEST_DENIED if the join cannot happen. + */ +static int +_formi_join_line(FIELD *field, _FORMI_FIELD_LINES **rowp, int direction) +{ + int old_len, count; + struct _formi_field_lines *saved; + char *newp; + _FORMI_FIELD_LINES *row = *rowp; + + _formi_dbg_printf("%s: working on row %p, row_count = %d\n", + __func__, row, field->row_count); + + if ((direction == JOIN_NEXT) || (direction == JOIN_NEXT_NW)) { + /* + * See if there is another line following, or if the + * line contains a hard return then we don't join + * any lines to it. + */ + if ((row->next == NULL) || (row->hard_ret == TRUE)) { + return E_REQUEST_DENIED; + } + + _formi_dbg_printf( + "%s: join_next before length = %d, expanded = %d", + __func__, row->length, row->expanded); + _formi_dbg_printf( + " :: next row length = %d, expanded = %d\n", + row->length, row->expanded); + + if (row->allocated < (row->length + row->next->length + 1)) { + if ((newp = realloc(row->string, (size_t)(row->length + + row->next->length + + 1))) == NULL) + return E_REQUEST_DENIED; + row->string = newp; + row->allocated = row->length + row->next->length + 1; + } + + strcat(row->string, row->next->string); + old_len = row->length; + row->length += row->next->length; + if (row->length > 0) + row->expanded = + _formi_tab_expanded_length(row->string, 0, + row->length - 1); + else + row->expanded = 0; + + _formi_calculate_tabs(row); + row->hard_ret = row->next->hard_ret; + + /* adjust current line if it is on the row being eaten */ + if (field->cur_line == row->next) { + field->cur_line = row; + field->row_xpos += old_len; + field->cursor_xpos = + _formi_tab_expanded_length(row->string, 0, + field->row_xpos); + if (field->cursor_xpos > 0) + field->cursor_xpos--; + + if (field->cursor_ypos > 0) + field->cursor_ypos--; + else { + if (field->start_line->prev != NULL) + field->start_line = + field->start_line->prev; + } + } + + /* remove joined line record from the row list */ + add_to_free(field, row->next); + + _formi_dbg_printf( + "%s: exit length = %d, expanded = %d\n", + __func__, row->length, row->expanded); + } else { + if (row->prev == NULL) { + return E_REQUEST_DENIED; + } + + saved = row->prev; + + /* + * Don't try to join if the line above has a hard + * return on it. + */ + if (saved->hard_ret == TRUE) { + return E_REQUEST_DENIED; + } + + _formi_dbg_printf( + "%s: join_prev before length = %d, expanded = %d", + __func__, row->length, row->expanded); + _formi_dbg_printf( + " :: prev row length = %d, expanded = %d\n", + saved->length, saved->expanded); + + if (saved->allocated < (row->length + saved->length + 1)) { + if ((newp = realloc(saved->string, + (size_t) (row->length + + saved->length + + 1))) == NULL) + return E_REQUEST_DENIED; + saved->string = newp; + saved->allocated = row->length + saved->length + 1; + } + + strcat(saved->string, row->string); + old_len = saved->length; + saved->length += row->length; + if (saved->length > 0) + saved->expanded = + _formi_tab_expanded_length(saved->string, 0, + saved->length - 1); + else + saved->length = 0; + + saved->hard_ret = row->hard_ret; + + /* adjust current line if it was on the row being eaten */ + if (field->cur_line == row) { + field->cur_line = saved; + field->row_xpos += old_len; + field->cursor_xpos = + _formi_tab_expanded_length(saved->string, 0, + field->row_xpos); + if (field->cursor_xpos > 0) + field->cursor_xpos--; + } + + add_to_free(field, row); + + _formi_dbg_printf( + "%s: exit length = %d, expanded = %d\n", __func__, + saved->length, saved->expanded); + row = saved; + } + + + /* + * Work out where the line lies in the field in relation to + * the cursor_ypos. First count the rows from the start of + * the field until we hit the row we just worked on. + */ + saved = field->start_line; + count = 0; + while (saved->next != NULL) { + if (saved == row) + break; + count++; + saved = saved->next; + } + + /* now check if we need to adjust cursor_ypos */ + if (field->cursor_ypos > count) { + field->cursor_ypos--; + } + + field->row_count--; + *rowp = row; + + /* wrap the field if required, if this fails undo the change */ + if ((direction == JOIN_NEXT) || (direction == JOIN_PREV)) { + if (_formi_wrap_field(field, row) != E_OK) { + return E_REQUEST_DENIED; + } + } + + return E_OK; +} + +/* + * Split the line at the given position, if possible. If hard_split is + * TRUE then split the line regardless of the position, otherwise don't + * split at the beginning of a line. + */ +static int +split_line(FIELD *field, bool hard_split, unsigned pos, + _FORMI_FIELD_LINES **rowp) +{ + struct _formi_field_lines *new_line; + char *newp; + _FORMI_FIELD_LINES *row = *rowp; + + /* if asked to split right where the line already starts then + * just return - nothing to do unless we are appending a line + * to the buffer. + */ + if ((pos == 0) && (hard_split == FALSE)) + return E_OK; + + _formi_dbg_printf("%s: splitting line at %d\n", __func__, pos); + + /* Need an extra line struct, check free list first */ + if (field->free != NULL) { + new_line = field->free; + field->free = new_line->next; + if (field->free != NULL) + field->free->prev = NULL; + } else { + if ((new_line = malloc(sizeof(*new_line))) == NULL) + return E_SYSTEM_ERROR; + new_line->prev = NULL; + new_line->next = NULL; + new_line->allocated = 0; + new_line->length = 0; + new_line->expanded = 0; + new_line->string = NULL; + new_line->hard_ret = FALSE; + new_line->tabs = NULL; + } + + _formi_dbg_printf("%s: enter: length = %d, expanded = %d\n", __func__, + row->length, row->expanded); + + assert((row->length < INT_MAX) && (row->expanded < INT_MAX)); + + + /* add new line to the row list */ + new_line->next = row->next; + new_line->prev = row; + row->next = new_line; + if (new_line->next != NULL) + new_line->next->prev = new_line; + + new_line->length = row->length - pos; + if (new_line->length >= new_line->allocated) { + if ((newp = realloc(new_line->string, + (size_t) new_line->length + 1)) == NULL) + return E_SYSTEM_ERROR; + new_line->string = newp; + new_line->allocated = new_line->length + 1; + } + + strcpy(new_line->string, &row->string[pos]); + + row->length = pos; + row->string[pos] = '\0'; + + if (row->length != 0) + row->expanded = _formi_tab_expanded_length(row->string, 0, + row->length - 1); + else + row->expanded = 0; + _formi_calculate_tabs(row); + + if (new_line->length != 0) + new_line->expanded = + _formi_tab_expanded_length(new_line->string, 0, + new_line->length - 1); + else + new_line->expanded = 0; + + _formi_calculate_tabs(new_line); + + /* + * If the given row was the current line then adjust the + * current line pointer if necessary + */ + if ((field->cur_line == row) && (field->row_xpos >= pos)) { + field->cur_line = new_line; + field->row_xpos -= pos; + field->cursor_xpos = + _formi_tab_expanded_length(new_line->string, 0, + field->row_xpos); + if (field->cursor_xpos > 0) + field->cursor_xpos--; + + field->cursor_ypos++; + if (field->cursor_ypos >= field->rows) { + if (field->start_line->next != NULL) { + field->start_line = field->start_line->next; + field->cursor_ypos = field->rows - 1; + } + else + assert(field->start_line->next == NULL); + } + } + + /* + * If the line split had a hard return then replace the + * current line's hard return with a soft return and carry + * the hard return onto the line after. + */ + if (row->hard_ret == TRUE) { + new_line->hard_ret = TRUE; + row->hard_ret = FALSE; + } + + /* + * except where we are doing a hard split then the current + * row must have a hard return on it too... + */ + if (hard_split == TRUE) { + row->hard_ret = TRUE; + } + + assert(((row->expanded < INT_MAX) && + (new_line->expanded < INT_MAX) && + (row->length < INT_MAX) && + (new_line->length < INT_MAX))); + + _formi_dbg_printf("%s: exit: ", __func__); + _formi_dbg_printf("row.length = %d, row.expanded = %d, ", + row->length, row->expanded); + _formi_dbg_printf("next_line.length = %d, next_line.expanded = %d, ", + new_line->length, new_line->expanded); + _formi_dbg_printf("row_count = %d\n", field->row_count + 1); + + field->row_count++; + *rowp = new_line; + + return E_OK; +} + +/* + * skip the blanks in the given string, start at the index start and + * continue forward until either the end of the string or a non-blank + * character is found. Return the index of either the end of the string or + * the first non-blank character. + */ +unsigned +_formi_skip_blanks(char *string, unsigned int start) +{ + unsigned int i; + + i = start; + + while ((string[i] != '\0') && isblank((unsigned char)string[i])) + i++; + + return i; +} + +/* + * Skip the blanks in the string associated with the given row, pass back + * the row and the offset at which the first non-blank is found. If no + * non-blank character is found then return the index to the last + * character on the last line. + */ + +unsigned +field_skip_blanks(unsigned int start, _FORMI_FIELD_LINES **rowp) +{ + unsigned int i; + _FORMI_FIELD_LINES *row, *last = NULL; + + row = *rowp; + i = start; + + do { + i = _formi_skip_blanks(&row->string[i], i); + if (!isblank((unsigned char)row->string[i])) { + last = row; + row = row->next; + /* + * don't reset if last line otherwise we will + * not be at the end of the string. + */ + if (row != NULL) + i = 0; + } else + break; + } + while (row != NULL); + + /* + * If we hit the end of the row list then point at the last row + * otherwise we return the row we found the blank on. + */ + if (row == NULL) + *rowp = last; + else + *rowp = row; + + return i; +} + +/* + * Return the index of the top left most field of the two given fields. + */ +static int +_formi_top_left(FORM *form, int a, int b) +{ + /* lower row numbers always win here.... */ + if (form->fields[a]->form_row < form->fields[b]->form_row) + return a; + + if (form->fields[a]->form_row > form->fields[b]->form_row) + return b; + + /* rows must be equal, check columns */ + if (form->fields[a]->form_col < form->fields[b]->form_col) + return a; + + if (form->fields[a]->form_col > form->fields[b]->form_col) + return b; + + /* if we get here fields must be in exactly the same place, punt */ + return a; +} + +/* + * Return the index to the field that is the bottom-right-most of the + * two given fields. + */ +static int +_formi_bottom_right(FORM *form, int a, int b) +{ + /* check the rows first, biggest row wins */ + if (form->fields[a]->form_row > form->fields[b]->form_row) + return a; + if (form->fields[a]->form_row < form->fields[b]->form_row) + return b; + + /* rows must be equal, check cols, biggest wins */ + if (form->fields[a]->form_col > form->fields[b]->form_col) + return a; + if (form->fields[a]->form_col < form->fields[b]->form_col) + return b; + + /* fields in the same place, punt */ + return a; +} + +/* + * Find the end of the current word in the string str, starting at + * offset - the end includes any trailing whitespace. If the end of + * the string is found before a new word then just return the offset + * to the end of the string. If do_join is TRUE then lines will be + * joined (without wrapping) until either the end of the field or the + * end of a word is found (whichever comes first). + */ +static int +find_eow(FIELD *cur, unsigned int offset, bool do_join, + _FORMI_FIELD_LINES **rowp) +{ + int start; + _FORMI_FIELD_LINES *row; + + row = *rowp; + start = offset; + + do { + /* first skip any non-whitespace */ + while ((row->string[start] != '\0') + && !isblank((unsigned char)row->string[start])) + start++; + + /* see if we hit the end of the string */ + if (row->string[start] == '\0') { + if (do_join == TRUE) { + if (row->next == NULL) + return start; + + if (_formi_join_line(cur, &row, JOIN_NEXT_NW) + != E_OK) + return E_REQUEST_DENIED; + } else { + do { + if (row->next == NULL) { + *rowp = row; + return start; + } else { + row = row->next; + start = 0; + } + } while (row->length == 0); + } + } + } while (!isblank((unsigned char)row->string[start])); + + do { + /* otherwise skip the whitespace.... */ + while ((row->string[start] != '\0') + && isblank((unsigned char)row->string[start])) + start++; + + if (row->string[start] == '\0') { + if (do_join == TRUE) { + if (row->next == NULL) + return start; + + if (_formi_join_line(cur, &row, JOIN_NEXT_NW) + != E_OK) + return E_REQUEST_DENIED; + } else { + do { + if (row->next == NULL) { + *rowp = row; + return start; + } else { + row = row->next; + start = 0; + } + } while (row->length == 0); + } + } + } while (isblank((unsigned char)row->string[start])); + + *rowp = row; + return start; +} + +/* + * Find the beginning of the current word in the string str, starting + * at offset. + */ +static int +find_sow(unsigned int offset, _FORMI_FIELD_LINES **rowp) +{ + int start; + char *str; + _FORMI_FIELD_LINES *row; + + row = *rowp; + str = row->string; + start = offset; + + do { + if (start > 0) { + if (isblank((unsigned char)str[start]) || + isblank((unsigned char)str[start - 1])) { + if (isblank((unsigned char)str[start - 1])) + start--; + /* skip the whitespace.... */ + while ((start >= 0) && + isblank((unsigned char)str[start])) + start--; + } + } + + /* see if we hit the start of the string */ + if (start < 0) { + do { + if (row->prev == NULL) { + *rowp = row; + start = 0; + return start; + } else { + row = row->prev; + str = row->string; + if (row->length > 0) + start = row->length - 1; + else + start = 0; + } + } while (row->length == 0); + } + } while (isblank((unsigned char)row->string[start])); + + /* see if we hit the start of the string */ + if (start < 0) { + *rowp = row; + return 0; + } + + /* now skip any non-whitespace */ + do { + while ((start >= 0) && !isblank((unsigned char)str[start])) + start--; + + + if (start < 0) { + do { + if (row->prev == NULL) { + *rowp = row; + start = 0; + return start; + } else { + row = row->prev; + str = row->string; + if (row->length > 0) + start = row->length - 1; + else + start = 0; + } + } while (row->length == 0); + } + } while (!isblank((unsigned char)str[start])); + + if (start > 0) { + start++; /* last loop has us pointing at a space, adjust */ + if (start >= row->length) { + if (row->next != NULL) { + start = 0; + row = row->next; + } else { + start = row->length - 1; + } + } + } + + if (start < 0) + start = 0; + + *rowp = row; + return start; +} + +/* + * Scroll the field forward the given number of lines. + */ +static void +_formi_scroll_fwd(FIELD *field, unsigned int amt) +{ + unsigned int count; + _FORMI_FIELD_LINES *end_row; + + end_row = field->start_line; + /* walk the line structs forward to find the bottom of the field */ + count = field->rows - 1; + while ((count > 0) && (end_row->next != NULL)) + { + count--; + end_row = end_row->next; + } + + /* check if there are lines to scroll */ + if ((count > 0) && (end_row->next == NULL)) + return; + + /* + * ok, lines to scroll - do this by walking both the start_line + * and the end_row at the same time for amt lines, we stop when + * either we have done the number of lines or end_row hits the + * last line in the field. + */ + count = amt; + while ((count > 0) && (end_row->next != NULL)) { + count--; + field->start_line = field->start_line->next; + end_row = end_row->next; + } +} + +/* + * Scroll the field backward the given number of lines. + */ +static void +_formi_scroll_back(FIELD *field, unsigned int amt) +{ + unsigned int count; + + /* check for lines above */ + if (field->start_line->prev == NULL) + return; + + /* + * Backward scroll is easy, follow row struct chain backward until + * the number of lines done or we reach the top of the field. + */ + count = amt; + while ((count > 0) && (field->start_line->prev != NULL)) { + count--; + field->start_line = field->start_line->prev; + } +} + +/* + * Scroll the field forward the given number of characters. + */ +void +_formi_hscroll_fwd(FIELD *field, _FORMI_FIELD_LINES *row, int unsigned amt) +{ + unsigned int end, scroll_amt, expanded; + _formi_tab_t *ts; + + + if ((row->tabs == NULL) || (row->tabs->in_use == FALSE)) { + /* if the line has no tabs things are easy... */ + end = field->start_char + field->cols + amt - 1; + scroll_amt = amt; + if (end > row->length) { + end = row->length; + scroll_amt = end - field->start_char - field->cols + 1; + } + } else { + /* + * If there are tabs we need to add on the scroll amount, + * find the last char position that will fit into + * the field and finally fix up the start_char. This + * is a lot of work but handling the case where there + * are not enough chars to scroll by amt is difficult. + */ + end = field->start_char + field->row_xpos + amt; + if (end >= row->length) + end = row->length - 1; + else { + expanded = _formi_tab_expanded_length( + row->string, + field->start_char + amt, + field->start_char + field->row_xpos + amt); + ts = row->tabs; + /* skip tabs to the lhs of our starting point */ + while ((ts != NULL) && (ts->in_use == TRUE) + && (ts->pos < end)) + ts = ts->fwd; + + while ((expanded <= field->cols) + && (end < row->length)) { + if (row->string[end] == '\t') { + assert((ts != NULL) + && (ts->in_use == TRUE)); + if (ts->pos == end) { + if ((expanded + ts->size) + > field->cols) + break; + expanded += ts->size; + ts = ts->fwd; + } + else + assert(ts->pos == end); + } else + expanded++; + end++; + } + } + + scroll_amt = tab_fit_window(field, end, field->cols); + if (scroll_amt < field->start_char) + scroll_amt = 1; + else + scroll_amt -= field->start_char; + + scroll_amt = min(scroll_amt, amt); + } + + field->start_char += scroll_amt; + field->cursor_xpos = + _formi_tab_expanded_length(row->string, + field->start_char, + field->row_xpos + + field->start_char) - 1; + +} + +/* + * Scroll the field backward the given number of characters. + */ +void +_formi_hscroll_back(FIELD *field, _FORMI_FIELD_LINES *row, unsigned int amt) +{ + field->start_char -= min(field->start_char, amt); + field->cursor_xpos = + _formi_tab_expanded_length(row->string, field->start_char, + field->row_xpos + + field->start_char) - 1; + if (field->cursor_xpos >= field->cols) { + field->row_xpos = 0; + field->cursor_xpos = 0; + } +} + +/* + * Find the different pages in the form fields and assign the form + * page_starts array with the information to find them. + */ +int +_formi_find_pages(FORM *form) +{ + int i, cur_page = 0; + + if ((form->page_starts = calloc((form->max_page + 1), + sizeof(*form->page_starts))) == NULL) + return E_SYSTEM_ERROR; + + for (i = 0; i < form->field_count; i++) { + if (form->fields[i]->page_break == 1) + cur_page++; + if (form->page_starts[cur_page].in_use == 0) { + form->page_starts[cur_page].in_use = 1; + form->page_starts[cur_page].first = i; + form->page_starts[cur_page].last = i; + form->page_starts[cur_page].top_left = i; + form->page_starts[cur_page].bottom_right = i; + } else { + form->page_starts[cur_page].last = i; + form->page_starts[cur_page].top_left = + _formi_top_left(form, + form->page_starts[cur_page].top_left, + i); + form->page_starts[cur_page].bottom_right = + _formi_bottom_right(form, + form->page_starts[cur_page].bottom_right, + i); + } + } + + return E_OK; +} + +/* + * Completely redraw the field of the given form. + */ +void +_formi_redraw_field(FORM *form, int field) +{ + unsigned int pre, post, flen, slen, i, j, start, line; + unsigned int tab, cpos, len; + char *str, c; + FIELD *cur; + _FORMI_FIELD_LINES *row; +#ifdef DEBUG + char buffer[100]; +#endif + + cur = form->fields[field]; + flen = cur->cols; + slen = 0; + start = 0; + line = 0; + + for (row = cur->start_line; ((row != NULL) && (line < cur->rows)); + row = row->next, line++) { + wmove(form->scrwin, (int) (cur->form_row + line), + (int) cur->form_col); + if ((cur->rows + cur->nrows) == 1) { + if ((cur->cols + cur->start_char) >= row->length) + len = row->length; + else + len = cur->cols + cur->start_char; + if (row->string != NULL) + slen = _formi_tab_expanded_length( + row->string, cur->start_char, len); + else + slen = 0; + + if (slen > cur->cols) + slen = cur->cols; + slen += cur->start_char; + } else + slen = row->expanded; + + if ((cur->opts & O_STATIC) == O_STATIC) { + switch (cur->justification) { + case JUSTIFY_RIGHT: + post = 0; + if (flen < slen) + pre = 0; + else + pre = flen - slen; + break; + + case JUSTIFY_CENTER: + if (flen < slen) { + pre = 0; + post = 0; + } else { + pre = flen - slen; + post = pre = pre / 2; + /* get padding right if + centring is not even */ + if ((post + pre + slen) < flen) + post++; + } + break; + + case NO_JUSTIFICATION: + case JUSTIFY_LEFT: + default: + pre = 0; + if (flen <= slen) + post = 0; + else { + post = flen - slen; + if (post > flen) + post = flen; + } + break; + } + } else { + /* dynamic fields are not justified */ + pre = 0; + if (flen <= slen) + post = 0; + else { + post = flen - slen; + if (post > flen) + post = flen; + } + + /* but they do scroll.... */ + + if (pre > cur->start_char - start) + pre = pre - cur->start_char + start; + else + pre = 0; + + if (slen > cur->start_char) { + slen -= cur->start_char; + if (slen > flen) + post = 0; + else + post = flen - slen; + + if (post > flen) + post = flen; + } else { + slen = 0; + post = flen - pre; + } + } + + if (form->cur_field == field) + wattrset(form->scrwin, cur->fore); + else + wattrset(form->scrwin, cur->back); + + str = &row->string[cur->start_char]; + +#ifdef DEBUG + _formi_dbg_printf( + "%s: start=%d, pre=%d, slen=%d, flen=%d, post=%d, " + "start_char=%d\n", __func__, + start, pre, slen, flen, post, cur->start_char); + if (str != NULL) { + if (row->expanded != 0) { + strncpy(buffer, str, flen); + } else { + strcpy(buffer, "(empty)"); + } + } else { + strcpy(buffer, "(null)"); + } + buffer[flen] = '\0'; + _formi_dbg_printf("%s: %s\n", __func__, buffer); +#endif + + for (i = start + cur->start_char; i < pre; i++) + waddch(form->scrwin, cur->pad); + + _formi_dbg_printf("%s: will add %d chars\n", __func__, + min(slen, flen)); + for (i = 0, cpos = cur->start_char; i < min(slen, flen); + i++, str++, cpos++) + { + c = *str; + tab = 0; /* just to shut gcc up */ + _formi_dbg_printf("adding char str[%d]=%c\n", + cpos + cur->start_char, c); + if (((cur->opts & O_PUBLIC) != O_PUBLIC)) { + if (c == '\t') + tab = add_tab(form, row, cpos, + cur->pad); + else + waddch(form->scrwin, cur->pad); + } else if ((cur->opts & O_VISIBLE) == O_VISIBLE) { + if (c == '\t') + tab = add_tab(form, row, cpos, ' '); + else + waddch(form->scrwin, c); + } else { + if (c == '\t') + tab = add_tab(form, row, cpos, ' '); + else + waddch(form->scrwin, ' '); + } + + /* + * If we have had a tab then skip forward + * the requisite number of chars to keep + * things in sync. + */ + if (c == '\t') + i += tab - 1; + } + + for (i = 0; i < post; i++) + waddch(form->scrwin, cur->pad); + } + + for (i = line; i < cur->rows; i++) { + wmove(form->scrwin, (int) (cur->form_row + i), + (int) cur->form_col); + + if (form->cur_field == field) + wattrset(form->scrwin, cur->fore); + else + wattrset(form->scrwin, cur->back); + + for (j = 0; j < cur->cols; j++) { + waddch(form->scrwin, cur->pad); + } + } + + wattrset(form->scrwin, cur->back); + return; +} + +/* + * Add the correct number of the given character to simulate a tab + * in the field. + */ +static int +add_tab(FORM *form, _FORMI_FIELD_LINES *row, unsigned int i, char c) +{ + int j; + _formi_tab_t *ts = row->tabs; + + while ((ts != NULL) && (ts->pos != i)) + ts = ts->fwd; + + assert(ts != NULL); + + for (j = 0; j < ts->size; j++) + waddch(form->scrwin, c); + + return ts->size; +} + + +/* + * Display the fields attached to the form that are on the current page + * on the screen. + * + */ +int +_formi_draw_page(FORM *form) +{ + int i; + + if (form->page_starts[form->page].in_use == 0) + return E_BAD_ARGUMENT; + + wclear(form->scrwin); + + for (i = form->page_starts[form->page].first; + i <= form->page_starts[form->page].last; i++) + _formi_redraw_field(form, i); + + return E_OK; +} + +/* + * Add the character c at the position pos in buffer 0 of the given field + */ +int +_formi_add_char(FIELD *field, unsigned int pos, char c) +{ + char *new, old_c; + unsigned int new_size; + int status; + _FORMI_FIELD_LINES *row, *temp, *next_temp; + + row = field->cur_line; + + /* + * If buffer has not had a string before, set it to a blank + * string. Everything should flow from there.... + */ + if (row->string == NULL) { + if ((row->string = malloc((size_t)INITIAL_LINE_ALLOC)) == NULL) + return E_SYSTEM_ERROR; + row->string[0] = '\0'; + row->allocated = INITIAL_LINE_ALLOC; + row->length = 0; + row->expanded = 0; + } + + if (_formi_validate_char(field, c) != E_OK) { + _formi_dbg_printf("%s: char %c failed char validation\n", + __func__, c); + return E_INVALID_FIELD; + } + + if ((c == '\t') && (field->cols <= 8)) { + _formi_dbg_printf("%s: field too small for a tab\n", __func__); + return E_NO_ROOM; + } + + _formi_dbg_printf("%s: pos=%d, char=%c\n", __func__, pos, c); + _formi_dbg_printf("%s: xpos=%d, row_pos=%d, start=%d\n", __func__, + field->cursor_xpos, field->row_xpos, field->start_char); + _formi_dbg_printf("%s: length=%d(%d), allocated=%d\n", __func__, + row->expanded, row->length, row->allocated); + _formi_dbg_printf("%s: %s\n", __func__, row->string); + _formi_dbg_printf("%s: buf0_status=%d\n", __func__, field->buf0_status); + if (((field->opts & O_BLANK) == O_BLANK) && + (field->buf0_status == FALSE) && + ((field->row_xpos + field->start_char) == 0)) { + row = field->alines; + if (row->next != NULL) { + /* shift all but one line structs to free list */ + temp = row->next; + do { + next_temp = temp->next; + add_to_free(field, temp); + temp = next_temp; + } while (temp != NULL); + } + + row->length = 0; + row->string[0] = '\0'; + pos = 0; + field->start_char = 0; + field->start_line = row; + field->cur_line = row; + field->row_count = 1; + field->row_xpos = 0; + field->cursor_ypos = 0; + row->expanded = 0; + row->length = 0; + _formi_init_field_xpos(field); + } + + + if ((field->overlay == 0) + || ((field->overlay == 1) && (pos >= row->length))) { + /* first check if the field can have more chars...*/ + if (check_field_size(field) == FALSE) + return E_REQUEST_DENIED; + + if (row->length + 2 + >= row->allocated) { + new_size = row->allocated + 16 - (row->allocated % 16); + if ((new = realloc(row->string, + (size_t) new_size )) == NULL) + return E_SYSTEM_ERROR; + row->allocated = new_size; + row->string = new; + } + } + + if ((field->overlay == 0) && (row->length > pos)) { + memmove(&row->string[pos + 1], &row->string[pos], + (size_t) (row->length - pos + 1)); + } + + old_c = row->string[pos]; + row->string[pos] = c; + if (pos >= row->length) { + /* make sure the string is terminated if we are at the + * end of the string, the terminator would be missing + * if we are at the end of the field. + */ + row->string[pos + 1] = '\0'; + } + + /* only increment the length if we are inserting characters + * OR if we are at the end of the field in overlay mode. + */ + if ((field->overlay == 0) + || ((field->overlay == 1) && (pos >= row->length))) { + row->length++; + } + + _formi_calculate_tabs(row); + row->expanded = _formi_tab_expanded_length(row->string, 0, + row->length - 1); + + /* wrap the field, if needed */ + status = _formi_wrap_field(field, row); + + row = field->cur_line; + pos = field->row_xpos; + + /* + * check the wrap worked or that we have not exceeded the + * max field size - this can happen if the field is re-wrapped + * and the row count is increased past the set limit. + */ + if ((status != E_OK) || (check_field_size(field) == FALSE)) { + if ((field->overlay == 0) + || ((field->overlay == 1) + && (pos >= (row->length - 1) /*XXXX- append check???*/))) { + /* + * wrap failed for some reason, back out the + * char insert + */ + memmove(&row->string[pos], &row->string[pos + 1], + (size_t) (row->length - pos)); + row->length--; + if (pos > 0) + pos--; + } else if (field->overlay == 1) { + /* back out character overlay */ + row->string[pos] = old_c; + } + + _formi_calculate_tabs(row); + + _formi_wrap_field(field, row); + /* + * If we are here then either the status is bad or we + * simply ran out of room. If the status is E_OK then + * we ran out of room, let the form driver know this. + */ + if (status == E_OK) + status = E_REQUEST_DENIED; + + } else { + field->buf0_status = TRUE; + field->row_xpos++; + if ((field->rows + field->nrows) == 1) { + status = _formi_set_cursor_xpos(field, FALSE); + } else { + field->cursor_xpos = + _formi_tab_expanded_length( + row->string, 0, field->row_xpos - 1); + + /* + * Annoying corner case - if we are right in + * the bottom right corner of the field we + * need to scroll the field one line so the + * cursor is positioned correctly in the + * field. + */ + if ((field->cursor_xpos >= field->cols) && + (field->cursor_ypos == (field->rows - 1))) { + field->cursor_ypos--; + field->start_line = field->start_line->next; + } + } + } + + assert((field->cursor_xpos <= field->cols) + && (field->cursor_ypos < 400000)); + + _formi_dbg_printf("%s: xpos=%d, row_pos=%d, start=%d\n", __func__, + field->cursor_xpos, field->row_xpos, field->start_char); + _formi_dbg_printf("%s: length=%d(%d), allocated=%d\n", __func__, + row->expanded, row->length, row->allocated); + _formi_dbg_printf("%s: ypos=%d, start_line=%p\n", __func__, + field->cursor_ypos, field->start_line); + _formi_dbg_printf("%s: %s\n", __func__, row->string); + _formi_dbg_printf("%s: buf0_status=%d\n", __func__, field->buf0_status); + _formi_dbg_printf("%s: status = %s\n", __func__, + (status == E_OK)? "OK" : "FAILED"); + return status; +} + +/* + * Set the position of the cursor on the screen in the row depending on + * where the current position in the string is and the justification + * that is to be applied to the field. Justification is only applied + * to single row, static fields. + */ +static int +_formi_set_cursor_xpos(FIELD *field, int noscroll) +{ + int just, pos; + + just = field->justification; + pos = field->start_char + field->row_xpos; + + _formi_dbg_printf( + "%s: pos %d, start_char %d, row_xpos %d, xpos %d\n", __func__, + pos, field->start_char, field->row_xpos, field->cursor_xpos); + + /* + * make sure we apply the correct justification to non-static + * fields. + */ + if (((field->rows + field->nrows) != 1) || + ((field->opts & O_STATIC) != O_STATIC)) + just = JUSTIFY_LEFT; + + switch (just) { + case JUSTIFY_RIGHT: + field->cursor_xpos = field->cols - 1 + - _formi_tab_expanded_length( + field->cur_line->string, 0, + field->cur_line->length - 1) + + _formi_tab_expanded_length( + field->cur_line->string, 0, + field->row_xpos); + break; + + case JUSTIFY_CENTER: + field->cursor_xpos = ((field->cols - 1) + - _formi_tab_expanded_length( + field->cur_line->string, 0, + field->cur_line->length - 1) + 1) / 2 + + _formi_tab_expanded_length(field->cur_line->string, + 0, field->row_xpos); + + if (field->cursor_xpos > (field->cols - 1)) + field->cursor_xpos = (field->cols - 1); + break; + + default: + field->cursor_xpos = _formi_tab_expanded_length( + field->cur_line->string, + field->start_char, + field->row_xpos + field->start_char); + if ((field->cursor_xpos <= (field->cols - 1)) && + ((field->start_char + field->row_xpos) + < field->cur_line->length)) + field->cursor_xpos--; + + if (field->cursor_xpos > (field->cols - 1)) { + if ((field->opts & O_STATIC) == O_STATIC) { + field->start_char = 0; + + if (field->row_xpos + == (field->cur_line->length - 1)) { + field->cursor_xpos = field->cols - 1; + } else { + field->cursor_xpos = + _formi_tab_expanded_length( + field->cur_line->string, + field->start_char, + field->row_xpos + + field->start_char + - 1) - 1; + } + } else { + if (noscroll == FALSE) { + field->start_char = + tab_fit_window( + field, + field->start_char + + field->row_xpos, + field->cols); + field->row_xpos = pos + - field->start_char; + field->cursor_xpos = + _formi_tab_expanded_length( + field->cur_line->string, + field->start_char, + field->row_xpos + + field->start_char - 1); + } else { + field->cursor_xpos = (field->cols - 1); + } + } + + } + break; + } + + _formi_dbg_printf( + "%s: pos %d, start_char %d, row_xpos %d, xpos %d\n", __func__, + pos, field->start_char, field->row_xpos, field->cursor_xpos); + return E_OK; +} + +/* + * Manipulate the text in a field, this takes the given form and performs + * the passed driver command on the current text field. Returns 1 if the + * text field was modified. + */ +int +_formi_manipulate_field(FORM *form, int c) +{ + FIELD *cur; + char *str, saved; + unsigned int start, end, pos, status, old_count, size; + unsigned int old_xpos, old_row_pos; + int len, wb; + bool eat_char; + _FORMI_FIELD_LINES *row, *rs; + + cur = form->fields[form->cur_field]; + if (cur->cur_line->string == NULL) + return E_REQUEST_DENIED; + + _formi_dbg_printf("%s: request is REQ_%s\n", + __func__, reqs[c - REQ_MIN_REQUEST]); + _formi_dbg_printf( + "%s: xpos=%d, row_pos=%d, start_char=%d, length=%d, allocated=%d\n", + __func__, cur->cursor_xpos, cur->row_xpos, cur->start_char, + cur->cur_line->length, cur->cur_line->allocated); + _formi_dbg_printf("%s: start_line=%p, ypos=%d\n", __func__, + cur->start_line, cur->cursor_ypos); + if (cur->cur_line->string == NULL) + _formi_dbg_printf("%s: string=(null)\n", __func__); + else + _formi_dbg_printf("%s: string=\"%s\"\n", __func__, + cur->cur_line->string); + + /* Cannot manipulate a null string! */ + if (cur->cur_line->string == NULL) + return E_REQUEST_DENIED; + + saved = '\0'; + row = cur->cur_line; + + switch (c) { + case REQ_RIGHT_CHAR: + /* + * The right_char request performs the same function + * as the next_char request except that the cursor is + * not wrapped if it is at the end of the line, so + * check if the cursor is at the end of the line and + * deny the request otherwise just fall through to + * the next_char request handler. + */ + if (cur->cursor_xpos >= cur->cols - 1) + return E_REQUEST_DENIED; + + /* FALLTHRU */ + + case REQ_NEXT_CHAR: + /* for a dynamic field allow an offset of one more + * char so we can insert chars after end of string. + * Static fields cannot do this so deny request if + * cursor is at the end of the field. + */ + if (((cur->opts & O_STATIC) == O_STATIC) && + (cur->row_xpos == cur->cols - 1) && + ((cur->rows + cur->nrows) == 1)) + return E_REQUEST_DENIED; + + if (((cur->rows + cur->nrows) == 1) && + (cur->row_xpos + cur->start_char + 1) > row->length) + return E_REQUEST_DENIED; + + if ((cur->rows + cur->nrows) == 1) { + cur->row_xpos++; + _formi_set_cursor_xpos(cur, (c == REQ_RIGHT_CHAR)); + } else { + if (cur->cursor_xpos >= (row->expanded - 1)) { + if ((row->next == NULL) || + (c == REQ_RIGHT_CHAR)) + return E_REQUEST_DENIED; + + cur->cursor_xpos = 0; + cur->row_xpos = 0; + cur->cur_line = cur->cur_line->next; + if (cur->cursor_ypos == (cur->rows - 1)) + cur->start_line = + cur->start_line->next; + else + cur->cursor_ypos++; + } else { + old_xpos = cur->cursor_xpos; + old_row_pos = cur->row_xpos; + if (row->string[cur->row_xpos] == '\t') + cur->cursor_xpos += tab_size(row, + cur->row_xpos); + else + cur->cursor_xpos++; + cur->row_xpos++; + if (cur->cursor_xpos + >= row->expanded) { + if ((row->next == NULL) || + (c == REQ_RIGHT_CHAR)) { + cur->cursor_xpos = old_xpos; + cur->row_xpos = old_row_pos; + return E_REQUEST_DENIED; + } + + cur->cursor_xpos = 0; + cur->row_xpos = 0; + cur->cur_line = cur->cur_line->next; + if (cur->cursor_ypos + == (cur->rows - 1)) + cur->start_line = + cur->start_line->next; + else + cur->cursor_ypos++; + } + } + } + + break; + + case REQ_LEFT_CHAR: + /* + * The behaviour of left_char is the same as prev_char + * except that the cursor will not wrap if it has + * reached the LHS of the field, so just check this + * and fall through if we are not at the LHS. + */ + if (cur->cursor_xpos == 0) + return E_REQUEST_DENIED; + + /* FALLTHRU */ + case REQ_PREV_CHAR: + if ((cur->rows + cur->nrows) == 1) { + if (cur->row_xpos == 0) { + if (cur->start_char > 0) + cur->start_char--; + else + return E_REQUEST_DENIED; + } else { + cur->row_xpos--; + _formi_set_cursor_xpos(cur, FALSE); + } + } else { + if ((cur->cursor_xpos == 0) && + (cur->cursor_ypos == 0) && + (cur->start_line->prev == NULL)) + return E_REQUEST_DENIED; + + pos = cur->row_xpos; + if (cur->cursor_xpos > 0) { + if (row->string[pos] == '\t') { + size = tab_size(row, pos); + if (size > cur->cursor_xpos) { + cur->cursor_xpos = 0; + cur->row_xpos = 0; + } else { + cur->row_xpos--; + cur->cursor_xpos -= size; + } + } else { + cur->cursor_xpos--; + cur->row_xpos--; + } + } else { + cur->cur_line = cur->cur_line->prev; + if (cur->cursor_ypos > 0) + cur->cursor_ypos--; + else + cur->start_line = + cur->start_line->prev; + row = cur->cur_line; + if (row->expanded > 0) { + cur->cursor_xpos = row->expanded - 1; + } else { + cur->cursor_xpos = 0; + } + + if (row->length > 0) + cur->row_xpos = row->length - 1; + else + cur->row_xpos = 0; + } + } + + break; + + case REQ_DOWN_CHAR: + /* + * The down_char request has the same functionality as + * the next_line request excepting that the field is not + * scrolled if the cursor is at the bottom of the field. + * Check to see if the cursor is at the bottom of the field + * and if it is then deny the request otherwise fall + * through to the next_line handler. + */ + if (cur->cursor_ypos >= cur->rows - 1) + return E_REQUEST_DENIED; + + /* FALLTHRU */ + + case REQ_NEXT_LINE: + if ((row->next == NULL) || (cur->cur_line->next == NULL)) + return E_REQUEST_DENIED; + + cur->cur_line = cur->cur_line->next; + if ((cur->cursor_ypos + 1) >= cur->rows) { + cur->start_line = cur->start_line->next; + } else + cur->cursor_ypos++; + row = cur->cur_line; + + if (row->length == 0) { + cur->row_xpos = 0; + cur->cursor_xpos = 0; + } else { + if (cur->cursor_xpos > (row->expanded - 1)) + cur->cursor_xpos = row->expanded - 1; + + cur->row_xpos = tab_fit_len(row, cur->cursor_xpos + 1); + if (cur->row_xpos == 0) + cur->cursor_xpos = 0; + else + cur->cursor_xpos = + _formi_tab_expanded_length( + row->string, 0, cur->row_xpos); + if (cur->cursor_xpos > 0) + cur->cursor_xpos--; + } + break; + + case REQ_UP_CHAR: + /* + * The up_char request has the same functionality as + * the prev_line request excepting the field is not + * scrolled, check if the cursor is at the top of the + * field, if it is deny the request otherwise fall + * through to the prev_line handler. + */ + if (cur->cursor_ypos == 0) + return E_REQUEST_DENIED; + + /* FALLTHRU */ + + case REQ_PREV_LINE: + if (cur->cur_line->prev == NULL) + return E_REQUEST_DENIED; + + if (cur->cursor_ypos == 0) { + if (cur->start_line->prev == NULL) + return E_REQUEST_DENIED; + cur->start_line = cur->start_line->prev; + } else + cur->cursor_ypos--; + + cur->cur_line = cur->cur_line->prev; + row = cur->cur_line; + + if (row->length == 0) { + cur->row_xpos = 0; + cur->cursor_xpos = 0; + } else { + if (cur->cursor_xpos > (row->expanded - 1)) + cur->cursor_xpos = row->expanded - 1; + + cur->row_xpos = tab_fit_len(row, cur->cursor_xpos + 1); + cur->cursor_xpos = + _formi_tab_expanded_length(row->string, + 0, cur->row_xpos); + if (cur->cursor_xpos > 0) + cur->cursor_xpos--; + } + break; + + case REQ_NEXT_WORD: + start = cur->row_xpos + cur->start_char; + str = row->string; + + wb = find_eow(cur, start, FALSE, &row); + if (wb < 0) + return wb; + + start = wb; + /* check if we hit the end */ + if (str[start] == '\0') + return E_REQUEST_DENIED; + + /* otherwise we must have found the start of a word...*/ + if ((cur->rows + cur->nrows) == 1) { + /* single line field */ + size = _formi_tab_expanded_length(str, + cur->start_char, start); + if (size < cur->cols) { + cur->row_xpos = start - cur->start_char; + } else { + cur->start_char = start; + cur->row_xpos = 0; + } + _formi_set_cursor_xpos(cur, FALSE); + } else { + /* multiline field */ + cur->cur_line = row; + adjust_ypos(cur, row); + + cur->row_xpos = start; + cur->cursor_xpos = + _formi_tab_expanded_length( + row->string, 0, cur->row_xpos) - 1; + } + break; + + case REQ_PREV_WORD: + start = cur->start_char + cur->row_xpos; + if (cur->start_char > 0) + start--; + + if ((start == 0) && (row->prev == NULL)) + return E_REQUEST_DENIED; + + if (start == 0) { + row = row->prev; + if (row->length > 0) + start = row->length - 1; + else + start = 0; + } + + str = row->string; + + start = find_sow(start, &row); + + if ((cur->rows + cur->nrows) == 1) { + /* single line field */ + size = _formi_tab_expanded_length(str, + cur->start_char, start); + + if (start > cur->start_char) { + cur->row_xpos = start - cur->start_char; + } else { + cur->start_char = start; + cur->row_xpos = 0; + } + _formi_set_cursor_xpos(cur, FALSE); + } else { + /* multiline field */ + cur->cur_line = row; + adjust_ypos(cur, row); + cur->row_xpos = start; + cur->cursor_xpos = + _formi_tab_expanded_length( + row->string, 0, + cur->row_xpos) - 1; + } + + break; + + case REQ_BEG_FIELD: + cur->start_char = 0; + while (cur->start_line->prev != NULL) + cur->start_line = cur->start_line->prev; + cur->cur_line = cur->start_line; + cur->row_xpos = 0; + _formi_init_field_xpos(cur); + cur->cursor_ypos = 0; + break; + + case REQ_BEG_LINE: + cur->row_xpos = 0; + _formi_init_field_xpos(cur); + cur->start_char = 0; + break; + + case REQ_END_FIELD: + while (cur->cur_line->next != NULL) + cur->cur_line = cur->cur_line->next; + + if (cur->row_count > cur->rows) { + cur->start_line = cur->cur_line; + pos = cur->rows - 1; + while (pos > 0) { + cur->start_line = cur->start_line->prev; + pos--; + } + cur->cursor_ypos = cur->rows - 1; + } else { + cur->cursor_ypos = cur->row_count - 1; + } + + /* we fall through here deliberately, we are on the + * correct row, now we need to get to the end of the + * line. + */ + /* FALLTHRU */ + + case REQ_END_LINE: + row = cur->cur_line; + + if ((cur->rows + cur->nrows) == 1) { + if (row->expanded > cur->cols - 1) { + if ((cur->opts & O_STATIC) != O_STATIC) { + cur->start_char = tab_fit_window( + cur, row->length, + cur->cols) + 1; + cur->row_xpos = row->length + - cur->start_char; + } else { + cur->start_char = 0; + cur->row_xpos = cur->cols - 1; + } + } else { + cur->row_xpos = row->length + 1; + cur->start_char = 0; + } + _formi_set_cursor_xpos(cur, FALSE); + } else { + cur->row_xpos = row->length - 1; + cur->cursor_xpos = row->expanded - 1; + if (row->next == NULL) { + cur->row_xpos++; + cur->cursor_xpos++; + } + } + break; + + case REQ_NEW_LINE: + start = cur->start_char + cur->row_xpos; + if ((status = split_line(cur, TRUE, start, &row)) != E_OK) + return status; + cur->cur_line->hard_ret = TRUE; + cur->cursor_xpos = 0; + cur->row_xpos = 0; + break; + + case REQ_INS_CHAR: + if ((status = _formi_add_char(cur, cur->start_char + + cur->row_xpos, + cur->pad)) != E_OK) + return status; + break; + + case REQ_INS_LINE: + if ((status = split_line(cur, TRUE, 0, &row)) != E_OK) + return status; + cur->cur_line->hard_ret = TRUE; + break; + + case REQ_DEL_CHAR: + row = cur->cur_line; + start = cur->start_char + cur->row_xpos; + end = row->length - 1; + if ((start >= row->length) && (row->next == NULL)) + return E_REQUEST_DENIED; + + if ((start == row->length - 1) || (row->length == 0)) { + if ((cur->rows + cur->nrows) > 1) { + /* + * Firstly, check if the current line has + * a hard return. In this case we just + * want to "delete" the hard return and + * re-wrap the field. The hard return + * does not occupy a character space in + * the buffer but we must make it appear + * like it does for a deletion. + */ + if (row->hard_ret == TRUE) { + row->hard_ret = FALSE; + if (_formi_join_line(cur, &row, + JOIN_NEXT) + != E_OK) { + row->hard_ret = TRUE; + return 0; + } else { + return 1; + } + } + + /* + * If we have more than one row, join the + * next row to make things easier unless + * we are at the end of the string, in + * that case the join would fail but we + * really want to delete the last char + * in the field. + */ + if (row->next != NULL) { + if (_formi_join_line(cur, &row, + JOIN_NEXT_NW) + != E_OK) { + return E_REQUEST_DENIED; + } + } + } + } + + saved = row->string[start]; + memmove(&row->string[start], &row->string[start + 1], + (size_t) (end - start + 1)); + row->string[end] = '\0'; + row->length--; + if (row->length > 0) + row->expanded = _formi_tab_expanded_length( + row->string, 0, row->length - 1); + else + row->expanded = 0; + + /* + * recalculate tabs for a single line field, multiline + * fields will do this when the field is wrapped. + */ + if ((cur->rows + cur->nrows) == 1) + _formi_calculate_tabs(row); + /* + * if we are at the end of the string then back the + * cursor pos up one to stick on the end of the line + */ + if (start == row->length) { + if (row->length > 1) { + if ((cur->rows + cur->nrows) == 1) { + pos = cur->row_xpos + cur->start_char; + cur->start_char = + tab_fit_window( + cur, + cur->start_char + cur->row_xpos, + cur->cols); + cur->row_xpos = pos - cur->start_char + - 1; + _formi_set_cursor_xpos(cur, FALSE); + } else { + if (cur->row_xpos == 0) { + if (row->next != NULL) { + if (_formi_join_line( + cur, &row, + JOIN_PREV_NW) + != E_OK) { + return E_REQUEST_DENIED; + } + } else { + if (cur->row_count > 1) + cur->row_count--; + } + + } + + cur->row_xpos = start - 1; + cur->cursor_xpos = + _formi_tab_expanded_length( + row->string, + 0, cur->row_xpos - 1); + if ((cur->cursor_xpos > 0) + && (start != (row->expanded - 1))) + cur->cursor_xpos--; + } + + start--; + } else { + start = 0; + cur->row_xpos = 0; + _formi_init_field_xpos(cur); + } + } + + if ((cur->rows + cur->nrows) > 1) { + if (_formi_wrap_field(cur, row) != E_OK) { + memmove(&row->string[start + 1], + &row->string[start], + (size_t) (end - start)); + row->length++; + row->string[start] = saved; + _formi_wrap_field(cur, row); + return E_REQUEST_DENIED; + } + } + break; + + case REQ_DEL_PREV: + if ((cur->cursor_xpos == 0) && (cur->start_char == 0) + && (cur->start_line->prev == NULL) + && (cur->cursor_ypos == 0)) + return E_REQUEST_DENIED; + + row = cur->cur_line; + start = cur->row_xpos + cur->start_char; + end = row->length - 1; + eat_char = TRUE; + + if ((cur->start_char + cur->row_xpos) == 0) { + if (row->prev == NULL) + return E_REQUEST_DENIED; + + /* + * If we are a multiline field then check if + * the line above has a hard return. If it does + * then just "eat" the hard return and re-wrap + * the field. + */ + if (row->prev->hard_ret == TRUE) { + row->prev->hard_ret = FALSE; + if (_formi_join_line(cur, &row, + JOIN_PREV) != E_OK) { + row->prev->hard_ret = TRUE; + return 0; + } + + eat_char = FALSE; + } else { + start = row->prev->length; + /* + * Join this line to the previous + * one. + */ + if (_formi_join_line(cur, &row, + JOIN_PREV_NW) != E_OK) { + return 0; + } + end = row->length - 1; + } + } + + if (eat_char == TRUE) { + /* + * eat a char from the buffer. Normally we do + * this unless we have deleted a "hard return" + * in which case we just want to join the lines + * without losing a char. + */ + saved = row->string[start - 1]; + memmove(&row->string[start - 1], &row->string[start], + (size_t) (end - start + 1)); + row->length--; + row->string[row->length] = '\0'; + row->expanded = _formi_tab_expanded_length( + row->string, 0, row->length - 1); + } + + if ((cur->rows + cur->nrows) == 1) { + _formi_calculate_tabs(row); + pos = cur->row_xpos + cur->start_char; + if (pos > 0) + pos--; + cur->start_char = + tab_fit_window(cur, + cur->start_char + cur->row_xpos, + cur->cols); + cur->row_xpos = pos - cur->start_char; + _formi_set_cursor_xpos(cur, FALSE); + } else { + if (eat_char == TRUE) { + cur->row_xpos--; + if (cur->row_xpos > 0) + cur->cursor_xpos = + _formi_tab_expanded_length( + row->string, 0, + cur->row_xpos - 1); + else + cur->cursor_xpos = 0; + } + + if ((_formi_wrap_field(cur, row) != E_OK)) { + memmove(&row->string[start], + &row->string[start - 1], + (size_t) (end - start)); + row->length++; + row->string[start - 1] = saved; + row->string[row->length] = '\0'; + _formi_wrap_field(cur, row); + return E_REQUEST_DENIED; + } + } + break; + + case REQ_DEL_LINE: + if (((cur->rows + cur->nrows) == 1) || + (cur->row_count == 1)) { + /* single line case */ + row->length = 0; + row->expanded = row->length = 0; + cur->row_xpos = 0; + _formi_init_field_xpos(cur); + cur->cursor_ypos = 0; + } else { + /* multiline field */ + old_count = cur->row_count; + cur->row_count--; + if (cur->row_count == 0) + cur->row_count = 1; + + if (old_count == 1) { + row->expanded = row->length = 0; + cur->cursor_xpos = 0; + cur->row_xpos = 0; + cur->cursor_ypos = 0; + } else + add_to_free(cur, row); + + if (row->next == NULL) { + if (cur->cursor_ypos == 0) { + if (cur->start_line->prev != NULL) { + cur->start_line = + cur->start_line->prev; + } + } else { + cur->cursor_ypos--; + } + } + + if (old_count > 1) { + if (cur->cursor_xpos > row->expanded) { + cur->cursor_xpos = row->expanded - 1; + cur->row_xpos = row->length - 1; + } + + cur->start_line = cur->alines; + rs = cur->start_line; + cur->cursor_ypos = 0; + while (rs != row) { + if (cur->cursor_ypos < cur->rows) + cur->cursor_ypos++; + else + cur->start_line = + cur->start_line->next; + rs = rs->next; + } + } + } + break; + + case REQ_DEL_WORD: + start = cur->start_char + cur->row_xpos; + str = row->string; + + wb = find_eow(cur, start, TRUE, &row); + if (wb < 0) + return wb; + + end = wb; + + /* + * If not at the start of a word then find the start, + * we cannot blindly call find_sow because this will + * skip back a word if we are already at the start of + * a word. + */ + if ((start > 0) + && !(isblank((unsigned char)str[start - 1]) && + !isblank((unsigned char)str[start]))) + start = find_sow(start, &row); + str = row->string; + /* XXXX hmmmm what if start and end on diff rows? XXXX */ + memmove(&str[start], &str[end], + (size_t) (row->length - end + 1)); + len = end - start; + row->length -= len; + + if ((cur->rows + cur->nrows) > 1) { + row = cur->start_line + cur->cursor_ypos; + if (row->next != NULL) { + /* + * if not on the last row we need to + * join on the next row so the line + * will be re-wrapped. + */ + _formi_join_line(cur, &row, JOIN_NEXT_NW); + } + _formi_wrap_field(cur, row); + cur->row_xpos = start; + cur->cursor_xpos = _formi_tab_expanded_length( + row->string, 0, cur->row_xpos); + if (cur->cursor_xpos > 0) + cur->cursor_xpos--; + } else { + _formi_calculate_tabs(row); + cur->row_xpos = start - cur->start_char; + if (cur->row_xpos > 0) + cur->row_xpos--; + _formi_set_cursor_xpos(cur, FALSE); + } + break; + + case REQ_CLR_EOL: + row->string[cur->row_xpos + 1] = '\0'; + row->length = cur->row_xpos + 1; + row->expanded = cur->cursor_xpos + 1; + break; + + case REQ_CLR_EOF: + row = cur->cur_line->next; + while (row != NULL) { + rs = row->next; + add_to_free(cur, row); + row = rs; + cur->row_count--; + } + break; + + case REQ_CLR_FIELD: + row = cur->alines->next; + cur->cur_line = cur->alines; + cur->start_line = cur->alines; + + while (row != NULL) { + rs = row->next; + add_to_free(cur, row); + row = rs; + } + + cur->alines->string[0] = '\0'; + cur->alines->length = 0; + cur->alines->expanded = 0; + cur->row_count = 1; + cur->cursor_ypos = 0; + cur->row_xpos = 0; + _formi_init_field_xpos(cur); + cur->start_char = 0; + break; + + case REQ_OVL_MODE: + cur->overlay = 1; + break; + + case REQ_INS_MODE: + cur->overlay = 0; + break; + + case REQ_SCR_FLINE: + _formi_scroll_fwd(cur, 1); + break; + + case REQ_SCR_BLINE: + _formi_scroll_back(cur, 1); + break; + + case REQ_SCR_FPAGE: + _formi_scroll_fwd(cur, cur->rows); + break; + + case REQ_SCR_BPAGE: + _formi_scroll_back(cur, cur->rows); + break; + + case REQ_SCR_FHPAGE: + _formi_scroll_fwd(cur, cur->rows / 2); + break; + + case REQ_SCR_BHPAGE: + _formi_scroll_back(cur, cur->rows / 2); + break; + + case REQ_SCR_FCHAR: + _formi_hscroll_fwd(cur, row, 1); + break; + + case REQ_SCR_BCHAR: + _formi_hscroll_back(cur, row, 1); + break; + + case REQ_SCR_HFLINE: + _formi_hscroll_fwd(cur, row, cur->cols); + break; + + case REQ_SCR_HBLINE: + _formi_hscroll_back(cur, row, cur->cols); + break; + + case REQ_SCR_HFHALF: + _formi_hscroll_fwd(cur, row, cur->cols / 2); + break; + + case REQ_SCR_HBHALF: + _formi_hscroll_back(cur, row, cur->cols / 2); + break; + + default: + return 0; + } + + _formi_dbg_printf( + "%s: cursor_xpos=%d, row_xpos=%d, start_char=%d, length=%d, " + "allocated=%d\n", __func__, cur->cursor_xpos, cur->row_xpos, + cur->start_char, cur->cur_line->length, cur->cur_line->allocated); + _formi_dbg_printf("%s: start_line=%p, ypos=%d\n", __func__, + cur->start_line, cur->cursor_ypos); + _formi_dbg_printf("%s: string=\"%s\"\n", __func__, + cur->cur_line->string); + assert ((cur->cursor_xpos < INT_MAX) && (cur->row_xpos < INT_MAX) + && (cur->cursor_xpos >= cur->row_xpos)); + return 1; +} + +/* + * Validate the given character by passing it to any type character + * checking routines, if they exist. + */ +int +_formi_validate_char(FIELD *field, char c) +{ + int ret_val; + + if (field->type == NULL) + return E_OK; + + ret_val = E_INVALID_FIELD; + _formi_do_char_validation(field, field->type, c, &ret_val); + + return ret_val; +} + + +/* + * Perform the validation of the character, invoke all field_type validation + * routines. If the field is ok then update ret_val to E_OK otherwise + * ret_val is not changed. + */ +static void +_formi_do_char_validation(FIELD *field, FIELDTYPE *type, char c, int *ret_val) +{ + if ((type->flags & _TYPE_IS_LINKED) == _TYPE_IS_LINKED) { + _formi_do_char_validation(field, type->link->next, c, ret_val); + _formi_do_char_validation(field, type->link->prev, c, ret_val); + } else { + if (type->char_check == NULL) + *ret_val = E_OK; + else { + if (type->char_check((int)(unsigned char) c, + field->args) == TRUE) + *ret_val = E_OK; + } + } +} + +/* + * Validate the current field. If the field validation returns success then + * return E_OK otherwise return E_INVALID_FIELD. + * + */ +int +_formi_validate_field(FORM *form) +{ + FIELD *cur; + int ret_val, count; + + + if ((form == NULL) || (form->fields == NULL) || + (form->fields[0] == NULL)) + return E_INVALID_FIELD; + + cur = form->fields[form->cur_field]; + + /* + * Sync the buffer if it has been modified so the field + * validation routines can use it and because this is + * the correct behaviour according to AT&T implementation. + */ + if ((cur->buf0_status == TRUE) + && ((ret_val = _formi_sync_buffer(cur)) != E_OK)) + return ret_val; + + /* + * If buffer is untouched then the string pointer may be + * NULL, see if this is ok or not. + */ + if (cur->buffers[0].string == NULL) { + if ((cur->opts & O_NULLOK) == O_NULLOK) + return E_OK; + else + return E_INVALID_FIELD; + } + + count = _formi_skip_blanks(cur->buffers[0].string, 0); + + /* check if we have a null field, depending on the nullok flag + * this may be acceptable or not.... + */ + if (cur->buffers[0].string[count] == '\0') { + if ((cur->opts & O_NULLOK) == O_NULLOK) + return E_OK; + else + return E_INVALID_FIELD; + } + + /* check if an unmodified field is ok */ + if (cur->buf0_status == 0) { + if ((cur->opts & O_PASSOK) == O_PASSOK) + return E_OK; + else + return E_INVALID_FIELD; + } + + /* if there is no type then just accept the field */ + if (cur->type == NULL) + return E_OK; + + ret_val = E_INVALID_FIELD; + _formi_do_validation(cur, cur->type, &ret_val); + + return ret_val; +} + +/* + * Perform the validation of the field, invoke all field_type validation + * routines. If the field is ok then update ret_val to E_OK otherwise + * ret_val is not changed. + */ +static void +_formi_do_validation(FIELD *field, FIELDTYPE *type, int *ret_val) +{ + if ((type->flags & _TYPE_IS_LINKED) == _TYPE_IS_LINKED) { + _formi_do_validation(field, type->link->next, ret_val); + _formi_do_validation(field, type->link->prev, ret_val); + } else { + if (type->field_check == NULL) + *ret_val = E_OK; + else { + if (type->field_check(field, field_buffer(field, 0)) + == TRUE) + *ret_val = E_OK; + } + } +} + +/* + * Select the next/previous choice for the field, the driver command + * selecting the direction will be passed in c. Return 1 if a choice + * selection succeeded, 0 otherwise. + */ +int +_formi_field_choice(FORM *form, int c) +{ + FIELDTYPE *type; + FIELD *field; + + if ((form == NULL) || (form->fields == NULL) || + (form->fields[0] == NULL) || + (form->fields[form->cur_field]->type == NULL)) + return 0; + + field = form->fields[form->cur_field]; + type = field->type; + + switch (c) { + case REQ_NEXT_CHOICE: + if (type->next_choice == NULL) + return 0; + else + return type->next_choice(field, + field_buffer(field, 0)); + + case REQ_PREV_CHOICE: + if (type->prev_choice == NULL) + return 0; + else + return type->prev_choice(field, + field_buffer(field, 0)); + + default: /* should never happen! */ + return 0; + } +} + +/* + * Update the fields if they have changed. The parameter old has the + * previous current field as the current field may have been updated by + * the driver. Return 1 if the form page needs updating. + * + */ +int +_formi_update_field(FORM *form, int old_field) +{ + int cur, i; + + cur = form->cur_field; + + if (old_field != cur) { + if (!((cur >= form->page_starts[form->page].first) && + (cur <= form->page_starts[form->page].last))) { + /* not on same page any more */ + for (i = 0; i < form->max_page; i++) { + if ((form->page_starts[i].in_use == 1) && + (form->page_starts[i].first <= cur) && + (form->page_starts[i].last >= cur)) { + form->page = i; + return 1; + } + } + } + } + + _formi_redraw_field(form, old_field); + _formi_redraw_field(form, form->cur_field); + return 0; +} + +/* + * Compare function for the field sorting + * + */ +static int +field_sort_compare(const void *one, const void *two) +{ + const FIELD *a, *b; + int tl; + + a = *(const FIELD **) __UNCONST(one); + b = *(const FIELD **) __UNCONST(two); + + if (a == NULL) + return 1; + + if (b == NULL) + return -1; + + /* + * First check the page, we want the fields sorted by page. + * + */ + if (a->page != b->page) + return ((a->page > b->page)? 1 : -1); + + tl = _formi_top_left(a->parent, a->index, b->index); + + /* + * sort fields left to right, top to bottom so the top left is + * the lesser value.... + */ + return ((tl == a->index)? -1 : 1); +} + +/* + * Sort the fields in a form ready for driver traversal. + */ +void +_formi_sort_fields(FORM *form) +{ + FIELD **sort_area; + int i; + + TAILQ_INIT(&form->sorted_fields); + + if ((sort_area = malloc(sizeof(*sort_area) * form->field_count)) + == NULL) + return; + + memcpy(sort_area, form->fields, sizeof(*sort_area) * form->field_count); + qsort(sort_area, (size_t) form->field_count, sizeof(FIELD *), + field_sort_compare); + + for (i = 0; i < form->field_count; i++) + TAILQ_INSERT_TAIL(&form->sorted_fields, sort_area[i], glue); + + free(sort_area); +} + +/* + * Set the neighbours for all the fields in the given form. + */ +void +_formi_stitch_fields(FORM *form) +{ + int above_row, below_row, end_above, end_below, cur_row, real_end; + FIELD *cur, *above, *below; + + /* + * check if the sorted fields circle queue is empty, just + * return if it is. + */ + if (TAILQ_EMPTY(&form->sorted_fields)) + return; + + /* initially nothing is above..... */ + above_row = -1; + end_above = TRUE; + above = NULL; + + /* set up the first field as the current... */ + cur = TAILQ_FIRST(&form->sorted_fields); + cur_row = cur->form_row; + + /* find the first field on the next row if any */ + below = TAILQ_NEXT(cur, glue); + below_row = -1; + end_below = TRUE; + real_end = TRUE; + while (below != NULL) { + if (below->form_row != cur_row) { + below_row = below->form_row; + end_below = FALSE; + real_end = FALSE; + break; + } + below = TAILQ_NEXT(below, glue); + } + + /* walk the sorted fields, setting the neighbour pointers */ + while (cur != NULL) { + if (cur == TAILQ_FIRST(&form->sorted_fields)) + cur->left = NULL; + else + cur->left = TAILQ_PREV(cur, _formi_sort_head, glue); + + if (cur == TAILQ_LAST(&form->sorted_fields, _formi_sort_head)) + cur->right = NULL; + else + cur->right = TAILQ_NEXT(cur, glue); + + if (end_above == TRUE) + cur->up = NULL; + else { + cur->up = above; + above = TAILQ_NEXT(above, glue); + if (above_row != above->form_row) { + end_above = TRUE; + above_row = above->form_row; + } + } + + if (end_below == TRUE) + cur->down = NULL; + else { + cur->down = below; + below = TAILQ_NEXT(below, glue); + if (below == NULL) { + end_below = TRUE; + real_end = TRUE; + } else if (below_row != below->form_row) { + end_below = TRUE; + below_row = below->form_row; + } + } + + cur = TAILQ_NEXT(cur, glue); + if ((cur != NULL) + && (cur_row != cur->form_row)) { + cur_row = cur->form_row; + if (end_above == FALSE) { + for (; above != + TAILQ_FIRST(&form->sorted_fields); + above = TAILQ_NEXT(above, glue)) { + if (above->form_row != above_row) { + above_row = above->form_row; + break; + } + } + } else if (above == NULL) { + above = TAILQ_FIRST(&form->sorted_fields); + end_above = FALSE; + above_row = above->form_row; + } else + end_above = FALSE; + + if (end_below == FALSE) { + while (below_row == below->form_row) { + below = TAILQ_NEXT(below, glue); + if (below == NULL) { + real_end = TRUE; + end_below = TRUE; + break; + } + } + + if (below != NULL) + below_row = below->form_row; + } else if (real_end == FALSE) + end_below = FALSE; + + } + } +} + +/* + * Calculate the length of the displayed line allowing for any tab + * characters that need to be expanded. We assume that the tab stops + * are 8 characters apart. The parameters start and end are the + * character positions in the string str we want to get the length of, + * the function returns the number of characters from the start + * position to the end position that should be displayed after any + * intervening tabs have been expanded. + */ +int +_formi_tab_expanded_length(char *str, unsigned int start, unsigned int end) +{ + int len, start_len, i; + + /* if we have a null string then there is no length */ + if (str[0] == '\0') + return 0; + + len = 0; + start_len = 0; + + /* + * preceding tabs affect the length tabs in the span, so + * we need to calculate the length including the stuff before + * start and then subtract off the unwanted bit. + */ + for (i = 0; i <= end; i++) { + if (i == start) /* stash preamble length for later */ + start_len = len; + + if (str[i] == '\0') + break; + + if (str[i] == '\t') + len = len - (len % 8) + 8; + else + len++; + } + + _formi_dbg_printf( + "%s: start=%d, end=%d, expanded=%d (diff=%d)\n", __func__, + start, end, (len - start_len), (end - start)); + + return (len - start_len); +} + +/* + * Calculate the tab stops on a given line in the field and set up + * the tabs list with the results. We do this by scanning the line for tab + * characters and if one is found, noting the position and the number of + * characters to get to the next tab stop. This information is kept to + * make manipulating the field (scrolling and so on) easier to handle. + */ +void +_formi_calculate_tabs(_FORMI_FIELD_LINES *row) +{ + _formi_tab_t *ts = row->tabs, *old_ts = NULL, **tsp; + int i, j; + + /* + * If the line already has tabs then invalidate them by + * walking the list and killing the in_use flag. + */ + for (; ts != NULL; ts = ts->fwd) + ts->in_use = FALSE; + + + /* + * Now look for tabs in the row and record the info... + */ + tsp = &row->tabs; + for (i = 0, j = 0; i < row->length; i++, j++) { + if (row->string[i] == '\t') { + if (*tsp == NULL) { + if ((*tsp = malloc(sizeof(*tsp))) == NULL) + return; + (*tsp)->back = old_ts; + (*tsp)->fwd = NULL; + } + + (*tsp)->in_use = TRUE; + (*tsp)->pos = i; + (*tsp)->size = 8 - (j % 8); + j += (*tsp)->size - 1; + old_ts = *tsp; + tsp = &(*tsp)->fwd; + } + } +} + +/* + * Return the size of the tab padding for a tab character at the given + * position. Return 1 if there is not a tab char entry matching the + * given location. + */ +static int +tab_size(_FORMI_FIELD_LINES *row, unsigned int i) +{ + _formi_tab_t *ts; + + ts = row->tabs; + while ((ts != NULL) && (ts->pos != i)) + ts = ts->fwd; + + if (ts == NULL) + return 1; + else + return ts->size; +} + +/* + * Find the character offset that corresponds to longest tab expanded + * string that will fit into the given window. Walk the string backwards + * evaluating the sizes of any tabs that are in the string. Note that + * using this function on a multi-line window will produce undefined + * results - it is really only required for a single row field. + */ +static int +tab_fit_window(FIELD *field, unsigned int pos, unsigned int window) +{ + int scroll_amt, i; + _formi_tab_t *ts; + + /* first find the last tab */ + ts = field->alines->tabs; + + /* + * unless there are no tabs - just return the window size, + * if there is enough room, otherwise 0. + */ + if (ts == NULL) { + if (field->alines->length < window) + return 0; + else + return field->alines->length - window + 1; + } + + while ((ts->fwd != NULL) && (ts->fwd->in_use == TRUE)) + ts = ts->fwd; + + /* + * now walk backwards finding the first tab that is to the + * left of our starting pos. + */ + while ((ts != NULL) && (ts->in_use == TRUE) && (ts->pos > pos)) + ts = ts->back; + + scroll_amt = 0; + for (i = pos; i >= 0; i--) { + if (field->alines->string[i] == '\t') { + assert((ts != NULL) && (ts->in_use == TRUE)); + if (ts->pos == i) { + if ((scroll_amt + ts->size) > window) { + break; + } + scroll_amt += ts->size; + ts = ts->back; + } + else + assert(ts->pos == i); + } else { + scroll_amt++; + if (scroll_amt > window) + break; + } + } + + return ++i; +} + +/* + * Return the position of the last character that will fit into the + * given width after tabs have been expanded for a given row of a given + * field. + */ +static unsigned int +tab_fit_len(_FORMI_FIELD_LINES *row, unsigned int width) +{ + unsigned int pos, len, row_pos; + _formi_tab_t *ts; + + ts = row->tabs; + pos = 0; + len = 0; + row_pos = 0; + + if (width == 0) + return 0; + + while ((len < width) && (pos < row->length)) { + if (row->string[pos] == '\t') { + assert((ts != NULL) && (ts->in_use == TRUE)); + if (ts->pos == row_pos) { + if ((len + ts->size) > width) + break; + len += ts->size; + ts = ts->fwd; + } + else + assert(ts->pos == row_pos); + } else + len++; + pos++; + row_pos++; + } + + if (pos > 0) + pos--; + return pos; +} + +/* + * Sync the field line structures with the contents of buffer 0 for that + * field. We do this by walking all the line structures and concatenating + * all the strings into one single string in buffer 0. + */ +int +_formi_sync_buffer(FIELD *field) +{ + _FORMI_FIELD_LINES *line; + char *nstr, *tmp; + unsigned length; + + if (field->alines == NULL) + return E_BAD_ARGUMENT; + + if (field->alines->string == NULL) + return E_BAD_ARGUMENT; + + /* + * init nstr up front, just in case there are no line contents, + * this could happen if the field just contains hard returns. + */ + if ((nstr = malloc(sizeof(*nstr))) == NULL) + return E_SYSTEM_ERROR; + nstr[0] = '\0'; + + line = field->alines; + length = 1; /* allow for terminating null */ + + while (line != NULL) { + if (line->length != 0) { + if ((tmp = realloc(nstr, + (size_t) (length + line->length))) + == NULL) { + if (nstr != NULL) + free(nstr); + return (E_SYSTEM_ERROR); + } + + nstr = tmp; + strcat(nstr, line->string); + length += line->length; + } + + line = line->next; + } + + if (field->buffers[0].string != NULL) + free(field->buffers[0].string); + field->buffers[0].allocated = length; + field->buffers[0].length = length - 1; + field->buffers[0].string = nstr; + return E_OK; +} + + + diff --git a/vendor/netbsd-curses/libform/internals.h b/vendor/netbsd-curses/libform/internals.h new file mode 100644 index 0000000..5159a06 --- /dev/null +++ b/vendor/netbsd-curses/libform/internals.h @@ -0,0 +1,145 @@ +/* $NetBSD: internals.h,v 1.11 2016/03/09 19:47:13 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include +#include "form.h" + +#ifndef FORMI_INTERNALS_H +#define FORMI_INTERNALS_H 1 + +/* direction definitions for _formi_pos_new_field */ +#define _FORMI_BACKWARD 1 +#define _FORMI_FORWARD 2 + +/* define the default options for a form... */ +#define DEFAULT_FORM_OPTS (O_VISIBLE | O_ACTIVE | O_PUBLIC | O_EDIT | \ + O_WRAP | O_BLANK | O_AUTOSKIP | O_NULLOK | \ + O_PASSOK | O_STATIC) + +/* definitions of the flags for the FIELDTYPE structure */ +#define _TYPE_NO_FLAGS 0 +#define _TYPE_HAS_ARGS 0x01 +#define _TYPE_IS_LINKED 0x02 +#define _TYPE_IS_BUILTIN 0x04 +#define _TYPE_HAS_CHOICE 0x08 + +typedef struct formi_type_link_struct formi_type_link; + +struct formi_type_link_struct +{ + FIELDTYPE *next; + FIELDTYPE *prev; +}; + + +struct _formi_page_struct +{ + int in_use; + int first; + int last; + int top_left; + int bottom_right; +}; + +struct _formi_tab_stops +{ + struct _formi_tab_stops *fwd; + struct _formi_tab_stops *back; + unsigned char in_use; + unsigned pos; + unsigned size; +}; + +typedef struct _formi_tab_stops _formi_tab_t; + +/* lines structure for the field - keeps start and ends and length of the + * lines in a field. + */ +struct _formi_field_lines +{ + _FORMI_FIELD_LINES *prev; + _FORMI_FIELD_LINES *next; + unsigned allocated; + unsigned length; + unsigned expanded; + char *string; + unsigned char hard_ret; /* line contains hard return */ + _formi_tab_t *tabs; +}; + + +/* function prototypes */ +unsigned +_formi_skip_blanks(char *string, unsigned int start); +int +_formi_add_char(FIELD *cur, unsigned pos, char c); +void +_formi_calculate_tabs(_FORMI_FIELD_LINES *row); +int +_formi_draw_page(FORM *form); +int +_formi_find_pages(FORM *form); +int +_formi_field_choice(FORM *form, int c); +void +_formi_init_field_xpos(FIELD *field); +int +_formi_manipulate_field(FORM *form, int c); +int +_formi_pos_first_field(FORM *form); +int +_formi_pos_new_field(FORM *form, unsigned direction, unsigned use_sorted); +void +_formi_redraw_field(FORM *form, int field); +void +_formi_sort_fields(FORM *form); +void +_formi_stitch_fields(FORM *form); +int +_formi_tab_expanded_length(char *str, unsigned int start, unsigned int end); +int +_formi_update_field(FORM *form, int old_field); +int +_formi_validate_char(FIELD *field, char c); +int +_formi_validate_field(FORM *form); +int +_formi_wrap_field(FIELD *field, _FORMI_FIELD_LINES *pos); +int +_formi_sync_buffer(FIELD *field); + +#ifdef DEBUG +void _formi_dbg_printf(const char *, ...) __printflike(1, 2); +#else +#define _formi_dbg_printf(a,...) +#endif /* DEBUG */ + +#endif diff --git a/vendor/netbsd-curses/libform/link_field.3 b/vendor/netbsd-curses/libform/link_field.3 new file mode 120000 index 0000000..2375069 --- /dev/null +++ b/vendor/netbsd-curses/libform/link_field.3 @@ -0,0 +1 @@ +form_field_new.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/link_fieldtype.3 b/vendor/netbsd-curses/libform/link_fieldtype.3 new file mode 120000 index 0000000..999206b --- /dev/null +++ b/vendor/netbsd-curses/libform/link_fieldtype.3 @@ -0,0 +1 @@ +form_fieldtype.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/move_field.3 b/vendor/netbsd-curses/libform/move_field.3 new file mode 120000 index 0000000..454d191 --- /dev/null +++ b/vendor/netbsd-curses/libform/move_field.3 @@ -0,0 +1 @@ +form_field.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/new_field.3 b/vendor/netbsd-curses/libform/new_field.3 new file mode 120000 index 0000000..2375069 --- /dev/null +++ b/vendor/netbsd-curses/libform/new_field.3 @@ -0,0 +1 @@ +form_field_new.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/new_fieldtype.3 b/vendor/netbsd-curses/libform/new_fieldtype.3 new file mode 120000 index 0000000..999206b --- /dev/null +++ b/vendor/netbsd-curses/libform/new_fieldtype.3 @@ -0,0 +1 @@ +form_fieldtype.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/new_form.3 b/vendor/netbsd-curses/libform/new_form.3 new file mode 120000 index 0000000..2f7d452 --- /dev/null +++ b/vendor/netbsd-curses/libform/new_form.3 @@ -0,0 +1 @@ +form_new.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/new_page.3 b/vendor/netbsd-curses/libform/new_page.3 new file mode 120000 index 0000000..259d2c6 --- /dev/null +++ b/vendor/netbsd-curses/libform/new_page.3 @@ -0,0 +1 @@ +form_new_page.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/pos_form_cursor.3 b/vendor/netbsd-curses/libform/pos_form_cursor.3 new file mode 120000 index 0000000..3194311 --- /dev/null +++ b/vendor/netbsd-curses/libform/pos_form_cursor.3 @@ -0,0 +1 @@ +form_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/post.c b/vendor/netbsd-curses/libform/post.c new file mode 100644 index 0000000..192bba3 --- /dev/null +++ b/vendor/netbsd-curses/libform/post.c @@ -0,0 +1,113 @@ +/* $NetBSD: post.c,v 1.10 2016/03/09 19:47:13 christos Exp $ */ + +/*- + * Copyright (c) 1998-2000 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include "form.h" +#include "internals.h" + +/* + * Post the form to the screen. + */ +int +post_form(FORM *form) +{ + int rows, cols, status; + + if (form == NULL) + return E_BAD_ARGUMENT; + + if (form->posted == 1) + return E_POSTED; + + if ((form->fields == NULL) || (form->fields[0] == NULL)) + return E_NOT_CONNECTED; + + if (form->in_init == 1) + return E_BAD_STATE; + + if (scale_form(form, &rows, &cols) != E_OK) + return E_SYSTEM_ERROR; + + if ((form->scrwin != NULL) && ((rows > getmaxy(form->scrwin)) + || (cols > getmaxx(form->scrwin)))) { + return E_NO_ROOM; + } + + form->in_init = 1; + if (form->form_init != NULL) + form->form_init(form); + + if (form->field_init != NULL) + form->field_init(form); + form->in_init = 0; + + _formi_pos_first_field(form); + if ((status = _formi_draw_page(form)) != E_OK) + return status; + + form->posted = 1; + pos_form_cursor(form); + + return E_OK; +} + +/* + * Unpost the form from the screen + */ +int +unpost_form(FORM *form) +{ + + if (form == NULL) + return E_BAD_ARGUMENT; + + if (form->posted != 1) + return E_NOT_POSTED; + + if (form->in_init == 1) + return E_BAD_STATE; + + form->in_init = 1; + if (form->field_term != NULL) + form->field_term(form); + + if (form->form_term != NULL) + form->form_term(form); + form->in_init = 0; + + wclear(form->scrwin); + + form->posted = 0; + + return E_OK; +} + diff --git a/vendor/netbsd-curses/libform/post_form.3 b/vendor/netbsd-curses/libform/post_form.3 new file mode 120000 index 0000000..418a48e --- /dev/null +++ b/vendor/netbsd-curses/libform/post_form.3 @@ -0,0 +1 @@ +form_post.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/scale_form.3 b/vendor/netbsd-curses/libform/scale_form.3 new file mode 120000 index 0000000..49bbf85 --- /dev/null +++ b/vendor/netbsd-curses/libform/scale_form.3 @@ -0,0 +1 @@ +form_win.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_current_field.3 b/vendor/netbsd-curses/libform/set_current_field.3 new file mode 120000 index 0000000..c7d47c5 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_current_field.3 @@ -0,0 +1 @@ +form_page.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_back.3 b/vendor/netbsd-curses/libform/set_field_back.3 new file mode 120000 index 0000000..0a8d84c --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_back.3 @@ -0,0 +1 @@ +form_field_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_buffer.3 b/vendor/netbsd-curses/libform/set_field_buffer.3 new file mode 120000 index 0000000..4e098fe --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_buffer.3 @@ -0,0 +1 @@ +form_field_buffer.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_fore.3 b/vendor/netbsd-curses/libform/set_field_fore.3 new file mode 120000 index 0000000..0a8d84c --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_fore.3 @@ -0,0 +1 @@ +form_field_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_init.3 b/vendor/netbsd-curses/libform/set_field_init.3 new file mode 120000 index 0000000..762e14b --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_init.3 @@ -0,0 +1 @@ +form_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_just.3 b/vendor/netbsd-curses/libform/set_field_just.3 new file mode 120000 index 0000000..d312d75 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_just.3 @@ -0,0 +1 @@ +form_field_just.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_opts.3 b/vendor/netbsd-curses/libform/set_field_opts.3 new file mode 120000 index 0000000..f1bebb3 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_opts.3 @@ -0,0 +1 @@ +form_field_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_pad.3 b/vendor/netbsd-curses/libform/set_field_pad.3 new file mode 120000 index 0000000..0a8d84c --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_pad.3 @@ -0,0 +1 @@ +form_field_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_printf.3 b/vendor/netbsd-curses/libform/set_field_printf.3 new file mode 120000 index 0000000..4e098fe --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_printf.3 @@ -0,0 +1 @@ +form_field_buffer.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_status.3 b/vendor/netbsd-curses/libform/set_field_status.3 new file mode 120000 index 0000000..4e098fe --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_status.3 @@ -0,0 +1 @@ +form_field_buffer.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_term.3 b/vendor/netbsd-curses/libform/set_field_term.3 new file mode 120000 index 0000000..762e14b --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_term.3 @@ -0,0 +1 @@ +form_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_type.3 b/vendor/netbsd-curses/libform/set_field_type.3 new file mode 120000 index 0000000..28e31c8 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_type.3 @@ -0,0 +1 @@ +form_field_validation.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_field_userptr.3 b/vendor/netbsd-curses/libform/set_field_userptr.3 new file mode 120000 index 0000000..6f4ce49 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_field_userptr.3 @@ -0,0 +1 @@ +form_field_userptr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_fieldtype_arg.3 b/vendor/netbsd-curses/libform/set_fieldtype_arg.3 new file mode 120000 index 0000000..999206b --- /dev/null +++ b/vendor/netbsd-curses/libform/set_fieldtype_arg.3 @@ -0,0 +1 @@ +form_fieldtype.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_fieldtype_choice.3 b/vendor/netbsd-curses/libform/set_fieldtype_choice.3 new file mode 120000 index 0000000..999206b --- /dev/null +++ b/vendor/netbsd-curses/libform/set_fieldtype_choice.3 @@ -0,0 +1 @@ +form_fieldtype.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_form_fields.3 b/vendor/netbsd-curses/libform/set_form_fields.3 new file mode 120000 index 0000000..454d191 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_form_fields.3 @@ -0,0 +1 @@ +form_field.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_form_init.3 b/vendor/netbsd-curses/libform/set_form_init.3 new file mode 120000 index 0000000..762e14b --- /dev/null +++ b/vendor/netbsd-curses/libform/set_form_init.3 @@ -0,0 +1 @@ +form_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_form_opts.3 b/vendor/netbsd-curses/libform/set_form_opts.3 new file mode 120000 index 0000000..efbebb3 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_form_opts.3 @@ -0,0 +1 @@ +form_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_form_page.3 b/vendor/netbsd-curses/libform/set_form_page.3 new file mode 120000 index 0000000..c7d47c5 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_form_page.3 @@ -0,0 +1 @@ +form_page.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_form_sub.3 b/vendor/netbsd-curses/libform/set_form_sub.3 new file mode 120000 index 0000000..49bbf85 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_form_sub.3 @@ -0,0 +1 @@ +form_win.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_form_term.3 b/vendor/netbsd-curses/libform/set_form_term.3 new file mode 120000 index 0000000..762e14b --- /dev/null +++ b/vendor/netbsd-curses/libform/set_form_term.3 @@ -0,0 +1 @@ +form_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_form_userptr.3 b/vendor/netbsd-curses/libform/set_form_userptr.3 new file mode 120000 index 0000000..77f6f4b --- /dev/null +++ b/vendor/netbsd-curses/libform/set_form_userptr.3 @@ -0,0 +1 @@ +form_userptr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_form_win.3 b/vendor/netbsd-curses/libform/set_form_win.3 new file mode 120000 index 0000000..49bbf85 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_form_win.3 @@ -0,0 +1 @@ +form_win.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_max_field.3 b/vendor/netbsd-curses/libform/set_max_field.3 new file mode 120000 index 0000000..4e098fe --- /dev/null +++ b/vendor/netbsd-curses/libform/set_max_field.3 @@ -0,0 +1 @@ +form_field_buffer.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/set_new_page.3 b/vendor/netbsd-curses/libform/set_new_page.3 new file mode 120000 index 0000000..259d2c6 --- /dev/null +++ b/vendor/netbsd-curses/libform/set_new_page.3 @@ -0,0 +1 @@ +form_new_page.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libform/shlib_version b/vendor/netbsd-curses/libform/shlib_version new file mode 100644 index 0000000..8890efa --- /dev/null +++ b/vendor/netbsd-curses/libform/shlib_version @@ -0,0 +1,5 @@ +# $NetBSD: shlib_version,v 1.17 2009/01/11 03:07:48 christos Exp $ +# Remember to update distrib/sets/lists/base/shl.* when changing +# +major=6 +minor=0 diff --git a/vendor/netbsd-curses/libform/std_header.c b/vendor/netbsd-curses/libform/std_header.c new file mode 100644 index 0000000..76afb4f --- /dev/null +++ b/vendor/netbsd-curses/libform/std_header.c @@ -0,0 +1,33 @@ +/* $NetBSD: std_header.c,v 1.3 2003/03/09 00:57:19 lukem Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + diff --git a/vendor/netbsd-curses/libform/type_alnum.c b/vendor/netbsd-curses/libform/type_alnum.c new file mode 100644 index 0000000..4ee8172 --- /dev/null +++ b/vendor/netbsd-curses/libform/type_alnum.c @@ -0,0 +1,176 @@ +/* $NetBSD: type_alnum.c,v 1.12 2021/04/13 13:13:04 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include +#include +#include +#include +#include "form.h" +#include "internals.h" + +/* + * The alpha-numeric type handling. + */ + +typedef struct +{ + unsigned width; +} alnum_args; + +/* + * Create the alnum arguments structure from the given args. Return NULL + * if the call fails, otherwise return a pointer to the structure allocated. + */ +static char * +create_alnum_args(va_list *args) +{ + alnum_args *new; + + new = malloc(sizeof(*new)); + + if (new != NULL) + new->width = va_arg(*args, int); + + return (void *)new; +} + +/* + * Copy the alnum argument structure. + */ +static char * +copy_alnum_args(char *args) +{ + alnum_args *new; + + new = malloc(sizeof(*new)); + + if (new != NULL) + new->width = ((alnum_args *) (void *)args)->width; + + return (void *)new; +} + +/* + * Free the allocated storage associated with the type arguments. + */ +static void +free_alnum_args(char *args) +{ + if (args != NULL) + free(args); +} + +/* + * Check the contents of the field buffer are alphanumeric only. + */ +static int +alnum_check_field(FIELD *field, char *args) +{ + int width, start, cur, end; + char *buf, *new; + + width = ((alnum_args *) (void *) field->args)->width; + buf = args; + start = 0; + + if (buf == NULL) + return FALSE; + + /* skip leading white space */ + while ((buf[start] != '\0') + && ((buf[start] == ' ') || (buf[start] == '\t'))) + start++; + + /* no good if we have hit the end */ + if (buf[start] == '\0') + return FALSE; + + /* find the end of the non-whitespace stuff */ + cur = start; + while(isalnum((unsigned char)buf[cur])) + cur++; + + /* no good if it exceeds the width */ + if ((cur - start) > width) + return FALSE; + + end = cur; + + /* check there is only trailing whitespace */ + while ((buf[cur] != '\0') + && ((buf[cur] == ' ') || (buf[cur] == '\t'))) + cur++; + + /* no good if we are not at the end of the string */ + if (buf[cur] != '\0') + return FALSE; + + if ((new = malloc(sizeof(*new) * (end - start + 1))) == NULL) + return FALSE; + + if ((end - start) >= 1) { + strncpy(new, &buf[start], (size_t) (end - start - 1)); + new[end] = '\0'; + } else + new[0]= '\0'; + + set_field_buffer(field, 0, new); + free(new); + + /* otherwise all was ok */ + return TRUE; +} + +/* + * Check the given character is alpha-numeric, return TRUE if it is. + */ +static int +alnum_check_char(/* ARGSUSED1 */ int c, char *args) +{ + return (isalnum(c) ? TRUE : FALSE); +} + +static FIELDTYPE builtin_alnum = { + _TYPE_HAS_ARGS | _TYPE_IS_BUILTIN, /* flags */ + 0, /* refcount */ + NULL, /* link */ + create_alnum_args, /* make_args */ + copy_alnum_args, /* copy_args */ + free_alnum_args, /* free_args */ + alnum_check_field, /* field_check */ + alnum_check_char, /* char_check */ + NULL, /* next_choice */ + NULL /* prev_choice */ +}; + +FIELDTYPE *TYPE_ALNUM = &builtin_alnum; + + diff --git a/vendor/netbsd-curses/libform/type_alpha.c b/vendor/netbsd-curses/libform/type_alpha.c new file mode 100644 index 0000000..65070d5 --- /dev/null +++ b/vendor/netbsd-curses/libform/type_alpha.c @@ -0,0 +1,179 @@ +/* $NetBSD: type_alpha.c,v 1.13 2021/04/13 13:13:04 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include +#include +#include +#include "form.h" +#include "internals.h" + +/* + * The alpha type handling. + */ + +typedef struct +{ + unsigned width; +} alpha_args; + +/* + * Create the alpha arguments structure from the given args. Return NULL + * if the call fails, otherwise return a pointer to the structure allocated. + */ +static char * +create_alpha_args(va_list *args) +{ + alpha_args *new; + + new = malloc(sizeof(*new)); + + if (new != NULL) + new->width = va_arg(*args, int); + + return (void *) new; +} + +/* + * Copy the alpha argument structure. + */ +static char * +copy_alpha_args(char *args) +{ + alpha_args *new; + + new = malloc(sizeof(*new)); + + if (new != NULL) + new->width = ((alpha_args *) (void *) args)->width; + + return (void *) new; +} + +/* + * Free the allocated storage associated with the type arguments. + */ +static void +free_alpha_args(char *args) +{ + if (args != NULL) + free(args); +} + +/* + * Check the contents of the field buffer are alphanumeric only. + */ +static int +alpha_check_field(FIELD *field, char *args) +{ + int width, start, cur, end; + char *buf, *new; + + width = ((alpha_args *) (void *) field->args)->width; + buf = args; + start = 0; + + if (buf == NULL) + return FALSE; + + /* skip leading white space */ + while ((buf[start] != '\0') + && ((buf[start] == ' ') || (buf[start] == '\t'))) + start++; + + /* no good if we have hit the end */ + if (buf[start] == '\0') + return FALSE; + + /* find the end of the non-whitespace stuff */ + cur = start; + while(isalpha((unsigned char)buf[cur])) + cur++; + + /* no good if it exceeds the width */ + if ((cur - start) > width) + return FALSE; + + end = cur; + + /* check there is only trailing whitespace */ + while ((buf[cur] != '\0') + && ((buf[cur] == ' ') || (buf[cur] == '\t'))) + cur++; + + /* no good if we are not at the end of the string */ + if (buf[cur] != '\0') + return FALSE; + + /* set buffer 0 to the new string */ + if ((new = malloc(sizeof(*new) * (end - start + 1))) == NULL) + return FALSE; + + if ((end - start) >= 1) { + strncpy(new, &buf[start], (size_t) (end - start - 1)); + new[end] = '\0'; + } else + new[0] = '\0'; + + + set_field_buffer(field, 0, new); + free(new); + + /* otherwise all was ok */ + return TRUE; +} + +/* + * Check the given character is alphabetic, return TRUE if it is. + */ +static int +alpha_check_char(/* ARGSUSED1 */ int c, char *args) +{ + return (isalpha(c) ? TRUE : FALSE); +} + +static FIELDTYPE builtin_alpha = { + _TYPE_HAS_ARGS | _TYPE_IS_BUILTIN, /* flags */ + 0, /* refcount */ + NULL, /* link */ + create_alpha_args, /* make_args */ + copy_alpha_args, /* copy_args */ + free_alpha_args, /* free_args */ + alpha_check_field, /* field_check */ + alpha_check_char, /* char_check */ + NULL, /* next_choice */ + NULL /* prev_choice */ +}; + +FIELDTYPE *TYPE_ALPHA = &builtin_alpha; + + diff --git a/vendor/netbsd-curses/libform/type_enum.c b/vendor/netbsd-curses/libform/type_enum.c new file mode 100644 index 0000000..f0a9c44 --- /dev/null +++ b/vendor/netbsd-curses/libform/type_enum.c @@ -0,0 +1,335 @@ +/* $NetBSD: type_enum.c,v 1.13 2021/04/13 13:13:04 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#define _BSD_SOURCE +#define _XOPEN_SOURCE 600 +#include + +#include +#include +#include +#include +#include "form.h" +#include "internals.h" + +/* + * Prototypes. + */ +static int +trim_blanks(char *field); + +/* + * The enum type handling. + */ + +typedef struct +{ + char **choices; + unsigned num_choices; + bool ignore_case; + bool exact; +} enum_args; + +/* + * Find the first non-blank character at the end of a field, return the + * index of that character. + */ +static int +trim_blanks(char *field) +{ + int i; + + i = (int) strlen(field); + if (i > 0) + i--; + else + return 0; + + while ((i > 0) && isblank((unsigned char)field[i])) + i--; + + return i; +} + +/* + * Create the enum arguments structure from the given args. Return NULL + * if the call fails, otherwise return a pointer to the structure allocated. + */ +static char * +create_enum_args(va_list *args) +{ + enum_args *new; + char **choices; + + new = malloc(sizeof(*new)); + if (new == NULL) + return NULL; + + new->choices = va_arg(*args, char **); + new->ignore_case = (va_arg(*args, int)) ? TRUE : FALSE; + new->exact = (va_arg(*args, int)) ? TRUE : FALSE; + + _formi_dbg_printf("%s: ignore_case %d, no_blanks %d\n", __func__, + new->ignore_case, new->exact); + + /* count the choices we have */ + choices = new->choices; + new->num_choices = 0; + while (*choices != NULL) { + _formi_dbg_printf("%s: choice[%u] = \'%s\'\n", __func__, + new->num_choices, new->choices[new->num_choices]); + new->num_choices++; + choices++; + } + _formi_dbg_printf("%s: have %u choices\n", __func__, + new->num_choices); + + return (void *) new; +} + +/* + * Copy the enum argument structure. + */ +static char * +copy_enum_args(char *args) +{ + enum_args *new; + + new = malloc(sizeof(*new)); + + if (new != NULL) + memcpy(new, args, sizeof(*new)); + + return (void *) new; +} + +/* + * Free the allocated storage associated with the type arguments. + */ +static void +free_enum_args(char *args) +{ + if (args != NULL) + free(args); +} + +/* + * Attempt to match the string in this to the choices given. Returns + * TRUE if match found otherwise FALSE. + * + */ +static bool +match_enum(char **choices, unsigned num_choices, bool ignore_case, + bool exact, char *this, unsigned *match_num) +{ + unsigned i, start, end, enum_start, blen, elen, enum_end; + bool cur_match; + + start = _formi_skip_blanks(this, 0); + end = trim_blanks(this); + + if (end >= start) + blen = (unsigned) (strlen(&this[start]) + - strlen(&this[end]) + 1); + else + blen = 0; + + _formi_dbg_printf("%s: start %u, blen %u\n", __func__, start, blen); + for (i = 0; i < num_choices; i++) { + enum_start = _formi_skip_blanks(choices[i], 0); + enum_end = trim_blanks(choices[i]); + + if (enum_end >= enum_start) + elen = (unsigned) (strlen(&choices[i][enum_start]) + - strlen(&choices[i][enum_end]) + 1); + else + elen = 0; + + _formi_dbg_printf("%s: checking choice \'%s\'\n", __func__, + choices[i]); + _formi_dbg_printf("%s: enum_start %u, elen %u\n", __func__, + enum_start, elen); + + /* don't bother if we are after an exact match + * and the test length is not equal to the enum + * in question - it will never match. + */ + if ((exact == TRUE) && (blen != elen)) + continue; + + /* + * If the test length is longer than the enum + * length then there is no chance of a match + * so we skip. + */ + if ((exact != TRUE) && (blen > elen)) + continue; + + if (ignore_case) + cur_match = (strncasecmp(&choices[i][enum_start], + &this[start], + (size_t)blen) == 0) ? + TRUE : FALSE; + else + cur_match = (strncmp(&choices[i][enum_start], + &this[start], + (size_t) blen) == 0) ? + TRUE : FALSE; + + _formi_dbg_printf("%s: curmatch is %s\n", __func__, + (cur_match == TRUE)? "TRUE" : "FALSE"); + + if (cur_match == TRUE) { + *match_num = i; + return TRUE; + } + + } + + _formi_dbg_printf("%s: no match found\n", __func__); + return FALSE; +} + +/* + * Check the contents of the field buffer match one of the enum strings only. + */ +static int +enum_check_field(FIELD *field, char *args) +{ + enum_args *ta; + unsigned match_num; + + if (args == NULL) + return FALSE; + + ta = (enum_args *) (void *) field->args; + + if (match_enum(ta->choices, ta->num_choices, ta->ignore_case, + ta->exact, args, &match_num) == TRUE) { + _formi_dbg_printf("%s: We matched, match_num %u\n", __func__, + match_num); + _formi_dbg_printf("%s: buffer is \'%s\'\n", __func__, + ta->choices[match_num]); + set_field_buffer(field, 0, ta->choices[match_num]); + return TRUE; + } + + return FALSE; +} + +/* + * Get the next enum in the list of choices. + */ +static int +next_enum(FIELD *field, char *args) +{ + enum_args *ta; + unsigned cur_choice; + + if (args == NULL) + return FALSE; + + ta = (enum_args *) (void *) field->args; + + _formi_dbg_printf("%s: attempt to match \'%s\'\n", __func__, args); + + if (match_enum(ta->choices, ta->num_choices, ta->ignore_case, + ta->exact, args, &cur_choice) == FALSE) { + _formi_dbg_printf("%s: match failed\n", __func__); + return FALSE; + } + + _formi_dbg_printf("%s: cur_choice is %u\n", __func__, cur_choice); + + cur_choice++; + + if (cur_choice >= ta->num_choices) + cur_choice = 0; + + _formi_dbg_printf("%s: cur_choice is %u on exit\n", __func__, + cur_choice); + + set_field_buffer(field, 0, ta->choices[cur_choice]); + return TRUE; +} + +/* + * Get the previous enum in the list of choices. + */ +static int +prev_enum(FIELD *field, char *args) +{ + enum_args *ta; + unsigned cur_choice; + + if (args == NULL) + return FALSE; + + ta = (enum_args *) (void *) field->args; + + _formi_dbg_printf("%s: attempt to match \'%s\'\n", __func__, args); + + if (match_enum(ta->choices, ta->num_choices, ta->ignore_case, + ta->exact, args, &cur_choice) == FALSE) { + _formi_dbg_printf("%s: match failed\n", __func__); + return FALSE; + } + + _formi_dbg_printf("%s: cur_choice is %u\n", __func__, cur_choice); + if (cur_choice == 0) + cur_choice = ta->num_choices - 1; + else + cur_choice--; + + _formi_dbg_printf("%s: cur_choice is %u on exit\n", + __func__, cur_choice); + + set_field_buffer(field, 0, ta->choices[cur_choice]); + return TRUE; +} + + +static FIELDTYPE builtin_enum = { + _TYPE_HAS_ARGS | _TYPE_IS_BUILTIN, /* flags */ + 0, /* refcount */ + NULL, /* link */ + create_enum_args, /* make_args */ + copy_enum_args, /* copy_args */ + free_enum_args, /* free_args */ + enum_check_field, /* field_check */ + NULL, /* char_check */ + next_enum, /* next_choice */ + prev_enum /* prev_choice */ +}; + +FIELDTYPE *TYPE_ENUM = &builtin_enum; + + diff --git a/vendor/netbsd-curses/libform/type_integer.c b/vendor/netbsd-curses/libform/type_integer.c new file mode 100644 index 0000000..6eceb92 --- /dev/null +++ b/vendor/netbsd-curses/libform/type_integer.c @@ -0,0 +1,186 @@ +/* $NetBSD: type_integer.c,v 1.9 2021/04/13 13:13:04 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#define _GNU_SOURCE +#include +#include + +#include +#include +#include +#include "form.h" +#include "internals.h" + +/* + * The integer type handling. + */ + +typedef struct +{ + unsigned precision; + long min; + long max; +} integer_args; + +/* + * Create the integer arguments structure from the given args. Return NULL + * if the call fails, otherwise return a pointer to the structure allocated. + */ +static char * +create_integer_args(va_list *args) +{ + integer_args *new; + + new = malloc(sizeof(*new)); + + if (new != NULL) { + new->precision = va_arg(*args, unsigned); + new->min = va_arg(*args, long); + new->max = va_arg(*args, long); + } + + return (void *) new; +} + +/* + * Copy the integer argument structure. + */ +static char * +copy_integer_args(char *args) +{ + integer_args *new; + + new = malloc(sizeof(*new)); + + if (new != NULL) + memcpy(new, args, sizeof(*new)); + + return (void *) new; +} + +/* + * Free the allocated storage associated with the type arguments. + */ +static void +free_integer_args(char *args) +{ + if (args != NULL) + free(args); +} + +/* + * Check the contents of the field buffer are digits only. + */ +static int +integer_check_field(FIELD *field, char *args) +{ + int cur; + long number, max, min; + int precision; + char *buf, *new_buf; + + if (args == NULL) + return FALSE; + + precision = ((integer_args *) (void *) field->args)->precision; + min = ((integer_args *) (void *) field->args)->min; + max = ((integer_args *) (void *) field->args)->max; + + buf = args; + cur = 0; + + /* skip leading white space */ + while ((buf[cur] != '\0') + && ((buf[cur] == ' ') || (buf[cur] == '\t'))) + cur++; + + /* no good if we have hit the end */ + if (buf[cur] == '\0') + return FALSE; + + /* find the end of the digits but allow a leading + or - sign */ + if ((buf[cur] == '-') || (buf[cur] == '+')) + cur++; + + while(isdigit((unsigned char)buf[cur])) + cur++; + + /* check there is only trailing whitespace */ + while ((buf[cur] != '\0') + && ((buf[cur] == ' ') || (buf[cur] == '\t'))) + cur++; + + /* no good if we are not at the end of the string */ + if (buf[cur] != '\0') + return FALSE; + + /* convert and range check the number...*/ + number = atol(buf); + if ((min > max) || ((number < min) || (number > max))) + return FALSE; + + if (asprintf(&new_buf, "%.*ld", precision, number) < 0) + return FALSE; + + /* re-set the field buffer to be the reformatted numeric */ + set_field_buffer(field, 0, new_buf); + + free(new_buf); + + /* otherwise all was ok */ + return TRUE; +} + +/* + * Check the given character is numeric, return TRUE if it is. + */ +static int +integer_check_char(/* ARGSUSED1 */ int c, char *args) +{ + return ((isdigit(c) || (c == '-') || (c == '+')) ? TRUE : FALSE); +} + +static FIELDTYPE builtin_integer = { + _TYPE_HAS_ARGS | _TYPE_IS_BUILTIN, /* flags */ + 0, /* refcount */ + NULL, /* link */ + create_integer_args, /* make_args */ + copy_integer_args, /* copy_args */ + free_integer_args, /* free_args */ + integer_check_field, /* field_check */ + integer_check_char, /* char_check */ + NULL, /* next_choice */ + NULL /* prev_choice */ +}; + +FIELDTYPE *TYPE_INTEGER = &builtin_integer; + + diff --git a/vendor/netbsd-curses/libform/type_ipv4.c b/vendor/netbsd-curses/libform/type_ipv4.c new file mode 100644 index 0000000..e5c2ac4 --- /dev/null +++ b/vendor/netbsd-curses/libform/type_ipv4.c @@ -0,0 +1,211 @@ +/* $NetBSD: type_ipv4.c,v 1.11 2016/03/09 19:47:13 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#define _GNU_SOURCE +#include + +#include +#include +#include +#include +#include +#include "form.h" +#include "internals.h" + +/* + * The IP v4 address type handling. + */ + +/* + * define the styles of address we can have, they are: + * FORMI_DOTTED_QUAD address of form aaa.bbb.ccc.ddd + * FORMI_HEX address of form 0xaabbccdd + * FORMI_CLASSLESS address of form aaa.bbb.ccc.ddd/ee + */ +#define FORMI_DOTTED_QUAD 0 +#define FORMI_HEX 1 +#define FORMI_CLASSLESS 2 + +/* + * Check the contents of the field buffer are a valid IPv4 address only. + */ +static int +ipv4_check_field(FIELD *field, char *args) +{ + char *buf, *buf1, *keeper, *p, *slash; + unsigned int vals[4], style, start, mask; + unsigned long hex_val, working; + int i; + + if (args == NULL) + return FALSE; + + if (asprintf(&keeper, "%s", args) < 0) + return FALSE; + +#ifdef DEBUG + _formi_dbg_printf("%s: enter with args of %s\n", __func__, keeper); +#endif + style = FORMI_DOTTED_QUAD; + buf = keeper; + hex_val = 0; + mask = 0; + + if ((slash = index(buf, '/')) != NULL) + style = FORMI_CLASSLESS; + else { + start = _formi_skip_blanks(buf, 0); + if ((buf[start] != '\0') && (buf[start + 1] != '\0') && + (buf[start] == '0') && ((buf[start + 1] == 'x') || + (buf[start + 1] == 'X'))) + style = FORMI_HEX; + } + + switch (style) { + case FORMI_CLASSLESS: + *slash = '\0'; + slash++; + mask = atoi(slash); + if (mask > 32) + goto FAIL; + /* FALLTHROUGH */ + + case FORMI_DOTTED_QUAD: + for (i = 0; i < 4; i++) { + p = strsep(&buf, "."); + if ((p == NULL) || (*p == '\0')) + goto FAIL; + vals[i] = atoi(p); + if (vals[i] > 255) + goto FAIL; + } + break; + + + case FORMI_HEX: + errno = 0; + hex_val = strtoul(buf, NULL, 16); + if ((hex_val == ULONG_MAX) && (errno == ERANGE)) + goto FAIL; + + working = hex_val; + for (i = 3; i >= 0; i--) { + vals[i] = (unsigned int)(working & 0xffUL); + working = working >> 8; + } + break; + + } + + free(keeper); + + buf1 = NULL; + + switch (style) { + case FORMI_DOTTED_QUAD: + if (asprintf(&buf, "%d.%d.%d.%d", vals[0], vals[1], vals[2], + vals[3]) < 0) + return FALSE; + if (asprintf(&buf1, "%d.%d.%d.%d", vals[0], vals[1], + vals[2], vals[3]) < 0) + return FALSE; + break; + + case FORMI_CLASSLESS: + if (asprintf(&buf, "%d.%d.%d.%d/%d", vals[0], vals[1], + vals[2], vals[3], mask) < 0) + return FALSE; + if (asprintf(&buf1, "%d.%d.%d.%d", vals[0], vals[1], + vals[2], vals[3]) < 0) + return FALSE; + break; + + case FORMI_HEX: + if (asprintf(&buf, "0x%.8lx", hex_val) < 0) + return FALSE; + if (asprintf(&buf1, "%d.%d.%d.%d", vals[0], vals[1], + vals[2], vals[3]) < 0) + return FALSE; + break; + } + + /* re-set the field buffer to be the reformatted IPv4 address */ + set_field_buffer(field, 0, buf); + + /* + * Set the field buffer 1 to the dotted quad format regardless + * of the input format, only if buffer 1 exists. + */ + if (field->nbuf > 1) + set_field_buffer(field, 1, buf1); + +#ifdef DEBUG + _formi_dbg_printf("%s: buf0 set to %s\n", __func__, buf); + _formi_dbg_printf("%s: buf1 set to %s\n", __func__, buf1); +#endif + free(buf); + free(buf1); + + return TRUE; + + /* bail out point if we got a bad entry */ + FAIL: + free(keeper); + return FALSE; + +} + +/* + * Check the given character is numeric, return TRUE if it is. + */ +static int +ipv4_check_char(/* ARGSUSED1 */ int c, char *args) +{ + return (isxdigit(c) || (c == '.') || (tolower(c) == 'x') || + (c == '/'))? TRUE : FALSE; +} + +static FIELDTYPE builtin_ipv4 = { + _TYPE_IS_BUILTIN, /* flags */ + 0, /* refcount */ + NULL, /* link */ + NULL, /* make_args */ + NULL, /* copy_args */ + NULL, /* free_args */ + ipv4_check_field, /* field_check */ + ipv4_check_char, /* char_check */ + NULL, /* next_choice */ + NULL /* prev_choice */ +}; + +FIELDTYPE *TYPE_IPV4 = &builtin_ipv4; + + diff --git a/vendor/netbsd-curses/libform/type_ipv6.c b/vendor/netbsd-curses/libform/type_ipv6.c new file mode 100644 index 0000000..b7a6bff --- /dev/null +++ b/vendor/netbsd-curses/libform/type_ipv6.c @@ -0,0 +1,122 @@ +/* $NetBSD: type_ipv6.c,v 1.10 2004/11/24 11:57:09 blymn Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Many thanks to Jun-ichiro itojun Hagino for providing + * the sample code for the check field function, this function is 99.999% + * his code. + * + */ + +#include + +#include +#include +#include +#include +#include +#include "form.h" +#include "internals.h" + +/* + * The IP v6 address type handling. + */ + +/* + * Check the contents of the field buffer are a valid Ipv6 address only. + */ +static int +ipv6_check_field(FIELD *field, char *args) +{ + char cleaned[NI_MAXHOST]; + struct addrinfo hints, *res; + const int niflags = NI_NUMERICHOST; + + if (args == NULL) + return FALSE; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_INET6; + hints.ai_socktype = SOCK_DGRAM; /* dummy */ + hints.ai_flags = AI_NUMERICHOST; + + if (getaddrinfo(args, "0", &hints, &res) != 0) { + /* no it is not an IPv6 address */ + return FALSE; + } + + if (res->ai_next) { + /* somehow the address resolved to multiple + * addresses - strange + */ + freeaddrinfo(res); + return FALSE; + } + + if (getnameinfo(res->ai_addr, res->ai_addrlen, cleaned, + (socklen_t) sizeof(cleaned), NULL, 0, niflags) != 0) { + freeaddrinfo(res); + return FALSE; + } + + freeaddrinfo(res); + + /* + * now we are sure host is an IPv6 address literal, and "cleaned" + * has the uniformly-formatted IPv6 address literal. Re-set the + * field buffer to be the reformatted IPv6 address + */ + set_field_buffer(field, 0, cleaned); + + return TRUE; +} + +/* + * Check the given character is numeric, return TRUE if it is. + */ +static int +ipv6_check_char(/* ARGSUSED1 */ int c, char *args) +{ + return (isxdigit(c) || (c == '.') || (c == ':')) ? TRUE : FALSE; +} + +static FIELDTYPE builtin_ipv6 = { + _TYPE_IS_BUILTIN, /* flags */ + 0, /* refcount */ + NULL, /* link */ + NULL, /* make_args */ + NULL, /* copy_args */ + NULL, /* free_args */ + ipv6_check_field, /* field_check */ + ipv6_check_char, /* char_check */ + NULL, /* next_choice */ + NULL /* prev_choice */ +}; + +FIELDTYPE *TYPE_IPV6 = &builtin_ipv6; + + diff --git a/vendor/netbsd-curses/libform/type_numeric.c b/vendor/netbsd-curses/libform/type_numeric.c new file mode 100644 index 0000000..2cbda4a --- /dev/null +++ b/vendor/netbsd-curses/libform/type_numeric.c @@ -0,0 +1,219 @@ +/* $NetBSD: type_numeric.c,v 1.10 2021/04/13 13:13:04 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#define _GNU_SOURCE +#include + +#include +#include +#include +#include "form.h" +#include "internals.h" + +/* + * The numeric type handling. + */ + +typedef struct +{ + unsigned precision; + double min; + double max; +} numeric_args; + +/* + * Create the numeric arguments structure from the given args. Return NULL + * if the call fails, otherwise return a pointer to the structure allocated. + */ +static char * +create_numeric_args(va_list *args) +{ + numeric_args *new; + + new = malloc(sizeof(*new)); + + if (new != NULL) { + new->precision = va_arg(*args, unsigned); + new->min = va_arg(*args, double); + new->max = va_arg(*args, double); + } + + return (void *) new; +} + +/* + * Copy the numeric argument structure. + */ +static char * +copy_numeric_args(char *args) +{ + numeric_args *new; + + new = malloc(sizeof(*new)); + + if (new != NULL) + memcpy(new, args, sizeof(*args)); + + return (void *) new; +} + +/* + * Free the allocated storage associated with the type arguments. + */ +static void +free_numeric_args(char *args) +{ + if (args != NULL) + free(args); +} + +/* + * Check the contents of the field buffer are numeric only. A valid + * number is of the form nnnn[.mmmmm][Ee[+-]ddd] + */ +static int +numeric_check_field(FIELD *field, char *args) +{ + int cur; + double number, max, min; + int precision; + char *buf, *new_buf; + + if (args == NULL) + return FALSE; + + precision = ((numeric_args *) (void *) field->args)->precision; + min = ((numeric_args *) (void *) field->args)->min; + max = ((numeric_args *) (void *) field->args)->max; + + buf = args; + cur = 0; + + /* skip leading white space */ + while ((buf[cur] != '\0') + && ((buf[cur] == ' ') || (buf[cur] == '\t'))) + cur++; + + /* no good if we have hit the end */ + if (buf[cur] == '\0') + return FALSE; + + /* find the end of the digits but allow a leading + or - sign, and + * a decimal point. + */ + if ((buf[cur] == '-') || (buf[cur] == '+')) + cur++; + + while(isdigit((unsigned char)buf[cur])) + cur++; + + /* if not at end of string then check for decimal... */ + if (buf[cur] == '.') { + cur++; + /* check for more digits now.... */ + while (buf[cur] && isdigit((unsigned char)buf[cur])) + cur++; + } + + /* check for an exponent */ + if ((buf[cur] == 'E') || (buf[cur] == 'e')) { + cur++; + if (buf[cur] == '\0') + return FALSE; + + /* allow a + or a - for exponent */ + if ((buf[cur] == '+') || (buf[cur] == '-')) + cur++; + + if (buf[cur] == '\0') + return FALSE; + + /* we expect a digit now */ + if (!isdigit((unsigned char)buf[cur])) + return FALSE; + + /* skip digits for the final time */ + while(isdigit((unsigned char)buf[cur])) + cur++; + } + + /* check there is only trailing whitespace */ + while ((buf[cur] != '\0') + && ((buf[cur] == ' ') || (buf[cur] == '\t'))) + cur++; + + /* no good if we are not at the end of the string */ + if (buf[cur] != '\0') + return FALSE; + + /* convert and range check the number...*/ + number = atof(buf); + if ((min < max) && ((number < min) || (number > max))) + return FALSE; + + if (asprintf(&new_buf, "%.*f", precision, number) < 0) + return FALSE; + + /* re-set the field buffer to be the reformatted numeric */ + set_field_buffer(field, 0, new_buf); + + free(new_buf); + + /* otherwise all was ok */ + return TRUE; +} + +/* + * Check the given character is numeric, return TRUE if it is. + */ +static int +numeric_check_char(/* ARGSUSED1 */ int c, char *args) +{ + return ((isdigit(c) || (c == '-') || (c == '+') + || (c == '.') || (c == 'e') || (c == 'E')) ? TRUE : FALSE); +} + +static FIELDTYPE builtin_numeric = { + _TYPE_HAS_ARGS | _TYPE_IS_BUILTIN, /* flags */ + 0, /* refcount */ + NULL, /* link */ + create_numeric_args, /* make_args */ + copy_numeric_args, /* copy_args */ + free_numeric_args, /* free_args */ + numeric_check_field, /* field_check */ + numeric_check_char, /* char_check */ + NULL, /* next_choice */ + NULL /* prev_choice */ +}; + +FIELDTYPE *TYPE_NUMERIC = &builtin_numeric; + + diff --git a/vendor/netbsd-curses/libform/type_regex.c b/vendor/netbsd-curses/libform/type_regex.c new file mode 100644 index 0000000..01be4e2 --- /dev/null +++ b/vendor/netbsd-curses/libform/type_regex.c @@ -0,0 +1,128 @@ +/* $NetBSD: type_regex.c,v 1.8 2021/04/13 13:13:04 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn + * (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include +#include +#include +#include "form.h" +#include "internals.h" + +/* + * The regex type handling. + */ + +typedef struct +{ + regex_t compiled; + unsigned references; +} regex_args; + +/* + * Create the regex arguments structure from the given args. Return NULL + * if the call fails, otherwise return a pointer to the structure allocated. + */ +static char * +create_regex_args(va_list *args) +{ + regex_args *new; + char *expression; + + new = malloc(sizeof(*new)); + + if (new != NULL) { + new->references = 1; + expression = va_arg(*args, char *); + if ((regcomp(&new->compiled, expression, + (REG_EXTENDED | REG_NOSUB | REG_NEWLINE))) != 0) { + free(new); + return NULL; + } + } + + return (void *) new; +} + +/* + * Copy the regex argument structure. + */ +static char * +copy_regex_args(char *args) +{ + ((regex_args *) (void *) args)->references++; + + return (void *) args; +} + +/* + * Free the allocated storage associated with the type arguments. + */ +static void +free_regex_args(char *args) +{ + if (args != NULL) { + ((regex_args *) (void *) args)->references--; + if (((regex_args *) (void *) args)->references == 0) + free(args); + } +} + +/* + * Check the contents of the field buffer match the regex. + */ +static int +regex_check_field(FIELD *field, char *args) +{ + if ((args != NULL) && + (regexec(&((regex_args *) (void *) field->args)->compiled, + args, (size_t) 0, NULL, 0) == 0)) + return TRUE; + + return FALSE; +} + +static FIELDTYPE builtin_regex = { + _TYPE_HAS_ARGS | _TYPE_IS_BUILTIN, /* flags */ + 0, /* refcount */ + NULL, /* link */ + create_regex_args, /* make_args */ + copy_regex_args, /* copy_args */ + free_regex_args, /* free_args */ + regex_check_field, /* field_check */ + NULL, /* char_check */ + NULL, /* next_choice */ + NULL /* prev_choice */ +}; + +FIELDTYPE *TYPE_REGEXP = &builtin_regex; + + diff --git a/vendor/netbsd-curses/libform/unpost_form.3 b/vendor/netbsd-curses/libform/unpost_form.3 new file mode 120000 index 0000000..418a48e --- /dev/null +++ b/vendor/netbsd-curses/libform/unpost_form.3 @@ -0,0 +1 @@ +form_post.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/GNUmakefile b/vendor/netbsd-curses/libmenu/GNUmakefile new file mode 100644 index 0000000..48435b9 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/GNUmakefile @@ -0,0 +1,88 @@ +# $NetBSD: Makefile,v 1.9 2012/06/27 22:18:07 jdf Exp $ +# + +CPPFLAGS+=-I. -I.. +LIB= menu + +LIBDPLIBS+= curses ${.CURDIR}/../libcurses + +SRCS= menu.c item.c userptr.c internals.c driver.c post.c attributes.c +MAN= menu_attributes.3 menu_item_name.3 menu_items.3 menu_userptr.3 \ + menu_cursor.3 menu_item_new.3 menu_mark.3 menu_win.3 menu_driver.3 \ + menu_item_opts.3 menu_new.3 menus.3 menu_format.3 menu_item_userptr.3 \ + menu_opts.3 menu_hook.3 menu_item_value.3 menu_pattern.3 \ + menu_item_current.3 menu_item_visible.3 menu_post.3 +MLINKS+= menu_attributes.3 menu_back.3 \ + menu_attributes.3 menu_fore.3 \ + menu_attributes.3 menu_grey.3 \ + menu_attributes.3 menu_pad.3 \ + menu_attributes.3 set_menu_back.3 \ + menu_attributes.3 set_menu_fore.3 \ + menu_attributes.3 set_menu_grey.3 \ + menu_attributes.3 set_menu_pad.3 \ + menu_item_name.3 item_description.3 \ + menu_item_name.3 item_name.3 \ + menu_items.3 item_count.3 \ + menu_items.3 set_menu_items.3 \ + menu_userptr.3 set_menu_userptr.3 \ + menu_cursor.3 pos_menu_cursor.3 \ + menu_item_new.3 free_item.3 \ + menu_item_new.3 new_item.3 \ + menu_mark.3 menu_unmark.3 \ + menu_mark.3 set_menu_mark.3 \ + menu_mark.3 set_menu_unmark.3 \ + menu_win.3 menu_sub.3 \ + menu_win.3 scale_menu.3 \ + menu_win.3 set_menu_sub.3 \ + menu_win.3 set_menu_win.3 \ + menu_item_opts.3 item_opts.3 \ + menu_item_opts.3 item_opts_off.3 \ + menu_item_opts.3 item_opts_on.3 \ + menu_new.3 new_menu.3 \ + menu_new.3 free_menu.3 \ + menu_format.3 set_menu_format.3 \ + menu_item_userptr.3 item_userptr.3 \ + menu_item_userptr.3 set_item_userptr.3 \ + menu_opts.3 menu_opts_off.3 \ + menu_opts.3 menu_opts_on.3 \ + menu_opts.3 set_menu_opts.3 \ + menu_hook.3 item_init.3 \ + menu_hook.3 item_term.3 \ + menu_hook.3 menu_init.3 \ + menu_hook.3 menu_term.3 \ + menu_hook.3 set_item_init.3 \ + menu_hook.3 set_item_term.3 \ + menu_hook.3 set_menu_init.3 \ + menu_hook.3 set_menu_term.3 \ + menu_item_value.3 item_value.3 \ + menu_item_value.3 set_item_value.3 \ + menu_item_value.3 item_selected.3 \ + menu_item_current.3 current_item.3 \ + menu_item_current.3 item_index.3 \ + menu_item_current.3 set_current_item.3 \ + menu_item_current.3 set_top_row.3 \ + menu_item_current.3 top_row.3 \ + menu_item_visible.3 item_visible.3 \ + menu_post.3 post_menu.3 \ + menu_post.3 unpost_menu.3 +INCS= menu.h eti.h +INCSDIR=/usr/include +CFLAGS+=-Werror-implicit-function-declaration + +AR?=ar +RANLIB?=ranlib +OBJS = $(SRCS:.c=.o) +LIBA=lib$(LIB).a +all: $(LIBA) + +clean: + rm -f $(OBJS) $(LIBA) + +$(LIBA): $(OBJS) + rm -f $(LIBA) + $(AR) cr $@ $^ + $(RANLIB) $@ + +%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $< + diff --git a/vendor/netbsd-curses/libmenu/Makefile b/vendor/netbsd-curses/libmenu/Makefile new file mode 100644 index 0000000..e219d6c --- /dev/null +++ b/vendor/netbsd-curses/libmenu/Makefile @@ -0,0 +1,77 @@ +# $NetBSD: Makefile,v 1.9 2012/06/27 22:18:07 jdf Exp $ +# + +CPPFLAGS+=-I${.CURDIR} +.if defined(DEBUG_MENUS) +CFLAGS+=-g +CPPFLAGS+=-DDEBUG +LDFLAGS+=-g +.endif +LIB= menu + +LIBDPLIBS+= curses ${.CURDIR}/../libcurses + +SRCS= menu.c item.c userptr.c internals.c driver.c post.c attributes.c +MAN= menu_attributes.3 menu_item_name.3 menu_items.3 menu_userptr.3 \ + menu_cursor.3 menu_item_new.3 menu_mark.3 menu_win.3 menu_driver.3 \ + menu_item_opts.3 menu_new.3 menus.3 menu_format.3 menu_item_userptr.3 \ + menu_opts.3 menu_hook.3 menu_item_value.3 menu_pattern.3 \ + menu_item_current.3 menu_item_visible.3 menu_post.3 +MLINKS+= menu_attributes.3 menu_back.3 \ + menu_attributes.3 menu_fore.3 \ + menu_attributes.3 menu_grey.3 \ + menu_attributes.3 menu_pad.3 \ + menu_attributes.3 set_menu_back.3 \ + menu_attributes.3 set_menu_fore.3 \ + menu_attributes.3 set_menu_grey.3 \ + menu_attributes.3 set_menu_pad.3 \ + menu_item_name.3 item_description.3 \ + menu_item_name.3 item_name.3 \ + menu_items.3 item_count.3 \ + menu_items.3 set_menu_items.3 \ + menu_userptr.3 set_menu_userptr.3 \ + menu_cursor.3 pos_menu_cursor.3 \ + menu_item_new.3 free_item.3 \ + menu_item_new.3 new_item.3 \ + menu_mark.3 menu_unmark.3 \ + menu_mark.3 set_menu_mark.3 \ + menu_mark.3 set_menu_unmark.3 \ + menu_win.3 menu_sub.3 \ + menu_win.3 scale_menu.3 \ + menu_win.3 set_menu_sub.3 \ + menu_win.3 set_menu_win.3 \ + menu_item_opts.3 item_opts.3 \ + menu_item_opts.3 item_opts_off.3 \ + menu_item_opts.3 item_opts_on.3 \ + menu_new.3 new_menu.3 \ + menu_new.3 free_menu.3 \ + menu_format.3 set_menu_format.3 \ + menu_item_userptr.3 item_userptr.3 \ + menu_item_userptr.3 set_item_userptr.3 \ + menu_opts.3 menu_opts_off.3 \ + menu_opts.3 menu_opts_on.3 \ + menu_opts.3 set_menu_opts.3 \ + menu_hook.3 item_init.3 \ + menu_hook.3 item_term.3 \ + menu_hook.3 menu_init.3 \ + menu_hook.3 menu_term.3 \ + menu_hook.3 set_item_init.3 \ + menu_hook.3 set_item_term.3 \ + menu_hook.3 set_menu_init.3 \ + menu_hook.3 set_menu_term.3 \ + menu_item_value.3 item_value.3 \ + menu_item_value.3 set_item_value.3 \ + menu_item_value.3 item_selected.3 \ + menu_item_current.3 current_item.3 \ + menu_item_current.3 item_index.3 \ + menu_item_current.3 set_current_item.3 \ + menu_item_current.3 set_top_row.3 \ + menu_item_current.3 top_row.3 \ + menu_item_visible.3 item_visible.3 \ + menu_post.3 post_menu.3 \ + menu_post.3 unpost_menu.3 +INCS= menu.h eti.h +INCSDIR=/usr/include + +.include +.include diff --git a/vendor/netbsd-curses/libmenu/attributes.c b/vendor/netbsd-curses/libmenu/attributes.c new file mode 100644 index 0000000..2c7fcbe --- /dev/null +++ b/vendor/netbsd-curses/libmenu/attributes.c @@ -0,0 +1,134 @@ +/* $NetBSD: attributes.c,v 1.7 2003/03/09 01:08:47 lukem Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include + +/* defined in menu.c - the default menu struct */ +extern MENU _menui_default_menu; + +/* + * Set the menu foreground attribute + */ +int +set_menu_fore(MENU *menu, attr_t attr) +{ + if (menu == NULL) + _menui_default_menu.fore = attr; + else + menu->fore = attr; + return E_OK; +} + +/* + * Return the menu foreground attribute + */ +char +menu_fore(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.fore; + else + return menu->fore; +} + +/* + * Set the menu background attribute + */ +int +set_menu_back(MENU *menu, attr_t attr) +{ + if (menu == NULL) + _menui_default_menu.back = attr; + else + menu->back = attr; + return E_OK; +} + +/* + * Return the menu background attribute + */ +char +menu_back(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.back; + else + return menu->back; +} + +/* + * Set the menu greyed out attribute + */ +int +set_menu_grey(MENU *menu, attr_t attr) +{ + if (menu == NULL) + _menui_default_menu.grey = attr; + else + menu->grey = attr; + return E_OK; +} + +/* + * Return the menu greyed out attribute + */ +char +menu_grey(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.grey; + else + return menu->grey; +} + +/* + * Set the menu pad character - the filler char between name and description + */ +int +set_menu_pad(MENU *menu, int pad) +{ + if (menu == NULL) + _menui_default_menu.pad = pad; + else + menu->pad = pad; + return E_OK; +} + +/* + * Return the menu pad character + */ +int +menu_pad(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.pad; + else + return menu->pad; +} diff --git a/vendor/netbsd-curses/libmenu/current_item.3 b/vendor/netbsd-curses/libmenu/current_item.3 new file mode 120000 index 0000000..230876e --- /dev/null +++ b/vendor/netbsd-curses/libmenu/current_item.3 @@ -0,0 +1 @@ +menu_item_current.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/driver.c b/vendor/netbsd-curses/libmenu/driver.c new file mode 100644 index 0000000..27f9fd1 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/driver.c @@ -0,0 +1,287 @@ +/* $NetBSD: driver.c,v 1.9 2003/03/09 01:08:48 lukem Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include +#include +#include +#include "internals.h" + +/* + * The guts of the menu library. This function processes the character + * in c and performs actions based on the value of the character. If the + * character is a normal one then the driver attempts to match the character + * against the items. If the character is a recognised request then the + * request is processed by the driver, if the character is not a recognised + * request and is not printable then it assumed to be a user defined command. + */ +int +menu_driver(MENU *menu, int c) +{ + int drv_top_row, drv_scroll, i, it, status = E_OK; + ITEM *drv_new_item; + + i = 0; + + if (menu == NULL) + return E_BAD_ARGUMENT; + if (menu->posted == 0) + return E_NOT_POSTED; + if (menu->items == NULL) + return E_NOT_CONNECTED; + if (*menu->items == NULL) + return E_NOT_CONNECTED; + if (menu->in_init == 1) + return E_BAD_STATE; + + /* this one should never happen but just in case.... */ + if (menu->items[menu->cur_item] == NULL) + return E_SYSTEM_ERROR; + + drv_new_item = menu->items[menu->cur_item]; + it = menu->cur_item; + drv_top_row = menu->top_row; + + if ((c > REQ_BASE_NUM) && (c <= MAX_COMMAND)) { + /* is a known driver request - first check if the pattern + * buffer needs to be cleared, we do this on non-search + * type requests. + */ + if (! ((c == REQ_BACK_PATTERN) || (c == REQ_NEXT_MATCH) || + (c == REQ_PREV_MATCH))) { + if ((c == REQ_CLEAR_PATTERN) + && (menu->pattern == NULL)) + return E_REQUEST_DENIED; + free(menu->pattern); + menu->pattern = NULL; + menu->plen = 0; + menu->match_len = 0; + } + + switch (c) { + case REQ_LEFT_ITEM: + drv_new_item = drv_new_item->left; + break; + case REQ_RIGHT_ITEM: + drv_new_item = drv_new_item->right; + break; + case REQ_UP_ITEM: + drv_new_item = drv_new_item->up; + break; + case REQ_DOWN_ITEM: + drv_new_item = drv_new_item->down; + break; + case REQ_SCR_ULINE: + if (drv_top_row == 0) + return E_REQUEST_DENIED; + drv_top_row--; + drv_new_item = drv_new_item->up; + break; + case REQ_SCR_DLINE: + drv_top_row++; + if ((drv_top_row + menu->rows - 1)> menu->item_rows) + return E_REQUEST_DENIED; + drv_new_item = drv_new_item->down; + break; + case REQ_SCR_DPAGE: + drv_scroll = menu->item_rows - menu->rows + - menu->top_row; + if (drv_scroll > menu->rows) { + drv_scroll = menu->rows; + } + + if (drv_scroll <= 0) { + return E_REQUEST_DENIED; + } else { + drv_top_row += drv_scroll; + while (drv_scroll-- > 0) + drv_new_item = drv_new_item->down; + } + break; + case REQ_SCR_UPAGE: + if (menu->rows < menu->top_row) { + drv_scroll = menu->rows; + } else { + drv_scroll = menu->top_row; + } + if (drv_scroll == 0) + return E_REQUEST_DENIED; + + drv_top_row -= drv_scroll; + while (drv_scroll-- > 0) + drv_new_item = drv_new_item->up; + break; + case REQ_FIRST_ITEM: + drv_new_item = menu->items[0]; + break; + case REQ_LAST_ITEM: + drv_new_item = menu->items[menu->item_count - 1]; + break; + case REQ_NEXT_ITEM: + if ((menu->cur_item + 1) >= menu->item_count) { + if ((menu->opts & O_NONCYCLIC) + == O_NONCYCLIC) { + return E_REQUEST_DENIED; + } else { + drv_new_item = menu->items[0]; + } + } else { + drv_new_item = + menu->items[menu->cur_item + 1]; + } + break; + case REQ_PREV_ITEM: + if (menu->cur_item == 0) { + if ((menu->opts & O_NONCYCLIC) + == O_NONCYCLIC) { + return E_REQUEST_DENIED; + } else { + drv_new_item = menu->items[ + menu->item_count - 1]; + } + } else { + drv_new_item = + menu->items[menu->cur_item - 1]; + } + break; + case REQ_TOGGLE_ITEM: + if ((menu->opts & (O_RADIO | O_ONEVALUE)) != 0) { + if ((menu->opts & O_RADIO) == O_RADIO) { + if ((drv_new_item->opts & O_SELECTABLE) + != O_SELECTABLE) + return E_NOT_SELECTABLE; + + /* don't deselect selected item */ + if (drv_new_item->selected == 1) + return E_REQUEST_DENIED; + + /* deselect all items */ + for (i = 0; i < menu->item_count; i++) { + if ((menu->items[i]->selected) && + (drv_new_item->index != i)) { + menu->items[i]->selected ^= 1; + _menui_draw_item(menu, + menu->items[i]->index); + } + } + + /* turn on selected item */ + drv_new_item->selected ^= 1; + _menui_draw_item(menu, drv_new_item->index); + } else { + return E_REQUEST_DENIED; + } + } else { + if ((drv_new_item->opts + & O_SELECTABLE) == O_SELECTABLE) { + /* toggle select flag */ + drv_new_item->selected ^= 1; + /* update item in menu */ + _menui_draw_item(menu, + drv_new_item->index); + } else { + return E_NOT_SELECTABLE; + } + } + break; + case REQ_CLEAR_PATTERN: + /* this action is taken before the + case statement */ + break; + case REQ_BACK_PATTERN: + if (menu->pattern == NULL) + return E_REQUEST_DENIED; + + if (menu->plen == 0) + return E_REQUEST_DENIED; + menu->pattern[menu->plen--] = '\0'; + break; + case REQ_NEXT_MATCH: + if (menu->pattern == NULL) + return E_REQUEST_DENIED; + + status = _menui_match_pattern(menu, 0, + MATCH_NEXT_FORWARD, + &it); + drv_new_item = menu->items[it]; + break; + case REQ_PREV_MATCH: + if (menu->pattern == NULL) + return E_REQUEST_DENIED; + + status = _menui_match_pattern(menu, 0, + MATCH_NEXT_REVERSE, + &it); + drv_new_item = menu->items[it]; + break; + } + } else if (c > MAX_COMMAND) { + /* must be a user command */ + return E_UNKNOWN_COMMAND; + } else if (isprint((unsigned char) c)) { + /* otherwise search items for the character. */ + status = _menui_match_pattern(menu, (unsigned char) c, + MATCH_FORWARD, &it); + drv_new_item = menu->items[it]; + + /* update the position of the cursor if we are doing + * show match and the current item has not changed. If + * we don't do this here it won't get done since the + * display will not be updated due to the current item + * not changing. + */ + if ((drv_new_item->index == menu->cur_item) + && ((menu->opts & O_SHOWMATCH) == O_SHOWMATCH)) { + pos_menu_cursor(menu); + } + + + } else { + /* bad character */ + return E_BAD_ARGUMENT; + } + + if (drv_new_item == NULL) + return E_REQUEST_DENIED; + + if (drv_new_item->row < drv_top_row) drv_top_row = drv_new_item->row; + if (drv_new_item->row >= (drv_top_row + menu->rows)) + drv_top_row = drv_new_item->row - menu->rows + 1; + + if ((drv_new_item->index != menu->cur_item) + || (drv_top_row != menu->top_row)) + _menui_goto_item(menu, drv_new_item, drv_top_row); + + return status; +} + + + + + diff --git a/vendor/netbsd-curses/libmenu/eti.h b/vendor/netbsd-curses/libmenu/eti.h new file mode 100644 index 0000000..84cff06 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/eti.h @@ -0,0 +1,50 @@ +/* $NetBSD: eti.h,v 1.8 2001/06/13 10:45:59 wiz Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#ifndef _ETI_H_ +#define _ETI_H_ + +/* common return codes for libmenu and libpanel functions */ + +#define E_OK (0) +#define E_SYSTEM_ERROR (-1) +#define E_BAD_ARGUMENT (-2) +#define E_POSTED (-3) +#define E_CONNECTED (-4) +#define E_BAD_STATE (-5) +#define E_NO_ROOM (-6) +#define E_NOT_POSTED (-7) +#define E_UNKNOWN_COMMAND (-8) +#define E_NO_MATCH (-9) +#define E_NOT_SELECTABLE (-10) +#define E_NOT_CONNECTED (-11) +#define E_REQUEST_DENIED (-12) +#define E_INVALID_FIELD (-13) +#define E_CURRENT (-14) + +#endif /* !_ETI_H_ */ diff --git a/vendor/netbsd-curses/libmenu/free_item.3 b/vendor/netbsd-curses/libmenu/free_item.3 new file mode 120000 index 0000000..96bfeca --- /dev/null +++ b/vendor/netbsd-curses/libmenu/free_item.3 @@ -0,0 +1 @@ +menu_item_new.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/free_menu.3 b/vendor/netbsd-curses/libmenu/free_menu.3 new file mode 120000 index 0000000..98027d0 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/free_menu.3 @@ -0,0 +1 @@ +menu_new.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/internals.c b/vendor/netbsd-curses/libmenu/internals.c new file mode 100644 index 0000000..46de869 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/internals.c @@ -0,0 +1,631 @@ +/* $NetBSD: internals.c,v 1.17 2013/10/18 19:53:59 christos Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include +#include +#include +#include +#include "internals.h" + +/* internal function prototypes */ +static void +_menui_calc_neighbours(MENU *menu, int item_no); +static void _menui_redraw_menu(MENU *menu, int old_top_row, int old_cur_item); + + /* + * Link all the menu items together to speed up navigation. We need + * to calculate the widest item entry, then work out how many columns + * of items the window will accommodate and then how many rows there will + * be. Once the layout is determined the neighbours of each item is + * calculated and the item structures updated. + */ +int +_menui_stitch_items(MENU *menu) +{ + int i, row_major; + + row_major = ((menu->opts & O_ROWMAJOR) == O_ROWMAJOR); + + if (menu->posted == 1) + return E_POSTED; + if (menu->items == NULL) + return E_BAD_ARGUMENT; + + menu->item_rows = menu->item_count / menu->cols; + menu->item_cols = menu->cols; + if (menu->item_count > (menu->item_rows * menu->item_cols)) + menu->item_rows += 1; + + _menui_max_item_size(menu); + + for (i = 0; i < menu->item_count; i++) { + /* fill in the row and column value of the item */ + if (row_major) { + menu->items[i]->row = i / menu->item_cols; + menu->items[i]->col = i % menu->item_cols; + } else { + menu->items[i]->row = i % menu->item_rows; + menu->items[i]->col = i / menu->item_rows; + } + + _menui_calc_neighbours(menu, i); + } + + return E_OK; +} + + /* + * Calculate the neighbours for an item in menu. + */ +static void +_menui_calc_neighbours(MENU *menu, int item_no) +{ + int neighbour, cycle, row_major, edge; + ITEM *item; + + row_major = ((menu->opts & O_ROWMAJOR) == O_ROWMAJOR); + cycle = ((menu->opts & O_NONCYCLIC) != O_NONCYCLIC); + item = menu->items[item_no]; + + if (menu->item_rows < 2) { + if (cycle) { + item->up = item; + item->down = item; + } else { + item->up = NULL; + item->down = NULL; + } + } else { + + /* up */ + if (menu->item_cols < 2) { + if (item_no == 0) { + if (cycle) + item->up = + menu->items[menu->item_count - 1]; + else + item->up = NULL; + } else + item->up = menu->items[item_no - 1]; + } else { + edge = 0; + if (row_major) { + if (item->row == 0) { + neighbour = + (menu->item_rows - 1) * menu->item_cols + + item->col; + if (neighbour >= menu->item_count) + neighbour -= menu->item_cols; + edge = 1; + } else + neighbour = item_no - menu->item_cols; + } else { + if (item->row == 0) { + neighbour = menu->item_rows * item->col + + menu->item_rows - 1; + if (neighbour >= menu->item_count) + neighbour = menu->item_count - 1; + edge = 1; + } else + neighbour = item_no - 1; + } + + + item->up = menu->items[neighbour]; + if ((!cycle) && (edge == 1)) + item->up = NULL; + } + + /* Down */ + if (menu->item_cols < 2) { + if (item_no == (menu->item_count - 1)) { + if (cycle) + item->down = menu->items[0]; + else + item->down = NULL; + } else + item->down = menu->items[item_no + 1]; + } else { + edge = 0; + if (row_major) { + if (item->row == menu->item_rows - 1) { + neighbour = item->col; + edge = 1; + } else { + neighbour = item_no + menu->item_cols; + if (neighbour >= menu->item_count) { + neighbour = item->col; + edge = 1; + } + } + } else { + if (item->row == menu->item_rows - 1) { + neighbour = item->col * menu->item_rows; + edge = 1; + } else { + neighbour = item_no + 1; + if (neighbour >= menu->item_count) { + neighbour = item->col + * menu->item_rows; + edge = 1; + } + } + } + + item->down = menu->items[neighbour]; + if ((!cycle) && (edge == 1)) + item->down = NULL; + } + } + + if (menu->item_cols < 2) { + if (cycle) { + item->left = item; + item->right = item; + } else { + item->left = NULL; + item->right = NULL; + } + } else { + /* left */ + if (menu->item_rows < 2) { + if (item_no == 0) { + if (cycle) + item->left = + menu->items[menu->item_count - 1]; + else + item->left = NULL; + } else + item->left = menu->items[item_no - 1]; + } else { + edge = 0; + if (row_major) { + if (item->col == 0) { + neighbour = item_no + menu->cols - 1; + if (neighbour >= menu->item_count) + neighbour = menu->item_count - 1; + edge = 1; + } else + neighbour = item_no - 1; + } else { + if (item->col == 0) { + neighbour = menu->item_rows + * (menu->item_cols - 1) + item->row; + if (neighbour >= menu->item_count) + neighbour -= menu->item_rows; + edge = 1; + } else + neighbour = item_no - menu->item_rows; + } + + item->left = menu->items[neighbour]; + if ((!cycle) && (edge == 1)) + item->left = NULL; + } + + /* right */ + if (menu->item_rows < 2) { + if (item_no == menu->item_count - 1) { + if (cycle) + item->right = menu->items[0]; + else + item->right = NULL; + } else + item->right = menu->items[item_no + 1]; + } else { + edge = 0; + if (row_major) { + if (item->col == menu->item_cols - 1) { + neighbour = item_no - menu->item_cols + + 1; + edge = 1; + } else if (item_no == menu->item_count - 1) { + neighbour = item->row * menu->item_cols; + edge = 1; + } else + neighbour = item_no + 1; + } else { + if (item->col == menu->item_cols - 1) { + neighbour = item->row; + edge = 1; + } else { + neighbour = item_no + menu->item_rows; + if (neighbour >= menu->item_count) { + neighbour = item->row; + edge = 1; + } + } + } + + item->right = menu->items[neighbour]; + if ((!cycle) && (edge == 1)) + item->right = NULL; + } + } +} + +/* + * Goto the item pointed to by item and adjust the menu structure + * accordingly. Call the term and init functions if required. + */ +int +_menui_goto_item(MENU *menu, ITEM *item, int new_top_row) +{ + int old_top_row = menu->top_row, old_cur_item = menu->cur_item; + + /* If we get a null then the menu is not cyclic so deny request */ + if (item == NULL) + return E_REQUEST_DENIED; + + menu->in_init = 1; + if (menu->top_row != new_top_row) { + if ((menu->posted == 1) && (menu->menu_term != NULL)) + menu->menu_term(menu); + menu->top_row = new_top_row; + + if ((menu->posted == 1) && (menu->menu_init != NULL)) + menu->menu_init(menu); + } + + /* this looks like wasted effort but it can happen.... */ + if (menu->cur_item != item->index) { + + if ((menu->posted == 1) && (menu->item_term != NULL)) + menu->item_term(menu); + + menu->cur_item = item->index; + menu->cur_row = item->row; + menu->cur_col = item->col; + + if (menu->posted == 1) + _menui_redraw_menu(menu, old_top_row, old_cur_item); + + if ((menu->posted == 1) && (menu->item_init != NULL)) + menu->item_init(menu); + + } + + menu->in_init = 0; + return E_OK; +} + +/* + * Attempt to match items with the pattern buffer in the direction given + * by iterating over the menu items. If a match is found return E_OK + * otherwise return E_NO_MATCH + */ +int +_menui_match_items(MENU *menu, int direction, int *item_matched) +{ + int i, caseless; + + caseless = ((menu->opts & O_IGNORECASE) == O_IGNORECASE); + + i = menu->cur_item; + if (direction == MATCH_NEXT_FORWARD) { + if (++i >= menu->item_count) i = 0; + } else if (direction == MATCH_NEXT_REVERSE) { + if (--i < 0) i = menu->item_count - 1; + } + + + do { + if (menu->items[i]->name.length >= menu->plen) { + /* no chance if pattern is longer */ + if (caseless) { + if (strncasecmp(menu->items[i]->name.string, + menu->pattern, + (size_t) menu->plen) == 0) { + *item_matched = i; + menu->match_len = menu->plen; + return E_OK; + } + } else { + if (strncmp(menu->items[i]->name.string, + menu->pattern, + (size_t) menu->plen) == 0) { + *item_matched = i; + menu->match_len = menu->plen; + return E_OK; + } + } + } + + if ((direction == MATCH_FORWARD) || + (direction == MATCH_NEXT_FORWARD)) { + if (++i >= menu->item_count) i = 0; + } else { + if (--i <= 0) i = menu->item_count - 1; + } + } while (i != menu->cur_item); + + menu->match_len = 0; /* match did not succeed - kill the match len. */ + return E_NO_MATCH; +} + +/* + * Attempt to match the pattern buffer against the items. If c is a + * printable character then add it to the pattern buffer prior to + * performing the match. Direction determines the direction of matching. + * If the match is successful update the item_matched variable with the + * index of the item that matched the pattern. + */ +int +_menui_match_pattern(MENU *menu, int c, int direction, int *item_matched) +{ + if (menu == NULL) + return E_BAD_ARGUMENT; + if (menu->items == NULL) + return E_BAD_ARGUMENT; + if (*menu->items == NULL) + return E_BAD_ARGUMENT; + + if (isprint(c)) { + /* add char to buffer - first allocate room for it */ + if ((menu->pattern = (char *) + realloc(menu->pattern, + menu->plen + sizeof(char) + + ((menu->plen > 0)? 0 : 1))) + == NULL) + return E_SYSTEM_ERROR; + menu->pattern[menu->plen] = c; + menu->pattern[++menu->plen] = '\0'; + + /* there is no chance of a match if pattern is longer + than all the items */ + if (menu->plen >= menu->max_item_width) { + menu->pattern[--menu->plen] = '\0'; + return E_NO_MATCH; + } + + if (_menui_match_items(menu, direction, + item_matched) == E_NO_MATCH) { + menu->pattern[--menu->plen] = '\0'; + return E_NO_MATCH; + } else + return E_OK; + } else { + if (_menui_match_items(menu, direction, + item_matched) == E_OK) { + return E_OK; + } else { + return E_NO_MATCH; + } + } +} + +/* + * Draw an item in the subwindow complete with appropriate highlighting. + */ +void +_menui_draw_item(MENU *menu, int item) +{ + int j, pad_len, mark_len; + + mark_len = max(menu->mark.length, menu->unmark.length); + + wmove(menu->scrwin, + menu->items[item]->row - menu->top_row, + menu->items[item]->col * (menu->col_width + 1)); + + if (menu->cur_item == item) + wattrset(menu->scrwin, menu->fore); + if ((menu->items[item]->opts & O_SELECTABLE) != O_SELECTABLE) + wattron(menu->scrwin, menu->grey); + + /* deal with the menu mark, if one is set. + * We mark the selected items and write blanks for + * all others unless the menu unmark string is set in which + * case the unmark string is written. + */ + if ((menu->items[item]->selected == 1) || + (((menu->opts & O_ONEVALUE) == O_ONEVALUE) && + (menu->cur_item == item))) { + for (j = 0; j < menu->mark.length; j++) { + waddch(menu->scrwin, + menu->mark.string[j]); + } + /* blank any length difference between mark & unmark */ + for (j = menu->mark.length; j < mark_len; j++) + waddch(menu->scrwin, ' '); + } else { + for (j = 0; j < menu->unmark.length; j++) { + waddch(menu->scrwin, + menu->unmark.string[j]); + } + /* blank any length difference between mark & unmark */ + for (j = menu->unmark.length; j < mark_len; j++) + waddch(menu->scrwin, ' '); + } + + /* add the menu name */ + for (j=0; j < menu->items[item]->name.length; j++) + waddch(menu->scrwin, + menu->items[item]->name.string[j]); + + pad_len = menu->col_width - menu->items[item]->name.length + - mark_len - 1; + if ((menu->opts & O_SHOWDESC) == O_SHOWDESC) { + pad_len -= menu->items[item]->description.length - 1; + for (j = 0; j < pad_len; j++) + waddch(menu->scrwin, menu->pad); + for (j = 0; j < menu->items[item]->description.length; j++) { + waddch(menu->scrwin, + menu->items[item]->description.string[j]); + } + } else { + for (j = 0; j < pad_len; j++) + waddch(menu->scrwin, ' '); + } + menu->items[item]->visible = 1; + + /* kill any special attributes... */ + wattrset(menu->scrwin, menu->back); + + /* + * Fill in the spacing between items, annoying but it looks + * odd if the menu items are inverse because the spacings do not + * have the same attributes as the items. + */ + if ((menu->items[item]->col > 0) && + (menu->items[item]->col < (menu->item_cols - 1))) { + wmove(menu->scrwin, + menu->items[item]->row - menu->top_row, + menu->items[item]->col * (menu->col_width + 1) - 1); + waddch(menu->scrwin, ' '); + } + + /* and position the cursor nicely */ + pos_menu_cursor(menu); +} + +/* + * Draw the menu in the subwindow provided. + */ +int +_menui_draw_menu(MENU *menu) +{ + int rowmajor, i, j, k, row = -1, stride; + int incr, cur_row, offset, row_count; + + rowmajor = ((menu->opts & O_ROWMAJOR) == O_ROWMAJOR); + + if (rowmajor) { + stride = 1; + incr = menu->item_cols; + } else { + stride = menu->item_rows; + incr = 1; + } + row_count = 0; + + for (i = 0; i < menu->item_count; i += incr) { + if (menu->items[i]->row == menu->top_row) + break; + row_count++; + for (j = 0; j < menu->item_cols; j++) { + offset = j * stride + i; + if (offset >= menu->item_count) + break; /* done */ + menu->items[offset]->visible = 0; + } + } + + wmove(menu->scrwin, 0, 0); + + menu->col_width = getmaxx(menu->scrwin) / menu->cols; + + for (cur_row = 0; cur_row < menu->rows; cur_row++) { + for (j = 0; j < menu->cols; j++) { + offset = j * stride + i; + if (offset >= menu->item_count) { + /* no more items to draw, write background blanks */ + wattrset(menu->scrwin, menu->back); + if (row < 0) { + row = menu->items[menu->item_count - 1]->row; + } + + wmove(menu->scrwin, cur_row, + j * (menu->col_width + 1)); + for (k = 0; k < menu->col_width; k++) + waddch(menu->scrwin, ' '); + } else { + _menui_draw_item(menu, offset); + } + } + + i += incr; + row_count++; + } + + if (row_count < menu->item_rows) { + for (cur_row = row_count; cur_row < menu->item_rows; cur_row++) { + for (j = 0; j < menu->item_cols; j++) { + offset = j * stride + i; + if (offset >= menu->item_count) + break; /* done */ + menu->items[offset]->visible = 0; + } + i += incr; + } + } + + return E_OK; +} + + +/* + * Calculate the widest menu item and stash it in the menu struct. + * + */ +void +_menui_max_item_size(MENU *menu) +{ + int i, with_desc, width; + + with_desc = ((menu->opts & O_SHOWDESC) == O_SHOWDESC); + + for (i = 0; i < menu->item_count; i++) { + width = menu->items[i]->name.length + + max(menu->mark.length, menu->unmark.length); + if (with_desc) + width += menu->items[i]->description.length + 1; + + menu->max_item_width = max(menu->max_item_width, width); + } +} + + +/* + * Redraw the menu on the screen. If the current item has changed then + * unhighlight the old item and highlight the new one. + */ +static void +_menui_redraw_menu(MENU *menu, int old_top_row, int old_cur_item) +{ + + if (menu->top_row != old_top_row) { + /* top row changed - redo the whole menu + * XXXX this could be improved if we had wscrl implemented. + + * XXXX we could scroll the window and just fill in the + * XXXX changed lines. + */ + wclear(menu->scrwin); + _menui_draw_menu(menu); + } else { + if (menu->cur_item != old_cur_item) { + /* redo the old item as a normal one. */ + _menui_draw_item(menu, old_cur_item); + } + /* and then redraw the current item */ + _menui_draw_item(menu, menu->cur_item); + } +} diff --git a/vendor/netbsd-curses/libmenu/internals.h b/vendor/netbsd-curses/libmenu/internals.h new file mode 100644 index 0000000..11fbc14 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/internals.h @@ -0,0 +1,53 @@ +/* $NetBSD: internals.h,v 1.8 2001/06/13 10:45:59 wiz Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#ifndef INTERNALS_H +#define INTERNALS_H + +#define MATCH_FORWARD 1 +#define MATCH_REVERSE 2 +#define MATCH_NEXT_FORWARD 3 +#define MATCH_NEXT_REVERSE 4 + +/* stole this from curses.h */ +#define max(a,b) ((a) > (b) ? a : b) + +/* function prototypes */ + +void _menui_draw_item(MENU *menu, int item); +int _menui_draw_menu(MENU *menu); +int _menui_goto_item(MENU *menu, ITEM *item, int new_top_row); +int _menui_match_pattern(MENU *menu, int c, int direction , + int *item_matched); +int _menui_match_items(MENU *menu, int direction, int *item_matched); +void _menui_max_item_size(MENU *menu); +int _menui_stitch_items(MENU *menu); + +#endif diff --git a/vendor/netbsd-curses/libmenu/item.c b/vendor/netbsd-curses/libmenu/item.c new file mode 100644 index 0000000..0cc1541 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item.c @@ -0,0 +1,403 @@ +/* $NetBSD: item.c,v 1.12 2012/03/21 05:33:27 matt Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include +#include +#include +#include "internals.h" + +/* the following is defined in menu.c - it is the default menu struct */ +extern MENU _menui_default_menu; + +/* keep default item options for setting in new_item */ +ITEM _menui_default_item = { + {NULL, 0}, /* item name struct */ + {NULL, 0}, /* item description struct */ + NULL, /* user pointer */ + 0, /* is item visible? */ + 0, /* is item selected? */ + 0, /* row item is on */ + 0, /* column item is on */ + O_SELECTABLE, /* item options */ + NULL, /* parent menu item is bound to */ + -1, /* index number if item attached to a menu */ + NULL, /* left neighbour */ + NULL, /* right neighbour */ + NULL, /* up neighbour */ + NULL /* down neighbour */ +}; + +/* + * Return the item visibility flag + */ +int +item_visible(ITEM *item) +{ + if (item == NULL) + return E_BAD_ARGUMENT; + if (item->parent == NULL) + return E_NOT_CONNECTED; + + return item->visible; +} + +/* + * Return the pointer to the item name + */ +char * +item_name(ITEM *item) +{ + if (item == NULL) + return NULL; + + return item->name.string; +} + +/* + * Return the pointer to the item description + */ +char * +item_description(ITEM *item) +{ + if (item == NULL) + return NULL; + + return item->description.string; +} + +/* + * Set the application defined function called when the menu is posted or + * just after the current item changes. + */ +int +set_item_init(MENU *menu, Menu_Hook func) +{ + if (menu == NULL) + _menui_default_menu.item_init = func; + else + menu->item_init = func; + return E_OK; +} + + +/* + * Return a pointer to the item initialisation routine. + */ +Menu_Hook +item_init(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.item_init; + else + return menu->item_init; +} + +/* + * Set the user defined function to be called when menu is unposted or just + * before the current item changes. + */ +int +set_item_term(MENU *menu, Menu_Hook func) +{ + if (menu == NULL) + _menui_default_menu.item_term = func; + else + menu->item_term = func; + return E_OK; +} + +/* + * Return a pointer to the termination function + */ +Menu_Hook +item_term(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.item_term; + else + return menu->item_term; +} + +/* + * Returns the number of items that are selected. + * The index numbers of the items are placed in the dynamically allocated + * int array *sel. + */ +int +item_selected(MENU *menu, int **sel) +{ + int i, j; + + if (menu == NULL) + return E_BAD_ARGUMENT; + + /* count selected */ + for (i = 0, j = 0; i < menu->item_count; i++) + if (menu->items[i]->selected) + j++; + + if (j == 0) { + *sel = NULL; + return 0; + } + + if ( (*sel = malloc(sizeof(int) * j)) == NULL) + return E_SYSTEM_ERROR; + + for (i = 0, j = 0; i < menu->item_count; i++) + if (menu->items[i]->selected) + (*sel)[j++] = i; + + return j; +} + +/* + * Set the item options. We keep a global copy of the current item options + * as subsequent new_item calls will use the updated options as their + * defaults. + */ +int +set_item_opts(ITEM *item, OPTIONS opts) +{ + /* selectable seems to be the only allowable item opt! */ + if (opts != O_SELECTABLE) + return E_SYSTEM_ERROR; + + if (item == NULL) + _menui_default_item.opts = opts; + else + item->opts = opts; + return E_OK; +} + +/* + * Set item options on. + */ +int +item_opts_on(ITEM *item, OPTIONS opts) +{ + if (opts != O_SELECTABLE) + return E_SYSTEM_ERROR; + + if (item == NULL) + _menui_default_item.opts |= opts; + else + item->opts |= opts; + return E_OK; +} + +/* + * Turn off the named options. + */ +int +item_opts_off(ITEM *item, OPTIONS opts) +{ + if (opts != O_SELECTABLE) + return E_SYSTEM_ERROR; + + if (item == NULL) + _menui_default_item.opts &= ~(opts); + else + item->opts &= ~(opts); + return E_OK; +} + +/* + * Return the current options set in item. + */ +OPTIONS +item_opts(ITEM *item) +{ + if (item == NULL) + return _menui_default_item.opts; + else + return item->opts; +} + +/* + * Set the selected flag of the item iff the menu options allow it. + */ +int +set_item_value(ITEM *param_item, int flag) +{ + ITEM *item = (param_item != NULL) ? param_item : &_menui_default_item; + + /* not bound to a menu */ + if (item->parent == NULL) + return E_NOT_CONNECTED; + + /* menu options do not allow multi-selection */ + if ((item->parent->opts & O_ONEVALUE) == O_ONEVALUE) + return E_REQUEST_DENIED; + + item->selected = flag; + _menui_draw_item(item->parent, item->index); + return E_OK; +} + +/* + * Return the item value of the item. + */ +int +item_value(ITEM *item) +{ + if (item == NULL) + return _menui_default_item.selected; + else + return item->selected; +} + +/* + * Allocate a new item and return the pointer to the newly allocated + * structure. + */ +ITEM * +new_item(char *name, char *description) +{ + ITEM *new_one; + + if (name == NULL) + return NULL; + + /* allocate a new item structure for ourselves */ + if ((new_one = (ITEM *)malloc(sizeof(ITEM))) == NULL) + return NULL; + + /* copy in the defaults for the item */ + (void)memcpy(new_one, &_menui_default_item, sizeof(ITEM)); + + /* fill in the name structure - first the length and then + allocate room for the string & copy that. */ + new_one->name.length = strlen(name); + if ((new_one->name.string = (char *) + malloc(sizeof(char) * new_one->name.length + 1)) == NULL) { + /* uh oh malloc failed - clean up & exit */ + free(new_one); + return NULL; + } + + strcpy(new_one->name.string, name); + + if (description == NULL) + new_one->description.length = 0; + else { + /* fill in the description structure, stash the length then + allocate room for description string and copy it in */ + new_one->description.length = strlen(description); + if ((new_one->description.string = + (char *) malloc(sizeof(char) * + new_one->description.length + 1)) == NULL) { + /* + * malloc has failed + * - free up allocated memory and return + */ + free(new_one->name.string); + free(new_one); + return NULL; + } + + strcpy(new_one->description.string, description); + } + + return new_one; +} + +/* + * Free the allocated storage associated with item. + */ +int +free_item(ITEM *item) +{ + if (item == NULL) + return E_BAD_ARGUMENT; + + /* check for connection to menu */ + if (item->parent != NULL) + return E_CONNECTED; + + /* no connections, so free storage starting with the strings */ + free(item->name.string); + if (item->description.length) + free(item->description.string); + free(item); + return E_OK; +} + +/* + * Set the menu's current item to the one given. + */ +int +set_current_item(MENU *param_menu, ITEM *item) +{ + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + int i = 0; + + /* check if we have been called from an init type function */ + if (menu->in_init == 1) + return E_BAD_STATE; + + /* check we have items in the menu */ + if (menu->items == NULL) + return E_NOT_CONNECTED; + + if ((i = item_index(item)) < 0) + /* item must not be a part of this menu */ + return E_BAD_ARGUMENT; + + menu->cur_item = i; + return E_OK; +} + +/* + * Return a pointer to the current item for the menu + */ +ITEM * +current_item(MENU *menu) +{ + if (menu == NULL) + return NULL; + + if (menu->items == NULL) + return NULL; + + return menu->items[menu->cur_item]; +} + +/* + * Return the index into the item array that matches item. + */ +int +item_index(ITEM *item) +{ + if (item == NULL) + return _menui_default_item.index; + else + return item->index; +} diff --git a/vendor/netbsd-curses/libmenu/item_count.3 b/vendor/netbsd-curses/libmenu/item_count.3 new file mode 120000 index 0000000..03b51d0 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_count.3 @@ -0,0 +1 @@ +menu_items.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_description.3 b/vendor/netbsd-curses/libmenu/item_description.3 new file mode 120000 index 0000000..c331d23 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_description.3 @@ -0,0 +1 @@ +menu_item_name.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_index.3 b/vendor/netbsd-curses/libmenu/item_index.3 new file mode 120000 index 0000000..230876e --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_index.3 @@ -0,0 +1 @@ +menu_item_current.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_init.3 b/vendor/netbsd-curses/libmenu/item_init.3 new file mode 120000 index 0000000..cfc6304 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_init.3 @@ -0,0 +1 @@ +menu_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_name.3 b/vendor/netbsd-curses/libmenu/item_name.3 new file mode 120000 index 0000000..c331d23 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_name.3 @@ -0,0 +1 @@ +menu_item_name.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_opts.3 b/vendor/netbsd-curses/libmenu/item_opts.3 new file mode 120000 index 0000000..cb690af --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_opts.3 @@ -0,0 +1 @@ +menu_item_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_opts_off.3 b/vendor/netbsd-curses/libmenu/item_opts_off.3 new file mode 120000 index 0000000..cb690af --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_opts_off.3 @@ -0,0 +1 @@ +menu_item_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_opts_on.3 b/vendor/netbsd-curses/libmenu/item_opts_on.3 new file mode 120000 index 0000000..cb690af --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_opts_on.3 @@ -0,0 +1 @@ +menu_item_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_selected.3 b/vendor/netbsd-curses/libmenu/item_selected.3 new file mode 120000 index 0000000..1d6719b --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_selected.3 @@ -0,0 +1 @@ +menu_item_value.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_term.3 b/vendor/netbsd-curses/libmenu/item_term.3 new file mode 120000 index 0000000..cfc6304 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_term.3 @@ -0,0 +1 @@ +menu_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_userptr.3 b/vendor/netbsd-curses/libmenu/item_userptr.3 new file mode 120000 index 0000000..867e203 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_userptr.3 @@ -0,0 +1 @@ +menu_item_userptr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_value.3 b/vendor/netbsd-curses/libmenu/item_value.3 new file mode 120000 index 0000000..1d6719b --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_value.3 @@ -0,0 +1 @@ +menu_item_value.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/item_visible.3 b/vendor/netbsd-curses/libmenu/item_visible.3 new file mode 120000 index 0000000..7de44fd --- /dev/null +++ b/vendor/netbsd-curses/libmenu/item_visible.3 @@ -0,0 +1 @@ +menu_item_visible.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu.c b/vendor/netbsd-curses/libmenu/menu.c new file mode 100644 index 0000000..74e1fda --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu.c @@ -0,0 +1,689 @@ +/* $NetBSD: menu.c,v 1.18 2012/12/30 12:27:09 blymn Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include +#include +#include +#include +#include "internals.h" + +MENU _menui_default_menu = { + 16, /* number of item rows that will fit in window */ + 1, /* number of columns of items that will fit in window */ + 0, /* number of rows of items we have */ + 0, /* number of columns of items we have */ + 0, /* current cursor row */ + 0, /* current cursor column */ + {"", 0}, /* mark string */ + {"", 0}, /* unmark string */ + O_ONEVALUE, /* menu options */ + NULL, /* the pattern buffer */ + 0, /* length of pattern buffer */ + 0, /* the length of matched buffer */ + 0, /* is the menu posted? */ + A_REVERSE, /* menu foreground */ + A_NORMAL, /* menu background */ + A_UNDERLINE, /* unselectable menu item */ + ' ', /* filler between name and description */ + NULL, /* user defined pointer */ + 0, /* top row of menu */ + 0, /* widest item in the menu */ + 0, /* the width of a menu column */ + 0, /* number of items attached to the menu */ + NULL, /* items in the menu */ + 0, /* current menu item */ + 0, /* currently in a hook function */ + NULL, /* function called when menu posted */ + NULL, /* function called when menu is unposted */ + NULL, /* function called when current item changes */ + NULL, /* function called when current item changes */ + NULL, /* the menu window */ + NULL, /* the menu subwindow */ + NULL, /* the window to write to */ +}; + + +static int set_markstring(MENU *m, char *mark, int isunmark) { + MENU *menu = m; + + if (m == NULL) menu = &_menui_default_menu; + MARK_STR *s = isunmark ? &menu->unmark : &menu->mark; + int l = snprintf(s->string, sizeof s->string, "%s", mark); + s->length = (l >= sizeof s->string) ? sizeof s->string -1 : l; + + /* max item size may have changed - recalculate. */ + _menui_max_item_size(menu); + return E_OK; +} + + +/* + * Set the menu mark character + */ +int +set_menu_mark(MENU *m, char *mark) +{ + return set_markstring(m, mark, 0); +} + +/* + * Return the menu mark string for the menu. + */ +char * +menu_mark(MENU *menu) +{ + return menu ? menu->mark.string : _menui_default_menu.mark.string; +} + +/* + * Set the menu unmark character + */ +int +set_menu_unmark(MENU *m, char *mark) +{ + return set_markstring(m, mark, 1); +} + +/* + * Return the menu unmark string for the menu. + */ +char * +menu_unmark(MENU *menu) +{ + return menu ? menu->unmark.string : _menui_default_menu.unmark.string; +} + +/* + * Set the menu window to the window passed. + */ +int +set_menu_win(MENU *menu, WINDOW *win) +{ + if (menu == NULL) { + _menui_default_menu.menu_win = win; + _menui_default_menu.scrwin = win; + } else { + if (menu->posted == TRUE) { + return E_POSTED; + } else { + menu->menu_win = win; + menu->scrwin = win; + } + } + + return E_OK; +} + +/* + * Return the pointer to the menu window + */ +WINDOW * +menu_win(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.menu_win; + else + return menu->menu_win; +} + +/* + * Set the menu subwindow for the menu. + */ +int +set_menu_sub(MENU *menu, WINDOW *sub) +{ + if (menu == NULL) { + _menui_default_menu.menu_subwin = sub; + _menui_default_menu.scrwin = sub; + } else { + if (menu->posted == TRUE) + return E_POSTED; + + menu->menu_subwin = sub; + menu->scrwin = sub; + } + + return E_OK; +} + +/* + * Return the subwindow pointer for the menu + */ +WINDOW * +menu_sub(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.menu_subwin; + else + return menu->menu_subwin; +} + +/* + * Set the maximum number of rows and columns of items that may be displayed. + */ +int +set_menu_format(MENU *param_menu, int rows, int cols) +{ + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + + menu->rows = rows; + menu->cols = cols; + + if (menu->items != NULL) + /* recalculate the item neighbours */ + return _menui_stitch_items(menu); + + return E_OK; +} + +/* + * Return the max number of rows and cols that may be displayed. + */ +void +menu_format(MENU *param_menu, int *rows, int *cols) +{ + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + + *rows = menu->rows; + *cols = menu->cols; +} + +/* + * Set the user defined function to call when a menu is posted. + */ +int +set_menu_init(MENU *menu, Menu_Hook func) +{ + if (menu == NULL) + _menui_default_menu.menu_init = func; + else + menu->menu_init = func; + return E_OK; +} + +/* + * Return the pointer to the menu init function. + */ +Menu_Hook +menu_init(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.menu_init; + else + return menu->menu_init; +} + +/* + * Set the user defined function called when a menu is unposted. + */ +int +set_menu_term(MENU *menu, Menu_Hook func) +{ + if (menu == NULL) + _menui_default_menu.menu_term = func; + else + menu->menu_term = func; + return E_OK; +} + +/* + * Return the user defined menu termination function pointer. + */ +Menu_Hook +menu_term(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.menu_term; + else + return menu->menu_term; +} + +/* + * Return the current menu options set. + */ +OPTIONS +menu_opts(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.opts; + else + return menu->opts; +} + +/* + * Set the menu options to the given options. + */ +int +set_menu_opts(MENU *param_menu, OPTIONS opts) +{ + int i, seen; + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + OPTIONS old_opts = menu->opts; + + menu->opts = opts; + + /* + * If the radio option is selected then make sure only one + * item is actually selected in the items. + */ + if (((opts & O_RADIO) == O_RADIO) && (menu->items != NULL) && + (menu->items[0] != NULL)) { + seen = 0; + for (i = 0; i < menu->item_count; i++) { + if (menu->items[i]->selected == 1) { + if (seen == 0) { + seen = 1; + } else { + menu->items[i]->selected = 0; + } + } + } + + /* if none selected, select the first item */ + if (seen == 0) + menu->items[0]->selected = 1; + } + + if ((menu->opts & O_ROWMAJOR) != (old_opts & O_ROWMAJOR)) + /* changed menu layout - need to recalc neighbours */ + _menui_stitch_items(menu); + + return E_OK; +} + +/* + * Turn on the options in menu given by opts. + */ +int +menu_opts_on(MENU *param_menu, OPTIONS opts) +{ + int i, seen; + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + OPTIONS old_opts = menu->opts; + + menu->opts |= opts; + + /* + * If the radio option is selected then make sure only one + * item is actually selected in the items. + */ + if (((opts & O_RADIO) == O_RADIO) && (menu->items != NULL) && + (menu->items[0] != NULL)) { + seen = 0; + for (i = 0; i < menu->item_count; i++) { + if (menu->items[i]->selected == 1) { + if (seen == 0) { + seen = 1; + } else { + menu->items[i]->selected = 0; + } + } + } + /* if none selected then select the top item */ + if (seen == 0) + menu->items[0]->selected = 1; + } + + if ((menu->items != NULL) && + (menu->opts & O_ROWMAJOR) != (old_opts & O_ROWMAJOR)) + /* changed menu layout - need to recalc neighbours */ + _menui_stitch_items(menu); + + return E_OK; +} + +/* + * Turn off the menu options given in opts. + */ +int +menu_opts_off(MENU *param_menu, OPTIONS opts) +{ + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + OPTIONS old_opts = menu->opts; + + menu->opts &= ~(opts); + + if ((menu->items != NULL ) && + (menu->opts & O_ROWMAJOR) != (old_opts & O_ROWMAJOR)) + /* changed menu layout - need to recalc neighbours */ + _menui_stitch_items(menu); + + return E_OK; +} + +/* + * Return the menu pattern buffer. + */ +char * +menu_pattern(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.pattern; + else + return menu->pattern; +} + +/* + * Set the menu pattern buffer to pat and attempt to match the pattern in + * the item list. + */ +int +set_menu_pattern(MENU *param_menu, char *pat) +{ + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + char *p = pat; + + /* check pattern is all printable characters */ + while (*p) + if (!isprint((unsigned char) *p++)) return E_BAD_ARGUMENT; + + if ((menu->pattern = (char *) realloc(menu->pattern, + sizeof(char) * strlen(pat) + 1)) == NULL) + return E_SYSTEM_ERROR; + + strcpy(menu->pattern, pat); + menu->plen = strlen(pat); + + /* search item list for pat here */ + return _menui_match_items(menu, MATCH_FORWARD, &menu->cur_item); +} + +/* + * Allocate a new menu structure and fill it in. + */ +MENU * +new_menu(ITEM **items) +{ + MENU *the_menu; + + if (!(the_menu = malloc(sizeof(MENU)))) return NULL; + + /* copy the defaults */ + (void)memcpy(the_menu, &_menui_default_menu, sizeof(MENU)); + + /* set a default window if none already set. */ + if (the_menu->menu_win == NULL) + the_menu->scrwin = stdscr; + + /* default mark needs to be set, the default unmark string is + already covered by the above memcpy(). */ + set_markstring(the_menu, "-", 0); + + /* now attach the items, if any */ + if (items != NULL) { + if(set_menu_items(the_menu, items) < 0) { + free(the_menu); + return NULL; + } + } + + return the_menu; +} + +/* + * Free up storage allocated to the menu object and destroy it. + */ +int +free_menu(MENU *menu) +{ + int i; + + if (menu == NULL) + return E_BAD_ARGUMENT; + + if (menu->posted != 0) + return E_POSTED; + + if (menu->pattern != NULL) + free(menu->pattern); + + if (menu->items != NULL) { + /* disconnect the items from this menu */ + for (i = 0; i < menu->item_count; i++) { + menu->items[i]->parent = NULL; + } + } + + free(menu); + return E_OK; +} + +/* + * Calculate the minimum window size for the menu. + */ +int +scale_menu(MENU *param_menu, int *rows, int *cols) +{ + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + + if (menu->items == NULL) + return E_BAD_ARGUMENT; + + /* calculate the max item size */ + _menui_max_item_size(menu); + + *rows = menu->rows; + *cols = menu->cols * menu->max_item_width; + + /* + * allow for spacing between columns... + */ + *cols += (menu->cols - 1); + + return E_OK; +} + +/* + * Set the menu item list to the one given. + */ +int +set_menu_items(MENU *param_menu, ITEM **items) +{ + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + int i, new_count = 0, sel_count = 0; + + /* don't change if menu is posted */ + if (menu->posted == 1) + return E_POSTED; + + /* count the new items and validate none are connected already */ + while (items[new_count] != NULL) { + if ((items[new_count]->parent != NULL) && + (items[new_count]->parent != menu)) + return E_CONNECTED; + if (items[new_count]->selected == 1) + sel_count++; + new_count++; + } + + /* + * don't allow multiple selected items if menu is radio + * button style. + */ + if (((menu->opts & O_RADIO) == O_RADIO) && + (sel_count > 1)) + return E_BAD_ARGUMENT; + + /* if there were items connected then disconnect them. */ + if (menu->items != NULL) { + for (i = 0; i < menu->item_count; i++) { + menu->items[i]->parent = NULL; + menu->items[i]->index = -1; + } + } + + menu->item_count = new_count; + + /* connect the new items to the menu */ + for (i = 0; i < new_count; i++) { + items[i]->parent = menu; + items[i]->index = i; + } + + menu->items = items; + menu->cur_item = 0; /* reset current item just in case */ + menu->top_row = 0; /* and the top row too */ + if (menu->pattern != NULL) { /* and the pattern buffer....sigh */ + free(menu->pattern); + menu->plen = 0; + menu->match_len = 0; + } + + /* + * make sure at least one item is selected on a radio + * button style menu. + */ + if (((menu->opts & O_RADIO) == O_RADIO) && (sel_count == 0)) + menu->items[0]->selected = 1; + + + _menui_stitch_items(menu); /* recalculate the item neighbours */ + + return E_OK; +} + +/* + * Return the pointer to the menu items array. + */ +ITEM ** +menu_items(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.items; + else + return menu->items; +} + +/* + * Return the count of items connected to the menu + */ +int +item_count(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.item_count; + else + return menu->item_count; +} + +/* + * Set the menu top row to be the given row. The current item becomes the + * leftmost item on that row in the menu. + */ +int +set_top_row(MENU *param_menu, int row) +{ + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + int i, cur_item, state = E_SYSTEM_ERROR; + + if (row > menu->item_rows) + return E_BAD_ARGUMENT; + + if (menu->items == NULL) + return E_NOT_CONNECTED; + + if (menu->in_init == 1) + return E_BAD_STATE; + + cur_item = 0; + + for (i = 0; i < menu->item_count; i++) { + /* search for first item that matches row - this will be + the current item. */ + if (row == menu->items[i]->row) { + cur_item = i; + state = E_OK; + break; /* found what we want - no need to go further */ + } + } + + menu->in_init = 1; /* just in case we call the init/term routines */ + + if (menu->posted == 1) { + if (menu->menu_term != NULL) + menu->menu_term(menu); + if (menu->item_term != NULL) + menu->item_term(menu); + } + + menu->cur_item = cur_item; + menu->top_row = row; + + if (menu->posted == 1) { + if (menu->menu_init != NULL) + menu->menu_init(menu); + if (menu->item_init != NULL) + menu->item_init(menu); + } + + menu->in_init = 0; + + /* this should always be E_OK unless we are really screwed up */ + return state; +} + +/* + * Return the current top row number. + */ +int +top_row(MENU *param_menu) +{ + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + + if (menu->items == NULL) + return E_NOT_CONNECTED; + + return menu->top_row; +} + +/* + * Position the cursor at the correct place in the menu. + * + */ +int +pos_menu_cursor(MENU *menu) +{ + int movx, maxmark; + + if (menu == NULL) + return E_BAD_ARGUMENT; + + maxmark = max(menu->mark.length, menu->unmark.length); + movx = maxmark + (menu->items[menu->cur_item]->col + * (menu->col_width + 1)); + + if (menu->match_len > 0) + movx += menu->match_len - 1; + + wmove(menu->scrwin, + menu->items[menu->cur_item]->row - menu->top_row, movx); + + return E_OK; +} diff --git a/vendor/netbsd-curses/libmenu/menu.h b/vendor/netbsd-curses/libmenu/menu.h new file mode 100644 index 0000000..b5ca2e1 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu.h @@ -0,0 +1,225 @@ +/* $NetBSD: menu.h,v 1.13 2004/03/22 19:01:09 jdc Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#ifndef _MENU_H_ +#define _MENU_H_ + +#include +#include + +#define MENU_NOOP_SPACING +#ifdef MENU_NOOP_SPACING +#define set_menu_spacing(a,b,c,d) (E_BAD_ARGUMENT) +#define menu_spacing(a,b,c,d) (E_BAD_ARGUMENT) +#endif + +/* requests for the menu_driver call */ +#define REQ_BASE_NUM (KEY_MAX + 0x200) +#define REQ_LEFT_ITEM (KEY_MAX + 0x201) +#define REQ_RIGHT_ITEM (KEY_MAX + 0x202) +#define REQ_UP_ITEM (KEY_MAX + 0x203) +#define REQ_DOWN_ITEM (KEY_MAX + 0x204) +#define REQ_SCR_ULINE (KEY_MAX + 0x205) +#define REQ_SCR_DLINE (KEY_MAX + 0x206) +#define REQ_SCR_DPAGE (KEY_MAX + 0x207) +#define REQ_SCR_UPAGE (KEY_MAX + 0x208) +#define REQ_FIRST_ITEM (KEY_MAX + 0x209) +#define REQ_LAST_ITEM (KEY_MAX + 0x20a) +#define REQ_NEXT_ITEM (KEY_MAX + 0x20b) +#define REQ_PREV_ITEM (KEY_MAX + 0x20c) +#define REQ_TOGGLE_ITEM (KEY_MAX + 0x20d) +#define REQ_CLEAR_PATTERN (KEY_MAX + 0x20e) +#define REQ_BACK_PATTERN (KEY_MAX + 0x20f) +#define REQ_NEXT_MATCH (KEY_MAX + 0x210) +#define REQ_PREV_MATCH (KEY_MAX + 0x211) + +#define MAX_COMMAND (KEY_MAX + 0x211) /* last menu driver request + - for application defined + commands */ + +/* Menu options */ +typedef unsigned int OPTIONS; + +/* and the values they can have */ +#define O_ONEVALUE (0x1) +#define O_SHOWDESC (0x2) +#define O_ROWMAJOR (0x4) +#define O_IGNORECASE (0x8) +#define O_SHOWMATCH (0x10) +#define O_NONCYCLIC (0x20) +#define O_SELECTABLE (0x40) +#define O_RADIO (0x80) + +typedef struct __menu_str { + char *string; + int length; +} MENU_STR; + +typedef struct __mark_str { + char string[15]; + unsigned char length; +} MARK_STR; + +typedef struct __menu MENU; +typedef struct __item ITEM; + +typedef void (*Menu_Hook) (MENU *); + +struct __item { + MENU_STR name; + MENU_STR description; + void *userptr; + int visible; /* set if item is visible */ + int selected; /* set if item has been selected */ + int row; /* menu row this item is on */ + int col; /* menu column this item is on */ + OPTIONS opts; + MENU *parent; /* menu this item is bound to */ + int index; /* index number for this item, if attached */ + /* The following are the item's neighbours - makes menu + navigation easier */ + ITEM *left; + ITEM *right; + ITEM *up; + ITEM *down; +}; + +struct __menu { + int rows; /* max number of rows to be displayed */ + int cols; /* max number of columns to be displayed */ + int item_rows; /* number of item rows we have */ + int item_cols; /* number of item columns we have */ + int cur_row; /* current cursor row */ + int cur_col; /* current cursor column */ + MARK_STR mark; /* menu mark string */ + MARK_STR unmark; /* menu unmark string */ + OPTIONS opts; /* options for the menu */ + char *pattern; /* the pattern buffer */ + int plen; /* pattern buffer length */ + int match_len; /* length of pattern matched */ + int posted; /* set if menu is posted */ + attr_t fore; /* menu foreground */ + attr_t back; /* menu background */ + attr_t grey; /* greyed out (nonselectable) menu item */ + int pad; /* filler char between name and description */ + void *userptr; + int top_row; /* the row that is at the top of the menu */ + int max_item_width; /* widest item */ + int col_width; /* width of the menu columns - this is not always + the same as the widest item */ + int item_count; /* number of items attached */ + ITEM **items; /* items associated with this menu */ + int cur_item; /* item cursor is currently positioned at */ + int in_init; /* set when processing an init or term function call */ + Menu_Hook menu_init; /* call this when menu is posted */ + Menu_Hook menu_term; /* call this when menu is unposted */ + Menu_Hook item_init; /* call this when menu posted & after + current item changes */ + Menu_Hook item_term; /* call this when menu unposted & just + before current item changes */ + WINDOW *menu_win; /* the menu window */ + WINDOW *menu_subwin; /* the menu subwindow */ + WINDOW *scrwin; /* the window to write to */ +}; + + +/* Public function prototypes. */ +#ifdef __cplusplus +extern "C" { +#endif +int menu_driver(MENU *, int); +int scale_menu(MENU *, int *, int *); +int set_top_row(MENU *, int); +int pos_menu_cursor(MENU *); +int top_row(MENU *); + +int free_menu(MENU *); +char menu_back(MENU *); +char menu_fore(MENU *); +void menu_format(MENU *, int *, int *); +char menu_grey(MENU *); +Menu_Hook menu_init(MENU *); +char *menu_mark(MENU *); +OPTIONS menu_opts(MENU *); +int menu_opts_off(MENU *, OPTIONS); +int menu_opts_on(MENU *, OPTIONS); +int menu_pad(MENU *); +char *menu_pattern(MENU *); +WINDOW *menu_sub(MENU *); +Menu_Hook menu_term(MENU *); +char *menu_unmark (MENU *); +void *menu_userptr(MENU *); +WINDOW *menu_win(MENU *); +MENU *new_menu(ITEM **); +int post_menu(MENU *); +int set_menu_back(MENU *, attr_t); +int set_menu_fore(MENU *, attr_t); +int set_menu_format(MENU *, int, int); +int set_menu_grey(MENU *, attr_t); +int set_menu_init(MENU *, Menu_Hook); +int set_menu_items(MENU *, ITEM **); +int set_menu_mark(MENU *, char *); +int set_menu_opts(MENU *, OPTIONS); +int set_menu_pad(MENU *, int); +int set_menu_pattern(MENU *, char *); +int set_menu_sub(MENU *, WINDOW *); +int set_menu_term(MENU *, Menu_Hook); +int set_menu_unmark(MENU *, char *); +int set_menu_userptr(MENU *, void *); +int set_menu_win(MENU *, WINDOW *); +int unpost_menu(MENU *); + +ITEM *current_item(MENU *); +int free_item(ITEM *); +int item_count(MENU *); +char *item_description(ITEM *); +int item_index(ITEM *); +Menu_Hook item_init(MENU *); +char *item_name(ITEM *); +OPTIONS item_opts(ITEM *); +int item_opts_off(ITEM *, OPTIONS); +int item_opts_on(ITEM *, OPTIONS); +int item_selected(MENU *, int **); /* return the item index of selected */ +Menu_Hook item_term(MENU *); +void *item_userptr(ITEM *); +int item_value(ITEM *); +int item_visible(ITEM *); +ITEM **menu_items(MENU *); +ITEM *new_item(char *, char *); +int set_current_item(MENU *, ITEM *); +int set_item_init(MENU *, Menu_Hook); +int set_item_opts(ITEM *, OPTIONS); +int set_item_term(MENU *, Menu_Hook); +int set_item_userptr(ITEM *, void *); +int set_item_value(ITEM *, int); + +#ifdef __cplusplus +} +#endif + +#endif /* !_MENU_H_ */ diff --git a/vendor/netbsd-curses/libmenu/menu_attributes.3 b/vendor/netbsd-curses/libmenu/menu_attributes.3 new file mode 100644 index 0000000..c00cd59 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_attributes.3 @@ -0,0 +1,135 @@ +.\" $NetBSD: menu_attributes.3,v 1.11 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_ATTRIBUTES 3 +.Os +.Sh NAME +.Nm menu_back , +.Nm menu_fore , +.Nm menu_grey , +.Nm menu_pad , +.Nm set_menu_back , +.Nm set_menu_fore , +.Nm set_menu_grey , +.Nm set_menu_pad +.Nd get and set menu attributes +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft char +.Fn menu_back "MENU *menu" +.Ft char +.Fn menu_fore "MENU *menu" +.Ft char +.Fn menu_grey "MENU *menu" +.Ft int +.Fn menu_pad "MENU *menu" +.Ft int +.Fn set_menu_back "MENU *menu" "char attr" +.Ft int +.Fn set_menu_fore "MENU *menu" "char attr" +.Ft int +.Fn set_menu_grey "MENU *menu" "char attr" +.Ft int +.Fn set_menu_pad "MENU *menu" "int pad" +.Sh DESCRIPTION +The +.Fn menu_back +function returns the value of the background attribute for the menu +passed. +This attribute is set by the +.Fn set_menu_back +call. +The +.Fn menu_fore +function returns the value of the foreground character attribute for +the menu passed. +This attribute is set by the +.Fn set_menu_fore +function. +The +.Fn menu_grey +function returns the value of the grey or unselectable character +attribute for the menu passed. +This attribute is set by the +.Fn set_menu_grey +function. +The +.Fn menu_pad +function returns the padding character that will be used between the +item name and its description. +The value of the pad character is set by the +.Fn set_menu_pad +function. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_POSTED +The menu is already posted. +.It Er E_CONNECTED +An item was already connected to a menu. +.It Er E_BAD_STATE +The function was called from within an initialization or termination +routine. +.It Er E_NO_ROOM +The menu does not fit within the subwindow. +.It Er E_NOT_POSTED +The menu is not posted. +.It Er E_UNKNOWN_COMMAND +The menu driver does not recognize the request passed to it. +.It Er E_NO_MATCH +The character search failed to find a match. +.It Er E_NOT_SELECTABLE +The item could not be selected. +.It Er E_NOT_CONNECTED +The item is not connected to a menu. +.It Er E_REQUEST_DENIED +The menu driver could not process the request. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_back.3 b/vendor/netbsd-curses/libmenu/menu_back.3 new file mode 120000 index 0000000..924e6ff --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_back.3 @@ -0,0 +1 @@ +menu_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu_cursor.3 b/vendor/netbsd-curses/libmenu/menu_cursor.3 new file mode 100644 index 0000000..ddc380f --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_cursor.3 @@ -0,0 +1,91 @@ +.\" $NetBSD: menu_cursor.3,v 1.10 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_CURSOR 3 +.Os +.Sh NAME +.Nm pos_menu_cursor +.Nd position cursor in menu window +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft int +.Fn pos_menu_cursor "MENU *menu" +.Sh DESCRIPTION +The +.Fn pos_menu_cursor +function positions the cursor in the menu window. +This function can be called after other curses calls to restore the cursor +to its correct position in the menu. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_POSTED +The menu is already posted. +.It Er E_CONNECTED +An item was already connected to a menu. +.It Er E_BAD_STATE +The function was called from within an initialization or termination +routine. +.It Er E_NO_ROOM +The menu does not fit within the subwindow. +.It Er E_NOT_POSTED +The menu is not posted. +.It Er E_UNKNOWN_COMMAND +The menu driver does not recognize the request passed to it. +.It Er E_NO_MATCH +The character search failed to find a match. +.It Er E_NOT_SELECTABLE +The item could not be selected. +.It Er E_NOT_CONNECTED +The item is not connected to a menu. +.It Er E_REQUEST_DENIED +The menu driver could not process the request. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_driver.3 b/vendor/netbsd-curses/libmenu/menu_driver.3 new file mode 100644 index 0000000..ae02fcf --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_driver.3 @@ -0,0 +1,136 @@ +.\" $NetBSD: menu_driver.3,v 1.9 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_DRIVER 3 +.Os +.Sh NAME +.Nm menu_driver +.Nd main menu handling function +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft int +.Fn menu_driver "MENU *menu" "int c" +.Sh DESCRIPTION +The +.Fn menu_driver +function is the guts of the menu system. +It takes the commands passed +by c parameter and performs the requested action on the menu given. +The following commands may be given to the menu driver: +.Pp +.Bl -tag -width REQ_CLEAR_PATTERN -compact +.It Command +Action +.It REQ_LEFT_ITEM +Sets the new current item to be the item to the left of the current +item. +.It REQ_RIGHT_ITEM +Sets the new current item to be the item to the rights of the current +item. +.It REQ_UP_ITEM +Sets the new current item to be the item above the current item. +.It REQ_DOWN_ITEM +Sets the new current item to be the item below the current item. +.It REQ_SCR_ULINE +Scroll the menu one line towards the bottom of the menu window. +The new current item becomes the item immediately above the current item. +.It REQ_SCR_DLINE +Scroll the menu one line towards the top of the menu window. +The new current item becomes the item immediately below the current item. +.It REQ_SCR_DPAGE +Scroll the menu one page towards the bottom of the menu window. +.It REQ_SCR_UPAGE +Scroll the menu one page towards the top of the menu window. +.It REQ_FIRST_ITEM +Set the current item to be the first item in the menu. +.It REQ_LAST_ITEM +Set the current item to be the last item in the menu. +.It REQ_NEXT_ITEM +Set the new current item to be the next item in the item array after +the current item. +.It REQ_PREV_ITEM +Set the new current item to be the item before the current item in the +items array. +.It REQ_TOGGLE_ITEM +If the item is selectable then toggle the item's value. +.It REQ_CLEAR_PATTERN +Clear all the characters currently in the menu's pattern buffer. +.It REQ_BACK_PATTERN +Remove the last character from the pattern buffer. +.It REQ_NEXT_MATCH +Attempt to find the next item that matches the pattern buffer. +.It REQ_PREV_MATCH +Attempt to find the previous item that matches the pattern buffer. +.El +If +.Fn menu_driver +is passed a command that is greater than MAX_COMMAND then the command +passed is assumed to be a user defined command and +.Fn menu_driver +returns E_UNKNOWN_COMMAND. +Otherwise if the command is a printable +character then the character represented by the command is placed at +the end of the pattern buffer and an attempt is made to match the +pattern buffer against the items in the menu. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_NOT_POSTED +The menu is not posted. +.It Er E_UNKNOWN_COMMAND +The menu driver does not recognize the request passed to it. +.It Er E_NO_MATCH +The character search failed to find a match. +.It Er E_NOT_CONNECTED +The item is not connected to a menu. +.It Er E_REQUEST_DENIED +The menu driver could not process the request. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_fore.3 b/vendor/netbsd-curses/libmenu/menu_fore.3 new file mode 120000 index 0000000..924e6ff --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_fore.3 @@ -0,0 +1 @@ +menu_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu_format.3 b/vendor/netbsd-curses/libmenu/menu_format.3 new file mode 100644 index 0000000..e5556b5 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_format.3 @@ -0,0 +1,77 @@ +.\" $NetBSD: menu_format.3,v 1.10 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_FORMAT 3 +.Os +.Sh NAME +.Nm menu_format , +.Nm set_menu_format +.Nd get or set number of rows and columns of items +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft void +.Fn menu_format "MENU *menu" "int *rows" "int *cols" +.Ft int +.Fn set_menu_format "MENU *menu" "int rows" "int cols" +.Sh DESCRIPTION +The +.Fn menu_format +returns the number of rows and columns of items that can be displayed +by the menu. +The format is set by the +.Fn set_menu_format +function call. +Note that the rows and columns defined here are not the size of the +window but rather the number of rows and columns of items. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_BAD_ARGUMENT -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_POSTED +The menu is already posted. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_grey.3 b/vendor/netbsd-curses/libmenu/menu_grey.3 new file mode 120000 index 0000000..924e6ff --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_grey.3 @@ -0,0 +1 @@ +menu_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu_hook.3 b/vendor/netbsd-curses/libmenu/menu_hook.3 new file mode 100644 index 0000000..f979c94 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_hook.3 @@ -0,0 +1,103 @@ +.\" $NetBSD: menu_hook.3,v 1.9 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_HOOK 3 +.Os +.Sh NAME +.Nm item_init , +.Nm item_term , +.Nm menu_init , +.Nm menu_term , +.Nm set_item_init , +.Nm set_item_term , +.Nm set_menu_init , +.Nm set_menu_term +.Nd get or set handler functions for menu post/unpost or item change +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft void (*hook)() +.Fn item_init "MENU *menu" +.Ft void (*hook)() +.Fn item_term "MENU *menu" +.Ft void (*hook)() +.Fn menu_init "MENU *menu" +.Ft void (*hook)() +.Fn menu_term "MENU *menu" +.Ft int +.Fn set_item_init "MENU *menu" "void (*hook)())" +.Ft int +.Fn set_item_term "MENU *menu" "void (*hook)())" +.Ft int +.Fn set_menu_init "MENU *menu" "void (*hook)())" +.Ft int +.Fn set_menu_term "MENU *menu" "void (*hook)())" +.Sh DESCRIPTION +The +.Fn item_init +function returns a pointer to the function that will be called +whenever the menu is posted and also just after the current item +changes. +This is set by the +.Fn set_item_init +call. +The +.Fn item_term +function returns a pointer to the function that will be called before +the menu is unposted and just before the current item changes, this +pointer is set by the +.Fn set_item_term +call. +The +.Fn menu_init +functions returns a pointer to the function that will be called just +before the menu is posted to the screen. +This pointer is set by the +.Fn set_menu_init +function call. +The +.Fn menu_term +function returns a pointer to the function that will be called just +after the menu has been unposted, this pointer is set by the +.Fn set_menu_term +function. +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_init.3 b/vendor/netbsd-curses/libmenu/menu_init.3 new file mode 120000 index 0000000..cfc6304 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_init.3 @@ -0,0 +1 @@ +menu_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu_item_current.3 b/vendor/netbsd-curses/libmenu/menu_item_current.3 new file mode 100644 index 0000000..98a6e73 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_item_current.3 @@ -0,0 +1,101 @@ +.\" $NetBSD: menu_item_current.3,v 1.10 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_ITEM_CURRENT 3 +.Os +.Sh NAME +.Nm current_item , +.Nm item_index , +.Nm set_current_item , +.Nm set_top_row +.Nm top_row +.Nd get or set item pointers or top row +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft ITEM * +.Fn current_item "MENU *menu" +.Ft int +.Fn item_index "ITEM *item" +.Ft int +.Fn set_current_item "MENU *menu" "ITEM *item" +.Ft int +.Fn set_top_row "MENU *menu" "int row" +.Ft int +.Fn top_row "MENU *menu" +.Sh DESCRIPTION +The +.Fn current_item +returns a pointer to the current menu item. +The +.Fn set_current_item +can be used to set this to the item give. +The +.Fn item_index +function returns the index number in the array of items for the item +pointed to by the +.Fa item +parameter. +The +.Fn set_top_row +function sets the top row of the menu displayed to be the row given. +The current item becomes the leftmost item of the top row. +The +.Fn top_row +call returns the row number that is currently at the top of the +displayed menu. +.Sh RETURN VALUES +.Fn current_item +returns NULL if no items are attached to the menu. +.Pp +.Bl -tag -width E_NOT_CONNECTED -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_BAD_STATE +The function was called from within an initialization or termination +routine. +.It Er E_NOT_CONNECTED +The item is not connected to a menu. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_item_name.3 b/vendor/netbsd-curses/libmenu/menu_item_name.3 new file mode 100644 index 0000000..69dcf0d --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_item_name.3 @@ -0,0 +1,71 @@ +.\" $NetBSD: menu_item_name.3,v 1.10 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_ITEM_NAME 3 +.Os +.Sh NAME +.Nm item_description , +.Nm item_name +.Nd get item name or description +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft char * +.Fn item_description "ITEM *item" +.Ft char * +.Fn item_name "ITEM *item" +.Sh DESCRIPTION +The +.Fn item_description +.Fa menu +function returns the description string associated with the passed +item. +The +.Fn item_name +function returns the name string associated with the passed item. +.Sh RETURN VALUES +The function +.Fn item_description +and +.Fn item_name +functions return NULL if the item pointer is not valid. +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_item_new.3 b/vendor/netbsd-curses/libmenu/menu_item_new.3 new file mode 100644 index 0000000..8365318 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_item_new.3 @@ -0,0 +1,79 @@ +.\" $NetBSD: menu_item_new.3,v 1.9 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_ITEM_NEW 3 +.Os +.Sh NAME +.Nm free_item , +.Nm new_item +.Nd create or delete menu item +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft int +.Fn free_item "ITEM *item" +.Ft ITEM * +.Fn new_item "char *name" "char *description" +.Sh DESCRIPTION +The +.Fn free_item +function destroys the item and frees all allocated storage for that +item. +The +.Fn new_item +allocates storage for a new item then copies in the item name and +description for the new item. +A pointer to the newly created item is returned to the caller. +.Sh RETURN VALUES +The +.Fn new_item +function returns NULL on failure, the +.Fn free_item +returns one of the following error values: +.Pp +.Bl -tag -width E_BAD_ARGUMENT -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_item_opts.3 b/vendor/netbsd-curses/libmenu/menu_item_opts.3 new file mode 100644 index 0000000..53fbe34 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_item_opts.3 @@ -0,0 +1,82 @@ +.\" $NetBSD: menu_item_opts.3,v 1.9 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_ITEM_OPTS 3 +.Os +.Sh NAME +.Nm item_opts , +.Nm item_opts_off , +.Nm item_opts_on +.Nd get or modify options for an item +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft OPTIONS +.Fn item_opts "ITEM *item" +.Ft int +.Fn item_opts_off "ITEM *item" "OPTIONS opts" +.Ft int +.Fn item_opts_on "ITEM *item" "OPTIONS opts" +.Sh DESCRIPTION +The +.Fn item_opts +function returns the options currently set for the given item. +The +.Fn item_opts_off +function turns off the options passed in +.Fa opts +for the item passed. +The +.Fn item_opts_on +function turns on the options passed in +.Fa opts +for the item given. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_SYSTEM_ERROR -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_item_userptr.3 b/vendor/netbsd-curses/libmenu/menu_item_userptr.3 new file mode 100644 index 0000000..78c7060 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_item_userptr.3 @@ -0,0 +1,72 @@ +.\" $NetBSD: menu_item_userptr.3,v 1.8 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_ITEM_USERPTR 3 +.Os +.Sh NAME +.Nm item_userptr , +.Nm set_item_userptr +.Nd get or set user pointer for an item +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft void * +.Fn item_userptr "ITEM *item" +.Ft int +.Fn set_item_userptr "ITEM *item" "void *userptr" +.Sh DESCRIPTION +The +.Fn item_userptr +function returns the value of the user defined pointer for the given +item, this pointer is defined by the +.Fn set_item_userptr +function. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_SYSTEM_ERROR -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_item_value.3 b/vendor/netbsd-curses/libmenu/menu_item_value.3 new file mode 100644 index 0000000..8f513cb --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_item_value.3 @@ -0,0 +1,106 @@ +.\" $NetBSD: menu_item_value.3,v 1.12 2017/07/03 21:32:50 wiz Exp $ .\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_ITEM_VALUE 3 +.Os +.Sh NAME +.Nm item_value , +.Nm set_item_value , +.Nm item_selected +.Nd get or set value for an item +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft int +.Fn item_value "ITEM *item" +.Ft int +.Fn set_item_value "ITEM *item" "int flag" +.Ft int +.Fn item_selected "MENU *menu" "int **array" +.Sh DESCRIPTION +The +.Fn item_value +function returns value of the item. +If the item has been selected then this value will be TRUE. +The value can also be set by calling +.Fn set_item_value +to set the value to a defined state. +Setting the value to a value +other than TRUE or FALSE will have undefined results. +The +.Fn item_selected +function returns the number of items that are selected in the menu, that +is the number of items whose value is TRUE. +The indexes of the selected +items will be returned in +.Fa array +which will be dynamically allocated to hold the number of indexes. +It is the responsibility of the caller to release this storage by calling +.Xr free 3 +when the storage is no longer required. +If there are no elements selected in the items array then +.Fn item_selected +will return 0 and +.Fa array +will be NULL. +If an error occurs +.Fn item_selected +will return one of the below return values which are less than 0. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_REQUEST_DENIED -compact +.It Er E_OK +The function was successful. +.It Er E_NOT_CONNECTED +The item is not connected to a menu. +.It Er E_REQUEST_DENIED +The menu driver could not process the request. +.It Er E_SYSTEM_ERROR +A system error occurred whilst processing the request. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . +.Pp +The function +.Fn item_selected +is a +.Nx +extension and must not be used in portable code. diff --git a/vendor/netbsd-curses/libmenu/menu_item_visible.3 b/vendor/netbsd-curses/libmenu/menu_item_visible.3 new file mode 100644 index 0000000..490fe92 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_item_visible.3 @@ -0,0 +1,67 @@ +.\" $NetBSD: menu_item_visible.3,v 1.8 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_ITEM_VISIBLE 3 +.Os +.Sh NAME +.Nm item_visible +.Nd get visibility status of an item +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft int +.Fn item_visible "ITEM *item" +.Sh DESCRIPTION +The +.Fn item_visible +function returns TRUE if the item passed is currently visible in a +menu. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_NOT_CONNECTED -compact +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_NOT_CONNECTED +The item is not connected to a menu. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_items.3 b/vendor/netbsd-curses/libmenu/menu_items.3 new file mode 100644 index 0000000..c567e63 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_items.3 @@ -0,0 +1,90 @@ +.\" $NetBSD: menu_items.3,v 1.11 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_ITEMS 3 +.Os +.Sh NAME +.Nm item_count , +.Nm menu_items , +.Nm set_menu_items +.Nd attach items to menus or check correspondences +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft int +.Fn item_count "MENU *menu" +.Ft ITEM ** +.Fn menu_items "MENU *menu" +.Ft int +.Fn set_menu_items "MENU *menu" "ITEM **items" +.Sh DESCRIPTION +The +.Fn item_count +.Fa menu +function returns the number of items currently attached to the menu +passed. +The +.Fn menu_items +function returns a pointer to an array of item pointers that represent +the menu items currently attached to the given menu. +Apart from using +.Fn new_menu +(see +.Xr menu_new 3 ) +menu items may be attached to a menu by calling +.Fn set_menu_items +any items currently attached to the menu will be detached and the NULL +terminated array of new items will be attached to the menu. +.Sh RETURN VALUES +Any function returning a string pointer will return NULL if an error +occurs. +Functions returning an integer will return one of the following: +.Pp +.Bl -tag -width E_CONNECTED -compact +.It Er E_OK +The function was successful. +.It Er E_POSTED +The menu is already posted. +.It Er E_CONNECTED +An item was already connected to a menu. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_mark.3 b/vendor/netbsd-curses/libmenu/menu_mark.3 new file mode 100644 index 0000000..6f85bf8 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_mark.3 @@ -0,0 +1,112 @@ +.\" $NetBSD: menu_mark.3,v 1.10 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_MARK 3 +.Os +.Sh NAME +.Nm menu_mark , +.Nm menu_unmark , +.Nm set_menu_mark , +.Nm set_menu_unmark +.Nd get or set strings that show mark status for a menu +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft char * +.Fn menu_mark "MENU *menu" +.Ft char * +.Fn menu_unmark "MENU *menu" +.Ft int +.Fn set_menu_mark "MENU *menu" "char *mark" +.Ft int +.Fn set_menu_unmark "MENU *menu" "char *mark" +.Sh DESCRIPTION +The +.Fn menu_mark +function returns a pointer to the character string that is used to +mark selected items in the menu. +The mark string is set by the +.Fn set_menu_mark +function. +The +.Fn menu_unmark +function returns a pointer to the character string that is used to +indicate a menu items is not selected, this string is set by the +.Fn set_menu_unmark +function. +The mark and unmark strings may be of differing lengths, the room +allocated to drawing the mark will be the maximum of the lengths of +both the mark and unmark strings. +The shorter of the two strings will be left justified and space padded. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_POSTED +The menu is already posted. +.It Er E_CONNECTED +An item was already connected to a menu. +.It Er E_BAD_STATE +The function was called from within an initialization or termination +routine. +.It Er E_NO_ROOM +The menu does not fit within the subwindow. +.It Er E_NOT_POSTED +The menu is not posted. +.It Er E_UNKNOWN_COMMAND +The menu driver does not recognize the request passed to it. +.It Er E_NO_MATCH +The character search failed to find a match. +.It Er E_NOT_SELECTABLE +The item could not be selected. +.It Er E_NOT_CONNECTED +The item is not connected to a menu. +.It Er E_REQUEST_DENIED +The menu driver could not process the request. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_new.3 b/vendor/netbsd-curses/libmenu/menu_new.3 new file mode 100644 index 0000000..8efc036 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_new.3 @@ -0,0 +1,85 @@ +.\" $NetBSD: menu_new.3,v 1.11 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_NEW 3 +.Os +.Sh NAME +.Nm free_menu , +.Nm new_menu +.Nd create or delete a menu +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft int +.Fn free_menu "MENU *menu" +.Ft MENU * +.Fn new_menu "ITEM **items" +.Sh DESCRIPTION +The +.Fn free_menu +.Fa menu +function destroys the given menu and frees all allocated storage +associated with the menu. +All items associated with the menu are +detached from the menu before it is destroyed. +The +.Fn new_menu +function allocates storage for a new menu and initializes all the +values to the defined defaults. +If the items pointer passed is not a NULL then the given NULL terminated +array of items is attached to the new menu. +.Sh RETURN VALUES +The +.Fn new_menu +function returns NULL on error, while the +.Fn free_menu +function returns one of the following error values: +.Pp +.Bl -tag -width E_BAD_ARGUMENT -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_POSTED +The menu is already posted. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_opts.3 b/vendor/netbsd-curses/libmenu/menu_opts.3 new file mode 100644 index 0000000..c22e2f4 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_opts.3 @@ -0,0 +1,97 @@ +.\" $NetBSD: menu_opts.3,v 1.11 2019/07/01 07:16:25 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 30, 2019 +.Dt MENU_OPTS 3 +.Os +.Sh NAME +.Nm menu_opts , +.Nm menu_opts_off , +.Nm menu_opts_on , +.Nm set_menu_opts +.Nd get or modify options for a menu +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft OPTIONS +.Fn menu_opts "MENU *menu" +.Ft int +.Fn menu_opts_off "MENU *menu" "OPTIONS opts" +.Ft int +.Fn menu_opts_on "MENU *menu" "OPTIONS opts" +.Ft int +.Fn set_menu_opts "MENU *menu" "OPTIONS opts" +.Sh DESCRIPTION +The +.Fn menu_opts +function returns the current options set for the menu given. +The +.Fn menu_opts_off +function turns off the menu options given by the opts parameter for +the menu. +The +.Fn menu_opts_on +function turns on the menu options given by the opts parameter for the +menu passed. +The +.Fn set_menu_opts +sets the menu options to the value given in opts. +Options may be logigally ORed together. +Valid options are: +.Bl -column -offset indent ".Sy Option" ".Sy Meaning" +.It Sy Option Ta Sy Meaning +.It Dv O_ONEVALUE Ta The menu may only have one item selected at a time. +The menu mark will indicate the current item. +If this option is off then multiple menu items may be selected and +the menu mark will be displayed on each selected item. +.El +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_BAD_ARGUMENT -compact +.It Er E_OK +The function was successful. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_POSTED +The menu is already posted. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Aq Pa menu.h +automatically includes both +.Aq Pa curses.h +and +.Aq Pa eti.h . diff --git a/vendor/netbsd-curses/libmenu/menu_opts_off.3 b/vendor/netbsd-curses/libmenu/menu_opts_off.3 new file mode 120000 index 0000000..8a73c98 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_opts_off.3 @@ -0,0 +1 @@ +menu_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu_opts_on.3 b/vendor/netbsd-curses/libmenu/menu_opts_on.3 new file mode 120000 index 0000000..8a73c98 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_opts_on.3 @@ -0,0 +1 @@ +menu_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu_pad.3 b/vendor/netbsd-curses/libmenu/menu_pad.3 new file mode 120000 index 0000000..924e6ff --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_pad.3 @@ -0,0 +1 @@ +menu_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu_pattern.3 b/vendor/netbsd-curses/libmenu/menu_pattern.3 new file mode 100644 index 0000000..1efaa7c --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_pattern.3 @@ -0,0 +1,77 @@ +.\" $NetBSD: menu_pattern.3,v 1.9 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_PATTERN 3 +.Os +.Sh NAME +.Nm menu_pattern , +.Nm set_menu_pattern +.Nd get or set menu pattern +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft char * +.Fn menu_pattern "MENU *menu" +.Sh DESCRIPTION +The +.Fn menu_pattern +function returns a pointer to the string that is currently in the menu +pattern buffer. +The menu pattern buffer can be set by calling +.Fn set_menu_pattern +which will set the pattern buffer to the string passed and then +attempt to match that string against the names of the items in the +attached items. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_BAD_ARGUMENT -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_NO_MATCH +The character search failed to find a match. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_post.3 b/vendor/netbsd-curses/libmenu/menu_post.3 new file mode 100644 index 0000000..91067b5 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_post.3 @@ -0,0 +1,98 @@ +.\" $NetBSD: menu_post.3,v 1.11 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_POST 3 +.Os +.Sh NAME +.Nm post_menu , +.Nm unpost_menu +.Nd post (draw) or unpost a menu +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft int +.Fn post_menu "MENU *menu" +.Ft int +.Fn unpost_menu "MENU *menu" +.Sh DESCRIPTION +The +.Fn post_menu +function causes the menu to be drawn on the screen. +Any functions defined by either +.Fn set_menu_init +or +.Fn set_item_init +(see +.Xr menu_hook 3 ) +are called before the menu is placed on the screen. +The +.Fn unpost_menu +does the opposite, it removes a menu from the screen. +Any functions defined by both +.Fn set_menu_term +and +.Fn set_item_term +(see +.Xr menu_hook 3 ) +are called prior to the menu's removal. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_NOT_CONNECTED -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_POSTED +The menu is already posted. +.It Er E_BAD_STATE +The function was called from within an initialization or termination +routine. +.It Er E_NO_ROOM +The menu does not fit within the subwindow. +.It Er E_NOT_CONNECTED +The item is not connected to a menu. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menu_hook 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_sub.3 b/vendor/netbsd-curses/libmenu/menu_sub.3 new file mode 120000 index 0000000..ccc2d43 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_sub.3 @@ -0,0 +1 @@ +menu_win.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu_term.3 b/vendor/netbsd-curses/libmenu/menu_term.3 new file mode 120000 index 0000000..cfc6304 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_term.3 @@ -0,0 +1 @@ +menu_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu_unmark.3 b/vendor/netbsd-curses/libmenu/menu_unmark.3 new file mode 120000 index 0000000..a4b34d3 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_unmark.3 @@ -0,0 +1 @@ +menu_mark.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/menu_userptr.3 b/vendor/netbsd-curses/libmenu/menu_userptr.3 new file mode 100644 index 0000000..b0bfa92 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_userptr.3 @@ -0,0 +1,73 @@ +.\" $NetBSD: menu_userptr.3,v 1.9 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_USERPTR 3 +.Os +.Sh NAME +.Nm menu_userptr , +.Nm set_menu_userptr +.Nd get or set user pointer for a menu +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft void * +.Fn menu_userptr "MENU *menu" +.Ft int +.Fn set_menu_userptr "MENU *menu" "void *ptr" +.Sh DESCRIPTION +The +.Fn menu_userptr +function returns the pointer to the user defined pointer for the given +menu. +This pointer is set by the +.Fn set_menu_userptr +function. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_SYSTEM_ERROR -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menu_win.3 b/vendor/netbsd-curses/libmenu/menu_win.3 new file mode 100644 index 0000000..21678ad --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menu_win.3 @@ -0,0 +1,115 @@ +.\" $NetBSD: menu_win.3,v 1.11 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENU_WIN 3 +.Os +.Sh NAME +.Nm menu_sub , +.Nm menu_win , +.Nm scale_menu , +.Nm set_menu_sub , +.Nm set_menu_win +.Nd sub-menu handling +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Ft WINDOW * +.Fn menu_sub "MENU *menu" +.Ft WINDOW * +.Fn menu_win "MENU *menu" +.Ft int +.Fn scale_menu "MENU *menu" "int *rows" "int *cols" +.Ft int +.Fn set_menu_sub "MENU *menu" "WINDOW *sub" +.Ft int +.Fn set_menu_win "MENU *menu" "WINDOW *win" +.Sh DESCRIPTION +The +.Fn menu_sub +function returns a pointer to the window that will be used to post a +menu into, this pointer is set by the +.Fn set_menu_sub +function. +The +.Fn menu_win +function returns a pointer to the window in which the menu subwindow +will be created when the menu is posted, this pointer is set by the +.Fn set_menu_win +function. +The +.Fn scale_menu +function calculates the minimum size a window needs to be to hold the +items for a given menu, the parameters rows and cols are set to the +required number of rows and columns respectively. +.Sh RETURN VALUES +The functions return one of the following error values: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_POSTED +The menu is already posted. +.It Er E_CONNECTED +An item was already connected to a menu. +.It Er E_BAD_STATE +The function was called from within an initialization or termination +routine. +.It Er E_NO_ROOM +The menu does not fit within the subwindow. +.It Er E_NOT_POSTED +The menu is not posted +.It Er E_UNKNOWN_COMMAND +The menu driver does not recognize the request passed to it. +.It Er E_NO_MATCH +The character search failed to find a match. +.It Er E_NOT_SELECTABLE +The item could not be selected. +.It Er E_NOT_CONNECTED +The item is not connected to a menu. +.It Er E_REQUEST_DENIED +The menu driver could not process the request. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menus 3 +.Sh NOTES +The header +.Pa +automatically includes both +.Pa +and +.Pa . diff --git a/vendor/netbsd-curses/libmenu/menus.3 b/vendor/netbsd-curses/libmenu/menus.3 new file mode 100644 index 0000000..9016fcf --- /dev/null +++ b/vendor/netbsd-curses/libmenu/menus.3 @@ -0,0 +1,299 @@ +.\" $NetBSD: menus.3,v 1.16 2017/07/03 21:32:50 wiz Exp $ +.\" +.\" Copyright (c) 1999 +.\" Brett Lymn - blymn@baea.com.au, brett_lymn@yahoo.com.au +.\" +.\" This code is donated to The NetBSD Foundation by the author. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the Author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd September 10, 1999 +.Dt MENUS 3 +.Os +.Sh NAME +.Nm menus +.Nd menu library +.Sh LIBRARY +.Lb libmenu +.Sh SYNOPSIS +.In menu.h +.Sh DESCRIPTION +The +.Nm +library provides a terminal independent menu system using the +.Xr curses 3 +library. +Before using the +.Nm +functions the terminal must be set up by +.Xr curses 3 +using the +.Fn initscr +function or similar. +Programs using +.Nm +functions must be linked with the +.Xr curses 3 +library. +.Pp +The +.Nm +library provides facilities for defining menu items, placing a menu on the +terminal screen, assign pre- and post-change operations and setting the +attributes of both the menu and its items. +.Ss Defining default attributes for menus and items +The +.Nm +library allows any settable attribute or option of both the menu and item +objects to be defined such that any new menu or item automatically inherits +the value as default. +Setting the default value will not affect any item or +menu that has already been created but will be applied to subsequent objects. +To set the default attribute or option the set routine is passed a NULL +pointer in the item or menu parameter when calling the set routine. +The current default value can be retrieved by calling the get routine with a +NULL pointer for the item or menu parameter. +.Pp +.Bl -tag -width item_description -compact +.It function name +manual page name +.It current_item +.Xr menu_item_current 3 +.It free_item +.Xr menu_item_new 3 +.It free_menu +.Xr menu_new 3 +.It item_count +.Xr menu_items 3 +.It item_description +.Xr menu_item_name 3 +.It item_index +.Xr menu_item_current 3 +.It item_init +.Xr menu_hook 3 +.It item_name +.Xr menu_item_name 3 +.It item_opts +.Xr menu_item_opts 3 +.It item_opts_off +.Xr menu_item_opts 3 +.It item_opts_on +.Xr menu_item_opts 3 +.It item_selected +.Xr menu_item_value 3 +.It item_term +.Xr menu_hook 3 +.It item_userptr +.Xr menu_item_userptr 3 +.It item_value +.Xr menu_item_value 3 +.It item_visible +.Xr menu_item_visible 3 +.It menu_back +.Xr menu_attributes 3 +.It menu_driver +.Xr menu_driver 3 +.It menu_fore +.Xr menu_attributes 3 +.It menu_format +.Xr menu_format 3 +.It menu_grey +.Xr menu_attributes 3 +.It menu_init +.Xr menu_hook 3 +.It menu_items +.Xr menu_items 3 +.It menu_mark +.Xr menu_mark 3 +.It menu_opts +.Xr menu_opts 3 +.It menu_opts_off +.Xr menu_opts 3 +.It menu_opts_on +.Xr menu_opts 3 +.It menu_pad +.Xr menu_attributes 3 +.It menu_pattern +.Xr menu_pattern 3 +.It menu_sub +.Xr menu_win 3 +.It menu_term +.Xr menu_hook 3 +.It menu_unmark +.Xr menu_mark 3 +.It menu_userptr +.Xr menu_userptr 3 +.It men_win +.Xr menu_win 3 +.It new_item +.Xr menu_item_new 3 +.It new_menu +.Xr menu_new 3 +.It pos_menu_cursor +.Xr menu_cursor 3 +.It post_menu +.Xr menu_post 3 +.It scale_menu +.Xr menu_win 3 +.It set_current_item +.Xr menu_item_current 3 +.It set_item_init +.Xr menu_hook 3 +.It set_item_opts +.Xr menu_item_opts 3 +.It set_item_term +.Xr menu_hook 3 +.It set_item_userptr +.Xr menu_item_userptr 3 +.It set_item_value +.Xr menu_item_value 3 +.It set_menu_back +.Xr menu_attributes 3 +.It set_menu_fore +.Xr menu_attributes 3 +.It set_menu_format +.Xr menu_format 3 +.It set_menu_grey +.Xr menu_attributes 3 +.It set_menu_init +.Xr menu_hook 3 +.It set_menu_items +.Xr menu_items 3 +.It set_menu_mark +.Xr menu_mark 3 +.It set_menu_opts +.Xr menu_opts 3 +.It set_menu_pad +.Xr menu_attributes 3 +.It set_menu_pattern +.Xr menu_pattern 3 +.It set_menu_sub +.Xr menu_win 3 +.It set_menu_term +.Xr menu_hook 3 +.It set_menu_unmark +.Xr menu_mark 3 +.It set_menu_userptr +.Xr menu_userptr 3 +.It set_menu_win +.Xr menu_win 3 +.It set_top_row +.Xr menu_item_current 3 +.It top_row +.Xr menu_item_current 3 +.It unpost_menu +.Xr menu_post 3 +.El +.Sh RETURN VALUES +Any function returning a string pointer will return NULL if an error +occurs. +Functions returning an integer will return one of the following: +.Pp +.Bl -tag -width E_UNKNOWN_COMMAND -compact +.It Er E_OK +The function was successful. +.It Er E_SYSTEM_ERROR +There was a system error during the call. +.It Er E_BAD_ARGUMENT +One or more of the arguments passed to the function was incorrect. +.It Er E_POSTED +The menu is already posted. +.It Er E_CONNECTED +An item was already connected to a menu. +.It Er E_BAD_STATE +The function was called from within an initialization or termination +routine. +.It Er E_NO_ROOM +The menu does not fit within the subwindow. +.It Er E_NOT_POSTED +The menu is not posted. +.It Er E_UNKNOWN_COMMAND +The menu driver does not recognize the request passed to it. +.It Er E_NO_MATCH +The character search failed to find a match. +.It Er E_NOT_SELECTABLE +The item could not be selected. +.It Er E_NOT_CONNECTED +The item is not connected to a menu. +.It Er E_REQUEST_DENIED +The menu driver could not process the request. +.El +.Sh SEE ALSO +.Xr curses 3 , +.Xr menu_attributes 3 , +.Xr menu_cursor 3 , +.Xr menu_driver 3 , +.Xr menu_format 3 , +.Xr menu_hook 3 , +.Xr menu_item_current 3 , +.Xr menu_item_name 3 , +.Xr menu_item_new 3 , +.Xr menu_item_opts 3 , +.Xr menu_item_userptr 3 , +.Xr menu_item_value 3 , +.Xr menu_item_visible 3 , +.Xr menu_items 3 , +.Xr menu_mark 3 , +.Xr menu_new 3 , +.Xr menu_opts 3 , +.Xr menu_pattern 3 , +.Xr menu_post 3 , +.Xr menu_userptr 3 , +.Xr menu_win 3 +.Sh NOTES +This implementation of the menus library does depart in behaviour +subtly from the original AT & T implementation. +Some of the more notable departures are: +.Pp +.Bl -tag -width "item marking" -compact +.It unmark +The original implementation did not have a marker for an unmarked field +the mark was only displayed next to a field when it had been marked using +the REQ_TOGGLE_ITEM. +In this implementation a separate marker can be used +to indicate an unmarked item. +This can be set using set_menu_unmark function. +There is no requirement for the mark and unmark strings to be the same +length. +Room will be left for the longest of the two. +The unmark string +is optional, if it is not set then menus defaults to the old behaviour. +.It item marking +In the original implementation the current item was considered selected +and hence had the mark string displayed next to it. +This implementation does not do this because the Author considers the +effect too confusing. +Especially in the case of a multiple selection menu because there was no +way to tell if the current item is selected or not without shifting off +of it. +Since the current item is displayed using the foreground attribute it was +deemed unnecessary to also display the mark string against the current item. +.El +.Pp +The option O_RADIO and the function +.Fn item_selected +are +.Nx +extensions and must not be used in portable code. diff --git a/vendor/netbsd-curses/libmenu/new_item.3 b/vendor/netbsd-curses/libmenu/new_item.3 new file mode 120000 index 0000000..96bfeca --- /dev/null +++ b/vendor/netbsd-curses/libmenu/new_item.3 @@ -0,0 +1 @@ +menu_item_new.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/new_menu.3 b/vendor/netbsd-curses/libmenu/new_menu.3 new file mode 120000 index 0000000..98027d0 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/new_menu.3 @@ -0,0 +1 @@ +menu_new.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/pos_menu_cursor.3 b/vendor/netbsd-curses/libmenu/pos_menu_cursor.3 new file mode 120000 index 0000000..6d27b04 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/pos_menu_cursor.3 @@ -0,0 +1 @@ +menu_cursor.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/post.c b/vendor/netbsd-curses/libmenu/post.c new file mode 100644 index 0000000..ec60cd1 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/post.c @@ -0,0 +1,106 @@ +/* $NetBSD: post.c,v 1.12 2003/04/19 12:52:39 blymn Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include +#include +#include "internals.h" + +/* + * Post the menu to the screen. Call any defined init routines and then + * draw the menu on the screen. + */ +int +post_menu(MENU *menu) +{ + int maxx, maxy, i; + + if (menu == NULL) + return E_BAD_ARGUMENT; + if (menu->posted == 1) + return E_POSTED; + if (menu->in_init == 1) + return E_BAD_STATE; + if (menu->items == NULL) + return E_NOT_CONNECTED; + if (*menu->items == NULL) + return E_NOT_CONNECTED; + + menu->in_init = 1; + + if (menu->menu_init != NULL) + menu->menu_init(menu); + if (menu->item_init != NULL) + menu->item_init(menu); + + menu->in_init = 0; + + getmaxyx(menu->scrwin, maxy, maxx); + if ((maxx == ERR) || (maxy == ERR)) return E_SYSTEM_ERROR; + + if ((menu->cols * menu->max_item_width + menu->cols - 1) > maxx) + return E_NO_ROOM; + + if ((menu->opts & O_RADIO) != O_RADIO) { + for (i = 0; i < menu->item_count; i++) { + menu->items[i]->selected = 0; + } + } + + menu->posted = 1; + return _menui_draw_menu(menu); + +} + +/* + * Unpost the menu. Call any defined termination routines and remove the + * menu from the screen. + */ +int +unpost_menu(MENU *menu) +{ + if (menu == NULL) + return E_BAD_ARGUMENT; + if (menu->posted != 1) + return E_NOT_POSTED; + if (menu->in_init == 1) + return E_BAD_STATE; + if (menu->item_term != NULL) + menu->item_term(menu); + + if (menu->menu_term != NULL) + menu->menu_term(menu); + + menu->posted = 0; + werase(menu->scrwin); + wrefresh(menu->scrwin); + return E_OK; +} + + diff --git a/vendor/netbsd-curses/libmenu/post_menu.3 b/vendor/netbsd-curses/libmenu/post_menu.3 new file mode 120000 index 0000000..e1dca80 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/post_menu.3 @@ -0,0 +1 @@ +menu_post.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/scale_menu.3 b/vendor/netbsd-curses/libmenu/scale_menu.3 new file mode 120000 index 0000000..ccc2d43 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/scale_menu.3 @@ -0,0 +1 @@ +menu_win.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_current_item.3 b/vendor/netbsd-curses/libmenu/set_current_item.3 new file mode 120000 index 0000000..230876e --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_current_item.3 @@ -0,0 +1 @@ +menu_item_current.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_item_init.3 b/vendor/netbsd-curses/libmenu/set_item_init.3 new file mode 120000 index 0000000..cfc6304 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_item_init.3 @@ -0,0 +1 @@ +menu_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_item_term.3 b/vendor/netbsd-curses/libmenu/set_item_term.3 new file mode 120000 index 0000000..cfc6304 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_item_term.3 @@ -0,0 +1 @@ +menu_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_item_userptr.3 b/vendor/netbsd-curses/libmenu/set_item_userptr.3 new file mode 120000 index 0000000..867e203 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_item_userptr.3 @@ -0,0 +1 @@ +menu_item_userptr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_item_value.3 b/vendor/netbsd-curses/libmenu/set_item_value.3 new file mode 120000 index 0000000..1d6719b --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_item_value.3 @@ -0,0 +1 @@ +menu_item_value.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_back.3 b/vendor/netbsd-curses/libmenu/set_menu_back.3 new file mode 120000 index 0000000..924e6ff --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_back.3 @@ -0,0 +1 @@ +menu_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_fore.3 b/vendor/netbsd-curses/libmenu/set_menu_fore.3 new file mode 120000 index 0000000..924e6ff --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_fore.3 @@ -0,0 +1 @@ +menu_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_format.3 b/vendor/netbsd-curses/libmenu/set_menu_format.3 new file mode 120000 index 0000000..8b4c422 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_format.3 @@ -0,0 +1 @@ +menu_format.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_grey.3 b/vendor/netbsd-curses/libmenu/set_menu_grey.3 new file mode 120000 index 0000000..924e6ff --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_grey.3 @@ -0,0 +1 @@ +menu_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_init.3 b/vendor/netbsd-curses/libmenu/set_menu_init.3 new file mode 120000 index 0000000..cfc6304 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_init.3 @@ -0,0 +1 @@ +menu_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_items.3 b/vendor/netbsd-curses/libmenu/set_menu_items.3 new file mode 120000 index 0000000..03b51d0 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_items.3 @@ -0,0 +1 @@ +menu_items.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_mark.3 b/vendor/netbsd-curses/libmenu/set_menu_mark.3 new file mode 120000 index 0000000..a4b34d3 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_mark.3 @@ -0,0 +1 @@ +menu_mark.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_opts.3 b/vendor/netbsd-curses/libmenu/set_menu_opts.3 new file mode 120000 index 0000000..8a73c98 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_opts.3 @@ -0,0 +1 @@ +menu_opts.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_pad.3 b/vendor/netbsd-curses/libmenu/set_menu_pad.3 new file mode 120000 index 0000000..924e6ff --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_pad.3 @@ -0,0 +1 @@ +menu_attributes.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_sub.3 b/vendor/netbsd-curses/libmenu/set_menu_sub.3 new file mode 120000 index 0000000..ccc2d43 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_sub.3 @@ -0,0 +1 @@ +menu_win.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_term.3 b/vendor/netbsd-curses/libmenu/set_menu_term.3 new file mode 120000 index 0000000..cfc6304 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_term.3 @@ -0,0 +1 @@ +menu_hook.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_unmark.3 b/vendor/netbsd-curses/libmenu/set_menu_unmark.3 new file mode 120000 index 0000000..a4b34d3 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_unmark.3 @@ -0,0 +1 @@ +menu_mark.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_userptr.3 b/vendor/netbsd-curses/libmenu/set_menu_userptr.3 new file mode 120000 index 0000000..9b10edd --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_userptr.3 @@ -0,0 +1 @@ +menu_userptr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_menu_win.3 b/vendor/netbsd-curses/libmenu/set_menu_win.3 new file mode 120000 index 0000000..ccc2d43 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_menu_win.3 @@ -0,0 +1 @@ +menu_win.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/set_top_row.3 b/vendor/netbsd-curses/libmenu/set_top_row.3 new file mode 120000 index 0000000..230876e --- /dev/null +++ b/vendor/netbsd-curses/libmenu/set_top_row.3 @@ -0,0 +1 @@ +menu_item_current.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/shlib_version b/vendor/netbsd-curses/libmenu/shlib_version new file mode 100644 index 0000000..dc8e452 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/shlib_version @@ -0,0 +1,5 @@ +# $NetBSD: shlib_version,v 1.11 2009/01/11 03:07:48 christos Exp $ +# Remember to update distrib/sets/lists/base/shl.* when changing +# +major=6 +minor=0 diff --git a/vendor/netbsd-curses/libmenu/top_row.3 b/vendor/netbsd-curses/libmenu/top_row.3 new file mode 120000 index 0000000..230876e --- /dev/null +++ b/vendor/netbsd-curses/libmenu/top_row.3 @@ -0,0 +1 @@ +menu_item_current.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/unpost_menu.3 b/vendor/netbsd-curses/libmenu/unpost_menu.3 new file mode 120000 index 0000000..e1dca80 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/unpost_menu.3 @@ -0,0 +1 @@ +menu_post.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libmenu/userptr.c b/vendor/netbsd-curses/libmenu/userptr.c new file mode 100644 index 0000000..04c6e21 --- /dev/null +++ b/vendor/netbsd-curses/libmenu/userptr.c @@ -0,0 +1,90 @@ +/* $NetBSD: userptr.c,v 1.9 2003/03/09 01:08:48 lukem Exp $ */ + +/*- + * Copyright (c) 1998-1999 Brett Lymn (blymn@baea.com.au, brett_lymn@yahoo.com.au) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include + +#include +#include +#include + +/* the following is defined in menu.c */ +extern MENU _menui_default_menu; + +/* the following is defined in item.c */ +extern ITEM _menui_default_item; + +/* + * Set the item user pointer data + */ +int +set_item_userptr(ITEM *param_item, void *userptr) +{ + ITEM *item = (param_item != NULL) ? param_item : &_menui_default_item; + + item->userptr = userptr; + return E_OK; +} + + +/* + * Return the item user pointer + */ +void * +item_userptr(ITEM *item) +{ + if (item == NULL) + return _menui_default_item.userptr; + else + return item->userptr; +} + +/* + * Return the user pointer for the given menu + */ +void * +menu_userptr(MENU *menu) +{ + if (menu == NULL) + return _menui_default_menu.userptr; + else + return menu->userptr; +} + +/* + * Set the user pointer for the given menu + */ +int +set_menu_userptr(MENU *param_menu, void *userptr) +{ + MENU *menu = (param_menu != NULL) ? param_menu : &_menui_default_menu; + + menu->userptr = userptr; + + return E_OK; +} + diff --git a/vendor/netbsd-curses/libpanel/GNUmakefile b/vendor/netbsd-curses/libpanel/GNUmakefile new file mode 100644 index 0000000..bb78675 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/GNUmakefile @@ -0,0 +1,71 @@ +# $NetBSD: Makefile,v 1.7 2015/11/22 04:30:33 kamil Exp $ + +CPPFLAGS+= -I. -I.. -I../libcurses + +LIB= panel + +INCS= panel.h +INCSDIR= /usr/include + +SRCS= # + +SRCS+= _deck.c + +SRCS+= above.c +SRCS+= below.c +SRCS+= bottom.c +SRCS+= del.c +SRCS+= getuser.c +SRCS+= hidden.c +SRCS+= hide.c +SRCS+= move.c +SRCS+= new.c +SRCS+= replace.c +SRCS+= setuser.c +SRCS+= show.c +SRCS+= top.c +SRCS+= update.c +SRCS+= window.c + +LIBDPLIBS+= curses ${.CURDIR}/../libcurses + +MAN= # +MAN+= move_panel.3 +MAN+= new_panel.3 +MAN+= panel.3 +MAN+= panel_above.3 +MAN+= panel_hidden.3 +MAN+= panel_userptr.3 +MAN+= update_panels.3 + +MLINKS+= new_panel.3 panel_window.3 +MLINKS+= new_panel.3 replace_window.3 +MLINKS+= new_panel.3 replace_panel.3 +MLINKS+= new_panel.3 del_panel.3 + +MLINKS+= panel_above.3 top_panel.3 +MLINKS+= panel_above.3 bottom_panel.3 +MLINKS+= panel_above.3 panel_below.3 + +MLINKS+= panel_hidden.3 hide_panel.3 +MLINKS+= panel_hidden.3 show_panel.3 + +MLINKS+= panel_userptr.3 set_panel_userptr.3 +AR?=ar +RANLIB?=ranlib +OBJS = $(SRCS:.c=.o) +LIBA=lib$(LIB).a +all: $(LIBA) + +clean: + rm -f $(OBJS) $(LIBA) + +$(LIBA): $(OBJS) + rm -f $(LIBA) + $(AR) cr $@ $^ + $(RANLIB) $@ + +%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $< + + diff --git a/vendor/netbsd-curses/libpanel/Makefile b/vendor/netbsd-curses/libpanel/Makefile new file mode 100644 index 0000000..a9fd87b --- /dev/null +++ b/vendor/netbsd-curses/libpanel/Makefile @@ -0,0 +1,57 @@ +# $NetBSD: Makefile,v 1.8 2016/10/03 17:06:58 christos Exp $ + +WARNS= 6 + +CPPFLAGS+= -I${.CURDIR} + +LIB= panel + +INCS= panel.h +INCSDIR= /usr/include + +SRCS= # + +SRCS+= _deck.c + +SRCS+= above.c +SRCS+= below.c +SRCS+= bottom.c +SRCS+= del.c +SRCS+= getuser.c +SRCS+= hidden.c +SRCS+= hide.c +SRCS+= move.c +SRCS+= new.c +SRCS+= replace.c +SRCS+= setuser.c +SRCS+= show.c +SRCS+= top.c +SRCS+= update.c +SRCS+= window.c + +LIBDPLIBS+= curses ${.CURDIR}/../libcurses + +MAN= # +MAN+= move_panel.3 +MAN+= new_panel.3 +MAN+= panel.3 +MAN+= panel_above.3 +MAN+= panel_hidden.3 +MAN+= panel_userptr.3 +MAN+= update_panels.3 + +MLINKS+= new_panel.3 panel_window.3 +MLINKS+= new_panel.3 replace_window.3 +MLINKS+= new_panel.3 replace_panel.3 +MLINKS+= new_panel.3 del_panel.3 + +MLINKS+= panel_above.3 top_panel.3 +MLINKS+= panel_above.3 bottom_panel.3 +MLINKS+= panel_above.3 panel_below.3 + +MLINKS+= panel_hidden.3 hide_panel.3 +MLINKS+= panel_hidden.3 show_panel.3 + +MLINKS+= panel_userptr.3 set_panel_userptr.3 + +.include diff --git a/vendor/netbsd-curses/libpanel/_deck.c b/vendor/netbsd-curses/libpanel/_deck.c new file mode 100644 index 0000000..36ec087 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/_deck.c @@ -0,0 +1,33 @@ +/* $NetBSD: _deck.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + +struct deck _deck __dso_hidden = TAILQ_HEAD_INITIALIZER(_deck); +PANEL _stdscr_panel __dso_hidden; diff --git a/vendor/netbsd-curses/libpanel/above.c b/vendor/netbsd-curses/libpanel/above.c new file mode 100644 index 0000000..3760a3e --- /dev/null +++ b/vendor/netbsd-curses/libpanel/above.c @@ -0,0 +1,48 @@ +/* $NetBSD: above.c,v 1.4 2015/11/02 02:45:25 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + + +PANEL * +panel_above(PANEL *p) +{ + + if (p == NULL) { + if (TAILQ_EMPTY(&_deck)) + return NULL; + + return PANEL_ABOVE(&_stdscr_panel); + } + + if (__predict_false(PANEL_HIDDEN(p))) + return NULL; + + return PANEL_ABOVE(p); +} diff --git a/vendor/netbsd-curses/libpanel/below.c b/vendor/netbsd-curses/libpanel/below.c new file mode 100644 index 0000000..1e9c9a3 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/below.c @@ -0,0 +1,49 @@ +/* $NetBSD: below.c,v 1.2 2015/11/01 01:40:23 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + + +PANEL * +panel_below(PANEL *p) +{ + PANEL *below; + + if (p == NULL) + below = TAILQ_LAST(&_deck, deck); + else if (__predict_true(!PANEL_HIDDEN(p))) + below = PANEL_BELOW(p); + else + return NULL; + + if (below == &_stdscr_panel) + return NULL; + else + return below; +} diff --git a/vendor/netbsd-curses/libpanel/bottom.c b/vendor/netbsd-curses/libpanel/bottom.c new file mode 100644 index 0000000..ccd5edb --- /dev/null +++ b/vendor/netbsd-curses/libpanel/bottom.c @@ -0,0 +1,47 @@ +/* $NetBSD: bottom.c,v 1.3 2015/11/02 02:45:25 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + + +int +bottom_panel(PANEL *p) +{ + + if (__predict_false(p == NULL)) + return ERR; + + if (__predict_false(PANEL_HIDDEN(p))) + return ERR; + + (void) hide_panel(p); + + DECK_INSERT_BOTTOM(p); + return OK; +} diff --git a/vendor/netbsd-curses/libpanel/bottom_panel.3 b/vendor/netbsd-curses/libpanel/bottom_panel.3 new file mode 120000 index 0000000..0853414 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/bottom_panel.3 @@ -0,0 +1 @@ +panel_above.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libpanel/del.c b/vendor/netbsd-curses/libpanel/del.c new file mode 100644 index 0000000..ca1a83b --- /dev/null +++ b/vendor/netbsd-curses/libpanel/del.c @@ -0,0 +1,62 @@ +/* $NetBSD: del.c,v 1.3 2015/11/02 02:45:25 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + +#include +#include + + +int +del_panel(PANEL *p) +{ + + if (__predict_false(p == NULL)) + return ERR; + + (void) hide_panel(p); + free(p); + + /* + * If the last panel is removed, remove the phantom stdscr + * panel as well. + * + * A program that wants to switch to a different screen with + * set_term(3), or ends and recreates curses session with + * endwin(3)/initscr(3), must delete all panels first, since + * their windows will become invalid. When it will create its + * first new panel afterwards, it will pick up new stdscr. + */ + if (TAILQ_LAST(&_deck, deck) == &_stdscr_panel) { + (void) hide_panel(&_stdscr_panel); + assert(TAILQ_EMPTY(&_deck)); + } + + return OK; +} diff --git a/vendor/netbsd-curses/libpanel/del_panel.3 b/vendor/netbsd-curses/libpanel/del_panel.3 new file mode 120000 index 0000000..2f58737 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/del_panel.3 @@ -0,0 +1 @@ +new_panel.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libpanel/getuser.c b/vendor/netbsd-curses/libpanel/getuser.c new file mode 100644 index 0000000..86a475c --- /dev/null +++ b/vendor/netbsd-curses/libpanel/getuser.c @@ -0,0 +1,40 @@ +/* $NetBSD: getuser.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + + +char * +panel_userptr(PANEL *p) +{ + if (p == NULL) + return NULL; + + return p->user; +} diff --git a/vendor/netbsd-curses/libpanel/hidden.c b/vendor/netbsd-curses/libpanel/hidden.c new file mode 100644 index 0000000..4de139a --- /dev/null +++ b/vendor/netbsd-curses/libpanel/hidden.c @@ -0,0 +1,44 @@ +/* $NetBSD: hidden.c,v 1.3 2015/11/02 02:45:25 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + + +int +panel_hidden(PANEL *p) +{ + + if (p == NULL) + return ERR; + + if (PANEL_HIDDEN(p)) + return TRUE; + else + return FALSE; +} diff --git a/vendor/netbsd-curses/libpanel/hide.c b/vendor/netbsd-curses/libpanel/hide.c new file mode 100644 index 0000000..1aa341f --- /dev/null +++ b/vendor/netbsd-curses/libpanel/hide.c @@ -0,0 +1,56 @@ +/* $NetBSD: hide.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" +extern int touchoverlap(WINDOW *, WINDOW *); + + +int +hide_panel(PANEL *p) +{ + PANEL *other; + + if (__predict_false(p == NULL)) + return ERR; + + if (__predict_false(PANEL_HIDDEN(p))) + return OK; + + DECK_REMOVE(p); + + /* + * The panel is no longer in the deck, so update_panels() will + * not handle it. Touch exposed areas now. + */ + FOREACH_PANEL (other) { + touchoverlap(p->win, other->win); + } + + return OK; +} diff --git a/vendor/netbsd-curses/libpanel/hide_panel.3 b/vendor/netbsd-curses/libpanel/hide_panel.3 new file mode 120000 index 0000000..c25918e --- /dev/null +++ b/vendor/netbsd-curses/libpanel/hide_panel.3 @@ -0,0 +1 @@ +panel_hidden.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libpanel/move.c b/vendor/netbsd-curses/libpanel/move.c new file mode 100644 index 0000000..413eca6 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/move.c @@ -0,0 +1,57 @@ +/* $NetBSD: move.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" +extern int touchoverlap(WINDOW *, WINDOW *); + +int +move_panel(PANEL *p, int y, int x) +{ + int oldy, oldx; + + if (__predict_false(p == NULL)) + return ERR; + + getbegyx(p->win, oldy, oldx); + if (__predict_false(y == oldy && x == oldx)) + return OK; + + if (!PANEL_HIDDEN(p)) { + PANEL *other; + + /* touch exposed areas at the old location now */ + FOREACH_PANEL (other) { + if (other != p) { + touchoverlap(p->win, other->win); + } + } + } + + return mvwin(p->win, y, x); +} diff --git a/vendor/netbsd-curses/libpanel/move_panel.3 b/vendor/netbsd-curses/libpanel/move_panel.3 new file mode 100644 index 0000000..d4c5aea --- /dev/null +++ b/vendor/netbsd-curses/libpanel/move_panel.3 @@ -0,0 +1,70 @@ +.\" $NetBSD: move_panel.3,v 1.4 2015/10/28 10:22:40 wiz Exp $ +.\" +.\" Copyright (c) 2015 Valery Ushakov +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 28, 2015 +.Dt MOVE_PANEL 3 +.Os +.Sh NAME +.Nm move_panel +.Nd change panel position +.Sh LIBRARY +.Lb libpanel +.Sh SYNOPSIS +.In panel.h +.\" +.Ft int +.Fn move_panel "PANEL *p" "int y" "int x" +.\" +.Sh DESCRIPTION +A panel can be moved to a new position by calling the +.Fn move_panel +function. +The +.Fa y +and +.Fa x +positions are the new origin of the panel on the screen. +.Pp +This function is the panel library counterpart of the curses +.Xr mvwin 3 +function. +Curses +.Fn mvwin +must never be directly used on a window associated with a panel. +.Sh RETURN VALUES +The +.Fn move_panel +function will return one of the following +values: +.Pp +.Bl -tag -width ".Dv ERR" -compact +.It Dv OK +The function completed successfully. +.It Dv ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr mvwin 3 , +.Xr panel 3 diff --git a/vendor/netbsd-curses/libpanel/new.c b/vendor/netbsd-curses/libpanel/new.c new file mode 100644 index 0000000..256aa31 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/new.c @@ -0,0 +1,75 @@ +/* $NetBSD: new.c,v 1.3 2015/11/02 02:45:25 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + +#include +#include + + +static PANEL * +_new_panel(WINDOW *w) +{ + PANEL *p; + + p = (PANEL *)malloc(sizeof(PANEL)); + if (__predict_false(p == NULL)) + return NULL; + + p->win = w; + p->user = NULL; + + DECK_INSERT_TOP(p); + return p; +} + + +PANEL * +new_panel(WINDOW *w) +{ + + if (__predict_false(w == NULL)) + return NULL; + + if (__predict_false(w == stdscr)) + return NULL; + + /* + * Ensure there's phantom panel for stdscr at (below) the + * bottom. We explicitly re-assign stdscr in case it changed. + */ + if (TAILQ_EMPTY(&_deck)) { + assert(PANEL_HIDDEN(&_stdscr_panel)); + + _stdscr_panel.win = stdscr; + DECK_INSERT_TOP(&_stdscr_panel); + } + + return _new_panel(w); +} diff --git a/vendor/netbsd-curses/libpanel/new_panel.3 b/vendor/netbsd-curses/libpanel/new_panel.3 new file mode 100644 index 0000000..8c6934c --- /dev/null +++ b/vendor/netbsd-curses/libpanel/new_panel.3 @@ -0,0 +1,82 @@ +.\" $NetBSD: new_panel.3,v 1.4 2015/10/29 02:33:46 uwe Exp $ +.\" +.\" Copyright (c) 2015 Valery Ushakov +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 28, 2015 +.Dt NEW_PANEL 3 +.Os +.Sh NAME +.Nm new_panel , +.Nm panel_window , +.Nm replace_panel , +.Nm del_panel +.Nd panel routines +.Sh LIBRARY +.Lb libpanel +.Sh SYNOPSIS +.In panel.h +.\" +.Ft PANEL * +.Fn new_panel "WINDOW *win" +.\" +.Ft WINDOW * +.Fn panel_window "PANEL *p" +.\" +.Ft int +.Fn replace_panel "PANEL *p" "WINDOW *win" +.\" +.Ft int +.Fn del_panel "PANEL *p" +.\" +.Sh DESCRIPTION +The function +.Fn new_panel +creates a new panel associated with the curses window +.Fa win . +The new panel is visible and is placed at the top of the deck. +.Pp +The curses window associated with a panel may be obtained with +.Fn panel_window +and changed with +.Fn replace_panel . +.Pp +The function +.Fn del_panel +hides the panel and deletes it. +Note that the curses window associated with the panel is not deleted. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ".Dv ERR" -compact +.It Dv OK +The function completed successfully. +.It Dv ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr panel 3 diff --git a/vendor/netbsd-curses/libpanel/panel.3 b/vendor/netbsd-curses/libpanel/panel.3 new file mode 100644 index 0000000..b2b611d --- /dev/null +++ b/vendor/netbsd-curses/libpanel/panel.3 @@ -0,0 +1,75 @@ +.\" $NetBSD: panel.3,v 1.3 2015/10/28 10:22:40 wiz Exp $ +.\" +.\" Copyright (c) 2015 Valery Ushakov +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 28, 2015 +.Dt PANEL 3 +.Os +.Sh NAME +.Nm panel +.Nd z-order for curses windows +.Sh LIBRARY +.Lb libpanel +.Sh SYNOPSIS +.In panel.h +.Sh DESCRIPTION +Overlapping curses windows have no notion of z-order, +what you see on the screen depends on the order of updates. +The +.Nm +library is an extension built on top of +.Xr curses 3 +that adds z-order to curses windows. +.Pp +Each panel has an associated curses window. +All currently visible panels form a +.Dq deck . +Panels have z-order only relative to other panels in the deck and to +.\".Xr stdscr 3 . +stdscr. +The latter doesn't have a panel of its own but implicitly lies below +all other panels in the deck. +If you mix plain curses windows and panels, the visual results are +undefined since the panel library is not aware of windows that are not +associated with panels. +.Bl -column ".Xr set_panel_userptr 3" +.It Sy "Function" Ta Sy "Summary" +.It Xr bottom_panel 3 Ta move the panel to the bottom of the deck +.It Xr del_panel 3 Ta delete the panel +.It Xr hide_panel 3 Ta hide the panel, removing it from deck +.It Xr move_panel 3 Ta move the panel to a new position on screen +.It Xr new_panel 3 Ta create new panel +.It Xr panel_above 3 Ta a panel above the given panel +.It Xr panel_below 3 Ta a panel below the given panel +.It Xr panel_hidden 3 Ta check if the panel is hidden +.It Xr panel_userptr 3 Ta user data associated with the panel +.It Xr panel_window 3 Ta curses window associated with the panel +.It Xr replace_panel 3 Ta associate a different window with the panel +.It Xr set_panel_userptr 3 Ta associate arbitrary user data with the panel +.It Xr show_panel 3 Ta show hidden panel at the top of the deck +.It Xr top_panel 3 Ta move the panel to the top of the deck +.It Xr update_panels 3 Ta update terminal display +.El +.Sh SEE ALSO +.Xr curses 3 diff --git a/vendor/netbsd-curses/libpanel/panel.h b/vendor/netbsd-curses/libpanel/panel.h new file mode 100644 index 0000000..d850e18 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/panel.h @@ -0,0 +1,64 @@ +/* $NetBSD: panel.h,v 1.2 2015/11/02 01:06:15 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PANEL_H_ +#define _PANEL_H_ + +#include + +typedef struct __panel PANEL; + +#ifdef __cplusplus +extern "C" { +#endif +PANEL *new_panel(WINDOW *); +int del_panel(PANEL *); + +int replace_panel(PANEL *, WINDOW *); +WINDOW *panel_window(PANEL *); + +int set_panel_userptr(PANEL *, char *); +char *panel_userptr(PANEL *); + +int hide_panel(PANEL *); +int show_panel(PANEL *); +int panel_hidden(PANEL *); + +int top_panel(PANEL *); +int bottom_panel(PANEL *); + +PANEL *panel_above(PANEL *); +PANEL *panel_below(PANEL *); + +int move_panel(PANEL *, int, int); + +void update_panels(void); +#ifdef __cplusplus +} +#endif + +#endif /* _PANEL_H_ */ diff --git a/vendor/netbsd-curses/libpanel/panel_above.3 b/vendor/netbsd-curses/libpanel/panel_above.3 new file mode 100644 index 0000000..883dee2 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/panel_above.3 @@ -0,0 +1,102 @@ +.\" $NetBSD: panel_above.3,v 1.8 2015/11/01 14:47:54 wiz Exp $ +.\" +.\" Copyright (c) 2015 Valery Ushakov +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 28, 2015 +.Dt PANEL_ABOVE 3 +.Os +.Sh NAME +.Nm top_panel , +.Nm bottom_panel , +.Nm panel_above , +.Nm panel_below +.Nd z-order of panels +.Sh LIBRARY +.Lb libpanel +.Sh SYNOPSIS +.In panel.h +.\" +.Ft int +.Fn top_panel "PANEL *p" +.\" +.Ft int +.Fn bottom_panel "PANEL *p" +.\" +.Ft PANEL * +.Fn panel_above "PANEL *p" +.\" +.Ft PANEL * +.Fn panel_below "PANEL *p" +.\" +.Sh DESCRIPTION +Newly created panels are placed at the top of the deck. +The z-order of a visible panel can be changed with the functions +.Fn top_panel +and +.Fn bottom_panel +that move it to the top and bottom of the deck respectively. +.Pp +For a visible panel its neighbors in the deck can be obtained with +.Fn panel_above +and +.Fn panel_below . +The bottom and top panels can be obtained by passing a +.Dv NULL +argument to +.Fn panel_above +and +.Fn panel_below , +respectively. +.Sh IMPLEMENTATION NOTES +The +.Fn top_panel +function will return an error if the panel is currently hidden. +Use +.Xr show_panel 3 +to make a hidden panel visible again and put it at the top of the deck. +This is the behaviour specified by the original +.At V +panel library. +.Pp +In the ncurses implementation of the panel library +.Fn show_panel +and +.Fn top_panel +are identical and handle both visible and hidden panels. +This may be a source of bugs in programs tested only against ncurses. +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ".Dv ERR" -compact +.It Dv OK +The function completed successfully. +.It Dv ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr panel 3 diff --git a/vendor/netbsd-curses/libpanel/panel_below.3 b/vendor/netbsd-curses/libpanel/panel_below.3 new file mode 120000 index 0000000..0853414 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/panel_below.3 @@ -0,0 +1 @@ +panel_above.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libpanel/panel_hidden.3 b/vendor/netbsd-curses/libpanel/panel_hidden.3 new file mode 100644 index 0000000..8d4aef6 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/panel_hidden.3 @@ -0,0 +1,98 @@ +.\" $NetBSD: panel_hidden.3,v 1.3 2015/10/28 10:22:40 wiz Exp $ +.\" +.\" Copyright (c) 2015 Valery Ushakov +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 28, 2015 +.Dt PANEL_HIDDEN 3 +.Os +.Sh NAME +.Nm hide_panel , +.Nm show_panel , +.Nm panel_hidden +.Nd visibility of panels +.Sh LIBRARY +.Lb libpanel +.Sh SYNOPSIS +.In panel.h +.\" +.Ft int +.Fn hide_panel "PANEL *p" +.\" +.Ft int +.Fn show_panel "PANEL *p" +.\" +.Ft int +.Fn panel_hidden "PANEL *p" +.\" +.Sh DESCRIPTION +Panels are initially created visible. +The function +.Fn hide_panel +can be used to hide a panel. +The panel is removed from the deck. +.Pp +A panel can be made visible again with a call to +.Fn show_panel . +The panel is returned to the top of the deck. +.Pp +The current visibility status of a panel can be queried with +.Fn panel_hidden . +.Sh IMPLEMENTATION NOTES +The +.Fn show_panel +function will return an error if the panel is already visible. +Use +.Xr top_panel 3 +to change z-order of an already visible panel. +This is the behaviour specified by the original +.At V +panel library. +.Pp +In the ncurses implementation of the panel library +.Fn show_panel +and +.Fn top_panel +are identical and handle both visible and hidden panels. +This may be a source of bugs in programs tested only against ncurses. +.Sh RETURN VALUES +The +.Fn panel_hidden +function returns +.Dv TRUE +or +.Dv FALSE . +It will return +.Dv ERR +if passed a null pointer. +.Pp +Other functions will return one of the following values: +.Pp +.Bl -tag -width ".Dv ERR" -compact +.It Dv OK +The function completed successfully. +.It Dv ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr panel 3 diff --git a/vendor/netbsd-curses/libpanel/panel_impl.h b/vendor/netbsd-curses/libpanel/panel_impl.h new file mode 100644 index 0000000..25989bd --- /dev/null +++ b/vendor/netbsd-curses/libpanel/panel_impl.h @@ -0,0 +1,92 @@ +/* $NetBSD: panel_impl.h,v 1.2 2015/11/02 01:06:15 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PANEL_IMPL_H_ +#define _PANEL_IMPL_H_ + +#include "panel.h" + +#include + +#define DECK_HEAD(head) TAILQ_HEAD(head, __panel) +#define DECK_ENTRY TAILQ_ENTRY(__panel) + + +/* + * Panels are just curses windows with Z-order added. + * See update_panels() for details. + */ +struct __panel { + WINDOW *win; + char *user; + DECK_ENTRY zorder; +}; + + +/* Deck of panels in Z-order from bottom to top. */ +DECK_HEAD(deck); +extern struct deck _deck __dso_hidden; + +/* Fake stdscr panel at the bottom, not user visible */ +extern PANEL _stdscr_panel __dso_hidden; + + +/* + * Hidden panels are not in the deck. macros don't have + * a concept of an entry not on the list, so provide a kludge that + * digs into internals. + */ +#define TAILQ_REMOVE_NP(head, elm, field) do { \ + TAILQ_REMOVE((head), (elm), field); \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_prev = NULL; \ +} while (/*CONSTCOND*/ 0) + +#define TAILQ_LINKED_NP(elm, field) \ + (((elm)->field.tqe_prev) != NULL) + + +#define DECK_INSERT_TOP(p) do { \ + TAILQ_INSERT_TAIL(&_deck, (p), zorder); \ +} while (/*CONSTCOND*/ 0) + +#define DECK_INSERT_BOTTOM(p) do { \ + TAILQ_INSERT_AFTER(&_deck, &_stdscr_panel, (p), zorder); \ +} while (/*CONSTCOND*/ 0) + +#define DECK_REMOVE(p) do { \ + TAILQ_REMOVE_NP(&_deck, (p), zorder); \ +} while (/*CONSTCOND*/ 0) + + +#define PANEL_ABOVE(p) (TAILQ_NEXT((p), zorder)) +#define PANEL_BELOW(p) (TAILQ_PREV((p), deck, zorder)) +#define PANEL_HIDDEN(p) (!TAILQ_LINKED_NP((p), zorder)) + +#define FOREACH_PANEL(var) TAILQ_FOREACH(var, &_deck, zorder) + +#endif /* _PANEL_IMPL_H_ */ diff --git a/vendor/netbsd-curses/libpanel/panel_userptr.3 b/vendor/netbsd-curses/libpanel/panel_userptr.3 new file mode 100644 index 0000000..7af42e8 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/panel_userptr.3 @@ -0,0 +1,65 @@ +.\" $NetBSD: panel_userptr.3,v 1.2 2015/10/28 02:23:50 uwe Exp $ +.\" +.\" Copyright (c) 2015 Valery Ushakov +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 28, 2015 +.Dt PANEL_USERPTR 3 +.Os +.Sh NAME +.Nm set_panel_userptr , +.Nm panel_userptr +.Nd user data associated with panels +.Sh LIBRARY +.Lb libpanel +.Sh SYNOPSIS +.In panel.h +.\" +.Ft int +.Fn set_panel_userptr "PANEL *p" "char *data" +.\" +.Ft char * +.Fn panel_userptr "PANEL *p" +.\" +.Sh DESCRIPTION +The function +.Fn set_panel_userptr +can be used to associate arbitrary user data with a panel. +.Pp +The data associated with a panel can be obtained with +.Fn panel_userptr . +.Sh RETURN VALUES +Functions returning pointers will return +.Dv NULL +if an error is detected. +The functions that return an int will return one of the following +values: +.Pp +.Bl -tag -width ".Dv ERR" -compact +.It Dv OK +The function completed successfully. +.It Dv ERR +An error occurred in the function. +.El +.Sh SEE ALSO +.Xr panel 3 diff --git a/vendor/netbsd-curses/libpanel/panel_window.3 b/vendor/netbsd-curses/libpanel/panel_window.3 new file mode 120000 index 0000000..2f58737 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/panel_window.3 @@ -0,0 +1 @@ +new_panel.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libpanel/replace.c b/vendor/netbsd-curses/libpanel/replace.c new file mode 100644 index 0000000..9a2f4ea --- /dev/null +++ b/vendor/netbsd-curses/libpanel/replace.c @@ -0,0 +1,52 @@ +/* $NetBSD: replace.c,v 1.3 2015/11/02 02:45:25 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" +extern int touchoverlap(WINDOW *, WINDOW *); + +int +replace_panel(PANEL *p, WINDOW *w) +{ + + if (__predict_false(p == NULL || w == NULL)) + return ERR; + + if (!PANEL_HIDDEN(p)) { + PANEL *other; + + /* touch exposed areas at the old location now */ + FOREACH_PANEL (other) { + if (other != p) + touchoverlap(p->win, other->win); + } + } + + p->win = w; + return OK; +} diff --git a/vendor/netbsd-curses/libpanel/replace_panel.3 b/vendor/netbsd-curses/libpanel/replace_panel.3 new file mode 120000 index 0000000..2f58737 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/replace_panel.3 @@ -0,0 +1 @@ +new_panel.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libpanel/replace_window.3 b/vendor/netbsd-curses/libpanel/replace_window.3 new file mode 120000 index 0000000..2f58737 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/replace_window.3 @@ -0,0 +1 @@ +new_panel.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libpanel/set_panel_userptr.3 b/vendor/netbsd-curses/libpanel/set_panel_userptr.3 new file mode 120000 index 0000000..05354b1 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/set_panel_userptr.3 @@ -0,0 +1 @@ +panel_userptr.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libpanel/setuser.c b/vendor/netbsd-curses/libpanel/setuser.c new file mode 100644 index 0000000..c06fe8b --- /dev/null +++ b/vendor/netbsd-curses/libpanel/setuser.c @@ -0,0 +1,41 @@ +/* $NetBSD: setuser.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + + +int +set_panel_userptr(PANEL *p, char *u) +{ + if (p == NULL) + return ERR; + + p->user = u; + return OK; +} diff --git a/vendor/netbsd-curses/libpanel/shlib_version b/vendor/netbsd-curses/libpanel/shlib_version new file mode 100644 index 0000000..04f3516 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/shlib_version @@ -0,0 +1,5 @@ +# $NetBSD: shlib_version,v 1.1 2015/10/26 23:09:49 uwe Exp $ +# Remember to update distrib/sets/lists/base/shl.* when changing +# +major=1 +minor=0 diff --git a/vendor/netbsd-curses/libpanel/show.c b/vendor/netbsd-curses/libpanel/show.c new file mode 100644 index 0000000..1b0a274 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/show.c @@ -0,0 +1,46 @@ +/* $NetBSD: show.c,v 1.3 2015/11/02 02:45:25 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + + +int +show_panel(PANEL *p) +{ + + if (__predict_false(p == NULL)) + return ERR; + + /* unlike top_panel() */ + if (__predict_false(!PANEL_HIDDEN(p))) + return ERR; + + DECK_INSERT_TOP(p); + return OK; +} diff --git a/vendor/netbsd-curses/libpanel/show_panel.3 b/vendor/netbsd-curses/libpanel/show_panel.3 new file mode 120000 index 0000000..c25918e --- /dev/null +++ b/vendor/netbsd-curses/libpanel/show_panel.3 @@ -0,0 +1 @@ +panel_hidden.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libpanel/top.c b/vendor/netbsd-curses/libpanel/top.c new file mode 100644 index 0000000..d05a92f --- /dev/null +++ b/vendor/netbsd-curses/libpanel/top.c @@ -0,0 +1,48 @@ +/* $NetBSD: top.c,v 1.3 2015/11/02 02:45:25 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + + +int +top_panel(PANEL *p) +{ + + if (__predict_false(p == NULL)) + return ERR; + + /* unlike show_panel() */ + if (__predict_false(PANEL_HIDDEN(p))) + return ERR; + + /* XXX: use common internal functions instead */ + (void) hide_panel(p); + (void) show_panel(p); + return OK; +} diff --git a/vendor/netbsd-curses/libpanel/top_panel.3 b/vendor/netbsd-curses/libpanel/top_panel.3 new file mode 120000 index 0000000..0853414 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/top_panel.3 @@ -0,0 +1 @@ +panel_above.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libpanel/update.c b/vendor/netbsd-curses/libpanel/update.c new file mode 100644 index 0000000..767ed2d --- /dev/null +++ b/vendor/netbsd-curses/libpanel/update.c @@ -0,0 +1,61 @@ +/* $NetBSD: update.c,v 1.1 2015/10/26 23:09:49 uwe Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" +extern int touchoverlap(WINDOW *, WINDOW *); + +void +update_panels(void) +{ + PANEL *p; + + /* + * For each panel tell panels above it they need to refresh + * regions that overlap (are above) this panel. This ensures + * that even if a panel below was touched, it's still + * overwritten by a panel above. + * + * Note that we also need to do this during "destructive" + * operations (hide, move, replace window - which see). + */ + FOREACH_PANEL (p) { + PANEL *above = p; + while ((above = PANEL_ABOVE(above)) != NULL) { + touchoverlap(p->win, above->win); + } + } + + /* + * This is what effects Z-order: the window updated later + * overwrites contents of the windows below (before) it. + */ + FOREACH_PANEL (p) { + wnoutrefresh(p->win); + } +} diff --git a/vendor/netbsd-curses/libpanel/update_panels.3 b/vendor/netbsd-curses/libpanel/update_panels.3 new file mode 100644 index 0000000..516e409 --- /dev/null +++ b/vendor/netbsd-curses/libpanel/update_panels.3 @@ -0,0 +1,66 @@ +.\" $NetBSD: update_panels.3,v 1.3 2015/10/29 06:57:34 wiz Exp $ +.\" +.\" Copyright (c) 2015 Valery Ushakov +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 28, 2015 +.Dt UPDATE_PANELS 3 +.Os +.Sh NAME +.Nm update_panels +.Nd update terminal display +.Sh LIBRARY +.Lb libpanel +.Sh SYNOPSIS +.In panel.h +.\" +.Ft void +.Fn update_panels "void" +.\" +.Sh DESCRIPTION +The +.Fn update_panels +function performs the internal processing required by the panel +library to determine what changes need to be made to synchronise +the curses internal screen buffer and the terminal but does not +modify the terminal display. +.Pp +This function will internally perform the required calls to +.Xr touchoverlap 3 +and +.Xr wnoutrefresh 3 +in the correct order. +You should never directly call curses functions like +.Xr wnoutrefresh 3 +on panel windows yourself. +Remember, that +.Dv stdscr +is below all panels and any changes to it also require calling +.Fn update_panels . +.Pp +Finally, call the curses function +.Xr doupdate 3 +to update the terminal display. +.Sh SEE ALSO +.Xr doupdate 3 , +.Xr panel 3 diff --git a/vendor/netbsd-curses/libpanel/window.c b/vendor/netbsd-curses/libpanel/window.c new file mode 100644 index 0000000..26e668d --- /dev/null +++ b/vendor/netbsd-curses/libpanel/window.c @@ -0,0 +1,41 @@ +/* $NetBSD: window.c,v 1.3 2015/11/02 02:45:25 kamil Exp $ */ + +/* + * Copyright (c) 2015 Valery Ushakov + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "panel_impl.h" + + +WINDOW * +panel_window(PANEL *p) +{ + + if (p == NULL) + return NULL; + + return p->win; +} diff --git a/vendor/netbsd-curses/libterminfo/GNUmakefile b/vendor/netbsd-curses/libterminfo/GNUmakefile new file mode 100644 index 0000000..ce0dc06 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/GNUmakefile @@ -0,0 +1,108 @@ +# $NetBSD: Makefile,v 1.22 2012/03/21 05:37:44 matt Exp $ + +USE_SHLIBDIR= yes + +LIB= terminfo +WARNS?= 5 + +CPPFLAGS+= -I. +CPPFLAGS+= -I.. + +SRCS= term.c ti.c setupterm.c curterm.c tparm.c tputs.c +SRCS+= compile.c hash.c +SRCS+= cdbr.c +SRCS+= mi_vector_hash.c + +INCS= term.h +INCSDIR= /usr/include + +COPTS.tparm.c = -Wno-format-nonliteral + +MAN= terminfo.3 terminfo.5 +MLINKS= terminfo.3 setupterm.3 \ + terminfo.3 set_curterm.3 terminfo.3 del_curterm.3 \ + terminfo.3 termname.3 terminfo.3 longname.3 \ + terminfo.3 tigetnum.3 terminfo.3 tigetflag.3 \ + terminfo.3 tigetstr.3 terminfo.3 tparm.3 terminfo.3 tputs.3 \ + terminfo.3 putp.3 \ + terminfo.3 ti_setupterm.3 terminfo.3 ti_getflag.3 \ + terminfo.3 ti_getnum.3 terminfo.3 ti_getstr.3 \ + terminfo.3 tiparm.3 terminfo.3 ti_tiparm.3 \ + terminfo.3 ti_puts.3 terminfo.3 ti_putp.3 + +# Build in termcap emulation +SRCS+= termcap.c +INCS+= termcap.h +MAN+= termcap.3 +MLINKS+= termcap.3 tgetent.3 termcap.3 tgetflag.3 termcap.3 tgetnum.3 \ + termcap.3 tgetstr.3 termcap.3 tgoto.3 + +#CPPFLAGS+= -I${.OBJDIR} + +# $NetBSD: Makefile.hash,v 1.7 2013/01/24 14:17:40 roy Exp $ + +TERMINFODIR=../terminfo +SCRIPT_ENV= \ + TERMINFODIR=$(TERMINFODIR) \ + TOOL_AWK=awk \ + TOOL_NBPERF=../nbperf/nbperf \ + TOOL_SED=sed \ + TOOL_SORT=sort \ + TOOL_TIC=../tic/tic + +HOST_SH?=/bin/sh + +all: libterminfo.a + +$(TOOL_NBPERF): + $(MAKE) -C ../nbperf nbperf + +$(TOOL_TIC): + $(MAKE) -C ../tic tic + +# Generate our string and hash tables +hash.c: genhash term.h $(TOOL_NBPERF) + @echo "Generating terminfo hash" + $(SCRIPT_ENV) $(HOST_SH) $^ > $@ + +termcap_hash.c: genthash termcap_map.c $(TOOL_NBPERF) + @echo "Generating termcap hash" + ${SCRIPT_ENV} ${HOST_SH} $^ > $@ + +# Allow terminfo descriptions to be compiled into libterminfo +compiled_terms.c: genterms term.h ${TERMINFODIR}/terminfo $(TOOL_TIC) + @echo "Generating compiled terminfo descriptions" + ${SCRIPT_ENV} ${HOST_SH} $^ > $@ + +ifeq ($(USETOOLS),yes) +compiled_terms.c: ${TOOL_TIC} +endif + +DPSRCS+= hash.c termcap_hash.c compiled_terms.c + +CLEANFILES+= hash.c termcap_hash.c compiled_terms.c + +clean: + rm -f $(OBJS) libterminfo.a $(CLEANFILES) + +# Generate our man pages +terminfo.5: genman terminfo.5.in term.h termcap_map.c + @echo "Generating terminfo man pages" + ${SCRIPT_ENV} ${HOST_SH} $^ > $@ + +CLEANFILES+= terminfo.5 +CFLAGS+=-Werror-implicit-function-declaration + +OBJS = $(SRCS:.c=.o) + +man: terminfo.5 + +term.c: compiled_terms.c +termcap.c: termcap_hash.c + +libterminfo.a: $(OBJS) + ar cru $@ $^ + +%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $< + diff --git a/vendor/netbsd-curses/libterminfo/Makefile b/vendor/netbsd-curses/libterminfo/Makefile new file mode 100644 index 0000000..556703d --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/Makefile @@ -0,0 +1,110 @@ +# $NetBSD: Makefile,v 1.23 2020/04/05 12:31:02 roy Exp $ + +.include + +USE_SHLIBDIR= yes + +LIB= terminfo +WARNS?= 5 + +CPPFLAGS+= -I${.CURDIR} + +SRCS= term.c ti.c setupterm.c curterm.c tparm.c tputs.c +SRCS+= hash.c +INCS= term.h +INCSDIR= /usr/include + +# For ramdisks there is no database to read from so remove compat +# and the need to read from them. +# While here, remove the ability to compile terminfo descriptions +# from $TERMINFO as well. +# This means the library requires any terminal needed built into it. +.if !defined(SMALLPROG) +CPPFLAGS+= -DTERMINFO_COMPILE -DTERMINFO_DB -DTERMINFO_COMPAT +SRCS+= compile.c +.endif + +COPTS.tparm.c = -Wno-format-nonliteral + +MAN= terminfo.3 terminfo.5 +MLINKS= terminfo.3 setupterm.3 \ + terminfo.3 set_curterm.3 terminfo.3 del_curterm.3 \ + terminfo.3 termname.3 terminfo.3 longname.3 \ + terminfo.3 tigetnum.3 terminfo.3 tigetflag.3 \ + terminfo.3 tigetstr.3 terminfo.3 tparm.3 terminfo.3 tputs.3 \ + terminfo.3 putp.3 \ + terminfo.3 ti_setupterm.3 terminfo.3 ti_getflag.3 \ + terminfo.3 ti_getnum.3 terminfo.3 ti_getstr.3 \ + terminfo.3 tiparm.3 terminfo.3 ti_tiparm.3 \ + terminfo.3 ti_puts.3 terminfo.3 ti_putp.3 + +# Build in termcap emulation +SRCS+= termcap.c +INCS+= termcap.h +MAN+= termcap.3 +MLINKS+= termcap.3 tgetent.3 termcap.3 tgetflag.3 termcap.3 tgetnum.3 \ + termcap.3 tgetstr.3 termcap.3 tgoto.3 + +CPPFLAGS+= -I${.OBJDIR} + +.include + +# Generate our man pages +terminfo.5: genman terminfo.5.in term.h termcap_map.c + @echo "Generating terminfo man pages" + ${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET} + +CLEANFILES+= terminfo.5 + +man: terminfo.5 + +.include + +.if ${MKLINKLIB} != "no" +SYMLINKS+= libterminfo.a ${LIBDIR}/libtermcap.a +SYMLINKS+= libterminfo.a ${LIBDIR}/libtermlib.a +.endif + +.if ${MKPROFILE} != "no" +SYMLINKS+= libterminfo_p.a ${LIBDIR}/libtermcap_p.a +SYMLINKS+= libterminfo_p.a ${LIBDIR}/libtermlib_p.a +.endif + +.if ${MKPIC} != "no" + +.if ${MKPICINSTALL} != "no" +SYMLINKS+= libterminfo_pic.a ${LIBDIR}/libtermcap_pic.a +SYMLINKS+= libterminfo_pic.a ${LIBDIR}/libtermlib_pic.a +.endif + +.if exists(${.CURDIR}/shlib_version) +SYMLINKS+= libterminfo.so.${SHLIB_FULLVERSION} \ + ${_LIBSODIR}/libtermcap.so.0.6 +SYMLINKS+= libterminfo.so.${SHLIB_FULLVERSION} \ + ${_LIBSODIR}/libtermlib.so.0.6 +.if ${_LIBSODIR} != ${LIBDIR} +SYMLINKS+= libterminfo.so.${SHLIB_FULLVERSION} \ + ${LIBDIR}/libtermcap.so.0.6 +SYMLINKS+= libterminfo.so.${SHLIB_FULLVERSION} \ + ${LIBDIR}/libtermlib.so.0.6 +.endif + +SYMLINKS+= libterminfo.so.${SHLIB_MAJOR} \ + ${_LIBSODIR}/libtermcap.so.0 +SYMLINKS+= libterminfo.so ${_LIBSODIR}/libtermcap.so +SYMLINKS+= libterminfo.so.${SHLIB_MAJOR} \ + ${_LIBSODIR}/libtermlib.so.0 +SYMLINKS+= libterminfo.so ${_LIBSODIR}/libtermlib.so +.if ${_LIBSODIR} != ${LIBDIR} +SYMLINKS+= libterminfo.so.${SHLIB_MAJOR} \ + ${LIBDIR}/libtermcap.so.0 +SYMLINKS+= libterminfo.so ${LIBDIR}/libtermcap.so +SYMLINKS+= libterminfo.so.${SHLIB_MAJOR} \ + ${LIBDIR}/libtermlib.so.0 +SYMLINKS+= libterminfo.so ${LIBDIR}/libtermlib.so +.endif +.endif # exists shlib_version + +.endif # ${MKPIC} != "no" + +.include diff --git a/vendor/netbsd-curses/libterminfo/Makefile.hash b/vendor/netbsd-curses/libterminfo/Makefile.hash new file mode 100644 index 0000000..1bea657 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/Makefile.hash @@ -0,0 +1,32 @@ +# $NetBSD: Makefile.hash,v 1.7 2013/01/24 14:17:40 roy Exp $ + +SCRIPT_ENV= \ + NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ + TOOL_AWK=${TOOL_AWK:Q} \ + TOOL_NBPERF=${TOOL_NBPERF:Q} \ + TOOL_SED=${TOOL_SED:Q} \ + TOOL_SORT=${TOOL_SORT:Q} \ + TOOL_TIC=${TOOL_TIC:Q} + +PARSEDIR:=${.PARSEDIR} +# Generate our string and hash tables +hash.c: genhash term.h + @echo "Generating terminfo hash" + ${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET} + +termcap_hash.c: genthash termcap_map.c + @echo "Generating termcap hash" + ${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET} + +# Allow terminfo descriptions to be compiled into libterminfo +compiled_terms.c: genterms term.h ${NETBSDSRCDIR}/share/terminfo/terminfo + @echo "Generating compiled terminfo descriptions" + ${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET} + +.if ${USETOOLS} == "yes" +compiled_terms.c: ${TOOL_TIC} +.endif + +DPSRCS+= hash.c termcap_hash.c compiled_terms.c + +CLEANFILES+= hash.c termcap_hash.c compiled_terms.c diff --git a/vendor/netbsd-curses/libterminfo/cdbr.c b/vendor/netbsd-curses/libterminfo/cdbr.c new file mode 100644 index 0000000..18ca4af --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/cdbr.c @@ -0,0 +1,314 @@ +/* $NetBSD: cdbr.c,v 1.1 2013/12/11 01:24:08 joerg Exp $ */ +/*- + * Copyright (c) 2010 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +#include + +#if !defined(_KERNEL) && !defined(_STANDALONE) +//#include "namespace.h" +#endif + +#if !HAVE_NBTOOL_CONFIG_H +//#include +#endif +#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H +#include +#endif + +#if defined(_KERNEL) || defined(_STANDALONE) +#include +#include +#include +#include +#define SET_ERRNO(val) +#define malloc(size) kmem_alloc(size, KM_SLEEP) +#define free(ptr) kmem_free(ptr, sizeof(struct cdbr)) +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define SET_ERRNO(val) errno = (val) +#endif + +#if !defined(_KERNEL) && !defined(_STANDALONE) +#ifdef __weak_alias +__weak_alias(cdbr_close,_cdbr_close) +__weak_alias(cdbr_find,_cdbr_find) +__weak_alias(cdbr_get,_cdbr_get) +__weak_alias(cdbr_open,_cdbr_open) +__weak_alias(cdbr_open_mem,_cdbr_open_mem) +#endif +#endif + +#if 1 || HAVE_NBTOOL_CONFIG_H +#define fast_divide32_prepare(d,m,s1,s2) (void)0 +#define fast_remainder32(v,d,m,s1,s2) (v%d) +#endif +extern void mi_vector_hash(const void *restrict, size_t, uint32_t, uint32_t[3]); +struct cdbr { + void (*unmap)(void *, void *, size_t); + void *cookie; + uint8_t *mmap_base; + size_t mmap_size; + + uint8_t *hash_base; + uint8_t *offset_base; + uint8_t *data_base; + + uint32_t data_size; + uint32_t entries; + uint32_t entries_index; + uint32_t seed; + + uint8_t offset_size; + uint8_t index_size; + + uint32_t entries_m; + uint32_t entries_index_m; + uint8_t entries_s1, entries_s2; + uint8_t entries_index_s1, entries_index_s2; +}; + +#if !defined(_KERNEL) && !defined(_STANDALONE) +static void +cdbr_unmap(void *cookie, void *base, size_t size) +{ + (void)cookie; + munmap(base, size); +} + +/* ARGSUSED */ +struct cdbr * +cdbr_open(const char *path, int flags) +{ + void *base; + size_t size; + int fd; + struct cdbr *cdbr; + struct stat sb; + + if ((fd = open(path, O_RDONLY)) == -1) + return NULL; + if (fstat(fd, &sb) == -1) { + close(fd); + return NULL; + } + + if (sb.st_size >= SSIZE_MAX) { + close(fd); + SET_ERRNO(EINVAL); + return NULL; + } + + + size = (size_t)sb.st_size; + base = mmap(NULL, size, PROT_READ, MAP_FILE|MAP_SHARED, fd, 0); + close(fd); + + if (base == MAP_FAILED) + return NULL; + + cdbr = cdbr_open_mem(base, size, flags, cdbr_unmap, NULL); + if (cdbr == NULL) + munmap(base, size); + return cdbr; +} +#endif + +struct cdbr * +cdbr_open_mem(void *base, size_t size, int flags, + void (*unmap)(void *, void *, size_t), void *cookie) +{ + struct cdbr *cdbr; + uint8_t *buf = base; + if (size < 40 || memcmp(buf, "NBCDB\n\0\001", 8)) { + SET_ERRNO(EINVAL); + return NULL; + } + + cdbr = malloc(sizeof(*cdbr)); + cdbr->unmap = unmap; + cdbr->cookie = cookie; + + cdbr->data_size = le32dec(buf + 24); + cdbr->entries = le32dec(buf + 28); + cdbr->entries_index = le32dec(buf + 32); + cdbr->seed = le32dec(buf + 36); + + if (cdbr->data_size < 0x100) + cdbr->offset_size = 1; + else if (cdbr->data_size < 0x10000) + cdbr->offset_size = 2; + else + cdbr->offset_size = 4; + + if (cdbr->entries_index < 0x100) + cdbr->index_size = 1; + else if (cdbr->entries_index < 0x10000) + cdbr->index_size = 2; + else + cdbr->index_size = 4; + + cdbr->mmap_base = base; + cdbr->mmap_size = size; + + cdbr->hash_base = cdbr->mmap_base + 40; + cdbr->offset_base = cdbr->hash_base + cdbr->entries_index * cdbr->index_size; + if (cdbr->entries_index * cdbr->index_size % cdbr->offset_size) + cdbr->offset_base += cdbr->offset_size - + cdbr->entries_index * cdbr->index_size % cdbr->offset_size; + cdbr->data_base = cdbr->offset_base + (cdbr->entries + 1) * cdbr->offset_size; + + if (cdbr->hash_base < cdbr->mmap_base || + cdbr->offset_base < cdbr->mmap_base || + cdbr->data_base < cdbr->mmap_base || + cdbr->data_base + cdbr->data_size < cdbr->mmap_base || + cdbr->data_base + cdbr->data_size > + cdbr->mmap_base + cdbr->mmap_size) { + SET_ERRNO(EINVAL); + free(cdbr); + return NULL; + } + + if (cdbr->entries) { + fast_divide32_prepare(cdbr->entries, &cdbr->entries_m, + &cdbr->entries_s1, &cdbr->entries_s2); + } + if (cdbr->entries_index) { + fast_divide32_prepare(cdbr->entries_index, + &cdbr->entries_index_m, + &cdbr->entries_index_s1, &cdbr->entries_index_s2); + } + + return cdbr; +} + +static inline uint32_t +get_uintX(const uint8_t *addr, uint32_t idx, int size) +{ + addr += idx * size; + + if (size == 4) + return /* LINTED */le32toh(*(const uint32_t *)addr); + else if (size == 2) + return /* LINTED */le16toh(*(const uint16_t *)addr); + else + return *addr; +} + +uint32_t +cdbr_entries(struct cdbr *cdbr) +{ + + return cdbr->entries; +} + +int +cdbr_get(struct cdbr *cdbr, uint32_t idx, const void **data, size_t *data_len) +{ + uint32_t start, end; + + if (idx >= cdbr->entries) { + SET_ERRNO(EINVAL); + return -1; + } + + start = get_uintX(cdbr->offset_base, idx, cdbr->offset_size); + end = get_uintX(cdbr->offset_base, idx + 1, cdbr->offset_size); + + if (start > end) { + SET_ERRNO(EIO); + return -1; + } + + if (end > cdbr->data_size) { + SET_ERRNO(EIO); + return -1; + } + + *data = cdbr->data_base + start; + *data_len = end - start; + + return 0; +} + +int +cdbr_find(struct cdbr *cdbr, const void *key, size_t key_len, + const void **data, size_t *data_len) +{ + uint32_t hashes[3], idx; + + if (cdbr->entries_index == 0) { + SET_ERRNO(EINVAL); + return -1; + } + + mi_vector_hash(key, key_len, cdbr->seed, hashes); + + hashes[0] = fast_remainder32(hashes[0], cdbr->entries_index, + cdbr->entries_index_m, cdbr->entries_index_s1, + cdbr->entries_index_s2); + hashes[1] = fast_remainder32(hashes[1], cdbr->entries_index, + cdbr->entries_index_m, cdbr->entries_index_s1, + cdbr->entries_index_s2); + hashes[2] = fast_remainder32(hashes[2], cdbr->entries_index, + cdbr->entries_index_m, cdbr->entries_index_s1, + cdbr->entries_index_s2); + + idx = get_uintX(cdbr->hash_base, hashes[0], cdbr->index_size); + idx += get_uintX(cdbr->hash_base, hashes[1], cdbr->index_size); + idx += get_uintX(cdbr->hash_base, hashes[2], cdbr->index_size); + + return cdbr_get(cdbr, fast_remainder32(idx, cdbr->entries, + cdbr->entries_m, cdbr->entries_s1, cdbr->entries_s2), data, + data_len); +} + +void +cdbr_close(struct cdbr *cdbr) +{ + if (cdbr->unmap) + (*cdbr->unmap)(cdbr->cookie, cdbr->mmap_base, cdbr->mmap_size); + free(cdbr); +} diff --git a/vendor/netbsd-curses/libterminfo/compile.c b/vendor/netbsd-curses/libterminfo/compile.c new file mode 100644 index 0000000..8ba097d --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/compile.c @@ -0,0 +1,815 @@ +/* $NetBSD: compile.c,v 1.26 2020/06/21 15:05:23 roy Exp $ */ + +/* + * Copyright (c) 2009, 2010, 2011, 2020 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#undef _GNU_SOURCE +#define _GNU_SOURCE +#undef _XOPEN_SOURCE +#define _XOPEN_SOURCE 700 + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void __printflike(2, 3) +dowarn(int flags, const char *fmt, ...) +{ + va_list va; + + errno = EINVAL; + if (flags & TIC_WARNING) { + va_start(va, fmt); + vwarnx(fmt, va); + va_end(va); + } +} + +#ifdef TERMINFO_COMPAT +int +_ti_promote(TIC *tic) +{ + char *obuf, type, flag, *buf, *delim, *name, *nbuf; + const char *cap, *code, *str; + size_t n, entries, strl; + uint16_t ind; + int num, ortype, error = 0; + + ortype = tic->rtype; + tic->rtype = TERMINFO_RTYPE; + obuf = tic->name; + tic->name = _ti_getname(tic->rtype, tic->name); + if (tic->name == NULL) { + warn("_ti_getname"); + tic->name = obuf; + return -1; + } + free(obuf); + + n = 0; + obuf = buf = tic->alias; + tic->alias = NULL; + while (buf != NULL) { + delim = strchr(buf, '|'); + if (delim != NULL) + *delim++ = '\0'; + name = _ti_getname(tic->rtype, buf); + strl = strlen(name) + 1; + nbuf = realloc(tic->alias, n + strl); + if (nbuf == NULL) { + free(name); + return -1; + } + tic->alias = nbuf; + memcpy(tic->alias + n, name, strl); + n += strl; + free(name); + buf = delim; + } + free(obuf); + + obuf = tic->nums.buf; + cap = obuf; + entries = tic->nums.entries; + tic->nums.buf = NULL; + tic->nums.entries = tic->nums.buflen = tic->nums.bufpos = 0; + for (n = entries; n > 0; n--) { + ind = _ti_decode_16(&cap); + num = _ti_decode_num(&cap, ortype); + if (VALID_NUMERIC(num) && + !_ti_encode_buf_id_num(&tic->nums, ind, num, + _ti_numsize(tic))) + { + warn("promote num"); + error = -1; + break; + } + } + free(obuf); + + obuf = tic->extras.buf; + cap = obuf; + entries = tic->extras.entries; + tic->extras.buf = NULL; + tic->extras.entries = tic->extras.buflen = tic->extras.bufpos = 0; + for (n = entries; n > 0; n--) { + num = _ti_decode_16(&cap); + flag = 0; /* satisfy gcc, won't be used for non flag types */ + str = NULL; /* satisfy gcc, won't be used as strl is 0 */ + strl = 0; + code = cap; + cap += num; + type = *cap++; + switch (type) { + case 'f': + flag = *cap++; + break; + case 'n': + num = _ti_decode_num(&cap, ortype); + break; + case 's': + strl = _ti_decode_16(&cap); + str = cap; + cap += strl; + break; + default: + errno = EINVAL; + break; + } + if (!_ti_store_extra(tic, 0, code, type, flag, num, + str, strl, TIC_EXTRA)) + { + error = -1; + break; + } + } + free(obuf); + + return error; +} +#endif + +char * +_ti_grow_tbuf(TBUF *tbuf, size_t len) +{ + char *buf; + size_t l; + + _DIAGASSERT(tbuf != NULL); + + l = tbuf->bufpos + len; + if (l > tbuf->buflen) { + if (tbuf->buflen == 0) + buf = malloc(l); + else + buf = realloc(tbuf->buf, l); + if (buf == NULL) + return NULL; + tbuf->buf = buf; + tbuf->buflen = l; + } + return tbuf->buf; +} + +const char * +_ti_find_cap(TIC *tic, TBUF *tbuf, char type, short ind) +{ + size_t n; + uint16_t num; + const char *cap; + + _DIAGASSERT(tbuf != NULL); + + cap = tbuf->buf; + for (n = tbuf->entries; n > 0; n--) { + num = _ti_decode_16(&cap); + if ((short)num == ind) + return cap; + switch (type) { + case 'f': + cap++; + break; + case 'n': + cap += _ti_numsize(tic); + break; + case 's': + num = _ti_decode_16(&cap); + cap += num; + break; + } + } + + errno = ESRCH; + return NULL; +} + +const char * +_ti_find_extra(TIC *tic, TBUF *tbuf, const char *code) +{ + size_t n; + uint16_t num; + const char *cap; + + _DIAGASSERT(tbuf != NULL); + _DIAGASSERT(code != NULL); + + cap = tbuf->buf; + for (n = tbuf->entries; n > 0; n--) { + num = _ti_decode_16(&cap); + if (strcmp(cap, code) == 0) + return cap + num; + cap += num; + switch (*cap++) { + case 'f': + cap++; + break; + case 'n': + cap += _ti_numsize(tic); + break; + case 's': + num = _ti_decode_16(&cap); + cap += num; + break; + } + } + + errno = ESRCH; + return NULL; +} + +char * +_ti_getname(int rtype, const char *orig) +{ +#ifdef TERMINFO_COMPAT + const char *delim; + char *name; + const char *verstr; + size_t diff, vlen; + + switch (rtype) { + case TERMINFO_RTYPE: + verstr = TERMINFO_VDELIMSTR "v3"; + break; + case TERMINFO_RTYPE_O1: + verstr = ""; + break; + default: + errno = EINVAL; + return NULL; + } + + delim = orig; + while (*delim != '\0' && *delim != TERMINFO_VDELIM) + delim++; + diff = delim - orig; + vlen = strlen(verstr); + name = malloc(diff + vlen + 1); + if (name == NULL) + return NULL; + + memcpy(name, orig, diff); + memcpy(name + diff, verstr, vlen + 1); + return name; +#else + return strdup(orig); +#endif +} + +size_t +_ti_store_extra(TIC *tic, int wrn, const char *id, char type, char flag, + int num, const char *str, size_t strl, int flags) +{ + size_t l, capl; + + _DIAGASSERT(tic != NULL); + + if (strcmp(id, "use") != 0) { + if (_ti_find_extra(tic, &tic->extras, id) != NULL) + return 0; + if (!(flags & TIC_EXTRA)) { + if (wrn != 0) + dowarn(flags, "%s: %s: unknown capability", + tic->name, id); + return 0; + } + } + + l = strlen(id) + 1; + if (l > UINT16_MAX) { + dowarn(flags, "%s: %s: cap name is too long", tic->name, id); + return 0; + } + + capl = sizeof(uint16_t) + l + 1; + switch (type) { + case 'f': + capl++; + break; + case 'n': + capl += _ti_numsize(tic); + break; + case 's': + capl += sizeof(uint16_t) + strl; + break; + } + + if (!_ti_grow_tbuf(&tic->extras, capl)) + return 0; + _ti_encode_buf_count_str(&tic->extras, id, l); + tic->extras.buf[tic->extras.bufpos++] = type; + switch (type) { + case 'f': + tic->extras.buf[tic->extras.bufpos++] = flag; + break; + case 'n': + _ti_encode_buf_num(&tic->extras, num, tic->rtype); + break; + case 's': + _ti_encode_buf_count_str(&tic->extras, str, strl); + break; + } + tic->extras.entries++; + return 1; +} + +static void +_ti_encode_buf(char **cap, const TBUF *buf) +{ + if (buf->entries == 0) { + _ti_encode_16(cap, 0); + } else { + _ti_encode_16(cap, buf->bufpos + sizeof(uint16_t)); + _ti_encode_16(cap, buf->entries); + _ti_encode_str(cap, buf->buf, buf->bufpos); + } +} + +ssize_t +_ti_flatten(uint8_t **buf, const TIC *tic) +{ + size_t buflen, len, alen, dlen; + char *cap; + + _DIAGASSERT(buf != NULL); + _DIAGASSERT(tic != NULL); + + len = strlen(tic->name) + 1; + if (tic->alias == NULL) + alen = 0; + else + alen = strlen(tic->alias) + 1; + if (tic->desc == NULL) + dlen = 0; + else + dlen = strlen(tic->desc) + 1; + + buflen = sizeof(char) + + sizeof(uint16_t) + len + + sizeof(uint16_t) + alen + + sizeof(uint16_t) + dlen + + (sizeof(uint16_t) * 2) + tic->flags.bufpos + + (sizeof(uint16_t) * 2) + tic->nums.bufpos + + (sizeof(uint16_t) * 2) + tic->strs.bufpos + + (sizeof(uint16_t) * 2) + tic->extras.bufpos; + + *buf = malloc(buflen); + if (*buf == NULL) + return -1; + + cap = (char *)*buf; + *cap++ = tic->rtype; + + _ti_encode_count_str(&cap, tic->name, len); + _ti_encode_count_str(&cap, tic->alias, alen); + _ti_encode_count_str(&cap, tic->desc, dlen); + + _ti_encode_buf(&cap, &tic->flags); + + _ti_encode_buf(&cap, &tic->nums); + _ti_encode_buf(&cap, &tic->strs); + _ti_encode_buf(&cap, &tic->extras); + + return (uint8_t *)cap - *buf; +} + +static int +encode_string(const char *term, const char *cap, TBUF *tbuf, const char *str, + int flags) +{ + int slash, i, num; + char ch, *p, *s, last; + + if (_ti_grow_tbuf(tbuf, strlen(str) + 1) == NULL) + return -1; + p = s = tbuf->buf + tbuf->bufpos; + slash = 0; + last = '\0'; + /* Convert escape codes */ + while ((ch = *str++) != '\0') { + if (ch == '\n') { + /* Following a newline, strip leading whitespace from + * capability strings. */ + while (isspace((unsigned char)*str)) + str++; + continue; + } + if (slash == 0 && ch == '\\') { + slash = 1; + continue; + } + if (slash == 0) { + if (last != '%' && ch == '^') { + ch = *str++; + if (((unsigned char)ch) >= 128) + dowarn(flags, + "%s: %s: illegal ^ character", + term, cap); + if (ch == '\0') + break; + if (ch == '?') + ch = '\177'; + else if ((ch &= 037) == 0) + ch = (char)128; + } else if (!isprint((unsigned char)ch)) + dowarn(flags, + "%s: %s: unprintable character", + term, cap); + *p++ = ch; + last = ch; + continue; + } + slash = 0; + if (ch >= '0' && ch <= '7') { + num = ch - '0'; + for (i = 0; i < 2; i++) { + if (*str < '0' || *str > '7') { + if (isdigit((unsigned char)*str)) + dowarn(flags, + "%s: %s: non octal" + " digit", term, cap); + else + break; + } + num = num * 8 + *str++ - '0'; + } + if (num == 0) + num = 0200; + *p++ = (char)num; + continue; + } + switch (ch) { + case 'a': + *p++ = '\a'; + break; + case 'b': + *p++ = '\b'; + break; + case 'e': /* FALLTHROUGH */ + case 'E': + *p++ = '\033'; + break; + case 'f': + *p++ = '\014'; + break; + case 'l': /* FALLTHROUGH */ + case 'n': + *p++ = '\n'; + break; + case 'r': + *p++ = '\r'; + break; + case 's': + *p++ = ' '; + break; + case 't': + *p++ = '\t'; + break; + default: + /* We should warn here */ + case '^': + case ',': + case ':': + case '|': + *p++ = ch; + break; + } + last = ch; + } + *p++ = '\0'; + tbuf->bufpos += (size_t)(p - s); + return 0; +} + +char * +_ti_get_token(char **cap, char sep) +{ + char esc, *token; + + while (isspace((unsigned char)**cap)) + (*cap)++; + if (**cap == '\0') + return NULL; + + /* We can't use stresep(3) as ^ we need two escape chars */ + esc = '\0'; + for (token = *cap; + **cap != '\0' && (esc != '\0' || **cap != sep); + (*cap)++) + { + if (esc == '\0') { + if (**cap == '\\' || **cap == '^') + esc = **cap; + } else { + /* termcap /E/ is valid */ + if (sep == ':' && esc == '\\' && **cap == 'E') + esc = 'x'; + else + esc = '\0'; + } + } + + if (**cap != '\0') + *(*cap)++ = '\0'; + + return token; +} + +int +_ti_encode_buf_id_num(TBUF *tbuf, int ind, int num, size_t len) +{ + if (!_ti_grow_tbuf(tbuf, sizeof(uint16_t) + len)) + return 0; + _ti_encode_buf_16(tbuf, ind); + if (len == sizeof(uint32_t)) + _ti_encode_buf_32(tbuf, (uint32_t)num); + else + _ti_encode_buf_16(tbuf, (uint16_t)num); + tbuf->entries++; + return 1; +} + +int +_ti_encode_buf_id_count_str(TBUF *tbuf, int ind, const void *buf, size_t len) +{ + if (!_ti_grow_tbuf(tbuf, 2 * sizeof(uint16_t) + len)) + return 0; + _ti_encode_buf_16(tbuf, ind); + _ti_encode_buf_count_str(tbuf, buf, len); + tbuf->entries++; + return 1; +} + +int +_ti_encode_buf_id_flags(TBUF *tbuf, int ind, int flag) +{ + if (!_ti_grow_tbuf(tbuf, sizeof(uint16_t) + 1)) + return 0; + _ti_encode_buf_16(tbuf, ind); + tbuf->buf[tbuf->bufpos++] = flag; + tbuf->entries++; + return 1; +} + +TIC * +_ti_compile(char *cap, int flags) +{ + char *token, *p, *e, *name, *desc, *alias; + signed char flag; + long cnum; + short ind; + int num; + size_t len; + TBUF buf; + TIC *tic; + + _DIAGASSERT(cap != NULL); + + name = _ti_get_token(&cap, ','); + if (name == NULL) { + dowarn(flags, "no separator found: %s", cap); + return NULL; + } + desc = strrchr(name, '|'); + if (desc != NULL) + *desc++ = '\0'; + alias = strchr(name, '|'); + if (alias != NULL) + *alias++ = '\0'; + + if (strlen(name) > UINT16_MAX - 1) { + dowarn(flags, "%s: name too long", name); + return NULL; + } + if (desc != NULL && strlen(desc) > UINT16_MAX - 1) { + dowarn(flags, "%s: description too long: %s", name, desc); + return NULL; + } + if (alias != NULL && strlen(alias) > UINT16_MAX - 1) { + dowarn(flags, "%s: alias too long: %s", name, alias); + return NULL; + } + + tic = calloc(sizeof(*tic), 1); + if (tic == NULL) + return NULL; + +#ifdef TERMINFO_COMPAT + tic->rtype = TERMINFO_RTYPE_O1; /* will promote if needed */ +#else + tic->rtype = TERMINFO_RTYPE; +#endif + buf.buf = NULL; + buf.buflen = 0; + + tic->name = _ti_getname(tic->rtype, name); + if (tic->name == NULL) + goto error; + if (alias != NULL && flags & TIC_ALIAS) { + tic->alias = _ti_getname(tic->rtype, alias); + if (tic->alias == NULL) + goto error; + } + if (desc != NULL && flags & TIC_DESCRIPTION) { + tic->desc = strdup(desc); + if (tic->desc == NULL) + goto error; + } + + for (token = _ti_get_token(&cap, ','); + token != NULL && *token != '\0'; + token = _ti_get_token(&cap, ',')) + { + /* Skip commented caps */ + if (!(flags & TIC_COMMENT) && token[0] == '.') + continue; + + /* Obsolete entries */ + if (token[0] == 'O' && token[1] == 'T') { + if (!(flags & TIC_EXTRA)) + continue; + token += 2; + } + + /* str cap */ + p = strchr(token, '='); + if (p != NULL) { + *p++ = '\0'; + /* Don't use the string if we already have it */ + ind = (short)_ti_strindex(token); + if (ind != -1 && + _ti_find_cap(tic, &tic->strs, 's', ind) != NULL) + continue; + + /* Encode the string to our scratch buffer */ + buf.bufpos = 0; + if (encode_string(tic->name, token, + &buf, p, flags) == -1) + goto error; + if (buf.bufpos > UINT16_MAX - 1) { + dowarn(flags, "%s: %s: string is too long", + tic->name, token); + continue; + } + if (!VALID_STRING(buf.buf)) { + dowarn(flags, "%s: %s: invalid string", + tic->name, token); + continue; + } + + if (ind == -1) { + if (!_ti_store_extra(tic, 1, token, 's', -1, -2, + buf.buf, buf.bufpos, flags)) + goto error; + } else { + if (!_ti_encode_buf_id_count_str(&tic->strs, + ind, buf.buf, buf.bufpos)) + goto error; + } + continue; + } + + /* num cap */ + p = strchr(token, '#'); + if (p != NULL) { + *p++ = '\0'; + /* Don't use the number if we already have it */ + ind = (short)_ti_numindex(token); + if (ind != -1 && + _ti_find_cap(tic, &tic->nums, 'n', ind) != NULL) + continue; + + cnum = strtol(p, &e, 0); + if (*e != '\0') { + dowarn(flags, "%s: %s: not a number", + tic->name, token); + continue; + } + if (!VALID_NUMERIC(cnum) || cnum > INT32_MAX) { + dowarn(flags, "%s: %s: number %ld out of range", + tic->name, token, cnum); + continue; + } + if (cnum > INT16_MAX) { + if (flags & TIC_COMPAT_V1) + cnum = INT16_MAX; + else if (tic->rtype == TERMINFO_RTYPE_O1) + if (_ti_promote(tic) == -1) + goto error; + } + + num = (int)cnum; + if (ind == -1) { + if (!_ti_store_extra(tic, 1, token, 'n', -1, + num, NULL, 0, flags)) + goto error; + } else { + if (!_ti_encode_buf_id_num(&tic->nums, + ind, num, _ti_numsize(tic))) + goto error; + } + continue; + } + + flag = 1; + len = strlen(token) - 1; + if (token[len] == '@') { + flag = CANCELLED_BOOLEAN; + token[len] = '\0'; + } + ind = (short)_ti_flagindex(token); + if (ind == -1 && flag == CANCELLED_BOOLEAN) { + if ((ind = (short)_ti_numindex(token)) != -1) { + if (_ti_find_cap(tic, &tic->nums, 'n', ind) + != NULL) + continue; + if (!_ti_encode_buf_id_num(&tic->nums, ind, + CANCELLED_NUMERIC, _ti_numsize(tic))) + goto error; + continue; + } else if ((ind = (short)_ti_strindex(token)) != -1) { + if (_ti_find_cap(tic, &tic->strs, 's', ind) + != NULL) + continue; + if (!_ti_encode_buf_id_num( + &tic->strs, ind, 0, sizeof(uint16_t))) + goto error; + continue; + } + } + if (ind == -1) { + if (!_ti_store_extra(tic, 1, token, 'f', flag, 0, NULL, + 0, flags)) + goto error; + } else if (_ti_find_cap(tic, &tic->flags, 'f', ind) == NULL) { + if (!_ti_encode_buf_id_flags(&tic->flags, ind, flag)) + goto error; + } + } + + free(buf.buf); + return tic; + +error: + free(buf.buf); + _ti_freetic(tic); + return NULL; +} + +void +_ti_freetic(TIC *tic) +{ + + if (tic != NULL) { + free(tic->name); + free(tic->alias); + free(tic->desc); + free(tic->extras.buf); + free(tic->flags.buf); + free(tic->nums.buf); + free(tic->strs.buf); + free(tic); + } +} diff --git a/vendor/netbsd-curses/libterminfo/curterm.c b/vendor/netbsd-curses/libterminfo/curterm.c new file mode 100644 index 0000000..e15a845 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/curterm.c @@ -0,0 +1,167 @@ +/* $NetBSD: curterm.c,v 1.14 2020/05/30 16:03:58 roy Exp $ */ + +/* + * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +TERMINAL *cur_term; + +/* + * There is no standard way of getting a list of aliases for the + * terminal. However, some applications such as telnet want to know this. + * ncurses dumps the terminfo header into an undefined variable ttytype + * and these applications then parse it to work out the aliases. + * We should do the same for now, until a standard mechanism for getting + * the information is available or the need for it goes away. + */ +#define NAMESIZE 256 +char ttytype[NAMESIZE]; + +static const speed_t bauds[] = { + 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 2400, 4800, 9600, + 19200, 38400, 57600, 115200, 230400, 460800, 921600 +}; + +void +_ti_setospeed(TERMINAL *term) +{ + struct termios termios; + speed_t os; + size_t i; + + _DIAGASSERT(term != NULL); + + term->_ospeed = 0; + if (tcgetattr(term->fildes, &termios) == 0) { + os = cfgetospeed(&termios); + for (i = 0; i < __arraycount(bauds); i++) + if (bauds[i] == os) { + term->_ospeed = (short)i; + break; + } + } +} + +TERMINAL * +set_curterm(TERMINAL *nterm) +{ + TERMINAL *oterm; + size_t l; + int n; + char *p; + + oterm = cur_term; + cur_term = nterm; + + ospeed = 0; + if (cur_term == NULL) + PC = '\0'; + else { + if (pad_char == NULL) + PC = '\0'; + else + PC = *pad_char; + _ti_setospeed(nterm); + ospeed = nterm->_ospeed; + + p = ttytype; + l = sizeof(ttytype); + if ((n = snprintf(p, l, "%s", nterm->name)) < l) { + p += n; + l -= n; + *p++ = '|'; + l--; + if (nterm->_alias && + (n = snprintf(p, l, "%s", nterm->_alias)) < l) + { + p += n; + l -= n; + *p++ = '|'; + l--; + } + if (nterm->desc && + (n = snprintf(p, l, "%s", nterm->desc)) < l) + { + p += n; + l -= n; + *p++ = '|'; + l--; + } + p--; + } + *p = '\0'; + } + + return oterm; +} + +int +del_curterm(TERMINAL *oterm) +{ + + if (oterm == NULL) + return ERR; + free(oterm->_area); + free(oterm->strs); + free(oterm->nums); + free(oterm->flags); + free(oterm->_userdefs); + free(oterm->_buf); + free(oterm); + if (oterm == cur_term) + cur_term = NULL; + return OK; +} + +char * +termname(void) +{ + + _DIAGASSERT(cur_term != NULL); + return __UNCONST(cur_term->name); +} + +static const char * nullname = ""; + +char * +longname(void) +{ + + _DIAGASSERT(cur_term != NULL); + if (cur_term->desc == NULL) + return __UNCONST(nullname); + return __UNCONST(cur_term->desc); +} diff --git a/vendor/netbsd-curses/libterminfo/del_curterm.3 b/vendor/netbsd-curses/libterminfo/del_curterm.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/del_curterm.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/genhash b/vendor/netbsd-curses/libterminfo/genhash new file mode 100755 index 0000000..96be8e1 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/genhash @@ -0,0 +1,108 @@ +#!/bin/sh +# $NetBSD: genhash,v 1.9 2017/01/11 20:53:52 roy Exp $ + +# Copyright (c) 2009, 2011 The NetBSD Foundation, Inc. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Roy Marples. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +# Generate string and hash tables for our terminfo strings in term.h +# We don't expose the hash or tables directly, but instead via functions. +# This allows us to freely change how we hash or store our string tables +# in the future. + +set -e +: ${TOOL_AWK:=awk} +: ${TOOL_NBPERF:=nbperf} +: ${TOOL_SED:=sed} + +TERMH=${1:-term.h} + +genent() +{ + local name=$1 NAME=$2 len= + + # Calculate the maximum word length plus terminator + len=$($TOOL_SED -e "1,/enum TI${NAME}/d" -e '/};/,$d' \ + -e 's/.*TICODE_\([^,]*\).*/\1X/' $TERMH | \ + $TOOL_AWK \ + 'BEGIN {L=0} {if (length($1)>L) L=length($1)} END {print L}') + + echo + echo "static const char _ti_${name}ids[][${len}] = {" + $TOOL_SED -e "1,/enum TI${NAME}/d" -e '/};/,$d' \ + -e 's/.*TICODE_\([^,]*\).*/ "\1",/' $TERMH + echo "};" + echo + $TOOL_SED -e "1,/enum TI${NAME}/d" -e '/};/,$d' \ + -e 's/.*TICODE_\([^,]*\).*/\1/' $TERMH | \ + $TOOL_NBPERF -p -s -n _ti_${name}hash; + + cat <= __arraycount(_ti_${name}ids)) + return NULL; + return _ti_${name}ids[idx]; +} + +ssize_t +_ti_${name}index(const char *key) +{ + uint32_t idx; + + idx = _ti_${name}hash((const unsigned char *)key, strlen(key)); + if (idx >= __arraycount(_ti_${name}ids) || + strcmp(key, _ti_${name}ids[idx]) != 0) + return -1; + return idx; +} +EOF +} + +cat < +#include +#include +#include +#include +#ifndef __arraycount +#define __arraycount(a) (sizeof(a) / sizeof(*(a))) +#endif +extern void mi_vector_hash(const void *restrict, size_t, uint32_t, uint32_t[3]); +EOF + +genent flag FLAG +genent num NUM +genent str STR diff --git a/vendor/netbsd-curses/libterminfo/genman b/vendor/netbsd-curses/libterminfo/genman new file mode 100755 index 0000000..ac95e84 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/genman @@ -0,0 +1,70 @@ +#!/bin/sh +# $NetBSD: genman,v 1.5 2013/01/25 12:52:45 roy Exp $ + +# Copyright (c) 2009, 2013 The NetBSD Foundation, Inc. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Roy Marples. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +# Generate variable tables for terminfo.5 from our source files. + +set -e +: ${TOOL_SED:=sed} +: ${TOOL_SORT:=sort} + +TERMM=${1:-terminfo.5.in} +TERMH=${2:-term.h} +TERMC=${3:-termcap_map.c} + +gentab() +{ + local ti=$1 tc=$2 tab=$3 + + # Generate a list of long names and codes + $TOOL_SED -n \ + -e "s/#define t_\([^(]*\).*>$tab\[TICODE_\([^]]*\).*/\1 \2/p" \ + $ti | $TOOL_SORT | while read name code foo; do + cap=$($TOOL_SED -ne "s/.*{ \"\(..\)\", TICODE_$code }.*/\1/p" \ + $tc | head -n 1) + desc=$($TOOL_SED -ne "s/ \* $name\: \(.*\)/\1/p" $ti) + echo ".It \"\\&$name\" Ta Sy \"\\&$code\" Ta Sy \"\\&$cap\" Ta \"\\&$desc\"" + done +} + +boolcaps=$(gentab $TERMH $TERMC flags) +numcaps=$(gentab $TERMH $TERMC nums) +strcaps=$(gentab $TERMH $TERMC strs) + +echo ".\\\"DO NOT EDIT" +echo ".\\\"Automatically generated from termcap.5.in" +echo ".\\\"" + +while read -r line; do + case "$line" in + "@BOOLCAPS@") echo "$boolcaps";; + "@NUMCAPS@") echo "$numcaps";; + "@STRCAPS@") echo "$strcaps";; + *) echo "$line";; + esac +done <$TERMM diff --git a/vendor/netbsd-curses/libterminfo/genterms b/vendor/netbsd-curses/libterminfo/genterms new file mode 100755 index 0000000..54bfbc0 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/genterms @@ -0,0 +1,58 @@ +#!/bin/sh +# $NetBSD: genterms,v 1.4 2011/11/02 12:09:25 roy Exp $ + +# Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Roy Marples. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +# Generate compiled terminfo descriptions to embed into libterminfo + +set -e +: ${TOOL_TIC:=tic} +: ${NETBSDSRCDIR:=/usr/src} +: ${TERMINFO:=${TERMINFODIR}/terminfo} + +echo "/* DO NOT EDIT" +echo " * Automatically generated from terminfo */" +echo +TERMLIST=" +xterm +linux +xterm-256color +ansi +dumb +vt100 +screen +screen-256color +tmux-256color +rxvt-unicode +rxvt-unicode-256color +st-256color +dvtm +dvtm-256color +fbpad-256 +" + +${TOOL_TIC} -Sx ${TERMINFO} ${TERMLIST} diff --git a/vendor/netbsd-curses/libterminfo/genthash b/vendor/netbsd-curses/libterminfo/genthash new file mode 100755 index 0000000..d018cb0 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/genthash @@ -0,0 +1,59 @@ +#!/bin/sh +# $NetBSD: genthash,v 1.5 2011/11/02 12:09:25 roy Exp $ + +# Copyright (c) 2009, 2011 The NetBSD Foundation, Inc. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Roy Marples. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +# Generate string and hash tables for our termcap strings in termcap.c + +set -e +: ${TOOL_NBPERF:=nbperf} +: ${TOOL_SED:=sed} + +TERMCAPC=${1:-termcap_map.c} + +cat < +#include +#include +extern void mi_vector_hash(const void *restrict, size_t, uint32_t, uint32_t[3]); + +EOF + +$TOOL_SED -n -e "1,/_ti_cap_flagids/d" -e '/};/,$d' \ + -e 's/.*"\([^"]*\)".*/\1/p' $TERMCAPC | \ + $TOOL_NBPERF -p -s -n _t_flaghash +echo +$TOOL_SED -n -e "1,/_ti_cap_numids/d" -e '/};/,$d' \ + -e 's/.*"\([^"]*\)".*/\1/p' $TERMCAPC | \ + $TOOL_NBPERF -p -s -n _t_numhash +echo +$TOOL_SED -n -e "1,/_ti_cap_strids/d" -e '/};/,$d' \ + -e 's/.*"\([^"]*\)".*/\1/p' $TERMCAPC | \ + $TOOL_NBPERF -p -s -n _t_strhash diff --git a/vendor/netbsd-curses/libterminfo/longname.3 b/vendor/netbsd-curses/libterminfo/longname.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/longname.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/mi_vector_hash.c b/vendor/netbsd-curses/libterminfo/mi_vector_hash.c new file mode 100644 index 0000000..369b1a0 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/mi_vector_hash.c @@ -0,0 +1,179 @@ +/* $NetBSD: mi_vector_hash.c,v 1.1 2013/12/11 01:24:08 joerg Exp $ */ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * See http://burtleburtle.net/bob/hash/doobs.html for the full description + * and the original version of the code. This version differs by exposing + * the full internal state and avoiding byte operations in the inner loop + * if the key is aligned correctly. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +#include + +#if defined(_KERNEL) || defined(_STANDALONE) +#include +#include +#include +#else +//#include "namespace.h" + +#include +#include +#endif + +#define mix(a, b, c) do { \ + a -= b; a -= c; a ^= (c >> 13); \ + b -= c; b -= a; b ^= (a << 8); \ + c -= a; c -= b; c ^= (b >> 13); \ + a -= b; a -= c; a ^= (c >> 12); \ + b -= c; b -= a; b ^= (a << 16); \ + c -= a; c -= b; c ^= (b >> 5); \ + a -= b; a -= c; a ^= (c >> 3); \ + b -= c; b -= a; b ^= (a << 10); \ + c -= a; c -= b; c ^= (b >> 15); \ +} while (/* CONSTCOND */0) + +#define FIXED_SEED 0x9e3779b9 /* Golden ratio, arbitrary constant */ + +#if !defined(_KERNEL) && !defined(_STANDALONE) +#ifdef __weak_alias +__weak_alias(mi_vector_hash, _mi_vector_hash) +#endif +#endif + +void +mi_vector_hash(const void * __restrict key, size_t len, uint32_t seed, + uint32_t hashes[3]) +{ + static const uint32_t mask[4] = { + 0x000000ff, 0x0000ffff, 0x00ffffff, 0xffffffff + }; + uint32_t orig_len, a, b, c; + const uint8_t *k; + + orig_len = (uint32_t)len; + + a = b = FIXED_SEED; + c = seed; + + if ((uintptr_t)key & 3) { + k = key; + while (len >= 12) { + a += le32dec(k); + b += le32dec(k + 4); + c += le32dec(k + 8); + mix(a, b, c); + k += 12; + len -= 12; + } + c += orig_len; + + if (len > 8) { + switch (len) { + case 11: + c += (uint32_t)k[10] << 24; + /* FALLTHROUGH */ + case 10: + c += (uint32_t)k[9] << 16; + /* FALLTHROUGH */ + case 9: + c += (uint32_t)k[8] << 8; + /* FALLTHROUGH */ + } + b += le32dec(k + 4); + a += le32dec(k); + } else if (len > 4) { + switch (len) { + case 8: + b += (uint32_t)k[7] << 24; + /* FALLTHROUGH */ + case 7: + b += (uint32_t)k[6] << 16; + /* FALLTHROUGH */ + case 6: + b += (uint32_t)k[5] << 8; + /* FALLTHROUGH */ + case 5: + b += k[4]; + /* FALLTHROUGH */ + } + a += le32dec(k); + } else if (len) { + switch (len) { + case 4: + a += (uint32_t)k[3] << 24; + /* FALLTHROUGH */ + case 3: + a += (uint32_t)k[2] << 16; + /* FALLTHROUGH */ + case 2: + a += (uint32_t)k[1] << 8; + /* FALLTHROUGH */ + case 1: + a += k[0]; + /* FALLTHROUGH */ + } + } + } else { + const uint32_t *key32 = key; + while (len >= 12) { + a += le32toh(key32[0]); + b += le32toh(key32[1]); + c += le32toh(key32[2]); + mix(a, b, c); + key32 += 3; + len -= 12; + } + c += orig_len; + + if (len > 8) { + c += (le32toh(key32[2]) & mask[len - 9]) << 8; + b += le32toh(key32[1]); + a += le32toh(key32[0]); + } else if (len > 4) { + b += le32toh(key32[1]) & mask[len - 5]; + a += le32toh(key32[0]); + } else if (len) + a += le32toh(key32[0]) & mask[len - 1]; + } + mix(a, b, c); + hashes[0] = a; + hashes[1] = b; + hashes[2] = c; +} diff --git a/vendor/netbsd-curses/libterminfo/putp.3 b/vendor/netbsd-curses/libterminfo/putp.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/putp.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/set_curterm.3 b/vendor/netbsd-curses/libterminfo/set_curterm.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/set_curterm.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/setupterm.3 b/vendor/netbsd-curses/libterminfo/setupterm.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/setupterm.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/setupterm.c b/vendor/netbsd-curses/libterminfo/setupterm.c new file mode 100644 index 0000000..381337f --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/setupterm.c @@ -0,0 +1,168 @@ +/* $NetBSD: setupterm.c,v 1.9 2019/04/11 23:52:08 jakllsch Exp $ */ + +/* + * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * use_env is really a curses function - POSIX mandates it's in curses.h + * But it has to live in terminfo because it must precede a call to setupterm(). + */ +#include + +static bool __use_env = true; + +void +use_env(bool value) +{ + + __use_env = value; +} +#define reterr(code, msg) \ + do { \ + if (errret == NULL) \ + errx(EXIT_FAILURE, msg); \ + else { \ + *errret = code; \ + return ERR; \ + } \ + } while (0 /* CONSTCOND */) + +#define reterrarg(code, msg, arg) \ + do { \ + if (errret == NULL) \ + errx(EXIT_FAILURE, msg, arg); \ + else { \ + *errret = code; \ + return ERR; \ + } \ + } while (0 /* CONSTCOND */) + + +int +ti_setupterm(TERMINAL **nterm, const char *term, int fildes, int *errret) +{ + int error; + char *p; + struct winsize win; + + _DIAGASSERT(nterm != NULL); + + if (term == NULL) + term = getenv("TERM"); + if (term == NULL || *term == '\0') { + *nterm = NULL; + reterr(0, "TERM environment variable not set"); + } + if (fildes == STDOUT_FILENO && !isatty(fildes)) + fildes = STDERR_FILENO; + + *nterm = calloc(1, sizeof(**nterm)); + if (*nterm == NULL) + reterr(-1, "not enough memory to create terminal structure"); + + error = _ti_getterm(*nterm, term, 0); + if (error != 1 && (p = strchr(term, '.'))) { + term = ++p; + /* assert assumption that we don't need to call del_curterm */ + p = (void*) *nterm; + while(p < (char*)((*nterm)+1)) if(*(p++)) assert(0); + error = _ti_getterm(*nterm, term, 0); + } + if (error != 1) { + del_curterm(*nterm); + *nterm = NULL; + switch (error) { + case -1: + reterr(error, "cannot access the terminfo database"); + /* NOTREACHED */ + case 0: + reterrarg(error, + "%s: terminal not listed in terminfo database", + term); + /* NOTREACHED */ + default: + reterr(-1, "unknown error"); + /* NOTREACHED */ + } + } + + (*nterm)->fildes = fildes; + _ti_setospeed(*nterm); + if (t_generic_type(*nterm)) + reterrarg(0, "%s: generic terminal", term); + if (t_hard_copy(*nterm)) + reterrarg(1, "%s: hardcopy terminal", term); + + /* If TIOCGWINSZ works, then set initial lines and columns. */ + if (ioctl(fildes, TIOCGWINSZ, &win) != -1 && + win.ws_row != 0 && win.ws_col != 0) + { + t_lines(*nterm) = (short)win.ws_row; + t_columns(*nterm) = (short)win.ws_col; + } + + /* POSIX 1003.2 requires that the environment override. */ + if (__use_env) { + if ((p = getenv("LINES")) != NULL) + t_lines(*nterm) = (short)strtol(p, NULL, 0); + if ((p = getenv("COLUMNS")) != NULL) + t_columns(*nterm) = (short)strtol(p, NULL, 0); + } + + /* POSIX requires 1 for success */ + if (errret) + *errret = 1; + return OK; +} + +int +setupterm(const char *term, int fildes, int *errret) +{ + TERMINAL *nterm; + int ret; + + if (errret != NULL) + *errret = ERR; + ret = ti_setupterm(&nterm, term, fildes, errret); + if (nterm != NULL) + set_curterm(nterm); + return ret; +} diff --git a/vendor/netbsd-curses/libterminfo/shlib_version b/vendor/netbsd-curses/libterminfo/shlib_version new file mode 100644 index 0000000..9592ee5 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/shlib_version @@ -0,0 +1,5 @@ +# $NetBSD: shlib_version,v 1.1 2010/02/03 15:16:32 roy Exp $ +# Remember to update distrib/sets/lists/base/shl.* when changing +# +major=1 +minor=0 diff --git a/vendor/netbsd-curses/libterminfo/term.c b/vendor/netbsd-curses/libterminfo/term.c new file mode 100644 index 0000000..accae27 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/term.c @@ -0,0 +1,468 @@ +/* $NetBSD: term.c,v 1.34 2020/04/05 14:53:39 martin Exp $ */ + +/* + * Copyright (c) 2009, 2010, 2011, 2020 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#define _GNU_SOURCE +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef _PATH_TERMINFO +#ifndef INSTALL_PREFIX +#define _PATH_TERMINFO "/usr/share/misc/terminfo" +#else +#define _PATH_TERMINFO INSTALL_PREFIX "/share/terminfo" +#endif +#endif + +#ifdef TERMINFO_DB +static char __ti_database[PATH_MAX]; +#endif +const char *_ti_database; + +/* Include a generated list of pre-compiled terminfo descriptions. */ +#include "compiled_terms.c" + +static int +allocset(void *pp, int init, size_t nelem, size_t elemsize) +{ + void **p = pp; + if (*p) { + memset(*p, init, nelem * elemsize); + return 0; + } + + if ((*p = calloc(nelem, elemsize)) == NULL) + return -1; + + if (init != 0) + memset(*p, init, nelem * elemsize); + return 0; +} + +static int +_ti_readterm(TERMINAL *term, const char *cap, size_t caplen, int flags) +{ + char rtype; + uint16_t ind, num; + size_t len; + TERMUSERDEF *ud; + + if (caplen == 0) + goto out; + rtype = *cap++; + caplen--; + /* Only read type 1 or 3 records */ + if (rtype != TERMINFO_RTYPE && rtype != TERMINFO_RTYPE_O1) + goto out; + + if (allocset(&term->flags, 0, TIFLAGMAX+1, sizeof(*term->flags)) == -1) + return -1; + + if (allocset(&term->nums, -1, TINUMMAX+1, sizeof(*term->nums)) == -1) + return -1; + + if (allocset(&term->strs, 0, TISTRMAX+1, sizeof(*term->strs)) == -1) + return -1; + + if (term->_arealen != caplen) { + term->_arealen = caplen; + term->_area = realloc(term->_area, term->_arealen); + if (term->_area == NULL) + return -1; + } + memcpy(term->_area, cap, term->_arealen); + + cap = term->_area; + len = _ti_decode_16(&cap); + term->name = cap; + cap += len; + len = _ti_decode_16(&cap); + if (len == 0) + term->_alias = NULL; + else { + term->_alias = cap; + cap += len; + } + len = _ti_decode_16(&cap); + if (len == 0) + term->desc = NULL; + else { + term->desc = cap; + cap += len; + } + + num = _ti_decode_16(&cap); + if (num != 0) { + num = _ti_decode_16(&cap); + for (; num != 0; num--) { + ind = _ti_decode_16(&cap); + term->flags[ind] = *cap++; + if (flags == 0 && !VALID_BOOLEAN(term->flags[ind])) + term->flags[ind] = 0; + } + } + + num = _ti_decode_16(&cap); + if (num != 0) { + num = _ti_decode_16(&cap); + for (; num != 0; num--) { + ind = _ti_decode_16(&cap); + term->nums[ind] = _ti_decode_num(&cap, rtype); + if (flags == 0 && !VALID_NUMERIC(term->nums[ind])) + term->nums[ind] = ABSENT_NUMERIC; + } + } + + num = _ti_decode_16(&cap); + if (num != 0) { + num = _ti_decode_16(&cap); + for (; num != 0; num--) { + ind = _ti_decode_16(&cap); + len = _ti_decode_16(&cap); + if (len > 0) + term->strs[ind] = cap; + else if (flags == 0) + term->strs[ind] = ABSENT_STRING; + else + term->strs[ind] = CANCELLED_STRING; + cap += len; + } + } + + num = _ti_decode_16(&cap); + if (num != 0) { + num = _ti_decode_16(&cap); + if (num != term->_nuserdefs) { + free(term->_userdefs); + term->_userdefs = NULL; + term->_nuserdefs = num; + } + if (allocset(&term->_userdefs, 0, term->_nuserdefs, + sizeof(*term->_userdefs)) == -1) + return -1; + for (num = 0; num < term->_nuserdefs; num++) { + ud = &term->_userdefs[num]; + len = _ti_decode_16(&cap); + ud->id = cap; + cap += len; + ud->type = *cap++; + switch (ud->type) { + case 'f': + ud->flag = *cap++; + if (flags == 0 && + !VALID_BOOLEAN(ud->flag)) + ud->flag = 0; + ud->num = ABSENT_NUMERIC; + ud->str = ABSENT_STRING; + break; + case 'n': + ud->flag = ABSENT_BOOLEAN; + ud->num = _ti_decode_num(&cap, rtype); + if (flags == 0 && + !VALID_NUMERIC(ud->num)) + ud->num = ABSENT_NUMERIC; + ud->str = ABSENT_STRING; + break; + case 's': + ud->flag = ABSENT_BOOLEAN; + ud->num = ABSENT_NUMERIC; + len = _ti_decode_16(&cap); + if (len > 0) + ud->str = cap; + else if (flags == 0) + ud->str = ABSENT_STRING; + else + ud->str = CANCELLED_STRING; + cap += len; + break; + default: + goto out; + } + } + } else { + term->_nuserdefs = 0; + if (term->_userdefs) { + free(term->_userdefs); + term->_userdefs = NULL; + } + } + + return 1; +out: + errno = EINVAL; + return -1; +} + +#if defined(TERMINFO_DB) || defined(TERMINFO_COMPILE) +static int +_ti_checkname(const char *name, const char *termname, const char *termalias) +{ + const char *alias, *s; + size_t len, l; + + /* Check terminal name matches. */ + if (strcmp(termname, name) == 0) + return 1; + + /* Check terminal aliases match. */ + if (termalias == NULL) + return 0; + + len = strlen(name); + alias = termalias; + while (*alias != '\0') { + s = strchr(alias, '|'); + if (s == NULL) + l = strlen(alias); + else + l = (size_t)(s - alias); + if (len == l && memcmp(alias, name, l) == 0) + return 1; + if (s == NULL) + break; + alias = s + 1; + } + + /* No match. */ + return 0; +} +#endif + +#ifdef TERMINFO_DB +static int +_ti_dbgetterm(TERMINAL *term, const char *path, const char *name, int flags) +{ + struct cdbr *db; + const void *data; + const uint8_t *data8; + size_t len, klen; + int r; + + r = snprintf(__ti_database, sizeof(__ti_database), "%s.cdb", path); + if (r < 0 || (size_t)r > sizeof(__ti_database)) { + db = NULL; + errno = ENOENT; /* To fall back to a non extension. */ + } else + db = cdbr_open(__ti_database, CDBR_DEFAULT); + + /* Target file *may* be a cdb file without the extension. */ + if (db == NULL && errno == ENOENT) { + len = snprintf(__ti_database, sizeof(__ti_database), "%s", path); + if (len < sizeof(__ti_database)) + db = cdbr_open(__ti_database, CDBR_DEFAULT); + } + if (db == NULL) + return -1; + + r = 0; + klen = strlen(name) + 1; + if (cdbr_find(db, name, klen, &data, &len) == -1) + goto out; + data8 = data; + if (len == 0) + goto out; + + /* If the entry is an alias, load the indexed terminfo description. */ + if (data8[0] == TERMINFO_ALIAS) { + if (cdbr_get(db, le32dec(data8 + 1), &data, &len)) + goto out; + data8 = data; + } + + r = _ti_readterm(term, data, len, flags); + /* Ensure that this is the right terminfo description. */ + if (r == 1) + r = _ti_checkname(name, term->name, term->_alias); + /* Remember the database we read. */ + if (r == 1) + _ti_database = __ti_database; + +out: + cdbr_close(db); + return r; +} + +static int +_ti_dbgettermp(TERMINAL *term, const char *path, const char *name, int flags) +{ + const char *p; + char pathbuf[PATH_MAX]; + size_t l; + int r, e; + + e = -1; + r = 0; + do { + for (p = path; *path != '\0' && *path != ':'; path++) + continue; + l = (size_t)(path - p); + if (l != 0 && l + 1 < sizeof(pathbuf)) { + memcpy(pathbuf, p, l); + pathbuf[l] = '\0'; + r = _ti_dbgetterm(term, pathbuf, name, flags); + if (r == 1) + return 1; + if (r == 0) + e = 0; + } + } while (*path++ == ':'); + return e; +} +#endif + +static int +_ti_findterm(TERMINAL *term, const char *name, int flags) +{ +#ifndef TERMINFO_DB + _ti_database = NULL; + + return 0; +#else + int r; + char *c, *e; + + _DIAGASSERT(term != NULL); + _DIAGASSERT(name != NULL); + + _ti_database = NULL; + r = 0; + + e = getenv("TERMINFO"); + if (e != NULL && *e == '/') + return _ti_dbgetterm(term, e, name, flags); + + c = NULL; +#ifdef TERMINFO_COMPILE +#ifdef USE_TERMCAP + if (e == NULL && (c = getenv("TERMCAP")) != NULL) { + if (*c != '\0' && *c != '/') { + c = strdup(c); + if (c != NULL) { + e = captoinfo(c); + free(c); + } + } + } +#endif + if (e != NULL) { + TIC *tic; + + if (c == NULL) + e = strdup(e); /* So we don't destroy env */ + if (e == NULL) + tic = NULL; + else { + tic = _ti_compile(e, TIC_WARNING | + TIC_ALIAS | TIC_DESCRIPTION | TIC_EXTRA); + free(e); + } + if (tic != NULL && + _ti_checkname(name, tic->name, tic->alias) == 1) + { + uint8_t *f; + ssize_t len; + + len = _ti_flatten(&f, tic); + if (len != -1) { + r = _ti_readterm(term, (char *)f, (size_t)len, + flags); + free(f); + } + } + _ti_freetic(tic); + if (r == 1) { + if (c == NULL) + _ti_database = "$TERMINFO"; + else + _ti_database = "$TERMCAP"; + return r; + } + } + + if ((e = getenv("TERMINFO_DIRS")) != NULL) + return _ti_dbgettermp(term, e, name, flags); + + if ((e = getenv("HOME")) != NULL) { + char homepath[PATH_MAX]; + + if (snprintf(homepath, sizeof(homepath), "%s/.terminfo", e) > 0) + r = _ti_dbgetterm(term, homepath, name, flags); + } + if (r != 1) + r = _ti_dbgettermp(term, _PATH_TERMINFO, name, flags); +#endif + + return r; +#endif +} + +int +_ti_getterm(TERMINAL *term, const char *name, int flags) +{ + int r; + size_t i; + const struct compiled_term *t; +#ifdef TERMINFO_COMPAT + char *namev3; + + namev3 = _ti_getname(TERMINFO_RTYPE, name); + if (namev3 != NULL) { + r = _ti_findterm(term, namev3, flags); + free(namev3); + if (r == 1) + return r; + } +#endif + + r = _ti_findterm(term, name, flags); + if (r == 1) + return r; + + for (i = 0; i < __arraycount(compiled_terms); i++) { + t = &compiled_terms[i]; + if (strcmp(name, t->name) == 0) { + r = _ti_readterm(term, t->cap, t->caplen, flags); + break; + } + } + + return r; +} diff --git a/vendor/netbsd-curses/libterminfo/term.h b/vendor/netbsd-curses/libterminfo/term.h new file mode 100644 index 0000000..a06c80c --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/term.h @@ -0,0 +1,2007 @@ +/* $NetBSD: term.h,v 1.24 2020/06/05 22:08:10 roy Exp $ */ + +/* + * Copyright (c) 2009, 2010, 2011, 2013, 2020 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _TERM_H_ +#define _TERM_H_ + +#ifndef ERR +#define ERR (-1) /* Error return */ +#define OK (0) /* Success return */ +#endif + +/* Define available terminfo flags */ +enum TIFLAGS { + TICODE_bw, + TICODE_am, + TICODE_bce, + TICODE_ccc, + TICODE_xhp, + TICODE_xhpa, + TICODE_cpix, + TICODE_crxm, + TICODE_xt, + TICODE_xenl, + TICODE_eo, + TICODE_gn, + TICODE_hc, + TICODE_chts, + TICODE_km, + TICODE_daisy, + TICODE_hs, + TICODE_hls, + TICODE_in, + TICODE_lpix, + TICODE_da, + TICODE_db, + TICODE_mir, + TICODE_msgr, + TICODE_nxon, + TICODE_xsb, + TICODE_npc, + TICODE_ndscr, + TICODE_nrrmc, + TICODE_os, + TICODE_mc5i, + TICODE_xvpa, + TICODE_sam, + TICODE_eslok, + TICODE_hz, + TICODE_ul, + TICODE_xon +}; +#define TIFLAGMAX TICODE_xon + +#define t_auto_left_margin(t) (t)->flags[TICODE_bw] +#define t_auto_right_margin(t) (t)->flags[TICODE_am] +#define t_back_color_erase(t) (t)->flags[TICODE_bce] +#define t_can_change(t) (t)->flags[TICODE_ccc] +#define t_ceol_standout_glitch(t) (t)->flags[TICODE_xhp] +#define t_col_addr_glitch(t) (t)->flags[TICODE_xhpa] +#define t_cpi_changes_res(t) (t)->flags[TICODE_cpix] +#define t_cr_cancels_micro_mode(t) (t)->flags[TICODE_crxm] +#define t_dest_tabs_magic_smso(t) (t)->flags[TICODE_xt] +#define t_eat_newline_glitch(t) (t)->flags[TICODE_xenl] +#define t_erase_overstrike(t) (t)->flags[TICODE_eo] +#define t_generic_type(t) (t)->flags[TICODE_gn] +#define t_hard_copy(t) (t)->flags[TICODE_hc] +#define t_hard_cursor(t) (t)->flags[TICODE_chts] +#define t_has_meta_key(t) (t)->flags[TICODE_km] +#define t_has_print_wheel(t) (t)->flags[TICODE_daisy] +#define t_has_status_line(t) (t)->flags[TICODE_hs] +#define t_hue_light_saturation(t) (t)->flags[TICODE_hls] +#define t_insert_null_glitch(t) (t)->flags[TICODE_in] +#define t_lpi_changes_yes(t) (t)->flags[TICODE_lpix] +#define t_memory_above(t) (t)->flags[TICODE_da] +#define t_memory_below(t) (t)->flags[TICODE_db] +#define t_move_insert_mode(t) (t)->flags[TICODE_mir] +#define t_move_standout_mode(t) (t)->flags[TICODE_msgr] +#define t_needs_xon_xoff(t) (t)->flags[TICODE_nxon] +#define t_no_esc_ctlc(t) (t)->flags[TICODE_xsb] +#define t_no_pad_char(t) (t)->flags[TICODE_npc] +#define t_non_dest_scroll_region(t) (t)->flags[TICODE_ndscr] +#define t_non_rev_rmcup(t) (t)->flags[TICODE_nrrmc] +#define t_over_strike(t) (t)->flags[TICODE_os] +#define t_prtr_silent(t) (t)->flags[TICODE_mc5i] +#define t_row_addr_glitch(t) (t)->flags[TICODE_xvpa] +#define t_semi_auto_right_margin(t) (t)->flags[TICODE_sam] +#define t_status_line_esc_ok(t) (t)->flags[TICODE_eslok] +#define t_tilde_glitch(t) (t)->flags[TICODE_hz] +#define t_transparent_underline(t) (t)->flags[TICODE_ul] +#define t_xon_xoff(t) (t)->flags[TICODE_xon] + +#define auto_left_margin t_auto_left_margin(cur_term) +#define auto_right_margin t_auto_right_margin(cur_term) +#define back_color_erase t_back_color_erase(cur_term) +#define can_change t_can_change(cur_term) +#define ceol_standout_glitch t_ceol_standout_glitch(cur_term) +#define col_addr_glitch t_col_addr_glitch(cur_term) +#define cpi_changes_res t_cpi_changes_res(cur_term) +#define cr_cancels_micro_mode t_cr_cancels_micro_mode(cur_term) +#define dest_tabs_magic_smso t_dest_tabs_magic_smso(cur_term) +#define eat_newline_glitch t_eat_newline_glitch(cur_term) +#define erase_overstrike t_erase_overstrike(cur_term) +#define generic_type t_generic_type(cur_term) +#define hard_copy t_hard_copy(cur_term) +#define hard_cursor t_hard_cursor(cur_term) +#define has_meta_key t_has_meta_key(cur_term) +#define has_print_wheel t_has_print_wheel(cur_term) +#define has_status_line t_has_status_line(cur_term) +#define hue_light_saturation t_hue_light_saturation(cur_term) +#define insert_null_glitch t_insert_null_glitch(cur_term) +#define lpi_changes_yes t_lpi_changes_yes(cur_term) +#define memory_above t_memory_above(cur_term) +#define memory_below t_memory_below(cur_term) +#define move_insert_mode t_move_insert_mode(cur_term) +#define move_standout_mode t_move_standout_mode(cur_term) +#define needs_xon_xoff t_needs_xon_xoff(cur_term) +#define no_esc_ctlc t_no_esc_ctlc(cur_term) +#define no_pad_char t_no_pad_char(cur_term) +#define non_dest_scroll_region t_non_dest_scroll_region(cur_term) +#define non_rev_rmcup t_non_rev_rmcup(cur_term) +#define over_strike t_over_strike(cur_term) +#define prtr_silent t_prtr_silent(cur_term) +#define row_addr_glitch t_row_addr_glitch(cur_term) +#define semi_auto_right_margin t_semi_auto_right_margin(cur_term) +#define status_line_esc_ok t_status_line_esc_ok(cur_term) +#define tilde_glitch t_tilde_glitch(cur_term) +#define transparent_underline t_transparent_underline(cur_term) +#define xon_xoff t_xon_xoff(cur_term) + +/* + * BOOLEAN DESCRIPTIONS + * + * auto_left_margin: cub1 wraps from column 0 to last column + * auto_right_margin: Terminal has automatic margins + * back_color_erase: Screen erased with background colour + * can_change: Terminal can re-define existing colour + * ceol_standout_glitch: Standout not erased by overwriting (hp) + * col_addr_glitch: Only positive motion for hpa/mhba caps + * cpi_changes_res: Changing character pitch changes resolution + * cr_cancels_micro_mode: Using cr turns off micro mode + * dest_tabs_magic_smso: Destructive tabs, magic smso char (t1061) + * eat_newline_glitch: Newline ignored after 80 columns (Concept) + * erase_overstrike: Can erase overstrikes with a blank line + * generic_type: Generic line type (e.g. dialup, switch) + * hard_copy: Hardcopy terminal + * hard_cursor: Cursor is hard to see + * has_meta_key: Has a meta key (shift, sets parity bit) + * has_print_wheel: Printer needs operator to change character set + * has_status_line: Has extra "status line" + * hue_light_saturation: Terminal only uses HLS colour notion (Tektronix) + * insert_null_glitch: Insert mode distinguishes nulls + * lpi_changes_yes: Changing line pitch changes resolution + * memory_above: Display may be retained above the screen + * memory_below: Display may be retained below the screen + * move_insert_mode: Safe to move while in insert mode + * move_standout_mode: Safe to move in standout modes + * needs_xon_xoff: Padding won't work, xon/xoff required + * no_esc_ctlc: Beehive (f1=escape, f2=ctrl C) + * no_pad_char: Pad character doesn't exist + * non_dest_scroll_region: Scrolling region is nondestructive + * non_rev_rmcup: smcup does not reverse rmcup + * over_strike: Terminal overstrikes on hard-copy terminal + * prtr_silent: Printer won't echo on screen + * row_addr_glitch: Only positive motion for vpa/mvpa caps + * semi_auto_right_margin: Printing in last column causes cr + * status_line_esc_ok: Escape can be used on the status line + * tilde_glitch: Hazeltine; can't print tilde (~) + * transparent_underline: Underline character overstrikes + * xon_xoff: Terminal uses xon/xoff handshaking +*/ + +/* Define available terminfo numbers */ +enum TINUMS { + TICODE_bitwin, + TICODE_bitype, + TICODE_bufsz, + TICODE_btns, + TICODE_cols, + TICODE_spinh, + TICODE_spinv, + TICODE_it, + TICODE_lh, + TICODE_lw, + TICODE_lines, + TICODE_lm, + TICODE_ma, + TICODE_xmc, + TICODE_colors, + TICODE_maddr, + TICODE_mjump, + TICODE_pairs, + TICODE_wnum, + TICODE_mcs, + TICODE_mls, + TICODE_ncv, + TICODE_nlab, + TICODE_npins, + TICODE_orc, + TICODE_orl, + TICODE_orhi, + TICODE_orvi, + TICODE_pb, + TICODE_cps, + TICODE_vt, + TICODE_widcs, + TICODE_wsl +}; +#define TINUMMAX TICODE_wsl + +#define t_bit_image_entwining(t) (t)->nums[TICODE_bitwin] +#define t_bit_image_type(t) (t)->nums[TICODE_bitype] +#define t_buffer_capacity(t) (t)->nums[TICODE_bufsz] +#define t_buttons(t) (t)->nums[TICODE_btns] +#define t_columns(t) (t)->nums[TICODE_cols] +#define t_dot_horz_spacing(t) (t)->nums[TICODE_spinh] +#define t_dot_vert_spacing(t) (t)->nums[TICODE_spinv] +#define t_init_tabs(t) (t)->nums[TICODE_it] +#define t_label_height(t) (t)->nums[TICODE_lh] +#define t_label_width(t) (t)->nums[TICODE_lw] +#define t_lines(t) (t)->nums[TICODE_lines] +#define t_lines_of_memory(t) (t)->nums[TICODE_lm] +#define t_max_attributes(t) (t)->nums[TICODE_ma] +#define t_magic_cookie_glitch(t) (t)->nums[TICODE_xmc] +#define t_max_colors(t) (t)->nums[TICODE_colors] +#define t_max_micro_address(t) (t)->nums[TICODE_maddr] +#define t_max_micro_jump(t) (t)->nums[TICODE_mjump] +#define t_max_pairs(t) (t)->nums[TICODE_pairs] +#define t_maximum_windows(t) (t)->nums[TICODE_wnum] +#define t_micro_col_size(t) (t)->nums[TICODE_mcs] +#define t_micro_line_size(t) (t)->nums[TICODE_mls] +#define t_no_color_video(t) (t)->nums[TICODE_ncv] +#define t_num_labels(t) (t)->nums[TICODE_nlab] +#define t_number_of_pins(t) (t)->nums[TICODE_npins] +#define t_output_res_char(t) (t)->nums[TICODE_orc] +#define t_output_res_line(t) (t)->nums[TICODE_orl] +#define t_output_res_horz_inch(t) (t)->nums[TICODE_orhi] +#define t_output_res_vert_inch(t) (t)->nums[TICODE_orvi] +#define t_padding_baud_rate(t) (t)->nums[TICODE_pb] +#define t_print_rate(t) (t)->nums[TICODE_cps] +#define t_virtual_terminal(t) (t)->nums[TICODE_vt] +#define t_wide_char_size(t) (t)->nums[TICODE_widcs] +#define t_width_status_line(t) (t)->nums[TICODE_wsl] + +#define bit_image_entwining t_bit_image_entwining(cur_term) +#define bit_image_type t_bit_image_type(cur_term) +#define buffer_capacity t_buffer_capacity(cur_term) +#define buttons t_buttons(cur_term) +#define columns t_columns(cur_term) +#define dot_horz_spacing t_dot_horz_spacing(cur_term) +#define dot_vert_spacing t_dot_vert_spacing(cur_term) +#define init_tabs t_init_tabs(cur_term) +#define label_height t_label_height(cur_term) +#define label_width t_label_width(cur_term) +#define lines t_lines(cur_term) +#define lines_of_memory t_lines_of_memory(cur_term) +#define max_attributes t_max_attributes(cur_term) +#define magic_cookie_glitch t_magic_cookie_glitch(cur_term) +#define max_colors t_max_colors(cur_term) +#define max_micro_address t_max_micro_address(cur_term) +#define max_micro_jump t_max_micro_jump(cur_term) +#define max_pairs t_max_pairs(cur_term) +#define maximum_windows t_maximum_windows(cur_term) +#define micro_col_size t_micro_col_size(cur_term) +#define micro_line_size t_micro_line_size(cur_term) +#define no_color_video t_no_color_video(cur_term) +#define num_labels t_num_labels(cur_term) +#define number_of_pins t_number_of_pins(cur_term) +#define output_res_char t_output_res_char(cur_term) +#define output_res_line t_output_res_line(cur_term) +#define output_res_horz_inch t_output_res_horz_inch(cur_term) +#define output_res_vert_inch t_output_res_vert_inch(cur_term) +#define padding_baud_rate t_padding_baud_rate(cur_term) +#define print_rate t_print_rate(cur_term) +#define virtual_terminal t_virtual_terminal(cur_term) +#define wide_char_size t_wide_char_size(cur_term) +#define width_status_line t_width_status_line(cur_term) + +/* + * NUMBER DESCRIPTIONS + * + * bit_image_entwining: Number of passes for each bit-map row + * bit_image_type: Type of bit image device + * buffer_capacity: Number of bytes buffered before printing + * buttons: Number of buttons on the mouse + * columns: Number of columns in a line + * dot_horz_spacing: Spacing of dots horizontally in dots per inch + * dot_vert_spacing: Spacing of pins vertically in pins per inch + * init_tabs: Tabs initially every #1 spaces + * label_height: Number of rows in each label + * label_width: Number of columns in each label + * lines: Number of lines on a screen or a page + * lines_of_memory: Lines of memory of > lines; 0 means varies + * max_attributes: Maximum combined video attributes terminal can display + * magic_cookie_glitch: Number of blank characters left by smso or rmso + * max_colors: Maximum number of colours on the screen + * max_micro_address: Maximum value in micro_..._addresss + * max_micro_jump: Maximum value in parm_..._micro + * max_pairs: Maximum number of colour-pairs on the screen + * maximum_windows: Maximum number of definable windows + * micro_col_size: Character step size when in micro mode + * micro_line_size: Line step size when in micro mode + * no_color_video: Video attributes that can't be used with colours + * num_labels: Number of labels on screen (start at 1) + * number_of_pins: Number of pins in print-head + * output_res_char: Horizontal resolution in units per character + * output_res_line: Vertical resolution in units per line + * output_res_horz_inch: Horizontal resolution in units per inch + * output_res_vert_inch: Vertical resolution in units per inch + * padding_baud_rate: Lowest baud rate where padding needed + * print_rate: Print rate in characters per second + * virtual_terminal: Virtual terminal number + * wide_char_size: Character step size when in double-wide mode + * width_status_line: Number of columns in status line + */ + +/* Define available terminfo strings */ +enum TISTRS{ + TICODE_acsc, + TICODE_scesa, + TICODE_cbt, + TICODE_bel, + TICODE_bicr, + TICODE_binel, + TICODE_birep, + TICODE_cr, + TICODE_cpi, + TICODE_lpi, + TICODE_chr, + TICODE_cvr, + TICODE_csr, + TICODE_rmp, + TICODE_csnm, + TICODE_tbc, + TICODE_mgc, + TICODE_clear, + TICODE_el1, + TICODE_el, + TICODE_ed, + TICODE_csin, + TICODE_colornm, + TICODE_hpa, + TICODE_cmdch, + TICODE_cwin, + TICODE_cup, + TICODE_cud1, + TICODE_home, + TICODE_civis, + TICODE_cub1, + TICODE_mrcup, + TICODE_cnorm, + TICODE_cuf1, + TICODE_ll, + TICODE_cuu1, + TICODE_cvvis, + TICODE_defbi, + TICODE_defc, + TICODE_dch1, + TICODE_dl1, + TICODE_devt, + TICODE_dial, + TICODE_dsl, + TICODE_dclk, + TICODE_dispc, + TICODE_hd, + TICODE_enacs, + TICODE_endbi, + TICODE_smacs, + TICODE_smam, + TICODE_blink, + TICODE_bold, + TICODE_smcup, + TICODE_smdc, + TICODE_dim, + TICODE_swidm, + TICODE_sdrfq, + TICODE_ehhlm, + TICODE_smir, + TICODE_sitm, + TICODE_elhlm, + TICODE_slm, + TICODE_elohlm, + TICODE_smicm, + TICODE_snlq, + TICODE_snrmq, + TICODE_smpch, + TICODE_prot, + TICODE_rev, + TICODE_erhlm, + TICODE_smsc, + TICODE_invis, + TICODE_sshm, + TICODE_smso, + TICODE_ssubm, + TICODE_ssupm, + TICODE_ethlm, + TICODE_smul, + TICODE_sum, + TICODE_evhlm, + TICODE_smxon, + TICODE_ech, + TICODE_rmacs, + TICODE_rmam, + TICODE_sgr0, + TICODE_rmcup, + TICODE_rmdc, + TICODE_rwidm, + TICODE_rmir, + TICODE_ritm, + TICODE_rlm, + TICODE_rmicm, + TICODE_rmpch, + TICODE_rmsc, + TICODE_rshm, + TICODE_rmso, + TICODE_rsubm, + TICODE_rsupm, + TICODE_rmul, + TICODE_rum, + TICODE_rmxon, + TICODE_pause, + TICODE_hook, + TICODE_flash, + TICODE_ff, + TICODE_fsl, + TICODE_getm, + TICODE_wingo, + TICODE_hup, + TICODE_is1, + TICODE_is2, + TICODE_is3, + TICODE_if, + TICODE_iprog, + TICODE_initc, + TICODE_initp, + TICODE_ich1, + TICODE_il1, + TICODE_ip, + TICODE_ka1, + TICODE_ka3, + TICODE_kb2, + TICODE_kbs, + TICODE_kbeg, + TICODE_kcbt, + TICODE_kc1, + TICODE_kc3, + TICODE_kcan, + TICODE_ktbc, + TICODE_kclr, + TICODE_kclo, + TICODE_kcmd, + TICODE_kcpy, + TICODE_kcrt, + TICODE_kctab, + TICODE_kdch1, + TICODE_kdl1, + TICODE_kcud1, + TICODE_krmir, + TICODE_kend, + TICODE_kent, + TICODE_kel, + TICODE_ked, + TICODE_kext, + TICODE_kf0, + TICODE_kf1, + TICODE_kf2, + TICODE_kf3, + TICODE_kf4, + TICODE_kf5, + TICODE_kf6, + TICODE_kf7, + TICODE_kf8, + TICODE_kf9, + TICODE_kf10, + TICODE_kf11, + TICODE_kf12, + TICODE_kf13, + TICODE_kf14, + TICODE_kf15, + TICODE_kf16, + TICODE_kf17, + TICODE_kf18, + TICODE_kf19, + TICODE_kf20, + TICODE_kf21, + TICODE_kf22, + TICODE_kf23, + TICODE_kf24, + TICODE_kf25, + TICODE_kf26, + TICODE_kf27, + TICODE_kf28, + TICODE_kf29, + TICODE_kf30, + TICODE_kf31, + TICODE_kf32, + TICODE_kf33, + TICODE_kf34, + TICODE_kf35, + TICODE_kf36, + TICODE_kf37, + TICODE_kf38, + TICODE_kf39, + TICODE_kf40, + TICODE_kf41, + TICODE_kf42, + TICODE_kf43, + TICODE_kf44, + TICODE_kf45, + TICODE_kf46, + TICODE_kf47, + TICODE_kf48, + TICODE_kf49, + TICODE_kf50, + TICODE_kf51, + TICODE_kf52, + TICODE_kf53, + TICODE_kf54, + TICODE_kf55, + TICODE_kf56, + TICODE_kf57, + TICODE_kf58, + TICODE_kf59, + TICODE_kf60, + TICODE_kf61, + TICODE_kf62, + TICODE_kf63, + TICODE_kfnd, + TICODE_khlp, + TICODE_khome, + TICODE_kich1, + TICODE_kil1, + TICODE_kcub1, + TICODE_kll, + TICODE_kmrk, + TICODE_kmsg, + TICODE_kmous, + TICODE_kmov, + TICODE_knxt, + TICODE_knp, + TICODE_kopn, + TICODE_kopt, + TICODE_kpp, + TICODE_kprv, + TICODE_kprt, + TICODE_krdo, + TICODE_kref, + TICODE_krfr, + TICODE_krpl, + TICODE_krst, + TICODE_kres, + TICODE_kcuf1, + TICODE_ksav, + TICODE_kBEG, + TICODE_kCAN, + TICODE_kCMD, + TICODE_kCPY, + TICODE_kCRT, + TICODE_kDC, + TICODE_kDL, + TICODE_kslt, + TICODE_kEND, + TICODE_kEOL, + TICODE_kEXT, + TICODE_kind, + TICODE_kFND, + TICODE_kHLP, + TICODE_kHOM, + TICODE_kIC, + TICODE_kLFT, + TICODE_kMSG, + TICODE_kMOV, + TICODE_kNXT, + TICODE_kOPT, + TICODE_kPRV, + TICODE_kPRT, + TICODE_kri, + TICODE_kRDO, + TICODE_kRPL, + TICODE_kRIT, + TICODE_kRES, + TICODE_kSAV, + TICODE_kSPD, + TICODE_khts, + TICODE_kUND, + TICODE_kspd, + TICODE_kund, + TICODE_kcuu1, + TICODE_rmkx, + TICODE_smkx, + TICODE_lf0, + TICODE_lf1, + TICODE_lf2, + TICODE_lf3, + TICODE_lf4, + TICODE_lf5, + TICODE_lf6, + TICODE_lf7, + TICODE_lf8, + TICODE_lf9, + TICODE_lf10, + TICODE_fln, + TICODE_rmln, + TICODE_smln, + TICODE_rmm, + TICODE_smm, + TICODE_mhpa, + TICODE_mcud1, + TICODE_mcub1, + TICODE_mcuf1, + TICODE_mvpa, + TICODE_mcuu1, + TICODE_minfo, + TICODE_nel, + TICODE_porder, + TICODE_oc, + TICODE_op, + TICODE_pad, + TICODE_dch, + TICODE_dl, + TICODE_cud, + TICODE_mcud, + TICODE_ich, + TICODE_indn, + TICODE_il, + TICODE_cub, + TICODE_mcub, + TICODE_cuf, + TICODE_mcuf, + TICODE_rin, + TICODE_cuu, + TICODE_mcuu, + TICODE_pctrm, + TICODE_pfkey, + TICODE_pfloc, + TICODE_pfxl, + TICODE_pfx, + TICODE_pln, + TICODE_mc0, + TICODE_mc5p, + TICODE_mc4, + TICODE_mc5, + TICODE_pulse, + TICODE_qdial, + TICODE_rmclk, + TICODE_rep, + TICODE_rfi, + TICODE_reqmp, + TICODE_rs1, + TICODE_rs2, + TICODE_rs3, + TICODE_rf, + TICODE_rc, + TICODE_vpa, + TICODE_sc, + TICODE_scesc, + TICODE_ind, + TICODE_ri, + TICODE_scs, + TICODE_s0ds, + TICODE_s1ds, + TICODE_s2ds, + TICODE_s3ds, + TICODE_sgr1, + TICODE_setab, + TICODE_setaf, + TICODE_sgr, + TICODE_setb, + TICODE_smgb, + TICODE_smgbp, + TICODE_sclk, + TICODE_setcolor, + TICODE_scp, + TICODE_setf, + TICODE_smgl, + TICODE_smglp, + TICODE_smglr, + TICODE_slines, + TICODE_slength, + TICODE_smgr, + TICODE_smgrp, + TICODE_hts, + TICODE_smgtb, + TICODE_smgt, + TICODE_smgtp, + TICODE_wind, + TICODE_sbim, + TICODE_scsd, + TICODE_rbim, + TICODE_rcsd, + TICODE_subcs, + TICODE_supcs, + TICODE_ht, + TICODE_docr, + TICODE_tsl, + TICODE_tone, + TICODE_u0, + TICODE_u1, + TICODE_u2, + TICODE_u3, + TICODE_u4, + TICODE_u5, + TICODE_u6, + TICODE_u7, + TICODE_u8, + TICODE_u9, + TICODE_uc, + TICODE_hu, + TICODE_wait, + TICODE_xoffc, + TICODE_xonc, + TICODE_zerom +}; +#define TISTRMAX TICODE_zerom + +#define t_acs_chars(t) (t)->strs[TICODE_acsc] +#define t_alt_scancode_esc(t) (t)->strs[TICODE_scesa] +#define t_back_tab(t) (t)->strs[TICODE_cbt] +#define t_bell(t) (t)->strs[TICODE_bel] +#define t_bit_image_carriage_return(t) (t)->strs[TICODE_bicr] +#define t_bit_image_newline(t) (t)->strs[TICODE_binel] +#define t_bit_image_repeat(t) (t)->strs[TICODE_birep] +#define t_carriage_return(t) (t)->strs[TICODE_cr] +#define t_change_char_pitch(t) (t)->strs[TICODE_cpi] +#define t_change_line_pitch(t) (t)->strs[TICODE_lpi] +#define t_change_res_horz(t) (t)->strs[TICODE_chr] +#define t_change_res_vert(t) (t)->strs[TICODE_cvr] +#define t_change_scroll_region(t) (t)->strs[TICODE_csr] +#define t_char_padding(t) (t)->strs[TICODE_rmp] +#define t_char_set_names(t) (t)->strs[TICODE_csnm] +#define t_clear_all_tabs(t) (t)->strs[TICODE_tbc] +#define t_clear_margins(t) (t)->strs[TICODE_mgc] +#define t_clear_screen(t) (t)->strs[TICODE_clear] +#define t_clr_bol(t) (t)->strs[TICODE_el1] +#define t_clr_eol(t) (t)->strs[TICODE_el] +#define t_clr_eos(t) (t)->strs[TICODE_ed] +#define t_code_set_init(t) (t)->strs[TICODE_csin] +#define t_color_names(t) (t)->strs[TICODE_colornm] +#define t_column_address(t) (t)->strs[TICODE_hpa] +#define t_command_character(t) (t)->strs[TICODE_cmdch] +#define t_create_window(t) (t)->strs[TICODE_cwin] +#define t_cursor_address(t) (t)->strs[TICODE_cup] +#define t_cursor_down(t) (t)->strs[TICODE_cud1] +#define t_cursor_home(t) (t)->strs[TICODE_home] +#define t_cursor_invisible(t) (t)->strs[TICODE_civis] +#define t_cursor_left(t) (t)->strs[TICODE_cub1] +#define t_cursor_mem_address(t) (t)->strs[TICODE_mrcup] +#define t_cursor_normal(t) (t)->strs[TICODE_cnorm] +#define t_cursor_right(t) (t)->strs[TICODE_cuf1] +#define t_cursor_to_ll(t) (t)->strs[TICODE_ll] +#define t_cursor_up(t) (t)->strs[TICODE_cuu1] +#define t_cursor_visible(t) (t)->strs[TICODE_cvvis] +#define t_define_bit_image_region(t) (t)->strs[TICODE_defbi] +#define t_define_char(t) (t)->strs[TICODE_defc] +#define t_delete_character(t) (t)->strs[TICODE_dch1] +#define t_delete_line(t) (t)->strs[TICODE_dl1] +#define t_device_type(t) (t)->strs[TICODE_devt] +#define t_dial_phone(t) (t)->strs[TICODE_dial] +#define t_dis_status_line(t) (t)->strs[TICODE_dsl] +#define t_display_clock(t) (t)->strs[TICODE_dclk] +#define t_display_pc_char(t) (t)->strs[TICODE_dispc] +#define t_down_half_time(t) (t)->strs[TICODE_hd] +#define t_ena_acs(t) (t)->strs[TICODE_enacs] +#define t_end_bit_image_region(t) (t)->strs[TICODE_endbi] +#define t_enter_alt_charset_mode(t) (t)->strs[TICODE_smacs] +#define t_enter_am_mode(t) (t)->strs[TICODE_smam] +#define t_enter_blink_mode(t) (t)->strs[TICODE_blink] +#define t_enter_bold_mode(t) (t)->strs[TICODE_bold] +#define t_enter_ca_mode(t) (t)->strs[TICODE_smcup] +#define t_enter_delete_mode(t) (t)->strs[TICODE_smdc] +#define t_enter_dim_mode(t) (t)->strs[TICODE_dim] +#define t_enter_doublewide_mode(t) (t)->strs[TICODE_swidm] +#define t_enter_draft_quality(t) (t)->strs[TICODE_sdrfq] +#define t_enter_horizontal_hl_mode(t) (t)->strs[TICODE_ehhlm] +#define t_enter_insert_mode(t) (t)->strs[TICODE_smir] +#define t_enter_italics_mode(t) (t)->strs[TICODE_sitm] +#define t_enter_left_hl_mode(t) (t)->strs[TICODE_elhlm] +#define t_enter_leftward_mode(t) (t)->strs[TICODE_slm] +#define t_enter_low_hl_mode(t) (t)->strs[TICODE_elohlm] +#define t_enter_micro_mode(t) (t)->strs[TICODE_smicm] +#define t_enter_near_quality_letter(t) (t)->strs[TICODE_snlq] +#define t_enter_normal_quality(t) (t)->strs[TICODE_snrmq] +#define t_enter_pc_charset_mode(t) (t)->strs[TICODE_smpch] +#define t_enter_protected_mode(t) (t)->strs[TICODE_prot] +#define t_enter_reverse_mode(t) (t)->strs[TICODE_rev] +#define t_enter_right_hl_mode(t) (t)->strs[TICODE_erhlm] +#define t_enter_scancode_mode(t) (t)->strs[TICODE_smsc] +#define t_enter_secure_mode(t) (t)->strs[TICODE_invis] +#define t_enter_shadow_mode(t) (t)->strs[TICODE_sshm] +#define t_enter_standout_mode(t) (t)->strs[TICODE_smso] +#define t_enter_subscript_mode(t) (t)->strs[TICODE_ssubm] +#define t_enter_superscript_mode(t) (t)->strs[TICODE_ssupm] +#define t_enter_top_hl_mode(t) (t)->strs[TICODE_ethlm] +#define t_enter_underline_mode(t) (t)->strs[TICODE_smul] +#define t_enter_upward_mode(t) (t)->strs[TICODE_sum] +#define t_enter_vertical_hl_mode(t) (t)->strs[TICODE_evhlm] +#define t_enter_xon_mode(t) (t)->strs[TICODE_smxon] +#define t_erase_chars(t) (t)->strs[TICODE_ech] +#define t_exit_alt_charset_mode(t) (t)->strs[TICODE_rmacs] +#define t_exit_am_mode(t) (t)->strs[TICODE_rmam] +#define t_exit_attribute_mode(t) (t)->strs[TICODE_sgr0] +#define t_exit_ca_mode(t) (t)->strs[TICODE_rmcup] +#define t_exit_delete_mode(t) (t)->strs[TICODE_rmdc] +#define t_exit_doublewide_mode(t) (t)->strs[TICODE_rwidm] +#define t_exit_insert_mode(t) (t)->strs[TICODE_rmir] +#define t_exit_italics_mode(t) (t)->strs[TICODE_ritm] +#define t_exit_leftward_mode(t) (t)->strs[TICODE_rlm] +#define t_exit_micro_mode(t) (t)->strs[TICODE_rmicm] +#define t_exit_pc_charset_mode(t) (t)->strs[TICODE_rmpch] +#define t_exit_scancode_mode(t) (t)->strs[TICODE_rmsc] +#define t_exit_shadow_mode(t) (t)->strs[TICODE_rshm] +#define t_exit_standout_mode(t) (t)->strs[TICODE_rmso] +#define t_exit_subscript_mode(t) (t)->strs[TICODE_rsubm] +#define t_exit_superscript_mode(t) (t)->strs[TICODE_rsupm] +#define t_exit_underline_mode(t) (t)->strs[TICODE_rmul] +#define t_exit_upward_mode(t) (t)->strs[TICODE_rum] +#define t_exit_xon_mode(t) (t)->strs[TICODE_rmxon] +#define t_fixed_pause(t) (t)->strs[TICODE_pause] +#define t_flash_hook(t) (t)->strs[TICODE_hook] +#define t_flash_screen(t) (t)->strs[TICODE_flash] +#define t_form_feed(t) (t)->strs[TICODE_ff] +#define t_from_status_line(t) (t)->strs[TICODE_fsl] +#define t_get_mouse(t) (t)->strs[TICODE_getm] +#define t_goto_window(t) (t)->strs[TICODE_wingo] +#define t_hangup(t) (t)->strs[TICODE_hup] +#define t_init_1string(t) (t)->strs[TICODE_is1] +#define t_init_2string(t) (t)->strs[TICODE_is2] +#define t_init_3string(t) (t)->strs[TICODE_is3] +#define t_init_file(t) (t)->strs[TICODE_if] +#define t_init_prog(t) (t)->strs[TICODE_iprog] +#define t_initialize_color(t) (t)->strs[TICODE_initc] +#define t_initialize_pair(t) (t)->strs[TICODE_initp] +#define t_insert_character(t) (t)->strs[TICODE_ich1] +#define t_insert_line(t) (t)->strs[TICODE_il1] +#define t_insert_padding(t) (t)->strs[TICODE_ip] +#define t_key_a1(t) (t)->strs[TICODE_ka1] +#define t_key_a3(t) (t)->strs[TICODE_ka3] +#define t_key_b2(t) (t)->strs[TICODE_kb2] +#define t_key_backspace(t) (t)->strs[TICODE_kbs] +#define t_key_beg(t) (t)->strs[TICODE_kbeg] +#define t_key_btab(t) (t)->strs[TICODE_kcbt] +#define t_key_c1(t) (t)->strs[TICODE_kc1] +#define t_key_c3(t) (t)->strs[TICODE_kc3] +#define t_key_cancel(t) (t)->strs[TICODE_kcan] +#define t_key_catab(t) (t)->strs[TICODE_ktbc] +#define t_key_clear(t) (t)->strs[TICODE_kclr] +#define t_key_close(t) (t)->strs[TICODE_kclo] +#define t_key_command(t) (t)->strs[TICODE_kcmd] +#define t_key_copy(t) (t)->strs[TICODE_kcpy] +#define t_key_create(t) (t)->strs[TICODE_kcrt] +#define t_key_ctab(t) (t)->strs[TICODE_kctab] +#define t_key_dc(t) (t)->strs[TICODE_kdch1] +#define t_key_dl(t) (t)->strs[TICODE_kdl1] +#define t_key_down(t) (t)->strs[TICODE_kcud1] +#define t_key_eic(t) (t)->strs[TICODE_krmir] +#define t_key_end(t) (t)->strs[TICODE_kend] +#define t_key_enter(t) (t)->strs[TICODE_kent] +#define t_key_eol(t) (t)->strs[TICODE_kel] +#define t_key_eos(t) (t)->strs[TICODE_ked] +#define t_key_exit(t) (t)->strs[TICODE_kext] +#define t_key_f0(t) (t)->strs[TICODE_kf0] +#define t_key_f1(t) (t)->strs[TICODE_kf1] +#define t_key_f2(t) (t)->strs[TICODE_kf2] +#define t_key_f3(t) (t)->strs[TICODE_kf3] +#define t_key_f4(t) (t)->strs[TICODE_kf4] +#define t_key_f5(t) (t)->strs[TICODE_kf5] +#define t_key_f6(t) (t)->strs[TICODE_kf6] +#define t_key_f7(t) (t)->strs[TICODE_kf7] +#define t_key_f8(t) (t)->strs[TICODE_kf8] +#define t_key_f9(t) (t)->strs[TICODE_kf9] +#define t_key_f10(t) (t)->strs[TICODE_kf10] +#define t_key_f11(t) (t)->strs[TICODE_kf11] +#define t_key_f12(t) (t)->strs[TICODE_kf12] +#define t_key_f13(t) (t)->strs[TICODE_kf13] +#define t_key_f14(t) (t)->strs[TICODE_kf14] +#define t_key_f15(t) (t)->strs[TICODE_kf15] +#define t_key_f16(t) (t)->strs[TICODE_kf16] +#define t_key_f17(t) (t)->strs[TICODE_kf17] +#define t_key_f18(t) (t)->strs[TICODE_kf18] +#define t_key_f19(t) (t)->strs[TICODE_kf19] +#define t_key_f20(t) (t)->strs[TICODE_kf20] +#define t_key_f21(t) (t)->strs[TICODE_kf21] +#define t_key_f22(t) (t)->strs[TICODE_kf22] +#define t_key_f23(t) (t)->strs[TICODE_kf23] +#define t_key_f24(t) (t)->strs[TICODE_kf24] +#define t_key_f25(t) (t)->strs[TICODE_kf25] +#define t_key_f26(t) (t)->strs[TICODE_kf26] +#define t_key_f27(t) (t)->strs[TICODE_kf27] +#define t_key_f28(t) (t)->strs[TICODE_kf28] +#define t_key_f29(t) (t)->strs[TICODE_kf29] +#define t_key_f30(t) (t)->strs[TICODE_kf30] +#define t_key_f31(t) (t)->strs[TICODE_kf31] +#define t_key_f32(t) (t)->strs[TICODE_kf32] +#define t_key_f33(t) (t)->strs[TICODE_kf33] +#define t_key_f34(t) (t)->strs[TICODE_kf34] +#define t_key_f35(t) (t)->strs[TICODE_kf35] +#define t_key_f36(t) (t)->strs[TICODE_kf36] +#define t_key_f37(t) (t)->strs[TICODE_kf37] +#define t_key_f38(t) (t)->strs[TICODE_kf38] +#define t_key_f39(t) (t)->strs[TICODE_kf39] +#define t_key_f40(t) (t)->strs[TICODE_kf40] +#define t_key_f41(t) (t)->strs[TICODE_kf41] +#define t_key_f42(t) (t)->strs[TICODE_kf42] +#define t_key_f43(t) (t)->strs[TICODE_kf43] +#define t_key_f44(t) (t)->strs[TICODE_kf44] +#define t_key_f45(t) (t)->strs[TICODE_kf45] +#define t_key_f46(t) (t)->strs[TICODE_kf46] +#define t_key_f47(t) (t)->strs[TICODE_kf47] +#define t_key_f48(t) (t)->strs[TICODE_kf48] +#define t_key_f49(t) (t)->strs[TICODE_kf49] +#define t_key_f50(t) (t)->strs[TICODE_kf50] +#define t_key_f51(t) (t)->strs[TICODE_kf51] +#define t_key_f52(t) (t)->strs[TICODE_kf52] +#define t_key_f53(t) (t)->strs[TICODE_kf53] +#define t_key_f54(t) (t)->strs[TICODE_kf54] +#define t_key_f55(t) (t)->strs[TICODE_kf55] +#define t_key_f56(t) (t)->strs[TICODE_kf56] +#define t_key_f57(t) (t)->strs[TICODE_kf57] +#define t_key_f58(t) (t)->strs[TICODE_kf58] +#define t_key_f59(t) (t)->strs[TICODE_kf59] +#define t_key_f60(t) (t)->strs[TICODE_kf60] +#define t_key_f61(t) (t)->strs[TICODE_kf61] +#define t_key_f62(t) (t)->strs[TICODE_kf62] +#define t_key_f63(t) (t)->strs[TICODE_kf63] +#define t_key_find(t) (t)->strs[TICODE_kfnd] +#define t_key_help(t) (t)->strs[TICODE_khlp] +#define t_key_home(t) (t)->strs[TICODE_khome] +#define t_key_ic(t) (t)->strs[TICODE_kich1] +#define t_key_il(t) (t)->strs[TICODE_kil1] +#define t_key_left(t) (t)->strs[TICODE_kcub1] +#define t_key_ll(t) (t)->strs[TICODE_kll] +#define t_key_mark(t) (t)->strs[TICODE_kmrk] +#define t_key_message(t) (t)->strs[TICODE_kmsg] +#define t_key_mouse(t) (t)->strs[TICODE_kmous] +#define t_key_move(t) (t)->strs[TICODE_kmov] +#define t_key_next(t) (t)->strs[TICODE_knxt] +#define t_key_npage(t) (t)->strs[TICODE_knp] +#define t_key_open(t) (t)->strs[TICODE_kopn] +#define t_key_options(t) (t)->strs[TICODE_kopt] +#define t_key_ppage(t) (t)->strs[TICODE_kpp] +#define t_key_previous(t) (t)->strs[TICODE_kprv] +#define t_key_print(t) (t)->strs[TICODE_kprt] +#define t_key_redo(t) (t)->strs[TICODE_krdo] +#define t_key_reference(t) (t)->strs[TICODE_kref] +#define t_key_refresh(t) (t)->strs[TICODE_krfr] +#define t_key_replace(t) (t)->strs[TICODE_krpl] +#define t_key_restart(t) (t)->strs[TICODE_krst] +#define t_key_resume(t) (t)->strs[TICODE_kres] +#define t_key_right(t) (t)->strs[TICODE_kcuf1] +#define t_key_save(t) (t)->strs[TICODE_ksav] +#define t_key_sbeg(t) (t)->strs[TICODE_kBEG] +#define t_key_scancel(t) (t)->strs[TICODE_kCAN] +#define t_key_scommand(t) (t)->strs[TICODE_kCMD] +#define t_key_scopy(t) (t)->strs[TICODE_kCPY] +#define t_key_screate(t) (t)->strs[TICODE_kCRT] +#define t_key_sdc(t) (t)->strs[TICODE_kDC] +#define t_key_sdl(t) (t)->strs[TICODE_kDL] +#define t_key_select(t) (t)->strs[TICODE_kslt] +#define t_key_send(t) (t)->strs[TICODE_kEND] +#define t_key_seol(t) (t)->strs[TICODE_kEOL] +#define t_key_sexit(t) (t)->strs[TICODE_kEXT] +#define t_key_sf(t) (t)->strs[TICODE_kind] +#define t_key_sfind(t) (t)->strs[TICODE_kFND] +#define t_key_shelp(t) (t)->strs[TICODE_kHLP] +#define t_key_shome(t) (t)->strs[TICODE_kHOM] +#define t_key_sic(t) (t)->strs[TICODE_kIC] +#define t_key_sleft(t) (t)->strs[TICODE_kLFT] +#define t_key_smessage(t) (t)->strs[TICODE_kMSG] +#define t_key_smove(t) (t)->strs[TICODE_kMOV] +#define t_key_snext(t) (t)->strs[TICODE_kNXT] +#define t_key_soptions(t) (t)->strs[TICODE_kOPT] +#define t_key_sprevious(t) (t)->strs[TICODE_kPRV] +#define t_key_sprint(t) (t)->strs[TICODE_kPRT] +#define t_key_sr(t) (t)->strs[TICODE_kri] +#define t_key_sredo(t) (t)->strs[TICODE_kRDO] +#define t_key_sreplace(t) (t)->strs[TICODE_kRPL] +#define t_key_sright(t) (t)->strs[TICODE_kRIT] +#define t_key_srsume(t) (t)->strs[TICODE_kRES] +#define t_key_ssave(t) (t)->strs[TICODE_kSAV] +#define t_key_ssuspend(t) (t)->strs[TICODE_kSPD] +#define t_key_stab(t) (t)->strs[TICODE_khts] +#define t_key_sundo(t) (t)->strs[TICODE_kUND] +#define t_key_suspend(t) (t)->strs[TICODE_kspd] +#define t_key_undo(t) (t)->strs[TICODE_kund] +#define t_key_up(t) (t)->strs[TICODE_kcuu1] +#define t_keypad_local(t) (t)->strs[TICODE_rmkx] +#define t_keypad_xmit(t) (t)->strs[TICODE_smkx] +#define t_lab_f0(t) (t)->strs[TICODE_lf0] +#define t_lab_f1(t) (t)->strs[TICODE_lf1] +#define t_lab_f2(t) (t)->strs[TICODE_lf2] +#define t_lab_f3(t) (t)->strs[TICODE_lf3] +#define t_lab_f4(t) (t)->strs[TICODE_lf4] +#define t_lab_f5(t) (t)->strs[TICODE_lf5] +#define t_lab_f6(t) (t)->strs[TICODE_lf6] +#define t_lab_f7(t) (t)->strs[TICODE_lf7] +#define t_lab_f8(t) (t)->strs[TICODE_lf8] +#define t_lab_f9(t) (t)->strs[TICODE_lf9] +#define t_lab_f10(t) (t)->strs[TICODE_lf10] +#define t_label_format(t) (t)->strs[TICODE_fln] +#define t_label_off(t) (t)->strs[TICODE_rmln] +#define t_label_on(t) (t)->strs[TICODE_smln] +#define t_meta_off(t) (t)->strs[TICODE_rmm] +#define t_meta_on(t) (t)->strs[TICODE_smm] +#define t_micro_column_address(t) (t)->strs[TICODE_mhpa] +#define t_micro_down(t) (t)->strs[TICODE_mcud1] +#define t_micro_left(t) (t)->strs[TICODE_mcub1] +#define t_micro_right(t) (t)->strs[TICODE_mcuf1] +#define t_micro_row_address(t) (t)->strs[TICODE_mvpa] +#define t_micro_up(t) (t)->strs[TICODE_mcuu1] +#define t_mouse_info(t) (t)->strs[TICODE_minfo] +#define t_newline(t) (t)->strs[TICODE_nel] +#define t_order_of_pins(t) (t)->strs[TICODE_porder] +#define t_orig_colors(t) (t)->strs[TICODE_oc] +#define t_orig_pair(t) (t)->strs[TICODE_op] +#define t_pad_char(t) (t)->strs[TICODE_pad] +#define t_parm_dch(t) (t)->strs[TICODE_dch] +#define t_parm_delete_line(t) (t)->strs[TICODE_dl] +#define t_parm_down_cursor(t) (t)->strs[TICODE_cud] +#define t_parm_down_micro(t) (t)->strs[TICODE_mcud] +#define t_parm_ich(t) (t)->strs[TICODE_ich] +#define t_parm_index(t) (t)->strs[TICODE_indn] +#define t_parm_insert_line(t) (t)->strs[TICODE_il] +#define t_parm_left_cursor(t) (t)->strs[TICODE_cub] +#define t_parm_left_micro(t) (t)->strs[TICODE_mcub] +#define t_parm_right_cursor(t) (t)->strs[TICODE_cuf] +#define t_parm_right_micro(t) (t)->strs[TICODE_mcuf] +#define t_parm_rindex(t) (t)->strs[TICODE_rin] +#define t_parm_up_cursor(t) (t)->strs[TICODE_cuu] +#define t_parm_up_micro(t) (t)->strs[TICODE_mcuu] +#define t_pc_term_options(t) (t)->strs[TICODE_pctrm] +#define t_pkey_key(t) (t)->strs[TICODE_pfkey] +#define t_pkey_local(t) (t)->strs[TICODE_pfloc] +#define t_pkey_plab(t) (t)->strs[TICODE_pfxl] +#define t_pkey_xmit(t) (t)->strs[TICODE_pfx] +#define t_plab_norm(t) (t)->strs[TICODE_pln] +#define t_print_screen(t) (t)->strs[TICODE_mc0] +#define t_ptr_non(t) (t)->strs[TICODE_mc5p] +#define t_ptr_off(t) (t)->strs[TICODE_mc4] +#define t_ptr_on(t) (t)->strs[TICODE_mc5] +#define t_pulse(t) (t)->strs[TICODE_pulse] +#define t_quick_dial(t) (t)->strs[TICODE_qdial] +#define t_remove_clock(t) (t)->strs[TICODE_rmclk] +#define t_repeat_char(t) (t)->strs[TICODE_rep] +#define t_req_for_input(t) (t)->strs[TICODE_rfi] +#define t_req_mouse_pos(t) (t)->strs[TICODE_reqmp] +#define t_reset_1string(t) (t)->strs[TICODE_rs1] +#define t_reset_2string(t) (t)->strs[TICODE_rs2] +#define t_reset_3string(t) (t)->strs[TICODE_rs3] +#define t_reset_file(t) (t)->strs[TICODE_rf] +#define t_restore_cursor(t) (t)->strs[TICODE_rc] +#define t_row_address(t) (t)->strs[TICODE_vpa] +#define t_save_cursor(t) (t)->strs[TICODE_sc] +#define t_scancode_escape(t) (t)->strs[TICODE_scesc] +#define t_scroll_forward(t) (t)->strs[TICODE_ind] +#define t_scroll_reverse(t) (t)->strs[TICODE_ri] +#define t_select_char_set(t) (t)->strs[TICODE_scs] +#define t_set0_des_seq(t) (t)->strs[TICODE_s0ds] +#define t_set1_des_seq(t) (t)->strs[TICODE_s1ds] +#define t_set2_des_seq(t) (t)->strs[TICODE_s2ds] +#define t_set3_des_seq(t) (t)->strs[TICODE_s3ds] +#define t_set_a_attributes(t) (t)->strs[TICODE_sgr1] +#define t_set_a_background(t) (t)->strs[TICODE_setab] +#define t_set_a_foreground(t) (t)->strs[TICODE_setaf] +#define t_set_attributes(t) (t)->strs[TICODE_sgr] +#define t_set_background(t) (t)->strs[TICODE_setb] +#define t_set_bottom_margin(t) (t)->strs[TICODE_smgb] +#define t_set_bottom_margin_parm(t) (t)->strs[TICODE_smgbp] +#define t_set_clock(t) (t)->strs[TICODE_sclk] +#define t_set_color_band(t) (t)->strs[TICODE_setcolor] +#define t_set_color_pair(t) (t)->strs[TICODE_scp] +#define t_set_foreground(t) (t)->strs[TICODE_setf] +#define t_set_left_margin(t) (t)->strs[TICODE_smgl] +#define t_set_left_margin_parm(t) (t)->strs[TICODE_smglp] +#define t_set_lr_margin(t) (t)->strs[TICODE_smglr] +#define t_set_page_length(t) (t)->strs[TICODE_slines] +#define t_set_pglen_inch(t) (t)->strs[TICODE_slength] +#define t_set_right_margin(t) (t)->strs[TICODE_smgr] +#define t_set_right_margin_parm(t) (t)->strs[TICODE_smgrp] +#define t_set_tab(t) (t)->strs[TICODE_hts] +#define t_set_tb_margin(t) (t)->strs[TICODE_smgtb] +#define t_set_top_margin(t) (t)->strs[TICODE_smgt] +#define t_set_top_margin_parm(t) (t)->strs[TICODE_smgtp] +#define t_set_window(t) (t)->strs[TICODE_wind] +#define t_start_bit_image(t) (t)->strs[TICODE_sbim] +#define t_start_char_set_def(t) (t)->strs[TICODE_scsd] +#define t_stop_bit_image(t) (t)->strs[TICODE_rbim] +#define t_stop_char_set_def(t) (t)->strs[TICODE_rcsd] +#define t_subscript_characters(t) (t)->strs[TICODE_subcs] +#define t_superscript_characters(t) (t)->strs[TICODE_supcs] +#define t_tab(t) (t)->strs[TICODE_ht] +#define t_these_cause_cr(t) (t)->strs[TICODE_docr] +#define t_to_status_line(t) (t)->strs[TICODE_tsl] +#define t_tone(t) (t)->strs[TICODE_tone] +#define t_user0(t) (t)->strs[TICODE_u0] +#define t_user1(t) (t)->strs[TICODE_u1] +#define t_user2(t) (t)->strs[TICODE_u2] +#define t_user3(t) (t)->strs[TICODE_u3] +#define t_user4(t) (t)->strs[TICODE_u4] +#define t_user5(t) (t)->strs[TICODE_u5] +#define t_user6(t) (t)->strs[TICODE_u6] +#define t_user7(t) (t)->strs[TICODE_u7] +#define t_user8(t) (t)->strs[TICODE_u8] +#define t_user9(t) (t)->strs[TICODE_u9] +#define t_underline_char(t) (t)->strs[TICODE_uc] +#define t_up_half_line(t) (t)->strs[TICODE_hu] +#define t_wait_tone(t) (t)->strs[TICODE_wait] +#define t_xoff_character(t) (t)->strs[TICODE_xoffc] +#define t_xon_character(t) (t)->strs[TICODE_xonc] +#define t_zero_motion(t) (t)->strs[TICODE_zerom] + +#define acs_chars t_acs_chars(cur_term) +#define alt_scancode_esc t_alt_scancode_esc(cur_term) +#define back_tab t_back_tab(cur_term) +#define bell t_bell(cur_term) +#define bit_image_carriage_return t_bit_image_carriage_return(cur_term) +#define bit_image_newline t_bit_image_newline(cur_term) +#define bit_image_repeat t_bit_image_repeat(cur_term) +#define carriage_return t_carriage_return(cur_term) +#define change_char_pitch t_change_char_pitch(cur_term) +#define change_line_pitch t_change_line_pitch(cur_term) +#define change_res_horz t_change_res_horz(cur_term) +#define change_res_vert t_change_res_vert(cur_term) +#define change_scroll_region t_change_scroll_region(cur_term) +#define char_padding t_char_padding(cur_term) +#define char_set_names t_char_set_names(cur_term) +#define clear_all_tabs t_clear_all_tabs(cur_term) +#define clear_margins t_clear_margins(cur_term) +#define clear_screen t_clear_screen(cur_term) +#define clr_bol t_clr_bol(cur_term) +#define clr_eol t_clr_eol(cur_term) +#define clr_eos t_clr_eos(cur_term) +#define code_set_init t_code_set_init(cur_term) +#define color_names t_color_names(cur_term) +#define column_address t_column_address(cur_term) +#define command_character t_command_character(cur_term) +#define create_window t_create_window(cur_term) +#define cursor_address t_cursor_address(cur_term) +#define cursor_down t_cursor_down(cur_term) +#define cursor_home t_cursor_home(cur_term) +#define cursor_invisible t_cursor_invisible(cur_term) +#define cursor_left t_cursor_left(cur_term) +#define cursor_mem_address t_cursor_mem_address(cur_term) +#define cursor_normal t_cursor_normal(cur_term) +#define cursor_right t_cursor_right(cur_term) +#define cursor_to_ll t_cursor_to_ll(cur_term) +#define cursor_up t_cursor_up(cur_term) +#define cursor_visible t_cursor_visible(cur_term) +#define define_bit_image_region t_define_bit_image_region(cur_term) +#define define_char t_define_char(cur_term) +#define delete_character t_delete_character(cur_term) +#define delete_line t_delete_line(cur_term) +#define device_type t_device_type(cur_term) +#define dial_phone t_dial_phone(cur_term) +#define dis_status_line t_dis_status_line(cur_term) +#define display_clock t_display_clock(cur_term) +#define display_pc_char t_display_pc_char(cur_term) +#define down_half_time t_down_half_time(cur_term) +#define ena_acs t_ena_acs(cur_term) +#define end_bit_image_region t_end_bit_image_region(cur_term) +#define enter_alt_charset_mode t_enter_alt_charset_mode(cur_term) +#define enter_am_mode t_enter_am_mode(cur_term) +#define enter_blink_mode t_enter_blink_mode(cur_term) +#define enter_bold_mode t_enter_bold_mode(cur_term) +#define enter_ca_mode t_enter_ca_mode(cur_term) +#define enter_delete_mode t_enter_delete_mode(cur_term) +#define enter_dim_mode t_enter_dim_mode(cur_term) +#define enter_doublewide_mode t_enter_doublewide_mode(cur_term) +#define enter_draft_quality t_enter_draft_quality(cur_term) +#define enter_horizontal_hl_mode t_enter_horizontal_hl_mode(cur_term) +#define enter_insert_mode t_enter_insert_mode(cur_term) +#define enter_italics_mode t_enter_italics_mode(cur_term) +#define enter_left_hl_mode t_enter_left_hl_mode(cur_term) +#define enter_leftward_mode t_enter_leftward_mode(cur_term) +#define enter_low_hl_mode t_enter_low_hl_mode(cur_term) +#define enter_micro_mode t_enter_micro_mode(cur_term) +#define enter_near_quality_letter t_enter_near_quality_letter(cur_term) +#define enter_normal_quality t_enter_normal_quality(cur_term) +#define enter_pc_charset_mode t_enter_pc_charset_mode(cur_term) +#define enter_protected_mode t_enter_protected_mode(cur_term) +#define enter_reverse_mode t_enter_reverse_mode(cur_term) +#define enter_right_hl_mode t_enter_right_hl_mode(cur_term) +#define enter_scancode_mode t_enter_scancode_mode(cur_term) +#define enter_secure_mode t_enter_secure_mode(cur_term) +#define enter_shadow_mode t_enter_shadow_mode(cur_term) +#define enter_standout_mode t_enter_standout_mode(cur_term) +#define enter_subscript_mode t_enter_subscript_mode(cur_term) +#define enter_superscript_mode t_enter_superscript_mode(cur_term) +#define enter_top_hl_mode t_enter_top_hl_mode(cur_term) +#define enter_underline_mode t_enter_underline_mode(cur_term) +#define enter_upward_mode t_enter_upward_mode(cur_term) +#define enter_vertical_hl_mode t_enter_vertical_hl_mode(cur_term) +#define enter_xon_mode t_enter_xon_mode(cur_term) +#define erase_chars t_erase_chars(cur_term) +#define exit_alt_charset_mode t_exit_alt_charset_mode(cur_term) +#define exit_am_mode t_exit_am_mode(cur_term) +#define exit_attribute_mode t_exit_attribute_mode(cur_term) +#define exit_ca_mode t_exit_ca_mode(cur_term) +#define exit_delete_mode t_exit_delete_mode(cur_term) +#define exit_doublewide_mode t_exit_doublewide_mode(cur_term) +#define exit_insert_mode t_exit_insert_mode(cur_term) +#define exit_italics_mode t_exit_italics_mode(cur_term) +#define exit_leftward_mode t_exit_leftward_mode(cur_term) +#define exit_micro_mode t_exit_micro_mode(cur_term) +#define exit_pc_charset_mode t_exit_pc_charset_mode(cur_term) +#define exit_scancode_mode t_exit_scancode_mode(cur_term) +#define exit_shadow_mode t_exit_shadow_mode(cur_term) +#define exit_standout_mode t_exit_standout_mode(cur_term) +#define exit_subscript_mode t_exit_subscript_mode(cur_term) +#define exit_superscript_mode t_exit_superscript_mode(cur_term) +#define exit_underline_mode t_exit_underline_mode(cur_term) +#define exit_upward_mode t_exit_upward_mode(cur_term) +#define exit_xon_mode t_exit_xon_mode(cur_term) +#define fixed_pause t_fixed_pause(cur_term) +#define flash_hook t_flash_hook(cur_term) +#define flash_screen t_flash_screen(cur_term) +#define form_feed t_form_feed(cur_term) +#define from_status_line t_from_status_line(cur_term) +#define get_mouse t_get_mouse(cur_term) +#define goto_window t_goto_window(cur_term) +#define hangup t_hangup(cur_term) +#define init_1string t_init_1string(cur_term) +#define init_2string t_init_2string(cur_term) +#define init_3string t_init_3string(cur_term) +#define init_file t_init_file(cur_term) +#define init_prog t_init_prog(cur_term) +#define initialize_color t_initialize_color(cur_term) +#define initialize_pair t_initialize_pair(cur_term) +#define insert_character t_insert_character(cur_term) +#define insert_line t_insert_line(cur_term) +#define insert_padding t_insert_padding(cur_term) +#define key_a1 t_key_a1(cur_term) +#define key_a3 t_key_a3(cur_term) +#define key_b2 t_key_b2(cur_term) +#define key_backspace t_key_backspace(cur_term) +#define key_beg t_key_beg(cur_term) +#define key_btab t_key_btab(cur_term) +#define key_c1 t_key_c1(cur_term) +#define key_c3 t_key_c3(cur_term) +#define key_cancel t_key_cancel(cur_term) +#define key_catab t_key_catab(cur_term) +#define key_clear t_key_clear(cur_term) +#define key_close t_key_close(cur_term) +#define key_command t_key_command(cur_term) +#define key_copy t_key_copy(cur_term) +#define key_create t_key_create(cur_term) +#define key_ctab t_key_ctab(cur_term) +#define key_dc t_key_dc(cur_term) +#define key_dl t_key_dl(cur_term) +#define key_down t_key_down(cur_term) +#define key_eic t_key_eic(cur_term) +#define key_end t_key_end(cur_term) +#define key_enter t_key_enter(cur_term) +#define key_eol t_key_eol(cur_term) +#define key_eos t_key_eos(cur_term) +#define key_exit t_key_exit(cur_term) +#define key_f0 t_key_f0(cur_term) +#define key_f1 t_key_f1(cur_term) +#define key_f2 t_key_f2(cur_term) +#define key_f3 t_key_f3(cur_term) +#define key_f4 t_key_f4(cur_term) +#define key_f5 t_key_f5(cur_term) +#define key_f6 t_key_f6(cur_term) +#define key_f7 t_key_f7(cur_term) +#define key_f8 t_key_f8(cur_term) +#define key_f9 t_key_f9(cur_term) +#define key_f10 t_key_f10(cur_term) +#define key_f11 t_key_f11(cur_term) +#define key_f12 t_key_f12(cur_term) +#define key_f13 t_key_f13(cur_term) +#define key_f14 t_key_f14(cur_term) +#define key_f15 t_key_f15(cur_term) +#define key_f16 t_key_f16(cur_term) +#define key_f17 t_key_f17(cur_term) +#define key_f18 t_key_f18(cur_term) +#define key_f19 t_key_f19(cur_term) +#define key_f20 t_key_f20(cur_term) +#define key_f21 t_key_f21(cur_term) +#define key_f22 t_key_f22(cur_term) +#define key_f23 t_key_f23(cur_term) +#define key_f24 t_key_f24(cur_term) +#define key_f25 t_key_f25(cur_term) +#define key_f26 t_key_f26(cur_term) +#define key_f27 t_key_f27(cur_term) +#define key_f28 t_key_f28(cur_term) +#define key_f29 t_key_f29(cur_term) +#define key_f30 t_key_f30(cur_term) +#define key_f31 t_key_f31(cur_term) +#define key_f32 t_key_f32(cur_term) +#define key_f33 t_key_f33(cur_term) +#define key_f34 t_key_f34(cur_term) +#define key_f35 t_key_f35(cur_term) +#define key_f36 t_key_f36(cur_term) +#define key_f37 t_key_f37(cur_term) +#define key_f38 t_key_f38(cur_term) +#define key_f39 t_key_f39(cur_term) +#define key_f40 t_key_f40(cur_term) +#define key_f41 t_key_f41(cur_term) +#define key_f42 t_key_f42(cur_term) +#define key_f43 t_key_f43(cur_term) +#define key_f44 t_key_f44(cur_term) +#define key_f45 t_key_f45(cur_term) +#define key_f46 t_key_f46(cur_term) +#define key_f47 t_key_f47(cur_term) +#define key_f48 t_key_f48(cur_term) +#define key_f49 t_key_f49(cur_term) +#define key_f50 t_key_f50(cur_term) +#define key_f51 t_key_f51(cur_term) +#define key_f52 t_key_f52(cur_term) +#define key_f53 t_key_f53(cur_term) +#define key_f54 t_key_f54(cur_term) +#define key_f55 t_key_f55(cur_term) +#define key_f56 t_key_f56(cur_term) +#define key_f57 t_key_f57(cur_term) +#define key_f58 t_key_f58(cur_term) +#define key_f59 t_key_f59(cur_term) +#define key_f60 t_key_f60(cur_term) +#define key_f61 t_key_f61(cur_term) +#define key_f62 t_key_f62(cur_term) +#define key_f63 t_key_f63(cur_term) +#define key_find t_key_find(cur_term) +#define key_help t_key_help(cur_term) +#define key_home t_key_home(cur_term) +#define key_ic t_key_ic(cur_term) +#define key_il t_key_il(cur_term) +#define key_left t_key_left(cur_term) +#define key_ll t_key_ll(cur_term) +#define key_mark t_key_mark(cur_term) +#define key_message t_key_message(cur_term) +#define key_mouse t_key_mouse(cur_term) +#define key_move t_key_move(cur_term) +#define key_next t_key_next(cur_term) +#define key_npage t_key_npage(cur_term) +#define key_open t_key_open(cur_term) +#define key_options t_key_options(cur_term) +#define key_ppage t_key_ppage(cur_term) +#define key_previous t_key_previous(cur_term) +#define key_print t_key_print(cur_term) +#define key_redo t_key_redo(cur_term) +#define key_reference t_key_reference(cur_term) +#define key_refresh t_key_refresh(cur_term) +#define key_replace t_key_replace(cur_term) +#define key_restart t_key_restart(cur_term) +#define key_resume t_key_resume(cur_term) +#define key_right t_key_right(cur_term) +#define key_save t_key_save(cur_term) +#define key_sbeg t_key_sbeg(cur_term) +#define key_scancel t_key_scancel(cur_term) +#define key_scommand t_key_scommand(cur_term) +#define key_scopy t_key_scopy(cur_term) +#define key_screate t_key_screate(cur_term) +#define key_sdc t_key_sdc(cur_term) +#define key_sdl t_key_sdl(cur_term) +#define key_select t_key_select(cur_term) +#define key_send t_key_send(cur_term) +#define key_seol t_key_seol(cur_term) +#define key_sexit t_key_sexit(cur_term) +#define key_sf t_key_sf(cur_term) +#define key_sfind t_key_sfind(cur_term) +#define key_shelp t_key_shelp(cur_term) +#define key_shome t_key_shome(cur_term) +#define key_sic t_key_sic(cur_term) +#define key_sleft t_key_sleft(cur_term) +#define key_smessage t_key_smessage(cur_term) +#define key_smove t_key_smove(cur_term) +#define key_snext t_key_snext(cur_term) +#define key_soptions t_key_soptions(cur_term) +#define key_sprevious t_key_sprevious(cur_term) +#define key_sprint t_key_sprint(cur_term) +#define key_sr t_key_sr(cur_term) +#define key_sredo t_key_sredo(cur_term) +#define key_sreplace t_key_sreplace(cur_term) +#define key_sright t_key_sright(cur_term) +#define key_srsume t_key_srsume(cur_term) +#define key_ssave t_key_ssave(cur_term) +#define key_ssuspend t_key_ssuspend(cur_term) +#define key_stab t_key_stab(cur_term) +#define key_sundo t_key_sundo(cur_term) +#define key_suspend t_key_suspend(cur_term) +#define key_undo t_key_undo(cur_term) +#define key_up t_key_up(cur_term) +#define keypad_local t_keypad_local(cur_term) +#define keypad_xmit t_keypad_xmit(cur_term) +#define lab_f0 t_lab_f0(cur_term) +#define lab_f1 t_lab_f1(cur_term) +#define lab_f2 t_lab_f2(cur_term) +#define lab_f3 t_lab_f3(cur_term) +#define lab_f4 t_lab_f4(cur_term) +#define lab_f5 t_lab_f5(cur_term) +#define lab_f6 t_lab_f6(cur_term) +#define lab_f7 t_lab_f7(cur_term) +#define lab_f8 t_lab_f8(cur_term) +#define lab_f9 t_lab_f9(cur_term) +#define lab_f10 t_lab_f10(cur_term) +#define label_format t_label_format(cur_term) +#define label_off t_label_off(cur_term) +#define label_on t_label_on(cur_term) +#define meta_off t_meta_off(cur_term) +#define meta_on t_meta_on(cur_term) +#define micro_column_address t_micro_column_address(cur_term) +#define micro_down t_micro_down(cur_term) +#define micro_left t_micro_left(cur_term) +#define micro_right t_micro_right(cur_term) +#define micro_row_address t_micro_row_address(cur_term) +#define micro_up t_micro_up(cur_term) +#define mouse_info t_mouse_info(cur_term) +#define newline t_newline(cur_term) +#define order_of_pins t_order_of_pins(cur_term) +#define orig_colors t_orig_colors(cur_term) +#define orig_pair t_orig_pair(cur_term) +#define pad_char t_pad_char(cur_term) +#define parm_dch t_parm_dch(cur_term) +#define parm_delete_line t_parm_delete_line(cur_term) +#define parm_down_cursor t_parm_down_cursor(cur_term) +#define parm_down_micro t_parm_down_micro(cur_term) +#define parm_ich t_parm_ich(cur_term) +#define parm_index t_parm_index(cur_term) +#define parm_insert_line t_parm_insert_line(cur_term) +#define parm_left_cursor t_parm_left_cursor(cur_term) +#define parm_left_micro t_parm_left_micro(cur_term) +#define parm_right_cursor t_parm_right_cursor(cur_term) +#define parm_right_micro t_parm_right_micro(cur_term) +#define parm_rindex t_parm_rindex(cur_term) +#define parm_up_cursor t_parm_up_cursor(cur_term) +#define parm_up_micro t_parm_up_micro(cur_term) +#define pc_term_options t_pc_term_options(cur_term) +#define pkey_key t_pkey_key(cur_term) +#define pkey_local t_pkey_local(cur_term) +#define pkey_plab t_pkey_plab(cur_term) +#define pkey_xmit t_pkey_xmit(cur_term) +#define plab_norm t_plab_norm(cur_term) +#define print_screen t_print_screen(cur_term) +#define ptr_non t_ptr_non(cur_term) +#define ptr_off t_ptr_off(cur_term) +#define ptr_on t_ptr_on(cur_term) +#define pulse t_pulse(cur_term) +#define quick_dial t_quick_dial(cur_term) +#define remove_clock t_remove_clock(cur_term) +#define repeat_char t_repeat_char(cur_term) +#define req_for_input t_req_for_input(cur_term) +#define req_mouse_pos t_req_mouse_pos(cur_term) +#define reset_1string t_reset_1string(cur_term) +#define reset_2string t_reset_2string(cur_term) +#define reset_3string t_reset_3string(cur_term) +#define reset_file t_reset_file(cur_term) +#define restore_cursor t_restore_cursor(cur_term) +#define row_address t_row_address(cur_term) +#define save_cursor t_save_cursor(cur_term) +#define scancode_escape t_scancode_escape(cur_term) +#define scroll_forward t_scroll_forward(cur_term) +#define scroll_reverse t_scroll_reverse(cur_term) +#define select_char_set t_select_char_set(cur_term) +#define set0_des_seq t_set0_des_seq(cur_term) +#define set1_des_seq t_set1_des_seq(cur_term) +#define set2_des_seq t_set2_des_seq(cur_term) +#define set3_des_seq t_set3_des_seq(cur_term) +#define set_a_attributes t_set_a_attributes(cur_term) +#define set_a_background t_set_a_background(cur_term) +#define set_a_foreground t_set_a_foreground(cur_term) +#define set_attributes t_set_attributes(cur_term) +#define set_background t_set_background(cur_term) +#define set_bottom_margin t_set_bottom_margin(cur_term) +#define set_bottom_margin_parm t_set_bottom_margin_parm(cur_term) +#define set_clock t_set_clock(cur_term) +#define set_color_band t_set_color_band(cur_term) +#define set_color_pair t_set_color_pair(cur_term) +#define set_foreground t_set_foreground(cur_term) +#define set_left_margin t_set_left_margin(cur_term) +#define set_left_margin_parm t_set_left_margin_parm(cur_term) +#define set_lr_margin t_set_lr_margin(cur_term) +#define set_page_length t_set_page_length(cur_term) +#define set_pglen_inch t_set_pglen_inch(cur_term) +#define set_right_margin t_set_right_margin(cur_term) +#define set_right_margin_parm t_set_right_margin_parm(cur_term) +#define set_tab t_set_tab(cur_term) +#define set_tb_margin t_set_tb_margin(cur_term) +#define set_top_margin t_set_top_margin(cur_term) +#define set_top_margin_parm t_set_top_margin_parm(cur_term) +#define set_window t_set_window(cur_term) +#define start_bit_image t_start_bit_image(cur_term) +#define start_char_set_def t_start_char_set_def(cur_term) +#define stop_bit_image t_stop_bit_image(cur_term) +#define stop_char_set_def t_stop_char_set_def(cur_term) +#define subscript_characters t_subscript_characters(cur_term) +#define superscript_characters t_superscript_characters(cur_term) +#define tab t_tab(cur_term) +#define these_cause_cr t_these_cause_cr(cur_term) +#define to_status_line t_to_status_line(cur_term) +#define tone t_tone(cur_term) +#define user0 t_user0(cur_term) +#define user1 t_user1(cur_term) +#define user2 t_user2(cur_term) +#define user3 t_user3(cur_term) +#define user4 t_user4(cur_term) +#define user5 t_user5(cur_term) +#define user6 t_user6(cur_term) +#define user7 t_user7(cur_term) +#define user8 t_user8(cur_term) +#define user9 t_user9(cur_term) +#define underline_char t_underline_char(cur_term) +#define up_half_line t_up_half_line(cur_term) +#define wait_tone t_wait_tone(cur_term) +#define xoff_character t_xoff_character(cur_term) +#define xon_character t_xon_character(cur_term) +#define zero_motion t_zero_motion(cur_term) + +/* + * STRING DESCRIPTIONS + * + * acs_chars: Graphic charset pairs aAbBcC + * alt_scancode_esc: Alternate escape for scancode emulation + * back_tab: Back tab + * bell: Audible signal (bell) + * bit_image_carriage_return: Move to beginning of same row + * bit_image_newline: Move to next row of the bit image + * bit_image_repeat: Repeat bit-image cell #1 #2 times + * carriage_return: Carriage return + * change_char_pitch: Change number of characters per inch + * change_line_pitch: Change number of lines per inch + * change_res_horz: Change horizontal resolution + * change_res_vert: Change vertical resolution + * change_scroll_region: Change to lines #1 through #2 (VT100) + * char_padding: Like ip but when in replace mode + * char_set_names: Returns a list of character set names + * clear_all_tabs: Clear all tab stops + * clear_margins: Clear all margins (top, bottom and sides) + * clear_screen: Clear screen and home cursor + * clr_bol: Clear to beginning of line, inclusive + * clr_eol: Clear to end of line + * clr_eos: Clear to end of display + * code_set_init: Init sequence for multiple codesets + * color_names: Give name for colour #1 + * column_address: Set horizontal position to absolute #1 + * command_character: Terminal settable cmd character in prototype + * create_window: Define win #1 to go from #2,#3 to #4,#5 + * cursor_address: Move to row #1, col #2 + * cursor_down: Down one line + * cursor_home: Home cursor (if no cup) + * cursor_invisible: Make cursor invisible + * cursor_left: Move left one space + * cursor_mem_address: Memory relative cursor addressing + * cursor_normal: Make cursor appear normal (under vs/vi) + * cursor_right: Non-destructive space (cursor or carriage right) + * cursor_to_ll: Last line, first column (if no cup) + * cursor_up: Upline (cursor up) + * cursor_visible: Make cursor very visible + * define_bit_image_region: Define rectangular bit-image region + * define_char: Define a character in a character set + * delete_character: Delete character + * delete_line: Delete line + * device_type: Indicate language/codeset support + * dial_phone: Dial phone number #1 + * dis_status_line: Disable status line + * display_clock: Display time-of-day clock + * display_pc_char: Display PC character + * down_half_time: Half-line down (forward 1/2 linefeed) + * ena_acs: Enable alternate character set + * end_bit_image_region: End a bit-image region + * enter_alt_charset_mode: Start alternate character set + * enter_am_mode: Turn on automatic margins + * enter_blink_mode: Turn on blinking + * enter_bold_mode: Turn on bold (extra bright) mode + * enter_ca_mode: String to begin programs that use cup + * enter_delete_mode: Delete mode (enter) + * enter_dim_mode: Turn on half-bright mode + * enter_doublewide_mode: Enable double wide printing + * enter_draft_quality: Set draft qualify print + * enter_horizontal_hl_mode: Turn on horizontal highlight mode + * enter_insert_mode: Insert mode (enter) + * enter_italics_mode: Enable italics + * enter_left_hl_mode: Turn on left highlight mode + * enter_leftward_mode: Enable leftward carriage motion + * enter_low_hl_mode: Turn on low highlight mode + * enter_micro_mode: Enable micro motion capabilities + * enter_near_quality_letter: Set near-letter quality print + * enter_normal_quality: Set normal quality print + * enter_pc_charset_mode: Enter PC character display mode + * enter_protected_mode: Turn on protected mode + * enter_reverse_mode: Turn on reverse video mode + * enter_right_hl_mode: Turn on right highlight mode + * enter_scancode_mode: Enter PC scancode mode + * enter_secure_mode: Turn on blank mode (characters invisible) + * enter_shadow_mode: Enable shadow printing + * enter_standout_mode: Begin standout mode + * enter_subscript_mode: Enable subscript printing + * enter_superscript_mode: Enable superscript printing + * enter_top_hl_mode: Turn on top highlight mode + * enter_underline_mode: Start underscore mode + * enter_upward_mode: Enable upward carriage motion + * enter_vertical_hl_mode: Turn on verticle highlight mode + * enter_xon_mode: Turn on xon/xoff handshaking + * erase_chars: Erase #1 characters + * exit_alt_charset_mode: End alternate character set + * exit_am_mode: Turn off automatic margins + * exit_attribute_mode: Turn off all attributes + * exit_ca_mode: String to end programs that use cup + * exit_delete_mode: End delete mode + * exit_doublewide_mode: Disable double wide printing + * exit_insert_mode: End insert mode + * exit_italics_mode: Disable italics + * exit_leftward_mode: Enable rightward (normal) carriage motion + * exit_micro_mode: Disable micro motion capabilities + * exit_pc_charset_mode: Disable PC character display mode + * exit_scancode_mode: Disable PC scancode mode + * exit_shadow_mode: Disable shadow printing + * exit_standout_mode: End standout mode + * exit_subscript_mode: Disable subscript printing + * exit_superscript_mode: Disable superscript printing + * exit_underline_mode: End underscore mode + * exit_upward_mode: Enable downward (normal) carriage motion + * exit_xon_mode: Turn off xon/xoff handshaking + * fixed_pause: Pause for 2-3 seconds + * flash_hook: Flash the switch hook + * flash_screen: Visible bell (may move cursor) + * form_feed: Hardcopy terminal eject page + * from_status_line: Return from status line + * get_mouse: Curses should get button events + * goto_window: Go to window #1 + * hangup: Hang-up phone + * init_1string: Terminal or printer initialisation string + * init_2string: Terminal or printer initialisation string + * init_3string: Terminal or printer initialisation string + * init_file: Name of initialisation file + * init_prog: Path name of program for initialisation + * initialize_color: Set colour #1 to RGB #2, #3, #4 + * initialize_pair: Set colour-pair #1 to fg #2, bg #3 + * insert_character: Insert character + * insert_line: Add new blank line + * insert_padding: Insert pad after character inserted + * key_a1: upper left of keypad + * key_a3: upper right of keypad + * key_b2: center of keypad + * key_backspace: set by backspace key + * key_beg: 1 + * key_btab: sent by back-tab key + * key_c1: lower left of keypad + * key_c3: lower right of keypad + * key_cancel: 2 + * key_catab: sent by clear-all-tabs key + * key_clear: sent by clear-screen or erase key + * key_close: 3 + * key_command: 4 + * key_copy: 5 + * key_create: 6 + * key_ctab: sent by clear-tab key + * key_dc: sent by delete-character key + * key_dl: sent by delete-line key + * key_down: sent by terminal down-arrow key + * key_eic: sent by rmir or smir in insert mode + * key_end: 7 + * key_enter: 8 + * key_eol: sent by clear-to-end-of-line key + * key_eos: sent by clear-to-end-of-screen key + * key_exit: 9 + * key_f0: sent by function key f0 + * key_f1: sent by function key f1 + * key_f2: sent by function key f2 + * key_f3: sent by function key f3 + * key_f4: sent by function key f4 + * key_f5: sent by function key f5 + * key_f6: sent by function key f6 + * key_f7: sent by function key f7 + * key_f8: sent by function key f8 + * key_f9: sent by function key f9 + * key_f10: sent by function key f10 + * key_f11: sent by function key f11 + * key_f12: sent by function key f12 + * key_f13: sent by function key f13 + * key_f14: sent by function key f14 + * key_f15: sent by function key f15 + * key_f16: sent by function key f16 + * key_f17: sent by function key f17 + * key_f18: sent by function key f18 + * key_f19: sent by function key f19 + * key_f20: sent by function key f20 + * key_f21: sent by function key f21 + * key_f22: sent by function key f22 + * key_f23: sent by function key f23 + * key_f24: sent by function key f24 + * key_f25: sent by function key f25 + * key_f26: sent by function key f26 + * key_f27: sent by function key f27 + * key_f28: sent by function key f28 + * key_f29: sent by function key f29 + * key_f30: sent by function key f30 + * key_f31: sent by function key f31 + * key_f32: sent by function key f32 + * key_f33: sent by function key f33 + * key_f34: sent by function key f34 + * key_f35: sent by function key f35 + * key_f36: sent by function key f36 + * key_f37: sent by function key f37 + * key_f38: sent by function key f38 + * key_f39: sent by function key f39 + * key_f40: sent by function key f40 + * key_f41: sent by function key f41 + * key_f42: sent by function key f42 + * key_f43: sent by function key f43 + * key_f44: sent by function key f44 + * key_f45: sent by function key f45 + * key_f46: sent by function key f46 + * key_f47: sent by function key f47 + * key_f48: sent by function key f48 + * key_f49: sent by function key f49 + * key_f50: sent by function key f50 + * key_f51: sent by function key f51 + * key_f52: sent by function key f52 + * key_f53: sent by function key f53 + * key_f54: sent by function key f54 + * key_f55: sent by function key f55 + * key_f56: sent by function key f56 + * key_f57: sent by function key f57 + * key_f58: sent by function key f58 + * key_f59: sent by function key f59 + * key_f60: sent by function key f60 + * key_f61: sent by function key f61 + * key_f62: sent by function key f62 + * key_f63: sent by function key f63 + * key_find: 0 + * key_help: sent by help key + * key_home: sent by home key + * key_ic: sent by ins-char/enter ins-mode key + * key_il: sent by insert-line key + * key_left: sent by terminal left-arrow key + * key_ll: sent by home-down key + * key_mark: sent by mark key + * key_message: sent by message key + * key_mouse: 0631, Mouse event has occured + * key_move: sent by move key + * key_next: sent by next-object key + * key_npage: sent by next-page key + * key_open: sent by open key + * key_options: sent by options key + * key_ppage: sent by previous-page key + * key_previous: sent by previous-object key + * key_print: sent by print or copy key + * key_redo: sent by redo key + * key_reference: sent by ref(erence) key + * key_refresh: sent by refresh key + * key_replace: sent by replace key + * key_restart: sent by restart key + * key_resume: sent by resume key + * key_right: sent by terminal right-arrow key + * key_save: sent by save key + * key_sbeg: sent by shifted beginning key + * key_scancel: sent by shifted cancel key + * key_scommand: sent by shifted command key + * key_scopy: sent by shifted copy key + * key_screate: sent by shifted create key + * key_sdc: sent by shifted delete-char key + * key_sdl: sent by shifted delete-line key + * key_select: sent by select key + * key_send: sent by shifted end key + * key_seol: sent by shifted clear-line key + * key_sexit: sent by shited exit key + * key_sf: sent by scroll-forward/down key + * key_sfind: sent by shifted find key + * key_shelp: sent by shifted help key + * key_shome: sent by shifted home key + * key_sic: sent by shifted input key + * key_sleft: sent by shifted left-arrow key + * key_smessage: sent by shifted message key + * key_smove: sent by shifted move key + * key_snext: sent by shifted next key + * key_soptions: sent by shifted options key + * key_sprevious: sent by shifted prev key + * key_sprint: sent by shifted print key + * key_sr: sent by scroll-backwards/up key + * key_sredo: sent by shifted redo key + * key_sreplace: sent by shifted replace key + * key_sright: sent by shifted right-arrow key + * key_srsume: sent by shifted resume key + * key_ssave: sent by shifted save key + * key_ssuspend: sent by shifted suspend key + * key_stab: sent by set-tab key + * key_sundo: sent by shifted undo key + * key_suspend: sent by suspend key + * key_undo: sent by undo key + * key_up: sent by terminal up-arrow key + * keypad_local: Out of "keypad-transmit" mode + * keypad_xmit: Put terminal in "keypad-transmit" mode + * lab_f0: Labels on function key f0 if not f0 + * lab_f1: Labels on function key f1 if not f1 + * lab_f2: Labels on function key f2 if not f2 + * lab_f3: Labels on function key f3 if not f3 + * lab_f4: Labels on function key f4 if not f4 + * lab_f5: Labels on function key f5 if not f5 + * lab_f6: Labels on function key f6 if not f6 + * lab_f7: Labels on function key f7 if not f7 + * lab_f8: Labels on function key f8 if not f8 + * lab_f9: Labels on function key f9 if not f9 + * lab_f10: Labels on function key f10 if not f10 + * label_format: Label format + * label_off: Turn off soft labels + * label_on: Turn on soft labels + * meta_off: Turn off "meta mode" + * meta_on: Turn on "meta mode" (8th bit) + * micro_column_address: Like column_address for micro adjustment + * micro_down: Like cursor_down for micro adjustment + * micro_left: Like cursor_left for micro adjustment + * micro_right: Like cursor_right for micro adjustment + * micro_row_address: Like row_address for micro adjustment + * micro_up: Like cursor_up for micro adjustment + * mouse_info: Mouse status information + * newline: Newline (behaves like cr followed by lf) + * order_of_pins: Matches software bits to print-head pins + * orig_colors: Set all colour(-pair)s to original ones + * orig_pair: Set default colour-pair to the original one + * pad_char: Pad character (rather than NULL) + * parm_dch: Delete #1 chars + * parm_delete_line: Delete #1 lines + * parm_down_cursor: Move down #1 lines + * parm_down_micro: Like parm_down_cursor for micro adjustment + * parm_ich: Insert #1 blank chars + * parm_index: Scroll forward #1 lines + * parm_insert_line: Add #1 new blank lines + * parm_left_cursor: Move cursor left #1 lines + * parm_left_micro: Like parm_left_cursor for micro adjustment + * parm_right_cursor: Move right #1 spaces + * parm_right_micro: Like parm_right_cursor for micro adjustment + * parm_rindex: Scroll backward #1 lines + * parm_up_cursor: Move cursor up #1 lines + * parm_up_micro: Like parm_up_cursor for micro adjustment + * pc_term_options: PC terminal options + * pkey_key: Prog funct key #1 to type string #2 + * pkey_local: Prog funct key #1 to execute string #2 + * pkey_plab: Prog key #1 to xmit string #2 and show string #3 + * pkey_xmit: Prog funct key #1 to xmit string #2 + * plab_norm: Prog label #1 to show string #2 + * print_screen: Print contents of screen + * ptr_non: Turn off printer for #1 bytes + * ptr_off: Turn off the printer + * ptr_on: Turn on the printer + * pulse: Select pulse dialing + * quick_dial: Dial phone number #1, without progress detection + * remove_clock: Remove time-of-day clock + * repeat_char: Repeat char #1 #2 times + * req_for_input: Send next input char (for ptys) + * req_mouse_pos: Request mouse position report + * reset_1string: Reset terminal completely to sane modes + * reset_2string: Reset terminal completely to sane modes + * reset_3string: Reset terminal completely to sane modes + * reset_file: Name of file containing reset string + * restore_cursor: Restore cursor to position of last sc + * row_address: Set vertical position to absolute #1 + * save_cursor: Save cursor position + * scancode_escape: Escape for scancode emulation + * scroll_forward: Scroll text up + * scroll_reverse: Scroll text down + * select_char_set: Select character set + * set0_des_seq: Shift into codeset 0 (EUC set 0, ASCII) + * set1_des_seq: Shift into codeset 1 + * set2_des_seq: Shift into codeset 2 + * set3_des_seq: Shift into codeset 3 + * set_a_attributes: Define second set of video attributes #1-#6 + * set_a_background: Set background colour to #1 using ANSI escape + * set_a_foreground: Set foreground colour to #1 using ANSI escape + * set_attributes: Define first set of video attributes #1-#9 + * set_background: Set background colour to #1 + * set_bottom_margin: Set bottom margin at current line + * set_bottom_margin_parm: Set bottom margin at line #1 or #2 lines from bottom + * set_clock: Set clock to hours (#1), minutes (#2), seconds (#3) + * set_color_band: Change ribbon to colour #1 + * set_color_pair: Set current colour pair to #1 + * set_foreground: Set foreground colour to #1 + * set_left_margin: Set left margin at current column + * set_left_margin_parm: Set left (right) margin at column #1 (#2) + * set_lr_margin: Sets both left and right margins + * set_page_length: Set page length to #1 lines + * set_pglen_inch: Set page length to #1 hundredth of an inch + * set_right_margin: Set right margin at current column + * set_right_margin_parm: Set right margin at #1 + * set_tab: Set a tab in all rows, current column + * set_tb_margin: Sets both top and bottom margins + * set_top_margin: Set top margin at current line + * set_top_margin_parm: Set top (bottom) margin at line #1 (#2) + * set_window: Current window is lines #1-#2 cols #3-#4 + * start_bit_image: Start printing bit image graphics + * start_char_set_def: Start definition of a character set + * stop_bit_image: End printing bit image graphics + * stop_char_set_def: End definition of a character set + * subscript_characters: List of "subscript-able" characters + * superscript_characters: List of "superscript-able" characters + * tab: Tab to next 8-space hardware tab stop + * these_cause_cr: Printing any of these characters causes cr + * to_status_line: Go to status line, col #1 + * tone: Select tone touch dialing + * user0: User string 0 + * user1: User string 1 + * user2: User string 2 + * user3: User string 3 + * user4: User string 4 + * user5: User string 5 + * user6: User string 6 + * user7: User string 7 + * user8: User string 8 + * user9: User string 9 + * underline_char: Underscore one char and move past it + * up_half_line: Half-line up (reverse 1/2 linefeed) + * wait_tone: Wait for dial tone + * xoff_character: X-off character + * xon_character: X-on character + * zero_motion: No motion for the subsequent character + */ + +#ifndef _TERMINFO +typedef struct { + int fildes; + /* We need to expose these so that the macros work */ + const char *name; + const char *desc; + signed char *flags; + int *nums; + const char **strs; +} TERMINAL; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern TERMINAL *cur_term; + +/* setup functions */ +int setupterm(const char *, int, int *); +TERMINAL * set_curterm(TERMINAL *); +int del_curterm(TERMINAL *); +char * termname(void); +char * longname(void); + +/* information functions */ +int tigetflag(const char *); +int tigetnum(const char *); +char * tigetstr(const char *); +/* You should note that the spec allows stuffing a char * into a long + * if the platform allows and the %pN is followed immediately by %l or %s */ +char * tparm(const char *, long, long, long, long, long, + long, long, long, long); + +/* Non standard functions, but provide a level of thread safety */ +int ti_setupterm(TERMINAL **, const char *, int, int *); +int ti_getflag(const TERMINAL *, const char *); +int ti_getnum(const TERMINAL *, const char *); +const char * ti_getstr(const TERMINAL *, const char *); +char * ti_parm(TERMINAL *, const char *, + long, long, long, long, long, long, long, long, long); + +/* These functions do not use PC or speed, but the terminal */ +int ti_puts(const TERMINAL *, const char *, int, + int (*)(int, void *), void *); +int ti_putp(const TERMINAL *, const char *); + +/* Using tparm can be kunkly, so provide a variadic function + * Numbers have to be passed as int */ +/* This is not standard, but ncurses also provides this */ +char * tiparm(const char *, ...); +/* And a thread safe version */ +char * ti_tiparm(TERMINAL *, const char *, ...); + +#ifdef TPARM_TLPARM +/* Same as the above, but numbers have to be passed as long */ +char * tlparm(const char *, ...); +/* And a thread safe version */ +char * ti_tlparm(TERMINAL *, const char *, ...); +#endif + +/* Default to X/Open tparm, but allow it to be variadic also */ +#ifdef TPARM_VARARGS +# define tparm tiparm +# define ti_parm ti_tiparm +#endif + +/* Convert a termcap string into a terminfo string. + * The passed string is destroyed and the return string needs to be freed. */ +char * captoinfo(char *); + +/* POSIX says that term.h should also pull in our termcap definitions. */ +#include + +#ifdef __cplusplus +} +#endif +#endif diff --git a/vendor/netbsd-curses/libterminfo/term_private.h b/vendor/netbsd-curses/libterminfo/term_private.h new file mode 100644 index 0000000..14f23b7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/term_private.h @@ -0,0 +1,301 @@ +/* $NetBSD: term_private.h,v 1.19 2020/06/21 15:05:23 roy Exp $ */ + +/* + * Copyright (c) 2009, 2010, 2013, 2020 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _TERM_PRIVATE_H_ +#define _TERM_PRIVATE_H_ + +/* This header should only be used by libterminfo, tic and infocmp. */ + +/* The terminfo database structure is private to us, + * so it's documented here. + * + * Version 1 - types 1 and 2. + * terminfo defines the largest number as 32767 and the largest + * compiled entry as 4093 bytes long. Negative numbers are not allowed. + * Thus, we store all numbers as uint16_t, including string length. + * We reserve negative numbers -1 and -2 to mean absent or cancelled. + * All strings are prefixed by length, including the null terminator. + * The largest string length we can handle is 65535 bytes, + * including the null terminator. + * The largest capability block we can handle is 65535 bytes. + * + * Version 2 - type 3 + * Extends terminfo numbers upto 2147483647 by storing the value as a uint32_t. + * This means that we exceed the current terminfo defined limits in every way. + * + * Type 1 capabilities are defined as: + * header byte (always 1) + * name + * description, + * cap length, num flags, index, char, + * cap length, num numbers, index, number, + * cap length, num strings, index, string, + * cap length, num undefined caps, name, type (char), flag, number, string + * + * Type 2 entries are aliases and defined as: + * header byte (always 2) + * 32bit id of the corresponding terminal in the file + * name + * + * Type 3 extends Type 1 so that it can store terminfo numbers + * as uint32_t. All other numerics are still stored as uint16_t. + * + * The database itself is created using cdbw(3) and the numbers are + * always stored as little endian. + */ + +#include +#include +#include +#ifndef _DIAGASSERT +#define _DIAGASSERT(X) +#endif +/* some comment, so patches touching includes apply + */ + +#include +#include +#include + +#define _TERMINFO +#define TERMINFO_RTYPE_O1 1 +#define TERMINFO_ALIAS 2 +#define TERMINFO_RTYPE 3 + +/* , and | are the two print characters now allowed + * in terminfo aliases or long descriptions. + * As | is generally used to delimit aliases inside the + * description, we use a comma. */ +#define TERMINFO_VDELIM ',' +#define TERMINFO_VDELIMSTR "," + +/* We use the same ncurses tic macros so that our data is identical + * when a caller uses the long name macros to access te terminfo data + * directly. */ +#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ +#define ABSENT_NUMERIC (-1) +#define ABSENT_STRING (char *)0 +#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ +#define CANCELLED_NUMERIC (-2) +#define CANCELLED_STRING (char *)(-1) +#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */ +#define VALID_NUMERIC(s) ((s) >= 0) +#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) + +typedef struct { + const char *id; + char type; + char flag; + int num; + const char *str; +} TERMUSERDEF; + +typedef struct { + int fildes; + /* We need to expose these so that the macros work */ + const char *name; + const char *desc; + signed char *flags; + int *nums; + const char **strs; + /* Storage area for terminfo data */ + char *_area; + size_t _arealen; + size_t _nuserdefs; + TERMUSERDEF *_userdefs; + /* So we don't rely on the global ospeed */ + short _ospeed; + /* Output buffer for tparm */ + char *_buf; + size_t _buflen; + size_t _bufpos; + /* A-Z static variables for tparm */ + long _snums[26]; + /* aliases of the terminal, | separated */ + const char *_alias; +} TERMINAL; + +extern const char * _ti_database; + +ssize_t _ti_flagindex(const char *); +ssize_t _ti_numindex(const char *); +ssize_t _ti_strindex(const char *); +const char * _ti_flagid(ssize_t); +const char * _ti_numid(ssize_t); +const char * _ti_strid(ssize_t); +int _ti_getterm(TERMINAL *, const char *, int); +void _ti_setospeed(TERMINAL *); + +/* libterminfo can compile terminfo strings too */ +#define TIC_WARNING (1 << 0) +#define TIC_DESCRIPTION (1 << 1) +#define TIC_ALIAS (1 << 2) +#define TIC_COMMENT (1 << 3) +#define TIC_EXTRA (1 << 4) +#define TIC_COMPAT_V1 (1 << 5) + +typedef struct { + char *buf; + size_t buflen; + size_t bufpos; + size_t entries; +} TBUF; + +typedef struct { + char *name; + char *alias; + char *desc; + int rtype; + TBUF flags; + TBUF nums; + TBUF strs; + TBUF extras; +} TIC; + +#define _ti_numsize(tic) \ + ((tic)->rtype == TERMINFO_RTYPE_O1 ? sizeof(uint16_t) : sizeof(uint32_t)) + +int _ti_promote(TIC *); +char *_ti_grow_tbuf(TBUF *, size_t); +char *_ti_get_token(char **, char); +const char *_ti_find_cap(TIC *, TBUF *, char, short); +const char *_ti_find_extra(TIC *, TBUF *, const char *); +char *_ti_getname(int, const char *); +size_t _ti_store_extra(TIC *, int, const char *, char, char, int, + const char *, size_t, int); +TIC *_ti_compile(char *, int); +ssize_t _ti_flatten(uint8_t **, const TIC *); +void _ti_freetic(TIC *); + +int _ti_encode_buf_id_num(TBUF *, int, int, size_t); +int _ti_encode_buf_id_count_str(TBUF *, int, const void *, size_t); +int _ti_encode_buf_id_flags(TBUF *, int, int); + +#define TPARM_MAX 9 /* not likely to change */ +int _ti_parm_analyse(const char *, int *, int); + +static __inline int +_ti_decode_16(const char **cap) +{ + int num = (int16_t)le16dec(*cap); + + *cap += sizeof(uint16_t); + return num; +} + +static __inline int +_ti_decode_32(const char **cap) +{ + int num = (int32_t)le32dec(*cap); + + *cap += sizeof(uint32_t); + return num; +} + +static __inline int +_ti_decode_num(const char **cap, int rtype) +{ + if (rtype == TERMINFO_RTYPE_O1) { + return _ti_decode_16(cap); + } else { + return _ti_decode_32(cap); + } +} + +static __inline void +_ti_encode_16(char **cap, size_t num) +{ + _DIAGASSERT(num <= UINT16_MAX); + le16enc(*cap, (uint16_t)num); + *cap += sizeof(uint16_t); +} + +static __inline void +_ti_encode_32(char **cap, size_t num) +{ + _DIAGASSERT(num <= UINT32_MAX); + le32enc(*cap, (uint32_t)num); + *cap += sizeof(uint32_t); +} + +static __inline void +_ti_encode_str(char **cap, const void *buf, size_t len) +{ + memcpy(*cap, buf, len); + *cap += len; +} + +static __inline void +_ti_encode_count_str(char **cap, const char *name, size_t len) +{ + _ti_encode_16(cap, (uint16_t)len); + if (name == NULL) + return; + _ti_encode_str(cap, name, len); +} + +static __inline void +_ti_encode_buf_16(TBUF *tbuf, size_t num) +{ + _DIAGASSERT(num <= UINT16_MAX); + le16enc(tbuf->buf + tbuf->bufpos, (uint16_t)num); + tbuf->bufpos += sizeof(uint16_t); +} + +static __inline void +_ti_encode_buf_32(TBUF *tbuf, size_t num) +{ + _DIAGASSERT(num <= UINT32_MAX); + le32enc(tbuf->buf + tbuf->bufpos, (uint32_t)num); + tbuf->bufpos += sizeof(uint32_t); +} + +static __inline void +_ti_encode_buf_count_str(TBUF *tbuf, const void *buf, size_t len) +{ + _ti_encode_buf_16(tbuf, len); + memcpy(tbuf->buf + tbuf->bufpos, buf, len); + tbuf->bufpos += len; +} + +static __inline void +_ti_encode_buf_num(TBUF *tbuf, int num, int rtype) +{ + if (rtype == TERMINFO_RTYPE_O1) { + if (num > INT16_MAX) + num = INT16_MAX; + _ti_encode_buf_16(tbuf, (uint16_t)num); + } else { + if (num > INT32_MAX) + num = INT32_MAX; + _ti_encode_buf_32(tbuf, (uint32_t)num); + } +} + +#endif diff --git a/vendor/netbsd-curses/libterminfo/termcap.3 b/vendor/netbsd-curses/libterminfo/termcap.3 new file mode 100644 index 0000000..8803c12 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/termcap.3 @@ -0,0 +1,155 @@ +.\" $NetBSD: termcap.3,v 1.9 2017/10/22 16:44:51 abhinav Exp $ +.\" +.\" Copyright (c) 2009 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Roy Marples. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd March 14, 2011 +.Dt TERMCAP 3 +.Os +.Sh NAME +.Nm tgetent , +.Nm tgetnum , +.Nm tgetflag , +.Nm tgetstr , +.Nm tgoto +.Nd terminal independent operation routines +.Sh LIBRARY +.Lb libtermcap +.Sh SYNOPSIS +.In termcap.h +.Vt char PC ; +.Vt char *BC ; +.Vt char *UP ; +.Ft int +.Fn tgetent "char *bp" "const char *name" +.Ft int +.Fn tgetnum "const char *id" +.Ft int +.Fn tgetflag "const char *id" +.Ft char * +.Fn tgetstr "const char *id" "char **area" +.Ft char * +.Fn tgoto "const char *cm" "int destcol" "int destline" +.Sh DESCRIPTION +These functions extract and use capabilities from a terminal capability +database. +They exist as wrappers around equivalent +.Xr terminfo 3 +functions, which new code should use. +These are low level routines; see +.Xr curses 3 +for a higher level package. +.Pp +The +.Fn tgetent +function calls +.Fn setupterm +and configures +.Va PC , +.Va UP +and +.Va BC . +Only +.Va PC +is actually used internally. +The +.Fn tgetent +function returns \-1 if none of the +.Nm terminfo +data base files could be opened, +0 if the terminal name given does not match an entry, +and 1 if all goes well. +The +.Fa bp +argument is not used. +.Pp +The +.Fn tgetnum +function gets the numeric value of the capability +.Fa id , +returning \-1 if it is not given for the terminal. +The +.Fn tgetflag +function returns 1 if the specified capability is present in the terminal's +entry, 0 if it is not. +The +.Fn tgetstr +function returns the string value of the capability +.Fa id . +This is a +.Xr terminfo 5 +string and not a +.Nm termcap +string; +as such it should only be processed by +.Fn tgoto . +The +.Fn tgetstr +function returns +.Dv NULL +if the capability was not found. +The +.Fa area +argument is unused. +.Pp +The +.Fn tgoto +function returns a cursor addressing string decoded from +.Fa cm +to go to column +.Fa destcol +in line +.Fa destline , +or +.Dv NULL +on error conditions such as out of memory. +Please note that +.Fn tgoto +can return an incomplete value on a malformed input sequence. +Historically +.Fn tgoto +used to return +.Dq OOPS +on those conditions, so newer programs should now be checking the return +value. +.Sh SEE ALSO +.Xr terminfo 3 , +.Xr terminfo 5 +.Sh HISTORY +.Nm termcap +first appeared in 4.0BSD. +.Nx 1.5 +introduced some +.Nm termcap +.Fn t_* +extensions which were removed in +.Nx 6.0 +when +.Xr terminfo 3 +was introduced. +.Sh AUTHORS +.An Roy Marples Aq Mt roy@NetBSD.org diff --git a/vendor/netbsd-curses/libterminfo/termcap.c b/vendor/netbsd-curses/libterminfo/termcap.c new file mode 100644 index 0000000..2c353ff --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/termcap.c @@ -0,0 +1,604 @@ +/* $NetBSD: termcap.c,v 1.24 2020/04/05 14:53:39 martin Exp $ */ + +/* + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "termcap_map.c" +#include "termcap_hash.c" + +char *UP; +char *BC; + +/* ARGSUSED */ +int +tgetent(char *bp, const char *name) +{ + (void)bp; + int errret; + static TERMINAL *last = NULL; + + _DIAGASSERT(name != NULL); + + /* Free the old term */ + if (cur_term != NULL) { + if (last != NULL && cur_term != last) + del_curterm(last); + last = cur_term; + } + errret = -1; + if (setupterm(name, STDOUT_FILENO, &errret) != 0) + return errret; + + if (last == NULL) + last = cur_term; + + if (pad_char != NULL) + PC = pad_char[0]; + UP = __UNCONST(cursor_up); + BC = __UNCONST(cursor_left); + return 1; +} + +int +tgetflag(const char *id2) +{ + uint32_t ind; + size_t i; + TERMUSERDEF *ud; + const char id[] = { id2[0], id2[0] ? id2[1] : '\0', '\0' }; + + if (cur_term == NULL) + return 0; + + ind = _t_flaghash((const unsigned char *)id, strlen(id)); + if (ind < __arraycount(_ti_cap_flagids)) { + if (strcmp(id, _ti_cap_flagids[ind].id) == 0) + return cur_term->flags[_ti_cap_flagids[ind].ti]; + } + for (i = 0; i < cur_term->_nuserdefs; i++) { + ud = &cur_term->_userdefs[i]; + if (ud->type == 'f' && strcmp(ud->id, id) == 0) + return ud->flag; + } + return 0; +} + +int +tgetnum(const char *id2) +{ + uint32_t ind; + size_t i; + TERMUSERDEF *ud; + const TENTRY *te; + const char id[] = { id2[0], id2[0] ? id2[1] : '\0', '\0' }; + + if (cur_term == NULL) + return -1; + + ind = _t_numhash((const unsigned char *)id, strlen(id)); + if (ind < __arraycount(_ti_cap_numids)) { + te = &_ti_cap_numids[ind]; + if (strcmp(id, te->id) == 0) { + if (!VALID_NUMERIC(cur_term->nums[te->ti])) + return ABSENT_NUMERIC; + return cur_term->nums[te->ti]; + } + } + for (i = 0; i < cur_term->_nuserdefs; i++) { + ud = &cur_term->_userdefs[i]; + if (ud->type == 'n' && strcmp(ud->id, id) == 0) { + if (!VALID_NUMERIC(ud->num)) + return ABSENT_NUMERIC; + return ud->num; + } + } + return -1; +} + +char * +tgetstr(const char *id2, char **area) +{ + uint32_t ind; + size_t i; + TERMUSERDEF *ud; + const char *str; + const char id[] = { id2[0], id2[0] ? id2[1] : '\0', '\0' }; + + if (cur_term == NULL) + return NULL; + + str = NULL; + ind = _t_strhash((const unsigned char *)id, strlen(id)); + if (ind < __arraycount(_ti_cap_strids)) { + if (strcmp(id, _ti_cap_strids[ind].id) == 0) { + str = cur_term->strs[_ti_cap_strids[ind].ti]; + if (str == NULL) + return NULL; + } + } + if (str != NULL) + for (i = 0; i < cur_term->_nuserdefs; i++) { + ud = &cur_term->_userdefs[i]; + if (ud->type == 's' && strcmp(ud->id, id) == 0) + str = ud->str; + } + + /* XXX: FXIXME + * We should fix sgr0(me) as it has a slightly different meaning + * for termcap. */ + + if (str != NULL && area != NULL && *area != NULL) { + char *s; + s = *area; + strcpy(*area, str); + *area += strlen(*area) + 1; + return s; + } + + return __UNCONST(str); +} + +char * +tgoto(const char *cm, int destcol, int destline) +{ + _DIAGASSERT(cm != NULL); + return tiparm(cm, destline, destcol); +} + +#ifdef TERMINFO_COMPILE +static const char * +flagname(const char *key) +{ + uint32_t idx; + + idx = _t_flaghash((const unsigned char *)key, strlen(key)); + if (idx < __arraycount(_ti_cap_flagids) && + strcmp(key, _ti_cap_flagids[idx].id) == 0) + return _ti_flagid(_ti_cap_flagids[idx].ti); + return key; +} + +static const char * +numname(const char *key) +{ + uint32_t idx; + + idx = _t_numhash((const unsigned char *)key, strlen(key)); + if (idx < __arraycount(_ti_cap_numids) && + strcmp(key, _ti_cap_numids[idx].id) == 0) + return _ti_numid(_ti_cap_numids[idx].ti); + return key; +} + +static const char * +strname(const char *key) +{ + uint32_t idx; + + idx = _t_strhash((const unsigned char *)key, strlen(key)); + if (idx < __arraycount(_ti_cap_strids) && + strcmp(key, _ti_cap_strids[idx].id) == 0) + return _ti_strid(_ti_cap_strids[idx].ti); + + if (strcmp(key, "tc") == 0) + return "use"; + + return key; +} + +/* Print a parameter if needed */ +static size_t +printparam(char **dst, char p, bool *nop) +{ + if (*nop) { + *nop = false; + return 0; + } + + *(*dst)++ = '%'; + *(*dst)++ = 'p'; + *(*dst)++ = '0' + p; + return 3; +} + +/* Convert a termcap character into terminfo equivalents */ +static size_t +printchar(char **dst, const char **src) +{ + char v; + size_t l; + + l = 4; + v = *++(*src); + if (v == '\\') { + v = *++(*src); + switch (v) { + case '0': + case '1': + case '2': + case '3': + v = 0; + while (isdigit((unsigned char) **src)) + v = 8 * v + (*(*src)++ - '0'); + (*src)--; + break; + case '\0': + v = '\\'; + break; + } + } else if (v == '^') + v = *++(*src) & 0x1f; + *(*dst)++ = '%'; + if (isgraph((unsigned char )v) && + v != ',' && v != '\'' && v != '\\' && v != ':') + { + *(*dst)++ = '\''; + *(*dst)++ = v; + *(*dst)++ = '\''; + } else { + *(*dst)++ = '{'; + if (v > 99) { + *(*dst)++ = '0'+ v / 100; + l++; + } + if (v > 9) { + *(*dst)++ = '0' + ((int) (v / 10)) % 10; + l++; + } + *(*dst)++ = '0' + v % 10; + *(*dst)++ = '}'; + } + return l; +} + +/* Convert termcap commands into terminfo commands */ +static const char fmtB[] = "%p0%{10}%/%{16}%*%p0%{10}%m%+"; +static const char fmtD[] = "%p0%p0%{2}%*%-"; +static const char fmtIf[] = "%p0%p0%?"; +static const char fmtThen[] = "%>%t"; +static const char fmtElse[] = "%+%;"; + +static char * +strval(const char *val) +{ + char *info, *ip, c, p; + const char *ps, *pe; + bool nop; + size_t len, l; + + len = 1024; /* no single string should be bigger */ + info = ip = malloc(len); + if (info == NULL) + return 0; + + /* Move the = */ + *ip++ = *val++; + + /* Set ps and pe to point to the start and end of the padding */ + if (isdigit((unsigned char)*val)) { + for (ps = pe = val; + isdigit((unsigned char)*val) || *val == '.'; + val++) + pe++; + if (*val == '*') { + val++; + pe++; + } + } else + ps = pe = NULL; + + nop = false; + l = 0; + p = 1; + for (; *val != '\0'; val++) { + if (l + 2 > len) + goto elen; + if (*val != '%') { + if (*val == ',') { + if (l + 3 > len) + goto elen; + *ip++ = '\\'; + l++; + } + *ip++ = *val; + l++; + continue; + } + switch (c = *++(val)) { + case 'B': + if (l + sizeof(fmtB) > len) + goto elen; + memcpy(ip, fmtB, sizeof(fmtB) - 1); + /* Replace the embedded parameters with real ones */ + ip[2] += p; + ip[19] += p; + ip += sizeof(fmtB) - 1; + l += sizeof(fmtB) - 1; + nop = true; + continue; + case 'D': + if (l + sizeof(fmtD) > len) + goto elen; + memcpy(ip, fmtD, sizeof(fmtD) - 1); + /* Replace the embedded parameters with real ones */ + ip[2] += p; + ip[5] += p; + ip += sizeof(fmtD) - 1; + l += sizeof(fmtD) - 1; + nop = true; + continue; + case 'r': + /* non op as switched below */ + break; + case '2': /* FALLTHROUGH */ + case '3': /* FALLTHROUGH */ + case 'd': + if (l + 7 > len) + goto elen; + l += printparam(&ip, p, &nop); + *ip++ = '%'; + if (c != 'd') { + *ip++ = c; + l++; + } + *ip++ = 'd'; + l += 2; + break; + case '+': + if (l + 13 > len) + goto elen; + l += printparam(&ip, p, &nop); + l += printchar(&ip, &val); + *ip++ = '%'; + *ip++ = c; + *ip++ = '%'; + *ip++ = 'c'; + l += 7; + break; + case '>': + if (l + sizeof(fmtIf) + sizeof(fmtThen) + + sizeof(fmtElse) + (6 * 2) > len) + goto elen; + + memcpy(ip, fmtIf, sizeof(fmtIf) - 1); + /* Replace the embedded parameters with real ones */ + ip[2] += p; + ip[5] += p; + ip += sizeof(fmtIf) - 1; + l += sizeof(fmtIf) - 1; + l += printchar(&ip, &val); + memcpy(ip, fmtThen, sizeof(fmtThen) - 1); + ip += sizeof(fmtThen) - 1; + l += sizeof(fmtThen) - 1; + l += printchar(&ip, &val); + memcpy(ip, fmtElse, sizeof(fmtElse) - 1); + ip += sizeof(fmtElse) - 1; + l += sizeof(fmtElse) - 1; + l += 16; + nop = true; + continue; + case '.': + if (l + 6 > len) + goto elen; + l += printparam(&ip, p, &nop); + *ip++ = '%'; + *ip++ = 'c'; + l += 2; + break; + default: + /* Hope it matches a terminfo command. */ + *ip++ = '%'; + *ip++ = c; + l += 2; + if (c == 'i') + continue; + break; + } + /* Swap p1 and p2 */ + p = 3 - p; + } + + /* \E\ is valid termcap. + * We need to escape the final \ for terminfo. */ + if (l > 2 && info[l - 1] == '\\' && + (info[l - 2] != '\\' && info[l - 2] != '^')) + { + if (l + 1 > len) + goto elen; + *ip++ = '\\'; + } + + /* Add our padding at the end. */ + if (ps != NULL) { + size_t n = (size_t)(pe - ps); + if (l + n + 4 > len) + goto elen; + *ip++ = '$'; + *ip++ = '<'; + strncpy(ip, ps, n); + ip += n; + *ip++ = '/'; + *ip++ = '>'; + } + + *ip = '\0'; + return info; + +elen: + free(info); + errno = ENOMEM; + return NULL; +} + +typedef struct { + const char *name; + const char *cap; +} DEF_INFO; + +static DEF_INFO def_infos[] = { + { "bel", "^G" }, + { "cr", "^M" }, + { "cud1", "^J" }, + { "ht", "^I" }, + { "ind", "^J" }, + { "kbs", "^H" }, + { "kcub1", "^H" }, + { "kcud1", "^J" }, + { "nel", "^M^J" } +}; + +char * +captoinfo(char *cap) +{ + char *info, *ip, *token, *val, *p, tok[3]; + const char *name; + size_t len, lp, nl, vl, rl; + int defs[__arraycount(def_infos)], fv; + + _DIAGASSERT(cap != NULL); + + len = strlen(cap) * 2; + len += __arraycount(def_infos) * (5 + 4 + 3); /* reserve for defs */ + info = ip = malloc(len); + if (info == NULL) + return NULL; + + memset(defs, 0, sizeof(defs)); + lp = 0; + tok[2] = '\0'; + for (token = _ti_get_token(&cap, ':'); + token != NULL; + token = _ti_get_token(&cap, ':')) + { + if (token[0] == '\0') + continue; + name = token; + val = p = NULL; + fv = 0; + nl = 0; + if (token[1] != '\0') { + tok[0] = token[0]; + tok[1] = token[1]; + nl = 1; + if (token[2] == '\0') { + name = flagname(tok); + val = NULL; + } else if (token[2] == '#') { + name = numname(tok); + val = token + 2; + } else if (token[2] == '=') { + name = strname(tok); + val = strval(token + 2); + fv = 1; + } else + nl = 0; + } + /* If not matched we may need to convert padding still. */ + if (nl == 0) { + p = strchr(name, '='); + if (p != NULL) { + val = strval(p); + *p = '\0'; + fv = 1; + } + } + + /* See if this sets a default. */ + for (nl = 0; nl < __arraycount(def_infos); nl++) { + if (strcmp(name, def_infos[nl].name) == 0) { + defs[nl] = 1; + break; + } + } + + nl = strlen(name); + if (val == NULL) + vl = 0; + else + vl = strlen(val); + rl = nl + vl + 3; /* , \0 */ + + if (lp + rl > len) { + if (rl < 256) + len += 256; + else + len += rl; + p = realloc(info, len); + if (p == NULL) { + if (fv == 1) + free(val); + return NULL; + } + info = p; + } + + if (ip != info) { + *ip++ = ','; + *ip++ = ' '; + } + + strcpy(ip, name); + ip += nl; + if (val != NULL) { + strcpy(ip, val); + ip += vl; + if (fv == 1) + free(val); + } + } + + /* Add any defaults not set above. */ + for (nl = 0; nl < __arraycount(def_infos); nl++) { + if (defs[nl] == 0) { + *ip++ = ','; + *ip++ = ' '; + strcpy(ip, def_infos[nl].name); + ip += strlen(def_infos[nl].name); + *ip++ = '='; + strcpy(ip, def_infos[nl].cap); + ip += strlen(def_infos[nl].cap); + } + } + + *ip = '\0'; + return info; +} +#endif diff --git a/vendor/netbsd-curses/libterminfo/termcap.h b/vendor/netbsd-curses/libterminfo/termcap.h new file mode 100644 index 0000000..76c31aa --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/termcap.h @@ -0,0 +1,56 @@ +/* $NetBSD: termcap.h,v 1.2 2011/04/11 21:13:09 roy Exp $ */ + +/* + * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _TERMCAP_H_ +#define _TERMCAP_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Output functions. + * These are still valid for terminfo. */ +int putp(const char *); +int tputs(const char *, int, int (*)(int)); + +extern short ospeed; +extern char PC; +extern char *BC; +extern char *UP; + +int tgetent(char *, const char *); +char * tgetstr(const char *, char **); +int tgetflag(const char *); +int tgetnum(const char *); +char * tgoto(const char *, int, int); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/vendor/netbsd-curses/libterminfo/termcap_map.c b/vendor/netbsd-curses/libterminfo/termcap_map.c new file mode 100644 index 0000000..e8b5404 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/termcap_map.c @@ -0,0 +1,510 @@ +/* $NetBSD: termcap_map.c,v 1.3 2010/09/22 06:10:51 roy Exp $ */ + +/* + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +typedef struct { + const char id[3]; + int ti; +} TENTRY; + +static const TENTRY _ti_cap_flagids[] = { + { "bw", TICODE_bw }, + { "am", TICODE_am }, + { "ut", TICODE_bce }, + { "cc", TICODE_ccc }, + { "xs", TICODE_xhp }, + { "YA", TICODE_xhpa }, + { "YF", TICODE_cpix }, + { "YB", TICODE_crxm }, + { "xt", TICODE_xt }, + { "xn", TICODE_xenl }, + { "eo", TICODE_eo }, + { "gn", TICODE_gn }, + { "hc", TICODE_hc }, + { "HC", TICODE_chts }, + { "km", TICODE_km }, + { "YC", TICODE_daisy }, + { "hs", TICODE_hs }, + { "hl", TICODE_hls }, + { "in", TICODE_in }, + { "YG", TICODE_lpix }, + { "da", TICODE_da }, + { "db", TICODE_db }, + { "mi", TICODE_mir }, + { "ms", TICODE_msgr }, + { "nx", TICODE_nxon }, + { "xb", TICODE_xsb }, + { "NP", TICODE_npc }, + { "ND", TICODE_ndscr }, + { "NR", TICODE_nrrmc }, + { "os", TICODE_os } , + { "5i", TICODE_mc5i }, + { "YD", TICODE_xvpa }, + { "YE", TICODE_sam }, + { "es", TICODE_eslok }, + { "hz", TICODE_hz }, + { "ul", TICODE_ul }, + { "xo", TICODE_xon } +}; + +static const TENTRY _ti_cap_numids[] = { + { "Yo", TICODE_bitwin }, + { "Yp", TICODE_bitype }, + { "Ya", TICODE_bufsz }, + { "BT", TICODE_btns }, + { "co", TICODE_cols }, + { "Yc", TICODE_spinh }, + { "Yb", TICODE_spinv }, + { "it", TICODE_it }, + { "lh", TICODE_lh }, + { "lw", TICODE_lw }, + { "li", TICODE_lines }, + { "lm", TICODE_lm }, + { "ma", TICODE_ma }, + { "sg", TICODE_xmc }, + { "Co", TICODE_colors }, + { "Yd", TICODE_maddr }, + { "Ye", TICODE_mjump }, + { "pa", TICODE_pairs }, + { "MW", TICODE_wnum }, + { "Yf", TICODE_mcs }, + { "Yg", TICODE_mls }, + { "NC", TICODE_ncv }, + { "Nl", TICODE_nlab }, + { "Yh", TICODE_npins }, + { "Yi", TICODE_orc }, + { "Yj", TICODE_orl }, + { "Yk", TICODE_orhi }, + { "Yl", TICODE_orvi }, + { "pb", TICODE_pb }, + { "Ym", TICODE_cps }, + { "vt", TICODE_vt }, + { "Yn", TICODE_widcs }, + { "ws", TICODE_wsl } +}; + +static const TENTRY _ti_cap_strids[] = { + { "ac", TICODE_acsc }, + { "S8", TICODE_scesa }, + { "bt", TICODE_cbt }, + { "bl", TICODE_bel }, + { "Yv", TICODE_bicr }, + { "Zz", TICODE_binel }, + { "Xy", TICODE_birep }, + { "cr", TICODE_cr }, + { "ZA", TICODE_cpi }, + { "ZB", TICODE_lpi }, + { "ZC", TICODE_chr }, + { "ZD", TICODE_cvr }, + { "cs", TICODE_csr }, + { "rP", TICODE_rmp }, + { "Zy", TICODE_csnm }, + { "ct", TICODE_tbc }, + { "MC", TICODE_mgc }, + { "cl", TICODE_clear }, + { "cb", TICODE_el1 }, + { "ce", TICODE_el }, + { "cd", TICODE_ed }, + { "ci", TICODE_csin }, + { "Yw", TICODE_colornm }, + { "ch", TICODE_hpa }, + { "CC", TICODE_cmdch }, + { "cm", TICODE_cup }, + { "do", TICODE_cud1 }, + { "ho", TICODE_home }, + { "vi", TICODE_civis }, + { "le", TICODE_cub1 }, + { "CM", TICODE_mrcup }, + { "ve", TICODE_cnorm }, + { "nd", TICODE_cuf1 }, + { "ll", TICODE_ll }, + { "up", TICODE_cuu1 }, + { "vs", TICODE_cvvis }, + { "Yx", TICODE_defbi }, + { "ZE", TICODE_defc }, + { "dc", TICODE_dch1 }, + { "dl", TICODE_dl1 }, + { "dv", TICODE_devt }, + { "DI", TICODE_dial }, + { "ds", TICODE_dsl }, + { "DK", TICODE_dclk }, + { "S1", TICODE_dispc }, + { "hd", TICODE_hd }, + { "eA", TICODE_enacs }, + { "Yy", TICODE_endbi }, + { "as", TICODE_smacs }, + { "SA", TICODE_smam }, + { "mb", TICODE_blink }, + { "md", TICODE_bold }, + { "ti", TICODE_smcup }, + { "dm", TICODE_smdc }, + { "mh", TICODE_dim }, + { "ZF", TICODE_swidm }, + { "ZG", TICODE_sdrfq }, + { "Xh", TICODE_ehhlm }, + { "im", TICODE_smir }, + { "ZH", TICODE_sitm }, + { "Xl", TICODE_elhlm }, + { "ZI", TICODE_slm }, + { "Xo", TICODE_elohlm }, + { "ZJ", TICODE_smicm }, + { "ZK", TICODE_snlq }, + { "ZL", TICODE_snrmq }, + { "S2", TICODE_smpch }, + { "mp", TICODE_prot }, + { "mr", TICODE_rev }, + { "Xr", TICODE_erhlm }, + { "S4", TICODE_smsc }, + { "mk", TICODE_invis }, + { "ZM", TICODE_sshm }, + { "so", TICODE_smso }, + { "ZN", TICODE_ssubm }, + { "ZO", TICODE_ssupm }, + { "Xt", TICODE_ethlm }, + { "us", TICODE_smul }, + { "ZP", TICODE_sum }, + { "Xv", TICODE_evhlm }, + { "SX", TICODE_smxon }, + { "ec", TICODE_ech }, + { "ae", TICODE_rmacs }, + { "RA", TICODE_rmam }, + { "me", TICODE_sgr0 }, + { "te", TICODE_rmcup }, + { "ed", TICODE_rmdc }, + { "ZQ", TICODE_rwidm }, + { "ei", TICODE_rmir }, + { "ZR", TICODE_ritm }, + { "ZS", TICODE_rlm }, + { "ZT", TICODE_rmicm }, + { "S3", TICODE_rmpch }, + { "S5", TICODE_rmsc }, + { "ZU", TICODE_rshm }, + { "se", TICODE_rmso }, + { "ZV", TICODE_rsubm }, + { "ZW", TICODE_rsupm }, + { "ue", TICODE_rmul }, + { "ZX", TICODE_rum }, + { "RX", TICODE_rmxon }, + { "PA", TICODE_pause }, + { "fh", TICODE_hook }, + { "vb", TICODE_flash }, + { "ff", TICODE_ff }, + { "fs", TICODE_fsl }, + { "Gm", TICODE_getm }, + { "WG", TICODE_wingo }, + { "HU", TICODE_hup }, + { "i1", TICODE_is1 }, + { "i2", TICODE_is2 }, + { "i3", TICODE_is3 }, + { "is", TICODE_is2 }, + { "if", TICODE_if }, + { "iP", TICODE_iprog }, + { "Ic", TICODE_initc }, + { "Ip", TICODE_initp }, + { "ic", TICODE_ich1 }, + { "al", TICODE_il1 }, + { "ip", TICODE_ip }, + { "K1", TICODE_ka1 }, + { "K3", TICODE_ka3 }, + { "K2", TICODE_kb2 }, + { "kb", TICODE_kbs }, + { "kB", TICODE_kcbt }, + { "K4", TICODE_kc1 }, + { "K5", TICODE_kc3 }, + { "ka", TICODE_ktbc }, + { "kC", TICODE_kclr }, + { "kt", TICODE_kctab }, + { "kD", TICODE_kdch1 }, + { "kL", TICODE_kdl1 }, + { "kd", TICODE_kcud1 }, + { "kM", TICODE_krmir }, + { "kE", TICODE_kel }, + { "kS", TICODE_ked }, + { "k0", TICODE_kf0 }, + { "k1", TICODE_kf1 }, + { "k2", TICODE_kf2 }, + { "k3", TICODE_kf3 }, + { "k4", TICODE_kf4 }, + { "k5", TICODE_kf5 }, + { "k6", TICODE_kf6 }, + { "k7", TICODE_kf7 }, + { "k8", TICODE_kf8 }, + { "k9", TICODE_kf9 }, + { "k;", TICODE_kf10 }, + { "F1", TICODE_kf11 }, + { "F2", TICODE_kf12 }, + { "F3", TICODE_kf13 }, + { "F4", TICODE_kf14 }, + { "F5", TICODE_kf15 }, + { "F6", TICODE_kf16 }, + { "F7", TICODE_kf17 }, + { "F8", TICODE_kf18 }, + { "F9", TICODE_kf19 }, + { "FA", TICODE_kf20 }, + { "FB", TICODE_kf21 }, + { "FC", TICODE_kf22 }, + { "FD", TICODE_kf23 }, + { "FE", TICODE_kf24 }, + { "FF", TICODE_kf25 }, + { "FG", TICODE_kf26 }, + { "FH", TICODE_kf27 }, + { "FI", TICODE_kf28 }, + { "FJ", TICODE_kf29 }, + { "FK", TICODE_kf30 }, + { "FL", TICODE_kf31 }, + { "FM", TICODE_kf32 }, + { "FN", TICODE_kf33 }, + { "FO", TICODE_kf34 }, + { "FP", TICODE_kf35 }, + { "FQ", TICODE_kf36 }, + { "FR", TICODE_kf37 }, + { "FS", TICODE_kf38 }, + { "FT", TICODE_kf39 }, + { "FU", TICODE_kf40 }, + { "FV", TICODE_kf41 }, + { "FW", TICODE_kf42 }, + { "FX", TICODE_kf43 }, + { "FY", TICODE_kf44 }, + { "FZ", TICODE_kf45 }, + { "Fa", TICODE_kf46 }, + { "Fb", TICODE_kf47 }, + { "Fc", TICODE_kf48 }, + { "Fd", TICODE_kf49 }, + { "Fe", TICODE_kf50 }, + { "Ff", TICODE_kf51 }, + { "Fg", TICODE_kf52 }, + { "Fh", TICODE_kf53 }, + { "Fi", TICODE_kf54 }, + { "Fj", TICODE_kf55 }, + { "Fk", TICODE_kf56 }, + { "Fl", TICODE_kf57 }, + { "Fm", TICODE_kf58 }, + { "Fn", TICODE_kf59 }, + { "Fo", TICODE_kf60 }, + { "Fp", TICODE_kf61 }, + { "Fq", TICODE_kf62 }, + { "Fr", TICODE_kf63 }, + { "%1", TICODE_khlp }, + { "kh", TICODE_khome }, + { "kI", TICODE_kich1 }, + { "kA", TICODE_kil1 }, + { "kl", TICODE_kcub1 }, + { "kH", TICODE_kll }, + { "%2", TICODE_kmrk }, + { "%3", TICODE_kmsg }, + { "Km", TICODE_kmous }, + { "%4", TICODE_kmov }, + { "%5", TICODE_knxt }, + { "kN", TICODE_knp }, + { "%6", TICODE_kopn }, + { "%7", TICODE_kopt }, + { "kP", TICODE_kpp }, + { "%8", TICODE_kprv }, + { "%9", TICODE_kprt }, + { "%0", TICODE_krdo }, + { "&1", TICODE_kref }, + { "&2", TICODE_krfr }, + { "&3", TICODE_krpl }, + { "&4", TICODE_krst }, + { "&5", TICODE_kres }, + { "kr", TICODE_kcuf1 }, + { "&6", TICODE_ksav }, + { "&9", TICODE_kBEG }, + { "&0", TICODE_kCAN }, + { "*1", TICODE_kCMD }, + { "*2", TICODE_kCPY }, + { "*3", TICODE_kCRT }, + { "*4", TICODE_kDC }, + { "*5", TICODE_kDL }, + { "*6", TICODE_kslt }, + { "*7", TICODE_kEND }, + { "*8", TICODE_kEOL }, + { "*9", TICODE_kEXT }, + { "kF", TICODE_kind }, + { "*0", TICODE_kFND }, + { "#1", TICODE_kHLP }, + { "#2", TICODE_kHOM }, + { "#3", TICODE_kIC }, + { "#4", TICODE_kLFT }, + { "%a", TICODE_kMSG }, + { "%b", TICODE_kMOV }, + { "%c", TICODE_kNXT }, + { "%d", TICODE_kOPT }, + { "%e", TICODE_kPRV }, + { "%f", TICODE_kPRT }, + { "kR", TICODE_kri }, + { "%g", TICODE_kRDO }, + { "%h", TICODE_kRPL }, + { "%i", TICODE_kRIT }, + { "%j", TICODE_kRES }, + { "!1", TICODE_kSAV }, + { "!2", TICODE_kSPD }, + { "kT", TICODE_khts }, + { "!3", TICODE_kUND }, + { "&7", TICODE_kspd }, + { "&8", TICODE_kund }, + { "ku", TICODE_kcuu1 }, + { "ke", TICODE_rmkx }, + { "ks", TICODE_smkx }, + { "l0", TICODE_lf0 }, + { "l1", TICODE_lf1 }, + { "l2", TICODE_lf2 }, + { "l3", TICODE_lf3 }, + { "l4", TICODE_lf4 }, + { "l5", TICODE_lf5 }, + { "l6", TICODE_lf6 }, + { "l7", TICODE_lf7 }, + { "l8", TICODE_lf8 }, + { "l9", TICODE_lf9 }, + { "la", TICODE_lf10 }, + { "Lf", TICODE_fln }, + { "LF", TICODE_rmln }, + { "LO", TICODE_smln }, + { "mo", TICODE_rmm }, + { "mm", TICODE_smm }, + { "ZY", TICODE_mhpa }, + { "ZZ", TICODE_mcud1 }, + { "Za", TICODE_mcub1 }, + { "Zb", TICODE_mcuf1 }, + { "Zc", TICODE_mvpa }, + { "Zd", TICODE_mcuu1 }, + { "Mi", TICODE_minfo }, + { "nw", TICODE_nel }, + { "Ze", TICODE_porder }, + { "oc", TICODE_oc }, + { "op", TICODE_op }, + { "pc", TICODE_pad }, + { "DC", TICODE_dch }, + { "DL", TICODE_dl }, + { "DO", TICODE_cud }, + { "Zf", TICODE_mcud }, + { "IC", TICODE_ich }, + { "SF", TICODE_indn }, + { "AL", TICODE_il }, + { "LE", TICODE_cub }, + { "Zg", TICODE_mcub }, + { "RI", TICODE_cuf }, + { "Zh", TICODE_mcuf }, + { "SR", TICODE_rin }, + { "UP", TICODE_cuu }, + { "Zi", TICODE_mcuu }, + { "S6", TICODE_pctrm }, + { "pk", TICODE_pfkey }, + { "pl", TICODE_pfloc }, + { "xl", TICODE_pfxl }, + { "px", TICODE_pfx }, + { "pn", TICODE_pln }, + { "ps", TICODE_mc0 }, + { "pO", TICODE_mc5p }, + { "pf", TICODE_mc4 }, + { "po", TICODE_mc5 }, + { "PU", TICODE_pulse }, + { "QD", TICODE_qdial }, + { "RC", TICODE_rmclk }, + { "rp", TICODE_rep }, + { "RF", TICODE_rfi }, + { "RQ", TICODE_reqmp }, + { "r1", TICODE_rs1 }, + { "r2", TICODE_rs2 }, + { "r3", TICODE_rs3 }, + { "rf", TICODE_rf }, + { "rc", TICODE_rc }, + { "cv", TICODE_vpa }, + { "sc", TICODE_sc }, + { "S7", TICODE_scesc }, + { "sf", TICODE_ind }, + { "sr", TICODE_ri }, + { "Zj", TICODE_scs }, + { "s0", TICODE_s0ds }, + { "s1", TICODE_s1ds }, + { "s2", TICODE_s2ds }, + { "s3", TICODE_s3ds }, + { "sA", TICODE_sgr1 }, + { "AB", TICODE_setab }, + { "AF", TICODE_setaf }, + { "sa", TICODE_sgr }, + { "Sb", TICODE_setb }, + { "Zk", TICODE_smgb }, + { "Zl", TICODE_smgbp }, + { "SC", TICODE_sclk }, + { "Yz", TICODE_slines }, + { "sL", TICODE_slength }, + { "sp", TICODE_scp }, + { "Sf", TICODE_setf }, + { "ML", TICODE_smgl }, /* We should fallback to TICODE_smglr */ + { "Zm", TICODE_smglp }, + { "YZ", TICODE_slines }, + { "YI", TICODE_slength }, + { "MR", TICODE_smgr }, + { "Zn", TICODE_smgrp }, + { "st", TICODE_hts }, + { "MT", TICODE_smgtb }, + { "Zo", TICODE_smgt }, + { "Zp", TICODE_smgtp }, + { "wi", TICODE_wind }, + { "Zq", TICODE_sbim }, + { "Zr", TICODE_scsd }, + { "Zs", TICODE_rbim }, + { "Zt", TICODE_rcsd }, + { "Zu", TICODE_subcs }, + { "Zv", TICODE_supcs }, + { "ta", TICODE_ht }, + { "Zw", TICODE_docr }, + { "ts", TICODE_tsl }, + { "TO", TICODE_tone }, + { "u0", TICODE_u0 }, + { "u1", TICODE_u1 }, + { "u2", TICODE_u2 }, + { "u3", TICODE_u3 }, + { "u4", TICODE_u4 }, + { "u5", TICODE_u5 }, + { "u6", TICODE_u6 }, + { "u7", TICODE_u7 }, + { "u8", TICODE_u8 }, + { "u9", TICODE_u9 }, + { "uc", TICODE_uc }, + { "hu", TICODE_hu }, + { "WA", TICODE_wait }, + { "XF", TICODE_xoffc }, + { "XN", TICODE_xonc }, + { "Zx", TICODE_zerom }, + + /* NetBSD extensions */ + { "@0", TICODE_kfnd }, + { "@1", TICODE_kbeg }, + { "@2", TICODE_kcan }, + { "@3", TICODE_kclo }, + { "@4", TICODE_kcmd }, + { "@5", TICODE_kcpy }, + { "@6", TICODE_kcrt }, + { "@7", TICODE_kend }, + { "@8", TICODE_kent }, + { "@9", TICODE_kext }, +}; diff --git a/vendor/netbsd-curses/libterminfo/terminfo.3 b/vendor/netbsd-curses/libterminfo/terminfo.3 new file mode 100644 index 0000000..3363d4d --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/terminfo.3 @@ -0,0 +1,256 @@ +.\" $NetBSD: terminfo.3,v 1.14 2017/10/22 16:42:34 abhinav Exp $ +.\" +.\" Copyright (c) 2009, 2011 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Roy Marples. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd November 23, 2015 +.Dt TERMINFO 3 +.Os +.Sh NAME +.Nm setupterm , +.Nm set_curterm , +.Nm del_curterm , +.Nm termname , +.Nm longname , +.Nm tigetflag , +.Nm tigetnum , +.Nm tigetstr , +.Nm tparm , +.Nm tputs , +.Nm putp , +.Nm ti_setupterm , +.Nm ti_getflag , +.Nm ti_getnum , +.Nm ti_getstr , +.Nm tiparm , +.Nm ti_tiparm , +.Nm ti_puts , +.Nm ti_putp +.Nd terminal independent operation routines +.Sh LIBRARY +.Lb libterminfo +.Sh SYNOPSIS +.In term.h +.Vt char PC ; +.Vt short ospeed ; +.Vt TERMINAL *cur_term ; +.Ft int +.Fn setupterm "const char *name" "int fildes" "int *errret" +.Ft TERMINAL * +.Fn set_curterm "TERMINAL *nterm" +.Ft int +.Fn del_curterm "TERMINAL *oterm" +.Ft char * +.Fn termname "void" +.Ft char * +.Fn longname "void" +.Ft int +.Fn tigetnum "const char *id" +.Ft int +.Fn tigetflag "const char *id" +.Ft char * +.Fn tigetstr "const char *id" +.Ft char * +.Fn tparm "const char *cm" "long p1" "long p2" "long p3" "long p4" "long p5" "long p6" "long p7" "long p8" "long p9" +.Ft int +.Fn tputs "const char *cp" "int affcnt" "int (*outc)(int)" +.Ft int +.Fn putp "const char *cp" +.Ft int +.Fn ti_setupterm "TERMINAL **" "const char *name" "int fildes" "int *error" +.Ft int +.Fn ti_getflag "const TERMINAL *" "const char *id" +.Ft int +.Fn ti_getnum "const TERMINAL *" "const char *id" +.Ft const char * +.Fn ti_getstr "const TERMINAL *" "const char *id" +.Ft char * +.Fn tiparm "const char *cm" "..." +.Ft char * +.Fn ti_tiparm "TERMINAL *" "const char *cm" "..." +.Ft int +.Fn ti_puts "const TERMINAL *term" "const char *str" "int affcnt" "int (*outc)(int ch, void *arg)" "void *arg" +.Ft int +.Fn ti_putp "const TERMINAL *term" "const char *str" +.Sh DESCRIPTION +These functions extract and use capabilities from a terminal capability +database, usually +.Pa /usr/share/misc/terminfo , +the format of which is described in +.Xr terminfo 5 . +These are low level routines; +see +.Xr curses 3 +for a higher level package. +.Pp +The +.Fn setupterm +function extracts the entry for terminal +.Fa name +and then calls +.Fn set_curterm +to set +.Va cur_term +to it. +If +.Fa name +is +.Dv NULL +then it is replaced by the environment variable +.Ev TERM . +The +.Fn setupterm +function returns 0 on success and \-1 on error. +.Va errret +is set to \-1 if the +.Nm terminfo +database could not be opened, +0 if the terminal could not be found in the database, and +1 if all went well. +.Pp +The +.Fn set_curterm +function sets the variable +.Va cur_term +to +.Va nterm +and makes all of the +.Nm terminfo +boolean, numeric and string variables use the values from +.Va nterm . +The global variables +.Va PC +and +.Va ospeed +are then set. +The old value of +.Va cur_term +is returned. +The +.Fn del_curterm +function frees space pointed to by +.Va oterm . +.Pp +The +.Fn termname +function returns the name of +.Va cur_term . +The +.Fn longname +function returns the description of +.Va cur_term . +.Pp +The +.Fn tigetflag +function gets the boolean value of capability +.Va id , +returning \-1 if it is not a valid capability. +The +.Fn tigetnum +function gets the numeric value of the capability +.Va id , +returning \-2 if it is not a valid capability. +The +.Fn tigetstr +function returns the string value of the capability +.Va id , +returning (char *)-1 if it is not a valid capability. +.Pp +The +.Fn tparm +function returns a string decoded from +.Va cm +with the parameters +.Va p1 +\&... +.Va p9 +applied. +Some capabilities require string parameters and only platforms that can fit +a +.Vt char * +pointer inside a +.Vt long +can use them. +For platforms which don't support this, +.Dv NULL +is returned and +.Va errno +is set to +.Er ENOTSUPP . +The string encoding and parameter application is described in +.Xr terminfo 5 . +.Pp +The +.Fn tputs +function applies padding information to the string +.Va cp ; +.Va affcnt +gives the number of lines affected by the operation, +or 1 if this is not applicable; +.Va outc +is a function which is called by each character in turn. +The external variable +.Va ospeed +controls how many padding characters are sent in relation to the terminal +speed. +The +.Fn putp +function calls tputs(str, 1, putchar). +The output from +.Fn putp +always goes to stdout. +.Ss NetBSD Extensions To Terminfo +The +.Fn tiparm +function allows variadic parameters instead of 9 fixed longs. +Numeric parameters must be passed as +.Vt int . +String parameters must be passed as +.Vt char * +and works on all platforms, unlike +.Fn tparm . +.Pp +The +.Fn ti_* +functions correspond to the standard +.Fn t* +functions but take an additional +.Ft TERMINAL * +parameter so that the terminal can be specified instead of assuming +.Va cur_term . +These functions use private variables to the +.Ft TERMINAL +instead of the global variables, such as +.Va PC +and +.Va ospeed . +.Sh SEE ALSO +.Xr ex 1 , +.Xr curses 3 , +.Xr terminfo 5 +.Sh AUTHORS +.An Roy Marples Aq Mt roy@NetBSD.org diff --git a/vendor/netbsd-curses/libterminfo/terminfo.5.in b/vendor/netbsd-curses/libterminfo/terminfo.5.in new file mode 100644 index 0000000..436d4cf --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/terminfo.5.in @@ -0,0 +1,263 @@ +.\" $NetBSD: terminfo.5.in,v 1.24 2020/06/05 22:08:11 roy Exp $ +.\" +.\" Copyright (c) 2009, 2010, 2011, 2013 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Roy Marples. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd June 5, 2020 +.Dt TERMINFO 5 +.Os +.Sh NAME +.Nm terminfo +.Nd terminal capability definition +.Sh DESCRIPTION +.Nm +describes the capabilities of terminals, used by programs such as +.Xr vi 1 , +.Xr rogue 6 +and libraries such as +.Xr curses 3 . +The +.Nm +source described here needs to be compiled with +.Xr tic 1 +to be of any use. +.Pp +Entries in +.Nm +consist of a number of comma separated fields. +White space after each comma is ignored. +Embedded commas must be escaped by using a backslash. +Lines beginning with +.Sq # +in the first column are treated as comments. +Blank lines are ignored. +.Pp +The header line must begin in column one and end with a comma. +Inside the header line are terminal name and aliases, +separated by vertical bars, the last one being the long +description of the terminal. +.Pp +Capability lines then follow, starting on column two and ending with a comma. +Each capability is listed by its name, followed by its value if applicable. +Booleans have no values, numeric values are prefixed by +.Sq # +and strings are prefixed by +.Sq = . +Numbers can range from 0 to 32767 and string values can be up to 1000 +characters long. +This implementation supports strings upto 32767 characters long, including the +.Dv NUL +terminator. +.Pp +Some escapes are available for strings - both +.Sy \eE +and +.Sy \ee +map to the +.Dv ESC +character, +.Sy ^X +maps to a control-X for any appropriate X, and the sequences +.Sy \en , +.Sy \er , +.Sy \et , +.Sy \eb +and +.Sy \ef +map to linefeed, return, tab, backspace, and formfeed respectively. +Any character can be escaped in octal, such as +.Sy \e072 . +If you need to encode a +.Dv NUL +character, it should be escaped as +.Sy \e200 . +.Pp +A delay in milliseconds may appear anywhere in a string capability, +prefixed with a dollar sign and enclosed by angled brackets, such as +.Sy $\*[Lt]5\*[Gt] . +.Ss String Parameters +String capabilities sometimes require parameters. +Normally this just involves replacing the parameter with a supplied +variable; however, there are cases where the variable needs to be manipulated +or used in conditional expressions. +A stack is also provided for simple pop and push operations. +.Pp +The below % encodings have the following meanings: +.Bl -tag -width %P[a-z] +.It Sy %% +outputs % +.It Sy %[[:]flags][width[.precision]][doxXs] +flags are +.Dq [-+#] . +Prefix with +.Sq \&: +to avoid interpreting +.Dq %- +as an operator. +.It Sy %c +pop a parameter and print the character representation of it. +.It Sy %s +pop a parameter and print the string representation of it. +.It Sy %p[1-9] +push the parameter [1-9]. +.It Sy %P[a-z] +pop a parameter and push it to dynamic variable [a-z]. +.It Sy %g[a-z] +push the dynamic variable [a-z]. +.It Sy %P[A-Z] +pop a parameter and push it to static variable [a-z]. +.It Sy %g[A-Z] +push the static variable [a-z]. +.Pp +Static variables persist over +.Fn tparm +whereas dynamic variables do not. +.It Sy %'c' +char constant c. +.It Sy %{nn} +integer constant nn. +.It Sy %l +push the string length of the previously popped parameter. +.It Sy %+ Sy %- Sy %* Sy %/ Sy %m +arithmetic: pop two parameters and push the result. +.It Sy %& Sy %| Sy %^ +bit operations: pop two parameters and push the result. +.It Sy %! Sy %~ +unary operations: pop two parameters and push the result. +.It Sy %i +add 1 to parameters 1 and 2. +.It Sy %? Va expr Sy %t Ic then Sy %e Ic else Sy %; +If expr equates to zero then control passes to the optional else part. +.El +.Ss Boolean Capabilities +.Bl -column "enter_near_quality_letter" "setcolor" "TC" "desc" +.It Sy "Long name" Ta Sy "Code" Ta Sy "TC" Ta Sy "Description" +@BOOLCAPS@ +.El +.Ss Numeric Capabilities +.Bl -column "enter_near_quality_letter" "setcolor" "TC" "Desc" +.It Sy "Long name" Ta Sy "Code" Ta Sy "TC" Ta Sy "Description" +@NUMCAPS@ +.El +.Ss String Capabilities +.Bl -column "enter_near_quality_letter" "setcolor" "TC" "Desc" +.It Sy "Long name" Ta Sy "Code" Ta Sy "TC" Ta Sy "Description" +@STRCAPS@ +.El +.Ss A Sample Entry +.Bd -literal +vt100\||dec vt100 (w/advanced video), +am, xenl, msgr, mc5i, xon, +cols#80, it#8, lines#24, vt#3, +acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, +cr=^M, csr=\eE[%i%p1%d;%p2%dr, tbc=\eE[3g, clear=\eE[H\eE[J$\*[Lt]50\*[Gt], +el1=\eE[1K$\*[Lt]3\*[Gt], el=\eE[K$\*[Lt]3\*[Gt], ed=\eE[J$\*[Lt]50\*[Gt], +cup=\eE[%i%p1%d;%p2%dH$\*[Lt]5\*[Gt], cud1=^J, home=\eE[H, cub1=^H, +cuf1=\eE[C$\*[Lt]2\*[Gt], cuu1=\eE[A$\*[Lt]2\*[Gt], enacs=\eE(B\eE)0, smacs=^N, +smam=\eE[?7h, blink=\eE[5m$\*[Lt]2\*[Gt], bold=\eE[1m$\*[Lt]2\*[Gt], rev=\eE[7m$\*[Lt]2\*[Gt], +smso=\eE[7m$\*[Lt]2\*[Gt], smul=\eE[4m$\*[Lt]2\*[Gt], rmacs=^O, rmam=\eE[?7l, +sgr0=\eE[m017$\*[Lt]2\*[Gt], rmso=\eE[m$\*[Lt]2\*[Gt], rmul=\eE[m$\*[Lt]2\*[Gt], ka1=\eEOq, +ka3=\eEOs, kb2=\eEOr, kbs=^H, kc1=\eEOp, kc3=\eEOn, kcud1=\eEOB, +kent=\eEOM, kf0=\eEOy, kf1=\eEOP, kf2=\eEOQ, kf3=\eEOR, kf4=\eEOS, +kf5=\eEOt, kf6=\eEOu, kf7=\eEOv, kf8=\eEOl, kf9=\eEOw, kf10=\eEOx, +kcub1=\eEOD, kcuf1=\eEOC, kcuu1=\eEOA, rmkx=\eE[?1l\eE\*[Gt], +smkx=\eE[?1h\eE=, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, +cud=\eE[%p1%dB, cub=\eE[%p1%dD, cuf=\eE[%p1%dC, cuu=\eE[%p1%dA, +mc0=\eE[0i, mc4=\eE[4i, mc5=\eE[5i, +rs2=\eE\*[Gt]\eE[?3l\eE[?4l\eE[?5l\eE[?7h\eE[?8h, rc=\eE8, sc=\eE7, +ind=^J, ri=\eEM$\*[Lt]5\*[Gt], +sgr=\eE[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t016%e017%;$\*[Lt]2\*[Gt], +hts=\eEH, ht=^I, +.Ed +.Ss Fetching Compiled Descriptions +This implementation uses hashed databases managed by +.Xr cdb 5 +instead of directories. +To maintain compatibility with other implementations, +.Pa .cdb +is appended to each file checked. +.Pp +If the environment variable +.Ev TERMINFO +is available, does not begin with +.Pq Sq / , +can be compiled with the above rules and whose name matches +.Ev TERM +then it is used. +.Pp +If the environment variable +.Ev TERMCAP +is available and does not begin with a slash +.Pq Sq / +then it will be translated into +terminfo and compiled as above. +If its name matches +.Ev TERM +then it is used. +.Pp +If the environment variable +.Ev TERMINFO +is available and begins with a slash +.Pq Sq / +then only this file is searched. +Otherwise +.Nm +will first look for +.Pa $HOME/.terminfo , +followed by +.Pa /usr/share/misc/terminfo +unless +.Ev TERMINFO_DIRS +is available. +If a matching description is not found then a small embedded database is +searched, which currently holds descriptions for ansi, dumb, vt100, vt220, +wsvt25, and xterm. +.Sh FILES +.Bl -tag -width /usr/share/misc/terminfo.cdb -compact +.It Pa $HOME/.terminfo.cdb +Database of terminal descriptions for personal use. +.It Pa /usr/share/misc/terminfo +File containing terminal descriptions. +.It Pa /usr/share/misc/terminfo.cdb +Database of terminal descriptions. +.El +.Sh SEE ALSO +.Xr infocmp 1 , +.Xr tic 1 , +.Xr tput 1 , +.Xr curses 3 , +.Xr cdb 5 +.Sh STANDARDS +.Nm +complies with the +.St -xcurses4.2 +standard. +.Pp +Extensions to the standard are noted in +.Xr tic 1 . +.Sh AUTHORS +.An Roy Marples Aq Mt roy@NetBSD.org diff --git a/vendor/netbsd-curses/libterminfo/termname.3 b/vendor/netbsd-curses/libterminfo/termname.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/termname.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tgetent.3 b/vendor/netbsd-curses/libterminfo/tgetent.3 new file mode 120000 index 0000000..bcd05f7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tgetent.3 @@ -0,0 +1 @@ +termcap.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tgetflag.3 b/vendor/netbsd-curses/libterminfo/tgetflag.3 new file mode 120000 index 0000000..bcd05f7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tgetflag.3 @@ -0,0 +1 @@ +termcap.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tgetnum.3 b/vendor/netbsd-curses/libterminfo/tgetnum.3 new file mode 120000 index 0000000..bcd05f7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tgetnum.3 @@ -0,0 +1 @@ +termcap.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tgetstr.3 b/vendor/netbsd-curses/libterminfo/tgetstr.3 new file mode 120000 index 0000000..bcd05f7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tgetstr.3 @@ -0,0 +1 @@ +termcap.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tgoto.3 b/vendor/netbsd-curses/libterminfo/tgoto.3 new file mode 120000 index 0000000..bcd05f7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tgoto.3 @@ -0,0 +1 @@ +termcap.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/ti.c b/vendor/netbsd-curses/libterminfo/ti.c new file mode 100644 index 0000000..6b34728 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/ti.c @@ -0,0 +1,134 @@ +/* $NetBSD: ti.c,v 1.3 2013/06/07 13:16:18 roy Exp $ */ + +/* + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * + * This id is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source id must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include + +int +ti_getflag(const TERMINAL *term, const char *id) +{ + ssize_t ind; + size_t i; + TERMUSERDEF *ud; + + _DIAGASSERT(term != NULL); + _DIAGASSERT(id != NULL); + + ind = _ti_flagindex(id); + if (ind != -1) + return term->flags[ind]; + for (i = 0; i < term->_nuserdefs; i++) { + ud = &term->_userdefs[i]; + if (ud->type == 'f' && strcmp(ud->id, id) == 0) + return ud->flag; + } + return ABSENT_BOOLEAN; +} + +int +tigetflag(const char *id) +{ + + _DIAGASSERT(id != NULL); + if (cur_term != NULL) + return ti_getflag(cur_term, id); + return ABSENT_BOOLEAN; +} + +int +ti_getnum(const TERMINAL *term, const char *id) +{ + ssize_t ind; + size_t i; + TERMUSERDEF *ud; + + _DIAGASSERT(term != NULL); + _DIAGASSERT(id != NULL); + + ind = _ti_numindex(id); + if (ind != -1) { + if (!VALID_NUMERIC(term->nums[ind])) + return ABSENT_NUMERIC; + return term->nums[ind]; + } + for (i = 0; i < term->_nuserdefs; i++) { + ud = &term->_userdefs[i]; + if (ud->type == 'n' && strcmp(ud->id, id) == 0) { + if (!VALID_NUMERIC(ud->num)) + return ABSENT_NUMERIC; + return ud->num; + } + } + return CANCELLED_NUMERIC; +} + +int +tigetnum(const char *id) +{ + + _DIAGASSERT(id != NULL); + if (cur_term != NULL) + return ti_getnum(cur_term, id); + return CANCELLED_NUMERIC; +} + +const char * +ti_getstr(const TERMINAL *term, const char *id) +{ + ssize_t ind; + size_t i; + TERMUSERDEF *ud; + + _DIAGASSERT(term != NULL); + _DIAGASSERT(id != NULL); + + ind = _ti_strindex(id); + if (ind != -1) + return term->strs[ind]; + for (i = 0; i < term->_nuserdefs; i++) { + ud = &term->_userdefs[i]; + if (ud->type == 's' && strcmp(ud->id, id) == 0) + return ud->str; + } + return (const char *)CANCELLED_STRING; +} + +char * +tigetstr(const char *id) +{ + + _DIAGASSERT(id != NULL); + if (cur_term != NULL) + return __UNCONST(ti_getstr(cur_term, id)); + return (char *)CANCELLED_STRING; +} diff --git a/vendor/netbsd-curses/libterminfo/ti_getflag.3 b/vendor/netbsd-curses/libterminfo/ti_getflag.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/ti_getflag.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/ti_getnum.3 b/vendor/netbsd-curses/libterminfo/ti_getnum.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/ti_getnum.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/ti_getstr.3 b/vendor/netbsd-curses/libterminfo/ti_getstr.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/ti_getstr.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/ti_putp.3 b/vendor/netbsd-curses/libterminfo/ti_putp.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/ti_putp.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/ti_puts.3 b/vendor/netbsd-curses/libterminfo/ti_puts.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/ti_puts.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/ti_setupterm.3 b/vendor/netbsd-curses/libterminfo/ti_setupterm.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/ti_setupterm.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/ti_tiparm.3 b/vendor/netbsd-curses/libterminfo/ti_tiparm.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/ti_tiparm.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tigetflag.3 b/vendor/netbsd-curses/libterminfo/tigetflag.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tigetflag.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tigetnum.3 b/vendor/netbsd-curses/libterminfo/tigetnum.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tigetnum.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tigetstr.3 b/vendor/netbsd-curses/libterminfo/tigetstr.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tigetstr.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tiparm.3 b/vendor/netbsd-curses/libterminfo/tiparm.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tiparm.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tparm.3 b/vendor/netbsd-curses/libterminfo/tparm.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tparm.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tparm.c b/vendor/netbsd-curses/libterminfo/tparm.c new file mode 100644 index 0000000..5596362 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tparm.c @@ -0,0 +1,633 @@ +/* $NetBSD: tparm.c,v 1.18 2020/03/27 15:11:57 christos Exp $ */ + +/* + * Copyright (c) 2009, 2011, 2013 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define LONG_STR_MAX ((CHAR_BIT * sizeof(long)) / 3) +#define BUFINC 128 /* Size to increament the terminal buffer by */ + +#define VA_LONG_LONG 1 +#define VA_CHAR_INT 2 +//#define VA_CHAR_LONG 3 /* No need for this yet */ + +static TERMINAL *dumbterm; /* For non thread safe functions */ + +typedef struct { + long nums[20]; + char *strings[20]; + size_t offset; +} TPSTACK; + +typedef struct { + long num; + char *string; +} TPVAR; + +static int +push(long num, char *string, TPSTACK *stack) +{ + if (stack->offset >= sizeof(stack->nums)) { + errno = E2BIG; + return -1; + } + stack->nums[stack->offset] = num; + stack->strings[stack->offset] = string; + stack->offset++; + return 0; +} + +static int +pop(long *num, char **string, TPSTACK *stack) +{ + if (stack->offset == 0) { + if (num) + *num = 0; + if (string) + *string = NULL; + errno = E2BIG; + return -1; + } + stack->offset--; + if (num) + *num = stack->nums[stack->offset]; + if (string) + *string = stack->strings[stack->offset]; + return 0; +} + +static char * +checkbuf(TERMINAL *term, size_t len) +{ + char *buf; + + if (term->_bufpos + len >= term->_buflen) { + len = term->_buflen + MAX(len, BUFINC); + buf = realloc(term->_buf, len); + if (buf == NULL) + return NULL; + term->_buf = buf; + term->_buflen = len; + } + return term->_buf; +} + +static size_t +ochar(TERMINAL *term, int c) +{ + if (c == 0) + c = 0200; + /* Check we have space and a terminator */ + if (checkbuf(term, 2) == NULL) + return 0; + term->_buf[term->_bufpos++] = (char)c; + return 1; +} + +static size_t +onum(TERMINAL *term, const char *fmt, int num, size_t len) +{ + int l; + size_t r; + + if (len < LONG_STR_MAX) + len = LONG_STR_MAX; + if (checkbuf(term, len + 2) == NULL) + return 0; + l = snprintf(term->_buf + term->_bufpos, len + 2, fmt, num); + if (l == -1) + return 0; + r = (size_t)l; + term->_bufpos += r; + return r; +} + +/* + Make a pass through the string so we can work out + which parameters are ints and which are char *. + Basically we only use char * if %p[1-9] is followed by %l or %s. +*/ +int +_ti_parm_analyse(const char *str, int *piss, int piss_len) +{ + int nparm, lpop; + char c; + + nparm = 0; + lpop = -1; + while ((c = *str++) != '\0') { + if (c != '%') + continue; + c = *str++; + switch (c) { + case 'l': /* FALLTHROUGH */ + case 's': + if (lpop > 0) { + if (lpop <= piss_len) + piss[lpop - 1] = 1; + else if (piss) + errno = E2BIG; + } + break; + case 'p': + c = *str++; + if (c < '1' || c > '9') { + errno = EINVAL; + continue; + } else { + lpop = c - '0'; + if (lpop > nparm) + nparm = lpop; + } + break; + default: + lpop = -1; + } + } + + return nparm; +} + +static char * +_ti_tiparm(TERMINAL *term, const char *str, int va_type, va_list parms) +{ + char c, fmt[64], *fp, *ostr; + long val, val2; + long dnums[26]; /* dynamic variables a-z, not preserved */ + size_t l, max, width, precision, olen; + TPSTACK stack; + TPVAR params[TPARM_MAX]; + unsigned int done, dot, minus; + int piss[TPARM_MAX]; /* Parameter IS String - piss ;) */ + + if (str == NULL) + return NULL; + + /* + If not passed a terminal, malloc a dummy one. + This means we can preserve buffers and variables per terminal and + still work with non thread safe functions (which sadly are still the + norm and standard). + */ + if (term == NULL) { + if (dumbterm == NULL) { + dumbterm = malloc(sizeof(*dumbterm)); + if (dumbterm == NULL) + return NULL; + dumbterm->_buflen = 0; + } + term = dumbterm; + } + + term->_bufpos = 0; + /* Ensure we have an initial buffer */ + if (term->_buflen == 0) { + term->_buf = malloc(BUFINC); + if (term->_buf == NULL) + return NULL; + term->_buflen = BUFINC; + } + + memset(&piss, 0, sizeof(piss)); + max = (size_t)_ti_parm_analyse(str, piss, TPARM_MAX); + + /* Put our parameters into variables */ + memset(¶ms, 0, sizeof(params)); + for (l = 0; l < max; l++) { + if (piss[l]) { + if (va_type == VA_LONG_LONG) { + /* This only works if char * fits into a long + * on this platform. */ + if (sizeof(char *) <= sizeof(long)/*CONSTCOND*/) + params[l].string = + (char *)va_arg(parms, long); + else { + errno = ENOTSUP; + return NULL; + } + } else + params[l].string = va_arg(parms, char *); + } else { + if (va_type == VA_CHAR_INT) + params[l].num = (long)va_arg(parms, int); + else + params[l].num = va_arg(parms, long); + } + } + + memset(&stack, 0, sizeof(stack)); + while ((c = *str++) != '\0') { + if (c != '%' || (c = *str++) == '%') { + if (c == '\0') + break; + if (ochar(term, c) == 0) + return NULL; + continue; + } + + /* Handle formatting. */ + fp = fmt; + *fp++ = '%'; + done = dot = minus = 0; + width = precision = 0; + val = 0; + while (done == 0 && (size_t)(fp - fmt) < sizeof(fmt)) { + switch (c) { + case 'c': /* FALLTHROUGH */ + case 's': + *fp++ = c; + done = 1; + break; + case 'd': /* FALLTHROUGH */ + case 'o': /* FALLTHROUGH */ + case 'x': /* FALLTHROUGH */ + case 'X': /* FALLTHROUGH */ + *fp++ = 'l'; + *fp++ = c; + done = 1; + break; + case '#': /* FALLTHROUGH */ + case ' ': + *fp++ = c; + break; + case '.': + *fp++ = c; + if (dot == 0) { + dot = 1; + width = (size_t)val; + } else + done = 2; + val = 0; + break; + case ':': + minus = 1; + break; + case '-': + if (minus) + *fp++ = c; + else + done = 1; + break; + default: + if (isdigit((unsigned char)c)) { + val = (val * 10) + (c - '0'); + if (val > 10000) + done = 2; + else + *fp++ = c; + } else + done = 1; + } + if (done == 0) + c = *str++; + } + if (done == 2) { + /* Found an error in the format */ + fp = fmt + 1; + *fp = *str; + olen = 0; + } else { + if (dot == 0) + width = (size_t)val; + else + precision = (size_t)val; + olen = MAX(width, precision); + } + *fp++ = '\0'; + + /* Handle commands */ + switch (c) { + case 'c': + pop(&val, NULL, &stack); + if (ochar(term, (unsigned char)val) == 0) + return NULL; + break; + case 's': + pop(NULL, &ostr, &stack); + if (ostr != NULL) { + int r; + + l = strlen(ostr); + if (l < (size_t)olen) + l = olen; + if (checkbuf(term, (size_t)(l + 1)) == NULL) + return NULL; + r = snprintf(term->_buf + term->_bufpos, l + 1, + fmt, ostr); + if (r != -1) + term->_bufpos += (size_t)r; + } + break; + case 'l': + pop(NULL, &ostr, &stack); + if (ostr == NULL) + l = 0; + else + l = strlen(ostr); +#ifdef NCURSES_COMPAT_57 + if (onum(term, "%ld", (long)l, 0) == 0) + return NULL; +#else + push((long)l, NULL, &stack); +#endif + break; + case 'd': /* FALLTHROUGH */ + case 'o': /* FALLTHROUGH */ + case 'x': /* FALLTHROUGH */ + case 'X': + pop(&val, NULL, &stack); + if (onum(term, fmt, (int)val, olen) == 0) + return NULL; + break; + case 'p': + if (*str < '1' || *str > '9') + break; + l = (size_t)(*str++ - '1'); + if (push(params[l].num, params[l].string, &stack)) + return NULL; + break; + case 'P': + pop(&val, NULL, &stack); + if (*str >= 'a' && *str <= 'z') + dnums[*str - 'a'] = val; + else if (*str >= 'A' && *str <= 'Z') + term->_snums[*str - 'A'] = val; + break; + case 'g': + if (*str >= 'a' && *str <= 'z') { + if (push(dnums[*str - 'a'], NULL, &stack)) + return NULL; + } else if (*str >= 'A' && *str <= 'Z') { + if (push(term->_snums[*str - 'A'], + NULL, &stack)) + return NULL; + } + break; + case 'i': + if (piss[0] == 0) + params[0].num++; + if (piss[1] == 0) + params[1].num++; + break; + case '\'': + if (push((long)(unsigned char)*str++, NULL, &stack)) + return NULL; + while (*str != '\0' && *str != '\'') + str++; + if (*str == '\'') + str++; + break; + case '{': + val = 0; + for (; isdigit((unsigned char)*str); str++) + val = (val * 10) + (*str - '0'); + if (push(val, NULL, &stack)) + return NULL; + while (*str != '\0' && *str != '}') + str++; + if (*str == '}') + str++; + break; + case '+': /* FALLTHROUGH */ + case '-': /* FALLTHROUGH */ + case '*': /* FALLTHROUGH */ + case '/': /* FALLTHROUGH */ + case 'm': /* FALLTHROUGH */ + case 'A': /* FALLTHROUGH */ + case 'O': /* FALLTHROUGH */ + case '&': /* FALLTHROUGH */ + case '|': /* FALLTHROUGH */ + case '^': /* FALLTHROUGH */ + case '=': /* FALLTHROUGH */ + case '<': /* FALLTHROUGH */ + case '>': + pop(&val, NULL, &stack); + pop(&val2, NULL, &stack); + switch (c) { + case '+': + val = val + val2; + break; + case '-': + val = val2 - val; + break; + case '*': + val = val * val2; + break; + case '/': + val = val ? val2 / val : 0; + break; + case 'm': + val = val ? val2 % val : 0; + break; + case 'A': + val = val && val2; + break; + case 'O': + val = val || val2; + break; + case '&': + val = val & val2; + break; + case '|': + val = val | val2; + break; + case '^': + val = val ^ val2; + break; + case '=': + val = val == val2; + break; + case '<': + val = val2 < val; + break; + case '>': + val = val2 > val; + break; + } + if (push(val, NULL, &stack)) + return NULL; + break; + case '!': + case '~': + pop(&val, NULL, &stack); + switch (c) { + case '!': + val = !val; + break; + case '~': + val = ~val; + break; + } + if (push(val, NULL, &stack)) + return NULL; + break; + case '?': /* if */ + break; + case 't': /* then */ + pop(&val, NULL, &stack); + if (val == 0) { + l = 0; + for (; *str != '\0'; str++) { + if (*str != '%') + continue; + str++; + if (*str == '?') + l++; + else if (*str == ';') { + if (l > 0) + l--; + else { + str++; + break; + } + } else if (*str == 'e' && l == 0) { + str++; + break; + } + } + } + break; + case 'e': /* else */ + l = 0; + for (; *str != '\0'; str++) { + if (*str != '%') + continue; + str++; + if (*str == '?') + l++; + else if (*str == ';') { + if (l > 0) + l--; + else { + str++; + break; + } + } + } + break; + case ';': /* fi */ + break; + } + } + term->_buf[term->_bufpos] = '\0'; + return term->_buf; +} + +char * +ti_tiparm(TERMINAL *term, const char *str, ...) +{ + va_list va; + char *ret; + + _DIAGASSERT(term != NULL); + _DIAGASSERT(str != NULL); + + va_start(va, str); + ret = _ti_tiparm(term, str, VA_CHAR_INT, va); + va_end(va); + return ret; +} + +char * +tiparm(const char *str, ...) +{ + va_list va; + char *ret; + + _DIAGASSERT(str != NULL); + + va_start(va, str); + ret = _ti_tiparm(NULL, str, VA_CHAR_INT, va); + va_end(va); + return ret; +} + +#ifdef VA_CHAR_LONG +char * +ti_tlparm(TERMINAL *term, const char *str, ...) +{ + va_list va; + char *ret; + + _DIAGASSERT(term != NULL); + _DIAGASSERT(str != NULL); + + va_start(va, str); + ret = _ti_tiparm(term, str, VA_CHAR_LONG, va); + va_end(va); + return ret; +} + +char * +tlparm(const char *str, ...) +{ + va_list va; + char *ret; + + _DIAGASSERT(str != NULL); + + va_start(va, str); + ret = _ti_tiparm(NULL, str, VA_CHAR_LONG, va); + va_end(va); + return ret; +} +#endif + +static char * +_tparm(const char *str, ...) +{ + va_list va; + char *ret; + + _DIAGASSERT(str != NULL); + + va_start(va, str); + ret = _ti_tiparm(NULL, str, VA_LONG_LONG, va); + va_end(va); + return ret; +} + +char * +tparm(const char *str, + long p1, long p2, long p3, long p4, long p5, + long p6, long p7, long p8, long p9) +{ + + return _tparm(str, p1, p2, p3, p4, p5, p6, p7, p8, p9); +} diff --git a/vendor/netbsd-curses/libterminfo/tputs.3 b/vendor/netbsd-curses/libterminfo/tputs.3 new file mode 120000 index 0000000..1647dc7 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tputs.3 @@ -0,0 +1 @@ +terminfo.3 \ No newline at end of file diff --git a/vendor/netbsd-curses/libterminfo/tputs.c b/vendor/netbsd-curses/libterminfo/tputs.c new file mode 100644 index 0000000..d8e6f98 --- /dev/null +++ b/vendor/netbsd-curses/libterminfo/tputs.c @@ -0,0 +1,178 @@ +/* $NetBSD: tputs.c,v 1.5 2019/10/03 18:02:05 christos Exp $ */ + +/* + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include + +/* + * The following array gives the number of tens of milliseconds per + * character for each speed as returned by gtty. Thus since 300 + * baud returns a 7, there are 33.3 milliseconds per char at 300 baud. + */ +static const short tmspc10[] = { + 0, 2000, 1333, 909, 743, 666, 500, 333, 166, 83, 55, 41, 20, 10, 5 +}; + +short ospeed; +char PC; + +static int +_ti_calcdelay(const char **str, int affcnt, int *mand) +{ + int i; + + i = 0; + /* Convert the delay */ + while (isdigit(*(const unsigned char *)*str)) + i = i * 10 + *(*str)++ - '0'; + i *= 10; + if (*(*str) == '.') { + (*str)++; + if (isdigit(*(const unsigned char *)*str)) + i += *(*str) - '0'; + while (isdigit(*(const unsigned char *)*str)) + (*str)++; + } + if (*(*str) == '*') { + (*str)++; + i *= affcnt; + } else if (*(*str) == '/') { + (*str)++; + if (mand != NULL) + *mand = 1; + } + return i; +} + +static void +_ti_outputdelay(int delay, short os, char pc, + int (*outc)(int, void *), void *args) +{ + int mspc10; + + if (delay < 1 || os < 1 || (size_t)os >= __arraycount(tmspc10)) + return; + + mspc10 = tmspc10[os]; + delay += mspc10 / 2; + for (delay /= mspc10; delay > 0; delay--) + outc(pc, args); +} + +static int +_ti_puts(int dodelay, short os, char pc, + const char *str, int affcnt, int (*outc)(int, void *), void *args) +{ + int taildelay, delay, mand; + + if (str == NULL) + return OK; + + taildelay = _ti_calcdelay(&str, affcnt, NULL); + + /* Output the string with embedded delays */ + for (; *str != '\0'; str++) { + if (str[0] != '$' || + str[1] != '<' || + !(isdigit((const unsigned char)str[2]) || str[2] == '.') || + strchr(str + 3, '>') == NULL) + { + outc(*str, args); + } else { + str += 2; + mand = 0; + delay = _ti_calcdelay(&str, affcnt, &mand); + if (dodelay != 0 || mand != 0) + _ti_outputdelay(delay, os, pc, outc, args); + } + } + + /* Delay if needed */ + if (dodelay) + _ti_outputdelay(taildelay, os, pc, outc, args); + + return OK; +} + +int +ti_puts(const TERMINAL *term, const char *str, int affcnt, + int (*outc)(int, void *), void *args) +{ + int dodelay; + char pc; + + _DIAGASSERT(term != NULL); + _DIAGASSERT(str != NULL); + _DIAGASSERT(outc != NULL); + + dodelay = (str == t_bell(term) || + str == t_flash_screen(term) || + (t_xon_xoff(term) == 0 && t_padding_baud_rate(term) != 0)); + + if (t_pad_char(term) == NULL) + pc = '\0'; + else + pc = *t_pad_char(term); + return _ti_puts(dodelay, term->_ospeed, pc, + str, affcnt, outc, args); +} + +int +ti_putp(const TERMINAL *term, const char *str) +{ + + _DIAGASSERT(term != NULL); + _DIAGASSERT(str != NULL); + return ti_puts(term, str, 1, + (int (*)(int, void *))(void *)putchar, NULL); +} + +int +tputs(const char *str, int affcnt, int (*outc)(int)) +{ + + _DIAGASSERT(str != NULL); + _DIAGASSERT(outc != NULL); + return _ti_puts(1, ospeed, PC, str, affcnt, + (int (*)(int, void *))(void *)outc, NULL); +} + +int +putp(const char *str) +{ + + _DIAGASSERT(str != NULL); + return tputs(str, 1, putchar); +} diff --git a/vendor/netbsd-curses/nbperf/GNUmakefile b/vendor/netbsd-curses/nbperf/GNUmakefile new file mode 100644 index 0000000..53e1d0d --- /dev/null +++ b/vendor/netbsd-curses/nbperf/GNUmakefile @@ -0,0 +1,23 @@ +# $NetBSD: Makefile,v 1.1 2009/08/15 16:21:04 joerg Exp $ + +PROG= nbperf +SRCS= nbperf.c +SRCS+= nbperf-bdz.c nbperf-chm.c nbperf-chm3.c +SRCS+= graph2.c graph3.c +SRCS+= mi_vector_hash.c + +CPPFLAGS += -I.. + +OBJS = $(SRCS:.c=.o) + +all: $(PROG) + +clean: + rm -f $(OBJS) $(PROG) + +$(PROG): $(OBJS) + $(CC) $(LDFLAGS) $^ -o $@ + +%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $< + diff --git a/vendor/netbsd-curses/nbperf/Makefile b/vendor/netbsd-curses/nbperf/Makefile new file mode 100644 index 0000000..e777472 --- /dev/null +++ b/vendor/netbsd-curses/nbperf/Makefile @@ -0,0 +1,8 @@ +# $NetBSD: Makefile,v 1.1 2009/08/15 16:21:04 joerg Exp $ + +PROG= nbperf +SRCS= nbperf.c +SRCS+= nbperf-bdz.c nbperf-chm.c nbperf-chm3.c +SRCS+= graph2.c graph3.c + +.include diff --git a/vendor/netbsd-curses/nbperf/graph2.c b/vendor/netbsd-curses/nbperf/graph2.c new file mode 100644 index 0000000..e88ffa9 --- /dev/null +++ b/vendor/netbsd-curses/nbperf/graph2.c @@ -0,0 +1,210 @@ +/* $NetBSD: graph2.c,v 1.4 2011/10/21 23:47:11 joerg Exp $ */ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +#include +#include +#include +#include +#include + +#include "nbperf.h" +#include "graph2.h" + +static const uint32_t unused = 0xffffffffU; + +void +graph2_setup(struct graph2 *graph, uint32_t v, uint32_t e) +{ + graph->v = v; + graph->e = e; + + graph->verts = calloc(sizeof(struct vertex2), v); + graph->edges = calloc(sizeof(struct edge2), e); + graph->output_order = calloc(sizeof(uint32_t), e); + + if (graph->verts == NULL || graph->edges == NULL || + graph->output_order == NULL) + err(1, "malloc failed"); +} + +void +graph2_free(struct graph2 *graph) +{ + free(graph->verts); + free(graph->edges); + free(graph->output_order); + + graph->verts = NULL; + graph->edges = NULL; + graph->output_order = NULL; +} + +static int +graph2_check_duplicates(struct nbperf *nbperf, struct graph2 *graph) +{ + struct vertex2 *v; + struct edge2 *e, *e2; + uint32_t i, j; + + for (i = 0; i < graph->e; ++i) { + e = &graph->edges[i]; + v = &graph->verts[e->left]; + j = v->l_edge; + e2 = &graph->edges[j]; + for (;;) { + if (i < j && e->right == e2->right && + nbperf->keylens[i] == nbperf->keylens[j] && + memcmp(nbperf->keys[i], nbperf->keys[j], + nbperf->keylens[i]) == 0) { + nbperf->has_duplicates = 1; + return -1; + } + if (e2->l_next == unused) + break; + j = e2->l_next; + e2 = &graph->edges[j]; + } + } + return 0; +} + +int +graph2_hash(struct nbperf *nbperf, struct graph2 *graph) +{ + struct vertex2 *v; + uint32_t hashes[NBPERF_MAX_HASH_SIZE]; + size_t i; + + for (i = 0; i < graph->e; ++i) { + (*nbperf->compute_hash)(nbperf, + nbperf->keys[i], nbperf->keylens[i], hashes); + graph->edges[i].left = hashes[0] % graph->v; + graph->edges[i].right = hashes[1] % graph->v; + if (graph->edges[i].left == graph->edges[i].right) + return -1; + } + + for (i = 0; i < graph->v; ++i) { + graph->verts[i].l_edge = unused; + graph->verts[i].r_edge = unused; + } + + for (i = 0; i < graph->e; ++i) { + v = &graph->verts[graph->edges[i].left]; + if (v->l_edge != unused) + graph->edges[v->l_edge].l_prev = i; + graph->edges[i].l_next = v->l_edge; + graph->edges[i].l_prev = unused; + v->l_edge = i; + + v = &graph->verts[graph->edges[i].right]; + if (v->r_edge != unused) + graph->edges[v->r_edge].r_prev = i; + graph->edges[i].r_next = v->r_edge; + graph->edges[i].r_prev = unused; + v->r_edge = i; + } + + if (nbperf->first_round) { + nbperf->first_round = 0; + return graph2_check_duplicates(nbperf, graph); + } + + return 0; +} + +static void +graph2_remove_vertex(struct graph2 *graph, struct vertex2 *v) +{ + struct edge2 *e; + struct vertex2 *v2; + + for (;;) { + if (v->l_edge != unused && v->r_edge != unused) + break; + if (v->l_edge == unused && v->r_edge == unused) + break; + + if (v->l_edge != unused) { + e = &graph->edges[v->l_edge]; + if (e->l_next != unused) + break; + v->l_edge = unused; /* No other elements possible! */ + v2 = &graph->verts[e->right]; + if (e->r_prev == unused) + v2->r_edge = e->r_next; + else + graph->edges[e->r_prev].r_next = e->r_next; + if (e->r_next != unused) + graph->edges[e->r_next].r_prev = e->r_prev; + v = v2; + } else { + e = &graph->edges[v->r_edge]; + if (e->r_next != unused) + break; + v->r_edge = unused; /* No other elements possible! */ + v2 = &graph->verts[e->left]; + if (e->l_prev == unused) + v2->l_edge = e->l_next; + else + graph->edges[e->l_prev].l_next = e->l_next; + if (e->l_next != unused) + graph->edges[e->l_next].l_prev = e->l_prev; + v = v2; + } + + graph->output_order[--graph->output_index] = e - graph->edges; + } +} + +int +graph2_output_order(struct graph2 *graph) +{ + size_t i; + + graph->output_index = graph->e; + + for (i = 0; i < graph->v; ++i) + graph2_remove_vertex(graph, &graph->verts[i]); + + if (graph->output_index != 0) + return -1; + + return 0; +} diff --git a/vendor/netbsd-curses/nbperf/graph2.h b/vendor/netbsd-curses/nbperf/graph2.h new file mode 100644 index 0000000..29ba775 --- /dev/null +++ b/vendor/netbsd-curses/nbperf/graph2.h @@ -0,0 +1,63 @@ +/* $NetBSD: graph2.h,v 1.1 2009/08/15 16:21:05 joerg Exp $ */ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Implementation of common 2-graph routines: + * - build a 2-graph with hash-pairs as edges + * - check a 2-graph for acyclicness and compute an output order + */ + +struct vertex2 { + uint32_t l_edge, r_edge; +}; + +struct edge2 { + uint32_t left, right; + uint32_t l_prev, l_next; + uint32_t r_prev, r_next; +}; + +struct graph2 { + struct vertex2 *verts; + struct edge2 *edges; + uint32_t output_index; + uint32_t *output_order; + uint8_t *visited; + uint32_t e, v; +}; + +void graph2_setup(struct graph2 *, uint32_t, uint32_t); +void graph2_free(struct graph2 *); + +int graph2_hash(struct nbperf *, struct graph2 *); +int graph2_output_order(struct graph2 *graph); diff --git a/vendor/netbsd-curses/nbperf/graph3.c b/vendor/netbsd-curses/nbperf/graph3.c new file mode 100644 index 0000000..5fd058e --- /dev/null +++ b/vendor/netbsd-curses/nbperf/graph3.c @@ -0,0 +1,249 @@ +/* $NetBSD: graph3.c,v 1.4 2011/10/21 23:47:11 joerg Exp $ */ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +#include +#include +#include +#include +#include + +#include "nbperf.h" +#include "graph3.h" + +static const uint32_t unused = 0xffffffffU; + +void +graph3_setup(struct graph3 *graph, uint32_t v, uint32_t e) +{ + graph->v = v; + graph->e = e; + + graph->verts = calloc(sizeof(struct vertex3), v); + graph->edges = calloc(sizeof(struct edge3), e); + graph->output_order = calloc(sizeof(uint32_t), e); + + if (graph->verts == NULL || graph->edges == NULL || + graph->output_order == NULL) + err(1, "malloc failed"); +} + +void +graph3_free(struct graph3 *graph) +{ + free(graph->verts); + free(graph->edges); + free(graph->output_order); + + graph->verts = NULL; + graph->edges = NULL; + graph->output_order = NULL; +} + +static int +graph3_check_duplicates(struct nbperf *nbperf, struct graph3 *graph) +{ + struct vertex3 *v; + struct edge3 *e, *e2; + uint32_t i, j; + + for (i = 0; i < graph->e; ++i) { + e = &graph->edges[i]; + v = &graph->verts[e->left]; + j = v->l_edge; + e2 = &graph->edges[j]; + for (;;) { + if (i < j && e->middle == e2->middle && + e->right == e2->right && + nbperf->keylens[i] == nbperf->keylens[j] && + memcmp(nbperf->keys[i], nbperf->keys[j], + nbperf->keylens[i]) == 0) { + nbperf->has_duplicates = 1; + return -1; + } + if (e2->l_next == unused) + break; + j = e2->l_next; + e2 = &graph->edges[j]; + } + } + return 0; +} + +int +graph3_hash(struct nbperf *nbperf, struct graph3 *graph) +{ + struct vertex3 *v; + uint32_t hashes[NBPERF_MAX_HASH_SIZE]; + size_t i; + + for (i = 0; i < graph->e; ++i) { + (*nbperf->compute_hash)(nbperf, + nbperf->keys[i], nbperf->keylens[i], hashes); + graph->edges[i].left = hashes[0] % graph->v; + graph->edges[i].middle = hashes[1] % graph->v; + graph->edges[i].right = hashes[2] % graph->v; + if (graph->edges[i].left == graph->edges[i].middle) + return -1; + if (graph->edges[i].left == graph->edges[i].right) + return -1; + if (graph->edges[i].middle == graph->edges[i].right) + return -1; + } + + for (i = 0; i < graph->v; ++i) { + graph->verts[i].l_edge = unused; + graph->verts[i].m_edge = unused; + graph->verts[i].r_edge = unused; + } + + for (i = 0; i < graph->e; ++i) { + v = &graph->verts[graph->edges[i].left]; + if (v->l_edge != unused) + graph->edges[v->l_edge].l_prev = i; + graph->edges[i].l_next = v->l_edge; + graph->edges[i].l_prev = unused; + v->l_edge = i; + + v = &graph->verts[graph->edges[i].middle]; + if (v->m_edge != unused) + graph->edges[v->m_edge].m_prev = i; + graph->edges[i].m_next = v->m_edge; + graph->edges[i].m_prev = unused; + v->m_edge = i; + + v = &graph->verts[graph->edges[i].right]; + if (v->r_edge != unused) + graph->edges[v->r_edge].r_prev = i; + graph->edges[i].r_next = v->r_edge; + graph->edges[i].r_prev = unused; + v->r_edge = i; + } + + if (nbperf->first_round) { + nbperf->first_round = 0; + return graph3_check_duplicates(nbperf, graph); + } + + return 0; +} + +static void +graph3_remove_vertex(struct graph3 *graph, struct vertex3 *v) +{ + struct edge3 *e; + struct vertex3 *vl, *vm, *vr; + + if (v->l_edge != unused && v->m_edge != unused) + return; + if (v->l_edge != unused && v->r_edge != unused) + return; + if (v->m_edge != unused && v->r_edge != unused) + return; + if (v->l_edge == unused && v->m_edge == unused && v->r_edge == unused) + return; + + if (v->l_edge != unused) { + e = &graph->edges[v->l_edge]; + if (e->l_next != unused) + return; + } else if (v->m_edge != unused) { + e = &graph->edges[v->m_edge]; + if (e->m_next != unused) + return; + } else { + if (v->r_edge == unused) + abort(); + e = &graph->edges[v->r_edge]; + if (e->r_next != unused) + return; + } + + graph->output_order[--graph->output_index] = e - graph->edges; + + vl = &graph->verts[e->left]; + vm = &graph->verts[e->middle]; + vr = &graph->verts[e->right]; + + if (e->l_prev == unused) + vl->l_edge = e->l_next; + else + graph->edges[e->l_prev].l_next = e->l_next; + if (e->l_next != unused) + graph->edges[e->l_next].l_prev = e->l_prev; + + if (e->m_prev == unused) + vm->m_edge = e->m_next; + else + graph->edges[e->m_prev].m_next = e->m_next; + if (e->m_next != unused) + graph->edges[e->m_next].m_prev = e->m_prev; + + if (e->r_prev == unused) + vr->r_edge = e->r_next; + else + graph->edges[e->r_prev].r_next = e->r_next; + if (e->r_next != unused) + graph->edges[e->r_next].r_prev = e->r_prev; +} + +int +graph3_output_order(struct graph3 *graph) +{ + struct edge3 *e; + size_t i; + + graph->output_index = graph->e; + + for (i = 0; i < graph->v; ++i) + graph3_remove_vertex(graph, &graph->verts[i]); + + for (i = graph->e; i > 0 && i > graph->output_index;) { + --i; + e = &graph->edges[graph->output_order[i]]; + + graph3_remove_vertex(graph, &graph->verts[e->left]); + graph3_remove_vertex(graph, &graph->verts[e->middle]); + graph3_remove_vertex(graph, &graph->verts[e->right]); + } + + if (graph->output_index != 0) + return -1; + + return 0; +} diff --git a/vendor/netbsd-curses/nbperf/graph3.h b/vendor/netbsd-curses/nbperf/graph3.h new file mode 100644 index 0000000..ce6482d --- /dev/null +++ b/vendor/netbsd-curses/nbperf/graph3.h @@ -0,0 +1,62 @@ +/* $NetBSD: graph3.h,v 1.1 2009/08/15 16:21:05 joerg Exp $ */ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Implementation of common 3-graph routines: + * - build a 3-graph with hash-triple as edges + * - check a 3-graph for acyclicness and compute an output order + */ + +struct vertex3 { + uint32_t l_edge, m_edge, r_edge; +}; + +struct edge3 { + uint32_t left, middle, right; + uint32_t l_prev, m_prev, l_next; + uint32_t r_prev, m_next, r_next; +}; + +struct graph3 { + struct vertex3 *verts; + struct edge3 *edges; + uint32_t output_index; + uint32_t *output_order; + uint32_t e, v; +}; + +void graph3_setup(struct graph3 *, uint32_t, uint32_t); +void graph3_free(struct graph3 *); + +int graph3_hash(struct nbperf *, struct graph3 *); +int graph3_output_order(struct graph3 *); diff --git a/vendor/netbsd-curses/nbperf/mi_vector_hash.c b/vendor/netbsd-curses/nbperf/mi_vector_hash.c new file mode 120000 index 0000000..5c65ab7 --- /dev/null +++ b/vendor/netbsd-curses/nbperf/mi_vector_hash.c @@ -0,0 +1 @@ +../libterminfo/mi_vector_hash.c \ No newline at end of file diff --git a/vendor/netbsd-curses/nbperf/nbperf-bdz.c b/vendor/netbsd-curses/nbperf/nbperf-bdz.c new file mode 100644 index 0000000..8e519ac --- /dev/null +++ b/vendor/netbsd-curses/nbperf/nbperf-bdz.c @@ -0,0 +1,306 @@ +/* $NetBSD: nbperf-bdz.c,v 1.9 2014/04/30 21:04:58 joerg Exp $ */ +/*- + * Copyright (c) 2009, 2012 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +#include +#include +#include +#include +#include + +#include "nbperf.h" + +/* + * A full description of the algorithm can be found in: + * "Simple and Space-Efficient Minimal Perfect Hash Functions" + * by Botelho, Pagh and Ziviani, proceeedings of WADS 2007. + */ + +/* + * The algorithm is based on random, acyclic 3-graphs. + * + * Each edge in the represents a key. The vertices are the reminder of + * the hash function mod n. n = cm with c > 1.23. This ensures that + * an acyclic graph can be found with a very high probality. + * + * An acyclic graph has an edge order, where at least one vertex of + * each edge hasn't been seen before. It is declares the first unvisited + * vertex as authoritive for the edge and assigns a 2bit value to unvisited + * vertices, so that the sum of all vertices of the edge modulo 4 is + * the index of the authoritive vertex. + */ + +#include "graph3.h" + +struct state { + struct graph3 graph; + uint32_t *visited; + uint32_t *holes64k; + uint16_t *holes64; + uint8_t *g; + uint32_t *result_map; +}; + +static void +assign_nodes(struct state *state) +{ + struct edge3 *e; + size_t i, j; + uint32_t t, r, holes; + + for (i = 0; i < state->graph.v; ++i) + state->g[i] = 3; + + for (i = 0; i < state->graph.e; ++i) { + j = state->graph.output_order[i]; + e = &state->graph.edges[j]; + if (!state->visited[e->left]) { + r = 0; + t = e->left; + } else if (!state->visited[e->middle]) { + r = 1; + t = e->middle; + } else { + if (state->visited[e->right]) + abort(); + r = 2; + t = e->right; + } + + state->visited[t] = 2 + j; + if (state->visited[e->left] == 0) + state->visited[e->left] = 1; + if (state->visited[e->middle] == 0) + state->visited[e->middle] = 1; + if (state->visited[e->right] == 0) + state->visited[e->right] = 1; + + state->g[t] = (9 + r - state->g[e->left] - state->g[e->middle] + - state->g[e->right]) % 3; + } + + holes = 0; + for (i = 0; i < state->graph.v; ++i) { + if (i % 65536 == 0) + state->holes64k[i >> 16] = holes; + + if (i % 64 == 0) + state->holes64[i >> 6] = holes - state->holes64k[i >> 16]; + + if (state->visited[i] > 1) { + j = state->visited[i] - 2; + state->result_map[j] = i - holes; + } + + if (state->g[i] == 3) + ++holes; + } +} + +static void +print_hash(struct nbperf *nbperf, struct state *state) +{ + uint64_t sum; + size_t i; + + fprintf(nbperf->output, "#include \n"); + fprintf(nbperf->output, "#include \n\n"); + + fprintf(nbperf->output, "%suint32_t\n", + nbperf->static_hash ? "static " : ""); + fprintf(nbperf->output, + "%s(const void * __restrict key, size_t keylen)\n", + nbperf->hash_name); + fprintf(nbperf->output, "{\n"); + + fprintf(nbperf->output, + "\tstatic const uint64_t g1[%" PRId32 "] = {\n", + (state->graph.v + 63) / 64); + sum = 0; + for (i = 0; i < state->graph.v; ++i) { + sum |= ((uint64_t)state->g[i] & 1) << (i & 63); + if (i % 64 == 63) { + fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s", + (i / 64 % 2 == 0 ? "\t " : " "), + sum, + (i / 64 % 2 == 1 ? "\n" : "")); + sum = 0; + } + } + if (i % 64 != 0) { + fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s", + (i / 64 % 2 == 0 ? "\t " : " "), + sum, + (i / 64 % 2 == 1 ? "\n" : "")); + } + fprintf(nbperf->output, "%s\t};\n", (i % 2 ? "\n" : "")); + + fprintf(nbperf->output, + "\tstatic const uint64_t g2[%" PRId32 "] = {\n", + (state->graph.v + 63) / 64); + sum = 0; + for (i = 0; i < state->graph.v; ++i) { + sum |= (((uint64_t)state->g[i] & 2) >> 1) << (i & 63); + if (i % 64 == 63) { + fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s", + (i / 64 % 2 == 0 ? "\t " : " "), + sum, + (i / 64 % 2 == 1 ? "\n" : "")); + sum = 0; + } + } + if (i % 64 != 0) { + fprintf(nbperf->output, "%s0x%016" PRIx64 "ULL,%s", + (i / 64 % 2 == 0 ? "\t " : " "), + sum, + (i / 64 % 2 == 1 ? "\n" : "")); + } + fprintf(nbperf->output, "%s\t};\n", (i % 2 ? "\n" : "")); + + fprintf(nbperf->output, + "\tstatic const uint32_t holes64k[%" PRId32 "] = {\n", + (state->graph.v + 65535) / 65536); + for (i = 0; i < state->graph.v; i += 65536) + fprintf(nbperf->output, "%s0x%08" PRIx32 ",%s", + (i / 65536 % 4 == 0 ? "\t " : " "), + state->holes64k[i >> 16], + (i / 65536 % 4 == 3 ? "\n" : "")); + fprintf(nbperf->output, "%s\t};\n", (i / 65536 % 4 ? "\n" : "")); + + fprintf(nbperf->output, + "\tstatic const uint16_t holes64[%" PRId32 "] = {\n", + (state->graph.v + 63) / 64); + for (i = 0; i < state->graph.v; i += 64) + fprintf(nbperf->output, "%s0x%04" PRIx32 ",%s", + (i / 64 % 4 == 0 ? "\t " : " "), + state->holes64[i >> 6], + (i / 64 % 4 == 3 ? "\n" : "")); + fprintf(nbperf->output, "%s\t};\n", (i / 64 % 4 ? "\n" : "")); + + fprintf(nbperf->output, "\tuint64_t m;\n"); + fprintf(nbperf->output, "\tuint32_t idx, i, idx2;\n"); + fprintf(nbperf->output, "\tuint32_t h[%zu];\n\n", nbperf->hash_size); + + (*nbperf->print_hash)(nbperf, "\t", "key", "keylen", "h"); + + fprintf(nbperf->output, "\n\th[0] = h[0] %% %" PRIu32 ";\n", + state->graph.v); + fprintf(nbperf->output, "\th[1] = h[1] %% %" PRIu32 ";\n", + state->graph.v); + fprintf(nbperf->output, "\th[2] = h[2] %% %" PRIu32 ";\n", + state->graph.v); + + fprintf(nbperf->output, + "\tidx = 9 + ((g1[h[0] >> 6] >> (h[0] & 63)) &1)\n" + "\t + ((g1[h[1] >> 6] >> (h[1] & 63)) & 1)\n" + "\t + ((g1[h[2] >> 6] >> (h[2] & 63)) & 1)\n" + "\t - ((g2[h[0] >> 6] >> (h[0] & 63)) & 1)\n" + "\t - ((g2[h[1] >> 6] >> (h[1] & 63)) & 1)\n" + "\t - ((g2[h[2] >> 6] >> (h[2] & 63)) & 1);\n" + ); + + fprintf(nbperf->output, + "\tidx = h[idx %% 3];\n"); + fprintf(nbperf->output, + "\tidx2 = idx - holes64[idx >> 6] - holes64k[idx >> 16];\n" + "\tidx2 -= popcount64(g1[idx >> 6] & g2[idx >> 6]\n" + "\t & (((uint64_t)1 << (idx & 63)) - 1));\n" + "\treturn idx2;\n"); + + fprintf(nbperf->output, "}\n"); + + if (nbperf->map_output != NULL) { + for (i = 0; i < state->graph.e; ++i) + fprintf(nbperf->map_output, "%" PRIu32 "\n", + state->result_map[i]); + } +} + +int +bpz_compute(struct nbperf *nbperf) +{ + struct state state; + int retval = -1; + uint32_t v, e; + + if (nbperf->c == 0) + nbperf->c = 1.24; + if (nbperf->c < 1.24) + errx(1, "The argument for option -c must be at least 1.24"); + if (nbperf->hash_size < 3) + errx(1, "The hash function must generate at least 3 values"); + + (*nbperf->seed_hash)(nbperf); + e = nbperf->n; + v = nbperf->c * nbperf->n; + if (1.24 * nbperf->n > v) + ++v; + if (v < 10) + v = 10; + + graph3_setup(&state.graph, v, e); + + state.holes64k = calloc(sizeof(uint32_t), (v + 65535) / 65536); + state.holes64 = calloc(sizeof(uint16_t), (v + 63) / 64 ); + state.g = calloc(sizeof(uint32_t), v | 63); + state.visited = calloc(sizeof(uint32_t), v); + state.result_map = calloc(sizeof(uint32_t), e); + + if (state.holes64k == NULL || state.holes64 == NULL || + state.g == NULL || state.visited == NULL || + state.result_map == NULL) + err(1, "malloc failed"); + + if (graph3_hash(nbperf, &state.graph)) + goto failed; + if (graph3_output_order(&state.graph)) + goto failed; + assign_nodes(&state); + print_hash(nbperf, &state); + + retval = 0; + +failed: + graph3_free(&state.graph); + free(state.visited); + free(state.g); + free(state.holes64k); + free(state.holes64); + free(state.result_map); + return retval; +} diff --git a/vendor/netbsd-curses/nbperf/nbperf-chm.c b/vendor/netbsd-curses/nbperf/nbperf-chm.c new file mode 100644 index 0000000..b3a610d --- /dev/null +++ b/vendor/netbsd-curses/nbperf/nbperf-chm.c @@ -0,0 +1,271 @@ +/* $NetBSD: nbperf-chm.c,v 1.3 2011/10/21 23:47:11 joerg Exp $ */ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +#include +#include +#include +#include +#include + +#include "nbperf.h" + +#ifdef BUILD_CHM3 +#include "graph3.h" +#else +#include "graph2.h" +#endif + +/* + * A full description of the algorithm can be found in: + * "An optimal algorithm for generating minimal perfect hash functions" + * by Czech, Havas and Majewski in Information Processing Letters, + * 43(5):256-264, October 1992. + */ + +/* + * The algorithm is based on random, acyclic graphs. + * + * Each edge in the represents a key. The vertices are the reminder of + * the hash function mod n. n = cm with c > 2, otherwise the propability + * of finding an acyclic graph is very low (for 2-graphs). The constant + * for 3-graphs is 1.24. + * + * After the hashing phase, the graph is checked for cycles. + * A cycle-free graph is either empty or has a vertex of degree 1. + * Removing the edge for this vertex doesn't change this property, + * so applying this recursively reduces the size of the graph. + * If the graph is empty at the end of the process, it was acyclic. + * + * The assignment step now sets g[i] := 0 and processes the edges + * in reverse order of removal. That ensures that at least one vertex + * is always unvisited and can be assigned. + */ + +struct state { +#ifdef BUILD_CHM3 + struct graph3 graph; +#else + struct graph2 graph; +#endif + uint32_t *g; + uint8_t *visited; +}; + +static void +assign_nodes(struct state *state) +{ +#ifdef BUILD_CHM3 + struct edge3 *e; +#else + struct edge2 *e; +#endif + size_t i; + uint32_t e_idx; + + for (i = 0; i < state->graph.e; ++i) { + e_idx = state->graph.output_order[i]; + e = &state->graph.edges[e_idx]; + +#ifdef BUILD_CHM3 + if (!state->visited[e->left]) { + state->g[e->left] = (2 * state->graph.e + e_idx + - state->g[e->middle] - state->g[e->right]) + % state->graph.e; + } else if (!state->visited[e->middle]) { + state->g[e->middle] = (2 * state->graph.e + e_idx + - state->g[e->left] - state->g[e->right]) + % state->graph.e; + } else { + state->g[e->right] = (2 * state->graph.e + e_idx + - state->g[e->left] - state->g[e->middle]) + % state->graph.e; + } + state->visited[e->left] = 1; + state->visited[e->middle] = 1; + state->visited[e->right] = 1; +#else + if (!state->visited[e->left]) { + state->g[e->left] = (state->graph.e + e_idx + - state->g[e->right]) % state->graph.e; + } else { + state->g[e->right] = (state->graph.e + e_idx + - state->g[e->left]) % state->graph.e; + } + state->visited[e->left] = 1; + state->visited[e->right] = 1; +#endif + } +} + +static void +print_hash(struct nbperf *nbperf, struct state *state) +{ + uint32_t i, per_line; + const char *g_type; + int g_width; + + fprintf(nbperf->output, "#include \n\n"); + + fprintf(nbperf->output, "%suint32_t\n", + nbperf->static_hash ? "static " : ""); + fprintf(nbperf->output, + "%s(const void * __restrict key, size_t keylen)\n", + nbperf->hash_name); + fprintf(nbperf->output, "{\n"); + if (state->graph.v >= 65536) { + g_type = "uint32_t"; + g_width = 8; + per_line = 4; + } else if (state->graph.v >= 256) { + g_type = "uint16_t"; + g_width = 4; + per_line = 8; + } else { + g_type = "uint8_t"; + g_width = 2; + per_line = 10; + } + fprintf(nbperf->output, "\tstatic const %s g[%" PRId32 "] = {\n", + g_type, state->graph.v); + for (i = 0; i < state->graph.v; ++i) { + fprintf(nbperf->output, "%s0x%0*" PRIx32 ",%s", + (i % per_line == 0 ? "\t " : " "), + g_width, state->g[i], + (i % per_line == per_line - 1 ? "\n" : "")); + } + if (i % per_line != 0) + fprintf(nbperf->output, "\n\t};\n"); + else + fprintf(nbperf->output, "\t};\n"); + fprintf(nbperf->output, "\tuint32_t h[%zu];\n\n", nbperf->hash_size); + (*nbperf->print_hash)(nbperf, "\t", "key", "keylen", "h"); +#ifdef BUILD_CHM3 + fprintf(nbperf->output, "\treturn (g[h[0] %% %" PRIu32 "] + " + "g[h[1] %% %" PRIu32 "] + " + "g[h[2] %% %" PRIu32"]) %% %" PRIu32 ";\n", + state->graph.v, state->graph.v, state->graph.v, state->graph.e); +#else + fprintf(nbperf->output, "\treturn (g[h[0] %% %" PRIu32 "] + " + "g[h[1] %% %" PRIu32"]) %% %" PRIu32 ";\n", + state->graph.v, state->graph.v, state->graph.e); +#endif + fprintf(nbperf->output, "}\n"); + + if (nbperf->map_output != NULL) { + for (i = 0; i < state->graph.e; ++i) + fprintf(nbperf->map_output, "%" PRIu32 "\n", i); + } +} + +int +#ifdef BUILD_CHM3 +chm3_compute(struct nbperf *nbperf) +#else +chm_compute(struct nbperf *nbperf) +#endif +{ + struct state state; + int retval = -1; + uint32_t v, e; + +#ifdef BUILD_CHM3 + if (nbperf->c == 0) + nbperf-> c = 1.24; + + if (nbperf->c < 1.24) + errx(1, "The argument for option -c must be at least 1.24"); + + if (nbperf->hash_size < 3) + errx(1, "The hash function must generate at least 3 values"); +#else + if (nbperf->c == 0) + nbperf-> c = 2; + + if (nbperf->c < 2) + errx(1, "The argument for option -c must be at least 2"); + + if (nbperf->hash_size < 2) + errx(1, "The hash function must generate at least 2 values"); +#endif + + (*nbperf->seed_hash)(nbperf); + e = nbperf->n; + v = nbperf->c * nbperf->n; +#ifdef BUILD_CHM3 + if (v == 1.24 * nbperf->n) + ++v; + if (v < 10) + v = 10; +#else + if (v == 2 * nbperf->n) + ++v; +#endif + + state.g = calloc(sizeof(uint32_t), v); + state.visited = calloc(sizeof(uint8_t), v); + if (state.g == NULL || state.visited == NULL) + err(1, "malloc failed"); + +#ifdef BUILD_CHM3 + graph3_setup(&state.graph, v, e); + if (graph3_hash(nbperf, &state.graph)) + goto failed; + if (graph3_output_order(&state.graph)) + goto failed; +#else + graph2_setup(&state.graph, v, e); + if (graph2_hash(nbperf, &state.graph)) + goto failed; + if (graph2_output_order(&state.graph)) + goto failed; +#endif + assign_nodes(&state); + print_hash(nbperf, &state); + + retval = 0; + +failed: +#ifdef BUILD_CHM3 + graph3_free(&state.graph); +#else + graph2_free(&state.graph); +#endif + free(state.g); + free(state.visited); + return retval; +} diff --git a/vendor/netbsd-curses/nbperf/nbperf-chm3.c b/vendor/netbsd-curses/nbperf/nbperf-chm3.c new file mode 100644 index 0000000..d2a2ada --- /dev/null +++ b/vendor/netbsd-curses/nbperf/nbperf-chm3.c @@ -0,0 +1,4 @@ +/* $NetBSD: nbperf-chm3.c,v 1.1 2009/08/15 16:21:05 joerg Exp $ */ + +#define BUILD_CHM3 +#include "nbperf-chm.c" diff --git a/vendor/netbsd-curses/nbperf/nbperf.1 b/vendor/netbsd-curses/nbperf/nbperf.1 new file mode 100644 index 0000000..ebc2404 --- /dev/null +++ b/vendor/netbsd-curses/nbperf/nbperf.1 @@ -0,0 +1,143 @@ +.\" $NetBSD: nbperf.1,v 1.6 2013/01/31 16:32:02 joerg Exp $ +.\" +.\" Copyright (c) 2009 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Joerg Sonnenberger. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd September 25, 2012 +.Dt NBPERF 1 +.Os +.Sh NAME +.Nm nbperf +.Nd compute a perfect hash function +.Sh SYNOPSIS +.Nm +.Op Fl ps +.Op Fl a Ar algorithm +.Op Fl c Ar utilisation +.Op Fl h Ar hash +.Op Fl i Ar iterations +.Op Fl m Ar map-file +.Op Fl n Ar name +.Op Fl o Ar output +.Op Ar input +.Sh DESCRIPTION +.Nm +reads a number of keys one per line from standard input or +.Ar input . +It computes a minimal perfect hash function and writes it to stdout or +.Ar output . +The default algorithm is +.Qq Sy chm . +.Pp +The +.Fl m +argument instructs +.Nm +to write the resulting key mapping to +.Ar map-file . +Each line gives the result of the hash function for the corresponding input +key. +.Pp +The parameter +.Ar utilisation +determines the space efficiency. +.Pp +Supported arguments for +.Fl a : +.Bl -tag -width "chm" +.It Sy chm +This results in an order preserving minimal perfect hash function. +The +.Ar utilisation +must be at least 2, the default. +The number of iterations needed grows if the utilisation is very near to 2. +.It Sy chm3 +Similar to +.Ar chm . +The resulting hash function needs three instead of two table lookups when +compared to +.Ar chm . +The +.Ar utilisation +must be at least 1.24, the default. +This makes the output for +.Ar chm3 +noticable smaller than the output for +.Ar chm . +.It Sy bpz +This results in a non-order preserving minimal perfect hash function. +Output size is approximately 2.79 bit per key for the default value of +.Ar utilisation , +1.24. +This is also the smallest supported value. +.El +.Pp +Supported arguments for +.Fl h : +.Bl -tag -width "mi_vector_hash" +.It Sy mi_vector_hash +Platform-independent version of Jenkins parallel hash. +See +.Xr mi_vector_hash 3 . +.El +.Pp +The number of iterations can be limited with +.Fl i . +.Nm +outputs a function matching +.Ft uint32_t +.Fn hash "const void * restrict" "size_t" +to stdout. +The function expects the key length as second argument, for strings not +including the terminating NUL. +It is the responsibility of the caller to pass in only valid keys or compare +the resulting index to the key. +The function name can be changed using +.Fl n Ar name . +If the +.Fl s +flag is specified, it will be static. +.Pp +After each failing iteration, a dot is written to stderr. +.Pp +.Nm +checks for duplicate keys on the first iteration that passed +basic hash distribution tests. +In that case, an error message is printed and the program terminates. +.Pp +If the +.Fl p +flag is specified, the hash function is seeded in a stable way. +This may take longer than the normal random seed, but ensures +that the output is the same for repeated invocations as long as +the input is constant. +.Sh EXIT STATUS +.Ex -std +.Sh SEE ALSO +.Xr mi_vector_hash 3 +.Sh AUTHORS +.An J\(:org Sonnenberger diff --git a/vendor/netbsd-curses/nbperf/nbperf.c b/vendor/netbsd-curses/nbperf/nbperf.c new file mode 100644 index 0000000..ea7b6e9 --- /dev/null +++ b/vendor/netbsd-curses/nbperf/nbperf.c @@ -0,0 +1,265 @@ +/* $NetBSD: nbperf.c,v 1.5 2013/01/31 16:32:02 joerg Exp $ */ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#undef _GNU_SOURCE +#define _GNU_SOURCE +#undef _XOPEN_SOURCE +#define _XOPEN_SOURCE 700 + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "nbperf.h" +extern void mi_vector_hash(const void *restrict, size_t, uint32_t, uint32_t[3]); + +static int predictable; + +static __dead +void usage(char *a0) +{ + fprintf(stderr, + "%s [-ps] [-c utilisation] [-i iterations] [-n name] " + "[-o output] input\n", + a0); + exit(1); +} + +#if !defined(__NetBSD__) +#define arc4random() 0x4c957f2d +#endif + +static void +mi_vector_hash_seed_hash(struct nbperf *nbperf) +{ + static uint32_t predictable_counter; + if (predictable) + nbperf->seed[0] = predictable_counter++; + else + nbperf->seed[0] = arc4random(); +} + +static void +mi_vector_hash_compute(struct nbperf *nbperf, const void *key, size_t keylen, + uint32_t *hashes) +{ + mi_vector_hash(key, keylen, nbperf->seed[0], hashes); +} + +static void +mi_vector_hash_print_hash(struct nbperf *nbperf, const char *indent, + const char *key, const char *keylen, const char *hash) +{ + fprintf(nbperf->output, + "%smi_vector_hash(%s, %s, 0x%08" PRIx32 "U, %s);\n", + indent, key, keylen, nbperf->seed[0], hash); +} + +static void +set_hash(struct nbperf *nbperf, const char *arg) +{ + if (strcmp(arg, "mi_vector_hash") == 0) { + nbperf->hash_size = 3; + nbperf->seed_hash = mi_vector_hash_seed_hash; + nbperf->compute_hash = mi_vector_hash_compute; + nbperf->print_hash = mi_vector_hash_print_hash; + return; + } + if (nbperf->hash_size > NBPERF_MAX_HASH_SIZE) + errx(1, "Hash function creates too many output values"); + errx(1, "Unknown hash function: %s", arg); +} + +int +main(int argc, char **argv) +{ + struct nbperf nbperf = { + .c = 0, + .hash_name = "hash", + .map_output = NULL, + .output = NULL, + .static_hash = 0, + .first_round = 1, + .has_duplicates = 0, + }; + FILE *input; + size_t curlen = 0, curalloc = 0; + char *line, *eos; + ssize_t line_len; + size_t line_allocated; + const void **keys = NULL; + size_t *keylens = NULL; + uint32_t max_iterations = 0xffffffU; + long long tmp; + int looped, ch; + int (*build_hash)(struct nbperf *) = chm_compute; + + set_hash(&nbperf, "mi_vector_hash"); + + while ((ch = getopt(argc, argv, "a:c:h:i:m:n:o:ps")) != -1) { + switch (ch) { + case 'a': + /* Accept bdz as alias for netbsd-6 compat. */ + if (strcmp(optarg, "chm") == 0) + build_hash = chm_compute; + else if (strcmp(optarg, "chm3") == 0) + build_hash = chm3_compute; + else if (strcmp(optarg, "bpz") == 0 || + strcmp(optarg, "bdz") == 0) + build_hash = bpz_compute; + else + errx(1, "Unsupport algorithm: %s", optarg); + break; + case 'c': + errno = 0; + nbperf.c = strtod(optarg, &eos); + if (errno || eos[0] || !nbperf.c) + errx(2, "Invalid argument for -c"); + break; + case 'h': + set_hash(&nbperf, optarg); + break; + case 'i': + errno = 0; + tmp = strtoll(optarg, &eos, 0); + if (errno || eos == optarg || eos[0] || + tmp < 0 || tmp > 0xffffffffU) + errx(2, "Iteration count must be " + "a 32bit integer"); + max_iterations = (uint32_t)tmp; + break; + case 'm': + if (nbperf.map_output) + fclose(nbperf.map_output); + nbperf.map_output = fopen(optarg, "w"); + if (nbperf.map_output == NULL) + err(2, "cannot open map file"); + break; + case 'n': + nbperf.hash_name = optarg; + break; + case 'o': + if (nbperf.output) + fclose(nbperf.output); + nbperf.output = fopen(optarg, "w"); + if (nbperf.output == NULL) + err(2, "cannot open output file"); + break; + case 'p': + predictable = 1; + break; + case 's': + nbperf.static_hash = 1; + break; + default: + usage(argv[0]); + } + } + + argc -= optind; + argv += optind; + + if (argc > 1) + usage(argv[0]); + + if (argc == 1) { + input = fopen(argv[0], "r"); + if (input == NULL) + err(1, "can't open input file"); + } else + input = stdin; + + if (nbperf.output == NULL) + nbperf.output = stdout; + + line = NULL; + line_allocated = 0; + while ((line_len = getline(&line, &line_allocated, input)) != -1) { + if (line_len && line[line_len - 1] == '\n') + --line_len; + if (curlen == curalloc) { + if (curalloc < 256) + curalloc = 256; + else + curalloc += curalloc; + keys = realloc(keys, curalloc * sizeof(*keys)); + if (keys == NULL) + err(1, "realloc failed"); + keylens = realloc(keylens, + curalloc * sizeof(*keylens)); + if (keylens == NULL) + err(1, "realloc failed"); + } + if ((keys[curlen] = strndup(line, line_len)) == NULL) + err(1, "malloc failed"); + keylens[curlen] = line_len; + ++curlen; + } + free(line); + + if (input != stdin) + fclose(input); + + nbperf.n = curlen; + nbperf.keys = keys; + nbperf.keylens = keylens; + + looped = 0; + while ((*build_hash)(&nbperf)) { + if (nbperf.has_duplicates) + errx(1, "Duplicate keys detected"); + fputc('.', stderr); + looped = 1; + if (max_iterations == 0xffffffffU) + continue; + if (--max_iterations == 0) { + fputc('\n', stderr); + errx(1, "Iteration count reached"); + } + } + if (looped) + fputc('\n', stderr); + + return 0; +} diff --git a/vendor/netbsd-curses/nbperf/nbperf.h b/vendor/netbsd-curses/nbperf/nbperf.h new file mode 100644 index 0000000..413b8c3 --- /dev/null +++ b/vendor/netbsd-curses/nbperf/nbperf.h @@ -0,0 +1,59 @@ +/* $NetBSD: nbperf.h,v 1.4 2013/01/31 16:32:02 joerg Exp $ */ +/*- + * Copyright (c) 2009 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#define NBPERF_MAX_HASH_SIZE 3 + +struct nbperf { + FILE *output; + FILE *map_output; + const char *hash_name; + int static_hash; + size_t n; + const void * __restrict * keys; + const size_t *keylens; + int first_round, has_duplicates; + + double c; + + size_t hash_size; + void (*seed_hash)(struct nbperf *); + void (*print_hash)(struct nbperf *, const char *, const char *, const char *, + const char *); + void (*compute_hash)(struct nbperf *, const void *, size_t, + uint32_t *); + uint32_t seed[1]; +}; + +int chm_compute(struct nbperf *); +int chm3_compute(struct nbperf *); +int bpz_compute(struct nbperf *); diff --git a/vendor/netbsd-curses/netbsd_sys/cdbr.h b/vendor/netbsd-curses/netbsd_sys/cdbr.h new file mode 100644 index 0000000..09ed9b4 --- /dev/null +++ b/vendor/netbsd-curses/netbsd_sys/cdbr.h @@ -0,0 +1,64 @@ +/* $NetBSD: cdbr.h,v 1.1 2013/12/11 01:24:08 joerg Exp $ */ +/*- + * Copyright (c) 2010 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CDBR_H +#define _CDBR_H + +#include +#if defined(_KERNEL) || defined(_STANDALONE) +#include +#else +#include +#include +#endif + +#define CDBR_DEFAULT 0 + +struct cdbr; + +__BEGIN_DECLS + +#if !defined(_KERNEL) && !defined(_STANDALONE) +struct cdbr *cdbr_open(const char *, int); +#endif +struct cdbr *cdbr_open_mem(void *, size_t, int, + void (*)(void *, void *, size_t), void *); +uint32_t cdbr_entries(struct cdbr *); +int cdbr_get(struct cdbr *, uint32_t, const void **, size_t *); +int cdbr_find(struct cdbr *, const void *, size_t, + const void **, size_t *); +void cdbr_close(struct cdbr *); + +__END_DECLS + +#endif /* _CDBR_H */ diff --git a/vendor/netbsd-curses/netbsd_sys/cdefs.h b/vendor/netbsd-curses/netbsd_sys/cdefs.h new file mode 100644 index 0000000..67bc160 --- /dev/null +++ b/vendor/netbsd-curses/netbsd_sys/cdefs.h @@ -0,0 +1,72 @@ +#ifndef NETBSD_SYS_CDEFS_H +#define NETBSD_SYS_CDEFS_H + +#ifndef __RCSID +#define __RCSID(X) +#endif +#ifndef __BEGIN_DECLS +#define __BEGIN_DECLS +#define __END_DECLS +#endif +#ifndef __COPYRIGHT +#define __COPYRIGHT(X) +#endif + +#ifndef __printflike +#if __GNUC__ >= 3 +#define __printflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__printf__, fmtarg, firstvararg))) +#define __scanflike(fmtarg, firstvararg) \ + __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) +#else +#define __printflike(fmtarg, firstvararg) /* nothing */ +#define __scanflike(fmtarg, firstvararg) /* nothing */ +#endif +#endif + +#ifndef __warn_references +#define __warn_references(a, b) +#endif +#ifndef __P +#define __P(X) X +#endif +#ifndef __dead +#define __dead __attribute__((__noreturn__)) +#endif +#define __UNCONST(a) (void *)(intptr_t)(a) +# define __STRING(x) #x +#if 0 +#define __strong_alias(alias,sym) \ + __asm__(".global " __STRING(alias) " ; " __STRING(alias) \ + " = " __STRING(sym)) ; +#else +#undef myweak_alias +#define myweak_alias(old, new) \ + extern __typeof(old) new __attribute__((weak, alias(#old))) +#define __strong_alias(new, old) myweak_alias(old, new); +#endif +#ifndef _DIAGASSERT +#define _DIAGASSERT(x) +#endif +#ifndef __arraycount +#define __arraycount(a) (sizeof(a) / sizeof(*(a))) +#endif + +#if __GNUC__ >= 4 +# define __dso_public __attribute__((__visibility__("default"))) +# define __dso_hidden __attribute__((__visibility__("hidden"))) +#else +# define __dso_public +# define __dso_hidden +#endif +#if defined(__predict_true) +#elif __GNUC__ >= 3 +#define __predict_true(exp) __builtin_expect((exp) != 0, 1) +#define __predict_false(exp) __builtin_expect((exp) != 0, 0) +#else +#define __predict_true(exp) (exp) +#define __predict_false(exp) (exp) +#endif + +#endif + diff --git a/vendor/netbsd-curses/netbsd_sys/emalloc.h b/vendor/netbsd-curses/netbsd_sys/emalloc.h new file mode 100644 index 0000000..a298b84 --- /dev/null +++ b/vendor/netbsd-curses/netbsd_sys/emalloc.h @@ -0,0 +1,48 @@ +#ifndef EMALLOC_H +#define EMALLOC_H + +/* replacement functions for emalloc() and friends used in netbsd code */ + +#undef _GNU_SOURCE +#define _GNU_SOURCE +#include +#include +#include +#include + +static void mallerr(void) { + dprintf(2, "error: out of memory\n"); + abort(); +} +static inline void* emalloc(size_t x) { + void *p=malloc(x); + if(!p) mallerr(); + return p; +} +static inline void* ecalloc(size_t x, size_t y) { + void *p=calloc(x, y); + if(!p) mallerr(); + return p; +} +static inline void* erealloc(void *x, size_t y) { + void *p=realloc(x, y); + if(!p) mallerr(); + return p; +} +static inline char* estrdup(const char* x) { + char *p = strdup(x); + if(!p) mallerr(); + return p; +} +static int easprintf(char **s, const char *fmt, ...) { + int ret; + va_list ap; + va_start(ap, fmt); + ret = vasprintf(s, fmt, ap); + va_end(ap); + if(ret == -1) mallerr(); + return ret; +} + +#endif + diff --git a/vendor/netbsd-curses/netbsd_sys/endian.h b/vendor/netbsd-curses/netbsd_sys/endian.h new file mode 100644 index 0000000..012869d --- /dev/null +++ b/vendor/netbsd-curses/netbsd_sys/endian.h @@ -0,0 +1,71 @@ +#ifndef NETBSD_SYS_ENDIAN_H +#define NETBSD_SYS_ENDIAN_H + +#if defined(__BYTE_ORDER__) +#undef __BYTE_ORDER +#define __BYTE_ORDER __BYTE_ORDER__ +#undef __LITTLE_ENDIAN +#define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__ +#else +#include +#endif +#if __LITTLE_ENDIAN+0 != 1234 +#error erroneus __LITTLE_ENDIAN macro +#endif +#include + +#ifndef le32toh +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define le32toh(x) (uint32_t)(x) +#define le16toh(x) (uint16_t)(x) +#else +static __inline uint32_t nbs_bswap32(uint32_t __x) +{ + return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24; +} +static __inline uint16_t nbs_bswap16(uint16_t __x) +{ + return __x<<8 | __x>>8; +} +#define le32toh(x) nbs_bswap32(x) +#define le16toh(x) nbs_bswap16(x) +#endif +#endif + +#define __CAST(__dt, __st) ((__dt)(__st)) +static inline uint16_t +le16dec(const void *buf) +{ + const uint8_t *p = __CAST(const uint8_t *, buf); + + return (p[0] | (__CAST(uint16_t, p[1]) << 8)); +} + +static inline uint32_t +le32dec(const void *buf) +{ + const uint8_t *p = __CAST(const uint8_t *, buf); + + return (le16dec(p) | (__CAST(uint32_t, le16dec(p + 2)) << 16)); +} +static inline void +le16enc(void *buf, uint16_t u) +{ + uint8_t *p = __CAST(uint8_t *, buf); + + p[0] = __CAST(uint8_t, (u & 0xff)); + p[1] = __CAST(uint8_t, ((__CAST(unsigned, u) >> 8) & 0xff)); +} +static inline void +le32enc(void *buf, uint32_t u) +{ + uint8_t *p = __CAST(uint8_t *, buf); + + p[0] = __CAST(uint8_t, (u & 0xff)); + p[1] = __CAST(uint8_t, ((u >> 8) & 0xff)); + p[2] = __CAST(uint8_t, ((u >> 16) & 0xff)); + p[3] = __CAST(uint8_t, ((u >> 24) & 0xff)); +} + +#endif + diff --git a/vendor/netbsd-curses/netbsd_sys/queue.h b/vendor/netbsd-curses/netbsd_sys/queue.h new file mode 100644 index 0000000..a38499a --- /dev/null +++ b/vendor/netbsd-curses/netbsd_sys/queue.h @@ -0,0 +1,846 @@ +/* $NetBSD: queue.h,v 1.70 2015/11/02 15:21:23 christos Exp $ */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +/* + * This file defines five types of data structures: singly-linked lists, + * lists, simple queues, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The + * elements are singly linked for minimum space and pointer manipulation + * overhead at the expense of O(n) removal for arbitrary elements. New + * elements can be added to the list after an existing element or at the + * head of the list. Elements being removed from the head of the list + * should use the explicit macro for this purpose for optimum + * efficiency. A singly-linked list may only be traversed in the forward + * direction. Singly-linked lists are ideal for applications with large + * datasets and few or no removals or for implementing a LIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A simple queue is headed by a pair of pointers, one the head of the + * list and the other to the tail of the list. The elements are singly + * linked to save space, so elements can only be removed from the + * head of the list. New elements can be added to the list after + * an existing element, at the head of the list, or at the end of the + * list. A simple queue may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * A circle queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or after + * an existing element, at the head of the list, or at the end of the list. + * A circle queue may be traversed in either direction, but has a more + * complex end of list detection. + * + * For details on the use of these macros, see the queue(3) manual page. + */ + +/* + * Include the definition of NULL only on NetBSD because sys/null.h + * is not available elsewhere. This conditional makes the header + * portable and it can simply be dropped verbatim into any system. + * The caveat is that on other systems some other header + * must provide NULL before the macros can be used. + */ +#ifdef __NetBSD__ +#include +#endif + +#if defined(QUEUEDEBUG) +# if defined(_KERNEL) +# define QUEUEDEBUG_ABORT(...) panic(__VA_ARGS__) +# else +# include +# define QUEUEDEBUG_ABORT(...) err(1, __VA_ARGS__) +# endif +#endif + +/* + * Singly-linked List definitions. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List access methods. + */ +#define SLIST_FIRST(head) ((head)->slh_first) +#define SLIST_END(head) NULL +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + +#define SLIST_FOREACH(var, head, field) \ + for((var) = (head)->slh_first; \ + (var) != SLIST_END(head); \ + (var) = (var)->field.sle_next) + +#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = SLIST_FIRST((head)); \ + (var) != SLIST_END(head) && \ + ((tvar) = SLIST_NEXT((var), field), 1); \ + (var) = (tvar)) + +/* + * Singly-linked List functions. + */ +#define SLIST_INIT(head) do { \ + (head)->slh_first = SLIST_END(head); \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + (elm)->field.sle_next = (slistelm)->field.sle_next; \ + (slistelm)->field.sle_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.sle_next = (head)->slh_first; \ + (head)->slh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE_AFTER(slistelm, field) do { \ + (slistelm)->field.sle_next = \ + SLIST_NEXT(SLIST_NEXT((slistelm), field), field); \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + (head)->slh_first = (head)->slh_first->field.sle_next; \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if ((head)->slh_first == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = (head)->slh_first; \ + while(curelm->field.sle_next != (elm)) \ + curelm = curelm->field.sle_next; \ + curelm->field.sle_next = \ + curelm->field.sle_next->field.sle_next; \ + } \ +} while (/*CONSTCOND*/0) + + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List access methods. + */ +#define LIST_FIRST(head) ((head)->lh_first) +#define LIST_END(head) NULL +#define LIST_EMPTY(head) ((head)->lh_first == LIST_END(head)) +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + +#define LIST_FOREACH(var, head, field) \ + for ((var) = ((head)->lh_first); \ + (var) != LIST_END(head); \ + (var) = ((var)->field.le_next)) + +#define LIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = LIST_FIRST((head)); \ + (var) != LIST_END(head) && \ + ((tvar) = LIST_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define LIST_MOVE(head1, head2) do { \ + LIST_INIT((head2)); \ + if (!LIST_EMPTY((head1))) { \ + (head2)->lh_first = (head1)->lh_first; \ + LIST_INIT((head1)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * List functions. + */ +#if defined(QUEUEDEBUG) +#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \ + if ((head)->lh_first && \ + (head)->lh_first->field.le_prev != &(head)->lh_first) \ + QUEUEDEBUG_ABORT("LIST_INSERT_HEAD %p %s:%d", (head), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_LIST_OP(elm, field) \ + if ((elm)->field.le_next && \ + (elm)->field.le_next->field.le_prev != \ + &(elm)->field.le_next) \ + QUEUEDEBUG_ABORT("LIST_* forw %p %s:%d", (elm), \ + __FILE__, __LINE__); \ + if (*(elm)->field.le_prev != (elm)) \ + QUEUEDEBUG_ABORT("LIST_* back %p %s:%d", (elm), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) \ + (elm)->field.le_next = (void *)1L; \ + (elm)->field.le_prev = (void *)1L; +#else +#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) +#define QUEUEDEBUG_LIST_OP(elm, field) +#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) +#endif + +#define LIST_INIT(head) do { \ + (head)->lh_first = LIST_END(head); \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + QUEUEDEBUG_LIST_OP((listelm), field) \ + if (((elm)->field.le_next = (listelm)->field.le_next) != \ + LIST_END(head)) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + QUEUEDEBUG_LIST_OP((listelm), field) \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + (elm)->field.le_next = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &(elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \ + if (((elm)->field.le_next = (head)->lh_first) != LIST_END(head))\ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (/*CONSTCOND*/0) + +#define LIST_REMOVE(elm, field) do { \ + QUEUEDEBUG_LIST_OP((elm), field) \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ + QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \ +} while (/*CONSTCOND*/0) + +#define LIST_REPLACE(elm, elm2, field) do { \ + if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \ + (elm2)->field.le_next->field.le_prev = \ + &(elm2)->field.le_next; \ + (elm2)->field.le_prev = (elm)->field.le_prev; \ + *(elm2)->field.le_prev = (elm2); \ + QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \ +} while (/*CONSTCOND*/0) + +/* + * Simple queue definitions. + */ +#define SIMPLEQ_HEAD(name, type) \ +struct name { \ + struct type *sqh_first; /* first element */ \ + struct type **sqh_last; /* addr of last next element */ \ +} + +#define SIMPLEQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).sqh_first } + +#define SIMPLEQ_ENTRY(type) \ +struct { \ + struct type *sqe_next; /* next element */ \ +} + +/* + * Simple queue access methods. + */ +#define SIMPLEQ_FIRST(head) ((head)->sqh_first) +#define SIMPLEQ_END(head) NULL +#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == SIMPLEQ_END(head)) +#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) + +#define SIMPLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->sqh_first); \ + (var) != SIMPLEQ_END(head); \ + (var) = ((var)->field.sqe_next)) + +#define SIMPLEQ_FOREACH_SAFE(var, head, field, next) \ + for ((var) = ((head)->sqh_first); \ + (var) != SIMPLEQ_END(head) && \ + ((next = ((var)->field.sqe_next)), 1); \ + (var) = (next)) + +/* + * Simple queue functions. + */ +#define SIMPLEQ_INIT(head) do { \ + (head)->sqh_first = NULL; \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (head)->sqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.sqe_next = NULL; \ + *(head)->sqh_last = (elm); \ + (head)->sqh_last = &(elm)->field.sqe_next; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (listelm)->field.sqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ + if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \ + if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \ + == NULL) \ + (head)->sqh_last = &(elm)->field.sqe_next; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ + if ((head)->sqh_first == (elm)) { \ + SIMPLEQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->sqh_first; \ + while (curelm->field.sqe_next != (elm)) \ + curelm = curelm->field.sqe_next; \ + if ((curelm->field.sqe_next = \ + curelm->field.sqe_next->field.sqe_next) == NULL) \ + (head)->sqh_last = &(curelm)->field.sqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_CONCAT(head1, head2) do { \ + if (!SIMPLEQ_EMPTY((head2))) { \ + *(head1)->sqh_last = (head2)->sqh_first; \ + (head1)->sqh_last = (head2)->sqh_last; \ + SIMPLEQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_LAST(head, type, field) \ + (SIMPLEQ_EMPTY((head)) ? \ + NULL : \ + ((struct type *)(void *) \ + ((char *)((head)->sqh_last) - offsetof(struct type, field)))) + +/* + * Tail queue definitions. + */ +#define _TAILQ_HEAD(name, type, qual) \ +struct name { \ + qual type *tqh_first; /* first element */ \ + qual type *qual *tqh_last; /* addr of last next element */ \ +} +#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) + +#define TAILQ_HEAD_INITIALIZER(head) \ + { TAILQ_END(head), &(head).tqh_first } + +#define _TAILQ_ENTRY(type, qual) \ +struct { \ + qual type *tqe_next; /* next element */ \ + qual type *qual *tqe_prev; /* address of previous next element */\ +} +#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) + +/* + * Tail queue access methods. + */ +#define TAILQ_FIRST(head) ((head)->tqh_first) +#define TAILQ_END(head) (NULL) +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)(void *)((head)->tqh_last))->tqh_last)) +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)(void *)((elm)->field.tqe_prev))->tqh_last)) +#define TAILQ_EMPTY(head) (TAILQ_FIRST(head) == TAILQ_END(head)) + + +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->tqh_first); \ + (var) != TAILQ_END(head); \ + (var) = ((var)->field.tqe_next)) + +#define TAILQ_FOREACH_SAFE(var, head, field, next) \ + for ((var) = ((head)->tqh_first); \ + (var) != TAILQ_END(head) && \ + ((next) = TAILQ_NEXT(var, field), 1); (var) = (next)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = TAILQ_LAST((head), headname); \ + (var) != TAILQ_END(head); \ + (var) = TAILQ_PREV((var), headname, field)) + +#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \ + for ((var) = TAILQ_LAST((head), headname); \ + (var) != TAILQ_END(head) && \ + ((prev) = TAILQ_PREV((var), headname, field), 1); (var) = (prev)) + +/* + * Tail queue functions. + */ +#if defined(QUEUEDEBUG) +#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \ + if ((head)->tqh_first && \ + (head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \ + QUEUEDEBUG_ABORT("TAILQ_INSERT_HEAD %p %s:%d", (head), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \ + if (*(head)->tqh_last != NULL) \ + QUEUEDEBUG_ABORT("TAILQ_INSERT_TAIL %p %s:%d", (head), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_TAILQ_OP(elm, field) \ + if ((elm)->field.tqe_next && \ + (elm)->field.tqe_next->field.tqe_prev != \ + &(elm)->field.tqe_next) \ + QUEUEDEBUG_ABORT("TAILQ_* forw %p %s:%d", (elm), \ + __FILE__, __LINE__); \ + if (*(elm)->field.tqe_prev != (elm)) \ + QUEUEDEBUG_ABORT("TAILQ_* back %p %s:%d", (elm), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) \ + if ((elm)->field.tqe_next == NULL && \ + (head)->tqh_last != &(elm)->field.tqe_next) \ + QUEUEDEBUG_ABORT("TAILQ_PREREMOVE head %p elm %p %s:%d",\ + (head), (elm), __FILE__, __LINE__); +#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) \ + (elm)->field.tqe_next = (void *)1L; \ + (elm)->field.tqe_prev = (void *)1L; +#else +#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) +#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) +#define QUEUEDEBUG_TAILQ_OP(elm, field) +#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) +#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) +#endif + +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = TAILQ_END(head); \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \ + if (((elm)->field.tqe_next = (head)->tqh_first) != TAILQ_END(head))\ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \ + (elm)->field.tqe_next = TAILQ_END(head); \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + QUEUEDEBUG_TAILQ_OP((listelm), field) \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != \ + TAILQ_END(head)) \ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + QUEUEDEBUG_TAILQ_OP((listelm), field) \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_REMOVE(head, elm, field) do { \ + QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \ + QUEUEDEBUG_TAILQ_OP((elm), field) \ + if (((elm)->field.tqe_next) != TAILQ_END(head)) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ + QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \ +} while (/*CONSTCOND*/0) + +#define TAILQ_REPLACE(head, elm, elm2, field) do { \ + if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != \ + TAILQ_END(head)) \ + (elm2)->field.tqe_next->field.tqe_prev = \ + &(elm2)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm2)->field.tqe_next; \ + (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ + *(elm2)->field.tqe_prev = (elm2); \ + QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \ +} while (/*CONSTCOND*/0) + +#define TAILQ_CONCAT(head1, head2, field) do { \ + if (!TAILQ_EMPTY(head2)) { \ + *(head1)->tqh_last = (head2)->tqh_first; \ + (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ + (head1)->tqh_last = (head2)->tqh_last; \ + TAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * Singly-linked Tail queue declarations. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first; /* first element */ \ + struct type **stqh_last; /* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue access methods. + */ +#define STAILQ_FIRST(head) ((head)->stqh_first) +#define STAILQ_END(head) NULL +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) +#define STAILQ_EMPTY(head) (STAILQ_FIRST(head) == STAILQ_END(head)) + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_INIT(head) do { \ + (head)->stqh_first = NULL; \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (head)->stqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.stqe_next = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &(elm)->field.stqe_next; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (listelm)->field.stqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if ((head)->stqh_first == (elm)) { \ + STAILQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->stqh_first; \ + while (curelm->field.stqe_next != (elm)) \ + curelm = curelm->field.stqe_next; \ + if ((curelm->field.stqe_next = \ + curelm->field.stqe_next->field.stqe_next) == NULL) \ + (head)->stqh_last = &(curelm)->field.stqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define STAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->stqh_first); \ + (var); \ + (var) = ((var)->field.stqe_next)) + +#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = STAILQ_FIRST((head)); \ + (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define STAILQ_CONCAT(head1, head2) do { \ + if (!STAILQ_EMPTY((head2))) { \ + *(head1)->stqh_last = (head2)->stqh_first; \ + (head1)->stqh_last = (head2)->stqh_last; \ + STAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +#define STAILQ_LAST(head, type, field) \ + (STAILQ_EMPTY((head)) ? \ + NULL : \ + ((struct type *)(void *) \ + ((char *)((head)->stqh_last) - offsetof(struct type, field)))) + + +#ifndef _KERNEL +/* + * Circular queue definitions. Do not use. We still keep the macros + * for compatibility but because of pointer aliasing issues their use + * is discouraged! + */ + +/* + * __launder_type(): We use this ugly hack to work around the the compiler + * noticing that two types may not alias each other and elide tests in code. + * We hit this in the CIRCLEQ macros when comparing 'struct name *' and + * 'struct type *' (see CIRCLEQ_HEAD()). Modern compilers (such as GCC + * 4.8) declare these comparisons as always false, causing the code to + * not run as designed. + * + * This hack is only to be used for comparisons and thus can be fully const. + * Do not use for assignment. + * + * If we ever choose to change the ABI of the CIRCLEQ macros, we could fix + * this by changing the head/tail sentinal values, but see the note above + * this one. + */ +static __inline const void * __launder_type(const void *); +static __inline const void * +__launder_type(const void *__x) +{ + __asm __volatile("" : "+r" (__x)); + return __x; +} + +#if defined(QUEUEDEBUG) +#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) \ + if ((head)->cqh_first != CIRCLEQ_ENDC(head) && \ + (head)->cqh_first->field.cqe_prev != CIRCLEQ_ENDC(head)) \ + QUEUEDEBUG_ABORT("CIRCLEQ head forw %p %s:%d", (head), \ + __FILE__, __LINE__); \ + if ((head)->cqh_last != CIRCLEQ_ENDC(head) && \ + (head)->cqh_last->field.cqe_next != CIRCLEQ_ENDC(head)) \ + QUEUEDEBUG_ABORT("CIRCLEQ head back %p %s:%d", (head), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) \ + if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) { \ + if ((head)->cqh_last != (elm)) \ + QUEUEDEBUG_ABORT("CIRCLEQ elm last %p %s:%d", \ + (elm), __FILE__, __LINE__); \ + } else { \ + if ((elm)->field.cqe_next->field.cqe_prev != (elm)) \ + QUEUEDEBUG_ABORT("CIRCLEQ elm forw %p %s:%d", \ + (elm), __FILE__, __LINE__); \ + } \ + if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) { \ + if ((head)->cqh_first != (elm)) \ + QUEUEDEBUG_ABORT("CIRCLEQ elm first %p %s:%d", \ + (elm), __FILE__, __LINE__); \ + } else { \ + if ((elm)->field.cqe_prev->field.cqe_next != (elm)) \ + QUEUEDEBUG_ABORT("CIRCLEQ elm prev %p %s:%d", \ + (elm), __FILE__, __LINE__); \ + } +#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) \ + (elm)->field.cqe_next = (void *)1L; \ + (elm)->field.cqe_prev = (void *)1L; +#else +#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field) +#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field) +#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field) +#endif + +#define CIRCLEQ_HEAD(name, type) \ +struct name { \ + struct type *cqh_first; /* first element */ \ + struct type *cqh_last; /* last element */ \ +} + +#define CIRCLEQ_HEAD_INITIALIZER(head) \ + { CIRCLEQ_END(&head), CIRCLEQ_END(&head) } + +#define CIRCLEQ_ENTRY(type) \ +struct { \ + struct type *cqe_next; /* next element */ \ + struct type *cqe_prev; /* previous element */ \ +} + +/* + * Circular queue functions. + */ +#define CIRCLEQ_INIT(head) do { \ + (head)->cqh_first = CIRCLEQ_END(head); \ + (head)->cqh_last = CIRCLEQ_END(head); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ + QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \ + (elm)->field.cqe_next = (listelm)->field.cqe_next; \ + (elm)->field.cqe_prev = (listelm); \ + if ((listelm)->field.cqe_next == CIRCLEQ_ENDC(head)) \ + (head)->cqh_last = (elm); \ + else \ + (listelm)->field.cqe_next->field.cqe_prev = (elm); \ + (listelm)->field.cqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ + QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ + QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field) \ + (elm)->field.cqe_next = (listelm); \ + (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ + if ((listelm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \ + (head)->cqh_first = (elm); \ + else \ + (listelm)->field.cqe_prev->field.cqe_next = (elm); \ + (listelm)->field.cqe_prev = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ + QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ + (elm)->field.cqe_next = (head)->cqh_first; \ + (elm)->field.cqe_prev = CIRCLEQ_END(head); \ + if ((head)->cqh_last == CIRCLEQ_ENDC(head)) \ + (head)->cqh_last = (elm); \ + else \ + (head)->cqh_first->field.cqe_prev = (elm); \ + (head)->cqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ + QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ + (elm)->field.cqe_next = CIRCLEQ_END(head); \ + (elm)->field.cqe_prev = (head)->cqh_last; \ + if ((head)->cqh_first == CIRCLEQ_ENDC(head)) \ + (head)->cqh_first = (elm); \ + else \ + (head)->cqh_last->field.cqe_next = (elm); \ + (head)->cqh_last = (elm); \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_REMOVE(head, elm, field) do { \ + QUEUEDEBUG_CIRCLEQ_HEAD((head), field) \ + QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field) \ + if ((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \ + (head)->cqh_last = (elm)->field.cqe_prev; \ + else \ + (elm)->field.cqe_next->field.cqe_prev = \ + (elm)->field.cqe_prev; \ + if ((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \ + (head)->cqh_first = (elm)->field.cqe_next; \ + else \ + (elm)->field.cqe_prev->field.cqe_next = \ + (elm)->field.cqe_next; \ + QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field) \ +} while (/*CONSTCOND*/0) + +#define CIRCLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->cqh_first); \ + (var) != CIRCLEQ_ENDC(head); \ + (var) = ((var)->field.cqe_next)) + +#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = ((head)->cqh_last); \ + (var) != CIRCLEQ_ENDC(head); \ + (var) = ((var)->field.cqe_prev)) + +/* + * Circular queue access methods. + */ +#define CIRCLEQ_FIRST(head) ((head)->cqh_first) +#define CIRCLEQ_LAST(head) ((head)->cqh_last) +/* For comparisons */ +#define CIRCLEQ_ENDC(head) (__launder_type(head)) +/* For assignments */ +#define CIRCLEQ_END(head) ((void *)(head)) +#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) +#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) +#define CIRCLEQ_EMPTY(head) \ + (CIRCLEQ_FIRST(head) == CIRCLEQ_ENDC(head)) + +#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ + (((elm)->field.cqe_next == CIRCLEQ_ENDC(head)) \ + ? ((head)->cqh_first) \ + : (elm->field.cqe_next)) +#define CIRCLEQ_LOOP_PREV(head, elm, field) \ + (((elm)->field.cqe_prev == CIRCLEQ_ENDC(head)) \ + ? ((head)->cqh_last) \ + : (elm->field.cqe_prev)) +#endif /* !_KERNEL */ + +#endif /* !_SYS_QUEUE_H_ */ diff --git a/vendor/netbsd-curses/tabs/Makefile b/vendor/netbsd-curses/tabs/Makefile new file mode 100644 index 0000000..8b4d911 --- /dev/null +++ b/vendor/netbsd-curses/tabs/Makefile @@ -0,0 +1,7 @@ +# $NetBSD: Makefile,v 1.3 2010/02/03 15:34:46 roy Exp $ + +PROG= tabs +DPADD= ${LIBTERMINFO} +LDADD= -lterminfo + +.include diff --git a/vendor/netbsd-curses/tabs/tabs.1 b/vendor/netbsd-curses/tabs/tabs.1 new file mode 100644 index 0000000..e88b29a --- /dev/null +++ b/vendor/netbsd-curses/tabs/tabs.1 @@ -0,0 +1,166 @@ +.\" $NetBSD: tabs.1,v 1.6 2014/03/18 18:20:45 riastradh Exp $ +.\" +.\" Copyright (c) 2008 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Roy Marples. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd April 5, 2012 +.Dt TABS 1 +.Os +.Sh NAME +.Nm tabs +.Nd set terminal tabs +.Sh SYNOPSIS +.Nm +.Op Fl n Ns | Ns Fl a Ns | Ns Fl a2 Ns | Ns Fl c Ns | Ns Fl c2 \ +Ns | Ns Fl c3 Ns | Ns Fl f Ns | Ns Fl p Ns | Ns Fl s Ns | Ns Fl u +.Op +m Ns Op n +.Op Fl T Ar type +.Nm +.Op Fl T Ar type +.Op + Ns Op n +.Ar n1 Ns Op , Ns Ar n2 , Ns Ar ... +.Sh DESCRIPTION +The +.Nm +utility displays a series of characters that first clears the hardware terminal +tab settings and then initializes the tab stops at the specified positions +and optionally adjusts the margin. +.Pp +The phrase "tab-stop position N" means that, from the start of a line of +output, tabbing to position N shall cause the next character output to be in +the (N+1)th column on that line. +.Pp +The following options are supported: +.Bl -tag -width Fl +.It Fl Ar n +Specifies repetitive tab stops separated by a uniform number of columns, +.Ar n , +where +.Ar n +is a single digit decimal number. +The default usage of +.Nm +with no arguments is equivalent to +.Nm +.Fl 8 . +When +.Fl 0 +is used, the tab stops are cleared and no new ones set. +.It Fl a +Assembler, applicable to some mainframes. +Equivalent to +.Nm +1,10,16,36,72 . +.It Fl a2 +Assembler, applicable to some mainframes. +Equivalent to +.Nm +1,10,16,40,72 +.It Fl c +.Tn COBOL , +normal format. +Equivalent to +.Nm +1,8,12,16,20,55 +.It Fl c2 +.Tn COBOL , +compact format (columns 1 to 6 omitted). +Equivalent to +.Nm +1,6,10,14,49 +.It Fl c3 +.Tn COBOL , +compact format (columns 1 to 6 omitted), with more tabs than +.Fl c2 . +Equivalent to +.Nm +1,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,67 +.It Fl f +.Tn FORTRAN . +Equivalent to +.Nm +1,7,11,15,19,23 +.It Fl p +.Tn PL/1 . +Equivalent to +.Nm +1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61 +.It Fl s +.Tn SNOBOL . +Equivalent to +.Nm +1,10,55 +.It Fl T Ar type +Indicates the type of terminal. +.It Fl u +Assembler, applicable to some mainframes. +Equivalent to +.Nm +1,12,20,44 +.El +.Sh ENVIRONMENT +The +.Ev COLUMNS +and +.Ev TERM +environment variables affect the execution of +.Nm +as described in +.Xr environ 7 . +.Pp +The +.Fl T +option overrides +.Ev TERM . +If neither +.Ev TERM +nor the +.Fl T +option are present, +.Nm +will fail. +.Sh EXIT STATUS +.Ex -std +.Sh SEE ALSO +.Xr expand 1 , +.Xr stty 1 , +.Xr tput 1 , +.Xr unexpand 1 , +.Xr terminfo 5 +.Sh STANDARDS +The +.Nm +utility conforms to +.St -p1003.1 . +.Sh HISTORY +A +.Nm +utility first appeared in PWB UNIX. +This implementation was introduced in +.Nx 6.0 . +.Sh AUTHORS +.An Roy Marples Aq Mt roy@NetBSD.org diff --git a/vendor/netbsd-curses/tabs/tabs.c b/vendor/netbsd-curses/tabs/tabs.c new file mode 100644 index 0000000..eefa47b --- /dev/null +++ b/vendor/netbsd-curses/tabs/tabs.c @@ -0,0 +1,227 @@ +/* $NetBSD: tabs.c,v 1.5 2019/02/01 08:29:04 mrg Exp $ */ + +/*- + * Copyright (c) 2008 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define NSTOPS 20 + +struct tabspec { + const char *opt; + const char *spec; +}; +static const struct tabspec tabspecs[] = { + {"a", "1,10,16,36,72"}, + {"a2", "1,10,16,40,72"}, + {"c", "1,8,12,16,20,55"}, + {"c2", "1,6,10,14,49"}, + {"c3", "1,6,10,14,18,22,26,30,34,38,42,46,50,54,58,62,67"}, + {"f", "1,7,11,15,19,23"}, + {"p", "1,5,9,13,17,21,25,29,33,37,41,45,49,53,57,61"}, + {"s", "1,10,55"}, + {"u", "1,12,20,44"} +}; +static const size_t ntabspecs = sizeof(tabspecs) / sizeof(tabspecs[0]); + +__dead static void +usage(void) +{ + fprintf(stderr, + "usage: tabs [-n|-a|-a2|-c|-c2|-c3|-f|-p|-s|-u] [+m[n]]" + " [-T type]\n" + " tabs [-T type] [+[n]] n1[,n2,...]\n"); + exit(EXIT_FAILURE); + /* NOTREACHED */ +} + +int +main(int argc, char **argv) +{ + char *term, *arg, *token, *end, *tabs = NULL, *p; + const char *cr, *spec = NULL; + int i, n, inc = 8, stops[NSTOPS], nstops, last, cols, margin = 0; + size_t j; + struct winsize ws; + + term = getenv("TERM"); + for (i = 1; i < argc; i++) { + if (argv[i][0] == '+') { + arg = argv[i] + 1; + if (arg[0] == 'm') + arg++; + if (arg[0] == '\0') + margin = 10; + else { + errno = 0; + margin = strtol(arg, &end, 10); + if (errno != 0 || *end != '\0' || margin < 0) + errx(EXIT_FAILURE, + "%s: invalid margin", arg); + } + continue; + } + if (argv[i][0] != '-') { + tabs = argv[i]; + break; + } + arg = argv[i] + 1; + if (arg[0] == '\0') + usage(); + if (arg[0] == '-' && arg[1] == '\0') { + if (argv[i + 1] != NULL) + tabs = argv[i + 1]; + break; + } + if (arg[0] == 'T' && arg[1] == '\0') { + term = argv[++i]; + if (term == NULL) + usage(); + continue; + } + if (isdigit((int)arg[0])) { + if (arg[1] != '\0') + errx(EXIT_FAILURE, + "%s: invalid increament", arg); + inc = arg[0] - '0'; + continue; + } + for (j = 0; j < ntabspecs; j++) { + if (arg[0] == tabspecs[j].opt[0] && + arg[1] == tabspecs[j].opt[1]) { + spec = tabspecs[j].spec; + break; + } + } + if (j == ntabspecs) + usage(); + } + if (tabs == NULL && spec != NULL) + tabs = strdup(spec); + + if (tabs != NULL) + last = nstops = 0; + else + nstops = -1; + p = tabs; + while ((token = strsep(&p, ", ")) != NULL) { + if (*token == '\0') + continue; + if (nstops >= NSTOPS) + errx(EXIT_FAILURE, + "too many tab stops (max %d)", NSTOPS); + errno = 0; + n = strtol(token, &end, 10); + if (errno != 0 || *end != '\0' || n <= 0) + errx(EXIT_FAILURE, "%s: invalid tab stop", token); + if (*token == '+') { + if (nstops == 0) + errx(EXIT_FAILURE, + "first tab stop may not be relative"); + n += last; + } + if (last > n) + errx(EXIT_FAILURE, "tab stops may not go backwards"); + last = stops[nstops++] = n; + } + + if (term == NULL) + errx(EXIT_FAILURE, "no value for $TERM and -T not given"); + if (setupterm(term, STDOUT_FILENO, NULL) != 0) + err(EXIT_FAILURE, "setupterm:"); + cr = carriage_return; + if (cr == NULL) + cr = "\r"; + if (clear_all_tabs == NULL) + errx(EXIT_FAILURE, "terminal cannot clear tabs"); + if (set_tab == NULL) + errx(EXIT_FAILURE, "terminal cannot set tabs"); + + /* Clear existing tabs */ + putp(cr); + putp(clear_all_tabs); + putp(cr); + + if (set_lr_margin != NULL) { + printf("%*s", margin, ""); + putp(set_lr_margin); + } else if (margin != 0) + warnx("terminal cannot set left margin"); + + if (nstops >= 0) { + printf("%*s", stops[0] - 1, ""); + putp(set_tab); + for (i = 1; i < nstops; i++) { + printf("%*s", stops[i] - stops[i - 1], ""); + putp(set_tab); + } + } else if (inc > 0) { + cols = 0; + term = getenv("COLUMNS"); + if (term != NULL) { + errno = 0; + cols = strtol(term, &end, 10); + if (errno != 0 || *end != '\0' || cols < 0) + cols = 0; + } + if (cols == 0) { + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == 0) + cols = ws.ws_col; + else { + cols = tigetnum("cols"); + if (cols == 0) { + cols = 80; + warnx("terminal does not specify number" + "columns; defaulting to %d", + cols); + } + } + } + for (i = 0; i < cols / inc; i++) { + printf("%*s", inc, ""); + putp(set_tab); + } + } + putp(cr); + + exit(EXIT_SUCCESS); + /* NOTREACHED */ +} diff --git a/vendor/netbsd-curses/terminfo/Makefile b/vendor/netbsd-curses/terminfo/Makefile new file mode 100644 index 0000000..fc6ce68 --- /dev/null +++ b/vendor/netbsd-curses/terminfo/Makefile @@ -0,0 +1,13 @@ +# $NetBSD: Makefile,v 1.5 2020/03/27 15:11:57 christos Exp $ +# from: @(#)Makefile 8.1 (Berkeley) 6/8/93 + +CLEANFILES= terminfo.cdb +realall: terminfo.cdb +FILES=terminfo.cdb terminfo +FILESDIR=${BINDIR}/misc + +terminfo.cdb: terminfo ${TOOL_TIC} + ${_MKTARGET_CREATE} + ${TOOL_TIC} -ax -o ${.TARGET} "${.CURDIR}/terminfo" + +.include diff --git a/vendor/netbsd-curses/terminfo/terminfo b/vendor/netbsd-curses/terminfo/terminfo new file mode 100644 index 0000000..7ab6378 --- /dev/null +++ b/vendor/netbsd-curses/terminfo/terminfo @@ -0,0 +1,25224 @@ +######## TERMINAL TYPE DESCRIPTIONS SOURCE FILE +# +# This version of terminfo.src is distributed with ncurses and is maintained +# by Thomas E. Dickey (TD). +# +# Report bugs and new terminal descriptions to +# bug-ncurses@gnu.org +# +# $Revision: 1.586 $ +# $Date: 2017/01/28 23:50:28 $ +# +# The original header is preserved below for reference. It is noted that there +# is a "newer" version which differs in some cosmetic details (but actually +# stopped updates several years ago); we have decided to not change the header +# unless there is also a change in content. +# +# To further muddy the waters, it is noted that changes to this file as part of +# maintenance of ncurses (since 1996) are generally conceded to be copyright +# under the ncurses MIT-style license. That was the effect of the agreement +# which the principal authors of ncurses made in 1998. However, since much of +# the file itself is of unknown authorship (and the disclaimer below makes it +# obvious that Raymond cannot or will not convey rights over those parts), +# there is no explicit copyright notice on the file itself. +# +# It would also be a nuisance to split the file into unknown/known authorship +# and move pieces as they are maintained, since many of the maintenance changes +# have been small corrections to Raymond's translations to/from termcap format, +# correcting the data but not the accompanying annotations. +# +# In any case, note that almost half of this file is not data but annotations +# which reflect creative effort. Furthermore, the structure of entries to +# reuse common chunks also is creative (and subject to copyright). Finally, +# some portions of the data are derivative work under a compatible MIT-style +# license from xterm. +# +#------------------------------------------------------------------------------ +# Version 10.2.1 +# terminfo syntax +# +# Eric S. Raymond (current maintainer) +# John Kunze, Berkeley +# Craig Leres, Berkeley +# +# Please e-mail changes to terminfo@thyrsus.com; the old termcap@berkeley.edu +# address is no longer valid. The latest version can always be found at +# . +# +# PURPOSE OF THIS FILE: +# +# This file describes the capabilities of various character-cell terminals, +# as needed by software such as screen-oriented editors. +# +# Other terminfo and termcap files exist, supported by various OS vendors +# or as relics of various older versions of UNIX. This one is the longest +# and most comprehensive one in existence. It subsumes not only the entirety +# of the historical 4.4BSD, GNU, System V and SCO termcap files and the BRL +# termcap file, but also large numbers of vendor-maintained termcap and +# terminfo entries more complete and carefully tested than those in historical +# termcap/terminfo versions. +# +# Pointers to related resources (including the ncurses distribution) may +# be found at . +# +# INTERNATIONALIZATION: +# +# This file uses only the US-ASCII character set (no ISO8859 characters). +# +# This file assumes a US-ASCII character set. If you need to fix this, start +# by global-replacing \E(B and \E)B with the appropriate ISO 6429 enablers +# for your character set. \E(A and \E)A enables the British character set +# with the pound sign at position 2/3. +# +# In a Japanese-processing environment using EUC/Japanese or Shift-JIS, +# C1 characters are considered the first-byte set of the Japanese encodings, +# so \E)0 should be avoided in and initialization strings. +# +# FILE FORMAT: +# +# The version you are looking at may be in any of three formats: master +# (terminfo with OT capabilities), stock terminfo, or termcap. You can tell +# which by the format given in the header above. +# +# The master format is accepted and generated by the terminfo tools in the +# ncurses suite; it differs from stock (System V-compatible) terminfo only +# in that it admits a group of capabilities (prefixed `OT') equivalent to +# various obsolete termcap capabilities. You can, thus, convert from master +# to stock terminfo simply by filtering with `sed "/OT[^,]*,/s///"'; but if +# you have ncurses `tic -I' is nicer (among other things, it automatically +# outputs entries in a canonical form). +# +# The termcap version is generated automatically from the master version +# using tic -C. This filtering leaves in the OT capabilities under their +# original termcap names. All translated entries fit within the 1023-byte +# string-table limit of archaic termcap libraries except where explicitly +# noted below. Note that the termcap translation assumes that your termcap +# library can handle multiple tc capabilities in an entry. 4.4BSD has this +# capability. Older versions of GNU termcap, through 1.3, do not. +# +# For details on these formats, see terminfo(5) in the ncurses distribution, +# and termcap(5) in the 4.4BSD Unix Programmer's Manual. Be aware that 4.4BSD +# curses has been declared obsolete by the caretakers of the 4.4BSD sources +# as of June 1995; they are encouraging everyone to migrate to ncurses. +# +# Note: unlike some other distributed terminfo files (Novell Unix & SCO's), +# no entry in this file has embedded comments. This is so source translation +# to termcap only has to carry over leading comments. Also, no name field +# contains embedded whitespace (such whitespace confuses rdist). +# +# Further note: older versions of this file were often installed with an editor +# script (reorder) that moved the most common terminal types to the front of +# the file. This should no longer be necessary, as the file is now ordered +# roughly by type frequency with ANSI/VT100 and other common types up front. +# +# Some information has been merged in from terminfo files distributed by +# USL and SCO (see COPYRIGHTS AND OTHER DELUSIONS below). Much information +# comes from vendors who maintain official terminfos for their hardware +# (notably DEC and Wyse). +# +# A detailed change history is included at the end of this file. +# +# FILE ORGANIZATION: +# +# Comments in this file begin with # - they cannot appear in the middle +# of a terminfo/termcap entry (this feature had to be sacrificed in order +# to allow standard terminfo and termcap syntax to be generated cleanly from +# the master format). Individual capabilities are commented out by +# placing a period between the colon and the capability name. +# +# The file is divided up into major sections (headed by lines beginning with +# the string "########") and minor sections (beginning with "####"); do +# +# grep "^####" | more +# +# to see a listing of section headings. The intent of the divisions is +# (a) to make it easier to find things, and (b) to order the database so +# that important and frequently-encountered terminal types are near the +# front (so that you'll get reasonable search efficiency from a linear +# search of the termcap form even if you don't use reorder). Minor sections +# usually correspond to manufacturers or standard terminal classes. +# Parenthesized words following manufacturer names are type prefixes or +# product line names used by that manufacturers. +# +# HOW TO READ THE ENTRIES: +# +# The first name in an entry is the canonical name for the model or +# type, last entry is a verbose description. Others are mnemonic synonyms for +# the terminal. +# +# Terminal names look like - +# The part to the left of the dash, if a dash is present, describes the +# particular hardware of the terminal. The part to the right may be used +# for flags indicating special ROMs, extra memory, particular terminal modes, +# or user preferences. +# +# All names should be in lower case, for consistency in typing. +# +# The following are conventionally used suffixes: +# -2p Has two pages of memory. Likewise 4p, 8p, etc. +# -am Enable auto-margin. +# -m Monochrome. Suppress color support +# -mc Magic-cookie. Some terminals (notably older Wyses) can +# only support one attribute without magic-cookie lossage. +# Their base entry is usually paired with another that +# uses magic cookies to support multiple attributes. +# -nam No auto-margin - suppress capability +# -nl No labels - suppress soft labels +# -ns No status line - suppress status line +# -rv Terminal in reverse video mode (black on white) +# -s Enable status line. +# -vb Use visible bell () rather than . +# -w Wide - in 132 column mode. +# If a name has multiple suffixes and one is a line height, that one should +# go first. Thus `aaa-30-s-rv' is recommended over `aaa-s-rv-30'. +# +# Entries with embedded plus signs are designed to be included through use/tc +# capabilities, not used as standalone entries. +# +# To avoid search clashes, some older all-numeric names for terminals have +# been removed (i.e., "33" for the Model 33 Teletype, "2621" for the HP2621). +# All primary names of terminals now have alphanumeric prefixes. +# +# Comments marked "esr" are mostly results of applying the termcap-compiler +# code packaged with ncurses and contemplating the resulting error messages. +# In many cases, these indicated obvious fixes to syntax garbled by the +# composers. In a few cases, I was able to deduce corrected forms for garbled +# capabilities by looking at context. All the information in the original +# entries is preserved in the comments. +# +# In the comments, terminfo capability names are bracketed with <> (angle +# brackets). Termcap capability names are bracketed with :: (colons). +# +# INTERPRETATION OF USER CAPABILITIES +# +# The System V Release 4 and XPG4 terminfo format defines ten string +# capabilities for use by applications, .... In this file, we use +# certain of these capabilities to describe functions which are not covered +# by terminfo. The mapping is as follows: +# +# u9 terminal enquire string (equiv. to ANSI/ECMA-48 DA) +# u8 terminal answerback description +# u7 cursor position request (equiv. to VT100/ANSI/ECMA-48 DSR 6) +# u6 cursor position report (equiv. to ANSI/ECMA-48 CPR) +# +# The terminal enquire string should elicit an answerback response +# from the terminal. Common values for will be ^E (on older ASCII +# terminals) or \E[c (on newer VT100/ANSI/ECMA-48-compatible terminals). +# +# The cursor position request () string should elicit a cursor position +# report. A typical value (for VT100 terminals) is \E[6n. +# +# The terminal answerback description (u8) must consist of an expected +# answerback string. The string may contain the following scanf(3)-like +# escapes: +# +# %c Accept any character +# %[...] Accept any number of characters in the given set +# +# The cursor position report () string must contain two scanf(3)-style +# %d format elements. The first of these must correspond to the Y coordinate +# and the second to the %d. If the string contains the sequence %i, it is +# taken as an instruction to decrement each value after reading it (this is +# the inverse sense from the cup string). The typical CPR value is +# \E[%i%d;%dR (on VT100/ANSI/ECMA-48-compatible terminals). +# +# These capabilities are used by tack(1m), the terminfo action checker +# (distributed with ncurses 5.0). +# +# TABSET FILES +# +# All the entries in this file have been edited to assume that the tabset +# files directory is /usr/share/tabset, in conformance with the File Hierarchy +# Standard for Linux and open-source BSD systems. Some vendors (notably Sun) +# use /usr/lib/tabset or (more recently) /usr/share/lib/tabset. +# +# No curses package we know of actually uses these files. If their location +# is an issue, you will have to hand-patch the file locations before compiling +# this file. +# +# REQUEST FOR CONTACT INFORMATION AND HISTORICAL MATERIAL +# +# As the ANSI/ECMA-48 standard and variants take firmer hold, and as +# character-cell terminals are increasingly replaced by X displays, much of +# this file is becoming a historical document (this is part of the reason for +# the new organization, which puts ANSI types, xterm, Unix consoles, +# and vt100 up front in confidence that this will catch 95% of new hardware). +# +# For the terminal types still alive, I'd like to have manufacturer's +# contact data (Internet address and/or snail-mail + phone). +# +# I'm also interested in enriching the comments so that the latter portions of +# the file do in fact become a potted history of VDT technology as seen by +# UNIX hackers. Ideally, I'd like the headers for each manufacturer to +# include its live/dead/out-of-the-business status, and for as many +# terminal types as possible to be tagged with information like years +# of heaviest use, popularity, and interesting features. +# +# I'm especially interested in identifying the obscure entries listed under +# `Miscellaneous obsolete terminals, manufacturers unknown' before the tribal +# wisdom about them gets lost. If you know a lot about obscure old terminals, +# please go to the terminfo resource page, grab the UFO file (ufo.ti), and +# eyeball it for things you can identify and describe. +# +# If you have been around long enough to contribute, please read the file +# with this in mind and send me your annotations. +# +# COPYRIGHTS AND OTHER DELUSIONS +# +# The BSD ancestor of this file had a standard Regents of the University of +# California copyright with dates from 1980 to 1993. +# +# Some information has been merged in from a terminfo file SCO distributes. +# It has an obnoxious boilerplate copyright which I'm ignoring because they +# took so much of the content from the ancestral BSD versions of this file +# and didn't attribute it, thereby violating the BSD Regents' copyright. +# +# Not that anyone should care. However many valid functions copyrights may +# serve, putting one on a termcap/terminfo file with hundreds of anonymous +# contributors makes about as much sense as copyrighting a wall-full of +# graffiti -- it's legally dubious, ethically bogus, and patently ridiculous. +# +# This file deliberately has no copyright. It belongs to no one and everyone. +# If you claim you own it, you will merely succeed in looking like a fool. +# Use it as you like. Use it at your own risk. Copy and redistribute freely. +# There are no guarantees anywhere. Svaha! +# + +######## ANSI, UNIX CONSOLE, AND SPECIAL TYPES +# +# This section describes terminal classes and brands that are still +# quite common. +# + +#### Specials +# +# Special "terminals". These are used to label tty lines when you don't +# know what kind of terminal is on it. The characteristics of an unknown +# terminal are the lowest common denominator - they look about like a ti 700. +# + +dumb|80-column dumb tty, + am, + cols#80, + bel=^G, cr=^M, cud1=^J, ind=^J, +unknown|unknown terminal type, + gn, use=dumb, +lpr|printer|line printer, + OTbs, hc, os, + cols#132, lines#66, + bel=^G, cr=^M, cub1=^H, cud1=^J, ff=^L, ind=^J, +glasstty|classic glass tty interpreting ASCII control characters, + OTbs, am, + cols#80, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, ht=^I, kcub1=^H, + kcud1=^J, nel=^M^J, .kbs=^H, + +vanilla|dumb tty, + OTbs, + bel=^G, cr=^M, cud1=^J, ind=^J, + +# This is almost the same as "dumb", but with no prespecified width. +# DEL and ^C are hardcoded to act as kill characters. +# ^D acts as a line break (just like newline). +# It also interprets +# \033];xxx\007 +# for compatibility with xterm -TD +9term|Plan9 terminal emulator for X, + am, + OTnl=^J, bel=^G, cud1=^J, + +#### ANSI.SYS/ISO 6429/ECMA-48 Capabilities +# +# See the end-of-file comment for more on these. +# + +# ANSI capabilities are broken up into pieces, so that a terminal +# implementing some ANSI subset can use many of them. +ansi+local1, + cub1=\E[D, cud1=\E[B, cuf1=\E[C, cuu1=\E[A, +ansi+local, + cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, + cuu=\E[%p1%dA, use=ansi+local1, +ansi+tabs, + cbt=\E[Z, ht=^I, hts=\EH, tbc=\E[3g, +ansi+inittabs, + it#8, use=ansi+tabs, +ansi+erase, + clear=\E[H\E[J, ed=\E[J, el=\E[K, +ansi+rca, + hpa=\E[%p1%{1}%+%dG, vpa=\E[%p1%{1}%+%dd, +ansi+cup, + cup=\E[%i%p1%d;%p2%dH, home=\E[H, +ansi+rep, + rep=%p1%c\E[%p2%{1}%-%db, +ansi+idl1, + dl1=\E[M, il1=\E[L, +ansi+idl, + dl=\E[%p1%dM, il=\E[%p1%dL, use=ansi+idl1, +ansi+idc, + dch1=\E[P, ich=\E[%p1%d@, ich1=\E[@, rmir=\E6, smir=\E6, +ansi+arrows, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + khome=\E[H, +ansi+sgr|ansi graphic renditions, + blink=\E[5m, invis=\E[8m, rev=\E[7m, + sgr=\E[0%?%p3%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, + sgr0=\E[0m, +ansi+sgrso|ansi standout only, + rmso=\E[m, smso=\E[7m, +ansi+sgrul|ansi underline only, + rmul=\E[m, smul=\E[4m, +ansi+sgrbold|ansi graphic renditions; assuming terminal has bold; not dim, + bold=\E[1m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1; + %;%?%p7%t8;%;m, + use=ansi+sgr, use=ansi+sgrso, use=ansi+sgrul, +ansi+sgrdim|ansi graphic renditions; assuming terminal has dim; not bold, + dim=\E[2m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p5%t2; + %;%?%p7%t8;%;m, + use=ansi+sgr, use=ansi+sgrso, use=ansi+sgrul, +ansi+csr|ansi scroll-region plus cursor save & restore, + csr=\E[%i%p1%d;%p2%dr, rc=\E8, sc=\E7, + +# The normal (ANSI) flavor of "media copy" building block asserts that +# characters sent to the printer do not echo on the screen. DEC terminals +# can also be put into autoprinter mode, where each line is sent to the +# printer as you move off that line, e.g., by a carriage return. +ansi+pp|ansi printer port, + mc5i, + mc0=\E[i, mc4=\E[4i, mc5=\E[5i, +dec+pp|DEC autoprinter mode, + mc0=\E[i, mc4=\E[?4i, mc5=\E[?5i, + +# The IBM PC alternate character set. Plug this into any Intel console entry. +# We use \E[11m for rmacs rather than \E[12m so the string can use the +# ROM graphics for control characters such as the diamond, up- and down-arrow. +# This works with the System V, Linux, and BSDI consoles. It's a safe bet this +# will work with any Intel console, they all seem to have inherited \E[11m +# from the ANSI.SYS de-facto standard. +klone+acs|alternate character set for ansi.sys displays, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j + \331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v + \301w\302x\263y\363z\362{\343|\330}\234~\376, + rmacs=\E[10m, smacs=\E[11m, + +# Highlight controls corresponding to the ANSI.SYS standard. Most +# console drivers for Intel boxes obey these. Makes the same assumption +# about \E[11m as klone+acs. True ANSI/ECMA-48 would have , +# , but this isn't a documented feature of ANSI.SYS. +klone+sgr|attribute control for ansi.sys displays, + blink=\E[5m, bold=\E[1m, rev=\E[7m, rmpch=\E[10m, + rmso=\E[m, rmul=\E[m, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6 + %t;1%;%?%p9%t;11%;m, + sgr0=\E[0;10m, smpch=\E[11m, smso=\E[7m, smul=\E[4m, + use=klone+acs, + +# Most Intel boxes do not treat "invis" (invisible) text. +klone+sgr8|attribute control for ansi.sys displays, + invis=\E[8m, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6 + %t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + use=klone+sgr, + +# Highlight controls corresponding to the ANSI.SYS standard. *All* +# console drivers for Intel boxes obey these. Does not assume \E[11m will +# work; uses \E[12m instead, which is pretty bulletproof but loses you the ACS +# diamond and arrow characters under curses. +klone+sgr-dumb|attribute control for ansi.sys displays (no ESC [ 11 m), + blink=\E[5m, bold=\E[1m, invis=\E[8m, rev=\E[7m, rmso=\E[m, + rmul=\E[m, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6 + %t;1%;%?%p7%t;8%;%?%p9%t;12%;m, + sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m, smul=\E[4m, + use=klone+acs, + +# KOI8-R (RFC1489) acs (alternate character set) +# From: Qing Long , 24 Feb 1996. +klone+koi8acs|alternate character set for ansi.sys displays with KOI8 charset, + acsc=+\020\,\021-\036.^_0\215`\004a\237f\234g\232h\222i + \220j\205k\203l\202m\204n\212o\213p\216q\0r\217s\214t + \206u\207v\210w\211x\201y\230z\231{\267|\274}L~ + \225, + rmacs=\E[10m, smacs=\E[11m, + +# ANSI.SYS color control. The setab/setaf caps depend on the coincidence +# between SVr4/XPG4's color numbers and ANSI.SYS attributes. Here are longer +# but equivalent strings that don't rely on that coincidence: +# setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, +# setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, +# The DOS 5 manual asserts that these sequences meet the ISO 6429 standard. +# They match a subset of ECMA-48. +klone+color|color control for ansi.sys and ISO6429-compatible displays, + colors#8, ncv#3, pairs#64, + op=\E[37;40m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + +# This is better than klone+color, it doesn't assume white-on-black as the +# default color pair, but many `ANSI' terminals don't grok the cap. +ecma+color|color control for ECMA-48-compatible terminals, + AX, + colors#8, ncv#3, pairs#64, + op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + +# Attribute control for ECMA-48-compatible terminals +ecma+sgr|attribute capabilities for true ECMA-48 terminals, + rmso=\E[27m, rmul=\E[24m, use=klone+sgr8, + +# For comparison, here are all the capabilities implied by the Intel +# Binary Compatibility Standard (level 2) that fit within terminfo. +# For more detail on this rather pathetic standard, see the comments +# near the end of this file. +ibcs2|Intel Binary Compatibility Standard prescriptions, + cbt=\E[Z, clear=\Ec, cub=\E[%p1%dD, cub1=\E[1D, + cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[1A, + dch=\E[%p1%dP, dispc=\E=%p1%dg, ech=\E[%p1%dX, + hpa=\E[%i%p1%dG, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, indn=\E[%p1%dS, rc=\E7, rin=\E[%p1%dT, + rmam=\E[?7l, sc=\E7, smam=\E[?7h, tbc=\E[g, + vpa=\E[%i%p1%dd, + +#### ANSI/ECMA-48 terminals and terminal emulators +# +# See near the end of this file for details on ANSI conformance. +# Don't mess with these entries! Lots of other entries depend on them! +# +# This section lists entries in a least-capable to most-capable order. +# if you're in doubt about what `ANSI' matches yours, try them in that +# order and back off from the first that breaks. + +# ansi-mr is for ANSI terminals with ONLY relative cursor addressing +# and more than one page of memory. It uses local motions instead of +# direct cursor addressing, and makes almost no assumptions. It does +# assume auto margins, no padding and/or xon/xoff, and a 24x80 screen. +ansi-mr|mem rel cup ansi, + am, xon, + cols#80, lines#24, use=vanilla, use=ansi+erase, + use=ansi+local1, + +# ansi-mini is a bare minimum ANSI terminal. This should work on anything, but +# beware of screen size problems and memory relative cursor addressing. +ansi-mini|any ansi terminal with pessimistic assumptions, + am, xon, + cols#80, lines#24, use=vanilla, use=ansi+cup, + use=ansi+erase, + +# ansi-mtabs adds relative addressing and minimal tab support +ansi-mtabs|any ansi terminal with pessimistic assumptions, + it#8, + ht=^I, use=ansi-mini, use=ansi+local1, + +# ANSI X3.64 from emory!mlhhh (Hugh Hansard) via BRL +# +# The following is an entry for the full ANSI 3.64 (1977). It lacks +# padding, but most terminals using the standard are "fast" enough +# not to require any -- even at 9600 bps. If you encounter problems, +# try including the padding specifications. +# +# Note: the :as: and :ae: specifications are not implemented here, for +# the available termcap documentation does not make clear WHICH alternate +# character set to specify. ANSI 3.64 seems to make allowances for several. +# Please make the appropriate adjustments to fit your needs -- that is +# if you will be using alternate character sets. +# +# There are very few terminals running the full ANSI 3.64 standard, +# so I could only test this entry on one verified terminal (Visual 102). +# I would appreciate the results on other terminals sent to me. +# +# Please report comments, changes, and problems to: +# +# U.S. MAIL: Hugh Hansard +# Box: 22830 +# Emory University +# Atlanta, GA. 30322. +# +# USENET {akgua,msdc,sb1,sb6,gatech}!emory!mlhhh. +# +# (Added vt100 , to quiet a tic warning --esr) +ansi77|ansi 3.64 standard 1977 version, + OTbs, am, mir, + cols#80, it#8, lines#24, + bel=^G, clear=\E[;H\E[2J, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, dch1=\E[P, dl1=\E[M$<5*/>, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, il1=\E[L$<5*/>, ind=\ED, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, + kf2=\EOR, kf4=\EOS, khome=\E[H, nel=^M\ED, rc=\E8, ri=\EM, + rmir=\E[4l, rmso=\E[m, rmul=\E[m, sc=\E7, smir=\E[4h, + smso=\E[7m, smul=\E[4m, + +# Procomm and some other ANSI emulations don't recognize all of the ANSI- +# standard capabilities. This entry deletes , , , , and +# / capabilities, forcing curses to use repetitions of , +# , and . Also deleted and , as QModem up to +# 5.03 doesn't recognize these. Finally, we delete and , which seem +# to confuse many emulators. On the other hand, we can count on these programs +# doing //. Older versions of this entry featured +# , but now seems to be more common under +# ANSI.SYS influence. +# From: Eric S. Raymond Oct 30 1995 +pcansi-m|pcansi-mono|ibm-pc terminal programs claiming to be ansi (mono mode), + OTbs, am, mir, msgr, + cols#80, it#8, lines#24, + bel=^G, cbt=\E[Z, clear=\E[H\E[J, cr=^M, cub1=\E[D, + cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + hts=\EH, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, tbc=\E[3g, + use=klone+sgr-dumb, +pcansi-25-m|pcansi25m|ibm-pc terminal programs with 25 lines (mono mode), + lines#25, use=pcansi-m, +pcansi-33-m|pcansi33m|ibm-pc terminal programs with 33 lines (mono mode), + lines#33, use=pcansi-m, +pcansi-43-m|ansi43m|ibm-pc terminal programs with 43 lines (mono mode), + lines#43, use=pcansi-m, +# The color versions. All PC emulators do color... +pcansi|ibm-pc terminal programs claiming to be ansi, + use=klone+color, use=pcansi-m, +pcansi-25|pcansi25|ibm-pc terminal programs with 25 lines, + lines#25, use=pcansi, +pcansi-33|pcansi33|ibm-pc terminal programs with 33 lines, + lines#33, use=pcansi, +pcansi-43|pcansi43|ibm-pc terminal programs with 43 lines, + lines#43, use=pcansi, + +# ansi-m -- full ANSI X3.64 with ANSI.SYS-compatible attributes, no color. +# If you want pound signs rather than dollars, replace `B' with `A' +# in the , , , and capabilities. +# From: Eric S. Raymond Nov 6 1995 +ansi-m|ansi-mono|ANSI X3.64-1979 terminal with ANSI.SYS compatible attributes, + mc5i, + cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, + cuu=\E[%p1%dA, dch=\E[%p1%dP, dl=\E[%p1%dM, + ech=\E[%p1%dX, el1=\E[1K, hpa=\E[%i%p1%dG, ht=\E[I, + ich=\E[%p1%d@, il=\E[%p1%dL, indn=\E[%p1%dS, kbs=^H, + kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kich1=\E[L, mc4=\E[4i, mc5=\E[5i, nel=\r\E[S, + rep=%p1%c\E[%p2%{1}%-%db, rin=\E[%p1%dT, s0ds=\E(B, + s1ds=\E)B, s2ds=\E*B, s3ds=\E+B, tbc=\E[3g, + vpa=\E[%i%p1%dd, use=pcansi-m, + +ansi+enq|ncurses extension for ANSI ENQ, + u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?%[;0123456789]c, + u9=\E[c, + +# ansi -- this terminfo expresses the largest subset of X3.64 that will fit in +# standard terminfo. Assumes ANSI.SYS-compatible attributes and color. +# From: Eric S. Raymond Nov 6 1995 +ansi|ansi/pc-term compatible with color, + use=ansi+enq, use=ecma+color, use=klone+sgr8, use=ansi-m, + +# ansi-generic is a vanilla ANSI terminal. This is assumed to implement +# all the normal ANSI stuff with no extensions. It assumes +# insert/delete line/char is there, so it won't work with +# vt100 clones. It assumes video attributes for bold, blink, +# underline, and reverse, which won't matter much if the terminal +# can't do some of those. Padding is assumed to be zero, which +# shouldn't hurt since xon/xoff is assumed. +ansi-generic|generic ansi standard terminal, + am, xon, + cols#80, lines#24, use=vanilla, use=ansi+csr, use=ansi+cup, + use=ansi+rca, use=ansi+erase, use=ansi+tabs, + use=ansi+local, use=ansi+idc, use=ansi+idl, use=ansi+rep, + use=ansi+sgrbold, use=ansi+arrows, + +#### DOS ANSI.SYS variants +# +# This completely describes the sequences specified in the DOS 2.1 ANSI.SYS +# documentation (except for the keyboard key reassignment feature, which +# doesn't fit the model well). The klone+acs sequences were valid +# though undocumented. The capability is untested but should work for +# keys F1-F10 (%p1 values outside this range will yield unpredictable results). +# From: Eric S. Raymond Nov 7 1995 +ansi.sys-old|ANSI.SYS under PC-DOS 2.1, + OTbs, am, mir, msgr, xon, + cols#80, lines#25, + clear=\E[2J, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[k, home=\E[H, + is2=\E[m\E[?7h, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, + khome=^^, pfkey=\E[0;%p1%{58}%+%d;%p2"%s"p, rc=\E[u, + rmam=\E[?7l, sc=\E[s, smam=\E[?7h, u6=\E[%i%d;%dR, + u7=\E[6n, use=klone+color, use=klone+sgr8, + +# Keypad: Home=\0G Up=\0H PrPag=\0I +# ka1,kh kcuu1 kpp,ka3 +# +# Left=\0K 5=\0L Right=\0M +# kcub1 kb2 kcuf1 +# +# End=\0O Down=\0P NxPag=\0Q +# kc1,kend kcud1 kc3,knp +# +# Ins=\0R Del=\0S +# kich1 kdch1 +# +# On keyboard with 12 function keys, +# shifted f-keys: F13-F24 +# control f-keys: F25-F36 +# alt f-keys: F37-F48 +# The shift/control/alt keys do not modify each other, but alt overrides both, +# and control overrides shift. +# +# capability for F1-F48 -TD +ansi.sys|ANSI.SYS 3.1 and later versions, + el=\E[K, ka1=\0G, ka3=\0I, kb2=\0L, kbs=^H, kc1=\0O, kc3=\0Q, + kcbt=\0^O, kcub1=\0K, kcud1=\0P, kcuf1=\0M, kcuu1=\0H, + kdch1=\0S, kend=\0O, kf1=\0;, kf10=\0D, kf11=\0\205, + kf12=\0\206, kf13=\0T, kf14=\0U, kf15=\0V, kf16=\0W, + kf17=\0X, kf18=\0Y, kf19=\0Z, kf2=\0<, kf20=\0[, kf21=\0\\, + kf22=\0], kf23=\0\207, kf24=\0\210, kf25=\0\^, kf26=\0_, + kf27=\0`, kf28=\0a, kf29=\0b, kf3=\0=, kf30=\0c, kf31=\0d, + kf32=\0e, kf33=\0f, kf34=\0g, kf35=\0\211, kf36=\0\212, + kf37=\0h, kf38=\0i, kf39=\0j, kf4=\0>, kf40=\0k, kf41=\0l, + kf42=\0m, kf43=\0n, kf44=\0o, kf45=\0p, kf46=\0q, + kf47=\0\213, kf48=\0\214, kf5=\0?, kf6=\0@, kf7=\0A, kf8=\0B, + kf9=\0C, khome=\0G, kich1=\0R, knp=\0Q, kpp=\0I, + pfkey=\E[0;%?%p1%{11}%<%t%'\:'%e%p1%{13}%<%t%'z'%e%p1%{23}%< + %t%'G'%e%p1%{25}%<%t%'p'%e%p1%'#'%<%t%'E'%e%p1%'%'%<%t + %'f'%e%p1%'/'%<%t%'C'%e%{92}%;%p1%+%d;%p2"%s"p, + use=ansi.sys-old, + +# +# Define IBM PC keypad keys for vi as per MS-Kermit while using ANSI.SYS. +# This should only be used when the terminal emulator cannot redefine the keys. +# Since redefining keys with ansi.sys also affects PC-DOS programs, the key +# definitions must be restored. If the terminal emulator is quit while in vi +# or others using /, the keypad will not be defined as per PC-DOS. +# The PgUp and PgDn are prefixed with ESC so that tn3270 can be used on Unix +# (^U and ^D are already defined for tn3270). The ESC is safe for vi but it +# does "beep". ESC ESC i is used for Ins to avoid tn3270 ESC i for coltab. +# Note that is always BS, because PC-dos can tolerate this change. +# Caution: vi is limited to 256 string bytes, longer crashes or weirds out vi. +# Consequently the End keypad key could not be set (it is relatively safe and +# actually useful because it sends ^@ O, which beeps and opens a line above). +ansi.sysk|ansisysk|PC-DOS 3.1 ANSI.SYS with keypad redefined for vi, + is2=U2\sPC-DOS\s3.1\sANSI.SYS\swith\skeypad\sredefined\sfor + \svi\s9-29-86\n\E[;75;8p, + rmkx=\E[;71;0;71p\E[;72;0;72p\E[;73;0;73p\E[;77;0;77p\E[;80; + 0;80p\E[;81;0;81p\E[;82;0;82p\E[;83;0;83p, + smkx=\E[;71;30p\E[;72;11p\E[;73;27;21p\E[;77;12p\E[;80;10p + \E[;81;27;4p\E[;82;27;27;105p\E[;83;127p, + use=ansi.sys, +# +# Adds ins/del line/character, hence vi reverse scrolls/inserts/deletes nicer. +nansi.sys|nansisys|PC-DOS Public Domain NANSI.SYS, + dch1=\E[1P, dl1=\E[1M, ich1=\E[1@, il1=\E[1L, + is2=U3 PC-DOS Public Domain NANSI.SYS 9-23-86\n, + use=ansi.sys, +# +# See ansi.sysk and nansi.sys above. +nansi.sysk|nansisysk|PC-DOS Public Domain NANSI.SYS with keypad redefined for vi, + dch1=\E[1P, dl1=\E[1M, ich1=\E[1@, il1=\E[1L, + is2=U4\sPC-DOS\sPublic\sDomain\sNANSI.SYS\swith\skeypad + \sredefined\sfor\svi\s9-29-86\n\E[;75;8p, + use=ansi.sysk, + +#### Atari ST terminals + +# From Guido Flohr . +# +tw52|tw52-color|Toswin window manager with color, + bce, + colors#16, pairs#256, + oc=\Eb?\Ec0, op=\Eb?\Ec0, + setab=\Ec%?%p1%{0}%=%t?%e%p1%{7}%=%t0%e%p1%{15}%=%t7%e%p1 + %{48}%+%c, + setaf=\Eb%?%p1%{0}%=%t?%e%p1%{7}%=%t0%e%p1%{15}%=%t7%e%p1 + %{48}%+%c, + setb=\Ec%?%p1%{0}%=%t?%e%p1%{7}%=%t0%e%p1%{15}%=%t7%e%p1 + %{48}%+%c, + setf=\Eb%?%p1%{0}%=%t?%e%p1%{7}%=%t0%e%p1%{15}%=%t7%e%p1 + %{48}%+%c, + use=tw52-m, +tw52-m|Toswin window manager monochrome, + ul, + ma#999, + bold=\Eya, dch1=\Ea, dim=\EyB, + is2=\Ev\Eq\Ez_\Ee\Ei\Eb?\Ec0, rev=\EyP, rmso=\EzQ, + rmul=\EzH, rs2=\Ev\Eq\Ez_\Ee\Ei\Eb?\Ec0, sgr0=\Ez_, + smso=\EyQ, smul=\EyH, use=at-m, +tt52|Atari TT medium and high resolution, + lines#30, use=at-color, +st52-color|at-color|atari-color|atari_st-color|Atari ST with color, + bce, + colors#16, pairs#256, + is2=\Ev\Eq\Ee\Eb1\Ec0, rs2=\Ev\Eq\Ee\Eb1\Ec0, + setab=\Ec%?%p1%{0}%=%t1%e%p1%{1}%=%t2%e%p1%{2}%=%t3%e%p1%{3} + %=%t>%e%p1%{4}%=%t4%e%p1%{5}%=%t7%e%p1%{6}%=%t5%e%p1 + %{7}%=%t0%e%p1%{8}%=%t8%e%p1%{9}%=%t9%e%p1%{10}%=%t\: + %e%p1%{11}%=%t;%e%p1%{12}%=%t<%e%p1%{13}%=%t=%e%p1 + %{14}%=%t6%e?, + setaf=\Eb%?%p1%{0}%=%t1%e%p1%{1}%=%t2%e%p1%{2}%=%t3%e%p1%{3} + %=%t>%e%p1%{4}%=%t4%e%p1%{5}%=%t7%e%p1%{6}%=%t5%e%p1 + %{7}%=%t0%e%p1%{8}%=%t8%e%p1%{9}%=%t9%e%p1%{10}%=%t\: + %e%p1%{11}%=%t;%e%p1%{12}%=%t<%e%p1%{13}%=%t=%e%p1 + %{14}%=%t6%e?, + setb=\Ec%?%p1%{0}%=%t1%e%p1%{1}%=%t2%e%p1%{2}%=%t3%e%p1%{3} + %=%t>%e%p1%{4}%=%t4%e%p1%{5}%=%t7%e%p1%{6}%=%t5%e%p1 + %{7}%=%t0%e%p1%{8}%=%t8%e%p1%{9}%=%t9%e%p1%{10}%=%t\:%e + %p1%{11}%=%t;%e%p1%{12}%=%t<%e%p1%{13}%=%t=%e%p1%{14}%= + %t6%e?, + setf=\Eb%?%p1%{0}%=%t1%e%p1%{1}%=%t2%e%p1%{2}%=%t3%e%p1%{3} + %=%t>%e%p1%{4}%=%t4%e%p1%{5}%=%t7%e%p1%{6}%=%t5%e%p1 + %{7}%=%t0%e%p1%{8}%=%t8%e%p1%{9}%=%t9%e%p1%{10}%=%t\:%e + %p1%{11}%=%t;%e%p1%{12}%=%t<%e%p1%{13}%=%t=%e%p1%{14}%= + %t6%e?, + use=st52, +st52|st52-m|at|at-m|atari|atari-m|atari_st|atarist-m|Atari ST, + am, eo, mir, npc, + cols#80, it#8, lines#24, + bel=^G, civis=\Ef, clear=\EE, cnorm=\Ee, cr=^M, cub1=\ED, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dl1=\EM, ed=\EJ, el=\EK, el1=\Eo, home=\EH, ht=^I, + il1=\EL, ind=^J, is2=\Ev\Eq\Ee, kLFT=\Ed, kRIT=\Ec, kbs=^H, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\177, + kf1=\EP, kf10=\EY, kf11=\Ep, kf12=\Eq, kf13=\Er, kf14=\Es, + kf15=\Et, kf16=\Eu, kf17=\Ev, kf18=\Ew, kf19=\Ex, kf2=\EQ, + kf20=\Ey, kf3=\ER, kf4=\ES, kf5=\ET, kf6=\EU, kf7=\EV, kf8=\EW, + kf9=\EX, khlp=\EH, khome=\EE, kich1=\EI, knp=\Eb, kpp=\Ea, + kund=\EK, nel=^M^J, rc=\Ek, rev=\Ep, ri=\EI, rmso=\Eq, + rs2=\Ev\Eq\Ee, sc=\Ej, sgr0=\Eq, smso=\Ep, +tw100|toswin vt100 window mgr, + eo, mir, msgr, xon, + colors#8, cols#80, it#8, lines#24, pairs#64, vt#3, + acsc=++\,\,--..00II``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxy + yzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\Ef, + clear=\E[2J\E[H, cnorm=\Ee, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\EB, + cuf=\E[%p1%dC, cuf1=\EC, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\EA, dch1=\Ea, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, ht=^I, + hts=\EH, ich=\E[%p1%d@, il1=\EL, ind=^J, is2=\E<\E)0, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\177, + kf1=\EOP, kf10=\EOY, kf11=\Ep, kf12=\Eq, kf13=\Er, kf14=\Es, + kf15=\Et, kf16=\Eu, kf17=\Ev, kf18=\Ew, kf19=\Ex, kf2=\EOQ, + kf20=\Ey, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, + kf8=\EOW, kf9=\EOX, khlp=\EH, khome=\E\EE, kich1=\EI, + knp=\Eb, kpp=\E\Ea, kund=\EK, ll=\E[24H, nel=\EE, + oc=\E[30;47m, op=\E[30;47m, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmcup=\E[?7h, rmir=\Ei, rmkx=\E[?1l\E>, + rmso=\E[m, rmul=\E[m, + rs1=\E<\E[20l\E[?3;6;9l\E[r\Eq\E(B\017\E)0\E>, + sc=\E7, + setb=\E[4%p1%'0'%+%Pa%?%ga%'0'%=%t0%e%ga%'1'%=%t4%e%ga%'2'%= + %t2%e%ga%'3'%=%t6%e%ga%'4'%=%t1%e%ga%'5'%=%t5%e%ga%'6' + %=%t3%e7%;m, + setf=\E[3%p1%'0'%+%Pa%?%ga%'0'%=%t0%e%ga%'1'%=%t4%e%ga%'2'%= + %t2%e%ga%'3'%=%t6%e%ga%'4'%=%t1%e%ga%'5'%=%t5%e%ga%'6' + %=%t3%e7%;m, + sgr0=\E[m, smacs=^N, smcup=\E[?7l, smir=\Eh, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, +# The entries for stv52 and stv52pc probably need a revision. +stv52|MiNT virtual console, + am, msgr, + cols#80, it#8, lines#30, + bel=^G, blink=\Er, bold=\EyA, civis=\Ef, clear=\EE, + cnorm=\E. \Ee, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\E.", + dim=\Em, dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, il1=\EL, + ind=\n$<2*/>, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\177, kf1=\EP, kf10=\EY, kf11=\Ep, kf12=\Eq, + kf13=\Er, kf14=\Es, kf15=\Et, kf16=\Eu, kf17=\Ev, kf18=\Ew, + kf19=\Ex, kf2=\EQ, kf20=\Ey, kf3=\ER, kf4=\ES, kf5=\ET, + kf6=\EU, kf7=\EV, kf8=\EW, kf9=\EX, khlp=\EH, khome=\EE, + kich1=\EI, knp=\Eb, kpp=\Ea, kund=\EK, nel=\r\n$<2*/>, + op=\Eb@\EcO, rev=\Ep, ri=\EI$<2*/>, rmcup=\Ev\E. \Ee\Ez_, + rmso=\Eq, rmul=\EzH, rs1=\Ez_\Eb@\EcA, sgr0=\Ez_, + smcup=\Ev\Ee\Ez_, smso=\Ep, smul=\EyH, +stv52pc|MiNT virtual console with PC charset, + am, msgr, + cols#80, it#8, lines#30, + acsc=+\257\,\256-\^.v0\333I\374`\177a\260f\370g\361h\261j + \331k\277l\332m\300n\305o\377p-q\304r-s_t+u+v+w+x\263y + \363z\362{\343|\366}\234~\371, + bel=^G, blink=\Er, bold=\EyA, civis=\Ef, clear=\EE, + cnorm=\E. \Ee, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\E.", + dim=\Em, dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, il1=\EL, + ind=\n$<2*/>, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\177, kf1=\EP, kf10=\EY, kf11=\Ep, kf12=\Eq, + kf13=\Er, kf14=\Es, kf15=\Et, kf16=\Eu, kf17=\Ev, kf18=\Ew, + kf19=\Ex, kf2=\EQ, kf20=\Ey, kf3=\ER, kf4=\ES, kf5=\ET, + kf6=\EU, kf7=\EV, kf8=\EW, kf9=\EX, khlp=\EH, khome=\EE, + kich1=\EI, knp=\Eb, kpp=\Ea, kund=\EK, nel=\r\n$<2*/>, + rev=\Ep, ri=\EI$<2*/>, rmcup=\Ev\E. \Ee\Ez_, rmso=\Eq, + rmul=\EzH, rs1=\Ez_\Eb@\EcA, sgr0=\Ez_, smcup=\Ev\Ee\Ez_, + smso=\Ep, smul=\EyH, + +# From: Simson L. Garfinkel +atari-old|atari st, + OTbs, am, + cols#80, it#8, lines#25, + clear=\EH\EJ, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dl1=\EM, + ed=\EJ, el=\EK, ht=^I, il1=\EL, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, ri=\EI, rmso=\Eq, sgr0=\Eq, smso=\Ep, +# UniTerm terminal program for the Atari ST: 49-line VT220 emulation mode +# From: Paul M. Aoki +uniterm|uniterm49|UniTerm VT220 emulator with 49 lines, + lines#49, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;49r\E[49;1H, use=vt220, +# MiNT VT52 emulation. 80 columns, 25 rows. +# MiNT is Now TOS, the operating system which comes with all Ataris now +# (mainly Atari Falcon). This termcap is for the VT52 emulation you get +# under tcsh/zsh/bash/sh/ksh/ash/csh when you run MiNT in `console' mode +# From: Per Persson , 27 Feb 1996 +st52-old|Atari ST with VT52 emulation, + am, km, + cols#80, lines#25, + bel=^G, civis=\Ef, clear=\EH\EJ, cnorm=\Ee, cr=^M, cub1=\ED, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, il1=\EL, + ind=^J, ka1=\E#7, ka3=\E#5, kb2=\E#9, kbs=^H, kc1=\E#1, + kc3=\E#3, kclr=\E#7, kcub1=\E#K, kcud1=\E#P, kcuf1=\E#M, + kcuu1=\E#H, kf0=\E#D, kf1=\E#;, kf2=\E#<, kf3=\E#=, kf4=\E#>, + kf5=\E#?, kf6=\E#@, kf7=\E#A, kf8=\E#B, kf9=\E#C, khome=\E#G, + kil1=\E#R, kind=\E#2, kri=\E#8, lf0=f10, nel=^M^J, rc=\Ek, + ri=\EI, rmcup=, rmso=\Eq, rs1=\Ez_\Eb@\EcA, sc=\Ej, sgr0=\Eq, + smcup=\Ee, smso=\Ep, + +#### Apple Terminal.app + +# nsterm*|Apple_Terminal - AppKit Terminal.app +# +# Terminal.app is a Terminal emulator bundled with NeXT's NeXTStep and +# OPENSTEP/Mach operating systems, and with Apple's Rhapsody, Mac OS X +# Server and Mac OS X operating systems. There is also a +# "terminal.app" in GNUStep, but I believe it to be an unrelated +# codebase and I have not attempted to describe it here. +# +# For NeXTStep, OPENSTEP/Mach, Rhapsody and Mac OS X Server 1.0, you +# are pretty much on your own. Use "nsterm-7-m" and hope for the best. +# You might also try "nsterm-7" and "nsterm-old" if you suspect your +# version supports color. +# +# To determine the version of Terminal.app you're using by running: +# +# echo "$TERM_PROGRAM" "$TERM_PROGRAM_VERSION" +# +# For Apple_Terminal v309+, use "nsterm-256color" (or "nsterm-bce") +# +# For Apple_Terminal v200+, use "nsterm-16color" (a.k.a. "nsterm") +# +# For Apple_Terminal v71+/v100+, use "nsterm-bce". +# +# For Apple_Terminal v51+, use "nsterm-7-c" or "nsterm-7-c-s". +# +# For Apple_Terminal v41+, use "nsterm-old", or "nsterm-s". +# +# For all earlier versions (Apple_Terminal), try "nsterm-7-m" +# (monochrome) or "nsterm-7" (color); "nsterm-7-m-s" and "nsterm-7-s" +# might work too, but really you're on your own here since these +# systems are very obsolete and I can't test them. I do welcome +# patches, though :). + +# Other Terminals: +# +# For GNUstep_Terminal, you're probably best off using "linux" or +# writing your own terminfo. + +# For MacTelnet, you're on your own. It's a different codebase, and +# seems to be somewhere between "vt102", "ncsa" and "xterm-color". + +# For iTerm.app, see "iterm". + +# +# The AppKit Terminal.app descriptions all have names beginning with +# "nsterm". Note that the statusline (-s) versions use the window +# titlebar as a phony status line, and may produce warnings during +# compilation as a result ("tsl uses 0 parameters, expected 1".) +# Ignore these warnings, or even ignore these entries entirely. Apps +# which need to position the cursor or do other fancy stuff inside the +# status line won't work with these entries. They're primarily useful +# for programs like Pine which provide simple notifications in the +# status line. Please note that non-ASCII characters don't work right +# in the status line, since Terminal.app incorrectly interprets their +# Unicode codepoints as MacRoman codepoints (in earlier Mac OS X +# versions) or only accepts status lines consisting entirely of +# characters from the first 256 Unicode positions (including C1 but +# not C0 or DEL.) +# +# The Mythology* of AppKit Terminal.app: +# +# In the days of NeXTSTep 0.x and 1.x there were two incompatible +# bundled terminal emulators, Shell and Terminal. Scott Hess wrote a +# shareware replacement for Terminal called "Stuart" which NeXT bought +# and used as the basis for the Terminal.app in NeXTstep 2+, +# OPENSTEP/Mach, Apple Rhapsody, Mac OS X Server 1.0, and Mac OS X. I +# don't know the TERM_PROGRAM and TERM_PROGRAM_VERSION settings or +# capabilities for the early versions, but I believe that the +# TERM_PROGRAM_VERSION may have been reset at some point. +# +# The early versions were tailored to the NeXT character set. Sometime +# after the Apple aquisition the encoding was swiched to MacRoman +# (initally with serious altcharset bugs due to incomplete conversion +# of the old NeXT code,) and then later to UTF-8. Alos sometime during +# or just prior to the early days of Mac OS X, the Terminal grew ANSI +# 8-color support (initially buggy when combined with attributes, but +# that was later fixed.) More recently, around Mac OS X version 10.3 +# or so (Terminal.app v100+) xterm-like 16-color support was added. In +# some versions (for instance 133-1 which shipped with Mac OS X +# version 10.4) this suffered from the bug, but that seems to +# have been fixed in Mac OS X version 10.5 (Terminal.app v240.2+). +# +# In the early days of Mac OS X the terminal was fairly buggy and +# would routinely crash under load. Many of these bugs seem to have +# been fixed around Mac OS X version 10.3 (Terminal.app v100+) but +# some may still remain. This change seems to correspond to +# Terminal.app reporting "xterm-color" as $TERM rather than "vt100" as +# it did previously. +# +# * This may correspond with what actually happened, but I don't +# know. It is based on guesswork, hearsay, private correspondence, +# my faulty memory, and the following online sources and references: +# +# [1] "Three Scotts and a Duane" by Simson L. Garfinkel +# http://www.nextcomputers.org/NeXTfiles/Articles/NeXTWORLD/93.8/93.8.Dec.Community1.html +# +# [2] NeXTSTEP entry from Wikipedia, the free encyclopedia +# https://secure.wikimedia.org/wikipedia/en/wiki/Nextstep +# +# * Renamed the AppKit Terminal.app entry from "Apple_Terminal" to +# "nsterm" to comply with the name length and case conventions and +# limitations of various software packages [notably Solaris terminfo +# and UNIX.] A single Apple_Terminal alias is retained for +# backwards-compatbility. +# +# * Added function key support (F1-F4). These only work in Terminal.app +# version 51, hopefully the capabilities won't cause problems for people +# using version 41. +# +# * Added "full color" (-c) entries which support the 16-color mode in +# version 51. +# +# * By default, version 51 uses UTF-8 encoding with broken altcharset +# support, so "ASCII" (-7) entries without altcharset support were +# added. + +# nsterm - AppKit Terminal.app +# +# Apple's Mac OS X includes a Terminal.app derived from the old NeXT +# Terminal.app. It is a partial VT100 emulation with some xterm-like +# extensions. This terminfo was written to describe versions 41 +# (shipped with Mac OS X version 10.0) and 51 (shipped with Mac OS X +# version 10.1) of Terminal.app. +# +# Terminal.app runs under the Mac OS X Quartz windowing system (and +# other AppKit-supported windowing systems.) On the Mac OS X machine I +# use, the executable for Terminal.app is: +# /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal +# +# If you're looking for a description of the full-screen system +# console which runs under Apple's Darwin operating system on PowerPC +# platforms, see the "xnuppc" entry instead. +# +# There were no function keys in version 41. In version 51, there are +# four working function keys (F1, F2, F3 and F4.) The function keys +# are included in all of these entries. +# +# It does not support mouse pointer position reporting. Under some +# circumstances the cursor can be positioned using option-click; this +# works by comparing the cursor position and the selected position, +# and simulating enough cursor-key presses to move the cursor to the +# selected position. This technique fails in all but the simplest +# applications. +# +# It provides partial ANSI color support (background colors interacted +# badly with bold in version 41, though, as reflected in :ncv:.) The +# monochrome (-m) entries are useful if you've disabled color support +# or use a monochrome monitor. The full color (-c) entries are useful +# in version 51, which doesn't exhibit the background color bug. They +# also enable an xterm-compatible 16-color mode. +# +# The configurable titlebar is set using xterm-compatible sequences; +# it is used as a status bar in the statusline (-s) entries. Its width +# depends on font sizes and window sizes, but 50 characters seems to +# be the default for an 80x24 window. +# +# The MacRoman character encoding is used for some of the alternate +# characters in the "MacRoman" entries; the "ASCII" (-7) entries +# disable alternate character set support entirely, and the "VT100" +# (-acs) entries rely instead on Terminal.app's own buggy VT100 +# graphics emulation, which seems to think the character encoding is +# the old NeXT charset instead of MacRoman. The "ASCII" (-7) entries +# are useful in Terminal.app version 51, which supports UTF-8 and +# other ASCII-compatible character encodings but does not correctly +# implement VT100 graphics; once VT100 graphics are correctly +# implemented in Terminal.app, the "VT100" (-acs) entries should be +# usable in any ASCII-compatible character encoding [except perhaps +# in UTF-8, where some experts argue for disallowing alternate +# characters entirely.] +# +# Terminal.app reports "vt100" as the terminal type, but exports +# several environment variables which may aid detection in a shell +# profile (i.e. .profile or .login): +# +# TERM=vt100 +# TERM_PROGRAM=Apple_Terminal +# TERM_PROGRAM_VERSION=41 # in Terminal.app version 41 +# TERM_PROGRAM_VERSION=51 # in Terminal.app version 51 +# +# For example, the following Bourne shell script would detect the +# correct terminal type: +# +# if [ :"$TERM" = :"vt100" -a :"$TERM_PROGRAM" = :"Apple_Terminal" ] +# then +# export TERM +# if [ :"$TERM_PROGRAM_VERSION" = :41 ] +# then +# TERM="nsterm-old" +# else +# TERM="nsterm-c-7" +# fi +# fi +# +# In a C shell derivative, this would be accomplished by: +# +# if ( $?TERM && $?TERM_PROGRAM && $?TERM_PROGRAM_VERSION) then +# if ( :"$TERM" == :"vt100" && :"$TERM_PROGRAM" == :"Apple_Terminal" ) then +# if ( :"$TERM_PROGRAM_VERSION" == :41 ) then +# setenv TERM "nsterm-old" +# else +# setenv TERM "nsterm-c-7" +# endif +# endif +# endif + +# The '+' entries are building blocks +nsterm+7|AppKit Terminal.app v41+ basic capabilities w/ASCII charset, + am, bw, msgr, xenl, xon, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, + el1=\E[1K, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, + ind=^J, invis=\E[8m, kbs=\177, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kent=\EOM, rc=\E8, rev=\E[7m, ri=\EM, + rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? + %p5%t;2%;%?%p7%t;8%;m, + sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, use=vt100+enq, use=vt100+pfkeys, + +nsterm+acs|AppKit Terminal.app v41+ basic capabilities w/VT100 alternate-charset, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + enacs=\E(B\E)0, rmacs=^O, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? + %p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, use=nsterm+7, + +nsterm+mac|AppKit Terminal.app v41+ basic capabilities w/MacRoman alternate-charset, + acsc=+\335\,\334-\366.\3770#`\327a\:f\241g\261h#i + \360jjkkllmmnno\370p\370q\321rrssttuuvvwwxxy\262z\263{ + \271|\255}\243~\245, + enacs=\E(B\E)0, rmacs=^O, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? + %p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, use=nsterm+7, + +# compare with xterm+sl-twm +nsterm+s|AppKit Terminal.app v41+ status-line (window titlebar) support, + wsl#50, use=xterm+sl-twm, + +nsterm+c|AppKit Terminal.app v51+ full color support (including 16 colors), + op=\E[0m, use=ibm+16color, + +nsterm+c41|AppKit Terminal.app v41 color support, + colors#8, ncv#37, pairs#64, + op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + +# These are different combinations of the building blocks + +# ASCII charset (-7) +nsterm-m-7|nsterm-7-m|AppKit Terminal.app v41+ w/ASCII charset (monochrome), + use=nsterm+7, + +nsterm-m-s-7|nsterm-7-m-s|AppKit Terminal.app v41+ w/ASCII charset (monochrome w/statusline), + use=nsterm+s, use=nsterm+7, + +nsterm-7|AppKit Terminal.app v41+ w/ASCII charset (color), + use=nsterm+c41, use=nsterm+7, + +nsterm-7-c|nsterm-c-7|AppKit Terminal.app v51+ w/ASCII charset (full color), + use=nsterm+c, use=nsterm+7, + +nsterm-s-7|nsterm-7-s|AppKit Terminal.app v41+ w/ASCII charset (color w/statusline), + use=nsterm+s, use=nsterm+c41, use=nsterm+7, + +nsterm-c-s-7|nsterm-7-c-s|AppKit Terminal.app v51+ w/ASCII charset (full color w/statusline), + use=nsterm+s, use=nsterm+c, use=nsterm+7, + +# VT100 alternate-charset (-acs) +nsterm-m-acs|nsterm-acs-m|AppKit Terminal.app v41+ w/VT100 alternate-charset (monochrome), + use=nsterm+acs, + +nsterm-m-s-acs|nsterm-acs-m-s|AppKit Terminal.app v41+ w/VT100 alternate-charset (monochrome w/statusline), + use=nsterm+s, use=nsterm+acs, + +nsterm-acs|AppKit Terminal.app v41+ w/VT100 alternate-charset (color), + use=nsterm+c41, use=nsterm+acs, + +nsterm-c-acs|nsterm-acs-c|AppKit Terminal.app v51+ w/VT100 alternate-charset (full color), + use=nsterm+c, use=nsterm+acs, + +nsterm-s-acs|nsterm-acs-s|AppKit Terminal.app v41+ w/VT100 alternate-charset (color w/statusline), + use=nsterm+s, use=nsterm+c41, use=nsterm+acs, + +nsterm-c-s-acs|nsterm-acs-c-s|AppKit Terminal.app v51+ w/VT100 alternate-charset (full color w/statusline), + use=nsterm+s, use=nsterm+c, use=nsterm+acs, + +# MacRoman charset +nsterm-m|AppKit Terminal.app v41+ w/MacRoman charset (monochrome), + use=nsterm+mac, + +nsterm-m-s|AppKit Terminal.app v41+ w/MacRoman charset (monochrome w/statusline), + use=nsterm+s, use=nsterm+mac, + +nsterm-old|AppKit Terminal.app v41+ w/MacRoman charset (color), + use=nsterm+c41, use=nsterm+mac, + +nsterm-c|AppKit Terminal.app v51+ w/MacRoman charset (full color), + use=nsterm+c, use=nsterm+mac, + +nsterm-s|AppKit Terminal.app v41+ w/MacRoman charset (color w/statusline), + use=nsterm+s, use=nsterm+c41, use=nsterm+mac, + +nsterm-c-s|AppKit Terminal.app v51+ w/MacRoman charset (full color w/statusline), + use=nsterm+s, use=nsterm+c, use=nsterm+mac, + +# In Mac OS X version 10.5 the format of the preferences has changed +# and a new, more complex technique is needed, e.g., +# +# python -c 'import sys,objc;NSUserDefaults=objc.lookUpClass( +# "NSUserDefaults");ud=NSUserDefaults.alloc(); +# ud.init();prefs=ud.persistentDomainForName_( +# "com.apple.Terminal");prefs["Window Settings"][ +# prefs["Default Window Settings"]]["TerminalType" +# ]=sys.argv[1];ud.setPersistentDomain_forName_(prefs, +# "com.apple.Terminal")' nsterm-16color +# +# and it is still not settable from the preferences dialog. This is +# tracked under rdar://problem/7365108 and rdar://problem/7365134 +# in Apple's bug reporter. +# +# In OS X 10.7 (Leopard) the TERM which can be set in the preferences dialog +# defaults to xterm-color. Alternative selections are ansi, dtterm, rxvt, +# vt52, vt100, vt102 and xterm. +nsterm-16color|AppKit Terminal.app v240.2+ with Mac OS X version 10.5, + bw@, mir, npc, + civis=\E[?25l, cnorm=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, + flash=\E[?5h$<200/>\E[?5l, hpa=\E[%i%p1%dG, + ich=\E[%p1%d@, ich1=\E[@, kdch1=\E[3~, kend=\E[F, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[22~, kf19=\E[33~, kf20=\E[34~, kf5=\E[15~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, + knp=\E[6~, kpp=\E[5~, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, + smcup=\E7\E[?47h, smir=\E[4h, vpa=\E[%i%p1%dd, + kLFT5=\E[5D, kRIT5=\E[5C, use=nsterm-c-s-acs, + +# The versions of Terminal.app in Mac OS X version 10.3.x seem to have +# the background color erase feature. The newer version 240.2 in Mac OS X +# version 10.5 does not. +# +# This entry is based on newsgroup comments by Alain Bench, Christian Ebert, +# and D P Schreber comparing to nsterm-c-s-acs. +# +# In Mac OS X version 10.4 and earlier, D P Schreber notes that $TERM +# can be set in Terminal.app, e.g., +# +# defaults write com.apple.Terminal TermCapString nsterm-bce +# +# and that it is not set in Terminal's preferences dialog. +# +# Modified for OS X 10.8, omitting bw based on testing with tack -TD +# +# Notes: +# * The terminal description matches the default settings. +# * The keyboard is configurable via a dialog. +# * By default khome, kend, knext and kprev are honored only with a +# shift-modifier. +# * There are bindings for control left/right arrow (but not up/down). +# Added those to nsterm-16color, which is the version used for OS X 10.6 +# * "Allow VT100 application keypage mode" is by default disabled. +# There is no way to press keypad-comma unless application mode is enabled +# and used. +# * 132-column mode stopped working during vttest's tests. Consider it broken. +# * CHT, REP, SU, SD are buggy. +# * ECH works (also in Leopard), but is not used here for compatibility. +# * The terminal preferences dialog replaces xterm-color by xterm-16color and +# xterm-256color. However, it adds "nsterm", so it is possible to use the +# nsterm entry from this file to override the MacPorts (20110404) or +# system (20081102) copy of this file. +# + In OS X 10.8 (Mountain Lion) the TERM which can be set in the preferences +# dialog defaults to xterm-256color. Alternative selections are ansi, +# dtterm, rxvt, vt52, vt100, vt102, xterm and xterm-16color. However, +# the menu says "Declare terminal as" without promising to actually emulate +# the corresponding terminals. Indeed, changing TERM does not affect the +# emulation itself. This means that +# + the function-keys do not match for dtterm for kf1-kf4 as well as +# khome/kend +# + the color model is the same for each setting of TERM (does not match +# ansi or dtterm). +# + the shift/control/meta key modifiers from rxvt and xterm variants are not +# recognised except for a few special cases, i.e., kRIT5 and kLFT5. +# + the vt52 emulation does not give a usable shell because screen-clearing +# does not work as expected. +# + selecting "xterm" or "xterm-16color" sets TERM to "xterm-256color". +# + OSX 10.9 (Yosemite) added more extended keys in the default configuration +# as well as unmasking F10 (which had been used in the window manager). Those +# keys are listed in this entry. +nsterm-bce|AppKit Terminal.app v71+/v100.1.8+ with Mac OS X version 10.3/10.4 (bce), + bce, use=nsterm-16color, + +# This is tested with OS X 10.8 (Mountain Lion), 2012/08/11 +# TERM_PROGRAM_VERSION=309 +# Earlier reports state that these differences also apply to OS X 10.7 (Lion), +# TERM_PROGRAM_VERSION=303 +nsterm-256color|Terminal.app in OS X 10.8, + use=xterm+256setaf, use=nsterm-bce, + +nsterm-build326|Terminal.app in OS X 10.9, + kDC=\E[3;2~, kLFT=\E[1;2D, kRIT=\E[1;2C, kcbt=\E[Z, + kf18=\E[32~, kDC5=\E[3;5~, kDC7=\E[3;5~, kLFT3=\Eb, + kLFT5=\E[1;5D, kRIT3=\Ef, kRIT5=\E[1;5C, + use=nsterm-256color, + +# actually "343.7" +nsterm-build343|Terminal.app in OS X 10.10, + kend=\EOF, khome=\EOH, use=nsterm-build326, + +# reviewed Terminal.app in El Capitan (version 2.6 build 361) -TD +# Using vttest: +# + no vt52 mode for cursor keys, though vt52 screen works in vttest +# + f1-f4 map to pf1-pf4 +# + no vt220 support aside from DECTCEM and ECH +# + there are no protected areas. Forget about anything above vt220. +# + in ECMA-48 cursor movement, VPR and HPR fail. Others work. +# + vttest color 11.6.4 and 11.6.5 (bce for ED/EL and ECH/indexing) are bce +# + but bce fails for 11.6.7.2 (test repeat). +# + SD (11.6.7.3) also fails, but SL/SR/SU work. +# + 11.6.6 (test insert/delete char/line with bce) has several failures. +# + normal (not X10 or Highlight tracking) mouse now works. +# + mouse any-event works +# + mouse button-event works +# + in alternate screen: +# mode 47/48 work +# mode 1047 fails to restore cursor position (do not use) +# mode 1049 fails to restore screen contents (do not use) +# + dtterm window-modify operations work (some messages are not printed) +# + dtterm window-report gives size of window in characters/pixels as +# well as state of window. +# Using tack: +# + there is no difference between cnorm/cvvis +# + has dim/invis/blink (no protect of course) +# + most function keys with shift/control modifiers give beep +# (user can configure, but out-of-the-box is what I record) +# + shift-F5 is \E[25~ through shift-F12 is \E[34~ (skips \E[30~ between +# F8 and F9). +# + kLFT5/kRIT5 work, but not up/down with control-modifier +# + kLFT/kRIT work, but not up/down with shift-modifier +# + there are a few predefined bindings with Alt, but no clear pattern. +# + uses alt-key as UTF-8 "meta" something like xterm altSendsEscape +# Using ncurses test-program with xterm-new: +# + no italics +# Using xterm's scripts: +# + palette for 256-colors is hardcoded. +# + no support for "dynamic colors" +# + no support for tcap-query. +nsterm-build361|Terminal.app in OS X 10.11, + kmous=\E[M, use=nsterm-build343, + +# This is an alias which should always point to the "current" version +nsterm|Apple_Terminal|AppKit Terminal.app, + use=nsterm-build361, + +# iTerm.app from http://iterm.sourceforge.net/ is an alternative (and +# more featureful) terminal emulator for Mac OS X. It is similar +# enough in capabilities to nsterm-16color that I have derived this +# description from that one, but as far as I know they share no code. +# Many of the features are user-configurable, but I attempt only to +# describe the default configuration. +# +# NOTE: When tack tests (csr) + (nel) iTerm.app crashes, so (csr) is +# disabled. +iTerm.app|iterm|iTerm.app terminal emulator for Mac OS X, + bce, bw@, + csr@, dim@, kend=\EOF, khome=\EOH, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? + %p7%t;8%;m%?%p9%t\016%e\017%;, + use=xterm+256setaf, use=nsterm-16color, + +# xnuppc - Darwin PowerPC Console (a.k.a. "darwin") +# +# On PowerPC platforms, Apple's Darwin operating system uses a +# full-screen system console derived from a NetBSD framebuffer +# console. It is an ANSI-style terminal, and is not really VT-100 +# compatible. +# +# Under Mac OS X, this is the system console driver used while in +# single-user mode [reachable by holding down Command-S during the +# boot process] and when logged in using console mode [reachable by +# typing ">console" at the graphical login prompt.] +# +# If you're looking for a description of the Terminal.app terminal +# emulator which runs under the Mac OS X Quartz windowing system (and +# other AppKit-supported windowing systems,) see the "nsterm" +# entry instead. +# +# NOTE: Under Mac OS X version 10.1, the default login window does not +# prompt for user name, instead requiring an icon to be selected from +# a list of known users. Since the special ">console" login is not in +# this list, you must make one of two changes in the Login Window +# panel of the Login section of System Prefs to make the special +# ">console" login accessible. The first option is to enable 'Show +# "Other User" in list for network users', which will add a special +# "Other..." icon to the graphical login panel. Selecting "Other..." +# will present the regular graphical login prompt. The second option +# is to change the 'Display Login Window as:' setting to 'Name and +# password entry fields', which replaces the login panel with a +# graphical login prompt. +# +# There are no function keys, at least not in Darwin 1.3. +# +# It has no mouse support. +# +# It has full ANSI color support, and color combines correctly with +# all three supported attributes: bold, inverse-video and underline. +# However, bold colored text is almost unreadable (bolding is +# accomplished using shifting and or-ing, and looks smeared) so bold +# has been excluded from the list of color-compatible attributes +# [using (ncv)]. The monochrome entry (-m) is useful if you use a +# monochrome monitor. +# +# There is one serious bug with this terminal emulation's color +# support: repositioning the cursor onto a cell with non-matching +# colors obliterates that cell's contents, replacing it with a blank +# and displaying a colored cursor in the "current" colors. There is +# no complete workaround at present [other than using the monochrome +# (-m) entries,] but removing the (msgr) capability seemed to help. +# +# The "standout" chosen was simple reverse-video, although a colorful +# standout might be more aesthetically pleasing. Similarly, the bold +# chosen is the terminal's own smeared bold, although a simple +# color-change might be more readable. The color-bold (-b) entries +# uses magenta colored text for bolding instead. The fancy color (-f +# and -f2) entries use color for bold, standout and underlined text +# (underlined text is still underlined, though.) +# +# Apparently the terminal emulator does support a VT-100-style +# alternate character set, but all the alternate character set +# positions have been left blank in the font. For this reason, no +# alternate character set capabilities have been included in this +# description. The console driver appears to be ASCII-only, so (enacs) +# has been excluded [although the VT-100 sequence does work.] +# +# The default Mac OS X and Darwin installation reports "vt100" as the +# terminal type, and exports no helpful environment variables. To fix +# this, change the "console" entry in /etc/ttys from "vt100" to +# "xnuppc-WxH", where W and H are the character dimensions of your +# console (see below.) +# +# The font used by the terminal emulator is apparently one originally +# drawn by Ka-Ping Yee, and uses 8x16-pixel characters. This +# file includes descriptions for the following geometries: +# +# Pixels Characters Entry Name (append -m for monochrome) +# ------------------------------------------------------------------- +# 640x400 80x25 xnuppc-80x25 +# 640x480 80x30 xnuppc-80x30 +# 720x480 90x30 xnuppc-90x30 +# 800x600 100x37 xnuppc-100x37 +# 896x600 112x37 xnuppc-112x37 +# 1024x640 128x40 xnuppc-128x40 +# 1024x768 128x48 xnuppc-128x48 +# 1152x768 144x48 xnuppc-144x48 +# 1280x1024 160x64 xnuppc-160x64 +# 1600x1024 200x64 xnuppc-200x64 +# 1600x1200 200x75 xnuppc-200x75 +# 2048x1536 256x96 xnuppc-256x96 +# +# The basic "xnuppc" entry includes no size information, and the +# emulator includes no reporting capability, so you'll be at the mercy +# of the TTY device (which reports incorrectly on my hardware.) The +# color-bold entries do not include size information. + +# The '+' entries are building blocks +xnuppc+basic|Darwin PowerPC Console basic capabilities, + am, bce, mir, xenl, + it#8, + bold=\E[1m, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dsl=\E]2;\007, ed=\E[J, el=\E[K, + el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=\177, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rc=\E8, + rev=\E[7m, ri=\EM, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, + rmul=\E[m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, + sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, use=vt100+keypad, + +xnuppc+c|Darwin PowerPC Console ANSI color support, + colors#8, ncv#32, pairs#64, + op=\E[37;40m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + +xnuppc+b|Darwin PowerPC Console color-bold support, + ncv#32, + bold=\E[35m, + sgr=\E[0%?%p6%t;35%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, + use=xnuppc+basic, + +xnuppc+f|Darwin PowerPC Console fancy color support, + ncv#35, + sgr=\E[0%?%p6%t;35%;%?%p2%t;36;4%;%?%p1%t;33;44%;%?%p3%t;7%; + m, + smso=\E[33;44m, smul=\E[36;4m, use=xnuppc+b, + +xnuppc+f2|Darwin PowerPC Console alternate fancy color support, + ncv#35, + bold=\E[33m, + sgr=\E[0%?%p6%t;33%;%?%p2%t;34%;%?%p1%t;31;47%;%?%p3%t;7%;m, + smso=\E[31;47m, smul=\E[34m, use=xnuppc+basic, + +# Building blocks for specific screen sizes +xnuppc+80x25|Darwin PowerPC Console 80x25 support (640x400 pixels), + cols#80, lines#25, + +xnuppc+80x30|Darwin PowerPC Console 80x30 support (640x480 pixels), + cols#80, lines#30, + +xnuppc+90x30|Darwin PowerPC Console 90x30 support (720x480 pixels), + cols#90, lines#30, + +xnuppc+100x37|Darwin PowerPC Console 100x37 support (800x600 pixels), + cols#100, lines#37, + +xnuppc+112x37|Darwin PowerPC Console 112x37 support (896x600 pixels), + cols#112, lines#37, + +xnuppc+128x40|Darwin PowerPC Console 128x40 support (1024x640 pixels), + cols#128, lines#40, + +xnuppc+128x48|Darwin PowerPC Console 128x48 support (1024x768 pixels), + cols#128, lines#48, + +xnuppc+144x48|Darwin PowerPC Console 144x48 support (1152x768 pixels), + cols#144, lines#48, + +xnuppc+160x64|Darwin PowerPC Console 160x64 support (1280x1024 pixels), + cols#160, lines#64, + +xnuppc+200x64|Darwin PowerPC Console 200x64 support (1600x1024 pixels), + cols#200, lines#64, + +xnuppc+200x75|Darwin PowerPC Console 200x75 support (1600x1200 pixels), + cols#200, lines#75, + +xnuppc+256x96|Darwin PowerPC Console 256x96 support (2048x1536 pixels), + cols#256, lines#96, + +# These are different combinations of the building blocks + +xnuppc-m|darwin-m|Darwin PowerPC Console (monochrome), + use=xnuppc+basic, + +xnuppc|darwin|Darwin PowerPC Console (color), + use=xnuppc+c, use=xnuppc+basic, + +xnuppc-m-b|darwin-m-b|Darwin PowerPC Console (monochrome w/color-bold), + use=xnuppc+b, + +xnuppc-b|darwin-b|Darwin PowerPC Console (color w/color-bold), + use=xnuppc+b, use=xnuppc+c, + +xnuppc-m-f|darwin-m-f|Darwin PowerPC Console (fancy monochrome), + use=xnuppc+f, + +xnuppc-f|darwin-f|Darwin PowerPC Console (fancy color), + use=xnuppc+f, use=xnuppc+c, + +xnuppc-m-f2|darwin-m-f2|Darwin PowerPC Console (alternate fancy monochrome), + use=xnuppc+f2, + +xnuppc-f2|darwin-f2|Darwin PowerPC Console (alternate fancy color), + use=xnuppc+f2, use=xnuppc+c, + +# Combinations for specific screen sizes +xnuppc-80x25-m|darwin-80x25-m|Darwin PowerPC Console (monochrome) 80x25, + use=xnuppc+80x25, use=xnuppc+basic, + +xnuppc-80x25|darwin-80x25|Darwin PowerPC Console (color) 80x25, + use=xnuppc+c, use=xnuppc+80x25, use=xnuppc+basic, + +xnuppc-80x30-m|darwin-80x30-m|Darwin PowerPC Console (monochrome) 80x30, + use=xnuppc+80x30, use=xnuppc+basic, + +xnuppc-80x30|darwin-80x30|Darwin PowerPC Console (color) 80x30, + use=xnuppc+c, use=xnuppc+80x30, use=xnuppc+basic, + +xnuppc-90x30-m|darwin-90x30-m|Darwin PowerPC Console (monochrome) 90x30, + use=xnuppc+90x30, use=xnuppc+basic, + +xnuppc-90x30|darwin-90x30|Darwin PowerPC Console (color) 90x30, + use=xnuppc+c, use=xnuppc+90x30, use=xnuppc+basic, + +xnuppc-100x37-m|darwin-100x37-m|Darwin PowerPC Console (monochrome) 100x37, + use=xnuppc+100x37, use=xnuppc+basic, + +xnuppc-100x37|darwin-100x37|Darwin PowerPC Console (color) 100x37, + use=xnuppc+c, use=xnuppc+100x37, use=xnuppc+basic, + +xnuppc-112x37-m|darwin-112x37-m|Darwin PowerPC Console (monochrome) 112x37, + use=xnuppc+112x37, use=xnuppc+basic, + +xnuppc-112x37|darwin-112x37|Darwin PowerPC Console (color) 112x37, + use=xnuppc+c, use=xnuppc+112x37, use=xnuppc+basic, + +xnuppc-128x40-m|darwin-128x40-m|Darwin PowerPC Console (monochrome) 128x40, + use=xnuppc+128x40, use=xnuppc+basic, + +xnuppc-128x40|darwin-128x40|Darwin PowerPC Console (color) 128x40, + use=xnuppc+c, use=xnuppc+128x40, use=xnuppc+basic, + +xnuppc-128x48-m|darwin-128x48-m|Darwin PowerPC Console (monochrome) 128x48, + use=xnuppc+128x48, use=xnuppc+basic, + +xnuppc-128x48|darwin-128x48|Darwin PowerPC Console (color) 128x48, + use=xnuppc+c, use=xnuppc+128x48, use=xnuppc+basic, + +xnuppc-144x48-m|darwin-144x48-m|Darwin PowerPC Console (monochrome) 144x48, + use=xnuppc+144x48, use=xnuppc+basic, + +xnuppc-144x48|darwin-144x48|Darwin PowerPC Console (color) 144x48, + use=xnuppc+c, use=xnuppc+144x48, use=xnuppc+basic, + +xnuppc-160x64-m|darwin-160x64-m|Darwin PowerPC Console (monochrome) 160x64, + use=xnuppc+160x64, use=xnuppc+basic, + +xnuppc-160x64|darwin-160x64|Darwin PowerPC Console (color) 160x64, + use=xnuppc+c, use=xnuppc+160x64, use=xnuppc+basic, + +xnuppc-200x64-m|darwin-200x64-m|Darwin PowerPC Console (monochrome) 200x64, + use=xnuppc+200x64, use=xnuppc+basic, + +xnuppc-200x64|darwin-200x64|Darwin PowerPC Console (color) 200x64, + use=xnuppc+c, use=xnuppc+200x64, use=xnuppc+basic, + +xnuppc-200x75-m|darwin-200x75-m|Darwin PowerPC Console (monochrome) 200x75, + use=xnuppc+200x75, use=xnuppc+basic, + +xnuppc-200x75|darwin-200x75|Darwin PowerPC Console (color) 200x75, + use=xnuppc+c, use=xnuppc+200x75, use=xnuppc+basic, + +xnuppc-256x96-m|darwin-256x96-m|Darwin PowerPC Console (monochrome) 256x96, + use=xnuppc+256x96, use=xnuppc+basic, + +xnuppc-256x96|darwin-256x96|Darwin PowerPC Console (color) 256x96, + use=xnuppc+c, use=xnuppc+256x96, use=xnuppc+basic, + + +#### BeOS +# +# BeOS entry for Terminal program Seems to be almost ANSI +beterm|BeOS Terminal, + am, eo, mir, msgr, xenl, xon, + colors#8, cols#80, it#8, lines#25, ncv#5, pairs#64, + bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, + kend=\E[4~, kf1=\E[11~, kf10=\E[20~, kf11=\E[21~, + kf12=\E[22~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[16~, kf7=\E[17~, kf8=\E[18~, kf9=\E[19~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, + nel=^M^J, op=\E[m, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, + rmkx=\E[?4l, rmso=\E[m, rmul=\E[24m, rs1=\Ec, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + setb=\E[%p1%{40}%+%cm, setf=\E[%p1%{30}%+%cm, + sgr0=\E[0;10m, smir=\E[4h, smkx=\E[?4h, smso=\E[7m, + smul=\E[4m, u6=\E[%i%p1%d;%p2%dR, u7=\E[6n, + vpa=\E[%i%p1%dd, + +#### Linux consoles +# + +# This entry is good for the 1.2.13 or later version of the Linux console. +# +# *************************************************************************** +# * * +# * WARNING: * +# * Linuxes come with a default keyboard mapping kcbt=^I. This entry, in * +# * response to user requests, assumes kcbt=\E[Z, the ANSI/ECMA reverse-tab * +# * character. Here are the keymap replacement lines that will set this up: * +# * * +# keycode 15 = Tab Tab +# alt keycode 15 = Meta_Tab +# shift keycode 15 = F26 +# string F26 ="\033[Z" +# * * +# * This has to use a key slot which is unfortunate (any unused one will * +# * do, F26 is the higher-numbered one). The change ought to be built * +# * into the kernel tables. * +# * * +# *************************************************************************** +# +# All linux kernels since 1.2.13 (at least) set the screen size +# themselves; this entry assumes that capability. +# +linux-basic|linux console, + am, bce, eo, mir, msgr, xenl, xon, + it#8, ncv#18, U8#1, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i + \316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u + \264v\301w\302x\263y\363z\362{\343|\330}\234~\376, + bel=^G, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, + el=\E[K, el1=\E[1K, flash=\E[?5h$<200/>\E[?5l, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, kb2=\E[G, kbs=\177, + kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, + kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + kspd=^Z, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmam=\E[?7l, + rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 + %t;2%;%?%p6%t;1%;%?%p9%t;11%;m, + smam=\E[?7h, smir=\E[4h, smul=\E[4m, tbc=\E[3g, + vpa=\E[%i%p1%dd, use=vt102+enq, use=klone+sgr, + use=ecma+color, + +linux-m|Linux console no color, + colors@, pairs@, + setab@, setaf@, setb@, setf@, use=linux, + +# The 1.3.x kernels add color-change capabilities; if yours doesn't have this +# and it matters, turn off . The %02x escape used to implement this is +# not supposedly back-portable to older SV curses (although it has worked fine +# on Solaris for several years) and not supported in ncurses versions before +# 1.9.9. +linux-c-nc|linux console with color-change, + ccc, + initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/ + %02x%p4%{255}%*%{1000}%/%02x, + oc=\E]R, use=linux-basic, +# From: Dennis Henriksen , 9 July 1996 +linux-c|linux console 1.3.6+ for older ncurses, + ccc, + initc=\E]P%?%p1%{9}%>%t%p1%{10}%-%'a'%+%c%e%p1%d%;%p2%{255} + %*%{1000}%/%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'a' + %+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'a' + %+%c%e%gx%d%;%p3%{255}%*%{1000}%/%Pr%gr%{16}%/%Px%?%gx + %{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx + %{9}%>%t%gx%{10}%-%'a'%+%c%e%gx%d%;%p4%{255}%*%{1000} + %/%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx + %d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'a'%+%c%e%gx + %d%;, + oc=\E]R, use=linux-basic, + +# The 2.2.x kernels add a private mode that sets the cursor type; use that to +# get a block cursor for cvvis. +# reported by Frank Heckenbach . +linux2.2|linux 2.2.x console, + civis=\E[?25l\E[?1c, cnorm=\E[?25h\E[?0c, + cvvis=\E[?25h\E[?8c, use=linux-c-nc, + +# Linux 2.6.x has a fix for SI/SO to work with UTF-8 encoding added here: +# http://lkml.iu.edu/hypermail/linux/kernel/0602.2/0738.html +# Although the kernel has mappings for these, they were not in the default +# font (tested with Debian and Fedora): +# '`' diamond +# '~' scan line 1 +# 'p' scan line 3 +# 'r' scan line 7 +# '_' scan line 9 +linux2.6|linux 2.6.x console, + acsc=++\,\,--..00__``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwx + xyyzz{{||}c~~, + enacs=\E)0, rmacs=^O, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 + %t;2%;%?%p6%t;1%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, use=linux2.2, + +# The 3.0 kernel adds support for clearing scrollback buffer (capability E3). +# It is the same as xterm's erase-saved-lines feature. +linux3.0|linux 3.0 kernels, + E3=\E[3J, use=linux2.6, + +# This is Linux console for ncurses. +linux|linux console, + use=linux3.0, + +# Subject: linux 2.6.26 vt back_color_erase +# Changes to the Linux console driver broke bce model as reported in +# https://bugzilla.novell.com/show_bug.cgi?id=418613 +# apparently from +# http://lkml.org/lkml/2008/4/26/305 +# http://lkml.org/lkml/2008/10/3/66 +linux2.6.26|linux console w/o bce, + bce@, use=linux2.6, + +# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file +linux-nic|linux with ich/ich1 suppressed for non-curses programs, + ich@, ich1@, use=linux, + +# This assumes you have used setfont(8) to load one of the Linux koi8-r fonts. +# acsc entry from Pavel Roskin" , 29 Sep 1997. +linux-koi8|linux with koi8 alternate character set, + acsc=+\020\,\021-\030.^Y0\215`\004a\221f\234g\237h\220i + \276j\205k\203l\202m\204n\212o~p\0q\0r\0s_t\206u\207v + \211w\210x\201y\230z\231{\267|\274~\224, + use=linux, use=klone+koi8acs, + +# Another entry for KOI8-r with Qing Long's acsc. +# (which one better complies with the standard?) +linux-koi8r|linux with koi8-r alternate character set, + use=linux, use=klone+koi8acs, + +# Entry for the latin1 and latin2 fonts +linux-lat|linux with latin1 or latin2 alternate character set, + acsc=+\020\,\021-\030.^Y0\333`\004a\013f\370g\361h\260i + \316j\211k\214l\206m\203n\305o~p\304q\212r\304s_t\207u + \215v\301w\302x\205y\363z\362{\343|\330}\234~\376, + use=linux, + +# This uses graphics from VT codeset instead of from cp437. +# reason: cp437 (aka "straight to font") is not functional under luit. +# from: Andrey V Lukyanov . +linux-vt|linux console using VT codes for graphics, + acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy + yzz~~, + rmacs=\E(K, rmpch@, sgr@, sgr0=\E[0m\E(K\017, smacs=\E(0, + smpch@, use=linux, + +# This is based on the Linux console (relies on the console to perform some +# of the functionality), but does not recognize as many control sequences. +# The program comes bundled with an old (circa 1998) copy of the Linux +# console terminfo. It recognizes some non-ANSI/VT100 sequences such as +# \E* move cursor to home, as as \E[H +# \E,X same as \E(X +# \EE move cursor to beginning of row +# \E[y,xf same as \E[y,xH +# +# Note: The status-line support is buggy (dsl does not work). +kon|kon2|jfbterm|Kanji ON Linux console, + ccc@, hs, + civis@, cnorm@, cvvis@, dsl=\E[?H, flash@, fsl=\E[?F, initc@, + initp@, kcbt@, oc@, op=\E[37;40m, rs1=\Ec, tsl=\E[?T, + use=linux, + +# 16-color linux console entry; this works with a 256-character +# console font but bright background colors turn into dim ones when +# you use a 512-character console font. This uses bold for bright +# foreground colors and blink for bright background colors. +linux-16color|linux console with 16 colors, + colors#16, ncv#42, pairs#256, + setab=\E[4%p1%{8}%m%d%?%p1%{7}%>%t;5%e;25%;m, + setaf=\E[3%p1%{8}%m%d%?%p1%{7}%>%t;1%e;21%;m, + use=linux, + +# bterm (bogl 0.1.18) +# Implementation is in bogl-term.c +# Key capabilities from linux terminfo entry +# +# Notes: +# bterm only supports acs using wide-characters, has case for these: qjxamlkut +# bterm does not support sgr, since it only processes one parameter -TD +bterm|bogl virtual terminal, + am, bce, + colors#8, cols#80, lines#24, pairs#64, + acsc=aajjkkllmmqqttuuxx, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, cub1=^H, cud1=^J, + cup=\E[%i%p1%d;%p2%dH, ed=\E[J, el=\E[K, home=\E[H, ind=^J, + kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, + kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, + kmous=\E[M, knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, + op=\E[49m\E[39m, rev=\E[7m, ri=\EM, rmacs=^O, rmso=\E[27m, + rmul=\E[24m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr0=\E[0m, smacs=^N, smso=\E[7m, smul=\E[4m, + +#### Mach +# + +# From: Matthew Vernon +mach|Mach Console, + am, km, + cols#80, it#8, lines#25, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\Ec, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, home=\E[H, ht=^I, il=\E[%p1%dL, il1=\E[L, ind=^J, + kbs=\177, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[9, kend=\E[Y, kf1=\EOP, kf10=\EOY, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, + kf9=\EOX, khome=\E[H, kich1=\E[@, kll=\E[F, knp=\E[U, + kpp=\E[V, rev=\E[7m, rmso=\E[0m, rmul=\E[24m, sgr0=\E[0m, + smso=\E[7m, smul=\E[4m, +mach-bold|Mach Console with bold instead of underline, + rmul=\E[0m, smul=\E[1m, use=mach, +mach-color|Mach Console with ANSI color, + colors#8, pairs#64, + dim=\E[2m, invis=\E[8m, op=\E[37;40m, rmso=\E[27m, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=mach, + +# From: Samuel Thibault +# Source: git://git.sv.gnu.org/hurd/gnumach.git +# Files: i386/i386at/kd.c +# +# Added nel, hpa, sgr and removed rmacs, smacs based on source -TD +mach-gnu|GNU Mach, + acsc=+>\,<-\^.v0\333`+a\261f\370g\361h\260i#j\331k\277l + \332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x + \263y\363z\362{\343|\330}\234~\376, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX, + el1=\E[1K, hpa=\E[%i%p1%dG, ich=\E[%p1%d@, ich1=\E[@, + indn=\E[%p1%dS, invis=\E[8m, nel=\EE, rin=\E[%p1%dT, + sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t; + 2%;%?%p6%t;1%;%?%p7%t;8%;m, + use=mach, + +mach-gnu-color|Mach Console with ANSI color, + colors#8, pairs#64, + op=\E[37;40m, rmso=\E[27m, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, use=mach-gnu, + +# From: Marcus Brinkmann +# http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/hurd/hurd/console/ +# +# Comments in the original are summarized here: +# +# hurd uses 8-bit characters (km). +# +# Although it doesn't do XON/XOFF, we don't want padding characters (xon). +# +# Regarding compatibility to vt100: hurd doesn't specify , as we don't +# have the eat_newline_glitch. It doesn't support setting or removing tab +# stops (hts/tbc). +# +# hurd uses ^H instead of \E[D for cub1, as only ^H implements and it is +# one byte instead three. +# +# is not included because hurd has insert mode. +# +# hurd doesn't use ^J for scrolling, because this could put things into the +# scrollback buffer. +# +# gsbom/grbom are used to enable/disable real bold (not intensity bright) mode. +# This is a GNU extension. +# +# The original has commented-out ncv, but is restored here. +# +# Reading the source, RIS resets cnorm, but not xmous. +hurd|The GNU Hurd console server, + am, bce, bw, eo, km, mir, msgr, xenl, xon, + colors#8, it#8, ncv#18, pairs#64, + acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy + yzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\Ec, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[34l, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, flash=\Eg, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS, + invis=\E[8m, kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, + kend=\E[4~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf5=\E[15~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + kspd=^Z, nel=^M^J, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\E[T, + rin=\E[%p1%dT, ritm=\E[23m, rmacs=\E[10m, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, rs1=\EM\E[?1000l, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t; + 2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + sgr0=\E[0m, sitm=\E[3m, smacs=\E[11m, smir=\E[4h, + smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, grbom=\E[>1l, + gsbom=\E[>1h, + +#### QNX +# + +# QNX 4.0 Console +# Michael's original version of this entry had , , +# ; this was so terminfo applications could write the lower +# right corner without triggering a scroll. The ncurses terminfo library can +# handle this case with the capability, and prefers for better +# optimization. Bug: The capability resets attributes. +# From: Michael Hunter 30 Jul 1996 +# (removed: ) +qnx|qnx4|qnx console, + daisy, km, mir, msgr, xhpa, xt, + colors#8, cols#80, it#4, lines#25, ncv#3, pairs#8, + acsc=O\333a\261j\331k\277l\332m\300n\305o\337q\304s\334t + \303u\264v\301w\302x\263, + bel=^G, blink=\E{, bold=\E<, civis=\Ey0, clear=\EH\EJ, + cnorm=\Ey1, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\Ey2, + dch1=\Ef, dl1=\EF, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\Ee, + il1=\EE, ind=^J, kBEG=\377\356, kCAN=\377\263, + kCMD=\377\267, kCPY=\377\363, kCRT=\377\364, + kDL=\377\366, kEND=\377\301, kEOL=\377\311, + kEXT=\377\367, kFND=\377\370, kHLP=\377\371, + kHOM=\377\260, kIC=\377\340, kLFT=\377\264, + kMOV=\377\306, kMSG=\377\304, kNXT=\377\272, + kOPT=\377\372, kPRT=\377\275, kPRV=\377\262, + kRDO=\377\315, kRES=\377\374, kRIT=\377\266, + kRPL=\377\373, kSAV=\377\307, kSPD=\377\303, + kUND=\377\337, kbeg=\377\300, kcan=\377\243, kcbt=\377\0, + kclo=\377\343, kclr=\377\341, kcmd=\377\245, + kcpy=\377\265, kcrt=\377\305, kctab=\377\237, + kcub1=\377\244, kcud1=\377\251, kcuf1=\377\246, + kcuu1=\377\241, kdch1=\377\254, kdl1=\377\274, + ked=\377\314, kel=\377\310, kend=\377\250, kent=\377\320, + kext=\377\270, kf1=\377\201, kf10=\377\212, + kf11=\377\256, kf12=\377\257, kf13=\377\213, + kf14=\377\214, kf15=\377\215, kf16=\377\216, + kf17=\377\217, kf18=\377\220, kf19=\377\221, + kf2=\377\202, kf20=\377\222, kf21=\377\223, + kf22=\377\224, kf23=\377\333, kf24=\377\334, + kf25=\377\225, kf26=\377\226, kf27=\377\227, + kf28=\377\230, kf29=\377\231, kf3=\377\203, + kf30=\377\232, kf31=\377\233, kf32=\377\234, + kf33=\377\235, kf34=\377\236, kf35=\377\276, + kf36=\377\277, kf37=\377\321, kf38=\377\322, + kf39=\377\323, kf4=\377\204, kf40=\377\324, + kf41=\377\325, kf42=\377\326, kf43=\377\327, + kf44=\377\330, kf45=\377\331, kf46=\377\332, + kf47=\377\316, kf48=\377\317, kf5=\377\205, kf6=\377\206, + kf7=\377\207, kf8=\377\210, kf9=\377\211, kfnd=\377\346, + khlp=\377\350, khome=\377\240, khts=\377\342, + kich1=\377\253, kil1=\377\273, kind=\377\261, + kmov=\377\351, kmrk=\377\355, kmsg=\377\345, + knp=\377\252, knxt=\377\312, kopn=\377\357, + kopt=\377\353, kpp=\377\242, kprt=\377\255, + kprv=\377\302, krdo=\377\336, kref=\377\354, + kres=\377\360, krfr=\377\347, kri=\377\271, + krmir=\377\313, krpl=\377\362, krst=\377\352, + ksav=\377\361, kslt=\377\247, kspd=\377\335, + ktbc=\377\344, kund=\377\365, mvpa=\E!%p1%02d, op=\ER, + rep=\Eg%p2%{32}%+%c%p1%c, rev=\E(, ri=\EI, rmcup=\Eh\ER, + rmso=\E), rmul=\E], rs1=\ER, setb=\E@%p1%Pb%gb%gf%d%d, + setf=\E@%p1%Pf%gb%gf%d%d, sgr0=\E}\E]\E>\E), smcup=\Ei, + smso=\E(, smul=\E[, +# +# +qnxt|qnxt4|QNX4 terminal, + crxm, use=qnx4, +# +qnxm|QNX4 with mouse events, + maddr#1, + chr=\E/, cvr=\E", is1=\E/0t, mcub=\E/>1h, mcub1=\E/>7h, + mcud=\E/>1h, mcud1=\E/>1l\E/>9h, mcuf=\E/>1h\E/>9l, + mcuf1=\E/>7l, mcuu=\E/>6h, mcuu1=\E/>6l, rmicm=\E/>2l, + smicm=\E/>2h, use=qnx4, +# +qnxw|QNX4 windows, + xvpa, use=qnxm, +# +# Monochrome QNX4 terminal or console. Setting this terminal type will +# allow an application running on a color console to behave as if it +# were a monochrome terminal. Output will be through stdout instead of +# console writes because the term routines will recognize that the +# terminal name starts with 'qnxt'. +# +qnxtmono|Monochrome QNX4 terminal or console, + colors@, pairs@, + scp@, use=qnx4, + +# From: Federico Bianchi , 1 Jul 1998 +# (esr: commented out and to avoid warnings.) +# (TD: derive from original qnx4 entry) +qnxt2|qnx 2.15 serial terminal, + am, + civis@, cnorm@, cvvis@, dch1@, ich1@, kRES@, kRPL@, kUND@, kspd@, + rep@, rmcup@, rmso=\E>, setb@, setf@, smcup@, smso=\E<, use=qnx4, + +# QNX ANSI terminal definition +qansi-g|QNX ANSI, + am, eslok, hs, xon, + colors#8, cols#80, it#8, lines#25, ncv#19, pairs#64, wsl#80, + acsc=Oa``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[2J\E[H, cnorm=\E[?25h\E[?12l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[1M, dsl=\E[r, ech=\E[%p1%dX, ed=\E[J, + el=\E[K, el1=\E[1K\E[X, flash=\E[?5h$<200>\E[?5l, + fsl=\E[?6h\E8, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, + ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, + ind=\E[S, indn=\E[%p1%dS, invis=\E[9m, + is2=\E>\E[?1l\E[?7h\E[0;10;39;49m, is3=\E(B\E)0, + kBEG=\ENn, kCAN=\E[s, kCMD=\E[t, kCPY=\ENs, kCRT=\ENt, + kDL=\ENv, kEXT=\ENw, kFND=\ENx, kHLP=\ENy, kHOM=\E[h, + kLFT=\E[d, kNXT=\E[u, kOPT=\ENz, kPRV=\E[v, kRIT=\E[c, + kbs=^H, kcan=\E[S, kcbt=\E[Z, kclo=\ENc, kclr=\ENa, + kcmd=\E[G, kcpy=\E[g, kctab=\E[z, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[p, kend=\E[Y, + kext=\E[y, kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EOA, + kf13=\EOp, kf14=\EOq, kf15=\EOr, kf16=\EOs, kf17=\EOt, + kf18=\EOu, kf19=\EOv, kf2=\EOQ, kf20=\EOw, kf21=\EOx, + kf22=\EOy, kf23=\EOz, kf24=\EOa, kf25=\E[1~, kf26=\E[2~, + kf27=\E[3~, kf28=\E[4~, kf29=\E[5~, kf3=\EOR, kf30=\E[6~, + kf31=\E[7~, kf32=\E[8~, kf33=\E[9~, kf34=\E[10~, + kf35=\E[11~, kf36=\E[12~, kf37=\E[17~, kf38=\E[18~, + kf39=\E[19~, kf4=\EOS, kf40=\E[20~, kf41=\E[21~, + kf42=\E[22~, kf43=\E[23~, kf44=\E[24~, kf45=\E[25~, + kf46=\E[26~, kf47=\E[27~, kf48=\E[28~, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, kf9=\EOX, kfnd=\ENf, khlp=\ENh, + khome=\E[H, khts=\ENb, kich1=\E[@, kil1=\E[`, kind=\E[a, + kmov=\ENi, kmrk=\ENm, kmsg=\ENe, knp=\E[U, kopn=\ENo, + kopt=\ENk, kpp=\E[V, kref=\ENl, kres=\ENp, krfr=\ENg, + kri=\E[b, krpl=\ENr, krst=\ENj, ksav=\ENq, kslt=\E[T, + ktbc=\ENd, kund=\ENu, ll=\E[99H, nel=\EE, op=\E[39;49m, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\E[T, + rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmso=\E[27m, + rmul=\E[24m, rs1=\017\E[?7h\E[0;39;49m$<2>\E>\E[?1l, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 + %|%t;7%;%?%p7%t;9%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, + tsl=\E7\E1;24r\E[?6l\E[25;%i%p1%dH, +# +qansi|QNX ansi with console writes, + daisy, xhpa, use=qansi-g, +# +qansi-t|QNX ansi without console writes, + crxm, use=qansi, +# +qansi-m|QNX ansi with mouse, + maddr#1, + chr=\E[, cvr=\E], is1=\E[0t, mcub=\E[>1h, mcub1=\E[>7h, + mcud=\E[>1h, mcud1=\E[>1l\E[>9h, mcuf=\E[>1h\E[>9l, + mcuf1=\E[>7l, mcuu=\E[>6h, mcuu1=\E[>6l, rmicm=\E[>2l, + smicm=\E[>2h, use=qansi, +# +qansi-w|QNX ansi for windows, + xvpa, use=qansi-m, + +#### SCO consoles + +# SCO console and SOS-Syscons console for 386bsd +# (scoansi: had unknown capabilities +# :Gc=N:Gd=K:Gh=M:Gl=L:Gu=J:Gv=\072:\ +# :GC=E:GD=B:GH=D:GL=\64:GU=A:GV=\63:GR=C: +# :G1=?:G2=Z:G3=@:G4=Y:G5=;:G6=I:G7=H:G8=<:\ +# :CW=\E[M:NU=\E[N:RF=\E[O:RC=\E[P:\ +# :WL=\E[S:WR=\E[T:CL=\E[U:CR=\E[V:\ +# I renamed GS/GE/HM/EN/PU/PD/RT and added klone+sgr-dumb, based +# on the =\E[12m -- esr) +# +# klone+sgr-dumb is an error since the acsc does not match -TD +# +# In this description based on SCO's keyboard(HW) manpage list of default +# function key values: +# F13-F24 are shifted F1-F12 +# F25-F36 are control F1-F12 +# F37-F48 are shift+control F1-F12 +# +# hpa/vpa work in the console, but not in scoterm: +# hpa=\E[%p1%dG, +# vpa=\E[%p1%dd, +# +# SCO's terminfo uses +# kLFT=\E[d, +# kRIT=\E[c, +# which do not work (console or scoterm). +# +# Console documents only 3 attributes can be set with SGR (so we don't use sgr). +scoansi-old|SCO Extended ANSI standard crt (5.0.5), + OTbs, am, bce, eo, xon, + colors#8, cols#80, it#8, lines#25, pairs#64, + acsc=+/\,.-\230.\2310[5566778899\:\:;;<<==>>FFGGHHIIJJKKLLMM + NNOOPPQQRRSSTTUUVVWWXX`\204a0fxgqh2jYk?lZm@nEqDtCu4vAwB + x3yszr{c}\034~\207, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + civis=\E[=14;12C, clear=\E[H\E[2J, cnorm=\E[=10;12C, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[=0;12C, dch=\E[%p1%dP, + dch1=\E[P, dispc=\E[=%p1%dg, dl=\E[%p1%dM, dl1=\E[M, + ed=\E[m\E[J, el=\E[m\E[K, el1=\E[1K, home=\E[H, ht=^I, + hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, + ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, kbeg=\E[E, kbs=^H, + kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\177, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, + kf12=\E[X, kf13=\E[Y, kf15=\E[a, kf16=\E[b, kf17=\E[c, + kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, + kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, kf26=\E[l, + kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, kf30=\E[p, + kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, kf35=\E[u, + kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, + kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], + kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, kf5=\E[Q, + kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, + kich1=\E[L, knp=\E[G, kpp=\E[I, op=\E[0;37;40m, rc=\E8, + rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmacs=\E[10m, + rmam=\E[?7l, rmso=\E[m, rmul=\E[m, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0;10m, + smacs=\E[12m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, +scoansi-new|SCO Extended ANSI standard crt (5.0.6), + km, + civis=\E[=0c, cnorm=\E[=1c, csr=\E[%i%p1%d;%p2%dr, + cvvis=\E[=2c, mgc=\E[=r, oc=\E[51m, op=\E[50m, + rep=\E[%p1%d;%p2%db, rmm=\E[=11L, + sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%? + %p7%t;8%;%?%p9%t;12%e;10%;m, + smgb=\E[=1;0m, smgbp=\E[=1;%i%p1%dm, + smglp=\E[=2;%i%p1%dm, smgr=\E[=3;0m, + smgrp=\E[=3;%i%p1%dm, smgt=\E[=0;0m, + smgtp=\E[=0;%i%p1%dm, smm=\E[=10L, + wind=\E[%i%p1%d;%p2%d;%i%p3%d;%p4%dr, + use=scoansi-old, +# make this easy to change... +scoansi|SCO Extended ANSI standard crt, + use=scoansi-old, + +#### SGI consoles + +# Sent by Stefan Stapelberg , 24 Feb 1997, this is +# from SGI's terminfo database. SGI's entry shows F9-F12 with the codes +# for the application keypad mode. We have added iris-ansi-ap rather than +# change the original to keypad mode. +# +# (iris-ansi: added rmam/smam based on init string -- esr) +# +# This entry, and those derived from it, is used in xwsh (also known as +# winterm). Some capabilities that do not fit into the terminfo model +# include the shift- and control-functionkeys: +# +# F1-F12 generate different codes when shift or control modifiers are used. +# For example: +# F1 \E[001q +# shift F1 \E[013q +# control-F1 \E[025q +# +# In application keypad mode, F9-F12 generate codes like vt100 PF1-PF4, i.e., +# \EOP to \EOS. The shifted and control modifiers still do the same thing. +# +# The cursor keys also have different codes: +# control-up \E[162q +# control-down \E[165q +# control-left \E[159q +# control-right \E[168q +# +# shift-up \E[161q +# shift-down \E[164q +# shift-left \E[158q +# shift-right \E[167q +# +# control-tab \[072q +# +iris-ansi|iris-ansi-net|IRIS emulating 40 line ANSI terminal (almost VT100), + am, + cols#80, it#8, lines#40, + bel=^G, bold=\E[1m, clear=\E[H\E[2J, + cnorm=\E[9/y\E[12/y\E[=6l, cr=^M, cub=\E[%p1%dD, + cub1=\E[D, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, cvvis=\E[10/y\E[=1h\E[=2l\E[=6h, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=\ED, + is2=\E[?1l\E>\E[?7h\E[100g\E[0m\E7\E[r\E8, kDC=\E[P, + kEND=\E[147q, kHOM=\E[143q, kLFT=\E[158q, kPRT=\E[210q, + kRIT=\E[167q, kSPD=\E[218q, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, + kend=\E[146q, kent=^M, kf1=\E[001q, kf10=\E[010q, + kf11=\E[011q, kf12=\E[012q, kf2=\E[002q, kf3=\E[003q, + kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, + kf8=\E[008q, kf9=\E[009q, khome=\E[H, kich1=\E[139q, + knp=\E[154q, kpp=\E[150q, kprt=\E[209q, krmir=\E[146q, + kspd=\E[217q, nel=\EE, pfkey=\EP101;%p1%d.y%p2%s\E\\, + rc=\E8, rev=\E[7m, ri=\EM, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, + sc=\E7, sgr0=\E[m, smam=\E[?7h, smso=\E[1;7m, smul=\E[4m, + tbc=\E[3g, +iris-ansi-ap|IRIS ANSI in application-keypad mode, + is2=\E[?1l\E=\E[?7h, kent=\EOM, kf10=\E[010q, + kf11=\E[011q, kf12=\E[012q, kf9=\E[009q, use=iris-ansi, + +# From the man-page, this is a quasi-vt100 emulator that runs on SGI's IRIX +# (T.Dickey 98/1/24) +iris-color|xwsh|IRIX ANSI with color, + ncv#33, + csr=\E[%i%p1%d;%p2%dr, dch=\E[%p1%dP, dim=\E[2m, + ech=\E[%p1%dX, ich=\E[%p1%d@, rc=\E8, ritm=\E[23m, + rmul=\E[24m, rs1=\Ec, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sitm=\E[3m, use=vt100+enq, use=klone+color, + use=iris-ansi-ap, + +#### OpenBSD consoles +# +# From: Alexei Malinin ; October, 2011. +# +# The following terminal descriptions for the AMD/Intel PC console +# were prepared based on information contained in the OpenBSD-4.9 +# termtypes.master and wscons(4) & vga(4) manuals (2010, November). +# +# Added bce based on testing with tack -TD +# Added several capabilities to pccon+base, reading wsemul_vt100_subr.c -TD +# Changed kbs to DEL and removed keys that duplicate stty settings -TD +# +# Notes from testing with vttest: +# fails wrapping test +# no 8-bit controls +# identifies as vt200 with selective erase, but does not implement DECSCA +# no vt52 mode +# also lacks these: +# ESC # 8 DEC Screen Alignment Test (DECALN). +# CSI ? 5 h Reverse Video (DECSCNM). +# +pccon+keys|OpenBSD PC keyboard keys, + kbs=\177, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kend=\E[8~, kent=^M, kf1=\E[11~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf21=\E[35~, + kf22=\E[36~, kf23=\E[37~, kf24=\E[38~, kf3=\E[13~, + kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, khome=\E[7~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + krfr=^R, +pccon+sgr+acs0|sgr and simple ASCII pseudographics for OpenBSD PC console, + acsc=+>\,<-\^.v0#`+a\:f\\h#i#j+k+l+m+n+o~p-q-r-s_t+u+v+w+x|y + #z#{*|!}#~o, + sgr=\E[0%?%p1%p3%|%t;7%;%?%p6%t;1%;%?%p2%t;4%;m, + sgr0=\E[m, +pccon+sgr+acs|sgr and default ASCII pseudographics for OpenBSD PC console, + acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy + yzz{{||}}~~, + enacs=\E)0$<5>, rmacs=\E(B$<5>, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e + \E(B%;$<2>, + sgr0=\E[m\E(B$<5>, smacs=\E(0$<5>, +# underline renders as color +pccon+colors|ANSI colors for OpenBSD PC console, + bce, + colors#8, ncv#2, pairs#64, + op=\E[47;30m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, +pccon+base|base capabilities for OpenBSD PC console, + am, km, mc5i, msgr, npc, nxon, xenl, xon, + cols#80, it#8, lines#24, + bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, + el=\E[K, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + il1=\E[L, ind=\ED, nel=\EE, rev=\E[7m, ri=\EM, rmam=\E[?7l, + rmso=\E[27m, rmul=\E[24m, rs2=\Ec$<50>, smam=\E[?7h, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, + u7=\E[6n, +pccon0-m|OpenBSD PC console without colors & with simple ASCII pseudographics, + use=pccon+sgr+acs0, use=pccon+base, use=pccon+keys, +pccon0|OpenBSD PC console with simple ASCII pseudographics, + use=pccon0-m, use=pccon+colors, +pccon-m|OpenBSD PC console without colors, + use=pccon+base, use=pccon+sgr+acs, use=pccon+keys, +pccon|OpenBSD PC console, + use=pccon-m, use=pccon+colors, + +#### NetBSD consoles +# +# pcvt termcap database entries (corresponding to release 3.31) +# Author's last edit-date: [Fri Sep 15 20:29:10 1995] +# +# (For the terminfo master file, I translated these into terminfo syntax. +# Then I dropped all the pseudo-HP entries. we don't want and can't use +# the :Xs: flag. Then I split :is: into a size-independent and a +# size-dependent . Finally, I added / -- esr) + +# NOTE: has been taken out of this entry. for reference, it should +# be . For discussion, see ICH/ICH1 VERSUS RMIR/SMIR below. +# (esr: added and to resolve NetBSD Problem Report #4583) +pcvtXX|pcvt vt200 emulator (DEC VT220), + am, km, mir, msgr, xenl, + it#8, vt#3, + acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy + yzz~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=\ED, indn=\E[%p1%dS, + is1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kbs=\177, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kf1=\E[17~, kf2=\E[18~, kf3=\E[19~, + kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, + khome=\E[1~, kich1=\E[2~, kll=\E[4~, knp=\E[6~, kpp=\E[5~, + nel=\EE, rc=\E8, rev=\E[7m, rf=/usr/share/tabset/vt100, + ri=\EM, rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\Ec\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + +# NetBSD/FreeBSD vt220 terminal emulator console (pc keyboard & monitor) +# termcap entries for pure VT220-Emulation and 25, 28, 35, 40, 43 and +# 50 lines entries; 80 columns +pcvt25|dec vt220 emulation with 25 lines, + cols#80, lines#25, + is2=\E[1;25r\E[25;1H, use=pcvtXX, +pcvt28|dec vt220 emulation with 28 lines, + cols#80, lines#28, + is2=\E[1;28r\E[28;1H, use=pcvtXX, +pcvt35|dec vt220 emulation with 35 lines, + cols#80, lines#35, + is2=\E[1;35r\E[35;1H, use=pcvtXX, +pcvt40|dec vt220 emulation with 40 lines, + cols#80, lines#40, + is2=\E[1;40r\E[40;1H, use=pcvtXX, +pcvt43|dec vt220 emulation with 43 lines, + cols#80, lines#43, + is2=\E[1;43r\E[43;1H, use=pcvtXX, +pcvt50|dec vt220 emulation with 50 lines, + cols#80, lines#50, + is2=\E[1;50r\E[50;1H, use=pcvtXX, + +# NetBSD/FreeBSD vt220 terminal emulator console (pc keyboard & monitor) +# termcap entries for pure VT220-Emulation and 25, 28, 35, 40, 43 and +# 50 lines entries; 132 columns +pcvt25w|dec vt220 emulation with 25 lines and 132 cols, + cols#132, lines#25, + is2=\E[1;25r\E[25;1H, use=pcvtXX, +pcvt28w|dec vt220 emulation with 28 lines and 132 cols, + cols#132, lines#28, + is2=\E[1;28r\E[28;1H, use=pcvtXX, +pcvt35w|dec vt220 emulation with 35 lines and 132 cols, + cols#132, lines#35, + is2=\E[1;35r\E[35;1H, use=pcvtXX, +pcvt40w|dec vt220 emulation with 40 lines and 132 cols, + cols#132, lines#40, + is2=\E[1;40r\E[40;1H, use=pcvtXX, +pcvt43w|dec vt220 emulation with 43 lines and 132 cols, + cols#132, lines#43, + is2=\E[1;43r\E[43;1H, use=pcvtXX, +pcvt50w|dec vt220 emulation with 50 lines and 132 cols, + cols#132, lines#50, + is2=\E[1;50r\E[50;1H, use=pcvtXX, + +# OpenBSD implements a color variation +pcvt25-color|dec vt220 emulation with 25 lines and color, + cols#80, lines#25, + is2=\E[1;25r\E[25;1H, kf1=\EOP, kf10=\E[29~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf5=\E[17~, + kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, use=pcvtXX, + use=ecma+color, + +# Terminfo entries to enable the use of the ncurses library in colour on a +# NetBSD-arm32 console (only tested on a RiscPC). +# Created by Dave Millen 22.07.98 +# modified codes for setf/setb to setaf/setab, then to klone+color, corrected +# typo in invis - TD +arm100|arm100-am|Arm(RiscPC) ncurses compatible (for 640x480), + am, bce, msgr, xenl, xon, + cols#80, it#8, lines#30, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, + invis=\E[8m$<2>, ka1=\E[q, ka3=\E[s, kb2=\E[r, kbs=^H, + kc1=\E[p, kc3=\E[n, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kent=\E[M, kf0=\E[y, kf1=\E[P, kf10=\E[x, + kf2=\E[Q, kf3=\E[R, kf4=\E[S, kf5=\E[t, kf6=\E[u, kf7=\E[v, + kf8=\E[l, kf9=\E[w, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, + rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, + rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<2>, + sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, use=ecma+sgr, + use=klone+color, + +arm100-w|arm100-wam|Arm(RiscPC) ncurses compatible (for 1024x768), + cols#132, lines#50, use=arm100, + +# NetBSD/x68k console vt200 emulator. This port runs on a 68K machine +# manufactured by Sharp for the Japenese market. +# From Minoura Makoto , 12 May 1996 +x68k|x68k-ite|NetBSD/x68k ITE, + cols#96, lines#32, + kbs=\177,kclr=\E[9~, khlp=\E[28~, use=vt220, + +# : +# Entry for the DNARD OpenFirmware console, close to ANSI but not quite. +# +# (still unfinished, but good enough so far.) +ofcons|DNARD OpenFirmware console, + bw, + cols#80, lines#30, + bel=^G, blink=\2335m, bold=\2331m, clear=^L, cr=^M, + cub=\233%p1%dD, cub1=\233D, cud=\233%p1%dB, cud1=\233B, + cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH, + cuu=\233%p1%dA, cuu1=\233A, dch=\233%p1%dP, dch1=\233P, + dim=\2332m, dl=\233%p1%dM, dl1=\233M, ed=\233J, el=\233K, + flash=^G, ht=^I, ich=\233%p1%d@, ich1=\233@, il=\233%p1%dL, + il1=\233L, ind=^J, invis=\2338m, kbs=^H, kcub1=\233D, + kcud1=\233B, kcuf1=\233C, kcuu1=\233A, kdch1=\233P, + kf1=\2330P, kf10=\2330M, kf2=\2330Q, kf3=\2330W, + kf4=\2330x, kf5=\2330t, kf6=\2330u, kf7=\2330q, kf8=\2330r, + kf9=\2330p, knp=\233/, kpp=\233?, nel=^M^J, rev=\2337m, + rmso=\2330m, rmul=\2330m, + sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t2%;%?%p7%t8 + %;%?%p1%p3%|%t;7%;m, + sgr0=\2330m, smso=\2337m, smul=\2334m, + +# NetBSD "wscons" emulator in vt220 mode. +# This entry is based on the NetBSD termcap entry. +# +# Testing the emulator and reading the source code (NetBSD 2.0), it appears +# that "vt220" is inaccurate. There are a few vt220-features, but most of the +# vt220 screens in vttest do not work with this emulator. For instance, it +# identifies itself (primary DA response) as a vt220 with selective erase. But +# the selective erase feature does not work. The secondary response is copied +# from Kermit's emulation of vt220, does not correspond to actual vt220. At +# the level of detail in a termcap, it is a passable emulator, since ECH does +# work. Don't use it on a VMS system -TD +wsvt25|NetBSD wscons in 25 line DEC VT220 mode, + bce, msgr, + colors#8, cols#80, it#8, lines#25, pairs#64, + civis=\E[?25l, cnorm=\E[?25h, is2=\E[r\E[25;1H, + kdch1=\E[3~, kend=\E[8~, kf1=\E[11~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~, + kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, khome=\E[7~, op=\E[m, rs1=\Ec, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=vt220, + +wsvt25m|NetBSD wscons in 25 line DEC VT220 mode with Meta, + km, use=wsvt25, + +# NetBSD 6.x still uses wscons, with minor changes (2014/02/22) -TD +# +# TERM is by default vt100 for the console, wsvt25 for other ttys. +# Initial testing set TERM=xterm, based on comments by developers, found too +# many differences to continue in that path. However, test-results may be +# useful to people curious about compatibility with xterm. +# +# Testing with tack: +# ----------------- +# Failed: cbt, bel, flash, cvvis, smul (color), blink, invis +# There is color-bleeding in the color-pairs screen. +# Attributes do not work with color +# Failed: vpa/hpa +# Failed: kf1-kf4, kf13-kf48, khome, kend +# (effectively xterm-r6 for function-keys) +# None of the function or cursor key-modifiers are encoded. +# Console hangs in the smm/rmm test if TERM=xterm, does not show test +# +# Testing with vttest: +# ------------------- +# Identifies as vt220 with selective erase +# (however, selective erase refers to DECSCA, SPA) +# Does not implement vt52 +# Uses spaces to simulate double-size characters +# Does not support 8-bit controls +# Does not support VT220 reports +# Does not support send/receive mode +# Supports ECH (like rxvt) +# Does not support DECSCA +# Does not support any of the ISO-6429 cursor-movement +# Does not support any of the ISO-6429 miscellaneous tests +# (SL/SR also leave unexpected char on screen too) +# Background does not change in menu 11.6.9 (SGR 22-27) +# None of the xterm special features tests work +netbsd6|NetBSD wscons in 25 line DEC VT100 mode, + kbs=\177, use=wsvt25, + +# `rasterconsole' provided by 4.4BSD, NetBSD and OpenBSD on SPARC, and +# DECstation/pmax. +rcons|BSD rasterconsole, + use=sun-il, +# Color version of above. Color currently only provided by NetBSD. +rcons-color|BSD rasterconsole with ANSI color, + bce, + colors#8, pairs#64, + op=\E[m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=rcons, + +# mgterm -- MGL/MGL2, MobileGear Graphic Library +# for PocketBSD,PocketLinux,NetBSD/{hpcmips,mac68k} +# -- the setf/setb are probably incorrect, more likely setaf/setab -TD +# -- compare with cons25w +mgterm, + OTbs, OTpt, am, bce, bw, eo, km, msgr, npc, + colors#8, cols#80, it#8, lines#18, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[30;1m, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, kb2=\E[E, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[F, + kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf2=\E[N, + kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, + kf9=\E[U, khome=\E[H, kich1=\E[L, knp=\E[G, kpp=\E[I, + nel=\E[E, op=\E[x, rc=\E8, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, + rmso=\E[m, rs2=\E[x\E[m\Ec, sc=\E7, setb=\E[4%p1%dm, + setf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, + +#### FreeBSD console entries +# +# From: Andrey Chernov 29 Mar 1996 +# Andrey Chernov maintains the FreeBSD termcap distributions. +# +# Note: Users of FreeBSD 2.1.0 and older versions must either upgrade +# or comment out the :cb: capability in the console entry. +# +# Alexander Lukyanov reports: +# I have seen FreeBSD-2.1.5R... The old el1 bug changed, but it is still there. +# Now el1 clears not only to the line beginning, but also a large chunk +# of previous line. But there is another bug - ech does not work at all. +# + +# for syscons +# common entry without semigraphics +# Bug: The capability resets attributes. +# Bug? The ech and el1 attributes appear to move the cursor in some cases; for +# instance el1 does if the cursor is moved to the right margin first. Removed +# by T.Dickey 97/5/3 (ech=\E[%p1%dX, el1=\E[1K) +# +# Setting colors turns off reverse; we cannot guarantee order, so use ncv. +# Note that this disables standout with color. +# +# The emulator sends difference strings based on shift- and control-keys, +# like scoansi: +# F13-F24 are shifted F1-F12 +# F25-F36 are control F1-F12 +# F37-F48 are shift+control F1-F12 +cons25w|ansiw|ansi80x25-raw|freebsd console (25-line raw mode), + am, bce, bw, eo, msgr, npc, + colors#8, cols#80, it#8, lines#25, ncv#21, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cnorm=\E[=0C, cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, + cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[=1C, dch=\E[%p1%dP, dch1=\E[P, dim=\E[30;1m, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, kb2=\E[E, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[F, + kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf13=\E[Y, + kf14=\E[Z, kf15=\E[a, kf16=\E[b, kf17=\E[c, kf18=\E[d, + kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, kf22=\E[h, + kf23=\E[i, kf24=\E[j, kf25=\E[k, kf26=\E[l, kf27=\E[m, + kf28=\E[n, kf29=\E[o, kf3=\E[O, kf30=\E[p, kf31=\E[q, + kf32=\E[r, kf33=\E[s, kf34=\E[t, kf35=\E[u, kf36=\E[v, + kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, kf40=\E[z, + kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], kf45=\E[\^, + kf46=\E[_, kf47=\E[`, kf48=\E[{, kf5=\E[Q, kf6=\E[R, + kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, kich1=\E[L, + knp=\E[G, kpp=\E[I, nel=\E[E, op=\E[x, rc=\E8, rev=\E[7m, + ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, rs2=\E[x\E[m\Ec, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p1%t;2;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;30;1%;%? + %p6%t;1%;m, + sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, +cons25|ansis|ansi80x25|freebsd console (25-line ansi mode), + acsc=-\030.^Y0\333`\004a\260f\370g\361h\261i\025j\331k\277l + \332m\300n\305q\304t\303u\264v\301w\302x\263y\363z\362~ + \371, + use=cons25w, +cons25-debian|freebsd console with debian backspace (25-line ansi mode), + kbs=\177, kdch1=\E[3~, use=cons25, +cons25-m|ansis-mono|ansi80x25-mono|freebsd console (25-line mono ansi mode), + colors@, pairs@, + bold@, dim@, op@, rmul=\E[m, setab@, setaf@, + sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, + smul=\E[4m, use=cons25, +cons30|ansi80x30|freebsd console (30-line ansi mode), + lines#30, use=cons25, +cons30-m|ansi80x30-mono|freebsd console (30-line mono ansi mode), + lines#30, use=cons25-m, +cons43|ansi80x43|freebsd console (43-line ansi mode), + lines#43, use=cons25, +cons43-m|ansi80x43-mono|freebsd console (43-line mono ansi mode), + lines#43, use=cons25-m, +cons50|ansil|ansi80x50|freebsd console (50-line ansi mode), + lines#50, use=cons25, +cons50-m|ansil-mono|ansi80x50-mono|freebsd console (50-line mono ansi mode), + lines#50, use=cons25-m, +cons60|ansi80x60|freebsd console (60-line ansi mode), + lines#60, use=cons25, +cons60-m|ansi80x60-mono|freebsd console (60-line mono ansi mode), + lines#60, use=cons25-m, +cons25r|pc3r|ibmpc3r|cons25-koi8-r|freebsd console w/koi8-r cyrillic, + acsc=-\030.^Y0\215`\004a\220f\234h\221i\025j\205k\203l\202m + \204n\212q\0t\206u\207v\211w\210x\201y\230z\231~ + \225, + use=cons25w, +cons25r-m|pc3r-m|ibmpc3r-mono|cons25-koi8r-m|freebsd console w/koi8-r cyrillic (mono), + colors@, pairs@, + op@, rmul=\E[m, setab@, setaf@, + sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 + %t;30;1%;%?%p6%t;1%;m, + smul=\E[4m, use=cons25r, +cons50r|cons50-koi8r|freebsd console w/koi8-r cyrillic (50 lines), + lines#50, use=cons25r, +cons50r-m|cons50-koi8r-m|freebsd console w/koi8-r cyrillic (50-line mono), + lines#50, use=cons25r-m, +cons60r|cons60-koi8r|freebsd console w/koi8-r cyrillic (60 lines), + lines#60, use=cons25r, +cons60r-m|cons60-koi8r-m|freebsd console w/koi8-r cyrillic (60-line mono), + lines#60, use=cons25r-m, +# ISO 8859-1 FreeBSD console +cons25l1|cons25-iso8859|freebsd console w/iso 8859-1 chars, + acsc=+\253\,\273-\030.\031`\201a\202f\207g\210i\247j\213k + \214l\215m\216n\217o\220p\221q\222r\223s\224t\225u + \226v\227w\230x\231y\232z\233~\237, + use=cons25w, +cons25l1-m|cons25-iso-m|freebsd console w/iso 8859-1 chars (mono), + colors@, pairs@, + bold@, dim@, op@, rmul=\E[m, setab@, setaf@, + sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, + smul=\E[4m, use=cons25l1, +cons50l1|cons50-iso8859|freebsd console w/iso 8859-1 chars (50 lines), + lines#50, use=cons25l1, +cons50l1-m|cons50-iso-m|freebsd console w/iso 8859-1 chars (50-line mono), + lines#50, use=cons25l1-m, +cons60l1|cons60-iso|freebsd console w/iso 8859-1 chars (60 lines), + lines#60, use=cons25l1, +cons60l1-m|cons60-iso-m|freebsd console w/iso 8859-1 chars (60-line mono), + lines#60, use=cons25l1-m, + +# Starting with FreeBSD 8, an alternative configuration for syscons is provided, +# which is intended to be xterm-compatible. See for example +# http://svnweb.freebsd.org/base/stable/8/sys/dev/syscons/ +# in particular scterm-teken.c +# +# For FreeBSD 9 and 10: +# -------------------- +# The /etc/ttys entries for console and other ttys are all configured to set +# TERM=xterm. +# +# Testing with tack: +# There is no VT100 line-drawing (uses +'s and -'s) +# Shifted f1-f12 give cons25 codes, rather than xterm function-keys +# +# Testing with vttest: +# Menu 2 diamonds don't work, blink ditto, light background ditto +# The terminal identifies itself as VT100 with AVO +# There is no VT52 support +# There is no doublesize character support +# The terminal supports ECH (like rxvt) +# The terminal does not support send/receive mode +# The terminal supports all of the ISO-6429 cursor-movement +# The terminal supports some of the ISO-6429 miscellaneous tests +# (SL/SR also leave unexpected char on screen too) +# +# Considering cons25 as a base, the line-drawing mostly works, but is missing +# the cells which happen to have ASCII control-character values: +# - ^X arrow pointing up +# . ^Y arrow pointing down +# i ^Y lantern +# ` ^D diamond +# +# Those are removed from this entry's acsc string to avoid confusion. +# The resulting description provides correct line-drawing and function-keys -TD +teken|syscons with teken, + bw@, mir, xenl, + acsc=0\333a\260f\370g\361h\261j\331k\277l\332m\300n\305q + \304t\303u\264v\301w\302x\263y\363z\362~\371, + civis=\E[?25l, cnorm=\E[?25h, cvvis@, hpa=\E[%i%p1%dG, + hts=\EH, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kend=\E[F, kent=^M, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rmir=\E[4l, + smir=\E[4h, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, + u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd, use=cons25, + +#### 386BSD and BSD/OS Consoles +# + +# This was the original 386BSD console entry (I think). +# Some places it's named oldpc3|oldibmpc3. +# From: Alex R.N. Wetmore +origpc3|origibmpc3|IBM PC 386BSD Console, + OTbs, am, bw, eo, xon, + cols#80, lines#25, + acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x + \263, + bold=\E[7m, clear=\Ec, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, ind=\E[S, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, khome=\E[Y, ri=\E[T, rmso=\E[1;0x\E[2;7x, + rmul=\E[1;0x\E[2;7x, sgr0=\E[m\E[1;0x\E[2;7x, + smso=\E[1;7x\E[2;0x, smul=\E[1;7x\E[2;0x, + +# description of BSD/386 console emulator in version 1.0 (supplied by BSDI) +oldpc3|oldibmpc3|old IBM PC BSD/386 Console, + OTbs, km, + lines#25, + bel=^G, bold=\E[=15F, cr=^M, cud1=^J, dim=\E[=8F, dl1=\E[M, + ht=^I, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L, kll=\E[F, + knp=\E[G, kpp=\E[I, nel=^M^J, sgr0=\E[=R, + +# Description of BSD/OS console emulator in version 1.1, 2.0, 2.1 +# Note, the emulator supports many of the additional console features +# listed in the iBCS2 (e.g. character-set selection) though not all +# are described here. This entry really ought to be upgraded. +# Also note, the console will also work with fewer lines after doing +# "stty rows NN", e.g. to use 24 lines. +# (Color support from Kevin Rosenberg , 2 May 1996) +# Bug: The capability resets attributes. +bsdos-pc|IBM PC BSD/OS Console, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;1%;%?%p3%t;7%;%?%p4%t;5%;%?%p6 + %t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + use=bsdos-pc-nobold, + +bsdos-pc-nobold|BSD/OS PC console w/o bold, + use=klone+color, use=bsdos-pc-m, + +bsdos-pc-m|bsdos-pc-mono|BSD/OS PC console mono, + OTbs, am, eo, km, xon, + cols#80, it#8, lines#25, + bel=^G, clear=\Ec, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kich1=\E[L, + kll=\E[F, knp=\E[G, kpp=\E[I, nel=^M^J, rc=\E8, sc=\E7, + sgr=\E[0;10%?%p1%t;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7 + %t;8%;%?%p9%t;11%;m%?%p5%t\E[=8F%;, + use=klone+sgr8, + +# Old names for BSD/OS PC console used in releases before 4.1. +pc3|BSD/OS on the PC Console, + use=bsdos-pc-nobold, +ibmpc3|pc3-bold|BSD/OS on the PC Console with bold instead of underline, + use=bsdos-pc, + +# BSD/OS on the SPARC +bsdos-sparc|Sun SPARC BSD/OS Console, + use=sun, + +# BSD/OS on the PowerPC +bsdos-ppc|PowerPC BSD/OS Console, + use=bsdos-pc, + + +#### DEC VT52 +# (// capabilities aren't in DEC's official entry -- esr) +# +# Actually (TD pointed this out at the time the acsc string was added): +# vt52 shouldn't define full acsc since most of the cells don't match. +# see vt100 manual page A-31. This is the list that does match: +# f degree +# g plus/minus +# h right-arrow +# k down-arrow +# m scan-1 +# o scan-3 +# q scan-5 +# s scan-7 +# The line-drawing happens to work in several terminal emulators, but should +# not be used as a guide to the capabilities of the vt52. Note in particular +# that vt52 does not support line-drawing characters (the scan-X values refer +# to a crude plotting feature) -TD +vt52|dec vt52, + OTbs, + cols#80, it#8, lines#24, + acsc=+h.k0affggolpnqprrss, bel=^G, clear=\EH\EJ, cr=^M, + cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, + +#### DEC VT100 and compatibles +# +# DEC terminals from the vt100 forward are collected here. Older DEC terminals +# and micro consoles can be found in the `obsolete' section. More details on +# the relationship between the VT100 and ANSI X3.64/ISO 6429/ECMA-48 may be +# found near the end of this file. +# +# Except where noted, these entries are DEC's official terminfos. +# Contact Bill Hedberg of Terminal Support +# Engineering for more information. Updated terminfos and termcaps +# are kept available at ftp://gatekeeper.dec.com/pub/DEC/termcaps. +# +# In October 1995 DEC sold its terminals business, including the VT and Dorio +# line and trademark, to SunRiver Data Systems. SunRiver has since changed +# its name to Boundless Technologies; see http://www.boundless.com. +# + +# NOTE: Any VT100 emulation, whether in hardware or software, almost +# certainly includes what DEC called the `Level 1 editing extension' codes; +# only the very oldest VT100s lacked these and there probably aren't any of +# those left alive. To capture these, use one of the VT102 entries. +# +# Note that the glitch in vt100 is not quite the same as on the Concept, +# since the cursor is left in a different position while in the +# weird state (concept at beginning of next line, vt100 at end +# of this line) so all versions of vi before 3.7 don't handle +# right on vt100. The correct way to handle is when +# you output the char in column 80, immediately output CR LF +# and then assume you are in column 1 of the next line. If +# is on, am should be on too. +# +# I assume you have smooth scroll off or are at a slow enough baud +# rate that it doesn't matter (1200? or less). Also this assumes +# that you set auto-nl to "on", if you set it off use vt100-nam +# below. +# +# The padding requirements listed here are guesses. It is strongly +# recommended that xon/xoff be enabled, as this is assumed here. +# +# The vt100 uses and rather than // because the +# tab settings are in non-volatile memory and don't need to be +# reset upon login. Also setting the number of columns glitches +# the screen annoyingly. You can type "reset" to get them set. +# +# The VT100 series terminals have cursor ("arrows") keys which can operate +# in two different modes: Cursor Mode and Application Mode. Cursor Mode +# is the reset state, and is assumed to be the normal state. Application +# Mode is the "set" state. In Cursor Mode, the cursor keys transmit +# "Esc [ {code}" sequences, conforming to ANSI standards. In Application +# Mode, the cursor keys transmit "Esc O " sequences. Application Mode +# was provided primarily as an aid to the porting of VT52 applications. It is +# assumed that the cursor keys are normally in Cursor Mode, and expected that +# applications such as vi will always transmit the string. Therefore, +# the definitions for the cursor keys are made to match what the terminal +# transmits after the string is transmitted. If the string +# is a null string or is not defined, then cursor keys are assumed to be in +# "Cursor Mode", and the cursor keys definitions should match that assumption, +# else the application may fail. It is also expected that applications will +# always transmit the string to the terminal before they exit. +# +# The VT100 series terminals have an auxiliary keypad, commonly referred to as +# the "Numeric Keypad", because it is a cluster of numeric and function keys. +# The Numeric Keypad which can operate in two different modes: Numeric Mode and +# Application Mode. Numeric Mode is the reset state, and is assumed to be +# the normal state. Application Mode is the "set" state. In Numeric Mode, +# the numeric and punctuation keys transmit ASCII 7-bit characters, and the +# Enter key transmits the same as the Return key (Note: the Return key +# can be configured to send either LF (\015) or CR LF). In Application Mode, +# all the keypad keys transmit "Esc O {code}" sequences. The PF1 - PF4 keys +# always send the same "Esc O {code}" sequences. It is assumed that the keypad +# is normally in Numeric Mode. If an application requires that the keypad be +# in Application Mode then it is expected that the user, or the application, +# will set the TERM environment variable to point to a terminfo entry which has +# defined the string to include the codes that switch the keypad into +# Application Mode, and the terminfo entry will also define function key +# fields to match the Application Mode control codes. If the string +# is a null string or is not defined, then the keypad is assumed to be in +# Numeric Mode. If the string switches the keypad into Application +# Mode, it is expected that the string will contain the control codes +# necessary to reset the keypad to "Normal" mode, and it is also expected that +# applications which transmit the string will also always transmit the +# string to the terminal before they exit. +# +# Here's a diagram of the VT100 keypad keys with their bindings. +# The top line is the name of the key (some DEC keyboards have the keys +# labelled somewhat differently, like GOLD instead of PF1, but this is +# the most "official" name). The second line is the escape sequence it +# generates in Application Keypad mode (where "$" means the ESC +# character). The third line contains two items, first the mapping of +# the key in terminfo, and then in termcap. +# _______________________________________ +# | PF1 | PF2 | PF3 | PF4 | +# | $OP | $OQ | $OR | $OS | +# |_kf1__k1_|_kf2__k2_|_kf3__k3_|_kf4__k4_| +# | 7 8 9 - | +# | $Ow | $Ox | $Oy | $Om | +# |_kf9__k9_|_kf10_k;_|_kf0__k0_|_________| +# | 4 | 5 | 6 | , | +# | $Ot | $Ou | $Ov | $Ol | +# |_kf5__k5_|_kf6__k6_|_kf7__k7_|_kf8__k8_| +# | 1 | 2 | 3 | | +# | $Oq | $Or | $Os | enter | +# |_ka1__K1_|_kb2__K2_|_ka3__K3_| $OM | +# | 0 | . | | +# | $Op | $On | | +# |___kc1_______K4____|_kc3__K5_|_kent_@8_| +# +# Note however, that the arrangement of the 5-key ka1-kc3 do not follow the +# terminfo guidelines. That is a compromise used to assign the remaining +# keys on the keypad to kf5-kf0, used on older systems with legacy termcap +# support: +vt100+keypad|dec vt100 numeric keypad no fkeys, + ka1=\EOq, ka3=\EOs, kb2=\EOr, kc1=\EOp, kc3=\EOn, +vt100+pfkeys|dec vt100 numeric keypad, + kent=\EOM, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + use=vt100+keypad, +vt100+fnkeys|dec vt100 numeric keypad, + kf0=\EOy, kf10=\EOx, kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, + kf9=\EOw, use=vt100+pfkeys, +# +# A better adaptation to modern keyboards such as the PC's, which have a dozen +# function keys and the keypad 2,4,6,8 keys are labeled with arrows keys, is to +# use the 5-key arrangement to model the arrow keys as suggested in the +# terminfo guidelines: +# _______________________________________ +# | PF1 | PF2 | PF3 | PF4 | +# | $OP | $OQ | $OR | $OS | +# |_kf1__k1_|_kf2__k2_|_kf3__k3_|_kf4__k4_| +# | 7 8 9 - | +# | $Ow | $Ox | $Oy | $Om | +# |_ka1__K1_|_________|_ka3__K3_|_________| +# | 4 | 5 | 6 | , | +# | $Ot | $Ou | $Ov | $Ol | +# |_________|_kb2__K2_|_________|_________| +# | 1 | 2 | 3 | | +# | $Oq | $Or | $Os | enter | +# |_kc1__K4_|_________|_kc3__K5_| $OM | +# | 0 | . | | +# | $Op | $On | | +# |___________________|_________|_kent_@8_| +# +vt220+keypad|dec vt220 numeric keypad, + ka1=\EOw, ka3=\EOy, kb2=\EOu, kc1=\EOq, kc3=\EOs, kent=\EOM, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, ka2=\EOx, kb1=\EOt, + kb3=\EOv, kc2=\EOr, +# +vt100+enq|ncurses extension for vt100-style ENQ, + u8=\E[?1;2c, use=ansi+enq, +vt102+enq|ncurses extension for vt102-style ENQ, + u8=\E[?6c, use=ansi+enq, +# +# And here, for those of you with orphaned VT100s lacking documentation, is +# a description of the soft switches invoked when you do `Set Up'. +# +# Scroll 0-Jump Shifted 3 0-# +# | 1-Smooth | 1-British pound sign +# | Autorepeat 0-Off | Wrap Around 0-Off +# | | 1-On | | 1-On +# | | Screen 0-Dark Bkg | | New Line 0-Off +# | | | 1-Light Bkg | | | 1-On +# | | | Cursor 0-Underline | | | Interlace 0-Off +# | | | | 1-Block | | | | 1-On +# | | | | | | | | +# 1 1 0 1 1 1 1 1 0 1 0 0 0 0 1 0 <--Standard Settings +# | | | | | | | | +# | | | Auto XON/XOFF 0-Off | | | Power 0-60 Hz +# | | | 1-On | | | 1-50 Hz +# | | Ansi/VT52 0-VT52 | | Bits Per Char. 0-7 Bits +# | | 1-ANSI | | 1-8 Bits +# | Keyclick 0-Off | Parity 0-Off +# | 1-On | 1-On +# Margin Bell 0-Off Parity Sense 0-Odd +# 1-On 1-Even +# +# The following SET-UP modes are assumed for normal operation: +# ANSI_MODE AUTO_XON/XOFF_ON NEWLINE_OFF 80_COLUMNS +# WRAP_AROUND_ON JUMP_SCROLL_OFF +# Other SET-UP modes may be set for operator convenience or communication +# requirements; I recommend +# AUTOREPEAT_ON BLOCK_CURSOR MARGIN_BELL_OFF SHIFTED_3_# +# Unless you have a graphics add-on such as Digital Engineering's VT640 +# (and even then, whenever it can be arranged!) you should set +# INTERLACE_OFF +# +# (vt100: I added / based on the init string, also . -- esr) +vt100|vt100-am|dec vt100 (w/advanced video), + OTbs, am, mc5i, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, lf1=pf1, + lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, + rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;$<2>, + sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, + use=vt100+fnkeys, +vt100nam|vt100-nam|vt100 no automargins, + am@, xenl@, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt100-am, +vt100-vb|dec vt100 (w/advanced video) & no beep, + bel@, flash=\E[?5h$<100/>\E[?5l, use=vt100, + +# Ordinary vt100 in 132 column ("wide") mode. +vt100-w|vt100-w-am|dec vt100 132 cols (w/advanced video), + cols#132, lines#24, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=vt100-am, +vt100-w-nam|vt100-nam-w|dec vt100 132 cols (w/advanced video no automargin), + cols#132, lines#14, vt@, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=vt100-nam, + +# vt100 with no advanced video. +vt100-nav|vt100 without advanced video option, + xmc#1, + blink@, bold@, rev@, rmso=\E[m, rmul@, sgr@, sgr0@, smso=\E[7m, + smul@, use=vt100, +vt100-nav-w|vt100-w-nav|dec vt100 132 cols 14 lines (no advanced video option), + cols#132, lines#14, use=vt100-nav, + +# vt100 with one of the 24 lines used as a status line. +# We put the status line on the top. +vt100-s|vt100-s-top|vt100-top-s|vt100 for use with top sysline, + eslok, hs, + lines#23, + clear=\E[2;1H\E[J$<50>, csr=\E[%i%i%p1%d;%p2%dr, + cup=\E[%i%p1%{1}%+%d;%p2%dH$<5>, dsl=\E7\E[1;24r\E8, + fsl=\E8, home=\E[2;1H, is2=\E7\E[2;24r\E8, + tsl=\E7\E[1;%p1%dH\E[1K, use=vt100-am, + +# Status line at bottom. +# Clearing the screen will clobber status line. +vt100-s-bot|vt100-bot-s|vt100 for use with bottom sysline, + eslok, hs, + lines#23, + dsl=\E7\E[1;24r\E8, fsl=\E8, is2=\E[1;23r\E[23;1H, + tsl=\E7\E[24;%p1%dH\E[1K, use=vt100-am, + +# Most of the `vt100' emulators out there actually emulate a vt102 +# This entry (or vt102-nsgr) is probably the right thing to use for +# these. +vt102|dec vt102, + dch1=\E[P, dl1=\E[M, il1=\E[L, rmir=\E[4l, smir=\E[4h, + use=vt100, +vt102-w|dec vt102 in wide mode, + cols#132, + rs3=\E[?3h, use=vt102, + +# Many brain-dead PC comm programs that pretend to be `vt100-compatible' +# fail to interpret the ^O and ^N escapes properly. Symptom: the +# string in the canonical vt100 entry above leaves the screen littered +# with little snowflake or star characters (IBM PC ROM character \017 = ^O) +# after highlight turnoffs. This entry should fix that, and even leave +# ACS support working, at the cost of making multiple-highlight changes +# slightly more expensive. +# From: Eric S. Raymond July 22 1995 +vt102-nsgr|vt102 no sgr (use if you see snowflakes after highlight changes), + sgr@, sgr0=\E[m, use=vt102, + +# VT125 Graphics CRT. Clear screen also erases graphics +# Some vt125's came configured with vt102 support. +vt125|vt125 graphics terminal, + mir, + clear=\E[H\E[2J\EPpS(E)\E\\$<50>, use=vt100, + +# This isn't a DEC entry, it came from University of Wisconsin. +# (vt131: I added / based on the init string, also -- esr) +vt131|dec vt131, + OTbs, am, xenl, + cols#80, it#8, lines#24, vt#3, + bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, + clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C$<2/>, + cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, + ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, + is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, nel=^M^J, rc=\E8, rev=\E[7m$<2/>, ri=\EM$<5/>, + rmam=\E[?7h, rmkx=\E[?1l\E>, rmso=\E[m$<2/>, + rmul=\E[m$<2/>, + rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m$<2/>, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[7m$<2/>, smul=\E[4m$<2/>, + +# vt132 - like vt100 but slower and has ins/del line and such. +# I'm told that / are backwards in the terminal from the +# manual and from the ANSI standard, this describes the actual +# terminal. I've never actually used a vt132 myself, so this +# is untested. +# +vt132|DEC vt132, + xenl, + dch1=\E[P$<7>, dl1=\E[M$<99>, il1=\E[L$<99>, ind=\n$<30>, + ip=$<7>, rmir=\E[4h, smir=\E[4l, use=vt100, + +# This vt220 description maps F5--F9 to the second block of function keys +# at the top of the keyboard. The "DO" key is used as F10 to avoid conflict +# with the key marked (ESC) on the vt220. See vt220d for an alternate mapping. +# PF1--PF4 are used as F1--F4. +# +# added msgr -TD +vt220-old|vt200-old|DEC VT220 in vt100 emulation mode, + OTbs, OTpt, am, mir, msgr, xenl, xon, + cols#80, lines#24, vt#3, + OTnl=^J, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, civis=\E[?25l, + clear=\E[H\E[2J$<50>, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<10>, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, + if=/usr/share/tabset/vt100, il1=\E[L, ind=\ED$<20/>, + is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\EOP, + kf10=\E[29~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[17~, + kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rc=\E8, + rev=\E[7m$<2>, rf=/usr/share/tabset/vt100, + ri=\EM$<14/>, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? + %p9%t\E(0%e\E(B%;$<2>, + sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, + smso=\E[7m, smul=\E[4m, + +# A much better description of the VT200/220; used to be vt220-8 +# changed rmacs/smacs from shift-in/shift-out to vt200-old's explicit G0/G1 +# designation to accommodate bug in pcvt -TD +# +# Here's a picture of the VT220 editing keypad: +# +--------+--------+--------+ +# | Find | Insert | Remove | +# +--------+--------+--------+ +# | Select | Prev | Next | +# +--------+--------+--------+ +vt220|vt200|dec vt220, + OTbs, am, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, + flash=\E[?5h$<200/>\E[?5l, home=\E[H, ht=^I, hts=\EH, + ich=\E[%p1%d@, if=/usr/share/tabset/vt100, + il=\E[%p1%dL, il1=\E[L, ind=\ED, + is2=\E[?7h\E[>\E[?1l\E F\E[?4l, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + krdo=\E[29~, kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, + nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B$<4>, + rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + rs1=\E[?3l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? + %p9%t\E(0%e\E(B%;$<2>, + sgr0=\E[m\E(B, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, use=ansi+pp, + use=ansi+enq, +vt220-w|vt200-w|DEC vt220 in wide mode, + cols#132, + rs3=\E[?3h, use=vt220, +vt220-8bit|vt220-8|vt200-8bit|vt200-8|dec vt220/200 in 8-bit mode, + OTbs, am, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\2335m, bold=\2331m, clear=\233H\233J, cr=^M, + csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cub1=^H, + cud=\233%p1%dB, cud1=^J, cuf=\233%p1%dC, cuf1=\233C, + cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, cuu1=\233A, + dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, + ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, enacs=\E)0, + flash=\233?5h$<200/>\233?5l, home=\233H, ht=^I, hts=\EH, + ich=\233%p1%d@, if=/usr/share/tabset/vt100, + il=\233%p1%dL, il1=\233L, ind=\ED, + is2=\233?7h\233>\233?1l\E F\233?4l, kbs=^H, + kcub1=\233D, kcud1=\233B, kcuf1=\233C, kcuu1=\233A, + kdch1=\2333~, kf1=\EOP, kf10=\23321~, kf11=\23323~, + kf12=\23324~, kf13=\23325~, kf14=\23326~, kf17=\23331~, + kf18=\23332~, kf19=\23333~, kf2=\EOQ, kf20=\23334~, + kf3=\EOR, kf4=\EOS, kf6=\23317~, kf7=\23318~, kf8=\23319~, + kf9=\23320~, kfnd=\2331~, khlp=\23328~, khome=\233H, + kich1=\2332~, knp=\2336~, kpp=\2335~, krdo=\23329~, + kslt=\2334~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\233i, + mc4=\2334i, mc5=\2335i, nel=\EE, rc=\E8, rev=\2337m, ri=\EM, + rmacs=\E(B, rmam=\233?7l, rmir=\2334l, rmso=\23327m, + rmul=\23324m, rs1=\233?3l, sc=\E7, + sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m + %?%p9%t\E(0%e\E(B%;$<2>, + sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, smir=\2334h, + smso=\2337m, smul=\2334m, tbc=\2333g, + +# vt220d: +# This vt220 description regards F6--F10 as the second block of function keys +# at the top of the keyboard. This mapping follows the description given +# in the VT220 Programmer Reference Manual and agrees with the labeling +# on some terminals that emulate the vt220. There is no support for an F5. +# See vt220 for an alternate mapping. +# +vt220d|DEC VT220 in vt100 mode with DEC function key labeling, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kf5@, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, use=vt220-old, + +vt220-nam|v200-nam|VT220 in vt100 mode with no auto margins, + am@, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, + +# vt220 termcap written Tue Oct 25 20:41:10 1988 by Alex Latzko +# (not an official DEC entry!) +# The problem with real vt220 terminals is they don't send escapes when in +# in vt220 mode. This can be gotten around two ways. 1> don't send +# escapes or 2> put the vt220 into vt100 mode and use all the nifty +# features of vt100 advanced video which it then has. +# +# This entry takes the view of putting a vt220 into vt100 mode so +# you can use the escape key in emacs and everything else which needs it. +# +# You probably don't want to use this on a VMS machine since VMS will think +# it has a vt220 and will get fouled up coming out of emacs +# +# From: Alexander Latzko , 30 Dec 1996 +# (Added vt100 , to quiet a tic warning -- esr) +# added msgr -TD +vt200-js|vt220-js|dec vt200 series with jump scroll, + am, msgr, + cols#80, + bel=^G, clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, + ht=^I, il1=\E[L, ind=\ED, + is2=\E[61"p\E[H\E[?3l\E[?4l\E[?1h\E[?5l\E[?6l\E[?7h\E[?8h\E[ + ?25h\E>\E[m, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=^M\ED, rc=\E8, + rf=/usr/share/tabset/vt100, ri=\EM, rmdc=, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[27m$<5/>, rmul=\E[24m, + rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, smdc=, + smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m$<5/>, smul=\E[4m, + +# This was DEC's vt320. Use the purpose-built one below instead +#vt320|DEC VT320 in vt100 emulation mode, +# use=vt220, + +# Use v320n for SCO's LYRIX. Otherwise, use Adam Thompson's vt320-nam. +# +vt320nam|v320n|DEC VT320 in vt100 emul. mode with NO AUTO WRAP mode, + am@, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h, use=vt220, + +# These entries are not DEC's official ones, they were purpose-built for the +# VT320. Here are the designer's notes: +# is end on a PC kbd. Actually 'select' on a VT. Mapped to +# 'Erase to End of Field'... since nothing seems to use 'end' anyways... +# khome is Home on a PC kbd. Actually 'FIND' on a VT. +# Things that use usually use tab anyways... and things that don't use +# tab usually use instead... +# kprv is same as tab - Backtab is useless... +# I left out because of its RIDICULOUS complexity, +# and the resulting fact that it causes the termcap translation of the entry +# to SMASH the 1k-barrier... +# From: Adam Thompson Sept 10 1995 +# (vt320: uncommented --esr) +vt320|vt300|dec vt320 7 bit terminal, + am, hs, mir, msgr, xenl, + cols#80, lines#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, ht=^I, + hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, + kbs=\177, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kel=\E[4~, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, khome=\E[1~, kich1=\E[2~, knp=\E[6~, knxt=^I, + kpp=\E[5~, kprv=\E[Z, kslt=\E[4~, nel=\EE, rc=\E8, rev=\E[7m, + rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, + rmul=\E[m, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, + sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? + %p9%t\E(0%e\E(B%;$<2>, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + use=dec+pp, use=vt220+keypad, use=dec+sl, use=ansi+enq, +vt320-nam|vt300-nam|dec vt320 7 bit terminal with no am to make SAS happy, + am@, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, use=vt320, +# We have to init 132-col mode, not 80-col mode. +vt320-w|vt300-w|dec vt320 wide 7 bit terminal, + cols#132, wsl#132, + is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, use=vt320, +vt320-w-nam|vt300-w-nam|dec vt320 wide 7 bit terminal with no am, + am@, + is2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, use=vt320-w, + +# VT330 and VT340 -- These are ReGIS and SIXEL graphics terminals +# which are pretty much a superset of the VT320. They have the +# host writable status line, yet another different DRCS matrix size, +# and such, but they add the DEC Technical character set, Multiple text +# pages, selectable length pages, and the like. The difference between +# the vt330 and vt340 is that the latter has only 2 planes and a monochrome +# monitor, the former has 4 planes and a color monitor. These terminals +# support VT131 and ANSI block mode, but as with much of these things, +# termcap/terminfo doesn't deal with these features. +# +# Note that this entry is are set up in what was the standard way for GNU +# Emacs v18 terminal modes to deal with the cursor keys in that the arrow +# keys were switched into application mode at the same time the numeric pad +# is switched into application mode. This changes the definitions of the +# arrow keys. Emacs v19 is smarter and mines its keys directly out of +# your termcap or terminfo entry, +# +# From: Daniel Glasser , 13 Oct 1993 +# (vt340: string capability "sb=\E[M" corrected to "sr"; +# also, added / based on the init string -- esr) +vt340|dec-vt340|vt330|dec-vt330|dec vt340 graphics terminal with 24 line page, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[J, + cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, dsl=\E[2$~\r\E[1$}\E[K\E[$}, + ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, + il1=\E[L, ind=\ED, + is2=\E<\E\sF\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r + \E[24;1H, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, + lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, + rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, + rmul=\E[24m, rs1=\E[?3l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? + %p9%t\E(0%e\E(B%;$<2>, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[2$~\E[1$}\E[1;%dH, + +# DEC doesn't supply a vt400 description, so we add Daniel Glasser's +# (originally written with vt420 as its primary name, and usable for it). +# +# VT400/420 -- This terminal is a superset of the vt320. It adds the multiple +# text pages and long text pages with selectable length of the vt340, along +# with left and right margins, rectangular area text copy, fill, and erase +# operations, selected region character attribute change operations, +# page memory and rectangle checksums, insert/delete column, reception +# macros, and other features too numerous to remember right now. TERMCAP +# can only take advantage of a few of these added features. +# +# Note that this entry is are set up in what was the standard way for GNU +# Emacs v18 terminal modes to deal with the cursor keys in that the arrow +# keys were switched into application mode at the same time the numeric pad +# is switched into application mode. This changes the definitions of the +# arrow keys. Emacs v19 is smarter and mines its keys directly out of +# your termcap entry, +# +# From: Daniel Glasser , 13 Oct 1993 +# (vt400: string capability ":sb=\E[M:" corrected to ":sr=\E[M:"; +# also, added / based on the init string -- esr) +vt400|vt400-24|dec-vt400|dec vt400 24x80 column autowrap, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J$<10/>, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J$<10/>, + el=\E[K$<4/>, flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=\ED, + is2=\E<\E\sF\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r + \E[24;1H, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, + lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, + rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, + rmul=\E[24m, rs1=\E<\E[?3l\E[!p\E[?7h, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? + %p9%t\E(0%e\E(B%;$<2>, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[2$~\E[1$}\E[1;%dH, use=dec+sl, + +# (vt420: I removed , it collided with . I also restored +# a missing -- esr) +# add msgr and other capabilities from vt220 -TD +vt420|DEC VT420, + am, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, civis=\E[?25l, + clear=\E[H\E[2J$<50>, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K, + enacs=\E)0, flash=\E[?5h$<200/>\E[?5l, home=\E[H, ht=^I, + hts=\EH, ich=\E[%p1%d@, if=/usr/share/tabset/vt300, + il=\E[%p1%dL, il1=\E[L, ind=\ED, is2=\E[1;24r\E[24;1H, + is3=\E[?67h\E[64;1"p, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP, kf10=\E[29~, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[17~, kf6=\E[18~, + kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, kfnd=\E[1~, + kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, nel=\EE, + rc=\E8, rev=\E[7m$<2>, rf=/usr/share/tabset/vt300, + ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, + rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + rmso=\E[27m, rmul=\E[24m, rs3=\E[?67h\E[64;1"p, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? + %p9%t\E(0%e\E(B%;$<2>, + sgr0=\E[m\E(B$<2>, smacs=\E(0$<2>, smam=\E[?7h, + smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + use=ansi+pp, use=dec+sl, use=ansi+enq, + +# DEC VT220 and up support DECUDK (user-defined keys). DECUDK (i.e., pfx) +# takes two parameters, the key and the string. Translating the key is +# straightforward (keys 1-5 are not defined on real terminals, though some +# emulators define these): +# +# if (key < 16) then value = key; +# else if (key < 21) then value = key + 1; +# else if (key < 25) then value = key + 2; +# else if (key < 27) then value = key + 3; +# else if (key < 30) then value = key + 4; +# else value = key + 5; +# +# The string must be the hexadecimal equivalent, e.g., "5052494E" for "PRINT". +# There's no provision in terminfo for emitting a string in this format, so the +# application has to know it. +# +vt420pc|DEC VT420 w/PC keyboard, + kdch1=\177, kend=\E[4~, kf1=\E[11~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[11;2~, kf14=\E[12;2~, + kf15=\E[13;2~, kf16=\E[14;2~, kf17=\E[15;2~, + kf18=\E[17;2~, kf19=\E[18;2~, kf2=\E[12~, kf20=\E[19;2~, + kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, + kf24=\E[24;2~, kf25=\E[23~, kf26=\E[24~, kf27=\E[25~, + kf28=\E[26~, kf29=\E[28~, kf3=\E[13~, kf30=\E[29~, + kf31=\E[31~, kf32=\E[32~, kf33=\E[33~, kf34=\E[34~, + kf35=\E[35~, kf36=\E[36~, kf37=\E[23;2~, kf38=\E[24;2~, + kf39=\E[25;2~, kf4=\E[14~, kf40=\E[26;2~, kf41=\E[28;2~, + kf42=\E[29;2~, kf43=\E[31;2~, kf44=\E[32;2~, + kf45=\E[33;2~, kf46=\E[34;2~, kf47=\E[35;2~, + kf48=\E[36;2~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[H, + pctrm=USR_TERM\:vt420pcdos\:, + pfx=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%> + %t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+ + %d/%p2%s\E\\, + use=vt420, + +vt420pcdos|DEC VT420 w/PC for DOS Merge, + lines#25, + dispc=%?%p1%{19}%=%t\E\023\021%e%p1%{32}%<%t\E%p1%c%e%p1 + %{127}%=%t\E\177%e%p1%c%;, + pctrm@, + rmsc=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr@, + sgr0=\E[m, smsc=\E[?1;2r\E[34h, use=vt420pc, + +vt420f|DEC VT420 with VT kbd; VT400 mode; F1-F5 used as Fkeys, + kdch1=\177, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[H, lf1=\EOP, lf2=\EOQ, lf3=\EOR, lf4=\EOS, + use=vt420, + +vt510|DEC VT510, + use=vt420, +vt510pc|DEC VT510 w/PC keyboard, + use=vt420pc, +vt510pcdos|DEC VT510 w/PC for DOS Merge, + use=vt420pcdos, + +# VT520/VT525 +# +# The VT520 is a monochrome text terminal capable of managing up to +# four independent sessions in the terminal. It has multiple ANSI +# emulations (VT520, VT420, VT320, VT220, VT100, VT PCTerm, SCO Console) +# and ASCII emulations (WY160/60, PCTerm, 50/50+, 150/120, TVI 950, +# 925 910+, ADDS A2). This terminfo data is for the ANSI emulations only. +# +# Terminal Set-Up is entered by pressing [F3], [Caps Lock]/[F3] or +# [Alt]/[Print Screen] depending upon which keyboard and which +# terminal mode is being used. If Set-Up has been disabled or +# assigned to an unknown key, Set-Up may be entered by pressing +# [F3] as the first key after power up, regardless of keyboard type. +vt520|DEC VT520, + use=ansi+rca, use=vt420, use=ansi+tabs, + +vt525|DEC VT525, + use=vt520, + +# I just got a brand new Boundless VT520 with that company's "ANSI 2011" +# Keyboard, which replaces the old LK41R-AA keyboard. +# +# In trying to get the function keys to work, I had to cobble my own +# terminfo.src entry, since the existing vt520 entry doesn't include most of +# the function keys. If I blend the entries for "vt420f" and "vt220+keypad" +# I seem to get them all -Mike Gran +vt520ansi|Boundless VT520 ANSI, + use=ansi+rca, use=vt420f, use=vt220+keypad, + use=ansi+tabs, + +#### VT100 emulations +# + +# John Hawkinson tells us that the EWAN telnet for Windows +# (the best Windows telnet as of September 1995) presents the name `dec-vt100' +# to telnetd. Michael Deutschmann informs us +# that this works best with a stock vt100 entry. +dec-vt100|EWAN telnet's vt100 emulation, + use=vt100, + +# From: Adrian Garside <94ajg2@eng.cam.ac.uk>, 19 Nov 1996 +dec-vt220|DOS tnvt200 terminal emulator, + am@, use=vt220, + +# Zstem340 is an (IMHO) excellent VT emulator for PC's. I recommend it to +# anyone who needs PC VT340 emulation. (or anything below that level, for +# that matter -- DEC's ALL-in-1 seems happy with it, as does INFOPLUS's +# RDBM systems, it includes ReGIS and SiXel support! I'm impressed... +# I can send the address if requested. +# (z340: changed garbled \E[5?l to \E[?5l, DEC smooth scroll off -- esr) +# From: Adam Thompson Sept 10 1995 +z340|zstem vt340 terminal emulator 132col 42line, + lines#42, + is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H, use=vt320-w, +z340-nam|zstem vt340 terminal emulator 132col 42line (no automatic margins), + am@, + is2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H, use=z340, + +# CRT is shareware. It implements some xterm features, including mouse. +crt|crt-vt220|CRT 2.3 emulating VT220, + bce, msgr, + ncv@, + hts=\EH, use=vt100+enq, use=vt220, use=ecma+color, + +# PuTTY 0.55 (released 3 August 2004) +# http://www.chiark.greenend.org.uk/~sgtatham/putty/ +# +# Comparing with 0.51, vttest is much better (only a few problems with the +# cursor position reports and wrapping). +# +# PuTTY 0.51 (released 14 December 2000) +# +# This emulates vt100 + vt52 (plus a few vt220 features: ech, SRM, DECTCEM, as +# well as SCO and Atari, color palettes from Linux console). Reading the code, +# it is intended to be VT102 plus selected features. By default, it sets $TERM +# to xterm, which is incorrect, since several features are misimplemented: +# +# Alt+key always sends ESC+key, so 'km' capability is removed. +# +# Control responses, wrapping and tabs are buggy, failing a couple of +# screens in vttest. +# +# xterm mouse support is not implemented (unrelease version may). +# +# Several features such as backspace/delete are optional; this entry documents +# the default behavior -TD + +putty|PuTTY terminal emulator, + am, bce, bw, ccc, mir, msgr, xenl, xon, XT, + colors#8, it#8, ncv#22, pairs#64, U8#1, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\ED, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, + dch=\E[%p1%dP, dch1=\E[P, + dispc=%?%p1%{8}%=%t\E%%G\342\227\230\E%%@%e%p1%{10}%=%t\E%%G + \342\227\231\E%%@%e%p1%{12}%=%t\E%%G\342\231\0\E%%@%e + %p1%{13}%=%t\E%%G\342\231\252\E%%@%e%p1%{14}%=%t\E%%G + \342\231\253\E%%@%e%p1%{15}%=%t\E%%G\342\230\274\E%%@ + %e%p1%{27}%=%t\E%%G\342\206\220\E%%@%e%p1%{155}%=%t\E + %%G\340\202\242\E%%@%e%p1%c%;, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h$<100/>\E[?5l, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, il=\E[%p1%dL, + il1=\E[L, ind=^J, indn=\E[%p1%dS, + initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/ + %02x%p4%{255}%*%{1000}%/%02x, + is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>\E]R, + kb2=\E[G, kbs=\177, kcbt=\E[Z, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kend=\E[4~, khome=\E[1~, kich1=\E[2~, + kind=\E[B, kmous=\E[M, knp=\E[6~, kpp=\E[5~, kri=\E[A, + kspd=^Z, nel=^M^J, oc=\E]R, op=\E[39;49m, rc=\E8, rev=\E[7m, + ri=\EM, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, + rmcup=\E[2J\E[?47l, rmir=\E[4l, rmkx=\E[?1l\E>, + rmpch=\E[10m, rmso=\E[27m, rmul=\E[24m, + rs2=\E<\E["p\E[50;6"p\Ec\E[?3l\E]R\E[?1000l, + s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[?47h, + smir=\E[4h, smkx=\E[?1h\E=, smpch=\E[11m, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, E3=\E[3J, + use=putty+fnkeys, use=vt102+enq, use=xterm+sl, +vt100-putty|Reset PuTTY to pure vt100, + rs2=\E<\E["p\Ec\E[?3l\E]R\E[40"p\E[61"p\E[50;1;2"p, + use=vt100, +putty-256color|PuTTY 0.58 with xterm 256-colors, + use=xterm+256setaf, use=putty, +putty-noapp|putty with cursor keys in normal mode, + kLFT=\EOD, kRIT=\EOC, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kind=\EOB, kri=\EOA, rmkx=\E>, smkx=\E=, + use=putty, + +# One of the keyboard selections is "VT100+". +# pterm (the X11 port) uses shifted F1-F10 as F11-F20 +putty-vt100|VT100+ keyboard layout, + use=putty+fnkeys+vt100, use=putty, + +putty-sco|putty with SCO function keys, + use=putty+fnkeys+sco, use=putty, + +# PuTTY has more than one section in its Keyboard configuration: +# a) backspace/delete, which we ignore since that choice largely depends on +# whether one matches Unix and BSD or Linux. +# b) home/end keys, also ignored because the "rxvt" setting sends keys which +# are unrelated to rxvt's actual settings. +# c) function keys and keypad - this is the interesting part. None of the +# selections match any of their respective namesakes, but they are shown +# here to help users who expect that the selections do what is implied. +# +# This is the default setting for PuTTY +putty+fnkeys|fn-keys for PuTTY, + use=putty+fnkeys+esc, + +putty+fnkeys+esc|ESC[n~ fn-keys for PuTTY, + kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, + kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + +putty+fnkeys+linux|Linux fn-keys for PuTTY, + kf1=\E[[A, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, + use=putty+fnkeys+esc, + +putty+fnkeys+xterm|Xterm R6 fn-keys for PuTTY, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + use=putty+fnkeys+esc, + +putty+fnkeys+vt400|VT400 fn-keys for PuTTY, + use=putty+fnkeys+esc, + +# Shifted F1 is F11. F13-F20 inherit from the defaults, and the last distinct +# key is F20. +putty+fnkeys+vt100|VT100+ fn-keys for PuTTY, + kf1=\EOP, kf10=\EOY, kf11=\EOZ, kf12=\EO[, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, + kf9=\EOX, use=putty+fnkeys+esc, + +# Unlike xterm-sco, this leaves kmous ambiguous with kf1. +# +# Use modifiers to obtain function keys past 12: +# F1-F12 - normal +# F13-F24 - shift +# F25-F36 - control/alt +# F37-F48 - control/shift +# +putty+fnkeys+sco|SCO fn-keys for PuTTY, + kbeg=\E[E, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\177, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, + kf12=\E[X, kf13=\E[Y, kf14=\E[Z, kf15=\E[a, kf16=\E[b, + kf17=\E[c, kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, + kf21=\E[g, kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, + kf26=\E[l, kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, + kf30=\E[p, kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, + kf35=\E[u, kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, + kf4=\E[P, kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, + kf44=\E[], kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, + kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, + kich1=\E[L, knp=\E[G, kpp=\E[I, + +# This entry is for Tera Term Pro version 2.3, for MS-Windows 95/NT written by +# T. Teranishi dated Mar 10, 1998. It is a free software terminal emulator +# (communication program) which supports: +# +# - Serial port connections. +# - TCP/IP (telnet) connections. +# - VT100 emulation, and selected VT200/300 emulation. +# - TEK4010 emulation. +# - File transfer protocols (Kermit, XMODEM, ZMODEM, B-PLUS and +# Quick-VAN). +# - Scripts using the "Tera Term Language". +# - Japanese and Russian character sets. +# +# The program does not come with terminfo or termcap entries. However, the +# emulation (testing with vttest and ncurses) is reasonably close to vt100 (no +# vt52 or doublesize character support; blinking is done with color). Besides +# the HPA, VPA extensions it also implements CPL and CNL. +# +# All of the function keys can be remapped. This description shows the default +# mapping, as installed. Both vt100 PF1-PF4 keys and quasi-vt220 F1-F4 keys +# are supported. F13-F20 are obtained by shifting F3-F10. The editing keypad +# is laid out like vt220, rather than the face codes on the PC keyboard, i.e, +# kfnd Insert +# kslt Delete +# kich1 Home +# kdch1 PageUp +# kpp End +# knp PageDown +# +# ANSI colors are implemented, but cannot be combined with video attributes +# except for reverse. +# +# No fonts are supplied with the program, so the acsc string is chosen to +# correspond with the default Microsoft terminal font. +# +# Tera Term recognizes some xterm sequences, including those for setting and +# retrieving the window title, and for setting the window size (i.e., using +# "resize -s"), though it does not pass SIGWINCH to the application if the +# user resizes the window with the mouse. +teraterm2.3|Tera Term Pro, + km, xon@, + ncv#43, vt@, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i + \316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u + \264v\301w\302x\263y\363z\362{\343|\330}\234~\376, + blink=\E[5m, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[J, + cnorm=\E[?25h, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + flash=\E[?5h\E[?5l$<200/>, hpa=\E[%i%p1%dG, + il=\E[%p1%dL, il1=\E[L, kdch1=\E[3~, kf1=\E[11~, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, + kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, kslt=\E[4~, op=\E[100m, rev=\E[7m, ri=\EM, + rmso=\E[27m, rmul=\E[24m, sgr0=\E[0m\017, smso=\E[7m, + smul=\E[4m, vpa=\E[%i%p1%dd, use=vt100+enq, + use=klone+color, use=vt100, + +# Version 4.59 has regular vt100 line-drawing (so it is no longer necessary +# to choose a Windows OEM font). +# +# Testing with tack: +# - it does not have xenl (suppress that) +# - underline seems to work with color (modify ncv). +# Testing with vttest: +# - wrapping differs from vt100 (menu 1). +# - it recognizes xterm's X10 and normal mouse tracking, but none of the +# other flavors. +# - it recognizes the dtterm window controls for reporting size in +# characters and pixels. +# - it passes SIGWINCH. +teraterm4.59|Tera Term Pro, + bce, xenl@, + ncv#41, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + kmous=\E[M, use=teraterm2.3, + +teraterm|Tera Term, + use=teraterm4.59, + +# Tested with WinNT 4.0, the telnet application assumes the screensize is +# 25x80. This entry uses the 'Terminal' font, to get line-drawing characters. +# +# Other notes: +# a) Fails tack's cup (cursor-addressing) test, though cup works well enough +# for casual (occasional) use. Also fails several of the vttest screens, +# but that is not unusual for vt100 "emulators". +# b) Does not implement vt100 keypad +# c) Recognizes a subset of vt52 controls. +ms-vt100|MS telnet imitating dec vt100, + lines#25, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i + \316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u + \264v\301w\302x\263y\363z\362{\343|\330}\234~\376, + ka1@, ka3@, kb2@, kc1@, kc3@, kent@, kf0@, kf1@, kf10@, kf2@, kf3@, kf4@, + kf5@, kf6@, kf7@, kf8@, kf9@, tbc@, use=vt102+enq, use=vt100, + +# Tested with Windows 2000, the telnet application runs in a console window, +# also using 'Terminal' font. +# +# Other notes: +# a) This version has no function keys or numeric keypad. Unlike the older +# version, the numeric keypad is entirely ignored. +# b) The program sets $TERM to "ansi", which of course is inaccurate. +ms-vt100-color|vtnt|windows 2000 ansi (sic), + bce, + dch=\E[%p1%dP, ich=\E[%p1%d@, use=ecma+color, + use=ms-vt100, + +# Based on comments from Federico Bianchi: +# +# vt100+ is basically a VT102-noSGR with ANSI.SYS colors and a different +# scheme for PF keys. +# +# and PuTTY wishlist: +# +# The modifiers are represented as the codes listed above, prefixed to +# the normal sequences. If the modifier is pressed alone, its sequence +# is transmitted twice in succession. If multiple modifiers apply, +# they're transmitted in the order shift, control, alt. +# +# Shift \E^S +# Alt \E^A, +# Ctrl \E^C, +ms-vt100+|vt100+|windows XP vt100+ (sic), + kdch1=\E-, kend=\Ek, kf1=\E1, kf10=\E0, kf11=\E!, kf12=\E@, + kf13=\E\023\E1, kf14=\E\023\E2, kf15=\E\023\E3, + kf16=\E\023\E4, kf17=\E\023\E5, kf18=\E\023\E6, + kf19=\E\023\E7, kf2=\E2, kf20=\E\023\E8, kf21=\E\023\E9, + kf22=\E\023\E0, kf23=\E\023\E!, kf24=\E\023\E@, + kf25=\E\003\E1, kf26=\E\003\E2, kf27=\E\003\E3, + kf28=\E\003\E4, kf29=\E\003\E5, kf3=\E3, kf30=\E\003\E6, + kf31=\E\003\E7, kf32=\E\003\E8, kf33=\E\003\E9, + kf34=\E\003\E0, kf35=\E\003\E!, kf36=\E\003\E@, + kf37=\E\001\E1, kf38=\E\001\E2, kf39=\E\001\E3, kf4=\E4, + kf40=\E\001\E4, kf41=\E\001\E5, kf42=\E\001\E6, + kf43=\E\001\E7, kf44=\E\001\E8, kf45=\E\001\E9, + kf46=\E\001\E0, kf47=\E\001\E!, kf48=\E\001\E@, kf5=\E5, + kf6=\E6, kf7=\E7, kf8=\E8, kf9=\E9, khome=\Eh, kich1=\E+, + knp=\E/, kpp=\E?, use=ms-vt100-color, + +ms-vt-utf8|vt-utf8|UTF-8 flavor of vt100+, + use=ms-vt100+, + +# expect-5.44.1.15/example/tkterm +# a minimal subset of a vt100 (compare with "news-unk). +# +# The missing "=" in smkx is not a typo (here), but an error in tkterm. +tt|tkterm|Don Libes' tk text widget terminal emulator, + clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%p1%d;%p2%dH, cuu1=\E[A, ind=^J, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, + kf9=\EOX, rmkx=\E[?1l\E>, rmso=\E[m, smkx=\E[?1h\E, + smso=\E[7m, + +######## X TERMINAL EMULATORS +#### XTERM +# +# You can add the following line to your .Xdefaults to change the terminal type +# set by the xterms you start up to my-xterm: +# +# *termName: my-xterm +# +# System administrators can change the default entry for xterm instances +# by adding a similar line to /usr/X11/lib/X11/app-defaults/XTerm. In either +# case, xterm will detect and reject an invalid terminal type, falling back +# to the default of xterm. +# + +# X10/6.6 11/7/86, minus alternate screen, plus (csr) +# (xterm: ":MT:" changed to ":km:"; added / based on init string; +# removed (hs, eslok, tsl=\E[?E\E[?%i%dT, fsl=\E[?F, dsl=\E[?E) +# as these seem not to work -- esr) +x10term|vs100-x10|xterm terminal emulator (X10 window system), + OTbs, am, km, mir, msgr, xenl, xon, + cols#80, it#8, lines#65, + bold=\E[1m, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, il=\E[%p1%dL, + il1=\E[L, ind=^J, is2=\E\E[m\E[?7h\E[?1;4l, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, rev=\E[7m, ri=\EM, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, + smso=\E[7m, smul=\E[4m, +# Compatible with the R5 xterm +# (from the XFree86 3.2 distribution, removed) +# added khome/kend, rmir/smir, rmul/smul, hts based on the R5 xterm code - TD +# corrected typos in rs2 string - TD +# added u6-u9 -TD +xterm-r5|xterm R5 version, + OTbs, am, km, msgr, xenl, + cols#80, it#8, lines#24, + bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, + kdl1=\E[31~, kel=\E[8~, kend=\E[4~, kf0=\EOq, kf1=\E[11~, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, + kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, + kil1=\E[30~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, rc=\E8, + rev=\E[7m, ri=\EM, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, + rmul=\E[m, + rs2=\E>\E[?1;3;4;5;6l\E[4l\E[?7h\E[m\E[r\E[2J\E[H, + sc=\E7, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + %;m, + sgr0=\E[m, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, use=vt100+enq, +# Compatible with the R6 xterm +# (from XFree86 3.2 distribution, and added, removed) +# added khome/kend, hts based on the R6 xterm code - TD +# (khome/kend do not actually work in X11R5 or X11R6, but many people use this +# for compatibility with other emulators). +xterm-r6|xterm X11R6 version, + OTbs, am, km, mir, msgr, xenl, + cols#80, it#8, lines#24, + acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, enacs=\E)0, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, + il1=\E[L, ind=^J, + is2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kfnd=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + kslt=\E[4~, meml=\El, memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs2=\E[m\E[?7h\E[4l\E>\E7\E[r\E[?1;3;4;6l\E8, sc=\E7, + sgr0=\E[m, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + use=vt100+enq, +xterm-old|antique xterm version, + use=xterm-r6, +# This is the base xterm entry for the xterm supplied with XFree86 3.2 & up. +# The name has been changed and some aliases have been removed. +xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System), + OTbs, am, bce, km, mir, msgr, xenl, XT, + cols#80, it#8, lines#24, ncv@, + acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, + ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, + is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, + kbeg=\EOE, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, kdch1=\177, kend=\EOF, kf1=\E[11~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, + kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, kfnd=\E[1~, khome=\EOH, kich1=\E[2~, + kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, meml=\El, + memu=\Em, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, + rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>, + rmso=\E[27m, rmul=\E[24m, rs1=^O, + rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>, sc=\E7, + setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, + smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, vpa=\E[%i%p1%dd, use=vt100+enq, + use=ecma+color, use=vt220+keypad, + +# This is the stock xterm entry supplied with XFree86 3.3, which uses VT100 +# codes for F1-F4 except while in VT220 mode. +xterm-xf86-v33|xterm terminal emulator (XFree86 3.3 Window System), + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, use=xterm-xf86-v32, + +# This version was released in XFree86 3.3.3 (November 1998). +# Besides providing printer support, it exploits a new feature that allows +# xterm to use terminfo-based descriptions with the titeInhibit resource. +# -- the distribution contained incorrect khome/kend values -TD +xterm-xf86-v333|xterm terminal emulator (XFree86 3.3.3 Window System), + blink=\E[5m, ich1@, invis=\E[8m, + is2=\E[!p\E[?3;4l\E[4l\E>, kdch1=\E[3~, kfnd@, kslt@, + rmcup=\E[?1047l\E[?1048l, rs1=\Ec, + rs2=\E[!p\E[?3;4l\E[4l\E>, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + smcup=\E[?1048h\E[?1047h, use=ansi+pp, + use=xterm-xf86-v33, + +# This version was released in XFree86 4.0. +xterm-xf86-v40|xterm terminal emulator (XFree86 4.0 Window System), + npc, + kDC=\E[3;5~, kEND=\EO5F, kHOM=\EO5H, kIC=\E[2;5~, + kLFT=\EO5D, kNXT=\E[6;5~, kPRV=\E[5;5~, kRIT=\EO5C, ka1@, + ka3@, kb2=\EOE, kc1@, kc3@, kcbt=\E[Z, kdch1=\E[3~, kend=\EOF, + kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, kf16=\EO2S, + kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, + kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, + kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P, kf26=\EO5Q, + kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, kf30=\E[17;5~, + kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, + kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, kf37=\EO6P, + kf38=\EO6Q, kf39=\EO6R, kf40=\EO6S, kf41=\E[15;6~, + kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, + kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, + kf48=\E[24;6~, khome=\EOH, rmcup=\E[?1049l, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%? + %p9%t\016%e\017%;, + smcup=\E[?1049h, use=xterm-xf86-v333, + +# This version was released in XFree86 4.3. +xterm-xf86-v43|xterm terminal emulator (XFree86 4.3 Window System), + kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, + kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, + kbeg@, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? + %p7%t;8%;m%?%p9%t\016%e\017%;, + use=xterm-xf86-v40, + +# This version was released in XFree86 4.4. +xterm-xf86-v44|xterm terminal emulator (XFree86 4.4 Window System), + cnorm=\E[?12l\E[?25h, cvvis=\E[?12;25h, indn=\E[%p1%dS, + rin=\E[%p1%dT, use=xterm-xf86-v43, + +xterm-xfree86|xterm terminal emulator (XFree86), + use=xterm-xf86-v44, + +# This version reflects the current xterm features. +xterm-new|modern xterm terminal emulator, + npc, + indn=\E[%p1%dS, kb2=\EOE, kcbt=\E[Z, kent=\EOM, + rin=\E[%p1%dT, use=ansi+enq, use=xterm+pcfkeys, + use=xterm+tmux, use=xterm-basic, + +# This fragment is for people who cannot agree on what the backspace key +# should send. +xterm+kbs|fragment for backspace key, + kbs=^H, +# +# This fragment describes as much of XFree86 xterm's "pc-style" function +# keys as will fit into terminfo's 60 function keys. +# From ctlseqs.ms: +# Code Modifiers +# --------------------------------- +# 2 Shift +# 3 Alt +# 4 Shift + Alt +# 5 Control +# 6 Shift + Control +# 7 Alt + Control +# 8 Shift + Alt + Control +# --------------------------------- +# The meta key may also be used as a modifier in this scheme, adding another +# bit to the parameter. +xterm+pcfkeys|fragment for PC-style fkeys, + use=xterm+app, use=xterm+pcf2, use=xterm+pcc2, + use=xterm+pce2, +# +xterm+noapp|fragment with cursor keys in normal mode, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[F, + khome=\E[H, + +xterm+app|fragment with cursor keys in application mode, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\EOF, + khome=\EOH, +# +# The "PC-style" modifier scheme was introduced in xterm patch #94 (1999/3/27) +# and revised in xterm patch #167 (2002/8/24). Some other terminal emulators +# copied the earlier scheme, as noted in the "use=" clauses in this file. +# +# The original assignments from patch #94 for cursor-keys had some technical +# issues: +# +# A parameter for a function-key to represent a modifier is just more +# bits. But for a cursor-key it may change the behavior of the +# application. For instance, emacs decodes the first parameter of a +# cursor-key as a repeat count. +# +# A parameterized string should (really) not begin with SS3 (\EO). +# Rather, CSI (\E[) should be used. +# +# For these reasons, the original assignments were deprecated. For +# compatibility reasons, they are still available as a setting of xterm's +# modifyCursorKeys resource. These fragments list the modified cursor-keys +# that might apply to xterm+pcfkeys with different values of that resource. +xterm+pcc3|fragment with modifyCursorKeys:3, + kLFT=\E[>1;2D, kRIT=\E[>1;2C, kind=\E[>1;2B, + kri=\E[>1;2A, kDN=\E[>1;2B, kDN3=\E[>1;3B, kDN4=\E[>1;4B, + kDN5=\E[>1;5B, kDN6=\E[>1;6B, kDN7=\E[>1;7B, + kLFT3=\E[>1;3D, kLFT4=\E[>1;4D, kLFT5=\E[>1;5D, + kLFT6=\E[>1;6D, kLFT7=\E[>1;7D, kRIT3=\E[>1;3C, + kRIT4=\E[>1;4C, kRIT5=\E[>1;5C, kRIT6=\E[>1;6C, + kRIT7=\E[>1;7C, kUP=\E[>1;2A, kUP3=\E[>1;3A, + kUP4=\E[>1;4A, kUP5=\E[>1;5A, kUP6=\E[>1;6A, + kUP7=\E[>1;7A, + +xterm+pcc2|fragment with modifyCursorKeys:2, + kLFT=\E[1;2D, kRIT=\E[1;2C, kind=\E[1;2B, kri=\E[1;2A, + kDN=\E[1;2B, kDN3=\E[1;3B, kDN4=\E[1;4B, kDN5=\E[1;5B, + kDN6=\E[1;6B, kDN7=\E[1;7B, kLFT3=\E[1;3D, kLFT4=\E[1;4D, + kLFT5=\E[1;5D, kLFT6=\E[1;6D, kLFT7=\E[1;7D, + kRIT3=\E[1;3C, kRIT4=\E[1;4C, kRIT5=\E[1;5C, + kRIT6=\E[1;6C, kRIT7=\E[1;7C, kUP=\E[1;2A, kUP3=\E[1;3A, + kUP4=\E[1;4A, kUP5=\E[1;5A, kUP6=\E[1;6A, kUP7=\E[1;7A, + +xterm+pcc1|fragment with modifyCursorKeys:1, + kLFT=\E[2D, kRIT=\E[2C, kind=\E[2B, kri=\E[2A, kDN=\E[2B, + kDN3=\E[3B, kDN4=\E[4B, kDN5=\E[5B, kDN6=\E[6B, kDN7=\E[7B, + kLFT3=\E[3D, kLFT4=\E[4D, kLFT5=\E[5D, kLFT6=\E[6D, + kLFT7=\E[7D, kRIT3=\E[3C, kRIT4=\E[4C, kRIT5=\E[5C, + kRIT6=\E[6C, kRIT7=\E[7C, kUP=\E[2A, kUP3=\E[3A, + kUP4=\E[4A, kUP5=\E[5A, kUP6=\E[6A, kUP7=\E[7A, + +xterm+pcc0|fragment with modifyCursorKeys:0, + kLFT=\EO2D, kRIT=\EO2C, kind=\EO2B, kri=\EO2A, kDN=\EO2B, + kDN3=\EO3B, kDN4=\EO4B, kDN5=\EO5B, kDN6=\EO6B, kDN7=\EO7B, + kLFT3=\EO3D, kLFT4=\EO4D, kLFT5=\EO5D, kLFT6=\EO6D, + kLFT7=\EO7D, kRIT3=\EO3C, kRIT4=\EO4C, kRIT5=\EO5C, + kRIT6=\EO6C, kRIT7=\EO7C, kUP=\EO2A, kUP3=\EO3A, + kUP4=\EO4A, kUP5=\EO5A, kUP6=\EO6A, kUP7=\EO7A, + +# +# Here are corresponding fragments from xterm patch #216: +# +xterm+pcf0|fragment with modifyFunctionKeys:0, + kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, kf16=\EO2S, + kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, + kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, + kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P, kf26=\EO5Q, + kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, kf3=\EOR, + kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, + kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, + kf36=\E[24;5~, kf37=\EO6P, kf38=\EO6Q, kf39=\EO6R, + kf4=\EOS, kf40=\EO6S, kf41=\E[15;6~, kf42=\E[17;6~, + kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, + kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, kf49=\EO3P, + kf5=\E[15~, kf50=\EO3Q, kf51=\EO3R, kf52=\EO3S, + kf53=\E[15;3~, kf54=\E[17;3~, kf55=\E[18;3~, + kf56=\E[19;3~, kf57=\E[20;3~, kf58=\E[21;3~, + kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, kf61=\EO4P, + kf62=\EO4Q, kf63=\EO4R, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, +# +xterm+pcf2|fragment with modifyFunctionKeys:2, + kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[1;2P, kf14=\E[1;2Q, kf15=\E[1;2R, kf16=\E[1;2S, + kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, + kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, + kf23=\E[23;2~, kf24=\E[24;2~, kf25=\E[1;5P, kf26=\E[1;5Q, + kf27=\E[1;5R, kf28=\E[1;5S, kf29=\E[15;5~, kf3=\EOR, + kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, + kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, + kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q, kf39=\E[1;6R, + kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~, kf42=\E[17;6~, + kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, + kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, + kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q, kf51=\E[1;3R, + kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, + kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~, + kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, + kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, +# +# Chunks from xterm #230: +xterm+pce2|fragment with modifyCursorKeys:2, + kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, + kNXT=\E[6;2~, kPRV=\E[5;2~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, kDC3=\E[3;3~, kDC4=\E[3;4~, kDC5=\E[3;5~, + kDC6=\E[3;6~, kDC7=\E[3;7~, kEND3=\E[1;3F, kEND4=\E[1;4F, + kEND5=\E[1;5F, kEND6=\E[1;6F, kEND7=\E[1;7F, + kHOM3=\E[1;3H, kHOM4=\E[1;4H, kHOM5=\E[1;5H, + kHOM6=\E[1;6H, kHOM7=\E[1;7H, kIC3=\E[2;3~, kIC4=\E[2;4~, + kIC5=\E[2;5~, kIC6=\E[2;6~, kIC7=\E[2;7~, kNXT3=\E[6;3~, + kNXT4=\E[6;4~, kNXT5=\E[6;5~, kNXT6=\E[6;6~, + kNXT7=\E[6;7~, kPRV3=\E[5;3~, kPRV4=\E[5;4~, + kPRV5=\E[5;5~, kPRV6=\E[5;6~, kPRV7=\E[5;7~, + use=xterm+edit, + +xterm+edit|fragment for 6-key editing-keypad, + kdch1=\E[3~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + use=xterm+pc+edit, + +xterm+pc+edit|fragment for pc-style editing keypad, + kend=\E[4~, khome=\E[1~, + +xterm+vt+edit|fragment for vt220-style editing keypad, + kfnd=\E[1~, kslt=\E[4~, + +# +# Those chunks use the new-style (the xterm oldFunctionKeys resource is false). +# Alternatively, the same scheme with old-style function keys as in xterm-r6 +# is shown here (because that is used in mrxvt and mlterm): +xterm+r6f2|xterm with oldFunctionKeys and modifyFunctionKeys:2, + kf1=\E[11~, kf13=\E[11;2~, kf14=\E[12;2~, kf15=\E[13;2~, + kf16=\E[14;2~, kf2=\E[12~, kf25=\E[11;5~, kf26=\E[12;5~, + kf27=\E[13;5~, kf28=\E[14;5~, kf3=\E[13~, kf37=\E[11;6~, + kf38=\E[12;6~, kf39=\E[13;6~, kf4=\E[14~, kf40=\E[14;6~, + kf49=\E[11;3~, kf50=\E[12;3~, kf51=\E[13;3~, + kf52=\E[14;3~, kf61=\E[11;4~, kf62=\E[12;4~, + kf63=\E[13;4~, use=xterm+pcf2, +# +# This chunk is used for building the VT220/Sun/PC keyboard variants. +xterm-basic|modern xterm terminal emulator - common, + OTbs, am, bce, km, mir, msgr, xenl, AX, XT, + colors#8, cols#80, it#8, lines#24, pairs#64, + acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, + is2=\E[!p\E[?3;4l\E[4l\E>, kmous=\E[M, meml=\El, + memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, + ritm=\E[23m, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, + rmir=\E[4l, rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, + rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%; + %?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, + sgr0=\E(B\E[m, sitm=\E[3m, smacs=\E(0, smam=\E[?7h, + smcup=\E[?1049h, smir=\E[4h, smkx=\E[?1h\E=, + smm=\E[?1034h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%i%p1%dd, E3=\E[3J, use=ansi+pp, use=xterm+kbs, + use=vt100+enq, + +# From: David J. MacKenzie , 14 Nov 1997 +# In retrospect, something like xterm-r6 was intended here -TD +xterm-xi|xterm on XI Graphics Accelerated X under BSD/OS 3.1, + rmso=\E[m, rmul=\E[m, use=xterm-xf86-v33, + +# 16-colors is one of the variants of XFree86 3.3 xterm, updated for 4.0 +# (T.Dickey) +# +# If configured to support 88- or 256-colors (which is fairly common in 2009), +# xterm also recognizes the control sequences for initc -TD +xterm-16color|xterm with 16 colors like aixterm, + ccc, + initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%* + %{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, + oc=\E]104\007, rs1=\Ec\E]104\007, use=ibm+16color, + use=xterm-new, + +# 256-colors is a compile-time feature of XFree86 xterm beginning with +# xterm patch #111 (1999/7/10) -TD +xterm+256color|xterm 256-color feature, + ccc, + colors#256, pairs#32767, + initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%* + %{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, + oc=\E]104\007, + setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48; + 5;%p1%d%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5 + ;%p1%d%;m, + setb@, setf@, + +# palette is hardcoded... +xterm+256setaf|xterm 256-color (set-only), + ccc@, + colors#256, pairs#32767, + initc@, + setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48; + 5;%p1%d%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5 + ;%p1%d%;m, + setb@, setf@, + +# 88-colors is a compile-time feature of XFree86 xterm beginning with +# xterm patch #115 (1999/9/18) -TD +# +# Note that the escape sequences used are the same as for 256-colors - xterm +# has a different table of default color resource values. If built for +# 256-colors, it can still handle an 88-color palette by using the initc +# capability. +# +# At this time (2007/7/14), except for rxvt 2.7.x, none of the other terminals +# which support the xterm+256color feature support the associated initc +# capability. So it is cancelled in the entries which use this and/or the +# xterm+256color block. +# +# The default color palette for the 256- and 88-colors are different. A +# given executable will have one palette (perhaps compiled-in). If the program +# supports xterm's control sequence, it can be programmed using initc. +xterm+88color|xterm 88-color feature, + colors#88, pairs#7744, use=xterm+256color, + +# These variants of XFree86 3.9.16 xterm are built as a configure option. +xterm-256color|xterm with 256 colors, + rs1=\Ec\E]104\007, use=xterm+256color, use=xterm-new, +xterm-88color|xterm with 88 colors, + rs1=\Ec\E]104\007, use=xterm+88color, + use=xterm-256color, + +# This chunk is based on suggestions by Ailin Nemui and Nicholas Marriott, who +# asked for some of xterm's advanced features to be added to its terminfo +# entry. It defines extended capabilities not found in standard terminfo or +# termcap. These are useful in tmux, for instance, hence the name. +# +# One caveat in adding extended capabilities in ncurses is that if the names +# are longer than two characters, then they will not be visible through the +# termcap interface. +# +# Ms modifies the selection/clipboard. Its parameters are +# p1 = the storage unit (clipboard, selection or cut buffer) +# p2 = the base64-encoded clipboard content. +# +# Ss is used to set the cursor style as described by the DECSCUSR +# function to a block or underline. +# Se resets the cursor style to the terminal power-on default. +# +# Cs and Cr set and reset the cursor colour. +xterm+tmux|advanced xterm features used in tmux, + Cr=\E]112\007, Cs=\E]12;%p1%s\007, + Ms=\E]52;%p1%s;%p2%s\007, Se=\E[2 q, Ss=\E[%p1%d q, + +# This is another variant, for XFree86 4.0 xterm (T.Dickey) +# This is an 8-bit version of xterm, which emulates DEC vt220 with ANSI color. +# To use it, your decTerminalID resource must be set to 200 or above. +# +# HTS \E H \210 +# RI \E M \215 +# SS3 \E O \217 +# CSI \E [ \233 +# +xterm-8bit|xterm terminal emulator 8-bit controls (X Window System), + OTbs, am, bce, km, mc5i, mir, msgr, npc, xenl, AX, + colors#8, cols#80, it#8, lines#24, pairs#64, + acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\2335m, bold=\2331m, cbt=\233Z, + civis=\233?25l, clear=\233H\2332J, + cnorm=\233?25l\233?25h, cr=^M, csr=\233%i%p1%d;%p2%dr, + cub=\233%p1%dD, cub1=^H, cud=\233%p1%dB, cud1=^J, + cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH, + cuu=\233%p1%dA, cuu1=\233A, cvvis=\233?12;25h, + dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, + ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, + flash=\233?5h$<100/>\233?5l, home=\233H, + hpa=\233%i%p1%dG, ht=^I, hts=\210, ich=\233%p1%d@, + il=\233%p1%dL, il1=\233L, ind=^J, invis=\2338m, + is2=\E[62"p\E\sG\233m\233?7h\E>\E7\233?1;3;4;6l\2334l\233r + \E8, + ka1=\217w, ka3=\217u, kb2=\217y, kbeg=\217E, kc1=\217q, + kc3=\217s, kcbt=\233Z, kcub1=\217D, kcud1=\217B, + kcuf1=\217C, kcuu1=\217A, kdch1=\2333~, kend=\2334~, + kent=\217M, kf1=\23311~, kf10=\23321~, kf11=\23323~, + kf12=\23324~, kf13=\23325~, kf14=\23326~, kf15=\23328~, + kf16=\23329~, kf17=\23331~, kf18=\23332~, kf19=\23333~, + kf2=\23312~, kf20=\23334~, kf3=\23313~, kf4=\23314~, + kf5=\23315~, kf6=\23317~, kf7=\23318~, kf8=\23319~, + kf9=\23320~, khome=\2331~, kich1=\2332~, kmous=\233M, + knp=\2336~, kpp=\2335~, mc0=\233i, mc4=\2334i, mc5=\2335i, + meml=\El, memu=\Em, op=\23339;49m, rc=\E8, rev=\2337m, + ri=\215, rmacs=\E(B, rmam=\233?7l, rmcup=\233?1049l, + rmir=\2334l, rmkx=\233?1l\E>, rmso=\23327m, rmul=\23324m, + rs1=\Ec, + rs2=\E[62"p\E\sG\233m\233?7h\E>\E7\233?1;3;4;6l\2334l\233r + \E8, + sc=\E7, setab=\2334%p1%dm, setaf=\2333%p1%dm, + setb=\2334%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1 + %{6}%=%t3%e%p1%d%;m, + setf=\2333%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1 + %{6}%=%t3%e%p1%d%;m, + sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? + %p7%t;8%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, + smcup=\233?1049h, smir=\2334h, smkx=\233?1h\E=, + smso=\2337m, smul=\2334m, tbc=\2333g, u6=\233[%i%d;%dR, + u7=\E[6n, u8=\233[?1;2c, u9=\E[c, vpa=\233%i%p1%dd, + use=xterm+kbs, + +xterm-hp|xterm with hpterm function keys, + kclr=\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kdch1=\EP, kend=\EF, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, + kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, kich1=\EQ, + knp=\ES, kpp=\ET, use=xterm-basic, + +xterm-sco|xterm with SCO function keys, + kbeg=\E[E, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\177, kend=\E[F, kf1=\E[M, kf10=\E[V, kf11=\E[W, + kf12=\E[X, kf13=\E[Y, kf14=\E[Z, kf15=\E[a, kf16=\E[b, + kf17=\E[c, kf18=\E[d, kf19=\E[e, kf2=\E[N, kf20=\E[f, + kf21=\E[g, kf22=\E[h, kf23=\E[i, kf24=\E[j, kf25=\E[k, + kf26=\E[l, kf27=\E[m, kf28=\E[n, kf29=\E[o, kf3=\E[O, + kf30=\E[p, kf31=\E[q, kf32=\E[r, kf33=\E[s, kf34=\E[t, + kf35=\E[u, kf36=\E[v, kf37=\E[w, kf38=\E[x, kf39=\E[y, + kf4=\E[P, kf40=\E[z, kf41=\E[@, kf42=\E[[, kf43=\E[\\, + kf44=\E[], kf45=\E[\^, kf46=\E[_, kf47=\E[`, kf48=\E[{, + kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, + kich1=\E[L, kmous=\E[>M, knp=\E[G, kpp=\E[I, + use=xterm-basic, + +# The xterm-new description has all of the features, but is not completely +# compatible with vt220. If you are using a Sun or PC keyboard, set the +# sunKeyboard resource to true: +# + maps the editing keypad +# + interprets control-function-key as a second array of keys, so a +# 12-fkey keyboard can support vt220's 20-fkeys. +# + maps numeric keypad "+" to ",". +# + uses DEC-style control sequences for the application keypad. +# +xterm-vt220|xterm emulating vt220, + kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kend=\E[4~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + use=xterm+app, use=xterm+edit, use=xterm-basic, + use=vt220+keypad, + +xterm-vt52|xterm emulating dec vt52, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, clear=\EH\EJ, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, ed=\EJ, el=\EK, + home=\EH, ht=^I, ind=^J, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, + use=xterm+kbs, + +xterm-noapp|xterm with cursor keys in normal mode, + rmcup@, rmkx=\E>, smcup@, smkx=\E=, use=xterm+noapp, + use=xterm, + +xterm-24|vs100|xterms|xterm terminal emulator (X Window System), + lines#24, use=xterm-old, + +# This is xterm for ncurses. +xterm|xterm terminal emulator (X Window System), + use=xterm-new, + +# This entry assumes that xterm's handling of VT100 SI/SO is disabled by +# setting the vt100Graphics resource to false. +xterm-utf8|xterm with no VT100 line-drawing in UTF-8 mode, + U8#1, use=xterm, + +# These building-blocks allow access to the X titlebar and icon name as a +# status line. There are a few problems in using them in entries: +# +# a) tsl should have a parameter to denote the column on which to transfer to +# the status line. +# b) the "0" code for xterm updates both icon-title and window title. Some +# window managers such as twm (and possibly window managers descended from +# it such as tvtwm, ctwm, and vtwm) track windows by icon-name. Thus, you +# don't want to mess with icon-name when using those window managers. +# +# The extension "TS" is preferable, because it does not accept a parameter. +# However, if you are using a non-extended terminfo, "TS" is not visible. +xterm+sl|access X title line and icon name, + hs, + dsl=\E]0;\007, fsl=^G, tsl=\E]0;, TS=\E]0;, +xterm+sl-twm|access X title line (pacify twm-descended window managers), + hs, + dsl=\E]2;\007, fsl=^G, tsl=\E]2;, TS=\E]2;, + +# In contrast, this block can be used for a DEC vt320 and up. There are two +# controls used. +# +# DECSASD (select active status display) +# \E[0$} Main display +# \E[1$} Status line +# +# DECSSDT (select status line type) +# \E[0$~ No status line +# \E[1$~ Indicator status line +# \E[2$~ Host-writable status line +# +# The building block assumes that the terminal always shows something at the +# status line (either the indicator, or status line). That is because if no +# status line is used, then the terminal makes that line part of the user +# window, changing its size without notice. +# +# Because there is no "esl" (enable status line) capability, the "tsl" +# capability ensures that the status line is host-writable. A DEC terminal +# will clear the status line when changing from indicator to host-writable +# mode. +# +# Once on the status line, the row part of cursor addressing is ignored. Since +# tsl expects a parameter (to specify the column), the shortest addressing that +# can be used for this purpose is HPA, e.g., \E[5d to go to column 5. +# +dec+sl|DEC VTxx status line, + eslok, hs, + dsl=\E[1$~, fsl=\E[0$}, tsl=\E[2$~\E[1$}\E[%i%p1%d`, + +# +# The following xterm variants don't depend on your base version +# +# xterm with bold instead of underline +xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold, + sgr=%?%p9%t\016%e\017%;B\E[0%?%p6%t;1%;%?%p2%t;1%;%?%p1%p3%| + %t;7%;m, + smso=\E[7m, smul=\E[1m, use=xterm-old, + +# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file +xterm-nic|xterm with ich/ich1 suppressed for non-curses programs, + ich@, ich1@, use=xterm, +# From: Mark Sheppard , 4 May 1996 +xterm1|xterm terminal emulator ignoring the alternate screen buffer, + rmcup@, smcup@, use=xterm, + +#### XTERM Mouse +# The xterm mouse protocol is used by other terminal emulators. +# In this section, two extended capabilities are used to illustrate the mouse +# protocol: XM and xm. The "XM" capability is recognized by ncurses to allow +# enabling/disabling other mouse protocols. The "xm" capability describes the +# mouse response; currently there is no interpreter which would use this +# information to make the mouse support completely data-driven. + +# Here is the "original" xterm mouse protocol. +# +# First seen in X10.3, February 1986, this likely dates from 1985 based on the +# copyright dates in the sources. A comment in charproc.c notes "MIT bogus +# sequence", referring to the fact that it does not correspond to a "real" +# terminal. The mouse responses for the X10 protocol are sent only for +# button-presses. +xterm+x10mouse|X10 xterm mouse protocol, + kmous=\E[M, XM=\E[?9%?%p1%{1}%=%th%el%;, + xm=\E[M%p3%' '%+%c%p2%'!'%+%c%p1%'!'%+%c, +xterm-x10mouse|X10 xterm mouse, + use=xterm+x10mouse, use=xterm, + +# Here is the conventional xterm mouse protocol, introduced with X11R1 in +# September 1987. +# +# The mouse responses for the X11 protocol covered button releases, as well as +# modifiers: +# shift 4 +# alt/meta 8 (technically the "mod1" mask, because X11 has no such keys) +# control 16 +# +# The modifiers are not reflected in this description because as used in xterm +# they are normally inaccessible because the translations resources assign +# shift and control to other features. However, they are important because +# they take up space in the first byte of the response. The other bits of this +# byte are used to encode the button number for both presses and releases. +# In the X11 protocol, any button-release is encoded with "3" (the lowest 2 +# bits in the byte). Later work on XFree86 xterm used the remaining 3 bits to +# provide additional features, e.g., wheel mouse. +# +# X11R1's xterm also supported an "emacs" mouse protocol, with final character +# "t" or "T", which was activated by double-clicking. The "t" response was +# used when the starting/ending positions were the same. +# +# X11R3 (February 1988) added the highlight/tracking mode. +# +# X11R4 (December 1989) added the control sequences document, listing the +# control sequences for the X10/X11 protocols without descriptions. It also +# mentioned the "emacs" ("T") response. Comments in button.c referred to the +# X11 protocol as "DEC vt200 compatible", although DEC offered no such terminal. +# +# X11R5 (November 1993) gave a description of the mouse protocol. +# +# X11R6 (January 1995) moved the control sequences document out of the xterm +# source-directory to xc/doc/specs/xterm, polishing the formatting but adding +# no new information. +xterm+x11mouse|X11 xterm mouse protocol, + kmous=\E[M, XM=\E[?1000%?%p1%{1}%=%th%el%;, + xm=\E[M%?%p4%t3%e%p3%'\s'%+%c%;%p2%'!'%+%c%p1%'!'%+%c, +xterm-x11mouse|X11 mouse, + use=xterm+x11mouse, use=xterm, + +# Here is a suggested description of the xterm highlighting protocol. +# A more complicated example could be constructed to account for the "t" +# response. +xterm+x11hilite|X11 xterm mouse protocol with highlight, + kmous=\E[M, XM=\E[?1001%?%p1%{1}%=%th%el%;, + xm=\E[%p7%'!'%+%p6%'!'%+%c%p9%'!'%+%c%p8%'!'%+%c%p2%'!'%+%c + %p1%'!'%+%cT, +xterm-x11hilite|X11 mouse with highlight, + use=xterm+x11mouse, use=xterm, + +# The preceding were the sources from X Consortium. Other sources (or patches) +# were available. Starting in mid-1995, XFree86 developers collected some of +# those changes and began improvements, e.g., to support color. This was, by +# the way, around the same time that rxvt developers began implementing color, +# though dates (and attributions) are not well documented. I became interested +# in xterm in late 1995, and involved in early 1996. To complete the picture, +# CDE's dtterm was introduced around the same time, with no mouse protocol -TD + +# xterm patch #83 (1998/10/7), added Jason Bacon's changes to provide an +# "any-event" mouse mode. +xterm+sm+1002|xterm any-event mouse, + kmous=\E[M, XM=\E[?1002%?%p1%{1}%=%th%el%;, +xterm-1002|xterm any-event mouse, + use=xterm+sm+1002, use=xterm, + +xterm+sm+1003|testing xterm-mouse, + kmous=\E[M, XM=\E[?1003%?%p1%{1}%=%th%el%;, + +xterm-1003|testing xterm-mouse, + use=xterm+sm+1003, use=xterm, + +# xterm patch #116 (1999/9/25) added Stephen P Wall's changes to support DEC +# locator mode. + +# xterm patch #120 (1999/10/28) added my change to support wheel mouse, by +# dropping support for the X11 mouse protocol's shift-modifier and using +# available bits in the first byte of the response to encode buttons 4 and 5. +# xterm patch #126 (2000/2/8) amended that change to avoid conflicting with +# older configurations which might have used the obsolete modifiers. + +# xterm patch #262 (2010/8/30) added Ryan Johnson's changes to provide a mode +# where the coordinates in the mouse response would be encoded in UTF-8, +# thereby extending the range of coordinates past 222=(255-33). This is the +# "1005" mouse mode. +xterm+sm+1005|xterm UTF-8 mouse, + kmous=\E[M, XM=\E[?1005;1000%?%p1%{1}%=%th%el%;, + xm=\E[M%?%p4%t3%e%p3%'\s'%+%c%;%p2%'!'%+%u%p1%'!'%+%u, +xterm-1005|xterm UTF-8 mouse, + use=xterm+sm+1005, use=xterm, + +# xterm patch #277 (2012/1/7) provides a mode where the mouse response uses +# SGR-style parameters. +# +# Someone stated that the 1005 mouse mode would not be handled properly in luit. +# (By the way, this is a problem with the X11 protocol). A more plausible +# criticism is that the responses provided by the 1005 mode are not distinct +# from the non-1005 responses. +# +# As an alternative (and fixing the longstanding limitation of X11 mouse +# protocol regarding button-releases), I provided this: +xterm+sm+1006|xterm SGR-mouse, + kmous=\E[<, XM=\E[?1006;1000%?%p1%{1}%=%th%el%;, + xm=\E[<%p1%d;%p2%d;%p3%d;%?%p4%tM%em%;, +xterm-1006|xterm SGR-mouse, + use=xterm+sm+1006, use=xterm, + +#### KTERM +# (kterm: this had extension capabilities ":KJ:TY=ascii:" -- esr) +# (kterm should not invoke DEC Graphics as the alternate character set +# -- Kenji Rikitake) +# (proper setting of enacs, smacs, rmacs makes kterm to use DEC Graphics +# -- MATSUMOTO Shoji) +# kterm implements acsc via built-in table of X Drawable's +kterm|kterm kanji terminal emulator (X window system), + eslok, hs, XT, + ncv@, + acsc=``aajjkkllmmnnooppqqrrssttuuvvwwxx~~, + csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs=, fsl=\E[?F, + kmous=\E[M, rc=\E8, rmacs=\E(B, rmam=\E[?7l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e + \E(B%;, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, + tsl=\E[?E\E[?%i%p1%dT, use=xterm-r6, use=ecma+color, +kterm-color|kterm-co|kterm with ANSI colors, + ncv@, use=kterm, use=ecma+color, + +#### Other XTERM +# These (xtermc and xtermm) are distributed with Solaris. They refer to a +# variant of xterm which is apparently no longer supported, but are interesting +# because they illustrate SVr4 curses mouse controls - T.Dickey +xtermm|xterm terminal emulator (monocrome), + OTbs, am, km, mir, msgr, xenl, + btns#3, cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink@, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0, getm=\E[%p1%dY, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\E[Y, kf0=\EOy, + kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, kf9=\EOX, khome=\E[H, kmous=\E[^_, + knp=\E[U, kpp=\E[V, rc=\E8, reqmp=\E[492Z, rev=\E[7m, ri=\EM, + rmacs=^O, rmcup=\E@0\E[?4r, rmso=\E[m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smcup=\E@0\E[?4s\E[?4h\E@1, + smso=\E[7m, tbc=\E[3g, use=vt100+fnkeys, + +xtermc|xterm terminal emulator (color), + colors#8, ncv#7, pairs#64, + op=\E[100m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + use=xtermm, + +# From: David J. MacKenzie 20 Apr 1995 +# Here's a termcap entry I've been using for xterm_color, which comes +# with BSD/OS 2.0, and the X11R6 contrib tape too I think. Besides the +# color stuff, I also have a status line defined as the window manager +# title bar. [I have translated it to terminfo -- ESR] +xterm-pcolor|xterm with color used for highlights and status line, + wsl#40, + bold=\E[1;43m, rev=\E[7;34m, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1;43%;%?%p2%t;4;42%;%?%p1 + %t;7;31%;%?%p3%t;7;34%;%?%p4%t;5%;%?%p7%t;8%;m, + smso=\E[7;31m, smul=\E[4;42m, use=xterm+sl, use=xterm-r6, + +# This describes the capabilities of color_xterm, an xterm variant from +# before ECMA-64 color support was folded into the main-line xterm release. +# This entry is straight from color_xterm's maintainer. +# From: Jacob Mandelson , 09 Nov 1996 +# The README's with the distribution also say that it supports SGR 21, 24, 25 +# and 27, but they are not present in the terminfo or termcap. +color_xterm|cx|cx100|color_xterm color terminal emulator for X, + OTbs, am, km, mir, msgr, xenl, XT, + cols#80, it#8, lines#65, ncv@, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, enacs=\E(B\E)0, home=\E[H, ht=^I, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is1=\E[r\E[m\E[?7h\E[?4;6l\E[4l, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kend=\E[8~, kf1=\E[11~, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, + kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[7~, kich1=\E[2~, + kmous=\E[M, knp=\E[6~, kpp=\E[5~, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmam=\E[?7l, rmcup=\E>\E[?41;1r, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, + rs1=\E(B\017\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;, + sgr0=\E[0m\017, smacs=^N, smam=\E[?7h, + smcup=\E[?1;41s\E[?1;41h\E=, smir=\E[4h, smso=\E[7m, + smul=\E[4m, use=ecma+color, use=vt220+keypad, + +# The 'nxterm' distributed with Redhat Linux 5.2 is a slight rehack of +# xterm-sb_right-ansi-3d, which implements ANSI colors, but does not support +# SGR 39 or 49. SGR 0 does reset colors (along with everything else). This +# description is "compatible" with color_xterm, rxvt and XFree86 xterm, except +# that each of those implements the home, end, delete keys differently. +# +# Redhat Linux 6.x distributes XFree86 xterm as "nxterm", which uses bce +# colors; note that this is not compatible with the 5.2 version. +# csw (2002-05-15): make xterm-color primary instead of nxterm, to +# match XFree86's xterm.terminfo usage and prevent circular links +xterm-color|nxterm|generic color xterm, + ncv@, + op=\E[m, use=xterm-r6, use=klone+color, + +# This entry describes an xterm with Sun-style function keys enabled +# via the X resource setting "xterm*sunFunctionKeys:true" +# To understand / note that L1,L2 and F11,F12 are the same. +# The ... keys are L3-L10. We don't set +# because we want it to be seen as . +# The ... keys are R1-R15. We treat some of these in accordance +# with their Sun keyboard labels instead. +# From: Simon J. Gerraty 10 Jan 1996 +xterm-sun|xterm with sunFunctionKeys true, + kb2=\E[218z, kcpy=\E[197z, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3z, kend=\E[220z, + kent=\EOM, kf1=\E[224z, kf10=\E[233z, kf11=\E[192z, + kf12=\E[193z, kf13=\E[194z, kf14=\E[195z, kf15=\E[196z, + kf17=\E[198z, kf18=\E[199z, kf19=\E[200z, kf2=\E[225z, + kf20=\E[201z, kf3=\E[226z, kf31=\E[208z, kf32=\E[209z, + kf33=\E[210z, kf34=\E[211z, kf35=\E[212z, kf36=\E[213z, + kf38=\E[215z, kf4=\E[227z, kf40=\E[217z, kf42=\E[219z, + kf44=\E[221z, kf45=\E[222z, kf46=\E[234z, kf47=\E[235z, + kf5=\E[228z, kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, + kf9=\E[232z, kfnd=\E[200z, khlp=\E[196z, khome=\E[214z, + kich1=\E[2z, knp=\E[222z, kpp=\E[216z, kund=\E[195z, + use=xterm-basic, +xterms-sun|small (80x24) xterm with sunFunctionKeys true, + cols#80, lines#24, use=xterm-sun, + +#### GNOME (VTE) +# this describes the alpha-version of Gnome terminal shipped with Redhat 6.0 +gnome-rh62|Gnome terminal, + bce, + kdch1=\177, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + use=xterm-color, + +# GNOME Terminal 1.4.0.4 (Redhat 7.2) +# +# This implements a subset of vt102 with a random selection of features from +# other terminals such as color and function-keys. +# +# shift-f1 to shift-f10 are f11 to f20 +# +# NumLock changes the application keypad to approximate vt100 keypad, except +# that there is no escape sequence matching comma (,). +# +# Other defects observed: +# vt100 LNM mode is not implemented. +# vt100 80/132 column mode is not implemented. +# vt100 DECALN is not implemented. +# vt100 DECSCNM mode is not implemented, so flash does not work. +# vt100 TBC (tab reset) is not implemented. +# xterm alternate screen controls do not restore cursor position properly +# it hangs in tack after running function-keys test. +gnome-rh72|GNOME Terminal, + bce, km@, + civis=\E[?25l, cnorm=\E[?25h, kdch1=\E[3~, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, rmam=\E[?7l, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\016%e + \017%;, + sgr0=\E[0m\017, smam=\E[?7h, tbc@, use=xterm-color, + +# GNOME Terminal 2.0.1 (Redhat 8.0) +# +# Documentation now claims it implements vt220 (which is demonstrably false). +# However, it does implement ECH, which is a vt220 feature. And there are +# workable vt100 LNM, DECALN, DECSNM modes, making it possible to display +# more of its bugs using vttest. +# +# However, note that bce and msgr are broken in this release. Tabs (tbc and +# hts) are broken as well. Sometimes flash (as in xterm-new) works. +# +# kf1 and kf10 are not tested since they're assigned (hardcoded?) to menu +# operations. Shift-tab generates a distinct sequence so it can be argued +# that it implements kcbt. +gnome-rh80|GNOME Terminal, + bce@, msgr@, + ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l, kbs=\177, + kcbt=\E^I, op=\E[39;49m, use=gnome-rh72, + +# GNOME Terminal 2.2.1 (Redhat 9.0) +# +# bce and msgr are repaired. +gnome-rh90|GNOME Terminal, + bce, msgr, XT, + hpa=\E[%i%p1%dG, kDC=\E[3;2~, kLFT=\EO2D, kRIT=\EO2C, + kb2=\E[E, kcbt=\E[Z, kend=\EOF, khome=\EOH, tbc=\E[3g, + vpa=\E[%i%p1%dd, use=xterm+pcf0, use=xterm+pcfkeys, + use=gnome-rh80, + +# GNOME Terminal 2.14.2 (Fedora Core 5) +# Ed Catmur notes that gnome-terminal has recognized soft-reset since May 2002. +gnome-fc5|GNOME Terminal, + rs1=\Ec, + rs2=\E7\E[r\E8\E[m\E[?7h\E[!p\E[?1;3;4;6l\E[4l\E>\E[?1000l + \E[?25h, + use=ansi+enq, use=xterm+pcc0, use=gnome-rh90, + +# GNOME Terminal 2.18.1 (2007 snapshot) +# +# For any "recent" version of gnome-terminal, it is futile to attempt to +# support modifiers on cursor- and keypad keys because the program usually +# is hardcoded to set $TERM to "xterm", and on startup, it builds a subset +# of the keys (which more/less correspond to the termcap values), and will +# interpret those according to the $TERM value, but others not in the +# terminfo according to some constantly changing set of hacker guidelines -TD +vte-2007|VTE in GNOME Terminal snapshot 2.18.1, + use=xterm+pcc2, use=gnome-fc5, +gnome-2007|GNOME Terminal snapshot 2.18.1, + use=vte-2007, + +# GNOME Terminal 2.22.3 (2008 snapshot) +# +# In vttest, it claims to be a vt220 with national replacement character-sets, +# but aside from the identifier string, implements only a small fraction of +# vt220's behavior, which will make it less usable on a VMS system (unclear +# what the intent of the developer is, since the NRC feature exposed in vttest +# by this change does not work). +vte-2008|VTE in GNOME Terminal snapshot 2.22.3, + use=vte+pcfkeys, use=vte-2007, +gnome-2008|GNOME Terminal snapshot 2.22.3, + use=vte-2008, + +# GNOME Terminal 3.6.0 (2012) +# VTE 0.34.1 was marked in git 2012-10-15 (three days after patch was applied +# in ncurses). It inherited from gnome-fc5, which broke the modified forms +# of f1-f4 -TD +# +# Testing with tack shows that flash does not/has not worked -TD +vte-2012|VTE 0.34.1, + ncv#16, + dim=\E[2m, flash@, invis=\E[8m, ritm=\E[23m, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p5%t;2%;%?%p7%t;8%;%?%p1%p3 + %|%t;7%;m%?%p9%t\016%e\017%;, + sitm=\E[3m, use=vte-2008, +# Version 3.6.1 sets TERM to xterm-256color (still hardcoded), which has +# 61 differences from a correct entry for gnome terminal. +gnome-2012|GNOME Terminal 3.6.0, + use=vte-2012, + +# GNOME terminal may automatically use the contents of the "xterm" terminfo to +# supply key information which is not built into the program. With 2.22.3, +# this list is built into the program (which addresses the inadvertant use of +# random terminfo data, though using a set of values which does not correspond +# to any that xterm produces - still not solving the problem that GNOME +# terminal hardcodes the $TERM variable as "xterm"). +# +# terminfo modifier code keys +# kf13-kf24 shift 2 F1 to F12 +# kf25-kf36 control 5 F1 to F12 +# kf37-kf48 shift/control 6 F1 to F12 +# kf49-kf60 alt 3 F1 to F12 +# kf61-kf63 shift-alt 4 F1 to F3 +# +# The parameters with \EO (SS3) are technically an error, since SS3 should have +# no parameters. This appears to be rote copying based on xterm+pcc0. +vte+pcfkeys|VTE's variation on xterm+pcfkeys, + kf1=\EOP, kf13=\EO1;2P, kf14=\EO1;2Q, kf15=\EO1;2R, + kf16=\EO1;2S, kf2=\EOQ, kf25=\EO1;5P, kf26=\EO1;5Q, + kf27=\EO1;5R, kf28=\EO1;5S, kf3=\EOR, kf37=\EO1;6P, + kf38=\EO1;6Q, kf39=\EO1;6R, kf4=\EOS, kf40=\EO1;6S, + kf49=\EO1;3P, kf50=\EO1;3Q, kf51=\EO1;3R, kf52=\EO1;3S, + kf61=\EO1;4P, kf62=\EO1;4Q, kf63=\EO1;4R, + use=xterm+pcfkeys, +gnome+pcfkeys|VTE's variation on xterm+pcfkeys, + use=vte+pcfkeys, + +# deprecated - use "vte" for newer versions +gnome|GNOME Terminal, + use=vte-2012, + +# relevant changes were made in January 2014, and later. +vte-2014|VTE 0.35.1, + ncv@, + cbt=\E[Z, el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, + ich=\E[%p1%d@, indn=\E[%p1%dS, kent=\EOM, rin=\E[%p1%dT, + rmso=\E[27m, rmul=\E[24m, use=xterm+pcfkeys, + use=vte-2012, + +vte|VTE aka GNOME Terminal, + use=vte-2014, + +vte-256color|VTE with xterm 256-colors, + use=xterm+256color, use=vte, +gnome-256color|GNOME Terminal with xterm 256-colors, + use=vte-256color, + +# XFCE Terminal 0.2.5.4beta2 +# +# This is based on some of the same source code, e.g., the VTE library, as +# gnome-terminal, but has fewer features, fails more screens in vttest. +# Since most of the terminfo-related behavior is due to the VTE library, +# the terminfo is the same as gnome-terminal. +xfce|Xfce Terminal, + use=vte-2008, + +#### Other GNOME +# Multi-Gnome-Terminal 1.6.2 +# +# This does not use VTE, and does have different behavior (compare xfce and +# gnome). +mgt|Multi GNOME Terminal, + indn=\E[%p1%dS, rin=\E[%p1%dT, use=xterm-xf86-v333, + +#### KDE +# This is kvt 0-18.7, shipped with Redhat 6.0 (though whether it supports bce +# or not is debatable). +kvt|KDE terminal, + bce, km@, + kdch1=\177, kend=\E[F, khome=\E[H, use=xterm-color, + +# Konsole 1.0.1 +# (formerly known as kvt) +# +# This program hardcodes $TERM to 'xterm', which is not accurate. However, to +# simplify this entry (and point out why konsole isn't xterm), we base this on +# xterm-r6. The default keyboard appears to be 'linux'. +# +# Notes: +# a) konsole implements several features from XFree86 xterm, though none of +# that is documented - except of course in its source code - apparently +# because its implementors are unaccustomed to reading documentation - as +# evidenced by the sparse and poorly edited documentation distributed with +# konsole. Some features such as the 1049 private mode are recognized but +# incorrectly implemented as a duplicate of the 47 private mode. +# b) even with the "vt100 (historical)" keyboard setting, the numeric keypad +# sends PC-style escapes rather than vt100. +# c) fails vttest menu 3 (Test of character sets) because it does not properly +# parse some control sequences. Also fails vttest Primary Device Attributes +# by sending a bogus code (in the source it says it's supposed to be a +# vt220, which is doubly incorrect because it does not implement vt220 +# control sequences except for a few special cases). Treat it as a +# mildly-broken vt102. +# +# Update for konsole 1.3.2: +# The 1049 private mode works (but see the other xterm screens in vttest). +# Primary Device Attributes now returns the code for a vt100 with advanced +# video option. Perhaps that's intended to be a "mildly-broken vt102". +# +# Updated for konsole 1.6.4: +# add konsole-solaris +# +# Updated for konsole 1.6.6: +# add control-key modifiers for function-keys, etc. +# +# Updated for konsole 2.12.4: +# add sitm/ritm +# +# vttest menu 1 shows that both konsole and gnome terminal do wrapping +# different from xterm (and vt100's). They have the same behavior in this +# detail, but it is unclear which copies the other. +konsole-base|KDE console window, + bce, km@, npc, XT, + ncv@, + bel@, blink=\E[5m, civis=\E[?25l, cnorm=\E[?25h, + ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l, + hpa=\E[%i%p1%dG, indn=\E[%p1%dS, kbs=\177, kdch1=\E[3~, + kend=\E[4~, kf1@, kf10@, kf11@, kf12@, kf13@, kf14@, kf15@, kf16@, + kf17@, kf18@, kf19@, kf2@, kf20@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + kf9@, kfnd@, khome=\E[1~, kslt@, rin=\E[%p1%dT, ritm=\E[23m, + rmam=\E[?7l, rmso=\E[27m, rmul=\E[24m, + rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%? + %p9%t\016%e\017%;, + sgr0=\E[0m\017, sitm=\E[3m, smam=\E[?7h, vpa=\E[%i%p1%dd, + use=ecma+color, use=xterm-r6, +konsole-linux|KDE console window with linux keyboard, + kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13@, + kf14@, kf15@, kf16@, kf17@, kf18@, kf19@, kf2=\E[[B, kf20@, + kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, use=konsole-base, +konsole-solaris|KDE console window with Solaris keyboard, + kbs=^H, kend=\E[4~, khome=\E[1~, use=konsole-vt100, +# KDE's "XFree86 3.x.x" keyboard is based on reading the xterm terminfo rather +# than testing the code. +konsole-xf3x|KDE console window with keyboard for XFree86 3.x xterm, + kend=\E[4~, khome=\E[1~, use=konsole-vt100, +# The value for kbs reflects local customization rather than the settings used +# for XFree86 xterm. +konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm, + kend=\EOF, khome=\EOH, use=konsole+pcfkeys, + use=konsole-vt100, +# Konsole does not implement shifted cursor-keys. +konsole+pcfkeys|konsole subset of xterm+pcfkeys, + kLFT@, kRIT@, kcbt=\E[Z, kind@, kri@, kDN@, kUP@, use=xterm+pcc2, + use=xterm+pcf0, +# KDE's "vt100" keyboard has no relationship to any terminal that DEC made, but +# it is still useful for deriving the other entries. +konsole-vt100|KDE console window with vt100 (sic) keyboard, + kbs=\177, kdch1=\E[3~, kend=\E[F, kf1=\E[11~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13@, kf14@, kf15@, kf16@, kf17@, + kf18@, kf19@, kf2=\E[12~, kf20@, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[H, use=konsole-base, +konsole-vt420pc|KDE console window with vt420 pc keyboard, + kbs=^H, kdch1=\177, use=konsole-vt100, +konsole-16color|klone of xterm-16color, + ncv#32, use=ibm+16color, use=konsole, +# make a default entry for konsole +konsole|KDE console window, + use=konsole-xf4x, + +konsole-256color|KDE console window with xterm 256-colors, + use=xterm+256setaf, use=konsole, + +#### MLTERM +# http://mlterm.sourceforge.net/ + +mlterm|multi lingual terminal emulator, + use=mlterm3, + +# Tested mlterm 3.2.2: +# mlterm 3.x has made changes, but they are not reflected in the included +# mlterm.ti; this entry is based on testing with tack and vttest -TD +mlterm3|multi lingual terminal emulator, + kf1=\E[11~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, + ritm=\E[23m, sitm=\E[3m, use=xterm+app, use=xterm+pcf0, + use=xterm+pcc2, use=xterm+pce2, use=mlterm2, + +# This is mlterm 2.9.3's mlterm.ti, with some additions/corrections -TD +# +# It is nominally a vt102 emulator, with features borrowed from rxvt and +# xterm. +# +# The function keys are numbered based on shift/control/alt modifiers, except +# that the control-modifier itself is used to spawn a new copy of mlterm (the +# "-P" option). So control/F1 to control/F12 may not be usable, depending on +# how it is configured. +# +# kf1 to kf12 \E[11~ to \E[24~ +# shift kf1 to kf12 \E[11;2~ to \E[24;2~ +# alt kf1 to kf12 \E[11;3~ to \E[24;3~ +# shift/alt kf1 to kf12 \E[11;4~ to \E[24;4~ +# control kf1 to kf12 \E[11;5~ to \E[24;5~ (maybe) +# control/shift kf1 to kf12 \E[11;6~ to \E[24;6~ +# control/alt kf1 to kf12 \E[11;7~ to \E[24;7~ +# control/shift/alt kf1 to kf12 \E[11;8~ to \E[24;8~ +# +mlterm2|multi lingual terminal emulator, + am, eslok, km, mc5i, mir, msgr, npc, xenl, XT, + colors#8, cols#80, it#8, lines#24, pairs#64, + acsc=00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, + is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, + kbs=\177, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, kdch1=\E[3~, kend=\EOF, kent=\EOM, kfnd=\E[1~, + khome=\EOH, kich1=\E[2~, kind=\EO1;2B, kmous=\E[M, + knp=\E[6~, kpp=\E[5~, kri=\EO1;2A, kslt=\E[4~, mc0=\E[i, + nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, + rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, + rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l, + sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e + \E(B%;, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h, + smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, + vpa=\E[%i%p1%dd, use=mlterm+pcfkeys, use=xterm+r6f2, + +# The insert/delete/home/end keys do not respond to modifiers because mlterm +# looks in its termcap to decide which string to send. If it used terminfo +# (when available), it could use the extended names introduced for xterm. +mlterm+pcfkeys|fragment for PC-style fkeys, + kLFT=\EO1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\EO1;2C, + kDN=\EO1;2B, kDN3=\EO1;3B, kDN4=\EO1;4B, kDN5=\EO1;5B, + kDN6=\EO1;6B, kDN7=\EO1;7B, kIC5=\E[2;5~, kIC6=\E[2;6~, + kLFT3=\EO1;3D, kLFT4=\EO1;4D, kLFT5=\EO1;5D, + kLFT6=\EO1;6D, kLFT7=\EO1;7D, kNXT5=\E[6;5~, + kNXT6=\E[6;6~, kPRV5=\E[5;5~, kPRV6=\E[5;6~, + kRIT3=\EO1;3C, kRIT4=\EO1;4C, kRIT5=\EO1;5C, + kRIT6=\EO1;6C, kRIT7=\EO1;7C, kUP=\EO1;2A, kUP3=\EO1;3A, + kUP4=\EO1;4A, kUP5=\EO1;5A, kUP6=\EO1;6A, kUP7=\EO1;7A, + +mlterm-256color|mlterm 3.0 with xterm 256-colors, + use=xterm+256color, use=mlterm, + +#### RXVT +# From: Thomas Dickey 04 Oct 1997 +# Updated: Oezguer Kesim 02 Nov 1997 +# Notes: +# rxvt 2.21b uses +# smacs=\E(B\E)U^N, rmacs=\E(B\E)0^O, +# but some applications don't work with that. +# It also has an AIX extension +# box2=lqkxjmwuvtn, +# and +# ech=\E[%p1%dX, +# but the latter does not work correctly. +# +# The distributed terminfo says it implements hpa and vpa, but they are not +# implemented correctly, using relative rather than absolute positioning. +# +# rxvt is normally configured to look for "xterm" or "xterm-color" as $TERM. +# Since rxvt is not really compatible with xterm, it should be configured as +# "rxvt" or "rxvt-color". +# +# removed dch/dch1 because they are inconsistent with bce/ech -TD +# remove km as per tack test -TD +rxvt-basic|rxvt terminal base (X Window System), + OTbs, am, bce, eo, mir, msgr, xenl, xon, XT, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=\E[?5h$<100/>\E[?5l, home=\E[H, + ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, is1=\E[?47l\E=\E[?1l, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^H, + kcbt=\E[Z, kmous=\E[M, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, + rmul=\E[24m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, + rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[? + 25h, + s0ds=\E(B, s1ds=\E(0, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%? + %p9%t\016%e\017%;, + sgr0=\E[0m\017, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, + smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, use=vt100+enq, + use=rxvt+pcfkeys, use=vt220+keypad, +# Key Codes from rxvt reference: +# +# Note: Shift + F1-F10 generates F11-F20 +# +# For the keypad, use Shift to temporarily override Application-Keypad +# setting use Num_Lock to toggle Application-Keypad setting if Num_Lock +# is off, escape sequences toggle Application-Keypad setting. +# Also note that values of Home, End, Delete may have been compiled +# differently on your system. +# +# Normal Shift Control Ctrl+Shift +# Tab ^I ESC [ Z ^I ESC [ Z +# BackSpace ^H ^? ^? ^? +# Find ESC [ 1 ~ ESC [ 1 $ ESC [ 1 ^ ESC [ 1 @ +# Insert ESC [ 2 ~ paste ESC [ 2 ^ ESC [ 2 @ +# Execute ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @ +# Select ESC [ 4 ~ ESC [ 4 $ ESC [ 4 ^ ESC [ 4 @ +# Prior ESC [ 5 ~ scroll-up ESC [ 5 ^ ESC [ 5 @ +# Next ESC [ 6 ~ scroll-down ESC [ 6 ^ ESC [ 6 @ +# Home ESC [ 7 ~ ESC [ 7 $ ESC [ 7 ^ ESC [ 7 @ +# End ESC [ 8 ~ ESC [ 8 $ ESC [ 8 ^ ESC [ 8 @ +# Delete ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @ +# F1 ESC [ 11 ~ ESC [ 23 ~ ESC [ 11 ^ ESC [ 23 ^ +# F2 ESC [ 12 ~ ESC [ 24 ~ ESC [ 12 ^ ESC [ 24 ^ +# F3 ESC [ 13 ~ ESC [ 25 ~ ESC [ 13 ^ ESC [ 25 ^ +# F4 ESC [ 14 ~ ESC [ 26 ~ ESC [ 14 ^ ESC [ 26 ^ +# F5 ESC [ 15 ~ ESC [ 28 ~ ESC [ 15 ^ ESC [ 28 ^ +# F6 ESC [ 17 ~ ESC [ 29 ~ ESC [ 17 ^ ESC [ 29 ^ +# F7 ESC [ 18 ~ ESC [ 31 ~ ESC [ 18 ^ ESC [ 31 ^ +# F8 ESC [ 19 ~ ESC [ 32 ~ ESC [ 19 ^ ESC [ 32 ^ +# F9 ESC [ 20 ~ ESC [ 33 ~ ESC [ 20 ^ ESC [ 33 ^ +# F10 ESC [ 21 ~ ESC [ 34 ~ ESC [ 21 ^ ESC [ 34 ^ +# F11 ESC [ 23 ~ ESC [ 23 $ ESC [ 23 ^ ESC [ 23 @ +# F12 ESC [ 24 ~ ESC [ 24 $ ESC [ 24 ^ ESC [ 24 @ +# F13 ESC [ 25 ~ ESC [ 25 $ ESC [ 25 ^ ESC [ 25 @ +# F14 ESC [ 26 ~ ESC [ 26 $ ESC [ 26 ^ ESC [ 26 @ +# F15 (Help) ESC [ 28 ~ ESC [ 28 $ ESC [ 28 ^ ESC [ 28 @ +# F16 (Menu) ESC [ 29 ~ ESC [ 29 $ ESC [ 29 ^ ESC [ 29 @ +# F17 ESC [ 31 ~ ESC [ 31 $ ESC [ 31 ^ ESC [ 31 @ +# F18 ESC [ 32 ~ ESC [ 32 $ ESC [ 32 ^ ESC [ 32 @ +# F19 ESC [ 33 ~ ESC [ 33 $ ESC [ 33 ^ ESC [ 33 @ +# F20 ESC [ 34 ~ ESC [ 34 $ ESC [ 34 ^ ESC [ 34 @ +# +# Application +# Up ESC [ A ESC [ a ESC O a ESC O A +# Down ESC [ B ESC [ b ESC O b ESC O B +# Right ESC [ C ESC [ c ESC O c ESC O C +# Left ESC [ D ESC [ d ESC O d ESC O D +# KP_Enter ^M ESC O M +# KP_F1 ESC O P ESC O P +# KP_F2 ESC O Q ESC O Q +# KP_F3 ESC O R ESC O R +# KP_F4 ESC O S ESC O S +# XK_KP_Multiply * ESC O j +# XK_KP_Add + ESC O k +# XK_KP_Separator , ESC O l +# XK_KP_Subtract - ESC O m +# XK_KP_Decimal . ESC O n +# XK_KP_Divide / ESC O o +# XK_KP_0 0 ESC O p +# XK_KP_1 1 ESC O q +# XK_KP_2 2 ESC O r +# XK_KP_3 3 ESC O s +# XK_KP_4 4 ESC O t +# XK_KP_5 5 ESC O u +# XK_KP_6 6 ESC O v +# XK_KP_7 7 ESC O w +# XK_KP_8 8 ESC O x +# XK_KP_9 9 ESC O y +# +# The source-code for rxvt actually defines mappings for F21-F35, using +# "ESC [ 35 ~" to "ESC [ 49 ~". Keyboards with more than 12 function keys +# are rare, so this entry uses the shift- and control-modifiers as in +# xterm+pcfkeys to define keys past F12. +# +# kIC is normally not used, since rxvt performs a paste for that (shifted +# insert), unless private mode 35 is set. +# +# kDN, kDN5, kDN6, etc are extensions based on the names from xterm+pcfkeys -TD +# Removed kDN6, etc (control+shift) since rxvt does not implement this -TD +rxvt+pcfkeys|fragment for PC-style fkeys, + kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kIC=\E[2$, kLFT=\E[d, + kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kel=\E[8\^, + kend=\E[8~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\E[12~, kf20=\E[34~, kf21=\E[23$, kf22=\E[24$, + kf23=\E[11\^, kf24=\E[12\^, kf25=\E[13\^, kf26=\E[14\^, + kf27=\E[15\^, kf28=\E[17\^, kf29=\E[18\^, kf3=\E[13~, + kf30=\E[19\^, kf31=\E[20\^, kf32=\E[21\^, kf33=\E[23\^, + kf34=\E[24\^, kf35=\E[25\^, kf36=\E[26\^, kf37=\E[28\^, + kf38=\E[29\^, kf39=\E[31\^, kf4=\E[14~, kf40=\E[32\^, + kf41=\E[33\^, kf42=\E[34\^, kf43=\E[23@, kf44=\E[24@, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kfnd=\E[1~, khome=\E[7~, kich1=\E[2~, kind=\E[a, knp=\E[6~, + kpp=\E[5~, kri=\E[b, kslt=\E[4~, kDC5=\E[3\^, kDC6=\E[3@, + kDN=\E[b, kDN5=\EOb, kEND5=\E[8\^, kEND6=\E[8@, + kHOM5=\E[7\^, kHOM6=\E[7@, kIC5=\E[2\^, kIC6=\E[2@, + kLFT5=\EOd, kNXT5=\E[6\^, kNXT6=\E[6@, kPRV5=\E[5\^, + kPRV6=\E[5@, kRIT5=\EOc, kUP=\E[a, kUP5=\EOa, + +# rxvt was originally "xvt", first announced in April 1993: +# http://www.informatica.co.cr/linux-desktops/research/1993/0416.html +# +# Though its change-log does not mention this, John Davis has stated that he +# was the author of the changes to use the bce ("new color model") which was +# incorporated into rxvt 2.11 (June 15, 1995). The change-log does not give +# dates, nor give developer's names. Initial color support was added for rxvt +# "2.0", which was sometime in 1994. +# +# rxvt had usable color support with 2.16 (April 2, 1996), with some help by my +# work on vttest, as well as bug reports to Mark Olesen. For instance, the fix +# mentioned here +# http://web.archiveorange.com/archive/v/6ETvLb5wHtbbzCaS4S9J +# was from one of my bug-reports -TD +# +# While the color model both for xterm and rxvt was based on Linux console, +# Olesen (or possibly Davis) diverged in one respect from Linux's bce color +# behavior: inserting/deleting characters does not fill the newly empty cell +# with the default background color. +rxvt|rxvt terminal emulator (X Window System), + ncv@, + hpa=\E[%i%p1%dG, kf0=\E[21~, sgr0=\E[m\017, + vpa=\E[%i%p1%dd, use=rxvt-basic, use=ecma+color, +rxvt-color|rxvt terminal emulator (X Window System), + use=rxvt, +rxvt-256color|rxvt 2.7.9 with xterm 256-colors, + use=xterm+256color, use=rxvt, +rxvt-88color|rxvt 2.7.9 with xterm 88-colors, + use=xterm+88color, use=rxvt, +rxvt-xpm|rxvt terminal emulator (X Window System), + use=rxvt, +rxvt-cygwin|rxvt terminal emulator (X Window System) on cygwin, + acsc=+\257\,\256-\^0\333`\004a\261f\370g\361h\260j\331k + \277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w + \302x\263y\363z\362{\343|\330}\234~\376, + use=rxvt, +rxvt-cygwin-native|rxvt terminal emulator (native MS Window System port) on cygwin, + acsc=+\257\,\256-\^0\333`\004a\261f\370g\361h\260j\331k + \277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w + \302x\263y\363z\362{\343|\330~\376, + use=rxvt-cygwin, + +# This variant is supposed to work with rxvt 2.7.7 when compiled with +# NO_BRIGHTCOLOR defined. rxvt needs more work... +rxvt-16color|rxvt with 16 colors like aixterm, + ncv#32, use=ibm+16color, use=rxvt, + +#### MRXVT +# mrxvt 0.5.4 +# +# mrxvt is based on rxvt 2.7.11, but has by default XTERM_FKEYS defined, which +# makes its function-keys different from other flavors of rxvt -TD +# +# Testing with tack: +# + made custom description (below) to work, though it sets TERM=xterm. +# +# Testing with vttest: +# + While "based on" rxvt, some of the basic functionality is broken. The +# window collapses to a single line when running several of the screens +# in vttest, e.g., the tests for cursor movement, screen features, +# double-sized characters. +# + The vt52 test works properly, but this is an exception. Due to the +# other bug(s) most of vttest is untestable. +# + the color test using ECH shows a gap in the bce model, like rxvt. +# +# Testing with xterm "vttest" scripts: +# + resize.pl does not work because mrxvt does implement CSI 18 t +# (not in rxvt, but not documented by mrxvt) but not CSI 19 t. +# + none of the "dynamic colors" (OSC colors) scripts work. +mrxvt|multitabbed rxvt, + XT, + kEND=\E[8;2~, kHOM=\E[7;2~, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kend=\E[8~, khome=\E[7~, + kEND3=\E[8;3~, kEND4=\E[8;4~, kEND5=\E[8;5~, + kEND6=\E[8;6~, kEND7=\E[8;7~, kHOM3=\E[7;3~, + kHOM4=\E[7;4~, kHOM5=\E[7;5~, kHOM6=\E[7;6~, + kHOM7=\E[7;7~, use=xterm+r6f2, use=xterm+pcfkeys, + use=rxvt, + +mrxvt-256color|multitabbed rxvt with 256 colors, + use=xterm+256color, use=mrxvt, + +#### ETERM +# From: Michael Jennings +# +# Eterm 0.9.3 +# +# removed kf0 which conflicts with kf10 -TD +# remove cvvis which conflicts with cnorm -TD +# Eterm does not implement control/shift cursor keys such as kDN6, or kPRV/kNXT +# but does otherwise follow the rxvt+pcfkeys model -TD +# remove nonworking flash -TD +# remove km as per tack test -TD +Eterm|Eterm-color|Eterm with xterm-style color support (X Window System), + am, bce, bw, eo, mc5i, mir, msgr, xenl, xon, XT, + btns#5, cols#80, it#8, lines#24, lm#0, ncv@, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is1=\E[?47l\E>\E[?1l, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kNXT@, + kPRV@, ka1=\E[7~, ka3=\E[5~, kb2=\EOu, kbeg=\EOu, kbs=^H, + kc1=\E[8~, kc3=\E[6~, kent=\EOM, khlp=\E[28~, kmous=\E[M, + mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=, + rmso=\E[27m, rmul=\E[24m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, + rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[? + 25h, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, + smir=\E[4h, smkx=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%i%p1%dd, use=vt100+enq, use=rxvt+pcfkeys, + use=ecma+color, + +Eterm-256color|Eterm with xterm 256-colors, + use=xterm+256color, use=Eterm, + +Eterm-88color|Eterm with 88 colors, + use=xterm+88color, use=Eterm, + +#### ATERM +# Based on rxvt 2.4.8, it has a few differences in key bindings +aterm|AfterStep terminal, + XT, + kbs=\177, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, use=rxvt, + +#### XITERM +# xiterm 0.5-5.2 +# This is not based on xterm's source... +# vttest shows several problems with keyboard, cursor-movements. +# see also http://invisible-island.net/xterm/xterm.faq.html#bug_xiterm +xiterm|internationalized terminal emulator for X, + km@, + kbs=\177, kdch1=\E[3~, use=klone+color, use=xterm-r6, + + +#### HPTERM +# HP ships this (HPUX 9 and 10), except for the pb#9600 which was merged in +# from BSD termcap. (hpterm: added empty , we have no idea what ACS +# chars look like --esr) +hpterm|X-hpterm|hp X11 terminal emulator, + am, da, db, mir, xhp, + cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, pb#9600, xmc#0, + acsc=, bel=^G, bold=\E&dB, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, + cub1=^H, cud1=\EB, cuf1=\EC, cup=\E&a%p1%dy%p2%dC, + cuu1=\EA, dch1=\EP, dim=\E&dH, dl1=\EM, ed=\EJ$<1>, el=\EK, + hpa=\E&a%p1%dC, ht=^I, hts=\E1, il1=\EL, ind=^J, kbs=^H, + kclr=\EJ, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, kf1=\Ep, + kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, + khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, kind=\ES, kll=\EF, + knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, ktbc=\E3, meml=\El, + memu=\Em, pfkey=\E&f%p1%dk%p2%l%dL%p2%s, + pfloc=\E&f1a%p1%dk%p2%l%dL%p2%s, + pfx=\E&f2a%p1%dk%p2%l%dL%p2%s, + pln=\E&f%p1%dk%p2%l%dd0L%p2%s, rev=\E&dB, ri=\ET, + rmacs=^O, rmir=\ER, rmkx=\E&s0A, rmln=\E&j@, rmso=\E&d@, + rmul=\E&d@, + sgr=\E&d%?%p7%t%{115}%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+ + %p5%{8}%*%+%{64}%+%c%?%p9%t%'\016'%c%e%'\017'%c%;, + sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smln=\E&jB, + smso=\E&dJ, smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, +# HPUX 11 provides a color version. +hpterm-color|HP X11 terminal emulator with color, + ccc, + colors#64, pairs#8, + home=\E&a0y0C, + initp=\E&v%p2%da%p3%db%p4%dc%p5%dx%p6%dy%p7%dz%p1%dI, + op=\E&v0S, scp=\E&v%p1%dS, use=hpterm, + +#### EMU +# This is for the extensible terminal emulator on the X11R6 contrib tape. +# It corresponds to emu's internal emulation: +# emu -term emu +# emu's default sets TERM to "xterm", but that doesn't work well -TD +# fixes: remove bogus rmacs/smacs, change oc to op, add bce, am -TD +# fixes: add civis, cnorm, sgr -TD +emu|emu native mode, + am, bce, mir, msgr, xon, + colors#15, cols#80, it#8, lines#24, pairs#64, vt#200, + acsc=61a\202f\260g2j\213k\214l\215m\216n\217o\220q\222s + \224t\225u\226v\227w\230x\231~\244, + bel=^G, blink=\EW, bold=\EU, civis=\EZ, clear=\EP\EE0;0;, + cnorm=\Ea, cr=^M, csr=\Ek%p1%d;%p2%d;, cub=\Eq-%p1%d;, + cub1=^H, cud=\Ep%p1%d;, cud1=\EB, cuf=\Eq%p1%d;, cuf1=\EC, + cup=\EE%p1%d;%p2%d;, cuu=\Ep-%p1%d;, cuu1=\EA, + dch=\EI%p1%d;, dch1=\EI1;, dl=\ER%p1%d;, dl1=\ER1;, + ech=\Ej%p1%d;, ed=\EN, el=\EK, el1=\EL, home=\EE0;0;, ht=^I, + hts=\Eh, il=\EQ%p1%d;, il1=\EQ1;, ind=\EG, + is2=\ES\Er0;\Es0;, kbs=^H, kcub1=\EC, kcud1=\EB, kcuf1=\ED, + kcuu1=\EA, kdch1=\177, kent=^M, kf0=\EF00, kf1=\EF01, + kf10=\EF10, kf11=\EF11, kf12=\EF12, kf13=\EF13, kf14=\EF14, + kf15=\EF15, kf16=\EF16, kf17=\EF17, kf18=\EF18, kf19=\EF19, + kf2=\EF02, kf20=\EF20, kf3=\EF03, kf4=\EF04, kf5=\EF05, + kf6=\EF06, kf7=\EF07, kf8=\EF08, kf9=\EF09, kfnd=\Efind, + kich1=\Eins, knp=\Enext, kpp=\Eprior, kslt=\Esel, + op=\Es0;\Er0;, rev=\ET, ri=\EF, rmir=\EX, rmso=\ES, rmul=\ES, + rs2=\ES\Es0;\Er0;, setab=\Es%i%p1%d;, + setaf=\Er%i%p1%d;, + sgr=\ES%?%p1%t\ET%;%?%p2%t\EV%;%?%p3%t\ET%;%?%p4%t\EW%;%?%p6 + %t\EU%;, + sgr0=\ES, smir=\EY, smso=\ET, smul=\EV, tbc=\Ej, + +# vt220 Terminfo entry for the Emu emulation, corresponds to +# emu -term vt220 +# with NumLock set (to make the keypad transmit kf0-kf9). +# fixes: add am, xenl, corrected sgr0 -TD +emu-220|Emu-220 (vt200-7bit mode), + am, xenl, xon, + cols#80, it#8, lines#24, vt#200, + acsc=aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, + blink=\E[0;5m, bold=\E[0;1m, civis=\E[?25l, + clear=\E[2J\E[H, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[1D, + cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[1A, + dch=\E[%p1%dP, dch1=\E[1P, dl=\E[%p1%dM, dl1=\E[1M, + ed=\E[0J, el=\E[0K, el1=\E[1K, enacs=\E)0, home=\E[H, ht=^I, + hts=\EH, if=/usr/share/tabset/vt300, il=\E[%p1%dL, + il1=\E[1L, ind=\ED, is2=\E>\E[?1l\E[?3l\E[4l\E[?7h, + kbs=^H, kcmd=\E[29~, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\E[3~, kent=\EOM, kf0=\EOp, kf1=\EOq, + kf10=\EOl, kf11=\EOm, kf12=\EOn, kf13=\EOP, kf14=\EOQ, + kf15=\EOR, kf16=\EOS, kf2=\EOr, kf26=\E[17~, kf27=\E[18~, + kf28=\E[19~, kf29=\E[20~, kf3=\EOs, kf30=\E[21~, + kf34=\E[26~, kf37=\E[31~, kf38=\E[32~, kf39=\E[33~, + kf4=\EOt, kf40=\E[34~, kf5=\EOu, kf6=\EOv, kf7=\EOw, + kf8=\EOx, kf9=\EOy, kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, + knp=\E[6~, kpp=\E[5~, kslt=\E[4~, rc=\E8, rev=\E[0;7m, + ri=\EM, rmacs=^O, rmcup=\E>, rmkx=\E>, rmso=\E[m, rmul=\E[m, + rs2=\E[4l\E[34l\E[?1l\E[?3l\E[?5l\E[?7h, sc=\E7, + sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t; + 2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m, smacs=^N, smcup=\E[?1l\E=, smkx=\E=, + smso=\E[0;7m, smul=\E[0;4m, tbc=\E[3g, + +#### MVTERM +# A commercial product, Reportedly a version of Xterm with an OPEN LOOK UI, +# print interface, ANSI X3.64 colour escape sequences, etc. Newsgroup postings +# indicate that it emulates more than one terminal, but incompletely. +# +# This is adapted from a FreeBSD bug-report by Daniel Rudy +# It is based on vt102's entry, with some subtle differences, but also +# has status line +# supports ANSI colors (except for 'op' string) +# apparently implements alternate screen like xterm +# does not use padding, of course. +mvterm|vv100|SwitchTerm aka mvTERM, + am, eslok, hs, km, mir, msgr, xenl, + colors#8, cols#80, it#8, lines#24, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[?E, ed=\E[J, el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0, + fsl=\E[?F, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOy, + kf10=\EOx, kf5=\EOt, kf6=\EOu, kf7=\EOv, kf8=\EOl, kf9=\EOw, + op=\E[100m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmcup=\E[2J\E[?47l\E8, rmkx=\E[?1l\E>, rmso=\E[m, + rmul=\E[m, + rs2=\E>\E[1;3;4;5;6l\E[?7h\E[100m\E[m\E[r\E[2J\E[H, + sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smcup=\E7\E[?47h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[?E\E[?%i%p1%dT, use=vt100+fnkeys, + +#### MTERM +# +# This application is available by email from . +# +# "mterm -type ansi" sets $TERM to "ansi" +mterm-ansi|ANSI emulation, + am, bw, mir, msgr, + it#8, + acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, + el=\E[K, home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich1=, + il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS, + invis=\E[8m, is2=\E)0\017, kbs=^H, nel=\EE, rev=\E[7m, + ri=\E[T, rin=\E[%p1%dT, rmacs=^O, rmir=\E[4l, rmso=\E[27m, + rmul=\E[24m, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? + %p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m, smacs=^N, smir=\E[4h, smso=\E[7m, smul=\E[4m, + vpa=\E[%i%p1%dd, +# mterm normally sets $TERM to "mterm" +mterm|mouse-sun|Der Mouse term, + am, bw, mir, + it#8, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^N, cuf1=^S, + cup=\006%p1%d.%p2%d., cuu1=^X, dch1=^Y, dl1=^K, ed=^B, el=^C, + home=^P, ht=^I, il1=^A, ind=^U, kbs=^H, ll=^R, nel=^M^U, ri=^W, + rmir=^O, rmso=^T, smir=^Q, smso=^V, +# "mterm -type decansi" sets $TERM to "decansi" +# +# note: kdch1, kfnd, kslt are in the source code, but do not work -TD +decansi|ANSI emulation with DEC compatibility hacks, + am, mir, msgr, xenl, + colors#8, it#8, pairs#64, + acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, enacs=\E(B\E)0, + home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich1=, il=\E[%p1%dL, + il1=\E[L, ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, + is2=\E)0\E[r\017, kbs=^H, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\E[11~, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, + kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, kslt=\E[4~, nel=\EE, op=\E[0m, rc=\E8, rev=\E[7m, + ri=\E[T, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%? + %p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, u6=\E[%i%d;%dR, + u7=\E[6n, vpa=\E[%i%p1%dd, + +#### VWM +# http://vwm.sourceforge.net/ +# +# VWM 2.0.2 (2009-05-01) +# vwmterm is a terminal emulator written for the VWM console window manager. +# This version is obsolete, replaced by libvterm in 2.1.0 (2009-10-23). +vwmterm|(vwm term), + am, bce, ccc, mir, msgr, npc, xenl, xon, + colors#8, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, cub=\E[%p1%dD, + cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, cvvis=\E[?25h, dim=\E[2m, ed=\E[J, el=\E[K, + home=\E[H, il1=\E[L, ind=^J, invis=\E[8m, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, + kend=\E[4~, kf1=\E[[A, kf10=\E[21~, kf11=\E[22~, + kf12=\E[23~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, knp=\E[6~, kpp=\E[5~, rev=\E[7m, rmacs=\E[10m, + rmam=\E[?7l, rmcup=\E[?1049l, rs1=\E[H\E[J\E[m\Ec, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6 + %t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + sgr0=\E[0;10m, smacs=\E[11m, smam=\E[?7h, + smcup=\E[?1049h, smso=\E[3m, smul=\E[4m, + +#### MGR +# +# MGR is a Bell Labs window system lighter-weight than X. +# These entries describe MGR's xterm-equivalent. +# They are courtesy of Vincent Broman 14 Jan 1997 +# + +mgr|Bellcore MGR (non X) window system terminal emulation, + am, km, + bel=^G, bold=\E2n, civis=\E9h, clear=^L, cnorm=\Eh, cr=^M, + csr=\E%p1%d;%p2%dt, cub1=^H, cud1=\Ef, cuf1=\Er, + cup=\E%p2%d;%p1%dM, cuu1=\Eu, cvvis=\E0h, + dch=\E%p1%dE$<5>, dch1=\EE, dl=\E%p1%dd$<3*>, + dl1=\Ed$<3>, ed=\EC, el=\Ec, hd=\E1;2f, ht=^I, hu=\E1;2u, + ich=\E%p1%dA$<5>, ich1=\EA, il=\E%p1%da$<3*>, + il1=\Ea$<3>, ind=^J, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, nel=^M^J, rev=\E1n, rmam=\E5S, + rmso=\E0n, rmul=\E0n, sgr0=\E0n, smam=\E5s, smso=\E1n, + smul=\E4n, +mgr-sun|Mgr window with Sun keyboard, + ka1=\E[214z, ka3=\E[216z, kb2=\E[218z, kc1=\E[220z, + kc3=\E[222z, kcpy=\E[197z, kend=\E[220z, kent=\E[250z, + kf1=\E[224z, kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, + kf2=\E[225z, kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, + kf6=\E[229z, kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, + kfnd=\E[200z, khlp=\E[207z, khome=\E[214z, knp=\E[222z, + kopn=\E[198z, kpp=\E[216z, kund=\E[195z, use=mgr, +mgr-linux|Mgr window with Linux keyboard, + ka1=\E[H, ka3=\E[5~, kb2=\E[G, kc1=\E[Y, kc3=\E[6~, + kdch1=\E[3~, kend=\E[4~, kf0=\E[[J, kf1=\E[[A, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, + kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, knp=\E[6~, kpp=\E[5~, use=mgr, + +#### SIMPLETERM +# st.suckless.org +# st-0.4.1 +# +# This version uses a table which supports a single modifier (a subset of +# xterm's keys, using the same scheme). Because it supports only a single +# modifier in this table, function keys f36-f48 are normally unavailable +# because they are assigned to modifier-4. +# +# The program assigns TERM to match the program name (the upstream source says +# "st", but Debian renames it to "stterm"). +# +# The source includes two entries which are not useful here: +# st-meta| simpleterm with meta key, +# st-meta-256color| simpleterm with meta key and 256 colors, +# because st's notion of "meta" does not correspond to the terminfo definition. +# Rather, it acts like xterm - when the meta feature is disabled. +# +# Removed invis -TD +# Added eo, removed ul -TD +# +# Reviewed st 0.5: +# implements control-modifier, but not control-shift for special keys +# implements alt-modifier, but not alt-shift for special keys +# +# Reviewed st 0.6: +# http://git.suckless.org/st/log/st.info +# Tmux unofficial extensions, see TERMINFO EXTENSIONS in tmux(1) +# still has no function keys past kf36 (no combinations of modifiers) +# no application keypad mode, e.g, kent. +st|stterm| simpleterm 0.4.1, + am, bce, hs, mir, msgr, npc, xenl, Tc, XT, + colors#8, cols#80, it#8, lines#24, pairs#64, + acsc=+C\,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyy + zz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E)0, flash=\E[?5h$<100/>\E[?5l, fsl=^G, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, + invis=\E[8m, is2=\E[4l\E>\E[?1034l, kDC=\E[3;2~, + kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, + kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, ka1=\E[1~, + ka3=\E[5~, kb2=\EOu, kbs=\177, kc1=\E[4~, kc3=\E[6~, + kcbt=\E[Z, kclr=\E[3;5~, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kdl1=\E[3;2~, + ked=\E[1;5F, kel=\E[1;2F, kend=\E[4~, kent=\EOM, kf1=\EOP, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[1;2P, + kf14=\E[1;2Q, kf15=\E[1;2R, kf16=\E[1;2S, kf17=\E[15;2~, + kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, + kf21=\E[20;2~, kf22=\E[21;2~, kf23=\E[23;2~, + kf24=\E[24;2~, kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, + kf28=\E[1;5S, kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, + kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, + kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, + kf37=\E[1;6P, kf38=\E[1;6Q, kf39=\E[1;6R, kf4=\EOS, + kf40=\E[1;6S, kf41=\E[15;6~, kf42=\E[17;6~, + kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, + kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, + kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q, kf51=\E[1;3R, + kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, + kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~, + kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, + kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, + kil1=\E[2;5~, kind=\E[1;2B, kmous=\E[M, knp=\E[6~, + kpp=\E[5~, kri=\E[1;2A, krmir=\E[2;2~, mc0=\E[i, mc4=\E[4i, + mc5=\E[5i, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, + ritm=\E[23m, rmacs=\E(B, rmcup=\E[?1049l, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, + rs2=\E[4l\E>\E[?1034l, sc=\E7, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, + setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%| + %t;7%;%?%p4%t;5%;%?%p7%t;8%;m, + sgr0=\E[0m, sitm=\E[3m, smacs=\E(0, smcup=\E[?1049h, + smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E]0;, u6=\E[%i%d;%dR, u7=\E[6n, + u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd, Se=\E[2 q, + Ss=\E[%p1%d q, +# +# st-0.1.1 +# +# Note: the original terminfo description uses leading blank to persuade +# ncurses to use "st" as its name. Proper fix for that is to use "st" as an +# alias. +# +# Reading the code shows it should work for aixterm 16-colors +# - added st-16color +# +# Using tack: +# - set eo (erase-overstrike) +# - set xenl +# - tbc doesn't work +# - hts works +# - cbt doesn't work +# - shifted cursor-keys send sequences like rxvt +# - sgr referred to unimplemented "invis" mode. +# Fixes: add eo and xenl per tack, remove nonworking cbt, hts and tbc, invis +simpleterm|old-st| simpleterm 0.1.1, + am, eo, mir, msgr, ul, xenl, + colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64, + acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, + cnorm=\E[?12l\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, kbs=\177, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, knp=\E[6~, kpp=\E[5~, op=\E[37;40m, rc=\E8, + rev=\E[7m, rmacs=\E(B, rmso=\E[m, rmul=\E[m, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%| + %t;7%;m, + sgr0=\E[0m, smacs=\E(0, smso=\E[7m, smul=\E[4m, +st-16color|stterm-16color|simpleterm with 16-colors, + use=ibm+16color, use=st, +# 256 colors "works", but when running xterm's test-scripts, some garbage is +# shown in the titlebar. +# +# terminal wants to use TERM=stterm-256color, but that is longer than 14 +# characters, making the choice nonportable. +st-256color|stterm-256color|simpleterm with 256 colors, + ccc@, + initc@, oc@, use=xterm+256color, use=st, + +#### TERMINATOR +# https://code.google.com/p/jessies/ +# Tested using their Debian package org.jessies.terminator 6.104.3256 on 64-bit +# Debian/current -TD (2011/8/20) +# +# There are some packaging problems: +# a) using Java, the program starts off using 50Mb, and climbs from there, +# up to 114Mb after testing (no scrollback). +# b) it insists on reinstalling its terminal description in $HOME/.terminfo +# (two copies, just in case the host happens to be Mac OS X). +# I deleted this after testing with tack. +# +# Issues/features found with tack: +# a) tbc does not work (implying that hts also is broken). +# Comparing with the tabs utility shows a problem with the last tabstop on +# a line. +# b) has xterm-style shifted function-key strings +# meta also is used, but control is ignored. +# c) has xterm-style modifiers for cursor keys (shift, control, shift+control, +# meta) +# d) some combinations of shift/control send xterm-style sequences for +# insert/delete/home/end. +# e) numeric keypad sends only numbers (compare with vttest). +# f) meta mode (km) is not implemented. +# +# Issues found with ncurses test-program: +# a) bce is inconsistently implemented +# b) widths of Unicode values above 256 do not always agree with wcwidth. +# +# Checked with vttest, found low degree of compatibility there. +# +# Checked with xterm's scripts, found that the 256-color palette is fixed. +# +# Fixes: +# a) add sgr string +# b) corrected sgr0 to reset alternate character set +# c) modified smacs/rmacs to use SCS rather than SI/SO +# d) removed bce +# e) removed km +terminator|Terminator no line wrap, + eo, mir, msgr, xenl, xon, + colors#256, cols#80, it#8, lines#24, lm#0, pairs#32767, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bold=\E[1m, civis=\E[?25l, clear=\E[H\E[2J, + cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=^G, home=\E[H, hpa=\E[%i%p1%dG, + ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, + is1=\E[?47l\E=\E[?1l, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B, + rmcup=\E[?47l\E8, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, + rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>, + s0ds=\E(B, s1ds=\E(0, sc=\E7, setab=\E[48;5;%p1%dm, + setaf=\E[38;5;%p1%dm, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t + \E(0%e\E(B%;, + sgr0=\E[m\E(B, smacs=\E(0, smcup=\E7\E[?47h, smir=\E[4h, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, + use=xterm+sl-twm, + +#### TERMINOLOGY +# http://enlightenment.org +# +# Tested terminology-0.3.0, 0.6.1, using tack and vttest. This is not a vt100 +# emulator, nor is it compatible with xterm, but it uses a few features from +# both -TD +# +# General comments: +# cursor does not fill on focus +# there are pervasive problems with clearing/erasing parts of the screen +# resizing the window causes it to stop listening to the keyboard +# tack - +# doesn't understand vt100 CPR needed for resize +# no CBT +# no cvvis +# has invis +# no blink +# uses bce model for colors, but (see below) fails the vttest screens +# has partial support for 256color feature. +# tack function-keys (a subset of xterm+pcf0), and +# tack cursor-keys (a subset of xterm+pce2): +# ctrl+shift (ignored) +# 2 shift +# shift-alt modifier -> shift (2) +# 3 alt +# 4 +# 5 ctrl +# tack modifiers did not work for fkeys in 0.3.0; subset works in 0.6.1 +# ctrl + khome/kend works - none of the other modifiers do +# vttest - +# spits lots of messages from termptyesc.c especially in vttest. +# no 132-column mode +# fails menu 1, 2 (definitely not vt100-compatible) +# primary (claims vt420 with several options, apparently none work) and +# secondary report says (perhaps... vt420): \E[>41;285;0c +# CHA, HPR, VPA, CNL, CPL work +# BCE with ED/EL - fail +# BCE with ECH/indexing - fail +# SD/SU work +# unlike teken, background light/dark works +# can set title +# X10 and Normal mouse work +# Any-event mouse works +# Mouse button-event works +# +# This description uses xterm+pcf0, which is misleading because the program +# does not handle combinations of modifiers - but listing them all would +# involve more effort than its developers spent -TD +terminology|EFL-based terminal emulator, + mc5i@, xon@, + blink@, ed@, el@, el1@, invis=\E[8m, kLFT=\E[1;2D, + kRIT=\E[1;2C, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kind=\E[1;2B, kri=\E[1;2A, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p7%t;8 + %;m%?%p9%t\016%e\017%;$<2>, + vpa=\E[%i%p1%dd, kDC3=\E[3;3~, kDC4=\E[3;4~, + kDC5=\E[3;5~, kDC6=\E[3;6~, kDC7=\E[3;7~, kDN=\E[1;2B, + kDN3=\E[1;3B, kDN4=\E[1;4B, kDN5=\E[1;5B, kDN6=\E[1;6B, + kDN7=\E[1;7B, kEND5=\E[1;5F, kHOM5=\E[1;5H, + kLFT3=\E[1;3D, kLFT4=\E[1;4D, kLFT5=\E[1;5D, + kLFT6=\E[1;6D, kLFT7=\E[1;7D, kRIT3=\E[1;3C, + kRIT4=\E[1;4C, kRIT5=\E[1;5C, kRIT6=\E[1;6C, + kRIT7=\E[1;7C, kUP=\E[1;2A, use=xterm+pcf0, use=vt100, + use=xterm+256setaf, + +######## UNIX VIRTUAL TERMINALS, VIRTUAL CONSOLES, AND TELNET CLIENTS +# + +# Columbus UNIX virtual terminal. This terminal also appears in +# UNIX 4.0 and successors as line discipline 1 (?), but is +# undocumented and does not really work quite right. +cbunix|cb unix virtual terminal, + OTbs, am, da, db, + cols#80, lines#24, lm#0, + bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EG%p2%c%p1%c, cuu1=\EA, dch1=\EM, dl1=\EN, ed=\EL, + el=\EK, ich1=\EO, il1=\EP, ind=^J, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, khome=\EE, rmso=\Eb^D, rmul=\Eb^A, + smso=\Ea^D, smul=\Ea^A, +# (vremote: removed obsolete ":nl@:" -- esr) +vremote|virtual remote terminal, + am@, + cols#79, use=cbunix, + +pty|4bsd pseudo teletype, + cup=\EG%p1%{32}%+%c%p2%{32}%+%c, rmso=\Eb$, rmul=\Eb!, + smso=\Ea$, smul=\Ea!, use=cbunix, + +#### Emacs + +# https://www.emacswiki.org/emacs/AnsiTerm +# https://github.com/emacs-mirror/emacs/blob/master/lisp/term.el +# +# The codes supported by the term.el terminal emulation in GNU Emacs 19.30 +eterm|gnu emacs term.el terminal emulation, + am, mir, xenl, + cols#80, lines#24, + bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, rev=\E[7m, + rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smcup=\E7\E[?47h, smir=\E[4h, smso=\E[7m, + smul=\E[4m, + +# The codes supported by the term.el terminal emulation in GNU Emacs 22.2 +eterm-color|Emacs term.el terminal emulator term-protocol-version 0.96, + am, mir, msgr, xenl, + colors#8, cols#80, lines#24, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, kbs=\177, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kend=\E[4~, khome=\E[1~, kich1=\E[2~, + knp=\E[6~, kpp=\E[5~, op=\E[39;49m, rc=\E8, rev=\E[7m, + ri=\EM, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, + sc=\E7, setab=\E[%p1%'('%+%dm, setaf=\E[%p1%{30}%+%dm, + sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;%? + %p7%t;8%;m, + sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, + u6=\E[%i%d;%dR, u7=\E[6n, + +# shell.el can "do" color, though not nearly as well. +# +# seen here: +# http://unix.stackexchange.com/questions/237943/changing-colors-used-by-ls-does-not-work-in-emacs-shell-mode +# +# and +# https://lists.gnu.org/archive/html/bug-gnu-emacs/2012-08/msg00481.html +# https://github.com/emacs-mirror/emacs/blob/master/lisp/shell.el +# https://github.com/emacs-mirror/emacs/blob/master/lisp/ansi-color.el +# +# however, as tested with Emacs 24.5.1, the result is buggy, losing overlays +# frequently. The contemporaneous term.el aka ansi-term does not "support" +# italics but does not lose the color information -TD 2017/01/28. +dumb-emacs-ansi|Emacs dumb terminal with ANSI color codes, + am, hc, + colors#8, it#8, ncv#13, pairs#64, + bold=\E[1m, cud1=^J, ht=^I, ind=^J, op=\E[39;49m, + ritm=\E[23m, rmul=\E[24m, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, sgr0=\E[m, sitm=\E[3m, smul=\E[4m, + +#### Screen + +# Entries for use by the `screen' program by Juergen Weigert, +# Michael Schroeder, Oliver Laumann. The screen and +# screen-w entries came with version 3.7.1. The screen2 and screen3 entries +# come from University of Wisconsin and may be older. +# (screen: added on ANSI model -- esr) +# +# 'screen' defines extensions to termcap. Some are used in its terminal +# description: +# G0 (bool) Terminal can deal with ISO 2022 font selection sequences. +# AX (bool) Does understand ANSI set default fg/bg color +# (\E[39m / \E[49m). +# S0 (str) Switch charset 'G0' to the specified charset. +# E0 (str) Switch charset 'G0' back to standard charset. +# +# Initially tested with screen 3.09.08 +# +# According to its manual page +# +# Screen is a full-screen window manager that multiplexes a physical +# terminal between several processes (typically interactive shells). Each +# virtual terminal provides the functions of a DEC VT100 terminal and, in +# addition, several control functions from the ISO 6429 (ECMA 48, ANSI +# X3.64) and ISO 2022 standards (e.g. insert/delete line and support for +# multiple character sets). +# +# However, there is a design error in its support for video highlights. The +# program uses a table (rendlist) which equates the SGR codes to terminal +# capabilities. That, and color-decoding are hardcoded in screen; its behavior +# is modified only by the presence or absence of the corresponding capabilities. +# Not by their values. +# +# If screen sets the TERMCAP variable, it uses hardcoded strings which +# correspond to the rendlist table. +# +# The table gives this information: +# +# SGR capability +# --- --------- +# 1 bold +# 2 dim +# 3 standout +# 4 underline +# 5 blink +# - (unused 6) +# 7 reverse +# - (unused 8-21) +# 22 reset bold, standout and dim +# 23 reset standout +# 24 reset underline +# 25 reset blink +# - (unused 26) +# 27 reset reverse +# +# ECMA-48 differs from this: 3 and 23 set and reset italics, respectively. +# ECMA-48 does not define "standout" - that is a termcap/terminfo abstraction. +# Without some redesign of screen, it is not possible to extend the set of +# capabilities. Substitution would be possible, e.g., sending italics in +# place of underline. +# +# Because screen uses hard-coded parsing, it does not check if two capabilities +# use the same value. For example, changing standout to be the same as any of +# the other capabilities will confuse screen. Curses applications which use +# sgr are not impacted (because that usually resets all capabilities before +# setting any), but termcap applications do not use sgr -TD +screen|VT 100/ANSI X3.64 virtual terminal, + OTbs, OTpt, am, km, mir, msgr, xenl, G0, + colors#8, cols#80, it#8, lines#24, ncv@, pairs#64, U8#1, + acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy + yzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, + cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=\Eg, home=\E[H, ht=^I, hts=\EH, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, + kbs=^H, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, kdch1=\E[3~, kend=\E[4~, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, + rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t; + 5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smcup=\E[?1049h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g, E0=\E(B, + S0=\E(%p1%c, use=ecma+color, +# The bce and status-line entries are from screen 3.9.13 (and require some +# changes to .screenrc). +screen-bce|VT 100/ANSI X3.64 virtual terminal with bce, + bce, + ech@, use=screen, +screen-s|VT 100/ANSI X3.64 virtual terminal with hardstatus line, + dsl=\E_\E\\, fsl=\E\\, tsl=\E_, use=screen, + +# ====================================================================== +# Entries for GNU Screen with 16 colors. +# Those variations permit to benefit from 16 colors palette, and from +# bold font and blink attribute separated from bright colors. But they +# are less portable than the generic "screen" 8 color entries: Their +# usage makes real sense only if the terminals you attach and reattach +# do all support 16 color palette. + +screen-16color|GNU Screen with 16 colors, + use=ibm+16color, use=screen, + +screen-16color-s|GNU Screen with 16 colors and status line, + use=ibm+16color, use=screen-s, + +screen-16color-bce|GNU Screen with 16 colors and BCE, + use=ibm+16color, use=screen-bce, + +screen-16color-bce-s|GNU Screen with 16 colors using BCE and status line, + bce, use=ibm+16color, use=screen-s, + +# ====================================================================== +# Entries for GNU Screen 4.02 with --enable-colors256. + +screen-256color|GNU Screen with 256 colors, + use=xterm+256setaf, use=screen, + +screen-256color-s|GNU Screen with 256 colors and status line, + use=xterm+256setaf, use=screen-s, + +screen-256color-bce|GNU Screen with 256 colors and BCE, + bce, use=xterm+256setaf, use=screen-bce, + +screen-256color-bce-s|GNU Screen with 256 colors using BCE and status line, + bce, use=xterm+256setaf, use=screen-s, + +screen.xterm-256color|GNU Screen with xterm using 256 colors, + use=xterm+256setaf, use=screen.xterm-new, + +screen.konsole-256color|GNU Screen with konsole using 256 colors, + use=xterm+256setaf, use=screen.konsole, + +screen.vte-256color|GNU Screen with vte using 256 colors, + use=xterm+256setaf, use=screen.vte, + +screen.putty-256color|GNU Screen with putty using 256 colors, + use=xterm+256setaf, use=screen.putty, + +screen.mlterm-256color|GNU Screen with mlterm using 256 colors, + use=xterm+256setaf, use=screen.mlterm, + +# ====================================================================== + +# Read the fine manpage: +# When screen tries to figure out a terminal name for +# itself, it first looks for an entry named "screen.", +# where is the contents of your $TERM variable. If +# no such entry exists, screen tries "screen" (or "screen-w" +# if the terminal is wide (132 cols or more)). If even this +# entry cannot be found, "vt100" is used as a substitute. +# +# Notwithstanding the manpage, screen uses its own notion of the termcap +# and some keys from "screen." are ignored. Here is an entry which +# covers those (tested with screen 4.00.02) -TD +screen+fkeys|function-keys according to screen, + kend=\E[4~, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kfnd@, + khome=\E[1~, kslt@, + +# See explanation before "screen" entry. Cancel italics so that applications +# do not assume screen supports the feature. Add this tweak to entries which +# extend screen for terminals which do support italics. +screen+italics|screen cannot support italics, + ritm@, sitm@, +# +# Here are a few customized entries which are useful -TD +# +# Notes: +# (a) screen does not support invis. +# (b) screen's implementation of bw is incorrect according to tack. +# (c) screen appears to hardcode the strings for khome/kend, making it +# necessary to override the "use=" clause's values (screen+fkeys). +# (d) screen sets $TERMCAP to a termcap-formatted copy of the 'screen' entry, +# which is NOT the same as the terminfo screen.. +# (e) when screen finds one of these customized entries, it sets $TERM to +# match. Hence, no "screen.xterm" entry is provided, since that would +# create heartburn for people running remote xterm's. +# +# xterm (-xfree86 or -r6) does not normally support kIC, kNXT and kPRV +# since the default translations override the built-in keycode +# translation. They are suppressed here to show what is tested by tack. +screen.xterm-xfree86|screen.xterm-new|screen customized for modern xterm, + bce@, bw, + invis@, kIC@, kNXT@, kPRV@, meml@, memu@, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%| + %t;7%;%?%p4%t;5%;%?%p5%t;2%;m, + E3@, use=screen+italics, use=screen+fkeys, use=xterm-new, +#:screen.xterm|screen for modern xterm, +#: use=screen.xterm-new, +# xterm-r6 does not really support khome/kend unless it is propped up by +# the translations resource. +screen.xterm-r6|screen customized for X11R6 xterm, + bw, use=screen+fkeys, use=xterm-r6, +# Color applications running in screen and TeraTerm do not play well together +# on Solaris because Sun's curses implementation gets confused. +screen.teraterm|disable ncv in teraterm, + ncv#127, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i + \316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u + \264v\301w\302x\263y\363z\362{\343|\330}\234~\376, + use=screen+fkeys, use=screen, +# Other terminals +screen.rxvt|screen in rxvt, + bw, XT, + cvvis@, flash@, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, use=screen+fkeys, use=vt100+enq, + use=rxvt+pcfkeys, use=vt220+keypad, use=screen, +screen.Eterm|screen in Eterm, + use=screen+fkeys, use=Eterm, +screen.mrxvt|screen in mrxvt, + use=screen+fkeys, use=mrxvt, +screen.vte|screen in any VTE-based terminal, + use=screen+italics, use=screen+fkeys, use=vte, +screen.gnome|screen in GNOME Terminal, + use=screen+italics, use=screen+fkeys, use=gnome, +screen.konsole|screen in KDE console window, + use=screen+italics, use=screen+fkeys, use=konsole, +# fix the backspace key +screen.linux|screen in linux console, + bw, + kbs=\177, kcbt@, use=screen+fkeys, use=screen, +screen.mlterm|screen in mlterm, + use=screen+fkeys, use=mlterm, +screen.putty|screen in putty, + use=screen+fkeys, use=putty, + +# The default "screen" entry is reasonably portable, but not optimal for the +# most widely-used terminal emulators. The "bce" capability is supported in +# screen since 3.9.13, and when used, will require fewer characters to be sent +# to the terminal for updates. +# +# If you are using only terminals which support bce, then you can use this +# feature in your screen configuration. +# +# Adding these lines to your ".screenrc" file will allow using these customized +# entries: +# term screen-bce +# bce on +# defbce on +screen-bce.xterm-new|screen optimized for modern xterm, + bce, + ech@, use=screen+italics, use=screen.xterm-new, +screen-bce.rxvt|screen optimized for rxvt, + bce, + ech@, use=screen.rxvt, +screen-bce.Eterm|screen optimized for Eterm, + bce, + ech@, use=screen.Eterm, +screen-bce.mrxvt|screen optimized for mrxvt, + bce, + ech@, use=screen.mrxvt, +screen-bce.gnome|screen optimized for GNOME-Terminal, + bce, + ech@, use=screen+italics, use=screen.gnome, +screen-bce.konsole|screen optimized for KDE console window, + bce, + ech@, use=screen+italics, use=screen.konsole, +screen-bce.linux|screen optimized for linux console, + bce, + ech@, use=screen.linux, + +screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols, + cols#132, use=screen, + +screen2|old VT 100/ANSI X3.64 virtual terminal, + cols#80, it#8, lines#24, + cbt=\E[Z, clear=\E[2J\E[H, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=, il=\E[%p1%dL, + il1=\E[L, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf0=\E~, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, + kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\E0I, khome=\EH, + nel=^M^J, rc=\E8, ri=\EM, rmir=\E[4l, rmso=\E[23m, + rmul=\E[24m, rs1=\Ec, sc=\E7, sgr0=\E[m, smir=\E[4h, + smso=\E[3m, smul=\E[4m, tbc=\E[3g, +# (screen3: removed unknown ":xv:LP:G0:" -- esr) +screen3|older VT 100/ANSI X3.64 virtual terminal, + km, mir, msgr, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, is2=\E)0, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, + rmir=\E[4l, rmkx=\E>, rmso=\E[23m, rmul=\E[24m, rs1=\Ec, + sc=\E7, sgr0=\E[m, smir=\E[4h, smkx=\E=, smso=\E[3m, + smul=\E[4m, tbc=\E[3g, + +#### Tmux + +# tmux is compatible with screen, but has support for italics, and some of the +# xterm cursor bits. +tmux|tmux terminal multiplexer, + ritm=\E[23m, rmso=\E[27m, sitm=\E[3m, smso=\E[7m, + use=xterm+edit, use=xterm+pcfkeys, use=xterm+sl, + use=xterm+tmux, use=screen, + +tmux-256color|tmux with 256 colors, + use=xterm+256setaf, use=tmux, + +#### Dvtm + +# dvtwm 0.15 +# http://www.brain-dump.org/projects/dvtm/ +# +# + This uses ncurses to manage the display, including support for italics and +# default-colors. +# + However, default-colors are incomplete: do not set bce. +# + It does not implement flash (since no \e[?5h) +# + Do not set XT: dvtm knows about OSC 0 and 2, but not 1. +# Oddly enough, if $TERM contains "linux", it attempts to set the title. +# + Some of the program is cut/paste from rxvt-unicode, e.g., the ACS table. +# + The built-in table of function-keys (based on rxvt) is incomplete (ends +# with kf22). +# + It also omits the shifted cursor- and editing-keypad keys. +# However, it is confused by xterm's shifted cursor- and editing-keypad keys +# (and passes those through without interpretation) +# and may simply pass-through rxvt's, making it appear to work. +# In other cases such as kf23 and up, no pass-through is done. +# + Most of the mode-settings in the initialization/reset strings are not +# implemented; dvtm copies its description from rxvt. +dvtm|dynamic virtual terminal manager, + am, eo, mir, msgr, xenl, AX, + colors#8, cols#80, it#8, lines#24, ncv@, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is1=\E[?47l\E=\E[?1l, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, + kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kIC=\E[2$, kLFT=\E[d, + kNXT=\E[6$, kPRV=\E[5$, kRIT=\E[c, ka1=\EOw, ka3=\EOy, + kb2=\EOu, kbs=\177, kc1=\EOq, kc3=\EOs, kcbt=\E[Z, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kel=\E[8\^, kend=\E[8~, kent=\EOM, kf0=\E[21~, + kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, + kf20=\E[34~, kf21=\E[23$, kf22=\E[24$, kf3=\E[13~, + kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, kfnd=\E[1~, khome=\E[7~, kich1=\E[2~, + kind=\E[a, kmous=\E[M, knp=\E[6~, kpp=\E[5~, kri=\E[b, + kslt=\E[4~, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, + ritm=\E[23m, rmacs=^O, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, + rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[? + 25h, + s0ds=\E(B, s1ds=\E(0, sc=\E7, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%? + %p9%t\016%e\017%;, + sgr0=\E[m\017, sitm=\E[3m, smacs=^N, smcup=\E7\E[?47h, + smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%i%p1%dd, + +dvtm-256color|dynamic virtual terminal manager with 256 colors, + colors#256, pairs#32767, + setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48; + 5;%p1%d%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5 + ;%p1%d%;m, + use=dvtm, + +#### NCSA Telnet + +# Francesco Potorti : +# NCSA telnet is one of the most used telnet clients for the Macintosh. It has +# been maintained until recently by the National Center for Supercomputer +# Applications, and it is feature rich, stable and free. It can be downloaded +# from www.ncsa.edu. This terminfo description file is based on xterm-vt220, +# xterm+sl, and the docs at NCSA. It works well. +# +# NCSA Telnet 2.6 for Macintosh in vt220 8-bit emulation mode +# The terminal options should be set as follows: +# Xterm sequences ON +# use VT wrap mode ON +# use Emacs arrow keys OFF +# CTRL-COMND is Emacs meta ON +# 8 bit mode ON +# answerback string: "ncsa-vt220-8" +# setup keys: all disabled +# +# Application mode is not used. +# +# Other special mappings: +# Apple VT220 +# HELP Find +# HOME Insert here +# PAGEUP Remove +# DEL Select +# END Prev Screen +# PAGEDOWN Next Screen +# +# Though it supports ANSI color, NCSA Telnet uses color to represent blinking +# text. +# +# The status-line manipulation is a mapping of the xterm-compatible control +# sequences for setting the window-title. So you must use tsl and fsl in +# pairs, since the latter ends the string that is loaded to the window-title. +ncsa-m|ncsa-vt220-8|NCSA Telnet 2.6 for Macintosh in vt220-8 mode, + am, km, mir, msgr, xenl, + acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, enacs=\E)0, + flash=\E[?5h$<100/>\E[?5l, home=\E[H, ht=^I, hts=\EH, + ich=\E[%p1%d@, if=/usr/share/tabset/vt100, + il=\E[%p1%dL, il1=\E[L, ind=\n$<150*>, + is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[4~, kend=\E[5~, kf1=\E[17~, kf10=\E[28~, + kf11=\E[29~, kf12=\E[31~, kf13=\E[32~, kf14=\E[33~, + kf15=\E[34~, kf2=\E[18, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, + kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khlp=\E[1~, + khome=\E[2~, knp=\E[6~, kpp=\E[3~, mc4=\E[4i, mc5=\E[5i, + rc=\E8, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EM, + rmacs=\E(B, rmam=\E[?7l, rmcup=\E[2J\E8, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, + rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;4;6l\E[4l\E>, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%? + %p9%t\E(0%e\E(B%;, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E7, + smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + u8=\E[?62;1;6c, use=xterm+sl, use=ansi+enq, +ncsa|NCSA Telnet 2.7 for Macintosh in vt220-8 mode, + use=ncsa-m, use=klone+color, +ncsa-ns|NCSA Telnet 2.7 for Macintosh in vt220-8 mode, + hs@, + dsl@, fsl@, tsl@, use=ncsa, +ncsa-m-ns|NCSA Telnet 2.6 for Macintosh in vt220-8 mode, + hs@, + dsl@, fsl@, tsl@, use=ncsa-m, +# alternate -TD: +# The documented function-key mapping refers to the Apple Extended Keyboard +# (e.g., NCSA Telnet's F1 corresponds to a VT220 F6). We use the VT220-style +# codes, however, since the numeric keypad (VT100) PF1-PF4 are available on +# some keyboards and many applications require these as F1-F4. +# +ncsa-vt220|NCSA Telnet using vt220-compatible function keys, + kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, + kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, use=ncsa, + +#### Pilot Pro Palm-Top +# +# Termcap for Top Gun Telnet and SSH on the Palm Pilot. +# https://web.archive.org/web/20051103015726/http://www.ai/~iang/TGssh/ +pilot|tgtelnet|Top Gun Telnet on the Palm Pilot Professional, + OTbs, am, xenl, + cols#39, lines#16, + bel=^G, clear=\Ec, cr=^M, cub1=^H, cud1=^J, + cup=\Em%p1%{32}%+%c%p2%{32}%+%c, home=\Em\s\s, ht=^I, + ind=^J, kbs=^H, kcub1=^H, kcud1=^J, knp=^L, kpp=^K, nel=\Em~\s, + rmso=\EB, smso=\Eb, + +# From: Federico Bianchi +# These entries are for the Embeddable Linux Kernel System (ELKS) +# project - an heavily stripped down Linux to be run on 16 bit +# boxes or, eventually, to be used in embedded systems - and have been +# adapted from the stock ELKS termcap. The project itself looks stalled, +# and the latest improvements I know of date back to March 2000. +# +# To cope with the ELKS dumb console I added an "elks-glasstty" entry; +# as an added bonus, this deals with all the capabilities common to +# both VT52 and ANSI (or, eventually, "special") modes. + +elks-glasstty|ELKS glass-TTY capabilities, + OTbs, am, + cols#80, it#8, lines#25, + bel=^G, cr=^M, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, + nel=^M^J, + +elks-vt52|ELKS vt52 console, + clear=\EH\EJ, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, el=\EK, + home=\EH, use=elks-glasstty, + +elks-ansi|ELKS ANSI console, + clear=\E[H\E[2J, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, + rmso=\E[m, smso=\E[7m, use=elks-glasstty, + +# As a matter of fact, ELKS 0.0.83 on PCs defaults to ANSI emulation +# instead of VT52, but the "elks" entry still refers to the latter. + +elks|default ELKS console, + use=elks-vt52, + +# Project SIBO (for Psion 3 palmtops) console is identical to the ELKS +# one but in screen size + +sibo|ELKS SIBO console, + cols#61, it#8, lines#20, use=elks-vt52, + +######## COMMERCIAL WORKSTATION CONSOLES +# + +#### Alpha consoles +# + +# This is from the OSF/1 Release 1.0 termcap file +pccons|pcconsole|ANSI (mostly) Alpha PC console terminal emulation, + am, xon, + cols#80, lines#25, + bel=^G, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + nel=^M^J, rev=\E[7m, rmso=\E[m, sgr0=\E[m, smso=\E[7m, + +#### Sun consoles +# + +# :is1: resets scrolling region in case a previous user had used "tset vt100" +oldsun|Sun Microsystems Workstation console, + OTbs, am, km, mir, msgr, + cols#80, it#8, lines#34, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, ht=^I, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is1=\E[1r, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, + rmso=\E[m, sgr0=\E[m, smso=\E[7m, +# From: Alexander Lukyanov , 14 Nov 1995 +# capability later corrected by J.T. Conklin +# SGR 1, 4 aren't supported - removed bold/underline (T.Dickey 17 Jan 1998) +sun-il|Sun Microsystems console with working insert-line, + am, km, msgr, + cols#80, lines#34, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, ht=^I, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + kb2=\E[218z, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\177, kend=\E[220z, kf1=\E[224z, + kf10=\E[233z, kf11=\E[234z, kf12=\E[235z, kf2=\E[225z, + kf3=\E[226z, kf4=\E[227z, kf5=\E[228z, kf6=\E[229z, + kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, khome=\E[214z, + kich1=\E[247z, knp=\E[222z, kopt=\E[194z, kpp=\E[216z, + kres=\E[193z, kund=\E[195z, rev=\E[7m, rmso=\E[m, rmul@, + rs2=\E[s, sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, + smso=\E[7m, u8=\E[1t, u9=\E[11t, +# On some versions of CGSIX framebuffer firmware (SparcStation 5), / +# flake out on the last line. Unfortunately, without them the terminal has no +# way to scroll. +sun-cgsix|sun-ss5|Sun SparcStation 5 console, + il@, il1@, use=sun-il, +# If you are using an SS5, change the sun definition to use sun-ss5. +sun|sun1|sun2|Sun Microsystems Inc. workstation console, + use=sun-il, + +sun+sl|Sun Workstation window status line, + hs, + dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l, + +# From: Tue Sep 24 13:14:44 1985 +sun-s|Sun Microsystems Workstation window with status line, + hs, + dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l, use=sun, +sun-e-s|sun-s-e|Sun Microsystems Workstation with status hacked for emacs, + hs, + dsl=\E]l\E\\, fsl=\E\\, tsl=\E]l, use=sun-e, +sun-48|Sun 48-line window, + cols#80, lines#48, use=sun, +sun-34|Sun 34-line window, + cols#80, lines#34, use=sun, +sun-24|Sun 24-line window, + cols#80, lines#24, use=sun, +sun-17|Sun 17-line window, + cols#80, lines#17, use=sun, +sun-12|Sun 12-line window, + cols#80, lines#12, use=sun, +sun-1|Sun 1-line window for sysline, + eslok, hs, + cols#80, lines#1, + dsl=^L, fsl=\E[K, tsl=^M, use=sun, +sun-e|sun-nic|sune|Sun Microsystems Workstation without insert character, + ich1@, rmir@, smir@, use=sun, +sun-c|sun-cmd|Sun Microsystems Workstation console with scrollable history, + lines#35, + rmcup=\E[>4h, smcup=\E[>4l, use=sun, +sun-type4|Sun Workstation console with type 4 keyboard, + kcub1=\E[217z, kcud1=\E[221z, kcuf1=\E[219z, + kcuu1=\E[215z, use=sun-il, + +# Most of the current references to sun-color are from users wondering why this +# is the default on install. Details from reading the wscons manpage, adding +# cub, etc., here (rather than in the base sun-il entry) since it is not clear +# when those were added -TD (2005-05-28) +# +# According to wscons manpage, color is supported only on IA systems. +# Sun's terminfo entry documents bold and smul/rmul capabilities, but wscons +# does not list these. It also sets ncv#3, however that corresponds to +# underline and standout. +# +# Since the documentation and terminfo do not agree, see also current code at +# https://web.archive.org/web/20091231042744/http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/io/tem_safe.c +# +# That (actually a different driver which "supports" sun-color) also supports +# these features: +# vpa=\E[%i%p1%dd +# hpa=\E[%i%p1%d` +# cbt=\E[Z +# dim=\E[2m +# blink=\E[5m +# It supports bold, but not underline -TD (2009-09-19) +sun-color|Sun Microsystems Workstation console with color support (IA systems), + colors#8, ncv#3, pairs#64, + bold=\E[1m, cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, + cuu=\E[%p1%dA, home=\E[H, op=\E[0m, rs2=\E[s, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6} + %=%t3%e%p1%d%;m, + sgr=\E[0%?%p6%t;1%;%?%p1%p3%|%t;7%;m, sgr0=\E[m, + smso=\E[7m, use=sun, + +#### Iris consoles +# + +# (wsiris: this had extension capabilities +# :HS=\E7F2:HE=\E7F7:\ +# :CT#2:CZ=*Bblack,red,green,yellow,blue,magenta,cyan,*Fwhite: +# See the note on Iris extensions near the end of this file. +# Finally, removed suboptimal =\EH\EJ and added & +# from BRL -- esr) +wsiris|iris40|iris emulating a 40 line visual 50 (approximately), + OTbs, OTnc, OTpt, am, + OTkn#3, cols#80, it#8, lines#40, + OTnl=\EB, bel=^G, clear=\Ev, cnorm=\E>, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + cvvis=\E;, dim=\E7F2, dl1=\EM, ed=\EJ, el=\EK, + flash=\E7F4\E7B1\013\E7F7\E7B0, home=\EH, ht=^I, il1=\EL, + ind=^J, is2=\E7B0\E7F7\E7C2\E7R3, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, + kf4=\E4, kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, kf9=\E9, ri=\EI, + rmso=\E0@, rmul=\E7R3\E0@, sgr0=\E7F7, smso=\E9P, + smul=\E7R2\E9P, + +#### NeWS consoles +# +# Console terminal windows under the NeWS (Sun's Display Postscript windowing +# environment). Note: these have nothing to do with Sony's News workstation +# line. +# + +# Entry for NeWS's psterm from Eric Messick & Hugh Daniel +# (psterm: unknown ":sl=\EOl:el=\ENl:" removed -- esr) +psterm|psterm-basic|NeWS psterm-80x34, + OTbs, am, hs, km, ul, + cols#80, it#8, lines#34, + blink=\EOb, bold=\EOd, clear=^L, csr=\EE%p1%d;%p2%d;, + cub1=\ET, cud1=\EP, cuf1=\EV, cup=\E%p1%d;%p2%d;, cuu1=\EY, + dch1=\EF, dl1=\EK, ed=\EB, el=\EC, flash=\EZ, fsl=\ENl, + home=\ER, ht=^I, il1=\EA, ind=\EW, is1=\EN*, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, ll=\EU, rc=^\, rev=\EOr, + ri=\EX, rmcup=\ENt, rmir=\ENi, rmso=\ENo, rmul=\ENu, sc=^], + sgr0=\EN*, smcup=\EOt, smir=\EOi, smso=\EOo, smul=\EOu, + tsl=\EOl, +psterm-96x48|NeWS psterm 96x48, + cols#96, lines#48, use=psterm, +psterm-90x28|NeWS psterm 90x28, + cols#90, lines#28, use=psterm, +psterm-80x24|NeWS psterm 80x24, + cols#80, lines#24, use=psterm, +# This is a faster termcap for psterm. Warning: if you use this termcap, +# some control characters you type will do strange things to the screen. +# (psterm-fast: unknown ":sl=^Ol:el=^Nl:" -- esr) +psterm-fast|NeWS psterm fast version (flaky ctrl chars), + OTbs, am, hs, km, ul, + cols#80, it#8, lines#34, + blink=^Ob, bold=^Od, clear=^L, csr=\005%p1%d;%p2%d;, + cub1=^T, cud1=^P, cuf1=^V, cup=\004%p1%d;%p2%d;, cuu1=^Y, + dch1=^F, dl1=^K, ed=^B, el=^C, flash=^Z, fsl=^Nl, home=^R, ht=^I, + il1=^A, ind=^W, is1=^N*, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, ll=^U, rc=^\, rev=^Or, ri=^X, rmcup=^Nt, rmir=^Ni, + rmso=^No, rmul=^Nu, sc=^], sgr0=^N*, smcup=^Ot, smir=^Oi, + smso=^Oo, smul=^Ou, tsl=^Ol, + +#### NeXT consoles +# +# Use `glasstty' for the Workspace application +# + +# From: Dave Wetzel 22 Dec 1995 +next|NeXT console, + am, xt, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, + ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, + rmso=\E[4;1m, sgr0=\E[m, smso=\E[4;2m, +nextshell|NeXT Shell application, + am, + cols#80, + bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, kbs=^H, kcub1=^H, + kcud1=^J, nel=^M^J, + +#### Sony NEWS workstations +# + +# (news-unk: this had :KB=news: -- esr) +news-unk|SONY NEWS vt100 emulator common entry, + OTbs, OTpt, am, xenl, + cols#80, + OTnl=^J, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, + if=/usr/share/tabset/vt100, il=\E[%p1%dL, il1=\E[L, + is2=\E[?7h\E[?1h\E[?3l\E7\E8, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOY, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, + kf8=\EOW, kf9=\EOX, rc=\E8, rev=\E[7m, ri=\EM, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[r, sc=\E7, + sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, +# +# (news-29: this had :TY=ascii: --esr) +news-29, + lines#29, use=news-unk, +# (news-29-euc: this had :TY=euc: --esr) +news-29-euc, + use=news-29, +# (news-29-sjis: this had :TY=sjis: --esr) +news-29-sjis, + use=news-29, +# +# (news-33: this had :TY=ascii: --esr) +news-33, + lines#33, use=news-unk, +# (news-33-euc: this had :TY=euc: --esr) +news-33-euc, + use=news-33, +# (news-33-sjis: this had :TY=sjis: --esr) +news-33-sjis, + use=news-33, +# +# (news-42: this had :TY=ascii: --esr) +news-42, + lines#42, use=news-unk, +# (news-42-euc: this had :TY=euc: --esr) +news-42-euc, + use=news-42, +# (news-42-sjis: this had :TY=sjis: --esr) +news-42-sjis, + use=news-42, +# +# NEWS-OS old termcap entry +# +# (news-old-unk: this had :KB=news:TY=sjis: --esr) +news-old-unk|SONY NEWS vt100 emulator common entry, + OTbs, OTpt, am, xenl, + cols#80, vt#3, + OTnl=^J, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, if=/usr/share/tabset/vt100, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, rev=\E[7m, ri=\EM, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, +# +# (nwp512: this had :DE=^H:, which I think means --esr) +nwp512|news|nwp514|news40|vt100-bm|old sony vt100 emulator 40 lines, + OTbs, + lines#40, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40 + r\E8, + use=news-old-unk, +# +# (nwp512-a: this had :TY=ascii: and the alias vt100-bm --esr) +nwp512-a|nwp514-a|news-a|news42|news40-a|sony vt100 emulator 42 line, + lines#42, + is2=\E[?7h\E[?1l\E[?3l\E7\E[1;42r\E8, + use=news-old-unk, +# +# (nwp-512-o: this had :KB=nwp410:DE=^H: I interpret the latter as . --esr) +nwp512-o|nwp514-o|news-o|news40-o|vt100-bm-o|sony vt100 emulator 40 lines, + OTbs, + lines#40, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40 + r\E8, + use=news-old-unk, +# +# (nwp513: this had :DE=^H: and the alias vt100-bm --esr) +nwp513|nwp518|nwe501|newscbm|news31|sony vt100 emulator 33 lines, + OTbs, + lines#31, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31 + r\E8, + use=news-old-unk, +# +# (nwp513-a: this had :TY=ascii: and :DE=^H:, which I interpret as ; --esr) +# also the alias vt100-bm. +nwp513-a|nwp518-a|nwe501-a|nwp251-a|newscbm-a|news31-a|newscbm33|news33|old sony vt100 emulator 33 lines, + OTbs, + lines#33, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;33 + r\E8, + use=news-old-unk, +# +# (nwp513-o: had :DE=^H:, I think that's ; also the alias vt100-bm --esr) +nwp513-o|nwp518-o|nwe501-o|nwp251-o|newscbm-o|news31-o|old sony vt100 emulator 33 lines, + OTbs, + lines#31, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31 + r\E8, + use=news-old-unk, +# +# (news28: this had :DE=^H:, I think that's , and :KB=nws1200: --esr) +news28|sony vt100 emulator 28 lines, + OTbs, + lines#28, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;28 + r\E8, + use=news-old-unk, +# +# (news29: this had :TY=ascii:KB=nws1200:\ --esr) +news29|news28-a|sony vt100 emulator 29 lines, + lines#29, + is2=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;29 + r\E8, + use=news-old-unk, +# +# (news511: this had :TY=sjis: --esr) +nwp511|nwp-511|nwp-511 vt100, + OTbs, OTpt, am, xenl, + cols#80, lines#24, + clear=\E[;H\E[2J$<20/>, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A$<2/>, dl1=\E[M, + ed=\E[J$<30/>, el=\E[K$<3/>, + flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, + il1=\E[L, is2=\E[?5l\E[?1l\E>\E[?7h\E[?8h, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\E#W, khome=\E[H, + ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, + rs2=\E7\E[r\E8\E[?5l\E[?1l\E>\E[?7h\E[?8h, + smso=\E[7m$<2/>, smul=\E[4m$<2/>, +# (news517: this had :TY=sjis:. --esr) +nwp517|nwp-517|nwp-517 vt200 80 cols 30 rows, + eslok, hs, + cols#80, lines#30, + OTi2=\E[2$~\n, dsl=\E[1$~, fsl=\E[0$}, + is2=\E7\E[r\E8\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + tsl=\E[1$}\E[;%df, use=vt200, +# (news517-w: this had :TY=sjis:. --esr) +nwp517-w|nwp-517-w|nwp-517 vt200 132 cols 50 rows, + eslok, hs, + cols#132, lines#50, + OTi2=\E[2$~\n, dsl=\E[1$~, fsl=\E[0$}, + is2=\E7\E[r\E8\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, + tsl=\E[1$}\E[;%df, use=vt200, + +#### Common Desktop Environment +# + +# This ships with Sun's CDE in Solaris 2.5 +# Corrected Sun Aug 9 1998 by Alexander V. Lukyanov +dtterm|CDE desktop terminal, + am, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, lm#0, ncv@, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, home=\E[H, + ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, + ind=\ED, invis=\E[8m, is2=\E F\E>\E[?1l\E[?7h\E[?45l, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + kslt=\E[4~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmso=\E[22;27m, rmul=\E[24m, + sc=\E7, + sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 + %t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, use=ecma+color, + +######## Non-Unix Consoles +# + +#### EMX termcap.dat compatibility modes +# +# Also (possibly only EMX, so we don't put it in ansi.sys, etc): set the +# no_color_video to inform the application that standout(1), underline(2) +# reverse(4) and invisible(64) don't work with color. +emx-base|DOS special keys, + bce, bw, + it#8, ncv#71, + bel=^G, use=ansi.sys, + +# Except for the "-emx" suffixes, these are as distributed with EMX 0.9b, +# a Unix-style environment used on OS/2. (Note that the suffix makes some +# names longer than 14 characters, the nominal maximum). +# +# Removed: rmacs=\E[10m, smacs=\E[11m, because OS/2 does not implement acs. +ansi-emx|ANSI.SYS color, + am, bce, eo, mir, msgr, xon, + colors#8, cols#80, it#8, lines#25, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[1;33;44m\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, + cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch=\E[%p1%dp, ed=\E[J, el=\E[K, + flash=\E[?5h$<100/>\E[?5l, home=\E[H, ht=^I, hts=\EH, + ich=\E[%p1%d@, ich1=\E[@, ind=^J, kb2=\E[G, kbs=^H, kf0=\0D, + kll=\0O, kspd=^Z, nel=^M^J, rev=\E[5;37;41m, rmir=\E[4l, + rmpch=\E[10m, rmso=\E[0;44m\E[1;33m, + rmul=\E[0;44m\E[1;33m, rs1=\Ec, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, sgr0=\E[0m\E[1;33;44m, smir=\E[4h, + smpch=\E[11m, smso=\E[0;31;47m, smul=\E[1;31;44m, + tbc=\E[3g, u8=\E[?6c, u9=\E[c, use=emx-base, +# nice colors for Emacs (white on blue, mode line white on cyan) +ansi-color-2-emx|ANSI.SYS color 2, + clear=\E[0;37;44m\E[H\E[J, rev=\E[1;37;46m, + rmso=\E[0;37;44m, rmul=\E[0;37;44m, rs1=\Ec, + setaf=\E[3%p1%dm, sgr0=\E[0;37;44m, smso=\E[1;37;46m, + smul=\E[1;36;44m, use=ansi-emx, +# nice colors for Emacs (white on black, mode line black on cyan) +ansi-color-3-emx|ANSI.SYS color 3, + clear=\E[0;37;40m\E[H\E[J, rev=\E[1;37;46m, + rmso=\E[0;37;40m, rmul=\E[0;37;40m, rs1=\Ec, + setaf=\E[3%p1%dm, sgr0=\E[0;10m, smso=\E[1;37;46m, + smul=\E[0;36;40m, use=ansi-emx, +mono-emx|stupid monochrome ansi terminal with only one kind of emphasis, + am, + cols#80, it#8, lines#24, + clear=\E[H\E[2J$<50>, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, + ht=^I, kb2=\E[G, kbs=^H, kcub1=\0K, kcud1=\0P, kcuf1=\0M, + kcuu1=\0H, kf0=\0D, kf1=\0;, kf2=\0<, kf3=\0=, kf4=\0>, + kf5=\0?, kf6=\0@, kf7=\0A, kf8=\0B, kf9=\0C, khome=\0G, + kich1=\0R, kll=\0O, knp=\0Q, kpp=\0I, nel=^M^J, rev=\E[7m, + sgr0=\E[0m, + +#### Cygwin + +# Use this for cygwin32 (tested with beta 19.1) +# underline is colored bright magenta +# shifted kf1-kf12 are kf11-kf22 +cygwinB19|ansi emulation for cygwin32, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, + kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, rmam@, smam@, + use=ansi.sys, + +# Use this for cygwin (tested with version 1.1.0). +# I've combined pcansi and linux. Some values of course were different and +# I've indicated which of these were and which I used. +# Cheers, earnie_boyd@yahoo.com +# several changes based on running with tack and comparing with older entry -TD +# more changes from csw: +# add cbt [backtab] +# remove eo [erase overstrike with blank] +# change clear was \E[H\E[J now \E[2J (faster?) +# remove cols +# remove lines +# remove ncv#3 [colors collide with highlights, bitmask] not applicable +# to MSDOS box? +# add cub [cursor back param] +# add cuf [cursor forward param] +# add cuu [cursor up param] +# add cud [cursor down param] +# add hs [has status line] +# add fsl [return from status line] +# add tsl [go to status line] +# add smacs [Start alt charset] (not sure if this works) +# add rmacs [End alt charset] (ditto) +# add smcup [enter_ca_mode] (save console; thanks Corinna) +# add rmcup [exit_ca_mode] (restore console; thanks Corinna) +# add kb2 [center of keypad] +# add u8 [user string 8] \E[?6c +# add el [clear to end of line] \E[K +# Notes: +# cnorm [make cursor normal] not implemented +# flash [flash] not implemented +# blink [blink] not implemented very usefully in cygwin? \E[5m +# dim [dim] not implemented very usefully in cygwin? \E[2m +# cub1 [cursor back 1] typically \E[D, but ^H is faster? +# kNXT [shifted next key] not implemented +# kPRV [shifted prev key] not implemented +# khome [home key] really is \E[1~ NOT \E[H +# tbc [clear tab stops] not implemented +# xenl [newline ignnored after 80 cols] messes up last line? Ehud Karni +# smpch [Start PC charset] is \E[11m, same as smacs +# rmpch [End PC charset] is \E[10m, same as rmacs +# mir [move in insert mode] fails in tack? +# bce [back color erase] causes problems with change background color? +# cvvis [make cursor very visible] causes a stackdump when testing with +# testcurs using the output option? \E[?25h\E[?8c +# civis [make cursor invisible] causes everything to stackdump? \E[?25l\E[?1c +# ech [erase characters param] broken \E[%p1%dX +# kcbt [back-tab key] not implemented in cygwin? \E[Z +# +# 2005/11/12 -TD +# Remove cbt since it does not work in current cygwin +# Add 'mir' and 'in' flags based on tack +cygwin|ansi emulation for Cygwin, + am, hs, mir, msgr, xon, + colors#8, it#8, pairs#64, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j + \331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v + \301w\302x\263y\363z\362{\343|\330}\234~\376, + bel=^G, bold=\E[1m, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD, + cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, fsl=^G, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, kb2=\E[G, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, + kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, + nel=^M^J, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=\E[10m, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, + rmpch=\E[10m, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, + sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p6%t;1%;%?%p7 + %t;8%;%?%p9%t;11%;m, + sgr0=\E[0;10m, smacs=\E[11m, smcup=\E7\E[?47h, + smir=\E[4h, smpch=\E[11m, smso=\E[7m, smul=\E[4m, tsl=\E];, + vpa=\E[%i%p1%dd, use=vt102+enq, + +# I've supplied this so that you can help test new values and add other +# features. Cheers, earnie_boyd@yahoo.com. +# +# Some features are from pcansi. The op value is from linux. Function-keys +# are from linux. These have been tested not to cause problems. xenl was in +# this list, but DOES cause problems so it has been removed +cygwinDBG|Debug Version for Cygwin, + am, eo, mir, msgr, xon, + colors#8, cols#80, it#8, lines#24, ncv#3, pairs#64, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j + \331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v + \301w\302x\263y\363z\362{\343|\330}\234~\376, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cnorm=\E[?25h, cr=^M, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + flash=\E[?5h\E[?5l$<200/>, home=\E[H, hpa=\E[%i%p1%dG, + ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, invis=\E[8m, kNXT=\E[6$, kPRV=\E[5$, + kb2=\E[G, kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, + kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, + knp=\E[6~, kpp=\E[5~, kspd=^Z, nel=^M^J, op=\E[39;49m, + rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E[10m, rmir=\E[4l, + rmso=\E[m, rmul=\E[m, rs1=\Ec\E]R, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5 + %t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m, + sgr0=\E[0;10m, smacs=\E[11m, smir=\E[4h, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, vpa=\E[%i%p1%dd, use=vt102+enq, + +#### DJGPP + +# Key definitions: +# The encodings for unshifted arrow keys, F1-F12, Home, Insert, etc. match the +# encodings used by other x86 environments. All others are invented for DJGPP. +# Oddly enough, while several combinations of modifiers are tabulated, there is +# none for shifted cursor keys. +# +# F1 \E[[A +# F2 \E[[B +# F3 \E[[C +# F4 \E[[D +# F5 \E[[E +# F6 \E[17~ +# F7 \E[18~ +# F8 \E[19~ +# F9 \E[20~ +# F10 \E[21~ +# F11 \E[23~ +# F12 \E[24~ +# +# Delete \E[3~ +# Down Arrow \E[B +# End \E[4~ +# Home \E[1~ +# Insert \E[2~ +# Left Arrow \E[D +# Page Down \E[6~ +# Page Up \E[5~ +# Right Arrow \E[C +# Up Arrow \E[A +# +# Shift-F1 \E[25~ +# Shift-F2 \E[26~ +# Shift-F3 \E[27~ +# Shift-F4 \E[28~ +# Shift-F5 \E[29~ +# Shift-F6 \E[30~ +# Shift-F7 \E[31~ +# Shift-F8 \E[32~ +# Shift-F9 \E[33~ +# Shift-F10 \E[34~ +# Shift-F11 \E[35~ +# Shift-F12 \E[36~ +# +# Ctrl-F1 \E[47~ +# Ctrl-F2 \E[48~ +# Ctrl-F3 \E[49~ +# Ctrl-F4 \E[50~ +# Ctrl-F5 \E[51~ +# Ctrl-F6 \E[52~ +# Ctrl-F7 \E[53~ +# Ctrl-F8 \E[54~ +# Ctrl-F9 \E[55~ +# Ctrl-F10 \E[56~ +# Ctrl-F11 \E[57~ +# Ctrl-F12 \E[58~ +# +# Ctrl-Delete \E[43~ +# Ctrl-Down Arrow \E[38~ +# Ctrl-End \E[44~ +# Ctrl-Home \E[41~ +# Ctrl-Insert \E[42~ +# Ctrl-Left Arrow \E[39~ +# Ctrl-Page Down \E[46~ +# Ctrl-Page Up \E[45~ +# Ctrl-Right Arrow \E[40~ +# Ctrl-Up Arrow \E[37~ +# +# Alt-F1 \E[59~ +# Alt-F2 \E[60~ +# Alt-F3 \E[61~ +# Alt-F4 \E[62~ +# Alt-F5 \E[63~ +# Alt-F6 \E[64~ +# Alt-F7 \E[65~ +# Alt-F8 \E[66~ +# Alt-F9 \E[67~ +# Alt-F10 \E[68~ +# Alt-F11 \E[79~ +# Alt-F12 \E[80~ +# +# Alt-Delete \E[65~ +# Alt-Down Arrow \E[60~ +# Alt-End \E[66~ +# Alt-Home \E[41~ +# Alt-Insert \E[64~ +# Alt-Left Arrow \E[61~ +# Alt-Page Down \E[68~ +# Alt-Page Up \E[67~ +# Alt-Right Arrow \E[62~ +# Alt-Up Arrow \E[59~ +# +# Also: +# Alt-A \E[82~ +# Alt-B \E[82~ +# Alt-C \E[83~ +# Alt-D \E[84~ +# Alt-E \E[85~ +# Alt-F \E[86~ +# Alt-G \E[87~ +# Alt-H \E[88~ +# Alt-I \E[89~ +# Alt-J \E[90~ +# Alt-K \E[91~ +# Alt-L \E[92~ +# Alt-M \E[93~ +# Alt-N \E[94~ +# Alt-O \E[95~ +# Alt-P \E[96~ +# Alt-Q \E[97~ +# Alt-R \E[98~ +# Alt-S \E[99~ +# Alt-T \E[100~ +# Alt-U \E[101~ +# Alt-V \E[102~ +# Alt-W \E[103~ +# Alt-X \E[104~ +# Alt-Y \E[105~ +# Alt-Z \E[106~ +djgpp|ansi emulation for DJGPP alpha, + am, bce, msgr, xhp, xon, xt, + colors#8, it#8, pairs#64, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j + \331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v + \301w\302x\263y\363z\362{\343|\330}\234~\376, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[1v, + clear=\E[H\E[J, cnorm=\E[v, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[2v, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, invis=\E[8m, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, + kend=\E[4~, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf2=\E[[B, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, nel=^M^J, + op=\E[37;40m, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%e;25%;%? + %p6%t;1%;%?%p7%t;8%;m, + sgr0=\E[m, smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, + +djgpp203|Entry for DJGPP 2.03, + OTbs, am, + cols#80, it#8, lines#25, + bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, + kcud1=^J, nel=^M^J, + +djgpp204|Entry for DJGPP 2.04, + OTbs, am, AX, + colors#8, cols#80, it#8, lines#25, ncv#3, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[1v, + clear=\E[H\E[2J, cnorm=\E[v, cr=^M, cub=\E[%p1%dD, + cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, cvvis=\E[2v, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kf0=\E[21~, kf1=\E[[A, kf10=\E[21~, kf2=\E[[B, + kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, + kll=\E[4~, knp=\E[6~, kpp=\E[5~, nel=^M^J, rev=\E[7m, + ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, sgr0=\E[m, smso=\E[7m, smul=\E[4m, + +#### U/Win + +# This is tested using U/Win's telnet. Scrolling is omitted because it is +# buggy. Another odd bug appears when displaying "~" in alternate character +# set (the emulator spits out error messages). Compare with att6386 -TD +uwin|U/Win 3.2 console, + am, eo, in, msgr, xenl, xon, + colors#8, it#8, ncv#58, pairs#64, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260i + \316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u + \264v\301w\302x\263y\363z\362{\343|\330}\234~\376, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, cub1=^H, cud1=^J, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, ech=\E[%p1%dX, + ed=\E[J, el=\E[K, el1=\E[1K, home=\E[H, ht=^I, hts=\EH, + ich=\E[%p1%d@, ich1=\E[@, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[Y, kf1=\EOP, + kf10=\EOY, kf11=\EOZ, kf12=\EOA, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, kf9=\EOX, + khome=\E[H, kich1=\E[@, nel=^M^J, op=\E[39;49m, rc=\E8, + rev=\E[7m, rmacs=\E[10m, rmir=\E[4l, rmpch=\E[10m, + rmso=\E[27m, rmul=\E[m, rs1=\Ec\E]R, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0;10m, + smacs=\E[11m, smir=\E[4h, smpch=\E[11m, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, + +#### Microsoft (miscellaneous) + +# This entry fits the Windows NT console when the _POSIX_TERM environment +# variable is set to 'on'. While the Windows NT POSIX console is seldom used, +# the Telnet client supplied with both the Windows for WorkGroup 3.11 TCP/IP +# stack and the Win32 (i.e., Windows 95 and Windows NT 3.1 or later) operating +# systems is not, and (surprise!) they match very well. +# +# See: MS Knowledge Base item Q108581, dated 13-MAY-1997, titled "Setting Up +# VI POSIX Editor for Windows NT 3.1". True to Microsoft form, not only +# are the installation instructions a pile of mind-numbing bureaucratese, +# but the termcap entry is actually broken and unusable as given; the :do: +# capability is misspelled "d". +# +# To use this, you need to a bunch of environment variables: +# +# SET _POSIX_TERM=on +# SET TERM=ansi +# SET TERMCAP=location of termcap file in POSIX file format +# which is case-sensitive. +# e.g. SET TERMCAP=//D/RESKIT35/posix/termcap +# SET TMP=//C/TEMP +# +# Important note: setting the TMP environment variable in POSIX style renders +# it incompatible with a lot of other applications, including Visual C++. So +# you should have a separate command window just for vi. All the other +# variables may be permanently set in the Control Panel\System applet. +# +# You can find out more about the restrictions of this facility at +# . +# +# From: Federico Bianchi , 15 Jan 1997 +ansi-nt|psx_ansi|Microsoft Windows NT console POSIX ANSI mode, + am, bw, msgr, + cols#80, it#8, lines#25, + bel=^G, clear=\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, ind=\E[S, kbs=^H, kcub1=\E[D, kcud1=\E[V, + kcuf1=\E[C, kcuu1=\E[A, nel=\r\E[S, rc=\E[u, rev=\E[7m, + ri=\E[T, rmso=\E[m, sc=\E[s, sgr0=\E[0m, smso=\E[7m, +# From: jew@venus.sunquest.com +# Date: 19 Feb 93 23:41:07 GMT +# Here's a combination of ansi and vt100 termcap +# entries that works nearly perfectly for me +# (Gateway 2000 Handbook and Microsoft Works 3.0): +pcmw|PC running Microsoft Works, + am, xenl, + cols#80, it#8, lines#24, vt#3, + bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, + clear=\E[;H\E[2J$<50/>, cr=^M, cub1=^H, cud1=^J, + cuf1=\E[C$<2/>, cup=\E[%i%p1%d;%p2%dH$<5/>, + cuu1=\E[A$<2/>, ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, + ht=^I, hts=\EH$<2/>, ind=\ED$<5/>, is2=\E[1;24r\E[24;1H, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\r\ED$<5/>, + rc=\E8, rev=\E[7m$<2/>, rf=/usr/share/tabset/vt100, + ri=\EM$<5/>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m$<2/>, smso=\E[7m$<2/>, smul=\E[4m$<2/>, + tbc=\E[3g$<2/>, + +# From: Federico Bianchi +# This is the entry for the OpenNT terminal. +# The ntconsole name is for backward compatability. +# This is for OpenNT 2.0 and later. +# Later OpenNT was renamed to Interix. +# +# Presently it is distributed by Microsoft as Services For Unix (SFU). +# The 3.5 beta contains ncurses 4.2 (that is header files and executables, +# the documentation dates from 1.9.9e) -TD + +interix|opennt|opennt-25|ntconsole|ntconsole-25|OpenNT-term compatible with color, + am, bw, msgr, + colors#8, cols#80, lines#25, ncv#3, pairs#64, + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j + \331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v + \301w\302x\263y\363z\362{\343|\330}\234~\376, + bel=^G, bold=\E[1m, cbt=\E[Z, clear=\E[2J, cub=\E[%p1%dD, + cub1=\E[D, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[M, kend=\E[U, kf0=\EFA, + kf1=\EF1, kf10=\EFA, kf11=\EFB, kf12=\EFC, kf13=\EFD, + kf14=\EFE, kf15=\EFF, kf16=\EFG, kf17=\EFH, kf18=\EFI, + kf19=\EFJ, kf2=\EF2, kf20=\EFK, kf21=\EFL, kf22=\EFM, + kf23=\EFN, kf24=\EFO, kf25=\EFP, kf26=\EFQ, kf27=\EFR, + kf28=\EFS, kf29=\EFT, kf3=\EF3, kf30=\EFU, kf31=\EFV, + kf32=\EFW, kf33=\EFX, kf34=\EFY, kf35=\EFZ, kf36=\EFa, + kf37=\EFb, kf38=\EFc, kf39=\EFd, kf4=\EF4, kf40=\EFe, + kf41=\EFf, kf42=\EFg, kf43=\EFh, kf44=\EFi, kf45=\EFj, + kf46=\EFk, kf47=\EFm, kf48=\EFn, kf49=\EFo, kf5=\EF5, + kf50=\EFp, kf51=\EFq, kf52=\EFr, kf53=\EFs, kf54=\EFt, + kf55=\EFu, kf56=\EFv, kf57=\EFw, kf58=\EFx, kf59=\EFy, + kf6=\EF6, kf60=\EFz, kf61=\EF+, kf62=\EF-, kf63=\EF^L, + kf7=\EF7, kf8=\EF8, kf9=\EF9, kich1=\E[L, kll=\E[U, knp=\E[T, + kpp=\E[S, ll=\E[U, nel=^M^J, op=\E[m, rc=\E[u, rev=\E[7m, + ri=\E[T, rin=\E[%p1%dT, rmcup=\E[2b\E[u\r\E[K, rmso=\E[m, + rmul=\E[m, rs1=\Ec, sc=\E[s, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, setb=\E[%p1%{40}%+%dm, + setf=\E[%p1%{30}%+%dm, sgr0=\E[0m, smcup=\E[s\E[1b, + smso=\E[7m, smul=\E[4m, kf64=\EF$, + +opennt-35|ntconsole-35|OpenNT-term35 compatible with color, + lines#35, use=opennt, + +opennt-50|ntconsole-50|OpenNT-term50 compatible with color, + lines#50, use=opennt, + +opennt-60|ntconsole-60|OpenNT-term60 compatible with color, + lines#60, use=opennt, + +opennt-100|ntconsole-100|OpenNT-term100 compatible with color, + lines#100, use=opennt, + +# OpenNT wide terminals +opennt-w|opennt-25-w|ntconsole-w|ntconsole-25-w|OpenNT-term-w compat with color, + cols#125, use=opennt, + +opennt-35-w|ntconsole-35-w|OpenNT-term35-w compatible with color, + lines#35, use=opennt-w, + +opennt-50-w|ntconsole-50-w|OpenNT-term50-w compatible with color, + lines#50, use=opennt-w, + +opennt-60-w|ntconsole-60-w|OpenNT-term60-w compatible with color, + lines#60, use=opennt-w, + +opennt-w-vt|opennt-25-w-vt|ntconsole-w-vt|ntconsole-25-w-vt|OpenNT-term-w-vt compat with color, + cols#132, use=opennt, + +# OpenNT terminals with no smcup/rmcup (names match termcap entries) +interix-nti|opennt-nti|opennt-25-nti|ntconsole-25-nti|OpenNT-nti compatible with color, + rmcup@, smcup@, use=opennt, + +opennt-35-nti|ntconsole-35-nti|OpenNT-term35-nti compatible with color, + lines#35, use=opennt-nti, + +opennt-50-nti|ntconsole-50-nti|OpenNT-term50-nti compatible with color, + lines#50, use=opennt-nti, + +opennt-60-nti|ntconsole-60-nti|OpenNT-term60-nti compatible with color, + lines#60, use=opennt-nti, + +opennt-100-nti|ntconsole-100-nti|OpenNT-term100-nti compatible with color, + lines#100, use=opennt-nti, + +######## COMMON TERMINAL TYPES +# +# This section describes terminal classes and maker brands that are still +# quite common, but have proprietary command sets not blessed by ANSI. +# + +#### Altos +# +# Altos made a moderately successful line of UNIX boxes. In 1990 they were +# bought out by Acer, a major Taiwanese manufacturer of PC-clones. +# Acer has a web site at http://www.acer.com. +# +# Altos descriptions from Ted Mittelstaedt 4 Sep 1993 +# His comments suggest they were shipped with the system. +# + +# (altos2: had extension capabilities +# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ +# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ +# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ +# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: +# :XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\ +# :YU=^AQ\r:YD=^AR\r:YR=^AS\r:YL=^AT\r:\ +# :HL=^AP\r:SP=\E[i:\ +# :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:\ +# :LO=\E[0q:LC=\E[5q:LL=\E[6q:\ +# Comparison with the k* capabilities makes it obvious that the c* things are +# shift keys. I have renamed them to keys 32 and up accordingly. Also, +# :sr: was given as a boolean-- esr) +altos2|alt2|altos-2|altos II, + cols#80, it#8, lines#24, xmc#0, + clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[1B, cuf1=\E[1C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[1A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, + if=/usr/share/tabset/vt100, il1=\E[L, ind=^J, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kDL=^Am\r, + kEOL=^An\r, kbs=^H, kcbt=^AK\r, kclr=^AL\r, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=^AM\r, kel=^AN\r, + kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf32=^A`\r, + kf33=^Aa\r, kf34=^Ab\r, kf35=^Ac\r, kf36=^Ad\r, kf37=^Ae\r, + kf38=^Af\r, kf39=^Ag\r, kf4=^AC\r, kf40=^Ah\r, kf41=^Ai\r, + kf42=^Aj\r, kf43=^Ak\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=\E[f, kil1=^AJ\r, kind=^AO\r, + nel=^M^J, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smam=\E[?7h, smso=\E[7m, smul=\E[4m, +# (altos3: had extension capabilities +# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ +# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ +# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ +# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: +# :XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\ +# :HL=^AP\r:SP=\E[i:\ +# :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T: +altos3|altos5|alt3|alt5|altos-3|altos-5|altos III or V, + blink=\E[5p, ri=\EM, sgr0=\E[p, use=altos2, +altos4|alt4|altos-4|altos IV, + use=wy50, +# (altos7: had extension capabilities: +# :GG#0:GI=\EH8:GF=\EH7:\ +# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ +# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ +# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ +# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: +# Comparison with the k* capabilities makes it obvious that the c* things are +# shift keys. I have renamed them to keys 32 and up accordingly. I have +# also made this entry relative to adm12 in order to give it an . The +# imported by use=adm+sgr may work, let me know. -- esr) +altos7|alt7|altos VII, + am, mir, + cols#80, lines#24, xmc#0, + acsc=j5k3l2m1n8q\:t4u9v=w0x6, blink=\EG2, bold=\EGt, + clear=\E+^^, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dim=\EGp, dl1=\ER, ed=\EY, el=\ET, home=^^, ht=^I, il1=\EE, + ind=^J, invis=\EG1, + is2=\E`\:\Ee(\EO\Ee6\Ec41\E~4\Ec21\Eu\E~2, kDL=^Am\r, + kEOL=^An\r, kbs=^H, kcbt=^AK\r, kclr=^AL\r, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=^AM\r, kel=^AN\r, + kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf32=^A`\r, + kf33=^Aa\r, kf34=^Ab\r, kf35=^Ac\r, kf36=^Ad\r, kf37=^Ae\r, + kf38=^Af\r, kf39=^Ag\r, kf4=^AC\r, kf40=^Ah\r, kf41=^Ai\r, + kf42=^Aj\r, kf43=^Ak\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^^, kil1=^AJ\r, kind=^AO\r, + knp=\EK, kpp=\EJ, mc4=\EJ, mc5=\Ed#, nel=^M^J, ri=\Ej, + rmir=\Er, smir=\Eq, use=adm+sgr, +altos7pc|alt7pc|altos PC VII, + kend=\ET, use=altos7, + +#### Hewlett-Packard (hp) +# +# Hewlett-Packard +# 8000 Foothills Blvd +# Roseville, CA 95747 +# Vox: 1-(916)-785-4363 (Technical response line for VDTs) +# 1-(800)-633-3600 (General customer support) +# +# +# As of March 1998, HP no longer has any terminals in production. +# The 700 series (22, 32, 41, 44, 92, 94, 96, 98) is still being +# supported (they still have parts). So are the 2392a and 2394a. +# See the WORKSTATION CONSOLES section for the 700s. +# + +# Generic HP terminal - this should (hopefully) work on any HP terminal. +hpgeneric|hp|hewlett-packard generic terminal, + OTbs, OTpt, am, da, db, mir, xhp, + cols#80, lines#24, lm#0, vt#6, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\E&a%p2%dc%p1%dY$<6>, cuu1=\EA, dch1=\EP, dl1=\EM, + ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, il1=\EL, + ind=^J, kbs=^H, kcbt=\Ei, rmir=\ER, rmso=\E&d@, rmul=\E&d@, + sgr0=\E&d@, smir=\EQ, smso=\E&dJ, smul=\E&dD, tbc=\E3, + vpa=\E&a%p1%dY, + +hp110|hewlett-packard model 110 portable, + lines#16, use=hpgeneric, + +hp+pfk+cr|hp function keys with CR, + kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, + kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, + +hp+pfk-cr|hp function keys w/o CR, + kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, + kf8=\Ew, + +# The hp2621s use the same keys for the arrows and function keys, +# but not separate escape sequences. These definitions allow the +# user to use those keys as arrow keys rather than as function +# keys. +hp+pfk+arrows|hp alternate arrow definitions, + kcub1=\Eu\r, kcud1=\Ew\r, kcuf1=\Ev\r, kcuu1=\Et\r, kf1@, + kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, khome=\Ep\r, kind=\Er\r, + kll=\Eq\r, kri=\Es\r, + +hp+arrows|hp arrow definitions, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, + kind=\ES, kll=\EF, kri=\ET, + +# Generic stuff from the HP 262x series +# +hp262x|HP 262x terminals, + xhp, + blink=\E&dA, dch1=\EP$<2>, ed=\EJ, ht=\011$<2>, ind=\ES, + invis=\E&dS, ip=$<2>, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, khome=\Eh, + kich1=\EQ, kil1=\EL, kind=\ES, knp=\EU, kpp=\EV, kri=\ET, + krmir=\ER, rev=\E&dB, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, + sgr=\E&d%{64}%?%p1%t%{66}%|%;%?%p2%t%{68}%|%;%?%p3%t%{66}%| + %;%?%p4%t%{65}%|%;%c, + sgr0=\E&d@, smkx=\E&s1A, smso=\E&dB, smul=\E&dD, + +# Note: no on HPs since that homes to top of memory, not screen. +# Due to severe 2621 braindamage, the only way to get the arrow keys to +# transmit anything at all is to turn on the function key labels +# with , and even then the user has to hold down shift! +# The default 2621 turns off the labels except when it has to to +# enable the function keys. If your installation prefers labels +# on all the time, or off all the time (at the "expense" of the +# function keys), use 2621-nl or 2621-wl. +# +# Note: there are newer ROMs for 2621's that allow you to set +# strap A so the regular arrow keys xmit \EA, etc, as with the +# 2645. However, even with this strap set, the terminal stops +# xmitting if you reset it, until you unset and reset the strap! +# Since there is no way to set/unset the strap with an escape +# sequence, we don't use it in the default. +# If you like, you can use 2621-ba (brain-damaged arrow keys). +hp2621-ba|2621 w/new rom and strap A set, + rmkx@, smkx@, use=hp+arrows, use=hp2621, + +# hp2621 with function labels. Most of the time they are off, +# but inside vi, the function key labels appear. You have to +# hold down shift to get them to xmit. +hp2621|hp2621a|hp2621A|2621|2621a|2621A|hp2621-wl|2621-wl|hp 2621 w/labels, + is2=\E&jA\r, rmkx=\E&jA, use=hp2621-fl, +hp2621-fl|hp 2621, + xhp@, xon, + pb#19200, + cbt=\Ei, cup=\E&a%p2%dc%p1%dY, dch1=\EP$<2>, ht=\011$<2>, + ip=$<2>, is2=\E&j@\r, rmkx=\E&j@, rmso=\E&d@, rmul=\E&d@, + sgr0=\E&d@, smkx=\E&jB, smso=\E&dD, smul=\E&dD, + use=hp+pfk+cr, use=hpgeneric, + +# To use hp2621p printer, setenv TERM=2621p, PRINTER=2612p +hp2621p|hp 2621 with printer, + mc4=\E&p13C, mc5=\E&p11C, use=hp2621, + +hp2621p-a|hp2621p with fn as arrows, + use=hp+pfk+arrows, use=hp2621p, + +# hp2621 with k45 keyboard +hp2621-k45|hp2621k45|k45|hp 2621 with 45 keyboard, + kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + khome=\Eh, rmkx=\E&s0A, smkx=\E&s1A, use=hp2621, + +# 2621 using all 48 lines of memory, only 24 visible at any time. +hp2621-48|48 line 2621, + lines#48, + cup=\E&a%p2%dc%p1%dR, home=\EH, vpa=\E&a%p1%dR, + use=hp2621, + +# 2621 with no labels ever. Also prevents vi delays on escape. +hp2621-nl|hp 2621 with no labels, + kcub1@, kcud1@, kcuf1@, kcuu1@, khome@, rmkx@, smkx@, + use=hp2621-fl, + +# Needed for UCB ARPAVAX console, since lsi-11 expands tabs +# (wrong). +# +hp2621-nt|hp 2621 w/no tabs, + ht@, use=hp2621, + +# Hp 2624 B with 4 or 10 pages of memory. +# +# Some assumptions are made with this entry. These settings are +# NOT set up by the initialization strings. +# +# Port Configuration +# RecvPace=Xon/Xoff +# XmitPace=Xon/Xoff +# StripNulDel=Yes +# +# Terminal Configuration +# InhHndShk=Yes +# InhDC2=Yes +# XmitFnctn(A)=No +# InhEolWrp=No +# +# Note: the 2624 DOES have a true , believe it or not! +# +# The 2624 has an "error line" to which messages can be sent. +# This is CLOSE to what is expected for a "status line". However, +# after a message is sent to the "error line", the next carriage +# return is EATEN and the "error line" is turned back off again! +# So I guess we can't define , , , , , . +# +# This entry supports emacs (and any other program that uses raw +# mode) at 4800 baud and less. I couldn't get the padding right +# for 9600. +# +# (hp2624: replaced NUL sequences in flash with mandatory pauses -- esr) +hp2624|hp2624a|hp2624b|hp2624b-4p|Hewlett Packard 2624 B, + da, db, + lm#96, + flash=\E&w13F$<66/>\E&w12F$<66/>\E&w13F$<66/>\E&w12F, use=hp+labels, use=scrhp, + +# This hp2626 entry does not use any of the fancy windowing stuff +# of the 2626. +# +# Indeed, terminfo does not yet handle such stuff. Since changing +# any window clears memory, it is probably not possible to use +# this for screen opt. +# +# ed is incredibly slow most of the time - I am guessing at the +# exact padding. Since the terminal uses xoff/xon this is intended +# only for cost computation, so that the terminal will prefer el +# or even dl1 which is probably faster! +# +# \ED\EJ\EC hack for ed from Ed Bradford - apparently ed is only +# extra slow on the last line of the window. +# +# The padding probably should be changed. +# +hp2626|hp2626a|hp2626p|hp 2626, + da, db, + lm#0, pb#19200, + ed=\ED\EJ$<500>\EC, indn=\E&r%p1%dD, ip=$<4>, + is2=\E&j@\r, rin=\E&r%p1%dU, use=hp+pfk-cr, + use=hp+labels, use=scrhp, + +# This entry is for sysline. It allocates a 23 line window with +# a 115 line workspace for regular use, and a 1 line window for +# the status line. +# +# This assumes port 2 is being used. +# Turn off horizontal line, Create ws #1 with 115 lines, +# Create ws #2 with 1 line, Create window #1 lines 1-23, +# Create window #2 lines 24-24, Attach cursor to workspace #1. +# Note that this clears the tabs so it must be done by tset before +# it sets the tabs. +# +hp2626-s|hp 2626 using only 23 lines, + eslok, hs, + lines#23, + fsl=\E&d@\E&w7f2p1I\E&w4f1I, + is1=\E&q3t0{0H\s\E&w0f115n1I\s\E&w0f1n2I\s\E&w2f1i0d0u22l0S + \s\E&w2f2i0d23u23l0S\s\E&w7f2p1I\s\r, + tsl=\E&w7f2p2I\E&w4f2I\r\EK\E&a%p1%dC, use=hp2626, +# Force terminal back to 24 lines after being 23. +hp2626-ns|hp 2626 using all 24 lines, + is1=\E&q3t0{0H\s\E&w0f118n1I\s\E&w0f1n2I\s\E&w2f1i0d0u23l0S + \s\E&w3f2I\s\E&w7f2p1I\s\r, + use=hp2626, +# Various entries useful for small windows on 2626. +hp2626-12|hewlett-packard 2626 12 lines, + lines#12, use=hp2626, +hp2626-12x40|hewlett-packard 2626 12 lines 40 columns, + cols#40, lines#12, use=hp2626, +hp2626-x40|hewlett-packard 2626 40 columns, + cols#40, use=hp2626, +hp2626-12-s|hewlett-packard 2626 11 lines plus status, + lines#11, use=hp2626-s, + +# +# hp2627 color tubes from University of Wisconsin +# +hp2627a-rev|hp 2627 with reverse video colors, + cr=^M, cud1=^J, ht=^I, ind=^J, + is2=\E&v0m1a0b0c1x1y1z1i0a0b1c1x1y1z0i0S\E&j@\r\E3 + \r, + kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rmul=\E&v0S\E&d@, + smul=\E&dD\E&v1S, use=hp2621-nl, +hp2627a|hp 2627 color terminal with no labels, + cr=^M, cud1=^J, ht=^I, ind=^J, + is2=\E&v0m1a1b0c1i0a1b1c2i1a0b0c0i0S\E&j@\r\E3\r, + kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rmso=\E&v0S, + rmul=\E&v0S\E&d@, smso=\E&v2S, smul=\E&dD\E&v1S, + use=hp2621-nl, +hp2627c|hp 2627 color (cyan) terminal with no labels, + cr=^M, cud1=^J, ht=^I, ind=^J, + is2=\E&v0m1a0b0c2i1a1b0c1i0a1b1c0i0S\E&j@\r\E3\r, + kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, use=hp2627a, + +# hp2640a doesn't have the Y cursor addressing feature, and C is +# memory relative instead of screen relative, as we need. +# +hp2640a|hp 2640a, + cup@, rmkx@, smkx@, use=hp2645, + +hp2640b|hp2644a|hp 264x series, + rmkx@, smkx@, use=hp2645, + +# (hp2641a: removed unknown :gu: -- esr) +hp2641a|hp2645a|hp2647a|HP 264?A series BRL entry, + am, da, db, mir, xhp, + cols#80, lines#24, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\E&a%p2%2dc%p1%2dY, cuu1=\EA, dch1=\EP, dl1=\EM, + ed=\EJ, el=\EK, hpa=\E&a%p1%2dC, ht=^I, + if=/usr/share/tabset/std, il1=\EL, ind=^J, + is2=\EE$<500/>, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, + rmir=\ER, rmso=\E&d@, smir=\EQ, smso=\E&dB, + vpa=\E&a%p1%2dY, + +# This terminal should be used at 4800 baud or less. It needs padding for +# plain characters at 9600, I guessed at an appropriate cr delay. It really +# wants ^E/^F handshaking, but that doesn't work well even if you write +# software to support it. +hp2645|hp45|HP 2645 series, + pb#9600, + blink=\E&dA, cr=\r$<20>, dim=\E&dH, kctab=\E2, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, + ked=\EJ, kel=\EK, khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, + kind=\ES, knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, rev=\E&dB, + rmkx=\E&s0A, + sgr=\E&d%{64}%?%p1%t%{66}%|%;%?%p2%t%{68}%|%;%?%p3%t%{66}%| + %;%?%p4%t%{65}%|%;%?%p5%t%{72}%|%;%?%p6%t%{66}%|%;%c, + sgr0=\E&d@, smkx=\E&s1A, smul=\E&dD, use=hpgeneric, +# You should use this terminal at 4800 baud or less. +hp2648|hp2648a|HP 2648a graphics terminal, + clear=\EH\EJ$<50>, cup=\E&a%p2%dc%p1%dY$<20>, + dch1=\EP$<7>, ip=$<5>, use=hp2645, + +# The HP 150 terminal is a fairly vanilla HP terminal, with the +# clreol standout problem. It also has graphics capabilities and +# a touch screen, which we don't describe here. +hp150|hewlett packard Model 150, + OTbs, use=hp2622, + +# HP 2382a terminals, "the little ones." They don't have any +# alternate character set support and sending out ^N/^O will +# leave the screen blank. +hp2382a|hp2382|hewlett packard 2382a, + da, db, + lh#1, lm#48, + acsc@, + pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t\s%;%p2 + %s, + rmacs@, + sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga + %+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+ + %Pa%;%?%p7%t%?%ga%ts%ga%{64}%+%e%{83}%;%e%?%ga%t%ga%{64} + %+%e%{64}%;%;%c, + sgr0=\E&d@, smacs@, use=hp+labels, use=scrhp, + +hp2621-a|hp2621a-a|hp2621 with fn as arrows, + use=hp+pfk+arrows, use=hp2621-fl, + +# newer hewlett packard terminals + +newhpkeyboard|generic entry for HP extended keyboard, + kbs=^H, kcbt=\Ei, kclr=\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, khome=\Eh, + kich1=\EQ, kil1=\EL, kind=\ET, kll=\EF, knp=\EU, kpp=\EV, + kri=\ES, krmir=\ER, rmkx=\E&s0A, smkx=\E&s1A, + use=hp+pfk-cr, + +newhp|generic entry for new hewlett packard terminals, + am, bw, mir, xhp, xon, + cols#80, lines#24, pb#4800, + acsc=2[3@4>5I9(\:'JSKWLQMAO#P$Q;R!S"T1U2V4W3X\:Y+Z*dHjGkTlRm + Fn/q\,t5u6v8w7x., + bel=^G, blink=\E&dA, bold=\E&dF, cbt=\Ei, cr=^M, cub1=^H, + cud1=^J, cuf1=\EC, cuu1=\EA, dch1=\EP$<2>, dim=\E&dH, + dl1=\EM, ed=\EJ, el=\EK, ht=\011$<2>, hts=\E1, il1=\EL, ind=^J, + invis=\E&dS, ip=$<2>, is1=\E&jB$<8>, nel=^M^J, + pfkey=\E&f0a%p1%dk0d%p2%l%dL%p2%s, + pfloc=\E&f1a%p1%dk0d%p2%l%dL%p2%s, + pfx=\E&f2a%p1%dk0d%p2%l%dL%p2%s, rev=\E&dB, ri=\ET, + rmacs=^O, rmir=\ER, rmso=\E&d@, rmul=\E&d@, rs1=\Eg, + sgr=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga + %+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+ + %Pa%;%?%p7%t%?%ga%ts%ga%{64}%+%e%{83}%;%e%?%ga%t%ga%{64} + %+%e%{64}%;%;%c%?%p9%t\016%e\017%;, + sgr0=\E&d@\017, smacs=^N, smir=\EQ, smso=\E&dJ, smul=\E&dD, + tbc=\E3, use=newhpkeyboard, + +memhp|memory relative addressing for new HP ttys, + vt#6, + clear=\EH\EJ$<40>, cub=\E&a-%p1%dC, cud=\E&a+%p1%dR, + cuf=\E&a+%p1%dC, cup=\E&a%p1%dr%p2%dC, cuu=\E&a-%p1%dR, + home=\EH, hpa=\E&a%p1%dC, ll=\E&a23R\r, + mrcup=\E&a%p1%dr%p2%dC, vpa=\E&a%p1%dR, use=newhp, + +scrhp|screen relative addressing for new HP ttys, + clear=\E&a0c0Y\EJ$<40>, cub=\E&a-%p1%dC, + cud=\E&a+%p1%dR, cuf=\E&a+%p1%dC, + cup=\E&a%p1%dy%p2%dC$<10>, cuu=\E&a-%p1%dR, + home=\E&a0y0C, hpa=\E&a%p1%dC, ll=\E&a0y0C\EA, + mrcup=\E&a%p1%dr%p2%dC, vpa=\E&a%p1%dY, use=newhp, + +# (hp+labels: added label values from a BRL termcap -- esr) +hp+labels|"standard" label info for new HP ttys, + lh#2, lw#8, nlab#8, + lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, + pln=\E&f2a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t\s%;%p2 + %s, + rmln=\E&j@, smln=\E&jB, + +hp+printer|"standard" printer info for HP ttys, + ff=\E&p4u0C, mc0=\EH\E&p4dF, mc4=\E&p13C, mc5=\E&p11C, + + +# The new hp2621b is kind of a cross between the old 2621 and the +# new 262x series of machines. It has dip-switched options. +# The firmware has a bug in it such that if you give it a null +# length label, the following character is eaten! +hp2621b|hp 2621b with old style keyboard, + lh#1, lm#48, lw#8, nlab#8, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, + kind=\ET, kll=\EF, kri=\ES, + pln=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d3L%?%ga%!%t%{32}%c + %;%p2%s\E%{111}%p1%+%c\r, + smln=\E&jB, use=hp2621, + +hp2621b-p|hp 2621b with printer, + use=hp+printer, use=hp2621b, + +# hp2621b - new 2621b with new extended keyboard +# these are closer to the new 26xx series than the other 2621b +hp2621b-kx|hp 2621b with extended keyboard, + use=newhpkeyboard, use=hp2621b, + +hp2621b-kx-p|hp 2621b with new keyboard & printer, + use=hp+printer, use=hp2621b-kx, + +# Some assumptions are made in the following entries. +# These settings are NOT set up by the initialization strings. +# +# Port Configuration +# RecvPace=Xon/Xoff XmitPace=Xon/Xoff StripNulDel=Yes +# +# Terminal Configuration +# InhHndShk(G)=Yes InhDC2(H)=Yes +# XmitFnctn(A)=No InhEolWrp=No +# +# +# Hp 2622a & hp2623a display and graphics terminals +# +hp2622|hp2622a|hp 2622, + da, db, + lm#0, pb#19200, + is2=\E&dj@\r, use=hp+pfk-cr, use=hp+labels, use=scrhp, + +# The 2623 is a 2622 with extra graphics hardware. +hp2623|hp2623a|hp 2623, + use=hp2622, + +hp2624b-p|hp2624b-4p-p|hewlett packard 2624 B with printer, + use=hp+printer, use=hp2624, + +# The hewlett packard B can have an optional extra 6 pages of memory. +hp2624-10p|hp2624a-10p|hp2624b-10p|hewlett packard 2624 B w/ 10 pages of memory, + lm#240, use=hp2624, + +hp2624b-10p-p|hewlett packard 2624 B w/ extra memory & printer, + lm#240, use=hp2624b-p, + +# Color manipulations for HP terminals +hp+color|hp with colors, + ccc, + colors#16, ncv#17, pairs#7, + initp=\E&v%?%p2%{1000}%=%t1%e.%p2%d%;a%?%p3%{1000}%=%t1%e. + %p3%d%;b%?%p4%{1000}%=%t1%e.%p4%d%;c%?%p5%{1000}%=%t1 + %e.%p5%d%;x%?%p6%{1000}%=%t1%e.%p6%d%;y%?%p7%{1000}%= + %t1%e.%p7%d%;z%p1%dI, + oc=\E&v0m1a1b1c0I\E&v1a1I\E&v1b2I\E&v1a1b3I\E&v1c4I\E&v1a1c5 + I\E&v1b1c6I\E&v1x1y7I, + op=\E&v0S, scp=\E&v%p1%dS, + +# sets the screen to be 80 columns wide +hp2397a|hp2397|hewlett packard 2397A color terminal, + is2=\E&w6f80X, use=memhp, use=hp+labels, use=hp+color, + +# HP 700/44 Setup parameters: +# Terminal Mode HP-PCterm +# Inhibit Auto Wrap NO +# Status Line Host Writable +# PC Character Set YES +# Twenty-Five Line Mode YES +# XON/XOFF @128 or 64 (sc) +# Keycode Mode NO or YES (sc) +# Backspace Key BS or BS/DEL +# +# sets pcterm; autowrap; 25 lines; pc char set; prog DEL key; +# \E\\? does not turn off keycode mode +# sets alternate start/stop; keycode on +hpansi|hp700|hewlett packard 700/44 in HP-PCterm mode, + am, eo, xenl, xon, + cols#80, lines#25, + acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x + \263, + bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[2J\E[H, + cnorm=\E[?25h, cr=^M, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, + ind=^J, + is2=\E[44"p\E[?7h\E[>10h\E[>12h\EP1;1|3/7F\E\\, + kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kend=\E[4~, kf1=\E[17~, kf10=\E[28~, + kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, + kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khome=\E[1~, knp=\E[6~, + kpp=\E[5~, rmam=\E[?7l, + rmsc=\E[>11l\EP1**x0/11;1/13\E[m\E\\, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smam=\E[?7h, + smsc=\E[>11h\EPO**x0/65;1/67\E\\$<250>, smso=\E[7m, + smul=\E[4m, xoffc=g, xonc=e, +# +# (hp2392: copied here from hpex -- esr) +hp2392|239x series, + cols#80, + cbt=\Ei, cup=\E&a%p1%dy%p2%dC, kf1=\Ep\r, kf2=\Eq\r, + kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, + kf8=\Ew\r, khome=\Eh, kind=\EU, knp=\Eu, kpp=\Ev, kri=\EV, + rmir=\ER, rmul=\E&d@, smir=\EQ, smul=\E&dD, vpa=\E&a%p1%dY, + use=hpsub, + +hpsub|hp terminals -- capability subset, + am, da, db, mir, xhp, xon, + lines#24, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cuu1=\EA, dch1=\EP, dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, + ht=^I, if=/usr/share/tabset/stdcrt, il1=\EL, ind=^J, + is2=\E&s1A\E<\E&k0\\, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, khome=\Eh, rmkx=\E&s0A, rmso=\E&d@, + sgr0=\E&d@, smkx=\E&s1A, smso=\E&dB, + +# hpex: +# May be used for most 24 x 80 hp terminals, +# but has no padding added, so may allow runover in some terminals at high +# baud rates. Will not work for hp2640a or hp2640b terminals, hp98x6 and +# hp98x5 terminal emulators or hp98x6 consoles. +# Adds xy-cursor addressing, vertical cursor addressing, home, +# last line, and underline capabilities. +# +# (hpex: removed memory-lock capabilities ":ml=\El:mu=\Em:", +# moved here from hpsub -- esr) +hpex|hp extended capabilites, + cr=^M, cud1=^J, cup=\E&a%p1%dy%p2%dC, ht=^I, ind=^J, kbs=^H, + kcub1=^H, kcud1=^J, nel=^M^J, rmir=\ER, rmul=\E&d@, smir=\EQ, + smul=\E&dD, vpa=\E&a%p1%dY, use=hpsub, + +# From: Ville Sulko , 05 Aug 1996 +hp2|hpex2|hewlett-packard extended capabilities newer version, + am, da, db, mir, xhp, + cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, xmc#0, + bel=^G, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, + dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, + il1=\EL, ind=^J, kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, + ked=\EJ, kel=\EK, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, + kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, khts=\E1, kich1=\EQ, + kil1=\EL, kind=\ES, kll=\EF, knp=\EU, kpp=\EV, kri=\ET, + krmir=\ER, ktbc=\E3, meml=\El, memu=\Em, + pfkey=\E&f%p1%dk%p2%l%dL%p2%s, + pfloc=\E&f1a%p1%dk%p2%l%dL%p2%s, + pfx=\E&f2a%p1%dk%p2%l%dL%p2%s, + pln=\E&f%p1%dk%p2%l%dd0L%p2%s, rmir=\ER, rmkx=\E&s0A, + rmln=\E&j@, rmso=\E&d@, rmul=\E&d@, + sgr=\E&d%?%p7%t%{115}%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+ + %p5%{8}%*%+%{64}%+%c%?%p9%t%'\016'%c%e%'\017'%c%;, + sgr0=\E&d@, smir=\EQ, smkx=\E&s1A, smln=\E&jB, smso=\E&dB, + smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, + +# HP 236 console +# From: +hp236|hp236 internal terminal emulator, + OTbs, am, + cols#80, lines#24, + clear=\EF, cnorm=\EDE, cub1=^H, + cup=\EE%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, cvvis=\EDB, + dch1=\EJ, dl1=\EH, el=\EK, ich1=\EI, il1=\EG, rmso=\ECI, + sgr0=\ECI, smso=\EBI, + +# This works on a hp300 console running Utah 4.3 BSD +# From: Craig Leres +hp300h|HP Catseye console, + OTbs, am, da, db, mir, xhp, + cols#128, lines#51, lm#0, xmc#0, + bel=^G, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, + dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, + if=/usr/share/tabset/stdcrt, il1=\EL, ind=^J, kbs=^H, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\Eh, + rmir=\ER, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, sgr0=\E&d@, + smir=\EQ, smkx=\E&s1A, smso=\E&dB, smul=\E&dD, tbc=\E3, + vpa=\E&a%p1%dY, +# From: Greg Couch +hp9837|hp98720|hp98721|HP 9000/300 workstations, + OTbs, am, da, db, mir, xhp, + cols#128, it#8, lines#46, lm#0, + bel=^G, cbt=\Ei, clear=\E&a0y0C\EJ, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, + dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, + il1=\EL, ind=^J, is2=\E&v0m1b0i&j@, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, + ked=\EJ, kel=\EK, khome=\Eh, kich1=\EQ, kil1=\EL, knp=\EU, + kpp=\EV, rmir=\ER, rmkx=\E&s0A, rmso=\E&v0S, rmul=\E&d@, + sgr0=\E&d@, smir=\EQ, smkx=\E&s1A, smso=\E&v5S, smul=\E&dD, + tbc=\E3, vpa=\E&a%p1%dY, +# HP 9845 desktop computer from BRL +# (hp9845: removed unknown capability :gu: -- esr) +hp9845|HP 9845, + OTbs, am, da, db, eo, mir, xhp, + cols#80, lines#21, + OTbc=\ED, clear=\EH\EJ, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\E&a%p2%2dc%p1%2dY, cuu1=\EA, dch1=\EP, dl1=\EM, + ed=\EJ, el=\EK, if=/usr/share/tabset/std, il1=\EL, + rmir=\ER, rmso=\E&d@, smir=\EQ, smso=\E&dB, +# From: Charles A. Finnell of MITRE , developed 07SEP90 +# (hp98550: replaced /usr/share/tabset/9837 with std because ,; +# added empty to avoid warnings re / --esr) +hp98550|hp98550a|HP 9000 Series 300 color console, + OTbs, am, da, db, mir, xhp, + cols#128, it#8, lines#49, lm#0, + acsc=, bel=^G, blink=\E&dA, bold=\E&dJ, cbt=\Ei, civis=\E*dR, + clear=\EH\EJ, cnorm=\E*dQ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\E&a%p1%dy%p2%dC, cuu1=\EA, dch1=\EP, dim=\E&dH, + dl1=\EM, ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=^I, hts=\E1, + if=/usr/share/tabset/std, il1=\EL, ind=^J, invis=\E&ds, + kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, ked=\EJ, kel=\EK, kf1=\Ep, + kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, + khome=\Eh, khts=\E1, kich1=\EQ, kil1=\EL, kind=\ES, kll=\EF, + knp=\EU, kpp=\EV, kri=\ET, krmir=\ER, ktbc=\E3, rev=\E&dJ, + rmacs=^O, rmir=\ER, rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, + sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smso=\E&dJ, + smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, +# From: Victor Duchovni +# (hp700-wy: removed obsolete ":nl=^J:"; +# replaced /usr/share/tabset/hp700-wy with std because , -- esr) +hp700-wy|HP700/41 emulating wyse30, + OTbs, am, bw, mir, msgr, + cols#80, it#8, lines#24, xmc#1, + cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET$<10/>, home=^^, ht=^I, hts=\E1, + if=/usr/share/tabset/stdcrt, il1=\EE$<0.7*/>, + is1=\E~"\EC\Er\E(\EG0\003\E`9\E`1, kbs=\177, kcbt=\EI, + kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, ked=\EY, + kel=\ET, khome=^^, khts=\EI, kich1=\Eq, krmir=\Er, ll=^^^K, + ri=\Ej, rmir=\Er, rmso=\EG0$<10/>, rmul=\EG0$<10/>, + sgr0=\EG0$<10/>, smir=\Eq, smso=\EG4$<10/>, + smul=\EG8$<10/>, tbc=\E0, vpa=\E[%p1%{32}%+%c, +hp70092|hp70092a|hp70092A|HP 700/92, + am, da, db, xhp, + cols#80, lh#2, lines#24, lm#0, lw#8, nlab#8, + acsc=0cjgktlrmfn/q\,t5u6v8w7x., bel=^G, blink=\E&dA, + bold=\E&dB, cbt=\Ei, clear=\E&a0y0C\EJ, cr=^M, cub1=^H, + cud1=\EB, cuf1=\EC, cup=\E&a%p1%dy%p2%dC, cuu1=\EA, + dch1=\EP, dim=\E&dH, dl1=\EM, el=\EK, hpa=\E&a%p1%dC, ht=^I, + hts=\E1, il1=\EL, kbs=^H, kclr=\EJ, kctab=\E2, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\EP, kdl1=\EM, + ked=\EJ, kel=\EK, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, + kf6=\Eu, kf7=\Ev, kf8=\Ew, khome=\Eh, khts=\E1, kich1=\EQ, + kil1=\EL, kind=\ES, kll=\EF, knp=\EU, kpp=\EV, kri=\ET, + krmir=\ER, ktbc=\E3, rev=\E&dB, ri=\ET, rmacs=^O, rmir=\ER, + rmkx=\E&s0A, rmln=\E&j@, rmso=\E&d@, rmul=\E&d@, + sgr0=\E&d@, smacs=^N, smir=\EQ, smkx=\E&s1A, smln=\E&jB, + smso=\E&dJ, smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, + +bobcat|sbobcat|HP 9000 model 300 console, + am, da, db, mir, xhp, + cols#128, it#8, lines#47, xmc#0, + cbt=\Ei, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\E&a%p1%dy%p2%dC$<6/>, cuu1=\EA, dch1=\EP, + dl1=\EM$<10*/>, ed=\EJ, el=\EK, hpa=\E&a%p1%dC$<6/>, ht=^I, + il1=\EL$<10*/>, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, khome=\Eh, nel=^M^J, rmir=\ER, + rmkx=\E&s0A, rmso=\E&d@, rmul=\E&d@, sgr0=\E&d@, smir=\EQ, + smkx=\E&s1A, smso=\E&dB, smul=\E&dD, vpa=\E&a%p1%dY$<6/>, +gator-t|HP 9000 model 237 emulating extra-tall AAA, + lines#94, use=gator, +gator|HP 9000 model 237 emulating AAA, + bw, km, mir, ul, + cols#128, it#8, lines#47, + bel=^G, cbt=\E[Z, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, + dch=\E[%p1%dP$<4/>, dch1=\E[P, dl=\E[%p1%dM$<1*/>, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, hpa=\E[%i%p1%d`, + ht=^I, ich=\E[%p1%d@$<4/>, ich1=\E[@, il=\E[%p1%dL$<1*/>, + il1=\E[L, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, + rep=%p1%c\E[%p2%db$<1*/>, rev=\E[7m, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, +gator-52|HP 9000 model 237 emulating VT52, + cols#128, lines#47, use=vt52, +gator-52t|HP 9000 model 237 emulating extra-tall VT52, + lines#94, use=gator-52, + +#### Honeywell-Bull +# +# From: Michael Haardt 11 Jan 93 +# + +# Honeywell Bull terminal. Its cursor and function keys send single +# control characters and it has standout/underline glitch. Most programs +# do not like these features/bugs. Visual bell is realized by flashing the +# "keyboard locked" LED. +dku7003-dumb|Honeywell Bull DKU 7003 dumb mode, + cols#80, lines#25, + clear=^]^_, cr=^M, cub1=^Y, cud1=^K, cuf1=^X, + cup=\E[%i%p1%d;%p2%dH, cuu1=^Z, ed=^_, el=\E[K, + flash=\E[2h\E[2l, home=^], ht=^I, ind=^J, kbs=^H, kcub1=^Y, + kcud1=^K, kcuf1=^X, kcuu1=^Z, khome=^], nel=^M^J, +dku7003|Honeywell Bull DKU 7003 all features described, + msgr, + xmc#1, + blink=\E[5m, bold=\E[7m, dim=\E[2m, rev=\E[7m, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, + use=dku7003-dumb, + +#### Lear-Siegler (adm) +# +# These guys are long since out of the terminals business, but +# in 1995 many current terminals still have an adm type as one of their +# emulations (usually their stupidest, and usually labeled adm3, though +# these `adm3' emulations normally have adm3a+ capabilities). +# +# WARNING: Some early ADM terminals (including the ADM3 and ADM5) had a +# `diagnostic feature' that sending them a ^G while pin 22 (`Ring Indicator') +# was being held to ground would trigger a send of the top line on the screen. +# A quick fix might be to drop back to a cheesy 4-wire cable with pin 22 +# hanging in the air. (Thanks to Eric Fischer, , +# for clearing up this point.) + +adm1a|adm1|lsi adm1a, + am, + cols#80, lines#24, + bel=^G, clear=\E;$<1>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, home=^^, + ind=^J, +adm2|lsi adm2, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, ich1=\EQ, il1=\EE, ind=^J, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, +# (adm3: removed obsolete ":ma=^K^P:" -- esr) +adm3|lsi adm3, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, ind=^J, +# The following ADM-3A switch settings are assumed for normal operation: +# SPACE U/L_DISP CLR_SCRN 24_LINE +# CUR_CTL LC_EN AUTO_NL FDX +# Other switches may be set for operator convenience or communication +# requirements. I recommend +# DISABLE_KB_LOCK LOCAL_OFF 103 202_OFF +# ETX_OFF EOT_OFF +# Most of these terminals required an option ROM to support lower case display. +# Open the case and look at the motherboard; if you see an open 24-pin DIP +# socket, you may be out of luck. +# +# (adm3a: some capabilities merged in from BRl entry -- esr) +adm3a|lsi adm3a, + OTbs, am, + cols#80, lines#24, + OTma=^K^P, OTnl=^J, bel=^G, clear=\032$<1/>, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, home=^^, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, rs2=^N, +adm3a+|adm3a plus, + kbs=^H, use=adm3a, +# (adm5: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" & duplicate ":do=^J:" -- esr) +adm5|lsi adm5, + xmc#1, + bel=^G, cr=^M, cud1=^J, ed=\EY, el=\ET, kbs=^H, khome=^^, + rmso=\EG, smso=\EG, use=adm3a+, +# A lot of terminals other than adm11s use these. Wherever you see +# use=adm+sgr with some of its capabilities disabled, try the +# disabled ones. They may well work but not have been documented or +# expressed in the using entry. We'd like to cook up an but the +# / sequences of the using entries vary too much. +adm+sgr|adm style highlight capabilities, + invis=\EG1, rev=\EG4, rmso=\EG0, rmul=\EG0, sgr0=\EG0, + smso=\EG4, smul=\EG8, +# LSI ADM-11 from George William Hartwig, Jr. via BRL +# Status line additions from Stephen J. Muir +# from . could also +# be ^Z, according to his entry. +# (adm11: =\EG4 was obviously erroneous because it also said +# =\EG4. Looking at other ADMs confirms this -- esr) +adm11|LSI ADM-11, + OTbs, am, hs, + OTkn#8, cols#80, lines#24, + OTnl=^J, bel=^G, blink=\EG2, clear=\E*, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, dsl=\Eh, ed=\EY, el=\ET, fsl=\E(\r, home=^^, ht=^I, + kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, khome=^^, nel=^M^J, tsl=\EF\E), + use=adm+sgr, +# From: Andrew Scott Beals +# Corrected by Olaf Siebert , 11 May 1995 +# Supervisor mode info by Ari Wuolle, , 27 Aug 1996 +# (adm12: removed obsolete ":kn:ma=j^Jk^P^K^Pl ^R^L^L :". This formerly had +# =\Eq but that looked wrong; this is from Dave Yost +# via BRL. That entry asserted , but I've left that out because +# neither earlier nor later ADMSs have it -- esr) +# +# You will need to get into the supervisor setup before you can set +# baudrate etc. for your ADM-12+. Press Shift-Ctrl-Setup and you should +# see a lot more setup options. +# +# While in supervisor setup you can also use following codes: +# +# Ctrl-P Personality character selections (configure for example what +# arrow keys send, if I recall correctly) +# Ctrl-T tabs 1-80 use left&right to move and up to set and +# Ctrl-V tabs 81-158 down to clear tab. Shift-Ctrl-M sets right margin at cursor +# Ctrl-B Binary setup (probably not needed. I think that everything can +# be set using normal setup) +# Ctrl-A Answerback mode (enter answerback message) +# Ctrl-U User friendly mode (normal setup) +# Ctrl-D Defaults entire setup and function keys from EPROM tables +# Ctrl-S Save both setup and functions keys. Takes from 6 to 10 seconds. +# Ctrl-R Reads both setup and functions keys from NVM. +# Shift-Ctrl-X Unlock keyboard and cancel received X-OFF status +# +# ADM-12+ supports hardware handshaking, but it is DTR/CTS as opposed to +# RTS/CTS used nowadays with virtually every modem and computer. 19200 +# bps works fine with hardware flow control. +# +# The following null-modem cable should fix this and enable you to use +# RTS/CTS handshaking (which Linux supports, use CRTSCTS setting). Also +# set ADM-12+ for DTR handshaking from supervisor setup. +# +# PC Serial ADM-12+ +# -------- ------- +# 2 - 3 +# 3 - 2 +# 4 - 5 +# 5 - 20 +# 6,8 - 4 +# 7 - 7 +# 20 - 6,8 +# +adm12|lsi adm12, + OTbs, OTpt, am, mir, + OTug#1, cols#80, it#8, lines#24, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, hts=\E1, ich1=\EQ, il1=\EE, + is2=\E0\s\s\s\s\s\s\s\s\E1\s\s\s\s\s\s\s\s\E1\s\s\s\s\s\s\s + \s\E1\s\s\s\s\s\s\s\s\E1\s\s\s\s\s\s\s\s\E1\s\s\s\s\s\s + \s\s\E1\s\s\s\s\s\s\s\s\E1\s\s\s\s\s\s\s\s\E1, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, + kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, + kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, rmir=\Er, smir=\Eq, tbc=\E0, + use=adm+sgr, +# (adm20: removed obsolete ":kn#7:" -- esr) +adm20|lear siegler adm20, + OTbs, am, + cols#80, it#8, lines#24, + bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cuf1=^L, + cup=\E=%i%p2%{31}%+%c%p1%{31}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, ht=^I, ich1=\EQ, il1=\EE, + kf1=^A, kf2=^B, kf3=^W, kf4=^D, kf5=^E, kf6=^X, kf7=^Z, rmso=\E(, + sgr0=\E(, smso=\E), +adm21|lear siegler adm21, + xmc#1, + bel=^G, cr=^M, cud1=^J, dch1=\EW, dl1=\ER$<30*>, ed=\EY, + el=\ET, ich1=\EQ, il1=\EE$<30*>, ind=^J, invis@, kbs=^H, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, + use=adm+sgr, use=adm3a, +# (adm22: ":em=:" was an obvious typo for ":ei=:"; also, +# removed obsolete ":kn#7:ma=j^Jk^P^K^Pl ^R^L^L :"; +# removed bogus-looking \200 from before . -- esr) +adm22|lsi adm22, + OTbs, am, + cols#80, lines#24, + bel=^G, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\Ey, el=\Et, home=^^, ht=\Ei, ich1=\EQ, il1=\EE, + is2=\E%\014\014\014\016\003\0\003\002\003\002\0\0\0\0\0\0\0 + \0\0\0\0, + kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, khome=^^, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, + lf6=F6, lf7=F7, rmso=\E(, sgr0=\E(, smso=\E), +# ADM 31 DIP Switches +# +# This information comes from two versions of the manual for the +# Lear-Siegler ADM 31. +# +# Main board: +# rear of case +# +-||||-------------------------------------+ +# + S1S2 ||S + +# + ||3 + +# + + +# + ||S + +# + ||4 + +# + + +# + + +# + + +# + + +# + + +# +-+ +-+ +# + + +# + S5 S6 S7 + +# + == == == + +# +----------------------------------------------+ +# front of case (keyboard) +# +# S1 - Data Rate - Modem +# S2 - Data Rate - Printer +# ------------------------ +# Data Rate Setting +# ------------------- +# 50 0 0 0 0 +# 75 1 0 0 0 +# 110 0 1 0 0 +# 134.5 1 1 0 0 +# 150 0 0 1 0 +# 300 1 0 1 0 +# 600 0 1 1 0 +# 1200 1 1 1 0 +# 1800 0 0 0 1 +# 2000 1 0 0 1 +# 2400 0 1 0 1 +# 3600 1 1 0 1 +# 4800 0 0 1 1 +# 7200 1 0 1 1 +# 9600 0 1 1 1 +# x 1 1 1 1 +# +# S3 - Interface/Printer/Attributes +# --------------------------------- +# Printer Busy Control +# sw1 sw2 sw3 +# --------------- +# off off off Busy not active, CD disabled +# off off on Busy not active, CD enabled +# off on off Busy active on J5-20, CD disabled +# on off off Busy active on J5-19, CD disabled - Factory Set. +# on off on Busy active on J5-19, CD enabled +# +# sw4 Used in conjuction with S4 for comm interface control - Fact 0 +# +# sw5 Secondary Channel Control (Hardware implementation only) - Fact 0 +# +# sw6 ON enables printer BUSY active LOW - Factory Setting +# OFF enables printer BUSY active HIGH - If set to this, ADM31 senses +# +# sw7 ON - steady cursor - Factory Setting +# OFF - blinking cursor +# +# sw8 ON causes selected attribute character to be displayed +# OFF causes SPACE to be displayed instead - Factory Setting +# +# S4 - Interface +# -------------- +# Modem Interface +# S3 S4 S4 S4 S4 +# sw4 sw1 sw2 sw3 sw4 +# --------------------------- +# OFF ON OFF ON OFF Enable RS-232C interface, Direct Connect and +# Current Loop disabled - Factory Setting +# ON ON OFF ON OFF Enable Current Loop interface, Direct Connect +# disabled +# OFF OFF ON OFF ON Enable Direct Connect interface, RS-232C and +# Current Loop Disabled +# +# sw5 ON disables dot stretching mode - Factory Setting +# OFF enables dot stretching mode +# sw6 ON enables blanking function +# OFF enables underline function - Factory Setting +# sw7 ON causes NULLS to be displayed as NULLS +# OFF causes NULLS to be displayed as SPACES - Factory Setting +# +# S5 - Word Structure +# ------------------- +# sw1 ON enables BREAK key - Factory Setting +# OFF disables BREAK key +# sw2 ON selects 50Hz monitor refresh rate +# OFF selects 60Hz monitor refresh rate - Factory Setting +# +# Modem Port Selection +# sw3 sw4 sw5 +# --------------- +# ON ON ON Selects 7 DATA bits, even parity, 2 STOP bits +# OFF ON ON Selects 7 DATA bits, odd parity, 2 STOP bits +# ON OFF ON Selects 7 DATA bits, even parity, 1 STOP bit - Factory Set. +# OFF OFF ON Selects 7 DATA bits, odd parity, 1 STOP bit +# ON ON OFF Selects 8 DATA bits, no parity, 2 STOP bits +# OFF ON OFF Selects 8 DATA bits, no parity, 1 STOP bit +# ON OFF OFF Selects 8 DATA bits, even parity, 1 STOP bit +# OFF OFF OFF Selects 8 DATA bits, odd parity, 1 STOP bit +# +# sw6 ON sends bit 8 a 1 (mark) +# OFF sends bit 8 as 0 (space) - Factory Setting +# sw7 ON selects Block Mode +# OFF selects Conversation Mode - Factory Setting +# sw8 ON selects Full Duplex operation +# OFF selects Half Duplex operation - Factory Setting +# +# S6 - Printer +# ------------ +# sw1, sw2, sw6, sw7 Reserved - Factory 0 +# +# Printer Port Selection +# same as Modem above, bit 8 (when 8 DATA bits) is always = 0 +# +# sw8 ON enables Printer Port +# OFF disables Printer Port - Factory Setting +# +# S7 - Polling Address +# -------------------- +# sw1-7 Establish ASCII character which designates terminal polling address +# ON = logic 0 +# OFF = logic 1 - Factory Setting +# sw8 ON enables Polling Option +# OFF disables Polling Option - Factory Setting +# +# +# On some older adm31s, S4 does not exist, and S5-sw6 is not defined. +# +# This adm31 entry uses underline as the standout mode. +# If the adm31 gives you trouble with standout mode, check the DIP switch in +# position 6, bank @c11, 25% from back end of the circuit board. Should be +# OFF. If there is no such switch, you have an old adm31 and must use oadm31. +# (adm31: removed obsolete ":ma=j^Jk^P^K^Pl ^R^L^L :" -- esr) +adm31|lsi adm31 with sw6 set for underline mode, + OTbs, am, mir, + cols#80, lines#24, + bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, il1=\EE, ind=^J, is2=\Eu\E0, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, + kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, + kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, rmir=\Er, rmso=\EG0, + rmul=\EG0, sgr0=\EG0, smir=\Eq, smso=\EG1, smul=\EG1, +adm31-old|o31|old adm31, + rmul@, smso=\EG4, smul@, use=adm31, +# LSI ADM-36 from Col. George L. Sicherman via BRL +adm36|LSI ADM36, + OTbs, OTpt, + OTkn#4, + if=/usr/share/tabset/vt100, + is2=\E<\E>\E[6;?2;?7;?8h\E[4;20;?1;?3;?4;?5;?6;?18;?19l, use=vt100, +# (adm42: removed obsolete ":ma=^K^P:" -- esr) +adm42|lsi adm42, + OTbs, am, + cols#80, lines#24, + bel=^G, cbt=\EI, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + cvvis=\EC\E3 \E3(, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, ht=^I, + il1=\EE$<270>, ind=^J, invis@, ip=$<6*>, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, khome=^^, pad=\177, rmir=\Er, rmul@, + smir=\Eq, smul@, use=adm+sgr, +# The following termcap for the Lear Siegler ADM-42 leaves the +# "system line" at the bottom of the screen blank (for those who +# find it distracting otherwise) +adm42-ns|lsi adm-42 with no system line, + cbt=\EI\EF \011, clear=\E;\EF \011, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<6>\EF \011, + dch1=\EW\EF \011, dl1=\ER\EF \011, ed=\EY\EF \011, + el=\ET\EF \011, il1=\EE\EF \011, rmir=\Er\EF \011, + smir=\Eq\EF \011, use=adm42, +# ADM 1178 terminal -- rather like an ADM-42. Manual is dated March 1 1985. +# The insert mode of this terminal is commented out because it's broken for our +# purposes in that it will shift the position of every character on the page, +# not just the cursor line! +# From: Michael Driscoll 10 July 1996 +adm1178|1178|lsi adm1178, + am, + cols#80, lines#24, xmc#1, + bel=^G, bold=\E(, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + cvvis=\EC\E3 \E3(, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, + home=^^, ht=^I, il1=\EE, ind=^J, ip=$<6*/>, kbs=^H, kcub1=^H, + kcud1=^J, nel=^M^J, pad=\177, rev=\EG4, rmso=\EG0, rmul=\EG0, + sgr0=\E), smso=\EG4, smul=\EG1, + +#### Prime +# +# Yes, Prime made terminals. These entries were posted by Kevin J. Cummings +# on 14 Dec 1992 and lightly edited by esr. +# Prime merged with ComputerVision in the late 1980s; you can reach them at: +# +# ComputerVision Services +# 500 Old Connecticut Path +# Framingham, Mass. +# + +# Standout mode is dim reverse-video. +pt100|pt200|wren|fenix|prime pt100/pt200, + am, bw, mir, msgr, + cols#80, it#8, lines#24, + cbt=\E[Z, clear=\E?, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\ED, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E0%p1%{33}%+%c%p2%{33}%+%c, cuu=\E[%p1%dA, + cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl1=\E[M, + ed=\E[J\E[r, el=\E[K\E[t, flash=\E$$<200/>\E$P, + home=\E$B, ht=^I, il1=\E[L\E[t, ind=^J, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E$A, nel=^M^J, + rmcup=, rmir=\E[4l, rmkx=\E[>13l, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, + smcup=\E[>1l\E[>2l\E[>16l\E[4l\E[>9l\E[20l\E[>3l\E[>7h\E[>12 + l\E[1Q, + smir=\E[4h, smkx=\E[>13h, smso=\E[2;7m, smul=\E[4m, +pt100w|pt200w|wrenw|fenixw|prime pt100/pt200 in 132-column mode, + cols#132, + cup=\E[%i%p1%d;%p2%dH, use=pt100, +pt250|Prime PT250, + rmso@, smso@, use=pt100, +pt250w|Prime PT250 in 132-column mode, + rmso@, smso@, use=pt100w, + +#### Qume (qvt) +# +# Qume, Inc. +# 3475-A North 1st Street +# San Jose CA 95134 +# Vox: (800)-457-4447 +# Fax: (408)-473-1510 +# Net: josed@techsupp.wyse.com (Jose D'Oliveira) +# +# Qume was bought by Wyse, but still (as of early 1995) has its own support +# group and production division. +# +# Discontinued Qume models: +# +# The qvt101 and qvt102 listed here are long obsolete; so is the qvt101+ +# built to replace them, and a qvt119+ which was a 101+ with available wide +# mode (132 columns). There was a qvt103 which added vt100/vt131 emulations +# and an ANSI-compatible qvt203 that replaced it. Qume started producing +# ANSI-compatible terminals with the qvt323 and qvt61. +# +# Current Qume models (as of February 1995): +# +# All current Qume terminals have ANSI-compatible operation modes. +# Qume is still producing the qvt62, which features emulations for other +# popular lines such as ADDS, and dual-host capabilities. The qvt82 is +# designed for use as a SCO ANSI terminal. The qvt70 is a color terminal +# with many emulations including Wyse370, Wyse 325, etc. Their newest +# model is the qvt520, which is vt420-compatible. +# +# There are some ancient printing Qume terminals under `Daisy Wheel Printers' +# +# If you inherit a Qume without docs, try Ctrl-Shift-Setup to enter its +# setup mode. Shift-s should be a configuration save to NVRAM. + +qvt101|qvt108|qume qvt 101 and QVT 108, + xmc#1, use=qvt101+, + +# This used to have but no or . The BSD termcap +# file had . I've done the safe thing and yanked +# both. The is from BSD, which also claimed bold=\E( and dim=\E). +# What seems to be going on here is that this entry was designed so that +# the normal highlight is bold and standout is dim plus something else +# (reverse-video maybe? But then, are there two sequences?) +# +# Added kdch1, kil1, kdl1 based on screenshot -TD: +# http://www.vintagecomputer.net/qume/qvt-108/qume_qvt-108_keyboard.jpg +qvt101+|qvt101p|qume qvt 101 PLUS product, + am, bw, hs, ul, + cols#80, lines#24, xmc#0, + bel=^G, cbt=\EI, clear=^Z, cnorm=\E.4, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dl1=\ER, dsl=\Eg\Ef\r, ed=\EY, el=\ET, + flash=\Eb$<200>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, + ich1=\EQ, il1=\EE, ind=^J, invis@, kbs=^H, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, kf3=^AB\r, + kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, + kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, mc4=\EA, mc5=\E@, + rmso=\E(, smso=\E0P\E), tbc=\E3, tsl=\Eg\Ef, use=adm+sgr, +qvt102|qume qvt 102, + cnorm=\E., use=qvt101, +# (qvt103: added / based on init string -- esr) +qvt103|qume qvt 103, + am, xenl, xon, + cols#80, it#8, lines#24, vt#3, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[2J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, home=\E[H, ht=^I, + hts=\EH, ind=^J, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, + rev=\E[7m$<2>, ri=\EM$<5>, rmam=\E[?7l, rmkx=\E[?1l\E>, + rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + %;m$<2>, + sgr0=\E[m$<2>, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, +qvt103-w|qume qvt103 132 cols, + cols#132, lines#24, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=qvt103, +qvt119+|qvt119p|qvt119|qume qvt 119 and 119PLUS terminals, + am, hs, mir, msgr, + cols#80, lines#24, xmc#0, + bel=^G, cbt=\EI, clear=\E*1, cnorm=\E.4, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, cvvis=\E.2, dch1=\EW, dl1=\ER, dsl=\Eg\Ef\r, ed=\Ey, + el=\Et, flash=\En0$<200>\En1, fsl=^M, home=^^, ht=^I, + hts=\E1, il1=\EE, ind=^J, is2=\EDF\EC\EG0\Er\E(\E%EX, + kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^AI\r, + kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + mc4=\EA, mc5=\E@, ri=\EJ, rmir=\Er, smir=\Eq, smul=\EG8, + tbc=\E3, tsl=\Eg\Ef, use=adm+sgr, +qvt119+-25|qvt119p-25|QVT 119 PLUS with 25 data lines, + lines#25, use=qvt119+, +qvt119+-w|qvt119p-w|qvt119-w|QVT 119 and 119 PLUS in 132 column mode, + cols#132, + is2=\EDF\EC\EG0\Er\E(\E%\EX\En4, use=qvt119+, +qvt119+-25-w|qvt119p-25-w|qvt119-25-w|QVT 119 and 119 PLUS 132 by 25, + lines#25, use=qvt119+, +qvt203|qvt203+|qume qvt 203 Plus, + dch1=\E[P$<7>, dl1=\E[M$<99>, il1=\E[L$<99>, ind=\n$<30>, + ip=$<7>, kf0=\E[29~, kf1=\E[17~, kf2=\E[18~, kf3=\E[19~, + kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, + kf9=\E[28~, rmir=\E[4l, smir=\E[4h, use=qvt103, +qvt203-w|qvt203-w-am|qume qvt 203 PLUS in 132 cols (w/advanced video), + cols#132, lines#24, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?8h, use=qvt203, +# +# Since a command is present for enabling 25 data lines, +# a specific terminfo entry may be generated for the 203. +# If one is desired for the QVT 119 PLUS then 25 lines must +# be selected in the status line (setup line 9). +# +qvt203-25|QVT 203 PLUS with 25 by 80 column mode, + cols#80, lines#25, + is2=\E[=40h\E[?3l, use=qvt203, +qvt203-25-w|QVT 203 PLUS with 25 by 132 columns, + cols#132, lines#25, + rs2=\E[?3h\E[=40h, use=qvt203, + +#### Televideo (tvi) +# +# TeleVideo +# 550 East Brokaw Road +# PO Box 49048 95161 +# San Jose CA 95112 +# Vox: (408)-954-8333 +# Fax: (408)-954-0623 +# +# +# These require incredible amounts of padding. +# +# All of these terminals (912 to 970 and the tvipt) are discontinued. Newer +# Televideo terminals are ANSI and PC-ANSI compatible. + +tvi803|televideo 803, + clear=\E*$<10>, use=tvi950, + +# Vanilla tvi910 -- W. Gish 10/29/86 +# Switch settings are: +# +# S1 1 2 3 4 +# D D D D 9600 +# D D D U 50 +# D D U D 75 +# D D U U 110 +# D U D D 135 +# D U D U 150 +# D U U D 300 +# D U U U 600 +# U D D D 1200 +# U D D U 1800 +# U D U D 2400 +# U D U U 3600 +# U U D D 4800 +# U U D U 7200 +# U U U D 9600 +# U U U U 19200 +# +# S1 5 6 7 8 +# U D X D 7N1 (data bits, parity, stop bits) (X means ignored) +# U D X U 7N2 +# U U D D 7O1 +# U U D U 7O2 +# U U U D 7E1 +# U U U U 7E2 +# D D X D 8N1 +# D D X U 8N2 +# D U D D 8O1 +# D U U U 8E2 +# +# S1 9 Autowrap +# U on +# D off +# +# S1 10 CR/LF +# U do CR/LF when CR received +# D do CR when CR received +# +# S2 1 Mode +# U block +# D conversational +# +# S2 2 Duplex +# U half +# D full +# +# S2 3 Hertz +# U 50 +# D 60 +# +# S2 4 Edit mode +# U local +# D duplex +# +# S2 5 Cursor type +# U underline +# D block +# +# S2 6 Cursor down key +# U send ^J +# D send ^V +# +# S2 7 Screen colour +# U green on black +# D black on green +# +# S2 8 DSR status (pin 6) +# U disconnected +# D connected +# +# S2 9 DCD status (pin 8) +# U disconnected +# D duplex +# +# S2 10 DTR status (pin 20) +# U disconnected +# D duplex +# (tvi910: removed obsolete ":ma=^Kk^Ll^R^L:"; added , , , +# , , , , from SCO entry -- esr) +tvi910|televideo model 910, + OTbs, am, msgr, + cols#80, it#8, lines#24, xmc#1, + bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EY, el=\ET, + home=\E=\001\001, hpa=\E]%p1%{32}%+%c, ht=^I, + if=/usr/share/tabset/stdcrt, ind=^J, invis@, kbs=^H, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kf0=^AI\r, kf1=^A@\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + vpa=\E[%p1%{32}%+%c, use=adm+sgr, +# From: Alan R. Rogers +# as subsequently hacked over by someone at SCO +# (tvi910+: removed obsolete ":ma=^K^P^L :" -- esr) +# +# Here are the 910+'s DIP switches (U = up, D = down, X = don't care): +# +# S1 1 2 3 4: +# D D D D 9600 D D D U 50 D D U D 75 D D U U 110 +# D U D D 135 D U D U 150 D U U D 300 D U U U 600 +# U D D D 1200 U D D U 1800 U D U D 2400 U D U U 3600 +# U U D D 4800 U U D U 7200 U U U D 9600 U U U U 19200 +# +# S1 5 6 7 8: +# U D X D 7N1 U D X U 7N2 U U D D 7O1 U U D U 7O2 +# U U U D 7E1 U U U U 7E2 D D X D 8N1 D D X U 8N2 +# D U D D 8O1 D U U U 8E2 +# +# S1 9 Autowrap (U = on, D = off) +# S1 10 CR/LF (U = CR/LF on CR received, D = CR on CR received) +# S2 1 Mode (U = block, D = conversational) +# S2 2 Duplex (U = half, D = full) +# S2 3 Hertz (U = 50, D = 60) +# S2 4 Edit mode (U = local, D = duplex) +# S2 5 Cursor type (U = underline, D = block) +# S2 6 Cursor down key (U = send ^J, D = send ^V) +# S2 7 Screen colour (U = green on black, D = black on green) +# S2 8 DSR status (pin 6) (U = disconnected, D = connected) +# S2 9 DCD status (pin 8) (U = disconnected, D = connected) +# S2 10 DTR status (pin 20) (U = disconnected, D = connected) +# +tvi910+|televideo 910+, + dch1=\EW, dl1=\ER$<33*>, home=^^, ich1=\EQ, il1=\EE$<33*>, + kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, + kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, + ll=\E=7\s, use=tvi910, + +# (tvi912: removed obsolete ":ma=^K^P^L :", added and +# from BRL entry -- esr) +tvi912|tvi914|tvi920|old televideo 912/914/920, + OTbs, OTpt, am, msgr, + cols#80, it#8, lines#24, xmc#1, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER$<33*>, ed=\Ey, el=\ET, flash=\Eb$<50/>\Ed, home=^^, + ht=^I, hts=\E1, ich1=\EQ, if=/usr/share/tabset/stdcrt, + il1=\EE$<33*>, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, + kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, + kf9=^AH\r, khome=^^, rmso=\Ek, rmul=\Em, smso=\Ej, smul=\El, + tbc=\E3, +# We got some new tvi912c terminals that act really weird on the regular +# termcap, so one of our gurus worked this up. Seems that cursor +# addressing is broken. +tvi912cc|tvi912 at cowell college, + cup@, use=tvi912c, + +# tvi{912,920}[bc] - TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C +# From: Benjamin C. W. Sittler +# +# Someone has put a scanned copy of the manual online at: +# http://vt100.net/televideo/912b-om/ +# +# These terminals were produced ca. 1979, and had a 12" monochrome +# screen, supported 75-9600 baud (no handshaking), monochrome, 7-bit +# ASCII, and were generally similar to adm3a but with attributes +# (including some with magic cookies), fancy half-duplex mode, and +# different bugs. +# +# Some operations reqire truly incredible amounts of padding. The +# insert_line () and delete_line () operations in particular +# are so slow as to be nearly unusable. +# +# There may or may not have been a separate, earlier series of 912/920 +# terminals (without the "B" and "C" suffix); I have never seen one, +# and the manual only describes the "B" and "C" series. The 912 and 920 +# are quite distinct from the 914 and 924, which were much nicer non- +# magic-cookie terminals similar to the 950. +# +# This is a new description for the following TeleVideo terminals, +# distinguished chiefly by their keyboards: +# +# TVI-912B - very odd layout, no function keys (84 keys) +# TVI-920B - typewriter layout, no function keys (103 keys) +# TVI-912C - very odd layout, function keys F1-F11 (82 keys) +# TVI-920C - typewriter layout, function keys F1-F11 (101 keys) +# +# To choose a setting for the TERM variable, start with the model: +# +# Model || base name +# ----------||----------- +# TVI-912B || tvi912b +# TVI-912C || tvi912c +# TVI-920B || tvi920b +# TVI-920C || tvi920c +# +# Then add a suffix from the following table describing installed options +# and how you'd like to use the terminal: +# +# Use Video | Second | Visual | Magic | Page || feature +# Attributes | Page | Bell | Cookies | Print || suffix +# ------------|--------|--------|---------|-------||--------- +# No | No | N/A | N/A | No || -unk +# No | No | N/A | N/A | Yes || -p +# No | Yes | No | N/A | No || -2p-unk +# No | Yes | No | N/A | Yes || -2p-p +# No | Yes | Yes | N/A | No || -vb-unk +# No | Yes | Yes | N/A | Yes || -vb-p +# Yes | No | N/A | No | N/A || +# Yes | No | N/A | Yes | N/A || -mc +# Yes | Yes | No | No | N/A || -2p +# Yes | Yes | No | Yes | N/A || -2p-mc +# Yes | Yes | Yes | No | N/A || -vb +# Yes | Yes | Yes | Yes | N/A || -vb-mc +# +# So e.g. a model 920 C with second page memory option, visual bell +# and no magic cookies would be tvi920c-vb; a model 912 B without the +# second page memory option and using magic cookies would be +# tvi912b-mc +# +# PADDING +# +# At 9600 baud, the terminal is prone to overflow its input buffer +# during complex operations (insert/delete +# character/line/screen/page), and it does not signal this over the +# RS232 cable. The typical symptom of an overrun is that the terminal +# starts beeping, and output becomes garbled. +# +# The padding delays in this terminfo were derived using tack(1) +# running on a Linux box connected to a TVI-920C with a later-model +# (A49C1-style) ROM running at 9600 baud, so your mileage may +# vary. The numbers below seem to give the terminal enough time so +# that it doesn't overflow its input buffer and start losing +# characters. +# +# KEYS +# +# If you want to use the FUNCT key on a tvi912[bc], use the +# corresponding tvi920[bc] terminfo with FUNCT + ... equivalents from +# the following table (these also work on the 920 series): +# +# Unshifted Function Keys: +# +# Key | capname|| Equivalent +# -----|--------||------------ +# F1 | || FUNCT + @ +# F2 | || FUNCT + A +# F3 | || FUNCT + B +# F4 | || FUNCT + C +# F5 | || FUNCT + D +# F6 | || FUNCT + E +# F7 | || FUNCT + F +# F8 | || FUNCT + G +# F9 | || FUNCT + H +# F10 | || FUNCT + I +# F11 | || FUNCT + J +# +# Shifted Function Keys: +# +# SHIFT + Key | capname|| Equivalent +# -------------|--------||------------ +# SHIFT + F1 | || FUNCT + ` +# SHIFT + F2 | || FUNCT + a +# SHIFT + F3 | || FUNCT + b +# SHIFT + F4 | || FUNCT + c +# SHIFT + F5 | || FUNCT + d +# SHIFT + F6 | || FUNCT + e +# SHIFT + F7 | || FUNCT + f +# SHIFT + F8 | || FUNCT + g +# SHIFT + F9 | || FUNCT + h +# SHIFT + F10 | || FUNCT + i +# SHIFT + F11 | || FUNCT + j +# +# PORTS AND SWITCH SETTINGS +# +# Here are the switch settings for the TVI-912B/TVI-920B and +# TVI-912C/TVI-920C: +# +# S1 (Line), and S3 (Printer) baud rates -- put one, and only one, switch down: +# 2: 9600 3: 4800 4: 2400 5: 1200 +# 6: 600 7: 300 8: 150 9: 75 +# 10: 110 +# +# S2 UART/Terminal options: +# Up Down +# 1: Not used Not allowed +# 2: Alternate character set Standard character set +# 3: Full duplex Half duplex +# 4: 50 Hz refresh 60 Hz refresh +# 5: No parity Send parity +# 6: 2 stop bits 1 stop bit +# 7: 8 data bits 7 data bits +# 8: Not used Not allowed on Rev E or lower +# 9: Even parity Odd parity +# 10: Steady cursor Blinking cursor +# (On Rev E or lower, use W25 instead of switch 10.) +# +# S5 UART/Terminal options: +# Open Closed +# 1: P3-6 Not connected DSR received on P3-6 +# 2: P3-8 Not connected DCD received on P3-8 +# +# 3 Open, 4 Open: P3-20 Not connected +# 3 Open, 4 Closed: DTR on when terminal is on +# 3 Closed, 4 Open: DTR is connected to RTS +# 3 Closed, 4 Closed: Not allowed +# +# 5 Closed: HDX printer (hardware control) Rev. K with extension port off, +# all data transmitted out of the modem port (P3) will also be +# transmitted out of the printer port (P4). +# +# 6 Open, 7 Open: Not allowed +# 6 Open, 7 Closed: 20ma current loop input +# 6 Closed, 7 Open: RS232 input +# 6 Closed, 7 Closed: Not allowed +# +# Jumper options: +# If the jumper is installed, the effect will occur (the next time the terminal +# is switched on). +# +# S4/W31: Enables automatic LF upon receipt of CR from +# remote or keyboard. +# S4/W32: Enables transmission of EOT at the end of Send. If not +# installed, a carriage return is sent. +# S4/W33: Disables automatic carriage return in column 80. +# S4/W34: Selects Page Print Mode as initial condition. If not +# installed, Extension Mode is selected. +# +# NON-STANDARD CAPABILITIES +# +# Sending or returns a cursor position report in the format +# YX\r, where Y and X are as in . This format is described in +# and , but it's not clear how one should write an +# appropriate scanf string, since we need to subtract %' ' from the +# character after reading it. The capability is used by tack(1) +# to synchronize during padding tests, and seems to work for that +# purpose. +# +# This description also includes the obsolete termcap capabilities +# has_hardware_tabs () and backspaces_with_bs (). +# +# FEATURES NOT YET DESCRIBED IN THIS TERMINFO +# +# The FUNCT modifier actually works with every normal key by sending +# ^AX\r, where X is the sequence normally sent by that key. This is a +# sort of meta key not currently describable in terminfo. +# +# There are quite a few other keys (especially on the 920 models,) but +# they are for the most part only useful in block mode. +# +# These terminals have lots of forms manipulation features, mainly +# useful in block mode, including "clear X to nulls" (vs. "clear X to +# spaces"; nulls are sentinels for "send X" operations); "send X" +# operations for uploading all or part of the screen; and block-mode +# editing keys (they don't send escape sequences, but manipulate video +# memory directly). Block mode is used for local editing, and protect +# mode (in conjunction with the "write protect" attribute, +# a.k.a. half-intensity outside of protect mode) is used to control +# which parts of the screen are edited/sent/printed (by ). +# +# There are at least two major families of ROM, "early" and +# A49B1/A49C1; the major difference seems to be that the latter ROMs +# support a few extra escape sequences for manipulating the off-screen +# memory page, and for sending whole pages back to the host (mainly +# useful in block mode.) The descriptions in this file don't use any +# of those sequences: set cursor position including page (\E-PYX, +# where P is \s for page 0 and ! for page 1 [actually only the LSB of +# P is taken into account, so e.g. 0 and 1 work too,] and Y and X are +# as in ); read cursor position (\E/), which is analogous to +# and returns PYX\r, where P is \s for page 0 or ! for page 1, and YX +# are as in , and some "send page" features mainly useful for +# forms manipulation. +# +# The keyboard enable (\E") and disable (\E#) sequences are unused, +# except that a terminal reset () enables the keyboard. +# +# Auto-flip mode (\Ev) is likely faster than the scrolling mode (\Ew) +# enabled in , but auto-flip is very jarring so we don't use it. +# +# BUGS +# +# At least up to the A49B1 and A49C1 ROMs, there are no \Eb and \Ed +# sequences (I infer that in some TeleVideo terminal they may invert +# and uninvert the display) so the sequence given here is a +# cheesy page-flip instead. +# +# The back_tab () sequence (\EI) doesn't work according to +# tack(1), so it is not included in the descriptions below. +# +# It's not clear whether auto_left_margin () flag should be set +# for these terminals; tack says yes, so it is set here, but this +# differs from other descriptions I've seen. +# +# Extension print mode () echoes all characters to the printer +# port [in addition to displaying them] except for the page print mode +# sequence (); this is a slight violation of the terminfo +# definition for but I don't expect it to cause problems. We +# reset to page print mode in since it may have been enabled +# accidentally. +# +# The descriptions with plus signs (+) are building blocks. + +tvi912b-unk|tvi912c-unk|TeleVideo TVI-912B or TVI-912C (no attributes), + OTbs, OTpt, am, bw, + cols#80, it#8, lines#24, + bel=^G, clear=\032$<50>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%' '%+%c%p2%' '%+%c, cuu1=^K, dch1=\EW$<30>, + dl1=\ER$<1*>$<100>, ed=\Ey$<2*>$<10>, el=\ET$<15>, + home=^^, ht=^I, hts=\E1, ich1=\EQ$<30>, + if=/usr/share/tabset/stdcrt, il1=\EE$<1*>$<100>, + ind=\n$<10>, is2=\Ew\EA\E'\E"\E(, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, kdch1=\177, kent=^M, khome=^^, mc4=\EA, + mc5=\E@, rs1=\Ek\010\Em\010\Eq\032, tbc=\E3, u6=%c%c\r, + u7=\E?, u8=%c%c\r, u9=\E?, + +# This isn't included in the basic capabilities because it is +# typically unusable in combination with the full range of video +# attributes, since the magic cookie attributes turn into ASCII +# control characters, and the half-intensity ("protected") attribute +# converts all affected characters to spaces. + +tvi912b+printer|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C page print support, + mc0=\EP, + +# This uses half-intensity mode () for standout (), and +# exposes no other attributes (half-intensity is the only attribute +# that does not generate a magic cookie.) + +tvi912b+dim|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C half-intensity attribute support, + msgr, + dim=\E), rmso=\E(, sgr=\E%?%p1%p5%|%t)%e(%;, sgr0=\E(, + smso=\E), + +# Full magic-cookie attribute support, with half-intensity reverse +# video for standout. Note that we add a space in the sequence +# to give a consistent magic-cookie count. Also note that uses +# backspacing (in the TVI-supported order) to apply all requested +# attributes with only a single magic cookie. + +tvi912b+mc|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C full magic-cookie attribute support, + xmc#1, + blink=\E\^, dim=\E)\s, invis=\E_, rev=\Ej, rmso=\E(\Ek, + rmul=\Em, + sgr=\E%?%p1%p5%|%t)%e(%;\s\010\E%?%p1%p3%|%tj%ek%;\010\E%? + %p2%tl%em%;\010\E%?%p7%t_%e%?%p4%t\^%eq%;%;, + sgr0=\E(\Ek\010\Em\010\Eq, smso=\E)\Ej, smul=\El, + +# This uses the second page memory option to save & restore screen +# contents. If your terminal is missing the option, this description +# should still work, but that has not been tested. + +tvi912b+2p|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C second page memory option support, + flash=\EK$<100>\EK, rmcup=\032$<50>\EK\E=7\s, + smcup=\EK\032$<50>\E(\Ek\010\Em\010\Eq\032$<50>, + +# This simulates flashing by briefly toggling to the other page +# (kludge!) + +tvi912b+vb|TeleVideo TVI-912B/TVI-920B and TVI-912C/TVI-920C second page memory option "visible bell" support, + bel=\EK$<100>\EK, use=tvi912b+2p, + +# Function keys ( .. are shifted .. ) + +tvi920b+fn|TeleVideo TVI-920B and TVI-920C function key support, + kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^A`\r, kf13=^Aa\r, + kf14=^Ab\r, kf15=^Ac\r, kf16=^Ad\r, kf17=^Ae\r, kf18=^Af\r, + kf19=^Ag\r, kf2=^AA\r, kf20=^Ah\r, kf21=^Ai\r, kf22=^Aj\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, + +# Combinations of the basic building blocks + +tvi912b-2p-unk|tvi912c-2p-unk|tvi912b-unk-2p|tvi912c-unk-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; no attributes), + use=tvi912b+2p, use=tvi912b-unk, + +tvi912b-vb-unk|tvi912c-vb-unk|tvi912b-unk-vb|tvi912c-unk-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; no attributes), + use=tvi912b+vb, use=tvi912b-unk, + +tvi912b-p|tvi912c-p|TeleVideo TVI-912B or TVI-912C (no attributes; page print), + use=tvi912b+printer, use=tvi912b-unk, + +tvi912b-2p-p|tvi912c-2p-p|tvi912b-p-2p|tvi912c-p-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; no attributes; page print), + use=tvi912b+2p, use=tvi912b+printer, use=tvi912b-unk, + +tvi912b-vb-p|tvi912c-vb-p|tvi912b-p-vb|tvi912c-p-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; no attributes; page print), + use=tvi912b+vb, use=tvi912b+printer, use=tvi912b-unk, + +tvi912b-2p|tvi912c-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; half-intensity attribute), + use=tvi912b+2p, use=tvi912b+dim, use=tvi912b-unk, + +tvi912b-2p-mc|tvi912c-2p-mc|tvi912b-mc-2p|tvi912c-mc-2p|TeleVideo TVI-912B or TVI-912C (second page memory option; magic cookies), + use=tvi912b+2p, use=tvi912b+mc, use=tvi912b-unk, + +tvi912b-vb|tvi912c-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; half-intensity attribute), + use=tvi912b+vb, use=tvi912b+dim, use=tvi912b-unk, + +tvi912b-vb-mc|tvi912c-vb-mc|tvi912b-mc-vb|tvi912c-mc-vb|TeleVideo TVI-912B or TVI-912C (second page memory option "visible bell"; magic cookies), + use=tvi912b+vb, use=tvi912b+mc, use=tvi912b-unk, + +tvi912b|tvi912c|TeleVideo TVI-912B or TVI-912C (half-intensity attribute), + use=tvi912b+dim, use=tvi912b-unk, + +tvi912b-mc|tvi912c-mc|TeleVideo TVI-912B or TVI-912C (magic cookies), + use=tvi912b+mc, use=tvi912b-unk, + +tvi920b-unk|tvi920c-unk|TeleVideo TVI-920B or TVI-920C (no attributes), + use=tvi920b+fn, use=tvi912b-unk, + +tvi920b-2p-unk|tvi920c-2p-unk|tvi920b-unk-2p|tvi920c-unk-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; no attributes), + use=tvi920b+fn, use=tvi912b+2p, use=tvi912b-unk, + +tvi920b-vb-unk|tvi920c-vb-unk|tvi920b-unk-vb|tvi920c-unk-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; no attributes), + use=tvi920b+fn, use=tvi912b+vb, use=tvi912b-unk, + +tvi920b-p|tvi920c-p|TeleVideo TVI-920B or TVI-920C (no attributes; page print), + use=tvi920b+fn, use=tvi912b+printer, use=tvi912b-unk, + +tvi920b-2p-p|tvi920c-2p-p|tvi920b-p-2p|tvi920c-p-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; no attributes; page print), + use=tvi920b+fn, use=tvi912b+2p, use=tvi912b+printer, + use=tvi912b-unk, + +tvi920b-vb-p|tvi920c-vb-p|tvi920b-p-vb|tvi920c-p-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; no attributes; page print), + use=tvi920b+fn, use=tvi912b+vb, use=tvi912b+printer, + use=tvi912b-unk, + +tvi920b-2p|tvi920c-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; half-intensity attribute), + use=tvi920b+fn, use=tvi912b+2p, use=tvi912b+dim, + use=tvi912b-unk, + +tvi920b-2p-mc|tvi920c-2p-mc|tvi920b-mc-2p|tvi920c-mc-2p|TeleVideo TVI-920B or TVI-920C (second page memory option; magic cookies), + use=tvi920b+fn, use=tvi912b+2p, use=tvi912b+mc, + use=tvi912b-unk, + +tvi920b-vb|tvi920c-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; half-intensity attribute), + use=tvi920b+fn, use=tvi912b+vb, use=tvi912b+dim, + use=tvi912b-unk, + +tvi920b-vb-mc|tvi920c-vb-mc|tvi920b-mc-vb|tvi920c-mc-vb|TeleVideo TVI-920B or TVI-920C (second page memory option "visible bell"; magic cookies), + use=tvi920b+fn, use=tvi912b+vb, use=tvi912b+mc, + use=tvi912b-unk, + +tvi920b|tvi920c|TeleVideo TVI-920B or TVI-920C (half-intensity attribute), + use=tvi920b+fn, use=tvi912b+dim, use=tvi912b-unk, + +tvi920b-mc|tvi920c-mc|TeleVideo TVI-920B or TVI-920C (magic cookies), + use=tvi920b+fn, use=tvi912b+mc, use=tvi912b-unk, + +# Televideo 921 and variants +# From: Tim Theisen 22 Sept 1995 +# (tvi921: removed :ko=bt: before translation, I see no backtab cap; +# also added empty to suppress tic warning -- esr) +tvi921|televideo model 921 with sysline same as page & real vi function, + OTbs, OTpt, am, hs, xenl, xhp, + cols#80, lines#24, xmc#0, + acsc=, clear=^Z, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<3/>, cuu1=^K, + cvvis=\E.2, dch1=\EW, dl1=\ER$<1*/>, dsl=\Ef\r\Eg, ed=\EY, + el=\ET, fsl=\Eg, home=^^, ht=^I, ich1=\EQ, + if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, invis@, + is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, kcub1=^H, + kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER$<1*/>, + ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, nel=^M^J, rmacs=\E%%, + rmir=, smacs=\E$, smir=, tsl=\Ef\EG0, use=adm+sgr, +# without the beeper +# (tvi92B: removed :ko=bt: before translation, I see no backtab cap; +# also added empty to suppress tic warning -- esr) +tvi92B|televideo model 921 with sysline same as page & real vi function & no beeper, + am, hs, xenl, xhp, + cols#80, lines#24, xmc#0, + acsc=, clear=^Z, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<3/>, cuu1=^K, + cvvis=\E.2, dch1=\EW, dl1=\ER$<1*/>, dsl=\Ef\r\Eg, ed=\EY, + el=\ET, flash=\Eb$<200/>\Ed, fsl=\Eg, home=^^, ht=^I, + ich1=\EQ, if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, + invis@, is2=\El\E"\EF1\E.3\017\EA\E<, kbs=^H, kclr=^Z, + kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, + kdl1=\ER$<1*/>, ked=\EY, kel=\ET, kich1=\EQ, kil1=\EE, + nel=^M^J, rmacs=\E%%, smacs=\E$, tsl=\Ef\EG0, use=adm+sgr, +# (tvi92D: removed :ko=bt: before translation, I see no backtab cap -- esr) +tvi92D|tvi92B with DTR instead of XON/XOFF & better padding, + dl1=\ER$<2*/>, il1=\EE$<2*/>, + is2=\El\E"\EF1\E.3\016\EA\E<, kdl1=\ER$<2*/>, + kil1=\EE$<2*/>, use=tvi92B, + +# (tvi924: This used to have , . I put the new strings +# in from a BSD termcap file because it looks like they do something the +# old ones skip -- esr) +tvi924|televideo tvi924, + am, bw, hs, in, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, wsl#80, xmc#0, + bel=^G, blink=\EG2, cbt=\EI, civis=\E.0, clear=\E*0, + cnorm=\E.3, cr=^M, csr=\E_%p1%{32}%+%c%p2%{32}%+%c, + cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, cvvis=\E.1, + dch1=\EW, dl1=\ER, dsl=\Es0\Ef\031, ed=\Ey, el=\Et, + flash=\Eb$<200>\Ed, fsl=\031\Es1, home=^^, ht=^I, hts=\E1, + ich1=\EQ, if=/usr/share/tabset/stdcrt, il1=\EE, ind=^J, + invis@, is1=\017\E%\E'\E(\EDF\EC\EG0\EN0\Es0\Ev0, + kbs=^H, kclr=\E*0, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, + kdch1=\EW, kdl1=\ER, ked=\Ey, kel=\Et, kf0=^A@\r, kf1=^AA\r, + kf10=^AJ\r, kf11=^AK\r, kf12=^AL\r, kf13=^AM\r, kf14=^AN\r, + kf15=^AO\r, kf2=^AB\r, kf3=^AC\r, kf4=^AD\r, kf5=^AE\r, + kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, kf9=^AI\r, khome=^^, + kich1=\EQ, kil1=\EE, lf0=F1, lf1=F2, lf10=F11, lf2=F3, lf3=F4, + lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, lf9=F10, + pfkey=\E|%p1%{49}%+%c%p2%s\031, ri=\Ej, tbc=\E3, tsl=\Ef, + use=adm+sgr, + +# TVI925 DIP switches. In each of these, D = Down and U = Up, +# +# Here are the settings for the external (baud) switches (S1): +# +# Position Baud +# 7 8 9 10 [Printer] +# 1 2 3 4 [Main RS232] +# ----------------------------------------------------- +# D D D D 9600 +# D D D U 50 +# D D U D 75 +# D D U U 110 +# D U D D 135 +# D U D U 150 +# D U U D 300 +# D U U U 600 +# U D D D 1200 +# U D D U 1800 +# U D U D 2400 +# U D U U 3600 +# U U D D 4800 +# U U D U 7200 +# U U U D 9600 +# U U U U 19200 +# +# +# Settings for word length and stop-bits (S1) +# +# Position Description +# 5 6 +# --------------------------- +# U - 7-bit word +# D - 8-bit word +# - U 2 stop bits +# - D 1 stop bit +# +# +# S2 (external) settings +# +# Position Up Dn Description +# -------------------------------------------- +# 1 X Local edit +# X Duplex edit (transmit editing keys) +# -------------------------------------------- +# 2 X 912/920 emulation +# X 925 +# -------------------------------------------- +# 3 X +# 4 X No parity +# 5 X +# -------------------------------------------- +# 3 X +# 4 X Odd parity +# 5 X +# -------------------------------------------- +# 3 X +# 4 X Even parity +# 5 X +# -------------------------------------------- +# 3 X +# 4 X Mark parity +# 5 X +# -------------------------------------------- +# 3 X +# 4 X Space parity +# 5 X +# -------------------------------------------- +# 6 X White on black display +# X Black on white display +# -------------------------------------------- +# 7 X Half Duplex +# 8 X +# -------------------------------------------- +# 7 X Full Duplex +# 8 X +# -------------------------------------------- +# 7 X Block mode +# 8 X +# -------------------------------------------- +# 9 X 50 Hz +# X 60 Hz +# -------------------------------------------- +# 10 X CR/LF (Auto LF) +# X CR only +# +# S3 (internal switch) settings: +# +# Position Up Dn Description +# -------------------------------------------- +# 1 X Keyclick off +# X Keyclick on +# -------------------------------------------- +# 2 X English +# 3 X +# -------------------------------------------- +# 2 X German +# 3 X +# -------------------------------------------- +# 2 X French +# 3 X +# -------------------------------------------- +# 2 X Spanish +# 3 X +# -------------------------------------------- +# 4 X Blinking block cursor +# 5 X +# -------------------------------------------- +# 4 X Blinking underline cursor +# 5 X +# -------------------------------------------- +# 4 X Steady block cursor +# 5 X +# -------------------------------------------- +# 4 X Steady underline cursor +# 5 X +# -------------------------------------------- +# 6 X Screen blanking timer (ON) +# X Screen blanking timer (OFF) +# -------------------------------------------- +# 7 X Page attributes +# X Line attributes +# -------------------------------------------- +# 8 X DCD disconnected +# X DCD connected +# -------------------------------------------- +# 9 X DSR disconnected +# X DSR connected +# -------------------------------------------- +# 10 X DTR Disconnected +# X DTR connected +# -------------------------------------------- +# +# (tvi925: BSD has . I got and from there -- esr) +tvi925|televideo 925, + OTbs, am, bw, hs, ul, + cols#80, lines#24, xmc#1, + bel=^G, cbt=\EI, clear=^Z, cnorm=\E.4, cr=^M, cub1=^H, cud1=^V, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + cvvis=\E.2, dch1=\EW, dl1=\ER, dsl=\Eh, ed=\EY, el=\ET, + flash=\Eb$<200>\Ed, fsl=^M\Eg, home=^^, ht=^I, hts=\E1, + ich1=\EQ, il1=\EE, ind=^J, invis@, is2=\El\E", kbs=^H, kclr=^Z, + kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, + ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, + kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, + kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, ri=\Ej, tbc=\E3, + tsl=\Eh\Ef, use=adm+sgr, +# TeleVideo 925 from Mitch Bradley via BRL +# to avoid "magic cookie" standout glitch: +tvi925-hi|TeleVideo Model 925 with half intensity standout mode, + xmc@, + kbs=^H, kcub1=^H, kcud1=^J, rmso=\E(, smso=\E), use=tvi925, + +# From: Todd Litwin 28 May 1993 +# Originally Tim Curry, Univ. of Central Fla., 5/21/82 +# for additional capabilities, +# The following tvi descriptions from B:pjphar and virus!mike +# is for all 950s. It sets the following attributes: +# full duplex (\EDF) write protect off (\E() +# conversation mode (\EC) graphics mode off (\E%) +# white on black (\Ed) auto page flip off (\Ew) +# turn off status line (\Eg) clear status line (\Ef\r) +# normal video (\E0) monitor mode off (\EX or \Eu) +# edit mode (\Er) load blank char to space (\Ee\040) +# line edit mode (\EO) enable buffer control (^O) +# protect mode off (\E\047) duplex edit keys (\El) +# program unshifted send key to send line all (\E016) +# program shifted send key to send line unprotected (\E004) +# set the following to nulls: +# field delimiter (\Ex0\200\200) +# line delimiter (\Ex1\200\200) +# start-protected field delimiter (\Ex2\200\200) +# end-protected field delimiter (\Ex3\200\200) +# set end of text delimiter to carriage return/null (\Ex4\r\200) +# +# TVI 950 Switch Setting Reference Charts +# +# TABLE 1: +# +# S1 1 2 3 4 5 6 7 8 9 10 +# +-----------------------+-----+-----+-----------------------+ +# | Computer Baud Rate |Data |Stop | Printer Baud Rate | +# | |Bits |Bits | | +# +------+-----------------------+-----+-----+-----------------------+ +# | Up | See | 7 | 2 | See | +# +------+-----------------------+-----+-----+-----------------------+ +# | Down | TABLE 2 | 8 | 1 | TABLE 2 | +# +------+-----------------------+-----+-----+-----------------------+ +# +# +# S2 1 2 3 4 5 6 7 8 9 10 +# +-----+-----+-----------------+-----+-----------+-----+-----+ +# |Edit |Cursr| Parity |Video|Transmiss'n| Hz |Click| +# +------+-----+-----+-----------------+-----+-----------+-----+-----+ +# | Up | Dplx|Blink| See |GonBk| See | 60 | Off | +# +------+-----+-----+-----------------+-----+-----------+-----+-----+ +# | Down |Local|St'dy| TABLE 3 |BkonG| CHART | 50 | On | +# +------+-----+-----+-----------------+-----+-----------+-----+-----+ +# +# TABLE 2: +# +# +-----------+-----+-----+-----+-----+-----------+ +# | Display | 1 | 2 | 3 | 4 | Baud | +# +-----------+-----+-----+-----+-----+ | +# | Printer | 7 | 8 | 9 | 10 | Rate | +# +-----------+-----+-----+-----+-----+-----------+ +# | D | D | D | D | 9600 | +# | U | D | D | D | 50 | +# | D | U | D | D | 75 | +# | U | U | D | D | 110 | +# | D | D | U | D | 135 | +# | U | D | U | D | 150 | +# | D | U | U | D | 300 | +# | U | U | U | D | 600 | +# | D | D | D | U | 1200 | +# | U | D | D | U | 1800 | +# | D | U | D | U | 2400 | +# | U | U | D | U | 3600 | +# | D | D | U | U | 4800 | +# | U | D | U | U | 7200 | +# | D | U | U | U | 9600 | +# | U | U | U | U | 19200 | +# +-----+-----+-----+-----+-----------+ +# +# TABLE 3: +# +-----+-----+-----+-----------+ +# | 3 | 4 | 5 | Parity | +# +-----+-----+-----+-----------+ +# | X | X | D | None | +# | D | D | U | Odd | +# | D | U | U | Even | +# | U | D | U | Mark | +# | U | U | U | Space | +# +-----+-----+-----+-----------+ +# X = don't care +# +# CHART: +# +-----+-----+-----------------+ +# | 7 | 8 | Communication | +# +-----+-----+-----------------+ +# | D | D | Half Duplex | +# | D | U | Full Duplex | +# | U | D | Block | +# | U | U | Local | +# +-----+-----+-----------------+ +# +# (tvi950: early versions had obsolete ":ma=^Vj^Kk^Hh^Ll^^H:". +# I also inserted and ; the :ko: string indicated that +# should be present and all tvi native modes use the same string for this. +# Finally, note that BSD has cud1=^V. -- esr) +tvi950|televideo 950, + OTbs, am, hs, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, xmc#1, + acsc=b\011c\014d\re\ni\013, bel=^G, cbt=\EI, clear=\E*, + cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, dsl=\Eg\Ef\r, ed=\Ey, el=\Et, flash=\Eb$<200/>\Ed, + fsl=^M, home=^^, ht=^I, hts=\E1, ich1=\EQ, il1=\EE, ind=^J, + invis@, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee\s\017\011\El + \E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0 + \Ef\r, + kbs=^H, kcbt=\EI, kclr=\E*, kcub1=^H, kcud1=^V, kcuf1=^L, + kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\Ey, kel=\Et, kf0=^A0\r, + kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, ri=\Ej, rmacs=^X, + rmir=\Er, smacs=^U, smir=\Eq, tbc=\E3, tsl=\Eg\Ef, + use=adm+sgr, +# +# is for 950 with two pages adds the following: +# set 48 line page (\E\\2) +# place cursor at page 0, line 24, column 1 (\E-07 ) +# set local (no send) edit keys (\Ek) +# +# two page 950 adds the following: +# when entering ex, set 24 line page (\E\\1) +# when exiting ex, reset 48 line page (\E\\2) +# place cursor at 0,24,1 (\E-07 ) +# set duplex (send) edit keys (\El) when entering vi +# set local (no send) edit keys (\Ek) when exiting vi +# +tvi950-2p|televideo950 w/2 pages, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee\s\017\011\Ek + \E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0 + \E\\2\E-07\s\011, + rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, + smkx=\El, use=tvi950, +# +# is for 950 with four pages adds the following: +# set 96 line page (\E\\3) +# place cursor at page 0, line 24, column 1 (\E-07 ) +# +# four page 950 adds the following: +# when entering ex, set 24 line page (\E\\1) +# when exiting ex, reset 96 line page (\E\\3) +# place cursor at 0,24,1 (\E-07 ) +# +tvi950-4p|televideo950 w/4 pages, + is2=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee\s\017\011\Ek + \E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0 + \E\\3\E-07\s\011, + rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, + smkx=\El, use=tvi950, +# +# for reverse video 950 changes the following: +# set reverse video (\Ed) +# +# set vb accordingly (\Ed ...delay... \Eb) +# +tvi950-rv|televideo950 rev video, + flash=\Ed$<200/>\Eb, + is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee\s\017\011\El + \E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r + \0, + use=tvi950, + +# tvi950-rv-2p uses the appropriate entries from 950-2p and 950-rv +tvi950-rv-2p|televideo950 rev video w/2 pages, + flash=\Ed$<200/>\Eb, + is2=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee\s\017\011\Ek + \E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0 + \E\\2\E-07\s, + rmcup=\E\\2\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, + smkx=\El, use=tvi950, + +# tvi950-rv uses the appropriate entries from 950-4p and 950-rv +tvi950-rv-4p|televideo950 rev video w/4 pages, + flash=\Ed$<200/>\Eb, + is2=\EDF\EC\Eb\EG0\Er\EO\E'\E(\E%\Ew\EX\Ee\s\017\011\Ek + \E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0 + \E\\3\E-07\s, + rmcup=\E\\3\E-07\s, rmkx=\Ek, smcup=\E\\1\E-07\s, + smkx=\El, use=tvi950, +# From: Andreas Stolcke +# (tvi955: removed obsolete ":ma:=^Vj^Kk^Hh^Ll^^H"; +# removed incorrect (and overridden) ":do=^J:"; fixed broken continuations in +# the :rs: string, inserted the implied by the termcap :ko: string. Note +# the :ko: string had :cl: in it, which means that one of the original +# , had to be wrong; set because that's what +# the 950 has. Finally, corrected the string to match the 950 and what +# ko implies -- esr) +# If the BSD termcap file was right, would +# also work. +tvi955|televideo 955, + OTbs, mc5i, msgr@, + it#8, xmc@, + acsc=0_`RjHkGlFmEnIoPqKsQtMuLvOwNxJ, blink=\EG2, + civis=\E.0, cnorm=\E.2, cud1=^V, cup=\E[%i%p1%d;%p2%dH, + cvvis=\E.1, dim=\E[=5h, ind@, invis=\EG1, + is2=\E[=3l\EF1\Ed\EG0\E[=5l\E%\El, kctab=\E2, khts=\E1, + knp=\EK, kpp=\EJ, krmir=\EQ, ktbc=\E3, mc0=\EP, rmacs=\E%%, + rmam=\E[=7l, rmxon=^N, + rs1=\EDF\EC\Eg\Er\EO\E'\E(\Ew\EX\Ee\s\017\E0P\E6\0\E0p\E4\0 + \Ef\r, + sgr0=\EG0\E[=5l, smacs=\E$, smam=\E[=7h, smxon=^O, + use=tvi950, +tvi955-w|955-w|televideo955 w/132 cols, + cols#132, + is2=\E[=3h\EF1\Ed\EG0\E[=5l\E%\El, use=tvi955, +# use half-intensity as normal mode, full intensity as +tvi955-hb|955-hb|televideo955 half-bright, + bold=\E[=5l, dim@, is2=\E[=3l\EF1\Ed\EG0\E[=5h\E%\El, + sgr0=\EG0\E[=5h, use=tvi955, +# From: Humberto Appleton , 880521 UT Austin +# (tvi970: removed ":sg#0:"; removed =\E[m, =\E[m; +# added ////// from BRL. +# According to BRL we could have =\E>, =\E= but I'm not sure what +# it does to the function keys. I deduced /. +# also added empty to suppress tic warning, -- esr) +tvi970|televideo 970, + OTbs, OTpt, am, da, db, mir, msgr, + cols#80, it#8, lines#24, + acsc=, cbt=\E[Z, clear=\E[H\E[2J, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=\ED, cuf1=\E[C, cup=\E[%i%p1%d;%p2%df, + cuu1=\EM, cvvis=\E[1Q, dch1=\E[P, dl1=\E[M, dsl=\Eg\Ef\r, + ed=\E[J, el=\E[K, flash=\E[5m$<200/>\E[m, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, il1=\E[L, + is2=\E<\E[?21l\E[19h\E[1Q\E[10l\E[7l\E[H\E[2J, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\E?a, kf2=\E?b, kf3=\E?c, kf4=\E?d, kf5=\E?e, kf6=\E?f, + kf7=\E?g, kf8=\E?h, kf9=\E?i, khome=\E[H, ri=\EM, rmacs=\E(B, + rmam=\E[?7h, rmcup=, rmir=\E[4l, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smacs=\E(B, smam=\E[?7l, + smcup=\E[?20l\E[?7h\E[1Q, smir=\E[4h, smso=\E[7m, + smul=\E[4m, vpa=\E[%i%p1%dd, +tvi970-vb|televideo 970 with visual bell, + flash=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l, + use=tvi970, +tvi970-2p|televideo 970 with using 2 pages of memory, + rmcup=\E[H\E[J\E[V, smcup=\E[U\E[?20l\E[?7h\E[1Q, + use=tvi970, +# Works with vi and rogue. NOTE: Esc v sets autowrap on, Esc u sets 80 chars +# per line (rather than 40), Esc K chooses the normal character set. Not sure +# padding is needed, but adapted from the tvi920c termcap. The and +# strings are klutzy, but at least use no screen space. +# (tvipt: removed obsolete ":ma=^Kk^Ll^R^L:". I wish we knew , +# its absence means =\Ev isn't safe to use. -- esr) +# From: Gene Rochlin 9/19/84. +# The ////, and caps are from BRL, which says: +# F1 and F2 should be programmed as ^A and ^B; required for UNIFY. +tvipt|televideo personal terminal, + OTbs, am, + cols#80, lines#24, + cbt=\EI, clear=^Z, cub1=^H, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\ER$<5*>, + ed=\EY, el=\ET, home=^^, if=/usr/share/tabset/stdcrt, + il1=\EE$<5*>, is2=\Ev\Eu\EK, kbs=^H, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, kf0=^A, kf1=^B, khome=^^, mc4=^T, mc5=^R, + rmso=\EF, rmul=\EF, smso=\EG1@A\EH, smul=\EG1B@\EH, +# From: Nathan Peterson , 03 Sep 1996 +tvi9065|televideo 9065, + am, bw, chts, hs, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lh#1, lines#25, lm#0, lw#9, ma#4, nlab#8, vt#0, + wnum#0, wsl#30, + acsc='r0_jhkglfmeniopqksqtmulvownxj, bel=^G, + blink=\EG2, bold=\EG\,, cbt=\EI, civis=\E.0, clear=^Z, + cnorm=\E.3, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, + cub1=^H, cud=\E[%p1%dB, cud1=^V, cuf=\E[%p1%dC, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu=\E[%p1%dA, + cuu1=^K, cvvis=\E.2, dch=\E[%p1%dP, dch1=\EW, dim=\EGp, + dl=\E[%p1%dM, dl1=\ER, dsl=\E_30\r, ech=\E[%p1%d@, ed=\EY, + el=\ET, flash=\Eb$<15>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, + ich=\E[%p1%d@, if=/usr/share/tabset/stdcrt, + il=\E[%p1%dL, il1=\EE, ind=^J, indn=\E[%p1%dS, invis=\EG1, + ip=$<3>, + is1=\E"\E%\E'\E(\EG@\EO\EX\E[=5l\E[=6l\E[=7h\Ed\Er, + is2=\EF2\EG0\E\\L, is3=\E<\E[=4l\E[=8h, kHOM=\E\s\s\s, + kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, + kdch1=\EW, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^AK\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, ll=\E[25;1H, + mc0=\E[0;0i, mc4=\Ea, mc5=\E`, nel=^M^J, + pfkey=\E|%p1%{48}%+%c3%p2%s\031, + pfloc=\E|%p1%{48}%+%c2%p2%s\031, + pfx=\E|%p1%{48}%+%c1%p2%s\031, + pln=\E_%p1%{63}%+%c%p2%s\r, prot=\E&, + rep=\E[%p2%db%p1%c, rev=\EG4, + rf=/usr/share/tabset/stdcrt, ri=\Ej, rin=\E[%p1%dT, + rmacs=\E%%, rmam=\E[=7l, rmcup=\E.3\Er\E[1;25r\E[25;0H, + rmdc=\0, rmir=\Er, rmln=\E[4;1v, rmso=\EG0, rmul=\EG0, + rmxon=^N, rs1=\EC\EDF\E[0;0v\E[8;1v\E[=65l, + rs2=\E.b\E[10;20v\E[14;1v\E[3;0v\E[7;0v\E[=11.h\E[=12.h\E[=1 + 3.h\E[=14.h\E[=15l\E[=20h\E[=60l\E[=61h\E[=9l\E[=10l\E[= + 21l\E[=23l\E[=3l\E_40\E_50\En\Ew\Ee\s\Ex0\0\0\Ex1\0\0 + \Ex2\0\0\Ex3\0\0\Ex4\0\0\E1, + rs3=\E[=19h\E.3\E9\E0O\0\0\0\0\0\E0o\0\0\0\0\0\E0J\177\0\0 + \0\0, + sgr=\EG0%?%p1%t\EGt%;%?%p2%t\EG8%;%?%p3%t\EG4%;%?%p4%t\EG2%; + %?%p5%t\EGp%;%?%p6%t\EG\,%;%?%p7%t\EG1%;%?%p8%t\E&%;%? + %p9%t\E$%e\E%%%;, + sgr0=\EG0\E%, smacs=\E$, smam=\E=7h, smcup=\E.2, smdc=\Er, + smir=\Eq, smln=\E[4;2v, smso=\EGt, smul=\EG8, smxon=^O, + tbc=\E3, tsl=\E[4;1v\E_30, uc=\EG8\EG0, + +#### Visual (vi) +# +# In September 1993, Visual Technology of Westboro, Massachusetts, +# merged with White Pine Software of Nashua, New Hampshire. +# +# White Pine Software may be contacted at +1 603/886-9050. +# Or visit White Pine on the World Wide Web at URL http://www.wpine.com. +# + +# Visual 50 from Beau Shekita, BTL-Whippany +# Recently I hacked together the following termcap for Visual +# Technology's Visual 50 terminal. It's a slight modification of +# the vt52 termcap. +# It's intended to run when the Visual 50 is in vt52 emulation mode +# (I know what you're thinking; if it's emulating a vt52, then why +# another termcap? Well, it turns out that the Visual 50 can handle +# and db(?) among other things, which the vt52 can't) +# The termcap works OK for the most part. The only problem is on +# character inserts. The whole line gets painfully redrawn for each +# character typed. Any suggestions? +# Beau's entry is combined with the vi50 entry from University of Wisconsin. +# Note especially the function. - are really l4-l6 in +# disguise; - are really l1-l3. +vi50|visual 50, + OTbs, OTpt, am, da, db, msgr, + cols#80, it#8, lines#24, + OTnl=^J, bel=^G, cbt=\Ez$<4/>, clear=\EH\EJ, cr=^M, cub1=^H, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dl1=\EM$<3*/>, ed=\EJ, el=\EK$<16/>, home=\EH, + ht=^I, il1=\EL, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kf1=\EP, kf2=\EQ, kf3=\ER, kf4=\EV, + kf5=\EE, kf6=\E], kf7=\EL, kf8=\Ev, kf9=\EM, khome=\EH, + nel=^M^J, ri=\EI, rmso=\ET, rmul=\EW, smso=\EU, smul=\ES, +# this one was BSD & SCO's vi50 +vi50adm|visual 50 in adm3a mode, + am, msgr, + cols#80, it#8, lines#24, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\EM, + ed=\Ek, el=\EK, home=\EH, ht=^I, il1=\EL, ind=^J, kbs=^H, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\EH, + rmso=\ET, smso=\EU, +# From: Jeff Siegal +vi55|Visual 55, + OTbs, am, mir, msgr, + cols#80, it#8, lines#24, + clear=\Ev, csr=\E_%p1%{65}%+%c%p2%{65}%+%c, cub1=^H, + cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dch1=\Ew, dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, + il1=\EL, is2=\Ev\E_AX\Eb\EW\E9P\ET, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, ri=\EI, rmir=\Eb, rmso=\ET, + smir=\Ea, smso=\EU, + +# Visual 200 from BRL +# The following switch settings are assumed for normal operation: +# FULL_DUPLEX SCROLL CR +# AUTO_NEW_LINE_ON VISUAL_200_EMULATION_MODE +# Other switches may be set for operator convenience or communication +# requirements. +# Character insertion is kludged in order to get around the "beep" misfeature. +# (This cap is commented out because / is more efficient -- esr) +# Supposedly "4*" delays should be used for , , , , +# and strings, but we seem to get along fine without them. +vi200|visual 200, + OTbs, OTpt, am, mir, msgr, + OTkn#10, cols#80, it#8, lines#24, + acsc=, bel=^G, cbt=\Ez, clear=\Ev, cnorm=\Ec, cr=^M, cub1=^H, + cud1=^J, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, cvvis=\Ed, dch1=\EO, dim=\E4, dl1=\EM, ed=\Ey, + el=\Ex, home=\EH, ht=^I, hts=\E1, il1=\EL, ind=^J, invis=\Ea, + kbs=^H, kclr=\Ev, kctab=\E2, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EO, kdl1=\EM, ked=\EJ, kel=\Et, kf0=\E?p, + kf1=\E?q, kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v, + kf7=\E?w, kf8=\E?x, kf9=\E?y, khome=\EH, khts=\E1, kich1=\Ei, + kil1=\EL, krmir=\Ej, mc0=\EH\E], mc4=\EX, mc5=\EW, ri=\EI, + rmacs=\EG, rmkx=\E>, rmso=\E3, + rs1=\E3\Eb\Ej\E\El\EG\Ec\Ek\EX, sgr0=\E3\Eb, smacs=\EF, + smkx=\E=, smso=\E4, tbc=\Eg, +# The older Visuals didn't come with function keys. This entry uses +# and so that the keypad keys can be used as function keys. +# If your version of vi doesn't support function keys you may want +# to use vi200-f. +vi200-f|visual 200 no function keys, + is2=\E3\Eb\Ej\E\\\El\EG\Ed\Ek, kf0=\E?p, kf1=\E?q, + kf2=\E?r, kf3=\E?s, kf4=\E?t, kf5=\E?u, kf6=\E?v, kf7=\E?w, + kf8=\E?x, kf9=\E?y, rmkx=\E>, rmso@, smkx=\E=, smso@, + use=vi200, +vi200-rv|visual 200 reverse video, + cnorm@, cvvis@, ri@, rmso=\E3, smso=\E4, use=vi200, + +# the function keys are programmable but we don't reprogram them to their +# default values with because programming them is very verbose. maybe +# an initialization file should be made for the 300 and they could be stuck +# in it. +# (vi300: added / based on init string -- esr) +vi300|visual 300 ansi x3.64, + am, bw, mir, xenl, + cols#80, lines#24, + bel=^G, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch1=\E[P$<40>, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + il1=\E[L, ind=^J, + is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[1Q\E[0;1(D\E[8s, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\E_A\E\\, kf2=\E_B\E\\, kf3=\E_C\E\\, kf4=\E_D\E\\, + kf5=\E_E\E\\, kf6=\E_F\E\\, kf7=\E_G\E\\, kf8=\E_H\E\\, + kf9=\E_I\E\\, khome=\E[H, ri=\EM, rmam=\E[?7l, rmir=\E[4l, + rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, + smso=\E[1m, smul=\E[4m, +# some of the vi300s have older firmware that has the command +# sequence for setting editing extent reversed. +vi300-old|visual 300 with old firmware (set edit extent reversed), + is2=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[2Q\E[0;1(D\E[8s, use=vi300, + +# Visual 500 prototype entry from University of Wisconsin. +# The best place to look for the escape sequences is page A1-1 of the +# Visual 500 manual. The initialization sequence given here may be +# overkill, but it does leave out some of the initializations which can +# be done with the menus in set-up mode. +# The :xp: line below is so that emacs can understand the padding requirements +# of this slow terminal. :xp: is 10 time the padding factor. +# (vi500: removed unknown :xp#4: termcap; +# also added empty to suppress tic warning -- esr) +vi500|visual 500, + am, mir, msgr, + cols#80, it#8, lines#33, + acsc=, cbt=\Ez$<4/>, clear=\Ev$<6*/>, cr=^M, + csr=\E(%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=\EB, + cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + dch1=\EO$<3*/>, dl1=\EM$<3*/>, ed=\Ey$<3*/>, + el=\Ex$<16/>, home=\EH, ht=\011$<8/>, il1=\EL\Ex$<3*/>, + ind=^J, + is2=\E3\E\001\E\007\E\003\Ek\EG\Ed\EX\El\E>\Eb\E\\, + kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + khome=\EH, nel=^M^J, rmacs=^O, rmir=\Ej, rmso=\E^G, + rmul=\E^C, smacs=^N, smir=\Ei, smso=\E^H, smul=\E^D, + +# The visual 550 is a visual 300 with tektronix graphics, +# and with 33 lines. clear screen is modified here to +# also clear the graphics. +vi550|visual 550 ansi x3.64, + lines#33, + clear=\030\E[H\E[2J, use=vi300, + +vi603|visual603|visual 603, + hs, mir, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, + csr=\E[%i%p1%d;%p2%dr, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + dsl=\EP2;1~\E\\, ed=\E[J, el=\E[K, fsl=\E\\, il1=\E[L, + ind=\ED, is1=\E>\E[?3l\E[?4l\E[?7h\E[?8h\E[1;24r, + rev=\E[7m, ri=\EM, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, tsl=\EP2~, + use=vt100, + +#### Wyse (wy) +# +# Wyse Technology +# 3471 North First Street +# San Jose, CA 95134 +# Vox: (408)-473-1200 +# Fax: (408) 473-1222 +# Web: http://www.wyse.com +# +# Wyse sales can be reached by phone at 1-800-GET-WYSE. Tech support is at +# (800)-800-WYSE (option 5 gets you a human). There's a Web page at the +# obvious address, . They keep terminfo entries at +# https://web.archive.org/web/19970712022641/http://www.wyse.co.uk/support/appnotes/idxappnt.htm +# +# +# Wyse bought out Link Technology, Inc. in 1990 and closed it down in 1995. +# They now own the Qume and Amdek brands, too. So these are the people to +# talk with about all Link, Qume, and Amdek terminals. +# +# These entries include a few small fixes. +# I canceled the bel capacities in the vb entries. +# I made two trivial syntax fixes in the wyse30 entry. +# I made some entries relative to adm+sgr. +# +# +# Note: The wyse75, wyse85, and wyse99 have been discontinued. + +# Although the Wyse 30 can support more than one attribute +# it requires magic cookies to do so. Many applications do not +# function well with magic cookies. The following terminfo uses +# the protect mode to support one attribute (dim) without cookies. +# If more than one attribute is needed then the wy30-mc terminfo +# should be used. +# +wy30|wyse30|Wyse 30, + am, bw, hs, mc5i, mir, msgr, xon, + cols#80, lh#1, lines#24, lw#8, ma#1, nlab#8, wsl#45, + acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, cbt=\EI, + civis=\E`0, clear=\E+$<80>, cnorm=\E`1, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, dch1=\EW$<10>, dim=\E`7\E), dl1=\ER$<1>, + dsl=\EF\r, ed=\EY$<80>, el=\ET, flash=\E`8$<100/>\E`9, + fsl=^M, home=^^, ht=\011$<1>, hts=\E1, il1=\EE$<2>, + ind=\n$<2>, ip=$<2>, is2=\E'\E(\E\^3\E`9\016\024, + kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kent=\E7, + kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, khome=^^, kich1=\EQ, + kil1=\EE, knp=\EK, kpp=\EJ, krpl=\Er, ll=^^^K, mc0=\EP, mc4=^T, + mc5=^X, nel=^M^J, pfx=\Ez%p1%{63}%+%c%p2%s\177, + pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E`7\E), ri=\Ej$<3>, + rmacs=\EH^C, rmir=\Er, rmln=\EA11, rmso=\E(, + sgr=%?%p1%p5%p8%|%|%t\E`7\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, + sgr0=\E(\EH\003, smacs=\EH^B, smir=\Eq, smln=\EA10, + smso=\E`7\E), tbc=\E0, tsl=\EF, +# +# This terminal description uses the non-hidden attribute mode +# (with magic cookie). +# +# (wy30-mc: added to suppress tic warning --esr) +wy30-mc|wyse30-mc|wyse 30 with magic cookies, + msgr@, + ma@, xmc#1, + blink=\EG2, dim=\EGp, prot=\EG0\E), rmacs=\EG0\EH\003, + rmcup=\EG0, rmso=\EG0, + sgr=\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%? + %p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8 + %t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, + sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, + smso=\EG4, use=wy30, use=adm+sgr, +# The mandatory pause used by does not work with +# older versions of terminfo. If you see this effect then +# unset xon and delete the / from the delay. +# i.e. change $<100/> to $<100> +wy30-vb|wyse30-vb|wyse 30 visible bell, + bel@, use=wy30, +# +# The Wyse 50 can support one attribute (e.g. Dim, Inverse, +# Normal) without magic cookies by using the protect mode. +# The following description uses this feature, but when more +# than one attribute is put on the screen at once, all attributes +# will be changed to be the same as the last attribute given. +# The Wyse 50 can support more attributes when used with magic +# cookies. The wy50-mc terminal description uses magic cookies +# to correctly handle multiple attributes on a screen. +# +wy50|wyse50|Wyse 50, + am, bw, hs, mc5i, mir, msgr, xon, + cols#80, lh#1, lines#24, lw#8, ma#1, nlab#8, wsl#45, + acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, cbt=\EI, + civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, dch1=\EW$<1>, dim=\E`7\E), dl1=\ER, dsl=\EF\r, + ed=\EY$<20>, el=\ET, flash=\E`8$<100/>\E`9, fsl=^M, + home=^^, ht=^I, hts=\E1, il1=\EE, ind=\n$<2>, ip=$<1>, + is1=\E`\:\E`9$<30>, is2=\016\024\E'\E(, kHOM=\E{, kbs=^H, + kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, + kdl1=\ER, ked=\EY, kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, + kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, + kf16=^AO\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, + ll=^^^K, mc0=\EP, mc4=^T, mc5=^X, nel=^M^J, + pfx=\Ez%p1%{63}%+%c%p2%s\177, + pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E`7\E), rev=\E`6\E), + ri=\Ej, rmacs=\EH^C, rmir=\Er, rmln=\EA11, rmso=\E(, + sgr=%?%p1%p3%|%t\E`6\E)%e%p5%p8%|%t\E`7\E)%e\E(%;%?%p9%t\EH + \002%e\EH\003%;, + sgr0=\E(\EH\003, smacs=\EH^B, smir=\Eq, smln=\EA10, + smso=\E`6\E), tbc=\E0, tsl=\EF, +# +# This terminal description uses the non-hidden attribute mode +# (with magic cookie). +# +# The mandatory pause used by flash does not work with some +# older versions of terminfo. If you see this effect then +# unset and delete the / from the delay. +# i.e. change $<100/> to $<100> +# (wy50-mc: added to suppress tic warning --esr) +wy50-mc|wyse50-mc|wyse 50 with magic cookies, + msgr@, + ma@, xmc#1, + blink=\EG2, dim=\EGp, prot=\EG0\E), rev=\EG4, + rmacs=\EG0\EH\003, rmcup=\EG0, rmso=\EG0, + sgr=\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%? + %p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8 + %t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;, + sgr0=\EG0\E(\EH\003, smacs=\EG0\EH\002, smcup=, + smso=\EGt, use=wy50, use=adm+sgr, +wy50-vb|wyse50-vb|wyse 50 visible bell, + bel@, use=wy50, +wy50-w|wyse50-w|wyse 50 132-column, + cols#132, lw#7, nlab#16, wsl#97, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, + use=wy50, +wy50-wvb|wyse50-wvb|wyse 50 132-column visible bell, + bel@, use=wy50-w, + +# +# The Wyse 350 is a Wyse 50 with color. +# Unfortunately this means that it has magic cookies. +# The color attributes are designed to overlap the reverse, dim and +# underline attributes. This is nice for monochrome applications +# because you can make underline stuff green (or any other color) +# but for true color applications it's not so hot because you cannot +# mix color with reverse, dim or underline. +# To further complicate things one of the attributes must be +# black (either the foreground or the background). In reverse video +# the background changes color with black letters. In normal video +# the foreground changes colors on a black background. +# This terminfo uses some of the more advanced features of curses +# to display both color and blink. In the final analysis I am not +# sure that the wy350 runs better with this terminfo than it does +# with the wy50 terminfo (with user adjusted colors). +# +# The mandatory pause used by flash does not work with +# older versions of terminfo. If you see this effect then +# unset xon and delete the / from the delay. +# i.e. change $<100/> to $<100> +# +# Bug: The capability resets attributes. +wy350|wyse350|Wyse 350, + am, bw, hs, mc5i, mir, xon, + colors#8, cols#80, lh#1, lines#24, lw#8, ncv#55, nlab#8, pairs#8, + wsl#45, xmc#1, + acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, blink=\EG2, + cbt=\EI, civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, + cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<1>, + dim=\EGp, dl1=\ER, dsl=\EF\r, ed=\EY$<20>, el=\ET, + flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=^I, hts=\E1, + il1=\EE, ind=\n$<2>, ip=$<1>, is1=\E`\:\E`9$<30>, + is2=\016\024\E'\E(, is3=\E%?, kHOM=\E{, kbs=^H, kcbt=\EI, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, + ked=\EY, kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, + kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, + kf16=^AO\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, + ll=^^^K, mc0=\EP, mc4=^T, mc5=^X, nel=^M^J, oc=\E%?, op=\EG0, + pfx=\Ez%p1%{63}%+%c%p2%s\177, + pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\EG0\E), ri=\Ej, + rmacs=\EG0\EH\003, rmir=\Er, rmln=\EA11, setb=, + setf=%?%p1%{0}%=%t%{76}%e%p1%{1}%=%t%{64}%e%p1%{2}%=%t%{8}%e + %p1%{3}%=%t%{72}%e%p1%{4}%=%t%{4}%e%p1%{5}%=%t%{68}%e + %p1%{6}%=%t%{12}%e%p1%{7}%=%t%{0}%;%PC\EG%gC%gA%+%{48} + %+%c, + sgr=%{0}%?%p4%t%{2}%|%;%?%p7%t%{1}%|%;%PA\EG%?%gC%t%gC%e%{0} + %?%p1%t%{4}%|%;%?%p2%t%{8}%|%;%?%p3%t%{4}%|%;%?%p5%t + %{64}%|%;%;%gA%+%{48}%+%c%?%p8%t\E)%e\E(%;%?%p9%t\EH + \002%e\EH\003%;, + sgr0=\EG0\E(\EH\003%{0}%PA%{0}%PC, smacs=\EG0\EH\002, + smir=\Eq, smln=\EA10, tbc=\E0, tsl=\EF, use=adm+sgr, +wy350-vb|wyse350-vb|wyse 350 visible bell, + bel@, use=wy350, +wy350-w|wyse350-w|wyse 350 132-column, + cols#132, lw#7, nlab#16, wsl#97, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<2>, is1=\E`;\E`9$<30>, + use=wy350, +wy350-wvb|wyse350-wvb|wyse 350 132-column visible bell, + bel@, use=wy350-w, +# +# This terminfo description is untested. +# The wyse100 emulates an adm31, so the adm31 entry should work. +# +wy100|wyse 100, + hs, mir, + cols#80, lines#24, xmc#1, + bel=^G, clear=\E;, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, dsl=\EA31, ed=\EY, el=\ET, fsl=^M, il1=\EE, ind=^J, + invis@, is2=\Eu\E0, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, + kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, khome=\E{, + rmir=\Er, smir=\Eq, tsl=\EF, use=adm+sgr, +# +# The Wyse 120/150 has most of the features of the Wyse 60. +# This terminal does not need padding up to 9600 baud! +# should be set but the clear screen fails when in +# alt-charset mode. Try \EcE\s\s\E+\s if the screen is really clear +# then set . +# +wy120|wyse120|wy150|wyse150|Wyse 120/150, + am, bw, hs, km, mc5i, mir, msgr, xon, + cols#80, it#8, lh#1, lines#24, lw#8, nlab#8, pb#9601, wsl#45, + acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<50>, + cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<7>, + dim=\EGp, dl1=\ER$<3>, dsl=\EF\r, ed=\EY$<50>, el=\ET$<4>, + flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=\011$<1>, + hts=\E1, il1=\EE$<3>, ind=\n$<3>, ip=$<2>, is1=\EcB0\EcC1, + is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016 + \024\El, + is3=\EwJ\Ew1$<150>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, + kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, + kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=^^^K, + mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<3>, + pfloc=\EZ2%p1%{63}%+%c%p2%s\177, + pfx=\EZ1%p1%{63}%+%c%p2%s\177, + pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<2>, + rmacs=\EcD, rmam=\Ed., rmcup=\Ew1, rmir=\Er, rmln=\EA11, + rmxon=\Ec20, rs1=\E~!\E~4$<30>, rs2=\EeF\E`\:$<70>, + rs3=\EwG\Ee($<100>, + sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8} + %|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t + %{64}%|%;%?%p7%t%{1}%|%;%c, + sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, + smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, + tbc=\E0, tsl=\EF, use=adm+sgr, +# +wy120-w|wyse120-w|wy150-w|wyse150-w|wyse 120/150 132-column, + cols#132, lw#7, nlab#16, wsl#97, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<12>, ip=$<4>, + rs2=\E`;$<70>, use=wy120, +# +wy120-25|wyse120-25|wy150-25|wyse150-25|wyse 120/150 80-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy120, +# +wy120-25-w|wyse120-25-w|wy150-25-w|wyse150-25-w|wyse 120/150 132-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy120-w, +# +wy120-vb|wyse120-vb|wy150-vb|wyse150-vb|Wyse 120/150 visible bell, + bel@, use=wy120, +# +wy120-w-vb|wy120-wvb|wyse120-wvb|wy150-w-vb|wyse150-w-vb|Wyse 120/150 132-column visible bell, + bel@, use=wy120-w, +# +# The Wyse 60 is like the Wyse 50 but with more padding. +# The reset strings are slow and the pad times very depending +# on other parameters such as font loading. I have tried +# to follow the following outline: +# +# -> set personality +# -> set number of columns +# -> set number of lines +# -> select the proper font +# -> do the initialization +# -> set up display memory (2 pages) +# +# The Wyse 60's that have vt100 emulation are slower than the +# older Wyse 60's. This change happened mid-1987. +# The capabilities effected are +# +# The meta key is only half right. This terminal will return the +# high order bit set when you hit CTRL-function_key +# +# It may be useful to assign two function keys with the +# values \E=(\s look at old data in page 1 +# \E=W, look at bottom of page 1 +# where \s is a space ( ). +# +# Note: +# The Wyse 60 runs faster when the XON/XOFF +# handshake is turned off. +# +# (wy60: we use \E{ rather than ^^ for home (both are documented) to avoid +# a bug reported by Robert Dunn, -- esr) +wy60|wyse60|Wyse 60, + am, bw, hs, km, mc5i, mir, msgr, + cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#45, + acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<100>, + cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW$<11>, dclk=\E`b, dim=\EGp, dl1=\ER$<5>, dsl=\EF\r, + ed=\EY$<100>, el=\ET, flash=\E`8$<100/>\E`9, fsl=^M, + home=\E{, ht=\011$<1>, hts=\E1, il1=\EE$<4>, ind=\n$<5>, + ip=$<3>, is1=\EcB0\EcC1, + is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016 + \024\El, + is3=\EwJ\Ew1$<150>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, + kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, + kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=\E{^K, + mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<3>, + pfloc=\EZ2%p1%{63}%+%c%p2%s\177, + pfx=\EZ1%p1%{63}%+%c%p2%s\177, + pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<7>, + rmacs=\EcD, rmam=\Ed., rmclk=\E`c, rmcup=\Ew1, rmir=\Er, + rmln=\EA11, rmxon=\Ec20, rs1=\E~!\E~4$<150>, + rs2=\EeG$<150>, rs3=\EwG\Ee($<200>, + sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8} + %|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t + %{64}%|%;%?%p7%t%{1}%|%;%c, + sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, + smcup=\Ew0, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, + tbc=\E0, tsl=\EF, use=adm+sgr, +# +wy60-w|wyse60-w|wyse 60 132-column, + cols#132, lw#7, nlab#16, wsl#97, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<16>, ip=$<5>, + rs2=\EeF$<150>\E`;$<150>, use=wy60, +# +wy60-25|wyse60-25|wyse 60 80-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<200>, use=wy60, +wy60-25-w|wyse60-25-w|wyse 60 132-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<200>, use=wy60-w, +# +wy60-42|wyse60-42|wyse 60 80-column 42-lines, + lines#42, + clear=\E+$<260>, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<2>, + dch1=\EW$<16>, dl1=\ER$<11>, ed=\Ey$<260>, il1=\EE$<11>, + ind=\n$<9>, ip=$<5>, is1=\EcB2\EcC3, nel=\r\n$<6>, + ri=\Ej$<10>, rs3=\Ee*$<150>, use=wy60, +wy60-42-w|wyse60-42-w|wyse 60 132-column 42-lines, + cols#132, lw#7, nlab#16, wsl#97, + clear=\E+$<260>, cup=\Ea%i%p1%dR%p2%dC$<2>, + dch1=\EW$<19>, ed=\Ey$<260>, home=\036$<2>, ip=$<6>, + nel=\r\n$<11>, rs2=\EeF$<150>\E`;$<150>, use=wy60-42, +# +wy60-43|wyse60-43|wyse 60 80-column 43-lines, + lh@, lines#43, lw@, nlab@, + pln@, rs3=\Ee+$<150>, use=wy60-42, +wy60-43-w|wyse60-43-w|wyse 60 132-column 43-lines, + lh@, lines#43, lw@, nlab@, + pln@, rs3=\Ee+$<150>, use=wy60-42-w, +# +wy60-vb|wyse60-vb|Wyse 60 visible bell, + bel@, use=wy60, +wy60-w-vb|wy60-wvb|wyse60-wvb|Wyse 60 132-column visible bell, + bel@, use=wy60-w, + +# The Wyse-99GT looks at lot like the Wyse 60 except that it +# does not have the 42/43 line mode. In the Wyse-60 the "lines" +# setup parameter controls the number of lines on the screen. +# For the Wyse 99GT the "lines" setup parameter controls the +# number of lines in a page. The screen can display 25 lines max. +# The Wyse-99GT also has personalities for the VT220 and +# Tektronix 4014. But this has no bearing on the native mode. +# +# (msgr) should be set but the clear screen fails when in +# alt-charset mode. Try \EcE\s\s\E+\s if the screen is really clear +# then set msgr, else use msgr@. +# +# u0 -> enter Tektronix mode +# u1 -> exit Tektronix mode +# +wy99gt|wyse99gt|Wyse 99gt, + msgr@, + clear=\E+$<130>, dch1=\EW$<7>, dl1=\ER$<4>, ed=\Ey$<130>, + el=\Et$<5>, flash=\E`8$<100/>\E`9, ht=\011$<1>, + il1=\EE$<4>, ind=\n$<4>, ip=$<2>, is3=\Ew0$<20>, nel@, + ri=\Ej$<3>, rmcup=\Ew0, rs2=\E`\:$<150>, smcup=\Ew1, + u0=\E~>\E8, u1=\E[42h, use=wy60, +# +wy99gt-w|wyse99gt-w|wyse 99gt 132-column, + cols#132, lw#7, nlab#16, wsl#97, + clear=\E+$<160>, cup=\Ea%i%p1%dR%p2%dC$<2>, + dch1=\EW$<9>, ed=\Ey$<160>, ip=$<4>, rs2=\E`;$<150>, + use=wy99gt, +# +wy99gt-25|wyse99gt-25|wyse 99gt 80-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs2=\E`\:$<150>, rs3=\EwG\Ee)$<200>, use=wy99gt, +# +wy99gt-25-w|wyse99gt-25-w|wyse 99gt 132-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs2=\E`;$<150>, use=wy99gt-w, +# +wy99gt-vb|wyse99gt-vb|Wyse 99gt visible bell, + bel@, use=wy99gt, +# +wy99gt-w-vb|wy99gt-wvb|wyse99gt-wvb|Wyse 99gt 132-column visible bell, + bel@, use=wy99gt-w, + +# Can't set tabs! Other bugs (ANSI mode only): +# - can't redefine function keys (anyway, key redefinition in ANSI mode +# is too much complex to be described); +# - meta key can't be described (the terminal forgets it when reset); +# The xon-xoff handshaking can't be disabled while in ansi personality, so +# emacs can't work at speed greater than 9600 baud. No padding is needed at +# this speed. +# dch1 has been commented out because it causes annoying glittering when +# vi deletes one character at the beginning of a line with tabs in it. +# dch makes sysgen(1M) have a horrible behaviour when deleting +# a screen and makes screen(1) behave badly, so it is disabled too. The nice +# thing is that vi goes crazy if smir-rmir are present and both dch-dch1 are +# not, so smir and rmir are commented out as well. +# From: Francesco Potorti` , 24 Aug 1998 +wy99-ansi|Wyse WY-99GT in ansi mode (int'l PC keyboard), + am, km, mc5i, mir, msgr, xenl, + cols#80, it#8, lines#25, vt#3, + acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<200>, cnorm=\E[34h\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD$<1>, + cub1=\010$<1>, cud=\E[%p1%dB, cud1=\ED, + cuf=\E[%p1%dC$<1>, cuf1=\E[C$<1>, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, + cvvis=\E[34l\E[?25h, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J$<8*>, el=\E[K$<1>, el1=\E[1K$<1>, + enacs=\E)0, flash=\E[?5h$<30/>\E[?5l, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, + il1=\E[L, ind=\n$<1>, invis=\E[8m, + is2=\E7\E[1r\E8\E[2;3;4;13;20;34;39;36l\E[12;16;34h\E[?1;3;4 + ;5;10;18l\E[?7;8;25h\E>\E[?5W\E(B\017\E[4i, + kbs=^H, kcbt=\E[z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf17=\E[K, kf18=\E[31~, kf19=\E[32~, kf2=\EOQ, + kf20=\E[33~, kf21=\E[34~, kf22=\E[35~, kf23=\E[1~, + kf24=\E[2~, kf3=\EOR, kf4=\EOS, kf5=\E[M, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, ll=\E[24E, mc0=\E[?19h, + mc4=\E[4i, mc5=\E[5i, nel=\EE, prot=\E[1"q, rc=\E8, + rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[?1l, rmso=\E[27m, rmul=\E[24m, + rs2=\E[61"p\E[40h\E[?6l\E[1r\E[2;3;4;13;20;34;39;36l\E[12;16 + ;34h\E[?1;3;4;5;10;18l\E[?7;8;25h\E>\E[?5W\E(B\017\E[24E + \E[4i, + sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%O%t;7%;%?%p4%t;5%;%? + %p5%t;2%;%?%p7%t;8%;m\E[%?%p8%t1%;"q%?%p9%t\016%e\017%;, + sgr0=\E[m\017\E["q, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h, smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, + +# This is the american terminal. Here tabs work fine. +# From: Francesco Potorti` , 24 Aug 1998 +wy99a-ansi|Wyse WY-99GT in ansi mode (US PC keyboard), + hts=\EH, is3=\E[?5l, rs3=\E[?5l, tbc=\E[3g, use=wy99-ansi, + +# This terminal (firmware version 02) has a lot of bugs: +# - can't set tabs; +# - other bugs in ANSI modes (see above). +# This description disables handshaking when using cup. This is because +# GNU emacs doesn't like Xon-Xoff handshaking. This means the terminal +# cannot be used at speeds greater than 9600 baud, because at greater +# speeds handshaking is needed even for character sending. If you use +# DTR handshaking, you can use even greater speeds. +# From: Francesco Potorti` , 24 Aug 1998 +wy99f|wy99fgt|wy-99fgt|Wyse WY-99GT (int'l PC keyboard), + am, bw, hs, km, mc5i, mir, msgr, xon, + cols#80, it#8, lines#25, wsl#46, + acsc='x+y.w_vi~j(k'l&m%n)o9q*s8t-u.v\,w+x=, bel=^G, + blink=\EG2, cbt=\EI, civis=\E`0, clear=\E'\E(\032, + cnorm=\E`4\E`1, cr=^M, cub1=^H, cud1=\Ej, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + cvvis=\E`2\E`1, dch1=\EW, dim=\EGp, dl1=\ER, dsl=\EF\r, + ed=\EY$<8*>, el=\ET$<8>, enacs=\Ec@1J$<2000>, + flash=\E\^1$<30/>\E\^0, fsl=^M, home=^^, ht=^I, il1=\EE, + ind=^J, invis=\EG3, + is2=\Eu\Ee6\EC\EDF\Ec21\Ec31\Ec62\Ec72\Ee;\016\E'\EeL\E`9\E + \^0\E`1\E`4\Ee.\E`\:\Ee1\EG0\E(\Ed/\Ee4\Ed*\EO\E`I\Er + \Ee"\EcD\024, + ka1=^^, ka3=\EJ, kbs=^H, kc1=\ET, kc3=\EK, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf10=^AI\r, + kf11=^AJ\r, kf12=^AK\r, kf13=^A`\r, kf14=^Aa\r, kf15=^Ab\r, + kf16=^Ac\r, kf17=^Ad\r, kf18=^Ae\r, kf19=^Af\r, kf2=^AA\r, + kf20=^Ag\r, kf21=^Ah\r, kf22=^Ai\r, kf23=^Aj\r, kf24=^Ak\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, kprt=\EP, mc0=\EP, mc4=^T, mc5=\Ed#, + nel=^_, prot=\E), rev=\EG4, ri=\Ej, rmacs=\EcD, rmam=\Ed., + rmcup=\Ec21\Ec31, rmir=\Er, rmso=\EG0, rmxon=\Ec20\Ec30, + rs2=\Eu\E~4\Ee6\EC\EDF\Ec21\Ec31\Ec62\Ec72\Ee;\016\E'\EeL\E` + 9\E\^0\E`1\E`4\Ee.\E`\:\Ee)\Ew\EwG\Ew0\Ee1\EG0\E(\Ed/ + \Ee4\Ed*\EO\E`I\Er\Ee"\Ec@0B\EcD\024, + sgr=\E(\EG%{48}%?%p1%p3%O%t%{4}%+%;%?%p2%t%{8}%+%;%?%p4%t + %{2}%+%;%?%p5%t%{64}%+%;%?%p7%t%{1}%+%;%c%?%p8%t\E)%;%? + %p9%t\EcE%e\EcD%;, + sgr0=\E(\EG0, smacs=\EcE, smam=\Ed/, smcup=\Ec20\Ec30, + smir=\Eq, smso=\EG4, smxon=\Ec21\Ec31, tsl=\EF, + +# This is the american terminal. Here tabs work. +# From: Francesco Potorti` , 24 Aug 1998 +wy99fa|wy99fgta|wy-99fgta|Wyse WY-99GT (US PC keyboard), + hts=\E1, tbc=\E0, use=wy99f, + +# +# The Wyse 160 is combination of the WY-60 and the WY-99gt. +# The reset strings are slow and the pad times very depending +# on other parameters such as font loading. I have tried +# to follow the following outline: +# +# -> set personality +# -> set number of columns +# -> set number of lines +# -> select the proper font +# -> do the initialization +# -> set up display memory (2 pages) +# +# The display memory may be used for either text or graphics. +# When "Display Memory = Shared" the terminal will have more pages +# but garbage may be left on the screen when you switch from +# graphics to text. If "Display Memory = Unshared" then the +# text area will be only one page long. +# +# (wy160: we use \E{ rather than ^^ for home (both are documented) to avoid +# a bug reported by Robert Dunn, -- esr) +wy160|wyse160|Wyse 160, + am, bw, hs, km, mc5i, mir, msgr, + cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#38, + acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<30>, + cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<5>, + dclk=\E`b, dim=\EGp, dl1=\ER$<1>, dsl=\EF\r, ed=\EY$<30>, + el=\ET$<5>, flash=\E`8$<100/>\E`9, fsl=^M, home=\E{, ht=^I, + hts=\E1, il1=\EE$<1>, ind=\n$<1>, ip=$<2>, is1=\EcB0\EcC1, + is2=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016 + \024\El, + is3=\Ew0$<100>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, + kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, + kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=\E{^K, + mc0=\EP, mc4=^T, mc5=\Ed#, nel=\r\n$<1>, + pfloc=\EZ2%p1%{63}%+%c%p2%s\177, + pfx=\EZ1%p1%{63}%+%c%p2%s\177, + pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<1>, + rmacs=\EcD, rmam=\Ed., rmclk=\E`c, rmcup=\Ew0, rmir=\Er, + rmln=\EA11, rmxon=\Ec20, rs1=\E~!\E~4$<70>, + rs2=\E`\:$<100>, rs3=\EwG\Ee($<140>, + sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8} + %|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t + %{64}%|%;%?%p7%t%{1}%|%;%c, + sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, + smcup=\Ew1, smir=\Eq, smln=\EA10, smso=\EGt, smxon=\Ec21, + tbc=\E0, tsl=\EF, use=adm+sgr, +# +wy160-w|wyse160-w|wyse 160 132-column, + cols#132, lw#7, nlab#16, wsl#90, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<9>, + rs2=\EeF$<150>\E`;$<150>, use=wy160, +# +wy160-25|wyse160-25|wyse 160 80-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<200>, use=wy160, +wy160-25-w|wyse160-25-w|wyse 160 132-column 25-lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<200>, use=wy160-w, +# +wy160-42|wyse160-42|wyse 160 80-column 42-lines, + lines#42, + clear=\E+$<50>, dl1=\ER$<2>, ed=\Ey$<50>, il1=\EE$<2>, + ind=\n$<2>, is1=\EcB2\EcC3, nel=\r\n$<2>, ri=\Ej$<2>, + rs3=\Ee*$<150>, use=wy160, +wy160-42-w|wyse160-42-w|wyse 160 132-column 42-lines, + cols#132, lw#7, nlab#16, wsl#90, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<8>, ip=$<3>, + rs2=\EeF$<150>\E`;$<150>, use=wy160-42, +# +wy160-43|wyse160-43|wyse 160 80-column 43-lines, + lh@, lines#43, lw@, nlab@, + pln@, rs3=\Ee+$<150>, use=wy160-42, +wy160-43-w|wyse160-43-w|wyse 160 132-column 43-lines, + lh@, lines#43, lw@, nlab@, + pln@, rs3=\Ee+$<150>, use=wy160-42-w, +# +wy160-vb|wyse160-vb|Wyse 160 visible bell, + bel@, use=wy160, +wy160-w-vb|wy160-wvb|wyse160-wvb|Wyse 160 132-column visible bell, + bel@, use=wy160-w, +# +# The Wyse 75 is a vt100 lookalike without advanced video. +# +# The Wyse 75 can support one attribute (e.g. Dim, Inverse, +# Underline) without magic cookies. The following description +# uses this capability, but when more than one attribute is +# put on the screen at once, all attributes will be changed +# to be the same as the last attribute given. +# The Wyse 75 can support more attributes when used with magic +# cookies. The wy75-mc terminal description uses magic cookies +# to correctly handle multiple attributes on a screen. +# +wy75|wyse75|wyse 75, + am, hs, mc5i, mir, msgr, xenl, xon, + cols#80, lines#24, ma#1, pb#1201, wsl#78, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[J$<30>, + cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr$<2>, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP$<3*>, + dch1=\E[P$<3>, dim=\E[0t\E[2m, dl=\E[%p1%dM$<1*>, + dl1=\E[M, dsl=\E[>\,\001\001\E[>-\001\001, + ech=\E[%p1%dX, ed=\E[J$<30>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E)0, flash=\E[30h\E\,$<250/>\E[30l, fsl=^A, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, + ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, + ind=\n$<2>, ip=$<1>, + is1=\E[2;4;20;30l\E[?1;10l\E[12h\E[?7;8;25h, + is2=\E>\E(B\E)0\017, is3=\E[m, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdl1=\E[M, kel=\E[K, + kf1=\E[?5i, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[?3i, + kf20=\E[34~, kf21=\E[35~, kf3=\E[2i, kf4=\E[@, kf5=\E[M, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + khlp=\E[28~, khome=\E[H, kich1=\E[@, kil1=\E[L, knp=\E[6~, + kpp=\E[5~, kprt=\E[?5i, kslt=\E[4~, mc0=\E[0i, mc4=\E[4i, + mc5=\E[5i, rc=\E8, rev=\E[1t\E[7m, ri=\EM$<2>, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, rmul=\E[m, + rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<80>, rs3=\E[?5l, + sc=\E7, + sgr=%?%p5%t\E[0t%;%?%p3%p1%|%t\E[1t%;%?%p2%t\E[2t%;%?%p4%t + \E[3t%;%?%p1%p2%p3%p4%p5%|%|%|%|%t\E[7m%e\E[m%;%?%p9%t + \016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1l\E[?7h\E=, smso=\E[1t\E[7m, smul=\E[2t\E[4m, + tbc=\E[3g, tsl=\E[>\,\001, use=vt220+keypad, +# +# This terminal description uses the non-hidden attribute mode +# (with magic cookie). +# +wy75-mc|wyse75-mc|wyse 75 with magic cookies, + msgr@, + ma@, xmc#1, + blink=\E[2p, dim=\E[1p, invis=\E[4p, is3=\E[m\E[p, + rev=\E[16p, rmacs=\E[0p\017, rmso=\E[0p, rmul=\E[0p, + sgr=\E[%{0}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{16}%|%;%? + %p4%t%{2}%|%;%?%p1%p5%|%t%{1}%|%;%?%p7%t%{4}%|%;%dp%?%p9 + %t\016%e\017%;, + sgr0=\E[0p\017, smacs=\E[0p\016, smso=\E[17p, smul=\E[8p, + use=wy75, +wy75-vb|wyse75-vb|wyse 75 with visible bell, + pb@, + bel@, use=wy75, +wy75-w|wyse75-w|wyse 75 in 132 column mode, + cols#132, wsl#130, + rs2=\E[35h\E[?3h$<80>, use=wy75, +wy75-wvb|wyse75-wvb|wyse 75 with visible bell 132 columns, + pb@, + bel@, use=wy75-w, +# +# Wyse 85 emulating a vt220 7 bit mode. +# 24 line screen with status line. +# +# The vt220 mode permits more function keys but it wipes out +# the escape key. I strongly recommend that be set to +# escape (esc). +# The terminal may have to be set for 8 data bits and 2 stop +# bits for the arrow keys to work. +# The Wyse 85 runs faster with XON/XOFF enabled. Also the +# and work best when XON/XOFF is set. and +# leave trash on the screen when used without XON/XOFF. +# +wy85|wyse85|wyse 85, + am, hs, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<110>, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP$<3*>, dch1=\E[P$<3>, dim=\E[2m, + dl=\E[%p1%dM$<3*>, dl1=\E[M$<3>, dsl=\E[40l, + ech=\E[%p1%dX, ed=\E[J$<110>, el=\E[K$<1>, el1=\E[1K, + enacs=\E)0, flash=\E[30h\E\,$<300/>\E[30l, + fsl=\E[1;24r\E8, home=\E[H, ht=\011$<1>, hts=\EH, + ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, + ind=\n$<3>, invis=\E[8m, ip=$<3>, is1=\E[62;1"p\E[?5W, + is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h$<16>, + is3=\E>\E(B\E)0\017\E[m, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, + khome=\E[26~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, + mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM$<3>, + rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, + rmul=\E[m, rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<70>, + rs3=\E[?5l, sc=\E7, + sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%? + %p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[40h\E7\E[25;%i%p1%dH, use=vt220+keypad, +# +# Wyse 85 with visual bell. +wy85-vb|wyse85-vb|wyse 85 with visible bell, + bel@, flash=\E[30h\E\,$<300/>\E[30l, use=wy85, +# +# Wyse 85 in 132-column mode. +wy85-w|wyse85-w|wyse 85 in 132-column mode, + cols#132, wsl#132, + rs2=\E[35h$<70/>\E[?3h, use=wy85, +# +# Wyse 85 in 132-column mode with visual bell. +wy85-wvb|wyse85-wvb|wyse 85 with visible bell 132-columns, + bel@, use=wy85-w, + +# From: Kevin Turner , 12 Jul 1998 +# This copes with an apparent firmware bug in the wy85. He writes: +# "What I did was change leave the terminal cursor keys set to Normal +# (instead of application), and change \E[ to \233 for all the keys in +# terminfo. At one point, I found some reference indicating that this +# terminal bug (not sending \E[) was acknowledged by Wyse (so it's not just +# me), but I can't find that and the server under my bookmark to "Wyse +# Technical" isn't responding. So there's the question of whether the wy85 +# terminfo should reflect the manufactuer's intended behaviour of the terminal +# or the actual." +wy85-8bit|wyse85-8bit|wyse 85 in 8-bit mode, + am, hs, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<110>, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP$<3*>, dch1=\E[P$<3>, dim=\E[2m, + dl=\E[%p1%dM$<3*>, dl1=\E[M$<3>, dsl=\E[40l, + ech=\E[%p1%dX, ed=\E[J$<110>, el=\E[K$<1>, el1=\E[1K, + enacs=\E)0, flash=\E[30h\E\,$<300/>\E[30l, + fsl=\E[1;24r\E8, home=\E[H, ht=\011$<1>, hts=\EH, + ich=\E[%p1%d@$<4*>, il=\E[%p1%dL$<5*>, il1=\E[L$<5>, + ind=\n$<3>, invis=\E[8m, ip=$<3>, is1=\E[62;1"p\E[?5W, + is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h$<16>, + is3=\E>\E(B\E)0\017\E[m, ka1=\EOw, ka3=\EOy, kb2=\EOu, + kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\233D, kcud1=\233B, + kcuf1=\233C, kcuu1=\233A, kdch1=\2333~, kent=\EOM, + kf1=\EOP, kf10=\23321~, kf11=\23323~, kf12=\23324~, + kf13=\23325~, kf14=\23326~, kf15=\23328~, kf16=\23329~, + kf17=\23331~, kf18=\23332~, kf19=\23333~, kf2=\EOQ, + kf20=\23334~, kf3=\EOR, kf4=\EOS, kf6=\23317~, kf7=\23318~, + kf8=\23319~, kf9=\23320~, kfnd=\2331~, khlp=\23328~, + khome=\23326~, kich1=\2332~, knp=\2336~, kpp=\2335~, + kslt=\2334~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, + mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, ri=\EM$<3>, + rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[m, + rmul=\E[m, rs1=\E[13l\E[3l\E!p, rs2=\E[35h\E[?3l$<70>, + rs3=\E[?5l, sc=\E7, + sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%? + %p6%t;1%;%?%p7%t;8%;+m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[40h\E7\E[25;%i%p1%dH, +# +# Wyse 185 emulating a vt320 7 bit mode. +# +# This terminal always displays 25 lines. These lines may be used +# as 24 data lines and a terminal status line (top or bottom) or +# 25 data lines. The 48 and 50 line modes change the page size +# and not the number of lines on the screen. +# +# The Compose Character key can be used as a meta key if changed +# by set-up. +# +wy185|wyse185|wyse 185, + am, hs, km, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr$<20>, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<3>, dch1=\E[P$<3>, + dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, + dsl=\E7\E[99;0H\E[K\E8, ech=\E[%p1%dX, ed=\E[J$<40>, + el=\E[K, el1=\E[1K, enacs=\E)0, + flash=\E[30h\E\,$<100/>\E[30l, fsl=\E[1;24r\E8, + home=\E[H, hpa=\E[%i%p1%d`, ht=^I, hts=\EH, + ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, il1=\E[L$<3>, + ind=\n$<2>, invis=\E[8m, ip=$<4>, is1=\E[?5W, + is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h, + is3=\E>\E(B\E)0\017\E[m, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, + kf4=\EOS, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kfnd=\E[1~, khlp=\E[28~, khome=\E[26~, kich1=\E[2~, + knp=\E[6~, kpp=\E[5~, kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, + lf4=PF4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, + ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, rmcup=\E[ R, rmir=\E[4l, + rmkx=\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, rs2=\E[35h\E[?3l, + rs3=\E[?5l\E[47h\E[40l\E[r, sc=\E7, + sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%? + %p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[ Q, + smir=\E[4h, smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E7\E[99;%i%p1%dH, vpa=\E[%i%p1%dd, + use=vt220+keypad, +# +# Wyse 185 with 24 data lines and top status (terminal status) +wy185-24|wyse185-24|wyse 185 with 24 data lines, + hs@, + dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, + use=wy185, +# +# Wyse 185 with visual bell. +wy185-vb|wyse185-vb|wyse 185+flash, + bel@, use=wy185, +# +# Wyse 185 in 132-column mode. +wy185-w|wyse185-w|wyse 185 in 132-column mode, + cols#132, wsl#132, + dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, + ip=$<7>, rs2=\E[35h\E[?3h, use=wy185, +# +# Wyse 185 in 132-column mode with visual bell. +wy185-wvb|wyse185-wvb|wyse 185+flash+132 cols, + bel@, use=wy185-w, + +# wy325 terminfo entries +# Done by Joe H. Davis 3-9-92 + +# lines 25 columns 80 +# +wy325|wyse325|Wyse epc, + am, bw, hs, mc5i, mir, + cols#80, lh#1, lines#24, lw#8, nlab#8, pb#9601, wsl#45, + acsc=+/\,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<50>, + cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<7>, + dim=\EGp, dl1=\ER$<3>, dsl=\EF\r, ed=\EY$<50>, el=\ET$<4>, + flash=\E`8$<100/>\E`9, fsl=^M, home=^^, ht=^I, hts=\E1, + il1=\EE$<3>, ind=\n$<3>, ip=$<2>, is1=\EcB0\EcC1, + is2=\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024 + \El, + is3=\Ew0$<16>, kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kent=\E7, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, + kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, + kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, + kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\Eq, + kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, ll=^^^K, + mc0=\EP, mc4=^T, mc5=\Ed#, + pfloc=\EZ2%p1%{63}%+%c%p2%s\177, + pfx=\EZ1%p1%{63}%+%c%p2%s\177, + pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<2>, + rmacs=\EcD, rmam=\Ed., rmcup=\Ew0, rmir=\Er, rmln=\EA11, + rs1=\E~!\E~4$<30>, rs2=\EeF\E`\:$<70>, + rs3=\EwG\Ee($<100>, + sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EcE%e\EcD%;\EG%{48}%?%p2%t%{8} + %|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t + %{64}%|%;%?%p7%t%{1}%|%;%c, + sgr0=\E(\EH\003\EG0\EcD, smacs=\EcE, smam=\Ed/, + smcup=\Ew1, smir=\Eq, smln=\EA10, smso=\EGt, tbc=\E0, + tsl=\EF, use=adm+sgr, + +# +# lines 24 columns 80 vb +# +wy325-vb|wyse325-vb|wyse-325 with visual bell, + bel@, use=wy325, + +# +# lines 24 columns 132 +# +wy325-w|wyse325-w|wy325w-24|wyse-325 in wide mode, + cols#132, lw#7, nlab#16, wsl#97, + cup=\Ea%i%p1%dR%p2%dC, dch1=\EW$<12>, ip=$<4>, + rs2=\E`;$<70>, use=wy325, +# +# lines 25 columns 80 +# +wy325-25|wyse325-25|wy325-80|wyse-325|wyse-325 25 lines, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy325, +# +# lines 25 columns 132 +# +wy325-25w|wyse325-25w|wy325 132 columns, + lh@, lines#25, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, +# +# lines 25 columns 132 vb +# +wy325-w-vb|wy325-wvb|wyse325-wvb|wyse-325 wide mode reverse video, + bel@, use=wy325-w, + +# +# lines 42 columns 80 +# +wy325-42|wyse325-42|wyse-325 42 lines, + lh@, lines#42, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy325, +# +# lines 42 columns 132 +# +wy325-42w|wyse325-42w|wyse-325 42 lines wide mode, + lh@, lines#42, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, +# +# lines 42 columns 132 vb +# +wy325-42w-vb|wy325-42wvb|wyse-325 42 lines wide mode visual bell, + bel@, use=wy325-w, +# +# lines 43 columns 80 +# +wy325-43|wyse325-43|wyse-325 43 lines, + lh@, lines#43, lw@, nlab@, + pln@, use=wy325, +# +# lines 43 columns 132 +# +wy325-43w|wyse325-43w|wyse-325 43 lines wide mode, + lh@, lines#43, lw@, nlab@, + pln@, rs3=\EwG\Ee)$<100>, use=wy325-w, +# +# lines 43 columns 132 vb +# +wy325-43w-vb|wy325-43wvb|wyse-325 43 lines wide mode visual bell, + bel@, use=wy325-w, + +# Wyse 370 -- 24 line screen with status line. +# +# The terminal may have to be set for 8 data bits and 2 stop +# bits for the arrow keys to work. +# +# If you change keyboards the terminal will send different +# escape sequences. +# The following definition is for the basic terminal without +# function keys. +# +# -> enter Tektronix 4010/4014 mode +# -> exit Tektronix 4010/4014 mode +# -> enter ASCII mode (from any ANSI mode) +# -> exit ASCII mode (goto native ANSI mode) +# -> enter Tek 4207 ANSI mode (from any ANSI mode) +# -> exit Tek 4207 mode (goto native ANSI mode) +# +# Bug: The capability resets attributes. +wy370-nk|wyse 370 without function keys, + am, ccc, hs, mc5i, mir, msgr, xenl, xon, + colors#64, cols#80, it#8, lines#24, ncv#48, pairs#64, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH$<1>, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<1*>, dch1=\E[P$<1>, + dclk=\E[31h, dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, + dsl=\E[40l, ech=\E[%p1%dX$<.1*>, ed=\E[J$<40>, + el=\E[K$<10>, el1=\E[1K$<12>, enacs=\E)0, + flash=\E[30h\E\,$<300/>\E[30l, fsl=\E[1;24r\E8, + home=\E[H, hpa=\E[%i%p1%d`, ht=\011$<1>, hts=\EH, + ich=\E[%p1%d@$<1*>, il=\E[%p1%dL$<2*>, il1=\E[L$<2>, + ind=\n$<2>, + initc=\E[66;%p1%d;%?%p2%{250}%<%t%{0}%e%p2%{500}%<%t%{16}%e + %p2%{750}%<%t%{32}%e%{48}%;%?%p3%{250}%<%t%{0}%e%p3 + %{500}%<%t%{4}%e%p3%{750}%<%t%{8}%e%{12}%;%?%p4%{250} + %<%t%{0}%e%p4%{500}%<%t%{1}%e%p4%{750}%<%t%{2}%e%{3}%; + %{1}%+%+%+%dw, + invis=\E[8m, ip=$<1>, is1=\E[90;1"p\E[?5W$<6>, + is2=\E[2;4;20;30;40l\E[?1;10;16l\E[12h\E[?7;8;25h, + is3=\E>\017\E)0\E(B\E[63;0w\E[m, mc0=\E[0i, mc4=\E[4i, + mc5=\E[5i, + oc=\E[60w\E[63;0w\E[66;1;4w\E[66;2;13w\E[66;3;16w\E[66;4;49w + \E[66;5;51w\E[66;6;61w\E[66;7;64w, + op=\E[m, rc=\E8, rev=\E[7m, ri=\EM$<2>, rmacs=^O, + rmam=\E[?7l, rmclk=\E[31l, rmcup=\E[ R, rmir=\E[4l, + rmkx=\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\E[13l\E[3l\E!p\E[?4i, rs2=\E[35h\E[?3l$<8>, + rs3=\E[?5l, sc=\E7, setb=\E[62;%p1%dw, setf=\E[61;%p1%dw, + sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%? + %p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[ Q, + smir=\E[4h, smkx=\E[?1l\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E[40l\E[40h\E7\E[99;%i%p1%dH, + u0=\E[?38h\E8, u1=\E[?38l\E)0, u2=\E[92;52"p, u3=\E~B, + u4=\E[92;76"p, u5=\E%!1\E[90;1"p, vpa=\E[%i%p1%dd, +# +# Function key set for the ASCII (wy-50 compatible) keyboard +# This is the default 370. +# +wy370|wyse370|wy370-101k|Wyse 370 with 101 key keyboard, + kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\EOQ, kdl1=\EOQ, kent=\EOM, kf1=\E[?4i, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf2=\E[?3i, + kf3=\E[2i, kf4=\E[@, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[H, kich1=\EOP, kil1=\EOP, + knp=\E[U, kpp=\E[V, use=wy370-nk, +# +# Function key set for the VT-320 (and wy85) compatible keyboard +# +wy370-105k|Wyse 370 with 105 key keyboard, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + khlp=\E[28~, khome=\E[26~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, kslt=\E[4~, lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, + use=wy370-nk, use=vt220+keypad, +# +# Function key set for the PC compatible keyboard +# +wy370-EPC|Wyse 370 with 102 key keyboard, + kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kend=\E[1~, kent=\EOM, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kf5=\E[M, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[H, kich1=\E[2~, knp=\E[U, kpp=\E[V, use=wy370-nk, +# +# Wyse 370 with visual bell. +wy370-vb|Wyse 370 with visible bell, + bel@, use=wy370, +# +# Wyse 370 in 132-column mode. +wy370-w|Wyse 370 in 132-column mode, + cols#132, wsl#132, + rs2=\E[35h\E[?3h$<70>, use=wy370, +# +# Wyse 370 in 132-column mode with visual bell. +wy370-wvb|Wyse 370 with visible bell 132-columns, + flash=\E[30h\E\,$<300/>\E[30l, use=wy370-w, +wy370-rv|Wyse 370 reverse video, + rs3=\E[32h\E[?5h, use=wy370, +# +# Wyse 99gt Tektronix 4010/4014 emulator, +# +wy99gt-tek|Wyse 99gt Tektronix 4010/4014 emulator, + am, os, + cols#74, lines#35, + bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, + cup=\035%{3040}%{89}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31} + %&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004} + %/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/ + %{31}%&%{64}%+%c\037, + cuu1=^K, ff=^L, + hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH + \037, + home=^]7`x @\037, + hu=\036DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD + \037, + is2=\E8, nel=^M^J, u0=\E~>\E8, u1=\E[42h, +# +# Wyse 160 Tektronix 4010/4014 emulator, +# +wy160-tek|Wyse 160 Tektronix 4010/4014 emulator, + cup=\035%{3103}%{91}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31} + %&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004} + %/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/ + %{31}%&%{64}%+%c\037, + home=^]8`g @\037, use=wy99gt-tek, +# +# Wyse 370 Tektronix 4010/4014 emulator, +# +wy370-tek|Wyse 370 Tektronix 4010/4014 emulator, + am, os, + cols#80, lines#36, + bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, + cup=\035%{775}%{108}%p1%*%{5}%/%-%Py%p2%{64}%*%{4}%+%{5}%/ + %Px%gy%{32}%/%{31}%&%{32}%+%c%gy%{31}%&%{96}%+%c%gx%{32} + %/%{31}%&%{32}%+%c%gx%{31}%&%{64}%+%c\037, + cuu1=^K, ff=^L, + hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH + \037, + home=^]8g @\037, + hu=\036DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD + \037, + is2=\E8, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^I, kcuu1=^K, + nel=^M^J, u0=\E[?38h\E8, u1=\E[?38l\E)0, + +# Vendor-supplied Wyse entries end here. + +# +#TITLE: TERMINFO ENTRY WY520 +#DATE: 8/5/93 +# The WY520 terminfo is based on the WY285 entry published on the WYSE +# BBS with the addition of more function keys and special keys. +# +# rs1 -> set personality +# rs2 -> set number of columns +# rs3 -> set number of lines +# is1 -> select the proper font +# is2 -> do the initialization +# is3 -> If this string is empty then rs3 gets sent. +# +# Wyse 520 emulating a vt420 7 bit mode with default ANSI keyboard +# - The BS key is programmed to generate BS in smcup since +# is2 doesn't seem to work. +# - Remove and shift/Remove: delete a character +# - Insert : enter insert mode +# - Find : delete to end of file +# - Select : clear a line +# - F11, F12, F13: send default sequences (not ESC, BS, LF) +# - F14 : Home key +# - Bottom status line (host writable line) is used. +# - smkx,rmkx are removed because this would put the numeric +# keypad in Dec application mode which doesn't seem to work +# with SCO applications. +# +wy520|wyse520|wyse 520, + am, hs, km, mc5i, mir, xenl, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J$<40>, cnorm=\E[34h\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr$<20>, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?25h\E[34l, dch=\E[%p1%dP$<3>, dch1=\E[P$<30>, + dim=\E[2m, dl=\E[%p1%dM$<2*>, dl1=\E[M$<2>, dsl=\E[0$~, + ech=\E[%p1%dX, ed=\E[J$<40>, el=\E[K, el1=\E[1K, + enacs=\E)0, fsl=\E[0$}, home=\E[H, hpa=\E[%i%p1%d`, ht=^I, + hts=\EH, ich=\E[%p1%d@$<2>, il=\E[%p1%dL$<3*>, + il1=\E[L$<3>, ind=\n$<2>, invis=\E[8m, ip=$<4>, is1=\E[?5W, + is2=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25;67h, + is3=\E>\E(B\E)0\017\E[m, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, ked=\E[1~, + kel=\E[4~, kent=\EOM, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf20=\E[34~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, khome=\E[26~, + kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, lf1=PF1, + lf2=PF2, lf3=PF3, lf4=PF4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + rc=\E8, rev=\E[7m, ri=\EM$<2>, rmacs=^O, rmam=\E[?7l, + rmcup=\E[ R, rmir=\E[4l, rmso=\E[m, rmul=\E[24m, + rs1=\E[13l\E[3l\E\\\E[63;1"p\E[!p, rs2=\E[35h\E[?3l, + rs3=\E[?5l\E[47h\E[40l\E[r, sc=\E7, + sgr=\E[0%?%p2%t;4%;%?%p3%p1%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%? + %p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, + smcup=\E[ Q\E[?67;8h, smir=\E[4h, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E[2$~\E[1$}\E[%i%p1%d`, + vpa=\E[%i%p1%dd, use=vt220+keypad, +# +# Wyse 520 with 24 data lines and status (terminal status) +wy520-24|wyse520-24|wyse 520 with 24 data lines, + hs@, + dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, + use=wy520, +# +# Wyse 520 with visual bell. +wy520-vb|wyse520-vb|wyse 520 with visible bell, + flash=\E[30h\E\,$<100/>\E[30l, use=wy520, +# +# Wyse 520 in 132-column mode. +wy520-w|wyse520-w|wyse 520 in 132-column mode, + cols#132, wsl#132, + dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, + ip=$<7>, rs2=\E[35h\E[?3h, use=wy520, +# +# Wyse 520 in 132-column mode with visual bell. +wy520-wvb|wyse520-wvb|wyse 520 with visible bell 132-columns, + flash=\E[30h\E\,$<100/>\E[30l, use=wy520-w, +# +# +# Wyse 520 emulating a vt420 7 bit mode. +# The DEL key is programmed to generate BS in is2. +# With EPC keyboard. +# - 'End' key will clear till end of line on EPC keyboard +# - Shift/End : ignored. +# - Insert : enter insert mode. +# - Delete : delete a character (have to change interrupt character +# to CTRL-C: stty intr '^c') for it to work since the +# Delete key sends 7FH. +wy520-epc|wyse520-epc|wyse 520 with EPC keyboard, + kdch1=\177, kel=\E[4~, kend=\E[4~, kf0=\E[21~, kf1=\E[11~, + kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, khome=\E[H, + use=wy520, +# +# Wyse 520 with 24 data lines and status (terminal status) +# with EPC keyboard. +wy520-epc-24|wyse520-pc-24|wyse 520 with 24 data lines and EPC keyboard, + hs@, + dsl@, fsl@, rs3=\E[?5l\E[47h\E[40l\E[1;24r, tsl@, + use=wy520-epc, +# +# Wyse 520 with visual bell. +wy520-epc-vb|wyse520-pc-vb|wyse 520 with visible bell and EPC keyboard, + flash=\E[30h\E\,$<100/>\E[30l, use=wy520-epc, +# +# Wyse 520 in 132-column mode. +wy520-epc-w|wyse520-epc-w|wyse 520 in 132-column mode with EPC keyboard, + cols#132, wsl#132, + dch=\E[%p1%dP$<7>, dch1=\E[P$<7>, ich=\E[%p1%d@$<7>, + ip=$<7>, rs2=\E[35h\E[?3h, use=wy520-epc, +# +# Wyse 520 in 132-column mode with visual bell. +wy520-epc-wvb|wyse520-p-wvb|wyse 520 with visible bell 132-columns and EPC keyboard, + flash=\E[30h\E\,$<100/>\E[30l, use=wy520-epc-w, +# +# Wyse 520 in 80-column, 36 lines +wy520-36|wyse520-36|wyse 520 with 36 data lines, + hs@, + lines#36, + dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, + use=wy520, +# +# Wyse 520 in 80-column, 48 lines +wy520-48|wyse520-48|wyse 520 with 48 data lines, + hs@, + lines#48, + dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, + use=wy520, +# +# Wyse 520 in 132-column, 36 lines +wy520-36w|wyse520-36w|wyse 520 with 132 columns and 36 data lines, + cols#132, wsl#132, + rs2=\E[?3h, + rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, + use=wy520-36, +# +# Wyse 520 in 132-column, 48 lines +wy520-48w|wyse520-48w|wyse 520 with 48 data lines, + cols#132, wsl#132, + rs2=\E[?3h, + rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, + use=wy520-48, +# +# +# Wyse 520 in 80-column, 36 lines with EPC keyboard +wy520-36pc|wyse520-36pc|wyse 520 with 36 data lines and EPC keyboard, + hs@, + lines#36, + dsl@, fsl@, rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r, tsl@, + use=wy520-epc, +# +# Wyse 520 in 80-column, 48 lines with EPC keyboard +wy520-48pc|wyse520-48pc|wyse 520 with 48 data lines and EPC keyboard, + hs@, + lines#48, + dsl@, fsl@, rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r, tsl@, + use=wy520-epc, +# +# Wyse 520 in 132-column, 36 lines with EPC keyboard +wy520-36wpc|wyse520-36wpc|wyse 520 with 36 data lines and EPC keyboard, + cols#132, wsl#132, + rs2=\E[?3h, + rs3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|, + use=wy520-36pc, +# +# Wyse 520 in 132-column, 48 lines with EPC keyboard +wy520-48wpc|wyse520-48wpc|wyse 520 with 48 data lines and EPC keyboard, + cols#132, wsl#132, + rs2=\E[?3h, + rs3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|, + use=wy520-48pc, + +# From: John Gilmore +# (wyse-vp: removed , there's no such +# file and we don't know what is -- esr) +wyse-vp|Wyse 50 in ADDS Viewpoint emulation mode with "enhance" on, + OTbs, am, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dch1=\EW, + dl1=\El, ed=\Ek, el=\EK, home=^A, ht=^I, il1=\EM, ind=^J, + is2=\E`\:\E`9\017\Er, kbs=^H, kcub1=^U, kcud1=^J, kcuf1=^F, + kcuu1=^Z, khome=^A, ll=^A^Z, nel=^M^J, rmir=\Er, rmso=^O, + rmul=^O, rs1=\E`\:\E`9\017\Er, sgr0=^O, smir=\Eq, smso=^N, + smul=^N, + +wy75ap|wyse75ap|wy-75ap|wyse-75ap|Wyse WY-75 Applications and Cursor keypad, + is2=\E[1;24r\E[?10;3l\E[?1;25h\E[4l\E[m\E(B\E=, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + khome=\EOH, rmkx=\E[?1l\E>$<10/>, smkx=\E[?1h\E=$<10/>, + use=wy75, + +# From: Eric Freudenthal +wy100q|Wyse 100 for Quotron, + OTbs, + cols#80, lines#24, xmc#1, + cbt=\EI, clear=^Z, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, il1=\EE, invis@, + is2=\E`\:\0\EC\EDF\E0\E'\E(\EA21, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, ri=\Ej, rmir=\Er, smir=\Eq, use=adm+sgr, + +#### Kermit terminal emulations +# +# Obsolete Kermit versions may be listed in the section describing obsolete +# non-ANSI terminal emulators later in the file. +# + +# KERMIT standard all versions. +# Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. +# (kermit: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) +# From: greg small 9-25-84 +kermit|standard kermit, + OTbs, + cols#80, lines#24, + clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, home=\EH, is2=K0 Standard Kermit 9-25-84\n, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, +kermit-am|standard kermit plus auto-margin, + am, + is2=K1 Standard Kermit plus Automatic Margins\n, + use=kermit, +# IBMPC Kermit 1.2. +# Bugs: , : do not work except at beginning of line! does +# not work, but fake with :cl=\EH\EJ (since :cd=\EJ: works at beginning of +# line). +# From: greg small 8-30-84 +pckermit|pckermit12|UCB IBMPC Kermit 1.2, + am, + lines#25, + clear=\EH\EJ, ed@, el@, + is2=K2 UCB IBMPC Kermit 1.2 8-30-84\n, use=kermit, +# IBMPC Kermit 1.20 +# Cannot use line 25, now acts funny like ansi special scrolling region. +# Initialization must escape from that region by cursor position to line 24. +# Cannot use character insert because 1.20 goes crazy if insert at col 80. +# Does not use :am: because autowrap is lost when kermit dropped and restarted. +# From: greg small 12-19-84 +pckermit120|UCB IBMPC Kermit 1.20, + it#8, lines#24, + cud1=\EB, cvvis=\EO\Eq\EEK3, dch1=\EN, dl1=\EM, ht=^I, + il1=\EL, + is2=\EO\Eq\EJ\EY7\sK3\sUCB\sIBMPC\sKermit\s1.20\s\s12-19-84 + \n, + rmir@, rmso=\Eq, smir@, smso=\Ep, use=kermit, +# MS-DOS Kermit 2.27 for the IBMPC +# Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. +# Cannot use line 25, now acts funny like ansi special scrolling region. +# Initialization must escape from that region by cursor position to line 24. +# Does not use am: because autowrap is lost when kermit dropped and restarted. +# Reverse video for standout like H19. +# (msk227: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) +# From: greg small 3-17-85 +msk227|mskermit227|MS-DOS Kermit 2.27 for the IBMPC, + OTbs, am@, + cols#80, it#8, lines#24, + clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + cvvis=\EO\Eq\EG\EwK4, dch1=\EN, dl1=\EM, ed=\EJ, el=\EK, + home=\EH, ht=^I, il1=\EL, + is2=\EO\Eq\EG\Ew\EJ\EY7\sK4\sMS\sKermit\s2.27\sfor\sthe + \sIBMPC\s3-17-85\n, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, rc=\Ek, + rmir=\EO, rmso=\Eq, sc=\Ej, smir=\E@, smso=\Ep, +# MS-DOS Kermit 2.27 with automatic margins +# From: greg small 3-17-85 +msk227am|mskermit227am|UCB MS-DOS Kermit 2.27 with automatic margins, + am, + cvvis=\EO\Eq\EG\EvK5, + is2=\EO\Eq\EG\Ev\EJ\EY7\sK5\sMS\sKermit\s2.27\s+automatic + \smargins\s3-17-85\n, + use=msk227, +# MS-DOS Kermit 2.27 UCB 227.14 for the IBM PC +# Automatic margins now default. Use ansi for highlights. +# Define function keys. +# (msk22714: removed obsolete ":kn#10:" -- esr) +# From: greg small 3-17-85 +msk22714|mskermit22714|UCB MS-DOS Kermit 2.27 UCB 227.14 IBM PC, + am, + bold=\E[1m, cvvis=\EO\Eq\EG\EvK6, + is2=\EO\Eq\EG\Ev\EJ\EY7\sK6\sMS\sKermit\s2.27\sUCB\s227.14 + \sIBM\sPC\s3-17-85\n, + kf0=\E0, kf1=\E1, kf2=\E2, kf3=\E3, kf4=\E4, kf5=\E5, kf6=\E6, + kf7=\E7, kf8=\E8, kf9=\E9, rev=\E[7m, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smso=\E[1m, smul=\E[4m, use=mskermit227, +# This was designed for a VT320 emulator, but it is probably a good start +# at support for the VT320 itself. +# Please send changes with explanations to bug-gnu-emacs@prep.ai.mit.edu. +# (vt320-k3: I added / based on the init string -- esr) +vt320-k3|MS-Kermit 3.00's vt320 emulation, + am, eslok, hs, km, mir, msgr, xenl, + cols#80, it#8, lines#49, pb#9600, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cmdch=\E, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[0$~, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + flash=\E[?5h$<100/>\E[?5l\E[?5h$<100/>\E[?5l\E[?5h$<100/>\E[ + ?5l, + fsl=\E[0$}, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is2=\E>\E F\E[?1h\E[?7h\E[r\E[2$~, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdl1=\E[3~, kf0=\E[21~, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, nel=^M^J, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dL, rmacs=\E(B, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\E(B\E)B\E>\E\sF\E[4;20l\E[12h\E[?1;5;6;38;42l\E[?7;25h + \E[4i\E[?4i\E[m\E[r\E[2$~, + sc=\E7, sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[1$}\r\E[K, vpa=\E[%i%p1%dd, +# From: Joseph Gil 13 Dec 1991 +# ACS capabilities from Philippe De Muyter 30 May 1996 +# (I removed a bogus boolean :mo: and added , , -- esr) +vt320-k311|dec vt320 series as defined by kermit 3.11, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[;H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J, el=\E[K, + flash=\E[?5h$<100/>\E[?5l, fsl=\E[$}, home=\E[H, ht=^I, + hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L$<3/>, + ind=\ED, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, + lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, + rf=/usr/share/tabset/vt100, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, + rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=^N, + smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, tsl=\E[2$~\E[1$}\E[1;%dH, + +######## NON-ANSI TERMINAL EMULATIONS +# + +#### Avatar +# +# These entries attempt to describe Avatar, a terminal emulation used with +# MS-DOS bulletin-board systems. It was designed to give ANSI-like +# capabilities, but with cheaper (shorter) control sequences. Messy design, +# excessively dependent on PC idiosyncracies, but apparently rather popular +# in the BBS world. +# +# No color support. Avatar doesn't fit either of the Tektronix or HP color +# models that terminfo knows about. An Avatar color attribute is the +# low 7 bits of the IBM-PC display-memory attribute. Bletch. +# +# I wrote these entries while looking at the Avatar spec. I don't have +# the facilities to test them. Let me know if they work, or don't. +# +# Avatar escapes not used by these entries (because maybe you're smarter +# and more motivated than I am and can figure out how to wrap terminfo +# around some of them, and because they are weird enough to be funny): +# level 0: +# ^L -- clear window/reset current attribute to default +# ^V^A%p1%c -- set current color attribute, parameter decodes as follows: +# +# bit: 6 5 4 3 2 1 0 +# | | | | | +# +---+---+ | +---+---+ +# | | | +# | | foreground color +# | foreground intensity +# background color +# level 0+: +# ^V^J%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) up by p1 lines +# ^V^K%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) down by p1 lines +# ^V^L%p1%c%p2%c%p3%c -- clear p2 lines and p3 cols w/attr %p1 +# ^V^M%p1%c%p2%c%p3%c%p4%c -- fill p3 lines & p4 cols w/char p2+attr %p1 +# (^V^L and ^V^M set the current attribute as a side-effect.) +# ^V ^Y [...] -- repeat pattern. specifies the number of bytes +# in the pattern, the number of times the pattern +# should be repeated. If either value is 0, no-op. +# The pattern can contain Avatar console codes, +# including other ^V ^Y patterns. +# level 1: +# ^V^O -- clockwise mode on; turn print direction right each time you +# hit a window edge (yes, really). Turned off by CR +# ^V^P -- no-op +# ^V^Q%c -- query the driver +# ^V^R -- driver reset +# ^V^S -- Sound tone (PC-specific) +# ^V^T -- change highlight at current cursor poition to %c +# ^V^U%p1%c%p2%c -- highlight window with attribute +# ^V^V%p1%c%p2%c%p3%c%p4%c%p5%c +# -- define window +# +# From: Eric S. Raymond 1 Nov 1995 +# (The ///// capabilities exist only to +# tell ncurses that the corresponding highlights exist; it should use , +# which is the only method that will actually work for multiple highlights.) +# +# Update by TD - 2004: half of this was inconsistent. Found documentation +# and repaired most of the damage. sgr0 is probably incorrect, but the +# available documentation gives no clues for a workable string. +avatar0|avatar terminal emulator level 0, + am, bce, msgr, + cols#80, it#8, lines#25, + blink=^V^B, bold=^V^A^P, cr=^M, cub1=^V^E, cud1=^V^D, + cuf1=^V^F, cup=\026\010%p1%c%p2%c, cuu1=^V^C, el=^V^G, + ind=^J, invis=^V^A\0, rep=\031%p1%c%p2%c, rev=^V^Ap, + rmacs@, rs2=^L, + sgr=%?%p1%p2%|%p3%|%p6%|%p7%|%t\026\001%?%p7%t%{128}%e%{0}%? + %p1%t%{112}%|%;%?%p2%t%{1}%|%;%?%p3%t%{112}%|%;%?%p6%t + %{16}%|%;%;%c%;%?%p4%t\026\002%;, + sgr0=^V^A^G, smacs@, smso=^V^Ap, smul=^V^A^A, + use=klone+acs, +# From: Eric S. Raymond 1 Nov 1995 +avatar0+|avatar terminal emulator level 0+, + dch1=^V^N, rmir=\026\n\0\0\0\0, smir=^V^I, use=avatar0, +# From: Eric S. Raymond 1 Nov 1995 +avatar|avatar1|avatar terminal emulator level 1, + civis=^V'^B, cnorm=^V'^A, cvvis=^V^C, dl1=^V-, il1=^V+, + rmam=^V", rmir=^V^P, smam=^V$, use=avatar0+, + +#### RBcomm +# +# RBComm is a lean and mean terminal emulator written by the Interrupt List +# maintainer, Ralf Brown. It was fairly popular in the late DOS years (early +# '90s), especially in the BBS world, and still has some loyal users due to +# its very small memory footprint and to a cute macro language. +rbcomm|IBM PC with RBcomm and EMACS keybindings, + am, bw, mir, msgr, xenl, + cols#80, it#8, lines#25, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=^L, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^C, cuf1=^B, + cup=\037%p2%{32}%+%c%p1%{32}%+%c, cuu1=^^, dch1=^W, + dl=\E[%p1%dM, dl1=^Z, ech=\E[%p1%dX, ed=^F5, el=^P^P, ht=^I, + il=\E[%p1%dL, il1=^K, ind=\ED, invis=\E[8m, + is2=\017\035\E(B\E)0\E[?7h\E[?3l\E[>8g, kbs=^H, + kcub1=^B, kcud1=^N, kcuf1=^F, kcuu1=^P, khome=^A, nel=^M\ED, + rc=\E8, rep=\030%p1%c%p2%c, rev=^R, ri=\EM, rmcup=, rmdc=, + rmir=^], rmkx=\E>, rmso=^U, rmul=^U, + rs1=\017\E(B\E)0\025\E[?3l\E[>8g, sc=\E7, sgr0=\E[m, + smcup=, smdc=, smir=^\, smkx=\E=, smso=^R, smul=^T, +rbcomm-nam|IBM PC with RBcomm without autowrap, + am@, + bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, + is2=\017\035\E(B\E)0\E[?7l\E[?3l\E[>8g, kbs=^H, + kcub1=^H, kcud1=^J, nel=^M^J, use=rbcomm, +rbcomm-w|IBM PC with RBcomm in 132 column mode, + cols#132, + bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, + is2=\017\035\E(B\E)0\E[?7h\E[?3h\E[>8g, kbs=^H, + kcub1=^H, kcud1=^J, nel=^M^J, use=rbcomm, + +######## LCD DISPLAYS +# + +#### Matrix Orbital +# from: Eric Z. Ayers (eric@ale.org) +# +# Matrix Orbital 20x4 LCD display +# Command Character is 0xFE (decimal 254, octal 376) +# +# On this device, cursor addressability isn't possible. The LCD expects: +# 0xfe G +# for cup: %p1 == row and %p2 is column +# +# This line: +# cup=\376G%p2%c%p1%c +# LOOKS like it will work, but sometimes only one of the two numbers is sent. +# See the terminfo (5) manpage commented regarding 'Terminals which use "%c"'. +# +# Alas, there is no cursor upline capability on this display. +# +# These entries add some 'sanity stuff' to the clear function. That is, it +# does a 'clear' and also turns OFF auto scroll, turns ON Auto Line Wrapping, +# and turns off the cursor blinking and stuff like that. +# +# NOTE: calling 'beep' turns on the backlight (bell) +# NOTE: calling 'flash' turns it on and back off (visual bell) +# +MtxOrb|Generic Matrix Orbital LCD display, + bel=\376B^A, clear=\376X\376C\376R\376K\376T, + cnorm=\376K\376T, cub1=\376L, cuf1=\376M, + flash=\376B\001$<200>\376F, home=\376H, +MtxOrb204|20x4 Matrix Orbital LCD display, + cols#20, lines#4, use=MtxOrb, +MtxOrb162|16x2 Matrix Orbital LCD display, + cols#16, lines#2, use=MtxOrb, +# The end + +######## OLDER TERMINAL TYPES +# +# This section is devoted to older commercial terminal brands that are now +# discontinued, but known to be still in use or represented by emulations. +# + +#### AT&T (att, tty) +# +# This section also includes Teletype-branded VDTs. +# +# The AT&T/Teletype terminals group was sold to SunRiver Data Systems (now +# Boundless Technologies); for details, see the header comment on the ADDS +# section. +# +# These are AT&T's official terminfo entries. All-caps aliases have been +# removed. +# +att2300|sv80|AT&T 2300 Video Information Terminal 80 column mode, + am, eo, mir, msgr, xon, + cols#80, it#8, lines#24, + bel=^G, clear=\E[H\E[J, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, kbs=^H, kcbt=\E[Z, kclr=\E[J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, + kdl1=\E[M, kf1=\E[1r, kf10=\E[10r, kf11=\E[11r, + kf12=\E[12r, kf13=\E[13r, kf14=\E[14r, kf15=\E[15r, + kf16=\E[16r, kf2=\E[2r, kf3=\E[3r, kf4=\E[4r, kf5=\E[5r, + kf6=\E[6r, kf7=\E[7r, kf8=\E[8r, kf9=\E[9r, khome=\E[H, + kich1=\E[@, kil1=\E[L, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + rev=\E[7m, rmir=\E[4l, rmso=\E[m, sgr0=\E[m, smir=\E[4h, + smso=\E[7m, +att2350|AT&T 2350 Video Information Terminal 80 column mode, + mc0@, mc4@, mc5@, use=att2300, + +# Must setup RETURN KEY - CR, REC'VD LF - INDEX. +# Seems upward compatible with vt100, plus ins/del line/char. +# On sgr, the protection parameter is ignored. +# No check is made to make sure that only 3 parameters are output. +# standout= reverse + half-intensity = 3 | 5. +# bold= reverse + underline = 2 | 3. +# note that half-bright blinking doesn't look different from normal blinking. +# NOTE:you must program the function keys first, label second! +# (att4410: a BSD entry has been seen with the following capabilities: +# , , , , , +# , , , -- esr) +att5410v1|att4410v1|tty5410v1|AT&T 4410/5410 80 columns - version 1, + am, hs, mir, msgr, xon, + cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, + acsc=++\,\,--..00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyz + z{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[2;7m, clear=\E[H\E[J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dim=\E[2m, + dl1=\E[M, ed=\E[J, el=\E[K, fsl=\E8, home=\E[H, ht=^I, + ich1=\E[@, il1=\E[L, ind=^J, invis=\E[8m, is1=\E[?3l\E)0, + is3=\E[1;03q\s\s\sf1\s\s\s\s\s\s\s\s\s\s\s\EOP\E[2;03q\s\s + \sf2\s\s\s\s\s\s\s\s\s\s\s\EOQ\E[3;03q\s\s\sf3\s\s\s\s + \s\s\s\s\s\s\s\EOR\E[4;03q\s\s\sf4\s\s\s\s\s\s\s\s\s\s + \s\EOS\E[5;03q\s\s\sf5\s\s\s\s\s\s\s\s\s\s\s\EOT\E[6;03q + \s\s\sf6\s\s\s\s\s\s\s\s\s\s\s\EOU\E[7;03q\s\s\sf7\s\s + \s\s\s\s\s\s\s\s\s\EOV\E[8;03q\s\s\sf8\s\s\s\s\s\s\s\s + \s\s\s\EOW, + kbs=^H, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, + kf6=\EOU, kf7=\EOV, kf8=\EOW, khome=\E[H, kll=\E[24;1H, + ll=\E[24H, nel=^M^J, + pfx=\E[%p1%1d;%p2%l%2.2dq\s\s\sf%p1%1d\s\s\s\s\s\s\s\s\s\s + \s%p2%s, + pln=\E[%p1%d;00q%p2%:-16s, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, + sc=\E7, + sgr=\E[0%?%p1%p5%|%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 + %|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smso=\E[7m, smul=\E[4m, + tsl=\E7\E[25;%p1%{1}%+%dH, + +att4410v1-w|att5410v1-w|tty5410v1-w|AT&T 4410/5410 132 columns - version 1, + cols#132, wsl#132, + is1=\E[?3h\E)0, rs2=\Ec\E[?3h\E[2;0y, use=att5410v1, + +att4410|att5410|tty5410|AT&T 4410/5410 80 columns - version 2, + OTbs, + pfx=\E[%p1%d;%p2%l%02dq f%p1%d %p2%s, + use=att5410v1, + +att5410-w|att4410-w|4410-w|tty5410-w|5410-w|AT&T 4410/5410 in 132 column mode, + cols#132, wsl#132, + is1=\E[?3h\E)0, rs2=\Ec\E[?3h\E[2;0y, use=att4410, + +# 5410 in terms of a vt100 +# (v5410: added / based on init string -- esr) +v5410|att5410 in terms of a vt100, + am, mir, msgr, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu1=\E[A$<2>, dch1=\E[P, + dl1=\E[M, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ich1=\E[@, + il1=\E[L, ind=^J, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, + rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, + rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;$<2>, + sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, + use=vt100+fnkeys, + +# +# Teletype Model 5420 -- A souped up 5410, with multiple windows, +# even! the 5420 has three modes: scroll, window or page mode +# this terminfo should work in scroll or window mode, but doesn't +# take advantage of any of the differences between them. +# +# Has memory below (2 lines!) +# 3 pages of memory (plus some spare) +# The 5410 sequences for , , ,
, , , , +# , would work for these, but these work in both scroll and window +# mode... Unset insert character so insert mode works +# sets 80 column mode, +# escape sequence: +# 1) turn off all fonts +# 2) function keys off, keyboard lock off, control display off, +# insert mode off, erasure mode off, +# 3) full duplex, monitor mode off, send graphics off, nl on lf off +# 4) reset origin mode +# 5) set line wraparound +# 6) exit erasure mode, positional attribute mode, and erasure extent mode +# 7) clear margins +# 8) program ENTER to transmit ^J, +# We use \212 to program the ^J because a bare ^J will get translated by +# UNIX into a CR/LF. The enter key is needed for AT&T uOMS. +# 1 2 3 4 5 6 7 8 +# set screen color to black, +# No representation in terminfo for the delete word key: kdw1=\Ed +# Key capabilities assume the power-up send sequence... +# This is not strictly necessary, but it helps maximize +# memory usefulness: , +# Alternate sgr0: , +# Alternate sgr: , +# smkx programs the SYS PF keys to send a set sequence. +# It also sets up labels f1, f2, ..., f8, and sends edit keys. +# This string causes them to send the strings - +# when pressed in SYS PF mode. +# (att4415: I added / based on the init string -- esr) +att4415|tty5420|att5420|AT&T 4415/5420 80 cols, + OTbs, db, mir, xon, + lh#2, lm#78, lw#8, nlab#8, wsl#55, + cbt=\E[Z, clear=\E[x\E[J, cnorm=\E[11;0j, cub=\E[%p1%dD, + cud=\E[%p1%dB, cuf=\E[%p1%dC, cup=\E[%i%p1%d;%p2%dx, + cuu=\E[%p1%dA, cvvis=\E[11;1j, dch=\E[%p1%dP, + dl=\E[%p1%dM, ech=\E[%p1%ds\E[%p1%dD, + flash=\E[?5h$<200>\E[?5l, home=\E[x, + hpa=\E[%p1%{1}%+%dG, hts=\EH, ich=\E[%p1%d@, ich1@, + il=\E[%p1%dL, indn=\E[%p1%dE, is1=\E[?3l$<100>, + is2=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h + \E[4i\Ex\E[21;1j\212, + is3=\E[?5l, kbeg=\Et, kcbt=\E[Z, kdch1=\E[P, kdl1=\E[M, + kel=\E[2K, kend=\Ez, kent=\Eent, kf1=\EOc, kf2=\EOd, + kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, + kich1=\E[4h, kil1=\E[L, kind=\E[T, kll=\Eu, knp=\E[U, + kpp=\E[V, kri=\E[S, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, + lf6=F6, lf7=F7, lf8=F8, ll=\Ew, mc0=\E[?2i, mc4=\E[?9i, + mc5=\E[?4i, mrcup=\E[%i%p1%d;%p2%dt, + pfx=\E[%p1%d;%p2%l%02dq F%p1%d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV, + rin=\E[%p1%dF, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[19;0j\E[21;1j\212, rmln=\E|, + sgr=\E[0%?%p1%p5%|%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 + %|%p6%|%t;7%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smam=\E[?7h, smir=\E[4h, + smkx=\E[19;1j\E[21;4j\Eent, smln=\E~, tbc=\E[3g, + tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, + use=att4410, + +att4415-w|tty5420-w|att5420-w|AT&T 4415/5420 132 cols, + cols#132, lm#54, wsl#97, + is1=\E[?3h$<100>, use=att4415, + +att4415-rv|tty5420-rv|att5420-rv|AT&T 4415/5420 80 cols/rv, + flash=\E[?5l$<200>\E[?5h, is3=\E[?5h, use=att4415, + +att4415-w-rv|tty5420-w-rv|att5420-w-rv|AT&T 4415/5420 132 cols/rv, + cols#132, lm#54, wsl#97, + flash=\E[?5l$<200>\E[?5h, is1=\E[?3h$<100>, is3=\E[?5h, + use=att4415, + +# Note that this mode permits programming USER PF KEYS and labels +# However, when you program user pf labels you have to reselect +# user pf keys to make them appear! +att4415+nl|tty5420+nl|att5420+nl|generic AT&T 4415/5420 changes for not changing labels, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + pfx=\E[%p1%d;%p2%l%02d;0;1q\s\s\sF%p1%d\s\s\s\s\s\s\s\s\s\s + \s%p2%s, + pln=\E[%p1%d;0;0;1q%p2%:-16.16s, + +att4415-nl|tty5420-nl|att5420-nl|AT&T 4415/5420 without changing labels, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, + use=att4415, + +att4415-rv-nl|tty5420-rv-nl|att5420-rv-nl|AT&T 4415/5420 reverse video without changing labels, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, + use=att4415-rv, + +att4415-w-nl|tty5420-w-nl|att5420-w-nl|AT&T 4415/5420 132 cols without changing labels, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, + use=att4415-w, + +att4415-w-rv-n|tty5420-w-rv-n|att5420-w-rv-n|AT&T 4415/5420 132 cols reverse without changing labels, + kf1@, kf2@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, use=att4415+nl, + use=att4415-w-rv, + +att5420_2|AT&T 5420 model 2 80 cols, + am, db, hs, mir, msgr, xon, + cols#80, it#8, lh#2, lines#24, lm#78, lw#8, nlab#8, wsl#55, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + blink=\E[5m, cbt=\E[1Z, clear=\EH\EJ, cnorm=\E[11;0j, + cr=\EG, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[1A, + cvvis=\E[11;1j, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, ed=\E[0J, + el=\E[0K, el1=\E[1K, flash=\E[?5h$<200>\E[?5l, fsl=\E8, + home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + indn=\E[%p1%dE, invis=\E[8m, + is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;0j\E[6;0j\E[7;0j + \E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j + \E[29;0j\E[1;24r, + kbeg=\Et, kbs=^H, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, + kel=\E[2K, kend=\Ez, kent=^J, kf1=\EOc, kf2=\EOd, kf3=\EOe, + kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, khome=\E[H, + kich1=\E[4h, kil1=\E[L, kind=\E[T, kll=\Eu, knp=\E[U, + kpp=\E[V, kri=\E[S, lf1=F1, lf2=F2, lf3=F3, lf4=F4, lf5=F5, + lf6=F6, lf7=F7, lf8=F8, ll=\Ew, mc0=\E[?;2i, mc4=\E[4i, + mc5=\E[5i, mrcup=\E[%i%p1%d;%p2%dt, nel=^M^J, + pfx=\E[%p1%d;%p2%l%02dq\s\s\sF%p1%d\s\s\s\s\s\s\s\s\s\s\s%p2 + %s\E~, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s\E~, prot=\EV, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, rmkx=\E[19;0j, + rmln=\E|, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, + sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1 + %|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smkx=\E[19;1j, smln=\E~, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E7\E[25;%p1%{8}%+%dH, vpa=\E[%p1%{1}%+%dd, +att5420_2-w|AT&T 5420 model 2 in 132 column mode, + cols#132, + is1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;1j\E[6;0j\E[7;0j + \E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j + \E[29;0j\E[1;24r, + use=att5420_2, + +att4418|att5418|AT&T 5418 80 cols, + am, xon, + cols#80, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, clear=\E[H\E[2J, cr=^M, cub=\E[%p1%dD, + cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[0K, home=\E[H, + ich=\E[%p1%d@, ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, ind=^J, + is1=\E[?3l, is2=\E)0\E?6l\E?5l, kclr=\E[%%, kcub1=\E@, + kcud1=\EU, kcuf1=\EA, kcuu1=\ES, kent=\E[, kf1=\E[h, + kf10=\E[m, kf11=\E[n, kf12=\E[o, kf13=\E[H, kf14=\E[I, + kf15=\E[J, kf18=\E[K, kf19=\E[L, kf2=\E[i, kf20=\E[E, + kf21=\E[_, kf22=\E[M, kf23=\E[N, kf24=\E[O, kf3=\E[j, + kf6=\E[k, kf7=\E[l, kf8=\E[f, kf9=\E[w, khome=\Ec, rc=\E8, + rev=\E[7m, rmacs=^O, rmso=\E[m, rmul=\E[m, sc=\E7, + sgr0=\E[m\017, smacs=^N, smso=\E[7m, smul=\E[4m, +att4418-w|att5418-w|AT&T 5418 132 cols, + cols#132, + is1=\E[?3h, use=att5418, + +att4420|tty4420|teletype 4420, + OTbs, da, db, eo, msgr, ul, xon, + cols#80, lines#24, lm#72, + bel=^G, clear=\EH\EJ, cr=\EG, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, + dl1=\EM, ed=\EJ, el=\Ez, home=\EH, il1=\EL, ind=\EH\EM\EY7\s, + kcbt=\EO, kclr=\EJ, kcub1=^H, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EP, kdl1=\EM, kf0=\EU, kf3=\E@, khome=\EH, + kich1=\E\^, kil1=\EL, kind=\ES, kri=\ET, + lf0=segment advance, lf3=cursor tab, rmdc@, rmso=\E~, + rmul=\EZ, smdc@, smso=\E}, smul=\E\\, + +# The following is a terminfo entry for the Teletype 4424 +# asynchronous keyboard-display terminal. It supports +# the vi editor. The terminal must be set up as follows, +# +# HIGHLIGHT DEFINITION 3-TONE +# DISPLAY FUNCTION GROUP III +# +# The second entry below provides limited (a la adm3a) +# operation under GROUP II. +# +# This must be used with DISPLAY FUNCTION GROUP I or III +# and HIGHLIGHT DEFINITION 3-TONE +# The terminal has either bold or blink, depending on options +# +# (att4424: commented out =\E[1m, we don't need bright locked on -- esr) +att4424|tty4424|teletype 4424, + OTbs, am, xon, + cols#80, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E3, bold=\E3, cbt=\EO, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\EB, cuf=\E[%p1%dC, cuf1=\EC, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EA, + dch=\E[%p1%dP, dch1=\EP, dim=\EW, dl=\E[%p1%dM, dl1=\EM, + ed=\EJ, el=\Ez, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E\^, il=\E[%p1%dL, il1=\EL, ind=^J, is2=\E[20l\E[?7h, + kbs=^H, kclr=\EJ, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + khome=\E[H, nel=\EE, rev=\E}, ri=\ET, rmacs=\E(B, rmso=\E~, + rmul=\EZ, + sgr=\E[%?%p1%t7%;%?%p2%t;4%;%?%p3%t;7%;%?%p6%t;1%;%?%p6%p4%| + %t;5%;%?%p5%t;0%;m, + sgr0=\EX\E~\EZ\E4\E(B, smacs=\E(0, smso=\E}, smul=\E\\, + tbc=\EF, + +att4424-1|tty4424-1|teletype 4424 in display function group I, + kclr@, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome@, + use=att4424, + +# This entry is not one of AT&T's official ones, it was translated from the +# 4.4BSD termcap file. The highlight strings are different from att4424. +# I have no idea why this is -- older firmware version, maybe? +# The following two lines are the comment originally attached to the entry: +# This entry appears to avoid the top line - I have no idea why. +# From: jwb Wed Mar 31 13:25:09 1982 remote from ihuxp +att4424m|tty4424m|teletype 4424M, + am, da, db, mir, + cols#80, it#8, lines#23, + bel=^G, clear=\E[2;H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH\E[B, cuu1=\E[A, dch1=\EP, + dl1=\EM, el=\E[K, ht=^I, ich1=\E\^, il1=\EL, ind=^J, ip=$<2/>, + is2=\E[m\E[2;24r, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, khome=\E[H, nel=^M^J, ri=\ET, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smso=\E[7m, smul=\E[4m, + +# The Teletype 5425 is really version 2 of the Teletype 5420. It +# is quite similar, except for some minor differences. No page +# mode, for example, so all of the sequences used above have +# to change back to what's being used for the 5410. Many of the +# option settings have changed their numbering as well. +# +# This has been tested on a preliminary model. +# +# (att5425: added / based on the init string -- esr) +att5425|tty5425|att4425|AT&T 4425/5425, + am, da, db, hs, mir, msgr, xenl, xon, + cols#80, it#8, lh#2, lines#24, lm#78, lw#8, nlab#8, wsl#55, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, + clear=\E[H\E[J, cnorm=\E[12;0j, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[12;1j, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%ds\E[%p1%dD, ed=\E[J, + el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, + hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dE, + invis=\E[8m, is1=\E<\E[?3l$<100>, + is2=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h + \E[4i\Ex\E[25;1j\212, + is3=\E[?5l, kbeg=\Et, kbs=^H, kcbt=\E[Z, kclr=\E[J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, + kdl1=\E[M, kel=\E[2K, kend=\Ez, kent=\Eent, kf1=\EOc, + kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, + kf8=\EOj, khome=\E[H, kich1=\E[4h, kil1=\E[L, kind=\E[T, + kri=\E[S, ll=\E[24H, mc0=\E[?2i, mc4=\E[?9i, mc5=\E[?4i, + nel=^M^J, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, prot=\EV, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dF, rmacs=^O, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E[21;0j\E[25;1j\212, rmln=\E|, + rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l\E[2;0y, sc=\E7, + sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6 + %|%t;7%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[21;1j\E[25;4j\Eent\E~, smln=\E~, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, tsl=\E7\E[25;%p1%{8}%+%dH, + vpa=\E[%p1%{1}%+%dd, + +att5425-nl|tty5425-nl|att4425-nl|AT&T 4425/5425 80 columns no labels, + smkx=\E[21;1j\E[25;4j\Eent, use=att4425, + +att5425-w|att4425-w|tty5425-w|teletype 4425/5425 in 132 column mode, + cols#132, lm#54, wsl#97, + is1=\E[?3h$<100>, use=tty5425, + +# (att4426: his had bogus capabilities: :ri=\EM:, :ri=\E[1U:. +# I also added / -- esr) +att4426|tty4426|teletype 4426S, + am, da, db, xon, + cols#80, lines#24, lm#48, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[5m, clear=\E[H\E[2J\E[1U\E[H\E[2J\E[1V, + cr=^M, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\EP, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[0K, home=\E[H, + hpa=\E[%p1%dG, ht=^I, hts=\E1, ich=\E[%p1%d@, ich1=\E\^, + il=\E[%p1%dL, il1=\EL, ind=^J, indn=\E[%p1%dS, + is1=\Ec\E[?7h, is2=\E[m\E[1;24r, kbs=^H, kcbt=\EO, + kclr=\E[2J, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, khome=\E[H, kll=\E[24;1H, ll=\E[24H, + nel=^M^J, rc=\E8, rev=\E[7m, ri=\ET, rin=\E[%p1%dT, + rmacs=\E(B, rmam=\E[?7l, rmso=\E[m, rmul=\E[m, + rs2=\Ec\E[?3l\E[2;0y, sc=\E7, sgr0=\E[m\E(B, smacs=\E(0, + smam=\E[?7h, smso=\E[5m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%p1%dd, + +# Terminfo entry for the AT&T 510 A Personal Terminal +# Function keys 9 - 16 are available only after the +# screen labeled (soft keys/action blocks) are labeled. Function key +# 9 corresponds to the leftmost touch target on the screen, +# function key 16 corresponds to the rightmost. +# +# This entry is based on one done by Ernie Rice at Summit, NJ and +# changed by Anne Gallup, Skokie, IL, ttrdc!anne +att510a|bct510a|AT&T 510A Personal Terminal, + am, mir, msgr, xenl, xon, + cols#80, lh#2, lines#24, lw#7, nlab#8, + acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, + civis=\E[11;0|, clear=\E[H\E[J, cnorm=\E[11;3|, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[11;2|, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, + el=\E[0K, el1=\E[1K, enacs=\E(B\E)1, ff=^L, home=\E[H, ht=^I, + hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E(B\E)1\E[2l, + is3=\E[21;1|\212, kLFT=\E[u, kRIT=\E[v, kbs=^H, kcbt=\E[Z, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, + kf10=\EOd, kf11=\EOe, kf12=\EOf, kf13=\EOg, kf14=\EOh, + kf15=\EOi, kf16=\EOj, kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, + kf6=\ENf, kf7=\ENh, kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, + mc0=\E[0i, mc4=\E[?8i, mc5=\E[?4i, nel=\EE, + pln=\E[%p1%dp%p2%:-16s, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=^O, rmkx=\E[19;0|, rmso=\E[m, rmul=\E[m, sc=\E7, + sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6 + %|%t;7%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smkx=\E[19;1|, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, + +# Terminfo entry for the AT&T 510 D Personal Terminal +# Function keys 9 through 16 are accessed by bringing up the +# system blocks. +# Function key 9 corresponds to the leftmost touch target on the screen, +# function key 16 corresponds to the rightmost. +# +# There are problems with soft key labeling. These are due to +# strangenesses in the native terminal that are impossible to +# describe in a terminfo. +att510d|bct510d|AT&T 510D Personal Terminal, + am, da, db, mir, msgr, xenl, xon, + cols#80, lh#2, lines#24, lm#48, lw#7, nlab#8, + acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, + clear=\E[H\E[J, cnorm=\E[11;3|, cr=^M, cub=\E[%p1%dD, + cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, cvvis=\E[11;2|, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[0K, + el1=\E[1K, enacs=\E(B\E)1, ff=^L, home=\E[H, + hpa=\E[%p1%{1}%+%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, + invis=\E[8m, is1=\E(B\E)1\E[5;0|, is3=\E[21;1|\212, + kLFT=\E[u, kRIT=\E[v, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOm, kf10=\EOd, + kf11=\EOe, kf12=\EOf, kf13=\EOg, kf14=\EOh, kf15=\EOi, + kf16=\EOj, kf2=\EOV, kf3=\EOu, kf4=\ENj, kf5=\ENe, kf6=\ENf, + kf7=\ENh, kf8=\E[H, kf9=\EOc, kind=\E[S, kri=\E[T, ll=\E#2, + mc0=\E[0i, mc4=\E[?8i, mc5=\E[?4i, mgc=\E\:, nel=\EE, + pln=\E[%p1%dp%p2%:-16s, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, + rin=\E[%p1%dT, rmacs=^O, rmir=\E[4l, rmkx=\E[19;0|, + rmln=\E<, rmso=\E[m, rmul=\E[m, rmxon=\E[29;1|, + rs2=\E[5;0|, sc=\E7, + sgr=\E[0%?%p5%p6%|%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1%|%p6 + %|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smgl=\E4, smgr=\E5, smir=\E[4h, + smkx=\E[19;1|, smln=\E?, smso=\E[7m, smul=\E[4m, + smxon=\E[29;0|, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, + +# (att500: I merged this with the att513 entry, att500 just used att513 -- esr) +att500|att513|AT&T 513 using page mode, + am, chts, mir, msgr, xenl, xon, + cols#80, lh#2, lines#24, lw#8, nlab#8, + acsc=+g\,h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[2;7m, cbt=\E[Z, + clear=\E[H\E[J, cnorm=\E[11;0|, cr=^M, + csr=%i\E[%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[11;1|, dch=\E[%p1%dP, dch1=\E[P$<1>, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)1, home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, + hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, + indn=\E[%p1%dE, invis=\E[8m, + is1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l, + kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, + kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, + kFND=\EOX, kHLP=\EOM, kHOM=\ENM, kIC=\ENJ, kLFT=\ENK, + kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, kOPT=\EOR, kPRT=\EOZ, + kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, kRIT=\ENL, kRPL=\EOY, + kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, kbs=^H, kcan=\EOw, + kcbt=\E[Z, kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, + kcrt=\EOn, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=\Eent, + kext=\EOk, kf1=\EOc, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, + kf6=\EOh, kf7=\EOi, kf8=\EOj, kfnd=\EOx, khlp=\EOm, + khome=\E[H, kich1=\ENj, kind=\E[S, kmov=\ENc, kmrk=\ENi, + kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, + kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, + kres=\EOq, krfr=\ENa, kri=\E[T, krpl=\EOy, krst=\EOB, + ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, ll=\E#2, + mc0=\E[?98l\E[0i, mc4=\E[?98l\E[?8i, mc5=\E[?98l\E[?4i, + nel=\EE, + pfkey=\E[%p1%d;%p2%l%d;3;0p\s\s\sF%p1%d\s\s\s\s\s\s\s\s\s\s + \s%p2%s, + pfloc=\E[%p1%d;%p2%l%d;2;0p\s\s\sF%p1%d\s\s\s\s\s\s\s\s\s\s + \s%p2%s, + pfx=\E[%p1%d;%p2%l%d;1;0p F%p1%d %p2%s, + pln=\E[%p1%dp%p2%:-16s, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, + rin=\E[%p1%dF, rmacs=^O, rmir=\E[4l, + rmkx=\E[19;0|\E[21;1|\212, rmln=\E<, rmso=\E[m, + rmul=\E[m, + rs1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l\E[2;0| + \E[6;1|\E[8;0|\E[19;0|\E[1{\E[?99l, + rs2=\E[5;0|, sc=\E7, + sgr=\E[0%?%p1%p5%|%t;2%;%?%p2%p6%|%t;4%;%?%p4%t;5%;%?%p3%p1 + %|%p6%|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smir=\E[4h, + smkx=\E[19;1|\E[21;4|\Eent, smln=\E?, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, + +# 01-07-88 +# printer must be set to EMUL ANSI to accept ESC codes +# stops at top margin +# sets cpi 10,lpi 6,form 66,left 1,right 132,top 1,bottom 66,font +# and alt font ascii,wrap on,tabs cleared +# disables newline on LF,Emphasized off +# The capability sets form length +att5310|att5320|AT&T Model 53210 or 5320 matrix printer, + xhpa, xvpa, + bufsz#8192, cols#132, cps#120, it#8, lines#66, orc#10, + orhi#100, orl#12, orvi#72, + cpi=%?%p1%{10}%=%t\E[w%e%p1%{12}%=%t\E[2w%e%p1%{5}%=%t\E[5w + %e%p1%{13}%=%p1%{14}%=%O%t\E[3w%e%p1%{16}%=%p1%{17}%=%O + %t\E[4w%e%p1%{6}%=%t\E[6w%e%p1%{7}%=%t\E[7w%e%p1%{8}%=%t + \E[8w%;, + cr=^M, + csnm=%?%p1%{0}%=%tusascii%e%p1%{1}%=%tenglish%e%p1%{2}%=%tfi + nnish%e%p1%{3}%=%tjapanese%e%p1%{4}%=%tnorwegian%e%p1 + %{5}%=%tswedish%e%p1%{6}%=%tgermanic%e%p1%{7}%=%tfrench + %e%p1%{8}%=%tcanadian_french%e%p1%{9}%=%titalian%e%p1 + %{10}%=%tspanish%e%p1%{11}%=%tline%e%p1%{12}%=%tsecurit + y%e%p1%{13}%=%tebcdic%e%p1%{14}%=%tapl%e%p1%{15}%=%tmos + aic%;, + cud=\E[%p1%de, cud1=^J, cuf=\E[%p1%da, cuf1=\s, cuu1=\EM, + ff=^L, hpa=\E[%p1%d`, ht=^I, is1=\Ec, is2=\E[20l\r, + lpi=%?%p1%{2}%=%t\E[4z%e%p1%{3}%=%t\E[5z%e%p1%{4}%=%t\E[6z%e + %p1%{6}%=%t\E[z%e%p1%{8}%=%t\E[2z%e%p1%{12}%=%t\E[3z%;, + rshm=\E[m, + scs=%?%p1%{0}%=%t\E(B%e%p1%{1}%=%t\E(A%e%p1%{2}%=%t\E(C%e%p1 + %{3}%=%t\E(D%e%p1%{4}%=%t\E(E%e%p1%{5}%=%t\E(H%e%p1%{6} + %=%t\E(K%e%p1%{7}%=%t\E(R%e%p1%{8}%=%t\E(Q%e%p1%{9}%=%t + \E(Y%e%p1%{10}%=%t\E(Z%e%p1%{11}%=%t\E(0%e%p1%{12}%=%t + \E(1%e%p1%{13}%=%t\E(3%e%p1%{14}%=%t\E(8%e%p1%{15}%=%t + \E(}%;, + smgbp=\E[;%p1%dr, smglp=\E[%{1}%p1%+%ds, + smgrp=\E[;%{1}%p1%+%ds, smgtp=\E[%p1%dr, sshm=\E[5m, + u0=\E[%p1%dt, vpa=\E[%p1%dd, + +# Teletype 5620, firmware version 1.1 (8;7;3) or earlier from BRL +# The following SET-UP modes are assumed for normal operation: +# CR_DEF=CR NL_DEF=INDEX DUPLEX=FULL +# Other SET-UP modes may be set for operator convenience or communication +# requirements. This termcap description is for the Resident Terminal Mode. +# No delays specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# The BRL entry also said: UNSAFE :ll=\E[70H: +att5620-1|tty5620-1|dmd1|Teletype 5620 with old ROMs, + am, xon, + cols#88, it#8, lines#70, vt#3, + bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, + home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, indn=\E[%p1%dS, kbs=^H, kclr=\E[2J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + kll=\E[70;1H, nel=^M^J, rc=\E8, ri=\E[T, rin=\E[%p1%dT, + rs1=\Ec, sc=\E7, + +# 5620 terminfo (2.0 or later ROMS with char attributes) +# The following SET-UP modes are assumed for normal operation: +# DUPLEX=FULL GEN_FLOW=ON NEWLINE=INDEX RETURN=CR +# Other SET-UP modes may be set for operator convenience or communication +# requirements. This termcap description is for Resident Terminal Mode. No +# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# assumptions: (scroll forward one line) is only done at screen bottom +# Be aware that older versions of the dmd have a firmware bug that affects +# parameter defaulting; for this terminal, the 0 in \E[0m is not optional. +# is from an otherwise inferior BRL for this terminal. That entry +# also has =\E[70H commented out and marked unsafe. +# For more, see the 5620 FAQ maintained by David Breneman . +att5620|dmd|tty5620|ttydmd|5620|5620 terminal 88 columns, + OTbs, am, msgr, npc, xon, + cols#88, it#8, lines#70, + bel=^G, bold=\E[2m, clear=\E[H\E[J, cr=^M, cub1=^H, + cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, kbs=^H, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, kll=\E[70;1H, nel=^J, + pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, rev=\E[7m, ri=\E[T, + rin=\E[%p1%dT, rmso=\E[0m, rmul=\E[0m, rs1=\Ec, sc=\E7, + sgr0=\E[0m, smso=\E[7m, smul=\E[4m, +att5620-24|tty5620-24|dmd-24|teletype dmd 5620 in a 24x80 layer, + lines#24, use=att5620, +att5620-34|tty5620-34|dmd-34|teletype dmd 5620 in a 34x80 layer, + lines#34, use=att5620, +# 5620 layer running the "S" system's downloaded graphics handler: +att5620-s|tty5620-s|layer|vitty|5620 S layer, + OTbs, OTpt, am, + cols#80, it#8, lines#72, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, + cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=^K, dl1=\ED, + el=\EK, flash=\E^G, ht=^I, il1=\EI, ind=^J, kbs=^H, kclr=\E[2J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + kll=\E[70;1H, + +# Entries for thru refer to the shifted system pf keys. +# +# Entries for thru refer to the alternate keypad mode +# keys: = * / + 7 8 9 - 4 5 6 , 1 2 3 0 . ENTER +att605|AT&T 605 80 column 102key keyboard, + am, eo, xon, + cols#80, lines#24, lw#8, nlab#8, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K, el1=\E[1K, fsl=\E8, ht=^I, ich=\E[%p1%d@, ich1=\E[@, + il1=\E[L, ind=^J, invis=\E[8m, + is1=\E[8;0|\E[?\E[13;20l\E[?\E[12h, is2=\E[m\017, + kLFT=\E[ A, kRIT=\E[ @, kbs=^H, kcbt=\E[Z, kclr=\E[2J, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, + kdl1=\E[M, kend=\E[24;1H, kf1=\EOc, kf10=\ENp, kf11=\ENq, + kf12=\ENr, kf13=\ENs, kf14=\ENt, kf15=\EOC, kf16=\EOD, + kf17=\EOE, kf18=\EOF, kf19=\EOG, kf2=\EOd, kf20=\EOH, + kf21=\EOI, kf22=\EOJ, kf23=\ENO, kf24=\ENP, kf25=\ENQ, + kf26=\ENR, kf27=\ENS, kf28=\ENT, kf29=\EOP, kf3=\EOe, + kf30=\EOQ, kf31=\EOR, kf32=\EOS, kf33=\EOw, kf34=\EOx, + kf35=\EOy, kf36=\EOm, kf37=\EOt, kf38=\EOu, kf39=\EOv, + kf4=\EOf, kf40=\EOl, kf41=\EOq, kf42=\EOr, kf43=\EOs, + kf44=\EOp, kf45=\EOn, kf46=\EOM, kf5=\EOg, kf6=\EOh, + kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, kich1=\E[@, + kil1=\E[L, kind=\E[S, knp=\E[U, kpp=\E[V, ll=\E[24H, + mc4=\E[?4i, mc5=\E[?5i, nel=\EE, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, + rmacs=^O, rmir=\E[4l, rmln=\E[2p, rmso=\E[m, rmul=\E[m, + rs2=\Ec\E[?3l, sc=\E7, sgr0=\E[m\017, smacs=\E)0\016, + smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m, + tsl=\E7\E[25;%i%p1%dx, +att605-pc|ATT 605 in pc term mode, + acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x + \263, + cbt=\E[Z, cub1=\E[D, cud1=\E[B, cuf1=\E[C, cuu1=\E[A, + dch1=\E[P, dl1=\E[M, ich1=\E[@, il1=\E[L, kcbt=\E[Z, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, + kdl1=\E[M, kend=\E[F, kf1=\E[M, kf10=\E[V, kf2=\E[N, + kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, + kf9=\E[U, khome=\E[H, kich1=\E[@, knp=\E[G, kpp=\E[I, + rmsc=\E[50;0|$<400>, smsc=\E[?11l\E[50;1|$<250>, + xoffc=g, xonc=e, use=att605, +att605-w|AT&T 605-w 132 column 102 key keyboard, + cols#132, wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)0, use=att605, +# (att610: I added / based on the init string. I also +# added and because the BSD file says the att615s have them, +# and the 615 is like a 610 with a big keyboard, and most of their other +# smart terminals support the same sequence -- esr) +att610|AT&T 610; 80 column; 98key keyboard, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, ht=^I, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + indn=\E[%p1%dS, invis=\E[8m, + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0, + is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ @, kRIT=\E[ A, kbs=^H, + kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, + kf13=\ENs, kf14=\ENt, kf2=\EOd, kf3=\EOe, kf4=\EOf, kf5=\EOg, + kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, + kind=\E[S, kri=\E[T, ll=\E[24H, mc4=\E[?4i, mc5=\E[?5i, + nel=\EE, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, + ri=\EM, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, + rmln=\E[2p, rmso=\E[m, rmul=\E[m, rs2=\Ec\E[?3l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 + %|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smln=\E[p, smso=\E[7m, smul=\E[4m, tsl=\E7\E[25;%i%p1%dx, +att610-w|AT&T 610; 132 column; 98key keyboard, + cols#132, wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + use=att610, + +att610-103k|AT&T 610; 80 column; 103key keyboard, + kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, + kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, + kFND=\EOX, kHLP=\EOM, kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, + kOPT=\EOR, kPRT=\EOZ, kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, + kRPL=\EOY, kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, + kcan=\EOw, kclo=\EOV, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, + kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=^M, + kext=\EOk, kf10@, kf11@, kf12@, kf13@, kf14@, kf9@, kfnd=\EOx, + khlp=\EOm, kich1=\ENj, kmov=\ENc, kmrk=\ENi, kmsg=\EOl, + knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, kpp=\E[V, + kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, kres=\EOq, + krfr=\ENa, krmir=\ENj, krpl=\EOy, krst=\EOB, ksav=\EOo, + kslt=\ENI, kspd=\EOp, kund=\EOs, use=att610, +att610-103k-w|AT&T 610; 132 column; 103key keyboard, + cols#132, wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + use=att610-103k, +att615|AT&T 615; 80 column; 98key keyboard, + kLFT=\E[ A, kRIT=\E[ @, kf15=\EOC, kf16=\EOD, kf17=\EOE, + kf18=\EOF, kf19=\EOG, kf20=\EOH, kf21=\EOI, kf22=\EOJ, + kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, kf27=\ENS, + kf28=\ENT, kf29=\EOP, kf30=\EOQ, kf31=\EOR, kf32=\EOS, + kf33=\EOw, kf34=\EOx, kf35=\EOy, kf36=\EOm, kf37=\EOt, + kf38=\EOu, kf39=\EOv, kf40=\EOl, kf41=\EOq, kf42=\EOr, + kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, use=att610, +att615-w|AT&T 615; 132 column; 98key keyboard, + kLFT=\E[ A, kRIT=\E[ @, kf15=\EOC, kf16=\EOD, kf17=\EOE, + kf18=\EOF, kf19=\EOG, kf20=\EOH, kf21=\EOI, kf22=\EOJ, + kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, kf27=\ENS, + kf28=\ENT, kf29=\EOP, kf30=\EOQ, kf31=\EOR, kf32=\EOS, + kf33=\EOw, kf34=\EOx, kf35=\EOy, kf36=\EOm, kf37=\EOt, + kf38=\EOu, kf39=\EOv, kf40=\EOl, kf41=\EOq, kf42=\EOr, + kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, use=att610-w, +att615-103k|AT&T 615; 80 column; 103key keyboard, + kLFT=\E[ A, kRIT=\E[ @, use=att610-103k, +att615-103k-w|AT&T 615; 132 column; 103key keyboard, + kLFT=\E[ A, kRIT=\E[ @, use=att610-103k-w, +# (att620: I added / based on the init string and +# / from a BSD termcap -- esr) +att620|AT&T 620; 80 column; 98key keyboard, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + flash=\E[?5h$<200>\E[?5l, fsl=\E8, home=\E[H, ht=^I, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + indn=\E[%p1%dS, invis=\E[8m, + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h, + is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ A, kRIT=\E[ @, kbs=^H, + kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, + kf13=\ENs, kf14=\ENt, kf15=\EOC, kf16=\EOD, kf17=\EOE, + kf18=\EOF, kf19=\EOG, kf2=\EOd, kf20=\EOH, kf21=\EOI, + kf22=\EOJ, kf23=\ENO, kf24=\ENP, kf25=\ENQ, kf26=\ENR, + kf27=\ENS, kf28=\ENT, kf29=\EOP, kf3=\EOe, kf30=\EOQ, + kf31=\EOR, kf32=\EOS, kf33=\EOw, kf34=\EOx, kf35=\EOy, + kf36=\EOm, kf37=\EOt, kf38=\EOu, kf39=\EOv, kf4=\EOf, + kf40=\EOl, kf41=\EOq, kf42=\EOr, kf43=\EOs, kf44=\EOp, + kf45=\EOn, kf46=\EOM, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, + kf9=\ENo, khome=\E[H, kind=\E[S, kri=\E[T, ll=\E[24H, + mc4=\E[?4i, mc5=\E[?5i, nel=\EE, + pfx=\E[%p1%d;%p2%l%02dq F%p1%1d %p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, rev=\E[7m, + ri=\EM, rin=\E[%p1%dT, rmacs=\E(B\017, rmam=\E[?7l, + rmir=\E[4l, rmln=\E[2p, rmso=\E[m, rmul=\E[m, + rs2=\Ec\E[?3l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 + %|%t;7%;%?%p7%t;8%;m%?%p9%t\E)0\016%e\E(B\017%;, + sgr0=\E[m\E(B\017, smacs=\E)0\016, smam=\E[?7h, + smir=\E[4h, smln=\E[p, smso=\E[7m, smul=\E[4m, + tsl=\E7\E[25;%i%p1%dx, +att620-w|AT&T 620; 132 column; 98key keyboard, + cols#132, wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + use=att620, +att620-103k|AT&T 620; 80 column; 103key keyboard, + kBEG=\ENB, kCAN=\EOW, kCMD=\EOU, kCPY=\END, kCRT=\EON, + kDC=\ENF, kDL=\ENE, kEND=\ENN, kEOL=\EOA, kEXT=\EOK, + kFND=\EOX, kHLP=\EOM, kMOV=\ENC, kMSG=\EOL, kNXT=\ENH, + kOPT=\EOR, kPRT=\EOZ, kPRV=\ENG, kRDO=\EOT, kRES=\EOQ, + kRPL=\EOY, kSAV=\EOO, kSPD=\EOP, kUND=\EOS, kbeg=\E9, + kcan=\EOw, kclo=\EOV, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, + kdch1=\ENf, kdl1=\ENe, kel=\EOa, kend=\E0, kent=^M, + kext=\EOk, kf10@, kf11@, kf12@, kf13@, kf14@, kf15@, kf16@, kf17@, + kf18@, kf19@, kf20@, kf21@, kf22@, kf23@, kf24@, kf25@, kf26@, kf27@, + kf28@, kf29@, kf30@, kf31@, kf32@, kf33@, kf34@, kf35@, kf36@, kf37@, + kf38@, kf39@, kf40@, kf41@, kf42@, kf43@, kf44@, kf45@, kf46@, kf9@, + kfnd=\EOx, khlp=\EOm, kich1=\ENj, kmov=\ENc, kmrk=\ENi, + kmsg=\EOl, knp=\E[U, knxt=\ENh, kopn=\EOv, kopt=\EOr, + kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, kref=\EOb, + kres=\EOq, krfr=\ENa, krmir=\ENj, krpl=\EOy, krst=\EOB, + ksav=\EOo, kslt=\ENI, kspd=\EOp, kund=\EOs, use=att620, + +att620-103k-w|AT&T 620; 132 column; 103key keyboard, + cols#132, wsl#132, + is1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h, + use=att620-103k, + +# AT&T (formerly Teletype) 630 Multi-Tasking Graphics terminal +# The following SETUP modes are assumed for normal operation: +# Local_Echo=Off Gen_Flow=On Return=CR Received_Newline=LF +# Font_Size=Large Non-Layers_Window_Cols=80 +# Non-Layers_Window_Rows=60 +# Other SETUP modes may be set for operator convenience or communication +# requirements. Some capabilities assume a printer attached to the Aux EIA +# port. This termcap description is for the Fixed Non-Layers Window. No +# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# (att630: added , and from a BSD termcap file -- esr) +att630|AT&T 630 windowing terminal, + OTbs, am, da, db, mir, msgr, npc, xon, + cols#80, it#8, lines#60, lm#0, + bel=^G, blink=\E[5m, cbt=\E[Z, clear=\E[H\E[J, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, + el1=\E[1K, home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=\ED, indn=\E[%p1%dS, is2=\E[m, + kbs=^H, kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, kent=^M, + kf10=\ENp, kf11=\ENq, kf12=\ENr, kf13=\ENs, kf14=\ENt, + kf15=\ENu, kf16=\ENv, kf17=\ENw, kf18=\ENx, kf19=\ENy, + kf20=\ENz, kf21=\EN{, kf22=\EN|, kf23=\EN}, kf24=\EN~, + kf9=\ENo, khome=\E[H, kich1=\E[@, kil1=\E[L, mc4=\E[?4i, + mc5=\E[?5i, nel=^M^J, pfx=\E[%p1%d;%p2%l%dq%p2%s, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmir=\E[4l, rmso=\E[m, + rmul=\E[m, rs2=\Ec, sc=\E7, + sgr=\E[0%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%p4%|%t;7 + %;m, + sgr0=\E[m, smir=\E[4h, smso=\E[7m, smul=\E[4m, +att630-24|5630-24|5630DMD-24|630MTG-24|AT&T 630 windowing terminal 24 lines, + lines#24, use=att630, + +# This is the att700 entry for 700 native emulation of the AT&T 700 +# terminal. Comments are relative to changes from the 605V2 entry and +# att730 on which the entry is based. Comments show the terminfo +# capability name, termcap name, and description. +# +# Here is what's going onm in the init string: +# ESC [ 50;4| set 700 native mode (really is 605) +# x ESC [ 56;ps| set lines to 24: ps=0; 40: ps=1 (plus status line) +# ESC [ 53;0| set GenFlow to Xon/Xoff +# ESC [ 8 ;0| set CR on NL +# x ESC [ ? 3 l/h set workspace: 80 col(l); 132 col(h) +# ESC [ ? 4 l jump scroll +# ESC [ ? 5 l/h video: normal (l); reverse (h) +# ESC [ ?13 l Labels on +# ESC [ ?15 l parity check = no +# ESC [ 13 l monitor mode off +# ESC [ 20 l LF on NL (not CRLF on NL) +# ESC [ ? 7 h autowrap on +# ESC [ 12 h local echo off +# ESC ( B GO = ASCII +# ESC ) 0 G1 = Special Char & Line Drawing +# ESC [ ? 31 l Set 7 bit controls +# +# Note: Most terminals, especially the 600 family use Reverse Video for +# standout mode. DEC also uses reverse video. The VT100 uses bold in addition +# Assume we should stay with reverse video for 70.. However, the 605V2 exits +# standout mode with \E[m (all normal attributes). The 730 entry simply +# exits reverse video which would leave other current attributes intact. It +# was assumed the 730 entry to be more correct so rmso has changed. The +# 605V2 has no sequences to turn individual attributes off, thus its setting +# and the rmso/smso settings from the 730. +# +# Note: For the same reason as above in rmso I changed exit under-score mode +# to specifically turn off underscore, rather than return to all normal +# attributes +# +# Note: The following pkey_xmit is taken from the 605V2 which contained the +# capability as pfxl. It was changed here to pfx since pfxl +# will only compile successfully with Unix 4.0 tic. Also note that pfx only +# allows strings to be parameters and label values must be programmed as +# constant strings. Supposedly the pfxl of Version 4.0 allows both labels +# and strings to be parameters. The 605V2 pfx entry should be examined later +# in this regard. For reference the 730 pfxl entry is shown here for comparison +# 730 pfx entry: +# pfxl=\E[%?%p1%{25}%<%t%p1%e%p1%{24}%-%;%d;%p2%l%02d%?%p1%{25}%<%tq\s\s\s +# SYS\s\s\s\s\sF%p1%:-2d\s\s%e;0;3q%;%p2%s, +# +# (for 4.0 tic) +# pfxl=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t F%p1%1d %;%p2%s, +# +# (for <4.0 tic) +# pfx=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t F%p1%1d %;%p2%s, +# +# From the AT&T 705 Multi-tasking terminal user's guide Page 8-8,8-9 +# +# Port1 Interface +# +# modular 10 pin Connector +# Left side Right side +# Pin 1 2 3 4 5 6 7 8 9 10 +# +# Key (notch) at bottom +# +# Pin 1 DSR +# 3 DCD +# 4 DTR +# 5 Sig Ground +# 6 RD +# 7 SD +# 8 CTS +# 9 RTS +# 10 Frame Ground +# +# The manual is 189 pages and is loaded with details about the escape codes, +# etc..... Available from AT&T CIC 800-432-6600... +# ask for Document number 999-300-660.. +# +att700|AT&T 700 24x80 column display w/102key keyboard, + am, eslok, hs, mir, msgr, xenl, xon, + cols#80, it#8, lh#2, lines#24, lw#8, nlab#8, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, fln=4\,4, + fsl=\E8, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=\ED, invis=\E[8m, + is2=\E[50;4|\E[53;0|\E[8;0|\E[?4;13;15l\E[13;20l\E[?7h\E[12h + \E(B\E)0\E[?31l\E[0m\017, + is3=\E(B\E)0, kLFT=\E[ A, kRIT=\E[ @, kbs=^H, kcbt=\E[Z, + kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[P, kdl1=\E[M, kend=\E[24;1H, kf1=\EOc, kf10=\ENp, + kf11=\ENq, kf12=\ENr, kf13=\ENs, kf14=\ENt, kf15=\EOC, + kf16=\EOD, kf17=\EOE, kf18=\EOF, kf19=\EOG, kf2=\EOd, + kf20=\EOH, kf21=\EOI, kf22=\EOJ, kf23=\ENO, kf24=\ENP, + kf25=\ENQ, kf26=\ENR, kf27=\ENS, kf28=\ENT, kf29=\EOq, + kf3=\EOe, kf30=\EOr, kf31=\EOs, kf32=\EOt, kf33=\EOu, + kf34=\EOv, kf35=\EOw, kf36=\EOx, kf37=\EOy, kf38=\EOu, + kf39=\EOv, kf4=\EOf, kf40=\EOl, kf41=\EOq, kf42=\EOr, + kf43=\EOs, kf44=\EOp, kf45=\EOn, kf46=\EOM, kf5=\EOg, + kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, + kich1=\E[@, kil1=\E[L, knp=\E[U, kpp=\E[V, ll=\E[24H, + mc0=\E[i, mc4=\E[?4i, mc5=\E[?5i, nel=\EE, + pfx=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t\s\s\sF%p1%1d\s\s\s\s\s + \s\s\s\s\s\s%;%p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, rmacs=^O, + rmir=\E[4l, rmln=\E[2p, rmso=\E[27m, rmul=\E[24m, + rmxon=\E[53;3|, rs1=\Ec\E[?3;5l\E[56;0|, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 + %|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smir=\E[4h, smln=\E[p, smso=\E[7m, + smul=\E[4m, smxon=\E[53;0|, tbc=\E[3g, + tsl=\E7\E[99;%i%p1%dx, + +# This entry was modified 3/13/90 by JWE. +# fixes include additions of , correcting , and modification +# of . (See comments below) +# att730 has status line of 80 chars +# These were commented out: , , +# the and up keys are used for shifted system Fkeys +# NOTE: JWE 3/13/90 The 98 key keyboard translation for shift/HOME is +# currently the same as (unshifted HOME or \E[H). On the 102, 102+1 +# and 122 key keyboards, the 730's translation is \E[2J. For consistency +# has been commented out. The user can uncomment if using the +# 102, 102+1, or 122 key keyboards +# kHOM=\E[2J, +# (att730: I added / based on the init string -- esr) +att730|AT&T 730 windowing terminal, + am, da, db, eslok, hs, mir, msgr, npc, xenl, xon, + cols#80, it#8, lh#2, lines#60, lm#0, lw#8, nlab#24, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h\E[?12l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=\E[?5h$<200>\E[?5l, fsl=\E8, + home=\E[H, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, + ind=\ED, invis=\E[8m, + is1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)B, + is2=\E[m\017, is3=\E(B\E)0, kLFT=\E[ @, kRIT=\E[ A, kbs=^H, + kcbt=\E[Z, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOc, kf10=\ENp, kf11=\ENq, kf12=\ENr, + kf13=\ENs, kf14=\ENt, kf15=\ENu, kf16=\ENv, kf17=\ENw, + kf18=\ENx, kf19=\ENy, kf2=\EOd, kf20=\ENz, kf21=\EN{, + kf22=\EN|, kf23=\EN}, kf24=\EN~, kf25=\EOC, kf26=\EOD, + kf27=\EOE, kf28=\EOF, kf29=\EOG, kf3=\EOe, kf30=\EOH, + kf31=\EOI, kf32=\EOJ, kf33=\ENO, kf34=\ENP, kf35=\ENQ, + kf36=\ENR, kf37=\ENS, kf38=\ENT, kf39=\EOU, kf4=\EOf, + kf40=\EOV, kf41=\EOW, kf42=\EOX, kf43=\EOY, kf44=\EOZ, + kf45=\EO[, kf46=\EO\s, kf47=\EO], kf48=\EO\^, kf5=\EOg, + kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\ENo, khome=\E[H, + kich1=\E[@, kil1=\E[L, kind=\E[S, kri=\E[T, + mc0=\E[?19h\E[0i, mc4=\E[?4i, mc5=\E[?5i, nel=\EE, + pfx=\E[%?%p1%{25}%<%t%p1%e%p1%{24}%-%;%d;%p2%l%02d%?%p1%{25} + %<%tq\s\s\sSYS\s\s\s\s\sF%p1%:-2d\s\s%e;0;3q%;%p2%s, + pfxl=\E[%p1%d;%p2%l%02d;0;0q%p3%:-16.16s%p2%s, + pln=\E[%p1%d;0;0;0q%p2%:-16.16s, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, ri=\EM, rmacs=^O, + rmam=\E[?7l, rmir=\E[4l, rmln=\E[?13h, rmso=\E[27m, + rmul=\E[24m, rmxon=\E[?21l, rs2=\Ec\E[?3l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%;%?%p3%p1 + %|%t;7%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smir=\E[4h, + smln=\E[?13l, smso=\E[7m, smul=\E[4m, smxon=\E[?21h, + swidm=\E#6, tsl=\E7\E[;%i%p1%dx, +att730-41|730MTG-41|AT&T 730-41 windowing terminal Version, + lines#41, use=att730, +att730-24|730MTG-24|AT&T 730-24 windowing terminal Version, + lines#24, use=att730, +att730r|730MTGr|AT&T 730 rev video windowing terminal Version, + flash=\E[?5l$<200>\E[?5h, + is1=\E[8;0|\E[?3;4;13;15l\E[?5h\E[13;20l\E[?7h\E[12h\E(B\E)B, use=att730, +att730r-41|730MTG-41r|AT&T 730r-41 rev video windowing terminal Version, + lines#41, use=att730r, +att730r-24|730MTGr-24|AT&T 730r-24 rev video windowing terminal Version, + lines#24, use=att730r, + +# The following represents the screen layout along with the associated +# bezel buttons for the 5430/pt505 terminal. The "kf" designations do +# not appear on the screen but are shown to reference the bezel buttons. +# The "CMD", "MAIL", and "REDRAW" buttons are shown in their approximate +# position relative to the screen. +# +# +# +# +----------------------------------------------------------------+ +# | | +# XXXX | kf0 kf24 | XXXX +# | | +# | | +# XXXX | kf1 kf23 | XXXX +# | | +# | | +# XXXX | kf2 kf22 | XXXX +# | | +# | | +# XXXX | kf3 kf21 | XXXX +# | | +# | | +# XXXX | kf4 kf20 | XXXX +# | | +# | | +# XXXX | kf5 kf19 | XXXX +# | | +# | | +# XXXX | kf6 kf18 | XXXX +# | | +# | | +# XXXX | | XXXX +# | | +# | | +# +----------------------------------------------------------------+ +# +# XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX +# +# Note: XXXX represents the screen buttons +# CMD REDRAW +# +# MAIL +# +# version 1 note: +# The character string sent by key 'kf26' may be user programmable +# to send either \E[16s, or \E[26s. +# The character string sent by key 'krfr' may be user programmable +# to send either \E[17s, or \E[27s. +# +# Depression of the "CMD" key sends \E! (kcmd) +# Depression of the "MAIL" key sends \E[26s (kf26) +# "REDRAW" same as "REFRESH" (krfr) +# +# "kf" functions adds carriage return to output string if terminal is in +# 'new line' mode. +# +# The following are functions not covered in the table above: +# +# Set keyboard character (SKC): \EPn1;Pn2w +# Pn1= 0 Back Space key +# Pn1= 1 Break key +# Pn2= Program char (hex) +# +# Screen Definition (SDF): \E[Pn1;Pn2;Pn3;Pn4;Pn5t +# Pn1= Window number (1-39) +# Pn2-Pn5= Y;X;Y;X coordinates +# +# Screen Selection (SSL): \E[Pnu +# Pn= Window number +# +# Set Terminal Modes (SM): \E[Pnh +# Pn= 3 Graphics mode +# Pn= > Cursor blink +# Pn= < Enter new line mode +# Pn= = Enter reverse insert/replace mode +# Pn= ? Enter no scroll mode +# +# Reset Terminal Mode (RM): \E[Pnl +# Pn= 3 Exit graphics mode +# Pn= > Exit cursor blink +# Pn= < Exit new line mode +# Pn= = Exit reverse insert/replace mode +# Pn= ? Exit no scroll mode +# +# Screen Status Report (SSR): \E[Pnp +# Pn= 0 Request current window number +# Pn= 1 Request current window dimensions +# +# Device Status Report (DSR): \E[6n Request cursor position +# +# Call Status Report (CSR): \E[Pnv +# Pn= 0 Call failed +# Pn= 1 Call successful +# +# Transparent Button String (TBS): \E[Pn1;Pn2;Pn3;{string +# Pn1= Button number to be loaded +# Pn2= Character count of "string" +# Pn3= Key mode being loaded: +# 0= Unshifted +# 1= Shifted +# 2= Control +# String= Text string (15 chars max) +# +# Screen Number Report (SNR): \E[Pnp +# Pn= Screen number +# +# Screen Dimension Report (SDR): \E[Pn1;Pn2r +# Pn1= Number of rows available in window +# Pn2= Number of columns available in window +# +# Cursor Position Report (CPR): \E[Pn1;Pn2R +# Pn1= "Y" Position of cursor +# Pn2= "X" Position of cursor +# +# Request Answer Back (RAB): \E[c +# +# Answer Back Response (ABR): \E[?;*;30;VSV +# *= 0 No printer available +# *= 2 Printer available +# V= Software version number +# SV= Software sub version number +# (printer-available field not documented in v1) +# +# Screen Alignment Aid: \En +# +# Bell (lower pitch): \E[x +# +# Dial Phone Number: \EPdstring\ +# string= Phone number to be dialed +# +# Set Phone Labels: \EPpstring\ +# string= Label for phone buttons +# +# Set Clock: \EPchour;minute;second\ +# +# Position Clock: \EPsY;X\ +# Y= "Y" coordinate +# X= "X" coordinate +# +# Delete Clock: \Epr\ +# +# Programming The Function Buttons: \EPfPn;string\ +# Pn= Button number (00-06, 18-24) +# (kf00-kf06, kf18-kf24) +# string= Text to sent on button depression +# +# The following in version 2 only: +# +# Request For Local Directory Data: \EPp12;\ +# +# Local Directory Data to host: \EPp11;LOCAL...DIRECTORY...DATA\ +# +# Request for Local Directory Data in print format: \EPp13;\ +# +# Enable 'Prt on Line' mode: \022 (DC2) +# +# Disable 'Prt on Line' mode: \024 (DC4) +# + +# 05-Aug-86: +# The following Terminfo entry describes functions which are supported by +# the AT&T 5430/pt505 terminal software version 2 and later. +att505|pt505|att5430|gs5430|AT&T Personal Terminal 505 or 5430 GETSET terminal, + am, xon, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[2J\E[H, + cnorm=\E[>l, cr=^M, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[>h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[0J, el=\E[0K, el1=\E[2K, home=\E[H, ht=^I, + il=\E[%p1%dL, il1=\E[L, ind=^J, + is1=\EPr\\E[0u\E[2J\E[0;0H\E[m\E[3l\E[l\E[=l\E[?l, + kbs=^H, kcmd=\E!, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf0=\E[00s, kf1=\E[01s, kf18=\E[18s, + kf19=\E[19s, kf2=\E[02s, kf20=\E[20s, kf21=\E[21s, + kf22=\E[22s, kf23=\E[23s, kf24=\E[24s, kf26=\E[26s, + kf3=\E[03s, kf4=\E[04s, kf5=\E[05s, kf6=\E[06s, + krfr=\E[27s, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, + rmacs=\E[10m, rmam=\E[11;1j, rmir=\E[4l, rmso=\E[m, + rmul=\E[m, rs1=\Ec, sc=\E7, sgr0=\E[m, smacs=\E[11m, + smam=\E[11;0j, smir=\E[4h, smso=\E[1m, smul=\E[4m, + +# The following Terminfo entry describes functions which are supported by +# the AT&T 5430/pt505 terminal software version 1. +att505-24|pt505-24|gs5430-24|AT&T PT505 or 5430 GETSET version 1 24 lines, + lines#24, + mc4@, mc5@, rc@, rmam@, sc@, smam@, use=att505, +tt505-22|pt505-22|gs5430-22|AT&T PT505 or 5430 GETSET version 1 22 lines, + lines#22, use=att505, +# +#### ------------------ TERMINFO FILE CAN BE SPLIT HERE --------------------- +# This cut mark helps make life less painful for people running ncurses tic +# on machines with relatively little RAM. The file can be broken in half here +# cleanly and compiled in sections -- no `use' references cross this cut +# going forward. +# + +#### Ampex (Dialogue) +# +# Yes, these are the same people who are better-known for making audio- and +# videotape. I'm told they are located in Redwood City, CA. +# + +# From: Fri Sep 11 22:38:32 1981 +# (ampex80: some capabilities merged in from SCO's entry -- esr) +ampex80|a80|d80|dialogue|dialogue80|ampex dialogue 80, + OTbs, am, bw, ul, + cols#80, it#8, lines#24, + bel=^G, cbt=\EI, clear=\E*$<75>, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dl1=\ER$<5*>, ed=\Ey, el=\Et, ht=^I, hts=\E1, + ich1=\EQ, il1=\EE$<5*>, ind=^J, is2=\EA, rmso=\Ek, rmul=\Em, + smso=\Ej, smul=\El, tbc=\E3, +# This entry was from somebody anonymous, Tue Aug 9 20:11:37 1983, who wrote: +ampex175|ampex d175, + am, + cols#80, lines#24, + bel=^G, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\Ey, el=\Et, home=^^, ich1=\EQ, il1=\EE, ind=^J, + is2=\EX\EA\EF, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, + kdch1=\EW, kdl1=\ER, khome=^^, kich1=\EQ, kil1=\EE, ll=^^^K, + rmcup=\EF, rmso=\Ek, rmul=\Em, smcup=\EN, smso=\Ej, smul=\El, +# No backspace key in the main QWERTY cluster. Fortunately, it has a +# NEWLINE/PAGE key just above RETURN that sends a strange single-character +# code. Given a suitable Unix (one that lets you set an echo-erase-as-BS-SP-BS +# mode), this key can be used as the erase key; I find I like this. Because +# some people and some systems may not, there is another termcap ("ampex175") +# that suppresses this little eccentricity by omitting the relevant capability. +ampex175-b|ampex d175 using left arrow for erase, + kbs=^_, use=ampex175, +# From: Richard Bascove +# (ampex210: removed obsolete ":kn#10:" -- esr) +ampex210|a210|ampex a210, + OTbs, am, hs, xenl, + cols#80, it#8, lines#24, xmc#1, + cbt=\EI, clear=\E*, cub1=^H, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\Ey, el=\Et, flash=\EU\EX\EU\EX\EU\EX\EU\EX, + fsl=\E.2, home=^^, ht=^I, ich1=\EQ, + if=/usr/share/tabset/std, il1=\EE, invis@, + is2=\EC\Eu\E'\E(\El\EA\E%\E{\E.2\EG0\Ed\En, kcub1=^H, + kcud1=^V, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A1\r, + kf2=^A2\r, kf3=^A3\r, kf4=^A4\r, kf5=^A5\r, kf6=^A6\r, + kf7=^A7\r, kf8=^A8\r, kf9=^A9\r, khome=^^, + tsl=\E.0\Eg\E}\Ef, use=adm+sgr, +# (ampex219: I added / based on the init string, added +# from ampex219w, added =\E[?3l, irresistibly suggested by , +# and moved the padding to be *after* the caps -- esr) +ampex219|ampex-219|amp219|Ampex with Automargins, + hs, xenl, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, cbt=\E[Z, + clear=\E[H\E[2J$<50>, cnorm=\E[?3l, cr=^M, + csr=%i\E[%p1%2d;%p2%2dr, cub1=^H, cud1=\E[B, + cuf1=\E[C$<2>, cup=\E[%i%p1%d;%p2%dH$<5>, + cuu1=\E[A$<2>, cvvis=\E[?3h, dim=\E[1m, ed=\E[J$<50>, + el=\E[K$<3>, home=\E[H, ht=^I, ind=^J, + is2=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[21~, + kf1=\E[7~, kf2=\E[8~, kf3=\E[9~, kf4=\E[10~, kf5=\E[11~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[H, + rev=\E[7m, ri=\EM$<5>, rmam=\E[?7l, rmkx=\E>, + rmso=\E[m$<2>, rmul=\E[m$<2>, sgr0=\E[m$<2>, smam=\E[?7h, + smkx=\E=, smso=\E[7m$<2>, smul=\E[4m$<2>, +ampex219w|ampex-219w|amp219w|Ampex 132 cols, + cols#132, lines#24, + bel=^G, cr=^M, cud1=^J, ind=^J, + is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h, use=ampex219, +# (ampex232: removed , no file and no --esr) +ampex232|ampex-232|Ampex Model 232, + am, + cols#80, lines#24, xmc#1, + cbt=\EI, civis=\E.0, clear=\E+, cnorm=\E.4, cub1=^H, cud1=^V, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dl1=\ER$<5*/>, ed=\EY, el=\ET, + flash=\Eb$<200/>\Ed, ht=^I, ich1=\EQ, il1=\EE$<5*/>, + invis@, is2=\Eg\El, kbs=^H, kcub1=^H, kcud1=^V, kcuf1=^L, + kcuu1=^K, kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, + kf4=^AD\r, kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, + kf9=^AI\r, khome=^^, use=adm+sgr, +# (ampex: removed , no file and no -- esr) +ampex232w|Ampex Model 232 / 132 columns, + cols#132, lines#24, + is2=\E\034Eg\El, use=ampex232, + +#### Ann Arbor (aa) +# +# Ann Arbor made dream terminals for hackers -- large screen sizes and huge +# numbers of function keys. At least some used monitors in portrait mode, +# allowing up to 76-character screen heights! They were reachable at: +# +# Ann Arbor Terminals +# 6175 Jackson Road +# Ann Arbor, MI 48103 +# (313)-663-8000 +# +# But in 1996 the phone number reaches some kitschy retail shop, and Ann Arbor +# can't be found on the Web; I fear they're long dead. R.I.P. +# + + +# Originally from Mike O'Brien@Rand and Howard Katseff at Bell Labs. +# Highly modified 6/22 by Mike O'Brien. +# split out into several for the various screen sizes by dave-yost@rand +# Modifications made 3/82 by Mark Horton +# Modified by Tom Quarles at UCB for greater efficiency and more diversity +# status line moved to top of screen, removed 5/82 +# Some unknown person at SCO then hacked the init strings to make them more +# efficient. +# +# assumes the following setup: +# A menu: 0000 1010 0001 0000 +# B menu: 9600 0100 1000 0000 0000 1000 0000 17 19 +# C menu: 56 66 0 0 9600 0110 1100 +# D menu: 0110 1001 1 0 +# +# Briefly, the settings are for the following modes: +# (values are for bit set/clear with * indicating our preference +# and the value used to test these termcaps) +# Note that many of these settings are irrelevent to the terminfo +# and are just set to the default mode of the terminal as shipped +# by the factory. +# +# A menu: 0000 1010 0001 0000 +# Block/underline cursor* +# blinking/nonblinking cursor* +# key click/no key click* +# bell/no bell at column 72* +# +# key pad is cursor control*/key pad is numeric +# return and line feed/return for key * +# repeat after .5 sec*/no repeat +# repeat at 25/15 chars per sec. * +# +# hold data until pause pressed/process data unless pause pressed* +# slow scroll/no slow scroll* +# Hold in area/don't hold in area* +# functions keys have default*/function keys disabled on powerup +# +# show/don't show position of cursor during page transmit* +# unused +# unused +# unused +# +# B menu: 9600 0100 1000 0000 0000 1000 0000 17 19 +# Baud rate (9600*) +# +# 2 bits of parity - 00=odd,01=even*,10=space,11=mark +# 1 stop bit*/2 stop bits +# parity error detection off*/on +# +# keyboard local/on line* +# half/full duplex* +# disable/do not disable keyboard after data transmission* +# +# transmit entire page/stop transmission at cursor* +# transfer/do not transfer protected characters* +# transmit all characters/transmit only selected characters* +# transmit all selected areas/transmit only 1 selected area* +# +# transmit/do not transmit line separators to host* +# transmit/do not transmit page tab stops tabs to host* +# transmit/do not transmit column tab stop tabs to host* +# transmit/do not transmit graphics control (underline,inverse..)* +# +# enable*/disable auto XON/XOFF control +# require/do not require receipt of a DC1 from host after each LF* +# pause key acts as a meta key/pause key is pause* +# unused +# +# unused +# unused +# unused +# unused +# +# XON character (17*) +# XOFF character (19*) +# +# C menu: 56 66 0 0 9600 0110 1100 +# number of lines to print data on (printer) (56*) +# +# number of lines on a sheet of paper (printer) (66*) +# +# left margin (printer) (0*) +# +# number of pad chars on new line to printer (0*) +# +# printer baud rate (9600*) +# +# printer parity: 00=odd,01=even*,10=space,11=mark +# printer stop bits: 2*/1 +# print/do not print guarded areas* +# +# new line is: 01=LF,10=CR,11=CRLF* +# unused +# unused +# +# D menu: 0110 1001 1 0 +# LF is newline/LF is down one line, same column* +# wrap to preceding line if move left from col 1*/don't wrap +# wrap to next line if move right from col 80*/don't wrap +# backspace is/is not destructive* +# +# display*/ignore DEL character +# display will not/will scroll* +# page/column tab stops* +# erase everything*/erase unprotected only +# +# editing extent: 0=display,1=line*,2=field,3=area +# +# unused +# + +annarbor4080|aa4080|ann arbor 4080, + OTbs, am, + cols#80, lines#40, + bel=^G, clear=\014$<2>, cr=^M, cub1=^H, cud1=^J, cuf1=^_, + cup=\017%p2%{10}%/%{16}%*%p2%{10}%m%+%c%p1%?%p1%{19}%>%t + %{12}%+%;%{64}%+%c, + cuu1=^N, home=^K, ht=^I, hts=^]^P1, ind=^J, kbs=^^, kcub1=^H, + kcud1=^J, kcuf1=^_, kcuu1=^N, khome=^K, tbc=^\^P^P, + +# Strange Ann Arbor terminal from BRL +aas1901|Ann Arbor K4080 w/S1901 mod, + am, + cols#80, lines#40, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^_, cuu1=^N, + home=^K, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, ll=^O\0c, + nel=^M^J, + +# If you're using the GNU termcap library, add +# :cS=\E[%p1%d;%p2%d;%p3%d;%p4%dp: +# to these capabilities. This is the nonstandard GNU termcap scrolling +# capability, arguments are: +# 1. Total number of lines on the screen. +# 2. Number of lines above desired scroll region. +# 3. Number of lines below (outside of) desired scroll region. +# 4. Total number of lines on the screen, the same as the first parameter. +# The generic Ann Arbor entry is the only one that uses this. +aaa+unk|aaa-unk|ann arbor ambassador (internal - don't use this directly), + OTbs, am, km, mc5i, mir, xon, + cols#80, it#8, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + clear=\E[H\E[J$<156>, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^K, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, + el=\E[K$<5>, home=\E[H, hpa=\E[%p1%{1}%+%dG, ht=^I, + hts=\EH, ich=\E[%p1%d@$<4*>, ich1=\E[@$<4>, il=\E[%p1%dL, + il1=\E[L$<3>, ind=^K, invis=\E[8m, is1=\E[m\E7\E[H\E9\E8, + is3=\E[1Q\E[>20;30l\EP`+x~M\E\\, kbs=^H, kcbt=\E[Z, + kclr=\E[J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[P, kdl1=\E[M, kf1=\EOA, kf10=\EOJ, kf11=\EOK, + kf12=\EOL, kf13=\EOM, kf14=\EON, kf15=\EOO, kf16=\EOP, + kf17=\EOQ, kf18=\EOR, kf19=\EOS, kf2=\EOB, kf20=\EOT, + kf21=\EOU, kf22=\EOV, kf23=\EOW, kf24=\EOX, kf3=\EOC, + kf4=\EOD, kf5=\EOE, kf6=\EOF, kf7=\EOG, kf8=\EOH, kf9=\EOI, + khome=\E[H, kich1=\E[@, kil1=\E[L, krmir=\E6, mc0=\E[0i, + mc4=^C, mc5=\E[v, mc5p=\E[%p1%dv, rc=\E8, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, + rmkx=\EP`>y~[[J`8xy~[[A`4xy~[[D`6xy~[[C`2xy~[[B\E + \\, + rmm=\E[>52l, rmso=\E[m, rmul=\E[m, sc=\E7, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1; + %;%?%p7%t8;%;m, + sgr0=\E[m, + smkx=\EP`>z~[[J`8xz~[[A`4xz~[[D`6xz~[[C`2xz~[[B\E + \\, + smm=\E[>52h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%p1%{1}%+%dd, + +aaa+rv|ann arbor ambassador in reverse video, + blink=\E[5;7m, bold=\E[1;7m, invis=\E[7;8m, + is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, rmul=\E[7m, + rs1=\E[H\E[7m\E[J$<156>, + sgr=\E[%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p1%p2%|%p3%!%t7; + %;%?%p7%t8;%;m\016, + sgr0=\E[7m\016, smso=\E[m, smul=\E[4;7m, +# Ambassador with the DEC option, for partial vt100 compatibility. +aaa+dec|ann arbor ambassador in dec vt100 mode, + acsc=aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}, + csr=\E[%i%p1%d;%p2%dr, enacs=\E(0, rmacs=^N, + sgr=\E[%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p1%p3%|%!%t7;%;%? + %p7%t8;%;m%?%p9%t\017%e\016%;, + smacs=^O, +aaa-18|ann arbor ambassador/18 lines, + lines#18, + is2=\E7\E[60;0;0;18p\E8, + rmcup=\E[60;0;0;18p\E[60;1H\E[K, smcup=\E[18;0;0;18p, + use=aaa+unk, +aaa-18-rv|ann arbor ambassador/18 lines+reverse video, + use=aaa+rv, use=aaa-18, +aaa-20|ann arbor ambassador/20 lines, + lines#20, + is2=\E7\E[60;0;0;20p\E8, + rmcup=\E[60;0;0;20p\E[60;1H\E[K, smcup=\E[20;0;0;20p, + use=aaa+unk, +aaa-22|ann arbor ambassador/22 lines, + lines#22, + is2=\E7\E[60;0;0;22p\E8, + rmcup=\E[60;0;0;22p\E[60;1H\E[K, smcup=\E[22;0;0;22p, + use=aaa+unk, +aaa-24|ann arbor ambassador/24 lines, + lines#24, + is2=\E7\E[60;0;0;24p\E8, + rmcup=\E[60;0;0;24p\E[60;1H\E[K, smcup=\E[24;0;0;24p, + use=aaa+unk, +aaa-24-rv|ann arbor ambassador/24 lines+reverse video, + use=aaa+rv, use=aaa-24, +aaa-26|ann arbor ambassador/26 lines, + lines#26, + is2=\E7\E[60;0;0;26p\E8, + rmcup=\E[60;0;0;26p\E[26;1H\E[K, + smcup=\E[H\E[J$<156>\E[26;0;0;26p, use=aaa+unk, +aaa-28|ann arbor ambassador/28 lines, + lines#28, + is2=\E7\E[60;0;0;28p\E8, + rmcup=\E[60;0;0;28p\E[28;1H\E[K, + smcup=\E[H\E[J$<156>\E[28;0;0;28p, use=aaa+unk, +aaa-30-s|aaa-s|ann arbor ambassador/30 lines w/status, + eslok, hs, + lines#29, + dsl=\E7\E[60;0;0;30p\E[1;1H\E[K\E[H\E8\r\n\E[K, + fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;30p\E8, + rmcup=\E[60;1;0;30p\E[29;1H\E[K, + smcup=\E[H\E[J$<156>\E[30;1;0;30p\E[30;1H\E[K, + tsl=\E[>51h\E[1;%p1%dH\E[2K, use=aaa+unk, +aaa-30-s-rv|aaa-s-rv|ann arbor ambassador/30 lines+status+reverse video, + use=aaa+rv, use=aaa-30-s, +aaa-s-ctxt|aaa-30-s-ctxt|ann arbor ambassador/30 lines+status+save context, + rmcup=\E[60;1;0;30p\E[59;1H\E[K, + smcup=\E[30;1H\E[K\E[30;1;0;30p, use=aaa-30-s, +aaa-s-rv-ctxt|aaa-30-s-rv-ct|ann arbor ambassador/30 lines+status+save context+reverse video, + rmcup=\E[60;1;0;30p\E[59;1H\E[K, + smcup=\E[30;1H\E[K\E[30;1;0;30p, use=aaa-30-s-rv, +aaa|aaa-30|ambas|ambassador|ann arbor ambassador/30 lines, + lines#30, + is2=\E7\E[60;0;0;30p\E8, + rmcup=\E[60;0;0;30p\E[30;1H\E[K, + smcup=\E[H\E[J$<156>\E[30;0;0;30p, use=aaa+unk, +aaa-30-rv|aaa-rv|ann arbor ambassador/30 lines in reverse video, + use=aaa+rv, use=aaa-30, +aaa-30-ctxt|aaa-ctxt|ann arbor ambassador/30 lines; saving context, + rmcup=\E[60;0;0;30p\E[60;1H\E[K, smcup=\E[30;0;0;30p, + use=aaa-30, +aaa-30-rv-ctxt|aaa-rv-ctxt|ann arbor ambassador/30 lines reverse video; saving context, + rmcup=\E[60;0;0;30p\E[60;1H\E[K, smcup=\E[30;0;0;30p, + use=aaa+rv, use=aaa-30, +aaa-36|ann arbor ambassador/36 lines, + lines#36, + is2=\E7\E[60;0;0;36p\E8, + rmcup=\E[60;0;0;36p\E[36;1H\E[K, + smcup=\E[H\E[J$<156>\E[36;0;0;36p, use=aaa+unk, +aaa-36-rv|ann arbor ambassador/36 lines+reverse video, + use=aaa+rv, use=aaa-36, +aaa-40|ann arbor ambassador/40 lines, + lines#40, + is2=\E7\E[60;0;0;40p\E8, + rmcup=\E[60;0;0;40p\E[40;1H\E[K, + smcup=\E[H\E[J$<156>\E[40;0;0;40p, use=aaa+unk, +aaa-40-rv|ann arbor ambassador/40 lines+reverse video, + use=aaa+rv, use=aaa-40, +aaa-48|ann arbor ambassador/48 lines, + lines#48, + is2=\E7\E[60;0;0;48p\E8, + rmcup=\E[60;0;0;48p\E[48;1H\E[K, + smcup=\E[H\E[J$<156>\E[48;0;0;48p, use=aaa+unk, +aaa-48-rv|ann arbor ambassador/48 lines+reverse video, + use=aaa+rv, use=aaa-48, +aaa-60-s|ann arbor ambassador/59 lines+status, + eslok, hs, + lines#59, + dsl=\E7\E[60;0;0;60p\E[1;1H\E[K\E[H\E8\r\n\E[K, + fsl=\E[>51l, is2=\r\n\E[A\E7\E[60;1;0;60p\E8, + tsl=\E[>51h\E[1;%p1%dH\E[2K, use=aaa+unk, +aaa-60-s-rv|ann arbor ambassador/59 lines+status+reverse video, + use=aaa+rv, use=aaa-60-s, +aaa-60-dec-rv|ann arbor ambassador/dec mode+59 lines+status+rev video, + use=aaa+dec, use=aaa+rv, use=aaa-60-s, +aaa-60|ann arbor ambassador/60 lines, + lines#60, + is2=\E7\E[60;0;0;60p\E[1Q\E[m\E[>20;30l\E8, + use=aaa+unk, +aaa-60-rv|ann arbor ambassador/60 lines+reverse video, + use=aaa+rv, use=aaa-60, +aaa-db|ann arbor ambassador 30/destructive backspace, + OTbs@, + cub1=\E[D, is3=\E[1Q\E[m\E[>20l\E[>30h, use=aaa-30, + +guru|guru-33|guru+unk|ann arbor guru/33 lines 80 cols, + lines#33, + flash=\E[>59h$<100>\E[>59l, + is2=\E7\E[255;0;0;33;80;80p\E8\E[J, is3=\E[>59l, + rmcup=\E[255p\E[255;1H\E[K, smcup=\E[33p, use=aaa+unk, +guru+rv|guru changes for reverse video, + flash=\E[>59l$<100>\E[>59h, is3=\E[>59h, +guru-rv|guru-33-rv|ann arbor guru/33 lines+reverse video, + use=guru+rv, use=guru-33, +guru+s|guru status line, + eslok, hs, + dsl=\E7\E[;0p\E[1;1H\E[K\E[H\E8\r\n\E[K, fsl=\E[>51l, + rmcup=\E[255;1p\E[255;1H\E[K, smcup=, + tsl=\E[>51h\E[1;%p1%dH\E[2K, +guru-nctxt|guru with no saved context, + smcup=\E[H\E[J$<156>\E[33p\E[255;1H\E[K, use=guru, +guru-s|guru-33-s|ann arbor guru/33 lines+status, + lines#32, + is2=\r\n\E[A\E7\E[255;1;0;33;80;80p\E8\E[J, + smcup=\E[33;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, +guru-24|ann arbor guru 24 lines, + cols#80, lines#24, + is2=\E7\E[255;0;0;24;80;80p\E8\E[J, smcup=\E[24p, + use=guru+unk, +guru-44|ann arbor guru 44 lines, + cols#97, lines#44, + is2=\E7\E[255;0;0;44;97;100p\E8\E[J, smcup=\E[44p, + use=guru+unk, +guru-44-s|ann arbor guru/44 lines+status, + lines#43, + is2=\r\n\E[A\E7\E[255;1;0;44;80;80p\E8\E[J, + smcup=\E[44;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, +guru-76|guru with 76 lines by 89 cols, + cols#89, lines#76, + is2=\E7\E[255;0;0;76;89;100p\E8\E[J, smcup=\E[76p, + use=guru+unk, +guru-76-s|ann arbor guru/76 lines+status, + cols#89, lines#75, + is2=\r\n\E[A\E7\E[255;1;0;76;89;100p\E8\E[J, + smcup=\E[76;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, +guru-76-lp|guru-lp|guru with page bigger than line printer, + cols#134, lines#76, + is2=\E7\E[255;0;0;76;134;134p\E8\E[J, smcup=\E[76p, + use=guru+unk, +guru-76-w|guru 76 lines by 178 cols, + cols#178, lines#76, + is2=\E7\E[255;0;0;76;178;178p\E8\E[J, smcup=\E[76p, + use=guru+unk, +guru-76-w-s|ann arbor guru/76 lines+status+wide, + cols#178, lines#75, + is2=\r\n\E[A\E7\E[255;1;0;76;178;178p\E8\E[J, + smcup=\E[76;1p\E[255;1H\E[K, use=guru+s, use=guru+unk, +guru-76-wm|guru 76 lines by 178 cols with 255 cols memory, + cols#178, lines#76, + is2=\E7\E[255;0;0;76;178;255p\E8\E[J, smcup=\E[76p, + use=guru+unk, +aaa-rv-unk|ann arbor unknown type, + lh#0, lw#0, nlab#0, + blink=\E[5;7m, bold=\E[1;7m, home=\E[H, invis=\E[7;8m, + is1=\E[7m\E7\E[H\E9\E8, rev=\E[m, rmso=\E[7m, rmul=\E[7m, + rs1=\E[H\E[7m\E[J, + sgr=\E[%?%p6%t1;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p1%!%t + 7;%;%?%p7%t8;%;m, + sgr0=\E[7m, smso=\E[m, smul=\E[4;7m, + +#### Applied Digital Data Systems (adds) +# +# ADDS itself is long gone. ADDS was bought by NCR, and the same group made +# ADDS and NCR terminals. When AT&T and NCR merged, the engineering for +# terminals was merged again. Then AT&T sold the terminal business to +# SunRiver, which later changed its name to Boundless Technologies. The +# engineers from Teletype, AT&T terminals, ADDS, and NCR (who are still there +# as of early 1995) are at: +# +# Boundless Technologies +# 100 Marcus Boulevard +# Hauppauge, NY 11788-3762 +# Vox: (800)-231-5445 +# Fax: (516)-342-7378 +# Web: http://boundless.com +# +# Their voice mail used to describe the place as "SunRiver (formerly ADDS)". +# In 1995 Boundless acquired DEC's terminals business. +# + +# Regent: lowest common denominator, works on all regents. +# (regent: renamed ":bc:" to ":le:" -- esr) +regent|Adds Regent Series, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^U, cud1=^J, cuf1=^F, cuu1=^Z, + home=\EY\s\s, ind=^J, ll=^A, +# Regent 100 has a bug where if computer sends escape when user is holding +# down shift key it gets confused, so we avoid escape. +regent100|Adds Regent 100, + xmc#1, + bel=^G, + cup=\013%p1%'\s'%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%c, + kf0=^B1\r, kf1=^B2\r, kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, + kf5=^B6\r, kf6=^B7\r, kf7=^B8\r, lf0=F1, lf1=F2, lf2=F3, + lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, rmso=\E0@, rmul=\E0@, + sgr0=\E0@, smso=\E0P, smul=\E0`, use=regent, +regent20|Adds Regent 20, + bel=^G, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, ed=\Ek, el=\EK, + use=regent, +regent25|Adds Regent 25, + bel=^G, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, khome=^A, + use=regent20, +regent40|Adds Regent 40, + xmc#1, + bel=^G, dl1=\El$<2*>, il1=\EM$<2*>, kf0=^B1\r, kf1=^B2\r, + kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, kf5=^B6\r, kf6=^B7\r, + kf7=^B8\r, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, lf5=F6, + lf6=F7, lf7=F8, rmso=\E0@, rmul=\E0@, sgr0=\E0@, smso=\E0P, + smul=\E0`, use=regent25, +regent40+|Adds Regent 40+, + is2=\EB, use=regent40, +regent60|regent200|Adds Regent 60, + dch1=\EE, is2=\EV\EB, kdch1=\EE, kich1=\EF, krmir=\EF, + rmir=\EF, rmso=\ER\E0@\EV, smir=\EF, smso=\ER\E0P\EV, + use=regent40+, +# From: Thu Jul 9 09:27:33 1981 +# (viewpoint: added , function key, and capabilities -- esr) +viewpoint|addsviewpoint|adds viewpoint, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=^L, cnorm=\017\E0`, cr=^M, cub1=^H, cud1=^J, + cuf1=^F, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, + cvvis=\017\E0P, dl1=\El, ed=\Ek$<16.1*>, el=\EK$<16>, + ind=^J, is2=\017\E0`, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, + kf0=^B1, kf2=^B2, kf3=^B!, kf4=^B", kf5=^B#, khome=^A, ll=^A, + rmso=^O, rmul=^O, sgr0=^O, smso=^N, smul=^N, +# Some viewpoints have bad ROMs that foo up on ^O +screwpoint|adds viewpoint with ^O bug, + cvvis@, rmso@, rmul@, smso@, smul@, use=viewpoint, + +# From: Jay S. Rouman 5 Jul 92 +# The /// strings were added by ESR from specs. +# Theory; the vp3a+ wants \E0%c to set highlights, where normal=01000000, +# underline=01100000, rev=01010000, blink=01000010,dim=01000001, +# invis=01000100 and %c is the logical or of desired attributes. +# There is also a `tag bit' enabling attributes, set by \E) and unset by \E(. +# +# Update by TD - 2004: +# Adapted from +# https://web.archive.org/web/19990922005103/http://www.cs.utk.edu/~shuford/terminal/adds_viewpoint_news.txt +# +# COMMANDS ASCII CODE +# +# Address, Absolute ESC,=,row,column +# Beep BEL +# Aux Port Enable ESC,@ +# Aux Port Disable ESC,A +# Backspace BS +# Cursor back BS +# Cursor down LF +# Cursor forward FF +# Cursor home RS +# Cursor up VT +# Cursor supress ETB +# Cursor enable CAN +# Erase to end of line ESC,T +# Erase to end of page ESC,Y +# Erase screen SUB +# Keyboard lock SI +# Keyboard unlock SO +# Read current cursor position ESC,? +# Set Attribute ESC,0,x (see below for values of x) +# Tag bit reset ESC,( +# Tag bit set ESC,) +# Transparent Print on ESC,3 +# Transparent Print off ESC,4 +# +# +# ATTRIBUTES +# +# Normal @ 0100 +# Half Intensity A 0101 +# Blinking B 0102 +# Half Intensity Blinking C 0103 +# Reverse Video P 0120 +# Reverse Video Half Intensity Q 0121 +# Reverse Video Blinking R 0122 +# Reverse Video Half Intensity +# Blinking S 0123 +# Underlined ` 0140 +# Underlined Half Intensity a 0141 +# Underlined Blinking b 0142 +# Underlined Half Intensity +# Blinking c 0143 +# Video suppress D 0104 +vp3a+|viewpoint3a+|adds viewpoint 3a+, + am, bw, + cols#80, it#8, lines#24, + blink=\E0B\E), civis=^W, clear=\E*$<80>, cnorm=^X, cr=^M, + cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dim=\E0A\E), + ed=\EY$<80>, el=\ET, home=^^, ht=^I, ind=^J, invis=\E0D\E), + kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, + nel=^M^J, rev=\E0P\E), rmso=\E(, + sgr=%?%p1%p2%|%p3%|%p4%|%p5%|%p7%|%t\E0%{64}%?%p1%t%{17}%|%; + %?%p2%t%{32}%|%;%?%p3%t%{16}%|%;%?%p4%t%{2}%|%;%?%p5%t + %{1}%|%;%c%?%p7%tD%;\E)%e\E(%;, + sgr0=\E(, smso=\E0Q\E), smul=\E0`\E), +vp60|viewpoint60|addsvp60|adds viewpoint60, + use=regent40, +# +# adds viewpoint 90 - from cornell +# Note: emacs sends ei occasionally to insure the terminal is out of +# insert mode. This unfortunately puts the viewpoint90 IN insert +# mode. A hack to get around this is . (Also, +# - :ei=:im=: must be present in the termcap translation.) +# - indicates glitch that attributes stick to location +# - means it's safe to move in standout mode +# - : clears screen and visual attributes without affecting +# the status line +# Function key and label capabilities merged in from SCO. +vp90|viewpoint90|adds viewpoint 90, + OTbs, bw, msgr, xhp, + cols#80, lines#24, + clear=\EG\Ek, cub1=^H, cud1=^J, cuf1=^F, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dch1=\EE, + dl1=\El, ed=\Ek, el=\EK, home=\EY\s\s, ht=^I, + ich1=\EF \EF\025, ind=^J, kbs=^H, kcub1=^U, kcud1=^J, + kcuf1=^F, kcuu1=^Z, kf0=^B1\r, kf1=^B2\r, kf10=^B;\r, + kf2=^B3\r, kf3=^B4\r, kf4=^B5\r, kf5=^B6\r, kf6=^B7\r, + kf7=^B8\r, kf8=^B9\r, kf9=^B\:\r, khome=^A, lf0=F1, lf1=F2, + lf10=F11, lf2=F3, lf3=F4, lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, + lf9=F10, ll=^A, rmso=\ER\E0@\EV, rmul=\ER\E0@\EV, + sgr0=\ER\E0@\EV, smso=\ER\E0Q\EV, smul=\ER\E0`\EV, +# Note: if return acts weird on a980, check internal switch #2 +# on the top chip on the CONTROL pc board. +adds980|a980|adds consul 980, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\014$<1>\013@, cr=^M, cub1=^H, cud1=^J, + cuf1=\E^E01, cup=\013%p1%{64}%+%c\E\005%p2%2d, + dl1=\E\017$<13>, il1=\E\016$<13>, ind=^J, kf0=\E0, kf1=\E1, + kf2=\E2, kf3=\E3, kf4=\E4, kf5=\E5, kf6=\E6, kf7=\E7, kf8=\E8, + kf9=\E9, rmso=^O, sgr0=^O, smso=^Y^^^N, + +#### C. Itoh Electronics +# +# As of 1995 these people no longer make terminals (they're still in the +# printer business). Their terminals were all clones of the DEC VT series. +# They're located in Orange County, CA. +# + +# CIT 80 - vt-52 emulator, the termcap has been modified to remove +# the delay times and do an auto tab set rather than the indirect +# file used in vt100. +cit80|cit-80|citoh 80, + OTbs, am, + cols#80, lines#24, + clear=\E[H\EJ, cr=^M, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\EJ, el=\EK, ff=^L, + ind=^J, is2=\E>, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, + kcuu1=\EOA, rmkx=\E[?1l\E>, smkx=\E[?1h\E=, +# From: Tim Wood Fri Sep 27 09:39:12 PDT 1985 +# (cit101: added / based on init string, merged this with c101 -- esr) +cit101|citc|C.itoh fast vt100, + OTbs, am, xenl, + cols#80, lines#24, + bel=^G, clear=\E[H\E[2J, cnorm=\E[V\E8, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + cvvis=\E7\E[U, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, + flash=\E[?5h$<200/>\E[?5l, ich1=\E[@, il1=\E[L, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[3g\E[>5g, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, +# CIE Terminals CIT-101e from Geoff Kuenning via BRL +# The following termcap entry was created from the Callan cd100 entry. The +# last two lines (with the capabilities in caps) are used by RM-cobol to allow +# full selection of combinations of reverse video, underline, and blink. +# (cit101e: removed unknown :f0=\EOp:f1=\EOq:f2=\EOr:f3=\EOs:f4=\EOt:f5=\EOu:\ +# f6=\EOv:f7=\EOw:f8=\EOx:f9=\EOy:AB=\E[0;5m:AL=\E[m:AR=\E[0;7m:AS=\E[0;5;7m:\ +# :NB=\E[0;1;5m:NM=\E[0;1m:NR=\E[0;1;7m:NS=\E[0;1;5;7m: -- esr) +cit101e|C. Itoh CIT-101e, + OTbs, OTpt, am, mir, msgr, + cols#80, it#8, lines#24, + acsc=, clear=\E[H\E[J, cnorm=, csr=\E[%i%p1%2d;%p2%2dr, + cub1=\E[D, cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, + cuu1=\E[A, cvvis=\E[?1l\E[?4l\E[?7h, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, if=/usr/share/tabset/vt100, il1=\E[L, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOT, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOm, kf6=\EOl, + kf7=\EOM, kf8=\EOn, rc=\E8, ri=\EM, rmacs=^O, rmir=\E[4l, + rmkx=\E>, rmso=\E[m, rmul=\E[m, sc=\E7, smacs=^N, smir=\E[4h, + smkx=\E=, smso=\E[7m, smul=\E[4m, +# From: David S. Lawyer, June 1997: +# The CIT 101-e was made in Japan in 1983-4 and imported by CIE +# Terminals in Irvine, CA. It was part of CITOH Electronics. In the +# late 1980's CIT Terminals went out of business. +# There is no need to use the initialization string is=... (by invoking +# tset or setterm etc.) provided that the terminal has been manually set +# up (and the setup saved with ^S) to be compatible with this termcap. To be +# compatible it should be in ANSI mode (not VT52). A set-up that +# works is to set all the manually setable stuff to factory defaults +# by pressing ^D in set-up mode. Then increse the brighness with the +# up-arrow key since the factory default will likely be dim on an old +# terminal. Then change any options you want (provided that they are +# compatible with the termcap). For my terminal I set: Screen +# Background: light; Keyclicks: silent; Auto wraparound: on; CRT saver: +# on. I also set up mine for parity (but you may not need it). Then +# save the setup with ^S. +# (cit101e-rv: added empty to suppress a tic warning. --esr) +cit101e-rv|Citoh CIT-101e (sets reverse video), + am, eo, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, + OTnl=\EM, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + civis=\E[1v, clear=\E[H\E[J, cnorm=\E[0;3;4v, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[3;5v, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5l\E[?5h$<200/>, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, + is2=\E<\E>\E[?1l\E[?3l\E[?4l\E[?5h\E[?7h\E[?8h\E[3g\E[>5g\E( + B\E[m\E[20l\E[1;24r\E[24;1H, + kbs=\177, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, nel=\EE, rc=\E8, + rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmcup=, rmir=\E[4l, + rmso=\E[m, rmul=\E[m, rs1=\Ec\E[?7h\E[>5g, sc=\E7, + sgr0=\E[m, smcup=\E[>5g\E[?7h\E[?5h, smir=\E[4h, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%p1%d;%p2%dR, + u7=\E[6n, u8=\E[?6c, u9=\E[c, +cit101e-n|CIT-101e w/o am, + am@, + cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, + use=cit101e, +cit101e-132|CIT-101e with 132 cols, + cols#132, + kbs=^H, kcub1=^H, kcud1=^J, use=cit101e, +cit101e-n132|CIT-101e with 132 cols w/o am, + am@, + cols#132, + cvvis=\E[?1l\E[?4l\E[?7l, kbs=^H, kcub1=^H, kcud1=^J, + use=cit101e, +# CIE Terminals CIT-500 from BRL +# The following SET-UP modes are assumed for normal operation: +# GENERATE_XON/XOFF:YES DUPLEX:FULL NEWLINE:OFF +# AUTOWRAP:ON MODE:ANSI SCREEN_LENGTH:64_LINES +# DSPLY_CNTRL_CODES?NO PAGE_WIDTH:80 EDIT_MODE:OFF +# Other SET-UP modes may be set for operator convenience or communication +# requirements. +# Hardware tabs are assumed to be set every 8 columns; they can be set up +# by the "reset", "tset", or "tabs" utilities. No delays are specified; use +# "stty ixon -ixany" to enable DC3/DC1 flow control! +# (cit500: I added / based on the init string -- esr) +cit500|CIE Terminals CIT-500, + OTbs, OTpt, mir, msgr, xon, + OTkn#10, cols#80, it#8, lines#64, vt#3, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + clear=\E[H\E[J, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\EM, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ed=\EJ, el=\EK, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, + il1=\E[L, ind=^J, is2=\E<\E)0, kbs=^H, kcbt=\E[Z, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[P, kdl1=\E[M, + ked=\EJ, kel=\EK, kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, + kf4=\EOU, kf5=\EOV, kf6=\EOW, kf7=\EOX, kf8=\EOY, kf9=\EOZ, + khome=\E[H, kich1=\E[4h, kil1=\E[L, krmir=\E[4l, lf0=PF1, + lf1=PF2, lf2=PF3, lf3=PF4, lf4=F15, lf5=F16, lf6=F17, lf7=F18, + lf8=F19, lf9=F20, ll=\E[64H, nel=\EE, rc=\E8, rev=\E[7m, + ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, + rmso=\E[m, rmul=\E[m, + rs1=\E<\E2\E[20l\E[?6l\E[r\E[m\E[q\E(B\017\E)0\E>, + sc=\E7, sgr0=\E[m, smacs=^N, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + +# C. Itoh printers begin here +citoh|ci8510|8510|c.itoh 8510a, + cols#80, it#8, + bold=\E!, cub1@, + is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073., + rep=\ER%p2%03d%p1%c, ri=\Er, rmul=\EY, sgr0=\E"\EY, + smul=\EX, use=lpr, +citoh-pica|citoh in pica, + is1=\EN, use=citoh, +citoh-elite|citoh in elite, + cols#96, + is1=\EE, + is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089 + ., + use=citoh, +citoh-comp|citoh in compressed, + cols#136, + is1=\EQ, + is2=\E(009\,017\,025\,033\,041\,049\,057\,065\,073\,081\,089 + \,097\,105\,113\,121\,129., + use=citoh, +# citoh has infinite cols because we don't want lp ever inserting \n\t**. +citoh-prop|citoh-ps|ips|citoh in proportional spacing mode, + cols#32767, + is1=\EP, use=citoh, +citoh-6lpi|citoh in 6 lines per inch mode, + is3=\EA, use=citoh, +citoh-8lpi|citoh in 8 lines per inch mode, + lines#88, + is3=\EB, use=citoh, + +#### Control Data (cdc) +# + +cdc456|cdc 456 terminal, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=^Y^X, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E1%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dl1=\EJ, ed=^X, + el=^V, home=^Y, il1=\EL, ind=^J, + +# Assorted CDC terminals from BRL (improvements by DAG & Ferd Brundick) +cdc721|CDC Viking, + OTbs, am, + cols#80, lines#24, + clear=^L, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, + cuu1=^W, el=^K, home=^Y, kcub1=^H, kcud1=^J, kcuf1=^I, + kcuu1=^W, khome=^Y, +cdc721ll|CDC Vikingll, + OTbs, am, + cols#132, lines#24, + clear=^L, cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, + cuu1=^W, el=^K, home=^Y, kcub1=^H, kcud1=^J, kcuf1=^I, + kcuu1=^W, khome=^Y, +# (cdc752: the BRL entry had :ll=\E1 ^Z: commented out +cdc752|CDC 752, + OTbs, am, bw, xhp, + cols#80, lines#24, + bel=^G, clear=\030\E1\s\s, cr=^M, cub1=^H, cud1=^J, cuf1=^U, + cup=\E1%p2%{32}%+%c%p1%{32}%+%c, cuu1=^Z, el=^V, + home=\E1\s\s, ind=^J, ll=^Y, rs1=\E1 \030\002\003\017, +# CDC 756 +# The following switch/key settings are assumed for normal operation: +# 96 chars SCROLL FULL duplex not BLOCK +# Other switches may be set according to communication requirements. +# Insert/delete-character cannot be used, as the whole display is affected. +# "so" & "se" are commented out until jove handles "sg" correctly. +cdc756|CDC 756, + OTbs, am, bw, + OTkn#10, cols#80, lines#24, + bel=^G, clear=^Y^X, cr=^M, cub1=^H, cud1=^J, cuf1=^U, + cup=\E1%p2%{32}%+%c%p1%{32}%+%c, cuu1=^Z, + dl1=\EJ$<6*/>, ed=^X, el=^V, home=^Y, il1=\EL$<6*/>, ind=^J, + kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^Z, kdch1=\EI, + kdl1=\EL, ked=^X, kel=^V, kf0=\EA, kf1=\EB, kf2=\EC, kf3=\ED, + kf4=\EE, kf5=\EF, kf6=\EG, kf7=\EH, kf8=\Ea, kf9=\Eb, khome=^Y, + khts=^O, kich1=\EK, kil1=\EL, lf0=F1, lf1=F2, lf2=F3, lf3=F4, + lf4=F5, lf5=F6, lf6=F7, lf7=F8, lf8=F9, lf9=F10, ll=^Y^Z, + rs1=\031\030\002\003\017, +# +# CDC 721 from Robert Viduya, Ga. Tech. via BRL. +# +# Part of the long initialization string defines the "DOWN" key to the left +# of the tab key to send an ESC. The real ESC key is positioned way out +# in right field. +# +# The termcap won't work in 132 column mode due to the way it it moves the +# cursor. Termcap doesn't have the capability (as far as I could tell) to +# handle the 721 in 132 column mode. +# +# (cdc721: changed :ri: to :sr: -- esr) +cdc721-esc|Control Data 721, + OTbs, OTpt, am, bw, msgr, xon, + OTkn#10, cols#80, it#8, lines#30, + bel=^G, blink=^N, cbt=^^^K, clear=^L, cub1=^H, cud1=^Z, + cuf1=^X, cup=\002%p2%{32}%+%c%p1%{32}%+%c, cuu1=^W, + dch1=^^N, dim=^\, dl1=^^Q, ed=^^P, el=^K, home=^Y, hts=^^^RW, + ich1=^^O, il1=^^R, ind=\036W =\036U, invis=^^^R[, + is2=\036\022B\003\036\035\017\022\025\035\036E\036\022H\036 + \022J\036\022L\036\022N\036\022P\036\022Q\036\022\036 + \022\^\036\022b\036\022i\036W\s=\036\022Z\036\011C1-`\s` + !k/o, + kbs=^H, kcub1=^H, kcud1=^Z, kcuf1=^X, kcuu1=^W, kf0=^^q, + kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, kf6=^^w, kf7=^^x, + kf8=^^y, kf9=^^z, khome=^Y, ll=^B =, rev=^^D, + ri=\036W =\036V, rmir=, rmkx=^^^Rl, rmso=^^E, rmul=^], + sgr0=\017\025\035\036E\036\022\\, smir=, smkx=^^^Rk, + smso=^^D, smul=^\, tbc=^^^RY, + +#### Getronics +# +# Getronics is a Dutch electronics company that at one time was called +# `Geveke' and made async terminals; but (according to the company itself!) +# they've lost all their documentation on the command set. The hardware +# documentation suggests the terminals were actually manufactured by a +# Taiwanese electronics company named Cal-Comp. There are known +# to have been at least two models, the 33 and the 50. +# + +# The 50 seems to be a top end vt220 clone, with the addition of a higher +# screen resolution, a larger screen, at least 1 page of memory above and +# below the screen, apparently pages of memory right and left of the screen +# which can be panned, and about 75 function keys (15 function keys x normal, +# shift, control, func A, func B). It also has more setup possibilities than +# the vt220. The monitor case is dated November 1978 and the keyboard case is +# May 1982. +# +# The vt100 emulation works as is. The entry below describes the rather +# non-conformant (but more featureful) ANSI mode. +# +# From: Stephen Peterson , 27 May 1995 +visa50|geveke visa 50 terminal in ansi 80 character mode, + bw, mir, msgr, + cols#80, lines#25, + acsc=0_aaffggh jjkkllmmnnooqqssttuuvvwwxx, bel=^G, + blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dX, dch1=\E[X, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5h$<100/>\E[?5l, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, + is2=\E0;2m\E[1;25r\E[25;1H\E[?3l\E[?7h\E[?8h, + ka1=\E[f, ka3=\EOQ, kb2=\EOP, kbs=^H, kc1=\EOR, kc3=\EOS, + kcub1=\E[D, kcud1=\E[A, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, + kdl1=\EOS, kf0=\E010, kf1=\E001, kf10=\E011, kf2=\E002, + kf3=\E003, kf4=\E004, kf5=\E005, kf6=\E006, kf7=\E007, + kf8=\E008, kf9=\E009, khome=\E[f, lf2=A delete char, + lf3=A insert line, lf4=A delete line, lf5=A clear, + lf6=A ce of/cf gn, lf7=A print, lf8=A on-line, + lf9=A funcl0=A send, nel=^M^J, rev=\E[7m, rmacs=\E[3l, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E>, rmso=\E[0;2m, + rmul=\E[0m, sgr0=\E[0;2m, smacs=\E3h, smam=\E?7h, + smir=\E[4h, smkx=\E=, smso=\E[2;7m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%i%p1%dd, + +#### Human Designed Systems (Concept) +# +# Human Designed Systems +# 400 Fehley Drive +# King of Prussia, PA 19406 +# Vox: (610)-277-8300 +# Fax: (610)-275-5739 +# Net: support@hds.com +# +# John Martin is their termcap expert. They're mostly out of +# the character-terminal business now (1995) and making X terminals. In +# particular, the whole `Concept' line described here was discontinued long +# ago. +# + +# From: Sat Jun 27 07:41:20 1981 +# Extensive changes to c108 by arpavax:eric Feb 1982 +# Some unknown person at SCO then translated it to terminfo. +# +# There seem to be a number of different versions of the C108 PROMS +# (with bug fixes in its Z-80 program). +# +# The first one that we had would lock out the keyboard of you +# sent lots of short lines (like /usr/dict/words) at 9600 baud. +# Try that on your C108 and see if it sends a ^S when you type it. +# If so, you have an old version of the PROMs. +# +# You should configure the C108 to send ^S/^Q before running this. +# It is much faster (at 9600 baud) than the c100 because the delays +# are not fixed. +# new status line display entries for c108-8p: +# - init str #3 - setup term for status display - +# set programmer mode, select window 2, define window at last +# line of memory, set bkgnd stat mesg there, select window 0. +# +# - to status line - select window 2, home cursor, erase to +# end-of-window, 1/2 bright on, goto(line#0, col#?) +# +# - from status line - 1/2 bright off, select window 0 +# +# - disable status display - set bkgnd status mesg with +# illegal window # +# +# There are probably more function keys that should be added but +# I don't know what they are. +# +# No delays needed on c108 because of ^S/^Q handshaking +# +c108|concept108|c108-8p|concept108-8p|concept 108 w/8 pages, + is3=\EU\E\sz"\Ev\001\177\s!p\E\s;"\E\sz\s\Ev\s\s\001\177p + \Ep\n, + rmcup=\Ev \001\177p\Ep\r\n, use=c108-4p, +c108-4p|concept108-4p|concept 108 w/4 pages, + OTbs, eslok, hs, xon, + pb@, + acsc=jEkTl\\mMqLxU, cnorm=\Ew, cr=^M, + cup=\Ea%p1%?%p1%{95}%>%t\001%{96}%-%;%{32}%+%c%p2%?%p2%{95} + %>%t\001%{96}%-%;%{32}%+%c, + cvvis=\EW, dch1=\E 1$<16*>, dsl=\E ;\177, fsl=\Ee\E z\s, + ind=^J, is1=\EK\E!\E F, + is3=\EU\E z"\Ev\177 !p\E ;"\E z \Ev \001 p\Ep\n, + rmacs=\Ej\s, rmcup=\Ev \001 p\Ep\r\n, smacs=\Ej!, + smcup=\EU\Ev 8p\Ep\r\E\025, + tsl=\E z"\E?\E\005\EE\Ea %+\s, use=c100, +c108-rv|c108-rv-8p|concept 108 w/8 pages in reverse video, + rmcup=\Ev \002 p\Ep\r\n, smcup=\EU\Ev 8p\Ep\r, + use=c108-rv-4p, +c108-rv-4p|concept108rv4p|concept 108 w/4 pages in reverse video, + flash=\EK$<200>\Ek, is1=\Ek, rmso=\Ee, smso=\EE, + use=c108-4p, +c108-w|c108-w-8p|concept108-w-8|concept108-w8p|concept 108 w/8 pages in wide mode, + cols#132, + is1=\E F\E", rmcup=\Ev ^A0\001D\Ep\r\n, + smcup=\EU\Ev 8\001D\Ep\r, use=c108-8p, + +# Concept 100: +# These have only window relative cursor addressing, not screen +# relative. To get it to work right here, smcup/rmcup (which +# were invented for the concept) lock you into a one page +# window for screen style programs. +# +# To get out of the one page window, we use a clever trick: +# we set the window size to zero ("\Ev " in rmcup) which the +# terminal recognizes as an error and resets the window to all +# of memory. +# +# This trick works on c100 but does not on c108, sigh. +# +# Some tty drivers use cr3 for concept, others use nl3, hence +# the delays on cr and ind below. This padding is only needed at +# 9600 baud and up. One or the other is commented out depending on +# local conventions. +# +# 2 ms padding on isn't always enough. 6 works fine. Maybe +# less than 6 but more than 2 will work. +# +# Note: can't use function keys f7-f10 because they are +# indistinguishable from arrow keys (!), also, del char and +# clear eol use xon/xoff so they probably won't work very well. +# +# Also note that we don't define insrt/del char/delline/eop/send +# because they don't transmit unless we reset them - I figured +# it was a bad idea to clobber their definitions. +# +# The sequence changes the escape character to ^^ so that +# escapes will be passed through to the printer. Only trouble +# is that ^^ won't be - ^^ was chosen to be unlikely. +# Unfortunately, if you're sending raster bits through to be +# plotted, any character you choose will be likely, so we lose. +# +# \EQ"\EY(^W (send anything from printer to host, for xon/xoff) +# cannot be # in is2 because it will hang a c100 with no printer +# if sent twice. +c100|concept100|concept|c104|c100-4p|hds concept 100, + OTbs, am, eo, mir, ul, xenl, + cols#80, lines#24, pb#9600, vt#8, + bel=^G, blink=\EC, clear=\E?\E\005$<2*>, cr=$<9>\r, + cub1=^H, cud1=^J, cuf1=\E=, + cup=\Ea%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E;, + dch1=\E\021$<16*>, dim=\EE, dl1=\E\002$<3*>, + ed=\E\005$<16*>, el=\E\025$<16>, flash=\Ek$<200>\EK, + ht=\011$<8>, il1=\E\022$<3*>, ind=^J, invis=\EH, ip=$<16*>, + is1=\EK, + is2=\EU\Ef\E7\E5\E8\El\ENH\E\0\Eo&\0\Eo'\E\Eo!\0\E\007!\E + \010A@\s\E4#\:"\E\:a\E4#;"\E\:b\E4#<"\E\:c, + is3=\Ev $<6>\Ep\n, kbs=^H, kcbt=\E', kctab=\E_, + kcub1=\E>, kcud1=\E<, kcuf1=\E=, kcuu1=\E;, kdch1=\E^Q, + kdl1=\E^B, ked=\E^C, kel=\E^S, kf1=\E5, kf2=\E6, kf3=\E7, + kf4=\E8, kf5=\E9, kf6=\E\:a, kf7=\E\:b, kf8=\E\:c, khome=\E?, + khts=\E], kich1=\E^P, kil1=\E^R, kind=\E[, knp=\E-, kpp=\E., + kri=\E\\, krmir=\E\0, mc4=\036o \E\EQ!\EYP\027, + mc5=\EQ"\EY(\027\EYD\Eo \036, prot=\EI, + rep=\Er%p1%c%p2%{32}%+%c$<.2*>, rev=\ED, + rmcup=\Ev $<6>\Ep\r\n, rmir=\E\s\s, rmkx=\Ex, + rmso=\Ed, rmul=\Eg, sgr0=\EN@, + smcup=\EU\Ev 8p\Ep\r\E\025$<16>, smir=\E^P, smkx=\EX, + smso=\ED, smul=\EG, +c100-rv|c100-rv-4p|concept100-rv|c100 rev video, + cnorm@, cvvis@, flash=\EK$<200>\Ek, is1=\Ek, rmso=\Ee, + smso=\EE, use=c100, +oc100|oconcept|c100-1p|old 1 page concept 100, + in, + is3@, use=c100, + +# From: Walter Skorski , 16-oct-1996. +# Lots of notes, originally inline, but ncurses doesn't grok that. +# +# am: not available in power on mode, but turned on with \E[=107;207h in +# is2=. Also, \E=124l in is2= could have been used to prevent needing +# to specify xenl:, but that would have rendered the last space on the +# last line useless. +# bw: Not available in power on mode, but turned on with \E[=107;207h in +# is2=. +# clear: Could be done with \E[2J alone, except that vi (and probably most +# other programs) assume that this also homes the cursor. +# dsl: Go to window 2, go to the beginning of the line, use a line feed to +# scroll the window, and go back to window 1. +# is2: the string may cause a warning to be issued by tic that it +# found a very long line and that it suspects that a comma is missing +# somewhere. This warning can be ignored (unless it comes up more than +# once). The initialization string contains the following commands: +# +# [Setup mode items changed from factory defaults:] +# \E)0 set alternate character set to +# graphics +# ^O set character set to default +# [In case it wasn't] +# \E[m turn off all attributes +# [In case they weren't off] +# \E[=107; cursor wrap and +# 207h character wrap on +# \E[90;3u set Fkey definitions to "transmit" +# defaults +# \E[92;3u set cursor key definitions to +# "transmit" defaults +# \E[43;1u set shift F13 to transmit... +# \177\E$P\177 +# \E[44;1u set shift F14 to transmit... +# \177\E$Q\177 +# \E[45;1u set shift F15 to transmit... +# \177\E$R\177 +# \E[46;1u set shift F16 to transmit... +# \177\E$S\177 +# \E[200;1u set shift up to transmit... +# \177\E$A\177 +# \E[201;1u set shift down to transmit... +# \177\E$B\177 +# \E[202;1u set shift right to transmit... +# \177\E$C\177 +# \E[203;1u set shift left to transmit... +# \177\E$D\177 +# \E[204;1u set shift home to transmit... +# \177\E$H\177 +# \E[212;1u set backtab to transmit... +# \177\E$I\177 +# \E[213;1u set shift backspace to transmit... +# \177\E$^H\177 +# \E[214;1u set shift del to transmit... +# "\E$\177" +# [Necessary items not mentioned in setup mode:] +# \E[2!w move to window 2 +# \E[25;25w define window as line 25 of memory +# \E[!w move to window 1 +# \E[2*w show current line of window 2 as +# status line +# \E[2+x set meta key to use high bit +# \E[;3+} move underline to bottom of character +# +# All Fkeys are set to their default transmit definitions with \E[90;3u +# in is2=. IMPORTANT: to use this terminal definition, the "quit" stty +# setting MUST be redefined or deactivated, because the default is +# contained in almost all of this terminal's Fkey strings! If for some +# reason "quit" cannot be altered, the Fkeys can, but it would be +# necessary to change ^| to ^] in all of these definitions, and add +# \E[2;029!t to is2. +# lines: is set to 24 because this terminal refuses to treat the 25th +# line normally. +# ll: Not available in power on mode, but turned on with \E[=107;207h in +# is2=. +# lm: Pointless, given that this definition locks a single screen of +# memory into view, but what the hey... +# rmso: Could use \E[1;7!{ to turn off only bold and reverse (leaving any +# other attributes alone), but some programs expect this to turn off +# everything. +# rmul: Could use \E[4!{ to turn off only underline (leaving any other +# attributes alone), but some programs expect this to turn off +# everything. +# sgr: Attributes are set on this terminal with the string \E[ followed by +# a list of attribute code numbers (in decimal, separated by +# semicolons), followed by the character m. The attribute code +# numbers are: +# 1 for bold; +# 2 for dim (which is ignored in power on mode); +# 4 for underline; +# 5 for blinking; +# 7 for inverse; +# 8 for not displayable; and +# =99 for protected (except that there are strange side +# effects to protected characters which make them inadvisable). +# The mapping of terminfo parameters to attributes is as follows: +# %p1 (standout) = bold and inverse together; +# %p2 (underline) = underline; +# %p3 (reverse) = inverse; +# %p4 (blink) = blinking; +# %p5 (dim) is ignored; +# %p6 (bold) = bold; +# %p7 (invisible) = not displayable; +# %p8 (protected) is ignored; and +# %p9 (alt char set) = alt char set. +# The code to do this is: +# \E[0 OUTPUT \E[0 +# %?%p1%p6%O IF (standout; bold) OR +# %t;1 THEN OUTPUT ;1 +# %; ENDIF +# %?%p2 IF underline +# %t;4 THEN OUTPUT ;4 +# %; ENDIF +# %?%p4 IF blink +# %t;5 THEN OUTPUT ;5 +# %; ENDIF +# %?%p1%p3%O IF (standout; reverse) OR +# %t;7 THEN OUTPUT ;7 +# %; ENDIF +# %?%p7 IF invisible +# %t;8 THEN OUTPUT ;8 +# %; ENDIF +# m OUTPUT m +# %?%p9 IF altcharset +# %t^N THEN OUTPUT ^N +# %e^O ELSE OUTPUT ^O +# %; ENDIF +# sgr0: Everything is turned off (including alternate character set), since +# there is no way of knowing what it is that the program wants turned +# off. +# smul: The "underline" attribute is reconfigurable to an overline or +# strikethru, or (as done with \E[;3+} in is2=), to a line at the true +# bottom of the character cell. This was done to allow for more readable +# underlined characters, and to be able to distinguish between an +# underlined space, an underscore, and an underlined underscore. +# xenl: Terminal can be configured to not need this, but this "glitch" +# behavior is actually preferable with autowrap terminals. +# +# Parameters kf31= thru kf53= actually contain the strings sent by the shifted +# Fkeys. There are no parameters for shifted Fkeys in terminfo. The is2 +# string modifies the 'O' in kf43 to kf46 to a '$'. +# +# kcbt was originally ^I but redefined in is2=. +# kHOM was \E[H originally but redefined in is2=, as were a number of +# other keys. +# kDC was originally \177 but redefined in is2=. +# +# kbs: Shift was also ^H originally but redefined as \E$^H in is2=. +# tsl: Go to window 2, then do an hpa=. +# +#------- flash=\E[8;3!}^G\E[3;3!} +#------- flash=\E[?5h$<100>\E[?5l +# There are two ways to flash the screen, both of which have their drawbacks. +# The first is to set the bell mode to video, transmit a bell character, and +# set the bell mode back - but to what? There is no way of knowing what the +# user's old bell setting was before we messed with it. Worse, the command to +# set the bell mode also sets the key click volume, and there is no way to say +# "leave that alone", or to know what it's set to, either. +# The second way to do a flash is to set the screen to inverse video, pad for a +# tenth of a second, and set it back - but like before, there's no way to know +# that the screen wasn't ALREADY in inverse video, or that the user may prefer +# it that way. The point is moot anyway, since vi (and probably other +# programs) assume that by defining flash=, you want the computer to use it +# INSTEAD of bel=, rather than as a secondary type of signal. +# +#------- cvvis=\E[+{ +# The is the power on setting, which is also as visible as the cursor +# gets. +#------- wind=\E[%i%p1%d;%p2%d;%p3%{1}%+%d;%p4%{1}%+%dw +# Windowing is possible, but not defined here because it is also used to +# emulate status line functions. Allowing a program to set a window could +# clobber the status line or render it unusable. There is additional memory, +# but screen scroll functions are destructive and do not make use of it. +# +#------- dim= Not available in power on mode. +# You have a choice of defining low intensity characters as "half bright" and +# high intensity as "normal", or defining low as "normal" and high as "bold". +# No matter which you choose, only one of either "half bright" or "bold" is +# available at any time, so taking the time to override the default is +# pointless. +# +#------- prot=\E[=0;99m +# Not defined, because it appears to have some strange side effects. +#------- pfkey=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%du\177%p2%s\177%; +#------- pfloc=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%du\177%p2%s\177%; +#------- pfx=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%d;1u\177%p2%s\177%; +# Available, but making them available to programs is inadvisable. +# The code to do this is: +# %?%p1%{24}%< IF ((key; 24) <; +# %p1%{30}%> ((key; 30) >; +# %p1%{54}%< (key; 54) < +# %A ) AND +# %O ) OR +# [that is, "IF key < 24 OR (key > 30 AND key < 54)",] +# %t\E[ THEN OUTPUT \E[ +# %p1%d OUTPUT (key) as decimal +# [next line applies to pfx only] +# ;1 OUTPUT ;1 +# u OUTPUT u +# \177 OUTPUT \177 +# %p2%s OUTPUT (string) as string +# \177 OUTPUT \177 +# [DEL chosen as delimiter, but could be any character] +# [implied: ELSE do nothing] +# %; ENDIF +# +#------- rs2= +# Not defined since anything it might do could be done faster and easier with +# either Meta-Shift-Reset or the main power switch. +# +#------- smkx=\E[1!z +#------- rmkx=\E[!z +# These sequences apply to the cursor and setup keys only, not to the +# numeric keypad. But it doesn't matter anyway, since making these +# available to programs is inadvisable. +# For the key definitions below, all sequences beginning with \E$ are +# custom and programmed into the terminal via is2. \E$ also has no +# meaning to any other terminal. +# +#------- cmdch=\E[;%p1%d!t +# Available, but making it available to programs is inadvisable. +#------- smxon=\E[1*q +# Available, but making it available to programs is inadvisable. +# Terminal will send XON/XOFF on buffer overflow. +#------- rmxon=\E[*q +# Available, but making it available to programs is inadvisable. +# Terminal will not notify on buffer overflow. +#------- smm=\E[2+x +#------- rmm=\E[+x +# Available, but making them available to programs is inadvisable. +# +# Printing: +# It's not made clear in the manuals, but based on other ansi/vt type +# terminals, it's a good guess that this terminal is capable of both +# "transparent print" (which doesn't copy data to the screen, and +# therefore needs mc5i: specified to say so) and "auxilliary print" +# (which does duplicate printed data on the screen, in which case mc4= +# and mc5= should use the \E[?4i and \E[?5i strings instead). + +hds200|Human Designed Systems HDS200, + am, bw, eslok, hs, km, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, lm#0, + acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, + blink=\E[0;5m, bold=\E[0;1m, cbt=\E[Z, civis=\E[6+{, + clear=\E[H\E[J, cnorm=\E[+{, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[2!w\r\n\E[!w, ed=\E[J, el=\E[K, el1=\E[1K, + fsl=\E[!w, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, + ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + invis=\E[0;8m, + is2=\E)0\017\E[m\E[=107;207h\E[90;3u\E[92;3u\E[43;1u\177\E$P + \177\E[44;1u\177\E$Q\177\E[45;1u\177\E$R\177\E[46;1u + \177\E$S\177\E[200;1u\177\E$A\177\E[201;1u\177\E$B\177 + \E[202;1u\177\E$C\177\E[203;1u\177\E$D\177\E[204;1u\177 + \E$H\177\E[212;1u\177\E$I\177\E[213;1u\177\E$\010\177\E[ + 214;1u"\E$\177"\E[2!w\E[25;25w\E[!w\E[2*w\E[2+x\E[;3+}, + kDC=\E$\177, kHOM=\E$H, kLFT=\E$D, kRIT=\E$C, kbs=^H, + kcbt=\E$I, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\177, kent=^M, kf1=^\001\r, kf10=^\010\r, + kf11=^\011\r, kf12=^\012\r, kf13=\EOP, kf14=\EOQ, + kf15=\EOR, kf16=\EOS, kf17=^\017\r, kf18=^\018\r, + kf19=^\019\r, kf2=^\002\r, kf20=^\020\r, kf21=^\021\r, + kf22=^\022\r, kf23=^\023\r, kf3=^\003\r, kf31=^\031\r, + kf32=^\032\r, kf33=^\033\r, kf34=^\034\r, kf35=^\035\r, + kf36=^\036\r, kf37=^\037\r, kf38=^\038\r, kf39=^\039\r, + kf4=^\004\r, kf40=^\040\r, kf41=^\041\r, kf42=^\042\r, + kf43=\E$P, kf44=\E$Q, kf45=\E$R, kf46=\E$S, kf47=^\047\r, + kf48=^\048\r, kf49=^\049\r, kf5=^\005\r, kf50=^\050\r, + kf51=^\051\r, kf52=^\052\r, kf53=^\053\r, kf6=^\006\r, + kf7=^\007\r, kf8=^\008\r, kf9=^\009\r, khome=\E[H, + kind=\E[T, knp=\E[U, kpp=\E[V, kri=\E[S, ll=\E[H\E[A, + nel=\E[E, rc=\E8, rev=\E[0;7m, ri=\EM, rmacs=^O, rmir=\E[4l, + rmso=\E[m\017, rmul=\E[m\017, sc=\E7, + sgr=\E[0%?%p1%p6%O%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%O%t;7 + %;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smir=\E[4h, smso=\E[0;1;7m, + smul=\E[0;4m, tbc=\E[3g, tsl=\E[2!w\E[%i%p1%dG, + vpa=\E[%i%p1%dd, use=ansi+pp, + +# through included to specify padding needed in raw mode. +# (avt-ns: added empty to suppress a tic warning --esr) +avt-ns|concept avt no status line, + OTbs, am, eo, mir, ul, xenl, xon, + cols#80, it#8, lines#24, lm#192, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + clear=\E[H\E[J$<38>, cnorm=\E[=119l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[=119h, dch1=\E[P, dim=\E[1!{, dl=\E[%p1%dM$<4*>, + dl1=\E[M$<4>, ed=\E[J$<96>, el=\E[K$<6>, home=\E[H, + hpa=\E[%p1%{1}%+%dG, ht=\011$<4>, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL$<4*>, il1=\E[L$<4>, ind=\n$<8>, + invis=\E[8m, ip=$<4>, is1=\E[=103l\E[=205l, + is2=\E[1*q\E[2!t\E[7!t\E[=4;101;119;122l\E[=107;118;207h\E)1 + \E[1Q\EW\E[!y\E[!z\E>\E[0\:0\:32!r\E[0*w\E[w\E2\r\n\E[2; + 27!t, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E^B\r, ked=\E^D\r, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, khome=\E[H, kich1=\E^A\r, kil1=\E^C\r, ll=\E[24H, + mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + pfloc=\E[%p1%d;0u#%p2%s#, pfx=\E[%p1%d;1u#%p2%s#, + prot=\E[99m, rc=\E8, rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, + ri=\EM$<4>, rmacs=\016$<1>, rmcup=\E[w\E2\r\n, + rmir=\E[4l, rmkx=\E[!z\E[0;2u, rmso=\E[7!{, rmul=\E[4!{, + sc=\E7, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1; + %;%?%p7%t8;%;%?%p8%t99;%;m%?%p5%t\E[1!{%;%?%p9%t\017%e + \016%;$<1>, + sgr0=\E[m\016$<1>, smacs=\017$<1>, + smcup=\E[=4l\E[1;24w\E2\r, smir=\E[4h, + smkx=\E[1!z\E[0;3u, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%p1%{1}%+%dd, +avt-rv-ns|concept avt in reverse video mode/no status line, + flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, + use=avt-ns, +avt-w-ns|concept avt in 132 column mode/no status line, + is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, + use=avt-ns, +avt-w-rv-ns|concept avt in 132 column mode/no status line/reverse video, + flash=\E[=205l$<200>\E[=205h, is1=\E[=103h\E[=205h, + smcup=\E[H\E[1;24;1;132w, use=avt-ns, + +# Concept AVT with status line. We get the status line using the +# "Background status line" feature of the terminal. We swipe the +# first line of memory in window 2 for the status line, keeping +# 191 lines of memory and 24 screen lines for regular use. +# The first line is used instead of the last so that this works +# on both 4 and 8 page AVTs. (Note the lm#191 or 192 - this +# assumes an 8 page AVT but lm isn't currently used anywhere.) +# +avt+s|concept avt status line changes, + eslok, hs, + lm#191, + dsl=\E[0*w, fsl=\E[1;1!w, + is3=\E[2w\E[2!w\E[1;1;1;80w\E[H\E[2*w\E[1!w\E2\r\n, + rmcup=\E[2w\E2\r\n, smcup=\E[2;25w\E2\r, + tsl=\E[2;1!w\E[;%p1%dH\E[2K, +avt|avt-s|concept-avt|avt w/80 columns, + use=avt+s, use=avt-ns, +avt-rv|avt-rv-s|avt reverse video w/sl, + flash=\E[=205l$<200>\E[=205h, is1=\E[=103l\E[=205h, + use=avt+s, use=avt-ns, +avt-w|avt-w-s|concept avt 132 cols+status, + is1=\E[=103h\E[=205l, smcup=\E[H\E[1;24;1;132w, + use=avt+s, use=avt-ns, +avt-w-rv|avt-w-rv-s|avt wide+status+rv, + flash=\E[=205l$<200>\E[=205h, is1=\E[=103h\E[=205h, + smcup=\E[H\E[1;24;1;132w, use=avt+s, use=avt-ns, + +#### Contel Business Systems. +# + +# Contel c300 and c320 terminals. +contel300|contel320|c300|Contel Business Systems C-300 or C-320, + am, in, xon, + cols#80, lines#24, xmc#1, + bel=^G, clear=\EK, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, + dch1=\EO$<5.5*>, dl1=\EM$<5.5*>, ed=\EJ$<5.5*>, + el=\EI$<5.5>, flash=\020\002$<200/>\020\003, home=\EH, + hts=\E1, ich1=\EN, il1=\EL$<5.5*>, ind=^J, ip=$<5.5*>, + kbs=^H, kf0=\ERJ, kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, + kf5=\ERE, kf6=\ERF, kf7=\ERG, kf8=\ERH, kf9=\ERI, ll=\EH\EA, + rmso=\E!\0, sgr0=\E!\0, smso=\E!\r, tbc=\E3, +# Contel c301 and c321 terminals. +contel301|contel321|c301|c321|Contel Business Systems C-301 or C-321, + flash@, ich1@, ip@, rmso=\E!\0$<20>, smso=\E!\r$<20>, + use=contel300, + +#### Data General (dg) +# +# According to James Carlson writing in January 1995, +# the terminals group at Data General was shut down in 1991; all these +# terminals have thus been discontinued. +# +# DG terminals have function keys that respond to the SHIFT and CTRL keys, +# e.g., SHIFT-F1 generates a different code from F1. To number the keys +# sequentially, first the unmodified key codes are listed as F1 through F15. +# Then their SHIFT versions are listed as F16 through F30, their CTRL versions +# are listed as F31 through F45, and their CTRL-SHIFT versions are listed as +# F46 through F60. This is done in the private "includes" below whose names +# start with "dgkeys+". +# +# DG terminals generally support 8 bit characters. For each of these terminals +# two descriptions are supplied: +# 1) A default description for 8 bits/character communications, which +# uses the default DG international character set and keyboard codes. +# 2) A description with suffix "-7b" for 7 bits/character communications. +# This description must use the NON-DEFAULT native keyboard language. + +# Unmodified fkeys (kf1-kf11), Shift fkeys (kf12-kf22), Ctrl fkeys (kf23-kf33), +# Ctrl/Shift fdkeys (kf34-kf44). + +dgkeys+8b|Private entry describing DG terminal 8-bit ANSI mode special keys, + ka1=\233020z, ka3=\233021z, kc1=\233022z, kc3=\233023z, + kclr=\2332J, kcub1=\233D, kcud1=\233B, kcuf1=\233C, + kcuu1=\233A, kel=\233K, kf1=\233001z, kf10=\233010z, + kf11=\233011z, kf12=\233012z, kf13=\233013z, + kf14=\233014z, kf15=\233000z, kf16=\233101z, + kf17=\233102z, kf18=\233103z, kf19=\233104z, + kf2=\233002z, kf20=\233105z, kf21=\233106z, + kf22=\233107z, kf23=\233108z, kf24=\233109z, + kf25=\233110z, kf26=\233111z, kf27=\233112z, + kf28=\233113z, kf29=\233114z, kf3=\233003z, + kf30=\233100z, kf31=\233201z, kf32=\233202z, + kf33=\233203z, kf34=\233204z, kf35=\233205z, + kf36=\233206z, kf37=\233207z, kf38=\233208z, + kf39=\233209z, kf4=\233004z, kf40=\233210z, + kf41=\233211z, kf42=\233212z, kf43=\233213z, + kf44=\233214z, kf45=\233200z, kf46=\233301z, + kf47=\233302z, kf48=\233303z, kf49=\233304z, + kf5=\233005z, kf50=\233305z, kf51=\233306z, + kf52=\233307z, kf53=\233308z, kf54=\233309z, + kf55=\233310z, kf56=\233311z, kf57=\233312z, + kf58=\233313z, kf59=\233314z, kf6=\233006z, + kf60=\233300z, kf7=\233007z, kf8=\233008z, kf9=\233009z, + khome=\233H, kprt=\233i, + +dgkeys+7b|Private entry describing DG terminal 7-bit ANSI mode special keys, + ka1=\E[020z, ka3=\E[021z, kc1=\E[022z, kc3=\E[023z, + kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kel=\E[K, kf1=\E[001z, kf10=\E[010z, kf11=\E[011z, + kf12=\E[012z, kf13=\E[013z, kf14=\E[014z, kf15=\E[000z, + kf16=\E[101z, kf17=\E[102z, kf18=\E[103z, kf19=\E[104z, + kf2=\E[002z, kf20=\E[105z, kf21=\E[106z, kf22=\E[107z, + kf23=\E[108z, kf24=\E[109z, kf25=\E[110z, kf26=\E[111z, + kf27=\E[112z, kf28=\E[113z, kf29=\E[114z, kf3=\E[003z, + kf30=\E[100z, kf31=\E[201z, kf32=\E[202z, kf33=\E[203z, + kf34=\E[204z, kf35=\E[205z, kf36=\E[206z, kf37=\E[207z, + kf38=\E[208z, kf39=\E[209z, kf4=\E[004z, kf40=\E[210z, + kf41=\E[211z, kf42=\E[212z, kf43=\E[213z, kf44=\E[214z, + kf45=\E[200z, kf46=\E[301z, kf47=\E[302z, kf48=\E[303z, + kf49=\E[304z, kf5=\E[005z, kf50=\E[305z, kf51=\E[306z, + kf52=\E[307z, kf53=\E[308z, kf54=\E[309z, kf55=\E[310z, + kf56=\E[311z, kf57=\E[312z, kf58=\E[313z, kf59=\E[314z, + kf6=\E[006z, kf60=\E[300z, kf7=\E[007z, kf8=\E[008z, + kf9=\E[009z, khome=\E[H, kprt=\E[i, + +dgkeys+11|Private entry describing 11 minimal-subset DG mode special keys, + kclr=^L, kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, kel=^K, + kf1=^^q, kf10=^^z, kf11=^^{, kf12=^^a, kf13=^^b, kf14=^^c, + kf15=^^d, kf16=^^e, kf17=^^f, kf18=^^g, kf19=^^h, kf2=^^r, + kf20=^^i, kf21=^^j, kf22=^^k, kf23=^^1, kf24=^^2, kf25=^^3, + kf26=^^4, kf27=^^5, kf28=^^6, kf29=^^7, kf3=^^s, kf30=^^8, + kf31=^^9, kf32=^^\:, kf33=^^;, kf34=^^!, kf35=^^", kf36=^^#, + kf37=^^$, kf38=^^%%, kf39=^^&, kf4=^^t, kf40=^^', kf41=^^(, + kf42=^^), kf43=^^*, kf44=^^+, kf5=^^u, kf6=^^v, kf7=^^w, + kf8=^^x, kf9=^^y, khome=^H, + +dgkeys+15|Private entry describing 15 DG mode special keys, + kHOM=^^^H, kLFT=^^^Y, kRIT=^^^X, ka1=^^\\, ka3=^^], kc1=^^\^, + kc3=^^_, kf1=^^q, kf10=^^z, kf11=^^{, kf12=^^|, kf13=^^}, + kf14=^^~, kf15=^^p, kf16=^^a, kf17=^^b, kf18=^^c, kf19=^^d, + kf2=^^r, kf20=^^e, kf21=^^f, kf22=^^g, kf23=^^h, kf24=^^i, + kf25=^^j, kf26=^^k, kf27=^^l, kf28=^^m, kf29=^^n, kf3=^^s, + kf30=^^`, kf31=^^1, kf32=^^2, kf33=^^3, kf34=^^4, kf35=^^5, + kf36=^^6, kf37=^^7, kf38=^^8, kf39=^^9, kf4=^^t, kf40=^^\:, + kf41=^^;, kf42=^^<, kf43=^^=, kf44=^^>, kf45=^^0, kf46=^^!, + kf47=^^", kf48=^^#, kf49=^^$, kf5=^^u, kf50=^^%%, kf51=^^&, + kf52=^^', kf53=^^(, kf54=^^), kf55=^^*, kf56=^^+, kf57=^^\,, + kf58=^^-, kf59=^^., kf6=^^v, kf60=^^\s, kf7=^^w, kf8=^^x, + kf9=^^y, + +# Data General color terminals use the "Tektronix" color model. The total +# number of colors varies with the terminal model, as does support for +# attributes used in conjunction with color. + +# Removed u7, u8 definitions since they conflict with tack: +# Preserve user-defined colors in at least some cases. +# u7=^^Fh, +# Default is ACM mode. +# u8=^^F}20^^Fi^^F}21, +# +dgunix+fixed|Fixed color info for DG D430C terminals in DG-UNIX mode, + bce, + colors#16, ncv#53, pairs#256, + op=\036Ad\036Bd, + setab=\036B%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1 + %{4}%&%t%{1}%|%;%;%{48}%+%c, + setaf=\036A%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1 + %{4}%&%t%{1}%|%;%;%{48}%+%c, + setb=\036B%p1%{48}%+%c, setf=\036A%p1%{48}%+%c, + +dg+fixed|Fixed color info for DG D430C terminals in DG mode, + use=dgunix+fixed, + +# Video attributes are coordinated using static variables set by "sgr", then +# checked by "op", "seta[bf]", and "set[bf]" to refresh the attribute settings. +# (D=dim, U=underline, B=blink, R=reverse.) +dg+color8|Color info for Data General D220 and D230C terminals in ANSI mode, + bce, + colors#8, ncv#16, pairs#64, + op=\E[%?%gD%t2;%;%?%gU%t4;%;%?%gB%t5;%;%?%gR%t7;%;m, + setab=\E[4%p1%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, + setaf=\E[3%p1%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, + setb=\E[4%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%; + %d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, + setf=\E[3%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%; + %d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m, + +dg+color|Color info for Data General D470C terminals in ANSI mode, + colors#16, ncv#53, pairs#256, + setab=\E[%?%p1%{8}%<%t4%p1%e=%p1%{2}%&%?%p1%{1}%&%t%{4}%|%; + %?%p1%{4}%&%t%{1}%|%;%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t + ;5%;%?%gR%t;7%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%e<%p1%{2}%&%?%p1%{1}%&%t%{4}%|%; + %?%p1%{4}%&%t%{1}%|%;%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t + ;5%;%?%gR%t;7%;m, + setb=\E[%?%p1%{8}%<%t4%e=%;%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%? + %p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%; + %?%gR%t;7%;m, + setf=\E[%?%p1%{8}%<%t3%e<%;%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%? + %p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%; + %?%gR%t;7%;m, + use=dg+color8, + +dgmode+color8|Color info for Data General D220/D230C terminals in DG mode, + bce, + colors#8, ncv#16, pairs#64, + op=\036Ad\036Bd, + setab=\036B%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%| + %;%{48}%+%c, + setaf=\036A%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%| + %;%{48}%+%c, + setb=\036B%p1%{48}%+%c, setf=\036A%p1%{48}%+%c, + +dgmode+color|Color info for Data General D470C terminals in DG mode, + colors#16, pairs#256, + setab=\036B%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1 + %{4}%&%t%{1}%|%;%;%{48}%+%c, + setaf=\036A%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1 + %{4}%&%t%{1}%|%;%;%{48}%+%c, + use=dgmode+color8, + +dgunix+ccc|Configurable color info for DG D430C terminals in DG-UNIX mode, + bce, ccc, + colors#52, ncv#53, pairs#26, + initp=\036RG0%p1%02X%p2%{255}%*%{1000}%/%02X%p3%{255}%* + %{1000}%/%02X%p4%{255}%*%{1000}%/%02X%p5%{255}%* + %{1000}%/%02X%p6%{255}%*%{1000}%/%02X%p7%{255}%* + %{1000}%/%02X, + oc=\036RG01A00FF00000000\036RG01B00000000FF00 + \036RG01C007F00000000\036RG01D000000007F00, + op=\036RF4831A\036RF2E31B\036RF1D31C\036RF3F31D, + scp=\036RG2%p1%02X, + +# Colors are in the order: normal, reverse, dim, dim + reverse. +dg+ccc|Configurable color info for DG D430C terminals in DG mode, + bce, ccc, + colors#52, ncv#53, pairs#26, + initp=\036RG0%p1%{16}%/%{48}%+%c%p1%{16}%m%{48}%+%c%p2%{255} + %*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c + %p3%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m + %{48}%+%c%p4%{255}%*%{1000}%/%Pa%ga%{16}%/%{48}%+%c%ga + %{16}%m%{48}%+%c%p5%{255}%*%{1000}%/%Pa%ga%{16}%/%{48} + %+%c%ga%{16}%m%{48}%+%c%p6%{255}%*%{1000}%/%Pa%ga%{16} + %/%{48}%+%c%ga%{16}%m%{48}%+%c%p7%{255}%*%{1000}%/%Pa + %ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c, + oc=\036RG01\:00??00000000\036RG01;00000000??00\036RG01<007?0 + 0000000\036RG01=000000007?00, + op=\036RF4831\:\036RF2>31;\036RF1=31<\036RF3?31=, + scp=\036RG2%p1%{16}%/%{48}%+%c%p1%{16}%m%{48}%+%c, + +# The generic DG terminal type (an 8-bit-clean subset of the 6053) +# Initialization string 1 sets: +# ^R - vertical scrolling enabled +# ^C - blinking enabled +dg-generic|Generic Data General terminal in DG mode, + am, bw, msgr, xon, + cols#80, lines#24, + bel=^G, blink=^N, clear=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, + cup=\020%p2%c%p1%c, cuu1=^W, dim=^\, el=^K, ind=^J, is1=^R^C, + mc0=^Q, nel=^J, rmso=^], rmul=^U, sgr0=^O^U^], smso=^\, + smul=^T, use=dgkeys+11, + +# According to the 4.4BSD termcap file, the dg200 should be the +# termcap equivalent of \020%p2%{128}%+%c%p1%{128}%+%c (in termcap +# notation that's "^P%r%+\200%+\200"). Those \200s are suspicious, +# maybe they were originally nuls (which would fit). + +dg200|data general dasher 200, + OTbs, am, bw, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^Y, cud1=^Z, cuf1=^X, + cup=\020%p2%c%p1%c, cuu1=^W, el=^K, home=^H, ind=^J, + kcub1=^Y, kcud1=^Z, kcuf1=^X, kcuu1=^W, kf0=^^z, kf1=^^q, + kf2=^^r, kf3=^^s, kf4=^^t, kf5=^^u, kf6=^^v, kf7=^^w, kf8=^^x, + kf9=^^y, khome=^H, lf0=f10, nel=^J, rmso=^^E, rmul=^U, + smso=^^D, smul=^T, + +# Data General 210/211 (and 410?) from Lee Pearson (umich!lp) via BRL +dg210|dg-ansi|Data General 210/211, + am, + cols#80, lines#24, + OTnl=\E[B, clear=\E[2J, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + khome=\E[H, nel=\r\E[H\E[A\n, rmso=\E[0;m, rmul=\E[0;m, + smso=\E[7;m, smul=\E[4;m, +# From: Peter N. Wan +# courtesy of Carlos Rucalde of Vantage Software, Inc. +# (dg211: this had ., which was an ancient termcap hangover. +# I suspect the d200 function keys actually work on the dg211, check it out.) +dg211|Data General d211, + cnorm=^L, cvvis=^L^R, ht=^I, ind@, kbs=^Y, kf0@, kf1@, kf2@, kf3@, + kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, lf0@, nel=^M^Z, rmcup=^L, + rmso=\036E$<0/>, smcup=^L^R, smso=\036D$<5/>, use=dg200, + +# dg450 from Cornell (not official) +dg450|dg6134|data general 6134, + cub1@, cuf1=^X, use=dg200, + +# Not official... +# Note: lesser Dasher terminals will not work with vi because vi insists upon +# having a command to move straight down from any position on the bottom line +# and scroll the screen up, or a direct vertical scroll command. The 460 and +# above have both, the D210/211, for instance, has neither. We must use ANSI +# mode rather than DG mode because standard UNIX tty drivers assume that ^H is +# backspace on all terminals. This is not so in DG mode. +# (dg460-ansi: removed obsolete ":kn#6:"; also removed ":mu=\EW:", on the +# grounds that there is no matching ":ml:" +dg460-ansi|Data General Dasher 460 in ANSI-mode, + OTbs, am, msgr, ul, + cols#80, it#8, lines#24, + OTnl=\ED, blink=\E[5m, clear=\E[2J, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, + dim=\E[2m, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + ich1=\E[@, il1=\E[L, ind=\E[S, is2=^^F@, kbs=\E[D, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf0=\E[001z, kf1=\E[002z, kf2=\E[003z, kf3=\E[004z, + kf4=\E[005z, kf5=\E[006z, kf6=\E[007z, kf7=\E[008z, + kf8=\E[009z, kf9=\E[00\:z, khome=\E[H, lf0=f1, lf1=f2, + lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf9=f10, + mc0=\E[i, rev=\E[7m, ri=\E[T, rmso=\E[m, rmul=\E[05, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p5%t;2%;%?%p2%t;4%;%?%p4%t;5%; + %?%p1%p3%|%t;7%;m, + sgr0=\E(B\E[m, smso=\E[7m, smul=\E[4m, u6=\E[%d;%dR, + u7=\E[6n, u8=\E[5n, u9=\E[0n, +# From: Wayne Throop (not official) +# Data General 605x +# Ought to work for a Model 6242, Type D210 as well as a 605x. +# Note that the cursor-down key transmits ^Z. Job control users, beware! +# This also matches a posted description of something called a `Dasher 100' +# so there's a dg100 alias here. +# (dg6053: the 4.4BSD file had , , . -- esr) +dg6053-old|dg100|data general 6053, + OTbs, am, bw, ul, + cols#80, lines#24, + OTbc=^Y, bel=^G, clear=^L, cnorm=^L, cr=^M, cub1=^Y, cud1=^Z, + cuf1=^X, cup=\020%p2%c%p1%c, cuu1=^W, cvvis=^L^R, el=^K, + home=^H, ht=^I, is2=^R, kbs=^Y, kcub1=^Y, kcud1=^Z, kcuf1=^X, + kcuu1=^W, kf0=^^q, kf1=^^r, kf2=^^s, kf3=^^t, kf4=^^u, kf5=^^v, + kf6=^^w, kf7=^^x, kf8=^^y, kf9=^^z, khome=^H, rmcup=^L, + rmso=\0^^E, rmul=^U, smcup=^L^R, smso=\0\0\0\0\0\036D, + smul=^T, + +# (Some performance can be gained over the generic DG terminal type) +dg6053|6053|6053-dg|dg605x|605x|605x-dg|d2|d2-dg|Data General DASHER 6053, + xon@, + home=^P\0\0, ll=^P\0^W, use=dg-generic, + +# Like 6053, but adds reverse video and more keypad and function keys. +d200|d200-dg|Data General DASHER D200, + bold=^^D^T, home@, ll@, rev=^^D, rmso=^^E^], + sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4 + %t\016%e\017%;%?%p1%p5%|%t\034%e\035%;, + sgr0=\017\025\035\036E, smso=^^D^\, use=dgkeys+15, + use=dg6053, + +# DASHER D210 series terminals in ANSI mode. +# Reverse video, no insert/delete character/line, 7 bits/character only. +# +# Initialization string 1 sets: +# <0 - scrolling enabled +# <1 - blink enabled +# <4 - print characters regardless of attributes +d210|d214|Data General DASHER D210 series, + am, bw, msgr, xon, + cols#80, lines#24, + bel=^G, blink=\E[5m, bold=\E[4;7m, clear=\E[2J, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dim=\E[2m, ed=\E[J, el=\E[K, + el1=\E[1K, home=\E[H, ind=^J, is1=\E[<0;<1;<4l, + ll=\E[H\E[A, nel=^J, rev=\E[7m, rmso=\E[m, rmul=\E[m, + sgr=\E[%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;%?%p1%p3%| + %p6%|%t7;%;m, + sgr0=\E[m, smso=\E[2;7m, smul=\E[4m, use=dgkeys+7b, + +# DASHER D210 series terminals in DG mode. +# Like D200, but adds clear to end-of-screen and needs XON/XOFF. +d210-dg|d214-dg|Data General DASHER D210 series in DG mode, + xon, + ed=^^FF, use=d200-dg, + +# DASHER D211 series terminals in ANSI mode. +# Like the D210, but with 8-bit characters and local printer support. +# +# Initialization string 2 sets: +# \E[2;1;1;1v +# 2;1 - 8 bit operations +# 1;1 - 8 bit (international) keyboard language +# \E(B - default primary character set (U.S. ASCII) +# \E)4 - default secondary character set (international) +# ^O - primary character set +# +d211|d215|Data General DASHER D211 series, + km, + is2=\E[2;1;1;1v\E(B\E)4\017, mc0=\E[i, use=dgkeys+8b, + use=d210, + +# Initialization string 2 sets: +# \E[2;0;1;0v +# 2;0 - 7 bit operations +# 1;0 - 7 bit (native) keyboard language +# \E(0 - default character set (the keyboard native language) +# ^O - primary character set +d211-7b|d215-7b|Data General DASHER D211 series in 7 bit mode, + km@, + is2=\E[2;0;1;0v\E(0\017, use=dgkeys+7b, use=d211, + +# Like the D210 series, but adds support for 8-bit characters. +# +# Reset string 2 sets: +# ^^N - secondary character set +# ^^FS0> - 8 bit international character set +# ^^O - primary character set +# ^^FS00 - default character set (matching the native keyboard language) +# +d211-dg|d215-dg|Data General DASHER D211 series in DG mode, + km, + rs2=\036N\036FS0>\036O\036FS00, use=d210-dg, + +d216-dg|d216e-dg|d216+dg|d216e+dg|d217-dg|Data General DASHER D216 series in DG mode, + use=d211-dg, + +# Enhanced DG mode with changes to be more UNIX compatible. +d216-unix|d216e-unix|d216+|d216e+|Data General DASHER D216+ in DG-UNIX mode, + mc5i, + it#8, + acsc=a\177j$k"l!m#n)q+t'u&v(w%x*, blink=^^PI, + clear=^^PH, cub1=^^PD, cud1=^^PB, cuf1=^^PC, cuu1=^^PA, + el=^^PE, home=^^PF, hpa=\020%p1%c\177, ht=^I, ind=^J, + is1=\022\003\036P@1, is3=\036Fz0, kHOM=^^Pf, kLFT=^^Pd, + kPRT=^^P1, kRIT=^^Pc, kclr=^^PH, kcub1=^^PD, kcud1=^^PB, + kcuf1=^^PC, kcuu1=^^PA, kel=^^PE, khome=^^PF, kprt=^^P0, + mc0=\036F?9, mc4=^^Fa, mc5=^^F`, rmacs=\036FS00, + rs2=\036N\036FS0E\036O\036FS00, + sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%; + \036P%?%p4%tI%eJ%;%?%p1%p5%|%t\034%e\035%;\036FS%?%p9%t1 + 1%e00%;, + sgr0=\036PJ\025\035\036E\036FS00, smacs=\036FS11, + vpa=\020\177%p1%c, use=dgkeys+15, use=d216-dg, +d216-unix-25|d216+25|Data General DASHER D216+ in DG-UNIX mode with 25 lines, + lines#25, + is3=\036Fz2, use=d216+, + +d217-unix|Data General DASHER D217 in DG-UNIX mode, + use=d216-unix, +d217-unix-25|Data General DASHER D217 in DG-UNIX mode with 25 lines, + use=d216-unix-25, + +# DASHER D220 color terminal in ANSI mode. +# Like the D470C but with fewer colors and screen editing features. +# +# Initialization string 1 sets: +# \E[<0;<1;<4l +# <0 - scrolling enabled +# <1 - blink enabled +# <4 - print characters regardless of attributes +# \E[m - all attributes off +# Reset string 1 sets: +# \Ec - initial mode defaults (RIS) +# +d220|Data General DASHER D220, + mc5i@, + dl@, dl1@, il@, il1@, is1=\E[<0;<1;<4l\E[m, mc4@, mc5@, rs1=\Ec, + use=dg+color8, use=d470c, + +d220-7b|Data General DASHER D220 in 7 bit mode, + mc5i@, + dl@, dl1@, il@, il1@, is1=\E[<0;<1;<4l\E[m, mc4@, mc5@, rs1=\Ec, + use=dg+color8, use=d470c-7b, + +# Initialization string 3 sets: +# - default cursor (solid rectangle) +# Reset string 2 sets: +# ^^N - secondary character set +# ^^FS0> - 8 bit international character set +# ^^O - primary character set +# ^^FS00 - default character set (matching the native keyboard language) +# +d220-dg|Data General DASHER D220 color terminal in DG mode, + mc5i@, + dl1@, home@, il1@, is2@, is3=\036FQ2, ll@, mc4@, mc5@, rs1@, + rs2=\036N\036FS0>\036O\036FS00, use=dgmode+color8, + use=d470c-dg, + +# DASHER D230C color terminal in ANSI mode. +# Like the D220 but with minor ANSI compatibility improvements. +# +d230c|d230|Data General DASHER D230C, + blink=\E[5;50m, bold=\E[4;7;50m, dim=\E[2;50m, nel=^M^J, + rev=\E[7;50m, rmkx=\E[2;1v, rmso=\E[50m, rmul=\E[50m, + sgr=\E[50%?%p1%p3%|%p6%|%t;7%{1}%e%{0}%;%PR%?%p4%t;5%{1}%e + %{0}%;%PB%?%p2%p6%|%t;4%{1}%e%{0}%;%PU%?%p1%p5%|%t;2%{1} + %e%{0}%;%PDm\E)%?%p9%t6\016%e4\017%;, + sgr0=\E[50m\E)4\017, smkx=\E[2;0v, smso=\E[2;7;50m, + smul=\E[4;50m, use=dgkeys+7b, use=d220, + +d230c-dg|d230-dg|Data General DASHER D230C in DG mode, + use=d220-dg, + +# DASHER D400/D450 series terminals. +# These add intelligent features like insert/delete to the D200 series. +# +# Initialization string 2 sets: +# ^^FQ2 - default cursor (solid rectangle) +# ^^FW - character protection disabled +# ^^FJ - normal (80 column) mode +# ^^F\^ - horizontal scrolling enabled (for alignment) +# ^^FX004? - margins at columns 0 and 79 +# ^^F] - horizontal scrolling disabled +# ^^O - primary character set +# ^^FS00 - default character set (the keyboard native language) +# - (should reset scrolling regions, but that glitches the screen) +# Reset string 1 sets: +# ^^FA - all terminal defaults except scroll rate +# Reset string 2 sets: +# ^^F] - horizontal scrolling disabled +# ^^FT0 - jump scrolling +# +d400|d400-dg|d450|d450-dg|Data General DASHER D400/D450 series, + mc5i, + acsc=j$k"l!m#n)q+t'u&v(w%x*, civis=\036FQ0, + cnorm=\036FQ2, dch1=^^K, dl1=^^FI, + enacs=\036N\036FS11\036O, home=^^FG, hpa=\020%p1%c\177, + ich1=^^J, il1=^^FH, + is2=\036FQ2\036FW\036FJ\036F\^\036FX004?\036F]\036O + \036FS00, + ll=\036FG\027, mc4=^^Fa, mc5=^^F`, ri=^^I, rmacs=^^O, + rs1=^^FA, rs2=\036F]\036FT0, + sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4 + %t\016%e\017%;%?%p1%p5%|%t\034%e\035%;\036%?%p9%tN%eO%;, + sgr0=\017\025\035\036E\036O, smacs=^^N, + vpa=\020\177%p1%c, use=d210-dg, + +# DASHER D410/D460 series terminals in ANSI mode. +# These add a large number of intelligent terminal features. +# +# Initialization string 1 sets: +# \E[<0;<1;<2;<4l +# <0 - scrolling enabled +# <1 - blink enabled +# <2 - horizontal scrolling enabled (for alignment) +# <4 - print characters regardless of attributes +# \E[5;0v - normal (80 column) mode +# \E[1;1;80w - margins at columns 1 and 80 +# \E[1;6;<2h +# 1 - print all characters even if protected +# 6 - character protection disabled +# <2 - horizontal scrolling disabled +# - (should reset scrolling regions, but that glitches the screen) +# +# Initialization string 2 sets: +# \E[3;2;2;1;1;1v +# 3;2 - default cursor (solid rectangle) +# 2;1 - 8 bit operations +# 1;1 - international keyboard language +# \E(B - default primary character set (U.S. ASCII) +# \E)4 - default secondary character set (international) +# ^O - primary character set +# +# Reset string 1 sets: +# \Ec - initial mode defaults (RIS) +# \E[<2h - horizontal scrolling disabled +# +# Reset string 2 sets: +# \E[4;0;2;1;1;1v +# 4;0 - jump scrolling +# 2;1 - 8 bit operations +# 1;1 - 8 bit (international) keyboard language +# \E(B - default primary character set (U.S. ASCII) +# \E)4 - default secondary character set (international) +# +d410|d411|d460|d461|Data General DASHER D410/D460 series, + mc5i, + acsc=j$k"l!m#n)q+t'u&v(w%x*, civis=\E[3;0v, + cnorm=\E[3;2v, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, + is1=\E[<0;<1;<2;<4l\E[5;0v\E[1;1;80w\E[1;6;<2h, + is2=\E[3;2;2;1;1;1v\E(B\E)4\017, mc4=\E[4i, mc5=\E[5i, + ri=\EM, rmacs=\E)4\017, rs1=\Ec\E[<2h, + rs2=\E[4;0;2;1;1;1v\E(B\E)4, + sgr=\E[%?%p1%t2;7%;%?%p3%t7;%;%?%p4%t5;%;%?%p2%t4;%;%?%p1%p5 + %|%t2;%;%?%p6%t4;7;%;m\E)%?%p9%t6\016%e4\017%;, + sgr0=\E[m\E)4\017, smacs=\E)6\016, use=d211, + +# Initialization string 2 sets: +# \E[3;2;2;0;1;0v +# 3;2 - default cursor (solid rectangle) +# 2;0 - 7 bit operations +# 1;0 - 7 bit (native) keyboard language +# \E(0 - default character set (the keyboard native language) +# ^O - primary character set +# +# Reset string 2 sets: +# \E[4;0;2;0;1;0v +# 4;0 - jump scrolling +# 2;0 - 7 bit operations +# 1;0 - 7 bit (native) keyboard language +# \E(0 - default character set (the keyboard native language) +# +d410-7b|d411-7b|d460-7b|d461-7b|Data General DASHER D410/D460 series in 7 bit mode, + km@, + enacs=\E)6, is2=\E[3;2;2;0;1;0v\E(0\017, rmacs=^O, + rs2=\E[4;0;2;0;1;0v\E(0, + sgr=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1 + %p5%|%t2;%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, use=dgkeys+7b, use=d410, + +d410-dg|d460-dg|d411-dg|d461-dg|Data General DASHER D410/D460 series in DG mode, + km, + enacs@, rmacs=\036FS00, + sgr=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4 + %t\016%e\017%;%?%p1%p5%|%t\034%e\035%;\036FS%?%p9%t11%e0 + 0%;, + sgr0=\017\025\035\036E\036FS00, smacs=\036FS11, + use=d400-dg, + +# DASHER D410/D460 series terminals in wide (126 columns) ANSI mode. +# +# Initialization string 1 sets: +# \E[<0;<1;<2;<4l +# <0 - scrolling enabled +# <1 - blink enabled +# <2 - horizontal scrolling enabled (for alignment) +# <4 - print characters regardless of attributes +# \E[5;1v - compressed (135 column) mode +# \E[1;1;126 - margins at columns 1 and 126 +# \E[1;6;<2h +# 1 - print all characters even if protected +# 6 - character protection disabled +# <2 - horizontal scrolling disabled +# - (should reset scrolling regions, but that glitches the screen) +# +# Reset string 1 sets: +# \Ec - initial mode defaults (RIS) +# \E[5;1v - compressed (135 column) mode +# \E[1;1;126w - margins at columns 1 and 126 +# \E[<2h - horizontal scrolling disabled +# +d410-w|d411-w|d460-w|d461-w|Data General DASHER D410/D460 series in wide mode, + cols#126, + is1=\E[<0;<1;<2;<4l\E[5;1v\E[1;1;126w\E[1;6;<2h, + rs1=\Ec\E[5;1v\E[1;1;126w\E[<2h, use=d410, + +d410-7b-w|d411-7b-w|d460-7b-w|d461-7b-w|Data General DASHER D410/D460 series in wide 7 bit mode, + cols#126, + is1=\E[<0;<1;<2;<4l\E[5;1v\E[1;1;126w\E[1;6;<2h, + rs1=\Ec\E[5;1v\E[1;1;126w\E[<2h, use=d410-7b, + +d412-dg|d462-dg|d462e-dg|d412+dg|d462+dg|d413-dg|d463-dg|Data General DASHER D412/D462 series in DG mode, + use=d410-dg, + +# These add intelligent features like scrolling regions. +d412-unix|d462-unix|d412+|d462+|Data General DASHER D412+/D462+ series in Unix mode, + civis=\036FQ0, clear=^^FE, cnorm=\036FQ5, + cup=\036FP%p2%2.2X%p1%2.2X, dch1=^^K, dl1=^^FI, + home=^^FG, hpa=\036FP%p1%2.2XFF, ich1=^^J, il1=^^FH, + is2=\036FQ5\036FW\036FJ\036F\^\036FX004F\036O + \036FS00, + ll=\036FG\036PA, mc0=^A, rc=\036F}11, ri=^^I, + rs1=\036FA\036FT0, rs2=\036P@1, sc=\036F}10, + vpa=\036FPFF%p1%2.2X, + wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2 + %>%t000%;\036FX%p3%2.2X%p4%2.2X, + use=d216+, +d412-unix-w|d462-unix-w|d412+w|d462+w|Data General DASHER D412+/D462+ series in wide Unix mode, + cols#132, + is2=\036FQ5\036FW\036FK\036F\^\036FX0083\036O + \036FS00, + rs2=\036P@1\036FK\036FX0083, + wind=\036FB%?%p1%t%p1%2.2X1%;%p2%p1%-%{1}%+%2.2X1%?%{23}%p2 + %>%t001%;\036FX%p3%2.2X%p4%2.2X, + use=d412-unix, +d412-unix-25|d462-unix-25|d412+25|d462+25|Data General DASHER D412+/D462+ series in Unix mode with 25 lines, + lines#25, + is3=\036Fz2, + wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{24}%p2 + %>%t000%;\036FX%p3%2.2X%p4%2.2X, + use=d462+, +d412-unix-s|d462-unix-s|d412+s|d462+s|Data General DASHER D412+/D462+ in Unix mode with status line, + eslok, hs, + clear=\036FG\036PH, fsl=\036F}01\022, + is3=\036Fz2\036F}00\036FB180000\036F}01, ll@, + tsl=\036F}00\036FP%p1%2.2X18\036PG, + wind=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2 + %>%t%{23}%p2%-%2.2X0%;000\036FX%p3%2.2X%p4%2.2X, + use=d462+, + +# Relative cursor motions are confined to the current window, +# which is not what the scrolling region specification expects. +# Thus, relative vertical cursor positioning must be deleted. +d412-unix-sr|d462-unix-sr|d412+sr|d462+sr|Data General DASHER D412+/D462+ in Unix mode with scrolling region, + csr=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%> + %t000%;, + cud1@, cuu1@, ll@, use=d462+, + +d413-unix|d463-unix|Data General DASHER D413/D463 series in DG-UNIX mode, + use=d412-unix, +d413-unix-w|d463-unix-w|Data General DASHER D413/D463 series in wide DG-UNIX mode, + use=d412-unix-w, +d413-unix-25|d463-unix-25|Data General DASHER D413/D463 series in DG-UNIX mode with 25 lines, + use=d412-unix-25, +d413-unix-s|d463-unix-s|Data General DASHER D413/D463 in DG-UNIX mode with status line, + use=d412-unix-s, +d413-unix-sr|d463-unix-sr|Data General DASHER D413/D463 in DG-UNIX mode with scrolling region, + use=d412-unix-sr, + +d414-unix|d464-unix|Data General D414/D464 in DG-UNIX mode, + use=d413-unix, +d414-unix-w|d464-unix-w|Data General D414/D464 in wide DG-UNIX mode, + use=d413-unix-w, +d414-unix-25|d464-unix-25|Data General D414/D464 in DG-UNIX mode with 25 lines, + use=d413-unix-25, +d414-unix-s|d464-unix-s|Data General D414/D464 in DG-UNIX mode with status line, + use=d413-unix-s, +d414-unix-sr|d464-unix-sr|Data General D414/D464 in DG-UNIX mode with scrolling region, + use=d413-unix-sr, + +d430c-dg|d430-dg|Data General D430C in DG mode, + use=d413-dg, use=dg+fixed, +d430c-dg-ccc|d430-dg-ccc|Data General D430C in DG mode with configurable colors, + use=d413-dg, use=dg+ccc, + +d430c-unix|d430-unix|Data General D430C in DG-UNIX mode, + use=d413-unix, use=dgunix+fixed, +d430c-unix-w|d430-unix-w|Data General D430C in wide DG-UNIX mode, + use=d413-unix-w, use=dgunix+fixed, +d430c-unix-25|d430-unix-25|Data General D430C in DG-UNIX mode with 25 lines, + use=d413-unix-25, use=dgunix+fixed, +d430c-unix-s|d430-unix-s|Data General D430C in DG-UNIX mode with status line, + use=d413-unix-s, use=dgunix+fixed, +d430c-unix-sr|d430-unix-sr|Data General D430C in DG-UNIX mode with scrolling region, + use=d413-unix-sr, use=dgunix+fixed, +d430c-unix-ccc|d430-unix-ccc|Data General D430C in DG-UNIX mode with configurable colors, + use=d413-unix, use=dgunix+ccc, +d430c-unix-w-ccc|d430-unix-w-ccc|Data General D430C in wide DG-UNIX mode with configurable colors, + use=d413-unix-w, use=dgunix+ccc, +d430c-unix-25-ccc|d430-unix-25-ccc|Data General D430C in DG-UNIX mode with 25 lines and configurable colors, + use=d413-unix-25, use=dgunix+ccc, +d430c-unix-s-ccc|d430-unix-s-ccc|Data General D430C in DG-UNIX mode with status line and configurable colors, + use=d413-unix-s, use=dgunix+ccc, +d430c-unix-sr-ccc|d430-unix-sr-ccc|Data General D430C in DG-UNIX mode with scrolling region and configurable colors, + use=d413-unix-sr, use=dgunix+ccc, + +# DASHER D470C color terminal in ANSI mode. +# Like the D460 but with 16 colors and without a compressed mode. +# +# Initialization string 1 sets: +# \E[<0;<1;<2;<4l +# <0 - scrolling enabled +# <1 - blink enabled +# <2 - horizontal scrolling enabled (for alignment) +# <4 - print characters regardless of attributes +# \E[1;1;80w - margins at columns 1 and 80 +# \E[1;6;<2h +# 1 - print all characters even if protected +# 6 - character protection disabled +# <2 - horizontal scrolling disabled +# - (should reset scrolling regions, but that glitches the screen) +# +d470c|d470|Data General DASHER D470C, + is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, + sgr=\E[%?%p3%t7;%;%?%p4%t5;%;%?%p2%t4;%;%?%p6%t4;7;%;%?%p1%t + 2;7;%;%?%p5%t2;%;m\E)%?%p9%t6\016%e4\017%;, + use=dg+color, use=d460, + +d470c-7b|d470-7b|Data General DASHER D470C in 7 bit mode, + is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, + sgr=\E[%?%p3%t7;%;%?%p4%t5;%;%?%p2%t4;%;%?%p6%t4;7;%;%?%p1%t + 2;7;%;%?%p5%t2;%;m%?%p9%t\016%e\017%;, + use=dg+color, use=d460-7b, + +# Initialization string 2 sets: +# ^^FQ2 - default cursor (solid rectangle) +# ^^FW - character protection disabled +# ^^F\^ - horizontal scrolling enabled (for alignment) +# ^^FX004? - margins at columns 0 and 79 +# ^^F] - horizontal scrolling disabled +# ^^O - primary character set +# ^^FS00 - default character set (the keyboard native language) +# - (should reset scrolling regions, but that glitches the screen) +# +d470c-dg|d470-dg|Data General DASHER D470C in DG mode, + is2=\036FQ2\036FW\036F\^\036FX004?\036F]\036O + \036FS00, + use=dgmode+color, use=d460-dg, + +# DASHER D555 terminal in ANSI mode. +# Like a D411, but has an integrated phone. +d555|Data General DASHER D555, + use=d411, +d555-7b|Data General DASHER D555 in 7-bit mode, + use=d411-7b, +d555-w|Data General DASHER D555 in wide mode, + use=d411-w, +d555-7b-w|Data General DASHER D555 in wide 7-bit mode, + use=d411-7b-w, +d555-dg|Data General DASHER D555 series in DG mode, + use=d411-dg, + +# DASHER D577 terminal in ANSI mode. +# Like a D411, but acts as a keyboard for serial printers ("KSR" modes). +d577|Data General DASHER D577, + use=d411, +d577-7b|Data General DASHER D577 in 7-bit mode, + use=d411-7b, +d577-w|Data General DASHER D577 in wide mode, + use=d411-w, +d577-7b-w|Data General DASHER D577 in wide 7-bit mode, + use=d411-7b-w, + +d577-dg|d578-dg|Data General DASHER D577/D578 series in DG mode, + use=d411-dg, + +# DASHER D578 terminal. +# Like a D577, but without compressed mode; like a D470C in this respect. +# +# Initialization string 1 sets: +# \E[<0;<1;<2;<4l +# <0 - scrolling enabled +# <1 - blink enabled +# <2 - horizontal scrolling enabled (for alignment) +# <4 - print characters regardless of attributes +# \E[1;1;80w - margins at columns 1 and 80 +# \E[1;6;<2h +# 1 - print all characters even if protected +# 6 - character protection disabled +# <2 - horizontal scrolling disabled +# - (should reset scrolling regions, but that glitches the screen) +# +d578|Data General DASHER D578, + is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, use=d577, +d578-7b|Data General DASHER D578 in 7-bit mode, + is1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h, use=d577-7b, + +#### Datamedia (dm) +# +# Datamedia was headquartered in Nashua, New Hampshire until it went +# out of business in 1993, but the ID plates on the terminals referred +# to the factory in Pennsauken, NJ. The factory was sold to a PCB board +# manufacturer which threw out all information about the terminals. +# + +cs10|colorscan|Datamedia Color Scan 10, + msgr, + cols#80, lines#24, + bel=^G, clear=\E[H\E[J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%02d;%p2%02dH, cuu1=\E[A, ed=\E[J, el=\E[K, + ind=^J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smso=\E[7m, smul=\E[4m, +cs10-w|Datamedia Color Scan 10 with 132 columns, + cols#132, + cup=\E[%i%p1%02d;%p2%03dH, use=cs10, + +# (dm1520: removed obsolete ":ma=^\ ^_^P^YH:" -- esr) +dm1520|dm1521|datamedia 1520, + OTbs, am, xenl, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, ht=^I, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^\, kcuu1=^_, + khome=^Y, +# dm2500: this terminal has both and . Applications using +# termcap/terminfo directly (rather than through ncurses) might be confused. +dm2500|datamedia2500|datamedia 2500, + OTbs, OTnc, + cols#80, lines#24, + bel=^G, clear=^^^^\177, cub1=^H, cud1=^J, cuf1=^\, + cup=\014%p2%{96}%^%c%p1%{96}%^%c, cuu1=^Z, + dch1=\020\010\030\035$<10*>, + dl1=\020\032\030\035$<10*>, el=^W, home=^B, + ich1=\020\034\030\035$<10*>, + il1=\020\n\030\035\030\035$<15>, ind=^J, pad=\377, + rmdc=^X^], rmir=\377\377\030\035$<10>, rmso=^X^], + smdc=^P, smir=^P, smso=^N, +# dmchat is like DM2500, but DOES need "all that padding" (jcm 1/31/82) +# also, has a meta-key. +# From: +# (dmchat: ":MT:" changed to ":km:" -- esr) +dmchat|dmchat version of datamedia 2500, + km, + dl1=\020\032\030\035$<2/>, + il1=\020\n\030\035\030\035$<1*/>, use=dm2500, +# (dm3025: ":MT:" changed to ":km:" -- esr) +dm3025|datamedia 3025a, + OTbs, km, + cols#80, it#8, lines#24, + bel=^G, clear=\EM$<2>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, + dch1=\010$<6>, dl1=\EP\EA\EQ$<130>, ed=\EJ$<2>, el=\EK, + home=\EH, ht=^I, il1=\EP\n\EQ$<130>, ind=^J, ip=$<6>, + is2=\EQ\EU\EV, rmdc=\EQ, rmir=\EQ, rmso=\EO0, smdc=\EP, + smir=\EP, smso=\EO1, +dm3045|datamedia 3045a, + OTbs, am, eo, km@, ul, xenl, + dch1=\EB$<6>, dl1@, il1@, is2=\EU\EV, kcuf1=\EC, kcuu1=\EA, + kf0=\Ey\r, kf1=\Ep\r, kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, + kf5=\Et\r, kf6=\Eu\r, kf7=\Ev\r, kf8=\Ew\r, kf9=\Ex\r, + khome=\EH, pad=\177, rmdc@, rmir=\EP, rmso@, smdc@, smso@, + use=dm3025, +# Datamedia DT80 soft switches: +# 1 0=Jump 1=Smooth +# Autorepeat 0=off 1=on +# Screen 0=Dark 1=light +# Cursor 0=u/l 1=block +# +# 2 Margin Bell 0=off 1=on +# Keyclick 0=off 1=on +# Ansi/VT52 0=VT52 1=Ansi +# Xon/Xoff 0=Off 1=On +# +# 3 Shift3 0=Hash 1=UK Pound +# Wrap 0=Off 1=On +# Newline 0=Off 1=On +# Interlace 0=Off 1=On +# +# 4 Parity 0=Odd 1=Even +# Parity 0=Off 1=On +# Bits/Char 0=7 1=8 +# Power 0=60Hz 1=50Hz +# +# 5 Line Interface 0=EIA 1=Loop +# Aux Interface 0=EIA 1=Loop +# Local Copy 0=Off 1=On +# Spare +# +# 6 Aux Parity 0=Odd 1=Even +# Aux Parity 0=Off 1=On +# Aux Bits/Char 0=7 1=8 +# CRT Saver 0=Off 1=On +# dm80/1 is a vt100 lookalike, but it doesn't seem to need any padding. +dm80|dmdt80|dt80|datamedia dt80/1, + clear=\E[2J\E[H, cud1=^J, cuf1=\E[C, + cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, ri=\EM, + rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, + use=vt100, +# except in 132 column mode, where it needs a little padding. +# This is still less padding than the vt100, and you can always turn on +# the ^S/^Q handshaking, so you can use vt100 flavors for things like +# reverse video. +dm80w|dmdt80w|dt80w|datamedia dt80/1 in 132 char mode, + cols#132, + clear=\E[H\E[2J$<50/>, cud1=^J, + cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<5/>, + ed=\E[0J$<20/>, el=\E[0K$<20/>, use=dm80, +# From: Adam Thompson Sept 10 1995 +dt80-sas|Datamedia DT803/DTX for SAS usage, + am, bw, + cols#80, lines#24, + acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, + bel=^G, clear=^L, cr=^M, + csr=\E=%p1%{32}%+%c%{32}%c\E#1\E=%p2%{32}%+%c%{32}%c\E#2, + cub1=^H, cud1=\EB, cuf1=^\, + cup=\E=%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, dl1=\EM, ed=^K, + el=^], ff=^L, home=^Y, ht=^I, hts=\E'1, il1=\EL, ind=\EB, + is2=\E)0\E<\EP\E'0\E$2, kclr=^L, kcub1=^H, kcud1=^J, + kcuf1=^\, kcuu1=^_, ked=^K, kel=^], khome=^Y, mc4=^O, mc5=^N, + rev=\E$2\004, ri=\EI, rmacs=\EG, rmso=^X, sgr0=^X, smacs=\EF, + smso=\E$2\004, tbc=\E'0, + +# Datamedia Excel 62, 64 from Gould/SEL UTX/32 via BRL +# These aren't end-all Excel termcaps; but do insert/delete char/line +# and name some of the extra function keys. (Mike Feldman ccvaxa!feldman) +# The naming convention has been bent somewhat, with the use of E? (where +# E is for 'Excel') as # a name. This was done to distinguish the entries +# from the other Datamedias in use here, and yet to associate a model of +# the Excel terminals with the regular datamedia terminals that share +# major characteristics. +excel62|excel64|datamedia Excel 62, + dch1=\E[P, kbs=^H, kcub1=^H, kcud1=^J, kf5=\EOu, kf6=\EOv, + kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, smir=\E[4h, + use=dt80, +excel62-w|excel64-w|datamedia Excel 62 in 132 char mode, + dch1=\E[P, kbs=^H, kcub1=^H, kcud1=^J, kf5=\EOu, kf6=\EOv, + kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, smir=\E[4h, + use=dt80w, +excel62-rv|excel64-rv|datamedia Excel 62 in reverse video mode, + dch1=\E[P, flash=\E[?5l\E[?5h, kbs=^H, kcub1=^H, kcud1=^J, + kf5=\EOu, kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy, rmir=\E[4l, + smir=\E[4h, use=dt80, + +#### Falco +# +# Falco Data Products +# 440 Potrero Avenue +# Sunnyvale, CA 940864-196 +# Vox: (800)-325-2648 +# Fax: (408)-745-7860 +# Net: techsup@charm.sys.falco.com +# +# Current Falco models as of 1995 are generally ANSI-compatible and support +# emulations of DEC VT-series, Wyse, and Televideo types. +# + +# Test version for Falco ts-1. See for info +# This terminal was released around 1983 and was discontinued long ago. +# The standout and underline highlights are the same. +falco|ts1|ts-1|falco ts-1, + OTbs, am, + cols#80, it#8, lines#24, + bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET\EG0\010, home=^^, ht=^I, il1=\EE, + ind=^J, is2=\Eu\E3, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, + kf0=^A0\r, rmir=\Er, rmso=\Eg0, rmul=\Eg0, sgr0=\Eg0, + smir=\Eq, smso=\Eg1, smul=\Eg1, +falco-p|ts1p|ts-1p|falco ts-1 with paging option, + OTbs, am, da, db, mir, msgr, ul, + cols#80, it#8, lines#24, + bel=^G, cbt=\EI, clear=\E*, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E[A, + dch1=\EW, dl1=\ER, ed=\EY, el=\ET\EG0\010\Eg0, ht=^I, + il1=\EE, ind=^J, is2=\EZ\E3\E_c, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, rmcup=\E_b, rmir=\Er, + rmso=\Eg0, rmul=\Eg0, sgr0=\Eg0, smcup=\E_d, smir=\Eq, + smso=\Eg4, smul=\Eg1, +# (ts100: I added / based on the init string -- esr) +ts100|ts100-sp|falco ts100-sp, + am, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, dch1=\E~W, dl1=\E~R, ed=\E[J$<50>, + el=\E[K$<3>, el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, + ht=^I, hts=\EH, ich1=\E~Q, il1=\E~E, ind=^J, is1=\E~)\E~ea, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, + rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;$<2>, + sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, + use=vt100+fnkeys, +ts100-ctxt|falco ts-100 saving context, + rmcup=\E~_b, smcup=\E~_d\E[2J, use=ts100, + +#### Florida Computer Graphics +# + +# Florida Computer Graphics Beacon System, using terminal emulator program +# "host.com", as provided by FCG. This description is for an early release +# of the "host" program. Known bug: clears the whole screen, so it's +# commented out. + +# From: David Bryant 1/7/83 +beacon|FCG Beacon System, + am, da, db, + cols#80, lines#32, + bel=\ESTART\r\E37\r\EEND\r$<1>, + blink=\ESTART\r\E61\,1\r\EEND\r, clear=\EZ$<10>, cr=^M, + cub1=^H, cud1=^J, cuf1=\EV, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<20>, cuu1=\EU, + dch1=\EW, dl1=\ER, el=\ET, home=\EH$<10>, ich1=\EQ, il1=\EE, + ind=^J, rev=\ESTART\r\E59\,1\r\EEND\r, rmcup=, + rmso=\ESTART\r\E70\,0\r\EEND\r$<20>, + rmul=\ESTART\r\E60\,0\r\EEND\r, + sgr0=\ESTART\r\E78\r\E70\,0\r\EEND\r$<20>, + smcup=\ESTART\r\E2\,0\r\E12\r\EEND\r$<10>, + smso=\ESTART\r\E70\,6\r\EEND\r$<20>, + smul=\ESTART\r\E60\,1\r\EEND\r, + +#### Fluke +# + +# The f1720a differences from ANSI: no auto margin, destructive +# tabs, # of lines, funny highlighting and underlining +f1720|f1720a|fluke 1720A, + xt, + cols#80, lines#16, xmc#1, + bel=^G, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, + el=\E[K, ind=\ED, is2=\E[H\E[2J, kcub1=^_, kcud1=^], + kcuf1=^^, kcuu1=^\, ri=\EM, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smso=\E[7m, smul=\E[4m, + +#### Liberty Electronics (Freedom) +# +# Liberty Electronics +# 48089 Fremont Blvd +# Fremont CA 94538 +# Vox: (510)-623-6000 +# Fax: (510)-623-7021 + +# From: +# (f100: added empty to suppress a tic warning; +# made this relative to adm+sgr -- note that isn't +# known to work for f100 but does on the f110. --esr) +f100|freedom|freedom100|freedom model 100, + OTbs, am, bw, hs, mir, msgr, xon, + cols#80, lines#24, + acsc=, bel=^G, cbt=\EI, clear=^Z, cr=^M, cub1=^H, cud1=^J, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dl1=\ER$<11.5*>, dsl=\Eg\Ef\r, ed=\EY, el=\ET, + flash=\Eb$<200>\Ed, fsl=^M, home=^^, hpa=\E]%p1%{32}%+%c, + ht=^I, hts=\E1, il1=\EE$<8.5*>, ind=^J, ip=$<6>, + is2=\Eg\Ef\r\Ed, kbs=^H, kcbt=\EI, kcub1=^H, kcud1=^V, + kcuf1=^L, kcuu1=^K, kf1=^A@\r, kf10=^AI\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^^, ri=\Ej, rmacs=\E$, rmir=\Er, + smacs=\E%%, smir=\Eq, tbc=\E3, tsl=\Eg\Ef, + vpa=\E[%p1%{32}%+%c, use=adm+sgr, +f100-rv|freedom-rv|freedom 100 in reverse video, + flash=\Ed$<200>\Eb, is2=\Eg\Ef\r\Eb, use=f100, +# The f110 and f200 have problems with vi(1). They use the ^V +# code for the down cursor key. When kcud1 is defined in terminfo +# as ^V, the Control Character Quoting capability (^V in insert mode) +# is lost! It cannot be remapped in vi because it is necessary to enter +# a ^V to to quote the ^V that is being remapped!!! +# +# f110/f200 users will have to decide whether +# to lose the down cursor key or the quoting capability. We will opt +# initially for leaving the quoting capability out, since use of VI +# is not generally applicable to most interactive applications +# (f110: added , & from f100 -- esr) +f110|freedom110|Liberty Freedom 110, + bw@, eslok, + it#8, wsl#80, + blink=\EG2, bold=\EG0, civis=\E.1, cnorm=\E.2, cud1=^V, + dim=\EG@, dl1=\ER, dsl=\Ef\r, flash=\Eb$<200/>\Ed, il1=\EE, + ip@, is2@, kclr=^^, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, + kf0=^AI\r, kf10@, kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, + ri=\EJ, rmacs=\E%%, rmir=\Er\EO, smacs=\E$, smir=\EO\Eq, + smso=\EG<, tsl=\Ef, use=f100, +f110-14|Liberty Freedom 110 14inch, + dch1@, use=f110, +f110-w|Liberty Freedom 110 - 132 cols, + cols#132, use=f110, +f110-14w|Liberty Freedom 110 14in/132 cols, + cols#132, + dch1@, use=f110, +# (f200: added to suppress tic warnings re / --esr) +f200|freedom200|Liberty Freedom 200, + OTbs, am, eslok, hs, mir, msgr, xon, + cols#80, it#8, lines#24, wsl#80, + acsc=, bel=^G, blink=\EG2, bold=\EG0, cbt=\EI, civis=\E.0, + clear=^Z, cnorm=\E.1, cr=^M, + csr=\Em0%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=^V, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, el=\ET, + flash=\Eo$<200/>\En, fsl=^M, home=^^, + hpa=\E]%p1%{32}%+%c, hts=\E1, il1=\EE, ind=^J, kbs=^H, + kclr=^^, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, + kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, + ri=\EJ, rmacs=\E%%, rmir=\Er, smacs=\E$, smir=\Eq, smso=\EG<, + tbc=\E3, tsl=\Ef, vpa=\E[%p1%{32}%+%c, use=adm+sgr, +f200-w|Liberty Freedom 200 - 132 cols, + cols#132, use=f200, +# The f200 has the ability to reprogram the down cursor key. The key is +# reprogrammed to ^J (linefeed). This value is remembered in non-volatile RAM, +# so powering the terminal off and on will not cause the change to be lost. +f200vi|Liberty Freedom 200 for vi, + flash=\Eb$<200/>\Ed, kcud1=^J, use=f200, +f200vi-w|Liberty Freedom 200 - 132 cols for vi, + cols#132, use=f200vi, + +#### GraphOn (go) +# +# Graphon Corporation +# 544 Division Street +# Campbell, CA 95008 +# Vox: (408)-370-4080 +# Fax: (408)-370-5047 +# Net: troy@graphon.com (Troy Morrison) +# +# +# The go140 and go225 have been discontinued. GraphOn now makes X terminals, +# including one odd hybrid that starts out life on power-up as a character +# terminal, than can be switched to X graphics mode (driven over the serial +# line) by an escape sequence. No info on this beast yet. +# (go140: I added / based on the init string -- esr) +go140|graphon go-140, + OTbs, + cols#80, it#8, lines#24, + clear=\E[H\E[2J$<10/>, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J$<10/>, el=\E[K, ht=^I, + if=/usr/share/tabset/vt100, il1=\E[L, + is2=\E<\E=\E[?3l\E[?7l\E(B\E[J\E7\E[;r\E8\E[m\E[q, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, ri=\EM, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, +go140w|graphon go-140 in 132 column mode, + am, + cols#132, + is2=\E<\E=\E[?3h\E[?7h\E(B\E[J\E7\E[;r\E8\E[m\E[q, + use=go140, +# Hacked up vt200 termcap to handle GO-225/VT220 +# From: +# (go225: I added / based on the init string -- esr) +go225|go-225|Graphon 225, + OTbs, am, mir, xenl, + cols#80, it#8, lines#25, vt#3, + blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[L, ind=\ED, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, rc=\E8, rev=\E[7m, + rf=/usr/share/tabset/vt100, ri=\EM, rmam=\E[?7l, + rmcup=\E[!p\E[?7h\E[2;1;1#w, rmir=\E[4l, rmkx=\E>, + rmso=\E[27m, rmul=\E[24m, rs1=\E[!p\E[?7h\E[2;1;1#w, + sc=\E7, sgr0=\E[m, smam=\E[?7h, smcup=\E[2;0#w\E[1;25r, + smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, + +#### Harris (Beehive) +# +# Bletch. These guys shared the Terminal Brain Damage laurels with Hazeltine. +# Their terminal group is ancient history now (1995) though the parent +# company is still in business. +# + +# Beehive documentation is undated and marked Preliminary and has no figures +# so we must have early Superbee2 (Model 600, according to phone conversation +# with mfr.). It has proved reliable except for some missing padding +# (notably after \EK and at bottom of screen). +# +# The key idea is that AEP mode is poison for & that US's in +# the local memory should be avoided like the plague. That means +# that the 2048 character local buffer is used as 25 lines of 80 +# characters, period. No scrolling local memory, folks. It also +# appears that we cannot use naked INS LINE feature since it uses +# US. The sbi fakes with an 80-space insert that may be too +# slow at low speeds; also spaces get converted to \040 which is +# too long for some programs (not vi). DEL LINE is ok but slow. +# +# The string is designed for last line of screen ONLY; cup to +# 25th line corrects the motion inherent in scrolling to Page 1. +# +# There is one understood bug. It is that the screen appears to +# pop to a new (blank) page after a , or leave a half-line +# ellipsis to a quad that is the extra 48 memory locations. The +# data received is dumped into memory but not displayed. Not to +# worry if is being used; the lines not displayed will be, +# whenever the cursor is moved up there. Since is addressed +# relative to MEMORY of window, nothing is lost; but beware of +# relative cursor motion (,,,). Recommended, +# therefore, is setenv MORE -c . +# +# WARNING: Not all features tested. +# +# Timings are assembled from 3 sources. Some timings may reflect +# SB2/Model 300 that were used if more conservative. +# Tested on a Model 600 at 1200 and 9600 bd. +# +# The BACKSPACEkb option is cute. The NEWLINE key, so cleverly +# placed on the keyboard and useless because of AEP, is made +# into a backspace key. In use ESC must be pressed twice (to send) +# and sending ^C must be prefixed by ESC to avoid that weird +# transmit mode associated with ENTER key. +# +# IF TERMINAL EVER GOES CATATONIC with the cursor buzzing across +# the screen, then it has dropped into ENTER mode; hit +# RESET--ONLINE--!tset. +# +# As delivered this machine has a FATAL feature that will throw +# it into that strange transmit state (SPOW) if the space bar is +# hit after a CR is received, but before receiving a LF (or a +# few others). +# +# The circuits MUST be modified to eliminate the SPOW latch. +# This is done by strapping on chip A46 of the I/O board; cut +# the p.c. connection to Pin 5 and strap Pin 5 to Pin 8 of that +# chip. This mod has been checked out on a Mod 600 of Superbee II. +# With this modification absurdly high timings on cr are +# unnecessary. +# +# NOTE WELL that the rear panel switch should be set to CR/LF, +# not AEP! +# +sb1|beehive superbee, + OTbs, am, bw, da, db, mir, ul, xsb, + cols#80, lines#25, xmc#1, + bel=^G, cbt=\E`$<650>, clear=\EH$<1>\EJ$<3>, cr=$<1>\r, + cub1=^H, cud1=^J, cuf1=\EC$<3>, cup=\EF%p2%03d%p1%03d, + cuu1=\EA$<3>, dch1=\EP$<3>, dl1=\EM$<100>, ed=\EJ$<3>, + el=\EK$<3>, home=\EH$<1>, ht=^I, hts=\E1, + il1=\EN\EL$<3>\EQ\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s + \s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s + \s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s + \s\s\s\s\s\EP$<3>\s\EO\ER\EA$<3>, + ind=^J, is2=\EE$<3>\EX\EZ\EO\Eb\Eg\ER, kbs=^_, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdl1=\EM, ked=\EJ, kel=\EK, + kf0=\E2, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, + kf7=\Ev, kf8=\Ew, kf9=\E1, khome=\EH, kich1=\EQ\EO, + krmir=\ER, lf0=TAB CLEAR, lf9=TAB SET, rmcup=, rmir=\ER, + rmso=\E_3, rmul=\E_3, sgr0=\E_3, smcup=\EO, smir=\EQ\EO, + smso=\E_1, smul=\E_0, tbc=\E3, +sbi|superbee|beehive superbee at Indiana U., + xsb, + cr=\r$<1>, il1=\EN$<1>\EL$<9>\EQ \EP$<9> \EO\ER\EA, + use=sb1, +# Alternate (older) description of Superbee - f1=escape, f2=^C. +# Note: there are at least 3 kinds of superbees in the world. The sb1 +# holds onto escapes and botches ^C's. The sb2 is the best of the 3. +# The sb3 puts garbage on the bottom of the screen when you scroll with +# the switch in the back set to CRLF instead of AEP. This description +# is tested on the sb2 but should work on all with either switch setting. +# The f1/f2 business is for the sb1 and the can be taken out for +# the other two if you want to try to hit that tiny escape key. +# This description is tricky: being able to use cup depends on there being +# 2048 bytes of memory and the hairy string. +superbee-xsb|beehive super bee, + am, da, db, xsb, + cols#80, it#8, lines#25, + clear=\EH\EJ$<3>, cnorm=^J, cr=\r$<1000>, cub1=^H, cud1=^J, + cuf1=\EC, cup=\EF%p2%3d%p1%3d, cuu1=\EA$<3>, + dch1=\EP$<3>, dl1=\EM$<100>, ed=\EJ$<3>, el=\EK$<3>, + home=\EH, ht=^I, hts=\E1, + ind=\n\0\0\0\n\0\0\0\EA\EK\0\0\0\ET\ET, is2=\EH\EJ, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf1=\Ep, kf2=\Eq, + kf3=\Er, kf4=\Es, kf5=\Et, kf6=\Eu, kf7=\Ev, kf8=\Ew, + khome=\EH, rmso=\E_3, sgr0=\E_3, smso=\E_1, tbc=\E3, +# This loses on lines > 80 chars long, use at your own risk +superbeeic|super bee with insert char, + ich1=, rmir=\ER, smir=\EQ, use=superbee-xsb, +sb2|sb3|fixed superbee, + xsb@, use=superbee, + +#### Beehive Medical Electronics +# +# Steve Seymour writes (Wed, 03 Feb 1999): +# Regarding your question though; Beehive terminals weren't made by Harris. +# They were made by Beehive Medical Electronics in Utah. They went out of +# business in the early '80s. +# +# (OK, then, I don't know why a couple of these say "harris beehive".) +# + +# Reports are that most of these Beehive entries (except superbee) have not +# been tested and do not work right. is a trouble spot. Be warned. + +# (bee: was empty, which is obviously bogus -- esr) +beehive|bee|harris beehive, + OTbs, am, mir, + cols#80, lines#24, + cbt=\E>, clear=\EE, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EF%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, + dl1=\EM, ed=\EJ, el=\EK, home=\EH, il1=\EL, kbs=^H, kcbt=\E>, + kclr=\EE, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kdch1=\EP, kdl1=\EM, kel=\EK, khome=\EH, kich1=\EQ, kil1=\EL, + krmir=\E@, rmir=\E@, rmso=\Ed@, rmul=\Ed@, sgr0=\Ed@, + smir=\EQ, smso=\EdP, smul=\Ed`, +# set tab is ^F, clear (one) tab is ^V, no way to clear all tabs. +# good grief - does this entry make :sg:/:ug: when it doesn't have to? +# look at those spaces in /. Seems strange to me... +# (beehive: removed, no such file. If you +# really care, cook up one using ^F -- esr) +beehive3|bh3m|beehiveIIIm|harris beehive 3m, + OTbs, am, + cols#80, it#8, lines#20, + bel=^G, clear=^E^R, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cuu1=^K, + dl1=\021$<350>, ed=^R, el=^P, home=^E, ht=^I, hts=^F, + il1=\023$<160>, ind=^J, ll=^E^K, rmso=\s^_, smso=^]\s, +beehive4|bh4|beehive 4, + am, + cols#80, lines#24, + bel=^G, clear=\EE, cr=^M, cub1=\ED, cud1=^J, cuf1=\EC, + cuu1=\EA, ed=\EJ, el=\EK, home=\EH, ind=^J, +# There was an early Australian kit-built computer called a "Microbee". +# It's not clear whether this is for one of those or for a relative +# of the Beehive. +microb|microbee|micro bee series, + OTbs, am, + cols#80, it#8, lines#24, + bel=^G, clear=\EE, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EF%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, ht=^I, ind=^J, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf1=\Ep, kf2=\Eq, kf3=\Er, kf4=\Es, kf5=\Et, + kf6=\Eu, kf7=\Ev, kf8=\Ew, kf9=\Ex, khome=\EH, rmso=\Ed@, + rmul=\Ed@, sgr0=\Ed@, smso=\s\EdP, smul=\Ed`, + +# 8675, 8686, and bee from Cyrus Rahman +# (8675: changed k10, k11...k16 to k;, F1...F6 -- esr) +ha8675|harris 8675, + is2=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU, kf1=^F, + kf10=\Ed, kf11=^W, kf12=\ER, kf13=\EE, kf14=\EI, kf15=\Ei, + kf16=\Eg, kf2=^P, kf3=^N, kf4=^V, kf5=^J, kf6=^T, kf7=^H, + kf8=\177, kf9=\Ee, use=bee, +# (8686: changed k10, k11...k16 to k;, F1...F6; fixed broken continuation +# in :is: -- esr) +ha8686|harris 8686, + is2=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU\E"*Z01\E"8F35021B7C83# + \E"8F45021B7D83#\E"8F55021B7E83#\E"8F65021B7F83#\E"8F750 + 21B7383#\E"8F851BD7#\E"8F95021B7083#\E"8FA5021B7183#\E"8 + FB5021B7283#, + kf1=\002\Ep\003, kf10=\Ej, kf11=\EW, kf12=\002\E{\003, + kf13=\002\E|\003, kf14=\002\E}\003, kf15=\002\E~\003, + kf16=\002\E\177\003, kf2=\002\Eq\003, kf3=\002\Er\003, + kf4=\002\Es\003, kf5=\E3, kf6=\EI, kf7=\ER, kf8=\EJ, kf9=\E(, + use=bee, + +#### Hazeltine +# +# Hazeltine appears to be out of the terminal business as of 1995. These +# guys were co-owners of the Terminal Brain Damage Hall Of Fame along with +# Harris. They have a hazeltine.com domain (but no web page there ) and can +# be reached at: +# +# Hazeltine +# 450 East Pulaski Road +# Greenlawn, New York 11740 +# +# As late as 1993, manuals for the terminal product line could still be +# purchased from: +# +# TRW Customer Service Division +# 15 Law Drive +# P.O. Box 2076 +# Fairfield, NJ 07007-2078 +# +# They're now (1998) a subsidiary of General Electric, operating under the +# marque "GEC-Marconi Hazeltine" and doing military avionics. Web page +# at . +# + +# Since is blank, when you want to erase something you +# are out of luck. You will have to do ^L's a lot to +# redraw the screen. h1000 is untested. It doesn't work in +# vi - this terminal is too dumb for even vi. (The code is +# there but it isn't debugged for this case.) +hz1000|hazeltine 1000, + OTbs, + cols#80, lines#12, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\s, home=^K, + ind=^J, +# From: Thu Aug 20 09:09:18 1981 +hz1420|hazeltine 1420, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\E^\, cr=^M, cub1=^H, cud1=^J, cuf1=^P, + cup=\E\021%p2%c%p1%{32}%+%c, cuu1=\E^L, dl1=\E^S, + ed=\E^X, el=\E^O, ht=^N, il1=\E^Z, ind=^J, rmso=\E^Y, + smso=\E^_, +# New "safe" cursor movement (11/87) from . Prevents +# freakout with out-of-range args and tn3270. No hz since it needs to +# receive tildes. +hz1500|hazeltine 1500, + OTbs, am, hz, + cols#80, lines#24, + bel=^G, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, + cup=~\021%p2%p2%?%{30}%>%t%{32}%+%;%{96}%+%c%p1%{96}%+%c, + cuu1=~^L, dl1=~\023$<40>, ed=~\030$<10>, el=~^O, home=~^R, + il1=~\032$<40>, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^P, + kcuu1=~^L, khome=~^R, rmso=~^Y, smso=~^_, +# h1510 assumed to be in sane escape mode. Else use h1500. +# (h1510: early versions of this entry apparently had ", +# , but these caps were commented out in 8.3; also, +# removed incorrect and overridden ":do=^J:" -- esr) +hz1510|hazeltine 1510, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\E^\, cr=^M, cub1=^H, cud1=\E^K, cuf1=^P, + cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, ed=\E^X, + el=\E^O, il1=\E^Z, ind=^J, +# Hazeltine 1520 +# The following switch settings are assumed for normal operation: +# FULL CR U/L_CASE ESCAPE +# FORMAT_OFF EOM_A_OFF EOM_B_OFF WRAPAROUND_ON +# Other switches may be set for operator convenience or communication +# requirements. +hz1520|Hazeltine 1520, + OTbs, am, bw, msgr, + cols#80, lines#24, + bel=^G, bold=\E^_, clear=\E^\, cr=^M, cub1=^H, cud1=^J, + cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, + ed=\E^X, el=\E^O, home=\E^R, il1=\E^Z, ind=^J, kbs=^H, + kclr=\E^\, kcub1=^H, kcud1=\E^K, kcuf1=^P, kcuu1=\E^L, + kdl1=\E^S, ked=\E^X, kel=\E^O, khome=\E^R, kil1=\E^Z, + rmso=\E^Y, rs1=\E$\E\005\E?\E\031, sgr0=\E^Y, smso=\E^_, +# This version works with the escape switch off +# (h1520: removed incorrect and overridden ":do=^J:" -- esr) +hz1520-noesc|hazeltine 1520, + am, hz, + cols#80, lines#24, + bel=^G, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, + cup=~\021%p2%c%p1%c$<1>, cuu1=~^L, dl1=~^S, ed=~^X, el=~^O, + home=~^R, il1=~^Z, ind=^J, rmso=~^Y, smso=~^_, +# Note: the h1552 appears to be the first Hazeltine terminal which +# is not braindamaged. It has tildes and backprimes and everything! +# Be sure the auto lf/cr switch is set to cr. +hz1552|hazeltine 1552, + OTbs, + cud1=^J, dl1=\EO, il1=\EE, kf1=\EP, kf2=\EQ, kf3=\ER, lf1=blue, + lf2=red, lf3=green, use=vt52, +hz1552-rv|hazeltine 1552 reverse video, + cud1=^J, rmso=\ET, smso=\ES, use=hz1552, +# Note: h2000 won't work well because of a clash between upper case and ~'s. +hz2000|hazeltine 2000, + OTbs, OTnc, am, + cols#74, lines#27, + bel=^G, clear=~\034$<6>, cub1=^H, cud1=^J, + cup=~\021%p2%c%p1%c, dl1=~\023$<6>, home=~^R, + il1=~\032$<6>, ind=^J, pad=\177, +# Date: Fri Jul 23 10:27:53 1982. Some unknown person wrote: +# I tested this termcap entry for the Hazeltine Esprit with vi. It seems +# to work ok. There is one problem though if one types a lot of garbage +# characters very fast vi seems not able to keep up and hangs while trying +# to insert. That's in insert mode while trying to insert in the middle of +# a line. It might be because the Esprit doesn't have insert char and delete +# char as a built in function. Vi has to delete to end of line and then +# redraw the rest of the line. +esprit|Hazeltine Esprit I, + OTbs, am, bw, + cols#80, lines#24, + bel=^G, cbt=\E^T, clear=\E^\, cr=^M, cub1=^H, cud1=\E^K, + cuf1=^P, cup=\E\021%p2%c%p1%c, cuu1=\E^L, dl1=\E^S, + ed=\E^W, el=\E^O, home=\E^R, il1=\E^Z, ind=^J, is2=\E?, kbs=^H, + kcub1=^H, kcud1=\E^K, kcuf1=^P, kcuu1=\E^L, kf0=^B0^J, + kf1=^B1^J, kf2=^B2^J, kf3=^B3^J, kf4=^B4^J, kf5=^B5^J, + kf6=^B6^J, kf7=^B7^J, kf8=^B8^J, kf9=^B9^J, khome=\E^R, + lf0=0, lf1=1, lf2=2, lf3=3, lf4=4, lf5=5, lf6=6, lf7=7, lf8=8, lf9=9, + rmkx=\E>, rmso=\E^Y, smkx=\E<, smso=\E^_, +esprit-am|hazeltine esprit auto-margin, + am, use=esprit, +# Hazeltine Modular-1 from Cliff Shackelton via BRL +# Vi it seems always wants to send a control J for "do" and it turned out +# that the terminal would work somewhat if the auto LF/CR was turned off. +# (hmod1: removed :dn=~^K: -- esr) +hmod1|Hazeltine Modular 1, + OTbs, am, hz, + cols#80, lines#24, + bel=^G, cbt=~^T, clear=~^\, cr=^M, cub1=^H, cud1=~^K, cuf1=^P, + cup=~\021%p2%c%p1%c, cuu1=~^L, dl1=~^S, home=~^R, il1=~^Z, + ind=^J, kcub1=^H, kcud1=~^K, kcuf1=^P, kcuu1=~^L, khome=~^R, + rc=~^Q, rmso=~^Y, sc=~^E, sgr0=~^Y, smso=~^_, +# +# Hazeltine Executive 80 Model 30 (1554?) +# from Will Martin via BRL +# Like VT100, except for different "am" behavior. +hazel|exec80|h80|he80|Hazeltine Executive 80, + OTbs, OTpt, am, + cols#80, it#8, lines#24, vt#3, + OTnl=^J, bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, + clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C$<2/>, + cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, + ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, ht=^I, + is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, rc=\E8, rev=\E[7m$<2/>, + rf=/usr/share/tabset/vt100, ri=\EM$<5/>, + rmkx=\E[?1l\E>, rmso=\E[m$<2/>, rmul=\E[m$<2/>, + rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m$<2/>, smkx=\E[?1h\E=, smso=\E[7m$<2/>, + smul=\E[4m$<2/>, + +#### IBM +# + +ibm327x|line mode IBM 3270 style, + gn, + clear=^M^J, el=^M, home=^M, + +ibm3101|i3101|IBM 3101-10, + OTbs, am, xon, + cols#80, lines#24, + bel=^G, clear=\EK, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EI, home=\EH, hts=\E0, ind=^J, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, nel=^M^J, tbc=\EH, +ibm3151|IBM 3151 display, + is2=\E S, rmacs=\E>B, rmcup=\E>B, rs2=\E S, s0ds=\E>B, + sgr=\E4%{64}%?%p1%t%{65}%|%;%?%p2%t%{66}%|%;%?%p3%t%{65}%|%; + %?%p4%t%{68}%|%;%?%p5%t%{64}%|%;%?%p6%t%{72}%|%;%?%p7%t + %{80}%|%;%c%?%p9%t\E>A%e\E>B%;, + sgr0=\E4@\E>B, smacs=\E>A, smcup=\E>B, use=ibm3162, +# From: Mark Easter 29 Oct 1992 +# removed kend, knp, kpp -TD +# +# From: Stephen Powell 23 Apr 2015 +# Added ich1 (kich1 without ich1 doesn't make sense). +# Added il1 (kil1 without il1 doesn't make sense). +# Added xon (terminal uses XON/XOFF flow control). +# +ibm3161|ibm3163|wy60-316X|wyse60-316X|IBM 3161/3163 display, + OTbs, am, mir, msgr, xon, + cols#80, it#8, lines#24, + acsc=j\352k\353l\354m\355n\356q\361t\364u\365v\366w\367x + \370, + bel=^G, blink=\E4D, bold=\E4H, clear=\EH\EJ, cr=^M, cub1=\ED, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dch1=\EQ, dl1=\EO, ed=\EJ, el=\EI, home=\EH, + ich1=\EP \010, il1=\EN, ind=^J, invis=\E4P, kbs=^H, kcbt=\E2, + kclr=\EL\r, kctab=\E1, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EQ, kdl1=\EO, ked=\EJ, kel=\EI, kf1=\Ea\r, + kf10=\Ej\r, kf11=\Ek\r, kf12=\El\r, kf13=\E!a\r, + kf14=\E!b\r, kf15=\E!c\r, kf16=\E!d\r, kf17=\E!e\r, + kf18=\E!f\r, kf19=\E!g\r, kf2=\Eb\r, kf20=\E!h\r, + kf21=\E!i\r, kf22=\E!j\r, kf23=\E!k\r, kf24=\E!l\r, + kf3=\Ec\r, kf4=\Ed\r, kf5=\Ee\r, kf6=\Ef\r, kf7=\Eg\r, + kf8=\Eh\r, kf9=\Ei\r, khome=\EH, khts=\E0, kich1=\EP \010, + kil1=\EN, ktbc=\E 1, mc4=^P^T, mc5=^P^R, rev=\E4A, + rmcup=\E>A, rmso=\E4@, rmul=\E4@, + sgr=\E4%{64}%?%p1%t%{65}%|%;%?%p2%t%{66}%|%;%?%p3%t%{65}%|%; + %?%p4%t%{68}%|%;%?%p5%t%{64}%|%;%?%p6%t%{72}%|%;%?%p7%t + %{80}%|%;%c%?%p9%t\E>A%e\E<@%;, + sgr0=\E4@\E<@, smcup=\E>A, smso=\E4A, smul=\E4B, + +ibm3161-C|IBM 3161-C NLS terminal using cartridge, + rmcup=\E>B, s0ds=\E>B, s1ds=\E>A, smcup=\E>B, use=ibm3161, +# +# From: Stephen Powell 23 Apr 2015 +# Deleted il1. (il1 will now be inherited from ibm3161-C, which inherits +# it from ibm3161. +# +ibm3162|IBM 3162 display, + blink=\E4$a, bold=\E4(a, invis=\E40a, rev=\E4!a, + rmso=\E4>b, rmul=\E4=b, sgr0=\E4@, smso=\E4!a, smul=\E4"a, + use=ibm3161-C, + +# This really should not use setab/setaf, but it is clear that the +# original terminfo does not toggle red/blue colors as in setb/setf. +ibm3164|i3164|IBM 3164, + msgr, + colors#8, pairs#64, + op=\E4 "@, rmcup=\E!9(N\E>B, s0ds=\E>B, s1ds=\E>A, + setab=\E4 %p1%{64}%+%c, + setaf=\E4%?%p1%t %p1%{32}%+%c%e!'%;@, + smcup=\E!9/N\E>B, use=ibm3161, + +ibm5151|wy60-AT|wyse60-AT|IBM 5151 Monochrome display, + am, bw, msgr, xon, + cols#80, it#8, lines#25, + acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x + \263, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, + hpa=\E[%i%p1%dG, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, invis=\E[8m, is2=\Ec, kbs=^H, kcbt=\E[Z, + kclr=\E[144q, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\E[P, ked=\E[148q, kel=\E[142q, + kend=\E[146q, kf1=\E[001q, kf10=\E[010q, kf11=\E[011q, + kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, kf15=\E[015q, + kf16=\E[016q, kf17=\E[017q, kf18=\E[018q, kf19=\E[019q, + kf2=\E[002q, kf20=\E[020q, kf21=\E[021q, kf22=\E[022q, + kf23=\E[023q, kf24=\E[024q, kf25=\E[025q, kf26=\E[026q, + kf27=\E[027q, kf28=\E[028q, kf29=\E[029q, kf3=\E[003q, + kf30=\E[030q, kf31=\E[031q, kf32=\E[032q, kf33=\E[033q, + kf34=\E[034q, kf35=\E[035q, kf36=\E[036q, kf4=\E[004q, + kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, + kf9=\E[009q, khome=\E[H, kich1=\E[139q, kil1=\E[140q, + kind=\E[151q, knp=\E[154q, kpp=\E[150q, kri=\E[155q, + krmir=\E[4l, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmir=\E[4l, + rmso=\E[m, rmul=\E[m, rs2=\Ec, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + %;%?%p7%t;8%;m, + sgr0=\E[0m, smir=\E[4h, smso=\E[7m, smul=\E[4m, + +ibmaed|IBM Experimental display, + OTbs, am, eo, msgr, + cols#80, it#8, lines#52, + clear=\EH\EK, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, + dl1=\EO, ed=\EJ, el=\EI, flash=\EG, home=\EH, ht=^I, ich1=\EP, + il1=\EN, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + rmso=\E0, sgr0=\E0, smso=\E0, +ibm-apl|apl|IBM apl terminal simulator, + lines#25, use=dm1520, +# (ibmmono: this had an unknown `sb' boolean, I changed it to `bs'. +# Also it had ":I0=f10:" which pretty obviously should be "l0=f10" -- esr) +ibmmono|IBM workstation monochrome, + eslok, hs, + bold=\EZ, dl1=\EM, dsl=\Ej\EY8 \EI\Ek, fsl=\Ek, il1=\EL, + invis=\EF\Ef0;\Eb0;, kbs=^H, kf0=\E<, kf1=\ES, kf2=\ET, + kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\EY, + khome=\EH, kich1=\0, kind=\EE, knp=\EE, kpp=\Eg, kri=\EG, + lf0=f10, rev=\Ep, ri=\EA, rmso=\Ez, rmul=\Ew, + sgr0=\Ew\Eq\Ez\EB, smso=\EZ, smul=\EW, tsl=\Ej\EY8%+ \Eo, + use=ibm3101, +ibmega|IBM Enhanced Color Display, + cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, + nel=^M^J, use=ibmmono, +# This color scheme is assumed in some recent IBM terminal descriptions +# (green on black, emulated on a 16-color terminal). +ibm+color|IBM color definitions, + colors#8, ncv#3, pairs#64, + op=\E[32m\E[40m, + setb=\E[%?%p1%{0}%=%t40m%e%p1%{1}%=%t41m%e%p1%{2}%=%t42m%e + %p1%{3}%=%t43m%e%p1%{4}%=%t44m%e%p1%{5}%=%t45m%e%p1%{6} + %=%t46m%e%p1%{7}%=%t107m%;, + setf=\E[%?%p1%{0}%=%t30m%e%p1%{1}%=%t31m%e%p1%{2}%=%t32m%e + %p1%{3}%=%t33m%e%p1%{4}%=%t34m%e%p1%{5}%=%t35m%e%p1%{6} + %=%t36m%e%p1%{7}%=%t97m%;, +ibm+16color|IBM aixterm color definitions, + colors#16, pairs#256, + setab=\E[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm, + setaf=\E[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm, + setb=%p1%{8}%/%{6}%*%{4}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e + %ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m, + setf=%p1%{8}%/%{6}%*%{3}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e + %ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m, +ibm5154|IBM 5154 Color display, + colors#8, ncv@, pairs#64, + bold@, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ibm5151, + use=ibm+color, +ibmega-c|ibm5154-c|IBM Enhanced Color Display with standout and underline, + rmso=\EB, rmul=\EB, smso=\EF\Ef3;, smul=\EF\Ef2;, + use=ibmmono, +ibmvga-c|IBM VGA display color termcap, + cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, + nel=^M^J, use=ibmega-c, +ibmvga|IBM VGA display, + cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, + nel=^M^J, use=ibmega, +# ibmapa* and ibmmono entries come from ACIS 4.3 distribution +rtpc|ibmapa16|IBM 6155 Extended Monochrome Graphics Display, + lines#32, + dsl=\Ej\EY@ \EI\Ek, tsl=\Ej\EY@%+ \Eo, use=ibmmono, +ibm6155|IBM 6155 Black & White display, + blink@, bold@, use=ibm5151, +# Advanced Monochrome (6153) and Color (6154) Graphics Display: +ibmapa8c|ibmapa8|IBM 6154 Advanced Graphics Display, + lines#31, + dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, use=ibmmono, +ibmapa8c-c|ibm6154-c|IBM 6154 Advanced Color Graphics Display, + lines#31, + dim=\EF\Ef7;, dsl=\Ej\EY? \EI\Ek, tsl=\Ej\EY?%+ \Eo, + use=ibmega-c, +ibm6154|IBM 6154 Color displays, + blink@, bold=\E[12m, s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + 2%;m, + sgr0=\E[0;10m, use=ibm5154, +ibm6153|IBM 6153 Black & White display, + blink@, bold=\E[12m, s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + 2%;m, + sgr0=\E[0;10m, use=ibm5151, +ibm6153-90|IBM 6153 Black & White display, + cols#90, lines#36, + blink@, bold@, use=ibm5151, +ibm6153-40|IBM 6153 Black & White display, + cols#40, lines#12, use=ibm6153-90, +ibm8512|ibm8513|IBM color VGA Terminal, + am, mir, msgr, + cols#80, it#8, lines#25, + acsc=jjkkllmmnnqqttuuvvwwxx, blink=\E[5m, bold=\E[1m, + clear=\E[H\E[J, cub1=\E[D, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, il=\E[%p1%dL, + il1=\E[L, is2=\Eb\E[m\017\E[?7h, kcud1=\E[B, kcuu1=\E[A, + kf0=\E[010q, kf1=\E[001q, kf2=\E[002q, kf3=\E[003q, + kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, + kf8=\E[008q, kf9=\E[009q, khome=\E[H, rc=\E[u, rev=\E[7m, + rmacs=^O, rmam=\E[?7l, rmcup=\E[20h, rmdc=\E[4l, + rmir=\E[4l, rmso=\E[m, rmul=\E[m, + rs1=\Eb\E[m\017\E[?7h\E[H\E[J, sc=\E[s, sgr0=\E[m, + smacs=^N, smam=\E[?7h, smcup=\E[20;4l\E[?7h\Eb, + smdc=\E[4h, smir=\E[4h, smso=\E[7m, smul=\E[4m, + use=ibm8503, +hft-c|HFT with Color, + colors#8, pairs#64, + acsc=jjkkllmmnnqqttuuvvwwxx, s0ds=\E(B, s1ds=\E(0, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[0m\E(B, + use=ibm5151, use=ibm+color, +hft-c-old|HFT with Color PC850, + colors#8, pairs#64, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=ibm5151, + use=ibm+color, +hft-old|AIWS High Function Terminal, + am, xon, + cols#80, lines#25, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, + ht=^I, ich1=\E[@, il1=\E[L, ind=^J, invis=\E[8m, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\E[001q, kf2=\E[002q, kf3=\E[003q, kf4=\E[004q, + kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, kf8=\E[008q, + kf9=\E[009q, khome=\E[H, knp=\E[153q, kpp=\E[159q, + ktbc=\E[010q, rev=\E[7m, rmir=\E6, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smir=\E6, smso=\E[7m, smul=\E[4m, use=ibm+color, +ibm-system1|system1|ibm system/1 computer, + am, xt, + cols#80, lines#24, + bel=^G, clear=^Z, cub1=^H, cuf1=^\, + cup=\005%p1%{32}%+%c%p2%{32}%+%c, cuu1=^^, home=^K, + ind=^J, +# lft-pc850 : IBM Low Function Terminal Device +# lft "supports" underline, bold, and blink in the sense that the lft code +# sets all the right bits. HOWEVER, depending upon the adapter, these +# attributes may or may not be supported by the device driver. +lft|lft-pc850|LFT-PC850|IBM LFT PC850 Device, + am, bw, msgr, xon, + cols#80, it#8, lines#25, + acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x + \263, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[2J, el=\E[0K, + home=\E[H, hpa=\E[%i%p1%dG, ich=\E[%p1%d@, il=\E[%p1%dL, + il1=\E[L, ind=\ED, indn=\E[%p1%dS, invis=\E[8m, is2=\Ec, + kbs=^H, kcbt=\E[Z, kclr=\E[144q, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, ked=\E[148q, + kel=\E[142q, kend=\E[146q, kf1=\E[001q, kf10=\E[010q, + kf11=\E[011q, kf12=\E[012q, kf13=\E[013q, kf14=\E[014q, + kf15=\E[015q, kf16=\E[016q, kf17=\E[017q, kf18=\E[018q, + kf19=\E[019q, kf2=\E[002q, kf20=\E[020q, kf21=\E[021q, + kf22=\E[022q, kf23=\E[023q, kf24=\E[024q, kf25=\E[025q, + kf26=\E[026q, kf27=\E[027q, kf28=\E[028q, kf29=\E[029q, + kf3=\E[003q, kf30=\E[030q, kf31=\E[031q, kf32=\E[032q, + kf33=\E[033q, kf34=\E[034q, kf35=\E[035q, kf36=\E[036q, + kf4=\E[004q, kf5=\E[005q, kf6=\E[006q, kf7=\E[007q, + kf8=\E[008q, kf9=\E[009q, khome=\E[H, kich1=\E[139q, + kil1=\E[140q, kind=\E[151q, knp=\E[154q, kpp=\E[150q, + kri=\E[155q, krmir=\E[4l, rev=\E[7m, ri=\EL, rin=\E[%p1%dT, + rmacs=\E(B, rmir=\E[4l, rmso=\E[0m, rmul=\E[0m, rs2=\Ec, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + %;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[0m, smacs=\E(0, smir=\E[4h, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, +# "Megapel" refers to the display adapter, which was used with the IBM RT +# aka IBM 6150. +ibm5081|hft|IBM Megapel Color display, + acsc=jjkkllmmnnqqttuuvvwwxx, blink@, bold@, s0ds=\E(B, + s1ds=\E(0, sgr0=\E[0m\E(B, use=ibm5154, +ibm5081-c|ibmmpel-c|IBM 5081 1024x1024 256/4096 Megapel enhanced color display, + eslok, hs, + lines#33, + dsl=\Ej\EYA \EI\Ek, fsl=\Ek, tsl=\Ej\EYA%+ \Eo, + use=ibmega-c, +ibm8503|ibm8507|ibm8604|IBM 8503 B & W VGA display, + use=hft-c, +ibm8514|IBM 8514/a color VGA display, + eslok, hs, + dsl=\Ej\EYI \EI\Ek, fsl=\Ek, tsl=\Ej\EYI%+ \Eo, use=hft, +ibm8514-c|IBM 8514 color display with standout and underline, + eslok, hs, + lines#41, + cr=^M, cud1=^J, dsl=\Ej\EYI \EI\Ek, fsl=\Ek, ht=^I, ind=^J, + kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, tsl=\Ej\EYI%+ \Eo, + use=ibmega-c, + +# +# AIX entries. IBM ships these with AIX 3.2.5. +# -- added rc, sc based on manpage -TD +# Note that we could use ibm+16color, but that is not how IBM defines this one. +aixterm|IBM Aixterm Terminal Emulator, + eslok, hs, + acsc=jjkkllmmnnqqttuuvvwwxx, bold=\E[1m, dsl=\E[?E, + fsl=\E[?F, rc=\E8, ri@, s0ds=\E(B, s1ds=\E(0, sc=\E7, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + %;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, use=ibm6154, +aixterm-m|IBM AIXterm Monochrome Terminal Emulator, + eslok, hs, + acsc=jjkkllmmnnqqttuuvvwwxx, bold=\E[1m, dsl=\E[?E, + fsl=\E[?F, ri@, s0ds=\E(B, s1ds=\E(0, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + %;m, + sgr0=\E[0;10m\E(B, tsl=\E[?%p1%dT, use=ibm6153, +aixterm-m-old|old IBM AIXterm Monochrome Terminal Emulator, + eslok, hs, + bold=\E[1m, dsl=\E[?E, fsl=\E[?F, ri@, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + %;m, + tsl=\E[?%p1%dT, use=ibm6153, +jaixterm|IBM Kanji Aixterm Terminal Eemulator, + acsc@, use=aixterm, +jaixterm-m|IBM Kanji AIXterm Monochrome Terminal Emulator, + acsc@, use=aixterm-m, + +# This flavor is adapted from xterm, in turn from aixterm documentation -TD +aixterm-16color|IBM Aixterm Terminal Emulator with 16 colors, + use=ibm+16color, use=aixterm, + +#### Infoton/General Terminal Corp. +# + +# gt100 sounds like something DEC would come out with. Let's hope they don't. +i100|gt100|gt100a|General Terminal 100A (formerly Infoton 100), + OTbs, am, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\Ef%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, dl1=\EM, + ed=\EJ, el=\EK, flash=\Eb$<200/>\Ea, home=\EH, il1=\EL, + ind=^J, rmso=\Ea, smso=\Eb, +i400|infoton 400, + OTbs, am, + cols#80, lines#25, + bel=^G, clear=\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%3d;%p2%3dH, cuu1=\E[A, + dch1=\E[4h\E[2Q\E[P\E[4l\E[0Q, dl1=\E[M, el=\E[N, + il1=\E[L, ind=^J, rmir=\E[4l\E[0Q, smir=\E[4h\E[2Q, +# (addrinfo: removed obsolete ":bc=^Z:" -- esr) +addrinfo, + am, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^Z, cud1=^J, cuf1=^Y, + cup=\037%p1%c%p2%c, cuu1=^\, ed=^K, home=^H, ind=^J, ll=^H^\, +# (infoton: used to have the no-ops , , -- esr) +infoton, + am, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^Z, cud1=^J, cuf1=^Y, cuu1=^\, + ed=^K, ind=^J, ll=^H^\, + +# The ICL6402 was actually the Kokusai Display System 6402. +# The 6404 was the KDS7372 (color version of the 6402). +# +# ICL6404 control codes follow: +# +#code function +#~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +#ctrl-A set SOM position at cursor position +#ctrl-G Bell +#ctrl-H Backspace +#ctrl-I Horiz tab +#ctrl-J Linefeed +#ctrl-K Cursor up +#ctrl-L Cursor right +#ctrl-M Carriage return +#ctrl-N Disable xon/xoff to host +#ctrl-O Enable xon/xoff to host +#ctrl-R Enable bidirectional mode +#ctrl-T Disable bidirectional mode +#ctrl-V Cursor down +#ctrl-Z Clear unprotected data to insert char +#ctrl-^ Cursor home +#ctrl-_ Newline +# +#ESC lead-in char for multiple character command +# +#ESC space R execute power on sequence +#ESC ! p1 p2 define scroll region: +# p1 = scroll top line: 20h - 37h +# p1 = scroll bottom line: 20h - 37h +#ESC " unlock keyboard +#ESC # lock keyboard +#ESC $ Semi-graphics mode on +#ESC % Semi-graphics mode off +#ESC & protect mode on +#ESC ' protect mode off +#ESC ( write protect mode off (full intensity) +#ESC ) write protect mode on (half intensity) +# +#ESC * clear screen +#ESC + clear unprotected data to insert char +#ESC , clear unprotected data to half intensity spaces +#ESC - p1 p2 p3 p4 address cursor to page, row, column: +# p1 = page number 0 - 3 +# p2 = row 20h - 7fh +# p3 = column (lo) 20h - 7fh +# p4 = column (hi) 20h - 21h (only 132 col) +#ESC . p1 set cursor style: +# p1 = 0 invisible cursor +# p1 = 1 block blinking cursor +# p1 = 2 block steady cursor +# p1 = 3 underline blinking cursor +# p1 = 4 underline steady cursor +#ESC / transmit cursor location (page, row, column) +#ESC 0 p1 p2 p3 p4 program edit key: +# p1 = edit key code: '@'-'S', '`'-'s' +# p2 p3 p4 = program data (3 bytes) +# +#ESC 1 set tab +#ESC 2 clear tab at cursor +#ESC 3 clear all tabs +#ESC 4 send unprotect line to cursor +#ESC 5 send unprotect page to cursor +#ESC 6 send line to cursor +#ESC 7 send page to cursor +#ESC 8 n set scroll mode: +# n = 0 set jump scroll +# n = 1 set smooth scroll +#ESC 9 n control display: +# n = 0 display off +# n = 1 display on +#ESC : clear unprotected data to null +#ESC ; clear unprotected data to insert char +# +#ESC < keyclick on +#ESC = p1 p2 address cursor to row, column +# p1 = row 20h - 7fh +# p2 = column (lo) 20h - 7fh +# p3 = column (hi) 20h - 21h (only 132 col) +#ESC > keyclick off +#ESC ? transmit cursor location (row, column) +# +#ESC @ copy print mode on +#ESC A copy print mode off +#ESC B block mode on +#ESC C block mode off (conversation mode) +#ESC D F set full duplex +#ESC D H set half duplex +#ESC E line insert +#ESC F p1 p2 set page colour (p1 = f/grnd, p2 = b/grnd) +# 0 = black, 1 = red, 2 = green, 3 = yellow +# 4 = blue, 5 = magenta, 6 = cyan, 7 = white +#ESC G n set serial field attribute (n = 30h - 3Fh) +#ESC H n full graphics mode: +# n = 0 exit full graphics mode +# n = 1 enter full graphics mode +#ESC I back tab +#ESC J back page +#ESC K forward page +# +#ESC L unformatted page print +#ESC M L move window left (132 col mode only) +#ESC M R move window right (132 col mode only) +#ESC N set page edit (clear line edit) +#ESC O set line edit (clear page edit) +#ESC P formatted page print +#ESC Q character insert +#ESC R line delete +#ESC S send message unprotected only +#ESC T erase line to insert char +#ESC U set monitor mode (see ESC X, ESC u) +# +#ESC V n select video attribute mode: +# n = 0 serial field attribute mode +# n = 1 parallel character attribute mode +#ESC V 2 n define line attribute: +# n = 0 single width single height +# n = 1 single width double height +# n = 2 double width single height +# n = 3 double width double height +#ESC V 3 n select character font: +# n = 0 system font +# n = 1 user defined font +#ESC V 4 n select screen mode: +# n = 0 page screen mode +# n = 1 virtual screen mode +#ESC V 5 n control mouse mode: +# n = 0 disable mouse +# n = 1 enable sample mode +# n = 2 send mouse information +# n = 3 enable request mode +#ESC W character delete +#ESC X clear monitor mode (see ESC U, ESC u) +#ESC Y erase page to insert char +# +#ESC Z n send user/status line: +# n = 0 send user line +# n = 1 send status line +# n = 2 send terminal ID +#ESC [ p1 p2 p3 set character attribute (parallel char mode): +# p1: 0 = normal +# 1 = blank +# 2 = blink +# 3 = blink blank (= blank) +# 4 = reverse +# 5 = reverse blank +# 6 = reverse blink +# 7 = reverse blink blank (= reverse blank) +# 8 = underline +# 9 = underline blank +# : = underline blink +# ; = underline blink blank +# < = reverse underline +# = = reverse underline blank +# > = reverse underline blink +# ? = reverse underline blink blank +# p2, p3: f/grnd, b/grnd colour +# (see ESC F for colours) +# use ZZ for mono, eg. +# ESC [ 0 Z Z for normal +# ESC [ 4 Z Z for inverse etc. +# +#ESC \ n set page size: +# n = 1 24 lines/page +# n = 2 48 lines/page +# n = 3 72 lines/page +# n = 4 96 lines/page +#ESC ] n set Wordstar mode: +# n = 0 normal (KDS7372) mode +# n = 1 Wordstar mode +# +#ESC b set foreground colour screen +# +#ESC c n enter self-test mode: +# n = 0 exit self test mode +# n = 1 ROM test +# n = 2 RAM test +# n = 3 NVRAM test +# n = 4 screen display test +# n = 5 main/printer port test +# n = 6 mouse port test +# n = 7 graphics board test +# n = 8 graphics memory test +# n = 9 display all 'E' +# n = : display all 'H' +#ESC d set background colour screen +# +#ESC e n program insert char (n = insert char) +#ESC f text CR load user status line with 'text' +# +#ESC g display user status line on 25th line +#ESC h display system status line on 25th line +#ESC i tab +#ESC j reverse linefeed +#ESC k n duplex/local edit mode: +# n = 0 duplex edit mode +# n = 1 local edit mode +#ESC l n select virtual screen: +# n = 0 screen 1 +# n = 1 screen 2 +#ESC m save current config to NVRAM +#ESC n p1 select display screen: +# p1 = 0 screen 1 +# p1 = 1 screen 2 +# p1 = 2 screen 3 +# p1 = 3 screen 4 +#ESC o p1 p2 set characters/line and attribute: +# p1 = 0 80 chars/line +# +#ESC o p1 p2 set characters/line and attribute: +# p1 = 0 80 chars/line +# p1 = 1 132 chars/line +# p2 = 0 single width single height +# p2 = 1 single width double height +# p2 = 2 double width single height +# p2 = 3 double width double height +# +#ESC q insert mode on +#ESC r edit mode on +#ESC s send message all +#ESC t erase line to null +#ESC u clear monitor mode (see ESC U, ESC X) +#ESC v autopage mode on +#ESC w autopage mode off +#ESC x p1 p2 p3 define delimiter code... +#ESC y erase page to null +# +#ESC z 2 p1 p2 p3 p4 draw quadrangle: +# p1 = starting row +# p2 = starting column +# p3 = end row +# p4 = end column +# +#ESC { p1 p2 p3 p4 configure main port +# (baud, stop bits, parity, word length) +# +#ESC | p1 p2 text Ctrl-Y program function key with 'text': +# p1 = function key code: +# '1' - ';' normal f1- f11 +# '<' - 'F' shifted f1 - f11 +# p2 = program mode: +# 1 = FDX +# 2 = LOC +# 3 = HDX +# Ctrl-Y = terminator +# (use Ctrl-P to escape ^P, ^Y ) +# +#ESC } p1 p2 p3 p4 configure printer port +# (baud, stop bits, parity, word length) +#ESC ~ send system status +# +# Codes and info from Peter Disdale 12 May 1997 +# +# Entry is by esr going solely on above information and is UNTESTED. +# This actually looks a lot like a Televideo 9xx. +# This entry uses page 0 and is monochrome; I'm not brave enough to try +# to make color work without a test terminal. The capability is a guess. +# The initialization string sets conversation mode, blinking underline cursor, +# full duplex, parallel attribute mode, display user status line, white +# foreground, black background, normal highlight. +# +icl6404|kds7372|icl6402|kds6402|ICL 6404 aka Kokusai Display Systems 7372, + OTbs, am, hs, + cols#80, lines#24, + bel=^G, blink=\E[2ZZ, cbt=\EI, civis=\E.0, clear=\E*, + cnorm=\E.3, cr=^M, + csr=\E!%+%p1%{32}%+%p2%{32} cud1=\026, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{80}%m%{32}%+%c%p2%{80}%>%{32}%+%c, + cuu1=^K, cvvis=\E.1, dch1=\EW, dl1=\ER, home=^^, ht=^I, + hts=\E1, il1=\EE, invis=\E[1ZZ, + is1=\EC\E.3\EDF\EV1\Eg\E[0ZZ, nel=^_, rev=\E[4ZZ, + rmir=\Er, rmso=\E[%gh%{4}%^%Ph%gh%dZZ, + rmul=\E[%gh%{8}%^%Ph%gh%dZZ, rs2=\Eo1, + sgr=\E[%'0'%?%p1%t%'8'%|%;%?%p2%t%'8'%|%;%?%p3%t%'4'%|%;%? + %p4%t%'2'%|%;%?%p7%t%'1'%|%;%cZZ, + sgr0=\E[0ZZ, smir=\Eq, smso=\E[8ZZ, smul=\E[8ZZ, tbc=\E3, +icl6404-w|kds7372-w|ICL 6404 aka Kokusai Display Systems 7372 132 cols, + rs2=\Eo1, use=icl6404, + +#### Interactive Systems Corp +# +# ISC used to sell OEMed and customized hardware to support ISC UNIX. +# ISC UNIX still exists in 1995, but ISC itself is no more; they got +# bought out by Sun. +# + +# From: Wed Sep 16 08:06:44 1981 +# (intext: removed obsolete ":ma=^K^P^R^L^L ::bc=^_:", also the +# ":le=^_:" later overridden -- esr) +intext|Interactive Systems Corporation modified owl 1200, + OTbs, am, + cols#80, it#8, lines#24, xmc#1, + bel=^G, cbt=^Y, clear=\014$<132>, cr=^M, cub1=^H, cud1=^J, + cuf1=^^, cup=\017%p1%{32}%+%c%p2%{32}%+%c, cuu1=^\, + dch1=\022$<5.5*>, dl1=\021$<5.5*>, ed=\026J$<5.5*>, + el=^Kp^R, ht=^I, il1=\020$<5.5*>, ind=^J, ip=$<5.5*>, kbs=^H, + kcub1=^_, kcud1=^J, kcuf1=^^, kcuu1=^\, kf0=^VJ\r, kf1=^VA\r, + kf2=^VB\r, kf3=^VC\r, kf4=^VD\r, kf5=^VE\r, kf6=^VF\r, + kf7=^VG\r, kf8=^VH\r, kf9=^VI\r, khome=^Z, rmir=^V<, + rmkx=^V9, rmso=^V#\s, smir=^V;, smkx=\036\:\264\026%%, + smso=^V$\,, +intext2|intextii|INTERACTIVE modified owl 1251, + am, bw, ul, + cols#80, lines#24, xmc#0, + bel=^G, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, cub1=\E[D, + cud1=\E[B, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch1=\E[P, dl1=\E[M, ed=\E[J, el=\E[K, + flash=\E[;;;;;;;;;2;;u$<200/>\E[;;;;;;;;;1;;u, + hpa=\E[%p1%{1}%+%dG, ht=^I, ich1=\E[@, il1=\E[L, ind=\E[S, + kbs=^H, kcub1=\ED\r, kcud1=\EB\r, kcuf1=\EC\r, kcuu1=\EA\r, + kf0=\E@\r, kf1=\EP\r, kf2=\EQ\r, kf3=\ES\r, kf4=\ET\r, + kf5=\EU\r, kf6=\EV\r, kf7=\EW\r, kf8=\EX\r, kf9=\EY\r, + khome=\ER\r, lf0=REFRSH, lf1=DEL CH, lf2=TABSET, lf3=GOTO, + lf4=+PAGE, lf5=+SRCH, lf6=-PAGE, lf7=-SRCH, lf8=LEFT, + lf9=RIGHT, ri=\E[T, rmso=\E[2 D, rmul=\E[2 D, smso=\E[6 D, + smul=\E[18 D, + +#### Kimtron (abm, kt) +# +# Kimtron seems to be history, but as March 1998 these people are still +# offering repair services for Kimtron equipment: +# +# Com/Pair Monitor Service +# 1105 N. Cliff Ave. +# Sioux Falls, South Dakota 57103 +# +# WATS voice: 1-800/398-4946 +# POTS fax: +1 605/338-8709 +# POTS voice: +1 605/338-9650 +# Email: +# Internet/Web: +# +# Kimtron entries include (undocumented) codes for: enter dim mode, +# enter bold mode, enter reverse mode, turn off all attributes. +# + +# Kimtron ABM 85 added by Dual Systems +# (abm85: removed duplicated ":kd=^J:" -- esr) +abm85|Kimtron ABM 85, + OTbs, am, bw, msgr, + cols#80, it#8, lines#24, xmc#1, + cbt=\EI, clear=\E*, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\Ey, el=\Et, ht=^I, + if=/usr/share/tabset/stdcrt, il1=\EE, + is2=\EC\EX\Eg\En\E%\Er\E(\Ek\Em\Eq, kbs=^H, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, rmir=\Er, rmso=\Ek, + rmul=\Em, smir=\EQ, smso=\Ej, smul=\El, +# Kimtron ABM 85H added by Dual Systems. +# Some notes about the abm85h entries: +# 1) there are several firmware revs of 85H in the world. Use abm85h-old for +# firmware revs prior to SP51 +# 2) Make sure to use abm85h entry if the terminal is in 85h mode and the +# abm85e entry if it is in tvi920 emulation mode. They are incompatible +# in some places and NOT software settable i.e., can't fix it) +# 3) In 85h mode, the arrow keys and special functions transmit when +# the terminal is in dup-edit, and work only locally in local-edit. +# Vi won't swallow `del char' for instance, but turns on +# dup-edit anyway so that the arrow keys will work right. If the +# arrow keys don't work the way you like, change , , and +# . Note that 920E mode does not have software commands to toggle +# between dup and local edit, so you get whatever was set last on the +# terminal. +# 4) attribute is nice, but seems too slow to work correctly +# (\Eb\Ed) +# 5) Make sure `hidden' attributes are selected. If `embedded' attributes +# are selected, the entry should be removed. +# 6) auto new-line should be on (selectable from setup mode only) +# +# From: Erik Fair Sun Oct 27 07:21:05 1985 +abm85h|Kimtron ABM 85H native mode, + hs, + xmc@, + bel=^G, cnorm=\E.4, cvvis=\E.2, dim=\E), dsl=\Ee, flash@, + fsl=^M, invis@, + is2=\EC\EN\EX\024\016\EA\Ea\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r + \EG0\Ed\E.4\El, + kcud1=^V, sgr0=\E(\EG0, smir=\EZ, tsl=\Eg\Ef, use=adm+sgr, + use=abm85, +abm85e|Kimtron ABM 85H in 920E mode, + xmc@, + bel=^G, dim=\E), flash@, + is2=\EC\EX\EA\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\Ek\Eq + \Em, + rev=\Ej, sgr0=\E(\Ek, smir=\EZ, use=abm85, +abm85h-old|oabm85h|o85h|Kimtron ABM 85H with old firmware rev., + xmc@, + bel=^G, dim=\E), + is2=\E}\EC\EX\Ee\En\E%\Er\E(\Ek\Em\Eq\Ed\ET\EC\E9 + \EF, + rev=\Ej, sgr0=\E(\Ek, smir=\EZ, use=abm85, +# From: +# (kt7: removed obsolete :ma=^V^J^L :" -- esr) +kt7|kimtron model kt-7, + OTbs, am, + cols#80, it#8, lines#24, + cbt=\EI, clear=^Z, cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, fsl=\Eg, home=^^, ht=^I, ich1=\EQ, + if=/usr/share/tabset/stdcrt, il1=\EE, invis@, is2=\El\E", + kbs=^H, kcbt=\EI, kclr=^Z, kcub1=^H, kcud1=^V, kcuf1=^L, + kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, + kf1=^A@\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, tsl=\Ef, use=adm+sgr, +# Renamed TB=^I to :ta:, BE=^G to :bl:, BS=^H to :kb:, N to :kS: (based on the +# other kt7 entry and the adjacent key capabilities). Removed EE which is +# identical to :mh:. Removed :ES=\EGD: which is some kind of highlight +# but we can't figure out what. +kt7ix|kimtron model kt-7 or 70 in IX mode, + am, bw, + cols#80, it#8, lines#25, + acsc=jYk?lZm@nEqDt4uCvAwBx3, bel=^G, blink=\EG2, cbt=\EI, + civis=\E.0, clear=\E*, cnorm=\E.3, cr=^M, cub1=^H, cud1=^V, + cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, el=\ET, fsl=^M, + home=^^, ht=^I, ich1=\EQ, il1=\EE, ind=^J, + is2=\EG0\E s\017\E~, kbs=^H, kcbt=\EI, kclr=\E*, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdl1=\ER, + ked=\EY, kel=\ET, kend=\EY, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\EQ, kil1=\EE, knp=\EJ, + nel=^M^J, pulse=\EK, rmacs=\E%%, rmir=, rmso=\EG0, rmul=\EG0, + sgr0=\EG0, smacs=\E$, smir=, smso=\EG4, smul=\EG8, tsl=\Ef, + +#### Microdata/MDIS +# +# This was a line of terminals made by McDonnell-Douglas Information Systems. +# These entries come direct from MDIS documentation. I have edited them only +# to move primary names of the form p[0-9] * to aliases, and to comment out +# / in a couple of entries without strings. I have +# also removed the change history; the last version indicates this is +# version 4.3 by A.Barkus, September 1990 (earliest entry is October 1989). +# + +# McDonnell Information Systems Terminal Family History +# ========================================= +# +# Prism-1, Prism-2 and P99: +# Ancient Microdata and CMC terminals, vaguely like Adds Regent 25. +# +# Prism-4 and Prism-5: +# Slightly less ancient range of Microdata terminals. Follow-on from +# Prism-2, but with many enhancements. P5 has eight display pages. +# +# Prism-6: +# A special terminal for use with library systems, primarily in Germany. +# Limited numbers. Similar functionality to P5 (except attributes?). +# +# Prism-7, Prism-8 and Prism-9: +# More recent range of MDIS terminals, in which P7 and P8 +# replace the P4 & P5, with added functionality, and P9 is the flagship. +# The P9 has two emulation modes - P8 and ANSI - and includes a +# large number of the DEC VT220 control sequences. Both +# P8 and P9 support 80c/24ln/8pg and 132cl/24li/4pg formats. +# +# Prism-12 and Prism-14: +# Latest range, functionally very similar to the P9. The P14 has a +# black-on-white overscanning screen. +# +# The terminfo definitions given here are: +# +# p2 - Prism-2 (or Prism-1 or P99). +# +# p4 - Prism-4 (and older P7s & P8s). +# p5 - Prism-5 (or Prism-6). +# +# p7 - Prism-7. +# p8 - Prism-8 (in national or multinational mode). +# p8-w - 132 column version of p8. +# p9 - Prism-9 in ANSI mode. +# p9-w - 132 column version of p9. +# p9-8 - Prism-9 in Prism-8 emulation mode. +# p9-8-w - As p9-8, but with 132 columns. +# +# p12 - Prism-12 in ANSI mode. +# p12-w - 132 column version of p12. +# p12-m - Prism-12 in MDC emulation mode. +# p12-m-w - As p12-m, but with 132 columns. +# p14 - Prism-14 in ANSI mode. +# p14-w - 132 column version of p14. +# p14-m - Prism-14 in MDC emulation mode. +# p14-m-w - As p14-m, but with 132 columns. +# +# p2: Prism-2 +# ----------- +# +# Includes Prism-1 and basic P99 without SP or MP loaded. +# The simplest form of Prism-type terminal. +# Basic cursor movement and clearing operations only. +# No video attributes. +# Notes: +# Horizontal cursor qualifiers of NUL, XON and XOFF are mapped to the next +# value up, followed by backspace. +# +prism2|MDC Prism-2, + am, bw, msgr, + cols#80, lines#24, + bel=^G, clear=\014$<20>, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\013%p1%{32}%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%? + %{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, + cuu1=^Z, ed=\EJ, el=\EK, home=^A, + hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc + %=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, + ind=^J, kbs=^H, khome=^A, vpa=\013%p1%{32}%+%c, + +# p4: Prism-4 +# ----------- +# +# Includes early versions of P7 & P8. +# Basic family definition for most Prisms (except P2 and P9 ANSI). +# Notes: +# Horizontal cursor qualifiers of NUL, XON and XOFF are mapped to the next +# value up, followed by backspace. +# Cursor key definitions removed because they interfere with vi and csh keys. +# +prism4|p4|P4|MDC Prism-4, + am, bw, hs, mc5i, msgr, + cols#80, lines#24, wsl#72, xmc#1, + bel=^G, blink=^CB, civis=^]\344, clear=\014$<20>, + cnorm=^]\342, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\013%p1%{32}%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%? + %{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, + cuu1=^Z, dim=^CA, dsl=\035\343\035\345, ed=\EJ, el=\EK, + fsl=^]\345, home=^A, + hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc + %=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c, + ind=^J, invis=^CH, kbs=^H, khome=^A, mc0=\EU, mc4=\ET, mc5=\ER, + rev=^CD, rmso=^C\s, rmul=^C\s, + sgr=\003%{64}%?%p1%p3%|%t%{4}%+%;%?%p2%t%{16}%+%;%?%p4%t%{2} + %+%;%?%p5%t%{1}%+%;%?%p7%t%{8}%+%;%c%?%p9%t\016%e\017%;, + sgr0=^C\s, smso=^CD, smul=^CP, tsl=^]\343, + vpa=\013%p1%{32}%+%c, + +# p5: Prism-5 +# ----------- +# +# Same definition as p4. Includes Prism-6 (not tested!). +# Does not use any multi-page features. +# +prism5|p5|P5|MDC Prism-5, + use=p4, + +# p7: Prism-7 +# ----------- +# +# Similar definition to p4. Uses ANSI cursor motion to avoid network problems. +# Notes: +# Use p4 for very early models of P7. +# Rev-index removed; can't send nulls to terminal in 8-bit modes. +# +prism7|p7|P7|MDC Prism-7, + cup=\E[%i%p1%d;%p2%dH, hpa@, vpa@, use=p4, + +# p8: Prism-8 +# ----------- +# +# Similar definition to p7. Uses ANSI cursor motion to avoid network problems. +# Supports national and multinational character sets. +# Notes: +# Alternate char set operations only work in multinational mode. +# Use p4 for very early models of P8. +# Rev-index removed; can't send nulls to terminal in 8-bit modes. +# (esr: commented out / because there's no ) +# +prism8|p8|P8|MDC Prism-8, + cup=\E[%i%p1%d;%p2%dH, hpa=\E[%i%p1%d`, is2=\E[<12h, + vpa=\E[%i%p1%dd, use=p4, + +# p8-w: Prism-8 in 132 column mode +# -------------------------------- +# +# 'Wide' version of p8. +# Notes: +# Rev-index removed; can't send nulls to terminal in 8-bit modes. +# +prism8-w|p8-w|P8-W|MDC Prism-8 in 132 column mode, + cols#132, + is2=\E[<12h\E[<14h, use=p8, + +# p9: Prism-9 in ANSI mode +# ------------------------- +# +# The "flagship" model of this generation of terminals. +# ANSI X3.64 (ISO 6429) standard sequences, plus many DEC VT220 ones. +# Notes: +# Tabs only reset by "reset". Otherwise assumes default (8 cols). +# Fixes to deal with terminal firmware bugs: +# . 'ri' uses insert-line since rev index doesn't always +# . 'sgr0' has extra '0' since esc[m fails +# . 'fsl' & 'dsl' use illegal char since cr is actioned wrong on line 25 +# Not covered in the current definition: +# . Labels +# . Programming Fn keys +# . Graphic characters (defaults correctly to vt100) +# . Padding values (sets xon) +# (esr: commented out / because there's no ) +# +prism9|p9|P9|MDC Prism-9 in ANSII mode, + am, bw, hs, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, wsl#72, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[<4l, + clear=^L, cnorm=\E[<4h, cr=^M, csr=\E[%i%p1%d;%p2%d%%v, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, dsl=\E[%}\024, ech=\E[%p1%dX, + ed=\E[J$<10>, el=\E[K, fsl=^T, home=\E[H, hpa=\E[%i%p1%d`, + ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, + is2=\E[&p\E[<12l\E F, kbs=^H, kclr=^L, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\E[11~, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[H, nel=^M^J, prot=\E[32%{, rc=\E[%z, + rep=\E[%p2%db%p1%c, rev=\E[7m, ri=\E[L, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, + rs2=\E[&p\E[<12l\E\sF\E[3g\E[9;17;25;33;41;49;57;65;73 + \sN, + sc=\E[%y, + sgr=\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p6%t;1%;m%? + %p8%t\E[32%%{%;%?%p9%t\016%e\017%;, + sgr0=\E[0m\017, smir=\E[4h, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E[%i%p1%d%%}, vpa=\E[%i%p1%dd, + use=ansi+pp, + +# p9-w: Prism-9 in 132 column mode +# -------------------------------- +# +# 'Wide' version of p9. +# +prism9-w|p9-w|P9-W|MDC Prism-9 in 132 column mode, + cols#132, + is2=\E[&p\E[<12l\E F\E[<14h, + rs2=\E[&p\E[<12l\E F\E[<14h, use=p9, + +# p9-8: Prism-9 in P8 mode +# ------------------------ +# +# P9 terminal in P8 emulation mode. +# Similar to p8 definition. +# Insertion and deletion operations possible. +# +prism9-8|p9-8|P9-8|MDC Prism-9 in P8 mode, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, use=p8, + +# p9-8-w: Prism-9 in P8 and 132 column modes +# ------------------------------------------ +# +# P9 terminal in P8 emulation mode and 132 column mode. +# +prism9-8-w|p9-8-w|P9-8-W|MDC Prism-9 in Prism 8 emulation and 132 column mode, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, use=p8-w, + +# p12: Prism-12 in ANSI mode +# --------------------------- +# +# See p9 definition. +# +prism12|p12|P12|MDC Prism-12 in ANSI mode, + use=p9, + +# p12-w: Prism-12 in 132 column mode +# ---------------------------------- +# +# 'Wide' version of p12. +# +prism12-w|p12-w|P12-W|MDC Prism-12 in 132 column mode, + use=p9-w, + +# p12-m: Prism-12 in MDC emulation mode +# ------------------------------------- +# +# P12 terminal in MDC emulation mode. +# Similar to p8 definition. +# Insertion and deletion operations possible. +# +prism12-m|p12-m|P12-M|MDC Prism-12 in MDC emulation mode, + use=p9-8, + +# p12-m-w: Prism-12 in MDC emulation and 132 column modes +# ------------------------------------------------------- +# +# P12 terminal in MDC emulation mode and 132 column mode. +# +prism12-m-w|p12-m-w|P12-M-W|MDC Prism-12 in MDC emulation and 132 column mode, + use=p9-8-w, + +# p14: Prism-14 in ANSII mode +# --------------------------- +# +# See p9 definition. +# +prism14|p14|P14|MDC Prism-14 in ANSII mode, + use=p9, + +# p14-w: Prism-14 in 132 column mode +# ---------------------------------- +# +# 'Wide' version of p14. +# +prism14-w|p14-w|P14-W|MDC Prism-14 in 132 column mode, + use=p9-w, + +# p14-m: Prism-14 in MDC emulation mode +# ------------------------------------- +# +# P14 terminal in MDC emulation mode. +# Similar to p8 definition. +# Insertion and deletion operations possible. +# +prism14-m|p14-m|P14-M|MDC Prism-14 in MDC emulation mode, + use=p9-8, + +# p14-m-w: Prism-14 in MDC emulation and 132 column modes +# ------------------------------------------------------- +# +# P14 terminal in MDC emulation mode and 132 column mode. +# +prism14-m-w|p14-m-w|P14-M-W|MDC Prism-14 in MDC emulation and 132 column mode, + use=p9-8-w, + +# End of McDonnell Information Systems Prism definitions + +# These things were popular in the Pick database community at one time +# From: George Land 24 Sep 1996 +p8gl|prism8gl|McDonnell-Douglas Prism-8 alternate definition, + am, bw, hs, mir, + cols#80, lines#24, ma#1, wsl#78, xmc#1, + bel=^G, blink=^CB, clear=^L, cr=^M, cub1=^U, cud1=^J, cuf1=^F, + cup=\E[%i%p1%d;%p2%dH, cuu1=^Z, dch1=\s^H, dim=^CA, dl1=^P, + ed=\EJ, el=\EK, home=^A, ind=^J, invis=^CH, kbs=^H, kcub1=^U, + kcud1=^J, kcuf1=^F, kcuu1=^Z, kdch1=\s^H, kdl1=^P, ked=\EJ, + kel=\EK, kf1=^A@\r, kf10=^AI\r, kf12=^AJ\r, kf13=^AK\r, + kf14=^AL\r, kf15=^AM\r, kf16=^AN\r, kf17=^AO\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^A, lf1=F1, lf10=F10, lf2=F2, + lf3=F3, lf4=F4, lf5=F5, lf6=F6, lf7=F7, lf8=F8, lf9=F9, nel=^J^M, + pad=\0, rev=^CD, rmso=^C\s, rmul=^C\s, sgr0=^C\s, smso=^CE, + smul=^C0, + +#### Microterm (act, mime) +# +# The mime1 entries refer to the Microterm Mime I or Mime II. +# The default mime is assumed to be in enhanced act iv mode. +# + +# New "safe" cursor movement (5/87) from . Prevents +# freakout with out-of-range args on Sytek multiplexors. No and +# since it gets confused and it's too dim anyway. No +# since Sytek insists ^S means xoff. +# (act4: found ":ic=2^S:ei=:im=:ip=.1*^V:" commented out in 8.3 -- esr) +act4|microterm|microterm act iv, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\014$<12/>, cr=^M, cub1=^H, cud1=^K, cuf1=^X, + cup=\024%p1%{24}%+%c%p2%p2%?%{47}%>%t%{48}%+%;%{80}%+%c, + cuu1=^Z, dch1=\004$<.1*/>, dl1=\027$<2.3*/>, + ed=\037$<2.2*/>, el=\036$<.1*/>, home=^], + il1=\001<2.3*/>, ind=^J, kcub1=^H, kcud1=^K, kcuf1=^X, + kcuu1=^Z, +# The padding on :sr: and :ta: for act5 and mime is a guess and not final. +# The act 5 has hardware tabs, but they are in columns 8, 16, 24, 32, 41 (!)... +# (microterm5: removed obsolete ":ma==^Z^P^Xl^Kj:" -- esr) +act5|microterm5|microterm act v, + kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, ri=\EH$<3>, uc=^H\EA, + use=act4, +# Mimes using brightness for standout. Half bright is really dim unless +# you turn up the brightness so far that lines show up on the screen. +mime-fb|full bright mime1, + is2=^S\E, rmso=^S, smso=^Y, use=mime, +mime-hb|half bright mime1, + is2=^Y\E, rmso=^Y, smso=^S, use=mime, +# (mime: removed obsolete ":ma=^X ^K^J^Z^P:"; removed ":do=^K:" that overrode +# the more plausible ":do=^J:" -- esr) +# uc was at one time disabled to get around a curses bug, be wary of it +mime|mime1|mime2|mimei|mimeii|microterm mime1, + OTbs, am, + cols#80, it#8, lines#24, vt#9, + bel=^G, clear=^]^C, cr=^M, cub1=^H, cud1=^J, cuf1=^X, + cup=\024%p1%{24}%+%c%p2%p2%?%{32}%>%t%{48}%+%;%{80}%+%c, + cuu1=^Z, dl1=\027$<80>, ed=^_, el=^^, home=^], ht=\011$<2>, + il1=\001$<80>, ind=^J, is2=^S\E^Q, kcub1=^H, kcud1=^K, + kcuf1=^X, kcuu1=^Z, ri=\022$<3>, uc=^U, +# These termcaps (for mime2a) put the terminal in low intensity mode +# since high intensity mode is so obnoxious. +mime2a-s|microterm mime2a (emulating an enhanced soroc iq120), + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EI, dch1=\ED, + dl1=\027$<20*>, ed=\EJ$<20*>, el=\EK, home=^^, + il1=\001$<20*>, ind=^J, ip=$<2>, is2=\E), kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, ri=\EI, rmir=^Z, rmso=\E;, rmul=\E7, + smir=\EE, smso=\E\:, smul=\E6, +# This is the preferred mode (but ^X can't be used as a kill character) +mime2a|mime2a-v|microterm mime2a (emulating an enhanced vt52), + OTbs, + cols#80, it#8, lines#24, + bel=^G, clear=\EL, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=^N, + dl1=\027$<20*>, ed=\EQ$<20*>, el=\EP, home=\EH, ht=^I, + il1=\001$<20*>, ind=^J, ip=$<2>, is2=^Y, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, ri=\EA, rmir=^Z, rmso=\E9, + rmul=\E5, smir=^O, smso=\E8, smul=\E4, +# (mime3a: removed obsolete ":ma=^X ^K^J^Z^P:" -- esr) +mime3a|mime1 emulating 3a, + am@, + kcub1=^H, kcud1=^K, kcuf1=^X, kcuu1=^Z, use=adm3a, +mime3ax|mime-3ax|mime1 emulating enhanced 3a, + it#8, + dl1=\027$<80>, ed=^_, el=^X, ht=\011$<3>, il1=\001$<80>, + use=mime3a, +# Wed Mar 9 18:53:21 1983 +# We run our terminals at 2400 baud, so there might be some timing problems at +# higher speeds. The major improvements in this model are the terminal now +# scrolls down and insert mode works without redrawing the rest of the line +# to the right of the cursor. This is done with a bit of a kludge using the +# exit graphics mode to get out of insert, but it does not appear to hurt +# anything when using vi at least. If you have some users using act4s with +# programs that use curses and graphics mode this could be a problem. +mime314|mm314|mime 314, + am, + cols#80, lines#24, + clear=^L, cub1=^H, cuf1=^X, cup=\024%p1%c%p2%c, cuu1=^Z, + dch1=^D, dl1=^W, ed=^_, el=^^, home=^], ht=^I, il1=^A, kcub1=^H, + kcud1=^K, kcuf1=^X, kcuu1=^Z, rmir=^V, smir=^S, +# Microterm mime 340 from University of Wisconsin +mm340|mime340|mime 340, + cols#80, lines#24, + clear=\032$<12/>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\E#$<2.1*/>, dl1=\EV$<49.6/>, ed=\037$<2*/>, + el=\EL$<2.1/>, ht=^I, il1=\EU$<46/>, ind=^J, is2=\E\,, + kbs=^H, kcub1=^H, kcud1=^J, kcuu1=^K, nel=^M^J, +# This came from University of Wisconsin marked "astro termcap for jooss". +# (mt4520-rv: removed obsolete ":kn#4:" and incorrect ":ri=\E[C:"; +# also added / based on the init string -- esr) +mt4520-rv|micro-term 4520 reverse video, + am, hs, msgr, xenl, xon, + cols#80, it#8, lines#24, wsl#80, + bel=^G, clear=\E[H\E[J, cnorm=\E[0V\E8, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E7\E[0U, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, flash=\E[?5l$<200/>\E[?5h, + fsl=\E[?5l\E[?5h, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + is2=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[1;24r\E[24;1H\E[H + \E[J, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, + ll=\E[24;1H, nel=\EE, rc=\E8, rf=/usr/share/tabset/vt100, + ri=\EM, rmam=\E[?7l, rmso=\E[0m, rmul=\E[24m, + rs1=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[H\E[J, + sc=\E7, sgr0=\E[m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, + tbc=\E[g, tsl=\E[25;1H, + +# Fri Aug 5 08:11:57 1983 +# This entry works for the ergo 4000 with the following setups: +# ansi,wraparound,newline disabled, xon/xoff disabled in both +# setup a & c. +# +# WARNING!!! There are multiple versions of ERGO 4000 microcode +# Be advised that very early versions DO NOT WORK RIGHT !! +# Microterm does have a ROM exchange program- use it or lose big +# (ergo400: added / based on the init string -- esr) +ergo4000|microterm ergo 4000, + da, db, msgr, + cols#80, lines#66, + bel=^G, clear=\E[H\E[2J$<80>, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + dch1=\E[1P$<80>, dl1=\E[1M$<5*>, ed=\E[0J$<15>, + el=\E[0K$<13>, ht=^I, il1=\E[1L$<5*>, ind=\ED$<20*>, + is2=\E<\E=\E[?1l\E[?4l\E[?5l\E[?7h\E[?8h$<300>, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, lf1=pf1, lf2=pf2, lf3=pf3, + lf4=pf4, ri=\EM$<20*>, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E=$<4>, rmso=\E[m$<20>, sgr0=\E[m$<20>, + smam=\E[?7m, smir=\E[4h$<6>, smkx=\E=$<4>, + smso=\E[7m$<20>, + +#### NCR +# +# NCR's terminal group was merged with AT&T's when AT&T bought the company. +# For what happened to that group, see the ADDS section. +# +# There is an NCR4103 terminal that's just a re-badged Wyse-50. +# + +# The following vendor-supplied termcaps were captured from the Boundless +# Technologies site, 8 March 1998. I removed all-upper-case names that were +# identical, except for case, to lower-case ones. I also uncommented the acsc +# capabilities.X +# +# The Intecolor emulation of the NCR 2900/260C color terminal is basically a +# DEC vt200/300 with color capabilities added. +ncr260intan|NCR Intecolor emulation of the 2900_260C with an ANSI keyboard, + colors#8, pairs#64, + op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=ncr260vt300an, +# The Intecolor emulation of the NCR 2900/260C color terminal is basically a +# DEC vt200/300 with color capabilities added. +ncr260intwan|NCR Intecolor emulation of the 2900_260C with an ANSI keyboard, + colors#8, pairs#64, + op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=ncr260vt300wan, +# The Intecolor emulation of the NCR 2900/260C color terminal is basically a +# DEC vt200/300 with color capabilities added. +ncr260intpp|NCR Intecolor emulation of the 2900_260C with a PC+ keyboard, + colors#8, pairs#64, + op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=ncr260vt300pp, +# The Intecolor emulation of the NCR 2900/260C color terminal is basicly a +# DEC vt200/300 with color capabilities added. +ncr260intwpp|NCR Intecolor emulation of the 2900_260C with a PC+ keyboard in 132 column mode, + colors#8, pairs#64, + op=\E[0m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + use=ncr260vt300wpp, +# This definition for ViewPoint supports several attributes. This means +# that it has magic cookies (extra spaces where the attributes begin). +# Some applications do not function well with magic cookies. The System +# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. +# If supporting various attributes is not vital, 'xmc#1' and the extra +# attributes can be removed. +# Mapping to ASCII character set ('acsc' capability) can also be +# restored if needed. +ncr260vppp|NCR 2900_260 viewpoint, + am, bw, hs, km, mc5i, mir, msgr, xon, + cols#80, lines#24, nlab#32, xmc#1, + acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, + cbt=\EI, civis=\E`0, clear=\014$<40>, cnorm=\E`5, + cr=\r$<2>, cub1=\010$<2>, cud1=\n$<2>, cuf1=\006$<2>, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<5>, cuu1=\032$<2>, + dch1=\EW$<2>, dim=\EGp, dl1=\El$<2>, dsl=\E`c, ed=\Ek$<2>, + el=\EK$<2>, fsl=^M, home=\036$<2>, ht=^I, hts=\E1, + il1=\EM$<2>, ind=\n$<2>, invis=\EG1, + is2=\Ee6\E~%$<100>\E+\E`\:\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0 + \EcC1\Ee7$<100>, + kDC=\El, kEND=\Ek, kHOM=^A, kPRT=\E7, kRIT=^F, ka1=^A, ka3=\EJ, + kbs=^H, kc1=\ET, kc3=\EJ, kcub1=^U, kcud1=^J, kcuf1=^F, + kcuu1=^Z, kdch1=\EW, kend=\EK, kf1=^B1\r, kf10=^B\:\r, + kf11=^B;\r, kf12=^B<\r, kf13=^B=\r, kf14=^B>\r, kf15=^B?\r, + kf16=^B@\r, kf17=^B!\r, kf18=^B"\r, kf19=^B#\r, kf2=^B2\r, + kf20=^B$\r, kf21=\002%^M, kf22=^B&\r, kf23=^B'\r, + kf24=^B(\r, kf25=^B)\r, kf26=^B*\r, kf27=^B+\r, + kf28=^B\,\r, kf29=^B-\r, kf3=^B3\r, kf30=^B.\r, kf31=^B/\r, + kf32=^B0\r, kf4=^B4\r, kf5=^B5\r, kf6=^B6\r, kf7=^B7\r, + kf8=^B8\r, kf9=^B9\r, khome=^A, kich1=\Eq, knp=\EJ, kpp=\EJ, + kprt=\EP, ll=\001$<5>, mc0=\EP$<100>, mc4=^T, mc5=^R, + mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<5>, + nel=\037$<2>, rev=\EG4, ri=\Ej$<2>, rmacs=\EcB0\EH\003, + rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, + rs2=\Ee6\E~%$<100>\E+\E`\:\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0 + \EcC1\Ee7$<100>, + sgr0=\EG0\EH\003, smacs=\EcB1\EH\002, smir=\Eq, + smso=\EG4, smul=\EG8, smxon=\Ec21, tsl=\EF, +ncr260vpwpp|NCR 2900_260 viewpoint wide mode, + cols#132, + cup=\Ea%i%p1%dR%p2%dC$<30>, + is2=\Ee6\E~%$<100>\E+\E`;\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0 + \EcC1\Ee7$<100>, + rs2=\Ee6\E~%$<100>\E+\E`;\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0 + \EcC1\Ee7$<100>, + use=ncr260vppp, +ncr260vt100an|NCR 2900_260 vt100 with ansi kybd, + am, hs, mir, msgr, xenl, xon, + cols#80, lines#24, nlab#32, + acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, + blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[2J\E[1;1H$<20>, cnorm=\E[?25h, cr=\r$<1>, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD$<5>, + cub1=\E[D$<5>, cud=\E[%p1%dB$<5>, cud1=\E[B$<5>, + cuf=\E[%p1%dC$<5>, cuf1=\E[C$<5>, + cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA$<5>, + cuu1=\E[A$<5>, dch=\E[%p1%dP$<5>, dch1=\E[1P$<5>, + dl=\E[%p1%dM$<5>, dl1=\E[M$<5>, dsl=\E[0$~\E[1$~, + ech=\E[%p1%dX, ed=\E[0J$<5>, el=\E[0K$<3>, el1=\E[1K$<3>, + fsl=\E[0$}, home=\E[H$<1>, hpa=\E[%p1%dG$<40>, ht=^I, + hts=\EH, ich=\E[%p1%d@$<5>, il=\E[%p1%dL$<5>, + il1=\E[L$<5>, ind=\ED$<5>, indn=\E[%p1%dE$<5>, + invis=\E[8m, + is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, + knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, nel=\EE$<5>, + rc=\E8, rev=\E[7m, ri=\EM$<5>, rmacs=^O, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[0m, rmul=\E[0m, + rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>, + sgr0=\E[0m\017$<20>, smacs=^N, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[1;7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>, use=vt220+keypad, +ncr260vt100wan|NCR 2900_260 vt100 wide mode ansi kybd, + cols#132, + cup=\E[%i%p1%d;%p2%dH$<30>, + is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + use=ncr260vt100an, +ncr260vt100pp|NCR 2900_260 vt100 with PC+ kybd, + is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + ka1=\E[H, ka3=\EOu, kb2=\E[V, kc3=\E[U, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[4~, + kend=\E[5~, khome=\E[2~, kich1=\E[1~, knp=\E[6~, kpp=\E[3~, + lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rmkx=\E>, + rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + smkx=\E=, use=ncr260vt100an, +ncr260vt100wpp|NCR 2900_260 vt100 wide mode pc+ kybd, + cols#132, + cup=\E[%i%p1%d;%p2%dH$<30>, + is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + use=ncr260vt100pp, +ncr260vt200an|NCR 2900_260 vt200 with ansi kybd, + am, hs, mir, msgr, xenl, xon, + cols#80, lines#24, nlab#32, + acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, + blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[2J\E[1;1H$<20>, cnorm=\E[?25h, cr=\r$<1>, + csr=\E[%i%p1%d;%p2%dr$<5>, cub=\E[%p1%dD$<5>, + cub1=\E[D$<5>, cud=\E[%p1%dB$<5>, cud1=\E[B$<5>, + cuf=\E[%p1%dC$<5>, cuf1=\E[C$<5>, + cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA$<5>, + cuu1=\E[A$<5>, dch=\E[%p1%dP$<5>, dch1=\E[1P$<5>, + dl=\E[%p1%dM$<5>, dl1=\E[M$<5>, dsl=\E[0$~\E[1$~, + ech=\E[%p1%dX$<5>, ed=\E[0J, el=\E[0K$<5>, el1=\E[1K$<5>, + fsl=\E[0$}, home=\E[H, hpa=\E[%p1%dG$<40>, ht=^I, hts=\EH, + ich=\E[%p1%d@$<5>, il=\E[%p1%dL$<5>, il1=\E[L$<5>, + ind=\ED$<5>, indn=\E[%p1%dE$<5>, invis=\E[8m, + is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kf0=\EOy, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\EOQ, kf20=\E[34~, kf21=\E[31~, kf22=\E[32~, + kf23=\E[33~, kf24=\E[34~, kf25=\E[35~, kf26=\E[1~, + kf27=\E[2~, kf28=\E[3~, kf29=\E[4~, kf3=\EOR, kf30=\E[5~, + kf31=\E[6~, kf32=\E[7~, kf33=\E[8~, kf34=\E[9~, + kf35=\E[10~, kf4=\EOS, kf5=\E[M, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, + kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, + mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, + ri=\EM$<5>, rmacs=\017$<20>, rmam=\E[?7l, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, + rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>, + sgr0=\E[0m\017$<20>, smacs=\016$<20>, smam=\E[?7h, + smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>, + use=vt220+keypad, +ncr260vt200wan|NCR 2900_260 vt200 wide mode ansi kybd, + cols#132, + cup=\E[%i%p1%d;%p2%dH$<30>, + is2=\E[!p\E[?3;7;19;67h\E[?4l\E(B\E)0\017\E[2J\E[1;1H$<200>, + rs2=\E[!p\E[?3;7;19;67h\E[?4l\E(B\E)0\017\E[2J\E[1;1H$<200>, use=ncr260vt200an, +ncr260vt200pp|NCR 2900_260 vt200 with pc+ kybd, + ka1=\E[H, ka3=\EOu, kb2=\E[V, kc3=\E[U, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[4~, + kend=\E[1~, khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rmkx=\E>, smkx=\E=, + use=ncr260vt200an, +ncr260vt200wpp|NCR 2900_260 vt200 wide mode pc+ kybd, + cols#132, + cup=\E[%i%p1%d;%p2%dH$<30>, + is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>$< + 200>, + use=ncr260vt200pp, +ncr260vt300an|NCR 2900_260 vt300 with ansi kybd, + am, hs, mir, msgr, xenl, xon, + cols#80, lines#24, nlab#32, + acsc=``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, + blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[2J\E[1;1H$<20>, cnorm=\E[?25h, cr=\r$<1>, + csr=\E[%i%p1%d;%p2%dr$<5>, cub=\E[%p1%dD$<5>, + cub1=\E[D$<5>, cud=\E[%p1%dB$<5>, cud1=\E[B$<5>, + cuf=\E[%p1%dC$<5>, cuf1=\E[C$<5>, + cup=\E[%i%p1%d;%p2%dH$<10>, cuu=\E[%p1%dA$<5>, + cuu1=\E[A$<5>, dch=\E[%p1%dP$<5>, dch1=\E[1P$<5>, + dl=\E[%p1%dM$<5>, dl1=\E[M$<5>, dsl=\E[0$~\E[1$~, + ech=\E[%p1%dX$<5>, ed=\E[0J, el=\E[0K$<5>, el1=\E[1K$<5>, + fsl=\E[0$}, home=\E[H, hpa=\E[%p1%dG$<40>, ht=^I, hts=\EH, + ich=\E[%p1%d@$<5>, il=\E[%p1%dL$<5>, il1=\E[L$<5>, + ind=\ED$<5>, indn=\E[%p1%dE$<5>, invis=\E[8m, + is2=\E[!p\E[?7;19;67h\E[?1;3;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1 + ;1H\E>$<200>, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kf0=\EOy, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf20=\E[34~, kf21=\E[31~, kf22=\E[32~, kf23=\E[33~, + kf24=\E[34~, kf25=\E[35~, kf26=\E[1~, kf27=\E[2~, + kf28=\E[3~, kf29=\E[4~, kf30=\E[5~, kf31=\E[6~, kf32=\E[7~, + kf33=\E[8~, kf34=\E[9~, kf35=\E[10~, kf5=\E[M, kf6=\E[17~, + kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + krdo=\E[29~, kslt=\E[4~, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, + nel=\EE, rc=\E8, rev=\E[7m, ri=\EM$<5>, rmacs=\017$<20>, + rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, + rmul=\E[24m, + rs2=\E[!p\E[?7;19;67h\E[?1;3;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1 + ;1H\E>$<200>, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;%?%p7%t;8%;m%?%p9%t\016%e\017%;$<20>, + sgr0=\E[0m\017$<20>, smacs=\016$<20>, smam=\E[?7h, + smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E[2$~\E[1$}, vpa=\E[%p1%dd$<40>, + use=vt220+keypad, +ncr260vt300wan|NCR 2900_260 vt300 wide mode ansi kybd, + cols#132, + cup=\E[%i%p1%d;%p2%dH$<30>, + is2=\E[!p\E[?3;7;19;67h\E[?4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1 + H$<200>, + rs2=\E[!p\E[?3;7;19;67h\E[?4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1 + H$<200>, + use=ncr260vt300an, +ncr260vt300pp|NCR 2900_260 vt300 with pc+ kybd, + ka1=\E[H, ka3=\EOu, kb2=\E[V, kc3=\E[U, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[4~, + kend=\E[1~, khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, rmkx=\E>, smkx=\E=, + use=ncr260vt300an, +NCR260VT300WPP|ncr260vt300wpp|NCR 2900_260 vt300 wide mode pc+ kybd, + cols#132, + cup=\E[%i%p1%d;%p2%dH$<30>, + is2=\E[!p\E[?3;7;19;67h\E[?1;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1 + ;1H\E>$<200>, + rs2=\E[!p\E[?3;7;19;67h\E[?1;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1 + ;1H\E>$<200>, + use=ncr260vt300pp, +# This terminfo file contains color capabilities for the Wyse325 emulation of +# the NCR 2900/260C color terminal. Because of the structure of the command +# (escape sequence) used to set color attributes, one of the fore/background +# colors must be preset to a given value. I have set the background color to +# black. The user can change this setup by altering the last section of the +# 'setf' definition. The escape sequence to set color attributes is +# ESC d y 1 +# In addition, the background color can be changed through the desk accessories. +# The capablitiy 'op' sets colors to green on black (default combination). +# +# NOTE: The NCR Unix System Administrator's Shell will not function properly +# if the 'pairs' capability is defined. Un-Comment the 'pairs' +# capability and recompile if you wish to have it included. +# +ncr260wy325pp|NCR 2900_260 wyse 325, + am, bw, hs, km, mc5i, mir, msgr, xon, + colors#16, cols#80, lines#24, ncv#33, nlab#32, + acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, + cbt=\EI, civis=\E`0, clear=\E*$<10>, cnorm=\E`1, cr=^M, + cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<10>, cuu1=\013$<5>, + cvvis=\E`5, dch1=\EW$<50>, dl1=\ER$<5>, dsl=\E`c, + ed=\Ey$<5>, el=\Et$<5>, fsl=^M, home=\036$<5>, ht=^I, + hts=\E1, il1=\EE$<5>, ind=\n$<5>, invis=\EG1, + is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9 + \Ee7$<100>, + kDC=\ER, kEND=\EY, kHOM=\E{, kNXT=\EK, kPRT=\E7, kPRV=\EJ, + kRIT=^L, ka1=^^, kb2=\EJ, kbs=^H, kc1=\ET, kc3=\EK, kcbt=\EI, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, kdch1=\EW, kend=\ET, + kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, + kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, kf17=^A`\r, kf18=^Aa\r, + kf19=^Ab\r, kf2=^AA\r, kf20=^Ac\r, kf21=^Ad\r, kf22=^Ae\r, + kf23=^Af\r, kf24=^Ag\r, kf25=^Ah\r, kf26=^Ai\r, kf27=^Aj\r, + kf28=^Ak\r, kf29=^Al\r, kf3=^AB\r, kf30=^Am\r, kf31=^An\r, + kf32=^Ao\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, + kprt=\EP, mc0=\EP, mc4=^T, mc5=^R, + mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<10>, + nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH\003\EcB0, + rmam=\Ed., rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, + rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9 + \Ee7$<100>, + setb=\s, + setf=%?%p1%{0}%=%t%{49}%e%p1%{1}%=%t%{50}%e%p1%{2}%=%t%{51} + %e%p1%{3}%=%t%{52}%e%p1%{4}%=%t%{53}%e%p1%{5}%=%t%{54} + %e%p1%{6}%=%t%{55}%e%p1%{7}%=%t%{64}%e%p1%{8}%=%t%{57} + %e%p1%{9}%=%t%{58}%e%p1%{10}%=%t%{59}%e%p1%{11}%=%t + %{60}%e%p1%{12}%=%t%{61}%e%p1%{13}%=%t%{62}%e%p1%{14}%= + %t%{63}%e%p1%{15}%=%t%{56}%;\Edy%c11$<100>, + sgr0=\EG0\EcB0\EcD$<15>, smacs=\EH\002\EcB1, smam=\Ed/, + smir=\Eq, smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0, + tsl=\EF, +ncr260wy325wpp|NCR 2900_260 wyse 325 wide mode, + cols#132, + cup=\Ea%i%p1%dR%p2%dC$<30>, + is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9 + \Ee7$<100>, + rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9 + \Ee7$<100>, + use=ncr260wy325pp, +# This definition for Wyse 350 supports several attributes. This means +# that it has magic cookies (extra spaces where the attributes begin). +# Some applications do not function well with magic cookies. The System +# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. +# If supporting various attributes is not vital, 'xmc#1' and the extra +# attributes can be removed. +# Mapping to ASCII character set ('acsc' capability) can also be +# restored if needed. +# In addition, color capabilities have been added to this file. The drawback, +# however, is that the background color has to be black. The foreground colors +# are numbered 0 through 15. +# +# NOTE: The NCR Unix System Administrator's Shell does not function properly +# with the 'pairs' capability defined as below. If you wish to +# have it included, Un-comment it and recompile (using 'tic'). +# +ncr260wy350pp|NCR 2900_260 wyse 350, + am, bw, hs, km, mc5i, mir, msgr, xon, + colors#16, cols#80, lines#24, ncv#33, nlab#32, pairs#16, xmc#1, + acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, + cbt=\EI, civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, + cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<40>, cuu1=\013$<5>, + cvvis=\E`5, dch1=\EW$<50>, dim=\EGp, dl1=\ER$<5>, dsl=\E`c, + ed=\Ey$<5>, el=\Et$<5>, fsl=^M, home=\036$<10>, ht=^I, + hts=\E1, il1=\EE$<5>, ind=\n$<5>, invis=\EG1, + is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9 + \Ee7$<100>, + kDC=\ER, kEND=\EY, kHOM=\E{, kPRT=\E7, kRIT=^L, ka1=^^, kbs=^H, + kc1=\ET, kc3=\EK, kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, kdch1=\EW, kend=\ET, kf1=^A@\r, kf10=^AI\r, + kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, + kf16=^AO\r, kf17=^A`\r, kf18=^Aa\r, kf19=^Ab\r, kf2=^AA\r, + kf20=^Ac\r, kf21=^Ad\r, kf22=^Ae\r, kf23=^Af\r, kf24=^Ag\r, + kf25=^Ah\r, kf26=^Ai\r, kf27=^Aj\r, kf28=^Ak\r, kf29=^Al\r, + kf3=^AB\r, kf30=^Am\r, kf31=^An\r, kf32=^Ao\r, kf4=^AC\r, + kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, + khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, kprt=\EP, + mc0=\EP$<10>, mc4=^T, mc5=^R, + mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<20>, + nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH\003\EcB0, + rmam=\Ed., rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, + rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E"\Ee4\Ex@\E`9 + \Ee7$<100>, + setb=\s, + setf=%?%p1%{0}%=%t%{49}%e%p1%{1}%=%t%{50}%e%p1%{2}%=%t%{51} + %e%p1%{3}%=%t%{52}%e%p1%{4}%=%t%{53}%e%p1%{5}%=%t%{54} + %e%p1%{6}%=%t%{55}%e%p1%{7}%=%t%{102}%e%p1%{8}%=%t%{97} + %e%p1%{9}%=%t%{98}%e%p1%{10}%=%t%{99}%e%p1%{11}%=%t + %{101}%e%p1%{12}%=%t%{106}%e%p1%{13}%=%t%{110}%e%p1 + %{14}%=%t%{111}%e%p1%{15}%=%t%{56}%;\Em0%c$<100>, + sgr0=\EG0\EH\003\EcD, smacs=\EH\002\EcB1, smam=\Ed/, + smir=\Eq, smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0, + tsl=\EF, +ncr260wy350wpp|NCR 2900_260 wyse 350 wide mode, + cols#132, + cup=\Ea%i%p1%dR%p2%dC$<30>, + is2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9 + \Ee7$<200>, + rs2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E"\Ee4\Ex@\E`9 + \Ee7$<200>, + use=ncr260wy350pp, +# This definition for Wyse 50+ supports several attributes. This means +# that it has magic cookies (extra spaces where the attributes begin). +# Some applications do not function well with magic cookies. The System +# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. +# If supporting various attributes is not vital, 'xmc#1' and the extra +# attributes can be removed. +# Mapping to ASCII character set ('acsc' capability) can also be +# restored if needed. +# (ncr260wy50+pp: originally contained commented-out +# , as well as the commented-out one there -- esr) +ncr260wy50+pp|NCR 2900_260 wyse 50+, + am, bw, hs, km, mc5i, mir, msgr, xon, + cols#80, lines#24, nlab#32, xmc#1, + acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, blink=\EG2, + cbt=\EI$<5>, civis=\E`0, clear=\E+$<20>, cnorm=\E`1, cr=^M, + cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<30>, cuu1=\013$<5>, + cvvis=\E`5, dch1=\EW$<50>, dim=\EGp, dl1=\ER$<5>, dsl=\E`c, + ed=\EY$<5>, el=\ET$<5>, fsl=^M, home=\036$<10>, + ht=\011$<5>, hts=\E1$<5>, il1=\EE$<5>, ind=\n$<5>, + invis=\EG1, + is2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E" + \Ee4\Ex@\E`9\Ee7$<100>, + kDC=\ER, kEND=\EY, kHOM=\E{, kPRT=\E7, kRIT=^L, ka1=^^, kbs=^H, + kc1=\ET, kc3=\EK, kcbt=\EI, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, kdch1=\EW, kend=\ET, kf1=^A@\r, kf10=^AI\r, + kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, + kf16=^AO\r, kf17=^A`\r, kf18=^Aa\r, kf19=^Ab\r, kf2=^AA\r, + kf20=^Ac\r, kf21=^Ad\r, kf22=^Ae\r, kf23=^Af\r, kf24=^Ag\r, + kf25=^Ah\r, kf26=^Ai\r, kf27=^Aj\r, kf28=^Ak\r, kf29=^Al\r, + kf3=^AB\r, kf30=^Am\r, kf31=^An\r, kf32=^Ao\r, kf4=^AC\r, + kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, + khome=^^, kich1=\Eq, knp=\EK, kpp=\EJ, kprt=\EP, + mc0=\EP$<10>, mc4=^T, mc5=^R, + mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<10>, + nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH^C, rmam=\Ed., + rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, + rs2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E" + \Ee4\Ex@\E`9\Ee7$<100>, + sgr0=\EG0\EH\003$<15>, smacs=\EH^B, smam=\Ed/, smir=\Eq, + smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0$<5>, tsl=\EF, +ncr260wy50+wpp|NCR 2900_260 wyse 50+ wide mode, + cols#132, + cup=\Ea%i%p1%dR%p2%dC$<30>, + is2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E" + \Ee4\Ex@\E`9\Ee7$<200>, + rs2=\Ee6\E~"$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E" + \Ee4\Ex@\E`9\Ee7$<200>, + use=ncr260wy50+pp, +ncr260wy60pp|NCR 2900_260 wyse 60, + am, bw, hs, km, mc5i, mir, msgr, xon, + cols#80, lines#24, nlab#32, + acsc=07a?h;j5k3l2m1n8q\:t4u9v=w0x6, bel=^G, blink=\EG2, + cbt=\EI$<15>, civis=\E`0, clear=\E*$<100>, cnorm=\E`1, + cr=^M, cub1=\010$<5>, cud1=\n$<5>, cuf1=\014$<5>, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<10>, cuu1=\013$<5>, + cvvis=\E`5, dch1=\EW$<50>, dl1=\ER$<5>, dsl=\E`c, + ed=\Ey$<5>, el=\Et$<5>, fsl=^M, home=\036$<25>, + ht=\011$<15>, hts=\E1$<15>, il1=\EE$<5>, ind=\n$<5>, + invis=\EG1, + is2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E" + \Ee4\Ex@\E`9\Ee7$<100>, + kDC=\ER, kEND=\EY, kHOM=\E{, kNXT=\EK, kPRT=\E7, kPRV=\EJ, + kRIT=^L, ka1=^^, kb2=\EJ, kbs=^H, kc1=\ET, kc3=\EK, + kcbt=\EI$<15>, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, + kdch1=\EW, kend=\ET, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, + kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, kf16=^AO\r, + kf17=^A`\r, kf18=^Aa\r, kf19=^Ab\r, kf2=^AA\r, kf20=^Ac\r, + kf21=^Ad\r, kf22=^Ae\r, kf23=^Af\r, kf24=^Ag\r, kf25=^Ah\r, + kf26=^Ai\r, kf27=^Aj\r, kf28=^Ak\r, kf29=^Al\r, kf3=^AB\r, + kf30=^Am\r, kf31=^An\r, kf32=^Ao\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\Eq, knp=\EK, kpp=\EJ, kprt=\EP, mc0=\EP, mc4=^T, mc5=^R, + mrcup=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c$<30>, + nel=\037$<5>, rev=\EG4, ri=\Ej$<5>, rmacs=\EH^C, rmam=\Ed., + rmir=\Er, rmso=\EG0, rmul=\EG0, rmxon=\Ec20, + rs2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\:\E`@\E~!\E" + \Ee4\Ex@\E`9\Ee7$<100>, + sgr0=\EG0\EcB0\EcD$<15>, smacs=\EH^B, smam=\Ed/, + smir=\Eq, smso=\EGt, smul=\EG8, smxon=\Ec21, tbc=\E0$<15>, + tsl=\EF, +ncr260wy60wpp|NCR 2900_260 wyse 60 wide mode, + cols#132, + cup=\Ea%i%p1%dR%p2%dC$<30>, + is2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E" + \Ee4\Ex@\E`9\Ee7$<100>, + rs2=\Ee6\E~4$<100>\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~!\E" + \Ee4\Ex@\E`9\Ee7$<100>, + use=ncr260wy60pp, +ncr160vppp|NCR 2900_160 viewpoint, + use=ncr260vppp, +ncr160vpwpp|NCR 2900_160 viewpoint wide mode, + use=ncr260vpwpp, +ncr160vt100an|NCR 2900_160 vt100 with ansi kybd, + use=ncr260vt100an, +ncr160vt100pp|NCR 2900_160 vt100 with PC+ kybd, + use=ncr260vt100pp, +ncr160vt100wan|NCR 2900_160 vt100 wide mode ansi kybd, + use=ncr260vt100wan, +ncr160vt100wpp|NCR 2900_160 vt100 wide mode pc+ kybd, + use=ncr260vt100wpp, +ncr160vt200an|NCR 2900_160 vt200 with ansi kybd, + use=ncr260vt200an, +ncr160vt200pp|NCR 2900_160 vt200 with pc+ kybd, + use=ncr260vt200pp, +ncr160vt200wan|NCR 2900_160 vt200 wide mode ansi kybd, + use=ncr260vt200wan, +ncr160vt200wpp|NCR 2900_160 vt200 wide mode pc+ kybd, + use=ncr260vt200wpp, +ncr160vt300an|NCR 2900_160 vt300 with ansi kybd, + use=ncr260vt300an, +ncr160vt300pp|NCR 2900_160 vt300 with pc+ kybd, + use=ncr260vt300pp, +ncr160vt300wan|NCR 2900_160 vt300 wide mode ansi kybd, + use=ncr260vt300wan, +ncr160vt300wpp|NCR 2900_160 vt300 wide mode pc+ kybd, + use=ncr260vt300wpp, +ncr160wy50+pp|NCR 2900_160 wyse 50+, + use=ncr260wy50+pp, +ncr160wy50+wpp|NCR 2900_160 wyse 50+ wide mode, + use=ncr260wy50+wpp, +ncr160wy60pp|NCR 2900_160 wyse 60, + use=ncr260wy60pp, +ncr160wy60wpp|NCR 2900_160 wyse 60 wide mode, + use=ncr260wy60wpp, +ncrvt100an|ncrvt100pp|NCR vt100 for the 2900 terminal, + am, hs, mc5i, mir, msgr, xon, + cols#80, it#8, lines#24, nlab#32, + acsc=``aaffgghhiijjkkllmmnnqqttuuvvwwxxyyzz~~, + bel=^G, blink=\E[5m$<30>, bold=\E[1m$<30>, + clear=\E[2J\E[1;1H$<300>, cr=^M, + csr=\E[%i%p1%d;%p2%dr$<100>, cub=\E[%p1%dD$<30>, + cub1=\E[D$<2>, cud=\E[%p1%dB$<30>, cud1=\E[B$<2>, + cuf=\E[%p1%dC$<30>, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<100>, cuu=\E[%p1%dA$<30>, + cuu1=\E[A$<2>, dch=\E[%p1%dP$<40>, dch1=\E[1P$<10>, + dl=\E[%p1%dM$<70>, dl1=\E[M$<40>, dsl=\E[31l$<25>, + ed=\E[0J$<300>, el=\E[0K$<30>, el1=\E[1K$<30>, + enacs=\E(B\E)0$<40>, fsl=1$<10>, home=\E[H$<2>$<80>, + ht=^I, hts=\EH, il=\E[%p1%dL$<80>, il1=\E[B\E[L$<80>, + ind=\ED, + is2=\E[12h\E[?10l\E%/0n\E[P\031\E[?3l\E(B\E)0$<200>, + kLFT=\E[D, kRIT=\E[C, ka1=\E[H, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kent=^M, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, mc0=\E[i$<100>, nel=\EE, + rc=\E8, rev=\E[7m$<30>, ri=\EM$<50>, rmacs=\017$<90>, + rmir=\E[4l$<80>, rmso=\E[0m$<30>, rmul=\E[0m$<30>, + rs2=\Ec\E[12;31h\E[?3;4;5;10l\E[?6;7;19;25h\E[33;34l\E[0m\E( + B\E)0\E%/0n\E[P\031$<200>, + sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;$<100>, + sgr0=\017\E[0m$<120>, smacs=\016$<90>, smir=\E[4h$<80>, + smso=\E[7m$<30>, smul=\E[4m$<30>, tbc=\E[3g$<40>, + tsl=\E[>+1$<70>, +ncrvt100wan|NCRVT100WPP|ncrvt100wpp|NCR VT100 emulation of the 2900 terminal, + cols#132, + is2=\E[12h\E[?10l\E%/0n\E[P\031\E[?3h\E(B\E)0$<200>, + rs2=\Ec\E[12;31h\E[?4;5;10l\E?3;6;7;19;25h\E[33;34l\E[0m\E(B + \E)0\E%/0n\E[P\031$<200>, + use=ncrvt100an, +# +# Vendor-supplied NCR termcaps end here + +# NCR7900 DIP switches: +# +# Switch A: +# 1-4 - Baud Rate +# 5 - Parity (Odd/Even) +# 6 - Don't Send or Do Send Spaces +# 7 - Parity Enable +# 8 - Stop Bits (One/Two) +# +# Switch B: +# 1 - Upper/Lower Shift +# 2 - Typewriter Shift +# 3 - Half Duplex / Full Duplex +# 4 - Light/Dark Background +# 5-6 - Carriage Return Without / With Line Feed +# 7 - Extended Mode +# 8 - Suppress Keyboard Display +# +# Switch C: +# 1 - End of line entry disabled/enabled +# 2 - Conversational mode / (Local?) Mode +# 3 - Control characters displayed / not displayed +# 4 - (2-wire?) / 4-wire communications +# 5 - RTS on and off for each character +# 6 - (50Hz?) / 60 Hz +# 7 - Exit after level zero diagnostics +# 8 - RS-232 interface +# +# Switch D: +# 1 - Reverse Channel (yes / no) +# 2 - Manual answer (no / yes) +# 3-4 - Cursor appearance +# 5 - Communication Rate +# 6 - Enable / Disable EXT turnoff +# 7 - Enable / Disable CR turnoff +# 8 - Enable / Disable backspace +# +# Since each attribute parameter is 0 or 1, we shift each attribute (standout, +# reverse, blink, dim, and underline) the appropriate number of bits (by +# multiplying the 0 or 1 by a correct factor to shift) so the bias character, +# '@' is (effectively) "or"ed with each attribute to generate the proper third +# character in the 0 sequence. The string implements the following +# equation: +# +# ((((('@' + P5) | (P4 << 1)) | (P3 << 3)) | (P2 << 4)) | (p1 * 17)) => +# ((((('@' + P5) + (P4 << 1)) + (P3 << 3)) + (P2 << 4)) + (p1 * 17)) +# +# Where: P1 <==> Standout attribute parameter +# P2 <==> Underline attribute parameter +# P3 <==> Reverse attribute parameter +# P4 <==> Blink attribute parameter +# P5 <==> Dim attribute parameter +# From , init string hacked by SCO. +ncr7900i|ncr7900|ncr 7900 model 1, + am, bw, ul, + cols#80, lines#24, xmc#1, + bel=^G, blink=\E0B, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\E1%p2%c%p1%c, cuu1=^Z, dim=\E0A, ed=\Ek, el=\EK, ind=^J, + is2=\E0@\010\E3\E4\E7, kcub1=^U, kcud1=^J, kcuf1=^F, + kcuu1=^Z, khome=^A, ll=^A, mc4=^T, mc5=^R, rev=\E0P, rmso=\E0@, + rmul=\E0@, + sgr=\E0%p5%{64}%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17} + %*%+%c, + sgr0=\E0@, smso=\E0Q, smul=\E0`, +ncr7900iv|ncr 7900 model 4, + am, bw, eslok, hs, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, + cup=\013%p1%{64}%+%c\E\005%p2%02d, dl1=\E^O, dsl=\Ey1, + fsl=\Ek\Ey5, home=\013@\E^E00, il1=\E^N, ind=^J, kbs=^H, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf1=\ES, kf2=\ET, + kf3=\EU, kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, + khome=\EH, lf6=blue, lf7=red, lf8=white, nel=^M^J, + tsl=\Ej\Ex5\Ex1\EY8%p1%{32}%+%c\Eo, +# Warning: This terminal will lock out the keyboard when it receives a CTRL-D. +# The user can enter a CTRL-B to get out of this locked state. +# In , we want to output the character given by the formula: +# ((col / 10) * 16) + (col % 10) where "col" is "p1" +ncr7901|ncr 7901 model, + am, bw, ul, + cols#80, lines#24, + bel=^G, blink=\E0B, civis=^W, clear=^L, cnorm=^X, cr=^M, + cub1=^H, cud1=^J, cuf1=^F, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, dim=\E0A, + ed=\Ek, el=\EK, + hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%c, ind=^J, + is2=\E4^O, kclr=^L, kcub1=^U, kcud1=^J, kcuf1=^F, kcuu1=^Z, + khome=^H, ll=^A, mc4=^T, mc5=^R, rev=\E0P, rmso=^O, rmul=^O, + sgr=\E0%p5%{64}%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17} + %*%+%c\016, + sgr0=^O, smso=\E0Q\016, smul=\E0`\016, + vpa=\013%p1%{64}%+%c, + +# Newbury Data Recording Limited (Newbury Data) +# +# Have been manufacturing and reselling various peripherals for a long time +# They don't make terminals anymore, but are still in business (in 2007). +# Their e-mail address is at ndsales@newburydata.co.uk +# and their post address is: +# +# Newbury Data Recording Ltd, +# Premier Park, Road One, +# Winsford, Cheshire, CW7 3PT +# +# Their technical support is still good, they sent me for free a printed copy +# of the 9500 user manual and I got it just 1 week after I first contacted them +# (in 2005)! + +# NDR 9500 +# Manufactured in the early/mid eighties, behaves almost the same as a +# Televideo 950. Take a 950, change its cabinet for a more 80s-ish one (but +# keep the same keyboard layout), add an optional 25-line mode, replace the DIP +# switches with a menu and remove the "lock line" feature (ESC ! 1 and ESC ! +# 2), here is the NDR 9500. Even the line-lock, albeit disabled, is +# recognized: if you type in "ESC !", the next (third) character is not +# echoed, showing that the terminal was actually waiting for a parameter! +ndr9500|nd9500|Newbury Data 9500, + am, bw, hs, mc5i, mir, msgr, ul, xon, + cols#80, lines#24, wsl#79, + acsc=jDkClBmAnIqKtMuLvOwNxJ, bel=^G, cbt=\EI, civis=\E.0, + clear=\E;, cnorm=\E.1, cr=^M, cub1=^H, cud1=^V, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dim=\E), dl1=\ER, dsl=\Eh, ed=\EY, el=\ET, + flash=\Eb$<50/>\Ed, fsl=^M, home=^^, ht=^I, hts=\E1, + ich1=\EQ, il1=\EE, ind=^J, is2=\Ew\E'\EDF\El\Er\EO, + kDC=\Er, kDL=\EO, kEOL=\Et, kIC=\Eq, kcbt=\EI, kclr=^Z, + kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, + ked=\EY, kel=\ET, kent=^M, kf1=^A@\r, kf10=^AI\r, kf11=^AJ\r, + kf12=^A`\r, kf13=^Aa\r, kf14=^Ab\r, kf15=^Ac\r, kf16=^Ad\r, + kf17=^Ae\r, kf18=^Af\r, kf19=^Ag\r, kf2=^AA\r, kf20=^Ah\r, + kf21=^Ai\r, kf22=^Aj\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, kprt=\EP, mc4=\Ea, mc5=\E`, nel=^_, + pfloc=\E|%{48}%p1%+%c2%p2\031, + pfx=\E|%{48}%p1%+%c1%p2\031, prot=\E), ri=\Ej, + rmacs=\E%%, rmir=\Er, rmso=\E(, rmxon=^N, + sgr=\EG0\E%%%%\E(%?%p1%p5%p8%|%|%t\E)%;%?%p9%t\E$%;, + sgr0=\EG0\E%%\E(, smacs=\E$, smir=\Eq, smso=\E), smxon=^O, + tbc=\E3, tsl=\Eg\Ef\011%p1%{32}%+%c, .kbs=^H, + +ndr9500-nl|NDR 9500 with no status line, + hs@, + wsl@, + dsl@, fsl@, tsl@, use=ndr9500, + +ndr9500-25|NDR 9500 with 25th line enabled, + lines#25, use=ndr9500, + +ndr9500-25-nl|NDR 9500 with 25 lines and no status line, + lines#25, use=ndr9500-nl, + +ndr9500-mc|NDR 9500 with magic cookies (enables underline inverse video invisible and blink), + msgr@, + xmc#1, + blink=\EG2, invis=\EG1, rev=\EG4, rmso=\EG0, rmul=\EG0, + sgr=\E%%\E(%?%p5%p8%|%t\E)%;%?%p9%t\E$%;\EG%{48}%?%p7%t%{1} + %+%;%?%p4%t%{2}%+%;%?%p3%p1%|%t%{4}%+%;%?%p2%t%{8}%+%;%c, + sgr0=\EG0\E%%\E(, smso=\EG4, smul=\EG8, use=ndr9500, + +ndr9500-25-mc|NDR 500 with 25 lines and magic cookies, + lines#25, use=ndr9500-mc, + +ndr9500-mc-nl|NDR 9500 with magic cookies and no status line, + hs@, + wsl@, + dsl@, fsl@, tsl@, use=ndr9500-mc, + +ndr9500-25-mc-nl|NDR 9500 with 25 lines and magic cookies and no status line, + lines#25, use=ndr9500-mc-nl, + +#### Perkin-Elmer (Owl) +# +# These are official terminfo entries from within Perkin-Elmer. +# + +bantam|pe550|pe6100|perkin elmer 550, + OTbs, + cols#80, lines#24, + bel=^G, clear=\EK$<20>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, + el=\EI$<20>, home=\EH, ind=^J, ll=\EH\EA, +fox|pe1100|perkin elmer 1100, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\EH\EJ$<132>, cr=^M, cub1=^H, cud1=^J, + cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, + ed=\EJ$<5.5*>, el=\EI, flash=\020\002$<200/>\020\003, + home=\EH, hts=\E1, ind=^J, ll=\EH\EA, tbc=\E3, +owl|pe1200|perkin elmer 1200, + OTbs, am, in, + cols#80, lines#24, + bel=^G, clear=\EH\EJ$<132>, cr=^M, cub1=^H, cud1=^J, + cuf1=\EC, cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, + dch1=\EO$<5.5*>, dl1=\EM$<5.5*>, ed=\EJ$<5.5*>, + el=\EI$<5.5>, flash=\020\002$<200/>\020\003, home=\EH, + hts=\E1, ich1=\EN, il1=\EL$<5.5*>, ind=^J, ip=$<5.5*>, + kbs=^H, kf0=\ERJ, kf1=\ERA, kf2=\ERB, kf3=\ERC, kf4=\ERD, + kf5=\ERE, kf6=\ERF, kf7=\ERG, kf8=\ERH, kf9=\ERI, ll=\EH\EA, + rmso=\E!\0, sgr0=\E!\0, smso=\E!^H, tbc=\E3, +pe1251|pe6300|pe6312|perkin elmer 1251, + am, + cols#80, it#8, lines#24, pb#300, vt#8, xmc#1, + bel=^G, clear=\EK$<332>, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EX%p1%{32}%+%c\EY%p2%{32}%+%c, cuu1=\EA, + ed=\EJ$<20*>, el=\EI$<10*>, home=\EH, hts=\E1, ind=^J, + kf0=\ERA, kf1=\ERB, kf10=\ERK, kf2=\ERC, kf3=\ERD, kf4=\ERE, + kf5=\ERF, kf6=\ERG, kf7=\ERH, kf8=\ERI, kf9=\ERJ, tbc=\E3, +# (pe7000m: this had +# rmul=\E!\0, smul=\E!\040, +# which is probably wrong, it collides with kf0 +pe7000m|perkin elmer 7000 series monochrome monitor, + am, + cols#80, lines#24, + bel=^G, cbt=\E!Y, clear=\EK, cr=^M, cub1=\ED, cud1=\EB, + cuf1=\EC, cup=\ES%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + ed=\EJ, el=\EI, home=\EH, ind=^J, + is1=\E!\0\EW 7o\Egf\ES7\s, kbs=^H, kcub1=\E!V, + kcud1=\E!U, kcuf1=\E!W, kcuu1=\E!T, kf0=\E!\0, kf1=\E!^A, + kf10=\E!^J, kf2=\E!^B, kf3=\E!^C, kf4=\E!^D, kf5=\E!^E, + kf6=\E!^F, kf7=\E!^G, kf8=\E!^H, kf9=\E!^I, khome=\E!S, + ll=\ES7\s, ri=\ER, +pe7000c|perkin elmer 7000 series colour monitor, + is1=\E!\0\EW 7o\Egf\Eb0\Ec7\ES7\s, rmso=\Eb0, + rmul=\E!\0, smso=\Eb2, smul=\E!\s, use=pe7000m, + +#### Sperry Univac +# +# Sperry Univac has merged with Burroughs to form Unisys. +# + +# This entry is for the Sperry UTS30 terminal running the TTY +# utility under control of CP/M Plus 1R1. The functionality +# provided is comparable to the DEC vt100. +# (uts30: I added / based on the init string -- esr) +uts30|sperry uts30 with cp/m@1R1, + am, bw, hs, + cols#80, lines#24, wsl#40, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\ER, clear=^L, + cnorm=\ES, cr=^M, csr=\EU%p1%{32}%+%c%p2%{32}%+%c, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\EM, + dl=\E[%p1%dM, dl1=\EL, ed=\E[J, el=\E[K, fsl=^M, home=\E[H, + ht=^I, ich=\E[%p1%d@, ich1=\EO, il=\E[%p1%dL, il1=\EN, + ind=^J, indn=\E[%p1%dB, is2=\E[U 7\E[24;1H, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, khome=\E[H, + rc=\EX, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EI, + rin=\E[%p1%dA, rmacs=\Ed, rmam=\E[?7l, rmso=\E[m, + rmul=\E[m, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, + sc=\EW, sgr0=\E[m, smacs=\EF, smam=\E[?7m, smso=\E[7m, + smul=\E[4m, tsl=\E], uc=\EPB, + +#### Tandem +# +# Tandem builds these things for use with its line of fault-tolerant +# transaction-processing computers. They aren't generally available +# on the merchant market, and so are fairly uncommon. +# + +tandem6510|adm3a repackaged by Tandem, + use=adm3a, + +# A funny series of terminal that TANDEM uses. The actual model numbers +# have a fourth digit after 653 that designates minor variants. These are +# natively block-mode and rather ugly, but they have a character mode which +# this doubtless(?) exploits. There is a 6520 that is slightly dumber. +# (tandem653: had ":sb=\ES:", probably someone's mistake for sf; also, +# removed , no such file -- esr) +tandem653|t653x|Tandem 653x multipage terminal, + OTbs, am, da, db, hs, + cols#80, lines#24, wsl#64, xmc#1, + clear=\EI, cub1=^H, cud1=^J, cuf1=\EC, + cup=\023%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dsl=\Eo\r, + ed=\EJ, el=\EK, fsl=^M, home=\EH, ind=\ES, ri=\ET, rmso=\E6\s, + rmul=\E6\s, sgr0=\E6\s, smso=\E6$, smul=\E60, tsl=\Eo, + +#### Tandy/Radio Shack +# +# Tandy has a line of VDTs distinct from its microcomputers. +# + +dmterm|deskmate terminal, + am, bw, + cols#80, lines#24, + bel=^G, civis=\EG5, clear=\Ej, cnorm=\EG6, cr=^M, cub1=^H, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dch1=\ES, dl1=\ER, ed=\EJ, el=\EK, home=\EH, ht=^I, + ich1=\EQ, il1=\EP, ind=\EX, invis@, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kf0=\E1, kf1=\E2, kf2=\E3, kf3=\E4, + kf4=\E5, kf5=\E6, kf6=\E7, kf7=\E8, kf8=\E9, kf9=\E0, + khome=\EH, lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, + lf6=f7, lf7=f8, lf8=f9, lf9=f10, ll=\EE, rmul@, smul@, + use=adm+sgr, +dt100|dt-100|Tandy DT-100 terminal, + xon, + cols#80, lines#24, xmc#1, + acsc=jjkkllmmnnqqttuuvvwwxx, bel=^G, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%p1%2d;%p2%2dr, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\010\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, + il1=\E[L, ind=^J, is2=\E[?3l\E)0\E(B, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\E[?3i, + kf10=\E[?5i, kf2=\E[2i, kf3=\E[@, kf4=\E[M, kf5=\E[17~, + kf6=\E[18~, kf7=\E[19~, kf8=\E[20~, kf9=\E[21~, khome=\E[H, + knp=\E[29~, kpp=\E[28~, lf1=f1, lf2=f2, lf3=f3, lf4=f4, lf5=f5, + lf6=f6, lf7=f7, lf8=f8, ri=\EM, rmacs=^O, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smacs=^N, smso=\E[7m, smul=\E[4m, +dt100w|dt-100w|Tandy DT-100 terminal (wide mode), + cols#132, use=dt100, +dt110|Tandy DT-110 emulating ansi, + xon, + cols#80, lines#24, + acsc=jjkkllmmnnqqttuuvvwwxx, bel=^G, civis=\E[?25l, + clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\010\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[0P, + dl1=\E[0M, ed=\E[0J, el=\E[0K, enacs=\E(B\E)0, home=\E[H, + ht=^I, ich1=\E[0@, il1=\E[0L, ind=^J, is2=\E[?3l\E)0\E(B, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[K, + kf1=\E[1~, kf10=\E[10~, kf2=\E[2~, kf3=\E[3~, kf4=\E[4~, + kf5=\E[5~, kf6=\E[6~, kf7=\E[7~, kf8=\E[8~, kf9=\E[9~, + khome=\E[G, kich1=\E[@, knp=\E[26~, kpp=\E[25~, lf0=f1, + lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, lf7=f8, lf8=f9, + lf9=f10, ri=\EM, rmacs=^O, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smacs=^N, smso=\E[7m, smul=\E[4m, +pt210|TRS-80 PT-210 printing terminal, + hc, os, + cols#80, + bel=^G, cr=^M, cud1=^J, ind=^J, + +#### Tektronix (tek) +# +# Tektronix tubes are graphics terminals. Most of them use modified +# oscilloscope technology incorporating a long-persistence green phosphor, +# and support vector graphics on a main screen with an attached "dialogue +# area" for interactive text. +# + +tek|tek4012|tektronix 4012, + OTbs, os, + cols#75, lines#35, + bel=^G, clear=\E\014$<1000>, cr=^M, cub1=^H, cud1=^J, + ff=\014$<1000>, is2=\E^O, +# (tek4013: added to suppress tic warnings re / --esr) +tek4013|tektronix 4013, + acsc=, rmacs=\E^O, smacs=\E^N, use=tek4012, +tek4014|tektronix 4014, + cols#81, lines#38, + is2=\E\017\E9, use=tek4012, +# (tek4015: added to suppress tic warnings re / --esr) +tek4015|tektronix 4015, + acsc=, rmacs=\E^O, smacs=\E^N, use=tek4014, +tek4014-sm|tektronix 4014 in small font, + cols#121, lines#58, + is2=\E\017\E\:, use=tek4014, +# (tek4015-sm: added to suppress tic warnings re / --esr) +tek4015-sm|tektronix 4015 in small font, + acsc=, rmacs=\E^O, smacs=\E^N, use=tek4014-sm, +# Tektronix 4023 from Andrew Klossner +# +# You need to have "stty nl2" in effect. Some versions of tset(1) know +# how to set it for you. +# +# It's got the Magic Cookie problem around stand-out mode. If you can't +# live with Magic Cookie, remove the :so: and :se: fields and do without +# reverse video. If you like reverse video stand-out mode but don't want +# it to flash, change the letter 'H' to 'P' in the :so: field. +tek4023|tektronix 4023, + OTbs, am, + OTdN#4, cols#80, lines#24, vt#4, xmc#1, + OTnl=^J, bel=^G, clear=\E\014$<4/>, cr=^M, cub1=^H, cud1=^J, + cuf1=^I, cup=\034%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, + rmso=^_@, smso=^_P, +# It is recommended that you run the 4025 at 4800 baud or less; +# various bugs in the terminal appear at 9600. It wedges at the +# bottom of memory (try "cat /usr/dict/words"); ^S and ^Q typed +# on keyboard don't work. You have to hit BREAK twice to get +# one break at any speed - this is a documented feature. +# Can't use cursor motion because it's memory relative, and +# because it only works in the workspace, not the monitor. +# Same for home. Likewise, standout only works in the workspace. +# +# was commented out since vi and rogue seem to work better +# simulating it with lots of spaces! +# +# and had 145ms of padding, but that slowed down vi's ^U +# and didn't seem necessary. +# +tek4024|tek4025|tek4027|tektronix 4024/4025/4027, + OTbs, am, da, db, + cols#80, it#8, lines#34, lm#0, + bel=^G, clear=\037era\r\n\n, cmdch=^_, cr=^M, + cub=\037lef %p1%d\r, cub1=^H, cud=\037dow %p1%d\r, + cud1=^F^J, cuf=\037rig %p1%d\r, cuf1=\037rig\r, + cuu=\037up %p1%d\r, cuu1=^K, dch1=\037dch\r, + dl=\037dli %p1%d\r\006, dl1=\037dli\r\006, + ed=\037dli 50\r, ht=^I, ich1=\037ich\r \010, + il=\037up\r\037ili %p1%d\r, il1=\037up\r\037ili\r, + ind=^F^J, + is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r, + rmkx=\037lea\sp2\r\037lea\sp4\r\037lea\sp6\r\037lea\sp8\r + \037lea\sf5\r, + smkx=\037lea\sp4\s/h/\r\037lea\sp8\s/k/\r\037lea\sp6\s/\s/ + \r\037lea\sp2\s/j/\r\037lea\sf5\s/H/\r, +tek4025-17|tek 4025 17 line window, + lines#17, use=tek4025, +tek4025-17-ws|tek 4025 17 line window in workspace, + is2=!com\s31\r\n\037sto\s9\s17\s25\s33\s41\s49\s57\s65\s73 + \r\037wor\s17\r\037mon\s17\r, + rmcup=\037mon h\r, rmso=\037att s\r, smcup=\037wor h\r, + smso=\037att e\r, use=tek4025-17, +tek4025-ex|tek4027-ex|tek 4025/4027 w/!, + is2=\037com 33\r\n!sto 9 17 25 33 41 49 57 65 73\r, + rmcup=\037com 33\r, smcup=!com 31\r, use=tek4025, +# Tektronix 4025a +# From: Doug Gwyn +# The following status modes are assumed for normal operation (replace the +# initial "!" by whatever the current command character is): +# !COM 29 # NOTE: changes command character to GS (^]) +# ^]DUP +# ^]ECH R +# ^]EOL +# ^]RSS T +# ^]SNO N +# ^]STO 9 17 25 33 41 49 57 65 73 +# Other modes may be set according to communication requirements. +# If the command character is inadvertently changed, termcap can't restore it. +# Insert-character cannot be made to work on both top and bottom rows. +# Clear-to-end-of-display emulation via !DLI 988 is too grotty to use, alas. +# There also seems to be a problem with vertical motion, perhaps involving +# delete/insert-line, following a typed carriage return. This terminal sucks. +# Delays not specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# (tek4025a: removed obsolete ":xx:". This may mean the tek4025a entry won't +# work any more. -- esr) +tek4025a|Tektronix 4025A, + OTbs, OTpt, am, bw, da, db, xon, + cols#80, it#8, lines#34, + bel=^G, cbt=\035bac;, clear=\035era;\n\035rup;, cmdch=^], + cr=^M, cub=\035lef %p1%d;, cub1=^H, cud=\035dow %p1%d;, + cud1=^J, cuf=\035rig %p1%d;, cuf1=\035rig;, + cuu=\035up %p1%d;, cuu1=^K, dch=\035dch %p1%d;, + dch1=\035dch;, dl=\035dli %p1%d;, dl1=\035dli;, + el=\035dch 80;, hpa=\r\035rig %p1%d;, ht=^I, + il1=\013\035ili;, ind=^J, indn=\035dow %p1%d;, + rs2=!com\s29\035del\s0\035rss\st\035buf\035buf\sn\035cle + \035dis\035dup\035ech\sr\035eol\035era\sg\035for\sn + \035pad\s203\035pad\s209\035sno\sn\035sto\s9\s17\s25 + \s33\s41\s49\s57\s65\s73\035wor\s0;, + tbc=\035sto;, +# From: cbosg!teklabs!davem Wed Sep 16 21:11:41 1981 +# Here's the command file that I use to get rogue to work on the 4025. +# It should work with any program using the old curses (e.g. it better +# not try to scroll, or cursor addressing won't work. Also, you can't +# see the cursor.) +# (This "learns" the arrow keys for rogue. I have adapted it for termcap - mrh) +tek4025-cr|tek 4025 for curses and rogue, + OTbs, am, + cols#80, it#8, lines#33, + clear=\037era;, cub1=^H, cud1=^F^J, cuf1=\037rig;, + cup=\037jum%i%p1%d\,%p2%d;, cuu1=^K, ht=^I, ind=^F^J, + is2=!com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r, + rmcup=\037wor 0, smcup=\037wor 33h, +# next two lines commented out since curses only allows 128 chars, sigh. +# :ti=\037lea p1/b/\037lea p2/j/\037lea p3/n/\037lea p4/h/\037lea p5/ /\037lea p6/l/\037lea p7/y/\037lea p8/k/\037lea p9/u/\037lea p./f/\037lea pt/`era w/13\037lea p0/s/\037wor 33h:\ +# :te=\037lea p1\037lea p2\037lea p3\037lea p4\037lea pt\037lea p5\037lea p6\037lea p7\037lea p8\037lea p9/la/13\037lea p.\037lea p0\037wor 0: +tek4025ex|4025ex|4027ex|tek 4025 w/!, + is2=\037com\s33\r\n!sto\s9\,17\,25\,33\,41\,49\,57\,65\,73 + \r, + rmcup=\037com 33\r, smcup=!com 31\r, use=tek4025, +tek4105|tektronix 4105, + OTbs, am, mir, msgr, ul, xenl, xt, + cols#79, it#8, lines#29, + acsc=, bel=^G, blink=\E[=3;<7m, bold=\E[=7;<4m, cbt=\E[Z, + clear=\E[2J\E[H, cr=^M, cub1=\E[1D, cud1=\E[1B, cuf1=\E[1C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[1A, dch1=\E[1P, + dim=\E[=1;<6m, dl1=\E[1M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + il1=\E[1L, ind=\E[S, invis=\E[=6;<5, is1=\E%!1\E[m, + is2=\E%!1\E[?6141\E[m, kbs=^H, kcub1=\E[1D, kcud1=\E[1B, + kcuf1=\E[1C, kcuu1=\E[1A, rev=\E[=1;<3m, ri=\E[T, + rmacs=\E[m, rmcup=, rmir=\E[4l, rmso=\E[=0;<1m, + rmul=\E[=0;<1m, sgr0=\E[=0;<1m, smacs=\E[1m, + smcup=\E%!1\E[?6l\E[2J, smir=\E[4h, smso=\E[=2;<3m, + smul=\E[=5;<2m, tbc=\E[1g, + +# (tek4105-30: I added / based on the init string -- esr) +tek4105-30|4015 emulating 30 line vt100, + am, mir, msgr, xenl, xon, + cols#80, it#8, lines#30, vt#3, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, + clear=\E[H\E[J$<50>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, + enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rc=\E8, + rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, + rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5 + %;m%?%p9%t\016%e\017%;$<2>, + sgr0=\E[m\017$<2>, smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, + smso=\E[1;7m$<2>, smul=\E[4m$<2>, tbc=\E[3g, + use=vt100+fnkeys, + +# Tektronix 4105 from BRL +# The following setup modes are assumed for normal operation: +# CODE ansi CRLF no DABUFFER 141 +# DAENABLE yes DALINES 30 DAMODE replace +# DAVISIBILITY yes ECHO no EDITMARGINS 1 30 +# FLAGGING input INSERTREPLACE replace LFCR no +# ORIGINMODE relative PROMPTMODE no SELECTCHARSET G0 B +# SELECTCHARSET G1 0 TABS -2 +# Other setup modes may be set for operator convenience or communication +# requirements; I recommend +# ACURSOR 1 0 AUTOREPEAT yes AUTOWRAP yes +# BYPASSCANCEL CURSORKEYMODE no DAINDEX 1 0 0 +# EOFSTRING '' EOLSTRING EOMCHARS +# GAMODE overstrike GCURSOR 0 100 0 GSPEED 10 1 +# IGNOREDEL no KEYEXCHAR
NVDEFINE -53 "" +# PROMPTSTRING '' QUEUESIZE 2460 WINDOW 0 0 4095 3132 +# XMTDELAY 0 +# and factory color maps. After setting these modes, save them with NVSAVE. No +# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# "IC" cannot be used in combination with "im" & "ei". +# "tek4105a" is just a guess: +tek4105a|Tektronix 4105, + OTbs, OTpt, msgr, xon, + OTkn#8, cols#80, it#8, lines#30, vt#3, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + civis=\E%!0\ETD00\E%!1, clear=\E[H\E[J, + cnorm=\E%!0\ETD10\E%!1, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\EM, cvvis=\E%!0\ETD70\E%!1, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, + il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, is2=\E%!1, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, + kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, + lf5=F6, lf6=F8, ll=\E[30;H, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, + rin=\E[%p1%dT, rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs2=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40 + \ELI100\ELLA>\ELM0\EKE0\ENF1\EKS0\END0\E%!1\Ec\E[?3;5l + \E[?7;8h\E[r\E[m\E>, + sc=\E7, sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + +# +# Tektronix 4106/4107/4109 from BRL +# The following setup modes are assumed for normal operation: +# CODE ansi COLUMNMODE 80 CRLF no +# DABUFFER 141 DAENABLE yes DALINES 32 +# DAMODE replace DAVISIBILITY yes ECHO no +# EDITMARGINS 1 32 FLAGGING input INSERTREPLACE replace +# LFCR no LOCKKEYBOARD no ORIGINMODE relative +# PROMPTMODE no SELECTCHARSET G0 B SELECTCHARSET G1 0 +# TABS -2 +# Other setup modes may be set for operator convenience or communication +# requirements; I recommend +# ACURSOR 1 0 AUTOREPEAT yes AUTOWRAP yes +# BYPASSCANCEL CURSORKEYMODE no DAINDEX 1 0 0 +# EOFSTRING '' EOLSTRING EOMCHARS +# GAMODE overstrike GCURSOR 0 100 0 GSPEED 9 3 +# IGNOREDEL no KEYEXCHAR
NVDEFINE -53 "" +# PROMPTSTRING '' QUEUESIZE 2620 WINDOW 0 0 4095 3132 +# XMTDELAY 0 +# and factory color maps. After setting these modes, save them with NVSAVE. No +# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +# "IC" cannot be used in combination with "im" & "ei". +tek4106brl|tek4107brl|tek4109brl|Tektronix 4106 4107 or 4109, + msgr, xon, + cols#80, it#8, lines#32, vt#3, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, + civis=\E%!0\ETD00\E%!1, clear=\E[H\E[J, + cnorm=\E%!0\ETD10\E%!1, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\EM, cvvis=\E%!0\ETD70\E%!1, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, + il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, is2=\E%!1, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf0=\EOA, kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EOP, kf5=\EOQ, + kf6=\EOR, kf7=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, lf4=F5, + lf5=F6, lf6=F8, ll=\E[32;H, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, + rin=\E[%p1%dT, rmacs=^O, rmcup=\E%!0\ELBH=\E%!1, + rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs1=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40 + \ELI100\ELLB0\ELM0\EKE0\ENF1\EKS0\END0\ERE0\E%!1\Ec\E[?3 + ;5l\E[?7;8h\E[r\E[m\E>, + sc=\E7, sgr0=\E[m, smacs=^N, smcup=\E[?6l, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7;42m, smul=\E[4m, tbc=\E[3g, + +# Tektronix 4107/4109 interpret 4 modes using "\E%!" followed by a code: +# 0 selects Tek mode, i.e., \E%!0 +# 1 selects ANSI mode +# 2 selects ANSI edit-mode +# 3 selects VT52 mode +# +# One odd thing about the description (which has been unchanged since the 90s) +# is that the cursor addressing is using VT52 mode, and a few others use the +# VT52's non-CSI versions of ANSI, e.g., \EJ. +tek4107|tek4109|tektronix terminals 4107 4109, + OTbs, am, mir, msgr, ul, xenl, xt, + cols#79, it#8, lines#29, + bel=^G, blink=\E%!1\E[5m$<2>\E%!0, + bold=\E%!1\E[1m$<2>\E%!0, clear=\ELZ, cnorm=\E%!0, cr=^M, + cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\E%!3, + dim=\E%!1\E[<0m$<2>\E%!0, ed=\EJ, el=\EK, ht=^I, ind=^J, + kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + rev=\E%!1\E[7m$<2>\E%!0, ri=\EI, + rmso=\E%!1\E[m$<2>\E%!0, rmul=\E%!1\E[m$<2>\E%!0, + sgr=\E%%!1\E[%?%p1%t;7;5%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%; + %?%p5%t<0%;%?%p6%t;1%;m$<2>\E%%!0, + sgr0=\E%!1\E[m$<2>\E%!0, smso=\E%!1\E[7;5m$<2>\E%!0, + smul=\E%!1\E[4m$<2>\E%!0, +# Tektronix 4207 with sysline. In the ancestral termcap file this was 4107-s; +# see the note attached to tek4207. +tek4207-s|Tektronix 4207 with sysline but no memory, + eslok, hs, + dsl=\E7\E[?6l\E[2K\E[?6h\E8, fsl=\E[?6h\E8, + is1=\E%!1\E[2;32r\E[132D\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8 + C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J, + is2=\E7\E[?6l\E[2K\E[?6h\E8, + tsl=\E7\E[?6l\E[2K\E[;%i%df, use=tek4107, + +# The 4110 series may be a wonderful graphics series, but they make the 4025 +# look good for screen editing. In the dialog area, you can't move the cursor +# off the bottom line. Out of the dialog area, ^K moves it up, but there +# is no way to scroll. +# +# Note that there is a floppy for free from Tek that makes the +# 4112 emulate the vt52 (use the vt52 termcap). There is also +# an expected enhancement that will use ANSI standard sequences. +# +# 4112 in non-dialog area pretending to scroll. It really wraps +# but vi is said to work (more or less) in this mode. +# +# 'vi' works reasonably well with this entry. +# +otek4112|o4112-nd|otek4113|otek4114|old tektronix 4110 series, + am, + cols#80, lines#34, + bel=^G, clear=\E^L, cr=^M, cub1=^H, cud1=^J, cuu1=^K, ind=^J, + rmcup=\EKA1\ELV1, smcup=\EKA0\ELV0\EMG0, +# The 4112 with the ANSI compatibility enhancement +tek4112|tek4114|tektronix 4110 series, + OTbs, am, db, + cols#80, lines#34, + cbt=\E[Z, clear=\E[2J\E[0;0H, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\EM, dch1=\E[P, + dl1=\E[M, ed=\E[0J, el=\E[0K, ich1=\E[@, il1=\E[L, + ind=\E7\E[0;0H\E[M\E8, is2=\E3!1, ri=\E7\E[0;0H\E[L\E8, + rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, smul=\E[4m, +tek4112-nd|4112 not in dialog area, + OTns, + cuu1=^K, use=tek4112, +tek4112-5|4112 in 5 line dialog area, + lines#5, use=tek4112, +# (tek4113: this used to have "", someone's mistake; +# removed ", ", which had been commented out in 8.3. +# Note, the !0 and !1 sequences in /// were +# previously \0410 and \0411 sequences...I don't *think* they were supposed +# to be 4-digit octal -- esr) +tek4113|tektronix 4113 color graphics with 5 line dialog area, + OTbs, am, da, eo, + cols#80, lines#5, + clear=\ELZ, cub1=^H, cud1=^J, cuf1=\ELM1 \ELM0, + flash=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4 + \ERBA4\ERBA4\ERB0, + is2=\EKA1\ELL5\ELV0\ELV1, uc=\010\ELM1_\ELM0, +tek4113-34|tektronix 4113 color graphics with 34 line dialog area, + lines#34, + is2=\EKA1\ELLB2\ELV0\ELV1, use=tek4113, +# :ns: left off to allow vi visual mode. APL font (:as=\E^N:/:ae=\E^O:) not +# supported here. :uc: is slow, but looks nice. Suggest setenv MORE -up . +# :vb: needs enough delay to let you see the background color being toggled. +tek4113-nd|tektronix 4113 color graphics with no dialog area, + OTbs, am, eo, + cols#80, it#8, lines#34, + clear=\E^L, cub1=^H, cud1=^J, cuf1=^I, cuu1=^K, + cvvis=\ELZ\EKA0, + flash=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4 + \ERBA4\ERBA4\ERB0, + home=\ELF7l\177 @, ht=^I, is2=\ELZ\EKA0\ELF7l\177 @, + ll=\ELF hl @, rmso=\EMT1, smso=\EMT2, uc=\010\EMG1_\EMG0, +# This entry is from Tek. Inc. (Brian Biehl) +# (tek4115: :bc: renamed to :le:, / added based on init string -- esr) +otek4115|Tektronix 4115, + OTbs, am, da, db, eo, + cols#80, it#8, lines#34, + cbt=\E[Z, clear=\E[H\E[2J, + cnorm=\E%!0\ELBG8\E%!1\E[34;1H, cub1=\E[D, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + cvvis=\E%!0\ELBB2\E%!1, dch1=\E[P, dl1=\E[M, ed=\E[J, + el=\E[K, home=\E[H, ht=^I, if=/usr/share/tabset/vt100, + il1=\E[L, + is2=\E%!0\E%\014\ELV0\EKA1\ELBB2\ENU@=\ELLB2\ELM0\ELV1\EKYA? + \E%!1\E[<1l\E[?7h\E[?8h\E[34;1H\E[34B\E[m, + kbs=^H, ri=\EM, rmam=\E[?7l, + rmcup=\E%!0\ELBG8\E%!1\E[34;1H\E[J, rmir=\E[4l, + rmkx=\E>, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smam=\E[?7h, + smcup=\E%!0\ELBB2\E%!1, smir=\E[4h, smkx=\E=, smso=\E[7m, + smul=\E[4m, +tek4115|newer tektronix 4115 entry with more ANSI capabilities, + am, xon, + cols#80, lines#34, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, + cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, hpa=\E[%p1%{1}%+%dG, + ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, invis=\E[8m, kbs=^H, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, + rep=%p1%c\E[%p2%{1}%-%db, rev=\E[7m, rmam=\E[?7l, + rmso=\E[m, rmul=\E[m, + sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1; + %;%?%p7%t8;%;m, + sgr0=\E[m, smam=\E[?7h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + vpa=\E[%p1%{1}%+%dd, +# The tek4125 emulates a vt100 incorrectly - the scrolling region +# command is ignored. The following entry replaces with the needed +# , , and ; removes some cursor pad commands that the tek4125 +# chokes on; and adds a lot of initialization for the tek dialog area. +# Note that this entry uses all 34 lines and sets the cursor color to green. +# Steve Jacobson 8/85 +# (tek4125: there were two "\!"s in the is that I replaced with "\E!"; +# commented out, =\E1 because there's no -- esr) +tek4125|tektronix 4125, + lines#34, + csr@, dl1=\E[1M, il1=\E[1L, + is2=\E%\E!0\EQD1\EUX03\EKA\ELBB2\ELCE0\ELI100\ELJ2\ELLB2 + \ELM0\ELS1\ELX00\ELV1\E%\E!1\E>\E[?3l\E[?4l\E[?5l\E[?7h + \E[?8h, + rc@, sc@, smkx=\E=, use=vt100, + +# From: +# (tek4207: This was the termcap file's entry for the 4107/4207, but SCO +# supplied another, less capable 4107 entry. So we'll use that for 4107 and +# note that if jcoker wasn't confused you may be able to use this one. +# I merged in ,,,, from a BRL entry -- esr) +tek4207|Tektronix 4207 graphics terminal with memory, + am, bw, mir, msgr, ul, xenl, + cols#80, it#8, lines#32, + blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J$<156/>, + cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\EM, dch1=\E[P$<4/>, dl1=\E[M$<3/>, ed=\E[J, + el=\E[K$<5/>, home=\E[H, ht=^I, ich1=\E[@$<4/>, + il1=\E[L$<3/>, ind=\E[S, invis=\E[=6;<5, + is2=\E%!0\ELBP0\E%!1\E[H\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8 + C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J, + kcub1=\E[D, kcud1=\ED, kcuf1=\E[C, kcuu1=\EM, khome=\E[H, + rev=\E[7m, ri=\E[T, + rmcup=\E[?6h\E%!0\ELBP0\E%!1\E[32;1f, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smcup=\E[?6l\E[H\E[J, smso=\E[7m, + smul=\E[4m, tbc=\E[1g, + +# From: Thu Oct 31 12:54:27 1985 +# (tek4404: There was a "\!" in that I replaced with "\E!". +# Tab had been given as \E2I,that must be the tab-set capability -- esr) +tek4404|tektronix 4404, + OTbs, + cols#80, it#8, lines#32, + blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[1M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\E[2I, il1=\E[1L, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, rc=\E8, + rmcup=\E[1;1H\E[0J\E[?6h\E[?1l, rmir=\E[4l, + rmkx=\E[?1h, rmso=\E[27m, rmul=\E[m, sc=\E7, sgr0=\E[m, + smcup=\E%\E!1\E[1;32r\E[?6l\E>, smir=\E[4h, + smkx=\E[?1l, smso=\E[7m, smul=\E[4m, +# Some unknown person wrote: +# I added the is string - straight Unix has ESC ; in the login +# string which sets a ct8500 into monitor mode (aka 4025 snoopy +# mode). The is string here cleans up a few things (but not +# everything). +ct8500|tektronix ct8500, + am, bw, da, db, + cols#80, lines#25, + bel=^G, cbt=\E^I, clear=\E^E, cr=^M, cub1=^H, cud1=^J, + cuf1=\ES, cup=\E|%p1%{32}%+%c%p2%{32}%+%c, cuu1=\ER, + dch1=\E^], dl1=\E^M, ed=\E^U, el=\E^T, ht=^I, ich1=\E^\, + il1=\E^L, ind=^J, is2=\037\EZ\Ek, ri=\E^A, rmso=\E\s, + rmul=\E\s, sgr0=\E\s, smso=\E$, smul=\E!, + +# Tektronix 4205 terminal. +# +# am is not defined because the wrap around occurs not when the char. +# is placed in the 80'th column, but when we are attempting to type +# the 81'st character on the line. (esr: hmm, this is like the vt100 +# version of xenl, perhaps am + xenl would work!) +# +# Bold, dim, and standout are simulated by colors and thus not allowed +# with colors. The tektronix color table is mapped into the RGB color +# table by setf/setb. All colors are reset to factory specifications by oc. +# The cap uses RGB notation to define colors. for arguments 1-3 the +# interval (0-1000) is broken into 8 smaller sub-intervals (125). Each sub- +# interval then maps into pre-defined value. +tek4205|tektronix 4205, + ccc, mir, msgr, + colors#8, cols#80, it#8, lines#30, ncv#49, pairs#63, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[=7;<4m, cbt=\E[Z, + clear=\E[2J\E[H, cr=^M, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch1=\E[1P, dim=\E[=1;<6m, dl=\E[%p1%dM, dl1=\E[1M, + ech=\E%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E)0, + home=\E[H, ht=^I, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[1L, + ind=\ED, + initc=\E%%!0\ETF4%?%p1%{0}%=%t0%e%p1%{1}%=%t4%e%p1%{2}%=%t3 + %e%p1%{3}%=%t5%e%p1%{4}%=%t2%e%p1%{5}%=%t6%e%p1%{6}%= + %t7%e1%;%?%p2%{125}%<%t0%e%p2%{250}%<%tA2%e%p2%{375}%< + %tA?%e%p2%{500}%<%tC8%e%p2%{625}%<%tD4%e%p2%{750}%<%tE + 1%e%p2%{875}%<%tE\:%eF4%;%?%p3%{125}%<%t0%e%p3%{250}%< + %tA2%e%p3%{375}%<%tA?%e%p3%{500}%<%tC8%e%p3%{625}%<%tD + 4%e%p3%{750}%<%tE1%e%p3%{875}%<%tE\:%eF4%;%?%p4%{125} + %<%t0%e%p4%{250}%<%tA2%e%p4%{375}%<%tA?%e%p4%{500}%<%t + C8%e%p4%{625}%<%tD4%e%p4%{750}%<%tE1%e%p4%{875}%<%tE\: + %eF4%;\E%%!1, + invis=\E[=6;<5, is1=\E%!0\ETM1\E%!1\E[m, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\EOA, + kf1=\EOB, kf2=\EOC, kf3=\EOD, kf4=\EP, kf5=\EQ, kf6=\ER, + kf7=\ES, + oc=\E%!0\ETFB000001F4F4F42F40030F404A4C because of a bug in old vi (if stty says you have +# a "newline" style terminal (-crmode) vi figures all it needs is nl +# to get crlf, even if is not ^M.) +# (tty40: removed obsolete ":nl=\EG\EB:", it's just do+cr -- esr) +tty40|ds40|ds40-2|dataspeed40|teletype dataspeed 40/2, + OTbs, xon, + cols#80, lines#24, + clear=\EH$<20>\EJ$<80>, cr=\EG, cub1=^H, cud1=\EB, + cuf1=\EC, cuu1=\E7, dch1=\EP$<50>, dl1=\EM$<50>, + ed=\EJ$<75>, home=\EH$<10>, ht=\E@$<10>, hts=\E1, + ich1=\E\^$<50>, il1=\EL$<50>, ind=\ES$<20>, kbs=^], + kcub1=^H, mc4=^T, mc5=\022$<2000>, ri=\ET$<10>, rmso=\E4, + rs2=\023\ER$<60>, smso=\E3, tbc=\EH\E2$<80>, +tty43|model 43 teletype, + OTbs, am, hc, os, xon, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, kbs=^H, + +#### Tymshare +# + +# You can add to put this 40-column mode, though I can't +# for the life of me think why anyone would want to. +scanset|sc410|sc415|Tymshare Scan Set, + am, bw, msgr, + cols#80, lines#24, + acsc=j%k4l, sc=^B, smacs=^N, + +#### Volker-Craig (vc) +# +# If you saw a Byte Magazine cover with a terminal on it during the early +# 1980s, it was probably one of these. Carl Helmers liked them because +# they could crank 19.2 and were cheap (that is, he liked them until he tried +# to program one...) +# + +# Missing in vc303a and vc303 descriptions: they scroll 2 lines at a time +# every other linefeed. +vc303|vc103|vc203|volker-craig 303, + OTbs, OTns, am, + cols#80, lines#24, + bel=^G, clear=\014$<40>, cr=^M, cub1=^H, cud1=^J, cuf1=^I, + cuu1=^N, home=\013$<40>, kcub1=^H, kcud1=^J, kcuf1=^I, + kcuu1=^N, ll=\017$<1>W, +vc303a|vc403a|volker-craig 303a, + clear=\030$<40>, cuf1=^U, cuu1=^Z, el=\026$<20>, + home=\031$<40>, kcuf1=^U, kcuu1=^Z, ll=^P, use=vc303, +# (vc404: removed obsolete ":ma=^Z^P^U :" -- esr) +vc404|volker-craig 404, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\030$<40>, cr=^M, cub1=^H, cud1=^J, cuf1=^U, + cup=\020%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, + ed=\027$<40>, el=\026$<20>, home=\031$<40>, ind=^J, + kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^Z, +vc404-s|volker-craig 404 w/standout mode, + cud1=^J, rmso=^O, smso=^N, use=vc404, +# From: +# (vc414: merged in cup/dl1/home from an old vc414h-noxon) +vc414|vc414h|Volker-Craig 414H in sane escape mode., + OTbs, am, + cols#80, lines#24, + clear=\E\034$<40>, cud1=\E^K, cuf1=^P, + cup=\E\021%p2%c%p1%c$<40>, cuu1=\E^L, dch1=\E3, + dl1=\E\023$<40>, ed=\E^X, el=\E\017$<10/>, home=\E^R, + ich1=\E\:, il1=\E\032$<40>, kcub1=^H, kcud1=\E^K, kcuf1=^P, + kcuu1=\E^L, kf0=\EA, kf1=\EB, kf2=\EC, kf3=\ED, kf4=\EE, + kf5=\EF, kf6=\EG, kf7=\EH, khome=\E^R, lf0=PF1, lf1=PF2, + lf2=PF3, lf3=PF4, lf4=PF5, lf5=PF6, lf6=PF7, lf7=PF8, + rmso=\E^_, smso=\E^Y, +vc415|volker-craig 415, + clear=^L, use=vc404, + +######## OBSOLETE PERSONAL-MICRO CONSOLES AND EMULATIONS +# + +#### IBM PC and clones +# + +# The pcplot IBM-PC terminal emulation program is really messed up. It is +# supposed to emulate a vt-100, but emulates the wraparound bug incorrectly, +# doesn't support scrolling regions, ignores add line commands, and ignores +# delete line commands. Consequently, the resulting behavior looks like a +# crude adm3a-type terminal. +# Steve Jacobson 8/85 +pcplot|pc-plot terminal emulation program, + xenl@, + csr@, dl@, dl1@, il@, il1@, rc@, sc@, use=vt100, +# KayPro II from Richard G Turner +# I've found that my KayPro II, running MDM730, continues to emulate an +# ADM-3A terminal, just like I was running TERM.COM. On our 4.2 UNIX +# system the following termcap entry works well: +# I have noticed a couple of minor glitches, but nothing I can't work +# around. (I added two capabilities from the BRL entry -- esr) +kaypro|kaypro2|kaypro II, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\032$<1/>, cr=^M, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dl1=\ER, ed=^W, + el=^X, home=^^, il1=\EE, ind=^J, kcud1=^J, kcuf1=^L, kcuu1=^K, + +# From IBM, Thu May 5 19:35:27 1983 +# (ibmpc: commented out =\200R because we don't know -- esr) +ibm-pc|ibm5051|5051|IBM Personal Computer (no ANSI.SYS), + OTbs, am, + cols#80, lines#24, + bel=^G, clear=^L^K, cr=^M^^, cub1=^], cud1=^J, cuf1=^\, + cuu1=^^, home=^K, ind=\n$<10>, kcud1=^_, + +ibmpc|wy60-PC|wyse60-PC|IBM PC/XT running PC/IX, + OTbs, am, bw, eo, hs, km, msgr, ul, + cols#80, it#8, lines#24, + acsc=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x + \263, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\Ec, cr=^M, + cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + home=\E[H, hpa=\E[%i%p1%dG, ind=\E[S\E[B, + indn=\E[%p1%dS\E[%p1%dB, invis=\E[30;40m, kbs=^H, + kcbt=^], kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\177, kend=\E[Y, kf1=\240, kf10=\251, kf2=\241, + kf3=\242, kf4=\243, kf5=\244, kf6=\245, kf7=\246, kf8=\247, + kf9=\250, khome=\E[H, kich1=\E[^H, knp=\E[U, kpp=\E[V, + ll=\E[24;1H, nel=^M, rev=\E[7m, ri=\E[T\E[A, + rin=\E[%p1%dT\E[%p1%dA, rmso=\E[m, rmul=\E[m, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + %;%?%p7%t30;40%;m, + sgr0=\E[m, smso=\E[7m, smul=\E[4m, + +#### Apple II +# +# Apple II firmware console first, then various 80-column cards and +# terminal emulators. For two cents I'd toss all these in the UFO file +# along with the 40-column apple entries. +# + +# From: brsmith@umn-cs.cs.umn.edu (Brian R. Smith) via BRL +# 'it#8' tells UNIX that you have tabs every 8 columns. This is a +# function of TIC, not the firmware. +# The clear key on a IIgs will do something like clear-screen, +# depending on what you're in. +appleIIgs|appleIIe|appleIIc|Apple 80 column firmware interface, + OTbs, am, bw, eo, msgr, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, ht=^I, ind=^W, kbs=^H, kclr=^X, kcub1=^H, kcud1=^J, + kcuf1=^U, kcuu1=^K, kdch1=\177, nel=^M^W, ri=^V, rmso=^N, + smso=^O, +# Apple //e with 80-column card, entry from BRL +# The modem interface is permitted to discard LF (maybe DC1), otherwise +# passing characters to the 80-column firmware via COUT (PR#3 assumed). +# Auto-wrap does not work right due to newline scrolling delay, which also +# requires that you set "stty cr2". +# Note: Cursor addressing is only available via the Pascal V1.1 entry, +# not via the BASIC PR#3 hook. All this nonsense can be avoided only by +# using a terminal emulation program instead of the built-in firmware. +apple2e|Apple //e, + bw, msgr, + cols#80, lines#24, + bel=^G, clear=\014$<100/>, cub1=^H, cud1=^J, cuu1=^_, + ed=\013$<4*/>, el=\035$<4/>, home=^Y, ht=^I, ind=^W, + is2=^R^N, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^U, kcuu1=^K, + nel=\r$<100/>, rev=^O, ri=^V, rmso=^N, rs1=^R^N, sgr0=^N, + smso=^O, +# mcvax!vu44!vu45!wilcke uses the "ap" entry together with Ascii Express Pro +# 4.20, with incoming and outgoing terminals both on 0, emulation On. +apple2e-p|Apple //e via Pascal, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, kbs=^H, kcub1=^H, + kcud1=^J, use=apple2e, +# (ASCII Express) MouseTalk "Standard Apple //" emulation from BRL +# Enable DC3/DC1 flow control with "stty ixon -ixany". +apple-ae|ASCII Express, + OTbs, am, bw, msgr, nxon, xon, + cols#80, it#8, lines#24, + bel=\007$<500/>, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^U, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, ind=^W, is2=^R^N, kclr=^X, kcub1=^H, kcud1=^J, + kcuf1=^U, kcuu1=^K, rev=^O, ri=^V, rmso=^N, rs1=^R^N, sgr0=^N, + smso=^O, +appleII|apple ii plus, + OTbs, am, + cols#80, it#8, lines#24, + clear=^L, cnorm=^TC2, cub1=^H, cud1=^J, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, cvvis=^TC6, + ed=^K, el=^], flash=\024G1$<200/>\024T1, home=\E^Y, ht=^I, + is2=\024T1\016, kcud1=^J, kcuf1=^U, rmso=^N, sgr0=^N, + smso=^O, +# Originally by Gary Ford 21NOV83 +# From: Fri Oct 11 21:27:00 1985 +apple-80|apple II with smarterm 80 col, + OTbs, am, bw, + cols#80, lines#24, + cbt=^R, clear=\014$<10*/>, cr=\r$<10*/>, cub1=^H, cud1=^J, + cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, + ed=\013$<10*/>, el=\035$<10/>, home=^Y, +apple-soroc|apple emulating soroc 120, + am, + cols#80, lines#24, + bel=^G, clear=\E*$<300>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EY, el=\ET, + home=^^, ind=^J, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, +# From Peter Harrison, Computer Graphics Lab, San Francisco +# ucbvax!ucsfmis!harrison .....uucp +# ucbvax!ucsfmis!harrison@BERKELEY .......ARPA +# "These two work. If you don't have the inverse video chip for the +# Apple with videx then remove the :so: and :se: fields." +# (apple-videx: this used to be called DaleApple -- esr) +apple-videx|Apple with videx videoterm 80 column board with inverse video, + OTbs, am, xenl, + cols#80, it#8, lines#24, + clear=\014$<300/>, cub1=^H, cud1=^J, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, ht=^I, kcub1=^H, kcud1=^J, kcuf1=^U, khome=^Y, + rmso=^Z2, sgr0=^Z2, smso=^Z3, +# My system [for reference] : Apple ][+, 64K, Ultraterm display card, +# Apple Cat ][ 212 modem, + more all +# controlled by ASCII Express: Pro. +# From Dave Shaver +apple-uterm-vb|Videx Ultraterm for Apple micros with Visible Bell, + OTbs, am, eo, xt, + cols#80, lines#24, + acsc=, clear=^L, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + flash=^W35^W06, home=^Y, + is2=^V4^W06\017\rVisible Bell Installed.\016\r\n, + rmso=^N, smso=^O, +apple-uterm|Ultraterm for Apple micros, + OTbs, am, eo, xt, + cols#80, lines#24, + acsc=, clear=^L, cuf1=^\, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, is2=^V4^W06\016, rmso=^N, smso=^O, +# from trwrba!bwong (Bradley W. Wong): +# +# This entry assumes that you are using an apple with the UCSD Pascal +# language card. SYSTEM.MISCINFO is assumed to be the same as that +# supplied with the standard apple except that screenwidth should be set +# using SETUP to 80 columns. Note that the right arrow is not mapped in +# this termcap entry. This is because that key, on the Apple, transmits +# a ^U and would thus preempt the more useful "up" function of vi. +# +# HMH 2/23/81 +apple80p|80-column apple with Pascal card, + am, bw, + cols#80, lines#24, + clear=^Y^L, cuf1=^\\:, + cup=\036%p2%{32}%+%c%p1%{32}%+%c, cuu1=^_, ed=^K, el=^], + home=^Y, kcub1=^H, +# +# Apple II+ equipped with Videx 80 column card +# +# Terminfo from ihnp4!ihu1g!djc1 (Dave Christensen) via BRL; +# manually converted by D A Gwyn +# +# DO NOT use any terminal emulation with this data base, it works directly +# with the Videx card. This has been tested with vi 1200 baud and works fine. +# +# This works great for vi, except I've noticed in pre-R2, ^U will scroll back +# 1 screen, while in R2 ^U doesn't. +# For inverse alternate character set add: +# =^O:=^N: +# (apple-v: added it#8 -- esr) +apple-videx2|Apple II+ w/ Videx card (similar to Datamedia h1520), + am, xenl, + cols#80, it#8, lines#24, + bel=\007$<100/>, clear=\014$<16*/>, cr=^M, cub1=^H, + cud1=^J, cuf1=^\, cup=\036%p2%{32}%+%c%p1%{32}%+%c, + cuu1=^_, ed=\013$<16*/>, el=^], home=^Y, ht=\011$<8/>, + ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^\, kcuu1=^_, + khome=^Y, rmso=^Z2, smso=^Z3, +apple-videx3|vapple|Apple II with 80 col card, + OTbs, am, + cols#80, lines#24, + clear=\Ev, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, el=\Ex, + home=\EH, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kf0=\EP, kf1=\EQ, kf2=\ER, kf3=\E\s, kf4=\E!, kf5=\E", kf6=\E#, + kf7=\E$, kf8=\E%%, kf9=\E&, khome=\EH, +#From: decvax!cbosgd!cbdkc1!mww Mike Warren via BRL +aepro|Apple II+ running ASCII Express Pro--vt52, + OTbs, + cols#80, lines#24, + clear=\014$<300/>, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, home=\EH, +# UCSD addition: Yet another termcap from Brian Kantor's Micro Munger Factory +apple-vm80|ap-vm80|apple with viewmax-80, + OTbs, + cols#80, lines#24, + clear=\014$<300/>, cuf1=^\\:, + cup=\036%p1%{32}%+%c%p2%{32}%+%c$<100/>, cuu1=^_, + ed=\013$<300/>, el=^], home=\031$<200/>, + +#### Apple Lisa & Macintosh +# + +# (lisa: changed to -- esr) +lisa|apple lisa console display (black on white), + OTbs, am, eo, msgr, + cols#88, it#8, lines#32, + acsc=jdkclfmenbqattuvvuwsx`, civis=\E[5h, clear=^L, + cnorm=\E[5l, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, il1=\E[L, + is2=\E>\E[m\014, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smacs=\E[11m, smso=\E[7m, smul=\E[4m, +liswb|apple lisa console display (white on black), + is2=\E>\E[0;7m\014, rmso=\E[0;7m, rmul=\E[0;7m, + smso=\E[m, smul=\E[4m, use=lisa, + +# lisaterm from ulysses!gamma!epsilon!mb2c!jed (John E. Duncan III) via BRL; +# revised by Ferd Brundick +# +# These entries assume that the 'Auto Wraparound' is enabled. +# Xon-Xoff flow control should also be enabled. +# +# The vt100 uses :rs2: and :rf: rather than :is2:/:tbc:/:hts: because the tab +# settings are in non-volatile memory and don't need to be reset upon login. +# Also setting the number of columns glitches the screen annoyingly. +# You can type "reset" to get them set. +# +lisaterm|Apple Lisa or Lisa/2 running LisaTerm vt100 emulation, + OTbs, OTpt, am, xenl, xon, + OTkn#4, cols#80, it#8, lines#24, vt#3, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, ed=\E[J, + el=\E[K, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOP, kf1=\EOQ, + kf2=\EOR, kf3=\EOS, lf0=F1, lf1=F2, lf2=F3, lf3=F4, rc=\E8, + rev=\E[7m, ri=\EM, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs1=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r, + sc=\E7, sgr0=\E[m, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, +# Lisaterm in 132 column ("wide") mode. +lisaterm-w|Apple Lisa with Lisaterm in 132 column mode, + cols#132, + kbs=^H, kcub1=^H, kcud1=^J, use=lisaterm, +# Although MacTerminal has insert/delete line, it is commented out here +# since it is much faster and cleaner to use the "lock scrolling region" +# method of inserting and deleting lines due to the MacTerminal implementation. +# Also, the "Insert/delete ch" strings have an extra character appended to them +# due to a bug in MacTerminal V1.1. Blink is disabled since it is not +# supported by MacTerminal. +mac|macintosh|Macintosh with MacTerminal, + xenl, + OTdN#30, + blink@, dch1=\E[P$<7/>, ich1=\E[@$<9/>, ip=$<7/>, use=lisa, +# Lisaterm in 132 column ("wide") mode. +mac-w|macterminal-w|Apple Macintosh with Macterminal in 132 column mode, + cols#132, use=mac, + +#### Radio Shack/Tandy +# + +# (coco3: This had "ta" used incorrectly as a boolean and bl given as "bl#7". +# I read these as mistakes for ":it#8:" and ":bl=\007:" respectively -- esr) +# From: <{pbrown,ctl}@ocf.berkeley.edu> 12 Mar 90 +coco3|os9LII|Tandy CoCo3 24*80 OS9 Level II, + OTbs, am, + cols#80, it#8, lines#24, + bel=^G, blink=^_", bold=\E\:^A, civis=^E\s, + clear=\014$<5*/>, cnorm=^E!, cub1=^H, cud1=^J, cuf1=^F, + cup=\002%p2%{32}%+%c%p1%{32}%+%c$<2/>, cuu1=^I, + dl1=^_1, ed=^K, el=^D, home=^A, il1=^_0, kcub1=^H, kcud1=^J, + kcuf1=^I, kcuu1=^L, rev=^_\s, rmso=^_!, rmul=^_#, + sgr0=\037!\E\:\0, smso=^_\s, smul=^_", +# (trs2: removed obsolete ":nl=^_:" -- esr) +trs2|trsII|trs80II|Radio Shack Model II using P&T CP/M, + OTbs, am, msgr, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^_, cuf1=^], + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^^, dl1=^K, ed=^B, + el=^A, home=^F, ht=^I, il1=^D, ind=^J, kbs=^H, kcub1=^\, + kcud1=^_, kcuf1=^], kcuu1=^^, rmso=^O, sgr0=^O, smso=^N, +# From: Kevin Braunsdorf +# (This had extension capabilities +# :BN=\E[?33h:BF=\E[?33l:UC=\E[_ q:BC=\E[\177 q:\ +# :CN=\ERC:CF=\ERc:NR=\ERD:NM=\ER@: +# I also deleted the unnecessary ":kn#2:", ":sg#0:" -- esr) +trs16|trs-80 model 16 console, + OTbs, am, + cols#80, it#8, lines#24, + acsc=jak`l_mbquvewcxs, bel=^G, civis=\ERc, clear=^L, + cnorm=\ERC, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, + dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\EP, il1=\EL, + ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + kf0=^A, kf1=^B, kf2=^D, kf3=^L, kf4=^U, kf5=^P, kf6=^N, kf7=^S, + khome=^W, lf0=f1, lf1=f2, lf2=f3, lf3=f4, lf4=f5, lf5=f6, lf6=f7, + lf7=f8, mc4=\E]+, mc5=\E]=, rmacs=\ERg, rmso=\ER@, sgr0=\ER@, + smacs=\ERG, smso=\ERD, + +#### Commodore Business Machines +# +# Formerly located in West Chester, PA; went spectacularly bust in 1994 +# after years of shaky engineering and egregious mismanagement. Made one +# really nice machine (the Amiga) and boatloads of nasty ones (PET, C-64, +# C-128, VIC-20). The C-64 is said to have been the most popular machine +# ever (most units sold); they can still be found gathering dust in closets +# everywhere. +# + +# From: Kent Polk , 30 May 90 +# Added a few more entries, converted caret-type control sequence (^x) entries +# to '\0xx' entries since a couple of people mentioned losing '^x' sequences. +# Corrections by Ty Sarna , Sat Feb 28 18:55:15 1998 +# +# :as:, :ae: Support for alternate character sets. +# :ve=\E[\040p:vi=\E[\060\040p: cursor visible/invisible. +# :xn: vt100 kludginess at column 80/NEWLINE ignore after 80 cols(Concept) +# This one appears to fix a problem I always had with a line ending +# at 'width+1' (I think) followed by a blank line in vi. The blank +# line tended to disappear and reappear depending on how the screen +# was refreshed. Note that this is probably needed only if you use +# something like a Dnet Fterm with the window sized to some peculiar +# dimension larger than 80 columns. +# :k0=\E9~: map F10 to k0 - could have F0-9 -> k0-9, but ... F10 was 'k;' +# (amiga: removed obsolete :kn#10:, +# also added empty to suppress a warning --esr) +amiga|Amiga ANSI, + OTbs, am, bw, xenl, + cols#80, lines#24, + acsc=, bel=^G, blink=\E[7;2m, bold=\E[1m, cbt=\E[Z, + civis=\E[0 p, clear=\E[H\E[J, cnorm=\E[ p, cub=\E[%p1%dD, + cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, invis=\E[8m, is2=\E[20l, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf0=\E[9~, + kf1=\E[0~, kf2=\E[1~, kf3=\E[2~, kf4=\E[3~, kf5=\E[4~, + kf6=\E[5~, kf7=\E[6~, kf8=\E[7~, kf9=\E[8~, rev=\E[7m, + ri=\E[T, rin=\E[%p1%dT, rmacs=^O, rmso=\E[m, rmul=\E[m, + rs1=\Ec, sgr0=\E[m, smacs=^N, smso=\E[7m, smul=\E[4m, + +# From: Hans Verkuil , 4 Dec 1995 +# (amiga: added empty to suppress a warning. +# I'm told this entry screws up badly with AS225, the Amiga +# TCP/IP package once from Commodore, and now sold by InterWorks.--esr) +amiga-h|Hans Verkuil's Amiga ANSI, + OTbs, bw, msgr, + cols#80, lines#24, + acsc=, bel=^G, blink=\2337;2m, bold=\2331m, cbt=\233Z, + civis=\2330 p, clear=\233H\233J, cnorm=\233 p, cr=^M, + cub=\233%p1%dD, cub1=\233D, cud=\233%p1%dB, cud1=\233B, + cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH, + cuu=\233%p1%dA, cuu1=\233A, dch=\233%p1%dP, dch1=\233P, + dim=\2332m, ech=\233%p1%dP, ed=\233J, el=\233K, flash=^G, + home=\233H, ht=^I, ich=\233%p1%d@, ich1=\233@, ind=\233S, + indn=\233%p1%dS, invis=\2338m, is2=\23320l, kbs=^H, + kcub1=\233D, kcud1=\233B, kcuf1=\233C, kcuu1=\233A, + kdch1=\177, kf0=\2339~, kf1=\2330~, kf2=\2331~, kf3=\2332~, + kf4=\2333~, kf5=\2334~, kf6=\2335~, kf7=\2336~, kf8=\2337~, + kf9=\2338~, nel=\233B\r, rev=\2337m, ri=\233T, + rin=\233%p1%dT, rmacs=^O, rmcup=\233?7h, rmso=\2330m, + rmul=\2330m, rs1=\Ec, sgr0=\2330m, smacs=^N, smcup=\233?7l, + smso=\2337m, smul=\2334m, + +# From: Henning 'Faroul' Peters , 25 Sep 1999 +# +# Pavel Fedin added +# Home Shift+Left +# End Shift+Right +# PgUp Shift+Up +# PgDn Shift+Down +amiga-8bit|Amiga ANSI using 8-bit controls, + acsc=, dl=\233%p1%dM, dl1=\233M, il=\233%p1%dL, il1=\233L, + ind=\204, indn@, kend=\233 @, khome=\233 A, knp=\233S, + kpp=\233T, ri=\215, rin@, use=amiga-h, + +# From: Ruediger Kuhlmann , 18 Jul 2000 +# requires use of appropriate preferences settings. +amiga-vnc|Amiga using VNC console (black on light gray), + am, da, db, msgr, ndscr, + btns#1, colors#16, cols#80, lines#24, lm#0, ncv#0, pairs#256, + bel=^G, blink=\E[7;2m, bold=\E[1m, civis=\E[0p, + clear=\E[H\E[J, cnorm=\E[p\E[>?6l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\E[>?6h, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[1M, ed=\E[J, el=\E[K, flash=^G, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[1L, ind=\ED, + indn=\E[%p1%dS, invis=\E8m, + is2=\E[>?2;18l\E[>?26;?6;20;>?15;?7;>?22;>?8h, + kbs=^H, kcbt=\233Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\177, kf0=\E[9~, kf1=\E[0~, kf2=\E[1~, + kf3=\E[2~, kf4=\E[3~, kf5=\E[4~, kf6=\E[5~, kf7=\E[6~, + kf8=\E[7~, kf9=\E[8~, khlp=\E[?~, khome=\E[44~, kll=\E[45~, + kmous=\E[M, knp=\E[42~, kpp=\E[41~, nel=\EE, oc=\E[0m, + rev=\E[7m, ri=\EM, rin=\E[%p1%dT, rmcup=\E[?7h\E[r\E[J, + rmkx=\E[?1l, rmso=\E[21m, rmul=\E[24m, rs1=\Ec, + rs2=\E[>?2;18l\E[>?26;?6;20;>?15;?7;>?22;>?8h, + setab=\E[%?%p1%{8}%>%t%'F'%p1%+%d%e4%p1%d%;m, + setaf=\E[%?%p1%{8}%>%t%'2'%p1%+%d%e3%p1%d%;m, + sgr0=\E[0m\017\E[30;85;>15m, smcup=\E[?7h, smkx=\E[?1h, + smso=\E[1m, smul=\E[4m, + +# MorphOS on Genesi Pegasos +# By Pavel Fedin +morphos, + acsc=, dl=\233%p1%dM, dl1=\233M, il=\233%p1%dL, il1=\233L, + ind=\204, indn@, kend=\23345~, kf11=\23320~, kf12=\23321~, + khome=\23344~, kich1=\23340~, knp=\23342~, kpp=\23341~, + ri=\215, rin@, use=amiga-h, + +# Commodore B-128 microcomputer from Doug Tyrol +# I'm trying to write a termcap for a commodore b-128, and I'm +# having a little trouble. I've had to map most of my control characters +# to something that unix will accept (my delete-char is a ctrl-t, etc), +# and create some functions (like cm), but thats life. +# The problem is with the arrow keys - right, and up work fine, but +# left deletes the previous character and down I just can't figure out. +# Jove knows what I want, but I don't know what it's sending to me (it +# isn't thats bound to next-line in jove). +# Anybody got any ideas? Here's my termcap. +# DAG -- I changed his "^n" entries to "\n"; see if that works. +# +commodore|b-128|Commodore B-128 micro, + am, bw, + OTdN#20, cols#80, lines#24, pb#150, + OTbc=^H, OTnl=^M, clear=\E\006$<10/>, cr=^M, cud1=^J, + cuf1=^F, cup=\E\013%p1%2d\,%p2%2d\,$<20/>, cuu1=^P, + dch1=\177$<10*/>, dl1=\Ed$<10*/>, el=\Eq$<10/>, + home=\E^E, ht=\011$<5/>, ich1=\E\n$<5/>, il1=\Ei$<10/>, + kcub1=^B, kcud1=^J, kcuf1=^F, kcuu1=^P, khome=\E^E, rmir=, + smir=, + +#### North Star +# +# North Star Advantage from Lt. Fickie via BRL +northstar|North Star Advantage, + OTbs, + cols#80, lines#24, + clear=\004$<200/>, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<1/>, ed=\017$<200/>, + el=\016$<200/>, home=\034\032$<200/>, + +#### Osborne +# +# Thu Jul 7 03:55:16 1983 +# +# As an aside, be careful; it may sound like an anomaly on the +# Osborne, but with the 80-column upgrade, it's too easy to +# enter lines >80 columns! +# +# I've already had several comments... +# The Osborne-1 with the 80-col option is capable of being +# 52, 80, or 104 characters wide; default to 80 for compatibility +# with most systems. +# +# The tab is destructive on the Ozzie; make sure to 'stty -tabs'. +osborne-w|osborne1-w|osborne I in 104-column mode, + msgr, ul, xt, + cols#104, lines#24, + bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, el=\ET, ich1=\EQ, il1=\EE, ind=^J, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, rmso=\E(, rmul=\Em, smso=\E), smul=\El, +# Osborne I from ptsfa!rhc (Robert Cohen) via BRL +osborne|osborne1|osborne I in 80-column mode, + OTbs, am, mir, msgr, ul, xhp, + OTdB#4, cols#80, lines#24, + clear=^Z, cub1=\010$<4>, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, + dch1=\EW$<4/>, dl1=\ER, el=\ET, il1=\EE, is2=^Z, kbs=^H, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, rmir=, rmso=\E), + rmul=\Em, smir=\EQ, smso=\E(, smul=\El, +# +# Osborne Executive definition from BRL +# Similar to tvi920 +# Added by David Milligan and Tom Smith (SMU) +osexec|Osborne executive, + OTbs, am, + OTug#1, cols#80, lines#24, xmc#1, + OTnl=^J, bel=^G, clear=^Z, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dl1=\ER, ed=\EY, el=\ET, home=^^, hts=\E1, ich1=\EQ, il1=\EE, + is2=\Eq\Ek\Em\EA\Ex0, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, + kcuu1=^K, kf0=^A@\r, kf1=^AA\r, kf2=^AB\r, kf3=^AC\r, + kf4=^AD\r, kf5=^AE\r, kf6=^AF\r, kf7=^AG\r, kf8=^AH\r, + kf9=^AI\r, rmir=, rmso=\Ek, rmul=\Em, smir=, smso=\Ej, + smul=\El, tbc=\E3, + +#### Console types for obsolete UNIX clones +# +# Coherent, Minix, Venix, and several lesser-known kin were OSs for 8088 +# machines that tried to emulate the UNIX look'n'feel. Coherent and Venix +# were commercial, Minix an educational tool sold in conjunction with a book. +# Memory-segmentation limits and a strong tendency to look like V7 long after +# it was obsolete made all three pretty lame. Venix croaked early. Coherent +# and Minix were ported to 32-bit Intel boxes, only to be run over by a +# steamroller named `Linux' (which, to be fair, traces some lineage to Minix). +# Coherent's vendor, the Mark Williams Company, went belly-up in 1994. There +# are also, I'm told, Minix ports that ran on Amiga and Atari machines and +# even as single processes under SunOS and the Macintosh OS. +# + +# See +# https://web.archive.org/web/20120703021949/http://www.minix3.org/manpages/html4/console.html +minix|minix console (v3), + acsc=+\020\,\021-\030.^Y0\333`\004a\261f\370g\361h\260j + \331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v + \301w\302x\263y\363z\362{\343|\330}\234~\376, + kdch1=\177, kend=\E[Y, kf0=\E[21~, kf1=\E[11~, kf10=\E[21~, + kf11=\E[11;2~, kf12=\E[12;2~, kf13=\E[13;2~, + kf14=\E[14;2~, kf15=\E[15;2~, kf16=\E[17;2~, + kf17=\E[18;2~, kf18=\E[19;2~, kf19=\E[20;2~, kf2=\E[12~, + kf20=\E[21;2~, kf21=\E[11;5~, kf22=\E[12;5~, + kf23=\E[13;5~, kf24=\E[14;5~, kf25=\E[15;5~, + kf26=\E[17;5~, kf27=\E[18;5~, kf28=\E[19;5~, + kf29=\E[20;5~, kf3=\E[13~, kf30=\E[21;5~, kf31=\E[11;6~, + kf32=\E[12;6~, kf33=\E[13;6~, kf34=\E[14;6~, + kf35=\E[15;6~, kf36=\E[17;6~, kf37=\E[18;6~, + kf38=\E[19;6~, kf39=\E[20;6~, kf4=\E[14~, kf40=\E[21;6~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kich1=\E[@, knp=\E[U, kpp=\E[V, lf0@, lf1@, lf2@, lf3@, lf4@, lf5@, + use=minix-3.0, + +minix-3.0|minix console (v3.0), + use=ecma+color, use=minix-1.7, + +# See +# http://www.minix-vmd.org/pub/Minix-vmd/1.7.0/wwwman/man4/console.4.html +# This is the entry provided with minix 1.7.4, with bogus :ri: removed. +minix-1.7|minix console (v1.7), + am, xenl, + cols#80, it#8, lines#25, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[0J, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[K, el1=\E[2K, + home=\E[H, ht=^I, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, is2=\E[0m, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf0=\E[Y, kf1=\E[V, kf2=\E[U, + kf3=\E[T, kf4=\E[S, kf5=\E[G, khome=\E[H, lf0=End, lf1=PgUp, + lf2=PgDn, lf3=Num +, lf4=Num -, lf5=Num 5, nel=^M^J, + rev=\E[7m, ri=\EM, rmso=\E[0m, rmul=\E[0m, sgr0=\E[0m, + smso=\E[7m, smul=\E[4m, +# Corrected Jan 14, 1997 by Vincent Broman +minix-old|minix-1.5|minix console (v1.5), + xon, + cols#80, it#8, lines#25, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[0J, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[0J, el=\E[K, home=\E[H, ht=^I, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf0=\E[Y, kf1=\E[V, kf2=\E[U, kf3=\E[T, kf4=\E[S, kf5=\E[G, + khome=\E[H, nel=^M^J, rev=\E[7m, ri=\EM, rmso=\E[0m, + rmul=\E[0m, sgr0=\E[0m, smso=\E[7m, smul=\E[4m, +# The linewrap option can be specified by editing /usr/include/minix/config.h +# before recompiling the minix 1.5 kernel. +minix-old-am|minix console with linewrap, + am, use=minix-old, + +pc-minix|minix console on an Intel box, + use=klone+acs, use=minix-3.0, + +# According to the Coherent 2.3 manual, the PC console is similar +# to a z19. The differences seem to be (1) 25 lines, (2) no status +# line, (3) standout is broken, (4) ins/del line is broken, (5) +# has blinking and bold. +pc-coherent|pcz19|coherent|IBM PC console running Coherent, + am, mir, + cols#80, it#8, lines#25, + bel=^G, clear=\EE, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EN, + ed=\EJ, el=\EK, home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\EH, ri=\EI, rmir=\EO, + rmso=\Eq, sgr0=\Eq, smir=\E@, smso=\Ep, + +# According to the Venix 1.1 manual, the PC console is similar +# to a DEC vt52. Differences seem to be (1) arrow keys send +# different strings, (2) enhanced standout, (3) added insert/delete line. +# Note in particular that it doesn't have automatic margins. +# There are other keys (f1-f10, kpp, knp, kcbt, kich1, kdch1) but they +# not described here because this derives from an old termcap entry. +pc-venix|venix|IBM PC console running Venix, + cols#80, it#8, lines#25, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dl1=\EM, + ed=\EJ, el=\EK, ht=^I, il1=\EL, ind=^J, kbs=^H, kcub1=\EK, + kcud1=\EP, kcuf1=\EM, kcuu1=\EH, khome=\EG, ri=\EI, + +#### Miscellaneous microcomputer consoles +# +# If you know anything more about any of these, please tell me. +# + +# The MAI Basic Four computer was obsolete at the end of the 1980s. +# It may be used as a terminal by putting it in "line" mode as seen on +# one of the status lines. +# Initialization is similar to CIT80. will set ANSI mode for you. +# Hardware tabs set by at 8-spacing. Auto line wrap causes glitches so +# wrap mode is reset by . Using =\E[S caused errors so I +# used \ED instead. +# From: bf347@lafn.org (David Lawyer), 28 Jun 1997 +mai|basic4|MAI Basic Four in ansi mode, + am, da, db, mir, msgr, + cols#82, it#8, lines#25, + bel=^G, blink=\E[5m, bold=\E[1m, clear=^]^_, cnorm=\E[?7h, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=^X, + cup=\E[%i%p1%d;%p2%dH, cuu1=^Z, cvvis=\E[?7l, dch1=\E[1P, + dl1=\E[M, ed=^_, el=^^, home=^], ht=^I, + if=/usr/share/tabset/vt100, il1=\E[L, ind=\ED, + is2=\E>\E[?1h\E[?7h\E[?5l\017\E(B\E[m\E[20l\E[1;24r\E[24;1H, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, nel=^M\ED, rc=\E8, rev=\E[7m, ri=\E[T, + rmir=\E[4l, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, + smir=\E[4h, smso=\E[7m, smul=\E[4m, +# basis from Peter Harrison, Computer Graphics Lab, San Francisco +# ucbvax!ucsfmis!harrison ...uucp / ucbvax!ucsfmis!harrison@BERKELEY ...ARPA +# +# On Sat, 7 Aug 1999, Torsten Jerzembeck wrote: +# The Basis 108 was a Apple II clone, manufactured by the "Basis +# Mikrocomputer GmbH" in Munster, Germany (the company still exists today, +# about 1,5 km from where I live, but doesn't build own computers any +# more). A Basis 108 featured a really heavy (cast aluminium?) case, was +# equipped with one or two 5.25" disk drives, had a monochrome and colour +# video output for a TV set or a dedicated monitor and several slots for +# Apple II cards. Basis 108 were quite popular at german schools before +# the advent of the IBM PC. They run, for example, the UCSD Pascal +# development system (which I used even in 1993 to program the steering +# and data recording for our school's experimental solar panel :), Apple DOS +# or CP/M. +# (basis: removed obsolete ":ma=^K^P^R^L^L :nl=5000*^J:" -- esr) +basis|BASIS108 computer with terminal translation table active, + clear=\E*$<300/>, cud1=\n$<5000/>, ed=\EY, el=\ET, kbs=^H, + kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, rmso=\E), sgr0=\E), + smso=\E(, use=adm3a, +# luna's BMC terminal emulator +luna|luna68k|LUNA68K Bitmap console, + cols#88, lines#46, use=ansi-mini, +megatek|pegasus workstation terminal emulator, + am, os, + cols#83, lines#60, +# The Xerox 820 was a Z80 micro with a snazzy XEROX PARC-derived +# interface (pre-Macintosh by several years) that went nowhere. +xerox820|x820|Xerox 820, + am, + cols#80, lines#24, + bel=^G, clear=\032$<1>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=^Q, el=^X, + home=^^, ind=^J, + +#### Videotex and teletext +# + +# \E\:1} switch to te'le'informatique mode (ascii terminal/ISO 6429) +# \E[?3l 80 columns +# \E[?4l scrolling on +# \E[12h local echo off +# \Ec reset: G0 U.S. charset (to get #,@,{,},...), 80 cols, clear screen +# \E)0 G1 DEC set (line graphics) +# +# From: Igor Tamitegama , 18 Jan 1997 +m2-nam|minitel|minitel-2|minitel-2-nam|France Telecom Minitel 2 mode te'le'informatique, + OTbs, eslok, hs, xenl, + cols#80, it#8, lines#24, wsl#72, xmc#0, + acsc=aaffggjjkkllmmnnooqqssttuuvvwwxx, bel=^G, + blink=\E[5m, bold=\E[1m, civis=\E[<1h, clear=\E[H\E[J, + cnorm=\E[<1l, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, flash=^G, fsl=^J, + home=\E[H, ht=^I, il=\E[%p1%dL, il1=\E[L, ind=^J, ip=$<7/>, + is1=\E\:1}\Ec\E[?4l\E[12h, is2=\Ec\E[12h\E)0, + is3=\E[?3l kbs=\010, kclr=\E[2J, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kdl1=\E[M, kf0=\EOp, + kf1=\EOq, kf10=\EOp, kf2=\EOr, kf3=\EOs, kf4=\EOt, kf5=\EOu, + kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy, khome=\E[H, + kich1=\E[4h, kil1=\E[4l, knp=\EOn, kpp=\EOR, ll=\E[24;80H, + mc0=\E[i, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, + rs1=\Ec\E[?4l\E[12h, rs2=\Ec\E)0, sc=\E7, sgr0=\E[m, + smacs=^N, smir=\E[4h, smso=\E[7m, smul=\E[4m, tsl=^_@A, + u6=\E[%i%d;%dR, u7=\E[6n, + +# From: Alexandre Montaron , 18 Jun 1998, updated 19 Sep 2016 +# +minitel1|minitel 1, + am, bw, eslok, hs, hz, .msgr, G0, + colors#8, cols#40, lines#24, pairs#8, .ncv#16, + acsc=j+k+l+m+n+o~q`s_t+u+v+w+x|, bel=^G, blink=\EH, + civis=^T, clear=^L, cnorm=^Q, cr=^M, cub1=^H, cud1=^J, cuf1=^I, + cup=\037%p1%'A'%+%c%p2%'A'%+%c, cuu1=^K, + dsl=\037@A\030\n, el=^X, + flash=\037@A\EW \177\022\177\022P\r\030\n, fsl=^J, + home=^^, ind=^J, is2=\E;`ZQ\E\:iC\E\:iE\021, kbs=^SG, + kcan=^SE, kend=^SI, kent=^SA, khlp=^SD, knp=^SH, kpp=^SB, + krfr=^SC, nel=^M^J, op=\EG, rep=%p1%c\022%p2%'?'%+%c, + rev=\E], ri=^K, rmso=\E\\, + rs2=\024\037XA\030\n\030\n\030\n\030\n\030\n\030\n\030\n + \030\n\030\n\030\n\030\n\030\n\030\n\030\n\030\n\030\n + \030\n\030\n\030\n\030\n\030\n\030\n\030\n\030\014 + \021, + setab=\0, setaf=\E%p1%'@'%+%c, setb=\0, + setf=\E%?%p1%{1}%=%tD%e%p1%{3}%=%tF%e%p1%{4}%=%tA%e%p1%{6}%= + %tC%e%p1%'@'%+%c%;, + sgr=%?%p1%t\E]%;%?%p3%t\E]%;%?%p4%t\EH%;, + sgr0=\EI\E\\\EG, smso=\E], tsl=\037@%p1%'A'%+%c, + u6=\037%c%'A'%-%c%'A'%-, u7=\Ea, + u8=\001%[BCDEFGHIJKLbcresdfg0123456789]\004, u9=\E9{, + .dim=\EB, .hup=\E9g, .rs2=^L, .u8=\001Br4\004, + C0=`>a9f!j%k4l\,\277?\,\300AA\, + \301BA\,\302CA\,\303DA\,\304HA\,\305JA\,\306a\,\307KC\, + \310AE\,\311BE\,\312CE\,\313HE\,\314AI\,\315BI\,\316CI\, + \317HI\,\320b\,\321DN\,\322AO\,\323BO\,\324CO\,\325DO\, + \326HO\,\3274\,\330i\,\331AU\,\332BU\,\333CU\,\334HU\, + \335BY\,\336l\,\337{\,\340Aa\,\341Ba\,\342Ca\,\343Da\, + \344Ha\,\345Ja\,\346q\,\347Kc\,\350Ae\,\351Be\,\352Ce\, + \353He\,\354Ai\,\355Bi\,\356Ci\,\357Hi\,\360r\,\361Dn\, + \362Ao\,\363Bo\,\364Co\,\365Do\,\366Ho\,\3678\,\370y\, + \371Au\,\372Bu\,\373Cu\,\374Hu\,\375By\,\376|\,\377Hy\, + \252c\,\,0\017\031%\016\,}#\,f0\,g1\,\\\,\\\,\,+.\,./\,0 + \177\,--, +minitel1b|minitel 1-bistandard (in 40cols mode), + mir, + cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, + cuu=\E[%p1%dA, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el1=\E[1K, il=\E[%p1%dL, il1=\E[L, + is1=\E;iYA\E;jYC, kbs@, kcan@, kclr=\E[2J, kctab=^I, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, + kdl1=\E[M, kent@, kf1=^SD, kf10=^Y0, kf11=^Y1, kf12=^Y/, + kf13=^Y{1, kf14=^Y{2, kf15=^Y{3, kf16=^Y{4, kf17=^Y{5, + kf18=^Y{6, kf19=^Y{7, kf2=^SC, kf20=^Y{8, kf21=^Y{9, + kf22=^Y{0, kf23=^Y{*, kf24=^Y{#, kf3=^SF, kf4=^SA, kf5=^SG, + kf6=^SE, kf7=^Y8, kf8=^Y\,, kf9=^Y., khlp@, khome=\E[H, + kich1=\E[4h, kil1=\E[L, krfr@, lf1=Guide, lf2=Repetition, + lf3=Sommaire, lf4=Envoi, lf5=Correction, lf6=Annulation, + rmir=\E[4l, smir=\E[4h, + u8=\001%[ABCPtuvwxyz0123456789\:;<=>?]\004, + .ich=\E[%p1%d@, .ich1=\E[@, .kLFT=\E[P, .kRIT=\E[4h, + .kb2=^Y{g, .kcbt=^Y{i, .kel=^X, .mc0=\E\:|k, .rmkx=\E;jYA, + .rs1=\E[4l\E[2l, .smkx=\E;iYA\E;jYC, .u8=\001Cu<\004, + use=minitel1, +# rmkx posait des problemes (logout en sortant de vi). +minitel1b-80|minitel 1-bistandard (standard teleinformatique), + am@, bw@, eslok@, hz@, msgr, G0, + colors@, cols#80, it#8, pairs@, + acsc@, blink=\E[5m, bold=\E[1m, civis=\037@A\024\n, + clear=\E[H\E[J, cnorm=\037@A\021\n, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, + ht=^I, ind=\ED, is1@, is2@, kbs=\EOl, kcan=\EOQ, kend=\E)4\r, + kent=\EOM, kf1=\EOq, kf10=\EOp, kf11=\EOP1, kf12=\EOP2, + kf13=\EOP3, kf14=\EOP4, kf15=\EOP5, kf16=\EOP6, kf17=\EOP7, + kf18=\EOP8, kf19=\EOP9, kf2=\EOr, kf20=\EOP0, kf21=\EOP*, + kf22=\EOP#, kf23@, kf24@, kf3=\EOs, kf4=\EOt, kf5=\EOu, + kf6=\EOv, kf7=\EOw, kf8=\EOx, kf9=\EOy, khlp=\EOm, knp=\EOn, + kpp=\EOR, krfr=\EOS, lf1@, lf2@, lf3@, lf4@, lf5@, lf6@, nel=\EE, + op@, rc=\E8, rep@, rev=\E[7m, ri=\EM, rmkx@, rmso=\E[27m, + rmul=\E[24m, + rs2=\036\E[12H\E[2M\E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2M\E[ + H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2M + \E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2 + M\E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[2M\E[H\E[L\E[12H\E[ + 2M\E[H\E[J\E[m, + sc=\E7, setab@, setaf@, setb@, setf@, sgr@, sgr0=\E[m, smkx@, + smso=\E[7m, smul=\E[4m, + tsl=\037@%?%p1%{63}%<%t%p1%'A'%+%c%e\177%p1%{62}%-%Pa%?%ga + %{1}%&%t\011%;%?%ga%{2}%&%t\011\011%;%?%ga%{4}%&%t\011 + \011\011\011%;%?%ga%{07}%>%t\011\011\011\011\011\011 + \011\011%;%?%ga%{15}%>%t\011\011\011\011\011\011\011 + \011%;%;, + u6@, u7@, u8@, u9@, .acsc=}#f[, .enacs=^O, .kb2=\EOPg, + .kcbt=\EOPi, .ll=\E[24H, .mc0=\E[i, .rmacs=^O, .rs2=\Ec, + .sgr=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1 + ;%;m, + .smacs=^N, C0=}#f[j+k+l+m+n+o~q=s_t+u+v+w+x!0\032, + E0=^O, S0=^N, + XC=B\016%\017\,\243#\,\247]\,\260[\,\340@\,\347\\\\\,\351{\, + \350}\,\371|\,\300A\,\301A\,\302A\,\303A\,\304A\,\305A\, + \306E\,\307C\,\310E\,\311E\,\312E\,\313E\,\314I\,\315I\, + \316I\,\317I\,\320D\,\321N\,\322O\,\323O\,\324O\,\325O\, + \326O\,\331U\,\332U\,\333U\,\334U\,\335Y\,\337s\,\341a\, + \342a\,\343a\,\344a\,\345a\,\346e\,\352e\,\353e\,\354i\, + \355i\,\356i\,\357i\,\360d\,\361n\,\362o\,\363o\,\364o\, + \365o\,\366o\,\372u\,\373u\,\374u\,\375y\,\377y\,\267.\, + \327x\,\367/\,\261\E7\E[4m+\E8\E[C\,\,0\017%\016\,x|\,y + \E7\E[4m<\E8\E[C\,z\E7\E[4m>\E8\E[C\,g\E7\E[4m+\E8\E[C, + use=minitel1b, + +minitel1-nb|minitel 1 (40cols) noir & blanc sans couleurs avec bold et dim ..., + colors@, pairs@, + bold=\EG, clear=^L\EB, + cup=\037%p1%'A'%+%c%p2%'A'%+%c\EB, dim=\ED, home=^^\EB, + op@, rs2=^L\EB, setab@, setaf@, setb@, setf@, + sgr=%?%p1%p3%O%t\E]%;%?%p4%t\EH%;%?%p5%t\ED%;%?%p6%t\EG%;, + sgr0=\EI\E\\\EB, tsl=\037@%p1%'A'%+%c\EB, .invis=\E@, + use=minitel1, + +minitel1b-nb|minitel 1b (40cols) noir & blanc sans couleurs avec bold et dim ..., + msgr, + colors@, pairs@, + acsc=`>a9f!j%k4l\E[?5l, home=\E[H, hpa=\E[%i%p1%d`, + ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, + initc=\E]P%p1%{15}%&%X%p2%{255}%&%02X%p3%{255}%&%02X%p4 + %{255}%&%02X, + is2=\E]R\E]P3FFFF80\E[?8c, ka1=\EOw, ka3=\EOy, kb2=\E[G, + kbs=\177, kc1=\EOq, kc3=\EOs, kcbt=\E^I, kclr=\E^M, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kdl1=\E\E[A, kend=\E[4~, kent=\EOM, kf1=\E[[A, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, + kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, + kil1=\E\E[B, kmous=\E[M, knp=\E[6~, kpp=\E[5~, nel=\EE, + oc=\E]R\E]P3FFFF80, op=\E[39;49m, rc=\E8, rev=\E[7m, + ri=\EM, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmpch=\E[10m, + rmso=\E[27m, rs1=\Ec, rs3=\E[37;40m\E[8], sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m, smacs=^N, + smam=\E[?7h, smir=\E[4h, smpch=\E[11m, smso=\E[7m, + tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?6c, u9=\EZ, + vpa=\E[%i%p1%dd, .VN=\E[?5l, .VR=\E[?5h, .am@, + .ich=\E[%p1%d@, .ich1=\E[@, .ll=\E[99H, .rmcup=, + .rmul=\E[24m, .smcup=\E]R\E]P3FFFF80\E[?8c, + .smul=\E[4m, + E3=\E[99H\E[2J\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n, + +# 1. Using double-shapes for vt100 graphical chars (eg: mc). +# 2. Native brown color corrected to good yellow color. +# 3. Adding "Insert" and "Delete Line" keys as ESC Up and ESC Down arrow keys. +# 4. Suppressed inexistant underlined mode (normally as bright). +# 5. ich/ich1 not filled because of non-curses programs. +#-- +# 6. Suppressed inexistant invisible mode. +#(7.)Adding forgotten "cub/cud/cuf/cuu" sequences deplacement. + +linux-m1b|Linux Minitel 1B "like" Monochrome (Gris/Blanc/Noir+Dim), + ccc@, + colors@, ncv@, pairs@, + acsc@, bold=\E[33m, enacs@, initc@, + is2=\E]R\E]P1A9A9A9\E]P2A9A9A9\E]P3FFFFFF\E]P4A9A9A9\E]P5A9A + 9A9\E]P6A9A9A9\E]P9FFFFFF\E]PAFFFFFF\E]PBFFFFFF\E]PCFFFF + FF\E]PDFFFFFF\E]PEFFFFFF\E[?2c, + oc@, op@, rmacs@, setab=^A, setaf=^A, smacs@, .setab@, .setaf@, + .smcup=\E]R\E]P1A9A9A9\E]P2A9A9A9\E]P3FFFFFF\E]P4A9A9A9\E]P5 + A9A9A9\E]P6A9A9A9\E]P9FFFFFF\E]PAFFFFFF\E]PBFFFFFF\E] + PCFFFFFF\E]PDFFFFFF\E]PEFFFFFF\E[?2c, + use=linux-m1, + +linux-m2|Linux Minitel 2 "like" Couleurs (Vert/Blanc/Noir+Bleu), + ccc@, + colors@, ncv@, pairs@, + acsc=++\,\,--..00``aabbccddeeffgghhiijjkkllmmnnooppqqrrssttu + uvvwwxxyyzz{{||}}~~, + bold=\E[33m, cnorm=\E[?2c\E[?25h, cvvis=\E[?8c\E[?25h, + enacs=\E)0, initc@, + is2=\E]R\E]P100A900\E]P200A900\E]P3FFFFFF\E]P400A900\E]P500A + 900\E]P600A900\E]P700A900\E]P80000FF\E]P9FFFFFF\E]PAFFFF + FF\E]PBFFFFFF\E]PCFFFFFF\E]PDFFFFFF\E]PEFFFFFF\E]PFFFFFF + F\E[;37m, + oc@, op@, rmacs=^O, setab=^A, setaf=^A, sgr0=\E[;37m, smacs=^N, + .setab@, .setaf@, + .smcup=\E]R\E]P100A900\E]P200A900\E]P3FFFFFF\E]P400A900\E]P5 + 00A900\E]P600A900\E]P700A900\E]P80000FF\E]P9FFFFFF\E] + PAFFFFFF\E]PBFFFFFF\E]PCFFFFFF\E]PDFFFFFF\E]PEFFFFFF + \E]PFFFFFFF\E[;37m, + use=linux-m1, + +# Screen entries counterpart : + +screen.linux-m1|Linux m1 specific for screen, + ncv@, + dim=\E[2m, kbs=\177, kclr=\E^M, kdl1=\E\E[A, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, kil1=\E\E[B, rmul@, + smul@, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\EZ, + E3=\E[99H\E[2J\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + \n\n\n\n\n\n\n\n\n\n, + use=screen, + +screen.linux-m1b|Linux m1b specific for screen, + colors@, pairs@, + op@, setab@, setaf@, setb@, setf@, use=screen.linux-m1, + +screen.linux-m2|Linux m2 specific for screen, + acsc=++\,\,--..00``aabbccddeeffgghhiijjkkllmmnnooppqqrrssttu + uvvwwxxyyzz{{||}}~~, + use=screen.linux-m1b, + +# Putty : + +putty-m1|Putty Minitel 1 "like" Couleurs, + hs, + dim@, dsl=\E]2;\007, fsl=^G, indn=\E[%p1%dS, kf1=\E[11~, + kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, + rin=\E[%p1%dT, rmcup=\E[2J\E[?47l\E8, rmul=\E[24m, + smcup=\E7\E[?47h, smul=\E[4m, tsl=\E]2;, .E3=\E[300S, + .WS=\E[8;%d;%dt, Z0=\E[?3h, Z1=\E[?3l, use=linux-m1, + +putty-m1b|Putty Minitel 1B "like" Monochrome (Gris/Blanc/Noir), + hs, + dim@, dsl=\E]2;\007, fsl=^G, indn=\E[%p1%dS, kf1=\E[11~, + kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, + rin=\E[%p1%dT, rmcup=\E[2J\E[?47l\E8, rmul=\E[24m, + smcup=\E7\E[?47h, smul=\E[4m, tsl=\E]2;, .E3=\E[300S, + .WS=\E[8;%d;%dt, Z0=\E[?3h, Z1=\E[?3l, use=linux-m1b, + +putty-m2|Putty Minitel 2 "like" Couleurs (Vert/Blanc/Noir), + hs, + acsc=``aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{ + {||}}~~, + dim@, dsl=\E]2;\007, fsl=^G, indn=\E[%p1%dS, kf1=\E[11~, + kf2=\E[12~, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, + rin=\E[%p1%dT, rmcup=\E[2J\E[?47l\E8, rmul=\E[24m, + smcup=\E7\E[?47h, smul=\E[4m, tsl=\E]2;, .E3=\E[300S, + .WS=\E[8;%d;%dt, Z0=\E[?3h, Z1=\E[?3l, use=linux-m2, + + +screen.putty-m1|Putty m1 specific for screen, + dim@, rmul=\E[24m, smul=\E[4m, E3@, use=screen.linux-m1, + +screen.putty-m1b|Putty m1b specific for screen, + colors@, pairs@, + op@, setab@, setaf@, setb@, setf@, use=screen.putty-m1, + +screen.putty-m2|Putty m2 specific for screen, + acsc=++\,\,--..00``aabbccddeeffgghhiijjkkllmmnnooppqqrrssttu + uvvwwxxyyzz{{||}}~~, + use=screen.putty-m1b, +# From: Alexandre Montaron, 19 Nov 2015, updated 19 Sep 2016 +# +# He comments: +# viewdata lacks a true cup capabilitie, +# so I achieved it with home and cud1/cuf1 sequences only ! +viewdata|prestel/viewdata terminals, + am, bw, eslok, hz, + cols#40, lines#24, + bel=^G, civis=^T, clear=^L, cnorm=^Q, cr=^M, cub1=^H, cud1=^J, + cuf1=^I, + cup=\036%?%p1%{07}%>%t\n\n\n\n\n\n\n\n%;%?%p1%{15}%>%t\n\n + \n\n\n\n\n\n%;%?%p1%{4}%&%t\n\n\n\n%;%?%p1%{2}%&%t\n\n%; + %?%p1%{1}%&%t\n%;%?%p2%{07}%>%t\011\011\011\011\011\011 + \011\011%;%?%p2%{15}%>%t\011\011\011\011\011\011\011 + \011%;%?%p2%{23}%>%t\011\011\011\011\011\011\011\011%;%? + %p2%{31}%>%t\011\011\011\011\011\011\011\011%;%?%p2%{4} + %&%t\011\011\011\011%;%?%p2%{2}%&%t\011\011%;%?%p2%{1}%& + %t\011%;, + cuu1=^K, home=^^, nel=^M^J, rs2=^L, .el=^X, .ind=^J, + .rep=%p1%c\022%p2%'?'%+%c, .ri=^K, + +viewdata-o|optimized version of viewdata prestel/viewdata terminals, + cup=\036%p1%?%p2%{20}%>%t%?%p1%{23}%=%t%Pa%{1}%e%{1}%+%;%; + %Pa%?%ga%{13}%<%t%?%ga%{07}%>%t\n\n\n\n\n\n\n\n%;%?%ga + %{4}%&%t\n\n\n\n%;%?%ga%{2}%&%t\n\n%;%?%ga%{1}%&%t\n%;%e + %{24}%ga%-%Pa%?%ga%{07}%>%t\013\013\013\013\013\013\013 + \013%;%?%ga%{4}%&%t\013\013\013\013%;%?%ga%{2}%&%t\013 + \013%;%?%ga%{1}%&%t\013%;%;%?%p2%{21}%<%t%?%p2%{07}%>%t + \011\011\011\011\011\011\011\011%;%?%p2%{15}%>%t\011 + \011\011\011\011\011\011\011%;%?%p2%{4}%&%t\011\011\011 + \011%;%?%p2%{2}%&%t\011\011%;%?%p2%{1}%&%t\011%;%e%{40} + %p2%-%Pa%?%ga%{07}%>%t\010\010\010\010\010\010\010\010%; + %?%ga%{15}%>%t\010\010\010\010\010\010\010\010%;%?%ga + %{4}%&%t\010\010\010\010%;%?%ga%{2}%&%t\010\010%;%?%ga + %{1}%&%t\010%;%?%p1%{23}%=%t\013%;%;, + .ll=^^^K, use=viewdata, + +# Samples with TERM=viewdata and TERM=viewdata-rv: http://canal.chez.com/blog/ + +viewdata-rv|prestel/viewdata terminals with reverse capabilitie (as green), + xmc#1, + rmso=\EG, smso=\EB, use=viewdata-o, + +######## OBSOLETE VDT TYPES +# +# These terminals are *long* dead -- these entries are retained for +# historical interest only. + +#### Amtek Business Machines +# + +# (abm80: early versions of this entry apparently had ":se=\E^_:so=\E^Y", +# but these caps were commented out in 8.3; also, removed overridden +# ":do=^J:" -- esr) +abm80|amtek business machines 80, + OTbs, am, bw, + cols#80, lines#24, + cbt=^T, clear=\E^\, cub1=^H, cud1=\E^K, cuf1=^P, + cup=\E\021%p2%{32}%+%c%p1%{32}%+%c, cuu1=\E^L, + dl1=\E^S, ed=\E^X, el=\E^O, home=\E^R, il1=\E^Z, + +#### Bell Labs blit terminals +# +# These were AT&T's official entries. The 5620 FAQ maintained by +# David Breneman has this to say: +# +# Actually, in the beginning was the Jerq, and the Jerq was white with a +# green face, and Locanthi and Pike looked upon the Jerq and said the Jerq +# was good. But lo, upon the horizon loomed a mighty management-type person +# (known now only by the initials VP) who said, the mighty Jerq must stay +# alone, and could not go forth into the world. So Locanthi and Pike put the +# Jerq to sleep, cloned its parts, and the Blit was brought forth unto the +# world. And the Jerq lived the rest of its days in research, but never +# strayed from those paths. +# +# In all seriousness, the Blit was originally known as the Jerq, but when +# it started to be shown outside of the halls of the Bell Labs Research +# organization, the management powers that be decided that the name could +# not remain. So it was renamed to be Blit. This was in late 1981. +# +# (The AT&T 5620 was the commercialized Blit. Its successors were the 630, +# 730, and 730+.) +# + +blit|jerq|blit running teletype rom, + am, eo, ul, xon, + cols#87, it#8, lines#72, + bel=^G, clear=^L, cr=^M, cub1=\ED, cud1=^J, cuf1=\EC, + cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, + dch=\Ee%p1%{32}%+%c, dch1=\Ee!, dl=\EE%p1%{32}%+%c, + dl1=\EE!, el=\EK, ht=^I, ich=\Ef%p1%{32}%+%c, ich1=\Ef!, + il=\EF%p1%{32}%+%c, il1=\EF!, ind=^J, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf1=\Ex, kf2=\Ey, kf3=\Ez, + +# (cbblit: here's a BSD termcap that says -- esr) +cbblit|fixterm|blit running columbus code, + cols#88, + ed=\EJ, flash=\E^G, ich1@, mc4=^T, mc5=^R, mc5p=\EP%p1%03d, + rmir=\ER, rmso=\EV!, rmul=\EV", smir=\EQ, smso=\EU!, + smul=\EU", use=blit, + +oblit|ojerq|first version of blit rom, + am, da, db, eo, mir, ul, xon, + cols#88, it#8, lines#72, + bel=^G, clear=^L, cr=^M, cub1=\ED, cud1=^J, cuf1=\EC, + cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, dch1=\EO, + dl=\Ee%p1%{32}%+%c, dl1=\EE, ed=\EJ, el=\EK, flash=\E^G, + ht=^I, il=\Ef%p1%{32}%+%c, il1=\EF, ind=^J, kbs=^H, rmir=\ER, + smir=\EQ, + +#### Bolt, Beranek & Newman (bbn) +# +# The BitGraph was a product of the now-defunct BBN Computer Corporation. +# The parent company, best known as the architects of the Internet, is +# still around. +# +# Jeff DelPapa writes: +# The bitgraph was a large white box that contained a monochrome bitmap +# display, and a 68000 to run it. You could download code and run it on +# the cpu, it had 128kb (I think) of memory. I used one in the late +# 70's, sure beat a vt100. It had one strange feature tho -- it used +# the cpu to bitblt pixels to scroll, it took longer than the refresh +# rate, and looked like a rubber sheet stretching, then snapping +# upwards. It had everything the early mac had, except a floppy drive a +# small screen (it had a 17" crisp beauty) and a real OS. They (Bolt +# Beranek and Neuman) sold at most a few hundred of them to the real +# world. DOD may have bought more... +# + +# Entries for the BitGraph terminals. The problem +# with scrolling in vi can only be fixed by getting BBN to put +# smarter scroll logic in the terminal or changing vi or padding +# scrolls with about 500 ms delay. +# +# I always thought the problem was related to the terminal +# counting newlines in its input buffer before scrolling and +# then moving the screen that much. Then vi comes along and +# paints lines in on the bottom line of the screen, so you get +# this big white gap. + +bitgraph|bg2.0nv|bg3.10nv|bbn bitgraph 2.0 or later (normal video), + flash=\E[?5h$<200/>\E[?5l, is2=\E>\E[?5l\E[?7h, + use=bg2.0, +bg2.0rv|bg3.10rv|bbn bitgraph 2.0 (reverse video), + flash=\E[?5l$<200/>\E[?5h, is2=\E>\E[?5h\E[?7h, + use=bg2.0, +bg2.0|bg3.10|bbn bitgraph 2.0 or later (no init), + OTbs, xenl, + cols#85, lines#64, + bel=^G, clear=\E[H\E[J$<150>, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, dl1=\E[M$<2*>, + ed=\E[J$<150>, el=\E[K$<2>, ht=^I, il1=\E[L$<2*>, + ind=\n$<280>, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, lf1=PF1, + lf2=PF2, lf3=PF3, lf4=PF4, rc=\E8, rmkx=\E>, rmso=\E[m, sc=\E7, + sgr0=\E[m, smkx=\E=, smso=\E[7m, + +bg1.25rv|bbn bitgraph 1.25 (reverse video), + flash=\E[?5l$<200/>\E[?5h, is2=\E>\E[?5h\E[?7h, + use=bg1.25, +bg1.25nv|bbn bitgraph 1.25 (normal video), + flash=\E[?5h$<200/>\E[?5l, is2=\E>\E[?5l\E[?7h, + use=bg1.25, +# (bg1.25: I added / based on the init string -- esr) +bg1.25|bbn bitgraph 1.25, + cols#85, lines#64, + bel=^G, clear=\E[H\E[J$<150>, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, + dl1=\E[M$<2*>, ed=\E[J$<150>, el=\E[K$<2>, ht=^I, + il1=\E[L$<2*>, ind=\n$<280>, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kf1=\EP, kf2=\EQ, kf3=\ER, kf4=\ES, + lf1=PF1, lf2=PF2, lf3=PF3, lf4=PF4, ll=\E[64;1H, rmam=\E[?7l, + rmkx=\E>, rmso=\E[m, sgr0=\E[m, smam=\E[?7h, smkx=\E=, + smso=\E[7m, + +#### Bull (bq, dku, vip) +# +# (Adapted for terminfo; AIX extension capabilities translated -- esr) + +#============================================# +# BULL QUESTAR 210 `SDP' terminals emulation # +#============================================# +# +# Description written by R.K.Saunders (Bull Transac) +# +# Modifications written by F. Girard (Bull MTS) +# 19-05-87 V02.00.01 +# 17-12-87 V02.00.02 +# 15-09-89 V02.00.05 +# +# Typical technical selections F1 (modes SDP/ROLL): +# ------------------------------------------------------- +# | 01 02 03 04 05 06 07 08 09 10 | +# | 1010 0011 1010 0110 0110 0001 0100 0000 0000 0000 | +# | | +# | 11 12 13 14 15 16 17 18 19 20 | +# | 0000 0110 100? 0000 0000 0000 0001 0000 0000 0001 | +# | | +# | 21 22 23 24 25 26 27 28 29 30 | +# | 0011 0000 0001 1000 0000 0000 0000 0000 0000 0000 | +# | | +# | 31 32 33 34 35 36 37 38 39 40 | +# | 1010 0011 0000 0000 0000 0000 0000 0000 0000 0000 | +# ------------------------------------------------------- +# Typical firmware identification F5 "etat 6": +# P287.02.04b (AZERTY) +# P297.11.04 (24-pin: 2732) or P798.11.04 (28-pin: 2764) +# P298.03.03 (monochrome) or P374.03.02 (colour) +# +# SM SDP mode (VIP command): ^[[?=h +# RIS (erases screen): ^[c +# DMI disable keyboard: ^[` +# SM double rendition mode: ^[[?>h +# RM solicited status mode: ^[[5l +# RM character mode: ^[[>l +# RM echoplex mode: ^[[12l +# RM column tab mode: ^[[18l +# RM forbid SS2 keyboard mode: ^[[?h\EPY99\:98\E\\, + is2=\E[5;>;12;18;?h\EPY99\:98\E\\, + smir=\E[4h, smso=\E[0;7m, smul=\E[0;4m, tbc=\E[3g, + tsl=\EPY99\:98\E\\\E[0;98v\E[2;7m, +tws2102-sna|dku7102-sna|BULL Questar tws2102 for SNA, + dsl=\E[0;98v\E[2J\E[v, fsl=\E[v, is3=\Eb, tsl=\E[0;98v, + use=tws-generic, +tws2103|xdku|BULL Questar tws2103, + ht=^I, use=tws-generic, +tws2103-sna|dku7103-sna|BULL Questar tws2103 for SNA, + ht=^I, use=tws2102-sna, +dku7102-old|BULL Questar 200 DKU7102 (microcode version < 6), + clear=\E[2J\E[H, cup@, dl@, dl1@, + dsl=\EPY99\:98\E\\\E[0;98v\E[2J\E[H\E[v, el=\E[K\E[m, + il@, il1@, tsl=\EPY99\:98\E\\\E[0;98v\E[H\E[2;7m, + use=tws-generic, +dku7202|BULL Questar 200 DKU7202 (colour/character attributes), + blink=\E[0;2;4m, dim=\E[0;5m, ht=^I, is3=\E[?3h\Eb, + sgr=\E[0%?%p1%t;2;4;5;7%;%?%p3%t;7%;%?%p2%t;2%;%?%p4%t;2;4%; + %?%p5%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + smso=\E[0;4;5;7m, smul=\E[0;2m, use=tws-generic, + +#=========================================================# +# BULL QUESTAR 303 & 310 `DEC VT 320' terminals emulation # +#=========================================================# +# +# Description written by J. Staerck (BULL SA) +# Copyright (c) 1989 BULL SA +#--------------------------------------------------------------------------- +# This entry is used for terminals with vt320 emulation mode +# and following set-up : +# 8 bit ISO Latin Character Set (ISO 8859-1), +# 7 bit Control Characters, +# 80 columns screen. +# Hereafter are some DEC vt terminals' commands. (valid on vt200 and 300) +# They are used in string capabilities with vt220-320 emulation mode. +# In the following DEC definitions, two kinds of terminfo databases are +# provided : +# 1. the first with Command Sequence Introducer starting with escape +# sequence in 7 bits characters ex. ESC [ : 2 chars. in 7-bit mode. +# 2. the second with Command Sequence Introducer starting with escape +# sequence in 8 bits characters ex. ESC [ : 1 char. 'CSI' =x9B. +# Soft Terminal Reset esc [ ! p +# RIS (erases screen): esc c +# DECKPNM numeric keypad mode: esc > +# DECKPAM applic. keypad mode: esc = +# DECSTBM Scrolling region: esc [ r +# SCS select G0 = US: esc ( B +# SCS select G1 = line-graphic: esc ) 0 +# Select 7-bit C1 controls: esc sp F +# Select 8-bit C1 controls: esc sp G +# Select cursor home: esc [ H +# Select erase screen: esc [ J +# SM KAM lock keyboard: esc [ 2 h +# RM KAM unlock keyboard: esc [ 2 l +# SM SRM local echo off: esc [ 1 2 h +# RM SRM local echo on: esc [ 1 2 l +# SM LNM New line : esc [ 2 0 h +# RM LNM return = CR only: esc [ 2 0 l +# SM DECCKM cursor keys mode: esc [ ? 1 h +# RM DECCKM appli. keys mode: esc [ ? 1 l +# SM DECANM ANSI mode on: esc [ ? 2 h +# RM DECANM ANSI mode off: esc [ ? 2 l +# SM DECCOLM 132-column screen: esc [ ? 3 h +# RM DECCOLM 80-column screen: esc [ ? 3 l +# SM DECSCLM Smooth scroll: esc [ ? 4 h +# RM DECSCLM Jump scroll: esc [ ? 4 l +# SM DECSCNM screen light backgr. esc [ ? 5 h +# RM DECSCNM screen dark backgr. esc [ ? 5 l +# SM DECOM move within margins: esc [ ? 6 h +# RM DECOM move outside margins: esc [ ? 6 l +# SM DECAWM auto right margin: esc [ ? 7 h +# RM DECAWM auto right margin: esc [ ? 7 l +# SM DECARM auto repeat: esc [ ? 8 h +# RM DECARM auto repeat: esc [ ? 8 l +# DECSASD Select active main: esc [ 0 $ } +# DECSASD Select active status: esc [ 1 $ } +# DECSSDT Select status none: esc [ 0 $ ~ +# DECSSDT Select status indic.: esc [ 1 $ ~ +# DECSSDT Select status host-wr: esc [ 2 $ ~ +# SM DECTCEM Visible cursor: esc [ ? 2 5 h +# RM DECTCEM Invisible cursor: esc [ ? 2 5 l +# SM DECNCRM 7 bits NCR set: esc [ ? 4 2 h +# RM DECNCRM Multi or ISO latin: esc [ ? 4 2 l +# SM DECNKM numeric keypad mode: esc [ ? 6 6 h +# RM DECNKM numeric keypad appl.: esc [ ? 6 6 l +# SM DECKBUM clavier informatique esc [ ? 6 8 h +# RM DECKBUM clavier bureautique: esc [ ? 6 8 l +# DECSCL vt300 mode 8-bit ctrl: esc [ 6 3 " p +# or DECSCL vt300 mode 8-bit ctrl: esc [ 6 3 ; 0 " p +# or DECSCL vt300 mode 8-bit ctrl: esc [ 6 3 ; 2 " p +# DECSCL vt300 mode 7-bit ctrl: esc [ 6 3 ; 1 " p +# Char. and Line attributes: esc [ Ps ... Ps m +# with: 0 All off, 1 Bold, 4 Underline, 5 Blinking, 7 Reverse +# and : 22 Bold off, 24 Underline off, 25 Blinking off, 27 Reverse off +# + +# This entry covers BQ303, BQ306, BQ310, Q303, Q306, Q310 +bq300|Bull vt320 ISO Latin 1 80 columns terminal, + am, eo, eslok, hs, km, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[1$}\E[2$~\n\E[0$}, ech=\E[%p1%dX, ed=\E[J, + el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h$<50>\E[?5l, fsl=\E[0$}, home=\E[H, ht=^I, + hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + is1=\E[63;1"p\E[2h, + is2=\E[?2h\E[?3l\E[?5l\E[?7h\E[?8h\E>\E[?1l\E\sF\E[?42l\E[?4 + l, + is3=\E[0$}\E[?25h\E[2l\E[H\E[J, ka1=\EOw, ka3=\EOy, + kb2=\EOu, kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, kf1=\EOP, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + krdo=\E[29~, kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, + nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B, rmam=\E[?7l, + rmcup=\E[?7h, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, + rmul=\E[24m, rs1=\E[!p, rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0, + sc=\E7, + sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1 + %;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[0m\E(B, smacs=\E(0, smam=\E[?7h, + smcup=\E[?7l\E[?1l\E(B, smir=\E[4h, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, tsl=\E[1$}\E[2$~, use=ansi+pp, +bq300-rv|Bull vt320 reverse 80 columns, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E\sF\E[?42l\E[?4 + l, + use=bq300, +bq300-w|Bull vt320 132 columns, + cols#132, wsl#132, + is2=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E\sF\E[?42l\E[?4 + l, + rs2=\E[?3h, use=bq300, +bq300-w-rv|Bull vt320 reverse mode 132 columns, + cols#132, wsl#132, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E\sF\E[?42l\E[?4 + l, + rs2=\E[?3h, use=bq300, + +# This entry is used for terminals with vt320 emulation mode +# and following set-up : +# 8 bit ISO Latin Character Set (ISO 8859-1), +# 8 bit Control Characters, (CSI coded as x9B for ESC [) +# 80 columns screen. +# Soft Terminal Reset csi ! p +# RIS (erases screen): esc c +# DECKPNM numeric keypad mode: esc > +# DECKPAM applic. keypad mode: esc = +# DECSTBM Scrolling region: esc [ r +# SCS select G0 = US: esc ( B +# SCS select G1 = line-graphic: esc ) 0 +# Select 7-bit C1 controls: esc sp F +# Select 8-bit C1 controls: esc sp G +# Select cursor home: csi H +# Select erase screen: csi J +# SM KAM lock keyboard: csi 2 h +# RM KAM unlock keyboard: csi 2 l +# SM SRM local echo off: csi 1 2 h +# RM SRM local echo on: csi 1 2 l +# SM LNM New line : csi 2 0 h +# RM LNM return = CR only: csi 2 0 l +# SM DECCKM cursor keys mode: csi ? 1 h +# RM DECCKM appli. keys mode: csi ? 1 l +# SM DECANM ANSI mode on: csi ? 2 h +# RM DECANM ANSI mode off: csi ? 2 l +# SM DECCOLM 132-column screen: csi ? 3 h +# RM DECCOLM 80-column screen: csi ? 3 l +# SM DECSCLM Smooth scroll: csi ? 4 h +# RM DECSCLM Jump scroll: csi ? 4 l +# SM DECSCNM screen light backgr. csi ? 5 h +# RM DECSCNM screen dark backgr. csi ? 5 l +# SM DECOM move within margins: csi ? 6 h +# RM DECOM move outside margins: csi ? 6 l +# SM DECAWM auto right margin: csi ? 7 h +# RM DECAWM auto right margin: csi ? 7 l +# SM DECARM auto repeat: csi ? 8 h +# RM DECARM auto repeat: csi ? 8 l +# DECSASD Select active main: csi 0 $ } +# DECSASD Select active status: csi 1 $ } +# DECSSDT Select status none: csi 0 $ ~ +# DECSSDT Select status indic.: csi 1 $ ~ +# DECSSDT Select status host-wr: csi 2 $ ~ +# SM DECTCEM Visible cursor: csi ? 2 5 h +# RM DECTCEM Invisible cursor: csi ? 2 5 l +# SM DECNCRM 7 bits NCR set: csi ? 4 2 h +# RM DECNCRM Multi or ISO latin: csi ? 4 2 l +# DECSCL vt300 mode 8-bit ctrl: csi 6 3 " p +# or DECSCL vt300 mode 8-bit ctrl: csi 6 3 ; 0 " p +# DECSCL vt300 mode 7-bit ctrl: csi 6 3 ; 1 " p +# Char. and Line attributes: csi Ps ... Ps m +# with: 0 All off, 1 Bold, 4 Underline, 5 Blinking, 7 Reverse +# and : 22 Bold off, 24 Underline off, 25 Blinking off, 27 Reverse off +# (bq300-8: ,,,,, to get under 1024 --esr) +bq300-8|Bull vt320 full 8 bits 80 columns, + am, eo, eslok, hs, km, mc5i, mir, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, wsl#80, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\2335m, bold=\2331m, civis=\233?25l, + clear=\233H\233J, cnorm=\233?25h, cr=^M, + csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cub1=\2331D, + cud=\233%p1%dB, cud1=\2331B, cuf=\233%p1%dC, cuf1=\2331C, + cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, cuu1=\2331A, + dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, + dsl=\2331$}\2332$~\n\2330$}, ech=\233%p1%dX, ed=\233J, + el=\233K, el1=\2331K, enacs=\E(B\E)0, + flash=\233?5h$<50>\233?5l, fsl=\2330$}, home=\233H, + ht=^I, hts=\EH, ich=\233%p1%d@, il=\233%p1%dL, il1=\233L, + ind=\ED, is1=\E[63;2"p\E[2h, + is2=\E[?2h\E[?3l\E[?5l\E[?7h\E[?8h\E>\E[?1l\E\sG\E[?42l\E[?4 + l, + is3=\2330$}\233?25h\2332l\233H\233J, ka1=\217w, + ka3=\217y, kb2=\217u, kbs=^H, kc1=\217q, kc3=\217s, + kcub1=\233D, kcud1=\233B, kcuf1=\233C, kcuu1=\233A, + kdch1=\2333~, kf1=\217P, kf10=\23321~, kf11=\23323~, + kf12=\23324~, kf13=\23325~, kf14=\23326~, kf15=\23328~, + kf16=\23329~, kf17=\23331~, kf18=\23332~, kf19=\23333~, + kf2=\217Q, kf20=\23334~, kf3=\217R, kf4=\217S, kf6=\23317~, + kf7=\23318~, kf8=\23319~, kf9=\23320~, kfnd=\2331~, + khlp=\23328~, kich1=\2332~, knp=\2336~, kpp=\2335~, + krdo=\23329~, kslt=\2334~, lf1=pf1, lf2=pf2, lf3=pf3, + lf4=pf4, mc0=\233i, mc4=\2334i, mc5=\2335i, nel=\EE, rc=\E8, + rev=\2337m, ri=\EM, rmacs=\E(B, rmam=\233?7l, + rmcup=\233?7h, rmir=\2334l, rmkx=\233?1l\E>, + rmso=\23327m, rmul=\23324m, rs1=\E[!p, rs2=\E[?3l, + s0ds=\E(B, s1ds=\E(0, sc=\E7, + sgr=\233%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t; + 1%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, + smcup=\233?7l\233?1l\E(B, smir=\2334h, smso=\2337m, + smul=\2334m, tbc=\2333g, tsl=\2331$}\2332$~, +bq300-8rv|Bull vt320 8-bit reverse mode 80 columns, + flash=\233?5l$<50>\233?5h, + is2=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E\sG\E[?42l\E[?4 + l, + use=bq300-8, +bq300-8w|Bull vt320 8-bit 132 columns, + cols#132, wsl#132, + is2=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E\sG\E[?42l\E[?4 + l, + rs2=\233?3h, use=bq300-8, +bq300-w-8rv|Bull vt320 8-bit reverse mode 132 columns, + cols#132, wsl#132, + flash=\233?5l$<50>\233?5h, + is2=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E\sG\E[?42l\E[?4 + l, + rs2=\233?3h, use=bq300-8, + +# This entry is used for terminals with vt320 emulation mode +# a 102 keys keyboard (PC scancode !) and following set-up : +# 8 bit ISO Latin Character Set (ISO 8859-1), +# 7 bit Control Characters, +# 80 columns screen. +bq300-pc|Questar 303 with PC keyboard ISO Latin 1 80 columns, + kbs=^H, kdch1=\E[3~, kend=\E[4~, kf1=\E[17~, kf10=\E[28~, + kf11=\E[29~, kf12=\E[31~, kf13@, kf14@, kf15@, kf16@, kf17@, + kf18@, kf19@, kf2=\E[18~, kf20@, kf3=\E[19~, kf4=\E[20~, + kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, + kfnd@, khlp@, khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, + krdo@, kslt@, lf1@, lf2@, lf3@, lf4@, use=bq300, +bq300-pc-rv|Questar 303 with PC keyboard reverse mode 80 columns, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E\sF\E[?42l\E[?4 + l, + use=bq300-pc, +bq300-pc-w|Questar 303 with PC keyboard 132 columns terminal, + cols#132, wsl#132, + is2=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E\sF\E[?42l\E[?4 + l, + rs2=\E[?3h, use=bq300-pc, +bq300-pc-w-rv|Questar 303 with PC keyboard reverse mode 132 columns, + cols#132, wsl#132, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E\sF\E[?42l\E[?4 + l, + rs2=\E[?3h, use=bq300-pc, +# 8 bit ISO Latin Character Set (ISO 8859-1), +# 8 bit Control Characters, +# 80 columns screen. +bq300-8-pc|Q306-8-pc|Questar 303 with PC keyboard in full 8 bits 80 columns, + kbs=^H, kdch1=\2333~, kend=\2334~, kf1=\23317~, + kf10=\23328~, kf11=\23329~, kf12=\23331~, kf13@, kf14@, + kf15@, kf16@, kf17@, kf18@, kf19@, kf2=\23318~, kf20@, + kf3=\23319~, kf4=\23320~, kf5=\23321~, kf6=\23323~, + kf7=\23324~, kf8=\23325~, kf9=\23326~, kfnd@, khlp@, + khome=\2331~, kich1=\2332~, knp=\2336~, kpp=\2335~, krdo@, + kslt@, lf1@, lf2@, lf3@, lf4@, use=bq300-8, +bq300-8-pc-rv|Questar 303 with PC keyboard full 8 bits reverse mode 80 columns, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E\sG\E[?42l\E[?4 + l, + use=bq300-8-pc, +bq300-8-pc-w|Questar 303 with PC keyboard full 8 bits 132 columns, + cols#132, wsl#132, + is2=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E\sG\E[?42l\E[?4 + l, + rs2=\E[?3h, use=bq300-8-pc, +bq300-8-pc-w-rv|Questar 303 with PC keyboard full 8 bits reverse 132 columns, + cols#132, wsl#132, + flash=\E[?5l$<50>\E[?5h, + is2=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E\sG\E[?42l\E[?4 + l, + rs2=\E[?3h, use=bq300-8-pc, + +#======================================================# +# BULL QUESTAR 310 `VIP 7800/8800' terminals emulation # +#======================================================# + +# normal mode, 8 bits, 80 columns terminal. +# RES reset : ^[e +# RIS reset initial state: ^[c +# BLE bell enable ^[h +# BLD bell disable ^[g +# CAMS char. attr. mode set ^[[D +# CAMR char. attr. mode reset ^[[G +# CLR clear ^[` +# KBU keyboard unlock (set) ^[[W +# KBL keyboard lock (reset) ^[[X +# CM character mode (async.) ^[k +# NEP non echoplex mode (by host) ^[l +# EP echoplex mode (by host) ^[m +# IM insert mode set ^[[I +# IM insert mode reset ^[[J +# RMS roll mode set ^[r +# RMR roll mode reset ^[q +# SM78 set mode vip7800 ^[[1q +# SD scroll up (72 lines) ^[[0s +# SD scroll down (72 lines) ^[[1s +# RBM block mode reset ^[[E +# SLS status line set ^[w +# SLR status line reset ^[v +# SLL status line lock ^[O +# LGS Line-graphic mode set ^[G +# LGR Line-graphic mode reset ^[F +# TBC tab clear (at cursor pos.) ^[[g +# TBI tab initialize ^[[N +# TBS tab set (at cursor pos.) ^[p +# PDS print data space ^[[0p +# PHD print host data ^[[3p +# PDT print data terminator ^[[

u +# SSP0 partition 0 set ^[[00u +# SSP1 partition n format 1 ^[[PnPnSTRINGu +# SSP2 partition n format 2 ^[[PnPnSTRINGu +# SSP3 partition n format 3 ^[[PnPnu +# ATR attribute (visual) +# blink : ^[sB +# dim : ^[sL +# hide (blank) : ^[sH +# restore : ^[sR +# inverse video : ^[sI +# prot. : ^[sP +# underline : ^[s_ +# reset : ^{ +# +# This covers the vip7800 and BQ3155-vip7800 +vip|Bull Questar 3155-7800, + am, eslok, hs, km, mc5i, msgr, xenl, xon, + cols#80, it#8, lines#24, vt#3, wsl#80, + acsc=0pjdkblamcnkqitgufvhwexj, bel=^G, blink=\EsB, + cbt=\E[Z, clear=\E`, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\E[%i%p1%03d%p2%03df, cuu1=\EA, dch1=\E[P, dim=\EsL, + dl1=\E[M, dsl=\Ev, ed=\EJ, el=\EK, + flash=\007$<80>\007$<80>\007, fsl=\EO, home=\EH, ht=^I, + hts=\Ep, ich1=\E[I, ind=^J, invis=\EsH, + is2=\E[00u\E[<>001001024080024080u\E[01u, + is3=\Er\E[W\E`, kHOM=\EH, kLFT=\Eo, kRIT=\Eu, kbs=^H, + kcbt=\E[Z, kclr=\E`, kctab=\E[g, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kdch1=\E[P, kdl1=\E[M, ked=\EJ, + kel=\EK, kf1=\E0, kf10=\ET, kf11=\E\\, kf12=\E\^, kf13@, kf14@, + kf15@, kf16@, kf17@, kf18@, kf19@, kf2=\E2, kf20@, kf21=\E1, + kf22=\E5, kf23=\E7, kf24=\E9, kf25=\E;, kf26=\E=, kf27=\E?, + kf28=\EQ, kf29=\ES, kf3=\E6, kf30=\EV, kf31=\E], kf32=\E_, + kf4=\E8, kf5=\E\:, kf6=\E<, kf7=\E>, kf8=\EP, kf9=\ER, + khome=\EH, khts=\Ep, kich1=\E[I, kil1=\E[L, kind=\E[0s, + kll=\EH\EA, kri=\E[1s, krmir=\E[J, ktbc=\E[N, lf1=pf1, + lf2=pf2, lf3=pf3, lf4=pf4, ll=\EH\EA, mc0=\E[0p, mc4=\E[, rmacs=\EF, rmir=\E[J, rmso=\EsR, + rmul=\EsR, rs1=\Ec, rs2=\E[G, s0ds=\EF, s1ds=\EG, + sgr0=\EsR\EsU\EF, smacs=\EG, smir=\E[I, smso=\EsI, + smul=\Es_, tbc=\E[N, tsl=\Ew, +# normal screen, 8 bits, 132 columns terminal. +vip-w|vip7800-w|Q310-vip-w|Q310-vip-w-am|Questar 3155-vip7800 wide, + cols#132, wsl#132, + is2=\E[00u\E[<>001001024132024132u\E[01u, use=vip, +vip-H|vip7800-H|Q310-vip-H|Q310-vip-H-am|Questar 3155-vip7800 72 lines, + lines#72, + is2=\E[00u\E[<>001001024080072080u\E[01u, use=vip, +vip-Hw|vip7800-Hw|Q310-vip-Hw|Questar 3155-vip7800 wide 72 lines, + cols#132, lines#72, wsl#132, + is2=\E[00u\E[<>001001024132072132u\E[01u, use=vip, + +#### Chromatics +# + +# I have put the long strings in /. Ti sets up a window +# that is smaller than the screen, and puts up a warning message +# outside the window. Te erases the warning message, puts the +# window back to be the whole screen, and puts the cursor at just +# below the small window. I defined and to really turn +# the cursor on and off, but I have taken this out since I don't +# like the cursor being turned off when vi exits. +cg7900|chromatics|chromatics 7900, + am, + cols#80, lines#40, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^], + cup=\001M%p2%d\,%p1%d\,, cuu1=^K, dch1=^A<1, dl1=^A<2, + ed=^Al, el=^A`, home=^\, ich1=^A>1, il1=^A>2, ind=^J, ll=^A|, + rmcup=\001W0\,40\,85\,48\,\014\001W0\,0\,85\,48\,\001M0\,40 + \,, + rmso=\001C1\,\001c2\,, + smcup=\001P0\001O1\001R1\001C4\,\001c0\,\014\001M0\,42\,WARN + ING\sDOUBLE\sENTER\sESCAPE\sand\s\025\001C1\,\001c2\, + \001W0\,0\,79\,39\,, + smso=\001C4\,\001c7\,, uc=\001\001_\001\0, + +#### Computer Automation +# + +ca22851|computer automation 22851, + am, + cols#80, lines#24, + bel=^G, clear=\014$<8>, cr=^M, cub1=^U, cud1=^J, cuf1=^I, + cup=\002%i%p1%c%p2%c, cuu1=^V, ed=^\, el=^], home=^^, ind=^J, + kcub1=^U, kcud1=^W, kcuu1=^V, khome=^^, + +#### Cybernex +# + +# This entry has correct padding and the undocumented "ri" capability +cyb83|xl83|cybernex xl-83, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\014$<62>, cr=^M, cub1=^H, cud1=^J, cuf1=^I, + cup=\027%p1%{32}%+%c%p2%{32}%+%c, cuu1=^N, + ed=\020$<62>, el=\017$<3>, home=^K, ind=^J, kcub1=^H, + kcud1=^J, kcuf1=^I, kcuu1=^N, ri=^N, +# (mdl110: removed obsolete ":ma=^Z^P:" and overridden ":cd=145^NA^W:" -- esr) +cyb110|mdl110|cybernex mdl-110, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=\030$<70>, cr=^M, cub1=^H, cud1=^J, cuf1=^U, + cup=\020%p1%{32}%+%c%p2%{32}%+%c, cuu1=^Z, + dch1=\016A\036$<3.5>, dl1=\016A\016\036$<40>, + ed=\016@\026$<6>, el=\016@\026$<145>, home=^Y, + ht=\011$<43>, ich1=\016A\035$<3.5>, + il1=\016A\016\035$<65>, ind=^J, rmso=^NG, smso=^NF, + +#### Datapoint +# +# Datapoint is gone. They used to be headquartered in Texas. +# They created ARCnet, an Ethernet competitor that flourished for a while +# in the early 1980s before 3COM got wise and cut its prices. The service +# side of Datapoint still lives (1995) in the form of Intelogic Trace. +# + +dp3360|datapoint|datapoint 3360, + OTbs, am, + cols#82, lines#25, + bel=^G, clear=^]^_, cr=^M, cub1=^H, cud1=^J, cuf1=^X, cuu1=^Z, + ed=^_, el=^^, home=^], ind=^J, + +# From: Jan Willem Stumpel , 11 May 1997 +# The Datapoint 8242 Workstation was sold at least between 1985 +# and 1989. To make the terminal work with this entry, press +# CONTROL-INT-INT to take the terminal off-line, and type (opt). +# Set the options AUTO ROLL, ROLL DN, and ESC KBD on, and AUTO +# CR/LF off. Use control-shift-[] as escape key, control-I as tab, +# shift-F1 to shift-F5 as F6 to F10 (unshifted F1 to F5 are in +# fact unusable because the strings sent by the terminal conflict +# with other keys). +# The terminal is capable of displaying "box draw" characters. +# For each graphic character you must send 2 ESC's (\E\E) followed +# by a control character as follows: +# character meaning +# ========= ======= +# ctrl-E top tee +# ctrl-F right tee +# ctrl-G bottom tee +# ctrl-H left tee +# ctrl-I cross +# ctrl-J top left corner +# ctrl-K top right corner +# ctrl-L bottom left corner +# ctrl-M bottom right corner +# ctrl-N horizontal line +# ctrl-O vertical line +# Unfortunately this cannot be fitted into the termcap/terminfo +# description scheme. +dp8242|datapoint 8242, + msgr, + cols#80, lines#25, + bel=^G, civis=^Y, clear=\025\E\004\027\030, cnorm=^X, + cr=^M, cub1=^H, cud1=^J, + cup=\011%p2%'\0'%+%c%p1%'\0'%+%c, dl1=\E^Z, ed=^W, el=^V, + home=^U, ht=^I, il1=\E^T, ind=^C, + is1=\E\014\E\016\0\230\0\317\025\027\030\E\004, + kbs=^H, kcub1=^D, kcud1=^B, kcuf1=^F, kcuu1=^E, kf1=^G\Ee, + kf10=\EK\Ea, kf2=^I\Ed, kf3=^J\Ec, kf4=^J\Eb, kf5=^S\Ea, + kf6=\EO\Ee, kf7=\EN\Ed, kf8=\EM\Ec, kf9=\EL\Eb, nel=^M^J, + rep=\E\023%p1%c%p2%c, ri=^K, rmso=\E^D, rmul=\E^D, + rs1=\E\014\E\016\0\230\0\317\025\027\030\E\004, + smso=\E^E, smul=\E^F, + wind=\E\014\E\016%p1%'\0'%+%c%p2%'\0'%+%c%p3%'\0'%+%c%p4%' + \0'%+%c\025, + +#### DEC terminals (Obsolete types: DECwriter and vt40/42/50) +# +# These entries are DEC's official terminfos for its older terminals. +# Contact Bill Hedberg of Terminal Support +# Engineering for more information. Updated terminfos and termcaps +# are kept available at ftp://gatekeeper.dec.com/pub/DEC/termcaps. +# + +gt40|dec gt40, + OTbs, os, + cols#72, lines#30, + bel=^G, cr=^M, cub1=^H, cud1=^J, +gt42|dec gt42, + OTbs, os, + cols#72, lines#40, + bel=^G, cr=^M, cub1=^H, cud1=^J, +vt50|dec vt50, + OTbs, + cols#80, lines#12, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cuu1=\EA, ed=\EJ, el=\EK, ht=^I, ind=^J, +vt50h|dec vt50h, + OTbs, + cols#80, lines#12, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, ht=^I, ind=^J, ri=\EI, +# (vt61: there's a BSD termcap that claims , ) +vt61|vt-61|vt61.5|dec vt61, + cols#80, lines#24, + bel=^G, clear=\EH\EJ$<120>, cr=\r$<20>, cub1=^H, cud1=^J, + cuf1=\EC$<20>, cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<20>, + cuu1=\EA$<20>, ed=\EJ$<120>, el=\EK$<70>, ht=^I, + ind=\n$<20>, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, + ri=\E$<20>I, + +# The gigi does standout with red! +# (gigi: I added / based on the init string, corrected cub1 -- esr) +gigi|vk100|dec gigi graphics terminal, + OTbs, am, xenl, + cols#84, lines#24, + bel=^G, clear=\E[H\E[2J, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, ed=\E[J, + el=\E[K, ht=^I, ind=^J, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?20l\E[?7h\E[?8h, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, khome=\E[H, ri=\EM, + rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + sgr0=\E[m, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7;31m, + smul=\E[4m, + +# DEC PRO-350 console (VT220-style). The 350 was DEC's attempt to produce +# a PC differentiated from the IBM clones. It was a total, ludicrous, +# grossly-overpriced failure (among other things, DEC's OS didn't include +# a format program, so you had to buy pre-formatted floppies from DEC at +# a hefty premium!). +pro350|decpro|dec pro console, + OTbs, + cols#80, it#8, lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + clear=\EH\EJ, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, + el=\EK, home=\EH, ht=^I, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf0=\EE, kf1=\EF, kf2=\EG, kf3=\EH, kf4=\EI, + kf5=\EJ, kf6=\Ei, kf7=\Ej, khome=\EH, ri=\EI, rmacs=\EG, + rmso=\E^N, rmul=\E^C, smacs=\EF, smso=\E^H, smul=\E^D, + +dw1|decwriter I, + OTbs, hc, os, + cols#72, + bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, +dw2|decwriter|dw|decwriter II, + OTbs, hc, os, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, ind=^J, kbs=^H, +# \E(B Use U.S. character set (otherwise # => british pound !) +# \E[20l Disable "linefeed newline" mode (else puts \r after \n,\f,\v) +# \E[w 10 char/in pitch +# \E[1;132 full width horizontal margins +# \E[2g clear all tab stops +# \E[z 6 lines/in +# \E[66t 66 lines/page (for \f) +# \E[1;66r full vertical page can be printed +# \E[4g clear vertical tab stops +# \E> disable alternate keypad mode (so it transmits numbers!) +# \E[%i%p1%du set tab stop at column %d (origin == 1) +# (Full syntax is \E[n;n;n;n;n;...;nu where each 'n' is +# a tab stop) +# +# The dw3 does standout with wide characters. +# +dw3|la120|decwriter III, + OTbs, hc, os, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, ind=^J, + is1=\E(B\E[20l\E[w\E[0;132s\E[2g\E[z\E[66t\E[1;66r\E[4g\E>, + is2=\E[9;17;25;33;41;49;57;65;73;81;89;97;105;113;121;129u + \r, + kbs=^H, rmso=\E[w, sgr0=\E[w, smso=\E[6w, +dw4|decwriter IV, + OTbs, am, hc, os, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, ht=^I, ind=^J, is2=\Ec, kbs=^H, + kf0=\EOP, kf1=\EOQ, kf2=\EOR, kf3=\EOS, + +# These aren't official +ln03|dec ln03 laser printer, + hc, + cols#80, lines#66, + bel=^G, cr=^M, cud1=^J, hd=\EK, ht=^I, hu=\EL, ind=^J, nel=^M^J, + rmso=\E[22m, rmul=\E[24m, sgr0=\E[m, smso=\E[1m, + smul=\E[4m, +ln03-w|dec ln03 laser printer 132 cols, + cols#132, + bel=^G, cr=^M, cud1=^J, ht=^I, ind=^J, kbs=^H, kcub1=^H, + kcud1=^J, nel=^M^J, use=ln03, + +#### Delta Data (dd) +# + +# Untested. The cup sequence is hairy enough that it probably needs work. +# The idea is ctrl(O), dd(row), dd(col), where dd(x) is x - 2*(x%16) + '9'. +# There are BSD-derived termcap entries floating around for this puppy +# that are *certainly* wrong. +delta|dd5000|delta data 5000, + OTbs, am, + cols#80, lines#27, + bel=^G, clear=^NR, cub1=^H, cud1=^J, cuf1=^Y, + cup=\017%p1%p1%{16}%m%{2}%*%-%{57}%+%c%p2%p2%{16}%m%{2}%*%- + %{57}%+%c, + cuu1=^Z, dch1=^NV, el=^NU, home=^NQ, ind=^J, + +#### Digital Data Research (ddr) +# + +# (ddr: I added / based on the init string -- esr) +ddr|rebus3180|ddr3180|Rebus/DDR 3180 vt100 emulator, + OTbs, am, xenl, + cols#80, it#8, lines#24, vt#3, + blink=\E[5m$<2/>, bold=\E[1m$<2/>, + clear=\E[H\E[2J$<50/>, csr=\E[%i%p1%d;%p2%dr, cub1=^H, + cud1=^J, cuf1=\E[C$<2/>, cup=\E[%i%p1%d;%p2%dH$<5/>, + cuu1=\E[A$<2/>, ed=\E[J$<50/>, el=\E[K$<3/>, home=\E[H, + ht=^I, ind=\ED$<5/>, is2=\E[1;24r\E[24;1H, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, + kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, rev=\E[7m$<2/>, + rf=/usr/share/tabset/vt100, ri=\EM$<5/>, rmam=\E[7l, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m$<2/>, + rs1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, + sgr0=\E[m$<2/>, smam=\E[7l, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m$<2/>, + +#### Evans & Sutherland +# + +# Jon Leech tells us: +# The ps300 was the Evans & Sutherland Picture System 300, a high +# performance 3D vector graphics system with a bunch of specialized hardware. +# Approximate date of release was 1982 (early 80s, anyway), and it had several +# evolutions including (limited) color versions such as the PS330C. PS300s +# were effectively obsolete by the late 80s, replaced by raster graphics +# systems, although specialized applications like molecular modelling +# hung onto them for a while longer. AFAIK all E&S vector graphics systems +# are out of production, though of course E&S is very much alive (in 1996). +# (ps300: changed ":pt@:" to "it@" -- esr) +# +ps300|Picture System 300, + xt, + it@, + rmso@, rmul@, smso@, smul@, use=vt100, + +#### General Electric (ge) +# + +terminet1200|terminet300|tn1200|tn300|terminet|GE terminet 1200, + OTbs, hc, os, + cols#120, + bel=^G, cr=^M, cud1=^J, ind=^J, + +#### Heathkit/Zenith +# + +# Here is a description of the H19 DIP switches: +# +# S401 +# 0-3 = baud rate as follows: +# +# 3 2 1 0 +# --- --- --- --- +# 0 0 1 1 300 baud +# 0 1 0 1 1200 baud +# 1 0 0 0 2400 baud +# 1 0 1 0 4800 baud +# 1 1 0 0 9600 baud +# 1 1 0 1 19.2K baud +# +# 4 = parity (0 = no parity) +# 5 = even parity (0 = odd parity) +# 6 = stick parity (0 = normal parity) +# 7 = full duplex (0 = half duplex) +# +# S402 +# 0 = block cursor (0 = underscore cursor) +# 1 = no key click (0 = keyclick) +# 2 = wrap at end of line (0 = no wrap) +# 3 = auto LF on CR (0 = no LF on CR) +# 4 = auto CR on LF (0 = no CR on LF) +# 5 = ANSI mode (0 = VT52 mode) +# 6 = keypad shifted (0 = keypad unshifted) +# 7 = 50Hz refresh (1 = 60Hz refresh) +# +# Factory Default settings are as follows: +# 7 6 5 4 3 2 1 0 +# S401 1 0 0 0 1 1 0 0 +# S402 0 0 0 0 0 0 0 0 +# (h19: I added / based on the init string; +# also added empty to suppress a tic warning -- esr) +h19-a|h19a|heath-ansi|heathkit-a|heathkit h19 ansi mode, + OTbs, am, mir, msgr, + cols#80, it#8, lines#24, + acsc=, bel=^G, clear=\E[2J, cnorm=\E[>4l, cr=^M, cub1=^H, + cud1=\E[1B, cuf1=\E[1C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[1A, cvvis=\E[>4h, dch1=\E[1P, dl1=\E[1M$<1*>, + ed=\E[J, el=\E[K, home=\E[H, ht=^I, il1=\E[1L$<1*>, ind=^J, + is2=\E<\E[>1;2;3;4;5;6;7;8;9l\E[m\E[11m\E[?7h, + kbs=^H, kcub1=\E[1D, kcud1=\E[1B, kcuf1=\E[1C, kcuu1=\E[1A, + kf1=\EOS, kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, + kf7=\EOQ, kf8=\EOR, khome=\E[H, lf6=blue, lf7=red, lf8=white, + ri=\EM, rmacs=\E[11m, rmam=\E[?7l, rmir=\E[4l, rmso=\E[m, + smacs=\E[10m, smam=\E[?7h, smir=\E[4h, smso=\E[7m, +h19-bs|heathkit w/keypad shifted, + rmkx=\Eu, smkx=\Et, use=h19-b, +h19-us|h19us|h19-smul|heathkit w/keypad shifted/underscore cursor, + rmkx=\Eu, smkx=\Et, use=h19-u, +# (h19: merged in from BSDI hp19-e entry>; +# also added empty to suppress a tic warning --esr) +# From: Tim Pierce , 23 Feb 1998 +# Tim tells us that: +# I have an old Zenith-19 terminal at home that still gets a lot of use. +# This terminal suffers from the same famous insert-mode padding lossage +# that has been acknowledged for the Z29 terminal. Emacs is nearly +# unusable on this box, since even a half-scroll up or down the window +# causes flaming terminal death. +# +# On the Z19, the only way I have found around this problem is to remove +# the :al: and :dl: entries entirely. No amount of extra padding will +# help (I have tried up to 20000). Removing and +# makes Emacs a little slower, but it remains in the land of the living. +# Big win. +h19|heath|h19-b|heathkit|heath-19|z19|zenith|heathkit h19, + OTbs, am, eslok, hs, mir, msgr, + cols#80, it#8, lines#24, + acsc=+h.kaiggjdkclfmenbozqas{tvutvuwsx`~\^, bel=^G, + clear=\EE, cnorm=\Ey4, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, cvvis=\Ex4, + dch1=\EN, ed=\EJ, el=\EK, fsl=\Ek\Ey5, home=\EH, ht=^I, ind=^J, + ip=$<1.5/>, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, kf5=\EW, + kf6=\EP, kf7=\EQ, kf8=\ER, khome=\EH, lf6=blue, lf7=red, + lf8=white, ri=\EI, rmacs=\EG, rmir=\EO, rmso=\Eq, smacs=\EF, + smir=\E@, smso=\Ep, tsl=\Ej\Ex5\EY8%p1%{32}%+%c\Eo\Eo, +h19-u|heathkit with underscore cursor, + cnorm@, cvvis@, use=h19-b, +h19-g|h19g|heathkit w/block cursor, + cnorm=\Ex4, cvvis@, use=h19-b, +alto-h19|altoh19|altoheath|alto-heath|alto emulating heathkit h19, + lines#60, + dl1=\EM, il1=\EL, use=h19, + +# The major problem with the Z29 is that it requires more padding than the Z19. +# +# The problem with declaring an H19 to be synonymous with a Z29 is that +# it needs more padding. It especially loses if a program attempts +# to put the Z29 into insert mode and insert text at 9600 baud. It +# even loses worse if the program attempts to insert tabs at 9600 +# baud. Adding padding to text that is inserted loses because in +# order to make the Z29 not die, one must add so much padding that +# whenever the program tries to use insert mode, the effective +# rate is about 110 baud. +# +# What program would want to put the terminal into insert mode +# and shove stuff at it at 9600 baud you ask? +# +# Emacs. Emacs seems to want to do the mathematically optimal +# thing in doing a redisplay rather than the practical thing. +# When it is about to output a line on top of a line that is +# already on the screen, instead of just killing to the end of +# the line and outputting the new line, it compares the old line +# and the new line and if there are any similarities, it +# constructs the new line by deleting the text on the old line +# on the terminal that is already there and then inserting new +# text into the line to transform it into the new line that is +# to be displayed. The Z29 does not react kindly to this. +# +# But don't cry for too long.... There is a solution. You can make +# a termcap entry for the Z29 that says the Z29 has no insert mode. +# Then Emacs cannot use it. "Oh, no, but now inserting into a +# line will be really slow", you say. Well there is a sort of a +# solution to that too. There is an insert character option on +# the Z29 that will insert one character. Unfortunately, it +# involves putting the terminal into ansi mode, inserting the +# character, and changing it back to H19 mode. All this takes 12 +# characters. Pretty expensive to insert one character, but it +# works. Either Emacs doesn't try to use its inserting hack when +# it's only given an insert character ability or the Z29 doesn't +# require padding with this (the former is probably more likely, +# but I haven't checked it out). +# (z29: added empty to suppress a tic warning, merged in +# status line capabilities from BRL entry --esr) +z29|zenith29|z29b|zenith z29b, + OTbs, OTpt, am, eslok, hs, mir, msgr, + OTkn#10, cols#80, lines#24, + OTbc=\ED, acsc=, bel=^G, cbt=\E-, clear=\EE$<14>, cnorm=\Ey4, + cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\E$<1>A, + cvvis=\Ex4, dch1=\EN$<0.1*>, dl1=\EM$<1/>, dsl=\Ey1, + ed=\EJ$<14>, el=\EK$<1>, fsl=\Ek\Ey5, home=\EH, ht=^I, + ich1=\E<\E[1@\E[?2h$<1>, il1=\EL$<1/>, ind=\n$<2>, + is2=\E<\E[?2h\Ev, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kf0=\E~, kf1=\ES, kf2=\ET, kf3=\EU, kf4=\EV, + kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\E0I, khome=\EH, + lf0=home, ri=\EI$<2/>, rmacs=\EF, rmir=\EO, rmso=\Eq, + rmul=\Es0, smacs=\EG, smir=\E@, smso=\Ep, smul=\Es8, + tsl=\Ej\Ex5\Ex1\EY8%+ \Eo, +# z29 in ansi mode. Assumes that the cursor is in the correct state, and that +# the world is stable. causes the terminal to be reset to the state +# indicated by the name. kc -> key click, nkc -> no key click, uc -> underscore +# cursor, bc -> block cursor. +# From: Mike Meyers +# (z29a: replaced nonexistent befause +# looks vt100-compatible -- esr) +z29a|z29a-kc-bc|h29a-kc-bc|heath/zenith 29 in ansi mode, + OTbs, OTpt, am, eslok, hs, mir, msgr, + OTkn#10, cols#80, it#8, lines#24, + OTbc=\ED, bel=^G, blink=\E[5m, bold=\E[2m, clear=\E[2J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[M, dsl=\E[>1l, ed=\E[J, el=\E[K, fsl=\E[u\E[>5l, + home=\E[H, ht=^I, hts=\EH, if=/usr/share/tabset/vt100, + il=\E[%p1%dL, il1=\E[L, ind=\ED, kbs=^H, kclr=\E[J, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, ked=\E[J, + kf0=\E[~, kf1=\EOS, kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, + kf6=\EOP, kf7=\EOQ, kf8=\EOR, kf9=\EOX, khome=\E[H, lf0=help, + mc0=\E#7, nel=^M\ED, rc=\E[r, rev=\E[7m, ri=\EM, + rmcup=\E[?7h, rmso=\E[m, rmul=\E[m, + rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>4h\E[>1;2;3;5;6;7;8;9l\E[m + \E[11m, + sc=\E[s, sgr0=\E[m, smcup=\E[?7l, smso=\E[7;2m, smul=\E[4m, + tbc=\E[3g, tsl=\E[s\E[>5;1h\E[25;%i%dH\E[1K, +z29a-kc-uc|h29a-kc-uc|z29 ansi mode with keyckick and underscore cursor, + rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>1;2;3;4;5;6;7;8;9l\E[m\E[11 + m, + use=z29a, +z29a-nkc-bc|h29a-nkc-bc|z29 ansi mode with block cursor and no keyclick, + rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>2;4h\E[>1;3;5;6;7;8;9l\E[m + \E[11m, + use=z29a, +z29a-nkc-uc|h29a-nkc-uc|z29 ansi mode with underscore cursor and no keyclick, + rs1=\E<\E[1;24r\E[24;1H\E[?7h\E[>2h\E[>1;3;4;5;6;7;8;9l\E[m + \E[11m, + use=z29a, +# From: Jeff Bartig 31 Mar 1995 +z39-a|z39a|zenith39-a|zenith39-ansi|Zenith 39 in ANSI mode, + am, eslok, hs, mc5i, mir, msgr, xon, + cols#80, lines#24, + acsc=0a``aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, + blink=\E[5m, bold=\E[1m, cbt=\E[1Z, civis=\E[>5h, + clear=\E[2J\E[H, cnorm=\E[>5l, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[1P, dim=\E[2m, dl=\E[%p1%dM, + dl1=\E[1M, dsl=\E[>1l, ed=\E[0J, el=\E[0K, el1=\E[1K, + fsl=\E[u, home=\E[H, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[1L, + ind=^J, is2=\E<\E[>1;3;5;6;7l\E[0m\E[2J, ka1=\EOw, + ka3=\EOu, kb2=\EOy, kbs=^H, kc1=\EOq, kc3=\EOs, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, ked=\E[J, kf1=\EOS, + kf2=\EOT, kf3=\EOU, kf4=\EOV, kf5=\EOW, kf6=\EOP, kf7=\EOQ, + kf8=\EOR, kf9=\EOX, khlp=\E[~, khome=\E[H, ll=\E[24;1H, + mc0=\E[?19h\E[i, mc4=\E[4i, mc5=\E[5i, rc=\E[u, rev=\E[7m, + rmacs=\E(B, rmir=\E[4l, rmkx=\E[>7l, rmso=\E[0m, + rmul=\E[0m, rs2=\E<\Ec\0, sc=\E[s, sgr0=\E[0m, smacs=\E(0, + smir=\E[4h, smkx=\E[>7h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[s\E[>1h\E[25;%i%p1%dH, + +# From: Brad Brahms +z100|h100|z110|z-100|h-100|heath/zenith z-100 pc with color monitor, + cnorm=\Ey4\Em70, cvvis=\Ex4\Em71, use=z100bw, +# (z100bw: removed obsolete ":kn#10:", added empty -- esr) +z100bw|h100bw|z110bw|z-100bw|h-100bw|heath/zenith z-100 pc, + OTbs, OTpt, mir, msgr, + OTkn#10, cols#80, it#8, lines#24, + acsc=+h.kaiggjdkclfmenbozqas{tvutvuwsx`~\^, + clear=\EE$<5*/>, cnorm=\Ey4, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<1*/>, cuu1=\EA, + cvvis=\Ex4, dch1=\EN$<1*/>, dl1=\EM$<5*/>, ed=\EJ, el=\EK, + home=\EH, ht=^I, il1=\EL$<5*/>, kbs=^H, kcub1=\ED, kcud1=\EB, + kcuf1=\EC, kcuu1=\EA, kf0=\EJ, kf1=\ES, kf2=\ET, kf3=\EU, + kf4=\EV, kf5=\EW, kf6=\EP, kf7=\EQ, kf8=\ER, kf9=\EOI, + khome=\EH, ri=\EI, rmacs=\EG, rmir=\EO, rmso=\Eq, smacs=\EF, + smir=\E@, smso=\Ep, +p19|h19-b with il1/dl1, + dl1=\EM$<2*/>, il1=\EL$<2*/>, use=h19-b, +# From: +# (ztx: removed duplicate :sr: -- esr) +ztx|ztx11|zt-1|htx11|ztx-1-a|ztx-10 or 11, + OTbs, am, eslok, hs, + cols#80, it#8, lines#24, + clear=\EE, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dl1=\EM, + dsl=\Ey1, ed=\EJ, el=\EK, fsl=\Ek\Ey5, home=\EH, ht=^I, + il1=\EL, is2=\Ej\EH\Eq\Ek\Ev\Ey1\Ey5\EG\Ey8\Ey9\Ey>, + kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kf0=\ES, + kf1=\EB, kf2=\EU, kf3=\EV, kf4=\EW, kf5=\EP, kf6=\EQ, kf7=\ER, + ri=\EI, rmso=\Eq, rmul=\Eq, smso=\Es5, smul=\Es2, + tsl=\Ej\Ex5\Ex1\EY8%+ \Eo, + +#### IMS International (ims) +# +# There was a company called IMS International located in Carson City, +# Nevada, that flourished from the mid-70s to mid-80s. They made S-100 +# bus/Z80 hardware and a line of terminals called Ultimas. +# + +# From: Erik Fair Sun Oct 27 07:21:05 1985 +ims950-b|bare ims950 no init string, + is2@, use=ims950, +# (ims950: removed obsolete ":ko@:" -- esr) +ims950|ims televideo 950 emulation, + xenl@, + flash@, kbs@, kcub1@, kcud1@, kcuf1@, kcuu1@, kf0@, kf1@, kf2@, kf3@, + kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, khome@, use=tvi950, +# (ims950-rv: removed obsolete ":ko@:" -- esr) +ims950-rv|ims tvi950 rev video, + xenl@, + flash@, kbs@, kcub1@, kcud1@, kcuf1@, kcuu1@, kf0@, kf1@, kf2@, kf3@, + kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, khome@, use=tvi950-rv, +ims-ansi|ultima2|ultimaII|IMS Ultima II, + OTbs, am, + cols#80, it#8, lines#24, + clear=\E[H\E[2J, cub1=^H, cud1=\ED, cuf1=\EC, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\EM, ed=\E[0J, el=\E[0K, + ht=^I, if=/usr/share/tabset/vt100, + is2=\E[m\E[>14l\E[?1;?5;20l\E>\E[1m\r, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, ri=\EM, + rmso=\E[m\E[1m, rmul=\E[m\E[1m, sgr0=\E[m, smso=\E[7m, + smul=\E[4m, + +#### Intertec Data Systems +# +# I think this company is long dead as of 1995. They made an early CP/M +# micro called the "Intertec Superbrain" that was moderately popular, +# then sank out of sight. +# + +superbrain|intertec superbrain, + OTbs, am, bw, + cols#80, lines#24, + OTbc=^U, bel=^G, clear=\014$<5*>, cr=^M, cub1=^H, cud1=^J, + cuf1=^F, cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<20>, cuu1=^K, + ed=\E~k<10*>, el=\E~K$<15>, ht=^I, ind=^J, kcub1=^U, + kcud1=^J, kcuf1=^F, kcuu1=^K, rmcup=^L, smcup=^L, +# (intertube: a Gould entry via BRL asserted smul=\E0@$<200/>, +# rmul=\E0A$<200/>; my guess is the highlight letter is bit-coded like an ADM, +# and the reverse is actually true. Try it. -- esr) +intertube|intertec|Intertec InterTube, + OTbs, am, + cols#80, lines#25, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^F, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<50>, cuu1=^Z, home=^A, + ind=^J, rmso=\E0@, smso=\E0P, +# The intertube 2 has the "full duplex" problem like the tek 4025: if you +# are typing and a command comes in, the keystrokes you type get interspersed +# with the command and it messes up +intertube2|intertec data systems intertube 2, + OTbs, + cup=\016%p1%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%c, + el=\EK, hpa=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%c, + ll=^K^X\r, vpa=\013%p1%c, use=intertube, + +#### Ithaca Intersystems +# +# This company made S100-bus personal computers long ago in the pre-IBM-PC +# past. They used to be reachable at: +# +# Ithaca Intersystems +# 1650 Hanshaw Road +# Ithaca, New York 14850 +# +# However, the outfit went bankrupt years ago. +# + +# The Graphos III was a color graphics terminal from Ithaca Intersystems. +# These entries were written (originally in termcap syntax) by Brian Yandell +# and Mike Meyer at the +# University of Wisconsin. + +# (graphos: removed obsolete and syntactically incorrect :kn=4:, +# removed and +# no such file & no -- esr) +graphos|graphos III, + am, mir, + cols#80, it#8, lines#24, + clear=\E[H\E[2J, cnorm=\Ez56;2;0;0z\Ez73z\Ez4;1;1z, + cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, + cvvis=\Ez4;2;1z\Ez56;2;80;24z, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, il=\E[%p1%dL, + il1=\E[L, ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, kf3=\EOR, + kf4=\EOS, khome=\E[H, nel=^M\ED, rc=\E8, ri=\EM, rmdc=\E[4l, + rmir=\E[4l, rmso=\E[m, sc=\E7, sgr0=\E[m, smdc=\E[4h, + smir=\E[4h, smso=\E[7m, +graphos-30|graphos III with 30 lines, + lines#30, + cvvis=\Ez4;2;1z\Ez56;2;80;30z, use=graphos, + +#### Modgraph +# +# These people used to be reachable at: +# +# Modgraph, Inc +# 1393 Main Street, +# Waltham, MA 02154 +# Vox: (617)-890-5796. +# +# However, if you call that number today you'll get an insurance company. +# I have mail from "Michael Berman, V.P. Sales, Modgraph" dated +# 26 Feb 1997 that says: +# +# Modgraph GX-1000, replaced by GX-2000. Both are out of production, have been +# for ~7 years. Modgraph still in business. Products are rugged laptop and +# portable PC's and specialized CRT and LCD monitors (rugged, rack-mount +# panel-mount etc). I can be emailed at sonfour@aol.com +# +# Peter D. Smith notes that his modgraph manual was +# dated 1984. According to the manual, it featured Tek 4010/4014 +# graphics and DEC VT100/VT52 + ADM-3A emulation with a VT220-style keyboard. +# + +modgraph|mod24|modgraph terminal emulating vt100, + xenl@, + cols#80, lines#24, + cvvis=\E\^9;0s\E\^7;1s, + is2=\E\^9;0s\E\^7;1s\E[3g\E\^11;9s\E\^11;17s\E\^11;25s\E\^11 + ;33s\E\^11;41s\E\^11;49s\E\^11;57s\E\^11;65s\E\^11;73s + \E\^11;81s\E\^11;89s, + rf@, ri=\EM\E[K$<5/>, use=vt100, +# The GX-1000 manual is dated 1984. This looks rather like a VT-52. +modgraph2|modgraph gx-1000 80x24 with keypad not enabled, + am, da, db, + cols#80, it#8, lines#24, + clear=\EH\EJ$<50/>, cub1=^H, cud1=\EB$<2/>, + cuf1=\EC$<2/>, cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<5/>, + cuu1=\EA$<2/>, ed=\EJ$<50/>, el=\EK$<3/>, ht=^I, + is2=\E<\E\^5;2s\E\^7;1s\E[3g\E\^11;9s\E\^11;17s\E\^11;25s\E + \^11;33s\E\^11;41s\E\^11;49s\E\^11;57s\E\^11;65s\E\^11;7 + 3s\E\^11;81s\E\^11;89s\E\^12;0s\E\^14;2s\E\^15;9s\E\^25; + 1s\E\^9;1s\E\^27;1, + ri=\EI$<5/>, +# +# Modgraph from Nancy L. Cider +# BUG NOTE from Barbara E. Ringers : +# If we set TERM=vt100, and set the Modgraph screen to 24 lines, setting a +# mark and using delete-to-killbuffer work correctly. However, we would +# like normal mode of operation to be using a Modgraph with 48 line setting. +# If we set TERM=mod (which is a valid entry in termcap with 48 lines) +# the setting mark and delete-to-killbuffer results in the deletion of only +# the line the mark is set on. +# We've discovered that the delete-to-killbuffer works correctly +# with TERM=mod and screen set to 80x48 but it's not obvious. Only +# the first line disappears but a ctrl-l shows that it did work +# correctly. +modgraph48|mod|Modgraph w/48 lines, + OTbs, OTpt, am, xenl, + cols#80, it#8, lines#48, vt#3, + OTnl=^J, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[;H\E[2J, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, ed=\E[J, el=\E[K, + flash=\E[?5h\E[0q\E[1;2q\E[?5l\E[0q\E[4;3q, + home=\E[H, ht=^I, is2=\E<\E[1;48r\E[0q\E[3;4q\E=\E[?1h, + kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rc=\E8, rev=\E[7m, + ri=\EM, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs1=\E=\E[0q\E>, sc=\E7, sgr0=\E[m, smkx=\E[?1h\E=, + smso=\E[7m, smul=\E[4m, + +#### Morrow Designs +# +# This was George Morrow's company. They started in the late 1970s making +# S100-bus machines. They used to be reachable at: +# +# Morrow +# 600 McCormick St. +# San Leandro, CA 94577 +# +# but they're long gone now (1995). +# + +# The mt70 terminal was shipped with the Morrow MD-3 microcomputer. +# Jeff's specimen was dated June 1984. +# From: Jeff Wieland 24 Feb 1995 +mt70|mt-70|Morrow MD-70; native Morrow mode, + am, mir, msgr, xon, + cols#80, it#8, lines#24, + acsc=+z\,{-x.yOi`|jGkFlEmDnHqJtLuKvNwMxI, bel=^G, + cbt=\EI, civis=\E"0, clear=^Z, cnorm=\E"2, cr=^M, cub1=^H, + cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c$<1>, + cuu1=^K, dch1=\EW, dim=\EG2, dl1=\ER, ed=\EY, el=\ET$<10>, + flash=\EK1$<200>\EK0, home=^^, ht=^I, ich1=\EQ, il1=\EE, + ind=^J, invis@, is1=\E"2\EG0\E], kbs=^H, kcbt=^A^Z\r, + kclr=^An\r, kcub1=^AL\r, kcud1=^AK\r, kcuf1=^AM\r, + kcuu1=^AJ\r, kdch1=\177, kf1=^A@\r, kf10=^AI\r, kf11=^A`\r, + kf12=^Aa\r, kf13=^Ab\r, kf14=^Ac\r, kf15=^Ad\r, kf16=^Ae\r, + kf17=^Af\r, kf18=^Ag\r, kf19=^Ah\r, kf2=^AA\r, kf20=^Ai\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khlp=^AO\r, khome=^AN\r, nel=^_, + rmacs=\E%%, rmcup=, smacs=\E$, smcup=\E"2\EG0\E], + smul=\EG1, tbc=\E0, use=adm+sgr, + +#### Motorola +# + +# Motorola EXORterm 155 from {decvax, ihnp4}!philabs!sbcs!megad!seth via BRL +# (Seth H Zirin) +ex155|Motorola Exorterm 155, + OTbs, am, bw, + OTkn#5, OTug#1, cols#80, lines#24, + cbt=\E[, clear=\EX, cub1=\ED, cud1=\EB, cuf1=\EC, + cup=\EE%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\ET, + el=\EU, home=\E@, ht=\EZ, kbs=^H, kcbt=\E[, kclr=\EX, kcub1=^H, + kcud1=^J, kcuf1=^L, kcuu1=^K, ked=\ET, kel=\EU, khome=\E@, + rmso=\Ec\ED, rmul=\Eg\ED, smso=\Eb\ED, smul=\Ef\ED, + +#### Omron +# +# This company is still around in 1995, manufacturing point-of-sale systems. + +omron|Omron 8025AG, + OTbs, am, da, db, + cols#80, lines#24, + bel=^G, clear=\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, cuu1=\EA, + cvvis=\EN, dch1=\EP, dl1=\EM, ed=\ER, el=\EK, home=\EH, + il1=\EL, ind=\ES, ri=\ET, rmso=\E4, smso=\Ef, + +#### Ramtek +# +# Ramtek was a vendor of high-end graphics terminals around 1979-1983; they +# were competition for things like the Tektronics 4025. +# + +# Ramtek 6221 from BRL, probably by Doug Gwyn +# The following SET-UP modes are assumed for normal operation: +# UNDERLINE_CURSOR ANSI_MODE AUTO_XON/XOFF_ON +# NEWLINE_OFF 80_COLUMNS +# Other SET-UP modes may be set for operator convenience or communication +# requirements; I recommend +# SMOOTH_SCROLL AUTO_REPEAT_ON 3_#_SHIFTED WRAP_AROUND_ON +# Hardware tabs are assumed to be every 8 columns; they can be set up by the +# "reset", "tset", or "tabs" utilities (use rt6221-w, 160 columns, for this). +# Note that the Control-E key is useless on this brain-damaged terminal. No +# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! +rt6221|Ramtek 6221 80x24, + OTbs, OTpt, msgr, xon, + OTkn#4, cols#80, it#8, lines#24, vt#3, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[>5l, + clear=\E[1;1H\E[J, cnorm=\E[>5h\E[>9h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^K, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, + cvvis=\E[>7h\E[>9l, ed=\E[J, el=\E[K, home=\E[1;1H, ht=^I, + hts=\EH, ind=^J, is2=\E)0, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf0=\EOP, kf1=\EOQ, kf2=\EOR, + kf3=\EOS, lf0=PF1, lf1=PF2, lf2=PF3, lf3=PF4, ll=\E[24;1H, + nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmkx=\E>, + rmso=\E[m, rmul=\E[m, + rs1=\E[1w\E[>37m\E[>39m\E[1v\E[20l\E[?3l\E[?6l\E[>5h\E[>6h + \E[>7h\E[>8l\E[>9h\E[>10l\E[1;24r\E[m\E[q\E(B\017\E)0\E# + 5\E>, + sc=\E7, sgr0=\E[m, smacs=^N, smkx=\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, +# [TO DO: Check out: short forms of ho/cl and ll; reset (\Ec)]. +rt6221-w|Ramtek 6221 160x48, + cols#160, lines#48, + ll=\E[48;1H, use=rt6221, + +#### RCA +# + +# RCA VP3301 or VP3501 +rca|rca vp3301/vp3501, + OTbs, + cols#40, lines#24, + clear=^L, cuf1=^U, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, home=^Z, rmso=\E\ES0, smso=\E\ES1, + + +#### Selanar +# + +# Selanar HiREZ-100 from BRL, probably by Doug Gwyn +# The following SET-UP modes are assumed for normal operation: +# SET_DEFAULT_TABS 48_LINES 80_COLUMNS +# ONLINE ANSI CURSOR_VISIBLE +# VT102_AUTO_WRAP_ON VT102_NEWLINE_OFF VT102_MONITOR_MODE_OFF +# LOCAL_ECHO_OFF US_CHAR_SET WPS_TERMINAL_DISABLED +# CPU_AUTO_XON/XOFF_ENABLED PRINT_FULL_SCREEN +# For use with graphics software, all graphics modes should be set to factory +# default. Other SET-UP modes may be set for operator convenience or +# communication requirements. No delays are specified; use "stty ixon -ixany" +# to enable DC3/DC1 flow control! +# I commented out the scrolling capabilities since they are too slow. +hirez100|Selanar HiREZ-100, + OTbs, OTpt, mir, msgr, xon, + OTkn#4, cols#80, it#8, lines#48, vt#3, + acsc=, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, + cr=^M, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\EM, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + hts=\EH, il=\E[%p1%dL, il1=\E[L, is2=\E<\E)0, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf0=\EOP, + kf1=\EOQ, kf2=\EOR, kf3=\EOS, lf0=PF1, lf1=PF2, lf2=PF3, + lf3=PF4, ll=\E[48H, mc0=\E[i, mc4=\E[4i\E[?4i, + mc5=\E[?5i\E[5i, nel=\EE, rc=\E8, rev=\E[7m, rmacs=^O, + rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, + rs1=\030\E2\E<\E[4i\E[?4i\E[12h\E[2;4;20l\E[?0;7h\E[?1;3;6;1 + 9l\E[r\E[m\E(B\017\E)0\E>, + sc=\E7, sgr0=\E[m, smacs=^N, smkx=\E[?1h\E=, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, +hirez100-w|Selanar HiREZ-100 in 132-column mode, + cols#132, use=hirez100, + +#### Signetics +# + +# From University of Wisconsin +vsc|Signetics Vsc Video driver by RMC, + am, msgr, + cols#80, it#8, lines#26, + clear=\E[;H\E[2J$<50/>, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, el=\E[K, home=\E[H, + ht=^I, ind=^J, kbs=^H, kcub1=^H, kcud1=^J, nel=^M^J, rev=^_\s, + rmso=^_!, rmul=^_#, sgr0=^_!, smso=^_\s, smul=^_", + +#### Soroc +# +# Alan Frisbie writes: +# +# As you may recall, the Soroc logo consisted of their name, +# with the letter "S" superimposed over an odd design. This +# consisted of a circle with a slightly smaller 15 degree (approx.) +# wedge with rounded corners inside it. The color was sort of +# a metallic gold/yellow. +# +# If I had been more of a beer drinker it might have been obvious +# to me, but it took a clue from their service department to make +# me exclaim, "Of course!" The circular object was the top of +# a beer can (the old removable pop-top style) and "Soroc" was an +# anagram for "Coors". +# +# I can just imagine the founders of the company sitting around +# one evening, tossing back a few and trying to decide what to +# call their new company and what to use for a logo. +# + +# (soroc120: removed obsolete ":ma=^K^P^R^L^L :" -- esr) +soroc120|iq120|soroc|soroc iq120, + clear=\E*$<2>, cud1=^J, ed=\EY, el=\ET, kcub1=^H, kcud1=^J, + kcuf1=^L, kcuu1=^K, use=adm3a, +soroc140|iq140|soroc iq140, + OTbs, am, mir, + cols#80, lines#24, + bel=^G, cbt=\EI, clear=\E+, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\Ew, + dl1=\Er$<.7*>, ed=\Ey, el=\Et, home=^^, il1=\Ee$<1*>, ind=^J, + kbs=^H, kcuf1=^L, kcuu1=^K, kf0=^A0\r, kf1=^A@\r, kf2=^AA\r, + kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, kf6=^AE\r, kf7=^AF\r, + kf8=^AG\r, kf9=^AH\r, khome=^^, ll=^^^K, rmir=\E8, + rmso=\E\177, rmul=\E^A, smir=\E9, smso=\E\177, smul=\E^A, + +#### Southwest Technical Products +# +# These guys made an early personal micro called the M6800. +# The ct82 was probably its console terminal. +# + +# (swtp: removed obsolete ":bc=^D:" -- esr) +swtp|ct82|southwest technical products ct82, + am, + cols#82, lines#20, + bel=^G, clear=^L, cr=^M, cub1=^D, cud1=^J, cuf1=^S, + cup=\013%p2%c%p1%c, cuu1=^A, dch1=^\^H, dl1=^Z, ed=^V, el=^F, + home=^P, ich1=^\^X, il1=^\^Y, ind=^N, + is2=\034\022\036\023\036\004\035\027\011\023\036\035\036 + \017\035\027\022\011, + ll=^C, ri=^O, rmso=^^^F, smso=^^^V, + +#### Synertek +# +# Bob Manson writes (28 Apr 1995): +# +# Synertek used to make ICs, various 6502-based single-board process +# control and hobbyist computers, and assorted peripherals including a +# series of small inexpensive terminals (I think they were one of the +# first to have a "terminal-on-a-keyboard", where the terminal itself +# was only slightly larger than the keyboard). +# +# They apparently had a KTM-1 model, which I've never seen. The KTM-2/40 +# was a 40x24 terminal that could connect to a standard TV through a +# video modulator. The KTM-2/80 was the 80-column version (the 2/40 +# could be upgraded to the 2/80 by adding 2 2114 SRAMs and a new ROM). +# I have a KTM-2/80 still in working order. The KTM-2s had fully +# socketed parts, used 2 6507s, a 6532 as keyboard scanner, a program +# ROM and 2 ROMs as character generators. They were incredibly simple, +# and I've never had any problems with mine (witness the fact that mine +# was made in 1981 and is still working great... I've blown the video +# output transistor a couple of times, but it's a 2N2222 :-) +# +# The KTM-3 (which is what is listed in the terminfo file) was their +# attempt at putting a KTM-2 in a box (and some models came with a +# CRT). It wasn't much different from the KTM-2 hardware-wise, but the +# control and escape sequences are very different. The KTM-3 was always +# real broken, at least according to the folks I've talked to about it. +# +# The padding in the entry is probably off--these terminals were very +# slow (it takes like 100ms for the KTM-2 to clear the screen...) And +# anyone with any sanity replaced the ROMs with something that provided +# a reasonable subset of VT100 functionality, since the usual ROMs were +# obviously very primitive... oh, you could get an upgraded ROM from +# Synertek for some incredible amount of money, but what hacker with an +# EPROM burner would do that? :) +# +# Sorry I don't have any contact info; I believe they were located in +# Sunnyvale, and I'm fairly sure they are still manufacturing ICs +# (they've gone to ASICs and FPGAs), but I doubt they're in the computer +# business these days. +# + +# Tested, seems to work fine with vi. +synertek|ktm|synertek380|synertek ktm 3/80 tubeless terminal, + am, + cols#80, lines#24, + clear=^Z, cub1=^H, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EJ, el=\EK, + +#### Tab Office Products +# +# TAB Products Co. - Palo Alto, California +# Electronic Office Products, +# 1451 California Avenue 94304 +# +# I think they're out of business. +# + +# The tab 132 uses xon/xoff, so no padding needed. +# / have nothing to do with arrow keys. +# sets 80 col mode, normal video, autowrap on (for ). +# Seems to be no way to get rid of status line. +# The manual for this puppy was dated June 1981. It claims to be VT52- +# compatible but looks more vt100-like. +tab132|tab|tab132-15|tab 132/15, + da, db, + OTdN@, cols#80, lines#24, lm#96, + cud1=^J, cup=\E[%i%p1%d;%p2%dH, dch1=\E[P, dl1=\E[M, + il1=\E[L, is2=\E[?7h\E[?3l\E[?5l, kcub1=\E[D, kcud1=\E[B, + kcuu1=\E[A, rmir=\E[4l, rmkx@, smir=\E[4h, smkx@, use=vt100, +tab132-w|tab132 in wide mode, + cols#132, + is2=\E[?7h\E[?3h\E[?5l, use=tab132, +tab132-rv|tab132 in reverse-video mode, + is2=\E[?7h\E[?3l\E[?5h, use=tab132, +tab132-w-rv|tab132 in reverse-video/wide mode, + is2=\E[?7h\E[?3h\E[?5h, use=tab132-w, + + +#### Teleray +# +# Research Incorporated +# 6425 Flying Cloud Drive +# Eden Prairie, MN 55344 +# Vox: (612)-941-3300 +# +# The Teleray terminals were all discontinued in 1992-93. RI still services +# and repairs these beasts, but no longer manufactures them. The Teleray +# people believe that all the types listed below are very rare now (1995). +# There was a newer line of Telerays (Model 7, Model 20, Model 30, and +# Model 100) that were ANSI-compatible. +# +# Note two things called "teleray". Reorder should move the common one +# to the front if you have either. A dumb teleray with the cursor stuck +# on the bottom and no obvious model number is probably a 3700. +# + +t3700|dumb teleray 3700, + OTbs, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, ind=^J, +t3800|teleray 3800 series, + OTbs, + cols#80, it#8, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=\EJ, el=\EK, + home=\EH, ht=^I, ind=^J, ll=\EY7\s, +t1061|teleray|teleray 1061, + OTbs, am, km, xhp, xt, + cols#80, it#8, lines#24, xmc#1, + bel=^G, clear=\014$<1>, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, + dl1=\EM$<2*>, ed=\EJ$<1>, el=\EK, home=\EH, ht=^I, hts=\EF, + ich1=\EP, il1=\EL$<2*>, ind=^J, ip=$<0.4*>, + is2=\Ee\EU01^Z1\EV\EU02^Z2\EV\EU03^Z3\EV\EU04^Z4\EV\EU05^Z5 + \EV\EU06^Z6\EV\EU07^Z7\EV\EU08^Z8\EV\Ef, + kf1=^Z1, kf2=^Z2, kf3=^Z3, kf4=^Z4, kf5=^Z5, kf6=^Z6, kf7=^Z7, + kf8=^Z8, rmso=\ER@, rmul=\ER@, smso=\s\ERD, smul=\ERH, + tbc=\EG, +t1061f|teleray 1061 with fast PROMs, + dl1=\EM, il1=\EL, ip@, use=t1061, +# "Teleray Arpa Special", officially designated as +# "Teleray Arpa network model 10" with "Special feature 720". +# This is the new (1981) fast microcode updating the older "arpa" proms +# (which gave meta-key and programmable-fxn keys). 720 is much much faster, +# converts the keypad to programmable function keys, and has other goodies. +# Standout mode is still broken (magic cookie, etc) so is suppressed as no +# programs handle such lossage properly. +# Note: this is NOT the old termcap's "t1061f with fast proms." +# From: J. Lepreau Tue Feb 1 06:39:37 1983, Univ of Utah +# (t10: removed overridden ":so@:se@:us@:ue@:" -- esr) +t10|teleray 10 special, + OTbs, km, xhp, xt, + cols#80, it#8, lines#24, xmc#2, + clear=\Ej$<30/>, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EQ, + dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\EP, il1=\EL, + ind=\Eq, pad=\0, ri=\Ep, rmso=\ER@, rmul=\ER@, smso=\ERD, + smul=\ERH, +# teleray 16 - map the arrow keys for vi/rogue, shifted to up/down page, and +# back/forth words. Put the function keys (f1-f10) where they can be +# found, and turn off the other magic keys along the top row, except +# for line/local. Do the magic appropriate to make the page shifts work. +# Also toggle ^S/^Q for those of us who use Emacs. +t16|teleray 16, + am, da, db, mir, xhp, xt, + cols#80, lines#24, + bel=^G, clear=\E[H\E[2J, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=%i\E[%p1%d;%p2%df, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[0J, el=\E[0K, home=\E[H, ht=^I, il1=\E[L, + ind=^J, kf1=^Z1, kf10=^Z0, kf2=^Z2, kf3=^Z3, kf4=^Z4, kf5=^Z5, + kf6=^Z6, kf7=^Z7, kf8=^Z8, kf9=^Z9, ri=\E[T, + rmcup=\E[V\E[24;1f\E[?38h, rmir=\E[4l, rmso=\E[m, + rmul=\E[m, sgr0=\E[m, smcup=\E[U\E[?38l, smir=\E[4h, + smso=\E[7m, smul=\E[4m, + +#### Texas Instruments (ti) +# + +# The Silent 700 was so called because it was built around a quiet thermal +# printer. It was portable, equipped with an acoustic coupler, and pretty +# neat for its day. +ti700|ti733|ti735|ti745|ti800|ti silent 700/733/735/745 or omni 800, + OTbs, hc, os, + cols#80, + bel=^G, cr=\r$<162>, cub1=^H, cud1=^J, ind=^J, + +# +# Texas Instruments 916 VDT 7 bit control mode +# +ti916|ti916-220-7|Texas Instruments 916 VDT 8859/1 vt220 mode 7 bit CTRL, + da, db, in, msgr, + cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[2J$<6>, + cnorm=\E[?25h, cub=\E[%p1%dD, cud=\E[%p1%dB, + cuf=\E[%p1%dC, cup=\E[%p1%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + dch=\E[%p1%dP$<250>, dch1=\E[P, dl=\E[%p1%dM, + ech=\E[%p1%dX$<20>, ed=\E[J$<6>, el=\E[0K, el1=\E[1K, + enacs=\E(B\E)0, ff=^L, flash=\E[?5h\E[?5l$<6>, + hpa=\E[%p1%{1}%+%dG, hts=\E[0W, ich=\E[%p1%d@$<250>, + il=\E[%p1%dL$<36>, ip=$<10>, is2=\E[1;24r\E[24;1H, + kcmd=\E[29~, kdch1=\E[P, kent=^J, kf1=\E[17~, kf10=\E[28~, + kf11=\E[29~, kf12=\E[31~, kf2=\E[18~, kf3=\E[19~, + kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, + kf9=\E[26~, khome=\E[H, kich1=\E[@, knp=\E[S, kpp=\E[T, + kprt=^X, prot=\E&, rmacs=\017$<2>, rs2=\E[!p, sgr@, + smacs=\016$<2>, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, + use=vt220, +# +# Texas Instruments 916 VDT 8 bit control mode +# +ti916-8|ti916-220-8|Texas Instruments 916 VDT 8859/1 8 vt220 mode bit CTRL, + kcmd=\23329~, kcub1=\233D, kcud1=\233B, kcuf1=\233C, + kcuu1=\233A, kdch1=\233P, kent=^J, kf1=\23317~, + kf10=\23328~, kf11=\23329~, kf12=\23331~, kf2=\23318~, + kf3=\23319~, kf4=\23320~, kf5=\23321~, kf6=\23323~, + kf7=\23324~, kf8=\23325~, kf9=\23326~, khome=\233H, + kich1=\233@, knp=\233S, kpp=\233T, kprt=^X, use=ti916, +# +# Texas Instruments 916 VDT 8859/1 7 bit control 132 column mode +# +ti916-132|Texas Instruments 916 VDT vt220 132 column, + cols#132, use=ti916, +# +# Texas Instruments 916 VDT 8859/1 8 bit control 132 column mode +# +ti916-8-132|Texas Instruments 916 VDT 8-bit vt220 132 column, + cols#132, use=ti916-8, +ti924|Texas Instruments 924 VDT 8859/1 7 bit CTRL, + OTbs, am, xon, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[2J\E[H, cnorm=\E[?25h, cr=^M, + csr=%i\E[%p1%d;%p2%dr, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E[?31h, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, + il1=\E[L, ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[P, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\E[16~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, kich1=\E[@, rc=\E8, rev=\E[7m, + ri=\EM, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, smso=\E[7m, + smul=\E[4m, tbc=\E[3g, +ti924-8|Texas Instruments 924 VDT 8859/1 8 bit CTRL, + am, xon, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, + clear=\E[2J\E[H, cnorm=\E[?25h, cr=^M, + csr=%i\E[%p1%d;%p2%dr, cub1=\E[D, cud1=\E[B, cuf1=\E[C, + cup=%i\E[%p1%d;%p2%dH, cuu1=\E[A, cvvis=\E[?31h, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, hts=\EH, + il1=\E[L, ind=\ED, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\233P, kf1=\217P, kf2=\217Q, + kf3=\217R, kf4=\217S, kf5=\23316~, kf6=\23317~, + kf7=\23318~, kf8=\23319~, kf9=\23320~, kich1=\233@, rc=\E8, + rev=\E[7m, ri=\EM, rmso=\E[m, rmul=\E[m, sc=\E7, sgr0=\E[m, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, +ti924w|Texas Instruments 924 VDT 7 bit - 132 column mode, + cols#132, use=ti924, +ti924-8w|Texas Instruments 924 VDT 8 bit - 132 column mode, + cols#132, use=ti924-8, +ti931|Texas Instruments 931 VDT, + OTbs, am, xon, + cols#80, lines#24, + bel=^G, blink=\E4P, clear=\EL, cnorm=\E4@, cr=^M, cub1=\ED, + cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, + cuu1=\EA, dch1=\EQ, dl1=\EO, ed=\EJ, el=\EI, home=\EH, + ich1=\ER\EP\EM, il1=\EN, ind=\Ea, invis=\E4H, + is2=\EGB\E(@B@@\E), kcub1=\ED, kcud1=\EB, kcuf1=\EC, + kcuu1=\EA, kdch1=\EQ, kdl1=\EO, kf1=\Ei1, kf2=\Ei2, kf3=\Ei3, + kf4=\Ei4, kf5=\Ei5, kf6=\Ei6, kf7=\Ei7, kf8=\Ei8, kf9=\Ei9, + kich1=\EP, kil1=\EN, rev=\E4B, ri=\Eb, rmso=\E4@, rmul=\E4@, + sgr0=\E4@, smso=\E4A, smul=\E4D, +ti926|Texas Instruments 926 VDT 8859/1 7 bit CTRL, + csr@, ind=\E[1S, ri=\E[1T, use=ti924, +# (ti926-8: I corrected this from the broken SCO entry -- esr) +ti926-8|Texas Instruments 926 VDT 8859/1 8 bit CTRL, + csr@, ind=\2331S, ri=\2331T, use=ti924-8, +ti_ansi|basic entry for ti928, + am, bce, eo, xenl, xon, + colors#8, cols#80, it#8, lines#25, pairs#64, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[2J\E[H, + cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, + dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, ich1=\E[@, + il1=\E[L, ind=\E[S, kbs=^H, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kend=\E[F, kf0=\E[V, kf1=\E[M, + kf2=\E[N, kf3=\E[O, kf4=\E[P, kf5=\E[Q, kf6=\E[R, kf7=\E[S, + kf8=\E[T, kf9=\E[U, khome=\E[H, knp=\E[G, kpp=\E[I, + op=\E[37;40m, ri=\E[T, rmso=\E[m, rmul=\E[m, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m, + smso=\E[7m, smul=\E[4m, +# +# 928 VDT 7 bit control mode +# +ti928|Texas Instruments 928 VDT 8859/1 7 bit CTRL, + kdch1=\E[P, kend=\E_1\E\\, kent=\E[8~, kf1=\E[17~, + kf10=\E[28~, kf11=\E[29~, kf12=\E[31~, kf13=\E[32~, + kf15=\E[34~, kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, + kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, + kich1=\E[@, knp=\E[S, kpp=\E[T, kprt=\E[35~, use=ti_ansi, +# +# 928 VDT 8 bit control mode +# +ti928-8|Texas Instruments 928 VDT 8859/1 8 bit CTRL, + kdch1=\233P, kend=\2371\234, kent=\2338~, kf1=\23317~, + kf10=\23328~, kf11=\23329~, kf12=\23331~, kf13=\23332~, + kf15=\23334~, kf2=\23318~, kf3=\23319~, kf4=\23320~, + kf5=\23321~, kf6=\23323~, kf7=\23324~, kf8=\23325~, + kf9=\23326~, khome=\233H, kich1=\233@, knp=\233S, + kpp=\233T, kprt=\23335~, use=ti_ansi, + +#### Zentec (zen) +# + +# (zen30: removed obsolete :ma=^L ^R^L^K^P:. This entry originally +# had just =\EG6 which I think means standout was supposed to be +# dim-reverse using ADM12-style attributes. ADM12 / and +# might work-- esr) +zen30|z30|zentec 30, + OTbs, am, mir, ul, + cols#80, lines#24, + bel=^G, clear=\E*, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW, + dim=\EG2, dl1=\ER$<1.5*>, ed=\EY, el=\ET$<1.0*>, home=^^, + il1=\EE$<1.5*>, ind=^J, rmir=\Er, rmul@, smir=\Eq, smso=\EG6, + smul@, use=adm+sgr, +# (zen50: this had extension capabilities +# :BS=^U:CL=^V:CR=^B: +# UK/DK/RK/LK/HM were someone's aliases for ku/kd/kl/kr/kh, +# which were also in the original entry -- esr) +# (zen50: removed obsolete ":ma=^Hh^Ll^Jj^Kk:" -- esr) +zen50|z50|zentec zephyr, + OTbs, am, + cols#80, lines#24, xmc#1, + clear=\E+, cub1=^H, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, + cuu1=^K, dch1=\EW, dl1=\ER, ed=\EY, el=\ET, ich1=\EQ, il1=\EE, + invis@, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, + rmul@, smul@, use=adm+sgr, + +# CCI 4574 (Office Power) from Will Martin via BRL +cci|cci1|z8001|zen8001|CCI Custom Zentec 8001, + OTbs, am, bw, + cols#80, lines#24, + blink=\EM", clear=\EH\EJ, cnorm=\EP, + csr=\ER%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=^J, + cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, + cvvis=\EF\EQ\EM \ER 7, dim=\EM!, ed=\EJ, el=\EK, home=\EH, + invis=\EM(, is2=\EM \EF\ET\EP\ER 7, kbs=^H, kcub1=\ED, + kcud1=\EB, kcuf1=\EC, kcuu1=\EA, khome=\EH, mc4=^T, mc5=^R, + rev=\EM$, ri=\EI, rmso=\EM\s, rmul=\EM\s, sgr0=\EM\s, + smso=\EM$, smul=\EM0, + +######## OBSOLETE UNIX CONSOLES +# + +#### Apollo consoles +# +# Apollo got bought by Hewlett-Packard. The Apollo workstations are +# labeled HP700s now. +# + +# From: Gary Darland +apollo|apollo console, + OTbs, am, mir, + cols#88, lines#53, + clear=^L, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\EM%p1%{32}%+%c%p2%d), cuu1=\EA, dch1=\EP, dl1=\EL, + ed=\EJ, el=\EK, hpa=\EN%p1%d, il1=\EI, ind=\EE, ri=\ED, + rmcup=\EX, rmir=\ER, rmso=\ET, rmul=\EV, smcup=\EW, smir=\EQ, + smso=\ES, smul=\EU, vpa=\EO+\s, + +# We don't know whether or not the apollo guys replicated DEC's firmware bug +# in the VT132 that reversed /. To be on the safe side, disable +# both these capabilities. +apollo_15P|apollo 15 inch display, + rmir@, smir@, use=vt132, +apollo_19L|apollo 19 inch display, + rmir@, smir@, use=vt132, +apollo_color|apollo color display, + rmir@, smir@, use=vt132, + +#### AT&T consoles + +# This actually describes the generic SVr4 display driver for Intel boxes. +# The isn't documented and therefore may not be reliable. +# From: Eric Raymond Mon Nov 27 19:00:53 EST 1995 +att6386|at386|386at|AT&T WGS 6386 console, + am, bw, eo, xon, + cols#80, it#8, lines#25, + acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[=C, + clear=\E[2J\E[H, cnorm=\E[=1C, cr=^M, cub=\E[%p1%dD, + cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, + dl=\E[%p1%dM, dl1=\E[1M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[1@, il=\E[%p1%dL, il1=\E[1L, ind=\E[S, + indn=\E[%p1%dS, invis=\E[9m, is2=\E[0;10;39m, kbs=^H, + kcbt=^], kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[P, kend=\E[Y, kf1=\EOP, kf10=\EOY, kf11=\EOZ, + kf12=\EOA, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, + kf7=\EOV, kf8=\EOW, kf9=\EOX, khome=\E[H, kich1=\E[@, + knp=\E[U, kpp=\E[V, krmir=\E0, nel=\r\E[S, rc=\E8, rev=\E[7m, + ri=\E[T, rin=\E[%p1%dT, rmacs=\E[10m, rmso=\E[m, rmul=\E[m, + sc=\E7, + sgr=\E[10m\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t; + 2%;%?%p6%t;1%;%?%p9%t;12%e;10%;%?%p7%t;9%;m, + sgr0=\E[0;10m, smacs=\E[12m, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, vpa=\E[%i%p1%dd, use=klone+color, +# (pc6300plus: removed ":KM=/usr/lib/ua/kmap.s5:"; renamed BO/EE/CI/CV -- esr) +pc6300plus|AT&T 6300 plus, + OTbs, am, xon, + cols#80, lines#24, + bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[=C, + clear=\E[2J\E[H, cnorm=\E[=1C, cr=^M, cub1=^H, cud1=\E[B, + cuf1=\E[C, cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, + dch1=\E[1P, dim=\E[2m, dl1=\E[1M, ed=\E[0J, el=\E[0K, + home=\E[H, hts=\EH, ich1=\E[1@, il1=\E[1L, ind=^J, + invis=\E[9m, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kf1=\EOc, kf10=\EOu, kf2=\EOd, kf3=\EOe, + kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, kf9=\EOk, + nel=^M^J, rev=\E[7m, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, + +# From: Benjamin C. W. Sittler +# +# I have a UNIX PC which I use as a terminal attached to my Linux PC. +# Unfortunately, the UNIX PC terminfo entry that comes with ncurses +# is broken. All the special key sequences are broken, making it unusable +# with Emacs. The problem stems from the following: +# +# The UNIX PC has a plethora of keys (103 of them, and there's no numeric +# keypad!), loadable fonts, and strange highlighting modes ("dithered" +# half-intensity, "smeared" bold, and real strike-out, for example.) It also +# uses resizable terminal windows, but the bundled terminal program always +# uses an 80x24 window (and doesn't support seem to support a 132-column +# mode.) +# +# HISTORY: The UNIX PC was one of the first machines with a GUI, and used a +# library which was a superset of SVr3.5 curses (called tam, for "terminal +# access method".) tam includes support for real, overlapping windows, +# onscreen function key labels, and bitmap graphics. But since the primary +# user interface on the UNIX PC was a GUI program (ua, for "user +# assistant",) and remote administration was considered important for the +# machine, tam also supported VT100-compatible terminals attached to the +# serial port or used across the StarLan network. To simulate the extra keys +# not present on a VT100, users could press ESC and a two-letter sequence, +# such as u d (Undo) or U D (Shift-Undo.) These two-letter sequences, +# however, were not the same as those sent by the actual Undo key. The +# actual Undo key sends ESC 0 s unshifted, and ESC 0 S shifted, for example. +# (If you're interested in adding some of the tam calls to ncurses, btw, I +# have the full documentation and several programs which use tam. It also +# used an extended terminfo format to describe key sequences, special +# highlighting modes, etc.) +# +# KEYS: This means that ncurses would quite painful on the UNIX PC, since +# there are two sequences for every key-modifier combination (local keyboard +# sequence and remote "VT100" sequence.) But I doubt many people are trying +# to use ncurses on the UNIX PC, since ncurses doesn't properly handle the +# GUI. Unfortunately, the terminfo entry (and the termcap, too, I presume) +# seem to have been built from the manual describing the VT100 sequences. +# This means it doesn't work for a real live UNIX PC. +# +# FONTS: The UNIX PC also has a strange interpretation of "alternate +# character set". Rather than the VT100 graphics you might expect, it allows +# up to 8 custom fonts to be loaded at any given time. This means that +# programs expecting VT100 graphics will usually be disappointed. For this +# reason I have disabled the smacs/rmacs sequences, but they could easily be +# re-enabled. Here are the relevant control sequences (from the ESCAPE(7) +# manpage), should you wish to do so: +# +# SGR10 - Select font 0 - ESC [ 10 m or SO +# SGR11 - Select font 1 - ESC [ 11 m or SI +# SGR12 - Select font 2 - ESC [ 12 m +# ... (etc.) +# SGR17 - Select font 7 - ESC [ 17 m +# +# Graphics for line drawing are not reliably found at *any* character +# location because the UNIX PC has dynamically reloadable fonts. I use font +# 0 for regular text and font 1 for italics, but this is by no means +# universal. So ASCII line drawing is in order if smacs/rmacs are enabled. +# +# MISC: The cursor visible/cursor invisible sequences were swapped in the +# distributed terminfo. +# +# To ameliorate these problems (and fix a few highlighting bugs) I rewrote +# the UNIX PC terminfo entry. The modified version works great with Lynx, +# Emacs, and XEmacs running on my Linux PC and displaying on the UNIX PC +# attached by serial cable. In Emacs, even the Undo key works, and many +# applications can now use the F1-F8 keys. +# +# esr's notes: +# Terminfo entry for the AT&T Unix PC 7300 +# from escape(7) in Unix PC 7300 Manual. +# Somewhat similar to a vt100-am (but different enough +# to redo this from scratch.) +# +# /*************************************************************** +# * +# * FONT LOADING PROGRAM FOR THE UNIX PC +# * +# * This routine loads a font defined in the file ALTFONT +# * into font memory slot #1. Once the font has been loaded, +# * it can be used as an alternative character set. +# * +# * The call to ioctl with the argument WIOCLFONT is the key +# * to this routine. For more information, see window(7) in +# * the PC 7300 documentation. +# ***************************************************************/ +# #include /* needed for strcpy call */ +# #include /* needed for ioctl call */ +# #define FNSIZE 60 /* font name size */ +# #define ALTFONT "/usr/lib/wfont/special.8.ft" /* font file */ +# /* +# * The file /usr/lib/wfont/special.8.ft comes with the +# * standard PC software. It defines a graphics character set +# * similar to that of the Teletype 5425 terminal. To view +# * this or other fonts in /usr/lib/wfont, use the command +# * cfont . For further information on fonts see +# * cfont(1) in the PC 7300 documentation. +# */ +# +# struct altfdata /* structure for alt font data */ +# { +# short altf_slot; /* memory slot number */ +# char altf_name[FNSIZE]; /* font name (file name) */ +# }; +# ldfont() +# { +# int wd; /* window in which altfont will be */ +# struct altfdata altf; +# altf.altf_slot=1; +# strcpy(altf.altf_name,ALTFONT); +# for (wd =1; wd < 12; wd++) { +# ioctl(wd, WIOCLFONT,&altf); +# } +# } +# +# (att7300: added /// from the BSDI entry, +# they're confirmed by the man page for the System V display---esr) +# +att7300|unixpc|pc7300|3b1|s4|AT&T UNIX PC Model 7300, + am, xon, + cols#80, it#8, lines#24, + bel=^G, blink=\E[9m, bold=\E[1m, cbt=\E^I, civis=\E[=1C, + clear=\E[2J\E[H, cnorm=\E[=0C, cr=^M, cub=\E[%p1%dD, + cub1=^H, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, + cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, + cuu1=\E[A, dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, + ed=\E[0J, el=\E[0K, home=\E[H, ich1=\E[@, il=\E[%p1%dL, + il1=\E[L, ind=^J, invis=\E[9m, is1=\017\E[=1w, kBEG=\ENB, + kCAN=\EOW, kCPY=\END, kCRT=\EON, kDC=\ENF, kDL=\ENE, + kEND=\ENN, kEOL=\EOA, kFND=\EOX, kHLP=\EOM, kHOM=\ENM, + kIC=\ENJ, kLFT=\ENK, kMOV=\ENC, kNXT=\ENH, kOPT=\EOR, + kPRV=\ENG, kRDO=\EOT, kRIT=\ENL, kRPL=\EOY, kSAV=\EOO, + kUND=\EOS, kbeg=\ENb, kbs=^H, kcan=\EOw, kcbt=\E[Z, + kclo=\EOV, kclr=\E[J, kcmd=\EOu, kcpy=\ENd, kcrt=\EOn, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\ENf, + ked=\E[J, kel=\EOa, kend=\E0, kext=\EOk, kf1=\EOc, kf2=\EOd, + kf3=\EOe, kf4=\EOf, kf5=\EOg, kf6=\EOh, kf7=\EOi, kf8=\EOj, + kfnd=\EOx, khlp=\EOm, khome=\E[H, kich1=\ENj, kind=\E[B, + kmov=\ENc, kmrk=\ENi, knp=\E[U, knxt=\ENh, kopn=\EOv, + kopt=\EOr, kpp=\E[V, kprt=\EOz, kprv=\ENg, krdo=\EOt, + kref=\EOb, krfr=\ENa, kri=\E[A, krpl=\EOy, krst=\EOB, + ksav=\EOo, kslt=\ENI, kund=\EOs, nel=\EE, rev=\E[7m, ri=\EM, + rmso=\E[m, rmul=\E[m, sgr0=\E[0;10m, smso=\E[7m, + smul=\E[4m, + +#### Convergent Technology +# +# Burroughs bought Convergent shortly before it merged with Univac. +# CTOS is (I believe) dead. Probably the aws is too (this entry dates +# from 1991 or earlier). +# + +# Convergent AWS workstation from Gould/SEL UTX/32 via BRL +# (aws: removed unknown :dn=^K: -- esr) +aws|Convergent Technologies AWS workstation under UTX and Xenix, + am, + OTug#0, cols#80, lines#28, xmc#0, + OTbc=^H, OTma=\016h\013j\001k\022l\002m, OTnl=^J, acsc=, + clear=^L, cud1=^K, cuf1=^R, cup=\EC%p2%c%p1%c, cuu1=^A, + dch1=\EDC, dl1=\EDL, ed=\EEF, el=\EEL, hpa=\EH%p1%c, + ich1=\EIC, il1=\EIL, ind=\ESU, kbs=^H, kcub1=^N, kcud1=^K, + kcuf1=^R, kcuu1=^A, ri=\ESD, rmacs=\EAAF, rmso=\EARF, + rmul=\EAUF, smacs=\EAAN, smso=\EARN, smul=\EAUN, + vpa=\EV%p1%c, +awsc|Convergent Technologies AWS workstation under CTOS, + am, + OTug#0, cols#80, lines#24, xmc#0, + OTbc=^N, OTma=\016h\013j\001k\022l\002m, acsc=, clear=^L, + cud1=^K, cuf1=^R, cup=\EC%p2%c%p1%c, cuu1=^A, ed=\EEF, + el=\EEL, kbs=^H, kcub1=^N, kcud1=^K, kcuf1=^R, kcuu1=^A, + rmacs=\EAAF, rmso=\EAA, rmul=\EAA, smacs=\EAAN, smso=\EAE, + smul=\EAC, + +#### DEC consoles +# + +# The MicroVax console. Tim Theisen writes: +# The digital uVax II's had a graphic display called a qdss. It was +# supposed to be a high performance graphic accelerator, but it was +# late to market and barely appeared before faster dumb frame buffers +# appeared. I have only used this display while running X11. However, +# during bootup, it was in text mode, and probably had a terminal emulator +# within it. And that is what your termcap entry is for. In graphics +# mode the screen size is 1024x864 pixels. +qdss|qdcons|qdss glass tty, + OTbs, am, + cols#128, lines#57, + clear=\032$<1/>, cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%c%p2%c, cuu1=^K, + +#### Fortune Systems consoles +# +# Fortune made a line of 68K-based UNIX boxes that were pretty nifty +# in their day; I (esr) used one myself for a year or so around 1984. +# They had no graphics, though, and couldn't compete against Suns and +# the like. R.I.P. +# + +# From: Robert Nathanson via tut Wed Oct 5, 1983 +# (This had extension capabilities +# :rv=\EH:re=\EI:rg=0:GG=0:\ +# :CO=\E\\:WL=^Aa\r:WR=^Ab\r:CL=^Ac\r:CR=^Ad\r:DL=^Ae\r:RF=^Af\r:\ +# :RC=^Ag\r:CW=^Ah\r:NU=^Aj\r:EN=^Ak\r:HM=^Al:PL=^Am\r:\ +# :PU=^An\r:PD=^Ao\r:PR=^Ap\r:HP=^A@\r:RT=^Aq\r:TB=\r:CN=\177:MP=\E+F: +# It had both ":bs:" and ":bs=^H:"; I removed the latter. Also, it had +# ":sg=0:" and ":ug=0:"; evidently the composer was trying (unnecessarily) +# to force both magic cookie glitches off. Once upon a time, I +# used a Fortune myself, so I know the capabilities of the form ^A[a-z]\r are +# function keys; thus the "Al" value for HM was certainly an error. I renamed +# EN/PD/PU/CO/CF/RT according to the XENIX/TC mappings, but not HM/DL/RF/RC. +# I think :rv: and :re: are start/end reverse video and :rg: is a nonexistent +# "reverse-video-glitch" capability; I have put :rv: and :re: in with standard +# names below. I've removed obsolete ":nl=5^J:" as there is a :do: -- esr) +fos|fortune|Fortune system, + OTbs, am, bw, + cols#80, lines#25, + acsc=j*k(l m"q&v%w#x-, bel=^G, blink=\EN, civis=\E], + clear=\014$<20>, cnorm=\E\\, cr=^M, cub1=^H, cud1=\n$<3>, + cup=\034C%p1%{32}%+%c%p2%{32}%+%c, cuu1=\013$<3>, + cvvis=\E\:, dch1=\034W$<5>, dl1=\034R$<15>, + ed=\034Y$<3*>, el=^\Z, home=\036$<10>, ht=^Z, + ich1=\034Q$<5>, il1=\034E$<15>, ind=^J, is2=^_.., kbs=^H, + kcub1=^Aw\r, kcud1=^Ay\r, kcuf1=^Az\r, kcuu1=^Ax\r, + kend=^Ak\r, kent=^Aq, kf1=^Aa\r, kf2=^Ab\r, kf3=^Ac\r, + kf4=^Ad\r, kf5=^Ae\r, kf6=^Af\r, kf7=^Ag\r, kf8=^Ah\r, + khome=^A?\r, knp=^Ao\r, kpp=^An\r, nel=^M^J, rev=\EH, + rmacs=^O, rmso=^\I`, rmul=^\IP, sgr0=\EI, smacs=\Eo, + smso=^\H`, smul=^\HP, + +#### Masscomp consoles +# +# Masscomp has gone out of business. Their product line was purchased by +# comany in Georgia (US) called "XS International", parts and service may +# still be available through them. +# + +# (masscomp: ":MT:" changed to ":km:"; -- esr) +masscomp|masscomp workstation console, + OTbs, km, mir, + cols#80, it#8, lines#24, + clear=\E[2J, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, ht=^I, il1=\E[L, is2=\EGc\EGb\EGw, kbs=^H, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rmir=\E[4l, + rmso=\E[m, rmul=\EGau, smir=\E[4h, smso=\E[7m, smul=\EGu, +masscomp1|masscomp large screen version 1, + cols#104, lines#36, use=masscomp, +masscomp2|masscomp large screen version 2, + cols#64, lines#21, use=masscomp, + +#### OSF Unix +# + +# OSF/1 1.1 Snapshot 2 +pmcons|pmconsole|PMAX console, + am, + cols#128, lines#57, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuu1=^K, ht=^I, + ind=^J, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + +#### Other consoles +# The following is a version of the ibm-pc entry distributed with PC/IX, +# (Interactive Systems' System 3 for the Big Blue), modified by Richard +# McIntosh at UCB/CSM. The :pt: and :uc: have been removed from the original, +# (the former is untrue, and the latter failed under UCB/man); standout and +# underline modes have been added. Note: this entry describes the "native" +# capabilities of the PC monochrome display, without ANY emulation; most +# communications packages (but NOT PC/IX connect) do some kind of emulation. +pcix|PC/IX console, + am, bw, eo, + cols#80, lines#24, + clear=\Ec, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%2d;%p2%2dH, cuu1=\E[A, ed=\E[J, el=\E[K, + home=\E[H, rmso=\E[m, rmul=\E[m, sgr0=\E[m, smso=\E[7m, + smul=\E[4m, + +# (ibmpcx: this entry used to be known as ibmx. +# It formerly included the following extension capabilities: +# :GC=b:GL=v:GR=t:RT=^J:\ +# :GH=\E[196g:GV=\E[179g:\ +# :GU=\E[193g:GD=\E[194g:\ +# :G1=\E[191g:G2=\E[218g:G3=\E[192g:G4=\E[217g:\ +# :CW=\E[E:NU=\E[F:RF=\E[G:RC=\E[H:\ +# :WL=\E[K:WR=\E[L:CL=\E[M:CR=\E[N:\ +# I renamed GS/GE/WL/WR/CL/CR/PU/PD/HM/EN; also, removed a duplicate +# ":kh=\E[Y:". Added IBM-PC forms characters and highlights, they match +# what was there before. -- esr) +ibmpcx|xenix|ibmx|IBM PC xenix console display, + OTbs, am, msgr, + cols#80, lines#25, + clear=^L, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, home=\E[H, ich1=\E[@, il1=\E[L, kbs=^H, + kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kend=\E[d, + kf1=\E[K, kf2=\E[L, kf3=\E[M, kf4=\E[N, khome=\E[Y, knp=\E[e, + kpp=\E[Z, use=klone+acs, use=klone+sgr8, + +######## OTHER OBSOLETE TYPES +# +# These terminals are *long* dead -- these entries are retained for +# historical interest only. +# + +#### Obsolete non-ANSI software emulations +# + +# CTRM terminal emulator +# 1. underlining is not allowed with colors: first, is is simulated by +# black on white, second, it disables background color manipulations. +# 2. BLINKING, REVERSE and BOLD are allowed with colors, +# so we have to save their status in the static registers A, B and H +# respectively, to be able to restore them when color changes +# (because any color change turns off ALL attributes) +# 3. and sequences alternate modes, +# rather than simply entering them. Thus we have to check the +# static register B and H to determine the status, before sending the +# escape sequence. +# 4. now must set the status of all 3 register (A,B,H) to zero +# and then reset colors +# 5. implementation of the protect mode would badly penalize the performance. +# we would have to use \E&bn sequence to turn off colors (as well as all +# other attributes), and keep the status of protect mode in yet another +# static variable. If someone really needs this mode, they would have to +# create another terminfo entry. +# 6. original color-pair is white on black. +# store the information about colors into static registers +# 7. set foreground color. it performs the following steps. +# 1) turn off all attributes +# 2) turn on the background and video attributes that have been turned +# on before (this information is stored in static registers X,Y,Z,A,B,H,D). +# 3) turn on foreground attributes +# 4) store information about foreground into U,V,W static registers +# 8. turn on background: similar to turn on foreground above +ctrm|C terminal emulator, + am, bce, xon, + colors#8, cols#80, lh#0, lines#24, lm#0, lw#0, ncv#2, nlab#0, + pairs#63, pb#19200, vt#6, + bel=^G, blink=\E&dA%{1}%PA, + bold=%?%gH%{0}%=%t\E&dH%{1}%PH%;, cbt=\Ei, + clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\E&a%p2%dc%p1%dY, cuu1=\EA, dch1=\EP$<2>, dl1=\EM, + ed=\EJ, el=\EK, hpa=\E&a%p1%dC, ht=\011$<2>, hts=\E1, + il1=\EL, ind=^J, ip=$<2>, is2=\E&jA\r, kbs=^H, kcub1=\Eu\r, + kcud1=\Ew\r, kcuf1=\Ev\r, kcuu1=\Et\r, kf1=\Ep\r, + kf2=\Eq\r, kf3=\Er\r, kf4=\Es\r, kf5=\Et\r, kf6=\Eu\r, + kf7=\Ev\r, kf8=\Ew\r, khome=\Ep\r, + op=\E&bn\E&bB\E&bG\E&bR%{0}%PX%{0}%PY%{0}%PZ%{1}%PW%{1}%PV + %{1}%PU, + rev=%?%gB%{0}%=%t\E&dB%{1}%PB%;, rmir=\ER, rmkx=\E&jA, + setb=\E&bn%?%gA%t\E&dA%;%?%gB%t\E&dB%;%?%gH%t\E&dH%;%?%gU%t + \E&bR%;%?%gV%t\E&bG%;%?%gW%t\E&bB%;%?%p1%{1}%&%t\E&bb + %{1}%e%{0}%;%PZ%?%p1%{2}%&%t\E&bg%{1}%e%{0}%;%PY%?%p1 + %{4}%&%t\E&br%{1}%e%{0}%;%PX, + setf=\E&bn%?%gA%t\E&dA%;%?%gB%t\E&dB%;%?%gH%t\E&dH%;%?%gX%t + \E&br%;%?%gY%t\E&bg%;%?%gZ%t\E&bb%;%?%p1%{1}%&%t\E&bB + %{1}%e%{0}%;%PW%?%p1%{2}%&%t\E&bG%{1}%e%{0}%;%PV%?%p1 + %{4}%&%t\E&bR%{1}%e%{0}%;%PU, + sgr=\E&d@%{0}%PA%{0}%PB%{0}%PD%{0}%PH%?%p1%p3%p5%|%|%t\E&dB + %{1}%PB%;%?%p4%t\E&dA%{1}%PA%;%?%p6%t\E&dH%{1}%PH%;%?%p2 + %t\E&dD%;, + sgr0=\E&d@%{0}%PA%{0}%PB%{0}%PH, smir=\EQ, smkx=\E&jB, + smso=\E&dD, smul=\E&dD, tbc=\E3, vpa=\E&a%p1%dY, + +# gs6300 - can't use blue foreground, it clashes with underline; +# it's simulated with cyan +# Bug: The capability probably resets attributes. +# (gs6300: commented out (no ) --esr) +gs6300|emots|AT&T PC6300 with EMOTS terminal emulator, + am, bce, msgr, xon, + colors#8, cols#80, it#8, lines#24, pairs#63, + acsc=++\,\,--..``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyz + z{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[J, cr=^M, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, ht=^I, + ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, + is2=\E[m, kbs=^H, kcbt=^R^I, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf1=\E[0s, kf2=\E[24s, kf3=\E[1s, + kf4=\E[23s, kf5=\E[2s, kf6=\E[22s, kf7=\E[3s, kf8=\E[21s, + khome=\E[H, mc4=\E[4i, mc5=\E[5i, op=\E[?;m, rev=\E[7m, + ri=\E[L, rmacs=\E[10m, rs1=\Ec, setb=\E[?;%p1%dm, + setf=\E[?%?%p1%{0}%=%t0%e%p1%{1}%=%t2%e%p1%{1}%-%d%;m, + sgr0=\E[m\E[10m, smacs=\E[11m, smso=\E[1m, smul=\E[4m, + +# From: 29 Oct 85 05:40:18 GMT +# MS-Kermit with Heath-19 emulation mode enabled +# (h19k: changed ":pt@:" to ":it@" +h19k|h19kermit|heathkit emulation provided by Kermit (no auto margin), + am@, da, db, xt, + it@, + ht@, use=h19-u, + +# Apple Macintosh with Versaterm, a terminal emulator distributed by Synergy +# Software (formerly Peripherals Computers & Supplies, Inc) of +# 2457 Perkiomen Ave., Reading, PA 19606, 1-800-876-8376. They can +# also be reached at support@synergy.com. +versaterm|versaterm vt100 emulator for the macintosh, + am, xenl, + cols#80, it#8, lines#24, + bel=^G, blink=\E[5m$<2/>, bold=\E[1m$<2/>, + clear=\E[;H\E[2J$<50/>, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C$<2/>, + cup=\E[%i%p1%d;%p2%dH$<5/>, cuu1=\E[A$<2/>, + dch1=\E[1P$<7/>, dl1=\E[1M$<9/>, ed=\E[J$<50/>, + el=\E[K$<3/>, home=\E[H, ht=^I, ich1=\E[1@$<7/>, + il1=\E[1L$<9/>, is2=\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, nel=^M^J, rc=\E8, rev=\E[7m$<2/>, + rf=/usr/share/tabset/vt100, ri=\EM$<5/>, + rmkx=\E>\E[?1l, rmso=\E[m$<2/>, rmul=\E[m$<2/>, rs1=\E>, + sc=\E7, sgr0=\E[m$<2/>, smkx=\E=\E[?1h, smso=\E[7m$<2/>, + smul=\E[4m$<2/>, + +# From: Rick Thomas +# (xtalk: I added / based on the init string. +xtalk|IBM PC with xtalk communication program (versions up to 3.4), + am, mir, msgr, xon, + cols#80, it#8, lines#24, vt#3, xmc#1, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, clear=\E[H\E[J$<50>, cr=^M, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C$<2>, + cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, + cuu1=\E[A$<2>, dl1=\E[M$<99>, ed=\E[J$<50>, el=\E[K$<3>, + el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, + il1=\E[L$<99>, ind=^J, kbs=^H, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, + rmkx=\E[?1l\E>, rmso=\E[m\s, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sgr0=\E[m, + smacs=^N, smam=\E[?7h, smkx=\E[?1h\E=, smso=\E[7m\s, + tbc=\E[3g, use=vt100+fnkeys, + +# The official PC terminal emulator program of the AT&T Product Centers. +# Note - insert mode commented out - doesn't seem to work on AT&T PC. +simterm|attpc running simterm, + am, + cols#80, lines#24, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=\EB, cuf1=\EC, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\ER, + dl1=\EM, ed=\EJ, el=\EK, home=\EH, il1=\EL, ind=^J, rmcup=\EVE, + rmso=\E&d@, sgr0=\E&d@, smcup=\EVS, smso=\E&dB, + +#### Daisy wheel printers +# +# This section collects Diablo, DTC, Xerox, Qume, and other daisy +# wheel terminals. These are now largely obsolete. +# + +# (diablo1620: removed , no such file -- esr) +diablo1620|diablo1720|diablo450|ipsi|diablo 1620, + hc, os, + cols#132, it#8, + cub1=^H, cud1=^J, cuu1=\E^J, hd=\ED, hpa=\E\011%i%p1%c, + ht=^I, hts=\E1, hu=\EU, kbs=^H, tbc=\E2, +diablo1620-m8|diablo1640-m8|diablo 1620 w/8 column left margin, + cols#124, + is2=\r \E9, use=diablo1620, +# (diablo1640: removed , no such file -- esr) +diablo1640|diablo1730|diablo1740|diablo630|x1700|diablo|xerox|diablo 1640, + bel=^G, rmso=\E&, rmul=\ER, smso=\EW, smul=\EE, + use=diablo1620, +# (diablo1640-lm: removed , no such +# file -- esr) +diablo1640-lm|diablo-lm|xerox-lm|diablo 1640 with indented left margin, + cols#124, + rmso=\E&, rmul=\ER, smso=\EW, smul=\EE, use=diablo1620, +diablo1740-lm|630-lm|1730-lm|x1700-lm|diablo 1740 printer, + use=diablo1640-lm, +# DTC 382 with VDU. Has no so we fake it with . Standout +# works but won't go away without dynamite . +# The terminal has tabs, but I'm getting tired of fighting the braindamage. +# If no tab is set or the terminal's in a bad mood, it glitches the screen +# around all of memory. Note that return puts a blank ("a return character") +# in the space the cursor was at, so we use ^P return (and thus ^P newline for +# newline). Note also that if you turn off :pt: and let Unix expand tabs, +# curses won't work (some old BSD versions) because it doesn't clear this bit, +# and cursor addressing sends a tab for row/column 9. What a losing terminal! +# I have been unable to get tabs set in all 96 lines - it always leaves at +# least one line with no tabs in it, and once you tab through that line, +# it completely weirds out. +# (dtc382: change to -- it just does a clear --esr) +dtc382|DTC 382, + am, da, db, xhp, + cols#80, lines#24, lm#96, + bel=^G, clear=\020\035$<20>, cnorm=^Pb, cr=^P^M, cub1=^H, + cuf1=^PR, cup=\020\021%p2%c%p1%c, cuu1=^P^L, cvvis=^PB, + dch1=^X, dl1=^P^S, ed=\020\025\020\023\020\023, el=^P^U, + home=^P^R, il1=^P^Z, ind=^J, pad=\177, rmcup=, rmir=^Pi, + rmul=^P \0, smcup=\020\035$<20>, smir=^PI, smul=^P ^P, +dtc300s|DTC 300s, + hc, os, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=^Z, ff=^L, hd=\Eh, ht=^I, + hts=\E1, hu=\EH, ind=^J, kbs=^H, tbc=\E3, +gsi|mystery gsi terminal, + hc, os, + cols#132, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=^Z, hd=\Eh, ht=^I, hu=\EH, + ind=^J, +aj830|aj832|aj|anderson jacobson, + hc, os, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=\E7, hd=\E9, hu=\E8, + ind=^J, +# From: Chris Torek Thu, 7 Nov 85 18:21:58 EST +aj510|Anderson-Jacobson model 510, + am, mir, + cols#80, lines#24, + clear=^L, cub1=^H, cuf1=\EX, + cup=\E#%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EY, + dch1=\E'D$<.1*>, dl1=\E&D$<2*/>, ed=\E'P, el=\E'L, ich1=, + il1=\E&I$<2*/>, ip=$<.1*/>, kcub1=\EW, kcud1=\EZ, + kcuf1=\EX, kcuu1=\EY, pad=\177, rmcup=\E"N, rmir=\E'J, + rmso=\E"I, rmul=\E"U, smcup=\E"N, smir=\E'I, smso=\E"I, + smul=\E"U, +# From: Thu Aug 20 09:09:18 1981 +# This is incomplete, but it's a start. +nec5520|nec|spinwriter|nec 5520, + hc, os, + cols#132, it#8, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=\E9, ff=^L, + hd=\E]s\n\E]W, ht=^I, hts=\E1, hu=\E]s\E9\E]W, ind=^J, + kbs=^H, tbc=\E3, +qume5|qume|Qume Sprint 5, + hc, os, + cols#80, it#8, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuu1=^Z, ff=^L, hd=\Eh, ht=^I, + hts=\E1, hu=\EH, ind=^J, kbs=^H, tbc=\E3, +# I suspect the xerox 1720 is the same as the diablo 1620. +xerox1720|x1720|x1750|xerox 1720, + hc, os, + cols#132, it#8, + bel=^G, cr=^M, cub1=^H, cud1=^J, ff=^L, ht=^I, hts=\E1, ind=^J, + tbc=\E2, + +#### Miscellaneous obsolete terminals, manufacturers unknown +# +# If you have any information about these (like, a manufacturer's name, +# and a date on the serial-number plate) please send it! + +cad68-3|cgc3|cad68 basic monitor transparent mode size 3 chars, + OTbs, am, + cols#73, lines#36, + clear=^Z, cub1=^H, cuf1=^L, cuu1=^K, home=^^, +cad68-2|cgc2|cad68 basic monitor transparent mode size 2 chars, + OTbs, am, + cols#85, lines#39, + clear=^Z, cub1=^H, cuf1=^L, cuu1=^K, home=^^, kcub1=\E3, + kcud1=\E2, kcuf1=\E4, kcuu1=\E1, kf1=\E5, kf2=\E6, kf3=\E7, + kf4=\E8, rmso=\Em^C, smso=\Em^L, +cops10|cops|cops-10|cops 10, + am, bw, + cols#80, lines#24, + bel=^G, clear=\030$<30/>, cr=^M, cub1=^H, cud1=^J, cuf1=^L, + cup=\020%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, ed=^W, el=^V, + ind=^J, kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, + khome=^Y, +# (d132: removed duplicate :ic=\E5:, +# merged in capabilities from a BRL entry -- esr) +d132|datagraphix|datagraphix 132a, + da, db, in, + cols#80, lines#30, + bel=^G, clear=^L, cnorm=\Em\En, cr=^M, cub1=^H, cud1=^J, + cuf1=\EL, cup=\E8%i%p1%3d%p2%3d, cuu1=\EK, cvvis=\Ex, + dch1=\E6, home=\ET, ht=^I, ich1=\E5, il1=\E3, ind=^J, kbs=^H, + kcub1=^H, kcud1=^J, nel=^M^J, ri=\Ew, +# The d800 was an early portable terminal from c.1984-85 that looked a lot +# like the original Compaq `lunchbox' portable (but no handle). It had a vt220 +# mode (which is what this entry looks like) and several other lesser-known +# emulations. +d800|Direct 800/A, + OTbs, am, da, db, msgr, xhp, + cols#80, it#8, lines#24, + acsc=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~, + bel=^G, clear=\E[1;1H\E[2J, cnorm=\E[>12h, cr=^M, cub1=^H, + cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, + cvvis=\E[>12l, ed=\E[J, el=\E[K, ht=^I, ind=\ED, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kf1=\EOP, kf2=\EOQ, + kf3=\EOR, kf4=\EOS, kf5=\EOT, kf6=\EOU, kf7=\EOV, kf8=\EOW, + ri=\EM, rmacs=\E[m, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smacs=\E[1m, smso=\E[7m, smul=\E[4m, +digilog|digilog 333, + OTbs, + cols#80, lines#16, + bel=^G, cr=^M, cub1=^H, cud1=^J, cuf1=^I, cuu1=^O, el=^X, + home=^N, ind=^J, +# The DWK was a terminal manufactured in the Soviet Union c.1986 +dwk|dwk-vt|dwk terminal, + am, + cols#80, it#8, lines#24, + acsc=+\^\,Q-S.M0\177`+a\:f'g#h#i#jXkClJmFnNo~qUs_tEuPv + \\wKxW~_, + bel=^G, clear=\EH\EJ, cr=^M, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, dch1=\EP, + ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\EQ, ind=^J, kbs=\177, + kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, kdch1=\Ee, + kf1=\Ef1, kf10=\Ef0, kf2=\Ef2, kf3=\Ef3, kf4=\Ef4, kf5=\Ef5, + kf6=\Ef6, kf7=\Ef7, kf8=\Ef8, kf9=\Ef9, kich1=\Ed, knp=\Eh, + kpp=\Eg, nel=^M^J, rev=\ET, ri=\ES, rmacs=\EG, rmso=\EX, + sgr0=\EX, smacs=\EF, smso=\ET, +env230|envision230|envision 230 graphics terminal, + xenl@, + enacs@, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, rmacs@, + sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t; + 1%;m$<2>, + sgr0=\E[0m$<2>, smacs@, use=vt100, +# These execuports were impact-printer ttys with a 30- or maybe 15-cps acoustic +# coupler attached, the whole rig fitting in a suitcase and more or less +# portable. Hot stuff for c.1977 :-) -- esr +ep48|ep4080|execuport 4080, + OTbs, am, os, + cols#80, + bel=^G, cr=^M, cub1=^H, cud1=^J, hd=^\, hu=^^, ind=^J, +ep40|ep4000|execuport 4000, + cols#136, use=ep4080, +# Adam Thompson tells us: +# Informer series - these are all portable units, resembling older +# automatic bread-baking machines. The terminal looks like a `clamshell' +# design, but isn't. The structure is similar to the Direct terminals, +# but only half the width. The entire unit is only about 10" wide. +# It features an 8" screen (6" or 7" if you have color!), and an 9"x6" +# keyboard. All the keys are crammed together, much like some laptop +# PCs today, but perhaps less well organized...all these units have a +# bewildering array of plugs on the back, including a built-in modem. +# The 305 was a color version of the 304; the 306 and 307 were mono and +# color terminals built for IBM bisync protocols. +# From: Paul Leondis +ifmr|Informer D304, + OTbs, am, + cols#80, lines#24, + clear=\EZ, cub1=^H, cud1=^J, cuf1=\EC, + cup=\EY%p2%{32}%+%c%p1%{32}%+%c, cuu1=\EA, dch1=\E\\, + ed=\E/, el=\EQ, home=\EH, ich1=\E[, ri=\En, rmso=\EK, sgr0=\EK, + smso=\EJ, +# Entry largely based on wy60 and has the features of wy60ak. +opus3n1+|Esprit Opus3n1+ in wy60 mode with ANSI arrow keys, + am, bw, hs, km, mir, msgr, ul, xon, + cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#80, + acsc=0wa_h[jukslrmqnxqzttuyv]wpxv, bel=^G, blink=\EG2, + cbt=\EI, civis=\E`0, clear=\E*$<100>, cnorm=\E`1, cr=^M, + cub1=^H, cud1=^J, cuf1=^L, cup=\Ea%i%p1%dR%p2%dC, cuu1=^K, + dch1=\EW$<11>, dim=\EGp, dl1=\ER$<5>, dsl=\Ez(\r, + ed=\EY$<100>, el=\ET, fsl=^M, home=\036$<2>, ht=\011$<5>, + hts=\E1, if=/usr/share/tabset/std, il1=\EE$<4>, ind=^J, + ip=$<3>, + is2=\E`\:\Ee(\EO\Ee6\Ec41\E~4\Ec21\Ed/\Ezz&\E[A\177\Ezz'\E[B + \177\Ezz(\E[D\177\Ezz)\E[C\177\Ezz<\E[Q\177\Ezz`\E[F + \177\EA1*\EZH12, + kHOM=\E{, kbs=^H, kcbt=\EI, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kdch1=\EW, kdl1=\ER, ked=\EY, + kel=\ET, kend=\E[F, kent=\E7, kf1=^A@\r, kf10=^AI\r, + kf11=^AJ\r, kf12=^AK\r, kf13=^AL\r, kf14=^AM\r, kf15=^AN\r, + kf16=^AO\r, kf2=^AA\r, kf3=^AB\r, kf4=^AC\r, kf5=^AD\r, + kf6=^AE\r, kf7=^AF\r, kf8=^AG\r, kf9=^AH\r, khome=^^, + kich1=\EQ, kil1=\EE, knp=\EK, kpp=\EJ, kprt=\EP, krpl=\Er, + mc0=\EP, mc4=^T, mc5=^R, nel=\r\n$<3>, + pfloc=\EZ2%p1%{63}%+%c%p2%s\177, + pfx=\EZ1%p1%{63}%+%c%p2%s\177, + pln=\Ez%p1%{47}%+%c%p2%s\r, prot=\E), ri=\Ej$<7>, + rmacs=\EH^C, rmam=\Ed., rmcup=, rmir=\Er, rmln=\EA11, + rmxon=\Ec20, rs1=\E~!\E~4$<150>, rs2=\EeF$<150>, + rs3=\EwG\Ee($<150>, + sgr=%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;\EG%{48}%?%p2 + %t%{8}%|%;%?%p1%p3%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%| + %t%{64}%|%;%?%p7%t%{1}%|%;%c, + sgr0=\E(\EH\003\EG0\EcD, smacs=\EH^B, smam=\Ed/, + smcup=\Ezz&\E[A\177\Ezz'\E[B\177\Ezz(\E[D\177\Ezz)\E[C\177 + \Ezz<\E[Q\177, + smir=\Eq, smln=\EA10, smxon=\Ec21, tbc=\E0, tsl=\Ez(, + uc=\EG8\EG0, use=adm+sgr, +teletec|Teletec Datascreen, + OTbs, am, + cols#80, lines#24, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=^_, cuu1=^K, + home=^^, ind=^J, +# From: Mark Dornfeld +# This description is for the LANPAR Technologies VISION 3220 +# terminal from 1984/85. The function key definitions k0-k5 represent the +# edit keypad: FIND, INSERT HERE, REMOVE, SELECT, PREV SCREEN, +# NEXT SCREEN. The key definitions k6-k9 represent the PF1 to PF4 keys. +# +# Kenneth Randell writes on 31 Dec 1998: +# I had a couple of scopes (3221) like this once where I used to work, around +# the 1987 time frame if memory serves me correctly. These scopes were made +# by an outfit called LANPAR Technologies, and were meant to me DEC VT 220 +# compatible. The 3220 was a plain text terminal like the VT-220, the 3221 +# was a like the VT-240 (monochrome with Regis + Sixel graphics), and the 3222 +# was like the VT-241 (color with Regis + Sixel Graphics). These terminals +# (3221) cost about $1500 each, and one was always broken -- had to be sent +# back to the shop for repairs. +# The only real advantage these scopes had over the VT-240's were: +# 1) They were faster in the Regis display, or at least the ones I did +# 2) They had a handy debugging feature where you could split-screen the +# scope, the graphics would appear on the top, and the REGIS commands would +# appear on the bottom. I don't remember the VT-240s being able to do that. +# I would swear that LANPAR Technologies was in MA someplace, but since I +# don't work at the same place anymore, and those terminals and manuals were +# long since junked, I cannot be any more sure than that. +# +# (v3220: removed obsolete ":kn#10:", +# I added / based on the init string -- esr) +v3220|LANPAR Vision II model 3220/3221/3222, + OTbs, am, mir, xenl, + cols#80, it#8, lines#24, + clear=\E[H\E[J, cub1=^H, cud1=\E[B, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch1=\E[P, dl1=\E[M, + ed=\E[J, el=\E[K, ht=^I, il1=\E[L, + is2=\E>\E[?3l\E[?7h\E[?8h\E[p, kcub1=\E[D, kcud1=\E[B, + kcuf1=\E[C, kcuu1=\E[A, kf0=\E[1~, kf1=\E[2~, kf2=\E[3~, + kf3=\E[4~, kf4=\E[5~, kf5=\E[6~, kf6=\E[OP, kf7=\E[OQ, + kf8=\E[OR, kf9=\E[OS, khome=\E[H, ri=\EM, rmam=\E[?7l, + rmir=\E[4l, rmkx=\E>, rmso=\E[m, rmul=\E[m, sgr0=\E[m, + smam=\E[?7h, smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, +######## ICH/ICH1 VERSUS RMIR/SMIR +# +# Some non-curses applications get confused if both ich/ich1 and rmir/smir +# are present; the symptom is doubled characters in an update using insert. +# These applications are technically correct; in both 4.3BSD termcap and +# terminfo, you're not actually supposed to specify both ich/ich1 and rmir/smir +# unless the terminal needs both. To my knowledge, no terminal still in this +# file requires both other than the very obsolete dm2500. +# +# For ncurses-based applications this is not a problem, as ncurses uses +# one or the other as appropriate but never mixes the two. Therefore we +# have not corrected entries like `linux' and `xterm' that specify both. +# If you see doubled characters from these, use the linux-nic and xterm-nic +# entries that suppress ich/ich1. And upgrade to ncurses! +# + +######## VT100/ANSI/ISO 6429/ECMA-48/PC-TERM TERMINAL STANDARDS +# +# ANSI X3.64 has been withdrawn and replaced by ECMA-48. The ISO 6429 and +# ECMA-48 standards are said to be almost identical, but are not the same +# as X3.64 (though for practical purposes they are close supersets of it). +# +# You can obtain ECMA-48 for free by sending email to helpdesk@ecma.ch +# requesting the standard(s) you want (i.e. ECMA-48, "Control Functions for +# Coded Character Sets"), include your snail-mail address, and you should +# receive the document in due course. Don't expect an email acknowledgement. +# +# Related standards include "X3.4-1977: American National Standard Code for +# Information Interchange" (the ASCII standard) and "X3.41.1974: +# Code-Extension Techniques for Use with the 7-Bit Coded Character Set of +# American National Standard for Information Interchange." I believe (but +# am not certain) that these are effectively identical to ECMA-6 and ECMA-35 +# respectively. +# + +#### VT100/ANSI/ECMA-48 +# +# ANSI Standard (X3.64) Control Sequences for Video Terminals and Peripherals +# and ECMA-48 Control Functions for Coded Character Sets. +# +# Much of the content of this comment is adapted from a table prepared by +# Richard Shuford, based on a 1984 Byte article. Terminfo correspondences, +# discussion of some terminfo-related issues, and updates to capture ECMA-48 +# have been added. Control functions described in ECMA-48 only are tagged +# with * after their names. +# +# The table is a complete list of the defined ANSI X3.64/ECMA-48 control +# sequences. In the main table, \E stands for an escape (\033) character, +# SPC for space. Pn stands for a single numeric parameter to be inserted +# in decimal ASCII. Ps stands for a list of such parameters separated by +# semicolons. Parameter meanings for most parametrized sequences are +# decribed in the notes. +# +# Sequence Sequence Parameter or +# Mnemonic Name Sequence Value Mode terminfo +# ----------------------------------------------------------------------------- +# APC Applicatn Program Command \E _ - Delim - +# BEL Bell * ^G - - bel +# BPH Break Permitted Here * \E B - * - +# BS Backpace * ^H - EF - +# CAN Cancel * ^X - - - (A) +# CBT Cursor Backward Tab \E [ Pn Z 1 eF cbt +# CCH Cancel Previous Character \E T - - - +# CHA Cursor Horizntal Absolute \E [ Pn G 1 eF hpa (B) +# CHT Cursor Horizontal Tab \E [ Pn I 1 eF tab (C) +# CMD Coding Method Delimiter * \E +# CNL Cursor Next Line \E [ Pn E 1 eF nel (D) +# CPL Cursor Preceding Line \E [ Pn F 1 eF - +# CPR Cursor Position Report \E [ Pn ; Pn R 1, 1 - - (E) +# CSI Control Sequence Intro \E [ - Intro - +# CTC Cursor Tabulation Control \E [ Ps W 0 eF - (F) +# CUB Cursor Backward \E [ Pn D 1 eF cub +# CUD Cursor Down \E [ Pn B 1 eF cud +# CUF Cursor Forward \E [ Pn C 1 eF cuf +# CUP Cursor Position \E [ Pn ; Pn H 1, 1 eF cup (G) +# CUU Cursor Up \E [ Pn A 1 eF cuu +# CVT Cursor Vertical Tab \E [ Pn Y - eF - (H) +# DA Device Attributes \E [ Pn c 0 - - +# DAQ Define Area Qualification \E [ Ps o 0 - - +# DCH Delete Character \E [ Pn P 1 eF dch +# DCS Device Control String \E P - Delim - +# DL Delete Line \E [ Pn M 1 eF dl +# DLE Data Link Escape * ^P - - - +# DMI Disable Manual Input \E \ - Fs - +# DSR Device Status Report \E [ Ps n 0 - - (I) +# DTA Dimension Text Area * \E [ Pn ; Pn SPC T - PC - +# EA Erase in Area \E [ Ps O 0 eF - (J) +# ECH Erase Character \E [ Pn X 1 eF ech +# ED Erase in Display \E [ Ps J 0 eF ed (J) +# EF Erase in Field \E [ Ps N 0 eF - +# EL Erase in Line \E [ Ps K 0 eF el (J) +# EM End of Medium * ^Y - - - +# EMI Enable Manual Input \E b Fs - +# ENQ Enquire ^E - - - +# EOT End Of Transmission ^D - * - +# EPA End of Protected Area \E W - - - (K) +# ESA End of Selected Area \E G - - - +# ESC Escape ^[ - - - +# ETB End Transmission Block ^W - - - +# ETX End of Text ^C - - - +# FF Form Feed ^L - - - +# FNK Function Key * \E [ Pn SPC W - - - +# GCC Graphic Char Combination* \E [ Pn ; Pn SPC B - - - +# FNT Font Selection \E [ Pn ; Pn SPC D 0, 0 FE - +# GSM Graphic Size Modify \E [ Pn ; Pn SPC B 100, 100 FE - (L) +# GSS Graphic Size Selection \E [ Pn SPC C none FE - +# HPA Horz Position Absolute \E [ Pn ` 1 FE - (B) +# HPB Char Position Backward \E [ j 1 FE - +# HPR Horz Position Relative \E [ Pn a 1 FE - (M) +# HT Horizontal Tab * ^I - FE - (N) +# HTJ Horz Tab w/Justification \E I - FE - +# HTS Horizontal Tab Set \E H - FE hts +# HVP Horz & Vertical Position \E [ Pn ; Pn f 1, 1 FE - (G) +# ICH Insert Character \E [ Pn @ 1 eF ich +# IDCS ID Device Control String \E [ SPC O - * - +# IGS ID Graphic Subrepertoire \E [ SPC M - * - +# IL Insert Line \E [ Pn L 1 eF il +# IND Index \E D - FE - +# INT Interrupt \E a - Fs - +# JFY Justify \E [ Ps SPC F 0 FE - +# IS1 Info Separator #1 * ^_ - * - +# IS2 Info Separator #1 * ^^ - * - +# IS3 Info Separator #1 * ^] - * - +# IS4 Info Separator #1 * ^\ - * - +# LF Line Feed ^J - - - +# LS1R Locking Shift Right 1 * \E ~ - - - +# LS2 Locking Shift 2 * \E n - - - +# LS2R Locking Shift Right 2 * \E } - - - +# LS3 Locking Shift 3 * \E o - - - +# LS3R Locking Shift Right 3 * \E | - - - +# MC Media Copy \E [ Ps i 0 - - (S) +# MW Message Waiting \E U - - - +# NAK Negative Acknowledge * ^U - * - +# NBH No Break Here * \E C - - - +# NEL Next Line \E E - FE nel (D) +# NP Next Page \E [ Pn U 1 eF - +# NUL Null * ^@ - - - +# OSC Operating System Command \E ] - Delim - +# PEC Pres. Expand/Contract * \E Pn SPC Z 0 - - +# PFS Page Format Selection * \E Pn SPC J 0 - - +# PLD Partial Line Down \E K - FE - (T) +# PLU Partial Line Up \E L - FE - (U) +# PM Privacy Message \E ^ - Delim - +# PP Preceding Page \E [ Pn V 1 eF - +# PPA Page Position Absolute * \E [ Pn SPC P 1 FE - +# PPB Page Position Backward * \E [ Pn SPC R 1 FE - +# PPR Page Position Forward * \E [ Pn SPC Q 1 FE - +# PTX Parallel Texts * \E [ \ - - - +# PU1 Private Use 1 \E Q - - - +# PU2 Private Use 2 \E R - - - +# QUAD Typographic Quadding \E [ Ps SPC H 0 FE - +# REP Repeat Char or Control \E [ Pn b 1 - rep +# RI Reverse Index \E M - FE - (V) +# RIS Reset to Initial State \E c - Fs - +# RM Reset Mode * \E [ Ps l - - - (W) +# SACS Set Add. Char. Sep. * \E [ Pn SPC / 0 - - +# SAPV Sel. Alt. Present. Var. * \E [ Ps SPC ] 0 - - (X) +# SCI Single-Char Introducer \E Z - - - +# SCO Sel. Char. Orientation * \E [ Pn ; Pn SPC k - - - +# SCS Set Char. Spacing * \E [ Pn SPC g - - - +# SD Scroll Down \E [ Pn T 1 eF rin +# SDS Start Directed String * \E [ Pn ] 1 - - +# SEE Select Editing Extent \E [ Ps Q 0 - - (Y) +# SEF Sheet Eject & Feed * \E [ Ps ; Ps SPC Y 0,0 - - +# SGR Select Graphic Rendition \E [ Ps m 0 FE sgr (O) +# SHS Select Char. Spacing * \E [ Ps SPC K 0 - - +# SI Shift In ^O - - - (P) +# SIMD Sel. Imp. Move Direct. * \E [ Ps ^ - - - +# SL Scroll Left \E [ Pn SPC @ 1 eF - +# SLH Set Line Home * \E [ Pn SPC U - - - +# SLL Set Line Limit * \E [ Pn SPC V - - - +# SLS Set Line Spacing * \E [ Pn SPC h - - - +# SM Select Mode \E [ Ps h none - - (W) +# SO Shift Out ^N - - - (Q) +# SOH Start Of Heading * ^A - - - +# SOS Start of String * \E X - - - +# SPA Start of Protected Area \E V - - - (Z) +# SPD Select Pres. Direction * \E [ Ps ; Ps SPC S 0,0 - - +# SPH Set Page Home * \E [ Ps SPC G - - - +# SPI Spacing Increment \E [ Pn ; Pn SPC G none FE - +# SPL Set Page Limit * \E [ Ps SPC j - - - +# SPQR Set Pr. Qual. & Rapid. * \E [ Ps SPC X 0 - - +# SR Scroll Right \E [ Pn SPC A 1 eF - +# SRCS Set Reduced Char. Sep. * \E [ Pn SPC f 0 - - +# SRS Start Reversed String * \E [ Ps [ 0 - - +# SSA Start of Selected Area \E F - - - +# SSU Select Size Unit * \E [ Pn SPC I 0 - - +# SSW Set Space Width * \E [ Pn SPC [ none - - +# SS2 Single Shift 2 (G2 set) \E N - Intro - +# SS3 Single Shift 3 (G3 set) \E O - Intro - +# ST String Terminator \E \ - Delim - +# STAB Selective Tabulation * \E [ Pn SPC ^ - - - +# STS Set Transmit State \E S - - - +# STX Start pf Text * ^B - - - +# SU Scroll Up \E [ Pn S 1 eF indn +# SUB Substitute * ^Z - - - +# SVS Select Line Spacing * \E [ Pn SPC \ 1 - - +# SYN Synchronous Idle * ^F - - - +# TAC Tabul. Aligned Centered * \E [ Pn SPC b - - - +# TALE Tabul. Al. Leading Edge * \E [ Pn SPC a - - - +# TATE Tabul. Al. Trailing Edge* \E [ Pn SPC ` - - - +# TBC Tab Clear \E [ Ps g 0 FE tbc +# TCC Tabul. Centered on Char * \E [ Pn SPC c - - - +# TSR Tabulation Stop Remove * \E [ Pn SPC d - FE - +# TSS Thin Space Specification \E [ Pn SC E none FE - +# VPA Vert. Position Absolute \E [ Pn d 1 FE vpa +# VPB Line Position Backward * \E [ Pn k 1 FE - +# VPR Vert. Position Relative \E [ Pn e 1 FE - (R) +# VT Vertical Tabulation * ^K - FE - +# VTS Vertical Tabulation Set \E J - FE - +# +# --------------------------------------------------------------------------- +# +# Notes: +# +# Some control characters are listed in the ECMA-48 standard without +# being assigned functions relevant to terminal control there (they +# referred to other standards such as ISO 1745 or ECMA-35). They are listed +# here anyway for completeness. +# +# (A) ECMA-48 calls this "CancelCharacter" but retains the CCH abbreviation. +# +# (B) There seems to be some confusion abroad between CHA and HPA. Most +# `ANSI' terminals accept the CHA sequence, not the HPA. but terminfo calls +# the capability (hpa). ECMA-48 calls this "Cursor Character Absolute" but +# preserved the CHA abbreviation. +# +# (C) CHT corresponds to terminfo (tab). Usually it has the value ^I. +# Occasionally (as on, for example, certain HP terminals) this has the HTJ +# value. ECMA-48 calls this "Cursor Forward Tabulation" but preserved the +# CHT abbreviation. +# +# (D) terminfo (nel) is usually \r\n rather than ANSI \EE. +# +# (E) ECMA-48 calls this "Active Position Report" but preserves the CPR +# abbreviation. +# +# (F) CTC parameter values: 0 = set char tab, 1 = set line tab, 2 = clear +# char tab, 3 = clear line tab, 4 = clear all char tabs on current line, +# 5 = clear all char tabs, 6 = clear all line tabs. +# +# (G) CUP and HVP are identical in effect. Some ANSI.SYS versions accept +# HVP, but always allow CUP as an alternate. ECMA-48 calls HVP "Character +# Position Absolute" but retains the HVP abbreviation. +# +# (H) ECMA calls this "Cursor Line Tabulation" but preserves the CVT +# abbreviation. +# +# (I) DSR parameter values: 0 = ready, 1 = busy, 2 = busy, will send DSR +# later, 3 = malfunction, 4 = malfunction, will send DSR later, 5 = request +# DSR, 6 = request CPR response. +# +# (J) ECMA calls ED "Erase In Page". EA/ED/EL parameters: 0 = clear to end, +# 1 = clear from beginning, 2 = clear. +# +# (K) ECMA calls this "End of Guarded Area" but preserves the EPA abbreviation. +# +# (L) The GSM parameters are vertical and horizontal parameters to scale by. +# +# (M) Some ANSI.SYS versions accept HPR, but more commonly `ANSI' terminals +# use CUF for this function and ignore HPR. ECMA-48 calls this "Character +# Position Relative" but retains the HPR abbreviation. +# +# (N) ECMA-48 calls this "Character Tabulation" but retains the HT +# abbreviation. +# +# (O) SGR parameter values: 0 = default mode (attributes off), 1 = bold, +# 2 = dim, 3 = italicized, 4 = underlined, 5 = slow blink, 6 = fast blink, +# 7 = reverse video, 8 = invisible, 9 = crossed-out (marked for deletion), +# 10 = primary font, 10 + n (n in 1..9) = nth alternative font, 20 = Fraktur, +# 21 = double underline, 22 = turn off 2, 23 = turn off 3, 24 = turn off 4, +# 25 = turn off 5, 26 = proportional spacing, 27 = turn off 7, 28 = turn off +# 8, 29 = turn off 9, 30 = black fg, 31 = red fg, 32 = green fg, 33 = yellow +# fg, 34 = blue fg, 35 = magenta fg, 36 = cyan fg, 37 = white fg, 38 = set +# fg color as in CCIT T.416, 39 = set default fg color, 40 = black bg +# 41 = red bg, 42 = green bg, 43 = yellow bg, 44 = blue bg, 45 = magenta bg, +# 46 = cyan bg, 47 = white bg, 48 = set bg color as in CCIT T.416, 39 = set +# default bg color, 50 = turn off 26, 51 = framed, 52 = encircled, 53 = +# overlined, 54 = turn off 51 & 52, 55 = not overlined, 56-59 = reserved, +# 61-65 = variable highlights for ideograms. +# +# (P) SI is also called LSO, Locking Shift Zero. +# +# (Q) SI is also called LS1, Locking Shift One. +# +# (R) Some ANSI.SYS versions accept VPR, but more commonly `ANSI' terminals +# use CUD for this function and ignore VPR. ECMA calls it `Line Position +# Absolute' but retains the VPA abbreviation. +# +# (S) MC parameters: 0 = start xfer to primary aux device, 1 = start xfer from +# primary aux device, 2 = start xfer to secondary aux device, 3 = start xfer +# from secondary aux device, 4 = stop relay to primary aux device, 5 = +# start relay to primary aux device, 6 = stop relay to secondary aux device, +# 7 = start relay to secondary aux device. +# +# (T) ECMA-48 calls this "Partial Line Forward" but retains the PLD +# abbreviation. +# +# (U) ECMA-48 calls this "Partial Line Backward" but retains the PLU +# abbreviation. +# +# (V) ECMA-48 calls this "Reverse Line Feed" but retains the RI abbreviation. +# +# (W) RM/SM modes are as follows: 1 = Guarded Area Transfer Mode (GATM), +# 2 = Keyboard Action Mode (KAM), 3 = Control Representation Mode (CRM), +# 4 = Insertion Replacement Mode, 5 = Status Report Transfer Mode (SRTM), +# 6 = Erasure Mode (ERM), 7 = Line Editing Mode (LEM), 8 = Bi-Directional +# Support Mode (BDSM), 9 = Device Component Select Mode (DCSM), +# 10 = Character Editing Mode (HEM), 11 = Positioning Unit Mode (PUM), +# 12 = Send/Receive Mode, 13 = Format Effector Action Mode (FEAM), +# 14 = Format Effector Transfer Mode (FETM), 15 = Multiple Area Transfer +# Mode (MATM), 16 = Transfer Termination Mode, 17 = Selected Area Transfer +# Mode, 18 = Tabulation Stop Mode, 19 = Editing Boundary Mode, 20 = Line Feed +# New Line Mode (LF/NL), Graphic Rendition Combination Mode (GRCM), 22 = +# Zero Default Mode (ZDM). The EBM and LF/NL modes have actually been removed +# from ECMA-48's 5th edition but are listed here for reference. +# +# (X) Select Alternate Presentation Variants is used only for non-Latin +# alphabets. +# +# (Y) "Select Editing Extent" (SEE) was ANSI "Select Edit Extent Mode" (SEM). +# +# (Z) ECMA-48 calls this "Start of Guarded Area" but retains the SPA +# abbreviation. +# +# --------------------------------------------------------------------------- +# +# Abbreviations: +# +# Intro an Introducer of some kind of defined sequence; the normal 7-bit +# X3.64 Control Sequence Introducer is the two characters "Escape [" +# +# Delim a Delimiter +# +# x/y identifies a character by position in the ASCII table (column/row) +# +# eF editor function (see explanation) +# +# FE format effector (see explanation) +# +# F is a Final character in +# an Escape sequence (F from 3/0 to 7/14 in the ASCII table) +# a control sequence (F from 4/0 to 7/14) +# +# Gs is a graphic character appearing in strings (Gs ranges from +# 2/0 to 7/14) in the ASCII table +# +# Ce is a control represented as a single bit combination in the C1 set +# of controls in an 8-bit character set +# +# C0 the familiar set of 7-bit ASCII control characters +# +# C1 roughly, the set of control chars available only in 8-bit systems. +# This is too complicated to explain fully here, so read Jim Fleming's +# article in the February 1983 BYTE, especially pages 214 through 224. +# +# Fe is a Final character of a 2-character Escape sequence that has an +# equivalent representation in an 8-bit environment as a Ce-type +# (Fe ranges from 4/0 to 5/15) +# +# Fs is a Final character of a 2-character Escape sequence that is +# standardized internationally with identical representation in 7-bit +# and 8-bit environments and is independent of the currently +# designated C0 and C1 control sets (Fs ranges from 6/0 to 7/14) +# +# I is an Intermediate character from 2/0 to 2/15 (inclusive) in the +# ASCII table +# +# P is a parameter character from 3/0 to 3/15 (inclusive) in the ASCII +# table +# +# Pn is a numeric parameter in a control sequence, a string of zero or +# more characters ranging from 3/0 to 3/9 in the ASCII table +# +# Ps is a variable number of selective parameters in a control sequence +# with each selective parameter separated from the other by the code +# 3/11 (which usually represents a semicolon); Ps ranges from +# 3/0 to 3/9 and includes 3/11 +# +# * Not relevant to terminal control, listed for completeness only. +# +# Format Effectors versus Editor Functions +# +# A format effector specifies how following output is to be displayed. +# An editor function allows you to modify the display. Informally +# format effectors may be destructive; format effectors should not be. +# +# For instance, a format effector that moves the "active position" (the +# cursor or equivalent) one space to the left would be useful when you want to +# create an overstrike, a compound character made of two standard characters +# overlaid. Control-H, the Backspace character, is actually supposed to be a +# format effector, so you can do this. But many systems use it in a +# nonstandard fashion, as an editor function, deleting the character to the +# left of the cursor and moving the cursor left. When Control-H is assumed to +# be an editor function, you cannot predict whether its use will create an +# overstrike unless you also know whether the output device is in an "insert +# mode" or an "overwrite mode". When Control-H is used as a format effector, +# its effect can always be predicted. The familiar characters carriage +# return, linefeed, formfeed, etc., are defined as format effectors. +# +# NOTES ON THE DEC VT100 IMPLEMENTATION +# +# Control sequences implemented in the VT100 are as follows: +# +# CPR, CUB, CUD, CUF, CUP, CUU, DA, DSR, ED, EL, HTS, HVP, IND, +# LNM, NEL, RI, RIS, RM, SGR, SM, TBC +# +# plus several private DEC commands. +# +# Erasing parts of the display (EL and ED) in the VT100 is performed thus: +# +# Erase from cursor to end of line Esc [ 0 K or Esc [ K +# Erase from beginning of line to cursor Esc [ 1 K +# Erase line containing cursor Esc [ 2 K +# Erase from cursor to end of screen Esc [ 0 J or Esc [ J +# Erase from beginning of screen to cursor Esc [ 1 J +# Erase entire screen Esc [ 2 J +# +# Some brain-damaged terminal/emulators respond to Esc [ J as if it were +# Esc [ 2 J, but this is wrong; the default is 0. +# +# The VT100 responds to receiving the DA (Device Attributes) control +# +# Esc [ c (or Esc [ 0 c) +# +# by transmitting the sequence +# +# Esc [ ? l ; Ps c +# +# where Ps is a character that describes installed options. +# +# The VT100's cursor location can be read with the DSR (Device Status +# Report) control +# +# Esc [ 6 n +# +# The VT100 reports by transmitting the CPR sequence +# +# Esc [ Pl ; Pc R +# +# where Pl is the line number and Pc is the column number (in decimal). +# +# The specification for the DEC VT100 is document EK-VT100-UG-003. + +#### ANSI.SYS +# +# Here is a description of the color and attribute controls supported in the +# the ANSI.SYS driver under MS-DOS. Most console drivers and ANSI +# terminal emulators for Intel boxes obey these. They are a proper subset +# of the ECMA-48 escapes. +# +# 0 all attributes off +# 1 foreground bright +# 4 underscore on +# 5 blink on/background bright (not reliable with brown) +# 7 reverse-video +# 8 set blank (non-display) +# 10 set primary font +# 11 set first alternate font (on PCs, display ROM characters 1-31) +# 12 set second alternate font (on PCs, display IBM high-half chars) +# +# Color attribute sets +# 3n set foreground color / 0=black, 1=red, 2=green, 3=brown, +# 4n set background color \ 4=blue, 5=magenta, 6=cyan, 7=white +# Bright black becomes gray. Bright brown becomes yellow, +# These coincide with the prescriptions of the ISO 6429/ECMA-48 standard. +# +# * If the 5 attribute is on and you set a background color (40-47) it is +# supposed to enable bright background. +# +# * Many VGA cards (such as the Paradise and compatibles) do the wrong thing +# when you try to set a "bright brown" (yellow) background with attribute +# 5 (you get a blinking yellow foreground instead). A few displays +# (including the System V console) support an attribute 6 that undoes this +# braindamage (this is required by iBCS2). +# +# * Some older versions of ANSI.SYS have a bug that causes thems to require +# ESC [ Pn k as EL rather than the ANSI ESC [ Pn K. (This is not ECMA-48 +# compatible.) + +#### Intel Binary Compatibility Standard +# +# For comparison, here are the capabilities implied by the Intel Binary +# Compatibility Standard for UNIX systems (Intel order number 468366-001). +# These recommendations are optional. IBCS2 allows the leading escape to +# be either the 7-bit \E[ or 8-bit \0233 introducer, in accordance with +# the ANSI X.364/ISO 6429/ECMA-48 standard. Here are the iBCS2 capabilities +# (as described in figure 9-3 of the standard). Those expressed in the ibcs2 +# terminfo entry are followed with the corresponding capability in parens: +# +# CSI k disable (n=0) or enable (n=1) keyclick +# CSI 2h lock keyboard +# CSI 2i send screen as input +# CSI 2l unlock keyboard +# CSI 6m enable background color intensity +# CSI <0-2>c reserved +# CSI <0-59>m select graphic rendition +# CSI ;H (cup) cursor to line n and column m +# CSI ;f cursor to line n and column m +# CSI @ (ich) insert characters +# CSI A (cuu) cursor up n lines +# CSI B (cud) cursor down n lines +# CSI C (cuu) cursor right n characters +# CSI D (cud) cursor left n characters +# CSI E cursor down n lines and in first column +# CSI F cursor up n lines and in first column +# CSI G (hpa) position cursor at column n-1 +# CSI J (ed) erase in display +# CSI K (el) erase in line +# CSI L (il) insert line(s) +# CSI P (dch) delete characters +# CSI S (indn) scroll up n lines +# CSI T (rin) scroll down n lines +# CSI X (ech) erase characters +# CSI Z (cbt) back up n tab stops +# CSI ` cursor to column n on line +# CSI a (cuu) cursor right n characters +# CSI d (vpa) cursor to line n +# CSI e cursor down n lines and in first column +# CSI g (cbt) clear all tabs +# CSI z make virtual terminal n active +# CSI ?7h (smam) turn automargin on +# CSI ?7l (rmam) turn automargin off +# CSI s save cursor position +# CSI u restore cursor position to saved value +# CSI =A set overscan color +# CSI =F set normal foreground color +# CSI =G set normal background color +# CSI =H set reverse foreground color +# CSI =I set reverse foreground color +# CSI =J set graphic foreground color +# CSI =K set graphic foreground color +# CSI =g (dispc) display n from alternate graphics character set +# CSI =

;B set bell parameters +# CSI =;C set cursor parameters +# CSI =D enable/disable intensity of background color +# CSI =E set/clear blink vs. bold background +# CSI 7 (sc) (sc) save cursor position +# CSI 8 (rc) (rc) restore cursor position to saved value +# CSI H (hts) (hts) set tab stop +# CSI Q define function key string +# (string must begin and end with delimiter char) +# CSI c (clear) clear screen +# +# The lack of any specification for attributes in SGR (among other things) +# makes this a wretchedly weak standard. The table above is literally +# everything iBSC2 has to say about terminal escape sequences; there is +# no further discussion of their meaning or how to set the parameters +# in these sequences at all. +# + +######## NONSTANDARD CAPABILITY TRANSLATIONS USED IN THIS FILE +# +# The historical termcap file entries were written primarily in 4.4BSD termcap. +# The 4.4BSD termcap set was substantially larger than the original 4.1BSD set, +# with the extension names chosen for compatibility with the termcap names +# assigned in System V terminfo. There are some variant extension sets out +# there. We try to describe them here. +# +#### XENIX extensions: +# +# The XENIX extensions include a set of function-key capabilities as follows: +# +# code XENIX variable name terminfo name name clashes? +# ---- ------------------- ------------- ----------------------- +# CL key_char_left +# CR key_char_right +# CW key_change_window create_window +# EN key_end kend +# HM key_home khome +# HP ?? +# LD key_delete_line kdl1 +# LF key_linefeed label_off +# NU key_next_unlocked_cell +# PD key_page_down knp +# PL ?? +# PN start_print mc5 +# PR ?? +# PS stop_print mc4 +# PU key_page_up kpp pulse +# RC key_recalc remove_clock +# RF key_toggle_ref req_for_input +# RT key_return kent +# UP key_up_arrow kcuu1 parm_up_cursor +# WL key_word_left +# WR key_word_right +# +# The XENIX extensions also include the following character-set and highlight +# capabilities: +# +# XENIX terminfo function +# ----- -------- ------------------------------ +# GS smacs start alternate character set +# GE rmacs end alternate character set +# GG :as:/:ae: glitch (analogous to :sg:/:ug:) +# bo blink begin blink (not used in /etc/termcap) +# be end blink (not used in /etc/termcap) +# bb blink glitch (not used in /etc/termcap) +# it dim begin dim (not used in /etc/termcap) +# ie end dim (not used in /etc/termcap) +# ig dim glitch (not used in /etc/termcap) +# +# Finally, XENIX also used the following forms-drawing capabilities: +# +# single double type ASCII approximation +# ------ ------ ------------- ------------------- +# GV Gv vertical line | +# GH Gv horizontal line - _ +# G1 G5 top right corner _ | +# G2 G6 top left corner | +# G3 G7 bottom left corner |_ +# G4 G8 bottom right corner _| +# GD Gd down-tick character T +# GL Gl left-tick character -| +# GR Gr right-tick character |- +# GC Gc middle intersection -|- +# GU Gu up-tick character _|_ +# +# These were invented to take advantage of the IBM PC ROM character set. One +# can compose an acsc string from the single-width characters as follows +# "j{G4}k{G1}l{G2}m{G3}q{GH}x{GV}t{GR}u{GL}v{GU}w{GD}n{GC}" +# When translating a termcap file, ncurses tic will do this automatically. +# The double forms characters don't fit the SVr4 terminfo model. +# +#### AT&T Extensions: +# +# The old AT&T 5410, 5420, 5425, pc6300plus, 610, and s4 entries used a set of +# nonstandard capabilities. Its signature is the KM capability, used to name +# some sort of keymap file. EE, BO, CI, CV, XS, DS, FL and FE are in this +# set. Comments in the original, and a little cross-checking with other AT&T +# documentation, seem to establish that BO=:mr: (start reverse video), DS=:mh: +# (start dim), XS=:mk: (secure/invisible mode), EE=:me: (end highlights), +# FL=:LO: (enable soft labels), FE=:LF: (disable soft labels), CI=:vi: (make +# cursor invisible), and CV=:ve: (make cursor normal). +# +#### HP Extensions +# +# The HP library (as of mid-1995, their term.h file version 70.1) appears to +# have the System V capabilities up to SVr1 level. After that, it supports +# two nonstandard caps meml and memu corresponding to the old termcap :ml:, +# :mu: capabilities. After that, it supports caps plab_norm, label_on, +# label_off, and key_f11..key_f63 capabilities like SVr4's. This makes the +# HP binary format incompatible with SVr4's. +# +#### IBM Extensions +# +# There is a set of nonstandard terminfos used by IBM's AIX operating system. +# The AIX terminfo library diverged from SVr1 terminfo, and replaces all +# capabilities following prtr_non with the following special capabilties: +# box[12], batt[12], colb[0123456789], colf[0123456789], f[01234567], kbtab, +# kdo, kcmd, kcpn, kend, khlp, knl, knpn, kppn, kppn, kquit, ksel, kscl, kscr, +# ktab, kmpf[123456789], apstr, ksf1..ksf10, kf11...kf63, kact, topl, btml, +# rvert, lvert. Some of these are identical to XPG4/SVr4 equivalents: +# kcmd, kend, khlp, and kf11...kf63. Two others (kbtab and ksel) can be +# renamed (to kcbt and kslt). The places in the box[12] capabilities +# correspond to acsc chars, here is the mapping: +# +# box1[0] = ACS_ULCORNER +# box1[1] = ACS_HLINE +# box1[2] = ACS_URCORNER +# box1[3] = ACS_VLINE +# box1[4] = ACS_LRCORNER +# box1[5] = ACS_LLCORNER +# box1[6] = ACS_TTEE +# box1[7] = ACS_RTEE +# box1[8] = ACS_BTEE +# box1[9] = ACS_LTEE +# box1[10] = ACS_PLUS +# +# The box2 characters are the double-line versions of these forms graphics. +# The AIX binary terminfo format is incompatible with SVr4's. +# +#### Iris console extensions: +# +# HS is half-intensity start; HE is half-intensity end +# CT is color terminal type (for Curses & rogue) +# CP is color change escape sequence +# CZ are color names (for Curses & rogue) +# +# The ncurses tic utility recognizes HS as an alias for mh . +# +#### TC Extensions: +# +# There is a set of extended termcaps associated with something +# called the "Terminal Control" or TC package created by MainStream Systems, +# Winfield Kansas. This one also uses GS/GE for as/ae, and also uses +# CF for civis and CO for cvvis. Finally, they define a boolean :ct: +# that flags color terminals. +# +######## NCURSES USER-DEFINABLE CAPABILITIES +# +# Extensions added after ncurses 5.0 generally use the "-x" option of tic and +# infocmp to manipulate user-definable capabilities. Those that are intended +# for use in either terminfo or termcap use 2-character names. Extended +# function keys do not use 2-character names, and are available only with +# terminfo. +# +# As of mid-2012, no other terminfo/termcap implementation than ncurses +# supports this extension; termcap libraries can as noted above make limited +# use of the feature. +# +# ncurses makes explicit checks for a few user-definable capabilities: AX, U8, +# XM. +# +#### SCREEN Extensions: +# +# The screen program uses the termcap interface. It recognizes a few useful +# nonstandard capabilities. Those are used in this file. +# +# AX (bool) Does understand ANSI set default fg/bg color (\E[39m / +# \E[49m). +# G0 (bool) Terminal can deal with ISO 2022 font selection sequences. +# E0 (str) Switch charset 'G0' back to standard charset. +# S0 (str) Switch charset 'G0' to the specified charset. +# XT (bool) Terminal understands special xterm sequences (OSC, mouse +# tracking). +# +# AX is relatively straightforward; it is interpreted by ncurses to say that +# SGR 39/49 reset the terminal's foreground and background colors to their +# "default". +# +# XT is harder, since screen's manpage does not give more details. For that, +# we must read screen's source-code. When XT is set, screen assumes +# +# a) OSC 1 sets the title string, e.g., for the icon. Recent versions of +# screen may also set the terminal's name, which is (for xterm) distinct +# from the icon name. +# b) OSC 20 sets the background pixmap. This is an rxvt feature. +# c) OSC 39 and OSC 49 set the default foreground/background colors. Again +# this is an rxvt feature. +# d) certain mode settings enable the mouse: 9, 1000, 1001, 1002, 1003. +# These are from xterm, although xterm accepts mouse codes that may not be +# recognized by screen, e.g., 1005, 1006. +# e) colors beyond 0..7 are implemented by xterm's aixterm-like 16-color +# sequence. However, because screen uses only termcap, the values returned +# by Af/Ab are not usable because they rely on expressions that termcap +# does not support. Therefore, screen uses a hardcoded string to work +# around the limitation. +# f) all entries named "*xterm*" or "*rxvt*" have the bce flag set. +# +# The other ISO-2022 features are rarely used, but provided here to make +# screen's termcap features available. +# +#### XTERM Extensions: +# +# Most of the xterm extensions are for function-keys. Since xterm patch #94 (in +# 1999), xterm has supported shift/control/alt/meta modifiers which produce +# additional function-key strings. Some other developers copied the feature, +# though they did not follow xterm's lead in xterm patch #167 (in 2002), to make +# these key definitions less ambiguous. +# +# A few terminals provide similar functionality (sending distinct keys when +# a modifier is used), including rxvt. +# +# These are the extended keys defined in this file: +# +# kDC3 kDC4 kDC5 kDC6 kDC7 kDN kDN3 kDN4 kDN5 kDN6 kDN7 kEND3 kEND4 kEND5 kEND6 +# kEND7 kHOM3 kHOM4 kHOM5 kHOM6 kHOM7 kIC3 kIC4 kIC5 kIC6 kIC7 kLFT3 kLFT4 +# kLFT5 kLFT6 kLFT7 kNXT3 kNXT4 kNXT5 kNXT6 kNXT7 kPRV3 kPRV4 kPRV5 kPRV6 kPRV7 +# kRIT3 kRIT4 kRIT5 kRIT6 kRIT7 kUP kUP3 kUP4 kUP5 kUP6 kUP7 ka2 kb1 kb3 kc2 +# +# Here are the other xterm-related extensions which are used in this file: +# +# Cr is a string capability which resets the cursor color +# Cs is a string capability which sets the cursor color to a given value. +# The single string parameter is the color name/number, according to the +# implementation. +# Ms modifies the selection/clipboard. Its parameters are +# p1 = the storage unit (clipboard, selection or cut buffer) +# p2 = the base64-encoded clipboard content. +# Se resets the cursor style to the terminal power-on default. +# Ss is a string capability with one numeric parameter. It is used to set the +# cursor style as described by the DECSCUSR function to a block or +# underline. +# TS is a string capability which acts like "tsl", but uses no parameter and +# goes to the first column of the "status line". +# XM is a string capability which overrides ncurses's built-in string which +# enables/disables xterm mouse mode. +# xm shows the format of the mouse responses. Parameters are (from zero): +# p1 = y-ordinate +# p2 = x-ordinate +# p3 = button +# p4 = state, e.g., pressed or released +# p6 = y-ordinate starting region +# p7 = x-ordinate starting region +# p8 = y-ordinate ending region +# p9 = x-ordinate ending region +# Other extensions, used in xm: +# %u = UTF-8 +# +#### Miscellaneous extensions: +# +# gsbom/grbom are used to enable/disable real bold (not intensity bright) mode. +# This was implemented for the Hurd. +# E3 clears the terminal's scrollback buffer. This was implemented in the +# Linux 3.0 kernel as a security feature. It matches a feature which was +# added in xterm patch #107. +# U8 is a numeric capability which denotes a terminal emulator which does not +# support VT100 SI/SO when processing UTF-8 encoding. Set this to a nonzero +# value to enable it. +# +######## CHANGE HISTORY +# +# The last /etc/termcap version maintained by John Kunze was 8.3, dated 8/5/94. +# Releases 9 and 10 (up until the release of ncurses 4.2 in 1998) were +# maintained by Eric S. Raymond as part of the ncurses project. +# +# This file contains all the capability information present in John Kunze's +# last version of the termcap master file, except as noted in the change +# comments at end of file. Some information about very ancient obsolete +# capabilities has been moved to comments. Some all-numeric names of older +# terminals have been retired. +# +# I changed :MT: to :km: (the 4.4BSD name) everywhere. I commented out some +# capabilities (EP, dF, dT, dV, kn, ma, ml, mu, xr, xx) that are no longer +# used by BSD curses. +# +# The 9.1.0 version of this file was translated from my lightly-edited copy of +# 8.3, then mechanically checked against 8.3 using Emacs Lisp code written for +# the purpose. Unless the ncurses tic implementation and the Lisp code were +# making perfectly synchronized mistakes which I then failed to catch by +# eyeball, the translation was correct and perfectly information-preserving. +# +# Major version number bumps correspond to major version changes in ncurses. +# +# Here is a log of the changes since then: +# +# 9.1.0 (Wed Feb 1 04:50:32 EST 1995): +# * First terminfo master translated from 8.3. +# 9.2.0 (Wed Feb 1 12:21:45 EST 1995): +# * Replaced Wyse entries with updated entries supplied by vendor. +# +# 9.3.0 (Mon Feb 6 19:14:40 EST 1995): +# * Added contact & status info from G. Clark Brown . +# 9.3.1 (Tue Feb 7 12:00:24 EST 1995): +# * Better XENIX keycap translation. Describe TC termcaps. +# * Contact and history info supplied by Qume. +# 9.3.2 (Sat Feb 11 23:40:02 EST 1995): +# * Raided the Shuford FTP site for recent termcaps/terminfos. +# * Added information on X3.64 and VT100 standard escape sequences. +# 9.3.3 (Mon Feb 13 12:26:15 EST 1995): +# * Added a correct X11R6 xterm entry. +# * Fixed terminfo translations of padding. +# 9.3.4 (Wed Feb 22 19:27:34 EST 1995): +# * Added correct acsc/smacs/rmacs strings for vt100 and xterm. +# * Added u6/u7/u8/u9 capabilities. +# * Added PCVT entry. +# 9.3.5 (Thu Feb 23 09:37:12 EST 1995): +# * Emacs uses :so:, not :mr:, for its mode line. Fix linux entry +# to use reverse-video standout so Emacs will look right. +# * Added el1 capability to ansi. +# * Added smacs/rmacs to ansi.sys. +# +# 9.4.0 (Sat Feb 25 16:43:25 EST 1995): +# * New mt70 entry. +# * Added COPYRIGHTS AND OTHER DELUSIONS. +# * Added AT&T 23xx & 500/513, vt220 and vt420, opus3n1+, netronics +# smartvid & smarterm, ampex 175 & 219 & 232, +# env230, falco ts100, fluke, intertube, superbrain, ncr7901, vic20, +# ozzie, trs200, tr600, Tandy & Texas Instruments VDTs, intext2, +# screwpoint, fviewpoint, Contel Business Systems, Datamedia Colorscan, +# adm36, mime314, ergo4000, ca22851. Replaced att7300, esprit, dd5500. +# * Replaced the Perkin-Elmer entries with vendor's official ones. +# * Restored the old minimal-ansi entry, luna needs it. +# * Fixed some incorrect ip and proportional-padding translations. +# 9.4.1 (Mon Feb 27 14:18:33 EST 1995): +# * Fix linux & AT386 sgr strings to do A_ALTCHARSET turnoff correctly. +# * Make the xterm entry 65 lines again; create xterm25 and xterm24 +# to force a particular height. +# * Added beehive4 and reorganized other Harris entries. +# 9.4.2 (Thu Mar 9 01:45:44 EST 1995): +# * Merged in DEC's official entries for its terminals. The only old +# entry I kept was Doug Gwyn's alternate vt100 (as vt100-avo). +# * Replaced the translated BBN Bitgraph entries with purpose-built +# ones from AT&T's SVr3. +# * Replaced the AT&T entries with AT&T's official terminfos. +# * Added teleray 16, vc415, cops10. +# * Merged in many individual capabilities from SCO terminfo files. +# 9.4.3 (Mon Mar 13 02:37:53 EST 1995): +# * Typo fixes. +# * Change linux entry so A_PROTECT enables IBM-PC ROM characters. +# 9.4.4 (Mon Mar 27 12:32:35 EST 1995): +# * Added tty35, Ann Arbor Guru series. vi300 and 550, cg7900, tvi803, +# pt210, ibm3164, IBM System 1, ctrm, Tymshare scanset, dt200, adm21, +# simterm, citoh and variants. +# * Replaced sol entry with sol1 and sol2. +# * Replaced Qume QVT and Freedom-series entries with purpose-built +# terminfo entries. +# * Enhanced vt220, tvi910, tvi924, hpterm, hp2645, adm42, tek +# and dg200 entries using caps from from SCO. +# * Added the usual set of function-key mappings to ANSI entry. +# * Corrected xterm's function-key capabilities. +# 9.4.5 (Tue Mar 28 14:27:49 EST 1995): +# * Fix in xterm entry, cub and cud are not reliable under X11R6. +# 9.4.6 (Thu Mar 30 14:52:15 EST 1995): +# * Fix in xterm entry, get the arrow keys right. +# * Change some \0 escapes to \200. +# 9.4.7 (Tue Apr 4 11:27:11 EDT 1995) +# * Added apple (Videx card), adm1a, oadm31. +# * Fixed malformed ampex csr. +# * Fixed act4, cyb110; they had old-style prefix padding left in. +# * Changed mandatory to advisory padding in many entries. +# * Replaced HP entries up to hpsub with purpose-built ones. +# * Blank rmir/smir/rmdc/smdc capabilities removed. +# * Small fixes merged in from SCO entries for lpr, fos, tvi910+, tvi924. +# 9.4.8 (Fri Apr 7 09:36:34 EDT 1995): +# * Replaced the Ann Arbor entries with SCO's, the init strings are +# more efficient (but the entries otherwise identical). +# * Added dg211 from Shuford archive. +# * Added synertek, apple-soroc, ibmpc, pc-venix, pc-coherent, xtalk, +# adm42-nl, pc52, gs6300, xerox820, uts30. +# * Pull SCO's padding into vi200 entry. +# * Improved capabilities for tvi4107 and other Televideo and Viewpoint +# entries merged in from SCO's descriptions. +# * Fixed old-style prefix padding on zen50, h1500. +# * Moved old superbee entry to superbee-xsb, pulled in new superbee +# entry from SCO's description. +# * Reorganized the special entries. +# * Added lm#0 to cbunix and virtual entries. +# +# 9.5.0 (Mon Apr 10 11:30:00 EDT 1995): +# * Restored cdc456tst. +# * Fixed sb1 entry, SCO erroneously left out the xsb glitch. +# * Added megatek, beacon, microkit. +# * Freeze for ncurses-1.9 release. +# 9.5.1 (Fri Apr 21 12:46:42 EDT 1995): +# * Added historical data for TAB. +# * Comment fixes from David MacKenzie. +# * Added the new BSDI pc3 entry. +# 9.5.2 (Tue Apr 25 17:27:52 EDT 1995) +# * A change in the tic -C logic now ensures that all entries in +# the termcap translation will fit in < 1024 bytes. +# * Added `bobcat' and `gator' HP consoles and the Nu machine entries +# from GNU termcap file. This merges in all their local information. +# 9.5.3 (Tue Apr 25 22:28:13 EDT 1995) +# * Changed tic -C logic to dump all capabilities used by GNU termcap. +# * Added warnings about entries with long translations (restoring +# all the GNU termcaps pushes a few over the edge). +# 9.5.4 (Wed Apr 26 15:35:09 EDT 1995) +# * Yet another tic change, and a couple of entry tweaks, to reduce the +# number of long (> 1024) termcap translations back to 0. +# +# 9.6.0 (Mon May 1 10:35:54 EDT 1995) +# * Added kf13-kf20 to Linux entry. +# * Regularize Prime terminal names. +# * Historical data on Synertek. +# * Freeze for ncurses-1.9.1. +# 9.6.1 (Sat May 6 02:00:52 EDT 1995): +# * Added true xterm-color entry, renamed djm's pseudo-color entry. +# * Eliminate whitespace in short name fields, this tanks some scripts. +# * Name field changes to shorten some long entries. +# * Termcap translation now automatically generates empty rmir/smir +# when ich1/ich is present (copes with an ancient vi bug). +# * Added `screen' entries from FSF's screen-3.6.2. +# * Added linux-nic and xterm-nic entries. +# 9.6.2 (Sat May 6 17:00:55 EDT 1995): +# * Change linux entry to use smacs=\E[11m and have an explicit acsc, +# eliminating some special-case code in ncurses. +# +# 9.7.0 (Tue May 9 18:03:12 EDT 1995): +# * Added vt320-k3, rsvidtx from the Emacs termcap.dat file. I think +# that captures everything unique from it. +# * Added reorder script generator. +# * Freeze for ncurses 1.9.2 release. +# 9.7.1 (Thu Jun 29 09:35:22 EDT 1995): +# * Added Sean Farley's kspd, flash, rs1 capabilities for linux. +# * Added Olaf Siebert's corrections for adm12. +# * ansi-pc-color now includes the colors and pairs caps, so that +# entries which use it will inherit them automatically. +# * The linux entry can now recognize the center (keypad 5) key. +# * Removed some junk that found its way into Linux acsc. +# +# 9.8.0 (Fri Jul 7 04:46:57 EDT 1995): +# * Add 50% cut mark as a desperate hack to reduce tic's core usage. +# * xterm doesn't try to use application keypad mode any more. +# * Freeze for ncurses-1.9.3 release. +# 9.8.1 (Thu Jul 19 17:02:12 EDT 1995): +# * Added corrected sun entry from vendor. +# * Added csr capability to linux entry. +# * Peter Wemm says the at386 hpa should be \E[%i%p1%dG, not \E[%p1%dG. +# * Added vt102-nsgr to cope with stupid IBM PC `VT100' emulators. +# * Some commented-out caps in long entries come back in, my code +# for computing string-table lengths had a bug in it. +# * pcansi series modified to fit comm-program reality better. +# 9.8.2 (Sat Sep 9 23:35:00 EDT 1995): +# * BSD/OS actually ships the ibmpc3 bold entry as its console. +# * Correct some bad aliases in the pcansi series +# * Added entry for QNX console. +# * Clean up duplicate long names for use with 4.4 library. +# * Change vt100 standout to be normal reverse vide, not bright reverse; +# this makes the Emacs status line look better. +# 9.8.3 (Sun Sep 10 13:07:34 EDT 1995): +# * Added Adam Thompson's VT320 entries, also his dtx-sas and z340. +# * Minor surgery, mostly on name strings, to shorten termcap version. +# +# 9.9.0 (Sat Sep 16 23:03:48 EDT 1995): +# * Added dec-vt100 for use with the EWAN emulator. +# * Added kmous to xterm for use with xterm's mouse-tracking facility. +# * Freeze for 1.9.5 alpha release. +# 9.9.1 (Wed Sep 20 13:46:09 EDT 1995): +# * Changed xterm lines to 24, the X11R6 default. +# 9.9.2 (Sat Sep 23 21:29:21 EDT 1995): +# * Added 7 newly discovered, undocumented acsc characters to linux +# entry (the pryz{|} characters). +# * ncurses no longer steals A_PROTECT. Simplify linux sgr accordingly. +# * Correct two typos in the xterm entries introduced in 9.9.1. +# * I finally figured out how to translate ko capabilities. Done. +# * Added tvi921 entries from Tim Theisen. +# * Cleanup: dgd211 -> dg211, adm42-nl -> adm42-nsl. +# * Removed mystery tec entry, it was neither interesting nor useful. +# * shortened altos3, qvt203, tvi910+, tvi92D, tvi921-g, tvi955, vi200-f, +# vi300-ss, att505-24, contel301, dm3045, f200vi, pe7000c, vc303a, +# trs200, wind26, wind40, wind50, cdc456tst, dku7003, f110, dg211, +# by making them relative to use capabilities +# * Added cuf1=^L to tvi925 from deleted variant tvi925a. +# * fixed cup in adm22 entry and parametrized strings in vt320-k3. +# * added it#8 to entries that used to have :pt: -- tvi912, vi200, +# ampex80, +# * Translate all home=\E[;H capabilities to home=\E[H, they're +# equivalent. +# * Translate \E[0m -> \E[m in [rs]mso, [rs]mul, and init strings of +# vt100 and ANSI-like terminals. +# 9.9.3 (Tue Sep 26 20:11:15 EDT 1995): +# * Added it#8 and ht=\t to *all* entries with :pt:; the ncurses tic +# does this now, too. +# * fviewpoint is gone, it duplicated screwpoint. +# * Added hp2627, graphos, graphos-30, hpex, ibmega, ibm8514, ibm8514-c, +# ibmvga, ibmvga-c, minix, mm340, mt4520-rv, screen2, screen3, +# versaterm, vi500, vsc, vt131, vt340, vt400 entries from UW. +# The UW vi50 replaces the old one, which becomes vi50adm, +# * No more embedded commas in name fields. +# +# 9.10.0 (Wed Oct 4 15:39:37 EDT 1995): +# * XENIX forms characters in fos, trs16, scoansi become acsc strings, +# * Introduced klone+* entries for describing Intel-console behavior. +# * Linux kbs is default-mapped to delete for some brain-dead reason. +# * -nsl -> -ns. The -pp syntax is obsolete. +# * Eliminate [A-Z]* primaries in accordance with SVr4 terminfo docs. +# * Make xterm entry do application-keypad mode again. I got complaints +# that it was messing up someone's 3270 emulator. +# * Added some longname fields in order to avoid warning messages from +# older tic implementations. +# * According to ctlseqs.ms, xterm has a full vt100 graphics set. Use +# it! (This gives us pi, greater than, less than, and a few more.) +# * Freeze for ncurses-1.9.6 release. +# 9.10.1 (Sat Oct 21 22:18:09 EDT 1995): +# * Add xon to a number of console entries, they're memory-mapped and +# don't need padding. +# * Correct the use dependencies in the ansi series. +# * Hand-translate more XENIX capabilities. +# * Added hpterm entry for HP's X terminal emulator. +# * Added aixterm entries. +# * Shortened four names so everything fits in 14 chars. +# +# 9.11.0 (Thu Nov 2 17:29:35 EST 1995): +# * Added ibcs2 entry and info on iBCS2 standard. +# * Corrected hpa/vpa in linux entry. They still fail the worm test. +# * We can handle the HP meml/memu capability now. +# * Added smacs to klone entries, just as documentation. +# * Carrected ansi.sys and cit-500 entries. +# * Added z39, vt320-k311, v220c, and avatar entries. +# * Make pcansi use the ansi.sys invis capability. +# * Added DIP switch descriptions for vt100, adm31, tvi910, tvi920c, +# tvi925, tvi950, dt80, ncr7900i, h19. +# * X3.64 has been withdrawn, change some references. +# * Removed function keys from ansi-m entry. +# * Corrected ansi.sys entry. +# * Freeze for ncurses-1.9.7 release. +# 9.11.1 (Tue Nov 6 18:18:38 EST 1995): +# * Added rmam/smam capabilities to many entries based on init strings. +# * Added correct hpa/vpa to linux. +# * Reduced several entries relative to vt52. +# 9.11.2 (Tue Nov 7 00:21:06 EST 1995): +# * Exiled some utterly unidentifiable custom and homebrew types to the +# UFO file; also, obsolete small-screen hardware; also, entries which +# look flat-out incorrect, garbled, or redundant. These include the +# following entries: carlock, cdc456tst, microkit, qdss, ramtek, tec, +# tec400, tec500, ubell, wind, wind16, wind40, wind50, plasma, agile, +# apple, bch, daleblit, nucterm, ttywilliams, nuterminal, nu24, bnu, +# fnu, nunix-30, nunix-61, exidy, ex3000, sexidy, pc52, sanyo55, +# yterm10, yterm11, yterm10nat, aed, aed-ucb, compucolor, compucolor2, +# vic20, dg1, act5s, netx, smartvid, smarterm, sol, sol2, dt200, +# trs80, trs100, trs200, trs600, xitex, rsvidtx, vid, att2300-x40, +# att2350-x40, att4410-nfk, att5410-ns, otty5410, att5425-nl-w, +# tty5425-fk, tty5425-w-fk, cita, c108-na, c108-rv-na, c100-rv-na, +# c108-na-acs, c108-rv-na-acs, ims950-ns, infotonKAS, ncr7900i-na, +# regent60na, scanset-n, tvi921-g, tvi925n, tvi925vbn, tvi925vb, +# vc404-na, vc404-s-na, vt420nam, vt420f-nam, vt420pc-nam, vt510nam, +# vt510pc-nam, vt520nam, vt525nam, xterm25, xterm50, xterm65, xterms. +# * Corrected pcvt25h as suggested by Brian C. Grayson +# . +# 9.11.3 (Thu Nov 9 12:14:40 EST 1995): +# * Added kspd=\E[P, kcbt=\E[Z, to linux entry, changed kbs back to ^H. +# * Added kent=\EOM to xterm entry. +# +# 9.11.4 (Fri Nov 10 08:31:35 EST 1995): +# * Corrected gigi entry. +# * Restored cuf/cud1 to xterm, their apparent bugginess was due to +# bad hpa/vpa capabilities. +# * Corrected flash strings to have a uniform delay of .2 sec. No +# more speed-dependent NUL-padding! +# * terminfo capabilities in comments bracketed with <>. +# 9.11.5 (Fri Nov 10 15:35:02 EST 1995): +# * Replaced pcvt with the 3.31 pcvt entries. +# * Freeze for 1.9.7a. +# 9.11.6 (Mon Nov 13 10:20:24 EST 1995): +# * Added emu entry from the X11R6 contrib tape sources. +# +# 9.12.0 (Wed Nov 29 04:22:25 EST 1995): +# * Improved iris-ansi and sun entries. +# * More flash string improvements. +# * Corrected wy160 & wy160 as suggested by Robert Dunn +# * Added dim to at386. +# * Reconciled pc3 and ibmpc3 with the BSDI termcap file. Keith says +# he's ready to start using the termcap generated from this one. +# * Added vt102-w, vt220-w, xterm-bold, wyse-vp, wy75ap, att4424m, +# ln03, lno3-w, h19-g, z29a*, qdss. Made vt200 an alias of vt220. +# * Improved hpterm, apollo consoles, fos, qvt101, tvi924. tvi925, +# att610, att620, att630, +# * Changed hazeltine name prefix from h to hz. +# * Sent t500 to the UFI file. +# * I think we've sucked all the juice out of BSDI's termcap file now. +# * Freeze for ncurses 1.9.8 release +# 9.12.1 (Thu Nov 30 03:14:06 EST 1995) +# * Unfreeze, linux kbs needed to be fixed. +# * Tim Theisen pinned down a bug in the DMD firmware. +# 9.12.2 (Thu Nov 30 19:08:55 EST 1995): +# * Fixes to ansi and klone capabilities (thank you, Aaron Ucko). +# (The broken ones had been shadowed by sgr.) +# 9.12.3 (Thu Dec 7 17:47:22 EST 1995): +# * Added documentation on ECMA-48 standard. +# * New Amiga entry. +# 9.12.4 (Thu Dec 14 04:16:39 EST 1995): +# * More ECMA-48 stuff +# * Corrected typo in minix entry, added pc-minix. +# * Corrected khome/kend in xterm (thank you again, Aaron Ucko). +# * Added rxvt entry. +# * Added 1.3.x color-change capabilities to linux entry. +# 9.12.5 (Tue Dec 19 00:22:10 EST 1995): +# * Corrected rxvt entry khome/kend. +# * Corrected linux color change capabilities. +# * NeXT entries from Dave Wetzel. +# * Cleaned up if and rf file names (all in /usr/share now). +# * Changed linux op capability to avoid screwing up a background color +# pair set by setterm. +# 9.12.6 (Wed Feb 7 16:14:35 EST 1996): +# * Added xterm-sun. +# 9.12.7 (Fri Feb 9 13:27:35 EST 1996): +# * Added visa50. +# +# 9.13.0 (Sun Mar 10 00:13:08 EST 1996): +# * Another sweep through the Shuford archive looking for new info. +# * Added dg100 alias to dg6053 based on a comp.terminals posting. +# * Added st52 from Per Persson. +# * Added eterm from the GNU Emacs 19.30 distribution. +# * Freeze for 1.9.9. +# 9.13.1 (Fri Mar 29 14:06:46 EST 1996): +# * FreeBSD console entries from Andrew Chernov. +# * Removed duplicate Atari st52 name. +# 9.13.2 (Tue May 7 16:10:06 EDT 1996) +# * xterm doesn't actually have ACS_BLOCK. +# * Change klone+color setf/setb to simpler forms that can be +# translated into termcap. +# * Added xterm1. +# * Removed mechanically-generated junk capabilities from cons* entries. +# * Added color support to bsdos. +# 9.13.3 (Thu May 9 10:35:51 EDT 1996): +# * Added Wyse 520 entries from Wm. Randolph Franklin . +# * Created ecma+color, linux can use it. Also added ech to linux. +# * Teach xterm about more keys. Add Thomas Dickey's 3.1.2E updates. +# * Add descriptions to FreeBSD console entries. Also shorten +# some aliases to <= 14 chars for portability. +# * Added x68k console +# * Added OTbs to several VT-series entries. +# 9.13.4 (Wed May 22 10:54:09 EDT 1996): +# * screen entry update for 3.7.1 from Michael Alan Dorman. +# 9.13.5 (Wed Jun 5 11:22:41 EDT 1996): +# * kterm correction due to Kenji Rikitake. +# * ACS correction in vt320-kll due to Phillippe De Muyter. +# 9.13.6 (Sun Jun 16 15:01:07 EDT 1996): +# * Sun console entry correction from J.T. Conklin. +# * Changed all DEC VT300 and up terminals to use VT300 tab set +# 9.13.7 (Mon Jul 8 20:14:32 EDT 1996): +# * Added smul to linux entry (we never noticed it was missing +# because of sgr!). +# * Added rmln to hp+labels (deduced from other HP entries). +# * Added vt100 acsc capability to vt220, vt340, vt400, d800, dt80-sas, +# pro350, att7300, 5420_2, att4418, att4424, att4426, att505, vt320-k3. +# * Corrected vt220 acsc. +# * The klone+sgr and klone+sgr-dumb entries now use klone+acs; +# this corresponds to reality and helps prevent some tic warnings. +# * Added sgr0 to c101, pcix, vt100-nav, screen2, oldsun, next, altos2, +# hpgeneric, hpansi, hpsub, hp236, hp700-wy, bobcat, dku7003, adm11, +# adm12, adm20, adm21, adm22, adm31, adm36, adm42, pt100, pt200, +# qvt101, tvi910, tvi921, tvi92B, tvi925, tvi950, tvi970, wy30-mc, +# wy50-mc, wy100, wyse-vp, ampex232, regent100, viewpoint, vp90, +# adds980, cit101, cit500, contel300, cs10, dm80, falco, falco-p, +# f1720a, go140, sb1, superbeeic, microb, ibm8512, kt7, ergo4000, +# owl, uts30, dmterm, dt100, dt100, dt110, appleII, apple-videx, +# lisa, trsII, atari, st52, pc-coherent, basis, m2-man, bg2.0, bg1.25, +# dw3, ln03, ims-ansi, graphos, t16, zen30, xtalk, simterm, d800, +# ifmr, v3220, wy100q, tandem653, ibmaed. +# * Added DWK terminal description. +# 9.13.8 (Wed Jul 10 11:45:21 EDT 1996): +# * Many entries now have highlights inherited from adm+sgr. +# * xterm entry now corresponds to XFree86 3.1.2E, with color. +# * xtitle and xtitle-twm enable access to the X status line. +# * Added linux-1.3.6 color palette caps in conventional format. +# * Added adm1178 terminal. +# * Move fos and apollo terminals to obsolete category. +# * Aha! The BRL terminals file told us what the Iris extensions mean. +# * Added, from the BRL termcap file: rt6221, rt6221-w, northstar, +# commodore, cdc721-esc, excel62, osexec. Replaced from the BRL file: +# cit500, adm11. +# 9.13.9 (Mon Jul 15 00:32:51 EDT 1996): +# * Added, from the BRL termcap file: cdc721, cdc721l, cdc752, cdc756, +# aws, awsc, zentec8001, modgraph48, rca vp3301/vp3501, ex155. +# * Corrected, from BRL termcap file: vi50. +# * Better rxvt entry & corrected xterm entries from Thomas Dickey. +# 9.13.10 (Mon Jul 15 12:20:13 EDT 1996): +# * Added from BRL: cit101e & variants, hmod1, vi200, ansi77, att5620-1, +# att5620-s, att5620-s, dg210, aas1901, hz1520, hp9845, osborne +# (old osborne moved to osborne-w), tvi970-vb, tvi970-2p, tvi925-hi, +# tek4105brl, tek4106brl, tek4107brl,tek4109brl, hazel, aepro, +# apple40p, apple80p, appleIIgs, apple2e, apple2e-p, apple-ae. +# * Paired-attribute fixes to various terminals. +# * Sun entry corrections from A. Lukyanov & Gert-Jan Vons. +# * xterm entry corrections from Thomas Dickey. +# 9.13.11 (Tue Jul 30 16:42:58 EDT 1996): +# * Added t916 entry, translated from a termcap in SCO's support area. +# * New qnx entry from Michael Hunter. +# 9.13.12 (Mon Aug 5 14:31:11 EDT 1996): +# * Added hpex2 from Ville Sulko. +# * Fixed a bug that ran the qnx and pcvtXX together. +# 9.13.13 (Fri Aug 9 01:16:17 EDT 1996): +# * Added dtterm entry from Solaris CDE. +# 9.13.14 (Tue Sep 10 15:31:56 EDT 1996): +# * corrected pairs#8 typo in dtterm entry. +# * added tvi9065. +# 9.13.15 (Sun Sep 15 02:47:05 EDT 1996): +# * updated xterm entry to cover 3.1.2E's new features. +# 9.13.16 (Tue Sep 24 12:47:43 EDT 1996): +# * Added new minix entry +# * Removed aliases of the form ^[0-9]* for obsolete terminals. +# * Commented out linux-old, nobody's using pre-1.2 kernels now. +# 9.13.17 (Fri Sep 27 13:25:38 EDT 1996): +# * Added Prism entries and kt7ix. +# * Caution notes about EWAN and tabset files. +# * Changed /usr/lib/tabset -> /usr/share/tabset. +# * Added acsc/rmacs/smacs to vt52. +# 9.13.18 (Mon Oct 28 13:24:59 EST 1996): +# * Merged in Thomas Dickey's reorganization of the xterm entries; +# added technical corrections to avoid warning messages. +# 9.13.19 (Sat Nov 16 16:05:49 EST 1996): +# * Added rmso=\E[27m in Linux entry. +# * Added koi8-r support for Linux console. +# * Replace xterm entries with canonical ones from XFree86 3.2. +# 9.13.20 (Sun Nov 17 23:02:51 EST 1996): +# * Added color_xterm from Jacob Mandelson +# 9.13.21 (Mon Nov 18 12:43:42 EST 1996): +# * Back off the xterm entry to use r6 as a base. +# 9.13.22 (Sat Nov 30 11:51:31 EST 1996): +# * Added dec-vt220 at Adrian Garside's request. +# +#-(original-changelog-1996/12/29-to-1998/02/28-by-TD)--------------------------- +# +# 10.1.0 (Sun Dec 29 02:36:31 EST 1996): withdrawn +# * Minor corrections to xterm entries. +# * Replaced EWAN telnet entry. +# * Dropped the reorder script generator. It was a fossil. +# 9.13.23 (Fri Feb 21 16:36:06 EST 1997): +# * Replaced minitel-2 entry. +# * Added MGR, ansi-nt. +# 9.13.24 (Sun Feb 23 20:55:23 EST 1997): +# * Thorsten Lockert added termcap `bs' to a lot of types, working from +# the 4.4BSD Lite2 file. +# +# 10.1.1 (Sat May 3 21:41:27 EDT 1997): +# * Use setaf/setab consistently with SVr4. +# * Remove ech, el1 from cons25w, they do not work in FreeBSD 2.1.5 +# 10.1.2 (Sat May 24 21:10:57 EDT 1997) +# * update xterm-xf86-v32 to match XFree86 3.2A (changes F1-F4) +# * add xterm-16color, for XFree86 3.3 +# 10.1.3 (Sat May 31 12:21:05 EDT 1997) +# * correct typo in emu +# * correct typo in vt102-w (Robert Wuest) +# * make new entry xterm-xf86-v33, restored xterm-xf86-v32. +# 10.1.4 (Sun Jun 15 08:29:05 EDT 1997) +# * remove ech capability from rxvt (it does the wrong thing) +# 10.1.5 (Sat Jun 28 21:34:36 EDT 1997) +# * remove spurious newlines from several entries (hp+color, wy50, +# wy350, wy370-nk, wy99gt-tek, wy370-tek, ibm3161, tek4205, ctrm, +# gs6300) +# 10.1.6 (Sat Jul 5 15:08:16 EDT 1997) +# * correct rmso capability of wy50-mc +# 10.1.7 (Sat Jul 12 20:05:55 EDT 1997) +# * add cbt to xterm-xf86-v32 +# * disentangle some entries from 'xterm', preferring xterm-r6 in case +# 'xterm' is derived from xterm-xf86-v32, which implements ech and +# other capabilities not in xterm-r6. +# * remove alternate character set from kterm entry. +# 10.1.8 (Sat Aug 2 18:43:18 EDT 1997) +# * correct acsc entries for ACS_LANTERN, which is 'i', not 'I'. +# 10.1.9 (Sat Aug 23 17:54:38 EDT 1997) +# * add xterm-8bit entry. +# 10.1.10 (Sat Oct 4 18:17:13 EDT 1997) +# * repair several places where early version of tic replaced \, with \\\, +# * make acsc entries canonical form (sorted, uniq). +# * modify acsc entries for linux, linux-koi8 +# * new rxvt entry, from corrected copy of distribution in rxvt 2.21b +# * add color, mouse support to kterm. +# 10.1.11 (Sat Oct 11 14:57:10 EDT 1997) +# * correct wy120 smxon/tbc capabilities which were stuck together. +# 10.1.12 (Sat Oct 18 17:38:41 EDT 1997) +# * add entry for xterm-xf86-v39t +# 10.1.13 (Sat Nov 8 13:43:33 EST 1997) +# * add u8,u9 to sun-il description +# 10.1.14 (Sat Nov 22 19:59:03 EST 1997) +# * add vt220-js, pilot, rbcomm, datapoint entries from esr's 27-jun-97 +# version. +# * add hds200 description (Walter Skorski) +# * add EMX 0.9b descriptions +# * correct rmso/smso capabilities in wy30-mc and wy50-mc (Daniel Weaver) +# * rename xhpterm back to hpterm. +# 10.1.15 (Sat Nov 29 19:21:59 EST 1997) +# * change initc in linux-c-nc to use 0..1000 range. +# 10.1.16 (Sat Dec 13 19:41:59 EST 1997) +# * remove hpa/vpa from rxvt, which implements them incorrectly. +# * add sgr0 for rxvt. +# * remove bogus smacs/rmacs from EMX descriptions. +# 10.1.17 (Sat Dec 20 17:54:10 EST 1997) +# * revised entry for att7300 +# 10.1.18 (Sat Jan 3 17:58:49 EST 1998) +# * use \0 rather than \200. +# * rename rxvt-color to rxvt to match rxvt 2.4.5 distribution. +# 10.1.19 (Sat Jan 17 14:24:57 EST 1998) +# * change xterm (xterm-xf86-v40), xterm-8bit rs1 to use hard reset. +# * rename xterm-xf86-v39t to xterm-xf86-v40 +# * remove bold/underline from sun console entries since they're not +# implemented. +# 10.1.20 (Sat Jan 24 11:02:51 EST 1998) +# * add beterm entry (Fred Fish) +# * add irix-color/xwsh entry. +# * turn ncv off for linux. +# 10.1.21 (Sat Jan 31 17:39:16 EST 1998) +# * set ncv for FreeBSD console (treat colors with reverse specially). +# * remove sgr string from qnx based on report by Xiaodan Tang +# 10.1.22 (Wed Feb 11 18:40:12 EST 1998) +# * remove spurious commas from descriptions +# * correct xterm-8bit to match XFree86 3.9Ad F1-F4. +# 10.1.23 (Sat Feb 28 17:48:38 EST 1998) +# * add linux-koi8r to replace linux-koi8 (which uses a corrupt acsc, +# apparently based on cp-866). +# +#-(replaced-changelog-1998/02/28-by-ESR)---------------------------------------- +# +# 9.13.23 (Fri Feb 21 16:36:06 EST 1997): +# * Replaced minitel-2 entry. +# * Added MGR, ansi-nt. +# * Minor corrections to xterm entries. +# * Replaced EWAN telnet entry. +# * Dropped the reorder script generator. It was a fossil. +# 9.13.24 (Sun Feb 23 20:55:23 EST 1997): +# * Thorsten Lockert added termcap `bs' to a lot of types, working from +# the 4.4BSD Lite2 file. +# 9.13.25 (Fri Jun 20 12:33:36 EDT 1997): +# * Added Datapoint 8242, pilot, ansi_psx, rbcomm, vt220js. +# * Updated iris-ansi; corrected vt102-w. +# * Switch base xterm entry to 3.3 level. +# 9.13.26 (Mon Jun 30 22:45:45 EDT 1997) +# * Added basic4. +# * Removed rmir/smir from tv92B. +# +# 10.2.0 (Sat Feb 28 12:47:36 EST 1998): +# * add hds200 description (Walter Skorski) +# * add beterm entry (Fred Fish) +# * add Thomas Dickey's xterm-xf86-v40, xterm-8bit, xterm-16color, +# iris-color entries. +# * add emx entries. +# * Replaced unixpc entry with Benjamin Sittler's corrected version. +# * Replaced xterm/rxvt/emu/syscons entries with Thomas Dickey's +# versions. +# * remove sgr string from qnx based on report by Xiaodan Tang +# * Added u8/u9, removed rmul/smul from sun-il. +# * 4.2 tic displays \0 rather than \200. +# * add linux-koi8r to replace linux-koi8 (which uses a corrupt acsc, +# apparently based on cp-866). +# * Merged in Pavel Roskin's acsc for linux-koi8 +# * Corrected some erroneous \\'s to \. +# * 4.2 ncurses has been changed to use setaf/setab, consistent w/SysV. +# * II -> ii in pcvtXX, screen, xterm. +# * Removed \n chars following ANSI escapes in sgr & friends. +# * Updated Wyse entries. +# * h19 corrections from Tim Pierce. +# * Noted that the dm2500 has both ich and smir. +# * added pccons for the Alpha under OSF/1. +# * Added Sony NEWS workstation entries and cit101e-rv. +# * Reverted `amiga'; to Kent Polk's version, as I'm told +# the Verkuil entry messes up with Amiga Telnet. +# 10.2.1 (Sun Mar 8 18:32:04 EST 1998): +# * Corrected attributions in 10.2.0 release notes. +# * Scanned the Shuford archive for new terminfos and information. +# * Removed sgr from qnx entry (Thomas Dickey). +# * Added entries for ICL and Kokusai Data Systems terminals. +# * Incorporated NCR terminfos from the Boundless Technology FTP site. +# * Incorporated att700 from the Boundless Technology FTP site. +# * Miscellaneous contact-address and Web-page updates. +# +#-(changelog-beginning-ncurses-4.2)--------------------------------------------- +# +# 1998/5/9 +# * add nxterm and xterm-color terminfo description (request by Cristian +# Gafton ). +# * modify rxvt terminfo description to clear alternate screen before +# switching back to normal screen, for compatibility with applications +# which use xterm (reported by Manoj Kasichainula ). +# * modify linux terminfo description to reset color palette (reported +# by Telford Tendys ). +# +# 1998/7/4 +# * merge changes from current XFree86 xterm terminfo descriptions. +# +# 1998/7/25 +# * Added minitel1 entries from Alexander Montaron. +# * Added qnxt2 from Federico Bianchi. +# * Added arm100 terminfo entries from Dave Millen. +# +# 1998/8/6 +# * Added ncsa telnet entries from Francesco Potorti +# +# 1998/8/15 +# * modify ncsa telnet entry to reflect color, other capabilities based on +# examination of the source code - T.Dickey. +# +# 1998/8/22 +# * Corrected some erroneous \\'s to \ (eterm, osborne) - TD. +# +# 1998/8/29 +# * Added Francesco Potorti's tuned Wyse 99 entries. +# * dtterm enacs correction from Alexander V. Lukyanov. +# * Add ncsa-ns, ncsa-m-ns and ncsa-m entries from esr version. +# * correct a typo in icl6404 entry. +# * add xtermm and xtermc +# +# 1998/9/26 +# * format most %'char' sequences to %{number} +# * adapt IBM AIX 3.2.5 terminfo - T.Dickey +# * merge Data General terminfo from Hasufin - TD +# +# 1998/10/10 +# * update xterm-xfree86 to current (xterm patch #84), for is2/rs2 changes - TD +# * correct initialization string in xterm-r5, add misc other features +# to correspond with xterm patch #84 - TD +# +# 1998/12/19 +# * update xterm-xfree86 to current (xterm patch #90), smcur/rmcur changes - TD +# * add Mathew Vernon's mach console entries +# * corrections for ncsa function-keys (report by Larry Virden) +# +# 1998/12/19 +# * change linux to use ncv#2, since underline does not work with color - TD +# +# 1999/1/9 +# * add kbt to iris-ansi, document other shift/control functionkeys - TD +# * correct iris-ansi and iris-ansi-ap with respect to normal vs keypad +# application modes, change kent to use the correct keypad code - TD +# +# 1999/1/10 +# * add entry for Tera Term - TD +# +# 1999/1/23 +# * minor improvements for teraterm entry - TD +# * rename several entries used by BSDI: bsdos to bsdos-pc-nobold, +# and bsdos-bold to bsdos-pc (Jeffrey C Honig) +# +# 1999/2/20 +# * resolve ambiguity of kend/kll/kslt and khome/kfnd/kich1 strings in +# xterm and ncsa entries by removing the unneeded ones. Note that +# some entries will return kend & khome versus kslt and kfnd, for +# PC-style keyboards versus strict vt220 compatiblity - TD +# +# 1999/3/13 +# * adjust xterm-xfree86 khome/kend to match default PC-style keyboard +# tables - TD +# * add 'crt' entry - TD +# * correct typos in 'linux-c' entry - TD +# +# 1999/3/14 +# * update entries for BSD/OS console to use klone+sgr and klone+color +# (Jeffrey C Honig) +# +# 1999/3/27 +# * adjust xterm-xfree86 miscellaneous keypad keys, as per xterm patch #94 - TD. +# +# 1999/4/10 +# * add linux-lat, from RedHat patches to ncurses 4.2 +# +# 1999/4/17 +# * add complete set of default function-key definitions for scoansi - TD. +# +# 1999/7/3 +# * add cnorm, cvvis for Linux 2.2 kernels +# +# 1999/7/24 +# * add kmous to xterm-r5 -TD +# * correct entries xterm+sl and xterm+sl-twm, which were missing the +# parent "use" clause -TD +# +# 1999/7/31 +# * corrected cnorm, added el1 in 'screen' description -TD +# +# 1999/8/14 +# * add ms-vt100 -TD +# +# 1999/8/21 +# * corrections to beterm entry -TD +# +# 1999/8/28 +# * add cygwin entry -TD +# +# 1999/9/4 +# * minor corrections for beterm entry -TD +# +# 1999/9/18 +# * add acsc string to HP 70092 terminfo entry -Joerg Wunsch +# +# 1999/9/25 +# * add amiga-8bit entry +# * add console entries from NetBSD: ofcons, wsvt25, wsvt25m, rcons, +# rcons-color, based on +# ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-current/src/share/termcap/termcap.src +# * add alias for iris-ansi-net +# +# 1999/10/2 +# * corrected scoansi entry's acsc, some function keys, add color -TD +# +# 1999/10/23 +# * add cnorm, cvvis to cons25w, and modify ncv to add 'dim' -TD +# * reorder ncsa entries to make ncsa-vt220 use the alternate function +# key mapping, leaving Potorti's entries more like he named them -TD +# * remove enter/exit am-mode from cygwin -TD +# +# 1999/10/30 +# * correct typos in several entries (missing '[' from CSI): +# mgr-sun, ncsa-m, vt320-k3, att505, avt-ns, as well as smir/rmir +# strings for avt-ns -TD +# * add 'dim' to ncv mask for linux (report by Klaus Weide). +# +# 1999/11/27 +# * correct kf1-kf4 in xterm-r6 which were vt100-style PF1-PF4 -TD +# * add hts to xterm-r6, and u6-u9 to xterm-r5 -TD +# * add xterm-88color and xterm-256color -TD +# +# 1999/12/4 +# * add "obsolete" termcap strings -TD +# * add kvt and gnome entries -TD +# +# 1999/12/11 +# * correct cup string for regent100 -TD +# +# 2000/1/1 +# * update mach, add mach-color based on Debian diffs for ncurses 5.0 -TD +# * add entries for xterm-hp, xterm-vt220, xterm-vt52 and xterm-noapp -TD +# * change OTrs capabilities to rs2 -TD +# * add obsolete and extended capabilities to 'screen' -TD +# +# 2000/1/5 +# * remove kf0 from rxvt, vt520, vt525 and ibm5151 since it conflicts +# with kf10 -TD +# * updated xterm-xf86-v40, making kdch1 correspond to vt220 'Remove', +# and adding kcbt -TD +# +# 2000/1/12 +# * remove incorrect khome/kend from xterm-xf86-v333, which was based on +# nonstandard resource settings -TD +# +# 2000/2/26 +# * minor fixes for xterm-*, based on Debian #58530 -TD +# +# 2000/3/4 +# * add several terminal types from esr's "11.0", as well as comments. +# bq300*, dku7102-old, dku7202, hft, lft, pcmw, pmcons, tws*, vip*, +# vt220-8bit, vt220-old, wy85-8bit +# +# 2000/3/18 +# * add several terminal types from esr's "11.0.1" (ansi-*). +# * update OTxx capabilities for changes on 2000/3/4. +# * revert part of vt220 change (request by Todd C Miller for OpenBSD) +# +# 2000/3/26 +# * move screen's AX extension to ecma+color, modify several entries to +# use that, adjusting ncv as needed -TD +# +# 2000/4/8 +# * add bsdos-pc-m, bsdos-pc-mono (Jeffrey C Honig) +# * correct spelling error in entry name: bq300-rv was given as bg300-rv +# in esr's version. +# +# 2000/4/15 +# * add cud, ech, etc., to beterm based on feedback from Rico Tudor -TD +# * correct color definition for ibm3164, make minor changes to other +# IBM terminal definitions based on recent terminfo descriptions -TD +# +# 2000/4/22 +# * add mgterm, from NetBSD -TD +# * add alias sun-cgsix for sun-ss5 as per NetBSD +# * change cons25w to use rs2 for reset rather than rs1 -TD +# * add rc/sc to aixterm based on manpage -TD +# +# 2000/5/13 +# * remove ncv from xterm-16color, xterm-256color +# +# 2000/6/10 +# * add kmous capability to linux to use Joerg Schoen's gpm patch. +# +# 2000/7/1 +# * add Eterm (Michael Jennings) +# +# 2000-07-18 +# * add amiga-vnc entry. +# +# 2000-08-12 +# * correct description of Top Gun Telnet. +# * add kterm-color +# +# 2000-08-26 +# * add qansi* entries from QNX ftp site. +# +# 2000-09-16 +# * add Matrix Orbital entries by Eric Z. Ayers). +# * add xterm-basic, xterm-sco entries, update related entries to XFree86 +# 4.0.1c -TD +# +# 2000-09-17 +# * add S0, E0 extensions to screen's entry -TD +# +# 2000-09-23 +# * several corrections based on tic's new parameter-checking code -TD +# * modify xterm-r6 and similar rs2 sequences which had \E7...\E8 +# bracketing sequences that reset video attributes (\E8 would restore +# them) -TD +# +# 2000-11-11 +# * rename cygwin to cygwinB19, adapt newer entry from Earnie Boyd -TD +# +# 2000-12-16 +# * improved scoansi, based on SCO man-page, and testing console, +# scoterm with tack -TD +# +# 2001-01-27 +# * modify kterm to use acsc via SCS controls. +# +# 2001-02-10 +# * screen 3.9.8 allows xterm mouse controls to pass-through +# +# 2001-03-11 +# * remove spurious "%|" from some xterm entries. +# +# 2001-03-31 +# * modify 'screen' khome/kend to match screen 3.09.08 +# * add examples of 'screen' customization (screen.xterm-xfree86, +# screen.xterm-r6, screen.teraterm) -TD +# +# 2001-04-14 +# * correct definitions of shifted editing keys for xterm-xfree86 -TD +# * add "Apple_Terminal" entries -Benjamin Sittler +# * remove time-delays from "Apple_Terminal" entries -TD +# * make sgr entries time-delays consistent with individual caps -TD +# +# 2001-05-05 +# * corrected/updated screen.xterm-xfree86 +# +# 2001-05-19 +# * ELKS descriptions, from Federico Bianchi +# * add u6 (CSR) to Eterm (Michael Jennings). +# +# 2001-07-21 +# * renamed "Apple_Terminal" entries to "nsterm" to work with Solaris's +# tic which handles names no longer than 14 characters. Add +# corresponding descriptions for the Darwin PowerPC console named +# "xnuppc" -Benjamin Sittler +# +# 2001-09-01 +# * change kbs in mach entries to ^? (Marcus Brinkmann). +# +# 2001-11-17 +# * add "putty" entry -TD +# * updated "Apple_Terminal" entries -Benjamin Sittler +# +# 2001-11-24 +# * add ms-vt100-color entry -TD +# * add "konsole" entries -TD +# +# 2001-12-08 +# * update gnome entry to Redhat 7.2 -TD +# +# 2002-05-25 +# * add kf13-kf48 strings to cons25w -TD +# * add pcvt25-color entry -TD +# * changed a few /usr/lib/tabset -> /usr/share/tabset. +# * improve some features of scoansi entry based on SCO's version -TD +# * add scoansi-new entry corresponding to OpenServer 5.0.6 +# +# 2002-06-15 +# * add kcbt to screen entry -TD +# +# 2002-06-22 +# * add rxvt-16color, ibm+16color, mvterm entries -TD +# +# 2002-09-28 +# * split out linux-basic entry, making linux-c inherit from that, and +# in turn linux (with cnorm, etc) inherit from linux-c-nc to reflect +# the history of this console type -TD +# * scaled the linux-c terminfo entry to match linux-c-nc, i.e., the +# r/g/b parameters of initc are in the range 0 to 1000 -TD +# +# 2002-10-05 +# * minor fix for scale-factor of linux-c and linux-c-nc -TD +# +# 2002-11-09 +# * split-out vt100+keypad and vt220+keypad, fix interchanged ka3/kb2 +# in the latter -TD +# +# 2002-11-16 +# * add entries for mterm (mterm, mterm-ansi, decansi) -TD +# * ncr260wy350pp has only 16 color pairs -TD +# * add sun-type4 from NetBSD -TD +# * update xterm-xfree86 to current (xterm patch #170) -TD +# * add screen-bce, screen-s entries -TD +# * add xterm-1002, xterm-1003 entries -TD +# +# 2003-01-11 +# * update homepage for Top Gun Telnet/SSH +# +# 2003-01-25 +# * reduce duplication in emx entries, added emx-base -TD +# +# 2003-05-24 +# * corrected acs for screen.teraterm -TD +# * add tkterm entry -TD +# +# 2003-07-15 +# * cygwin changes from Charles Wilson: +# misc/terminfo.src (nxterm|xterm-color): make xterm-color +# primary instead of nxterm, to match XFree86's xterm.terminfo +# usage and to prevent circular links. +# (rxvt): add additional codes from rxvt.org. +# (rxvt-color): new alias +# (rxvt-xpm): new alias +# (rxvt-cygwin): like rxvt, but with special acsc codes. +# (rxvt-cygwin-native): ditto. rxvt may be run under XWindows, or +# with a "native" MSWin GUI. Each takes different acsc codes, +# which are both different from the "normal" rxvt's acsc. +# (cygwin): cygwin-in-cmd.exe window. Lots of fixes. +# (cygwinDBG): ditto. +# +# 2003-09-27 +# * update gnome terminal entries -TD +# +# 2003-10-04 +# * add entries for djgpp 2.03 and 2.04 -TD +# +# 2003-10-25 +# * add alias for vtnt -TD +# * update xterm-xfree86 for XFree86 4.4 -TD +# +# 2003-11-22 +# * add linux-vt (Andrey V Lukyanov) +# +# 2003-12-20 +# * add screen.linux -TD +# +# 2004-01-10 +# * revised/improved entries for tvi912b, tvi920b (Benjamin Sittler) +# +# 2004-01-17 +# * add OpenNT/Interix/SFU entries (Federico Bianchi) +# * add vt100+ and vt-utf8 entries -TD +# * add uwin entry -TD +# +# 2004-03-27 +# * add sgr strings to several common entries lacking them, e.g., +# screen, to make the entries more portable -TD +# * remove cvvis from rxvt entry, since it is the same as cnorm -TD +# * similar fixups for cvvis/cnorm various entries -TD +# +# 2004-05-22 +# * remove 'ncv' from xterm-256color (xterm patch #188) -TD +# +# 2004-06-26 +# * add mlterm -TD +# * add xterm-xf86-v44 -TD +# * modify xterm-new aka xterm-xfree86 to accommodate luit, which relies +# on G1 being used via an ISO-2022 escape sequence (report by +# Juliusz Chroboczek) -TD +# * add 'hurd' entry -TD +# +# 2004-07-03 +# * make xterm-xf86-v43 derived from xterm-xf86-v40 rather than +# xterm-basic -TD +# * align with xterm #192's use of xterm-new -TD +# * update xterm-new and xterm-8bit for cvvis/cnorm strings -TD +# * make xterm-new the default "xterm" -TD +# +# 2004-07-10 +# * minor fixes for emu -TD +# * add emu-220 +# * add rmam/smam to linux (Trevor Van Bremen) +# * change wyse acsc strings to use 'i' map rather than 'I' -TD +# * fixes for avatar0 -TD +# * fixes for vp3a+ -TD +# +# 2004-07-17 +# * add xterm-pc-fkeys -TD +# * review/update gnome and gnome-rh90 entries (prompted by +# Redhat Bugzilla #122815) -TD +# * review/update konsole entries -TD +# * add sgr, correct sgr0 for kterm and mlterm -TD +# * correct tsl string in kterm -TD +# +# 2004-07-24 +# * make ncsa-m rmacs/smacs consistent with sgr -TD +# * add sgr, rc/sc and ech to syscons entries -TD +# * add function-keys to decansi -TD +# * add sgr to mterm-ansi -TD +# * add sgr, civis, cnorm to emu -TD +# * correct/simplify cup in addrinfo -TD +# * corrections for gnome and konsole entries +# (Redhat Bugzilla #122815) -Hans de Goede +# * modify DEC entries (vt220, etc), to add sgr string, and to use +# ISO-2022 strings for rmacs/smacs -TD +# +# 2004-07-31 +# * rename xterm-pc-fkeys to xterm+pcfkeys -TD +# +# 2004-08-07 +# * improved putty entry -Robert de Bath +# +# 2004-08-14 +# * remove dch/dch1 from rxvt because they are implemented inconsistently +# with the common usage of bce/ech -TD +# * remove khome from vt220 (vt220's have no home key) -TD +# * add rxvt+pcfkeys -TD +# +# 2004-08-21 +# * modify several entries to ensure xterm mouse and cursor visibility +# are reset in rs2 string: hurd, putty, gnome, konsole-base, mlterm, +# Eterm, screen. (The xterm entries are left alone - old ones for +# compatibility, and the new ones do not require this change) -TD +# +# 2004-08-28 +# * add morphos entry -Pavel Fedin +# * modify amiga-8bit to add khome/kend/knp/kpp -Pavel Fedin +# * corrected \E[5?l to \E[?5l in vt320 entries -TD +# +# 2004-11-20 +# * update wsvt25 entry -TD +# +# 2005-01-29 +# * update pairs for xterm-88color and xterm-256color to reflect the +# ncurses extended-color support -TD +# +# 2005-02-26 +# * modify sgr/sgr0 in xterm-new to improve tgetent's derived "me" -TD +# * add aixterm-16color to demonstrate 16-color capability -TD +# +# 2005-04-23 +# * add media-copy to vt100 -TD +# * corrected acsc string for vt52 -TD +# +# 2005-04-30 +# * add kUP, kDN (user-defined shifted up/down arrow) definitions for +# xterm-new -TD +# * add kUP5, kUP6, etc., for xterm-new and rxvt -TD +# +# 2005-05-07 +# * re-corrected acsc string for vt52 -TD +# +# 2005-05-28 +# * corrected sun-il sgr string which referred to bold and underline -TD +# * add sun-color entry -TD +# +# 2005-07-23 +# * modify sgr0 in several entries to reset alternate-charset as in the +# sgr string -TD +# * modify sgr string of prism9 to better match the individual +# attributes -TD +# +# 2005-10-15 +# * correct order of use= in rxvt-basic -TD +# +# 2005-10-26 +# * use kind/kri as shifted up/down cursor keys for xterm-new -TD +# +# 2005-11-12 +# * other minor fixes to cygwin based on tack -TD +# * correct smacs in cygwin (report by Baurzhan Ismagulov). +# +# 2006-02-18 +# * add nsterm-16color entry -TD +# * remove ncv flag from xterm-16color -TD +# * remove setf/setb from xterm-256color to match xterm #209 -TD +# * update mlterm entry to 2.9.2 -TD +# +# 2006-02-25 +# * fixes to make nsterm-16color match report +# by Christian Ebert -Alain Bench +# +# 2006-04-22 +# * add xterm+256color building block -TD +# * add gnome-256color, putty-256color, rxvt-256color -TD +# +# 2006-05-06 +# * add hpterm-color -TD +# +# 2006-06-24 +# * add xterm+pcc0, xterm+pcc1, xterm+pcc2, xterm+pcc3 -TD +# * add gnome-fc5 (prompted by GenToo #122566) -TD +# * remove obsolete/misleading comments about kcbt on Linux -Alain Bench +# * improve xterm-256color by combining the ibm+16color setaf/setab +# strings with SGR 48. The setf/setb strings also are cancelled here +# rather than omitted so derived entries will cancel those also -Alain +# Bench +# +# 2006-07-01 +# * add some notes regarding copyright to terminfo.src -TD +# * use rxvt+pcfkeys in Eterm -TD +# * remove km and flash from gnome, Eterm and rxvt since they do not work +# as one would expect (km sends ESC rather than setting the 8th bit +# of the key) -TD +# * add/use ansi+enq, vt100+enq and vt102+enq -TD +# * add konsole-solaris -TD +# +# 2006-07-22 +# * update xterm-sun and xterm-sco entries to match xterm #216 -TD +# * modify is2/rs2 strings for xterm-r6 as per fix in xterm #148 -TD +# * modify xterm-24 to inherit from "xterm" -TD +# * add xiterm entry -TD +# * add putty-vt100 entry -TD +# * corrected spelling of Michael A Dorman's name, prompted by +# http://www.advogato.org/person/mdorman/diary.html -TD +# +# 2006-08-05 +# * add xterm+pcf0, xterm+pcf2 from xterm #216 -TD +# * update xterm+pcfkeys to match xterm #216 -TD +# +# 2006-08-17 +# * make descriptions of xterm entries consistent with its terminfo -TD +# +# 2006-08-26 +# * add xfce, mgt -TD +# +# 2006-09-02 +# * correct acsc string in kterm -TD +# +# 2006-09-09 +# * add kon entry -TD +# * remove invis from linux and related entries, add klone+sgr8 for those +# that implement the feature (or have not been shown to lack it) -TD +# +# 2006-09-23 +# * add ka2, kb1, kb3, kc2 to vt220-keypad as an extension -TD +# * minor improvements to rxvt+pcfkeys -TD +# +# 2006-09-30 +# * fix a few typos in if/then/else expressions -TD +# +# 2006-10-07 +# * add several GNU Screen variations with 16- and 256-colors, and +# status line (Alain Bench). +# +# 2007-03-03 +# * add Newbury Data entries (Jean-Charles Billaud). +# +# 2007-06-10 +# * corrected xterm+pcf2 modifiers for F1-F4, match xterm #226 -TD +# +# 2007-07-14 +# * restore section of pre-ncurses-4.2 changelog to fix attribution -TD +# * add konsole-256color entry -TD +# +# 2007-08-18 +# * add 9term entry (request by Juhapekka Tolvanen) -TD +# +# 2007-10-13 +# * correct kIC in rxvt+pcfkeys (prompted by Debian #446444) -TD +# * add shift-control- and control-modified keys for rxvt editing +# keypad -TD +# * update mlterm entry to 2.9.3 -TD +# * add mlterm+pcfkeys -TD +# +# 2007-10-20 +# * move kLFT, kRIT, kind and kri capabilities from xterm-new to +# xterm+pcc0, etc., to make the corresponding building blocks reflect +# xterm's capabilities -TD +# * add mrxvt entry -TD +# * add xterm+r6f2, use in mlterm and mrxvt entries -TD +# +# 2007-11-03 +# * correct acsc strings for h19 and z100 (Benjamin Sittler) +# +# 2007-11-11 +# * use xterm-xf86-v44 for "xterm-xfree86", reflecting changes to +# xterm starting with xterm patch #216 -TD +# * make legacy xterm entries such as xterm-24 inherit from xterm-old, +# to match xterm #230 -TD +# * extend xterm+pccX entries to match xterm #230 -TD +# * add xterm+app, xterm+noapp, from xterm #230 -TD +# * add/use xterm+pce2 from xterm #230, in xterm+pcfkeys -TD +# +# 2008-04-19 +# * add screen.rxvt -TD +# +# 2008-04-28 +# * add screen+fkeys (prompted by Debian #478094) -TD +# +# 2008-06-28 +# * add screen.mlterm -TD +# * improve mlterm and mlterm+pcfkeys -TD +# +# 2008-08-23 +# * add Eterm-256color, Eterm-88color -TD +# * add rxvt-88color -TD +# +# 2008-10-12 +# * add teraterm4.59 entry, use that as primary teraterm entry, rename +# original to teraterm2.3 -TD +# * update "gnome" to 2.22.3 -TD +# * update "konsole" to 1.6.6 -TD +# * add "aterm" -TD +# * add "linux2.6.26" -TD +# +# 2008-11-15 +# * change several \E[2g (clear tab at current column) to \E[3g +# (clear all tabs) to match definition for tbc capability -TD +# +# 2008-11-29 +# * add eterm-color -TD +# +# 2009-01-10 +# * add screen.Eterm -TD +# +# 2009-03-28 +# * correct typo in pfkey of ansi.sys-old +# (report by Kalle Olavi Niemitalo) +# * move function- and cursor-keys from emx-base to ansi.sys, and create +# a pfkey capability which handles F1-F48 -TD +# +# 2009-05-02 +# * add vwmterm entry (Bryan Christ) +# +# 2009-09-19 +# * change ncv and op capabilities in sun-color to match Sun's entry for +# this (report by Laszlo Peter) +# * improve interix smso by using reverse rather than bold (report by +# Kristof Zelechovski). +# +# 2009-10-03 +# * remove unnecessary kcan assignment to ^C from putty (Sven Joachim) +# * add linux-16color (Benjamin Sittler) +# * correct initc capability of linux-c-nc end-of-range (Benjamin Sittler) +# * similar change for dg+ccc and dgunix+ccc (Benjamin Sittler) +# * add ccc and initc capabilities to xterm-16color -TD +# +# 2009-10-31 +# * updated nsterm* entries (Benjamin Sittler, prompted by GenToo #206201) +# +# 2009-12-12 +# * updated nsterm* entries (Benjamin Sittler, Emanuele Giaquinta) +# +# 2009-12-19 +# * add bw (auto-left-margin) to nsterm* entries (Benjamin Sittler) +# * rename minix to minix-1.7, add minix entry for Minux3 -TD +# +# 2009-12-26 +# * add bterm (bogl 0.1.18) -TD +# * minor fix to rxvt+pcfkeys -TD +# +# 2010-02-06 +# * update mrxvt to 0.5.4, add mrxvt-256color -TD +# +# 2010-02-13 +# * add several screen-bce.XXX entries -TD +# +# 2010-02-23 +# * modify screen-bce.XXX entries to exclude ech, since screen's color +# model does not clear with color for that feature -TD +# +# 2010-03-20 +# * rename atari and st52 to atari-old, st52-old, use newer entries from +# FreeMiNT by Guido Flohr (from patch/report by Alan Hourihane). +# +# 2010-06-12 +# * add mlterm-256color entry -TD +# +# 2010-07-17 +# * add hard-reset for rs2 to wsvt25 to help ensure that reset ends +# the alternate character set (patch by Nicholas Marriott) +# +# 2010-08-28 +# * improve acsc for vt52 (Benjamin Sittler) +# * modify nsterm entries for consistent sgr/sgr0 -TD +# * modify xnuppc entries for consistent sgr/sgr0 -TD +# * add invis to tek4115 sgr -TD +# +# 2010-09-11 +# * reformat acsc strings to canonical format -TD +# +# 2010-09-25 +# * add "XT" capability to entries for terminals that support both +# xterm-style mouse- and title-controls, for "screen" which +# special-cases TERM beginning with "xterm" or "rxvt" -TD +# +# 2010-10-02 +# * fill in no-parameter forms of cursor-movement where a parameterized +# form is available -TD +# * fill in missing cursor controls where the form of the controls is +# ANSI -TD +# * add parameterized cursor-controls to linux-basic (report by Dae) -TD +# +# 2010-10-09 +# * correct comparison used for setting 16-colors in linux-16color +# entry (Novell #644831) -TD +# * improve linux-16color entry, using "dim" for color-8 which makes it +# gray rather than black like color-0 -TD +# +# 2010-11-20 +# * make "vte" the principal entry defining "gnome", since GNOME terminal +# is merely one of several terminals whose behavior is provided by this +# library -TD +# +# 2010-11-27 +# * fix typo in rmso for tek4106 -Goran Weinholt +# +# 2010-12-11 +# * suppress ncv in screen entry, allowing underline -Alejandro R. Sedeno +# * also suppress ncv in konsole-base -TD +# +# 2011-02-05 +# * add U8 feature to denote entries for terminal emulators which do not +# support VT100 SI/SO when processing UTF-8 encoding -TD +# * add xterm-utf8 as a demo of the U8 feature -TD +# +# 2011-02-20 +# * add cons25-debian entry (Brian M Carlson, Debian #607662). +# +# 2011-06-11 +# * update minix entry to minix 3.2 (Thomas Cort). +# +# 2011-07-09 +# * fix inconsistent tabset path in pcmw (Todd C. Miller). +# * remove a backslash which continued comment, obscuring altos3 +# definition with OpenBSD toolset (Nicholas Marriott). +# +# 2011-07-16 +# * add/use xterm+tmux chunk from xterm #271 -TD +# * resync xterm-new entry from xterm #271 -TD +# * add E3 extended capability to linux-basic (Miroslav Lichvar) +# * add linux2.2, linux2.6, linux3.0 entries to give context for E3 -TD +# * add SI/SO change to linux2.6 entry (Debian #515609) -TD +# +# 2011-07-21 +# * add kich1 to sun (Yuri Pankov) +# * use bold rather than reverse for smso in sun-color (Yuri Pankov). +# +# 2011-08-06 +# * corrected k9 in dg460-ansi, add other features based on manuals -TD +# +# 2011-08-20 +# * minor cleanup of X-terminal emulator section -TD +# * add terminator entry -TD +# * add simpleterm entry -TD +# +# 2011-09-10 +# * add xterm+kbs fragment from xterm #272 -TD +# +# 2011-11-12 +# * add pccon entries for OpenBSD console (Alexei Malinin) +# +# 2011-12-17 +# * corrected old changelog comments -TD +# +# 2011-11-24 +# * add putty-sco -TD +# +# 2012-01-28 +# * add mach-gnu (Samuel Thibault) +# * add mach-gnu-color, tweaks to mach-gnu -TD +# * make sgr for sun-color agree with smso -TD +# * make sgr for prism9 agree with other caps -TD +# * make sgr for icl6404 agree with other caps -TD +# * make sgr for ofcons agree with other caps -TD +# * make sgr for att5410v1, att4415, att620 agree with other caps -TD +# * make sgr for aaa-unk, aaa-rv agree with other caps -TD +# * make sgr for avt-ns agree with other caps -TD +# +# 2012-02-11 +# * make sgr for xterm-pcolor agree with other caps -TD +# * make sgr for att5425 agree with other caps -TD +# * make sgr for att630 agree with other caps -TD +# * make sgr for linux entries agree with other caps -TD +# * make sgr for tvi9065 agree with other caps -TD +# * make sgr for ncr260vt200an agree with other caps -TD +# * make sgr for ncr160vt100pp agree with other caps -TD +# * make sgr for ncr260vt300an agree with other caps -TD +# * make sgr for aaa-60-dec-rv, aaa+dec agree with other caps -TD +# * make sgr for cygwin, cygwinDBG agree with other caps -TD +# +# 2012-03-31 +# * correct order of use-clauses in st-256color -TD +# +# 2012-04-01 +# * revert 2011-07-16 change to "linux" alias, return to "linux2.2" -TD +# +# 2012-04-14 +# * document all of the user-defined capabilities in one place -TD +# * add XT to some places to improve usefulness for other applications +# than screen, which would like to pretend that xterm's title is +# a status-line. -TD +# * change use-clauses in ansi-mtabs, hp2626, and hp2622 based on review +# of ordering and overrides -TD +# +# 2012-04-21 +# * add msgr to vt420, similar DEC vtXXX entries -TD +# * add several missing vt420 capabilities from vt220 -TD +# * factor out ansi+pp from several entries -TD +# * change xterm+sl and xterm+sl-twm to include only the status-line +# capabilities and not "use=xterm", making them more generally useful +# as building-blocks -TD +# * add dec+sl building block, as example -TD +# +# 2012-04-28 +# * fix some inconsistencies between vt320/vt420, e.g., cnorm/civis -TD +# * add eslok flag to dec+sl -TD +# * dec+sl applies to vt320 and up -TD +# * drop wsl width from xterm+sl -TD +# * reuse xterm+sl in putty and nsca-m -TD +# * add ansi+tabs to vt520 -TD +# * add ansi+enq to vt220-vt520 -TD +# +# 2012-05-05 +# * remove p6 (bold) from opus3n1+ for consistency -TD +# * remove acs stuff from env230 per clues in Ingres termcap -TD +# * modify env230 sgr/sgr0 to match other capabilities -TD +# * modify smacs/rmacs in bq300-8 to match sgr/sgr0 -TD +# * make sgr for dku7202 agree with other caps -TD +# * make sgr for ibmpc agree with other caps -TD +# * make sgr for tek4107 agree with other caps -TD +# * make sgr for ndr9500 agree with other caps -TD +# * make sgr for sco-ansi agree with other caps -TD +# * make sgr for d410 agree with other caps -TD +# * make sgr for d210 agree with other caps -TD +# * make sgr for d470c, d470c-7b agree with other caps -TD +# +# 2012-05-12 +# * rewrite vt520 entry based on vt420 -TD +# * corrected 'op' for bterm (report by Samuel Thibault) -TD +# +# 2012-06-02 +# * add kdch1 to wsvt25 entry from NetBSD CVS (reported by David Lord, +# analysis by Martin Husemann). +# * add cnorm/civis to wsvt25 entry from NetBSD CVS (report/analysis by +# Onno van der Linden). +# * add kdch1 aka "Remove" to vt220 and vt220-8 entries -TD +# * add kdch1, etc., to qvt108 -TD +# * add dl1/il1 to some entries based on dl/il values -TD +# * add dl to simpleterm -TD +# +# 2012-06-10 +# * modify some older xterm entries to align with xterm source -TD +# * separate "xterm-old" alias from "xterm-r6" -TD +# +# 2012-07-28 +# * add E3 to xterm-basic and putty -TD +# +# 2012-08-11 +# * add nsterm-256color, make this the default nsterm -TD +# * remove bw from nsterm-bce, per testing with tack -TD +# +# 2012-10-12 +# * add vte-2012, gnome-2012, making these the defaults for vte/gnome +# (patch by Christian Persch). +# +# 2012-11-02 +# * reviewed vte-2012, reverted most of the change since it was incorrect +# based on testing with tack -TD +# * un-cancel the initc in vte-256color, since this was implemented +# starting with version 0.20 in 2009 -TD +# +# 2013-03-16 +# * correct typo in sgr string for sun-color, +# add bold for consistency with sgr, +# change smso for consistency with sgr -TD +# * correct typo in sgr string for terminator -TD +# * add blink to the attributes masked by ncv in linux-16color (report +# by Benjamin Sittler) +# +# 2013-03-23 +# * change initialization for vt220, similar entries for consistency +# with cursor-key strings (NetBSD #47674) -TD +# * further improvements to linux-16color (Benjamin Sittler) +# +# 2013-05-11 +# * move nsterm-related entries out of "obsolete" section to more +# plausible "ansi consoles" -TD +# * additional cleanup of table-of-contents by reordering -TD +# +# 2013-06-07 +# * added note to clarify Terminal.app's non-emulation of the various +# terminal types listed in the preferences dialog -TD +# +# 2013-11-02 +# * use TS extension to describe xterm's title-escapes -TD +# * modify terminator and nsterm-s to use xterm+sl-twm building block -TD +# * update hurd.ti, add xenl to reflect 2011-03-06 change in +# http://git.savannah.gnu.org/cgit/hurd/hurd.git/log/console/display.c +# (Debian #727119). +# * simplify pfkey expression in ansi.sys -TD +# +# 2013-11-10 +# * split-out building blocks xterm+sm+1002 and xterm+sm+1003 -TD +# +# 2014-02-22 +# * updated notes for wsvt25 based on tack and vttest -TD +# * add teken entry to show actual properties of FreeBSD's "xterm" +# console -TD +# +# 2014-03-22 +# * add terminology entry -TD +# * add mlterm3 entry, use that as "mlterm" -TD +# * inherit mlterm-256color from mlterm -TD +# +# 2014-03-23 +# * fix typo in "mlterm" entry (report by Gabriele Balducci) -TD +# +# 2014-03-30 +# * cancel ccc in putty-256color and konsole-256color for consistency +# with the cancelled initc capability (patch by Sven Zuhlsdorf). +# * add xterm+256setaf building block for various terminals which only +# get the 256-color feature half-implemented -TD +# * updated "st" entry (leaving the 0.1.1 version as "simpleterm") to +# 0.4.1 -TD +# +# 2014-05-03 +# * add vt520ansi (Mike Gran) +# +# 2014-05-24 +# * correct several entries which had termcap-style padding used in +# terminfo: adm21, aj510, alto-h19, att605-pc, x820 -TD +# * correct syntax for padding in some entries: dg211, h19 -TD +# * correct ti924-8 which had confused padding versus octal escapes -TD +# * correct padding in sbi entry -TD +# +# 2014-06-07 +# * update xterm-new to xterm patch #305 -TD +# + change screen's smso to use SGR 7 (ECMA-80 reverse) rather than SGR 3 +# (italic). This was a long-ago typo in screen 3.1.1 which was +# overlooked until a few terminal emulators implemented the feature -TD +# +# 2014-06-09 +# > fix regression in screen terminfo entries (reports by Christian +# Ebert, Gabriele Balducci) -TD +# + revert the change to screen; see notes for why this did not work -TD +# + cancel sitm/ritm for entries which extend "screen", to work around +# screen's hardcoded behavior for SGR 3 -TD +# +# 2014-06-14 +# + modify sgr for screen.xterm-new to support dim capability -TD +# + add dim capability to nsterm+7 -TD +# + cancel dim capability for iterm -TD +# + add dim, invis capabilities to vte-2012 -TD +# + add sitm/ritm to konsole-base and mlterm3 -TD +# +# 2014-10-06 +# + add xterm-1005 and xterm-1006 entries, with suggested extension +# capability "xm" -TD +# +# 2014-10-07 +# + update test-report for mrxvt -TD +# +# 2014-10-11 +# + add xterm-x10mouse, xterm-x11mouse, etc. -TD +# +# 2014-10-18 +# + reviewed terminology 0.6.1, add function key definitions. None of +# the vt100-compatibility issues were improved -TD +# +# 2015-04-22 +# + add 'dim' capability to screen entry (report by Leonardo B Schenkel) +# + add several key definitions to nsterm-bce to match preconfigured +# keys, e.g., with OSX 10.9 and 10.10 (report by Leonardo B Schenkel) +# +# 2015-05-02 +# + remove unnecessary ';' from E3 capabilities -TD +# + add tmux entry, derived from screen (patch by Nicholas Marriott). +# + split-out recent change to nsterm-bce as nsterm-build326, and add +# nsterm-build342 to reflect changes with successive releases of OSX +# (discussion with Leonardo B Schenkel) +# + add xon, ich1, il1 to ibm3161 (patch by Stephen Powell, +# Debian #783806) +# +# 2015-05-17 +# + remove screen-bce.mlterm, since mlterm does not do "bce" -TD +# + add several screen.XXX entries to support the respective variations +# for 256 colors -TD +# +# 2015-05-23 +# + add putty+fnkeys* building-block entries -TD +# +# 2015-05-30 +# + remove spurious "%;" from st entry (report by Daniel Pitts) -TD +# + add vte-2014, update vte to use that -TD +# +# 2015-06-27 +# + comment-out "screen.xterm" entry, and inherit screen.xterm-256color +# from xterm-new (report by Richard Birkett) -TD +# +# 2015-07-25 +# + add status line to tmux via xterm+sl (patch by Nicholas Marriott). +# + fixes for st 0.5 from testing with tack -TD +# +# 2015-10-24 +# + updated minitel entries to fix kel problem with emacs, and add +# minitel1b-nb (Alexandre Montaron). +# + reviewed/updated nsterm entry Terminal.app in OSX -TD +# + replace some dead URLs in commands with equivalents from the +# Internet Archive -TD +# +# 2015-11-14 +# + add bold to pccon+sgr+acs and pccon-base (Tati Chevron). +# + add keys f12-f124 to pccon+keys (Tati Chevron). +# +# 2015-11-21 +# + fix some inconsistencies in the pccon* entries -TD +# +# 2015-11-28 +# + add viewdata (Alexandre Montaron). +# +# 2016-01-16 +# + tidy up comments about hardcoded 256color palette (report by +# Leonardo Brondani Schenkel) -TD +# + add putty-noapp entry, and amend putty entry to use application mode +# for better consistency with xterm (report by Leonardo Brondani +# Schenkel) -TD +# +# 2016-04-23 +# + add 'oc' capability to xterm+256color, allowing palette reset for +# xterm -TD +# +# 2016-05-14 +# + modify linux2.6 entry to improve line-drawing -TD +# + make linux3.0 entry the default linux entry (Debian #823658) -TD +# +# 2016-05-29 +# + modify rs1 for xterm-16color, xterm-88color and xterm-256color to +# reset palette using "oc" string as in linux -TD +# +# 2016-06-11 +# + use ANSI reply for u8 in xterm-new, to reflect vt220-style responses +# that could be returned -TD +# + added a few capabilities fixed in recent vte -TD +# +# 20160817 +# + correct a typo in interix -TD +# +# 2016-09-24 +# + updated minitel entries to use status line with screen(1), as well as +# printing special G2 videotex chars like french accentuated glyph +# using special cap XC= (patch by Alexandre Montaron). +# +# 2016-10-01 +# + add linux-m1 minitel entries (patch by Alexandre Montaron). +# + correct rs2 string for vt100-nam -TD +# +# 2016-11-26 +# + modify linux-16color to not mask dim, standout or reverse with the +# ncv capability -TD +# + add 0.1sec mandatory delay to flash capabilities using the VT100 +# reverse-video control -TD +# + omit selection of ISO-8859-1 for G0 in enacs capability from linux2.6 +# entry, to avoid conflict with the user-defined mapping. The reset +# feature will use ISO-8859-1 in any case (Mikulas Patocka). +# +# 2016-12-30 +# + merge current st description (report by Harry Gindi) -TD +# +# 2016-12-31 +# + modify flash capability for linux and wyse entries to put the delay +# between the reverse/normal escapes rather than after -TD +# +# 2017-01-28 +# + minor comment-fixes to help automate links to bug-urls -TD +# + add dvtm, dvtm-256color -TD +# + add settings corresponding to xterm-keys option to tmux entry to +# reflect upcoming change to make that option "on" by default +# (patch by Nicholas Marriott). +# + uncancel Ms in tmux entry (Harry Gindi, Nicholas Marriott). +# + add dumb-emacs-ansi -TD +# +######## SHANTIH! SHANTIH! SHANTIH! + +# From: Thomas Dickey 04 Oct 1997 +# Updated: Özgür Kesim 02 Nov 1997 +# Updated: Marc Lehmann , 17 Feb 2005 +# Updated: Marc Lehmann , 04 Nov 2008: change init/reset sequences +# Updated: Marc Lehmann , 24 Nov 2014: implement cvvis as blinking cursor +# Updated: Marc Lehmann , 13 Dec 2014: removed superfluous 0 from sgr +rxvt-unicode|rxvt-unicode terminal (X Window System), + am, + bce, + eo, + km, + msgr, + xenl, + hs, + cols#80, + it#8, + lines#24, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~-A.B+C\,D0EhFiG, + bel=^G, + blink=\E[5m, + bold=\E[1m, + clear=\E[H\E[2J, + civis=\E[?25l, + cnorm=\E[?12l\E[?25h, + cvvis=\E[?12;25h, + cr=^M, + csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, + cub1=^H, + cud=\E[%p1%dB, + cud1=^J, + cuf=\E[%p1%dC, + cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, + cuu1=\E[A, + dch=\E[%p1%dP, + dch1=\E[P, + dl=\E[%p1%dM, + dl1=\E[M, + ed=\E[J, + el=\E[K, + el1=\E[1K, + flash=\E[?5h$<20/>\E[?5l, + home=\E[H, + hpa=\E[%i%p1%dG, + ht=^I, + hts=\EH, + ich=\E[%p1%d@, + ich1=\E[@, + il=\E[%p1%dL, + il1=\E[L, + ind=^J, + is1=\E[\041p, + is2=\E[r\E[m\E[2J\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l, + kDC=\E[3$, + kDC5=\E[3\^, + kDC6=\E[3@, + kDN=\E[b, + kDN5=\EOb, + kIC=\E[2$, + kIC5=\E[2\^, + kIC6=\E[2@, + kEND=\E[8$, + kEND5=\E[8\^, + kEND6=\E[8@, + kFND=\E[1$, + kFND5=\E[1\^, + kFND6=\E[1@, + kHOM=\E[7$, + kHOM5=\E[7\^, + kHOM6=\E[7@, + kLFT=\E[d, + kLFT5=\EOd, + kNXT=\E[6$, + kNXT5=\E[6\^, + kNXT6=\E[6@, + kPRV=\E[5$, + kPRV5=\E[5\^, + kPRV6=\E[5@, + kRIT=\E[c, + kRIT5=\EOc, + kUP=\E[a, + kUP5=\EOa, + kbs=\177, + ka1=\EOw, + ka3=\EOy, + kb2=\EOu, + kc1=\EOq, + kc3=\EOs, + kcbt=\E[Z, + kcub1=\E[D, + kcud1=\E[B, + kcuf1=\E[C, + kcuu1=\E[A, + kdch1=\E[3~, + kel=\E[8\^, + kend=\E[8~, + kent=\EOM, + kf1=\E[11~, + kf10=\E[21~, + kf11=\E[23~, + kf12=\E[24~, + kf13=\E[25~, + kf14=\E[26~, + kf15=\E[28~, + kf16=\E[29~, + kf17=\E[31~, + kf18=\E[32~, + kf19=\E[33~, + kf2=\E[12~, + kf20=\E[34~, + kf3=\E[13~, + kf4=\E[14~, + kf5=\E[15~, + kf6=\E[17~, + kf7=\E[18~, + kf8=\E[19~, + kf9=\E[20~, + kfnd=\E[1~, + khome=\E[7~, + kich1=\E[2~, + kmous=\E[M, + knp=\E[6~, + kpp=\E[5~, + kslt=\E[4~, + rc=\E8, + rev=\E[7m, + ri=\EM, + rmso=\E[27m, + rmul=\E[24m, + rs1=\Ec, + rs2=\E[r\E[m\E[?7;25h\E[?1;3;4;5;6;9;66;1000;1001;1049l\E[4l, + sgr0=\E[m\E(B, + enacs=, + smacs=\E(0, + rmacs=\E(B, + smso=\E[7m, + smul=\E[4m, + tbc=\E[3g, + vpa=\E[%i%p1%dd, + colors#88, + pairs#7744, + btns#5, + lm#0, + ccc, + npc, + mc5i, + ncv#0, + mir, + xon, + bw, + ech=\E[%p1%dX, + mc0=\E[i, + mc4=\E[4i, + mc5=\E[5i, + sitm=\E[3m, + ritm=\E[23m, + smam=\E[?7h, + rmam=\E[?7l, + smir=\E[4h, + rmir=\E[4l, + smcup=\E[?1049h, + rmcup=\E[r\E[?1049l, + smkx=\E=, + rmkx=\E>, + indn=\E[%p1%dS, + rin=\E[%p1%dT, + sgr=\E[%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, + op=\E[39;49m, + setaf=\E[38;5;%p1%dm, + setab=\E[48;5;%p1%dm, + setf=%?%p1%{7}%>%t\E[38;5;%p1%dm%e\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m%;, + setb=%?%p1%{7}%>%t\E[48;5;%p1%dm%e\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m%;, + initc=\E]4;%p1%d;rgb\:%p2%{65535}%*%{1000}%/%4.4X/%p3%{65535}%*%{1000}%/%4.4X/%p4%{65535}%*%{1000}%/%4.4X\E\\, + sc=\E7, + s0ds=\E(B, + s1ds=\E(0, + s2ds=\E*B, + s3ds=\E+B, + u6=\E[%i%d;%dR, + u7=\E[6n, + u8=\E[?1;2c, + u9=\E[c, + tsl=\E]2;, + fsl=\007, + dsl=\E]2;\007, + +rxvt-unicode-256color|rxvt-unicode terminal with 256 colors (X Window System), + colors#256, + pairs#32767, + use=rxvt-unicode, + +fbpad-256, + use=linux2.2, U8#0, + colors#256, + pairs#32767, + setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, + setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, + +uuterm|uuterm experimental, + am, eo, mir, msgr, xenl, xon, + colors#8, ncv#3, pairs#64, + it#8, ncv#2, + bel=^G, blink=\E[5m, bold=\E[1m, + civis=\E[?25l\E[?1c, clear=\E[H\E[J, + cnorm=\E[?25h\E[?0c, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu1=\E[A, cvvis=\E[?25h\E[?8c, dch=\E[%p1%dP, dch1=\E[P, + dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, + el=\E[K, el1=\E[1K, flash=\E[?5h\E[?5l$<200/>, home=\E[H, + hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, + il=\E[%p1%dL, il1=\E[L, ind=^J, kb2=\E[G, kbs=\177, + kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, + kdch1=\E[3~, kend=\E[4~, kf1=\E[[A, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, + kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, + kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, + kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kspd=^Z, + op=\E[37;40m, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmpch=\E[10m, + rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + sgr0=\E[0;10m, smpch=\E[11m, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, + u7=\E[6n, u8=\E[?6c, u9=\E[c, vpa=\E[%i%p1%dd, + +# rmir=\E[4l, smir=\E[4h, + diff --git a/vendor/netbsd-curses/tic/GNUmakefile b/vendor/netbsd-curses/tic/GNUmakefile new file mode 100644 index 0000000..63a383f --- /dev/null +++ b/vendor/netbsd-curses/tic/GNUmakefile @@ -0,0 +1,34 @@ +# $NetBSD: Makefile,v 1.2 2012/05/31 20:10:06 joerg Exp $ +PROG= tic +WARNS= 4 +SRCS=tic.c +SRCS+=cdbw.c mi_vector_hash.c compile.c hash.c +CLEANFILES+=hash.c + +CPPFLAGS+= -I../libterminfo +CPPFLAGS+= -I.. -I. +CFLAGS+=-Werror-implicit-function-declaration +ifndef HOSTPROG +LDADD+= -lterminfo -lutil +DPADD+= ${LIBTERMINFO} ${LIBUTIL} +endif + +OBJS = $(SRCS:.c=.o) + +all: $(PROG) + +clean: + rm -f $(OBJS) $(PROG) $(CLEANFILES) + +$(PROG): $(OBJS) + $(CC) $(LDFLAGS) $^ -o $@ + +%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $< + +hash.c: ../libterminfo/hash.c + cp ../libterminfo/hash.c hash.c + +../libterminfo/hash.c: + $(MAKE) -C ../libterminfo hash.c + diff --git a/vendor/netbsd-curses/tic/Makefile b/vendor/netbsd-curses/tic/Makefile new file mode 100644 index 0000000..3bff34b --- /dev/null +++ b/vendor/netbsd-curses/tic/Makefile @@ -0,0 +1,13 @@ +# $NetBSD: Makefile,v 1.2 2012/05/31 20:10:06 joerg Exp $ + +PROG= tic +WARNS= 4 + +CPPFLAGS+= -I${.CURDIR}/../../lib/libterminfo + +.ifndef HOSTPROG +LDADD+= -lterminfo -lutil +DPADD+= ${LIBTERMINFO} ${LIBUTIL} +.endif + +.include diff --git a/vendor/netbsd-curses/tic/cdbw.c b/vendor/netbsd-curses/tic/cdbw.c new file mode 100644 index 0000000..f4be7ca --- /dev/null +++ b/vendor/netbsd-curses/tic/cdbw.c @@ -0,0 +1,624 @@ +/* $NetBSD: cdbw.c,v 1.5 2012/07/21 22:49:37 joerg Exp $ */ +/*- + * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include + +//#include "namespace.h" + +#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H +#include +#endif +#include +#include +#include +#include +#include + +extern void mi_vector_hash(const void *restrict, size_t, uint32_t, uint32_t[3]); + +#ifdef __weak_alias +__weak_alias(cdbw_close,_cdbw_close) +__weak_alias(cdbw_open,_cdbw_open) +__weak_alias(cdbw_output,_cdbw_output) +__weak_alias(cdbw_put,_cdbw_put) +__weak_alias(cdbw_put_data,_cdbw_put_data) +__weak_alias(cdbw_put_key,_cdbw_put_key) +#endif + +struct key_hash { + SLIST_ENTRY(key_hash) link; + uint32_t hashes[3]; + uint32_t idx; + void *key; + size_t keylen; +}; + +SLIST_HEAD(key_hash_head, key_hash); + +struct cdbw { + size_t data_counter; + size_t data_allocated; + size_t data_size; + size_t *data_len; + void **data_ptr; + + size_t hash_size; + struct key_hash_head *hash; + size_t key_counter; +}; + + /* Max. data counter that allows the index size to be 32bit. */ +static const uint32_t max_data_counter = 0xccccccccU; + +struct cdbw * +cdbw_open(void) +{ + struct cdbw *cdbw; + size_t i; + + cdbw = calloc(sizeof(*cdbw), 1); + if (cdbw == NULL) + return NULL; + + cdbw->hash_size = 1024; + cdbw->hash = calloc(cdbw->hash_size, sizeof(*cdbw->hash)); + if (cdbw->hash == NULL) { + free(cdbw); + return NULL; + } + + for (i = 0; i < cdbw->hash_size; ++i) + SLIST_INIT(cdbw->hash + i); + + return cdbw; +} + +int +cdbw_put(struct cdbw *cdbw, const void *key, size_t keylen, + const void *data, size_t datalen) +{ + uint32_t idx; + int rv; + + rv = cdbw_put_data(cdbw, data, datalen, &idx); + if (rv) + return rv; + rv = cdbw_put_key(cdbw, key, keylen, idx); + if (rv) { + --cdbw->data_counter; + free(cdbw->data_ptr[cdbw->data_counter]); + cdbw->data_size -= datalen; + return rv; + } + return 0; +} + +int +cdbw_put_data(struct cdbw *cdbw, const void *data, size_t datalen, + uint32_t *idx) +{ + + if (cdbw->data_counter == max_data_counter) + return -1; + + if (cdbw->data_size + datalen < cdbw->data_size || + cdbw->data_size + datalen > 0xffffffffU) + return -1; /* Overflow */ + + if (cdbw->data_allocated == cdbw->data_counter) { + void **new_data_ptr; + size_t *new_data_len; + size_t new_allocated; + + if (cdbw->data_allocated == 0) + new_allocated = 256; + else + new_allocated = cdbw->data_allocated * 2; + + new_data_ptr = realloc(cdbw->data_ptr, + sizeof(*cdbw->data_ptr) * new_allocated); + if (new_data_ptr == NULL) + return -1; + cdbw->data_ptr = new_data_ptr; + + new_data_len = realloc(cdbw->data_len, + sizeof(*cdbw->data_len) * new_allocated); + if (new_data_len == NULL) + return -1; + cdbw->data_len = new_data_len; + + cdbw->data_allocated = new_allocated; + } + + cdbw->data_ptr[cdbw->data_counter] = malloc(datalen); + if (cdbw->data_ptr[cdbw->data_counter] == NULL) + return -1; + memcpy(cdbw->data_ptr[cdbw->data_counter], data, datalen); + cdbw->data_len[cdbw->data_counter] = datalen; + cdbw->data_size += datalen; + *idx = cdbw->data_counter++; + return 0; +} + +int +cdbw_put_key(struct cdbw *cdbw, const void *key, size_t keylen, uint32_t idx) +{ + uint32_t hashes[3]; + struct key_hash_head *head, *head2, *new_head; + struct key_hash *key_hash; + size_t new_hash_size, i; + + if (idx >= cdbw->data_counter || + cdbw->key_counter == max_data_counter) + return -1; + + mi_vector_hash(key, keylen, 0, hashes); + + head = cdbw->hash + (hashes[0] & (cdbw->hash_size - 1)); + SLIST_FOREACH(key_hash, head, link) { + if (key_hash->keylen != keylen) + continue; + if (key_hash->hashes[0] != hashes[0]) + continue; + if (key_hash->hashes[1] != hashes[1]) + continue; + if (key_hash->hashes[2] != hashes[2]) + continue; + if (memcmp(key, key_hash->key, keylen)) + continue; + return -1; + } + key_hash = malloc(sizeof(*key_hash)); + if (key_hash == NULL) + return -1; + key_hash->key = malloc(keylen); + if (key_hash->key == NULL) { + free(key_hash); + return -1; + } + memcpy(key_hash->key, key, keylen); + key_hash->hashes[0] = hashes[0]; + key_hash->hashes[1] = hashes[1]; + key_hash->hashes[2] = hashes[2]; + key_hash->keylen = keylen; + key_hash->idx = idx; + SLIST_INSERT_HEAD(head, key_hash, link); + ++cdbw->key_counter; + + if (cdbw->key_counter <= cdbw->hash_size) + return 0; + + /* Try to resize the hash table, but ignore errors. */ + new_hash_size = cdbw->hash_size * 2; + new_head = calloc(sizeof(*new_head), new_hash_size); + if (new_head == NULL) + return 0; + + head = &cdbw->hash[hashes[0] & (cdbw->hash_size - 1)]; + for (i = 0; i < new_hash_size; ++i) + SLIST_INIT(new_head + i); + + for (i = 0; i < cdbw->hash_size; ++i) { + head = cdbw->hash + i; + + while ((key_hash = SLIST_FIRST(head)) != NULL) { + SLIST_REMOVE_HEAD(head, link); + head2 = new_head + + (key_hash->hashes[0] & (new_hash_size - 1)); + SLIST_INSERT_HEAD(head2, key_hash, link); + } + } + free(cdbw->hash); + cdbw->hash_size = new_hash_size; + cdbw->hash = new_head; + + return 0; +} + +void +cdbw_close(struct cdbw *cdbw) +{ + struct key_hash_head *head; + struct key_hash *key_hash; + size_t i; + + for (i = 0; i < cdbw->hash_size; ++i) { + head = cdbw->hash + i; + while ((key_hash = SLIST_FIRST(head)) != NULL) { + SLIST_REMOVE_HEAD(head, link); + free(key_hash->key); + free(key_hash); + } + } + + for (i = 0; i < cdbw->data_counter; ++i) + free(cdbw->data_ptr[i]); + free(cdbw->data_ptr); + free(cdbw->data_len); + free(cdbw->hash); + free(cdbw); +} + +uint32_t +cdbw_stable_seeder(void) +{ + return 0; +} + +#define unused 0xffffffffU + +struct vertex { + uint32_t l_edge, m_edge, r_edge; +}; + +struct edge { + uint32_t idx; + + uint32_t left, middle, right; + uint32_t l_prev, m_prev, l_next; + uint32_t r_prev, m_next, r_next; +}; + +struct state { + uint32_t data_entries; + uint32_t entries; + uint32_t keys; + uint32_t seed; + + uint32_t *g; + char *visited; + + struct vertex *verts; + struct edge *edges; + uint32_t output_index; + uint32_t *output_order; +}; + +static void +remove_vertex(struct state *state, struct vertex *v) +{ + struct edge *e; + struct vertex *vl, *vm, *vr; + + if (v->l_edge != unused && v->m_edge != unused) + return; + if (v->l_edge != unused && v->r_edge != unused) + return; + if (v->m_edge != unused && v->r_edge != unused) + return; + if (v->l_edge == unused && v->m_edge == unused && v->r_edge == unused) + return; + + if (v->l_edge != unused) { + e = &state->edges[v->l_edge]; + if (e->l_next != unused) + return; + } else if (v->m_edge != unused) { + e = &state->edges[v->m_edge]; + if (e->m_next != unused) + return; + } else { + if (v->r_edge == unused) + abort(); + e = &state->edges[v->r_edge]; + if (e->r_next != unused) + return; + } + + state->output_order[--state->output_index] = e - state->edges; + + vl = &state->verts[e->left]; + vm = &state->verts[e->middle]; + vr = &state->verts[e->right]; + + if (e->l_prev == unused) + vl->l_edge = e->l_next; + else + state->edges[e->l_prev].l_next = e->l_next; + if (e->l_next != unused) + state->edges[e->l_next].l_prev = e->l_prev; + + if (e->m_prev == unused) + vm->m_edge = e->m_next; + else + state->edges[e->m_prev].m_next = e->m_next; + if (e->m_next != unused) + state->edges[e->m_next].m_prev = e->m_prev; + + if (e->r_prev == unused) + vr->r_edge = e->r_next; + else + state->edges[e->r_prev].r_next = e->r_next; + if (e->r_next != unused) + state->edges[e->r_next].r_prev = e->r_prev; +} + +static int +build_graph(struct cdbw *cdbw, struct state *state) +{ + struct key_hash_head *head; + struct key_hash *key_hash; + struct vertex *v; + struct edge *e; + uint32_t hashes[3]; + size_t i; + + e = state->edges; + for (i = 0; i < cdbw->hash_size; ++i) { + head = &cdbw->hash[i]; + SLIST_FOREACH(key_hash, head, link) { + e->idx = key_hash->idx; + mi_vector_hash(key_hash->key, key_hash->keylen, + state->seed, hashes); + e->left = hashes[0] % state->entries; + e->middle = hashes[1] % state->entries; + e->right = hashes[2] % state->entries; + + if (e->left == e->middle) + return -1; + if (e->left == e->right) + return -1; + if (e->middle == e->right) + return -1; + + ++e; + } + } + + for (i = 0; i < state->entries; ++i) { + v = state->verts + i; + v->l_edge = unused; + v->m_edge = unused; + v->r_edge = unused; + } + + for (i = 0; i < state->keys; ++i) { + e = state->edges + i; + v = state->verts + e->left; + if (v->l_edge != unused) + state->edges[v->l_edge].l_prev = i; + e->l_next = v->l_edge; + e->l_prev = unused; + v->l_edge = i; + + v = &state->verts[e->middle]; + if (v->m_edge != unused) + state->edges[v->m_edge].m_prev = i; + e->m_next = v->m_edge; + e->m_prev = unused; + v->m_edge = i; + + v = &state->verts[e->right]; + if (v->r_edge != unused) + state->edges[v->r_edge].r_prev = i; + e->r_next = v->r_edge; + e->r_prev = unused; + v->r_edge = i; + } + + state->output_index = state->keys; + for (i = 0; i < state->entries; ++i) + remove_vertex(state, state->verts + i); + + i = state->keys; + while (i > 0 && i > state->output_index) { + --i; + e = state->edges + state->output_order[i]; + remove_vertex(state, state->verts + e->left); + remove_vertex(state, state->verts + e->middle); + remove_vertex(state, state->verts + e->right); + } + + return state->output_index == 0 ? 0 : -1; +} + +static void +assign_nodes(struct state *state) +{ + struct edge *e; + size_t i; + + for (i = 0; i < state->keys; ++i) { + e = state->edges + state->output_order[i]; + + if (!state->visited[e->left]) { + state->g[e->left] = + (2 * state->data_entries + e->idx + - state->g[e->middle] - state->g[e->right]) + % state->data_entries; + } else if (!state->visited[e->middle]) { + state->g[e->middle] = + (2 * state->data_entries + e->idx + - state->g[e->left] - state->g[e->right]) + % state->data_entries; + } else { + state->g[e->right] = + (2 * state->data_entries + e->idx + - state->g[e->left] - state->g[e->middle]) + % state->data_entries; + } + state->visited[e->left] = 1; + state->visited[e->middle] = 1; + state->visited[e->right] = 1; + } +} + +static size_t +compute_size(uint32_t size) +{ + if (size < 0x100) + return 1; + else if (size < 0x10000) + return 2; + else + return 4; +} + +#define COND_FLUSH_BUFFER(n) do { \ + if (__predict_false(cur_pos + (n) >= sizeof(buf))) { \ + ret = write(fd, buf, cur_pos); \ + if (ret == -1 || (size_t)ret != cur_pos) \ + return -1; \ + cur_pos = 0; \ + } \ +} while (/* CONSTCOND */ 0) + +static int +print_hash(struct cdbw *cdbw, struct state *state, int fd, const char *descr) +{ + uint32_t data_size; + uint8_t buf[90000]; + size_t i, size, size2, cur_pos; + ssize_t ret; + + memcpy(buf, "NBCDB\n\0", 7); + buf[7] = 1; + strncpy((char *)buf + 8, descr, 16); + le32enc(buf + 24, cdbw->data_size); + le32enc(buf + 28, cdbw->data_counter); + le32enc(buf + 32, state->entries); + le32enc(buf + 36, state->seed); + cur_pos = 40; + + size = compute_size(state->entries); + for (i = 0; i < state->entries; ++i) { + COND_FLUSH_BUFFER(4); + le32enc(buf + cur_pos, state->g[i]); + cur_pos += size; + } + size2 = compute_size(cdbw->data_size); + size = size * state->entries % size2; + if (size != 0) { + size = size2 - size; + COND_FLUSH_BUFFER(4); + le32enc(buf + cur_pos, 0); + cur_pos += size; + } + for (data_size = 0, i = 0; i < cdbw->data_counter; ++i) { + COND_FLUSH_BUFFER(4); + le32enc(buf + cur_pos, data_size); + cur_pos += size2; + data_size += cdbw->data_len[i]; + } + COND_FLUSH_BUFFER(4); + le32enc(buf + cur_pos, data_size); + cur_pos += size2; + + for (i = 0; i < cdbw->data_counter; ++i) { + COND_FLUSH_BUFFER(cdbw->data_len[i]); + if (cdbw->data_len[i] < sizeof(buf)) { + memcpy(buf + cur_pos, cdbw->data_ptr[i], + cdbw->data_len[i]); + cur_pos += cdbw->data_len[i]; + } else { + ret = write(fd, cdbw->data_ptr[i], cdbw->data_len[i]); + if (ret == -1 || (size_t)ret != cdbw->data_len[i]) + return -1; + } + } + if (cur_pos != 0) { + ret = write(fd, buf, cur_pos); + if (ret == -1 || (size_t)ret != cur_pos) + return -1; + } + return 0; +} + +int +cdbw_output(struct cdbw *cdbw, int fd, const char descr[16], + uint32_t (*seedgen)(void)) +{ + struct state state; + int rv; + + if (cdbw->data_counter == 0 || cdbw->key_counter == 0) { + state.entries = 0; + state.seed = 0; + print_hash(cdbw, &state, fd, descr); + return 0; + } + +#if 1 || HAVE_NBTOOL_CONFIG_H + if (seedgen == NULL) + seedgen = cdbw_stable_seeder; +#else + if (seedgen == NULL) + seedgen = arc4random; +#endif + + rv = 0; + + state.keys = cdbw->key_counter; + state.data_entries = cdbw->data_counter; + state.entries = state.keys + (state.keys + 3) / 4; + if (state.entries < 10) + state.entries = 10; + +#define NALLOC(var, n) var = calloc(sizeof(*var), n) + NALLOC(state.g, state.entries); + NALLOC(state.visited, state.entries); + NALLOC(state.verts, state.entries); + NALLOC(state.edges, state.entries); + NALLOC(state.output_order, state.keys); +#undef NALLOC + + if (state.g == NULL || state.visited == NULL || state.verts == NULL || + state.edges == NULL || state.output_order == NULL) { + rv = -1; + goto release; + } + + state.seed = 0; + do { + if (seedgen == cdbw_stable_seeder) + ++state.seed; + else + state.seed = (*seedgen)(); + } while (build_graph(cdbw, &state)); + + assign_nodes(&state); + rv = print_hash(cdbw, &state, fd, descr); + +release: + free(state.g); + free(state.visited); + free(state.verts); + free(state.edges); + free(state.output_order); + + return rv; +} diff --git a/vendor/netbsd-curses/tic/cdbw.h b/vendor/netbsd-curses/tic/cdbw.h new file mode 100644 index 0000000..4260e18 --- /dev/null +++ b/vendor/netbsd-curses/tic/cdbw.h @@ -0,0 +1,59 @@ +/* $NetBSD: cdbw.h,v 1.2 2012/06/03 21:21:45 joerg Exp $ */ +/*- + * Copyright (c) 2010 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Joerg Sonnenberger. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _CDBW_H +#define _CDBW_H + +#include +#include +#include + +struct cdbw; + +__BEGIN_DECLS + +struct cdbw *cdbw_open(void); +int cdbw_put(struct cdbw *, const void *, size_t, + const void *, size_t); +int cdbw_put_data(struct cdbw *, const void *, size_t, + uint32_t *); +int cdbw_put_key(struct cdbw *, const void *, size_t, + uint32_t); +uint32_t cdbw_stable_seeder(void); +int cdbw_output(struct cdbw *, int, const char[16], + uint32_t (*)(void)); +void cdbw_close(struct cdbw *); + +__END_DECLS + +#endif /* _CDBW_H */ diff --git a/vendor/netbsd-curses/tic/compile.c b/vendor/netbsd-curses/tic/compile.c new file mode 120000 index 0000000..d64eed9 --- /dev/null +++ b/vendor/netbsd-curses/tic/compile.c @@ -0,0 +1 @@ +../libterminfo/compile.c \ No newline at end of file diff --git a/vendor/netbsd-curses/tic/mi_vector_hash.c b/vendor/netbsd-curses/tic/mi_vector_hash.c new file mode 120000 index 0000000..5c65ab7 --- /dev/null +++ b/vendor/netbsd-curses/tic/mi_vector_hash.c @@ -0,0 +1 @@ +../libterminfo/mi_vector_hash.c \ No newline at end of file diff --git a/vendor/netbsd-curses/tic/tic.1 b/vendor/netbsd-curses/tic/tic.1 new file mode 100644 index 0000000..da4ad32 --- /dev/null +++ b/vendor/netbsd-curses/tic/tic.1 @@ -0,0 +1,105 @@ +.\" $NetBSD: tic.1,v 1.13 2017/02/22 13:43:15 abhinav Exp $ +.\" +.\" Copyright (c) 2009, 2010 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Roy Marples. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd June 3, 2012 +.Dt TIC 1 +.Os +.Sh NAME +.Nm tic +.Nd terminfo compiler +.Sh SYNOPSIS +.Nm tic +.Op Fl acSsx +.Op Fl o Ar file +.Ar source +.Op Ar term1 term2 ... +.Sh DESCRIPTION +The +.Nm +utility compiles +.Xr terminfo 5 +source into a database for use by other programs. +The created database path name is the same as the source but with .cdb appended. +.Pp +The following options are available: +.Bl -tag -width Fl +.It Fl a +Do not discard commented out capabilities. +.It Fl c +Only check for errors, don't write the final database. +.It Fl o Ar file +Write the database to +.Ar file +instead of +.Ar source Ns .cdb . +.It Fl S +For +.Ar term1 , term2 , ... +output a C structure containing name, compiled description, and compiled size. +This can be used to embed terminal descriptions into a program. +.It Fl s +Display the number of terminal descriptions written to the database. +.It Fl x +Include non standard capabilities defined in the +.Ar source . +.El +.Ss Extensions To Terminfo +When +.Nm +discovers a +.Sy use Ns = Ns Va term +capability, the terminal description for +.Va term +is merged in. +Capabilities do not overwrite previously discovered ones and capabilities +ending with @ are marked as absent so the terminal does not inherit the +capability from +.Sy use Ns d +terminals. +.Sh EXIT STATUS +.Ex -std tic +.Sh EXAMPLES +To maintain your private terminfo definitions, if the system supplied +ones do not support your terminal: +.Bd -literal -offset indent +.Ic tic ~/.terminfo +.Ed +.Sh SEE ALSO +.Xr infocmp 1 , +.Xr tput 1 , +.Xr curses 3 , +.Xr terminfo 5 +.Sh STANDARDS +The +.Nm +utility works with terminfo files that conform to the +.St -xcurses4.2 +standard. +.Sh AUTHORS +.An Roy Marples Aq Mt roy@NetBSD.org diff --git a/vendor/netbsd-curses/tic/tic.c b/vendor/netbsd-curses/tic/tic.c new file mode 100644 index 0000000..a0d4f48 --- /dev/null +++ b/vendor/netbsd-curses/tic/tic.c @@ -0,0 +1,732 @@ +/* $NetBSD: tic.c,v 1.40 2020/03/30 00:09:06 roy Exp $ */ + +/* + * Copyright (c) 2009, 2010, 2020 The NetBSD Foundation, Inc. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Roy Marples. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define _GNU_SOURCE +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif +#include + +#include +#include + +#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifndef DEFFILEMODE +#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) +#endif + +#define HASH_SIZE 16384 /* 2012-06-01: 3600 entries */ + +typedef struct term { + STAILQ_ENTRY(term) next; + char *name; + TIC *tic; + uint32_t id; + struct term *base_term; +} TERM; +static STAILQ_HEAD(, term) terms = STAILQ_HEAD_INITIALIZER(terms); + +static int error_exit; +static int Sflag; +static size_t nterm, nalias; + +static void __printflike(1, 2) +dowarn(const char *fmt, ...) +{ + va_list va; + + error_exit = 1; + va_start(va, fmt); + vwarnx(fmt, va); + va_end(va); +} + +static char * +grow_tbuf(TBUF *tbuf, size_t len) +{ + char *buf; + + buf = _ti_grow_tbuf(tbuf, len); + if (buf == NULL) + err(EXIT_FAILURE, "_ti_grow_tbuf"); + return buf; +} + +static int +save_term(struct cdbw *db, TERM *term) +{ + uint8_t *buf; + ssize_t len; + size_t slen = strlen(term->name) + 1; + + if (term->base_term != NULL) { + char *cap; + len = (ssize_t)(1 + sizeof(uint32_t) + sizeof(uint16_t) + slen); + buf = emalloc(len); + cap = (char *)buf; + *cap++ = TERMINFO_ALIAS; + _ti_encode_32(&cap, term->base_term->id); + _ti_encode_count_str(&cap, term->name, slen); + if (cdbw_put(db, term->name, slen, buf, len)) + err(EXIT_FAILURE, "cdbw_put"); + free(buf); + return 0; + } + + len = _ti_flatten(&buf, term->tic); + if (len == -1) + return -1; + + if (cdbw_put_data(db, buf, len, &term->id)) + err(EXIT_FAILURE, "cdbw_put_data"); + if (cdbw_put_key(db, term->name, slen, term->id)) + err(EXIT_FAILURE, "cdbw_put_key"); + free(buf); + return 0; +} + +static TERM * +find_term(const char *name) +{ + ENTRY elem, *elemp; + + elem.key = __UNCONST(name); + elem.data = NULL; + elemp = hsearch(elem, FIND); + return elemp ? (TERM *)elemp->data : NULL; +} + +static TERM * +find_newest_term(const char *name) +{ + char *lname; + TERM *term; + + lname = _ti_getname(TERMINFO_RTYPE, name); + if (lname == NULL) + return NULL; + term = find_term(lname); + free(lname); + if (term == NULL) + term = find_term(name); + return term; +} + +static TERM * +store_term(const char *name, TERM *base_term) +{ + TERM *term; + ENTRY elem; + + term = ecalloc(1, sizeof(*term)); + term->name = estrdup(name); + STAILQ_INSERT_TAIL(&terms, term, next); + elem.key = estrdup(name); + elem.data = term; + hsearch(elem, ENTER); + + term->base_term = base_term; + if (base_term != NULL) + nalias++; + else + nterm++; + + return term; +} + +static void +alias_terms(TERM *term) +{ + char *p, *e, *alias; + + /* Create aliased terms */ + if (term->tic->alias == NULL) + return; + + alias = p = estrdup(term->tic->alias); + while (p != NULL && *p != '\0') { + e = strchr(p, '|'); + if (e != NULL) + *e++ = '\0'; + /* No need to lengthcheck the alias because the main + * terminfo description already stores all the aliases + * in the same length field as the alias. */ + if (find_term(p) != NULL) { + dowarn("%s: has alias for already assigned" + " term %s", term->tic->name, p); + } else { + store_term(p, term); + } + p = e; + } + free(alias); +} + +static int +process_entry(TBUF *buf, int flags) +{ + TERM *term; + TIC *tic; + TBUF sbuf = *buf; + + if (buf->bufpos == 0) + return 0; + /* Terminate the string */ + buf->buf[buf->bufpos - 1] = '\0'; + /* First rewind the buffer for new entries */ + buf->bufpos = 0; + + if (isspace((unsigned char)*buf->buf)) + return 0; + + tic = _ti_compile(buf->buf, flags); + if (tic == NULL) + return 0; + + if (find_term(tic->name) != NULL) { + dowarn("%s: duplicate entry", tic->name); + _ti_freetic(tic); + return 0; + } + term = store_term(tic->name, NULL); + term->tic = tic; + alias_terms(term); + + if (tic->rtype == TERMINFO_RTYPE) + return process_entry(&sbuf, flags | TIC_COMPAT_V1); + + return 0; +} + +static void +merge(TIC *rtic, TIC *utic, int flags) +{ + char flag, type; + const char *cap, *code, *str; + short ind, len; + int num; + size_t n; + + if (rtic->rtype < utic->rtype) + errx(EXIT_FAILURE, "merge rtype diff (%s:%d into %s:%d)", + utic->name, utic->rtype, rtic->name, rtic->rtype); + + cap = utic->flags.buf; + for (n = utic->flags.entries; n > 0; n--) { + ind = _ti_decode_16(&cap); + flag = *cap++; + if (VALID_BOOLEAN(flag) && + _ti_find_cap(rtic, &rtic->flags, 'f', ind) == NULL) + { + if (!_ti_encode_buf_id_flags(&rtic->flags, ind, flag)) + err(EXIT_FAILURE, "encode flag"); + } + } + + cap = utic->nums.buf; + for (n = utic->nums.entries; n > 0; n--) { + ind = _ti_decode_16(&cap); + num = _ti_decode_num(&cap, utic->rtype); + if (VALID_NUMERIC(num) && + _ti_find_cap(rtic, &rtic->nums, 'n', ind) == NULL) + { + if (!_ti_encode_buf_id_num(&rtic->nums, ind, num, + _ti_numsize(rtic))) + err(EXIT_FAILURE, "encode num"); + } + } + + cap = utic->strs.buf; + for (n = utic->strs.entries; n > 0; n--) { + ind = _ti_decode_16(&cap); + len = _ti_decode_16(&cap); + if (len > 0 && + _ti_find_cap(rtic, &rtic->strs, 's', ind) == NULL) + { + if (!_ti_encode_buf_id_count_str(&rtic->strs, ind, cap, + len)) + err(EXIT_FAILURE, "encode str"); + } + cap += len; + } + + cap = utic->extras.buf; + for (n = utic->extras.entries; n > 0; n--) { + num = _ti_decode_16(&cap); + code = cap; + cap += num; + type = *cap++; + flag = 0; + str = NULL; + switch (type) { + case 'f': + flag = *cap++; + if (!VALID_BOOLEAN(flag)) + continue; + break; + case 'n': + num = _ti_decode_num(&cap, utic->rtype); + if (!VALID_NUMERIC(num)) + continue; + break; + case 's': + num = _ti_decode_16(&cap); + str = cap; + cap += num; + if (num == 0) + continue; + break; + } + _ti_store_extra(rtic, 0, code, type, flag, num, str, num, + flags); + } +} + +static int +dup_tbuf(TBUF *dst, const TBUF *src) +{ + + if (src->buflen == 0) + return 0; + dst->buf = malloc(src->buflen); + if (dst->buf == NULL) + return -1; + dst->buflen = src->buflen; + memcpy(dst->buf, src->buf, dst->buflen); + dst->bufpos = src->bufpos; + dst->entries = src->entries; + return 0; +} + +static int +promote(TIC *rtic, TIC *utic) +{ + TERM *nrterm = find_newest_term(rtic->name); + TERM *nuterm = find_newest_term(utic->name); + TERM *term; + TIC *tic; + + if (nrterm == NULL || nuterm == NULL) + return -1; + if (nrterm->tic->rtype >= nuterm->tic->rtype) + return 0; + + tic = calloc(1, sizeof(*tic)); + if (tic == NULL) + return -1; + + tic->name = _ti_getname(TERMINFO_RTYPE, rtic->name); + if (tic->name == NULL) + goto err; + if (rtic->alias != NULL) { + tic->alias = strdup(rtic->alias); + if (tic->alias == NULL) + goto err; + } + if (rtic->desc != NULL) { + tic->desc = strdup(rtic->desc); + if (tic->desc == NULL) + goto err; + } + + tic->rtype = rtic->rtype; + if (dup_tbuf(&tic->flags, &rtic->flags) == -1) + goto err; + if (dup_tbuf(&tic->nums, &rtic->nums) == -1) + goto err; + if (dup_tbuf(&tic->strs, &rtic->strs) == -1) + goto err; + if (dup_tbuf(&tic->extras, &rtic->extras) == -1) + goto err; + if (_ti_promote(tic) == -1) + goto err; + + term = store_term(tic->name, NULL); + if (term == NULL) + goto err; + + term->tic = tic; + alias_terms(term); + return 0; + +err: + free(tic->flags.buf); + free(tic->nums.buf); + free(tic->strs.buf); + free(tic->extras.buf); + free(tic->desc); + free(tic->alias); + free(tic->name); + free(tic); + return -1; +} + +static size_t +merge_use(int flags) +{ + size_t skipped, merged, memn; + const char *cap; + char *name, *basename; + uint16_t num; + TIC *rtic, *utic; + TERM *term, *uterm; + bool promoted; + + skipped = merged = 0; + STAILQ_FOREACH(term, &terms, next) { + if (term->base_term != NULL) + continue; + rtic = term->tic; + basename = _ti_getname(TERMINFO_RTYPE_O1, rtic->name); + promoted = false; + while ((cap = _ti_find_extra(rtic, &rtic->extras, "use")) + != NULL) { + if (*cap++ != 's') { + dowarn("%s: use is not string", rtic->name); + break; + } + cap += sizeof(uint16_t); + if (strcmp(basename, cap) == 0) { + dowarn("%s: uses itself", rtic->name); + goto remove; + } + name = _ti_getname(rtic->rtype, cap); + if (name == NULL) { + dowarn("%s: ???: %s", rtic->name, cap); + goto remove; + } + uterm = find_term(name); + free(name); + if (uterm == NULL) + uterm = find_term(cap); + if (uterm != NULL && uterm->base_term != NULL) + uterm = uterm->base_term; + if (uterm == NULL) { + dowarn("%s: no use record for %s", + rtic->name, cap); + goto remove; + } + utic = uterm->tic; + if (strcmp(utic->name, rtic->name) == 0) { + dowarn("%s: uses itself", rtic->name); + goto remove; + } + if (_ti_find_extra(utic, &utic->extras, "use") + != NULL) { + skipped++; + break; + } + + /* If we need to merge in a term that requires + * this term to be promoted, we need to duplicate + * this term, promote it and append it to our list. */ + if (!promoted && rtic->rtype != TERMINFO_RTYPE) { + if (promote(rtic, utic) == -1) + err(EXIT_FAILURE, "promote"); + promoted = true; + } + + merge(rtic, utic, flags); + remove: + /* The pointers may have changed, find the use again */ + cap = _ti_find_extra(rtic, &rtic->extras, "use"); + if (cap == NULL) + dowarn("%s: use no longer exists - impossible", + rtic->name); + else { + char *scap = __UNCONST( + cap - (4 + sizeof(uint16_t))); + cap++; + num = _ti_decode_16(&cap); + cap += num; + memn = rtic->extras.bufpos - + (cap - rtic->extras.buf); + memmove(scap, cap, memn); + rtic->extras.bufpos -= cap - scap; + cap = scap; + rtic->extras.entries--; + merged++; + } + } + free(basename); + } + + if (merged == 0 && skipped != 0) + dowarn("circular use detected"); + return merged; +} + +static int +print_dump(int argc, char **argv) +{ + TERM *term; + uint8_t *buf; + int i, n; + size_t j, col; + ssize_t len; + + printf("struct compiled_term {\n"); + printf("\tconst char *name;\n"); + printf("\tconst char *cap;\n"); + printf("\tsize_t caplen;\n"); + printf("};\n\n"); + + printf("const struct compiled_term compiled_terms[] = {\n"); + + n = 0; + for (i = 0; i < argc; i++) { + term = find_newest_term(argv[i]); + if (term == NULL) { + warnx("%s: no description for terminal", argv[i]); + continue; + } + if (term->base_term != NULL) { + warnx("%s: cannot dump alias", argv[i]); + continue; + } + /* Don't compile the aliases in, save space */ + free(term->tic->alias); + term->tic->alias = NULL; + len = _ti_flatten(&buf, term->tic); + if (len == 0 || len == -1) + continue; + + printf("\t{\n"); + printf("\t\t\"%s\",\n", argv[i]); + n++; + for (j = 0, col = 0; j < (size_t)len; j++) { + if (col == 0) { + printf("\t\t\""); + col = 16; + } + + col += printf("\\%03o", (uint8_t)buf[j]); + if (col > 75) { + printf("\"%s\n", + j + 1 == (size_t)len ? "," : ""); + col = 0; + } + } + if (col != 0) + printf("\",\n"); + printf("\t\t%zu\n", len); + printf("\t}"); + if (i + 1 < argc) + printf(","); + printf("\n"); + free(buf); + } + printf("};\n"); + + return n; +} + +static void +write_database(const char *dbname) +{ + struct cdbw *db; + char *tmp_dbname; + TERM *term; + int fd; + + db = cdbw_open(); + if (db == NULL) + err(EXIT_FAILURE, "cdbw_open failed"); + /* Save the terms */ + STAILQ_FOREACH(term, &terms, next) + save_term(db, term); + + easprintf(&tmp_dbname, "%s.XXXXXX", dbname); + fd = mkstemp(tmp_dbname); + if (fd == -1) + err(EXIT_FAILURE, + "creating temporary database %s failed", tmp_dbname); + if (cdbw_output(db, fd, "NetBSD terminfo", cdbw_stable_seeder)) + err(EXIT_FAILURE, + "writing temporary database %s failed", tmp_dbname); + if (fchmod(fd, DEFFILEMODE)) + err(EXIT_FAILURE, "fchmod failed"); + if (close(fd)) + err(EXIT_FAILURE, + "writing temporary database %s failed", tmp_dbname); + if (rename(tmp_dbname, dbname)) + err(EXIT_FAILURE, "renaming %s to %s failed", tmp_dbname, dbname); + free(tmp_dbname); + cdbw_close(db); +} + +int +main(int argc, char **argv) +{ + int ch, cflag, sflag, flags; + char *source, *dbname, *buf, *ofile; + FILE *f; + size_t buflen; + ssize_t len; + TBUF tbuf; + struct term *term; + + cflag = sflag = 0; + ofile = NULL; + flags = TIC_ALIAS | TIC_DESCRIPTION | TIC_WARNING; + while ((ch = getopt(argc, argv, "Saco:sx")) != -1) + switch (ch) { + case 'S': + Sflag = 1; + /* We still compile aliases so that use= works. + * However, it's removed before we flatten to save space. */ + flags &= ~TIC_DESCRIPTION; + break; + case 'a': + flags |= TIC_COMMENT; + break; + case 'c': + cflag = 1; + break; + case 'o': + ofile = optarg; + break; + case 's': + sflag = 1; + break; + case 'x': + flags |= TIC_EXTRA; + break; + case '?': /* FALLTHROUGH */ + default: + fprintf(stderr, "usage: %s [-acSsx] [-o file] source\n", + argv[0]); + return EXIT_FAILURE; + } + + if (optind == argc) + errx(1, "No source file given"); + source = argv[optind++]; + f = fopen(source, "r"); + if (f == NULL) + err(EXIT_FAILURE, "fopen: %s", source); + + hcreate(HASH_SIZE); + + buf = tbuf.buf = NULL; + buflen = tbuf.buflen = tbuf.bufpos = 0; + while ((len = getline(&buf, &buflen, f)) != -1) { + /* Skip comments */ + if (*buf == '#') + continue; + if (buf[len - 1] != '\n') { + process_entry(&tbuf, flags); + dowarn("last line is not a comment" + " and does not end with a newline"); + continue; + } + /* + * If the first char is space not a space then we have a + * new entry, so process it. + */ + if (!isspace((unsigned char)*buf) && tbuf.bufpos != 0) + process_entry(&tbuf, flags); + + /* Grow the buffer if needed */ + grow_tbuf(&tbuf, len); + /* Append the string */ + memcpy(tbuf.buf + tbuf.bufpos, buf, len); + tbuf.bufpos += len; + } + free(buf); + /* Process the last entry if not done already */ + process_entry(&tbuf, flags); + free(tbuf.buf); + + /* Merge use entries until we have merged all we can */ + while (merge_use(flags) != 0) + ; + + if (Sflag) { + print_dump(argc - optind, argv + optind); + return error_exit; + } + + if (cflag) + return error_exit; + + if (ofile == NULL) + easprintf(&dbname, "%s.cdb", source); + else + dbname = ofile; + write_database(dbname); + + if (sflag != 0) + fprintf(stderr, "%zu entries and %zu aliases written to %s\n", + nterm, nalias, dbname); + + if (ofile == NULL) + free(dbname); + while ((term = STAILQ_FIRST(&terms)) != NULL) { + STAILQ_REMOVE_HEAD(&terms, next); + _ti_freetic(term->tic); + free(term->name); + free(term); + } +#if 0 +#ifndef HAVE_NBTOOL_CONFIG_H + /* + * hdestroy1 is not standard but we don't really care if we + * leak in the tools version + */ + hdestroy1(free, NULL); +#endif +#endif + + return EXIT_SUCCESS; +} diff --git a/vendor/netbsd-curses/tput/GNUmakefile b/vendor/netbsd-curses/tput/GNUmakefile new file mode 100644 index 0000000..23d2af4 --- /dev/null +++ b/vendor/netbsd-curses/tput/GNUmakefile @@ -0,0 +1,28 @@ +# $NetBSD: Makefile,v 1.11 2013/01/24 10:41:28 roy Exp $ +# @(#)Makefile 8.1 (Berkeley) 6/6/93 + +PROG= tput +SRCS=tput.c +DPADD= ${LIBTERMINFO} +LDADD= -lterminfo +MLINKS= tput.1 clear.1 +SCRIPTS=clear.sh + +#CPPFLAGS+= -I${.CURDIR}/../../lib/libterminfo + +CPPFLAGS+= -I.. -I. -I../libterminfo +CFLAGS+=-Werror-implicit-function-declaration + +OBJS = $(SRCS:.c=.o) + +all: $(PROG) + +clean: + rm -f $(OBJS) $(PROG) $(CLEANFILES) + +$(PROG): $(OBJS) + $(CC) $(LDFLAGS) $^ -o $@ -L ../libterminfo $(LDADD) -static + +%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $< + diff --git a/vendor/netbsd-curses/tput/Makefile b/vendor/netbsd-curses/tput/Makefile new file mode 100644 index 0000000..1f2bff7 --- /dev/null +++ b/vendor/netbsd-curses/tput/Makefile @@ -0,0 +1,12 @@ +# $NetBSD: Makefile,v 1.11 2013/01/24 10:41:28 roy Exp $ +# @(#)Makefile 8.1 (Berkeley) 6/6/93 + +PROG= tput +DPADD= ${LIBTERMINFO} +LDADD= -lterminfo +MLINKS= tput.1 clear.1 +SCRIPTS=clear.sh + +CPPFLAGS+= -I${.CURDIR}/../../lib/libterminfo + +.include diff --git a/vendor/netbsd-curses/tput/clear.1 b/vendor/netbsd-curses/tput/clear.1 new file mode 120000 index 0000000..d10fbf2 --- /dev/null +++ b/vendor/netbsd-curses/tput/clear.1 @@ -0,0 +1 @@ +tput.1 \ No newline at end of file diff --git a/vendor/netbsd-curses/tput/clear.sh b/vendor/netbsd-curses/tput/clear.sh new file mode 100644 index 0000000..5fffaf0 --- /dev/null +++ b/vendor/netbsd-curses/tput/clear.sh @@ -0,0 +1,38 @@ +#!/bin/sh - +# $NetBSD: clear.sh,v 1.2 1994/12/07 08:49:09 jtc Exp $ +# +# Copyright (c) 1989, 1993 +# The Regents of the University of California. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the University of +# California, Berkeley and its contributors. +# 4. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# @(#)clear.sh 8.1 (Berkeley) 6/6/93 +# + +exec tput clear diff --git a/vendor/netbsd-curses/tput/tput.1 b/vendor/netbsd-curses/tput/tput.1 new file mode 100644 index 0000000..1ea0bb4 --- /dev/null +++ b/vendor/netbsd-curses/tput/tput.1 @@ -0,0 +1,139 @@ +.\" $NetBSD: tput.1,v 1.16 2012/04/21 12:27:30 roy Exp $ +.\" +.\" Copyright (c) 1989, 1990, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)tput.1 8.2 (Berkeley) 3/19/94 +.\" +.Dd April 5, 2012 +.Dt TPUT 1 +.Os +.Sh NAME +.Nm tput , +.Nm clear +.Nd terminal capability interface +.Sh SYNOPSIS +.Nm +.Op Fl T Ar term +.Ar attribute +.Op Ar attribute-args +.Ar ... +.Sh DESCRIPTION +.Nm +makes terminal-dependent information available to users or shell +applications. +The options are as follows: +.Bl -tag -width Ds +.It Fl T +The terminal name as specified in the +.Xr terminfo 5 +database, for example, +.Dq vt100 +or +.Dq xterm . +If not specified, +.Nm +retrieves the +.Dq Ev TERM +variable from the environment. +.El +.Pp +.Nm +outputs a string if the +.Ar attribute +is of type string; a number if it is of type integer. +Otherwise, +.Nm +exits 0 if the terminal has the capability and 1 if it does not, +without further action. +.Pp +If the +.Ar attribute +is of type string, and takes arguments (e.g. cursor movement, +the terminfo +.Dq cup +sequence) the arguments are taken from the command line immediately +following the attribute. +.Pp +The following special attributes are available: +.Bl -tag -width Ar +.It clear +Clear the screen (the +.Xr terminfo 5 +.Dq cl +sequence). +.It init +Initialize the terminal (the +.Xr terminfo 5 +.Dq is2 +sequence). +.It longname +Print the descriptive name of the user's terminal type. +.It reset +Reset the terminal (the +.Xr terminfo 5 +.Dq rs1 , rs2 , rs3 +and +.Dq rf +sequence). +.El +.Sh EXIT STATUS +The exit status of +.Nm +is based on the last attribute specified. +If the attribute is of type string or of type integer, +.Nm +exits 0 if the attribute is defined for this terminal type and 1 +if it is not. +If the attribute is of type boolean, +.Nm +exits 0 if the terminal has this attribute, and 1 if it does not. +.Nm +exits 2 if any error occurred. +.Sh EXAMPLES +.Bl -tag -width "tput cm 6 11 DC 6" -compact +.It Li "tput cl cm 5 10" +clear the screen and goto line 5 column 10 +.Pp +.It Li "tput cm 6 11 DC 6" +goto line 6 column 11 and delete 6 characters +.El +.Sh SEE ALSO +.Xr termcap 3 , +.Xr terminfo 3 , +.Xr terminfo 5 +.Sh HISTORY +The +.Nm +command appears in +.Bx 4.4 . +.Sh BUGS +.Nm +can't really distinguish between different types of attributes. +.Pp +Not all terminfo entries contain the reset sequence, so using the init +sequence may be more useful. diff --git a/vendor/netbsd-curses/tput/tput.c b/vendor/netbsd-curses/tput/tput.c new file mode 100644 index 0000000..282a885 --- /dev/null +++ b/vendor/netbsd-curses/tput/tput.c @@ -0,0 +1,184 @@ +/* $NetBSD: tput.c,v 1.26 2013/02/05 11:31:56 roy Exp $ */ + +/*- + * Copyright (c) 1980, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void usage(char*) __dead; +static char **process(const char *, const char *, char **); + +int +main(int argc, char **argv) +{ + int ch, exitval, n; + char *term; + const char *p, *s; + size_t pl; + + term = NULL; + while ((ch = getopt(argc, argv, "T:")) != -1) + switch(ch) { + case 'T': + term = optarg; + break; + case '?': + default: + usage(argv[0]); + } + argc -= optind; + argv += optind; + + if (!term && !(term = getenv("TERM"))) + errx(2, "No terminal type specified and no TERM " + "variable set in the environment."); + setupterm(term, 0, NULL); + for (exitval = 0; (p = *argv) != NULL; ++argv) { + switch (*p) { + case 'c': + if (!strcmp(p, "clear")) + p = "clear"; + break; + case 'i': + if (!strcmp(p, "init")) { + s = tigetstr("is1"); + if (s != NULL) + putp(s); + p = "is2"; + } + break; + case 'l': + if (!strcmp(p, "longname")) { + (void)printf("%s\n", longname()); + continue; + } + break; + case 'r': + if (!strcmp(p, "reset")) { + s = tigetstr("rs1"); + if (s != NULL) + putp(s); + p = "rs2"; + } + break; + } + pl = strlen(p); + if (((s = tigetstr(p)) != NULL && s != (char *)-1) || + (pl <= 2 && (s = tgetstr(p, NULL)) != NULL)) + argv = process(p, s, argv); + else if ((((n = tigetnum(p)) != -1 && n != -2 ) || + (pl <= 2 && (n = tgetnum(p)) != -1))) + (void)printf("%d\n", n); + else { + exitval = tigetflag(p); + if (exitval == -1) { + if (pl <= 2) + exitval = !tgetflag(p); + else + exitval = 1; + } else + exitval = !exitval; + } + + if (argv == NULL) + break; + } + return argv ? exitval : 2; +} + +static char ** +process(const char *cap, const char *str, char **argv) +{ + static const char errfew[] = + "Not enough arguments (%d) for capability `%s'"; + static const char erresc[] = + "Unknown %% escape (%s) for capability `%s'"; + static const char errnum[] = + "Expected a numeric argument [%d] (%s) for capability `%s'"; + static const char errcharlong[] = + "Platform does not fit a string into a long for capability '%s'"; + int i, nparams, piss[TPARM_MAX]; + long nums[TPARM_MAX]; + char *strs[TPARM_MAX], *tmp; + + /* Count how many values we need for this capability. */ + errno = 0; + memset(&piss, 0, sizeof(piss)); + nparams = _ti_parm_analyse(str, piss, TPARM_MAX); + if (errno == EINVAL) + errx(2, erresc, str, cap); + + /* Create our arrays of integers and strings */ + for (i = 0; i < nparams; i++) { + if (*++argv == NULL || *argv[0] == '\0') + errx(2, errfew, nparams, cap); + if (piss[i]) { + if (sizeof(char *) > sizeof(long) /* CONSTCOND */) + errx(2, errcharlong, cap); + strs[i] = *argv; + } else { + errno = 0; + nums[i] = strtol(*argv, &tmp, 0); + if ((errno == ERANGE && + (nums[i] == LONG_MIN || nums[i] == LONG_MAX)) || + (errno != 0 && nums[i] == 0) || + tmp == str || + *tmp != '\0') + errx(2, errnum, i + 1, *argv, cap); + } + } + + /* And output */ +#define p(i) (i <= nparams ? \ + (piss[i - 1] ? (long)strs[i - 1] : nums[i - 1]) : 0) + putp(tparm(str, p(1), p(2), p(3), p(4), p(5), p(6), p(7), p(8), p(9))); + + return argv; +} + +static void +usage(char*a0) +{ + (void)fprintf(stderr, + "Usage: %s [-T term] attribute [attribute-args] ...\n", + a0); + exit(2); +} diff --git a/vendor/netbsd-curses/tset/GNUmakefile b/vendor/netbsd-curses/tset/GNUmakefile new file mode 100644 index 0000000..5656ebd --- /dev/null +++ b/vendor/netbsd-curses/tset/GNUmakefile @@ -0,0 +1,26 @@ +# $NetBSD: Makefile,v 1.7 2012/04/21 12:27:30 roy Exp $ +# @(#)Makefile 8.1 (Berkeley) 6/9/93 + +PROG= tset +SRCS= map.c misc.c set.c term.c tset.c + +DPADD= ${LIBTERMINFO} +LDADD= -lterminfo +LINKS= ${BINDIR}/tset ${BINDIR}/reset +MLINKS= tset.1 reset.1 +CPPFLAGS+= -I.. -I. -I../libterminfo +CFLAGS+=-Werror-implicit-function-declaration + +OBJS = $(SRCS:.c=.o) + +all: $(PROG) + +clean: + rm -f $(OBJS) $(PROG) $(CLEANFILES) + +$(PROG): $(OBJS) + $(CC) $(LDFLAGS) $^ -o $@ -L ../libterminfo $(LDADD) -static + +%.o: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $< + diff --git a/vendor/netbsd-curses/tset/Makefile b/vendor/netbsd-curses/tset/Makefile new file mode 100644 index 0000000..d919de7 --- /dev/null +++ b/vendor/netbsd-curses/tset/Makefile @@ -0,0 +1,12 @@ +# $NetBSD: Makefile,v 1.7 2012/04/21 12:27:30 roy Exp $ +# @(#)Makefile 8.1 (Berkeley) 6/9/93 + +PROG= tset +SRCS= map.c misc.c set.c term.c tset.c + +DPADD= ${LIBTERMINFO} +LDADD= -lterminfo +LINKS= ${BINDIR}/tset ${BINDIR}/reset +MLINKS= tset.1 reset.1 + +.include diff --git a/vendor/netbsd-curses/tset/extern.h b/vendor/netbsd-curses/tset/extern.h new file mode 100644 index 0000000..6eb38b1 --- /dev/null +++ b/vendor/netbsd-curses/tset/extern.h @@ -0,0 +1,46 @@ +/* $NetBSD: extern.h,v 1.14 2011/09/06 18:34:12 joerg Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)extern.h 8.1 (Berkeley) 6/9/93 + */ + +extern struct termios mode, oldmode; +extern int ncolumns, isreset, nlines; + +void add_mapping(const char *, char *); +void tset_cat(const char *); +const char *get_terminfo_entry(const char *); +const char *mapped(const char *); +int outc(int); +void reset_mode(void); +void set_control_chars(int, int, int); +void set_conversions(int); +void set_init(void); +void wrtermcap(char *); diff --git a/vendor/netbsd-curses/tset/map.c b/vendor/netbsd-curses/tset/map.c new file mode 100644 index 0000000..a9f7a75 --- /dev/null +++ b/vendor/netbsd-curses/tset/map.c @@ -0,0 +1,228 @@ +/* $NetBSD: map.c,v 1.13 2011/09/06 18:34:12 joerg Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include "extern.h" + +static int baudrate(char *); + +/* Baud rate conditionals for mapping. */ +#define GT 0x01 +#define EQ 0x02 +#define LT 0x04 +#define NOT 0x08 +#define GE (GT | EQ) +#define LE (LT | EQ) + +typedef struct map { + struct map *next; /* Linked list of maps. */ + const char *porttype; /* Port type, or "" for any. */ + const char *type; /* Terminal type to select. */ + int conditional; /* Baud rate conditionals bitmask. */ + int speed; /* Baud rate to compare against. */ +} MAP; + +static MAP *cur, *maplist; + +/* + * Syntax for -m: + * [port-type][test baudrate]:terminal-type + * The baud rate tests are: >, <, @, =, ! + */ +void +add_mapping(const char *port, char *arg) +{ + MAP *mapp; + char *copy, *p, *termp; + + copy = strdup(arg); + mapp = malloc((u_int)sizeof(MAP)); + if (copy == NULL || mapp == NULL) + err(1, "malloc"); + mapp->next = NULL; + if (maplist == NULL) + cur = maplist = mapp; + else { + cur->next = mapp; + cur = mapp; + } + + mapp->porttype = arg; + mapp->conditional = 0; + + arg = strpbrk(arg, "><@=!:"); + + if (arg == NULL) { /* [?]term */ + mapp->type = mapp->porttype; + mapp->porttype = NULL; + goto done; + } + + if (arg == mapp->porttype) /* [><@=! baud]:term */ + mapp->porttype = termp = NULL; + else + termp = arg; + + for (;; ++arg) /* Optional conditionals. */ + switch(*arg) { + case '<': + if (mapp->conditional & GT) + goto badmopt; + mapp->conditional |= LT; + break; + case '>': + if (mapp->conditional & LT) + goto badmopt; + mapp->conditional |= GT; + break; + case '@': + case '=': /* Not documented. */ + mapp->conditional |= EQ; + break; + case '!': + mapp->conditional |= NOT; + break; + default: + goto next; + } + +next: if (*arg == ':') { + if (mapp->conditional) + goto badmopt; + ++arg; + } else { /* Optional baudrate. */ + arg = strchr(p = arg, ':'); + if (arg == NULL) + goto badmopt; + *arg++ = '\0'; + mapp->speed = baudrate(p); + } + + if (*arg == '\0') /* Non-optional type. */ + goto badmopt; + + mapp->type = arg; + + /* Terminate porttype, if specified. */ + if (termp != NULL) + *termp = '\0'; + + /* If a NOT conditional, reverse the test. */ + if (mapp->conditional & NOT) + mapp->conditional = ~mapp->conditional & (EQ | GT | LT); + + /* If user specified a port with an option flag, set it. */ +done: if (port) { + if (mapp->porttype) +badmopt: errx(1, "illegal -m option format: %s", copy); + mapp->porttype = port; + } + +#ifdef MAPDEBUG + (void)printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY"); + (void)printf("type: %s\n", mapp->type); + (void)printf("conditional: "); + p = ""; + if (mapp->conditional & GT) { + (void)printf("GT"); + p = "/"; + } + if (mapp->conditional & EQ) { + (void)printf("%sEQ", p); + p = "/"; + } + if (mapp->conditional & LT) + (void)printf("%sLT", p); + (void)printf("\nspeed: %d\n", mapp->speed); +#endif + free(copy); +} + +/* + * Return the type of terminal to use for a port of type 'type', as specified + * by the first applicable mapping in 'map'. If no mappings apply, return + * 'type'. + */ +const char * +mapped(const char *type) +{ + MAP *mapp; + int match; + + match = 0; + for (mapp = maplist; mapp; mapp = mapp->next) + if (mapp->porttype == NULL || !strcmp(mapp->porttype, type)) { + switch (mapp->conditional) { + case 0: /* No test specified. */ + match = 1; + break; + case EQ: + match = (ospeed == mapp->speed); + break; + case GE: + match = (ospeed >= mapp->speed); + break; + case GT: + match = (ospeed > mapp->speed); + break; + case LE: + match = (ospeed <= mapp->speed); + break; + case LT: + match = (ospeed < mapp->speed); + break; + } + if (match) + return (mapp->type); + } + /* No match found; return given type. */ + return (type); +} + +static int +baudrate(char *rate) +{ + + /* The baudrate number can be preceded by a 'B', which is ignored. */ + if (*rate == 'B') + ++rate; + + return (atoi(rate)); +} diff --git a/vendor/netbsd-curses/tset/misc.c b/vendor/netbsd-curses/tset/misc.c new file mode 100644 index 0000000..5eeaee6 --- /dev/null +++ b/vendor/netbsd-curses/tset/misc.c @@ -0,0 +1,65 @@ +/* $NetBSD: misc.c,v 1.9 2010/02/10 10:33:45 roy Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include "extern.h" + +void +tset_cat(const char *file) +{ + register int fd, nr, nw; + char buf[1024]; + + if ((fd = open(file, O_RDONLY, 0)) < 0) + err(1, "%s", file); + + while ((nr = read(fd, buf, sizeof(buf))) > 0) + if ((nw = write(STDERR_FILENO, buf, nr)) == -1) + err(1, "write to stderr"); + if (nr != 0) + err(1, "%s", file); + (void)close(fd); +} + +int +outc(int c) +{ + + return (putc(c, stderr)); +} diff --git a/vendor/netbsd-curses/tset/reset.1 b/vendor/netbsd-curses/tset/reset.1 new file mode 120000 index 0000000..7a75cfb --- /dev/null +++ b/vendor/netbsd-curses/tset/reset.1 @@ -0,0 +1 @@ +tset.1 \ No newline at end of file diff --git a/vendor/netbsd-curses/tset/set.c b/vendor/netbsd-curses/tset/set.c new file mode 100644 index 0000000..141c747 --- /dev/null +++ b/vendor/netbsd-curses/tset/set.c @@ -0,0 +1,277 @@ +/* $NetBSD: set.c,v 1.18 2015/06/21 08:23:22 mlelstv Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include "extern.h" +#ifndef OXTABS +#define OXTABS 0 +#endif + +#define CHK(val, dft) (val <= 0 ? dft : val) + +static int set_tabs(void); + +/* + * Reset the terminal mode bits to a sensible state. Very useful after + * a child program dies in raw mode. + */ +void +reset_mode(void) +{ + tcgetattr(STDERR_FILENO, &mode); + +#if defined(VDISCARD) && defined(CDISCARD) + mode.c_cc[VDISCARD] = CHK(mode.c_cc[VDISCARD], CDISCARD); +#endif + mode.c_cc[VEOF] = CHK(mode.c_cc[VEOF], CEOF); + mode.c_cc[VERASE] = CHK(mode.c_cc[VERASE], CERASE); +#if defined(VFLUSH) && defined(CFLUSH) + mode.c_cc[VFLUSH] = CHK(mode.c_cc[VFLUSH], CFLUSH); +#endif + mode.c_cc[VINTR] = CHK(mode.c_cc[VINTR], CINTR); + mode.c_cc[VKILL] = CHK(mode.c_cc[VKILL], CKILL); +#if defined(VLNEXT) && defined(CLNEXT) + mode.c_cc[VLNEXT] = CHK(mode.c_cc[VLNEXT], CLNEXT); +#endif + mode.c_cc[VQUIT] = CHK(mode.c_cc[VQUIT], CQUIT); +#if defined(VREPRINT) && defined(CRPRNT) + mode.c_cc[VREPRINT] = CHK(mode.c_cc[VREPRINT], CRPRNT); +#endif + mode.c_cc[VSTART] = CHK(mode.c_cc[VSTART], CSTART); + mode.c_cc[VSTOP] = CHK(mode.c_cc[VSTOP], CSTOP); + mode.c_cc[VSUSP] = CHK(mode.c_cc[VSUSP], CSUSP); +#if defined(VWERASE) && defined(CWERASE) + mode.c_cc[VWERASE] = CHK(mode.c_cc[VWERASE], CWERASE); +#endif + + mode.c_iflag &= ~(IGNBRK | PARMRK | INPCK | ISTRIP | INLCR | IGNCR +#ifdef IUCLC + | IUCLC +#endif +#ifdef IXANY + | IXANY +#endif + | IXOFF); + + mode.c_iflag |= (BRKINT | IGNPAR | ICRNL | IXON +#ifdef IMAXBEL + | IMAXBEL +#endif + ); + + mode.c_oflag &= ~(0 +#ifdef OLCUC + | OLCUC +#endif +#ifdef OCRNL + | OCRNL +#endif +#ifdef ONOCR + | ONOCR +#endif +#ifdef ONLRET + | ONLRET +#endif +#ifdef OFILL + | OFILL +#endif +#ifdef OFDEL + | OFDEL +#endif +#ifdef NLDLY + | NLDLY | CRDLY | TABDLY | BSDLY | VTDLY | FFDLY +#endif + ); + + mode.c_oflag |= (OPOST +#ifdef ONLCR + | ONLCR +#endif + ); + + mode.c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD); + mode.c_cflag |= (CS8 | CREAD); + mode.c_lflag &= ~(ECHONL | NOFLSH | TOSTOP +#ifdef ECHOPTR + | ECHOPRT +#endif +#ifdef XCASE + | XCASE +#endif + ); + + mode.c_lflag |= (ISIG | ICANON | ECHO | ECHOE | ECHOK +#ifdef ECHOCTL + | ECHOCTL +#endif +#ifdef ECHOKE + | ECHOKE +#endif + ); + + tcsetattr(STDERR_FILENO, TCSADRAIN, &mode); +} + +/* + * Determine the erase, interrupt, and kill characters from the terminfo + * entry and command line and update their values in 'mode'. + */ +void +set_control_chars(int erasechar, int intrchar, int killchar) +{ + int bs_char; + + if (key_backspace != NULL && key_backspace[1] == '\0') + bs_char = key_backspace[0]; + else + bs_char = 0; + + if (erasechar == 0 && bs_char != 0 && !over_strike) + erasechar = -1; + if (erasechar < 0) + erasechar = (bs_char != 0) ? bs_char : CTRL('h'); + + if (mode.c_cc[VERASE] == 0 || erasechar != 0) + mode.c_cc[VERASE] = erasechar ? erasechar : CERASE; + + if (mode.c_cc[VINTR] == 0 || intrchar != 0) + mode.c_cc[VINTR] = intrchar ? intrchar : CINTR; + + if (mode.c_cc[VKILL] == 0 || killchar != 0) + mode.c_cc[VKILL] = killchar ? killchar : CKILL; +} + +/* + * Set up various conversions in 'mode', including parity, tabs, returns, + * echo, and case, according to the terminfo entry. If the program we're + * running was named with a leading upper-case character, map external + * uppercase to internal lowercase. + */ +void +set_conversions(int usingupper) +{ + +#ifdef ONLCR + mode.c_oflag |= ONLCR; +#endif + mode.c_iflag |= ICRNL; + mode.c_lflag |= ECHO; + mode.c_oflag |= OXTABS; + if (newline != NULL && newline[0] == '\n' && !newline[1]) { /* Newline, not linefeed. */ +#ifdef ONLCR + mode.c_oflag &= ~ONLCR; +#endif + mode.c_iflag &= ~ICRNL; + } + if (tab) /* Print tabs. */ + mode.c_oflag &= ~OXTABS; + mode.c_lflag |= (ECHOE | ECHOK); +} + +/* Output startup string. */ +void +set_init(void) +{ + const char *bp; + int settle; + +#ifdef TAB3 + if (oldmode.c_oflag & (TAB3 | ONLCR | OCRNL | ONLRET)) { + oldmode.c_oflag &= (TAB3 | ONLCR | OCRNL | ONLRET); + tcsetattr(STDERR_FILENO, TCSADRAIN, &oldmode); + } +#endif + settle = set_tabs(); + + if (isreset) { + if (reset_1string) { + tputs(reset_1string, 0, outc); + settle = 1; + } + if (reset_2string) { + tputs(reset_2string, 0, outc); + settle = 1; + } + if ((bp = reset_file) || (bp = init_file)) { + tset_cat(bp); + settle = 1; + } + } + + if (settle) { + (void)putc('\r', stderr); + (void)fflush(stderr); + (void)sleep(1); /* Settle the terminal. */ + } +} + +/* + * Set the hardware tabs on the terminal, using the ct (clear all tabs), + * st (set one tab) and ch (horizontal cursor addressing) capabilities. + * This is done before if and is, so they can patch in case we blow this. + * Return nonzero if we set any tab stops, zero if not. + */ +static int +set_tabs(void) +{ + int c; + char *out; + + if (set_tab) { + if (clear_all_tabs) { + (void)putc('\r', stderr); /* Force to left margin. */ + tputs(clear_all_tabs, 0, outc); + } + + for (c = 8; c < ncolumns; c += 8) { + if (column_address) + out = tiparm(column_address, c); + else + out = NULL; + if (out) + tputs(out, 1, outc); + else + (void)fprintf(stderr, "%s", " "); + /* Set the tab. */ + tputs(set_tab, 0, outc); + } + putc('\r', stderr); + return (1); + } + return (0); +} diff --git a/vendor/netbsd-curses/tset/term.c b/vendor/netbsd-curses/tset/term.c new file mode 100644 index 0000000..1cf0edd --- /dev/null +++ b/vendor/netbsd-curses/tset/term.c @@ -0,0 +1,153 @@ +/* $NetBSD: term.c,v 1.17 2011/09/06 18:34:12 joerg Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +//#include +#include +#include "extern.h" + +static const char *askuser(const char *); + +/* + * Figure out what kind of terminal we're dealing with, and then read in + * its termcap entry. + */ +const char * +get_terminfo_entry(const char *userarg) +{ + int rval; + const char *ttype; + + if (userarg) { + ttype = userarg; + goto found; + } + + /* Try the environment. */ + if ((ttype = getenv("TERM")) != NULL) + goto map; + +#ifdef HAVE_GETTTYNAM + struct ttyent *t; + char *p, *ttypath; + + /* Try ttyname(3); check for dialup or other mapping. */ + if ((ttypath = ttyname(STDERR_FILENO)) != NULL) { + if ((p = strrchr(ttypath, '/')) != NULL) + ++p; + else + p = ttypath; + if ((t = getttynam(p))) { + ttype = t->ty_type; + goto map; + } + } +#endif + /* If still undefined, use "unknown". */ + ttype = "unknown"; + +map: ttype = mapped(ttype); + +found: + + /* + * ttype now contains a pointer to the type of the terminal. + * If the first character is '?', ask the user. + */ + if (ttype[0] == '?') { + if (ttype[1] != '\0') + ttype = askuser(ttype + 1); + else + ttype = askuser(NULL); + } + + while (setupterm(ttype, 0, &rval) == ERR) { + switch (rval) { + case 1: + warnx("terminal type %s is hardcopy", ttype); + break; + case 0: + warnx("terminal type %s is unknown", ttype); + break; + default: + if (!errno) + errno = ENOENT; + err(1, NULL); + } + ttype = askuser(NULL); + } + + return (ttype); +} + +/* Prompt the user for a terminal type. */ +static const char * +askuser(const char *dflt) +{ + static char answer[256]; + char *p; + + /* We can get recalled; if so, don't continue uselessly. */ + if (feof(stdin) || ferror(stdin)) { + (void)fprintf(stderr, "\n"); + exit(1); + } + for (;;) { + if (dflt) + (void)fprintf(stderr, "Terminal type? [%s] ", dflt); + else + (void)fprintf(stderr, "Terminal type? "); + (void)fflush(stderr); + + if (fgets(answer, sizeof(answer), stdin) == NULL) { + if (dflt == NULL) { + (void)fprintf(stderr, "\n"); + exit(1); + } + return (dflt); + } + + if ((p = strchr(answer, '\n')) != NULL) + *p = '\0'; + if (answer[0]) + return (answer); + if (dflt != NULL) + return (dflt); + } +} diff --git a/vendor/netbsd-curses/tset/tset.1 b/vendor/netbsd-curses/tset/tset.1 new file mode 100644 index 0000000..d8b6fcc --- /dev/null +++ b/vendor/netbsd-curses/tset/tset.1 @@ -0,0 +1,408 @@ +.\" $NetBSD: tset.1,v 1.22 2017/07/03 21:34:22 wiz Exp $ +.\" +.\" Copyright (c) 1985, 1990, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)tset.1 8.1 (Berkeley) 6/9/93 +.\" +.Dd April 5, 2012 +.Dt TSET 1 +.Os +.Sh NAME +.Nm tset , +.Nm reset +.Nd terminal initialization +.Sh SYNOPSIS +.Nm +.Op Fl IQrs +.Op Fl +.Op Fl e Ar ch +.Op Fl i Ar ch +.Op Fl k Ar ch +.Op Fl m Ar mapping +.Op Ar terminal +.Pp +.Nm reset +.Op Fl IQrs +.Op Fl +.Op Fl e Ar ch +.Op Fl i Ar ch +.Op Fl k Ar ch +.Op Fl m Ar mapping +.Op Ar terminal +.Sh DESCRIPTION +.Nm +initializes terminals. +.Nm +first determines the type of terminal that you are using. +This determination is done as follows, using the first terminal type found. +.Pp +.Bl -bullet -compact -offset indent +.It +The +.Ar terminal +argument specified on the command line. +.It +The value of the +.Ev TERM +environmental variable. +.It +The terminal type associated with the standard error output device in the +.Pa /etc/ttys +file. +.It +The default terminal type, +.Dq unknown . +.El +.Pp +If the terminal type was not specified on the command-line, the +.Fl m +option mappings are then applied (see below for more information). +Then, if the terminal type begins with a question mark (``?''), the user is +prompted for confirmation of the terminal type. +An empty response confirms the type, or, another type can be entered to +specify a new type. +Once the terminal type has been determined, the terminfo entry for the terminal +is retrieved. +If no terminfo entry is found for the type, the user is prompted for another +terminal type. +.Pp +Once the terminfo entry is retrieved, the window size, backspace, interrupt +and line kill characters (among many other things) are set and the terminal +and tab initialization strings are sent to the standard error output. +Finally, if the erase, interrupt and line kill characters have changed, +or are not set to their default values, their values are displayed to the +standard error output. +.Pp +When invoked as +.Nm reset , +.Nm +sets cooked and echo modes, turns off cbreak and raw modes, turns on +newline translation and resets any unset special characters to their +default values before doing the terminal initialization described above. +This is useful after a program dies leaving a terminal in a abnormal state. +Note, you may have to type +.Dq Li reset +(the line-feed character is normally control-J) to get the terminal +to work, as carriage-return may no longer work in the abnormal state. +Also, the terminal will often not echo the command. +.Pp +The options are as follows: +.Bl -tag -width flag +.It Fl +The terminal type is displayed to the standard output, and the terminal is +not initialized in any way. +.It Fl e +Set the erase character to +.Ar ch . +.It Fl I +Do not send the terminal or tab initialization strings to the terminal. +.It Fl i +Set the interrupt character to +.Ar ch . +.It Fl k +Set the line kill character to +.Ar ch . +.It Fl m +Specify a mapping from a port type to a terminal. +See below for more information. +.It Fl Q +Don't display any values for the erase, interrupt and line kill characters. +.It Fl r +Print the terminal type to the standard error output. +.It Fl s +Print the sequence of shell commands to initialize the environment variable +.Ev TERM +to the standard output. +See the section below on setting the environment for details. +.El +.Pp +The arguments for the +.Fl e , +.Fl i +and +.Fl k +options may either be entered as actual characters or by using the +.Dq hat +notation, i.e. control-h may be specified as +.Dq Li ^H +or +.Dq Li ^h . +.Sh SETTING THE ENVIRONMENT +It is often desirable to enter the terminal type and information about +the terminal's capabilities into the shell's environment. +This is done using the +.Fl s +option. +.Pp +When the +.Fl s +option is specified, the commands to enter the information into the +shell's environment are written to the standard output. +If the +.Ev SHELL +environmental variable ends in +.Dq csh , +the commands are for the +.Xr csh 1 , +otherwise, they are for +.Xr sh 1 . +Note, the +.Xr csh 1 +commands +.Ic set +and +.Ic unset +the shell variable +.Dq noglob , +leaving it unset. +The following line in the +.Pa .login +or +.Pa .profile +files will initialize the environment correctly: +.Bd -literal -offset indent +eval \`tset -s options ... \` +.Ed +.Pp +To demonstrate a simple use of the +.Fl S +option, the following lines in the +.Pa .login +file have an equivalent effect: +.Bd -literal -offset indent +set noglob +set term=(`tset -S options ...`) +setenv TERM $term[1] +unset term +unset noglob +.Ed +.Sh TERMINAL TYPE MAPPING +When the terminal is not hardwired into the system (or the current system +information is incorrect) the terminal type derived from the +.Pa /etc/ttys +file or the +.Ev TERM +environmental variable is often something generic like +.Dq network , +.Dq dialup , +or +.Dq unknown . +When +.Nm +is used in a startup script +.Pf ( Pa .profile +for +.Xr sh 1 +users or +.Pa .login +for +.Xr csh 1 +users) it is often desirable to provide information about the type of +terminal used on such ports. +The purpose of the +.Fl m +option is to +.Dq map +from some set of conditions to a terminal type, that is, to +tell +.Nm +``If I'm on this port at a particular speed, guess that I'm on that +kind of terminal''. +.Pp +The argument to the +.Fl m +option consists of an optional port type, an optional operator, an optional +baud rate specification, an optional colon (``:'') character and a terminal +type. +The port type is a string (delimited by either the operator or the colon +character). +The operator may be any combination of: +.Dq Li \&> , +.Dq Li \&< , +.Dq Li \&@ , +and +.Dq Li \&! ; +.Dq Li \&> +means greater than, +.Dq Li \&< +means less than, +.Dq Li \&@ +means equal to +and +.Dq Li \&! +inverts the sense of the test. +The baud rate is specified as a number and is compared with the speed +of the standard error output (which should be the control terminal). +The terminal type is a string. +.Pp +If the terminal type is not specified on the command line, the +.Fl m +mappings are applied to the terminal type. +If the port type and baud rate match the mapping, the terminal type specified +in the mapping replaces the current type. +If more than one mapping is specified, the first applicable mapping is used. +.Pp +For example, consider the following mapping: +.Dq Li dialup>9600:vt100 . +The port type is +.Dq Li dialup , +the operator is +.Dq Li > , +the baud rate specification is +.Dq Li 9600 , +and the terminal type is +.Dq Li vt100 . +The result of this mapping is to specify that if the terminal type is +.Dq Li dialup , +and the baud rate is greater than 9600 baud, a terminal type of +.Dq Li vt100 +will be used. +.Pp +If no port type is specified, the terminal type will match any port type, +for example, +.Dq Li -m dialup:vt100 -m :?xterm +will cause any dialup port, regardless of baud rate, to match the terminal +type +.Dq Li vt100 , +and any non-dialup port type to match the terminal type +.Dq Li ?xterm . +Note, because of the leading question mark, the user will be +queried on a default port as to whether they are actually using an +.Ar xterm +terminal. +.Pp +No whitespace characters are permitted in the +.Fl m +option argument. +Also, to avoid problems with metacharacters, it is suggested that the entire +.Fl m +option argument be placed within single quote characters, and that +.Xr csh 1 +users insert a backslash character (``\e'') before any exclamation +marks (``!''). +.Sh ENVIRONMENT +The +.Nm +command uses the +.Ev SHELL +and +.Ev TERM +environment variables. +.Sh FILES +.Bl -tag -width /usr/share/misc/terminfo -compact +.It Pa /etc/ttys +system port name to terminal type mapping database +.It Pa /usr/share/misc/terminfo +terminal capability database +.El +.Sh COMPATIBILITY +The +.Fl A , +.Fl E , +.Fl h , +.Fl u +and +.Fl v +options have been deleted from the +.Nm +utility. +None of them were documented in +.Bx 4.3 +and all are of limited utility at +best. +The +.Fl a , +.Fl d +and +.Fl p +options are similarly not documented or useful, but were retained as they +appear to be in widespread use. +It is strongly recommended that any usage of these three options be +changed to use the +.Fl m +option instead. +The +.Fl n +option remains, but has no effect. +It is still permissible to specify the +.Fl e , +.Fl i +and +.Fl k +options without arguments, although it is strongly recommended that such +usage be fixed to explicitly specify the character. +.Pp +Executing +.Nm +as +.Nm reset +no longer implies the +.Fl Q +option. +Also, the interaction between the +.Fl +option and the +.Ar terminal +argument in some historic implementations of +.Nm +has been removed. +.Pp +The +.Fl E +and +.Fl S +options have been removed as they only make sense for termcap and +.Nm +now uses terminfo. +As such, the +.Ev TERMCAP +entry has been removed from +.Fl s . +.Pp +Finally, the +.Nm +implementation has been completely redone (as part of the addition to the +system of a +.St -p1003.1-88 +compliant terminal interface) and will no longer compile on systems with +older terminal interfaces. +.Sh SEE ALSO +.Xr csh 1 , +.Xr sh 1 , +.Xr stty 1 , +.Xr tty 4 , +.Xr terminfo 5 , +.Xr ttys 5 , +.Xr environ 7 +.Sh HISTORY +The +.Nm reset +and +.Nm tset +commands appeared in +.Bx 1 . diff --git a/vendor/netbsd-curses/tset/tset.c b/vendor/netbsd-curses/tset/tset.c new file mode 100644 index 0000000..cd5bb77 --- /dev/null +++ b/vendor/netbsd-curses/tset/tset.c @@ -0,0 +1,287 @@ +/* $NetBSD: tset.c,v 1.20 2011/09/06 18:34:12 joerg Exp $ */ + +/*- + * Copyright (c) 1980, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993\ + The Regents of the University of California. All rights reserved."); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "extern.h" + +static void obsolete(char *[]); +static void report(const char *, int, u_int); +__dead static void usage(char*); + +struct termios mode, oldmode; + +int isreset; /* invoked as reset */ +int nlines, ncolumns; /* window size */ + +int +main(int argc, char *argv[]) +{ + char *a0 = argv[0]; +#ifdef TIOCGWINSZ + struct winsize win; +#endif + int ch, noinit, noset, quiet, sflag, showterm; + int erasechar = 0, intrchar = 0, killchar = 0; + int usingupper; + char *p; + const char *k1, *k2; + const char *ttype; + + if (tcgetattr(STDERR_FILENO, &mode) < 0) + err(1, "standard error"); + + oldmode = mode; + ospeed = cfgetospeed(&mode); + + if ((p = strrchr(*argv, '/')) != NULL) + ++p; + else + p = *argv; + usingupper = isupper((unsigned char)*p); + if (!strcasecmp(p, "reset")) { + isreset = 1; + reset_mode(); + } + + obsolete(argv); + noinit = noset = quiet = sflag = showterm = 0; + while ((ch = getopt(argc, argv, "-a:d:e:EIi:k:m:np:QSrs")) != -1) { + switch (ch) { + case '-': /* display term only */ + noset = 1; + break; + case 'a': /* OBSOLETE: map identifier to type */ + add_mapping("arpanet", optarg); + break; + case 'd': /* OBSOLETE: map identifier to type */ + add_mapping("dialup", optarg); + break; + case 'e': /* erase character */ + erasechar = optarg[0] == '^' && optarg[1] != '\0' ? + optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : + optarg[0]; + break; + case 'E': /* -E does not make sense for terminfo + should this be noisy? */ + break; + case 'I': /* no initialization strings */ + noinit = 1; + break; + case 'i': /* interrupt character */ + intrchar = optarg[0] == '^' && optarg[1] != '\0' ? + optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : + optarg[0]; + break; + case 'k': /* kill character */ + killchar = optarg[0] == '^' && optarg[1] != '\0' ? + optarg[1] == '?' ? '\177' : CTRL(optarg[1]) : + optarg[0]; + break; + case 'm': /* map identifier to type */ + add_mapping(NULL, optarg); + break; + case 'n': /* OBSOLETE: set new tty driver */ + break; + case 'p': /* OBSOLETE: map identifier to type */ + add_mapping("plugboard", optarg); + break; + case 'Q': /* don't output control key settings */ + quiet = 1; + break; + case 'S': /* -S does not make sense for terminfo + should this be noisy? */ + break; + case 'r': /* display term on stderr */ + showterm = 1; + break; + case 's': /* output TERM string */ + sflag = 1; + break; + case '?': + default: + usage(a0); + } + } + argc -= optind; + argv += optind; + + if (argc > 1) + usage(a0); + + ttype = get_terminfo_entry(*argv); + + if (!noset) { + ncolumns = columns; + nlines = lines; + +#ifdef TIOCGWINSZ + /* Set window size */ + (void)ioctl(STDERR_FILENO, TIOCGWINSZ, &win); + if (win.ws_row > 0 && win.ws_col > 0) { + nlines = win.ws_row; + ncolumns = win.ws_col; + } else if (win.ws_row == 0 && win.ws_col == 0 && + nlines > 0 && columns > 0) { + win.ws_row = nlines; + win.ws_col = ncolumns; + (void)ioctl(STDERR_FILENO, TIOCSWINSZ, &win); + } +#endif + set_control_chars(erasechar, intrchar, killchar); + set_conversions(usingupper); + + if (!noinit) + set_init(); + + /* Set the modes if they've changed. */ + if (memcmp(&mode, &oldmode, sizeof(mode))) + tcsetattr(STDERR_FILENO, TCSADRAIN, &mode); + } + + if (noset) + (void)printf("%s\n", ttype); + else { + if (showterm) + (void)fprintf(stderr, "Terminal type is %s.\n", ttype); + /* + * If erase, kill and interrupt characters could have been + * modified and not -Q, display the changes. + */ + if (!quiet) { + report("Erase", VERASE, CERASE); + report("Kill", VKILL, CKILL); + report("Interrupt", VINTR, CINTR); + } + } + + if (sflag) { + /* + * Figure out what shell we're using. A hack, we look for an + * environmental variable SHELL ending in "csh". + */ + if ((p = getenv("SHELL")) && + !strcmp(p + strlen(p) - 3, "csh")) { + k1 = "set noglob;\nsetenv TERM "; + k2 = ";\nunset noglob;\n"; + } else { + k1 = "TERM="; + k2 = ";\nexport TERM;\n"; + } + (void)printf("%s%s%s", k1, ttype, k2); + } + + exit(0); +} + +/* + * Tell the user if a control key has been changed from the default value. + */ +static void +report(const char *name, int which, u_int def) +{ + u_int old, new; + + new = mode.c_cc[which]; + old = oldmode.c_cc[which]; + + if (old == new && old == def) + return; + + (void)fprintf(stderr, "%s %s ", name, old == new ? "is" : "set to"); + + if (key_backspace != NULL && + new == (unsigned int)key_backspace[0] && + key_backspace[1] == '\0') + (void)fprintf(stderr, "backspace.\n"); + else if (new == 0177) + (void)fprintf(stderr, "delete.\n"); + else if (new < 040) { + new ^= 0100; + (void)fprintf(stderr, "control-%c (^%c).\n", new, new); + } else if (new == _POSIX_VDISABLE) + (void)fprintf(stderr, ".\n"); + else + (void)fprintf(stderr, "%c.\n", new); +} + +/* + * Convert the obsolete argument form into something that getopt can handle. + * This means that -e, -i and -k get default arguments supplied for them. + */ +void +obsolete(char *argv[]) +{ + static char earg[5] = { '-', 'e', '^', 'H', '\0' }; + static char iarg[5] = { '-', 'i', '^', 'C', '\0' }; + static char karg[5] = { '-', 'k', '^', 'U', '\0' }; + + for (; *argv; ++argv) { + if (argv[0][0] != '-' || (argv[1] && argv[1][0] != '-') || + (argv[0][1] != 'e' && argv[0][1] != 'i' && + argv[0][1] != 'k') || argv[0][2] != '\0') + continue; + switch(argv[0][1]) { + case 'e': + argv[0] = earg; + break; + case 'i': + argv[0] = iarg; + break; + case 'k': + argv[0] = karg; + break; + } + } +} + +static void +usage(char *a0) +{ + (void)fprintf(stderr, +"usage: %s [-EIQrSs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]\n", + a0); + exit(1); +}