File: cmdhelp.c

package info (click to toggle)
xshipwars 1.32-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 17,176 kB
  • ctags: 6,357
  • sloc: ansic: 157,152; makefile: 226; sh: 75
file content (300 lines) | stat: -rw-r--r-- 7,912 bytes parent folder | download
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
#include "xsw.h"



int CmdHelp(char *arg)
{
	char stringa[256];
	char stringb[256];


        /* Print commands list. */
	if((arg == NULL) ? 1 : (arg[0] == '\0'))
	{
	    MesgAdd(
 "aint     con      discon   exit     help     int      lname    log",
		xsw_color.bp_standard_text
            );
            MesgAdd(
 "lpass    mem      refresh  script   set      synctime version",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "For additional help on a perticular command type `help [command]'",
                xsw_color.bp_standard_text
            );

	    return(0);
	}


	StringStripSpaces(arg);

	/* Automatic interval. */
	if(strpfx(arg, "autoi") ||
           strpfx(arg, "aint")
	)
	{
            MesgAdd(
 "aint [on|off]",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Toggles automatic network stream interval (auto interval) tunning on/off.",
                xsw_color.bp_standard_text
            );
	}
	/* Connect. */
	else if(strpfx(arg, "con"))
        {
            MesgAdd(
 "con [url]",
                xsw_color.bp_standard_text
            );  
            MesgAdd(
 "Connects to universe specified in the [url]. If no argument is given then",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "the universe list window will be mapped.",
                xsw_color.bp_standard_text
            );
        }
        /* Disconnect. */
        else if(strpfx(arg, "dis"))
        {
            MesgAdd(
 "discon",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Disconnects from current connected universe.",
               xsw_color.bp_standard_text
            );
        }
        /* Exit. */
        else if(strpfx(arg, "exi") ||
                strpfx(arg, "qu")
        )
        {
            MesgAdd(
 "exit",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Exits the program (requires comfermation).",
                xsw_color.bp_standard_text
            );
        }
        /* Help. */
        else if(strpfx(arg, "h") ||
                strpfx(arg, "?")
        )
        {
            MesgAdd(
 "help [command]",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Prints detailed help about [command] or if [command] is not given,",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "then a list of commands available on this program is printed.",
                xsw_color.bp_standard_text
            );
        }
	/* Interval. */
        else if(strpfx(arg, "int"))
	{
            MesgAdd(
 "int [milliseconds]",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Adjusts the network streaming interval in milliseconds. This command",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "is only available when automatic interval tuning is off.",
                xsw_color.bp_standard_text
            );
	}
        /* Login name. */
        else if(strpfx(arg, "login_n") ||
                strpfx(arg, "loginn") ||
                strpfx(arg, "lna")
        )
        {
            MesgAdd(
 "lname [login_name]",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Sets the default login name to be used when connecting with a URL",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "that specifies no login name.",
                xsw_color.bp_standard_text
            );
        }       
        /* Log. */
        else if(!strcmp(arg, "log"))
        {
            MesgAdd(
 "log [on|off] [filename]", 
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Turns logging on or off.  If [filename] is specified when turning logging",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "on, then logging will be saved to the file [filename].", 
                xsw_color.bp_standard_text
            );
        }
        /* Login password. */
        else if(strpfx(arg, "login_p") ||
                strpfx(arg, "loginp") ||
                strpfx(arg, "lpa")
        )
        {
            MesgAdd(
 "lpass [login_password]",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Sets the default login password to be used when connecting with a URL",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "that specifies no login password.",
                xsw_color.bp_standard_text 
            );
        }
        /* Memory. */
        else if(strpfx(arg, "mem"))
        {
            MesgAdd(
 "mem [operation]",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Prints memory used by this program. If [operation] is specified, then",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "that memory operation is performed. Available values for [operation] are;",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "refresh, reload.",
                xsw_color.bp_standard_text
            );
        }
        /* Refresh. */
        else if(strpfx(arg, "ref"))
        {
            MesgAdd(
 "refresh",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Refreshes local universe listing and other related information/resources",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "(must be connected to use this command).",
                xsw_color.bp_standard_text
            );
        }
	/* Script. */
        else if(strpfx(arg, "serversc") ||
                strpfx(arg, "scr")
        )
	{
            MesgAdd(
 "script [filename] [arg...]",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Uploads a script file [filename] to the server.  If no arguments",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "are given the file browser is mapped to select a script file.",
                xsw_color.bp_standard_text
            );
	}
        /* Set. */
        else if(!strcmp(arg, "set") ||
                !strcmp(arg, "se")
        )
        {
            MesgAdd(
 "set [parameter][=<value>]",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Sets [parameter] to <value>.  If no arguments are given, then a list",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "of available [parameter]s and their current <value>s are listed.",
                xsw_color.bp_standard_text
            );
        }
        /* Synctime. */
        else if(strpfx(arg, "sync"))
        {
            MesgAdd(
 "synctime",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "Reset and syncronize timmers, this action is performed automatically",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "by the program as needed. You may need to use this manual command if",
                xsw_color.bp_standard_text
            );
            MesgAdd(
 "timming appears extremely off sync (which rarly occures).",
                xsw_color.bp_standard_text
            );
        }
        /* Version. */
        else if(strpfx(arg, "ver"))
        {
            MesgAdd(
 "version",
                xsw_color.bp_standard_text 
            );
            MesgAdd(
 "Prints the version number of this program.",
                xsw_color.bp_standard_text
            );
        }


	else
	{
	    /* No help topic available. */
	    strncpy(stringb, arg, 256);
	    stringb[255] = '\0';
	    sprintf(stringa,
		"No help topic available for command `%s'",
		stringb
	    );
            MesgAdd(
		stringa,
                xsw_color.bp_standard_text
            );
	}


        return(0);
}