void consume(pipid32 pip) { char msg[4]; int read = 0; int i; int len = 4; while(1) { for(i = 0; i < 6; i++){ read = pipread(pip, msg, len); if(read == 0) continue; //kprintf("read:%d\n\r",read); int j; for(j=0; j < read;j++){ kprintf("%c",msg[j]); // kprintf("\n\r"); } kprintf("\n\r"); } suspend(getpid()); } }
void shellconsume(void) { uint32 i,j; for(i = 0; i < 2048; i++) { for(j = 0; j <5; j++) { cstring[i][j] = ' '; } } for(j = 0; j < 2048; j++) { pipread(shell_pipid_test, cstring[j], 5, j*5); sleepms(100); if (cstring[j][0] == 'A') { vacount ++; } if (cstring[j][0] == 'E') { vecount ++; } if (cstring[j][0] == 'I') { vicount ++; } if (cstring[j][0] == 'O') { vocount ++; } if (cstring[j][0] == 'U') { vucount ++; } } }