Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/cdplay Merge some of the cleanup from PR 21894. Do a...
details: https://anonhg.NetBSD.org/src/rev/5082192faea2
branches: trunk
changeset: 790414:5082192faea2
user: dholland <dholland%NetBSD.org@localhost>
date: Mon Oct 07 00:16:19 2013 +0000
description:
Merge some of the cleanup from PR 21894. Do a bit more of my own.
lint still squawks quite a bit, and it woudl probably be worthwhile
for someone to go through and make all the signedness consistent, but
I think I've got the valuable bits.
diffstat:
usr.bin/cdplay/cdplay.c | 42 ++++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 20 deletions(-)
diffs (168 lines):
diff -r e70c6675a485 -r 5082192faea2 usr.bin/cdplay/cdplay.c
--- a/usr.bin/cdplay/cdplay.c Sun Oct 06 21:05:50 2013 +0000
+++ b/usr.bin/cdplay/cdplay.c Mon Oct 07 00:16:19 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cdplay.c,v 1.46 2012/01/04 17:26:21 drochner Exp $ */
+/* $NetBSD: cdplay.c,v 1.47 2013/10/07 00:16:19 dholland Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Andrew Doran.
@@ -40,7 +40,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: cdplay.c,v 1.46 2012/01/04 17:26:21 drochner Exp $");
+__RCSID("$NetBSD: cdplay.c,v 1.47 2013/10/07 00:16:19 dholland Exp $");
#endif /* not lint */
#include <sys/types.h>
@@ -164,7 +164,7 @@
static int get_status(int *, int *, int *, int *, int *);
static void help(void);
-static int info(const char *);
+static int info(void);
static void lba2msf(u_long, u_int *, u_int *, u_int *);
static u_int msf2lba(u_int, u_int, u_int);
static int opencd(void);
@@ -175,11 +175,11 @@
static int play_digital(int, int);
static int play_msf(int, int, int, int, int, int);
static int play_track(int, int, int, int);
-static int print_status(const char *);
+static int print_status(void);
static void print_track(struct cd_toc_entry *);
static const char *prompt(void);
static int readaudio(int, int, int, u_char *);
-static int read_toc_entrys(int);
+static int read_toc_entries(int);
static int run(int, const char *);
static int start_analog(void);
static int start_digital(const char *);
@@ -199,10 +199,11 @@
const char *arg;
char buf[80], *p;
static char defdev[16];
- int cmd, len, c;
+ int cmd, c;
+ size_t len;
char *line;
const char *elline;
- int scratch, rv;
+ int scratch;
struct sigaction sa_timer;
const char *use_digital = NULL; /* historical default */
@@ -255,7 +256,7 @@
sigemptyset(&sa_timer.sa_mask);
sa_timer.sa_handler = sig_timer;
sa_timer.sa_flags = SA_RESTART;
- if ((rv = sigaction(SIGALRM, &sa_timer, NULL)) < 0)
+ if (sigaction(SIGALRM, &sa_timer, NULL) < 0)
err(EXIT_FAILURE, "sigaction()");
if (use_digital)
@@ -441,11 +442,11 @@
switch (cmd) {
case CMD_INFO:
- rv = info(arg);
+ rv = info();
break;
case CMD_STATUS:
- rv = print_status(arg);
+ rv = print_status();
break;
case CMD_PAUSE:
@@ -486,14 +487,15 @@
if (digital)
da.playing = 0;
if (shuffle)
- run(CMD_SHUFFLE, NULL);
+ rv = run(CMD_SHUFFLE, NULL);
if (ioctl(fd, CDIOCALLOW) < 0)
warn("ioctl(CDIOCALLOW)");
IOCTL_SIMPLE(fd, CDIOCEJECT);
break;
case CMD_CLOSE:
- ioctl(fd, CDIOCALLOW);
+ if (ioctl(fd, CDIOCALLOW) < 0)
+ warn("ioctl(CDIOCALLOW)");
IOCTL_SIMPLE(fd, CDIOCCLOSE);
if (interactive && fd == -1)
opencd();
@@ -585,7 +587,7 @@
if (!shuffle)
warnx("`skip' valid only in shuffle mode");
else
- skip(0, 1);
+ rv = skip(0, 1);
break;
case CMD_SET:
@@ -656,7 +658,7 @@
end = 0;
istart = iend = 1;
n = h.ending_track - h.starting_track + 1;
- rv = read_toc_entrys((n + 1) * sizeof(struct cd_toc_entry));
+ rv = read_toc_entries((n + 1) * sizeof(struct cd_toc_entry));
if (rv < 0)
return (rv);
@@ -968,7 +970,7 @@
}
static int
-print_status(const char *arg)
+print_status(void)
{
struct cd_sub_channel_info data;
struct ioc_read_subchannel ss;
@@ -1004,7 +1006,7 @@
ss.address_format = msf ? CD_MSF_FORMAT : CD_LBA_FORMAT;
ss.data_format = CD_MEDIA_CATALOG;
- if (!digital && ioctl(fd, CDIOCREADSUBCHANNEL, (char *) &ss) >= 0) {
+ if (!digital && ioctl(fd, CDIOCREADSUBCHANNEL, &ss) >= 0) {
printf("media catalog:\t%sactive",
ss.data->what.media_catalog.mc_valid ? "" : "in");
if (ss.data->what.media_catalog.mc_valid &&
@@ -1029,7 +1031,7 @@
}
static int
-info(const char *arg)
+info(void)
{
struct ioc_toc_header h;
int rc, i, n;
@@ -1040,7 +1042,7 @@
}
n = h.ending_track - h.starting_track + 1;
- rc = read_toc_entrys((n + 1) * sizeof(struct cd_toc_entry));
+ rc = read_toc_entries((n + 1) * sizeof(struct cd_toc_entry));
if (rc < 0)
return (rc);
@@ -1190,7 +1192,7 @@
}
static int
-read_toc_entrys(int len)
+read_toc_entries(int len)
{
struct ioc_read_toc_entry t;
int rv;
@@ -1246,7 +1248,7 @@
}
n = h.ending_track - h.starting_track + 1;
- rc = read_toc_entrys((n + 1) * sizeof(struct cd_toc_entry));
+ rc = read_toc_entries((n + 1) * sizeof(struct cd_toc_entry));
if (rc < 0)
return (rc);
}
Home |
Main Index |
Thread Index |
Old Index