Copyright Digital Equipment Corp. All rights reserved.

DECC$EFS_CHARSET

   With DECC$EFS_CHARSET enabled, UNIX names can contain ODS-5
   extended characters. Support includes multiple dots and all ASCII
   characters in the range 0 to 255, except the following:

   <NUL>
   /         *
   "         ?

   Unless DECC$FILENAME_UNIX_ONLY is enabled, some characters can be
   interpreted as OpenVMS characters depending on context. They are:

   :         ^
   [         ;
   <

   DECC$EFS_CHARSET might be necessary for existing applications
   that make assumptions about filenames based on the presence
   of certain characters, because the following nonstandard and
   undocumented C RTL extensions do not work when EFS extended
   character-set support is enabled:

   o  $HOME is interpreted as the user's login directory

      With DECC$EFS_CHARSET enabled, $HOME is treated literally and
      may be in an OpenVMS or UNIX style filename.

   o  ~name is interpreted as the login directory for user name

      With DECC$EFS_CHARSET enabled, ~name is treated literally and
      can be in an OpenVMS or UNIX style filename.

   o  Wild card regular expressions in the form [a-z]

      With DECC$EFS_CHARSET enabled, square brackets are acceptable
      in OpenVMS and UNIX style filenames. For instance, in a
      function such as open, abc[a-z]ef.txt is interpreted as a
      UNIX style name equivalent to the OpenVMS style name abc^[a-
      z^]ef.txt, and [a-z]bc is interpreted as an OpenVMS style name
      equivalent to the UNIX style name /sys$disk/a-z/bc.

   With DECC$EFS_CHARSET enabled, the following encoding for EFS
   extended characters is supported when converting from an OpenVMS
   style filename to a UNIX style filename:

   o  All ODS-2 compatible names

   o  All encoding for 8-bit characters, either as single byte or
      using two-digit hexadecimal form ^ab. In a UNIX path these are
      always represented as a single byte.

   o  Encoding for DEL (^7F)

   o  The following characters when preceded by a caret:

      space ! , _ & ' ( ) + @ { } ; # [ ] % ^ = $ - ~ .

   o  The following characters when not preceded by a caret:

      $  -  ~  .

   o  The implementation supports the conversion from OpenVMS to
      UNIX needed for functions readdir, ftw, getname, fgetname,
      getcwd, and others.

                                  NOTE

      There are some special cases in C RTL filename processing.
      For example:

      o  Pathnames ending in ^.dir are treated as directories, and
         when translated, these characters are truncated from the
         string.

      o  Pathnames begining with ^/ treat the next token as a
         logical name or a directory from the root.

      The following sample program shows these nuances:

      #include <stdio.h>
      #include <dirent.h>
      #include <unixlib.h>
      #include <string.h>
      main()
      {
        char adir[80];
        DIR *dir;
        struct dirent *dp;
        int decc_feature_efs_charset_index = 0;
        int decc_feature_efs_charset_default_val = 0;

        if (
            ( (decc_feature_efs_charset_index =
              decc$feature_get_index("DECC$EFS_CHARSET")) == -1 )
            ||
            ( (decc_feature_efs_charset_default_val =
  decc$feature_get_value(decc_feature_efs_charset_index, 0)) == -1 )
            ||
( (decc$feature_set_value(decc_feature_efs_charset_index, 1, TRUE) == -1))
           )
          {
            printf("Error setting up DECC$EFS_CHARSET macro\n");
          }

        strcpy(adir, "SYS$SYSDEVICE:[SSHTEST.TEST.a^,test^.dir^;22]");
        printf("\n\nFor %s\n", adir);
      mrb:  dir = opendir(adir);
        if(dir)
          {
            do
              {
                dp = readdir(dir);
                if(dp->d_name) printf("%s\n", dp->d_name);
              } while (dp);
          }

        closedir(dir);

        strcpy(adir, "SYS$SYSDEVICE:[SSHTEST.TEST.a^,test^.dir]");
        printf("\n\nFor %s\n", adir);
        dir = opendir(adir);
        if(dir)
          {
            do
              {
                dp = readdir(dir);
                if(dp->d_name) printf("%s\n", dp->d_name);
              } while (dp);
          }

        closedir(dir);

        strcpy(adir, "SYS$SYSDEVICE:[SSHTEST.TEST.a^\\test]");
        printf("\n\nFor %s\n", adir);
        dir = opendir(adir);
        if(dir)
          {
            do
              {
                dp = readdir(dir);
                if(dp->d_name) printf("%s\n", dp->d_name);
              } while (dp);
          }

        strcpy(adir, "SYS$SYSDEVICE:[SSHTEST.TEST.copies]");
        printf("\n\nFor %s\n", adir);
        dir = opendir(adir);
        if(dir)
          {
            do
              {
                dp = readdir(dir);
                if(dp->d_name) printf("%s\n", dp->d_name);
              } while (dp);
          }

        closedir(dir);

        strcpy(adir, "/SYS$SYSDEVICE/SSHTEST/TEST/copies");
        printf("\n\nFor %s\n", adir);
        dir = opendir(adir);
        if(dir)
          {
            do
              {
                dp = readdir(dir);
                if(dp->d_name) printf("%s\n", dp->d_name);
              } while (dp);
          }

        closedir(dir);

      }