Added the -f (nofifo) flag. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 7fe90573b44dd33db678d2f45ac5a2c6626d6c9d
(DIR) parent 5f62ec15765ff967a22f32a79cccdb49350fcf3e
(HTM) Author: Rob King <jking@deadpixi.com>
Date: Fri, 27 May 2016 13:46:15 -0500
Added the -f (nofifo) flag.
Diffstat:
doc/sam.1 | 22 ++++++++++++++++++++++
sam/sam.c | 11 ++++++++---
samterm/main.c | 7 ++++++-
samterm/unix.c | 5 +++++
4 files changed, 41 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/doc/sam.1 b/doc/sam.1
@@ -8,6 +8,7 @@
.Nm
.Op Fl d
.Op Fl e
+.Op Fl f
.Op Fl t Ar terminal
.Ar
.Nm
@@ -43,6 +44,19 @@ Editing will be done with the command language only, as in
Expand tabs to spaces during editing.
Literal tabs may still be inserted using the character composition functionality, see
.Sx "Composed Text Input" "."
+.It Fl f
+Do not create or take ownership of the external command FIFO
+.Po
+see
+.Sx "Controlling running instances of sam"
+.Pc "."
+The
+.Nm B
+command will not communicate with this instance of
+.Nm sam "."
+This flag is useful for running
+.Dq "one-off"
+instances of sam.
.It Fl r Ar machine
Run the host part remotely on the specified machine, the terminal part locally, or cause commands to be sent to an instance of
.Nm
@@ -861,6 +875,14 @@ to load the named files; the default is the most-recently started local instance
.Pp
.Nm B
may also be called on a remote machine, causing the downloaded instance of sam connected to that machine to load the named files.
+.Pp
+Note that
+.Nm B
+will only communicate with the most-recently-run instance of
+.Nm sam ","
+but see the
+.Fl f
+option above.
.Ss Composed Text Input
.Nm sam
allows the input of arbitrary Unicode characters from the Basic Multilingual Plane
(DIR) diff --git a/sam/sam.c b/sam/sam.c
@@ -35,7 +35,8 @@ Rune baddir[] = { '<', 'b', 'a', 'd', 'd', 'i', 'r', '>', '\n'};
void usage(void);
-int main(int argc, char *argv[])
+int
+main(int argc, char *argv[])
{
int i, o;
String *t;
@@ -45,12 +46,16 @@ int main(int argc, char *argv[])
ap = &arg[argc];
arg[0] = "samterm";
- while ((o = getopt(argc, argv, "edRr:t:s:")) != -1){
+ while ((o = getopt(argc, argv, "efdRr:t:s:")) != -1){
switch (o){
case 'e':
arg[targc++] = "-e";
break;
+ case 'f':
+ arg[targc++] = "-f";
+ break;
+
case 'd':
dflag = 1;
break;
@@ -119,7 +124,7 @@ int main(int argc, char *argv[])
void
usage(void)
{
- dprint("usage: sam [-r machine] [-d] [-e] [-t samterm] [-s samname] FILE...\n");
+ dprint("usage: sam [-r machine] [-d] [-f] [-e] [-t samterm] [-s samname] FILE...\n");
exits("usage");
}
(DIR) diff --git a/samterm/main.c b/samterm/main.c
@@ -26,6 +26,7 @@ char hasunlocked = 0;
int expandtabs = 0;
int chord = 0;
char *machine = "localhost";
+int nofifo = 0;
#ifndef LINEUP
#define LINEUP 0x00
@@ -52,7 +53,7 @@ main(int argc, char *argv[])
Flayer *nwhich;
int fwdbut;
- while ((opt = getopt(argc, argv, "er:")) != -1){
+ while ((opt = getopt(argc, argv, "efr:")) != -1){
switch (opt){
case 'r':
machine = optarg;
@@ -61,6 +62,10 @@ main(int argc, char *argv[])
case 'e':
expandtabs = 1;
break;
+
+ case 'f':
+ nofifo = 1;
+ break;
}
}
(DIR) diff --git a/samterm/unix.c b/samterm/unix.c
@@ -25,6 +25,8 @@ static char *fallbacks[] = {
NULL
};
+extern int nofifo;
+
void
getscreen(int argc, char **argv)
{
@@ -82,6 +84,9 @@ removeextern(void)
void
extstart(void)
{
+ if (nofifo)
+ return;
+
#ifndef NOFIFO
extern char *machine;
char *disp;