| 31 |
#include <err.h> |
#include <err.h> |
| 32 |
#include <getopt.h> |
#include <getopt.h> |
| 33 |
#include <stdio.h> |
#include <stdio.h> |
| 34 |
|
#include <stdlib.h> |
| 35 |
#include <string.h> |
#include <string.h> |
| 36 |
|
|
| 37 |
#include <rump/ukfs.h> |
#include <rump/ukfs.h> |
| 42 |
static int is_user_ok(const char *); |
static int is_user_ok(const char *); |
| 43 |
static int move_to_dir(struct ukfs *, const char *, const char *, int); |
static int move_to_dir(struct ukfs *, const char *, const char *, int); |
| 44 |
static int move_to_file(struct ukfs *, const char *, const char *, int); |
static int move_to_file(struct ukfs *, const char *, const char *, int); |
| 45 |
|
static void usage(void); |
| 46 |
|
|
| 47 |
|
static char *progname; |
| 48 |
|
|
| 49 |
int |
int |
| 50 |
fsu_mv_main(struct ukfs *fs, int argc, char *argv[]) |
fsu_mv_main(struct ukfs *fs, int argc, char *argv[]) |
| 51 |
{ |
{ |
| 52 |
int cur_arg, flags = 0, rv; |
int cur_arg, flags = 0, rv; |
| 53 |
|
|
| 54 |
|
progname = argv[0]; |
| 55 |
|
|
| 56 |
flags = fsu_mv_parse_arg(&argc, &argv); |
flags = fsu_mv_parse_arg(&argc, &argv); |
| 57 |
if (flags == -1 || argc < 2) { |
if (flags == -1 || argc < 2) { |
| 58 |
fprintf(stderr, "usage: \tmv [-iv] source target\n" |
usage(); |
|
"\tmv [-iv] source ... directory\n"); |
|
| 59 |
return -1; |
return -1; |
| 60 |
} |
} |
| 61 |
|
|
| 191 |
} |
} |
| 192 |
return 0; |
return 0; |
| 193 |
} |
} |
| 194 |
|
|
| 195 |
|
static void |
| 196 |
|
usage(void) |
| 197 |
|
{ |
| 198 |
|
|
| 199 |
|
#ifdef FSU_CONSOLE |
| 200 |
|
fprintf(stderr, "usage: \t%s [-iv] source target\n" |
| 201 |
|
"\t%s [-iv] source ... directory\n", |
| 202 |
|
progname, progname); |
| 203 |
|
#else |
| 204 |
|
fprintf(stderr, |
| 205 |
|
"usage: \t%s [MNT_OPTIONS] [fstype] fsdevice [-iv] source target\n" |
| 206 |
|
" \t%s [MNT_OPTIONS] [fstype] fsdevice [-iv] source ... directory\n", |
| 207 |
|
getprogname(), getprogname()); |
| 208 |
|
exit(EXIT_FAILURE); |
| 209 |
|
#endif |
| 210 |
|
} |