命令行API

This commit is contained in:
Yourtion
2016-05-18 11:41:34 +08:00
parent 9231ce4a38
commit 86791cd7f4
11 changed files with 70 additions and 24 deletions

1
28_day/type/!cons_9x.bat Normal file
View File

@@ -0,0 +1 @@
command

1
28_day/type/!cons_nt.bat Normal file
View File

@@ -0,0 +1 @@
cmd.exe

5
28_day/type/Makefile Normal file
View File

@@ -0,0 +1,5 @@
APP = type
STACK = 1k
MALLOC = 0k
include ../app_make.txt

1
28_day/type/make.bat Normal file
View 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
View 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();
}