[GLLUG] ~ or $HOME ?

Alain Williams addw at phcomp.co.uk
Mon Mar 17 12:04:38 UTC 2014


I have just written a program that processes an xxxx.rc file:

* /etc/xxxx.rc

* ~/.xxxx.rc

I got a value for ~ from the password file - I was doing a getpwuid() anyway.

Should I instead use $HOME ? OK: $HOME and the value from the password entry
will be the same most of the time, but *most*, not always.

Any opinions on what the 'right' thing to do ? Options:

a) $HOME

b) getpwuid() (or similar)

c) $HOME, but if that is not defined: getpwuid()

-- 
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256  http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>




More information about the GLLUG mailing list