[X2serv-cvs] CVS: x2/source help.c,NONE,1.1 help.h,NONE,1.1 commands.c,1.135,1.136
Brought to you by:
sirvulcan
From: Alex S. <ru...@us...> - 2001-03-02 14:05:02
|
Update of /cvsroot/x2serv/x2/source In directory usw-pr-cvs1:/tmp/cvs-serv25096 Modified Files: commands.c Added Files: help.c help.h Log Message: added the help.* files (woops) --- NEW FILE --- #include "config.h" HelpSub(char *Target, char *Source) { char* ptr; int i; for(ptr = Source; *ptr != '\0';ptr++) { if(*ptr == '$') { ptr++; switch(*ptr) { case 't': /* network name */ for(i=0;NETWORK[i] != '\0';i++) { *Target = NETWORK[i]; Target++; } break; case 'n': /* My nick */ for(i=0;IrcNick[i] != '\0';i++) { *Target = IrcNick[i]; Target++; } break; case 'c': /* Command char */ *Target = CommandMark; Target++; break; case 'w': /* Web URL */ for(i=0;HELPURL[i] != '\0';i++) { *Target = HELPURL[i]; Target++; } break; default: *Target = '$'; Target++; *Target = *ptr; Target++; break; } ptr++; } *Target = *ptr; Target++; } *Target=0; } int ShowCommHelp(UserListType uptr, FILE * HelpFile) { /* swap needs to be big enough to hold the input string * PLUS the extra size of swapped out pieces. */ char Buffer[LINEBUFFSIZE + 1]; char SwapBuff[LINEBUFFSIZE + MAXLEN]; int c; while((c = fgets(Buffer, LINEBUFFSIZE, HelpFile) != NULL)) { Buffer[strlen(Buffer) - 1] = '\0'; HelpSub(SwapBuff, Buffer); send_to_user(uptr, "%s", SwapBuff); } return(TRUE); } int ShowUserHelp(UserListType uptr, FILE * HelpFile) { char Buffer[LINEBUFFSIZE + 1]; char SwapBuff[LINEBUFFSIZE + MAXLEN]; int c; while((c = fgets(Buffer, LINEBUFFSIZE, HelpFile) != NULL)) { Buffer[strlen(Buffer) - 1] = '\0'; HelpSub(SwapBuff, Buffer); send_to_user(uptr, "%s", SwapBuff); } return(TRUE); } int ShowOperHelp(UserListType uptr, FILE * HelpFile) { char Buffer[LINEBUFFSIZE + 1]; char SwapBuff[LINEBUFFSIZE + MAXLEN]; int c; while((c = fgets(Buffer, LINEBUFFSIZE, HelpFile) != NULL)) { Buffer[strlen(Buffer) - 1] = '\0'; HelpSub(SwapBuff, Buffer); send_to_user(uptr, "%s", SwapBuff); } return(TRUE); } --- NEW FILE --- int ShowCommHelp(UserListType uptr, FILE * HelpFile); int ShowUserHelp(UserListType uptr, FILE * HelpFile); int ShowOperHelp(UserListType uptr, FILE * HelpFile); Index: commands.c =================================================================== RCS file: /cvsroot/x2serv/x2/source/commands.c,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -r1.135 -r1.136 *** commands.c 2001/03/02 12:23:22 1.135 --- commands.c 2001/03/02 14:06:26 1.136 *************** *** 44,47 **** --- 44,48 ---- #include "parse.h" #include "accounting.h" + #include "help.h" int FILTER = 0; |