#!/bin/sh
#
# $Header: ociconv 26-jul-99.09:31:43 mjaeger Exp $
#
# Copyright (c) 1995, 1999, Oracle Corporation.  All rights reserved.
#
# DESCRIPTION
#   Between Release 8.0.1 and 8.0.2, the names of the OCI functions have
#   changed from short names to long names.  This script changes all types,
#   functions, and macros from the short names to the long names.
#   Usage:
#        ociconv <filename>
#   where <filename> is the source file containing the short names.
#
# NOTES
#   ** This script will change the formatting of the source file. **
#   ** To "reformat" use your own tools to reformat!!! ***
# MODIFIED     (MM/DD/YY)
#    mjaeger    07/26/99 - bug 808870: OCCS: convert tabs, no long lines
#   10/02/96 Peter Vasterd - Creation
#   11/09/96 Peter Vasterd - Fix order problem in .sed files

# Check arguments:

if  [ $# -eq 0 ]
then
  echo "Usage: ociconv <filename1> [<filename2>] ... [<filenamen>]"
  echo ""
  echo "Note that <filename> is read AND CHANGED!"
  echo ""
  exit
fi

# Set temporary filename:

temp=tmp"$$"ociconv

echo Release 1.02

# Now for the file(s) passed as an argument, run all sed scripts:

for i in $*
do
  echo Converting file....$i
  for j in oro_m.sed oro_f.sed ori_f.sed ort_f.sed orl_m.sed orl_f.sed \
    oci_m.sed oci_f.sed ;
  do
    if [ -f $ORACLE_HOME/rdbms/demo/$j ]
    then
      sed -f $ORACLE_HOME/rdbms/demo/$j $i > $temp
      cp $temp $i
    else
      echo Error: $ORACLE_HOME/rdbms/demo/$j does not exist.
    fi
  done
done

rm $temp

exit # ociconv

