aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/sample.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/sample.c b/examples/sample.c
index cfe4b3a6..93634d80 100644
--- a/examples/sample.c
+++ b/examples/sample.c
@@ -60,9 +60,12 @@ struct ssh_callbacks_struct cb = {
static void add_cmd(char *cmd){
int n;
- for(n=0;cmds[n] && (n<MAXCMD);n++);
- if(n==MAXCMD)
+
+ for (n = 0; (n < MAXCMD) && cmds[n] != NULL; n++);
+
+ if (n == MAXCMD) {
return;
+ }
cmds[n]=strdup(cmd);
}