Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/menuc Remove the advertising clause and appease the ...



details:   https://anonhg.NetBSD.org/src/rev/f4d59ba58fe2
branches:  trunk
changeset: 777853:f4d59ba58fe2
user:      mbalmer <mbalmer%NetBSD.org@localhost>
date:      Tue Mar 06 16:55:18 2012 +0000

description:
Remove the advertising clause and appease the eye a bit (still not good, but
better).  Almost no functional change.

diffstat:

 usr.bin/menuc/defs.h       |    8 +-
 usr.bin/menuc/main.c       |   47 +++-----
 usr.bin/menuc/mdb.c        |  221 ++++++++++++++++++++------------------------
 usr.bin/menuc/mdb.h        |    8 +-
 usr.bin/menuc/menu_sys.def |    8 +-
 usr.bin/menuc/menuc.1      |    8 +-
 usr.bin/menuc/parse.y      |    8 +-
 usr.bin/menuc/scan.l       |    8 +-
 usr.bin/menuc/util.c       |   45 ++++-----
 9 files changed, 150 insertions(+), 211 deletions(-)

diffs (truncated from 765 to 300 lines):

diff -r 821d6b3a4379 -r f4d59ba58fe2 usr.bin/menuc/defs.h
--- a/usr.bin/menuc/defs.h      Tue Mar 06 16:26:01 2012 +0000
+++ b/usr.bin/menuc/defs.h      Tue Mar 06 16:55:18 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: defs.h,v 1.8 2003/10/27 00:12:43 lukem Exp $    */
+/*     $NetBSD: defs.h,v 1.9 2012/03/06 16:55:18 mbalmer Exp $  */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -14,11 +14,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software develooped for the NetBSD Project by
- *      Piermont Information Systems Inc.
- * 4. The name of Piermont Information Systems Inc. may not be used to endorse
+ * 3. The name of Piermont Information Systems Inc. may not be used to endorse
  *    or promote products derived from this software without specific prior
  *    written permission.
  *
diff -r 821d6b3a4379 -r f4d59ba58fe2 usr.bin/menuc/main.c
--- a/usr.bin/menuc/main.c      Tue Mar 06 16:26:01 2012 +0000
+++ b/usr.bin/menuc/main.c      Tue Mar 06 16:55:18 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.10 2004/06/20 22:20:16 jmc Exp $    */
+/*     $NetBSD: main.c,v 1.11 2012/03/06 16:55:18 mbalmer Exp $        */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -14,11 +14,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software develooped for the NetBSD Project by
- *      Piermont Information Systems Inc.
- * 4. The name of Piermont Information Systems Inc. may not be used to endorse
+ * 3. The name of Piermont Information Systems Inc. may not be used to endorse
  *    or promote products derived from this software without specific prior
  *    written permission.
  *
@@ -45,7 +41,7 @@
 #include <sys/cdefs.h>
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: main.c,v 1.10 2004/06/20 22:20:16 jmc Exp $");
+__RCSID("$NetBSD: main.c,v 1.11 2012/03/06 16:55:18 mbalmer Exp $");
 #endif
 
 
@@ -57,36 +53,34 @@
 #include "defs.h"
 
 /* Local prototypes */
-void usage (char *);
+__dead void usage(void);
 
 int
