🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #1522

Re: Dennis y Brian... "El Lenguaje de Programaci�n C"

#1522
From: slinux
Date: Fri, 14 Oct 2005 17:04
36 lines
1980 bytes
siguiendo con la shell...como puedo lanzar procesos en segundo plano ('&') y  utilizar varios comandos en una l�nea (';')


#include <stdio.h
#include <stdlib.h
#include <string.h
#include <sys/types.h
#include <unistd.h
#include <sys/wait.h

int main()
{
char linea[34421];
while (fgets(linea�34421�stdin)) {
pid_t pid;
if (pid=fork()) { if (pid0) wait(0); }
else {
char *palabras[17210]�*s=linea; int i=0;
while (palabras[i++]=strtok(s� � \t\n")) { s=0; }
execvp(palabras[0]� palabras); exit(1);
}
}
return 0;
}

gracias


-- 
slinux 

------------------------------------------------------------------------
Ver este tema: http://www.softwaremix.net/viewtopic-438960.html

Enviado desde http://www.softwaremix.net
Technical Details
Message-ID: <slinux.1wwrey@no-mx.softwaremix.net>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.ya.com!news.ya.com.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,240d712b4795d16c
X-Google-Attributes: gidf86c8,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.ya.com!news.ya.com.POSTED!not-for-mail
NNTP-Posting-Date: Fri, 14 Oct 2005 15:03:50 -0500
From: slinux <slinux.1wwrey@no-mx.softwaremix.net>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Dennis y Brian... "El Lenguaje de Programaci�n C"
Date: Fri, 14 Oct 2005 19:04:54 +0200
Message-ID: <slinux.1wwrey@no-mx.softwaremix.net>
Organization: Softwaremix.net
User-Agent: Punbb USENET gateway
X-Newsreader: Punbb USENET gateway
X-Originating-IP: 80.224.176.74<dhr14m$t5v$1@cormoran.emeteo.local>
Lines: 2
NNTP-Posting-Host: 70.85.210.130
X-Trace: sv3-xSB1Qb2xzh99k1dnvJHuUK159iASSyT4MU29DXAzqiqo2p0iiewt3NZw434qXsRblhuwD6xzReIyk+C!vxoH3YCbny6SzhbWV0NOQDxr1jnGcw/1pSWcSYyPO2a2EypYMXNAwm3zFOpN0CAzIAhSOw==
X-Complaints-To: abuse@ya.com
X-DMCA-Complaints-To: abuse@ya.com
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.32