~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to prim/tw3/libsrc/tacmd.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*===========================================================================
 
2
  Copyright (C) 1988-2009 European Southern Observatory (ESO)
 
3
 
 
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.
 
8
 
 
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.
 
13
 
 
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, 
 
17
  MA 02139, USA.
 
18
 
 
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 
 
25
                        GERMANY
 
26
===========================================================================*/
 
27
 
 
28
/*+++++++++++   
 
29
.TYPE           Module
 
30
.LANGUAGE       C
 
31
.IDENTIFICATION tacmd.c
 
32
.AUTHOR         Francois Ochsenbein [ESO-IPG]
 
33
.KEYWORDS       Execution of Spawn on a new Window
 
34
.ENVIRONMENT    TermWindows
 
35
.COMMENTS       
 
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
 
40
 
 
41
 090902         last modif
 
42
------------------*/
 
43
 
 
44
#define DEBUG   0       /* debugging option     */
 
45
 
 
46
#define PM_LEVEL        LEVEL_TW-1
 
47
 
 
48
#include <midas_def.h>
 
49
 
 
50
#define  PASCAL_DEF     0
 
51
#include <stesodef.h>
 
52
#include <tw.h>
 
53
 
 
54
#define FINISH  goto FIN
 
55
 
 
56
 
 
57
extern int ta_ret();
 
58
 
 
59
extern int tv_dim(), tv_supply(), tv_where(), tv_bell();
 
60
 
 
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();
 
67
 
 
68
extern int pm_enter(), pm_iexit(), pm_tr2(), pm_ed_i();
 
69
extern int pm_trace();
 
70
extern int eh_put1();
 
71
 
 
72
 
 
73
 
 
74
/*=====================================================================*/
 
75
int ta_cmd(com, input_file)
 
76
/*+++
 
77
.PURPOSE Execute DCL Command
 
78
.RETURNS OK 
 
79
---*/
 
80
        char    *com;           /* IN: Command to execute (NULL => prompted) */
 
81
        char    *input_file;    /* IN: File containing the input \
 
82
                                                (NULL => prompted) */
 
83
{
 
84
        static WINDOW *wDCL = NULL_WINDOW;
 
85
        TWSAVE  pos;    /* Old Position */
 
86
        char    bufcmd[160];
 
87
 
 
88
  ENTER("ta_cmd");
 
89
 
 
90
  if (com)
 
91
  {     if (*com == ' ')        com++;  /* Delete initial blank */
 
92
        TRACE(com);
 
93
        SupplyInputs(com);
 
94
  }
 
95
 
 
96
  if (wDCL == NULL_WINDOW)
 
97
        wDCL = OpenWindow("$", 0, 0, 0, 0, _NORMAL_, _SCROLL_, 20);
 
98
 
 
99
  SaveCursor(&pos);
 
100
  SetAttr(wDCL, _BOLD_), Put(wDCL, "$ "), SetAttr(wDCL, _NORMAL_);
 
101
  RaiseWindow(wDCL), ActiveWindow(wDCL);
 
102
  
 
103
  if (Gets(wDCL, bufcmd, sizeof(bufcmd)) < 0)   FINISH;
 
104
  NewLine(wDCL);
 
105
  ostraw(0);                    /* Added 30-Nov-1989 */
 
106
  if (oshcmd(bufcmd, input_file, NULL_PTR(char), NULL_PTR(char)) < 0)
 
107
        ERROR(osmsg());
 
108
  ostraw(1);                    /* Added 30-Nov-1989 */
 
109
 
 
110
  HitReturn(_REVERSE_|_BLINK_, _DOWNRIGHT_);
 
111
  
 
112
  FIN:
 
113
  ScreenModified(), RemoveWindow(wDCL);
 
114
  RestoreCursor(&pos);
 
115
 
 
116
  EXIT(OK);
 
117
}
 
118