]>
Commit | Line | Data |
---|---|---|
1 | /* This file is part of the Wake-on-LAN GUI AddOn | |
2 | * | |
3 | * This program is distributed under the terms of the GNU General Public | |
4 | * Licence. See the file COPYING for details. | |
5 | * | |
6 | * Copyright (C) 2006-03-03 weizen_42 | |
7 | * | |
8 | * | |
9 | */ | |
10 | ||
11 | #include <stdio.h> | |
12 | #include <string.h> | |
13 | #include <unistd.h> | |
14 | #include <stdlib.h> | |
15 | #include <sys/types.h> | |
16 | #include <fcntl.h> | |
17 | #include "setuid.h" | |
18 | ||
19 | ||
20 | #define BUFFER_SIZE 512 | |
21 | ||
22 | char command[BUFFER_SIZE]; | |
23 | ||
24 | int main(int argc, char *argv[]) | |
25 | { | |
26 | if (!(initsetuid())) | |
27 | exit(1); | |
28 | ||
29 | snprintf(command, BUFFER_SIZE-1, "/usr/sbin/etherwake -i %s %s", argv[2], argv[1]); | |
30 | safe_system(command); | |
31 | ||
32 | /* Send magic packet with broadcast flag set. */ | |
33 | snprintf(command, BUFFER_SIZE-1, "/usr/sbin/etherwake -i %s -b %s", argv[2], argv[1]); | |
34 | safe_system(command); | |
35 | ||
36 | return(0); | |
37 | } |