forked from AnaTofuZ/Perl-1.0
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathperl.diff
More file actions
1105 lines (977 loc) · 27.8 KB
/
Copy pathperl.diff
File metadata and controls
1105 lines (977 loc) · 27.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
commit c22d7b27db077eac80d305ddf16f844fa4ad1019
Author: Christophe Staïesse <chastai@skynet.be>
Date: Sun Dec 29 16:45:14 2013 +0100
Regeneration of Configure with metaconfig
I've used the latest version of dist with metaconfig 3.5-172:
http://sourceforge.net/projects/dist/
Run metaconfig with the -M option.
Changes:
- Renamed obsolete symbols. Metaconfig still wrongly see obsolete symbols.
- Two quotes was not closed in makedepend.SH
- makedepend.SH doesn't take into account lines containing <command-line>,
<built-int>,... generated by cpp.
- Removed the header lines of MANIFEST to not confuse the new Configure
diff --git a/Configure b/Configure
index 64215f7..fe74757 100755
--- a/Configure
+++ b/Configure
[snipped]
diff --git a/MANIFEST b/MANIFEST
index 085b831..571af4e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,7 +1,3 @@
-After all the perl kits are run you should have the following files:
-
-Filename Kit Description
--------- --- -----------
Configure 6 Run this first
EXTERN.h 10 Included before foreign .h files
INTERN.h 10 Included before domestic .h files
@@ -110,3 +106,5 @@ x2p/str.h 10 Public declarations for the above
x2p/util.c 9 Utility routines
x2p/util.h 10 Public declarations for the above
x2p/walk.c 1 Parse tree walker
+config_h.SH Produces config.h
+confmagic.h Magic symbol remapping
diff --git a/arg.c b/arg.c
index 66e73ac..b7c4eb2 100644
--- a/arg.c
+++ b/arg.c
@@ -498,7 +498,7 @@ register STAB *stab;
filegid = statbuf.st_gid;
if (*inplace) {
str_cat(str,inplace);
-#ifdef RENAME
+#ifdef HAS_RENAME
rename(oldname,str->str_ptr);
#else
UNLINK(str->str_ptr);
@@ -571,7 +571,7 @@ STAB *stab;
while (stio->fp) {
-#ifdef STDSTDIO /* (the code works without this) */
+#ifdef USE_STDIO_PTR /* (the code works without this) */
if (stio->fp->_cnt) /* cheat a little, since */
return FALSE; /* this is the most usual case */
#endif
@@ -664,7 +664,7 @@ STR ***retary;
apush(ary,str_nmake((double)statbuf.st_atime));
apush(ary,str_nmake((double)statbuf.st_mtime));
apush(ary,str_nmake((double)statbuf.st_ctime));
-#ifdef STATBLOCKS
+#ifdef HAS_STAT_BLOCKS
apush(ary,str_nmake((double)statbuf.st_blksize));
apush(ary,str_nmake((double)statbuf.st_blocks));
#else
@@ -1036,7 +1036,7 @@ STR **sarg;
if (val < 0) {
val = -val;
for (elem = tmpary+2; *elem; elem++)
-#ifdef KILLPG
+#ifdef HAS_KILLPG
if (killpg((int)(str_gnum(*elem)),val)) /* BSD */
#else
if (kill(-(int)(str_gnum(*elem)),val)) /* SYSV */
@@ -1910,7 +1910,7 @@ STR ***retary; /* where to return an array to, null if nowhere */
str = apop(arg[1].arg_ptr.arg_stab->stab_array);
if (!str)
return &str_no;
-#ifdef STRUCTCOPY
+#ifdef USE_STRUCT_COPY
*(arg->arg_ptr.arg_str) = *str;
#else
bcopy((char*)str, (char*)arg->arg_ptr.arg_str, sizeof *str);
@@ -1922,7 +1922,7 @@ STR ***retary; /* where to return an array to, null if nowhere */
str = ashift(arg[1].arg_ptr.arg_stab->stab_array);
if (!str)
return &str_no;
-#ifdef STRUCTCOPY
+#ifdef USE_STRUCT_COPY
*(arg->arg_ptr.arg_str) = *str;
#else
bcopy((char*)str, (char*)arg->arg_ptr.arg_str, sizeof *str);
@@ -2107,7 +2107,7 @@ STR ***retary; /* where to return an array to, null if nowhere */
retary = Null(STR***); /* do_stat already did retary */
goto donumset;
case O_CRYPT:
-#ifdef CRYPT
+#ifdef HAS_CRYPT
tmps = str_get(sarg[1]);
str_set(str,crypt(tmps,str_get(sarg[2])));
#else
@@ -2257,7 +2257,7 @@ STR ***retary; /* where to return an array to, null if nowhere */
goto donumset;
case O_RENAME:
tmps = str_get(sarg[1]);
-#ifdef RENAME
+#ifdef HAS_RENAME
value = (double)(rename(tmps,str_get(sarg[2])) >= 0);
#else
tmps2 = str_get(sarg[2]);
@@ -2326,11 +2326,11 @@ STR ***retary; /* where to return an array to, null if nowhere */
if (statbuf.st_gid == (maxarg ? getegid() : getgid()))
str = &str_yes; /* ok as "group" */
else {
-#ifdef GETGROUPS
+#ifdef HAS_GETGROUPS
#ifndef NGROUPS
#define NGROUPS 32
#endif
- GIDTYPE gary[NGROUPS];
+ Gid_t gary[NGROUPS];
str = &str_no;
anum = getgroups(NGROUPS,gary);
@@ -2386,7 +2386,7 @@ STR ***retary; /* where to return an array to, null if nowhere */
str = &str_no;
break;
case O_FTLINK:
-#ifdef SYMLINK
+#ifdef HAS_SYMLINK
if (lstat(str_get(sarg[1]),&statbuf) >= 0 &&
(statbuf.st_mode & S_IFMT) == S_IFLNK )
str = &str_yes;
@@ -2394,7 +2394,7 @@ STR ***retary; /* where to return an array to, null if nowhere */
#endif
str = &str_no;
break;
-#ifdef SYMLINK
+#ifdef HAS_SYMLINK
case O_SYMLINK:
tmps = str_get(sarg[1]);
value = (double)(symlink(tmps,str_get(sarg[2])) >= 0);
diff --git a/makedepend.SH b/makedepend.SH
index 8c7951c..c09171c 100644
--- a/makedepend.SH
+++ b/makedepend.SH
@@ -97,6 +97,11 @@ for file in `$cat .clist`; do
-e '}'
$cpp -I/usr/local/include -I. $file.c | \
$sed \
+ -e '/^#.*<stdin>/d' \
+ -e '/^#.*<builtin>/d' \
+ -e '/^#.*<built-in>/d' \
+ -e '/^#.*<command line>/d' \
+ -e '/^#.*<command-line>/d' \
-e '/^# *[0-9]/!d' \
-e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
-e 's|: \./|: |' \
@@ -110,7 +115,7 @@ make shlist || ($echo "Searching for .SH files..."; \
$echo *.SH */*.SH | $tr ' ' '\012' | $egrep -v '\*' >.shlist)
if $test -s .deptmp; then
for file in `cat .shlist`; do
- $echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
+ $echo `$expr X$file : 'X\(.*\).SH'`: $file config.sh \; \
/bin/sh $file >> .deptmp
done
$echo "Updating Makefile..."
@@ -141,7 +146,7 @@ else
<.deptmp $sed -n 's|h:#include <\(.*\)>.*$|h: /usr/include/\1|p' \
>> Makefile.new
for file in `$cat .shlist`; do
- $echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
+ $echo `$expr X$file : 'X\(.*\).SH'`: $file config.sh \; \
/bin/sh $file >> Makefile.new
done
fi
diff --git a/perl.h b/perl.h
index 10d377c..b1e4f07 100644
--- a/perl.h
+++ b/perl.h
@@ -36,7 +36,7 @@
#define VOIDUSED 1
#include "config.h"
-#ifndef BCOPY
+#ifndef HAS_BCOPY
# define bcopy(s1,s2,l) memcpy(s2,s1,l);
# define bzero(s,l) memset(s,0,l);
#endif
@@ -47,7 +47,7 @@
#include <sys/param.h>
#include <sys/stat.h>
-#ifdef TMINSYS
+#ifdef TM_IN_SYS
#include <sys/time.h>
#else
#include <time.h>
@@ -202,10 +202,10 @@ EXT struct stat statbuf;
EXT struct tms timesbuf;
EXT int uid;
EXT int euid;
-UIDTYPE getuid();
-UIDTYPE geteuid();
-GIDTYPE getgid();
-GIDTYPE getegid();
+Uid_t getuid();
+Uid_t geteuid();
+Gid_t getgid();
+Gid_t getegid();
EXT int unsafe;
#ifdef DEBUGGING
@@ -238,7 +238,7 @@ double atof();
long time();
struct tm *gmtime(), *localtime();
-#ifdef EUNICE
+#ifdef EUNICE_SYSTEM
#define UNLINK unlnk
int unlnk();
#else
diff --git a/perly.c b/perly.c
index 9ec6705..54a756d 100644
--- a/perly.c
+++ b/perly.c
@@ -808,7 +808,7 @@ yylex()
OPERATOR(PRINT);
}
if (strEQ(d,"symlink"))
-#ifdef SYMLINK
+#ifdef HAS_SYMLINK
FUN2(O_SYMLINK);
#else
fatal("symlink() not supported on this machine");
@@ -2203,7 +2203,7 @@ register ARG *arg;
str_numset(str,(double)(strNE(tmps,str_get(s2))));
break;
case O_CRYPT:
-#ifdef CRYPT
+#ifdef HAS_CRYPT
tmps = str_get(s1);
str_set(str,crypt(tmps,str_get(s2)));
#else
diff --git a/stab.c b/stab.c
index 4790e3c..d37458d 100644
--- a/stab.c
+++ b/stab.c
@@ -179,12 +179,12 @@ STAB *stab;
sprintf(s,"%d",(int)getegid());
add_groups:
while (*s) s++;
-#ifdef GETGROUPS
+#ifdef HAS_GETGROUPS
#ifndef NGROUPS
#define NGROUPS 32
#endif
{
- GIDTYPE gary[NGROUPS];
+ Gid_t gary[NGROUPS];
i = getgroups(NGROUPS,gary);
while (i >= 0) {
diff --git a/str.c b/str.c
index f1902b6..dc7c27d 100644
--- a/str.c
+++ b/str.c
@@ -342,7 +342,7 @@ str_gets(str,fp)
register STR *str;
register FILE *fp;
{
-#ifdef STDSTDIO /* Here is some breathtakingly efficient cheating */
+#ifdef USE_STDIO_PTR /* Here is some breathtakingly efficient cheating */
register char *bp; /* we're going to steal some values */
register int cnt; /* from the stdio struct and put EVERYTHING */
@@ -406,7 +406,7 @@ thats_really_all_folks:
*bp = '\0';
str->str_cur = bp - str->str_ptr; /* set length */
-#else /* !STDSTDIO */ /* The big, slow, and stupid way */
+#else /* !USE_STDIO_PTR */ /* The big, slow, and stupid way */
static char buf[4192];
@@ -415,7 +415,7 @@ thats_really_all_folks:
else
str_set(str, No);
-#endif /* STDSTDIO */
+#endif /* USE_STDIO_PTR */
return str->str_cur ? str->str_ptr : Nullch;
}
diff --git a/util.c b/util.c
index 4577a2a..06f131d 100644
--- a/util.c
+++ b/util.c
@@ -310,7 +310,7 @@ char *nam;
return i;
}
-#ifdef EUNICE
+#ifdef EUNICE_SYSTEM
unlnk(f) /* unlink all versions of a file */
char *f;
{
diff --git a/x2p/str.c b/x2p/str.c
index 6d53f4f..b7e2bd2 100644
--- a/x2p/str.c
+++ b/x2p/str.c
@@ -280,7 +280,7 @@ str_gets(str,fp)
register STR *str;
register FILE *fp;
{
-#ifdef STDSTDIO /* Here is some breathtakingly efficient cheating */
+#ifdef USE_STDIO_PTR /* Here is some breathtakingly efficient cheating */
register char *bp; /* we're going to steal some values */
register int cnt; /* from the stdio struct and put EVERYTHING */
@@ -327,7 +327,7 @@ thats_all_folks:
*bp = '\0';
str->str_cur = bp - str->str_ptr; /* set length */
-#else /* !STDSTDIO */ /* The big, slow, and stupid way */
+#else /* !USE_STDIO_PTR */ /* The big, slow, and stupid way */
static char buf[4192];
@@ -336,7 +336,7 @@ thats_all_folks:
else
str_set(str, No);
-#endif /* STDSTDIO */
+#endif /* USE_STDIO_PTR */
return str->str_cur ? str->str_ptr : Nullch;
}
commit d36e347825ef111c80a5d359daaba811c4a17c30
Author: Christophe Staïesse <chastai@skynet.be>
Date: Sun Dec 29 17:12:50 2013 +0100
Remove redeclarations of standard functions/variables
and include errno.h
diff --git a/arg.c b/arg.c
index b7c4eb2..6cb602c 100644
--- a/arg.c
+++ b/arg.c
@@ -84,7 +84,6 @@
#include <signal.h>
ARG *debarg;
-long time();
bool
do_match(s,arg)
@@ -476,8 +475,6 @@ register char *name;
return TRUE;
}
-extern int errno;
-
FILE *
nextargv(stab)
register STAB *stab;
@@ -1386,8 +1383,6 @@ STR ***retary; /* where to return an array to, null if nowhere */
STAB *stab;
ARRAY *ary;
bool assigning = FALSE;
- double exp(), log(), sqrt(), modf();
- char *crypt(), *getenv();
if (!arg)
return &str_no;
diff --git a/perl.h b/perl.h
index b1e4f07..64baaf3 100644
--- a/perl.h
+++ b/perl.h
@@ -43,6 +43,7 @@
#include <stdio.h>
#include <ctype.h>
+#include <errno.h>
#include <setjmp.h>
#include <sys/param.h>
#include <sys/stat.h>
@@ -78,12 +79,6 @@ typedef struct compex COMPEX;
#include "array.h"
#include "hash.h"
-#ifdef CHARSPRINTF
- char *sprintf();
-#else
- int sprintf();
-#endif
-
/* A string is TRUE if not "" or "0". */
#define True(val) (tmps = (val), (*tmps && !(*tmps == '0' && !tmps[1])))
EXT char *Yes INIT("1");
@@ -202,10 +197,6 @@ EXT struct stat statbuf;
EXT struct tms timesbuf;
EXT int uid;
EXT int euid;
-Uid_t getuid();
-Uid_t geteuid();
-Gid_t getgid();
-Gid_t getegid();
EXT int unsafe;
#ifdef DEBUGGING
@@ -234,10 +225,6 @@ EXT jmp_buf eval_env;
EXT char *goto_targ INIT(Nullch); /* cmd_exec gets strange when set */
-double atof();
-long time();
-struct tm *gmtime(), *localtime();
-
#ifdef EUNICE_SYSTEM
#define UNLINK unlnk
int unlnk();
diff --git a/perly.c b/perly.c
index 54a756d..23e77e2 100644
--- a/perly.c
+++ b/perly.c
@@ -74,7 +74,6 @@ register char **env;
{
register STR *str;
register char *s;
- char *index(), *strcpy();
uid = (int)getuid();
euid = (int)geteuid();
@@ -2028,8 +2027,6 @@ register ARG *arg;
register char *tmps;
int i;
long tmplong;
- double exp(), log(), sqrt(), modf();
- char *crypt();
if (!arg || !arg->arg_len)
return;
diff --git a/stab.c b/stab.c
index d37458d..d739eba 100644
--- a/stab.c
+++ b/stab.c
@@ -78,10 +78,6 @@ static char *sig_name[] = {
,0
};
-extern int errno;
-extern int sys_nerr;
-extern char *sys_errlist[];
-
STR *
stab_str(stab)
STAB *stab;
diff --git a/str.c b/str.c
index dc7c27d..ed25ea2 100644
--- a/str.c
+++ b/str.c
@@ -75,8 +75,6 @@ double num;
str->str_nok = 1; /* validate number */
}
-extern int errno;
-
char *
str_2ptr(str)
register STR *str;
diff --git a/util.c b/util.c
index 06f131d..651fb6a 100644
--- a/util.c
+++ b/util.c
@@ -43,7 +43,6 @@ safemalloc(size)
MEM_SIZE size;
{
char *ptr;
- char *malloc();
ptr = malloc(size?size:1); /* malloc(0) is NASTY on our system */
#ifdef DEBUGGING
@@ -67,7 +66,6 @@ char *where;
MEM_SIZE size;
{
char *ptr;
- char *realloc();
if (!where)
fatal("Null realloc");
@@ -220,8 +218,6 @@ int newlen;
}
}
-extern int errno;
-
/*VARARGS1*/
fatal(pat,a1,a2,a3,a4)
char *pat;
commit be5bd2a49cfb0479c264539cae073006498acede
Author: Christophe Staïesse <chastai@skynet.be>
Date: Sun Dec 29 17:16:10 2013 +0100
Include some missing standard headers
diff --git a/perl.h b/perl.h
index 64baaf3..3061843 100644
--- a/perl.h
+++ b/perl.h
@@ -44,10 +44,17 @@
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
+#include <math.h>
#include <setjmp.h>
+#include <stdlib.h>
+#include <string.h>
#include <sys/param.h>
#include <sys/stat.h>
+#ifdef HAS_BCOPY
+#include <strings.h>
+#endif
+
#ifdef TM_IN_SYS
#include <sys/time.h>
#else
@@ -56,6 +63,10 @@
#include <sys/times.h>
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+
typedef struct arg ARG;
typedef struct cmd CMD;
typedef struct formcmd FCMD;
commit b8cd70615a262c20aa1da5b64286f4d8e48af242
Author: Christophe Staïesse <chastai@skynet.be>
Date: Sun Dec 29 17:18:14 2013 +0100
Rename setenv in xsetenv
diff --git a/stab.c b/stab.c
index d739eba..faa2cd0 100644
--- a/stab.c
+++ b/stab.c
@@ -293,7 +293,7 @@ STR *str;
}
}
else if (stab == envstab && envname) {
- setenv(envname,str_get(str));
+ xsetenv(envname,str_get(str));
/* And you'll never guess what the dog had */
safefree(envname); /* in its mouth... */
envname = Nullch;
diff --git a/util.c b/util.c
index 651fb6a..2bd8d7a 100644
--- a/util.c
+++ b/util.c
@@ -259,7 +259,7 @@ static bool firstsetenv = TRUE;
extern char **environ;
void
-setenv(nam,val)
+xsetenv(nam,val)
char *nam, *val;
{
register int i=envix(nam); /* where does it go? */
diff --git a/util.h b/util.h
index 4f92eeb..3a7e003 100644
--- a/util.h
+++ b/util.h
@@ -28,7 +28,7 @@ void prexit();
char *get_a_line();
char *savestr();
int makedir();
-void setenv();
+void xsetenv();
int envix();
void notincl();
char *getval();
commit 675c82ddd9690f03b0e7f86b6f7ccb83ecad41d4
Author: Christophe Staïesse <chastai@skynet.be>
Date: Sun Dec 29 18:13:43 2013 +0100
Set real uid and gid in a more portable way
Call setreuid or setregid if setruid or setrgid (resp.) are not available
and die if no suitable function are available.
From the source code of Perl 5
diff --git a/stab.c b/stab.c
index faa2cd0..346c917 100644
--- a/stab.c
+++ b/stab.c
@@ -261,18 +261,41 @@ STR *str;
errno = (int)str_gnum(str); /* will anyone ever use this? */
break;
case '<':
+ {
+ int r;
uid = (int)str_gnum(str);
- if (setruid(uid) < 0)
+#ifdef HAS_SETRUID
+ r = setruid(uid);
+#else
+#ifdef HAS_SETREUID
+ r = setreuid(uid, (Uid_t)-1);
+#else
+ fatal("setruid() not implemented");
+#endif
+#endif
+ if (r < 0)
uid = (int)getuid();
break;
+ }
case '>':
euid = (int)str_gnum(str);
if (seteuid(euid) < 0)
euid = (int)geteuid();
break;
case '(':
- setrgid((int)str_gnum(str));
+ {
+ int a = (int)str_gnum(str);
+#ifdef HAS_SETRGID
+ setrgid(uid);
+#else
+#ifdef HAS_SETREGID
+ setregid(uid, (Uid_t)-1);
+#else
+ fatal("setrgid() not implemented");
+#endif
+#endif
break;
+ }
case ')':
setegid((int)str_gnum(str));
break;
commit 0c719a8f72c3967fedc0d1b3a344d0a5686a051c
Author: Christophe Staïesse <chastai@skynet.be>
Date: Sun Dec 29 21:23:29 2013 +0100
Fix problem with strcpy args overlapping in scanconst
Pointers passed to strcpy cannot be part of the same string.
Replaced by memmove which allows memory overlapping.
This was causing case 11 of t/op.pat to fail in some architectures.
diff --git a/perly.c b/perly.c
index 23e77e2..82701d6 100644
--- a/perly.c
+++ b/perly.c
@@ -986,7 +986,7 @@ char *string;
*d = '\0';
break;
}
- strcpy(d,d+1);
+ memmove(d,d+1,strlen(d+1)+1);
switch(*d) {
case 'n':
*d = '\n';
commit ef4afd7f7cc44696aebcd04b114cd6e207e4c025
Author: Christophe Staïesse <chastai@skynet.be>
Date: Mon Dec 30 09:33:14 2013 +0100
The declaration of fatal was incomplete in util.c
The four last arguments was declared implicitly as int instead of
char*.
This caused a crash wheneved fatal was called on some architectures.
diff --git a/util.c b/util.c
index 2bd8d7a..1494d1f 100644
--- a/util.c
+++ b/util.c
@@ -220,7 +220,7 @@ int newlen;
/*VARARGS1*/
fatal(pat,a1,a2,a3,a4)
-char *pat;
+char *pat,*a1,*a2,*a3,*a4;
{
extern FILE *e_fp;
extern char *e_tmpname;
commit 387b17436fa8d4cb471ad120790766d3860ad161
Author: Christophe Staïesse <chastai@skynet.be>
Date: Mon Dec 30 09:34:44 2013 +0100
Use rm -rf and not rm -f in io.fs to delete the tmp directory
diff --git a/t/io.fs b/t/io.fs
index 50e272e..b7495f6 100644
--- a/t/io.fs
+++ b/t/io.fs
@@ -7,7 +7,7 @@ print "1..20\n";
$wd = `pwd`;
chop($wd);
-`rm -f tmp; mkdir tmp 2>/dev/null`;
+`rm -rf tmp; mkdir tmp 2>/dev/null`;
chdir './tmp';
`/bin/rm -rf a b c x`;
commit 596555b9b737bb853e2438ad7a53a356bd44ca56
Author: Christophe Staïesse <chastai@skynet.be>
Date: Mon Dec 30 11:37:50 2013 +0100
Define wanted libraries for metaconfig
Namely nm, m and crypt. This is done in U/Myinit.U
Configure will add libraries on this list that are installed on the system
to $libs used by Makefile.SH
Also, remove the reference to deprecated $libnm in Makefile.SH
Note: There is still a reference to $libnm in x2p/Makefile.SH
diff --git a/Makefile.SH b/Makefile.SH
index a6bc00c..1d9d8bd 100644
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -69,7 +69,7 @@ mallocsrc = $mallocsrc
mallocobj = $mallocobj
SLN = $sln
-libs = $libnm -lm
+libs = $libs
!GROK!THIS!
cat >>Makefile <<'!NO!SUBS!'
diff --git a/U/Myinit.U b/U/Myinit.U
new file mode 100644
index 0000000..0d18ad9
--- /dev/null
+++ b/U/Myinit.U
@@ -0,0 +1,27 @@
+?RCS: $Id: Myinit.U 1 2006-08-24 12:32:52Z rmanfredi $
+?RCS:
+?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?RCS: $Log: Myinit.U,v $
+?RCS: Revision 3.0.1.1 1994/10/31 09:47:29 ram
+?RCS: patch44: leading comment states this unit comes before option processing
+?RCS:
+?RCS: Revision 3.0 1993/08/18 12:05:07 ram
+?RCS: Baseline for dist 3.0 netwide release.
+?RCS:
+?X:
+?X: If you want to initialize any default values, copy this unit to your
+?X: personal U directory and add the assignments to the end. This file
+?X: is included after variables are initialized but before any old
+?X: config.sh file is read in and before any Configure switch processing.
+?X:
+?MAKE:Myinit: Init
+?MAKE: -pick add $@ %<
+?LINT: nocomment
+libswanted='nm m crypt'
commit 2fce1746da9cee013723b01dd5226861082bd592
Author: Christophe Staïesse <chastai@skynet.be>
Date: Mon Dec 30 13:09:33 2013 +0100
Use LOC_SED to specify the path of sed to perl
This was causing t/comp.cpp to fail.
diff --git a/perly.c b/perly.c
index 82701d6..7b0411a 100644
--- a/perly.c
+++ b/perly.c
@@ -168,8 +168,8 @@ register char **env;
if (strEQ(filename,"-"))
argv[0] = "";
if (preprocess) {
- sprintf(buf, "\
-/bin/sed -e '/^[^#]/b' \
+ sprintf(buf, \
+LOC_SED " -e '/^[^#]/b' \
-e '/^#[ ]*include[ ]/b' \
-e '/^#[ ]*define[ ]/b' \
-e '/^#[ ]*if[ ]/b' \
commit 5fb619870bd0f8d254459b57c6030bb47d2f1d1f
Author: Christophe Staïesse <chastai@skynet.be>
Date: Mon Dec 30 14:26:48 2013 +0100
Double the number of tries for case 2 in t/op.time
It was not enough on some systems.
diff --git a/t/op.time b/t/op.time
old mode 100644
new mode 100755
index 87ef260..7b4b529
--- a/t/op.time
+++ b/t/op.time
@@ -12,7 +12,7 @@ while (($now = time) == $beg) {}
if ($now > $beg && $now - $beg < 10){print "ok 1\n";} else {print "not ok 1\n";}
-for ($i = 0; $i < 100000; $i++) {
+for ($i = 0; $i < 199998; $i++) {
($nowuser, $nowsys) = times;
$i = 200000 if $nowuser > $beguser && $nowsys > $begsys;
last if time - $beg > 20;
commit c63024577814284b2419708e841114183efcf625
Author: Christophe Staïesse <chastai@skynet.be>
Date: Mon Dec 30 17:06:28 2013 +0100
Remove empty %type declaration in perl.y
Byacc was forgiving about that but not Bison.
diff --git a/perl.y b/perl.y
index fc6bf89..282c995 100644
--- a/perl.y
+++ b/perl.y
@@ -77,7 +77,6 @@ char *tokename[] = {
%token <arg> RSTRING TRANS
%type <ival> prog decl format
-%type <stabval>
%type <cmdval> block lineseq line loop cond sideff nexpr else
%type <arg> expr sexpr term
%type <arg> condmod loopmod cexpr
commit 241cbb688ab3ad1e1076baad2c8719bd0e5761ea
Author: Christophe Staïesse <chastai@skynet.be>
Date: Tue Dec 31 15:21:44 2013 +0100
YYDEBUG was tested with #ifdef instead of #if
YYDEBUG may exists and be defined to 0 to disable Yacc debugging.
diff --git a/perly.c b/perly.c
index 7b0411a..c2d2ea4 100644
--- a/perly.c
+++ b/perly.c
@@ -87,7 +87,7 @@ register char **env;
#ifdef DEBUGGING
case 'D':
debug = atoi(argv[0]+2);
-#ifdef YYDEBUG
+#if YYDEBUG
yydebug = (debug & 1);
#endif
break;
@@ -316,7 +316,7 @@ yylex()
static bool firstline = TRUE;
retry:
-#ifdef YYDEBUG
+#if YYDEBUG
if (yydebug)
if (index(s,'\n'))
fprintf(stderr,"Tokener at %s",s);
commit 13475190a06e733cbcfd2695d28337f6c90029de
Author: Christophe Staïesse <chastai@skynet.be>
Date: Mon Dec 30 17:45:45 2013 +0100
Add some missing declarations in perl.h
of functions defined in perly.c and used in perl.y
diff --git a/perl.h b/perl.h
index 3061843..1f277b2 100644
--- a/perl.h
+++ b/perl.h
@@ -107,6 +107,8 @@ EXT STR *Str;
#define GROWSTR(pp,lp,len) if (*(lp) < (len)) growstr(pp,lp,len)
+EXT unsigned int cmdline;
+
CMD *add_label();
CMD *block_head();
CMD *append_line();
@@ -121,6 +123,14 @@ SPAT *stab2spat();
STAB *stabent();
+ARG *l();
+ARG *mod_match();
+ARG *addflags();
+ARG *hide_ary();
+ARG *make_list();
+ARG *listish();
+ARG *cval_to_arg();
+ARG *cmd_to_arg();
ARG *stab2arg();
ARG *op_new();
ARG *make_op();
commit 95dc5be0e2bbe7701b633da1e247f4c67ae38ef2
Author: Christophe Staïesse <chastai@skynet.be>
Date: Mon Dec 30 17:52:42 2013 +0100
Extends the support of crypt()
crypt() may be declared in unistd.h but on some systems it is in
crypt.h.
- included a new metaconfig unit: i_crypt that checks if crypt.h is
available (taken from another version of metaconfig).
- modified d_crypt unit so it includes crypt.h when available.
diff --git a/U/d_crypt.U b/U/d_crypt.U
new file mode 100644
index 0000000..2a24b35
--- /dev/null
+++ b/U/d_crypt.U
@@ -0,0 +1,86 @@
+?RCS: $Id: d_crypt.U 167 2013-05-08 17:58:00Z rmanfredi $
+?RCS:
+?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic License,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic License; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?RCS: $Log: d_crypt.U,v $
+?RCS: Revision 3.0.1.1 1997/02/28 15:31:47 ram
+?RCS: patch61: replaced .a with $_a all over the place
+?RCS:
+?RCS: Revision 3.0 1993/08/18 12:05:52 ram
+?RCS: Baseline for dist 3.0 netwide release.
+?RCS:
+?MAKE:d_crypt cryptlib: Loc test xlibpth libpth Setvar _a Trylink cat i_unistd i_crypt
+?MAKE: -pick add $@ %<
+?S:d_crypt:
+?S: This variable conditionally defines the CRYPT symbol, which
+?S: indicates to the C program that the crypt() routine is available
+?S: to encrypt passwords and the like.
+?S:.
+?S:cryptlib:
+?S: This variable holds -lcrypt or the path to a libcrypt.a archive if
+?S: the crypt() function is not defined in the standard C library. It is
+?S: up to the Makefile to use this.
+?S:.
+?C:HAS_CRYPT (CRYPT):
+?C: This symbol, if defined, indicates that the crypt routine is available
+?C: to encrypt passwords and the like.
+?C:.
+?H:#$d_crypt HAS_CRYPT /**/
+?H:.
+?LINT:set d_crypt
+?T:val
+: see if crypt exists
+$cat >try.c <<EOC
+#$i_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+#$i_crypt I_CRYPT
+#ifdef I_CRYPT
+#include <crypt.h>
+#endif
+int main(void)
+{
+ static char ret;
+ ret |= *crypt("key", "salt");
+ return ret ? 0 : 1;
+}
+EOC
+cyn=crypt