/** * Executes the issued command */ void console_exec(char *buf) { if(strncmp(buf, "cd", 2) == 0) { console_cd(dir, buf); } else if(strncmp(buf, "start", 5) == 0) { console_start(dir, buf); } else if(strncmp(buf, "read", 4) == 0) { console_read(dir, buf); } else if(strncmp(buf, "write", 5) == 0) { console_write(dir, buf); } else if(strncmp(buf, "touch", 5) == 0) { console_touch(dir, buf); } else if(strncmp(buf, "delete", 6) == 0) { console_delete(dir, buf); } else if(strcmp(buf, "hoho") == 0) { printk("hoho\n"); } else if(strcmp(buf, "help") == 0) { printk("Help:\nhoho - prints hoho\nhelp - shows help\nmeminfo - prints RAM info\ncpuinfo - shows CPU info\nls - shows filesystem devices\nread - reads a file\nstart - starts a program\nclear - clears the screen\nhalt - shuts down\nreboot - reboots the pc\n"); } else if(strcmp(buf, "meminfo") == 0) { print_meminfo(); } else if(strcmp(buf, "cpuinfo") == 0) { printk("%s\n", get_cpu_vendor(0)); } else if(strcmp(buf, "ls") == 0) { if(dir[0] == 0) { vfs_ls(); } else { vfs_ls_dir(dir); } } else if(strcmp(buf, "clear") == 0) { clear(); } else if(strcmp(buf, "proc") == 0) { print_procs(); } else if(strcmp(buf, "halt") == 0) { printk("Shutting down\n"); halt(); while(1); } else if(strcmp(buf, "reboot") == 0) { printk("Rebooting\n"); reboot(); } else { printk("Command not found\n"); } }
// ------------------------------------------------------------------- main --- int main( int argc, char **argv ) { GLFWwindow* window; char* screenshot_path = NULL; if (argc > 1) { if (argc == 3 && 0 == strcmp( "--screenshot", argv[1] )) screenshot_path = argv[2]; else { fprintf( stderr, "Unknown or incomplete parameters given\n" ); exit( EXIT_FAILURE ); } } glfwSetErrorCallback( error_callback ); if (!glfwInit( )) { exit( EXIT_FAILURE ); } glfwWindowHint( GLFW_VISIBLE, GL_FALSE ); glfwWindowHint( GLFW_RESIZABLE, GL_FALSE ); window = glfwCreateWindow( 600,400, argv[0], NULL, NULL ); if (!window) { glfwTerminate( ); exit( EXIT_FAILURE ); } glfwMakeContextCurrent( window ); glfwSwapInterval( 1 ); glfwSetFramebufferSizeCallback( window, reshape ); glfwSetWindowRefreshCallback( window, display ); glfwSetKeyCallback( window, keyboard ); glfwSetCharCallback( window, char_input ); #ifndef __APPLE__ glewExperimental = GL_TRUE; GLenum err = glewInit(); if (GLEW_OK != err) { /* Problem: glewInit failed, something is seriously wrong. */ fprintf( stderr, "Error: %s\n", glewGetErrorString(err) ); exit( EXIT_FAILURE ); } fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) ); #endif init(); glfwShowWindow( window ); reshape( window, 600,400 ); while (!glfwWindowShouldClose( window )) { display( window ); glfwPollEvents( ); if (screenshot_path) { screenshot( window, screenshot_path ); glfwSetWindowShouldClose( window, 1 ); } } console_delete( console ); glfwDestroyWindow( window ); glfwTerminate( ); return EXIT_SUCCESS; }