ok but please add these:
1) an error message if the user didn't invoke the file correctly
2) a check to see if the setrfkill have not failed
if((fd=fopen(path,"rw"))==NULL) return -1;
fputc(argv[2][0],fd);
kill_status=fgetc(fd);
if (argv[2][0]!=kill_status) return -1;
fclose(fd);
g_free(path);
wouldn't it be better if instead of returning immediately error, we first try to set the values to all cards? this if the first card fails, but the second is ok, we don't prevent the second setting to be applied!
This could be done adding a flag error_occurred...
----- Messaggio originale -----
Da: dragoran
<drago01 gmail com>
A: yelo_3 <yelo_3 yahoo it>
Cc: Dan Williams <dcbw redhat com>; network manager <networkmanager-list gnome org>; David Zeuthen <davidz redhat com>; Bastien Nocera <bnocera redhat com>
Inviato: Lunedì 25 giugno 2007, 19:14:24
Oggetto: Re: ipw srcipts for hal
On 6/25/07, yelo_3 <yelo_3 yahoo it> wrote:
I've removed some code duplication...
And in my opinion the script should return On if it founds at least one card on, and not as dan said, off if it finds at least one card off..
It is just an opinion...
Because one card on is enough to say that you have wireless on
What do you think?
this won't work with the new .fdi file (the ipw card is no longer a parent of the killswitch).
and you also don't check for cards but for interfaces on one card.