Explorar o código

Print data model with system information

bel %!s(int64=9) %!d(string=hai) anos
pai
achega
6fb124abdf
Modificáronse 2 ficheiros con 22 adicións e 5 borrados
  1. 17 0
      src/main.c
  2. 5 5
      test/public_server.c

+ 17 - 0
src/main.c

@@ -969,6 +969,23 @@ start_civetweb(int argc, char *argv[])
 #else
 		fprintf(stdout, "Other\n");
 #endif
+		/* Determine 32/64 bit data mode.
+		 * see https://en.wikipedia.org/wiki/64-bit_computing */
+		fprintf(stdout,
+		        "Data model: i:%u/%u/%u/%u, f:%u/%u/%u, c:%u/%u, "
+		        "p:%u, s:%u, t:%u",
+		        sizeof(short),
+		        sizeof(int),
+		        sizeof(long),
+		        sizeof(long long),
+		        sizeof(float),
+		        sizeof(double),
+		        sizeof(long double),
+		        sizeof(char),
+		        sizeof(wchar_t),
+		        sizeof(void *),
+		        sizeof(size_t),
+		        sizeof(time_t));
 
 		exit(EXIT_SUCCESS);
 	}

+ 5 - 5
test/public_server.c

@@ -1082,17 +1082,17 @@ START_TEST(test_request_handlers)
 
 	(void)expected_cgi_result;
 	(void)cgi_script_content;
-#else	
+#else
 	i = mg_read(client_conn, buf, sizeof(buf));
 	if ((i >= 0) && (i < (int)sizeof(buf))) {
 		while ((i > 0) && ((buf[i - 1] == '\r') || (buf[i - 1] == '\n'))) {
 			i--;
 		}
 		buf[i] = 0;
-	}	
-    /* ck_assert_int_eq(i, (int)strlen(expected_cgi_result)); */
-	ck_assert_str_eq(buf, expected_cgi_result);    
-    ck_assert_str_eq(ri->uri, "200");
+	}
+	/* ck_assert_int_eq(i, (int)strlen(expected_cgi_result)); */
+	ck_assert_str_eq(buf, expected_cgi_result);
+	ck_assert_str_eq(ri->uri, "200");
 	mg_close_connection(client_conn);
 #endif