X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=sympathy.git;a=blobdiff_plain;f=apps%2Fsympathy.c;h=4a9f18aa743dde3730367fec0e2a33f2116c72fb;hp=13b54ef7938ef242740409ebbb45bf9e35af7655;hb=95d068f1b4e8100d6501944eda3bd9ff73460514;hpb=82aed0c41cd917fdf9cdb20db788fe9da0662eba diff --git a/apps/sympathy.c b/apps/sympathy.c index 13b54ef..4a9f18a 100644 --- a/apps/sympathy.c +++ b/apps/sympathy.c @@ -11,6 +11,9 @@ static char rcsid[] = /* * $Log$ + * Revision 1.15 2008/02/27 01:31:14 james + * *** empty log message *** + * * Revision 1.14 2008/02/24 00:43:55 james * *** empty log message *** * @@ -239,6 +242,7 @@ main (int argc, char *argv[]) int c; extern char *optarg; extern int optind, opterr, optopt; + int width=VT102_COLS_80; int oflags[128]; char *oargs[128]; @@ -255,16 +259,7 @@ main (int argc, char *argv[]) memset (oflags, 0, sizeof (oflags)); memset (oargs, 0, sizeof (oargs)); -#if 0 - "sympathy -t [-K] [-d serialdev|-p] [-b baud] [-f] [-L log]\n" - "sympathy -s [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-F] [-k skt]\n" - " [-n hlines]\n" - "sympathy [-s -c] [-K] [-d serialdev|-p] [-b baud] [-f] [-L log] [-k skt]\n" - " [-n hlines]\n" - "sympathy -c [-H] -k skt\n" - "sympathy -r id [-H]\n" "sympathy {-l|-ls}\n" -#endif - while ((c = getopt (argc, argv, "utscr:lKHd:pb:fL:Fk:n:")) != EOF) + while ((c = getopt (argc, argv, "w:utscr:lKHd:pb:fL:Fk:n:")) != EOF) { switch (c) { @@ -397,6 +392,7 @@ main (int argc, char *argv[]) oflags['f'] = 0; oflags['L'] = 0; oflags['n'] = 0; + oflags['w'] = 0; if (server_socket) { socket_free_parent (server_socket); @@ -405,6 +401,7 @@ main (int argc, char *argv[]) } } + if (oflags['c'] && !oflags['k']) fatal_moan ("-c requires a socket to be specified with -s or -k"); @@ -418,6 +415,12 @@ main (int argc, char *argv[]) oflags['p']++; } + if (oflags['w']) { + width=safe_atoi(oargs['w']); + if ((width>VT102_MAX_COLS) || (width<1)) + fatal_moan("-w requires a width between 1 and %d\n",VT102_MAX_COLS); + } + if (oflags['s'] && !oflags['F']) { daemon (1, 0); /*incase socket is relative path, unlink then will fail */ @@ -436,7 +439,7 @@ main (int argc, char *argv[]) if (oflags['p']) { - tty = ptty_open (NULL, NULL); + tty = ptty_open (NULL, NULL, width); if (!tty) fatal_moan ("unable to open a ptty"); } @@ -493,7 +496,7 @@ main (int argc, char *argv[]) } } - mainloop (tty, server_socket, client_socket, ansi, log, history); + mainloop (tty, server_socket, client_socket, ansi, log, history,width); if (ansi) {