added line feeds when needed (patch from VMiklos <vmiklos@frugalware.org>)

This commit is contained in:
Aurelien Foret 2006-02-01 18:20:13 +00:00
parent de3a0f164c
commit cdc97dd6f2
3 changed files with 8 additions and 1 deletions

View file

@ -35,7 +35,7 @@
extern config_t *config; extern config_t *config;
static int neednl; /* for cleaner message output */ int neednl; /* for cleaner message output */
/* Callback to handle notifications from the library /* Callback to handle notifications from the library
*/ */

View file

@ -59,6 +59,8 @@ list_t *pm_targets = NULL;
int maxcols = 80; int maxcols = 80;
extern int neednl;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int ret = 0; int ret = 0;
@ -246,6 +248,9 @@ void cleanup(int signum)
muntrace(); muntrace();
#endif #endif
if(neednl) {
putchar('\n');
}
fflush(stdout); fflush(stdout);
exit(signum); exit(signum);

View file

@ -40,6 +40,7 @@
#include "conf.h" #include "conf.h"
extern int maxcols; extern int maxcols;
extern int neednl;
extern config_t *config; extern config_t *config;
/* does the same thing as 'mkdir -p' */ /* does the same thing as 'mkdir -p' */
@ -203,6 +204,7 @@ int yesno(char *fmt, ...)
vprintf(fmt, args); vprintf(fmt, args);
va_end(args); va_end(args);
fflush(stdout); fflush(stdout);
neednl = 1;
if(fgets(response, 32, stdin)) { if(fgets(response, 32, stdin)) {
/* trim whitespace and newlines */ /* trim whitespace and newlines */
char *pch = response; char *pch = response;