void kmain( void* mbd, unsigned int magic ) { if ( magic != 0x2BADB002 ) { /* Something went not according to specs. Print an error */ /* message and halt, but do *not* rely on the multiboot */ /* data structure. */ unsigned char *videoram = (unsigned char *) 0xb8000; videoram[0] = 66; /* character 'B' */ videoram[1] = 0x07; /* forground, background color. */ } /* You could either use multiboot.h */ /* (http://www.gnu.org/software/grub/manual/multiboot/multiboot.html#multiboot_002eh) */ /* or do your offsets yourself. The following is merely an example. */ char * boot_loader_name =(char*) ((long*)mbd)[16]; /* Write your kernel here. */ flush_video(' '); push_line(boot_loader_name); push_line("Hello World"); push_line("This is a test"); push_line("This is a test"); push_line("Hello World"); printk("iKern> ", (80 * 24) * 2); printk("iKern> ", (80 * 24) * 2); /* while (1) { change_term_color(0x07); 2 * 4 *2 +4 +2; change_term_color(0x1f); 2 * 4 *2 +4 +2; change_term_color(0x2a); 2 * 4 *2 +4 +2; } while (1) { int j = 0; unsigned char * videoram = (unsigned char *) 0xb8000; unsigned char * ram = (unsigned char *) 0x00000; for (int i = 0; i < (1920 * 2); i += 2) { videoram[i] = ram[j]; videoram[i + 1] = 0x07; j++; } } */ //unsigned char *videoram = (unsigned char *) 0xb8000; //videoram[1920 * 2] = 'A'; }
int termcaps(t_llist *env, t_memory *memo, int len, t_win *win) { struct termios term; int code; init_term(&term, env, win, len); while (win->buffer[0] != RETURN) { ft_bzero(win->buffer, 4); read(0, win->buffer, 4); if (win->buffer[0] == CTRL_D) termcaps_exit("close", &term); if ((ft_isalnum(win->buffer[0])) == 1 || (my_ctrl(win->buffer[0])) == 1) { memo->line = push_line(win->buffer[0], memo->line, win); ft_putchar(win->buffer[0]); } else if ((code = termc_ctrl(memo->line, win, env, memo)) > 0) memo->line = parsing_term(code, memo->line, win); } if (memo->c_t_r + RETURN == TAB + RETURN) tabulation(memo->line, win); bring_back_shell(&term); win->pos[1]++; return (0); }
void break_at(size_t i) { buf.s[i] = '\0'; total.words += buf.wc; total.chars += strlen(buf.s) + 1; total.lines++; push_line(buf.s); }
void count_usb_urbs(void) { DIR *dir; struct dirent *dirent; FILE *file; char filename[PATH_MAX]; char pathname[PATH_MAX]; char buffer[4096]; struct device_data *dev; dir = opendir("/sys/bus/usb/devices"); if (!dir) return; cachunk_urbs(); while ((dirent = readdir(dir))) { if (dirent->d_name[0]=='.') continue; sprintf(pathname, "/sys/bus/usb/devices/%s", dirent->d_name); sprintf(filename, "%s/urbnum", pathname); file = fopen(filename, "r"); if (!file) continue; memset(buffer, 0, 4096); fgets(buffer, 4095, file); update_urbnum(pathname, strtoull(buffer, NULL, 10), dirent->d_name); fclose(file); } closedir(dir); dev = devices; while (dev) { if (dev->urbs != dev->previous_urbs) { push_line(dev->human_name, dev->urbs - dev->previous_urbs); } dev = dev->next; } }