summaryrefslogtreecommitdiff
path: root/send/util.h
blob: 5f1a698688d8496e847ae1b5b4bf21bc146e66f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

static void
warn(const char *msg) {
	if (errno != 0)
		perror(msg);
	else
		fprintf(stderr, "error: %s\n", msg);
}

static void
error(const char *msg) {
	warn(msg);
	exit(1);
}

static int 
make_mhash(char *m) {
	int hash = 0;
	while (*m != 0) {
		hash += *m;
		m++;
	}
	return hash;
}