ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/ihost/ihost.c
(Generate patch)

Comparing projects/cms/source/ihost/ihost.c (file contents):
Revision 1.32 by pajs, Thu Mar 6 12:01:33 2003 UTC vs.
Revision 1.33 by pajs, Sat Mar 8 20:41:46 2003 UTC

# Line 75 | Line 75 | typedef struct{
75  
76   ihost_config_t ihost_config;
77  
78 + extern int errno;
79 +
80 + /* Taken from the openssh code. Its licence included in function.*/
81 + //#ifndef HAVE_STRLCAT
82 +
83 + /*
84 + * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
85 + * All rights reserved.
86 + *
87 + * Redistribution and use in source and binary forms, with or without
88 + * modification, are permitted provided that the following conditions
89 + * are met:
90 + * 1. Redistributions of source code must retain the above copyright
91 + *    notice, this list of conditions and the following disclaimer.
92 + * 2. Redistributions in binary form must reproduce the above copyright
93 + *    notice, this list of conditions and the following disclaimer in the
94 + *    documentation and/or other materials provided with the distribution.
95 + * 3. The name of the author may not be used to endorse or promote products
96 + *    derived from this software without specific prior written permission.
97 + *
98 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
99 + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
100 + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
101 + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
102 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
103 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
104 + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
105 + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
106 + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
107 + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
108 + */
109 + /*
110 + * Appends src to string dst of size siz (unlike strncat, siz is the
111 + * full size of dst, not space left).  At most siz-1 characters
112 + * will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
113 + * Returns strlen(src) + MIN(siz, strlen(initial dst)).
114 + * If retval >= siz, truncation occurred.
115 + */
116 + size_t
117 + strlcat(dst, src, siz)
118 +        char *dst;
119 +        const char *src;
120 +        size_t siz;
121 + {
122 +        register char *d = dst;
123 +        register const char *s = src;
124 +        register size_t n = siz;
125 +        size_t dlen;
126 +
127 +        /* Find the end of dst and adjust bytes left but don't go past end */
128 +        while (n-- != 0 && *d != '\0')
129 +                d++;
130 +        dlen = d - dst;
131 +        n = siz - dlen;
132 +
133 +        if (n == 0)
134 +                return(dlen + strlen(s));
135 +        while (*s != '\0') {
136 +                if (n != 1) {
137 +                        *d++ = *s;
138 +                        n--;
139 +                }
140 +                s++;
141 +        }
142 +        *d = '\0';
143 +
144 +        return(dlen + (s - src));       /* count does not include NUL */
145 + }
146 +
147 + //#endif
148 +
149 +
150   void log_msg(int level, char *format, ...){
79        extern int errno;
151          int cur_errno;
152          va_list ap;
153  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines