14 char *tmp
= strdup(s
);
15 for (c
= tmp
; *c
; c
++)
16 *c
= isprint(*c
) ? *c
: '.';
20 static void expand_custom(char ch
, check_context_t
*ctx
)
32 printf("%llx", swap_be64(ctx
->current_inode
->i_head
.h_self
));
35 s
= escape(ctx
->current_inode
->i_name
);
40 printf("%d", ctx
->hash
);
43 printf("%llx", ctx
->block
);
48 void sad_print(char *fmt
, check_context_t
*ctx
)
52 while ((ch
= *fmt
++) != 0)
56 expand_custom(ch
, ctx
);
69 int prompt_yesno(char *msg
)
71 struct termios saveios
, newios
;
74 tcgetattr(0, &saveios
);
75 memcpy(&newios
, &saveios
, sizeof(struct termios
));
76 newios
.c_lflag
&= ~(ECHO
| ICANON
);
77 newios
.c_cc
[VTIME
] = 0;
78 newios
.c_cc
[VMIN
] = 1;
79 tcsetattr(0, TCSANOW
, &newios
);
81 printf("%s [y/N]", msg
);
84 tcsetattr(0, TCSANOW
, &saveios
);
87 return tolower(ch
) == 'y';