[Toybox] [New toy] rudimentary getty

Ashwini Sharma ak.ashwini1981 at gmail.com
Thu Dec 19 00:52:37 PST 2013


Hi,

What a coincidence, even I was about to send getty implementation in this
forum.

Attached is a little largeish version of getty.
Supporting TERM settings, baud rate setting, issue file, updating utmp
entries....

if this suits, can add to the tree.
Looking forward to your inputs.

regards,
Ashwini


On Thu, Dec 19, 2013 at 12:49 PM, <ibid.ag at gmail.com> wrote:

> Here's a basic getty.
> It just reopens the current tty in such a way as to allow blocking code
> to work, then calls the login program of your choice (-l).
> /etc/issue is ignored, so -i is a nop.
> It does NOT modify the environment (including setting TERM), support
> baud rate setting or autodetection, do anything with modems, prompt for
> any user input, or open new ttys.
> Supporting
> getty ttyN $TERM
> should be something like this...
> char * prepend(char *arg, char *pfix)
> {
>   if (!arg) return NULL;
>   int alen = strlen(arg), plen = strlen(pfix);
>   char * ret = xzalloc(alen + plen + 1);
>   strcpy(ret, pfix);
>   strcpy(ret+plen, arg);
>   return ret;
> }
>
>
>   char *tty = prepend(toys.optargs[0], "/dev/")
>   if (!tty) tty = ttyname(0);
>   if (toys.optc > 1) {
>     char *termname = prepend(toys.optargs[1], "TERM=");
>     if (termname) putenv(termname);
>   }
>
> --
> With this, I can boot to a login prompt using only a shell and a toybox
> binary (with several pending applets enabled, and a hacked version of
> one of the many submissions for mount).
>
> I also have a small applet (resolve_modalias) that is mainly useful for
> testing, which I've sent a couple times to illustrate issues;
> maybe sometime I should see about putting the core code into a library
> function so modprobe and modinfo can share it....
>
> Thanks,
> Isaac Dunham
>
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20131219/09452123/attachment-0005.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: getty.c
Type: text/x-csrc
Size: 9935 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20131219/09452123/attachment-0006.c>


More information about the Toybox mailing list