pike.git / lib / modules / Protocols.pmod / LPD.pmod

version» Context lines:

pike.git/lib/modules/Protocols.pmod/LPD.pmod:1:   //   // LPD.pmod: an implementation of the BSD lpd protocol (RFC 1179).   // This is a module for pike.   // 3 July 1998 <hww3@riverweb.com> Bill Welliver   // - // $Id: LPD.pmod,v 1.3 1998/07/03 20:30:19 grubba Exp $ + // $Id: LPD.pmod,v 1.4 1999/08/20 05:01:58 hubbe Exp $   //      class client {    string host;    int port;    object conn;    int jobnum;    string jobtype;    string jobname;   
pike.git/lib/modules/Protocols.pmod/LPD.pmod:66:    if(!queue) return 0;       if(!conn->connect(host, port))    return 0;    werror("connected to " + host + "\n");       conn->write(sprintf("%c%s\n", 02, queue));    // werror("sent send data command\n");    string control="";    control+="H"+gethostname()+"\n"; -  control+="P"+(getpwuid(getuid())[0]||"nobody"); + #if constant(getuid) && constant(getpwuid) +  control+="P"+(getpwuid(getuid())[0]||"nobody")+"\n"; + #else +  /* Should there be a P-1 here? /Hubbe */ + #endif    control+=(jobtype||"l")+"dfA"+ sprintf("%3d%s", jobnum, gethostname())+"\n";    if(jobname)    control+="J" + jobname + "\n";    jobnum++;    conn->write(sprintf("%c%s cfA%3d%s\n", 02, (string)sizeof(control),    jobnum,gethostname()));    // werror("getting ready to send control file\n");       conn->write(sprintf("%s%c", control, 0));    // werror("sent control file\n");
pike.git/lib/modules/Protocols.pmod/LPD.pmod:96:    return 1;    }       string|int delete_job(string queue, int|void job)    {    if(!queue) return 0;       if(!conn->connect(host, port))    return 0;    + #if constant(getpwuid) && constant(getuid)    string agent=(getpwuid(getuid())[0]||"nobody"); -  + #else +  string agent="nobody"; + #endif       if(job)    conn->write(sprintf("%c%s %s %d\n", 05, queue, agent, job));    else    conn->write(sprintf("%c%s %s\n", 05, queue, agent));    string resp= conn->read();    conn->close();    return 1;    }