* COPYING: Update verbiage, add list of contributors and copyright notice.

* genstring.c: Generate string array from source file.
* Makefile.am: Build genstring.
* Makefile.inc: Use genstring to create license.c from COPYING.
* yasm.c: Include license.c and use it for new --license option.  Shorten
--version option to just displaying version, compile date, and very short
copyright message.

svn path=/trunk/yasm/; revision=1463
0.5.0rc2^2^2
Peter Johnson 19 years ago
parent 5c36a0551f
commit a9b1395d09
  1. 41
      COPYING
  2. 13
      Makefile.am
  3. 8
      frontends/yasm/Makefile.inc
  4. 47
      frontends/yasm/yasm.c
  5. 103
      genstring.c

@ -1,27 +1,39 @@
Yasm is Copyright (c) 2001-2006 Peter Johnson and other Yasm developers.
Yasm developers and/or contributors include:
Peter Johnson
Michael Urman
Stanislav Karchebny
Brian Gladman
-----------------------------------
YASM licensing overview and summary
Yasm licensing overview and summary
-----------------------------------
Note: This document does not provide legal advice nor is it the actual license
of any part of YASM. See the individual licenses for complete details.
Consult a laywer for legal advice.
Note: This document does not provide legal advice nor is it the actual
license of any part of Yasm. See the individual licenses for complete
details. Consult a lawyer for legal advice.
The primary license of YASM is the 2-clause BSD license. Please use this
The primary license of Yasm is the 2-clause BSD license. Please use this
license if you plan on submitting code to the project.
Yasm has absolutely no warranty; not even for merchantibility or fitness
for a particular purpose.
-------
Libyasm
-------
Libyasm is 2-clause or 3-clause BSD licensed, with the exception of bitvect,
which is triple-licensed under the Artistic license, GPL, and LGPL. Libyasm
is thus GPL and LGPL compatible. In addition, this also means that libyasm
is free for binary-only distribution as long as the terms of the 3-clause BSD
license and Artistic license (as it applies to bitvect) are fulfilled.
Libyasm is 2-clause or 3-clause BSD licensed, with the exception of
bitvect, which is triple-licensed under the Artistic license, GPL, and
LGPL. Libyasm is thus GPL and LGPL compatible. In addition, this also
means that libyasm is free for binary-only distribution as long as the
terms of the 3-clause BSD license and Artistic license (as it applies to
bitvect) are fulfilled.
-------
Modules
-------
Most of the modules are 2-clause BSD licensed, with the exception of:
The modules are 2-clause or 3-clause BSD licensed, with the exception of:
preprocs/nasm - LGPL licensed
---------
@ -32,9 +44,10 @@ The frontends are 2-clause BSD licensed.
-------------
License Texts
-------------
The full text of all licenses are provided in separate files in this
distribution. Each file may include the entire license (in the case of the BSD
and Artistic licenses), or may reference the GPL or LGPL license file.
The full text of all licenses are provided in separate files in the source
distribution. Each source file may include the entire license (in the case
of the BSD and Artistic licenses), or may reference the GPL or LGPL license
file.
BSD.txt - 2-clause and 3-clause BSD licenses
Artistic.txt - Artistic license

