mirror of
git://git.suckless.org/sbase
synced 2024-12-29 02:22:27 +00:00
39 lines
625 B
C
39 lines
625 B
C
/* See LICENSE file for copyright and license details. */
|
|
#include <stdbool.h>
|
|
#include <stdlib.h>
|
|
#include <sys/stat.h>
|
|
#include "fs.h"
|
|
#include "util.h"
|
|
|
|
static void
|
|
usage(void)
|
|
{
|
|
eprintf("usage: %s [-fRr] source... dest\n", argv0);
|
|
}
|
|
|
|
int
|
|
main(int argc, char *argv[])
|
|
{
|
|
struct stat st;
|
|
|
|
ARGBEGIN {
|
|
case 'f':
|
|
cp_fflag = true;
|
|
break;
|
|
case 'R':
|
|
case 'r':
|
|
cp_rflag = true;
|
|
break;
|
|
default:
|
|
usage();
|
|
} 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);
|
|
return EXIT_SUCCESS;
|
|
}
|