示例#1
0
/*
 * ParseDirective
 * Note: macro directives are handled before recording
 */
void ParseDirective(const char *cline)
{
	char *line = strdup(strltrim(cline) + 1);	// skip '.' and allow strtok
//printf("'%s'\n", file->line);
//printf("'%s'\n", line);
	bool valid_directive = false;
	//bool done_directive = true;
//printf("Line: [%s]\n", cline);
	
	/*
	 * macro ending directives
	 */

	if (DIRECTIVE("endm", PARSE_MACRO_DIRECTIVES))
	{
		current_macro = 0;
		parse_directives = PARSE_ALL_DIRECTIVES;
	}
	else if (DIRECTIVE("endr", PARSE_REPT_DIRECTIVES))
	{
		current_macro = 0;
		parse_directives = PARSE_ALL_DIRECTIVES;
		while (repeat-- > 0) MacroExecute("_rept");
	}

	/*
	 * record to macro
	 */
	if (current_macro)
	{
		MacroLine(cline);		// record full line
		goto exit;				// only process macro ending directives
	}

	/*
	 * macro starting directives
	 */
	if (DIRECTIVE("macro", PARSE_MACRO_DIRECTIVES) || DIRECTIVE("macroicase", PARSE_MACRO_DIRECTIVES))
	{
		char *name = strtok((char *)strskipspace(line), delim_chars);
		current_macro = FindMacro(name);
		if (pass != PASS_ASM)
		{
			if (current_macro) { eprintf("Macro name already defined.\n"); eexit(); }
			current_macro = NewMacro(name, DIRECTIVE("macroicase", PARSE_MACRO_DIRECTIVES));
EEKS{printf("new macro at %p\n", current_macro);}
			char *paramname;
			while ((paramname = strtok(0, delim_chars)))
			{
				if (isspace2(paramname[0])) paramname = strskipspace(paramname);
				if (strchr(endline_chars, *paramname)) break;

				current_macro->AddParameter(paramname);
			}
		}
		parse_directives = PARSE_MACRO_DIRECTIVES;
	}
示例#2
0
/*
 * Command handler for the DAVETagResponse directive, which is FLAG.
 */
static const char *etag_response(cmd_parms *cmd, void *config, int arg)
{
    caldav_dir_cfg *conf = config;

    conf->etag_response = arg;

    return NULL;
}

/* cmd callbacks */
static const command_rec caldav_cmds[] =
{
    DIRECTIVE("MinDateTime",  min_date_time, "Minumum datetime")
    DIRECTIVE("MaxDateTime",  max_date_time, "Maximum datetime")
    DIRECTIVE("MaxInstances", max_instances, "Maximum instances")
    DIRECTIVE("MaxAttendeesPerInstance", max_attendees_per_instance,
		"Maximum attendees per instance")

    /* per directory/location, or per server */
    AP_INIT_FLAG("CalQueryETagResponse", etag_response, NULL,
		 OR_OPTIONS, "response with ETag for calendar-query"),
    { NULL }
};

/** store resource type for a calendar collection */
static int caldav_store_resource_type(request_rec *r,
                                      const dav_resource *resource)
{