home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume24 / faxpax / part02 / FaxConfig
Text File  |  1991-03-12  |  26KB  |  973 lines

  1. #!/bin/sh
  2. #
  3. # $Header: FaxConfig, 2.2.91, ks
  4. # basically a [very much] stripped down and ripped off version of rn/Configure
  5. # where it says:
  6. # Yes, you may rip this off to use in other distribution packages.
  7. # so I did
  8.  
  9. n=''
  10. c=''
  11. contains=''
  12.  
  13. modemtypes='1'
  14.  
  15. charset='i'
  16. device="/dev/not_that_one"
  17. devlock="LCK..nosuchdevice"
  18. dialstr=""
  19. dialtype='T'
  20. net='y'
  21. netwide_fax="NETWIDE_FAX"
  22. faxhost="faxhost"
  23. faxadmin=`whoami`
  24. faxadmin="$faxadmin@"`hostname`
  25. faxfmode='0644'
  26. faxlib='/usr/local/lib/faxlib'
  27. faxspool='/usr/local/spool/fax'
  28. fmtype="sierra"
  29. localbin='/usr/local/bin'
  30. loglevel='9'
  31. manshelf='/usr/share/man'
  32. maxresend='3'
  33. maxage='1'
  34. maxtry='5'
  35. topspeed='7'
  36. uucplocks='/var/spool/locks'
  37.  
  38.  
  39. echo "Beginning of configuration questions for faxpak."
  40. echo " "
  41.  
  42. : some greps do not return status, grrr.
  43. echo "grimblepritz" >grimble
  44. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  45.     contains=contains
  46. else
  47.     if grep grimblepritz grimble >/dev/null 2>&1 ; then
  48.     contains=grep
  49.     else
  50.     contains=contains
  51.     fi
  52. fi
  53.  
  54. : sanity checks
  55. PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc'
  56. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
  57.  
  58. if test ! -t 0; then
  59.     echo "Type 'sh FaxConfig', not 'sh <FaxConfig'"
  60.     exit 1
  61. fi
  62.  
  63. : first determine how to suppress newline on echo command
  64. echo "Checking echo to see how to suppress newlines..."
  65. (echo "hi there\c" ; echo " ") >.echotmp
  66. if $contains c .echotmp >/dev/null 2>&1 ; then
  67.     echo "...using -n."
  68.     n='-n'
  69.     c=''
  70. else
  71.     echo "...using \\\c."
  72.     n=''
  73.     c='\c'
  74. fi
  75. echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
  76. read ans
  77. rm .echotmp
  78.  
  79. : now set up to do reads with possible shell escape
  80. : if this does not work on your machine, 1,$s/. myread/read ans/
  81. cat <<EOSC >myread
  82. ans='!'
  83. while expr "X\$ans" : "X!" >/dev/null; do
  84.     read ans
  85.     case "\$ans" in
  86.     !)
  87.     sh
  88.     echo " "
  89.     echo $n "Your answer: $c"
  90.     ;;
  91.     !*)
  92.     set \`expr "X\$ans" : "X!\(.*\)\$"\`
  93.     sh -c "\$*"
  94.     echo " "
  95.     echo $n "Your answer: $c"
  96.     ;;
  97.     esac
  98. done
  99. EOSC
  100.  
  101.  
  102. cat <<EOT
  103.  
  104. # general info
  105. ##############################################################################
  106. This installation shell script asks you some questions regarding the
  107. setup of faxpak. Currently there is no support for hardware other than
  108. Sun Microsystems'. To port this to other machines run this script 
  109. anyway, but then have a close look at wiring.c. Wiring.c can be used
  110. as a standalone test program with TESTING defined, and with TEST_DEVICE
  111. defined to a port you can use for testing [you can reconfig any time],
  112. preferably without interfering logins.
  113.  
  114. This script builds a header file faxconfig.h, a soft configuration file
  115. fax,config, fax.1 man pages and, if you're lucky, two faxpak fonts.
  116.  
  117. Default answers are shown in [brackets]. Hitting carriage return accepts
  118. the defaults. Once you have faxconfig.h and fax.config you can change
  119. each file by editing it without re-running this script.
  120.  
  121. EOT
  122.  
  123. echo $n "[Type carriage return to continue] $c"
  124. . myread
  125. echo " "
  126.  
  127.  
  128. cat <<EOT
  129.  
  130. ##############################################################################
  131. faxpak can run on networked and standalone machines.
  132.  
  133. If faxpak is networked, it is assumed that one HOST has the faxmodem[s],
  134. with all other machines acting as CLIENTS, spooling outgoing fax jobs to
  135. the faxhost.
  136.  
  137. The faxhosts' duty is to convert incoming text files into group 3 fax files,
  138. and to do the actual transmission, to log what's going on, to report by
  139. mail [if requested] and to do house keeping chores. This is done by entries
  140. in root's crontab which calls sendfax frequently and faxcleanup once a day.
  141.  
  142. EOT
  143.  
  144. dflt=$net
  145. echo $n "Do you expect to run faxpak on networked machines? [$dflt] $c"
  146. . myread
  147. echo
  148. case $ans in
  149. '') ans=$dflt;;
  150. esac
  151.  
  152.  
  153. if [ $ans = y ]
  154. then
  155.  
  156.     cat <<EOT
  157.  
  158. # network info, don't really need much
  159. ######################################################################
  160. "client" machines find the faxhost by calling gethostbyname(FAXHOST),
  161. with FAXHOST #defined in faxconfig.h on our sita as "faxhost",
  162. and with "faxhost" aliased in /etc/hosts to mbox. mbox is a 3/60 that
  163. acts as our spooling machine [printing, faxing, mail, news archive etc.].
  164.  
  165. EOT
  166.  
  167.     dflt=$faxhost
  168.     echo "Please enter the \"synonym\" your FAXHOST will be known by -"
  169.     echo $n "[I guess you could enter the name of a known machine]: [$dflt] $c"
  170.     . myread
  171.     echo
  172.     case $ans in
  173.     '') ans=$dflt;;
  174.     esac
  175.     faxhost=$ans
  176. else
  177.     net='n'
  178.     netwide_fax="nonet"
  179. fi
  180.  
  181.  
  182. cat <<EOT
  183.  
  184. # we need someone to blame when things go wrong
  185. ##############################################################################
  186. The bad news is that things DO go wrong. Therefore we may need 
  187. someone to interfere by hand, or to lend a hand if a user needs help,
  188. or to give the default answer ["You can't to that"].
  189.  
  190. EOT
  191. dflt=$faxadmin
  192. echo $n "Name a patient person suitable for dealing with fax problems: [$dflt] $c"
  193. . myread
  194. echo
  195. case $ans in
  196. '') ans=$dflt;;
  197. esac
  198. faxadmin=$ans
  199.  
  200.  
  201. # what arg do we give chmod()
  202. ##############################################################################
  203. dflt=$faxfmode
  204. echo $n "Please enter the file access perms to be enforced by faxpak: [$dflt] $c"
  205. . myread
  206. echo
  207. case $ans in
  208. '') ans=$dflt;;
  209. esac
  210. faxfmode=$ans
  211.  
  212. cat <<EOT
  213.  
  214.  
  215. # where to put faxlib and the spool dir
  216. ##############################################################################
  217. To keep things somewhat organised we need to define a /someplace/faxlib,
  218. and a /somewhere/spooldir for faxpak. I prefer to keep them separate from
  219. distribution libs and spool dirs. I'd also like to know where you keep you
  220. man pages.
  221.  
  222. EOT
  223. dflt=$faxlib
  224. echo $n "Please enter the path to faxlib: [$dflt] $c"
  225. . myread
  226. echo
  227. case $ans in
  228. '') ans=$dflt;;
  229. esac
  230. faxlib=$ans
  231.  
  232.  
  233. dflt=$faxspool
  234. echo $n "And path to faxspool: [$dflt] $c"
  235. . myread
  236. echo
  237. case $ans in
  238. '') ans=$dflt;;
  239. esac
  240. faxspool=$ans
  241.  
  242.  
  243. dflt=$manshelf
  244. echo $n "And your Manual Shelf: [$dflt] $c"
  245. . myread
  246. echo
  247. case $ans in
  248. '') ans=$dflt;;
  249. esac
  250. manshelf=$ans
  251.  
  252. cat <<EOT
  253.  
  254. # find competing uucp locks
  255. ##############################################################################
  256. Modem logins, uucp transmissions and faxes all the same time and on
  257. the same modem tend become somewhat garbled. Tell me where uucp keeps
  258. its lock files, so that sendfax dies away instantly if uucp is active
  259. [it knows about logins on a port].
  260.  
  261. EOT
  262. dflt=$uucplocks
  263. echo $n "Where does uucp create its lock files: [$dflt] $c"
  264. . myread
  265. echo
  266. case $ans in
  267. '') ans=$dflt;;
  268. esac
  269. uucplocks=$ans
  270.  
  271.  
  272. cat <<EOT
  273.  
  274. # local bin for fax
  275. ##############################################################################
  276. Assuming you don't put local executables into /usr/{bin,ucb}, we need
  277. sort of a /local/bin to put the user interface [called fax] into.
  278.  
  279. EOT
  280. dflt=$localbin
  281. echo $n "Where do you keep local executables: [$dflt] $c"
  282. . myread
  283. echo
  284. case $ans in
  285. '') ans=$dflt;;
  286. esac
  287. localbin=$ans
  288.  
  289.  
  290. cat <<EOT
  291.  
  292. # max no of resends within one transmission
  293. ##############################################################################
  294. The last hard wired bit of info is the number of resends. If a page is
  295. garbled during transmission, the two hardware gizzmos, that is your
  296. faxmodem on this side and the fax machine on the other end, can agree
  297. to resend that page. I don't know if fax machines have a built in limit
  298. for the number of resent pages, I do, however, feel safer if I know
  299. sendfax doesn't spend all night resending a page. Having seen the different
  300. levels of compliance to the CCITT specs, especially european fax machines',
  301. I would doubt, if such a limit is enforced.
  302.  
  303. EOT
  304. dflt=$maxresend
  305. echo $n "How often do you permit the resending of a page within one call [$dflt] $c"
  306. . myread
  307. echo
  308. case $ans in
  309. '') ans=$dflt;;
  310. esac
  311. maxresend=$ans
  312.  
  313.  
  314. # have header info, get details for fax.config
  315. ##############################################################################
  316.  
  317. if [ $modemtypes = 2 ]
  318. then
  319.     mtypestring="faxmodem type, currently class2 and sierra type modems are supported"
  320. else
  321.     mtypestring="faxmodem type, currently only sierra type modems are supported"
  322. fi
  323.  
  324. cat <<EOT
  325.  
  326. # soft configuration, saved in $faxlib/fax.config"
  327. ##############################################################################
  328. Most of the configuration of faxpak can be changed after compiling faxpak.
  329. Softwired details are stashed into $faxlib/fax.config, allowing for easy 
  330. alteration once you have faxpak working. The fax.config file stores:
  331.  
  332. 1: the ports to which you have faxmodems connected *)
  333. 2: literal name of lockfile for each port, in case uucp uses these ports
  334.    as well as faxpak *)
  335. 3: $mtypestring
  336. 4: Tone or Pulse dialling
  337. 5: Highest speed your faxmodems are capable of [RTFFaxmodemM]
  338. 6: an optinal string to re-enable dialins on the port after sendfax is done,
  339.    see /etc/uucp/Dialers, or the modem docs, for examples
  340.  
  341. 7: wildcarded dialcodes and times, faxes to these area codes are ok *)
  342.  
  343. 8: max no of days a fax is allowed to sit in $faxspool
  344. 9: max no of attempts to send a fax
  345.  
  346. log level, 9 logs everything [huge!], 0 only some relevant info
  347.  
  348. FaxConfig only writes a preliminary file including some comments. Feel
  349. free to edit it to your liking at any time.
  350.  
  351. *) these are best done with an editor, in fact, I don't even ask for
  352.    dialcode:time pairs. see the file fax.config when done with this script.
  353.    [you could also call this load sharing between you and me].
  354.  
  355. EOT
  356.  
  357. dflt=$device
  358. echo $n "Please enter the first port to be used [$dflt] $c"
  359. . myread
  360. echo
  361. case $ans in
  362. '') ans=$dflt;;
  363. esac
  364. device=$ans
  365.  
  366. dflt=$devlock
  367. echo "Please enter lockname to block uucp while we're"
  368. echo $n "sending out faxes [$dflt] $c"
  369. . myread
  370. echo
  371. case $ans in
  372. '') ans=$dflt;;
  373. esac
  374. devlock=$ans
  375.  
  376. if [ $modemtypes = 2 ]
  377. then
  378.     dflt=$fmtype
  379.     echo $n "Please enter modem type [$dflt] $c"
  380.     . myread
  381.     echo
  382.     case $ans in
  383.     '') ans=$dflt;;
  384.     esac
  385.     fmtype=$ans
  386. fi
  387.  
  388. dflt=$dialtype
  389. echo $n "Please enter 'P' if you want pulse dialling [$dflt] $c"
  390. . myread
  391. echo
  392. case $ans in
  393. '') ans=$dflt;;
  394. esac
  395. dialtype=$ans
  396.  
  397. dflt=$topspeed
  398. echo "Please enter code for highest baud rate your modem can "
  399. echo $n "fax at - see modem manual [$dflt] $c"
  400. . myread
  401. echo
  402. case $ans in
  403. '') ans=$dflt;;
  404. esac
  405. topspeed=$ans
  406.  
  407. dflt=$dialstring
  408. echo "If you feel brave enough [else leave blank and do later]"
  409. echo $n "String to reenable dialins on ports used by faxmodems [$dflt] $c"
  410. . myread
  411. echo
  412.  
  413. dflt=$maxage
  414. echo $n "How many days is a fax allowed to sit in the queue [$dflt] $c"
  415. . myread
  416. echo
  417. case $ans in
  418. '') ans=$dflt;;
  419. esac
  420. maxage=$ans
  421.  
  422. dflt=$maxage
  423. echo $n "How many attempts do you allow to connect to one phone no [$dflt] $c"
  424. . myread
  425. echo
  426. case $ans in
  427. '') ans=$dflt;;
  428. esac
  429. maxtry=$ans
  430.  
  431. dflt=$loglevel
  432. echo $n "What log level do you want sendfax [wiring for testing] to log at [$dflt] $c"
  433. . myread
  434. echo
  435. case $ans in
  436. '') ans=$dflt;;
  437. esac
  438. loglevel=$ans
  439.  
  440.  
  441.  
  442. cat <<EOT
  443.  
  444. # charset info
  445. ##############################################################################
  446. Although I planned to support quite a few different character sets [with
  447. the help of several netters] faxpak currently supports the following few. 
  448. For those poor souls whose expression is limited to 7 bits, the decision
  449. must be based on rand().
  450.  
  451. Please enter the charset you want faxpak to use:
  452.  
  453.     i    iso 8859.1
  454.     p    pc de facto [code page 850] standard *)
  455.     8    pc code page 861
  456.  
  457. *) Some people felt strongly the ibm pc code page 850 is NOT a de facto
  458.    standard. IMHO it is insofar as the uk, germany, switzerland and some
  459.    other mid european countries are concerned, where quite a chunk of 
  460.    "the action" takes place. If you still disagree, don't use faxpak.
  461.  
  462. EOT
  463.  
  464. dflt=$charset
  465. echo $n "What charset do you want to use [$dflt] $c"
  466. . myread
  467. echo
  468. echo    copying font definition for diy font kit
  469. case $ans in
  470. 'p')    cp faxhost/faxfonts/diy_ibmpc.def faxhost/faxfonts/diykit.def;;
  471. '8')    cp faxhost/faxfonts/diy_codep861.def faxhost/faxfonts/diykit.def;;
  472. *)    cp faxhost/faxfonts/diy_iso.def faxhost/faxfonts/diykit.def;;
  473. esac
  474.  
  475. rm -f myread grimble
  476.  
  477.  
  478. # have fax.config, write faxconfig.h and fax.config
  479. ###################################################
  480.  
  481. echo    "writing faxconfig.h"
  482.  
  483. cat    >faxconfig.h <<EOT
  484.  
  485. /*
  486.     fax configuration header [faxconfig.h],
  487.     shared by faxclient/fax.c, and faxhost/*.c
  488.  
  489.     Copyright (C) 1991, klaus schallhorn, klaus@cnix.uucp
  490.  
  491.     Permission to use, copy, modify, and distribute this software 
  492.     and its documentation for any purpose and without fee is hereby 
  493.     granted, provided that the above copyright notice appear in 
  494.     all copies and that both that copyright notice and this permission 
  495.     notice appear in supporting documentation. 
  496.  
  497.     This software is provided "as is" without express or implied warranty.
  498. */
  499.  
  500. #define    $netwide_fax
  501.  
  502.  
  503.             /* some common bits 'n pieces */
  504. #ifndef    TRUE
  505. #define    TRUE        1
  506. #define    FALSE        0
  507. #define    ERROR        (-1)
  508. #endif
  509.  
  510. #ifndef    min
  511. #define    min(a,b)    ((a<b)?a:b)
  512. #define    max(a,b)    ((a>b)?a:b)
  513. #endif
  514.  
  515.  
  516.             /* network stuff */
  517. #ifdef    NETWIDE_FAX
  518. #define    FAXHOST        "$faxhost"        /* get host by name */
  519. #endif
  520.  
  521.  
  522.             /* application specific stuff */
  523. #define    FAXADMIN    "$faxadmin"        /* mail errors if !user */
  524. #define    FAXFMODE    $faxfmode            /* for chmod */
  525. #define    FAXSERVER    "spool.fax"        /* name of spool pgm */
  526. #define    FAXLIB        "$faxlib"    /* needed on faxhost only */
  527. #define    FAXSPOOL    "$faxspool"    /* needed on faxhost only */
  528.  
  529. #define    UUCPLOCKS    "$uucplocks"    /* again host only */
  530. #define    LOCALBIN    "$localbin"        /* client && host, for fax.c */
  531.  
  532. #define    MAX_RESEND    $maxresend            /* don't resend a page forever */
  533. #define    FAXLFONT    "textfaxl.font"        /* lores bitmap font from diykit */
  534. #define    FAXHFONT    "textfaxh.font"        /* hires bitmap font from diykit */
  535. #define    PSFONT        "Courier-Bold12"    /* ghostscript font */
  536.  
  537. #define    MAX_FAX_LINES    2400        /* is a bit generous, so what */
  538.  
  539. #define    COARSE        1        /* 204.15 by 97.79 dpi */
  540. #define    FINE        2        /* 204.15 by 195.58 dpi */
  541. #define    HP        3
  542.  
  543. #define    ASCII        0    /* use hp laser jet compat font to create pbm */
  544. #define    PBM        1    /* use as is, sort of */
  545.             /* these aren't done yet, see wiring.c, why */
  546. #define    DVI        2    /* dvi2ps, NOT YET DONE */
  547. #define    GHOSTSCRIPT    3    /* ideas [not yet] stolen from mit ai labs */
  548. #define    HPCL        4    /* hp laser jet compat output */
  549.  
  550.  
  551.             /* fax modem specific bits */
  552. #define    BETA_FIRMWARE        /* applies to wiring.c */
  553. #define    SIERRA            /* type of fax modem */
  554.  
  555.  
  556. #ifdef    NEED_FAXTYPES        /* needed in fax.c and spool.fax.c */
  557. struct    ftypes
  558. {
  559.     char    *typename;
  560.     int    typeid;
  561. } faxtypes[] =
  562. {
  563.     "ascii",    ASCII,
  564.     "pbm",        PBM,
  565.     "dvi",        DVI,
  566.     "postscript",    GHOSTSCRIPT,
  567.     "hpcl"        HPCL
  568. };
  569. #define    MAX_FTYPE    sizeof(faxtypes)/sizeof(struct ftypes)
  570. #endif    /* need fax types */
  571.  
  572.  
  573. struct FAX
  574. {
  575.     long    spooled;
  576.     char    user[80];
  577. #ifdef    JOBID
  578.     char    jobid[80];
  579. #endif
  580.     char    dname[256];
  581.     char    xname[256];
  582.     char    **phone;
  583.     int    tries,
  584.         hires,
  585.         uid,
  586.         now,
  587.         mail,
  588.         pages,
  589.         type,
  590.         phone_nos;
  591.     long    tpos,
  592.         ppos;
  593. };
  594. EOT
  595.  
  596. echo    "writing fax.config"
  597.  
  598. cat    >fax.config <<EOT
  599. # fax.config
  600. # Copyright (C) 1991 klaus schallhorn, klaus@cnix.uucp
  601. #
  602. # Permission to use, copy, modify, and distribute this software 
  603. # and its documentation for any purpose and without fee is hereby 
  604. # granted, provided that the above copyright notice appear in 
  605. # all copies and that both that copyright notice and this permission 
  606. # notice appear in supporting documentation. 
  607. #
  608. # This software is provided "as is" without express or implied warranty.
  609. #
  610. #
  611. # fax devices
  612. # ===========
  613. # 2nd column contains the actual device for sendfax
  614. # ie /dev/cua1
  615. #
  616. # 3rd col states lock name to be used so that uucp does not even try 
  617. # to interfere while we're faxing. Stating the lock name verbatim is 
  618. # essential since there are differences between HDB uucp and older/other 
  619. # versions.
  620. # NOTE: if you don't share faxmodems with uucp, locknames don't really 
  621. # matter as long as each port has a distinctive lockname. fred1, fred2 
  622. # ... fredn would be acceptable.
  623. #
  624. # 4th col specifies the modem type connected to that port so sendfax knows 
  625. # how to talk to the hardware.
  626. #
  627. # 5th col is either T [as in tone dialling] or P [pulse].
  628. #
  629. # 6th col is highest speed you want to connect at, see your modem manual.
  630. #
  631. # 7th col is a string sent to the fax modem AFTER we've used it IF you 
  632. # want to enable incoming calls/getty, for a typical string see 
  633. # /etc/uucp/Diallers, string has to be "in quotes", absence of a string 
  634. # implies nothing to send.
  635. #
  636. # this is what fax.config looks here
  637. # 1st    2nd        3rd            4th      5th 6th 7th
  638. #device    /dev/cua1   LCK..cua1   sierra     T   7 "ATE1M0V1X1Q0S2=127S0=4S12=255"
  639. #device    /dev/cua2   LCK..cua2   sierra     T   7 "ATE1M0V1X1Q0S2=127S0=4S12=255"
  640. device    $device    $devlock    $fmtype    $dialtype    $topspeed    $dialstr
  641. #
  642. #
  643. # phone bill saver
  644. # ================
  645. #
  646. # I do not want faxes at peak rates, except local ones.
  647. #
  648. # long distance call phone nos start with a zero PLUS any combination of 
  649. # digits 1 to 9 [1-9][1-9]* 
  650. # NOTE: no zeros in 2nd or 3rd digit, except if 2nd digit > 1
  651. #
  652. # international ones start with 010 cty code PLUS any combination of 1 to 9
  653. #
  654. # This feature can be raped to make sure faxes to specific fax numbers 
  655. # are only sent at an acceptable [for the recipient] time, as shown in the 
  656. # first "hour entry". Hard coded phone nos should come before wild card 
  657. # entries.
  658. #
  659. # This sample states that long distance is ok from 6 pm to 6 am, 
  660. # international ones from 8 pm to 6 am
  661. #
  662. #hours    0104977777777    9 - 12    # this guy can only be sent to in the morning
  663. #hours    01049123456    8 - 10 14 16 - 19 
  664. #hours    0[1-9][1-9]*    18 - 6    # as in 078 123 6789
  665. #hours    0[2-9]*        18 - 6    # as in 030 455 6748
  666. #hours    010[1-9]*    20 - 6    # as in 01049 30 345 6789
  667. #
  668. #
  669. # max age of files in spool dir [days], fax is supposed to be fast!
  670. # =============================
  671. #
  672. maxage    $maxage
  673. #
  674. #
  675. # max number of attempts to connect
  676. # =================================
  677. #
  678. maxtry    $maxtry
  679. #
  680. # log level
  681. # =========
  682. #
  683. # 9 = everything
  684. # 0 = errors, transmission times
  685. # other useful levels are 3 and 5
  686. #
  687. loglevel $loglevel
  688. #
  689. #
  690. # end of fax.config
  691. EOT
  692.  
  693. # now save fax.1 man pages
  694. ##########################
  695.  
  696. echo    "writing faxclient/fax.1 man pages"
  697.  
  698. cat    >faxclient/fax.1 <<EOT
  699. .TH fax 1 "Feb 4th, 1991"
  700. .SH NAME
  701. fax \- send a Group 3 fax via faxmodem.
  702. .SH SYNOPSIS
  703. fax phone_no [-a -f -h -l -m -n -r -s] file
  704. .SH DESCRIPTION
  705. Fax accepts ascii input and sends it as a group 3 fax
  706. using a sierra type faxmodem. The first parameter is either
  707. a phone number, an alias [see aliases] or a distribution list [see lists] 
  708. file name.
  709. .sp
  710. If the first parameter contains digits only, it is
  711. assumed to be a phone number.
  712. .sp
  713. If your site does enforce permissions, you may have to ask your
  714. administrator [$faxadmin] for permission to fax.
  715. .SH PARAMETERS
  716. .TP
  717. .B -a'for the attention of...'
  718. To specify a recipient within an organization for internal
  719. routing. The string must be quoted so it's passed as one
  720. argument to fax. It is then prepended to the outgoing message.
  721. .TP
  722. .B -f/absolute/font/path/fontfile
  723. Use an alternative font. In addition to the default typewriter fonts
  724. in low and high resolution fax knows about 
  725. HP Laserjet compatible fonts [up to 30 points in height]. These are
  726. scaled to the resolution of the outgoing fax. Used with low resolution
  727. the output is not pretty.
  728. .TP
  729. .B -h
  730. Use high resolution mode [204 by 195 dots per inch]. This almost doubles
  731. the transmission time.
  732. .TP
  733. .B -l
  734. Use low resolution mode [204 by 97 dots per inch].
  735. .TP
  736. .B -m
  737. Report by mail as soon as the fax has been sent. Fatal errors or failure
  738. to deliver is reported back irrespectible of the mail flag setting.
  739. .TP
  740. .B -n
  741. Send the fax "now" rather than at cheap rate, where "now" refers
  742. to the next time the fax daemon runs. To bypass the time restrictions [if
  743. any] you may need to have special permission.
  744. .TP
  745. .B -r'return fax number string'
  746. This string is prepended to the outgoing fax to specify a return
  747. fax number. Currently fax does not support incoming faxes.
  748. .TP
  749. .B -s
  750. Save outgoing faxes in HOME/Fax.Sent/phone.date. Fax saves outgoing faxes in
  751. files whose name is a concatenation of recipient and date. If the recipient
  752. is not an alias and not a distribution list, the phone number is
  753. used for the first part of the file name.
  754. .PP
  755. File is an ascii file containing a formatted message.
  756. .SH DEFAULTS
  757. You can override built in defaults by creating a file ".faxrc" in
  758. your home directory. This file is consulted before fax reads 
  759. command line parameters.
  760. .sp
  761. Permitted default values in .faxrc are those that apply to
  762. all outgoing faxes sent by one user. Command line option override
  763. these dafaults, however.
  764. .TP
  765. .B font
  766. The name of a font to be used by fax. The font has to be available
  767. on the machine running the fax daemon. The fontfile
  768. must be accessible to the fax daemon.
  769. .TP
  770. .B resolution
  771. Can be high or low [see above]. Default: low. 
  772. .TP
  773. .B mail
  774. Set to yes for notification by mail. Default: no.
  775. .TP
  776. .B now
  777. Set to yes for sending next time the fax queue is checked
  778. for outgoing faxes. Default: no.
  779. .TP
  780. .B retfax
  781. A string to be prepended all your outgoing faxes. No default string.
  782. .TP
  783. .B save
  784. If set, saves files in HOME/Fax.Sent/phone.date. Default: no.
  785. .SH ALIASES
  786. If the first parameter to fax contains alphabetic characters, fax first
  787. checks your HOME directory for a file fax.aliases. This file contains
  788. a list of names, phone numbers, optionally ftao [for the attention of] 
  789. strings to be prepended to each outgoing fax. Anything appearing after a # 
  790. sign is treated as a comment.
  791. .sp
  792. A sample fax.aliases file might look:
  793. .sp
  794. .nf
  795. fred    12345678    :For the attn of Fred Bloggs     # comment
  796. bill    98765
  797. sue    765432389    :The Lady in Pink             # another comment
  798. .fi
  799. .SH LISTS
  800. If an alias is not found in fax.aliases, fax tries to open a distribution
  801. list with the same name. Distribution lists are similar to alias files.
  802. A sample distribution list might look:
  803. .sp
  804. .nf
  805. 12345678    :For the attn of Fred Bloggs     # comment
  806. 98765
  807. 765432389    :The Lady in Pink             # another comment
  808. .fi
  809. .SH INTERACTIVE USE
  810. If fax is not given a file name on the command line, it reads 
  811. it's standard input until a line starting with a '.' is encountered,
  812. or until EOF.
  813. .sp
  814. Entering of a fax can be aborted by hitting ^C. Entering ~v at the beginning of
  815. a line calls the default editor, if specified by the environment variable
  816. EDITOR, or /usr/ucb/vi.
  817. .sp
  818. Starting a line with ~p prints the message entered to far.
  819. .SH AUTHOR
  820. Klaus Schallhorn
  821. .SH COPYRIGHT
  822. Copyright (C) 1991 Klaus Schallhorn, klaus@cnix.uucp
  823. .sp
  824. Permission to use, copy, modify, and distribute this software and its
  825. documentation for any purpose and without fee is hereby granted, provided
  826. that the above copyright notice appear in all copies and that both that
  827. copyright notice and this permission notice appear in supporting
  828. documentation.  This software is provided "as is" without express or
  829. implied warranty.
  830. EOT
  831.  
  832. echo    "writing Makefiles"
  833.  
  834. cat    >Makefile <<EOT
  835. # Makefile for faxpak
  836. #
  837. # Copyright (C) 1991 klaus schallhorn, klaus@cnix.uucp
  838. #
  839. CC =        cc
  840. CFLAGS =    -O2
  841. LDFLAGS =    -s
  842.  
  843. FAXLIB =    $faxlib
  844. FAXFMODE =    $faxfmode
  845. LOCALBIN =    $localbin
  846. MANSHELF =    $manshelf
  847.  
  848. SHELL =        /bin/sh
  849.  
  850. SUBS =        faxclient faxhost faxhost/faxfonts
  851.  
  852.  
  853. all:
  854.     for i in \$(SUBS) ; do \
  855.         ( cd \$\$i ; make \$(MFLAGS) 'CC=\$(CC)' 'CFLAGS=\$(CFLAGS)' 'LDFLAGS=\$(LDFLAGS)' all ); \
  856.     done
  857.  
  858. install:
  859.     for i in \$(SUBS) ; do \
  860.         ( cd \$\$i ; make \$(MFLAGS) 'LOCALBIN=\$(LOCALBIN)' 'MANSHELF=\$(MANSHELF)' 'FAXLIB=\$(FAXLIB)' 'FAXFMODE=\$(FAXFMODE)' install ); \
  861.     done
  862.  
  863. clean:
  864.     -rm -f Part?? *.hdr fax.config
  865.     for i in \$(SUBS) ; do \
  866.         ( cd \$\$i ; make \$(MFLAGS) clean ); \
  867.     done
  868.  
  869. EOT
  870.  
  871. cat    >faxclient/Makefile <<EOT
  872. # Makefile for faxclient
  873.  
  874. all:        fax
  875.  
  876. fax:        fax.o
  877.         cc -o fax \$(LDFLAGS) fax.o
  878.  
  879. fax.o:        fax.c
  880.         cc \$(CFLAGS) -c fax.c
  881.  
  882. install:    bininstall maninstall
  883.  
  884. bininstall:    fax
  885.         cp fax \$(LOCALBIN)
  886.  
  887. maninstall:    fax.1
  888.         cp fax.1 \$(MANSHELF)/man1
  889.         chmod 644 \$(MANSHELF)/man1/fax.1
  890. clean:
  891.         -rm -f *.o *.a core fax
  892.  
  893. EOT
  894.  
  895. cat    >faxhost/Makefile <<EOT
  896. # Makefile for faxhost
  897.  
  898. FAXCLEANUP =    faxcleanup.o faxlog.o
  899. SENDFAX =    sendfax.o wiring.o faxlog.o
  900. SPOOLFAX =    spool.fax.o faxlog.o
  901. TEXTTOPBM =    texttopbm.o fntwrite.o
  902. FAXHDR =    ../faxconfig.h
  903.  
  904. PGMS =        faxcleanup sendfax spool.fax texttopbm
  905. TEXTFILES =    fax.config textfaxl.font textfaxh.font
  906.  
  907. all:        \$(PGMS)
  908.  
  909. faxcleanup:    \$(FAXHDR) \$(FAXCLEANUP)
  910.         cc -o faxcleanup \$(LDFLAGS) \$(FAXCLEANUP)
  911.  
  912. sendfax:    \$(FAXHDR) sierracmd.h \$(SENDFAX)
  913.         cc -o sendfax \$(LDFLAGS) \$(SENDFAX)
  914.  
  915. spool.fax:    \$(FAXHDR) \$(SPOOLFAX)
  916.         cc -o spool.fax \$(LDFLAGS) \$(SPOOLFAX)
  917.  
  918. texttopbm:    \$(FAXHDR) \$(TEXTTOPBM)
  919.         cc -o texttopbm \$(LDFLAGS) \$(TEXTTOPBM)
  920.  
  921. install:
  922.         cp \$(PGMS) \$(FAXLIB)
  923.         cp ../fax.config \$(FAXLIB)
  924.         for i in \$(TEXTFILES) ; do \
  925.             ( chmod \$(FAXFMODE) \$(FAXLIB)/\$\$i ); \
  926.         done
  927.         for i in \$(PGMS) ; do \
  928.             ( chmod 0500 \$(FAXLIB)/\$\$i ); \
  929.         done
  930.         chmod 6711 \$(FAXLIB)/spool.fax
  931.         chown root.daemon \$(FAXLIB)/*
  932.  
  933. clean:
  934.         -rm -f *.o *.a core \$(PGMS)
  935.  
  936. EOT
  937.  
  938. cat    >faxhost/faxfonts/Makefile <<EOT
  939. # Makefile for faxhost/faxfonts
  940.  
  941. # path for textfax?.font is hardwired into diykit [in ../../faxconfig.h]
  942. all:        diykit lores.data hires.data \
  943.             $faxlib/textfaxl.font $faxlib/textfaxh.font
  944.  
  945. diykit:        diykit.o
  946.         cc -o diykit \$(LDFLAGS) diykit.o
  947.  
  948. diykit.o:    ../../faxconfig.h diykit.h diykit.c
  949.         cc \$(CFLAGS) -c diykit.c
  950.  
  951. # path for textfax?.font is hardwired into diykit [in ../../faxconfig.h]
  952. $faxlib/textfaxl.font: lores.data
  953.         ./diykit
  954.  
  955. $faxlib/textfaxh.font: hires.data
  956.         ./diykit
  957.  
  958. lores.data:    lores.uue
  959.         uudecode lores.uue && uncompress lores.data.Z
  960.  
  961. hires.data:    hires.uue
  962.         uudecode hires.uue && uncompress hires.data.Z
  963.  
  964.  
  965. install:
  966.  
  967. clean:
  968.         -rm -f *.o *.a *.data core diykit
  969.  
  970. EOT
  971.  
  972. # end of FaxConfig
  973.