07.06.2013 Views

Design and Implementation of a Documentation Tool for ... - MADOC

Design and Implementation of a Documentation Tool for ... - MADOC

Design and Implementation of a Documentation Tool for ... - MADOC

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

0x12 Environment Variables (arbitrary number <strong>of</strong> C strings)<br />

Is written at session start. Contains the environment variables <strong>and</strong> their values<br />

as NAME=value pairs, each pair is terminated by a null byte (0x00). Since<br />

variable names may not contain the = character <strong>and</strong> neither variables names<br />

nor the values may include a null byte, the list needs no special escaping.<br />

19a 〈chunks 17a〉+≡ (15c) ⊳ 18c 19b ⊲<br />

int chunk12() {<br />

extern char **environ;<br />

int i = 0;<br />

int ret;<br />

while (environ[i] != NULL) {<br />

if (i == 0) {<br />

if ((ret = chunkwh(0x12)) < 0)<br />

return ret;<br />

}<br />

if ((ret = chunkwd((unsigned char *)environ[i],<br />

strlen(environ[i]) + 1)) < 0)<br />

return ret;<br />

i++;<br />

}<br />

if (i != 0) {<br />

if ((ret = chunkwf()) < 0)<br />

return ret;<br />

}<br />

return 1;<br />

}<br />

Defines:<br />

chunk12, used in chunk 34c.<br />

Uses chunkwd 21, chunkwf 22d, <strong>and</strong> chunkwh 22d.<br />

0x13 Locale Settings (seven C strings)<br />

Is written at session start. Contains the string values <strong>of</strong> several locale settings,<br />

namely LC ALL, LC COLLATE, LC CTYPE, LC MESSAGES, LC MONETARY, LC NUMERIC<br />

<strong>and</strong> LC TIME, in that order, each terminated by a null byte.<br />

19b 〈chunks 17a〉+≡ (15c) ⊳ 19a 20b ⊲<br />

int chunk13() {<br />

int cat[7] = { LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES,<br />

LC_MONETARY, LC_NUMERIC, LC_TIME };<br />

char *loc;<br />

int ret;<br />

if ((ret = chunkwh(0x13)) < 0)<br />

return ret;<br />

<strong>for</strong> (int i = 0; i < 7; i++) {<br />

if ((loc = setlocale(cat[i], "")) == NULL)<br />

return -1;<br />

if ((ret = chunkwd((unsigned char *)loc,<br />

19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!