1
0

generic 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/rc
  2. # fn sigexit { rm -f $LPSPOOL/$LPDEST/.$pid.* $LPSPOOL/$LPDEST/$pid.* $LPSPOOL/$LPDEST }
  3. if (! ~ $DEBUG '') flag x +
  4. if (~ $THIS_HOST $DEST_HOST) {
  5. if (! test -d $LPSPOOL/$LPDEST) {
  6. mkdir $LPSPOOL/$LPDEST
  7. chmod 777 $LPSPOOL/$LPDEST >[2]/dev/null
  8. }
  9. }
  10. # Process and enqueue files to be printed
  11. # take arguments as input files
  12. i=0
  13. if (~ $#* 0) *=''
  14. for (j in $*) {
  15. i= `{echo $i + 1|hoc}
  16. # check access to the file so that you know that a failure in the
  17. # processing is a drastic error which will cause an exit from lp.
  18. if (~ $j '' || test -f $j) {
  19. if (~ $THIS_HOST $DEST_HOST) {
  20. echo $LPMACHID $LPUSERID $pid.$i 0 > $LPSPOOL/$LPDEST/.$pid.$i^id
  21. if (~ $j '') @{bind -b $LPLIB/process /bin; $LPPROC} >$LPSPOOL/$LPDEST/.$pid.$i
  22. if not @{bind -b $LPLIB/process /bin; $LPPROC} <$j >$LPSPOOL/$LPDEST/.$pid.$i
  23. if (~ $status '') {
  24. mv $LPSPOOL/$LPDEST/.$pid.$i $LPSPOOL/$LPDEST/$pid.$i
  25. mv $LPSPOOL/$LPDEST/.$pid.$i^id $LPSPOOL/$LPDEST/$pid.$i^id
  26. }
  27. if not {
  28. rval='preprocessing failed'
  29. rm -f $LPSPOOL/$LPDEST/.$pid.$i $LPSPOOL/queue/$LPDEST/.$pid.$i^id
  30. exit $rval
  31. }
  32. }
  33. if not {
  34. switch ($j) {
  35. case ''; @{ {echo -d^$LPDEST -pnoproc -M^$LPMACHID -u^$LPUSERID; bind -b $LPLIB/process /bin; $LPPROC} | lpsend.rc $DEST_HOST}
  36. case *; @{ {echo -d^$LPDEST -pnoproc -M^$LPMACHID -u^$LPUSERID; bind -b $LPLIB/process /bin; $LPPROC} < $j | lpsend.rc $DEST_HOST}
  37. }
  38. rval=$status
  39. }
  40. }
  41. if not {
  42. echo $j cannot be opened >[1=2]
  43. }
  44. }