I have a program that's been using the gethostname() API successfully for many years:
This gets the hostname as host.domain.com. Now I need to get just the domain name:
This gets a blank value. No messages in the job log, getdomainname() returns 0, and errno is 0. Any ideas what I'm doing wrong? Thanks!
Code:
d gethostname pr 10i 0 extProc('gethostname') d name 32767a options(*varsize) d length 10i 0 value d host s 256a d cstring s +1 like(host) c callp gethostname(cstring:%size(cstring)) c eval host = %str(%addr(cstring))
Code:
d getDomainName pr 10i 0 extProc('getdomainname') d name 32767a options(*varsize) d length 10i 0 value d domain s 256a d cstring s +1 like(domain) getDomainName(cstring:%size(cstring)); domain = %str(%addr(cstring));
This gets a blank value. No messages in the job log, getdomainname() returns 0, and errno is 0. Any ideas what I'm doing wrong? Thanks!
Comment