--- tethereal.c.ori 2006-07-08 14:31:50.000000000 +0200 +++ tethereal.c 2006-07-10 13:33:33.000000000 +0200 @@ -261,6 +261,7 @@ fprintf(output, "\n"); fprintf(output, "Processing:\n"); fprintf(output, " -R packet filter in Ethereal display filter syntax\n"); + fprintf(output, " -A file Use file as input for the Ethereal display filter syntax\n"); fprintf(output, " -n disable all name resolutions (def: all enabled)\n"); fprintf(output, " -N enable specific name resolution(s): \"mntC\"\n"); fprintf(output, " -d %s ...\n", decode_as_arg_template); @@ -693,8 +694,9 @@ char badopt; GLogLevelFlags log_flags; int status; + FILE *fp; -#define OPTSTRING_INIT "a:b:c:d:Df:F:hi:lLnN:o:pqr:R:s:St:T:vVw:xX:y:z:" +#define OPTSTRING_INIT "a:b:c:d:Df:F:hi:lLnN:o:pqr:A:R:s:St:T:vVw:xX:y:z:" #ifdef HAVE_LIBPCAP #ifdef _WIN32 #define OPTSTRING_WIN32 "B:" @@ -990,6 +992,16 @@ case 'R': /* Read file filter */ rfilter = optarg; break; + case 'A': /* Read file filter syntax */ + fp = fopen(g_strdup(optarg), "r"); + if (! fp) + cmdarg_err("file not found: %s", optarg); + exit(1); + char line[256]; + fgets(line, sizeof(line), fp); + cmdarg_err("load filter= %s", line); + fclose(fp); + rfilter = line; + break; case 'S': /* show packets in real time */ print_packet_info = TRUE; break;