add my own driver for the NEC FC20X2JA display to lcd4linux
[openwrt.git] / openwrt / package / busybox / patches / 300-netmsg.patch
1 diff -urN busybox.old/include/applets.h busybox.dev/include/applets.h
2 --- busybox.old/include/applets.h 2006-01-11 01:32:47.302791000 +0100
3 +++ busybox.dev/include/applets.h 2006-01-11 01:33:18.744756250 +0100
4 @@ -475,6 +475,9 @@
5 #ifdef CONFIG_NC
6 APPLET(nc, nc_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER)
7 #endif
8 +#ifdef CONFIG_NETMSG
9 + APPLET_NOUSAGE("netmsg", netmsg_main, _BB_DIR_BIN, _BB_SUID_ALWAYS)
10 +#endif
11 #ifdef CONFIG_NETSTAT
12 APPLET(netstat, netstat_main, _BB_DIR_BIN, _BB_SUID_NEVER)
13 #endif
14 diff -urN busybox.old/networking/Config.in busybox.dev/networking/Config.in
15 --- busybox.old/networking/Config.in 2005-11-01 00:55:15.000000000 +0100
16 +++ busybox.dev/networking/Config.in 2006-01-11 01:33:18.744756250 +0100
17 @@ -435,6 +435,12 @@
18 help
19 A simple Unix utility which reads and writes data across network
20 connections.
21 +
22 +config CONFIG_NETMSG
23 + bool "netmsg"
24 + default n
25 + help
26 + simple program for sending udp broadcast messages
27
28 config CONFIG_NC_GAPING_SECURITY_HOLE
29 bool "gaping security hole"
30 diff -urN busybox.old/networking/Makefile.in busybox.dev/networking/Makefile.in
31 --- busybox.old/networking/Makefile.in 2005-11-01 00:55:15.000000000 +0100
32 +++ busybox.dev/networking/Makefile.in 2006-01-11 01:34:02.939518250 +0100
33 @@ -28,6 +28,7 @@
34 NETWORKING-$(CONFIG_IPTUNNEL) += iptunnel.o
35 NETWORKING-$(CONFIG_NAMEIF) += nameif.o
36 NETWORKING-$(CONFIG_NC) += nc.o
37 +NETWORKING-$(CONFIG_NETMSG) += netmsg.o
38 NETWORKING-$(CONFIG_NETSTAT) += netstat.o
39 NETWORKING-$(CONFIG_NSLOOKUP) += nslookup.o
40 NETWORKING-$(CONFIG_PING) += ping.o
41 diff -urN busybox.old/networking/netmsg.c busybox.dev/networking/netmsg.c
42 --- busybox.old/networking/netmsg.c 1970-01-01 01:00:00.000000000 +0100
43 +++ busybox.dev/networking/netmsg.c 2006-01-11 01:33:18.748756500 +0100
44 @@ -0,0 +1,58 @@
45 +#include <sys/types.h>
46 +#include <sys/socket.h>
47 +#include <netinet/in.h>
48 +#include <netdb.h>
49 +#include <stdio.h>
50 +#include <stdlib.h>
51 +#include <string.h>
52 +#include "busybox.h"
53 +
54 +
55 +#ifndef CONFIG_NETMSG
56 +int main(int argc, char **argv)
57 +#else
58 +int netmsg_main(int argc, char **argv)
59 +#endif
60 +{
61 + int s, i;
62 + struct sockaddr_in addr;
63 + int optval = 1;
64 + unsigned char buf[1001];
65 +
66 + if (argc != 3) {
67 + fprintf(stderr, "usage: %s <ip> \"<message>\"\n", argv[0]);
68 + exit(1);
69 + }
70 +
71 + if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
72 + perror("Opening socket");
73 + exit(1);
74 + }
75 +
76 + memset(&addr, 0, sizeof(addr));
77 + addr.sin_family = AF_INET;
78 + addr.sin_addr.s_addr = inet_addr(argv[1]);
79 + addr.sin_port = htons(0x1337);
80 +
81 + memset(buf, 0, 1001);
82 + buf[0] = 0xde;
83 + buf[1] = 0xad;
84 +
85 + strncpy(buf + 2, argv[2], 998);
86 +
87 + if (setsockopt (s, SOL_SOCKET, SO_BROADCAST, (caddr_t) &optval, sizeof (optval)) < 0) {
88 + perror("setsockopt()");
89 + goto fail;
90 + }
91 +
92 + if (sendto(s, buf, 1001, 0, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
93 + perror("sendto()");
94 + goto fail;
95 + }
96 +
97 + return 0;
98 +
99 +fail:
100 + close(s);
101 + exit(1);
102 +}
This page took 0.048205 seconds and 5 git commands to generate.