Initial test file, moved gitignore.

This commit is contained in:
Alex Huddleston 2018-01-30 09:38:11 -06:00
parent 653157b927
commit b41e84e259
3 changed files with 62 additions and 0 deletions

View file

32
.gitignore_copy/.gitignore vendored Normal file
View 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
View 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);
}