- Implemented InterlockedBitTestAndReset, InterlockedBitTestAndSet, InterlockedExchan...
[reactos.git] / reactos / ntoskrnl / mkconfig.c
index 5766afe..5c51489 100644 (file)
@@ -1,3 +1,13 @@
+/* $Id$
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS kernel
+ * FILE:            ntoskrnl/mkconfig.c
+ * PURPOSE:         No purpose listed.
+ *
+ * PROGRAMMERS:     No programmer listed.
+ */
+
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -44,7 +54,7 @@ write_if_change(char* outbuf, char* filename)
       fclose(out);
       return(1);
     }
-  if (memcmp(cmpbuf, outbuf, max(end, strlen(outbuf))) == 0)
+  if (end == strlen(outbuf) && memcmp(cmpbuf, outbuf, end) == 0)
     {
       fclose(out);
       return(0);
@@ -75,6 +85,7 @@ main(int argc, char* argv[])
   unsigned int i;
   char* outbuf;
   char* s;
+  char config[512];
 
   if (argc == 1)
     {
@@ -90,11 +101,22 @@ main(int argc, char* argv[])
     }
 
   s = outbuf;
-  s = s + sprintf(s, "/* Automatically generated, don't edit */\n");
+  s = s + sprintf(s, "/* Automatically generated, ");
+  s = s + sprintf(s, "Edit the Makefile to change configuration */\n");
+  s = s + sprintf(s, "#ifndef __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H\n");
+  s = s + sprintf(s, "#define __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H\n");
+  strcpy(config, "");
   for (i = 2; i < argc; i++)
     {
       s = s + sprintf(s, "#define %s\n", argv[i]);
+      strcat(config, argv[i]);
+      if (i != (argc - 1))
+       {
+         strcat(config, " ");
+       }
     }
+  s = s + sprintf(s, "#define CONFIG \"%s\"\n", config);
+  s = s + sprintf(s, "#endif /* __NTOSKRNL_INCLUDE_INTERNAL_CONFIG_H */\n");
 
   return(write_if_change(outbuf, argv[1]));
 }