Lines Matching +full:m +full:- +full:mode

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
104 static int mode = -1; variable
105 static int which = -1;
108 static void cmdhelp(int mode, int which);
123 conf.fd = -1; in main()
133 if (*argv[1] == '-') { in main()
135 * Special case, allow pw -V<dir> <operation> [args] for in main()
138 * The -M option before the keyword is handled in main()
139 * differently from -M after a keyword. in main()
144 errx(EXIT_FAILURE, "Both '-R' and '-V' " in main()
159 --argc; in main()
171 } else if (mode == -1 && which == -1 && arg == 'M') { in main()
178 --argc; in main()
183 if (fd == -1) in main()
190 } else if (mode == -1 && (tmp = getindex(Modes, argv[1])) != -1) in main()
191 mode = tmp; in main()
192 else if (which == -1 && (tmp = getindex(Which, argv[1])) != -1) in main()
194 else if ((mode == -1 && which == -1) && in main()
195 ((tmp = getindex(Combo1, argv[1])) != -1 || in main()
196 (tmp = getindex(Combo2, argv[1])) != -1)) { in main()
198 mode = tmp % M_NUM; in main()
200 cmdhelp(mode, which); in main()
201 else if (which != -1 && mode != -1) in main()
206 --argc; in main()
212 if (mode == -1 || which == -1) in main()
213 cmdhelp(mode, which); in main()
216 if (conf.rootfd == -1) in main()
219 if (conf.metalog != NULL && (which != W_USER || mode != M_ADD)) in main()
223 return (cmdfunc[which][mode](argc, argv, arg1)); in main()
237 return (-1); in getindex()
247 cmdhelp(int mode, int which) in cmdhelp() argument
249 if (which == -1) in cmdhelp()
251 else if (mode == -1) in cmdhelp()
256 * We need to give mode specific help in cmdhelp()
261 "usage: pw [-M metalog] useradd [name] [switches]\n" in cmdhelp()
262 "\t-V etcdir alternate /etc location\n" in cmdhelp()
263 "\t-R rootdir alternate root directory\n" in cmdhelp()
264 "\t-C config configuration file\n" in cmdhelp()
265 "\t-M metalog mtree file, must precede 'useradd'\n" in cmdhelp()
266 "\t-q quiet operation\n" in cmdhelp()
268 "\t-n name login name\n" in cmdhelp()
269 "\t-u uid user id\n" in cmdhelp()
270 "\t-c comment user name/comment\n" in cmdhelp()
271 "\t-d directory home directory\n" in cmdhelp()
272 "\t-e date account expiry date\n" in cmdhelp()
273 "\t-p date password expiry date\n" in cmdhelp()
274 "\t-g grp initial group\n" in cmdhelp()
275 "\t-G grp1,grp2 additional groups\n" in cmdhelp()
276 "\t-m [ -k dir ] create and set up home\n" in cmdhelp()
277 "\t-M mode home directory permissions\n" in cmdhelp()
278 "\t-s shell name of login shell\n" in cmdhelp()
279 "\t-o duplicate uid ok\n" in cmdhelp()
280 "\t-L class user class\n" in cmdhelp()
281 "\t-h fd read password on fd\n" in cmdhelp()
282 "\t-H fd read encrypted password on fd\n" in cmdhelp()
283 "\t-Y update NIS maps\n" in cmdhelp()
284 "\t-N no update\n" in cmdhelp()
286 "\t-D set user defaults\n" in cmdhelp()
287 "\t-b dir default home root dir\n" in cmdhelp()
288 "\t-e period default expiry period\n" in cmdhelp()
289 "\t-p period default password change period\n" in cmdhelp()
290 "\t-g group default group\n" in cmdhelp()
291 "\t-G grp1,grp2 additional groups\n" in cmdhelp()
292 "\t-L class default user class\n" in cmdhelp()
293 "\t-k dir default home skeleton\n" in cmdhelp()
294 "\t-M mode home directory permissions\n" in cmdhelp()
295 "\t-u min,max set min,max uids\n" in cmdhelp()
296 "\t-i min,max set min,max gids\n" in cmdhelp()
297 "\t-w method set default password method\n" in cmdhelp()
298 "\t-s shell default shell\n" in cmdhelp()
299 "\t-y path set NIS passwd file path\n", in cmdhelp()
301 "\t-V etcdir alternate /etc location\n" in cmdhelp()
302 "\t-R rootdir alternate root directory\n" in cmdhelp()
303 "\t-n name login name\n" in cmdhelp()
304 "\t-u uid user id\n" in cmdhelp()
305 "\t-Y update NIS maps\n" in cmdhelp()
306 "\t-y path set NIS passwd file path\n" in cmdhelp()
307 "\t-r remove home & contents\n", in cmdhelp()
309 "\t-V etcdir alternate /etc location\n" in cmdhelp()
310 "\t-R rootdir alternate root directory\n" in cmdhelp()
311 "\t-C config configuration file\n" in cmdhelp()
312 "\t-q quiet operation\n" in cmdhelp()
313 "\t-F force add if no user\n" in cmdhelp()
314 "\t-n name login name\n" in cmdhelp()
315 "\t-u uid user id\n" in cmdhelp()
316 "\t-c comment user name/comment\n" in cmdhelp()
317 "\t-d directory home directory\n" in cmdhelp()
318 "\t-e date account expiry date\n" in cmdhelp()
319 "\t-p date password expiry date\n" in cmdhelp()
320 "\t-g grp initial group\n" in cmdhelp()
321 "\t-G grp1,grp2 additional groups\n" in cmdhelp()
322 "\t-l name new login name\n" in cmdhelp()
323 "\t-L class user class\n" in cmdhelp()
324 "\t-m [ -k dir ] create and set up home\n" in cmdhelp()
325 "\t-M mode home directory permissions\n" in cmdhelp()
326 "\t-s shell name of login shell\n" in cmdhelp()
327 "\t-w method set new password using method\n" in cmdhelp()
328 "\t-h fd read password on fd\n" in cmdhelp()
329 "\t-H fd read encrypted password on fd\n" in cmdhelp()
330 "\t-Y update NIS maps\n" in cmdhelp()
331 "\t-y path set NIS passwd file path\n" in cmdhelp()
332 "\t-N no update\n", in cmdhelp()
334 "\t-V etcdir alternate /etc location\n" in cmdhelp()
335 "\t-R rootdir alternate root directory\n" in cmdhelp()
336 "\t-n name login name\n" in cmdhelp()
337 "\t-u uid user id\n" in cmdhelp()
338 "\t-F force print\n" in cmdhelp()
339 "\t-P prettier format\n" in cmdhelp()
340 "\t-a print all users\n" in cmdhelp()
341 "\t-7 print in v7 format\n", in cmdhelp()
343 "\t-V etcdir alternate /etc location\n" in cmdhelp()
344 "\t-R rootdir alternate root directory\n" in cmdhelp()
345 "\t-C config configuration file\n" in cmdhelp()
346 "\t-q quiet operation\n", in cmdhelp()
348 "\t-V etcdir alternate /etc locations\n" in cmdhelp()
349 "\t-C config configuration file\n" in cmdhelp()
350 "\t-q quiet operation\n", in cmdhelp()
352 "\t-V etcdir alternate /etc locations\n" in cmdhelp()
353 "\t-C config configuration file\n" in cmdhelp()
354 "\t-q quiet operation\n" in cmdhelp()
358 "\t-V etcdir alternate /etc location\n" in cmdhelp()
359 "\t-R rootdir alternate root directory\n" in cmdhelp()
360 "\t-C config configuration file\n" in cmdhelp()
361 "\t-q quiet operation\n" in cmdhelp()
362 "\t-n group group name\n" in cmdhelp()
363 "\t-g gid group id\n" in cmdhelp()
364 "\t-M usr1,usr2 add users as group members\n" in cmdhelp()
365 "\t-o duplicate gid ok\n" in cmdhelp()
366 "\t-Y update NIS maps\n" in cmdhelp()
367 "\t-N no update\n", in cmdhelp()
369 "\t-V etcdir alternate /etc location\n" in cmdhelp()
370 "\t-R rootdir alternate root directory\n" in cmdhelp()
371 "\t-n name group name\n" in cmdhelp()
372 "\t-g gid group id\n" in cmdhelp()
373 "\t-Y update NIS maps\n", in cmdhelp()
375 "\t-V etcdir alternate /etc location\n" in cmdhelp()
376 "\t-R rootdir alternate root directory\n" in cmdhelp()
377 "\t-C config configuration file\n" in cmdhelp()
378 "\t-q quiet operation\n" in cmdhelp()
379 "\t-F force add if not exists\n" in cmdhelp()
380 "\t-n name group name\n" in cmdhelp()
381 "\t-g gid group id\n" in cmdhelp()
382 "\t-M usr1,usr2 replaces users as group members\n" in cmdhelp()
383 "\t-m usr1,usr2 add users as group members\n" in cmdhelp()
384 "\t-d usr1,usr2 delete users as group members\n" in cmdhelp()
385 "\t-l name new group name\n" in cmdhelp()
386 "\t-Y update NIS maps\n" in cmdhelp()
387 "\t-N no update\n", in cmdhelp()
389 "\t-V etcdir alternate /etc location\n" in cmdhelp()
390 "\t-R rootdir alternate root directory\n" in cmdhelp()
391 "\t-n name group name\n" in cmdhelp()
392 "\t-g gid group id\n" in cmdhelp()
393 "\t-F force print\n" in cmdhelp()
394 "\t-P prettier format\n" in cmdhelp()
395 "\t-a print all accounting groups\n", in cmdhelp()
397 "\t-V etcdir alternate /etc location\n" in cmdhelp()
398 "\t-R rootdir alternate root directory\n" in cmdhelp()
399 "\t-C config configuration file\n" in cmdhelp()
400 "\t-q quiet operation\n" in cmdhelp()
404 fprintf(stderr, "%s", help[which][mode]); in cmdhelp()
412 cmdhelp(mode, which); in usage()