Deleted Added
full compact
map.c (9888) map.c (28370)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
35static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/9/93";
36static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/9/93";
37#endif
38static const char rcsid[] =
39 "$Id$";
36#endif /* not lint */
37
38#include <sys/types.h>
40#endif /* not lint */
41
42#include <sys/types.h>
39#include <termios.h>
40#include <errno.h>
43#include <err.h>
41#include <stdlib.h>
42#include <string.h>
44#include <stdlib.h>
45#include <string.h>
46#include <termios.h>
43#include "extern.h"
44
45extern speed_t Ospeed;
46speed_t baudrate __P((char *));
47
48/* Baud rate conditionals for mapping. */
49#define GT 0x01
50#define EQ 0x02

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

73 char *port, *arg;
74{
75 MAP *mapp;
76 char *copy, *p, *termp;
77
78 copy = strdup(arg);
79 mapp = malloc((u_int)sizeof(MAP));
80 if (copy == NULL || mapp == NULL)
47#include "extern.h"
48
49extern speed_t Ospeed;
50speed_t baudrate __P((char *));
51
52/* Baud rate conditionals for mapping. */
53#define GT 0x01
54#define EQ 0x02

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

77 char *port, *arg;
78{
79 MAP *mapp;
80 char *copy, *p, *termp;
81
82 copy = strdup(arg);
83 mapp = malloc((u_int)sizeof(MAP));
84 if (copy == NULL || mapp == NULL)
81 err("%s", strerror(errno));
85 errx(1, "malloc");
82 mapp->next = NULL;
83 if (maplist == NULL)
84 cur = maplist = mapp;
85 else {
86 cur->next = mapp;
87 cur = mapp;
88 }
89

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

149
150 /* If a NOT conditional, reverse the test. */
151 if (mapp->conditional & NOT)
152 mapp->conditional = ~mapp->conditional & (EQ | GT | LT);
153
154 /* If user specified a port with an option flag, set it. */
155done: if (port) {
156 if (mapp->porttype)
86 mapp->next = NULL;
87 if (maplist == NULL)
88 cur = maplist = mapp;
89 else {
90 cur->next = mapp;
91 cur = mapp;
92 }
93

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

153
154 /* If a NOT conditional, reverse the test. */
155 if (mapp->conditional & NOT)
156 mapp->conditional = ~mapp->conditional & (EQ | GT | LT);
157
158 /* If user specified a port with an option flag, set it. */
159done: if (port) {
160 if (mapp->porttype)
157badmopt: err("illegal -m option format: %s", copy);
161badmopt: errx(1, "illegal -m option format: %s", copy);
158 mapp->porttype = port;
159 }
160
161#ifdef MAPDEBUG
162 (void)printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY");
163 (void)printf("type: %s\n", mapp->type);
164 (void)printf("conditional: ");
165 p = "";

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

242 if (*rate == 'B')
243 ++rate;
244
245 for (sp = speeds; sp->string; ++sp)
246 if (!strcasecmp(rate, sp->string))
247 return (sp->speed);
248 speed = atol(rate);
249 if (speed == 0)
162 mapp->porttype = port;
163 }
164
165#ifdef MAPDEBUG
166 (void)printf("port: %s\n", mapp->porttype ? mapp->porttype : "ANY");
167 (void)printf("type: %s\n", mapp->type);
168 (void)printf("conditional: ");
169 p = "";

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

246 if (*rate == 'B')
247 ++rate;
248
249 for (sp = speeds; sp->string; ++sp)
250 if (!strcasecmp(rate, sp->string))
251 return (sp->speed);
252 speed = atol(rate);
253 if (speed == 0)
250 err("unknown baud rate %s", rate);
254 errx(1, "unknown baud rate %s", rate);
251 return speed;
252}
255 return speed;
256}