[so] tema1 - testul 09

Alexandru Goia webaigoia at gmail.com
Tue Jan 27 00:12:40 EET 2009


Buna ziua,

Am reusit sa trec peste problemele mentionate anterior, totusi acum imi da
eroare testul 9, desi codul care se ocupa de eroare este urmatorul :
Ce pot sa fac ca sa trec cu bine si testul 9 ?

Va multumesc,
Alexandru.

      if (pid == 0)
          {
          if (scmd == NULL || scmd->verb == NULL)
              exit(0);

          if (scmd->params == NULL)
              {
              int tmp = execlp((scmd->verb)->string,
(scmd->verb)->string, (char *) NULL);
              if (tmp < 0)
                  printf("Execution failed for '%s'\n",
(scmd->verb)->string);
              exit(tmp);
              }	
          else
              {
              char *argv[32];
              int i;
              for (i = 0; i < 32; i++)
                  argv[i] = malloc(sizeof(char));
              argv[0] = (scmd->verb)->string;
              i = 1;
              word_t *p = scmd->params;
              while (p != NULL)
                  {
                  if (p->expand == true)
                      p->string = getenv(p->string);
                  argv[i] = p->string;
                  i++;
                  p = p->next_word;
                  }
              argv[i] = (char *) NULL;

              /* execlp((scmd->verb)->string, (scmd->verb)->string,
(scmd->params)->string, (char *) NULL); */
              int tmp = execvp((scmd->verb)->string, argv);
              if (tmp < 0)
                  printf("Execution failed for '%s'\n", (scmd->verb)->string);
              exit(tmp);
              }
          }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cursuri.cs.pub.ro/pipermail/so/attachments/20090127/64366fc5/attachment.html 


More information about the so mailing list