I have succeeded in getting Samba printing working in eCS. Here are the details:
I had concluded that smbprint was the most likely culprit for the failure of printing to work, so I tried to lay my
hands on the source. I found smbprint.cmd and smbprint.vrx at netlabs. smbprint.vrx was useless. Here is smbprint.cmd
/* REXX */
parms = arg(1)
parse var parms '"'spoolfile'" "'printername'" "'Jobname'" "'pages'" "'Jobsize'"'
call beep 880, 100
/* 'D:\TCPIP\BIN\LPR.EXE -s
eps.bfdnet.at -p 'printername' 'spoolfile */
'copy /B 'spoolfile' 'printername
call lineout 'D:\Samba\print.log','spoolfile ='spoolfile
call lineout 'D:\Samba\print.log','printername ='printername
call lineout 'D:\Samba\print.log','Jobname ='Jobname
call lineout 'D:\Samba\print.log','pages ='pages
call lineout 'D:\Samba\print.log','Jobsize ='Jobsize
/* ok = SysFileDelete(SpoolFile) */
This is too short to be the actual source for the smbprint.exe that comes with Samba; nevertheless it provides some clues:
The only really useful information here is the identification and ordering of the parameters, the name of the print log,
and the hint that the only substantive operation to be done is to copy spoolfile to the printer queue..
Here is what I came up with:
/* jjw20141209 - smbprint.cmd replacement for smbprint.exe */
parse arg '"'spoolfile'" "'printername'" "'jobname'" "'pages'" "'jobsize'"'
d=date('S')
call lineout 'G:\Samba\print.log',substr(d,1,4)'/'substr(d,5,2)'/'substr(d,7)'-'time()' 'jobname
rc=stream('G:\Samba\print.log','c','close')
'set beginlibpath=g:\ibmpli\dll;'
'set path=g:\ibmpli\bin;%path%'
'set dpath=g:\ibmpli\msg;%dpath%'
'e:\pli\apps\fil2prt.exe /'printername' <'spoolfile' >>G:\samba\print.log'
call RxFuncAdd 'SysFileDelete', 'RexxUtil', 'SysFileDelete'
rc=SysFileDelete(spoolfile)
This can be further simplified if you are willing to dispense with the print log. I decided to use it for a while until
I am satisfied that the system is stable. At that point out it goes.
It is also necessary to have Samba and the spooler properly configured.
I have samba itself installed in g:\samba. However for each bootable instance samba also keeps certain information on
the boot drive. At the moment, I have only one bootable partition using samba which is my maintenance partition on drive
f. Instance specific information is stored in the tree under %boot%:\MPTN\ETC\samba. In particular, smb.conf is in the
samba directory and Samba sets up its own internal "spooler" in the spool directory under samba with a subdirectory for
each printer object. Do not point the real eCS spooler at this spool directory.
Basically, a printer specific spool file received from another computer is first placed in
%boot%:\MPTN\ETC\samba\spool\printer with a weird name. Then smbprint is called into action and it writes that file to
the real spooler which goes on to send it to the printer. Then smbprint must delete the file received from the other
computer from Samba's internal spooler.
Here are the relevant sections from my smb.conf file (I have flagged the important lines with an * in the left margin):
# Samba config file created using SSCC ver. 1.0.3
# from jjw@JJW3
# Date: 20 Nov 2014 20:25:07
[global]
workgroup = IBMPEERS
null passwords = Yes
passdb backend = tdbsam
guest account = guest
username map = F:\MPTN\ETC\samba\private\smbusermap
log level = 2
log file = F:\MPTN\ETC\samba\log\log.smbd.%U.%M
time server = Yes
load printers = No
* printing = os2
printcap name = G:\etc\printcap
* print command = G:\samba\smbprint.cmd "%s" "%p" "%J" "%c" "%z"
+ lpq command = lpq.exe -s %i -p %p
+ lprm command = lprm.exe -s %i -p %p %j
enumports command = G:\samba\enumports.cmd
add user script = G:\samba\usermod.cmd -a "%u"
rename user script = G:\samba\usermod.cmd -r "%uold" "%unew"
delete user script = G:\samba\usermod.cmd -x "%u"
add group script = G:\samba\groupmod.cmd -a "%g"
delete group script = G:\samba\groupmod.cmd -x "%g"
add user to group script = G:\samba\groupmod.cmd -j "%g" "%u"
delete user from group script = G:\samba\groupmod.cmd -l "%g" "%u"
set primary group script = G:\samba\usermod.cmd -p "%u" "%g"
add machine script = G:\samba\usermod.cmd -a "%u"
lm announce = Yes
wins support = Yes
add share command = G:\samba\addshare.cmd
change share command = G:\samba\changeshare.cmd
delete share command = G:\samba\delshare.cmd
lock directory = F:\MPTN\ETC\samba\lock
create mask = 0777
ea support = Yes
store dos attributes = Yes
[HOMES]
... drive shares
[CP2025PC]
path = F:/MPTN/ETC/samba/spool/CP2025PC
read only = No
create mask = 0700
guest ok = Yes
printable = Yes
printer name = CP2025PC
[CP2025PS]
path = F:/MPTN/ETC/samba/spool/CP2025PS
read only = No
create mask = 0700
guest ok = Yes
printable = Yes
printer name = CP2025PS
Note that the printing, print, lpq, and lprm lines have been deleted from the printer specific sections and a single
copy of each has been placed in the global section. I have no idea whether or not the lpq and lprm lines are actually
needed for anything; the look superfluous to me. Also note that printing=os2 as set up by the warpin installer seems to
work just as well as the printing=bsd setting specified in Herwig Bauernfeind's instructions. If someone knows
otherwise, please speak up.
Finally here is the source for fil2prt. It should be straightforward to transliterate to other languages.
% process mar(2,100),offset,libs(multi); /* fil2prt */
/* jjw20141205 - fil2prt {/}queue <prtfile - copy a printer specific file to a printer queue */
/* (c) 2014 James J. Weinkam */
fil2prt: proc(cmd) options(main noexecops) reorder;
dcl
cmd char(*) var,
(queue,strz based) char(256) varz,
(bp,ib,p3,hs,(rp,si) init(null)) ptr,
(rc,nr,bs,nq,na,sa,i,tw) bin fixed(31),
(dtatyp init('PM_Q_RAW'),cmt init('fil2prt')) char(8) varz,
1 info3 based(p3),
2 pnm ptr,
2 (prty,strt,untl) bin fixed(15),
2 (*,*,*,*,*,dflt,byps,raw,*,*,*,*,*,*,*,*) bit(1),
2 (sep,qprc,qpar,qdsc) ptr,
2 (stat,jobs) bin fixed(15),
2 (ptrs,drvr,drvd) ptr,
1 devopnstr,
2 (loga,dvrnm,drvdta,dtyp,com,qproc,qpparm,qsplp,qnetp) ptr,
((SplEnumQueue entry(char(*) varz byaddr,bin fixed(31),ptr,bin fixed(31),
bin fixed(31) byaddr,bin fixed(31) byaddr,bin fixed(31) byaddr,ptr),
DosRead entry(ptr,ptr,bin fixed(31),bin fixed(31) byaddr),
SplQmStartDoc entry(ptr,char(*) varz byaddr),
SplQmWrite entry(ptr,bin fixed(31),ptr),
(SplQmClose,SplQmEndDoc) entry(ptr)) returns(bin fixed(31) byvalue),
SplQmOpen entry(char(*) varz byaddr,bin fixed(31),* byaddr) returns(ptr byvalue))
external options(byvalue nodescriptor linkage(system)),
sysprint file print,
(addr,allocate,index,length,null,plifree,substr,trim) builtin;
queue=substr(cmd,1+index(cmd,'/'));
if length(queue)=0 then do;
put file(sysprint) edit('Usage: fil2prt {/}queue <prtfile')(col(1),a); goto fini;
end;
rc=splenumqueue('',3,bp,0,nq,na,sa,rp);
if rc~=234&rc~=2123 then do;
put file(sysprint) edit('Invalid error code from SplEnumQueue.')(col(1),a); goto fini;
end;
bs=sa; bp=allocate(bs);
rc=splenumqueue('',3,bp,bs,nq,na,sa,rp); p3=bp;
if rc~=0 then do;
put file(sysprint) edit('Error getting printer object information.')(col(1),a); goto freebp;
end;
work: do i=1 to nq;
if pnm->strz=queue then do;
loga=pnm; dvrnm=drvr; drvdta=drvd; dtyp=addr(dtatyp); com=addr(cmt);
qproc,qpparm,qsplp,qnetp=null;
hs=splqmopen('*',4,devopnstr);
if hs=null then do;
put file(sysprint) edit('Unable to open spool file')(col(1),a); goto freebp;
end;
rc=splqmstartdoc(hs,'prtfile');
ib=allocate(61440); tw=0;
do forever;
rc=dosread(si,ib,61440,nr);
if nr>0 then do; tw+=nr; rc=splqmwrite(hs,nr,ib); end;
if nr<61440 then leave;
end;
put file(sysprint)
edit(vfmt(tw),' bytes written to ',queue,'; job id ',vfmt(splqmenddoc(hs)),'.')
(col(1),6 a);
rc=splqmclose(hs); call plifree(ib); goto freebp;
end;
p3+=44;
end work;
put file(sysprint) edit(queue,' not found.')(col(1),2 a);
freebp: call plifree(bp);
vfmt: proc(i) returns(char(12) var);
dcl i bin fixed(31),c char(12);
put string(c) edit(i)(f(12)); return(trim(c,' '));
end;
fini: end fil2prt;