36
36
* Missing links and other wonk.
38
* $Log: pvmcruft.c,v $
39
* Revision 1.2 2002/10/14 14:37:51 chanceli
42
* Revision 1.38 2001/09/27 21:25:10 pvmsrc
44
* - submitted by Joe Vitale <vitale@scyld.com>.
45
* (we renamed it from BEOWULF to BEOSCYLD, but it's his port... :-)
48
* Revision 1.37 2001/09/26 22:04:20 pvmsrc
49
* Modified temp file prefix in pvmtmpnam().
53
* Revision 1.36 2001/09/26 21:22:59 pvmsrc
54
* Append VMID string to PVMD socket file name in pvmdsockfile().
55
* - if set in PVM_VMID env var.
56
* - not restricted to be integer as in SGI, can be arbitrary
57
* string... heh, heh... :-}
60
* Revision 1.35 2001/09/25 21:21:02 pvmsrc
61
* Yanked "char *pvmgettmp();" decl - now in pvm3.h...
64
* Revision 1.34 2001/02/09 15:23:47 pvmsrc
65
* Minor tweak to pvmgettmp() for Markus.
66
* - check %PVM_TMP% & registry before resorting to %TEMP%.
69
* Revision 1.33 2001/02/07 23:15:51 pvmsrc
70
* 2nd Half of CYGWIN Check-ins...
73
* Revision 1.32 2001/02/02 14:50:26 pvmsrc
74
* Win32 fixes & additions.
77
* Revision 1.31 2000/03/29 20:04:12 pvmsrc
78
* Added prototype for pvm_readregistry() routine.
81
* Revision 1.30 2000/02/17 23:12:15 pvmsrc
82
* *** Changes for new BEOLIN port ***
83
* - MPP-like, similar to SP2, etc.
84
* - submitted by Paul Springer <pls@smokeymt.jpl.nasa.gov>.
85
* - format-checked & cleaned up by Jeembo... :-)
88
* Revision 1.29 2000/02/16 23:30:24 pvmsrc
89
* Added back in read_pvmregistry() calls.
90
* - for PVM_ROOT and PVM_TMP, if env vars not present on WIN32.
91
* - couldn't find reference to PVM_ARCH anywhere, Markus?!
94
* Revision 1.28 2000/02/14 20:32:11 pvmsrc
95
* Added new pvmgetrsh() routine
96
* - checks for PVM_RSH or else uses old RSHCOMMAND interface.
97
* - one-stop shopping for rsh...
100
* Revision 1.27 2000/02/10 20:45:15 pvmsrc
101
* Replaced hard-coded /tmp usage.
102
* - modified pvmgettmp() to try $PVM_TMP env var for Unix, too.
103
* - use for TDSOCKNAME / TDSOCKNAME_CSPP in pvmdsockfile().
104
* Also in pvmdsockfile():
105
* - fixed WIN32 chdir() problem, cleaned up string manip.
108
* Revision 1.26 1999/12/13 18:13:55 pvmsrc
109
* Moved pvmmatchstring() here from msgbox.c.
110
* - for use by pvmtester stuff...
113
* Revision 1.25 1999/07/08 19:00:06 kohl
114
* Fixed "Log" keyword placement.
115
* - indent with " * " for new CVS.
117
* Revision 1.24 1999/03/16 16:29:56 pvmsrc
118
* Oops... Fixed typing problem for WIN32 in pvmsleep()...
121
* Revision 1.23 1999/03/15 19:06:32 pvmsrc
122
* Added new pvmsleep() routine.
123
* - Unix / Win32, C / Fortran compat...
124
* - invokes Sleep() on WIN32 (with secs * 1000 :-)~
127
* Revision 1.22 1999/03/05 17:21:15 pvmsrc
128
* improved to work with registry/environment on NT/win95-98
132
* Revision 1.21 1999/02/09 23:06:53 pvmsrc
133
* Cleaned up temp file stuff (mainly for WIN32).
134
* - extracted new pvmgettmp() routine for returning tmp directory.
137
* Revision 1.20 1999/02/09 20:10:10 pvmsrc
138
* Cleaned up pvmgetroot().
139
* - some arch cases not properly executed.
140
* - for WIN32, if read_pvmregistry() fails, give the env var a shot.
143
* Revision 1.19 1998/10/02 15:44:04 pvmsrc
144
* Single source code merge of Win32 and Unix code.
147
* Revision 1.18 1998/09/23 15:23:42 pvmsrc
148
* changes to use WIN32 registry as per Markus.
149
* ifdef in pvmd.c::colonsep() to include WIN32 and OS2
39
152
* Revision 1.17 1997/12/01 19:20:48 pvmsrc
40
153
* Replaced #ifdef IMA_OS2 fd_set declarations:
41
154
* - new #ifdef FDSETNOTSTRUCT.
602
728
static int n = 0;
603
static char scratch[32];
729
static char scratch[255];
736
pvmtmp = pvmgettmp();
609
sprintf(buf, "/tmp/tmp%06d.%d", getpid(), n++ % 10000);
739
sprintf(buf, "%s/pvmtmp%06d.%d", pvmtmp, getpid(), n++ % 10000);
617
if (!getenv("PVM_TMP")) {
619
"Could not get PVM_TMP, defaulting to %Temp% \n");
620
if (!getenv("TEMP")) {
622
"Could not get TEMP, defaulting to c:\temp \n");
623
sprintf(buf,"c:\temp");
624
} else sprintf(buf,getenv("TEMP"));
625
} else sprintf(buf,getenv("PVM_TMP"));
627
sprintf(tmptmp, "/tmp%06d.%d", _getpid(), n++ % 10000);
741
sprintf(buf, "%s\\pvmtmp%06d.%d", pvmtmp, getpid(), n++ % 10000);
709
846
static char *rd = 0;
711
if (!rd && !(rd = getenv("PVM_ROOT"))) {
712
pvmlogerror("PVM_ROOT environment variable not set.\n");
717
rd = STRALLOC("/usr/convex/pvm");
718
if (stat(rd, &buf) == -1) {
719
pvmlogperror("Unable to default PVM_ROOT to /usr/convex/pvm");
721
exit(1); /* the other meaning of bail out */
854
rd = STRALLOC("/usr/convex/pvm");
855
if (stat(rd, &buf) == -1) {
857
"Unable to default PVM_ROOT to /usr/convex/pvm");
859
exit(1); /* the other meaning of bail out */
861
pvmputenv("PVM_ROOT=/usr/convex/pvm");
862
pvmlogerror("Defaulting PVM_ROOT to /usr/convex/pvm");
867
rd = getenv("PVM_ROOT_U");
869
rd = getenv("PVM_ROOT");
874
rd = read_pvmregistry("PVM_ROOT");
880
pvmlogerror("PVM_ROOT environment variable not set.\n");
882
exit(1); /* the other meaning of bail out */
892
* Return absolute path of PVM temporary directory.
902
if ( !(td=getenv("PVM_TMP")) )
904
td = "/tmps"; /* the shared tmp */
909
if ( !(td=getenv("PVM_TMP")) ) {
910
if ( !(td=read_pvmregistry("PVM_TMP")) ) {
911
if ( !(td=getenv("TEMP")) ) {
914
"Could not get %%PVM_TMP%% or %%TEMP%% ");
915
fprintf(stderr, "-> using \"%s\".\n", td);
917
"Please check your PVM installation.\n");
723
pvmputenv("PVM_ROOT=/usr/convex/pvm");
724
pvmlogerror("Defaulting PVM_ROOT to /usr/convex/pvm");
728
exit(1); /* the other meaning of bail out */
930
* Return absolute path of the rsh executable for the local system.
939
if ( !(rd=getenv("PVM_RSH")) )
788
(void)sprintf(buf, TDSOCKNAME_CSPP, pvm_useruid, scid, hna);
1003
(void)sprintf(buf, TDSOCKNAME_CSPP,
1004
pvmtmp, pvm_useruid, scid, hna);
791
(void)sprintf(buf, TDSOCKNAME, pvm_useruid, hna);
1007
(void)sprintf(buf, TDSOCKNAME, pvmtmp, pvm_useruid, hna);
797
(void)sprintf(buf, TDSOCKNAME_CSPP, pvm_useruid, scid);
1013
(void)sprintf(buf, TDSOCKNAME_CSPP, pvmtmp, pvm_useruid, scid);
801
if (!getenv("PVM_TMP"))
803
(void)sprintf(buf, TDSOCKNAME, username);
804
pvmlogprintf("Could not get PVM_TMP, continuing with %s\n",
807
strcpy(TDSOCKSPEC,getenv("PVM_TMP"));
808
if (_chdir(getenv("PVM_TMP")) == -1) {
809
pvmlogerror("Could Not retrieve PVM_TMP directory \n");
812
sprintf(buf,"/pvmd.%s",username);
813
strcat(TDSOCKSPEC,buf);
814
sprintf(buf,TDSOCKSPEC);
1017
sprintf( buf, "%s\\pvmd.%s", pvmtmp, username );
817
(void)sprintf(buf, TDSOCKNAME, pvm_useruid);
1019
(void)sprintf(buf, TDSOCKNAME, pvmtmp, pvm_useruid);
1024
/* Append a Virtual Machine ID, If Set */
1025
if ( p = getenv("PVM_VMID") ) {
1331
* A consistent way to invoke sleep(), from:
1332
* Unix / Windows, C / Fortran
1341
Sleep( secs * 1000 );
1344
ret = (int) sleep( secs );
1352
* Replacement for GNU Regex pattern matching.
1356
pvmmatchstring( str, pattern )
1365
/* Find Start of Search String (Ignore Preceding '*'s) */
1369
while ( *start == '*' && *start != '\0' )
1372
/* Null Search - Always Matches */
1374
if ( *start == '\0' )
1377
/* Initialize Pointers */
1383
/* Search Line for Start of Search String */
1385
while ( *x != '\0' )
1387
/* Starting Match Found... Check it Out */
1391
/* Save Continuation Pointer */
1395
/* Traverse Line Until No Longer Matches */
1397
while ( *x != '\0' && *y != '\0' && *x == *y )
1402
/* Nested '*' Search Expansion */
1406
if ( pvmmatchstring( x, y + 1 ) )
1413
/* Skip Over '\' for Escaped '*'s */
1415
else if ( *y == '\\' && *(y+1) == '*' )
1424
/* Reset and Continue */