[comp.sys.ibm.pc] input == output, how do you tell?

kinmonthprep@deneb.ucdavis.edu (Earl H. Kinmonth) (01/17/89)

What is a "fool proof" way of telling whether a program is writing to
its own input under MSDOS?

Under **IX, oneALMOST  certain way is to compare i-node numbers.  If
they are the same you are feeding on yourself.  Since MSDOS lacks i-node
numbers (at lots of other things), how can you be certain you are not
eating your own output?

File name comparions are NOT particularly good because there are too
many ways to write the same name, even without considering case, such
as

file
.\file
full_path\file

etc.

kneller@cgl.ucsf.edu (Don Kneller) (01/20/89)

In article <3505@ucdavis.ucdavis.edu> kinmonthprep@deneb.ucdavis.edu (Earl H. Kinmonth) writes:
>What is a "fool proof" way of telling whether a program is writing to
>its own input under MSDOS?
>
>File name comparions are NOT particularly good because there are too
>many ways to write the same name.

One possibility is to compare the filenames, sans path components, and
the file times, dates, sizes and attributes.  If all are the same, then
chances are, the files are the same (or copies).  You could determine
if the files are copies by making some change to the output file (for
example, change its date or attributes) and seeing if the input file
reflects that changes.  Buffering of directories might be a problem,
but I suspect not.

- don
-----
	Don Kneller
UUCP:		...ucbvax!ucsfcgl!kneller
INTERNET:	kneller@cgl.ucsf.edu
BITNET:		kneller@ucsfcgl.BITNET