Aggiunta trattazione del crash del server, eseguite alcune correzioni alla
[gapil.git] / listati / endian.c
diff --git a/listati/endian.c b/listati/endian.c
new file mode 100644 (file)
index 0000000..9929323
--- /dev/null
@@ -0,0 +1,13 @@
+int endian(void)
+{
+/*
+ * Variables definition
+ */
+    short magic, test;
+    char * ptr;
+   
+    magic = 0xABCD;                     /* endianess magic number */
+    ptr = (char *) &magic;              
+    test = (ptr[1]<<8) + (ptr[0]&0xFF); /* build value byte by byte */
+    return (magic == test);             /* if the same is little endian */ 
+}