Windows �ޥ����Υץ��ͭ���뤿��ˤϰʲ��κ�Ȥ�ɬ�פǤ���
/etc/printcap
������������ȥ꤬ɬ�פǡ������ϥ�����
��ʥǥ��쥯�ȥ깽¤�˽स����ΤǤ���ɬ�פ�����ޤ��ʥ��ס���ǥ��쥯
�ȥ������ʤɡˡ�
/usr/bin/smbprint
������ץȤ�ɬ�פǤ�������� Samba ��
�������ѥå��������դ��Ƥ��ޤ�����Samba �ΥХ��ʥ����ۥѥå������ˤ���
���Ƥ��ʤ����⤷��ޤ���ǥ��ꥸ�ʥ������������Τ�ܤ��ޤ���
nenscript
�ʤɤ� Postscript ����С������������ɬ�פ�����ޤ���
nenscript
���̾�� /usr/bin
�˥��ȡ��뤵��Ƥ��ޤ���
�ʲ��˵����Τϡ�Windows NT �ץ����³���줿 HP 5MP �ץ������
���뤿��� /etc/printcap
�ؤΥ���ȥ�Ǥ������줾������Ƥϰ�
�����̤�Ǥ���
������
���Ϥ˻Ȥ��ǥХ���̾
���Υץ�Τ���Υ��ס���ǥ��쥯�ȥ�
��������ȥե�����
����Υե����륵������0 �ˤ����̵���¤ˤʤ�ޤ���
���Ϥ��Ѥ�����ե��륿�ʤޤ��ϥ�����ץȡ�
����˾���ɬ�פʤ顢Printing HOWTO �� printcap
�� man �ڡ�����
���Ʋ�������
# /etc/printcap # # //zimmerman/oreilly via smbprint # lp:\ :cm=HP 5MP Postscript OReilly on zimmerman:\ :lp=/dev/lp1:\ :sd=/var/spool/lpd/lp:\ :af=/var/spool/lpd/lp/acct:\ :mx#0:\ :if=/usr/bin/smbprint:
���ס���ǥ��쥯�ȥ�ȥ�������ȥե����뤬¸�ߤ��Ƥ��ꡢ���߲�ǽ��
���뤳�Ȥ��ǧ���Ƥ����Ʋ��������ޤ� printcap
�� if
�Ԥˡ���
���˵��� smbprint
������ץȤؤ��������ѥ������ꤵ��Ƥ��뤳�ȡ�
lp
�Ԥ� /dev
�ǥ��쥯�ȥ�ˤ����������ǥХ��������ꤵ��
�Ƥ��뤳�Ȥ��ǧ���Ʋ�������
���� smbprint
�Ǥ���������̾� /usr/bin
���֤���Ƥ��ꡢ
Samba ���ä� Andrew Tridgell �ܿͤˤ�äƽ줿��ΤǤ���ɮ�Ԥ���
��ʤ� Samba �ζ���Ԥ�¾�ˤ���ä���ä��餹�ߤޤ���ˡ������ Samba
�Υ������ѥå����������äƤ��ޤ������Х��ʥ����ۤξ��ˤ�̵�������Τ�
�ޤ���Τǡ��ʲ��˻䤬�������ä�����Τ��Ƥ����ޤ���
�ʲ��˵�����������ץȤ����տ������Ʋ�����������ϥ��ꥸ�ʥ�������� ��Τǡ�¿���Ȥ��䤹���ʤäƤ���Ȼפ��ޤ���
#!/bin/sh -x # This script is an input filter for printcap printing on a unix machine. It # uses the smbclient program to print the file to the specified smb-based # server and service. # For example you could have a printcap entry like this # # smb:lp=/dev/null:sd=/usr/spool/smb:sh:if=/usr/local/samba/smbprint # # which would create a unix printer called "smb" that will print via this # script. You will need to create the spool directory /usr/spool/smb with # appropriate permissions and ownerships for your system. # Set these to the server and service you wish to print to # In this example I have a WfWg PC called "lapland" that has a printer # exported called "printer" with no password. # # Script further altered by hamiltom@ecnz.co.nz (Michael Hamilton) # so that the server, service, and password can be read from # a /usr/var/spool/lpd/PRINTNAME/.config file. # # In order for this to work the /etc/printcap entry must include an # accounting file (af=...): # # cdcolour:\ # :cm=CD IBM Colorjet on 6th:\ # :sd=/var/spool/lpd/cdcolour:\ # :af=/var/spool/lpd/cdcolour/acct:\ # :if=/usr/local/etc/smbprint:\ # :mx=0:\ # :lp=/dev/null: # # The /usr/var/spool/lpd/PRINTNAME/.config file should contain: # server=PC_SERVER # service=PR_SHARENAME # password="password" # # E.g. # server=PAULS_PC # service=CJET_371 # password="" # # Debugging log file, change to /dev/null if you like. # logfile=/tmp/smb-print.log # logfile=/dev/null # # The last parameter to the filter is the accounting file name. # spool_dir=/var/spool/lpd/lp config_file=$spool_dir/.config # Should read the following variables set in the config file: # server # service # password # user eval `cat $config_file` # # Some debugging help, change the >> to > if you want to same space. # echo "server $server, service $service" >> $logfile ( # NOTE You may wish to add the line `echo translate' if you want automatic # CR/LF translation when printing. echo translate echo "print -" cat ) | /usr/bin/smbclient "\\\\$server\\$service" $password -U $user -N -P >> $log file
�ۤȤ�ɤ� Linux �ѥå������ˤϡ�ASCII ʸ��� Postscript �ˤ���
nenscript
���ޥ�ɤ��ޤޤ�Ƥ��ޤ����ʲ��� perl ������ץȤϡ�
smbprint
��Ȥäư�������ݤˡ���ꥷ��ץ�ʥ����ե���������
�������ΤǤ���
Usage: print [-a|c|p] <filename> -a prints <filename> as ASCII -c prints <filename> formatted as source code -p prints <filename> as Postscript If no switch is given, print attempts to guess the file type and print appropriately.
smbprint
��Ȥä� ASCII �ե�������������ȡ�Ĺ���Ԥϲ��Ԥ����
���ޤ��ޤ������Υ�����ץȤǤϡ���ǽ�ʸ¤�ñ�������ǤϤʤ�������Dz�
�Ԥ���褦�ˤ��Ƥ��ޤ���
�����������ɤΥե����ޥåȤˤ� nenscript
���Ѥ��Ƥ��ޤ���ASCII �ե�
����� 2 ���Ȥߤ��������졢�إå������ա��ե�����̾�ʤɡˤ��Ĥ��ޤ���
���Υ�����ץȤ�����ˤ��ơ�¾��������ˡ���Ѥ��뤳�Ȥ�Ǥ���Ǥ��礦��
Postscript ��ʸ��Ϥ��Ǥ���������Ƥ����ΤȤߤʤ��ơ����Τޤ��̤��� ���ˤʤäƤ��ޤ���
#!/usr/bin/perl # Script: print # Authors: Brad Marshall, David Wood # Plugged In Communications # Date: 960808 # # Script to print to oreilly which is currently on zimmerman # Purpose: Takes files of various types as arguments and # processes them appropriately for piping to a Samba print script. # # Currently supported file types: # # ASCII - ensures that lines longer than $line_length characters wrap on # whitespace. # Postscript - Takes no action. # Code - Formats in Postscript (using nenscript) to display # properly (landscape, font, etc). # # Set the maximum allowable length for each line of ASCII text. $line_length = 76; # Set the path and name of the Samba print script $print_prog = "/usr/bin/smbprint"; # Set the path and name to nenscript (the ASCII-->Postscript converter) $nenscript = "/usr/bin/nenscript"; unless ( -f $print_prog ) { die "Can't find $print_prog!"; } unless ( -f $nenscript ) { die "Can't find $nenscript!"; } &ParseCmdLine(@ARGV); # DBG print "filetype is $filetype\n"; if ($filetype eq "ASCII") { &wrap($line_length); } elsif ($filetype eq "code") { &codeformat; } elsif ($filetype eq "ps") { &createarray; } else { print "Sorry..no known file type.\n"; exit 0; } # Pipe the array to smbprint open(PRINTER, "|$print_prog") || die "Can't open $print_prog: $!\n"; foreach $line (@newlines) { print PRINTER $line; } # Send an extra linefeed in case a file has an incomplete last line. print PRINTER "\n"; close(PRINTER); print "Completed\n"; exit 0; # --------------------------------------------------- # # Everything below here is a subroutine # # --------------------------------------------------- # sub ParseCmdLine { # Parses the command line, finding out what file type the file is # Gets $arg and $file to be the arguments (if the exists) # and the filename if ($#_ < 0) { &usage; } # DBG # foreach $element (@_) { # print "*$element* \n"; # } $arg = shift(@_); if ($arg =~ /\-./) { $cmd = $arg; # DBG # print "\$cmd found.\n"; $file = shift(@_); } else { $file = $arg; } # Defining the file type unless ($cmd) { # We have no arguments if ($file =~ /\.ps$/) { $filetype = "ps"; } elsif ($file =~ /\.java$|\.c$|\.h$|\.pl$|\.sh$|\.csh$|\.m4$|\.inc$|\.html$|\.htm$/) { $filetype = "code"; } else { $filetype = "ASCII"; } # Process $file for what type is it and return $filetype } else { # We have what type it is in $arg if ($cmd =~ /^-p$/) { $filetype = "ps"; } elsif ($cmd =~ /^-c$/) { $filetype = "code"; } elsif ($cmd =~ /^-a$/) { $filetype = "ASCII" } } } sub usage { print " Usage: print [-a|c|p] <filename> -a prints <filename> as ASCII -c prints <filename> formatted as source code -p prints <filename> as Postscript If no switch is given, print attempts to guess the file type and print appropriately.\n "; exit(0); } sub wrap { # Create an array of file lines, where each line is < the # number of characters specified, and wrapped only on whitespace # Get the number of characters to limit the line to. $limit = pop(@_); # DBG #print "Entering subroutine wrap\n"; #print "The line length limit is $limit\n"; # Read in the file, parse and put into an array. open(FILE, "<$file") || die "Can't open $file: $!\n"; while(<FILE>) { $line = $_; # DBG #print "The line is:\n$line\n"; # Wrap the line if it is over the limit. while ( length($line) > $limit ) { # DBG #print "Wrapping..."; # Get the first $limit +1 characters. $part = substr($line,0,$limit +1); # DBG #print "The partial line is:\n$part\n"; # Check to see if the last character is a space. $last_char = substr($part,-1, 1); if ( " " eq $last_char ) { # If it is, print the rest. # DBG #print "The last character was a space\n"; substr($line,0,$limit + 1) = ""; substr($part,-1,1) = ""; push(@newlines,"$part\n"); } else { # If it is not, find the last space in the # sub-line and print up to there. # DBG #print "The last character was not a space\n"; # Remove the character past $limit substr($part,-1,1) = ""; # Reverse the line to make it easy to find # the last space. $revpart = reverse($part); $index = index($revpart," "); if ( $index > 0 ) { substr($line,0,$limit-$index) = ""; push(@newlines,substr($part,0,$limit-$index) . "\n"); } else { # There was no space in the line, so # print it up to $limit. substr($line,0,$limit) = ""; push(@newlines,substr($part,0,$limit) . "\n"); } } } push(@newlines,$line); } close(FILE); } sub codeformat { # Call subroutine wrap then filter through nenscript &wrap($line_length); # Pipe the results through nenscript to create a Postscript # file that adheres to some decent format for printing # source code (landscape, Courier font, line numbers). # Print this to a temporary file first. $tmpfile = "/tmp/nenscript$$"; open(FILE, "|$nenscript -2G -i$file -N -p$tmpfile -r") || die "Can't open nenscript: $!\n"; foreach $line (@newlines) { print FILE $line; } close(FILE); # Read the temporary file back into an array so it can be # passed to the Samba print script. @newlines = (""); open(FILE, "<$tmpfile") || die "Can't open $file: $!\n"; while(<FILE>) { push(@newlines,$_); } close(FILE); system("rm $tmpfile"); } sub createarray { # Create the array for postscript open(FILE, "<$file") || die "Can't open $file: $!\n"; while(<FILE>) { push(@newlines,$_); } close(FILE); }
===����===
nenscrpt
�����ܸ���̤��ޤ���JE �ˤ� psconv
�Ȥ������ܸ�
���б��������ޥ�ɤ����äƤ��ޤ���¾�ˤ� a2ps
��ps2ascii
��
ps2txt
��toPS
�ʤ��͡��ʤ�Τ��ͥåȥ�����������ǽ�Ǥ���
�ʤ������ԤϤ��ξϤΥ�����ץȤ�ƥ��ȤǤ���Ķ�������ޤ���Τǡ���ʸ �ˤ��ä�������ץȤΤޤܤ��Ƥ����ޤ�������¤�������ܸ���̤����� �������������ϡ���Ϣ��������й����Ǥ���
==������==