home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
APPS
/
dm.lzh
/
showfiles.c
< prev
next >
Wrap
Text File
|
1995-10-26
|
7KB
|
217 lines
/* showfiles.c function for DISKMASTER.C */
/* copyright (c) 1995 by Bob Devries */
/* email: bdevries@gil.ipswichcity.qld.gov.au */
/* show the filenames from the global buffers */
#include "diskmaster.h"
#include "screen.h"
#define S_IFDIR 0x80
showfiles(numfiles,pos,fileptr,flag)
int numfiles; /* number of files in directory */
int pos; /* position in directory to print from */
int fileptr; /* current pointer position */
short flag; /* action flag. */
{
extern char **nameptr;
extern short *attrptr;
int count = 0;
int fgnd = WHITE;
int bgnd = BLUE;
int x;
if(numfiles < 0) {
gotoxy(1,24);
cleol();
printf(" %cNo Files!",7);
sleep(3);
commands();
return(0);
}
if(flag == REDO) {
while((count < MAXCNT) && (count + pos <= numfiles)) {
gotoxy(3,count + 3);
if((attrptr[pos + count]&S_IFDIR) == S_IFDIR) {
foreground(BLACK);
fgnd = BLACK;
}
if((attrptr[pos + count]&TAG) == TAG) {
background(YELLOW);
bgnd = YELLOW;
foreground(BLACK);
fgnd = BLACK;
}
if(count + pos == fileptr) {
if((attrptr[fileptr]&S_IFDIR) == S_IFDIR) {
fgnd = BLACK;
bgnd = WHITE;
}
if((attrptr[fileptr]&TAG) == TAG) {
fgnd = YELLOW;
bgnd = BLACK;
} else {
fgnd = BLUE;
bgnd = WHITE;
}
foreground(WHITE);
background(BLUE);
get_info(pos + count);
gotoxy(3,count+3);
background(bgnd);
foreground(fgnd);
}
printf("%s",nameptr[pos+count]);
foreground(WHITE);
background(BLUE);
fgnd = WHITE;
bgnd = BLUE;
for(x = strlen(nameptr[pos + count]); x<28; x++) {
printf(" ");
}
count++;
}
}
if(flag == DOWN) {
if((attrptr[fileptr-1]&TAG) == TAG) {
background(YELLOW);
bgnd = YELLOW;
foreground(BLACK);
fgnd = BLACK;
} else {
if((attrptr[fileptr-1]&S_IFDIR) == S_IFDIR) {
foreground(BLACK);
fgnd = BLACK;
} else {
foreground(WHITE);
fgnd = WHITE;
}
background(BLUE);
bgnd = BLUE;
}
gotoxy(3,fileptr-pos+3-1);
printf("%s",nameptr[fileptr-1]);
foreground(WHITE);
background(BLUE);
fgnd = WHITE;
bgnd = BLUE;
for(x = strlen(nameptr[fileptr - 1]); x<28; x++) {
printf(" ");
}
if((attrptr[fileptr]&TAG) == TAG) {
background(BLACK);
bgnd = BLACK;
foreground(YELLOW);
fgnd = YELLOW;
} else {
if((attrptr[fileptr]&S_IFDIR) == S_IFDIR) {
foreground(BLACK);
fgnd = BLACK;
} else {
foreground(BLUE);
fgnd = BLUE;
}
background(WHITE);
bgnd = WHITE;
}
gotoxy(3,fileptr-pos+3);
printf("%s",nameptr[fileptr]);
foreground(WHITE);
background(BLUE);
fgnd = WHITE;
bgnd = BLUE;
for(x = strlen(nameptr[fileptr]); x<28; x++) {
printf(" ");
}
get_info(fileptr);
}
if(flag == UP) {
if((attrptr[fileptr+1]&TAG) == TAG) {
background(YELLOW);
bgnd = YELLOW;
foreground(BLACK);
fgnd = BLACK;
} else {
if((attrptr[fileptr+1]&S_IFDIR) == S_IFDIR) {
foreground(BLACK);
fgnd = BLACK;
} else {
foreground(WHITE);
fgnd = WHITE;
}
background(BLUE);
bgnd = BLUE;
}
gotoxy(3,fileptr-pos+3+1);
printf("%s",nameptr[fileptr+1]);
foreground(WHITE);
background(BLUE);
fgnd = WHITE;
bgnd = BLUE;
for(x = strlen(nameptr[fileptr+1]); x<28; x++) {
printf(" ");
}
if((attrptr[fileptr]&TAG) == TAG) {
background(BLACK);
bgnd = BLACK;
foreground(YELLOW);
fgnd = YELLOW;
} else {
if((attrptr[fileptr]&S_IFDIR) == S_IFDIR) {
foreground(BLACK);
fgnd = BLACK;
} else {
foreground(BLUE);
fgnd = BLUE;
}
background(WHITE);
bgnd = WHITE;
}
gotoxy(3,fileptr-pos+3);
printf("%s",nameptr[fileptr]);
foreground(WHITE);
background(BLUE);
fgnd = WHITE;
bgnd = BLUE;
for(x = strlen(nameptr[fileptr]); x<28; x++) {
printf(" ");
}
get_info(fileptr);
}
if(flag == TAG) {
if((attrptr[fileptr]&TAG)==TAG) {
foreground(YELLOW);
fgnd = YELLOW;
background(BLACK);
bgnd = BLACK;
} else {
if((attrptr[fileptr]&S_IFDIR) == S_IFDIR) {
foreground(BLACK);
fgnd = BLACK;
background(WHITE);
bgnd = WHITE;
} else {
foreground(BLUE);
fgnd = BLUE;
background(WHITE);
bgnd = WHITE;
}
}
gotoxy(3,fileptr-pos+3);
printf("%s",nameptr[fileptr]);
foreground(WHITE);
background(BLUE);
fgnd = WHITE;
bgnd = BLUE;
for(x = strlen(nameptr[fileptr]); x<28; x++) {
printf(" ");
}
get_info(fileptr);
}
gotoxy(1,24);
}
/* EOF showfiles.c */