torctrl: Add stop action.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 31 Jul 2013 10:55:08 +0000 (12:55 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 31 Jul 2013 10:55:08 +0000 (12:55 +0200)
src/misc-progs/Makefile
src/misc-progs/torctrl.c

index df5a3703846d548976aed0707f8c8ad328e9d6b1..4d09fbf65d2a2685c6c8341d0c3981beb78ab5dd 100644 (file)
@@ -165,5 +165,5 @@ wirelessclient: wirelessclient.c setuid.o ../install+setup/libsmooth/varval.o
 dnsmasqctrl: dnsmasqctrl.c setuid.o ../install+setup/libsmooth/varval.o
        $(COMPILE) -I../install+setup/libsmooth/ dnsmasqctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
 
-torctrl: toctrl.c setuid.o ../install+setup/libsmooth/varval.o
+torctrl: torctrl.c setuid.o ../install+setup/libsmooth/varval.o
        $(COMPILE) -I../install+setup/libsmooth/ torctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
index 686a8da4025dea2ae2cb4162b0cdd7a379c94ea1..39d49561d69650d18b83a52bb018739402be7bb9 100644 (file)
@@ -17,14 +17,18 @@ int main(int argc, char *argv[]) {
                exit(1);
 
        if (argc < 2) {
-               fprintf(stderr, "\nNo argument given.\n\ntorctrl (restart)\n\n");
+               fprintf(stderr, "\nNo argument given.\n\ntorctrl (restart|stop)\n\n");
                exit(1);
        }
 
        if (strcmp(argv[1], "restart") == 0) {
                safe_system("/etc/rc.d/init.d/tor reload-or-restart");
+
+       } else if (strcmp(argv[1], "stop") == 0) {
+               safe_system("/etc/rc.d/init.d/tor stop");
+
        } else {
-               fprintf(stderr, "\nBad argument given.\n\ntorctrl (restart)\n\n");
+               fprintf(stderr, "\nBad argument given.\n\ntorctrl (restart|stop)\n\n");
                exit(1);
        }