Date: Fri, 19 Nov 1999 11:37:20 -0500 From: Greg Lehey <grog@mojave.sitaranetworks.com> To: Jonathon McKitrick <jcm@dogma.freebsd-uk.eu.org> Cc: rover@lglobus.ru, freebsd-questions@freebsd.org Subject: Re: Is there correct way for program to read from itself? Message-ID: <19991119113720.28959@mojave.sitaranetworks.com> In-Reply-To: <Pine.BSF.4.02A.9911191615380.22999-100000@dogma.freebsd-uk.eu.org>; from Jonathon McKitrick on Fri, Nov 19, 1999 at 04:16:49PM %2B0000 References: <19991119111026.11577@mojave.sitaranetworks.com> <Pine.BSF.4.02A.9911191615380.22999-100000@dogma.freebsd-uk.eu.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, 19 November 1999 at 16:16:49 +0000, Jonathon McKitrick wrote: > On Fri, 19 Nov 1999, Greg Lehey wrote: >>>>> Can't open copyme: No such file or directory >>>>> Everything is not that easy. >>>> That wasn't the question. But it can be fixed. How about you doing > > What happened here? Does he need a rehash command? WHy can't it find > copyme? (I'm just trying to learn something from all of this) No, he didn't do anything wrong, except to expect me to write a perfect program instead of an example. The relevant part of the code is: main (int argc, char *argv []) { int me = open (argv [0], O_RDONLY); argv [0] gets set to the name of the program (copyme). If I start it via PATH, it's still just "copyme". open(2) will fail if it doesn't find it in the current directory, and worse, if it *does* find a file of the same name, it will open it instead of the correct file. Greg -- When replying to this message, please copy the original recipients. For more information, see http://www.lemis.com/questions.html Finger grog@lemis.com for PGP public key See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991119113720.28959>