fix randstring bug
don't define _XOPEN_SOURCE for NetBSD

on NetBSD, defining _XOPEN_SOURCE hides extensions
like inet_aton, strcasecmp, etc.
rename popcount to popcount_binary to avoid a conflict with NetBSD libc

NetBSD-current's libc has a function named popcount.
hiding these extensions using feature macros is not possible because
redis uses other extensions covered by the same feature macro.
eg. inet_aton
use nanosleep instead of usleep

SUSv3 says that:
	The useconds argument shall be less than one million. If the value of
	useconds is 0, then the call has no effect.
and actually NetBSD's implementation rejects such a value with EINVAL.
use nanosleep which has no such a limitation instead.
don't assume time_t == long

time_t is always 64bit on recent versions of NetBSD.
PUBSUB command implemented.

Currently it implements three subcommands:

PUBSUB CHANNELS [<pattern>]    List channels with non-zero subscribers.
PUBSUB NUMSUB [channel_1 ...]  List number of subscribers for channels.
PUBSUB NUMPAT                  Return number of subscribed patterns.
Allow PUBSUB NUMSUB without channels.

The result is an empty list but it is handy to call it programmatically.
Initialize char* to NULL to remove compiler warning
Merge pull request #1167 from badboy/patch-1

Initialize char* to NULL to remove compiler warning
New API to force propagation.

The old REDIS_CMD_FORCE_REPLICATION flag was removed from the
implementation of Redis, now there is a new API to force specific
executions of a command to be propagated to AOF / Replication link:

    void forceCommandPropagation(int flags);

The new API is also compatible with Lua scripting, so a script that will
execute commands that are forced to be propagated, will also be
propagated itself accordingly even if no change to data is operated.

As a side effect, this new design fixes the issue with scripts not able
to propagate PUBLISH to slaves (issue #873).
Replication of scripts as EVALSHA: sha1 caching implemented.

This code is only responsible to take an LRU-evicted fixed length cache
of SHA1 that we are sure all the slaves received.

In this commit only the implementation is provided, but the Redis core
does not use it to actually send EVALSHA to slaves when possible.
Use the RSC to replicate EVALSHA unmodified.

This commit uses the Replication Script Cache in order to avoid
translating EVALSHA into EVAL whenever possible for both the AOF and
slaves.
Move Replication Script Cache initialization in safer place.

It should be called just one time at startup and not every time the Lua
scripting engine is re-initialized, otherwise memory is leaked.
SCRIPT FLUSH comment minor pedantic improvement.
Force propagation of SCRIPT LOAD to AOF.
Test: replication-3 test speedup in master-slave setup.
Test: randomInt() behavior commented.
Test: EVALSHA replication.
Flush the replication script cache after SCRIPT FLUSH.
Test: add some AOF testing to EVALSHA replication test.