浏览代码

Better formatting of output

Piotr Czajkowski 6 年之前
父节点
当前提交
aff75df01c
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      pwned.c

+ 5 - 2
pwned.c

@@ -38,13 +38,16 @@ int findSuffix(char *suffix, char *data) {
 	int suffixCount = 0;
 	for (unsigned long i = 0; i < strlen(data); i++) {
 		if (found) {
+			if (data[i] == '\n') {
+				putchar('\n');
+				return found;
+			}
 			putchar(data[i]);
-			if (data[i] == '\n') return found;
 		}
 
 		if (check) {
 			if (data[i] == ':') {
-				puts("This is how many times your password was pwned:");
+				printf("This is how many times your password was pwned: ");
 				found = 1;
 			}
 			if (suffix[suffixCount] != data[i]) check = 0;