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

Diff for /src/usr.bin/mixerctl/mixerctl.c between version 1.21 and 1.22

version 1.21, 2005/05/09 13:23:35 version 1.22, 2005/10/01 17:07:26
Line 132 
Line 132 
                         printf("%d", m->un.value.level[0]);                          printf("%d", m->un.value.level[0]);
                 else                  else
                         printf("%d,%d", m->un.value.level[0],                          printf("%d,%d", m->un.value.level[0],
                                m->un.value.level[1]);                              m->un.value.level[1]);
                 if (prvalset)                  if (prvalset)
                         printf(" %s", p->infp->un.v.units.name);                          printf(" %s", p->infp->un.v.units.name);
                 break;                  break;
Line 181 
Line 181 
   
         switch (m->type) {          switch (m->type) {
         case AUDIO_MIXER_ENUM:          case AUDIO_MIXER_ENUM:
                   if (strcmp(q, "toggle") == 0) {
                           for (i = 0; i < p->infp->un.e.num_mem; i++) {
                                   if (m->un.ord == p->infp->un.e.member[i].ord)
                                           break;
                           }
                           if (i < p->infp->un.e.num_mem)
                                   i++;
                           else
                                   i = 0;
                           m->un.ord = p->infp->un.e.member[i].ord;
                           break;
                   }
                 for (i = 0; i < p->infp->un.e.num_mem; i++)                  for (i = 0; i < p->infp->un.e.num_mem; i++)
                         if (strcmp(p->infp->e_member_name, q) == 0)                          if (strcmp(p->infp->e_member_name, q) == 0)
                                 break;                                  break;
                 if (i < p->infp->un.e.num_mem)                  if (i < p->infp->un.e.num_mem)
                         m->un.ord = p->infp->un.e.member[i].ord;                          m->un.ord = p->infp->un.e.member[i].ord;
                 else                  else
                         errx(1, "Bad enum value %s", q);                          errx(1, "Bad enum value %s", q);
                 break;                  break;
         case AUDIO_MIXER_SET:          case AUDIO_MIXER_SET:
                 mask = 0;                  mask = 0;
Line 200 
Line 212 
                         if (i < p->infp->un.s.num_mem)                          if (i < p->infp->un.s.num_mem)
                                 mask |= p->infp->un.s.member[i].mask;                                  mask |= p->infp->un.s.member[i].mask;
                         else                          else
                                 errx(1, "Bad set value %s", q);                                  errx(1, "Bad set value %s", q);
                 }                  }
                 m->un.mask = mask;                  m->un.mask = mask;
                 break;                  break;
Line 238 
Line 250 
 main(int argc, char **argv)  main(int argc, char **argv)
 {  {
         int fd, i, j, ch, pos;          int fd, i, j, ch, pos;
         int aflag = 0, qflag = 0, vflag = 0;          int aflag = 0, qflag = 0, vflag = 0, tflag = 0;
         char *file;          char *file;
         char *sep = "=";          char *sep = "=";
         mixer_devinfo_t dinfo;          mixer_devinfo_t dinfo;
         int ndev;          int ndev;
   
         if ((file = getenv("MIXERDEVICE")) == 0 || *file == '\0')          if ((file = getenv("MIXERDEVICE")) == 0 || *file == '\0')
                 file = "/dev/mixer";                  file = "/dev/mixer";
   
         while ((ch = getopt(argc, argv, "af:nqvw")) != -1) {          while ((ch = getopt(argc, argv, "af:nqtvw")) != -1) {
                 switch(ch) {                  switch(ch) {
                 case 'a':                  case 'a':
                         aflag++;                          aflag++;
Line 267 
Line 279 
                 case 'q':                  case 'q':
                         qflag = 1;                          qflag = 1;
                         break;                          break;
                   case 't':
                           tflag = 1;
                           break;
                 case '?':                  case '?':
                 default:                  default:
                         usage();                          usage();
Line 363 
Line 378 
   
                         if ((p = findfield(*argv)) == NULL) {                          if ((p = findfield(*argv)) == NULL) {
                                 warnx("field %s does not exist", *argv);                                  warnx("field %s does not exist", *argv);
                         } else if (ch) {                          } else if (ch || tflag) {
                                   if (tflag && q == NULL)
                                           q = "toggle";
                                 rdfield(fd, p, q, qflag);                                  rdfield(fd, p, q, qflag);
                         } else {                          } else {
                                 prfield(p, sep, vflag);                                  prfield(p, sep, vflag);
Line 385 
Line 402 
         fprintf(stderr,          fprintf(stderr,
             "usage: %s [-nv] [-f file] -a\n"              "usage: %s [-nv] [-f file] -a\n"
             "       %s [-nv] [-f file] name [...]\n"              "       %s [-nv] [-f file] name [...]\n"
               "       %s [-qt] [-f file] name [...]\n"
             "       %s [-q]  [-f file] name=value [...]\n",              "       %s [-q]  [-f file] name=value [...]\n",
             __progname, __progname, __progname);              __progname, __progname, __progname);
   

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