Ticket #5935: 00-5935-mythbackend-showusage.patch

File 00-5935-mythbackend-showusage.patch, 6.1 KB (added by Matthew Wire <devel@…>, 15 years ago)
  • mythtv/programs/mythbackend/main.cpp

     
    431431    };
    432432}
    433433
     434void showUsage(const MythCommandLineParser &cmdlineparser)
     435{
     436    QString    help  = cmdlineparser.GetHelpString(false);
     437    QByteArray ahelp = help.toLocal8Bit();
     438
     439    cerr << "Valid options are: " << endl <<
     440    "-h or --help                   List valid command line parameters" << endl <<
     441    "-l or --logfile filename       Writes STDERR and STDOUT messages to filename" << endl <<
     442    "-p or --pidfile filename       Write PID of mythbackend to filename" << endl <<
     443    "-d or --daemon                 Runs mythbackend as a daemon" << endl <<
     444    "-v or --verbose debug-level    Use '-v help' for level info" << endl <<
     445    "--printexpire                  List of auto-expire programs" << endl <<
     446    "--printsched                   Upcoming scheduled programs" << endl <<
     447    "--testsched                    Test run scheduler (ignore existing schedule)" << endl <<
     448    "--resched                      Force the scheduler to update" << endl <<
     449    "--nosched                      Do not perform any scheduling" << endl <<
     450    "--noupnp                       Do not enable the UPNP server" << endl <<
     451    "--nojobqueue                   Do not start the JobQueue" << endl <<
     452    "--nohousekeeper                Do not start the Housekeeper" << endl <<
     453    "--noautoexpire                 Do not start the AutoExpire thread" << endl <<
     454    "--clearcache                   Clear the settings cache on all myth servers" << endl <<
     455    ahelp.constData() <<
     456    "--generate-preview             Generate a preview image" << endl <<
     457    "--upnprebuild                  Force an update of UPNP media" << endl <<
     458    "--infile                       Input file for preview generation" << endl <<
     459    "--outfile                      Optional output file for preview generation" << endl <<
     460    "--chanid                       Channel ID for preview generation" << endl <<
     461    "--starttime                    Recording start time for preview generation" << endl
     462    << endl;
     463
     464}
     465
    434466int main(int argc, char **argv)
    435467{
    436468    bool cmdline_err;
     
    485517    QString printexpire = "";
    486518    bool clearsettingscache = false;
    487519    bool wantupnprebuild = false;
     520   
     521    extern const char *myth_source_version;
     522    extern const char *myth_source_path;
    488523
     524    VERBOSE(VB_IMPORTANT, QString("%1 version: %2 [%3] www.mythtv.org")
     525                            .arg(binname)
     526                            .arg(myth_source_path)
     527                            .arg(myth_source_version));
     528
    489529    for (int argpos = 1; argpos < a.argc(); ++argpos)
    490530    {
    491531        if (!strcmp(a.argv()[argpos],"-l") ||
     
    682722        }
    683723        else
    684724        {
    685             QString    help  = cmdline.GetHelpString(false);
    686             QByteArray ahelp = help.toLocal8Bit();
    687725            if (!(!strcmp(a.argv()[argpos],"-h") ||
    688726                !strcmp(a.argv()[argpos],"--help")))
    689727                cerr << "Invalid argument: " << a.argv()[argpos] << endl;
    690             cerr << "Valid options are: " << endl <<
    691                     "-h or --help                   List valid command line parameters" << endl <<
    692                     "-l or --logfile filename       Writes STDERR and STDOUT messages to filename" << endl <<
    693                     "-p or --pidfile filename       Write PID of mythbackend " <<
    694                                                     "to filename" << endl <<
    695                     "-d or --daemon                 Runs mythbackend as a daemon" << endl <<
    696                     "-v or --verbose debug-level    Use '-v help' for level info" << endl <<
    697                     "--printexpire                  List of auto-expire programs" << endl <<
    698                     "--printsched                   Upcoming scheduled programs" << endl <<
    699                     "--testsched                    Test run scheduler (ignore existing schedule)" << endl <<
    700                     "--resched                      Force the scheduler to update" << endl <<
    701                     "--nosched                      Do not perform any scheduling" << endl <<
    702                     "--noupnp                       Do not enable the UPNP server" << endl <<
    703                     "--nojobqueue                   Do not start the JobQueue" << endl <<
    704                     "--nohousekeeper                Do not start the Housekeeper" << endl <<
    705                     "--noautoexpire                 Do not start the AutoExpire thread" << endl <<
    706                     "--clearcache                   Clear the settings cache on all myth servers" << endl <<
    707                 ahelp.constData() <<
    708                     "--generate-preview             Generate a preview image" << endl <<
    709                     "--upnprebuild                  Force an update of UPNP media" << endl <<
    710                     "--infile                       Input file for preview generation" << endl <<
    711                     "--outfile                      Optional output file for preview generation" << endl <<
    712                     "--chanid                       Channel ID for preview generation" << endl <<
    713                     "--starttime                    Recording start time for preview generation" << endl;
     728                showUsage(cmdline);
    714729            return BACKEND_EXIT_INVALID_CMDLINE;
    715730        }
    716731    }
     
    765780        pidfs.close();
    766781    }
    767782
    768     extern const char *myth_source_version;
    769     extern const char *myth_source_path;
    770 
    771     VERBOSE(VB_IMPORTANT, QString("%1 version: %2 [%3] www.mythtv.org")
    772                             .arg(binname)
    773                             .arg(myth_source_path)
    774                             .arg(myth_source_version));
    775 
    776783    gContext = new MythContext(MYTH_BINARY_VERSION);
    777784    if (!gContext->Init(false))
    778785    {
     
    10481055        {
    10491056            VERBOSE(VB_IMPORTANT, "Waking slave Backends now.");
    10501057            QByteArray tmp = WOLslaveBackends.toAscii();
    1051             system(tmp.constData());
     1058            myth_system(tmp);
    10521059        }
    10531060    }
    10541061