diff options
author | charnier <charnier@FreeBSD.org> | 1997-10-06 11:36:08 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1997-10-06 11:36:08 +0000 |
commit | e1eba2d48d55ccab7473f0ec67ac16b5daed99c7 (patch) | |
tree | bb6d02b48f43f60570e6d0c1d1f9b1d689b66624 /usr.sbin/pccard/pccardd | |
parent | 2fef004dcf2789eb4481b4022d97dcc520b07d42 (diff) | |
download | FreeBSD-src-e1eba2d48d55ccab7473f0ec67ac16b5daed99c7.zip FreeBSD-src-e1eba2d48d55ccab7473f0ec67ac16b5daed99c7.tar.gz |
Use err(3). Add usage()s.
Diffstat (limited to 'usr.sbin/pccard/pccardd')
-rw-r--r-- | usr.sbin/pccard/pccardd/cardd.c | 23 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardd/file.c | 30 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardd/pccard.conf.5 | 2 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardd/pccardd.8 | 15 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardd/readcis.c | 17 | ||||
-rw-r--r-- | usr.sbin/pccard/pccardd/util.c | 18 |
6 files changed, 60 insertions, 45 deletions
diff --git a/usr.sbin/pccard/pccardd/cardd.c b/usr.sbin/pccard/pccardd/cardd.c index e5ab1c5..d928d97 100644 --- a/usr.sbin/pccard/pccardd/cardd.c +++ b/usr.sbin/pccard/pccardd/cardd.c @@ -22,15 +22,18 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id$ */ +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + +#include <fcntl.h> #include <stdio.h> #include <stdlib.h> -#include <unistd.h> #include <string.h> -#include <fcntl.h> +#include <unistd.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/time.h> @@ -59,8 +62,6 @@ main(int argc, char *argv[]) struct slot *sp; int count, debug = 0; int verbose = 0; - extern char *optarg; - extern int optind, optopt; while ((count = getopt(argc, argv, ":dvf:")) != -1) { switch (count) { @@ -76,10 +77,10 @@ main(int argc, char *argv[]) config_file = optarg; break; case ':': - die("No config file argument"); + die("no config file argument"); break; case '?': - die("Illegal option"); + die("illegal option"); break; } } @@ -99,7 +100,7 @@ main(int argc, char *argv[]) die("fork failed"); readslots(); if (slots == 0) - die("No PC-CARD slots"); + die("no PC-CARD slots"); log_1s("pccardd started", NULL); for (;;) { fd_set mask; @@ -108,7 +109,7 @@ main(int argc, char *argv[]) FD_SET(sp->fd, &mask); count = select(32, 0, 0, &mask, 0); if (count == -1) { - logerr("Select"); + logerr("select"); continue; } if (count) @@ -187,7 +188,7 @@ readslots(void) if (mem == 0) { mem = alloc_memory(4 * 1024); if (mem == 0) - die("Can't allocate memory for controller access"); + die("can't allocate memory for controller access"); if (ioctl(fd, PIOCRWMEM, &mem)) logerr("ioctl (PIOCRWMEM)"); } diff --git a/usr.sbin/pccard/pccardd/file.c b/usr.sbin/pccard/pccardd/file.c index 22ee125..3add3da 100644 --- a/usr.sbin/pccard/pccardd/file.c +++ b/usr.sbin/pccard/pccardd/file.c @@ -22,9 +22,13 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id$ */ + +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -146,7 +150,7 @@ parsefile(void) parse_card(); break; default: - error("Syntax error"); + error("syntax error"); pusht = 0; break; } @@ -177,7 +181,7 @@ parse_card(void) /* config */ i = num_tok(); if (i == -1) { - error("Illegal card config index"); + error("illegal card config index"); break; } confp = xmalloc(sizeof(*confp)); @@ -190,7 +194,7 @@ parse_card(void) confp->flags = 0; } if (confp->irq < 0 || confp->irq > 15) { - error("Illegal card IRQ value"); + error("illegal card IRQ value"); break; } confp->index = i & 0x3F; @@ -214,7 +218,7 @@ parse_card(void) /* reset */ i = num_tok(); if (i == -1) { - error("Illegal card reset time"); + error("illegal card reset time"); break; } cp->reset_time = i; @@ -223,7 +227,7 @@ parse_card(void) /* ether */ cp->ether = num_tok(); if (cp->ether == -1) { - error("Illegal ether address offset"); + error("illegal ether address offset"); cp->ether = 0; } break; @@ -303,7 +307,7 @@ ioblk_tok(int force) return (io); } if (force) - error("Illegal or missing I/O block spec"); + error("illegal or missing I/O block spec"); return (0); } @@ -318,13 +322,13 @@ memblk_tok(int force) if ((i = num_tok()) >= 0) if ((j = num_tok()) < 0) - error("Illegal memory block"); + error("illegal memory block"); else { mem = xmalloc(sizeof(*mem)); mem->addr = i & ~(MEMUNIT - 1); mem->size = (j + MEMUNIT - 1) & ~(MEMUNIT - 1); if (i < MEMSTART || (i + j) > MEMEND) { - error("Memory address out of range"); + error("memory address out of range"); if (force) { free(mem); mem = 0; @@ -334,7 +338,7 @@ memblk_tok(int force) return (mem); } if (force) - error("Illegal or missing memory block spec"); + error("illegal or missing memory block spec"); return (0); } @@ -354,7 +358,7 @@ irq_tok(int force) if (i > 0 && i < 16) return (i); if (force) - error("Illegal IRQ value"); + error("illegal IRQ value"); return (-1); } @@ -557,7 +561,7 @@ _next_tok(void) break; case '\n': if (instr) { - error("Unterminated string"); + error("unterminated string"); break; } case ' ': diff --git a/usr.sbin/pccard/pccardd/pccard.conf.5 b/usr.sbin/pccard/pccardd/pccard.conf.5 index f00e611..96ad0cf 100644 --- a/usr.sbin/pccard/pccardd/pccard.conf.5 +++ b/usr.sbin/pccard/pccardd/pccard.conf.5 @@ -33,7 +33,7 @@ configuration file .Sh DESCRIPTION The -.Nm pccard.conf +.Nm file is the configuration file for the .Xr pccardd 8 PC-CARD slot management daemon. diff --git a/usr.sbin/pccard/pccardd/pccardd.8 b/usr.sbin/pccard/pccardd/pccardd.8 index 3fd202c..a4ebb74 100644 --- a/usr.sbin/pccard/pccardd/pccardd.8 +++ b/usr.sbin/pccard/pccardd/pccardd.8 @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id$ +.\" $Id: pccardd.8,v 1.7 1997/02/22 16:08:58 peter Exp $ .\" .Dd November 1, 1994 .Dt PCCARD 8 @@ -42,7 +42,7 @@ is normally started at boot time, and manages the insertion and removal of PC-CARD cards. .Pp When started, -.Nm pccardd +.Nm will read the configuration file (default name .Pa /etc/pccard.conf ) and scans the available PC-CARD slots for cards. @@ -69,7 +69,7 @@ the card description in the configuration file. Once matched, a driver is allocated. .It Once a free driver and device instance is located, -.Nm pccardd +.Nm will (if required) allocate resources such as an ISA memory block and Input/Output ports from a common pool. .It @@ -85,7 +85,7 @@ for each card, driver or device, and are executed in that order. .El .Pp When -.Nm pccardd +.Nm detects that a card has been removed, the following sequence occurs: .Bl -enum .It @@ -110,7 +110,7 @@ parameters. This will change significantly when loadable kernel modules are supported. .Pp The start options understood by -.Nm pccardd +.Nm are: .Bl -tag -width Ds .It Fl d @@ -122,7 +122,7 @@ of it. .It Fl f Ar configfile Specifies a different configuration file to be used in placed of the default file -.Pa /etc/pccard.conf. +.Pa /etc/pccard.conf . The file format is detailed in .Xr card.conf 5 , and lists the PC-CARD cards recognized by @@ -138,7 +138,8 @@ interface to the card. .Xr pccard.conf 5 , .Xr ifconfig 8 .Sh AUTHOR -Developed by Andrew McRae (andrew@mega.com.au). +Developed by +.An Andrew McRae Aq andrew@mega.com.au . .Sh BUGS .Nm Pccardd can set up card parameters, but cannot guarantee that diff --git a/usr.sbin/pccard/pccardd/readcis.c b/usr.sbin/pccard/pccardd/readcis.c index 5f7293d..fd00db5 100644 --- a/usr.sbin/pccard/pccardd/readcis.c +++ b/usr.sbin/pccard/pccardd/readcis.c @@ -22,13 +22,18 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id$ */ + +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + +#include <err.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #include <sys/ioctl.h> #include <pccard/card.h> @@ -478,7 +483,7 @@ read_one_tuplelist(int fd, int flags, off_t offs) lseek(fd, offs, SEEK_SET); do { if (read_attr(fd, &code, 1) != 1) { - perror("CIS code read"); + warn("CIS code read"); break; } total++; @@ -487,7 +492,7 @@ read_one_tuplelist(int fd, int flags, off_t offs) tp = xmalloc(sizeof(*tp)); tp->code = code; if (read_attr(fd, &length, 1) != 1) { - perror("CIS len read"); + warn("CIS len read"); break; } total++; @@ -503,7 +508,7 @@ read_one_tuplelist(int fd, int flags, off_t offs) total += length; tp->data = xmalloc(length); if (read_attr(fd, tp->data, length) != length) { - perror("CIS read"); + warn("CIS read"); break; } } diff --git a/usr.sbin/pccard/pccardd/util.c b/usr.sbin/pccard/pccardd/util.c index 33045e7..f963608 100644 --- a/usr.sbin/pccard/pccardd/util.c +++ b/usr.sbin/pccard/pccardd/util.c @@ -22,8 +22,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id$ */ /* @@ -33,12 +31,18 @@ * Nate Williams <nate@FreeBSD.org> */ +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + +#include <err.h> +#include <fcntl.h> +#include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <fcntl.h> -#include <stdarg.h> #include <sys/types.h> #include <sys/ioctl.h> #include <syslog.h> @@ -74,7 +78,7 @@ log_1s(const char *fmt, ...) dialog_clear(); msgConfirm(s); #else - fprintf(stderr, "cardd: %s\n", s); + warnx("%s", s); #endif } } @@ -89,7 +93,7 @@ logerr(char *msg) dialog_clear(); msgConfirm(msg); #else - perror(msg); + warn("%s", msg); #endif } } @@ -110,7 +114,7 @@ die(char *msg) dialog_clear(); msgConfirm(s); #else - fprintf(stderr, "cardd fatal error: %s\n", msg); + warnx("fatal error: %s", msg); #endif } closelog(); |