Esempio n. 1
0
File: fmenu.c Progetto: nrnhines/nrn
static void appendvar(int imenu, const char* variable, const char* command)
{
	Menuitem *item;
	int i, len;
	char buf[256];
	Psym *p;

	item = append(imenu);
	item->type = MENU_VAR;
	item->psym = p  = hoc_getsym(variable);
	if (command) {
		item->command = (char *)emalloc((unsigned)(strlen(command) + 1));
		Strcpy(item->command, command);
	}else{
		item->command = (char *)0;
	}
	Sprintf(buf, "%s", p->sym->name);
	len = strlen(buf);
	for (i = 0; i < p->nsub; i++) {
		Sprintf(buf+len, "[%d]", p->sub[i]);
		len = strlen(buf);
	}
	item->prompt = (char *)emalloc((unsigned)(len+1));
	Strcpy(item->prompt, buf);
}
Esempio n. 2
0
/*-------------------------------------------------------------------------
 * ReadFromRegistry
 *-------------------------------------------------------------------------
 * Purpose:
 *    Read info from the registry
 * 
 * Parameters:
 *    hk:        which key to read from
 *    bIsString: if false, then item is cosnidered to be a DWORD
 *    szItem:    name of item to read
 *    pValue:    destination of read
 *    dwDefault: default value can be an int or a pointer to a string
 *
 * Returns:
 *    true: iff pValue was set
 */
