1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686
|
/* DASDCOPY.C (c) Copyright Roger Bowler, 1999-2010 */
/* Copy a dasd file to another dasd file */
// $Id: dasdcopy.c 5589 2010-01-04 09:26:36Z rbowler $
/*-------------------------------------------------------------------*/
/* This program copies a dasd file to another dasd file. */
/* Input file and output file may be compressed or not. */
/* Files may be either ckd (or cckd) or fba (or cfba) but */
/* file types (ckd/cckd or fba/cfba) may not be mixed. */
/* */
/* Usage: */
/* dasdcopy [-options] ifile [sf=sfile] ofile */
/* */
/* Refer to the usage section below for details of options. */
/* */
/* The program may also be invoked by one of the following */
/* aliases which override the default output file format: */
/* */
/* ckd2cckd [-options] ifile ofile */
/* cckd2ckd [-options] ifile [sf=sfile] ofile */
/* fba2cfba [-options] ifile ofile */
/* cfba2fba [-options] ifile [sf=sfile] ofile */
/*-------------------------------------------------------------------*/
#include "hstdinc.h"
#include "hercules.h"
#include "dasdblks.h"
#include "devtype.h"
#include "opcode.h"
#define FBA_BLKGRP_SIZE (120 * 512) /* Size of block group */
#define FBA_BLKS_PER_GRP 120 /* Blocks per group */
int syntax (char *);
void status (int, int);
int nulltrk(BYTE *, int, int, int);
#define CKD 0x01
#define CCKD 0x02
#define FBA 0x04
#define CFBA 0x08
#define CKDMASK 0x03
#define FBAMASK 0x0c
#define COMPMASK 0x0a
/*-------------------------------------------------------------------*/
/* Copy a dasd file to another dasd file */
/*-------------------------------------------------------------------*/
int main (int argc, char *argv[])
{
char *pgm; /* -> Program name */
int ckddasd=-1; /* 1=CKD 0=FBA */
int rc; /* Return code */
int quiet=0; /* 1=Don't display status */
int comp=255; /* Compression algorithm */
int cyls=-1, blks=-1; /* Size of output file */
int lfs=0; /* 1=Create 1 large file */
int alt=0; /* 1=Create alt cyls */
int r=0; /* 1=Replace output file */
int in=0, out=0; /* Input/Output file types */
int fd; /* Input file descriptor */
char *ifile, *ofile; /* -> Input/Output file names*/
char *sfile=NULL; /* -> Input shadow file name */
CIFBLK *icif, *ocif; /* -> Input/Output CIFBLK */
DEVBLK *idev, *odev; /* -> Input/Output DEVBLK */
CKDDEV *ckd=NULL; /* -> CKD device table entry */
FBADEV *fba=NULL; /* -> FBA device table entry */
int i, n, max; /* Loop index, limits */
BYTE unitstat; /* Device unit status */
char msgbuf[512]; /* Message buffer */
size_t fba_bytes_remaining=0; /* FBA bytes to be copied */
int nullfmt = CKDDASD_NULLTRK_FMT0; /* Null track format */
char pathname[MAX_PATH]; /* file path in host format */
char pgmpath[MAX_PATH]; /* prog path in host format */
INITIALIZE_UTILITY("dasdcopy");
/* Figure out processing based on the program name */
hostpath(pgmpath, argv[0], sizeof(pgmpath));
pgm = strrchr (pgmpath, '/');
if (pgm) pgm++;
else pgm = argv[0];
strtok (pgm, ".");
if (strcmp(pgm, "ckd2cckd") == 0)
{
in = CKD;
out = CCKD;
}
else if (strcmp(pgm, "cckd2ckd") == 0)
{
in = CCKD;
out = CKD;
}
else if (strcmp(pgm, "fba2cfba") == 0)
{
in = FBA;
out = CFBA;
}
else if (strcmp(pgm, "cfba2fba") == 0)
{
in = CFBA;
out = FBA;
}
/* Process the arguments */
for (argc--, argv++ ; argc > 0 ; argc--, argv++)
{
if (argv[0][0] != '-') break;
if (strcmp(argv[0], "-v") == 0)
{
snprintf (msgbuf, 512, _("Hercules %s copy program "), pgm);
display_version (stderr, msgbuf, FALSE);
return 0;
}
else if (strcmp(argv[0], "-h") == 0)
{
syntax(pgm);
return 0;
}
else if (strcmp(argv[0], "-q") == 0
|| strcmp(argv[0], "-quiet") == 0)
quiet = 1;
else if (strcmp(argv[0], "-r") == 0)
r = 1;
#ifdef CCKD_COMPRESS_ZLIB
else if (strcmp(argv[0], "-z") == 0)
comp = CCKD_COMPRESS_ZLIB;
#endif
#ifdef CCKD_COMPRESS_BZIP2
else if (strcmp(argv[0], "-bz2") == 0)
comp = CCKD_COMPRESS_BZIP2;
#endif
else if (strcmp(argv[0], "-0") == 0)
comp = CCKD_COMPRESS_NONE;
else if ((strcmp(argv[0], "-cyl") == 0
|| strcmp(argv[0], "-cyls") == 0) && cyls < 0)
{
if (argc < 2 || (cyls = atoi(argv[1])) < 0)
return syntax(pgm);
argc--; argv++;
}
else if ((strcmp(argv[0], "-blk") == 0
|| strcmp(argv[0], "-blks") == 0) && blks < 0)
{
if (argc < 2 || (blks = atoi(argv[1])) < 0)
return syntax(pgm);
argc--; argv++;
}
else if (strcmp(argv[0], "-a") == 0
|| strcmp(argv[0], "-alt") == 0
|| strcmp(argv[0], "-alts") == 0)
alt = 1;
else if (strcmp(argv[0], "-lfs") == 0)
lfs = 1;
else if (out == 0 && strcmp(argv[0], "-o") == 0)
{
if (argc < 2 || out != 0) return syntax(pgm);
if (strcasecmp(argv[1], "ckd") == 0)
out = CKD;
else if (strcasecmp(argv[1], "cckd") == 0)
out = CCKD;
else if (strcasecmp(argv[1], "fba") == 0)
out = FBA;
else if (strcasecmp(argv[1], "cfba") == 0)
out = CFBA;
else
return syntax(pgm);
argc--; argv++;
}
else
return syntax(pgm);
}
/* Get the file names:
input-file [sf=shadow-file] output-file */
if (argc < 2 || argc > 3) return syntax(pgm);
ifile = argv[0];
if (argc < 3)
ofile = argv[1];
else
{
if (strlen(argv[1]) < 4 || memcmp(argv[1], "sf=", 3))
return syntax(pgm);
sfile = argv[1];
ofile = argv[2];
}
/* If we don't know what the input file is then find out */
if (in == 0)
{
BYTE buf[8];
hostpath(pathname, ifile, sizeof(pathname));
fd = open (pathname, O_RDONLY|O_BINARY);
if (fd < 0)
{
fprintf (stderr, _("HHCDC001E %s: %s open error: %s\n"),
pgm, ifile, strerror(errno));
return -1;
}
rc = read (fd, buf, 8);
if (rc < 8)
{
fprintf (stderr, _("HHCDC002E %s: %s read error: %s\n"),
pgm, ifile, strerror(errno));
return -1;
}
if (memcmp(buf, "CKD_P370", 8) == 0)
in = CKD;
else if (memcmp(buf, "CKD_C370", 8) == 0)
in = CCKD;
else if (memcmp(buf, "FBA_C370", 8) == 0)
in = CFBA;
else
in = FBA;
close (fd);
}
/* If we don't know what the output file type is
then derive it from the input file type */
if (out == 0)
{
switch (in) {
case CKD: if (!lfs) out = CCKD;
else out = CKD;
break;
case CCKD: if (comp == 255) out = CKD;
else out = CCKD;
break;
case FBA: if (!lfs) out = CFBA;
else out = FBA;
break;
case CFBA: if (comp == 255) out = FBA;
else out = CFBA;
break;
}
}
/* Set default compression if out file is to be compressed */
if (comp == 255 && (out & COMPMASK))
#ifdef CCKD_COMPRESS_ZLIB
comp = CCKD_COMPRESS_ZLIB;
#else
comp = CCKD_COMPRESS_NONE;
#endif
/* Perform sanity checks on the options */
if ((in & CKDMASK) && !(out & CKDMASK)) return syntax(pgm);
if ((in & FBAMASK) && !(out & FBAMASK)) return syntax(pgm);
if (sfile && !(in & COMPMASK)) return syntax(pgm);
if (comp != 255 && !(out & COMPMASK)) return syntax(pgm);
if (lfs && (out & COMPMASK)) return syntax(pgm);
if (cyls >= 0 && !(in & CKDMASK)) return syntax(pgm);
if (blks >= 0 && !(in & FBAMASK)) return syntax(pgm);
if (!(in & CKDMASK) && alt) return syntax(pgm);
/* Set the type of processing (ckd or fba) */
ckddasd = (in & CKDMASK);
/* Open the input file */
if (ckddasd)
icif = open_ckd_image (ifile, sfile, O_RDONLY|O_BINARY, 0);
else
icif = open_fba_image (ifile, sfile, O_RDONLY|O_BINARY, 0);
if (icif == NULL)
{
fprintf (stderr, _("HHCDC003E %s: %s open failed\n"), pgm, ifile);
return -1;
}
idev = &icif->devblk;
if (idev->oslinux) nullfmt = CKDDASD_NULLTRK_FMT2;
/* Calculate the number of tracks or blocks to copy */
if (ckddasd)
{
if (cyls < 0) cyls = idev->ckdcyls;
else if (cyls == 0) cyls = (idev->hnd->used)(idev);
ckd = dasd_lookup (DASD_CKDDEV, NULL, idev->devtype, cyls);
if (ckd == NULL)
{
fprintf (stderr, _("HHCDC004E %s: ckd lookup failed for %4.4X "
"cyls %d\n"),
pgm, idev->devtype, cyls);
close_image_file (icif);
return -1;
}
if (out == CCKD) cyls = ckd->cyls;
if (cyls <= ckd->cyls && alt) cyls = ckd->cyls + ckd->altcyls;
n = cyls * idev->ckdheads;
max = idev->ckdtrks;
if (max < n && out == CCKD) n = max;
}
else
{
fba_bytes_remaining = idev->fbanumblk * idev->fbablksiz;
if (blks < 0) blks = idev->fbanumblk;
else if (blks == 0) blks = (idev->hnd->used)(idev);
fba = dasd_lookup (DASD_FBADEV, NULL, idev->devtype, blks);
if (fba == NULL)
{
fprintf (stderr, _("HHCDC005E %s: fba lookup failed, blks %d\n"),
pgm, blks);
close_image_file (icif);
return -1;
}
n = blks;
max = idev->fbanumblk;
if (max < n && out == CFBA) n = max;
n = (n + FBA_BLKS_PER_GRP - 1) / FBA_BLKS_PER_GRP;
max = (max + FBA_BLKS_PER_GRP - 1) / FBA_BLKS_PER_GRP;
}
/* Create the output file */
if (ckddasd)
rc = create_ckd(ofile, idev->devtype, idev->ckdheads,
ckd->r1, cyls, "", comp, lfs, 1+r, nullfmt, 0);
else
rc = create_fba(ofile, idev->devtype, fba->size,
blks, "", comp, lfs, 1+r, 0);
if (rc < 0)
{
fprintf (stderr, _("HHCDC006E %s: %s create failed\n"), pgm, ofile);
close_image_file (icif);
return -1;
}
/* Open the output file */
if (ckddasd)
ocif = open_ckd_image (ofile, NULL, O_RDWR|O_BINARY, 1);
else
ocif = open_fba_image (ofile, NULL, O_RDWR|O_BINARY, 1);
if (ocif == NULL)
{
fprintf (stderr, _("HHCDC007E %s: %s open failed\n"), pgm, ofile);
close_image_file (icif);
return -1;
}
odev = &ocif->devblk;
/* Copy the files */
#ifdef EXTERNALGUI
if (extgui)
/* Notify GUI of total #of tracks or blocks being copied... */
fprintf (stderr, "TRKS=%d\n", n);
else
#endif /*EXTERNALGUI*/
if (!quiet) printf (" %3d%% %7d of %d", 0, 0, n);
for (i = 0; i < n; i++)
{
/* Read a track or block */
if (ckddasd)
{
if (i < max)
rc = (idev->hnd->read)(idev, i, &unitstat);
else
{
memset (idev->buf, 0, idev->ckdtrksz);
rc = nulltrk(idev->buf, i, idev->ckdheads, nullfmt);
}
}
else
{
if (i < max)
rc = (idev->hnd->read)(idev, i, &unitstat);
else
memset (idev->buf, 0, FBA_BLKGRP_SIZE);
rc = 0;
}
if (rc < 0)
{
fprintf (stderr, _("HHCDC008E %s: %s read error %s %d "
"stat=%2.2X, null %s substituted\n"),
pgm, ifile, ckddasd ? "track" : "block", i, unitstat,
ckddasd ? "track" : "block");
if (ckddasd)
nulltrk(idev->buf, i, idev->ckdheads, nullfmt);
else
memset (idev->buf, 0, FBA_BLKGRP_SIZE);
if (!quiet)
{
printf (_(" %3d%% %7d of %d"), 0, 0, n);
status (i, n);
}
}
/* Write the track or block just read */
if (ckddasd)
{
rc = (odev->hnd->write)(odev, i, 0, idev->buf,
idev->ckdtrksz, &unitstat);
}
else
{
if (fba_bytes_remaining >= (size_t)idev->buflen)
{
rc = (odev->hnd->write)(odev, i, 0, idev->buf,
idev->buflen, &unitstat);
fba_bytes_remaining -= (size_t)idev->buflen;
}
else
{
ASSERT(fba_bytes_remaining > 0 && (i+1) >= n);
rc = (odev->hnd->write)(odev, i, 0, idev->buf,
(int)fba_bytes_remaining, &unitstat);
fba_bytes_remaining = 0;
}
}
if (rc < 0)
{
fprintf (stderr, _("HHCDC009E %s: %s write error %s %d "
"stat=%2.2X\n"),
pgm, ofile, ckddasd ? "track" : "block", i, unitstat);
close_image_file(icif); close_image_file(ocif);
return -1;
}
/* Update the status indicator */
if (!quiet) status (i+1, n);
}
close_image_file(icif); close_image_file(ocif);
if (!quiet) printf (_("\r"));
printf (_("HHCDC010I %s successfully completed.\n"), pgm);
return 0;
}
/*-------------------------------------------------------------------*/
/* Build a null track image */
/*-------------------------------------------------------------------*/
int nulltrk(BYTE *buf, int trk, int heads, int nullfmt)
{
int i; /* Loop counter */
CKDDASD_TRKHDR *trkhdr; /* -> Track header */
CKDDASD_RECHDR *rechdr; /* -> Record header */
U32 cyl; /* Cylinder number */
U32 head; /* Head number */
BYTE r; /* Record number */
BYTE *pos; /* -> Next position in buffer*/
static BYTE eighthexFF[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
/* cylinder and head calculations */
cyl = trk / heads;
head = trk % heads;
/* Build the track header */
trkhdr = (CKDDASD_TRKHDR*)buf;
trkhdr->bin = 0;
store_hw(&trkhdr->cyl, cyl);
store_hw(&trkhdr->head, head);
pos = buf + CKDDASD_TRKHDR_SIZE;
/* Build record zero */
r = 0;
rechdr = (CKDDASD_RECHDR*)pos;
pos += CKDDASD_RECHDR_SIZE;
store_hw(&rechdr->cyl, cyl);
store_hw(&rechdr->head, head);
rechdr->rec = r;
rechdr->klen = 0;
store_hw(&rechdr->dlen, 8);
pos += 8;
r++;
/* Specific null track formatting */
if (nullfmt == CKDDASD_NULLTRK_FMT0)
{
rechdr = (CKDDASD_RECHDR*)pos;
pos += CKDDASD_RECHDR_SIZE;
store_hw(&rechdr->cyl, cyl);
store_hw(&rechdr->head, head);
rechdr->rec = r;
rechdr->klen = 0;
store_hw(&rechdr->dlen, 0);
r++;
}
else if (nullfmt == CKDDASD_NULLTRK_FMT2)
{
for (i = 0; i < 12; i++)
{
rechdr = (CKDDASD_RECHDR*)pos;
pos += CKDDASD_RECHDR_SIZE;
store_hw(&rechdr->cyl, cyl);
store_hw(&rechdr->head, head);
rechdr->rec = r;
rechdr->klen = 0;
store_hw(&rechdr->dlen, 4096);
r++;
pos += 4096;
}
}
/* Build the end of track marker */
memcpy (pos, eighthexFF, 8);
pos += 8;
return 0;
}
/*-------------------------------------------------------------------*/
/* Display command syntax */
/*-------------------------------------------------------------------*/
int syntax (char *pgm)
{
char usage[8192];
if (strcmp(pgm, "ckd2cckd") == 0)
snprintf(usage,8192,_(
"usage: ckd2cckd [-options] ifile ofile\n"
"\n"
" copy a ckd dasd file to a compressed ckd dasd file\n"
"\n"
" ifile -- input ckd dasd file\n"
" ofile -- output compressed ckd dasd file\n"
"\n"
" options:\n"
" -v display program version and quit\n"
" -h display this help and quit\n"
" -q quiet mode, don't display status\n"
" -r replace the output file if it exists\n"
"%s"
"%s"
" -0 don't compress track images\n"
" -cyls n size of output file\n"
" -a output file will have alt cyls\n"
),
#ifdef CCKD_COMPRESS_ZLIB
_(
" -z compress using zlib [default]\n"
),
#else
"",
#endif
#ifdef CCKD_COMPRESS_BZIP2
_(
" -bz2 compress using bzip2\n"
)
#else
""
#endif
);
else if (strcmp(pgm, "cckd2ckd") == 0)
snprintf(usage,8192,_(
"usage: cckd2ckd [-options] ifile [sf=sfile] ofile\n"
"\n"
" copy a compressed ckd file to a ckd file\n"
"\n"
" ifile -- input compressed ckd dasd file\n"
" sfile -- input compressed ckd shadow file\n"
" (optional)\n"
" ofile -- output ckd dasd file\n"
"\n"
" options:\n"
" -v display program version and quit\n"
" -h display this help and quit\n"
" -q quiet mode, don't display status\n"
" -r replace the output file if it exists\n"
"%s"
" -cyls n size of output file\n"
" -a output file will have alt cyls\n"
),
(sizeof(off_t) > 4) ? _( " -lfs create single large output file\n" ) : ( "" )
);
else if (strcmp(pgm, "fba2cfba") == 0)
snprintf(usage,8192,_(
"usage: fba2cfba [-options] ifile ofile\n"
"\n"
" copy a fba dasd file to a compressed fba dasd file\n"
"\n"
" ifile -- input fba dasd file\n"
" ofile -- output compressed fba dasd file\n"
"\n"
" options:\n"
" -v display program version and quit\n"
" -h display this help and quit\n"
" -q quiet mode, don't display status\n"
" -r replace the output file if it exists\n"
"%s"
"%s"
" -0 don't compress track images\n"
" -blks n size of output file\n"
),
#ifdef CCKD_COMPRESS_ZLIB
_(
" -z compress using zlib [default]\n"
),
#else
"",
#endif
#ifdef CCKD_COMPRESS_BZIP2
_(
" -bz2 compress using bzip2\n"
)
#else
""
#endif
);
else if (strcmp(pgm, "cfba2fba") == 0)
snprintf(usage,8192,_(
"usage: cfba2fba [-options] ifile [sf=sfile] ofile\n"
"\n"
" copy a compressed fba file to a fba file\n"
"\n"
" ifile -- input compressed fba dasd file\n"
" sfile -- input compressed fba shadow file\n"
" (optional)\n"
" ofile -- output fba dasd file\n"
"\n"
" options:\n"
" -v display program version and quit\n"
" -h display this help and quit\n"
" -q quiet mode, don't display status\n"
" -r replace the output file if it exists\n"
"%s"
" -blks n size of output file\n"
),
(sizeof(off_t) > 4) ? _( " -lfs create single large output file\n" ) : ( "" )
);
else
snprintf(usage,8192,_(
"usage: %s [-options] ifile [sf=sfile] ofile\n"
"\n"
" copy a dasd file to another dasd file\n"
"\n"
" ifile -- input dasd file\n"
" sfile -- input shadow file [optional]\n"
" ofile -- output dasd file\n"
"\n"
" options:\n"
" -v display program version and quit\n"
" -h display this help and quit\n"
" -q quiet mode, don't display status\n"
" -r replace the output file if it exists\n"
"%s"
"%s"
" -0 don't compress output\n"
" -blks n size of output fba file\n"
" -cyls n size of output ckd file\n"
" -a output ckd file will have alt cyls\n"
"%s"
" even if it exceeds 2G in size\n"
" -o type output file type (CKD, CCKD, FBA, CFBA)\n"
),
pgm,
#ifdef CCKD_COMPRESS_ZLIB
_(
" -z compress using zlib [default]\n"
),
#else
"",
#endif
#ifdef CCKD_COMPRESS_BZIP2
_(
" -bz2 compress output using bzip2\n"
)
#else
""
#endif
,(sizeof(off_t) > 4) ? _( " -lfs output ckd file will be a single file\n" ) : ( "" )
);
printf (usage);
return -1;
} /* end function syntax */
/*-------------------------------------------------------------------*/
/* Display progress status */
/*-------------------------------------------------------------------*/
void status (int i, int n)
{
static char indic[] = "|/-\\";
#ifdef EXTERNALGUI
if (extgui)
{
if (i % 100) return;
fprintf (stderr, "TRK=%d\n", i);
return;
}
#endif /*EXTERNALGUI*/
// if (i % 101 != 1) return;
printf ("\r%c %3d%% %7d", indic[i%4], (int)((i*100.0)/n), i);
} /* end function status */
|