Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dg_sde_pathname(1M) — DG/UX R4.11MU05

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sde-target(1)

elink-path(1)

convert-elinks(1)

libsde(3)



dg_sde_pathname(1M)            DG/UX R4.11MU05           dg_sde_pathname(1M)


NAME
       dgsdepathname - resolve a path using the elink(5) mechanism

SYNOPSIS
       #include <dgsde.h>

       int dgsdepathname (givenpath, resolvedpath, nbytes)
       const char * givenpath;
       char * resolvedpath;
       int nbytes;

   where:
       givenpath
              is the address of a pathname to resolve,
       resolvedpath
              is the address of a buffer to store the resolved path, and
       nbytes is the size (in bytes) of the resolved_path buffer.

DESCRIPTION
       The dgsdepathname function resolves a pathname containing elinks in
       a way that is sensitive to certain environment variables. An elink is
       a symbolic link whose contents are of the form:

       prefix/elink_key/sde_name/suffix

   where:
       prefix is a sequence of valid pathname characters that do not contain
              the elink_key sequence below,
       elinkkey
              is the sequence "sde/.elink.",
       sdename
              is a sequence of filename characters that are assumed to name
              a valid sde(5), and
       suffix is a sequence of valid pathname characters.

       For example, if the symbolic link /usr/lib/libnsl.so had the
       following contents:

        ../sde/.elink./dg/usr/lib/libnsl.so

       it would be recognized as an elink with ".." as the prefix, "dg" as
       the sde_name, and "usr/lib/libnsl.so" as the suffix.

       The dg_sde_pathname function takes its path argument and attempts to
       resolve it in the file system.  If the path resolves to a file entry
       that is not a symbolic link or does not resolve in the file system,
       the given_path is the resulting pathname.

       If the path resolves to a symbolic link, then the link's contents are
       read to see if they match the grammar defined above for an elink.

       If an elink is recognized, the following transformations are applied
       to it:

       1.     The elink_key portion of the elink is replaced by "sde".

       2.     If the environment variable TARGET_BINARY_INTERFACE is
              defined, the sde_name portion of the elink is replaced by its
              value. If the variable is undefined, the sde_name portion is
              left as is.

       3.     If the environment variable SDE_PATH is defined, the prefix
              portion of the elink is replaced by its value. If the variable
              is undefined, the prefix portion is left as is.  (Note, the
              SDE_PATH variable is for internal DG use. There is no
              supported or recommended customer use for this variable.)

       Whether transformed or not, the symbolic link contents are processed
       repeatedly using the above rules until the resulting pathname does
       not resolve to a symbolic link or a symbolic link maximum level is
       reached.

       In all cases, dg_sde_pathname returns the length (see strlen(3)) of
       the resulting pathname.  If the length is less than nbytes, the
       resulting pathname is written into the resolved_path buffer. If the
       length is greater than or equal to nbytes, the resolved_path buffer
       is undefined.  It is expected that this function will be called in a
       manner similar to the following:

         #include<limits.h>
         ...
         #define SIZE PATH_MAX+1
         char resolved_path[SIZE];
         int actual_length;
         ...
         actual_length = dg_sde_pathname( path, &resolved_path, SIZE  );
         if( actual_length >= SIZE ){
           /* Error resolved_path buffer too small. */
         ..

SEE ALSO
       sde-target(1), elink-path(1), convert-elinks(1), libsde(3)

NOTES
       The transformation of the elink_key from "sde/.elink." to "sde" can
       be used to check to see if software development tools have
       appropriate environmental sensitivity. The path "/usr/sde/.elink."
       is a symbolic link to "." and is part of the path used by generic
       tools to resolve elinks to a default location.  If the
       "/usr/sde/.elink." link is removed, tools that use dg_sde_pathname
       will continue to work with pathnames containing elinks, while generic
       tools will fail.

       Although not documented here, the dg_sde_pathname function recognizes
       and resolves old-style elinks.


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026