--- 2nash.c.orig 2018-07-02 22:31:59.000000000 -0600
+++ 2nash.c 2018-10-31 14:50:29.603725443 -0600
@@ -9,6 +9,7 @@
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
+#include <fcntl.h>
int main(int argc, char *argv[])
{
@@ -28,14 +29,16 @@
if(cpid[l-1] == 0) {
//forked threads
// n= sprintf(buffer, "lrs %s > out%i", argv[l], l);
+ sprintf(buffer, "out%i", l);
+ int fd = creat(buffer, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ dup2(fd, 1);
if(l==1) {
- int n= sprintf(buffer, "lrsnash %s %s > out%i", argv[1], argv[2], l);
+ execlp("lrsnash", "lrsnash", argv[1], argv[2], NULL);
}
else {
- int n= sprintf(buffer, "lrsnash %s %s > out%i", argv[2], argv[1], l);
+ execlp("lrsnash", "lrsnash", argv[2], argv[1], NULL);
}
- int i=system(buffer);
_exit(0);
}
}
@@ -50,18 +53,18 @@
printf("lrsnash %s %s finished first\n", argv[2], argv[1]);
printf("player numbers will be reversed in output\n");
}
+ sprintf(buffer, "out%i", j);
if(argc == 4) {
printf("output file: %s\n", argv[3]);
- int n = sprintf(buffer, "/bin/mv -f out%i %s", j, argv[3]);
+ rename(buffer, argv[3]);
}
else {
printf("output file: out\n");
- int n = sprintf(buffer, "/bin/mv -f out%i out", j);
+ rename(buffer, "out");
}
- int i = system(buffer);
} else {
- int n = sprintf(buffer, "/bin/rm -f out%i", j);
- int i = system(buffer);
+ sprintf(buffer, "out%i", j);
+ unlink(buffer);
}
}
printf("the other process will be "); /*...will be killed */
--- fourier.c.orig 2018-04-30 00:41:08.000000000 -0600
+++ fourier.c 2018-10-31 14:44:27.227701068 -0600
@@ -407,7 +407,6 @@ long compute_redundancy(long *redineq, l
{
long ineq;
long d, m;
- long nlinearity;
long lastdv, index;
lrs_mp_matrix Lin;
@@ -420,7 +419,6 @@ long compute_redundancy(long *redineq, l
}
m = P->m_A;
d = P->d;
- nlinearity = Q->nlinearity;
lastdv = Q->lastdv;
for(index = lastdv +1;index <= m+d; index++)
{
@@ -709,7 +707,7 @@ void full_fel(lrs_dic *iP, lrs_dat *iQ,
long *Dep; /*Dep[0] not used, Dep[i] = 1 if eqn lin. dep., else 0 */
long nlinearity;
long eqn;
- long last=0; /* =1 if equation used to remove var. =2 if FME used */
+ /* long last=0; */ /* =1 if equation used to remove var. =2 if FME used */
/* could do with less of these monsters */
lrs_mp Temp, Temp1, div1;
@@ -769,7 +767,7 @@ void full_fel(lrs_dic *iP, lrs_dat *iQ,
}
if (eqn > 0)
{
- last = 1;
+ /* last = 1; */
for(l=eqn-1;l<nlinearity-1;l++) /* reduce linearities */
{
Q1->linearity[l] = Q1->linearity[l+1] -1;
@@ -831,7 +829,7 @@ void full_fel(lrs_dic *iP, lrs_dat *iQ,
}
else
{
- last = 2;
+ /* last = 2; */
if( (Q2 = lrs_alloc_dat("LRS GLOBALS")) == NULL)
fel_abort("ERROR>Can't allocate memory for structures");
--- lrsgmp.c.orig 2018-06-25 04:30:25.000000000 -0600
+++ lrsgmp.c 2018-10-31 14:59:17.189999312 -0600
@@ -261,7 +261,7 @@ readrat (lrs_mp Na, lrs_mp Da) /* read a
}
#ifdef PLRS
-string sprat (char name[], lrs_mp Nin, lrs_mp Din) /*reduce and print Nin/Din */
+string sprat (const char *name, lrs_mp Nin, lrs_mp Din) /*reduce and print Nin/Din */
{
//create stream to collect output
@@ -296,7 +296,7 @@ string sprat (char name[], lrs_mp Nin, l
return str;
}
-char *cprat (char name[], lrs_mp Nin, lrs_mp Din)
+char *cprat (const char *name, lrs_mp Nin, lrs_mp Din)
{
char *ret;
unsigned long len;
@@ -323,7 +323,7 @@ char *cprat (char name[], lrs_mp Nin, lr
return ret;
}
-string spmp (char name[], lrs_mp Nt) /*print the long precision integer a */
+string spmp (const char *name, lrs_mp Nt) /*print the long precision integer a */
{
//create stream to collect output
@@ -345,7 +345,7 @@ string spmp (char name[], lrs_mp Nt) /*p
#endif
void
-pmp (char name[], lrs_mp Nt)
+pmp (const char *name, lrs_mp Nt)
{
lrs_printf (lrs_ofp, "%s", name);
if (sign (Nt) != NEG)
@@ -356,7 +356,7 @@ pmp (char name[], lrs_mp Nt)
}
void
-prat (char name[], lrs_mp Nin, lrs_mp Din)
+prat (const char *name, lrs_mp Nin, lrs_mp Din)
/*print the long precision rational Nt/Dt */
{
lrs_mp temp1, temp2;
@@ -470,7 +470,7 @@ lrs_getdigits (long *a, long *b)
}
void *
-xcalloc (long n, long s, long l, char *f)
+xcalloc (long n, long s, long l, const char *f)
{
void *tmp;
@@ -501,7 +501,7 @@ lrs_mp_init (long dec_digits, FILE * fpi
void
-notimpl (char s[])
+notimpl (const char *s)
{
fflush (stdout);
fprintf (stderr, "\nAbnormal Termination %s\n", s);
--- lrsgmp.h.orig 2018-06-25 04:30:26.000000000 -0600
+++ lrsgmp.h 2018-10-31 15:02:36.915695889 -0600
@@ -248,13 +248,13 @@ void atomp (const char s[], lrs_mp a); /
long compare (lrs_mp a, lrs_mp b); /* a ? b and returns -1,0,1 for <,=,> */
void linint (lrs_mp a, long ka, lrs_mp b, long kb); /* compute a*ka+b*kb --> a */
#ifdef PLRS
-string spmp (char name[], lrs_mp a); /* print the long precision integer a */
-string sprat (char name[], lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
-char *cprat(char name[], lrs_mp Nt, lrs_mp Dt); /* C version of prat */
+string spmp (const char *name, lrs_mp a); /* print the long precision integer a */
+string sprat (const char *name, lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
+char *cprat(const char *name, lrs_mp Nt, lrs_mp Dt); /* C version of prat */
long plrs_readrat (lrs_mp Na, lrs_mp Da, const char * rat); /* take a rational number and convert to lrs_mp */
#endif
-void pmp (char name[], lrs_mp a); /* print the long precision integer a */
-void prat (char name[], lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
+void pmp (const char *name, lrs_mp a); /* print the long precision integer a */
+void prat (const char *name, lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
void readmp (lrs_mp a); /* read an integer and convert to lrs_mp */
long readrat (lrs_mp Na, lrs_mp Da); /* read a rational or int and convert to lrs_mp */
void reduce (lrs_mp Na, lrs_mp Da); /* reduces Na Da by gcd(Na,Da) */
@@ -274,7 +274,7 @@ void lcm (lrs_mp a, lrs_mp b); /* a = le
void mulrat (lrs_mp Na, lrs_mp Da, lrs_mp Nb, lrs_mp Db, lrs_mp Nc, lrs_mp Dc);
/* computes Nc/Dc=(Na/Da)*(Nb/Db) and reduce */
long myrandom (long num, long nrange); /* return a random number in range 0..nrange-1 */
-void notimpl (char s[]); /* bail out - help! */
+void notimpl (const char *s); /* bail out - help! */
void rattodouble (lrs_mp a, lrs_mp b, double *x); /* convert lrs_mp rational to double */
void reduceint (lrs_mp Na, lrs_mp Da); /* divide Na by Da and return it */
void reducearray (lrs_mp_vector p, long n); /* find gcd of p[0]..p[n-1] and divide through by */
@@ -293,7 +293,7 @@ void *calloc ();
void *malloc ();
#endif
-void *xcalloc (long n, long s, long l, char *f);
+void *xcalloc (long n, long s, long l, const char *f);
void lrs_default_digits_overflow ();
void lrs_exit(int i);
--- lrslib.c.orig 2018-10-23 00:22:44.000000000 -0600
+++ lrslib.c 2018-10-31 15:31:15.462419933 -0600
@@ -62,8 +62,8 @@ static void lrs_dump_state ();
static void pushQ (lrs_dat * global, long m, long d, long m_A);
#ifndef TIMES
-static void ptimes ();
-static double get_time();
+static void ptimes (void);
+static double get_time(void);
#endif
@@ -71,10 +71,10 @@ static double get_time();
/* signals handling */
/*******************************/
#ifndef SIGNALS
-static void checkpoint ();
-static void die_gracefully ();
-static void setup_signals ();
-static void timecheck ();
+static void checkpoint (int signum);
+static void die_gracefully (int signum);
+static void setup_signals (void);
+static void timecheck (int signum);
#endif
/*******************************/
@@ -426,7 +426,7 @@ if (Q->countonly)
#ifdef PLRS
//Make new output node
- char *type=NULL;
+ const char *type=NULL;
//Make stream to collect prat / pmp data
stringstream ss;
@@ -551,7 +551,7 @@ if(Q->verbose)
/* end of lrs_lpoutput */
/***********************/
void
-lrs_printrow (char name[], lrs_dat * Q, lrs_mp_vector output, long rowd)
+lrs_printrow (const char *name, lrs_dat * Q, lrs_mp_vector output, long rowd)
/* print a row of A matrix in output in "original" form */
/* rowd+1 is the dimension of output vector */
/* if input is H-rep. output[0] contains the RHS */
@@ -650,7 +650,7 @@ lrs_getsolution (lrs_dic * P, lrs_dat *
} /* end of lrs_getsolution */
void
-lrs_print_header(char *name)
+lrs_print_header(const char *name)
{
if(lrs_ofp == NULL)
lrs_ofp=stdout;
@@ -683,7 +683,7 @@ fprintf (lrs_ofp,",hybrid arithmetic");
}
long
-lrs_init (char *name) /* returns TRUE if successful, else FALSE */
+lrs_init (const char *name) /* returns TRUE if successful, else FALSE */
{
#ifndef PLRS
if(overflow!=2)
@@ -702,7 +702,7 @@ lrs_init (char *name) /* returns T
}
void
-lrs_close (char *name)
+lrs_close (const char *name)
{
#ifndef PLRS
@@ -1699,8 +1699,8 @@ lrs_getfirstbasis (lrs_dic ** D_p, lrs_d
#ifndef PLRS
fprintf (lrs_ofp, "\n*Voronoi Diagram: Voronoi vertices and rays are output");
#else
- char *type = "header";
- char *data = "*Voronoi Diagram: Voronoi vertices and rays are output";
+ const char *type = "header";
+ const char *data = "*Voronoi Diagram: Voronoi vertices and rays are output";
//post output in a nonblocking manner (a consumer thread will manage output)
post_output(type,data);
#endif
@@ -1709,8 +1709,8 @@ lrs_getfirstbasis (lrs_dic ** D_p, lrs_d
#ifndef PLRS
fprintf (lrs_ofp, "\nH-representation");
#else
- char *type = "header";
- char *data = "H-representation";
+ const char *type = "header";
+ const char *data = "H-representation";
//post output in a nonblocking manner (a consumer thread will manage output)
post_output(type, data);
#endif
@@ -1719,8 +1719,8 @@ lrs_getfirstbasis (lrs_dic ** D_p, lrs_d
#ifndef PLRS
fprintf (lrs_ofp, "\nV-representation");
#else
- char *type = "header";
- char *data = "V-representation";
+ const char *type = "header";
+ const char *data = "V-representation";
//post output in a nonblocking manner (a consumer thread will manage output)
post_output(type,data);
#endif
@@ -1741,7 +1741,7 @@ lrs_getfirstbasis (lrs_dic ** D_p, lrs_d
fprintf (lrs_ofp, "\nlinearity %ld ", nredundcol - k); /*adjust nredundcol for homog. */
#else
stringstream ss;
- char *type = "header";
+ const char *type = "header";
ss<<"linearity "<<(nredundcol -k);
#endif
for (i = 1; i <= nredundcol - k; i++){
@@ -1761,7 +1761,7 @@ lrs_getfirstbasis (lrs_dic ** D_p, lrs_d
fprintf (lrs_ofp, "\nbegin");
fprintf (lrs_ofp, "\n***** %ld rational", Q->n);
#else
- char *type = "header";
+ const char *type = "header";
stringstream ss;
ss<<"begin"<<endl<<"***** "<<Q->n<<" rational";
post_output(type, ss.str().c_str());
@@ -4370,7 +4370,7 @@ printA (lrs_dic * P, lrs_dat * Q) /* pri
void
-pimat (lrs_dic * P, long r, long s, lrs_mp Nt, char name[])
+pimat (lrs_dic * P, long r, long s, lrs_mp Nt, const char *name)
/*print the long precision integer in row r col s of matrix A */
{
long *B = P->B;
@@ -5015,7 +5015,7 @@ setup_signals ()
}
static void
-timecheck ()
+timecheck (int signum __attribute__((unused)))
{
lrs_dump_state ();
errcheck ("signal", signal (SIGALRM, timecheck));
@@ -5023,14 +5023,14 @@ timecheck ()
}
static void
-checkpoint ()
+checkpoint (int signum __attribute__((unused)))
{
lrs_dump_state ();
errcheck ("signal", signal (SIGUSR1, checkpoint));
}
static void
-die_gracefully ()
+die_gracefully (int signum __attribute__((unused)))
{
lrs_dump_state ();
--- lrslib.h.orig 2018-07-02 22:31:59.000000000 -0600
+++ lrslib.h 2018-10-31 15:11:45.643225658 -0600
@@ -350,13 +350,13 @@ long lrs_getnextbasis (lrs_dic ** dict_p
long lrs_getsolution (lrs_dic * P, lrs_dat * Q, lrs_mp_vector output, long col);
long lrs_getray (lrs_dic * P, lrs_dat * Q, long col, long comment, lrs_mp_vector output);
long lrs_getvertex (lrs_dic * P, lrs_dat * Q, lrs_mp_vector output);
-void lrs_close (char *name); /* close lrs lib program "name" */
-long lrs_init (char *name); /* initialize lrslib and arithmetic package for prog "name" */
+void lrs_close (const char *name); /* close lrs lib program "name" */
+long lrs_init (const char *name); /* initialize lrslib and arithmetic package for prog "name" */
void lrs_lpoutput(lrs_dic * P,lrs_dat * Q, lrs_mp_vector output); /* print LP primal and dual solutions */
void lrs_printcobasis (lrs_dic * P, lrs_dat * Q, long col); /* print cobasis for column col(verted or ray) */
-void lrs_print_header(char *name);
+void lrs_print_header(const char *name);
void lrs_printoutput (lrs_dat * Q, lrs_mp_vector output); /* print output array */
-void lrs_printrow (char name[], lrs_dat * Q, lrs_mp_vector output, long rowd); /*print row of A matrix in output[0..rowd] */
+void lrs_printrow (const char *name, lrs_dat * Q, lrs_mp_vector output, long rowd); /*print row of A matrix in output[0..rowd] */
void lrs_printsol (lrs_dic * P, lrs_dat * Q, long col, long comment); /* print out solution from col, comment= 0=normal,-1=geometric ray,1..inputd=linearity */
void lrs_printtotals (lrs_dic * P, lrs_dat * Q);/* print final totals for lrs */
long lrs_set_digits (long dec_digits ); /* set lrsmp digits to equiv. of decimal dec_digits */
@@ -398,7 +398,7 @@ void updatevolume (lrs_dic * P, lrs_dat
long lrs_degenerate (lrs_dic * P, lrs_dat * Q); /* TRUE if the dictionary is primal degenerate */
void print_basis (FILE * fp, lrs_dat * Q);
void printA (lrs_dic * P, lrs_dat * Q); /* raw print of dictionary, bases for debugging */
-void pimat (lrs_dic * P, long r, long s, lrs_mp Nt, char name[]); /* print the row r col s of A */
+void pimat (lrs_dic * P, long r, long s, lrs_mp Nt, const char *name); /* print the row r col s of A */
long readfacets (lrs_dat * Q, long facet[]); /* read and check facet list */
long readlinearity (lrs_dat * Q); /* read and check linearity list */
void rescaledet (lrs_dic * P, lrs_dat * Q, lrs_mp Vnum, lrs_mp Vden); /* rescale determinant to get its volume */
--- lrslong.c.orig 2018-06-25 04:30:34.000000000 -0600
+++ lrslong.c 2018-10-31 15:13:18.209669977 -0600
@@ -333,7 +333,7 @@ string sprat (char name[], lrs_mp Nin, l
return str;
}
-char *cprat (char name[], lrs_mp Nin, lrs_mp Din)
+char *cprat (const char *name, lrs_mp Nin, lrs_mp Din)
{
char *ret;
unsigned long len;
@@ -360,7 +360,7 @@ char *cprat (char name[], lrs_mp Nin, lr
return ret;
}
-string spmp (char name[], lrs_mp Nt) /*print the long precision integer a */
+string spmp (const char *name, lrs_mp Nt) /*print the long precision integer a */
{
//create stream to collect output
stringstream ss;
@@ -395,7 +395,7 @@ string spmp (char name[], lrs_mp Nt) /*p
}
#endif
void
-pmp (char name[], lrs_mp Nt)
+pmp (const char *name, lrs_mp Nt)
{
lrs_printf (lrs_ofp, "%s", name);
if (sign (Nt) != NEG)
@@ -417,7 +417,7 @@ pmp (char name[], lrs_mp Nt)
}
void
-prat (char name[], lrs_mp Nin, lrs_mp Din)
+prat (const char *name, lrs_mp Nin, lrs_mp Din)
/*print the long precision rational Nt/Dt */
{
lrs_mp Nt, Dt;
@@ -547,7 +547,7 @@ lrs_getdigits (long *a, long *b)
}
void *
-xcalloc (long n, long s, long l, char *f)
+xcalloc (long n, long s, long l, const char *f)
{
void *tmp;
@@ -578,7 +578,7 @@ lrs_mp_init (long dec_digits, FILE * fpi
}
void
-notimpl (char s[])
+notimpl (const char *s)
{
fflush (stdout);
fprintf (stderr, "\nAbnormal Termination %s\n", s);
--- lrslong.h.orig 2018-10-31 14:44:27.247700740 -0600
+++ lrslong.h 2018-10-31 15:19:17.781626864 -0600
@@ -282,11 +282,11 @@ long mptoi (lrs_mp a); /* convert lrs_m
#ifdef PLRS
string spmp (char name[], lrs_mp a); /* print the long precision integer a */
string sprat (char name[], lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
-char *cprat(char name[], lrs_mp Nt, lrs_mp Dt); /* C version of prat */
+char *cprat(const char *name, lrs_mp Nt, lrs_mp Dt); /* C version of prat */
long plrs_readrat (lrs_mp Na, lrs_mp Da, const char * rat); /* take a rational number and convert to lrs_mp */
#endif
-void pmp (char name[], lrs_mp a); /* print the long precision integer a */
-void prat (char name[], lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
+void pmp (const char *name, lrs_mp a); /* print the long precision integer a */
+void prat (const char *name, lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
void readmp (lrs_mp a); /* read an integer and convert to lrs_mp */
long readrat (lrs_mp Na, lrs_mp Da); /* read a rational or int and convert to lrs_mp */
void reduce (lrs_mp Na, lrs_mp Da); /* reduces Na Da by gcd(Na,Da) */
@@ -307,7 +307,7 @@ void lcm (lrs_mp a, lrs_mp b); /* a = le
void mulrat (lrs_mp Na, lrs_mp Da, lrs_mp Nb, lrs_mp Db, lrs_mp Nc, lrs_mp Dc);
/* computes Nc/Dc=(Na/Da)*(Nb/Db) and reduce */
long myrandom (long num, long nrange); /* return a random number in range 0..nrange-1 */
-void notimpl (char s[]); /* bail out - help! */
+void notimpl (const char *s); /* bail out - help! */
void rattodouble (lrs_mp a, lrs_mp b, double *x); /* convert lrs_mp rational to double */
void reduceint (lrs_mp Na, lrs_mp Da); /* divide Na by Da and return it */
void reducearray (lrs_mp_vector p, long n); /* find gcd of p[0]..p[n-1] and divide through by */
@@ -338,7 +338,7 @@ void stringcpy (char *s, char *t); /* co
void *calloc ();
void *malloc ();
-void *xcalloc (long n, long s, long l, char *f);
+void *xcalloc (long n, long s, long l, const char *f);
void lrs_default_digits_overflow ();
void lrs_exit(int i);
--- lrsmp.c.orig 2018-06-25 04:30:25.000000000 -0600
+++ lrsmp.c 2018-10-31 14:44:27.248700724 -0600
@@ -623,7 +623,7 @@ mptoi (lrs_mp a) /* convert lrs_mp to l
#ifdef PLRS
-string prat (char name[], lrs_mp Nin, lrs_mp Din) /*reduce and print Nin/Din */
+string prat (const char *name, lrs_mp Nin, lrs_mp Din) /*reduce and print Nin/Din */
{
@@ -662,7 +662,7 @@ string prat (char name[], lrs_mp Nin, lr
return str;
}
-char *cprat (char name[], lrs_mp Nin, lrs_mp Din)
+char *cprat (const char *name, lrs_mp Nin, lrs_mp Din)
{
char *ret;
unsigned long len;
@@ -689,7 +689,7 @@ char *cprat (char name[], lrs_mp Nin, lr
return ret;
}
-string pmp (char name[], lrs_mp a) /*print the long precision integer a */
+string pmp (const char *name, lrs_mp a) /*print the long precision integer a */
{
long i;
@@ -714,7 +714,7 @@ string pmp (char name[], lrs_mp a) /*pri
return str;
}
#else
-void prat (char name[], lrs_mp Nin, lrs_mp Din) /*reduce and print Nin/Din */
+void prat (const char *name, lrs_mp Nin, lrs_mp Din) /*reduce and print Nin/Din */
{
lrs_mp Nt, Dt;
long i;
@@ -742,7 +742,7 @@ void prat (char name[], lrs_mp Nin, lrs_
}
-void pmp (char name[], lrs_mp a) /*print the long precision integer a */
+void pmp (const char *name, lrs_mp a) /*print the long precision integer a */
{
long i;
@@ -987,7 +987,7 @@ comprod (lrs_mp Na, lrs_mp Nb, lrs_mp Nc
void
-notimpl (char s[])
+notimpl (const char *s)
{
fflush (stdout);
fprintf (stderr, "\nAbnormal Termination %s\n", s);
@@ -1062,7 +1062,7 @@ mulrat (lrs_mp Na, lrs_mp Da, lrs_mp Nb,
void *
-xcalloc (long n, long s, long l, char *f)
+xcalloc (long n, long s, long l, const char *f)
{
void *tmp;
--- lrsmp.h.orig 2018-06-25 04:30:25.000000000 -0600
+++ lrsmp.h 2018-10-31 14:44:27.250700691 -0600
@@ -167,13 +167,13 @@ long mptoi (lrs_mp a); /* convert lrs_m
void mulint (lrs_mp a, lrs_mp b, lrs_mp c); /* multiply two integers a*b --> c */
void normalize (lrs_mp a); /* normalize lrs_mp after computation */
#ifdef PLRS
-string pmp (char name[], lrs_mp a); /* print the long precision integer a */
-string prat (char name[], lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
-char *cprat(char name[], lrs_mp Nt, lrs_mp Dt); /* C version of prat */
+string pmp (const char *name, lrs_mp a); /* print the long precision integer a */
+string prat (const char *name, lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
+char *cprat(const char *name, lrs_mp Nt, lrs_mp Dt); /* C version of prat */
long plrs_readrat (lrs_mp Na, lrs_mp Da, const char * rat); /* take a rational number and convert to lrs_mp */
#else
-void pmp (char name[], lrs_mp a); /* print the long precision integer a */
-void prat (char name[], lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
+void pmp (const char *name, lrs_mp a); /* print the long precision integer a */
+void prat (const char *name, lrs_mp Nt, lrs_mp Dt); /* reduce and print Nt/Dt */
#endif
long readrat (lrs_mp Na, lrs_mp Da); /* read a rational or int and convert to lrs_mp */
void reduce (lrs_mp Na, lrs_mp Da); /* reduces Na Da by gcd(Na,Da) */
@@ -197,7 +197,7 @@ void lcm (lrs_mp a, lrs_mp b); /* a = le
void mulrat (lrs_mp Na, lrs_mp Da, lrs_mp Nb, lrs_mp Db, lrs_mp Nc, lrs_mp Dc);
/* computes Nc/Dc=(Na/Da)*(Nb/Db) and reduce */
long myrandom (long num, long nrange); /* return a random number in range 0..nrange-1 */
-void notimpl (char s[]); /* bail out - help! */
+void notimpl (const char *s); /* bail out - help! */
void rattodouble (lrs_mp a, lrs_mp b, double *x); /* convert lrs_mp rational to double */
void reduceint (lrs_mp Na, lrs_mp Da); /* divide Na by Da and return it */
void reducearray (lrs_mp_vector p, long n); /* find gcd of p[0]..p[n-1] and divide through by */
@@ -214,7 +214,7 @@ void lrs_getdigits (long *a, long *b); /
void stringcpy (char *s, char *t); /* copy t to s pointer version */
-void *xcalloc (long n, long s, long l, char *f);
+void *xcalloc (long n, long s, long l, const char *f);
void lrs_default_digits_overflow ();
void digits_overflow ();
--- lrsnash.c.orig 2018-04-30 00:41:10.000000000 -0600
+++ lrsnash.c 2018-10-31 14:44:27.251700675 -0600
@@ -116,7 +116,7 @@ int tl_readrat(long *num, long *den, cha
//----------------------------------------------------------------------------------------//
-int readGame(game * g, char *filename)
+int readGame(game * g, const char *filename)
{
FILE *IN;
long pos, s, t, nr, nc;
@@ -160,11 +160,11 @@ int readGame(game * g, char *filename)
static long Print_game_flag;
static long Standard_input_flag;
-void printUsage(char *progname) {
+void printUsage(const char *progname) {
fprintf(stderr, Usage, progname, progname, progname);
}
-void printInfo(char *progname) {
+void printInfo(const char *progname) {
fprintf(stderr, Helptext, progname, progname);
}
@@ -250,7 +250,7 @@ int getArgs(int argc, char **argv)
//----------------------------------------------------------------------------------------//
// Checks if an input file is legacy (contains letters)
-int isLegacy(char *filename) {
+int isLegacy(const char *filename) {
FILE *fp;
int i, n, foundLetter = FALSE;
char buf[100];
--- lrsnashlib.c.orig 2018-04-30 00:41:10.000000000 -0600
+++ lrsnashlib.c 2018-10-31 14:44:27.251700675 -0600
@@ -25,7 +25,7 @@
//========================================================================
int lrs_solve_nash(game * g)
{
- lrs_dic *P1, *P2; /* structure for holding current dictionary and indices */
+ lrs_dic *P1; /* structure for holding current dictionary and indices */
lrs_dat *Q1, *Q2; /* structure for holding static problem data */
lrs_mp_vector output1; /* holds one line of output; ray,vertex,facet,linearity */
@@ -325,14 +325,12 @@ lrs_getfirstbasis2(lrs_dic ** D_p, lrs_d
/* assign local variables to structures */
lrs_mp_matrix A;
- long *B, *C, *Row, *Col;
+ long *B, *C, *Col;
long *inequality;
long *linearity;
long hull = Q->hull;
long m, d, lastdv, nlinearity, nredundcol;
- static long ocount = 0;
-
m = D->m;
d = D->d;
lastdv = Q->lastdv;
@@ -344,7 +342,6 @@ lrs_getfirstbasis2(lrs_dic ** D_p, lrs_d
A = D->A;
B = D->B;
C = D->C;
- Row = D->Row;
Col = D->Col;
inequality = Q->inequality;
@@ -459,7 +456,6 @@ lrs_getfirstbasis2(lrs_dic ** D_p, lrs_d
if (Q->verbose) {
fprintf(lrs_ofp, "\nNumber of pivots for starting dictionary: %ld", Q->count[3]);
- ocount = Q->count[3];
}
/* Do dual pivots to get primal feasibility */
@@ -467,14 +463,12 @@ lrs_getfirstbasis2(lrs_dic ** D_p, lrs_d
if (Q->verbose) {
fprintf(lrs_ofp, "\nNumber of pivots for feasible solution: %ld", Q->count[3]);
fprintf(lrs_ofp, " - No feasible solution");
- ocount = Q->count[3];
}
return FALSE;
}
if (Q->verbose) {
fprintf(lrs_ofp, "\nNumber of pivots for feasible solution: %ld", Q->count[3]);
- ocount = Q->count[3];
}
/* Now solve LP if objective function was given */
@@ -768,7 +762,7 @@ long lrs_nashoutput(lrs_dat * Q, lrs_mp_
int lrs_solve_nash_legacy (int argc, char *argv[])
// Handles legacy input files
{
- lrs_dic *P1,*P2; /* structure for holding current dictionary and indices */
+ lrs_dic *P1; /* structure for holding current dictionary and indices */
lrs_dat *Q1,*Q2; /* structure for holding static problem data */
lrs_mp_vector output1; /* holds one line of output; ray,vertex,facet,linearity */