printuid: fix uid_t decoding on 64-bit architectures

It was not a good idea to treat uid_t as a long int type because
the latter is twice larger than uid_t on 64-bit architectures.

* defs.h (printuid): Change uid argument type from "unsigned long"
to "unsigned int".
* util.c (printuid): Likewise.  When uid equals to -1, print "-1".
* tests/uid.awk: New file.
* tests/uid.c: New file.
* tests/uid32.c: Likewise.
* tests/uid.test: New test.
* tests/uid32.test: Likewise.
* tests/Makefile.am (CHECK_PROGRAMS): Add uid and uid32.
(TESTS): Add uid.test and uid32.test.
(EXTRA_DIST): Add uid.awk.
* tests/.gitignore: Add uid and uid32.
diff --git a/tests/uid.test b/tests/uid.test
new file mode 100755
index 0000000..02fea2a
--- /dev/null
+++ b/tests/uid.test
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# Check uid decoding.
+
+. "${srcdir=.}/init.sh"
+
+check_prog awk
+
+s="${uid_syscall_suffix-}"
+w="${uid_t_size-}"
+uid="uid$s$w"
+./"$uid" || {
+	if [ $? -eq 77 ]; then
+		framework_skip_ "some uid$s or uid${w}_t syscalls are not available"
+	else
+		fail_ "$uid failed"
+	fi
+}
+
+syscalls="getuid$s,setuid$s,getresuid$s,setreuid$s,setresuid$s,chown$s"
+args="-e trace=$syscalls"
+$STRACE -o "$LOG" $args ./"$uid"|| {
+	cat "$LOG"
+	fail_ "$STRACE $args ./$uid failed"
+}
+
+awk -f "$srcdir"/uid.awk -v suffix="$s" "$LOG" || {
+	cat "$LOG"
+	fail_ 'unexpected output'
+}
+
+exit 0