🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.programmer
6 messages
6 total messages Started by Nickolay Saukh Fri, 28 Sep 1990 16:20
Easy way to find hostname/domainname
#949
Author: Nickolay Saukh
Date: Fri, 28 Sep 1990 16:20
25 lines
1257 bytes
I need advice/software to figure out the hostname & domain name for C
programs and shell scripts. In C for hostname it seems to be quite easy:

	#if defined(BSD)
		gethostname(...);
	#endif

	#if defined(USG)
		uname(...);
	#endif

	#if defined(ANYTHING_ELSE)
		popen("uuname -l", ...);
	#endif

But how to find domain name? Look at some file with magic name? What the
name should be (with portabily issues in mind)?

The same problem for shell scripts. I know about 'hostname' command in
BSD world, 'uuname -l' for SV world (and 'uname' also).

This problem is one more 'iron curtain' (-:, which separates *NIXes
of the world. Help them unite!!!
-- 
| Nickolay Saukh | nms@saukh.rd.jvd.su | ...!fuug!demos!jvdrd!saukh!nms |
Re: Easy way to find hostname/domainname
#951
Author: Mark Verber
Date: Mon, 01 Oct 1990 16:02
51 lines
2366 bytes
There are a variety of ways to try and get a hostname/fully qualified
domain name for a shell script.  Some of the stratagies I have seen
include:

1. Write a replacement version of hostname which will run under on any
machine and return the appropriate information.  You might want to add
a -fqdn switch to give a full qualified domain name since many people
run with shortnames (ie hostname without domainnames tacks on).

2. Create a file called something like /etc/sysinfo which contains
fields which decribe how to get domainame and a short hostname, and
whatever other useful things you need.  For example, on my Suns this
file would look something like this:
    `arch`:/vmunix:"bsd":"sunos-41":`/bin/hostname`:"mps.ohio-state.edu"
and have a shell/perl/awk/etc script that rips important info out.
	
3. Make some assumptions.  For example, the following script should
run on all the systems I currently maintain (I think... I am writing
off the top of my head).  On the other hand, I am sure the is some
version of Unix will break it.  Assuptions are that the person is either
running with a domain name resolver, or has a /etc/domainname file.

#! /bin/csh

if ( -e /etc/resolv.conf ) then
	set domain = `grep domain /etc/resolv.conf`
	set domain = $domain[2]
else if ( -e /etc/domainname ) then
	set domain = `cat /etc/domainname`
else
	unset domain
endif

if ( -e /bin/hostname ) then
	set host = `hostname`
else if ( -e /bin/uname ) then
	set host = `uname -n`
else if ( -e /usr/bin/uuname ) then
	set host = `uuname -l`
else
	set host = unknown
endif

set host = (`echo $host | tr '.' ' '`)
set host = $host[1]

if ( $?domain ) then
	setenv HOST $host.$domain
else
	setenv HOST $host
endif
Re: Easy way to find hostname/domainname
#967
Author: Mark Towfiq
Date: Wed, 03 Oct 1990 14:38
21 lines
1514 bytes
In article <1990Sep28.162012.14325@saukh.rd.jvd.su>
nms@saukh.rd.jvd.su (Nickolay Saukh) writes:

   I need advice/software to figure out the hostname & domain name for C
   programs and shell scripts. In C for hostname it seems to be quite easy:

   [how to get hostname deleted]

   But how to find domain name? Look at some file with magic name? What the
   name should be (with portabily issues in mind)?

In C, I would do a gethostbyname() to get the FQDN, and then take
everything after the first "." to be the domain.

   The same problem for shell scripts. I know about 'hostname' command in
   BSD world, 'uuname -l' for SV world (and 'uname' also).

So you want the FQDN in a shell script?  I do not know of a portable
way to do this.  You could look for /etc/resolv.conf, or you could
look for a program like "host", or "nslookup", and maybe AWK its
output?
Comm program with scripting language needed
#991
Author: Bob Daniel
Date: Mon, 08 Oct 1990 17:43
8 lines
991 bytes
I need a comm program with a robust scripting language that will be distruted
to several hundred sites.  I have 'TERM' by Century Software but it costs $500
per site.  I have 'expect' but it will not do what we need.  I need something
under $200/site.  I understand ProComm is on UNIX.  How much is it?  Anyone
have their number?  Any other comm programs out there with scripting languages?

Oh yeah, I also have XCOMM but the scripting language is too limited.
 
Re: Comm program with scripting language needed
#992
Author: Dan Bernstein
Date: Tue, 09 Oct 1990 19:45
11 lines
994 bytes
In article <57@genco.uucp> rad@genco. (Bob Daniel) writes:
> I need a comm program with a robust scripting language that will be distruted
> to several hundred sites.  I have 'TERM' by Century Software but it costs $500
> per site.  I have 'expect' but it will not do what we need.

Really? I find this surprising. If TERM is too expensive and expect is
too inflexible and XCOMM is too limited, perhaps you'd better explain
what features you need so that you have a chance of getting a reasonable
answer.

---Dan
Re: Comm program with scripting language needed
#1052
Author: Jean-Pierre Radley
Date: Thu, 18 Oct 1990 05:30
52 lines
2606 bytes
In article <57@genco.uucp> rad@genco. (Bob Daniel) writes:
>I need a comm program with a robust scripting language that will be distruted
>to several hundred sites.  I have 'TERM' by Century Software but it costs $500
>per site.  I have 'expect' but it will not do what we need.  I need something
>under $200/site.  I understand ProComm is on UNIX.  How much is it?  Anyone
>have their number?  Any other comm programs out there with scripting languages?
>
>Oh yeah, I also have XCOMM but the scripting language is too limited.

Several generations after XCOMM, there's XCMALT.
Scripting language improvements are but the least of its features.
I'm the "curator" thereof, and it's being dispatched to you even as I write
this.


----------

Once upon a time, Eric Coe wrote XCOMM; Larry Gensch wrote XCOMM 2.0; Fred Buck
enhanced it to XCMALT.
XCMALT is currently at version 2.9

I fixed loose ends, condensed the documentation, tightened the code. Put/take
now function, and allow an optional second filename for the target file. The
dialing directory adjusts to the length of your screen. Startup and user
scripts and the phonelist are sought in your current directory, home directory,
or a default library directory. Tty output is now unbuffered. Getty/LCK-file
support allow dialing out on an enabled line. The baud rate choices now extend
from 300 to 19200. More inverse video for error messages.
As before, you can:
	send a modem BREAK
	set 7-bit masking or 8-bit masking
	up/download using
		ZMODEM
		XMODEM/YMODEM (if you have rx/sz)
		CompuServe Quick-B Protocol
		plain old ASCII
	name your capture file
	toggle your capture file on or off
	upload from a file on disk
	dial from a directory of numbers,
		optionally using a script which can, for example, log you on
		to CIS, get you into a Forum, start reading messages or upload
		replies
	escape to a shell
	attach the stdin and stdout of a system command to the modem port
and other goodies.
	
Buy it, you'll like it; at any rate, it's free. 

-----------
-- 
 Jean-Pierre Radley          HIGH-Q	     jpr@jpradley	CIS: 72160,1341
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads