1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It contains functions for general use within the Zephyr server.
4 * Created by: John T. Kohl
8 * Copyright (c) 1987 by the Massachusetts Institute of Technology.
9 * For copying and distribution information, see the file
13 #include <zephyr/mit-copyright.h>
18 static const char rcsid_common_c[] =
23 /* common routines for the server */
25 /* copy a string into a newly allocated area */
33 ret = (char *) malloc(strlen(sp) + 1);
35 syslog(LOG_CRIT, "no mem strdup'ing");
42 /* The "& 0x5f" provides case-insensitivity for ASCII. */
48 unsigned long hval = 0;
60 hval += (cp & 0x5f) * (3 + (1 << 16));
65 hval += (cp & 0x5f) * (1 + (1 << 8));
70 hval += (cp & 0x5f) * (1 + (1 << 12));
75 hval += (cp & 0x5f) * (1 + (1 << 4));
77 hval += ((long) hval) >> 18;
84 /* Output a name, replacing newlines with \n and single quotes with \q. */
85 void dump_quote(p, fp)
93 } else if (*p == '\n') {