]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/misc-progs/upnpctrl.c
9 #define BUFFER_SIZE 1024
11 char command
[BUFFER_SIZE
];
13 int main(int argc
, char *argv
[])
19 // Check what command is asked
22 fprintf (stderr
, "Missing smbctrl command!\n");
26 if (strcmp(argv
[1], "upnpstart")==0)
28 snprintf(command
, BUFFER_SIZE
-1, "route add -net 239.0.0.0 netmask 255.0.0.0 %s", argv
[3]);
31 snprintf(command
, BUFFER_SIZE
-1, "/usr/sbin/upnpd %s %s", argv
[2], argv
[3] );
37 if (strcmp(argv
[1], "upnpstop")==0)
39 snprintf(command
, BUFFER_SIZE
-1, "killall upnpd");
42 snprintf(command
, BUFFER_SIZE
-1, "route del -net 239.0.0.0 netmask 255.0.0.0 %s", argv
[3]);
47 if (strcmp(argv
[1], "upnpxml")==0)
49 snprintf(command
, BUFFER_SIZE
-1, "sed 's/\<friendlyName\>.*\<\/friendlyName\>/\<friendlyName\>%s\<\/friendlyName\>/gi' %s/%s > tmp && mv tmp %s/%s", argv
[2], argv
[3], argv
[4], argv
[3], argv
[4]);