Revision: 75805
          http://sourceforge.net/p/brlcad/code/75805
Author:   starseeker
Date:     2020-05-14 21:49:25 +0000 (Thu, 14 May 2020)
Log Message:
-----------
Add a new regress-repository test to check that all of our files with a main() 
in them call bu_setprogname.  It may not matter if none of the path aware 
functions are called, but it won't do any harm and the subsequent consequences 
(weird/nonintuitive/spotty breakage) when later adding something that needed it 
justify a blanket 'always call it' rule.

Modified Paths:
--------------
    brlcad/trunk/regress/repository/repocheck.cpp
    brlcad/trunk/src/conv/raw/raw-g.cpp
    brlcad/trunk/src/conv/step/util/list_elements.cpp
    brlcad/trunk/src/conv/walk_example.c
    brlcad/trunk/src/gtools/beset/beset.c
    brlcad/trunk/src/gtools/ganalyze.cpp
    brlcad/trunk/src/libged/help/help.cpp
    brlcad/trunk/src/libged/help/test_help.c
    brlcad/trunk/src/libicv/tests/crop.c
    brlcad/trunk/src/libicv/tests/fade.c
    brlcad/trunk/src/libicv/tests/filter.c
    brlcad/trunk/src/libicv/tests/operations.c
    brlcad/trunk/src/libicv/tests/read_write.c
    brlcad/trunk/src/libicv/tests/rect.c
    brlcad/trunk/src/libicv/tests/saturate.c
    brlcad/trunk/src/libicv/tests/size_down.c
    brlcad/trunk/src/libicv/tests/size_up.c
    brlcad/trunk/src/libpc/cartesian-heart.cpp
    brlcad/trunk/src/libpc/gecode_librt_test.cpp
    brlcad/trunk/src/libpc/gecode_solver_test.cpp
    brlcad/trunk/src/libpc/solver_test.cpp
    brlcad/trunk/src/libpc/vm_test.cpp
    brlcad/trunk/src/librt/uvpoints.cpp
    brlcad/trunk/src/proc-db/brickwall.c
    brlcad/trunk/src/proc-db/sphflake.c
    brlcad/trunk/src/rt/main.c
    brlcad/trunk/src/shapes/human.c
    brlcad/trunk/src/shapes/tire.c
    brlcad/trunk/src/util/bwshrink.c
    brlcad/trunk/src/util/pixcolors.c
    brlcad/trunk/src/util/pixelswap.c
    brlcad/trunk/src/util/pixshrink.c

Modified: brlcad/trunk/regress/repository/repocheck.cpp
===================================================================
--- brlcad/trunk/regress/repository/repocheck.cpp       2020-05-14 20:41:52 UTC 
(rev 75804)
+++ brlcad/trunk/regress/repository/repocheck.cpp       2020-05-14 21:49:25 UTC 
(rev 75805)
@@ -77,6 +77,11 @@
        std::regex common_regex;
        std::vector<std::regex> common_exempt_filters;
 
+       /* setprogname */
+       std::regex main_regex;
+       std::regex setprogname_regex;
+       std::vector<std::regex> setprogname_exempt_filters;
+
        /* api usage */
        std::vector<std::regex> api_file_filters;
        std::map<std::string, std::vector<std::regex>> api_exemptions;
@@ -94,6 +99,7 @@
        std::vector<std::string> bio_log;
        std::vector<std::string> bnet_log;
        std::vector<std::string> common_log;
+       std::vector<std::string> setprogname_log;
        std::vector<std::string> symbol_inc_log;
        std::vector<std::string> symbol_src_log;
        std::vector<std::string> symbol_bld_log;
@@ -164,6 +170,24 @@
 
     }
 
