Harmonize source headers: C examples (Patch 4/5)

This commit is contained in:
R. Bernstein
2012-03-02 23:41:06 -05:00
parent a08e5931e0
commit c67e423704
23 changed files with 164 additions and 67 deletions

View File

@@ -22,36 +22,35 @@
CDDA player program using curses display see cdda-player in this CDDA player program using curses display see cdda-player in this
distribution. distribution.
*/ */
#include <cdio/cdio.h> #ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif
#include <signal.h>
#ifdef HAVE_GETOPT_H #ifdef HAVE_GETOPT_H
#include <getopt.h> #include <getopt.h>
#endif #endif
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
#include <signal.h>
#include <cdio/cdio.h>
#include <cdio/mmc.h> #include <cdio/mmc.h>
#include <cdio/util.h> #include <cdio/util.h>
#include <cdio/cd_types.h> #include <cdio/cd_types.h>

View File

@@ -16,16 +16,12 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. 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 /* Test media changed */
say opensolaris. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
# define __CDIO_CONFIG_H__ 1 # define __CDIO_CONFIG_H__ 1
#endif #endif
#include <cdio/cdio.h>
/* Test media changed */
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
# include <stdio.h> # include <stdio.h>
#endif #endif
@@ -58,6 +54,8 @@
#define sleep(s) Sleep(1000*s) #define sleep(s) Sleep(1000*s)
#endif #endif
#include <cdio/cdio.h>
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
{ {

View File

@@ -14,10 +14,19 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. 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
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <stdio.h>
#include <string.h>
static void usage(char * progname) static void usage(char * progname)
{ {

View File

@@ -18,17 +18,20 @@
/* Simple program to list CD-Text info of a Compact Disc using /* Simple program to list CD-Text info of a Compact Disc using
libcdio. See also corresponding C++ programs of similar names. */ 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 #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdtext.h>
#include <cdio/cdio.h>
#include <cdio/cdtext.h>
static void static void
print_cdtext_track_info(cdtext_t *cdtext, track_t i_track, const char *psz_msg) { print_cdtext_track_info(cdtext_t *cdtext, track_t i_track, const char *psz_msg) {

View File

@@ -18,7 +18,11 @@
/* Simple program to show drivers installed and what the default /* Simple program to show drivers installed and what the default
CD-ROM drive is. See also corresponding C++ programs of similar CD-ROM drive is. See also corresponding C++ programs of similar
names .*/ names .*/
#include <cdio/cdio.h> #ifdef HAVE_CONFIG_H
#include "config.h"
#define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
@@ -29,6 +33,8 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#define _(x) x #define _(x) x
/* Prints out drive capabilities */ /* Prints out drive capabilities */

View File

@@ -22,11 +22,18 @@
discs. The disc-ID can be used to query info (tracks, title, discs. The disc-ID can be used to query info (tracks, title,
interpret) about compact audio discs from a CDDB-Server. 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> #include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
static int cddb_sum(int n) static int cddb_sum(int n)

View File

@@ -17,7 +17,11 @@
/* Simple program to show drivers installed and what the default /* Simple program to show drivers installed and what the default
CD-ROM drive is and what CD drives are available. */ 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 #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
@@ -27,6 +31,8 @@
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#include <cdio/cd_types.h> #include <cdio/cd_types.h>
#include <cdio/logging.h> #include <cdio/logging.h>

View File

@@ -24,7 +24,11 @@
See also corresponding C++ program of a similar name. 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 #ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif #endif
@@ -35,6 +39,8 @@
#include <string.h> #include <string.h>
#endif #endif
#include <cdio/cdio.h>
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
{ {

View File

@@ -33,7 +33,6 @@
say opensolaris. */ say opensolaris. */
#include "portable.h" #include "portable.h"
#include <sys/types.h>
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/iso9660.h> #include <cdio/iso9660.h>

View File

@@ -39,9 +39,6 @@
say opensolaris. */ say opensolaris. */
#include "portable.h" #include "portable.h"
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
@@ -64,6 +61,9 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#define CEILING(x, y) ((x+(y-1))/y) #define CEILING(x, y) ((x+(y-1))/y)
#define my_exit(rc) \ #define my_exit(rc) \

View File

@@ -30,12 +30,9 @@
say opensolaris. */ say opensolaris. */
#include "portable.h" #include "portable.h"
#include <sys/types.h> #ifdef HAVE_STDIO_H
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
@@ -52,6 +49,9 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
{ {

View File

@@ -30,15 +30,13 @@
#define ISO9660_IMAGE ISO9660_IMAGE_PATH "copying.iso" #define ISO9660_IMAGE ISO9660_IMAGE_PATH "copying.iso"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
# define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
#endif #endif
#include <sys/types.h>
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@@ -52,6 +50,9 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#define print_vd_info(title, fn) \ #define print_vd_info(title, fn) \
if (fn(p_iso, &psz_str)) { \ if (fn(p_iso, &psz_str)) { \
printf(title ": %s\n", psz_str); \ printf(title ": %s\n", psz_str); \

View File

@@ -32,15 +32,13 @@
#define ISO9660_IMAGE ISO9660_IMAGE_PATH "copying.iso" #define ISO9660_IMAGE ISO9660_IMAGE_PATH "copying.iso"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
# define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
#endif #endif
#include <sys/types.h>
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@@ -54,6 +52,9 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#include <cdio/iso9660.h>
#define print_vd_info(title, fn) \ #define print_vd_info(title, fn) \
if (fn(p_iso, &psz_str)) { \ if (fn(p_iso, &psz_str)) { \
printf(title ": %s\n", psz_str); \ printf(title ": %s\n", psz_str); \

View File

@@ -22,16 +22,20 @@
See also corresponding C++ programs. See also corresponding C++ programs.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
# define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
#endif #endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/mmc.h> #include <cdio/mmc.h>
#include <cdio/mmc_cmds.h> #include <cdio/mmc_cmds.h>

View File

@@ -18,16 +18,20 @@
/* A program to using the MMC interface to list CD and drive features /* A program to using the MMC interface to list CD and drive features
from the MMC GET_CONFIGURATION command . */ from the MMC GET_CONFIGURATION command . */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
# define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
#endif #endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#ifdef HAVE_STRING_H #ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif #endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/mmc.h> #include <cdio/mmc.h>

View File

@@ -22,10 +22,13 @@
routines. routines.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
# define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
#endif #endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif

View File

@@ -19,17 +19,25 @@
the libdio scsi_mmc_get_hwinfo() routine. the libdio scsi_mmc_get_hwinfo() routine.
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
# define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
#endif #endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/mmc.h> #include <cdio/mmc.h>
#include <string.h>
/* Set how long to wait for MMC commands to complete */ /* Set how long to wait for MMC commands to complete */
#define DEFAULT_TIMEOUT_MS 10000 #define DEFAULT_TIMEOUT_MS 10000

View File

@@ -19,9 +19,21 @@
A somewhat simplified program to show the use of cdio_guess_cd_type(). A somewhat simplified program to show the use of cdio_guess_cd_type().
Figure out the kind of CD image we've got. 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> #include <stdio.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/cd_types.h> #include <cdio/cd_types.h>

View File

@@ -19,9 +19,21 @@
A slightly improved sample3 program: we handle cdio logging and A slightly improved sample3 program: we handle cdio logging and
take an optional CD-location. 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> #include <stdio.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h> #include <string.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
#include <cdio/cd_types.h> #include <cdio/cd_types.h>
#include <cdio/logging.h> #include <cdio/logging.h>

View File

@@ -18,11 +18,20 @@
/* Simple program to list track numbers and logical sector numbers of /* Simple program to list track numbers and logical sector numbers of
a Compact Disc using libcdio. */ 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> #include <stdio.h>
#endif
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h> #include <cdio/cdio.h>
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
{ {

View File

@@ -25,12 +25,14 @@
#define UDF_IMAGE_PATH "../" #define UDF_IMAGE_PATH "../"
#define UDF_IMAGE "/src2/cd-images/udf/UDF102ISO.iso" #define UDF_IMAGE "/src2/cd-images/udf/UDF102ISO.iso"
#include <sys/types.h> #ifdef HAVE_CONFIG_H
#include <cdio/cdio.h> #include "config.h"
#include <cdio/udf.h> #define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@@ -44,6 +46,9 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#include <cdio/udf.h>
#define udf_PATH_DELIMITERS "/\\" #define udf_PATH_DELIMITERS "/\\"
static void static void

View File

@@ -27,12 +27,14 @@
#define UDF_IMAGE "/src2/cd-images/udf/test2.iso" #define UDF_IMAGE "/src2/cd-images/udf/test2.iso"
#define UDF_FILENAME "/parse/cue.L" #define UDF_FILENAME "/parse/cue.L"
#include <sys/types.h> #ifdef HAVE_CONFIG_H
#include <cdio/cdio.h> #include "config.h"
#include <cdio/udf.h> #define __CDIO_CONFIG_H__ 1
#endif
#ifdef HAVE_STDIO_H
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
@@ -46,6 +48,9 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#include <cdio/udf.h>
#define CEILING(x, y) ((x+(y-1))/y) #define CEILING(x, y) ((x+(y-1))/y)
#define udf_PATH_DELIMITERS "/\\" #define udf_PATH_DELIMITERS "/\\"

View File

@@ -26,8 +26,8 @@
/* config.h has to come first else _FILE_OFFSET_BITS are redefined in /* config.h has to come first else _FILE_OFFSET_BITS are redefined in
say opensolaris. */ say opensolaris. */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
# define __CDIO_CONFIG_H__ 1 #define __CDIO_CONFIG_H__ 1
#endif #endif
/* This is the UDF image. */ /* This is the UDF image. */
@@ -36,12 +36,9 @@
#define UDF_FILENAME "/COPYING" #define UDF_FILENAME "/COPYING"
#define LOCAL_FILENAME "copying" #define LOCAL_FILENAME "copying"
#include <sys/types.h> #ifdef HAVE_STDIO_H
#include <cdio/cdio.h>
#include <cdio/udf.h>
#include <stdio.h> #include <stdio.h>
#endif
#ifdef HAVE_ERRNO_H #ifdef HAVE_ERRNO_H
#include <errno.h> #include <errno.h>
#endif #endif
@@ -58,6 +55,9 @@
#include <sys/types.h> #include <sys/types.h>
#endif #endif
#include <cdio/cdio.h>
#include <cdio/udf.h>
#define CEILING(x, y) ((x+(y-1))/y) #define CEILING(x, y) ((x+(y-1))/y)
#define udf_PATH_DELIMITERS "/\\" #define udf_PATH_DELIMITERS "/\\"