summaryrefslogtreecommitdiff
path: root/muggle-plugin/muggle.c
diff options
context:
space:
mode:
authorwr61 <wr61@e10066b5-e1e2-0310-b819-94efdf66514b>2005-03-09 18:51:21 +0000
committerwr61 <wr61@e10066b5-e1e2-0310-b819-94efdf66514b>2005-03-09 18:51:21 +0000
commita09d656b90c2355ebf2a38bfaf036a3e1defa1ee (patch)
tree75e31c0d2ec4f71bffe77593679ff595182702b6 /muggle-plugin/muggle.c
parent806a02f87d720494b1b23781f23107ca1f45991e (diff)
downloadvdr-plugin-muggle-a09d656b90c2355ebf2a38bfaf036a3e1defa1ee.tar.gz
vdr-plugin-muggle-a09d656b90c2355ebf2a38bfaf036a3e1defa1ee.tar.bz2
rename HAVE_SERVER to HAVE_ONLY_SERVER, simplify connect, replace USE SQL by sql_select_db
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/branches/0.1.4-wr@560 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'muggle-plugin/muggle.c')
-rw-r--r--muggle-plugin/muggle.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/muggle-plugin/muggle.c b/muggle-plugin/muggle.c
index 7259078..d6bbcc7 100644
--- a/muggle-plugin/muggle.c
+++ b/muggle-plugin/muggle.c
@@ -50,14 +50,14 @@ mgMuggle::mgMuggle (void)
main = NULL;
// defaults for database arguments
the_setup.DbHost = strdup ("localhost");
- the_setup.DbSocket = NULL;
+ the_setup.DbSocket = 0;
the_setup.DbPort = 0;
the_setup.DbName = strdup ("GiantDisc");
- the_setup.DbUser = strdup ("");
- the_setup.DbPass = strdup ("");
+ the_setup.DbUser = 0;
+ the_setup.DbPass = 0;
the_setup.GdCompatibility = false;
the_setup.ToplevelDir = strdup ("/mnt/music/");
-#ifndef HAVE_SERVER
+#ifndef HAVE_ONLY_SERVER
char *buf;
asprintf(&buf,"%s/.muggle",getenv("HOME"));
set_datadir(buf);
@@ -85,18 +85,25 @@ mgMuggle::CommandLineHelp (void)
{
// Return a string that describes all known command line options.
return
+#ifdef HAVE_ONLY_SERVER
" -h HHHH, --host=HHHH specify database host (default is localhost)\n"
- " -s SSSS --socket=PATH specify database socket (default is TCP connection)\n"
+#else
+ " -h HHHH, --host=HHHH specify database host (default is mysql embedded)\n"
+#endif
+ " -s SSSS --socket=PATH specify database socket\n"
" -n NNNN, --name=NNNN specify database name (overridden by -g)\n"
" -p PPPP, --port=PPPP specify port of database server (default is )\n"
" -u UUUU, --user=UUUU specify database user (default is )\n"
" -w WWWW, --password=WWWW specify database password (default is empty)\n"
" -t TTTT, --toplevel=TTTT specify toplevel directory for music (default is /mnt/music)\n"
-#ifndef HAVE_SERVER
+#ifndef HAVE_ONLY_SERVER
" -d DIRN, --datadir=DIRN specify directory for embedded sql data (default is $HOME/.muggle)\n"
#endif
" -g, --giantdisc enable full Giantdisc compatibility mode\n"
- " -v, --verbose specify debug level. The higher the more. Default is 1\n";
+ " -v, --verbose specify debug level. The higher the more. Default is 1\n"
+ "\n"
+ "if the specified host is localhost, sockets will be used if possible.\n"
+ "Otherwise the -s parameter will be ignored";
}
@@ -115,7 +122,7 @@ bool mgMuggle::ProcessArgs (int argc, char *argv[])
{"port", required_argument, NULL, 'p'},
{"user", required_argument, NULL, 'u'},
{"password", required_argument, NULL, 'w'},
-#ifndef HAVE_SERVER
+#ifndef HAVE_ONLY_SERVER
{"datadir", required_argument, NULL, 'd'},
#endif
{"toplevel", required_argument, NULL, 't'},
@@ -127,7 +134,7 @@ bool mgMuggle::ProcessArgs (int argc, char *argv[])
c,
option_index = 0;
while ((c =
-#ifndef HAVE_SERVER
+#ifndef HAVE_ONLY_SERVER
getopt_long (argc, argv, "gh:s:n:p:t:u:w:d:v:", long_options,
#else
getopt_long (argc, argv, "gh:s:n:p:t:u:w:v:", long_options,
@@ -166,7 +173,7 @@ bool mgMuggle::ProcessArgs (int argc, char *argv[])
the_setup.DbPass = strcpyrealloc (the_setup.DbPass, optarg);
}
break;
-#ifndef HAVE_SERVER
+#ifndef HAVE_ONLY_SERVER
case 'd':
{
set_datadir(optarg);