~ubuntu-branches/ubuntu/lucid/libx11/lucid

« back to all changes in this revision

Viewing changes to src/os2Stubs.c

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen
  • Date: 2009-01-17 16:34:54 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090117163454-gaey3cd32xyavueo
Tags: 2:1.1.99.2-1build1
Fakesync with Debian, all previous Ubuntu changes are included
in the new upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *                      <marineau@genie.uottawa.ca>
4
4
 *                      <Holger.Veit@gmd.de>
5
5
 *
6
 
 * Permission is hereby granted, free of charge, to any person obtaining a 
7
 
 * copy of this software and associated documentation files (the "Software"), 
8
 
 * to deal in the Software without restriction, including without limitation 
9
 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
10
 
 * and/or sell copies of the Software, and to permit persons to whom the 
 
6
 * Permission is hereby granted, free of charge, to any person obtaining a
 
7
 * copy of this software and associated documentation files (the "Software"),
 
8
 * to deal in the Software without restriction, including without limitation
 
9
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
10
 * and/or sell copies of the Software, and to permit persons to whom the
11
11
 * Software is furnished to do so, subject to the following conditions:
12
12
 *
13
13
 * The above copyright notice and this permission notice shall be included in
14
14
 * all copies or substantial portions of the Software.
15
 
 * 
 
15
 *
16
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL 
19
 
 * HOLGER VEIT  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
20
 
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF 
21
 
 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
 
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
19
 * HOLGER VEIT  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 
20
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
 
21
 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
 * SOFTWARE.
23
 
 * 
24
 
 * Except as contained in this notice, the name of Sebastien Marineau or Holger Veit 
25
 
 * shall not be used in advertising or otherwise to promote the sale, use or other 
 
23
 *
 
24
 * Except as contained in this notice, the name of Sebastien Marineau or Holger Veit
 
25
 * shall not be used in advertising or otherwise to promote the sale, use or other
26
26
 * dealings in this Software without prior written authorization from Holger Veit or
27
27
 * Sebastien Marineau.
28
28
 *
67
67
        return fname;
68
68
 
69
69
    root = (char*)getenv("X11ROOT");
70
 
    if (root==0 || 
 
70
    if (root==0 ||
71
71
        (fname[1]==':' && isalpha(fname[0])) ||
72
72
        (strlen(fname)+strlen(root)+2) > 300)
73
73
        return fname;
132
132
int np,ns, i,ready_handles,n;
133
133
APIRET rc;
134
134
 
135
 
sd.have_read=FALSE; sd.have_write=FALSE; 
 
135
sd.have_read=FALSE; sd.have_write=FALSE;
136
136
sd.socket_nread=0; sd.socket_nwrite=0; sd.socket_ntotal=0;
137
137
sd.max_fds=31; ready_handles=0; any_ready=FALSE;
138
138
sd.pipe_ntotal=0; sd.pipe_have_write=FALSE;
150
150
        }
151
151
   /* Call these a first time to set the semaphore */
152
152
    rc = DosCreateEventSem(NULL, &hPipeSem, DC_SEM_SHARED, FALSE);
153
 
    if(rc) { 
 
153
    if(rc) {
154
154
             fprintf(stderr, "Could not create event semaphore, rc=%d\n",rc);
155
155
             return(-1);
156
156
             }
239
239
                        ready_handles+=np;
240
240
                        any_ready = TRUE;
241
241
                        }
242
 
                        else if (np == -1) { 
 
242
                        else if (np == -1) {
243
243
                                return(-1); }
244
244
                      }
245
245
 
250
250
                     }
251
251
                 else if (ns == -1) {return(-1);}
252
252
 
253
 
                  if (i%8 == 0) { 
 
253
                  if (i%8 == 0) {
254
254
                    now_millis = os2_get_sys_millis();
255
255
                    if((now_millis-start_millis) > timeout_ms) timeout_ms = 0;
256
256
                    }
350
350
   int j,n;
351
351
        memcpy(sd->tcp_select_copy,sd->tcp_select_mask,
352
352
                sd->socket_ntotal*sizeof(int));
353
 
 
 
353
 
354
354
        e = os2_tcp_select(sd->tcp_select_copy,sd->socket_nread,
355
355
                sd->socket_nwrite, 0, 0);
356
356
 
371
371
                     n ++;
372
372
                     }
373
373
               errno = 0;
374
 
               
 
374
 
375
375
               return n;
376
376
              }
377
377
        if(e<0){
394
394
APIRET rc;
395
395
        e = 0;
396
396
        rc = DosResetEventSem(hPipeSem,&ulPostCount);
397
 
        rc = DosQueryNPipeSemState((HSEM) hPipeSem, (PPIPESEMSTATE)&pipeSemState, 
 
397
        rc = DosQueryNPipeSemState((HSEM) hPipeSem, (PPIPESEMSTATE)&pipeSemState,
398
398
                sizeof(pipeSemState));
399
399
        if(rc) fprintf(stderr,"SELECT: rc from QueryNPipeSem: %d\n",rc);
400
400
        i=0;