#include <errno.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
pid_t
spawn(const char *file, char *const argv[])
{
pid_t pid;
int forkpipe[2];
int fd_flags, err, ret;
// set up a pipe for communication between forks
ret = pipe(forkpipe);
if (ret == -1)
return -1;
pid = fork();
if (pid == -1) {
err = errno;
// close the write pipe
close(forkpipe[1]);
goto parent_exit;
}
if (pid == 0) {
// forked child
// close the read pipe
ret = close(forkpipe[0]);
if (ret == -1)
goto child_err;
// make the write end close-on-exec
ret = fcntl(forkpipe[1], F_GETFD);
if (ret == -1)
goto child_err;
fd_flags = ret | FD_CLOEXEC;
ret = fcntl(forkpipe[1], F_SETFD, fd_flags);
if (ret == -1)
goto child_err;
// try to run the app
execvp(file, argv);
// if we continue executing here, an error occurred
child_err:
// send the error code through the write pipe
err = errno;
write(forkpipe[1], &err, sizeof(err));
exit(1);
}
// parent
// close the write pipe
close(forkpipe[1]);
// get the error code from the read pipe
ret = read(forkpipe[0], &err, sizeof(err));
if (ret == -1) {
err = errno;
pid = -1;
} else if (ret == sizeof(err))
pid = -1;
else
err = 0;
parent_exit:
// close the read pipe
close(forkpipe[0]);
if (err)
errno = err;
return pid;
}
/* Son of Suckerfish Dropdowns. JS needed only for
Internet Explorer. Documented here:
http://www.htmldog.com/articles/suckerfish/dropdowns/*/
sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
/* Create an array of all <select> tags on the page (could be limited to
those within an element with a specific id -- see line above. */
var selects = document.getElementsByTagName("select");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
for (var n=0; n<selects.length; n++) {
/* Hides <select> tags, which appear above menu in IE */
selects[n].className+=" hide_select";
}
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
for (var n=0; n<selects.length; n++) {
/* Makes <select> tags visible again */
selects[n].className = selects[n].className.replace(new RegExp(" hide_select\\b"), "");
}
}
}
}
/*
* NOTE: In order for this snippet to work, you need to add the
* following lines (or something similar) to your CSS:
*
* select.hide_select {
* visibility: hidden;
* }
*
* Using "display: none" may cause other elements to shift as the is
* completely removed from the flow of the document. By using
* "visibility: hidden", the just becomes "invisible."
*/
$selsearch = '
SELECT
Uni,Prof,Bearbeiter,Jahr,Semester,ID,Thema,status
FROM
Habilitation
WHERE 1 ';
if ( strlen($_GET["uni"])>0 ) { $selsearch .= ' AND Uni LIKE "'.$_GET["uni"].'%" '; }
if ( strlen($_GET["jahr"])>0 ) { $selsearch .= ' AND jahr LIKE "'.$_GET["jahr"].'%" '; }
if ( strlen($_GET["thema"])>0 ) { $selsearch .= ' AND Thema LIKE "%'.$_GET["thema"].'%" '; }
$selsearch .= ' ORDER BY '.$o.' LIMIT '.$posSelect.','.$perpage;
Function eregi(ByVal str, ByVal patrn,ByVal rpl)
'EJ, para sacar tags eregi(texto,"<([^>]+)>","")
'Ej, para sacar los links eregi(texto,"<a([^>]+)>|</a>","")
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
StrReplace = regEx.Replace(str,rpl)
eregi = StrReplace
End function