-
Notifications
You must be signed in to change notification settings - Fork 3
/
ChangeLog
2431 lines (1806 loc) · 85.1 KB
/
ChangeLog
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
2024-04-07 Andrew L. Moore <slewsys@gmail.com>
* Fix memory leaks flagged by valgrind.
2024-04-06 Andrew L. Moore <slewsys@gmail.com>
* Add target check-valgrind.
2024 Andrew L. Moore <slewsys@gmail.com>
* Remove remainder of generated files.
2024-04-06 Andrew L. Moore <slewsys@gmail.com>
* Comply with REUSE Specification – Version 3.0.
2024-04-05 Andrew L. Moore <slewsys@gmail.com>
* Remove references to quick-check.
2024-04-03 Andrew L. Moore <slewsys@gmail.com>
* Apply script to each file on command line. For this to work, the
script must be seekable. And to avoid infinite loops, if the
script modifies the input file list, it is only applied to the
first file on the command line.
* Fix typo to prevent double-free on Linux.
2024-02-08 Andrew L. Moore <slewsys@gmail.com>
* In substitution templates, support case modifier sequences:
\L - Substitute in lowercase until \E.
\l - Substitute next char in lowercase.
\U - Substitute in uppercase until \E.
\u - Substitute next char in uppercase.
As currently implemented, these only work for 8-bit locales.
The sequences \L and \U can be nested. For instance, given input:
`abcde', the command:
s/\(.\)\(.\)/\U\L\1\E \2/g
produces: `a Bc De', i.e., \L overrides \U until \E, then \U becomes
active again until the end of the current substitution.
* In substitution templates, a back-reference that does not match any
subexpressions is now replaced with the empty string instead of the
offending digit, as per The Open Group's 2018 publication (cf.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed.html).
2024-02-08 Andrew L. Moore <slewsys@gmail.com>
* Use SPDX license expressions.
2024-02-05 Andrew L. Moore <slewsys@gmail.com>
* Restore missing REG_NOTBOL.
Reported by Victor <vico/tuta+io>.
2023-09-22 Andrew L. Moore <slewsys@gmail.com>
* Report error if fflush fails.
2023-09-20 Andrew L. Moore <slewsys@gmail.com>
* Add CPP flag _FORTIFY_SOURCE=3.
2023-09-10 Andrew L. Moore <slewsys@gmail.com>
* Version command output missing --enable-address-argments.
2023-09-08 Andrew L. Moore <slewsys@gmail.com>
* Fix update-po Makefile target to support external regex.
* Add configure option for command-line address arguments.
2023-07-20 Andrew L. Moore <slewsys@gmail.com>
* Move declarations out of switch statement for compatibility.
2023-05-17 Andrew L. Moore <slewsys@gmail.com>
* Support command-line address arguments.
Valid address arguments are:
+N - Go to and print line N.
+/RE - Search forward to and print the first line matching RE.
+?RE - Search backward to and print the first line matching RE.
Address arguments can be repeated, e.g.,
ed +3 +/RE1 +?RE2 FILE
searches FILE forward from line 3 for RE1 and, from there,
backward for RE2.
2023-04-24 Andrew L. Moore <slewsys@gmail.com>
* Remove generated files.
2023-04-24 Andrew L. Moore <slewsys@gmail.com>
* Handle edge case where backslash is used as pattern delimiter.
POSIX does not disallow backslash (\) as a pattern delimiter ed, but
it does specify that a backslash-escaped delimiter may occur in the
pattern. Therefore, just as:
ed <<'EOF'
a
hel\o
.
s;\\
EOF
is a valid script producing output 'helo', the following should
produce the same:
ed <<'EOF'
a
hel\o
.
s\\\
EOF
Prior to this commit the substitution `s\\\` was being interpreted as
`s///`, not `s/\\//p` as it should.
2023-03-13 Andrew L. Moore <slewsys@gmail.com>
* Support static builds.
* Properly handle configure's --disable-feature options.
Don't nest Autoconf macro AS_IF.
Warn if an extension is enabled by another.
Support enabling all feature extensions and then selectively disabling
some, e.g.,
./configure --enable-all-extensions --disable-ed-encryption
2023-01-16 Andrew L. Moore <slewsys@gmail.com>
* Re-import Gnulib.
2022-12-31 Andrew L. Moore <slewsys@gmail.com>
* Fix BWK texi docs for latest makeinfo.
2022-04-07 Andrew L. Moore <slewsys@gmail.com>
* Support GNU regex operators in extended regular expressions.
When `ed` is linked against a GNU regex library and invoked with
either option `-E` or `-r`, then the following additional GNU regular
expression operators are recognized:
\s - matches a whitespace character
\S - matches a non-whitespace character
\w - matches a word character
\W - matches a non-word character
\< - matches the beginning of a word
\> - matches the end of a word
\b - matches a word boundary (beginning or end)
\B - matches a non-word boundary
"Words" in the above are any sequence of UTF-8 characters, digits
and/or underscores (_).
$ ed -re 's/\W+//gp' <(echo 'hϵllo, ☪ こんにちは')
hϵlloこんにちは
$
2022-01-25 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (r_cmd):
* src/io.c (read_file, is_fifo): Open FIFOs in read-only mode by
default. This allows ed to read the output of process
substitutions, e.g.,
$ echo p | ed - <(echo hello)
hello
$
Reading from a pipe via /dev/fd/0, i.e.,
$ echo hello | ed -e 'p' /dev/fd/0
doesn't work as expected yet.
* src/main.c (main, ed_usage): Add option -w for writing to
process substitutions, e.g.,
$ ed -w - >(gzip -c - >temp.gz) <<'EOF'
r !curl wttr.in?format=\%t
wq
EOF
$ gzip -cd temp.gz
+57°F
$
2022-01-24 Andrew L. Moore <slewsys@gmail.com>
* COPYING, testsuite/bang3.d: Resolve Debian Lintian errors by
removing full text of GPL.
2022-01-15 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (f_cmd, e_cmd, E_cmd, r_cmd, w_cmd, W_cmd):
Align extended command diagnostics more closely to POSIX intent.
If the default file is changed by an extended command, the name
of the new default is printed only if help/verbose mode is enabled
- i.e., in ed, command `H', or, on the command line, option `-v'.
This affects the extended commands, ~f, ~e, ~r and ~w as
summarized below.
The extended file command, ~f, now works as follows:
~f file-glob - sets the file list and default file name to
the first in the list, then prints the default
file name.
~f - prints the current file list without changing
the default file name.
~fn - changes the default file name to the "next" in
the current file list and prints the new
default file name.
~fp - changes the default file name to the
"previous" in the current file list and prints
the new default file name.
The extended edit commands, ~e and ~E now work as follows:
~e file-glob - sets the file list and edits the first in list.
~e - edits the first file in the current file list,
effectively "rewinding" it.
~en - edits the "next" file in the current file list.
~ep - edits the "previous" file in the current file
list.
The extended read command, ~r, now works as follows:
~r file-glob - if file-glob expands to a unique file, reads
that file without changing either the current
file list or the default file name.
~r - reads the default file, which may or may not be
the first in the current file list.
The extended write commands, ~w and ~W, now work as follows:
~w file-glob - if file-glob expands to a unique file, writes
the buffer contents to that file without
changing either the current file list or the
default file name.
~w - write the default file, which may or may not
be the first in the current file list.
~wn - writes the buffer contents to the default file,
then edits the "next" file current file list.
~wn - writes the buffer contents to the default file,
then edits the "previous" file current file
list.
See also ChangeLog entry 2006-12-29 for an earlier, though more
complete, description of these commands.
* src/main.c (main):
* src/buf.c (append_text_node):
* src/exec.c (r_cmd, w_cmd, z_cmd)
* src/io.c (get_stream_line): Remove unused variables.
* src/io.c (read_file):
* src/page.c (put_frame_buffer_line): Properly Initialize variables.
2022-01-12 Andrew L. Moore <slewsys@gmail.com>
* debian (*): Add Debian package support.
2022-01-10 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (comment_cmd): In POSIX mode, comments should report
and error. Reported by grylem.
2021-12-27 gettextize <bug-gnu-gettext@gnu.org>
* m4/gettext.m4: Upgrade to gettext-0.21.
* m4/host-cpu-c-abi.m4: New file, from gettext-0.21.
* m4/iconv.m4: Upgrade to gettext-0.21.
* m4/intlmacosx.m4: Upgrade to gettext-0.21.
* m4/lib-ld.m4: Upgrade to gettext-0.21.
* m4/lib-link.m4: Upgrade to gettext-0.21.
* m4/lib-prefix.m4: Upgrade to gettext-0.21.
* m4/nls.m4: Upgrade to gettext-0.21.
* m4/po.m4: Upgrade to gettext-0.21.
* m4/progtest.m4: Upgrade to gettext-0.21.
* Makefile.am (SUBDIRS): Add ./po.
* configure.ac (AC_CONFIG_FILES): Add ./po/Makefile.in.
2021-06-23 Andrew L. Moore <slewsys@gmail.com>
* src/buf.c (dup_argv): Duplicate file arguments of argv.
2018-09-09 Andrew L. Moore <slewsys@gmail.com>
* src/cbc.c (expand_des_key): Require 64-digit binary key,
16-digit hexadecimal key or (up to) 8-byte ASCII key.
(cbc_encode): Don't encrypt empty file.
* src/io.c (write_stream): Call fflush(3) on encoded files too.
(put_stream_line): Use size_t, not int for stream size.
2018-09-03 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (FILE_NAME): Condition printing expanded shell
command on POSIXLY_CORRECT.
* src/parse.c (expand_shell_command): If ed->exec->global, use
ed->input up to first newline.
2018-08-31 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (r_cmd, w_cmd): If file glob empty, use current file
name.
* src/exec.c (z_cmd, Z_cmd, scroll_backward_half)
(scroll_forward_half): An address followed by a scroll command
should be equivalent to an addressed scroll command - e.g., the
sequence of commands:
50
Z
should be equivalent to:
50Z
2018-08-30 Andrew L. Moore <slewsys@gmail.com>
* src/parse.c (address_range): Enable pseudo-modulus addressing:
Address 0 - 1 == last address, and last address + 1 == address 0.
This allows constructs such as:
$ ed <<EOF
a
hello
.
-ka
+kb
'a+,'b-p
Q
EOF
2018-08-24 Andrew L. Moore <slewsys@gmail.com>
* src/utf8.c (utf8_char_display_width): Initial support for paging
UTF-8-encoded text.
2018-08-21 Andrew L. Moore <slewsys@gmail.com>
* src/page.c (inc_mod_fb_row): Adjust text offset calculation for
backward scrolling through lines longer than display width,
including lines spanning multiple pages. Add scrolling tests to
testsuite.
2018-08-20 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (Z_cmd): Remove redundant checks.
2018-08-19 Andrew L. Moore <slewsys@gmail.com>
* src/io.c (get_extended_line): Escape trailing backslashes in
the context of a global command.
2018-08-19 Andrew L. Moore <slewsys@gmail.com>
* src/page.c (display_lines): Prevent scrolling beyond limits of
editor buffer.
(inc_mod_fb_row): Correct offset calculation.
2018-08-17 Andrew L. Moore <slewsys@gmail.com>
* src/page.c (put_frame_buffer_line): Conditionally split lines
while listing on flags POSIXLY_CORRECT and TRADITIONAL.
(fb_putc): Don't return signed chars if testing for < 0.
2018-08-15 Andrew L. Moore <slewsys@gmail.com>
* src/main.c (getenv_init_argv): Correct typo.
2018-08-15 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (scroll_backward_half, scroll_forward_half): Map
half-page scroll in bottom half of first page to offset full-page
scroll.
2018-08-14 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (z_cmd): Disable hack for half-page scrolling from
bottom half of first page.
* src/page.c (put_frame_buffer_line): Print newline at end of line!
(scroll_lines): First step in handling backward scrolling for
lines that span multiple pages.
2018-08-13 Andrew L. Moore <slewsys@gmail.com>
* src/ed.h (struct ed_frame_buffer):
* src/page.c (init_frame_buffer): Define frame buffer row as array
of pointers rather just a pointer.
2018-08-11 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (Z_cmd, z_cmd): Adjust address only if scrolling half
a page.
* src/main.c (append_script_expression): Preserve empty expressions.
2018-08-10 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (z_cmd): Fix off-by-one error in half-page scrolling.
2018-08-10 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (Z_cmd): Compensate for loss of addressed line if
scrolling half page.
2018-08-07 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (w_cmd):
(r_cmd): Only read from and write to file glob if expansion unique.
* src/parse.c (file_glob): Add parameter `uniquely' if expansion
should be unique.
2018-08-06 Andrew L. Moore <slewsys@gmail.com>
* src/cbc.c (get_des_keyword): Given empty password, disable
encryption/decryption.
* src/io.c: Condition encrypted input on fp != stdin.
2018-08-05 Andrew L. Moore <slewsys@gmail.com>
* src/io.c (read_stream): Don't use stubs for optional encrypted I/O.
* src/main.c (main): Work around strange regression: #ifdef within
setjmp disables ed signal handlers.
2018-08-04 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (global_cmd): Setting io_f too early masked errors.
2018-08-03 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (global_cmd): Reset flag `io_f' before return in case
of non-interactive global commands (i.e., `g' and `v'). Set to
PRNT in case of interactive commands (`G' and `V') to indicate
command completion. Move flag `io_f' to struct `ed_display'.
2018-08-02 Andrew L. Moore <slewsys@gmail.com>
* src/cmds.c (append_lines): Gobble newline away from global command.
* src/exec.c (newline_cmd): Newline in global command can
print if given an address per SUSv4.
2018-08-01 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (h_cmd): Condition printing "No previous error" on
POSIXLY_CORRECT and TRADITIONAL flags.
* src/sub.c (resubstitute): Condition extended short-form
substitution characters on POSIXLY_CORRECT and TRADITIONAL flags.
2018-07-31 Andrew L. Moore <slewsys@gmail.com>
* src/glbl.c: Empty command list equivalent to `p' command per SUSv4.
* src/exec.c (newline_cmd): Newline in global command does not
print per SUSv4.
* src/cmds.c (transfer_marks): Preserve line node marks across
substitutions per SUSv4.
2018-07-30 Andrew L. Moore <slewsys@gmail.com>
* src/page.c (display_lines): Handle printing of line that exceeds
page size like scrolling. Avoid spurious newlines.
(scroll_lines): Split of print and scroll functions.
* src/exec.c (FILE_NAME): Print shell command expansion even when
scripting per SUSv4.
2018-07-29 Andrew L. Moore <slewsys@gmail.com>
* src/main.c (main): Check for option `-' with strcmp(3).
(main): Print prompt even when scripting per SUSv4.
2018-07-29 Andrew L. Moore <slewsys@gmail.com>
* src/main.c (main):
* src/io.c (read_stream, read_stream_r): Don't append newline to
empty file per SUSv4
2018-07-27 Andrew L. Moore <slewsys@gmail.com>
* src/io.c (read_stream, read_stream_r): Print "Newline appended"
to stderr per SUSv4.
* configure.ac: Support shells other than /bin/sh.
2018-07-25 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (x_cmd): Add `x' command to enter encryption keyword.
DES encryption not working yet.
2018-07-24 Andrew L. Moore <slewsys@gmail.com>
* Makefile.am: Add rule `update-gnulib'.
* configure.ac:
* m4/ax_check_openssl.m4:
* src/Makefile.am (AM_CPPFLAGS):
* src/ed.h (struct ed_execute):
* src/cbc.c: Add preliminary DES encryption support for backward
compatibility. Condition DES encryption on configure feature
request `--enable-des-encryption' and OpenSSL library
availability.
2018-07-23 Andrew L. Moore <slewsys@gmail.com>
(DESTINATION_ADDRESS):
(exec_command): Allow command-line flag `--traditional' or
environment variable `POSIXLY_CORRECT' to override ed register and
file glob extensions.
Clean up parsing of command prefixes `<' and `~'.
* src/buf.c (init_stdio): Unconditionally exit on errors if
standard input is seekable and not a tty.
* src/io.c (write_file):
* src/cmds.c (mark_line_node): Silence compiler warnings.
2018-07-22 Andrew L. Moore <slewsys@gmail.com>
* src/ed.h:
* src/aux.c:
* src/buf.c:
* src/exec.c:
* src/main.c:
* configure.ac: Condition ed register and command-line scripting
flags `-f' and `-e' on configure feature requests
`--enable-ed-register' and `--enable-script-flags', respectively.
* testsuite/proto.ok-at.in:
* testsuite/proto.fail-at.in: Don't require option `-f' in tests.
2018-07-19 Andrew L. Moore <slewsys@gmail.com>
* src/ed.h:
* src/aux.c:
* src/exec.c:
* src/main.c:
* configure.ac: Condition ed macros on configure feature request
`--enable-ed-macro'.
2018-07-18 Andrew L. Moore <slewsys@gmail.com>
* src/main.c (main, ed_usage, save_edit): Remove command-line
option `--info'. Move functionality to option `--version'. Initial
implementation of option --in-place=SUFFIX to write file before
closing, with optional backup.
2018-07-17 Andrew L. Moore <slewsys@gmail.com>
* src/aux.c (push_stack_frame, pop_stack_frame, unwind_stack_frame):
* src/ed.h (struct ed_stack_frame):
* src/buf.c (init_stdio): Reopen internal script only in case of
option `-f' and when not in a macro. This fixes a regression
where shell escapes don't have access to stdin.
* src/main.c (append_script_file):
* src/aux.c (push_stack_frame): Clean up.
2018-07-15 Andrew L. Moore <slewsys@gmail.com>
* src/aux.c (unwind_stack_frame): Decrement stack frame index
before using it.
* src/exec.c (exec_macro): Remove unused code.
* src/ed.h (struct ed_stack_frame):
* src/aux.c (push_stack_frame): Remove unused rtrn address.
(pop_stack_frame): Enter ftruncate block conditionally on FSEEK.
Fixes macros for remaining cases.
2018-07-14 Andrew L. Moore <slewsys@gmail.com>
* ed.h:
* src/buf.c (init_stdio):
* src/aux.c (push_stack_frame):
(pop_stack_frame): When pushing stack frames, preserve original
standard input This fixes case where a script containing a macro
is provided via option `-f' and where a script is read from a
pipe.
TODO: Redirecting script from file still seqfaults.
2018-07-13 Andrew L. Moore <slewsys@gmail.com>
* src/aux.c (push_stack_frame): Add FSCRIPT flag.
(push_stack_frame): Distinguish between redirected file and script
file via option `-f'.
2018-07-10 Andrew L. Moore <slewsys@gmail.com>
* src/main.c (main, append_script_expression):
* src/exec.c (exec_macro):
* src/buf.c (init_stdio):
* src/aux.c (script_from_register):
(push_stack_frame):
(pop_stack_frame):
(unwind_stack_frame): Initial attempt to implement nested macros.
Once stdin is associated with script, use stdin for FTELL, etc.
instead of ed->exec->fp. The following script creates two macros
in registers 1 and 2, with macro 1 calling macro 2. The
second-to-last command, `<1@', invokes macro 1 with output:
hello
world
Here is the (tab-indented) script:
$ ed -s <<-EOF
a
a
world
y
p
a
hello
y
p
<2@
.
g/^y/s;;.;
1;/^p/m>2
,m>1
<1@
wq o.tmp
EOF
2018-07-07 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (exec_macro): Initial attempt to implement register
macros à la ex(1). Syntax: (<k)@ where k is a register containing
an ed(1) script to execute. If no register given, default register
is used.
* src/aux.c (script_from_register): Write register lines to script
buffer, used by register macros.
* src/buf.c (init_stdio): Support stack frames in script buffer,
used by register macros.
2018-06-24 Andrew L. Moore <slewsys@gmail.com>
* src/page.c (put_frame_buffer_line): Rename CHAR_WIDTH macro to
avoid conflict with gnulib.
2018-06-22 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (lbracket_cmd): Off-by-one fix for half-page scrolling.
(z_cmd): Handle half-page scrolling given address in second half
of first page. For example, on terminal with 24 rows, opening a
file with at least 41 (non-wrapping) lines in ed and running the
command `20[' prints lines 8 through 41, with line 20 in the
middle of the window.
2018-06-18 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (rbracket_cmd): Call lbracket_cmd (), not
exec_one_off ('[').
(lbracket_cmd): Call Z_cmd (), not exec_one_off ('Z').
Call z_cmd () directly, not via rbracket_cmd ().
2017-06-17 Andrew L. Moore <slewsys@gmail.com>
* configure.ac: Record configure args and environment vars.
2017-10-17 Andrew L. Moore <slewsys@gmail.com>
* src/re.c: Add support for Darwin ENHANCED regex.
2017-10-15 gettextize <bug-gnu-gettext@gnu.org>
* m4/gettext.m4: Upgrade to gettext-0.19.8.1.
* m4/iconv.m4: Upgrade to gettext-0.19.8.1.
* m4/lib-ld.m4: Upgrade to gettext-0.19.8.1.
* m4/lib-link.m4: Upgrade to gettext-0.19.8.1.
* m4/lib-prefix.m4: Upgrade to gettext-0.19.8.1.
* m4/nls.m4: Upgrade to gettext-0.19.8.1.
* m4/po.m4: Upgrade to gettext-0.19.8.1.
* m4/progtest.m4: Upgrade to gettext-0.19.8.1.
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.19.8.
2017-10-15 Andrew L. Moore <slewsys@gmail.com>
* Makefile.am: Update included GNU regex via gnulib.
Version 2.0.3.
2017-03-21 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (exec_command): Split out command switch into
separate functions called via function pointer.
2017-03-20 Andrew L. Moore <slewsys@gmail.com>
* testsuite/Makefile.am (ED_SCRIPTS_OK): Rename tests that are not
supposed to fail due to less stringent rules.
* src/page.c (display_lines): Scrolling half-page forward (ed
command `]') failed at end-of-file.
* src/io.c (read_file): Add diagnostics for unlockable read-only
file. Open read-only file without locking.
2016-10-19 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (exec_command):
* src/io.c (read_file): Move access() checks inside read_file().
2016-07-15 Andrew L. Moore <slewsys@gmail.com>
* src/main.c (main): Call one_time_init() prior to SETJMP(), since
both jump to `error'.
2016-06-15 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (exec_command): Fix 'P' and 'H' commands.
* src/io.c (read_file): fcntl(2) F_SETLK requires writable descriptor.
(set_file_lock): fcntl(2) F_SETLK and flock(2) may share locks.
* src/ed.h: Calculate OFF_T_MAX with size_t masks.
* src/buf.c (one_time_init):
* src/ed.h (struct ed_display):
* src/exec.c (exec_command):
* src/page.c (init_frame_buffer):
* src/signal.c (handle_winch): Move global vars window_rows and
window_columns to ed->display->ws_row and ed->display-ws_col,
respectively.
2016-06-11 gettextize <bug-gnu-gettext@gnu.org>
* m4/gettext.m4: Upgrade to gettext-0.19.7.
* m4/iconv.m4: Upgrade to gettext-0.19.7.
* m4/lib-ld.m4: Upgrade to gettext-0.19.7.
* m4/lib-link.m4: Upgrade to gettext-0.19.7.
* m4/lib-prefix.m4: Upgrade to gettext-0.19.7.
* m4/nls.m4: Upgrade to gettext-0.19.7.
* m4/po.m4: Upgrade to gettext-0.19.7.
* m4/progtest.m4: Upgrade to gettext-0.19.7.
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.19.7.
2014-09-16 Andrew L. Moore <slewsys@gmail.com>
* src/undo.c (undo_last_command):
* src/sub.c (substitution_rhs, substitute_lines)
(substitute_matching):
* src/signal.c (handle_hup):
* src/re.c (get_matching_node_address):
* src/parse.c (address_range, line_address)
(check_address_bounds, regular_expression):
* src/page.c (display_lines, put_frame_buffer_line):
* src/main.c (main):
* src/io.c (read_file, read_pipe, read_stream, read_stream_r):
* src/exec.c (DESTINATION_ADDRESS, exec_command, is_valid_range):
* src/cmds.c (append_lines, join_lines, copy_lines)
(delete_lines, join_lines, move_lines):
* src/buf.c (init_ed_state, put_buffer_line, append_line_node)
(get_line_node):
* src/aux.c (filter_lines, read_from_register): Replace `[0].'
with `->'.
2014-09-16 gettextize <bug-gnu-gettext@gnu.org>
* m4/gettext.m4: Upgrade to gettext-0.19.2.
* m4/iconv.m4: Upgrade to gettext-0.19.2.
* m4/lib-ld.m4: Upgrade to gettext-0.19.2.
* m4/lib-link.m4: Upgrade to gettext-0.19.2.
* m4/lib-prefix.m4: Upgrade to gettext-0.19.2.
* m4/nls.m4: Upgrade to gettext-0.19.2.
* m4/po.m4: Upgrade to gettext-0.19.2.
* m4/progtest.m4: Upgrade to gettext-0.19.2.
* m4/codeset.m4: Upgrade to gettext-0.19.2.
* m4/fcntl-o.m4: Upgrade to gettext-0.19.2.
* m4/glibc2.m4: Upgrade to gettext-0.19.2.
* m4/glibc21.m4: Upgrade to gettext-0.19.2.
* m4/intdiv0.m4: Upgrade to gettext-0.19.2.
* m4/intl.m4: Upgrade to gettext-0.19.2.
* m4/intldir.m4: Upgrade to gettext-0.19.2.
* m4/intlmacosx.m4: Upgrade to gettext-0.19.2.
* m4/intmax.m4: Upgrade to gettext-0.19.2.
* m4/inttypes_h.m4: Upgrade to gettext-0.19.2.
* m4/inttypes-pri.m4: Upgrade to gettext-0.19.2.
* m4/lcmessage.m4: Upgrade to gettext-0.19.2.
* m4/lock.m4: Upgrade to gettext-0.19.2.
* m4/longlong.m4: Upgrade to gettext-0.19.2.
* m4/printf-posix.m4: Upgrade to gettext-0.19.2.
* m4/size_max.m4: Upgrade to gettext-0.19.2.
* m4/stdint_h.m4: Upgrade to gettext-0.19.2.
* m4/threadlib.m4: Upgrade to gettext-0.19.2.
* m4/uintmax_t.m4: Upgrade to gettext-0.19.2.
* m4/visibility.m4: Upgrade to gettext-0.19.2.
* m4/wchar_t.m4: Upgrade to gettext-0.19.2.
* m4/wint_t.m4: Upgrade to gettext-0.19.2.
* m4/xsize.m4: Upgrade to gettext-0.19.2.
* configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.19.2.
2014-02-20 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (exec_command):
* src/aux.c (append_node_to_register, read_from_register)
(register_copy, register_move, reset_register_queue)
(write_to_register): Add register extensions to `m' and `t'
commands. Deleted lines are copied to a default register. The
syntax of the register extensions is as follows.
(.,.)m|t>[>][k] where optional k = 0, 1, ..., 9. Moves or copies,
respectively, the addressed lines to register k (or default
anonymous register, if k is not given). If `>>' lines are appended
to end of register. Otherwise, any previous register contents are
overwritten.
<[k]m|t(.) where optional k = 0, 1, ..., 9. Moves or copies,
respectively, contents of register k (or default anonymous
register, if k is not given) to after the addressed line.
<[k]m|t>[>][j] where optional k = 0, 1, ..., 9 and j = 0, 1, ...,
9. Moves or copies, respectively, contents of register k (or
default anonymous register, if k is not given) to register j (or
default anonymous register, if j is not given). If `>>' lines are
appended to end of register. Otherwise, any previous register
contents are overwritten.
2014-01-27 Andrew L. Moore <slewsys@gmail.com>
* src/ed.h (off_t): Work around conflicting off_t typedefs (e.g.,
if _LARGE_FILE support enabled) and redefine using storage size
determined by configure. This resolves outstanding segfaults on
32-bit GNU/Linux platform.
2014-01-26 Andrew L. Moore <slewsys@gmail.com>
* src/ed.h: Use configure to set size of off_t.
* src/buf.c (realloc_buffer): Changing argument type from off_t to
size_t fixes segfault on 32-bit GNU/Linux.
2014-01-25 Andrew L. Moore <slewsys@gmail.com>
* src/*.[ch]: Refactor data structures:
ed->subst => ed->exec->subst
ed->region => ed->exec->region
2014-01-20 Andrew L. Moore <slewsys@gmail.com>
* src/buf.c (alloc_ed_state, alloc_ed_core, alloc_ed_display)
(alloc_ed_execute, alloc_ed_file, alloc_ed_region)
(alloc_ed_substitute):
* src/ed.h: Use struct pointers to alleviate alignment issues
on 32-bit GNU/Linux.
2013-08-08 Andrew L. Moore <slewsys@gmail.com>
* Makefile.am: Ignore errors from update-po in
maintainer-update-dist target.
* upgrade-sh (_exit_status): Update ed.pot.in from ed.pot after
running msg-merge.
* configure.ac: Create po/ed.pot from po/ed.pot.in.
* src/parse.c (expand_glob): glob () on GNU/Linux platform does
not set errno.
(shell_command): Expand `%' to empty string if filename unset.
* src/io.c (get_file_lock): Set both fcntl (2) and flock (2)
locks, if available.
* src/buf.c (init_ed_command): fclose () on GNU/Linux
platform results in double free.
2013-08-07 Andrew L. Moore <slewsys@gmail.com>
* src/parse.c (file_glob): Reinitialize file.glob/list when
globbing fails. Return default file when file.list is empty.
(expand_glob): If globbing of pattern with no path separator
fails, then relax match criteria to permit non-existent pathname.
2013-08-05 Andrew L. Moore <slewsys@gmail.com>
* src/exec.c (exec_command): Don't set init_glob param of
init_ed_command () if ed `e' command has no arguments.
* src/parse.c (file_glob): Don't loose file.glob by assigning
file.list to it.
2013-08-05 gettextize <bug-gnu-gettext@gnu.org>
* m4/gettext.m4: Upgrade to gettext-0.18.3.
* m4/iconv.m4: Upgrade to gettext-0.18.3.
* m4/lib-ld.m4: Upgrade to gettext-0.18.3.
* m4/lib-link.m4: Upgrade to gettext-0.18.3.
* m4/lib-prefix.m4: Upgrade to gettext-0.18.3.
* m4/nls.m4: Upgrade to gettext-0.18.3.
* m4/progtest.m4: Upgrade to gettext-0.18.3.
* m4/codeset.m4: Upgrade to gettext-0.18.3.
* m4/fcntl-o.m4: Upgrade to gettext-0.18.3.
* m4/glibc2.m4: Upgrade to gettext-0.18.3.
* m4/glibc21.m4: Upgrade to gettext-0.18.3.
* m4/intdiv0.m4: Upgrade to gettext-0.18.3.
* m4/intldir.m4: Upgrade to gettext-0.18.3.
* m4/intlmacosx.m4: Upgrade to gettext-0.18.3.
* m4/intmax.m4: Upgrade to gettext-0.18.3.
* m4/inttypes_h.m4: Upgrade to gettext-0.18.3.
* m4/inttypes-pri.m4: Upgrade to gettext-0.18.3.
* m4/lcmessage.m4: Upgrade to gettext-0.18.3.
* m4/lock.m4: Upgrade to gettext-0.18.3.
* m4/longlong.m4: Upgrade to gettext-0.18.3.
* m4/printf-posix.m4: Upgrade to gettext-0.18.3.
* m4/size_max.m4: Upgrade to gettext-0.18.3.
* m4/stdint_h.m4: Upgrade to gettext-0.18.3.
* m4/threadlib.m4: Upgrade to gettext-0.18.3.
* m4/uintmax_t.m4: Upgrade to gettext-0.18.3.
* m4/visibility.m4: Upgrade to gettext-0.18.3.
* m4/wchar_t.m4: Upgrade to gettext-0.18.3.
* m4/wint_t.m4: Upgrade to gettext-0.18.3.
* m4/xsize.m4: Upgrade to gettext-0.18.3.
2013-08-05 Andrew L. Moore <slewsys@gmail.com>
* src/parse.c (expand_glob): Support file-glob expansion of
non-existent pathnames. For example, `~w ~/o.tmp' writes to o.tmp
in user's home directory, creating it if it did not already exist.
Unfortunately, this leads to some surprises. For instance, given
some empty directories, say, ./temp{1,2,3} and the commands:
$ ed -p \* \!date
!
29
*~w ./temp*/o.dat
./temp1/o.dat
29
*~f
./temp1/o.dat
./temp2/o.dat
./temp3/o.dat
*
Although only the first pathname, ./temp1/o.dat, is created, the
generated file list includes two additional non-existent
pathnames. This seems preferable, nonetheless, to restricting such
expansions since a file list can be generated prior to saving or
editing. In the example above, ./temp2/o.dat could have been
selected as follows:
$ ed -p \* \!date
!
29
*~f ./temp*/o.dat
./temp1/o.dat
./temp2/o.dat
./temp3/o.dat
*fn
./temp2/o.dat
*~w
./temp2/o.dat
29
*
2013-07-22 Andrew L. Moore <slewsys@gmail.com>
* src/page.c (put_frame_buffer_line): Condition line enumeration
format on addr_last.
(INC_MOD_FB_ROW): Rename COND_WRAP_FB_ROW () => INC_MOD_FB_ROW ().
(display_frame_buffer): Revisit calculation of first and last
frame buffer rows to print to support half-page scrolling.
* src/page.c (display_frame_buffer, put_frame_buffer_line)