home *** CD-ROM | disk | FTP | other *** search
-
- #include "RJS/Transport.h"
- #include "LPD.h"
-
- RJS_LPD::RJS_LPD(RJS_String h, RJS_String q)
- {
- host=h;
- queue=q;
- lpd_address.lookup(host,"printer","tcp");
- }
-
- RJS_LPD::set_queue(RJS_String h, RJS_String q)
- {
- host=h;
- queue=q;
- lpd_address.lookup(host,"printer","tcp");
- }
-
- RJS_String RJS_LPD::status(RJS_String user_or_job, int long_flag)
- {
-
- lpd_server.reserved_socket(1023);
- lpd_server.connect(lpd_address);
-
- RJS_String command;
- if (long_flag) command = '\04'; else command = '\03';
-
- command += queue + user_or_job + '\n';
- lpd_server.write(command,command.length());
-
- int nbr;
- RJS_String result;
- char buffer[512];
-
- while(nbr=lpd_server.read(buffer,512)) {
- buffer[nbr]=0;
- result += buffer;
- }
-
- return result;
- }
-
-