Esempio n. 1
0
static void
print_httppost (struct curl_httppost *hp)
{
  struct curl_httppost *p = hp;
  int i = 0;
  while (p != NULL)
    {
      fprintf (stderr, "\t\t%d: name: ", i);
      print_mem (p->name, p->namelength);
      fprintf (stderr, "\n\t\t   contents: ");
      print_mem (p->contents, p->contentslength);
      fprintf (stderr, "\n\t\t   buffer: ");
      print_mem (p->buffer, p->bufferlength);
      fprintf (stderr, "\n\t\t   contenttype: ");
      print_mem (p->contenttype, xstrlen (p->contenttype));
      fprintf (stderr, "\n\t\t   contentheader: ");
      print_slist (p->contentheader);
      fprintf (stderr, "\n\t\t   showfilename: ");
      print_mem (p->showfilename, xstrlen (p->showfilename));
      fprintf (stderr, "\n\t\t   flags: 0x%lx", p->flags);
      fprintf (stderr, "\n");
      i++;
      p = p->next;
    }
}
Esempio n. 2
0
// bsubst rewites b to replace all occurrences of x with y.
void
bsubst(Buf *b, char *x, char *y)
{
	char *p;
	int nx, ny, pos;

	nx = xstrlen(x);
	ny = xstrlen(y);

	pos = 0;
	for(;;) {
		p = xstrstr(bstr(b)+pos, x);
		if(p == nil)
			break;
		if(nx != ny) {
			if(nx < ny) {
				pos = p - b->p;
				bgrow(b, ny-nx);
				p = b->p + pos;
			}
			xmemmove(p+ny, p+nx, (b->p+b->len)-(p+nx));
		}
		xmemmove(p, y, ny);
		pos = p+ny - b->p;
		b->len += ny - nx;
	}
}
Esempio n. 3
0
int
n2a_event_host_check (int event_type __attribute__ ((__unused__)), void *data)
{
  //logger(LG_DEBUG, "Event: event_service_check");
  nebstruct_host_check_data *c = (nebstruct_host_check_data *) data;

  if (c->type == NEBTYPE_HOSTCHECK_PROCESSED)
    {
      //logger(LG_DEBUG, "HOSTCHECK_PROCESSED: %s", c->host_name);
      char *buffer = NULL, *key = NULL;

      size_t l = xstrlen(g_options.connector) + xstrlen(g_options.eventsource_name) + xstrlen(c->host_name) + 20; 

      nebstruct_host_check_data_to_json(&buffer, c); 

      // DO NOT FREE !!!
      xalloca(key, xmin(g_options.max_size, (int)l) * sizeof(char));

      snprintf(key, xmin(g_options.max_size, (int)l),
                 "%s.%s.check.component.%s", g_options.connector,
                 g_options.eventsource_name, c->host_name);

      if (c_size == -10000 || c_size / 2 == 0)
          amqp_publish(key, buffer);
      else
          n2a_record_cache (key, buffer);

      xfree(buffer);
    }

  return 0;
}
Esempio n. 4
0
static int mod_insert ( char *mod, int argc, char **argv )
{
	struct mod_list_t *tail = 0;
	struct mod_list_t *head = 0; 	
	int rc = 0;
	
	// get dep list for module mod
	check_dep ( mod, &head, &tail );
	
	if ( head && tail ) {
		int i;
		int l = 0;
	
		// append module args
		l = xstrlen ( head-> m_module );
		for ( i = 0; i < argc; i++ ) 
			l += ( xstrlen ( argv [i] ) + 1 );
		
		head-> m_module = xrealloc ( head-> m_module, l + 1 );
		
		for ( i = 0; i < argc; i++ ) {
			strcat ( head-> m_module, " " );
			strcat ( head-> m_module, argv [i] );
		}

		// process tail ---> head
		rc |= mod_process ( tail, 1 );
	}
	else
		rc = 1;
	
	return rc;
}
Esempio n. 5
0
main(int argc, string argv[])
{
    int i;
    long lstr[32], *lcop;
    stream opt, ipt;

    for (i = 0; i < 32; i++)
        lstr[i] = (i < 21 ? 12345 + 512 * i : (int) NULL);
    printf("xstrlen(lstr, %d) == %d\n",
           sizeof(long), xstrlen(lstr, sizeof(long)));
    lcop = (long *) copxstr(lstr, sizeof(long));
    printf("xstrlen(lcop, %d) == %d\n",
           sizeof(long), xstrlen(lcop, sizeof(long)));
    printf("xstreq(lstr, lcop, %d) == %d\n",
           sizeof(long), xstreq(lstr, lcop, sizeof(long)));
    printf("changing *lcop\n");
    *lcop = -1;
    printf("xstreq(lstr, lcop, %d) == %d\n",
           sizeof(long), xstreq(lstr, lcop, sizeof(long)));
    opt = stropen("foobar.dat", "w!");
    printf("putxstr(opt, lstr, %d) == %d\n",
           sizeof(long), putxstr(opt, lstr, sizeof(long)));
    printf("putxstr(opt, lcop, %d) == %d\n",
           sizeof(long), putxstr(opt, lcop, sizeof(long)));
    fclose(opt);
    ipt = stropen("foobar.dat", "r");
    lcop = (long *) getxstr(ipt, sizeof(long));
    if (lcop == NULL)
        printf("getxstr(ipt, %d) failed\n", sizeof(long));
    printf("xstreq(lstr, lcop, %d) == %d\n",
           sizeof(long), xstreq(lstr, lcop, sizeof(long)));
}
Esempio n. 6
0
char		*plv(char *msg, t_player *player)
{
  msg = xrealloc(msg, (xstrlen(msg) + 19) * sizeof(char));
  snprintf(msg + xstrlen(msg), 19, "plv %i %i\n", player->player_id,
	   player->level);
  return (msg);
}
Esempio n. 7
0
char		*ppo(char *msg, t_player *player)
{
  msg = xrealloc(msg, (xstrlen(msg) + 41) * sizeof(char));
  snprintf(msg + xstrlen(msg), 41, "ppo %i %i %i %i\n", player->player_id,
	   player->pos->x, player->pos->y, player->dir + 1);
  return (msg);
}
Esempio n. 8
0
//int xstrstr(char *base,char *pattern)
int xststr()
{
int len1=xstrlen(base);
int len2=xstrlen(pattern);
if(len1<len2)
	return -1;
if(len1==0 || len2==0)
	return -1;
int index=0,i=0,j=0;
for(i=0;i<len1;i++)
{
 if(base[i]==pattern[0])
 {
 index=i;
 for(j=1;j<len2;j++)
 {
	if(base[i]!=pattern[j])
		break;
 }
 if(pattern[j]=='\0')
	return index;
 else
 {	i-=j;
	j=0;
 }
 }
 }
 return -1;
 }
