Added usage
This commit is contained in:
@@ -13,12 +13,21 @@ static inline void die(int code, const char* message, int fd){
|
||||
exit(code);
|
||||
}
|
||||
|
||||
static inline void print_usage(){
|
||||
printf("Usage: %s [-h]\n\t-h\tdisplays this help message.\n\t\
|
||||
Calling the program with no arguments will check the CD \
|
||||
tray and its' capabilities.", program_name);
|
||||
die(127);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
register int fd, caps;
|
||||
|
||||
if(!argv) die(127, "How did you do that? No argv?", -1);
|
||||
program_name = argv[0];
|
||||
|
||||
if(argc > 1) print_usage();
|
||||
|
||||
if((fd = open("/dev/cdrom", O_RDONLY | O_NONBLOCK)) == -1)
|
||||
die(127, "Cannot open /dev/cdrom", fd);
|
||||
|
||||
|
@@ -13,12 +13,21 @@ static inline void die(int code, const char* message, int fd){
|
||||
exit(code);
|
||||
}
|
||||
|
||||
static inline void print_usage(){
|
||||
printf("Usage: %s [-h]\n\t-h\tdisplays this help message.\n\t\
|
||||
Calling the program with no arguments will open the CD \
|
||||
tray.", program_name);
|
||||
die(127);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
register int fd;
|
||||
|
||||
if(!argv) die(127, "How did you do that? No argv?", -1);
|
||||
program_name = argv[0];
|
||||
|
||||
if(argc > 1) print_usage();
|
||||
|
||||
if((fd = open("/dev/cdrom", O_RDONLY | O_NONBLOCK)) == -1)
|
||||
die(127, "Cannot open /dev/cdrom", fd);
|
||||
|
||||
|
@@ -14,6 +14,13 @@ static inline void die(int code, const char* message, int fd){
|
||||
exit(code);
|
||||
}
|
||||
|
||||
static inline void print_usage(){
|
||||
printf("Usage: %s [-h]\n\t-h\tdisplays this help message.\n\t\
|
||||
Calling the program with no arguments will read the \
|
||||
CD lying in the tray and play it.", program_name);
|
||||
die(127);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
register int fd;
|
||||
struct cdrom_tocentry toc_entry;
|
||||
@@ -22,6 +29,8 @@ int main(int argc, char** argv){
|
||||
if(!argv) die(127, "How did you do that? No argv?", -1);
|
||||
program_name = argv[0];
|
||||
|
||||
if(argc > 1) print_usage();
|
||||
|
||||
if((fd = open("/dev/cdrom", O_RDONLY)) == -1){
|
||||
if(errno == ENOMEDIUM)
|
||||
die(127, "No CD in drive", fd);
|
||||
|
@@ -14,6 +14,13 @@ static inline void die(int code, const char* message, int fd){
|
||||
exit(code);
|
||||
}
|
||||
|
||||
static inline void print_usage(){
|
||||
printf("Usage: %s [-h]\n\t-h\tdisplays this help message.\n\t\
|
||||
Calling the program with no arguments will read the \
|
||||
table of contents of the CD lying in the tray.", program_name);
|
||||
die(127);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv){
|
||||
register int fd;
|
||||
register unsigned char i;
|
||||
@@ -23,6 +30,8 @@ int main(int argc, char** argv){
|
||||
if(!argv) die(127, "How did you do that? No argv?", -1);
|
||||
program_name = argv[0];
|
||||
|
||||
if(argc > 1) print_usage();
|
||||
|
||||
if((fd = open("/dev/cdrom", O_RDONLY)) == -1){
|
||||
if(errno == ENOMEDIUM)
|
||||
die(127, "No CD in drive", fd);
|
||||
|
Reference in New Issue
Block a user