From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8c9b,372ebe42676183e0 X-Google-Attributes: gidf8c9b,public X-Google-Thread: fc89c,372ebe42676183e0 X-Google-Attributes: gidfc89c,public X-Google-Thread: 1014db,372ebe42676183e0 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,372ebe42676183e0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-12-12 13:26:57 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!news.umbc.edu!eff!blanket.mitre.org!linus.mitre.org!linus!mbunix!emery From: emery@goldfinger.mitre.org (David Emery) Newsgroups: comp.unix.programmer,comp.lang.ada,comp.unix.questions,comp.lang.c Subject: Re: Filename comparison ... HELP NEEDED! Followup-To: comp.unix.programmer Date: 12 Dec 94 15:28:33 Organization: The Mitre Corp., Bedford, MA. Distribution: world Message-ID: References: <3bn13h$jmo@speedy.cci.de> NNTP-Posting-Host: goldfinger.mitre.org In-reply-to: lr@quux.apana.org.au's message of 12 Dec 1994 07:50:57 GMT Xref: bga.com comp.unix.programmer:9785 comp.lang.ada:8547 comp.unix.questions:17793 comp.lang.c:34386 Date: 1994-12-12T15:28:33+00:00 List-Id: Sorry, comparing inodes is insufficient. Inodes are unique on a given device. Two files, on two separate devices, may have the same inode number. Thus, the C return should be return ((stat1.st_ino == stat2.st_ino) && (stat1.st_dev == stat2.st_dev)); Implemented in POSIX/Ada, the same function would be with POSIX, POSIX_File_Status; function same_file (f1, f2 : POSIX.pathname) return boolean is function "=" (l, r : POSIX_FIle_Status.File_ID) return boolean renames POSIX_File_Status."="; function "=" (l, r : POSIX_FIle_Status.Device_ID) return boolean renames POSIX_File_Status."="; status1, status2 : POSIX_File_Status.status; begin status1 := POSIX_File_Status.Get_File_Status (f1); status2 := POSIX_File_Status.Get_File_Status (f2); return ((POSIX_File_Status.Device_Id_Of (status1) = POSIX_File_Status.Device_ID_Of (Status2)) and then -- no need to check file_ID if Device_IDs -- are different. (POSIX_File_Status.File_Id_Of (status1) = POSIX_File_Status.File_ID_Of (Status2)) ); end same_file; dave p.s. Does anyone know if device numbers are 'unique' for NFS-mounted file systems? -- --The preceeding opinions do not necessarily reflect the opinions of --The MITRE Corporation or its sponsors. -- "A good plan violently executed -NOW- is better than a perfect plan -- next week" George Patton -- "Any damn fool can write a plan. It's the execution that gets you -- all screwed up" James Hollingsworth -------------------------------------------------------------------------