Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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.
  • Loading branch information...
commit 3353241a79f0e2b130dce5e98d656284a7da84f8 1 parent 49dcacb
William authored

Showing 3 changed files with 18 additions and 2 deletions. Show diff stats Hide diff stats

  1. +11 1 cli.c
  2. +6 0 espeakup.8
  3. +1 1  espeakup.c
12 cli.c
@@ -24,12 +24,16 @@
24 24
25 25 #include "espeakup.h"
26 26
  27 +/* pid path */
  28 +extern char *pidPath;
  29 +
27 30 /* default voice */
28 31 extern char *defaultVoice;
29 32
30 33 /* command line options */
31   -const char *shortOptions = "dhV:v";
  34 +const char *shortOptions = "P:V:dhv";
32 35 const struct option longOptions[] = {
  36 + {"pid-path", required_argument, NULL, 'P'},
33 37 {"default-voice", required_argument, NULL, 'V'},
34 38 {"debug", no_argument, NULL, 'd'},
35 39 {"help", no_argument, NULL, 'h'},
@@ -61,10 +65,16 @@ static void show_version(void)
61 65 void process_cli(int argc, char **argv)
62 66 {
63 67 int opt;
  68 + char *cp;
64 69
65 70 do {
66 71 opt = getopt_long(argc, argv, shortOptions, longOptions, NULL);
67 72 switch (opt) {
  73 + case 'p':
  74 + cp = strdup(optarg);
  75 + if (cp != NULL)
  76 + pidPath = cp;
  77 + break;
68 78 case 'V':
69 79 defaultVoice = strdup(optarg);
70 80 break;
6 espeakup.8
@@ -9,6 +9,9 @@ espeakup \(em connect Speakup to the ESpeak TTS engine
9 9 .SH SYNOPSIS
10 10 .B espeakup
11 11 [
  12 +.B \-\^\-pid-path=path
  13 +]
  14 +[
12 15 .B \-\^\-default-voice=voicename
13 16 ]
14 17 [
@@ -22,6 +25,9 @@ espeakup \(em connect Speakup to the ESpeak TTS engine
22 25 ]
23 26 .SH OPTIONS
24 27 .TP
  28 +.B \-P path, \-\^\-pid-path=path
  29 +Set the full path for the pid file espeakup uses when in daemon mode.
  30 +.TP
25 31 .B \-V voicename, \-\^\-default-voice=voicename
26 32 Set the espeak voice to be used by default.
27 33 .TP
2  espeakup.c
@@ -27,7 +27,7 @@
27 27 #include "espeakup.h"
28 28
29 29 /* path to our pid file */
30   -const char *pidPath = "/var/run/espeakup.pid";
  30 +char *pidPath = "/var/run/espeakup.pid";
31 31
32 32 int debug = 0;
33 33 struct queue_t *synth_queue = NULL;

0 comments on commit 3353241

Please sign in to comment.
Something went wrong with that request. Please try again.