[v3,02/14] cmdline: fix whitespace
Checks
Commit Message
Add space after keywords.
Remove unnecessary spaces in if expressions.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/cmdline/cmdline_parse_string.c | 17 +++++++----------
lib/cmdline/cmdline_rdline.c | 12 ++++++------
2 files changed, 13 insertions(+), 16 deletions(-)
@@ -73,20 +73,17 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
token_len = get_token_len(str);
/* if token is too big... */
- if (token_len >= STR_TOKEN_SIZE - 1) {
+ if (token_len >= STR_TOKEN_SIZE - 1)
continue;
- }
- if ( strncmp(buf, str, token_len) ) {
+ if (strncmp(buf, str, token_len))
continue;
- }
- if ( !cmdline_isendoftoken(*(buf+token_len)) ) {
+ if (!cmdline_isendoftoken(*(buf+token_len)))
continue;
- }
break;
- } while ( (str = get_next_token(str)) != NULL );
+ } while ((str = get_next_token(str)) != NULL);
if (!str)
return -1;
@@ -108,7 +105,7 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
/* unspecified string (unknown single token) */
else {
token_len = 0;
- while(!cmdline_isendoftoken(buf[token_len]) &&
+ while (!cmdline_isendoftoken(buf[token_len]) &&
token_len < (STR_TOKEN_SIZE-1))
token_len++;
@@ -149,9 +146,9 @@ int cmdline_complete_get_nb_string(cmdline_parse_token_hdr_t *tk)
return 0;
str = sd->str;
- while( (str = get_next_token(str)) != NULL ) {
+ while ((str = get_next_token(str)) != NULL)
ret++;
- }
+
return ret;
}
@@ -301,7 +301,7 @@ rdline_char_in(struct rdline *rdl, char c)
/* delete 1 char from the left */
case CMDLINE_KEY_BKSPACE:
case CMDLINE_KEY_BKSPACE2:
- if(!cirbuf_del_tail_safe(&rdl->left)) {
+ if (!cirbuf_del_tail_safe(&rdl->left)) {
rdline_puts(rdl, vt100_bs);
display_right_buffer(rdl, 1);
}
@@ -354,7 +354,7 @@ rdline_char_in(struct rdline *rdl, char c)
/* paste contents of kill buffer to the left side of caret */
case CMDLINE_KEY_CTRL_Y:
i=0;
- while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
+ while (CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
RDLINE_BUF_SIZE &&
i < rdl->kill_size) {
cirbuf_add_tail(&rdl->left, rdl->kill_buf[i]);
@@ -403,10 +403,10 @@ rdline_char_in(struct rdline *rdl, char c)
tmp_size = strnlen(tmp_buf, sizeof(tmp_buf));
/* add chars */
if (ret == RDLINE_RES_COMPLETE) {
- i=0;
- while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
- RDLINE_BUF_SIZE &&
- i < tmp_size) {
+ i = 0;
+ while (CIRBUF_GET_LEN(&rdl->right) +
+ CIRBUF_GET_LEN(&rdl->left) <
+ RDLINE_BUF_SIZE && i < tmp_size) {
cirbuf_add_tail(&rdl->left, tmp_buf[i]);
rdl->write_char(rdl, tmp_buf[i]);
i++;