File: last_pw_errno_test.c

package info (click to toggle)
libnss-cache 0.22-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 212 kB
  • sloc: ansic: 1,701; makefile: 137; sh: 38
file content (18 lines) | stat: -rw-r--r-- 312 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <errno.h>
#include <pwd.h>
#include <stdio.h>
#include <sys/types.h>

int main(int argc, char **argv) {
  setpwent();
  for (;;) {
    errno = 0;
    struct passwd *pw = getpwent();
    if (!pw) {
      if (errno != 0) printf("ERRNO: %u %m\n", errno);
      break;
    }
  }
  endpwent();
  return 0;
}