Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Now compiler friendly, typo free!

  • Loading branch information...
commit 1fac0f79e31cd1c47becc5120e329b432e21a8aa 1 parent 0406018
@msantos authored
Showing with 13 additions and 10 deletions.
  1. +7 −8 c_src/epcap.c
  2. +1 −1  src/epcap_net.erl
  3. +5 −1 src/sniff.erl
View
15 c_src/epcap.c
@@ -86,12 +86,7 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;
- if (argc == 1) {
- IS_NULL(ep->filt = strdup(argv[0]));
- }
- else {
- IS_NULL(ep->filt = strdup(EPCAP_FILTER));
- }
+ IS_NULL(ep->filt = strdup( (argc == 1) ? argv[0] : EPCAP_FILTER));
IS_NULL(ep->p = epcap_open(ep->dev, ep->promisc));
if (epcap_priv_drop(ep) != 0)
@@ -149,6 +144,7 @@ epcap_open(char *dev, int promisc)
return (p);
}
+
int
epcap_init(EPCAP_STATE *ep)
{
@@ -180,6 +176,7 @@ epcap_init(EPCAP_STATE *ep)
}
+
void
epcap_loop(pcap_t *p)
{
@@ -195,6 +192,7 @@ epcap_loop(pcap_t *p)
}
}
+
void
epcap_response(const u_char *pkt, struct pcap_pkthdr *hdr)
{
@@ -239,11 +237,12 @@ usage(EPCAP_STATE *ep)
{
(void)fprintf(stderr, "%s, %s\n", __progname, EPCAP_VERSION);
(void)fprintf(stderr,
- "usage: epcap <options>\n"
+ "usage: %s <options>\n"
" -d <directory> chroot directory\n"
" -g <group> unprivileged group\n"
" -u <user> unprivileged user\n"
- " -v display debuggin info\n"
+ " -v verbose mode\n",
+ __progname
);
exit (EXIT_FAILURE);
View
2  src/epcap_net.erl
@@ -42,7 +42,7 @@
ether_addr/1,
icmp/1,
ipv4/1,
- payload/1
+ payload/1,
tcp/1,
tcp_flags/1,
udp/1
View
6 src/sniff.erl
@@ -48,7 +48,11 @@ loop() ->
P -> dump(Time, P)
catch
error:Error ->
- io:format("~s *** Error decoding packet (~p) ***~n~p~n", [timestamp(Time), Error, Packet])
+ io:format("~s *** Error decoding packet ***~n~p~n~p~n~p~n", [
+ timestamp(Time),
+ Error,
+ erlang:get_stacktrace(),
+ Packet])
end,
loop();
stop ->
Please sign in to comment.
Something went wrong with that request. Please try again.