<div dir="ltr">Hi,<div><br></div><div>What a coincidence, even I was about to send getty implementation in this forum.</div><div><br></div><div>Attached is a little largeish version of getty. <br></div><div>Supporting TERM settings, baud rate setting, issue file, updating utmp entries....</div>
<div><br></div><div>if this suits, can add to the tree.</div><div>Looking forward to your inputs.</div><div><br></div><div>regards,</div><div>Ashwini</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 19, 2013 at 12:49 PM, <span dir="ltr"><<a href="mailto:ibid.ag@gmail.com" target="_blank">ibid.ag@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here's a basic getty.<br>
It just reopens the current tty in such a way as to allow blocking code<br>
to work, then calls the login program of your choice (-l).<br>
/etc/issue is ignored, so -i is a nop.<br>
It does NOT modify the environment (including setting TERM), support<br>
baud rate setting or autodetection, do anything with modems, prompt for<br>
any user input, or open new ttys.<br>
Supporting<br>
getty ttyN $TERM<br>
should be something like this...<br>
char * prepend(char *arg, char *pfix)<br>
{<br>
if (!arg) return NULL;<br>
int alen = strlen(arg), plen = strlen(pfix);<br>
char * ret = xzalloc(alen + plen + 1);<br>
strcpy(ret, pfix);<br>
strcpy(ret+plen, arg);<br>
return ret;<br>
}<br>
<br>
<br>
char *tty = prepend(toys.optargs[0], "/dev/")<br>
if (!tty) tty = ttyname(0);<br>
if (toys.optc > 1) {<br>
char *termname = prepend(toys.optargs[1], "TERM=");<br>
if (termname) putenv(termname);<br>
}<br>
<br>
--<br>
With this, I can boot to a login prompt using only a shell and a toybox<br>
binary (with several pending applets enabled, and a hacked version of<br>
one of the many submissions for mount).<br>
<br>
I also have a small applet (resolve_modalias) that is mainly useful for<br>
testing, which I've sent a couple times to illustrate issues;<br>
maybe sometime I should see about putting the core code into a library<br>
function so modprobe and modinfo can share it....<br>
<br>
Thanks,<br>
Isaac Dunham<br>
<br>_______________________________________________<br>
Toybox mailing list<br>
<a href="mailto:Toybox@lists.landley.net">Toybox@lists.landley.net</a><br>
<a href="http://lists.landley.net/listinfo.cgi/toybox-landley.net" target="_blank">http://lists.landley.net/listinfo.cgi/toybox-landley.net</a><br>
<br></blockquote></div><br></div>