🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Crear un front end

#9061
From: Toni Martir
Date: Thu, 05 Sep 2002 18:04
91 lines
3200 bytes
Hola,

Debes hacer un fork, pero antes debes redirigir la salida estandar del
quemador a una pipe() de tu aplicaci�n, puedes generar un hilo de ejecuci�n
que vaya leyendo de la pipe para que tu aplicaci�n est� siempre 'activa'.

Parece que tengo un cacho de c�digo por aqu�:

Extra�do de http://reportman.sourceforge.net unidad rpqtdriver.pas

Claro que si es en C++ pues a traducir que es f�cil

Tienes otro ejemplo  que utiliza pipes en
http://sourceforge.net/projects/ibaccess descargandolo via cvs, busca la
unidad ibman.pas, que recoge la salida de los comandos gbak,gfix etc de
Interbase/Firebird


uses
  Libc,

...
...
var
 abuffer:array [0..L_tmpnam] of char;
 theparams:array [0..20] of pchar;
 params:array[0..20] of string;
 paramcount:integer;
 afilename:string;
 child:__pid_t;
 i:integer;

   tmpnam(abuffer);
   afilename:=StrPas(abuffer);
   report.Metafile.SaveToFile(afilename);
   params[0]:='metaprint';
   params[1]:='-d';
   params[2]:='-copies';
   params[3]:=IntToStr(copies);
   params[4]:='-p';
   params[5]:=IntToStr(integer(report.PrinterSelect));
   paramcount:=6;
   if collate then
   begin
    params[paramcount]:='-collate';
    inc(paramcount);
   end;
   if not allpages then
   begin
    params[paramcount]:='-from';
    inc(paramcount);
    params[paramcount]:=IntToStr(frompage);
    inc(paramcount);
    params[paramcount]:='-to';
    inc(paramcount);
    params[paramcount]:=IntToStr(topage);
    inc(paramcount);
   end;
   if not progress then
   begin
    params[paramcount]:='-q';
    inc(paramcount);
   end;
   params[paramcount]:=afilename;
   inc(paramcount);

   for i:=0 to paramcount-1 do
   begin
    theparams[i]:=Pchar(params[i]);
   end;
   theparams[paramcount]:=nil;

   child:=fork;
   if child=-1 then
    Raise Exception.Create(SRpErrorFork);
   if child<>0 then
   begin
    if (-1=execv(theparams[0],PPChar(@theparams))) then
    begin
     try
      RaiseLastOsError;
     except
      on E:Exception do
      begin
       E.Message:=SRpErrorFork+':execv:'+IntToStr(errno)+'-'+E.Message;
       Raise;
      end;
     end;
    end;
   end
 end;
Technical Details
Message-ID: <al8638$1nqv4k$1@ID-145327.news.dfncis.de>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!fu-berlin.de!uni-berlin.de!17.red-80-32-237.pooles.rima-tde.NET!not-for-mail
References: <slrnanem2k.2cl.xsidius@dhp.net.dhis.org>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,1a30c76a9b730c28
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-09-05 11:00:10 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!fu-berlin.de!uni-berlin.de!17.red-80-32-237.pooles.rima-tde.NET!not-for-mail
From: "Toni Martir" <toniNOSPAM@pala.com>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Crear un front end
Date: Thu, 5 Sep 2002 20:04:07 +0200
Lines: 94
Message-ID: <al8638$1nqv4k$1@ID-145327.news.dfncis.de>
References: <slrnanem2k.2cl.xsidius@dhp.net.dhis.org>
NNTP-Posting-Host: 17.red-80-32-237.pooles.rima-tde.net (80.32.237.17)
X-Trace: fu-berlin.de 1031248808 58555540 80.32.237.17 (16 [145327])
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000