lol, me neither...
It seems I didn't post it in the forums, I only sent it by mail to the original author (who never answered, and I lost the mail I sent :s)
What I could find is this though :
http://www.amsn-project.net/forums/viewtopic.php?p=19370#19370so the code looks like this :
/* Test if the device is not locked by another process. This is
* just a crude workaround to avoid complete lockup of snack. It is
* not perfect since it is theoretically possible that another program
* locks the device between the close() and open() calls below. */
A->afd = open(device, O_WRONLY|O_NONBLOCK);
if(A->afd == -1) {
Tcl_AppendResult(interp, "Could not gain access to ", device, " for writing.",NULL);
return TCL_ERROR;
}
close(A->afd);
A->mode = mode;
switch (mode) {
case RECORD:
if ((A->afd = open(device, O_RDONLY, 0)) == -1) {
Tcl_AppendResult(interp, "Could not open ", device, " for read.",
NULL);
return TCL_ERROR;
}
break;
And if we make it into this :
/* Test if the device is not locked by another process. This is
* just a crude workaround to avoid complete lockup of snack. It is
* not perfect since it is theoretically possible that another program
* locks the device between the close() and open() calls below. */
if (mode == RECORD) {
A->afd = open(device, O_RDONLY|O_NONBLOCK);
} else {
A->afd = open(device, O_WRONLY|O_NONBLOCK);
}
if(A->afd == -1) {
Tcl_AppendResult(interp, "Could not gain access to ", device, " for writing.",NULL);
return TCL_ERROR;
}
close(A->afd);
A->mode = mode;
switch (mode) {
case RECORD:
if ((A->afd = open(device, O_RDONLY, 0)) == -1) {
Tcl_AppendResult(interp, "Could not open ", device, " for read.",
NULL);
return TCL_ERROR;
}
break;
It should work...
Note that I didn't test this code, so if it doesn't compile or doesn't work, try to fix it the best you can.