c - The joining operator ";" in my shell isn't working properly -


I have written a simple shell in C, and I ""; The operator is working properly, the user typing command will be 1; Command2 and Shell execute the first command in the command line followed by the second command. However, it seems that, for whatever reason, it is executing only the second order. Why does anyone have an idea?

This special section of my code is:

  four * next = strchr (cmd, ';'); While (next! = Null) {/ * 'next' number ';' * / * Next = '\ 0'; Input = run (CMD, input, first, 0); CMD = next + 1; Next = strchr (CMD, ';'); First = 0; }  

Your code is working for me just to handle the corner case The condition is added. Please check the code below.

  four * next = strchr (cmd, ';'); While (next! = Null) {/ * 'next' number ';' * / * Next = '\ 0'; Input = run (CMD, input, first, 0); Printf ("% s \ n", CMD); CMD = next + 1; Next = strchr (CMD, ';'); If (NULL == Next) {input = run (cmd, input, first, 0); Printf ("% s \ n", CMD); } First = 0; }  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -