diff options
author | dholland <dholland@pkgsrc.org> | 2015-11-07 21:06:37 +0000 |
---|---|---|
committer | dholland <dholland@pkgsrc.org> | 2015-11-07 21:06:37 +0000 |
commit | cf27b8ceef4da3b55bce090a598d1599b5c2f72a (patch) | |
tree | a235015581920c006de763faf1edd6e5b2088dc0 /biology | |
parent | 05a67487d7f3bfa5df7aed19c175688193ca1ab6 (diff) | |
download | pkgsrc-cf27b8ceef4da3b55bce090a598d1599b5c2f72a.tar.gz |
gets() considered harmful. What is this, 1985? Fixes the build on OpenBSD.
Diffstat (limited to 'biology')
-rw-r--r-- | biology/coalesce/Makefile | 3 | ||||
-rw-r--r-- | biology/coalesce/distinfo | 3 | ||||
-rw-r--r-- | biology/coalesce/patches/patch-coalesce.c | 135 |
3 files changed, 139 insertions, 2 deletions
diff --git a/biology/coalesce/Makefile b/biology/coalesce/Makefile index 65a021570bf..413f03c19e6 100644 --- a/biology/coalesce/Makefile +++ b/biology/coalesce/Makefile @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.9 2012/09/11 20:32:11 asau Exp $ +# $NetBSD: Makefile,v 1.10 2015/11/07 21:06:37 dholland Exp $ # DISTNAME= coalesce1.5b PKGNAME= coalesce-1.5.0.2 +PKGREVISION= 1 CATEGORIES= biology MASTER_SITES= http://evolution.genetics.washington.edu/lamarc/coalesce/ diff --git a/biology/coalesce/distinfo b/biology/coalesce/distinfo index b67e600e130..8abd9445f63 100644 --- a/biology/coalesce/distinfo +++ b/biology/coalesce/distinfo @@ -1,7 +1,8 @@ -$NetBSD: distinfo,v 1.3 2015/11/02 18:42:21 agc Exp $ +$NetBSD: distinfo,v 1.4 2015/11/07 21:06:37 dholland Exp $ SHA1 (coalesce1.5b.tar.gz) = ec2a13da25474440a0c57b2a2e634c94db30961e RMD160 (coalesce1.5b.tar.gz) = 199a0f219413ea67feea98a6864f43373d3955bc SHA512 (coalesce1.5b.tar.gz) = fc91001cb5f5678ff0ad095a7e1ff8a14a848db1d05c86ee8440238fff50eb5df12f4ec9e6ee2c46ec38d9f9a668294e6390ebd9386400670d50896d021afd0c Size (coalesce1.5b.tar.gz) = 46153 bytes SHA1 (patch-aa) = b4c3afcb563c54d4b16f20f8b4b9fc649b49deee +SHA1 (patch-coalesce.c) = 6ecd1f41134c42235c2a85aa0fd2dbdaf1a0f6d2 diff --git a/biology/coalesce/patches/patch-coalesce.c b/biology/coalesce/patches/patch-coalesce.c new file mode 100644 index 00000000000..30beb7caf53 --- /dev/null +++ b/biology/coalesce/patches/patch-coalesce.c @@ -0,0 +1,135 @@ +$NetBSD: patch-coalesce.c,v 1.1 2015/11/07 21:06:37 dholland Exp $ + +gets() considered harmful. + +--- coalesce.c~ 1996-02-29 16:00:09.000000000 +0000 ++++ coalesce.c +@@ -70,6 +70,20 @@ void readparmfile() + boolean accept_slide; + long slid, slacc, indecks, chaintype; + ++static void dogets(char *buf, size_t max) ++{ ++ size_t len; ++ ++ if (!fgets(buf, max, stdin)) { ++ *buf = '\0'; ++ return; ++ } ++ len = strlen(buf); ++ if (len > 0 && buf[len-1] == '\n') { ++ buf[len-1] = '\0'; ++ } ++} ++ + void openfile(FILE **fp, char *filename, char *mode, char *application, + char *perm) + { +@@ -88,7 +102,7 @@ void openfile(FILE **fp, char *filename, + file[0] = '\0'; + while (file[0] =='\0'){ + fprintf(stdout,"Please enter a new filename>"); +- gets(file); ++ dogets(file, sizeof(file)); + } + break; + case 'w': +@@ -96,7 +110,7 @@ void openfile(FILE **fp, char *filename, + file[0] = '\0'; + while (file[0] =='\0'){ + fprintf(stdout,"Please enter a new filename>"); +- gets(file); ++ dogets(file, sizeof(file)); + } + break; + } +@@ -775,7 +789,7 @@ void getoptions() + } + printf("\n"); + printf("Are these settings correct? (type Y or the letter for one to change)\n"); +- gets(input); ++ dogets(input, sizeof(input)); + ch = input[0]; + ch = toupper(ch); + done = (ch == 'Y'); +@@ -787,7 +801,7 @@ void getoptions() + case 'S': + do { + printf("How many Short Chains?\n"); +- gets(input); ++ dogets(input, sizeof(input)); + chains[0] = atoi(input); + if (chains[0] < 0) + printf("Must be non-negative\n"); +@@ -797,7 +811,7 @@ void getoptions() + case 'L': + do { + printf("How many Long Chains?\n"); +- gets(input); ++ dogets(input, sizeof(input)); + chains[1] = atoi(input); + if (chains[1] < 0) + printf("Must be non-negative\n"); +@@ -811,7 +825,7 @@ void getoptions() + if (ctgry) { + do { + printf("Number of categories ?"); +- gets(input); ++ dogets(input, sizeof(input)); + categs = atoi(input); + } while (categs < 1); + free(rate); +@@ -869,7 +883,7 @@ void getoptions() + case 'T': + do { + printf("Transition/transversion ratio?\n"); +- gets(input); ++ dogets(input, sizeof(input)); + locus_ttratio = atof(input); + } while (locus_ttratio < 0.0); + break; +@@ -883,7 +897,7 @@ void getoptions() + if (!watt) { + do { + printf("Initial theta estimate?\n"); +- gets(input); ++ dogets(input, sizeof(input)); + theta0 = atof(input); + } while (theta0 <= 0.0); + } +@@ -909,7 +923,7 @@ void getoptions() + done1 = false; + while (!done1) { + printf("How often to sample trees?\n"); +- gets(input); ++ dogets(input, sizeof(input)); + increm[0] = atoi(input); + if (increm[0] > 0) + done1 = true; +@@ -922,7 +936,7 @@ void getoptions() + done1 = false; + while (!done1) { + printf("How many short steps?\n"); +- gets(input); ++ dogets(input, sizeof(input)); + steps[0] = atoi(input); + if (steps[0] > 0) + done1 = true; +@@ -935,7 +949,7 @@ void getoptions() + done1 = false; + while (!done1) { + printf("How often to sample trees?\n"); +- gets(input); ++ dogets(input, sizeof(input)); + increm[1] = atoi(input); + if (increm[1] > 0) + done1 = true; +@@ -948,7 +962,7 @@ void getoptions() + done1 = false; + while (!done1) { + printf("How many long steps?\n"); +- gets(input); ++ dogets(input, sizeof(input)); + steps[1] = atoi(input); + if (steps[1] > 0) + done1 = true; |