[comp.sources.unix] v24i043: Email fax-sending package, Part05/05

rsalz@uunet.uu.net (Rich Salz) (03/14/91)

Submitted-by: klaus u schallhorn <cnix!klaus>
Posting-number: Volume 24, Issue 43
Archive-name: faxpax/part05

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# Contents:  Howto.Install faxhost/faxfonts/diy_codep861.def
#   faxhost/faxfonts/diy_ibmpc.def faxhost/faxfonts/diy_iso.def
#   faxhost/faxlog.c faxhost/texttopbm.c sample.dot.faxrc
# Wrapped by rsalz@litchi.bbn.com on Wed Mar 13 14:08:04 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
echo If this archive is complete, you will see the following message:
echo '          "shar: End of archive 5 (of 5)."'
if test -f 'Howto.Install' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'Howto.Install'\"
else
  echo shar: Extracting \"'Howto.Install'\" \(3828 characters\)
  sed "s/^X//" >'Howto.Install' <<'END_OF_FILE'
XThis is faxpak - the "how to do" bit.
X
XYou need all the bits and pieces that come with it. You also need 
XJef Poskanzer's pbmplus kit. If you have it installed on your system, 
Xyou need to replace pbmtog3.c with the version that is included 
Xin faxpak [there's only eol and eop differences fired up by a new 
X"-sierra" option]. If you don't have pbmplus, it's been posted to
Xcomp.sources.misc/vol9. I understand, Jef is currently [Feb '91] 
Xin the process of preparing an updated pbmplus kit for posting.
XIf you can't findt pbmplus locally, try varies archive servers [ic and
Xukc are good places in the uk]. If all else fails, try mailing 
Xjef@well.sf.ca.us.
X
X
XUsing sierra type fax modems I found pbmtog3 too close to the standard 
X- sierra type faxmodems are not, and fail therefore on page confirmation
Xor multipage faxes to SOME fax machines on SOME g3 files. The brute force
Xfix I made overcomes this. It's ugly too.
X
XRead readme. Run FaxConfig, to get faxconfig.h, FAXLIB/fax.config 
Xand some other bits and pieces.
X
XIf you're on a sun, make. If there's no smoke [there shouldn't be],
Xmake install
Xelse
X{
X	If you're running some other system, you have to know how to
X	get hardware flow control [termio(4) is a good place to start].
X	If you don't have hardware flow ctl, you might try xon/xoff.
X	I couldn't get it to work on a sun [don't tell me how it *should*
X	be done, unless you get it to work in practice with a sierra
X	type modem [it likes to hang up on me when I use xon/xoff]].
X	I know how to drive printers and plotters with xon/xoff. At
X	least they don't drop the phone line.
X
X	Until you've sorted out flow ctl, use wiring.c as a stand alone
X	[and boy, you will feel alone] program. There's enough comments
X	to guide you to insanity.
X}
XOnce you you have wiring.c working [flow ctl problem sorted out],
Xyou have to have another look at faxconfig.h, FAXLIB/fax.config.
X
XYou also have to decide, who can and who cannot. Set up some files
Xfax.allow or fax.deny in FAXLIB, specifying either who is allowed
Xto fax, or who should be prevented from doing so [the logic, I think, 
Xis the same used by cron].
X
XIn fax.config you also can enter dialing codes vs timezones. See
Xexamples in FAXLIB/fax.config, if you want to send long distance
Xfaxes at cheap rates only.
X
XDon't forget to put a binary of "fax" on each server. You need one
Xfor each architecture supported. Keep a spare handy for those
Xemergencies. 
X
XThen add a line to cron specifying when sendfax is to doodle. I
Xhave it running once an hour from 1pm to 5pm, and twice an hour
Xafter that till 6am. Enter another line for faxcleanup. This is
Xa wire brush to free your disk of those faxes that absolutely won't
Xgo. I also made an entry in /usr/bin-I-think/newsyslog, to start
Xa new log file each week. I keep logs 4 weeks. If you set loglevel
X[in FAXLIB/fax.config] to 9, these logs are huge.
X
XOn our spooler FAXLIB is owned by root, spool.fax runs suid and
Xsgid root. The rest in FAXLIB is read/writeable by root only.
X
XThere are some stubs in various places for things I'm considering
Xor planning for release 1.0. There commented out or undef'ed.
XIgnore these for the time being.
X
XIf you get it to work on a non sun, please let me have the diffs or
Xthe modifications. If you make a diykit.def file for a charset not
Xcatered for in faxhost/faxfonts, please let me have a copy of that
Xtoo.
X
XThis is, as specified in various places, only version 0.99. After
Xgetting it to work at all, I will now shift the focus of attention
Xto producing output that is pretty [I'm doing this in my spare time,
Xso don't hold you breath].
X
XHave fun
X
Xklaus schallhorn, klaus@cnix.uucp
X
XYou can always mail me for the things I forgot. There are bound to be 
Xsome. You can do what you want with faxpak, except trying to sell
Xit. Don't make me start a price war. You're bound to lose.
END_OF_FILE
  if test 3828 -ne `wc -c <'Howto.Install'`; then
    echo shar: \"'Howto.Install'\" unpacked with wrong size!
  fi
  # end of 'Howto.Install'
fi
if test -f 'faxhost/faxfonts/diy_codep861.def' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'faxhost/faxfonts/diy_codep861.def'\"
else
  echo shar: Extracting \"'faxhost/faxfonts/diy_codep861.def'\" \(1489 characters\)
  sed "s/^X//" >'faxhost/faxfonts/diy_codep861.def' <<'END_OF_FILE'
X# 	char set layout ibm code page 861
X#
X#	note: this set does not contain 
X#	the full ibm pc char set. If I'm not mistaken
X#	only the pretty patterns are missing, though.
X#	chars defined in iso, but not implemented on ibm pc hardware
X#	have not been done.
X#
X# position in textfax{h,l}.font [decimal]
X#	defined name in diykit.h
X#			attempt at char description
X128	Ccidilla	# C cidilla
X129	uumlaut		# u umlaut
X130	eac		# e'
X131	acirc		# a^
X132	aumlaut		# a umlaut
X133	agr		# a`
X134	adot		# a dot
X135	ccidilla	# c cidilla
X136	ecirc		# e^
X137	eumlaut		# e umlaut
X138	egr		# e`
X139	Eth		# -D
X140	eth		# small icelandic eth
X141	thorn		# thorn
X142	Aumlaut		# A umlaut
X143	Aring		# A with ring above
X144	Eac		# E'
X145	ae		# ae
X146	AE		# AE
X147	ocirc		# o^
X148	oumlaut		# o umlaut
X149	Thorn		# cap. icelandic thorn
X150	ucirc		# u^
X### 151 ################ not defined in iso
X152	yac		# y'
X152	yumlaut		# y umlaut
X153	Oumlaut		# O umlaut
X154	Uumlaut		# U umlaut
X155	cent		# cent sign
X156	pound		# pound sign
X157	yen		# yen sign
X158	ptpc		# Pt as in ibmpc
X159	fpc		# f as in ibmpc
X160	aac		# a'
X161	iac		# i'
X162	oac		# o'
X163	uac		# u'
X164	Aac		# A'
X165	Iac		# I'
X166	Oac		# O'
X167	Uac		# U'
X168	invqu		# inverted ?
X### 169
X170	not		# not sign,
X171	half		# 1/2
X172	quarter		# 1/4
X173	invexcl		# inverted !
X174	angledleft	# <<
X175	angledrite	# >>
X#
X225	germss		# small german letter sharp 's'
X#
X#
X241	plusminus	# +-
X#
X246	div		# division sign
X#
X249	middot		# middle dot,
X#
X253	sup2		# superscript 2
X#
END_OF_FILE
  if test 1489 -ne `wc -c <'faxhost/faxfonts/diy_codep861.def'`; then
    echo shar: \"'faxhost/faxfonts/diy_codep861.def'\" unpacked with wrong size!
  fi
  # end of 'faxhost/faxfonts/diy_codep861.def'
fi
if test -f 'faxhost/faxfonts/diy_ibmpc.def' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'faxhost/faxfonts/diy_ibmpc.def'\"
else
  echo shar: Extracting \"'faxhost/faxfonts/diy_ibmpc.def'\" \(1494 characters\)
  sed "s/^X//" >'faxhost/faxfonts/diy_ibmpc.def' <<'END_OF_FILE'
X# 	char set layout ibm pc type
X#
X#	note: this set does not contain 
X#	the full ibm pc char set. If I'm not mistaken
X#	only the pretty patterns are missing, though.
X#	chars defined in iso, but not implemented on ibm pc hardware
X#	have not been done.
X#
X# position in textfax{h,l}.font [decimal]
X#	defined name in diykit.h
X#			attempt at char description
X128	Ccidilla	# C cidilla
X129	uumlaut		# u umlaut
X130	eac		# e'
X131	acirc		# a^
X132	aumlaut		# a umlaut
X133	agr		# a`
X134	adot		# a dot
X135	ccidilla	# c cidilla
X136	ecirc		# e^
X137	eumlaut		# e umlaut
X138	egr		# e`
X139	iumlaut		# i umlaut
X140	icirc		# i^
X141	igr		# i`
X142	Aumlaut		# A umlaut
X143	Aring		# A with ring above
X144	Eac		# E'
X145	ae		# ae
X146	AE		# AE
X147	ocirc		# o^
X148	oumlaut		# o umlaut
X149	ogr		# o`
X150	ucirc		# u^
X151	ugr		# u`
X152	yumlaut		# y umlaut
X153	Oumlaut		# O umlaut
X154	Uumlaut		# U umlaut
X155	cent		# cent sign
X156	pound		# pound sign
X157	yen		# yen sign
X158	ptpc		# Pt as in ibmpc
X159	fpc		# f as in ibmpc
X160	aac		# a'
X161	iac		# i'
X162	oac		# o'
X163	uac		# u'
X164	ntilde		# n~
X165	Ntilde		# N~
X166	femordind	# fem. ordinal ind., a_
X167	mascordind	# masc. ordinal ind., a_
X168	invqu		# inverted ?
X#
X170	not		# not sign,
X171	half		# 1/2
X172	quarter		# 1/4
X173	invexcl		# inverted !
X174	angledleft	# <<
X175	angledrite	# >>
X#
X225	germss		# small german letter sharp 's'
X#
X227	pilcrow		# pilcrow, us paragraph
X#
X241	plusminus	# +-
X#
X246	div		# division sign
X#
X249	middot		# middle dot,
X#
X253	sup2		# superscript 2
END_OF_FILE
  if test 1494 -ne `wc -c <'faxhost/faxfonts/diy_ibmpc.def'`; then
    echo shar: \"'faxhost/faxfonts/diy_ibmpc.def'\" unpacked with wrong size!
  fi
  # end of 'faxhost/faxfonts/diy_ibmpc.def'
fi
if test -f 'faxhost/faxfonts/diy_iso.def' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'faxhost/faxfonts/diy_iso.def'\"
else
  echo shar: Extracting \"'faxhost/faxfonts/diy_iso.def'\" \(2151 characters\)
  sed "s/^X//" >'faxhost/faxfonts/diy_iso.def' <<'END_OF_FILE'
X#	char set layout iso 8859/1
X#
X# position in textfax{h,l}.font [decimal]
X#	defined name in diykit.h
X#			attempt at character description
X161	invexcl		# inverted !
X162	cent		# cent sign
X163	pound		# pound sign
X164	currency	# currency sign
X165	yen		# yen sign
X166	brokenbar	# broken bar
X167	paragraph	# paragraph sign
X168	diaeresis	# diaeresis
X169	copyrite	# copyright sign
X170	femordind	# fem. ordinal ind., a_
X171	angledleft	# <<
X172	not		# not sign,
X173	softhyphen	# soft hyphen, same as dash
X174	tm		# registered trade mark
X175	macron		# macron, high -
X176	degree		# degree sign
X177	plusminus	# +-
X178	sup2		# superscript 2
X179	sup3		# superscript 3
X180	accacute	# accent acute'
X181	micro		# micro sign
X182	pilcrow		# pilcrow, us paragraph
X183	middot		# middle dot,
X184	cidilla		# cidilla,
X185	sup1		# superscript 1
X186	mascordind	# masc. ordinal ind., a_
X187	angledrite	# >>
X188	quarter		# 1/4
X189	half		# 1/2
X190	threequarts	# 3/4
X191	invqu		# inverted ?
X192	Agr		# A`
X193	Aac		# A'
X194	Acirc		# A^
X195	Atilde		# A~
X196	Aumlaut		# A umlaut
X197	Aring		# A with ring above
X198	AE		# AE
X199	Ccidilla	# C cidilla
X200	Egr		# E`
X201	Eac		# E'
X202	Ecirc		# E^
X203	Eumlaut		# E umlaut
X204	Igr		# I`
X205	Iac		# I'
X206	Icirc		# I^
X207	Iumlaut		# I umlaut
X208	Eth		# -D
X209	Ntilde		# N~
X210	Ogr		# O`
X211	Oac		# O'
X212	Ocirc		# O^
X213	Otilde		# O~
X214	Oumlaut		# O umlaut
X215	multipl		# multiplication
X216	ooblique	# O/
X217	Ugr		# U`
X218	Uac		# U'
X219	Ucirc		# U^
X220	Uumlaut		# U umlaut
X221	Yac		# Y'
X222	Thorn		# cap. icelandic thorn
X223	germss		# small german letter sharp 's'
X224	agr		# a`
X225	aac		# a'
X226	acirc		# a^
X227	atidle		# a~
X228	aumlaut		# a umlaut
X229	adot		# a dot
X230	ae		# ae
X231	ccidilla	# c cidilla
X232	egr		# e`
X233	eac		# e'
X234	ecirc		# e^
X235	eumlaut		# e umlaut
X236	igr		# i`
X237	iac		# i'
X238	icirc		# i^
X239	iumlaut		# i umlaut
X240	eth		# small icelandic eth
X241	ntilde		# n~
X242	ogr		# o`
X243	oac		# o'
X244	ocirc		# o^
X245	otilde		# o~
X246	oumlaut		# o umlaut
X247	div		# division sign
X248	ooblique	# o/
X249	ugr		# u`
X250	uac		# u'
X251	ucirc		# u^
X252	uumlaut		# u umlaut
X253	yac		# y'
X254	thorn		# thorn
X255	yumlaut		# y umlaut
END_OF_FILE
  if test 2151 -ne `wc -c <'faxhost/faxfonts/diy_iso.def'`; then
    echo shar: \"'faxhost/faxfonts/diy_iso.def'\" unpacked with wrong size!
  fi
  # end of 'faxhost/faxfonts/diy_iso.def'
fi
if test -f 'faxhost/faxlog.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'faxhost/faxlog.c'\"
else
  echo shar: Extracting \"'faxhost/faxlog.c'\" \(3865 characters\)
  sed "s/^X//" >'faxhost/faxlog.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <fcntl.h>
X#include <varargs.h>
X#include <errno.h>
X#include <time.h>
X
X#include "../faxconfig.h"
X
X/*
X	logging and locking for faxpak
X
X	first released version 0.99 [desperado version]
X	cleaned up Jan 22nd '91, 
X	Copyright (C) 1991, klaus schallhorn, klaus@cnix.uucp
X
X	Permission to use, copy, modify, and distribute this software 
X	and its documentation for any purpose and without fee is hereby 
X	granted, provided that the above copyright notice appear in 
X	all copies and that both that copyright notice and this permission 
X	notice appear in supporting documentation. 
X
X	This software is provided "as is" without express or implied warranty.
X*/
X
Xchar	lckname[256], logname[256];
Xextern	int errno;
Xextern	int blah;
X
X/*
X	enter something in faxlog file, lock it to have exclusive
X	access while we're writing
X	unlock when done
X*/
X
Xfax_log(va_alist)
Xva_dcl
X{
X	va_list args;
X	char *fmt;
X	int db_flag;
X	FILE *fp;
X
X	va_start(args);
X	db_flag = va_arg(args, int);
X	fmt = va_arg(args, char *);
X
X	if (db_flag == ERROR || (blah >= db_flag))
X	{
X		sprintf(lckname, "%s/FAX.LOG.LOCK", FAXLIB);
X		sprintf(logname, "%s/FAX.LOG", FAXLIB);
X
X		if (mklock(lckname, 3, 15))
X			return(ERROR);
X
X		if ((fp = fopen(logname, "a")) != NULL)
X		{
X			chmod(logname, FAXFMODE);
X			timestamp(fp,(time_t)0L);
X			if (db_flag == ERROR)
X				fprintf(fp,"[%05d] %2d ",getpid(),errno);
X			else fprintf(fp,"[%05d]    ",getpid());
X			vfprintf(fp, fmt, args);
X		}
X
X		fclose(fp);
X		unlink(lckname);
X	}
X	va_end(args);
X	return(0);
X}
X
X/*
X	same as fax_log, except we use an applications specific
X	log file during transmission of fax as to not encounter
X	any delays for waiting for a lock [we're on the phone now!].
X
X	fflushlog moves the contents of this temp file to the real
X	log file after hangup
X*/
Xfax_tlog(va_alist)
Xva_dcl
X{
X	va_list args;
X	int db_flag;
X	FILE *fp;
X	char *fmt;
X
X	va_start(args);
X
X	db_flag = va_arg(args, int);
X	fp = va_arg(args, FILE *);
X	fmt = va_arg(args, char *);
X
X	if (fp && (db_flag == ERROR || (blah >= db_flag)))
X	{
X		timestamp(fp,(time_t)0L);
X		if (db_flag == ERROR)
X			fprintf(fp,"[%05d] %2d ",getpid(),errno);
X		else fprintf(fp,"[%05d]    ",getpid());
X		vfprintf(fp, fmt, args);
X	}
X	va_end(args);
X	return(0);
X}
Xfflushlog(tlogname)
Xchar *tlogname;
X{
X	FILE *in, *out;
X	char buf[256];
X
X	sprintf(lckname, "%s/FAX.LOG.LOCK", FAXLIB);
X	sprintf(logname, "%s/FAX.LOG", FAXLIB);
X
X	if (mklock(lckname, 4, 60))	/* wait up to a minute */
X		return(ERROR);
X
X	if (((out = fopen(logname, "a")) != NULL)
X		&& ((in = fopen(tlogname, "r")) != NULL))
X	{
X		while (fgets(buf, 248, in) != NULL)
X			if (fputs(buf, out) == EOF)
X				return(ERROR);
X		fflush(out);
X		if (ferror(in) || ferror(out))
X			return(ERROR);
X		fclose(in);	/* if we have errors on one of these */
X		fclose(out);	/* it's likely that fax_log will produce */
X				/* errors as well, simply reboot ;-) */
X		if (!unlink(lckname))
X			return(0);
X	}
X	return(ERROR);
X}
X
Xmklock(lockname,nap,max_secs)
Xchar *lockname;
Xint nap,max_secs;
X{
X	int i,l;
X
X	i=0;			/* wait till logfile is avail */
X	while ((l = open(lockname, O_WRONLY | O_CREAT | O_EXCL, 0666)) == ERROR
X		&& errno == EEXIST)
X	{
X		if ((!max_secs) || (max_secs && (i == max_secs)))
X			return(ERROR);
X		sleep(nap);
X		i += nap;
X	}
X	if (l > ERROR)
X	{
X		close(l);
X		return(0);
X	}
X	return(ERROR);
X}
X
Xtimestamp(fp,alt)
XFILE *fp;
Xtime_t alt;
X{
X	time_t t;
X	struct tm *tml, *localtime();
X
X	if (alt)
X		t = alt;
X	else time(&t);
X	tml = localtime(&t);
X	++tml->tm_mon;		/* jan is 0 */
X
X	fprintf(fp,"%02d.%02d.%2d %02d:%02d:%02d ",
X		tml->tm_mday,tml->tm_mon,tml->tm_year,
X		tml->tm_hour,tml->tm_min,tml->tm_sec);
X}
X
X/*
X	mainly used in spool.fax [I think], used to inform
X	a user of his bad fortune
X*/
Xmailexit(s)
Xchar *s;
X{
X	char buf[256];
X
X	if (*s)
X	{
X		sprintf(buf,"echo \"spool.fax, pid %05d: error while spooling\" | mail %s",
X			getpid(),s);
X		system(buf);
X	}
X	exit(1);
X}
END_OF_FILE
  if test 3865 -ne `wc -c <'faxhost/faxlog.c'`; then
    echo shar: \"'faxhost/faxlog.c'\" unpacked with wrong size!
  fi
  # end of 'faxhost/faxlog.c'
fi
if test -f 'faxhost/texttopbm.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'faxhost/texttopbm.c'\"
else
  echo shar: Extracting \"'faxhost/texttopbm.c'\" \(3379 characters\)
  sed "s/^X//" >'faxhost/texttopbm.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <ctype.h>
X#include "../faxconfig.h"
X
X/*
X	texttopbm.c
X
X	crude frontent to fntwrite
X
X	first released version 0.99 [desperado version]
X	cleaned up Jan 28nd '91,
X	Copyright (C) 1991, klaus schallhorn, klaus@cnix.uucp
X
X	Permission to use, copy, modify, and distribute this software 
X	and its documentation for any purpose and without fee is hereby 
X	granted, provided that the above copyright notice appear in 
X	all copies and that both that copyright notice and this permission 
X	notice appear in supporting documentation. 
X
X	This software is provided "as is" without express or implied warranty.
X*/
X
Xint	fax_mode=COARSE;
Xchar	TEXTFONT[256], outname[256], tname[256];
Xunsigned char inbuf[1024];
Xchar	*strrchr();
Xchar	*PGM;
XFILE	*outfp;
Xextern	int font_type;
X
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X	FILE *fp = NULL;
X	int i, x, y;
X
X	if ((PGM = strrchr(argv[0], '/')) != NULL)
X		++PGM;
X	else PGM = argv[0];
X
X
X	outname[0] = TEXTFONT[0] = '\0';
X	for (i=1; i<argc; i++)
X	{
X		if (!strncmp(argv[i], "-h", 2))
X			fax_mode = FINE;
X		else if (!strncmp(argv[i], "-f", 2))
X		{
X			if (argv[i][2] == '/')
X				strcpy(TEXTFONT, &argv[i][2]);
X			else sprintf(TEXTFONT, "%s/%s", FAXLIB, &argv[i][2]);
X		}
X		else if (!strncmp(argv[i], "-i", 2))
X		{
X			if ((fp = fopen(&argv[i][2], "r")) == NULL)
X			{
X				fprintf(stderr,"%s: can't open %s\n",PGM,&argv[i][2]);
X				exit(1);
X			}
X		}
X		else if (!strncmp(argv[i], "-o", 2))
X			strcpy(outname, &argv[i][2]);
X	}
X
X	if (!TEXTFONT[0])
X	{
X		if (fax_mode == FINE)
X			sprintf(TEXTFONT, "%s/%s", FAXLIB, FAXHFONT);
X		else sprintf(TEXTFONT, "%s/%s", FAXLIB, FAXLFONT);
X	}
X
X	if (fp == NULL)
X	{
X		if (isatty(fileno(stdin)))
X		{
X			fprintf(stderr,"%s [-high_res -ffont -ifile -ofile]\n",PGM);
X			exit(2);
X		}
X		fp = stdin;
X	}
X
X	if ((!outname[0]) && isatty(fileno(stdout)))
X	{
X		fprintf(stderr,"%s: need -ofile or redirection\n",PGM);
X		exit(2);
X	}
X
X	if (font_init(TEXTFONT))
X		exit(3);
X
X	if (font_type == HP)
X	{
X		x = 2800;
X		y = 3600;
X	}
X	else if (font_type == FINE)
X	{
X		x = 1800;
X		y = 2200;
X	}
X	else
X	{
X		x = 1800;
X		y = 1100;
X	}
X				/* 9 by 12 inches, big enough for A4 */
X	if (mk_bm(x,y))		/* if we're using a 300 dpi bitmap */
X		exit(4);	/* allows me to use any hp ljet font <= 30 pts */
X				/* maybe even larger, but haven't tested that */
X	exit(texttopbm(fp));
X}
Xtexttopbm(fp)
XFILE *fp;
X{
X	int line, page, line_inc, line_max;
X
X	switch(font_type)
X	{
X	case HP:	line = line_inc = 50;	line_max = 3250;	break;
X	case COARSE:	line = line_inc = 16;	line_max = 1040;	break;
X	case FINE:	line = line_inc = 34;	line_max = 2080;	break;
X	}
X
X	page = 0;
X
X	if (outname[0])
X	{
X		sprintf(tname,"%s.%d",outname,page);
X		if ((outfp = fopen(tname, "w")) == NULL)
X		{
X			fprintf(stderr,"%s: can't create %s",PGM,tname);
X			return(ERROR);
X		}
X		chmod(tname, FAXFMODE);
X	} else outfp = stdout;
X
X	for (;;)
X	{
X		if (fgets(inbuf, 256, fp) == NULL)
X			line = 9999;	/* first write out bitmap */
X		else printstr(inbuf,line);
X				/* 300 dpi / (6 lines per inch) = 50 dots */
X		if ((line += line_inc) > line_max)
X		{
X			if (end_bm())
X				return(ERROR);
X			fclose(outfp);
X
X			if ((line > 9999) || (!outname[0])) /*done */
X				return(0);
X
X			sprintf(tname,"%s.%d",outname,++page);
X			if ((outfp = fopen(tname, "w")) == NULL)
X			{
X				fprintf(stderr,"%s: can't create %s",PGM,tname);
X				return(ERROR);
X			}
X			chmod(tname, FAXFMODE);
X			line = line_inc;
X		}
X	}
X}
END_OF_FILE
  if test 3379 -ne `wc -c <'faxhost/texttopbm.c'`; then
    echo shar: \"'faxhost/texttopbm.c'\" unpacked with wrong size!
  fi
  # end of 'faxhost/texttopbm.c'
fi
if test -f 'sample.dot.faxrc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sample.dot.faxrc'\"
else
  echo shar: Extracting \"'sample.dot.faxrc'\" \(168 characters\)
  sed "s/^X//" >'sample.dot.faxrc' <<'END_OF_FILE'
X# sample .faxrc
X# no $HOME should be without one
X#
Xresolution low
Xmail true
Xnow false
Xsave true
Xretfax (000) 123 4567 [this is my mother in law, don't use at day time]
END_OF_FILE
  if test 168 -ne `wc -c <'sample.dot.faxrc'`; then
    echo shar: \"'sample.dot.faxrc'\" unpacked with wrong size!
  fi
  # end of 'sample.dot.faxrc'
fi
echo shar: End of archive 5 \(of 5\).
cp /dev/null ark5isdone
MISSING=""
for I in 1 2 3 4 5 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 5 archives.
    rm -f ark[1-9]isdone
else
    echo You still must unpack the following archives:
    echo "        " ${MISSING}
fi
exit 0
exit 0 # Just in case...
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Use a domain-based address or give alternate paths, or you may lose out.