bool CServiceModule::ReadFromRegistry(HKEY & hk, bool bIsString, const char * szItem, void * pValue, DWORD dwDefault, bool bWarnIfMissing)
{
    char psz[MAX_PATH] = {""};
    DWORD dwSize = (bIsString ? sizeof(psz): sizeof(DWORD));

    if (RegQueryValueExA(hk, szItem, NULL, NULL, (BYTE *)psz, &dwSize) != ERROR_SUCCESS ||
        (bIsString && psz[0] == 0)) // if blank like what SrvConfig.exe makes
    {
        if (bIsString)
        {
            if (dwDefault)
            {
                Strcpy((char*)pValue, (char*)dwDefault);
                if(bWarnIfMissing)
                    LogEvent(EVENTLOG_INFORMATION_TYPE, LE_RegStrMissingDef, szItem, dwDefault);
                return true;
            }
            if(bWarnIfMissing)
                LogEvent(EVENTLOG_ERROR_TYPE, LE_RegStrMissingNoDef, szItem);
            return false;
        }
        if(bWarnIfMissing)
            LogEvent(EVENTLOG_ERROR_TYPE, LE_RegIntMissingDef, szItem, (DWORD)dwDefault);
        *(DWORD*)pValue = dwDefault;
        return true;
    }

    if (bIsString)
        Strcpy((char*)pValue, psz);
    else
        *(DWORD*)pValue = *(DWORD*)psz;

    return true;
}
Esempio n. 3
0
// BT - 7/15 - Send currently connected players to the CSS webservice.
void CLobbyApp::SendGameInfoToCss()
{
	if (g_pLobbyApp->GetCssGameInfoEnabled() == false)
		return;

	CCssSoap cssSoap(g_pLobbyApp->GetCssServerDomain(), g_pLobbyApp->GetCssClientServicePath(), g_pLobbyApp->GetCssLobbyServicePath(), g_pLobbyApp->GetCssGameDataServicePath());

	std::vector<ConnectedPlayerInfo> connectedPlayers;

	PlayerByName::iterator iterPlayer = m_playerByName.begin();
	while (iterPlayer != m_playerByName.end())
	{
		ConnectedPlayerInfo connectedPlayerInfo;

		char szPlayerName[256];
		Strcpy(connectedPlayerInfo.szPlayerName, (*(*iterPlayer).second).second.GetName());

		FMD_LS_LOBBYMISSIONINFO *missionInfo = (*(*iterPlayer).second).second.GetMission()->GetMissionInfo();
		Strcpy(connectedPlayerInfo.szGameName, FM_VAR_REF(missionInfo, szGameName));
		Strcpy(connectedPlayerInfo.szServerName, FM_VAR_REF(missionInfo, szServerName));
		
		connectedPlayers.push_back(connectedPlayerInfo);

		iterPlayer++;
	}

	if (connectedPlayers.size() > 0)
	{
		cssSoap.SendConnectedPlayerInfo(connectedPlayers);
	}
}
Esempio n. 4
0
void
getmailstatus()
{
	if(!mailbox && !(mailbox = nh_getenv("MAIL"))) {
#  ifdef MAILPATH
#   ifdef AMS
	        struct passwd ppasswd;

		(void) memcpy(&ppasswd, getpwuid(getuid()), sizeof(struct passwd));
		if (ppasswd.pw_dir) {
		     mailbox = (char *) alloc((unsigned) strlen(ppasswd.pw_dir)+sizeof(AMS_MAILBOX));
		     Strcpy(mailbox, ppasswd.pw_dir);
		     Strcat(mailbox, AMS_MAILBOX);
		} else
		  return;
#   else
		const char *pw_name = getpwuid(getuid())->pw_name;
		mailbox = (char *) alloc(sizeof(MAILPATH)+strlen(pw_name));
		Strcpy(mailbox, MAILPATH);
		Strcat(mailbox, pw_name);
#  endif /* AMS */
#  else
		return;
#  endif
	}
	if(stat(mailbox, &omstat)){
#  ifdef PERMANENT_MAILBOX
		pline("Cannot get status of MAIL=\"%s\".", mailbox);
		mailbox = 0;
#  else
		omstat.st_mtime = 0;
#  endif
	}
}
Esempio n. 5
0
void preappend_nand_dev_name(const char *origname, char *newname)
{
	if (emulationType == 1) 
		Strcpy(newname, "sd:");
	else if (emulationType == 2)
		Strcpy(newname, "usb:");

	Strcat(newname, origname);
}
Esempio n. 6
0
File: fmenu.c Progetto: nrnhines/nrn
static void appendaction(int imenu, const char* prompt, const char* command)
{
	Menuitem *item;
	item = append(imenu);
	item->type = MENU_ACTION;
	item->prompt = (char *)emalloc((unsigned)(strlen(prompt) + 1));
	Strcpy(item->prompt, prompt);
	item->command = (char *)emalloc((unsigned)(strlen(command) + 1));
	Strcpy(item->command, command);
}
Esempio n. 7
0
void CLobbyApp::SendGameInfo()
{
  ZGameServerInfoMsg* gameInfo = GetGameServerInfoMsg();
  SetVariableGameInfo();
  //must do endian so both side of network get correct numbers
  //gameinfo used on Unix and Intel boxes
  //note that doing this once will invalidate all numbers
  //so set gameInfo->info[0] numbers again.
  ZGameInstanceInfoMsgEndian( gameInfo->info );
  
  //send, usually to many Ip addresses which are Zone Web servers, so add this to your game configuration
  for (int i = 0; i < m_cReportServers; i++)
    ZGameInfoSendTo(m_rgulIP[i], 2000, GetGameServerInfoMsg(), sizeof(m_GameInfoBuf));

  //Imago 9/14
	if (m_fmServers.GetConnections()->GetCount() > 0) {
		int offset = 0;
		char * PostData = new char[BUFFSIZE];
		ZeroMemory(PostData,BUFFSIZE);
		ListConnections::Iterator iterCnxn(*m_fmServers.GetConnections());
		while (!iterCnxn.End()) {
			CFLServer * pServerT = CFLServer::FromConnection(*iterCnxn.Value());
			MissionList::Iterator iterMission(*pServerT->GetMissions());
			while (!iterMission.End()){
				CFLMission* mission = iterMission.Value();
				FMD_LS_LOBBYMISSIONINFO *info = mission->GetMissionInfo();
				if (info) {
					memcpy(PostData + offset, info, info->cbmsg);
					offset += info->cbmsg;
					iterMission.Next();
				}
			}
			iterCnxn.Next();
		}
		if (offset > 0) {
			 pHTTP settings;
			 Strcpy(settings.hdrs,"Content-Type: application/octet-stream\r\n");
			 Strcpy(settings.verb,"POST");
			 Strcpy(settings.uri,"/lobbyinfo.ashx");
			 Strcpy(settings.host,"allegiancezone.com");
			 ZeroMemory(settings.data,BUFFSIZE);
			 memcpy(settings.data,PostData,offset);
			 settings.size = offset;
			 DWORD lpExitCode;
			 GetExitCodeThread(m_threadPost,&lpExitCode);
			 if (lpExitCode != STILL_ACTIVE) {
				debugf("Creating post thread.\n");
				DWORD dum;
				m_threadPost = CreateThread(NULL, 0, PostThread, (void*)&settings, 0, &dum);
			 } else
				 debugf("Post thread was still running...\n");
		}
	}
}
// 系统基本参数
int ParamGetBaseInfo(PARAM_CONFIG_BASE_INFO *pParam)
{
	int ret;

	ret = GetParamConfig(INDEX_PARAM_CONFIG_BASE_INFO, pParam, sizeof(*pParam), 0);
	Strcpy( pParam->softwareVersion, DEV_SOFTWARE_VERSION );
	Strcpy( pParam->hardwareVersion, DEV_HARDWARE_VERSION );
	Strcpy( pParam->configureVersion, DEV_CONFIG_VERSION );
	Strcpy( pParam->serialNo, DEV_SERIAL_NUM );

	return ret;
}
Esempio n. 9
0
/*
char yn_function(const char *ques, const char *choices, char default)
                -- Print a prompt made up of ques, choices and default.
                   Read a single character response that is contained in
                   choices or default.  If choices is NULL, all possible
                   inputs are accepted and returned.  This overrides
                   everything else.  The choices are expected to be in
                   lower case.  Entering ESC always maps to 'q', or 'n',
                   in that order, if present in choices, otherwise it maps
                   to default.  Entering any other quit character (SPACE,
                   RETURN, NEWLINE) maps to default.
                -- If the choices string contains ESC, then anything after
                   it is an acceptable response, but the ESC and whatever
                   follows is not included in the prompt.
                -- If the choices string contains a '#' then accept a count.
                   Place this value in the global "yn_number" and return '#'.
                -- This uses the top line in the tty window-port, other
                   ports might use a popup.
*/
char gnome_yn_function(const char *question, const char *choices,
		CHAR_P def)
{
    int ch;
    int result=-1;
    char message[BUFSZ];
    char yn_esc_map='\033';
    GtkWidget *mainWnd = ghack_get_main_window();
    
    
    if (choices) {
	char *cb, choicebuf[QBUFSZ];
	Strcpy(choicebuf, choices);
	if ((cb = index(choicebuf, '\033')) != 0) {
	    /* anything beyond <esc> is hidden */
	    *cb = '\0';
	}
	sprintf(message, "%s [%s] ", question, choicebuf);
	if (def) sprintf(eos(message), "(%c) ", def);
	/* escape maps to 'q' or 'n' or default, in that order */
	yn_esc_map = (index(choices, 'q') ? 'q' :
		 (index(choices, 'n') ? 'n' : def));
    } else {
	Strcpy(message, question);
    }
    
    
    gnome_putstr(WIN_MESSAGE, ATR_BOLD, message);
    if (mainWnd != NULL && choices && !index(choices,ch)) {
	return(ghack_yes_no_dialog( question, choices, def));
    }

    /* Only here if main window is not present */
    while (result<0) {
	ch=gnome_nhgetch();
	if (ch=='\033') {
	    result=yn_esc_map;
	} else if (choices && !index(choices,ch)) {
	    /* FYI: ch==-115 is for KP_ENTER */
	    if (def && (ch==' ' || ch=='\r' || ch=='\n' || ch==-115)) {
		result=def;
	    } else {
		gnome_nhbell();
		/* and try again... */
	    }
	} else {
	    result=ch;
	}
    }
    return result;
}
Esempio n. 10
0
int	EnumCtrl::Translate(char* name)
{
    char	name2[enumeltnamelen];
    Strcpy(name2,name);//,enumeltnamelen);
    if (arr)
        for (int i=max-min; i>=0; i--)
            if (    arr[i].name[0]
                    &&	(int&)arr[i].name[0]==(int&)name2[0]
                    &&	(int&)arr[i].name[4]==(int&)name2[4]
                    &&	(int&)arr[i].name[8]==(int&)name2[8]
                    &&	(int&)arr[i].name[12]==(int&)name2[12]
                    &&	(int&)arr[i].name[16]==(int&)name2[16]
               )
                return(i+min);
            else;
    else
        for (enumlinkelt* t2=links; t2; t2=t2->next)
            if (    t2->name[0]
                    &&	(int&)t2->name[0]==(int&)name2[0]
                    &&	(int&)t2->name[4]==(int&)name2[4]
                    &&	(int&)t2->name[8]==(int&)name2[8]
                    &&	(int&)t2->name[12]==(int&)name2[12]
                    &&	(int&)t2->name[16]==(int&)name2[16]
               )
                return(t2->value);
            else;
    return(0x80000000);
}
Esempio n. 11
0
bool CCssSoap::CommitPlayerScoreRecords(char * szGameGuid)
{
	char szHdrs[512];
	sprintf(szHdrs, "Content-Type: text/xml;charset=UTF-8\r\nSOAPAction: \"http://tempuri.org/GameData/CommitPlayerData\"");

	char soapBody[4092];
	int length = 0;

	length += sprintf(soapBody,
		"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\" xmlns:all=\"http://schemas.datacontract.org/2004/07/Allegiance.CommunitySecuritySystem.Server\"> \
		   <soapenv:Header/> \
		   <soapenv:Body> \
			  <tem:CommitPlayerData> \
				 <tem:request> \
					<all:GameGuid>%s</all:GameGuid> \
				 </tem:request> \
			  </tem:CommitPlayerData> \
		   </soapenv:Body> \
		</soapenv:Envelope>",
		szGameGuid);

	int soapLength = strlen(soapBody);

	ZString Response = UTL::DoHTTP(szHdrs, m_szCssServerDomain, "POST", m_szCssGameDataServicePath, soapBody, soapLength, true);

	char * szToken;
	char * szResponse = (char*)_alloca(10000);
	Strcpy(szResponse, (PCC)Response);

	return strstr(szResponse, "<a:Succeeded>true</a:Succeeded>") >= 0;
}
Esempio n. 12
0
/*######################################################################
 *##
 *## NAME:  HttpSendRequest10
 *##
 *## PURPOSE: Send an http 1.0 method request-line  
 *##          Note: szReq can be "HEAD ", "POST ", "GET ", ..
 *##
 *####################################################################*/
