//:FUNCTION vaporize // void vaporize(); // Remove the monster in a puff of black smoke! void vaporize() { simple_action(query_death_message()); filter(all_inventory(this_object()), (: $1->is_armor() :))->remove_it(); all_inventory(this_object())->move(environment()); remove(); }
void initiate_beavis() { object beavis = present("beavis", environment(this_object())); if(!beavis) { beavis = new(__DIR__ "beavis"); beavis->move(environment(this_object())); simple_action("Beavis strolls out of the shadows, laughing about " "his nads."); }
//:FUNCTION vaporize //remove the monster in a puff of black smoke void vaporize() { simple_action("Soon after $n $vhave breathed $p last, $p body disappears in a puff of black smoke."); all_inventory(this_object())->move(environment()); remove(); }
int main(int argc, char **argv) { struct goh_state st; int opt; struct fs_ctx s; enum action action = ACTION_CRACK; char *key = NULL; const char *filenamein = "-"; const char *filenameout = "-"; char *text = NULL; struct charset cs; struct crack_args cka; cs_init(&cs); memset(&cka, 0, sizeof(cka)); /* Parse the options. */ goh_init(&st, opt_desc, ARRAY_LENGTH(opt_desc), argc, argv, 1); st.usagehelp = "[options]\n"; while ((opt = goh_nextoption(&st)) >= 0) { switch (opt) { case 'i': filenamein = st.argval; break; case 'o': filenameout = st.argval; break; case 'e': action = ACTION_ENCRYPT; break; case 'd': action = ACTION_DECRYPT; break; case 'k': key = st.argval; break; case 'l': cka.klen = atoi(st.argval); break; case OPT_KASISKI_MIN_LENGTH: cka.ka_minlen = atoi(st.argval); break; case OPT_SHOW_KASISKI_TABLE: cka.ka_show_table = 1; break; case OPT_SHOW_KASISKI_LENGTH: cka.ka_show_length = 1; break; case 'c': cs_add(&cs, st.argval); break; default: custom_error("Unrecognized option (shouldn't happen)"); break; } } /* Common command line mistake. */ if (st.argidx != argc) custom_error("Useless argument %s", argv[st.argidx]); goh_fini(&st); /* Check for some invalid options combinations. */ if (action != ACTION_CRACK && key == NULL) custom_error("Encryption and decryption take a --key"); if (action == ACTION_CRACK && key != NULL) custom_error("--key need either --encrypt or --decrypt"); if (cka.klen > 0 && key != NULL) custom_warn("Unnecessary key length option with an actual key"); if (cka.klen > 0 && key != NULL && cka.klen != strlen(key)) custom_error("Key length option doesn't match " "the length of the key"); if (cka.ka_minlen > 0 && action != ACTION_CRACK) custom_error("--kasiski-min-length can only be used in " "cracking mode"); if (cka.ka_minlen > 0 && cka.klen > 0) custom_warn("Useless option --kasiski-min-length when the key " "length is given"); if (cka.ka_show_table != 0 && action != ACTION_CRACK) custom_error("--show-kasiski-table can only be used in " "cracking mode"); if (cka.ka_show_table != 0 && cka.klen > 0) custom_warn("Option --show-kasiski-table ignored when a key " "length is given"); if (cka.ka_show_length != 0 && action != ACTION_CRACK) custom_error("--show-kasiski-length can only be used in " "cracking mode"); if (cka.ka_show_length != 0 && cka.klen > 0) custom_warn("Option --show-kasiski-length ignored when a key " "length is given"); /* Default charset. */ if (cs.chars_size == 0) { cs_add(&cs, CHARSET_UPPER); cs_add(&cs, CHARSET_LOWER); } /* Start to do the job. */ text = read_file(filenamein); fs_init(&s, text, &cs); cka.str = &s; if (action == ACTION_CRACK) crack(&cka); else simple_action(&s, key, action); write_file(filenameout, text); fs_fini(&s); free(text); cs_fini(&cs); return EXIT_SUCCESS; }