Hi-
I wouldn't be surprised if this has already been addressed, but I was
browsing the source for tee in shellutils 2.0 and noticed a FIXME
comment on line 146:
/* FIXME: warn if tee is given no file arguments.
In that case it's just a slow imitation of `cat.' */
So, I think I fixed it. You will find the diff (generated w/ diff -u3)
below. This is the first time I've ever submitted a diff for anything,
so feel free to let me know if I've done anything wrong (or if my code
sucks :).
Thanks,
Nathan Lynch
--- tee.c.orig Mon Aug 14 01:54:17 2000
+++ tee.c Mon Aug 14 02:26:29 2000
@@ -143,8 +143,11 @@
signal (SIGPIPE, SIG_IGN);
#endif
- /* FIXME: warn if tee is given no file arguments.
+ /* Warn if tee is given no file arguments.
In that case it's just a slow imitation of `cat.' */
+ if (argv[optind] == NULL)
+ fprintf (stderr, _("%s: warning-- no file arguments given.\n"),
+ program_name);
errs = tee (argc - optind, (const char **) &argv[optind]);
if (close (0) != 0)