Re^2: Functions pointers and stuff.

Tony Olekshy tony at oha.UUCP
Thu Mar 30 23:34:34 AEST 1989


In article <301 at oha.UUCP> tony at oha.UUCP (me) wrote:
>And from the SVID (quasi-portable, if you have SV or Xenix or ?): ...
>    if (nlist(*argv, nameinfo) == -1) {

and in article <1989Mar29.204918.3882 at utzoo.uucp> henry at utzoo.uucp
(Henry Spencer) wrote:
>
> The problem here is the assumption that argv[0] is a full pathname for
> the program.  In general it's not, and finding the binary is not a
> trivial exercise.

Henry is, of course, completely correct, so two things are possible:

 a) Hand code the name to address mapping as a structure array, which is
    what I do with production code.  This was already mentioned by the
    poster of the original question, who was asking for other ways.

 b) Deliberately make the name of the binary known during the installation
    process, and check the consistency of this information at run-time.
    This is an alternative which meets the needs set out in the original
    posting.

Perhaps this is one for a future addition to C?  I'd suggest a syntax,
but the snow is already melting here without any help from the net ;-)

Yours, etc., Tony Olekshy (...!alberta!oha!tony or tony at oha.UUCP).



More information about the Comp.lang.c mailing list