aboutsummaryrefslogtreecommitdiff
path: root/ch4/4-10_getline-calc.c
diff options
context:
space:
mode:
authorzlg <zlg@zlg.space>2016-06-16 10:15:33 -0700
committerzlg <zlg@zlg.space>2016-06-16 10:15:33 -0700
commitf8d9ff23eb8d3e3286ff5cf4d5f9493532991bb7 (patch)
treee37b327d7f93435e93a57427600d2b91fbb0cd87 /ch4/4-10_getline-calc.c
parentSolve Exercise 7-2: Format arbitrary input (diff)
downloadknr-f8d9ff23eb8d3e3286ff5cf4d5f9493532991bb7.tar.gz
knr-f8d9ff23eb8d3e3286ff5cf4d5f9493532991bb7.tar.bz2
knr-f8d9ff23eb8d3e3286ff5cf4d5f9493532991bb7.tar.xz
knr-f8d9ff23eb8d3e3286ff5cf4d5f9493532991bb7.zip
The massive astyle sweep!
Code style should be consistent now. All future commits will be run through astyle or they will be amended.
Diffstat (limited to 'ch4/4-10_getline-calc.c')
-rw-r--r--ch4/4-10_getline-calc.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/ch4/4-10_getline-calc.c b/ch4/4-10_getline-calc.c
index 499e71a..a801f0c 100644
--- a/ch4/4-10_getline-calc.c
+++ b/ch4/4-10_getline-calc.c
@@ -63,7 +63,6 @@ int main() {
double op2;
char s[MAXOP];
char ltr;
-
while (mygetline(buf, BUFSIZE) != 0) {
bufp = 0;
while ((type = getop(s)) != '\0') {
@@ -188,7 +187,6 @@ double pop(void) {
int getop(char s[]) {
int i, c;
-
while ((s[0] = c = buf[bufp++]) == ' ' || c == '\t');
if (c >= 'a' && c <= 'z') {
return c;
@@ -210,7 +208,6 @@ int getop(char s[]) {
} else {
s[i] = c;
}
-
if (isdigit(c)) {
while (isdigit(s[++i] = c = buf[bufp++]));
}
@@ -264,7 +261,6 @@ double fetch_last(void) {
int mygetline(char s[], int lim) {
int c, i = 0;
-
while (--lim > 0 && (c = getchar()) != EOF && c != '\n') {
s[i++] = c;
}