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

Diff for /src/usr.bin/radioctl/radioctl.c between version 1.8 and 1.9

version 1.8, 2002/01/22 22:09:28 version 1.9, 2004/08/08 00:21:55
Line 105 
Line 105 
 main(int argc, char **argv)  main(int argc, char **argv)
 {  {
         struct opt_t opt;          struct opt_t opt;
           char **avp;
   
         char *radiodev = NULL;          char *radiodev = NULL;
         int rd = -1;          int rd = -1;
         int optchar;          int optchar;
         int show_vars = 0;          int show_vars = 0;
         int set_param = 0;  
         int silent = 0;          int silent = 0;
         int mode = O_RDONLY;          int mode = O_RDONLY;
   
Line 133 
Line 133 
                         silent = 1;                          silent = 1;
                         break;                          break;
                 case 'w':                  case 'w':
                         set_param = 1;                          /* backwards compatibility */
                         mode = O_RDWR;  
                         break;                          break;
                 default:                  default:
                         usage();                          usage();
Line 145 
Line 144 
         argc -= optind;          argc -= optind;
         argv += optind;          argv += optind;
   
           /*
            * Scan the options for `name=value` so the
            * device can be opened in the proper mode.
            */
           for (avp = argv; *avp != NULL; avp++)
                   if (strchr(*avp, '=') != NULL) {
                           mode = O_RDWR;
                           break;
                   }
   
         rd = open(radiodev, mode);          rd = open(radiodev, mode);
         if (rd < 0)          if (rd < 0)
                 err(1, "%s open error", radiodev);                  err(1, "%s open error", radiodev);
Line 152 
Line 161 
         if (ioctl(rd, RIOCGINFO, &ri) < 0)          if (ioctl(rd, RIOCGINFO, &ri) < 0)
                 err(1, "RIOCGINFO");                  err(1, "RIOCGINFO");
   
         if (!argc && show_vars && !set_param)          if (!argc && show_vars)
                 print_vars(silent);                  print_vars(silent);
         else if (argc > 0 && !show_vars) {          else if (argc > 0 && !show_vars) {
                 if (set_param) {                  if (mode == O_RDWR) {
                         for(; argc--; argv++)                          for(; argc--; argv++)
                                 if (parse_opt(*argv, &opt))                                  if (parse_opt(*argv, &opt))
                                         do_ioctls(rd, &opt, silent);                                          do_ioctls(rd, &opt, silent);
Line 180 
Line 189 
 void  void
 usage(void)  usage(void)
 {  {
         fprintf(stderr, "usage:  %s [-f file] [-n] variable ...\n"          fprintf(stderr,
             "        %s [-f file] [-n] -w variable=value ...\n"              "usage:  %s [-f file] [-n] variable ...\n"
               "        %s [-f file] [-n] variable=value ...\n"
             "        %s [-f file] [-n] -a\n",              "        %s [-f file] [-n] -a\n",
             __progname, __progname, __progname);              __progname, __progname, __progname);
         exit(1);          exit(1);

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9