Revision c6e4f54d src/dvbsched.cpp

View differences:

src/dvbsched.cpp
54 54
  bool convertToPS = false;
55 55
  int priority = 10;
56 56
  bool removeSpecified = false;
57
  bool noConflicts = false;
57 58
  int removeJob = -1;
58 59

  
59 60
  while (true) {
......
62 63
      {"socket", 1, 0, 's'},
63 64
      {"ps", 0, 0, 'P'},
64 65
      {"remove", 1, 0, 'r'},
66
      {"noconflicts", 0, 0, 'n'},
65 67
      {0, 0, 0, 0}
66 68
    };
67 69
 
......
83 85
      removeSpecified = true;
84 86
      removeJob = toInt(optarg);
85 87
      break;
88
    case 'n':
89
      noConflicts = true;
90
      break;
86 91
    default:
87 92
      usage(argv[0]);
88 93
      return 1;
......
138 143
    for (StringList::iterator i = messages.begin(); i != messages.end(); i++)
139 144
      std::cout << *i << "\n";
140 145

  
141
    std::cout << "Do you still wish to schedule the job?\n";
142

  
143
    char answer;
144
    while (std::cin >> answer) {
145
      switch (tolower(answer)) {
146
      case 'y':
147
	std::cout << "Job Scheduled\n";
148
	return 0;
149
      case 'n':
150
	client.removeJob(job);
151
	std::cout << "Job not scheduled.\n";
152
	return 0;
153
      default:
154
	std::cout << "Please answer Y or N\n";
155
	break;
146
    if (!noConflicts) {
147
      std::cout << "Do you still wish to schedule the job?\n";
148

  
149
      char answer;
150
      while (std::cin >> answer) {
151
	switch (tolower(answer)) {
152
	case 'y':
153
	  std::cout << "Job Scheduled\n";
154
	  return 0;
155
	case 'n':
156
	  client.removeJob(job);
157
	  std::cout << "Job not scheduled.\n";
158
	  return 0;
159
	default:
160
	  std::cout << "Please answer Y or N\n";
161
	  break;
162
	}
156 163
      }
157 164
    }
165
    else
166
      client.removeJob(job);
158 167
  }
159 168

  
160 169
}
......
189 198
	    << "  -r, --remove           Remove a job from the schedule\n"
190 199
	    << "  -s, --socket           Specify socket to connect to\n"
191 200
	    << "                         (default is " << DEFAULT_SOCKET_FILE << ")\n"
192
	    << "  -P, --ps               Convert stream to program stream\n";
201
	    << "  -P, --ps               Convert stream to program stream\n"
202
	    << "  -n, --noconflicts      Don't schedule if it makes a conflict\n";
193 203
}
194 204

  
195 205
// For parsetime

Also available in: Unified diff