Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Make POSIX compatible #4

merged 1 commit into from Dec 11, 2011


None yet
2 participants

theomega commented Dec 11, 2011

The current version does not compile without errors:

cc src/watch.c -std=c99 -o watch
src/watch.c: In function ‘mssleep’:
src/watch.c:76:3: warning: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration]

This comes from the fact that usleep is not specified on clean C but in POSIX instead. But furthermore, usleep is deprecated in POSIX, see man usleep:

4.3BSD, POSIX.1-2001. POSIX.1-2001 declares this function obsolete; use nanosleep(2) instead. POSIX.1-2008 removes the specification of usleep().

The attached patch changes the following things:

  • Turns warnings into errors
  • Specifies that this code can only run on POSIX-Systems
  • Uses nanosleep instead of usleep

@tj tj merged commit 1771f61 into tj:master Dec 11, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment