Esempio n. 1
0
File: tree_tests.c Progetto: imej/c
char *test_getvar()
{
    char line[] = "how are you?";
    char rv[MAXLINE] = {0};
    struct tnode *tree = createKeyTree();
    int i = 0;
     
    i = getvar(line, i, tree, rv);
    
    mu_assert(i == 3, "the first word should be ended at position 3");
    mu_assert(strcmp(rv,"how") == 0, "the first word is not 'how'");

    i = getvar(line, i, tree, rv);
    
    mu_assert(i == 7, "the second word should be ended at position 7");
    mu_assert(strcmp(rv,"are") == 0, "the second word is not 'are'");
    
    i = getvar(line, i, tree, rv);
    
    mu_assert(i == 11, "the second word should be ended at position 11");
    mu_assert(strcmp(rv,"you") == 0, "the third word is not 'you'");
    
    i = getvar(line, i, tree, rv);
    
    mu_assert(i == -1,"the fourth word does not exist");
    
    tdestroy(tree);

    return NULL;
}
Esempio n. 2
0
/*
* Variable should be in format:
*
*	gpio<N>=pin_name,pin_name
*
* This format allows multiple features to share the gpio with mutual
* understanding.
*
* 'def_pin' is returned if a specific gpio is not defined for the requested functionality 
* and if def_pin is not used by others.
*/
uint
getgpiopin(char *vars, char *pin_name, uint def_pin)
{
	char name[] = "gpioXXXX";
	char *val;
	uint pin;

	/* Go thru all possibilities till a match in pin name */
	for (pin = 0; pin < GPIO_NUMPINS; pin ++) {
		sprintf(name, "gpio%d", pin);
		val = getvar(vars, name);
		if (val && findmatch(val, pin_name))
			return pin;
	}

	if (def_pin != GPIO_PIN_NOTDEFINED) {
		/* make sure the default pin is not used by someone else */
		sprintf(name, "gpio%d", def_pin);
		if (getvar(vars, name)) {
			def_pin =  GPIO_PIN_NOTDEFINED;
		}
	}

	return def_pin;
}
Esempio n. 3
0
File: user.c Progetto: erukiti/ma
SHELL	void	user_chk(uint u)
{
	char	i,f;
	char	*p,*s;

	f=0;
	if (user.number==0)
		return;

	for (i=0;i<varsize(user.defs);++i)
		{
		 p=mkkey(i,user.defs);
		 if (p==NULL)
		 	break;
		 if (toupper(*getvar(p,user.defs))!='T')
			s=getvar(p,user.var); else
		 	{
		 	 if (u==0)
		 		continue;
		 	}
		 if (s==NULL||*s=='\0'||u==1)
		 	{
		 	 if (f==0)
		 	 	{
		 	 	 f=1;
		 	 	 msgout("");
		 	 	 msgout(IC_ok"二三、あなたについてお聞きしたい事が有ります。");
		 	 	}
		 	 user_def(p);
		 	}
		}
/* varview(user.var); */
}
Esempio n. 4
0
int TextMan::print(const char *p, int lin, int col, int len) {
	if (p == NULL)
		return 0;

	debugC(4, kDebugLevelText, "lin = %d, col = %d, len = %d", lin, col, len);

	if (col == 0 && lin == 0 && len == 0)
		lin = col = -1;

	if (len == 0)
		len = 30;

	blit_textbox(p, lin, col, len);

	if (getflag(F_output_mode)) {
		/* non-blocking window */
		setflag(F_output_mode, false);
		return 1;
	}

	/* blocking */

	if (game.vars[V_window_reset] == 0) {
		int k;
		setvar(V_key, 0);
		k = wait_key();
		close_window();
		return k;
	}

	/* timed window */

	debugC(3, kDebugLevelText, "f15==0, v21==%d => timed", getvar(21));
	game.msg_box_ticks = getvar(V_window_reset) * 10;
	setvar(V_key, 0);

	do {
		main_cycle();
		if (game.keypress == KEY_ENTER) {
			debugC(4, kDebugLevelText, "KEY_ENTER");
			setvar(V_window_reset, 0);
			game.keypress = 0;
			break;
		}
	} while (game.msg_box_ticks > 0);

	setvar(V_window_reset, 0);

	close_window();

	return 0;
}
void luaPopulateSettings(CEGUI::Window* settingsWindow)
{
    CEGUI::Slider* slider;

    slider = (CEGUI::Slider*)settingsWindow->getChildRecursive("Settings/Main/Volume");
    int soundvol = getvar("soundvol");
    slider->setCurrentValue(float(soundvol)/255);

    slider = (CEGUI::Slider*)settingsWindow->getChildRecursive("Settings/Main/MusicVolume");
    int musicvol = getvar("musicvol");
    slider->setCurrentValue(float(musicvol)/255);

//printf("luaPopulateSettings: %d,%d\r\n", soundvol, musicvol);
}
Esempio n. 6
0
void heapadjust(int index, int sizeall, int depth)
{
	//printf("heapadjust %d %d %d\n",index,sizeall,depth);
	int nchild=index*2+1;
	//printf("nchild: %d\n",nchild);
	//scanf("%d",&nchild);
	if(nchild<sizeall)
	{
		if (nchild==sizeall-1)
		{
			printf
			(
				"%sif(%s>%s)\n"
				"%s{\n"
				,
				strtab[depth],getvar(nchild),getvar(index),
				strtab[depth]
			);
			itemxchg(nchild,index,depth+1);
			printf("%s}\n",strtab[depth]);
		}
		else
		{
			printf
			(
				"%sif(%s>%s&&%s>=%s)\n"
				"%s{\n"
				,
				strtab[depth],getvar(nchild),getvar(index),getvar(nchild),getvar(nchild+1),
				strtab[depth]
			);
			itemxchg(nchild,index,depth+1);
			heapadjust(nchild,sizeall,depth+1);
			printf("%s}\n",strtab[depth]);
			
			printf
			(
				"%sif(%s>%s&&%s>=%s)\n"
				"%s{\n"
				,
				strtab[depth],getvar(nchild+1),getvar(index),getvar(nchild+1),getvar(nchild),
				strtab[depth]
			);
			itemxchg(nchild+1,index,depth+1);
			heapadjust(nchild+1,sizeall,depth+1);
			printf("%s}\n",strtab[depth]);
		}
	}
}
Esempio n. 7
0
void itemxchg(int idx0, int idx1, int depth)
{
	printf
	(
		"%s"
		"%s=%s;"
		"%s=%s;"
		"%s=%s;\n"
		,
		strtab[depth],
		varx,getvar(idx0),
		getvar(idx0),getvar(idx1),
		getvar(idx1),varx
	);
}
Esempio n. 8
0
static int init_luabash()
{
  if (!initialized) {
    const char* bash_version=getvar("BASH_VERSION");
    if (!bash_version)
      return EXECUTION_FAILURE;

    if (bash_version[0]=='2')
      current_flavor=bash_version_v2;
    else if (bash_version[0]=='3' ||
             bash_version[0]=='4')
      current_flavor=bash_version_v3;

    if (current_flavor==bash_version_unknown) {
      fprintf(stderr, "lua bash error: unknown/unsupported bash version\n");
      return EXECUTION_FAILURE;     
    }

    L=luaL_newstate ();
    if (!L) {
      fprintf(stderr, "lua bash error: failed to initialize lua state\n");
      return EXECUTION_FAILURE;     
    }

    luaL_openlibs(L);
    luaL_register(L, "bash", bashlib);
    
    initialized=1;
  }

  return EXECUTION_SUCCESS;
}
Esempio n. 9
0
VAR_DATA *
setvar (CHAR_DATA * mob, char *var_name, int value, int type)
{
	VAR_DATA *var;

	if (!(var = getvar (mob, var_name)))
	{

		var = new VAR_DATA;

		var->name = duplicateString (var_name);

		if (*var_name == '_')
		{
			var->next = global_vars;
			global_vars = var;
		}
		else
		{
			var->next = mob->vartab;
			mob->vartab = var;
		}
	}

	var->type = type;
	var->value = value;

	return var;
}
Esempio n. 10
0
/*
 * Set the created authenticated variable, AuthVarCreate,
 * and checking the data size and data.
 * expect EFI_SUCCESS returned.
 */
static int uefirtauthvar_test1(fwts_framework *fw)
{
	long ioret;

	uint8_t data[getvar_buf_size];
	uint64_t getdatasize = sizeof(data);
	uint64_t status;
	uint32_t attributestest;
	size_t i;

	ioret = setvar(&gtestguid, attributes, sizeof(AuthVarCreate), AuthVarCreate, &status);

	if (ioret == -1) {
		int supcheck = check_fw_support(fw, status);

		if (supcheck != FWTS_OK)
			return supcheck;

		fwts_failed(fw, LOG_LEVEL_HIGH,
			"UEFICreateAuthVar",
			"Failed to create authenticated variable with UEFI "
			"runtime service.");

		fwts_uefi_print_status_info(fw, status);
		return FWTS_ERROR;
	}

	ioret = getvar(&gtestguid, &attributestest, &getdatasize, data, &status);
	if (ioret == -1) {
		fwts_failed(fw, LOG_LEVEL_HIGH,
			"UEFICreateAuthVar",
			"Failed to get authenticated variable with UEFI "
			"runtime service.");
		fwts_uefi_print_status_info(fw, status);
		return FWTS_ERROR;
	}
	if (getdatasize != sizeof(AuthVarCreateData)) {
		fwts_failed(fw, LOG_LEVEL_HIGH,
			"UEFICreateAuthVar",
			"Get authenticated variable data size is not the "
			"same as it set.");
		return FWTS_ERROR;
	}

	for (i = 0; i < sizeof(AuthVarCreateData); i++) {
		if (data[i] != AuthVarCreateData[i]) {
			fwts_failed(fw, LOG_LEVEL_HIGH,
			"UEFICreateAuthVar",
			"Get authenticated variable data are not the "
			"same as it set.");
			return FWTS_ERROR;
		}
	}

	data_exist |= E_AUTHVARCREATE;

	fwts_passed(fw, "Create authenticated variable test passed.");

	return FWTS_OK;
}
Esempio n. 11
0
static int robo_switch_enable(void)
{
	unsigned int i, last_port;
	u16 val;

	val = robo_read16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE);
	if (!(val & (1 << 1))) {
		/* Unmanaged mode */
		val &= ~(1 << 0);
		/* With forwarding */
		val |= (1 << 1);
		robo_write16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE, val);
		val = robo_read16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE);
		if (!(val & (1 << 1))) {
			printk("Failed to enable switch\n");
			return -EBUSY;
		}

		last_port = (robo.devid == ROBO_DEVICE_ID_5398) ?
				ROBO_PORT6_CTRL : ROBO_PORT3_CTRL;
		for (i = ROBO_PORT0_CTRL; i < last_port + 1; i++)
			robo_write16(ROBO_CTRL_PAGE, i, 0);
	}

	/* WAN port LED, except for Netgear WGT634U */
	if (strcmp(getvar("nvram_type"), "cfe") != 0)
		robo_write16(ROBO_CTRL_PAGE, 0x16, 0x1F);

	return 0;
}
Esempio n. 12
0
void netStruct_init()
{
	int iterator;
	unsigned int* def;
	symbolType s;



	buffers=getVarNumber(TOTALBUFFERNUM);
	bufferLen=getVarNumber(TOTALBUFFERLEN);
	def=getvar(BASICBUFFERSTS ,&s);
	if(def&&symbolType_string==s)
	{
		defaultStatus=*def;
	}

	ns=malloc(sizeof(netStruct)*buffers);
	shares=malloc(sizeof(netStruct*)*buffers);
	if(!shares||!ns)
		qerror("Failed allocation of netstruct buffers",0);

	for(iterator=0;iterator<buffers;iterator++)
	{

		ns[iterator].data=malloc(bufferLen);
		if(!ns[iterator].data)
			qerror("failed allocating memory for buffer",0);
		shares[iterator]=ns+iterator;
	}


}
Esempio n. 13
0
static uint32_t calc_bytesize(char *varlist) {
    char *varname = NULL;
    char *varlistcpy = NULL;
    char *varlistcpy_strtok = NULL;
    var_t *var = NULL;
    uint32_t val = 0;

    if (!(varlistcpy = calloc(strlen(varlist)+1)))
        return 0;

    strcpy(varlistcpy,varlist);
    varlistcpy_strtok = varlistcpy;

    //we allow this to overflow, but result is checked for size elsewhere
    while ((varname = strtok(varlistcpy_strtok,','))) {
        varlistcpy_strtok = NULL; //for strtok
        if (strlen(varname) == 0)
            break;
        if (!(var = getvar(varname))) {
            val = 0;
            break;
        }
        if (var->type != NUMTYPE) {
            val = 0;
            break;
        }
        val += ((numvar_t*)var)->num;
    }
    free(varlistcpy);
    return val;
}
Esempio n. 14
0
static int handlenew() {
    char *type = NULL;
    char *name = NULL;
    char *arg = NULL;
    int i = 0;

    type = strtok(NULL,' ');

    if (!type || strlen(type) == 0)
        return ERRNOTYPE;

    name = strtok(NULL,' ');

    if (!name)
        return ERRNONAME;

    if (getvar(name))
        return ERRALREADYEXISTS;

    arg = strtok(NULL, ' ');

    if (!arg || strlen(arg) == 0)
        return ERRNOARG;

    for (i = 0; i < sizeof(types)/sizeof(types[0]); i+=1) {
        if (streq(type,types[i]))
            return constructors[i](name,arg);
    }

    return ERRNOSUCHTYPE;

}
Esempio n. 15
0
static simpts *checkplot(simpts *sp,int argc,char **argv,int numfiles)
{
  int ii=0;
  UINT1 nvout=0; 
  Toplot *tpout=NULL;
  simpts *newsp=NULL;
  tpout=(Toplot*)(calloc(1,sizeof(Toplot)));
  newsp=(simpts*)(calloc(numfiles,sizeof(simpts)));
  

  
  for(ii=0;ii<=(numfiles-1);ii++)
    {
      tpout =getvar(((sp+ii)->tpl),&nvout,argc,argv,((sp+ii)->curfilenum));
       (newsp+ii)->tpl=(Toplot*)(calloc(1,sizeof(Toplot)));
      memcpy(((Toplot*)(newsp+ii)->tpl),(Toplot*)tpout,sizeof(Toplot));
      (newsp+ii)->t1 = (sp+ii)->t1;
      (newsp+ii)->numcontreg = (sp+ii)->numcontreg;
      (newsp+ii)->curfilenum = (sp+ii)->curfilenum;
      (newsp+ii)->filename = (sp+ii)->filename;
      
    }
  
  return newsp;
}  
Esempio n. 16
0
File: user.c Progetto: erukiti/ma
void	sign_pass(char *p)
{
	char	buf[LN_buf+1];

	strcpy(buf,getvar("pass",user.var));
	if (*buf!='\0')
		{
		 msgout(IC_act "現時点でのパスワードを入力してください。");
		 getpass(buf);
		 if (!ulist_chkpass(buf,user.number))
			{
			 msgout(IC_err 
			 	"あなたはパスワード変更が出来ません。");
			 return ;
			}
		}

	for(;;)
		{
		 msgout("パスワードを入力してください。");
		 getpass(p);
		 msgout(IC_act "確認のためにもう一度入力してください。");
		 getpass(buf);
		 if (strcmp(p,buf)==SAME)
		 	return;
		 msgout(IC_err "パスワードが食い違っています。");
		}
}
Esempio n. 17
0
/**
*
* _cd(debug, path);
*
* Change current working directory.
*
**/
PUBLIC void _cd(DEBUG *debug, char *path)
{
    Object *cwd;

    if (path == NULL)
        if ((path = getvar(debug->env.Envv, "HOME")) == NULL)
            cmderr(debug, "No home directory");

#ifdef OLDCODE
    if ((cwd = Locate(debug->env.Objv[0], path)) == NULL)
#endif
        /*
        -- crf : 12/08/91 - clean up use of Environment Objv
        */
        if ((cwd = Locate(debug->env.Objv[OV_Cdir], path)) == NULL)
            cmderr(debug, "No such directory");
#ifdef OLDCODE
    Close(debug->env.Objv[0]);
    debug->env.Objv[0] = cwd;
#endif
    /*
    -- crf : 12/08/91 - clean up use of Environment Objv
    */
    Close(debug->env.Objv[OV_Cdir]);
    debug->env.Objv[OV_Cdir] = cwd;

    cmdmsg( debug, "Current directory is now '%s'", path );

    return;
}
Esempio n. 18
0
double getfval(char *s)	/* return float value of variable s */
{
	YYSTYPE y;

	y = getvar(s);
	return y.f;
}
Esempio n. 19
0
File: user.c Progetto: erukiti/ma
void	user_rep(uint id)
{
	uint	a;

	user.number= id;
	strjncpy(user.id,getvar("id",user.var),LN_id);
	strjncpy(user.style,getvar("style",user.var),LN_key);
	strjncpy(user.handle,getvar("handle",user.var),LN_handle);
	ch.limit= atoi(getvar("limit",user.var))*60;
	if (ch.limit==0 )/* ||ゴールデンアワーならば・・・・ */
		ch.limit=60*10;
	a=atoi(getvar("mode",user.var));
	ch.frug.esc   =!(a&1);
	ch.frug.onekey=a&2;

	ulist_rep(id,user.var);
}
Esempio n. 20
0
void computeraytable(float vx, float vy)
{
    if(!ocull) return;

    odist = getvar("fog")*1.5f;

    float apitch = (float)fabs(player1->pitch);
    float af = getvar("fov")/2+apitch/1.5f+3;
    float byaw = (player1->yaw-90+af)/360*PI2;
    float syaw = (player1->yaw-90-af)/360*PI2;

    loopi(NUMRAYS)
    {
        float angle = i*PI2/NUMRAYS;
        if((apitch>45 // must be bigger if fov>120
        || (angle<byaw && angle>syaw)
        || (angle<byaw-PI2 && angle>syaw-PI2)
        || (angle<byaw+PI2 && angle>syaw+PI2))
        && !OUTBORD(vx, vy)
        && !SOLID(S(fast_f2nat(vx), fast_f2nat(vy))))       // try to avoid tracing ray if outside of frustrum
        {
            float ray = i*8/(float)NUMRAYS;
            float dx, dy;
            if(ray>1 && ray<3) { dx = -(ray-2); dy = 1; }
            else if(ray>=3 && ray<5) { dx = -1; dy = -(ray-4); }
            else if(ray>=5 && ray<7) { dx = ray-6; dy = -1; }
            else { dx = 1; dy = ray>4 ? ray-8 : ray; };
            float sx = vx;
            float sy = vy;
            for(;;)
            {
                sx += dx;
                sy += dy;
                if(SOLID(S(fast_f2nat(sx), fast_f2nat(sy))))    // 90% of time spend in this function is on this line
                {
                    rdist[i] = (float)(fabs(sx-vx)+fabs(sy-vy));
                    break;
                };
            };
        }
        else
        {
            rdist[i] = 2;
        };
    };
};
Esempio n. 21
0
File: user.c Progetto: erukiti/ma
SHELL	void	user_disp()
{
	char	buf[LN_buf+1];
	uint	a,i;

	sprt(buf,lpu(user.number,-4)," [",user_id(),"]",NULL);
	lo_line(buf);

	prt("ハンドル "DC_norm ,user_handle(),"\n",NULL);
	prt("端末     "DC_norm ,
		isonekey()?"ワンキー入力":"ライン入力","\n",NULL);

	i=atol(getvar("lastlog",user.var))!=0;
	if (i)
		{
		 prt("コネクト "DC_norm ,ch.result,"\n",NULL);
		 prt("経過時間 "DC_norm ,strptime(timer_pas(ch.pass)),"。"
		 "活動限界まで",strptime(ch.limit-timer_pas(ch.pass)),"です。\n",NULL);
		}
	if (user.number>0)
		{
		 if (i)
		 	{
		 	 prt("ログイン "DC_norm 
		 	 						,stredatime(ch.login),"\n",NULL);

			 a=ulist_getmpost(user.number);
			 prt("ポスト数 "DC_norm "(今月)",lpu(a,0),"/(全体)"
			 	,lpu(ulist_getpost(user.number)+a,0),"\n",NULL);

			 a=ulist_getmlogin(user.number);
			 prt("ログイン "DC_norm "(今月)",lpu(a,0),"/(全体)"
			 	,lpu(ulist_getlogin(user.number)+a,0),"\n",NULL);
			}

		 lo_line2();
		 prt("氏名     "DC_norm ,getvar("name",user.var),"\n",NULL);
		 prt("住所     "DC_norm ,getvar("adrs",user.var),"\n",NULL);
		 prt("電話番号 "DC_norm ,getvar("tel",user.var),"\n",NULL);
		 prt("誕生日   "DC_norm ,getvar("birth",user.var),"\n",NULL);

		 lo_line2();
		 prof_myview();
		}
	lo_line1();
}
Esempio n. 22
0
/**
 * Update AGI interpreter timer.
 */
