当前位置: 首页>>代码示例>>C++>>正文


C++ CopyStr函数代码示例

本文整理汇总了C++中CopyStr函数的典型用法代码示例。如果您正苦于以下问题:C++ CopyStr函数的具体用法?C++ CopyStr怎么用?C++ CopyStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CopyStr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CedarLog

// Write a message into Cedar log
void CedarLog(char *str)
{
	char *tmp;
	// Validate arguments
	if (str == NULL)
	{
		return;
	}
	if (cedar_log_ref == NULL)
	{
		return;
	}

	tmp = CopyStr(str);

	if (StrLen(tmp) > 1)
	{
		if (tmp[StrLen(tmp) - 1] == '\n')
		{
			tmp[StrLen(tmp) - 1] = 0;
		}
		if (StrLen(tmp) > 1)
		{
			if (tmp[StrLen(tmp) - 1] == '\r')
			{
				tmp[StrLen(tmp) - 1] = 0;
			}
		}
	}

	InsertStringRecord(cedar_log, tmp);

	Free(tmp);
}
开发者ID:holoreimu,项目名称:SoftEtherVPN,代码行数:35,代码来源:Cedar.c

示例2: IDriveRenameFile

int IDriveRenameFile(TFileStore *FS, char *FromArg, char *ToArg)
{
char *Tempstr=NULL, *Error=NULL, *FromPath=NULL, *ToPath=NULL;
HTTPInfoStruct *Info;
ListNode *Headers;
int result, val;
STREAM *S;


FromPath=MakeFullPath(FromPath,FS, FromArg);
ToPath=MakeFullPath(ToPath,FS, ToArg);

Tempstr=MCopyStr(Tempstr,"https://",FS->Host,"/evs/renameFileFolder?uid=",FS->Logon,"&pwd=",FS->Passwd,"&oldpath=",FromPath,"&newpath=",ToPath,NULL);
S=HTTPMethod("POST",Tempstr,"","","","",0);

val=HTTPReadDocument(S, &Tempstr);
if (Settings.Flags & FLAG_VERBOSE) printf("\n%s\n",Tempstr);

Error=CopyStr(Error,"");
result=IDriveParseStatusResponse(Tempstr, &Error);

DestroyString(Tempstr);
DestroyString(Error);
DestroyString(FromPath);
DestroyString(ToPath);


return(result);
}
开发者ID:ColumPaget,项目名称:FileFerry,代码行数:29,代码来源:idrive.c

示例3: PAMConvFunc

int PAMConvFunc(int NoOfMessages, const struct pam_message **messages, 
         struct pam_response **responses, void *appdata)
{
int count;
const struct pam_message *mess;
struct pam_response *resp;

*responses=(struct pam_response *) calloc(NoOfMessages,sizeof(struct pam_response));

mess=*messages;
resp=*responses;

for (count=0; count < NoOfMessages; count++)
{
if ((mess->msg_style==PAM_PROMPT_ECHO_OFF) ||
    (mess->msg_style==PAM_PROMPT_ECHO_ON))
    {
      resp->resp=CopyStr(NULL,(char *) appdata); 
      resp->resp_retcode=0;
    }
mess++;
resp++;
}

return(PAM_SUCCESS);
}
开发者ID:ColumPaget,项目名称:MetaFTPD,代码行数:26,代码来源:Authenticate.c

示例4:

char *FormatURL(char *Buff, HTTPSession *Session, const char *ItemPath)
{
char *Tempstr=NULL, *Quoted=NULL;
const char *ptr=NULL, *sd_ptr;
int len;

if (StrLen(Session->Host))
{
if (Settings.Flags & FLAG_SSL) Tempstr=MCopyStr(Buff,"https://",Session->Host,"/",NULL);
else Tempstr=MCopyStr(Buff,"http://",Session->Host,"/",NULL);
}
else Tempstr=CopyStr(Tempstr,"/");

ptr=ItemPath;
while (*ptr == '/') ptr++;

if (StrLen(Session->StartDir)) sd_ptr=Session->StartDir;
else sd_ptr="";

while (*sd_ptr == '/') sd_ptr++;

len=StrLen(sd_ptr);

if (strncmp(ptr, sd_ptr,len)==0) ptr+=len;
Quoted=HTTPQuoteChars(Quoted,ptr," ()[]{}\t?&%!,+\':;#");

Tempstr=CatStr(Tempstr,Quoted);

DestroyString(Quoted);
return(Tempstr);
}
开发者ID:ColumPaget,项目名称:Alaya,代码行数:31,代码来源:common.c

示例5: NewListFast

// Get Ethernet device list on Solaris
TOKEN_LIST *GetEthListSolaris()
{
	TOKEN_LIST *t;
	int i, s;
	LIST *o;


	o = NewListFast(CompareStr);
	s = socket(AF_INET, SOCK_DGRAM, 0);
	if (s != INVALID_SOCKET)
	{
		struct lifnum lifn;
		lifn.lifn_family = AF_INET;
		lifn.lifn_flags = 0;
		if (ioctl(s, SIOCGLIFNUM, (char *)&lifn) >= 0)
		{
			struct lifconf lifc;
			struct lifreq *buf;
			UINT numifs;
			UINT bufsize;
			
			numifs = lifn.lifn_count;
			Debug("NumIFs:%d\n",numifs);
			bufsize = numifs * sizeof(struct lifreq);
			buf = Malloc(bufsize);

			lifc.lifc_family = AF_INET;
			lifc.lifc_flags = 0;
			lifc.lifc_len = bufsize;
			lifc.lifc_buf = (char*) buf;
			if (ioctl(s, SIOCGLIFCONF, (char *)&lifc) >= 0)
			{
				for (i = 0; i<numifs; i++)
				{
					if(StartWith(buf[i].lifr_name, "lo") == false){
						Add(o, CopyStr(buf[i].lifr_name));
					}
				}
			}
			Free(buf);
		}
		closesocket(s);
	}

	Sort(o);

	t = ZeroMalloc(sizeof(TOKEN_LIST));
	t->NumTokens = LIST_NUM(o);
	t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens);

	for (i = 0;i < LIST_NUM(o);i++)
	{
		char *name = LIST_DATA(o, i);
		t->Token[i] = name;
	}

	ReleaseList(o);

	return t;
}
开发者ID:AlexeyBychkov,项目名称:SoftEtherVPN,代码行数:61,代码来源:BridgeUnix.c

示例6: HTTPServerFindAndSendDocument

void HTTPServerFindAndSendDocument(STREAM *S, HTTPSession *Session, int Flags)
{
char *Path=NULL, *ptr;
TPathItem *PI=NULL;
ListNode *Curr;

	if (! VPathProcess(S, Session, Flags))
  {
    ptr=Session->StartDir;
    if (*ptr=='.') ptr++;
    if (strcmp(ptr,"/")==0) Path=CopyStr(Path,Session->Path);
    else Path=MCopyStr(Path,ptr,Session->Path,NULL);

		PI=VPathFind(PATHTYPE_FILETYPE, Session->Path);
		if (PI)
		{
			if (PI->Flags & PATHITEM_COMPRESS) Session->Flags |= FLAG_COMPRESS;
			if (PI->Flags & PATHITEM_NO_COMPRESS) Session->Flags &= ~FLAG_COMPRESS;
			if (PI->CacheTime > 0) Session->CacheTime=PI->CacheTime;
		}

		//One day we will be able to handle scripts inside of chroot using embedded
		//scripting. But not today.
		// if (PI && (PI->Flags & PATHITEM_EXEC)) HTTPServerExecCGI(S, Session, Path);
    //else 
		HTTPServerSendDocument(S, Session, Path, Flags);
  }
DestroyString(Path);
}
开发者ID:ColumPaget,项目名称:Alaya,代码行数:29,代码来源:server.c

示例7: ZeroMalloc

// Create new user object
USER *NewUser(char *name, wchar_t *realname, wchar_t *note, UINT authtype, void *authdata)
{
	USER *u;
	// Validate arguments
	if (name == NULL || realname == NULL || note == NULL)
	{
		return NULL;
	}
	if (authtype != AUTHTYPE_ANONYMOUS && authdata == NULL)
	{
		return NULL;
	}

	u = ZeroMalloc(sizeof(USER));
	u->lock = NewLock();
	u->ref = NewRef();
	u->Name = CopyStr(name);
	u->RealName = CopyUniStr(realname);
	u->Note = CopyUniStr(note);
	u->GroupName = NULL;
	u->Group = NULL;
	u->AuthType = authtype;
	u->AuthData = authdata;
	u->CreatedTime = SystemTime64();
	u->UpdatedTime = SystemTime64();

	u->Policy = NULL;
	u->Traffic = NewTraffic();

	return u;
}
开发者ID:SoftEtherVPN,项目名称:SoftEtherVPN,代码行数:32,代码来源:Account.c

示例8: switch

TFingerprint *CheckForMatch(HashratCtx *Ctx, const char *Path, struct stat *FStat, const char *HashStr)
{
TFingerprint *Lookup, *Head=NULL, *Prev=NULL, *Item=NULL, *Result=NULL;
void *ptr;

if (! StrValid(Path)) return(NULL);

Lookup=TFingerprintCreate(HashStr,"","",Path);
switch (Ctx->Action)
{
	case ACT_FINDMATCHES_MEMCACHED:
	Lookup->Data=MemcachedGet(Lookup->Data, Lookup->Hash);
	if (StrValid(Lookup->Data)) Result=TFingerprintCreate(Lookup->Hash, Lookup->HashType, Lookup->Data, "");
	break;

	case ACT_FINDDUPLICATES:
	case ACT_FINDMATCHES:
	ptr=tfind(Lookup, &Tree, MatchCompareFunc);
	if (ptr)
	{
	Item=*(TFingerprint **) ptr;

	//we have to make a copy because 'Result' is destroyed by parent function
	Result=TFingerprintCreate(Item->Hash, Item->HashType, Item->Data, Item->Path);
	}
	break;

	default:
	ptr=tfind(Lookup, &Tree, MatchCompareFunc);
	if (ptr) 
	{
		Item=FindPathMatches(Ctx, *(TFingerprint **) ptr, Path);
		if (Item) 
		{
		Result=TFingerprintCreate(Item->Hash, Item->HashType, Item->Data, Item->Path);
		if (Ctx->Action==ACT_CHECK)
		{
			if (Item==Head) 
			{
				if (Item->Next==NULL) 
				{
					// tree functions take a copy of the 'head' item, so we cannot
					// destroy it. No idea how they do this, it's magic
					// however we can destroy non-head items that we hang off
					// the tree
					tdelete(Lookup, &Tree, MatchCompareFunc);
				}
				else Item->Path=CopyStr(Item->Path, "");
			}
			//else TFingerprintDestroy(Item);
		}
		}
	}
	break;
}

TFingerprintDestroy(Lookup);

return(Result);
}
开发者ID:ColumPaget,项目名称:Hashrat,代码行数:60,代码来源:find.c

示例9: AuthPAM

int AuthPAM(TSession *Session)
{
int result;

AuthenticationsTried=CatStr(AuthenticationsTried,"pam ");


if(! PAMStart(Session, Session->User))
	{
		LogToFile(Settings.ServerLogPath,"PAM: No such user %s",Session->User);
  	return(USER_UNKNOWN);
	}

/* set the credentials for the remote user and remote host */

result=pam_authenticate(pamh,0);


if (result==PAM_SUCCESS)
{
	Session->Flags |= SESSION_PAM;
	Session->RealUser=CopyStr(Session->RealUser,Session->User);
	return(TRUE);
}
else return(FALSE);
}
开发者ID:ColumPaget,项目名称:MetaFTPD,代码行数:26,代码来源:Authenticate.c

示例10: IDriveOpen

