1 /*****************************************************************************/
2 /*                                                                           */
3 /*                 (C) Copyright 1991-1994  Alberto Pasquale                 */
4 /*                                                                           */
5 /*                   A L L   R I G H T S   R E S E R V E D                   */
6 /*                                                                           */
7 /*****************************************************************************/
8 /*                                                                           */
9 /* This source code is NOT in the public domain and it CANNOT be used or     */
10 /* distributed without written permission from the author.                   */
11 /*                                                                           */
12 /*****************************************************************************/
13 /*                                                                           */
14 /* How to contact the author:  Alberto Pasquale of 2:332/504@fidonet         */
15 /*                             Viale Verdi 106                               */
16 /*                             41100 Modena                                  */
17 /*                             Italy                                         */
18 /*                                                                           */
19 /*****************************************************************************/
20 
21 // MsgApiEr.Cpp
22 
23 
24 #include "msgapier.hpp"
25 #include <unistd.h>
26 
27 void vprintlog (char[], ...);
28 
wr_mapi_err(void)29 void wr_mapi_err (void)
30 {
31     switch (msgapierr) {
32         case MERR_BADH:  vprintlog ("MSGAPI Error: Invalid handle !\n");
33                          break;
34         case MERR_BADF:  vprintlog ("MSGAPI Error: Corrupted file !\n");
35                          break;
36         case MERR_NOMEM: vprintlog ("MSGAPI Error: Not enough memory !\n");
37                          break;
38         case MERR_NODS:  vprintlog ("MSGAPI Error: Disk Full !\n");
39                          break;
40         case MERR_NOENT: vprintlog ("MSGAPI Error: File/Message not found !\n");
41                          break;
42         case MERR_BADA:  vprintlog ("MSGAPI Error: Bad argument !\n");
43                          break;
44         case MERR_EOPEN: vprintlog ("MSGAPI Error: Open messages: cannot close Area !\n");
45                          break;
46 //        case MERR_NOLOCK:vprintlog ("MSGAPI Error: Base needs to be locked !\n");
47 //                         break;
48 //        case MERR_SHARE: vprintlog ("MSGAPI Error: Resource in use by other process !\n");
49 //                         break;
50 //        case MERR_EACCES:vprintlog ("MSGAPI Error: Access denied !\n");
51 //                         break;
52 //        case MERR_BADMSG:vprintlog ("MSGAPI Error: Bad Message Frame !\n");
53 //                         break;
54 //        case MERR_TOOBIG:vprintlog ("MSGAPI Error: Too much text/ctrlinfo !\n");
55 //                         break;
56 
57         default:         vprintlog ("MSGAPI Error: Unknown !\n");
58     }
59 }
60 
61 
MsgSOpenArea(byte * name,word mode,word type)62 HAREA MsgSOpenArea (byte *name, word mode, word type)
63 {
64     HAREA ret;
65     int i;
66 
67     i = 0;
68     ret = MsgOpenArea (name, mode, type);
69 
70     while ((ret == NULL) && (i < 10)) {
71         sleep (1);
72         i++;
73         ret = MsgOpenArea (name, mode, type);
74     };
75 
76     return ret;
77 }
78