Version 1.0.1

This commit is contained in:
Erik C. Thauvin 2002-07-25 05:31:57 +00:00
parent 4cd29f3eb0
commit fa7c5ec73d
6 changed files with 54 additions and 42 deletions

View file

@ -1,7 +1,7 @@
README
GeekTools Whois Java Client
Version 1.0
Version 1.0.1
GeekTools Whois Java Client is a finger-style whois which uses the GeekTools
Whois Proxy server (<whois.geektools.com>) provided by CenterGate Research
@ -126,4 +126,4 @@ Similarly, to change the default port from 43 to 46:
Copyright (C) 2000 by SkyTouch Communications. All Rights Reserved.
Copyright (C) 2000-2001 by SkyTouch Communications. All Rights Reserved.

View file

@ -1,17 +1,17 @@
/*
Package: GeekTools Whois Java Client 1.0
Package: GeekTools Whois Java Client 1.0.1
File: Whois.java (Java source file)
Author: Erik C. Thauvin <erik@skytouch.com>
Comments: Part of the GeekTools Whois Java Client package.
See the README.TXT file for more information.
Copyright (C) 2000 SkyTouch Communications. All Rights Reserved.
Copyright (C) 2000-2001 SkyTouch Communications. All Rights Reserved.
This program is distributed under the terms of the GNU General
Public License as published by the Free Software Foundation.
See the COPYING.TXT file for more information.
$Id$
*/
@ -21,16 +21,28 @@ import java.io.*;
import java.util.Properties;
/**
* Class Whois
*
*
* @author Erik C. Thauvin (erik@skytouch.com)
* @version 1.0.1
*/
public class Whois
{
// The truth is out there!
/**
* Method main
*
* The Truth is Out There!
*
* @param args Command line arguments
*/
public static void main(String[] args)
{
// Display usage if there are no command line arguments
if (args.length < 1)
{
System.out.println(
"Usage: java Whois query[@<whois.server>]");
System.out.println("Usage: java Whois query[@<whois.server>]");
return;
}
@ -43,8 +55,7 @@ public class Whois
// Load the properties file.
try
{
FileInputStream in =
new FileInputStream("Whois.properties");
FileInputStream in = new FileInputStream("Whois.properties");
Properties app = new Properties();
app.load(in);
@ -53,11 +64,9 @@ public class Whois
server = (app.getProperty("server", server));
// Get the port property
String tmp = app.getProperty("port");
try
{
port = Integer.parseInt(tmp);
port = Integer.parseInt(app.getProperty("port"));
}
catch (NumberFormatException e)
{
@ -72,19 +81,20 @@ public class Whois
}
catch (IOException e)
{
System.err.println(
"Whois: an error occurred while loading the properties file: "
+ e);
System.err.println("Whois: an error occurred while loading the properties file: " + e);
}
// Build the whois query using command line arguments
String query = args[0];
StringBuffer buff = new StringBuffer(args[0]);
for (int i = 1; i < args.length; i++)
{
query += (" " + args[i]);
buff.append(" " + args[i]);
}
// Convert string buffer to string
String query = buff.toString();
// The whois server can be specified after "@"
// e.g.: query@whois.networksolutions.com
int at = query.lastIndexOf("@");
@ -111,11 +121,8 @@ public class Whois
{
// Establish connection to whois server & port
Socket connection = new Socket(server, port);
PrintStream out =
new PrintStream(connection.getOutputStream());
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
PrintStream out = new PrintStream(connection.getOutputStream());
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line = "";
// Send the whois query

Binary file not shown.

Binary file not shown.

39
whois
View file

@ -1,12 +1,12 @@
#!/bin/sh
# Package: GeekTools Whois Java Client 1.0
# Package: GeekTools Whois Java Client 1.0.1
# File: whois (Bourne shell script)
# Author: Erik C. Thauvin <erik@skytouch.com>
# Comments: Part of the GeekTools Whois Java Client package. See
# the README.TXT file for more information.
#
# Copyright (C) 2000 SkyTouch Communications - All Rights Reserved
# Copyright (C) 2000-2001 SkyTouch Communications - All Rights Reserved
#
# This program is distributed under the terms of the GNU General
# Public License as published by the Free Software Foundation.
@ -26,31 +26,36 @@ then
JAVA_EXE=/bin/java
if [ "$JAVA_PATH" = "" ]
then
# Linux JDK
JAVA_PATH=/usr/java/jdk1.3
# Linux JDK 1.3.0_01
JAVA_PATH=/usr/java/jdk1.3.0_01
if [ ! -x ${JAVA_PATH}${JAVA_EXE} ]
then
# Linux JRE
JAVA_PATH=/usr/java/jre1.3
# Linux JDK 1.3
JAVA_PATH=/usr/java/jdk1.3
if [ ! -x ${JAVA_PATH}${JAVA_EXE} ]
then
# Solaris JDK
JAVA_PATH=/usr/j2se
# Linux JRE
JAVA_PATH=/usr/java/jre1.3
if [ ! -x ${JAVA_PATH}${JAVA_EXE} ]
then
# Solaris JRE
JAVA_PATH=/usr/j2se/jre
# Solaris JDK
JAVA_PATH=/usr/j2se
if [ ! -x ${JAVA_PATH}${JAVA_EXE} ]
then
# Mac OS X
JAVA_PATH=
JAVA_EXE=/System/Library/Frameworks/JavaVM.framework/Versions/1.2/Commands/java
if [ ! -x ${JAVA_EXE} ]
# Solaris JRE
JAVA_PATH=/usr/j2se/jre
if [ ! -x ${JAVA_PATH}${JAVA_EXE} ]
then
JAVA_EXE=`which java`
if [ ! -x $JAVA_EXE ]
# Mac OS X
JAVA_PATH=
JAVA_EXE=/System/Library/Frameworks/JavaVM.framework/Versions/1.2/Commands/java
if [ ! -x ${JAVA_EXE} ]
then
JAVA_EXE=java
JAVA_EXE=`which java`
if [ ! -x $JAVA_EXE ]
then
JAVA_EXE=java
fi
fi
fi
fi

View file

@ -1,12 +1,12 @@
@echo off
rem Package: GeekTools Whois Java Client 1.0
rem Package: GeekTools Whois Java Client 1.0.1
rem File: whois.bat (Batch file)
rem Author: Erik C. Thauvin <erik@skytouch.com>
rem Comments: Part of the GeekTools Whois Java Client package.
rem See the README.TXT file for more information.
rem
rem Copyright (C) 2000 SkyTouch Communications - All Rights Reserved
rem Copyright (C) 2000-2001 SkyTouch Communications - All Rights Reserved
rem
rem This program is distributed under the terms of the GNU General
rem Public License as published by the Free Software Foundation.