diff options
author | phk <phk@FreeBSD.org> | 2003-07-11 20:51:16 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-07-11 20:51:16 +0000 |
commit | 519d477531cf3d0a34bd3f4bab47c09c10355b48 (patch) | |
tree | 1984a819260bbc6df43549d06b51e5184c283513 /usr.bin | |
parent | 2e87863b0449adbce4a754c613d9816d4c4065bf (diff) | |
download | FreeBSD-src-519d477531cf3d0a34bd3f4bab47c09c10355b48.zip FreeBSD-src-519d477531cf3d0a34bd3f4bab47c09c10355b48.tar.gz |
Since (x)install is pretty unhelpfull and just spits out a Usage
for a lot of unrelated error conditions, at least report the line
number where it bailed.
Don't use multiline string literals for Usage, gcc 3.3 doesn't like them.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/xinstall/xinstall.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index cc27f6e..dae010a 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -97,7 +97,7 @@ void install_dir(char *); u_long numeric_id(const char *, const char *); void strip(const char *); int trymmap(int); -void usage(void); +void usage(int); int main(int argc, char *argv[]) @@ -165,18 +165,18 @@ main(int argc, char *argv[]) break; case '?': default: - usage(); + usage(__LINE__); } argc -= optind; argv += optind; /* some options make no sense when creating directories */ if (dostrip && dodir) - usage(); + usage(__LINE__); /* must have at least two arguments, except when creating directories */ if (argc < 2 && !dodir) - usage(); + usage(__LINE__); /* need to make a temp copy so we can compare stripped version */ if (docompare && dostrip) @@ -216,7 +216,7 @@ main(int argc, char *argv[]) /* can't do file1 file2 directory/file */ if (argc != 2) - usage(); + usage(__LINE__); if (!no_target) { if (stat(*argv, &from_sb)) @@ -757,14 +757,15 @@ install_dir(char *path) * print a usage message and die */ void -usage(void) +usage(int line) { - (void)fprintf(stderr, "\ -usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n\ - [-o owner] file1 file2\n\ - install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n\ - [-o owner] file1 ... fileN directory\n\ - install -d [-v] [-g group] [-m mode] [-o owner] directory ...\n"); + (void)fprintf(stderr, "line %d\n" +"usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n" +" [-o owner] file1 file2\n" +" install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]\n" +" [-o owner] file1 ... fileN directory\n" +" install -d [-v] [-g group] [-m mode] [-o owner] directory ...\n", + line); exit(EX_USAGE); /* NOTREACHED */ } |