Empty symlinks and full POSIX compliance
Empty symlinks and full POSIX compliance
Posted Jun 13, 2013 18:42 UTC (Thu) by dmuc (guest, #91417)Parent article: Empty symlinks and full POSIX compliance
Years ago we run a software which was configured with a lot of symlinks, and a few plain files.
It worked like that:
/etc/foo/mail/to -> foo@example.com
/etc/foo/mail/subject-prefix ->
The benefit is: You don't need a config file parser, you can access the config simply by readlink("/etc/foo/mail/subject-prefix").
With an empty symlink you have another value you can use. Think of NULL vs "" in SQL.
file not found -> NULL
symlink to "" -> ""
symlink to "x" -> "x"
The semantic for subject-prefix was: if the symlink is not there, there was a default for subject-prefix. If you want no prefix, just set the symlink to "".
