libk  Diff

Differences From Artifact [175e42b805]:

To Artifact [ba38860055]:


     5      5   
     6      6   struct object {
     7      7   	u8 a;
     8      8   	s16 b;
     9      9   	bool c;
    10     10   };
    11     11   
           12  +#define _slit(s) ((ksraw){Kmsz(s),s})
           13  +
    12     14   stat_long entry(kenv e) {
    13     15   	const char msg[] = "hello from libk\n";
    14     16   	ksraw ptr = { Kmsz(msg), msg };
    15     17   
    16     18   	bool maybe = true;
    17     19   	maybe = no;
    18     20   
................................................................................
    32     34   
    33     35   	void* top = kmlini();
    34     36   	kmres rst = kmlina(1230);
    35     37   	if(rst.cond != kmcond_ok) return kbad_mem;
    36     38   
    37     39   	kmres rst2 = kmlina(789);
    38     40   	if(rst2.cond != kmcond_ok) return kbad_mem;
           41  +
           42  +	const char varmsg[] = "printing environment variables\n";
           43  +	ksraw msgptr = { Kmsz(varmsg), varmsg };
           44  +	kiosend(e.std, msgptr, null);
           45  +
           46  +	for (sz i = 0; i < e.varc; ++i) {
           47  +		kiosend(e.std, _slit(" - "), null);
           48  +		kiosend(e.std, e.vars[i].name, null);
           49  +		kiosend(e.std, _slit(" = ["), null);
           50  +		kiosend(e.std, e.vars[i].val, null);
           51  +		kiosend(e.std, _slit("]\n"), null);
           52  +	}
    39     53   
    40     54   	return kbad_ok;
    41     55   }