structure app output
This commit is contained in:
@@ -8,16 +8,25 @@
|
||||
extern "C" void main() {
|
||||
char cmd_buff[100];
|
||||
uint8_t bufferpos = 0;
|
||||
|
||||
uint8_t id = sys_getpid();
|
||||
uint8_t x = 0;
|
||||
|
||||
char text[] = "kappl";
|
||||
write(1, text, sizeof(text), 0, (int)id);
|
||||
|
||||
while(1){
|
||||
char msg[11];
|
||||
int len;
|
||||
len = read(0, msg, 1);
|
||||
if(len){
|
||||
write(0, msg, len);
|
||||
write(0, msg, len, 6+x, id);
|
||||
memcpy(&cmd_buff[bufferpos], msg, len);
|
||||
bufferpos+=len;
|
||||
for(uint8_t i=0; i<len; i++)
|
||||
if(msg[i] == '\n'){
|
||||
x=0;
|
||||
write(0, " ", 52, 6+x, id);
|
||||
bufferpos = 0;
|
||||
if(strncmp(cmd_buff, "kill ", 5) == 0){
|
||||
int pid = cmd_buff[5]-0x30;
|
||||
@@ -32,6 +41,8 @@ extern "C" void main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user