From 65f0d981e66f5348e09324873fc5f62bcf71e4c1 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Wed, 1 Oct 2008 20:57:15 +1000 Subject: [PATCH] examples/sndfile-metadata-(get|set).c : Add usage messages. --- ChangeLog | 3 +++ examples/sndfile-metadata-get.c | 26 +++++++++++++++--- examples/sndfile-metadata-set.c | 47 ++++++++++++++++++++++++++++++--- 3 files changed, 70 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b1f4ce81..24939583 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,9 @@ Remove --bext-coding-history-append command line option because it didn't really make sense. + * examples/sndfile-metadata-(get|set).c + Add usage messages. + 2008-09-30 Erik de Castro Lopo * README doc/win32.html diff --git a/examples/sndfile-metadata-get.c b/examples/sndfile-metadata-get.c index 4818db40..5ece5757 100644 --- a/examples/sndfile-metadata-get.c +++ b/examples/sndfile-metadata-get.c @@ -63,7 +63,7 @@ main (int argc, char *argv []) progname = progname ? progname + 1 : argv [0] ; /* Check if we've been asked for help. */ - if (argc < 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0) + if (argc <= 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0) usage_exit (progname, 0) ; if (argv [argc - 1][0] != '-') @@ -100,8 +100,28 @@ main (int argc, char *argv []) static void usage_exit (const char *progname, int exit_code) -{ printf ("Usage :\n %s ...\n", progname) ; - printf (" Fill in more later.\n\n") ; +{ printf ("\nUsage :\n %s [options] \n\nOptions:\n", progname) ; + + puts ( + " --bext-description Print the 'bext' description.\n" + " --bext-originator Print the 'bext; originator info.\n" + " --bext-orig-ref Print the 'bext' origination reference.\n" + " --bext-umid Print the 'bext' UMID.\n" + " --bext-orig-date Print the 'bext' origination date.\n" + " --bext-orig-time Print the 'bext' origination time.\n" + " --bext-coding-hist Print the 'bext' coding history.\n" + ) ; + + puts ( + " --str-title Print the title metadata.\n" + " --str-copyright Print the copyright metadata.\n" + " --str-artist Print the artist metadata.\n" + " --str-comment Print the comment metadata.\n" + " --str-date Print the creation date metadata.\n" + " --str-album Print the album metadata.\n" + " --str-license Print the license metadata.\n" + ) ; + exit (exit_code) ; } /* usage_exit */ diff --git a/examples/sndfile-metadata-set.c b/examples/sndfile-metadata-set.c index 55089b1f..8cfc96ca 100644 --- a/examples/sndfile-metadata-set.c +++ b/examples/sndfile-metadata-set.c @@ -114,7 +114,6 @@ main (int argc, char *argv []) HANDLE_STR_ARG ("--str-title", title) ; HANDLE_STR_ARG ("--str-copyright", copyright) ; HANDLE_STR_ARG ("--str-artist", artist) ; - HANDLE_STR_ARG ("--str-copyright", copyright) ; HANDLE_STR_ARG ("--str-date", date) ; HANDLE_STR_ARG ("--str-album", album) ; HANDLE_STR_ARG ("--str-license", license) ; @@ -181,8 +180,50 @@ main (int argc, char *argv []) static void usage_exit (const char *progname, int exit_code) -{ printf ("Usage :\n %s ...\n", progname) ; - printf (" Fill in more later.\n\n") ; +{ printf ("\nUsage :\n\n" + " %s [options] \n" + " %s [options] \n" + "\n", + progname, progname) ; + + puts ( + "Where an option is made up of a pair of a field to set (one of\n" + "the 'bext' or metadata fields below) and a string. Fields are\n" + "as follows :\n" + ) ; + + puts ( + " --bext-description Set the 'bext' description.\n" + " --bext-originator Set the 'bext' originator.\n" + " --bext-orig-ref Set the 'bext' originator reference.\n" + " --bext-umid Set the 'bext' UMID.\n" + " --bext-orig-date Set the 'bext' origination date.\n" + " --bext-orig-time Set the 'bext' origination time.\n" + " --bext-coding-hist Set the 'bext' coding history\n" + "\n" + " --str-title Set the metadata title.\n" + " --str-copyright Set the metadata copyright.\n" + " --str-artist Set the metadata artist.\n" + " --str-date Set the metadata date.\n" + " --str-album Set the metadata album.\n" + " --str-license Set the metadata license.\n" + ) ; + + puts ( + "There are also the following arguments which do not take a\n" + "parameter :\n\n" + " --bext-auto-time-date Set the 'bext' time and date to current time/date.\n" + " --bext-auto-time Set the 'bext' time to current time.\n" + " --bext-auto-date Set the 'bext' date to current date.\n" + " --str-auto-date Set the metadata date to current date.\n" + ) ; + + puts ( + "Most of the above operations can be done in-place on an existing\n" + "file. If any operation cannot be performed, the application will\n" + "exit with an appropriate error message.\n" + ) ; + exit (exit_code) ; } /* usage_exit */