2 * Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
3 * Copyright (c) 1990,1993 Regents of The University of Michigan.
4 * All Rights Reserved. See COPYRIGHT.
6 * modified from main.c. this handles afp options.
11 #endif /* HAVE_CONFIG_H */
18 #include <sys/param.h>
19 #include <sys/socket.h>
20 #include <atalk/logger.h>
22 #include <netinet/in.h>
23 #include <arpa/inet.h>
27 #endif /* HAVE_NETDB_H */
31 #include <sys/types.h>
32 #endif /* ADMIN_GRP */
34 #include <atalk/paths.h>
35 #include <atalk/util.h>
36 #include <atalk/compat.h>
37 #include <atalk/globals.h>
38 #include <atalk/fce_api.h>
39 #include <atalk/errchk.h>
47 /* get rid of any allocated afp_option buffers. */
48 void afp_options_free(struct afp_options *opt)
52 if (opt->adminauthuser)
53 free(opt->adminauthuser);
55 free(opt->configfile);
75 free(opt->maccodepage);
77 free(opt->mimicmodel);
81 free(opt->ntseparator);
83 free(opt->passwdfile);
86 if (opt->signatureopt)
87 free(opt->signatureopt);
92 if (opt->unixcodepage)
93 free(opt->unixcodepage);
97 * Show version information about afpd.
100 static void show_version( void )
104 printf( "afpd %s - Apple Filing Protocol (AFP) daemon of Netatalk\n\n", VERSION );
106 puts( "This program is free software; you can redistribute it and/or modify it under" );
107 puts( "the terms of the GNU General Public License as published by the Free Software" );
108 puts( "Foundation; either version 2 of the License, or (at your option) any later" );
109 puts( "version. Please see the file COPYING for further information and details.\n" );
111 puts( "afpd has been compiled with support for these features:\n" );
113 num = sizeof( afp_versions ) / sizeof( afp_versions[ 0 ] );
114 printf( " AFP versions:\t" );
115 for ( i = 0; i < num; i++ ) {
116 printf( "%d.%d ", afp_versions[ i ].av_number/10, afp_versions[ i ].av_number%10);
120 printf( " CNID backends:\t" );
121 #ifdef CNID_BACKEND_CDB
124 #ifdef CNID_BACKEND_DB3
127 #ifdef CNID_BACKEND_DBD
128 #ifdef CNID_BACKEND_DBD_TXN
129 printf( "dbd-txn " );
134 #ifdef CNID_BACKEND_HASH
137 #ifdef CNID_BACKEND_LAST
140 #ifdef CNID_BACKEND_MTAB
143 #ifdef CNID_BACKEND_TDB
150 * Show extended version information about afpd and Netatalk.
153 static void show_version_extended(void )
157 printf( " Zeroconf support:\t" );
158 #if defined (HAVE_MDNS)
159 puts( "mDNSResponder" );
160 #elif defined (HAVE_AVAHI)
166 printf( " TCP wrappers support:\t" );
173 printf( " Quota support:\t" );
174 #ifndef NO_QUOTA_SUPPORT
180 printf( " Admin group support:\t" );
187 printf( " Valid shell checks:\t" );
188 #ifndef DISABLE_SHELLCHECK
194 printf( " cracklib support:\t" );
201 printf( " EA support:\t" );
204 printf( " ACL support:\t" );
211 printf( " LDAP support:\t" );
220 * Display compiled-in default paths
222 static void show_paths( void )
224 printf( " afp.conf:\t%s\n", _PATH_CONFDIR "afp.conf");
225 printf( " state directory:\t%s\n", _PATH_STATEDIR);
226 printf( " afp_signature.conf:\t%s\n", _PATH_STATEDIR "afp_signature.conf");
227 printf( " afp_voluuid.conf:\t%s\n", _PATH_STATEDIR "afp_voluuid.conf");
228 printf( " UAM search path:\t%s\n", _PATH_AFPDUAMPATH );
229 printf( " Server messages path:\t%s\n", SERVERTEXT);
233 * Display usage information about afpd.
235 static void show_usage(void)
237 fprintf( stderr, "Usage:\tafpd [-d] [-F configfile]\n");
238 fprintf( stderr, "\tafpd -h|-v|-V\n");
241 void afp_options_parse_cmdline(AFPObj *obj, int ac, char **av)
245 while (EOF != ( c = getopt( ac, av, "dF:vVh" )) ) {
248 obj->cmdlineflags |= OPTION_DEBUG;
251 obj->cmdlineconfigfile = strdup(optarg);
253 case 'v': /* version */
254 show_version( ); puts( "" );
255 show_paths( ); puts( "" );
258 case 'V': /* extended version */
259 show_version_extended( ); puts( "" );
260 show_paths( ); puts( "" );
263 case 'h': /* usage */
271 if ( err || optind != ac ) {