/* OS_FPATHNAME -- Map a VFN (virtual filename) into a pathname (filename * specification which is independent of the current directory). */ int os_fpathname ( char *vfn, /* virtual filename */ char *osfn, /* OS filename */ int maxch ) { XCHAR x_vfn[SZ_PATHNAME+1]; XCHAR x_osfn[SZ_PATHNAME+1]; XINT x_maxch = SZ_PATHNAME, x_nchars; if (vfn[0]) os_strupk (vfn2osfn(vfn,0), x_vfn, x_maxch); else x_vfn[0] = 0; if (vfn[0] == '.' && (vfn[1] == EOS || vfn[2] == EOS)) { ZFGCWD (x_osfn, &x_maxch, &x_nchars); os_strupk ((char *)x_osfn, x_osfn, x_maxch); if (vfn[1] == '.') { os_strupk (vfn, x_vfn, x_maxch); ZFSUBD (x_osfn, &x_maxch, x_vfn, &x_nchars); } } else ZFPATH (x_vfn, x_osfn, &x_maxch, &x_nchars); os_strpak (x_osfn, osfn, maxch); return (x_nchars); }
/* OS_SUBDIR -- Fold a subdirectory name into a directory pathname and return * a pointer to the pathname of the subdirectory. */ char * os_subdir ( char *dir, /* OS pathname of directory */ char *subdir /* name of subdirectory */ ) { static XCHAR x_path[SZ_PATHNAME+1]; XCHAR x_subdir[SZ_FNAME+1]; XINT x_maxch = SZ_PATHNAME, x_nchars; extern int ZFSUBD(); os_strupk (dir, x_path, SZ_PATHNAME); os_strupk (subdir, x_subdir, SZ_FNAME); ZFSUBD (x_path, &x_maxch, x_subdir, &x_nchars); if (x_nchars > 0) return (os_strpak (x_path, (char *)x_path, SZ_PATHNAME)); else return (NULL); }
/* OS_PUTENV -- Set the value of the named environment variable. */ void os_putenv ( char *name, char *value ) { XCHAR x_name[SZ_FNAME+1]; XCHAR x_value[SZ_VALUE+1]; char buf[SZ_VALUE], *env; extern void ENVRESET(XCHAR *key, XCHAR *value); /* Set the VOS environment. */ os_strupk (name, x_name, SZ_FNAME); os_strupk (value, x_value, SZ_VALUE); ENVRESET (x_name, x_value); /* Set the HOST environment. */ sprintf (buf, "%s=%s", name, value); if ( (env = (char *) malloc (strlen(buf) + 1)) ) { strcpy (env, buf); putenv (env); /* must keep env around. */ } }