main( void ) { char Str[ 512 ]; while( cin >> Str ) { if( Strlen1( Str ) != Strlen2( Str ) ) cerr << "Oops!!!" << endl; } return 0; }
void do_set(COMMAND_ARGS) { /* * on_msg checks: */ Chan *chan; UniVar *univar,*varval; char tmp[MSGLEN]; char *pp,*channel,*name; int n,which,i,sz,limit,uaccess; /* * */ channel = get_channel2(to,&rest); chan = find_channel_ny(channel); name = chop(&rest); /* * empty args, its "set" or "set #channel" */ if (!name) { if (!chan) { to_user(from,ERR_CHAN,channel); return; } if (!CurrentDCC) return; i = CHANSET_SIZE; limit = SIZE_VARS - 1; univar = current->setting; *tmp = 0; if ((uaccess = get_useraccess(from,GLOBAL_CHANNEL))) to_user(from,str_underline("Global settings")); second_pass: for(;i<limit;i++) { if (uaccess < VarName[i].uaccess) continue; varval = (IsProc(i)) ? current->setting[i].proc_var : &univar[i]; sz = Strlen2(tmp,VarName[i].name); if (IsStr(i)) { sz += (varval->str_var) ? strlen(varval->str_var) : 7; } if (sz > 58) { to_user(from,FMT_PLAIN,tmp); *tmp = 0; } if (IsInt(i)) { pp = tolowercat(tmp,VarName[i].name); sprintf(pp,(IsChar(i)) ? "=`%c' " : "=%i ",varval->int_var); } else if (IsStr(i)) { pp = tolowercat(tmp,VarName[i].name); sprintf(pp,(varval->str_var) ? "=\"%s\" " : "=(unset) ",varval->str_var); } else if (IsTog(i)) { pp = Strcat(tmp,(varval->int_var) ? "+" : "-"); pp = tolowercat(pp,VarName[i].name); pp[0] = ' '; pp[1] = 0; } } if (*tmp && tmp[1]) to_user(from,FMT_PLAIN,tmp); if (limit != CHANSET_SIZE) { to_user(from,"\037Channel settings: %s\037",(chan) ? chan->name : rest); i = 0; limit = CHANSET_SIZE; univar = chan->setting; *tmp = 0; uaccess = get_useraccess(from,(chan) ? chan->name : rest); goto second_pass; } return; } /* * alter a setting */ if ((which = find_setting(name)) == -1) { set_usage: usage(from); /* usage for CurrentCmd->name */ return; } if ((which < CHANSET_SIZE) && *channel != '*') { if (!chan) { to_user(from,ERR_CHAN,channel); return; } /* * its a channel setting */ channel = chan->name; varval = &chan->setting[which]; } else { /* * its a global setting */ channel = MATCH_ALL; varval = ¤t->setting[which]; } if (VarName[which].uaccess > get_authaccess(from,channel)) return; /* * Check each type and process `rest' if needed. */ n = 0; if (IsChar(which)) { if (rest[1]) goto set_usage; } else if (IsNum(which)) { if (IsTog(which)) { if (!Strcasecmp(rest,"ON")) { n = 1; goto num_data_ok; } else if (!Strcasecmp(rest,"OFF")) { /* n is 0 by default */ goto num_data_ok; } } n = a2i((rest = chop(&rest))); if (errno || n < VarName[which].min || n > VarName[which].max) { to_user(from,"Possible values are %i through %i",VarName[which].min,VarName[which].max); return; } } num_data_ok: /* * */ if ((which < CHANSET_SIZE) && *channel == '*') { for(chan=current->chanlist;chan;chan=chan->next) { if (IsNum(which)) { chan->setting[which].int_var = n; } else if (IsStr(which)) { Free((char**)&chan->setting[which].str_var); if (*rest) { set_mallocdoer(do_set); chan->setting[which].str_var = Strdup(rest); } } } channel = "(all channels)"; } else { if (IsProc(which)) varval = varval->proc_var; if (IsChar(which)) varval->char_var = *rest; else if (IsNum(which)) varval->int_var = n; else { if (varval->str_var) Free((char**)&varval->str_var); if (*rest) { set_mallocdoer(do_set); varval->str_var = Strdup(rest); } } } to_user(from,"Var: %s On: %s Set to: %s",VarName[which].name, (which >= CHANSET_SIZE) ? "(global)" : channel,(*rest) ? rest : NULLSTR); if (VarName[which].func) VarName[which].func(&VarName[which]); }