Scripting tftp(1) makes it non-interactive, yet the prompt is still
printed and may mess up the shell's PS1:
$ echo put nonexistent | tftp localhost
tftp> tftp: open: nonexistent: No such file or directory
tftp> $
The fix seems easy and works as expected for multiple commands as well:
$ echo 'verbose\nput nonexistent' | ./obj/tftp localhost
Verbose mode on.
tftp: open: nonexistent: No such file or directory
$
OK millert
-/* $OpenBSD: main.c,v 1.43 2018/09/20 11:42:42 jsg Exp $ */
+/* $OpenBSD: main.c,v 1.44 2022/10/04 07:03:27 kn Exp $ */
/* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */
/*
struct cmd *c;
for (;;) {
- printf("%s> ", prompt);
+ if (isatty(STDIN_FILENO))
+ printf("%s> ", prompt);
if (readcmd(line, LBUFLEN, stdin) < 1)
continue;
if ((line[0] == 0) || (line[0] == '\n'))