--- sourceforge.net/trunk/rdesktop/rdesktop.c 2000/10/16 08:44:48 21 +++ sourceforge.net/trunk/rdesktop/rdesktop.c 2001/01/06 03:47:04 25 @@ -18,13 +18,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include /* malloc realloc free */ -#include /* read close getuid getgid getpid getppid gethostname */ -#include /* open */ -#include /* getpwuid */ -#include /* stat */ -#include /* gettimeofday */ -#include /* times */ +#include /* malloc realloc free */ +#include /* read close getuid getgid getpid getppid gethostname */ +#include /* open */ +#include /* getpwuid */ +#include /* stat */ +#include /* gettimeofday */ +#include /* times */ #include "rdesktop.h" char username[16]; @@ -37,7 +37,8 @@ BOOL licence = True; /* Display usage information */ -static void usage(char *program) +static void +usage(char *program) { STATUS("Usage: %s [options] server\n", program); STATUS(" -u: user name\n"); @@ -55,7 +56,8 @@ } /* Client program */ -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { struct passwd *pw; char *server; @@ -68,7 +70,8 @@ int c; STATUS("rdesktop: A Remote Desktop Protocol client.\n"); - STATUS("Version "VERSION". Copyright (C) 1999-2000 Matt Chapman.\n"); + STATUS("Version " VERSION + ". Copyright (C) 1999-2000 Matt Chapman.\n"); STATUS("See http://www.rdesktop.org/ for more information.\n\n"); flags = RDP_LOGON_NORMAL; @@ -182,10 +185,12 @@ } /* Generate a 32-byte random for the secure transport code. */ -void generate_random(uint8 *random) +void +generate_random(uint8 *random) { struct stat st; - uint32 *r = (uint32 *)random; + struct tms tmsbuf; + uint32 *r = (uint32 *) random; int fd; /* If we have a kernel random device, use it. */ @@ -199,8 +204,8 @@ /* Otherwise use whatever entropy we can gather - ideas welcome. */ r[0] = (getpid()) | (getppid() << 16); r[1] = (getuid()) | (getgid() << 16); - r[2] = times(NULL); /* system uptime (clocks) */ - gettimeofday((struct timeval *)&r[3], NULL); /* sec and usec */ + r[2] = times(&tmsbuf); /* system uptime (clocks) */ + gettimeofday((struct timeval *) &r[3], NULL); /* sec and usec */ stat("/tmp", &st); r[5] = st.st_atime; r[6] = st.st_mtime; @@ -208,7 +213,8 @@ } /* malloc; exit if out of memory */ -void *xmalloc(int size) +void * +xmalloc(int size) { void *mem = malloc(size); if (mem == NULL) @@ -220,7 +226,8 @@ } /* realloc; exit if out of memory */ -void *xrealloc(void *oldmem, int size) +void * +xrealloc(void *oldmem, int size) { void *mem = realloc(oldmem, size); if (mem == NULL) @@ -232,13 +239,15 @@ } /* free */ -void xfree(void *mem) +void +xfree(void *mem) { free(mem); } /* Produce a hex dump */ -void hexdump(unsigned char *p, unsigned int len) +void +hexdump(unsigned char *p, unsigned int len) { unsigned char *line = p; unsigned int thisline, offset = 0; @@ -252,13 +261,13 @@ thisline = 16; for (i = 0; i < thisline; i++) - STATUS("%02x ", line[i]) - - for (; i < 16; i++) - STATUS(" "); + STATUS("%02x ", line[i]) for (; i < 16; i++) + STATUS(" "); for (i = 0; i < thisline; i++) - STATUS("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.'); + STATUS("%c", + (line[i] >= 0x20 + && line[i] < 0x7f) ? line[i] : '.'); STATUS("\n"); offset += thisline;