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

« back to all changes in this revision

Viewing changes to examples/mbox.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: mbox.c,v 1.9 1999/03/15 19:04:19 pvmsrc Exp $";
 
3
        "$Id: mbox.c,v 1.11 2001/06/27 23:20:51 pvmsrc Exp $";
4
4
 
5
5
/*
6
6
 *         PVM version 3.4:  Parallel Virtual Machine System
212
212
 
213
213
        char *arg;
214
214
 
 
215
        int NINDICES = 10;
 
216
 
215
217
        int do_noreset;
216
218
        int do_favail;
217
219
        int do_unpack;
291
293
                        do_unpack = 0;
292
294
                }
293
295
 
 
296
                else if ( !strncmp( arg, "nindices=", 9 ) )
 
297
                        NINDICES = atoi( arg + 9 );
 
298
 
294
299
                else if ( !strcmp( arg, "help" ) )
295
300
                        usage();
296
301
 
370
375
 
371
376
                        if ( ncmds == 1 )
372
377
                        {
373
 
                                for ( i=0 ; i < 10 ; i++ )
 
378
                                for ( i=0 ; i < NINDICES ; i++ )
374
379
                                {
375
380
                                        cc = check_msg( CLASS_NAME, i, flags,
376
381
                                                bufout, &tmp, do_unpack );
415
420
 
416
421
                        if ( ncmds == 1 )
417
422
                        {
418
 
                                for ( i=0 ; i < 10 ; i++ )
 
423
                                for ( i=0 ; i < NINDICES ; i++ )
419
424
                                {
420
425
                                        cc = pvm_delinfo( CLASS_NAME, i, flags );
421
426
 
853
858
 
854
859
                        ret++;
855
860
                }
 
861
 
 
862
                else if ( !strcmp( cmds[0], "direct" ) )
 
863
                {
 
864
                        set_flags( &flags, 0 /*do_pers*/, 1 /*do_favail*/, do_owrit,
 
865
                                1 /*do_minst*/, do_rddel, do_wait );
 
866
 
 
867
                        for ( i=0 ; i < 3 ; i++ )
 
868
                        {
 
869
                                sprintf( bufin,
 
870
                                        "This Message Left Here By Mbox (%d)", i );
 
871
 
 
872
                                index = stuff_msg( CLASS_NAME, flags, bufin, mytid );
 
873
 
 
874
                                if ( index < 0 )
 
875
                                        exit( -1 );
 
876
 
 
877
                                cc = check_msg( CLASS_NAME, index, 0, bufout, &tmp,
 
878
                                        do_unpack );
 
879
 
 
880
                                if ( cc < 0 )
 
881
                                        exit( -1 );
 
882
                
 
883
                                if ( strcmp( bufout, bufin ) )
 
884
                                {
 
885
                                        printf(
 
886
                                                "String Mismatch Error:  \"%s\"  !=  \"%s\"\n",
 
887
                                                bufout, bufin );
 
888
                                }
 
889
 
 
890
                                else if ( tmp != mytid )
 
891
                                {
 
892
                                        printf( "Number Mismatch Error:  %d  !=  %d\n",
 
893
                                                tmp, mytid );
 
894
                                }
 
895
 
 
896
                                else
 
897
                                {
 
898
                                        printf( "Retrieved Message is a Match.\n" );
 
899
 
 
900
                                        ret++;
 
901
                                }
 
902
                        }
 
903
 
 
904
                        if ( do_sleep )
 
905
                                pvmsleep( do_sleep );
 
906
 
 
907
                        set_flags( &flags, 0 /*do_pers*/, 0 /*do_favail*/, do_owrit,
 
908
                                0 /*do_minst*/, do_rddel, do_wait );
 
909
 
 
910
                        sprintf( bufin,
 
911
                                "This Message Left Here By Mbox (X)" );
 
912
 
 
913
                        index = stuff_msg( CLASS_NAME,
 
914
                                flags | PvmMboxDirectIndex( 1 ), bufin, mytid );
 
915
 
 
916
                        if ( index < 0 )
 
917
                                exit( -1 );
 
918
 
 
919
                        for ( i=0 ; i < 3 ; i++ )
 
920
                        {
 
921
                                cc = check_msg( CLASS_NAME, i, 0, bufout, &tmp,
 
922
                                        do_unpack );
 
923
 
 
924
                                if ( cc < 0 )
 
925
                                        exit( -1 );
 
926
                        }
 
927
                }
856
928
        }
857
929
 
858
930
        if ( do_exit )
1007
1079
        printf( "usage:  mbox [pers] [favail] [owrit] [minst] [rddel]\n" );
1008
1080
        printf( "\t[sleep[=<secs>]] [name=<class_name>]\n" );
1009
1081
        printf( "\t[query [<index>]] [wait] [noreset] [noexit]\n" );
1010
 
        printf( "\t[info [<pattern>]] [delete [<index>]]\n" );
1011
 
        printf( "\t[default] [default33] [help]\n" );
 
1082
        printf( "\t[info [<pattern>]] [delete [<index>]] [direct]\n" );
 
1083
        printf( "\t[default] [default33] [nindices=<n>] [help]\n" );
1012
1084
        printf( "\n" );
1013
1085
 
1014
1086
        exit( 0 );