static int HttpSendRequest10(SOCKET CSock,       /* socket decriptor   */
                             LPCSTR szReq,  /* request to be sent */
                             LPCSTR szURL   /* URL or URI         */)
{
LPSTR sRequest =  NULL;
int   Rc;

   Tcp4uLog (LOG4U_INTERN, "HttpSendRequest10");
  /* allocate buffer wide eough to contain all data */
  sRequest = Calloc (sizeof(" HTTP/1.0 ") + Strlen (szURL) + Strlen(szReq),
                     sizeof(char));
  if (sRequest == NULL)    return HTTP4U_INSMEMORY;

  /* compose request with reentrant functions */
  Strcpy(sRequest, szReq);
  Strcat(sRequest, szURL);
  Strcat(sRequest, " HTTP/1.0");

  /* send the request then forget it */
  Rc = TnSend (CSock, sRequest, FALSE, DO_NOT_LOG);
  Free (sRequest);
  if (Rc!=TCP4U_SUCCESS)    return HTTP4U_TCP_FAILED ;

  /* Send general-header */
return  HttpSendAdditionnalHeader(CSock);
} /* END HttpSendRequestHEAD10 */
Esempio n. 13
0
int dexpand_c(char *templat,char *output,int length)
/*
  This expands wildcards, matching them with files.

  Input:
    templat	The input character string, containing the wildcards.
    length	The length of the output buffer.
  Output:
    output	All the files matching "template". Filenames are separated
		by commas.
------------------------------------------------------------------------*/
{
  FILE *fd;
  char line[MAXPATH],*s;
  int l;

  Strcpy(line,"echo ");
  Strcat(line,templat);
  fd = popen(line,"r");
  if(fd == NULL) return(-1);
  s = output;
  while(fgets(s,length,fd)){
    l = strlen(s);
    if( length-l <= 1 ){(void)pclose(fd); return(-1);}
    *(s+l-1) = ',';
    s += l;
    length -= l;
  }
  if(s != output) *--s = 0;
  (void)pclose(fd);
  return(s-output);
}
Esempio n. 14
0
static Char
filetype(Char *dir, Char *file)
{
    struct stat statb;
    Char path[MAXPATHLEN];

    catn(Strcpy(path, dir), file, sizeof(path) / sizeof(Char));
    if (lstat(short2str(path), &statb) == 0) {
	switch (statb.st_mode & S_IFMT) {
	case S_IFDIR:
	    return ('/');
	case S_IFLNK:
	    if (stat(short2str(path), &statb) == 0 &&	/* follow it out */
		S_ISDIR(statb.st_mode))
		return ('>');
	    else
		return ('@');
	case S_IFSOCK:
	    return ('=');
	default:
	    if (statb.st_mode & 0111)
		return ('*');
	}
    }
    return (' ');
}
STDMETHODIMP CPigMissionParams::put_CoreName(BSTR bstrCoreName)
{
	XLock lock(this);
	USES_CONVERSION;
	Strcpy(m_mp.szIGCStaticFile,OLE2A(bstrCoreName));
	return S_OK;
}
Esempio n. 16
0
LRESULT xRenderSettingPane::OnPropertyChanged(WPARAM wParam, LPARAM lParam)
{
	CMFCPropertyGridProperty * prop = (CMFCPropertyGridProperty *)lParam;
	IPropertyObj * obj = xRenderSetting::Instance();

	const char * name = prop->GetName();

	const Property * p = obj->GetProperty(name);

	if (p)
	{
		char cdata[128];
		const COleVariant & strValue = prop->GetValue();
		CString val = (CString)strValue;

		Strcpy(cdata, 128, (const char *)val);

		if (p->type == PT_Bool)
		{
			bool bdata = (strValue.boolVal == -1);
			obj->SetPropertyData(p, &bdata);
		}
		else if (p->type == PT_Int && p->enumObj)
		{
			const cEnum * e = p->enumObj->GetEnum(cdata);
			obj->SetPropertyData(p, &e->val);
		}
	}


	return S_OK;
}
STDMETHODIMP CPigMissionParams::put_GameName(BSTR bstrGameName)
{
	XLock lock(this);
	USES_CONVERSION;
	Strcpy(m_mp.strGameName,OLE2A(bstrGameName));
	return S_OK;
}
Esempio n. 18
0
/*
outrip(winid, int)
	    -- The tombstone code.  If you want the traditional code use
	       genl_outrip for the value and check the #if in rip.c.
*/
void gnome_outrip(winid wid, int how)
{
    /* Follows roughly the same algorithm as genl_outrip() */
    char buf[BUFSZ];
    char ripString[BUFSZ]="\0";
    extern const char *killed_by_prefix[];

    /* Put name on stone */
    Sprintf(buf, "%s\n", plname);
    Strcat(ripString, buf);

    /* Put $ on stone */
    Sprintf(buf, "%ld Au\n",
#ifndef GOLDOBJ
            u.ugold);
#else
            done_money);
#endif
    Strcat(ripString, buf);

    /* Put together death description */
    switch (killer_format) {
    default:
        impossible("bad killer format?");
    case KILLED_BY_AN:
        Strcpy(buf, killed_by_prefix[how]);
        Strcat(buf, an(killer));
        break;
    case KILLED_BY:
        Strcpy(buf, killed_by_prefix[how]);
        Strcat(buf, killer);
        break;
    case NO_KILLER_PREFIX:
        Strcpy(buf, killer);
        break;
    }
    /* Put death type on stone */
    Strcat(ripString, buf);
    Strcat(ripString, "\n");

    /* Put year on stone */
    Sprintf(buf, "%4d\n", getyear());
    Strcat(ripString, buf);

    ghack_text_window_rip_string( ripString);
}
Esempio n. 19
0
Bool	EnumCtrl::Optimise(int breakeven)
{
    int	usemax=sillymax;
    if (sillymax>4*max)
        usemax=max;
    else
        max=usemax;
    if (arr)
        return TRUE;
    int	totelts=0;
    int	lastval=0x80000000;
    for (enumlinkelt* t2=links; t2; t2=t2->next)
    {
//		if (t2->value==lastval)
        //		return FALSE;
        totelts++;
        //	lastval=t2->value;
    }
    if (usemax-min>40000000 || totelts*100<(usemax-min)*breakeven)
        return (FALSE);
    arr=new enumarrelt[1+usemax-min];
    lastval=min;
    arr[0].name[0]=0;
    if (usemax==sillymax)
        for (enumlinkelt* t2=links; t2; t2=t2->next)
        {
            while (lastval<t2->value)
                arr[(lastval++)-min].name[0]=0;
            if (t2->value==lastval)
                Strcpy(arr[(lastval++)-min].name,t2->name);//,enumeltnamelen);
            else if	(links==NULL)
                return(FALSE);
        }
    else
        for (enumlinkelt* t2=links,*t3=t2->next; t3; t3=(t2=t3)->next)
        {
            while (lastval<t2->value)
                arr[(lastval++)-min].name[0]=0;
            if (t2->value==lastval)
                Strcpy(arr[(lastval++)-min].name,t2->name);//,enumeltnamelen);
        }

    delete links;
    links=NULL;
    return TRUE;
}
Esempio n. 20
0
/*
 * This routine takes the current input command line "line" and
 * searches for any possible macro declarations.  These are
 * present in the line as "$#" where '#' is a single digit
 * number from 0 to 9.  If a macro argument is found, it is
 * either substituted with the value on the same line as the
 * macro call (if it was present) or silently replaced with an
 * empty string.
 *
 * The user order of macro substitutions runs from the 1st to 9th
 * and then the 0th value.  Internally, the array runs from 0 to 9.
 * Thus, when a macro argument is found, it's integer value
 * will need to be shifted to account for the difference.  This
 * is done with a simple mod operation:
 * Internal order is: $0, $1, ..., $8, $9;
 * User sees order as: $1, $2, ..., $9, $0.
 *
 * This routine uses the input string "string" to copy the argument
 * substituted line into, so make sure it is large enough to hold
 * everything!  Also, this function returns a pointer to "string"
 * in the same fashion as strcpy().  There is no check to make sure
 * that the size of macarg[] is sufficient to cover all input
 * arguments.  This is a quiet assumption.  Also, macarg should
 * be declared "const char *macarg[]" but because it is a pointer to
 * an open array, I have trouble doing this.
 *
 */
