toaruos/kernel/core/args.c

38 lines
812 B
C
Raw Normal View History

/*
* vim:tabstop=4
* vim:noexpandtab
*
* Kernel Argument Parser
*/
#include <system.h>
void
parse_args(char * arg) {
2011-03-29 05:34:53 +04:00
if (!arg) { return; }
char * pch;
char * cmd;
char * save;
pch = strtok_r(arg," ",&save);
cmd = pch;
if (!cmd) { return; }
char * argv[1024]; /* Command tokens (space-separated elements) */
int tokenid = 0;
while (pch != NULL) {
argv[tokenid] = (char *)pch;
++tokenid;
pch = strtok_r(NULL," ",&save);
}
argv[tokenid] = NULL;
for (int i = 0; i < tokenid; ++i) {
if (!strcmp(argv[i],"vid=qemu")) {
/* QEMU Video Mode, we are free to set things for 1024x768 */
graphics_install_bochs();
bochs_draw_logo("/bs.bmp");
char * welcome = "Welcome to \200\201\202OS!\n";
2011-03-29 01:33:07 +04:00
for (uint16_t i = 0; i < strlen(welcome); ++i) {
bochs_write(welcome[i]);
2011-03-29 01:33:07 +04:00
}
}
}
}