File: lu.c

package info (click to toggle)
mailutils 1%3A3.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 31,424 kB
  • ctags: 17,698
  • sloc: ansic: 165,737; sh: 77,655; yacc: 6,304; cpp: 3,827; makefile: 3,019; lex: 2,053; python: 1,652; exp: 1,272; lisp: 782; awk: 200; sed: 31
file content (31 lines) | stat: -rw-r--r-- 907 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* This file is part of GNU Mailutils test suite.
   Copyright (C) 2012, 2014-2016 Free Software Foundation, Inc.

   This file is free software; as a special exception the author gives
   unlimited permission to copy and/or distribute it, with or without
   modifications.

   This file is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/  
#include <sys/types.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>

/* List all user names.  With a single numeric argument, list users with UID
   greater than that argument. */
int
main (int argc, char **argv)
{
	struct passwd *pw;
	int minuid = 0;
	
	if (argc == 2)
		minuid = atoi (argv[1]);
	while ((pw = getpwent ()))
		if (pw->pw_uid > minuid)
			printf ("%s\n", pw->pw_name);
	return 0;
}