[xiph-commits] r3631 - liboggz/trunk/src/tools
conrad at svn.annodex.net
conrad at svn.annodex.net
Wed Jul 9 02:54:45 PDT 2008
Author: conrad
Date: 2008-07-09 02:54:44 -0700 (Wed, 09 Jul 2008)
New Revision: 3631
Modified:
liboggz/trunk/src/tools/oggz.c
Log:
Report attempts to run unknown tools, and automatically fallback to
toolname --help if man is not installed (rather than only falling
back for win32 systems)
Modified: liboggz/trunk/src/tools/oggz.c
===================================================================
--- liboggz/trunk/src/tools/oggz.c 2008-07-08 16:28:12 UTC (rev 3630)
+++ liboggz/trunk/src/tools/oggz.c 2008-07-09 09:54:44 UTC (rev 3631)
@@ -84,6 +84,7 @@
{
char * progname = argv[0];
char toolname[TOOLNAME_LEN];
+ int ret;
if (argc < 2) {
usage (progname);
@@ -95,20 +96,29 @@
usage (progname);
} else {
sprintf (toolname, "oggz-%s", argv[2]);
-#ifdef _WIN32
+
+ /* Try running "man toolname" */
+ argv[1] = "man";
+ argv[2] = toolname;
+ ret = execvp ("man", &argv[1]);
+
+ /* If that fails (ie. "man" is not installed), try running "toolname --help" */
argv[1] = toolname;
argv[2] = "--help";
- execvp (toolname, &argv[1]);
-#else
- argv[1] = "man";
- argv[2] = toolname;
- execvp ("man", &argv[1]);
-#endif
+ ret = execvp (toolname, &argv[1]);
+
+ if (ret == -1) {
+ perror (toolname);
+ }
}
} else {
sprintf (toolname, "oggz-%s", argv[1]);
argv[1] = toolname;
- execvp (toolname, &argv[1]);
+ ret = execvp (toolname, &argv[1]);
+
+ if (ret == -1) {
+ perror (toolname);
+ }
}
}
More information about the commits
mailing list