File: commands.h

package info (click to toggle)
yafc 1.1.1.dfsg.1-4
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,248 kB
  • ctags: 1,679
  • sloc: ansic: 19,338; sh: 10,365; makefile: 155; perl: 38; ruby: 33
file content (184 lines) | stat: -rw-r--r-- 3,446 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/* $Id: commands.h,v 1.9 2003/07/12 10:25:41 mhe Exp $
 *
 * commands.h --
 *
 * Yet Another FTP Client
 * Copyright (C) 1998-2001, Martin Hedenfalk <mhe@stacken.kth.se>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. See COPYING for more details.
 */

#ifndef _commands_h_included
#define _commands_h_included

#include <config.h>
#include "args.h"

#define DEFCMD(CMDNAME)    void cmd_ ## CMDNAME (int argc, char **argv)

#define maxargs(n) \
  if(argc > n+1) { \
    char *fooargs; \
    fooargs = args_cat(argc, argv, n+1); \
    fprintf(stderr, _("unexpected arguments -- '%s', try '%s --help'" \
					  " for more information\n"), fooargs, argv[0]); \
    free(fooargs); \
    return; \
  }

#define maxargs_nohelp(n) \
  if(argc > n+1) { \
    char *fooargs; \
    fooargs = args_cat(argc, argv, n+1); \
    fprintf(stderr, _("unexpected arguments -- '%s'\n"), fooargs); \
    free(fooargs); \
    return; \
  }

#define minargs(n) \
  if(argc <= n) { \
    fprintf(stderr, _("missing argument, try '%s --help'" \
					  " for more information\n"), argv[0]); \
    return; \
  }

#define minargs_nohelp(n) \
  if(argc <= n) { \
    fprintf(stderr, _("missing argument\n")); \
    return; \
  }

#define need_connected() \
  if(!ftp_connected()) { \
    fprintf(stderr, _("Not connected. Try 'open --help'" \
					  " for more information.\n")); \
    return; \
  }

#define need_loggedin() \
  if(!ftp_loggedin()) { \
    fprintf(stderr, _("Not logged in. Try 'user --help'" \
					  " for more information.\n")); \
    return; \
  }

typedef enum {
	cpNone, cpRemoteFile, cpRemoteDir, cpLocalFile,
	cpCommand, cpAlias, cpVariable, cpHostname, cpBookmark,
	cpFtpList, cpTaglist, cpLocalTaglist, cpUnset
} cpl_t;

/* in completion.c */
extern cpl_t force_completion_type;

DEFCMD(cachelist);
DEFCMD(status);
DEFCMD(quit);
DEFCMD(filetime);
DEFCMD(source);
DEFCMD(system);
DEFCMD(switch);

/* in bookmark.c */
DEFCMD(bookmark);

/* cacheops.c */
DEFCMD(cache);

/* login.c */
DEFCMD(open);
DEFCMD(reopen);
DEFCMD(close);
DEFCMD(user);

DEFCMD(cdup);
DEFCMD(cd);
DEFCMD(pwd);
DEFCMD(url);
DEFCMD(mkdir);
DEFCMD(rmdir);
DEFCMD(mv);
DEFCMD(chmod);
DEFCMD(cat);
DEFCMD(page);
DEFCMD(zcat);
DEFCMD(zpage);

DEFCMD(quote);
DEFCMD(site);
DEFCMD(rhelp);
DEFCMD(rstatus);
DEFCMD(sstatus);
DEFCMD(nop);
DEFCMD(idle);

/* rm.c */
DEFCMD(rm);

/* get.c */
DEFCMD(get);

/* put.c */
DEFCMD(put);

/* fxp.c */
DEFCMD(fxp);

/* ls.c */
DEFCMD(ls);
DEFCMD(nlist);
DEFCMD(list);

/* help.c */
DEFCMD(help);
DEFCMD(version);
DEFCMD(warranty);
DEFCMD(copyright);

/* set.c */
DEFCMD(set);

/* alias.c */
DEFCMD(alias);
DEFCMD(unalias);

/* local.c */
DEFCMD(lpwd);
DEFCMD(lcd);
DEFCMD(shell);

#ifdef SECFTP
/* in ../lib/security.c */
DEFCMD(prot);
#endif
#ifdef HAVE_KRB4
/* in ../lib/kauth.c */
DEFCMD(kauth);
DEFCMD(kdestroy);
DEFCMD(klist);
DEFCMD(afslog);
DEFCMD(krbtkfile);
#endif

/* tag.c */
DEFCMD(tag);
DEFCMD(untag);
DEFCMD(taglist);
DEFCMD(taginfo);

/* ltag.c */
DEFCMD(ltag);
DEFCMD(luntag);
DEFCMD(ltaglist);
DEFCMD(ltaginfo);

#define OPT_HELP(help) { opt_help(argc, argv, _(help)); \
 if(optind == -1) return; }

void opt_help(int argc, char **argv, char *help);
void expand_alias_parameters(args_t **args, args_t *alias_args);

#endif