[so] Re: valgrind

Lucian Adrian Grijincu lucian.grijincu at gmail.com
Thu Nov 1 12:10:44 EET 2007


nu ai vrea sa il simplifici complet, inclusiv sa scoti comentariile inutile?

On 11/1/07, Andrei Ciuca <andrei.ciuca at gmail.com> wrote:
> revin cu "ramasitele" codului care INCA mai dau outputul de mai sus (ma
> gandesc ca asa se va crea o imagine mai clara) :
>
> int main()
> {
>
>     do
>     {
>         cout << "\n> ";
>         string line;
>         getline(cin, line);
>
>         command_t* root = NULL;
>         if (parse_line(line.c_str(), &root))
>         {
>             if (root != NULL)
>             {
>                  pid_t new_pid;
>                 int pipeDescriptors[2];
>                 pipe(pipeDescriptors);
>                 //root->aux = pipeDescriptors+1;
>                 //cout << getpid() << endl;
>
>                 /*switch (new_pid = fork())
>                 {
>                     case -1: //fork failed
>                             exit(-1);
>                     case 0://copilul
>                             close(pipeDescriptors[0]);
>                             //cout << getpid() << endl;
>                             execute_command(root);
>                             exit(-1);
>                     default:
>                     {*/
>                             int status,response;
>                             close(pipeDescriptors[1]);
>
>                             //do
>                             //{
>                             //    response = wait(&status);
>
>                                 //dupa ce se termina fiecare proces verific
> daca a trimis o comanda interna pe pipe
>                                 //apelez cu forwardingPipeDesc = 0 deoarece
> sunt in procesul primar
>                                 //si nu mai trimit nicaieri mai sus comanda
>
> //processInternalCommandsFromPipe(pipeDescriptors[0],0);
>                             //}
>                             //while (response != -1);
>                             //dupa ce am citit datele trimise de procesul
> copil, nu mai am nevoie de capatul de citire si il inchid
>                             close(pipeDescriptors[0]);
>
>                             free_parse_memory();
>                             close(pipeDescriptors[0]);
>                             exit(0);
>                     /*}
>
>                 }*/
>
>             }
>         }
>
>         free_parse_memory();
>     }
>     while (1);
>
>     return EXIT_SUCCESS;
> }
>
>
> _______________________________________________
> so mailing list
> so at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
>
>


-- 
Lucian


More information about the so mailing list