util.c (9dd94cc7) | util.c (a0bffbc0) |
---|---|
1/* $OpenBSD: util.c,v 1.10 2008/12/16 05:25:55 guenther Exp $ */ | 1/* $OpenBSD: util.c,v 1.11 2009/03/05 20:53:13 millert Exp $ */ |
2/* $NetBSD: util.c,v 1.4 1995/03/26 04:55:35 glass Exp $ */ 3 4/*- 5 * Copyright (c) 1988, 1993, 1994 6 * The Regents of the University of California. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)util.c 8.4 (Berkeley) 4/2/94"; 36#else | 2/* $NetBSD: util.c,v 1.4 1995/03/26 04:55:35 glass Exp $ */ 3 4/*- 5 * Copyright (c) 1988, 1993, 1994 6 * The Regents of the University of California. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 19 unchanged lines hidden (view full) --- 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33#ifndef lint 34#if 0 35static char sccsid[] = "@(#)util.c 8.4 (Berkeley) 4/2/94"; 36#else |
37static char rcsid[] = "$OpenBSD: util.c,v 1.10 2008/12/16 05:25:55 guenther Exp $"; | 37static char rcsid[] = "$OpenBSD: util.c,v 1.11 2009/03/05 20:53:13 millert Exp $"; |
38#endif 39#endif /* not lint */ 40 41#include <sys/types.h> 42 43#include <ctype.h> 44#include <pwd.h> 45#include <stdio.h> --- 36 unchanged lines hidden (view full) --- 82 return 1; 83 tm.tm_isdst = -1; 84 *store = mktime(&tm); 85 if (*store == (time_t) -1) 86 return 1; 87 return (0); 88} 89 | 38#endif 39#endif /* not lint */ 40 41#include <sys/types.h> 42 43#include <ctype.h> 44#include <pwd.h> 45#include <stdio.h> --- 36 unchanged lines hidden (view full) --- 82 return 1; 83 tm.tm_isdst = -1; 84 *store = mktime(&tm); 85 if (*store == (time_t) -1) 86 return 1; 87 return (0); 88} 89 |
90char * 91ok_shell(char *name) | 90int 91ok_shell(char *name, char **out) |
92{ 93 char *p, *sh; 94 95 setusershell(); 96 while ((sh = getusershell()) != NULL) { 97 if (!strcmp(name, sh)) | 92{ 93 char *p, *sh; 94 95 setusershell(); 96 while ((sh = getusershell()) != NULL) { 97 if (!strcmp(name, sh)) |
98 return (name); | 98 break; |
99 /* allow just shell name, but use "real" path */ 100 if ((p = strrchr(sh, '/')) && strcmp(name, p + 1) == 0) | 99 /* allow just shell name, but use "real" path */ 100 if ((p = strrchr(sh, '/')) && strcmp(name, p + 1) == 0) |
101 return (sh); | 101 break; |
102 } | 102 } |
103 return (NULL); | 103 if (sh && out) 104 *out = strdup(sh); 105 endusershell(); 106 return (sh != NULL); |
104} | 107} |