mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-04-24 02:30:32 +08:00
命令行API
This commit is contained in:
1
28_day/type/!cons_9x.bat
Normal file
1
28_day/type/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
28_day/type/!cons_nt.bat
Normal file
1
28_day/type/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
28_day/type/Makefile
Normal file
5
28_day/type/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = type
|
||||
STACK = 1k
|
||||
MALLOC = 0k
|
||||
|
||||
include ../app_make.txt
|
||||
1
28_day/type/make.bat
Normal file
1
28_day/type/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
23
28_day/type/type.c
Normal file
23
28_day/type/type.c
Normal file
@@ -0,0 +1,23 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
int fh;
|
||||
char c, cmdline[30], *p;
|
||||
|
||||
api_cmdline(cmdline, 30);
|
||||
for (p = cmdline; *p > ' '; p++) { } /*跳过之前的内容,直到遇到空格*/
|
||||
for (; *p == ' '; p++) { } /*跳过空格*/
|
||||
fh = api_fopen(p);
|
||||
if (fh != 0) {
|
||||
for (;;) {
|
||||
if (api_fread(&c, 1, fh) == 0) {
|
||||
break;
|
||||
}
|
||||
api_putchar(c);
|
||||
}
|
||||
} else {
|
||||
api_putstr0("File not found.\n");
|
||||
}
|
||||
api_end();
|
||||
}
|
||||
Reference in New Issue
Block a user