|
|
1.1 root 1: /* implode.c - explode ascii into octets */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/compat/RCS/implode.c,v 7.0 89/11/23 21:23:02 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/compat/RCS/implode.c,v 7.0 89/11/23 21:23:02 mrose Rel $
9: *
10: *
11: * $Log: implode.c,v $
12: * Revision 7.0 89/11/23 21:23:02 mrose
13: * Release 6.0
14: *
15: */
16:
17: /*
18: * NOTICE
19: *
20: * Acquisition, use, and distribution of this module and related
21: * materials are subject to the restrictions of a license agreement.
22: * Consult the Preface in the User's Manual for the full terms of
23: * this agreement.
24: *
25: */
26:
27:
28: /* LINTLIBRARY */
29:
30: #include <stdio.h>
31: #include "general.h"
32: #include "manifest.h"
33:
34: /* DATA */
35:
36: static char hex2nib[0x80] = {
37: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
38: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
39: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
40: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
41: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
42: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
43: 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
44: 0x08, 0x09, NULL, NULL, NULL, NULL, NULL, NULL,
45: NULL, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, NULL,
46: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
47: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
48: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
49: NULL, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, NULL,
50: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
51: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
52: NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
53: };
54:
55: /* */
56: int implode (a, b, n)
57: register u_char *a;
58: register char *b;
59: register int n;
60: {
61: register int i;
62:
63: for (i = 0; i < n; i += 2) {
64: *a++ = (hex2nib[b[0] & 0x7f] << 4) | (hex2nib[b[1] & 0x7f]);
65: b += 2;
66: }
67:
68: return (n / 2);
69: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.