int IDriveOpen(TFileStore *FS)
{
char *Tempstr=NULL, *TagName=NULL, *TagData=NULL, *ptr;
ListNode *Vars;
STREAM *S;
int result=FALSE;

if (! FS) 
{
return(FALSE);
}

//Always require login for IDrive
if (! StrLen(FS->Passwd)) RequestAuthDetails(&FS->Logon,&FS->Passwd);

time(&StartTime);
HTTPSetFlags(HTTP_NODECODE);

//Get Address of the server that stores my data

FS->CurrDir=CopyStr(FS->CurrDir,"/");
if (StrLen(FS->InitDir)) FS->ChDir(FS,FS->InitDir);

Tempstr=MCopyStr(Tempstr,"https://evs.idrive.com/evs/getServerAddress?uid=",FS->Logon,"&pwd=",FS->Passwd,NULL);
S=HTTPMethod("POST",Tempstr,"","","","",0);

if (S)
{
Tempstr=STREAMReadDocument(Tempstr, S, TRUE);

Vars=ListCreate();
IDriveParseResponse(Tempstr, Vars);
FS->Host=CopyStr(FS->Host,GetVar(Vars,"webApiServer"));

PrintConnectionDetails(FS,S);
STREAMClose(S);
result=TRUE;
}


ListDestroy(Vars,DestroyString);
DestroyString(Tempstr);
DestroyString(TagData);
DestroyString(TagName);

return(result);
}
开发者ID:ColumPaget,项目名称:FileFerry,代码行数:47,代码来源:idrive.c

示例11: NullToken

// Cut out the token from the string (not ignore the blanks between delimiters)
TOKEN_LIST *ParseTokenWithNullStr(char *str, char *split_chars)
{
	LIST *o;
	UINT i, len;
	BUF *b;
	char zero = 0;
	TOKEN_LIST *t;
	// Validate arguments
	if (str == NULL)
	{
		return NullToken();
	}
	if (split_chars == NULL)
	{
		split_chars = DefaultTokenSplitChars();
	}

	b = NewBuf();
	o = NewListFast(NULL);

	len = StrLen(str);

	for (i = 0;i < (len + 1);i++)
	{
		char c = str[i];
		bool flag = IsCharInStr(split_chars, c);

		if (c == '\0')
		{
			flag = true;
		}

		if (flag == false)
		{
			WriteBuf(b, &c, sizeof(char));
		}
		else
		{
			WriteBuf(b, &zero, sizeof(char));

			Insert(o, CopyStr((char *)b->Buf));
			ClearBuf(b);
		}
	}

	t = ZeroMalloc(sizeof(TOKEN_LIST));
	t->NumTokens = LIST_NUM(o);
	t->Token = ZeroMalloc(sizeof(char *) * t->NumTokens);

	for (i = 0;i < t->NumTokens;i++)
	{
		t->Token[i] = LIST_DATA(o, i);
	}

	ReleaseList(o);
	FreeBuf(b);

	return t;
}
开发者ID:SoftEtherVPN,项目名称:SoftEtherVPN,代码行数:60,代码来源:Str.c

示例12: calloc

OAUTH *OAuthCreate(const char *Type, const char *Name, const char *ClientID, const char *ClientSecret, const char *Scopes, const char *RefreshURL)
{
    OAUTH *Ctx;
    char *Tempstr=NULL, *Token=NULL;
    const char *ptr;

    if (OAuthTypes==NULL) SetupOAuthTypes();
    ptr=GetVar(OAuthTypes, Type);
    if (! StrValid(ptr)) return(NULL);

    Ctx=(OAUTH *) calloc(1,sizeof(OAUTH));

    ptr=GetToken(ptr,",",&(Ctx->Stage1), 0);
    ptr=GetToken(ptr,",",&(Ctx->Stage2), 0);
    ptr=GetToken(ptr,",",&(Ctx->VerifyTemplate), 0);
    Ctx->Name=CopyStr(Ctx->Name, Name);
    Ctx->Vars=ListCreate();
    SetVar(Ctx->Vars,"client_name",ClientID);
    SetVar(Ctx->Vars,"client_id",ClientID);
    SetVar(Ctx->Vars,"client_secret",ClientSecret);
    Tempstr=HTTPQuote(Tempstr, Scopes);
    SetVar(Ctx->Vars,"scope",Tempstr);
    SetVar(Ctx->Vars,"redirect_uri","urn:ietf:wg:oauth:2.0:oob");
    SetVar(Ctx->Vars,"connect_back_page","<html><body><h1>Code Accepted By Application</h1><body></html>");
    Ctx->AccessToken=CopyStr(Ctx->AccessToken, "");
    Ctx->RefreshToken=CopyStr(Ctx->RefreshToken, "");
    Ctx->RefreshURL=CopyStr(Ctx->RefreshURL, RefreshURL);
    Ctx->SavePath=MCopyStr(Ctx->SavePath, GetCurrUserHomeDir(), "/.oauth.creds",NULL);

    if (strcasecmp(Type, "getpocket.com")==0)
    {
        ptr=GetToken(ClientID,"-",&Token,0);
        Tempstr=MCopyStr(Tempstr, "pocketapp",Token,":authorizationFinished",NULL);
        SetVar(Ctx->Vars, "redirect_uri",Tempstr);

//Ctx->VerifyURL=MCopyStr(Ctx->VerifyURL,"https://getpocket.com/auth/authorize?request_token=",Ctx->AccessToken,"&redirect_uri=",Args,NULL);
    }
    else if (strcasecmp(Type, "implicit")==0) Ctx->Flags |= OAUTH_IMPLICIT;

    if (! OAuthKeyChain) OAuthKeyChain=ListCreate();
    ListAddNamedItem(OAuthKeyChain, Name, Ctx);

    DestroyString(Tempstr);
    DestroyString(Token);
    return(Ctx);
}
开发者ID:ColumPaget,项目名称:Crayonizer,代码行数:46,代码来源:OAuth.c

