# Makefile for Eric Raymond's silly hex dumper
-# Note: When the version changes, you also have to change
-# * the name of the containing directory
-# * the RPM spec file
-VERS=1.1
+# Note: When the version changes, you also have to change the RPM spec file
+VERS=1.2
hex: hex.c
+ $(CC) -DVERSION=\"$(VERS)\" -O hex.c -o hex
SOURCES = READ.ME Makefile hex.c hex.1 hex.lsm hex.spec
-hex-$(VERS).tar: $(SOURCES)
- tar --name-prefix "hex-$(VERS)/" -cvf hex-$(VERS).tar $(SOURCES)
-hex-$(VERS).tar.gz: hex-$(VERS).tar
- gzip -f hex-$(VERS).tar
-
-hex.shar: $(SOURCES)
- shar $(SOURCES) >hex.shar
+hex-$(VERS).tar.gz:
+ @ls $(SRC) | sed s:^:hex-$(VERS)/: >MANIFEST
+ @(cd ..; ln -s hex hex-$(VERS))
+ (cd ..; tar -czvf hex/hex-$(VERS).tar.gz `cat hex/MANIFEST`)
+ @(cd ..; rm hex-$(VERS))
clean:
- rm -f hex hex.tar hex.shar
+ rm -f hex hex-$(VERS).tar.gz *.rpm
+
+dist: hex-$(VERS).tar.gz
RPMROOT=/usr/src/redhat
RPM = rpm
RPMFLAGS = -ba
-rpm: hex-$(VERS).tar.gz
- cp hex-$(VERS).tar.gz $(RPMROOT)/SOURCES/hex-$(VERS).tar.gz
- cp hex.spec $(RPMROOT)/SPECS/hex.spec
- $(RPM) $(RPMFLAGS) hex.spec
+rpm: dist
+ cp hex-$(VERS).tar.gz $(RPMROOT)/SOURCES;
+ cp hex.spec $(RPMROOT)/SPECS
+ cd $(RPMROOT)/SPECS; $(RPM) $(RPMFLAGS) hex.spec
+ cp $(RPMROOT)/RPMS/`arch|sed 's/i[4-9]86/i386/'`/hex-$(VERS)*.rpm .
+ cp $(RPMROOT)/SRPMS/hex-$(VERS)*.src.rpm .
- HEX 1.1
+ HEX 1.2
(by Eric S. Raymond <esr@snark.thyrsus.com>)
This hex dumper was born because
-/* hex.c -- generate CP/M style hex dumps */
+/*****************************************************************************
+
+hex.c -- generate CP/M style hex dumps
+
+Copyright (c) 1999 by Eric S. Raymond<P>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:<P>
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.<P>
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.<P>
+
+*****************************************************************************/
+
#include <stdio.h>
#include <ctype.h>
base = 10;
break;
}
- else if (*cp = 'x' || *cp == 'X' || *cp == 'h' || *cp == 'H')
+ else if (*cp == 'x' || *cp == 'X' || *cp == 'h' || *cp == 'H')
{
base = 16;
cp++;
switch (c)
{
+ case 'V':
+ printf("hex " VERSION " by Eric S. Raymond.\n");
+ exit(0);
+
case 'e': eflag = (s == '-'); continue;
case 'c': cflag = (s == '-'); continue;
case 'g': gflag = (s == '-'); continue;
Name: hex
-Version: 1.1
+Version: 1.2
Release: 1
Summary: yet another hex dumper
-Source: locke.ccil.org:/pub/esr/hex-1.1.tar.gz
+Source: locke.ccil.org:/pub/esr/hex-1.2.tar.gz
Copyright: BSD-like
Group: Development/Tools
.SH NAME
hex.c \- dump a file to stdout in CP/M-like hex format
.SH SYNOPSIS
-.B hex [-w] [-e] [-c] [-g] [-s] [filename...]
+.B hex [-V] [-w] [-e] [-c] [-g] [-s] [filename...]
.SH DESCRIPTION
This program provides a facility for obtaining a dump of a binary file
to stdout. The default format is a CP/M style hex dump with byte
-g -- don't output mid-page gutter
.TP 10
-s -- dump file section
+.TP 10
+-V -- print version number and exit
.PP
The command line is scanned left-to-right for filenames and options, and
each file dumped according to the format defined by preceding options. To