None of these work without the proper # of arguments so print usage

This commit is contained in:
sin
2013-08-31 23:04:49 +01:00
parent 355911f010
commit 428cd4fe84
6 changed files with 27 additions and 0 deletions

9
cp.c
View File

@@ -5,6 +5,12 @@
#include "fs.h"
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s source... dest\n", argv0);
}
int
main(int argc, char *argv[])
{
@@ -18,6 +24,9 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
} ARGEND;
if (argc < 2)
usage();
if(argc > 2 && !(stat(argv[argc-1], &st) == 0 && S_ISDIR(st.st_mode)))
eprintf("%s: not a directory\n", argv[argc-1]);
enmasse(argc, argv, cp);