Use a macro for the configured message subject. v1.2.0
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 6 Dec 2009 00:39:24 +0000 (22:39 -0200)
committerThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Sun, 6 Dec 2009 00:39:24 +0000 (22:39 -0200)
hello.c

diff --git a/hello.c b/hello.c
index 25c722d..772a1e3 100644 (file)
--- a/hello.c
+++ b/hello.c
@@ -4,11 +4,15 @@
 /* Should be declared to not taint the kernel. */
 MODULE_LICENSE("GPL");
 
+#ifndef SUBJECT
+#define SUBJECT "world"
+#endif
+
 /* Our init function: returns 0 if successfull, an error code, otherwise. */
 static int hello_init(void)
 {
        /* printk is just like printf, but without floating point support. */
-       printk(KERN_ALERT "Hello, world!\n");
+       printk(KERN_ALERT "Hello, " SUBJECT "!\n");
        return 0;
 }
 
@@ -16,7 +20,7 @@ static int hello_init(void)
 static void hello_exit(void)
 {
        /* KERN_ALERT is a string macro prepended to our message. */
-       printk(KERN_ALERT "Goodbye, cruel world!\n");
+       printk(KERN_ALERT "Goodbye, cruel " SUBJECT "!\n");
 }
 
 /* Here, we declare our module init and exit functions. */