~ubuntu-branches/ubuntu/trusty/pvm/trusty-proposed

« back to all changes in this revision

Viewing changes to src/msgbox.c

  • Committer: Bazaar Package Importer
  • Author(s): Steinar H. Gunderson
  • Date: 2006-08-09 00:00:40 UTC
  • mfrom: (2.1.5 dapper)
  • Revision ID: james.westby@ubuntu.com-20060809000040-16kh33tmxx2em716
Tags: 3.4.5-7
Build with SHELL=/bin/bash in debian/rules; fixes FTBFS when /bin/sh
isn't bash. (Closes: #379543)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
 
2
2
static char rcsid[] =
3
 
        "$Id: msgbox.c,v 1.20 1999/07/08 19:00:04 kohl Exp $";
 
3
        "$Id: msgbox.c,v 1.25 2001/02/07 23:15:49 pvmsrc Exp $";
4
4
 
5
5
/*
6
6
 *         PVM version 3.4:  Parallel Virtual Machine System
36
36
 *      Message mailbox database.
37
37
 *
38
38
 * $Log: msgbox.c,v $
 
39
 * Revision 1.25  2001/02/07 23:15:49  pvmsrc
 
40
 * 2nd Half of CYGWIN Check-ins...
 
41
 * (Spanker=kohl)
 
42
 *
 
43
 * Revision 1.24  2000/02/16 21:59:47  pvmsrc
 
44
 * Fixed up #include <sys/types.h> stuff...
 
45
 *      - use <bsd/sys/types.h> for IMA_TITN...
 
46
 *      - #include before any NEEDMENDIAN #includes...
 
47
 * (Spanker=kohl)
 
48
 *
 
49
 * Revision 1.23  1999/12/13 18:13:41  pvmsrc
 
50
 * Moved pvmmatchstring() routine to pvmcruft.c (for usage by pvmtester).
 
51
 * Re-integrated two versions of mb_name() into one with #ifdefs for
 
52
 *      the USE_GNU_REGEX stuff.
 
53
 * (Spanker=kohl)
 
54
 *
 
55
 * Revision 1.22  1999/12/10 21:30:45  pvmsrc
 
56
 * Yanked GNU Regex Stuff.
 
57
 *      - re-activate using -DUSE_GNU_REGEX define...  if you must.
 
58
 *      - replaced full regular expression matching in mb_names()
 
59
 *              with good ole Unix style '*' globbing,
 
60
 *              via pvmmatchstring() a la Jeembo.
 
61
 * (Spanker=kohl)
 
62
 *
 
63
 * Revision 1.21  1999/11/08 17:21:16  pvmsrc
 
64
 * Added new PvmMboxDirectIndex() flag handling to mb_insert().
 
65
 *      - allow atomic re-insert at a specific index.
 
66
 * (Spanker=kohl)
 
67
 *
39
68
 * Revision 1.20  1999/07/08 19:00:04  kohl
40
69
 * Fixed "Log" keyword placement.
41
70
 *      - indent with " * " for new CVS.
148
177
 
149
178
#include <stdio.h>
150
179
#ifdef NEEDMENDIAN
 
180
#include <sys/types.h>
151
181
#include <machine/endian.h>
152
182
#endif
153
183
#ifdef NEEDENDIAN
158
188
#endif
159
189
 
160
190
#include <pvm3.h>
161
 
#ifdef WIN32
162
 
#ifndef _XDR_HEADERS
163
 
#define _XDR_HEADERS
 
191
 
 
192
#if defined(WIN32) || defined(CYGWIN)
164
193
#include "..\xdr\types.h"
165
194
#include "..\xdr\xdr.h"
166
 
#endif
167
195
#else
168
196
#include <rpc/types.h>
169
197
#include <rpc/xdr.h>
181
209
#include "msgbox.h"
182
210
#include "global.h"
183
211
 
 
212
 
 
213
#ifdef USE_GNU_REGEX
184
214
void *pvmcompileregex __ProtoGlarp__ (( char * ));
185
215
int pvmmatchregex __ProtoGlarp__ (( void *, char * ));
186
216
void pvmfreeregex __ProtoGlarp__ (( void ** ));
 
217
#else
 
218
int pvmmatchstring __ProtoGlarp__ (( char *, char * ));
 
219
#endif
187
220
 
188
221
 
189
222
/***************
290
323
        struct pvmmentry *ep;
291
324
        struct pvmmentry *ep2 = 0;
292
325
 
293
 
        int cind;
 
326
        int dind;       /* direct index */
 
327
        int cind;       /* current index */
294
328
 
295
329
        /* must change to always pass in -1 for 3.4 calls */
296
330
        /* then can distinguish between 3.4 reinsert which succeeds
304
338
                if (!(np = mc_new(name)))
305
339
                        return PvmNoMem;
306
340
 
307
 
        cind = ( req == -1 ) ? 0 : req;
 
341
        dind = PvmMboxDirectIndexOf( flags );
 
342
 
 
343
        cind = ( req == -1 ) ?
 
344
                ( ( dind ) ? dind : 0 )
 
345
                : req;
308
346
 
309
347
        for (ep = np->mc_ent->me_link; ep != np->mc_ent; ep = ep->me_link)
310
348
                if (ep->me_ind >= cind)
433
471
        char *pattern;
434
472
        struct pmsg *mp;
435
473
{
 
474
        struct pvmmclass *np;
 
475
        struct pvmmentry *ep;
 
476
 
 
477
#ifdef USE_GNU_REGEX
436
478
        void *pattbuff;
437
 
 
438
 
        struct pvmmclass *np;
439
 
        struct pvmmentry *ep;
440
 
 
441
479
        int pattglob = 0;
 
480
#endif
 
481
 
442
482
        int cnt;
443
483
 
 
484
#ifdef USE_GNU_REGEX
 
485
 
444
486
        /* Check for "*" Global Match Pattern */
445
487
 
446
488
        if ( !strcmp( pattern, "*" ) )
451
493
        if ( !pattglob )
452
494
                pattbuff = pvmcompileregex( pattern );
453
495
 
 
496
#endif
 
497
 
454
498
        /* Count # of Classes */
455
499
 
456
500
        cnt = 0;
458
502
        for ( np = pvmmboxclasses->mc_link; np != pvmmboxclasses;
459
503
                        np = np->mc_link )
460
504
        {
 
505
#ifdef USE_GNU_REGEX
461
506
                if ( pattglob
462
507
                                || ( ( pattbuff ) ?
463
508
                                        ( pvmmatchregex( pattbuff, np->mc_name ) )
464
509
                                        : ( !strcmp( pattern, np->mc_name ) ) ) )
 
510
#else
 
511
                if ( pvmmatchstring( np->mc_name, pattern ) )
 
512
#endif
465
513
                {
466
514
                        cnt++;
467
515
                }
474
522
        for ( np = pvmmboxclasses->mc_link; np != pvmmboxclasses;
475
523
                        np = np->mc_link )
476
524
        {
 
525
#ifdef USE_GNU_REGEX
477
526
                if ( pattglob
478
527
                                || ( ( pattbuff ) ?
479
528
                                        ( pvmmatchregex( pattbuff, np->mc_name ) )
480
529
                                        : ( !strcmp( pattern, np->mc_name ) ) ) )
 
530
#else
 
531
                if ( pvmmatchstring( np->mc_name, pattern ) )
 
532
#endif
481
533
                {
482
534
                        pkstr( mp, np->mc_name );
483
535
 
503
555
                }
504
556
        }
505
557
 
 
558
#ifdef USE_GNU_REGEX
506
559
        if ( !pattglob && pattbuff )
507
560
                pvmfreeregex( &pattbuff );
 
561
#endif
508
562
 
509
563
        return 0;
510
564
}