Help in C!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Help in C!

  1. #1
    steve Guest

    Help in C!


    I am trying to write a C program to write the following information. Does
    anyone know what files I need to search to find the answers to the following
    questions?

    Steve

    what is my host name?
    who is my DNS server?
    who is my NIS server?
    I am NIS server.
    I am DNS server.
    what order I resolve host names?
    what is my domain name?
    who I mount NFS from?
    do I mount AFS?
    what file system I am sharing and whom I am sharing it to?
    what is my IP address(es)?
    am I a web server?
    am I a route? if yes what do I route?
    what UNIX system am I running?
    who is (are) my DNS server(s)?
    who is (are) my NIS server(s)?
    I am NIS+ server.
    who is my NIS+ master server.
    where do I check user names and passwords from?
    where do I check network services?

    Share on Google+

  2. #2
    Tom Brennan Guest

    Re: Help in C!


    Hmmm...Best thing for you to do is get this book - Publishers is Wrox Press,
    Ttitle Linux Programming 2nd Edition, it will contain the answers to most
    of your questions....personally you could get away with it using a shell
    script which would be made much easier unless you want to write an administrator
    program to do all of this.....
    "steve" <SteveCusick@bigfoot.com> wrote:
    >
    >I am trying to write a C program to write the following information. Does
    >anyone know what files I need to search to find the answers to the following
    >questions?
    >
    >Steve
    >
    >what is my host name?
    >who is my DNS server?
    >who is my NIS server?
    >I am NIS server.
    >I am DNS server.
    >what order I resolve host names?
    >what is my domain name?
    >who I mount NFS from?
    >do I mount AFS?
    >what file system I am sharing and whom I am sharing it to?
    >what is my IP address(es)?
    >am I a web server?
    >am I a route? if yes what do I route?
    >what UNIX system am I running?

    snip>>>>
    try uname -a
    >who is (are) my DNS server(s)?
    >who is (are) my NIS server(s)?
    >I am NIS+ server.
    >who is my NIS+ master server.
    >where do I check user names and passwords from?

    snip>>>
    There is a function to read from the passwd file and will tell you what
    shell etc....cannot remember the function, the passwords/users etc are located
    in /etc/passwd. Beware that the passwd file itself could be shadowed ie.
    you will not see the passwd and need root privileges to look into it!!!

    >where do I check network services?

    snip>>>>
    look in /etc/services...some distros have their own front end ...eg suse
    6.3 (which I have) comes with yast which will allow you to glance at what
    your ip address is etc.....
    >


    Share on Google+

  3. #3
    joe Guest

    Re: Help in C!


    I agree that a shell script would do this easier, but there are system functions
    you can call to do this as well. If you want to read files though i've put
    what i know below.

    "Tom Brennan" <tommieb@dds.nl> wrote:
    >
    >Hmmm...Best thing for you to do is get this book - Publishers is Wrox Press,
    >Ttitle Linux Programming 2nd Edition, it will contain the answers to most
    >of your questions....personally you could get away with it using a shell
    >script which would be made much easier unless you want to write an administrator
    >program to do all of this.....
    >"steve" <SteveCusick@bigfoot.com> wrote:
    >>
    >>I am trying to write a C program to write the following information. Does
    >>anyone know what files I need to search to find the answers to the following
    >>questions?
    >>
    >>Steve
    >>
    >>what is my host name?


    hostname or hostname.something

    >>who is my DNS server?


    resolv.conf

    >>who is my NIS server?
    >>I am NIS server.
    >>I am DNS server.
    >>what order I resolve host names?


    nsswitch.conf

    >>what is my domain name?


    resolv.conf

    >>who I mount NFS from?


    mnttab or fstab (I forget which one on Linux)

    >>do I mount AFS?
    >>what file system I am sharing and whom I am sharing it to?


    smb.conf (?)

    >>what is my IP address(es)?


    ifconfig [interface name] is the command

    >>am I a web server?


    look for apache.conf and httpd processes

    >>am I a route? if yes what do I route?
    >>what UNIX system am I running?

    >snip>>>>
    > try uname -a
    >>who is (are) my DNS server(s)?


    resolv.conf

    >>who is (are) my NIS server(s)?
    >>I am NIS+ server.
    >>who is my NIS+ master server.
    >>where do I check user names and passwords from?

    >snip>>>
    > There is a function to read from the passwd file and will tell you what
    >shell etc....cannot remember the function, the passwords/users etc are located
    >in /etc/passwd. Beware that the passwd file itself could be shadowed ie.
    >you will not see the passwd and need root privileges to look into it!!!
    >
    >>where do I check network services?

    >snip>>>>
    > look in /etc/services...some distros have their own front end ...eg suse
    >6.3 (which I have) comes with yast which will allow you to glance at what
    >your ip address is etc.....
    >>

    >


    Share on Google+

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center