~ubuntu-branches/ubuntu/wily/gargoyle-free/wily-proposed

« back to all changes in this revision

Viewing changes to tads/tads2/lermsg.c

  • Committer: Bazaar Package Importer
  • Author(s): Sylvain Beucler
  • Date: 2009-09-11 20:09:43 UTC
  • Revision ID: james.westby@ubuntu.com-20090911200943-idgzoyupq6650zpn
Tags: upstream-2009-08-25
ImportĀ upstreamĀ versionĀ 2009-08-25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 */
 
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
 */
 
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
 */
 
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
 */
 
87
void errini(ctx, arg0)
 
88
  errcxdef *ctx;
 
89
  char     *arg0;
 
90
{
 
91
    VARUSED(ctx);
 
92
    VARUSED(arg0);
 
93
}