1 #ifdef RCSID
2 static char RCSid[] =
3 "$Header: d:/cvsroot/tads/TADS2/LERMSG.C,v 1.2 1999/05/17 02:52:12 MJRoberts Exp $";
4 #endif
5 
6 /*
7  *   Copyright (c) 1993 by Steve McAdams.  All Rights Reserved.
8  *
9  *   Please see the accompanying license file, LICENSE.TXT, for information
10  *   on using and copying this software.
11  */
12 /*
13 Name
14   lermsg.c - Library ERorr message handling routines
15 Function
16 
17 Notes
18 
19 Modified
20   01/04/93 SMcAdams - Creation from TADS errmsg.c
21 */
22 
23 
24 #include "os.h"
25 #include "lib.h"
26 #include "ler.h"
27 #include "ltk.h"
28 
29 
30 /*--------------------------------- lerini ---------------------------------*/
31 /*
32  * lerini - allocate and initialize an error context.  Returns a
33  * pointer to an initialized error context if successful, 0 otherwise.
34  */
lerini()35 errcxdef *lerini()
36 {
37   errcxdef *errcx;                                         /* error context */
38 
39   /* allocate an error context */
40   if (!(errcx = ltk_suballoc(sizeof(errcxdef))))
41   {
42     /* failure */
43     return((errcxdef *)0);
44   }
45 
46   /* initialize the error context */
47   errcx->errcxfp  = (osfildef *)0;                  /* no error file handle */
48   errcx->errcxofs = 0;                      /* no offset in argument buffer */
49   errcx->errcxlog = ltk_errlog;                    /* error logging routine */
50   errcx->errcxlgc = errcx;                         /* error logging context */
51 
52   /* return the new context */
53   return(errcx);
54 }
55 
56 
57 /*--------------------------------- lerfre ---------------------------------*/
58 /*
59  * lerfre - FREe error context allocated by errini.
60  */
lerfre(errcx)61 void lerfre(errcx)
62   errcxdef *errcx;                                 /* error context to free */
63 {
64   /* free the context */
65   ltk_subfree(errcx);
66 }
67 
68 
69 /*--------------------------------- errmsg ---------------------------------*/
70 /*
71  * errmsg - format error message number 'err' into the given buffer.
72  */
errmsg(ctx,outbuf,outbufl,err)73 void errmsg(ctx, outbuf, outbufl, err)
74   errcxdef *ctx;                                           /* error context */
75   char     *outbuf;                                        /* output buffer */
76   uint      outbufl;                                /* output buffer length */
77   uint      err;                                      /* error msg # to get */
78 {
79   sprintf(outbuf, "Error #%d occured.", err);
80 }
81 
82 
83 /*--------------------------------- errini ---------------------------------*/
84 /*
85  * errini - initialize error system.
86  */
errini(ctx,arg0)87 void errini(ctx, arg0)
88   errcxdef *ctx;
89   char     *arg0;
90 {
91     VARUSED(ctx);
92     VARUSED(arg0);
93 }
94