Esempio n. 9
0
int tableSet(PTable t,const pchar Name,const pchar Value)
{
  PTablePage p=t->pFirst,q;
  int idx0,idx=0,res=0;
  p=tableFind(p,&idx,Name);
  if(p)
  {
    q=p;idx0=idx;
    while((p=tableFind(p,&idx,Name)))
    {
      if(t->iFlags&TABLE_FLAG_ALLOCNAME)xfree(p->Values[idx].szName);
      if(t->iFlags&TABLE_FLAG_ALLOCVALUE)xfree(p->Values[idx].szValue);
      if(idx!=p->iCount-1)memmove(&p->Values[idx],&p->Values[idx+1],sizeof(SAttr)*(p->iCount-idx-1));
      p->iCount--;
      t->iCount--;
      res++;
    }
    if(res)t->iHoles++;
    if(t->iFlags&TABLE_FLAG_ALLOCVALUE)xfree(q->Values[idx].szValue);
    if(xstrlen(q->Values[idx0].szValue)>=xstrlen(Value))
      xstrcpy(q->Values[idx0].szValue,Value);
    else
      q->Values[idx0].szValue=xstrdup(t->pPool,Value);
    return t->iCount;
  }else return tableAdd(t,Name,Value);
}
Esempio n. 10
0
static bool 
starts_with(const xmlChar *str, const xmlChar *prefix)
{
    size_t prefix_len = xstrlen(prefix),
           str_len = xstrlen(str);
    return str_len < prefix_len ? FALSE : 
              xstrncmp(prefix, str, prefix_len) == 0;
}
Esempio n. 11
0
static void add_tag(ani_request_t *request)
{
    static int counter = 0;

    assert(NULL != request);
    (void)snprintf(request->tag, TAG_LEN, "tag%d", counter++);
    (void)strncat(request->msg, "&tag=", RAW_LEN - xstrlen(request->msg));
    (void)strncat(request->msg, request->tag, RAW_LEN - xstrlen(request->msg));
}
Esempio n. 12
0
void xmlSetItemContent(void *Pool,PXMLNode x,pchar Content)
{
  if(!x)return;
  if(xstrlen(x->szCont)>=xstrlen(Content))
    xstrcpy(x->szCont,Content);
  else
    x->szCont=xstrdup(Pool,Content);
  if(x->eType==xmlEmpty)x->eType=xmlLeaf;
}
Esempio n. 13
0
char		*pin(char *msg, t_player *player)
{
  int		i;

  i = -1;
  msg = xrealloc(msg, (xstrlen(msg) + 116) * sizeof(char));
  snprintf(msg + xstrlen(msg), 4, "plv %i %i %i", player->player_id,
	   player->pos->x, player->pos->y);
  while (++i != RESS_NUM)
    snprintf(msg + xstrlen(msg), 11, " %i", player->ress[i]);
  snprintf(msg + xstrlen(msg), 2, "\n");
  return (msg);
}
Esempio n. 14
0
static void add_session(ani_request_t *request)
{
    const char *session = ani_session();

    assert(NULL != request);
    if (NULL != session && '\0' != *session)
    {
        (void)xstrncpy(request->session, session, SESSION_LEN);
        (void)strncat(request->msg, "&s=",
            RAW_LEN - xstrlen(request->msg));
        (void)strncat(request->msg, request->session,
            RAW_LEN - xstrlen(request->msg));
    }
}
Esempio n. 15
0
/*
 * return the full path to a filter based on a short name
 * or, if the shortname is the full path, return itself 
 */
