pccardq.c (1c6adfcfdf40ae5d78fa19aff6a3451cc816fc0e) | pccardq.c (d50a71bdd882717df3f41dadd84ffc28f3466a1a) |
---|---|
1/* $FreeBSD$ */ | 1/* $Id: pccardq.c,v 1.2 1999/06/08 15:18:52 koie Exp $ */ |
2 3#include <err.h> 4#include <errno.h> 5#include <limits.h> 6#include <stdarg.h> 7#include <stddef.h> 8#include <stdio.h> 9#include <stdlib.h> --- 21 unchanged lines hidden (view full) --- 31 int rc = -1; 32 int ch; 33 34 char *p = strrchr(av[0], '/'); 35 prog = p ? p + 1 : av[0]; 36 37 tmp_dir = getenv("TMPDIR") ? getenv("TMPDIR") : tmp_dir; 38 | 2 3#include <err.h> 4#include <errno.h> 5#include <limits.h> 6#include <stdarg.h> 7#include <stddef.h> 8#include <stdio.h> 9#include <stdlib.h> --- 21 unchanged lines hidden (view full) --- 31 int rc = -1; 32 int ch; 33 34 char *p = strrchr(av[0], '/'); 35 prog = p ? p + 1 : av[0]; 36 37 tmp_dir = getenv("TMPDIR") ? getenv("TMPDIR") : tmp_dir; 38 |
39 while ((ch = getopt(ac, av, "ans:")) != -1) { | 39 while ((ch = getopt(ac, av, "ans:")) != EOF) { |
40 switch (ch) { 41 case 'a': 42 slot_map = ~0; 43 break; 44 case 'n': 45 slot_map = 0; 46 break; 47 case 's': --- 111 unchanged lines hidden (view full) --- 159 int slen; 160 char *s; 161 char *sl; 162 163 char *_manuf; 164 char *_version; 165 char *_device; 166 | 40 switch (ch) { 41 case 'a': 42 slot_map = ~0; 43 break; 44 case 'n': 45 slot_map = 0; 46 break; 47 case 's': --- 111 unchanged lines hidden (view full) --- 159 int slen; 160 char *s; 161 char *sl; 162 163 char *_manuf; 164 char *_version; 165 char *_device; 166 |
167 if ((slen = snprintf(buf, sizeof buf, "N%d", slot)) < 0) { 168 warnc(0, "write"); 169 goto err; 170 } 171 | 167 slen = snprintf(buf, sizeof buf, "N%d", slot); |
172 if ((rv = write(so, buf, slen)) < 0) { 173 warn("write"); 174 goto err; 175 } else if (rv != slen) { 176 warnc(0, "write"); 177 goto err; 178 } 179 --- 13 unchanged lines hidden (view full) --- 193 goto parse_err; 194 if ((_device = strsep(&s, "~")) == NULL) 195 goto parse_err; 196 if (sscanf(s, "%1d", state) != 1) 197 goto parse_err; 198 if (s != NULL && strchr(s, '~') != NULL) 199 goto parse_err; 200 | 168 if ((rv = write(so, buf, slen)) < 0) { 169 warn("write"); 170 goto err; 171 } else if (rv != slen) { 172 warnc(0, "write"); 173 goto err; 174 } 175 --- 13 unchanged lines hidden (view full) --- 189 goto parse_err; 190 if ((_device = strsep(&s, "~")) == NULL) 191 goto parse_err; 192 if (sscanf(s, "%1d", state) != 1) 193 goto parse_err; 194 if (s != NULL && strchr(s, '~') != NULL) 195 goto parse_err; 196 |
201 if ((*manuf = strdup(_manuf)) == NULL) { 202 warn("strdup"); 203 goto err; 204 } 205 if ((*version = strdup(_version)) == NULL) { 206 warn("strdup"); 207 goto err; 208 } 209 if ((*device = strdup(_device)) == NULL) { 210 warn("strdup"); 211 goto err; 212 } | 197 *manuf = strdup(_manuf); 198 *version = strdup(_version); 199 *device = strdup(_device); |
213 if (*manuf == NULL || *version == NULL || *device == NULL) { 214 warn("strdup"); 215 goto err; 216 } 217 218 rc = 0; 219 err: 220 return rc; --- 66 unchanged lines hidden --- | 200 if (*manuf == NULL || *version == NULL || *device == NULL) { 201 warn("strdup"); 202 goto err; 203 } 204 205 rc = 0; 206 err: 207 return rc; --- 66 unchanged lines hidden --- |