Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!mirror!sources-request From: sources-request@mirror.UUCP Newsgroups: mod.sources Subject: v09i039: MicroEMACS 3.8b, Part07/14 Message-ID: <2290@mirror.TMC.COM> Date: Fri, 13-Mar-87 16:12:40 EST Article-I.D.: mirror.2290 Posted: Fri Mar 13 16:12:40 1987 Date-Received: Sat, 14-Mar-87 11:27:23 EST Sender: rs@mirror.TMC.COM Lines: 2283 Approved: rs@mirror.TMC.COM Submitted by: ihnp4!itivax!duncan!lawrence (Daniel Lawrence) Mod.sources: Volume 9, Issue 39 Archive-name: uemacs3.8b/Part07 #! /bin/sh # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # If this archive is complete, you will see the message: # "End of archive 7 (of 14)." # Contents: exec.c spawn.c window.c # Wrapped by rs@mirror on Fri Mar 13 13:24:22 1987 PATH=/bin:/usr/bin:/usr/ucb ; export PATH echo shar: Extracting \"exec.c\" \(16413 characters\) if test -f exec.c ; then echo shar: Will not over-write existing file \"exec.c\" else sed "s/^X//" >exec.c <<'END_OF_exec.c' X/* This file is for functions dealing with execution of X commands, command lines, buffers, files and startup files X X written 1986 by Daniel Lawrence */ X X#include X#include "estruct.h" X#include "edef.h" X X#if MEGAMAX & ST520 Xoverlay "exec" X#endif X X#if DEBUGM Xchar outline[NSTRING]; /* global string to hold debug line text */ X#endif X X/* namedcmd: execute a named command even if it is not bound */ X Xnamedcmd(f, n) X Xint f, n; /* command arguments [passed through to command executed] */ X X{ X register (*kfunc)(); /* ptr to the requexted function to bind to */ X int (*getname())(); X X /* prompt the user to type a named command */ X mlwrite(": "); X X /* and now get the function name to execute */ X kfunc = getname(); X if (kfunc == NULL) { X mlwrite("[No such function]"); X return(FALSE); X } X X /* and then execute the command */ X return((*kfunc)(f, n)); X} X X/* execcmd: Execute a command line command to be typed in X by the user */ X Xexeccmd(f, n) X Xint f, n; /* default Flag and Numeric argument */ X X{ X register int status; /* status return */ X char cmdstr[NSTRING]; /* string holding command to execute */ X X /* get the line wanted */ X if ((status = mlreply(": ", cmdstr, NSTRING)) != TRUE) X return(status); X X execlevel = 0; X return(docmd(cmdstr)); X} X X/* docmd: take a passed string as a command line and translate X it to be executed as a command. This function will be X used by execute-command-line and by all source and X startup files. Lastflag/thisflag is also updated. X X format of the command line is: X X {# arg} {} X X Directives start with a "!" and include: X X !endm End a macro X !if (cond) conditional execution X !else X !endif X !return Return (terminating current macro) X !goto