Print this page
8485 Remove set but unused variables in usr/src/cmd
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/bnu/uuglist.c
+++ new/usr/src/cmd/bnu/uuglist.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 + * Copyright 2017 Gary Mills
23 24 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 25 * Use is subject to license terms.
25 26 */
26 27
27 28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 29 /* All Rights Reserved */
29 30
30 31
31 -#pragma ident "%Z%%M% %I% %E% SMI"
32 -
33 32 #include "uucp.h"
34 33
35 34 #define MAXLENGTH 256
36 35 #define C_MAX 512
37 36
38 37 static void insert();
39 38 void rproc(), uproc();
40 39
41 40 static char Nnament[MAXLENGTH][NAMESIZE];
42 41 static char *Nptr[MAXLENGTH];
43 42 static short Nnames = 0;
44 43
45 44 int
46 45 main(argc, argv)
47 46 int argc;
48 47 char **argv;
49 48 {
50 49 int c, i, uopt = 0;
51 50 char prev[2 * NAMESIZE];
52 51
53 52 if (eaccess(GRADES, 04) == -1) {
54 53 (void) fprintf(stderr, "No administrator defined service grades available on this machine, use single letter/number only\n");
55 54 exit(0);
56 55 }
57 56
58 57 while ((c = getopt(argc, argv, "x:u")) != EOF)
59 58 switch(c) {
60 59 case 'u':
61 60 uopt++;
62 61 break;
63 62 case 'x':
64 63 Debug = atoi(optarg);
65 64 if (Debug < 0)
66 65 Debug = 1;
67 66 break;
68 67 default:
69 68 (void) fprintf(stderr, "usage: uuglist [-u] [-xLEVEL]\n");
70 69 exit(-1);
71 70 }
72 71
73 72 if (uopt) {
74 73 Uid = getuid();
75 74
76 75 if (Uid == 0)
77 76 (void) setuid(UUCPUID);
78 77
79 78 (void) guinfo(Uid, User);
80 79
81 80 uproc();
82 81 } else
83 82 rproc();
84 83
85 84 for (i = 0; i < Nnames; i++) {
86 85
87 86 if (EQUALS(Nptr[i], prev))
88 87 continue;
89 88
90 89 puts(Nptr[i]);
91 90 (void) strcpy(prev, Nptr[i]);
92 91 }
93 92 return (0);
94 93 }
95 94 static void
96 95 insert(name)
97 96 char *name;
98 97 {
99 98 int i,j;
100 99 char *p;
101 100
102 101 DEBUG(7, "insert(%s) ", name);
103 102
104 103 for (i = Nnames; i > 0; i--)
105 104 if (strcmp(name, Nptr[i-1]) > 0)
106 105 break;
107 106
108 107 if (i == MAXLENGTH)
109 108 return;
110 109
111 110 if (Nnames == MAXLENGTH)
112 111 p = strcpy(Nptr[--Nnames], name);
113 112 else
114 113 p = strcpy(Nnament[Nnames], name);
115 114
116 115 for (j = Nnames; j > i; j--)
117 116 Nptr[j] = Nptr[j-1];
118 117
119 118 DEBUG(7, "insert %s ", p);
120 119 DEBUG(7, "at %d\n", i);
121 120 Nptr[i] = p;
↓ open down ↓ |
79 lines elided |
↑ open up ↑ |
122 121 Nnames++;
123 122 return;
124 123 }
125 124
126 125 void
127 126 rproc()
128 127 {
129 128 FILE *cfd;
130 129 char line[BUFSIZ];
131 130 char *carray[C_MAX];
132 - int na;
133 131
134 132 cfd = fopen(GRADES, "r");
135 133
136 134 while (rdfulline(cfd, line, BUFSIZ) != 0) {
137 135
138 - na = getargs(line, carray, C_MAX);
136 + (void) getargs(line, carray, C_MAX);
139 137 insert(carray[0]);
140 138 }
141 139
142 140 (void) fclose(cfd);
143 141 return;
144 142 }
145 143
146 144 void
147 145 uproc()
148 146 {
149 147 FILE *cfd;
150 148 char line[BUFSIZ];
151 149 char *carray[C_MAX];
152 150 int na;
153 151
154 152 cfd = fopen(GRADES, "r");
155 153
156 154 while (rdfulline(cfd, line, BUFSIZ) != 0) {
157 155
158 156 na = getargs(line, carray, C_MAX);
159 157
160 158 if (upermit(carray, na) != FAIL)
161 159 insert(carray[0]);
162 160 }
163 161
164 162 (void) fclose(cfd);
165 163 return;
166 164 }
167 165
168 166 int Dfileused = FALSE;
169 167 void wfcommit() {}
170 168 void cleanup() {}
171 169 int gnamef() { return (0); }
172 170 int gdirf() { return (0); }
173 171 int cklock() { return (0); }
174 172
175 173 /*VARARGS*/
176 174 /*ARGSUSED*/
177 175 void
178 176 assert (s1, s2, i1, s3, i2)
179 177 char *s1, *s2, *s3;
180 178 int i1, i2;
181 179 { } /* for ASSERT in gnamef.c */
182 180
183 181 /*VARARGS*/
184 182 /*ARGSUSED*/
185 183 void
186 184 errent(s1, s2, i1, file, line)
187 185 char *s1, *s2, *file;
188 186 { }
↓ open down ↓ |
40 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX