SCCS-vsn: usr.bin/tee/tee.c 5.7
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)tee.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)tee.c 5.7 (Berkeley) %G%";
#endif /* not lint */
#include <sys/types.h>
#endif /* not lint */
#include <sys/types.h>
}
add(1, "stdout");
for (; *argv; ++argv)
}
add(1, "stdout");
for (; *argv; ++argv)
- if ((fd = open(*argv, append ? O_WRONLY|O_CREAT :
+ if ((fd = open(*argv, append ? O_WRONLY|O_CREAT|O_APPEND :
O_WRONLY|O_CREAT|O_TRUNC, 0600)) < 0)
(void)fprintf(stderr, "tee: %s: %s.\n",
*argv, strerror(errno));
O_WRONLY|O_CREAT|O_TRUNC, 0600)) < 0)
(void)fprintf(stderr, "tee: %s: %s.\n",
*argv, strerror(errno));
- else {
- if (append)
- (void)lseek(fd, 0L, L_XTND);
exitval = 0;
while ((n = read(0, buf, sizeof(buf))) > 0)
for (p = head; p; p = p->next)
exitval = 0;
while ((n = read(0, buf, sizeof(buf))) > 0)
for (p = head; p; p = p->next)