8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / lp / lib / msgs / hslconv.c
blob4fa0143a86d42dd024548df7acc4b442f4e944e8
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
26 #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.7 */
27 /* LINTLIBRARY */
29 # include <string.h>
31 static char _lp_hextable[17] = "0123456789ABCDEF";
33 #if defined(__STDC__)
34 char * ltos ( char * s, unsigned long l)
35 #else
36 char * ltos (s, l)
37 char *s;
38 unsigned long l;
39 #endif
41 int i = 7;
43 while (i >= 0)
45 s[i--] = _lp_hextable[l % 16];
46 l /= 16;
48 s += 8;
49 return(s);
52 #if defined(__STDC__)
53 char * htos ( char * s, unsigned short h)
54 #else
55 char * htos (s, h)
56 char *s;
57 unsigned short h;
58 #endif
60 int i = 3;
62 while (i >= 0)
64 s[i--] = _lp_hextable[(long)h % 16];
65 h = (long) h / 16;
67 s += 4;
68 return(s);
71 #if defined(__STDC__)
72 unsigned long stol ( char * s )
73 #else
74 unsigned long stol (s)
75 char *s;
76 #endif
78 int i = 0;
79 unsigned long l = 0;
81 while (i < 8)
83 l <<= 4;
84 l += strchr(_lp_hextable, s[i++]) - _lp_hextable;
86 return(l);
89 #if defined(__STDC__)
90 unsigned short stoh ( char * s )
91 #else
92 unsigned short stoh (s)
93 char *s;
94 #endif
96 int i = 0;
97 unsigned short h = 0;
99 while (i < 4)
101 h <<= 4;
102 h += strchr(_lp_hextable, s[i++]) - _lp_hextable;
104 return(h);