*
* Author: S. Piccardi
*
- * $Id: Gapil.h,v 1.11 2003/05/06 11:29:16 piccardi Exp $
+ * $Id: Gapil.h,v 1.12 2003/08/16 18:30:21 piccardi Exp $
*
*****************************************************************************/
#include <sys/sem.h> /* IPC semaphore declarations */
void * FindShm(char * shm_name, off_t shm_size);
/* Function RemoveShm: remove a POSIX shared memory */
int RemoveShm(char * shm_name);
+/*
+ * General purpose functions. See corresponding .c
+ */
+int endian(void);
LIB = libgapil.so
-OBJ = FullRead.o FullWrite.o SigHand.o Mutex.o SharedMem.o LockFile.o DirScan.o
+OBJ = FullRead.o FullWrite.o SigHand.o Mutex.o SharedMem.o LockFile.o \
+ DirScan.o endian.o
FINAL = forktest errcode echo echod daytimed iterdaytimed daytime testfopen \
testren fortune fortuned mqfortune mqfortuned flock myls dirmonitor \
* Author: S. Piccardi
* May. 2003
*
- * $Id: endian.c,v 1.4 2003/08/16 18:22:25 piccardi Exp $
+ * $Id: endian.c,v 1.5 2003/08/16 18:30:21 piccardi Exp $
*
***************************************************************/
-#include <stdio.h>
-int main(int argc, char *argv[])
+int endian(void)
{
/*
* Variables definition
short magic, test;
char * ptr;
- magic = 0xABCD; /* endianess magic number */
- ptr = (char *) &magic;
- printf("Upper = %x\n", ptr[1]);
- printf("Lower = %x\n", ptr[0]);
- test = (ptr[1]<<8) + (ptr[0]&0xFF);
- printf("magic=%x, test=%x\n", magic, test);
- return (magic == test);
+ 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 */
}