/* **************************************************************** Copyright (c) 1992, Carnegie Mellon University All Rights Reserved Permission is hereby granted to use, copy, modify, and distribute this software provided that the above copyright notice appears in all copies and that any distribution be for noncommercial purposes. Carnegie Mellon University disclaims all warranties with regard to this software. In no event shall Carnegie Mellon University be liable for any special, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data, or profits arising out of or in connection with the use or performance of this software. **************************************************************** */ #include stdio #include ctype int FNAME_NET_TO_VMS(unix_fn,ulen,vms_fn,dirp) char *unix_fn,*vms_fn; int ulen; int dirp; { /* !!!HACK!!! Why don't we check for the end of vms_fn??? (cause were lazy) */ int i; char c; int upmode_flag = 0; int dotp = 0, lastdot = -1; char *vs; /* find last dot in file (for directory translations) */ for (i=0; i='4') && (c2<='9')) { int rc = -1; switch (c2) { case '4' : { if (isupper(c3)) rc = c3+001-'A'; break; } case '5' : { if (c3=='Z') rc = ':'; else if (isupper(c3)) rc = c3+041-'A'; break; } case '6' : { if (c3=='A') rc = 0; else if (isupper(c3)) rc = c3+033-'B'; break; } case '7' : { if (c3=='A') rc = ' '; else if (isupper(c3)) rc = c3+073-'B'; break; } case '8' : { if (isupper(c3)) rc = c3+0100-'A'; break; } case '9' : { if (c3=='A') rc = 0140; else if (isupper(c3)) rc = c3+0172-'B'; break; } } if (rc>=0) { i += 2; *us++ = rc; continue; } } /* got an octal code? */ if (isdigit(c2) && isdigit(c3) && isdigit(c4)) { *us++ = c2*0100 + c3*010 + c4; i += 3; continue; } } *us++ = c; } if (*(us-1) == '.') us -= 1; else if (!strncmp(us-4, ".dir", 4) || !strncmp(us-4, ".DIR", 4)) us -= 4; *us = 0; return (us-unix_fn); }