Changeset 123


Ignore:
Timestamp:
May 12, 2003, 12:48:43 PM (22 years ago)
Author:
zap
Message:

Started the work for re-designing the EMX C runtime library to not require
EMX.DLL. The new design is projected to be as follows:

  • all emx syscalls are replaced with the routines from the old sys.lib library which is now compilable in both a.out and OMF formats.
  • the sys.a library should be made replaceable and selectable by some gcc switch (e.g. -msyslib=emx would link with emx.a instead of sys.a which would give almost full backward compatibility with emx).
  • All C functions names were renamed to not contain the starting underscore (e.g. fopen and not _fopen). The underscored aliases will be added later with the c_alias library (which will be generated automatically from all public symbols of libc; any exported symbol that do not start with an underscore will be given an underscored alias unless such a symbol is already defined).

Also a lot of updates to the building system. It is now much faster (thanks
to Knut's suggestion of using ash's builtin echo).
Also re-wrote thunk1.asm and thunk2.asm to GAS format; this removes the need
for MASM and makes it possible to use 16-bit functions in a.out programs
without the need for EMX.DLL.
Also made a lot of small changes I don't remember now.

Location:
trunk/src/emx
Files:
25 added
23 deleted
205 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/Makefile

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    2323OUT = out/
    2424# Base installation directory
    25 INS = out/install/
     25INS = out/$(MODE)/install/
    2626# CPU type (pretend we are portable ;-)
    2727CPU = 386
     28# The object file format to use for tools (emxomf, ld and friends)
     29TOOLFMT.dbg = aout
     30TOOLFMT.opt = omf
     31TOOLFMT = $(TOOLFMT.$(MODE))
    2832
    2933# Use ash.exe which is quite fast (comparable to cmd.exe) but has more features
     
    4448CC = gcc -c
    4549# The C compiler flags
    46 CFLAGS = -Wall -Iinclude -Isrc/include $(CFLAGS.$(MODE)) $(CFLAGS.KIND)
     50CFLAGS.INC = -Iinclude -Isrc/include
     51CFLAGS = -Wall -mstack-arg-probe -Zmt $(CFLAGS.INC) $(CFLAGS.$(MODE)) $(CFLAGS.KIND)
    4752# The additional C compiler flags for different build modes
    4853CFLAGS.opt = -s -O3 -fomit-frame-pointer
     
    5055CFLAGS.aout =
    5156CFLAGS.omf = -Zomf
    52 CFLAGS.st =
    53 CFLAGS.mt = -Zmt
    5457CFLAGS.prof = -pg
    5558# The object files are put in subdirectory objectformat-targetkind,
     
    6366LD = gcc
    6467# Linker flags
    65 LDFLAGS = $(LDFLAGS.$(MODE)) $(LDFLAGS.KIND)
     68LDFLAGS = -Zmt $(LDFLAGS.$(MODE)) $(LDFLAGS.KIND)
    6669# Linker flags for different build modes
    6770LDFLAGS.opt = -s
     
    6972LDFLAGS.aout =
    7073LDFLAGS.omf = -Zomf -Zsys -Zsmall-conv -Zlinker /PM:VIO
    71 LDFLAGS.st =
    72 LDFLAGS.mt = -Zmt
    73 LDFLAGS.stp = -pg
    74 LDFLAGS.mtp = -pg -Zmt
     74LDFLAGS.prof = -pg
    7575# Linker flags for different kinds of target
    7676LDFLAGS.KIND = $(foreach x,$(subst -, ,$(firstword $(subst /, ,$(subst $.,,$@)))),$(LDFLAGS.$x))
     
    8888ARFLAGS = crs
    8989DO.LIBRARY = $(AR) $(ARFLAGS) $@ $(^O)
     90
     91# How to create dependencies
     92MAKEDEP = makedep
     93MAKEDEPFLAGS = $(CFLAGS.INC)
     94DO.DEPS = $(MAKEDEP) $(MAKEDEPFLAGS) \
     95  -I$(subst $(SPACE), -I,$(sort $(dir $^))) -p$(@D)/ -c -S -f$@ $^
     96
     97# How to convert an a.out file to the OMF format
     98DO.AOUT2OMF = emxomf $(strip $1 -o) $@ $<
    9099
    91100# How to filter just the object files from $^
     
    109118SEP := ==========================================================================
    110119
    111 # How to remove a file
     120# How to remove one or more files without questions
    112121RM = rm -f $1
     122# How to remove one or more directories without questions
     123RMDIR = rm -rf $1
     124# How to copy several files to a directory
     125CP = cp $1 $2
    113126# Miscelaneous tools
    114127MKDIR = mkdir.exe -p $1
     
    117130ECHOIZE = $(subst $$,\$$,$1$(strip $(subst $(SPACE)$(COMMA),$(COMMA),$(foreach x,2 3 4 5 6 7 8 9,$(if $($x),$(COMMA) $($x))))))
    118131# How to output a text string (with appended newline)
    119 # bird: skip the .exe and ash will use internal echo implementation which is way faster
    120 #ECHO = echo.exe "$(call ECHOIZE,$1,$2,$3,$4,$5,$6,$7,$8,$9)"
    121132ECHO = echo "$(call ECHOIZE,$1,$2,$3,$4,$5,$6,$7,$8,$9)"
    122133# Same but append the text to a file (given with first argument)
    123 # bird: skip the .exe and ash will use internal echo implementation which is way faster
    124 #FECHO = echo.exe "$(call ECHOIZE,$2,$3,$4,$5,$6,$7,$8,$9)" >> "$1"
    125134FECHO = echo "$(call ECHOIZE,$2,$3,$4,$5,$6,$7,$8,$9)" >> "$1"
    126135# How to replace the source file extension with a .o extension
     
    145154# Build rules (_@_ replaced by name of generated makefile)
    146155RULES :=
    147 
    148 .PHONY: default help all clean install
     156# The list of dependency files
     157TARGDEPEND :=
     158
     159.PHONY: default help all clean install cleandep cleandepend dep depend depdone
    149160.SUFFIXES:
    150 .SUFFIXES: .c .cpp .asm .s .o .exe .dll .a .lib
     161.SUFFIXES: .c .cpp .asm .s .o .exe .dll .a .lib .obj
    151162
    152163# Default target
     
    172183        @$(call ECHO,    clean - remove all generated files (remove all built files))
    173184        @$(call ECHO,    install - generate a installation tree in $(INS))
     185        @$(call ECHO,    dep - generate dependency files for all changed targets)
     186        @$(call ECHO,    cleandep - remove all dependency file)
    174187        @$(call ECHO,$(SEP))
    175188        @$(call ECHO,There are a number of variables than can be set in the make)
     
    181194        @$(call ECHO,$(SEP))
    182195
    183 all: $(MODULES)
     196all: $(TARGDIRS) $(MODULES)
    184197
    185198clean:
    186         rm -rf $(OUT)
    187 
    188 install: $(INSDIRS)
     199        $(call RMDIR,$(OUT))
     200
     201cleandep cleandepend:
     202        $(call RM,$(TARGDEPEND))
     203
     204dep depend:
     205        @$(MAKE) --no-print-directory BUILD_DEPS=1 depdone
     206
     207depdone:
     208        @$(call ECHO,Dependency files succesfully updated)
     209
     210install: all $(INSDIRS)
    189211        $(DO.INSTALL)
    190212
    191 $(OUT) $. $(INSDIRS) $(TARGDIRS):
     213$. $(INSDIRS) $(TARGDIRS):
    192214        $(call MKDIR,$@)
    193215
    194 # bird: add rule for generating the rules.
    195 rules: rules-rm $(OUT)genrules.smak
    196 rules-rm:
    197         @$(call RM,$(OUT)genrules.smak)
    198        
    199 #$(OUT)genrules.smak: $(OUT) Makefile $(SUBMAK)
    200 # bird: depeding on $(OUT) make it unstable.
    201 $(OUT)genrules.smak: Makefile $(SUBMAK)
    202         $(call MKDIR,$(@D))
    203         @$(call ECHO,Please wait, rebuilding make rules $@ ...)
     216$(OUT)genrules.smak: $(SUBMAK) # Makefile $(wildcard *.smak)
     217        @$(call MKDIR,$(OUT))
     218        @$(call ECHO,Please wait, rebuilding make rules ...)
    204219        @$(call RM,$@)
    205220        @$(call FECHO,$@,# Autogenerated file -- DO NOT EDIT!)
    206221        @$(subst _@,$@,$(RULES))
    207222
     223# The general a.out -> OMF conversion rule for object files
     224$.omf/%.obj: $.aout/%.o
     225        $(call DO.AOUT2OMF)
     226
     227# The general a.out -> OMF conversion rule for libraries
     228$.omf%.lib: $.aout%.a
     229        $(call DO.AOUT2OMF)
     230
    208231-include $(OUT)genrules.smak
    209 
  • trunk/src/emx/build.txt

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    9595  'make help' in the module list section.
    9696
     97.MDEP - (optional) module dependencies. This is useful if current module
     98  requires another module to be built first (e.g. a library).
     99
    97100.TARGET - The name of target (e.g. executable or library file name without dir).
    98101  For example: .TARGET=myfile.exe
     
    100103.TKIND - (optional) The kind of target. It can consist of up to three
    101104  components, the first one defines the object file format (omf or aout,
    102   if not defined defaults to omf), the second defines the threadness
    103   (st or mt, defaults to st), third can be 'prof' to build in profiling mode.
    104   Example: .TKIND=omf st prof
     105  if not defined defaults to omf), the second can be 'prof' to build in
     106  profiling mode.
     107  Example: .TKIND=omf prof
    105108
    106109.TDEP - Dependencies for target (not built from a source file). For example,
     
    141144mklib.smak - this builder creates a library. It defines all rules required
    142145  for building all object files and then runs the librarian which binds all
    143   object files together in a single library.
     146  object files together in a single library. Besides, if the file format is
     147  a.out, it also defines a target called '$(.MODULE)@omf' (e.g. for module
     148  zzz it also defines a module called zzz@omf) which will build the OMF
     149  library from its a.out counterpart by using emxomf.
    144150
    145151Here is a simple example of a submakefile that will build a simple helloworld
     
    195201files from a single source file they are put under different output directories
    196202(e.g. single-threaded OMF object files go into $(OUT)/omf-st/ directory while
    197 multi-threaded a.out object files with profiling go into $(OUT)/aout-mt-prof/
     203multi-threaded a.out object files with profiling go into $(OUT)/aout-prof/
    198204directory). This way, you can have several targets that are built from the
    199205same source files with different compilation options.
  • trunk/src/emx/common.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1919.tmp := omf
    2020endif # neq ($(findstring aout,$(.TKIND)),)
    21 ifneq ($(findstring mt,$(.TKIND)),)
    22 .tmp += mt
    23 else
    24 .tmp += st
    25 endif # neq ($(findstring mt,$(.TKIND)),)
    2621ifneq ($(findstring prof,$(.TKIND)),)
    2722.tmp += prof
     
    2924.TKIND := $(.tmp)
    3025.TKIND.DIR := $(subst $(SPACE),-,$(.TKIND))/
    31 .tmp :=
     26
     27ifdef .TARGET
    3228
    3329# .TARG is same as .TARGET except that it has a st/ or mt/ prefix
     
    3531
    3632ifdef .INSDIR
    37 DO.INSTALL += cp.exe $.$(.TARG) $(INS)$(.INSDIR)$(.TARGET)$(NL)
     33DO.INSTALL += $(call CP,$.$(.TARG),$(INS)$(.INSDIR)$(.TARGET))$(NL)
    3834INSDIRS += $(INS)$(.INSDIR)
    3935endif # def .INSDIR
     36
     37# We know how to create dependency files for .c and .cpp files
     38.tmp := $(strip $(filter %.c,$(.TSRC)) $(filter %.cpp,$(.TSRC)))
     39ifdef .tmp
     40# Read the dependency file
     41-include $.$(.TKIND.DIR)dep-$(.TARGET).smak
     42
     43TARGDEPEND += $.$(.TKIND.DIR)dep-$(.TARGET).smak
     44
     45ifdef BUILD_DEPS
     46# How to build the dependency file
     47$.$(.TKIND.DIR)dep-$(.TARGET).smak: $(.tmp)
     48        $(DO.DEPS)
     49endif # BUILD_DEPS
     50endif # def .tmp
     51
     52endif # def .TARGET
    4053
    4154# If module has any source files, find respective object file names
     
    4760TARGDIRS += $(.DIRS)
    4861
     62ifdef .MDEP
     63$(.MODULE): $(.MDEP)
     64.MDEP :=
     65endif
     66
     67ifdef .MODULE
    4968$(.MODULE): $(.DIRS) $.$(.TARG)
     69endif
    5070
    5171# Remove the names of files for which we already generated build rules
     
    6181BUILD.RULES += $(.TSRC)
    6282.TSRC := $(filter-out $(.OBJS),$(subst :, ,$(.TSRC)))
    63 
    64 #.TSRC := $(foreach x,$(.TSRC),$(if $(findstring $(call OBJFILE,$x):$x,$(BUILD.RULES)),,$x))
    65 #BUILD.RULES += $(foreach x,$(.TSRC),$(if $(findstring $(call OBJFILE,$x):$x,$(BUILD.RULES)),,$(call OBJFILE,$x):$x))
    6683
    6784# Generate compilation rules for C files
  • trunk/src/emx/include/ctype.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    4646#else
    4747
    48 #define isalnum(c)  ((_ctype+1)[c] & (_UPPER|_LOWER|_DIGIT))
    49 #define isalpha(c)  ((_ctype+1)[c] & (_UPPER|_LOWER))
    50 #define iscntrl(c)  ((_ctype+1)[c] & (_CNTRL))
    51 #define isdigit(c)  ((_ctype+1)[c] & (_DIGIT))
    52 #define isgraph(c)  ((_ctype+1)[c] & (_PUNCT|_UPPER|_LOWER|_DIGIT))
    53 #define islower(c)  ((_ctype+1)[c] & (_LOWER))
    54 #define isprint(c)  ((_ctype+1)[c] & (_PRINT))
    55 #define ispunct(c)  ((_ctype+1)[c] & (_PUNCT))
    56 #define isspace(c)  ((_ctype+1)[c] & (_SPACE))
    57 #define isupper(c)  ((_ctype+1)[c] & (_UPPER))
    58 #define isxdigit(c) ((_ctype+1)[c] & (_XDIGIT))
     48#define isalnum(c)  ((_ctype+1)[(unsigned char)c] & (_UPPER|_LOWER|_DIGIT))
     49#define isalpha(c)  ((_ctype+1)[(unsigned char)c] & (_UPPER|_LOWER))
     50#define iscntrl(c)  ((_ctype+1)[(unsigned char)c] & (_CNTRL))
     51#define isdigit(c)  ((_ctype+1)[(unsigned char)c] & (_DIGIT))
     52#define isgraph(c)  ((_ctype+1)[(unsigned char)c] & (_PUNCT|_UPPER|_LOWER|_DIGIT))
     53#define islower(c)  ((_ctype+1)[(unsigned char)c] & (_LOWER))
     54#define isprint(c)  ((_ctype+1)[(unsigned char)c] & (_PRINT))
     55#define ispunct(c)  ((_ctype+1)[(unsigned char)c] & (_PUNCT))
     56#define isspace(c)  ((_ctype+1)[(unsigned char)c] & (_SPACE))
     57#define isupper(c)  ((_ctype+1)[(unsigned char)c] & (_UPPER))
     58#define isxdigit(c) ((_ctype+1)[(unsigned char)c] & (_XDIGIT))
    5959
    6060int (isalnum)(int);
  • trunk/src/emx/include/fnmatch.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1 /* fnmatch.h (emx+gcc) */
     1/* Copyright 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
    22
    3 #ifndef _FNMATCH_H
    4 #define _FNMATCH_H
     3NOTE: The canonical source of this file is maintained with the GNU C Library.
     4Bugs can be reported to bug-glibc@prep.ai.mit.edu.
    55
    6 #if defined (__cplusplus)
     6This program is free software; you can redistribute it and/or modify it
     7under the terms of the GNU General Public License as published by the
     8Free Software Foundation; either version 2, or (at your option) any
     9later version.
     10
     11This program is distributed in the hope that it will be useful,
     12but WITHOUT ANY WARRANTY; without even the implied warranty of
     13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     14GNU General Public License for more details.
     15
     16You should have received a copy of the GNU General Public License
     17along with this program; if not, write to the Free Software
     18Foundation, 59 Temple Place - Suite 330,
     19Boston, MA 02111-1307, USA.  */
     20
     21#ifndef _FNMATCH_H
     22
     23#define _FNMATCH_H      1
     24
     25#ifdef  __cplusplus
    726extern "C" {
    827#endif
    928
    10 /* POSIX.2 */
    11 
    12 #define FNM_NOMATCH        1
    13 
    14 #define FNM_NOESCAPE       16
    15 #define FNM_PATHNAME       32
    16 #define FNM_PERIOD         64
    17 
    18 int fnmatch (__const__ char *, __const__ char *, int);
     29#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
     30#undef  __P
     31#define __P(args)       args
     32#else /* Not C++ or ANSI C.  */
     33#undef  __P
     34#define __P(args)       ()
     35/* We can get away without defining `const' here only because in this file
     36   it is used only inside the prototype for `fnmatch', which is elided in
     37   non-ANSI C where `const' is problematical.  */
     38#endif /* C++ or ANSI C.  */
    1939
    2040
    21 #if !defined (_POSIX_SOURCE) || defined (_WITH_UNDERSCORE)
     41/* We #undef these before defining them because some losing systems
     42   (HP-UX A.08.07 for example) define these in <unistd.h>.  */
     43#undef  FNM_PATHNAME
     44#undef  FNM_NOESCAPE
     45#undef  FNM_PERIOD
    2246
    23 /* emx extensions */
     47/* Bits set in the FLAGS argument to `fnmatch'.  */
     48#define FNM_PATHNAME    (1 << 0) /* No wildcard can ever match `/'.  */
     49#define FNM_NOESCAPE    (1 << 1) /* Backslashes don't quote special chars.  */
     50#define FNM_PERIOD      (1 << 2) /* Leading `.' is matched only explicitly.  */
    2451
    25 #define _FNM_MATCH         0
    26 #define _FNM_ERR           2
    27 
    28 #define _FNM_STYLE_MASK    15
    29 
    30 #define _FNM_POSIX         0
    31 #define _FNM_OS2           1
    32 #define _FNM_DOS           2
    33 
    34 #define _FNM_IGNORECASE    128
    35 #define _FNM_PATHPREFIX    256
    36 
    37 int _fnmatch (__const__ char *, __const__ char *, int);
    38 
     52#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
     53#define FNM_FILE_NAME   FNM_PATHNAME /* Preferred GNU name.  */
     54#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match.  */
     55#define FNM_CASEFOLD    (1 << 4) /* Compare without regard to case.  */
    3956#endif
    4057
     58/* Value returned by `fnmatch' if STRING does not match PATTERN.  */
     59#define FNM_NOMATCH     1
    4160
    42 #if defined (__cplusplus)
     61/* Match STRING against the filename pattern PATTERN,
     62   returning zero if it matches, FNM_NOMATCH if not.  */
     63extern int fnmatch __P ((const char *__pattern, const char *__string,
     64                         int __flags));
     65
     66#ifdef  __cplusplus
    4367}
    4468#endif
    4569
    46 #endif /* not _FNMATCH_H */
     70#endif /* fnmatch.h */
  • trunk/src/emx/include/getopt.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    11/* Declarations for getopt.
    2    Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
     2   Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 2000
     3   Free Software Foundation, Inc.
    34
    45   NOTE: The canonical source of this file is maintained with the GNU C Library.
     
    100101
    101102#if defined (__STDC__) && __STDC__
    102 #ifdef __GNU_LIBRARY__
     103/* HAVE_DECL_* is a three-state macro: undefined, 0 or 1.  If it is
     104   undefined, we haven't run the autoconf check so provide the
     105   declaration without arguments.  If it is 0, we checked and failed
     106   to find the declaration so provide a fully prototyped one.  If it
     107   is 1, we found it so don't provide any declaration at all.  */
     108#if defined (__GNU_LIBRARY__) || (defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT)
    103109/* Many other libraries have conflicting prototypes for getopt, with
    104110   differences in the consts, in stdlib.h.  To avoid compilation
     
    106112extern int getopt (int argc, char *const *argv, const char *shortopts);
    107113#else /* not __GNU_LIBRARY__ */
     114# if !defined (HAVE_DECL_GETOPT) && !defined (__cplusplus)
    108115extern int getopt ();
     116# endif
    109117#endif /* __GNU_LIBRARY__ */
    110118extern int getopt_long (int argc, char *const *argv, const char *shortopts,
  • trunk/src/emx/include/malloc.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/math.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/stddef.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/stdio.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/stdlib.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/string.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/sys/errno.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/sys/fcntl.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/sys/process.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/sys/stat.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55
    66#if !defined (_SYS_TYPES_H)
    7 #warning <sys/stat.h> requires <sys/types.h>
     7 #warning <sys/stat.h> requires <sys/types.h>
    88#include <sys/types.h>
    99#endif
  • trunk/src/emx/include/sys/types.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    6363#if !defined (FD_SETSIZE)
    6464#define FD_SETSIZE      256
    65 #elif FD_SETSIZE < 256
    66 #error FD_SETSIZE must be at least 256
     65#else
     66#if FD_SETSIZE < 256
     67 #error FD_SETSIZE must be at least 256
     68#endif
    6769#endif
    6870
  • trunk/src/emx/include/sys/wait.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/time.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/include/unistd.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
  • trunk/src/emx/mklib.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1010        $(call FECHO,_@,        $$(DO.LIBRARY))$(NL)
    1111
     12# The rule for building the OMF variant of library from a.out format
     13ifneq ($(findstring aout,$(.TKIND)),)
     14# Remove the .a suffix from library name
     15.TARGET := $(patsubst %$A,%,$(.TARGET))
     16# Replace 'aout' with 'omf' in .TKIND
     17.TKIND := $(subst aout,omf,$(.TKIND))
     18# Compute the new output file directory
     19.TKIND.DIR := $(subst $(SPACE),-,$(.TKIND))/
     20# Append the .lib suffix to target name
     21.TARGET := $(.TARGET)$A
     22# Compute the name of target file to build
     23.TARG@OMF := $(.TKIND.DIR)$(.TARGET)
     24# The rule for building the xxx@omf variant of target
     25.PHONY: $(.MODULE)@omf
     26MODULES += $(.MODULE)@omf
     27DO.INSTALL += $(call CP,$.$(.TARG@OMF),$(INS)$(.INSDIR)$(.TARGET))$(NL)
     28.DIRS@OMF := $(dir $.$(.TARG@OMF))
     29TARGDIRS += $(.DIRS@OMF)
     30$(.MODULE)@omf: $(.MODULE) $(.DIRS@OMF) $.$(.TARG@OMF)
     31endif # neq ($(findstring aout,$(.TKIND)),)
     32
    1233include comend.smak
  • trunk/src/emx/src/emxbind/emxbind.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    11.MODULE := emxbind
    22.MDESC  := Build a OS/2 LX executable/dll from linked a.out module
     3.MDEP   := moddef@omf
    34.INSDIR := bin/
    45
    56.TARGET := emxbind.exe
     7.TKIND  := $(TOOLFMT)
    68.TSRC   := $(wildcard src/emxbind/*.c)
    79.TCF    := -DLIST_OPT=1
  • trunk/src/emx/src/emxexp/emxexp.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    11.MODULE := emxexp
    22.MDESC  := Generate a list of DLL export entries
     3.MDEP   := omflib@omf
    34.INSDIR := bin/
    45
    56.TARGET := emxexp.exe
     7.TKIND  := $(TOOLFMT)
    68.TSRC   := $(wildcard src/emxexp/*.c)
    7 .TLDF   := -liberty -lomflib
     9.TDEP   := @O@omflib$A
     10.TLDF   := -liberty
    811include mkexe.smak
  • trunk/src/emx/src/emximp/emximp.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    11.MODULE := emximp
    22.MDESC  := Import library management tool
     3.MDEP   := omflib@omf moddef@omf
    34.INSDIR := bin/
    45
    56.TARGET := emximp.exe
     7.TKIND  := $(TOOLFMT)
    68.TSRC   := $(wildcard src/emximp/*.c)
    7 .TLDF   := -lomflib -lmoddef
     9.TDEP   := @O@omflib$A @O@moddef$A
    810include mkexe.smak
  • trunk/src/emx/src/emxomf/emxomf.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    22.MDESC  := a.out to OMF object file conversion utility
    33.INSDIR := bin/
     4.MDEP   := omflib@omf moddef@omf
    45
    56.TARGET := emxomf.exe
     7.TKIND  := $(TOOLFMT)
    68.TSRC   := $(addprefix src/emxomf/,emxomf.c stabshll.c grow.c)
    7 .TLDF   := -lomflib
     9.TDEP   := @O@omflib$A
    810include mkexe.smak
    911
    1012.TARGET := emxomfar.exe
     13.TKIND  := $(TOOLFMT)
    1114.TSRC   := src/emxomf/emxomfar.c
    12 .TLDF   := -lomflib
     15.TDEP   := @O@omflib$A
    1316include mkexe.smak
    1417
    1518.TARGET := emxomfld.exe
     19.TKIND  := $(TOOLFMT)
    1620.TSRC   := src/emxomf/emxomfld.c
    17 .TLDF   := -lmoddef
     21.TDEP   := @O@moddef$A
    1822include mkexe.smak
    1923
    2024.TARGET := emxaout.exe
     25.TKIND  := $(TOOLFMT)
    2126.TSRC   := $(addprefix src/emxomf/,emxaout.c grow.c)
    2227include mkexe.smak
    2328
    2429.TARGET := listomf.exe
     30.TKIND  := $(TOOLFMT)
    2531.TSRC   := src/emxomf/listomf.c
    2632include mkexe.smak
  • trunk/src/emx/src/emxstack/emxstack.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44
    55.TARGET := emxstack.exe
     6.TKIND  := $(TOOLFMT)
    67.TSRC   := $(wildcard src/emxstack/*.c)
    78include mkexe.smak
  • trunk/src/emx/src/emxtsf/emxtsf.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    11.MODULE := emxtsf
    22.MDESC  := Simplify construction of .TSF files
     3.MDEP   := moddef@omf
    34.INSDIR := bin/
    45
    56.TARGET := emxtsf.exe
     7.TKIND  := $(TOOLFMT)
    68.TSRC   := $(wildcard src/emxtsf/*.c)
    79.TLDF   := -lmoddef
  • trunk/src/emx/src/ld/ld.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    2929#include <process.h>        /* for running emxbind */
    3030#include <errno.h>
     31#include <utime.h>
    3132#endif /* __EMX__ */
     33#include <ctype.h>
    3234#include <sys/types.h>
    3335#include <sys/stat.h>
     
    8183#define FIXSETBUG
    8284
     85extern int DosCopy (char *, char *, int);
    8386#endif /* EMX */
    8487
     
    11091112
    11101113int parse ();
    1111 void do_warnings ();
    11121114void initialize_text_start ();
    11131115void initialize_data_start ();
     
    11321134char *get_file_name ();
    11331135symbol *getsym (), *getsym_soft ();
     1136void do_warnings ();
    11341137#ifdef EMX /* emxbind */
    11351138void check_exe (void);
     
    11441147#ifdef __EMX__
    11451148  _response (&argc, &argv);
     1149  _wildcard (&argc, &argv);
    11461150#endif /* __EMX__ */
    11471151  page_size = getpagesize ();
     
    18221826
    18231827  perror_file (entry);
     1828  /* NOTREACHED */
    18241829  return -1;
    18251830}
     
    28772882/* Handle a subentry for a file with no __.SYMDEF. */
    28782883
    2879 void process_subentry (desc, subentry, entry, prev_addr)
     2884void
     2885process_subentry (desc, subentry, entry, prev_addr)
    28802886     int desc;
    28812887     register struct file_entry *subentry;
     
    30513057{
    30523058  register int i;
    3053   int setv_fill_count = 0;
     3059  int setv_fill_count;
    30543060
    30553061  if (trace_files)
     
    34333439  fprintf (outfile, "\nFiles:\n\n");
    34343440
    3435   each_file (describe_file_sections, (int)outfile);
     3441  each_file (describe_file_sections, outfile);
    34363442
    34373443  fprintf (outfile, "\nGlobal symbols:\n\n");
     
    34513457    }
    34523458
    3453   each_file (list_file_locals, (int)outfile);
     3459  each_file (list_file_locals, outfile);
    34543460}
    34553461
     
    38683874  struct line_debug_entry *text_scan, *data_scan;
    38693875  int i;
    3870   char *errfmt, *file_name = NULL;
    3871   int line_number = -1;
     3876  char *errfmt, *file_name;
     3877  int line_number;
    38723878  int dont_allow_symbol_name;
    38733879
     
    40164022    return;
    40174023
    4018   each_file (do_file_warnings, (int)outfile);
     4024  each_file (do_file_warnings, outfile);
    40194025
    40204026  if (list_unresolved_refs || list_multiple_defs)
     
    40414047initialize_a_out_text_start ()
    40424048{
    4043   int magic = 0;
     4049  int magic;
    40444050
    40454051  switch (output_style)
     
    50435049        {
    50445050          char execname[512];
    5045           _execname((char *)&execname, sizeof(execname));
    5046           strcpy(_getname((char *)&execname), "ldstub.bin");
     5051          _execname(execname, sizeof (execname));
     5052          strcpy(_getname(execname), "ldstub.bin");
    50475053          /* Copy stub into file */
    5048           if (DosCopy((char *)&execname, touch_filename, 4))
     5054          if (DosCopy(execname, touch_filename, 4))
    50495055          {
    50505056            errno = EACCES;
     
    57195725
    57205726#ifdef EMX
    5721           if (symtype = symptr->defined != (N_IMP1 | N_EXT))
     5727          if ((symtype = symptr->defined) != (N_IMP1 | N_EXT))
    57225728#endif
    57235729            symtype = symptr->defined & ~N_EXT;
     
    58835889  /* Write the local symbols defined by the various files.  */
    58845890
    5885   each_file (write_file_syms, (int)&syms_written);
     5891  each_file (write_file_syms, &syms_written);
    58865892  file_close ();
    58875893
  • trunk/src/emx/src/ld/ld.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66
    77.TARGET := ld.exe
     8.TKIND  := $(TOOLFMT)
    89.TSRC   := $(wildcard src/ld/*.c)
     10.TCF    := -DEMX
    911.TLDF   := -liberty
    1012include mkexe.smak
  • trunk/src/emx/src/lib/app/app.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    22.MDESC  := EMX.DLL 'replacement' for statically linked programs
    33
    4 # Build four kinds of library c_app: single-threaded, multi-threaded,
    5 # single-threaded profile and multi-threaded profile
     4# Build two kinds of library: aout and aout-profile.
     5# The OMF libraries will be derived from them.
    66
    7 .TKIND  := aout st
     7.TKIND  := aout
    88.TARGET := c_app$A
    99.TSRC.386 := $(addprefix 386/,crt2.s crt3.s emxio.s inp8.s inp16.s inp32.s \
     
    1414.TCF.src/lib/app/stdio.c := -D_NFILES=40
    1515.TCF.src/lib/app/iodata.c := -D_NFILES=40
    16 .INSDIR = lib/$(filter st mt,$(.TKIND))/
     16.INSDIR = lib/
    1717.TKEEP  := 1
    1818include mklib.smak
    1919
    20 .TKIND  := aout mt
    21 .TKEEP  := 1
     20.TKIND  := aout prof
     21.TARGET := c_app_p$A
    2222include mklib.smak
    23 
    24 .TKIND  := aout st prof
    25 .TARGET := c_app_p$A
    26 .TKEEP  := 1
    27 include mklib.smak
    28 
    29 .TKIND  := aout mt prof
    30 include mklib.smak
  • trunk/src/emx/src/lib/emxload/emxloadl.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    88int _emxload_list_start (void)
    99{
    10   if (_osmode != OS2_MODE)
    11     return -1;
    1210  if (_emxload_do_connect (FALSE) != 0)
    1311    return -1;
     
    2523  answer ans;
    2624
    27   if (_osmode != OS2_MODE || buf_size == 0)
     25  if (buf_size == 0)
    2826    return -1;
    2927  if (_emxload_do_receive (&ans) != 0)
  • trunk/src/emx/src/lib/emxload/emxloadr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    144144  int result;
    145145
    146   if (_osmode != OS2_MODE)
    147     return -1;
    148146  switch (req_code)
    149147    {
  • trunk/src/emx/src/lib/end/end.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    22.MDESC  := The C runtime library that should be linked last
    33
    4 .TKIND  := omf st
     4.TKIND  := omf
    55.TARGET := end$A
    66.TSRC.386 := $(wildcard src/lib/end/386/*.asm)
    77.TSRC   := $(.TSRC.$(CPU))
    88.INSDIR = lib/
    9 .TKEEP  := 1
    109include mklib.smak
    11 
    12 .TKIND  := omf mt
    13 include mklib.smak
  • trunk/src/emx/src/lib/io/_imphand.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    88#include <emx/syscalls.h>
    99
    10 int _fmode_bin;
     10extern int _fmode_bin;
    1111
    1212int _imphandle (int handle)
  • trunk/src/emx/src/lib/io/access.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    88#include <emx/syscalls.h>
    99
    10 int _access (const char *name, int mode)
     10int access (const char *name, int mode)
    1111{
    1212  int a, slash;
  • trunk/src/emx/src/lib/io/chmod.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77#include <emx/syscalls.h>
    88
    9 int _chmod (const char *name, int pmode)
     9int chmod (const char *name, int pmode)
    1010{
    1111  int attr, rc;
  • trunk/src/emx/src/lib/io/chsize.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77#include <emx/syscalls.h>
    88
    9 int _chsize (int handle, long length)
     9int chsize (int handle, long length)
    1010{
    1111  long n;
  • trunk/src/emx/src/lib/io/close.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/syscalls.h>
    77
    8 int _close (int handle)
     8int close (int handle)
    99{
    1010  if (_fd_flags (handle) == NULL)
  • trunk/src/emx/src/lib/io/creat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <fcntl.h>
    55
    6 int _creat (const char *name, int pmode)
     6int creat (const char *name, int pmode)
    77{
    88  return _open (name, O_WRONLY|O_TRUNC|O_CREAT, pmode);
  • trunk/src/emx/src/lib/io/dup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/syscalls.h>
    77
    8 int _dup (int handle)
     8int dup (int handle)
    99{
    1010  int new, *pflags1, *pflags2, *pla1, *pla2;
  • trunk/src/emx/src/lib/io/dup2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/syscalls.h>
    77
    8 int _dup2 (int handle1, int handle2)
     8int dup2 (int handle1, int handle2)
    99{
    1010  int *pflags1, *pflags2, *pla1, *pla2;
  • trunk/src/emx/src/lib/io/eadread.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    6666
    6767  _ead_clear (ead);
    68   if (_osmode != OS2_MODE)
    69     {
    70       if (path != NULL)
    71         {
    72           if (_access (path, 0) != 0)
    73             return -1;
    74         }
    75       else
    76         {
    77           if (_tell (handle) == -1)
    78             return -1;
    79         }
    80       return 0;
    81     }
    8268  gd.gea_alloc = sizeof (GEA2LIST);
    8369  gd.gea_ptr = malloc (gd.gea_alloc);
  • trunk/src/emx/src/lib/io/eadwrite.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    5151int _ead_write (_ead ead, const char *path, int handle, int flags)
    5252{
    53   if (_osmode != OS2_MODE)
    54     return 0;
    5553  if (!(flags & _EAD_MERGE))
    5654    {
  • trunk/src/emx/src/lib/io/eaget.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    2626  dst->size = 0;
    2727  dst->value = NULL;
    28   if (_osmode != OS2_MODE)
    29     {
    30       if (path != NULL)
    31         {
    32           if (_access (path, 0) != 0)
    33             return -1;
    34         }
    35       else
    36         {
    37           if (_tell (handle) == -1)
    38             return -1;
    39         }
    40       return 0;
    41     }
    4228  if (path != NULL)
    4329    {
  • trunk/src/emx/src/lib/io/eaput.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    1818  int len, size;
    1919
    20   if (_osmode != OS2_MODE)
    21     return 0;
    2220  len = strlen (name);
    2321  size = sizeof (FEA2LIST) + len + src->size;
  • trunk/src/emx/src/lib/io/eof.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <emx/io.h>
    66
    7 int _eof (int handle)
     7int eof (int handle)
    88{
    99  int *pflags;
  • trunk/src/emx/src/lib/io/fcloseal.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/io.h>
    55
    6 int _fcloseall (void)
     6int fcloseall (void)
    77{
    88  int i, n, start;
  • trunk/src/emx/src/lib/io/fcntl.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    6060
    6161
    62 int _fcntl (int handle, int request, ...)
     62int fcntl (int handle, int request, ...)
    6363{
    6464  va_list va;
  • trunk/src/emx/src/lib/io/fdopen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1212/* Bug: doesn't check for compatible modes (O_ACCMODE) */
    1313
    14 FILE *_fdopen (int handle, const char *mode)
     14FILE *fdopen (int handle, const char *mode)
    1515{
    1616  char ok, bt;
  • trunk/src/emx/src/lib/io/fgetchar.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <stdio.h>
    44
    5 int _fgetchar (void)
     5int fgetchar (void)
    66{
    77  return getchar ();
  • trunk/src/emx/src/lib/io/fileleng.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55
    6 long _filelength (int handle)
     6long filelength (int handle)
    77{
    88  long cur, n;
  • trunk/src/emx/src/lib/io/flock.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <emx/io.h>
    66
    7 int _flock (int handle, int operation)
     7int flock (int handle, int operation)
    88{
    99  if (_fd_flags (handle) == NULL)
  • trunk/src/emx/src/lib/io/flushall.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <sys/rmutex.h>
    66#include <stdio.h>
     7#include <stdlib.h>
    78#include <emx/io.h>
    89
    9 int _flushall (void)
     10int flushall (void)
    1011{
    1112  int i, n;
  • trunk/src/emx/src/lib/io/fputchar.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <stdio.h>
    44
    5 int _fputchar (int c)
     5int fputchar (int c)
    66{
    77  return putchar (c);
  • trunk/src/emx/src/lib/io/fstat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    88#include <emx/syscalls.h>
    99
    10 int _fstat (int handle, struct stat *buffer)
     10int fstat (int handle, struct stat *buffer)
    1111{
    1212  int rc;
  • trunk/src/emx/src/lib/io/fsync.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55
    6 int _fsync (int handle)
     6int fsync (int handle)
    77{
    88  return __fsync (handle);
  • trunk/src/emx/src/lib/io/ftruncat.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/syscalls.h>
    77
    8 int _ftruncate (int handle, long length)
     8int ftruncate (int handle, long length)
    99{
    1010  int *pflags;
  • trunk/src/emx/src/lib/io/getw.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <stdio.h>
    44
    5 int _getw (FILE *stream)
     5int getw (FILE *stream)
    66{
    77  int x;
  • trunk/src/emx/src/lib/io/io.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    11libc.TSRC += $(wildcard src/lib/io/*.c)
     2
     3# Build some object files separately (not included in libraries)
     4.MODULE :=
     5.TKIND  := aout
     6.TSRC.386 := src/lib/io/386/binmode.s
     7.TSRC   := $(.TSRC.$(CPU))
     8include common.smak
     9
     10.OBJS += $(patsubst %.o,%.obj,$(subst /aout/,/omf/,$(.OBJS)))
     11.DIRS := $(sort $(dir $(.OBJS)))
     12TARGDIRS += $(.DIRS)
     13
     14DO.INSTALL += $(call CP,$(.OBJS) $(INS)lib/)$(NL)
     15
     16libc: $(.DIRS) $(.OBJS)
     17
     18include comend.smak
  • trunk/src/emx/src/lib/io/ioctl.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1414#define FIONBIO         0x667e
    1515
    16 int _ioctl (int handle, int request, ...)
     16int ioctl (int handle, int request, ...)
    1717{
    1818  va_list va;
  • trunk/src/emx/src/lib/io/isatty.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <emx/io.h>
    66
    7 int _isatty (int handle)
     7int isatty (int handle)
    88{
    99  int *pflags;
  • trunk/src/emx/src/lib/io/lseek.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/syscalls.h>
    77
    8 long _lseek (int handle, long offset, int origin)
     8long lseek (int handle, long offset, int origin)
    99{
    1010  int *pflags, *pla;
  • trunk/src/emx/src/lib/io/mkstemp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77#include <errno.h>
    88
    9 int _mkstemp (char *string)
     9int mkstemp (char *string)
    1010{
    1111  int fd, pid, n;
  • trunk/src/emx/src/lib/io/mktemp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <errno.h>
    77
    8 char *_mktemp (char *string)
     8char *mktemp (char *string)
    99{
    1010  int pid, n, saved_errno;
    1111  char *s;
    1212
    13   pid = _getpid ();
     13  pid = getpid ();
    1414  s = strchr (string, 0);
    1515  n = 0;
  • trunk/src/emx/src/lib/io/open.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/io.h>
    77
    8 int _open (const char *name, int oflag, ...)
     8int open (const char *name, int oflag, ...)
    99{
    1010  va_list va;
  • trunk/src/emx/src/lib/io/pclose.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/io.h>
    77
    8 int _pclose (FILE *stream)
     8int pclose (FILE *stream)
    99{
    1010  int rc, write_mode;
  • trunk/src/emx/src/lib/io/pipe.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77#include <emx/syscalls.h>
    88
    9 int _fmode_bin;
     9extern int _fmode_bin;
    1010int _pipe_size;
    1111
    12 int _pipe (int *two_handles)
     12int pipe (int *two_handles)
    1313{
    1414  int *pflags1, *pflags2;
  • trunk/src/emx/src/lib/io/popen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    8282
    8383
    84 FILE *_popen (const char *command, const char *mode)
     84FILE *popen (const char *command, const char *mode)
    8585{
    8686  int ph[2];
  • trunk/src/emx/src/lib/io/putw.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <stdio.h>
    44
    5 int _putw (int x, FILE *stream)
     5int putw (int x, FILE *stream)
    66{
    77  return (fwrite (&x, sizeof (x), 1, stream) == 1 ? x : EOF);
  • trunk/src/emx/src/lib/io/read.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    3737
    3838
    39 int _read (int handle, void *buf, size_t nbyte)
     39int read (int handle, void *buf, size_t nbyte)
    4040{
    4141  int n, *pflags, *pla;
  • trunk/src/emx/src/lib/io/readv.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    1010#include <sys/uio.h>
    1111
    12 int _readv (int handle, const struct iovec *iov, int iovcnt)
     12int readv (int handle, const struct iovec *iov, int iovcnt)
    1313{
    1414  int i, n;
  • trunk/src/emx/src/lib/io/select.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    1212#define MIN(a,b) (((a) < (b)) ? (a) : (b))
    1313
    14 int _select (int nfds, fd_set *readfds, fd_set *writefds,
     14int select (int nfds, fd_set *readfds, fd_set *writefds,
    1515             fd_set *exceptfds, struct timeval *timeout)
    1616{
  • trunk/src/emx/src/lib/io/setbuffe.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <stdio.h>
    44
    5 int _setbuffer (FILE *stream, char *buffer, size_t size)
     5int setbuffer (FILE *stream, char *buffer, size_t size)
    66{
    77  return setvbuf (stream, buffer, (buffer != NULL ? _IOFBF : _IONBF), size);
  • trunk/src/emx/src/lib/io/setmode.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/io.h>
    77
    8 int _setmode (int handle, int mode)
     8int setmode (int handle, int mode)
    99{
    1010  int old_mode, *pflags;
  • trunk/src/emx/src/lib/io/snprintf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/io.h>
    77
    8 int _snprintf (char *buffer, size_t n, const char *format, ...)
     8int snprintf (char *buffer, size_t n, const char *format, ...)
    99{
    1010  va_list arg_ptr;
  • trunk/src/emx/src/lib/io/sopen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <emx/io.h>
    66
    7 int _sopen (const char *name, int oflag, int shflag, ...)
     7int sopen (const char *name, int oflag, int shflag, ...)
    88{
    99  va_list va;
  • trunk/src/emx/src/lib/io/stat.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    1313#include <emx/syscalls.h>
    1414
    15 int _stat (const char *name, struct stat *buffer)
     15int stat (const char *name, struct stat *buffer)
    1616{
    1717  int rc, slash;
  • trunk/src/emx/src/lib/io/tell.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/syscalls.h>
    77
    8 long _tell (int handle)
     8long tell (int handle)
    99{
    1010  int *pflags, *pla;
  • trunk/src/emx/src/lib/io/truncate.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <fcntl.h>
    55
    6 int _truncate (char *name, long length)
     6int truncate (char *name, long length)
    77{
    88  int handle, result;
    99
    10   handle = _open (name, O_RDWR);
     10  handle = open (name, O_RDWR);
    1111  if (handle == -1)
    1212    return -1;
    1313  result = _ftruncate (handle, length);
    14   _close (handle);
     14  close (handle);
    1515  return result;
    1616}
  • trunk/src/emx/src/lib/io/ttyname.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <emx/thread.h>
    66
    7 char *_ttyname (int handle)
     7char *ttyname (int handle)
    88{
    99#if defined (__MT__)
  • trunk/src/emx/src/lib/io/umask.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55
    6 int _umask (int pmode)
     6int umask (int pmode)
    77{
    88  return __umask (pmode);
  • trunk/src/emx/src/lib/io/unlink.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55
    6 int _unlink (const char *name)
     6int unlink (const char *name)
    77{
    88  return __remove (name);       /* There are no links */
  • trunk/src/emx/src/lib/io/utime.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77#include <emx/syscalls.h>
    88
    9 int _utime (const char *name, const struct utimbuf *times)
     9int utime (const char *name, const struct utimbuf *times)
    1010{
    1111  struct timeval tv[2];
  • trunk/src/emx/src/lib/io/utimes.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/syscalls.h>
    77
    8 int _utimes (const char *name, const struct timeval *tvp)
     8int utimes (const char *name, const struct timeval *tvp)
    99{
    1010  struct timeval tv[2];
  • trunk/src/emx/src/lib/io/vsnprint.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <emx/io.h>
    66
    7 int _vsnprintf (char *buffer, size_t n, const char *format, va_list arg_ptr)
     7int vsnprintf (char *buffer, size_t n, const char *format, va_list arg_ptr)
    88{
    99  FILE trick;
  • trunk/src/emx/src/lib/io/vsscanf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <stdio.h>
    44#include <stdarg.h>
     5#include <string.h>
    56#include <limits.h>
    67#include <emx/io.h>
  • trunk/src/emx/src/lib/io/write.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    137137
    138138
    139 int _write (int handle, const void *buf, size_t nbyte)
     139int write (int handle, const void *buf, size_t nbyte)
    140140{
    141141  int n, *pflags;
  • trunk/src/emx/src/lib/io/writev.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    1010#include <sys/uio.h>
    1111
    12 int _writev (int handle, const struct iovec *iov, int iovcnt)
     12int writev (int handle, const struct iovec *iov, int iovcnt)
    1313{
    1414  int i, n;
  • trunk/src/emx/src/lib/libc.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33# Utility function used in second-level submakefiles
    44# Creates four versions of object file name for all kinds of outputs.
    5 .MVER = $(foreach x,aout-st aout-mt aout-st-prof aout-mt-prof,$.$x/src/lib/$1)
     5.MVER = $(foreach x,aout aout-prof,$.$x/src/lib/$1)
    66
    77# First of all, include all second-level libc submakefiles
     
    1414.MDESC  := The C library
    1515
    16 .TKIND  := aout st
     16.TKIND  := aout
    1717.TARGET := c$A
    1818.TSRC   := $(libc.TSRC.$(CPU)) $(libc.TSRC)
    19 .TDEP   := $(libc.TDEP)
    20 .INSDIR = lib/$(filter st mt,$(.TKIND))/
     19.TDEP   := $(libc.TDEP.$(CPU)) $(libc.TDEP)
     20.INSDIR = lib/
    2121.TKEEP  := 1
    2222include mklib.smak
    2323
    24 .TKIND  := aout mt
    25 .TKEEP  := 1
    26 include mklib.smak
    27 
    28 .TKIND  := aout st prof
     24.TKIND  := aout prof
    2925.TARGET := c_p$A
    30 .TKEEP  := 1
    31 include mklib.smak
    32 
    33 .TKIND  := aout mt prof
    3426include mklib.smak
    3527
     
    3830libc.TSRC.$(CPU) :=
    3931libc.TSRC :=
     32libc.TDEP.$(CPU) :=
    4033libc.TDEP :=
  • trunk/src/emx/src/lib/math/math.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    11libc.TSRC.386 += $(wildcard src/lib/math/386/*.s)
    22libc.TSRC += $(wildcard src/lib/math/*.c)
     3
     4# Virtual targets, e.g. compiled from same input files but with different opts
     5libc.TDEP.386 += $(addprefix @O@src/lib/math/386/, copysigf.o copysigl.o \
     6  fpclassf.o fpclassl.o isfinf.o isfinl.o isnanf.o isnanl.o isnormf.o \
     7  isnorml.o nextaftf.o nextaftl.o signbitf.o signbitl.o acosl.o asinl.o \
     8  atanl.o atan2l.o ceill.o cosl.o coshl.o expl.o fabsl.o floorl.o fmodl.o \
     9  frexpl.o fxaml.o hypotl.o ldexpl.o logl.o log10l.o modfl.o powl.o rintl.o \
     10  sinl.o sinhl.o sqrtl.o tanl.o tanhl.o truncl.o)
     11
     12$(call .MVER,math/%f.o): src/lib/math/%.s
     13        $(call DO.COMPILE.s, -DFLOAT)
     14$(call .MVER,math/%l.o): src/lib/math/%.s
     15        $(call DO.COMPILE.s, -DLONG_DOUBLE)
  • trunk/src/emx/src/lib/misc/386/int86.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    2727        movl    5*4(%ebx), %edi
    2828        movl    1*4(%ebx), %ebx
    29         call    (%esp)                  /* "call %esp" is undefined */
     29        call    *(%esp)                 /* "call %esp" is undefined */
    3030        movl    %ebx, 1*4(%esp)
    3131        movl    9*4(%esp), %ebx         /* out_regs */
  • trunk/src/emx/src/lib/misc/386/setjmp.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    3030        movl    0*4(%esp), %eax         /* return address */
    3131        movl    %eax, J_EIP(%edx)
    32         cmpb    $0, __osmode            /* OS/2? */
    33         je      1f                      /* No -> skip */
    3432        fs
    3533        movl    0, %eax                 /* Exception handler */
    3634        movl    %eax, J_XCP(%edx)
    37 1:      xorl    %eax, %eax
     35        xorl    %eax, %eax
    3836        EPILOGUE(setjmp)
    3937
     
    4442_longjmp:
    4543        PROFILE_NOFRAME
    46         cmpb    $0, __osmode            /* OS/2? */
    47         je      2f                      /* No -> skip */
    4844        movl    1*4(%esp), %eax         /* there */
    4945        pushl   J_XCP(%eax)
    5046        call    ___unwind2              /* unwind signal handlers */
    5147        addl    $4, %esp
    52 2:      movl    1*4(%esp), %edx         /* there */
     48        movl    1*4(%esp), %edx         /* there */
    5349        movl    2*4(%esp), %eax         /* n */
    5450        testl   %eax, %eax
  • trunk/src/emx/src/lib/misc/386/sigsetjm.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    3232        movl    0*4(%esp), %eax         /* return address */
    3333        movl    %eax, J_EIP(%edx)
    34         cmpb    $0, __osmode            /* OS/2? */
    35         je      1f                      /* No -> skip */
    3634        fs
    3735        movl    0, %eax                 /* Exception handler */
    3836        movl    %eax, J_XCP(%edx)
    39 1:      movl    2*4(%esp), %eax         /* savemask */
     37        movl    2*4(%esp), %eax         /* savemask */
    4038        movl    %eax, J_SAVE(%edx)
    4139        testl   %eax, %eax
    42         je      2f
     40        je      1f
    4341        leal    J_MASK(%edx), %eax
    4442        pushl   %eax                    /* oset */
     
    4745        call    __sigprocmask
    4846        addl    $12, %esp
    49 2:      xorl    %eax, %eax
     471:      xorl    %eax, %eax
    5048        EPILOGUE(_sigsetjmp)
    5149
     
    6563        call    __sigprocmask
    6664        addl    $12, %esp
    67 1:      cmpb    $0, __osmode            /* OS/2? */
    68         je      2f                      /* No -> skip */
    69         movl    1*4(%esp), %eax         /* there */
     651:      movl    1*4(%esp), %eax         /* there */
    7066        pushl   J_XCP(%eax)
    7167        call    ___unwind2              /* unwind signal handlers */
    7268        addl    $4, %esp
    73 2:      movl    1*4(%esp), %edx         /* there */
     69        movl    1*4(%esp), %edx         /* there */
    7470        movl    2*4(%esp), %eax         /* n */
    7571        testl   %eax, %eax
    76         jne     3f
     72        jne     2f
    7773        incl    %eax
    78 3:      movl    J_EBX(%edx), %ebx
     742:      movl    J_EBX(%edx), %ebx
    7975        movl    J_ESI(%edx), %esi
    8076        movl    J_EDI(%edx), %edi
  • trunk/src/emx/src/lib/misc/abort.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1515     and SIGABRT is not blocked: do not yet call _cleanup(). */
    1616
    17   if (_sigaction (SIGABRT, NULL, &act) == 0
     17  if (sigaction (SIGABRT, NULL, &act) == 0
    1818      && act.sa_handler != SIG_IGN && act.sa_handler != SIG_DFL
    19       && _sigemptyset (&set) == 0
    20       && _sigprocmask (SIG_SETMASK, NULL, &set) == 0
    21       && _sigismember (&set, SIGABRT) == 0)
     19      && sigemptyset (&set) == 0
     20      && sigprocmask (SIG_SETMASK, NULL, &set) == 0
     21      && sigismember (&set, SIGABRT) == 0)
    2222    {
    2323      /* Raise SIGABRT.  Note that this is not guaranteed to terminate
     
    3030
    3131  act.sa_handler = SIG_DFL;
    32   _sigemptyset (&act.sa_mask);
     32  sigemptyset (&act.sa_mask);
    3333  act.sa_flags = 0;
    34   _sigaction (SIGABRT, &act, NULL);
     34  sigaction (SIGABRT, &act, NULL);
    3535
    3636  /* Clean up the C library only once. */
     
    4141  /* Unblock SIGABRT. */
    4242
    43   _sigemptyset (&set);
    44   _sigaddset (&set, SIGABRT);
    45   _sigprocmask (SIG_UNBLOCK, &set, NULL);
     43  sigemptyset (&set);
     44  sigaddset (&set, SIGABRT);
     45  sigprocmask (SIG_UNBLOCK, &set, NULL);
    4646
    4747  /* Raise SIGABRT again. */
     
    5151  /* This should not get reached. */
    5252
    53   _exit (3);
     53  exit (3);
    5454}
  • trunk/src/emx/src/lib/misc/alarm.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55
    6 unsigned _alarm (unsigned sec)
     6unsigned alarm (unsigned sec)
    77{
    88  return __alarm (sec);
  • trunk/src/emx/src/lib/misc/brk.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55
    6 void *_brk (void *addr)
     6void *brk (void *addr)
    77{
    88  return __brk (addr);
  • trunk/src/emx/src/lib/misc/chdir.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/syscalls.h>
    77
    8 int _chdir (const char *name)
     8int chdir (const char *name)
    99{
    1010  size_t len;
  • trunk/src/emx/src/lib/misc/cuserid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <string.h>
    66
    7 char *_cuserid (char *buffer)
     7char *cuserid (char *buffer)
    88{
    99  static char tmp_name[L_cuserid];
  • trunk/src/emx/src/lib/misc/dirent.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    3737    const char *base);
    3838
    39 int _closedir (DIR *dirp)
     39int closedir (DIR *dirp)
    4040{
    4141  free_dircontents (dirp->dd_contents);
     
    4545
    4646
    47 struct dirent *_readdir (DIR *dirp)
     47struct dirent *readdir (DIR *dirp)
    4848{
    4949  if (dirp->dd_cp == NULL)
     
    6565
    6666
    67 void _seekdir (DIR *dirp, long off)
     67void seekdir (DIR *dirp, long off)
    6868{
    6969  long i;
     
    8383
    8484
    85 void _rewinddir (DIR *dirp)
     85void rewinddir (DIR *dirp)
    8686{
    8787  _seekdir (dirp, 0L);
     
    8989
    9090
    91 long _telldir (DIR *dirp)
     91long telldir (DIR *dirp)
    9292{
    9393  return dirp->dd_loc;
     
    9595
    9696
    97 DIR *_opendir (const char *name)
     97DIR *opendir (const char *name)
    9898{
    9999  struct stat statb;
  • trunk/src/emx/src/lib/misc/dtread.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    170170  data.dir_pass = 1;
    171171  if (strcmp (mask, "*.*") == 0
    172       || (_osmode == OS2_MODE && strcmp (mask, "*") == 0))
     172      || (strcmp (mask, "*") == 0))
    173173    data.dir_pass = 0;
    174174  data.attr = A_HIDDEN | A_SYSTEM;
  • trunk/src/emx/src/lib/misc/fnmatch.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <string.h>
    44#include <ctype.h>
    5 #include <fnmatch.h>
     5#include <emx/fnmatch.h>
    66#include <sys/nls.h>
    77
     
    592592/* This is the public entrypoint, with signed arguments. */
    593593
    594 int _fnmatch (const char *mask, const char *name, int flags)
     594int fnmatch (const char *mask, const char *name, int flags)
    595595{
    596596  return _fnmatch_unsigned (mask, name, flags);
  • trunk/src/emx/src/lib/misc/fpathcon.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77/* Return the POSIX.1  minimum values, for now. */
    88
    9 long _fpathconf (int handle, int name)
     9long fpathconf (int handle, int name)
    1010{
    1111  switch (name)
  • trunk/src/emx/src/lib/misc/ftw.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    6666
    6767
    68 int _ftw (const char *path,
    69           int (*fn)(const char *name, const struct stat *stat_ptr, int flag),
    70           int depth)
     68int ftw (const char *path,
     69         int (*fn)(const char *name, const struct stat *stat_ptr, int flag),
     70         int depth)
    7171{
    7272  struct stat st;
  • trunk/src/emx/src/lib/misc/getcwd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77#include <emx/syscalls.h>
    88
    9 char *_getcwd (char *buffer, size_t size)
     9char *getcwd (char *buffer, size_t size)
    1010{
    1111  char tmp[MAXPATHLEN+1];
  • trunk/src/emx/src/lib/misc/getegid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <sys/types.h>
    55
    6 gid_t _getegid (void)
     6gid_t getegid (void)
    77{
    88  return 0;
  • trunk/src/emx/src/lib/misc/geteuid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <sys/types.h>
    55
    6 uid_t _geteuid (void)
     6uid_t geteuid (void)
    77{
    88  return 0;
  • trunk/src/emx/src/lib/misc/getgid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <sys/types.h>
    55
    6 gid_t _getgid (void)
     6gid_t getgid (void)
    77{
    88  return 0;
  • trunk/src/emx/src/lib/misc/getgrgid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77/* Dummy function */
    88
    9 struct group *_getgrgid (gid_t gid)
     9struct group *getgrgid (gid_t gid)
    1010{
    1111  static struct group tmp_grp;
  • trunk/src/emx/src/lib/misc/getgrnam.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77/* Dummy function */
    88
    9 struct group *_getgrnam (const char *name)
     9struct group *getgrnam (const char *name)
    1010{
    1111  static struct group tmp_grp;
  • trunk/src/emx/src/lib/misc/getgroup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <sys/types.h>
    55
    6 int _getgroups (int gidsetsize, gid_t grouplist [])
     6int getgroups (int gidsetsize, gid_t grouplist [])
    77{
    88  return 0;
  • trunk/src/emx/src/lib/misc/getlogin.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <unistd.h>
    77
    8 char *_getlogin (void)
     8char *getlogin (void)
    99{
    1010  static char tmp_name[L_cuserid];
  • trunk/src/emx/src/lib/misc/getopt.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r122 r123  
    3434/* Note: `argv' is not const as GETOPT_ANY reorders argv[]. */
    3535
    36 int _getopt (int argc, char * argv[], const char *opt_str)
     36int getopt (int argc, char * argv[], const char *opt_str)
    3737{
    3838  char c, *q;
  • trunk/src/emx/src/lib/misc/getpages.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <stdlib.h>
    44
    5 int _getpagesize (void)
     5int getpagesize (void)
    66{
    77  return 4096;
  • trunk/src/emx/src/lib/misc/getpass.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <unistd.h>
    44
    5 char *_getpass (const char *prompt)
     5char *getpass (const char *prompt)
    66{
    77  return _getpass2 (prompt, 1);
  • trunk/src/emx/src/lib/misc/getpgrp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <sys/types.h>
    66
    7 pid_t _getpgrp (void)
     7pid_t getpgrp (void)
    88{
    9   return _getpid ();
     9  return getpid ();
    1010}
  • trunk/src/emx/src/lib/misc/getpwnam.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    99/* Dummy function */
    1010
    11 struct passwd *_getpwnam (const char *name)
     11struct passwd *getpwnam (const char *name)
    1212{
    1313  if (name == NULL)
  • trunk/src/emx/src/lib/misc/getpwuid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    88/* Dummy function */
    99
    10 struct passwd *_getpwuid (uid_t uid)
     10struct passwd *getpwuid (uid_t uid)
    1111{
    1212  return _getpw (uid, NULL);
  • trunk/src/emx/src/lib/misc/getuid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <sys/types.h>
    55
    6 uid_t _getuid (void)
     6uid_t getuid (void)
    77{
    88  return 0;
  • trunk/src/emx/src/lib/misc/getvol.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    2525    return NULL;
    2626
    27   if (_osmode == OS2_MODE)
    28     {
    29       ULONG rc;
    30       FSINFO fsinfo;
     27  ULONG rc;
     28  FSINFO fsinfo;
    3129
    32       memset (&fsinfo, 0, sizeof (fsinfo));
    33       rc = DosQueryFSInfo (drive - 'A' + 1, FSIL_VOLSER, &fsinfo,
    34                            sizeof (fsinfo));
    35       if (rc != 0)
    36         return NULL;
    37       strcpy (result, fsinfo.vol.szVolLabel);
    38     }
    39   else
    40     {
    41       static struct _find find;
    42       char mask[7];
     30  memset (&fsinfo, 0, sizeof (fsinfo));
     31  rc = DosQueryFSInfo (drive - 'A' + 1, FSIL_VOLSER, &fsinfo,
     32                       sizeof (fsinfo));
     33  if (rc != 0)
     34    return NULL;
     35  strcpy (result, fsinfo.vol.szVolLabel);
    4336
    44       mask[0] = drive;
    45       strcpy (mask + 1, ":\\*.*");
    46       if (__findfirst (mask, _A_VOLID, &find) != 0)
    47         return NULL;
    48       strcpy (result, find.name);
    49     }
    5037  return result;
    5138}
  • trunk/src/emx/src/lib/misc/getwd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77#include <emx/syscalls.h>
    88
    9 char *_getwd (char *buffer)
     9char *getwd (char *buffer)
    1010{
    1111  if (buffer == NULL)
  • trunk/src/emx/src/lib/misc/glob.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <errno.h>
    66#include <unistd.h>
    7 #include <fnmatch.h>
     7#include <alloca.h>
     8#include <emx/fnmatch.h>
    89#include <glob.h>
    910#include <sys/types.h>
     
    115116  /* TODO: Optimize for lpat not containing global characters. */
    116117
    117   dir = _opendir (*base != 0 ? base : ".");
     118  dir = opendir (*base != 0 ? base : ".");
    118119  if (dir == NULL)
    119120    {
     
    124125      return 0;
    125126    }
    126   while ((ent = _readdir (dir)) != NULL)
    127     {
    128       if (_fnmatch (lpat, ent->d_name, fnm_flags) == 0)
     127  while ((ent = readdir (dir)) != NULL)
     128    {
     129      if (fnmatch (lpat, ent->d_name, fnm_flags) == 0)
    129130        {
    130131          len = base_len + ent->d_namlen;
     
    145146              if (!glob_add (pg, path))
    146147                {
    147                   _closedir (dir);
     148                  closedir (dir);
    148149                  return GLOB_NOSPACE;
    149150                }
     
    158159              if (r != 0)
    159160                {
    160                   _closedir (dir);
     161                  closedir (dir);
    161162                  return r;
    162163                }
     
    164165        }
    165166    }
    166   _closedir (dir);
     167  closedir (dir);
    167168  return 0;
    168169}
     
    175176
    176177
    177 int _glob (const char *pattern, int flags,
    178            int (*errfun)(const char *e_path, int e_errno), glob_t *pglob)
     178int glob (const char *pattern, int flags,
     179          int (*errfun)(const char *e_path, int e_errno), glob_t *pglob)
    179180{
    180181  struct globi g;
  • trunk/src/emx/src/lib/misc/mkdir.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <emx/syscalls.h>
    66
    7 int _mkdir (const char *name, long mode)
     7int mkdir (const char *name, long mode)
    88{
    9   mode = 0;                     /* Keep the compiler happy */
     9  (void)mode;                     /* Keep the compiler happy */
    1010  if (__mkdir (name) == 0)
    1111    return 0;
  • trunk/src/emx/src/lib/misc/os2bad.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    99{
    1010  __write (2, msg, sizeof (msg) - 1);
    11   _exit (2);
     11  exit (2);
    1212}
  • trunk/src/emx/src/lib/misc/pathconf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77/* Return the POSIX.1  minimum values, for now. */
    88
    9 long _pathconf (const char *path, int name)
     9long pathconf (const char *path, int name)
    1010{
    1111  switch (name)
  • trunk/src/emx/src/lib/misc/perror.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1414    }
    1515  if (e >= 0 && e < _sys_nerr)
    16     fputs (_sys_errlist[e], stderr);
     16    fputs (sys_errlist[e], stderr);
    1717  else
    1818    fprintf (stderr, "Unknown error %d", e);
  • trunk/src/emx/src/lib/misc/pwd.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    5858
    5959
    60 struct passwd *_getpwent (void)
     60struct passwd *getpwent (void)
    6161{
    6262  return NULL;                  /* End of /etc/passwd reached */
     
    6464
    6565
    66 void _setpwent (void)
     66void setpwent (void)
    6767{
    6868}
    6969
    7070
    71 void _endpwent (void)
     71void endpwent (void)
    7272{
    7373}
  • trunk/src/emx/src/lib/misc/rmdir.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <emx/syscalls.h>
    66
    7 int _rmdir (const char *name)
     7int rmdir (const char *name)
    88{
    99  if (__rmdir (name) == 0)
  • trunk/src/emx/src/lib/misc/sbrk.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55
    6 void *_sbrk (int incr)
     6void *sbrk (int incr)
    77{
    88  return __sbrk (incr);
  • trunk/src/emx/src/lib/misc/scrsize.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <emx/syscalls.h>
    44
    5 void _scrsize (int *dst)
     5void scrsize (int *dst)
    66{
    77  __scrsize (dst);
  • trunk/src/emx/src/lib/misc/searchen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1212 
    1313  strcpy (path, file);
    14   if (_access (path, 4) == 0)
     14  if (access (path, 4) == 0)
    1515    return;
    1616  list = getenv (var);
     
    3030              path[i++] = '\\';
    3131            strcpy (path+i, file);
    32             if (_access (path, 4) == 0)
     32            if (access (path, 4) == 0)
    3333              return;
    3434          }
  • trunk/src/emx/src/lib/misc/setgid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <sys/types.h>
    66
    7 int _setgid (gid_t gid)
     7int setgid (gid_t gid)
    88{
    99  if (gid != 0)
  • trunk/src/emx/src/lib/misc/setpgid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <sys/types.h>
    66
    7 int _setpgid (pid_t pid, pid_t pgid)
     7int setpgid (pid_t pid, pid_t pgid)
    88{
    99  errno = ENOSYS;
  • trunk/src/emx/src/lib/misc/setsid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <sys/types.h>
    66
    7 pid_t _setsid (void)
     7pid_t setsid (void)
    88{
    99  errno = EPERM;
  • trunk/src/emx/src/lib/misc/setuid.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <sys/types.h>
    66
    7 int _setuid (uid_t uid)
     7int setuid (uid_t uid)
    88{
    99  if (uid != 0)
  • trunk/src/emx/src/lib/misc/sleep.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55
    6 unsigned _sleep (unsigned sec)
     6unsigned sleep (unsigned sec)
    77{
    88  return __sleep (sec);
  • trunk/src/emx/src/lib/misc/sleep2.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55
    6 unsigned _sleep2 (unsigned millisec)
     6unsigned sleep2 (unsigned millisec)
    77{
    88  return __sleep2 (millisec);
  • trunk/src/emx/src/lib/misc/sysconf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    88/* Return the POSIX.1  minimum values, for now. */
    99
    10 long _sysconf (int name)
     10long sysconf (int name)
    1111{
    1212  switch (name)
  • trunk/src/emx/src/lib/misc/syserr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    11/* syserr.c (emx+gcc) -- Copyright (c) 1990-1998 by Eberhard Mattes */
    22
    3 const char * const _sys_errlist[] =
     3const char * const sys_errlist[] =
    44{
    55  /*  0 EZERO          */ "Error 0",
     
    7272};
    7373
    74 const int _sys_nerr = sizeof (_sys_errlist) / sizeof (_sys_errlist[0]);
     74const int sys_nerr = sizeof (sys_errlist) / sizeof (sys_errlist[0]);
  • trunk/src/emx/src/lib/misc/syserrno.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <emx/syscalls.h>
    44
    5 int _syserrno (void)
     5int syserrno (void)
    66{
    77  return __syserrno ();
  • trunk/src/emx/src/lib/misc/uflags.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55
    6 int _uflags (int mask, int new_bits)
     6int uflags (int mask, int new_bits)
    77{
    88  return __uflags (mask, new_bits);
  • trunk/src/emx/src/lib/misc/ulimit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77#include <emx/syscalls.h>
    88
    9 long _ulimit (int cmd, ...)
     9long ulimit (int cmd, ...)
    1010{
    1111  va_list arg_ptr;
  • trunk/src/emx/src/lib/misc/uname.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    99#define CHR(x)       (char)((x)+'0')
    1010
    11 int _uname (struct utsname *name)
     11int uname (struct utsname *name)
    1212{
    1313  char *host;
    14   int dos;
    1514
    16   dos = (_osmode == DOS_MODE && _osmajor < 10);
    1715  host = getenv ("HOSTNAME");
    1816  if (host == NULL)
    1917    host = "standalone";
    2018
    21   SET (sysname, (dos ? "MS-DOS" : "OS/2"));
     19  SET (sysname, ("OS/2"));
    2220  SET (nodename, host);
    2321  SET (release, "1");
    24   name->version[0] = (dos ? CHR (_osmajor) : CHR (_osmajor / 10));
     22  name->version[0] = (CHR (_osmajor / 10));
    2523  name->version[1] = '.';
    2624  name->version[2] = CHR (_osminor / 10);
  • trunk/src/emx/src/lib/moddef/moddef.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    22.MDESC  := A library for working with .DEF files
    33
    4 .TKIND  := aout st
     4.TKIND  := aout
    55.TARGET := moddef$A
    66.TSRC   := $(wildcard src/lib/moddef/*.c)
  • trunk/src/emx/src/lib/omflib/omflib.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    22.MDESC  := A library for reading/writing OMF object files
    33
    4 .TKIND  := aout st
     4.TKIND  := aout
    55.TARGET := omflib$A
    66.TSRC   := $(wildcard src/lib/omflib/*.c)
  • trunk/src/emx/src/lib/process/386/_errno.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1414__errno:
    1515__errno_fun:
    16         cmpb    $0, __osmode            /* _osmode == DOS_MODE? */
    17         je      1f                      /* Yes -> */
    1816        fs
    1917        movl    12, %eax                /* ptib2 */
     
    2119        movl    __thread_tab(,%eax,4), %eax
    2220/       addl    $0, %eax                /* address of errno */
    23 Lreturn:EPILOGUE(_errno)
    24 
    25         ALIGN
    26 
    27 1:      movl    __thread_tab+4, %eax
    28 /       addl    $0, %eax                /* address of errno */
    29         jmp     Lreturn
     21        EPILOGUE(_errno)
    3022
    3123#else
  • trunk/src/emx/src/lib/process/386/gettid.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1010
    1111__gettid:
    12         cmpb    $0, __osmode            /* _osmode == DOS_MODE? */
    13         je      1f                      /* Yes -> */
    1412        fs
    1513        movl    12, %eax                /* ptib2 */
    1614        movl    0(%eax), %eax           /* TID */
    17 Lreturn:EPILOGUE(_gettid)
    18 
    19         ALIGN
    20 1:      movl    $1, %eax
    21         jmp     Lreturn
     15        EPILOGUE(_gettid)
  • trunk/src/emx/src/lib/process/386/thread.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1212
    1313__thread:
    14         cmpb    $0, __osmode            /* _osmode == DOS_MODE? */
    15         je      1f                      /* Yes -> */
    1614        fs
    1715        movl    12, %eax                /* ptib2 */
     
    1917        movl    __thread_tab(,%edx,4), %eax
    2018        testl   %eax, %eax
    21         jz      2f
     19        jz      1f
    2220Lreturn:EPILOGUE(_thread)
    2321
    2422        ALIGN
    25 1:      movl    __thread_tab+4, %eax
    26         jmp     Lreturn
    27 
    28         ALIGN
    29 2:      pushl   %edx
     231:      pushl   %edx
    3024        call    ___alloc_thread
    3125        popl    %edx
  • trunk/src/emx/src/lib/process/execl.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <process.h>
    66
    7 int _execl (const char *name, const char *arg0, ...)
     7int execl (const char *name, const char *arg0, ...)
    88{
    99  va_list arg_ptr;
     
    1414  /* Note: Passing `arg_ptr' to spawnv() is not portable. */
    1515
    16   result = _spawnv (P_OVERLAY, name, (char * const *)arg_ptr);
     16  result = spawnv (P_OVERLAY, name, (char * const *)arg_ptr);
    1717  va_end (arg_ptr);
    1818  return result;
  • trunk/src/emx/src/lib/process/execle.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <process.h>
    66
    7 int _execle (const char *name, const char *arg0, ...)
     7int execle (const char *name, const char *arg0, ...)
    88{
    99  va_list arg_ptr;
     
    2020  /* Note: Passing `arg_ptr' to spawnve() is not portable. */
    2121
    22   result = _spawnve (P_OVERLAY, name, (char * const *)arg_ptr, env_ptr);
     22  result = spawnve (P_OVERLAY, name, (char * const *)arg_ptr, env_ptr);
    2323  va_end (arg_ptr);
    2424  return result;
  • trunk/src/emx/src/lib/process/execlp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <process.h>
    66
    7 int _execlp (const char *name, const char *arg0, ...)
     7int execlp (const char *name, const char *arg0, ...)
    88{
    99  va_list arg_ptr;
     
    1414  /* Note: Passing `arg_ptr' to spawnvp() is not portable. */
    1515
    16   result = _spawnvp (P_OVERLAY, name, (char * const *)arg_ptr);
     16  result = spawnvp (P_OVERLAY, name, (char * const *)arg_ptr);
    1717  va_end (arg_ptr);
    1818  return result;
  • trunk/src/emx/src/lib/process/execlpe.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <process.h>
    66
    7 int _execlpe (const char *name, const char *arg0, ...)
     7int execlpe (const char *name, const char *arg0, ...)
    88{
    99  va_list arg_ptr;
     
    2020  /* Note: Passing `arg_ptr' to spawnvpe() is not portable. */
    2121
    22   result = _spawnvpe (P_OVERLAY, name, (char * const *)arg_ptr, env_ptr);
     22  result = spawnvpe (P_OVERLAY, name, (char * const *)arg_ptr, env_ptr);
    2323  va_end (arg_ptr);
    2424  return result;
  • trunk/src/emx/src/lib/process/execv.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <process.h>
    44
    5 int _execv (const char *name, char * const argv[])
     5int execv (const char *name, char * const argv[])
    66{
    7   return _spawnv (P_OVERLAY, name, argv);
     7  return spawnv (P_OVERLAY, name, argv);
    88}
  • trunk/src/emx/src/lib/process/execve.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <process.h>
    44
    5 int _execve (const char *name, char * const argv[], char * const envp[])
     5int execve (const char *name, char * const argv[], char * const envp[])
    66{
    7   return _spawnve (P_OVERLAY, name, argv, envp);
     7  return spawnve (P_OVERLAY, name, argv, envp);
    88}
  • trunk/src/emx/src/lib/process/execvp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <process.h>
    44
    5 int _execvp (const char *name, char * const argv[])
     5int execvp (const char *name, char * const argv[])
    66{
    7   return _spawnvp (P_OVERLAY, name, argv);
     7  return spawnvp (P_OVERLAY, name, argv);
    88}
  • trunk/src/emx/src/lib/process/execvpe.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <process.h>
    44
    5 int _execvpe (const char *name, char * const argv[], char * const envp[])
     5int execvpe (const char *name, char * const argv[], char * const envp[])
    66{
    7   return _spawnvpe (P_OVERLAY, name, argv, envp);
     7  return spawnvpe (P_OVERLAY, name, argv, envp);
    88}
  • trunk/src/emx/src/lib/process/fmutex.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1616{
    1717  sem->fs = _FMS_AVAILABLE;
    18   if (_osmode == DOS_MODE)
    19     return 0;
    2018  return DosCreateEventSem (NULL, (PHEV)&sem->hev,
    2119                            (flags & _FMC_SHARED) ? DC_SEM_SHARED : 0,
     
    2624unsigned _fmutex_open (_fmutex *sem)
    2725{
    28   if (_osmode == DOS_MODE)
    29     return 0;
    3026  return DosOpenEventSem (NULL, (PHEV)&sem->hev);
    3127}
     
    3430unsigned _fmutex_close (_fmutex *sem)
    3531{
    36   if (_osmode == DOS_MODE)
    37     return 0;
    3832  return DosCloseEventSem (sem->hev);
    3933}
  • trunk/src/emx/src/lib/process/fork.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66extern void _rmutex_fork (void);
    77
    8 int _fork (void)
     8int fork (void)
    99{
    1010  int pid;
  • trunk/src/emx/src/lib/process/spawnl.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <process.h>
    66
    7 int _spawnl (int mode, const char *name, const char *arg0, ...)
     7int spawnl (int mode, const char *name, const char *arg0, ...)
    88{
    99  va_list arg_ptr;
     
    1414  /* Note: Passing `arg_ptr' to spawnv() is not portable. */
    1515
    16   result = _spawnv (mode, name, (char * const *)arg_ptr);
     16  result = spawnv (mode, name, (char * const *)arg_ptr);
    1717  va_end (arg_ptr);
    1818  return result;
  • trunk/src/emx/src/lib/process/spawnle.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <process.h>
    66
    7 int _spawnle (int mode, const char *name, const char *arg0, ...)
     7int spawnle (int mode, const char *name, const char *arg0, ...)
    88{
    99  va_list arg_ptr;
     
    2020  /* Note: Passing `arg_ptr' to spawnve() is not portable. */
    2121
    22   result = _spawnve (mode, name, (char * const *)arg_ptr, env_ptr);
     22  result = spawnve (mode, name, (char * const *)arg_ptr, env_ptr);
    2323  va_end (arg_ptr);
    2424  return result;
  • trunk/src/emx/src/lib/process/spawnlp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <process.h>
    66
    7 int _spawnlp (int mode, const char *name, const char *arg0, ...)
     7int spawnlp (int mode, const char *name, const char *arg0, ...)
    88{
    99  va_list arg_ptr;
     
    1414  /* Note: Passing `arg_ptr' to spawnvp() is not portable. */
    1515
    16   result = _spawnvp (mode, name, (char * const *)arg_ptr);
     16  result = spawnvp (mode, name, (char * const *)arg_ptr);
    1717  va_end (arg_ptr);
    1818  return result;
  • trunk/src/emx/src/lib/process/spawnlpe.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    55#include <process.h>
    66
    7 int _spawnlpe (int mode, const char *name, const char *arg0, ...)
     7int spawnlpe (int mode, const char *name, const char *arg0, ...)
    88{
    99  va_list arg_ptr;
     
    2020  /* Note: Passing `arg_ptr' to spawnvpe() is not portable. */
    2121
    22   result = _spawnvpe (mode, name, (char * const *)arg_ptr, env_ptr);
     22  result = spawnvpe (mode, name, (char * const *)arg_ptr, env_ptr);
    2323  va_end (arg_ptr);
    2424  return result;
  • trunk/src/emx/src/lib/process/spawnv.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <process.h>
    55
    6 int _spawnv (int mode, const char *name, char * const argv[])
     6int spawnv (int mode, const char *name, char * const argv[])
    77{
    8   return _spawnve (mode, name, argv, NULL);
     8  return spawnve (mode, name, argv, NULL);
    99}
  • trunk/src/emx/src/lib/process/spawnvp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <process.h>
    55
    6 int _spawnvp (int mode, const char *name, char * const argv[])
     6int spawnvp (int mode, const char *name, char * const argv[])
    77{
    8   return _spawnvpe (mode, name, argv, NULL);
     8  return spawnvpe (mode, name, argv, NULL);
    99}
  • trunk/src/emx/src/lib/process/spawnvpe.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    22
    33#include <stdlib.h>
     4#include <string.h>
    45#include <process.h>
    56#include <errno.h>
    67
    7 int _spawnvpe (int mode, const char *name, char * const argv[],
    8                char * const envp[])
     8int spawnvpe (int mode, const char *name, char * const argv[],
     9              char * const envp[])
    910{
    1011  char exe[512];
     
    2021  if (_path (path, exe) != 0)
    2122    return -1;
    22   return _spawnve (mode, path, argv, envp);
     23  return spawnve (mode, path, argv, envp);
    2324}
  • trunk/src/emx/src/lib/process/system.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    2323    return _access (sh, 0) == 0;
    2424  if (*name == 0)
    25     rc = _spawnlp (P_WAIT, sh, sh, (char *)0);
     25    rc = spawnlp (P_WAIT, sh, sh, (char *)0);
    2626  else
    2727    {
    2828      base = _getname (sh);
    29       if (_stricmp (base, "cmd.exe") == 0 || _stricmp (base, "4os2.exe") == 0
    30           || _stricmp (base, "command.com") == 0
    31           || _stricmp (base, "4dos.com") == 0)
     29      if (stricmp (base, "cmd.exe") == 0
     30       || stricmp (base, "4os2.exe") == 0
     31       || stricmp (base, "command.com") == 0
     32       || stricmp (base, "4dos.com") == 0)
    3233        opt = "/c";
    3334      else
    3435        opt = "-c";
    35       rc = _spawnlp (P_WAIT, sh, sh, opt, name, (char *)0);
     36      rc = spawnlp (P_WAIT, sh, sh, opt, name, (char *)0);
    3637    }
    3738  return rc;
  • trunk/src/emx/src/lib/startup/386/crt0.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1313__text:
    1414        push    $__data
    15 #if defined (OMF)
    1615        call    __emx_init
    17 #else
    18         call    __dos_init
    19 #endif
    2016        jmp     __init
    2117
    2218___syscall:
    23 #if defined (OMF)
    2419        call    __emx_syscall
    25 #else
    26         call    __dos_syscall
    27 #endif
    2820        ret
    2921
     
    5547
    5648__data:
    57 #if defined (OMF)
    58         .long   0
    59         .long   0
    60         .long   0
    61         .long   0
    62         .long   0
    63         .long   0
    64 #else
    65         .long   __text
    66         .long   __etext
    67         .long   __data
    68         .long   __edata
    69         .long   __edata
    70         .long   __end
    71 #endif
    7249__heap_base:
    7350        .long   0                       /* heap base address */
     
    8057        .long   0                       /* stack base address */
    8158        .long   0                       /* stack end address */
    82 #if defined (OMF)
    8359        .long   0x02000002              /* flags: application, OMF */
    84 #else
    85         .long   0x02000000              /* flags: application */
    86 #endif
    8760        .long   0                       /* reserved */
    8861        .long   0                       /* reserved */
     
    9265/ first element of vector (N_SETA|N_EXT == 21)
    9366
    94 #if defined (OMF)
    9567__os2dll:
    9668        .long   0, 0
    97 #else
    98         .stabs  "__os2dll", 21, 0, 0, 0xffffffff
    99 #endif
     69/       .stabs  "__os2dll", 21, 0, 0, 0xffffffff
    10070
    10171        .stabs  "___CTOR_LIST__", 21, 0, 0, 0xffffffff
  • trunk/src/emx/src/lib/startup/386/crt1.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1414        .globl  _errno
    1515#endif
    16         .globl  __osmode
    1716        .globl  __emx_env
    1817        .globl  __emx_vcmp
     
    3736        movl    %eax, __emx_vprt
    3837        movb    $0, __emx_vprt+4
    39         testl   $0x200, %edx
    40         setne   __osmode
    4138        EPILOGUE(_entry2)
    4239
     
    4643_errno: .long   0
    4744#endif
    48 __osmode:       .byte 1                         /* OS2_MODE = 1 */
    4945        .comm   __emx_rev, 4
    5046        .comm   __emx_env, 4
  • trunk/src/emx/src/lib/startup/386/dll0.s

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1313__text:
    1414        push    $__data
    15 #if defined (OMF)
    1615        call    __emx_init
    17 #else
    18         call    __dos_init
    19 #endif
    2016        jmp     __init
    2117
    2218
    2319___syscall:
    24 #if defined (OMF)
    2520        call    __emx_syscall
    26 #else
    27         call    __dos_syscall
    28 #endif
    2921        ret
    3022
     
    6153        .long   0                       /* stack base address */
    6254        .long   0                       /* stack end address */
    63 #if defined (OMF)
    6455        .long   0x02000003              /* flags: DLL, OMF */
    65 #else
    66         .long   0x02000001              /* flags: DLL */
    67 #endif
    6856        .long   0                       /* reserved */
    6957        .long   0                       /* reserved */
     
    7361/ first element of vector (N_SETA|N_EXT == 21)
    7462
    75 #if defined (OMF)
    7663__os2dll:
    7764        .long   0, 0
    78 #else
    79         .stabs  "__os2dll", 21, 0, 0, 0xffffffff
    80 #endif
     65/       .stabs  "__os2dll", 21, 0, 0, 0xffffffff
    8166
    8267        .stabs  "___CTOR_LIST__", 21, 0, 0, 0xffffffff
  • trunk/src/emx/src/lib/startup/gmon.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    3232 */
    3333
    34 #ifndef lint
    35 static char sccsid[] = "@(#)gmon.c      5.3 (Berkeley) 5/22/91";
    36 #endif /* not lint */
    37 
    38 #if 0
    39 #include <unistd.h>
    40 
    41 #endif
    42 #ifdef DEBUG
    4334#include <stdio.h>
    44 #endif
    45 
    46 #ifdef EMX
    4735#include <stdlib.h>
    4836#include <fcntl.h>
    49 #endif /* EMX */
     37#include <unistd.h>
     38#include <io.h>
    5039
    5140#include "gmon.h"
    5241
    53 #ifndef EMX
    54 extern mcount() asm ("mcount");
    55 extern char *minbrk asm ("minbrk");
    56 #endif /* not EMX */
    57 
    58     /*
    59      *  froms is actually a bunch of unsigned shorts indexing tos
    60      */
     42/*
     43 *      froms is actually a bunch of unsigned shorts indexing tos
     44 */
    6145static int              profiling = 3;
    6246static unsigned short   *froms;
     
    7054static char     *sbuf;
    7155static int      s_scale;
    72     /* see profil(2) where this is describe (incorrectly) */
     56/* see profil(2) where this is describe (incorrectly) */
    7357#define         SCALE_1_TO_1    0x10000L
    7458
    7559#define MSG "No space for profiling buffer(s)\n"
    7660
     61/* Forward definition */
     62void moncontrol();
     63
     64void
    7765monstartup(lowpc, highpc)
    7866    char        *lowpc;
     
    119107        return;
    120108    }
    121 #ifndef EMX
    122     minbrk = sbrk(0);
    123 #endif /* not EMX */
    124109    tos[0].link = 0;
    125110    sbuf = buffer;
     
    133118    o = highpc - lowpc;
    134119    if( monsize < o )
    135 #ifndef hp300
    136120        s_scale = ( (float) monsize / o ) * SCALE_1_TO_1;
    137 #else /* avoid floating point */
    138     {
    139         int quot = o / monsize;
    140 
    141         if (quot >= 0x10000)
    142                 s_scale = 1;
    143         else if (quot >= 0x100)
    144                 s_scale = 0x10000 / quot;
    145         else if (o >= 0x800000)
    146                 s_scale = 0x1000000 / (o / (monsize >> 8));
    147         else
    148                 s_scale = 0x1000000 / ((o << 8) / monsize);
    149     }
    150 #endif
    151121    else
    152122        s_scale = SCALE_1_TO_1;
     
    154124}
    155125
     126void
    156127_mcleanup()
    157128{
     
    164135
    165136    moncontrol(0);
    166     fd = creat( "gmon.out" , 0666 );
    167     if ( fd < 0 ) {
     137    fd = open ("gmon.out" , O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, 0666);
     138    if (fd < 0) {
    168139        perror( "mcount: gmon.out" );
    169140        return;
    170141    }
    171 #ifdef EMX
    172     setmode (fd, O_BINARY);
    173 #endif /* EMX */
    174142#   ifdef DEBUG
    175143        fprintf( stderr , "[mcleanup] sbuf 0x%x ssiz %d\n" , sbuf , ssiz );
    176 #   endif DEBUG
     144#   endif /* DEBUG */
    177145    write( fd , sbuf , ssiz );
    178146    endfrom = s_textsize / (HASHFRACTION * sizeof(*froms));
     
    187155                        "[mcleanup] frompc 0x%x selfpc 0x%x count %d\n" ,
    188156                        frompc , tos[toindex].selfpc , tos[toindex].count );
    189 #           endif DEBUG
     157#           endif /* DEBUG */
    190158            rawarc.raw_frompc = (unsigned long) frompc;
    191159            rawarc.raw_selfpc = (unsigned long) tos[toindex].selfpc;
     
    197165}
    198166
    199 #ifdef EMX
     167void
    200168_mcount()
    201 #else /* not EMX */
    202 mcount()
    203 #endif /* not EMX */
    204169{
    205         register char                   *selfpc;
    206         register unsigned short         *frompcindex;
    207         register struct tostruct        *top;
    208         register struct tostruct        *prevtop;
    209         register long                   toindex;
    210 
     170    register char *selfpc;
     171    register unsigned short *frompcindex;
     172    register struct tostruct *top;
     173    register struct tostruct *prevtop;
     174    register long toindex;
     175
     176    /*
     177     *  find the return address for mcount,
     178     *  and the return address for mcount's caller.
     179     */
     180
     181    /* selfpc = pc pushed by mcount call.
     182       This identifies the function that was just entered.  */
     183    selfpc = (void *) __builtin_return_address (0);
     184    /* frompcindex = pc in preceding frame.
     185       This identifies the caller of the function just entered.  */
     186    frompcindex = (void *) __builtin_return_address (1);
     187    /*
     188     *  check that we are profiling
     189     *  and that we aren't recursively invoked.
     190     */
     191    if (profiling) {
     192        goto out;
     193    }
     194
     195    /* Profile thread 1 only. */
     196    if (_gettid () != 1)
     197        goto out;
     198
     199    profiling++;
     200    /*
     201     *  check that frompcindex is a reasonable pc value.
     202     *  for example:    signal catchers get called from the stack,
     203     *                  not from text space.  too bad.
     204     */
     205    frompcindex = (unsigned short *)((long)frompcindex - (long)s_lowpc);
     206    if ((unsigned long)frompcindex > s_textsize) {
     207        goto done;
     208    }
     209    frompcindex =
     210        &froms[((long)frompcindex) / (HASHFRACTION * sizeof(*froms))];
     211    toindex = *frompcindex;
     212    if (toindex == 0) {
    211213        /*
    212          *      find the return address for mcount,
    213          *      and the return address for mcount's caller.
     214         *      first time traversing this arc
    214215         */
    215 
    216         /* selfpc = pc pushed by mcount call.
    217            This identifies the function that was just entered.  */
    218         selfpc = (void *) __builtin_return_address (0);
    219         /* frompcindex = pc in preceding frame.
    220            This identifies the caller of the function just entered.  */
    221         frompcindex = (void *) __builtin_return_address (1);
     216        toindex = ++tos[0].link;
     217        if (toindex >= tolimit) {
     218            goto overflow;
     219        }
     220        *frompcindex = toindex;
     221        top = &tos[toindex];
     222        top->selfpc = selfpc;
     223        top->count = 1;
     224        top->link = 0;
     225        goto done;
     226    }
     227    top = &tos[toindex];
     228    if (top->selfpc == selfpc) {
    222229        /*
    223          *      check that we are profiling
    224          *      and that we aren't recursively invoked.
     230         *      arc at front of chain; usual case.
    225231         */
    226         if (profiling) {
    227                 goto out;
    228         }
    229 #ifdef EMX
    230         /* Profile thread 1 only. */
    231         if (_gettid () != 1)
    232                 goto out;
    233 #endif /* EMX */
    234         profiling++;
     232        top->count++;
     233        goto done;
     234    }
     235    /*
     236     *  have to go looking down chain for it.
     237     *  top points to what we are looking at,
     238     *  prevtop points to previous top.
     239     *  we know it is not at the head of the chain.
     240     */
     241    for (; /* goto done */; ) {
     242        if (top->link == 0) {
     243            /*
     244             *  top is end of the chain and none of the chain
     245             *  had top->selfpc == selfpc.
     246             *  so we allocate a new tostruct
     247             *  and link it to the head of the chain.
     248             */
     249            toindex = ++tos[0].link;
     250            if (toindex >= tolimit) {
     251                goto overflow;
     252            }
     253            top = &tos[toindex];
     254            top->selfpc = selfpc;
     255            top->count = 1;
     256            top->link = *frompcindex;
     257            *frompcindex = toindex;
     258            goto done;
     259        }
    235260        /*
    236          *      check that frompcindex is a reasonable pc value.
    237          *      for example:    signal catchers get called from the stack,
    238          *                      not from text space.  too bad.
     261         *      otherwise, check the next arc on the chain.
    239262         */
    240         frompcindex = (unsigned short *)((long)frompcindex - (long)s_lowpc);
    241         if ((unsigned long)frompcindex > s_textsize) {
    242                 goto done;
    243         }
    244         frompcindex =
    245             &froms[((long)frompcindex) / (HASHFRACTION * sizeof(*froms))];
    246         toindex = *frompcindex;
    247         if (toindex == 0) {
    248                 /*
    249                  *      first time traversing this arc
    250                  */
    251                 toindex = ++tos[0].link;
    252                 if (toindex >= tolimit) {
    253                         goto overflow;
    254                 }
    255                 *frompcindex = toindex;
    256                 top = &tos[toindex];
    257                 top->selfpc = selfpc;
    258                 top->count = 1;
    259                 top->link = 0;
    260                 goto done;
    261         }
    262         top = &tos[toindex];
     263        prevtop = top;
     264        top = &tos[top->link];
    263265        if (top->selfpc == selfpc) {
    264                 /*
    265                  *      arc at front of chain; usual case.
    266                  */
    267                 top->count++;
    268                 goto done;
    269         }
    270         /*
    271          *      have to go looking down chain for it.
    272          *      top points to what we are looking at,
    273          *      prevtop points to previous top.
    274          *      we know it is not at the head of the chain.
    275          */
    276         for (; /* goto done */; ) {
    277                 if (top->link == 0) {
    278                         /*
    279                          *      top is end of the chain and none of the chain
    280                          *      had top->selfpc == selfpc.
    281                          *      so we allocate a new tostruct
    282                          *      and link it to the head of the chain.
    283                          */
    284                         toindex = ++tos[0].link;
    285                         if (toindex >= tolimit) {
    286                                 goto overflow;
    287                         }
    288                         top = &tos[toindex];
    289                         top->selfpc = selfpc;
    290                         top->count = 1;
    291                         top->link = *frompcindex;
    292                         *frompcindex = toindex;
    293                         goto done;
    294                 }
    295                 /*
    296                  *      otherwise, check the next arc on the chain.
    297                  */
    298                 prevtop = top;
    299                 top = &tos[top->link];
    300                 if (top->selfpc == selfpc) {
    301                         /*
    302                          *      there it is.
    303                          *      increment its count
    304                          *      move it to the head of the chain.
    305                          */
    306                         top->count++;
    307                         toindex = prevtop->link;
    308                         prevtop->link = top->link;
    309                         top->link = *frompcindex;
    310                         *frompcindex = toindex;
    311                         goto done;
    312                 }
    313 
    314         }
     266            /*
     267             *  there it is.
     268             *  increment its count
     269             *  move it to the head of the chain.
     270             */
     271            top->count++;
     272            toindex = prevtop->link;
     273            prevtop->link = top->link;
     274            top->link = *frompcindex;
     275            *frompcindex = toindex;
     276            goto done;
     277        }
     278    }
    315279done:
    316         profiling--;
    317         /* and fall through */
     280    profiling--;
     281    /* and fall through */
    318282out:
    319         return;         /* normal return restores saved registers */
     283    return;             /* normal return restores saved registers */
    320284
    321285overflow:
    322         profiling++; /* halt further profiling */
    323 #   define      TOLIMIT "mcount: tos overflow\n"
    324         write(2, TOLIMIT, sizeof(TOLIMIT));
    325         goto out;
     286    profiling++; /* halt further profiling */
     287#define TOLIMIT "mcount: tos overflow\n"
     288    write(2, TOLIMIT, sizeof(TOLIMIT));
     289    goto out;
    326290}
    327291
     
    331295 *      all the data structures are ready.
    332296 */
     297void
    333298moncontrol(mode)
    334299    int mode;
  • trunk/src/emx/src/lib/str/memccpy.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <string.h>
    44
    5 void *_memccpy (void *s1, const void *s2, int c, size_t n)
     5void *memccpy (void *s1, const void *s2, int c, size_t n)
    66{
    77  size_t i;
  • trunk/src/emx/src/lib/str/memicmp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <ctype.h>
    55
    6 int _memicmp (const void *s1, const void *s2, size_t n)
     6int memicmp (const void *s1, const void *s2, size_t n)
    77{
    88  size_t i;
  • trunk/src/emx/src/lib/str/strdup.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <stdlib.h>
    55
    6 char *_strdup (const char *string)
     6char *strdup (const char *string)
    77{
    88  char *p;
  • trunk/src/emx/src/lib/str/strerror.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1919#endif
    2020      memcpy (result, msg, sizeof (msg) - 1);
    21       _itoa (errnum, result + sizeof (msg) - 1, 10);
     21      itoa (errnum, result + sizeof (msg) - 1, 10);
    2222      return result;
    2323    }
  • trunk/src/emx/src/lib/str/stricmp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <ctype.h>
    55
    6 int _stricmp (const char *string1, const char *string2)
     6int stricmp (const char *string1, const char *string2)
    77{
    88  int d;
  • trunk/src/emx/src/lib/str/strlwr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <ctype.h>
    55
    6 char *_strlwr (char *string)
     6char *strlwr (char *string)
    77{
    88  unsigned char *p;
     
    1010  for (p = (unsigned char *)string; *p != 0; ++p)
    1111    if (isupper (*p))
    12       *p = (unsigned char)_tolower (*p);
     12      *p = (unsigned char)tolower (*p);
    1313  return string;
    1414}
  • trunk/src/emx/src/lib/str/strnicmp.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <ctype.h>
    55
    6 int _strnicmp (const char *string1, const char *string2, size_t count)
     6int strnicmp (const char *string1, const char *string2, size_t count)
    77{
    88  int d;
  • trunk/src/emx/src/lib/str/strnset.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <string.h>
    44
    5 char *_strnset (char *string, int c, size_t count)
     5char *strnset (char *string, int c, size_t count)
    66{
    77  char *dst;
  • trunk/src/emx/src/lib/str/strrev.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <string.h>
    44
    5 char *_strrev (char *string)
     5char *strrev (char *string)
    66{
    77  char *p, *q, c;
  • trunk/src/emx/src/lib/str/strset.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33#include <string.h>
    44
    5 char *_strset (char *string, int c)
     5char *strset (char *string, int c)
    66{
    77  char *dst;
  • trunk/src/emx/src/lib/str/strtok.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1212#define next (tp->_th_strtok_ptr)
    1313#else
    14     static unsigned char *next = NULL;
     14  static unsigned char *next = NULL;
    1515#endif
    1616  if (string1 != NULL)
  • trunk/src/emx/src/lib/str/strupr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <ctype.h>
    55
    6 char *_strupr (char *string)
     6char *strupr (char *string)
    77{
    88  unsigned char *p;
     
    1010  for (p = (unsigned char *)string; *p != 0; ++p)
    1111    if (islower (*p))
    12       *p = (unsigned char)_toupper (*p);
     12      *p = (unsigned char)toupper (*p);
    1313  return string;
    1414}
  • trunk/src/emx/src/lib/sys/__ftime.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    2121  tm.tm_year = now.year - 1900;
    2222  tm.tm_isdst = -1;             /* unknown */
    23   ptr->time = (time_t)_mktime (&tm);
     23  ptr->time = (time_t)mktime (&tm);
    2424  ptr->millitm = now.hundredths * 10;
    2525  ptr->timezone = now.timezone;
  • trunk/src/emx/src/lib/sys/__getdrive.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1919    }
    2020}
    21 
  • trunk/src/emx/src/lib/sys/__init.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <os2emx.h>
    55#include <string.h>
     6#include <alloca.h>
    67#include <sys/builtin.h>
    78#include <sys/fmutex.h>
  • trunk/src/emx/src/lib/sys/__mkdir.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55#include "syscalls.h"
    6 
    76
    87int __mkdir (const char *name)
  • trunk/src/emx/src/lib/sys/__rmdir.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <emx/syscalls.h>
    55#include "syscalls.h"
    6 
    76
    87int __rmdir (const char *name)
  • trunk/src/emx/src/lib/sys/filesys.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <errno.h>
    55#include <os2emx.h>
     6#include <alloca.h>
    67#include <emx/syscalls.h>
    78#include "syscalls.h"
  • trunk/src/emx/src/lib/sys/p2t.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1818  tm.tm_year = d.year + 1980 - 1900;
    1919  tm.tm_isdst = -1;             /* unknown */
    20   return _mktime (&tm);
     20  return mktime (&tm);
    2121}
  • trunk/src/emx/src/lib/sys/pause.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    44#include <os2emx.h>
    55#include <emx/syscalls.h>
     6#include <errno.h>
    67#include "syscalls.h"
    78
    8 void __pause (void)
     9int pause (void)
    910{
    1011  while (DosSleep (0xffffffff) == 0)
    1112    ;
     13  errno = EINTR;
     14  return -1;
    1215}
  • trunk/src/emx/src/lib/sys/sigaction.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/syscalls.h>
    77#include "syscalls.h"
    8 
    98
    109int __sigaction (int signo, const struct sigaction *iact,
  • trunk/src/emx/src/lib/sys/spawnve.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1 /* sys/spawnve.c (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes */
     1/* spawnve.c (emx+gcc) -- Copyright (c) 1990-1996 by Eberhard Mattes */
    22
    33#include <stdlib.h>
     
    55#include <process.h>
    66#include <errno.h>
    7 #define INCL_DOSPROCESS
    8 #include <os2emx.h>
     7#include <alloca.h>
     8#include <emx/startup.h>
    99#include <emx/syscalls.h>
    10 #include "syscalls.h"
    1110
    12 /* Note: We are allowed to call _trealloc() as this module is not used
    13    in an .a library. */
     11int spawnve (int mode, const char *name, char * const argv[],
     12               char * const envp[])
     13{
     14  struct _new_proc np;
     15  int i, size, n;
     16  const char * const *p;
     17  char *d;
     18  char exe[512];
    1419
    15 #define ADD(n) do { \
    16   while (arg_size + n > arg_alloc) \
    17     { \
    18       arg_alloc += 512; \
    19       arg_buf = _trealloc (arg_buf, arg_alloc); \
    20       if (arg_buf == NULL) \
    21         { \
    22           errno = ENOMEM; \
    23           return -1; \
    24         } \
    25       arg_ptr = arg_buf + arg_size; \
    26     } \
    27   arg_size += n; } while (0)
     20  /* Kludge alert: Unfortunately, the `mode' member was made only 16
     21     bits wide originally.  Bit 15 is used to indicate that the
     22     `mode2' member is used, which holds the upper 16 bits of MODE.
     23     This allows using emx 0.8 applications with emx 0.9 as emx
     24     doesn't look at `mode2' unless bit 15 of `mode' is set.  Of
     25     course, this fails if an (old) application program sets bit 15 of
     26     MODE. */
    2827
     28  np.mode = (unsigned short)(mode | 0x8000);
     29  np.mode2 = (unsigned short)((unsigned)mode >> 16);
    2930
    30 int __spawnve (struct _new_proc *np)
    31 {
    32   ULONG rc;
    33   ULONG exec_flag, mode;
    34   RESULTCODES res;
    35   char obj[40], *arg_ptr, *arg_buf;
    36   char *pgm_name, *base;
    37   const char *src, *s;
    38   size_t arg_size, arg_alloc, len;
    39   int i, quote, bs, method;
    40 
    41   arg_buf = NULL; arg_alloc = 0; arg_size = 0; arg_ptr = NULL;
    42 
    43   mode = np->mode;
    44   if (np->mode & 0x8000)
    45     mode |= np->mode2 << 16;
    46 
    47   switch (mode & 0xff)
     31  if (envp == NULL) envp = _environ;
     32  if (strlen (name) >= sizeof (exe) - 4)
    4833    {
    49     case P_WAIT:
    50       exec_flag = EXEC_SYNC;
    51       break;
    52     case P_NOWAIT:
    53       exec_flag = EXEC_ASYNCRESULT;
    54       break;
    55     case P_OVERLAY:
    56       exec_flag = EXEC_ASYNC;
    57       break;
    58     default:
    59       errno = EINVAL;
     34      errno = ENAMETOOLONG;
    6035      return -1;
    6136    }
    62   pgm_name = alloca (strlen ((const char *)np->fname_off) + 5);
    63   strcpy (pgm_name, (const char *)np->fname_off);
    64   _defext (pgm_name, "exe");
    65   base = _getname (pgm_name);
    66   method = 0;
    67   if (stricmp (base, "cmd.exe") == 0 || stricmp (base, "4os2.exe") == 0)
    68     method = 1;
    69   src = (const char *)np->arg_off;
    70   if (np->arg_count > 0)
     37  strcpy (exe, name);
     38  _defext (exe, "exe");
     39  np.fname_off = (unsigned long)exe;
     40  size = 1; n = 0;
     41  for (p = (const char * const *)envp; *p != NULL; ++p)
    7142    {
    72       ++src;                    /* skip flags byte */
    73       len = strlen (src) + 1;
    74       ADD (len);
    75       memcpy (arg_ptr, src, len);
    76       arg_ptr += len; src += len;
     43      ++n; size += 1 + strlen (*p);
    7744    }
    78   for (i = 1; i < np->arg_count; ++i)
     45  d = alloca (size);
     46  np.env_count = n; np.env_size = size;
     47  np.env_off = (unsigned long)d;
     48  for (p = (const char * const *)envp; *p != NULL; ++p)
    7949    {
    80       if (i > 1)
    81         {
    82           ADD (1);
    83           *arg_ptr++ = ' ';
    84         }
    85       ++src;                    /* skip flags byte */
    86       quote = FALSE;
    87       if (*src == 0)
    88         quote = TRUE;
    89       else if (mode & P_QUOTE)
    90         {
    91           if (src[0] == '@' && src[1] != 0)
    92             quote = TRUE;
    93           else
    94             for (s = src; *s != 0; ++s)
    95               if (*s == '?' || *s == '*')
    96                 {
    97                   quote = TRUE;
    98                   break;
    99                 }
    100         }
    101       if (!quote)
    102         for (s = src; *s != 0; ++s)
    103           if (*s == ' ' || *s == '\t' || (*s == '"' && method == 1))
    104             {
    105               quote = TRUE;
    106               break;
    107             }
    108       if (quote)
    109         {
    110           ADD (1);
    111           *arg_ptr++ = '"';
    112         }
    113       bs = 0;
    114       while (*src != 0)
    115         {
    116           if (*src == '"' && method == 0)
    117             {
    118               ++bs;
    119               ADD (bs);
    120               memset (arg_ptr, '\\', bs); arg_ptr += bs;
    121               bs = 0;
    122             }
    123           else if (*src == '\\' && method == 0)
    124             ++bs;
    125           else
    126             bs = 0;
    127           ADD (1);
    128           *arg_ptr++ = *src;
    129           ++src;
    130         }
    131       if (quote)
    132         {
    133           ADD (1+bs);
    134           memset (arg_ptr, '\\', bs); arg_ptr += bs;
    135           *arg_ptr++ = '"';
    136         }
    137       ++src;
     50      i = strlen (*p);
     51      memcpy (d, *p, i+1);
     52      d += i+1;
    13853    }
    139   ADD (1);
    140   *arg_ptr++ = 0;
    141   rc = DosExecPgm (obj, sizeof (obj), exec_flag, arg_buf,
    142                    (const char *)np->env_off, &res, pgm_name);
    143   if (arg_buf != NULL)
    144     _tfree (arg_buf);
    145   if (rc != 0)
     54  *d = 0;
     55  size = 0; n = 0;
     56  for (p = (const char * const *)argv; *p != NULL; ++p)
    14657    {
    147       _sys_set_errno (rc);
    148       return -1;
     58      ++n; size += 2 + strlen (*p);
    14959    }
    150   switch (mode & 0xff)
     60  d = alloca (size);
     61  np.arg_count = n; np.arg_size = size;
     62  np.arg_off = (unsigned long)d;
     63  for (p = (const char * const *)argv; *p != NULL; ++p)
    15164    {
    152     case P_WAIT:
    153       return res.codeResult;
    154     case P_NOWAIT:
    155       return res.codeTerminate;
    156     case P_OVERLAY:
    157       while (1)
    158         DosExit (EXIT_PROCESS, 0);
    159     default:
    160       errno = EINVAL;
    161       return -1;
     65      i = strlen (*p);
     66      *d++ = _ARG_NONZERO;
     67      memcpy (d, *p, i+1);
     68      d += i+1;
    16269    }
     70  i = __spawnve (&np);
     71  return i;
    16372}
  • trunk/src/emx/src/lib/sys/syscalls.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    5252   While this variable is NULL, no memory has been allocated. */
    5353
    54 struct heap_obj *_sys_top_heap_obj;
     54EXTERN struct heap_obj *_sys_top_heap_obj;
    5555
    5656/* This array holds information on all the heap objects.  The heap
    5757   objects are managed in LIFO fashion. */
    5858
    59 struct heap_obj _sys_heap_objs[MAX_HEAP_OBJS];
     59EXTERN struct heap_obj _sys_heap_objs[MAX_HEAP_OBJS];
    6060
    6161/* This is the number of heap objects. */
  • trunk/src/emx/src/lib/time/ftime.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    66#include <emx/syscalls.h>
    77
    8 void _ftime (struct timeb *ptr)
     8void ftime (struct timeb *ptr)
    99{
    1010  time_t t_loc;
    1111
    12   if (!_tzset_flag) _tzset ();
     12  if (!_tzset_flag) tzset ();
    1313  __ftime (ptr);
    1414  t_loc = ptr->time;
  • trunk/src/emx/src/lib/time/gettimeo.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77#include <emx/syscalls.h>
    88
    9 int _gettimeofday (struct timeval *tp, struct timezone *tzp)
     9int gettimeofday (struct timeval *tp, struct timezone *tzp)
    1010{
    1111  struct timeb tb;
  • trunk/src/emx/src/lib/time/localtim.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    2222  struct tm *p;
    2323
    24   if (!_tzset_flag) _tzset ();
     24  if (!_tzset_flag) tzset ();
    2525  lt = *t;
    2626  isdst = _gmt2loc (&lt);
  • trunk/src/emx/src/lib/time/mktime.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    1111  int dst;
    1212
    13   if (!_tzset_flag) _tzset ();
     13  if (!_tzset_flag) tzset ();
    1414
    15   /* _mktime() requires that tm_mon is in range.  The other members
     15  /* mktime() requires that tm_mon is in range.  The other members
    1616     are not restricted. */
    1717
  • trunk/src/emx/src/lib/time/settimeo.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77#include <emx/syscalls.h>
    88
    9 int _settimeofday (const struct timeval *tp, const struct timezone *tzp)
     9int settimeofday (const struct timeval *tp, const struct timezone *tzp)
    1010{
    1111  struct timeval local;
     
    1717      return -1;
    1818    }
    19   if (!_tzset_flag) _tzset ();
     19  if (!_tzset_flag) tzset ();
    2020  t = tp->tv_sec;
    2121  local.tv_sec = _gmt2loc (&t);
  • trunk/src/emx/src/lib/time/strptime.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    265265
    266266
    267 char *_strptime (const char *buf, const char *format, struct tm *tm)
     267char *strptime (const char *buf, const char *format, struct tm *tm)
    268268{
    269269  return (char *)parse_fmt ((const unsigned char *)buf,
  • trunk/src/emx/src/lib/time/time.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    88  struct timeb tb;
    99
    10   _ftime (&tb);
     10  ftime (&tb);
    1111  if (t != NULL) *t = tb.time;
    1212  return tb.time;
  • trunk/src/emx/src/lib/time/times.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    77/* Note: return value overflows */
    88
    9 long _times (struct tms *buffer)
     9long times (struct tms *buffer)
    1010{
    1111  struct timeval tv;
     
    1515  buffer->tms_cutime = 0;
    1616  buffer->tms_cstime = 0;
    17   if (_gettimeofday (&tv, NULL) != 0)
     17  if (gettimeofday (&tv, NULL) != 0)
    1818    return -1;
    1919  return CLK_TCK * tv.tv_sec + (CLK_TCK * tv.tv_usec) / 1000000;
  • trunk/src/emx/src/lib/time/tzset.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    105105
    106106
    107 void _tzset (void)
     107void tzset (void)
    108108{
    109109  struct _tzinfo ntz;
  • trunk/src/emx/src/libend/end.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    22.MDESC  := The C runtime library that should be linked last
    33
    4 .TKIND  := omf st
     4.TKIND  := omf
    55.TARGET := end$A
    66.TSRC.386 := $(wildcard src/lib/end/386/*.asm)
    77.TSRC   := $(.TSRC.$(CPU))
    88.INSDIR = lib/
    9 .TKEEP  := 1
    109include mklib.smak
    11 
    12 .TKIND  := omf mt
    13 include mklib.smak
  • trunk/src/emx/src/libmoddef/moddef.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    22.MDESC  := A library for working with .DEF files
    33
    4 .TKIND  := aout st
     4.TKIND  := aout
    55.TARGET := moddef$A
    66.TSRC   := $(wildcard src/lib/moddef/*.c)
  • trunk/src/emx/src/libomflib/omflib.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    22.MDESC  := A library for reading/writing OMF object files
    33
    4 .TKIND  := aout st
     4.TKIND  := aout
    55.TARGET := omflib$A
    66.TSRC   := $(wildcard src/lib/omflib/*.c)
  • trunk/src/emx/src/regexp/regexp.smak

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r122 r123  
    33.INSDIR := lib/
    44
    5 .TARGET := regexp.a
     5.TARGET := regexp$A
    66.TSRC   := $(wildcard src/regexp/*.c)
    77include mklib.smak
Note: See TracChangeset for help on using the changeset viewer.