static char *domacsubs(char *string, const char *line, char *macarg[])
{
    register int j, k;
    register char *s, *ptr, *arg;

    if (Strchr(line, '$') == (char *)NULL) {   /* No arguments to sub. */
      (void)Strcpy(string, line);     /* Simply return a copy of line. */
    } else {
      s = (char *)line;
      ptr = string;
      while (*s) {                      /* Parse through input string. */
        if (*s != '$') {                /* If not special character... */
          *ptr++ = *s++;                /* ...copy regular characters; */
        } else {                /* otherwise, get the argument number. */
          j = (*(s+1)) - '0';      /* Convert next char to an integer. */
          if ((j < 0) || (j > 9)) {       /* Not a macro substitution. */
            *ptr++ = *s++;                      /* Just a regular '$'. */
          } else {
#if 1
            if ( *(s+2) ) {             /* see if next char */
                k = *(s+2) - '0';       /* is a digit */
                if (k>=0 && k<=9) {     /* and if so */
                    j = j*10 + k;       /* allow two digit parameters */
                    k = 1;              /* remember we had 2 digits */
                } else
                    k = 0;
            } else 
                k = 0;
            if (j >= MAXARG) {
                wipoutput(stderr, "$%d too large a reference\n",j);
                return NULL;
            }
            j = (j==0 ? 9 : j-1);
#else
            j = (j + 9) % 10;       /* This is where order is shifted. */
            k = 0;
#endif
            /*
             *  If the macro argument is not present, then quietly
             *  skip over the request.  If it is present (macarg[j]
             *  != Null), then substitute the argument value now.
             */
            if (macarg[j] != Null) {     /* If a value exists, then... */
              arg = (char *)macarg[j];  /* ...substitute the argument. */
              while (*arg)
                *ptr++ = *arg++;
            }
            s++;                                 /* Skip over the '$'. */
            s++;                                 /* Skip over the '#'. */
            if (k) s++;                     /* and one more if needed. */
          }                           /* If (0 <= j <= 9) conditional. */
        }                               /* If (*s != '$') conditional. */
      }                                            /* While (*s) loop. */
      *ptr = Null;                   /* Make sure it ends with a Null. */
    }                               /* if (!Strchr(line, '$')) branch. */

    return(string);
}
Esempio n. 21
0
AL_PROTO ALName::ALName( const ALName AL_DLL_FAR &rhs )
     : mCase( rhs.mCase )
{
     const char *s = rhs.GetSafeName();
     mszName = new AL_DLL_FAR char[ strlen( s ) + 1 ];
     if ( mszName )
          Strcpy( s );
     mszOldName = 0;
}
Esempio n. 22
0
/* TODO: This is in the wrong place. */
void
get_playerrank(char *rank)
{
    char buf[BUFSZ];
    if (Upolyd) {
        int k = 0;

        Strcpy(buf, mons[u.umonnum].mname);
        while(buf[k] != 0) {
            if ((k == 0 || (k > 0 && buf[k-1] == ' ')) &&
                'a' <= buf[k] && buf[k] <= 'z')
                buf[k] += 'A' - 'a';
            k++;
        }
        Strcpy(rank, buf);
    } else
        Strcpy(rank, rank_of(u.ulevel, Role_switch, flags.female));
}
Esempio n. 23
0
STDMETHODIMP CShareOverlay::GetOverlayInfo( LPWSTR pwszIconFile, int cchMax, int * pIndex, DWORD * pdwFlags )
{
	Strcpy(pwszIconFile,cchMax,s_IconPath);
	*pIndex=s_Index;
	*pdwFlags=ISIOI_ICONFILE;
	if (s_Index)
		*pdwFlags|=ISIOI_ICONINDEX;
	return S_OK;
}
Esempio n. 24
0
AL_PROTO ALName::ALName( const char AL_DLL_FAR *s /* = "" */, 
                         ALCase name_case /* = AL_MIXED */ )
     : mCase( name_case )
{
    mszName = new AL_DLL_FAR char[ strlen( s ) + 1 ];
    if ( mszName )
        Strcpy( s );
     mszOldName = 0;
}
Esempio n. 25
0
void
rechist(void)
{
    Char buf[BUFSIZE], hbuf[BUFSIZE], *hfile;
    int fp, ftmp, oldidfds;
    struct varent *shist;

    if (!fast) {
	/*
	 * If $savehist is just set, we use the value of $history
	 * else we use the value in $savehist
	 */
	if ((shist = adrof(STRsavehist)) != NULL) {
	    if (shist->vec[0][0] != '\0')
		(void)Strcpy(hbuf, shist->vec[0]);
	    else if ((shist = adrof(STRhistory)) && shist->vec[0][0] != '\0')
		(void)Strcpy(hbuf, shist->vec[0]);
	    else
		return;
	}
	else
  	    return;

  	if ((hfile = value(STRhistfile)) == STRNULL) {
  	    hfile = Strcpy(buf, value(STRhome));
  	    (void) Strcat(buf, STRsldthist);
  	}

  	if ((fp = open(short2str(hfile), O_WRONLY | O_CREAT | O_TRUNC,
	    0600)) == -1) 
  	    return;

	oldidfds = didfds;
	didfds = 0;
	ftmp = SHOUT;
	SHOUT = fp;
	dumphist[2] = hbuf;
	dohist(dumphist, NULL);
	SHOUT = ftmp;
	(void)close(fp);
	didfds = oldidfds;
    }
}
Esempio n. 26
0
void CLobbyApp::SendGameInfoToAz()
{
	//Imago 9/14
	if (m_fmServers.GetConnections()->GetCount() > 0) {
		int offset = 0;
		char * PostData = new char[BUFFSIZE];
		ZeroMemory(PostData, BUFFSIZE);
		ListConnections::Iterator iterCnxn(*m_fmServers.GetConnections());
		while (!iterCnxn.End()) {
			CFLServer * pServerT = CFLServer::FromConnection(*iterCnxn.Value());
			MissionList::Iterator iterMission(*pServerT->GetMissions());
			while (!iterMission.End()){
				CFLMission* mission = iterMission.Value();
				FMD_LS_LOBBYMISSIONINFO *info = mission->GetMissionInfo();
				if (info) {
					memcpy(PostData + offset, info, info->cbmsg);
					offset += info->cbmsg;
					iterMission.Next();
				}
			}
			iterCnxn.Next();
		}
		if (offset > 0) {
			pHTTP settings;
			Strcpy(settings.hdrs, "Content-Type: application/octet-stream\r\n");
			Strcpy(settings.verb, "POST");
			Strcpy(settings.uri, "/lobbyinfo.ashx");
			Strcpy(settings.host, "allegiancezone.com"); 
			ZeroMemory(settings.data, BUFFSIZE);
			memcpy(settings.data, PostData, offset);
			settings.size = offset;
			DWORD lpExitCode;
			GetExitCodeThread(m_threadPost, &lpExitCode);
			if (lpExitCode != STILL_ACTIVE) {
				debugf("Creating post thread.\n");
				DWORD dum;
				m_threadPost = CreateThread(NULL, 0, PostThread, (void*)&settings, 0, &dum);
			}
			else
				debugf("Post thread was still running...\n");
		}
	}
}
Esempio n. 27
0
// BT 7/15 - Enable Server to be hosted on same subnet as lobby on inside LAN.
HRESULT CLobbyApp::GetIPAddressFromDPlayOrServerIPAddressOverride(CFMConnection &cnxn, CFLServer * pServerT, char * szRemoteAddress)
{
	char * szServerAddressOverride = pServerT->GetServerIPOverride();
	if (szServerAddressOverride != NULL && strlen(szServerAddressOverride) > 0)
		Strcpy(szRemoteAddress, szServerAddressOverride);
	else
		GetFMServers().GetIPAddress(cnxn, szRemoteAddress);

	return S_OK;
}
Esempio n. 28
0
/*  Returns 0 on success; 1 on error. */
int wipcommand(const char *command)
{
    char outbuf[BUFSIZ];

    Strcpy(outbuf, command);
    if (System(outbuf)) {
        wipoutput(stderr, "Error sending command:\n%s\n", command);
        return(1);
    }
    return(0);
}
Esempio n. 29
0
int CLobbyApp::OnMessageBox(const char * strText, const char * strCaption, UINT nType)
{
  char sz[256];
  if (strCaption && *strCaption)
  {
    Strcpy(sz, strCaption);
    Strcat(sz, ": ");
  }
  Strcat(sz, strText);
  return m_plas->LogEvent(EVENTLOG_ERROR_TYPE, LE_ODBC_Error, strText);
}
Esempio n. 30
0
void
init_dungeon()
{
	if(++n_dgns > MAXDUNGEON) {
	    (void) fprintf(stderr, "FATAL - Too many dungeons (limit: %d).\n",
		    MAXDUNGEON);
	    (void) fprintf(stderr, "To increase the limit edit MAXDUNGEON in global.h\n");
	    exit(EXIT_FAILURE);
	}

	in_dungeon = 1;
	tmpdungeon[n_dgns].lev.base = 0;
	tmpdungeon[n_dgns].lev.rand = 0;
	tmpdungeon[n_dgns].chance = 100;
	Strcpy(tmpdungeon[n_dgns].name, "");
	Strcpy(tmpdungeon[n_dgns].protoname, "");
	tmpdungeon[n_dgns].flags = 0;
	tmpdungeon[n_dgns].levels = 0;
	tmpdungeon[n_dgns].branches = 0;
}