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

Diff for /src/usr.bin/aucat/aucat.c between version 1.112 and 1.113

version 1.112, 2011/04/27 21:20:36 version 1.113, 2011/04/28 06:19:57
Line 258 
Line 258 
   
 SLIST_HEAD(cfdevlist, cfdev);  SLIST_HEAD(cfdevlist, cfdev);
   
   /*
    * local network addresse to listen on
    */
   struct cfnet {
           SLIST_ENTRY(cfnet) entry;
           char *addr;
   };
   
   SLIST_HEAD(cfnetlist, cfnet);
   
 void  void
 cfdev_add(struct cfdevlist *list, struct cfdev *templ, char *path)  cfdev_add(struct cfdevlist *list, struct cfdev *templ, char *path)
 {  {
Line 318 
Line 328 
 }  }
   
 void  void
   cfnet_add(struct cfnetlist *list, char *addr)
   {
           struct cfnet *cn;
   
           cn = malloc(sizeof(struct cfnet));
           if (cn == NULL) {
                   perror("malloc");
                   abort();
           }
           cn->addr = addr;
           SLIST_INSERT_HEAD(list, cn, entry);
   }
   
   void
 setsig(void)  setsig(void)
 {  {
         struct sigaction sa;          struct sigaction sa;
Line 414 
Line 438 
 {  {
         (void)fputs("usage: " PROG_AUCAT " [-dlnu] [-a flag] [-b nframes] "          (void)fputs("usage: " PROG_AUCAT " [-dlnu] [-a flag] [-b nframes] "
             "[-C min:max] [-c min:max] [-e enc]\n\t"              "[-C min:max] [-c min:max] [-e enc]\n\t"
             "[-f device] [-h fmt] [-i file] [-j flag] [-m mode]"              "[-f device] [-h fmt] [-i file] [-j flag] [-L addr] [-m mode] "
             "[-o file] [-q device]\n\t"              "[-o file]\n\t"
             "[-r rate] [-s name] [-t mode] [-U unit] "              "[-q device] [-r rate] [-s name] [-t mode] [-U unit] "
             "[-v volume] [-x policy]\n\t"              "[-v volume]\n\t"
             "[-z nframes]\n",              "[-x policy] [-z nframes]\n",
             stderr);              stderr);
 }  }
   
Line 426 
Line 450 
 aucat_main(int argc, char **argv)  aucat_main(int argc, char **argv)
 {  {
         struct cfdevlist cfdevs;          struct cfdevlist cfdevs;
           struct cfnetlist cfnets;
         struct cfmid *cm;          struct cfmid *cm;
         struct cfstr *cs;          struct cfstr *cs;
         struct cfdev *cd;          struct cfdev *cd;
           struct cfnet *cn;
         int c, u_flag, d_flag, l_flag, n_flag, unit;          int c, u_flag, d_flag, l_flag, n_flag, unit;
         char base[PATH_MAX], path[PATH_MAX];          char base[PATH_MAX], path[PATH_MAX];
         unsigned mode, rate;          unsigned mode, rate;
Line 447 
Line 473 
         l_flag = 0;          l_flag = 0;
         n_flag = 0;          n_flag = 0;
         SLIST_INIT(&cfdevs);          SLIST_INIT(&cfdevs);
           SLIST_INIT(&cfnets);
         nfile = nsock = 0;          nfile = nsock = 0;
   
         /*          /*
Line 485 
Line 512 
         cd->round = 0;          cd->round = 0;
         cd->hold = 1;          cd->hold = 1;
   
         while ((c = getopt(argc, argv, "a:dnb:c:C:e:r:h:x:v:i:o:f:m:luq:s:U:t:j:z:")) != -1) {          while ((c = getopt(argc, argv, "a:dnb:c:C:e:r:h:x:v:i:o:f:m:luq:s:U:L:t:j:z:")) != -1) {
                 switch (c) {                  switch (c) {
                 case 'd':                  case 'd':
 #ifdef DEBUG  #ifdef DEBUG
Line 505 
Line 532 
                         if (str)                          if (str)
                                 errx(1, "%s: unit number is %s", optarg, str);                                  errx(1, "%s: unit number is %s", optarg, str);
                         break;                          break;
                   case 'L':
                           cfnet_add(&cfnets, optarg);
                           break;
                 case 'm':                  case 'm':
                         cs->mode = opt_mode();                          cs->mode = opt_mode();
                         cd->mode = cs->mode;                          cd->mode = cs->mode;
Line 766 
Line 796 
                 snprintf(path, sizeof(path), "%s/%s%u", base,                  snprintf(path, sizeof(path), "%s/%s%u", base,
                     AUCAT_PATH, unit);                      AUCAT_PATH, unit);
                 listen_new_un(path);                  listen_new_un(path);
                   while (!SLIST_EMPTY(&cfnets)) {
                           cn = SLIST_FIRST(&cfnets);
                           SLIST_REMOVE_HEAD(&cfnets, entry);
                           listen_new_tcp(cn->addr, AUCAT_PORT + unit);
                   }
         }          }
         if (geteuid() == 0)          if (geteuid() == 0)
                 privdrop();                  privdrop();
Line 825 
Line 860 
 midicat_usage(void)  midicat_usage(void)
 {  {
         (void)fputs("usage: " PROG_MIDICAT " [-dl] "          (void)fputs("usage: " PROG_MIDICAT " [-dl] "
             "[-i file] [-o file] [-q port] [-s name] [-U unit]\n",              "[-i file] [-L addr] [-o file] [-q port] [-s name] [-U unit]\n",
             stderr);              stderr);
 }  }
   
Line 833 
Line 868 
 midicat_main(int argc, char **argv)  midicat_main(int argc, char **argv)
 {  {
         struct cfdevlist cfdevs;          struct cfdevlist cfdevs;
           struct cfnetlist cfnets;
         struct cfmid *cm;          struct cfmid *cm;
         struct cfstr *cs;          struct cfstr *cs;
         struct cfdev *cd;          struct cfdev *cd;
           struct cfnet *cn;
         int c, d_flag, l_flag, unit, fd;          int c, d_flag, l_flag, unit, fd;
         char base[PATH_MAX], path[PATH_MAX];          char base[PATH_MAX], path[PATH_MAX];
         struct file *stdx;          struct file *stdx;
Line 852 
Line 889 
         d_flag = 0;          d_flag = 0;
         l_flag = 0;          l_flag = 0;
         SLIST_INIT(&cfdevs);          SLIST_INIT(&cfdevs);
           SLIST_INIT(&cfnets);
         nsock = 0;          nsock = 0;
   
         /*          /*
Line 910 
Line 948 
                         if (str)                          if (str)
                                 errx(1, "%s: unit number is %s", optarg, str);                                  errx(1, "%s: unit number is %s", optarg, str);
                         break;                          break;
                   case 'L':
                           cfnet_add(&cfnets, optarg);
                           break;
                 default:                  default:
                         midicat_usage();                          midicat_usage();
                         exit(1);                          exit(1);
Line 1033 
Line 1074 
                 snprintf(path, sizeof(path), "%s/%s%u", base,                  snprintf(path, sizeof(path), "%s/%s%u", base,
                     MIDICAT_PATH, unit);                      MIDICAT_PATH, unit);
                 listen_new_un(path);                  listen_new_un(path);
                   while (!SLIST_EMPTY(&cfnets)) {
                           cn = SLIST_FIRST(&cfnets);
                           SLIST_REMOVE_HEAD(&cfnets, entry);
                           listen_new_tcp(cn->addr, MIDICAT_PORT + unit);
                   }
         }          }
         if (geteuid() == 0)          if (geteuid() == 0)
                 privdrop();                  privdrop();

Legend:
Removed from v.1.112  
changed lines
  Added in v.1.113