Initial test file, moved gitignore.
This commit is contained in:
parent
653157b927
commit
b41e84e259
3 changed files with 62 additions and 0 deletions
0
.gitignore/.gitignore → .gitignore
vendored
0
.gitignore/.gitignore → .gitignore
vendored
32
.gitignore_copy/.gitignore
vendored
Normal file
32
.gitignore_copy/.gitignore
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
30
set_device.cpp
Normal file
30
set_device.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <stdio.h>
|
||||
#include <pcap.h>
|
||||
|
||||
// Naive, implies the user will pass in and consequently
|
||||
// know what the device name is.
|
||||
|
||||
/*
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *dev = argv[1];
|
||||
|
||||
printf("Device: %s\n", dev);
|
||||
return(0);
|
||||
}
|
||||
*/
|
||||
|
||||
// In this way, the program detects the device to use on its own.
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char *dev, errbuf[PCAP_ERRBUF_SIZE];
|
||||
|
||||
dev = pcap_lookupdev(errbuf);
|
||||
if (dev == NULL) {
|
||||
fprintf(stderr, "Couldn't find default device: %s\n", errbuf);
|
||||
return(2);
|
||||
}
|
||||
printf("Device: %s\n", dev);
|
||||
return(0);
|
||||
}
|
Reference in a new issue