Deleted Added
full compact
findfp.c (90792) findfp.c (94334)
1/*
2 * Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Chris Torek.
9 *
10 * By using this file, you agree to the terms and conditions set
11 * forth in the LICENSE file which can be found at the top level of
12 * the sendmail distribution.
13 */
14
15#include <sm/gen.h>
1/*
2 * Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 1990, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Chris Torek.
9 *
10 * By using this file, you agree to the terms and conditions set
11 * forth in the LICENSE file which can be found at the top level of
12 * the sendmail distribution.
13 */
14
15#include <sm/gen.h>
16SM_RCSID("@(#)$Id: findfp.c,v 1.62 2002/01/11 16:33:03 ca Exp $")
16SM_RCSID("@(#)$Id: findfp.c,v 1.66 2002/02/20 02:40:24 ca Exp $")
17#include <stdlib.h>
18#include <unistd.h>
19#include <sys/param.h>
20#include <errno.h>
21#include <string.h>
22#include <syslog.h>
23#include <sm/io.h>
24#include <sm/assert.h>

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

42/* An open type to map to fdopen()-like behavior */
43SM_FILE_T SmFtStdiofd_def =
44 {SmFileMagic, 0, 0, 0, (SMRW|SMFBF), -1, {0, 0}, 0, 0, 0,
45 sm_stdclose, sm_stdread, sm_stdseek, sm_stdwrite,
46 sm_stdfdopen, sm_stdsetinfo, sm_stdgetinfo, SM_TIME_FOREVER,
47 SM_TIME_BLOCK, "stdiofd" };
48
49/* A string file type */
17#include <stdlib.h>
18#include <unistd.h>
19#include <sys/param.h>
20#include <errno.h>
21#include <string.h>
22#include <syslog.h>
23#include <sm/io.h>
24#include <sm/assert.h>

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

42/* An open type to map to fdopen()-like behavior */
43SM_FILE_T SmFtStdiofd_def =
44 {SmFileMagic, 0, 0, 0, (SMRW|SMFBF), -1, {0, 0}, 0, 0, 0,
45 sm_stdclose, sm_stdread, sm_stdseek, sm_stdwrite,
46 sm_stdfdopen, sm_stdsetinfo, sm_stdgetinfo, SM_TIME_FOREVER,
47 SM_TIME_BLOCK, "stdiofd" };
48
49/* A string file type */
50SM_FILE_T _SmFtString_def =
50SM_FILE_T SmFtString_def =
51 {SmFileMagic, 0, 0, 0, (SMRW|SMNBF), -1, {0, 0}, 0, 0, 0,
52 sm_strclose, sm_strread, sm_strseek, sm_strwrite,
53 sm_stropen, sm_strsetinfo, sm_strgetinfo, SM_TIME_FOREVER,
54 SM_TIME_BLOCK, "string" };
55
56#if 0
57/* A file type for syslog communications */
58SM_FILE_T SmFtSyslog_def =

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

114
115static struct sm_glue *
116sm_moreglue_x(n)
117 register int n;
118{
119 register struct sm_glue *g;
120 register SM_FILE_T *p;
121
51 {SmFileMagic, 0, 0, 0, (SMRW|SMNBF), -1, {0, 0}, 0, 0, 0,
52 sm_strclose, sm_strread, sm_strseek, sm_strwrite,
53 sm_stropen, sm_strsetinfo, sm_strgetinfo, SM_TIME_FOREVER,
54 SM_TIME_BLOCK, "string" };
55
56#if 0
57/* A file type for syslog communications */
58SM_FILE_T SmFtSyslog_def =

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

114
115static struct sm_glue *
116sm_moreglue_x(n)
117 register int n;
118{
119 register struct sm_glue *g;
120 register SM_FILE_T *p;
121
122 g = (struct sm_glue *) sm_pmalloc_x(sizeof(*g) + ALIGNBYTES +
122 g = (struct sm_glue *) sm_pmalloc_x(sizeof(*g) + SM_ALIGN_BITS +
123 n * sizeof(SM_FILE_T));
123 n * sizeof(SM_FILE_T));
124 p = (SM_FILE_T *) ALIGN(g + 1);
124 p = (SM_FILE_T *) SM_ALIGN(g + 1);
125 g->gl_next = NULL;
126 g->gl_niobs = n;
127 g->gl_iobs = p;
128 while (--n >= 0)
129 *p++ = empty;
130 return g;
131}
132

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

189 fp->f_close = t->f_close; /* assign close function */
190 fp->f_read = t->f_read; /* assign read function */
191 fp->f_seek = t->f_seek; /* assign seek function */
192 fp->f_write = t->f_write; /* assign write function */
193 fp->f_open = t->f_open; /* assign open function */
194 fp->f_setinfo = t->f_setinfo; /* assign setinfo function */
195 fp->f_getinfo = t->f_getinfo; /* assign getinfo function */
196 fp->f_type = t->f_type; /* file type */
125 g->gl_next = NULL;
126 g->gl_niobs = n;
127 g->gl_iobs = p;
128 while (--n >= 0)
129 *p++ = empty;
130 return g;
131}
132

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

189 fp->f_close = t->f_close; /* assign close function */
190 fp->f_read = t->f_read; /* assign read function */
191 fp->f_seek = t->f_seek; /* assign seek function */
192 fp->f_write = t->f_write; /* assign write function */
193 fp->f_open = t->f_open; /* assign open function */
194 fp->f_setinfo = t->f_setinfo; /* assign setinfo function */
195 fp->f_getinfo = t->f_getinfo; /* assign getinfo function */
196 fp->f_type = t->f_type; /* file type */
197 fp->f_self = fp; /* self reference for future use */
198
199 fp->f_ub.smb_base = NULL; /* no ungetc buffer */
200 fp->f_ub.smb_size = 0; /* no size for no ungetc buffer */
201
197
198 fp->f_ub.smb_base = NULL; /* no ungetc buffer */
199 fp->f_ub.smb_size = 0; /* no size for no ungetc buffer */
200
202 fp->f_lb.smb_base = NULL; /* no line buffer */
203 fp->f_lb.smb_size = 0; /* no size for no line buffer */
204 if (fp->f_timeout == SM_TIME_DEFAULT)
205 fp->f_timeout = SM_TIME_FOREVER;
206 else
207 fp->f_timeout = t->f_timeout; /* traditional behavior */
208 fp->f_timeoutstate = SM_TIME_BLOCK; /* by default */
209
210 return fp;
211}

--- 217 unchanged lines hidden ---
201 if (fp->f_timeout == SM_TIME_DEFAULT)
202 fp->f_timeout = SM_TIME_FOREVER;
203 else
204 fp->f_timeout = t->f_timeout; /* traditional behavior */
205 fp->f_timeoutstate = SM_TIME_BLOCK; /* by default */
206
207 return fp;
208}

--- 217 unchanged lines hidden ---