示例#1
0
void send_dhst(char *filename)
{
	if (dhst_id == -1)
	{
		long	l;

		if (getcookie("DHST", &l))
			dhst_id = (int)l;
		else
			dhst_id = 0;
	}
	if (dhst_id > 0)
	{
		if (dhst == NULL)
		{
			dhst = malloc_global(sizeof(DHSTINFO));
			dhst->appname = malloc_global(4);
			strcpy(dhst->appname, "qed");
			dhst->apppath = malloc_global(strlen(gl_appdir) + strlen("qed.app") + 1);
			strcpy(dhst->apppath, gl_appdir);
			strcat(dhst->apppath, "qed.app");
			dhst->docname = malloc_global(sizeof(FILENAME));
			dhst->docpath = malloc_global(sizeof(PATH));
		}
		split_filename(filename, NULL, dhst->docname);
		strcpy(dhst->docpath, filename);
		
		msgbuff[0] = DHST_ADD;
		*(DHSTINFO **)(msgbuff + 3) = dhst;
		msgbuff[5] = 0;
		msgbuff[6] = 0;
		msgbuff[7] = 0;
		send_msg(dhst_id);
	}
}
示例#2
0
int main(int argc, char* argv[]) {
	char* input = "Gdkkn\x1FGR@\x1FVnqkc";
	size_t strlength = strlen(input);
	char *output = (char*) malloc_global(strlength + 1);
	char *secode = (char*) malloc_global(strlength + 1);
	char *output2 = (char*) malloc_global(strlength + 1);

        SNK_INIT_LPARM(lparm,strlength);
        decode(input,output,lparm);
	output[strlength] = '\0';
	printf("Decoded       :%s\n",output);
        /* Show we can call multiple functions in the .cl file */
        super_encode(output,secode,lparm);
        printf("Super encoded :%s\n",secode);
        super_decode(secode,output2,lparm);
        printf("Super decoded :%s\n",output2);
       /* Show we can call same function multiple times */
        decode(secode,output,lparm);
        decode(output,output2,lparm);
	printf("Decoded twice :%s\n",output2);
	free(output);
	free(secode);
	free(output2);
	return 0;
}
示例#3
0
void init_comm(void)
{
	global_str1 = malloc_global(256);
	global_str2 = malloc_global(256);
	init_av();
	init_se();
	init_olga();
}