- static int cmd_help( char *args[], char *outbuff)
- {
- int i;
- char tmp[MAX_ARG_LEN];
- if (args[1])
- { /* help for a single command */
- for (i=0;cmds[i].cmd;i++)
- if (0==strcmp(cmds[i].cmd, args[1]))
- {
- strcat(outbuff,cmds[i].cmd);
- strcat(outbuff," ");
- strcat(outbuff,cmds[i].args);
- strcat(outbuff,"\n");
- strcat(outbuff,cmds[i].explanation);
- strcat(outbuff,"\n");
- return 0;
- }
- strcat(outbuff, "Unknown command ");
- strcat(outbuff, args[1] );
- }
- else
- { /* list all commands */
- strcpy(tmp," ");
- for (i=0;cmds[i].cmd;i++)
- if (cmds[i].explanation)
- {
- /* sprintf(tmp, "%s %s %s\n",
- cmds[i].cmd, cmds[i].args, cmds[i].explanation);
- */
- strcat(tmp, cmds[i].cmd);
- strcat(tmp," ");
- if (!*cmds[i].cmd)
- {
- strcat(outbuff, tmp);
- strcat(outbuff,"\n");
- strcpy(tmp," ");
- if (*cmds[i].args)
- {
- strcat(outbuff, cmds[i].args);
- strcat(outbuff,"\n");
- }
- }
- if (strlen(tmp)>50)
- {
- strcat(outbuff,tmp);
- strcat(outbuff,"\n");
- strcpy(tmp," ");
- }
- }
- strcat(outbuff,tmp);
- }
- return 0;
+static int cmd_help( char *args[], char *outbuff)
+{
+ int i;
+ char tmp[MAX_ARG_LEN];
+ if (args[1])
+ { /* help for a single command */
+ for (i=0;cmds[i].cmd;i++)
+ if (0==strcmp(cmds[i].cmd, args[1]))
+ {
+ strcat(outbuff,cmds[i].cmd);
+ strcat(outbuff," ");
+ strcat(outbuff,cmds[i].args);
+ strcat(outbuff,"\n");
+ strcat(outbuff,cmds[i].explanation);
+ strcat(outbuff,"\n");
+ return 0;
+ }
+ strcat(outbuff, "Unknown command ");
+ strcat(outbuff, args[1] );
+ }
+ else
+ { /* list all commands */
+ strcpy(tmp," ");
+ for (i=0;cmds[i].cmd;i++)
+ if (cmds[i].explanation)
+ {
+ /* sprintf(tmp, "%s %s %s\n",
+ cmds[i].cmd, cmds[i].args, cmds[i].explanation);
+ */
+ strcat(tmp, cmds[i].cmd);
+ strcat(tmp," ");
+ if (!*cmds[i].cmd)
+ {
+ strcat(outbuff, tmp);
+ strcat(outbuff,"\n");
+ strcpy(tmp," ");
+ if (*cmds[i].args)
+ {
+ strcat(outbuff, cmds[i].args);
+ strcat(outbuff,"\n");
+ }
+ }
+ if (strlen(tmp)>50)
+ {
+ strcat(outbuff,tmp);
+ strcat(outbuff,"\n");
+ strcpy(tmp," ");
+ }
+ }
+ strcat(outbuff,tmp);
+ }
+ return 0;