Fix inconsistency in format module example

This commit is contained in:
Chocobo1 2015-05-31 16:32:51 +08:00
parent 5e61c5c0e4
commit 5cecc86856

View File

@ -189,8 +189,8 @@ static inline void add_token(int type, char *data)
if (out_tokens == NULL) if (out_tokens == NULL)
quit("Cannot reallocate out token array\n"); quit("Cannot reallocate out token array\n");
} }
out_tokens[token_index].ot_type = type; out_tokens[token_index].ot_type = type;
out_tokens[token_index].ot_str = data; out_tokens[token_index].ot_str = data;
token_index++; token_index++;
@ -250,7 +250,7 @@ static int format_probe(void)
} }
goto out; goto out;
finish_escape: finish_escape:
*p = '\0'; *p = '\0';
add_token(OT_STRING, s); add_token(OT_STRING, s);
@ -259,7 +259,7 @@ finish_escape:
continue; continue;
} }
out: out:
if (new_one) { if (new_one) {
add_token(OT_STRING, p); add_token(OT_STRING, p);
new_one = 0; new_one = 0;
@ -328,9 +328,9 @@ static void print_help(void)
" \"$(element:name) $(attr:rxrate:packets) $(attr:txrate:packets)\\n\"\n" \ " \"$(element:name) $(attr:rxrate:packets) $(attr:txrate:packets)\\n\"\n" \
" eth0 33 5\n" \ " eth0 33 5\n" \
"\n" \ "\n" \
" \"Element: $(element:name)\\nBytes Rate: \" \\\n" \ " \"Item: $(element:name)\\n\" \\\n" \
" \"$(attr:rxrate:bytes)/$(attr:txrate:bytes)\\nPackets Rate: \" \\\n" \ " \"Bytes Rate: $(attr:rxrate:bytes)/$(attr:txrate:bytes)\\n\" \\\n" \
" \"$(attr:rxrate:packets)/$(attr:txrate:packets)\\n\"\n" \ " \"Packets Rate: $(attr:rxrate:packets)/$(attr:txrate:packets)\\n\"\n" \
" Item: eth0\n" \ " Item: eth0\n" \
" Bytes Rate: 49130/2119\n" \ " Bytes Rate: 49130/2119\n" \
" Packets Rate: 40/11\n" \ " Packets Rate: 40/11\n" \