Commit 816a940a authored by colinw's avatar colinw

Fixed some problems whereby the tools were crashing if no filename was passed

in on the command line



git-svn-id: http://svn.annodex.net/liboggz/trunk@451 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent db5c02b0
......@@ -355,7 +355,8 @@ main (int argc, char ** argv)
progname = argv[0];
if (argc < 2) {
printf ("usage: %s filename\n", progname);
usage (progname);
return (1);
}
table = oggz_table_new();
......@@ -387,14 +388,14 @@ main (int argc, char ** argv)
if (i == ':') {
usage (progname);
oggz_table_delete(table);
exit (1);
return (1);
}
switch (i) {
case 'h': /* help */
usage (progname);
oggz_table_delete(table);
exit (0);
return (0);
break;
case 'b': /* binary */
dump_bits = 1;
......@@ -433,7 +434,7 @@ main (int argc, char ** argv)
if (optind >= argc) {
usage (progname);
oggz_table_delete(table);
exit (1);
return (1);
}
infilename = argv[optind++];
......@@ -446,7 +447,7 @@ main (int argc, char ** argv)
fprintf (stderr, "%s: unable to open output file %s\n",
progname, outfilename);
oggz_table_delete(table);
exit (1);
return (1);
}
}
......@@ -454,7 +455,7 @@ main (int argc, char ** argv)
if (dump_bits) {
fprintf (stderr, "%s: Revert of binary dump not supported\n", progname);
oggz_table_delete(table);
exit (1);
return (1);
}
revert_file (infilename);
......@@ -476,7 +477,7 @@ main (int argc, char ** argv)
progname, infilename, strerror (errno));
}
oggz_table_delete(table);
exit (1);
return (1);
}
if (dump_all_serialnos) {
......@@ -494,5 +495,6 @@ main (int argc, char ** argv)
oggz_close (oggz);
}
oggz_table_delete(table);
exit (0);
return (0);
}
......@@ -215,7 +215,8 @@ main (int argc, char ** argv)
long n;
if (argc < 2) {
printf ("usage: %s filename\n", argv[0]);
printf ("Usage: %s filename\n", argv[0]);
return (1);
}
granule_rate = 1000000;
......@@ -227,7 +228,7 @@ main (int argc, char ** argv)
if ((oggz = oggz_open ((char *)argv[1], OGGZ_READ)) == NULL) {
printf ("unable to open file %s\n", argv[1]);
exit (1);
return (1);
}
oggz_set_metric (oggz, -1, gp_metric, NULL);
......@@ -245,5 +246,5 @@ main (int argc, char ** argv)
oggz_close (oggz);
exit (0);
return (0);
}
......@@ -73,13 +73,13 @@ main (int argc, char ** argv)
long n;
if (argc < 2) {
printf ("usage: %s filename\n", argv[0]);
printf ("Usage: %s filename\n", argv[0]);
return (1);
}
if ((oggz = oggz_open ((char *)argv[1], OGGZ_READ)) == NULL) {
printf ("unable to open file %s\n", argv[1]);
exit (1);
return (1);
}
oggz_set_read_callback (oggz, -1, read_packet, NULL);
......@@ -87,5 +87,5 @@ main (int argc, char ** argv)
oggz_close (oggz);
exit (0);
return (0);
}
......@@ -213,6 +213,12 @@ main (int argc, char * argv[])
int i;
progname = argv[0];
if (argc < 2) {
usage (progname);
return (1);
}
omdata = omdata_new();
while (1) {
......@@ -233,14 +239,14 @@ main (int argc, char * argv[])
if (i == ':') {
usage (progname);
omdata_delete (omdata);
exit (1);
return (1);
}
switch (i) {
case 'h': /* help */
usage (progname);
omdata_delete (omdata);
exit (0);
return (0);
break;
case 'o': /* output */
outfilename = optarg;
......@@ -254,7 +260,7 @@ main (int argc, char * argv[])
if (optind >= argc) {
usage (progname);
omdata_delete (omdata);
exit (1);
return (1);
}
while (optind < argc) {
......@@ -276,7 +282,7 @@ main (int argc, char * argv[])
fprintf (stderr, "%s: unable to open output file %s\n",
progname, outfilename);
omdata_delete (omdata);
exit (1);
return (1);
}
}
......@@ -284,5 +290,5 @@ main (int argc, char * argv[])
omdata_delete (omdata);
exit (0);
return (0);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment