cmd: hmi/pipeconsole -P serve /dev/tty instead of /dev/cons (for use with mksh)
This commit is contained in:
parent
2bf39bf38a
commit
96f5c08548
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of Jehanne.
|
* This file is part of Jehanne.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Giacomo Tesio <giacomo@tesio.it>
|
* Copyright (C) 2015-2018 Giacomo Tesio <giacomo@tesio.it>
|
||||||
*
|
*
|
||||||
* Jehanne is free software: you can redistribute it and/or modify
|
* Jehanne is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -34,6 +34,7 @@ extern int systemwide; /* all the system depend on this console:
|
||||||
extern int blind; /* no feedback for input, disables rawmode */
|
extern int blind; /* no feedback for input, disables rawmode */
|
||||||
extern int linecontrol;
|
extern int linecontrol;
|
||||||
extern int crnl; /* turn \n into \r\n to output device */
|
extern int crnl; /* turn \n into \r\n to output device */
|
||||||
|
extern int posix; /* Qcons name is "tty" instead of "cons" */
|
||||||
|
|
||||||
extern int debugging;
|
extern int debugging;
|
||||||
extern void enabledebug(const char *);
|
extern void enabledebug(const char *);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of Jehanne.
|
* This file is part of Jehanne.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Giacomo Tesio <giacomo@tesio.it>
|
* Copyright (C) 2015-2018 Giacomo Tesio <giacomo@tesio.it>
|
||||||
*
|
*
|
||||||
* Jehanne is free software: you can redistribute it and/or modify
|
* Jehanne is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -27,7 +27,7 @@ int crnl;
|
||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprint(2, "usage: %s [-d dbgfile] [-l] [-b] program [args]\n", argv0);
|
fprint(2, "usage: %s [-d dbgfile] [-l] [-b] [-P] program [args]\n", argv0);
|
||||||
exits("usage");
|
exits("usage");
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
@ -48,6 +48,9 @@ main(int argc, char *argv[])
|
||||||
case 'l':
|
case 'l':
|
||||||
linecontrol = 0;
|
linecontrol = 0;
|
||||||
break;
|
break;
|
||||||
|
case 'P':
|
||||||
|
posix = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
}ARGEND;
|
}ARGEND;
|
||||||
|
@ -66,10 +69,15 @@ main(int argc, char *argv[])
|
||||||
/* become the requested program */
|
/* become the requested program */
|
||||||
rfork(RFNOTEG|RFREND|RFCFDG);
|
rfork(RFNOTEG|RFREND|RFCFDG);
|
||||||
|
|
||||||
fd = open("/dev/cons", OREAD);
|
if(posix){
|
||||||
fd = open("/dev/cons", OWRITE);
|
fd = open("/dev/tty", OREAD);
|
||||||
|
fd = open("/dev/tty", OWRITE);
|
||||||
|
} else {
|
||||||
|
fd = open("/dev/cons", OREAD);
|
||||||
|
fd = open("/dev/cons", OWRITE);
|
||||||
|
}
|
||||||
if(dup(fd, 2) != 2)
|
if(dup(fd, 2) != 2)
|
||||||
sysfatal("bad FDs: %r");
|
sysfatal("bad FDs: %r");
|
||||||
exec(argv[0], argv);
|
jehanne_pexec(argv[0], argv);
|
||||||
sysfatal("exec %s: %r", argv[0]);
|
sysfatal("exec %s: %r", argv[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of Jehanne.
|
* This file is part of Jehanne.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Giacomo Tesio <giacomo@tesio.it>
|
* Copyright (C) 2015-2018 Giacomo Tesio <giacomo@tesio.it>
|
||||||
*
|
*
|
||||||
* Jehanne is free software: you can redistribute it and/or modify
|
* Jehanne is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -36,6 +36,7 @@ typedef enum
|
||||||
} Status;
|
} Status;
|
||||||
|
|
||||||
int systemwide;
|
int systemwide;
|
||||||
|
int posix;
|
||||||
|
|
||||||
static Status status;
|
static Status status;
|
||||||
static int rawmode;
|
static int rawmode;
|
||||||
|
@ -1015,6 +1016,9 @@ fsserve(int connection)
|
||||||
Fcall rep;
|
Fcall rep;
|
||||||
Fcall *req;
|
Fcall *req;
|
||||||
|
|
||||||
|
if(posix)
|
||||||
|
qtab[Qcons].name = "tty";
|
||||||
|
|
||||||
fspid = getpid();
|
fspid = getpid();
|
||||||
req = malloc(sizeof(Fcall)+Maxfdata);
|
req = malloc(sizeof(Fcall)+Maxfdata);
|
||||||
if(req == nil)
|
if(req == nil)
|
||||||
|
|
Loading…
Reference in New Issue