dslinux/user/perl/mint Makefile README errno.h pwd.c stdio.h time.h

cayenne dslinux_cayenne at user.in-berlin.de
Mon Dec 4 18:01:19 CET 2006


Update of /cvsroot/dslinux/dslinux/user/perl/mint
In directory antilope:/tmp/cvs-serv17422/mint

Added Files:
	Makefile README errno.h pwd.c stdio.h time.h 
Log Message:
Adding fresh perl source to HEAD to branch from

--- NEW FILE: stdio.h ---
/* Wrapper around broken system stdio.h.  */

#ifndef _PERL_WRAPPER_AROUND_STDIO_H
# define _PERL_WRAPPER_AROUND_STDIO_H 1

/* The MiNTLib has a macro called EOS in stdio.h.  This conflicts
   with regnode.h.  Who had this glorious idea.  */
#ifdef EOS
# define PERL_EOS EOS
#endif

/* First include the system file.  */
#include_next <stdio.h> 

#ifdef EOS
# undef EOS
# define EOS PERL_EOS
#endif

#endif


--- NEW FILE: errno.h ---
/* Wrapper around broken system errno.h.  */

#ifndef _PERL_WRAPPER_AROUND_ERRNO_H
# define _PERL_WRAPPER_AROUND_ERRNO_H 1

/* First include the system file.  */
#include_next <errno.h> 

/* Now add the missing stuff.
#ifndef EAGAIN
# define EAGAIN EWOULDBLOCK
#endif

/* This one is problematic.  If you open() a directory with the
   MiNTLib you can't detect from errno if it is really a directory
   or if the file simply doesn't exist.  You'll get ENOENT 
   ("file not found") in either case.
   
   Defining EISDIR as ENOENT is actually a bad idea but works fine
   in general.  In praxi, if code checks for errno == EISDIR it
   will attempt an opendir() call on the file in question and this
   call will also file if the file really can't be found.  But
   you may get compile-time errors if the errno checking is embedded
   in a switch statement ("duplicate case value in switch").
   
   Anyway, here the define works alright.  */
#ifndef EISDIR
# define EISDIR ENOENT
#endif

#endif


--- NEW FILE: time.h ---
/* Wrapper around broken system time.h.  */

#ifndef _PERL_WRAPPER_AROUND_TIME_H
# define _PERL_WRAPPER_AROUND_TIME_H 1

/* Recent versions of the MiNTLib have a macro HAS_TZNAME in 
   time.h resp. sys/time.h.  Wow, I wonder why they didn't
   define HAVE_CONFIG_H ...  */
#ifdef HAS_TZNAME 
# define PERL_HAS_TZNAME HAS_TZNAME
#endif

/* First include the system file.  */
#include_next <time.h> 

#ifdef HAS_TZNAME
# undef HAS_TZNAME
# define HAS_TZNAME PERL_HAS_TZNAME
#endif

#endif


--- NEW FILE: Makefile ---
# IMPORTANT:  This Makefile is not intended to build Perl itself but
#             only to replace a broken pwd command!

all:	pwd

pwd:	pwd.c
	$(CC) -O3 -o pwd pwd.c

install: pwd
	(new_pwd=`which pwd` && cp -f $$new_pwd $$new_pwd.broken \
		&& cp -f pwd $$new_pwd) 

clean:
	rm -f pwd.o pwd


--- NEW FILE: pwd.c ---
/* pwd.c - replacement for broken pwd command.
 * Copyright 1997 Guido Flohr, <gufl0000 at stud.uni-sb.de>.
 * Do with it as you please.
 */
#include <stdio.h>
#include <limits.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>

#if defined(__STDC__) || defined(__cplusplus)
int main (int argc, char* argv[])
#else
int main (argc, argv)
	int argc;
	char* argv[];
#endif
{
	char path_buf[PATH_MAX + 1];
	
	if (argc > 1) {
		int i;
		
		fflush (stdout);
		fputs (argv[0], stderr);
		fputs (": ignoring garbage arguments\n", stderr);
	}
	
	if (!getcwd (path_buf, PATH_MAX + 1)) {
		fflush (stdout);
		/* Save space, memory and the whales, avoid fprintf.  */
		fputs (argv[0], stderr);
		fputs (": can\'t get current working directory: ", stderr);
		fputs (strerror (errno), stderr);
		fputc ('\n', stderr);
		return 1;
	}
	if (puts (path_buf) < 0) {
		return 1;
	}
	return 0;
}
/* End of pwd.c.  */

--- NEW FILE: README ---
This subdirectory contains some additional files which are necessary
(or at least useful) when compiling Perl on MiNT.

"Makefile" and "pwd.c" will build and install a fixed version of the
pwd command if your system pwd is broken.

The header files are wrappers around broken system header files.  Make
sure that this directory stands at first place in your include path
when compiling Perl.

The file system.c is an enhanced version of the system() function
in the MiNTLib.  It is strongly recommended that you insert this
version into your libc before you compile Perl (see README.MiNT
in the toplevel directory for details).




More information about the dslinux-commit mailing list