2020-09-21 16:10:29 +00:00
|
|
|
/*****************************************
|
|
|
|
* 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() {
|
2020-09-22 00:12:44 +00:00
|
|
|
puts("GETCWD(0)=");
|
2020-09-21 16:10:29 +00:00
|
|
|
n, err = getcwd(0, &s);
|
|
|
|
if (err) goto error;
|
|
|
|
putln(&s);
|
|
|
|
}
|
|
|
|
|
2020-10-14 14:59:25 +00:00
|
|
|
void chkerr(aa) {
|
2020-09-21 16:10:29 +00:00
|
|
|
if (err) {
|
|
|
|
printf(err, "ERROR %d - ");
|
|
|
|
ferror(0, m); putln(m);
|
2020-10-14 14:59:25 +00:00
|
|
|
if (aa and aa<>err) goto exit;
|
2020-09-21 16:10:29 +00:00
|
|
|
}
|
|
|
|
else if (r) putln("FAILED");
|
|
|
|
else putln("SUCCESS");
|
|
|
|
}
|
|
|
|
|
|
|
|
void chgdir(aa, yy, xx) {
|
2020-10-14 14:59:25 +00:00
|
|
|
setdst(); printf("CHDIR(0,\"%s\"): ");
|
|
|
|
err = chdir(0,yy,xx); chkerr(0);
|
2020-09-21 16:10:29 +00:00
|
|
|
prtcwd();
|
|
|
|
}
|
|
|
|
|
|
|
|
void mrdir() {
|
2020-10-14 14:59:25 +00:00
|
|
|
setdst(&dir); printf("MKDIR(0, \"%s\"): ");
|
|
|
|
err = mkdir(0, &dir); chkerr(17);
|
2020-09-21 16:10:29 +00:00
|
|
|
chgdir(&dir);
|
|
|
|
anykey();
|
2020-10-14 14:59:25 +00:00
|
|
|
chgdir(updir);
|
2020-09-21 16:10:29 +00:00
|
|
|
setdst(&dir); printf("RMDIR(\"%s\"): ");
|
2020-10-14 14:59:25 +00:00
|
|
|
err = rmdir(0, &dir); chkerr(0);
|
2020-09-21 16:10:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
error:
|
|
|
|
printf(err, "ERROR %d%n");
|
|
|
|
goto exit;
|