Print this page
8485 Remove set but unused variables in usr/src/cmd
   1 /*
   2  * Copyright (C) 1993-2001 by Darren Reed.
   3  *
   4  * See the IPFILTER.LICENCE file for details on licencing.
   5  *
   6  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
   7  * Use is subject to license terms.

   8  */
   9 
  10 #pragma ident   "%Z%%M% %I%     %E% SMI"
  11 
  12 #if !defined(lint)
  13 static const char sccsid[] = "@(#)ip_fil.c      2.41 6/5/96 (C) 1993-2000 Darren Reed";
  14 static const char rcsid[] = "@(#)$Id: ipfcomp.c,v 1.24.2.2 2004/04/28 10:34:44 darrenr Exp $";
  15 #endif
  16 
  17 #include "ipf.h"
  18 
  19 
  20 typedef struct {
  21         int c;
  22         int e;
  23         int n;
  24         int p;
  25         int s;
  26 } mc_t;
  27 
  28 
  29 static char *portcmp[] = { "*", "==", "!=", "<", ">", "<=", ">=", "**", "***" };
  30 static int count = 0;
  31 


  52 #define FRC_TCP 8
  53 #define FRC_SP  9
  54 #define FRC_DP  10
  55 #define FRC_OPT 11
  56 #define FRC_SEC 12
  57 #define FRC_ATH 13
  58 #define FRC_ICT 14
  59 #define FRC_ICC 15
  60 #define FRC_MAX 16
  61 
  62 
  63 static  FILE    *cfile = NULL;
  64 
  65 /*
  66  * This is called once per filter rule being loaded to emit data structures
  67  * required.
  68  */
  69 void printc(fr)
  70 frentry_t *fr;
  71 {
  72         fripf_t *ipf;
  73         u_long *ulp;
  74         char *and;
  75         FILE *fp;
  76         int i;
  77 
  78         if (fr->fr_v != 4)
  79                 return;
  80         if ((fr->fr_type != FR_T_IPF) && (fr->fr_type != FR_T_NONE))
  81                 return;
  82         if ((fr->fr_type == FR_T_IPF) &&
  83             ((fr->fr_datype != FRI_NORMAL) || (fr->fr_satype != FRI_NORMAL)))
  84                 return;
  85         ipf = fr->fr_ipf;
  86 
  87         if (cfile == NULL)
  88                 cfile = fopen("ip_rules.c", "w");
  89         if (cfile == NULL)
  90                 return;
  91         fp = cfile;
  92         if (count == 0) {
  93                 fprintf(fp, "/*\n");
  94                 fprintf(fp, "* Copyright (C) 1993-2000 by Darren Reed.\n");
  95                 fprintf(fp, "*\n");
  96                 fprintf(fp, "* Redistribution and use in source and binary forms are permitted\n");
  97                 fprintf(fp, "* provided that this notice is preserved and due credit is given\n");
  98                 fprintf(fp, "* to the original author and the contributors.\n");
  99                 fprintf(fp, "*/\n\n");
 100 
 101                 fprintf(fp, "#include <sys/types.h>\n");
 102                 fprintf(fp, "#include <sys/time.h>\n");
 103                 fprintf(fp, "#include <sys/socket.h>\n");
 104                 fprintf(fp, "#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__sgi)\n");
 105                 fprintf(fp, "# include <sys/systm.h>\n");


   1 /*
   2  * Copyright (C) 1993-2001 by Darren Reed.
   3  *
   4  * See the IPFILTER.LICENCE file for details on licencing.
   5  *
   6  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
   7  * Use is subject to license terms.
   8  * Copyright 2017 Gary Mills
   9  */
  10 


  11 #if !defined(lint)
  12 static const char sccsid[] = "@(#)ip_fil.c      2.41 6/5/96 (C) 1993-2000 Darren Reed";
  13 static const char rcsid[] = "@(#)$Id: ipfcomp.c,v 1.24.2.2 2004/04/28 10:34:44 darrenr Exp $";
  14 #endif
  15 
  16 #include "ipf.h"
  17 
  18 
  19 typedef struct {
  20         int c;
  21         int e;
  22         int n;
  23         int p;
  24         int s;
  25 } mc_t;
  26 
  27 
  28 static char *portcmp[] = { "*", "==", "!=", "<", ">", "<=", ">=", "**", "***" };
  29 static int count = 0;
  30 


  51 #define FRC_TCP 8
  52 #define FRC_SP  9
  53 #define FRC_DP  10
  54 #define FRC_OPT 11
  55 #define FRC_SEC 12
  56 #define FRC_ATH 13
  57 #define FRC_ICT 14
  58 #define FRC_ICC 15
  59 #define FRC_MAX 16
  60 
  61 
  62 static  FILE    *cfile = NULL;
  63 
  64 /*
  65  * This is called once per filter rule being loaded to emit data structures
  66  * required.
  67  */
  68 void printc(fr)
  69 frentry_t *fr;
  70 {

  71         u_long *ulp;
  72         char *and;
  73         FILE *fp;
  74         int i;
  75 
  76         if (fr->fr_v != 4)
  77                 return;
  78         if ((fr->fr_type != FR_T_IPF) && (fr->fr_type != FR_T_NONE))
  79                 return;
  80         if ((fr->fr_type == FR_T_IPF) &&
  81             ((fr->fr_datype != FRI_NORMAL) || (fr->fr_satype != FRI_NORMAL)))
  82                 return;

  83 
  84         if (cfile == NULL)
  85                 cfile = fopen("ip_rules.c", "w");
  86         if (cfile == NULL)
  87                 return;
  88         fp = cfile;
  89         if (count == 0) {
  90                 fprintf(fp, "/*\n");
  91                 fprintf(fp, "* Copyright (C) 1993-2000 by Darren Reed.\n");
  92                 fprintf(fp, "*\n");
  93                 fprintf(fp, "* Redistribution and use in source and binary forms are permitted\n");
  94                 fprintf(fp, "* provided that this notice is preserved and due credit is given\n");
  95                 fprintf(fp, "* to the original author and the contributors.\n");
  96                 fprintf(fp, "*/\n\n");
  97 
  98                 fprintf(fp, "#include <sys/types.h>\n");
  99                 fprintf(fp, "#include <sys/time.h>\n");
 100                 fprintf(fp, "#include <sys/socket.h>\n");
 101                 fprintf(fp, "#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__sgi)\n");
 102                 fprintf(fp, "# include <sys/systm.h>\n");