[Glibc-bsd-commits] r2847 - in trunk/freebsd-utils/debian: . patches
Petr Salinger
ps-guest at alioth.debian.org
Mon Nov 16 18:52:19 UTC 2009
Author: ps-guest
Date: 2009-11-16 18:52:19 +0000 (Mon, 16 Nov 2009)
New Revision: 2847
Modified:
trunk/freebsd-utils/debian/control
trunk/freebsd-utils/debian/patches/020_lib.diff
Log:
preparation for netstat
Modified: trunk/freebsd-utils/debian/control
===================================================================
--- trunk/freebsd-utils/debian/control 2009-11-16 18:51:08 UTC (rev 2846)
+++ trunk/freebsd-utils/debian/control 2009-11-16 18:52:19 UTC (rev 2847)
@@ -5,7 +5,7 @@
Uploaders: Aurelien Jarno <aurel32 at debian.org>, Guillem Jover <guillem at debian.org>
Build-Depends: debhelper (>= 7), quilt, po-debconf, freebsd-buildutils,
libkvm-dev (>= 8.0), libbsd-dev (>= 0.0-1.2), libc0.1-dev (>= 2.10.1),
- flex | flex-old, kfreebsd-kernel-headers (>= 0.31),
+ flex | flex-old, kfreebsd-kernel-headers (>= 0.43), libmemstat-dev,
libipx-dev, libkiconv-dev, libgeom-dev, libdevstat-dev, libsbuf-dev
# libkvm-dev: dmesg
# libgeom-dev : ccdconfig
Modified: trunk/freebsd-utils/debian/patches/020_lib.diff
===================================================================
--- trunk/freebsd-utils/debian/patches/020_lib.diff 2009-11-16 18:51:08 UTC (rev 2846)
+++ trunk/freebsd-utils/debian/patches/020_lib.diff 2009-11-16 18:52:19 UTC (rev 2847)
@@ -1,7 +1,9 @@
---- a/lib/Makefile
-+++ b/lib/Makefile
+Index: freebsd-utils/lib/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ freebsd-utils/lib/Makefile 2009-11-16 18:35:28.000000000 +0000
@@ -0,0 +1,12 @@
-+SRCS = linkaddr.c
++SRCS = linkaddr.c trimdomain.c
+
+OBJS = $(SRCS:%.c=%.o)
+
@@ -10,11 +12,13 @@
+
+all: $(OBJS)
+
-+clean:
-+ rm -f $(OBJS)
++clean:
++ rm -f $(OBJS)
+
---- a/lib/linkaddr.c
-+++ b/lib/linkaddr.c
+Index: freebsd-utils/lib/linkaddr.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ freebsd-utils/lib/linkaddr.c 2009-11-16 18:17:58.000000000 +0000
@@ -0,0 +1,155 @@
+/*-
+ * Copyright (c) 1990, 1993
@@ -171,8 +175,10 @@
+ *out = 0;
+ return (obuf);
+}
---- a/lib/linkaddr.h
-+++ b/lib/linkaddr.h
+Index: freebsd-utils/lib/linkaddr.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ freebsd-utils/lib/linkaddr.h 2009-11-16 18:17:58.000000000 +0000
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 1990, 1993
@@ -206,3 +212,121 @@
+void link_addr(const char *addr, struct sockaddr_dl *sdl);
+
+char *link_ntoa(const struct sockaddr_dl *sdl);
+Index: freebsd-utils/lib/trimdomain.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ freebsd-utils/lib/trimdomain.c 2009-11-16 18:35:00.000000000 +0000
+@@ -0,0 +1,113 @@
++/*-
++ * Copyright (c) 2001 Brian Somers <brian at Awfulhak.org>
++ * Based on original work by Atsushi Murai <amurai at FreeBSD.org>
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ *
++ */
++
++#include <sys/cdefs.h>
++#include <sys/param.h>
++
++#include <libutil.h>
++#include <string.h>
++#include <unistd.h>
++
++static int isDISP(const char *);
++
++/*-
++ * Trim the current domain name from fullhost, but only if the result
++ * is less than or equal to hostsize in length.
++ *
++ * This function understands $DISPLAY type fullhosts.
++ *
++ * For example:
++ *
++ * trimdomain("abcde.my.domain", 5) -> "abcde"
++ * trimdomain("abcde.my.domain", 4) -> "abcde.my.domain"
++ * trimdomain("abcde.my.domain:0.0", 9) -> "abcde:0.0"
++ * trimdomain("abcde.my.domain:0.0", 8) -> "abcde.my.domain:0.0"
++ */
++void
++trimdomain(char *fullhost, int hostsize)
++{
++ static size_t dlen;
++ static int first = 1;
++ static char domain[MAXHOSTNAMELEN];
++ char *end, *s;
++ size_t len;
++
++ if (first) {
++ /* XXX: Should we assume that our domain is this persistent ? */
++ first = 0;
++ if (gethostname(domain, sizeof(domain) - 1) == 0 &&
++ (s = strchr(domain, '.')) != NULL)
++ memmove(domain, s + 1, strlen(s + 1) + 1);
++ else
++ domain[0] = '\0';
++ dlen = strlen(domain);
++ }
++
++ if (domain[0] == '\0')
++ return;
++
++ s = fullhost;
++ end = s + hostsize + 1;
++ if ((s = memchr(s, '.', (size_t)(end - s))) != NULL) {
++ if (strncasecmp(s + 1, domain, dlen) == 0) {
++ if (s[dlen + 1] == '\0') {
++ /* Found -- lose the domain. */
++ *s = '\0';
++ } else if (s[dlen + 1] == ':' &&
++ isDISP(s + dlen + 2) &&
++ (len = strlen(s + dlen + 1)) < (size_t)(end - s)) {
++ /* Found -- shuffle the DISPLAY back. */
++ memmove(s, s + dlen + 1, len + 1);
++ }
++ }
++ }
++}
++
++/*
++ * Is the given string NN or NN.NN where ``NN'' is an all-numeric string ?
++ */
++static int
++isDISP(const char *disp)
++{
++ size_t w;
++ int res;
++
++ w = strspn(disp, "0123456789");
++ res = 0;
++ if (w > 0) {
++ if (disp[w] == '\0')
++ res = 1; /* NN */
++ else if (disp[w] == '.') {
++ disp += w + 1;
++ w = strspn(disp, "0123456789");
++ if (w > 0 && disp[w] == '\0')
++ res = 1; /* NN.NN */
++ }
++ }
++ return (res);
++}
More information about the Glibc-bsd-commits
mailing list