XINU
Functions
xsh_echo.c File Reference

STDOUT(標準出力)に引数に指定した文字列を出力する。 More...

#include <xinu.h>
#include <stdio.h>
Include dependency graph for xsh_echo.c:

Go to the source code of this file.

Functions

shellcmd xsh_echo (int nargs, char *args[])
 STDOUT(標準出力)に引数に指定した文字列を出力する。 More...
 

Detailed Description

STDOUT(標準出力)に引数に指定した文字列を出力する。

Definition in file xsh_echo.c.

Function Documentation

◆ xsh_echo()

shellcmd xsh_echo ( int  nargs,
char *  args[] 
)

STDOUT(標準出力)に引数に指定した文字列を出力する。

複数の引数がある場合は、改行せずにスペース区切りで引数が続けて出力される。

Parameters
[in]nargs引数の数
[in]args引数(引数を持つ配列)
Returns
0を返す。

Definition at line 15 of file xsh_echo.c.

References printf().

16 {
17  int32 i; /* walks through args array */
18 
19  if (nargs > 1)
20  {
21  printf("%s", args[1]);
22 
23  for (i = 2; i < nargs; i++)
24  {
25  printf(" %s", args[i]);
26  }
27  }
28  printf("\n");
29 
30  return 0;
31 }
int32 printf(const char *,...)
Definition: printf.c:13
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
Here is the call graph for this function: