[Klone-users] insmod or launching a script on the foxboard
thomas fossati
tho at koanlogic.com
Wed Sep 24 03:36:03 EDT 2008
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.
More information about the klone-users
mailing list