[gccsdk] Choices$Write, dotfiles, ~, ~/
beeb at woosh.co.nz
Fri Apr 27 22:50:35 PDT 2012
Referring to gcc4/recipe/files/gcc/libunix/pwd/pwdread.c
The default for setting the home directory
home = getenv("Choices$Write");
returns Boot:Choices which then forces the following unix style
dotfile path to be issued as a RISC OS path (no good)
I am using the following in pwdread as a functional equivalent for
the intended path. It has to know the drive booted from so that if
the csd is changed to another HD it wont try to use that instead.
/* If not, try Boot$Dir to get the booted HD name and zero the
$ so the unix pathname of Choices can be appended */
home = getenv("Boot$Dir");
if (strtok(home, "$") != 0)
This compiles and works, but I welcome corrections.
While on this topic, I'll suggest the possibility that maybe we
could use a subdir in Choices to accommodate the numerous dotfiles
that could clutter the Choices directory.
In the linux world they seem to be referred to as dotfiles so
perhaps that would be a suitable name for the subdir.
I think most setting files are dotfiles or dotdirs with dotfiles,
but it would mean anything else directed to ~ would be directed to
I think there are people using !UnixHome as a means but I thought
a while ago I read it was to be avoided in the future?
But secondly, using a default, allows ports like Bash and OpenSSH
to work out of the box seamlessly.
This is a different subject really, changes do not necessarily
affect each other.
I have noticed that my 10.04 distro does not recognise cd ~
but requires cd ~/
Bash on RISC OS is happy with cd ~ (1) so Iam guessing that Ubuntu
and maybe others adapt a modifier so that ~/ must be used to
get to the home directory contrary to other policy.
(1) Even though I have made this change to my Recipe's riscosify.c
if (in == '~' && in == '/')
const char *home =
getenv ("UnixEnv$HOME") ? : getenv ("HOME");
strcpy (new_buffer, home);
while (*in != '\0' && *in != '/');
if (new_buffer != '~')
strcat (new_buffer, in);
return __riscosify (new_buffer, create_dir, flags, buffer,
/* Fall through */
/* We can tell quite a lot from the first character of the path */
/* The directory separator must be a slash. Could be an absolute unix
pathname, or a unixified RISC OS path.
I have taken ~ out of the case function and added the requirement of ~/
I did this because there are existing RISC OS filenames ~xxxxxxx and
when a program like Tar encounters them they jump to the home dir, but it
may be in line with Ubuntu or Debian anyway.
The combination of my changes are working properly so far, perhaps
someone else could test it further and it could be implemented?
Thanks to all,
More information about the gcc