1af57ed9fSAtsushi Murai /* 2af57ed9fSAtsushi Murai * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 3af57ed9fSAtsushi Murai * 4af57ed9fSAtsushi Murai * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 5af57ed9fSAtsushi Murai * 6af57ed9fSAtsushi Murai * Redistribution and use in source and binary forms are permitted 7af57ed9fSAtsushi Murai * provided that the above copyright notice and this paragraph are 8af57ed9fSAtsushi Murai * duplicated in all such forms and that any documentation, 9af57ed9fSAtsushi Murai * advertising materials, and other materials related to such 10af57ed9fSAtsushi Murai * distribution and use acknowledge that the software was developed 11af57ed9fSAtsushi Murai * by the Internet Initiative Japan. The name of the 12af57ed9fSAtsushi Murai * IIJ may not be used to endorse or promote products derived 13af57ed9fSAtsushi Murai * from this software without specific prior written permission. 14af57ed9fSAtsushi Murai * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 15af57ed9fSAtsushi Murai * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 16af57ed9fSAtsushi Murai * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 17af57ed9fSAtsushi Murai * 1830291ffbSBrian Somers * $Id: command.h,v 1.13 1998/05/21 21:44:48 brian Exp $ 19af57ed9fSAtsushi Murai * 20af57ed9fSAtsushi Murai * TODO: 21af57ed9fSAtsushi Murai */ 22af57ed9fSAtsushi Murai 23b6e82f33SBrian Somers struct cmdtab; 242764b86aSBrian Somers struct bundle; 252764b86aSBrian Somers struct datalink; 262764b86aSBrian Somers struct prompt; 27b6e82f33SBrian Somers 28b6e82f33SBrian Somers struct cmdargs { 29aef795ccSBrian Somers struct cmdtab const *cmdtab; /* The entire command table */ 30aef795ccSBrian Somers struct cmdtab const *cmd; /* This command entry */ 31b6217683SBrian Somers int argc; /* Number of arguments (excluding cmd */ 3225092092SBrian Somers int argn; /* Argument to start processing from */ 33b6217683SBrian Somers char const *const *argv; /* Arguments */ 34b6217683SBrian Somers struct bundle *bundle; /* Our bundle */ 35b6217683SBrian Somers struct datalink *cx; /* Our context */ 36b6217683SBrian Somers struct prompt *prompt; /* Who executed us */ 37b6e82f33SBrian Somers }; 38b6e82f33SBrian Somers 39af57ed9fSAtsushi Murai struct cmdtab { 40b6e82f33SBrian Somers const char *name; 41b6e82f33SBrian Somers const char *alias; 42b6e82f33SBrian Somers int (*func) (struct cmdargs const *); 4353c9f6c0SAtsushi Murai u_char lauth; 44b6e82f33SBrian Somers const char *helpmes; 45b6e82f33SBrian Somers const char *syntax; 46b6e82f33SBrian Somers const void *args; 47af57ed9fSAtsushi Murai }; 4835495becSBrian Somers 491342caedSBrian Somers #define NEG_ACCEPTED (1) 501342caedSBrian Somers #define NEG_ENABLED (2) 511342caedSBrian Somers #define IsAccepted(x) ((x) & NEG_ACCEPTED) 521342caedSBrian Somers #define IsEnabled(x) ((x) & NEG_ENABLED) 5375240ed1SBrian Somers 546f384573SBrian Somers extern const char Version[]; 556f384573SBrian Somers extern const char VersionDate[]; 5675240ed1SBrian Somers 57dd7e2610SBrian Somers extern void command_Interpret(char *, int, int *, char ***); 58dd7e2610SBrian Somers extern void command_Run(struct bundle *, int, char const *const *, 5930291ffbSBrian Somers struct prompt *, const char *, struct datalink *); 60dd7e2610SBrian Somers extern void command_Decode(struct bundle *, char *, int, struct prompt *, 61b6217683SBrian Somers const char *); 62dd7e2610SBrian Somers extern struct link *command_ChooseLink(struct cmdargs const *); 63dd7e2610SBrian Somers extern const char *command_ShowNegval(unsigned); 64