See previous mail. Regards,
/Pete
>From 7849938882c6356634f8454bc0ac632bfc0be7b1 Mon Sep 17 00:00:00 2001 From: Pete Batard <[email protected]> Date: Fri, 10 Feb 2012 18:32:43 +0000 Subject: [PATCH 4/5] Harmonize source headers: C examples --- example/audio.c | 17 ++++++++--------- example/cdchange.c | 23 +++++++++-------------- example/cdio-eject.c | 11 ++++++++++- example/cdtext.c | 9 ++++++--- example/device.c | 8 +++++++- example/discid.c | 7 +++++++ example/drives.c | 8 +++++++- example/eject.c | 8 +++++++- example/isofile.c | 1 - example/isofile2.c | 6 +++--- example/isofuzzy.c | 10 +++++----- example/isolist.c | 13 +++++++------ example/isolsn.c | 13 +++++++------ example/mmc1.c | 8 ++++++-- example/mmc2.c | 8 ++++++-- example/mmc2a.c | 7 +++++-- example/mmc3.c | 14 +++++++++++--- example/paranoia.c | 16 +++++++--------- example/paranoia2.c | 12 +++++++++--- example/sample3.c | 12 ++++++++++++ example/sample4.c | 12 ++++++++++++ example/tracks.c | 9 +++++++++ example/udf1.c | 13 +++++++++---- example/udf2.c | 13 +++++++++---- example/udffile.c | 14 +++++++------- 25 files changed, 185 insertions(+), 87 deletions(-) diff --git a/example/audio.c b/example/audio.c index 57c187b..6951bd5 100644 --- a/example/audio.c +++ b/example/audio.c @@ -22,36 +22,35 @@ CDDA player program using curses display see cdda-player in this distribution. */ -#include <cdio/cdio.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif #ifdef HAVE_STDIO_H #include <stdio.h> #endif - #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif - #ifdef HAVE_UNISTD_H #include <unistd.h> #endif - #ifdef HAVE_STRING_H #include <string.h> #endif - +#ifdef HAVE_SYS_TIME_H #include <sys/time.h> - -#include <signal.h> - +#endif #ifdef HAVE_GETOPT_H #include <getopt.h> #endif - #ifdef HAVE_ERRNO_H #include <errno.h> #endif +#include <signal.h> +#include <cdio/cdio.h> #include <cdio/mmc.h> #include <cdio/util.h> #include <cdio/cd_types.h> diff --git a/example/cdchange.c b/example/cdchange.c index f08cb21..08554ea 100644 --- a/example/cdchange.c +++ b/example/cdchange.c @@ -16,36 +16,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/* config.h has to come first else _FILE_OFFSET_BITS are redefined in - say opensolaris. */ +/* Test media changed */ #ifdef HAVE_CONFIG_H # include "config.h" # define __CDIO_CONFIG_H__ 1 #endif -#include <cdio/cdio.h> - -/* Test media changed */ +#ifdef HAVE_STDIO_H #include <stdio.h> - +#endif #ifdef HAVE_LIMITS_H #include <limits.h> #endif - #ifdef HAVE_STDLIB_H -# include <stdlib.h> +#include <stdlib.h> #endif - #ifdef HAVE_STRING_H -# include <string.h> +#include <string.h> #endif - #ifdef HAVE_UNISTD_H -# include <unistd.h> +#include <unistd.h> #endif - #ifdef HAVE_ERRNO_H -# include <errno.h> +#include <errno.h> #endif #ifdef HAVE_WINDOWS_H @@ -56,6 +49,8 @@ #error usleep() unimplemented #endif +#include <cdio/cdio.h> + int main(int argc, const char *argv[]) { diff --git a/example/cdio-eject.c b/example/cdio-eject.c index 5db25b5..e7e8bdd 100644 --- a/example/cdio-eject.c +++ b/example/cdio-eject.c @@ -14,10 +14,19 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif -#include <cdio/cdio.h> +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif + +#include <cdio/cdio.h> static void usage(char * progname) { diff --git a/example/cdtext.c b/example/cdtext.c index 7e99ad0..6374c86 100644 --- a/example/cdtext.c +++ b/example/cdtext.c @@ -18,17 +18,20 @@ /* Simple program to list CD-Text info of a Compact Disc using libcdio. See also corresponding C++ programs of similar names. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif -#include <cdio/cdio.h> #ifdef HAVE_STDIO_H #include <stdio.h> #endif - #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif -#include <cdio/cdtext.h> +#include <cdio/cdio.h> +#include <cdio/cdtext.h> static void print_cdtext_track_info(cdtext_t *cdtext, track_t i_track, const char *psz_msg) { diff --git a/example/device.c b/example/device.c index 23b7a39..0fd005e 100644 --- a/example/device.c +++ b/example/device.c @@ -18,7 +18,11 @@ /* Simple program to show drivers installed and what the default CD-ROM drive is. See also corresponding C++ programs of similar names .*/ -#include <cdio/cdio.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif + #ifdef HAVE_STDIO_H #include <stdio.h> #endif @@ -29,6 +33,8 @@ #include <sys/types.h> #endif +#include <cdio/cdio.h> + #define _(x) x /* Prints out drive capabilities */ diff --git a/example/discid.c b/example/discid.c index 0075be9..3375ad1 100644 --- a/example/discid.c +++ b/example/discid.c @@ -22,11 +22,18 @@ discs. The disc-ID can be used to query info (tracks, title, interpret) about compact audio discs from a CDDB-Server. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif + #include <cdio/cdio.h> static int cddb_sum(int n) diff --git a/example/drives.c b/example/drives.c index b06f30c..b28d279 100644 --- a/example/drives.c +++ b/example/drives.c @@ -17,7 +17,11 @@ /* Simple program to show drivers installed and what the default CD-ROM drive is and what CD drives are available. */ -#include <cdio/cdio.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif + #ifdef HAVE_STDIO_H #include <stdio.h> #endif @@ -27,6 +31,8 @@ #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif + +#include <cdio/cdio.h> #include <cdio/cd_types.h> #include <cdio/logging.h> diff --git a/example/eject.c b/example/eject.c index d239ef2..b278b01 100644 --- a/example/eject.c +++ b/example/eject.c @@ -24,7 +24,11 @@ See also corresponding C++ program of a similar name. */ -#include <cdio/cdio.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif + #ifdef HAVE_STDIO_H #include <stdio.h> #endif @@ -35,6 +39,8 @@ #include <string.h> #endif +#include <cdio/cdio.h> + int main(int argc, const char *argv[]) { diff --git a/example/isofile.c b/example/isofile.c index 281408d..bcfe06a 100644 --- a/example/isofile.c +++ b/example/isofile.c @@ -33,7 +33,6 @@ say opensolaris. */ #include "portable.h" -#include <sys/types.h> #include <cdio/cdio.h> #include <cdio/iso9660.h> diff --git a/example/isofile2.c b/example/isofile2.c index 753fe55..474f0c1 100644 --- a/example/isofile2.c +++ b/example/isofile2.c @@ -39,9 +39,6 @@ say opensolaris. */ #include "portable.h" -#include <cdio/cdio.h> -#include <cdio/iso9660.h> - #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif @@ -64,6 +61,9 @@ #include <sys/types.h> #endif +#include <cdio/cdio.h> +#include <cdio/iso9660.h> + #define CEILING(x, y) ((x+(y-1))/y) #define my_exit(rc) \ diff --git a/example/isofuzzy.c b/example/isofuzzy.c index 15e81ef..138e1fc 100644 --- a/example/isofuzzy.c +++ b/example/isofuzzy.c @@ -30,12 +30,9 @@ say opensolaris. */ #include "portable.h" -#include <sys/types.h> -#include <cdio/cdio.h> -#include <cdio/iso9660.h> - +#ifdef HAVE_STDIO_H #include <stdio.h> - +#endif #ifdef HAVE_ERRNO_H #include <errno.h> #endif @@ -52,6 +49,9 @@ #include <sys/types.h> #endif +#include <cdio/cdio.h> +#include <cdio/iso9660.h> + int main(int argc, const char *argv[]) { diff --git a/example/isolist.c b/example/isolist.c index 0cb86b9..9233d2e 100644 --- a/example/isolist.c +++ b/example/isolist.c @@ -30,15 +30,13 @@ #define ISO9660_IMAGE ISO9660_IMAGE_PATH "copying.iso" #ifdef HAVE_CONFIG_H -# include "config.h" -# define __CDIO_CONFIG_H__ 1 +#include "config.h" +#define __CDIO_CONFIG_H__ 1 #endif -#include <sys/types.h> -#include <cdio/cdio.h> -#include <cdio/iso9660.h> +#ifdef HAVE_STDIO_H #include <stdio.h> - +#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif @@ -52,6 +50,9 @@ #include <sys/types.h> #endif +#include <cdio/cdio.h> +#include <cdio/iso9660.h> + #define print_vd_info(title, fn) \ if (fn(p_iso, &psz_str)) { \ printf(title ": %s\n", psz_str); \ diff --git a/example/isolsn.c b/example/isolsn.c index cdcfa06..d3046ac 100644 --- a/example/isolsn.c +++ b/example/isolsn.c @@ -32,15 +32,13 @@ #define ISO9660_IMAGE ISO9660_IMAGE_PATH "copying.iso" #ifdef HAVE_CONFIG_H -# include "config.h" -# define __CDIO_CONFIG_H__ 1 +#include "config.h" +#define __CDIO_CONFIG_H__ 1 #endif -#include <sys/types.h> -#include <cdio/cdio.h> -#include <cdio/iso9660.h> +#ifdef HAVE_STDIO_H #include <stdio.h> - +#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif @@ -54,6 +52,9 @@ #include <sys/types.h> #endif +#include <cdio/cdio.h> +#include <cdio/iso9660.h> + #define print_vd_info(title, fn) \ if (fn(p_iso, &psz_str)) { \ printf(title ": %s\n", psz_str); \ diff --git a/example/mmc1.c b/example/mmc1.c index 84fb470..08bfddc 100644 --- a/example/mmc1.c +++ b/example/mmc1.c @@ -22,16 +22,20 @@ See also corresponding C++ programs. */ #ifdef HAVE_CONFIG_H -# include "config.h" -# define __CDIO_CONFIG_H__ 1 +#include "config.h" +#define __CDIO_CONFIG_H__ 1 #endif + +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #ifdef HAVE_STRING_H #include <string.h> #endif + #include <cdio/cdio.h> #include <cdio/mmc.h> #include <cdio/mmc_cmds.h> diff --git a/example/mmc2.c b/example/mmc2.c index 46eb1db..e98cd0f 100644 --- a/example/mmc2.c +++ b/example/mmc2.c @@ -18,16 +18,20 @@ /* A program to using the MMC interface to list CD and drive features from the MMC GET_CONFIGURATION command . */ #ifdef HAVE_CONFIG_H -# include "config.h" -# define __CDIO_CONFIG_H__ 1 +#include "config.h" +#define __CDIO_CONFIG_H__ 1 #endif + +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif #ifdef HAVE_STRING_H #include <string.h> #endif + #include <cdio/cdio.h> #include <cdio/mmc.h> diff --git a/example/mmc2a.c b/example/mmc2a.c index 1a4848d..b90a87b 100644 --- a/example/mmc2a.c +++ b/example/mmc2a.c @@ -22,10 +22,13 @@ routines. */ #ifdef HAVE_CONFIG_H -# include "config.h" -# define __CDIO_CONFIG_H__ 1 +#include "config.h" +#define __CDIO_CONFIG_H__ 1 #endif + +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif diff --git a/example/mmc3.c b/example/mmc3.c index 135a99e..033593a 100644 --- a/example/mmc3.c +++ b/example/mmc3.c @@ -19,17 +19,25 @@ the libdio scsi_mmc_get_hwinfo() routine. */ #ifdef HAVE_CONFIG_H -# include "config.h" -# define __CDIO_CONFIG_H__ 1 +#include "config.h" +#define __CDIO_CONFIG_H__ 1 #endif + +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif +#ifdef HAVE_SYS_TYPES_H #include <sys/types.h> +#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif + #include <cdio/cdio.h> #include <cdio/mmc.h> -#include <string.h> /* Set how long to wait for MMC commands to complete */ #define DEFAULT_TIMEOUT_MS 10000 diff --git a/example/paranoia.c b/example/paranoia.c index 7df6b9c..25c2c88 100644 --- a/example/paranoia.c +++ b/example/paranoia.c @@ -22,32 +22,30 @@ /* config.h has to come first else _FILE_OFFSET_BITS are redefined in say opensolaris. */ #ifdef HAVE_CONFIG_H -# include "config.h" -# define __CDIO_CONFIG_H__ 1 +#include "config.h" +#define __CDIO_CONFIG_H__ 1 #endif -#include <cdio/paranoia.h> -#include <cdio/cd_types.h> +#ifdef HAVE_STDIO_H #include <stdio.h> - +#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif - #ifdef HAVE_UNISTD_H #include <unistd.h> #endif - #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif - #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif - #include <fcntl.h> +#include <cdio/paranoia.h> +#include <cdio/cd_types.h> + static void put_num(long int num, int f, int bytes) { diff --git a/example/paranoia2.c b/example/paranoia2.c index 19a725b..949ba5d 100644 --- a/example/paranoia2.c +++ b/example/paranoia2.c @@ -21,15 +21,21 @@ players this may be what will be done since, one may want to get CDDB/CD-Text info beforehand. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif -#include <cdio/cdda.h> -#include <cdio/cd_types.h> +#ifdef HAVE_STDIO_H #include <stdio.h> - +#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif +#include <cdio/cdda.h> +#include <cdio/cd_types.h> + int main(int argc, const char *argv[]) { diff --git a/example/sample3.c b/example/sample3.c index aff0b57..e5bf96e 100644 --- a/example/sample3.c +++ b/example/sample3.c @@ -19,9 +19,21 @@ A somewhat simplified program to show the use of cdio_guess_cd_type(). Figure out the kind of CD image we've got. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif + +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif +#ifdef HAVE_SYS_TYPES_H #include <sys/types.h> +#endif + #include <cdio/cdio.h> #include <cdio/cd_types.h> diff --git a/example/sample4.c b/example/sample4.c index 21826c5..4e75f5c 100644 --- a/example/sample4.c +++ b/example/sample4.c @@ -19,9 +19,21 @@ A slightly improved sample3 program: we handle cdio logging and take an optional CD-location. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif + +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif +#ifdef HAVE_SYS_TYPES_H #include <sys/types.h> +#endif + #include <cdio/cdio.h> #include <cdio/cd_types.h> #include <cdio/logging.h> diff --git a/example/tracks.c b/example/tracks.c index 8422735..8a2e633 100644 --- a/example/tracks.c +++ b/example/tracks.c @@ -18,11 +18,20 @@ /* Simple program to list track numbers and logical sector numbers of a Compact Disc using libcdio. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif + +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif #ifdef HAVE_SYS_TYPES_H #include <sys/types.h> #endif + #include <cdio/cdio.h> + int main(int argc, const char *argv[]) { diff --git a/example/udf1.c b/example/udf1.c index 52f7077..2da6f8f 100644 --- a/example/udf1.c +++ b/example/udf1.c @@ -25,12 +25,14 @@ #define UDF_IMAGE_PATH "../" #define UDF_IMAGE "/src2/cd-images/udf/UDF102ISO.iso" -#include <sys/types.h> -#include <cdio/cdio.h> -#include <cdio/udf.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif +#ifdef HAVE_STDIO_H #include <stdio.h> - +#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif @@ -44,6 +46,9 @@ #include <sys/types.h> #endif +#include <cdio/cdio.h> +#include <cdio/udf.h> + #define udf_PATH_DELIMITERS "/\\" static void diff --git a/example/udf2.c b/example/udf2.c index 2cd5ef1..1c0cd4e 100644 --- a/example/udf2.c +++ b/example/udf2.c @@ -27,12 +27,14 @@ #define UDF_IMAGE "/src2/cd-images/udf/test2.iso" #define UDF_FILENAME "/parse/cue.L" -#include <sys/types.h> -#include <cdio/cdio.h> -#include <cdio/udf.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#define __CDIO_CONFIG_H__ 1 +#endif +#ifdef HAVE_STDIO_H #include <stdio.h> - +#endif #ifdef HAVE_STDLIB_H #include <stdlib.h> #endif @@ -46,6 +48,9 @@ #include <sys/types.h> #endif +#include <cdio/cdio.h> +#include <cdio/udf.h> + #define CEILING(x, y) ((x+(y-1))/y) #define udf_PATH_DELIMITERS "/\\" diff --git a/example/udffile.c b/example/udffile.c index 2f19916..8f3d09b 100644 --- a/example/udffile.c +++ b/example/udffile.c @@ -26,8 +26,8 @@ /* config.h has to come first else _FILE_OFFSET_BITS are redefined in say opensolaris. */ #ifdef HAVE_CONFIG_H -# include "config.h" -# define __CDIO_CONFIG_H__ 1 +#include "config.h" +#define __CDIO_CONFIG_H__ 1 #endif /* This is the UDF image. */ @@ -36,12 +36,9 @@ #define UDF_FILENAME "/COPYING" #define LOCAL_FILENAME "copying" -#include <sys/types.h> -#include <cdio/cdio.h> -#include <cdio/udf.h> - +#ifdef HAVE_STDIO_H #include <stdio.h> - +#endif #ifdef HAVE_ERRNO_H #include <errno.h> #endif @@ -58,6 +55,9 @@ #include <sys/types.h> #endif +#include <cdio/cdio.h> +#include <cdio/udf.h> + #define CEILING(x, y) ((x+(y-1))/y) #define udf_PATH_DELIMITERS "/\\" -- 1.7.8.msysgit.0
