1 /* vi: set sw=4 ts=4: */
3 * cat implementation for busybox
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
7 * Licensed under GPLv2, see file License in this tarball for details.
10 /* BB_AUDIT SUSv3 compliant */
11 /* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
15 /* This is a NOFORK applet. Be very careful! */
18 int bb_cat(char **argv)
20 static const char *const argv_dash[] = { "-", NULL };
23 int retval = EXIT_SUCCESS;
26 argv = (char**) &argv_dash;
30 if (!LONE_DASH(*argv))
31 fd = open_or_warn(*argv, O_RDONLY);
33 /* This is not an xfunc - never exits */
34 off_t r = bb_copyfd_eof(fd, STDOUT_FILENO);
35 if (fd != STDIN_FILENO)
40 retval = EXIT_FAILURE;
46 int cat_main(int argc, char **argv);
47 int cat_main(int argc, char **argv)