haim@gvax.cs.cornell.edu (Haim Shvaytser) (12/12/87)
Does somebody have an equivalent to the unix "strings" program that runs under ms-dos?
toddg@hpldoma.HP.COM (Todd Goin) (12/15/87)
/ hpldoma:comp.sys.ibm.pc / haim@gvax.cs.cornell.edu (Haim Shvaytser) / 6:54 pm Dec 11, 1987 / Does somebody have an equivalent to the unix "strings" program that runs under ms-dos? ---------- I don't know of a free copy, but I use the one that comes with PC/TOOLS: UNIX Utilities for MS-DOS Available from: Custom Software Systems P.O. Box 678 Natick, Ma. 01760 617-653-2555 I think that I paid about $49.00 and it contains many of the UNIX standard things. banner, BFS (Big file Scanner), CAL, CAT, chmod, cmp, comm, cp, cut, date, diff, find, grep, head, ls, make, mv, od, paste, pr, rm, sed, see, sort, split, strings, sum, tail, tar, touch, tr, uniq, wc. Todd Goin
madd@bu-cs.BU.EDU (Jim Frost) (12/17/87)
In article <11250013@hpldoma.HP.COM> toddg@hpldoma.HP.COM (Todd Goin) writes: >/ hpldoma:comp.sys.ibm.pc / haim@gvax.cs.cornell.edu (Haim Shvaytser) / 6:54 pm Dec 11, 1987 / > >Does somebody have an equivalent to the unix "strings" program >that runs under ms-dos? There are a variety of them. I wrote one myself in only a couple of minutes. The code below is a simple one that I just wrote. I haven't a compiler here so I can't test it but its operation is obvious so if there are problems you should be able to debug it in seconds. Note that under MS-DOS there is no guarantee that strings will be null-terminated as they are in UNIX. This is why "minlength" is used. Five is a reasonable length. Hope this is useful, jim frost madd@bu-it.bu.edu -- cut -- { simple UNIX-like "strings" program. } program strings; {$i-,g128,p128} const minlength = 5; var f : file of byte; b : byte; s : string[255]; begin if paramcount <> 1 then begin { make sure they gave a filename } writeln('Usage: strings filename'); halt end; assign(f,paramstr(1)); { assign name to file variable } reset(f); { open file } if ioresult <> 0 then begin { error opening file } writeln(paramstr(1),': could not open file'); halt end; s:= ''; { clear string } while not eof(f) do begin { loop for whole file } read(f,b); { get a byte from file } if (b >= ord(' ')) and (b <= 127) then { is a char } s:= s+chr(b) { add to string } else begin { not char } if length(s) >= minlength then { if string is long enough, } writeln(s); { print it } s:= ''; { clear string } end; if (length(s) = 255) then begin { make sure no overflow } writeln(s); s:= '' end end; close(f); { all done } end.