Hi,

Because splashy by default doesn't show the printf statements, the user
wouldn't know that he/she would have to push a button on splash.getchar.
This adds a prompt to splash.getchar

Index: resume.c
===================================================================
diff -u -r1.29 resume.c
--- resume.c    14 Sep 2006 14:18:58 -0000      1.29
+++ resume.c    16 Sep 2006 13:58:14 -0000
@@ -615,7 +615,7 @@
                        error = load_image(&handle, dev, nr_pages);
        }
        if (error) {
-               fprintf(stderr,
+               c = splash.getchar(
                        "\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.getchar(buffer);
        }
        return error;
 }
Index: splash.c
===================================================================
diff -u -r1.3 splash.c
--- splash.c    14 Sep 2006 14:22:00 -0000      1.3
+++ splash.c    16 Sep 2006 13:58:14 -0000
@@ -27,6 +27,11 @@
 #ifndef CONFIG_ENCRYPT
 static void splash_dummy_readpass (char *a, int b) { }
 #endif
+static int splash_getchar (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->getchar     = splash_getchar;
 #ifdef CONFIG_ENCRYPT
        splash->read_password   = read_password;
 #else
@@ -57,7 +62,7 @@
        } else if (!splashy_open()) {
                splash->finish      = splashy_finish;
                splash->progress    = splashy_progress;
-               splash->getchar     = splashy_getchar;
+               splash->getchar     = splashy_get_char;
                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    16 Sep 2006 13:58:14 -0000
@@ -18,7 +18,7 @@
        int (*progress)   (int p);
        void (*switch_to) (void);
        void (*read_password) (char *, int);
-       int (*getchar) (void);
+       int (*getchar) (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     16 Sep 2006 13:58:14 -0000
@@ -64,8 +64,10 @@
 #endif
 }
 
-void splashy_print(const char *str) {
-       splashy_printline(str);
+int splashy_get_char (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     16 Sep 2006 13:58:14 -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_get_char(const char *);
 void splashy_print(const char *);
 
 #endif

Attachment: signature.asc
Description: PGP signature

-------------------------------------------------------------------------
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

Reply via email to