void char_stream(char *buffer, SWSpecification *swspec, char *text) { int size = strlen(text); //char *streaming = (char *)malloc(sizeof(char) * (size+1)); strcpy(buffer, text); if (swspec->encrypt == true) { encrypt_caesar_cipher(buffer); printf("encrypt: %s\n", buffer); } if (swspec->shift == true) { shift_string(buffer); printf("shift: %s\n", buffer); } if (swspec->inverter == true) { invert_string(buffer); printf("inverter: %s\n", buffer); } if (swspec->decrypt == true) { decrypt_caesar_cipher(buffer); printf("decrypt: %s\n", buffer); } }
/* * Parse a name for acceptability. */ bool check_parse_name( const string & name, bool newchar ) { /* * Names checking should really only be done on new characters, otherwise * we could end up with people who can't access their characters. Would * have also provided for that new area havoc mentioned below, while still * disallowing current area mobnames. I personally think that if we can * have more than one mob with the same keyword, then may as well have * players too though, so I don't mind that removal. -- Alty */ /* * Length restrictions. */ if( name.length( ) < 3 || name.length( ) > 12 ) return false; /* * Alphanumerics only. * Lock out IllIll twits. * { char *pc; bool fIll; fIll = true; for( pc = name; *pc != '\0'; ++pc ) { if( !isalpha( *pc ) ) return false; if( LOWER( *pc ) != 'i' && LOWER( *pc ) != 'l' ) fIll = false; } if( fIll ) return false; } */ // Alphanumeric checks string::const_iterator ptr = name.begin( ); while( ptr != name.end( ) ) { if( !isalpha( *ptr ) ) return false; ++ptr; } /* * Mob names illegal for newbies now - Samson 7-24-00 */ list < char_data * >::iterator ich; for( ich = charlist.begin( ); ich != charlist.end( ); ++ich ) { char_data *vch = *ich; if( vch->isnpc( ) ) { if( hasname( vch->name, name ) && newchar ) return false; } } /* * This grep idea was borrowed from SunderMud. * * Reserved names list was getting much too large to load into memory. * * Placed last so as to avoid problems from any of the previous conditions causing a problem in shell. */ char buf[MSL]; snprintf( buf, MSL, "grep -i -x %s ../system/reserved.lst > /dev/null", name.c_str( ) ); if( system( buf ) == 0 && newchar ) { buf[0] = '\0'; return false; } /* * Check for inverse naming as well */ string invname = invert_string( name ); snprintf( buf, MSL, "grep -i -x %s ../system/reserved.lst > /dev/null", invname.c_str( ) ); if( system( buf ) == 0 && newchar ) { buf[0] = '\0'; return false; } return true; }