--- pjlsession.cpp.orig Sat Jul 6 18:36:21 2002 +++ pjlsession.cpp Mon Aug 9 11:39:10 2004 @@ -3,7 +3,7 @@ * * $Id: pjlsession.cpp,v 1.7 2002/07/05 16:41:26 fx Exp $ */ -#include +#include #include #include @@ -21,13 +21,14 @@ #include // open(), close(), write() #include #include -#endif UNIX +#endif // UNIX #include "pjlsession.h" #include "pjllists.h" #include "commands.h" +using namespace std; PJLsession::PJLsession() { // nothing so far @@ -69,7 +70,7 @@ if (ts.stoken("@PJL INFO VARIABLES",0)==NULL) { #ifdef _DEBUG cerr << "PJLsession::read_env(): did not receive command echo" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } @@ -167,7 +168,7 @@ if (ts.stoken("@PJL INFO ID",0)==NULL) { #ifdef _DEBUG cerr << "PJLsession::read_devive_id(): did not receive command echo" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } @@ -186,7 +187,7 @@ _snprintf(numb,49,"%u",pass); #else snprintf(numb,49,"%u",pass); -#endif UNIX +#endif // UNIX connection.clear(); connection.sendbuf.set(PJL_START); @@ -206,7 +207,7 @@ if (ts.findstr("@PJL DINQUIRE PASSWORD")==NULL) { #ifdef _DEBUG cerr << "PJLsession::disable_pjl_password(): did not receive command echo" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } @@ -219,7 +220,7 @@ #ifdef _DEBUG cerr << "PJLsession::disable_pjl_password(): DINQUIRE didn't return result" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } @@ -234,7 +235,7 @@ _snprintf(numb,49,"%u",pass); #else snprintf(numb,49,"%u",pass); -#endif UNIX +#endif // UNIX connection.clear(); connection.sendbuf.set(PJL_START); @@ -277,7 +278,7 @@ if (ts.findstr("@PJL DINQUIRE PASSWORD")==NULL) { #ifdef _DEBUG cerr << "PJLsession::chk_pjl_password(): did not receive command echo" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } @@ -290,7 +291,7 @@ #ifdef _DEBUG cerr << "PJLsession::chk_pjl_password(): DINQUIRE didn't return result" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } @@ -353,7 +354,7 @@ if (ts.stoken("@PJL INFO FILESYS",0)==NULL) { #ifdef _DEBUG cerr << "PJLsession::read_volumes(): did not receive command echo" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } @@ -404,14 +405,14 @@ if (ts.stoken("@PJL FSDIRLIST",0)==NULL) { #ifdef _DEBUG cerr << "PJLsession::read_dir(): did not receive command echo" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } if (ts.stoken("\r\n",1)==NULL) { #ifdef _DEBUG cerr << "PJLsession::read_dir(): strange! got echo but no more lines" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } else { String err=ts.stoken("\r\n",1); @@ -419,7 +420,7 @@ if (err.findstr("FILEERROR")!=NULL) { #ifdef _DEBUG cerr << "PJLsession::read_dir(): Filesystem error " << err.token('=',1) << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } } @@ -495,7 +496,7 @@ if (ts.findstr("@PJL FSQUERY")==NULL) { #ifdef _DEBUG cerr << "PJLsession::stat(): did not receive command echo" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } @@ -514,7 +515,7 @@ #ifdef _DEBUG cerr << "PJLsession::stat(): strange answer: '" << ts.get() << "'" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } // failure ... @@ -524,13 +525,13 @@ if (err.findstr("FILEERROR")!=NULL) { #ifdef _DEBUG cerr << "PJLsession::stat(): Filesystem error " << err.token('=',1) << endl; -#endif _DEBUG +#endif // _DEBUG return (-1); } else { #ifdef _DEBUG cerr << "PJLsession::does_exist(): strange answer: '" << ts.get() << "'" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } } @@ -578,7 +579,7 @@ _snprintf(numb,49,"%u",expsize); #else snprintf(numb,49,"%u",expsize); -#endif UNIX +#endif // UNIX filebuffer.clear(); connection.clear(); @@ -602,7 +603,7 @@ if (ts.findstr("@PJL FSUPLOAD")==NULL) { #ifdef _DEBUG cerr << "PJLsession::recv_file(): did not receive command echo" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } if (ts.findstr("SIZE=")==NULL) { @@ -614,13 +615,13 @@ if (ts.findstr("FILEERROR")!=NULL) { #ifdef _DEBUG cerr << "PJLsession::recv_file(): Filesystem error " << ts.token('=',1) << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } else { #ifdef _DEBUG cerr << "PJLsession::recv_file(): strange answer: '" << ts.get() << "'" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExPJLerror(); } } else { @@ -633,7 +634,7 @@ fsi=fsi.token('=',1); #ifdef _DEBUG //cout << "DEBUG: expected size: " << expsize << ", reported: " << atoi(fsi.get()) << endl; -#endif _DEBUG +#endif // _DEBUG // timeout depends on size (of course) ;) connection.recvatleast((unsigned int)atoi(fsi.get()), @@ -658,7 +659,7 @@ if ((fd=open(filename,_O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY))<0) { #ifdef _DEBUG cerr << "PJLsession::recv_file(): Could not open local file "< (\x0c) from device and discard it @@ -771,7 +772,7 @@ _snprintf(numb,49,"%u",filebuffer.length()); #else snprintf(numb,49,"%u",filebuffer.length()); -#endif UNIX +#endif // UNIX connection.clear(); connection.sendbuf.set(PJL_START); @@ -808,7 +809,7 @@ #ifdef _DEBUG cerr << "PJLsession::send_file(2): could not stat file " << filename << endl; -#endif _DEBUG +#endif // _DEBUG throw ExInvalid(); } @@ -817,7 +818,7 @@ #ifdef _DEBUG cerr << "PJLsession::send_file(2) Could not open local file " << filename <0) { @@ -960,7 +961,7 @@ #ifdef _DEBUG cerr << "PJLsession::upload_RFU_firmware() Could not open local file " << rfu_file <0) { @@ -968,10 +969,10 @@ connection.sendbuf.set(rb,br); connection.senddata(); } - std::close(fd); + ::close(fd); } -#endif UNIX +#endif // UNIX connection.clear(); } @@ -1016,7 +1017,7 @@ if ((sttype==0)||(sttype>7)) { #ifdef _DEBUG cerr << "PJLsession::print_selftest(): out of range" << endl; -#endif _DEBUG +#endif // _DEBUG throw ExInvalid(); }