void update_timer() {
	clock_count++;
	if (clock_count <= TICK_SECONDS)
		return;

	clock_count -= TICK_SECONDS;

	if (!game.clock_enabled)
		return;

	setvar(V_seconds, getvar(V_seconds) + 1);
	if (getvar(V_seconds) < 60)
		return;

	setvar(V_seconds, 0);
	setvar(V_minutes, getvar(V_minutes) + 1);
	if (getvar(V_minutes) < 60)
		return;

	setvar(V_minutes, 0);
	setvar(V_hours, getvar(V_hours) + 1);
	if (getvar(V_hours) < 24)
		return;

	setvar(V_hours, 0);
	setvar(V_days, getvar(V_days) + 1);
}
Esempio n. 23
0
/**
 * Update AGI interpreter timer.
 */
void AgiEngine::updateTimer() {
	_clockCount++;
	if (_clockCount <= TICK_SECONDS)
		return;

	_clockCount -= TICK_SECONDS;

	if (!_game.clockEnabled)
		return;

	setvar(vSeconds, getvar(vSeconds) + 1);
	if (getvar(vSeconds) < 60)
		return;

	setvar(vSeconds, 0);
	setvar(vMinutes, getvar(vMinutes) + 1);
	if (getvar(vMinutes) < 60)
		return;

	setvar(vMinutes, 0);
	setvar(vHours, getvar(vHours) + 1);
	if (getvar(vHours) < 24)
		return;

	setvar(vHours, 0);
	setvar(vDays, getvar(vDays) + 1);
}
Esempio n. 24
0
/*
 * Search the vars for a specific one and return its value as
 * an integer. Returns 0 if not found.
 */
