Opened 17 years ago

Closed 17 years ago

#1684 closed enhancement (fixed)

Add -n option to netstat

Reported by: mjw Owned by: axeld
Priority: normal Milestone: R1
Component: Applications/Command Line Tools Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

I have produced a small patch to src/bin/netstat/netstat.cpp to prevent netstat resolving names. This functionality is enabled by the -n switch as in most other OSs.

Attachments (2)

netstat.cpp.diff (1.7 KB ) - added by mjw 17 years ago.
netstat.cpp.2.diff (2.1 KB ) - added by mjw 17 years ago.
I hope this one is more acceptable

Download all attachments as: .zip

Change History (6)

by mjw, 17 years ago

Attachment: netstat.cpp.diff added

comment:1 by axeld, 17 years ago

Component: - General- Applications/Command Line Tools

Thanks for the patch! I would like to apply it, but there are many coding style related issues - please have a look at http://haiku-os.org/documents/dev/haiku_coding_guidelines and resubmit your patch; a few hints:

  • opening parenthesis go to the end of the previous line in line 154
  • variables don't use '_' to separate words, but inter-caps formatting (ie. optionIndex)
  • static global variables are named like sThisIsAStaticVariable.

comment:2 by mjw, 17 years ago

OK, I'll work on that.

I have also noticed that gethostbyaddr() is called incorrectly. It is being called as: gethostbyaddr((const char *)_address,...), whereas it should be called as gethostbyaddr((const char *)&address.sin_addr,...).

Do you want me to roll that fix into this patch, or should I create a new bug to deal with that?

comment:3 by axeld, 17 years ago

Thanks!

I have also noticed that gethostbyaddr() is called incorrectly.

Nice catch, I've already fixed the problem in hrev23223.

by mjw, 17 years ago

Attachment: netstat.cpp.2.diff added

I hope this one is more acceptable

comment:4 by axeld, 17 years ago

Resolution: fixed
Status: newclosed

Absolutely! Thanks, I've applied it in hrev23252. I've only made two minor changes: I removed the superfluous parentheses around "address.sin_addr", and I added you to the list of authors.

Note: See TracTickets for help on using tickets.