Service Pack 1 for a software from 2008 :gg
authorMarkus Bröker<broeker.markus@googlemail.com>
Fri, 20 Oct 2017 06:43:33 +0200
changeset 169 df7c720bcaa6
parent 168 dfb60716880c
child 170 5a11538e7bc8
Service Pack 1 for a software from 2008 :gg
Makefile
cppdatabase.cc
data_types.c
mem2swap.c
testcase.c
--- a/Makefile
+++ b/Makefile
@@ -110,7 +110,8 @@
 
 ncurses: ncurses.o
 	@echo Linking $< ...
-	@$(CC) $(LDFLAGS) -o $@ $< -lncursesw
+	@#$(CC) $(LDFLAGS) -o $@ $< -lncursesw
+	@$(CC) $(LDFLAGS) -o $@ $< -lncurses
 
 numerierung: numerierung.o
 	@echo Linking $< ...
@@ -166,7 +167,8 @@
 
 crypt: crypt.o
 	@echo Linking $< ...
-	@$(CC) $(LDFLAGS) -o $@ $< -lcrypt
+	@#$(CC) $(LDFLAGS) -o $@ $< -lcrypt
+	@$(CC) $(LDFLAGS) -o $@ $<
 
 tokenpasting: tokenpasting.o
 	@echo Linking $< ...
--- a/cppdatabase.cc
+++ b/cppdatabase.cc
@@ -30,7 +30,7 @@
 
     struct Person p;
 
-    while ((in.read ((char *)&p, sizeof (Person))) != NULL) {
+    while ((in.read ((char *)&p, sizeof (Person))) != 0) {
         std::cout << p.lastname << ", " << p.firstname << ", " <<
             p.position << std::endl;
     }
--- a/data_types.c
+++ b/data_types.c
@@ -20,7 +20,6 @@
 
 #ifdef __USE_ISOC99
 typedef unsigned long long ULLONG;
-
 typedef signed long long SLLONG;
 #endif
 
@@ -28,31 +27,31 @@
 {
     printf ("%20s %4s %20s %25s\n\n", "Type", "BITS", "MIN", "MAX");
 
-    printf ("%20s %4d %20d %25d\n", "   signed char", 8 * sizeof (SCHAR), CHAR_MIN, CHAR_MAX);
-    printf ("%20s %4d %20d %25d\n", "  signed short", 8 * sizeof (SSHORT), SHRT_MIN, SHRT_MAX);
-    printf ("%20s %4d %20d %25d\n", "    signed int", 8 * sizeof (SINT), INT_MIN, INT_MAX);
-    printf ("%20s %4d %20ld %25ld\n", "   signed long", 8 * sizeof (SLONG), LONG_MIN, LONG_MAX);
+    printf ("%20s %4lu %20d %25d\n", "   signed char", 8 * sizeof (SCHAR), CHAR_MIN, CHAR_MAX);
+    printf ("%20s %4lu %20d %25d\n", "  signed short", 8 * sizeof (SSHORT), SHRT_MIN, SHRT_MAX);
+    printf ("%20s %4lu %20d %25d\n", "    signed int", 8 * sizeof (SINT), INT_MIN, INT_MAX);
+    printf ("%20s %4lu %20ld %25ld\n", "   signed long", 8 * sizeof (SLONG), LONG_MIN, LONG_MAX);
 
 #ifdef __USE_ISOC99
-    printf ("%20s %4d %20lld %25lld\n\n", "  signed llong", 8 * sizeof (SLLONG), (SLLONG) LLONG_MIN, LLONG_MAX);
+    printf ("%20s %4lu %20lld %25lld\n\n", "  signed llong", 8 * sizeof (SLLONG), (SLLONG) LLONG_MIN, LLONG_MAX);
 #endif
 
-    printf ("%20s %4d %20d %25u\n", " unsigned char", 8 * sizeof (UCHAR), 0, UCHAR_MAX);
-    printf ("%20s %4d %20d %25u\n", "unsigned short", 8 * sizeof (USHORT), 0, USHRT_MAX);
+    printf ("%20s %4lu %20d %25u\n", " unsigned char", 8 * sizeof (UCHAR), 0, UCHAR_MAX);
+    printf ("%20s %4lu %20d %25u\n", "unsigned short", 8 * sizeof (USHORT), 0, USHRT_MAX);
 
-    printf ("%20s %4d %20d %25u\n", "  unsigned int", 8 * sizeof (UINT), 0, UINT_MAX);
-    printf ("%20s %4d %20lu %25lu\n", " unsigned long", 8 * sizeof (ULONG), 0UL, ULONG_MAX);
+    printf ("%20s %4lu %20d %25u\n", "  unsigned int", 8 * sizeof (UINT), 0, UINT_MAX);
+    printf ("%20s %4lu %20lu %25lu\n", " unsigned long", 8 * sizeof (ULONG), 0UL, ULONG_MAX);
 
 #ifdef __USE_ISOC99
-    printf ("%20s %4d %20llu %25llu\n", "unsigned llong", 8 * sizeof (ULLONG), 0ULL, ULLONG_MAX);
+    printf ("%20s %4lu %20llu %25llu\n", "unsigned llong", 8 * sizeof (ULLONG), 0ULL, ULLONG_MAX);
 #endif
 
 #ifdef __USE_ISOC99
-    printf ("\n%20s %4d %20d  %20d\n", "_Bool", 8 * sizeof (_Bool), 0, 1);
+    printf ("\n%20s %4lu %20d  %20d\n", "_Bool", 8 * sizeof (_Bool), 0, 1);
 #endif
 
-    printf ("\n%20s %4d \t\t %#1.2g \t\t %#1.2g\n", "float", 8 * sizeof (float), (double)FLT_MIN, (double)FLT_MAX);
-    printf ("%20s %4d \t\t %#1.2g \t\t %#1.2g\n", "double", 8 * sizeof (double), (double)DBL_MIN, (double)DBL_MAX);
+    printf ("\n%20s %4lu \t\t %#1.2g \t\t %#1.2g\n", "float", 8 * sizeof (float), (double)FLT_MIN, (double)FLT_MAX);
+    printf ("%20s %4lu \t\t %#1.2g \t\t %#1.2g\n", "double", 8 * sizeof (double), (double)DBL_MIN, (double)DBL_MAX);
 
     return EXIT_SUCCESS;
 }
--- a/mem2swap.c
+++ b/mem2swap.c
@@ -23,6 +23,9 @@
 #elif __unix__
 #define CMD_FREE "/sbin/sysctl"
 #define CMD_ARGS "hw.usermem"
+#else
+#define CMD_FREE "/sbin/sysctl"
+#define CMD_ARGS "hw.usermem"
 #endif
 
 int set_limit (int);
--- a/testcase.c
+++ b/testcase.c
@@ -3,7 +3,7 @@
  * Copyright (C) 2008 Markus Broeker
  */
 
-#define _XOPEN_SOURCE 500
+#define _XOPEN_SOURCE 600
 
 #include <stdio.h>
 #include <stdlib.h>