3 * Copyright (C) 2005 Simone Piccardi
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #include <sys/types.h> /* primitive system data types */
20 #include <sys/stat.h> /* file characteristics constants and functions */
21 #include <dirent.h> /* directory operation constants and functions */
22 #include <stdlib.h> /* C standard library */
23 #include <unistd.h> /* unix standard library */
24 #include <stdio.h> /* standard I/O library */
29 * Enable and disable BSD accounting
31 /* Help printing routine */
34 int main(int argc, char *argv[])
39 * Input section: decode command line parameters
42 opterr = 0; /* don't want writing to stderr */
43 while ( (i = getopt(argc, argv, "hed")) != -1) {
48 case 'h': /* help option */
49 printf("Wrong -h option use\n");
53 case 'e': /* enable option */
56 case 'd': /* disable option */
59 case '?': /* unrecognized options */
60 printf("Unrecognized options -%c\n",optopt);
62 default: /* should not reached */
66 /* ***********************************************************
68 * Options processing completed
72 * ***********************************************************/
74 printf("Specify option\n");
78 if ((argc - optind) != 1) { /* There must be remaing parameters */
79 printf("Wrong number of arguments %d\n", argc - optind);
82 i = acct(argv[optind]);
87 perror("Operazione Fallita");
92 * routine to print usage info and exit
95 printf("Program AcctCtrl: enable/disable BSD accounting \n");
97 printf(" acctctrl [-hed] filename \n");
98 printf(" -h print this help\n");
99 printf(" -e enable BSD accounting\n");
100 printf(" -d disable BSD accounting\n");