+    /* setprogname regex */
+    {
+       r.main_regex = std::regex("int[[:space:]]*main[[:space:]]*[(].*");
+       r.setprogname_regex = 
std::regex("[[:space:]]*bu_setprogname[[:space:]]*[(].*");
+       const char *setprogname_exempt_filter_strs[] {
+           "mt19937ar.c", "stb_truetype.h", "misc/",
+               NULL
+       };
+       cnt = 0;
+       rf = setprogname_exempt_filter_strs[cnt];
+       while (rf) {
+           std::string rrf = std::string(".*/") + std::string(rf) + 
std::string(".*");
+           r.setprogname_exempt_filters.push_back(std::regex(rrf));
+           cnt++;
+           rf = setprogname_exempt_filter_strs[cnt];
+       }
+    }  
+
     /* API usage check regex */
     {
        const char *api_file_exemption_strs[] {
@@ -530,6 +554,71 @@
     return ret;
 }
 
+int
+setprogname(repo_info_t &r, std::vector<std::string> &srcs)
+{
+    int ret = 0;
+
+    for (size_t i = 0; i < srcs.size(); i++) {
+       bool skip = false;
+       for (size_t j = 0; j < r.setprogname_exempt_filters.size(); j++) {
+           if (std::regex_match(srcs[i], r.setprogname_exempt_filters[j])) {
+               skip = true;
+               break;
+           }
+       }
+       if (skip) {
+           continue;
+       }
+
+       struct bu_mapped_file *ifile = bu_open_mapped_file(srcs[i].c_str(), 
"candidate file");
+       if (!ifile) {
+           std::cerr << "Unable to open " << srcs[i] << " for reading, 
skipping\n";
+           continue;
+       }
+
+       // If we have anything in the buffer that looks like it might be
+       // of interest, continue - otherwise we're done
+       if (!std::strstr((const char *)ifile->buf, "main")) {
+           bu_close_mapped_file(ifile);
+           continue;
+       }
+
+       std::string fbuff((char *)ifile->buf);
+       std::istringstream fs(fbuff);
+
+       int lcnt = 0;
+       bool have_main = false;
+       size_t main_line = 0;
+       bool have_setprogname = false;
+       std::string sline;
+       while (std::getline(fs, sline) && lcnt < MAX_LINES_CHECK) {
+           lcnt++;
+           if (std::strstr(sline.c_str(), "main") && std::regex_match(sline, 
r.main_regex)) {
+               have_main = true;
+               main_line = lcnt;
+           }
+           if (!have_main) {
+               continue;
+           }
+           if (std::strstr(sline.c_str(), "bu_setprogname") && 
std::regex_match(sline, r.setprogname_regex)) {
+               have_setprogname = true;
+               break;
+           }
+       }
+       bu_close_mapped_file(ifile);
+   
+       if (have_main && !have_setprogname) {
+           std::string lstr = srcs[i].substr(r.path_root.length()+1) + 
std::string(" defines a main() function on line ") + std::to_string(main_line) 
+ std::string(" but does not call bu_setprogname\n");
+           r.setprogname_log.push_back(lstr);
+           ret = 1;
+       }          
+    }
+
+    return ret;
+
+}
+
 class platform_entry {
     public:
        std::string symbol;
@@ -694,6 +783,8 @@
     ret += common_include_first(repo_info, src_files);
     ret += api_usage(repo_info, src_files);
 
+    ret += setprogname(repo_info, src_files);
+
     int h_cnt = platform_symbols(repo_info, repo_info.symbol_inc_log, 
inc_files);
     int s_cnt = platform_symbols(repo_info, repo_info.symbol_src_log, 
src_files);
     int b_cnt = platform_symbols(repo_info, repo_info.symbol_bld_log, 
build_files);
@@ -734,6 +825,13 @@
            }
        }
 
