Path: utzoo!telly!attcan!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: Get process name w/o using argv[0] in C function? Message-ID: <3802@auspex.auspex.com> Date: 31 Jul 90 18:17:37 GMT References: <9220003@hpldsla.sid.hp.com> Organization: Auspex Systems, Santa Clara Lines: 15 >Also, I do not think I want to use a global and initialize it to >argv[0] in body of main(), because I do not use globals! Perhaps you should start doing so. The only portable alternatives are 1) use a global or 2) pass argv[0] all the way down. >I know that getpid() and getppid() get me the process id and parent's >process id. In effect, the process ID *is* a global, although in most UNIX implementations it's not accessible directly from user code. So if you're using "getpid()", you're already using a global; it just happens to be hidden inside a routine (a routine in the kernel, in most implementations). If globals really offend you, you might want to hide the global in question inside a function....