Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!brutus.cs.uiuc.edu!apple!motcsd!motsj1!mcdchg!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.questions Subject: Re: How to get the pathname of the current executable? Message-ID: <1990Feb8.210829.8237@chinet.chi.il.us> Date: 8 Feb 90 21:08:29 GMT References: <1610.25d028a3@wums.wustl.edu> Reply-To: les@chinet.chi.il.us (Leslie Mikesell) Organization: Chinet - Chicago Public Access UNIX Lines: 23 In article <1610.25d028a3@wums.wustl.edu> bethge@wums.wustl.edu writes: >I like to write programs that users can use without having to know >details of their inner workings. Suppose a program needs some >standard data which the user doesn't need to be concerned with, and >which for various reasons needs to be read from a file rather than >compiled in. The question is, how does the program find the file? The normal unix choices would be: 1) connect the file to one of the stdio streams before execution. This has the advantage of allowing pipes to work and can be hidden from the user by a shell wrapper. 2) have a "start-up" configuration file in a standard place that set all the other options. You might also look for a second set up file in the user's HOME directory. 3) (my favorite) Put all the options on the command line with reasonable defaults compiled in. Then if the desired options become clumsy to type in, just add a shell wrapper for the common variations. As long as you are calling getopt() you might as well anticipate every option anyone might want. Les Mikesell les@chinet.chi.il.us