+       if (repo_info.setprogname_log.size()) {
+           std::cout << "\nFAILURE: found " << 
repo_info.setprogname_log.size() << " missing bu_setprogname calls:\n";
+           for (size_t i = 0; i < repo_info.setprogname_log.size(); i++) {
+               std::cout << repo_info.setprogname_log[i];
+           }
+       }
+
        if (psym_cnt > expected_psym_cnt) {
            std::cout << 
"\n**************************************************************************\n";
            std::cout << "FAILURE: expected " << expected_psym_cnt << " 
platform symbols, found " << psym_cnt << "\n";

Modified: brlcad/trunk/src/conv/raw/raw-g.cpp
===================================================================
--- brlcad/trunk/src/conv/raw/raw-g.cpp 2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/conv/raw/raw-g.cpp 2020-05-14 21:49:25 UTC (rev 75805)
@@ -41,6 +41,7 @@
 
 #include "RegionList.h"
 
+#include "bu/app.h"
 
 static std::vector<std::string> readLine(std::istream& is)
 {
@@ -88,6 +89,9 @@
         char* argv[])
 {
     int        ret = 0;
+
+    bu_setprogname(argv[0]);
+
     RegionList regions;
 
     if (argc < 3) {

Modified: brlcad/trunk/src/conv/step/util/list_elements.cpp
===================================================================
--- brlcad/trunk/src/conv/step/util/list_elements.cpp   2020-05-14 20:41:52 UTC 
(rev 75804)
+++ brlcad/trunk/src/conv/step/util/list_elements.cpp   2020-05-14 21:49:25 UTC 
(rev 75805)
@@ -28,6 +28,8 @@
 
 #include "ap_schema.h"
 
+#include "bu/app.h"
+
 class SEarrIterator
 {
 private:
@@ -114,9 +116,11 @@
 }
 
 
-int main()
+int main(int UNUSED(argc), const char *argv[])
 {
 
+    bu_setprogname(argv[0]);
+
     // This has to be done before anything else.  This initializes
     // all of the registry information for the schema you are using.
     // The SchemaInit() function is generated by exp2cxx... see

Modified: brlcad/trunk/src/conv/walk_example.c
===================================================================
--- brlcad/trunk/src/conv/walk_example.c        2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/conv/walk_example.c        2020-05-14 21:49:25 UTC (rev 
75805)
@@ -39,6 +39,7 @@
 #include <string.h>
 
 #include "vmath.h"
+#include "bu/app.h"
 #include "bu/getopt.h"
 #include "bu/path.h"
 #include "bu/str.h"
@@ -248,6 +249,8 @@
        int stuff;
     } user_data;
 
+    bu_setprogname(av[0]);
+
     arg_count = parse_args(ac, av);
 
     if ((ac - arg_count) < 1) {

Modified: brlcad/trunk/src/gtools/beset/beset.c
===================================================================
--- brlcad/trunk/src/gtools/beset/beset.c       2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/gtools/beset/beset.c       2020-05-14 21:49:25 UTC (rev 
75805)
@@ -68,7 +68,6 @@
 {
     int c;
 
-    bu_setprogname(av[0]);
     /* handle options */
     bu_opterr = 0;
     bu_optind = 0;
@@ -124,6 +123,7 @@
     int  ac;
     struct db_i *source_db;
 
+    bu_setprogname(argv[0]);
 
     ac = parse_args(argc, argv, &opts);
     if (argc - ac != 3)

Modified: brlcad/trunk/src/gtools/ganalyze.cpp
===================================================================
--- brlcad/trunk/src/gtools/ganalyze.cpp        2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/gtools/ganalyze.cpp        2020-05-14 21:49:25 UTC (rev 
75805)
@@ -33,6 +33,7 @@
 
 #include "bio.h"
 
+#include "bu/app.h"
 #include "bu/log.h"
 #include "bu/vls.h"
 #include "raytrace.h"
@@ -139,7 +140,7 @@
     {NULL, NULL, NULL, 0, 0, 0 /* END */}
 };
 
-int main(int UNUSED(argc), const char **UNUSED(argv))
+int main(int UNUSED(argc), const char **argv)
 {
     int ret = 0;
     int nret = 0;
@@ -146,6 +147,8 @@
     struct analyze_command_state *acs = NULL;
     struct bu_vls iline = BU_VLS_INIT_ZERO;
 
+    bu_setprogname(argv[0]);
+
     /* For Windows */
     setmode(fileno(stdin), O_BINARY);
     setmode(fileno(stdout), O_BINARY);

Modified: brlcad/trunk/src/libged/help/help.cpp
===================================================================
--- brlcad/trunk/src/libged/help/help.cpp       2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libged/help/help.cpp       2020-05-14 21:49:25 UTC (rev 
75805)
@@ -353,8 +353,9 @@
 {
     struct ged ged = {0};
 
+    bu_setprogname(av[0]);
+
     GED_INIT(&ged, NULL);
-
     help_load(&ged);
     ged_help(&ged, ac, (const char **)av);
     help_unload(&ged);

Modified: brlcad/trunk/src/libged/help/test_help.c
===================================================================
--- brlcad/trunk/src/libged/help/test_help.c    2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libged/help/test_help.c    2020-05-14 21:49:25 UTC (rev 
75805)
@@ -23,11 +23,14 @@
  *
  */
 
+#include "bu/app.h"
 #include "ged.h"
 
 int main(int ac, char *av[]) {
   struct ged g;
 
+  bu_setprogname(av[0]);
+
   GED_INIT(&g, NULL);
 
   return ged_help(&g, ac, (const char **)av);

Modified: brlcad/trunk/src/libicv/tests/crop.c
===================================================================
--- brlcad/trunk/src/libicv/tests/crop.c        2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libicv/tests/crop.c        2020-05-14 21:49:25 UTC (rev 
75805)
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 
 #include "bio.h"
+#include "bu/app.h"
 #include "bu/log.h"
 #include "bu/mime.h"
 #include "bu/getopt.h"
@@ -58,11 +59,14 @@
     int urx, ury, ulx, uly, llx, lly, lrx, lry;
     int ret;
 
+    bu_setprogname(argv[0]);
+
     if (argc<2) {
            usage();
            return 1;
     }
 
+
     while ((c = bu_getopt(argc, argv, "s:W:w:N:n:s:S:o:bpdmh?")) != -1) {
            switch (c) {
                case 's':

Modified: brlcad/trunk/src/libicv/tests/fade.c
===================================================================
--- brlcad/trunk/src/libicv/tests/fade.c        2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libicv/tests/fade.c        2020-05-14 21:49:25 UTC (rev 
75805)
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 
 #include "bio.h"
+#include "bu/app.h"
 #include "bu/log.h"
 #include "bu/mime.h"
 #include "bu/getopt.h"
@@ -57,6 +58,9 @@
     icv_image_t *bif;
     bu_mime_image_t format = BU_MIME_IMAGE_AUTO;
     double multiplier=0.2;
+
+    bu_setprogname(argv[0]);
+
     if (argc<2) {
        usage();
        return 1;

Modified: brlcad/trunk/src/libicv/tests/filter.c
===================================================================
--- brlcad/trunk/src/libicv/tests/filter.c      2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libicv/tests/filter.c      2020-05-14 21:49:25 UTC (rev 
75805)
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 
 #include "bio.h"
+#include "bu/app.h"
 #include "bu/log.h"
 #include "bu/mime.h"
 #include "bu/getopt.h"
@@ -94,6 +95,8 @@
     bu_mime_image_t format = BU_MIME_IMAGE_AUTO;
     ICV_FILTER filter = ICV_FILTER_LOW_PASS;
 
+    bu_setprogname(argv[0]);
+
     if (argc<2) {
        usage();
        return 1;

Modified: brlcad/trunk/src/libicv/tests/operations.c
===================================================================
--- brlcad/trunk/src/libicv/tests/operations.c  2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libicv/tests/operations.c  2020-05-14 21:49:25 UTC (rev 
75805)
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 
 #include "bio.h"
+#include "bu/app.h"
 #include "bu/log.h"
 #include "bu/mime.h"
 #include "bu/getopt.h"
@@ -59,6 +60,7 @@
     icv_image_t *bif1, *bif2, *out_bif;
     bu_mime_image_t format = BU_MIME_IMAGE_AUTO;
 
+    bu_setprogname(argv[0]);
 
     if (argc<2) {
        usage();

Modified: brlcad/trunk/src/libicv/tests/read_write.c
===================================================================
--- brlcad/trunk/src/libicv/tests/read_write.c  2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libicv/tests/read_write.c  2020-05-14 21:49:25 UTC (rev 
75805)
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 
 #include "bio.h"
+#include "bu/app.h"
 #include "bu/log.h"
 #include "bu/mime.h"
 #include "bu/getopt.h"
@@ -55,6 +56,8 @@
     bu_mime_image_t format = BU_MIME_IMAGE_AUTO;
     int c;
 
+    bu_setprogname(argv[0]);
+
     if (argc<2) {
        usage();
        return 1;

Modified: brlcad/trunk/src/libicv/tests/rect.c
===================================================================
--- brlcad/trunk/src/libicv/tests/rect.c        2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libicv/tests/rect.c        2020-05-14 21:49:25 UTC (rev 
75805)
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 
 #include "bio.h"
+#include "bu/app.h"
 #include "bu/log.h"
 #include "bu/mime.h"
 #include "bu/getopt.h"
@@ -57,6 +58,8 @@
     icv_image_t *bif;
     bu_mime_image_t format=BU_MIME_IMAGE_AUTO;
 
+    bu_setprogname(argv[0]);
+
     if (argc<2) {
        usage();
        return 1;

Modified: brlcad/trunk/src/libicv/tests/saturate.c
===================================================================
--- brlcad/trunk/src/libicv/tests/saturate.c    2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libicv/tests/saturate.c    2020-05-14 21:49:25 UTC (rev 
75805)
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 
 #include "bio.h"
+#include "bu/app.h"
 #include "bu/log.h"
 #include "bu/mime.h"
 #include "bu/getopt.h"
@@ -57,6 +58,8 @@
     double fraction = 0;
     bu_mime_image_t format = BU_MIME_IMAGE_AUTO;
 
+    bu_setprogname(argv[0]);
+
     if (argc<2) {
        usage();
        return 1;

Modified: brlcad/trunk/src/libicv/tests/size_down.c
===================================================================
--- brlcad/trunk/src/libicv/tests/size_down.c   2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libicv/tests/size_down.c   2020-05-14 21:49:25 UTC (rev 
75805)
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 
 #include "bio.h"
+#include "bu/app.h"
 #include "bu/log.h"
 #include "bu/mime.h"
 #include "bu/getopt.h"
@@ -63,6 +64,8 @@
     ICV_RESIZE_METHOD method = ICV_RESIZE_SHRINK;
     size_t index;
 
+    bu_setprogname(argv[0]);
+
     if (argc<2) {
        usage();
        return 1;

Modified: brlcad/trunk/src/libicv/tests/size_up.c
===================================================================
--- brlcad/trunk/src/libicv/tests/size_up.c     2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libicv/tests/size_up.c     2020-05-14 21:49:25 UTC (rev 
75805)
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 
 #include "bio.h"
+#include "bu/app.h"
 #include "bu/log.h"
 #include "bu/mime.h"
 #include "bu/getopt.h"
@@ -62,6 +63,8 @@
     bu_mime_image_t format = BU_MIME_IMAGE_AUTO;
     ICV_RESIZE_METHOD method = ICV_RESIZE_NINTERP;
 
+    bu_setprogname(argv[0]);
+
     if (argc<2) {
        usage();
        return 1;

Modified: brlcad/trunk/src/libpc/cartesian-heart.cpp
===================================================================
--- brlcad/trunk/src/libpc/cartesian-heart.cpp  2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libpc/cartesian-heart.cpp  2020-05-14 21:49:25 UTC (rev 
75805)
@@ -40,6 +40,8 @@
 #include <gecode/minimodel.hh>
 #include <gecode/float.hh>
 
+#include "bu/app.h"
+
 using namespace Gecode;
 
 /**
@@ -110,6 +112,7 @@
  *  \relates CartesianHeart
  */
 int main(int argc, char* argv[]) {
+  bu_setprogname(argv[0]);
   Options opt("CartesianHeart");
   opt.parse(argc,argv);
   opt.solutions(0);

Modified: brlcad/trunk/src/libpc/gecode_librt_test.cpp
===================================================================
--- brlcad/trunk/src/libpc/gecode_librt_test.cpp        2020-05-14 20:41:52 UTC 
(rev 75804)
+++ brlcad/trunk/src/libpc/gecode_librt_test.cpp        2020-05-14 21:49:25 UTC 
(rev 75805)
@@ -29,6 +29,8 @@
 #include <gecode/minimodel.hh>
 #include <gecode/search.hh>
 
+#include "bu/app.h"
+
 class GeometrySolve : public Gecode::Space {
     public:
        Gecode::IntVarArray l;
@@ -86,8 +88,10 @@
 
 }
 
-int main() {
+int main(int argc, const char *argv[]) {
 
+    bu_setprogname(argv[0]);
+
     /* Perpendicular constraint test */
     {
        int cnt = 0;

Modified: brlcad/trunk/src/libpc/gecode_solver_test.cpp
===================================================================
--- brlcad/trunk/src/libpc/gecode_solver_test.cpp       2020-05-14 20:41:52 UTC 
(rev 75804)
+++ brlcad/trunk/src/libpc/gecode_solver_test.cpp       2020-05-14 21:49:25 UTC 
(rev 75805)
@@ -57,6 +57,8 @@
 #include <gecode/minimodel.hh>
 #include <gecode/search.hh>
 
+#include "bu/app.h"
+
 class EqSolve : public Gecode::Space {
     public:
        Gecode::IntVarArray l;
@@ -66,8 +68,10 @@
        void print(void) const {std::cout << l << std::endl;}
 };
 
-int main() {
+int main(int argc, const char *argv[]) {
 
+  bu_setprogname(argv[0]);
+
   EqSolve* m = new EqSolve(4, 0, 10);
 
   Gecode::IntVar A(m->l[0]), B(m->l[1]), C(m->l[2]), D(m->l[3]);

Modified: brlcad/trunk/src/libpc/solver_test.cpp
===================================================================
--- brlcad/trunk/src/libpc/solver_test.cpp      2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/libpc/solver_test.cpp      2020-05-14 21:49:25 UTC (rev 
75805)
@@ -29,6 +29,7 @@
 #include <utility>                   // for std::pair
 #include <algorithm>                 // for std::for_each
 
+#include "bu/app.h"
 #include "pcVariable.h"
 #include "pcVCSet.h"
 #include "pcNetwork.h"
@@ -78,7 +79,7 @@
     }
 } f4;
 
-int main()
+int main(int argc, const char *argv[])
 {
     BackTrackSolver<double> GBTS; /* Generic Backtracker */
     PCSolver<double> GPCS; /* Generic Solver */
@@ -86,6 +87,8 @@
     struct pc_pc_set pcs;
     VCSet vc_set;
 
+    bu_setprogname(argv[0]);
+
     pc_init_pcset(&pcs);
     fastf_t D = 8.04;
     point_t E = {8.04, 3.2, 0.0};

Modified: brlcad/trunk/src/libpc/vm_test.cpp
===================================================================
--- brlcad/trunk/src/libpc/vm_test.cpp  2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/libpc/vm_test.cpp  2020-05-14 21:49:25 UTC (rev 75805)
@@ -30,6 +30,7 @@
 #include <iostream>
 #include <cmath>
 
+#include "bu/app.h"
 
 typedef boost::shared_ptr<MathFunction> ct;
 
@@ -134,8 +135,9 @@
 }
 
 
-int main()
+int main(int argc, const char *argv[])
 {
+    bu_setprogname(argv[0]);
     eval();
     return 0;
 }

Modified: brlcad/trunk/src/librt/uvpoints.cpp
===================================================================
--- brlcad/trunk/src/librt/uvpoints.cpp 2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/librt/uvpoints.cpp 2020-05-14 21:49:25 UTC (rev 75805)
@@ -34,6 +34,8 @@
 #include <math.h>
 #include <time.h>
 
+#include "bu/app.h"
+
 #define POOL_SIZE 1024
 
 
@@ -461,6 +463,9 @@
     } else {
        MAX_TREE_DEPTH = atoi(argv[1]);
     }
+
+    bu_setprogname(argv[0]);
+
     t0 = time(NULL);
     t1 = time(NULL);
     matsize = pow(2, MAX_TREE_DEPTH + 1) + 1;

Modified: brlcad/trunk/src/proc-db/brickwall.c
===================================================================
--- brlcad/trunk/src/proc-db/brickwall.c        2020-05-14 20:41:52 UTC (rev 
75804)
+++ brlcad/trunk/src/proc-db/brickwall.c        2020-05-14 21:49:25 UTC (rev 
75805)
@@ -30,6 +30,7 @@
 #include <math.h>
 #include "bio.h"
 
+#include "bu/app.h"
 #include "bu/getopt.h"
 #include "bu/units.h"
 #include "bu/exit.h"
@@ -317,6 +318,8 @@
     double horiz_spacing;
     double vert_spacing;
 
+    bu_setprogname(av[0]);
+
     if (ac == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout)))
        usage("\n");
 

Modified: brlcad/trunk/src/proc-db/sphflake.c
===================================================================
--- brlcad/trunk/src/proc-db/sphflake.c 2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/proc-db/sphflake.c 2020-05-14 21:49:25 UTC (rev 75805)
@@ -31,6 +31,7 @@
 #include <math.h>
 
 #include "vmath.h"
+#include "bu/app.h"
 #include "bu/getopt.h"
 #include "bn.h"
 #include "raytrace.h"
@@ -139,6 +140,8 @@
     char fileName[MAX_INPUT_LENGTH] = {0};
     int depth = DEFAULT_MAXDEPTH;
 
+    bu_setprogname(argv[0]);
+
     memset(fileName, 0, MAX_INPUT_LENGTH);
     bu_strlcpy(fileName, DEFAULT_FILENAME, sizeof(fileName));
 

Modified: brlcad/trunk/src/rt/main.c
===================================================================
--- brlcad/trunk/src/rt/main.c  2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/rt/main.c  2020-05-14 21:49:25 UTC (rev 75805)
@@ -44,6 +44,7 @@
 
 #include "bio.h"
 
+#include "bu/app.h"
 #include "bu/endian.h"
 #include "bu/getopt.h"
 #include "bu/bitv.h"
@@ -202,6 +203,8 @@
     int rank;
 #endif
 
+    bu_setprogname(argv[0]);
+
     setmode(fileno(stdin), O_BINARY);
     setmode(fileno(stdout), O_BINARY);
     setmode(fileno(stderr), O_BINARY);

Modified: brlcad/trunk/src/shapes/human.c
===================================================================
--- brlcad/trunk/src/shapes/human.c     2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/shapes/human.c     2020-05-14 21:49:25 UTC (rev 75805)
@@ -31,6 +31,7 @@
 #  include <unistd.h>
 #endif
 
+#include "bu/app.h"
 #include "wdb.h"
 #include "ged.h"
 
@@ -43,6 +44,8 @@
     int ret;
     const char *filename = NULL;
 
+    bu_setprogname(av[0]);
+
     filename = DEFAULT_FILENAME;
 
     db_fp = wdb_fopen(filename);

Modified: brlcad/trunk/src/shapes/tire.c
===================================================================
--- brlcad/trunk/src/shapes/tire.c      2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/shapes/tire.c      2020-05-14 21:49:25 UTC (rev 75805)
@@ -32,6 +32,7 @@
 #  include <unistd.h>
 #endif
 
+#include "bu/app.h"
 #include "wdb.h"
 #include "ged.h"
 
@@ -45,6 +46,8 @@
     struct ged ged;
     int ret;
 
+    bu_setprogname(av[0]);
+
     filename = DEFAULT_TIRE_FILENAME;
 
     /* Just using "tire.g" for now. */

Modified: brlcad/trunk/src/util/bwshrink.c
===================================================================
--- brlcad/trunk/src/util/bwshrink.c    2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/util/bwshrink.c    2020-05-14 21:49:25 UTC (rev 75805)
@@ -32,6 +32,7 @@
 #include <string.h>
 #include "bio.h"
 
+#include "bu/app.h"
 #include "bu/getopt.h"
 #include "bu/file.h"
 #include "bu/malloc.h"
@@ -178,6 +179,8 @@
     int c = 0;
     int t;
 
+    bu_setprogname(av[0]);
+
     (void)parse_args(ac, av);
     if (isatty(fileno(stdin)))
        usage();

Modified: brlcad/trunk/src/util/pixcolors.c
===================================================================
--- brlcad/trunk/src/util/pixcolors.c   2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/util/pixcolors.c   2020-05-14 21:49:25 UTC (rev 75805)
@@ -34,6 +34,7 @@
 #include <limits.h>
 #include "bio.h"
 
+#include "bu/app.h"
 #include "bu/color.h"
 #include "bu/getopt.h"
 #include "bu/exit.h"
@@ -122,6 +123,9 @@
 int main(int ac, char **av)
 {
     int c, isatty(int);
+ 
+    bu_setprogname(av[0]);
+ 
     progname = *av;
 
     /* Get # of options & turn all the option flags off

Modified: brlcad/trunk/src/util/pixelswap.c
===================================================================
--- brlcad/trunk/src/util/pixelswap.c   2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/util/pixelswap.c   2020-05-14 21:49:25 UTC (rev 75805)
@@ -30,6 +30,7 @@
 
 #include "bio.h"
 
+#include "bu/app.h"
 #include "bu/getopt.h"
 #include "bu/exit.h"
 #include "fb.h"
@@ -96,6 +97,8 @@
     unsigned char r, g, b, R, G, B;
     size_t ret;
 
+    bu_setprogname(av[0]);
+
     i=parse_args(ac, av);
 /* if ac == 1, there is only 1 argument; i.e., run-with-no-arguments
  */

Modified: brlcad/trunk/src/util/pixshrink.c
===================================================================
--- brlcad/trunk/src/util/pixshrink.c   2020-05-14 20:41:52 UTC (rev 75804)
+++ brlcad/trunk/src/util/pixshrink.c   2020-05-14 21:49:25 UTC (rev 75805)
@@ -29,6 +29,7 @@
 #include <string.h>
 #include "bio.h"
 
+#include "bu/app.h"
 #include "bu/getopt.h"
 #include "bu/malloc.h"
 #include "bu/file.h"
@@ -242,6 +243,8 @@
 {
     UCHAR *buffer = (UCHAR *)NULL;
 
+    bu_setprogname(av[0]);
+
     (void)parse_args(ac, av);
     if (isatty(fileno(stdin)))
        usage();

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to