string filtername(string shortname)
{
  int nsp;
  static char fullname[256];
  char line[MAX_LINELEN];
  string *sp, fpath;
  stream fstr;

  if (nemo_file_size(shortname) > 0) return shortname;

  fpath = getenv("NEMODAT");
  if (fpath == 0) error("NEMODAT does not exist");

  sprintf(fullname,"%s/filter/Fnames",fpath);
  dprintf(1,"Alias table %s\n",fullname);
  fstr = stropen(fullname,"r");
  while (fgets(line,MAX_LINELEN,fstr)) {
    if (line[0] == '#') continue;
    sp = burststring(line," \n");
    nsp = xstrlen(sp,sizeof(sp))-1;
    if (nsp > 1) {
      if (streq(shortname,sp[0])) {
	sprintf(fullname,"%s/filter/%s",fpath,sp[1]);
	dprintf(1,"Matching %s\n",fullname);
	freestrings(sp);
	return fullname;
      }
    }
    freestrings(sp);
  }
  return shortname;
}
Esempio n. 16
0
File: backlog.c Progetto: hiciu/ekg2
static int wrap_line(window_t *w, int width, char *str, fstr_attr_t *attr, int *last_space) {
	int i, j, eat, printed, len = xstrlen(str);

	if (len==0 || xmbswidth(str, len)<width || width < 1)
		return len;

	if (w->nowrap)
		return break_word(str, width);

	for (i=0, printed=0; printed <= width && i < len; printed += j, i += eat) {
		j = get_word_width(str+i, attr+i, &eat);

		if (printed + j <= width)
			continue;

		if (printed+j == width+1 && str[i+eat-1]==' ') {
			*last_space = 1;
			return i + eat - 1;
		} else if (i==0) {
			return break_word(str, width);
		} else if ((j > width) && (width-printed>8)) {
			return i + break_word(str+i, width-printed);
		}
		return i;
	}
	return len;
}
Esempio n. 17
0
File: backlog.c Progetto: hiciu/ekg2
static int break_word(gchar *str, int width) {
	size_t i;
	int len = xstrlen(str);
#if USE_UNICODE
	int sum = 0;

	mbtowc(NULL, NULL, 0);
	for (i = 0; i < len && sum<width; ) {
		wchar_t ch;
		int ch_len = mbtowc(&ch, &str[i], len - i);
		if (ch_len!=-1) {
			int wc_width = wcwidth(ch);

			if (wc_width == -1)
				wc_width = 1;

			if (sum + wc_width > width)
				break;
			sum += wc_width;
			i += ch_len;
		} else {
			i++;
			sum++;
		}
	}
#else
	i = (len>=width ? width : len);
#endif
	return i;
}
Esempio n. 18
0
/*
Return VAR if there is already related to 's',
otherwise create a new VAR.
'var_name': name of the variable, it is optional.
's': string's content.
*/
VAR * VAR_MGR::register_str(CHAR const* var_name, SYM * s, UINT align)
{
	IS_TRUE0(s != NULL);
	VAR * v;
	if ((v = m_str_tab.get(s)) != NULL) {
		return v;
	}
	v = new_var();
	CHAR buf[64];
	if (var_name == NULL) {
		sprintf(buf, ".rodata_%zu", m_str_count++);
		VAR_name(v) = m_ru_mgr->add_to_symtab(buf);
	} else {
		VAR_name(v) = m_ru_mgr->add_to_symtab(var_name);
	}
	VAR_str(v) = s;
	VAR_data_type(v) = D_STR;
	VAR_elem_type(v) = D_UNDEF;
	IS_TRUE0(sizeof(CHAR) == 1);
	VAR_data_size(v) = xstrlen(SYM_name(s)) + 1;
	VAR_align(v) = align;
	VAR_is_global(v) = 1; //store in .data or .rodata

	assign_var_id(v);
	m_str_tab.set(s, v);
	return v;
}
Esempio n. 19
0
int nemoinpx(
	     char *expr,
	     double *a,
	     int     na)
{
  int nret, ncomp;
  string *vals, *comp;

  vals = burststring(expr,",");
  for (nret=0; vals[nret] != NULL; nret++) {
    if (nret>=na)
      return -23;
    comp = burststring(vals[nret],":");
    ncomp = xstrlen(comp,sizeof(string))-1;
    if (ncomp < 1 || ncomp > 3)
      return -13;
    a[nret] = atof(comp[0]);
    if (ncomp==1) continue;
    a[nret] += atof(comp[1])/60.0;
    if (ncomp==2) continue;
    a[nret] += atof(comp[2])/3600.0;
    freestrings(comp);
  }
  freestrings(vals);
  return nret;
}
Esempio n. 20
0
int watch_write(watch_t *w, const char *format, ...) {			/* XXX, refactory: watch_writef() */
	char		*text;
	int		textlen;
	va_list		ap;
	int		res;

	if (!w || !format)
		return -1;

	va_start(ap, format);
	text = vsaprintf(format, ap);
	va_end(ap);
	
	textlen = xstrlen(text); 

	debug_io("[watch]_send: %s\n", text ? textlen ? text: "[0LENGTH]":"[FAILED]");

	if (!text) 
		return -1;

	res = watch_write_data(w, text, textlen);

	xfree(text);
	return res;
}
Esempio n. 21
0
local void convert(stream instr, stream outstr)
{
    char   line[MAX_LINELEN];          /* input linelength */
    int    i, nlines, noutv;
    string *outv;                   /* pointer to vector of strings to write */
    char   *cp, *seps=", \t";       /* column separators  */
        
    nlines=0;               /* count lines read so far */

    for (;;) {
        if (get_line(instr, line) < 0)      /* EOF */
            return; 					     

        dprintf(3,"LINE: (%s)\n",line);
        if (iscomment(line)) continue;
        
        nlines++;
        tab2space(line);                  /* work around a Gipsy (?) problem */

        outv = burststring(line,seps);
        noutv = xstrlen(outv,sizeof(string)) - 1;
        if (noutv < maxcol)
            error("Too few columns in input file (%d < %d)",noutv,maxcol);
        if (Qall) nkeep = noutv;
                        
        for (i=0; i<nkeep; i++) {
            if (keep[i] == 0)
                fprintf(outstr,"%d",nlines);
            else
                fprintf(outstr,"%s",outv[keep[i]-1]);
            if (i < nkeep-1) fprintf(outstr,"%c",colsep);
        }
        if (colsep != 'n') fprintf(outstr,"\n");    /* end of line */
    }
}
Esempio n. 22
0
File: main.c Progetto: 11mariom/ekg2
static logs_log_t *logs_log_new(logs_log_t *l, const char *session, const char *uid) {
	logs_log_t *ll;
	int created = 0;

	debug("[logs] log_new uid = %s session %s", __(uid), __(session));
	ll = l ? l : logs_log_find(session, uid, 0);
	debug(" logs_log_t %x\n", ll);

	if (!ll) {
		ll = xmalloc(sizeof(logs_log_t));
		ll->session = xstrdup(session);
		ll->uid = xstrdup(uid);
		created = 1;
	}

	if (!(ll->lw)) {
		ll->lw = xmalloc(sizeof(log_window_t));
		logs_window_check(ll, time(NULL)); /* l->log_format i l->path, l->t */
		ll->lw->file = logs_open_file(ll->lw->path, ll->lw->logformat);
	}

	if (created) {
		if (ll->lw->logformat == LOG_FORMAT_IRSSI && xstrlen(IRSSI_LOG_EKG2_OPENED)) {
			logs_irssi(ll->lw->file, session, NULL,
					prepare_timestamp_format(IRSSI_LOG_EKG2_OPENED, time(NULL)),
					0, EKG_MSGCLASS_SYSTEM);
		} 
		list_add(&log_logs, ll);
	}
	return ll;
}
Esempio n. 23
0
PyObject *ekg_cmd_plugin_get(PyObject * self, PyObject * pyargs)
{
	ekg_pluginObj *pyplugin;
	plugin_t *p;
	char *name = NULL;
	int prio = -1;

	if (!PyArg_ParseTuple(pyargs, "s:plugin_get", &name))
		return NULL;

	debug("[python] checking for plugin '%s'\n", name);

	p = plugin_find(name);
	if (p) {
		prio = p->prio;
	}

	debug("[python] Building object for plugin '%s'\n", name);
	pyplugin = PyObject_New(ekg_pluginObj, &ekg_plugin_type);
	pyplugin->loaded = prio < 0 ? 0 : 1;
	pyplugin->prio = prio < 0 ? 0 : prio;
	pyplugin->name = xmalloc(xstrlen(name)+1);
	xstrcpy(pyplugin->name, name);
	Py_INCREF(pyplugin);
	return (PyObject *)pyplugin;
}
Esempio n. 24
0
int main()
{
    char input[11];int test;int l;int i=0;int flag=0;
    scanf("%d",&test);
    while(test--)
   {scanf("%s",input);
    l = xstrlen(input);
   // printf("%d\n",l);
    
    while(i<l){
    if(input[i]==input[l-i-1])
    {
    flag++;
    
    }
    i++;
	}
   
  //printf("flag = %d\n",flag);
   if(flag == l)
   printf("YES\n");
   else
   printf("NO\n");
   
    memset(input,0,10);
    i=0;flag=0;
   }
   return 0;

//system("pause");
}
Esempio n. 25
0
char *jabber_dcc_digest(char *sid, char *initiator, char *target) {
	GChecksum *ctx;
	unsigned char digest[20];
	static char result[41];
	gsize i, dsize;

	ctx = g_checksum_new(G_CHECKSUM_SHA1);
	g_checksum_update(ctx, (const guchar *)sid, xstrlen(sid));
	g_checksum_update(ctx, (const guchar *)initiator, xstrlen(initiator));
	g_checksum_update(ctx, (const guchar *)target, xstrlen(target));
	g_checksum_get_digest(ctx, digest, &dsize);

	for (i = 0; i < 20; i++)
		sprintf(result + i * 2, "%.2x", digest[i]);

	return result;
}
Esempio n. 26
0
void main()
{
int l;
char string[]="haha";
l=xstrlen(string);
printf("%d",l);
getch();
}
Esempio n. 27
0
char		*update_txtbox(char *str, SDL_KeyboardEvent *event)
{
  int		len;
  char		*tmp;

  // enter 13 + numpad 271
  // bksp = 8
  // esc = 27
  len = xstrlen(str);
  if (event->keysym.sym >= ' '
      && event->keysym.sym <= '~')
    {
      tmp = (char*)xmalloc(len + 2);
      xstrncpy(tmp, str, len);
      tmp[len] = event->keysym.sym;
      tmp[len + 1] = 0;
      free(str);
      str = tmp;
    }
  else if (event->keysym.sym == 266)
    {
      tmp = (char*)xmalloc(len + 2);
      xstrncpy(tmp, str, len);
      tmp[len] = '.';
      tmp[len + 1] = 0;
      free(str);
      str = tmp;
    }
  else if (event->keysym.sym >= 256
	   && event->keysym.sym <= 265)
    {
      tmp = (char*)xmalloc(len + 2);
      xstrncpy(tmp, str, len);
      tmp[len] = (event->keysym.sym - 256 + '0');
      tmp[len + 1] = 0;
      free(str);
      str = tmp;
    }
  else if (event->keysym.sym == 27)
    gfx->win->focus = -1;
  else if (event->keysym.sym == 8)
    {
      if (len > 1)
	{
	  tmp = xstrndup(str, len - 1);
	  free(str);
	  str = tmp;
	}
      else if (len == 1)
	{
	  free(str);
	  str = 0;
	}
      else if (!str)
	printf("%c", 7);
    }
  return (str);
}
Esempio n. 28
0
char *jabber_sasl_cram_md5_response(session_t *s, char *challenge, const char *username, const char *password) {
	char *digstr, *tmp, *retval;
	gsize i, len, block_size = 64;
	GChecksum *idigest = g_checksum_new(G_CHECKSUM_MD5);
	GChecksum *odigest = g_checksum_new(G_CHECKSUM_MD5);
	guchar *buf = g_malloc0(block_size);
	guchar *pad = g_malloc0(block_size);

	if (xstrlen(password) > block_size) {
		gsize len = block_size;
		g_checksum_update(idigest, (const guchar *)password, xstrlen(password));
		g_checksum_get_digest(idigest, buf, &len);
		g_checksum_reset(idigest);
	} else
		memcpy(buf, password, xstrlen(password));

	/* ipad */
	for (i = 0; i < block_size; i++)
		pad[i] = 0x36 ^ buf[i];
	g_checksum_update(idigest, pad, block_size);

	/* opad */
	for (i = 0; i < block_size; i++)
		pad[i] = 0x5c ^ buf[i];
	g_checksum_update(odigest, pad, block_size);

	g_checksum_update(idigest, (const guchar *)challenge, xstrlen(challenge));

	g_checksum_get_digest(idigest, buf, &len);
	g_checksum_update(odigest, buf, len);
	g_checksum_get_digest(odigest, buf, &len);

	digstr = g_strdup(g_checksum_get_string(odigest));

	g_checksum_free(idigest);
	g_checksum_free(odigest);
	g_free(buf);
	g_free(pad);

	tmp = g_strdup_printf("%s %s", username, digstr);
	retval = base64_encode(tmp, xstrlen(tmp));
	g_free(tmp);
	g_free(digstr);
	return retval;
}
Esempio n. 29
0
void nemo_main()
{
  int n;

  stream parstr, outstr;
  string molfile = getparam("mol");
  string outfile = getparam("out");
  string outdir  = getparam("outdir");
  string exefile = "radex";
  string datfile = "mol.dat";
  string parfile = "input.txt";
  string logfile = "radex.txt";
  char dname[256], cmd[256];

  real  fmin = getdparam("fmin");
  real  fmax = getdparam("fmax");
  real  tkin = getdparam("tkin");

  int   npartner;
  string *partner;
  real  density[MAXPARTNER];

  real  tbg = getdparam("tbg");
  real  cdmol = getdparam("cdmol");
  real  deltav = getdparam("deltav");

  partner = burststring(getparam("partner"),",");
  npartner = xstrlen(partner,sizeof(string))-1;
  if (npartner < 1 || npartner>MAXPARTNER) error("too few/many partners");
  n = nemoinpr(getparam("density"),density,MAXPARTNER);
  if (n != npartner) error("need matching numbers for partner= and density=");

  run_mkdir(outdir);
  sprintf(dname,"%s/%s",outdir,parfile);

  parstr = stropen(dname,"w");

  fprintf(parstr,"%s\n",molfile);
  fprintf(parstr,"%s\n",outfile);
  fprintf(parstr,"%g %g\n",fmin,fmax);
  fprintf(parstr,"%g\n",tkin);
  fprintf(parstr,"%d\n",npartner);
  for (n=0; n<npartner; n++) {
    fprintf(parstr,"%s\n",partner[n]);
    fprintf(parstr,"%g\n",density[n]);
  } 
  fprintf(parstr,"%g\n",tbg);
  fprintf(parstr,"%g\n",cdmol);
  fprintf(parstr,"%g\n",deltav);
  fprintf(parstr,"0\n");

  strclose(parstr);

  run_cd(outdir);
  sprintf(cmd,"%s < %s > %s ", exefile, parfile, logfile);
  run_sh(cmd);
}
Esempio n. 30
0
/* Count the number of times a character occurs in a string. */
static int 
count_chars(const xmlChar* string, char ch) {
    int count = 0;
    int length = xstrlen(string);
    for (int i = 0; i < length; ++i) {
        if (string[i] == ch) count++;
    }
    return count;
}