-
Notifications
You must be signed in to change notification settings - Fork 0
/
External.c
56 lines (50 loc) · 2.26 KB
/
External.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/****************************************************************************
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / \ \ \ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / INCLUDES / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
\ \ \ \ \ \ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
****************************************************************************/
#include "Public.h"
#include "External.h"
/****************************************************************************
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / \ \ \ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / FUNCTIONS / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
\ \ \ \ \ \ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
****************************************************************************/
BOOL ExternalPercent()
{
ULONG randval;
randval = rand() % 100;
if ( randval < _extp )
return( TRUE );
else
return( FALSE );
}
/***************************************************************************/
void HandleExternal()
{
BPTR outhandle;
if ( outhandle = Open( _externalout, MODE_NEWFILE )) {
FPuts( outhandle, "%%\n" );
Seek( outhandle, 0, OFFSET_END );
if ( Execute( _external, NULL, outhandle ) == FALSE ) {
Close( outhandle );
system_state = DoErrors( WARNING,
"Can't locate\load external program",
"restart `epigrams' with corrected tool type",
"Continue|Quit" );
} else {
Close( outhandle );
// ReadDataFile( _externalout );
}
DeleteFile( _externalout );
} else
system_state = DoErrors ( FATAL,
"Error creating temporary file for external program",
"coders fault!|don't use `external' option until next version|restart with normal data file",
"Quit" );
}
/***************************************************************************/