#!/bin/bash

# Refinger v0.04 (part of kfingerd-0.04)
# Copyright (C) 1995 -- Joel Katz -- Stimpson@Panix.COM
# May be freely redistributed in unmodified form

# An ugly little script to cause local fingers to behave
# like remote fingers. This is part of the kfingerd package.
# Hopefully this will soon be replaced with a _much_ better version.

# CAUTION: Use of this script, installed as /usr/bin/finger along with the 
# bsd fingerd will cause spectacular failures!
# (re)finger->finger.bsd->in.fingerd->finger->finger.bsd->in.fingerd-> etc...
# This script _must_ only be used on sites running kfingerd which have
# a copy of the bsd finger on the path and named "finger.bsd".

(
# loop through command line
 for J;
 do
# don't touch options
 if (echo ${J} | cut -c 1 | grep - >/dev/null );
  then echo ${J};
 else
# don't modify when a host is specified
  if (echo ${J} | grep @ >/dev/null) ;
  then echo ${J};
  else
# append "@" to local fingers
# (you can change "@" to "@localhost" if you prefer)
   echo ${J}@;
  fi
 fi
 done
# collect into command line for bsd finger
) | xargs finger.bsd
