- Rearrange reactos.dff according to rosapps rearrange.
[reactos.git] / rosapps / net / ncftp / ncftp / cmdlist.c
1 /* cmdlist.c
2 *
3 * Copyright (c) 1992-2001 by Mike Gleason.
4 * All rights reserved.
5 *
6 */
7
8 #include "syshdrs.h"
9 #include "shell.h"
10 #include "bookmark.h"
11 #include "cmds.h"
12
13 /* These will be sorted lexiographically when the program is run, but
14 * they should already be listed that way.
15 */
16 Command gCommands[] = {
17 #if defined(WIN32) || defined(_WINDOWS)
18 #else
19 { "!",
20 ShellCmd,
21 "[arguments]",
22 "Runs a subshell",
23 kCmdHidden,
24 kNoMin, kNoMax,
25 },
26 #endif
27 { "?",
28 HelpCmd,
29 "[optional commands]",
30 "shows commands, or detailed help on specified commands",
31 kCmdHidden,
32 kNoMin, kNoMax,
33 },
34 { "ascii",
35 TypeCmd,
36 "",
37 "sets the file transfer type to ASCII text",
38 kCmdMustBeConnected,
39 0, 0,
40 },
41 { "bgget",
42 SpoolGetCmd,
43 "[-flags] file1 [file2...]\n\
44 Flags:\n\
45 -R : Recursive. Useful for fetching whole directories.\n\
46 -z : Get the remote file X, and name it to Y.\n\
47 -@ <time> : Wait until <time> to do the transfer.\n\
48 It must be expressed as one of the following:\n\
49 YYYYMMDDHHMMSS\n\
50 \"now + N hours|min|sec|days\"\n\
51 HH:MM",
52 "collects items to download later from the remote host",
53 kCmdMustBeConnected | kCompleteRemoteFile,
54 1, kNoMax,
55 },
56 { "bgput",
57 SpoolPutCmd,
58 "[-flags] file1 [file2...]\n\
59 Flags:\n\
60 -z : Send the local file X, and name the remote copy to Y.\n\
61 -R : Recursive. Useful for sending whole directories.\n\
62 -@ <time> : Wait until <time> to do the transfer.\n\
63 It must be expressed as one of the following:\n\
64 YYYYMMDDHHMMSS\n\
65 \"now + N hours|min|sec|days\"\n\
66 HH:MM",
67 "collects items to upload later to the remote host",
68 kCmdMustBeConnected | kCompleteLocalFile,
69 1, kNoMax,
70 },
71 { "bgstart",
72 BGStartCmd,
73 "[n]",
74 "starts a ncftpbatch process to process spooled files",
75 0,
76 0, 1,
77 },
78 { "binary",
79 TypeCmd,
80 "",
81 "sets the file transfer type to binary/image",
82 kCmdMustBeConnected,
83 0, 0,
84 },
85 { "bookmark",
86 BookmarkCmd,
87 "[bookmark-name-to-save-as]",
88 "Creates or updates a bookmark using the current host and directory",
89 kCmdMustBeConnected | kCompleteBookmark,
90 0, 1,
91 },
92 { "bookmarks",
93 (CmdProc) HostsCmd,
94 "[-l]",
95 "lets you edit the settings for each bookmark",
96 0,
97 kNoMin, kNoMax,
98 },
99 { "bye",
100 (CmdProc) QuitCmd,
101 "",
102 "exits NcFTP",
103 kCmdHidden,
104 0, 0,
105 },
106 { "cat",
107 CatCmd,
108 "file1 [file2...]",
109 "views a file from the remote host",
110 kCmdMustBeConnected | kCompleteRemoteFile,
111 1, kNoMax,
112 },
113 { "cd",
114 ChdirCmd,
115 "<directory>",
116 "changes remote working directory",
117 kCmdMustBeConnected | kCompleteRemoteDir,
118 0, 1,
119 },
120 { "chmod",
121 ChmodCmd,
122 "mode file1 [file2...]",
123 "changes permissions for files on the remote host",
124 kCmdMustBeConnected | kCompleteRemoteFile,
125 2, kNoMax,
126 },
127 { "close",
128 (CmdProc) CloseCmd,
129 "",
130 "closes the connection to the remote host",
131 kCmdMustBeConnected,
132 0, 0,
133 },
134 { "debug",
135 DebugCmd,
136 "[debug level]",
137 "sets debug mode to level x",
138 0,
139 kNoMin, kNoMax,
140 },
141 { "delete",
142 DeleteCmd,
143 "file1 [file2...]",
144 "deletes files from the remote host",
145 kCmdMustBeConnected | kCmdHidden | kCompleteRemoteFile,
146 1, kNoMax,
147 },
148 { "dir",
149 ListCmd,
150 "[items to list]",
151 "prints a verbose directory listing",
152 kCmdMustBeConnected | kCompleteRemoteDir,
153 kNoMin, kNoMax,
154 },
155 { "echo",
156 EchoCmd,
157 "[items to echo]",
158 "echos back to screen",
159 kCmdHidden,
160 kNoMin, kNoMax,
161 },
162 { "exit",
163 (CmdProc) QuitCmd,
164 "",
165 "quits NcFTP",
166 kCmdHidden,
167 0, 0,
168 },
169 { "get",
170 GetCmd,
171 "[-flags] file1 [file2...]\n\
172 Flags:\n\
173 -R : Recursive. Useful for fetching whole directories.\n\
174 -z : Get the remote file X, and name it to Y.\n\
175 -a : Get files using ASCII mode.\n\
176 -A : Append entire remote file to the local file.\n\
177 -f : Force overwrite (do not try to auto-resume transfers).\n\
178 Examples:\n\
179 get README\n\
180 get README.*\n\
181 get \"**Name with stars and spaces in it**\"\n\
182 get -R new-files-directory\n\
183 get -z WIN.INI ~/junk/windows-init-file",
184 "fetches files from the remote host",
185 kCmdMustBeConnected | kCompleteRemoteFile,
186 1, kNoMax,
187 },
188 { "help",
189 HelpCmd,
190 "[optional commands]",
191 "shows commands, or detailed help on specified commands",
192 0,
193 kNoMin, kNoMax,
194 },
195 { "hosts",
196 (CmdProc) HostsCmd,
197 "",
198 "lets you edit the settings for each remote host",
199 kCmdMustBeDisconnected | kCmdHidden,
200 kNoMin, kNoMax,
201 },
202 #if defined(WIN32) || defined(_WINDOWS)
203 #else
204 { "jobs",
205 (CmdProc) JobsCmd,
206 "",
207 "shows status of background NcFTP tasks",
208 0,
209 0, 0,
210 },
211 #endif
212 { "lcd",
213 LocalChdirCmd,
214 "<directory>",
215 "changes local working directory",
216 kCompleteLocalDir,
217 kNoMin, 1,
218 },
219 #if defined(WIN32) || defined(_WINDOWS)
220 #else
221 { "lchmod",
222 LocalChmodCmd,
223 "mode file1 [file2...]",
224 "changes permissions for files on the local host",
225 kCompleteLocalFile | kCompleteLocalDir,
226 2, kNoMax,
227 },
228 #endif
229 { "less",
230 PageCmd,
231 "file1 [file2...]",
232 "views a file from the remote host one page at a time.",
233 kCmdMustBeConnected | kCmdHidden | kCompleteRemoteFile,
234 1, kNoMax,
235 },
236 { "lls",
237 LocalListCmd,
238 "[items to list]",
239 "prints a local directory listing",
240 kCompleteLocalDir,
241 kNoMin, kNoMax,
242 },
243 { "lmkdir",
244 (CmdProc) LocalMkdirCmd,
245 "[directories]",
246 "creates directories on the local host",
247 0,
248 1, kNoMax,
249 },
250 { "lookup",
251 LookupCmd,
252 "<host or IP number> [<more hosts or IP numbers>]",
253 "looks up information in the host database",
254 0,
255 1, kNoMax,
256 },
257 #if defined(WIN32) || defined(_WINDOWS)
258 #else
259 { "lpage",
260 LocalPageCmd,
261 "file1 [file2...]",
262 "views a file on the local host one page at a time.",
263 kCompleteLocalFile,
264 1, kNoMax,
265 },
266 #endif
267 { "lpwd",
268 (CmdProc) LocalPwdCmd,
269 "",
270 "Prints the current local working directory",
271 0,
272 0, 0,
273 },
274 { "lrename",
275 LocalRenameCmd,
276 "oldname newname",
277 "changes the name of a file on the local host",
278 kCompleteLocalFile | kCompleteLocalDir,
279 2, 2,
280 },
281 { "lrm",
282 (CmdProc) LocalRmCmd,
283 "[files]",
284 "removes files on the local host",
285 kCompleteLocalFile | kCompleteLocalDir,
286 1, kNoMax,
287 },
288 { "lrmdir",
289 (CmdProc) LocalRmdirCmd,
290 "[directories]",
291 "removes directories on the local host",
292 kCompleteLocalDir,
293 1, kNoMax,
294 },
295 { "ls",
296 ListCmd,
297 "[items to list]",
298 "prints a remote directory listing",
299 kCmdMustBeConnected | kCompleteRemoteDir,
300 kNoMin, kNoMax,
301 },
302 { "mget",
303 GetCmd,
304 "[-flags] file1 [file2...]\n\
305 Flags:\n\
306 -R : Recursive. Useful for fetching whole directories.\n\
307 -z : Get the remote file X, and name it to Y.\n\
308 -a : Get files using ASCII mode.\n\
309 -A : Append entire remote file to the local file.\n\
310 -f : Force overwrite (do not try to auto-resume transfers).\n\
311 Examples:\n\
312 get README\n\
313 get README.*\n\
314 get \"**Name with stars and spaces in it**\"\n\
315 get -R new-files-directory\n\
316 get -z WIN.INI ~/junk/windows-init-file",
317 "fetches files from the remote host",
318 kCmdMustBeConnected | kCmdHidden | kCompleteRemoteFile,
319 1, kNoMax,
320 },
321 { "mkdir",
322 MkdirCmd,
323 "dir1 [dir2...]",
324 "creates directories on the remote host",
325 kCmdMustBeConnected,
326 1, kNoMax,
327 },
328 { "mls",
329 MlsCmd,
330 "[<directory to list> | -d <single item to list>]",
331 "prints a machine-readable directory listing",
332 kCmdMustBeConnected | kCompleteRemoteDir | kCmdHidden,
333 kNoMin, kNoMax,
334 },
335 { "more",
336 PageCmd,
337 "file1 [file2...]",
338 "views a file from the remote host one page at a time.",
339 kCmdMustBeConnected | kCmdHidden | kCompleteRemoteFile,
340 1, kNoMax,
341 },
342 { "mput",
343 PutCmd,
344 "[-flags] file1 [file2...]\n\
345 Flags:\n\
346 -z : Send the local file X, and name the remote copy to Y.\n\
347 -f : Force overwrite (do not try to auto-resume transfers).\n\
348 -a : Send files using ASCII mode.\n\
349 -A : Append entire local file to the remote file.\n\
350 -R : Recursive. Useful for sending whole directories.\n\
351 Examples:\n\
352 put README\n\
353 put -z ~/junk/windows-init-file WIN.INI",
354 "sends files to the remote host",
355 kCmdMustBeConnected | kCompleteLocalFile | kCmdHidden,
356 1, kNoMax,
357 },
358 { "page",
359 PageCmd,
360 "file1 [file2...]",
361 "views a file from the remote host one page at a time.",
362 kCmdMustBeConnected | kCompleteRemoteFile,
363 1, kNoMax,
364 },
365 { "open",
366 OpenCmd,
367 "[-flags] [sitename]\n\
368 Flags:\n\
369 -a : Open anonymously.\n\
370 -u XX : Login with username XX.\n\
371 -p XX : Login with password XX.\n\
372 -j XX : Login with account XX.\n\
373 -P XX : Use port number X when opening.\n\
374 Examples:\n\
375 open sphygmomanometer.unl.edu\n\
376 open -u mario bowser.nintendo.co.jp\n",
377 "connects to a remote host",
378 kCompleteBookmark,
379 kNoMin, kNoMax,
380 },
381 { "pdir",
382 ListCmd,
383 "[items to list]",
384 "views a directory listing through your pager",
385 kCmdMustBeConnected | kCompleteRemoteDir,
386 kNoMin, kNoMax,
387 },
388 { "pls",
389 ListCmd,
390 "[items to list]",
391 "views a directory listing through your pager",
392 kCmdMustBeConnected | kCompleteRemoteDir,
393 kNoMin, kNoMax,
394 },
395 { "prefs",
396 (CmdProc) SetCmd,
397 "",
398 "shows the program's settings",
399 kCmdHidden,
400 0, 0,
401 },
402 { "put",
403 PutCmd,
404 "[-flags] file1 [file2...]\n\
405 Flags:\n\
406 -z : Send the local file X, and name the remote copy to Y.\n\
407 -f : Force overwrite (do not try to auto-resume transfers).\n\
408 -a : Send files using ASCII mode.\n\
409 -A : Append entire local file to the remote file.\n\
410 -R : Recursive. Useful for sending whole directories.\n\
411 Examples:\n\
412 put README\n\
413 put -z ~/junk/windows-init-file WIN.INI",
414 "sends a file to the remote host",
415 kCmdMustBeConnected | kCompleteLocalFile,
416 1, kNoMax,
417 },
418 { "pwd",
419 (CmdProc) PwdCmd,
420 "",
421 "Prints the current remote working directory",
422 kCmdMustBeConnected,
423 0, 0,
424 },
425 { "quit",
426 (CmdProc) QuitCmd,
427 "",
428 "take a wild guess",
429 0,
430 0, 0,
431 },
432 { "quote",
433 QuoteCmd,
434 "command-string",
435 "sends an FTP command to the remote server",
436 kCmdMustBeConnected,
437 1, kNoMax,
438 },
439 { "rename",
440 RenameCmd,
441 "oldname newname",
442 "changes the name of a file on the remote host",
443 kCmdMustBeConnected | kCompleteRemoteFile,
444 2, 2,
445 },
446 { "rglob",
447 RGlobCmd,
448 "regex",
449 "tests remote filename wildcard matching",
450 kCmdMustBeConnected | kCmdHidden,
451 1, kNoMax,
452 },
453 { "rhelp",
454 RmtHelpCmd,
455 "[help string]",
456 "requests help from the remote server",
457 kCmdMustBeConnected,
458 kNoMin, kNoMax,
459 },
460 { "rm",
461 DeleteCmd,
462 "[-r] file1 [file2...]",
463 "deletes files from the remote host",
464 kCmdMustBeConnected | kCompleteRemoteFile,
465 1, kNoMax,
466 },
467 { "rmdir",
468 RmdirCmd,
469 "dir1 [dir2...]",
470 "deletes directories from the remote host",
471 kCmdMustBeConnected | kCompleteRemoteDir,
472 1, kNoMax,
473 },
474 { "set",
475 SetCmd,
476 "[option [newvalue]]",
477 "lets you configure a program setting from the command line",
478 kCompletePrefOpt,
479 0, 2,
480 },
481 { "show",
482 (CmdProc) SetCmd,
483 "[option]",
484 "shows one or more the program's settings",
485 kCompletePrefOpt,
486 0, 1,
487 },
488 { "site",
489 SiteCmd,
490 "command-string",
491 "sends a host-specific FTP command to the remote server",
492 kCmdMustBeConnected,
493 1, kNoMax,
494 },
495 { "symlink",
496 SymlinkCmd,
497 "existing-item link-item",
498 "creates a symbolic link on the remote host",
499 kCmdHidden | kCmdMustBeConnected | kCompleteRemoteFile,
500 2, 2,
501 },
502 { "type",
503 TypeCmd,
504 "[ascii | binary | image]",
505 "sets file transfer type (one of 'ascii' or 'binary')",
506 kCmdMustBeConnected,
507 0, 1,
508 },
509 { "umask",
510 UmaskCmd,
511 "mask",
512 "sets the process umask on remote host",
513 kCmdMustBeConnected,
514 1, 1,
515 },
516 { "version",
517 (CmdProc) VersionCmd,
518 "",
519 "prints version information",
520 0,
521 kNoMin, kNoMax,
522 },
523 };
524
525 size_t gNumCommands = ((size_t) (sizeof(gCommands) / sizeof(Command)));
526
527 /* eof */