logo

openpt

Fake a pseudo-terminal for testsuites
commit: 526485532261715f52b90c159663a13297b9c574
parent e4a6c2af624388ebff4a8ceb18cfb7c8834b58f8
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun,  2 Jun 2024 07:45:20 +0200

openpt.1: Add manpage

Diffstat:

MMakefile3+++
Aopenpt.142++++++++++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile @@ -3,6 +3,7 @@ PREFIX ?= /usr/local BINDIR ?= ${PREFIX}/bin +MANDIR ?= ${PREFIX}/share/man openpt: openpt.c ${CC} -std=c99 ${CFLAGS} -o $@ $< ${LDFLAGS} @@ -15,3 +16,5 @@ clean: install: openpt mkdir -p ${BINDIR}/ cp -p openpt ${DESTDIR}/${BINDIR}/openpt + mkdir -p ${MANDIR}/man1/ + cp -p openpt.1 ${DESTDIR}/${MANDIR}/man1/openpt.1 diff --git a/openpt.1 b/openpt.1 @@ -0,0 +1,42 @@ +.\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils-openpt@hacktivis.me> +.\" SPDX-License-Identifier: MIT +.Dd 2024-06-02 +.Dt OPENPT 1 +.Os +.Sh NAME +.Nm openpt +.Nd Start program in a new pseudo-terminal +.Sh SYNOPSIS +.Nm +.Ar command +.Op argument... +.Sh DESCRIPTION +.Nm +executes +.Ar command +inside of a new pseudo-terminal, with standard I/Os copied in/out. +.Pp +Note that when executing prompts such as a shell, you might need +to send an explicit EOF, like so: +.Dl % printf 'ls\en\e004' | openpt sh +This behavior might change in future versions. +.Sh EXIT STATUS +.Ex -std +.Sh EXAMPLES +Test interactive mode of +.Cm mv : +.Bd -literal -offset indent +#!/bin/sh +set -e + +touch src no_write +chmod -w no_write + +echo y | openpt mv src no_write +test ! -e src +test -f no_write +.Ed +.Sh STANDARDS +None. +.Sh AUTHORS +.An Haelwenn (lanodan) Monnier Aq Mt contact+utils-openpt@hacktivis.me