Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | /* |
2 | * Contributed to 386bsd 0.1 and later versions | |
3 | * | |
4 | * Copyright 1992 by Holger Veit | |
5 | * May be freely used with Bill Jolitz's port of | |
6 | * 386bsd and may be included in a 386bsd collection | |
7 | * as long as binary and source are available and reproduce the above | |
8 | * copyright. | |
9 | * | |
10 | * You may freely modify this code and contribute improvements based | |
11 | * on this code as long as you don't claim to be the original author. | |
12 | * Commercial use of this source requires permittance of the copyright | |
13 | * holder. A general license for 386bsd will override this restriction. | |
14 | * | |
15 | * Use at your own risk. The copyright holder or any person who makes | |
16 | * this code available for the public (administrators of public archives | |
17 | * for instance) are not responsible for any harm to hardware or software | |
18 | * that might happen due to wrong application or program faults. | |
19 | * | |
20 | * You must have the codrv-0.1.1 or later driver in the same package | |
21 | * generated into the 386bsd kernel, otherwise this program does not work. | |
22 | * | |
23 | * @(#)xc_fns.c 1.0 (386bsd contribution) 01/10/93 | |
24 | */ | |
25 | ||
26 | /* these are EXPERIMENTAL routines to replace the standard str* functions | |
27 | * These functions work with the XCHAR data type. | |
28 | * note that still the problem of the NULL byte exists | |
29 | * | |
30 | * This is not intended to be a proposal for multibyte characters. | |
31 | * | |
32 | */ | |
33 | #include <sys/types.h> | |
34 | #include <sys/ioctl.h> | |
35 | #include <sys/ioctl_pc.h> | |
36 | ||
37 | ||
38 | XCHAR *XC_strcpy(XCHAR *t,XCHAR *f) | |
39 | { | |
40 | XCHAR *p = t; | |
41 | while (*t++ = *f++); | |
42 | return p; | |
43 | } | |
44 | ||
45 | XCHAR *XC_strncpy(XCHAR *t,XCHAR *f,int n) | |
46 | { | |
47 | XCHAR *p = t; | |
48 | while (n>0) { *t++ = *f++, n--; } | |
49 | return p; | |
50 | } | |
51 | ||
52 | int XC_strlen(XCHAR *s) | |
53 | { | |
54 | int i = 0; | |
55 | while (!*s++) i++; | |
56 | return i; | |
57 | } | |
58 | ||
59 | XCHAR *XC_char2XCHAR(XCHAR *t,char *f,int n) | |
60 | { | |
61 | while (n>=0) { *t++ = (XCHAR)*f; f++; n--; } | |
62 | ||
63 | return t; | |
64 | } | |
65 | ||
66 | XCHAR *XC_strcat(XCHAR *t,XCHAR *f) | |
67 | { | |
68 | XCHAR *p = t; | |
69 | ||
70 | while (!*t) t++; | |
71 | while (*t++ = *f++); | |
72 | return p; | |
73 | } |