Example #1
0
/*
 * Interpolate the named messages into the current
 * message, preceding each line with a tab.
 * Return a count of the number of characters now in
 * the message, or -1 if an error is encountered writing
 * the message temporary.  The flag argument is 'm' if we
 * should shift over and 'f' if not.
 */
static int
forward(char *ms, FILE *fp, int f)
{
	int *msgvec;
	struct ignoretab *ig;
	char *tabst;
	enum sendaction	action;

	/*LINTED*/
	msgvec = (int *)salloc((msgCount+1) * sizeof *msgvec);
	if (msgvec == NULL)
		return(0);
	if (getmsglist(ms, msgvec, 0) < 0)
		return(0);
	if (*msgvec == 0) {
		*msgvec = first(0, MMNORM);
		if (*msgvec == 0) {
			printf(catgets(catd, CATSET, 68,
					"No appropriate messages\n"));
			return(0);
		}
		msgvec[1] = 0;
	}
	if (f == 'f' || f == 'F')
		tabst = NULL;
	else if ((tabst = value("indentprefix")) == NULL)
		tabst = "\t";
	ig = upperchar(f) ? (struct ignoretab *)NULL : ignore;
	action = upperchar(f) ? SEND_QUOTE_ALL : SEND_QUOTE;
	printf(catgets(catd, CATSET, 69, "Interpolating:"));
	for (; *msgvec != 0; msgvec++) {
		struct message *mp = message + *msgvec - 1;

		touch(mp);
		printf(" %d", *msgvec);
		if (send(mp, fp, ig, tabst, action, NULL) < 0) {
			perror(catgets(catd, CATSET, 70,
					"temporary mail file"));
			return(-1);
		}
	}
	printf("\n");
	return(0);
}
Example #2
0
void ParamInfo::write_esp_attr_method_ng(const char *msgname, int pos, bool isSet, bool hasNilRemove)
{
    char metatype[256]={0};
    cat_type(metatype);
    
    esp_xlate_info *xlation=esp_xlat(metatype);
    
    char *methName=strdup(name);
    *methName=upperchar(*methName);
    
    if (isSet)
    {
        if (hasNilRemove)
            outf(1,"void set%s_null(){ m_params[%d]->setNull(); }\n", methName, pos);
        outf(1,"void set%s(%s val){m_params[%d]->setValue(val);}\n", methName, xlation->access_type, pos);
    }
    else
    {
        if (hasNilRemove)
            outf(1,"bool get%s_isNull(){return m_params[%d]->isNull();}\n", methName, pos);
        outf(1,"%s get%s(){return EspNgParamConverter(m_params[%d]);}\n", xlation->access_type, methName, pos);
    }
    free(methName);
}