/[rdesktop]/sourceforge.net/trunk/rdesktop/misc.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /sourceforge.net/trunk/rdesktop/misc.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (show annotations)
Fri Jul 7 09:49:45 2000 UTC (23 years, 11 months ago) by matty
File MIME type: text/plain
File size: 1614 byte(s)
Moved miscellaneous routines into a separate module.

1 /*
2 rdesktop: A Remote Desktop Protocol client.
3 Entrypoint and utility functions
4 Copyright (C) Matthew Chapman 1999-2000
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #include "includes.h"
22
23 void *xmalloc(int size)
24 {
25 void *mem = malloc(size);
26 if (mem == NULL)
27 {
28 fprintf(stderr, "xmalloc: Out of memory.\n");
29 exit(1);
30 }
31 return mem;
32 }
33
34 void *xrealloc(void *oldmem, int size)
35 {
36 void *mem = realloc(oldmem, size);
37 if (mem == NULL)
38 {
39 fprintf(stderr, "xrealloc: Out of memory.\n");
40 exit(1);
41 }
42 return mem;
43 }
44
45 #if DEBUG
46 void dump_data(unsigned char *p, int len)
47 {
48 unsigned char *line = p;
49 int i, j;
50
51 fprintf(stderr, "0000 ");
52
53 for (i = 0; i < len; i++)
54 {
55 if ((i & 15) == 0)
56 {
57 if (i != 0)
58 {
59 for (j = 0; j < 16; j++)
60 fputc(isprint(line[j]) ? line[j] : '.',
61 stderr);
62 line = p + i;
63 fprintf(stderr, "\n%04x ", line-p);
64 }
65 }
66
67 fprintf(stderr, "%02X ", p[i]);
68 }
69
70 fputc('\n', stderr);
71 }
72 #endif

  ViewVC Help
Powered by ViewVC 1.1.26