summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorR. Bernstein <rocky@gnu.org>2012-03-02 23:41:06 -0500
committerR. Bernstein <rocky@gnu.org>2012-03-02 23:41:06 -0500
commitc67e42370486c909eec3cb38cde5bb5a6dc88599 (patch)
tree2580af7f36045ae0c51e166802a739e8ebec64bd /example
parenta08e5931e0311e4083b86c928730e7eeb1f4b384 (diff)
Harmonize source headers: C examples (Patch 4/5)
Diffstat (limited to 'example')
-rw-r--r--example/audio.c17
-rw-r--r--example/cdchange.c8
-rw-r--r--example/cdio-eject.c11
-rw-r--r--example/cdtext.c9
-rw-r--r--example/device.c8
-rw-r--r--example/discid.c7
-rw-r--r--example/drives.c8
-rw-r--r--example/eject.c8
-rw-r--r--example/isofile.c1
-rw-r--r--example/isofile2.c6
-rw-r--r--example/isofuzzy.c10
-rw-r--r--example/isolist.c13
-rw-r--r--example/isolsn.c13
-rw-r--r--example/mmc1.c8
-rw-r--r--example/mmc2.c8
-rw-r--r--example/mmc2a.c7
-rw-r--r--example/mmc3.c14
-rw-r--r--example/sample3.c12
-rw-r--r--example/sample4.c12
-rw-r--r--example/tracks.c9
-rw-r--r--example/udf1.c13
-rw-r--r--example/udf2.c13
-rw-r--r--example/udffile.c14
23 files changed, 163 insertions, 66 deletions
diff --git a/example/audio.c b/example/audio.c
index 57c187b5..6951bd51 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 320633c5..091900e3 100644
--- a/example/cdchange.c
+++ b/example/cdchange.c
@@ -16,16 +16,12 @@
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
@@ -58,6 +54,8 @@
#define sleep(s) Sleep(1000*s)
#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 5db25b55..e7e8bdd6 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 7e99ad0b..6374c869 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 23b7a39f..0fd005ea 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 0075be97..3375ad13 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 b06f30c9..b28d2797 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 d239ef25..b278b019 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 281408d6..bcfe06a5 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 753fe557..474f0c1f 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 15e81efd..138e1fcf 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 0cb86b96..9233d2e8 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 cdcfa06c..d3046aca 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 84fb470e..08bfddc8 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 46eb1db2..e98cd0fd 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 1a4848d8..b90a87be 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 135a99eb..033593ad 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/sample3.c b/example/sample3.c
index aff0b57c..e5bf96e9 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 21826c5d..4e75f5c4 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 8422735e..8a2e6334 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 52f7077b..2da6f8f1 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 2cd5ef19..1c0cd4e6 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 2f19916c..8f3d09b5 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 "/\\"