Getting interface names using code


 
Thread Tools Search this Thread
Operating Systems Solaris Getting interface names using code
# 1  
Old 07-10-2008
Question Getting interface names using code

Is there a way to use code to get the interface names for a Solaris machine. I can easily see them on a command line with the "ifconfig -a" command. I could write a script that parses these out of a the ifconfig result and outputs them to a file, and then I run the script with the system command from code, and open the resulting file from code.

It seems there should be an easier way for a program to get these names. On some of the Solaris boxes I use, these names are bge0, bge1,... depending on how many ethernet cards are installed. On others the names are ce0, ce1,...

If you know how I can get these names from code directly, please let me know.
TIA,
Herb Miller
Smilie
# 2  
Old 07-10-2008
Are you only concerned with active network interfaces?
# 3  
Old 07-10-2008
use can use prtconf -D |grep network to see each interfaces' instances. and of course, if you need only the active interface, you can use ifconfig or the combination of both, depending on how stylish you want your script to report it out with the outputSmilie
# 4  
Old 07-10-2008
I'm not 100% sure what the OP means but 'code', but my foggy crystal ball tells me it's not "script", but rather some kind of the compiled language.
Maybe the OP could shed some more light....
# 5  
Old 07-10-2008
That was my understanding also.
# 6  
Old 07-10-2008
Getting interface names using code

I may be in the wrong forum.

I was hoping to do this from code (C++ or C, most likely). I can use the ifconfig command from code and pipe the result of a file and open the file and parse it. This seems cumbersome, but it does work.

I was hoping to just make some calls (or series of calls) from software to get this information rather that relying on the "system_ command from software, and writing and reading a file. I can not be sure that the code I am writing will be run in an environment where writing a file is permitted.

Thanks,
Herb
# 7  
Old 07-10-2008
Yes, active interfaces only.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

2. Solaris

Haed code nxge0 nic interface with full duplex & 1000mbps

Hi All I would need to do hard code of nxge0 nic to full duplex & 1000mbps. So that whenever solaris server come up after reboot. it will show full duplex & 1000mbps setting only. Please also let me know how to do it online through command. regards (0 Replies)
Discussion started by: amity
0 Replies

3. UNIX for Dummies Questions & Answers

Adding a network interface to a bonded interface

I have a RHEL 5 system with a bonded interface configure using only one network port (eth0). So I have config file for ifcfg-bond0 and ifcfg-eth. I'd like to configure eth5 to be the second SLAVE in the bond. My question is, after I modify ifcfg-eth5, can I add eth5 to the bond0 interface without... (1 Reply)
Discussion started by: westmoreland
1 Replies

4. IP Networking

Need a bridge from an ethernet interface to a serial interface

This is my situation DOS pc serial cable (sl0) Linux Pc eth1 192.168.0.10 <-------------------->192.168.0.2 <------------>192.168.0.1 (router) I connected the linux pc and the dos pc with a SLIP (serial line internet protocol), so they can communicate in the sl0 interface. ... (3 Replies)
Discussion started by: mghis
3 Replies

5. SCO

Change SCO - GUI or Desktop interface to DOS based interface

Hi all I have installed a demo version of SCO OpenServer 5.0.2, I finally found it is Desktop Interface, I would like to know how to change its interface to dos based interface? If you have any ideas, please tell me then. Thank you (2 Replies)
Discussion started by: TinhNhi
2 Replies

6. Solaris

Command line Interface or GUI Interface not shown on solaris

Dear all, I am a newbie in solaris and I need your advice. I have a Solaris version 5.9 installed on Sunfire V240. I am able to ssh the machine from putty remotely. My problem is that I cannot see the display from KVM switch I have connected to it. I need also to be able to see the GUI... (2 Replies)
Discussion started by: mbouster
2 Replies

7. Shell Programming and Scripting

Searching for file names in a directory while ignoring certain file names

Sun Solaris Unix Question Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies

8. Shell Programming and Scripting

Shell Script to display function names (called & defined) in a C++ Source Code

Hello to all, I am looking for a way to display only the names of function (calls & definition) of a C++ source code.There is already a post related to this, but the script is to find the functions using a specific variable, and the replies are not that convincing since they cannot be used for... (2 Replies)
Discussion started by: frozensmilz
2 Replies

9. Programming

How to modify this c code to get full GUI interface for Unix Linux ?

Hi, the following code comes from Unix Linux dialog utility project. Unfortunately, this project is no more actively maintained. Unix Linux dialog utility is made of widget boxes. One of them is mixedgauge.c In the following example I would like to get rid of flickering when run in... (0 Replies)
Discussion started by: jack2
0 Replies
Login or Register to Ask a Question