summaryrefslogtreecommitdiff
path: root/usr.bin/tcfs/tcfsrmuser.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tcfs/tcfsrmuser.c')
-rw-r--r--usr.bin/tcfs/tcfsrmuser.c69
1 files changed, 33 insertions, 36 deletions
diff --git a/usr.bin/tcfs/tcfsrmuser.c b/usr.bin/tcfs/tcfsrmuser.c
index 8ff37e49364..bacd3f2f6e9 100644
--- a/usr.bin/tcfs/tcfsrmuser.c
+++ b/usr.bin/tcfs/tcfsrmuser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcfsrmuser.c,v 1.4 2000/06/19 20:35:48 fgsch Exp $ */
+/* $OpenBSD: tcfsrmuser.c,v 1.5 2000/06/19 22:42:29 aaron Exp $ */
/*
* Transparent Cryptographic File System (TCFS) for NetBSD
@@ -31,7 +31,7 @@ Remove an user entry from the TCFS dabatase.
-v Makes the output a little more verbose\n";
int
-rmuser_main (int argn, char *argv[])
+rmuser_main(int argn, char *argv[])
{
int have_user = FALSE;
int be_verbose = FALSE;
@@ -43,33 +43,30 @@ rmuser_main (int argn, char *argv[])
* Going to check the arguments
*/
- if ((user = (char *) malloc(LOGIN_NAME_MAX + 1)) == NULL)
+ if ((user = (char *)malloc(LOGIN_NAME_MAX + 1)) == NULL)
err(1, NULL);
- while ((val=getopt (argn, argv, "l:hv"))!=EOF)
+ while ((val = getopt(argn, argv, "l:hv")) != EOF)
switch (val) {
- case 'l':
- strlcpy (user, optarg, LOGIN_NAME_MAX + 1);
- have_user = TRUE;
- break;
-
- case 'h':
- show_usage (rmuser_usage, argv[0]);
- exit (OK);
- break;
-
- case 'v':
- be_verbose = TRUE;
- break;
-
- default:
- fprintf (stderr, "Try %s --help for more information.\n", argv[0]);
- exit (ER_UNKOPT);
- break;
+ case 'l':
+ strlcpy(user, optarg, LOGIN_NAME_MAX + 1);
+ have_user = TRUE;
+ break;
+ case 'h':
+ show_usage(rmuser_usage, argv[0]);
+ exit(OK);
+ break;
+ case 'v':
+ be_verbose = TRUE;
+ break;
+ default:
+ fprintf(stderr, "Try %s --help for more information.\n", argv[0]);
+ exit(ER_UNKOPT);
+ break;
}
- if (argn-optind)
- tcfs_error (ER_UNKOPT, NULL);
+ if (argn - optind)
+ tcfs_error(ER_UNKOPT, NULL);
/*
* Here we don't have to drop root privileges because only root
@@ -79,31 +76,31 @@ rmuser_main (int argn, char *argv[])
if (!have_user) {
int len;
- printf ("Username to remove from TCFS database: ");
- fgets (user, LOGIN_NAME_MAX + 1, stdin);
+ printf("Username to remove from TCFS database: ");
+ fgets(user, LOGIN_NAME_MAX + 1, stdin);
len = strlen(user) - 2;
if (len < 0)
- exit (1);
+ exit(1);
user[len] = user[len] == '\n' ? 0 : user[len];
}
if (be_verbose)
- printf ("Deleting the entry for user %s from the TCFS database...\n", user);
+ printf("Deleting the entry for user %s from the TCFS database...\n", user);
/*
* Deleting an entry from the key database
*/
- if (!tcfspwdbr_new (&user_info))
- tcfs_error (ER_MEM, NULL);
+ if (!tcfspwdbr_new(&user_info))
+ tcfs_error(ER_MEM, NULL);
- if (!tcfspwdbr_edit (&user_info, F_USR, user))
- tcfs_error (ER_MEM, NULL);
+ if (!tcfspwdbr_edit(&user_info, F_USR, user))
+ tcfs_error(ER_MEM, NULL);
- if (!tcfs_putpwnam (user, user_info, U_DEL))
- tcfs_error (ER_CUSTOM, "Error: cannot remove user.");
+ if (!tcfs_putpwnam(user, user_info, U_DEL))
+ tcfs_error(ER_CUSTOM, "Error: cannot remove user.");
if (be_verbose)
- printf ("User entry removed with success.\n");
+ printf("User entry removed with success.\n");
- tcfs_error (OK, NULL);
+ tcfs_error(OK, NULL);
}