logname.c (77789) | logname.c (87287) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/*- 2 * Copyright (c) 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/usr.bin/logname/logname.c 77789 2001-06-05 21:04:42Z phk $ | 33 * $FreeBSD: head/usr.bin/logname/logname.c 87287 2001-12-03 21:03:39Z dwmalone $ |
34 */ 35 36#ifndef lint | 34 */ 35 36#ifndef lint |
37static char copyright[] = | 37static const char copyright[] = |
38"@(#) Copyright (c) 1991, 1993, 1994\n\ 39 The Regents of the University of California. All rights reserved.\n"; 40#endif /* not lint */ 41 42#ifndef lint | 38"@(#) Copyright (c) 1991, 1993, 1994\n\ 39 The Regents of the University of California. All rights reserved.\n"; 40#endif /* not lint */ 41 42#ifndef lint |
43static char sccsid[] = "@(#)logname.c 8.2 (Berkeley) 4/3/94"; | 43static const char sccsid[] = "@(#)logname.c 8.2 (Berkeley) 4/3/94"; |
44#endif /* not lint */ 45 46#include <err.h> 47#include <errno.h> 48#include <unistd.h> 49#include <stdio.h> 50#include <stdlib.h> 51#include <string.h> 52 53void usage __P((void)); 54 55int 56main(argc, argv) 57 int argc; | 44#endif /* not lint */ 45 46#include <err.h> 47#include <errno.h> 48#include <unistd.h> 49#include <stdio.h> 50#include <stdlib.h> 51#include <string.h> 52 53void usage __P((void)); 54 55int 56main(argc, argv) 57 int argc; |
58 char *argv[]; | 58 char *argv[] __unused; |
59{ 60 char *p; 61 62 if (argc != 1) 63 usage(); 64 if ((p = getlogin()) == NULL) 65 err(1, NULL); 66 (void)printf("%s\n", p); 67 exit(0); 68} 69 70void 71usage() 72{ 73 (void)fprintf(stderr, "usage: logname\n"); 74 exit(1); 75} | 59{ 60 char *p; 61 62 if (argc != 1) 63 usage(); 64 if ((p = getlogin()) == NULL) 65 err(1, NULL); 66 (void)printf("%s\n", p); 67 exit(0); 68} 69 70void 71usage() 72{ 73 (void)fprintf(stderr, "usage: logname\n"); 74 exit(1); 75} |