190792Sgshapiro/* 2261363Sgshapiro * Copyright (c) 2001 Proofpoint, Inc. and its suppliers. 390792Sgshapiro * All rights reserved. 490792Sgshapiro * 590792Sgshapiro * By using this file, you agree to the terms and conditions set 690792Sgshapiro * forth in the LICENSE file which can be found at the top level of 790792Sgshapiro * the sendmail distribution. 890792Sgshapiro * 990792Sgshapiro */ 1090792Sgshapiro 1190792Sgshapiro#include <sm/gen.h> 12266692SgshapiroSM_IDSTR(id, "@(#)$Id: t-cf.c,v 1.8 2013-11-22 20:51:43 ca Exp $") 1390792Sgshapiro 1490792Sgshapiro#include <errno.h> 1590792Sgshapiro#include <stdio.h> 1690792Sgshapiro#include <stdlib.h> 1790792Sgshapiro#include <string.h> 1890792Sgshapiro#include <sm/cf.h> 1990792Sgshapiro 2090792Sgshapiroint 2190792Sgshapiromain(argc, argv) 2290792Sgshapiro int argc; 2390792Sgshapiro char **argv; 2490792Sgshapiro{ 2590792Sgshapiro SM_CF_OPT_T opt; 2690792Sgshapiro int err; 2790792Sgshapiro 2890792Sgshapiro if (argc != 3) 2990792Sgshapiro { 3090792Sgshapiro fprintf(stderr, "Usage: %s .cf-file option\n", argv[0]); 3190792Sgshapiro exit(1); 3290792Sgshapiro } 3390792Sgshapiro opt.opt_name = argv[2]; 3490792Sgshapiro opt.opt_val = NULL; 3590792Sgshapiro err = sm_cf_getopt(argv[1], 1, &opt); 3690792Sgshapiro if (err) 3790792Sgshapiro { 3890792Sgshapiro fprintf(stderr, "%s: %s\n", argv[1], strerror(err)); 3990792Sgshapiro exit(1); 4090792Sgshapiro } 4190792Sgshapiro if (opt.opt_val == NULL) 4290792Sgshapiro printf("Error: option \"%s\" not found\n", opt.opt_name); 4390792Sgshapiro else 4490792Sgshapiro printf("%s=%s\n", opt.opt_name, opt.opt_val); 4590792Sgshapiro return 0; 4690792Sgshapiro} 47