New from Snide Computer Services !!!
Posted in 1993
You know when your working on a 4GL program and you get a compile-time error. You then type: "vi *.err", locate the error, fix it, save and exit. What happens when you re-compile. Bingo! the same compile-time error! I hate when that happens! Anyway, enclosed is a program called "vie". It means "VI error". VIE is nothing more than a shell-wrapper for "vi" that edits an error file and then put the changes into your original source/form file. I've been using "vie" for the month of October and now I find it very difficult to be without. Enjoy! Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip #!/bin/sh # This is a shell archive (produced by shar 3.50) # To extract the files from this archive, save it to a file, remove # everything above the "!/bin/sh" line above, and type "sh file_name". # # Made 10/22/1993 13:34 EDT by dave@das13.snide.com # # Existing files will NOT be overwritten unless -c is specified # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 2045 -rwxr-xr-x vie # 701 -rw-r--r-- vie.1 # # ============= vie ============== if test -f 'vie' -a X"$1" != X"-c"; then echo 'x - skipping vie (File already exists)' else echo 'x - extracting vie (Text)' sed 's/^X//' << 'SHAR_EOF' > 'vie' && X: X## X##################################################### X# X# Copyright(c) 1993 by David A. Snyder X# X# This document contains information that is X# the property of David A. Snyder. X# X# INFORMIX -- Informix Software Inc. X# X# Title: vie X# X##################################################### X## X X# Clear values of some variables Xunset FGL Xunset PER X X X# Make sure that the file exists and strip off the extension Xif [ ! -f "$1" ] Xthen X echo "$1: No such file or directory." >&2 X exit 1 Xfi XBFILE=`basename $1 .err` X X X# Determine if the error file is an Informix-4GL source error file Xegrep -i "^GLOBALS|^MAIN|^FUNCTION|^REPORT" ${BFILE}.err >/dev/null 2>&1 Xtest $? = 0 && FGL=1 X X# Determine if the error file is an Informix-4GL form error file Xgrep -i "^TABLE" ${BFILE}.err >/dev/null 2>&1 Xtest $? = 0 && PER=1 X X# Bail-out if there was a problem Xif [ "$FGL" -eq 0 -a "$PER" -eq 0 ] Xthen X echo "$1: Probably not an Informix-4GL error file." >&2 X exit 1 Xelif [ "$FGL" -eq 1 -a "$PER" -eq 1 ] Xthen X echo "$1: Can not determine the origin of this Informix-4GL error file." >&2 X exit 1 Xfi X X X# Edit the error file and place the cursor at the first error Xif [ "$FGL" -eq 1 ] Xthen X vi +/^\\| ${BFILE}.err X STAT=$? Xelse X vi +/^\\# ${BFILE}.err X STAT=$? Xfi X X# Bail-out if there was a problem Xif [ $STAT -ne 0 ] Xthen X echo "$0: VI exited with a non-zero status." >&2 X exit $STAT Xfi X X X# Create a backup of the source file (just in case :-) Xif [ "$FGL" -eq 1 ] Xthen X cp ${BFILE}.4gl ${BFILE}.4bl X STAT=$? Xelse X cp ${BFILE}.per ${BFILE}.pbr X STAT=$? Xfi X X# Bail-out if there was a problem Xif [ $STAT -ne 0 ] Xthen X exit $STAT Xfi X X X# Replace the error file with the source/form file while deleting error markers Xif [ "$FGL" -eq 1 ] Xthen X sed '/^|/d' <${BFILE}.err >${BFILE}.4gl X STAT=$? Xelse X sed '/^#/d' <${BFILE}.err >${BFILE}.per X STAT=$? Xfi X X# Bail-out if there was a problem Xif [ $STAT -ne 0 ] Xthen X exit $STAT Xfi X X X# Delete the error file and exit Xrm ${BFILE}.err Xexit $? SHAR_EOF chmod 0755 vie || echo 'restore of vie failed' Wc_c="`wc -c < 'vie'`" test 2045 -eq "$Wc_c" || echo 'vie: original size 2045, current size' "$Wc_c" fi # ============= vie.1 ============== if test -f 'vie.1' -a X"$1" != X"-c"; then echo 'x - skipping vie.1 (File already exists)' else echo 'x - extracting vie.1 (Text)' sed 's/^X//' << 'SHAR_EOF' > 'vie.1' && X.\\" $Id: vie.1,v 1.1 1993/03/18 15:34:45 dave Exp $ X.\\" X.\\" Man page for vie. X.\\" X.TH VIE 1 X.SH NAME Xvie \\- views/corrects Informix\\-4GL error files X.SH SYNOPSIS Xvie progname.err X.SH DESCRIPTION X.I Vie Xwill allow you to view and correct an Informix\\-4GL source/form Xerror file using "vi". X.SH OPTIONS X.TP X progname.err is the Informix\\-4GL source/form error file X.SH NOTES X.I Vie Xcan be fooled if the words MAIN, FUNCTION, REPORT, GLOBALS, or TABLE Xstart at the beginning of a line in a file that they normally wouldn't Xbe in. X X.I Vie Xmakes a backup of the Informix-4GL source/form file before replacement Xwith the error file. X.SH SUPPORT XBug reports can be mailed to Dave Snyder <dave@snide.com> SHAR_EOF chmod 0644 vie.1 || echo 'restore of vie.1 failed' Wc_c="`wc -c < 'vie.1'`" test 701 -eq "$Wc_c" || echo 'vie.1: original size 701, current size' "$Wc_c" fi exit 0 Here --------- Snip Here --------- Snip Here --------- Snip Here --------- Snip DAS -- David Snyder @ Snide Computer Services - Folcroft, PA Current Release is db4glgen-3.16 UUCP: ..!uunet!das13!dave INTERNET: dave.snyder@snide.com
I hate vi.