#include <xinu.h>
#include <stdio.h>
#include <string.h>
Go to the source code of this file.
◆ xsh_cat()
shellcmd xsh_cat |
( |
int |
nargs, |
|
|
char * |
args[] |
|
) |
| |
Definition at line 11 of file xsh_cat.c.
References close(), EOF, fprintf(), getc(), NAMESPACE, NULLCH, open(), printf(), putc(), stderr, stdin, stdout, strncmp(), and SYSERR.
21 if (nargs == 2 &&
strncmp(args[1],
"--help", 7) == 0) {
22 printf(
"Use: %s [file...]\n\n", args[0]);
24 printf(
"\twrites contents of files or stdin to stdout\n");
26 printf(
"\tfile...\tzero or more file names\n");
27 printf(
"\t--help\t display this help and exit\n");
33 while (nextch !=
EOF) {
39 for (i = 1; i < nargs; i++) {
41 if ( (argptr[0] ==
'-') && (argptr[1] ==
NULLCH) ) {
52 while (nextch !=
EOF) {
int32 strncmp(const char *, const char *, int32)
#define EOF
ファイルの終端(End of File)に達した場合(読み込み処理に用いる)
int32 printf(const char *,...)
syscall putc(did32, char)
デバイスへ文字1Byteを送信する。
int int32
符号あり32ビット整数(int)
int32 fprintf(int, char *,...)
syscall open(did32, char *, char *)
#define NULLCH
NULL文字(NULL終端)