Switch to unified view

a/scctl_src/scctl.cpp b/scctl_src/scctl.cpp
...
...
68
#define OPT_m 0x20
68
#define OPT_m 0x20
69
#define OPT_p 0x40
69
#define OPT_p 0x40
70
#define OPT_r 0x80
70
#define OPT_r 0x80
71
#define OPT_s 0x100
71
#define OPT_s 0x100
72
#define OPT_x 0x200
72
#define OPT_x 0x200
73
#define OPT_i 0x400
74
#define OPT_I 0x800
73
75
74
static const string sep("||");
76
static const string sep("||");
75
77
76
string showReceivers(int ops)
78
string showReceivers(int ops)
77
{
79
{
...
...
122
" -l List renderers with Songcast Receiver capability\n"
124
" -l List renderers with Songcast Receiver capability\n"
123
" -L List Songcast Senders\n"
125
" -L List Songcast Senders\n"
124
"   -m : for above modes: use parseable format\n"
126
"   -m : for above modes: use parseable format\n"
125
"For the following options the renderers can be designated by their \n"
127
"For the following options the renderers can be designated by their \n"
126
"uid (safer) or friendly name\n"
128
"uid (safer) or friendly name\n"
129
" -i <renderer> i : set source index\n"
130
" -I <renderer> name : set source index by name\n"
127
" -s <master> <slave> [slave ...] : Set up the slaves renderers as Songcast\n"
131
" -s <master> <slave> [slave ...] : Set up the slaves renderers as Songcast\n"
128
"    Receivers and make them play from the same uri as the master receiver\n"
132
"    Receivers and make them play from the same uri as the master receiver\n"
129
" -x <renderer> [renderer ...] Reset renderers from Songcast to Playlist\n"
133
" -x <renderer> [renderer ...] Reset renderers from Songcast to Playlist\n"
130
" -r <sender> <renderer> <renderer> : set up the renderers in Receiver mode\n"
134
" -r <sender> <renderer> <renderer> : set up the renderers in Receiver mode\n"
131
"    playing data from the sender. This is like -s but we get the uri from \n"
135
"    playing data from the sender. This is like -s but we get the uri from \n"
...
...
155
int main(int argc, char *argv[])
159
int main(int argc, char *argv[])
156
{
160
{
157
    thisprog = argv[0];
161
    thisprog = argv[0];
158
162
159
    int ret;
163
    int ret;
160
    while ((ret = getopt(argc, argv, "fhmLlrsSx")) != -1) {
164
    while ((ret = getopt(argc, argv, "fhmLlrsSxiI")) != -1) {
161
        switch (ret) {
165
        switch (ret) {
162
        case 'f': op_flags |= OPT_f; break;
166
        case 'f': op_flags |= OPT_f; break;
163
        case 'h': Usage(stdout); break;
167
        case 'h': Usage(stdout); break;
164
        case 'l':
168
        case 'l':
165
            op_flags |= OPT_l;
169
            op_flags |= OPT_l;
...
...
180
            op_flags |= OPT_S;
184
            op_flags |= OPT_S;
181
            break;
185
            break;
182
        case 'x':
186
        case 'x':
183
            op_flags |= OPT_x;
187
            op_flags |= OPT_x;
184
            break;
188
            break;
189
        case 'i':
190
            op_flags |= OPT_i;
191
            break;
192
        case 'I':
193
            op_flags |= OPT_I;
194
            break;
185
        default: Usage();
195
        default: Usage();
186
        }
196
        }
187
    }
197
    }
188
    //fprintf(stderr, "argc %d optind %d flgs: 0x%x\n", argc, optind, op_flags);
198
    //fprintf(stderr, "argc %d optind %d flgs: 0x%x\n", argc, optind, op_flags);
189
199
...
...
237
                                                         args.end()));
247
                                                         args.end()));
238
    } else if ((op_flags & OPT_x)) {
248
    } else if ((op_flags & OPT_x)) {
239
        if (args.size() < 1)
249
        if (args.size() < 1)
240
            Usage();
250
            Usage();
241
        stopReceivers(args);
251
        stopReceivers(args);
252
    } else if ((op_flags & OPT_i)) {
253
        if (args.size() < 2)
254
            Usage();
255
        setSourceIndex(args[0], std::stoi(args[1]));
256
    } else if ((op_flags & OPT_I)) {
257
        if (args.size() < 2)
258
            Usage();
259
        setSourceIndexByName(args[0], args[1]);
242
    } else if ((op_flags & OPT_S)) {
260
    } else if ((op_flags & OPT_S)) {
243
        exit(runserver());
261
        exit(runserver());
244
    } else {
262
    } else {
245
        Usage();
263
        Usage();
246
    }
264
    }