aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/Makefile.am28
-rwxr-xr-xdoc/grosciteco.tes38
-rw-r--r--doc/grosciteco.tes.1.in10
-rw-r--r--doc/sciteco.1.in39
-rw-r--r--doc/sciteco.7.template20
-rwxr-xr-xdoc/tedoc.tes27
-rw-r--r--fallback.teco_inibin2225 -> 2322 bytes
-rw-r--r--lib/getopt.tes52
-rw-r--r--lib/opener.tes30
-rw-r--r--src/Makefile.am2
-rw-r--r--src/core-commands.c2
-rw-r--r--src/main.c36
-rwxr-xr-xsrc/symbols-extract.tes12
-rw-r--r--tests/testsuite.at15
14 files changed, 171 insertions, 140 deletions
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 65f8556..f6e4dc1 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -40,40 +40,34 @@ install-exec-hook:
womendir = $(scitecolibdir)/women
women_DATA = grosciteco.tes.1.woman grosciteco.tes.1.woman.tec
-CLEANFILES = grosciteco.tes.1 grosciteco.tes.1.intermediate
+CLEANFILES = grosciteco.tes.1
EXTRA_DIST = grosciteco.tes.1.in
women_DATA += tedoc.tes.1.woman tedoc.tes.1.woman.tec
-CLEANFILES += tedoc.tes.1 tedoc.tes.1.intermediate
+CLEANFILES += tedoc.tes.1
EXTRA_DIST += tedoc.tes.1.in
women_DATA += sciteco.1.woman sciteco.1.woman.tec
-CLEANFILES += sciteco.1 sciteco.1.intermediate
+CLEANFILES += sciteco.1
EXTRA_DIST += sciteco.1.in
women_DATA += sciteco.7.woman sciteco.7.woman.tec
-CLEANFILES += sciteco.7 sciteco.7.intermediate sciteco.7.in
+CLEANFILES += sciteco.7 sciteco.7.in
EXTRA_DIST += sciteco.7.template
women_DATA += tutorial.woman tutorial.woman.tec
-CLEANFILES += tutorial.ms tutorial.intermediate
+CLEANFILES += tutorial.ms
EXTRA_DIST += tutorial.ms.in
CLEANFILES += $(women_DATA)
-# FIXME: *.intermediate files are only generated since SciTECO scripts
-# cannot currently read stdin via --stdin while passing command-line
-# arguments at the same time, so the grosciteco postprocessor
-# has to be run on a separate file.
-%.woman %.woman.tec : %.intermediate grosciteco.tes
- $(SCITECO_FULL) -m -- @srcdir@/grosciteco.tes \
- $@ $<
+%.woman %.woman.tec : % sciteco.tmac grosciteco.tes
+ @GROFF@ -wall -Z -Kutf-8 -Tutf8 -t -man -M@srcdir@ -msciteco $< | \
+ $(SCITECO_FULL) -im -- @srcdir@/grosciteco.tes $@
-%.intermediate : % sciteco.tmac
- @GROFF@ -wall -Z -Kutf-8 -Tutf8 -t -man -M@srcdir@ -msciteco $< >$@
-
-tutorial.intermediate : tutorial.ms sciteco.tmac
- @GROFF@ -wall -Z -Kutf-8 -Tutf8 -t -ms -M@srcdir@ -msciteco $< >$@
+tutorial.woman tutorial.woman.tec : tutorial.ms sciteco.tmac grosciteco.tes
+ @GROFF@ -wall -Z -Kutf-8 -Tutf8 -t -ms -M@srcdir@ -msciteco $< | \
+ $(SCITECO_FULL) -im -- @srcdir@/grosciteco.tes $@
man_MANS = grosciteco.tes.1 tedoc.tes.1 sciteco.1 sciteco.7
diff --git a/doc/grosciteco.tes b/doc/grosciteco.tes
index cbe0e61..a724a5f 100755
--- a/doc/grosciteco.tes
+++ b/doc/grosciteco.tes
@@ -1,16 +1,18 @@
-#!/usr/local/bin/sciteco -m
-!* grosciteco.tes [-t <output-tec>] [--] <output-woman> <input> *!
+#!/usr/local/bin/sciteco -mi
+!* grosciteco.tes [-t <output-tec>] [--] <output> <input *!
0,2EJ !* FIXME: Memory limiting is too slow *!
:EIQ[$SCITECOPATH]/getopt.tes
!* Process command-line options *!
-[optstring]t: M[getopt]"F (0/0) '
-LR 0X[output-woman] 2LR 0X[input] HK
+[optstring]t:
+M[getopt]U[output-woman] Q[output-woman]"< Invalid command-line^J 1 '
+EU[output-woman]Q[\[output-woman]]
:Q[getopt.t]"< EU[getopt.t]Q[output-woman].tec '
-EBN[input]
+EBN[output-woman] HK 1EB
+
0EE !* Groff intermediate code is always ASCII *!
!* skip whitespace characters *!
@@ -54,7 +56,7 @@ EBN[input]
!* FIXME: Works only for straight lines *!
@[line]{ U.[to.v] U.[to.h]
Q.[to.h]-Q[pos.h]"= Q.[to.v]-Q[pos.v]"=  ' '
- [* EB
+ [* EBN[output-woman]
Q.[to.h]-Q[pos.h]"=
!* vertical line *!
Q.[to.v]-Q[pos.v]"< Q[pos.v]U.v Q.[to.v]U[pos.v] | Q.[to.v]U.v '
@@ -147,32 +149,32 @@ EBN[input]
* a table). Only the line+column should no longer change.
* Either store line+column or use markers.
*!
- [* EB 0:M[move] U.d ]*
+ [* EBN[output-woman] 0:M[move] U.d ]*
:EU[topics]\.d:
C :X[topics]
L F<
!cmd.xXsciteco_tt!
- [* EB 0:M[move] U[ttstart] ]*
+ [* EBN[output-woman] 0:M[move] U[ttstart] ]*
L F<
!cmd.xXsciteco_tt_end!
- [* EB 0:M[move]
+ [* EBN[output-woman] 0:M[move]
-Q[ttstart]<
Q[ttstart]ESSTARTSTYLING Q[ttstart]ESGETSTYLEAT+16,1ESSETSTYLING
%[ttstart]>
]*
L F<
!cmd.xXsciteco_startstyling!
- [* EB 0:M[move] U[stylestart] ]*
+ [* EBN[output-woman] 0:M[move] U[stylestart] ]*
L F<
!cmd.xXsciteco_setstyling!
C :M#giU.s
- [* EB 0:M[move]
+ [* EBN[output-woman] 0:M[move]
Q[stylestart]ESSTARTSTYLING Q.s,(-Q[stylestart])ESSETSTYLING
]*
L F<
!cmd.xXsciteco_foldlevel!
C :M#giU.[foldlevel]
- [* EB 0:M[move]
+ [* EBN[output-woman] 0:M[move]
Q.[foldlevel],(ESLINEFROMPOSITION)ESSETLINESTATE
]*
L F<
@@ -274,7 +276,7 @@ EBN[input]
!cmd.t!
:M#sw .(:M#sa).X.w
- [* EB :Q.w:M[move]
+ [* EBN[output-woman] :Q.w:M[move]
G.w :Q.w:M[style] ]*
:Q.w%[pos.h] :M#sc F<
@@ -285,17 +287,17 @@ EBN[input]
|
.(:M#sa).X.w 0Q[glyphs.Q.w]U.w
'
- [* EB 1:M[move]
+ [* EBN[output-woman] 1:M[move]
Q.wI 1:M[style] ]* :M#sc F<
!cmd.c!
:M#sw 0AU.w C
- [* EB 1:M[move]
+ [* EBN[output-woman] 1:M[move]
G[glyphs.U.w] 1:M[style] ]* :M#sc F<
!cmd.N!
:M#sw :M#giU.w
- [* EB 1:M[move]
+ [* EBN[output-woman] 1:M[move]
Q.wI 1:M[style] ]* :M#sc F<
!cmd.n!
@@ -336,7 +338,7 @@ Q*U*
* TODO: The size can still be improved by using SCI_SETSTYLINGEX
* if appropriate.
*!
-EB 0EE !* operate in single-byte mode *!
+EBN[output-woman] 0EE !* operate in single-byte mode *!
J 0U#cs 0U#cd
<
.ESGETSTYLEATUs Qs"< Qs= '
@@ -375,7 +377,7 @@ Q[cur.fl]"N
!*
* Save the clear-text part of the document into <output-woman>
*!
-2EL EWQ[output-woman]
+2EL EW
EQ[styles]
diff --git a/doc/grosciteco.tes.1.in b/doc/grosciteco.tes.1.in
index 9056a60..e720f3e 100644
--- a/doc/grosciteco.tes.1.in
+++ b/doc/grosciteco.tes.1.in
@@ -18,7 +18,7 @@ GNU roff post-processor for \*(ST
.OP "-t" tec_output
.OP "--"
.I text_output
-.I input
+.RI < input
.YS
.
.
@@ -79,8 +79,8 @@ This is also the default when omitted.
.IP "\fItext_output\fP
The plain-text output file, e.g. \(lqgreat-macro.woman\(rq.
.IP "\fIinput\fP"
-The \fIinput\fP file is in \fBtroff\fP's device-independant
-output format.
+\fBtroff\fP's device-independant output format
+is read from \fIstdin\fP.
.
.
.SH SPECIAL TROFF MACROS
@@ -168,8 +168,8 @@ a \*(ST macro package with a man page called
.SCITECO_TT
.EX
groff -Z -Kutf-8 -Tutf8 -man -M@scitecodatadir@ -msciteco \\
- great-macro.tes.7sciteco >great-macro.tes.7sciteco.intermediate
-grosciteco.tes great-macro.tes.7sciteco.woman great-macro.tes.7sciteco.intermediate
+ great-macro.tes.7sciteco | \\
+grosciteco.tes great-macro.tes.7sciteco.woman
.SCITECO_TT_END
.EE
.RE
diff --git a/doc/sciteco.1.in b/doc/sciteco.1.in
index 0eec35f..c62723c 100644
--- a/doc/sciteco.1.in
+++ b/doc/sciteco.1.in
@@ -63,12 +63,13 @@ invoked as scripts by using a Hash-Bang line like
.RS
.SCITECO_TT
.EX
-#!@bindir@/sciteco -m
+#!@bindir@/@PACKAGE@ -m
.SCITECO_TT_END
.EE
.RE
.
.LP
+.SCITECO_TOPIC argv arguments
Note that UNIX Hash-Bang lines will only pass a \fBsingle\fP argument to the
interpreter before the script's file name, so all required \*(ST options must
be mangled into a single argument with their single-letter names.
@@ -76,31 +77,29 @@ Passing option-like arguments (beginning with a dash) to scripts may cause
problems because \*(ST might try to interpret these options.
\*(ST thus stops parsing at the first non-option
argument (which will always be the munged file name in a script invocation).
-.
-.LP
-Upon startup \*(ST's buffer ring contains only one unnamed empty buffer.
-First \*(ST reads from \fIstdin\fP into the unnamed buffer if \(lq--stdin\(rq
-was given.
-\# FIXME: This must change
-.SCITECO_TOPIC argv arguments
-Afterwards all command line arguments after the \*(ST options are passed as
-.I arguments
-to the munged macro by appending each argument on its own line to
-the unnamed buffer.
-The \fIscript\fP file name expected when \(lq--mung\(rq is given
-is currently \fBnot\fP considered a macro argument.
-In any case the current buffer position (called
-.IR dot )
-is left at the beginning of the buffer.
-The buffer is left \fIdirty\fP if anything was added to it.
Optionally \(lq\-\-\(rq might be used to explicitly separate \*(ST options and
macro arguments, but is never passed down as a macro argument.
Since it's sometimes useful to pass down \(rq\-\-\(rq to the profile macro,
you can use \(lq\-S\(rq, which is equivalent to \(lq\-\- \-\-\(rq.
+All remaining arguments after the built-in processing of options
+are passed to the executed macro using an array of global Q-registers \fB^A\fIx\fR.
+The \fIscript\fP file name expected when \(lq\-\-mung\(rq is given
+is currently \fBnot\fP included in this array.
+Q-register \fB^A0\fP is the name of the current process as passed to C
+programs in \(lqargv[0]\(rq.
+.
+.LP
+Upon startup \*(ST's buffer ring always contains only one unnamed buffer.
+If \(lq\-\-stdin\(rq is given, \*(ST first reads from \fIstdin\fP until end-of-file
+into the unnamed buffer.
+This is includes automatic EOL translation just like when using the \fBEB\fP command
+and can therefore be disabled by specifying \(lq\-\-8bit\(rq.
+If reading from \fIstdin\fP results in any text additions, the buffer is left \fIdirty\fP.
+The current position (called dot) is always left at the beginning of the buffer.
.
.LP
If the munged macro does not request program termination using the
-\fBEX\fP command or exits using \fB^C\fP, \*(ST will automatically
+\fBEX\fP command or exits using \fB^C^C\fP, \*(ST will automatically
switch into its graphical \fIinteractive\fP mode.
\*(ST may be built with different graphical user interfaces,
including Curses and GTK+ based ones.
@@ -546,6 +545,8 @@ dmesg | @PACKAGE@ -qioe '<%a\\@I/ / :L;>'
.RE
.
.LP
+This also works in interactive mode, so \(lq@PACKAGE@ -i\(rq
+allows you to interactively edit text read from \fIstdin\fP.
Suppose you would want to print only those lines from \fIstdin\fP
matching \(lqiwm0:\(rq:
.RS
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template
index bad7e7d..21385a3 100644
--- a/doc/sciteco.7.template
+++ b/doc/sciteco.7.template
@@ -1668,6 +1668,26 @@ the original clipboard contents, though.
The numeric parts of the clipboard registers are
currently not used by \*(ST.
.TP
+.SCITECO_TOPIC ^Ax
+.BI ^A x
+An argument passed on the operating system's command line.
+\fIx\fP can be an integer beginning with 0.
+.B ^A0
+is the name of the program, as passed via \(lqargv[0]\(rq to
+C programs, and is guaranteed to always exist.
+All remaining registers for \fIx\fP larger than or equal to 1
+represent the command-line parameters after all the built-in
+options as reported by \(lq@PACKAGE@ --help\(rq.
+In other words all the options processed by the \*(ST main program
+including the file names after \(lq--mung\(rq are automatically
+excluded from the
+.BI ^A x
+array.
+The numeric parts of the argument registers are
+currently not used by \*(ST.
+For more details, see
+.BR sciteco (1).
+.TP
.BI ^K key
Key macro registers as documented in section
.BR "KEY TRANSLATION" .
diff --git a/doc/tedoc.tes b/doc/tedoc.tes
index 885f41a..cc4f726 100755
--- a/doc/tedoc.tes
+++ b/doc/tedoc.tes
@@ -8,7 +8,7 @@
@[format_header]{
FD--S .,(:L"S.|Z')@Xa I^J
- EBQ#tm
+ EBN[\#tm]
I\# GENERATED FROM Q.#sc (\.#sc):^J
I.SS  Ga -A-10"N I^J '
:Q.[topics]">
@@ -45,7 +45,7 @@
J <FR^J^J^J;>
J 0A-10"=D'
ZJ -A-10"=-D'
- EBQ#tm
+ EBN[\#tm]
G.[header]
I^J.^J
}
@@ -73,35 +73,34 @@
J <S<MC>; -D I^J -S< -D I^J.I >
J <FRS^J^J;>
J <FR^JS^J;>
- EBN#tm
+ EBN[\#tm]
G.c I^J.^J.^J
}
!* process command-line options *!
-[optstring]C M[getopt]"F (0/0) '
+[optstring]C
+M[getopt]U#ou Q#ou"< Invalid command-line^J 1 '
:Q[getopt.C]"<
[comment.start]!* [comment.end]*!
|
[comment.start]/* [comment.end]*/
'
-LR 0X#ou
-2LR 0X#tm EBN#tm EB L
-[.f
- <:L;R 0X.f EBQ.f EB L>
-].f
--EF
+Q#ou+1U#tm Q#tmU.i <:Q[\.i]:; EBN[\.i] %.i>
+
+!* switch to the main troff template (#tm) *!
+EB EF
I\#
-\# AUTOGENERATED FROM Q#tm
+\# AUTOGENERATED FROM Q[\#tm]
\# DO NOT EDIT MANUALLY!!!
\#^J
!* find insertion point *!
-:FS^J.TEDOC^J^J"F(0/0)'
+:FS^J.TEDOC^J^J"F Missing .TEDOC call^J 1 '
EJ-1<
<
- 2U* [*]#sc
+ 2U* [*].#sc
!* extract comment *!
SQ[comment.start]$;
@@ -127,5 +126,5 @@ EJ-1<
EF
>
-2EL EWQ#ou
+2EL EWQ[\#ou]
EX
diff --git a/fallback.teco_ini b/fallback.teco_ini
index 68814dd..7b10441 100644
--- a/fallback.teco_ini
+++ b/fallback.teco_ini
Binary files differ
diff --git a/lib/getopt.tes b/lib/getopt.tes
index 46c813f..4ecfa3f 100644
--- a/lib/getopt.tes
+++ b/lib/getopt.tes
@@ -1,5 +1,5 @@
!*$
- * M[getopt] -> Success|Failure -- Parse options
+ * M[getopt] -> First non-flag argument -- Parse options
*
* Parses command line options according to the string
* \(lqoptstring\(rq, similar to \fBgetopt\P(3).
@@ -14,37 +14,47 @@
* If the option had an argument, it is stored in the register's
* string part.
*
- * A condition boolean is returned to signify whether
- * there was a parsing error.
+ * Returns the index of the first command-line argument that does not
+ * belong to a flag or -1 in case of parsing errors.
*!
[optstring]
-@[getopt]{ [:
- <
- .-Z"= 1; ' 0A-^^-"N :L; F< '
+@[getopt]{
+ <%.j
+ :Q[\.j]:;
+ 0Q[\.j]--"N 1; '
+ !next!
- 1A-^^-"= K 1; '
+ 1Q[\.j]U.f
+ Q.f--"= !* -- *! Q.j+1 '
+ !* j-th argument is -f *!
0U.i <
- :Q[optstring]-Q.i"= ]: 0 '
- Q.iQ[optstring]U.c
+ Q.iQ[optstring]U.o Q.o"< -1 '
- 0U.#ar <
- %.i-:Q[optstring]"= 1; '
- Q.iQ[optstring]-^^:"N 1; '
- %.#ar>
+ !* count number of : after o *!
+ 0U.#ar <%.iQ[optstring]-:"N 1; ' %.#ar>
- 1A-Q.c"=
- -U[getopt.U.c]
+ Q.f-Q.o"=
+ -U[getopt.U.o]
Q.#ar">
- 2A-10"=
- K Q.#ar-1"> 0A-^^-"= 0U.i F< ' '
+ 2Q[\.j]"<
+ !* -f arg *!
+ %.j
+ Q.#ar-1"> !* optional arg *!
+ :Q[\.j]"< Q.j '
+ 0Q[\.j]--"= Onext '
+ |
+ :Q[\.j]"< -1 '
+ '
+ EU[getopt.U.o]Q[\.j]
|
- 2D
+ !* -farg *!
+ EU[getopt.U.o]Q[\.j]
+ [* EQ[getopt.U.o] 2D ]*
'
- LR 0X[getopt.U.c] 0L
'
- K 1;
+ 1;
'
>
>
-]: -1}
+Q.j}
diff --git a/lib/opener.tes b/lib/opener.tes
index 98ce631..c0183c8 100644
--- a/lib/opener.tes
+++ b/lib/opener.tes
@@ -1,40 +1,38 @@
!*$
- * M[opener] -- Open a number of files from the current buffer
+ * M[opener] -- Open files, specified on the command line
*
- * This is usually the unnamed buffer as initialized from the command line.
* It supports both the +line[,column] and filename:line[:column] syntaxes.
* Since this may make it hard to open files with certain file names, all
* filenames after "--" are interpreted verbatim.
+ * It does not change the current buffer.
*!
-@[opener]{
- <.-Z;
+@[opener]{ [*
+ <%.i :Q[\.i]:; EQ[\.i]
!* --/-S stops processing of special arguments *!
- 0A--"= 1A--"= 2A-10"=
- L <:L;R 0X.f [* EBN.f ]* L> 1;
+ 0A--"= 1A--"= 2A"<
+ <%.i :Q[\.i]:; EBN[\.i]> 1;
'''
1U.l 1U.c
!* +line[,column] *!
0A-+"= C 0A"D
\U.l <0A"DC|1;'> 0A-,"= C \U.c <0A"DC|1;'> '
- 0A-10"= 2LR Oopen '
- ' '
+ 0A"< %.i Oopen '
+ ''
!* filename:line[:column][:] *!
- LR -A-:"=R'
+ ZJ -A-:"=R'
0U.p <-%.pA"D|1;'> Q.pA-:"=
Q.p+1C \U.a R 0U.p <-%.pA"D|1;'> Q.pA-:"=
Q.p+1C \U.l Q.aU.c R
|
Q.aU.l 1U.c
'
- |
- LR
+ !* FIXME: modifies the i *!
+ .,ZD
'
!open!
- 0X.f [*
- EBN.f Q.c-1,Q.l-1ESFINDCOLUMN:J
- ]*
- L>
-}
+ EBN[\.i] Q.c-1,Q.l-1ESFINDCOLUMN:J
+ >
+]* }
diff --git a/src/Makefile.am b/src/Makefile.am
index f22802b..ff2e86b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -103,8 +103,6 @@ endif
CLEANFILES = $(BUILT_SOURCES) \
symbols-scintilla.c symbols-scilexer.c
-# FIXME: Perhaps symbols-extract.tes should work with --stdin/--stdout.
-# Requires changing the command-line argument passing first.
symbols-scintilla.c : @SCINTILLA_PATH@/include/Scintilla.h \
symbols-extract.tes
$(SCITECO_MINIMAL) -8m -- @srcdir@/symbols-extract.tes \
diff --git a/src/core-commands.c b/src/core-commands.c
index f384272..6d0a3dc 100644
--- a/src/core-commands.c
+++ b/src/core-commands.c
@@ -920,7 +920,7 @@ TECO_DEFINE_STATE_START(teco_state_start);
* Immediately jumps to the current loop's start.
* Also works from inside conditionals.
*
- * This command behaves exactly like \fB>\fP with regard to
+ * This command behaves exactly like \fB<\fP with regard to
* colon-modifiers.
*
* Outside of loops \(em or in a macro without
diff --git a/src/main.c b/src/main.c
index 2be81ea..3ad4333 100644
--- a/src/main.c
+++ b/src/main.c
@@ -476,30 +476,30 @@ main(int argc, char **argv)
* NOTE: The profile hasn't run yet, so it cannot guess the
* documents encoding. This should therefore be done by the profile
* for any preexisting unnamed buffer.
- *
- * FIXME: The unnamed buffer is also currently used for
- * command-line parameters.
- * Therefore you practically cannot pipe into SciTECO
- * while using opener.tes.
*/
- if (teco_stdin && !teco_view_load_from_stdin(teco_ring_current->view, TRUE, &error))
- goto cleanup;
+ if (teco_stdin) {
+ if (!teco_view_load_from_stdin(teco_ring_current->view, TRUE, &error))
+ goto cleanup;
+
+ if (teco_interface_ssm(SCI_GETLENGTH, 0, 0) > 0)
+ teco_ring_dirtify();
+ }
/*
- * Add remaining arguments to unnamed buffer.
- *
- * FIXME: This is not really robust since filenames may contain linefeeds.
- * Also, the Unnamed Buffer should be kept empty for piping.
- * Therefore, it would be best to store the arguments in Q-Regs, e.g. ^A0,^A1,^A2...
+ * Initialize the commandline-argument Q-registers (^Ax).
*/
- for (gint i = 1; argv_utf8[i]; i++) {
- teco_interface_ssm(SCI_APPENDTEXT, strlen(argv_utf8[i]), (sptr_t)argv_utf8[i]);
- teco_interface_ssm(SCI_APPENDTEXT, 1, (sptr_t)"\n");
+ for (guint i = 0; argv_utf8[i]; i++) {
+ gchar buf[32+1];
+ gint len = g_snprintf(buf, sizeof(buf), "\1%u", i);
+ g_assert(len < sizeof(buf));
+
+ teco_qreg_t *qreg = teco_qreg_plain_new(buf, len);
+ teco_qreg_table_insert_unique(&teco_qreg_table_globals, qreg);
+ if (!qreg->vtable->set_string(qreg, argv_utf8[i], strlen(argv_utf8[i]),
+ teco_default_codepage(), &error))
+ goto cleanup;
}
- if (teco_interface_ssm(SCI_GETLENGTH, 0, 0) > 0)
- teco_ring_dirtify();
-
/*
* Execute macro or mung file
*/
diff --git a/src/symbols-extract.tes b/src/symbols-extract.tes
index da9c207..6c7ef05 100755
--- a/src/symbols-extract.tes
+++ b/src/symbols-extract.tes
@@ -11,18 +11,18 @@ EIQ[$SCITECOPATH]/string.tes
!* read commandline arguments *!
[getopt.p]
-[optstring]p:n: M[getopt]"F (0/0) '
-LR 0X#ou 2LR 0X#in HK
+[optstring]p:n:
+M[getopt]U#ou Q#ou"< Invalid command-line^J 1 ' Q#ou+1U#in
!* copy all defines in input file beginning with prefix *!
-EBN#in <S#defineS[[Q[getopt.p]]M ]; 1:Xa 10:a> EF
+EBN[\#in] <S#defineS[[Q[getopt.p]]M ]; 1:Xa 10:a> EF
!* sort all defines *!
Ga ZJB 0,.M[qsort] J
!* format as C/C++ array *!
I/*
- * AUTOGENERATED FROM Q#in
+ * AUTOGENERATED FROM Q[\#in]
* DO NOT EDIT
*/
#ifdef HAVE_CONFIG_H
@@ -31,7 +31,7 @@ I/*
#include <glib.h>
-#include "Q#in"
+#include "Q[\#in]"
#include "sciteco.h"
#include "symbols.h"
@@ -56,6 +56,6 @@ teco_cmdline_cleanup(void)

!* write output file *!
-2EL EWQ#ou
+2EL EWQ[\#ou]
EX
diff --git a/tests/testsuite.at b/tests/testsuite.at
index e65cc1c..3a2fc2e 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -420,14 +420,23 @@ AT_CLEANUP
AT_BANNER([Standard library])
+AT_SETUP([Option parser])
+AT_CHECK([[$SCITECO -e "@EI'^EQ[\$SCITECOPATH]/getopt.tes' @^U[optstring]/XY/ M[getopt]-3\"N(0/0)' \
+ Q[getopt.X]+1\"N(0/0)' :Q[^A3]-2\"N(0/0)' :Q[^A4]-6\"N(0/0)'" \
+ -- -X -- -Y foobar]], 0, ignore, ignore)
+AT_CHECK([[$SCITECO -e "@EI'^EQ[\$SCITECOPATH]/getopt.tes' @^U[optstring]/F:z::X/ M[getopt]-4\"N(0/0)' \
+ Q[getopt.X]+1\"N(0/0)' :Q[getopt.F]-8\"N(0/0)' :Q[getopt.z]\"N(0/0)'" \
+ -- -X -Ffilename -z]], 0, ignore, ignore)
+AT_CLEANUP
+
AT_SETUP([Command line opener])
AT_DATA([data.123], [0123456789
9876543210
])
-AT_CHECK([[$SCITECO -e "@EI'^EQ[\$SCITECOPATH]/opener.tes' M[opener] -EF .-13\"N(0/0)'" +2,3 data.123]], 0, ignore, ignore)
-AT_CHECK([[$SCITECO -e "@EI'^EQ[\$SCITECOPATH]/opener.tes' M[opener] -EF .-11\"N(0/0)'" data.123:2]], 0, ignore, ignore)
+AT_CHECK([[$SCITECO -e "@EI'^EQ[\$SCITECOPATH]/opener.tes' M[opener] EF .-13\"N(0/0)'" +2,3 data.123]], 0, ignore, ignore)
+AT_CHECK([[$SCITECO -e "@EI'^EQ[\$SCITECOPATH]/opener.tes' M[opener] EF .-11\"N(0/0)'" data.123:2]], 0, ignore, ignore)
# `-S` stops processing of special arguments
-AT_CHECK([[$SCITECO -e "@EI'^EQ[\$SCITECOPATH]/opener.tes' M[opener] -EF EJ-2\"N(0/0)'" -S +1 data.123]], 0, ignore, ignore)
+AT_CHECK([[$SCITECO -e "@EI'^EQ[\$SCITECOPATH]/opener.tes' M[opener] EF EJ-2\"N(0/0)'" -S +1 data.123]], 0, ignore, ignore)
AT_CLEANUP
AT_BANNER([Regression Tests])