isosize: move file name printing after error determination
Earlier the filename printing was buffered, and exit at error made output to appear in front of prompt. Output below demonstrates the brokenness. prompt> isosize /etc / isosize: /etc: might not be an ISO filesystem isosize: read error on /etc: Is a directory /etc: prompt> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
fce72f96d0
commit
799e584245
|
@ -125,7 +125,7 @@ struct iso_primary_descriptor
|
||||||
unsigned char unused5 [ISODCL (1396, 2048)];
|
unsigned char unused5 [ISODCL (1396, 2048)];
|
||||||
};
|
};
|
||||||
|
|
||||||
static void isosize(char *filenamep, int xflag, long divisor)
|
static void isosize(int argc, char *filenamep, int xflag, long divisor)
|
||||||
{
|
{
|
||||||
int fd, nsecs, ssize;
|
int fd, nsecs, ssize;
|
||||||
struct iso_primary_descriptor ipd;
|
struct iso_primary_descriptor ipd;
|
||||||
|
@ -145,6 +145,8 @@ static void isosize(char *filenamep, int xflag, long divisor)
|
||||||
/* isonum_723 returns nowadays always 2048 */
|
/* isonum_723 returns nowadays always 2048 */
|
||||||
ssize = isonum_723(ipd.logical_block_size, xflag);
|
ssize = isonum_723(ipd.logical_block_size, xflag);
|
||||||
|
|
||||||
|
if (1 < argc)
|
||||||
|
printf("%s: ", filenamep);
|
||||||
if (xflag) {
|
if (xflag) {
|
||||||
printf(_("sector count: %d, sector size: %d\n"), nsecs, ssize);
|
printf(_("sector count: %d, sector size: %d\n"), nsecs, ssize);
|
||||||
} else {
|
} else {
|
||||||
|
@ -220,11 +222,8 @@ int main(int argc, char **argv)
|
||||||
if (ct <= 0)
|
if (ct <= 0)
|
||||||
usage(stderr);
|
usage(stderr);
|
||||||
|
|
||||||
for (j = optind; j < argc; j++) {
|
for (j = optind; j < argc; j++)
|
||||||
if (ct > 1)
|
isosize(ct, argv[j], xflag, divisor);
|
||||||
printf("%s: ", argv[j]);
|
|
||||||
isosize(argv[j], xflag, divisor);
|
|
||||||
}
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue