2 * Simple cat implemention.
4 * Copyright (C) 2009 Liu Aleaxander -- All rights reserved. This file
5 * may be redistributed under the terms of the GNU Public License.
15 void fstk_cat(struct fstk
*fs
, int argc
, char *argv
[])
17 char buf
[2048] = {0,};
22 for (; i
< argc
; i
++) {
23 file
= fstk_open(fs
, argv
[i
]);
25 printf("cat: can't access %s: "
26 "No such file or directory\n", argv
[i
]);
29 if (file
->inode
->mode
== DIR_TYPE
) {
30 printf("cat: %s: is a directory\n", argv
[i
]);
35 while ((bytes_read
= fstk_read(file
, buf
, 2048)) >= 0) {
36 write(1, buf
, bytes_read
);