/* @(#)midkeyc.c 17.1.1.1 (ESO-DMD) 01/25/02 17:36:24 */ /*=========================================================================== Copyright (C) 1995 European Southern Observatory (ESO) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. Correspondence concerning ESO-MIDAS should be addressed as follows: Internet e-mail: midas@eso.org Postal address: European Southern Observatory Data Management Division Karl-Schwarzschild-Strasse 2 D 85748 Garching bei Muenchen GERMANY ===========================================================================*/ /*+++++++++++++++++++++ Module MIDKEYA +++++++++++++++++++++++++++++++++++++++ .LANGUAGE C .IDENTIFICATION Module MIDKEYA .AUTHOR Klaus Banse ESO - Garching .KEYWORDS Midas keyword utility routines. .ENVIRONMENT VMS and UNIX .COMMENT holds xPROMPT, (x=,D,x,R)CI .VERSION [3.00] 920129: split off original midkey.c 010917 last modif ------------------------------------------------------------------------*/ #include /* */ int MID_CPROMPT(p_string,noval,carray,nullo) /*++++++++++++++++++++++++++++++++++++++++++++++++++ .PURPOSE display a prompt string on the terminal + read the user input .ALGORITHM use MID_TPRO to display prompt string + get user input as character string convert this string to relevant data via CGN_CNVT .RETURNS status: I*4 return status --------------------------------------------------*/ char *p_string /* IN : prompt string (null terminated) */; int *noval /* IO : length of expected input */; char *carray /* OUT: input data for type = 3 */; int *nullo /* OUT: no. of null values in input */; { int save_val, count; register int nr; char work[96], prombuf[96]; save_val = *noval; /* save noval */ *noval = 0; /* init to 0 ... */ /* store prompt string in logfile */ (void) MID_LOG('G',p_string,(int)strlen(p_string)); /* cut off trailing blanks of prompt + read a line from the terminal */ CGN_CUTOFF(p_string,prombuf); MID_TPRO(prombuf,work,80); count = (int) strlen(work); /* test, if something came in */ if (count <= 0) return ERR_NODATA; /* do not pass more values than required */ (void) MID_LOG('G',work,count); if (save_val <= count) count = save_val; else CGN_FILL(carray,' ',save_val); /* fill first with blanks */ *noval = count; *nullo = 0; for (nr=0; nr