示例13: STREAMGetValue

char *LogFileInternalGetRotateDestinationPath(char *RetStr, TLogFile *LogFile)
{
char *Tempstr=NULL;

	Tempstr=CopyStr(Tempstr, STREAMGetValue(LogFile->S,"RotatePath"));
	if (StrLen(Tempstr) && strchr(Tempstr,'$'))
	{
		STREAMSetValue(LogFile->S, "Date",GetDateStr("%Y_%m_%d",NULL));
		STREAMSetValue(LogFile->S, "Time",GetDateStr("%H:%M:%S",NULL));
		RetStr=SubstituteVarsInString(RetStr,Tempstr,LogFile->S->Values,0);
	}
	else RetStr=CopyStr(RetStr,LogFile->Path);

	DestroyString(Tempstr);

return(RetStr);
}
开发者ID:ColumPaget,项目名称:MetaFTPD,代码行数:17,代码来源:Log.c

示例14: calloc

char *GetDefaultUser()
{
char *Possibilities[]={"nobody","daemon","guest",NULL};
TSession *Session;
int i;

Session=(TSession *) calloc(1,sizeof(TSession));

for (i=0; Possibilities[i] !=NULL; i++)
{
	Session->User=CopyStr(Session->User,Possibilities[i]);
	Session->Passwd=CopyStr(Session->Passwd,"");
	if (AuthPasswdFile(Session) != USER_UNKNOWN) break;
} 
    
return(Possibilities[i]);  
}
开发者ID:ColumPaget,项目名称:MetaFTPD,代码行数:17,代码来源:Authenticate.c

示例15: MainFunction

// Main function
void MainFunction(char *cmd)
{
	char tmp[MAX_SIZE];
	bool first = true;
	bool exit_now = false;

	while (true)
	{
		if (first && StrLen(cmd) != 0 && g_memcheck == false)
		{
			first = false;
			StrCpy(tmp, sizeof(tmp), cmd);
			exit_now = true;
			Print("%s\n", cmd);
		}
		else
		{
			_exit(0);
		}
		Trim(tmp);
		if (StrLen(tmp) != 0)
		{
			UINT i, num;
			bool b = false;
			TOKEN_LIST *token = ParseCmdLine(tmp);
			char *cmd = token->Token[0];

			num = sizeof(test_list) / sizeof(TEST_LIST);
			for (i = 0;i < num;i++)
			{
				if (!StrCmpi(test_list[i].command_str, cmd))
				{
					char **arg = Malloc(sizeof(char *) * (token->NumTokens - 1));
					UINT j;
					for (j = 0;j < token->NumTokens - 1;j++)
					{
						arg[j] = CopyStr(token->Token[j + 1]);
					}
					test_list[i].proc(token->NumTokens - 1, arg);
					for (j = 0;j < token->NumTokens - 1;j++)
					{
						Free(arg[j]);
					}
					Free(arg);
					b = true;
					_exit(1);
					break;
				}
			}
			FreeToken(token);

			if (exit_now)
			{
				break;
			}
		}
	}
}
开发者ID:13eatrice,项目名称:SoftEtherVPN,代码行数:59,代码来源:vpndrvinst.c


注:本文中的CopyStr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。