1
/* $Id: pmv.c,v 1.5 2003/05/28 06:37:48 twogood Exp $ */
10
static void show_usage(const char* name)
15
"\t%s [-d LEVEL] [-h] SOURCE DESTINATION\n"
17
"\t-d LEVEL Set debug log level\n"
18
"\t 0 - No logging (default)\n"
19
"\t 1 - Errors only\n"
20
"\t 2 - Errors and warnings\n"
22
"\t-h Show this help message\n"
23
"\tSOURCE The current filename\n"
24
"\tDESTINATION The new filename\n",
28
static bool handle_parameters(int argc, char** argv, char** source, char** dest)
31
int log_level = SYNCE_LOG_LEVEL_LOWEST;
33
while ((c = getopt(argc, argv, "d:h")) != -1)
38
log_level = atoi(optarg);
48
synce_log_set_level(log_level);
50
if ((argc - optind) != 2)
52
fprintf(stderr, "%s: You need to specify source and destination file names on command line\n\n", argv[0]);
57
*source = strdup(argv[optind++]);
58
*dest = strdup(argv[optind++]);
63
int main(int argc, char** argv)
69
WCHAR* wide_source = NULL;
70
WCHAR* wide_dest = NULL;
72
if (!handle_parameters(argc, argv, &source, &dest))
79
fprintf(stderr, "%s: Unable to initialize RAPI: %s\n",
85
convert_to_backward_slashes(source);
86
wide_source = wstr_from_ascii(source);
87
wide_source = adjust_remote_path(wide_source, true);
89
convert_to_backward_slashes(dest);
90
wide_dest = wstr_from_ascii(dest);
91
wide_dest = adjust_remote_path(wide_dest, true);
93
if (!CeMoveFile(wide_source, wide_dest))
95
fprintf(stderr, "%s: Cannot move '%s' to '%s': %s\n",
99
synce_strerror(CeGetLastError()));
106
wstr_free_string(wide_source);
107
wstr_free_string(wide_dest);