Add pft 1.2,
libPJL- Printer Job Language library A library and a command-line tool to use PJL- HP Printer Job Language PR: ports/69382 Submitted by: Yonatan <Yonatan@xpert.com>
This commit is contained in:
parent
4699f7ca4c
commit
fa85fdb34b
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=115718
@ -313,6 +313,7 @@
|
||||
SUBDIR += pear-Crypt_CBC
|
||||
SUBDIR += pear-Text_Password
|
||||
SUBDIR += pf
|
||||
SUBDIR += pft
|
||||
SUBDIR += pgp
|
||||
SUBDIR += pgp6
|
||||
SUBDIR += pgpdump
|
||||
|
29
security/pft/Makefile
Normal file
29
security/pft/Makefile
Normal file
@ -0,0 +1,29 @@
|
||||
# Ports collection makefile for: pft
|
||||
# Date created: 21 July 2004
|
||||
# Whom: Yonatan <Yonatan@xpert.com>
|
||||
#
|
||||
# $FreeBSD$
|
||||
#
|
||||
|
||||
PORTNAME= pft
|
||||
PORTVERSION= 1.2
|
||||
CATEGORIES= security
|
||||
MASTER_SITES= http://www.phenoelit.de/hp/
|
||||
DISTNAME= libPJL-${PORTVERSION}-src
|
||||
EXTRACT_SUFX= .tgz
|
||||
|
||||
MAINTAINER= Yonatan@xpert.com
|
||||
COMMENT= Printer Job Language library and tool
|
||||
|
||||
NO_WRKSUBDIR= yes
|
||||
ALL_TARGET= libPJL.a
|
||||
USE_GMAKE= yes
|
||||
|
||||
post-build:
|
||||
@cd ${WRKSRC}/pft; ${GMAKE} pft
|
||||
|
||||
do-install:
|
||||
${INSTALL_PROGRAM} ${WRKSRC}/pft/pft ${PREFIX}/bin/
|
||||
${INSTALL_DATA} ${WRKSRC}/libPJL.a ${PREFIX}/lib/
|
||||
|
||||
.include <bsd.port.mk>
|
2
security/pft/distinfo
Normal file
2
security/pft/distinfo
Normal file
@ -0,0 +1,2 @@
|
||||
MD5 (libPJL-1.2-src.tgz) = 51aba61d1cbfde5c31278bfb41bafdbb
|
||||
SIZE (libPJL-1.2-src.tgz) = 73194
|
11
security/pft/files/patch-Makefile
Normal file
11
security/pft/files/patch-Makefile
Normal file
@ -0,0 +1,11 @@
|
||||
--- Makefile.orig Wed Jan 30 14:47:32 2002
|
||||
+++ Makefile Thu Aug 5 19:29:52 2004
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
#
|
||||
|
||||
-CPPFLAGS= -Wall -g -DUNIX -D_DEBUG
|
||||
+CPPFLAGS= -Wall -g -DUNIX -D_DEBUG ${CXXFLAGS}
|
||||
AR=ar rcs
|
||||
RM=rm -f
|
||||
|
8
security/pft/files/patch-commands.h
Normal file
8
security/pft/files/patch-commands.h
Normal file
@ -0,0 +1,8 @@
|
||||
--- commands.h.orig Thu Aug 5 13:31:46 2004
|
||||
+++ commands.h Thu Aug 5 13:31:54 2004
|
||||
@@ -31,4 +31,4 @@
|
||||
#define PJLFS_FILE 1
|
||||
|
||||
|
||||
-#endif __COMMANDS_H__
|
||||
+#endif // __COMMANDS_H__
|
8
security/pft/files/patch-exceptions.h
Normal file
8
security/pft/files/patch-exceptions.h
Normal file
@ -0,0 +1,8 @@
|
||||
--- exceptions.h.orig Thu Aug 5 13:32:19 2004
|
||||
+++ exceptions.h Thu Aug 5 13:32:30 2004
|
||||
@@ -16,4 +16,4 @@
|
||||
class ExInvalid{};
|
||||
};
|
||||
|
||||
-#endif __EXCPETIONS_H__
|
||||
+#endif // __EXCPETIONS_H__
|
45
security/pft/files/patch-fxstrings.cpp
Normal file
45
security/pft/files/patch-fxstrings.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
--- fxstrings.cpp.orig Sat Jul 6 18:36:20 2002
|
||||
+++ fxstrings.cpp Thu Aug 5 15:17:58 2004
|
||||
@@ -3,12 +3,14 @@
|
||||
* $Id: fxstrings.cpp,v 1.3 2002/01/19 19:23:50 fx Exp $
|
||||
*/
|
||||
|
||||
-#include <iostream.h>
|
||||
+#include <iostream>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "fxstrings.h"
|
||||
|
||||
+using namespace std;
|
||||
+
|
||||
/* Initializes the protected variables */
|
||||
String::String(void) {
|
||||
str=NULL;
|
||||
@@ -58,7 +60,7 @@
|
||||
if ((str=(char*)malloc(strlen(s)+1))==NULL) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "String::set(): malloc failed\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExMalloc();
|
||||
}
|
||||
memset(str,0,strlen(s)+1);
|
||||
@@ -79,7 +81,7 @@
|
||||
if ((p=(char *)malloc(length+1))==NULL) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "String::set(char,len): malloc failed\n" << endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExMalloc();
|
||||
}
|
||||
|
||||
@@ -93,7 +95,7 @@
|
||||
if ((str=(char*)malloc(strlen(p)+1))==NULL) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "String::set(char,len): malloc failed\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExMalloc();
|
||||
}
|
||||
memset(str,0,strlen(p)+1);
|
8
security/pft/files/patch-fxstrings.h
Normal file
8
security/pft/files/patch-fxstrings.h
Normal file
@ -0,0 +1,8 @@
|
||||
--- fxstrings.h.orig Thu Aug 5 13:34:15 2004
|
||||
+++ fxstrings.h Thu Aug 5 13:34:26 2004
|
||||
@@ -64,4 +64,4 @@
|
||||
};
|
||||
|
||||
|
||||
-#endif __FXSTRINGS_H__
|
||||
+#endif // __FXSTRINGS_H__
|
17
security/pft/files/patch-llist.cpp
Normal file
17
security/pft/files/patch-llist.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
--- llist.cpp.orig Sat Jul 6 18:36:20 2002
|
||||
+++ llist.cpp Thu Aug 5 15:22:51 2004
|
||||
@@ -4,11 +4,13 @@
|
||||
* $Id: llist.cpp,v 1.2 2002/01/07 17:18:49 fx Exp $
|
||||
*/
|
||||
|
||||
-#include <iostream.h>
|
||||
+#include <iostream>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "llist.h"
|
||||
+
|
||||
+using namespace std;
|
||||
|
||||
LinkList::LinkList() {
|
||||
anchor=current=NULL;
|
8
security/pft/files/patch-llist.h
Normal file
8
security/pft/files/patch-llist.h
Normal file
@ -0,0 +1,8 @@
|
||||
--- llist.h.orig Thu Aug 5 13:37:24 2004
|
||||
+++ llist.h Thu Aug 5 13:37:32 2004
|
||||
@@ -88,4 +88,4 @@
|
||||
};
|
||||
|
||||
|
||||
-#endif __LLIST_H__
|
||||
+#endif // __LLIST_H__
|
9
security/pft/files/patch-pft:Makefile
Normal file
9
security/pft/files/patch-pft:Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
--- pft/Makefile.orig Mon Jan 7 17:15:36 2002
|
||||
+++ pft/Makefile Thu Aug 5 19:31:12 2004
|
||||
@@ -1,5 +1,5 @@
|
||||
CPP=g++
|
||||
-CPPFLAGS= -Wall -g -DUNIX -L../ -I../
|
||||
+CPPFLAGS= -Wall -g -DUNIX -L../ -I../ ${CXXFLAGS}
|
||||
DEBUGGING= -D_DEBUG
|
||||
AR=ar rcs
|
||||
RM=rm -f
|
127
security/pft/files/patch-pft:main.cpp
Normal file
127
security/pft/files/patch-pft:main.cpp
Normal file
@ -0,0 +1,127 @@
|
||||
--- pft/main.cpp.orig Sat Jul 6 18:36:30 2002
|
||||
+++ pft/main.cpp Thu Aug 5 19:33:12 2004
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
* $Id: main.cpp,v 1.8 2002/07/06 15:36:29 fx Exp fx $
|
||||
*/
|
||||
-#include <iostream.h>
|
||||
+#include <iostream>
|
||||
#include <stdio.h> // cant live without printf() ;)
|
||||
|
||||
#ifndef UNIX
|
||||
@@ -27,12 +27,15 @@
|
||||
#include <sys/types.h> // open(), close(), write()
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
-#endif UNIX
|
||||
+#include <string.h> // memset()
|
||||
+#endif // UNIX
|
||||
|
||||
#include "fxstrings.h"
|
||||
#include "pjlsession.h"
|
||||
#include "commands.h"
|
||||
|
||||
+using namespace std;
|
||||
+
|
||||
#define SPLASH "PFT - PJL file transfer\n" \
|
||||
"\tFX of Phenoelit <fx@phenoelit.de>\n"\
|
||||
"\tVersion 0.7 ($Revision: 1.8 $)\n"
|
||||
@@ -89,7 +92,7 @@
|
||||
void commandline_ident(void);
|
||||
#ifdef UNIX
|
||||
void sighandl(int s);
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
|
||||
class Program_config {
|
||||
@@ -102,7 +105,7 @@
|
||||
bool pause;
|
||||
#ifdef UNIX
|
||||
bool ctrlc;
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
};
|
||||
|
||||
Program_config cfg;
|
||||
@@ -122,7 +125,7 @@
|
||||
}
|
||||
#else
|
||||
cfg.lpwd=_getcwd(NULL,0);
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
if (argc>3) {
|
||||
usage(argv[0]);
|
||||
@@ -148,7 +151,7 @@
|
||||
void sighandl(int s) {
|
||||
cfg.ctrlc=true;
|
||||
}
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
void cmdloop(void) {
|
||||
String cmd;
|
||||
@@ -209,7 +212,7 @@
|
||||
#ifdef UNIX
|
||||
// endable default handler for ctrl-c during connect() call
|
||||
signal(SIGINT,SIG_DFL);
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
|
||||
if (sess.connected()) {
|
||||
@@ -238,7 +241,7 @@
|
||||
}
|
||||
#ifdef UNIX
|
||||
signal(SIGINT,&sighandl);
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
}
|
||||
|
||||
// close connection
|
||||
@@ -486,7 +489,7 @@
|
||||
if (_kbhit()) break;
|
||||
#else
|
||||
if (cfg.ctrlc) break;
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
if (++di==dx) {
|
||||
cout << "try " << p << endl;
|
||||
@@ -523,7 +526,7 @@
|
||||
if (_kbhit()) break;
|
||||
#else
|
||||
if (cfg.ctrlc) break;
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
}
|
||||
|
||||
// env invalid
|
||||
@@ -826,7 +829,7 @@
|
||||
} else {
|
||||
cerr << "lcd failed" << endl;
|
||||
}
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
}
|
||||
// get command
|
||||
else if (basecmd==CMD_GET) {
|
||||
@@ -949,7 +952,7 @@
|
||||
cout << sess.filebuffer.length()
|
||||
<< " bytes read from local file " << cmd.token(' ',1)<< endl;
|
||||
}
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
try {
|
||||
sess.append_file(targ.get());
|
||||
@@ -1193,7 +1196,7 @@
|
||||
#ifdef UNIX
|
||||
// endable default handler for ctrl-c during connect() call
|
||||
signal(SIGINT,SIG_DFL);
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
try {
|
||||
sess.initiate(cfg.server.get(),cfg.port);
|
15
security/pft/files/patch-pjllists.cpp
Normal file
15
security/pft/files/patch-pjllists.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
--- pjllists.cpp.orig Thu Aug 5 15:21:00 2004
|
||||
+++ pjllists.cpp Thu Aug 5 15:21:15 2004
|
||||
@@ -2,9 +2,11 @@
|
||||
*
|
||||
* $Id: pjllists.cpp,v 1.3 2002/07/05 16:41:26 fx Exp $
|
||||
*/
|
||||
-#include <iostream.h>
|
||||
+#include <iostream>
|
||||
|
||||
#include "pjllists.h"
|
||||
+
|
||||
+using namespace std;
|
||||
|
||||
/* **************************
|
||||
* PJLenv
|
8
security/pft/files/patch-pjllists.h
Normal file
8
security/pft/files/patch-pjllists.h
Normal file
@ -0,0 +1,8 @@
|
||||
--- pjllists.h.orig Thu Aug 5 13:38:09 2004
|
||||
+++ pjllists.h Thu Aug 5 13:38:19 2004
|
||||
@@ -152,4 +152,4 @@
|
||||
};
|
||||
|
||||
|
||||
-#endif __PJLLISTS_H__
|
||||
+#endif // __PJLLISTS_H__
|
412
security/pft/files/patch-pjlsession.cpp
Normal file
412
security/pft/files/patch-pjlsession.cpp
Normal file
@ -0,0 +1,412 @@
|
||||
--- 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 <iostream.h>
|
||||
+#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -21,13 +21,14 @@
|
||||
#include <sys/types.h> // open(), close(), write()
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
-#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 "<<filename<<endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
}
|
||||
#else
|
||||
@@ -666,10 +667,10 @@
|
||||
if ((fd=open(filename,O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP))<0) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "PJLsession::recv_file(): Could not open local file "<<filename<<endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
}
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
connection.clear();
|
||||
connection.sendbuf.set(PJL_START);
|
||||
@@ -692,7 +693,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) {
|
||||
@@ -704,13 +705,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 {
|
||||
@@ -723,7 +724,7 @@
|
||||
fsi=fsi.token('=',1);
|
||||
#ifdef _DEBUG
|
||||
//cout << "DEBUG: expected size: " << expsize << ", reported: " << atoi(fsi.get()) << endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
|
||||
|
||||
for (unsigned int i=0;i<expsize;i++) {
|
||||
@@ -735,7 +736,7 @@
|
||||
if ((bw=_write(fd,connection.recvbuf.get(),connection.recvbuf.length()))<0) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "PJLsession::recv_file(): _write() to local file failed" << endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
}
|
||||
} catch (TCPcon::ExTimeout) {
|
||||
@@ -746,14 +747,14 @@
|
||||
if ((bw=write(fd,connection.recvbuf.get(),connection.recvbuf.length()))<0) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "PJLsession::recv_file(): _write() to local file failed" << endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
}
|
||||
} catch (TCPcon::ExTimeout) {
|
||||
- std::close(fd);
|
||||
+ ::close(fd);
|
||||
}
|
||||
}
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
connection.recvbuf.clear();
|
||||
// recv the final <FF> (\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 <<endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
} else {
|
||||
_snprintf(numb,49,"%u",statbuf.st_size);
|
||||
@@ -854,11 +855,11 @@
|
||||
int fd,br=0;
|
||||
char rb[1025];
|
||||
|
||||
- if (std::stat(filename,&statbuf)!=0) {
|
||||
+ if (::stat(filename,&statbuf)!=0) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "PJLsession::send_file(2): could not stat file "
|
||||
<< filename << endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
}
|
||||
|
||||
@@ -866,10 +867,10 @@
|
||||
#ifdef _DEBUG
|
||||
cerr << "PJLsession::send_file(2) Could not open local file "
|
||||
<< filename <<endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
} else {
|
||||
- snprintf(numb,49,"%lu",statbuf.st_size);
|
||||
+ snprintf(numb,49,"%lu",(long int)statbuf.st_size);
|
||||
connection.clear();
|
||||
connection.sendbuf.set(PJL_START);
|
||||
connection.sendbuf.append(PJL_FSDOWNLOAD);
|
||||
@@ -885,12 +886,12 @@
|
||||
connection.sendbuf.set(rb,br);
|
||||
connection.senddata();
|
||||
}
|
||||
- std::close(fd);
|
||||
+ ::close(fd);
|
||||
}
|
||||
connection.clear();
|
||||
}
|
||||
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
|
||||
void PJLsession::append_file(char *str) {
|
||||
@@ -900,7 +901,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);
|
||||
@@ -942,7 +943,7 @@
|
||||
#ifdef _DEBUG
|
||||
cerr << "PJLsession::upload_RFU_firmware() Could not open local file "
|
||||
<< rfu_file <<endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
} else {
|
||||
while ((br=_read(fd,rb,1024))>0) {
|
||||
@@ -960,7 +961,7 @@
|
||||
#ifdef _DEBUG
|
||||
cerr << "PJLsession::upload_RFU_firmware() Could not open local file "
|
||||
<< rfu_file <<endl;
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
} else {
|
||||
while ((br=read(fd,rb,1024))>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();
|
||||
}
|
||||
|
21
security/pft/files/patch-pjlsession.h
Normal file
21
security/pft/files/patch-pjlsession.h
Normal file
@ -0,0 +1,21 @@
|
||||
--- pjlsession.h.orig Sat Jul 6 18:36:21 2002
|
||||
+++ pjlsession.h Thu Aug 5 15:25:00 2004
|
||||
@@ -70,10 +70,10 @@
|
||||
|
||||
// reads the volume information from device
|
||||
void read_volumes(void);
|
||||
- // reads an directory into the dir list
|
||||
+ /* reads an directory into the dir list
|
||||
// this method expects an absolute directory
|
||||
// path like 0:\webserver\
|
||||
- // it also updates pwd (which can be see by get_pwd()
|
||||
+ // it also updates pwd (which can be see by get_pwd() */
|
||||
void read_dir(char *str);
|
||||
// returns the existence of a file or directory (return
|
||||
// type is one of PJLFS_* or -1 for not found
|
||||
@@ -133,4 +133,4 @@
|
||||
};
|
||||
|
||||
|
||||
-#endif __PJLSESSION_H__
|
||||
+#endif // __PJLSESSION_H__
|
27
security/pft/files/patch-rawmem.cpp
Normal file
27
security/pft/files/patch-rawmem.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
--- rawmem.cpp.orig Sat Jul 6 18:36:21 2002
|
||||
+++ rawmem.cpp Thu Aug 5 18:53:38 2004
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* $Id: rawmem.cpp,v 1.2 2002/01/07 17:18:49 fx Exp $
|
||||
*/
|
||||
-#include <iostream.h>
|
||||
+#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -10,10 +10,14 @@
|
||||
#ifndef UNIX
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
#include "rawmem.h"
|
||||
+
|
||||
+using namespace std;
|
||||
|
||||
Rawmem::Rawmem() {
|
||||
mem=NULL;
|
8
security/pft/files/patch-rawmem.h
Normal file
8
security/pft/files/patch-rawmem.h
Normal file
@ -0,0 +1,8 @@
|
||||
--- rawmem.h.orig Thu Aug 5 13:40:01 2004
|
||||
+++ rawmem.h Thu Aug 5 13:40:10 2004
|
||||
@@ -52,4 +52,4 @@
|
||||
|
||||
};
|
||||
|
||||
-#endif __RAWMEM_H__
|
||||
+#endif // __RAWMEM_H__
|
158
security/pft/files/patch-tcpcon.cpp
Normal file
158
security/pft/files/patch-tcpcon.cpp
Normal file
@ -0,0 +1,158 @@
|
||||
--- tcpcon.cpp.orig Sat Jul 6 18:36:21 2002
|
||||
+++ tcpcon.cpp Thu Aug 5 18:54:27 2004
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* $Id: tcpcon.cpp,v 1.2 2002/01/07 17:18:49 fx Exp $
|
||||
*/
|
||||
-#include <iostream.h>
|
||||
+#include <iostream>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -17,15 +17,17 @@
|
||||
// defined on Windows but not on UNIX
|
||||
#define INVALID_SOCKET (-1)
|
||||
#define SOCKET_ERROR (-1)
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
#include "tcpcon.h"
|
||||
|
||||
+using namespace std;
|
||||
+
|
||||
TCPcon::TCPcon() {
|
||||
#ifndef UNIX
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
// initialize values
|
||||
memset(&dest,0,sizeof(dest));
|
||||
@@ -40,10 +42,10 @@
|
||||
if (WSAStartup(wVersionRequested, &wsaData)!=0) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::TCPcon() starting WSA failed\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExWinSock();
|
||||
}
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +53,7 @@
|
||||
if (connected) closeconnection();
|
||||
#ifndef UNIX
|
||||
WSACleanup();
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +63,7 @@
|
||||
if ((he=gethostbyname(host))==NULL) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::set_host(): gethostbyname() failed\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExResolver();
|
||||
}
|
||||
|
||||
@@ -75,7 +77,7 @@
|
||||
if ((port<=0)||(port>65535)) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::set_port(): port out of range\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
}
|
||||
dest.sin_port=htons(port);
|
||||
@@ -92,21 +94,21 @@
|
||||
if ( ntohs(*((unsigned short *)(&(dest.sin_port))))==0 ) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::startconnection(): port not set\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
}
|
||||
|
||||
if ((sfd=socket(AF_INET,SOCK_STREAM,0))==INVALID_SOCKET) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::startconnection(): socket() failed\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExSocket();
|
||||
}
|
||||
|
||||
if (connect(sfd,(struct sockaddr *)&dest,sizeof(dest))!=0) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::startconnection(): connect() failed\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExSocket();
|
||||
}
|
||||
|
||||
@@ -120,7 +122,7 @@
|
||||
closesocket(sfd);
|
||||
#else
|
||||
close(sfd);
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
}
|
||||
connected=false;
|
||||
}
|
||||
@@ -152,14 +154,14 @@
|
||||
if (sendbuf.length()==0) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::send(): send buffer empty\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExInvalid();
|
||||
}
|
||||
|
||||
if (send(sfd,(char *)sendbuf.get(),sendbuf.length(),0)==SOCKET_ERROR) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::send(): send() failed\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExSocket();
|
||||
}
|
||||
}
|
||||
@@ -173,7 +175,7 @@
|
||||
if ((tp=(char *)malloc(TPSIZE))==NULL) {
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::recvdata(): malloc() failed\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
throw ExMalloc();
|
||||
}
|
||||
|
||||
@@ -240,7 +242,7 @@
|
||||
throw ExTimeout();
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::recvuntilchr(): timed out\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +265,7 @@
|
||||
throw ExTimeout();
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::recvuntilstr(): timed out\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +288,7 @@
|
||||
throw ExTimeout();
|
||||
#ifdef _DEBUG
|
||||
cerr << "TCPcon::recvatleast(): timed out\n";
|
||||
-#endif _DEBUG
|
||||
+#endif // _DEBUG
|
||||
}
|
||||
}
|
||||
|
17
security/pft/files/patch-tcpcon.h
Normal file
17
security/pft/files/patch-tcpcon.h
Normal file
@ -0,0 +1,17 @@
|
||||
--- tcpcon.h.orig Thu Aug 5 13:40:47 2004
|
||||
+++ tcpcon.h Thu Aug 5 13:40:58 2004
|
||||
@@ -9,7 +9,7 @@
|
||||
#else
|
||||
#include <netinet/in.h>
|
||||
#include <sys/time.h>
|
||||
-#endif UNIX
|
||||
+#endif // UNIX
|
||||
|
||||
#include "rawmem.h"
|
||||
#include "exceptions.h"
|
||||
@@ -101,4 +101,4 @@
|
||||
bool connected;
|
||||
};
|
||||
|
||||
-#endif __TCPCON_H__
|
||||
+#endif // __TCPCON_H__
|
6
security/pft/pkg-descr
Normal file
6
security/pft/pkg-descr
Normal file
@ -0,0 +1,6 @@
|
||||
libPJL- Printer Job Language library
|
||||
A library and a command-line tool to use PJL- HP Printer Job Language
|
||||
|
||||
Author: FX <fx@phenoelit.de>
|
||||
|
||||
WWW: http://www.phenoelit.de/hp/
|
2
security/pft/pkg-plist
Normal file
2
security/pft/pkg-plist
Normal file
@ -0,0 +1,2 @@
|
||||
bin/pft
|
||||
lib/libPJL.a
|
Loading…
Reference in New Issue
Block a user