| 1 |
/*=========================================================================== |
| 2 |
Copyright (C) 1995-2010 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 Massachusetts Ave, Cambridge, |
| 17 |
MA 02139, USA. |
| 18 |
|
| 19 |
Correspondence concerning ESO-MIDAS should be addressed as follows: |
| 20 |
Internet e-mail: [email protected] |
| 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 |
/*+++++++++++++++++++++ Module MIDERR +++++++++++++++++++++++++++++++++++++++ |
| 29 |
.LANGUAGE C |
| 30 |
.IDENTIFICATION Module MIDERR |
| 31 |
.COMMENTS |
| 32 |
holds MID_ERROR, MID_ERRFIL, MID_DSPERR, MID_INITER, MID_E1, MID_E2, MID_PUTERR |
| 33 |
.AUTHOR Klaus Banse ESO - Garching |
| 34 |
.KEYWORDS Midas errors |
| 35 |
.ENVIRONMENT VMS and UNIX |
| 36 |
|
| 37 |
.VERSION |
| 38 |
|
| 39 |
100816 last modif |
| 40 |
------------------------------------------------------------------------*/ |
| 41 |
|
| 42 |
#include <fileexts.h> |
| 43 |
#include <errtable.h> |
| 44 |
|
| 45 |
#include <stdio.h> |
| 46 |
#include <string.h> |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
#define READ 0 |
| 51 |
#define WRITE 1 |
| 52 |
#define READ_WRITE 2 |
| 53 |
#define APPEND 3 |
| 54 |
|
| 55 |
static char caller[16], work[104], mess[84], *messpntr, *pntr; |
| 56 |
/* |
| 57 |
|
| 58 |
*/ |
| 59 |
|
| 60 |
void MID_ERRFIL(ulevel,label) |
| 61 |
|
| 62 |
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 63 |
.PURPOSE: display error messages |
| 64 |
.ALGORITHM: straight forward |
| 65 |
.RETURNS: nothing |
| 66 |
--------------------------------------------------------------------*/ |
| 67 |
|
| 68 |
int ulevel; /* IN: user level */ |
| 69 |
char *label; /* IN: label */ |
| 70 |
|
| 71 |
{ |
| 72 |
int mm, fp; |
| 73 |
|
| 74 |
|
| 75 |
if ((ulevel == 2) || |
| 76 |
(KIWORDS[OFF_ERROR+3] == 0)) return; /* expert mode or NoDisplay */ |
| 77 |
|
| 78 |
|
| 79 |
/* for novices + users we do more */ |
| 80 |
|
| 81 |
fp = CGN_OPEN("MID_MONIT:errpar.dat",READ); |
| 82 |
if (fp == -1) |
| 83 |
{ |
| 84 |
(void) printf("problems opening system errorfile %s ...\n",mess); |
| 85 |
return; |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
while (osaread(fp,mess,80) >= 1) /* read a file record */ |
| 90 |
{ |
| 91 |
if (strncmp(mess,label,6) == 0) /* compare with given label */ |
| 92 |
{ |
| 93 |
mm = osaread(fp,mess,80); /* match - read next record */ |
| 94 |
if (KIWORDS[OFF_ERROR+3] != 0) |
| 95 |
{ |
| 96 |
(void) printf("%s\n",mess); /* and print it */ |
| 97 |
(void) MID_LOG('G',mess,mm); |
| 98 |
} |
| 99 |
|
| 100 |
if (ulevel == 1) |
| 101 |
{ /* for novice users */ |
| 102 |
loop: /* get more records */ |
| 103 |
mm = osaread(fp,mess,80); |
| 104 |
if ( mm != -1) |
| 105 |
{ |
| 106 |
if ( strncmp(mess,"_END",4) != 0) |
| 107 |
{ |
| 108 |
(void) printf("%s\n",mess); /* and print it */ |
| 109 |
(void) MID_LOG('G',mess,mm); |
| 110 |
goto loop; |
| 111 |
} |
| 112 |
} |
| 113 |
} |
| 114 |
break; |
| 115 |
} |
| 116 |
} |
| 117 |
|
| 118 |
(void)osaclose(fp); /* close error message file */ |
| 119 |
} |
| 120 |
/* |
| 121 |
|
| 122 |
*/ |
| 123 |
|
| 124 |
void MID_DSPERR() |
| 125 |
|
| 126 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 127 |
.PURPOSE |
| 128 |
display error messages |
| 129 |
.ALGORITHM |
| 130 |
straight forward |
| 131 |
.RETURNS |
| 132 |
nothing |
| 133 |
--------------------------------------------------------*/ |
| 134 |
|
| 135 |
{ |
| 136 |
int mm, kk, prflag, usr_level, mesoff, kk1; |
| 137 |
int source = 0; |
| 138 |
static int fflag = 0; |
| 139 |
|
| 140 |
char saverr[8], full_mess[80]; |
| 141 |
|
| 142 |
|
| 143 |
if (ERRO_DISP != 0) |
| 144 |
{ |
| 145 |
prflag = KIWORDS[OFF_ERROR]; /* print flag = ERROR(1) */ |
| 146 |
if (fflag == 0) |
| 147 |
{ |
| 148 |
fflag = 1; |
| 149 |
if (prflag > 0) |
| 150 |
{ |
| 151 |
kk = OFF_APPLIC + 2; /* point to name of application */ |
| 152 |
pntr = &KCWORDS[kk]; |
| 153 |
memset((void *)work,32,(size_t)58); |
| 154 |
(void) strncpy(work,pntr,58); /* applic length - 2 */ |
| 155 |
work[58] = '\0'; |
| 156 |
kk = CGN_INDEXC(work,' '); |
| 157 |
if (kk > 0) work[kk] = '\0'; /* truncate if possible */ |
| 158 |
(void) strcpy(full_mess,"--- in module "); |
| 159 |
(void) strcat(full_mess,work); |
| 160 |
if (KIWORDS[OFF_ERROR+3] != 0) |
| 161 |
{ /* ERROR(4) = 0 -> no display */ |
| 162 |
(void) printf("%s\n",full_mess); |
| 163 |
(void) MID_LOG('G',full_mess,(int)strlen(full_mess)); |
| 164 |
} |
| 165 |
} |
| 166 |
} |
| 167 |
|
| 168 |
usr_level = KIWORDS[OFF_ERROR+1]; /* user level = ERROR(2) */ |
| 169 |
kk1 = ERRO_INDX; |
| 170 |
|
| 171 |
|
| 172 |
/* empty error message stack */ |
| 173 |
|
| 174 |
for (kk=kk1; kk > -1; kk--) /* loop from kk1 down to 0 */ |
| 175 |
{ |
| 176 |
mesoff = ERROS[kk][1]; |
| 177 |
pntr = &ERRO_MESAGS[mesoff]; |
| 178 |
if ((kk == kk1) || (kk == 0) || (prflag != 0)) |
| 179 |
{ |
| 180 |
if (KIWORDS[OFF_ERROR+3] != 0) |
| 181 |
{ |
| 182 |
(void) printf("%s\n",pntr); /* display error message */ |
| 183 |
(void) MID_LOG('G',pntr,(int)strlen(pntr)); |
| 184 |
} |
| 185 |
|
| 186 |
if (kk == kk1) /* save error of top of stack */ |
| 187 |
{ |
| 188 |
(void) SCKWRC("MID$ERRMESS",1,pntr,1,80,&mm); /* => MID$ERRMESS */ |
| 189 |
|
| 190 |
source = ERROS[kk][0]; |
| 191 |
mm = CGN_INDEXS(pntr,"- "); /* get to error itself... */ |
| 192 |
pntr += (mm + 2); |
| 193 |
(void) strncpy(saverr,pntr,6); |
| 194 |
} |
| 195 |
|
| 196 |
if (kk == 0) |
| 197 |
{ |
| 198 |
if (source == 1) /* MIDAS error: */ |
| 199 |
MID_ERRFIL(usr_level,saverr); /* write canned help text */ |
| 200 |
#if vms |
| 201 |
else if (source == 2) |
| 202 |
{ /* - Operating or File system interfaces: */ |
| 203 |
int istat; |
| 204 |
|
| 205 |
mm = sscanf(saverr,"%d",&istat); |
| 206 |
if ((mm != 0) && (istat != 0)) |
| 207 |
{ |
| 208 |
char tmp[260]; |
| 209 |
|
| 210 |
OSY_MESSAGE(istat,tmp); /* obtain full message */ |
| 211 |
(void)printf("%s\n",tmp); |
| 212 |
} |
| 213 |
} |
| 214 |
#endif |
| 215 |
} |
| 216 |
} |
| 217 |
} |
| 218 |
|
| 219 |
ERRO_INDX = -1; |
| 220 |
ERRO_OFF = 0; |
| 221 |
} |
| 222 |
} |
| 223 |
/* |
| 224 |
|
| 225 |
*/ |
| 226 |
|
| 227 |
void MID_ERROR(subsystem,text,status,print) |
| 228 |
|
| 229 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 230 |
.PURPOSE |
| 231 |
display error/warning/info messages |
| 232 |
.ALGORITHM |
| 233 |
store message into error stack + display complete stack if relevant |
| 234 |
store warning/error status and error source into key PROGSTAT |
| 235 |
.RETURNS |
| 236 |
nothing. |
| 237 |
--------------------------------------------------------*/ |
| 238 |
|
| 239 |
char *subsystem /* subsystem from which error resulted OSY or FSY or \ |
| 240 |
MIDAS */; |
| 241 |
char *text /* text to be stored in the error stack */; |
| 242 |
int status /* error status */; |
| 243 |
int print /* print flag, if set dump contents of error stack + \ |
| 244 |
reset pointer */; |
| 245 |
|
| 246 |
{ |
| 247 |
int mm, kk, source, ind; |
| 248 |
static int errtab_off = 9; /* must be = lowest warning code! */ |
| 249 |
|
| 250 |
char *osmsg(); |
| 251 |
static char fixtype[20] = {'(','O','S','Y',')','(','F','S','Y',')', |
| 252 |
'(','E','R','R',')','(','I','/','W',')'}; |
| 253 |
static char aux1 [3] = {' ','-',' '}; |
| 254 |
static char aux2 [9] = {' ','-',' ','I','N','V','E','R','R'}; |
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
/* init message string */ |
| 260 |
|
| 261 |
mm = (int) strlen(text); /* get length of text */ |
| 262 |
if (mm > 65) mm = 65; /* minimize... */ |
| 263 |
memset((void *)mess,32,(size_t)6); |
| 264 |
|
| 265 |
|
| 266 |
/* subsystem may either be OSY, FSY, APP or MIDAS */ |
| 267 |
|
| 268 |
if ((*subsystem == 'O') || (*subsystem == 'F')) |
| 269 |
{ |
| 270 |
source = 2; /* OSY or FSY error... */ |
| 271 |
pntr = fixtype; /* use both "(OSY)" prefix */ |
| 272 |
(void) strncpy(mess,pntr,5); /* copy type of error */ |
| 273 |
messpntr = mess + 6; |
| 274 |
#if vms |
| 275 |
(void) snprintf(messpntr,(size_t) 78, |
| 276 |
"%s - %d (or %x hex)",text,status,status); |
| 277 |
#else |
| 278 |
(void) snprintf(messpntr,(size_t) 78,"%s %s",text,osmsg()); |
| 279 |
#endif |
| 280 |
KIWORDS[OFF_PRSTAT+3] = status; /* save host system error */ |
| 281 |
} |
| 282 |
|
| 283 |
else if (*subsystem == 'A') |
| 284 |
{ |
| 285 |
source = 100; /* application provided error */ |
| 286 |
ERRO_INDX = -1; /* reset error stack */ |
| 287 |
ERRO_OFF = 0; |
| 288 |
(void) strcpy(mess,"(APP) application error"); |
| 289 |
(void) snprintf(work,(size_t) 20," - %d ",status); /* append error */ |
| 290 |
(void) strcat(mess,work); |
| 291 |
|
| 292 |
} |
| 293 |
|
| 294 |
else |
| 295 |
{ |
| 296 |
if ( (ERRO_LOG == 0) || |
| 297 |
((ERRO_LOG == 1) && (status < 0)) ) return; |
| 298 |
|
| 299 |
source = 1; /* error from MIDASLIB... */ |
| 300 |
if (status > 0) |
| 301 |
pntr = fixtype + 10; |
| 302 |
else |
| 303 |
pntr = fixtype + 15; |
| 304 |
|
| 305 |
(void) strncpy(mess,pntr,5); /* copy type of error */ |
| 306 |
messpntr = mess + 6; |
| 307 |
(void) strncpy(messpntr,text,(size_t) mm); /* copy user message */ |
| 308 |
messpntr += mm; /* adapt to count in MESS */ |
| 309 |
ind = (status + errtab_off) * 6; /* get offset into error table */ |
| 310 |
|
| 311 |
if (ind >= (ETABLIM*6)) |
| 312 |
{ |
| 313 |
(void) strncpy(messpntr,aux2,9); |
| 314 |
messpntr += 9; /* determine final length */ |
| 315 |
} |
| 316 |
else |
| 317 |
{ |
| 318 |
(void) strncpy(messpntr,aux1,3); |
| 319 |
pntr = ERRTAB + ind; |
| 320 |
(void) strncpy(messpntr+3,pntr,6); |
| 321 |
messpntr += 9; /* determine final length */ |
| 322 |
} |
| 323 |
*messpntr = '\0'; /* fix the end */ |
| 324 |
} |
| 325 |
|
| 326 |
|
| 327 |
/* put all relevant stuff on error stack */ |
| 328 |
|
| 329 |
kk = MID_PUTERR(source); |
| 330 |
if (kk != 0) /* something went wrong... */ |
| 331 |
{ |
| 332 |
if (print > 0) |
| 333 |
{ |
| 334 |
if (kk == 1) |
| 335 |
(void) printf(" error stack overflow... \n"); |
| 336 |
else |
| 337 |
(void) printf(" error message buffer overflow... \n"); |
| 338 |
|
| 339 |
MID_DSPERR(); /* display contents of error stack */ |
| 340 |
} |
| 341 |
ERRO_INDX = -1; |
| 342 |
ERRO_OFF = 0; |
| 343 |
(void) MID_PUTERR(source); |
| 344 |
} |
| 345 |
|
| 346 |
|
| 347 |
KCWORDS[OFF_APPLIC] = 'x'; /* indicate that module was "aborted" */ |
| 348 |
|
| 349 |
if (print < 1) return; /* low level MIDAS routines exit here... */ |
| 350 |
|
| 351 |
ind = ERRO_INDX; /* we may need it later... */ |
| 352 |
MID_DSPERR(); |
| 353 |
|
| 354 |
if (source == 100) return; /* do the rest in SCETER ... */ |
| 355 |
|
| 356 |
|
| 357 |
/* finally check continuation flag for high level interfaces */ |
| 358 |
|
| 359 |
if ( (ERRO_CONT == -1) || /* stop on everything */ |
| 360 |
((status > 0) && (ERRO_CONT == 0)) ) /* stop on errors only */ |
| 361 |
{ |
| 362 |
if (caller[0] != '*') |
| 363 |
{ /* print high level calling routine */ |
| 364 |
kk = ERROS[ind][1]; |
| 365 |
pntr = &ERRO_MESAGS[kk]; |
| 366 |
mm = CGN_INDEXS(pntr,"- "); /* get to error itself... */ |
| 367 |
pntr += mm; |
| 368 |
(void) printf("(ERR) %s: %s\n",caller,pntr); |
| 369 |
caller[0] = '*'; |
| 370 |
} |
| 371 |
|
| 372 |
MID_ABORT(status,source); /* now exit (but set ERROR(6) first) */ |
| 373 |
} |
| 374 |
} |
| 375 |
/* |
| 376 |
|
| 377 |
*/ |
| 378 |
|
| 379 |
void MID_INITER() |
| 380 |
|
| 381 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 382 |
.PURPOSE |
| 383 |
initialize error structures |
| 384 |
.ALGORITHM |
| 385 |
straight forward |
| 386 |
.RETURNS |
| 387 |
nothing |
| 388 |
--------------------------------------------------------*/ |
| 389 |
|
| 390 |
{ |
| 391 |
|
| 392 |
/* reset pointers */ |
| 393 |
|
| 394 |
ERRO_INDX = -1; /* last used entry in stack */ |
| 395 |
ERRO_OFF = 0; /* offset to first free char. in message buffer */ |
| 396 |
|
| 397 |
ERRO_CONT = 0; /* stop on errors only */ |
| 398 |
ERRO_LOG = 2; /* log warnings + errors */ |
| 399 |
ERRO_DISP = 1; /* display only errors */ |
| 400 |
|
| 401 |
caller[0] = '*'; /* clear high level calling routine */ |
| 402 |
|
| 403 |
} |
| 404 |
|
| 405 |
void MID_POPERR() |
| 406 |
|
| 407 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 408 |
.PURPOSE |
| 409 |
remove last (top) stack entry |
| 410 |
.ALGORITHM |
| 411 |
straight forward |
| 412 |
.RETURNS |
| 413 |
nothing |
| 414 |
--------------------------------------------------------*/ |
| 415 |
|
| 416 |
{ |
| 417 |
|
| 418 |
int mm; |
| 419 |
|
| 420 |
|
| 421 |
mm = ERRO_INDX; |
| 422 |
if (mm > 0) /* if not 1st entry */ |
| 423 |
{ |
| 424 |
ERRO_INDX--; |
| 425 |
ERRO_OFF = ERROS[mm][1]; /* get previous offset */ |
| 426 |
if (ERRO_OFF < 0) ERRO_OFF = 0; |
| 427 |
} |
| 428 |
else |
| 429 |
{ |
| 430 |
ERRO_INDX = -1; |
| 431 |
ERRO_OFF = 0; /* offset to 1st free char. in messbuffer */ |
| 432 |
} |
| 433 |
|
| 434 |
caller[0] = '*'; /* clear high level calling routine */ |
| 435 |
} |
| 436 |
/* |
| 437 |
|
| 438 |
*/ |
| 439 |
|
| 440 |
int MID_PUTERR(source) |
| 441 |
|
| 442 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 443 |
.PURPOSE |
| 444 |
put error message into error stack |
| 445 |
.ALGORITHM |
| 446 |
straight forward |
| 447 |
.RETURNS |
| 448 |
istat: 0, if o.k; 1, overflow in error stack; |
| 449 |
2, overflow in message buffer |
| 450 |
-------------------------------------------------------*/ |
| 451 |
|
| 452 |
int source /* IN : source of error */; |
| 453 |
|
| 454 |
|
| 455 |
{ |
| 456 |
int mm, meslen; |
| 457 |
|
| 458 |
|
| 459 |
/* check index of error stack */ |
| 460 |
|
| 461 |
mm = ERRO_INDX + 1; /* point to next free slot in stack */ |
| 462 |
if (mm >= ERRO_MAXENT) return (1); |
| 463 |
|
| 464 |
meslen = (int) strlen(mess); |
| 465 |
|
| 466 |
|
| 467 |
/* test, if full message + '\0' fits... */ |
| 468 |
|
| 469 |
if ( (ERRO_OFF + meslen) >= ERRO_MAXLEN) return (2); |
| 470 |
|
| 471 |
|
| 472 |
/* we still got space for this one... */ |
| 473 |
|
| 474 |
ERRO_INDX = mm; /* update stack index */ |
| 475 |
ERROS[mm][0] = source; |
| 476 |
ERROS[mm][1] = ERRO_OFF; /* set offset */ |
| 477 |
|
| 478 |
|
| 479 |
/* finally put the actual message into message buffer */ |
| 480 |
|
| 481 |
(void) strcpy(&ERRO_MESAGS[ERRO_OFF],mess); |
| 482 |
ERRO_OFF += (meslen + 1); /* update message offset */ |
| 483 |
|
| 484 |
return (0); |
| 485 |
} |
| 486 |
/* |
| 487 |
|
| 488 |
*/ |
| 489 |
|
| 490 |
void MID_E1(funcno,text,status,print) |
| 491 |
|
| 492 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 493 |
.PURPOSE |
| 494 |
display error/warning/info messages |
| 495 |
.ALGORITHM |
| 496 |
call MID_ERROR |
| 497 |
.RETURNS |
| 498 |
nothing. |
| 499 |
--------------------------------------------------------*/ |
| 500 |
|
| 501 |
int funcno; /* IN: no. of function from which error resulted */ |
| 502 |
char *text /* text to be stored in the error stack */; |
| 503 |
int status /* error status */; |
| 504 |
int print /* print flag, if set dump contents of error stack + \ |
| 505 |
reset pointer */; |
| 506 |
|
| 507 |
{ |
| 508 |
int mm; |
| 509 |
|
| 510 |
static char modu_1[] = |
| 511 |
"SPROSEPIFOPNFCREKRDxKPROKWRxKINFIPUTIGETKFNDFINFFXMP"; |
| 512 |
|
| 513 |
|
| 514 |
mm = (funcno - 1) * 4; |
| 515 |
|
| 516 |
(void) strcpy(work,"SC "); |
| 517 |
(void) strncpy(&work[2],&modu_1[mm],4); |
| 518 |
(void) strcpy(&work[6],": "); |
| 519 |
(void) strcpy(&work[8],text); |
| 520 |
|
| 521 |
MID_ERROR("MIDAS",work,status,print); |
| 522 |
} |
| 523 |
/* |
| 524 |
|
| 525 |
*/ |
| 526 |
|
| 527 |
void MID_E2(funcno,imno,text,status,print) |
| 528 |
|
| 529 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 530 |
.PURPOSE |
| 531 |
display error/warning/info workages |
| 532 |
.ALGORITHM |
| 533 |
call MID_ERROR |
| 534 |
.RETURNS |
| 535 |
nothing. |
| 536 |
--------------------------------------------------------*/ |
| 537 |
|
| 538 |
int funcno; /* IN: no. of function from which error resulted */ |
| 539 |
int imno; /* IN: FCT entry no. of frame involved */ |
| 540 |
char *text /* text to be stored in the error stack */; |
| 541 |
int status /* error status */; |
| 542 |
int print /* print flag, if set dump contents of error stack + \ |
| 543 |
reset pointer */; |
| 544 |
|
| 545 |
{ |
| 546 |
int mm; |
| 547 |
|
| 548 |
static char modu_2[] = |
| 549 |
"FCLOFMAPFUNMDDELDWRxDRDxDINFDCOPDFNDFGETFPUTPGETPPUT"; |
| 550 |
|
| 551 |
|
| 552 |
mm = (funcno - 1) * 4; |
| 553 |
|
| 554 |
(void) strcpy(work,"SC "); |
| 555 |
(void) strncpy(&work[2],&modu_2[mm],4); |
| 556 |
(void) strcpy(&work[6],": "); |
| 557 |
|
| 558 |
mm = MID_RETNAM(imno,&work[8],80); /* get name of file */ |
| 559 |
if (mm < 0) (void) strcpy(&work[8],"wrong file number"); |
| 560 |
(void) strcat(work," + "); |
| 561 |
(void) strcat(work,text); |
| 562 |
|
| 563 |
MID_ERROR("MIDAS",work,status,print); |
| 564 |
} |
| 565 |
/* |
| 566 |
|
| 567 |
*/ |
| 568 |
|
| 569 |
void MID_E3(callfunc) |
| 570 |
|
| 571 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 572 |
.PURPOSE |
| 573 |
put name of high level calling rotuine into internal buffer |
| 574 |
.ALGORITHM |
| 575 |
use strcpy ... |
| 576 |
.RETURNS |
| 577 |
nothing. |
| 578 |
--------------------------------------------------------*/ |
| 579 |
|
| 580 |
char *callfunc; |
| 581 |
|
| 582 |
{ |
| 583 |
(void) strcpy(caller,callfunc); |
| 584 |
} |
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
void MID_ABORT(erro,source) |
| 589 |
|
| 590 |
/*+++++++++++++++++++++++++++++++++++++++++++++++++++ |
| 591 |
.PURPOSE |
| 592 |
abort application program, but close keyfile correctly |
| 593 |
.ALGORITHM |
| 594 |
as it should be... |
| 595 |
.RETURNS |
| 596 |
nothing. |
| 597 |
--------------------------------------------------------*/ |
| 598 |
|
| 599 |
int erro, source; |
| 600 |
|
| 601 |
{ |
| 602 |
KIWORDS[OFF_PRSTAT] = erro; /* store status and error source */ |
| 603 |
KIWORDS[OFF_PRSTAT+1] = source; /* into key PROGSTAT */ |
| 604 |
|
| 605 |
MID_LOG('O',work,5); /* leave like in SCSEPI ... */ |
| 606 |
work[0] = ' '; |
| 607 |
MID_MOVKEY("O",work); /* update keyfile */ |
| 608 |
|
| 609 |
ospexit(0); /* and get out of here! */ |
| 610 |
} |
| 611 |
/* |
| 612 |
|
| 613 |
*/ |
| 614 |
|
| 615 |
void error_ret(fnam,addon,myerrno,status) |
| 616 |
|
| 617 |
char *fnam, *addon; |
| 618 |
int myerrno, status; |
| 619 |
|
| 620 |
{ |
| 621 |
int mm; |
| 622 |
|
| 623 |
char txt[80]; |
| 624 |
|
| 625 |
mm = CGN_INDEXC(fnam,' '); |
| 626 |
if (mm <= 0) mm = (int) strlen(fnam); |
| 627 |
(void) strncpy(txt,fnam,(size_t) mm); |
| 628 |
txt[mm++] = ' '; |
| 629 |
(void) strcpy(&txt[mm],addon); |
| 630 |
MID_E1(myerrno,txt,status,1); |
| 631 |
} |
| 632 |
|