コード例 #1
0
ファイル: kernel.c プロジェクト: ankitku/barebones
void kmain( void* mbd, unsigned int magic )
{
   if ( magic != 0x2BADB002 )
   {
      /* Something went not according to specs. Print an error */
      /* msg and halt, but do *not* rely on the multiboot */
      /* data structure. */
   }
   
/* Print a letter to screen to see everything is working: */
   kprint("\a\a\a");
   kclrscr(); /*clearing screen */
   kprint("Hi! \n Ankit is too \t  coooool, YOOOOOOO",12);
}
コード例 #2
0
ファイル: blueshell.c プロジェクト: orionempire/blue-fire-os
/**************************************************************************
* Used for multitasking debugging.
***************************************************************************/
void shell( s32int argc, char **argv){

	// Shell command buffer
	s08int cmd[256];
	s32int i;

	// Reset the command buffer
	memset08(cmd, 0, 256);

	// Command line
	while(TRUE) {
		kprintf(SHELL_PROMPT);

		scanf("%s", cmd);

		for(i = 0; i < SHELL_COMMANDS; i++) {
			// Parse the command
			if ( strncmp(cmd, commands[i].name, strlen(commands[i].name))==0 ) {
				if (*(cmd+strlen(commands[i].name)) == '\0') {
					*CMD_ARG = '\0';
						break;
				}
				if (*(cmd+strlen(commands[i].name)) == ' ') {
					break;
				}
			}
		}

		if (i == SHELL_COMMANDS) {
			// Command not found
			if (cmd[0]) {
				kprintf("\n\r%s: command not found!!!\n\r", cmd);
			}
			continue;
		}

		switch(commands[i].index){
					case SH_HELP:
						kprintf("\nBlueShell version 0.1 - by David Davidson\n");
						for (i = 0; i < SHELL_COMMANDS; i++) {
							kprintf("\n- %s : %s", commands[i].name, commands[i].help);
						}
						kprintf("\n\n");
						break;
					case SH_UNAME:
						kprintf("\n%s - Kernel [v%s]\n", KERNEL_NAME, KERNEL_VERSION);
						break;

					case SH_CLEAR:
						kclrscr();
						break;

					case SH_REBOOT:
						reboot();
						break;

					case SH_READ:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_WRITE:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_PAGES:
						dump_dirty_pages();
						break;

					case SH_MEM:
						dump_memory_map();
						break;

					case SH_CHECKMEM:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_FRAMES:
						dump_free_frames();
						break;

					case SH_EXEC:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_V86EXEC:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_TEST:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_CPUID:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_MOUNT:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_LS:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_CAT:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_CD:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_PS:
						ps();
						break;

					case SH_KILL:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

					case SH_PWD:
						kprintf("%s command not yet Implemented.\n",cmd);
						break;

				}
	}
}