C02/test/dirtest.c02

61 lines
1.2 KiB
Plaintext

/*****************************************
* TESTDIR - Test/Demo Module direct.h02 *
*****************************************/
//Specify System Header using -H option
#include <screen.h02>
#include <stddef.h02>
#include <stdlib.h02>
#include <intlib.h02>
#include <stdio.h02>
#include <stdiox.h02>
#include <string.h02>
#include <fileio.h02>
#include <direct.h02>
const char dir = "TEMPDIR";
char d, err, i, n, r;
char m[128], s[128];
char aa,xx,yy;
main:
prtcwd();
mrdir();
goto exit;
void prtcwd() {
puts("GETCWD(0)=");
n, err = getcwd(0, &s);
if (err) goto error;
putln(&s);
}
void chkerr(aa) {
if (err) {
printf(err, "ERROR %d - ");
ferror(0, m); putln(m);
if (aa and aa<>err) goto exit;
}
else if (r) putln("FAILED");
else putln("SUCCESS");
}
void chgdir(aa, yy, xx) {
setdst(); printf("CHDIR(0,\"%s\"): ");
err = chdir(0,yy,xx); chkerr(0);
prtcwd();
}
void mrdir() {
setdst(&dir); printf("MKDIR(0, \"%s\"): ");
err = mkdir(0, &dir); chkerr(17);
chgdir(&dir);
anykey();
chgdir(updir);
setdst(&dir); printf("RMDIR(\"%s\"): ");
err = rmdir(0, &dir); chkerr(0);
}
error:
printf(err, "ERROR %d%n");
goto exit;