[go: up one dir, main page]

File: misc.c

package info (click to toggle)
diction 1.14-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 968 kB
  • sloc: sh: 3,413; ansic: 2,644; makefile: 89
file content (60 lines) | stat: -rw-r--r-- 1,256 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* Notes */ /*{{{C}}}*//*{{{*/
/*

This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

*/
/*}}}*/
/* #includes *//*{{{*/
#ifndef NO_POSIX_SOURCE
#undef  _POSIX_SOURCE
#define _POSIX_SOURCE 1
#undef  _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 2
#endif

#ifdef DMALLOC
#include "dmalloc.h"
#endif

#include <sys/types.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "config.h"

#include "misc.h"
/*}}}*/

#ifdef BROKEN_REALLOC
/* myrealloc   -- ANSI conforming realloc() */ /*{{{*/
#undef realloc
void *myrealloc(void *p, size_t n)
{
  return (p==(void*)0 ? malloc(n) : realloc(p,n));
}
/*}}}*/
#endif
#ifndef HAVE_STRERROR
/* strerror    -- ANSI strerror */ /*{{{*/
extern int sys_nerr;
extern char *sys_errlist[];

char *strerror(int err)
{
  assert(err>=0);
  assert(err<sys_nerr);
  return sys_errlist[err];
}
/*}}}*/
#endif