|
Lines 109-114
Link Here
|
| 109 |
#define I_GET 5 |
109 |
#define I_GET 5 |
| 110 |
#define I_HELP 6 |
110 |
#define I_HELP 6 |
| 111 |
#define I_LCHDIR 7 |
111 |
#define I_LCHDIR 7 |
|
|
112 |
#define I_LINK 25 |
| 112 |
#define I_LLS 8 |
113 |
#define I_LLS 8 |
| 113 |
#define I_LMKDIR 9 |
114 |
#define I_LMKDIR 9 |
| 114 |
#define I_LPWD 10 |
115 |
#define I_LPWD 10 |
|
Lines 153-159
Link Here
|
| 153 |
{ "lchdir", I_LCHDIR, LOCAL }, |
154 |
{ "lchdir", I_LCHDIR, LOCAL }, |
| 154 |
{ "lls", I_LLS, LOCAL }, |
155 |
{ "lls", I_LLS, LOCAL }, |
| 155 |
{ "lmkdir", I_LMKDIR, LOCAL }, |
156 |
{ "lmkdir", I_LMKDIR, LOCAL }, |
| 156 |
{ "ln", I_SYMLINK, REMOTE }, |
157 |
{ "ln", I_LINK, REMOTE }, |
| 157 |
{ "lpwd", I_LPWD, LOCAL }, |
158 |
{ "lpwd", I_LPWD, LOCAL }, |
| 158 |
{ "ls", I_LS, REMOTE }, |
159 |
{ "ls", I_LS, REMOTE }, |
| 159 |
{ "lumask", I_LUMASK, NOARGS }, |
160 |
{ "lumask", I_LUMASK, NOARGS }, |
|
Lines 217-223
Link Here
|
| 217 |
"lcd path Change local directory to 'path'\n" |
218 |
"lcd path Change local directory to 'path'\n" |
| 218 |
"lls [ls-options [path]] Display local directory listing\n" |
219 |
"lls [ls-options [path]] Display local directory listing\n" |
| 219 |
"lmkdir path Create local directory\n" |
220 |
"lmkdir path Create local directory\n" |
| 220 |
"ln oldpath newpath Symlink remote file\n" |
221 |
"ln [-s] oldpath newpath Link remote file (-s for symlink)\n" |
| 221 |
"lpwd Print local working directory\n" |
222 |
"lpwd Print local working directory\n" |
| 222 |
"ls [-1afhlnrSt] [path] Display remote directory listing\n" |
223 |
"ls [-1afhlnrSt] [path] Display remote directory listing\n" |
| 223 |
"lumask umask Set local umask to 'umask'\n" |
224 |
"lumask umask Set local umask to 'umask'\n" |
|
Lines 354-359
Link Here
|
| 354 |
} |
355 |
} |
| 355 |
|
356 |
|
| 356 |
static int |
357 |
static int |
|
|
358 |
parse_link_flags(const char *cmd, char **argv, int argc, int *sflag) |
| 359 |
{ |
| 360 |
extern int opterr, optind, optopt, optreset; |
| 361 |
int ch; |
| 362 |
|
| 363 |
optind = optreset = 1; |
| 364 |
opterr = 0; |
| 365 |
|
| 366 |
*sflag = 0; |
| 367 |
while ((ch = getopt(argc, argv, "s")) != -1) { |
| 368 |
switch (ch) { |
| 369 |
case 's': |
| 370 |
*sflag = 1; |
| 371 |
break; |
| 372 |
default: |
| 373 |
error("%s: Invalid flag -%c", cmd, optopt); |
| 374 |
return -1; |
| 375 |
} |
| 376 |
} |
| 377 |
|
| 378 |
return optind; |
| 379 |
} |
| 380 |
|
| 381 |
static int |
| 357 |
parse_ls_flags(char **argv, int argc, int *lflag) |
382 |
parse_ls_flags(char **argv, int argc, int *lflag) |
| 358 |
{ |
383 |
{ |
| 359 |
extern int opterr, optind, optopt, optreset; |
384 |
extern int opterr, optind, optopt, optreset; |
|
Lines 1065-1071
Link Here
|
| 1065 |
|
1090 |
|
| 1066 |
static int |
1091 |
static int |
| 1067 |
parse_args(const char **cpp, int *pflag, int *rflag, int *lflag, int *iflag, |
1092 |
parse_args(const char **cpp, int *pflag, int *rflag, int *lflag, int *iflag, |
| 1068 |
int *hflag, unsigned long *n_arg, char **path1, char **path2) |
1093 |
int *hflag, int *sflag, unsigned long *n_arg, char **path1, char **path2) |
| 1069 |
{ |
1094 |
{ |
| 1070 |
const char *cmd, *cp = *cpp; |
1095 |
const char *cmd, *cp = *cpp; |
| 1071 |
char *cp2, **argv; |
1096 |
char *cp2, **argv; |
|
Lines 1115-1121
Link Here
|
| 1115 |
switch (cmdnum) { |
1140 |
switch (cmdnum) { |
| 1116 |
case I_GET: |
1141 |
case I_GET: |
| 1117 |
case I_PUT: |
1142 |
case I_PUT: |
| 1118 |
if ((optidx = parse_getput_flags(cmd, argv, argc, pflag, rflag)) == -1) |
1143 |
if ((optidx = parse_getput_flags(cmd, argv, argc, |
|
|
1144 |
pflag, rflag)) == -1) |
| 1119 |
return -1; |
1145 |
return -1; |
| 1120 |
/* Get first pathname (mandatory) */ |
1146 |
/* Get first pathname (mandatory) */ |
| 1121 |
if (argc - optidx < 1) { |
1147 |
if (argc - optidx < 1) { |
|
Lines 1131-1138
Link Here
|
| 1131 |
undo_glob_escape(*path2); |
1157 |
undo_glob_escape(*path2); |
| 1132 |
} |
1158 |
} |
| 1133 |
break; |
1159 |
break; |
|
|
1160 |
case I_LINK: |
| 1161 |
if ((optidx = parse_link_flags(cmd, argv, argc, sflag)) == -1) |
| 1162 |
return -1; |
| 1163 |
case I_SYMLINK: |
| 1134 |
case I_RENAME: |
1164 |
case I_RENAME: |
| 1135 |
case I_SYMLINK: |
|
|
| 1136 |
if (argc - optidx < 2) { |
1165 |
if (argc - optidx < 2) { |
| 1137 |
error("You must specify two paths after a %s " |
1166 |
error("You must specify two paths after a %s " |
| 1138 |
"command.", cmd); |
1167 |
"command.", cmd); |
|
Lines 1235-1241
Link Here
|
| 1235 |
int err_abort) |
1264 |
int err_abort) |
| 1236 |
{ |
1265 |
{ |
| 1237 |
char *path1, *path2, *tmp; |
1266 |
char *path1, *path2, *tmp; |
| 1238 |
int pflag = 0, rflag = 0, lflag = 0, iflag = 0, hflag = 0, cmdnum, i; |
1267 |
int pflag = 0, rflag = 0, lflag = 0, iflag = 0, hflag = 0, sflag = 0; |
|
|
1268 |
int cmdnum, i; |
| 1239 |
unsigned long n_arg = 0; |
1269 |
unsigned long n_arg = 0; |
| 1240 |
Attrib a, *aa; |
1270 |
Attrib a, *aa; |
| 1241 |
char path_buf[MAXPATHLEN]; |
1271 |
char path_buf[MAXPATHLEN]; |
|
Lines 1243-1250
Link Here
|
| 1243 |
glob_t g; |
1273 |
glob_t g; |
| 1244 |
|
1274 |
|
| 1245 |
path1 = path2 = NULL; |
1275 |
path1 = path2 = NULL; |
| 1246 |
cmdnum = parse_args(&cmd, &pflag, &rflag, &lflag, &iflag, &hflag, &n_arg, |
1276 |
cmdnum = parse_args(&cmd, &pflag, &rflag, &lflag, &iflag, &hflag, |
| 1247 |
&path1, &path2); |
1277 |
&sflag, &n_arg, &path1, &path2); |
| 1248 |
|
1278 |
|
| 1249 |
if (iflag != 0) |
1279 |
if (iflag != 0) |
| 1250 |
err_abort = 0; |
1280 |
err_abort = 0; |
|
Lines 1272-1279
Link Here
|
| 1272 |
err = do_rename(conn, path1, path2); |
1302 |
err = do_rename(conn, path1, path2); |
| 1273 |
break; |
1303 |
break; |
| 1274 |
case I_SYMLINK: |
1304 |
case I_SYMLINK: |
|
|
1305 |
sflag = 1; |
| 1306 |
case I_LINK: |
| 1307 |
path1 = make_absolute(path1, *pwd); |
| 1275 |
path2 = make_absolute(path2, *pwd); |
1308 |
path2 = make_absolute(path2, *pwd); |
| 1276 |
err = do_symlink(conn, path1, path2); |
1309 |
err = (sflag ? do_symlink : do_hardlink)(conn, path1, path2); |
| 1277 |
break; |
1310 |
break; |
| 1278 |
case I_RM: |
1311 |
case I_RM: |
| 1279 |
path1 = make_absolute(path1, *pwd); |
1312 |
path1 = make_absolute(path1, *pwd); |