~ubuntu-branches/ubuntu/karmic/remind/karmic

« back to all changes in this revision

Viewing changes to src/OBSOLETE/os2func.c

  • Committer: Bazaar Package Importer
  • Author(s): Javier Fernandez-Sanguino Pen~a
  • Date: 1999-02-19 13:36:15 UTC
  • Revision ID: james.westby@ubuntu.com-19990219133615-ovob95sord67b0ks
Tags: 03.00.22-1
* NMU upload, maintainer seems to be missing.
* Changed to main (now GPL) (Closes: #42402)
* New upstream version (Closes: #59447)
* Moved to use debconf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************/
 
2
/*                                                             */
 
3
/*  OS2FUNC.C                                                  */
 
4
/*                                                             */
 
5
/*  Functions to support OS/2.                                 */
 
6
/*                                                             */
 
7
/*  This file is part of REMIND.                               */
 
8
/*                                                             */
 
9
/*  This file is Copyright (C) 1993 by Russ Herman.            */
 
10
/*  REMIND is Copyright (C) 1992-1998 by David F. Skoll        */
 
11
/*  Copyright (C) 1999-2000 by Roaring Penguin Software Inc.   */
 
12
/*                                                             */
 
13
/***************************************************************/
 
14
 
 
15
#include "config.h"
 
16
static char const RCSID[] = "$Id: os2func.c,v 1.1 2000/03/15 16:03:57 dfs Exp $";
 
17
 
 
18
#ifdef OS2_POPUP
 
19
#define INCL_VIO
 
20
#define INCL_KBD
 
21
#endif
 
22
 
 
23
#ifdef _MSC_VER
 
24
#define INCL_DOSPROCESS
 
25
#endif
 
26
 
 
27
#if defined(OS2_POPUP) || defined(_MSC_VER)
 
28
#include <os2.h>
 
29
#endif
 
30
 
 
31
#ifdef OS2_POPUP
 
32
#include <stdio.h>
 
33
#include <stdlib.h>
 
34
#include <string.h>
 
35
#ifdef OS2DBG
 
36
#include <dos.h>
 
37
#include <stdlib.h>
 
38
#endif
 
39
#include "globals.h"
 
40
 
 
41
/* EMX defines PS_TYPE, so we undefine it here to avoid
 
42
   a redefinition warning when we include "types.h" */
 
43
#ifdef PS_TYPE
 
44
#undef PS_TYPE
 
45
#endif
 
46
 
 
47
#include "types.h"
 
48
#include "protos.h"
 
49
 
 
50
#ifdef _MSC_VER
 
51
typedef USHORT APIRET;
 
52
#endif
 
53
 
 
54
static APIRET apiret = 0;
 
55
static KBDKEYINFO kbci;
 
56
static char *pszPressAny = "\r\nPress any key to continue";
 
57
static USHORT pflags = VP_WAIT;  /* | VP_TRANSPARENT; */
 
58
static HKBD hkbd = 0;
 
59
static char VioSubstBuffer[SHELLSIZE + 1];
 
60
 
 
61
void StartPopUp()
 
62
{
 
63
    if (OS2MODE)
 
64
        if (!(DebugFlag & DB_ECHO_LINE))
 
65
            VioPopUp(&pflags, 0);
 
66
}
 
67
 
 
68
void EndPopUp()
 
69
{
 
70
    if (DebugFlag & DB_ECHO_LINE)
 
71
        return;
 
72
    if (OS2MODE) {
 
73
        VioWrtTTY(pszPressAny, strlen(pszPressAny), 0);
 
74
        KbdCharIn(&kbci, IO_WAIT, hkbd);
 
75
        VioEndPopUp(0);
 
76
    }
 
77
}
 
78
 
 
79
int PutsPopUp(char *s)
 
80
{
 
81
    char c, *os = VioSubstBuffer;
 
82
 
 
83
    if (DebugFlag & DB_ECHO_LINE)
 
84
        printf("%s", s);
 
85
    else {
 
86
        do {
 
87
            /* Convert \n to \r\n in auxiliary buffer for VIO */
 
88
            if ((c= *s++) == '\n')
 
89
                *os++ = '\r';
 
90
            *os++ = c;
 
91
        } while (c > 0);
 
92
        VioWrtTTY(VioSubstBuffer, strlen(VioSubstBuffer), 0);
 
93
    }
 
94
    return(0);
 
95
}
 
96
 
 
97
int PutlPopUp(char *s)
 
98
{
 
99
    StartPopUp();
 
100
    PutsPopUp(s);
 
101
    if (DebugFlag & DB_ECHO_LINE)
 
102
        fputc('\n', stdout);
 
103
    else
 
104
        VioWrtTTY("\r\n", 2, 0);
 
105
    EndPopUp();
 
106
    return(0);
 
107
}
 
108
 
 
109
 
 
110
int PutcPopUp(int c)
 
111
{
 
112
    char *s = " ";
 
113
 
 
114
    if (DebugFlag & DB_ECHO_LINE)
 
115
        fputc(c, stdout);
 
116
    else {
 
117
        switch (c) {
 
118
        case '\n':
 
119
            VioWrtTTY("\r\n", 2, 0);
 
120
            break;
 
121
        default:
 
122
            s[0] = c;
 
123
            VioWrtTTY(s, 1, 0);
 
124
            break;
 
125
        }
 
126
    }
 
127
    return(0);
 
128
}
 
129
 
 
130
#ifdef OS2DBG
 
131
#define DB_ECHO_LINE 16
 
132
int DebugFlag = 0;
 
133
void main(/* int argc, char **argv */)
 
134
{
 
135
    int ret;
 
136
 
 
137
    ret = os2fputs("Test VIO PopUp Writing");
 
138
    if (ret)
 
139
        fprintf(stderr, "Test VIO PopUP Writing returned %d %ld",
 
140
                ret, apiret);
 
141
    exit(ret);
 
142
}
 
143
#endif
 
144
#endif
 
145
 
 
146
#ifdef _MSC_VER
 
147
unsigned sleep(unsigned sec)
 
148
{
 
149
    return DosSleep(sec * 1000L);
 
150
}
 
151
#endif
 
152
 
 
153
#ifndef __EMX__ 
 
154
int fork()
 
155
{
 
156
    return(-1);
 
157
}
 
158
#endif
 
159