int getintvar(char *vars, char *name)
{
	char *val;

	if ((val = getvar(vars, name)) == NULL)
		return (0);

	return (bcm_strtoul(val, NULL, 0));
}
Esempio n. 25
0
void ebasearrayof::serial(estr& data) const
{
  serialint(size(),data);
  size_t i;
  for (i=0; i<size(); ++i){
    getvarkey(i).serial(data);
    getvar(i).serial(data);
  }
}
Esempio n. 26
0
/*
 * Read a number or variable.
 */
int getnum(char *text)
{
  int val;

  if (!strcmp(text, "$?"))
    return laststatus;
  if ((val = atoi(text)) != 0 || *text == '0')
    return val;
  return getvar(text, 0)->value;
}
Esempio n. 27
0
/*
 * Search the vars for a specific one and return its value as
 * an integer. Returns 0 if not found.
 */
int getintvar(char *vars, const char *name)
{
	char *val;

	val = getvar(vars, name);
	if (val == NULL)
		return 0;

	return simple_strtoul(val, NULL, 0);
}
Esempio n. 28
0
Variant Object::get(const StringName &p_name, bool *r_valid) const {

	Variant ret;

	if (script_instance) {

		if (script_instance->get(p_name, ret)) {
			if (r_valid)
				*r_valid = true;
			return ret;
		}
	}

	//try built-in setgetter
	{
		if (ClassDB::get_property(const_cast<Object *>(this), p_name, ret)) {
			if (r_valid)
				*r_valid = true;
			return ret;
		}
	}

	if (p_name == CoreStringNames::get_singleton()->_script) {
		ret = get_script();
		if (r_valid)
			*r_valid = true;
		return ret;

	} else if (p_name == CoreStringNames::get_singleton()->_meta) {
		ret = metadata;
		if (r_valid)
			*r_valid = true;
		return ret;
#ifdef TOOLS_ENABLED
	} else if (p_name == CoreStringNames::get_singleton()->_sections_unfolded) {
		Array array;
		for (Set<String>::Element *E = editor_section_folding.front(); E; E = E->next()) {
			array.push_back(E->get());
		}
		if (r_valid)
			*r_valid = true;
		return array;
#endif
	} else {
		//something inside the object... :|
		bool success = _getv(p_name, ret);
		if (success) {
			if (r_valid)
				*r_valid = true;
			return ret;
		}
		//if nothing else, use getvar
		return getvar(p_name, r_valid);
	}
}
Esempio n. 29
0
File: user.c Progetto: erukiti/ma
SHELL	void	user_def(char *s)
{
	char	*p,*msgptr;
	uint	i;
	char	c,buf[LN_buf+1];

	msgptr = pull(buf,getvar(s,user.defs));
	i=atoi(buf);
	c=toupper(*buf);
	if (c!='T')
		{
		 strcpy(buf,getvar(s,user.var));
		 p=buf;
		}

	msgout(msgptr);
	switch(c)
		{
	 case 'I':
/* IDを取得している状態からはこれを呼び出さないようにしなければならない */
		 sign_id(p);
		 break;
	 case 'P':
	  	 sign_pass(p);
		 break;
	 case 'S':
	 	 user_sel(s,p);
	 	 break;
	 case 'M':
	 	 user_mark(s,p);
	 	 break;
	 case 'T':
	 	 disp_text(s);
	 	 return;

	 default:
	  	 if (i==0 ||LN_str<i)
	  	 	i=LN_str;
	  	 getrstri(p,i);
	  	}
	setvar(s,p,user.var);
}
Esempio n. 30
0
File: line.c Progetto: erukiti/ma
uint	line_mptr(char *s)
{
	char	buf[LN_buf+1];
	char	*p;

	p=getvar(s,user.mptr);
	if (p==NULL)
		return 0;
	pull(buf,p);
	return atoi(buf);
}