/[inetutils]/inetutils/ftp/main.c
ViewVC logotype

Diff of /inetutils/ftp/main.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by gray, Thu Sep 8 11:02:55 2005 UTC revision 1.21 by gray, Tue Oct 11 11:16:13 2005 UTC
# Line 46  static char sccsid[] = "@(#)main.c     8.6 ( Line 46  static char sccsid[] = "@(#)main.c     8.6 (
46  #include <arpa/ftp.h>  #include <arpa/ftp.h>
47    
48  #include <ctype.h>  #include <ctype.h>
49  #include <err.h>  #include <error.h>
50  #include <netdb.h>  #include <netdb.h>
51  #include <pwd.h>  #include <pwd.h>
52  #include <signal.h>  #include <signal.h>
# Line 121  main (int argc, char *argv[]) Line 121  main (int argc, char *argv[])
121    
122    sp = getservbyname ("ftp", "tcp");    sp = getservbyname ("ftp", "tcp");
123    if (sp == 0)    if (sp == 0)
124      errx (1, "ftp/tcp: unknown service");      error (1, 0, "ftp/tcp: unknown service");
125    doglob = 1;    doglob = 1;
126    interactive = 1;    interactive = 1;
127    autologin = 1;    autologin = 1;
# Line 213  main (int argc, char *argv[]) Line 213  main (int argc, char *argv[])
213    
214        if (setjmp (toplevel))        if (setjmp (toplevel))
215          exit (0);          exit (0);
216        (void) signal(SIGINT, intr);        signal(SIGINT, intr);
217        (void) signal(SIGPIPE, lostpeer);        signal(SIGPIPE, lostpeer);
218        xargv[0] = __progname;        xargv[0] = __progname;
219        xargv[1] = argv[0];        xargv[1] = argv[0];
220        xargv[2] = argv[1];        xargv[2] = argv[1];
# Line 225  main (int argc, char *argv[]) Line 225  main (int argc, char *argv[])
225    top = setjmp (toplevel) == 0;    top = setjmp (toplevel) == 0;
226    if (top)    if (top)
227      {      {
228        (void) signal (SIGINT, intr);        signal (SIGINT, intr);
229        (void) signal (SIGPIPE, lostpeer);        signal (SIGPIPE, lostpeer);
230      }      }
231    for (;;)    for (;;)
232      {      {
# Line 235  main (int argc, char *argv[]) Line 235  main (int argc, char *argv[])
235      }      }
236  }  }
237    
238  void  RETSIGTYPE
239  intr (int sig)  intr (int sig ARG_UNUSED)
240  {  {
241    longjmp (toplevel, 1);    longjmp (toplevel, 1);
242  }  }
243    
244  void  RETSIGTYPE
245  lostpeer (int sig)  lostpeer (int sig ARG_UNUSED)
246  {  {
247    if (connected)    if (connected)
248      {      {
249        if (cout != NULL)        if (cout != NULL)
250          {          {
251            (void) shutdown (fileno (cout), 1+1);            shutdown (fileno (cout), 1+1);
252            (void) fclose (cout);            fclose (cout);
253            cout = NULL;            cout = NULL;
254          }          }
255        if (data >= 0)        if (data >= 0)
256          {          {
257            (void) shutdown (data, 1+1);            shutdown (data, 1+1);
258            (void) close (data);            close (data);
259            data = -1;            data = -1;
260          }          }
261        connected = 0;        connected = 0;
# Line 265  lostpeer (int sig) Line 265  lostpeer (int sig)
265      {      {
266        if (cout != NULL)        if (cout != NULL)
267          {          {
268            (void) shutdown (fileno(cout), 1+1);            shutdown (fileno(cout), 1+1);
269            (void) fclose (cout);            fclose (cout);
270            cout = NULL;            cout = NULL;
271          }          }
272        connected = 0;        connected = 0;
# Line 304  cmdscanner (int top) Line 304  cmdscanner (int top)
304    int l;    int l;
305    
306    if (!top)    if (!top)
307      (void) putchar ('\n');      putchar ('\n');
308    for (;;)    for (;;)
309      {      {
310    
# Line 375  cmdscanner (int top) Line 375  cmdscanner (int top)
375          }          }
376        (*c->c_handler) (margc, margv);        (*c->c_handler) (margc, margv);
377        if (bell && c->c_bell)        if (bell && c->c_bell)
378          (void) putchar('\007');          putchar('\007');
379        if (c->c_handler != help)        if (c->c_handler != help)
380          break;          break;
381      }      }
382    (void) signal (SIGINT, intr);    signal (SIGINT, intr);
383    (void) signal (SIGPIPE, lostpeer);    signal (SIGPIPE, lostpeer);
384  }  }
385    
386  /*  /*

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26