#!/bin/sh
# "@(#)install_gpib	2.1 10/7/93"
#
# Copyright (c) 1992 Alias Full Color. All rights reserved.
# This is unpublished proprietary source code of Alias Full Color
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
#
# links the GPIB device driver entries (/dev/devN) to the
# symbolic names found in the gpib_addresses file
#

SCRIPT=$0script
trap "rm -f $SCRIPT" 0

# the program for awk
#    get all records after the first two
#    weed out addresses less that 1
#    change addresses >15 to be in range (1-15)
#    generate ln commands 


#invoke awk to generate the script 
awk 'NR>2 && $2>0 {
   if ($2>15)
      {NUM=$2-10; MESSAGE="  # Address Modified from "$2" to "NUM}
   else
      {NUM=$2; MESSAGE=""}

   print "ln /dev/dev"NUM" /dev/"$1,  MESSAGE
   }

' /usr/fcc/util/gpib_addresses > $SCRIPT 

#now execute the commands generated
sh $SCRIPT

echo $0 exiting
