at 23.11-beta 322 lines 9.8 kB view raw
1--- _install/install_ucb.c 2+++ _install/install_ucb.c 3@@ -267,7 +267,7 @@ cp(const char *src, const char *tgt, struct stat *dsp) 4 if (check(src, tgt, dsp, &sst) != OKAY) 5 return; 6 unlink(tgt); 7- if ((dfd = creat(tgt, 0700)) < 0 || fchmod(dfd, 0700) < 0 || 8+ if ((dfd = creat(tgt, 0700)) < 0 || chmod(tgt, 0700) < 0 || 9 fstat(dfd, &nst) < 0) { 10 fprintf(stderr, "%s: %s: %s\n", progname, src, 11 strerror(errno)); 12--- libcommon/Makefile.mk 13+++ libcommon/Makefile.mk 14@@ -15,7 +15,7 @@ CHECK: CHECK.c 15 headers: CHECK 16 one() { \ 17 rm -f "$$1.h"; \ 18- if grep "$$1_h[ ]*=[ ]*[^0][ ]*;" CHECK >/dev/null; \ 19+ if true; \ 20 then \ 21 ln -s "_$$1.h" "$$1.h"; \ 22 fi; \ 23--- libcommon/atoll.h 24+++ libcommon/atoll.h 25@@ -1,8 +1,10 @@ 26 /* Sccsid @(#)atoll.h 1.4 (gritter) 7/18/04 */ 27 28 #if defined (__hpux) || defined (_AIX) || \ 29- defined (__FreeBSD__) && (__FreeBSD__) < 5 30+ (defined (__FreeBSD__) && (__FreeBSD__) < 5) || defined (__TINYC__) 31+#ifndef __TINYC__ 32 extern long long strtoll(const char *nptr, char **endptr, int base); 33 extern unsigned long long strtoull(const char *nptr, char **endptr, int base); 34+#endif 35 extern long long atoll(const char *nptr); 36 #endif /* __hpux || _AIX || __FreeBSD__ < 5 */ 37--- libcommon/blank.h 38+++ libcommon/blank.h 39@@ -5,7 +5,7 @@ 40 */ 41 /* Sccsid @(#)blank.h 1.3 (gritter) 5/1/04 */ 42 43-#ifndef __dietlibc__ 44+#if !defined(__dietlibc__) && !defined(__TINYC__) 45 #ifndef LIBCOMMON_BLANK_H 46 #define LIBCOMMON_BLANK_H 1 47 48--- libcommon/getdir.c 49+++ libcommon/getdir.c 50@@ -52,7 +52,7 @@ extern int getdents(int, struct dirent *, size_t); 51 #undef d_ino 52 #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ 53 || __APPLE__ */ 54-#elif defined (__dietlibc__) 55+#elif defined (__dietlibc__) || defined(__TINYC__) 56 #include <dirent.h> 57 #include <unistd.h> 58 #else /* !__GLIBC__, !__dietlibc__ */ 59--- libcommon/memalign.c 60+++ libcommon/memalign.c 61@@ -23,7 +23,7 @@ 62 63 #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (_AIX) || \ 64 defined (__NetBSD__) || defined (__OpenBSD__) || \ 65- defined (__DragonFly__) || defined (__APPLE__) 66+ defined (__DragonFly__) || defined (__APPLE__) || defined(__TINYC__) 67 /* 68 * FreeBSD malloc(3) promises to page-align the return of malloc() calls 69 * if size is at least a page. This serves for a poor man's memalign() 70--- libcommon/memalign.h 71+++ libcommon/memalign.h 72@@ -26,7 +26,7 @@ 73 74 #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (_AIX) || \ 75 defined (__NetBSD__) || defined (__OpenBSD__) || \ 76- defined (__DragonFly__) || defined (__APPLE__) 77+ defined (__DragonFly__) || defined (__APPLE__) || defined(__TINYC__) 78 #include <stdlib.h> 79 80 extern void *memalign(size_t, size_t); 81--- libcommon/pathconf.c 82+++ libcommon/pathconf.c 83@@ -21,7 +21,7 @@ 84 */ 85 /* Sccsid @(#)pathconf.c 1.2 (gritter) 5/1/04 */ 86 87-#ifdef __dietlibc__ 88+#if defined(__dietlibc__) || defined(__TINYC__) 89 #include <unistd.h> 90 #include "pathconf.h" 91 92--- libcommon/pathconf.h 93+++ libcommon/pathconf.h 94@@ -21,7 +21,7 @@ 95 */ 96 /* Sccsid @(#)pathconf.h 1.2 (gritter) 5/1/04 */ 97 98-#ifdef __dietlibc__ 99+#if defined(__dietlibc__) || defined(__TINYC__) 100 #include <unistd.h> 101 102 extern long fpathconf(int, int); 103--- libcommon/regexp.h 104+++ libcommon/regexp.h 105@@ -47,7 +47,7 @@ 106 static const char regexp_h_sccsid[] REGEXP_H_USED = 107 "@(#)regexp.sl 1.56 (gritter) 5/29/05"; 108 109-#if !defined (REGEXP_H_USED_FROM_VI) && !defined (__dietlibc__) 110+#if !defined (REGEXP_H_USED_FROM_VI) && !defined (__dietlibc__) && !defined (__TINYC__) 111 #define REGEXP_H_WCHARS 112 #endif 113 114--- libcommon/sfile.c 115+++ libcommon/sfile.c 116@@ -21,7 +21,7 @@ 117 */ 118 /* Sccsid @(#)sfile.c 1.9 (gritter) 6/7/04 */ 119 120-#ifdef __linux__ 121+#if defined(__linux__) && !defined(__TINYC__) 122 #undef _FILE_OFFSET_BITS 123 124 #include <sys/types.h> 125--- libcommon/sighold.c 126+++ libcommon/sighold.c 127@@ -22,7 +22,7 @@ 128 /* Sccsid @(#)sighold.c 1.7 (gritter) 1/22/06 */ 129 130 #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ 131- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) 132+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) 133 #include <signal.h> 134 #include "sigset.h" 135 136--- libcommon/sigignore.c 137+++ libcommon/sigignore.c 138@@ -22,7 +22,7 @@ 139 /* Sccsid @(#)sigignore.c 1.6 (gritter) 1/22/06 */ 140 141 #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ 142- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) 143+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) 144 #include <signal.h> 145 #include "sigset.h" 146 147--- libcommon/sigpause.c 148+++ libcommon/sigpause.c 149@@ -22,7 +22,7 @@ 150 /* Sccsid @(#)sigpause.c 1.6 (gritter) 1/22/06 */ 151 152 #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ 153- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) 154+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) 155 #include <signal.h> 156 #include "sigset.h" 157 158--- libcommon/sigrelse.c 159+++ libcommon/sigrelse.c 160@@ -22,7 +22,7 @@ 161 /* Sccsid @(#)sigrelse.c 1.8 (gritter) 1/22/06 */ 162 163 #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ 164- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) 165+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) 166 #include <signal.h> 167 #include "sigset.h" 168 169--- libcommon/sigset.c 170+++ libcommon/sigset.c 171@@ -22,7 +22,7 @@ 172 /* Sccsid @(#)sigset.c 1.7 (gritter) 1/22/06 */ 173 174 #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ 175- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) 176+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) 177 #include <signal.h> 178 #include "sigset.h" 179 180@@ -46,10 +46,7 @@ void (*sigset(int sig, void (*func)(int)))(int) 181 if (sigaction(sig, func==SIG_HOLD?(struct sigaction *)0:&nact, &oact) 182 == -1) 183 return SIG_ERR; 184- if (sigismember(&oset, sig)) 185- return SIG_HOLD; 186- else 187- return (oact.sa_handler); 188+ return (oact.sa_handler); 189 } 190 #endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ || 191 __DragonFly__ || __APPLE__ */ 192--- libcommon/sigset.h 193+++ libcommon/sigset.h 194@@ -22,7 +22,7 @@ 195 /* Sccsid @(#)sigset.h 1.9 (gritter) 1/22/06 */ 196 197 #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ 198- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) 199+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) 200 201 #ifndef SIG_HOLD 202 #define SIG_HOLD ((void (*)(int))2) 203--- libcommon/strtol.c 204+++ libcommon/strtol.c 205@@ -1,7 +1,7 @@ 206 /* Sccsid @(#)strtol.c 1.6 (gritter) 7/18/04 */ 207 208 #if defined (__hpux) || defined (_AIX) || \ 209- defined (__FreeBSD__) && (__FreeBSD__) < 5 210+ (defined (__FreeBSD__) && (__FreeBSD__) < 5) || defined (__TINYC__) 211 212 #include <stdlib.h> 213 #include <ctype.h> 214@@ -97,6 +97,7 @@ out: if (pp <= bptr) { 215 return v * sign; 216 } 217 218+#ifndef __TINYC__ 219 long long 220 strtoll(const char *nptr, char **endptr, int base) 221 { 222@@ -108,6 +109,7 @@ strtoull(const char *nptr, char **endptr, int base) 223 { 224 return (unsigned long long)internal(nptr, endptr, base, 3); 225 } 226+#endif 227 228 long long 229 atoll(const char *nptr) 230--- nawk/awk.h 231+++ nawk/awk.h 232@@ -156,7 +156,6 @@ extern Cell *rlengthloc; /* RLENGTH */ 233 #endif 234 235 #ifndef IN_MAKETAB 236-#include <wchar.h> 237 238 /* 239 * Get next character from string s and store it in wc; n is set to 240--- nawk/awk.lx.l 241+++ nawk/awk.lx.l 242@@ -71,7 +71,6 @@ 243 244 #include "awk.h" 245 #include "y.tab.h" 246-#include <pfmt.h> 247 #include <unistd.h> 248 249 static void awk_unputstr(const char *s); 250--- nawk/run.c 251+++ nawk/run.c 252@@ -1467,14 +1467,6 @@ Cell *bltin(Node **a, int n) 253 case FRAND: 254 u = (Awkfloat) (rand() % 32767) / 32767.0; 255 break; 256- case FSRAND: 257- u = saved_srand; /* return previous seed */ 258- if (x->tval & REC) /* no argument provided */ 259- saved_srand = time(NULL); 260- else 261- saved_srand = getfval(x); 262- srand((int) saved_srand); 263- break; 264 case FTOUPPER: 265 case FTOLOWER: 266 p = getsval(x); 267--- pgrep/pgrep.c 268+++ pgrep/pgrep.c 269@@ -214,7 +214,7 @@ chdir_to_proc(void) 270 fprintf(stderr, "%s: cannot open %s\n", progname, PROCDIR); 271 exit(3); 272 } 273- if (fchdir(fd) < 0) { 274+ if (chdir(PROCDIR) < 0) { 275 fprintf(stderr, "%s: cannot chdir to %s\n", progname, PROCDIR); 276 exit(3); 277 } 278--- rm/rm.c 279+++ rm/rm.c 280@@ -242,7 +242,7 @@ rm(size_t pend, const char *base, const int olddir, int ssub, int level) 281 } 282 return; 283 } 284- if (fchdir(df) < 0) { 285+ if (chdir(base) < 0) { 286 if (rmfile(base, &st) < 0) { 287 fprintf(stderr, 288 "%s: cannot chdir to %s\n", 289@@ -270,7 +270,7 @@ rm(size_t pend, const char *base, const int olddir, int ssub, int level) 290 progname, path); 291 errcnt |= 4; 292 } 293- if (olddir >= 0 && fchdir(olddir) < 0) { 294+ if (olddir >= 0) { 295 fprintf(stderr, "%s: cannot change backwards\n", 296 progname); 297 exit(1); 298@@ -316,24 +316,6 @@ subproc(size_t pend, const char *base, int level) 299 int status; 300 301 while (waitpid(pid, &status, 0) != pid); 302- if (status && WIFSIGNALED(status)) { 303- /* 304- * If the signal was sent due to a tty keypress, 305- * we should be terminated automatically and 306- * never reach this point. Otherwise, we terminate 307- * with the same signal, but make sure that we do 308- * not overwrite a possibly generated core file. 309- * This results in nearly the usual behavior except 310- * that the shell never prints a 'core dumped' 311- * message. 312- */ 313- struct rlimit rl; 314- 315- rl.rlim_cur = rl.rlim_max = 0; 316- setrlimit(RLIMIT_CORE, &rl); 317- raise(WTERMSIG(status)); 318- pause(); 319- } 320 return status ? WEXITSTATUS(status) : 0; 321 } 322 case -1: