int main (int argc, char **argv){ if (debug) printf("------------ Starting %s --------------\n",argv[0]); configuration *conf = (configuration *)malloc(sizeof(configuration)); int pipe1fd[2]; int pipe2fd[2]; // Handle options optionsHandler(argc,argv,conf); if (debug) printf("Opciones: numeroDeHijos: %d\t Orden: %d\t Archivo de salida: %s",conf->numberOfChilds, conf->order, conf->outputFile); // Create 1st pipe Pipe(pipe1fd); if (debug) puts("Pipe 1 creado"); // Create 2nd pipe Pipe(pipe2fd); if (debug) puts("Pipe 2 creado"); // Fork childWork(conf, pipe1fd, pipe2fd); //Father dadWork(conf, pipe1fd, pipe2fd); return 0; }
main(int argc, char *argv[]) { ValidRunCmd(argc, argv); ValidRepeatedArgs(argc, argv); ValidArgs(argc, argv); FixEqualsArgs(argc, argv); switch (optionsHandler(argc, argv)) { case 1: CodeCount(argv, 1); break; //Comment e Silent (Conta também as linhas de comentário e grava em arquivo). case 2: CodeCount(argv, 2); break; //Comment (Conta também as linhas de comentário). case 3: CodeCount(argv, 3); break; //Silent (grava em arquivo com modo padrão). default: CodeCount(argv, 0); //Modo padrão. } }