gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog cygnal/cygnal.cpp gui/gnash.cpp


From: Benjamin Wolsey
Subject: [Gnash-commit] gnash ChangeLog cygnal/cygnal.cpp gui/gnash.cpp
Date: Wed, 19 Mar 2008 12:04:24 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Benjamin Wolsey <bwy>   08/03/19 12:04:24

Modified files:
        .              : ChangeLog 
        cygnal         : cygnal.cpp 
        gui            : gnash.cpp 

Log message:
                * gui/gnash.cpp: minor changes to 'usage' display.
                * cygnal/cygnal.cpp: remove unnecessary call to 
RcFile::loadfiles()
                  (this is called on construction); use Arg_parser to add long
                  options. Make output of usage consistent with gnash, update
                  copyright date; use cout for output, split into smaller
                  units for translation. Set locale for LC_ALL to avoid mangling
                  non-ASCII characters in some log messages.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5975&r2=1.5976
http://cvs.savannah.gnu.org/viewcvs/gnash/cygnal/cygnal.cpp?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gnash.cpp?cvsroot=gnash&r1=1.112&r2=1.113

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5975
retrieving revision 1.5976
diff -u -b -r1.5975 -r1.5976
--- ChangeLog   19 Mar 2008 11:40:12 -0000      1.5975
+++ ChangeLog   19 Mar 2008 12:04:22 -0000      1.5976
@@ -1,4 +1,14 @@
-2008-03-18 Sandro Santilli <address@hidden>
+2008-03-19 Benjamin Wolsey <address@hidden>
+
+       * gui/gnash.cpp: minor changes to 'usage' display.
+       * cygnal/cygnal.cpp: remove unnecessary call to RcFile::loadfiles()
+         (this is called on construction); use Arg_parser to add long
+         options. Make output of usage consistent with gnash, update
+         copyright date; use cout for output, split into smaller
+         units for translation. Set locale for LC_ALL to avoid mangling
+         non-ASCII characters in some log messages.
+
+2008-03-19 Sandro Santilli <address@hidden>
 
        * server/array.{cpp,h}: use boost's mapped_vector for a sparse
          array implementation. Saves space at some cpu cycles till all
@@ -6,7 +16,7 @@
          behaviour :/).
        * testsuite/actionscript.all/array.as: successes in gaps filling.
 
-2008-03-18 Sandro Santilli <address@hidden>
+2008-03-19 Sandro Santilli <address@hidden>
 
        * testsuite/actionscript.all/array.as:
          test splice() and members access on a sparse array.

Index: cygnal/cygnal.cpp
===================================================================
RCS file: /sources/gnash/gnash/cygnal/cygnal.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- cygnal/cygnal.cpp   18 Mar 2008 22:04:28 -0000      1.25
+++ cygnal/cygnal.cpp   19 Mar 2008 12:04:23 -0000      1.26
@@ -55,6 +55,7 @@
 #include "statistics.h"
 #include "stream.h"
 #include "gmemory.h"
+#include "arg_parser.h"
 
 // classes internal to Cygnal
 #include "buffer.h"
@@ -77,7 +78,7 @@
 using namespace gnash;
 using namespace amf;
 
-static void usage(const char *proc);
+static void usage();
 static void version_and_copyright();
 static void cntrlc_handler(int sig);
 
@@ -89,6 +90,8 @@
 //static void dispatch_thread(struct thread_params *params);
 
 LogFile& dbglogfile = LogFile::getDefaultInstance();
+
+// The rcfile is loaded and parsed here:
 CRcInitFile& crcfile = CRcInitFile::getDefaultInstance();
 
 static struct sigaction  act;
