diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-08-08 02:50:00 +0200 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-08-08 03:06:05 +0200 |
commit | bb0b20dcce7493b583f3774606527ca6776e392c (patch) | |
tree | 57f679e4ebe2294b7b2ce35595c479942f3dda55 /src/actions.c | |
parent | 9705efbde06e6b4d7758b2a7a3ff6373690e69fc (diff) | |
download | ratpoison-bb0b20dcce7493b583f3774606527ca6776e392c.zip |
Consistent formatting in cmd_sfrestore.
Diffstat (limited to 'src/actions.c')
-rw-r--r-- | src/actions.c | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/src/actions.c b/src/actions.c index c723360..2de51fd 100644 --- a/src/actions.c +++ b/src/actions.c @@ -5515,61 +5515,63 @@ cmd_sfrestore (int interactively UNUSED, struct cmdarg **args) int restored = 0; int i; - for (i=0; i<num_screens; i++) { - buffer[i] = sbuf_new(0); - } + for (i = 0; i < num_screens; i++) + buffer[i] = sbuf_new (0); - copy = xstrdup (ARG_STRING(0)); + copy = xstrdup (ARG_STRING (0)); token = strtok (copy, ","); - if (token == NULL) { - free (copy); - return cmdret_new (RET_FAILURE, "sfrestore: invalid frame format"); - } + if (token == NULL) + { + free (copy); + return cmdret_new (RET_FAILURE, "sfrestore: invalid frame format"); + } - while (token != NULL) { - /* search for end of frameset */ - ptr = token; - while (*ptr != ')') { + while (token != NULL) + { + /* search for end of frameset */ + ptr = token; + while (*ptr != ')') + ptr++; ptr++; - } - ptr++; - screen = strtol (ptr, NULL, 10); + screen = strtol (ptr, NULL, 10); - /* clobber screen number here, frestore() doesn't need it */ - *ptr = '\0'; + /* clobber screen number here, frestore() doesn't need it */ + *ptr = '\0'; - /* check that specified screen number is valid */ - if (screen < num_screens) { - sbuf_concat(buffer[screen], token); - sbuf_concat(buffer[screen], ","); - restored++; - } - else { - out_of_screen++; - } + /* check that specified screen number is valid */ + if (screen < num_screens) + { + sbuf_concat (buffer[screen], token); + sbuf_concat (buffer[screen], ","); + restored++; + } + else + out_of_screen++; - /* continue with next frameset */ - token = strtok (NULL, ","); - } + /* continue with next frameset */ + token = strtok (NULL, ","); + } free (copy); /* now restore the frames for each screen */ - for (i=0; i<num_screens; i++) { - push_frame_undo (&screens[i]); /* fdump to stack */ - /* FIXME: store RET_SUCCESS || RET_FAILURE for each screen and output it later */ - frestore (sbuf_get(buffer[i]), &screens[i]); - sbuf_free(buffer[i]); - } + for (i = 0; i < num_screens; i++) + { + push_frame_undo (&screens[i]); /* fdump to stack */ + /* FIXME: store RET_SUCCESS || RET_FAILURE for each screen and output + it later */ + frestore (sbuf_get (buffer[i]), &screens[i]); + sbuf_free (buffer[i]); + } - if (!out_of_screen) { + if (!out_of_screen) return cmdret_new (RET_SUCCESS, "Restored %i Frame(s)", restored); - } - else { - return cmdret_new (RET_SUCCESS, "Restored %i Frame(s), %i Frame(s) out of Screen(s)", restored, out_of_screen); - } + else + return cmdret_new (RET_SUCCESS, + "Restored %i Frame(s), %i Frame(s) out of Screen(s)", + restored, out_of_screen); } cmdret * |