XINU
xsh_devdump.c
Go to the documentation of this file.
1 /* xsh_devdump.c - xsh_devdump */
2 
3 #include <xinu.h>
4 #include <stdio.h>
5 
6 /*------------------------------------------------------------------------
7  * xsh_devdump - shell command to print info from the device switch table
8  *------------------------------------------------------------------------
9  */
11  int nargs, /* number of arguments */
12  char *args[] /* list of arguments */
13  )
14 {
15  struct dentry *devptr; /* pointer to device entry */
16  int32 i; /* walks through device table */
17 
18  /* No arguments are expected */
19 
20  if (nargs > 1) {
21  fprintf(stderr, "No arguments allowed\n");
22  return 1;
23  }
24 
25  /* Walk through device table */
26 
27  printf("Device Name Minor\n");
28  printf("------ ------------ -----\n");
29 
30  for (i = 0; i < NDEVS; i++) {
31  devptr = &devtab[i];
32  printf("%4d %-12s %3d\n", i, devptr->dvname,
33  devptr->dvminor);
34  }
35  return 0;
36 }
#define NDEVS
Definition: conf.h:74
int32 dvminor
Definition: conf.h:8
全てのシステムヘッダファイルをインクルードする。
#define stderr
Definition: stdio.h:17
shellcmd xsh_devdump(int nargs, char *args[])
Definition: xsh_devdump.c:10
int32 printf(const char *,...)
Definition: printf.c:13
Definition: conf.h:6
struct dentry devtab[]
Definition: conf.c:11
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
char * dvname
Definition: conf.h:9
int32 shellcmd
シェルコール関数 返り値の型
Definition: kernel.h:51
int32 fprintf(int, char *,...)
Definition: fprintf.c:14