static bool ReadStringFromFile (const char* pathName, std::string& output)
{
	FILE* file = fopen( pathName, "rb" );
	if (file == NULL)
		return false;
	fseek(file, 0, SEEK_END);
	int length = ftell(file);
	fseek(file, 0, SEEK_SET);
	if (length < 0)
	{
		fclose( file );
		return false;
	}
	output.resize(length);
	int readLength = fread(&*output.begin(), 1, length, file);
	fclose(file);
	if (readLength != length)
	{
		output.clear();
		return false;
	}

	replace_string(output, "\r\n", "\n", 0);
	return true;
}
Beispiel #2
0
void create()
{
   string filename=__DIR__"find.map";
   string buf, *buf1;
   string dir, name;
   int size, i;

   seteuid(getuid());
   set("name", "监控精灵");
   set("id", "miscd");

   maps=([]);

   buf=read_file(filename);
   if(!buf) return; //no data available.

   buf1=explode(buf,"\n");
   size=sizeof(buf1);
   if(!size) return;

   for(i=0;i<size;i++) {
     if(sscanf(buf1[i],"%s %s",dir,name)==2) {
       name=replace_string(name," ","");
       if(strlen(dir)>2 && strlen(name)>2) {
         maps+=([dir:name]);
       }
     }
Beispiel #3
0
int cmd_message(string str) {
    string what, msg, extra;

    if(!str) {
	notify_fail("Which message? What is the message?\n");
	return 0;
    }
    if(sscanf(str, "%s %s", what, msg) != 2) {
	notify_fail("Correct syntax: <message [in | out] [msg]>\n");
	return 0;
    }
    if(what != "in" && what != "out") {
	notify_fail("You may only set your messages in and out.\n");
	return 0;
    }
    if((int)this_player()->query_mp() < 10) {
	notify_fail("Too low on magic power.\n");
	return 0;
    }
    this_player()->add_mp(-10);
    msg = replace_string(msg, "%^BLACK%^", "%^BOLD%^%^BLACK%^");
    while(sscanf(msg, "%snortheast%s", msg, extra) == 2) msg += "$D" + extra;
    while(sscanf(msg, "%ssoutheast%s", msg, extra) == 2) msg += "$D" + extra;
    while(sscanf(msg, "%snorthwest%s", msg, extra) == 2) msg += "$D" + extra;
    while(sscanf(msg, "%ssouthwest%s", msg, extra) == 2) msg += "$D" + extra;
    while(sscanf(msg, "%seast%s", msg, extra) == 2) msg += "$D" + extra;
    while(sscanf(msg, "%swest%s", msg, extra) == 2) msg += "$D" + extra;
    while(sscanf(msg, "%snorth%s", msg, extra) == 2) msg += "$D" + extra;
    while(sscanf(msg, "%ssouth%s", msg, extra) == 2) msg += "$D" + extra;
    if(what == "in") this_player()->setenv("MIN", "$N "+msg);
    else this_player()->setenv("MOUT", "$N "+msg+" $D");
    return 1;
}
Beispiel #4
0
mixed cmd(string args) {
    object ob, cre_ob, jeans, shirt, robe, hat, book, staff;
    string filec, filep, nom, home_dir;
    filep = player_save_file(args);
    filec = replace_string(filep, "players", "creators");

    if( !(master()->valid_apply(({ PRIV_ASSIST, PRIV_SECURE, LIB_CONNECT }))) )
Beispiel #5
0
TEST(find_command, IF(not_windows))
{
	opt_handlers_setup();

	replace_string(&cfg.shell, "/bin/sh");

	assert_success(chdir(TEST_DATA_PATH));
	strcpy(lwin.curr_dir, test_data);

	assert_success(exec_commands("set findprg='find %s %a %u'", &lwin,
				CIT_COMMAND));

	/* Nothing to repeat. */
	assert_failure(exec_commands("find", &lwin, CIT_COMMAND));

	assert_success(exec_commands("find a", &lwin, CIT_COMMAND));
	assert_int_equal(3, lwin.list_rows);

	assert_success(exec_commands("find . -name aaa", &lwin, CIT_COMMAND));
	assert_int_equal(1, lwin.list_rows);

	assert_success(exec_commands("find -name '*.vifm'", &lwin, CIT_COMMAND));
	assert_int_equal(4, lwin.list_rows);

	view_teardown(&lwin);
	view_setup(&lwin);

	/* Repeat last search. */
	strcpy(lwin.curr_dir, test_data);
	assert_success(exec_commands("find", &lwin, CIT_COMMAND));
	assert_int_equal(4, lwin.list_rows);

	opt_handlers_teardown();
}
Beispiel #6
0
int look_room(object me, object env)
{
	int i;
	object *inv;
	mapping exits;
	string str, *dirs;

	if( !env ) {
		write("你的四周灰蒙蒙地一片,什麽也没有。\n");
		return 1;
	}
	str = sprintf( "\n▲ %s - %s\n  %s\n%s",
		env->query("short"),
		file_name(env),
		replace_string(env->query("long"), "\n", ""),
		env->query("outdoors")? NATURE_D->outdoor_room_description() : "" );

	if( mapp(exits = env->query("exits")) ) {
		dirs = keys(exits);
		for(i=0; i<sizeof(dirs); i++)
			if( (int)env->query_door(dirs[i], "status") & DOOR_CLOSED )
				dirs[i] = 0;
		dirs -= ({ 0 });
		if( sizeof(dirs)==0 )
			str += "  这里没有任何明显的出路。\n";
		else if( sizeof(dirs)==1 )
			str += "  这里唯一的出口是 " + BOLD + dirs[0] + NOR + "。\n";
		else
			str += sprintf("  这里明显的出口是 " + BOLD + "%s" + NOR + " 和 " + BOLD + "%s" + NOR + "。\n",
				implode(dirs[0..sizeof(dirs)-2], "、"), dirs[sizeof(dirs)-1]);
	}
Beispiel #7
0
static int parse_timemaster_settings(char **settings,
				     struct timemaster_config *config)
{
	char *name, *value;

	for (; *settings; settings++) {
		parse_setting(*settings, &name, &value);
		if (!strcasecmp(name, "ntp_program")) {
			if (!strcasecmp(value, "chronyd")) {
				config->ntp_program = CHRONYD;
			} else if (!strcasecmp(value, "ntpd")) {
				config->ntp_program = NTPD;
			} else {
				pr_err("unknown ntp program %s", value);
				return 1;
			}
		} else if (!strcasecmp(name, "rundir")) {
			replace_string(value, &config->rundir);
		} else {
			pr_err("unknown timemaster setting %s", name);
			return 1;
		}
	}

	return 0;
}
static bool CheckGLSL (bool vertex, bool gles, const char* prefix, const std::string& source)
{
	std::string src;
	if (gles)
	{
		src += "#define lowp\n";
		src += "#define mediump\n";
		src += "#define highp\n";
		src += "#define texture2DLodEXT texture2DLod\n";
	}
	src += source;
	if (gles)
	{
		replace_string (src, "GL_EXT_shader_texture_lod", "GL_ARB_shader_texture_lod", 0);
	}
	const char* sourcePtr = src.c_str();
	
	
	GLhandleARB shader = glCreateShaderObjectARB (vertex ? GL_VERTEX_SHADER_ARB : GL_FRAGMENT_SHADER_ARB);
	glShaderSourceARB (shader, 1, &sourcePtr, NULL);
	glCompileShaderARB (shader);
	GLint status;
	glGetObjectParameterivARB (shader, GL_OBJECT_COMPILE_STATUS_ARB, &status);
	bool res = true;
	if (status == 0)
	{
		char log[4096];
		GLsizei logLength;
		glGetInfoLogARB (shader, sizeof(log), &logLength, log);
		printf ("  glsl compile error on %s:\n%s\n", prefix, log);
		res = false;
	}
	glDeleteObjectARB (shader);
	return res;
}
Beispiel #9
0
void event_exit(object ob, varargs string msg, object dest, mixed avoid)
{
  string new_name;

  ::event_exit(ob, msg, dest, avoid);

  if (!msg || !strlen(msg))
    return;

  // items added to our inventory also trigger event_enter
  if (environment(ob) == this_object())
    return;

  if (avoid)
  {
    if (pointerp(avoid) && (member_array(this_object(), avoid) != -1))
      return;
    else if (objectp(avoid) && (avoid == this_object()))
      return;
  }

  if (living(ob) && environment(this_object()))
  {
    if (this_object()->check_dark(environment(this_object())->query_light()) == 0)
    {
      // change player appereance from /table/hud_table.c, neverbot 10/04
      new_name = (string)HUD->query_colored_name(this_object(), ob, ob->query_cap_name(), 1);
      msg = replace_string(msg, ob->query_cap_name(), new_name);

      write(msg);
    }
    else
      write(_LANG_EVENTS_SOMEBODY_LEAVES);
  }
}
Beispiel #10
0
int cmd_whack(string str) {
  object tp = this_player();
  object env = environment(tp);
  object tgt, wep;
  object *weps;
  string wepname;

  if (!abil()) return 0;

  if (str)
    tgt = present(str, env);
  else
    tgt = tp->query_current_attacker();

  weps = filter(tp->query_wielded(), (: $1->query_type() == "blunt" :) );

  if (!can_cast(tp, tgt, weps)) return 0;

  wep = weps[random(sizeof(weps))];
  wepname = remove_article(strip_color(wep->query_short()));
  wepname = replace_string(wepname, " (wielded)", "");

  message("combat", "You spin your "+wepname+" around.", tp);
  message("combat", tp->query_cap_name()+" spins "+tp->query_possessive()+
    " "+wepname+" around.", env, tp);

  tp->set_disable(2);

  call_out("do_whack_hit", 2, ({ tp, env, tgt, wep, wepname }) );
Beispiel #11
0
/*
 *	group1/M00/0D/F3/3MIv8U0JrcoAAAAAAABNcGtWhC0409=320X100)!.jpg
 * 	return 320X100
 */
int filter_thumbnail(char *filename, char thumbnail_str[], int len) {
	int i;
	if (NULL == filename)
		return 0;
	if (!is_image_ext(filename, image_ext, IMAGE_EXT_LEN))
		return 0;
	memset(thumbnail_str, 0, len);
	char *thum_start = NULL;
	char *thum_end = NULL;
	if (NULL == (thum_start = strrchr(filename, '='))) {
		return 0;
	}
	thum_start++;
	//modify for .jpg.jpg
	if (NULL == (thum_end = strchr(thum_start, '.'))) {
		return 0;
	}
	if (thum_end - thum_start + 1 >= len)
		return 0;
	len = thum_end - thum_start + 1;
	snprintf(thumbnail_str, len, "%s", thum_start);
	int trim_str_len = strlen(thum_end);
	thum_start--;
	for (i = 0; i < trim_str_len; i++) {
		*(thum_start++) = *(thum_end++);
	}
	*thum_start = '\0';
	replace_string(thumbnail_str, len);
	return 1;
}
Beispiel #12
0
// This is the interface to the intermud channels
void send_msg(string channel, string id, string name, string msg, int emoted,
	mixed filter)
{
	string *names;
	int i;
	mapping muds;
	mapping svcs;
	mapping minfo;

	if( !this_player()		// Prevent from being called by ourself.
	||	!ACCESS_CHECK(previous_object())) return;

#ifdef DEBUG
	set("channel_id", "网路频道精灵");
	CHANNEL_D->do_channel(this_object(), "sys", "prepare to send gchannel message.");
#endif
	muds = (mapping)DNS_MASTER->query_muds();
	svcs = (mapping)DNS_MASTER->query_svc();
	msg = replace_string(msg, "|", "");
	msg = replace_string(msg, "@@@", "");
	// use keys(svcs) because none of the muds not in svcs can possibley
	// receive the message
	names = keys(svcs);
	i = sizeof(names);
	while(i--)
		if( (names[i] != mud_nname())
		&&	evaluate(filter, muds[names[i]])) {
			minfo = muds[names[i]];
			if(!mapp(minfo) || !mapp(svcs[names[i]])
			|| !(svcs[names[i]]["gwizmsg"] & SVC_UDP))
				continue;
#ifdef DEBUG
	set("channel_id", "网路频道精灵");
	CHANNEL_D->do_channel(this_object(), "sys",
		sprintf("gchannel message sent to %s.", minfo["NAME"]));
#endif
			DNS_MASTER->send_udp(minfo["HOSTADDRESS"], minfo["PORTUDP"],
				"@@@" + DNS_GCHANNEL +
				"||NAME:" + Mud_name() +
				"||PORTUDP:" + udp_port() +
				"||USRNAME:" + capitalize(id) +
				"||CNAME:" + name +
				"||MSG:" + msg +
				"||CHANNEL:" + channel +
				(emoted?"||EMOTE:1":"") + "@@@\n");
		}
}
Beispiel #13
0
mixed cmd(string args) {
    string *arr;
    string ret = "";
    string dss = replace_string(dump_socket_status(),"-- 0","--\n 0");
    foreach(mixed key, mixed val in network_stats()){
        val = val+"";
        ret += sprintf("%:-30s %s",key, val)+"\n";
    }
Beispiel #14
0
/* function for lower case hex substitution (unsigned int) */
char *replace_x(char *base, char *directive, va_list ap) {
	unsigned int val = va_arg(ap, unsigned int);
	char *str = unsigned_to_string(val, 16);
	char *ret;
	ret = replace_string(base, directive, str);
	free (str);
	return ret;
}
Beispiel #15
0
void
cfg_set_shell(const char shell[])
{
	if(replace_string(&cfg.shell, shell) == 0)
	{
		stats_update_shell_type(cfg.shell);
	}
}
varargs string imc2_mud_name(string name){ 
    string mudname;

    if(name) mudname = name;
    else mudname = mud_name();

    return replace_string(mudname," ","_");
}
Beispiel #17
0
int main(void) {
    char text[81] = "This is a test!!!1!";

    replace_string(text, "1", "");
    printf("%s\n", text);

    return 0;
}
Beispiel #18
0
static struct source *source_ptp_parse(char *parameter, char **settings)
{
	char *name, *value;
	struct source *source;
	int r = 0;

	source = xmalloc(sizeof(*source));
	source->type = PTP_DOMAIN;
	source->ptp.delay = DEFAULT_PTP_DELAY;
	source->ptp.ntp_poll = DEFAULT_PTP_NTP_POLL;
	source->ptp.phc2sys_poll = DEFAULT_PTP_PHC2SYS_POLL;
	source->ptp.interfaces = (char **)parray_new();
	source->ptp.ptp4l_settings = (char **)parray_new();
	source->ptp.ntp_options = xstrdup("");

	if (parse_int(parameter, &source->ptp.domain)) {
		pr_err("invalid ptp_domain number %s", parameter);
		goto failed;
	}

	for (; *settings; settings++) {
		parse_setting(*settings, &name, &value);
		if (!strcasecmp(name, "delay")) {
			r = parse_double(value, &source->ptp.delay);
		} else if (!strcasecmp(name, "ntp_poll")) {
			r = parse_int(value, &source->ptp.ntp_poll);
		} else if (!strcasecmp(name, "phc2sys_poll")) {
			r = parse_int(value, &source->ptp.phc2sys_poll);
		} else if (!strcasecmp(name, "ptp4l_option")) {
			parray_append((void ***)&source->ptp.ptp4l_settings,
				      xstrdup(value));
		} else if (!strcasecmp(name, "ntp_options")) {
			replace_string(value, &source->ptp.ntp_options);
		} else if (!strcasecmp(name, "interfaces")) {
			parse_words(value, &source->ptp.interfaces);
		} else {
			pr_err("unknown ptp_domain setting %s", name);
			goto failed;
		}

		if (r) {
			pr_err("invalid value %s for %s", value, name);
			goto failed;
		}
	}

	if (!*source->ptp.interfaces) {
		pr_err("no interfaces specified for ptp_domain %d",
		       source->ptp.domain);
		goto failed;
	}

	return source;
failed:
	source_destroy(source);
	return NULL;
}
Beispiel #19
0
/* function for u (unsigned int to decimal) */
char *replace_u(char *base, char *directive, va_list ap) {
	unsigned int val = va_arg(ap, unsigned int);
	char *str = unsigned_to_string(val, 10);
	char *ret;
	/* unsigned int to str, then replace_string() */
	ret = replace_string(base, directive, str);
	free (str);
	return ret;
}
Beispiel #20
0
void
filters_view_reset(view_t *view)
{
	view->invert = cfg.filter_inverted_by_default ? 1 : 0;
	view->prev_invert = view->invert;

	(void)replace_string(&view->prev_manual_filter, "");
	replace_matcher(&view->manual_filter, "");
	(void)replace_string(&view->prev_auto_filter, "");
	reset_filter(&view->auto_filter);

	(void)replace_string(&view->local_filter.prev, "");
	reset_filter(&view->local_filter.filter);
	view->local_filter.in_progress = 0;
	view->local_filter.saved = NULL;
	view->local_filter.poshist = NULL;
	view->local_filter.poshist_len = 0U;
}
Beispiel #21
0
void
name_filters_remove(view_t *view)
{
	if(name_filters_empty(view))
	{
		return;
	}

	(void)replace_string(&view->prev_manual_filter,
			matcher_get_expr(view->manual_filter));
	(void)replace_string(&view->prev_auto_filter, view->auto_filter.raw);
	view->prev_invert = view->invert;

	name_filters_drop(view);
	view->invert = cfg.filter_inverted_by_default ? 1 : 0;

	ui_view_schedule_reload(view);
}
Beispiel #22
0
/* function for d and i (int replacement) */
char *replace_d(char *base, char *directive, va_list ap) {
	int val = va_arg(ap, int);
	char *str = int_to_string(val, 10);
	char *ret;
	/* int to str, then replace_string() */
	ret = replace_string(base, directive, str);
	free(str);
	return ret;
}
Beispiel #23
0
int main(object me, string arg)
{
    int i;
    string term, *terms, *wiz_only;
        mixed data;
        mapping env;
 
    if (arg) arg = replace_string(arg, "/", "");
    wiz_only = ({"invisibility", "immortal"});
Beispiel #24
0
SETUP()
{
	view_setup(&lwin);
	view_setup(&rwin);

	curr_view = &lwin;
	other_view = &rwin;

#ifndef _WIN32
	replace_string(&cfg.shell, "/bin/sh");
#else
	replace_string(&cfg.shell, "cmd");
#endif

	stats_update_shell_type(cfg.shell);

	init_commands();
}
Beispiel #25
0
int
get_instance_xml(	const char *gen_libvirt_cmd_path,
			char *userId,
			char *instanceId,
			char *ramdiskId,
			char *kernelId,
			char *disk_path,
			virtualMachine *params,
			char *privMac,
			//			char *privIp,
			char *brname,
			int use_virtio_net,
			int use_virtio_root,
			char **xml)
{
    char buf [MAX_PATH];

    snprintf(buf, MAX_PATH, "%s", gen_libvirt_cmd_path);

// We should pass instance path parameter to perl script to determine file system type.
// It will help to make right suggestion about used OS and generate libvirt for it.
    strncat(buf, " --instance-path ", MAX_PATH);
    strncat(buf, disk_path, MAX_PATH);


    if (strnlen(ramdiskId, CHAR_BUFFER_SIZE)) {
        strncat(buf, " --ramdisk", MAX_PATH - strlen(buf) - 1);
    }
    if (use_virtio_net) {
        strncat(buf, " --virtionet", MAX_PATH - strlen(buf) - 1);
    }
    if (use_virtio_root) {
        strncat(buf, " --virtioroot", MAX_PATH - strlen(buf) - 1);
    }
    
    if (params->disk > 0) { /* TODO: get this info from scMakeImage */
        strncat (buf, " --ephemeral", MAX_PATH - strlen(buf) - 1);
    }
    * xml = system_output (buf);
    if ( ( * xml ) == NULL ) {
        logprintfl (EUCAFATAL, "%s: %s\n", gen_libvirt_cmd_path, strerror (errno));
        return ERROR;
    }
    
    /* the tags better be not substring of other tags: BA will substitute
     * ABABABAB */
    replace_string (xml, "BASEPATH", disk_path);
    replace_string (xml, "SWAPPATH", disk_path);
    replace_string (xml, "NAME", instanceId);
    replace_string (xml, "PRIVMACADDR", privMac);
    //    replace_string (xml, "PUBMACADDR", pubMac);
    replace_string (xml, "BRIDGEDEV", brname);
    snprintf(buf, CHAR_BUFFER_SIZE, "%d", params->mem * 1024); /* because libvirt wants memory in Kb, while we use Mb */
    replace_string (xml, "MEMORY", buf);
    snprintf(buf, CHAR_BUFFER_SIZE, "%d", params->cores);
    replace_string (xml, "VCPUS", buf);
    
    return 0;
}
Beispiel #26
0
    OutItrT put(OutItrT a_next, 
                std::ios_base& a_ios, 
                char_type a_fill, 
                const time_type& a_time) const 
    {
      if (a_time.is_special()) { 
        return do_put_special(a_next, a_ios, a_fill, 
                              a_time.date().as_special());
      }
      string_type format(m_format);
      string_type frac_str;
      if (format.find(seconds_with_fractional_seconds_format)) {
        // replace %s with %S.nnn 
        frac_str = 
          fractional_seconds_as_string(a_time.time_of_day(), false);
        char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point();
        
        string_type replace_string(seconds_format);
        replace_string += sep;
        replace_string += frac_str;
        boost::algorithm::replace_all(format, 
                                      seconds_with_fractional_seconds_format, 
                                      replace_string);
      }
      if (format.find(fractional_seconds_format)) {
        // replace %f with nnnnnnn
        if (!frac_str.size()) {
          frac_str = fractional_seconds_as_string(a_time.time_of_day(), false);
        }
        boost::algorithm::replace_all(format,
                                      fractional_seconds_format, 
                                      frac_str);
      }

      if (format.find(fractional_seconds_or_none_format)) {
        // replace %F with nnnnnnn or nothing if fs == 0
        frac_str = 
          fractional_seconds_as_string(a_time.time_of_day(), true);
        if (frac_str.size()) {
          char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point();
          string_type replace_string;
          replace_string += sep;
          replace_string += frac_str;
          boost::algorithm::replace_all(format,
                                        fractional_seconds_or_none_format, 
                                        replace_string);
        }
        else {
          boost::algorithm::erase_all(format,
                                      fractional_seconds_or_none_format);
        }
      }

      return do_put_tm(a_next, a_ios, a_fill, 
                       to_tm(a_time), format);
    }
Beispiel #27
0
string query_khmsg(string type,string name)
{
        string msg,msg1;
        msg = "";
        msg1 = "";
        msg += action_msg[random(sizeof(action_msg))];
        if (type == "寻") {
                msg1 = say_msg[random(sizeof(say_msg))];
                msg1 = replace_string(msg1,"name"," " + name + " ");
                msg1 = replace_string(msg1,"type","找");
        } else
        {
                msg1 = kill_msg[random(sizeof(kill_msg))];
                msg1 = replace_string(msg1,"name"," " + name + " ");
                msg1 = replace_string(msg1,"type","杀");
        }
        msg += msg1;
        return msg;
}
Beispiel #28
0
/* checks if the strings contains special double marks and then
 * replace all occurrences of this strings in the message */
void replace_strings(char *mes, char *strings) {
	char *pos, *atr, *val, *repl, *end;
	char sep;

	pos=atr=val=repl = NULL;
	dbg("replace_strings entered\nstrings: '%s'\n", strings);
	if ((isalnum(*strings) != 0) && 
		(isalnum(*(strings + strlen(strings) - 1)) != 0)) {
		replace_string(req, "$replace$", replace_str);
	}
	else {
		sep = *strings;
		dbg("sep: '%c'\n", sep);
		end = strings + strlen(strings);
		pos = strings + 1;
		while (pos < end) {
			atr = pos;
			pos = strchr(atr, sep);
			if (pos != NULL) {
				*pos = '\0';
				val = pos + 1;
				pos = strchr(val, sep);
				if (pos != NULL) {
					*pos = '\0';
					pos++;
				}
			}
			dbg("atr: '%s'\nval: '%s'\n", atr, val);
			if ((atr != NULL) && (val != NULL)) {
				repl = str_alloc(strlen(val) + 3);
				if (repl == NULL) {
					printf("failed to allocate memory\n");
					exit_code(2, __PRETTY_FUNCTION__, "memory allocation failure");
				}
				sprintf(repl, "$%s$", atr);
				replace_string(mes, repl, val);
				free(repl);
			}
			dbg("pos: '%s'\n", pos);
		}
	}
	dbg("mes:\n'%s'\n", mes);
}
Beispiel #29
0
string query_parry_msg(object weapon, object victim)
{
	object ob;

	if( !objectp(ob = victim->query_temp("weapon"))
	|| ob->query("skill_type") != "sword" || victim->query_skill("wudang-jian", 1) < 100 )
		return SKILL_D("parry")->query_parry_msg(weapon);
	else
		return replace_string(parry_msg[random(sizeof(parry_msg))], "$W", ob->name());
}
Beispiel #30
0
void on_entry_insert( GtkEntryBuffer *buf, guint position, gchar *chars,
                                            guint n_chars, gpointer user_data )
{   // remove linefeeds from pasted text
    if ( !strchr( gtk_entry_buffer_get_text( buf ), '\n' ) )
        return;

    char* new_text = replace_string( gtk_entry_buffer_get_text( buf ), "\n", "", FALSE );
    gtk_entry_buffer_set_text( buf, new_text, -1 );
    g_free( new_text );
}