Sponsored Content
Special Forums IP Networking gethostbyname_r returns NULL when hostname has dash Post 302198694 by Perderabo on Friday 23rd of May 2008 04:17:27 PM
Old 05-23-2008
This appears to be illegal according to rfc 952.
RFC 952 (rfc952) - DoD Internet host table specification

Code:
<name>  ::= <let>[*[<let-or-digit-or-hyphen>]<let-or-digit>]

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Solaris - unknown hostname - how can I change hostname?

Hello, I am new to Solaris. I am using stand alone Solaris 10.0 for test/study purpose and connecting to internet via an ADSL modem which has DHCP server. My Solaris is working on VMWare within winXP. My WinXP and Solaris connects to internet by the same ADSL modem via its DHCP at the same... (1 Reply)
Discussion started by: XNOR
1 Replies

2. Programming

PEM_read_RSAPublicKey returns NULL

Hi all, I am trying to write a program in C which will generate private and public keys using openssl RSA and use these for encryption and decryption. I am able to generate the keys successfully and write these to files. I am able to read the private key successfully. I can encrypt and decrypt... (1 Reply)
Discussion started by: Treasa
1 Replies

3. Shell Programming and Scripting

remove dash

hi I am using ksh #A="abc-def" #typeset -u B="$A" #echo $B ABC-DEF how to remove the dash? i.e. ABCDEF? thank you (1 Reply)
Discussion started by: melanie_pfefer
1 Replies

4. UNIX for Dummies Questions & Answers

echo statement when find returns null

Hi, How do you echo something once when a find statement returns null results? This is when using mutiple locations and mutiple arguments. The below find command the inner loop of a nested for loop where the outter loop holds the $args and the inner loop holds the locations. find... (2 Replies)
Discussion started by: tchoruma
2 Replies

5. Shell Programming and Scripting

awk returns null?

hi i try to check if awk returns null and i dont know how it's works this is the command set EndByC = `ls -l $base | awk '/.c$/ {print $9}'` if ($EndByC=="") then #check if ther is XXX.c directory echo Sorry ther is no XXX.c folder "in" $base path echo the XXX.c folder is necessary... (6 Replies)
Discussion started by: frenkelor
6 Replies

6. Shell Programming and Scripting

Insert string 'NULL' where there is a null value

I have an input file having 7 fields delimited by , eg : 1,ABC,hg,1,2,34,3 2,hj,YU,2,3,4, 3,JU,kl,4,5,7, 4,JK,KJ,3,56,4,5 The seventh field here in some lines is empty, whereas the other lines there is a value. How do I insert string NULL at this location (7th loc) for these lines where... (8 Replies)
Discussion started by: zilch
8 Replies

7. Emergency UNIX and Linux Support

HP UX - ILO Console hostname different than Machine Hostname...

Hi All, So we added a new HP-UX 11.31 machine. Copied OS via Ignite-UX (DVD)over from this machine called machine_a. It was supposed to be named machine_c. And it is when you log in...however when I'm in the ILO console before logging in, it says: It should say: What gives? And how do... (4 Replies)
Discussion started by: zixzix01
4 Replies

8. Red Hat

hostname command prints nothing a null value

Hi , On my box everything works fine. But whenever I run command It returns nothing as you see @(none) too. Its very strange issue I have never noticed on any other system yet. Any one have any idea about this. Thank you (2 Replies)
Discussion started by: pratapsingh
2 Replies

9. UNIX for Advanced & Expert Users

Hostname -f hostname: Unknown host

deleted (0 Replies)
Discussion started by: hce
0 Replies

10. Shell Programming and Scripting

A dash to GOTO or a dash from GOTO, that is the question...

Well, guys I saw a question about GOTO for Python. So this gave me the inspiration to attempt a GOTO function for 'dash', (bash and ksh too). Machine: MBP OSX 10.14.3, default bash terminal, calling '#!/usr/local/bin/dash'... This is purely a fun project to see if it is possible in PURE... (3 Replies)
Discussion started by: wisecracker
3 Replies
gethostbyname(3)					     Library Functions Manual						  gethostbyname(3)

NAME
gethostbyname, gethostbyname_r - Get a network host entry by name LIBRARY
Standard C Library (libc.so, libc.a) SYNOPSIS
#include <netdb.h> struct hostent *gethostbyname( const char *name); [Tru64 UNIX] The following function is supported in order to maintain backward compatibility with previous versions of the operating sys- tem. You should not use it in new designs. int gethostbyname_r( const char *name, struct hostent *hptr, struct hos- tent_data *hdptr); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: gethostbyname(): XNS4.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the official network name or alias. [Tru64 UNIX] For gethostbyname_r() only, this points to the hostent structure. The netdb.h header file defines hostent structure. [Tru64 UNIX] For gethostbyname_r() only, this is data for hosts database. The netdb.h header file defines hostent_data structure. DESCRIPTION
The gethostbyname() function returns a pointer to a structure of type hostent. Its members specify data obtained from either the local /etc/hosts file or one of the files distributed by DNS/BIND or NIS. To determine which file or files to search, and in which order, the system uses the switches in the /etc/svc.conf file. The netdb.h header file defines the hostent structure. If using DNS/BIND, the information is obtained from a name server specified in the /etc/resolv.conf file. If the name parameter does not contain a dot "." and you are using DNS/BIND, the gethostbyname() function checks whether the environment variable HOSTALIASES is set. If set, it first searches the file named by HOSTALIASES for an alias matching the name parameter. The alias file has the following format: name1 name2 The alias name. This name cannot include dots. The host name used by DNS/BIND to look up the host information. The hosts database must be distributed by DNS/BIND. NOTES
The gethostbyname() function returns a pointer to thread-specific data. Subsequent calls to this or a related function from the same thread overwrite this data. [Tru64 UNIX] The gethostbyname_r() function is an obsolete reentrant version of the gethostbyname() function. It is supported in order to maintain backward compatibility with previous versions of the operating system and should not be used in new designs. Note that you must zero-fill the hdptr structure before its first access by the gethostbyname_r() function. RETURN VALUES
Upon successful completion, the gethostbyname() function returns a pointer to a hostent structure. If it reaches the end of the network host name database, it returns a null pointer. [Tru64 UNIX] Upon successful completion, the gethostbyname_r() function stores the hostent structure in the location pointed to by hptr, and returns a value of 0 (zero). Upon failure, it returns a value of -1. ERRORS
If the gethostbyname() or gethostbyname_r() function call fails, h_errno is set to one of the following the values: Host is unknown. The server recognized the request and the name, but no address is available for the name. Another type of name server request may be success- ful. An unexpected server failure occurred. This is a nonrecoverable error. A transient error occurred, for example, the server did not respond. A retry at some later time may be successful. [Tru64 UNIX] If any of the following conditions occurs, the gethostbyaddr_r() function sets errno to the corresponding value: The name, hptr, or hdptr is invalid. FILES
The Internet network host name database. Each record in the file occupies a single line and has three fields consisting of the host address, official host name, and aliases. The resolver configuration file. The database service selection configuration file. RELATED INFORMATION
Functions: endhostent(3), gethostbyaddr(3), sethostent(3). Files: hostname(5), resolv.conf(4), svc.conf(4). Networks: bind_intro(7), nis_intro(7). Standards: standards(5) delim off gethostbyname(3)
All times are GMT -4. The time now is 02:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy