On Sat, 16 Sep 2006 22:41:08 +0200 "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:
> Can we rename this thing to splash.dialog()? I don't think .getchar() > should print. Sound sensible ;) > The rest looks good, but I think we should ask Holger if he agrees with it. _This_ patch doesn't changes anything for bootsplash.org, it just reorders some things. It could be, however, that the VT switch locking has some advert effect. Here's the patch. I renamed getchar to dialog and removed some white space. Index: bootsplash.c =================================================================== diff -u -r1.2 bootsplash.c --- bootsplash.c 14 Sep 2006 14:18:58 -0000 1.2 +++ bootsplash.c 18 Sep 2006 09:26:50 -0000 @@ -113,10 +113,11 @@ #endif } -int bootsplash_getchar (void) +int bootsplash_dialog (const char *prompt) { int ret; bootsplash_to_verbose(); + printf(prompt); ret = getchar(); bootsplash_to_silent(); Index: bootsplash.h =================================================================== diff -u -r1.2 bootsplash.h --- bootsplash.h 14 Sep 2006 14:18:58 -0000 1.2 +++ bootsplash.h 18 Sep 2006 09:26:50 -0000 @@ -18,6 +18,6 @@ int bootsplash_progress(int p); void bootsplash_switch_to(void); void bootsplash_read_password(char *, int); -int bootsplash_getchar(void); +int bootsplash_dialog(void); #endif /* BOOTSPLASH_H */ Index: resume.c =================================================================== diff -u -r1.29 resume.c --- resume.c 14 Sep 2006 14:18:58 -0000 1.29 +++ resume.c 18 Sep 2006 09:26:50 -0000 @@ -615,7 +615,7 @@ error = load_image(&handle, dev, nr_pages); } if (error) { - fprintf(stderr, + c = splash.dialog( "\nresume: The system snapshot image could not be read.\n\n" #ifdef CONFIG_ENCRYPT "\tThis might be a result of booting a wrong kernel\n" @@ -629,7 +629,6 @@ "\tnow and successful resume. That would badly damage\n" "\taffected filesystems.]\n\n" "\tDo you want to continue boot (Y/n)? "); - c = splash.getchar(); ret = (c == 'n' || c == 'N'); if (ret) { close(fd); @@ -669,9 +668,9 @@ if (!error) { printf("resume: Image successfully loaded\n"); } else { - printf("resume: Error %d loading the image\n" - "\nPress ENTER to continue", error); - splash.getchar(); + sprintf(buffer, "resume: Error %d loading the image\n" + "\nPress ENTER to continue\n", error); + splash.dialog(buffer); } return error; } Index: splash.c =================================================================== RCS file: /cvsroot/suspend/suspend/splash.c,v retrieving revision 1.3 diff -u -r1.3 splash.c --- splash.c 14 Sep 2006 14:22:00 -0000 1.3 +++ splash.c 18 Sep 2006 09:26:50 -0000 @@ -25,8 +25,13 @@ static int splash_dummy_int_int(int p) { return 0; } static void splash_dummy_void_void(void) { return; } #ifndef CONFIG_ENCRYPT -static void splash_dummy_readpass (char *a, int b) { } +static void splash_dummy_readpass(char *a, int b) { } #endif +static int splash_dialog(const char *prompt) +{ + printf(prompt); + return getchar(); +} /* Tries to find a splash system and initializes interface functions */ void splash_prepare(struct splash *splash, int enabled) @@ -36,7 +41,7 @@ splash->finish = splash_dummy_int_void; splash->progress = splash_dummy_int_int; splash->switch_to = splash_dummy_void_void; - splash->getchar = getchar; + splash->dialog = splash_dialog; #ifdef CONFIG_ENCRYPT splash->read_password = read_password; #else @@ -51,13 +56,13 @@ splash->finish = bootsplash_finish; splash->progress = bootsplash_progress; splash->switch_to = bootsplash_switch_to; - splash->getchar = bootsplash_getchar; + splash->dialog = bootsplash_dialog; splash->read_password = bootsplash_read_password; #ifdef CONFIG_SPLASHY } else if (!splashy_open()) { splash->finish = splashy_finish; splash->progress = splashy_progress; - splash->getchar = splashy_getchar; + splash->dialog = splashy_dialog; splash->read_password = splashy_read_password; #endif Index: splash.h =================================================================== diff -u -r1.2 splash.h --- splash.h 14 Sep 2006 14:18:58 -0000 1.2 +++ splash.h 18 Sep 2006 09:26:50 -0000 @@ -14,11 +14,11 @@ /* generic interface functions for an arbitary splash method */ struct splash { - int (*finish) (void); - int (*progress) (int p); + int (*finish) (void); + int (*progress) (int p); void (*switch_to) (void); void (*read_password) (char *, int); - int (*getchar) (void); + int (*dialog) (const char *); }; void splash_prepare(struct splash *splash, int enabled); Index: splashy_funcs.c =================================================================== diff -u -r1.1 splashy_funcs.c --- splashy_funcs.c 14 Sep 2006 14:22:00 -0000 1.1 +++ splashy_funcs.c 18 Sep 2006 09:26:50 -0000 @@ -47,7 +47,7 @@ return 0; } -void splashy_read_password (char *buf, int vrfy) +void splashy_read_password(char *buf, int vrfy) { #if CONFIG_ENCRYPT char *vrfy_buf = vrfy ? buf + PASS_SIZE : buf; @@ -64,8 +64,10 @@ #endif } -void splashy_print(const char *str) { - splashy_printline(str); +int splashy_dailog(const char *prompt) +{ + splashy_printline(prompt); + return splashy_getchar(); } #endif Index: splashy_funcs.h =================================================================== diff -u -r1.1 splashy_funcs.h --- splashy_funcs.h 14 Sep 2006 14:22:00 -0000 1.1 +++ splashy_funcs.h 18 Sep 2006 09:26:50 -0000 @@ -17,7 +17,7 @@ int splashy_finish(void); int splashy_progress(int p); void splashy_read_password(char *, int); -int splashy_getchar(void); +int splashy_dialog(const char *); void splashy_print(const char *); #endif ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Suspend-devel mailing list Suspend-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/suspend-devel