-
Notifications
You must be signed in to change notification settings - Fork 2
/
lrsdriver.c
72 lines (60 loc) · 1.65 KB
/
lrsdriver.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* This file contains functions and variables that should not be duplicated per arithmetic */
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include <stdlib.h>
#include <limits.h>
#include "lrsdriver.h"
/* Globals; these need to be here, rather than lrsdriver.h, so they are
not multiply defined. */
FILE *lrs_cfp; /* output file for checkpoint information */
FILE *lrs_ifp; /* input file pointer */
FILE *lrs_ofp; /* output file pointer */
char** makenewargv(int *argc,char** argv,char *tmp)
{
int i;
char** newargv;
newargv = (char**) malloc((*argc+3) * sizeof *newargv);
for(i = 0; i < *argc; ++i)
{
if (i != 1)
{
size_t length = strlen(argv[i])+1;
newargv[i] = (char *) malloc(length);
strncpy(newargv[i], argv[i], length);
}
}
/* make tmp the new input file */
size_t length = strlen(tmp)+1;
newargv[1] = (char *)malloc(length);
strncpy(newargv[1], tmp, length);
if(*argc == 1) /* input was stdin*/
*argc = 2;
newargv[*argc] = NULL;
return newargv;
}
lrs_restart_dat*
lrs_alloc_restart()
{
int i;
lrs_restart_dat *R;
R = (lrs_restart_dat *) malloc (sizeof (lrs_restart_dat));
if (R == NULL)
return R;
R->overide=0; /* do not overide Q */
R->restart=0; /* do not do a restart */
R->facet=NULL; /* this will be allocated later when we know its size */
R->d=0;
R->maxcobases=0;
R->maxdepth=-1; /* will be set to MAXD in lrs*_main */
R->mindepth=0;
R->maxcobases=0;
for(i=0;i<10;i++)
R->count[i]=0;
R->depth=0;
R->lrs=1;
R->redund=0;
R->verifyredund=0;
R->redineq = NULL;
return R;
}