mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-02-03 18:13:28 +08:00
type命令改良
This commit is contained in:
@@ -480,7 +480,7 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
|
||||
}
|
||||
}
|
||||
cursor_y = cons_newline(cursor_y, sheet);
|
||||
} else if (cmdline[0] == 't' && cmdline[1] == 'y' && cmdline[2] == 'p' && cmdline[3] == 'e' && cmdline[4] == ' ') {
|
||||
} else if (strncmp(cmdline, "type ", 5) == 0 ) {
|
||||
/* type命令*/
|
||||
/*准备文件名*/
|
||||
for (y = 0; y < 11; y++) {
|
||||
@@ -524,11 +524,30 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
|
||||
/*逐字输出*/
|
||||
s[0] = p[x];
|
||||
s[1] = 0;
|
||||
putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF,COL8_000000, s, 1);
|
||||
cursor_x += 8;
|
||||
if (cursor_x == 8 + 240) { /*到达最右端后换行*/
|
||||
if (s[0] == 0x09) { /*制表符*/
|
||||
for (;;) {
|
||||
putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, " ", 1);
|
||||
cursor_x += 8;
|
||||
if (cursor_x == 8 + 240) {
|
||||
cursor_x = 8;
|
||||
cursor_y = cons_newline(cursor_y, sheet);
|
||||
}
|
||||
if (((cursor_x - 8) & 0x1f) == 0) {
|
||||
break; /*被32整除则break */
|
||||
}
|
||||
}
|
||||
} else if (s[0] == 0x0a) { /*换行*/
|
||||
cursor_x = 8;
|
||||
cursor_y = cons_newline(cursor_y, sheet);
|
||||
} else if (s[0] == 0x0d) { /*回车*/
|
||||
/*这里暂且不进行任何操作*/
|
||||
} else { /*一般字符*/
|
||||
putfonts8_asc_sht(sheet, cursor_x, cursor_y, COL8_FFFFFF, COL8_000000, s, 1);
|
||||
cursor_x += 8;
|
||||
if (cursor_x == 8 + 240) {
|
||||
cursor_x = 8;
|
||||
cursor_y = cons_newline(cursor_y, sheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user