Copyright 2006-2008 <a href=\\"mailto:brisk@alternativeoutput.it\\">Matteo Nastasi</a> (aka mop)<br><br>';
+function csplitter($in, $sep)
+{
+ $st = 0;
+ $id = 0;
+ $out = array();
+
+ for ($i = 0 ; $i < strlen($in) ; $i++) {
+ if ($st == 0) {
+ if ($in{$i} == '\\')
+ $st = 1;
+ else if ($in{$i} == $sep) {
+ $id++;
+ }
+ else {
+ $out[$id] .= $in{$i};
+ }
+ }
+ else if ($st == 1) {
+ $out[$id] .= $in{$i};
+ $st = 0;
+ }
+ }
+
+ return ($out);
+}
+
+
function xcape($s)
{
$from = array ( '\\', '@', '|' );
return (FALSE);
}
if (sem_acquire($res)) {
- log_lock("LOCK room");
+ log_lock("LOCK warrant");
return ($res);
}
else
{
GLOBAL $sess;
- log_lock("UNLOCK room");
+ log_lock("UNLOCK warrant");
return (sem_release($res));
}
+}
+class Poll {
+ function lock_data()
+ {
+ GLOBAL $sess;
+
+ if (($tok = @ftok(FTOK_PATH."/poll", "B")) == -1) {
+ return (FALSE);
+ }
+ // echo "FTOK ".$tok."<br>";
+ if (($res = sem_get($tok)) == FALSE) {
+ return (FALSE);
+ }
+ if (sem_acquire($res)) {
+ log_lock("LOCK poll");
+ return ($res);
+ }
+ else
+ return (FALSE);
+ }
+ function unlock_data($res)
+ {
+ GLOBAL $sess;
+
+ log_lock("UNLOCK poll");
+
+ return (sem_release($res));
+ }
}
+
?>