simple patch from Ajax <ajax@firest0rm.org> (corrected) to print DDP
[oss-qm-packages.git] / lib / ddp.c
blob9b5e829dd55b61d70b007693d78ef0ce68dbcc3b
1 /*
2 * DDP protocol output functions.
3 * [Not yet input]
5 * Alan Cox <Alan.Cox@linux.org>
7 * $Id: ddp.c,v 1.6 1998/11/19 13:01:55 philip Exp $
9 * This program is free software; you can redistribute it
10 * and/or modify it under the terms of the GNU General
11 * Public License as published by the Free Software
12 * Foundation; either version 2 of the License, or (at
13 * your option) any later version.
15 #include "config.h"
17 #if HAVE_AFATALK
18 #include <asm/types.h>
19 #include <sys/types.h>
20 #include <sys/socket.h>
21 #include <linux/atalk.h>
22 #include <stdlib.h>
23 #include <stdio.h>
24 #include <errno.h>
25 #include <ctype.h>
26 #include <string.h>
27 #include <unistd.h>
28 #include <netinet/in.h>
29 #include "net-support.h"
30 #include "pathnames.h"
31 #include "intl.h"
32 #include "util.h"
34 /* Display a ddp domain address. */
35 static char *ddp_print(unsigned char *ptr)
37 static char buff[64];
38 struct sockaddr_at *sat = (struct sockaddr_at *) (ptr - 2);
39 sprintf(buff, "%d/%d", (int) ntohs(sat->sat_addr.s_net), (int) sat->sat_addr.s_node);
40 return (buff);
44 /* Display a ddp domain address. */
45 static char *ddp_sprint(struct sockaddr *sap, int numeric)
47 static char buf[64];
49 if (sap->sa_family != AF_APPLETALK)
50 return safe_strncpy(buf, _("[NONE SET]"), sizeof(buf));
51 return (ddp_print(sap->sa_data));
55 struct aftype ddp_aftype =
57 "ddp", NULL, /*"Appletalk DDP", */ AF_APPLETALK, 0,
58 ddp_print, ddp_sprint, NULL, NULL,
59 NULL /*DDP_rprint */ , NULL, NULL,
60 -1,
61 "/proc/net/appletalk"
64 #endif