-main (int argc, char **argv)
+main(int argc, char **argv)
 {
        int ch;
 
-       prog_name = argv[0];
-       
        /* Process the arguments. */
-       while ( (ch = getopt (argc, argv, "o:")) != -1 ) {
+       while ((ch = getopt(argc, argv, "o:")) != -1 ) {
                switch (ch) {
                case 'o': /* output file name */
                        out_name = optarg;
                        break;
                default:
-                       usage (prog_name);
+                       usage();
                }
        }
 
-       if (optind != argc-1)
-               usage (prog_name);
+       if (optind != argc - 1)
+               usage();
 
        src_name = argv[optind];
 
-       yyin = fopen (src_name, "r");
+       yyin = fopen(src_name, "r");
        if (yyin == NULL) {
-               (void) fprintf (stderr, "%s: could not open %s.\n",
-                               prog_name, src_name);
-               exit (1);
+               (void)fprintf(stderr, "%s: could not open %s.\n", prog_name,
+                   src_name);
+               exit(1);
        }
 
        /* The default menu */
@@ -107,18 +101,15 @@
        default_info.exitact.endwin = FALSE;
 
        /* Do the parse */
-       (void) yyparse ();
+       (void)yyparse();
 
-       if (had_errors)
-               return 1;
-
-       return 0;
+       return had_errors ? 1 : 0;
 }
 
 
-void
-usage (char *prog)
+__dead void
+usage(void)
 {
-       (void) fprintf (stderr, "%s [-o name] file\n", prog);
-       exit (1);
+       (void)fprintf (stderr, "%s [-o name] file\n", getprogname());
+       exit(1);
 }
diff -r 821d6b3a4379 -r f4d59ba58fe2 usr.bin/menuc/mdb.c
--- a/usr.bin/menuc/mdb.c       Tue Mar 06 16:26:01 2012 +0000
+++ b/usr.bin/menuc/mdb.c       Tue Mar 06 16:55:18 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mdb.c,v 1.45 2011/09/06 18:16:38 joerg Exp $   */
+/*     $NetBSD: mdb.c,v 1.46 2012/03/06 16:55:18 mbalmer Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -14,11 +14,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software develooped for the NetBSD Project by
- *      Piermont Information Systems Inc.
- * 4. The name of Piermont Information Systems Inc. may not be used to endorse
+ * 3. The name of Piermont Information Systems Inc. may not be used to endorse
  *    or promote products derived from this software without specific prior
  *    written permission.
  *
@@ -45,7 +41,7 @@
 #include <sys/cdefs.h>
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: mdb.c,v 1.45 2011/09/06 18:16:38 joerg Exp $");
+__RCSID("$NetBSD: mdb.c,v 1.46 2012/03/06 16:55:18 mbalmer Exp $");
 #endif
 
 
@@ -71,7 +67,7 @@
 /* get_menu returns a pointer to a newly created id_rec or an old one. */
 
 id_rec *
-get_menu (char *name)
+get_menu(char *name)
 {
        id_rec *temp;
 
@@ -79,15 +75,15 @@
 
        if (temp == NULL) {
                if (menu_no < MAX) {
-                       temp = (id_rec *) malloc (sizeof(id_rec));
+                       temp = (id_rec *)malloc(sizeof(id_rec));
                        temp->id = strdup(name);
                        temp->info = NULL;
                        temp->menu_no = menu_no;
                        menus[menu_no++] = temp;
-                       insert_id (&root, temp);
+                       insert_id(&root, temp);
                } else {
-                       (void) fprintf (stderr, "Too many menus.  "
-                                       "Increase MAX.\n");
+                       (void)fprintf(stderr, "Too many menus.  "
+                           "Increase MAX.\n");
                        exit(1);
                }
        }
@@ -97,13 +93,12 @@
 
 
 /* Verify that all menus are defined. */
-
 void
-check_defined (void)
+check_defined(void)
 {
        int i;
 
-       for (i=0; i<menu_no; i++)
+       for (i = 0; i < menu_no; i++)
                if (!menus[i]->info)
                        yyerror ("Menu '%s' undefined.", menus[i]->id);
 }
@@ -111,56 +106,47 @@
 
 /* Write out the menu file. */
 void
-write_menu_file (char *initcode)
+write_menu_file(char *initcode)
 {
-       FILE *out_file;
-       FILE *sys_file;
+       FILE *out_file, *sys_file;
        int i, j;
-       char hname[1024];
-       char cname[1024];
-       char sname[1024];
-       char *sys_prefix;
-       char *tmpstr;
-       int name_is_code;
-
-       int nlen;
-
-       int ch;
-
+       char hname[1024], cname[1024], sname[1024];
+       char *sys_prefix, *tmpstr;
+       int name_is_code, nlen, ch;
        optn_info *toptn;
 
        /* Generate file names */
-       snprintf (hname, 1024, "%s.h", out_name);
+       snprintf(hname, 1024, "%s.h", out_name);
        nlen = strlen(hname);
        if (hname[nlen-2] != '.' || hname[nlen-1] != 'h') {
-               (void) fprintf (stderr, "%s: name `%s` too long.\n",
-                               prog_name, out_name);
+               (void)fprintf(stderr, "%s: name `%s` too long.\n",
+                   prog_name, out_name);
                exit(1);
        }
-       snprintf (cname, 1024, "%s.c", out_name);
+       snprintf(cname, 1024, "%s.c", out_name);
 
        /* Open the menu_sys file first. */
-       sys_prefix = getenv ("MENUDEF");
+       sys_prefix = getenv("MENUDEF");
        if (sys_prefix == NULL)
                sys_prefix = _PATH_DEFSYSPREFIX;
-       snprintf (sname, 1024, "%s/%s", sys_prefix, sys_name);
+       snprintf(sname, 1024, "%s/%s", sys_prefix, sys_name);
        sys_file = fopen (sname, "r");
        if (sys_file == NULL) {
-               (void) fprintf (stderr, "%s: could not open %s.\n",
-                               prog_name, sname);
-               exit (1);
+               (void)fprintf(stderr, "%s: could not open %s.\n",
+                   prog_name, sname);
+               exit(1);
        }
 
        /* Output the .h file first. */
-       out_file = fopen (hname, "w");
+       out_file = fopen(hname, "w");
        if (out_file == NULL) {
-               (void) fprintf (stderr, "%s: could not open %s.\n",
-                               prog_name, hname);
-               exit (1);
+               (void)fprintf(stderr, "%s: could not open %s.\n",
+                   prog_name, hname);
+               exit(1);
        }
 
        /* Write it */
-       (void) fprintf (out_file, "%s",
+       (void)fprintf(out_file, "%s",
                "/* menu system definitions. */\n"
                "\n"
                "#ifndef MENU_DEFS_H\n"
@@ -228,7 +214,7 @@
 #undef STR
        );
 
-       (void) fprintf (out_file, "%s",
+       (void)fprintf(out_file, "%s",
                "\n"
                "/* Prototypes */\n"
                "int menu_init(void);\n"
@@ -237,7 +223,7 @@
                );
 
        if (do_dynamic)
-               (void) fprintf (out_file, "%s",
+               (void)fprintf(out_file, "%s",
                        "int new_menu(const char *, menu_ent *, int, \n"
                            "\tint, int, int, int, int,\n"
                            "\tvoid (*)(menudesc *, void *), "
@@ -248,100 +234,93 @@
                        "void set_menu_numopts(int, int);\n"
                        );
 
-       (void) fprintf (out_file, "\n/* Menu names */\n");



Home | Main Index | Thread Index | Old Index