diff options
| author | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 | 
|---|---|---|
| committer | svn2git <svn2git@FreeBSD.org> | 1994-05-01 08:00:00 +0000 | 
| commit | a16f65c7d117419bd266c28a1901ef129a337569 (patch) | |
| tree | 2626602f66dc3551e7a7c7bc9ad763c3bc7ab40a /gnu/libexec/uucp/libunix/cwd.c | |
| parent | 8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (diff) | |
Diffstat (limited to 'gnu/libexec/uucp/libunix/cwd.c')
| -rw-r--r-- | gnu/libexec/uucp/libunix/cwd.c | 55 | 
1 files changed, 55 insertions, 0 deletions
diff --git a/gnu/libexec/uucp/libunix/cwd.c b/gnu/libexec/uucp/libunix/cwd.c new file mode 100644 index 000000000000..433025db6c3a --- /dev/null +++ b/gnu/libexec/uucp/libunix/cwd.c @@ -0,0 +1,55 @@ +/* cwd.c +   Routines dealing with the current working directory.  */ + +#include "uucp.h" + +#include "uudefs.h" +#include "sysdep.h" +#include "system.h" + +/* See whether running this file through zsysdep_add_cwd would require +   knowing the current working directory.  This is used to avoid +   determining the cwd if it will not be needed.  */ + +boolean +fsysdep_needs_cwd (zfile) +     const char *zfile; +{ +  return *zfile != '/' && *zfile != '~'; +} + +/* Expand a local file, putting relative pathnames in the current +   working directory.  Note that ~/file is placed in the public +   directory, rather than in the user's home directory.  This is +   consistent with other UUCP packages.  */ + +char * +zsysdep_local_file_cwd (zfile, zpubdir) +     const char *zfile; +     const char *zpubdir; +{ +  if (*zfile == '/') +    return zbufcpy (zfile); +  else if (*zfile == '~') +    return zsysdep_local_file (zfile, zpubdir); +  else +    return zsysdep_add_cwd (zfile); +}       + +/* Add the current working directory to a remote file name.  */ + +char * +zsysdep_add_cwd (zfile) +     const char *zfile; +{ +  if (*zfile == '/' || *zfile == '~') +    return zbufcpy (zfile); + +  if (zScwd == NULL) +    { +      ulog (LOG_ERROR, "Can't determine current directory"); +      return NULL; +    } + +  return zsysdep_in_dir (zScwd, zfile); +}  | 
