[med-svn] [Git][med-team/blimps][master] 6 commits: Patch is not applicable since competing with quilt patch

Andreas Tille gitlab at salsa.debian.org
Fri Jan 11 12:24:56 GMT 2019


Andreas Tille pushed to branch master at Debian Med / blimps


Commits:
e23dae80 by Andreas Tille at 2019-01-10T21:53:10Z
Patch is not applicable since competing with quilt patch

- - - - -
2adb681a by Andreas Tille at 2019-01-11T06:55:28Z
Hardening + debug symbols

- - - - -
1b6a0f56 by Andreas Tille at 2019-01-11T07:10:35Z
Refactor single patch

- - - - -
1b33f3bf by Andreas Tille at 2019-01-11T07:42:00Z
More patches

- - - - -
2cb5f257 by Andreas Tille at 2019-01-11T08:52:02Z
Fix format-security issues

- - - - -
c2b94362 by Andreas Tille at 2019-01-11T12:23:05Z
Try hard to build even with hardening flags switched on

- - - - -


11 changed files:

- debian/blimps-utils.manpages
- − debian/blimps.patch.txt
- debian/changelog
- + debian/fastaseqs.1
- + debian/fastaseqs.pod
- − debian/get-patch
- + debian/patches/gets.patch
- + debian/patches/hardening.patch
- debian/patches/patch001 → debian/patches/makefile.patch
- debian/patches/series
- debian/rules


Changes:

=====================================
debian/blimps-utils.manpages
=====================================
@@ -1 +1 @@
-usr/share/man/man1/fastaseqs.1.gz
+debian/fastaseqs.1


=====================================
debian/blimps.patch.txt deleted
=====================================
The diff for this file was not included because it is too large.

=====================================
debian/changelog
=====================================
@@ -1,4 +1,4 @@
-blimps (3.9+ds-1) unstable; urgency=medium
+blimps (3.9+ds-1) UNRELEASED; urgency=medium
 
   * Homepage vanished - point to waybackmachine as homepage
   * Rebuild tarball by droping all binaries
@@ -6,6 +6,8 @@ blimps (3.9+ds-1) unstable; urgency=medium
   * debhelper 12
   * Point Vcs fields to salsa.debian.org
   * Standards-Version: 4.3.0
+  * hardening=+all
+  * Refactor single patch
 
  -- Andreas Tille <tille at debian.org>  Thu, 10 Jan 2019 22:19:40 +0100
 


=====================================
debian/fastaseqs.1
=====================================
@@ -0,0 +1,159 @@
+.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings.  \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
+.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+.    ds -- \(*W-
+.    ds PI pi
+.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
+.    ds L" ""
+.    ds R" ""
+.    ds C` ""
+.    ds C' ""
+'br\}
+.el\{\
+.    ds -- \|\(em\|
+.    ds PI \(*p
+.    ds L" ``
+.    ds R" ''
+.    ds C`
+.    ds C'
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
+.\"
+.\" If the F register is >0, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD.  Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.\"
+.\" Avoid warning from groff about undefined register 'F'.
+.de IX
+..
+.nr rF 0
+.if \n(.g .if rF .nr rF 1
+.if (\n(rF:(\n(.g==0)) \{\
+.    if \nF \{\
+.        de IX
+.        tm Index:\\$1\t\\n%\t"\\$2"
+..
+.        if !\nF==2 \{\
+.            nr % 0
+.            nr F 2
+.        \}
+.    \}
+.\}
+.rr rF
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
+.    \" fudge factors for nroff and troff
+.if n \{\
+.    ds #H 0
+.    ds #V .8m
+.    ds #F .3m
+.    ds #[ \f1
+.    ds #] \fP
+.\}
+.if t \{\
+.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+.    ds #V .6m
+.    ds #F 0
+.    ds #[ \&
+.    ds #] \&
+.\}
+.    \" simple accents for nroff and troff
+.if n \{\
+.    ds ' \&
+.    ds ` \&
+.    ds ^ \&
+.    ds , \&
+.    ds ~ ~
+.    ds /
+.\}
+.if t \{\
+.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+.    \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+.    \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+.    \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+.    ds : e
+.    ds 8 ss
+.    ds o a
+.    ds d- d\h'-1'\(ga
+.    ds D- D\h'-1'\(hy
+.    ds th \o'bp'
+.    ds Th \o'LP'
+.    ds ae ae
+.    ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "FASTASEQS 1"
+.TH FASTASEQS 1 "2019-01-11" "3.9" "User Commands"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+fastaseqs \- converts a file of sequences to FASTA format
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+fastaseqs <\s-1INPUTFILE\s0> <\s-1OUTPUTFILE\s0>
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+fastaseqs converts a file of sequences to \s-1FASTA\s0 format.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+J. Henikoff
+.SH "COPYRIGHT AND LICENSE"
+.IX Header "COPYRIGHT AND LICENSE"
+Copyright 1998, Fred Hutchinson Cancer Research Center
+.PP
+Please refer to /usr/share/doc/*blimps*/copyright for the license.
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+<http://blocks.fhcrc.org/blocks/uploads/blimps/>


=====================================
debian/fastaseqs.pod
=====================================
@@ -0,0 +1,25 @@
+=head1 NAME
+
+fastaseqs - converts a file of sequences to FASTA format
+
+=head1 SYNOPSIS
+
+fastaseqs <INPUTFILE> <OUTPUTFILE>
+
+=head1 DESCRIPTION
+
+fastaseqs converts a file of sequences to FASTA format.
+
+=head1 AUTHOR
+
+J. Henikoff
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 1998, Fred Hutchinson Cancer Research Center
+
+Please refer to /usr/share/doc/*blimps*/copyright for the license.
+
+=head1 SEE ALSO
+
+L<http://blocks.fhcrc.org/blocks/uploads/blimps/>


=====================================
debian/get-patch deleted
=====================================
@@ -1,3 +0,0 @@
-#!/bin/sh -e
-
-wget -N https://web.archive.org/web/20170703191319/http://blocks.fhcrc.org/blocks/uploads/blimps/blimps.patch.txt


=====================================
debian/patches/gets.patch
=====================================
@@ -0,0 +1,1730 @@
+Author: Laszlo Kajan
+Last-Update: 2012-01-31 17:21:48 +0000
+Description: replaced gets() with fgets()
+Remark: There is a patch at
+   https://web.archive.org/web/20170703191319/http://blocks.fhcrc.org/blocks/uploads/blimps/blimps.patch.txt
+ which tries to approach quite the same but is incompatible with the Debian patch and seems not to be needed
+
+--- a/blimps/addseqs.c
++++ b/blimps/addseqs.c
+@@ -150,7 +150,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of file containing blocks: ");
+-      gets(infile);
++      fgets(infile, MAXNAME, stdin);
+    }
+    if ( (fblk=fopen(infile, "r")) == NULL)
+    {
+@@ -164,7 +164,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of sequence file: ");
+-      gets(seqsfile);
++      fgets(seqsfile, MAXNAME, stdin);
+    }
+    if ( (fseq=fopen(seqsfile, "r")) == NULL)
+    {
+@@ -177,7 +177,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of output seqs file: ");
+-      gets(outfile);
++      fgets(outfile, MAXNAME, stdin);
+    }
+    if ( (fout=fopen(outfile, "w")) == NULL)
+    {
+--- a/blimps/biassed_blocks_finder.c
++++ b/blimps/biassed_blocks_finder.c
+@@ -25,6 +25,11 @@ char x2c(char *what);
+ void unescape_url(char *url);
+ void plustospace(char *str);
+ */
++// lkajan: very nice but util.c does not have an interface defined
++// lkajan: can't figure out where this came from but it certainly picked up the wrong fmakeword
++char *fmakeword(FILE *f, char stop, int *cl);
++char *makeword(char *line, char stop);
++
+  
+ entry entries[10000];
+ 
+@@ -124,7 +129,7 @@ void write_block()
+ 
+ 
+   /* check that a block was specified */
+-  if (BLOCK_Ptr->val[0] == NULL) 
++  if (BLOCK_Ptr->val[0] == 0)
+     {
+       printf("<H1>Error</H1>\n");
+       printf("You need to enter a block by writing or pasting a block in the window.<P>\n");
+@@ -139,7 +144,7 @@ void write_block()
+ 
+ 
+   /* if block was pasted/written - */
+-  if (BLOCK_Ptr->val[0] != NULL)
++  if (BLOCK_Ptr->val[0] != 0)
+     {
+       
+       /* open up the block file to write to */
+@@ -255,7 +260,7 @@ void display_output()
+ 
+   printf("<pre>\n");
+   while (!feof(outf) && fgets(buf, LARGE_BUFF_LENGTH, outf) != NULL)
+-     printf(buf) ; 
++     printf("%s", buf) ; 
+   printf("</pre>\n"); 
+ 
+   fclose(outf);
+@@ -264,7 +269,7 @@ void display_output()
+ 
+ /**********************************************************************/
+ 
+-void main(int argc, char *argv[]) {
++int main(int argc, char *argv[]) {
+ 
+   printf("Content-type: text/html\n\n\n");
+ 
+@@ -301,6 +306,6 @@ void main(int argc, char *argv[]) {
+ 
+   clean_temp_files() ;
+ 
+-  exit(0) ;
++  return(0) ;
+ }
+ 
+--- a/blimps/blalign.c
++++ b/blimps/blalign.c
+@@ -119,7 +119,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of file of blocks: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+--- a/blimps/bldist.c
++++ b/blimps/bldist.c
+@@ -70,7 +70,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of file of fasta multiple alignments: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (ifp=fopen(bdbname, "r")) == NULL)
+    {
+@@ -94,7 +94,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of file containing substitution matrix: ");
+-      gets(sijname);
++      fgets(sijname, MAXNAME, stdin);
+    }
+    if ( (sfp=fopen(sijname, "r")) == NULL)
+    {
+@@ -127,7 +127,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of output file: ");
+-      gets(outname);
++      fgets(outname, MAXNAME, stdin);
+    }
+    if ( (ofp=fopen(outname, "w")) == NULL)
+    {
+@@ -140,7 +140,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter type (S=similarity, D=dissimilarity, C=correlation): ");
+-      gets(ctemp);
++      fgets(ctemp, MAXNAME, stdin);
+    }
+    OutType = 1;			/* similarity is default */
+    if      (ctemp[0] == 'd' || ctemp[0] == 'D' || ctemp[0] == '2') OutType = 2;
+--- a/blimps/blDR.c
++++ b/blimps/blDR.c
+@@ -56,7 +56,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+@@ -69,7 +69,7 @@ int main(argc, argv)
+    {
+       printf("\nSequence database must be in fasta format:");
+       printf("\nEnter name of sequence database: ");
+-      gets(sdbname);
++      fgets(sdbname, MAXNAME, stdin);
+    }
+    if ( (sfp=fopen(sdbname, "r")) == NULL)
+    {
+@@ -81,7 +81,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of new blocks database: ");
+-      gets(outname);
++      fgets(outname, MAXNAME, stdin);
+    }
+    if ( (ofp=fopen(outname, "w")) == NULL)
+    {
+--- a/blimps/blexplode.c
++++ b/blimps/blexplode.c
+@@ -29,7 +29,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+--- a/blimps/blk2DR.c
++++ b/blimps/blk2DR.c
+@@ -31,7 +31,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+--- a/blimps/blk2GC.c
++++ b/blimps/blk2GC.c
+@@ -30,7 +30,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+--- a/blimps/blk2lis.c
++++ b/blimps/blk2lis.c
+@@ -30,7 +30,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+--- a/blimps/blk2mot.c
++++ b/blimps/blk2mot.c
+@@ -43,7 +43,7 @@ char *Seq[MAXSEQS];		/* sequences */
+ char Seqname[MAXSEQS][SNAMELEN];
+ 
+ /*=======================================================================*/
+-void main(argc, argv)
++int main(argc, argv)
+      int argc;
+      char *argv[];
+ {
+@@ -71,7 +71,7 @@ void main(argc, argv)
+    else
+    {
+       printf("\nEnter name of file containing sequences: ");
+-      gets(seqfile);
++      fgets(seqfile, FNAMELEN, stdin);
+    }
+    if ( (fseq=fopen(seqfile, "r")) == NULL)
+    {
+@@ -92,7 +92,7 @@ void main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks file: ");
+-      gets(blkfile);
++      fgets(blkfile, FNAMELEN, stdin);
+    }
+    if ( (fblk=fopen(blkfile, "r")) == NULL)
+    {
+@@ -126,7 +126,7 @@ void main(argc, argv)
+    else
+    {
+       printf("\nEnter name of new motomat file: ");
+-      gets(motfile);
++      fgets(motfile, FNAMELEN, stdin);
+    }
+    if ( (fmot=fopen(motfile, "wb")) == NULL)
+    {
+@@ -135,7 +135,7 @@ void main(argc, argv)
+    }
+    write_motifs(fmot, info, motif);
+    fclose(fmot);
+-   exit(0);
++   return(0);
+ }   /* end of main */
+ 
+ /*======================================================================
+--- a/blimps/blk2pssm.c
++++ b/blimps/blk2pssm.c
+@@ -67,7 +67,8 @@ int main(argc, argv)
+   Block *block;
+   Matrix *matrix, *logodds;
+   char bdbname[MAXNAME], conname[MAXNAME];
+-  char ctemp[10];
++#define BLK2PSSM_CTEMPLEN 10
++  char ctemp[BLK2PSSM_CTEMPLEN];
+   int format, type, itemp;
+ 
+   ErrorLevelReport = 5;			/* No blimps errors reported */
+@@ -87,7 +88,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of BLOCKS input file: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+@@ -100,7 +101,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of PSSM output file: ");
+-      gets(conname);
++      fgets(conname, MAXNAME, stdin);
+    }
+    if ( (ofp=fopen(conname, "w")) == NULL)
+    {
+@@ -115,7 +116,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter PSSM format type (B=blimps, M=mast, G=Gribskov, P=Psi-Blast) [B]:  ");
+-      gets(ctemp);
++      fgets(ctemp, BLK2PSSM_CTEMPLEN, stdin );
+    }
+    if (strlen(ctemp) && (ctemp[0] == 'm' || ctemp[0] == 'M'))
+    {       format = 1; type = 6;  }
+--- a/blimps/blk2slx.c
++++ b/blimps/blk2slx.c
+@@ -35,7 +35,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+@@ -48,7 +48,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of new slx database: ");
+-      gets(conname);
++      fgets(conname, MAXNAME, stdin);
+    }
+    if ( (ofp=fopen(conname, "w")) == NULL)
+    {
+--- a/blimps/blklis.c
++++ b/blimps/blklis.c
+@@ -34,7 +34,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of file of blocks: ");
+-      gets(infile);
++      fgets(infile, 80, stdin);
+    }
+    if ( (fin=fopen(infile, "r")) == NULL)
+    {
+@@ -46,7 +46,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of output file: ");
+-      gets(outfile);
++      fgets(outfile, 80, stdin );
+    }
+    if ( (fout=fopen(outfile, "w+")) == NULL)
+    {
+--- a/blimps/blkprob.c
++++ b/blimps/blkprob.c
+@@ -325,7 +325,7 @@ char *argv[];
+    {
+       printf("\nEnter number of hits to report or ");
+       printf("blimps configuration file name [%d]: ", MaxHit);
+-      gets(ctemp);
++      fgets(ctemp, FNAMELEN, stdin);
+    }
+    if (!strlen(ctemp)) strcpy(ctemp, "0");
+    for (i=0; i<strlen(ctemp); i++)
+@@ -353,7 +353,7 @@ char *argv[];
+          else
+          {
+             printf("\nEnter name of file containing blocks search results: ");
+-            gets(homfile);
++            fgets(homfile, FNAMELEN, stdin);
+          }
+          /*------------- arg 3:  blocks database file -----------------------*/
+          db[0] = '\0';
+@@ -362,7 +362,7 @@ char *argv[];
+          else
+          {
+             printf("\nEnter name of blocks database searched: ");
+-            gets(datfile);
++            fgets(datfile, FNAMELEN, stdin);
+          }
+          if (strlen(datfile))
+          {
+--- a/blimps/blocks.c
++++ b/blimps/blocks.c
+@@ -891,7 +891,7 @@ void print_block(block)
+ 	}
+       }    
+       else {
+-	printf("??) \t");
++	printf("??" ") \t");
+ 	for(k=0; k<block->clusters[i].sequences[j].length; k++) {
+ 	  printf("%c", aa_btoa[block->clusters[i].sequences[j].sequence[k]]);
+ 	}
+--- a/blimps/blocks_search.c
++++ b/blimps/blocks_search.c
+@@ -302,8 +302,9 @@ fprintf(jgh,"Address_Ptr->val=%s\n", Add
+         else if (!strncmp(entries[i].val, "pfam", 9))
+         { Pfam_Flag = TRUE; }
+       }
+-      else if (!strncmp(entries[i].name, "bias", 4)) 
+-      { strcpy(Minus_Flag, entries[i].val); }
++// lkajan: what was the intention here? Looks like this would copy entries[i].val to the value of boolean Minus_Flag interpreted as a pointer - trigger to segfault?
++//      else if (!strncmp(entries[i].name, "bias", 4))
++//      { strcpy(Minus_Flag, entries[i].val); }
+       else if (!strncmp(entries[i].name, "ty", 2)) 
+       { strcpy(type, entries[i].val); }
+       else if (!strncmp(entries[i].name, "st", 2)) 
+@@ -379,7 +380,7 @@ void write_csh()
+ 
+    cshp = fopen(csh_file, "w");
+ 
+-   fprintf(cshp, "\#\!/bin/csh\n");
++   fprintf(cshp, "#!/bin/csh\n");
+    fprintf(cshp, "unalias mv\n");
+    fprintf(cshp, "%s %s >& /dev/null\n", blimps, cs_file);
+    if (Title_Ptr != NULL)
+@@ -419,7 +420,7 @@ void write_csh()
+               mailprog, email_addr, buf, Address_Ptr->val, blksort_output);
+        }
+    }
+-   fprintf(cshp, "exit\(0\)\n");
++   fprintf(cshp, "exit(0)\n");
+    fclose(cshp);
+    sprintf(buf, "chmod a+x %s", csh_file);
+    system(buf);
+@@ -433,7 +434,7 @@ void write_sequence()
+   Boolean loop = TRUE;
+   int tot, sum;
+ 
+-  if (Sequence_Ptr->val[0] == NULL) {
++  if (Sequence_Ptr->val[0] == 0) {
+     printf("<H1>Search Error</H1>\n");
+     printf("You need to enter a sequence to search with.<P>\n");
+     exit(0);
+@@ -562,7 +563,7 @@ void display_output()
+ 
+   while (!feof(fp) &&
+ 	 fgets(buf, LARGE_BUFF_LENGTH, fp) != NULL) {
+-    printf(buf);
++    printf("%s", buf);
+   }
+   
+   pclose(fp);
+@@ -581,7 +582,7 @@ void display_html()
+ 
+   while (!feof(fp) &&
+ 	 fgets(buf, LARGE_BUFF_LENGTH, fp) != NULL) {
+-    printf(buf);
++    printf("%s", buf);
+   }
+   
+   fclose(fp);
+@@ -590,7 +591,7 @@ void display_html()
+ 
+ 
+ /*=======================================================================*/
+-void main(int argc, char *argv[]) {
++int main(int argc, char *argv[]) {
+ 
+ 
+ /*
+@@ -655,5 +656,5 @@ jgh = fopen("jorja.out", "w");
+ /*
+   fclose(jgh);
+ */
+-  exit(0);
++  return(0);
+ }  /* end of main */
+--- a/blimps/block_vis.c
++++ b/blimps/block_vis.c
+@@ -868,7 +868,7 @@ void read_file(char *ifilename, char *of
+  * each input file. The only actual work done here is interpreting
+  * '*' in the output filename.
+  */
+-void main(int argc, char *argv[])
++int main(int argc, char *argv[])
+ {
+   int i1, i2, i3, i4;
+   char out_filename[80];
+@@ -910,5 +910,7 @@ void main(int argc, char *argv[])
+   /* No arguments? Give the user some help (and skip the warning above) */
+   if (argc == 1)
+     do_help();
++
++  return(0);
+ }
+ 
+--- a/blimps/blpssm.c
++++ b/blimps/blpssm.c
+@@ -241,7 +241,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of configuration file: ");
+-      gets(cfname);
++      fgets(cfname, FNAMELEN, stdin);
+    }
+    if ( (cfp=fopen(cfname, "r")) == NULL)
+    {
+--- a/blimps/blweight.c
++++ b/blimps/blweight.c
+@@ -92,7 +92,8 @@ int main(argc, argv)
+   FILE *bfp, *ofp;
+   Block *block, *cblock;
+   int wtype, clus, stype;
+-  char bdbname[MAXNAME], conname[MAXNAME], ctemp[10];
++#define BLWEIGHT_CTEMPLEN 10
++  char bdbname[MAXNAME], conname[MAXNAME], ctemp[BLWEIGHT_CTEMPLEN];
+   struct timeval tv;
+ 
+   ErrorLevelReport = 5;			/* don't want to see them */
+@@ -119,7 +120,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets( bdbname, MAXNAME, stdin );
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+@@ -132,7 +133,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of new weighted blocks database: ");
+-      gets(conname);
++      fgets( conname, MAXNAME, stdin );
+    }
+    if ( (ofp=fopen(conname, "w")) == NULL)
+    {
+@@ -149,7 +150,7 @@ int main(argc, argv)
+    {
+       printf("\nEnter weighting scheme (P=position-based, V=Voronoi, ");
+       printf("\n A=Vingron & Argos, Cn = n-percent cluster [P]: ");
+-      gets(ctemp);
++      fgets( ctemp, BLWEIGHT_CTEMPLEN, stdin );
+    }
+    if (strlen(ctemp))
+    {
+@@ -187,7 +188,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter scale (M=>max=100, N=>sum=#seq, ###=>sum=###) [M]: ");
+-      gets(ctemp);
++      fgets( ctemp, BLWEIGHT_CTEMPLEN, stdin );
+    }
+    if (strlen(ctemp))
+    {
+--- a/blimps/cobbler.c
++++ b/blimps/cobbler.c
+@@ -256,7 +256,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of configuration file: ");
+-      gets(cfname);
++      fgets(cfname, MAXNAME, stdin);
+    }
+    if ( (cfp=fopen(cfname, "r")) == NULL)
+    {
+--- a/blimps/coduse.c
++++ b/blimps/coduse.c
+@@ -65,7 +65,7 @@ char *argv[];
+    else
+    {
+       printf("\nEnter name of CUTG spsum file: ");
+-      gets(infile);
++      fgets(infile, MAXNAME, stdin );
+    }
+    if ( (fin=fopen(infile, "r")) == NULL)
+    {
+@@ -78,7 +78,7 @@ char *argv[];
+    else
+    {
+       printf("Enter organism name (leave blank for first organism in file): ");
+-      gets(organism);
++      fgets(organism, MAXNAME, stdin);
+    }
+    if (strlen(organism))
+    {
+@@ -95,7 +95,7 @@ char *argv[];
+    else
+    {
+       printf("\nEnter name of Blimps codon usage output file: ");
+-      gets(outfile);
++      fgets(outfile, MAXNAME, stdin);
+    }
+    if ( (fout=fopen(outfile, "w")) == NULL)
+    {
+--- a/blimps/email.c
++++ b/blimps/email.c
+@@ -35,7 +35,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of sequence file: ");
+-      gets(filename);
++      fgets(filename, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(filename, "r")) == NULL)
+    {
+--- a/blimps/fastaseqs.c
++++ b/blimps/fastaseqs.c
+@@ -39,7 +39,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of input sequence file: ");
+-      gets(infile);
++      fgets(infile, MAXNAME, stdin);
+    }
+    if ( (fin=fopen(infile, "r")) == NULL)
+    {
+@@ -52,7 +52,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of output file: ");
+-      gets(outfile);
++      fgets(outfile, MAXNAME, stdin);
+    }
+    if ( (fout=fopen(outfile, "w")) == NULL)
+    {
+--- a/blimps/find_biassed_blocks.c
++++ b/blimps/find_biassed_blocks.c
+@@ -290,7 +290,7 @@ int *min_cols;
+    else                                   /* get input file interactively */
+       {
+       printf("\nEnter name of a file with blocks or block matrices: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+       }
+ 
+    if ( (*bfp=fopen(bdbname, "r")) == NULL)
+--- a/blimps/format_block.c
++++ b/blimps/format_block.c
+@@ -242,14 +242,14 @@ void clean_temp_files()
+ }
+ 
+ /* 
+- * resize_block_sequences
++ * fb_resize_block_sequences
+  *   Increases the memory for the storage of the sequences of a block.
+  *   Parameter:
+  *     Block *block: the block to resize
+  *   Error codes: none
+  */
+ 
+-static void resize_block_sequences(block)
++static void fb_resize_block_sequences(block)
+      Block *block;
+ {
+   int i;
+@@ -315,13 +315,13 @@ void make_block()
+   /* check that obligatory fields have something */
+ 
+ /* Note if sequence names and start positions not supplied */
+-  if (SEQ_NAMES_Ptr->val[0] == NULL) no_seq_names = 1 ;
++  if (SEQ_NAMES_Ptr->val[0] == 0) no_seq_names = 1 ;
+   else                               no_seq_names = 0 ; 
+ 
+-  if (SEQ_POS_Ptr->val[0] == NULL) no_seq_pos = 1 ;
++  if (SEQ_POS_Ptr->val[0] == 0) no_seq_pos = 1 ;
+   else                             no_seq_pos = 0 ; 
+ 
+-  if (SEQS_Ptr->val[0] == NULL) 
++  if (SEQS_Ptr->val[0] == 0)
+     {
+       printf("<H1>Error</H1>\n");
+       printf("No sequences specified.<P>\n");
+@@ -403,7 +403,7 @@ void make_block()
+        exit(0);
+        }
+ 
+-    if (MA_WIDTH_Ptr->val[0] != NULL && 
++    if (MA_WIDTH_Ptr->val[0] != 0 &&
+         block->width != atoi (MA_WIDTH_Ptr->val))
+        {
+        printf("<H2>Warning</H2>\n");
+@@ -470,15 +470,15 @@ void make_block()
+       if (seq_header)
+ 	 {
+                                                             /* skip blanks */
+-         for(; isspace(SEQS_Ptr->val[i]) && SEQS_Ptr->val[i] != '/n' && 
+-               SEQS_Ptr->val[i] != '/0'; i++) ;
+-         if (SEQS_Ptr->val[i] == '/n')      /* no name is found in line */
++         for(; isspace(SEQS_Ptr->val[i]) && SEQS_Ptr->val[i] != '\n' &&
++               SEQS_Ptr->val[i] != '\0'; i++) ;
++         if (SEQS_Ptr->val[i] == '\n')      /* no name is found in line */
+              sprintf(block->sequences[block->num_sequences].name, 
+                      "%s%d", UNKNOWN_SEQ_NAME, block->num_sequences+1) ;
+          else
+                         /* copy first 20 chars or until a space is reached */
+          for(k=0; !(isspace(SEQS_Ptr->val[i])) && k<20 &&
+-                  SEQS_Ptr->val[i] != '/n' ; i++, k++) 
++                  SEQS_Ptr->val[i] != '\n' ; i++, k++)
+             block->sequences[block->num_sequences].name[k] = SEQS_Ptr->val[i];
+ 
+                                                             /* end string */
+@@ -520,7 +520,7 @@ void make_block()
+          string[j] = '\0' ;
+ 
+          if (block->max_sequences <= block->num_sequences+1) 
+-            resize_block_sequences(block) ;
++            fb_resize_block_sequences(block) ;
+ 
+ 	                                            /* process the sequence */
+ 
+@@ -623,7 +623,7 @@ void make_block()
+             string[j] = '\0' ;
+ 
+             if (block->max_sequences <= k) 
+-               resize_block_sequences(block) ;
++               fb_resize_block_sequences(block) ;
+ 
+                                        /* copy up to first 20 chars of name */
+             strncpy(block->sequences[k].name,string,20) ;
+@@ -681,7 +681,7 @@ void make_block()
+                }
+             string[j] = '\0' ;
+ 
+-            if (block->max_sequences <= k+1) resize_block_sequences(block) ;
++            if (block->max_sequences <= k+1) fb_resize_block_sequences(block) ;
+ 
+             block->sequences[k].position = atoi(string) ;
+ 
+@@ -703,7 +703,7 @@ void make_block()
+ 
+                        /* check that actual number of sequences is equal to 
+                           what the user gave */
+-    if (MA_SEQS_Ptr->val[0] != NULL && 
++    if (MA_SEQS_Ptr->val[0] != 0 &&
+         block->num_sequences != atoi (MA_SEQS_Ptr->val))
+        {
+        printf("<H2>Warning</H2>\n");
+@@ -719,7 +719,7 @@ void make_block()
+ 
+  /* get block header data */
+ 
+-    if (ID_Ptr->val[0] == NULL) 
++    if (ID_Ptr->val[0] == 0)
+        strcpy(block->id, "None") ;
+     else
+        strncpy(block->id,ID_Ptr->val, SMALL_BUFF_LENGTH) ;
+@@ -727,7 +727,7 @@ void make_block()
+     strcat(block->id, "; BLOCK") ;
+ 
+ 
+-    if (AC_Ptr->val[0] == NULL) 
++    if (AC_Ptr->val[0] == 0)
+     {
+        strncpy(block->number, block->sequences[0].name, MAXAC) ;
+     }
+@@ -746,7 +746,7 @@ void make_block()
+ 
+     strcpy(block->ac,block->number) ;
+ 
+-    if (MIN_DIST_Ptr->val[0] == NULL) 
++    if (MIN_DIST_Ptr->val[0] == 0)
+        {
+        j = 10000 ;
+        for(i=0; i<block->num_sequences; i++) 
+@@ -758,7 +758,7 @@ void make_block()
+             block->ac, j) ;
+ 
+ 
+-    if (MAX_DIST_Ptr->val[0] == NULL) 
++    if (MAX_DIST_Ptr->val[0] == 0)
+        {
+        j = 0 ;
+        for(i=0; i<block->num_sequences; i++) 
+@@ -769,12 +769,12 @@ void make_block()
+     sprintf(block->ac, "%s,%d)",
+             block->ac, j) ;
+   
+-    if (DE_Ptr->val[0] == NULL) 
++    if (DE_Ptr->val[0] == 0)
+        strcpy(block->de, "None") ;
+     else
+        strncpy(block->de,DE_Ptr->val, SMALL_BUFF_LENGTH) ;
+ 
+-    if (MA_METH_Ptr->val[0] != NULL) 
++    if (MA_METH_Ptr->val[0] != 0)
+        strncpy(block->bl,MA_METH_Ptr->val, SMALL_BUFF_LENGTH-25) ;
+     else
+        strcpy(block->bl,"Method unspecified") ;
+@@ -881,7 +881,7 @@ void display_output()
+ }
+ 
+ 
+-void main(int argc, char *argv[]) {
++int main(int argc, char *argv[]) {
+ 
+   printf("Content-type: text/html\n\n\n");
+ 
+@@ -918,6 +918,6 @@ void main(int argc, char *argv[]) {
+ 
+   clean_temp_files() ;
+ 
+-  exit(0) ;
++  return(0) ;
+ }
+ 
+--- a/blimps/htmlize-codehop.c
++++ b/blimps/htmlize-codehop.c
+@@ -47,7 +47,7 @@ void insert_ohead();
+ void condense();
+ 
+ /*======================================================================*/
+-void main(argc, argv)
++int main(argc, argv)
+ int argc;
+ char *argv[];
+ {
+@@ -250,7 +250,7 @@ char *argv[];
+    printf("\n%d blocks, %d oligos processed\n", nblock, noligo);
+ */
+ 
+-   exit(0);
++   return(0);
+ }  /* end of main */
+ /*=========================================================================*/
+ struct olist *make_olist()
+--- a/blimps/htmlize-LAMA.c
++++ b/blimps/htmlize-LAMA.c
+@@ -13,6 +13,7 @@
+ 
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <string.h>
+ 
+ 
+ #define TRUE 1
+--- a/blimps/interpro.c
++++ b/blimps/interpro.c
+@@ -94,7 +94,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of interpro xml file: ");
+-      gets(iprfile);
++      fgets(iprfile, MAXNAME, stdin);
+    }
+    if ( (fip=fopen(iprfile, "r")) == NULL)
+    {
+@@ -108,7 +108,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of interpro entry or all : ");
+-      gets(iprname);
++      fgets(iprname, MAXAC, stdin);
+    }
+    if (!strlen(iprname)) strcpy(iprname, "all");
+    All = NO;
+--- a/blimps/LAMA.c
++++ b/blimps/LAMA.c
+@@ -400,12 +400,12 @@ double *Z_cutoff ;
+    else                                   /* get input file(s) interactively */
+       {
+       printf("\nEnter name of a file with blocks or block matrices: ");
+-      gets(bdbname[0]);
++      fgets(bdbname[0], MAXNAME, stdin);
+ 
+       printf("\nThe blocks/matrices in this file will be intercompared.\n");
+       printf("If you wish to compare them against blocks/matrices in\n");
+       printf("another file enter that file name (else just hit <ENTER>).\n");
+-      gets(bdbname[1]);
++      fgets(bdbname[1], MAXNAME, stdin);
+ 
+       if (bdbname[1][0] == '\0') *inpfiles = 1 ;
+       else                       *inpfiles = 2 ;
+@@ -426,7 +426,7 @@ double *Z_cutoff ;
+    else
+       {
+       printf("\nEnter name of output file: ");
+-      gets(outname);
++      fgets(outname, MAXNAME, stdin);
+       }
+ 
+    if ( (*out=fopen(outname, "w")) == NULL)
+@@ -1621,6 +1621,7 @@ FILE   *db ;
+ {
+    Block    *block ;
+    char     line[MAXLINELEN], word[MAXLINELEN], entry_name[MAXLINELEN] ;
++   char     tmpbuf[2*MAXLINELEN]; /* Store fully word+entry_name before stripping to SMALL_BUFF_LENGTH */
+    char     *ptr, *iptr ;
+    int      i1, i2, num_seqs, rc, max_pos, min_pos, temp ;
+    Sequence *sequence_pointer ;
+@@ -1654,11 +1655,13 @@ FILE   *db ;
+ 
+    strcpy(entry_name, ptr) ;
+                                        /* save first word in block accession */
+-   sprintf(block->ac, "%s%s;", word, entry_name) ;
+-   sprintf(block->number, "%s%s", word, entry_name) ;
++   sprintf(tmpbuf, "%s%s;", word, entry_name) ;  /* block->ac is only SMALL_BUFF_LENGTH */
++   strncpy(block->ac, tmpbuf, SMALL_BUFF_LENGTH);
++   strncpy(block->number, tmpbuf, SMALL_BUFF_LENGTH);
+ 
+                                               /* save first word in block ID */
+-   sprintf(block->id, "%s; ProDom_mul", entry_name) ;
++   sprintf(tmpbuf, "%s; ProDom_mul", entry_name) ;
++   strncpy(block->id, tmpbuf, SMALL_BUFF_LENGTH);
+ 
+                  /* get second word - number of sequences between parethesis */
+    if ((ptr = get_token(NULL)) == NULL) 
+--- a/blimps/LAMA_search.c
++++ b/blimps/LAMA_search.c
+@@ -104,7 +104,7 @@ char blplusdbase[LARGE_BUFF_LENGTH];		/*
+ char targetdbase[LARGE_BUFF_LENGTH];		/* user target blocks db */
+ char mail_file[LARGE_BUFF_LENGTH];
+ char email_addr[LARGE_BUFF_LENGTH];
+-char buf[LARGE_BUFF_LENGTH];
++static char buf[LARGE_BUFF_LENGTH];
+ 
+ int pid;
+ 
+@@ -281,7 +281,7 @@ void write_Qblock()
+ 
+ 
+   /* check that a block was specified */
+-  if (Qblock_Ptr->val[0] == NULL) 
++  if (Qblock_Ptr->val[0] == 0)
+     {
+       printf("<H1>Search Error</H1>\n");
+       printf("You need to enter a block to search with by writing or pasting a block in the query block window.<P>\n");
+@@ -296,7 +296,7 @@ void write_Qblock()
+ 
+ 
+   /* if block was pasted/written - */
+-  if (Qblock_Ptr->val[0] != NULL)
++  if (Qblock_Ptr->val[0] != 0)
+     {
+       
+       /* open up the block file to write to */
+@@ -535,7 +535,7 @@ void convert_LAMA_output()
+ 
+   while (!feof(fp) &&
+ 	 fgets(buf, LARGE_BUFF_LENGTH, fp) != NULL)
+-     printf(buf) ;
++     printf("%s", buf) ;
+ 
+   printf("</pre>\n");
+ 
+@@ -579,7 +579,7 @@ void queue_to_mail()
+   /*    mail the person the results */
+   /*    NOTE: need to echo the header lines for the LAMA output :P */
+   /*    NOTE: all this should need to do is to cat the ouput file. */
+-  sprintf(buf, "%s %s '(cat %s) | /usr/bin/mailx -s \"LAMA Results\" -r \"blocks\@fhcrc.org\" %s'", add_queue_entry, LAMA_queue, LAMA_output, Address_Ptr->val);
++  sprintf(buf, "%s %s '(cat %s) | /usr/bin/mailx -s \"LAMA Results\" -r \"blocks at fhcrc.org\" %s'", add_queue_entry, LAMA_queue, LAMA_output, Address_Ptr->val);
+   system(buf);
+   
+ 
+@@ -666,7 +666,7 @@ printf("%s=%d\n", buf, returnCode);
+ 
+ } /* end of run Cyrca */
+ 
+-void main(int argc, char *argv[]) {
++int main(int argc, char *argv[]) {
+ 
+   printf("Content-type: text/html\n\n\n");
+ 
+@@ -715,5 +715,5 @@ void main(int argc, char *argv[]) {
+ 
+   clean_temp_files() ;
+ 
+-  exit(0) ;
++  return(0) ;
+ }
+--- a/blimps/lisblk.c
++++ b/blimps/lisblk.c
+@@ -33,7 +33,7 @@ char Pros[FNAMELEN];
+ char Title[MAXLINE];
+ 
+ /*======================================================================*/
+-void main(argc, argv)
++int main(argc, argv)
+ int argc;
+ char *argv[];
+ {
+@@ -53,7 +53,7 @@ char *argv[];
+    else
+    {
+       printf("\nEnter name of file containing list of sequences: ");
+-      gets(lisfile);
++      fgets(lisfile, FNAMELEN, stdin);
+    }
+    if ( (flis=fopen(lisfile, "r")) == NULL)
+    {
+@@ -69,7 +69,7 @@ char *argv[];
+    else
+    {
+       printf("\nEnter name of block file: ");
+-      gets(blkfile);
++      fgets(blkfile, FNAMELEN, stdin);
+    }
+ 
+    if ((fblk=fopen(blkfile, "r")) == NULL)
+@@ -85,7 +85,7 @@ char *argv[];
+       if ((fblk=fopen(blkfile, "r")) == NULL)
+       {
+ 	    printf("\nEnter name of block file: ");
+-	    gets(blkfile);
++	    fgets(blkfile, FNAMELEN, stdin);
+       }
+    }
+    if (fblk == NULL)
+@@ -147,7 +147,7 @@ char *argv[];
+    fclose(fout);
+ 
+    printf("\n");
+-   exit(0);
++   return(0);
+ }  /*  end of main */
+ /*================================================================*/
+ int flag_ids(block, ids)
+--- a/blimps/mablock.c
++++ b/blimps/mablock.c
+@@ -102,7 +102,8 @@ int main(argc, argv)
+ {
+    FILE *ifp, *bfp, *sfp;
+    Sequence *seqs[MAXSEQ];
+-   char ctemp[MAXNAME], bdbname[MAXNAME], outtype[10], *ptr;
++#define MABLOCK_OUTTYPELEN 10
++   char ctemp[MAXNAME], bdbname[MAXNAME], outtype[MABLOCK_OUTTYPELEN], *ptr;
+    int db_type, seq_type, nseq, i, bflag, ftype;
+    struct blocks_list *blocks;
+    Block *block;
+@@ -127,7 +128,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets( bdbname, MAXNAME, stdin );
+    }
+    if ( (ifp=fopen(bdbname, "r")) == NULL)
+    {
+@@ -157,7 +158,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of output file: ");
+-      gets(OutName);
++      fgets( OutName, MAXNAME, stdin );
+    }
+    strcpy(ctemp, OutName); strcat(ctemp, ".blks");
+    if ( (bfp=fopen(ctemp, "w")) == NULL)
+@@ -177,7 +178,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter type of output file [B=blocks|F=fasta]: ");
+-      gets(outtype);
++      fgets( outtype, MABLOCK_OUTTYPELEN, stdin );
+    }
+    if (outtype[0] == 'F' || outtype[0] == 'f') ftype = 1;
+ /* ------------4th arg = optional min trimming size--------------------*/
+--- a/blimps/makelogob.c
++++ b/blimps/makelogob.c
+@@ -797,7 +797,7 @@ waveparam **w;
+     *w = NULL;
+     return;
+   }
+-  *w = (waveparam *)Malloc(sizeof(waveparam));
++  *w = (waveparam *)malloc(sizeof(waveparam));
+   p = *w;
+   while (!BUFEOF(afile->f)) {
+     fscanf(afile->f, "%c%*[^\n]", &p->extreme);
+@@ -831,7 +831,7 @@ waveparam **w;
+       }
+     }
+     if (!BUFEOF(afile->f)) {
+-      p->next = (waveparam *)Malloc(sizeof(waveparam));
++      p->next = (waveparam *)malloc(sizeof(waveparam));
+       p = p->next;
+     } else
+       p->next = NULL;
+@@ -2007,7 +2007,7 @@ strings **thestrings;
+     return;
+   }
+ 
+-  *thestrings = (strings *)Malloc(sizeof(strings));
++  *thestrings = (strings *)malloc(sizeof(strings));
+   stringspot = *thestrings;
+   for (n = 1; n <= numberstrings; n++) {
+     if (BUFEOF(theplace->f)) {
+@@ -2023,7 +2023,7 @@ strings **thestrings;
+       halt();
+     }
+     if (n < numberstrings) {
+-      stringspot->next = (strings *)Malloc(sizeof(strings));
++      stringspot->next = (strings *)malloc(sizeof(strings));
+       stringspot = stringspot->next;
+     } else
+       stringspot->next = NULL;
+--- a/blimps/matrix_logob.c
++++ b/blimps/matrix_logob.c
+@@ -142,9 +142,10 @@ int main(argc, argv)
+    int	      itemp, nblock, done, all;
+    long	      bfp_pos;
+    char       bdbname[MAXNAME], suffix[MAXNAME], outname[MAXNAME] ;
+-   char       blockAC[MAXNAME], blockID[MAXNAME], version[32], line[160] ;
++   char       blockAC[MAXNAME], blockID[MAXNAME], version[32];
++   const char line[160] ;
+    char       logodir[MAXNAME], suffix2[MAXNAME], blockAC2[MAXNAME];
+-   char       symvec[MAXNAME], makelogop[MAXNAME], colors[MAXNAME];
++   char       symvec[MAXNAME], makelogop[MAXNAME], colors[MAXNAME+10];
+ 
+    struct stat status ;
+ 
+@@ -331,7 +332,7 @@ FILE  **bfp ;
+    else                               
+       {
+       printf("\nEnter name of BLOCK or MATRIX file: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+       }
+ 
+    /*   Read stdin if the filename starts with '-'   */
+@@ -347,7 +348,7 @@ FILE  **bfp ;
+    else                                   /* get input file(s) interactively */
+       {
+       printf("\nEnter AC in %s or - to make logos for all: ", bdbname);
+-      gets(blockAC);
++      fgets(blockAC, MAXNAME, stdin);
+       }
+ 
+ /* ------------3rd arg = file name suffix ------------------------------JGH*/
+@@ -356,7 +357,7 @@ FILE  **bfp ;
+    else
+       {
+       printf("\nEnter file name suffix: ");
+-      gets(suffix);
++      fgets(suffix, MAXNAME, stdin);
+       printf("Logos will be written to logo.%s\n", suffix);
+       }
+ 
+@@ -588,7 +589,7 @@ char *outname;
+       printf("     after viewing you can also choose to print,\n") ;
+       printf("   P to print logo (%s %s).)\n", PSprint, outname) ;
+ 
+-      gets(ans) ;
++      fgets(ans, 2, stdin) ;
+ 
+       switch (toupper(ans[0]))
+ 	 {
+--- a/blimps/narrow.c
++++ b/blimps/narrow.c
+@@ -93,7 +93,7 @@ char *argv[];
+    else
+    {
+       printf("\nEnter type of input file (Block|Frequencies|Weights): ");
+-      gets(ctemp);
++      fgets(ctemp, 80, stdin);
+    }
+    if (ctemp[0] == 'F' || ctemp[0] == 'f') type = 1; 
+    else if (ctemp[0] == 'W' || ctemp[0] == 'w') type = 2; 
+@@ -104,7 +104,7 @@ char *argv[];
+    else
+    {
+       printf("\nEnter name of input file: ");
+-      gets(chkname);
++      fgets(chkname, 80, stdin);
+    }
+    if ( (chk=fopen(chkname, "r")) == NULL)
+    {
+--- a/blimps/oligo_melt.c
++++ b/blimps/oligo_melt.c
+@@ -75,7 +75,7 @@ int main(argc, argv)
+    else
+    {
+       printf("Enter name of file containing oligos: ");
+-      gets(fname);
++      fgets(fname, 80, stdin);
+    }
+    if (!strlen(fname) ) inpf = stdin;
+    else if ((inpf=fopen(fname, "r")) == NULL)
+--- a/blimps/papssm.c
++++ b/blimps/papssm.c
+@@ -163,7 +163,7 @@ struct steve {
+ 
+ int read_cf();
+ int load_frequencies();
+-double read_freq();
++static double read_freq();
+ void load_subst();
+ double nrgamma();
+ double addlogs();
+@@ -250,7 +250,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of configuration file: ");
+-      gets(cfname);
++      fgets(cfname, FNAMELEN, stdin);
+    }
+    if ( (cfp=fopen(cfname, "r")) == NULL)
+    {
+--- a/blimps/prints2blocks.c
++++ b/blimps/prints2blocks.c
+@@ -63,7 +63,7 @@ int main(argc, argv)
+       {
+       printf(
+        "\nEnter name of input file (Prints protein motifs database): ");
+-      gets(inpfname);
++      fgets(inpfname, MAXNAME, stdin);
+       }
+ 
+    if ( (inpf=fopen(inpfname, "r")) == NULL)
+--- a/blimps/protomat.c
++++ b/blimps/protomat.c
+@@ -438,7 +438,8 @@ char *line;
+ char *dir_unix(line)
+ char *line;
+ {
+-   char tname[FNAMELEN], mem[MAXLINE], pros[FNAMELEN], *ptr;
++   char tname[FNAMELEN], mem[MAXLINE], *ptr;
++   static char pros[FNAMELEN];
+    int test;
+    DIR *dp;
+ 
+--- a/blimps/protxblk.c
++++ b/blimps/protxblk.c
+@@ -37,7 +37,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+@@ -50,7 +50,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of output file: ");
+-      gets(conname);
++      fgets(conname, MAXNAME, stdin);
+    }
+    if ( (ofp=fopen(conname, "w")) == NULL)
+    {
+--- a/blimps/pssmBL.c
++++ b/blimps/pssmBL.c
+@@ -29,7 +29,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of pssmdist.dat file: ");
+-      gets(pssmname);
++      fgets(pssmname, MAXNAME, stdin);
+    }
+    if ( (pfp=fopen(pssmname, "r")) == NULL)
+    {
+@@ -42,7 +42,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+@@ -55,7 +55,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of new blocks database: ");
+-      gets(conname);
++      fgets(conname, MAXNAME, stdin);
+    }
+    if ( (ofp=fopen(conname, "a")) == NULL)
+    {
+--- a/blimps/pssmdist.c
++++ b/blimps/pssmdist.c
+@@ -81,7 +81,7 @@ struct score_struct {
+ 
+ int compute();
+ int load_freqs();
+-double read_a_freq();
++static double read_a_freq();
+ void fix_freqs();
+ int count_tps();
+ 
+@@ -113,7 +113,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of matrix database: ");
+-      gets(mname);
++      fgets(mname, MAXNAME, stdin);
+    }
+    if ( (mfp=fopen(mname, "r")) == NULL)
+    {
+@@ -126,7 +126,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of observed frequencies database: ");
+-      gets(oname);
++      fgets(oname, MAXNAME, stdin);
+    }
+    if ( (ofp=fopen(oname, "r")) == NULL)
+    {
+@@ -138,7 +138,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of frequency file: ");
+-      gets(fname);
++      fgets(fname, MAXNAME,stdin);
+    }
+    if ( (ffp=fopen(fname, "r")) == NULL)
+    {
+@@ -155,7 +155,7 @@ int main(argc, argv)
+    {
+       printf("\nEnter number of sequences in a typical search [%.0f]: ",
+ 		 Search);
+-      gets(ctemp);
++      fgets(ctemp, MAXNAME, stdin);
+    }
+    if (strlen(ctemp)) Search = atof(ctemp);
+ /* ------------5th arg = #aas in a search--------------------*/
+@@ -166,7 +166,7 @@ int main(argc, argv)
+    {
+       printf("\nEnter number of amino acids in a typical database [%.0f]: ",
+ 		SearchAA);
+-      gets(ctemp);
++      fgets(ctemp, MAXNAME, stdin);
+    }
+    if (strlen(ctemp)) SearchAA = atof(ctemp);
+    printf ("Assuming %.0f sequences, %.0f amino acids in a search\n",
+--- a/blimps/rank_matrix.c
++++ b/blimps/rank_matrix.c
+@@ -39,7 +39,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of scoring matrix: ");
+-      gets(matname);
++      fgets(matname, MAXNAME, stdin);
+    }
+    if ( (fmat=fopen(matname, "r")) == NULL)
+    {
+--- a/blimps/readchk.c
++++ b/blimps/readchk.c
+@@ -20,7 +20,7 @@ char *argv[];
+    else
+    {
+       printf("\nEnter name of configuration file: ");
+-      gets(chkname);
++      fgets(chkname, 80, stdin);
+    }
+    if ( (chk=fopen(chkname, "r")) == NULL)
+    {
+--- a/blimps/readmast.c
++++ b/blimps/readmast.c
+@@ -26,7 +26,7 @@ char *argv[];
+    else
+    {
+       printf("\nEnter name of configuration file: ");
+-      gets(chkname);
++      fgets(chkname, 80, stdin);
+    }
+    if ( (chk=fopen(chkname, "r")) == NULL)
+    {
+--- a/blimps/retblock.c
++++ b/blimps/retblock.c
+@@ -50,7 +50,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+@@ -66,7 +66,7 @@ int main(argc, argv)
+    {
+       strcpy(acname, "all");
+       printf("\nEnter AC of blocks to extract, or all [%s]: ", acname);
+-      gets(acname);
++      fgets(acname, MAXNAME, stdin);
+    }
+    if (strcasecmp(acname, "all") == 0) allflag = TRUE;
+ 
+--- a/blimps/sequences.c
++++ b/blimps/sequences.c
+@@ -665,7 +665,7 @@ int read_sequence(seq, seq_type, start_p
+       stemp is a huge negative number ...
+   */
+   if (seq_type == AA_SEQ) {
+-    while ( (c != NULL) && (c != '\0') && (num_seen < room_left) ) {
++    while ( (c != 0) && (c != '\0') && (num_seen < room_left) ) {
+       stemp = aa_atob[c];
+       if (stemp < 0 || stemp > AAID_MAX) stemp = AAID_MAX + 1;
+       if ( stemp <= AAID_MAX ) {
+@@ -1201,7 +1201,7 @@ printf("\n");
+     }
+   }    
+   else {
+-    printf("??) \t");
++    printf("??"") \t");
+ printf("\n");
+     for(k=0; k<seq->length; k++) {
+       printf("%c", aa_btoa[seq->sequence[k]]);
+--- a/blimps/sortblk.c
++++ b/blimps/sortblk.c
+@@ -58,7 +58,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of blocks database: ");
+-      gets(bdbname);
++      fgets(bdbname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(bdbname, "r")) == NULL)
+    {
+@@ -71,7 +71,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of new sorted blocks database: ");
+-      gets(conname);
++      fgets(conname, MAXNAME, stdin);
+    }
+    if ( (ofp=fopen(conname, "w")) == NULL)
+    {
+--- a/blimps/translate.c
++++ b/blimps/translate.c
+@@ -29,7 +29,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of sequence database: ");
+-      gets(sname);
++      fgets(sname, MAXNAME, stdin);
+    }
+    if ( (bfp=fopen(sname, "r")) == NULL)
+    {
+@@ -50,7 +50,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter name of new translated sequence database: ");
+-      gets(outname);
++      fgets(outname, MAXNAME, stdin);
+    }
+    if ( (ofp=fopen(outname, "w")) == NULL)
+    {
+@@ -62,7 +62,7 @@ int main(argc, argv)
+    else
+    {
+       printf("\nEnter translation frame: ");
+-      gets(ctemp);
++      fgets(ctemp, MAXNAME, stdin);
+       frame = atoi(ctemp);
+    }
+    if (frame == 0 || frame < -3 || frame > 3) frame = 1;
+@@ -74,7 +74,7 @@ int main(argc, argv)
+       for (code = 0; code < NUMBER_OF_GENETIC_CODES; code++)
+           printf("\n %d %s", code, gcodes[code].name);
+       printf("\nEnter genetic code: ");
+-      gets(ctemp);
++      fgets(ctemp, MAXNAME, stdin);
+       code = atoi(ctemp);
+    }
+    if (code < 0 || code > 8) code = 0;
+--- a/blimps/util.c
++++ b/blimps/util.c
+@@ -1,5 +1,6 @@
+ #include <stdlib.h>
+ #include <stdio.h>
++#include <string.h>
+ 
+ #define LF 10
+ #define CR 13
+@@ -92,7 +93,7 @@ int rind(char *s, char c) {
+     return -1;
+ }
+ 
+-int getline(char *s, int n, FILE *f) {
++int blimps_getline(char *s, int n, FILE *f) {
+     register int i=0;
+ 
+     while(1) {
+--- a/include/protomat.h
++++ b/include/protomat.h
+@@ -58,7 +58,7 @@
+ #define READ                 "r"       /* Code to read disk files */
+ #define SNAMELEN              20       /* Max length of sequence name */
+ #define IDLEN                 12       /* Max length of db id */
+-#define FNAMELEN              80       /* Max length of file name */
++#define FNAMELEN             160       /* Max length of file name */
+ #define MAXLINE               480      /* Max line length for ASCII file */
+ #define MATSIZE               21       /* Scoring matrix dimension */
+ #define HIGHPASS              4	       /* Default high pass filter value */
+--- a/protomat/blksort.c
++++ b/protomat/blksort.c
+@@ -211,7 +211,7 @@ char *argv[];
+    {
+       printf("\nEnter number of hits to report or ");
+       printf("blimps configuration file name [%d]: ", MaxHit);
+-      gets(ctemp);
++      fgets(ctemp, FNAMELEN, stdin);
+    }
+    if (!strlen(ctemp)) strcpy(ctemp, "0");
+    for (i=0; i<strlen(ctemp); i++)
+@@ -1874,10 +1874,10 @@ itemp = (int) strlen(block->name[s]);
+ 	 blkline[spot+4] = block->ac[7];
+ /*	 kr_itoa(block->offset[s], ctemp, 10);   */
+ 	 /* offset starts at 1 in */
+-	 sprintf(ctemp, "%d", block->offset[s]);
++	 sprintf(ctemp, "%ld", block->offset[s]);
+ 	 strncpy(datline+spot, ctemp, strlen(ctemp));
+ /*	 kr_itoa(block->offset[block->nseq-1]+1, ctemp,10); */
+-         sprintf(ctemp, "%d", block->offset[block->nseq-1]+1);
++         sprintf(ctemp, "%ld", block->offset[block->nseq-1]+1);
+ 	 strncpy(homline+spot, ctemp, strlen(ctemp));
+          /* save location in case there are repeats */
+          savspot = spot;
+@@ -1933,7 +1933,7 @@ itemp = (int) strlen(block->name[s]);
+                for (i=0; i<MAXLINE; i++) repline[i] = ' ';
+                repspot = savspot;
+ /*	       kr_itoa(results[t].offset+1, ctemp,10); */
+-	       sprintf(ctemp, "%d", results[t].offset+1);
++	       sprintf(ctemp, "%ld", results[t].offset+1);
+ 	       strncpy(repline+repspot, ctemp, strlen(ctemp));
+                repspot += 8;
+                strcpy(repline+repspot, results[t].aa);
+--- a/protomat/getblock.c
++++ b/protomat/getblock.c
+@@ -94,7 +94,7 @@ char *argv[];
+       while(strlen(BlockFam) < MINAC)
+       {
+ 	 printf("\nEnter Block accession number: ");
+-	 gets(BlockFam);
++	 fgets(BlockFam, FNAMELEN, stdin);
+       }
+    }
+    /*   Chop off any A-Z block designator at the end */
+--- a/protomat/motifj.h
++++ b/protomat/motifj.h
+@@ -67,7 +67,7 @@
+ #define IDLEN                 12       /* Max length of db id */
+ #define MINAC                  7	/* Min AC length */
+ #define MAXAC                 10	/* Max AC length */
+-#define FNAMELEN              80       /* Max length of file name */
++#define FNAMELEN             160       /* Max length of file name */
+ #define MAXLINE               480      /* Max line length for ASCII file */
+ #define MATSIZE               21       /* Scoring matrix dimension */
+ #define HIGHPASS              4	       /* Default high pass filter value */
+--- a/protomat/motmisc.c
++++ b/protomat/motmisc.c
+@@ -33,27 +33,27 @@ struct db_id *check_entry();
+    non-negative */
+ int bl60_highpass = 8;
+ char bl60_matrix[21][21]={
+-12, 7, 7, 6, 7, 7, 7, 8, 7, 7, 7, 7, 7, 6, 8, 9, 8, 5, 6, 8, 8, /*A*/
+- 7,13, 8, 7, 5, 9, 8, 6, 8, 5, 6,10, 7, 6, 6, 7, 7, 6, 6, 6, 8, /*R*/
+- 7, 8,14, 9, 6, 8, 8, 8, 8, 5, 5, 8, 6, 5, 6, 9, 8, 6, 6, 5, 8, /*N*/
+- 6, 7, 9,14, 4, 8, 9, 7, 7, 5, 5, 7, 5, 5, 6, 8, 7, 4, 6, 5, 8, /*D*/
+- 7, 5, 6, 4,17, 6, 5, 6, 5, 7, 7, 5, 6, 6, 6, 7, 7, 5, 5, 7, 8, /*C*/
+- 7, 9, 8, 8, 6,13,10, 6, 9, 6, 6, 9, 8, 5, 7, 8, 7, 6, 6, 6, 8, /*Q*/
+- 7, 8, 8, 9, 5,10,13, 6, 8, 5, 6, 9, 6, 5, 7, 8, 7, 6, 6, 6, 8,
+- 8, 6, 8, 7, 6, 6, 6,14, 6, 5, 5, 7, 5, 5, 6, 8, 7, 6, 5, 5, 8,
+- 7, 8, 8, 7, 5, 9, 8, 6,15, 5, 5, 7, 6, 7, 6, 7, 6, 6, 9, 5, 8,
+- 7, 5, 5, 5, 7, 6, 5, 5, 5,12,10, 6, 9, 8, 5, 6, 7, 6, 7,11, 8,
+- 7, 6, 5, 5, 7, 6, 6, 5, 5,10,12, 6,10, 8, 6, 6, 7, 6, 7, 9, 8,
+- 7,10, 8, 7, 5, 9, 9, 7, 7, 6, 6,12, 7, 5, 7, 8, 7, 5, 6, 6, 8,
+- 7, 7, 6, 5, 6, 8, 6, 5, 6, 9,10, 7,14, 8, 6, 6, 7, 6, 7, 9, 8,
+- 6, 6, 5, 5, 6, 5, 5, 5, 7, 8, 8, 5, 8,14, 5, 6, 6, 9,11, 7, 8,
+- 8, 6, 6, 6, 6, 7, 7, 6, 6, 5, 6, 7, 6, 5,15, 7, 7, 5, 6, 6, 8,
+- 9, 7, 9, 8, 7, 8, 8, 8, 7, 6, 6, 8, 6, 6, 7,12, 9, 6, 6, 6, 8,
+- 8, 7, 8, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 6, 7, 9,12, 6, 6, 8, 8,
+- 5, 6, 6, 4, 5, 6, 6, 6, 6, 6, 6, 5, 6, 9, 5, 6, 6,18,10, 6, 8,
+- 6, 6, 6, 6, 5, 6, 6, 5, 9, 7, 7, 6, 7,11, 6, 6, 6,10,15, 7, 8,
+- 8, 6, 5, 5, 7, 6, 6, 5, 5,11, 9, 6, 9, 7, 6, 6, 8, 6, 7,12, 8,
+- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0  /* X */
++ {12, 7, 7, 6, 7, 7, 7, 8, 7, 7, 7, 7, 7, 6, 8, 9, 8, 5, 6, 8, 8}, /*A*/
++ { 7,13, 8, 7, 5, 9, 8, 6, 8, 5, 6,10, 7, 6, 6, 7, 7, 6, 6, 6, 8}, /*R*/
++ { 7, 8,14, 9, 6, 8, 8, 8, 8, 5, 5, 8, 6, 5, 6, 9, 8, 6, 6, 5, 8}, /*N*/
++ { 6, 7, 9,14, 4, 8, 9, 7, 7, 5, 5, 7, 5, 5, 6, 8, 7, 4, 6, 5, 8}, /*D*/
++ { 7, 5, 6, 4,17, 6, 5, 6, 5, 7, 7, 5, 6, 6, 6, 7, 7, 5, 5, 7, 8}, /*C*/
++ { 7, 9, 8, 8, 6,13,10, 6, 9, 6, 6, 9, 8, 5, 7, 8, 7, 6, 6, 6, 8}, /*Q*/
++ { 7, 8, 8, 9, 5,10,13, 6, 8, 5, 6, 9, 6, 5, 7, 8, 7, 6, 6, 6, 8},
++ { 8, 6, 8, 7, 6, 6, 6,14, 6, 5, 5, 7, 5, 5, 6, 8, 7, 6, 5, 5, 8},
++ { 7, 8, 8, 7, 5, 9, 8, 6,15, 5, 5, 7, 6, 7, 6, 7, 6, 6, 9, 5, 8},
++ { 7, 5, 5, 5, 7, 6, 5, 5, 5,12,10, 6, 9, 8, 5, 6, 7, 6, 7,11, 8},
++ { 7, 6, 5, 5, 7, 6, 6, 5, 5,10,12, 6,10, 8, 6, 6, 7, 6, 7, 9, 8},
++ { 7,10, 8, 7, 5, 9, 9, 7, 7, 6, 6,12, 7, 5, 7, 8, 7, 5, 6, 6, 8},
++ { 7, 7, 6, 5, 6, 8, 6, 5, 6, 9,10, 7,14, 8, 6, 6, 7, 6, 7, 9, 8},
++ { 6, 6, 5, 5, 6, 5, 5, 5, 7, 8, 8, 5, 8,14, 5, 6, 6, 9,11, 7, 8},
++ { 8, 6, 6, 6, 6, 7, 7, 6, 6, 5, 6, 7, 6, 5,15, 7, 7, 5, 6, 6, 8},
++ { 9, 7, 9, 8, 7, 8, 8, 8, 7, 6, 6, 8, 6, 6, 7,12, 9, 6, 6, 6, 8},
++ { 8, 7, 8, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 6, 7, 9,12, 6, 6, 8, 8},
++ { 5, 6, 6, 4, 5, 6, 6, 6, 6, 6, 6, 5, 6, 9, 5, 6, 6,18,10, 6, 8},
++ { 6, 6, 6, 6, 5, 6, 6, 5, 9, 7, 7, 6, 7,11, 6, 6, 6,10,15, 7, 8},
++ { 8, 6, 5, 5, 7, 6, 6, 5, 5,11, 9, 6, 9, 7, 6, 6, 8, 6, 7,12, 8},
++ { 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0}  /* X */
+ };
+ 
+ /* BLOSUM62 matrix with each cell offset by 4 to make all scores
+@@ -61,27 +61,27 @@ char bl60_matrix[21][21]={
+ int bl62_highpass = 4;
+ /* A  R  N  D  C  Q  E  G  H  I  L  K  M  F  P  S  T  W  Y  V  X  */
+ char bl62_matrix[21][21]={
+-   8, 3, 2, 2, 4, 3, 3, 4, 2, 3, 3, 3, 3, 2, 3, 5, 4, 1, 2, 4, 0, 
+-   3, 9, 4, 2, 1, 5, 4, 2, 4, 1, 2, 6, 3, 1, 2, 3, 3, 1, 2, 1, 0, 
+-   2, 4,10, 5, 1, 4, 4, 4, 5, 1, 1, 4, 2, 1, 2, 5, 4, 0, 2, 1, 0, 
+-   2, 2, 5,10, 1, 4, 6, 3, 3, 1, 0, 3, 1, 1, 3, 4, 3, 0, 1, 1, 0, 
+-   4, 1, 1, 1,13, 1, 0, 1, 1, 3, 3, 1, 3, 2, 1, 3, 3, 2, 2, 3, 0, 
+-   3, 5, 4, 4, 1, 9, 6, 2, 4, 1, 2, 5, 4, 1, 3, 4, 3, 2, 3, 2, 0, 
+-   3, 4, 4, 6, 0, 6, 9, 2, 4, 1, 1, 5, 2, 1, 3, 4, 3, 1, 2, 2, 0, 
+-   4, 2, 4, 3, 1, 2, 2,10, 2, 0, 0, 2, 1, 1, 2, 4, 2, 2, 1, 1, 0, 
+-   2, 4, 5, 3, 1, 4, 4, 2,12, 1, 1, 3, 2, 3, 2, 3, 2, 2, 6, 1, 0, 
+-   3, 1, 1, 1, 3, 1, 1, 0, 1, 8, 6, 1, 5, 4, 1, 2, 3, 1, 3, 7, 0, 
+-   3, 2, 1, 0, 3, 2, 1, 0, 1, 6, 8, 2, 6, 4, 1, 2, 3, 2, 3, 5, 0, 
+-   3, 6, 4, 3, 1, 5, 5, 2, 3, 1, 2, 9, 3, 1, 3, 4, 3, 1, 2, 2, 0, 
+-   3, 3, 2, 1, 3, 4, 2, 1, 2, 5, 6, 3, 9, 4, 2, 3, 3, 3, 3, 5, 0, 
+-   2, 1, 1, 1, 2, 1, 1, 1, 3, 4, 4, 1, 4,10, 0, 2, 2, 5, 7, 3, 0, 
+-   3, 2, 2, 3, 1, 3, 3, 2, 2, 1, 1, 3, 2, 0,11, 3, 3, 0, 1, 2, 0, 
+-   5, 3, 5, 4, 3, 4, 4, 4, 3, 2, 2, 4, 3, 2, 3, 8, 5, 1, 2, 2, 0, 
+-   4, 3, 4, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 2, 3, 5, 9, 2, 2, 4, 0, 
+-   1, 1, 0, 0, 2, 2, 1, 2, 2, 1, 2, 1, 3, 5, 0, 1, 2,15, 6, 1, 0, 
+-   2, 2, 2, 1, 2, 3, 2, 1, 6, 3, 3, 2, 3, 7, 1, 2, 2, 6,11, 3, 0, 
+-   4, 1, 1, 1, 3, 2, 2, 1, 1, 7, 5, 2, 5, 3, 2, 2, 4, 1, 3, 8, 0, 
+-   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0  
++ { 8, 3, 2, 2, 4, 3, 3, 4, 2, 3, 3, 3, 3, 2, 3, 5, 4, 1, 2, 4, 0}, 
++ { 3, 9, 4, 2, 1, 5, 4, 2, 4, 1, 2, 6, 3, 1, 2, 3, 3, 1, 2, 1, 0}, 
++ { 2, 4,10, 5, 1, 4, 4, 4, 5, 1, 1, 4, 2, 1, 2, 5, 4, 0, 2, 1, 0}, 
++ { 2, 2, 5,10, 1, 4, 6, 3, 3, 1, 0, 3, 1, 1, 3, 4, 3, 0, 1, 1, 0}, 
++ { 4, 1, 1, 1,13, 1, 0, 1, 1, 3, 3, 1, 3, 2, 1, 3, 3, 2, 2, 3, 0}, 
++ { 3, 5, 4, 4, 1, 9, 6, 2, 4, 1, 2, 5, 4, 1, 3, 4, 3, 2, 3, 2, 0}, 
++ { 3, 4, 4, 6, 0, 6, 9, 2, 4, 1, 1, 5, 2, 1, 3, 4, 3, 1, 2, 2, 0}, 
++ { 4, 2, 4, 3, 1, 2, 2,10, 2, 0, 0, 2, 1, 1, 2, 4, 2, 2, 1, 1, 0}, 
++ { 2, 4, 5, 3, 1, 4, 4, 2,12, 1, 1, 3, 2, 3, 2, 3, 2, 2, 6, 1, 0}, 
++ { 3, 1, 1, 1, 3, 1, 1, 0, 1, 8, 6, 1, 5, 4, 1, 2, 3, 1, 3, 7, 0}, 
++ { 3, 2, 1, 0, 3, 2, 1, 0, 1, 6, 8, 2, 6, 4, 1, 2, 3, 2, 3, 5, 0}, 
++ { 3, 6, 4, 3, 1, 5, 5, 2, 3, 1, 2, 9, 3, 1, 3, 4, 3, 1, 2, 2, 0}, 
++ { 3, 3, 2, 1, 3, 4, 2, 1, 2, 5, 6, 3, 9, 4, 2, 3, 3, 3, 3, 5, 0}, 
++ { 2, 1, 1, 1, 2, 1, 1, 1, 3, 4, 4, 1, 4,10, 0, 2, 2, 5, 7, 3, 0}, 
++ { 3, 2, 2, 3, 1, 3, 3, 2, 2, 1, 1, 3, 2, 0,11, 3, 3, 0, 1, 2, 0}, 
++ { 5, 3, 5, 4, 3, 4, 4, 4, 3, 2, 2, 4, 3, 2, 3, 8, 5, 1, 2, 2, 0}, 
++ { 4, 3, 4, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 2, 3, 5, 9, 2, 2, 4, 0}, 
++ { 1, 1, 0, 0, 2, 2, 1, 2, 2, 1, 2, 1, 3, 5, 0, 1, 2,15, 6, 1, 0}, 
++ { 2, 2, 2, 1, 2, 3, 2, 1, 6, 3, 3, 2, 3, 7, 1, 2, 2, 6,11, 3, 0}, 
++ { 4, 1, 1, 1, 3, 2, 2, 1, 1, 7, 5, 2, 5, 3, 2, 2, 4, 1, 3, 8, 0}, 
++ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}  
+ };
+ /*=======================================================================*/
+ /* Number to amino acid                  */
+--- a/blimps/version.c
++++ b/blimps/version.c
+@@ -180,8 +180,8 @@ void print_version(fp)
+     }
+   }
+ 
+-  fprintf(fp, TitleString);
+-  fprintf(fp, CopyrightString);
++  fprintf(fp, "%s", TitleString);
++  fprintf(fp, "%s", CopyrightString);
+ 
+ }
+ 
+--- a/include/errors.h
++++ b/include/errors.h
+@@ -28,7 +28,7 @@
+ 
+ 
+ 
+-extern char ErrorBuffer[LARGE_BUFF_LENGTH];
++extern char ErrorBuffer[LARGE_BUFF_LENGTH+SMALL_BUFF_LENGTH];
+ extern int  ErrorLevelReport;
+ 
+ 
+--- a/blimps/errors.c
++++ b/blimps/errors.c
+@@ -15,7 +15,7 @@
+  * Exported variables and data structures
+  */
+ 
+-char ErrorBuffer[LARGE_BUFF_LENGTH];
++char ErrorBuffer[LARGE_BUFF_LENGTH+SMALL_BUFF_LENGTH];
+ int  ErrorLevelReport;
+ 
+ 
+@@ -113,7 +113,7 @@ void ErrorReport(err_level)
+       exit(FATAL_ERR_LVL);	/* closes all the open files */
+     }
+     
+-    ErrorBuffer[0] = '\0';	/* clear the string incase the caller does */
++    ((char *)ErrorBuffer)[0] = '\0';	/* clear the string incase the caller does */
+ 				/* not setup ErrorBuffer correctly for the */
+ 				/* next call */
+     if (dont_skip_error_file_report) {
+--- a/protomat/blosum.c
++++ b/protomat/blosum.c
+@@ -125,7 +125,7 @@ char *argv[];
+    else
+    {
+       printf("Enter name of blocks database:\n");
+-      gets(datfile);
++      fgets(datfile, FNAMELEN, stdin);
+    }
+    if ( (fdat=fopen(datfile, "r")) == NULL)
+    {
+@@ -139,7 +139,7 @@ char *argv[];
+    {
+       MinStr = MINSTR;
+       printf("Enter minimum block strength [%d]: ", MinStr);
+-      gets(ctemp);
++      fgets(ctemp, FNAMELEN, stdin);
+       if (strlen(ctemp)) MinStr = atoi(ctemp);
+    }
+    /*-----------Arg 3, Maximum block strength----------------------*/
+@@ -148,7 +148,7 @@ char *argv[];
+    {
+       MaxStr = MAXSTR;
+       printf("Enter maximum block strength [%d]: ", MaxStr);
+-      gets(ctemp);
++      fgets(ctemp, FNAMELEN, stdin);
+       if (strlen(ctemp)) MaxStr = atoi(ctemp);
+    }
+    printf("Minimum block strength=%d, Maximum block strength=%d\n",
+@@ -165,7 +165,7 @@ char *argv[];
+       printf("   or w for existing sequence weights\n");
+       printf("   or pn for position-based weights, PB weight = 1/n\n");
+       printf("Enter clustering identity percentage or n/e/w/pn [e]: ");
+-      gets(ctemp);
++      fgets(ctemp, FNAMELEN, stdin);
+    }
+    /*  e => -1, n=> -2, w=> -3 p=> -4 */
+    Cluster = -1;
+@@ -208,7 +208,7 @@ char *argv[];
+    {
+       iscale = 0;     
+       printf("Enter scale n for 1/n bits [%d]: ", iscale);
+-      gets(ctemp);
++      fgets(ctemp, FNAMELEN, stdin);
+       if (strlen(ctemp)) iscale = atoi(ctemp);
+    }
+    if (iscale < 0) iscale = 0;
+--- a/protomat/uextract.c
++++ b/protomat/uextract.c
+@@ -130,7 +130,7 @@ char *argv[];
+    else
+    {
+       printf("\nEnter name of file containing list of entries to extract: ");
+-      gets(lisfile);
++      fgets(lisfile, FNAMELEN, stdin);
+    }
+    if ( (flis=fopen(lisfile, "r")) == NULL)
+    {
+@@ -144,7 +144,7 @@ char *argv[];
+    else
+    {
+       printf("\nEnter name of database file to extract entries from: ");
+-      gets(infile);
++      fgets(infile, FNAMELEN, stdin);
+    }
+    if ( (fin=fopen(infile, "r")) == NULL)
+    {


=====================================
debian/patches/hardening.patch
=====================================
@@ -0,0 +1,35 @@
+Description: Propagate hardening options
+Author: Andreas Tille <tille at debian.org>
+Last-Update: Thu, 10 Jan 2019 22:19:40 +0100
+
+--- a/Makefile
++++ b/Makefile
+@@ -14,10 +14,10 @@ libdir ?= $(prefix)/lib
+ all: blimps protomat
+ 
+ blimps:
+-	$(MAKE) -C $(BLIMPSDIR) -f Makefile.Linux VERSION=$(VERSION)
++	$(MAKE) -C $(BLIMPSDIR) -f Makefile.Linux VERSION=$(VERSION) DEBCFLAGS="$(CFLAGS)" DEBLDFLAGS="$(LDFLAGS)"
+ 
+ protomat:
+-	$(MAKE) -C $(PROTOMATDIR) -f Makefile.Linux VERSION=$(VERSION)
++	$(MAKE) -C $(PROTOMATDIR) -f Makefile.Linux VERSION=$(VERSION) DEBCFLAGS="$(CFLAGS)" DEBLDFLAGS="$(LDFLAGS)"
+ 
+ # The sift package does not provide fastaseqs but expects it to exist. Fortunately this package provides it.
+ install: install-utils install-lib-dev install-lib install-data install-doc
+--- a/blimps/Makefile.Linux
++++ b/blimps/Makefile.Linux
+@@ -112,11 +112,11 @@ INCLUDES = -I$(INCLUDE_DIR)
+ 
+ # C Flags to compiler
+ #CFLAGS = `getconf LFS_CFLAGS` $(OPTIMIZ) $(DEFINES) $(INCLUDES)
+-CFLAGS = $(OPTIMIZ) $(DEFINES) $(INCLUDES) -fpic
++CFLAGS = $(DEBCFLAGS) $(OPTIMIZ) $(DEFINES) $(INCLUDES) -fpic
+ 
+ 
+ # Linker Flags
+-LDFLAGS = $(CFLAGS)
++LDFLAGS = $(DEBLDFLAGS)
+ LDLIBS = -lblimps -lm
+ LDOPTIONS = $(LDFLAGS) $(LDDIR)
+ # cc ld options


=====================================
debian/patches/patch001 → debian/patches/makefile.patch
=====================================
@@ -1,967 +1,7 @@
 Author: Laszlo Kajan
 Last-Update: 2012-01-31 17:21:48 +0000
-Description: * replaced gets() with fgets()
-             * fixes to blimps/Makefile.Linux
+Description: fixes to blimps/Makefile.Linux
 
---- a/blimps/addseqs.c
-+++ b/blimps/addseqs.c
-@@ -150,7 +150,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of file containing blocks: ");
--      gets(infile);
-+      fgets(infile, MAXNAME, stdin);
-    }
-    if ( (fblk=fopen(infile, "r")) == NULL)
-    {
-@@ -164,7 +164,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of sequence file: ");
--      gets(seqsfile);
-+      fgets(seqsfile, MAXNAME, stdin);
-    }
-    if ( (fseq=fopen(seqsfile, "r")) == NULL)
-    {
-@@ -177,7 +177,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of output seqs file: ");
--      gets(outfile);
-+      fgets(outfile, MAXNAME, stdin);
-    }
-    if ( (fout=fopen(outfile, "w")) == NULL)
-    {
---- a/blimps/biassed_blocks_finder.c
-+++ b/blimps/biassed_blocks_finder.c
-@@ -25,6 +25,11 @@ char x2c(char *what);
- void unescape_url(char *url);
- void plustospace(char *str);
- */
-+// lkajan: very nice but util.c does not have an interface defined
-+// lkajan: can't figure out where this came from but it certainly picked up the wrong fmakeword
-+char *fmakeword(FILE *f, char stop, int *cl);
-+char *makeword(char *line, char stop);
-+
-  
- entry entries[10000];
- 
-@@ -124,7 +129,7 @@ void write_block()
- 
- 
-   /* check that a block was specified */
--  if (BLOCK_Ptr->val[0] == NULL) 
-+  if (BLOCK_Ptr->val[0] == 0)
-     {
-       printf("<H1>Error</H1>\n");
-       printf("You need to enter a block by writing or pasting a block in the window.<P>\n");
-@@ -139,7 +144,7 @@ void write_block()
- 
- 
-   /* if block was pasted/written - */
--  if (BLOCK_Ptr->val[0] != NULL)
-+  if (BLOCK_Ptr->val[0] != 0)
-     {
-       
-       /* open up the block file to write to */
-@@ -264,7 +269,7 @@ void display_output()
- 
- /**********************************************************************/
- 
--void main(int argc, char *argv[]) {
-+int main(int argc, char *argv[]) {
- 
-   printf("Content-type: text/html\n\n\n");
- 
-@@ -301,6 +306,6 @@ void main(int argc, char *argv[]) {
- 
-   clean_temp_files() ;
- 
--  exit(0) ;
-+  return(0) ;
- }
- 
---- a/blimps/blalign.c
-+++ b/blimps/blalign.c
-@@ -119,7 +119,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of file of blocks: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
---- a/blimps/bldist.c
-+++ b/blimps/bldist.c
-@@ -70,7 +70,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of file of fasta multiple alignments: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (ifp=fopen(bdbname, "r")) == NULL)
-    {
-@@ -94,7 +94,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of file containing substitution matrix: ");
--      gets(sijname);
-+      fgets(sijname, MAXNAME, stdin);
-    }
-    if ( (sfp=fopen(sijname, "r")) == NULL)
-    {
-@@ -127,7 +127,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of output file: ");
--      gets(outname);
-+      fgets(outname, MAXNAME, stdin);
-    }
-    if ( (ofp=fopen(outname, "w")) == NULL)
-    {
-@@ -140,7 +140,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter type (S=similarity, D=dissimilarity, C=correlation): ");
--      gets(ctemp);
-+      fgets(ctemp, MAXNAME, stdin);
-    }
-    OutType = 1;			/* similarity is default */
-    if      (ctemp[0] == 'd' || ctemp[0] == 'D' || ctemp[0] == '2') OutType = 2;
---- a/blimps/blDR.c
-+++ b/blimps/blDR.c
-@@ -56,7 +56,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
-@@ -69,7 +69,7 @@ int main(argc, argv)
-    {
-       printf("\nSequence database must be in fasta format:");
-       printf("\nEnter name of sequence database: ");
--      gets(sdbname);
-+      fgets(sdbname, MAXNAME, stdin);
-    }
-    if ( (sfp=fopen(sdbname, "r")) == NULL)
-    {
-@@ -81,7 +81,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of new blocks database: ");
--      gets(outname);
-+      fgets(outname, MAXNAME, stdin);
-    }
-    if ( (ofp=fopen(outname, "w")) == NULL)
-    {
---- a/blimps/blexplode.c
-+++ b/blimps/blexplode.c
-@@ -29,7 +29,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
---- a/blimps/blk2DR.c
-+++ b/blimps/blk2DR.c
-@@ -31,7 +31,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
---- a/blimps/blk2GC.c
-+++ b/blimps/blk2GC.c
-@@ -30,7 +30,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
---- a/blimps/blk2lis.c
-+++ b/blimps/blk2lis.c
-@@ -30,7 +30,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
---- a/blimps/blk2mot.c
-+++ b/blimps/blk2mot.c
-@@ -43,7 +43,7 @@ char *Seq[MAXSEQS];		/* sequences */
- char Seqname[MAXSEQS][SNAMELEN];
- 
- /*=======================================================================*/
--void main(argc, argv)
-+int main(argc, argv)
-      int argc;
-      char *argv[];
- {
-@@ -71,7 +71,7 @@ void main(argc, argv)
-    else
-    {
-       printf("\nEnter name of file containing sequences: ");
--      gets(seqfile);
-+      fgets(seqfile, FNAMELEN, stdin);
-    }
-    if ( (fseq=fopen(seqfile, "r")) == NULL)
-    {
-@@ -92,7 +92,7 @@ void main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks file: ");
--      gets(blkfile);
-+      fgets(blkfile, FNAMELEN, stdin);
-    }
-    if ( (fblk=fopen(blkfile, "r")) == NULL)
-    {
-@@ -126,7 +126,7 @@ void main(argc, argv)
-    else
-    {
-       printf("\nEnter name of new motomat file: ");
--      gets(motfile);
-+      fgets(motfile, FNAMELEN, stdin);
-    }
-    if ( (fmot=fopen(motfile, "wb")) == NULL)
-    {
-@@ -135,7 +135,7 @@ void main(argc, argv)
-    }
-    write_motifs(fmot, info, motif);
-    fclose(fmot);
--   exit(0);
-+   return(0);
- }   /* end of main */
- 
- /*======================================================================
---- a/blimps/blk2pssm.c
-+++ b/blimps/blk2pssm.c
-@@ -67,7 +67,8 @@ int main(argc, argv)
-   Block *block;
-   Matrix *matrix, *logodds;
-   char bdbname[MAXNAME], conname[MAXNAME];
--  char ctemp[10];
-+#define BLK2PSSM_CTEMPLEN 10
-+  char ctemp[BLK2PSSM_CTEMPLEN];
-   int format, type, itemp;
- 
-   ErrorLevelReport = 5;			/* No blimps errors reported */
-@@ -87,7 +88,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of BLOCKS input file: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
-@@ -100,7 +101,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of PSSM output file: ");
--      gets(conname);
-+      fgets(conname, MAXNAME, stdin);
-    }
-    if ( (ofp=fopen(conname, "w")) == NULL)
-    {
-@@ -115,7 +116,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter PSSM format type (B=blimps, M=mast, G=Gribskov, P=Psi-Blast) [B]:  ");
--      gets(ctemp);
-+      fgets(ctemp, BLK2PSSM_CTEMPLEN, stdin );
-    }
-    if (strlen(ctemp) && (ctemp[0] == 'm' || ctemp[0] == 'M'))
-    {       format = 1; type = 6;  }
---- a/blimps/blk2slx.c
-+++ b/blimps/blk2slx.c
-@@ -35,7 +35,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
-@@ -48,7 +48,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of new slx database: ");
--      gets(conname);
-+      fgets(conname, MAXNAME, stdin);
-    }
-    if ( (ofp=fopen(conname, "w")) == NULL)
-    {
---- a/blimps/blklis.c
-+++ b/blimps/blklis.c
-@@ -34,7 +34,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of file of blocks: ");
--      gets(infile);
-+      fgets(infile, 80, stdin);
-    }
-    if ( (fin=fopen(infile, "r")) == NULL)
-    {
-@@ -46,7 +46,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of output file: ");
--      gets(outfile);
-+      fgets(outfile, 80, stdin );
-    }
-    if ( (fout=fopen(outfile, "w+")) == NULL)
-    {
---- a/blimps/blkprob.c
-+++ b/blimps/blkprob.c
-@@ -325,7 +325,7 @@ char *argv[];
-    {
-       printf("\nEnter number of hits to report or ");
-       printf("blimps configuration file name [%d]: ", MaxHit);
--      gets(ctemp);
-+      fgets(ctemp, FNAMELEN, stdin);
-    }
-    if (!strlen(ctemp)) strcpy(ctemp, "0");
-    for (i=0; i<strlen(ctemp); i++)
-@@ -353,7 +353,7 @@ char *argv[];
-          else
-          {
-             printf("\nEnter name of file containing blocks search results: ");
--            gets(homfile);
-+            fgets(homfile, FNAMELEN, stdin);
-          }
-          /*------------- arg 3:  blocks database file -----------------------*/
-          db[0] = '\0';
-@@ -362,7 +362,7 @@ char *argv[];
-          else
-          {
-             printf("\nEnter name of blocks database searched: ");
--            gets(datfile);
-+            fgets(datfile, FNAMELEN, stdin);
-          }
-          if (strlen(datfile))
-          {
---- a/blimps/blocks.c
-+++ b/blimps/blocks.c
-@@ -891,7 +891,7 @@ void print_block(block)
- 	}
-       }    
-       else {
--	printf("??) \t");
-+	printf("??" ") \t");
- 	for(k=0; k<block->clusters[i].sequences[j].length; k++) {
- 	  printf("%c", aa_btoa[block->clusters[i].sequences[j].sequence[k]]);
- 	}
---- a/blimps/blocks_search.c
-+++ b/blimps/blocks_search.c
-@@ -302,8 +302,9 @@ fprintf(jgh,"Address_Ptr->val=%s\n", Add
-         else if (!strncmp(entries[i].val, "pfam", 9))
-         { Pfam_Flag = TRUE; }
-       }
--      else if (!strncmp(entries[i].name, "bias", 4)) 
--      { strcpy(Minus_Flag, entries[i].val); }
-+// lkajan: what was the intention here? Looks like this would copy entries[i].val to the value of boolean Minus_Flag interpreted as a pointer - trigger to segfault?
-+//      else if (!strncmp(entries[i].name, "bias", 4))
-+//      { strcpy(Minus_Flag, entries[i].val); }
-       else if (!strncmp(entries[i].name, "ty", 2)) 
-       { strcpy(type, entries[i].val); }
-       else if (!strncmp(entries[i].name, "st", 2)) 
-@@ -379,7 +380,7 @@ void write_csh()
- 
-    cshp = fopen(csh_file, "w");
- 
--   fprintf(cshp, "\#\!/bin/csh\n");
-+   fprintf(cshp, "#!/bin/csh\n");
-    fprintf(cshp, "unalias mv\n");
-    fprintf(cshp, "%s %s >& /dev/null\n", blimps, cs_file);
-    if (Title_Ptr != NULL)
-@@ -419,7 +420,7 @@ void write_csh()
-               mailprog, email_addr, buf, Address_Ptr->val, blksort_output);
-        }
-    }
--   fprintf(cshp, "exit\(0\)\n");
-+   fprintf(cshp, "exit(0)\n");
-    fclose(cshp);
-    sprintf(buf, "chmod a+x %s", csh_file);
-    system(buf);
-@@ -433,7 +434,7 @@ void write_sequence()
-   Boolean loop = TRUE;
-   int tot, sum;
- 
--  if (Sequence_Ptr->val[0] == NULL) {
-+  if (Sequence_Ptr->val[0] == 0) {
-     printf("<H1>Search Error</H1>\n");
-     printf("You need to enter a sequence to search with.<P>\n");
-     exit(0);
-@@ -590,7 +591,7 @@ void display_html()
- 
- 
- /*=======================================================================*/
--void main(int argc, char *argv[]) {
-+int main(int argc, char *argv[]) {
- 
- 
- /*
-@@ -655,5 +656,5 @@ jgh = fopen("jorja.out", "w");
- /*
-   fclose(jgh);
- */
--  exit(0);
-+  return(0);
- }  /* end of main */
---- a/blimps/block_vis.c
-+++ b/blimps/block_vis.c
-@@ -868,7 +868,7 @@ void read_file(char *ifilename, char *of
-  * each input file. The only actual work done here is interpreting
-  * '*' in the output filename.
-  */
--void main(int argc, char *argv[])
-+int main(int argc, char *argv[])
- {
-   int i1, i2, i3, i4;
-   char out_filename[80];
-@@ -910,5 +910,7 @@ void main(int argc, char *argv[])
-   /* No arguments? Give the user some help (and skip the warning above) */
-   if (argc == 1)
-     do_help();
-+
-+  return(0);
- }
- 
---- a/blimps/blpssm.c
-+++ b/blimps/blpssm.c
-@@ -241,7 +241,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of configuration file: ");
--      gets(cfname);
-+      fgets(cfname, FNAMELEN, stdin);
-    }
-    if ( (cfp=fopen(cfname, "r")) == NULL)
-    {
---- a/blimps/blweight.c
-+++ b/blimps/blweight.c
-@@ -92,7 +92,8 @@ int main(argc, argv)
-   FILE *bfp, *ofp;
-   Block *block, *cblock;
-   int wtype, clus, stype;
--  char bdbname[MAXNAME], conname[MAXNAME], ctemp[10];
-+#define BLWEIGHT_CTEMPLEN 10
-+  char bdbname[MAXNAME], conname[MAXNAME], ctemp[BLWEIGHT_CTEMPLEN];
-   struct timeval tv;
- 
-   ErrorLevelReport = 5;			/* don't want to see them */
-@@ -119,7 +120,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets( bdbname, MAXNAME, stdin );
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
-@@ -132,7 +133,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of new weighted blocks database: ");
--      gets(conname);
-+      fgets( conname, MAXNAME, stdin );
-    }
-    if ( (ofp=fopen(conname, "w")) == NULL)
-    {
-@@ -149,7 +150,7 @@ int main(argc, argv)
-    {
-       printf("\nEnter weighting scheme (P=position-based, V=Voronoi, ");
-       printf("\n A=Vingron & Argos, Cn = n-percent cluster [P]: ");
--      gets(ctemp);
-+      fgets( ctemp, BLWEIGHT_CTEMPLEN, stdin );
-    }
-    if (strlen(ctemp))
-    {
-@@ -187,7 +188,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter scale (M=>max=100, N=>sum=#seq, ###=>sum=###) [M]: ");
--      gets(ctemp);
-+      fgets( ctemp, BLWEIGHT_CTEMPLEN, stdin );
-    }
-    if (strlen(ctemp))
-    {
---- a/blimps/cobbler.c
-+++ b/blimps/cobbler.c
-@@ -256,7 +256,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of configuration file: ");
--      gets(cfname);
-+      fgets(cfname, MAXNAME, stdin);
-    }
-    if ( (cfp=fopen(cfname, "r")) == NULL)
-    {
---- a/blimps/coduse.c
-+++ b/blimps/coduse.c
-@@ -65,7 +65,7 @@ char *argv[];
-    else
-    {
-       printf("\nEnter name of CUTG spsum file: ");
--      gets(infile);
-+      fgets(infile, MAXNAME, stdin );
-    }
-    if ( (fin=fopen(infile, "r")) == NULL)
-    {
-@@ -78,7 +78,7 @@ char *argv[];
-    else
-    {
-       printf("Enter organism name (leave blank for first organism in file): ");
--      gets(organism);
-+      fgets(organism, MAXNAME, stdin);
-    }
-    if (strlen(organism))
-    {
-@@ -95,7 +95,7 @@ char *argv[];
-    else
-    {
-       printf("\nEnter name of Blimps codon usage output file: ");
--      gets(outfile);
-+      fgets(outfile, MAXNAME, stdin);
-    }
-    if ( (fout=fopen(outfile, "w")) == NULL)
-    {
---- a/blimps/email.c
-+++ b/blimps/email.c
-@@ -35,7 +35,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of sequence file: ");
--      gets(filename);
-+      fgets(filename, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(filename, "r")) == NULL)
-    {
---- a/blimps/fastaseqs.c
-+++ b/blimps/fastaseqs.c
-@@ -39,7 +39,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of input sequence file: ");
--      gets(infile);
-+      fgets(infile, MAXNAME, stdin);
-    }
-    if ( (fin=fopen(infile, "r")) == NULL)
-    {
-@@ -52,7 +52,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of output file: ");
--      gets(outfile);
-+      fgets(outfile, MAXNAME, stdin);
-    }
-    if ( (fout=fopen(outfile, "w")) == NULL)
-    {
---- a/blimps/find_biassed_blocks.c
-+++ b/blimps/find_biassed_blocks.c
-@@ -290,7 +290,7 @@ int *min_cols;
-    else                                   /* get input file interactively */
-       {
-       printf("\nEnter name of a file with blocks or block matrices: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-       }
- 
-    if ( (*bfp=fopen(bdbname, "r")) == NULL)
---- a/blimps/format_block.c
-+++ b/blimps/format_block.c
-@@ -242,14 +242,14 @@ void clean_temp_files()
- }
- 
- /* 
-- * resize_block_sequences
-+ * fb_resize_block_sequences
-  *   Increases the memory for the storage of the sequences of a block.
-  *   Parameter:
-  *     Block *block: the block to resize
-  *   Error codes: none
-  */
- 
--static void resize_block_sequences(block)
-+static void fb_resize_block_sequences(block)
-      Block *block;
- {
-   int i;
-@@ -315,13 +315,13 @@ void make_block()
-   /* check that obligatory fields have something */
- 
- /* Note if sequence names and start positions not supplied */
--  if (SEQ_NAMES_Ptr->val[0] == NULL) no_seq_names = 1 ;
-+  if (SEQ_NAMES_Ptr->val[0] == 0) no_seq_names = 1 ;
-   else                               no_seq_names = 0 ; 
- 
--  if (SEQ_POS_Ptr->val[0] == NULL) no_seq_pos = 1 ;
-+  if (SEQ_POS_Ptr->val[0] == 0) no_seq_pos = 1 ;
-   else                             no_seq_pos = 0 ; 
- 
--  if (SEQS_Ptr->val[0] == NULL) 
-+  if (SEQS_Ptr->val[0] == 0)
-     {
-       printf("<H1>Error</H1>\n");
-       printf("No sequences specified.<P>\n");
-@@ -403,7 +403,7 @@ void make_block()
-        exit(0);
-        }
- 
--    if (MA_WIDTH_Ptr->val[0] != NULL && 
-+    if (MA_WIDTH_Ptr->val[0] != 0 &&
-         block->width != atoi (MA_WIDTH_Ptr->val))
-        {
-        printf("<H2>Warning</H2>\n");
-@@ -470,15 +470,15 @@ void make_block()
-       if (seq_header)
- 	 {
-                                                             /* skip blanks */
--         for(; isspace(SEQS_Ptr->val[i]) && SEQS_Ptr->val[i] != '/n' && 
--               SEQS_Ptr->val[i] != '/0'; i++) ;
--         if (SEQS_Ptr->val[i] == '/n')      /* no name is found in line */
-+         for(; isspace(SEQS_Ptr->val[i]) && SEQS_Ptr->val[i] != '\n' &&
-+               SEQS_Ptr->val[i] != '\0'; i++) ;
-+         if (SEQS_Ptr->val[i] == '\n')      /* no name is found in line */
-              sprintf(block->sequences[block->num_sequences].name, 
-                      "%s%d", UNKNOWN_SEQ_NAME, block->num_sequences+1) ;
-          else
-                         /* copy first 20 chars or until a space is reached */
-          for(k=0; !(isspace(SEQS_Ptr->val[i])) && k<20 &&
--                  SEQS_Ptr->val[i] != '/n' ; i++, k++) 
-+                  SEQS_Ptr->val[i] != '\n' ; i++, k++)
-             block->sequences[block->num_sequences].name[k] = SEQS_Ptr->val[i];
- 
-                                                             /* end string */
-@@ -520,7 +520,7 @@ void make_block()
-          string[j] = '\0' ;
- 
-          if (block->max_sequences <= block->num_sequences+1) 
--            resize_block_sequences(block) ;
-+            fb_resize_block_sequences(block) ;
- 
- 	                                            /* process the sequence */
- 
-@@ -623,7 +623,7 @@ void make_block()
-             string[j] = '\0' ;
- 
-             if (block->max_sequences <= k) 
--               resize_block_sequences(block) ;
-+               fb_resize_block_sequences(block) ;
- 
-                                        /* copy up to first 20 chars of name */
-             strncpy(block->sequences[k].name,string,20) ;
-@@ -681,7 +681,7 @@ void make_block()
-                }
-             string[j] = '\0' ;
- 
--            if (block->max_sequences <= k+1) resize_block_sequences(block) ;
-+            if (block->max_sequences <= k+1) fb_resize_block_sequences(block) ;
- 
-             block->sequences[k].position = atoi(string) ;
- 
-@@ -703,7 +703,7 @@ void make_block()
- 
-                        /* check that actual number of sequences is equal to 
-                           what the user gave */
--    if (MA_SEQS_Ptr->val[0] != NULL && 
-+    if (MA_SEQS_Ptr->val[0] != 0 &&
-         block->num_sequences != atoi (MA_SEQS_Ptr->val))
-        {
-        printf("<H2>Warning</H2>\n");
-@@ -719,7 +719,7 @@ void make_block()
- 
-  /* get block header data */
- 
--    if (ID_Ptr->val[0] == NULL) 
-+    if (ID_Ptr->val[0] == 0)
-        strcpy(block->id, "None") ;
-     else
-        strncpy(block->id,ID_Ptr->val, SMALL_BUFF_LENGTH) ;
-@@ -727,7 +727,7 @@ void make_block()
-     strcat(block->id, "; BLOCK") ;
- 
- 
--    if (AC_Ptr->val[0] == NULL) 
-+    if (AC_Ptr->val[0] == 0)
-     {
-        strncpy(block->number, block->sequences[0].name, MAXAC) ;
-     }
-@@ -746,7 +746,7 @@ void make_block()
- 
-     strcpy(block->ac,block->number) ;
- 
--    if (MIN_DIST_Ptr->val[0] == NULL) 
-+    if (MIN_DIST_Ptr->val[0] == 0)
-        {
-        j = 10000 ;
-        for(i=0; i<block->num_sequences; i++) 
-@@ -758,7 +758,7 @@ void make_block()
-             block->ac, j) ;
- 
- 
--    if (MAX_DIST_Ptr->val[0] == NULL) 
-+    if (MAX_DIST_Ptr->val[0] == 0)
-        {
-        j = 0 ;
-        for(i=0; i<block->num_sequences; i++) 
-@@ -769,12 +769,12 @@ void make_block()
-     sprintf(block->ac, "%s,%d)",
-             block->ac, j) ;
-   
--    if (DE_Ptr->val[0] == NULL) 
-+    if (DE_Ptr->val[0] == 0)
-        strcpy(block->de, "None") ;
-     else
-        strncpy(block->de,DE_Ptr->val, SMALL_BUFF_LENGTH) ;
- 
--    if (MA_METH_Ptr->val[0] != NULL) 
-+    if (MA_METH_Ptr->val[0] != 0)
-        strncpy(block->bl,MA_METH_Ptr->val, SMALL_BUFF_LENGTH-25) ;
-     else
-        strcpy(block->bl,"Method unspecified") ;
-@@ -881,7 +881,7 @@ void display_output()
- }
- 
- 
--void main(int argc, char *argv[]) {
-+int main(int argc, char *argv[]) {
- 
-   printf("Content-type: text/html\n\n\n");
- 
-@@ -918,6 +918,6 @@ void main(int argc, char *argv[]) {
- 
-   clean_temp_files() ;
- 
--  exit(0) ;
-+  return(0) ;
- }
- 
---- a/blimps/htmlize-codehop.c
-+++ b/blimps/htmlize-codehop.c
-@@ -47,7 +47,7 @@ void insert_ohead();
- void condense();
- 
- /*======================================================================*/
--void main(argc, argv)
-+int main(argc, argv)
- int argc;
- char *argv[];
- {
-@@ -250,7 +250,7 @@ char *argv[];
-    printf("\n%d blocks, %d oligos processed\n", nblock, noligo);
- */
- 
--   exit(0);
-+   return(0);
- }  /* end of main */
- /*=========================================================================*/
- struct olist *make_olist()
---- a/blimps/htmlize-LAMA.c
-+++ b/blimps/htmlize-LAMA.c
-@@ -13,6 +13,7 @@
- 
- #include <stdlib.h>
- #include <stdio.h>
-+#include <string.h>
- 
- 
- #define TRUE 1
---- a/blimps/interpro.c
-+++ b/blimps/interpro.c
-@@ -94,7 +94,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of interpro xml file: ");
--      gets(iprfile);
-+      fgets(iprfile, MAXNAME, stdin);
-    }
-    if ( (fip=fopen(iprfile, "r")) == NULL)
-    {
-@@ -108,7 +108,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of interpro entry or all : ");
--      gets(iprname);
-+      fgets(iprname, MAXAC, stdin);
-    }
-    if (!strlen(iprname)) strcpy(iprname, "all");
-    All = NO;
---- a/blimps/LAMA.c
-+++ b/blimps/LAMA.c
-@@ -400,12 +400,12 @@ double *Z_cutoff ;
-    else                                   /* get input file(s) interactively */
-       {
-       printf("\nEnter name of a file with blocks or block matrices: ");
--      gets(bdbname[0]);
-+      fgets(bdbname[0], MAXNAME, stdin);
- 
-       printf("\nThe blocks/matrices in this file will be intercompared.\n");
-       printf("If you wish to compare them against blocks/matrices in\n");
-       printf("another file enter that file name (else just hit <ENTER>).\n");
--      gets(bdbname[1]);
-+      fgets(bdbname[1], MAXNAME, stdin);
- 
-       if (bdbname[1][0] == '\0') *inpfiles = 1 ;
-       else                       *inpfiles = 2 ;
-@@ -426,7 +426,7 @@ double *Z_cutoff ;
-    else
-       {
-       printf("\nEnter name of output file: ");
--      gets(outname);
-+      fgets(outname, MAXNAME, stdin);
-       }
- 
-    if ( (*out=fopen(outname, "w")) == NULL)
---- a/blimps/LAMA_search.c
-+++ b/blimps/LAMA_search.c
-@@ -281,7 +281,7 @@ void write_Qblock()
- 
- 
-   /* check that a block was specified */
--  if (Qblock_Ptr->val[0] == NULL) 
-+  if (Qblock_Ptr->val[0] == 0)
-     {
-       printf("<H1>Search Error</H1>\n");
-       printf("You need to enter a block to search with by writing or pasting a block in the query block window.<P>\n");
-@@ -296,7 +296,7 @@ void write_Qblock()
- 
- 
-   /* if block was pasted/written - */
--  if (Qblock_Ptr->val[0] != NULL)
-+  if (Qblock_Ptr->val[0] != 0)
-     {
-       
-       /* open up the block file to write to */
-@@ -579,7 +579,7 @@ void queue_to_mail()
-   /*    mail the person the results */
-   /*    NOTE: need to echo the header lines for the LAMA output :P */
-   /*    NOTE: all this should need to do is to cat the ouput file. */
--  sprintf(buf, "%s %s '(cat %s) | /usr/bin/mailx -s \"LAMA Results\" -r \"blocks\@fhcrc.org\" %s'", add_queue_entry, LAMA_queue, LAMA_output, Address_Ptr->val);
-+  sprintf(buf, "%s %s '(cat %s) | /usr/bin/mailx -s \"LAMA Results\" -r \"blocks at fhcrc.org\" %s'", add_queue_entry, LAMA_queue, LAMA_output, Address_Ptr->val);
-   system(buf);
-   
- 
-@@ -666,7 +666,7 @@ printf("%s=%d\n", buf, returnCode);
- 
- } /* end of run Cyrca */
- 
--void main(int argc, char *argv[]) {
-+int main(int argc, char *argv[]) {
- 
-   printf("Content-type: text/html\n\n\n");
- 
-@@ -715,5 +715,5 @@ void main(int argc, char *argv[]) {
- 
-   clean_temp_files() ;
- 
--  exit(0) ;
-+  return(0) ;
- }
---- a/blimps/lisblk.c
-+++ b/blimps/lisblk.c
-@@ -33,7 +33,7 @@ char Pros[FNAMELEN];
- char Title[MAXLINE];
- 
- /*======================================================================*/
--void main(argc, argv)
-+int main(argc, argv)
- int argc;
- char *argv[];
- {
-@@ -53,7 +53,7 @@ char *argv[];
-    else
-    {
-       printf("\nEnter name of file containing list of sequences: ");
--      gets(lisfile);
-+      fgets(lisfile, FNAMELEN, stdin);
-    }
-    if ( (flis=fopen(lisfile, "r")) == NULL)
-    {
-@@ -69,7 +69,7 @@ char *argv[];
-    else
-    {
-       printf("\nEnter name of block file: ");
--      gets(blkfile);
-+      fgets(blkfile, FNAMELEN, stdin);
-    }
- 
-    if ((fblk=fopen(blkfile, "r")) == NULL)
-@@ -85,7 +85,7 @@ char *argv[];
-       if ((fblk=fopen(blkfile, "r")) == NULL)
-       {
- 	    printf("\nEnter name of block file: ");
--	    gets(blkfile);
-+	    fgets(blkfile, FNAMELEN, stdin);
-       }
-    }
-    if (fblk == NULL)
-@@ -147,7 +147,7 @@ char *argv[];
-    fclose(fout);
- 
-    printf("\n");
--   exit(0);
-+   return(0);
- }  /*  end of main */
- /*================================================================*/
- int flag_ids(block, ids)
---- a/blimps/mablock.c
-+++ b/blimps/mablock.c
-@@ -102,7 +102,8 @@ int main(argc, argv)
- {
-    FILE *ifp, *bfp, *sfp;
-    Sequence *seqs[MAXSEQ];
--   char ctemp[MAXNAME], bdbname[MAXNAME], outtype[10], *ptr;
-+#define MABLOCK_OUTTYPELEN 10
-+   char ctemp[MAXNAME], bdbname[MAXNAME], outtype[MABLOCK_OUTTYPELEN], *ptr;
-    int db_type, seq_type, nseq, i, bflag, ftype;
-    struct blocks_list *blocks;
-    Block *block;
-@@ -127,7 +128,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets( bdbname, MAXNAME, stdin );
-    }
-    if ( (ifp=fopen(bdbname, "r")) == NULL)
-    {
-@@ -157,7 +158,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of output file: ");
--      gets(OutName);
-+      fgets( OutName, MAXNAME, stdin );
-    }
-    strcpy(ctemp, OutName); strcat(ctemp, ".blks");
-    if ( (bfp=fopen(ctemp, "w")) == NULL)
-@@ -177,7 +178,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter type of output file [B=blocks|F=fasta]: ");
--      gets(outtype);
-+      fgets( outtype, MABLOCK_OUTTYPELEN, stdin );
-    }
-    if (outtype[0] == 'F' || outtype[0] == 'f') ftype = 1;
- /* ------------4th arg = optional min trimming size--------------------*/
 --- a/blimps/Makefile.Linux
 +++ b/blimps/Makefile.Linux
 @@ -44,19 +44,25 @@
@@ -2481,410 +1521,6 @@ Description: * replaced gets() with fgets()
 -blk2mot.o: ../include/sequences.h ../include/matrix.h ../include/pattern.h
 -blk2mot.o: ../include/convert.h ../include/frequency.h ../include/files.h
 -blk2mot.o: ../include/protomat.h
---- a/blimps/makelogob.c
-+++ b/blimps/makelogob.c
-@@ -797,7 +797,7 @@ waveparam **w;
-     *w = NULL;
-     return;
-   }
--  *w = (waveparam *)Malloc(sizeof(waveparam));
-+  *w = (waveparam *)malloc(sizeof(waveparam));
-   p = *w;
-   while (!BUFEOF(afile->f)) {
-     fscanf(afile->f, "%c%*[^\n]", &p->extreme);
-@@ -831,7 +831,7 @@ waveparam **w;
-       }
-     }
-     if (!BUFEOF(afile->f)) {
--      p->next = (waveparam *)Malloc(sizeof(waveparam));
-+      p->next = (waveparam *)malloc(sizeof(waveparam));
-       p = p->next;
-     } else
-       p->next = NULL;
-@@ -2007,7 +2007,7 @@ strings **thestrings;
-     return;
-   }
- 
--  *thestrings = (strings *)Malloc(sizeof(strings));
-+  *thestrings = (strings *)malloc(sizeof(strings));
-   stringspot = *thestrings;
-   for (n = 1; n <= numberstrings; n++) {
-     if (BUFEOF(theplace->f)) {
-@@ -2023,7 +2023,7 @@ strings **thestrings;
-       halt();
-     }
-     if (n < numberstrings) {
--      stringspot->next = (strings *)Malloc(sizeof(strings));
-+      stringspot->next = (strings *)malloc(sizeof(strings));
-       stringspot = stringspot->next;
-     } else
-       stringspot->next = NULL;
---- a/blimps/matrix_logob.c
-+++ b/blimps/matrix_logob.c
-@@ -331,7 +331,7 @@ FILE  **bfp ;
-    else                               
-       {
-       printf("\nEnter name of BLOCK or MATRIX file: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-       }
- 
-    /*   Read stdin if the filename starts with '-'   */
-@@ -347,7 +347,7 @@ FILE  **bfp ;
-    else                                   /* get input file(s) interactively */
-       {
-       printf("\nEnter AC in %s or - to make logos for all: ", bdbname);
--      gets(blockAC);
-+      fgets(blockAC, MAXNAME, stdin);
-       }
- 
- /* ------------3rd arg = file name suffix ------------------------------JGH*/
-@@ -356,7 +356,7 @@ FILE  **bfp ;
-    else
-       {
-       printf("\nEnter file name suffix: ");
--      gets(suffix);
-+      fgets(suffix, MAXNAME, stdin);
-       printf("Logos will be written to logo.%s\n", suffix);
-       }
- 
-@@ -588,7 +588,7 @@ char *outname;
-       printf("     after viewing you can also choose to print,\n") ;
-       printf("   P to print logo (%s %s).)\n", PSprint, outname) ;
- 
--      gets(ans) ;
-+      fgets(ans, 2, stdin) ;
- 
-       switch (toupper(ans[0]))
- 	 {
---- a/blimps/narrow.c
-+++ b/blimps/narrow.c
-@@ -93,7 +93,7 @@ char *argv[];
-    else
-    {
-       printf("\nEnter type of input file (Block|Frequencies|Weights): ");
--      gets(ctemp);
-+      fgets(ctemp, 80, stdin);
-    }
-    if (ctemp[0] == 'F' || ctemp[0] == 'f') type = 1; 
-    else if (ctemp[0] == 'W' || ctemp[0] == 'w') type = 2; 
-@@ -104,7 +104,7 @@ char *argv[];
-    else
-    {
-       printf("\nEnter name of input file: ");
--      gets(chkname);
-+      fgets(chkname, 80, stdin);
-    }
-    if ( (chk=fopen(chkname, "r")) == NULL)
-    {
---- a/blimps/oligo_melt.c
-+++ b/blimps/oligo_melt.c
-@@ -75,7 +75,7 @@ int main(argc, argv)
-    else
-    {
-       printf("Enter name of file containing oligos: ");
--      gets(fname);
-+      fgets(fname, 80, stdin);
-    }
-    if (!strlen(fname) ) inpf = stdin;
-    else if ((inpf=fopen(fname, "r")) == NULL)
---- a/blimps/papssm.c
-+++ b/blimps/papssm.c
-@@ -163,7 +163,7 @@ struct steve {
- 
- int read_cf();
- int load_frequencies();
--double read_freq();
-+static double read_freq();
- void load_subst();
- double nrgamma();
- double addlogs();
-@@ -250,7 +250,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of configuration file: ");
--      gets(cfname);
-+      fgets(cfname, FNAMELEN, stdin);
-    }
-    if ( (cfp=fopen(cfname, "r")) == NULL)
-    {
---- a/blimps/prints2blocks.c
-+++ b/blimps/prints2blocks.c
-@@ -63,7 +63,7 @@ int main(argc, argv)
-       {
-       printf(
-        "\nEnter name of input file (Prints protein motifs database): ");
--      gets(inpfname);
-+      fgets(inpfname, MAXNAME, stdin);
-       }
- 
-    if ( (inpf=fopen(inpfname, "r")) == NULL)
---- a/blimps/protomat.c
-+++ b/blimps/protomat.c
-@@ -438,7 +438,8 @@ char *line;
- char *dir_unix(line)
- char *line;
- {
--   char tname[FNAMELEN], mem[MAXLINE], pros[FNAMELEN], *ptr;
-+   char tname[FNAMELEN], mem[MAXLINE], *ptr;
-+   static char pros[FNAMELEN];
-    int test;
-    DIR *dp;
- 
---- a/blimps/protxblk.c
-+++ b/blimps/protxblk.c
-@@ -37,7 +37,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
-@@ -50,7 +50,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of output file: ");
--      gets(conname);
-+      fgets(conname, MAXNAME, stdin);
-    }
-    if ( (ofp=fopen(conname, "w")) == NULL)
-    {
---- a/blimps/pssmBL.c
-+++ b/blimps/pssmBL.c
-@@ -29,7 +29,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of pssmdist.dat file: ");
--      gets(pssmname);
-+      fgets(pssmname, MAXNAME, stdin);
-    }
-    if ( (pfp=fopen(pssmname, "r")) == NULL)
-    {
-@@ -42,7 +42,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
-@@ -55,7 +55,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of new blocks database: ");
--      gets(conname);
-+      fgets(conname, MAXNAME, stdin);
-    }
-    if ( (ofp=fopen(conname, "a")) == NULL)
-    {
---- a/blimps/pssmdist.c
-+++ b/blimps/pssmdist.c
-@@ -81,7 +81,7 @@ struct score_struct {
- 
- int compute();
- int load_freqs();
--double read_a_freq();
-+static double read_a_freq();
- void fix_freqs();
- int count_tps();
- 
-@@ -113,7 +113,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of matrix database: ");
--      gets(mname);
-+      fgets(mname, MAXNAME, stdin);
-    }
-    if ( (mfp=fopen(mname, "r")) == NULL)
-    {
-@@ -126,7 +126,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of observed frequencies database: ");
--      gets(oname);
-+      fgets(oname, MAXNAME, stdin);
-    }
-    if ( (ofp=fopen(oname, "r")) == NULL)
-    {
-@@ -138,7 +138,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of frequency file: ");
--      gets(fname);
-+      fgets(fname, MAXNAME,stdin);
-    }
-    if ( (ffp=fopen(fname, "r")) == NULL)
-    {
-@@ -155,7 +155,7 @@ int main(argc, argv)
-    {
-       printf("\nEnter number of sequences in a typical search [%.0f]: ",
- 		 Search);
--      gets(ctemp);
-+      fgets(ctemp, MAXNAME, stdin);
-    }
-    if (strlen(ctemp)) Search = atof(ctemp);
- /* ------------5th arg = #aas in a search--------------------*/
-@@ -166,7 +166,7 @@ int main(argc, argv)
-    {
-       printf("\nEnter number of amino acids in a typical database [%.0f]: ",
- 		SearchAA);
--      gets(ctemp);
-+      fgets(ctemp, MAXNAME, stdin);
-    }
-    if (strlen(ctemp)) SearchAA = atof(ctemp);
-    printf ("Assuming %.0f sequences, %.0f amino acids in a search\n",
---- a/blimps/rank_matrix.c
-+++ b/blimps/rank_matrix.c
-@@ -39,7 +39,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of scoring matrix: ");
--      gets(matname);
-+      fgets(matname, MAXNAME, stdin);
-    }
-    if ( (fmat=fopen(matname, "r")) == NULL)
-    {
---- a/blimps/readchk.c
-+++ b/blimps/readchk.c
-@@ -20,7 +20,7 @@ char *argv[];
-    else
-    {
-       printf("\nEnter name of configuration file: ");
--      gets(chkname);
-+      fgets(chkname, 80, stdin);
-    }
-    if ( (chk=fopen(chkname, "r")) == NULL)
-    {
---- a/blimps/readmast.c
-+++ b/blimps/readmast.c
-@@ -26,7 +26,7 @@ char *argv[];
-    else
-    {
-       printf("\nEnter name of configuration file: ");
--      gets(chkname);
-+      fgets(chkname, 80, stdin);
-    }
-    if ( (chk=fopen(chkname, "r")) == NULL)
-    {
---- a/blimps/retblock.c
-+++ b/blimps/retblock.c
-@@ -50,7 +50,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
-@@ -66,7 +66,7 @@ int main(argc, argv)
-    {
-       strcpy(acname, "all");
-       printf("\nEnter AC of blocks to extract, or all [%s]: ", acname);
--      gets(acname);
-+      fgets(acname, MAXNAME, stdin);
-    }
-    if (strcasecmp(acname, "all") == 0) allflag = TRUE;
- 
---- a/blimps/sequences.c
-+++ b/blimps/sequences.c
-@@ -665,7 +665,7 @@ int read_sequence(seq, seq_type, start_p
-       stemp is a huge negative number ...
-   */
-   if (seq_type == AA_SEQ) {
--    while ( (c != NULL) && (c != '\0') && (num_seen < room_left) ) {
-+    while ( (c != 0) && (c != '\0') && (num_seen < room_left) ) {
-       stemp = aa_atob[c];
-       if (stemp < 0 || stemp > AAID_MAX) stemp = AAID_MAX + 1;
-       if ( stemp <= AAID_MAX ) {
-@@ -1201,7 +1201,7 @@ printf("\n");
-     }
-   }    
-   else {
--    printf("??) \t");
-+    printf("??"") \t");
- printf("\n");
-     for(k=0; k<seq->length; k++) {
-       printf("%c", aa_btoa[seq->sequence[k]]);
---- a/blimps/sortblk.c
-+++ b/blimps/sortblk.c
-@@ -58,7 +58,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of blocks database: ");
--      gets(bdbname);
-+      fgets(bdbname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(bdbname, "r")) == NULL)
-    {
-@@ -71,7 +71,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of new sorted blocks database: ");
--      gets(conname);
-+      fgets(conname, MAXNAME, stdin);
-    }
-    if ( (ofp=fopen(conname, "w")) == NULL)
-    {
---- a/blimps/translate.c
-+++ b/blimps/translate.c
-@@ -29,7 +29,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of sequence database: ");
--      gets(sname);
-+      fgets(sname, MAXNAME, stdin);
-    }
-    if ( (bfp=fopen(sname, "r")) == NULL)
-    {
-@@ -50,7 +50,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter name of new translated sequence database: ");
--      gets(outname);
-+      fgets(outname, MAXNAME, stdin);
-    }
-    if ( (ofp=fopen(outname, "w")) == NULL)
-    {
-@@ -62,7 +62,7 @@ int main(argc, argv)
-    else
-    {
-       printf("\nEnter translation frame: ");
--      gets(ctemp);
-+      fgets(ctemp, MAXNAME, stdin);
-       frame = atoi(ctemp);
-    }
-    if (frame == 0 || frame < -3 || frame > 3) frame = 1;
-@@ -74,7 +74,7 @@ int main(argc, argv)
-       for (code = 0; code < NUMBER_OF_GENETIC_CODES; code++)
-           printf("\n %d %s", code, gcodes[code].name);
-       printf("\nEnter genetic code: ");
--      gets(ctemp);
-+      fgets(ctemp, MAXNAME, stdin);
-       code = atoi(ctemp);
-    }
-    if (code < 0 || code > 8) code = 0;
---- a/blimps/util.c
-+++ b/blimps/util.c
-@@ -1,5 +1,6 @@
- #include <stdlib.h>
- #include <stdio.h>
-+#include <string.h>
- 
- #define LF 10
- #define CR 13
-@@ -92,7 +93,7 @@ int rind(char *s, char c) {
-     return -1;
- }
- 
--int getline(char *s, int n, FILE *f) {
-+int blimps_getline(char *s, int n, FILE *f) {
-     register int i=0;
- 
-     while(1) {
 --- a/protomat/Makefile.Linux
 +++ b/protomat/Makefile.Linux
 @@ -3,52 +3,65 @@
@@ -2979,7 +1615,7 @@ Description: * replaced gets() with fgets()
  		$(CC) $(CFLAGS) blksort.c
 --- /dev/null
 +++ b/Makefile
-@@ -0,0 +1,117 @@
+@@ -0,0 +1,106 @@
 +PACKAGE := blimps
 +VERSION := 3.9
 +DISTDIR := $(PACKAGE)-$(VERSION)
@@ -2989,14 +1625,11 @@ Description: * replaced gets() with fgets()
 +INCLUDEDIR := include
 +PROTOMATDIR := protomat
 +
-+MAN1POD := fastaseqs.pod
-+MAN1GZ := $(MAN1POD:%.pod=%.1.gz)
-+
 +libdir ?= $(prefix)/lib
 +
 +# export LD_LIBRARY_PATH=/mnt/home/lkajan/project/rostlab/blimps/blimps-3.9/blimps
 +
-+all: blimps protomat man
++all: blimps protomat
 +
 +blimps:
 +	$(MAKE) -C $(BLIMPSDIR) -f Makefile.Linux VERSION=$(VERSION)
@@ -3004,11 +1637,6 @@ Description: * replaced gets() with fgets()
 +protomat:
 +	$(MAKE) -C $(PROTOMATDIR) -f Makefile.Linux VERSION=$(VERSION)
 +
-+man:	$(MAN1GZ)
-+
-+$(MAN1GZ) : %.1.gz : %.pod
-+	pod2man -c 'User Commands' -r "$(VERSION)" $< | gzip -c > $@
-+
 +# The sift package does not provide fastaseqs but expects it to exist. Fortunately this package provides it.
 +install: install-utils install-lib-dev install-lib install-data install-doc
 +
@@ -3021,7 +1649,6 @@ Description: * replaced gets() with fgets()
 +	mkdir -p $(DESTDIR)$(prefix)/bin && \
 +		cp -a $(BLIMPSDIR)/fastaseqs \
 +			$(DESTDIR)$(prefix)/bin/
-+	mkdir -p $(DESTDIR)$(prefix)/share/man/man1 && cp $(MAN1GZ) $(DESTDIR)$(prefix)/share/man/man1/
 +
 +install-lib-dev:
 +	mkdir -p $(DESTDIR)$(prefix)/include/$(PACKAGE) && \
@@ -3069,7 +1696,6 @@ Description: * replaced gets() with fgets()
 +		ChangeLog \
 +		Makefile \
 +		$(PACKAGE).spec \
-+		$(MAN1POD) \
 +		$(DISTDIR)/;
 +
 +help:
@@ -3085,7 +1711,6 @@ Description: * replaced gets() with fgets()
 +	@echo "distclean"
 +	@echo "dist"
 +	@echo "help"
-+	@echo "*man"
 +	@echo "*protomat"
 +	@echo
 +	@echo "Variables:"
@@ -3094,34 +1719,6 @@ Description: * replaced gets() with fgets()
 +	@echo "libdir - install libraries here, default: /$$(prefix)/lib"
 +	@echo "  use prefix=$$HOME to build for personal use"
 +
-+.PHONY: all bin clean-blimps clean diff dist distclean distdir help install install-data install-lib install-lib-dev install-utils man untar blimps protomat clean-protomat
++.PHONY: all bin clean-blimps clean diff dist distclean distdir help install install-data install-lib install-lib-dev install-utils untar blimps protomat clean-protomat
 +
 +# vim:ai:
---- /dev/null
-+++ b/fastaseqs.pod
-@@ -0,0 +1,25 @@
-+=head1 NAME
-+
-+fastaseqs - converts a file of sequences to FASTA format
-+
-+=head1 SYNOPSIS
-+
-+fastaseqs <INPUTFILE> <OUTPUTFILE>
-+
-+=head1 DESCRIPTION
-+
-+fastaseqs converts a file of sequences to FASTA format.
-+
-+=head1 AUTHOR
-+
-+J. Henikoff
-+
-+=head1 COPYRIGHT AND LICENSE
-+
-+Copyright 1998, Fred Hutchinson Cancer Research Center
-+
-+Please refer to /usr/share/doc/*blimps*/copyright for the license.
-+
-+=head1 SEE ALSO
-+
-+L<http://blocks.fhcrc.org/blocks/uploads/blimps/>


=====================================
debian/patches/series
=====================================
@@ -1 +1,3 @@
-patch001
+gets.patch
+makefile.patch
+hardening.patch


=====================================
debian/rules
=====================================
@@ -3,6 +3,10 @@
 # In order to make dh verbose set this to 1:
 # export DH_VERBOSE=1
 
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all
+
+include /usr/share/dpkg/default.mk
+
 %:
 	dh $@
 
@@ -10,8 +14,11 @@ override_dh_auto_install:
 	dh_auto_install -- prefix=/usr
 	find debian/tmp -name LICENSE -delete
 
-override_dh_dwz:
-	echo "Optimization of DWARF debug information in ELF binaries via dwz does not work"
+#override_dh_dwz:
+#	echo "Optimization of DWARF debug information in ELF binaries via dwz does not work"
 
 override_dh_clean:
 	dh_clean blimps/deps.mk
+
+manpage:
+	pod2man -c 'User Commands' -r "$(DEB_VERSION_UPSTREAM)" debian/fastaseqs.pod > debian/fastaseqs.1



View it on GitLab: https://salsa.debian.org/med-team/blimps/compare/7839e5d98a0f842bb15c953189b6958a2c7b1ee8...c2b943620baa785ce8b67efaca68f3aff0ab5457

-- 
View it on GitLab: https://salsa.debian.org/med-team/blimps/compare/7839e5d98a0f842bb15c953189b6958a2c7b1ee8...c2b943620baa785ce8b67efaca68f3aff0ab5457
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190111/7b1578c0/attachment-0001.html>


More information about the debian-med-commit mailing list