lug-bg: "C" wapros
- Subject: lug-bg: "C" wapros
- From: gf@xxxxxxxxxx (Georgi Chorbadzhiyski)
- Date: Tue, 16 May 2000 19:01:17 +0300
Ako mozhe niakoi po svetnat da pomogne. Imam slednata programa
#
# funkciikata e orezana versia ot pppd
#
int run_program(prog, args, must_exist, done, arg)
char *prog;
char **args;
int must_exist;
void (*done) __P((void *));
void *arg;
{
int pid;
pid = fork();
if (pid == -1) {
log(L_ERR, "Failed to create child process for %s", prog);
return -1;
}
if (pid == 0) {
/* run the program */
execvp(prog, args);
if (must_exist || errno != ENOENT) {
/* have to reopen the log, there's nowhere else
for the message to go. */
log(L_ERR, "Can't execute: %s error: %u", prog, errno);
}
_exit(-1);
}
return pid;
}
wikam si funkciikata taka:
run_program("/usr/local/my_script", exec_buf, 0, NULL, NULL);
/usr/local/my_script sadyrzha:
#!/bin/sh
echo raboti! >> /tmp/proba
Wsichko ok obache, kato go wikna tova run_program i waw log-a
mi pishe:
can't execute: /usr/local/my_script error: 14
kogato skript-a ne e izpalnim msg-to e:
can't execute: /usr/local/my_script error: 13
Kakvo oznachavat tezi i greshki i kakvo sam obyrkal ??
Georgi Chorbadzhiyski
System Administrator
Cybercom Ltd.
==================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
Otpiswaneto RABOTI !!! : Majordomo@xxxxxxxxxxxxxxxxxx UNSUBSCRIBE LUG-BG
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora
|