1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It contains source for the ZMakeZcode function.
4 * Created by: Jeffrey Hutzelman
8 * Copyright (c) 1987, 2002 by the Massachusetts Institute of Technology.
9 * For copying and distribution information, see the file
17 static const char rcsid_ZMakeZcode_c[] = "$Id$";
20 Code_t ZMakeZcode32(ptr, len, val)
26 buf[0] = (val >> 24) & 0xff;
27 buf[1] = (val >> 16) & 0xff;
28 buf[2] = (val >> 8) & 0xff;
30 return ZMakeZcode(ptr, len, buf, 4);
33 Code_t ZMakeZcode(ptr, len, field, num)
42 * This optimistic check lets us discover quickly if the buffer
43 * is not even large enough to hold the field without escapes.
44 * It also insures we'll have space for the leading 'Z' and the
45 * trailing NUL. Note that this does _not_ remove the need for
46 * checking length as we encode.