@ -8,7 +8,7 @@ AM_CFLAGS = @MORE_CFLAGS@
bin_PROGRAMS =
dist_man_MANS =
TESTS =
noinst_PROGRAMS =
noinst_PROGRAMS = genstring
check_PROGRAMS = test_hd
@ -19,6 +19,7 @@ include_HEADERS = libyasm.h
noinst_HEADERS = util.h
BUILT_SOURCES =
# configure.lineno doesn't clean up after itself?
CLEANFILES = configure.lineno
EXTRA_DIST = config/config.rpath
@ -104,3 +105,13 @@ uninstall-hook: python-uninstall
if BUILD_MAN
MAINTAINERCLEANFILES = $(dist_man_MANS)
endif
# genstring build
genstring_SOURCES =
EXTRA_DIST += genstring.c
genstring_LDADD = genstring.$(OBJEXT)
genstring_LINK = $(CCLD_FOR_BUILD) -o $@
genstring.$(OBJEXT): genstring.c
$(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(INCLUDES) -c -o $@ `test -f genstring.c || echo '$(srcdir)/'`genstring.c

@ -12,6 +12,14 @@ yasm_SOURCES = frontends/yasm/yasm.c
yasm_SOURCES += frontends/yasm/yasm-options.c
yasm_SOURCES += frontends/yasm/yasm-options.h
$(srcdir)/frontends/yasm/yasm.c: license.c
license.c: $(srcdir)/COPYING genstring$(EXEEXT)
$(top_builddir)/genstring$(EXEEXT) license_msg $@ $(srcdir)/COPYING
BUILT_SOURCES += license.c
CLEANFILES += license.c
yasm_LDADD = libyasm.a $(INTLLIBS)
EXTRA_DIST += frontends/yasm/yasm.xml

@ -38,6 +38,7 @@
#include "yasm-options.h"
#include "license.c"
#define DEFAULT_OBJFMT_MODULE "bin"
@ -118,13 +119,16 @@ static void print_list_keyword_desc(const char *name, const char *keyword);
/* values for special_options */
#define SPECIAL_SHOW_HELP 0x01
#define SPECIAL_SHOW_VERSION 0x02
#define SPECIAL_LISTED 0x04
#define SPECIAL_SHOW_LICENSE 0x04
#define SPECIAL_LISTED 0x08
/* command line options */
static opt_option options[] =
{
{ 0, "version", 0, opt_special_handler, SPECIAL_SHOW_VERSION,
N_("show version text"), NULL },
{ 0, "license", 0, opt_special_handler, SPECIAL_SHOW_LICENSE,
N_("show license text"), NULL },
{ 'h', "help", 0, opt_special_handler, SPECIAL_SHOW_HELP,
N_("show help text"), NULL },
{ 'a', "arch", 1, opt_arch_handler, 0,
@ -169,35 +173,10 @@ static opt_option options[] =
/* version message */
/*@observer@*/ static const char *version_msg[] = {
PACKAGE " " VERSION "\n",
N_("Copyright (c) 2001-2006 Peter Johnson and other"), " " PACKAGE " ",
N_("developers.\n"),
N_("**Licensing summary**\n"),
N_("Note: This summary does not provide legal advice nor is it the\n"),
N_(" actual license. See the individual licenses for complete\n"),
N_(" details. Consult a laywer for legal advice.\n"),
N_("The primary license is the 2-clause BSD license. Please use this\n"),
N_(" license if you plan on submitting code to the project.\n"),
N_("Libyasm:\n"),
N_(" Libyasm is 2-clause or 3-clause BSD licensed, with the exception\n"),
N_(" of bitvect, which is triple-licensed under the Artistic license,\n"),
N_(" GPL, and LGPL. Libyasm is thus GPL and LGPL compatible. In\n"),
N_(" addition, this also means that libyasm is free for binary-only\n"),
N_(" distribution as long as the terms of the 3-clause BSD license and\n"),
N_(" Artistic license (as it applies to bitvect) are fulfilled.\n"),
N_("Modules:\n"),
N_(" Most of the modules are 2-clause BSD licensed, except:\n"),
N_(" preprocs/nasm - LGPL licensed\n"),
N_("Frontends:\n"),
N_(" The frontends are 2-clause BSD licensed.\n"),
N_("License Texts:\n"),
N_(" The full text of all licenses are provided in separate files in\n"),
N_(" this program's source distribution. Each file may include the\n"),
N_(" entire license (in the case of the BSD and Artistic licenses), or\n"),
N_(" may reference the GPL or LGPL license file.\n"),
N_("This program has absolutely no warranty; not even for\n"),
N_("merchantibility or fitness for a particular purpose.\n"),
N_("Compiled on"), " " __DATE__ ".\n",
PACKAGE_STRING,
"Compiled on " __DATE__ ".",
"Copyright (c) 2001-2006 Peter Johnson and other Yasm developers.",
"Run yasm --license for licensing overview and summary."
};
/* help messages */
@ -262,8 +241,12 @@ main(int argc, char *argv[])
help_msg(help_head, help_tail, options, NELEMS(options));
return EXIT_SUCCESS;
case SPECIAL_SHOW_VERSION:
for (i=0; i<sizeof(version_msg)/sizeof(char *); i++)
printf("%s", gettext(version_msg[i]));
for (i=0; i<NELEMS(version_msg); i++)
printf("%s\n", version_msg[i]);
return EXIT_SUCCESS;
case SPECIAL_SHOW_LICENSE:
for (i=0; i<NELEMS(license_msg); i++)
printf("%s\n", license_msg[i]);
return EXIT_SUCCESS;
case SPECIAL_LISTED:
/* Printed out earlier */

@ -0,0 +1,103 @@
/* $Id$
*
* Generate array-of-const-string from text file.
*
* Copyright (C) 2006 Peter Johnson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXLINE 1024
int
main(int argc, char *argv[])
{
FILE *in, *out;
int i;
char *str;
char *strp;
char *charp;
size_t len;
if (argc < 4) {
fprintf(stderr, "Usage: %s <string> <outfile> <file> [<file> ...]\n",
argv[0]);
return EXIT_FAILURE;
}
out = fopen(argv[2], "wt");
if (!out) {
fprintf(stderr, "Could not open `%s'.\n", argv[2]);
return EXIT_FAILURE;
}
str = malloc(MAXLINE);
fprintf(out, "/* This file auto-generated from %s by genstring.c"
" - don't edit it */\n\n"
"static const char *%s[] = {\n", argv[3], argv[1]);
for (i=3; i<argc; i++) {
in = fopen(argv[i], "rt");
if (!in) {
fprintf(stderr, "Could not open `%s'.\n", argv[i]);
fclose(out);
remove(argv[2]);
return EXIT_FAILURE;
}
while (fgets(str, MAXLINE, in)) {
strp = str;
/* strip off trailing whitespace */
len = strlen(strp);
while (len > 0 && (strp[len-1] == ' ' || strp[len-1] == '\t' ||
strp[len-1] == '\n')) {
strp[len-1] = '\0';
len--;
}
/* output as string to output file */
fprintf(out, " \"");
while (*strp != '\0') {
if (*strp == '\\' || *strp == '"')
fputc('\\', out);
fputc(*strp, out);
strp++;
}
fprintf(out, "\",\n");
}
fclose(in);
}
fprintf(out, "};\n");
fclose(out);
free(str);
return EXIT_SUCCESS;
}
Loading…
Cancel
Save