~ubuntu-branches/ubuntu/dapper/flow-tools/dapper

« back to all changes in this revision

Viewing changes to src/flow-nfilter.c

  • Committer: Bazaar Package Importer
  • Author(s): Radu Spineanu
  • Date: 2005-06-02 20:12:57 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050602201257-jv0qdk3hjhpdf04b
Tags: 1:0.68-2
Fixed a bashism in init script (closes: #311568)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
24
 * SUCH DAMAGE.
25
25
 *
26
 
 *      $Id: flow-nfilter.c,v 1.6 2003/04/02 18:03:02 maf Exp $
 
26
 *      $Id: flow-nfilter.c,v 1.7 2004/01/05 17:57:18 maf Exp $
27
27
 */
28
28
 
29
29
#include "ftconfig.h"
57
57
  struct ftver ftv_in, ftv_out;
58
58
  struct ftset ftset;
59
59
  struct fts3rec_offsets fo;
 
60
  struct ftvar ftvar;
60
61
  char *rec;
61
62
  char *fname, *dname;
62
63
  u_int32 total_flows, cap_start, cap_end;
68
69
 
69
70
  bzero(&ftv_in, sizeof ftv_in);
70
71
  bzero(&ftv_out, sizeof ftv_out);
 
72
  bzero(&ftvar, sizeof ftvar);
71
73
  total_flows = 0;
72
74
 
 
75
  /* init var binding */
 
76
  if (ftvar_new(&ftvar) < 0)
 
77
    fterr_errx(1, "ftvar_new(): failed");
 
78
 
73
79
  fname = FT_PATH_CFG_FILTER;
74
80
  dname = "default";
75
81
 
78
84
  /* defaults + no compression */
79
85
  ftset_init(&ftset, 0);
80
86
 
81
 
  while ((i = getopt(argc, argv, "b:C:d:h?f:F:kz:")) != -1)
 
87
  while ((i = getopt(argc, argv, "b:C:d:f:F:h?kv:z:")) != -1)
82
88
 
83
89
    switch (i) {
84
90
 
111
117
      keep_input_time = 1;
112
118
      break;
113
119
 
 
120
    case 'v': /* variable */
 
121
      if (ftvar_pset(&ftvar, optarg) < 0)
 
122
        fterr_errx(1, "ftvar_pset(%s): failed", optarg);
 
123
      break;
 
124
 
114
125
    case 'z': /* compress level */
115
126
      ftset.z_level = atoi(optarg);
116
127
      if ((ftset.z_level < 0) || (ftset.z_level > 9))
130
141
    fterr_errx(1, "Extra arguments starting with %s.", argv[optind]);
131
142
 
132
143
  /* initialize and load filters */
133
 
  if (ftfil_load(&ftfil, fname))
 
144
  if (ftfil_load(&ftfil, &ftvar, fname))
134
145
    fterr_errx(1, "ftfil_load(): failed");
135
146
 
136
147
  if (!(ftfd = ftfil_def_find(&ftfil, dname))) 
210
221
 
211
222
  ftfil_free(&ftfil);
212
223
 
 
224
  ftvar_free(&ftvar);
 
225
 
213
226
  if (debug > 0) {
214
227
    ftprof_end (&ftp, total_flows);
215
228
    ftprof_print(&ftp, argv[0], stderr);