Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
net-tools
Commits
72c29c95
Commit
72c29c95
authored
Nov 15, 1998
by
Klaas Freitag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Use numerical sort for interface sorting.
- Use an AF_INET socket for SIOCGIFCONF
parent
6053a5c2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
4 deletions
+51
-4
interface.c
interface.c
+12
-3
lib/Makefile
lib/Makefile
+1
-1
lib/nstrcmp.c
lib/nstrcmp.c
+31
-0
lib/util.h
lib/util.h
+3
-0
statistics.c
statistics.c
+4
-0
No files found.
interface.c
View file @
72c29c95
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
10/1998 partly rewriten by Andi Kleen to support interface list.
10/1998 partly rewriten by Andi Kleen to support interface list.
I don't claim that the list operations are efficient @).
I don't claim that the list operations are efficient @).
$Id: interface.c,v 1.
8 1998/11/14 10:37:06 philip
Exp $
$Id: interface.c,v 1.
9 1998/11/15 18:58:40 freitag
Exp $
*/
*/
#include "config.h"
#include "config.h"
...
@@ -58,8 +58,7 @@ void add_interface(struct interface *n)
...
@@ -58,8 +58,7 @@ void add_interface(struct interface *n)
pp
=
&
int_list
;
pp
=
&
int_list
;
for
(
ife
=
int_list
;
ife
;
pp
=
&
ife
->
next
,
ife
=
ife
->
next
)
{
for
(
ife
=
int_list
;
ife
;
pp
=
&
ife
->
next
,
ife
=
ife
->
next
)
{
/* XXX: should use numerical sort */
if
(
nstrcmp
(
ife
->
name
,
n
->
name
)
>
0
)
if
(
strcmp
(
ife
->
name
,
n
->
name
)
>
0
)
break
;
break
;
}
}
n
->
next
=
(
*
pp
);
n
->
next
=
(
*
pp
);
...
@@ -99,6 +98,16 @@ static int if_readconf(void)
...
@@ -99,6 +98,16 @@ static int if_readconf(void)
struct
ifconf
ifc
;
struct
ifconf
ifc
;
struct
ifreq
*
ifr
;
struct
ifreq
*
ifr
;
int
n
,
err
=
-
1
;
int
n
,
err
=
-
1
;
int
skfd
;
/* SIOCGIFCONF seems to only work properly on AF_INET sockets
currently */
skfd
=
get_socket_for_af
(
AF_INET
);
if
(
skfd
<
0
)
{
fprintf
(
stderr
,
_
(
"warning: no inet socket available: %s
\n
"
),
strerror
(
errno
));
return
-
1
;
}
ifc
.
ifc_buf
=
NULL
;
ifc
.
ifc_buf
=
NULL
;
for
(;;)
{
for
(;;)
{
...
...
lib/Makefile
View file @
72c29c95
...
@@ -21,7 +21,7 @@ AFOBJS = unix.o inet.o inet6.o ax25.o ipx.o ddp.o ipx.o netrom.o af.o rose.o ec
...
@@ -21,7 +21,7 @@ AFOBJS = unix.o inet.o inet6.o ax25.o ipx.o ddp.o ipx.o netrom.o af.o rose.o ec
AFGROBJS
=
inet_gr.o inet6_gr.o ipx_gr.o ddp_gr.o netrom_gr.o ax25_gr.o rose_gr.o getroute.o
AFGROBJS
=
inet_gr.o inet6_gr.o ipx_gr.o ddp_gr.o netrom_gr.o ax25_gr.o rose_gr.o getroute.o
AFSROBJS
=
inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o
AFSROBJS
=
inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o
ACTOBJS
=
slip_ac.o ppp_ac.o activate.o
ACTOBJS
=
slip_ac.o ppp_ac.o activate.o
VARIA
=
getargs.o masq_info.o proc.o util.o
VARIA
=
getargs.o masq_info.o proc.o util.o
nstrcmp.o
NLSMISC
=
net-string.o
NLSMISC
=
net-string.o
OBJS
=
$(NLSMISC)
$(VARIA)
$(AFOBJS)
$(HWOBJS)
\
OBJS
=
$(NLSMISC)
$(VARIA)
$(AFOBJS)
$(HWOBJS)
\
...
...
lib/nstrcmp.c
0 → 100644
View file @
72c29c95
/* Copyright 1998 by Andi Kleen. Subject to the GPL. */
#include <ctype.h>
#include <stdlib.h>
#include "util.h"
/* like strcmp(), but knows about numbers */
int
nstrcmp
(
const
char
*
astr
,
const
char
*
b
)
{
const
char
*
a
=
astr
;
while
(
*
a
==
*
b
)
{
if
(
*
a
==
'\0'
)
return
0
;
a
++
;
b
++
;
}
if
(
isdigit
(
*
a
))
{
if
(
!
isdigit
(
*
b
))
return
-
1
;
while
(
a
>
astr
)
{
a
--
;
if
(
!
isdigit
(
*
a
))
{
a
++
;
break
;
}
if
(
!
isdigit
(
*
b
))
return
-
1
;
b
--
;
}
return
atoi
(
a
)
>
atoi
(
b
)
?
1
:
-
1
;
}
return
*
a
-
*
b
;
}
lib/util.h
View file @
72c29c95
...
@@ -8,3 +8,6 @@ void *xrealloc(void *p, size_t sz);
...
@@ -8,3 +8,6 @@ void *xrealloc(void *p, size_t sz);
int
kernel_version
(
void
);
int
kernel_version
(
void
);
#define KRELEASE(maj,min,patch) ((maj) * 10000 + (min)*1000 + (patch))
#define KRELEASE(maj,min,patch) ((maj) * 10000 + (min)*1000 + (patch))
int
nstrcmp
(
const
char
*
,
const
char
*
);
statistics.c
View file @
72c29c95
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
/* 19980630 - i18n - Arnaldo Carvalho de Melo <acme@conectiva.com.br> */
/* 19980630 - i18n - Arnaldo Carvalho de Melo <acme@conectiva.com.br> */
/* 19981113 - i18n fixes - Arnaldo Carvalho de Melo <acme@conectiva.com.br> */
/* 19981113 - i18n fixes - Arnaldo Carvalho de Melo <acme@conectiva.com.br> */
/*
XXX: rewrite to 2 pass to support /proc/net/netstat too
support -t -u
*/
#include <ctype.h>
#include <ctype.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment