소스 검색

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;