@@ -119,35 +122,30 @@
 {
     // Initialize national language support
 #ifdef ENABLE_NLS
-    setlocale (LC_MESSAGES, "");
+    setlocale (LC_ALL, "");
     bindtextdomain (PACKAGE, LOCALEDIR);
     textdomain (PACKAGE);
 #endif
-    // scan for the two main long GNU options
-    int c;
-    for (c=0; c<argc; c++) {
-        if (strcmp("--help", argv[c]) == 0) {
-            version_and_copyright();
-            printf("\n");
-            usage(argv[0]);
-            exit(0);
-        }
-
-        if (strcmp("--version", argv[c]) == 0) {
-            version_and_copyright();
-            exit(0);
-        }
-    }
-
-    crcfile.loadFiles();
     
-#if 0 // this should be automatic
-    if (crcfile.getDebugLog().size()) {
-       dbglogfile.openLog(crcfile.getDebugLog());
-    } else {
-       dbglogfile.openLog("/tmp/cygnal-dbg.log");
-    }
-#endif
+   const Arg_parser::Option opts[] =
+        {
+        { 'h', "help",          Arg_parser::no  },
+        { 'V', "version",       Arg_parser::no  },
+        { 'p', "port-offset",   Arg_parser::yes },
+        { 'v', "verbose",       Arg_parser::no  },
+        { 'd', "dump",          Arg_parser::no  }
+        };
+
+    Arg_parser parser(argc, argv, opts);
+    if( ! parser.error().empty() )     
+    {
+        cout << parser.error() << endl;
+        exit(EXIT_FAILURE);
+    }
+
+    // Set the log file name before trying to write to
+    // it, or we might get two.
+    dbglogfile.setLogFilename("cygnal-dbg.log");
     
     if (crcfile.verbosityLevel() > 0) {
         dbglogfile.setVerbosity(crcfile.verbosityLevel());
@@ -161,33 +159,37 @@
        docroot = "/var/www/html/software/gnash/tests/";
     }
     
-    while ((c = getopt (argc, argv, "hvp:d")) != -1) {
-       switch (c) {
+
+    // Handle command line arguments
+    for( int i = 0; i < parser.arguments(); ++i )
+    {
+        const int code = parser.code(i);
+        switch( code )
+        {
          case 'h':
-             usage (argv[0]);
+                version_and_copyright();
+                usage();
+                exit(0);
+            case 'V':
+                 version_and_copyright();
               exit(0);
          case 'v':
               dbglogfile.setVerbosity();
              log_debug (_("Verbose output turned on"));
              break;
          case 'p':
-             port_offset = strtol(optarg, NULL, 0);
+                port_offset = parser.argument<int>(i);
              crcfile.setPortOffset(port_offset);
              break;
          case 'd':
              crcfile.dump();
              exit(0);
              break;
+            default:
+                log_error (_("Extraneous argument: %s"), 
parser.argument(i).c_str());
         }
     }
     
-//    dbglogfile.setLogFilename("cygnal-dbg.log");
-
-    // get the file name from the command line
-    while (optind < argc) {
-        log_error (_("Extraneous argument: %s"), argv[optind]);
-    }
-    
     // Trap ^C (SIGINT) so we can kill all the threads
     act.sa_handler = cntrlc_handler;
     sigaction (SIGINT, &act, NULL);
@@ -322,27 +324,26 @@
 static void
 version_and_copyright()
 {
-    printf (_(
-"Cygnal %s\n"
-"Copyright (C) 2006, 2007 Free Software Foundation, Inc.\n"
-"Cygnal comes with NO WARRANTY, to the extent permitted by law.\n"
-"You may redistribute copies of Cygnal under the terms of the GNU General\n"
-"Public License.  For more information, see the file named COPYING.\n"),
-        VERSION);
+    cout << "Cygnal " << VERSION << endl
+        << endl
+        << _("Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, 
Inc.\n"
+        "Cygnal comes with NO WARRANTY, to the extent permitted by law.\n"
+        "You may redistribute copies of Cygnal under the terms of the GNU 
General\n"
+        "Public License.  For more information, see the file named COPYING.\n")
+    << endl;
 }
 
 static void
-usage(const char* /*proc*/)
+usage()
 {
-    printf(_(
-       "cygnal -- an streaming media server.\n"
-       "\n"
-       "usage: cygnal [options...]\n"
-       "  --help(-h)  Print this info.\n"
-       "  --version   Print the version numbers.\n"
-       "  --verbose (-v)   Output verbose debug info.\n"
-       "  --port-offset (-p)   RTMPT port offset.\n"
-       ));
+       cout << _("cygnal -- a streaming media server.") << endl
+       << endl
+       << _("Usage: cygnal [options...]") << endl
+       << _("  -h,  --help          Print this help and exit") << endl
+       << _("  -V,  --version       Print version information and exit") << 
endl
+       << _("  -v,  --verbose       Output verbose debug info") << endl
+       << _("  -p   --port-offset   RTMPT port offset") << endl
+       << endl;
 }
 
 //} // end of cygnal namespace

Index: gui/gnash.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gnash.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- gui/gnash.cpp       19 Mar 2008 09:05:56 -0000      1.112
+++ gui/gnash.cpp       19 Mar 2008 12:04:23 -0000      1.113
@@ -141,9 +141,9 @@
 
 static void version_and_copyright()
 {
-    cout << _(
-        "Gnash " VERSION "\n"
-        "Copyright (C) 2005-2008 Free Software Foundation, Inc.\n"
+    cout << "Gnash " << VERSION << endl
+        << endl
+        << _("Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, 
Inc.\n"
         "Gnash comes with NO WARRANTY, to the extent permitted by law.\n"
         "You may redistribute copies of Gnash under the terms of the GNU 
General\n"
         "Public License.  For more information, see the file named COPYING.\n")




reply via email to

[Prev in Thread] Current Thread [Next in Thread]