Mon Aug 29 14:08:39 2011 UTC ()
static + __dead


(joerg)
diff -r1.33 -r1.34 src/usr.bin/chpass/chpass.c
diff -r1.12 -r1.13 src/usr.bin/chpass/chpass.h

cvs diff -r1.33 -r1.34 src/usr.bin/chpass/chpass.c (expand / switch to unified diff)

--- src/usr.bin/chpass/chpass.c 2008/07/21 14:19:21 1.33
+++ src/usr.bin/chpass/chpass.c 2011/08/29 14:08:39 1.34
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: chpass.c,v 1.33 2008/07/21 14:19:21 lukem Exp $ */ 1/* $NetBSD: chpass.c,v 1.34 2011/08/29 14:08:39 joerg Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1988, 1993, 1994 4 * Copyright (c) 1988, 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34__COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\ 34__COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\
35 The Regents of the University of California. All rights reserved."); 35 The Regents of the University of California. All rights reserved.");
36#endif /* not lint */ 36#endif /* not lint */
37 37
38#ifndef lint 38#ifndef lint
39#if 0 39#if 0
40static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94"; 40static char sccsid[] = "@(#)chpass.c 8.4 (Berkeley) 4/2/94";
41#else  41#else
42__RCSID("$NetBSD: chpass.c,v 1.33 2008/07/21 14:19:21 lukem Exp $"); 42__RCSID("$NetBSD: chpass.c,v 1.34 2011/08/29 14:08:39 joerg Exp $");
43#endif 43#endif
44#endif /* not lint */ 44#endif /* not lint */
45 45
46#include <sys/param.h> 46#include <sys/param.h>
47#include <sys/stat.h> 47#include <sys/stat.h>
48#include <sys/time.h> 48#include <sys/time.h>
49#include <sys/resource.h> 49#include <sys/resource.h>
50 50
51#include <ctype.h> 51#include <ctype.h>
52#include <err.h> 52#include <err.h>
53#include <errno.h> 53#include <errno.h>
54#include <fcntl.h> 54#include <fcntl.h>
55#include <pwd.h> 55#include <pwd.h>
@@ -63,29 +63,29 @@ __RCSID("$NetBSD: chpass.c,v 1.33 2008/0 @@ -63,29 +63,29 @@ __RCSID("$NetBSD: chpass.c,v 1.33 2008/0
63#include "chpass.h" 63#include "chpass.h"
64#include "pathnames.h" 64#include "pathnames.h"
65 65
66static char tempname[] = "/tmp/pw.XXXXXX"; 66static char tempname[] = "/tmp/pw.XXXXXX";
67uid_t uid; 67uid_t uid;
68int use_yp; 68int use_yp;
69 69
70void (*Pw_error)(const char *, int, int); 70void (*Pw_error)(const char *, int, int);
71 71
72#ifdef YP 72#ifdef YP
73extern int _yp_check(char **); /* buried deep inside libc */ 73extern int _yp_check(char **); /* buried deep inside libc */
74#endif 74#endif
75 75
76void baduser(void); 76__dead static void baduser(void);
77void cleanup(void); 77static void cleanup(void);
78void usage(void); 78__dead static void usage(void);
79 79
80int 80int
81main(int argc, char **argv) 81main(int argc, char **argv)
82{ 82{
83 enum { NEWSH, LOADENTRY, EDITENTRY } op; 83 enum { NEWSH, LOADENTRY, EDITENTRY } op;
84 struct passwd *pw, lpw, old_pw; 84 struct passwd *pw, lpw, old_pw;
85 int ch, dfd, pfd, tfd; 85 int ch, dfd, pfd, tfd;
86#ifdef YP 86#ifdef YP
87 int yflag = 0; 87 int yflag = 0;
88#endif 88#endif
89 char *arg, *username = NULL; 89 char *arg, *username = NULL;
90 90
91#ifdef __GNUC__ 91#ifdef __GNUC__
@@ -280,37 +280,37 @@ main(int argc, char **argv) @@ -280,37 +280,37 @@ main(int argc, char **argv)
280 /* Copy the passwd file to the lock file, updating pw. */ 280 /* Copy the passwd file to the lock file, updating pw. */
281 pw_copy(pfd, tfd, pw, (op == LOADENTRY) ? NULL : &old_pw); 281 pw_copy(pfd, tfd, pw, (op == LOADENTRY) ? NULL : &old_pw);
282 282
283 close(pfd); 283 close(pfd);
284 close(tfd); 284 close(tfd);
285 285
286 /* Now finish the passwd file update. */ 286 /* Now finish the passwd file update. */
287 if (pw_mkdb(username, 0) < 0) 287 if (pw_mkdb(username, 0) < 0)
288 pw_error(NULL, 0, 1); 288 pw_error(NULL, 0, 1);
289 289
290 exit(0); 290 exit(0);
291} 291}
292 292
293void 293static void
294baduser(void) 294baduser(void)
295{ 295{
296 296
297 errx(1, "%s", strerror(EACCES)); 297 errx(1, "%s", strerror(EACCES));
298} 298}
299 299
300void 300static void
301usage(void) 301usage(void)
302{ 302{
303 303
304 (void)fprintf(stderr, 304 (void)fprintf(stderr,
305 "usage: %s [-a list] [-s shell] [-l] [user]\n" 305 "usage: %s [-a list] [-s shell] [-l] [user]\n"
306 " %s [-a list] [-s shell] [-y] [user]\n", 306 " %s [-a list] [-s shell] [-y] [user]\n",
307 getprogname(), getprogname()); 307 getprogname(), getprogname());
308 exit(1); 308 exit(1);
309} 309}
310 310
311void 311static void
312cleanup(void) 312cleanup(void)
313{ 313{
314 314
315 (void)unlink(tempname); 315 (void)unlink(tempname);
316} 316}

cvs diff -r1.12 -r1.13 src/usr.bin/chpass/chpass.h (expand / switch to unified diff)

--- src/usr.bin/chpass/chpass.h 2005/02/17 17:09:48 1.12
+++ src/usr.bin/chpass/chpass.h 2011/08/29 14:08:39 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: chpass.h,v 1.12 2005/02/17 17:09:48 xtraeme Exp $ */ 1/* $NetBSD: chpass.h,v 1.13 2011/08/29 14:08:39 joerg Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1988, 1993, 1994 4 * Copyright (c) 1988, 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -62,20 +62,20 @@ int p_expire(const char *, struct passw @@ -62,20 +62,20 @@ int p_expire(const char *, struct passw
62int p_gecos(const char *, struct passwd *, ENTRY *); 62int p_gecos(const char *, struct passwd *, ENTRY *);
63int p_gid(const char *, struct passwd *, ENTRY *); 63int p_gid(const char *, struct passwd *, ENTRY *);
64int p_hdir(const char *, struct passwd *, ENTRY *); 64int p_hdir(const char *, struct passwd *, ENTRY *);
65int p_login(const char *, struct passwd *, ENTRY *); 65int p_login(const char *, struct passwd *, ENTRY *);
66int p_passwd(const char *, struct passwd *, ENTRY *); 66int p_passwd(const char *, struct passwd *, ENTRY *);
67int p_shell(const char *, struct passwd *, ENTRY *); 67int p_shell(const char *, struct passwd *, ENTRY *);
68int p_uid(const char *, struct passwd *, ENTRY *); 68int p_uid(const char *, struct passwd *, ENTRY *);
69char *ttoa(char *, size_t, time_t); 69char *ttoa(char *, size_t, time_t);
70int verify(char *, struct passwd *); 70int verify(char *, struct passwd *);
71 71
72#ifdef YP 72#ifdef YP
73int check_yppasswdd(void); 73int check_yppasswdd(void);
74int pw_yp(struct passwd *, uid_t); 74int pw_yp(struct passwd *, uid_t);
75void yppw_error(const char *name, int, int); 75__dead void yppw_error(const char *name, int, int);
76void yppw_prompt(void); 76void yppw_prompt(void);
77struct passwd *ypgetpwnam(const char *); 77struct passwd *ypgetpwnam(const char *);
78struct passwd *ypgetpwuid(uid_t); 78struct passwd *ypgetpwuid(uid_t);
79#endif 79#endif
80 80
81extern void (*Pw_error)(const char *name, int, int); 81extern void (*Pw_error)(const char *name, int, int);