diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-06-01 07:53:02 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-06-01 07:53:02 +0000 |
commit | 300da6e4317ab1e227ad11b957bdd5ae4e7802a4 (patch) | |
tree | cc615d6b09ea4861d831cbce87b0a78237ca6aab | |
parent | 2aeabb9b1249e14bb5c85026fb3715d1e1a1356f (diff) |
minor tweaks
-rw-r--r-- | usr.bin/cdio/cdio.c | 26 | ||||
-rw-r--r-- | usr.bin/cdio/mmc.c | 24 |
2 files changed, 26 insertions, 24 deletions
diff --git a/usr.bin/cdio/cdio.c b/usr.bin/cdio/cdio.c index 42fd279ef6a..5a500a93c61 100644 --- a/usr.bin/cdio/cdio.c +++ b/usr.bin/cdio/cdio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cdio.c,v 1.50 2006/06/01 07:12:18 mjc Exp $ */ +/* $OpenBSD: cdio.c,v 1.51 2006/06/01 07:53:01 deraadt Exp $ */ /* Copyright (c) 1995 Serge V. Vakulenko * All rights reserved. @@ -192,7 +192,7 @@ help(void) int i; for (c=cmdtab; c->name; ++c) { - if (! c->args) + if (!c->args) continue; printf("\t"); for (i = c->min, s = c->name; *s; s++, i--) { @@ -232,7 +232,7 @@ main(int argc, char **argv) char type; cdname = getenv("DISC"); - if (! cdname) + if (!cdname) cdname = getenv("CDROM"); cddb_host = getenv("CDDB"); @@ -263,7 +263,7 @@ main(int argc, char **argv) if (argc > 0 && ! strcasecmp(*argv, "help")) usage(); - if (! cdname) { + if (!cdname) { cdname = DEFAULT_CD_DRIVE; fprintf(stderr, "No CD device name specified. Defaulting to %s.\n", cdname); @@ -314,7 +314,7 @@ main(int argc, char **argv) SLIST_INSERT_AFTER(cur_track,tr,track_list); cur_track = tr; } - if (! open_cd(cdname, 1)) + if (!open_cd(cdname, 1)) exit(1); get_disc_size(&availblk); SLIST_FOREACH(tr, &tracks, track_list) { @@ -441,10 +441,10 @@ run(int cmd, char *arg) if (fd < 0 && ! open_cd(cdname, 0)) return (0); - if (! strcasecmp(arg, "on")) + if (!strcasecmp(arg, "on")) return ioctl(fd, CDIOCSETDEBUG); - if (! strcasecmp(arg, "off")) + if (!strcasecmp(arg, "off")) return ioctl(fd, CDIOCCLRDEBUG); printf("%s: Invalid command arguments\n", __progname); @@ -465,7 +465,7 @@ run(int cmd, char *arg) } /* open new device */ - if (! open_cd(arg, 0)) + if (!open_cd(arg, 0)) return (0); (void) strlcpy(newcdname, arg, sizeof(newcdname)); cdname = newcdname; @@ -615,7 +615,7 @@ play(char *arg) rc--; } - if (! arg || ! *arg) { + if (!arg || ! *arg) { /* Play the whole disc */ return (play_track(h.starting_track, 1, h.ending_track, 1)); } @@ -940,7 +940,7 @@ play_prev(char *arg) } if (trk < h.starting_track) - return play_track(h.starting_track, 1, + return play_track(h.starting_track, 1, h.ending_track + 1, 1); return play_track(trk, 1, h.ending_track, 1); } @@ -1355,7 +1355,7 @@ play_msf(int start_m, int start_s, int start_f, int end_m, int end_s, int end_f) return ioctl(fd, CDIOCPLAYMSF, (char *) &a); } -int +int status(int *trk, int *min, int *sec, int *frame) { struct ioc_read_subchannel s; @@ -1431,7 +1431,7 @@ parse(char *buf, int *cmd) continue; len = p - buf; - if (! len) + if (!len) return (0); if (*p) { /* It must be a spacing character! */ @@ -1446,7 +1446,7 @@ parse(char *buf, int *cmd) *cmd = -1; for (c=cmdtab; c->name; ++c) { /* Is it an exact match? */ - if (! strcasecmp(buf, c->name)) { + if (!strcasecmp(buf, c->name)) { *cmd = c->command; break; } diff --git a/usr.bin/cdio/mmc.c b/usr.bin/cdio/mmc.c index 7ff773230aa..2f1929c398f 100644 --- a/usr.bin/cdio/mmc.c +++ b/usr.bin/cdio/mmc.c @@ -1,4 +1,5 @@ -/* $OpenBSD: mmc.c,v 1.6 2006/06/01 07:12:18 mjc Exp $ */ +/* $OpenBSD: mmc.c,v 1.7 2006/06/01 07:53:01 deraadt Exp $ */ + /* * Copyright (c) 2006 Michael Coulter <mjc@openbsd.org> * @@ -26,7 +27,6 @@ #include <unistd.h> #include "extern.h" -extern int errno; extern int fd; extern char *cdname; @@ -49,7 +49,7 @@ blank(void) if (r == -1 && errno == EPERM) { close(fd); fd = -1; - if (! open_cd(cdname, 1)) + if (!open_cd(cdname, 1)) return (-1); } r = ioctl(fd, SCIOCCOMMAND, &scr); @@ -110,7 +110,6 @@ close_session(void) r = ioctl(fd, SCIOCCOMMAND, &scr); return (r == 0 ? scr.retsts : -1); - } int @@ -118,8 +117,8 @@ writetao(struct track_head *thp) { u_char modebuf[70]; struct track_info *tr; - int r; u_char bdlen; + int r; if ((r = mode_sense_write(modebuf)) != SCCMD_OK) { warnx("mode sense failed: %d", r); @@ -130,7 +129,7 @@ writetao(struct track_head *thp) modebuf[2+8+bdlen] |= 0x01; /* change write type to TAO */ SLIST_FOREACH(tr, thp, track_list) { - switch(tr->type) { + switch (tr->type) { case 'd': modebuf[3+8+bdlen] = 0x04; /* track mode = data */ modebuf[4+8+bdlen] = 0x08; /* 2048 block track mode */ @@ -193,7 +192,8 @@ writetrack(struct track_info *tr) return (-1); } if (tr->sz % tr->blklen) { - warnx("file %s is not multiple of block length %d", tr->file, tr->blklen); + warnx("file %s is not multiple of block length %d", + tr->file, tr->blklen); end_lba = tr->sz / tr->blklen + lba + 1; } else { end_lba = tr->sz / tr->blklen + lba; @@ -214,7 +214,9 @@ writetrack(struct track_info *tr) return (-1); } if (scr.retsts != SCCMD_OK) { - warnx("ioctl returned bad status while attempting to write: %d", scr.retsts); + warnx("ioctl returned bad status while " + "attempting to write: %d", + scr.retsts); return (r); } lba += nblk; @@ -243,7 +245,7 @@ mode_sense_write(unsigned char buf[]) scr.cmd[7] = 0x00; scr.cmd[8] = 0x46; /* 16 for the header + size from pg. 89 mmc-r10a.pdf */ scr.cmdlen = 10; - scr.datalen= 0x46; + scr.datalen= 0x46; scr.flags = SCCMD_ESCAPE|SCCMD_READ; scr.databuf = (caddr_t)buf; @@ -290,7 +292,7 @@ get_disc_size(off_t *availblk) scr.cmd[7] = 0x00; scr.cmd[8] = 0x1c; scr.cmdlen = 10; - scr.datalen= 0x1c; + scr.datalen= 0x1c; scr.flags = SCCMD_ESCAPE|SCCMD_READ; scr.databuf = (caddr_t)databuf; @@ -316,7 +318,7 @@ get_nwa(int *nwa) scr.cmd[7] = 0x00; scr.cmd[8] = 0x1c; scr.cmdlen = 10; - scr.datalen= 0x1c; + scr.datalen= 0x1c; scr.flags = SCCMD_ESCAPE|SCCMD_READ; scr.databuf = (caddr_t)databuf; |