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
$
I think the manual's wording can just stay as-is:
COMMANDS
Once tftp is running, it issues the prompt ‘tftp>’ and recognizes
the
following commands:
Feedback? OK?
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/tftp/main.c,v
retrieving revision 1.43
diff -u -p -r1.43 main.c
--- main.c 20 Sep 2018 11:42:42 -0000 1.43
+++ main.c 2 Oct 2022 12:39:04 -0000
@@ -602,7 +602,8 @@ command(void)
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'))