1*096c39faSKyle Evans#!/usr/bin/env -S porch -f 2*096c39faSKyle Evans-- 3*096c39faSKyle Evans-- Copyright (c) 2024 Kyle Evans <kevans@FreeBSD.org> 4*096c39faSKyle Evans-- 5*096c39faSKyle Evans-- SPDX-License-Identifier: BSD-2-Clause 6*096c39faSKyle Evans-- 7*096c39faSKyle Evans 8*096c39faSKyle Evanstimeout(3) 9*096c39faSKyle Evans 10*096c39faSKyle Evanslocal function spawn_one(...) 11*096c39faSKyle Evans spawn(...) 12*096c39faSKyle Evans 13*096c39faSKyle Evans stty("lflag", 0, tty.lflag.ICANON) 14*096c39faSKyle Evansend 15*096c39faSKyle Evans 16*096c39faSKyle Evans-- We can send one byte... 17*096c39faSKyle Evansspawn_one("readsz", "-c", 1) 18*096c39faSKyle Evanswrite "H" 19*096c39faSKyle Evansmatch "^H$" 20*096c39faSKyle Evans 21*096c39faSKyle Evans-- or many. 22*096c39faSKyle Evansspawn_one("readsz", "-c", 1) 23*096c39faSKyle Evanswrite "Hello" 24*096c39faSKyle Evansmatch "^Hello$" 25*096c39faSKyle Evans 26*096c39faSKyle Evans-- VEOF is a normal character here, passed through as-is. 27*096c39faSKyle Evansspawn_one("readsz", "-c", 1) 28*096c39faSKyle Evanswrite "Hello^D" 29*096c39faSKyle Evansmatch "^Hello\x04$" 30*096c39faSKyle Evansspawn_one("readsz", "-c", 1) 31*096c39faSKyle Evanswrite "^D" 32*096c39faSKyle Evansmatch "^\x04$" 33*096c39faSKyle Evans 34*096c39faSKyle Evans-- Confirm that FIONREAD agrees that VEOF will be returned, even if it was sent 35*096c39faSKyle Evans-- while the tty was still in canonical mode. 36*096c39faSKyle Evansspawn("fionread") 37*096c39faSKyle Evanswrite "^D" 38*096c39faSKyle Evansstty("lflag", 0, tty.lflag.ICANON) 39*096c39faSKyle Evansmatch "^1$" 40