/* * cueprint.c -- print cd information based on a template * * Copyright (C) 2004, 2005, 2006, 2007, 2013 Svend Sorensen * For license terms, see the file COPYING in this distribution. */ #include /* isdigit() */ #include /* getopt_long() */ #include /* fprintf(), printf(), snprintf(), stderr */ #include /* exit() */ #include /* strcasecmp() */ #include "cuefile.h" #if HAVE_CONFIG_H #include "config.h" #else /* not HAVE_CONFIG_H */ #define PACKAGE_STRING "cueprint" #endif /* HAVE_CONFIG_H */ /* default templates */ #define D_TEMPLATE "\ Disc Information\n\ arranger: %A\n\ composer: %C\n\ genre: %G\n\ message: %M\n\ no. of tracks: %N\n\ performer: %P\n\ songwriter: %S\n\ title: %T\n\ UPC/EAN: %U\n\ " #define T_TEMPLATE "\ \n\ Track %n Information\n\ arranger: %a\n\ composer: %c\n\ genre: %g\n\ ISRC: %i\n\ message: %m\n\ track number: %n\n\ perfomer: %p\n\ title: %t\n\ ISRC (CD-TEXT): %u\n\ " /* default string to print for unset (NULL) values */ #define VALUE_UNSET "" /* * *_get_* functions can return an int or a char * */ typedef union { int ival; char *sval; char cval; } Value; char *progname; /* Print usage information and exit */ void usage(int status) { if (0 == status) { printf("Usage: %s [option...] [file...]\n", progname); printf("Report disc and track information from a CUE or TOC file.\n" "\n" "OPTIONS\n" "-h, --help print usage\n" "-i, --input-format cue|toc set format of file(s)\n" "-n, --track-number only print track information for single track\n" "-d, --disc-template