1
/* @(#)oshtest.c 19.1 (ES0-DMD) 02/25/03 14:33:05 */
2
/*===========================================================================
3
Copyright (C) 1995 European Southern Observatory (ESO)
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License as
7
published by the Free Software Foundation; either version 2 of
8
the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public
16
License along with this program; if not, write to the Free
17
Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
20
Corresponding concerning ESO-MIDAS should be addressed as follows:
21
Internet e-mail: midas@eso.org
22
Postal address: European Southern Observatory
23
Data Management Division
24
Karl-Schwarzschild-Strasse 2
25
D 85748 Garching bei Muenchen
27
===========================================================================*/
32
.IDENTIFICATION TESTosf
33
.VERSION 1.0 23-Oct-1987: Creation
34
.VERSION 1.1 01-Aug-1990: Added oshproc services
35
.AUTHOR Francois Ochsenbein [ESO-IPG]
36
.KEYWORDS Test of osh routines
40
-------------------------------------------------------------------------*/
44
/* char *osmsg(), *oshenv(), *oshuser(), *oshostname(); */
45
char *osmsg(), *oshenv();
46
long oshtime(), oshgmt();
49
static char c1[80], c2[80];
52
{ int i, l, n, n1, n2;
56
puts("Test of osh (Host Services) Routines");
59
{ printf("Operation: ");
60
if (gets(msg) == 0) break;
62
{ case '?': help(); break;
63
case 'l': case 'L': /* Logical translation */
64
printf("Logical to translate: "); gets(c1);
66
printf("Table to use: "); gets(c2);
69
if (r) printf("Translation: %s\n", r);
73
/* case 'n': case 'N': /* NodeName */
74
/* printf("You should be on node `%s'\n", oshostname());
79
/* case 'p': case 'P': /* Put Logical */
80
/* printf("Logical to define: "); gets(c1);
81
/* printf("Equivalence: "); gets(c2);
82
/* l = oshset(c1, c2);
83
/* if (l) puts(osmsg());
87
case 't': case 'T': /* Time */
88
printf("Time is now: %d\n", oshtime());
90
printf("UTime is now: %d\n", oshgmt());
95
/* case 'u': case 'U': /* UserName */
96
/* printf("You should be user `%s'\n", oshuser());
101
case 's': case 'S': /* Set time */
103
{ case 'c': case 'C':
104
tim = oshcpu(INIT_CLOCK, NULL_PTR(float)); break;
106
tim = oshela(INIT_CLOCK, NULL_PTR(long)); break;
107
default: puts("***BAD***");
111
case 'g': case 'G': /* Get time */
113
{ case 'c': case 'C':
114
tim = oshcpu(GET_CLOCK, NULL_PTR(float)); break;
116
tim = oshela(GET_CLOCK, NULL_PTR(long)); break;
118
tim = oshela(-1); break;
120
if (tim >= 0) printf("Time: %d\n", tim);
125
case 'e': case 'E': /* Execute */
126
printf("Specify Command: "); if (gets(msg) == 0) break;
128
printf("Specify stdin : "); if (gets(c1) == 0) break;
129
printf("Specify stdout : "); if (gets(c2) == 0) break;
130
i = oshcmd(msg, c1 , c2, (char *)0);
137
default: puts("***BAD***");
144
puts("Possibilities are: ? Help");
145
puts(" L translate Logical");
146
puts(" SC|SE Set time Cpu|Elapsed");
147
puts(" GC|GE Get Time Cpu|Elapsed");
148
puts(" N tell Node name");
149
puts(" P Put Logical Name in Environment");
150
puts(" T tell Time");
151
puts(" U tell User name");
152
puts(" E Execute a command");