  SMB HOWTO
  David Wood, dwood@plugged.net.au 
  v1.0, 10 August 1996
  ͺ nakano@apm.seikei.ac.jp 
  v1.0j1, 24 September 1996 

   SMB HOWTO Ǥʸ Linux  Session Message Block (SMB)
  ץȥ򰷤ˡˤĤƽҤ٤ΤǤSMB ץȥϡ NetBIOS
  ץȥ롢LanManager ץȥȤƤФƤޤ
  ______________________________________________________________________

  Table of Contents:

  1.      Ϥ

  2.      ¾ξ

  3.      󥹥ȡ

  4.      ǡư

  5.      /etc/smb.conf 

  6.      Linux Υɥ饤֤ Windows ޥ󤫤鶦ͭ

  7.      Windows Υɥ饤֤ Linux ޥǶͭ

  8.      Linux ޥΥץ󥿤 Windows ޥ󤫤Ѥ

  9.      Linux ޥ󤫤 Windows Υץ󥿤Ȥ

  10.     

  11.     ռ
  ______________________________________________________________________

  1.  Ϥ

   SMB HOWTO Ǥʸ Linux  Session Message Block (SMB)
  ץȥ򰷤ˡˤĤƽҤ٤ΤǤSMB ץȥϡ NetBIOS
  ץȥ롢LanManager ץȥȤƤФƤޤ

  ʸ David Wood (dwood@plugged.net.au) ԽƤޤɲþ
  佤ˤĤƤΥ᡼ϡΥɥ쥹ޤǤ꤯м
  Υ꡼ȿǤޤ

  SMB ץȥ Microsoft Windows 3.11NT95 ǥǥץ󥿤
  ͭ뤿ѤޤAndrew Tridgell ˤäƽ񤫤줿 Samba 
  륻åȤѤСLinux ʤɤ Unix ޥǤ Windows ΥۥȤ
  ǥץ󥿤ͭǤޤ

  Samba ѤƤǤ뤳Ȥϰʲ 4 ĤǤ

  1. Linux ۥȤΥɥ饤֤ Windows ۥȤǶͭ롣

  2. Windows ۥȤΥɥ饤֤ Linux ۥȤǶͭ롣

  3. Linux ۥȤΥץ󥿤 Windows ۥȤǶͭ롣

  4. Windows ۥȤΥץ󥿤 Linux ۥȤǶͭ롣

  ʸϰʾΥ򤹤٤ƥСƤޤ

  : ʸ˵ˡ䥹ץȤϡԤޤ᤿ͤΥ롼
  ǤϤޤƯƤޤĶۤʤȡޤʤǽ
  ⤢ޤΤ褦ʾԤ˥᡼Τ餻ƤСʸ
  ȯŸΩޤԤϲݾڤ⤷ޤ󡣲ԤƤ
  ǤԤϤ򤷤ƤˤʤΤǤ...

  2.  ¾ξ

   HOWTO ʸǤϡLinux ޥ SMB Υե륵ӥץȥ
  ӥѤ뤿ˡˤĤơäƤޤSamba 
  ʣǹⵡǽʥƥǤΤǡʸǤ Samba ˴ؤ󤹤٤
  򵭽Ҥ뤳ȤϤǤޤ󤷡ޤΤĤ⤢ޤ

  ¿ξΤꤿͤϰʲʸߤƤ

  o  Samba ۥѥå˴ޤޤɥȡۥѥå
     <ftp://nimbus.anu.edu.au/pub/tridge/samba/> Ǥޤ

  o  Linux Printing HOWTO

  o  Print2Win mini HOWTO

  ======

   Samba ߥ顼ФȤƤϡ
  <ftp://ring.aist.go.jp/archives/net/samba/> <ftp://ring.asahi-
  net.or.jp/archives/net/samba/> ʤɤޤ񤤤Ƥ
  '96 9 ߤǤϡ1.9.16p2 ǿΥ꡼СΤ褦Ǥ

  ܸβʸȤƤϰʲΤ褦ʤΤޤ
  1.9.15p8 ١˽񤤤ƤޤΤǡ1.9.16p2 ǤϺ٤ʬѤ
  Ƥޤä nmbd ΰѤäƤΤǡman nmbd Ƥ
  Ȥ򶯤ᤷޤ

  o  Unix Magazine '96 3  ý PC UNIXٲɧһ

  o  Unix User '96 10  إץ쥤ѡʥ Linuxٿɻ

  o  ؼդ Samba λȤʿ 
     <ftp://etlport.etl.go.jp/pub/windows/knowhow/samba.txt>
      Samba ɥȤȤƤϥХ֥Ū¸ߤȸޤ礦

  o  ƣʸͥ Samba Web ڡ
     smb.conf ʤɤޤ

  ˥塼ǤϡѸǤ comp.protocols.smb  Samba ˴ؤ
  Ƥޤ

  ====

  3.  󥹥ȡ

  ǿ Samba Υ <ftp://nimbus.anu.edu.au/pub/tridge/samba/> 
  ޤ

  Redhat ȤäƤͤʤ Samba  rpm ǥ󥹥ȡ뤹뤳Ȥ
  ޤ¾ۥѥåˤ Samba ΥХʥꥤ󥹥ȡ뤬ǽʤ
  Τޤ

  ======

  ܸΥե̾ͭˤϡѥκݤ Makefile Ǥ
  ꤬ɬפˤʤޤ嵭Τ褦ʥХʥѥåܸե̾
  ͭˤʤäƤ뤫ɤ¸Τä㤤ޤԤޤǤ
  Τ餻йǤ

  ====

  Samba Ѥ뤿ˤϰʲ 2 ĤΥǡץबɬפǤ
  ̾ /usr/sbin ˥󥹥ȡ뤵졢ƥ൯ư˥֡ȥå
  ץȤǵư뤫ޤ inetd ¹ԤޤץȤ
  ϡ``ǡư'' ˤƤޤ

     smbd
        SMB ǡǤ

     nmbd
        饤Ȥ NetBIOS ˤ̾赡ǽ󶡤ޤ

  ʲ Samba ץ̾ /usr/bin ˥󥹥ȡ뤵ޤʤξ
  ǽǤˡ

     smbclient
        UNIX ۥȤΤ SMB 饤ȥץ

     smbprint
        SMB ۥȤΥץ󥿤Ѥ뤿Υץ

     smbprint.sysv
        SVR4 Ѥ smbprint

     smbstatus
        ۥȤؤ SMB ³ꥹȤץ

     smbrun
        SMB ۥȤɬפʥץꥱ¹Ԥ뤿Ū
        򤹤륹ץȥץ

  ˡ HOWTO ʸˤ print Ȥ̾ΥץȤäƤ
   smbprint ץȤΥեȥɤǡñˤ
  ΤǤ

  Samba Υѥå򥤥󥹥ȡ뤹ΤϴñǤ嵭 URL 饽
  졢ۥ֤ README ե򸫤Ƥޤ
  docs/INSTALL.txt ˤϥ󥹥ȡξܺ٤ʲ⤬񤤤Ƥޤ

  󥹥ȡ³ơǡ /usr/sbin ءץ /usr/bin
  ءman ڡ /usr/local/man ֤ޤ礦

  Samba ΥѥåȤsmbd Υե졼ե
   smb.conf ֤ Makefile ǻꤷޤʤȤ
  ȤǤޤ̾ /etc/smb.conf ɤǤ礦ե
  ȥåǥ쥯ȥˤĤƤϰʲΤ褦ꤷƤȤ򤪴ᤷ
  

  ______________________________________________________________________
     log file=/var/log/samba-log.%m
     lock directory = /var/lock/samba
  ______________________________________________________________________

  ======

  Samba ѥåΥǥեȤǤϡǡ󤪤ӥץ
  /usr/local/samba/bin ءޤ smb.conf ʤɤ /usr/local/samba/lib 
  ֤ޤ

  ޤ log file  lock directory  Makefile ǤǤޤ
  smb.conf ˽񤤤Ƥɥ⤯ʤΤɤȻפ
  

  ====

  smb.conf 򥤥󥹥ȡ뤷ޤSamba Υץ򥳥ѥ뤷ǥ
  쥯ȥ˹Ԥ example/simple ǥ쥯ȥ˰ư README 
  ɤǲ³ƥǥ쥯ȥˤ smb.conf  /etc ˥ԡ
  Ǥäա Redhat ʤɤۥѥå Samba 򥤥
  ȡ뤷ˤϡ /etc  smb.conf 뤫⤷ޤ󡣤
  ϡΥե뤫ϤɤǤ礦

  % smb.conf  /etc ֤ʤˤϡʾˤƥ
  å󥯤 /etc ˺ޤ礦

  ______________________________________________________________________
      ln -s /path/to/smb.conf /etc/smb.conf
  ______________________________________________________________________

  4.  ǡư

  SMB Υǡ /usr/sbin/smbd  /usr/sbin/nmbd  2 ĤǤ

  Samba Υǡ¹Ԥ꤫ 2 Ĥޤinetd 鵯ư
  ˡȡɥΥץȤƵưˡǤѤΥե
  륵ФȤѤ inetd 鵯ưɤǤ礦
  в餫ͳǤΥǡץǤ⡢ΥꥯȤ
  äƺƼ¹ԤޤSMB ХӥѤʤʥƥ
  ΤȤȤˤʤС/etc/rc.d/init.d ץȤ¹Ԥ
  ɤǤ礦ɬפʤȤưǼ¹ԤƤɤǤ礦

  ======

  ԡɤϡǡץ鷺ʤͭȤո
  ޤޤԤΥۥȤ 3 ۤ Samba Ѥ֡
  ȤϤޤǤ

  ====

  inetd ǡưϡʲιԤ inetd ե
  /etc/inetd.conf ˲äޤ

  ______________________________________________________________________
  # SAMBA NetBIOS services (for PC file and print sharing)
  netbios-ssn stream tcp nowait root /usr/sbin/smbd smbd
  netbios-ns dgram udp wait root /usr/sbin/nmbd nmbd
  ______________________________________________________________________

  񤭴顢ʲΥޥɤ¹Ԥ inetd ꥹȤޤ

  ______________________________________________________________________
      kill -HUP <pid of inetd>
  ______________________________________________________________________

  <pid of inetd> ˤ inetd Υץ ID Ƥps ޥ
  ǳǧ뤫"cat /var/run/inetd.pid" ʤɤǤ狼ޤ

  ǡ򥷥ƥεưץȤ¹ԤϡʲƤ
  /etc/rc.d/init.d/smb ȤƺץΥȤǻꤵ
  եؤΥܥå󥯤äƤ

  ______________________________________________________________________
  #!/bin/sh

  #
  # /etc/rc.d/init.d/smb - starts and stops SMB services.
  #
  # The following files should be synbolic links to this file:
  # symlinks: /etc/rc.d/rc1.d/K35smb  (Kills SMB services on shutdown)
  #           /etc/rc.d/rc3.d/S91smb  (Starts SMB services in multiuser mode)
  #           /etc/rc.d/rc6.d/K35smb  (Kills SMB services on reboot)
  #

  # Source function library.
  \&. /etc/rc.d/init.d/functions

  # Source networking configuration.
  \&. /etc/sysconfig/network

  # Check that networking is up.
  [ ${NETWORKING} = "no" ] && exit 0

  # See how we were called.
  case "$1" in
    start)
      echo -n "Starting SMB services: "
      daemon smbd -D
      daemon nmbd -D
      echo
      touch /var/lock/subsys/smb
      ;;
    stop)
      echo -n "Shutting down SMB services: "
      killproc smbd
      killproc nmbd
      rm -f /var/lock/subsys/smb
      echo ""
      ;;
    *)
      echo "Usage: smb {start|stop}"
      exit 1
  esac
  ______________________________________________________________________

  ======

  Slackware ξϡ/etc/rc.d/rc.local ˰ʲΤ褦ʹԤɲäƤ
  ɤǤ礦

  ______________________________________________________________________
  if [ -f /usr/sbin/nmbd ]; then
    echo "SAMBA servers"
    /usr/sbin/smbd -D
    /usr/sbin/nmbd -D
  fi
  ______________________________________________________________________

  ====

  5.  /etc/smb.conf 

  Linux Ǥ¾ Unix Ǥ⡢Samba  /etc/smb.conf Ȥե
  ˤޤȤƵƤޤɤΥƥ꥽뤫ޤ
  ˤɤΤ褦¤ʤʤɤϡΥեꤷޤ

  ³ 2 Ǥ Linux Υɥ饤֤ץ󥿤 Windows ޥ󤫤
  ͭˡˤĤƽҤ٤ޤǼ smb.conf ϡǤñ
  ˤεǽ¸褦˽񤤤ΤǤΤǡޤƳŪʤ
  ȹͤƤ

   smb.conf ξܺ٤ʤƤ⿴ۤɬפϤޤ󡣽פʳǰ
  ˤĤƤϸǤ餿ޤ

  smb.conf γơΥϡإå[global][homes]
  [printers] ˤϤޤޤ

  global ǤƤΥ˶̤ѿꤷޤ

  homes ꤹȡ⡼ȥ桼ϼʬΥۡǥ쥯ȥ
  إǤ褦ˤʤޤĤޤ Samba ۥȤǤ Linux ޥ
  ˥ȤäƤͤ Windows ޥ³ȡĿ͸Ŀ
  Υۡǥ쥯ȥѤǤ褦ˤʤޤΥӥѤ
  ˤ Linux ޥ˥ȤäƤʤФʤޤ

  ˼ smb.conf Ǥϡ⡼ȥ桼ʬΥۡǥ쥯
  ˥/tmp ǥ쥯ȥ˽񤭤ߤǤ褦ˤƤ
  Windows 桼ˤΥ꥽򸫤ˤϡLinux ΥۥȤ
  ʥͥåȥˤʤФʤޤWindows Υեޥ͡
  䥨ץѤСΥɥ饤֤ͥåȥɥ饤֤Ȥ
  ³Ǥޤ

  ʸΰʲǤϡ¾Υ꥽ͭ뤿 smb.conf ե
  ν񼰤ˤĤƤҤ٤ƤޤͤˤƤ

  ______________________________________________________________________
  ; /etc/smb.conf
  ;
  ; Make sure and restart the server after making changes to this file, ex:
  ; /etc/rc.d/init.d/smb stop
  ; /etc/rc.d/init.d/smb start
  [global]
  ; Uncomment this if you want a guest account
  ; guest account = nobody
     log file = /var/log/samba-log.%m
     lock directory = /var/lock/samba
     share modes = yes

  [homes]
     comment = Home Directories
     browseable = no
     read only = no
     create mode = 0750

  [tmp]
     comment = Temporary file space
     path = /tmp
     read only = no
     public = yes
  ______________________________________________________________________

  6.  Linux Υɥ饤֤ Windows ޥ󤫤鶦ͭ

  ˤñ smb.conf 褦ˡLinux Υɥ饤֤ Windows
  Υ桼ͭΤϴñǤ Samba ΥƥǤ¿
  ιܤ򥫥ޥǤޤʲˤĤ򼨤ޤ

  ǥ쥯ȥ¤ʤ˸ˤϡǵ󤲤smb.conf 
  tmp ޤͤơĤΥѥ᡼ꤷޤ

  ______________________________________________________________________
  [public]
     comment = Public Stuff
     path = /home/public
     public = yes
     writable = yes
     printable = yes
  ______________________________________________________________________

  Υǥ쥯ȥ¤äѤơɤ߽ФϤǤǽȤ
  ߤ staff 롼פΥ桼˸¤ˤϡʲΤ褦ˤޤ

  ______________________________________________________________________
  [public]
     comment = Public Stuff
     path = /home/public
     public = yes
     writable = yes
     printable = no
     write list = @staff
  ______________________________________________________________________

  ɥ饤ֶͭ˴ؤ¾μˡˤĤƤϡSamba °ʸ man ڡ
  򸫤Ƥ

  ======

  Win 95 Ǻեʸʸζ̤򤷤ꡢܸ
  ɽ뤿ˤϡglobal ˰ʲΥȥɲäƤ
  ɤ褦Ǥ

  ______________________________________________________________________
     mangle case = no
     case sensitive = no
     default case = upper
     preserve case = yes
     short preserve case = yes
  ______________________________________________________________________

  ܸѤˤϡѥ Makefile 

                -DKANJI=\"euc\"

  ʤɤȻꤹɬפޤޤ 1.9.16p2 ϡsmb.conf 

  ______________________________________________________________________
     coding system = <ɷ>
  ______________________________________________________________________

  Τ褦˻ꤹ뤳Ȥǽˤʤꡢޤ CAP Ʊ˻Ȥ "cap" 
  ɷϤɲäޤ

  ʤɷϤ unicode ˤƤȡܸ Windows 95  Samba Υ
  饤֤³硢եκǤʤʤȤԶ礬
  뤽Ǥ

  ====

  7.  Windows Υɥ饤֤ Linux ޥǶͭ

  Samba ۥѥåˤϡUnix ޥΤ SMB 饤ȥץ
  बޤޤƤޤΥץ ftp Τ褦ʥޥɻظΥ
  եäƤޤΥץȤСWindows Υ
  ȡ Linux Υ饤ȤȤΤǡեΤ꤬Ǥޤ

  ======

  2.0 ʾʤɤκǶΥͥǤ smbfs Ȥե륷ƥब
  ꡢNT ʤɤΥͥåȥɥ饤֤ľܥޥȤǤ褦Ǥܺ
  ϡͥǥ쥯ȥ겼 Documentation/filesystems/smbfs.txt 򸫤
  

  ====

  ۥȤǤɤʶͭӥѽ뤫Ĵ٤뤿ˤϡʲΤ
  ʥޥɤ¹Ԥޤ

  ______________________________________________________________________
      /usr/sbin/smbclient -L host
  ______________________________________________________________________

  host ˤĴ٤ۥȤ̾ޤΥޥɤ¹Ԥȡ
  ӥ̾ΥꥹȤޤӥ̾ȤϡʤΥۥȤ
  Ǥɥ饤֤ץ󥿤̾Ǥ⤷ SMB Ф˲餫Υ
  ƥ¤äƤȥѥɤʹޤΤǡguest Ȥ
  ѥɤΥۥȤǤΤʤθĿͥȤΥѥɤ
  

  ¹򼨤ޤ

  ______________________________________________________________________
      smbclient -L zimmerman
  ______________________________________________________________________

  ¹Է̤ϰʲΤ褦ˤʤǤ礦

  ______________________________________________________________________
  Server time is Sat Aug 10 15:58:27 1996
  Timezone is UTC+10.0
  Password:
  Domain=[WORKGROUP] OS=[Windows NT 3.51] Server=[NT LAN Manager 3.51]

  Server=[ZIMMERMAN] User=[] Workgroup=[WORKGROUP] Domain=[]

          Sharename      Type      Comment
          ---------      ----      -------
          ADMIN$         Disk      Remote Admin
          public         Disk      Public
          C$             Disk      Default share
          IPC$           IPC       Remote IPC
          OReilly        Printer   OReilly
          print$         Disk      Printer Drivers

  This machine has a browse list:

          Server               Comment
          ---------            -------
          HOPPER               Samba 1.9.15p8
          KERNIGAN             Samba 1.9.15p8
          LOVELACE             Samba 1.9.15p8
          RITCHIE              Samba 1.9.15p8
          ZIMMERMAN
  ______________________________________________________________________

  ֥饦ꥹȡbrowse listˤϡͥåȥ¾ SMB Фζͭ
  ꥽򼨤ΤǤ

  饤ȤȤѤˤϰʲΤ褦˼¹Ԥޤ

  ______________________________________________________________________
      /usr/sbin/smbclient service <password>
  ______________________________________________________________________

  service ˤϥۥ̾ȶͭ̾ꤷޤۥ zimmerman ˤ
  public Ȥ̾ǸƤǥ쥯ȥѤ뤿
  ϡservice  \\zimmerman\public ȤʤޤΥץץȤ餳
  ΥޥɤѤϡХåå򥨥פʤȤ
  󤫤顢ɼΤ褦Ϥɬפޤ

  ______________________________________________________________________
      /usr/sbin/smbclient \\\\zimmerman\\public mypasswd
  ______________________________________________________________________

  mypassword ˤϡʤ ѥɤ򤽤Τޤ޽񤤤Ƥ

  ======

  ʲϾܡʹִĶˤ⤦äȴñˡǤ

  ______________________________________________________________________
      /usr/sbin/smbclient '\\zimmerman\public' mypasswd
  ______________________________________________________________________

  ====

  ʲΤ褦 smbclient ΥץץȤФƤޤ

  ______________________________________________________________________
  Server time is Sat Aug 10 15:58:44 1996
  Timezone is UTC+10.0
  Domain=[WORKGROUP] OS=[Windows NT 3.51] Server=[NT LAN Manager 3.51]
  smb: \>
  ______________________________________________________________________

  h ǤƤСsmbclient Υإפޤ

  ______________________________________________________________________
  smb: \> h
  ls             dir            lcd            cd             pwd
  get            mget           put            mput           rename
  more           mask           del            rm             mkdir
  md             rmdir          rd             prompt         recurse
  translate      lowercase      print          printmode      queue
  cancel         stat           quit           q              exit
  newer          archive        tar            blocksize      tarmode
  setmode        help           ?              !
  smb: \>
  ______________________________________________________________________

  ftp Ȥͤʤ顢man ڡ򸫤ޤǤʤ smbclient Ȥ褦
  ˤʤǤ礦

  8.  Linux ޥΥץ󥿤 Windows ޥ󤫤Ѥ

  Linux Υץ󥿤 Windows ѤˤϡLinux ǥץ󥿤
  ư褦ꤵƤɬפޤLinux ǤΥץ
  ȤǤƤ SMB ǤζͭϴñǤ

  ץ󥿤ˤĤƤ Printing HOWTO ߤƤ

  ɮԼȤ Windows NT ³Ƥץ󥿤ȤäƤΤǡ
  ˽񤤤Ƥ뤳ȤФȤϸ¤ޤ󡣽٤˼ȤƤ
  Ƥ⤷ŪʻѷиäƤä㤤ޤ顢
  ɤ dwood@plugged.net.au ޤΤ餻ƤФξϤ
  ƤǤޤ

  smb.conf ˥ץ󥿤äޤ

  ______________________________________________________________________
  [global]
     printing = bsd
     printcap name = /etc/printcap
     load printers = yes
     log file = /var/log/samba-log.%m
     lock directory = /var/lock/samba

  [printers]
     comment = All Printers
     security = server
     path = /var/spool/lpd/lp
     browseable = no
     printable = yes
     public = yes
     writable = no
     create mode = 0700

  [ljet]
     security = server
     path = /var/spool/lpd/lp
     printer name = lp
     writable = yes
     public = yes
     printable = yes
     print command = lpr -r -h -P %p %s
  ______________________________________________________________________

  ץ󥿤Υˤ path ˤϡ/etc/printcap ꤷס
  ǥ쥯ȥƱǥ쥯ȥꤷƤ

  : Samba Ȥä Unix ޥΥץ󥿤 Windows NT ޥ󤫤鶦ͭ
  ݤˤĤޤΤΰĤϡNT ϶ͭ
  ץ󥿤ʤȤΤǤ褹ˤ Samba
  ۥѥå docs/WinNT.txt ե򻲾ȤƲѥɤ
  ؤ⤢ޤƱե򸫤Ƥ⡢餤餹
  ǲˤϤʤޤ...

  ======

  Ԥ Linux ˤĤʤäƤ Epson MJ-700V2C  Samba Ǹ
  Windows 95 ȤäƤޤΤǡƤʲ˵ޤ
  ϥץ饤١ȥɥ쥹ΤĤͥåȥʤΤǡŪ˥
  ƥΤȤϹͤƤޤ

  ޤ smb.conf Ǥ

  ______________________________________________________________________
  [global]
          lock directory = /var/locks/samba

          workgroup = WORKGROUP
          browseable = yes
          allow hosts = 192.168.111.

          printing = bsd
          load printers = no
          printcap name = /etc/printcap

          password level = 8
          create mode = 0750

          mangle case = no
          case sensitive = no
          default case = upper
          preserve case = yes
          short preserve case = yes

  [lp]
          comment = MJ-700V2C
          printer name  = lp
          path = /var/tmp

          printable = yes
          writable = yes
          create mode = 0700
  ______________________________________________________________________

  /etc/printcap Ǥ

  ______________________________________________________________________
  lp:\
          :lp=/dev/lp1:\
          :sd=/var/spool/lpd/lp:\
          :lf=/var/spool/lpd/lp/errs:\
          :if=/var/spool/lpd/lp/incat:\
          :mx#0:\
          :sh:\
          :sf:
  ______________________________________________________________________

  ץåȥե륿 /var/spool/lpd/lp/incat Ǥ

  ______________________________________________________________________
  #!/bin/sh
  /bin/cat
  exit 0
  ______________________________________________________________________

  Windows 95 ϡͥåȥɥ饤֤򤷤 MJ-700V2C Υɥ饤
  Фǥ󥹥ȡ뤹ɬפޤ

  ====

  9.  Linux ޥ󤫤 Windows Υץ󥿤Ȥ

  Windows ޥΥץ󥿤ͭ뤿ˤϰʲκȤɬפǤ

  1. /etc/printcap ȥ꤬ɬפǡϥʥǥ쥯
     ȥ깽¤˽सΤǤɬפޤʥסǥ쥯ȥ
     ʤɡˡ

  2. /usr/bin/smbprint ץȤɬפǤ Samba Υѥå
     դƤޤSamba ΥХʥۥѥåˤդƤ
     ⤷ޤ󡣸ǥꥸʥ򾯡Τܤޤ

  3. ASCII ե Postscript Ѵɬפˤϡ
     nenscript ʤɤ Postscript Сɬפޤ
     nenscript ̾ /usr/bin ˥󥹥ȡ뤵Ƥޤ

  4. Samba ѤưפˤƤ褦ʥեȥɤߤ
     Сʲ˵ñ perl ץȤƲASCII
     Postscriptcreated Postscript 褦ˤʤäƤޤ

  ʲ˵ΤϡWindows NT ץ󥿤³줿 HP 5MP ץ󥿤
  뤿 /etc/printcap ؤΥȥǤ줾Ƥϰʲ̤
  Ǥ

     cm 

     lp Ϥ˻ȤǥХ̾

     sd Υץ󥿤ΤΥסǥ쥯ȥ

     af ȥե

     mx Υե륵0 ˤ̵¤ˤʤޤ

     if ϤѤե륿ʤޤϥץȡ

  ˾ɬפʤ顢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 եȡĹԤϲԤƤޤ
  ޤΥץȤǤϡǽʸ¤ñǤϤʤǲԤ
  褦ˤƤޤ

  ɤΥեޥåȤˤ 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 Ȥܸб
  ޥɤäƤޤ¾ˤ a2psps2ascii ps2txttoPS ʤ͡
  ʤΤͥåȥǽǤ

  ʤԤϤξϤΥץȤƥȤǤĶޤΤǡʸ
  ˤäץȤ򤽤Τޤ޺ܤƤޤ¤ܸ̤
  ϡϢйǤ

  ====

  10.  

   HOWTO ʸ 1996 ǯʹ David Wood ˤΤȤޤ
  ޤह٤Ƥʸѹʤ¤ˤơ
  ؤΤʸʣӤκۤĤޤ

  11.  ռ

  ⤷᡼Ǹո򤤤СǤΥ꡼κݤˡǤ̾
  󤲤ƴդȻפޤ

  ======

  ܸؤäƤϡ

        ܰ칬 ikko-@pacific.rim.or.jp
        ¼ ᤵ juk@rccm.co.jp
        ܾʤ shom@i.h.kyoto-u.ac.jp
        ̧ˤ minoura@biol.s.u-tokyo.ac.jp

  ˸λŦͭפʥȤ򤤤ޤ

  ====

