home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 December
/
VPR9712A.ISO
/
OLS
/
OS2
/
LHA2P205
/
LHA2P205.LZH
/
lha2-2.05pre
/
source.lzh
/
src
/
disp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-02-24
|
3KB
|
173 lines
/*
* disp.c --- display filenames
* Copyright (C) 1988-1992, Haruyasu YOSHIZAKI
* Copyright (C) 1991-1996. Satoshi HIRAMATSU (OS/2 HPFS version)
*
* $Log$
*/
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "typedef.h"
#include "port2.h"
#include "lh.h"
#include "header.h"
#include "intrface.h"
char *procptr;
char *fileptr;
ushort maxblk;
ushort blkcnt;
ushort curcnt;
ushort nxtcnt;
extern int fcount, tcount;
void
regdisp(char *p, char *q)
{
static char __filename__[13];
procptr = p;
/* for UNIX version LHA directory archives. */
/* for OS/2 version LHA directory archives with "-d" option. */
if(*(hpb.pathname + strlen(hpb.pathname) - 1) == DELIM)
fileptr = hpb.pathname;
else
fileptr = hpb.filename;
if(flg_l)
fileptr = hpb.pathname;
else
{
if(strlen(fileptr) > 12) /* long filename */
{
memcpy(__filename__, fileptr, 12);
__filename__[13] = '\0';
fileptr = __filename__;
}
}
if(q && flg_l == 2)
fileptr = q;
maxblk = (flg_l) ? 67 : 57;
fcount++;
}
void
dispname(void)
{
if(flg_n == 2)
return;
eprintf((flg_l) ? "\r %-8s " : "\r%-8s %-12s ", procptr, fileptr);
}
void
dispalone(char *p)
{
regdisp(p, NULL);
if(outredir)
printf("%s\n", fileptr);
if(flg_n != 2)
eprintf("%-8s %s", p, fileptr);
}
void
disp(int view, int redir)
{
int dicsiz, blk;
blkcnt = -1;
if(view)
return;
if(redir)
printf("%s\n", fileptr);
if(flg_n == 2)
return;
if(flg_l)
{
eprintf("[%d", fcount);
if(cmd == 'U' || cmd == 'M')
eprintf("/%d", tcount);
eprintf("] %s\n", fileptr);
}
dispname();
if (flg_n) return;
dicsiz = 1 << interface.dicbit;
blkcnt = blk =(interface.original + dicsiz - 1) / dicsiz;
if(blk > maxblk)
blk = maxblk;
while(blk)
{
fputc('.', stderr);
fflush(stderr);
blk--;
}
dispname();
}
void
enddisp(char *p)
{
if(flg_n == 2)
return;
eprintf((flg_l) ? "\r %-8s \n" : "\r%-8s \n", p);
}
void initdisp(void)
{
curcnt = nxtcnt = 0;
if(blkcnt == -1)
nxtcnt = -1;
}
void
dispmark(char mark)
{
if(curcnt >= nxtcnt)
{
if(!flg_n)
{
fputc(mark, stderr);
fflush(stderr);
}
if(blkcnt > maxblk)
nxtcnt = (((long)curcnt * maxblk + blkcnt - 1) / blkcnt + 1)
* blkcnt / maxblk;
else
nxtcnt++;
}
curcnt++;
}
void
increment_disp(void)
{
fcount++;
}
void
skipdisp(char *mes)
{
if(flg_n == 2)
return;
regdisp("Skipped", cmd == 'E' ? filename3 : NULL);
interface.original = 0;
disp(0, 0);
eprintf(": %s\n", mes);
}