http://blog.csdn.net/lishuhuakai/article/details/11928055
#include <stdio.h> #include <unistd.h> #include <wait.h> #define MAXLINE 80 void setup (char inputBuffer[], char *argv[]) { int i, j; char *p; i = 0; for (p = inputBuffer; ;p++)/*将字符命令一段一段拆分开来,如输入ls -l,则argv[0]= "ls",argv[1]="-l",argv[2]=NULL*/ { argv[i++] = p; while (*p != ' ' && *p != '