Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!allbery From: pjr@pyra.co.uk (Peter Ruczynski) Newsgroups: comp.sources.misc Subject: v13i025: patch to v13i020: hd - hexadecimal dump V1.6 for MSDOS Message-ID: <92117@uunet.UU.NET> Date: 5 Jun 90 23:25:00 GMT Sender: allbery@uunet.UU.NET Organization: Pyramid Technology Ltd, Farnborough, ENGLAND Lines: 72 Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) Posting-number: Volume 13, Issue 25 Submitted-by: pjr@pyra.co.uk (Peter Ruczynski) Archive-name: hd1.6/patch01 Thanks to Stephen Trier for pointing this one out to me. > On most MS-DOS C compilers, a file must be opened in _binary_ mode, or > else \n\r sequences are collapsed into \n's and ^Z's are treated as end > of file markers. Meaning that hd will currently work only on text files :-( Here is a context diff that will cause "patch" to change hd.c, all that is needed is the -DMSDOS flag added to your msdos makefile. run: patch -c hd.c patchfile If you don't have patch then there are NOT a lot of changes to make by hand :-) Thanks again to Stephen Keep Enjoying! Pete. ---- CUT HERE ---- *** hd.c Mon Jun 4 12:11:01 1990 --- hd.c Mon Jun 4 12:11:25 1990 *************** *** 321,326 int fd; /* file descriptor to read from */ if (fname[0] != 0) if ((fd = open(fname, O_RDONLY)) < 0) { perror(progname); --- 321,329 ----- int fd; /* file descriptor to read from */ if (fname[0] != 0) + #ifdef MSDOS + if ((fd = open(fname, O_RDONLY|O_BINARY)) < 0) + #else if ((fd = open(fname, O_RDONLY)) < 0) #endif { *************** *** 322,327 if (fname[0] != 0) if ((fd = open(fname, O_RDONLY)) < 0) { perror(progname); exit(1); --- 325,331 ----- if ((fd = open(fname, O_RDONLY|O_BINARY)) < 0) #else if ((fd = open(fname, O_RDONLY)) < 0) + #endif { perror(progname); exit(1); ---- CUT HERE ---- -- -w--------- Pyramid Technology U.K. Peter Ruczynski ---www------- Pyramid House #include -----wwwww----- Farnborough pjr@pyra.co.uk -------wwwwwww--- Hants GU14 7PL England. Wot no funny comment :-)