2 * Dolda Connect - Modular multiuser Direct Connect-style client
3 * Copyright (C) 2007 Fredrik Tolf (fredrik@dolda2000.com)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include <doldaconnect/uilib.h>
31 #include <doldaconnect/uimisc.h>
32 #include <doldaconnect/utils.h>
37 int main(int argc, char **argv)
48 server = username = NULL;
49 authless = authia = 1;
50 while((c = getopt(argc, argv, "hvIAs:u:")) != -1) {
68 fprintf(stderr, "usage: dcsh [-AIhv] [-s SERVER] [-u USERNAME]\n");
75 fprintf(stderr, "connecting...\n");
76 if((dcfd = dc_connectsync2(server, 1)) < 0) {
77 perror("dcsh: could not connect to server");
81 fprintf(stderr, "authenticating...\n");
82 if(dc_login(username, authless, authia?dc_convtty:dc_convnone, NULL) != DC_LOGIN_ERR_SUCCESS) {
83 fprintf(stderr, "dcsh: authentication unsuccessful\n");
87 fprintf(stderr, "done\n");
92 pfd[0].events = POLLIN;
94 pfd[0].events |= POLLOUT;
96 pfd[1].events = POLLIN;
98 if(poll(pfd, (cmddata < sizeof(cmdbuf)) ? 2 : 1, -1) < 0) {
100 perror("dcsh: poll");