示例#1
0
/*
 * Set status of entry/binfmt_misc:
 * '1' enables, '0' disables and '-1' clears entry/binfmt_misc
 */
static int proc_write_status(struct file *file, const char *buffer,
			     unsigned long count, void *data)
{
	struct binfmt_entry *e;
	int res = count;

	if (buffer[count-1] == '\n')
		count--;
	if ((count == 1) && !(buffer[0] & ~('0' | '1'))) {
		if (data) {
			if ((e = get_entry((long) data)))
				e->flags = (e->flags & ~ENTRY_ENABLED)
					    | (int)(buffer[0] - '0');
			put_entry(e);
		} else {
			enabled = buffer[0] - '0';
		}
	} else if ((count == 2) && (buffer[0] == '-') && (buffer[1] == '1')) {
		if (data)
			clear_entry((long) data);
		else
			clear_entries();
	} else {
		res = -EINVAL;
	}
	return res;
}
static void
icon_press_cb (GtkEntry       *entry,
               gint            position,
               GdkEventButton *event,
               gpointer        data)
{
  if (position == GTK_ENTRY_ICON_PRIMARY)
    gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
                    event->button, event->time);
  else
    clear_entry (entry);
}
示例#3
0
static void clear_response(ocsp_response* response) {
	gnutls_free(response->resp_data.data);
	gnutls_ocsp_resp_deinit(response->resp);
	if (NULL != response->certificates) {
		guint i;
		for (i = 0; i < response->certificates->len; ++i) {
			ocsp_response_cert_entry* entry = &g_array_index(response->certificates, ocsp_response_cert_entry, i);
			clear_entry(entry);
		}
		g_array_free(response->certificates, TRUE);
	}
	memset(response, 0, sizeof(*response));
}
示例#4
0
文件: iproute.c 项目: blex/bxvrrpd
void rt_clear(struct rt_entry *lstentry)
{
	while (lstentry)
		lstentry = clear_entry(lstentry);
}
示例#5
0
文件: sslTunnel.c 项目: ic-hep/emi3
int eInit(int fd)
{
	SSL             *ssl_con;

	int ret;
	SSL_CTX        *ssl_ctx;
	user_entry *en;

	if(!initialized) {
		SSL_library_init();
		SSLeay_add_ssl_algorithms();
		SSL_load_error_strings();

		++initialized;
	}

	ssl_ctx = SSL_CTX_new(TLSv1_client_method());
	ssl_con = (SSL *) SSL_new(ssl_ctx);

	ret = SSL_set_fd(ssl_con, fd);
	SSL_set_connect_state(ssl_con);

	ret = SSL_connect(ssl_con);

	ret =  SSL_get_error(ssl_con, ret);

	if(ret != SSL_ERROR_NONE) {

		switch (ret) {
			case SSL_ERROR_NONE :
				printf("SSL_ERROR_NONE.\n");
				break;
			case SSL_ERROR_SSL :
				printf("SSL_ERROR_SSL.\n");
				break;
			case SSL_ERROR_WANT_READ:
				printf("SSL_ERROR_WANT_READ.\n");
				break;
			case SSL_ERROR_WANT_WRITE:
				printf("SSL_ERROR_WANT_WRITE.\n");
				break;
			case SSL_ERROR_WANT_X509_LOOKUP :
				printf("SSL_ERROR_WANT_X509_LOOKUP.\n");
				break;
			case SSL_ERROR_SYSCALL:
				printf("SSL_ERROR_SYSCALL.\n");
				break;
			case SSL_ERROR_ZERO_RETURN :
				printf("SSL_ERROR_ZERO_RETURN.\n");
				break;
			case SSL_ERROR_WANT_CONNECT :
				printf("SSL_ERROR_WANT_CONNECT.\n");
				break;
			default:
				printf("Unknow error.\n");
		}

		ERR_print_errors_fp(stderr);
		return -1;
	}

	set_SSL_map(fd, ssl_con);

	en = getUserEntry();

	SSL_write(ssl_con, "Auth Protocol V#1.0 auth=" , 25);
	SSL_write(ssl_con, en->login , strlen(en->login));
	SSL_write(ssl_con, ":" , 1);
	SSL_write(ssl_con, en->passwd , strlen(en->passwd));
	SSL_write(ssl_con, "\n" , 1);
	clear_entry(en);
	return 0;
}
示例#6
0
文件: symbol.c 项目: zevlg/eukleides
void clear_table(void)
{
    _symbol *entry;

    while ((entry = pop_symbol())) clear_entry(entry);
}
示例#7
0
文件: dict.c 项目: Uyouii/dict
int main()
{
	int driver=0, mode=VESA_800x600x8bit;
	int yes; 
	int i=0;
	int t=0;
	int style1=-1,style2=-1;
	char c;
	int n;
	int eee=0;

	initgraph(&driver, &mode, "");
	mydict();
	outtextxy(0,580,"Search:");
	
	while(strcmp(str,"exit")!=0&&strcmp(str,"quit")!=0)
	{
		num=0;
		clear_entry(str);
		if(eee==0)
		{
			t=bioskey(0);
		}
		eee=0;
		while(t!=Enter||num==0)
		{
			if(((char)t>=32&&(char)t<=126)||t==Bspace||t==ESC) 
			{
				if(t==Bspace)
				{
					if( num>0 ){
						num--;
						str[num] = '\0';
					}
				}
				else
				{
					if(t!=Enter)
					{
						c=t&0XFF;
						str[num++]=c;
						str[num] = '\0';
					}
				}
				if(t==ESC)
				{
					clear_entry(str);
					num=0;
				}
				input_entry();
				t=bioskey(0);
				
				if(num>=20)
				{
					clear_entry(str);
					num=0;
				}
			}
			else t=bioskey(0);
		}
		clear_translation();
		
		n=strlen(str);
		
		style1=-1;style2=-1;
		for(i=0;i<n;i++)
		{
			if(str[i]=='*'&&i<n) 	style1=i; 
			if(str[i]=='?'&&i<n) 	style2=i;
		}
		if(style1>0||style2>0)
		{
			search(str);
			if(count!=0) put_list();
		}
		
		show_translation(str);
			
		if(record>0) total=2;
		else total=1;
		show_page();
		if(record>0)
		{
			eee=1;
			t=bioskey(0);
			while(t==LEFT||t==RIGHT||t==DOWN||t==UP)
			{
				if(page==1&&(t==RIGHT||t==DOWN))
				{
					clear_translation();
					page++;
					copy_example( example, example2, record);
					put_translation2(example2);
					show_page();
				}
				if(page==2&&(t==LEFT||t==UP))
				{
					clear_translation();
					page--;
					show_translation(str);
					show_page();
				}
				t=bioskey(0);
			}	
		}
		for(i=0;i<2000;i++)
		{
			translation[i]=0;
			example[i]=0;
			example2[i]=0;
		}
		page=1;
		record=0;
	}
	closegraph();
	return 0; 
}