version 1.49, 2006/06/01 06:32:17 |
version 1.50, 2006/06/01 07:12:18 |
|
|
struct stat sb; |
struct stat sb; |
struct track_info *cur_track; |
struct track_info *cur_track; |
struct track_info *tr; |
struct track_info *tr; |
|
off_t availblk,needblk = 0; |
|
u_int blklen; |
|
u_int ntracks = 0; |
char type; |
char type; |
|
|
cdname = getenv("DISC"); |
cdname = getenv("DISC"); |
|
|
usage(); |
usage(); |
SLIST_INIT(&tracks); |
SLIST_INIT(&tracks); |
type = 'd'; |
type = 'd'; |
|
blklen = 2048; |
while (argc > 1) { |
while (argc > 1) { |
tr = malloc(sizeof(struct track_info)); |
tr = malloc(sizeof(struct track_info)); |
tr->type = type; |
tr->type = type; |
|
|
switch (ch) { |
switch (ch) { |
case 'a': |
case 'a': |
type = 'a'; |
type = 'a'; |
|
blklen = 2352; |
break; |
break; |
case 'd': |
case 'd': |
type = 'd'; |
type = 'd'; |
|
blklen = 2048; |
break; |
break; |
default: |
default: |
usage(); |
usage(); |
} |
} |
} |
} |
tr->type = type; |
tr->type = type; |
|
tr->blklen = blklen; |
argc -= optind; |
argc -= optind; |
argv += optind; |
argv += optind; |
if (argv[0] == NULL) |
if (argv[0] == NULL) |
|
|
return (-1); |
return (-1); |
} |
} |
tr->sz = sb.st_size; |
tr->sz = sb.st_size; |
|
if (tr->type == 'a') |
|
tr->sz -= WAVHDRLEN; |
if (SLIST_EMPTY(&tracks)) |
if (SLIST_EMPTY(&tracks)) |
SLIST_INSERT_HEAD(&tracks,tr,track_list); |
SLIST_INSERT_HEAD(&tracks,tr,track_list); |
else |
else |
|
|
} |
} |
if (! open_cd(cdname, 1)) |
if (! open_cd(cdname, 1)) |
exit(1); |
exit(1); |
|
get_disc_size(&availblk); |
|
SLIST_FOREACH(tr, &tracks, track_list) { |
|
needblk += tr->sz/tr->blklen; |
|
ntracks++; |
|
} |
|
needblk += (ntracks - 1) * 150; /* transition area between tracks */ |
|
if (needblk > availblk) |
|
errx(1,"Only %llu of the required %llu blocks available", |
|
availblk,needblk); |
if (writetao(&tracks) != 0) |
if (writetao(&tracks) != 0) |
exit(1); |
exit(1); |
else |
else |