1
/*===========================================================================
2
Copyright (C) 1988-2009 European Southern Observatory (ESO)
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public
15
License along with this program; if not, write to the Free
16
Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
19
Corresponding concerning ESO-MIDAS should be addressed as follows:
20
Internet e-mail: midas@eso.org
21
Postal address: European Southern Observatory
22
Data Management Division
23
Karl-Schwarzschild-Strasse 2
24
D 85748 Garching bei Muenchen
26
===========================================================================*/
31
.IDENTIFICATION tacmd.c
32
.AUTHOR Francois Ochsenbein [ESO-IPG]
33
.KEYWORDS Execution of Spawn on a new Window
34
.ENVIRONMENT TermWindows
36
.VERSION 1.0 24-Jun-1988: Based on TermWindows version 3.0
37
.VERSION 1.1 21-Jul-1989: Added parameter to ta_cmd = input file
38
.VERSION 1.2 30-Nov-1989: Be sure to resdet correctly the Terminal
39
.VERSION 1.3 09-Mar-1990: Use HitReturn
44
#define DEBUG 0 /* debugging option */
46
#define PM_LEVEL LEVEL_TW-1
48
#include <midas_def.h>
54
#define FINISH goto FIN
59
extern int tv_dim(), tv_supply(), tv_where(), tv_bell();
61
extern int tw_fill(), tw_attr(), tw_uattr(), tw_r(), tw_goto(), tw_rule();
62
extern int tw_st(), tw_uflag(), tw_chars(), tw_copw(), tw_flags();
63
extern int tw_uw(), tw_write(), tw_il(), tw_clear(), tw_dc();
64
extern int tw_nl(), tw_upw(), tw_uc(), tw_mvc(), tw_copy();
65
extern int tw_mrule(), tw_cus(), tw_gc2(), tw_close(), tw_cur();
66
extern int tw_home(), tw_tra(), tw_wa(), tw_agoto(), tw_mods();
68
extern int pm_enter(), pm_iexit(), pm_tr2(), pm_ed_i();
69
extern int pm_trace();
74
/*=====================================================================*/
75
int ta_cmd(com, input_file)
77
.PURPOSE Execute DCL Command
80
char *com; /* IN: Command to execute (NULL => prompted) */
81
char *input_file; /* IN: File containing the input \
84
static WINDOW *wDCL = NULL_WINDOW;
85
TWSAVE pos; /* Old Position */
91
{ if (*com == ' ') com++; /* Delete initial blank */
96
if (wDCL == NULL_WINDOW)
97
wDCL = OpenWindow("$", 0, 0, 0, 0, _NORMAL_, _SCROLL_, 20);
100
SetAttr(wDCL, _BOLD_), Put(wDCL, "$ "), SetAttr(wDCL, _NORMAL_);
101
RaiseWindow(wDCL), ActiveWindow(wDCL);
103
if (Gets(wDCL, bufcmd, sizeof(bufcmd)) < 0) FINISH;
105
ostraw(0); /* Added 30-Nov-1989 */
106
if (oshcmd(bufcmd, input_file, NULL_PTR(char), NULL_PTR(char)) < 0)
108
ostraw(1); /* Added 30-Nov-1989 */
110
HitReturn(_REVERSE_|_BLINK_, _DOWNRIGHT_);
113
ScreenModified(), RemoveWindow(wDCL);