Re: Can anybody correct this code that is used to get/set ARP entries and uses ioctl( )



"jeniffer" <zenith.of.perfection@xxxxxxxxx> wrote:
This is a C program compiled on gcc compiler that tries to set a new
entry in the arp cache,get an entry and also delete an entry from it.I
have run this program but in the set function Set_Entry function a call

Your code is just loaded with problems. It does not use the
facilities of ANSI/ISO Standard C, which suggests it dates back
prior to perhaps 1990 or so.

Instead of using the example you are, look up the code for /arp/
from any current Linux distribution. You can, for example,
download net-tools-1.60.tar.bz2 from ftp.oss.cc.gatech.edu.
You'll find it on that server at,

/pub/linux/distributions/slackware/slackware-10.2/source/n/tcpip/net-tools-1.60.tar.bz2

And turn your compiler warnings up as high as you can. The
least you would want is a command line like this:

gcc -W -Wall -O2 -o foo foo.c

There are actually several other warnings that can also be enabled
most of the time. The point is to let the compiler help you write
better code. For example, I test short programs with a "generic"
Makefile that uses this command to compile:

gcc -ggdb -O2 -std=c99 -pedantic -Wall -W -Wcast-align \
-Wcast-qual -Wmissing-prototypes -Wshadow \
-Wnested-externs -Wstrict-prototypes -Waggregate-return \
-Wpointer-arith -c foo.c

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.



Relevant Pages

  • Re: Can anybody correct this code?
    ... jeniffer wrote: ... entry in the arp cache,get an entry and also delete an entry from it.I ... have run this program but in the set function Set_Entry function a call ...
    (comp.lang.c)
  • Re: Quick Q - How do I set the height/width of a Figure?
    ... Re question #2, in the Help Navigator, search for Figure Properties. ... In the entry for Position, it tells you, "You can use the get function ... you can use the set function to resize and move the figure to a new ...
    (comp.soft-sys.matlab)
  • Re: R: GOBACK (was: Perform Thru/Go to vs. Perform - Compile Speed
    ... >>in a toy program using a single compiler on just one platform. ... and ANS'2002 and not to something that _isn't_ 'modernized Cobol'. ... > existing Cobol program to run paragraphs in parallel requires changing at least ... > one paragraph name to ENTRY, or breaking the program into smaller ones. ...
    (comp.lang.cobol)
  • Re: ie6sp1 : Repair Function Blocked - Anyone know of a fix?
    ... Robert Aldwinckle wrote: ... >> Unfortunately am having a bit of difficulty with GetVers. ... > for command itself not to the thing it is being used to execute. ... Ran Registry Find - one entry: ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: ie6sp1 : Repair Function Blocked - Anyone know of a fix?
    ... I already explained that that command cannot ... work because there is no DllRegisterServer entry point in that module. ... there is a DllInstall entry point there. ... NTx uses the registry value. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)