void CommandLine::AppendSwitchNative(const std::string& switch_string, const CommandLine::StringType& value) { std::string switch_key(LowerASCIIOnWindows(switch_string)); #if defined(OS_WIN) StringType combined_switch_string(ASCIIToWide(switch_key)); #elif defined(OS_POSIX) StringType combined_switch_string(switch_string); #endif size_t prefix_length = GetSwitchPrefixLength(combined_switch_string); switches_[switch_key.substr(prefix_length)] = value; // Preserve existing switch prefixes in |argv_|; only append one if necessary. if (prefix_length == 0) combined_switch_string = kSwitchPrefixes[0] + combined_switch_string; if (!value.empty()) combined_switch_string += kSwitchValueSeparator + value; // Append the switch and update the switches/arguments divider |begin_args_|. argv_.insert(argv_.begin() + begin_args_++, combined_switch_string); }
int key_hook(int keycode, t_env *e) { double diviseur; diviseur = e->zoom / 100; if (keycode == 53) exit(0); else if (keycode == KEY_LEFT || keycode == KEY_RIGHT || keycode == KEY_DOWN || keycode == KEY_UP) direction_keys(keycode, e, diviseur); else if (keycode == KEY_Q || keycode == KEY_W) zoom_keys(keycode, e, diviseur); else if (keycode == KEY_E) { e->fractal_y[0] = e->fractal_y[0] - 0.1; e->fractal_y[1] = e->fractal_y[1] - 0.1; } else if (keycode == KEY_C) switch_key(e); else if (keycode == KEY_P) e->motion_enabled ^= 1; expose_event(e); return (0); }
char *substitution_decrypt(const char *ciphertext, const char *key) { char *switched_key = switch_key(key); char *result = replace_chars(ciphertext, switched_key); free(switched_key); return result; }