[Debburn-devel] [PATCH] cleanup: Use ANSI-style function definitions in cdrecord.c

Christian Fromme kaner at strace.org
Tue Sep 5 20:39:07 UTC 2006


Hello List,

Here is a patch that changes function definitions to ANSI-style in
cdrecord.c. Patches for other files will follow if anyone wants them.

Best wishes,
Christian
-------------- next part --------------
Index: cdrecord/cdrecord.c
===================================================================
--- cdrecord/cdrecord.c	(Revision 227)
+++ cdrecord/cdrecord.c	(Arbeitskopie)
@@ -196,7 +196,6 @@
 
 static	long	fs = -1L;	/* fifo (ring buffer) size */
 
-EXPORT	int 	main		__PR((int ac, char **av));
 LOCAL	int	gracewait	__PR((cdr_t *dp, BOOL *didgracep));
 LOCAL	void	cdrstats	__PR((cdr_t *dp));
 LOCAL	void	susage		__PR((int));
@@ -282,9 +281,7 @@
 } exargs;
 
 EXPORT int
-main(ac, av)
-	int	ac;
-	char	*av[];
+main(int argc, char *argv[])
 {
 	char	*dev = NULL;
 	int	timeout = 40;	/* Set default timeout to 40s CW-7502 is slow*/
@@ -310,8 +307,8 @@
 
 	/* workaround for k3b */
 	int acpos;
-	for(acpos=0;acpos<ac;acpos++) {
-	   if(!strcmp(av[acpos],"-version") || !strcmp(av[acpos],"--version"))
+	for(acpos=0;acpos<argc;acpos++) {
+	   if(!strcmp(argv[acpos],"-version") || !strcmp(argv[acpos],"--version"))
 	      fprintf(stderr, "Cdrecord-yelling-line-to-tell-frontends-to-use-it-like-version 2.01.01a03-dvd \n");
 	}
 
@@ -325,9 +322,9 @@
 
 #ifdef __EMX__
 	/* This gives wildcard expansion with Non-Posix shells with EMX */
-	_wildcard(&ac, &av);
+	_wildcard(&argc, &argv);
 #endif
-	save_args(ac, av);
+	save_args(argc, argv);
 	oeuid = geteuid();		/* Remember saved set uid	*/
 
 	fillbytes(track, sizeof (track), '\0');
@@ -335,7 +332,7 @@
 		track[i].track = track[i].trackno = i;
 	track[0].tracktype = TOC_MASK;
 	raise_fdlim();
-	ispacket = gargs(ac, av, &tracks, track, &dev, &timeout, &dp, &speed, &flags,
+	ispacket = gargs(argc, argv, &tracks, track, &dev, &timeout, &dp, &speed, &flags,
 							&blanktype, &formattype);
 	if ((track[0].tracktype & TOC_MASK) == TOC_MASK)
 		comerrno(EX_BAD, "Internal error: Bad TOC type.\n");
@@ -1492,9 +1489,7 @@
 }
 
 LOCAL int
-gracewait(dp, didgracep)
-	cdr_t	*dp;
-	BOOL	*didgracep;
+gracewait(cdr_t *dp, BOOL *didgracep)
 {
 	int	i;
 	BOOL	didgrace = FALSE;
@@ -1565,8 +1560,7 @@
 }
 
 LOCAL void
-cdrstats(dp)
-	cdr_t	*dp;
+cdrstats(cdr_t *dp)
 {
 	float	secsps = 75.0;
 	int	nsecs;
@@ -1642,8 +1636,7 @@
  * Short usage
  */
 LOCAL void
-susage(ret)
-	int	ret;
+susage(int ret)
 {
 	error("Usage: %s [options] track1...trackn\n", get_progname());
 	error("\nUse\t%s -help\n", get_progname());
@@ -1659,8 +1652,7 @@
 }
 
 LOCAL void
-usage(excode)
-	int excode;
+usage(int excode)
 {
 	error("Usage: %s [options] track1...trackn\n", get_progname());
 	error("Options:\n");
@@ -1755,8 +1747,7 @@
 }
 
 LOCAL void
-blusage(ret)
-	int	ret;
+blusage(int ret)
 {
 	error("Blanking options:\n");
 	error("\tall\t\tblank the entire disk\n");
@@ -1775,8 +1766,7 @@
 }
 
 LOCAL void
-formattypeusage(ret)
-	int	ret;
+formattypeusage(int ret)
 {
 	error("Formating options:\n");
 	error("\tfull\t\tstandard formating\n");
@@ -1789,8 +1779,7 @@
 
 /* ARGSUSED */
 LOCAL void
-intr(sig)
-	int	sig;
+intr(int sig)
 {
 	sig = 0;	/* Fake usage for gcc */
 
@@ -1800,15 +1789,13 @@
 }
 
 LOCAL void
-catchsig(sig)
-	int	sig;
+catchsig(int sig)
 {
 	signal(sig, catchsig);
 }
 
 LOCAL int
-scsi_cb(arg)
-	void	*arg;
+scsi_cb(void *arg)
 {
 	comexit(EX_BAD);
 	/* NOTREACHED */
@@ -1816,8 +1803,7 @@
 }
 
 LOCAL void
-intfifo(sig)
-	int	sig;
+intfifo(int sig)
 {
 	errmsgno(EX_BAD, "Caught interrupt.\n");
 	if (exargs.scgp) {
@@ -1838,9 +1824,7 @@
 
 /* ARGSUSED */
 LOCAL void
-exscsi(excode, arg)
-	int	excode;
-	void	*arg;
+exscsi(int excode, void *arg)
 {
 	struct exargs	*exp = (struct exargs *)arg;
 
@@ -1866,9 +1850,7 @@
 }
 
 LOCAL void
-excdr(excode, arg)
-	int	excode;
-	void	*arg;
+excdr(int excode, void *arg)
 {
 	struct exargs	*exp = (struct exargs *)arg;
 
@@ -1889,10 +1871,7 @@
 }
 
 EXPORT int
-read_buf(f, bp, size)
-	int	f;
-	char	*bp;
-	int	size;
+read_buf(int f, char *bp, int size)
 {
 	char	*p = bp;
 	int	amount = 0;
@@ -1912,12 +1891,7 @@
 }
 
 EXPORT int
-fill_buf(f, trackp, secno, bp, size)
-	int	f;
-	track_t	*trackp;
-	long	secno;
-	char	*bp;
-	int	size;
+fill_buf(int f, track_t *trackp, long secno, char *bp, int size)
 {
 	int	amount = 0;
 	int	nsecs;
@@ -1993,12 +1967,7 @@
 }
 
 EXPORT int
-get_buf(f, trackp, secno, bpp, size)
-	int	f;
-	track_t	*trackp;
-	long	secno;
-	char	**bpp;
-	int	size;
+get_buf(int f, track_t *trackp, long secno, char **bpp, int size)
 {
 	if (fs > 0) {
 /*		return (faio_read_buf(f, *bpp, size));*/
@@ -2009,14 +1978,8 @@
 }
 
 EXPORT int
-write_secs(scgp, dp, bp, startsec, bytespt, secspt, islast)
-	SCSI	*scgp;
-	cdr_t	*dp;
-	char	*bp;
-	long	startsec;
-	int	bytespt;
-	int	secspt;
-	BOOL	islast;
+write_secs(SCSI *scgp, cdr_t *dp, char *bp, long startsec, int bytespt, 
+        int secspt, BOOL islast)
 {
 	int	amount;
 
@@ -2055,10 +2018,7 @@
 }
 
 LOCAL int
-write_track_data(scgp, dp, trackp)
-	SCSI	*scgp;
-	cdr_t	*dp;
-	track_t	*trackp;
+write_track_data(SCSI *scgp, cdr_t *dp, track_t *trackp)
 {
 	int	track = trackp->trackno;
 	int	f = -1;
@@ -2341,14 +2301,8 @@
 }
 
 EXPORT int
-pad_track(scgp, dp, trackp, startsec, amt, dolast, bytesp)
-	SCSI	*scgp;
-	cdr_t	*dp;
-	track_t	*trackp;
-	long	startsec;
-	Llong	amt;
-	BOOL	dolast;
-	Llong	*bytesp;
+pad_track(SCSI *scgp, cdr_t	*dp, track_t *trackp, long startsec, Llong amt,
+	BOOL dolast, Llong *bytesp)
 {
 	int	track = trackp->trackno;
 	Llong	bytes	= 0;
@@ -2481,16 +2435,8 @@
 
 #ifdef	USE_WRITE_BUF
 EXPORT int
-write_buf(scgp, dp, trackp, bp, startsec, amt, secsize, dolast, bytesp)
-	SCSI	*scgp;
-	cdr_t	*dp;
-	track_t	*trackp;
-	char	*bp;
-	long	startsec;
-	Llong	amt;
-	int	secsize;
-	BOOL	dolast;
-	Llong	*bytesp;
+write_buf(SCSI *scgp, cdr_t *dp, track_t *trackp, char *bp, long startsec, 
+        Llong amt, int secsize, BOOL dolast, Llong *bytesp)
 {
 	int	track = trackp->trackno;
 	Llong	bytes	= 0;
@@ -2552,9 +2498,7 @@
 #endif	/* USE_WRITE_BUF */
 
 LOCAL void
-printdata(track, trackp)
-	int	track;
-	track_t	*trackp;
+printdata(int track, track_t *trackp)
 {
 	if (trackp->itracksize >= 0) {
 		printf("Track %02d: data  %4lld MB        ",
@@ -2581,9 +2525,7 @@
 }
 
 LOCAL void
-printaudio(track, trackp)
-	int	track;
-	track_t	*trackp;
+printaudio(int track, track_t *trackp)
 {
 	if (trackp->itracksize >= 0) {
 		printf("Track %02d: audio %4lld MB (%02d:%02d.%02d) %spreemp%s%s",
@@ -2631,9 +2573,7 @@
 }
 
 LOCAL void
-checkfile(track, trackp)
-	int	track;
-	track_t	*trackp;
+checkfile(int track, track_t *trackp)
 {
 	if (trackp->itracksize > 0 &&
 			is_audio(trackp) &&
@@ -2662,9 +2602,7 @@
 }
 
 LOCAL int
-checkfiles(tracks, trackp)
-	int	tracks;
-	track_t	*trackp;
+checkfiles(int tracks, track_t *trackp)
 {
 	int	i;
 	int	isaudio = 1;
@@ -2689,9 +2627,7 @@
 }
 
 LOCAL void
-setleadinout(tracks, trackp)
-	int	tracks;
-	track_t	*trackp;
+setleadinout(int tracks, track_t *trackp)
 {
 	/*
 	 * Set some values for track 0 (the lead-in)
@@ -2726,9 +2662,7 @@
 }
 
 LOCAL void
-setpregaps(tracks, trackp)
-	int	tracks;
-	track_t	*trackp;
+setpregaps(int tracks, track_t *trackp)
 {
 	int	i;
 	int	sectype;
@@ -2771,9 +2705,7 @@
  * Check total size of the medium
  */
 LOCAL long
-checktsize(tracks, trackp)
-	int	tracks;
-	track_t	*trackp;
+checktsize(int tracks, track_t *trackp)
 {
 	int	i;
 	Llong	curr;
@@ -2850,8 +2782,7 @@
 }
 
 LOCAL void
-opentracks(trackp)
-	track_t	*trackp;
+opentracks(track_t *trackp)
 {
 	track_t	*tp;
 	int	i;
@@ -2925,8 +2856,7 @@
 }
 
 LOCAL void
-checksize(trackp)
-	track_t	*trackp;
+checksize(track_t *trackp)
 {
 	struct stat	st;
 	Llong		lsize;
@@ -2983,11 +2913,7 @@
 }
 
 LOCAL BOOL
-checkdsize(scgp, dp, tsize, flags)
-	SCSI	*scgp;
-	cdr_t	*dp;
-	long	tsize;
-	int	flags;
+checkdsize(SCSI *scgp, cdr_t *dp, long tsize, int flags)
 {
 	long	startsec = 0L;
 	long	endsec = 0L;
@@ -3202,20 +3128,10 @@
 #define	M_SAO		2	/* Session at Once mode (also known as DAO) */
 #define	M_RAW		4	/* Raw mode */
 #define	M_PACKET	8	/* Packed mode */
-
 LOCAL int
-gargs(ac, av, tracksp, trackp, devp, timeoutp, dpp, speedp, flagsp, blankp, formatp)
-	int	ac;
-	char	**av;
-	int	*tracksp;
-	track_t	*trackp;
-	cdr_t	**dpp;
-	char	**devp;
-	int	*timeoutp;
-	int	*speedp;
-	long	*flagsp;
-	int	*blankp;
-	int	*formatp;
+gargs(int ac, char **av, int *tracksp, track_t *trackp, char **devp, 
+        int *timeoutp, cdr_t **dpp, int *speedp, long *flagsp, int *blankp, 
+        int *formatp)
 {
 	int	cac;
 	char	* const*cav;
@@ -3921,10 +3837,7 @@
 }
 
 LOCAL void
-set_trsizes(dp, tracks, trackp)
-	cdr_t	*dp;
-	int	tracks;
-	track_t	*trackp;
+set_trsizes(cdr_t *dp, int tracks, track_t *trackp)
 {
 	int	i;
 	int	secsize;
@@ -3979,10 +3892,7 @@
 }
 
 EXPORT void
-load_media(scgp, dp, doexit)
-	SCSI	*scgp;
-	cdr_t	*dp;
-	BOOL	doexit;
+load_media(SCSI *scgp, cdr_t *dp, BOOL doexit)
 {
 	int	code;
 	int	key;
@@ -4028,10 +3938,7 @@
 }
 
 EXPORT void
-unload_media(scgp, dp, flags)
-	SCSI	*scgp;
-	cdr_t	*dp;
-	int	flags;
+unload_media(SCSI *scgp, cdr_t *dp, int flags)
 {
 	scsi_prevent_removal(scgp, 0);
 	if ((flags & F_EJECT) != 0) {
@@ -4041,9 +3948,7 @@
 }
 
 EXPORT void
-reload_media(scgp, dp)
-	SCSI	*scgp;
-	cdr_t	*dp;
+reload_media(SCSI *scgp, cdr_t *dp)
 {
 	char	ans[2];
 #ifdef	F_GETFL
@@ -4098,9 +4003,7 @@
 }
 
 EXPORT void
-set_secsize(scgp, secsize)
-	SCSI	*scgp;
-	int	secsize;
+set_secsize(SCSI *scgp, int secsize)
 {
 	if (secsize > 0) {
 		/*
@@ -4113,9 +4016,7 @@
 }
 
 LOCAL int
-get_dmaspeed(scgp, dp)
-	SCSI	*scgp;
-	cdr_t	*dp;
+get_dmaspeed(SCSI *scgp, cdr_t *dp)
 {
 	int	i;
 	long	t;
@@ -4162,10 +4063,7 @@
 
 
 LOCAL BOOL
-do_opc(scgp, dp, flags)
-	SCSI	*scgp;
-	cdr_t	*dp;
-	int	flags;
+do_opc(SCSI *scgp, cdr_t *dp, int flags)
 {
 	if ((flags & F_DUMMY) == 0 && dp->cdr_opc) {
 		if (debug || lverbose) {
@@ -4182,10 +4080,7 @@
 }
 
 LOCAL void
-check_recovery(scgp, dp, flags)
-	SCSI	*scgp;
-	cdr_t	*dp;
-	int	flags;
+check_recovery(SCSI *scgp, cdr_t *dp, int flags)
 {
 	if ((*dp->cdr_check_recovery)(scgp, dp)) {
 		errmsgno(EX_BAD, "Recovery needed.\n");
@@ -4198,10 +4093,7 @@
 #define	DEBUG
 #endif
 void
-audioread(scgp, dp, flags)
-	SCSI	*scgp;
-	cdr_t	*dp;
-	int	flags;
+audioread(SCSI *scgp, cdr_t *dp, int flags)
 {
 #ifdef	DEBUG
 	int speed = 1;
@@ -4226,9 +4118,7 @@
 }
 
 LOCAL void
-print_msinfo(scgp, dp)
-	SCSI	*scgp;
-	cdr_t	*dp;
+print_msinfo(SCSI *scgp, cdr_t *dp)
 {
 	long	off;
 	long	fa;
@@ -4248,9 +4138,7 @@
 }
 
 LOCAL void
-print_toc(scgp, dp)
-	SCSI	*scgp;
-	cdr_t	*dp;
+print_toc(SCSI *scgp, cdr_t *dp)
 {
 	int	first;
 	int	last;
@@ -4298,13 +4186,7 @@
 }
 
 LOCAL void
-print_track(track, lba, msp, adr, control, mode)
-	int	track;
-	long	lba;
-	struct msf *msp;
-	int	adr;
-	int	control;
-	int	mode;
+print_track(int track, long lba, struct msf *msp, int adr, int control, int mode)
 {
 	long	lba_512 = lba*4;
 
@@ -4328,8 +4210,7 @@
 #include <sys/rtpriocntl.h>
 
 EXPORT	void
-raisepri(pri)
-	int pri;
+raisepri(int pri)
 {
 	int		pid;
 	int		classes;
@@ -4383,8 +4264,7 @@
 #endif
 
 LOCAL	int
-rt_raisepri(pri)
-	int pri;
+rt_raisepri(int pri)
 {
 	struct sched_param scp;
 
@@ -4435,8 +4315,7 @@
 #undef interface
 
 LOCAL	int
-rt_raisepri(pri)
-	int pri;
+rt_raisepri(int pri)
 {
 	int prios[] = {THREAD_PRIORITY_TIME_CRITICAL, THREAD_PRIORITY_HIGHEST};
 
@@ -4459,8 +4338,7 @@
  * This OS does not support real time scheduling.
  */
 LOCAL	int
-rt_raisepri(pri)
-	int pri;
+rt_raisepri(int pri)
 {
 	return (-1);
 }
@@ -4470,8 +4348,7 @@
 #endif	/* _POSIX_PRIORITY_SCHEDULING */
 
 EXPORT	void
-raisepri(pri)
-	int pri;
+raisepri(int pri)
 {
 	if (rt_raisepri(pri) >= 0)
 		return;
@@ -4556,9 +4433,7 @@
 }
 
 LOCAL int
-getbltype(optstr, typep)
-	char	*optstr;
-	long	*typep;
+getbltype(char *optstr, long *typep)
 {
 	if (streql(optstr, "all")) {
 		*typep = BLANK_DISC;
@@ -4591,9 +4466,7 @@
 }
 
 LOCAL int
-getformattype(optstr, typep)
-	char	*optstr;
-	long	*typep;
+getformattype(char *optstr, long *typep)
 {
 	if (streql(optstr, "full")) {
 		*typep = FULL_FORMAT;
@@ -4611,8 +4484,7 @@
 	return (TRUE);
 }
 LOCAL void
-print_drflags(dp)
-	cdr_t	*dp;
+print_drflags(cdr_t *dp)
 {
 	printf("Driver flags   : ");
 
@@ -4650,8 +4522,7 @@
 }
 
 LOCAL void
-print_wrmodes(dp)
-	cdr_t	*dp;
+print_wrmodes(cdr_t *dp)
 {
 	BOOL	needblank = FALSE;
 
@@ -4698,10 +4569,7 @@
 }
 
 LOCAL BOOL
-check_wrmode(dp, wmode, tflags)
-	cdr_t	*dp;
-	int	wmode;
-	int	tflags;
+check_wrmode(cdr_t *dp, int wmode, int tflags)
 {
 	int	cdflags = dp->cdr_flags;
 
@@ -4771,10 +4639,7 @@
 }
 
 LOCAL void
-set_wrmode(dp, wmode, tflags)
-	cdr_t	*dp;
-	int	wmode;
-	int	tflags;
+set_wrmode(cdr_t *dp, int wmode, int tflags)
 {
 	dstat_t	*dsp = dp->cdr_dstat;
 	int	profile;
@@ -4853,8 +4718,7 @@
 
 #ifdef __linux__
 LOCAL int
-get_cap(cap_array)
-	cap_value_t cap_array;
+get_cap(cap_value_t cap_array)
 { 
     	  int ret;
 	  cap_t capa;


More information about the Debburn-devel mailing list