/* _cf_path_1: write at/inpath.
  */
  static c3_w
  _cf_path_1(c3_c*   buf_c,
             c3_w    pos_w,
             u2_noun hut)                                         //  retain
  {
    if ( u2_no == u2_cr_du(hut) ) {
      c3_w met_w = u2_cr_met(3, hut);

      if ( buf_c ) u2_cr_bytes(0, met_w, (c3_y*)(buf_c + pos_w), hut);
      return (pos_w + met_w);
    }
    else {
      c3_w met_w  = u2_cr_met(3, u2h(hut));
      c3_w end_w  = _cf_path_1(buf_c, pos_w, u2t(hut));
      u2_noun san = u2h(hut);

      if ( buf_c ) buf_c[end_w] = '/';
      end_w++;

      // little security thing - last ditch
      //
      if ( c3_s2('.', '.') == san ) {
        san = c3_s3('.','.','.');
      }
      if ( buf_c ) u2_cr_bytes(0, met_w, (c3_y*)(buf_c + end_w), san);
      end_w += met_w;

      return end_w;
    }
  }
示例#2
0
/* _term_it_save(): save file by path.
*/
static void
_term_it_save(u2_noun pax, u2_noun pad)
{
  c3_c* pax_c;

  pax = u2nc(c3_s3('p','u','t'), pax);
  pax_c = _term_it_path(u2_yes, pax);

  u2_walk_save(pax_c, 0, pad);
  free(pax_c);
}
示例#3
0
文件: term.c 项目: laanwj/urbit
/* _term_it_save(): save file by path.
*/
static void
_term_it_save(u3_noun pax, u3_noun pad)
{
  c3_c* pax_c;

  pax = u3nt(c3_s4('.','u','r','b'), c3_s3('p','u','t'), pax);
  pax_c = _term_it_path(c3y, pax);

  u3_walk_save(pax_c, 0, pad);
  free(pax_c);
}