xref: /freebsd-src/usr.bin/revoke/revoke.c (revision 1d386b48a555f61cb7325543adbbb5c3f3407a66)
17c7cef72SEd Schouten /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
31de7b4b8SPedro F. Giffuni  *
47c7cef72SEd Schouten  * Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
57c7cef72SEd Schouten  * All rights reserved.
67c7cef72SEd Schouten  *
77c7cef72SEd Schouten  * Redistribution and use in source and binary forms, with or without
87c7cef72SEd Schouten  * modification, are permitted provided that the following conditions
97c7cef72SEd Schouten  * are met:
107c7cef72SEd Schouten  * 1. Redistributions of source code must retain the above copyright
117c7cef72SEd Schouten  *    notice, this list of conditions and the following disclaimer.
127c7cef72SEd Schouten  * 2. Redistributions in binary form must reproduce the above copyright
137c7cef72SEd Schouten  *    notice, this list of conditions and the following disclaimer in the
147c7cef72SEd Schouten  *    documentation and/or other materials provided with the distribution.
157c7cef72SEd Schouten  *
167c7cef72SEd Schouten  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
177c7cef72SEd Schouten  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
187c7cef72SEd Schouten  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
197c7cef72SEd Schouten  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
207c7cef72SEd Schouten  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
217c7cef72SEd Schouten  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
227c7cef72SEd Schouten  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
237c7cef72SEd Schouten  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
247c7cef72SEd Schouten  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
257c7cef72SEd Schouten  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
267c7cef72SEd Schouten  * SUCH DAMAGE.
277c7cef72SEd Schouten  */
287c7cef72SEd Schouten 
297c7cef72SEd Schouten #include <sys/cdefs.h>
307c7cef72SEd Schouten #include <stdio.h>
317c7cef72SEd Schouten #include <stdlib.h>
327c7cef72SEd Schouten #include <unistd.h>
337c7cef72SEd Schouten 
347c7cef72SEd Schouten static void
usage(void)357c7cef72SEd Schouten usage(void)
367c7cef72SEd Schouten {
377c7cef72SEd Schouten 
387c7cef72SEd Schouten 	fprintf(stderr, "usage: revoke file ...\n");
397c7cef72SEd Schouten 	exit(1);
407c7cef72SEd Schouten }
417c7cef72SEd Schouten 
427c7cef72SEd Schouten int
main(int argc,char * argv[])437c7cef72SEd Schouten main(int argc, char *argv[])
447c7cef72SEd Schouten {
457c7cef72SEd Schouten 	char **d;
467c7cef72SEd Schouten 	int error = 0;
477c7cef72SEd Schouten 
487c7cef72SEd Schouten 	if (argc == 1)
497c7cef72SEd Schouten 		usage();
507c7cef72SEd Schouten 
517c7cef72SEd Schouten 	for (d = &argv[1]; *d != NULL; d++) {
527c7cef72SEd Schouten 		if (revoke(*d) != 0) {
537c7cef72SEd Schouten 			perror(*d);
547c7cef72SEd Schouten 			error = 1;
557c7cef72SEd Schouten 		}
567c7cef72SEd Schouten 	}
577c7cef72SEd Schouten 
587c7cef72SEd Schouten 	return (error);
597c7cef72SEd Schouten }
60