/* Z3func05 - Zcpr3 access functions for C */ #include #include "z3env.h" /* Convert du to ascii along with directory name if any. DU suppressed if duok is false. String is of the form A0\ROOT. */ char *dir2a(du,s) int du; char *s; { char *p; p=s; if(getduok()) { *p++ = (du & 0xff) + 'A'; /* convert drive */ _2dc(s+1, du>>8, 0, 0); /* convert user */ while(*p) ++p; /* scan to end */ *p++ = '\\'; } du2dir(du,p); if(*p) { while(*p && *p != ' ') ++p; /* scan for first space */ } else { if(p != s) --p; /* no dir found, prep to wipe backslash */ } *p = '\0'; /* terminate */ return(s); } /* Convert filename from fcb to string. Retains space padding. */ char *fn2as(fcb,s) struct zfcb *fcb; char *s; { char *p, *q; int i; p = s; q = fcb->fname; for(i=0;i<8 ;++i) *p++ = *q++ & 0x7f; *p++ = '.'; for(i=0;i<3;++i) *p++ = *q++ & 0x7f; *p = '\0'; return(s); } /* Convert filename from fcb to string. Strips space padding. */ char *fn2a(fcb,s) struct zfcb *fcb; char *s; { char *p,*q; int i; p = s; q = fcb->fname; for(i=0;i<8 && *q != ' ';++i) *p++ = *q++ & 0x7f; *p++ = '.'; q = fcb->ftype; for(i=0;i<3 && *q != ' ';++i) *p++ = *q++ & 0x7f; *p = '\0'; return(s); }