Sponsored Content
Top Forums Programming find the fully-qualified path for the app my module is running in Post 95350 by jim mcnamara on Tuesday 10th of January 2006 02:58:39 PM
Old 01-10-2006
There is no one perfect way to do this in Linux/Unix.

argv[0] may have it, unless the file was exec'd, getcwd() may be it, or
you can try a directory search.

This is because files can be run in a lot of different ways, and Linux does not have a registry.
 

10 More Discussions You Might Find Interesting

1. Programming

Need help with C app on Oracle running on Solaris 6

Hello, I would really appreciate some help with a problem my current client is having. He has an old legacy app that does his company's financial accounting and ERP for manufacturing, etc. The app was written by a company called "Just in time" in Austin, TX, and they are no longer in business. ... (2 Replies)
Discussion started by: w0lf
2 Replies

2. Solaris

Hostname not fully qualified..

Hi Friends.. I have a small problem with the hostname of my system.I had installed Solaris 10 X86 on Vmware in my windows 2000 system.After booting of my solaris system,if i give check-hostname command it says ,, hostname is not fully qualified ,,change the hostname to hostname.xxx.xxxxxx.com... (3 Replies)
Discussion started by: sdspawankumar
3 Replies

3. Programming

Running app after logout and monitoring

Hello! I just programmed a very simple app, it's function is to report every minute the state of the memory and cpu and put it to and xml. All this stuff is working ok since I'm logged in into the machine, but i want it to run as a service, how can I do that?? P.S: Any one knows how can I... (1 Reply)
Discussion started by: ncatdesigner
1 Replies

4. IP Networking

Unable to ping freebsd machine using fully qualified domain name

hi all. am unable to ping a freebsd machine using fully qualified domain name from a windows machine. i have already set the fqdn for the machine. plz advise me. thanks. (2 Replies)
Discussion started by: coolatt
2 Replies

5. Windows & DOS: Issues & Discussions

Display running 'app' in terminal titlebar?

Hi. I was, not too long ago, an OS X home user. One of the things I remember from using the Apple-installed Terminal is: whenever an executable that took more than a split second to do its thing was running, its name would appear in the title bar in a way similar to "Terminal: ssh" or "Terminal:... (0 Replies)
Discussion started by: SilversleevesX
0 Replies

6. Shell Programming and Scripting

how to get fully qualified path name

hi actually i want to get fully qualified path name of the file when the file name is entered as command line argument while running a shell script ex. if i run the shell as $./test.sh ./nsdnet_file.csv the it should display me the full path of the file like /dialp/Release/bin/nsdnet_file.csv... (3 Replies)
Discussion started by: priyanka3006
3 Replies

7. AIX

AIX 6.1 app running on 5.x?

Hi, A quick question. If I build an application on AIX 6.1 TL3 using XL C/C++ 8.0 and Oracle 10g, can I then take those binaries and run them on AIX 5.3 and previous? Regards Kevin (3 Replies)
Discussion started by: KevB
3 Replies

8. Solaris

Can't change fully qualified host name

I tried changing my /etc/inet/hosts file for my server to: <ip address> <hostname> <fqdn> but when I go to reboot the file changes right back to: <ip address> <hostname> how do I get the <fqdn> to stick on a reboot. Thanks (2 Replies)
Discussion started by: jastanle84
2 Replies

9. Programming

Running bin file from a module

Hi I actually wrote a simple module and I need to call a bin file from that module. Could you give me some hints how to do that? (I tried with stdlib.h and 'system()', but cannot call that function from a module). Regards. (28 Replies)
Discussion started by: Chrisdot
28 Replies

10. UNIX for Dummies Questions & Answers

How to fix Python path for some script/app?

Hello, i have: # python -V Python 2.7.6 But original for my CentOS is 2.3 or 2.4 my python folder: /root/python2.7.6 (inside are folders like lib, include, bin, share) I launched app iotop: # iotop -od 6 Traceback (most recent call last): File "/usr/bin/iotop", line 16, in... (3 Replies)
Discussion started by: postcd
3 Replies
getexecname(3C) 					   Standard C Library Functions 					   getexecname(3C)

NAME
getexecname - return pathname of executable SYNOPSIS
#include <stdlib.h> const char *getexecname(void); DESCRIPTION
The getexecname() function returns the pathname (the first argument of one of the exec family of functions; see exec(2)) of the executable that started the process. 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 PATH components. If this is not an absolute path, the output of getcwd(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 exec family of functions. RETURN VALUES
If successful, getexecname() returns a pointer to the executables pathname; otherwise, it returns 0. USAGE
The getexecname() function obtains the executable pathname from the AT_SUN_EXECNAME aux vector. These vectors are made available to dynam- ically linked processes only. A successful call to one of the exec family of functions will always have AT_SUN_EXECNAME in the aux vector. The associated pathname is guaranteed to be less than or equal to PATH_MAX, not counting the trailing null byte that is always present. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
exec(2), getcwd(3C), attributes(5) SunOS 5.10 17 Dec 1997 getexecname(3C)
All times are GMT -4. The time now is 05:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy