diff options
author | zlg <zlg@zlg.space> | 2013-01-29 23:34:57 -0600 |
---|---|---|
committer | zlg <zlg@zlg.space> | 2013-01-29 23:34:57 -0600 |
commit | 0cf71f1358f9fe4d2b597283ab4d43200c2dc4ac (patch) | |
tree | 0a88fb0e507fa226dab8bf076961a81ea597bd3e /1-22_wordwrap.c | |
parent | Solve Exercise 1-22: wordwrap (diff) | |
download | knr-0cf71f1358f9fe4d2b597283ab4d43200c2dc4ac.tar.gz knr-0cf71f1358f9fe4d2b597283ab4d43200c2dc4ac.tar.bz2 knr-0cf71f1358f9fe4d2b597283ab4d43200c2dc4ac.tar.xz knr-0cf71f1358f9fe4d2b597283ab4d43200c2dc4ac.zip |
Solve exercise 1-23: Remove C comments
Diffstat (limited to '')
-rw-r--r-- | 1-22_wordwrap.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/1-22_wordwrap.c b/1-22_wordwrap.c index 5e17b50..83acfd6 100644 --- a/1-22_wordwrap.c +++ b/1-22_wordwrap.c @@ -53,22 +53,22 @@ int b_find_blank(char s[], int lim) { int main() { while (j = get_line(data, MAXLEN)) { - if (j == 80) { - // We know it's a long line now. Let's make sure we're breaking in - // the right place - k = b_find_blank(data, MAXLEN); - //printf("%d\n", k); - if (k > -1) { - data[k] = '\n'; - data[MAXLEN] = '\0'; - printf("%s", data); - continue; - } else { - data[MAXLEN] = '\0'; - printf("%s\n", data); - continue; - } + if (j == 80) { + // We know it's a long line now. Let's make sure we're breaking in + // the right place + k = b_find_blank(data, MAXLEN); + //printf("%d\n", k); + if (k > -1) { + data[k] = '\n'; + data[MAXLEN] = '\0'; + printf("%s", data); + continue; + } else { + data[MAXLEN] = '\0'; + printf("%s\n", data); + continue; } + } printf("%s", data); } |