brken buffer for printed irda address, reported by Christoph Bartelmus
[oss-qm-packages.git] / lib / irda.c
blob598e6f01bdb2fe9fb68a6b925d41a6838cfc953c
1 /*********************************************************************
2 *
3 * Filename: irda.c
4 * Version: 0.2
5 * Description: A second attempt to make ifconfig understand IrDA
6 * Status: Experimental.
7 * Author: Dag Brattli <dagb@cs.uit.no>
8 * Created at: Wed Apr 21 09:03:09 1999
9 * Modified at: Wed Apr 21 09:17:05 1999
10 * Modified by: Dag Brattli <dagb@cs.uit.no>
11 * Modified at: Wed May 1 11:51:44 CEST 2002
12 * Modified by: Christoph Bartelmus <christoph@bartelmus.de>
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * MA 02111-1307 USA
29 ********************************************************************/
31 #include "config.h"
33 #if HAVE_AFIRDA || HAVE_HWIRDA
34 #include <sys/types.h>
35 #include <sys/ioctl.h>
36 #include <sys/socket.h>
37 #include <net/if_arp.h>
38 #include <stdlib.h>
39 #include <stdio.h>
40 #include <ctype.h>
41 #include <errno.h>
42 #include <fcntl.h>
43 #include <string.h>
44 #include <termios.h>
45 #include <unistd.h>
46 #include "net-support.h"
47 #include "pathnames.h"
48 #include "intl.h"
49 #include "util.h"
51 /* Probably not a good idea to include <linux/if_arp.h> */
52 #ifndef ARPHRD_IRDA
53 #define ARPHRD_IRDA 783
54 #endif
57 * Function irda_print (ptr)
59 * Print hardware address of interface
62 static char *irda_print(unsigned char *ptr)
64 static char buff[12];
66 snprintf(buff, 12, "%02x:%02x:%02x:%02x", ptr[3], ptr[2],
67 ptr[1], ptr[0]);
69 return (buff);
72 struct hwtype irda_hwtype =
74 "irda", NULL, ARPHRD_IRDA, 2,
75 irda_print, NULL, NULL, 0
78 #endif /* HAVE_xxIRDA */