mirror of
https://github.com/linux-speakup/espeakup.git
synced 2026-08-20 14:54:17 +02:00
add command line option to change the pid path
This adds a -P or --pid-path option to the command line which allows the user to change the path and the name of the pid file created when espeakup is running as a daemon. I would like to thank Chris Brannon for the original idea for this.
This commit is contained in:
parent
49dcacb2ec
commit
3353241a79
3 changed files with 18 additions and 2 deletions
12
cli.c
12
cli.c
|
|
@ -24,12 +24,16 @@
|
|||
|
||||
#include "espeakup.h"
|
||||
|
||||
/* pid path */
|
||||
extern char *pidPath;
|
||||
|
||||
/* default voice */
|
||||
extern char *defaultVoice;
|
||||
|
||||
/* command line options */
|
||||
const char *shortOptions = "dhV:v";
|
||||
const char *shortOptions = "P:V:dhv";
|
||||
const struct option longOptions[] = {
|
||||
{"pid-path", required_argument, NULL, 'P'},
|
||||
{"default-voice", required_argument, NULL, 'V'},
|
||||
{"debug", no_argument, NULL, 'd'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
|
|
@ -61,10 +65,16 @@ static void show_version(void)
|
|||
void process_cli(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
char *cp;
|
||||
|
||||
do {
|
||||
opt = getopt_long(argc, argv, shortOptions, longOptions, NULL);
|
||||
switch (opt) {
|
||||
case 'p':
|
||||
cp = strdup(optarg);
|
||||
if (cp != NULL)
|
||||
pidPath = cp;
|
||||
break;
|
||||
case 'V':
|
||||
defaultVoice = strdup(optarg);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ espeakup \(em connect Speakup to the ESpeak TTS engine
|
|||
.SH SYNOPSIS
|
||||
.B espeakup
|
||||
[
|
||||
.B \-\^\-pid-path=path
|
||||
]
|
||||
[
|
||||
.B \-\^\-default-voice=voicename
|
||||
]
|
||||
[
|
||||
|
|
@ -22,6 +25,9 @@ espeakup \(em connect Speakup to the ESpeak TTS engine
|
|||
]
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-P path, \-\^\-pid-path=path
|
||||
Set the full path for the pid file espeakup uses when in daemon mode.
|
||||
.TP
|
||||
.B \-V voicename, \-\^\-default-voice=voicename
|
||||
Set the espeak voice to be used by default.
|
||||
.TP
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "espeakup.h"
|
||||
|
||||
/* path to our pid file */
|
||||
const char *pidPath = "/var/run/espeakup.pid";
|
||||
char *pidPath = "/var/run/espeakup.pid";
|
||||
|
||||
int debug = 0;
|
||||
struct queue_t *synth_queue = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue