@@ -122,11 +122,10 @@ static MAYBE_INLINE char *check_bom(char *string)
122122 "Warning: UTF-8 BOM seen in password hash file. You probably want --input-encoding=UTF8\n" );
123123 }
124124 if (options .input_enc == UTF_8 && (!memcmp (string , "\xFE\xFF" , 2 ) || !memcmp (string , "\xFF\xFE" , 2 ))) {
125- static int warned ;
126-
127- if (john_main_process && !warned ++ )
128- fprintf (stderr , "Warning: UTF-16 BOM seen in password hash file. "
129- "File may not be read properly unless you re-encode it\n" );
125+ if (john_main_process )
126+ WARN_ONCE (color_warning , stderr ,
127+ "Warning: UTF-16 BOM seen in password hash file. "
128+ "File may not be read properly unless you re-encode it\n" );
130129 }
131130 return string ;
132131}
@@ -254,13 +253,17 @@ static void read_file(struct db_main *db, char *name, int flags,
254253 options .input_enc == UTF_8 )) {
255254 if (!valid_utf8 ((UTF8 * )u8check )) {
256255 warn_enc = 0 ;
257- fprintf (stderr , "Warning: invalid UTF-8 seen reading %s\n" , path_expand (name ));
256+ fprintf_color (color_warning , stderr ,
257+ "Warning: invalid UTF-8 seen reading %s\n" ,
258+ path_expand (name ));
258259 }
259260 } else if (options .input_enc != UTF_8 &&
260261 (line != line_buf ||
261262 valid_utf8 ((UTF8 * )u8check ) > 1 )) {
262263 warn_enc = 0 ;
263- fprintf (stderr , "Warning: UTF-8 seen reading %s\n" , path_expand (name ));
264+ fprintf_color (color_warning , stderr ,
265+ "Warning: UTF-8 seen reading %s\n" ,
266+ path_expand (name ));
264267 }
265268 }
266269 process_line (db , line );
@@ -1012,18 +1015,13 @@ static void ldr_load_pw_line(struct db_main *db, char *line)
10121015
10131016 if (john_main_process ) {
10141017 if (format -> params .binary_size )
1015- fprintf (stderr , "Warning: "
1016- "excessive partial hash "
1017- "collisions detected\n%s" ,
1018- db -> password_hash_func !=
1019- fmt_default_binary_hash ? "" :
1020- "(cause: the \"format\" lacks "
1021- "proper binary_hash() function "
1022- "definitions)\n" );
1018+ fprintf_color (color_warning , stderr ,
1019+ "Warning: excessive partial hash collisions detected\n%s" ,
1020+ db -> password_hash_func != fmt_default_binary_hash ? "" :
1021+ "(cause: the \"format\" lacks proper binary_hash() function definitions)\n" );
10231022 else
1024- fprintf (stderr , "Warning: "
1025- "check for duplicates partially "
1026- "bypassed to speedup loading\n" );
1023+ fprintf_color (color_warning , stderr ,
1024+ "Warning: check for duplicates partially bypassed to speedup loading\n" );
10271025 }
10281026 dupe_checking = 0 ;
10291027 current_pw = NULL ; /* no match */
0 commit comments