Browse Source

-fix nameserver problem

-build with cdebconf-dev
-add -g when DEB_BUILD_OPTIONS tells me to
-remove libnetcfg stuff, it doesn't save space, maybe I make a unified netcfg
udeb some day

r525
master
David Whedon 22 years ago
parent
commit
abf9ed8c8a
  1. 36
      Makefile
  2. 6
      debian/changelog
  3. 2
      netcfg-dhcp.c
  4. 2
      netcfg-static.c
  5. 21
      netcfg.c
  6. 2
      netcfg.h

36
Makefile

@ -2,26 +2,22 @@ ifndef TARGETS
TARGETS=netcfg-dhcp netcfg-static
endif
MAJOR=0
MINOR=1
MICRO=0
LIB=libnetcfg.so
LIBNAME=libnetcfg.so.$(MAJOR).$(MINOR).$(MICRO)
SONAME=libnetcfg.so.$(MAJOR).$(MINOR)
LIBS=$(LIB) $(SONAME) $(LIBNAME)
INCS=-I../cdebconf/src/
LDOPTS=-L../cdebconf/src -ldebconf -Wl,-rpath,../cdebconf/src
#-L. -lnetcfg
LDOPTS=-ldebconf
PREFIX=$(DESTDIR)/usr/
CFLAGS=-Wall -Os -fomit-frame-pointer
CFLAGS=-Wall -Os
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -g
else
CFLAGS += -fomit-frame-pointer
endif
INSTALL=install
STRIPTOOL=strip
STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment
all: $(TARGETS)
#$(LIBS)
netcfg-dhcp netcfg-static: netcfg-dhcp.c utils.o netcfg.o
$(CC) $(CFLAGS) $@.c -o $@ $(INCS) $(LDOPTS) utils.o netcfg.o
$(STRIP) $@
@ -31,14 +27,8 @@ netcfg.o: netcfg.c
$(CC) -c $(CFLAGS) netcfg.c -o $@ $(INCS)
$(LIBNAME): netcfg.c
@echo Creating $(LIBNAME)
$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $^ $(INCS)
size $@
$(SONAME) $(LIB): $(LIBNAME)
@ln -sf $^ $@
test: netcfg.o
cc -g test.c netcfg.o -o test
clean:
rm -f netcfg-dhcp netcfg-static *.o $(LIBS)
rm -f netcfg-dhcp netcfg-static *.o

6
debian/changelog

@ -1,3 +1,9 @@
netcfg (0.10) unstable; urgency=low
* fix broken handling of nameservers, build with cdebconf-dev.
-- David Whedon <dwhedon@debian.org> Wed, 14 Feb 2001 20:33:40 -0800
netcfg (0.09) unstable; urgency=low
* make necessary dirs at build time rather than runtime

2
netcfg-dhcp.c

@ -30,7 +30,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <debconfclient.h>
#include <cdebconf/debconfclient.h>
#include "utils.h"
#include "netcfg.h"

2
netcfg-static.c

@ -29,7 +29,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <debconfclient.h>
#include <cdebconf/debconfclient.h>
#include "utils.h"
#include "netcfg.h"

21
netcfg.c

@ -1,5 +1,5 @@
/*
netcfg.c - Share functions used to configure the network for
netcfg.c - Shared functions used to configure the network for
the debian-installer.
Author - David Whedon
@ -30,7 +30,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <debconfclient.h>
#include <cdebconf/debconfclient.h>
#include "utils.h"
#include "netcfg.h"
@ -219,7 +219,7 @@ dot2num (u_int32_t * num, char *dot)
unsigned long val;
if (!dot)
goto error;
goto exit;
*num = 0;
for (ix = 0; ix < 4; ix++)
@ -230,17 +230,17 @@ dot2num (u_int32_t * num, char *dot)
if (e == p)
val = 0;
else if (val > 255)
goto error;
goto exit;
*num += val;
/*printf("%#8x, %#2x\n", *num, val); */
if (ix < 3 && *e != '.')
goto error;
goto exit;
p = e;
}
return;
error:
exit:
*num = 0;
}
@ -394,14 +394,15 @@ netcfg_nameservers_to_array (char *nameservers, u_int32_t array[])
if (nameservers)
{
save = ptr = strdup (ptr);
ns = strtok_r (ptr, " ", &ptr);
save = ptr = strdup (nameservers);
ns = strtok_r (ptr, " \n\t", &ptr);
dot2num (&array[0], ns);
ns = strtok_r (NULL, " ", &ptr);
ns = strtok_r (NULL, " \n\t", &ptr);
dot2num (&array[1], ns);
ns = strtok_r (NULL, " ", &ptr);
ns = strtok_r (NULL, " \n\t", &ptr);
dot2num (&array[2], ns);
array[3] = 0;

2
netcfg.h

@ -1,6 +1,8 @@
#ifndef _NETCFG_H_
#define _NETCFG_H_
#include <sys/types.h>
#include <stdio.h>
#include <cdebconf/debconfclient.h>
#define ETC_DIR "/etc"
#define NETWORK_DIR "/etc/network"

Loading…
Cancel
Save