xref: /openbsd/regress/bin/ksh/edit/emacs.sh (revision c0603667)
182270653Santon#!/bin/sh
282270653Santon#
382270653Santon# Copyright (c) 2017 Anton Lindqvist <anton@openbsd.org>
437f3e371Sschwarze# Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org>
582270653Santon#
682270653Santon# Permission to use, copy, modify, and distribute this software for any
782270653Santon# purpose with or without fee is hereby granted, provided that the above
882270653Santon# copyright notice and this permission notice appear in all copies.
982270653Santon#
1082270653Santon# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1182270653Santon# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1282270653Santon# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1382270653Santon# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1482270653Santon# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1582270653Santon# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1682270653Santon# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1782270653Santon
1882270653Santonset -e
1982270653Santon
2082270653Santon. "${1:-.}/subr.sh"
2182270653Santon
2282270653SantonEDITOR=
23997ea89aSantonENV=
2482270653SantonHISTFILE=
2582270653SantonMAIL=
2682270653SantonMALLOC_OPTIONS=S
27*c0603667SantonPS1=' # '
2882270653SantonVISUAL=emacs
2982270653Santonexport EDITOR ENV HISTFILE MAIL MALLOC_OPTIONS PS1 VISUAL
3082270653Santon
3182270653Santon# auto-insert
32*c0603667Santontestseq "abc" " # abc"
3337f3e371Sschwarze
3437f3e371Sschwarze# insertion of valid UTF-8
35*c0603667Santontestseq "z\0002\0302\0200" " # z\b\0302\0200z\b"
36*c0603667Santontestseq "z\0002\0337\0277" " # z\b\0337\0277z\b"
37*c0603667Santontestseq "z\0002\0340\0240\0200" " # z\b\0340\0240\0200z\b"
38*c0603667Santontestseq "z\0002\0354\0277\0277" " # z\b\0354\0277\0277z\b"
39*c0603667Santontestseq "z\0002\0355\0200\0200" " # z\b\0355\0200\0200z\b"
40*c0603667Santontestseq "z\0002\0355\0237\0277" " # z\b\0355\0237\0277z\b"
41*c0603667Santontestseq "z\0002\0356\0200\0200" " # z\b\0356\0200\0200z\b"
42*c0603667Santontestseq "z\0002\0357\0277\0277" " # z\b\0357\0277\0277z\b"
43*c0603667Santontestseq "z\0002\0364\0200\0200\0200" " # z\b\0364\0200\0200\0200z\b"
44*c0603667Santontestseq "z\0002\0364\0217\0277\0277" " # z\b\0364\0217\0277\0277z\b"
4537f3e371Sschwarze
4637f3e371Sschwarze# insertion of incomplete UTF-8
47*c0603667Santontestseq "z\0002\0302\0006" " # z\b\0302z\bz"
48*c0603667Santontestseq "z\0002\0377\0006" " # z\b\0377z\bz"
49*c0603667Santontestseq "z\0002\0337\0006" " # z\b\0337z\bz"
50*c0603667Santontestseq "z\0002\0340\0006" " # z\b\0340z\bz"
51*c0603667Santontestseq "z\0002\0357\0006" " # z\b\0357z\bz"
52*c0603667Santontestseq "z\0002\0364\0006" " # z\b\0364z\bz"
53*c0603667Santontestseq "z\0002\0340\0240\0006" " # z\b\0340\0240z\bz"
54*c0603667Santontestseq "z\0002\0354\0277\0006" " # z\b\0354\0277z\bz"
55*c0603667Santontestseq "z\0002\0355\0200\0006" " # z\b\0355\0200z\bz"
56*c0603667Santontestseq "z\0002\0355\0237\0006" " # z\b\0355\0237z\bz"
57*c0603667Santontestseq "z\0002\0356\0200\0006" " # z\b\0356\0200z\bz"
58*c0603667Santontestseq "z\0002\0357\0277\0006" " # z\b\0357\0277z\bz"
59*c0603667Santontestseq "z\0002\0364\0200\0200\0006" " # z\b\0364\0200\0200z\bz"
60*c0603667Santontestseq "z\0002\0364\0217\0277\0006" " # z\b\0364\0217\0277z\bz"
6137f3e371Sschwarze
6237f3e371Sschwarze# insertion of invalid bytes
63*c0603667Santontestseq "z\0002\0300\0277" " # z\b\0300z\b\b\0300\0277z\b"
64*c0603667Santontestseq "z\0002\0301\0277" " # z\b\0301z\b\b\0301\0277z\b"
65*c0603667Santontestseq "z\0002\0360\0217" " # z\b\0360z\b\b\0360\0217z\b"
66*c0603667Santontestseq "z\0002\0363\0217" " # z\b\0363z\b\b\0363\0217z\b"
67*c0603667Santontestseq "z\0002\0365\0217" " # z\b\0365z\b\b\0365\0217z\b"
68*c0603667Santontestseq "z\0002\0367\0217" " # z\b\0367z\b\b\0367\0217z\b"
69*c0603667Santontestseq "z\0002\0370\0217" " # z\b\0370z\b\b\0370\0217z\b"
70*c0603667Santontestseq "z\0002\0377\0217" " # z\b\0377z\b\b\0377\0217z\b"
7137f3e371Sschwarze
7237f3e371Sschwarze# insertion of excessively long encodings
7337f3e371Sschwarzetestseq "z\0002\0340\0200\0200" \
74*c0603667Santon	" # z\b\0340z\b\b\0340\0200z\b\b\0340\0200\0200z\b"
7537f3e371Sschwarzetestseq "z\0002\0340\0201\0277" \
76*c0603667Santon	" # z\b\0340z\b\b\0340\0201z\b\b\0340\0201\0277z\b"
7737f3e371Sschwarzetestseq "z\0002\0340\0202\0200" \
78*c0603667Santon	" # z\b\0340z\b\b\0340\0202z\b\b\0340\0202\0200z\b"
7937f3e371Sschwarzetestseq "z\0002\0340\0237\0277" \
80*c0603667Santon	" # z\b\0340z\b\b\0340\0237z\b\b\0340\0237\0277z\b"
8137f3e371Sschwarze
8237f3e371Sschwarze# insertion of surrogates and execessive code points
8337f3e371Sschwarzetestseq "z\0002\0355\0240\0200" \
84*c0603667Santon	" # z\b\0355z\b\b\0355\0240z\b\b\0355\0240\0200z\b"
8537f3e371Sschwarzetestseq "z\0002\0355\0277\0277" \
86*c0603667Santon	" # z\b\0355z\b\b\0355\0277z\b\b\0355\0277\0277z\b"
8737f3e371Sschwarzetestseq "z\0002\0364\0220\0200\0200" \
88*c0603667Santon  " # z\b\0364z\b\b\0364\0220z\b\b\0364\0220\0200z\b\b\0364\0220\0200\0200z\b"
8937f3e371Sschwarzetestseq "z\0002\0364\0277\0277\0277" \
90*c0603667Santon  " # z\b\0364z\b\b\0364\0277z\b\b\0364\0277\0277z\b\b\0364\0277\0277\0277z\b"
910a8992d0Santon
920a8992d0Santon# insertion of unmatched meta sequence
93*c0603667Santontestseq "z\0002\0033[3z" " # z\b\0007"
94