[so] tema 1 so - simple_command_t->params - pointer neintializat ?

Drutu Bogdan bogdandrutu at gmail.com
Mon Apr 12 18:55:03 EEST 2010


case OP_NONE:
//caz comanda simpla
if (!int_comand(root->scmd,&status,name)) {
if (root->scmd->params == NULL )
printf("A mers root->scmd->params\n");
 ........

bogdan at bogdan-desktop:~/Documents/3/SO/1/SOFINAL/lin/parser$ ./mini-shell
> ls
A mers root->scmd->params
makefile    mini-shell.c   mini-shell.o  parser.l      parser.tab.h
 parser.y  parser.yy.o  README~
mini-shell  mini-shell.c~  parser.h parser.tab.c  parser.tab.o  parser.yy.c
 README       SO1lin.zip


2010/4/10 Liviu Esanu <liviu_esanu at yahoo.com>

> Cum vezi daca o comanda are sau nu parametri ? Fara sa iti crape dc se
> poate ?
>
>
>
> --- On *Sat, 4/10/10, Liviu Esanu <liviu_esanu at yahoo.com>* wrote:
>
>
> From: Liviu Esanu <liviu_esanu at yahoo.com>
> Subject: Re: [so] tema 1 so - simple_command_t->params - pointer
> neintializat ?
>
> To: "Sisteme de Operare" <so at cursuri.cs.pub.ro>
> Date: Saturday, April 10, 2010, 12:34 AM
>
>
> Va merge apelul root->scmd->params != NULL fara crash ?
> A mai intalnit cineva problema aceasta ?
>
>
>
> --- On *Thu, 4/8/10, Liviu Esanu <liviu_esanu at yahoo.com>* wrote:
>
>
> From: Liviu Esanu <liviu_esanu at yahoo.com>
> Subject: [so] tema 1 so - simple_command_t->params - pointer neintializat ?
> To: "Sisteme de Operare" <so at cursuri.cs.pub.ro>
> Date: Thursday, April 8, 2010, 5:40 PM
>
>  Dupa apelul parse_line(line.c_str() , &root) - in fisierul
> DisplayStructur.cpp
> in cazul cand root->op == OP_NONE
> daca fac testul if( root->scmd->params != NULL) imi zice Segmentation fault
> pentru comenzi fara parametri.
>
> Deci pentru comanda ls imi da segmentation fault cand vreaus a verific daca
> are aprametri ;
> Iar petnru comanda ls -a nu da eroare si vede ca are un aprametru (-a).
>
> Presupun ca parserul uita sa initializeze la NULL membrii structurii
> simple_command_t cand o instantiaza , iar ->params ramane neinitializat cand
> se parseaza o comanda fara parametri.
>
> In cazul acesta , cum verific daca o comanda parsata are parametri ?
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> so mailing list
> so at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
>
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> so mailing list
> so at cursuri.cs.pub.ro <http://mc/compose?to=so@cursuri.cs.pub.ro>
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
>
>
>
> _______________________________________________
> so mailing list
> so at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
>
>


-- 
Bogdan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/lurker/list/so.html/attachments/20100412/f8abcde0/attachment.htm>


More information about the so mailing list