2012-01-30 17:41:33 -05:00
|
|
|
/* See LICENSE file for copyright and license details. */
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include "fs.h"
|
|
|
|
#include "util.h"
|
|
|
|
|
2013-08-31 18:04:49 -04:00
|
|
|
static void
|
|
|
|
usage(void)
|
|
|
|
{
|
|
|
|
eprintf("usage: %s source... dest\n", argv0);
|
|
|
|
}
|
|
|
|
|
2012-01-30 17:41:33 -05:00
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
struct stat st;
|
2013-07-20 01:27:42 -04:00
|
|
|
|
2013-03-10 20:59:22 -04:00
|
|
|
ARGBEGIN {
|
|
|
|
case 'r':
|
|
|
|
cp_rflag = true;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
} ARGEND;
|
2013-07-20 01:27:42 -04:00
|
|
|
|
2013-08-31 18:04:49 -04:00
|
|
|
if (argc < 2)
|
|
|
|
usage();
|
|
|
|
|
2013-03-10 20:59:22 -04:00
|
|
|
if(argc > 2 && !(stat(argv[argc-1], &st) == 0 && S_ISDIR(st.st_mode)))
|
2012-01-30 17:41:33 -05:00
|
|
|
eprintf("%s: not a directory\n", argv[argc-1]);
|
2013-03-10 20:59:22 -04:00
|
|
|
enmasse(argc, argv, cp);
|
2012-01-30 17:41:33 -05:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|