[BACK]Return to cmds.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tip

Diff for /src/usr.bin/tip/Attic/cmds.c between version 1.23 and 1.24

version 1.23, 2006/03/16 21:13:12 version 1.24, 2006/03/17 14:43:06
Line 54 
Line 54 
 char    *sep[] = { "second", "minute", "hour" };  char    *sep[] = { "second", "minute", "hour" };
 static char *argv[10];          /* argument vector for take and put */  static char *argv[10];          /* argument vector for take and put */
   
 void    timeout(int);           /* timeout function called on alarm */  static void     transfer(char *, int, char *);
 void    stopsnd(int);           /* SIGINT handler during file transfers */  static void     stopsnd(int);   /* SIGINT handler during file transfers */
 void    intcopy(int);           /* interrupt routine for file transfers */  static void     intcopy(int);   /* interrupt routine for file transfers */
   static void     transmit(FILE *, char *, char *);
   static void     send(int);
   static void     execute(char *);
   static int      args(char *, char **, int);
   static void     prtime(char *, time_t);
   static void     tandem(char *);
   static void     hardwareflow(char *);
   static int      anyof(char *, char *);
   
 /*  /*
  * FTP - remote ==> local   * FTP - remote ==> local
  *  get a file from the remote host   *  get a file from the remote host
  */   */
 void  void
 getfl(char c)  getfl(int c)
 {  {
         char buf[256], *cp, *expand(char *);          char buf[256], *cp;
   
         putchar(c);          putchar(c);
         /*          /*
Line 93 
Line 101 
  * Cu-like take command   * Cu-like take command
  */   */
 void  void
 cu_take(char cc)  cu_take(int c)
 {  {
         int fd, argc;          int fd, argc;
         char line[BUFSIZ], *expand(char *), *cp;          char line[BUFSIZ], *cp;
   
         if (prompt("[take] ", copyname, sizeof(copyname)))          if (prompt("[take] ", copyname, sizeof(copyname)))
                 return;                  return;
Line 122 
Line 130 
  * Bulk transfer routine --   * Bulk transfer routine --
  *  used by getfl(), cu_take(), and pipefile()   *  used by getfl(), cu_take(), and pipefile()
  */   */
 void  static void
 transfer(char *buf, int fd, char *eofchars)  transfer(char *buf, int fd, char *eofchars)
 {  {
         int ct;          int ct;
Line 196 
Line 204 
  * FTP - remote ==> local process   * FTP - remote ==> local process
  *   send remote input to local process via pipe   *   send remote input to local process via pipe
  */   */
   /*ARGSUSED*/
 void  void
 pipefile(void)  pipefile(int c)
 {  {
         int pdes[2];          int pdes[2];
         char buf[256];          char buf[256];
Line 244 
Line 253 
  * Interrupt service routine for FTP   * Interrupt service routine for FTP
  */   */
 /*ARGSUSED*/  /*ARGSUSED*/
 void  static void
 stopsnd(int signo)  stopsnd(int signo)
 {  {
   
         stop = 1;          stop = 1;
         signal(SIGINT, SIG_IGN);          signal(SIGINT, SIG_IGN);
 }  }
Line 258 
Line 266 
  *  terminate transmission with pseudo EOF sequence   *  terminate transmission with pseudo EOF sequence
  */   */
 void  void
 sendfile(char cc)  sendfile(int c)
 {  {
         FILE *fp;          FILE *fp;
         char *fnamex;          char *fnamex;
         char *expand(char *);  
   
         putchar(cc);          putchar(c);
         /*          /*
          * get file name           * get file name
          */           */
Line 288 
Line 295 
  * Bulk transfer routine to remote host --   * Bulk transfer routine to remote host --
  *   used by sendfile() and cu_put()   *   used by sendfile() and cu_put()
  */   */
 void  static void
 transmit(FILE *fp, char *eofchars, char *command)  transmit(FILE *fp, char *eofchars, char *command)
 {  {
         char *pc, lastc;          char *pc, lastc;
Line 384 
Line 391 
 /*  /*
  * Cu-like put command   * Cu-like put command
  */   */
   /*ARGSUSED*/
 void  void
 cu_put(char cc)  cu_put(int c)
 {  {
         FILE *fp;          FILE *fp;
         char line[BUFSIZ];          char line[BUFSIZ];
         int argc;          int argc;
         char *expand(char *);  
         char *copynamex;          char *copynamex;
   
         if (prompt("[put] ", copyname, sizeof(copyname)))          if (prompt("[put] ", copyname, sizeof(copyname)))
Line 419 
Line 426 
  * FTP - send single character   * FTP - send single character
  *  wait for echo & handle timeout   *  wait for echo & handle timeout
  */   */
 void  static void
 send(int c)  send(int c)
 {  {
         char cc;          char cc;
Line 562 
Line 569 
 /*  /*
  * Escape to local shell   * Escape to local shell
  */   */
   /*ARGSUSED*/
 void  void
 shell(void)  shell(int c)
 {  {
         int status;          int status;
         char *cp;          char *cp;
Line 621 
Line 629 
  * Change current working directory of   * Change current working directory of
  *   local portion of tip   *   local portion of tip
  */   */
   /*ARGSUSED*/
 void  void
 chdirectory(void)  chdirectory(int c)
 {  {
         char dirname[PATH_MAX];          char dirname[PATH_MAX];
         char *cp = dirname;          char *cp = dirname;
Line 653 
Line 662 
         exit(0);          exit(0);
 }  }
   
   /*ARGSUSED*/
 void  void
 finish(void)  finish(int c)
 {  {
         char *dismsg;          char *dismsg;
   
Line 665 
Line 675 
         tipabort(NOSTR);          tipabort(NOSTR);
 }  }
   
 void  static void
 intcopy(int signo)  intcopy(int signo)
 {  {
         raw();          raw();
Line 673 
Line 683 
         longjmp(intbuf, 1);          longjmp(intbuf, 1);
 }  }
   
 void  static void
 execute(char *s)  execute(char *s)
 {  {
         char *cp;          char *cp;
Line 686 
Line 696 
         execl(value(SHELL), cp, "-c", s, (char *)NULL);          execl(value(SHELL), cp, "-c", s, (char *)NULL);
 }  }
   
 int  static int
 args(char *buf, char *a[], int num)  args(char *buf, char *a[], int num)
 {  {
         char *p = buf, *start;          char *p = buf, *start;
Line 710 
Line 720 
         return(n);          return(n);
 }  }
   
 void  static void
 prtime(char *s, time_t a)  prtime(char *s, time_t a)
 {  {
         int i;          int i;
Line 728 
Line 738 
         printf("\r\n!\r\n");          printf("\r\n!\r\n");
 }  }
   
   /*ARGSUSED*/
 void  void
 variable(void)  variable(int c)
 {  {
         char    buf[256];          char    buf[256];
   
Line 779 
Line 790 
         }          }
 }  }
   
   /*ARGSUSED*/
 void  void
 listvariables(void)  listvariables(int c)
 {  {
         value_t *p;          value_t *p;
         char buf[BUFSIZ];          char buf[BUFSIZ];
Line 816 
Line 828 
 /*  /*
  * Turn tandem mode on or off for remote tty.   * Turn tandem mode on or off for remote tty.
  */   */
 void  static void
 tandem(char *option)  tandem(char *option)
 {  {
         struct termios  rmtty;          struct termios  rmtty;
Line 836 
Line 848 
 /*  /*
  * Turn hardware flow control on or off for remote tty.   * Turn hardware flow control on or off for remote tty.
  */   */
 void  static void
 hardwareflow(char *option)  hardwareflow(char *option)
 {  {
         struct termios  rmtty;          struct termios  rmtty;
Line 852 
Line 864 
 /*  /*
  * Send a break.   * Send a break.
  */   */
   /*ARGSUSED*/
 void  void
 genbrk(void)  genbrk(int c)
 {  {
   
         ioctl(FD, TIOCSBRK, NULL);          ioctl(FD, TIOCSBRK, NULL);
         sleep(1);          sleep(1);
         ioctl(FD, TIOCCBRK, NULL);          ioctl(FD, TIOCCBRK, NULL);
Line 865 
Line 877 
  * Suspend tip   * Suspend tip
  */   */
 void  void
 suspend(char c)  suspend(int c)
 {  {
   
         unraw();          unraw();
         kill(c == CTRL('y') ? getpid() : 0, SIGTSTP);          kill(c == CTRL('y') ? getpid() : 0, SIGTSTP);
         raw();          raw();
Line 876 
Line 887 
 /*  /*
  *      expand a file name if it includes shell meta characters   *      expand a file name if it includes shell meta characters
  */   */
   
 char *  char *
 expand(char name[])  expand(char name[])
 {  {
Line 947 
Line 957 
 /*  /*
  * Are any of the characters in the two strings the same?   * Are any of the characters in the two strings the same?
  */   */
 int  static int
 anyof(char *s1, char *s2)  anyof(char *s1, char *s2)
 {  {
         int c;          int c;

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24