Deleted Added
full compact
compat.c (8857) compat.c (20573)
1/* Copyright 1988,1990,1993,1994 by Paul Vixie
2 * All rights reserved
3 *
4 * Distribute freely, except: don't remove my name from the source or
5 * documentation (don't take credit for my work), mark your changes (don't
6 * get me blamed for your possible bugs), don't alter or remove this
7 * notice. May be sold if buildable source is provided to buyer. No
8 * warrantee of any kind, express or implied, is included with this
9 * software; use at your own risk, responsibility for damages (if any) to
10 * anyone resulting from the use of this software rests entirely with the
11 * user.
12 *
13 * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
14 * I'll try to keep a version up to date. I can be reached as follows:
15 * Paul Vixie <paul@vix.com> uunet!decwrl!vixie!paul
16 */
17
18#if !defined(lint) && !defined(LINT)
1/* Copyright 1988,1990,1993,1994 by Paul Vixie
2 * All rights reserved
3 *
4 * Distribute freely, except: don't remove my name from the source or
5 * documentation (don't take credit for my work), mark your changes (don't
6 * get me blamed for your possible bugs), don't alter or remove this
7 * notice. May be sold if buildable source is provided to buyer. No
8 * warrantee of any kind, express or implied, is included with this
9 * software; use at your own risk, responsibility for damages (if any) to
10 * anyone resulting from the use of this software rests entirely with the
11 * user.
12 *
13 * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
14 * I'll try to keep a version up to date. I can be reached as follows:
15 * Paul Vixie <paul@vix.com> uunet!decwrl!vixie!paul
16 */
17
18#if !defined(lint) && !defined(LINT)
19static char rcsid[] = "$Id: compat.c,v 1.1.1.1 1994/08/27 13:43:02 jkh Exp $";
19static char rcsid[] = "$Id: compat.c,v 1.2 1996/11/01 23:27:28 millert Exp $";
20#endif
21
22/* vix 30dec93 [broke this out of misc.c - see RCS log for history]
23 * vix 15jan87 [added TIOCNOTTY, thanks csg@pyramid]
24 */
25
26
27#include "cron.h"

--- 20 unchanged lines hidden (view full) ---

48
49#ifdef NEED_STRDUP
50char *
51strdup(str)
52 char *str;
53{
54 char *temp;
55
20#endif
21
22/* vix 30dec93 [broke this out of misc.c - see RCS log for history]
23 * vix 15jan87 [added TIOCNOTTY, thanks csg@pyramid]
24 */
25
26
27#include "cron.h"

--- 20 unchanged lines hidden (view full) ---

48
49#ifdef NEED_STRDUP
50char *
51strdup(str)
52 char *str;
53{
54 char *temp;
55
56 temp = malloc(strlen(str) + 1);
56 if ((temp = malloc(strlen(str) + 1)) == NULL) {
57 errno = ENOMEM;
58 return NULL;
59 }
57 (void) strcpy(temp, str);
58 return temp;
59}
60#endif
61
62
63#ifdef NEED_STRERROR
64char *

--- 73 unchanged lines hidden (view full) ---

138#ifdef NEED_FLOCK
139/* The following flock() emulation snarfed intact *) from the HP-UX
140 * "BSD to HP-UX porting tricks" maintained by
141 * system@alchemy.chem.utoronto.ca (System Admin (Mike Peterson))
142 * from the version "last updated: 11-Jan-1993"
143 * Snarfage done by Jarkko Hietaniemi <Jarkko.Hietaniemi@hut.fi>
144 * *) well, almost, had to K&R the function entry, HPUX "cc"
145 * does not grok ANSI function prototypes */
60 (void) strcpy(temp, str);
61 return temp;
62}
63#endif
64
65
66#ifdef NEED_STRERROR
67char *

--- 73 unchanged lines hidden (view full) ---

141#ifdef NEED_FLOCK
142/* The following flock() emulation snarfed intact *) from the HP-UX
143 * "BSD to HP-UX porting tricks" maintained by
144 * system@alchemy.chem.utoronto.ca (System Admin (Mike Peterson))
145 * from the version "last updated: 11-Jan-1993"
146 * Snarfage done by Jarkko Hietaniemi <Jarkko.Hietaniemi@hut.fi>
147 * *) well, almost, had to K&R the function entry, HPUX "cc"
148 * does not grok ANSI function prototypes */
146
149
147/*
148 * flock (fd, operation)
149 *
150 * This routine performs some file locking like the BSD 'flock'
151 * on the object described by the int file descriptor 'fd',
152 * which must already be open.
153 *
154 * The operations that are available are:

--- 39 unchanged lines hidden (view full) ---

194 if (i == -1)
195 if ((errno == EAGAIN) || (errno == EACCES))
196 errno = EWOULDBLOCK;
197 break;
198
199 case LOCK_UN: /* unlock */
200 i = lockf (fd, F_ULOCK, 0);
201 break;
150/*
151 * flock (fd, operation)
152 *
153 * This routine performs some file locking like the BSD 'flock'
154 * on the object described by the int file descriptor 'fd',
155 * which must already be open.
156 *
157 * The operations that are available are:

--- 39 unchanged lines hidden (view full) ---

197 if (i == -1)
198 if ((errno == EAGAIN) || (errno == EACCES))
199 errno = EWOULDBLOCK;
200 break;
201
202 case LOCK_UN: /* unlock */
203 i = lockf (fd, F_ULOCK, 0);
204 break;
202
205
203 default: /* can't decipher operation */
204 i = -1;
205 errno = EINVAL;
206 break;
207 }
206 default: /* can't decipher operation */
207 i = -1;
208 errno = EINVAL;
209 break;
210 }
208
211
209 return (i);
210}
211#endif /*NEED_FLOCK*/
212
213
214#ifdef NEED_SETENV
215int
216setenv(name, value, overwrite)

--- 5 unchanged lines hidden (view full) ---

222 if (overwrite && getenv(name))
223 return -1;
224
225 if (!(tmp = malloc(strlen(name) + strlen(value) + 2))) {
226 errno = ENOMEM;
227 return -1;
228 }
229
212 return (i);
213}
214#endif /*NEED_FLOCK*/
215
216
217#ifdef NEED_SETENV
218int
219setenv(name, value, overwrite)

--- 5 unchanged lines hidden (view full) ---

225 if (overwrite && getenv(name))
226 return -1;
227
228 if (!(tmp = malloc(strlen(name) + strlen(value) + 2))) {
229 errno = ENOMEM;
230 return -1;
231 }
232
230 sprintf("%s=%s", name, value);
233 sprintf(tmp, "%s=%s", name, value);
231 return putenv(tmp); /* intentionally orphan 'tmp' storage */
232}
233#endif
234 return putenv(tmp); /* intentionally orphan 'tmp' storage */
235}
236#endif