bb2d391712fb0208347ffc0b88abe146df14dc0a
galt
  Fri Jun 21 18:21:50 2019 -0700
Adding Support for CIDR specification of subnets, e.g. 192.168.1.255/31. It still supports the older subnet format too, e.g. 192.168

diff --git src/blatz/server.c src/blatz/server.c
index faf2221..57c2997 100644
--- src/blatz/server.c
+++ src/blatz/server.c
@@ -8,49 +8,50 @@
 #include "dnaseq.h"
 #include "chain.h"
 #include "obscure.h"
 #include "fa.h"
 #include "dnaLoad.h"
 #include "log.h"
 #include "net.h"
 #include "portable.h"
 #include "bzp.h"
 #include "blatz.h"
 #include <sys/wait.h>
 
 int port = bzpDefaultPort;
 int cpuCount = 2;
 char *host = "localhost";
-unsigned char subnet[4] = {255,255,255,255};
+
+struct cidr *subnet = NULL;
 
 void usage()
 /* Explain usage and exit. */
 {
 struct bzp *bzp = bzpDefault();
 printf("blatzServer version %d - Set up in-memory server for\n", bzpVersion());
 printf("cross-species DNA alignments\n");
 printf("usage:\n");
 printf("   blatzServer start file(s)\n");
 printf("Starts up server. Files are either fasta files, nib files, 2bit files\n");
 printf("or text files containing the names of the above files one per line.\n");
 printf("It's important that the sequence be repeat masked with repeats in\n");
 printf("lower case.\n");
 printf("Options: (defaults are shown for numerical parameters)\n");
 bzpServerOptionsHelp(bzp);
 bzpClientOptionsHelp(bzp);
 printf("  -debug Writes diagnostic output to console and no daemon fork\n");
-printf("  -subnet=255.255.255.255 Restrict access to subnet\n");
+printf("  -subnet=255.255.255.255 Restrict access to subnet. Also supports CIDR notation, e.g. 255.255.255.255/24\n");
 printf("  -port=%d Use specified TCP/IP port\n", bzpDefaultPort);
 printf("  -host=%s Query specified host\n", host);
 printf("  -cpu=%d Use specified number of CPUs (processes)\n", cpuCount);
 printf("Other uses:\n");
 printf("   blatzServer stop\n");
 printf("      this terminates server\n");
 printf("   blatzServer status\n");
 printf("      this prints status info including version\n");
 noWarnAbort();
 }
 
 static struct optionSpec options[] = {
    BZP_SERVER_OPTIONS
    BZP_CLIENT_OPTIONS
    {"debug", OPTION_BOOLEAN},
@@ -302,31 +303,31 @@
 netSendString(sd, "status");
 f = netFileFromSocket(sd);
 copyOpenFile(f, stdout);
 }
 
 int main(int argc, char *argv[])
 /* Process command line. */
 {
 char *command;
 bzpTime(NULL);
 dnaUtilOpen();
 setMaxAlloc(2LL*1024LL*1024LL*1024LL);
 optionInit(&argc, argv, options);
 port = optionInt("port", port);
 host = optionVal("host", host);
-netParseSubnet(optionVal("subnet", NULL), subnet);
+subnet = internetParseSubnetCidr(optionVal("subnet", NULL));
 cpuCount = optionInt("cpu", cpuCount);
 if (argc < 2)
     usage();
 command = argv[1];
 if (sameWord(command, "start"))
     {
     if (argc < 3)
         usage();
     serverStart(argv+2, argc-2);
     }
 else if (sameWord(command, "stop"))
     {
     serverStop();
     }
 else if (sameWord(command, "status"))