Import sendmail 8.13.4 into a new contrib directory as the first step
[dragonfly.git] / contrib / sendmail-8.13.4 / libsm / t-cf.c
blob90785144fbfd9b2872a8b13a9f9d3d345e33fd10
1 /*
2 * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
9 */
11 #include <sm/gen.h>
12 SM_IDSTR(id, "@(#)$Id: t-cf.c,v 1.7 2001/09/11 04:04:49 gshapiro Exp $")
14 #include <errno.h>
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <sm/cf.h>
20 int
21 main(argc, argv)
22 int argc;
23 char **argv;
25 SM_CF_OPT_T opt;
26 int err;
28 if (argc != 3)
30 fprintf(stderr, "Usage: %s .cf-file option\n", argv[0]);
31 exit(1);
33 opt.opt_name = argv[2];
34 opt.opt_val = NULL;
35 err = sm_cf_getopt(argv[1], 1, &opt);
36 if (err)
38 fprintf(stderr, "%s: %s\n", argv[1], strerror(err));
39 exit(1);
41 if (opt.opt_val == NULL)
42 printf("Error: option \"%s\" not found\n", opt.opt_name);
43 else
44 printf("%s=%s\n", opt.opt_name, opt.opt_val);
45 return 0;