| 1 | /* | 
|---|
| 2 | * gawkmisc.c --- miscellanious gawk routines that are OS specific. | 
|---|
| 3 | */ | 
|---|
| 4 |  | 
|---|
| 5 | /* | 
|---|
| 6 | * Copyright (C) 1986, 1988, 1989, 1991-2004 the Free Software Foundation, Inc. | 
|---|
| 7 | * | 
|---|
| 8 | * This file is part of GAWK, the GNU implementation of the | 
|---|
| 9 | * AWK Programming Language. | 
|---|
| 10 | * | 
|---|
| 11 | * GAWK is free software; you can redistribute it and/or modify | 
|---|
| 12 | * it under the terms of the GNU General Public License as published by | 
|---|
| 13 | * the Free Software Foundation; either version 2 of the License, or | 
|---|
| 14 | * (at your option) any later version. | 
|---|
| 15 | * | 
|---|
| 16 | * GAWK is distributed in the hope that it will be useful, | 
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 19 | * GNU General Public License for more details. | 
|---|
| 20 | * | 
|---|
| 21 | * You should have received a copy of the GNU General Public License | 
|---|
| 22 | * along with this program; if not, write to the Free Software | 
|---|
| 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA | 
|---|
| 24 | */ | 
|---|
| 25 |  | 
|---|
| 26 | #include "awk.h" | 
|---|
| 27 |  | 
|---|
| 28 | #if defined(HAVE_FCNTL_H) | 
|---|
| 29 | #include <fcntl.h> | 
|---|
| 30 | #endif | 
|---|
| 31 |  | 
|---|
| 32 | /* some old compilers don't grok #elif. sigh */ | 
|---|
| 33 |  | 
|---|
| 34 | #ifdef __EMX__ | 
|---|
| 35 | #include "pc/gawkmisc.pc" | 
|---|
| 36 | #else /* not __EMX__ */ | 
|---|
| 37 | #if defined(MSDOS) || defined(OS2) || defined(WIN32) | 
|---|
| 38 | #include "gawkmisc.pc" | 
|---|
| 39 | #else /* not MSDOS, not OS2, not WIN32 */ | 
|---|
| 40 | #if defined(VMS) | 
|---|
| 41 | #include "vms/gawkmisc.vms" | 
|---|
| 42 | #else /* not VMS */ | 
|---|
| 43 | #if defined(atarist) | 
|---|
| 44 | #include "unsupported/atari/gawkmisc.atr" | 
|---|
| 45 | #else /* not atarist */ | 
|---|
| 46 | #if defined(TANDEM) | 
|---|
| 47 | #include "tmiscc" | 
|---|
| 48 | #else /* not TANDEM */ | 
|---|
| 49 | #include "posix/gawkmisc.c" | 
|---|
| 50 | #endif /* not TANDEM */ | 
|---|
| 51 | #endif /* not atarist */ | 
|---|
| 52 | #endif /* not VMS */ | 
|---|
| 53 | #endif /* not MSDOS, not OS2, not WIN32 */ | 
|---|
| 54 | #endif /* not __EMX__ */ | 
|---|
| 55 |  | 
|---|
| 56 | /* xmalloc --- provide this so that other GNU library routines work */ | 
|---|
| 57 |  | 
|---|
| 58 | #if __STDC__ | 
|---|
| 59 | typedef void *pointer; | 
|---|
| 60 | #else | 
|---|
| 61 | typedef char *pointer; | 
|---|
| 62 | #endif | 
|---|
| 63 |  | 
|---|
| 64 | extern pointer xmalloc P((size_t bytes));       /* get rid of gcc warning */ | 
|---|
| 65 |  | 
|---|
| 66 | pointer | 
|---|
| 67 | xmalloc(size_t bytes) | 
|---|
| 68 | { | 
|---|
| 69 | pointer p; | 
|---|
| 70 |  | 
|---|
| 71 | emalloc(p, pointer, bytes, "xmalloc"); | 
|---|
| 72 |  | 
|---|
| 73 | return p; | 
|---|
| 74 | } | 
|---|