/*************************************************************************
 * AREXX Script
 *
 * Start_MGuide.ced         Copyright (c) 1993, Gerhard Leibrock
 *                            Derived from:
 * Start_TeX.ced            Copyright 1991 by J"org H"ohle
 *
 * AREXX program that starts a script for MakeGuide. It uses the current CEd
 * view and the .texi program located in it.
 * For further details about the great MakeGuide package refer to the MakeGuide
 * package for the CBM AMIGA, a special version of the GNU makeinfo (Simply great
 * for writing docs).
 *
 * Version: $VER: Start_MGuide.ced 1.00	by Gerhard Leibrock (06-Oct-1993)
 *
 * WARNING:
 *         ONLY WORKS FOR PRODUCING .guide FILES !!!!
 *         USELESS FOR PRODUCING .doc OR .dvi FILES !!
 *
 * BUGS:
 *  None known
 *
 * REQUIRES CYGNUS ED PROFESSIONAL AND AREXX !!
 *
 * Gerhard Leibrock, Neuh"auselerstr. 12, 66459 Kirkel, Germany
 * leibrock@fsinfo.cs.uni-sb.de
 ************************************************************************/

OPTIONS RESULTS

Okay1 "Starting MAKEGUIDE Amiga"
status 19	/* full filename */
fullname=RESULT

/* We need an absolute name */
PARSE VALUE namestruc(fullname) WITH ivol idirs ibase .

IF "" == SUBSTR(fullname, 1+ivol+idirs+ibase) | UPPER(RIGHT(fullname,4)) ~= "TEXI" THEN DO
	okay1 "Sorry, filename must have an extension and end in `texi'."
	EXIT 5
	END

IF 0 = ivol THEN DO
	direc = PRAGMA('d')
	IF RIGHT(direc,1)~='/' & RIGHT(direc,1)~=':' THEN direc=direc||'/'
	fullname = direc||fullname
	DROP direc
END

status 20 /* get only the file's path */
path = RESULT
fname = Left(fullname, length(fullname)-5)
IF RIGHT(path,1)~='/' & RIGHT(path,1)~=':' THEN path=path||'/'
comm = 'run execute ' || path ||"Script.Make4Guide" fname path ||"MakeGuide.err"

/* DROP ivol idirs ibase */

/* Save only if file has been modified */
status 18	/* number of changes to the file */
If 0 < RESULT THEN Save

ADDRESS COMMAND comm

return 0
