@@ -556,22 +556,6 @@ dbg (const char *fmt, ...)
556
556
557
557
/* Provide support for temporary files. */
558
558
559
- #ifndef HAVE_STDLIB_H
560
- # ifdef HAVE_MKSTEMP
561
- int mkstemp (char * template );
562
- # else
563
- char * mktemp (char * template );
564
- # endif
565
- #endif
566
-
567
- #ifndef HAVE_UMASK
568
- mode_t
569
- umask (mode_t mask )
570
- {
571
- return 0 ;
572
- }
573
- #endif
574
-
575
559
#ifdef VMS
576
560
# define DEFAULT_TMPFILE "sys$scratch:gnv$make_cmdXXXXXX.com"
577
561
#else
@@ -784,260 +768,3 @@ get_tmpfile (char **name)
784
768
785
769
return file ;
786
770
}
787
-
788
-
789
- #if HAVE_TTYNAME && defined(__EMX__ )
790
- /* OS/2 kLIBC has a declaration for ttyname(), so configure finds it.
791
- But, it is not implemented! Roll our own. */
792
- char * ttyname (int fd )
793
- {
794
- ULONG type ;
795
- ULONG attr ;
796
- ULONG rc ;
797
-
798
- rc = DosQueryHType (fd , & type , & attr );
799
- if (rc )
800
- {
801
- errno = EBADF ;
802
- return NULL ;
803
- }
804
-
805
- if (type == HANDTYPE_DEVICE )
806
- {
807
- if (attr & 3 ) /* 1 = KBD$, 2 = SCREEN$ */
808
- return (char * ) "/dev/con" ;
809
-
810
- if (attr & 4 ) /* 4 = NUL */
811
- return (char * ) "/dev/nul" ;
812
-
813
- if (attr & 8 ) /* 8 = CLOCK$ */
814
- return (char * ) "/dev/clock$" ;
815
- }
816
-
817
- errno = ENOTTY ;
818
- return NULL ;
819
- }
820
- #endif
821
-
822
-
823
- #if !HAVE_STRCASECMP && !HAVE_STRICMP && !HAVE_STRCMPI
824
- /* If we don't have strcasecmp() (from POSIX), or anything that can substitute
825
- for it, define our own version. */
826
-
827
- int
828
- strcasecmp (const char * s1 , const char * s2 )
829
- {
830
- while (1 )
831
- {
832
- int c1 = (unsigned char ) * (s1 ++ );
833
- int c2 = (unsigned char ) * (s2 ++ );
834
-
835
- if (isalpha (c1 ))
836
- c1 = tolower (c1 );
837
- if (isalpha (c2 ))
838
- c2 = tolower (c2 );
839
-
840
- if (c1 != '\0' && c1 == c2 )
841
- continue ;
842
-
843
- return (c1 - c2 );
844
- }
845
- }
846
- #endif
847
-
848
- #if !HAVE_STRNCASECMP && !HAVE_STRNICMP && !HAVE_STRNCMPI
849
- /* If we don't have strncasecmp() (from POSIX), or anything that can
850
- substitute for it, define our own version. */
851
-
852
- int
853
- strncasecmp (const char * s1 , const char * s2 , size_t n )
854
- {
855
- while (n -- > 0 )
856
- {
857
- int c1 = (unsigned char ) * (s1 ++ );
858
- int c2 = (unsigned char ) * (s2 ++ );
859
-
860
- if (isalpha (c1 ))
861
- c1 = tolower (c1 );
862
- if (isalpha (c2 ))
863
- c2 = tolower (c2 );
864
-
865
- if (c1 != '\0' && c1 == c2 )
866
- continue ;
867
-
868
- return (c1 - c2 );
869
- }
870
-
871
- return 0 ;
872
- }
873
- #endif
874
-
875
-
876
- #ifdef NEED_GET_PATH_MAX
877
- unsigned int
878
- get_path_max (void )
879
- {
880
- static unsigned int value ;
881
-
882
- if (value == 0 )
883
- {
884
- long x = pathconf ("/" , _PC_PATH_MAX );
885
- if (x > 0 )
886
- value = (unsigned int ) x ;
887
- else
888
- value = PATH_MAX ;
889
- }
890
-
891
- return value ;
892
- }
893
- #endif
894
-
895
- #if !HAVE_MEMPCPY
896
- void *
897
- mempcpy (void * dest , const void * src , size_t n )
898
- {
899
- return (char * ) memcpy (dest , src , n ) + n ;
900
- }
901
- #endif
902
-
903
- #if !HAVE_STPCPY
904
- char *
905
- stpcpy (char * dest , const char * src )
906
- {
907
- char * d = dest ;
908
- const char * s = src ;
909
-
910
- do
911
- * d ++ = * s ;
912
- while (* s ++ != '\0' );
913
-
914
- return d - 1 ;
915
- }
916
- #endif
917
-
918
- #if !HAVE_STRTOLL
919
- # undef UNSIGNED
920
- # undef USE_NUMBER_GROUPING
921
- # undef USE_WIDE_CHAR
922
- # define QUAD 1
923
- # include <strtol.c>
924
- #endif
925
-
926
- #if !HAVE_STRERROR
927
- char *
928
- strerror (int errnum )
929
- {
930
- static char msg [256 ];
931
-
932
- #define SETMSG (_e , _m ) case _e: strcpy(msg, _m); break
933
-
934
- switch (errnum )
935
- {
936
- #ifdef EPERM
937
- SETMSG (EPERM , "Operation not permitted" );
938
- #endif
939
- #ifdef ENOENT
940
- SETMSG (ENOENT , "No such file or directory" );
941
- #endif
942
- #ifdef ESRCH
943
- SETMSG (ESRCH , "No such process" );
944
- #endif
945
- #ifdef EINTR
946
- SETMSG (EINTR , "Interrupted system call" );
947
- #endif
948
- #ifdef EIO
949
- SETMSG (EIO , "I/O error" );
950
- #endif
951
- #ifdef ENXIO
952
- SETMSG (ENXIO , "No such device or address" );
953
- #endif
954
- #ifdef E2BIG
955
- SETMSG (E2BIG , "Argument list too long" );
956
- #endif
957
- #ifdef ENOEXEC
958
- SETMSG (ENOEXEC , "Exec format error" );
959
- #endif
960
- #ifdef EBADF
961
- SETMSG (EBADF , "Bad file number" );
962
- #endif
963
- #ifdef ECHILD
964
- SETMSG (ECHILD , "No child processes" );
965
- #endif
966
- #ifdef EAGAIN
967
- SETMSG (EAGAIN , "Try again" );
968
- #endif
969
- #ifdef ENOMEM
970
- SETMSG (ENOMEM , "Out of memory" );
971
- #endif
972
- #ifdef EACCES
973
- SETMSG (EACCES , "Permission denied" );
974
- #endif
975
- #ifdef EFAULT
976
- SETMSG (EFAULT , "Bad address" );
977
- #endif
978
- #ifdef ENOTBLK
979
- SETMSG (ENOTBLK , "Block device required" );
980
- #endif
981
- #ifdef EBUSY
982
- SETMSG (EBUSY , "Device or resource busy" );
983
- #endif
984
- #ifdef EEXIST
985
- SETMSG (EEXIST , "File exists" );
986
- #endif
987
- #ifdef EXDEV
988
- SETMSG (EXDEV , "Cross-device link" );
989
- #endif
990
- #ifdef ENODEV
991
- SETMSG (ENODEV , "No such device" );
992
- #endif
993
- #ifdef ENOTDIR
994
- SETMSG (ENOTDIR , "Not a directory" );
995
- #endif
996
- #ifdef EISDIR
997
- SETMSG (EISDIR , "Is a directory" );
998
- #endif
999
- #ifdef EINVAL
1000
- SETMSG (EINVAL , "Invalid argument" );
1001
- #endif
1002
- #ifdef ENFILE
1003
- SETMSG (ENFILE , "File table overflow" );
1004
- #endif
1005
- #ifdef EMFILE
1006
- SETMSG (EMFILE , "Too many open files" );
1007
- #endif
1008
- #ifdef ENOTTY
1009
- SETMSG (ENOTTY , "Not a typewriter" );
1010
- #endif
1011
- #ifdef ETXTBSY
1012
- SETMSG (ETXTBSY , "Text file busy" );
1013
- #endif
1014
- #ifdef EFBIG
1015
- SETMSG (EFBIG , "File too large" );
1016
- #endif
1017
- #ifdef ENOSPC
1018
- SETMSG (ENOSPC , "No space left on device" );
1019
- #endif
1020
- #ifdef ESPIPE
1021
- SETMSG (ESPIPE , "Illegal seek" );
1022
- #endif
1023
- #ifdef EROFS
1024
- SETMSG (EROFS , "Read-only file system" );
1025
- #endif
1026
- #ifdef EMLINK
1027
- SETMSG (EMLINK , "Too many links" );
1028
- #endif
1029
- #ifdef EPIPE
1030
- SETMSG (EPIPE , "Broken pipe" );
1031
- #endif
1032
- #ifdef EDOM
1033
- SETMSG (EDOM , "Math argument out of domain of func" );
1034
- #endif
1035
- #ifdef ERANGE
1036
- SETMSG (ERANGE , "Math result not representable" );
1037
- #endif
1038
- default : sprintf (msg , "Unknown error %d" , errnum ); break ;
1039
- }
1040
-
1041
- return msg ;
1042
- }
1043
- #endif
0 commit comments