pakfire: use correct tree on x86_64.
[ipfire-2.x.git] / src / misc-progs / launch-ether-wake.c
CommitLineData
4e565351
MT
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
22char command[BUFFER_SIZE];
23
24int main(int argc, char *argv[])
25{
26 if (!(initsetuid()))
27 exit(1);
28
20e891c6 29 snprintf(command, BUFFER_SIZE-1, "/usr/sbin/etherwake -i %s %s", argv[2], argv[1]);
4e565351
MT
30 safe_system(command);
31
f9f13c13
MT
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
4e565351
MT
36 return(0);
37}