changed _BSD_SOURCE to _DEFAULT_SOURCE and added include guards

Signed-off-by: Alexander Skjolden <alex@plastboks.net>