version 1.48, 2006/05/31 01:14:41 |
version 1.49, 2006/06/01 06:32:17 |
|
|
#include <sys/file.h> |
#include <sys/file.h> |
#include <sys/cdio.h> |
#include <sys/cdio.h> |
#include <sys/ioctl.h> |
#include <sys/ioctl.h> |
|
#include <sys/queue.h> |
#include <sys/scsiio.h> |
#include <sys/scsiio.h> |
|
#include <sys/stat.h> |
|
|
#include <ctype.h> |
#include <ctype.h> |
#include <err.h> |
#include <err.h> |
|
|
int verbose = 1; |
int verbose = 1; |
int msf = 1; |
int msf = 1; |
const char *cddb_host; |
const char *cddb_host; |
char **track_names; |
char **track_names; |
char *track_types; |
|
|
|
EditLine *el = NULL; /* line-editing structure */ |
EditLine *el = NULL; /* line-editing structure */ |
History *hist = NULL; /* line-editing history */ |
History *hist = NULL; /* line-editing history */ |
|
|
int play_track(int, int, int, int); |
int play_track(int, int, int, int); |
int get_vol(int *, int *); |
int get_vol(int *, int *); |
int status(int *, int *, int *, int *); |
int status(int *, int *, int *, int *); |
int open_cd(char *, int); |
|
int play(char *arg); |
int play(char *arg); |
int info(char *arg); |
int info(char *arg); |
int cddbinfo(char *arg); |
int cddbinfo(char *arg); |
|
|
{ |
{ |
int ch, cmd; |
int ch, cmd; |
char *arg; |
char *arg; |
|
struct stat sb; |
|
struct track_info *cur_track; |
|
struct track_info *tr; |
|
char type; |
|
|
cdname = getenv("DISC"); |
cdname = getenv("DISC"); |
if (! cdname) |
if (! cdname) |
|
|
} |
} |
|
|
if (argc > 0 && ! strcasecmp(*argv, "tao")) { |
if (argc > 0 && ! strcasecmp(*argv, "tao")) { |
optreset = 1; |
if (argc == 1) |
optind = 0; |
usage(); |
while ((ch = getopt(argc, argv, "t:")) != -1) { |
SLIST_INIT(&tracks); |
switch (ch) { |
type = 'd'; |
case 't': |
while (argc > 1) { |
track_types = optarg; |
tr = malloc(sizeof(struct track_info)); |
break; |
tr->type = type; |
default: |
optreset = 1; |
|
optind = 1; |
|
while ((ch = getopt(argc, argv, "ad")) != -1) { |
|
switch (ch) { |
|
case 'a': |
|
type = 'a'; |
|
break; |
|
case 'd': |
|
type = 'd'; |
|
break; |
|
default: |
|
usage(); |
|
} |
|
} |
|
tr->type = type; |
|
argc -= optind; |
|
argv += optind; |
|
if (argv[0] == NULL) |
usage(); |
usage(); |
|
tr->file = argv[0]; |
|
if (stat(tr->file, &sb) != 0) { |
|
warn("cannot stat file %s",tr->file); |
|
return (-1); |
} |
} |
|
tr->sz = sb.st_size; |
|
if (SLIST_EMPTY(&tracks)) |
|
SLIST_INSERT_HEAD(&tracks,tr,track_list); |
|
else |
|
SLIST_INSERT_AFTER(cur_track,tr,track_list); |
|
cur_track = tr; |
} |
} |
argc -= optind; |
|
argv += optind; |
|
if (argc == 0) |
|
usage(); |
|
if (! open_cd(cdname, 1)) |
if (! open_cd(cdname, 1)) |
exit(1); |
exit(1); |
if (writetao(argc,argv) != 0) |
if (writetao(&tracks) != 0) |
exit(1); |
exit(1); |
else |
else |
exit(0); |
exit(0); |
} |
} |
|
|
if (argc > 0) { |
if (argc > 0) { |
char buf[80], *p; |
char buf[80], *p; |
int len; |
int len; |