diff -r -u -N mpage-2.5.1/Makefile mpage-win32/Makefile --- mpage-2.5.1/Makefile Tue Mar 17 00:52:40 1998 +++ mpage-win32/Makefile Sat Mar 6 16:45:04 1999 @@ -27,10 +27,12 @@ # marcel@mesa.nl info@mesa.nl # -# Set this to an ANSI compatible C compiler (preferably gcc) -# See also system specific settings below -#CC=cc -CC=gcc + +# Makefile for Visual C++ 4.0 under NT. Requires GNU Make. +# +# NT port hacked by Petteri Kangaslampi + +CC=cl ############################################################################ # @@ -56,11 +58,14 @@ SPOOL_TYPE=BSD_SPOOLER # PREFIX=e:/usr # OS/2 type -PREFIX=/usr/local -BINDIR=$(PREFIX)/bin +#PREFIX=/usr/local +PREFIX=c:/utils +BINDIR=$(PREFIX) LIBDIR=$(PREFIX)/lib MANDIR=$(PREFIX)/man/man1 +# Under win32 the libraries are searched from binarydir/mpage-lib by default + # # A default encoding is given in encoding.h. Setting ENCODING=1 will # activate this encoding by default. 0 switches default off. @@ -74,7 +79,10 @@ SHEETMARGIN=20 -DEFS = -DPAGE_DEF=\"${PAGESIZE}\" -DLIBDIR=\"${LIBDIR}/mpage\" -DDEFAULT_ENCODING=${ENCODING} -DDEFAULTSMARGIN=${SHEETMARGIN} -DSPOOLER=${SPOOL_TYPE} +DEFS = -DPAGE_DEF=""${PAGESIZE}"" -DLIBDIR=""${LIBDIR}\\mpage"" -DDEFAULT_ENCODING=${ENCODING} -DDEFAULTSMARGIN=${SHEETMARGIN} -DSPOOLER=${SPOOL_TYPE} + +# Define for Win32: +DEFS += -DWIN32 -DNO_PRINTING ############################################################################ @@ -84,8 +92,8 @@ ############################################################################ # Unix extensions -E = -O = .o +# E = +# O = .o # OS/2: # CFLAGS = -O2 $(DEFS) -Wall @@ -95,8 +103,8 @@ # O = .o # MSDOS extensions -# E = .exe -# O = .obj +E = .exe +O = .obj ############################################################################ # @@ -108,7 +116,7 @@ # If you are using gcc, you probably don't need to change anything here. # Linux: -CFLAGS = -O2 -s $(DEFS) -Wall +#CFLAGS = -O2 -s $(DEFS) -Wall # AIX (xlC on aix 4): #CFLAGS = -O2 -s $(DEFS) @@ -126,6 +134,15 @@ # BeOS #CFLAGS= -O2 $(DEFS) +# Visual C++ 4.0: +CFLAGS = -c -Ot -MT -W3 -WX $(DEFS) + + +# Linker: +LINK = link +LINKFLAGS = + + ############################################################################ # # END OF CONFIGURATION OPTIONS @@ -133,7 +150,8 @@ # pattern rules. Should we define these? %$(O): %.c - $(CC) $(CFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) $< +# $(CC) $(CFLAGS) -c -o $@ $< HEAD = mpage.h @@ -147,10 +165,12 @@ @echo Done! mpage$(E): $(MOBJ) - $(CC) $(CFLAGS) -o mpage$(E) $(MOBJ) $(LIBS) + $(LINK) $(LINKFLAGS) -OUT:mpage$(E) $(MOBJ) +# $(CC) $(CFLAGS) -o mpage$(E) $(MOBJ) $(LIBS) msample$(E): $(SOBJ) - $(CC) $(CFLAGS) -o msample$(E) $(SOBJ) $(LIBS) + $(LINK) $(LINKFLAGS) -OUT:msample$(E) $(MOBJ) +# $(CC) $(CFLAGS) -o msample$(E) $(SOBJ) $(LIBS) clean: rm -rf $(MOBJ) mpage$(E) mpage.ps $(SOBJ) msample$(E) make.log core @@ -174,8 +194,8 @@ install: if [ ! -d $(LIBDIR)/mpage ] ; then mkdir -p $(LIBDIR)/mpage ; fi if [ ! -d $(BINDIR) ] ; then mkdir -p $(BINDIR) ; fi - if [ ! -d $(MANDIR) ] ; then mkdir -p $(MANDIR) ; fi +# if [ ! -d $(MANDIR) ] ; then mkdir -p $(MANDIR) ; fi cp mpage$(E) $(BINDIR) - cp mpage.1 $(MANDIR) +# cp mpage.1 $(MANDIR) -cp Encodings/* $(LIBDIR)/mpage - -chmod 644 $(LIBDIR)/mpage/* +# -chmod 644 $(LIBDIR)/mpage/* diff -r -u -N mpage-2.5.1/README.WIN32 mpage-win32/README.WIN32 --- mpage-2.5.1/README.WIN32 Thu Jan 1 02:00:00 1970 +++ mpage-win32/README.WIN32 Sat Mar 6 16:45:04 1999 @@ -0,0 +1,55 @@ +README.WIN32 - mpage 2.5.1 for Windows NT and 95 - 05 March 1999 + +Port by Petteri Kangaslampi . All changes in the Win32 port +are released to the public domain, but all the original code is covered by +the mpage copyright. See the file "README" for details. + + + +WIN32 NOTES: + +To compile, you'll need Microsoft Visual C++ and GNU Make. At least VC++ 4.0 +work, later versions should work as well. GNU Make 3.75 from the Cygnus +GNU-Win32 Beta19 works, other GNU Make ports should work too, and modifying +the Makefile to work with nmake shouldn't be very difficult. + +All printing support is disabled in the Win32 port, so the PostScript is +always written to standard output. Direct it to a file and send the file to a +PostScript printer to print it. Otherwise all functionality should be +available. + +The source code should compile and work in Unix-like environments as well, +but this has not been tested. The Makefile defaults for Win32 compilation. + + + +INSTALLING: + +Simply copy the file "mpage.exe" to a directory in your $PATH. If you with to +use non-default encodings, copy the files from the "Encoding" directory to a +directory named "mpage-lib" under the executable directory. Alternatively, +you can set the MPAGE_LIB environment variable to point to the Encodings +directory. For example: + + copy mpage.exe c:/utils + mkdir c:/utils/mpage-lib + copy Encodings/* c:/utilrs/mpage-lib + + + +USING MPAGE: + +See the README file and the manual page for details. The manual page is +available as both nroff source ("mpage.1") and preformatted test +("mpage.man"). + + + +AVAILABILITY: + +The source code, binaries, and source diffs against the official release are +available at http://www.s2.org/mpage/. + + + +-- Petteri Kangaslampi diff -r -u -N mpage-2.5.1/file.c mpage-win32/file.c --- mpage-2.5.1/file.c Wed Nov 26 01:14:31 1997 +++ mpage-win32/file.c Sat Mar 6 16:45:04 1999 @@ -43,10 +43,12 @@ /* * if we have the pr option, then we have to assume it's a text file */ +#ifndef NO_PRINTING if (opt_pr) { do_pr_file(fname, asheet, outfd); return; } +#endif /* * if not using pr(1), open fname and try to figure out what type of * file it is @@ -90,6 +92,7 @@ +#ifndef NO_PRINTING /* * do_file processes one text file into postscript, but first runs the file * through pr(1). @@ -129,6 +132,7 @@ return; } /* do_pr_file */ +#endif /* #ifndef NO_PRINTING */ @@ -140,6 +144,7 @@ struct sheet *asheet; FILE *outfd; { +#ifndef NO_PRINTING FILE *fd; char command[LINESIZE]; char tmpfile[LINESIZE]; @@ -208,7 +213,9 @@ Debug(DB_STDIN, "%% now remove '%s'\n", tmpfile); (void)unlink(tmpfile); } - else { + else +#endif /* #ifndef NO_PRINTING */ + { /* * check for the cutomary flag at the start of postscript files */ diff -r -u -N mpage-2.5.1/mpage.c mpage-win32/mpage.c --- mpage-2.5.1/mpage.c Mon Jan 12 00:29:17 1998 +++ mpage-win32/mpage.c Sat Mar 6 16:45:04 1999 @@ -24,6 +24,10 @@ * */ +#ifdef WIN32 +#include +#endif + #include "mpage.h" #include #include @@ -35,6 +39,9 @@ * Function Declarations */ static void ps_title(); +#ifdef WIN32 +static void win32_libdir(void); +#endif @@ -47,7 +54,9 @@ int currarg; struct sheet *thelist; struct sheet *thesheet; +#ifndef NO_PRINTING char outcommand[LINESIZE]; /* the command which is the output filter */ +#endif @@ -58,6 +67,11 @@ _wildcard (&argc, &argv); #endif +#ifdef WIN32 + /* Build default libdir based on the executable location: */ + win32_libdir(); +#endif + /* * examine the environment for PRINTER (or LPDEST) and MPAGE * environment variables @@ -76,6 +90,7 @@ * if a print queue was specified then create a print command using * the queue, else use standard output. */ +#ifndef NO_PRINTING /* No printing for Win32 */ if (doprint) { if (printque != NULL) (void) sprintf(outcommand, "%s %s%s", @@ -89,6 +104,7 @@ } } else +#endif outfd = stdout; /* @@ -195,8 +211,10 @@ /* * proper clean up to make sure the pipe is flushed */ +#ifndef NO_PRINTING if (doprint) (void) pclose(outfd); +#endif return 0; @@ -324,3 +342,29 @@ } /* ps_title */ + + +#ifdef WIN32 +static char win32libdir[512]; +void win32_libdir(void) +{ + char *c; + + /* Get the executable full path name: */ + if ( !GetModuleFileName(NULL, win32libdir, 511) ) + { + fprintf(stderr, "%s: Panic! GetModuleFileName() failed!\n", MPAGE); + exit(EXIT_FAILURE); + } + + /* Strip out the executable file name: */ + c = win32libdir + strlen(win32libdir); + while ( *c != '\\' ) + *(c--) = 0; + + /* Append mpage-lib: */ + strcat(win32libdir, "mpage-lib"); + + libdir = win32libdir; +} +#endif diff -r -u -N mpage-2.5.1/mpage.h mpage-win32/mpage.h --- mpage-2.5.1/mpage.h Wed Mar 25 00:07:58 1998 +++ mpage-win32/mpage.h Sat Mar 6 16:45:04 1999 @@ -31,9 +31,20 @@ * logical or virtual entity, and "sheet" is physical entity. */ +#ifndef _MSC_VER #include +#endif #include #include + +/* A quick'n'dirty NT hack: */ +/* +#define PAGE_DEF "A4" +#define LIBDIR "c:/utils/lib/mpage" +#define DEFAULT_ENCODING 1 +#define DEFAULTSMARGIN 20 +#define SPOOLER BSD_SPOOLER +*/ # define VERSION "2.5.1pre2 March 1998" diff -r -u -N mpage-2.5.1/mpage.man mpage-win32/mpage.man --- mpage-2.5.1/mpage.man Thu Jan 1 02:00:00 1970 +++ mpage-win32/mpage.man Sat Mar 6 16:45:04 1999 @@ -0,0 +1,528 @@ + + + +Misc. Reference Manual Pages MPAGE(Local) + + + +NNAME + mpage - print multiple pages per sheet on PostScript printer + + +SYNOPSIS + mpage [-1248aAcEfHloOrRStUvxX] [-b papersize] + [-B[num[lrtb]*] [-C [encoding]] [-da|p] [-D dateformat] + [-F fontname] [-h header] [-j first[-last][%interval]] + [-L lines] [-m[num[lrtb]*] [-M[num[lrtb]*] [-p[prprog]] + [-P[printer]] [-s tabstop] [-W width] [-z printcmd] + [-Z printcmd_args] [file...]] + + + + + +DESCRIPTION + mpage reads plain text files or PostScript documents and + prints them on a PostScript printer with the text reduced in + size so that several pages appear on one sheet of paper. + This is useful for viewing large printouts on a small amount + of paper. It uses ISO 8859.1 to print 8-bit characters. + + + The following options are recognized (note that arguments to + options may be separated from the option by spaces, except + for -B, -m, -M, -p and -P): + + + -1 Print 1 normal page per sheet (included for symmetry). + + + -2 Print 2 normal pages per sheet. + + + -4 Print 4 normal pages per sheet (default). + + + -8 Print 8 normal pages per sheet. + + + -a Toggle layout of the pages on the sheet so that succes- + sively numbered pages run down the sheet, as opposed to + left to right. (default updown) . + + + -A This option is deprecated, see -b. Prepare output for + European A4 sized paper. For default see 'mpage -x'. + + + -bpapertype + Prepare output for selected paper type. Papersize can + + + +SunOS 5.6 Last change: 98/03/15 1 + + + + + + +Misc. Reference Manual Pages MPAGE(Local) + + + + be A3 for European A3, A4 for European A4, Letter for + US Letter or Legal for Legal sized paper. For default + see 'mpage -x'. To see the list of currently available + types, just give the 'mpage -bl' or 'mpage -b?' command + (Note: mpage exits after finding such option use.) + + + -B[[lrtb]*] + Setup a box around a particular part of your page. + Specify text box margins and line thickness. The + default is 0 columns (lines) for both left and right + (top and bottom) margins and 0 line thickness. Speci- + fying -B solely toggles printing of the box. l, r, t or + b set the left, right, top or bottom margin respec- + tively to columns (lines). Not specifying any of + the sides, will set the line thickness when is + given. For example -B1 sets the line thickness to 1. + Sides with negative margins will not print. + + + -c Toggle concatenation off pages from different files on + single sheets (default off). + + + -C[encodingfile] + Specify the character encoding file. The file should + be in the mpage library directory + (/usr/local/lib/mpage). Mpage has an internal default + encoding based on Latin-1 or IBM codepage 850. Depend- + ing on compile time option this encoding definition is + on or not. Not specifying an encodingfile will toggle + the usage of the internal encoding. + + + -da|p + Force input to be taken as ascii (a) or postscript (p) + text. This way you can print your postscript code as + text, or print postscript code that mpage does not + recognise. When using -dp, make sure that the the + postscript code contains %Page page separators or else + things will probably look odd. + + + -Ddateformat + Set the date format as in strftime(3) to be used in + date/time representations (e.g. in headers). + + + -E Print 2 normal pages per sheet. However, this option + will print every second and third page of every set of + four pages. This option will ignore -a and -l. + + + + +SunOS 5.6 Last change: 98/03/15 2 + + + + + + +Misc. Reference Manual Pages MPAGE(Local) + + + + -f Toggles folding lines longer than page width (default + off) . + + + -Ffontname + Specify font. (default Courier). + + + -hheader + This is used only when the -p or -H switch is used and + is passed as the "-h header" option to pr(1) or as the + header for -H. + + + -H Create header line for each logical page separated from + page text by a horizontal line. Unless -h is given, the + header consist of last file changetime, filename and + page number, all in bold and slightly larger font. + This option only applies to non-postscript files. + + + -Iindent + Indent text by indent characters. + + + -jfirst[-last][%interval] + Print just the selected sheets, specified by number, + starting at 1. Here last defaults to the end of data, + interval to 1. Thus -j1-10 selects the first 10 + sheets, while -j 1%2 prints just the odd-numbered + sheets and -j 2%2 prints just the even ones. + + You can do double-sided printing, in two passes, as + follows. If you use 3-hole punched paper, put it in + the printer such that the holes will appear at the top + of the page -- on the right as you pull out the printer + tray, in our Laser writer II NTX. Print the odd- + numbered sheets with + + + mpage ... -j 1%2 ... + + Note the number of pages it reports. (Only half this + many will really be printed). When printing finishes, + if mpage reported an odd number of pages, remove the + last one from the stack, since there will be no even- + numbered sheet to match it. Then arrange the stack of + paper for printing on the other side. (If it's + punched, the holes will now be on the left.) On our II + NTX, the paper comes out blank-side up; replace it in + the tray still blank-side up but rotated 180 degrees. + For other printers, you figure it out. Now print the + + + +SunOS 5.6 Last change: 98/03/15 3 + + + + + + +Misc. Reference Manual Pages MPAGE(Local) + + + + even-numbered sheets in reverse order with + + + mpage ... -r -j 2%2 ... + + hoping no one else reaches the printer before you do. + + + -k When mapge finds a %%TRailer or %%PSTrailer in the + postscript input file it normally assumes this is the + end of the postscript file and stops reading the input + file. But when the PS file includes EPS files, + %%Trailers might be anywhere. Using this option ignores + the %%TRailer and %%PSTRailer lines. + + -l Toggle printing landscape or portrait mode. Landscape + pages are 55 lines long by 132 characters wide by + default. Portrait pages are 66 lines long by 80 charac- + ters wide by default. (default portrait.) + + + -Llines + Adjust the page reduction parameters so that lines + lines will fit in the space of one page. This over- + rides the default values normally supplied. (See -l.) + If used in conjunction with -p then this value is + passed to the pr(1) as well. As a side effect this + changes the font size as well (as will the -W option.) + So while there is an option to change font family, + there is no explicit option to change font size! + + + -m[[lrtb]*] + Specify sheet margin. The default margin is 20 points. + Only specifying -m sets left margin to 40 points. l, r, + t or b set left, right, top or bottom margin respec- + tively to points. Not specifying any of the + sides will set all sides when is given. + defaults to 40 points. For example -m10 sets all mar- + gins to 10 points. -ml50tb sets left margin to default + 40 and top and bottom margin to 50 points. - + m50l25bt30r set bottom and top margin to 25, left mar- + gin to 50 and right margin to 30 points. Margins can + have negative numbers. Very large values have funny + effects. This is left as an exercise to the user. + + + -M[[lrtb]*] + Specify logical page margins. For syntax, see -m + option. Defaults are 4 for -M solely, and 8 for . + Margins can be negative. This way large white borders + in your (postscript) documents can be reduced. Very + + + +SunOS 5.6 Last change: 98/03/15 4 + + + + + + +Misc. Reference Manual Pages MPAGE(Local) + + + + large values have funny effects. This is left as an + exercise to the user. + + + -o Toggle printing of outlines around each reduced page + (default on). + + + -O Print 2 normal pages per sheet. However, this option + will print every first and forth page of every set of + four pages. This option will ignore -a and -l. + + + -p[prprog] + Pipe input through prprog command (including specified + options) before printing (assumes the input is a text + file). When no command is specified, it defaults to + pr(1). + + + -P[printer] + Specify the printer to which the PostScript output will + be sent (e.g.lpr -Pprinter). Using -P with no printer + specified will send the PostScript to the default + printer queue (e.g. lpr). Using -P- will return output + to stdout, useful in combination with MPAGE environment + variable. Without -P output will be send to standard + output. + + + -r Reverse printing. The last sheet is printed first. + The way of arranging reduced pages on the sheets + doesn't change. + + + -R Switch to left to right mode, starting first page on + left bottom corner. This might be useful for landscape + postscript files. (Note: using -l after -R undoes -R, + and switches to normal landscape mode. + + + -stabstop + Set tabstop width (default 8 characters). Should by >= + 2. + + + -S Accept non-square page reduction. By default, pages + are shrunk equally in X and Y, even if this wastes some + space on the sheet. With -S, reduced pages are larger + but slightly distorted. (only used when printing + postscript files.) + + + + +SunOS 5.6 Last change: 98/03/15 5 + + + + + + +Misc. Reference Manual Pages MPAGE(Local) + + + + -t Toggle printing on both sides of the paper. This will + toggle duplex mode of the printer. Use this option + only if your printer is capable of printing in duplex + mode. (default off). + + + -T Toggle tumble of every second pages when printing in + duplex mode. Use this option only if your printer is + capable of printing in duplex mode and together with - + t. + + + -U This option is deprecated, see -b. Prepare output for + US Letter sized paper. For default see 'mpage -x'. + + + -v Toggle printing a count of the number of sheets pro- + duced for printing (default off.) + + + -Wwidth + Adjust the page reduction parameters so that a line + with width characters long will fit in the space of one + page. This overrides the default values normally sup- + plied. (See -l.) If used in conjunction with -p then + this value is passed to the s pr(1) program as well. + See also the -L option on font sizes. + + + -x Force usage display, which also shows current defaults. + + + -X [header] + Print header centered on each physical page (sheet). + If no header is given, the default is the current + filename (note -c) on the left and the page number on + the right. + + + -zprintcommand + Specify command to use to send output to. Default is + lpr (1) for BSD style spooler, lp (1) for SYSV style + spooler. You can specify command line options, but + note -Z. For example -zlp for system V Unix. + + + -Zprintprog_queuename_arg + Specify what option to use for the "-z printcommand" to + specify a printqueue. For example -zlp -Z-d for system + V Unix. Default is -P for BSD style spooler, -d for + SYSV style spooler. + + + + +SunOS 5.6 Last change: 98/03/15 6 + + + + + + +Misc. Reference Manual Pages MPAGE(Local) + + + +ENVIRONMENT + mpage examines the PRINTER (or LPDEST for SYSV style + spooler) environment variable to override its default + printer. + + + The MPAGE_LIB environment variable can be used to control + where the character encoding files (-C) can be found. + + + mpage also examines the MPAGE environment variable for + default option settings. Any option or combination of + options can be specified in the MPAGE environment variable. + For example, if MPAGE is set to the string: + + -2oPqms -L60 + + it would (in the absence of other command line arguments) + print 2 pages per sheet, 60 lines per page, with outlines, + on the printer named qms (overriding the PRINTER/LPDEST + environment variable, if it exists.) In the environment + variable, white space is used as an option delimiter, and no + quoting is recognized. + + + Any command line options will override both the PRINTER and + MPAGE environment variables. + + +FILES + /usr/tmp/mpageXXXXXX + /usr/local/lib/mpage + + +BUGS + Suffers under the burden of far too many switches. (But you + wanted the choices!) + + NULL characters in a postscript input file will cause mpage + to crash! + + Many others, w're sure. + + Mpage is year 2000 compliant, as long as the underlying + operating system is!!! + + +VERSION + Version 2.5.1 pre, Released March 1998. + Location: + + http://www.mesa.nl/pub/mpage + + + +SunOS 5.6 Last change: 98/03/15 7 + + + + + + +Misc. Reference Manual Pages MPAGE(Local) + + + + ftp://ftp.mesa.nl/pub/mpage + +AUTHORS + Marcel Mol (current maintainer). + + Mark P. Hahn (Original author) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +SunOS 5.6 Last change: 98/03/15 8 + + + diff -r -u -N mpage-2.5.1/page.c mpage-win32/page.c --- mpage-2.5.1/page.c Tue Mar 24 23:05:20 1998 +++ mpage-win32/page.c Sat Mar 6 16:45:04 1999 @@ -28,6 +28,9 @@ #include "mpage.h" #include "string.h" +#ifdef _MSC_VER +# define strcasecmp _stricmp +#endif void diff -r -u -N mpage-2.5.1/sample.c mpage-win32/sample.c --- mpage-2.5.1/sample.c Wed Nov 26 01:15:00 1997 +++ mpage-win32/sample.c Sat Mar 6 16:45:04 1999 @@ -43,7 +43,7 @@ do_sample(); - exit(0); + return 0; }