ReactOS  0.4.14-dev-297-g23e575c
cmdlist.c
Go to the documentation of this file.
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  */
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",
39  0, 0,
40  },
41  { "bgget",
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",
54  1, kNoMax,
55  },
56  { "bgput",
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",
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",
83  0, 0,
84  },
85  { "bookmark",
87  "[bookmark-name-to-save-as]",
88  "Creates or updates a bookmark using the current host and directory",
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",
111  1, kNoMax,
112  },
113  { "cd",
114  ChdirCmd,
115  "<directory>",
116  "changes remote working directory",
118  0, 1,
119  },
120  { "chmod",
121  ChmodCmd,
122  "mode file1 [file2...]",
123  "changes permissions for files on the remote host",
125  2, kNoMax,
126  },
127  { "close",
128  (CmdProc) CloseCmd,
129  "",
130  "closes the connection to the remote host",
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",
146  1, kNoMax,
147  },
148  { "dir",
149  ListCmd,
150  "[items to list]",
151  "prints a verbose directory listing",
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",
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",
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",
214  "<directory>",
215  "changes local working directory",
217  kNoMin, 1,
218  },
219 #if defined(WIN32) || defined(_WINDOWS)
220 #else
221  { "lchmod",
223  "mode file1 [file2...]",
224  "changes permissions for files on the local host",
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.",
234  1, kNoMax,
235  },
236  { "lls",
237  LocalListCmd,
238  "[items to list]",
239  "prints a local directory listing",
241  kNoMin, kNoMax,
242  },
243  { "lmkdir",
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.",
264  1, kNoMax,
265  },
266 #endif
267  { "lpwd",
269  "",
270  "Prints the current local working directory",
271  0,
272  0, 0,
273  },
274  { "lrename",
276  "oldname newname",
277  "changes the name of a file on the local host",
279  2, 2,
280  },
281  { "lrm",
283  "[files]",
284  "removes files on the local host",
286  1, kNoMax,
287  },
288  { "lrmdir",
290  "[directories]",
291  "removes directories on the local host",
293  1, kNoMax,
294  },
295  { "ls",
296  ListCmd,
297  "[items to list]",
298  "prints a remote directory listing",
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",
319  1, kNoMax,
320  },
321  { "mkdir",
322  MkdirCmd,
323  "dir1 [dir2...]",
324  "creates directories on the remote host",
326  1, kNoMax,
327  },
328  { "mls",
329  MlsCmd,
330  "[<directory to list> | -d <single item to list>]",
331  "prints a machine-readable directory listing",
333  kNoMin, kNoMax,
334  },
335  { "more",
336  PageCmd,
337  "file1 [file2...]",
338  "views a file from the remote host one page at a time.",
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",
356  1, kNoMax,
357  },
358  { "page",
359  PageCmd,
360  "file1 [file2...]",
361  "views a file from the remote host one page at a time.",
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",
379  kNoMin, kNoMax,
380  },
381  { "pdir",
382  ListCmd,
383  "[items to list]",
384  "views a directory listing through your pager",
386  kNoMin, kNoMax,
387  },
388  { "pls",
389  ListCmd,
390  "[items to list]",
391  "views a directory listing through your pager",
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",
416  1, kNoMax,
417  },
418  { "pwd",
419  (CmdProc) PwdCmd,
420  "",
421  "Prints the current remote working directory",
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",
437  1, kNoMax,
438  },
439  { "rename",
440  RenameCmd,
441  "oldname newname",
442  "changes the name of a file on the remote host",
444  2, 2,
445  },
446  { "rglob",
447  RGlobCmd,
448  "regex",
449  "tests remote filename wildcard matching",
451  1, kNoMax,
452  },
453  { "rhelp",
454  RmtHelpCmd,
455  "[help string]",
456  "requests help from the remote server",
458  kNoMin, kNoMax,
459  },
460  { "rm",
461  DeleteCmd,
462  "[-r] file1 [file2...]",
463  "deletes files from the remote host",
465  1, kNoMax,
466  },
467  { "rmdir",
468  RmdirCmd,
469  "dir1 [dir2...]",
470  "deletes directories from the remote host",
472  1, kNoMax,
473  },
474  { "set",
475  SetCmd,
476  "[option [newvalue]]",
477  "lets you configure a program setting from the command line",
479  0, 2,
480  },
481  { "show",
482  (CmdProc) SetCmd,
483  "[option]",
484  "shows one or more the program's settings",
486  0, 1,
487  },
488  { "site",
489  SiteCmd,
490  "command-string",
491  "sends a host-specific FTP command to the remote server",
493  1, kNoMax,
494  },
495  { "symlink",
496  SymlinkCmd,
497  "existing-item link-item",
498  "creates a symbolic link on the remote host",
500  2, 2,
501  },
502  { "type",
503  TypeCmd,
504  "[ascii | binary | image]",
505  "sets file transfer type (one of 'ascii' or 'binary')",
507  0, 1,
508  },
509  { "umask",
510  UmaskCmd,
511  "mask",
512  "sets the process umask on remote host",
514  1, 1,
515  },
516  { "version",
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 */
void ShellCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3094
void LocalListCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1552
void SpoolGetCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3298
void MlsCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1937
void LocalRmdirCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1836
void PageCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:2496
void HostsCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1329
#define kCompletePrefOpt
Definition: shell.h:66
void BGStartCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3266
void LookupCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1886
Definition: shell.h:41
void BookmarkCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:323
void DeleteCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:664
void SpoolPutCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3454
void DebugCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:650
#define kCompleteBookmark
Definition: shell.h:65
#define kCompleteRemoteFile
Definition: shell.h:61
void UmaskCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3672
void QuitCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:2923
void GetCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:916
void EchoCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:706
#define kCmdMustBeConnected
Definition: shell.h:59
void MkdirCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:2011
void PwdCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:2876
#define kCmdMustBeDisconnected
Definition: shell.h:60
void PutCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:2768
#define kCompleteRemoteDir
Definition: shell.h:62
void LocalRenameCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1786
void SiteCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3146
__kernel_size_t size_t
Definition: linux.h:237
void RmdirCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3007
struct Command Command
void ChmodCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:612
Command gCommands[]
Definition: cmdlist.c:16
#define kCompleteLocalFile
Definition: shell.h:63
size_t gNumCommands
Definition: cmdlist.c:525
#define kCmdHidden
Definition: shell.h:58
void OpenCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:2317
void LocalRmCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1802
void VersionCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3687
void QuoteCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:2934
void SetCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3078
void CatCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:356
void HelpCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1036
void LocalPwdCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1871
void SymlinkCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3609
void LocalMkdirCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1751
void RmtHelpCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3041
#define kNoMin
Definition: shell.h:35
void JobsCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1358
void RenameCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:2988
void RGlobCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:2954
#define kNoMax
Definition: shell.h:34
void(* CmdProc)(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: shell.h:29
void LocalPageCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1775
void CloseCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:637
void ListCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1371
void TypeCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:3627
void ChdirCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:558
void LocalChmodCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1741
#define kCompleteLocalDir
Definition: shell.h:64
void LocalChdirCmd(const int argc, const char **const argv, const CommandPtr cmdp, const ArgvInfoPtr aip)
Definition: cmds.c:1514