On Saturday 19 June 2010 16:11, Pascal Bellard wrote:
> Hello,
>
> Please find attached a patch to add the conspy applet.
> A text-mode VNC like, a poor man's GNU screen like and a screenshot
> utility in 3Kb.
+//usage:#define conspy_trivial_usage
+//usage: "[-vcsndf] [-x rows] [-y lines] [virtual_console]"
+//usage:#define conspy_full_usage "\n\n"
+//usage: "A text-mode VNC like program for Linux virtual terminals.\n"
+//usage: "\nTo exit, quickly press escape 3 times.\n"
+//usage: "\nvirtual_console:\n"
+//usage: " omitted Track the current console.\n"
+//usage: " 1..63 Virtual console N.\n"
+//usage: "\nOptions:"
+//usage: "\n -v Don't send keystrokes to the console."
+//usage: "\n -c May create device in /dev."
what does it mean "may"?
+//usage: "\n -s Open a SHELL session."
+//usage: "\n -n No colors. Black & white only."
+//usage: "\n -d Dump console to stdout."
+//usage: "\n -f Follow cursor."
+//usage: "\n -x r Skip the r first rows."
+//usage: "\n -y l Skip the l first lines."
Please convert to using tabs to make help text smaller.
Do not use periods at the end of option description.
Shorten text where feasible: "No colors. Black & white only" -> "Black & white".
Use upper case for variables: rows -> ROWS,
virtual_console -> VIRTUAL_CONSOLE_NO (by adding _NO, you
make it more obvious and thus you can remove help text about it).
+#define CHAR(x) ((x)[0])
+#define ATTR(x) ((x)[1])
+#define NEXT(x) ((x)+=2)
+#define DATA(x) (* (short *) (x))
This is caused by inconsistent space/tab usage. Use spaces
(tabs are used for _initial_ indent only).
+ int pid = vfork();
+
+ if (pid < 0) {
+ bb_perror_msg_and_die("vfork");
+ }
+ else if (pid == 0) { /* make tty to be input, output, error */
can drop "else" here
+ struct termios termchild;
+ char *shell = getenv("SHELL");
+
+ if (shell == NULL) {
+ shell = (char *) DEFAULT_SHELL;
+ }
+ bb_signals((1 << SIGCHLD) + (1 << SIGPIPE), SIG_DFL);
why?
+ signal(SIGHUP, SIG_IGN);
+ /* set tty as a controlling tty */
+ setsid();
+ /* open tty to fd 0,1,2 */
+ close(0);
+ xopen(tty_name, O_RDWR); /* uses fd 0 */
+ xdup2(0, 1);
+ xdup2(0, 2);
+ ioctl(0, TIOCSCTTY, 1);
+ tcsetpgrp(0, getpid());
+ tcgetattr(0, &termchild);
+ termchild.c_lflag |= ECHO;
+ termchild.c_oflag |= ONLCR | XTABS;
+ termchild.c_iflag |= ICRNL;
+ termchild.c_iflag &= ~IXOFF;
+ tcsetattr_stdin_TCSANOW(&termchild);
+ execl(shell, shell, "-i", (char *) NULL, (char *) NULL);
why two NULLs?
+ bb_simple_perror_msg_and_die(shell);
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox