4 * no options - the way cat was intended
8 Copyright (C) 1999-2009 Free Software Foundation, Inc.
10 This file is part of GNU Bash.
11 Bash is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 Bash is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with Bash. If not, see <http://www.gnu.org/licenses/>.
35 extern char *strerror ();
36 extern char **make_builtin_argv ();
45 while (n
= read(fd
, buf
, sizeof (buf
))) {
49 write(2, "cat: write error: ", 18);
51 write(2, s
, strlen(s
));
69 for (i
= r
= 1; i
< argc
; i
++) {
70 if (argv
[i
][0] == '-' && argv
[i
][1] == '\0')
73 fd
= open(argv
[i
], O_RDONLY
, 0666);
76 write(2, "cat: cannot open ", 17);
77 write(2, argv
[i
], strlen(argv
[i
]));
79 write(2, s
, strlen(s
));
97 v
= make_builtin_argv(list
, &c
);
107 "Read each FILE and display it on the standard output. If any",
108 "FILE is `-' or if no FILE argument is given, the standard input",
113 struct builtin cat_struct
= {
118 "cat [-] [file ...]",