Computer Programming

part of Computing at At Net's End by Jeff Paquette
This website is supported with sales through Amazon.com. Thank you for your support.

MS Windows Utilities and Unix Ports

  • VisEmacs Integrate Emacs with MS Visual Studio

Other Items of Interest

Unsupported and Obsolete Items

  • less - a pager similar to more
  • GNU textutils - the GNU Text processing utilities
  • GNU findutils  - the GNU Find utilites including xargs and locate.
  • GNU Make - Precompiled binaries for Windows 9x and Windows NT
  • pr - Printing from GNU Emacs on Win32

Less for Win32

Less v3.74 has been released under the GPL. Binaries for Win32 are available at the Downloading less page.

Source code (and prebuilt binaries) can be downloaded from the official Less Homepage

Less v3.32 executables for Win32 - 03-10-1998 will remain available


Printing from GNU Emacs 19.x on Win32

Note: this information is obsolete as of Emacs 20.x

Frustrating, isn't it? Trying to do a Un*x-style lpr command on a Windows system can be trying...either your utility can print to stdout, but not read from stdin, or can read from stdin but not write to stdout. Sheesh! Well, that was my problem, at least. What I ended up doing was taking an old DOS utility, porting it to Win32 and adding an option to print to a printer specified by a UNC pathname. From there, all I had to do was add the following to my .emacs:


(setq lpr-command "pr")
(setq lpr-add-switches nil)
(setq lpr-switches '("-f" "-p55" "-P\\\\eng_admin\\ljiiisi" "-s"))

NOTE: If you are using cmdproxy as your shell and pr has stopped working for you, you need to make sure that lpr-switches is set as a list of options as shown above, rather than a list of a string of options as used to be shown above. This is due to a change in argument quoting.

Obviously, you need to substitue the UNC name of your printer right after the -P switch (here, my printer is \\eng_admin\ljiiisi). Port names are legal as well, i.e., LPT1: COM2: as are file names c:/temp/printme.

The only caveat to UNC names is if you use 4DOS or command.com as your command shell, your UNC name must conform to the 8.3 DOS-style naming conventions, at least under Windows 95. If you use 4NT, there doesn't seem to be a problem with long path components. If you are using tcsh, or some other Un*x-like shell, you may have to quote the UNC name differently. If so, let me know and I'll add that information here.

Without further ado, here's prwin32.zip. If you run into any problems with this utility, don't hesitate to let me know...the obligatory mailto: link is at the bottom of the page.

If the output of pr consists of nothing but the usage information, you're invoking either print-buffer or print-region, neither of which are wired to do the right thing with prwin32.

Apparently, the cause of all this trouble is rooted in the menus...as supplied, the menu item "Print buffer" calls a function in lpr.el called (no suprise here) print-buffer instead of the (now-working) function lpr-buffer. The difference here is that print-buffer attempts to run lpr-page-header-program to add headers to the output file before running my version of pr. To work around this, add the following to your .emacs:


; fix up the menu bar to use lpr-buffer instead of print-buffer
(define-key menu-bar-tools-menu [lpr-buffer] '("Lpr Buffer" . lpr-buffer))
(define-key menu-bar-tools-menu [lpr-region] '("lpr Region" . lpr-region))
(define-key menu-bar-tools-menu [print-buffer] nil)
(define-key menu-bar-tools-menu [print-region] nil)

Note: Please use the new Lpr Buffer menu item instead of Print Buffer. Print Buffer uses a different printing method than Lpr Buffer and as such does not work with this utility.

09-07-98 Note: Emacs 20.3.1 has builtin support for printing on a Windows system and this utility is no longer necessary. Since the source code was lost when my system went down, prwin32 is no longer begin maintained.


GNU Text processing utilites (textutils) v1.22

There is a more comprehensive port of the GNU utilities available at Sourceforge. The version provided here is no longer supported and I will no longer provide support for them. -- jdp 19 July 2001

This is a preliminary compilation of the GNU textutils text processing utilities for Win32 (Windows 95, Windows NT). Included utilities:

ansi2knr cat cksum comm csplit cut expand fmt fold head join md5sum nl od paste pr sort split sum tac tail tr unexpand uniq wc

Suprisingly, most of the utilities compiled right out of the archive, with the exception of tac, cat, tail, md5sum, and csplit due to Win32 not having SIGHUP or SIGQUIT, or kill. Even more suprisingly, they all seem to work!

As always, the usual caveat still applies: use at your own risk! No warranty is expressed or implied, etc, etc, ad naseaum. If you run into any difficulties, please drop me a line.

I added wildcard support to all utilities by linking in setargv.obj. Path information was stripped from argv[0] when reporting errors and usage information.

Note that in cat, I had to disable check_redirection; the logic invovled used st_ino (undefined on Win32 systems) to prevent shell constructs like cat file > file, so beware!

GNU Textutils-1.19 are also available.


GNU Find utilities (findutils) v4.1

There is a more comprehensive port of the GNU utilities available at Sourceforge. The version provided here is no longer supported and I will no longer provide support for them. -- jdp 19 July 2001

This is a preliminary compilation of the GNU findutils v4.1 for Win32 (Windows 95, Windows NT), with full support for long file names, both '\' and '/' as path separators, and drive letters. UNC pathnames are currently unsupported.

Notes: When using the -printf switch, you may have to escape or double up the percent signs to prevent the shell from parsing the format specifier as an environment variable.

Use -iname for case-insensitive matching. I could determine the case sensitivity for each file system being searched, and match case appropriately -- any comments?

Known problems with the Win32 version of GNU Findutils 4.1:


GNU Make v3.77

There is a more comprehensive port of the GNU utilities available at Sourceforge. The version provided here is no longer supported and I will no longer provide support for them. -- jdp 19 July 2001

This is an archive containing GNU Make 3.77 binaries for Windows 95 and Windows NT. It is being provided as a convienence for those of you without means to build it from the sources. GNU Make 3.75 is also available.


Comments? <paquette@atnetsend.net>
Last modified: Mon Dec 9 21:13:34 EST 2002