/* DoCreateStringOutput (static) * * Private function used to send a C-string through the 1847 creator and * eventually pipe the 1847 output to a file. */ static int DoCreateStringOutput(const char *pStr, int nPart, emsMIMEtypeP mimePtr, createStatePtr pState, FILE *fOut) { BufTypePtr pTmpBuf = make_buf(); int ret = RFC1847_FAIL; if (pTmpBuf) { // Manually setup the buffer structure -- kind of ugly, but // more effiecient than copying the string pTmpBuf->buf = (char *) pStr; pTmpBuf->len = strlen(pStr); pTmpBuf->buf_size = pTmpBuf->len + 1; resetpos_buf(pTmpBuf); // Now output the buffer ret = DoCreatePartsOutput(mimePtr, ((nPart == 1) ? pTmpBuf : NULL), /* Part 1 */ ((nPart == 2) ? pTmpBuf : NULL), /* Part 2 */ pState, fOut); clear_buf(pTmpBuf); // Unassociate buffer with string delete_buf(pTmpBuf); // Delete buffer struct -- AFTER we clear it's contents } else return (FALSE); // Could not create buffer return (ret != RFC1847_FAIL); }
/* create_PartParseState (static) * * Private function used initialize the parse state. */ static PartParseStatePtr create_PartParseState() { PartParseStatePtr p = (PartParseStatePtr) malloc(sizeof(PartParseState)); if (p) { p->bFoundHeader = FALSE; p->pBuf = make_buf(); p->pSearchBuf = make_buf(); strcpy_buf(p->pSearchBuf, "\r\n\r\n"); p->cte = CTE_NONE; p->nPrevEndMatch = 0; p->preEncBuffer = NULL; p->d64state = NULL; p->dQPstate = NULL; } return (p); }
void add_cube(const MemoryBuf cbuf, const T& obuf) { uint32_t osize = obuf.size() * sizeof(typename T::value_type); if (cbuf.second < osize) { add_cube_pk(cbuf, osize); pak_counter++; } else { add_cube_pk(make_buf(obuf)); } }
f_skmac() { register struct buffer *b; struct buffer *make_buf(); if(km_flag) { ding("Kbd macro active, ignoring \"Start Kbd Macro\""); return; } if((b = km_buf) == 0) b = km_buf = make_buf(" *KBDMAC*"); ex_reset(b); km_flag = -1; /* Say starting macro collection */ kdef_mode = 1; redp(RD_MODE); }
/* Select old buffer or create a new one. Defaults to previously * used buffer. */ f_selbuffer() { register char *ans; register struct buffer *b; if((b = last_buf) == cur_buf) /* If default same as current, */ if(!(b = sel_mbuf(b))) /* try to pick a more useful one. */ b = sel_nbuf(cur_buf); ans = ask("Select buffer (%s): ",b->b_name); if (ans == 0) /* he aborted */ return; if (*ans != '\0') /* Null string => use last buff */ { b = find_buf (ans); /* Else find/create one */ if (b == 0) b = make_buf (ans); } sel_buf(b); chkfree(ans); }
void insert(const RawDataT& data, F& filter) { LOG4_TRACE("about to insert " << data.size() << " elements"); keys.reserve(data.size() + keys.size()); pk.reserve(data.size() + pk.size()); for(auto i = data.begin(); i != data.end(); ++i) { keys.push_back(i->first); uint32_t bs = i->second.size() * sizeof(typename CubeData::Val); if (filter.can_compress(bs)) { add_cube(filter.compress(i->second), i->second); } else { add_cube_pk(make_buf(i->second)); } counter++; } }
f_describe() { register char *cp; register int i, c; char str[10]; struct buffer *savbuf, *b, *make_buf(); chroff bdot; saynow("Help for command: "); i = cmd_idx(c = cmd_read()); /* Get function idx for cmd */ if(c&CB_META) sayntoo("M-"); if(i == FN_PFXMETA) { sayntoo("M-"); i = cmd_idx(c = (cmd_read() | CB_META)); } else if(i == FN_PFXEXT) { sayntoo("^X-"); i = cmd_idx(c = (cmd_read() | CB_EXT)); } str[0] = c&0177; str[1] = 0; sayntoo(str); /* Now read in the help file, if necessary */ savbuf = cur_buf; if(help_buf) chg_buf(help_buf); else { saynow("Loading "); sayntoo(ev_helpfile); sayntoo("..."); chg_buf(help_buf = make_buf(" **HELP**")); if(read_file(ev_helpfile) == 0) { chg_buf(savbuf); kill_buf(help_buf); help_buf = 0; return; } } /* Find function index in current buffer */ cp = str; *cp++ = '<'; *cp++ = 'F'; cp = dottoa(cp, (chroff)i); *cp++ = '>'; e_gobob(); if(e_search(str, cp-str, 0) == 0) sayntoo(" No help found"); else { bdot = e_dot(); while(!e_lblankp()) e_gonl(); /* Move past 1st blank line */ b = make_buf(" *SHOW*"); sb_sins((SBBUF *)b, e_copyn(bdot - e_dot())); mk_showin(b); /* Show the stuff */ kill_buf(b); sayclr(); } chg_buf(savbuf); }
static ssize_t gamma_b_show(struct device *dev, struct device_attribute *attr, char *buf) { return make_buf(9, buf); }