예제 #1
1
/* Global data */
static const char *cfgdb = CFGDB;
static const char *stdb = STATDB;
static DBM *stdbp = NULL;
static DBM *cfgdbp = NULL;
const char *progname = NULL;

/* Local defines */
#define UNLIM "unlimited"

#define OPER(op) {#op, handle_##op} /* main targets for program */
struct {
	const char	*op;
	void (*handler)(int, char **);
} ops[] = {
	OPER(ruleadd),
	OPER(rulemod),
	OPER(ruledel),
	OPER(rulelist),
	OPER(ruleflush),
	OPER(statdel),
	OPER(statlist),
	OPER(statflush),
	OPER(lock),
	OPER(unlock),
};
#define NOPS (sizeof(ops) / sizeof(*ops))
	
#define VFLAG 0x00000001 /* -v flag */
#define FFLAG 0x00000002 /* -f flag */
#define AFLAG 0x00000004 /* -a flag */
예제 #2
0
파일: op.c 프로젝트: blindsay7/libm-tools
int
main(int argc,char *argv[]){
	double arg=0.0;
	char *endptr=NULL;

	if(2!=argc){
		fprintf(stderr,"Argument required\n");
		return 1;
	}

	arg=strtod(argv[1],&endptr);

	if(0==arg&&endptr==argv[1]){
		fprintf(stderr,"Argument (%s) is not a valid number\n",argv[1]);
		return 1;
	}

#ifdef TOINT
	printf("%i\n",(int)OPER(arg));
#else
	printf("%.10g\n",OPER(arg));
#endif

	return 0;
}
예제 #3
0
GVN::Value * GVN::getValue(MultivariatePolynomial(OPER)(const MultivariatePolynomial & LMP, const MultivariatePolynomial & RMP), const GVN::Value & LV, const GVN::Value & RV, const OpValue & ov)
{
    const auto i = mapv.find(ov);
    if (i == mapv.end())
    {
        return getValue(OPER(*LV.poly, *RV.poly), ov);
    }
    else
    {
        return &i->second;
    }
}
예제 #4
0
파일: discofs.c 프로젝트: laevar/discofs
        case SIGUSR2:
            INFO("received SIGUSR2\n");
            state_toggle_force_offline();
            break;
    }
}

/*! @struct discofs_oper operations struct which will be passed to fuse_main() */
#if DEBUG_FSOPS
#define OPER(n) .n = debug_op_ ## n
#else
#define OPER(n) .n = op_ ## n
#endif
static struct fuse_operations discofs_oper =
{
    OPER(init),
    OPER(destroy),
    OPER(getattr),
    OPER(fgetattr),
    OPER(access),
    OPER(readlink),
    OPER(opendir),
    OPER(readdir),
    OPER(mknod),
    OPER(mkdir),
    OPER(rmdir),
    OPER(unlink),
    OPER(link),
    OPER(symlink),
    OPER(rename),
    OPER(releasedir),