Using a variable from getcwd() in execl()

view story

https://bbs.archlinux.org – Yes, but argv[0] doesn't always have a path in it, so readlink'ing /proc/self/exe is a more robust method. Still not great, though -- programs that do different things based on where they are in the filesystem just invite hard-to-find bugs. I'd hard-code a path and use an environment variable or command line option to change it when necessary.$ foo # uses "/opt/runescape/runescape-update-client" $ RUC_DIR=/usr/local/bin foo # uses "/usr/local/bin/runescape-update-client" $ foo --cl (HowTos)