[Klone-users] insmod or launching a script on the foxboard
smlabs
smlabs at libero.it
Wed Sep 24 07:39:30 EDT 2008
thanks thomas. I'll try.
In your opinion to launch a bash script is better system or exec or
shell_exec?
regards
thomas fossati ha scritto:
> Hi,
>
> On Sep 24, 2008, at 7:45 AM, smlabs wrote:
>> In particular I downloaded the project klapp-minimal-lib-1.1.0/
>> (from klone wiki) and I added in my.c the following functions:
>> /void functionBlue(void)
>> {
>> system("cd /mnt/flash/");
>> system("./cdBluez-start");
>> return;
>> }
>
> It'd be better to call system(3) once with the full path of the
> script, also check the return status of the syscall:
>
> int rc;
> switch ((rc = system("/mnt/flash/cdBluez-start")))
> {
> case -1:
> warn("waitpid or fork failure: %s", strerror(errno));
> break;
> case 0: /* this should be ok */
> break;
> case 127:
> warn("shell execution failed");
> break;
> default:
> warn("cdBluez-start returned with status %d", rc);
> break;
> }
>
> Otherwise, since system(3) spawns a different shell each time it is
> invoked, the first "cd /mnt/flash" is lost when the "./cdBluez-start"
> is called.
>
>> The compiling process doesn't give any errors.
>> But when I launch kloned from the konsole on my foxboard I received:
>> /[root at axis /mnt/flash]706# ./kloned
>> ./kloned: 1: Syntax error: "(" unexpected
>
> the unexpected "(" is an error message coming from the bourne shell,
> it depends on your script.
>
> Hope it helps, t.
>
>
> _______________________________________________
> Klone-users mailing list
> Klone-users at koanlogic.com
> http://koanlogic.com/cgi-bin/mailman/listinfo/klone-users
>
More information about the klone-users
mailing list