X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/3f5b4e35ccb5666749201bf8b3ffc667c0709baf..c8f19d81022a1f17cd14d1553a9c063f4eabe3c2:/lib-src/hexl.c diff --git a/lib-src/hexl.c b/lib-src/hexl.c index beb170613d..91fadd81f5 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c @@ -1,11 +1,41 @@ +/* Convert files for Emacs Hexl mode. + Copyright (C) 1989, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, + 2009, 2010 Free Software Foundation, Inc. + +Author: Keith Gabryelski +(according to authors.el) + +This file is not considered part of GNU Emacs. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . */ + + +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include -#ifdef MSDOS +#ifdef DOS_NT #include #if __DJGPP__ >= 2 #include #endif #endif +#ifdef WINDOWSNT +#include +#endif #define DEFAULT_GROUPING 0x01 #define DEFAULT_BASE 16 @@ -47,7 +77,7 @@ main (argc, argv) ** dump filename ** - (as filename == stdin) */ - + while (*argv && *argv[0] == '-' && (*argv)[1]) { /* A switch! */ @@ -136,8 +166,8 @@ main (argc, argv) { char buf[18]; -#ifdef MSDOS -#if __DJGPP__ >= 2 +#ifdef DOS_NT +#if (__DJGPP__ >= 2) || (defined WINDOWSNT) if (!isatty (fileno (stdout))) setmode (fileno (stdout), O_BINARY); #else @@ -147,7 +177,7 @@ main (argc, argv) #endif for (;;) { - register int i, c, d; + register int i, c = 0, d; #define hexchar(x) (isdigit (x) ? x - '0' : x - 'a' + 10) @@ -185,8 +215,8 @@ main (argc, argv) } else { -#ifdef MSDOS -#if __DJGPP__ >= 2 +#ifdef DOS_NT +#if (__DJGPP__ >= 2) || (defined WINDOWSNT) if (!isatty (fileno (fp))) setmode (fileno (fp), O_BINARY); #else @@ -199,7 +229,7 @@ main (argc, argv) string[17] = '\0'; for (;;) { - register int i, c; + register int i, c = 0; for (i=0; i < 16; ++i) { @@ -214,7 +244,7 @@ main (argc, argv) else { if (!i) - printf ("%08x: ", address); + printf ("%08lx: ", address); if (iso_flag) string[i+1] = @@ -244,12 +274,17 @@ main (argc, argv) fclose (fp); } while (*argv != NULL); - return 0; + return EXIT_SUCCESS; } void usage () { fprintf (stderr, "usage: %s [-de] [-iso]\n", progname); - exit (1); + exit (EXIT_FAILURE); } + +/* arch-tag: 20e04fb7-926e-4e48-be86-64fe869ecdaa + (do not change this comment) */ + +/* hexl.c ends here */