esac
AC_SUBST(release_info)
+EFL_CHECK_PATH_MAX
### Default options with respect to host
--- /dev/null
+dnl Check for PATH_MAX in limits.h, and define a default value if not found
+dnl This is a workaround for systems not providing PATH_MAX, like GNU/Hurd
+
+dnl EFL_CHECK_PATH_MAX([DEFAULT_VALUE_IF_NOT_FOUND])
+dnl
+dnl If PATH_MAX is not defined in <limits.h>, defines it
+dnl to DEFAULT_VALUE_IF_NOT_FOUND if it exists, or fallback
+dnl to using 4096
+
+AC_DEFUN([EFL_CHECK_PATH_MAX],
+[
+
+default_max=m4_default([$1], "4096")
+AC_LANG_PUSH([C])
+
+AC_MSG_CHECKING([for PATH_MAX in limits.h])
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+#include <limits.h>
+ ]],
+ [[
+int i = PATH_MAX;
+ ]])],
+ [AC_MSG_RESULT([yes])],
+ [
+ AC_DEFINE_UNQUOTED([PATH_MAX],
+ [${default_max}],
+ [default value since PATH_MAX is not defined])
+ AC_MSG_RESULT([no: using ${default_max}])
+ ])
+
+AC_LANG_POP([C])
+
+])
+dnl end of efl_path_max.m4
embryo_cc_SOURCES = \
embryo_cc_amx.h \
-embryo_cc_osdefs.h \
embryo_cc_sc.h \
embryo_cc_sc1.c \
embryo_cc_sc2.c \
* Version: $Id$
*/
-#include "embryo_cc_osdefs.h"
-
#ifndef EMBRYO_CC_AMX_H
#define EMBRYO_CC_AMX_H
-/*
- * Copyright 1998-2003, ITB CompuPhase, The Netherlands.
- * info@compuphase.com.
- */
-
-#ifndef EMBRYO_CC_OSDEFS_H
-# define EMBRYO_CC_OSDEFS_H
-
-# ifdef HAVE_STDINT_H
-# include <stdint.h>
-# endif
-
-/* _MAX_PATH is sometimes called differently and it may be in limits.h instead
- * stdio.h.
- */
-# if !defined _MAX_PATH
-/* not defined, perhaps stdio.h was not included */
-# include <stdio.h>
-# if !defined _MAX_PATH
-/* still undefined, try a common alternative name */
-# if defined MAX_PATH
-# define _MAX_PATH MAX_PATH
-# else
-/* no _MAX_PATH and no MAX_PATH, perhaps it is in limits.h */
-# include <limits.h>
-# if defined PATH_MAX
-# define _MAX_PATH PATH_MAX
-# elif defined _POSIX_PATH_MAX
-# define _MAX_PATH _POSIX_PATH_MAX
-# else
-/* everything failed, actually we have a problem here... */
-# define _MAX_PATH 4096
-# endif
-# endif
-# endif
-# endif
-
-#endif
#include <stdio.h>
#include <setjmp.h>
-#include "embryo_cc_osdefs.h"
#include "embryo_cc_amx.h"
/* Note: the "cell" and "ucell" types are defined in AMX.H */
# include <Evil.h>
#endif /* HAVE_EVIL */
-#include "embryo_cc_osdefs.h"
#include "embryo_cc_sc.h"
#include "embryo_cc_prefix.h"
static int skipinput = 0; /* number of lines to skip from the first input file */
static int wq[wqTABSZ]; /* "while queue", internal stack for nested loops */
static int *wqptr; /* pointer to next entry */
-static char binfname[_MAX_PATH]; /* binary file name */
+static char binfname[PATH_MAX]; /* binary file name */
int
main(int argc, char *argv[], char *env[] __UNUSED__)
{
- char argv0[_MAX_PATH];
+ char argv0[PATH_MAX];
int i;
- snprintf(argv0, _MAX_PATH, "%s", argv[0]);
+ snprintf(argv0, sizeof(argv0), "%s", argv[0]);
/* Linux stores the name of the program in argv[0], but not the path.
* To adjust this, I store a string with the path in argv[0]. To do
* so, I try to get the current path with getcwd(), and if that fails
* I search for the PWD= setting in the environment.
*/
- if (NULL != getcwd(argv0, _MAX_PATH))
+ if (NULL != getcwd(argv0, PATH_MAX))
{
i = strlen(argv0);
- snprintf(argv0 + i, _MAX_PATH - i, "/%s", argv[0]);
+ snprintf(argv0 + i, sizeof(argv0) - i, "/%s", argv[0]);
}
else
{
char *pwd = getenv("PWD");
if (pwd != NULL)
- snprintf(argv0, _MAX_PATH, "%s/%s", pwd, argv[0]);
+ snprintf(argv0, sizeof(argv0), "%s/%s", pwd, argv[0]);
} /* if */
argv[0] = argv0; /* set location to new first parameter */
{
int entry, i, jmpcode, fd_out;
int retcode;
- char incfname[_MAX_PATH];
- char reportname[_MAX_PATH];
+ char incfname[PATH_MAX];
+ char reportname[PATH_MAX];
FILE *binf;
void *inpfmark;
char lcl_ctrlchar;
goto cleanup;
/* allocate memory for fixed tables */
- inpfname = (char *)malloc(_MAX_PATH);
+ inpfname = (char *)malloc(PATH_MAX);
litq = (cell *) malloc(litmax * sizeof(cell));
if (litq == NULL)
error(103); /* insufficient memory */
tmpdir = (char *)evil_tmpdir_get();
#endif /* ! HAVE_EVIL */
- snprintf(outfname, _MAX_PATH, "%s/embryo_cc.asm-tmp-XXXXXX", tmpdir);
+ snprintf(outfname, PATH_MAX, "%s/embryo_cc.asm-tmp-XXXXXX", tmpdir);
fd_out = mkstemp(outfname);
if (fd_out < 0)
error(101, outfname);
static void
setconfig(char *root)
{
- char path[_MAX_PATH];
+ char path[PATH_MAX];
char *ptr;
int len;
#include <string.h>
#include <ctype.h>
#include <math.h>
-#include "embryo_cc_osdefs.h"
#include "embryo_cc_sc.h"
#include "Embryo.h"
{
for (i = 0; !result && (ptr = get_path(i)) != NULL; i++)
{
- char path[_MAX_PATH];
+ char path[PATH_MAX];
strncpy(path, ptr, sizeof path);
path[sizeof path - 1] = '\0'; /* force '\0' termination */
static void
doinclude(void)
{
- char name[_MAX_PATH], c;
+ char name[PATH_MAX], c;
int i, result;
while (*lptr <= ' ' && *lptr != 0) /* skip leading whitespace */
case tpFILE:
if (skiplevel == 0)
{
- char pathname[_MAX_PATH];
+ char pathname[PATH_MAX];
lptr = getstring(pathname, sizeof pathname, lptr);
if (pathname[0] != '\0')
#include <assert.h>
#include <stdio.h>
-#include <stdlib.h> /* for _MAX_PATH */
+#include <limits.h> /* for PATH_MAX */
#include <string.h>
#include "embryo_cc_sc.h"
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
-#include <stdlib.h> /* for _MAX_PATH */
+#include <limits.h> /* for PATH_MAX */
#include <string.h>
#include "embryo_cc_sc.h"
#include <stdlib.h> /* for macro max() */
#include <string.h>
#include <ctype.h>
-#include "embryo_cc_osdefs.h"
#include "embryo_cc_sc.h"
typedef cell(*OPCODE_PROC) (FILE * fbin, char *params, cell opcode);
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
-#include <stdlib.h> /* for _MAX_PATH */
+#include <config.h> /* for PATH_MAX */
#include "embryo_cc_sc.h"
/* global variables
constvalue *curlibrary = NULL; /* current library */
symbol *curfunc; /* pointer to current function */
char *inpfname; /* pointer to name of the file currently read from */
-char outfname[_MAX_PATH]; /* output file name */
+char outfname[PATH_MAX]; /* output file name */
char sc_ctrlchar = CTRL_CHAR; /* the control character (or escape character) */
int litidx = 0; /* index to literal table */
int litmax = sDEF_LITMAX; /* current size of the literal table */
>\r
</File>\r
<File\r
- RelativePath="..\..\src\bin\embryo_cc_osdefs.h"\r
- >\r
- </File>\r
- <File\r
RelativePath="..\..\src\bin\embryo_cc_prefix.h"\r
>\r
</File>\r