2 ** Copyright (C) 2005-2011 Erik de Castro Lopo
4 ** This program is free software; you can redistribute it and/or modify
5 ** it under the terms of the GNU General Public License as published by
6 ** the Free Software Foundation; either version 2 of the License, or
7 ** (at your option) any later version.
9 ** This program is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ** GNU General Public License for more details.
14 ** You should have received a copy of the GNU General Public License
15 ** along with this program; if not, write to the Free Software
16 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 { OPT_ADD_FILE
= 0x0100,
33 OPT_CREATE_DB
= 0x0200,
34 OPT_DEL_ENTRY
= 0x0400,
35 OPT_LIST_ALL
= 0x0800,
36 OPT_TEST_ALL
= 0x1000,
40 static void print_libsndfile_version (void) ;
43 main (int argc
, char * argv
[])
44 { const char *db_name
= "./.sndfile-regtest.db" ;
49 { printf ("\nUsage message goes here.\n\n") ;
53 if (argc
== 2 && strcmp (argv
[1], "--create-db") == 0)
54 return db_create (db_name
) ;
56 reg_db
= db_open (db_name
) ;
59 { if (strcmp (argv
[1], "--list-all") == 0)
60 return db_list_all (reg_db
) ;
62 if (strcmp (argv
[1], "--check-all") == 0)
63 { print_libsndfile_version () ;
64 retval
= db_check_all (reg_db
) ;
70 if (argc
== 3 && strcmp (argv
[1], "--del-entry") == 0)
71 { db_del_entry (reg_db
, argv
[2]) ;
76 if (strcmp (argv
[1], "--check-file") == 0)
77 { print_libsndfile_version () ;
79 for (k
= 2 ; k
< argc
; k
++)
80 db_check_file (reg_db
, argv
[k
]) ;
85 if (strcmp (argv
[1], "--add-file") == 0)
86 { print_libsndfile_version () ;
88 for (k
= 2 ; k
< argc
; k
++)
89 db_add_file (reg_db
, argv
[k
]) ;
94 printf ("\nError : unhandled command line args :") ;
95 for (k
= 1 ; k
< argc
; k
++)
96 printf (" %s", argv
[k
]) ;
103 print_libsndfile_version (void)
104 { char version
[64] ;
106 sf_command (NULL
, SFC_GET_LIB_VERSION
, version
, sizeof (version
)) ;
107 printf ("\nsndfile-regtest : using %s\n\n", version
) ;
108 } /* print_lib_version */
115 puts ("\nThis program was not compiled with libsqlite3 and hence doesn't work.\n") ;