예제 #1
0
파일: server.c 프로젝트: jdigittl/Smunge
mailboxT	*add_user_mailbox (userT *user, char *hostname, struct hostent *host, int port, char *alt_username)
{
	int		n;
	
	if (host == NULL)
	{
		// Need to lookup the stuffs
		// 
		
		host = gethostbyjosh (hostname);	
	}

	n = user->mailboxes++;
	user->mailbox[n].username[0] = '\0';
	user->mailbox[n].host = host;
	strncpy (user->mailbox[n].hostname, hostname, MAX_HOSTNAME-1);
	user->mailbox[n].port = port;
	user->mailbox[n].up_to_date = 0;
	user->mailbox[n].messages = 0;
	user->mailbox[n].total_size = 0;
	user->mailbox[n].fd = -1;
	user->mailbox[n].message = NULL;

	if (alt_username != NULL)
	{
		strncpy (user->mailbox[n].username, alt_username, MAX_USERPASS-1);
	}

	if (SMUNGE_UIDL > 0)
	{
		char	str[MAX_HOSTNAME+8];

		if (alt_username != NULL)
		{
			snprintf (str, MAX_HOSTNAME+7, "%s%d%s", hostname, port, alt_username);
		} else		
		{
			snprintf (str, MAX_HOSTNAME+7, "%s%d", hostname, port);
		}

		my_hash (str, user->mailbox[n].uidl_hash, 2);
	}

	return (&user->mailbox[n]);
}
예제 #2
0
 static size_t hash(const Kmer& a) { return my_hash(a); }
예제 #3
0
파일: hash.c 프로젝트: cyruserfani/programs
int hash_func(hash_t hash, hash_element_t e){
	return my_hash(hash->size, e);
}