'\" te .\" Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved .TH getexecname 3C "17 Dec 1997" "SunOS 5.11" "Standard C Library Functions" .SH NAME getexecname \- return pathname of executable .SH SYNOPSIS .LP .nf #include \fBconst char *\fR\fBgetexecname\fR(\fBvoid\fR); .fi .SH DESCRIPTION .sp .LP The \fBgetexecname()\fR function returns the pathname (the first argument of one of the \fBexec\fR family of functions; see \fBexec\fR(2)) of the executable that started the process. .sp .LP Normally this is an absolute pathname, as the majority of commands are executed by the shells that append the command name to the user's \fBPATH\fR components. If this is not an absolute path, the output of \fBgetcwd\fR(3C) can be prepended to it to create an absolute path, unless the process or one of its ancestors has changed its root directory or current working directory since the last successful call to one of the \fBexec\fR family of functions. .SH RETURN VALUES .sp .LP If successful, \fBgetexecname()\fR returns a pointer to the executables pathname; otherwise, it returns \fB0\fR. .SH USAGE .sp .LP The \fBgetexecname()\fR function obtains the executable pathname from the \fBAT_SUN_EXECNAME\fR aux vector. These vectors are made available to dynamically linked processes only. .sp .LP A successful call to one of the \fBexec\fR family of functions will always have \fBAT_SUN_EXECNAME\fR in the aux vector. The associated pathname is guaranteed to be less than or equal to \fIPATH_MAX\fR, not counting the trailing null byte that is always present. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ MT-LevelSafe .TE .SH SEE ALSO .sp .LP \fBexec\fR(2), \fBgetcwd\fR(3C), \fBattributes\fR(5)