da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/***********************************************************************
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* This software is part of the ast package *
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner* Copyright (c) 1985-2010 AT&T Intellectual Property *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* and is licensed under the *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Common Public License, Version 1.0 *
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin* by AT&T Intellectual Property *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* A copy of the License is available at *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* http://www.opensource.org/licenses/cpl1.0.txt *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Information and Software Systems Research *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* AT&T Research *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Florham Park NJ *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Glenn Fowler <gsf@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* David Korn <dgk@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* Phong Vo <kpv@research.att.com> *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin* *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin***********************************************************************/
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#pragma prototyped
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Glenn Fowler
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * AT&T Research
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * generate a license comment -- see proto(1)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * NOTE: coded for minimal library dependence
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * not so for the legal department
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef _PPLIB_H
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <ast.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#include <time.h>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef copy
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef BSD /* guess who defines this */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef END
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef INLINE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef TEST
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#undef VERBOSE
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NONE 0
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define INLINE 1
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define TEST 2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define VERBOSE 3
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define USAGE 4
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define OPEN 5
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CPL 6
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define EPL 7
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define BSD 8
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define ZLIB 9
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define MIT 10
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define GPL 11
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define SPECIAL 12
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define NONEXCLUSIVE 13
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define NONCOMMERCIAL 14
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner#define PROPRIETARY 15
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define AUTHOR 0
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CLASS 1
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define COMPANY 2
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CONTRIBUTOR 3
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define CORPORATION 4
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define DOMAIN 5
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define INCORPORATION 6
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define LICENSE 7
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define LOCATION 8
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NOTICE 9
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ORGANIZATION 10
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define PACKAGE 11
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define PARENT 12
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define QUERY 13
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define SINCE 14
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define STYLE 15
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define URL 16
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define URLMD5 17
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define VERSION 18
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define IDS 64
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define COMDATA 70
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define COMLINE (COMDATA+4)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define COMLONG (COMDATA-32)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define COMMENT(x,b,s,u) comment(x,b,s,sizeof(s)-1,u)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define PUT(b,c) (((b)->nxt<(b)->end)?(*(b)->nxt++=(c)):((c),(-1)))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define BUF(b) ((b)->buf)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define USE(b) ((b)->siz=(b)->nxt-(b)->buf,(b)->nxt=(b)->buf,(b)->siz)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define SIZ(b) ((b)->nxt-(b)->buf)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define END(b) (*((b)->nxt>=(b)->end?((b)->nxt=(b)->end-1):(b)->nxt)=0,(b)->nxt-(b)->buf)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#ifndef NiL
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define NiL ((char*)0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#endif
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Buffer_s
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char* buf;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char* nxt;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char* end;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int siz;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin} Buffer_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Item_s
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char* data;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int size;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int quote;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin} Item_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Id_s
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Item_t name;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Item_t value;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin} Id_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * NOTE: key[] element order must match the corresponding macro
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define KEY(s) {s,sizeof(s)-1,0}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic const Item_t key[] =
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("author"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("class"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("company"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("contributor"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("corporation"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("domain"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("incorporation"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("license"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("location"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("notice"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("organization"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("package"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("parent"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("query"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("since"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("type"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("url"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("urlmd5"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin KEY("version"),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {0}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin};
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define ITEMS (sizeof(key)/sizeof(key[0])-1)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin#define LIC(s,c) {s,sizeof(s)-1,c}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic const Item_t lic[] =
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("none", NONE),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("inline", SPECIAL),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("test", TEST),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("verbose", VERBOSE),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("usage", USAGE),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("open", OPEN),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("cpl", OPEN),
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner LIC("epl", OPEN),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("bsd", OPEN),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("zlib", OPEN),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("mit", OPEN),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("gpl", GPL),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("special", SPECIAL),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("nonexclusive", SPECIAL),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("noncommercial", SPECIAL),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin LIC("proprietary", PROPRIETARY),
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {0}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin};
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chintypedef struct Notice_s
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int test;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int type;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int verbose;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int ids;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Item_t item[ITEMS];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Id_t id[IDS];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char cc[3];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin} Notice_t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * return index given <name,size>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic int
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinlookup(register const Item_t* item, const char* name, int size)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register int c;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register int i;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c = name[0];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (i = 0; item[i].data; i++)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == item[i].data[0] && size == item[i].size && !strncmp(name, item[i].data, size))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return i;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return -1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * copy s of size n to b
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * n<0 means 0 terminated string
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic void
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincopy(register Buffer_t* b, register char* s, int n)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (n < 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin n = strlen(s);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (n--)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, *s++);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * center and copy comment line s to p
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * if s==0 then
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * n>0 first frame line
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * n=0 blank line
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * n<0 last frame line
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * if u>0 then s converted to upper case
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * if u<0 then s is left justified
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic void
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincomment(Notice_t* notice, register Buffer_t* b, register char* s, register int n, int u)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register int i;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register int m;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register int x;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int cc;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin cc = notice->cc[1];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!s)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (n)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, notice->cc[n > 0 ? 0 : 1]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (i = 0; i < COMDATA; i++)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, cc);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, notice->cc[n > 0 ? 1 : 2]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s = "";
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (s)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (n > COMDATA)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin n = COMDATA;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, cc);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin m = (u < 0) ? 1 : (COMDATA - n) / 2;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if ((x = COMDATA - m - n) < 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin n--;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (m-- > 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, ' ');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (n-- > 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin i = *s++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (u > 0 && i >= 'a' && i <= 'z')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin i = i - 'a' + 'A';
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, i);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (x-- > 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, ' ');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, cc);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, '\n');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * expand simple ${...}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic void
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinexpand(Notice_t* notice, register Buffer_t* b, const Item_t* item)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register char* t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register char* e;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register int q;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register char* x;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register char* z;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register int c;
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner int m;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (t = item->data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin q = item->quote;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin e = t + item->size;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (t < e)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (*t == '$' && t < (e + 2) && *(t + 1) == '{')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner m = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin x = t += 2;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (t < e && (c = *t++) != '}')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == '.')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin x = t;
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner else if (c == '/')
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner {
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner m = 1;
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner break;
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if ((c = lookup(key, x, t - x - 1)) >= 0 && (x = notice->item[c].data))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin z = x + notice->item[c].size;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (x < z)
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner {
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner c = *x++;
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner if (!m || c >= '0' && c <= '9')
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner PUT(b, c);
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner if (m)
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner while (t < e && *t++ != '}');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (q > 0 && *t == '\\' && (*(t + 1) == q || *(t + 1) == '\\'))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin t++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, *t++);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * generate a copright notice
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinstatic void
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chincopyright(Notice_t* notice, register Buffer_t* b)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register char* x;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register char* t;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin time_t clock;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(b, "Copyright (c) ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice->test)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin clock = (time_t)1000212300;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin time(&clock);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin t = ctime(&clock) + 20;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if ((x = notice->item[SINCE].data) && strncmp(x, t, 4))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(notice, b, &notice->item[SINCE]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, '-');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(b, t, 4);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice->item[PARENT].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, ' ');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(notice, b, &notice->item[PARENT]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice->item[CORPORATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, ' ');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(notice, b, &notice->item[CORPORATION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice->item[INCORPORATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, ' ');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(notice, b, &notice->item[INCORPORATION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice->item[COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(b, ' ');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(notice, b, &notice->item[COMPANY]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin/*
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * read the license file and generate a comment in p, length size
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * license length in p returned, -1 on error
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * -1 return places 0 terminated error string in p
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin */
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinint
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chinastlicense(char* p, int size, char* file, char* options, int cc1, int cc2, int cc3)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin{
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register char* s;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register char* v;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register char* x;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin register int c;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int i;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int h;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int k;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int n;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int q;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int contributor;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int first;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int line;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin int quote;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char tmpbuf[COMLINE];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin char info[8 * 1024];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Notice_t notice;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Item_t item;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Buffer_t buf;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Buffer_t tmp;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin buf.end = (buf.buf = buf.nxt = p) + size;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin tmp.end = (tmp.buf = tmp.nxt = tmpbuf) + sizeof(tmpbuf);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (file && *file)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if ((i = open(file, O_RDONLY)) < 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, file, -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, ": cannot open", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return -1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin n = read(i, info, sizeof(info) - 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin close(i);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (n < 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, file, -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, ": cannot read", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return -1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s = info;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s[n] = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (!options)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s = options;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin options = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.test = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.type = NONE;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.verbose = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.ids = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.cc[0] = cc1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.cc[1] = cc2;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.cc[2] = cc3;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (i = 0; i < ITEMS; i++)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.item[i].data = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.item[STYLE] = notice.item[CLASS] = lic[notice.type];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.item[STYLE].quote = notice.item[CLASS].quote = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin contributor = i = k = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin line = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (;;)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz first = 1;
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz while (c = *s)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (c == ' ' || c == '\t' || c == '\n' && ++line || c == '\r' || c == ',' || c == ';' || c == ')')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c = *++s;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!c)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == '#')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (*++s && *s != '\n');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (*s)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin line++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin continue;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == '\n')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin line++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin continue;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == '[')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c = *++s;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin x = s;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin n = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (c && c != '=' && c != ']' && c != ')' && c != ',' && c != ' ' && c != '\t' && c != '\n' && c != '\r')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c = *++s;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin n = s - x;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h = lookup(key, x, n);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == ']')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c = *++s;
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner quote = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == '=' || first)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == '=')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin q = ((c = *++s) == '"' || c == '\'') ? *s++ : 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == '(')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (h == LICENSE)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin contributor = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (h == CONTRIBUTOR)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin contributor = 1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin q = 1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin i = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (;;)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin switch (*s++)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case 0:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s--;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case '(':
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!i)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin q++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin continue;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case ')':
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!i && !--q)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin continue;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case '"':
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case '\'':
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!i)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin i = *(s - 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (i == *(s - 1))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin i = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin continue;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case '\\':
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (*s == i && i == '"')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin i++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin continue;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case '\n':
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin line++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin continue;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin default:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin continue;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin continue;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin v = s;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while ((c = *s) && (q == '"' && (c == '\\' && (*(s + 1) == '"' || *(s + 1) == '\\') && s++ && (quote = q)) || q && c != q || !q && c != ' ' && c != '\t' && c != '\n' && c != '\r' && c != ',' && c != ';'))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == '\n')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin line++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h = STYLE;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin v = x;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (c == '\n')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin line++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (contributor)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (i = 0; i < notice.ids; i++)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (n == notice.id[i].name.size && !strncmp(x, notice.id[i].name.data, n))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (i < IDS)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.id[i].name.data = x;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.id[i].name.size = n;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.id[i].name.quote = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.id[i].value.data = v;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.id[i].value.size = s - v;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.id[i].value.quote = quote;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.ids <= i)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.ids = i + 1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (h == QUERY)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if ((s - v) == 3 && v[0] == 'a' && v[1] == 'l' && v[2] == 'l')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (i = 0; i < ITEMS; i++)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[i].size)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &buf, &key[i]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, '=');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (h = 0;; h++)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (h >= notice.item[i].size)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.item[i].data[h] == ' ' || notice.item[i].data[h] == '\t')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (h)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, '\'');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &buf, &notice.item[i]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (h)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, '\'');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, '\n');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if ((h = lookup(key, v, s - v)) < 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin item.data = v;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin item.size = s - v;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin item.quote = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &buf, &item);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &buf, &notice.item[h]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, '\n');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return END(&buf);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (h == STYLE)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin switch (c = lookup(lic, v, s - v))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case NONE:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case TEST:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.test = 1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h = -1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case VERBOSE:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.verbose = 1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h = -1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case USAGE:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.type = c;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h = -1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin case -1:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin c = SPECIAL;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin /*FALLTHROUGH*/
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin default:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.type = c;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.item[CLASS].data = lic[lic[c].quote].data;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.item[CLASS].size = lic[lic[c].quote].size;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (h >= 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.item[h].data = (notice.item[h].size = s - v) ? v : (char*)0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.item[h].quote = quote;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin k = 1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (file)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, "\"", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, file, -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, "\", line ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin x = &tmpbuf[sizeof(tmpbuf)];
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin *--x = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin line++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin do *--x = ("0123456789")[line % 10]; while (line /= 10);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, x, -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, ": ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, "option error: assignment expected", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return -1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (*s)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin s++;
34f9b3eef6fdadbda0a846aa4d68691ac40eace5Roland Mainz first = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!options || !*(s = options))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin options = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!k)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.type == INLINE && (!notice.verbose || !notice.item[NOTICE].data))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.type != USAGE)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!notice.type)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin notice.type = SPECIAL;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 1, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[PACKAGE].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "This software is part of the ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[PACKAGE]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " package", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.type >= OPEN)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copyright(&notice, &tmp);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.type >= SPECIAL)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "All Rights Reserved", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner if (notice.type == CPL || notice.type == EPL)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, notice.item[PACKAGE].data ? "and" : "This software", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " is licensed under the", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner if (notice.type == EPL)
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner copy(&tmp, "Eclipse Public License", -1);
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner else
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner copy(&tmp, "Common Public License", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[VERSION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, ", Version ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[VERSION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[CORPORATION].data || notice.item[COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "by ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[PARENT].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[PARENT]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[CORPORATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[CORPORATION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[INCORPORATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[INCORPORATION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.item[COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[COMPANY]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "A copy of the License is available at", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[URL].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[URL]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[URLMD5].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "(with md5 checksum ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[URLMD5]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, ")", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner else if (notice.type == EPL)
3e14f97f673e8a630f076077de35afdd43dc1587Roger A. Faulkner COMMENT(&notice, &buf, "http://www.eclipse.org/org/documents/epl-v10.html", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "http://www.opensource.org/licenses/cpl", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.type == OPEN)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, notice.item[PACKAGE].data ? "and it" : "This software", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " may only be used by you under license from", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[i = CORPORATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[PARENT].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[i = PARENT]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[CORPORATION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.item[i = COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[PARENT].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[i = PARENT]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[COMPANY]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin i = -1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[URL].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "A copy of the Source Code Agreement is available", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "at the ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (i >= 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[i]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " Internet web site URL", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[URL]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[URLMD5].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "(with an md5 checksum of ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[URLMD5]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, ")", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "If you have copied or used this software without agreeing", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "to the terms of the license you are infringing on", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "the license and copyright and are violating", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (i >= 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[i]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "'s", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (n >= COMLONG)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&tmp, ' ');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "intellectual property rights.", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.type == GPL)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "This is free software; you can redistribute it and/or", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "modify it under the terms of the GNU General Public License", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "as published by the Free Software Foundation;", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "either version 2, or (at your option) any later version.", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "This software is distributed in the hope that it", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "will be useful, but WITHOUT ANY WARRANTY;", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "without even the implied warranty of MERCHANTABILITY", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "or FITNESS FOR A PARTICULAR PURPOSE.", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "See the GNU General Public License for more details.", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "You should have received a copy of the", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "GNU General Public License", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "along with this software (see the file COPYING.)", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "If not, a copy is available at", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "http://www.gnu.org/copyleft/gpl.html", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.type == BSD)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "Redistribution and use in source and binary forms, with or", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "without modification, are permitted provided that the following", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "conditions are met:", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " 1. Redistributions of source code must retain the above", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " copyright notice, this list of conditions and the", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " following disclaimer.", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " 2. Redistributions in binary form must reproduce the above", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " copyright notice, this list of conditions and the", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " following disclaimer in the documentation and/or other", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " materials provided with the distribution.", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " 3. Neither the name of ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[i = PARENT].data || notice.item[i = CORPORATION].data || notice.item[i = COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[i]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "the copyright holder", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " nor the", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " names of its contributors may be used to endorse or", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " promote products derived from this software without", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " specific prior written permission.", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "POSSIBILITY OF SUCH DAMAGE.", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.type == ZLIB)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "This software is provided 'as-is', without any express or implied", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "warranty. In no event will the authors be held liable for any", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "damages arising from the use of this software.", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "Permission is granted to anyone to use this software for any", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "purpose, including commercial applications, and to alter it and", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "redistribute it freely, subject to the following restrictions:", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " 1. The origin of this software must not be misrepresented;", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " you must not claim that you wrote the original software. If", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " you use this software in a product, an acknowledgment in the", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " product documentation would be appreciated but is not", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " required.", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " 2. Altered source versions must be plainly marked as such,", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " and must not be misrepresented as being the original", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " software.", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " 3. This notice may not be removed or altered from any source", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, " distribution.", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.type == MIT)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "Permission is hereby granted, free of charge, to any person", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "obtaining a copy of this software and associated", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "documentation files (the \"Software\"), to deal in the", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "Software without restriction, including without limitation", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "the rights to use, copy, modify, merge, publish, distribute,", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "sublicense, and/or sell copies of the Software, and to", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "permit persons to whom the Software is furnished to do so,", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "subject to the following conditions:", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "The above copyright notice and this permission notice shall", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "be included in all copies or substantial portions of the", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "Software.", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.type == PROPRIETARY)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[i = PARENT].data || notice.item[i = CORPORATION].data || notice.item[i = COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[i]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " - ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin i = -1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "Proprietary", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[URL].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "This is proprietary source code", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (i >= 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " licensed by", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[PARENT].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[PARENT]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[CORPORATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[CORPORATION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.item[COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[COMPANY]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "This is unpublished proprietary source code", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (i >= 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " of", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[i = PARENT].data || notice.item[i = CORPORATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[i]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (SIZ(&tmp))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&tmp, ' ');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[COMPANY]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (SIZ(&tmp))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "and is not to be disclosed or used except in", 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "accordance with applicable agreements", 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.type == NONEXCLUSIVE)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "For nonexclusive individual use", 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.type == NONCOMMERCIAL)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "For noncommercial use", 1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.type >= PROPRIETARY && !notice.item[URL].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "Unpublished & Not for Publication", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[URL].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "This software is licensed", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[CORPORATION].data || notice.item[COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " by", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if ((notice.item[PARENT].size + (notice.item[CORPORATION].data ? (notice.item[CORPORATION].size + notice.item[INCORPORATION].size) : notice.item[COMPANY].size)) >= (COMLONG - 6))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&tmp, ' ');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[PARENT].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[PARENT]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[CORPORATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[CORPORATION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[INCORPORATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, " ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[INCORPORATION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.item[COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[COMPANY]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "under the terms and conditions of the license in", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[URL]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[URLMD5].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, "(with an md5 checksum of ", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[URLMD5]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&tmp, ")", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else if (notice.type == PROPRIETARY)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "The copyright notice above does not evidence any", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "actual or intended publication of such source code", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (v = notice.item[NOTICE].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin x = v + notice.item[NOTICE].size;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (*v == '\n')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin v++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin item.quote = notice.item[NOTICE].quote;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin do
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (item.data = v; v < x && *v != '\n'; v++);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if ((item.size = v - item.data) && *item.data == '\t')
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin item.data++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin item.size--;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h = -1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &item);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), h);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin } while (v++ < x);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (item.size)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[ORGANIZATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[ORGANIZATION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[i = PARENT].data || notice.item[i = CORPORATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[i]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[COMPANY].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (SIZ(&tmp))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&tmp, ' ');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[COMPANY]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (SIZ(&tmp))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[LOCATION].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.item[LOCATION]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (v = notice.item[AUTHOR].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin x = v + notice.item[AUTHOR].size;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin q = (x - v) == 1 && (*v == '*' || *v == '-');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin k = q && notice.type != USAGE ? -1 : 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (;;)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!q)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (v < x && (*v == ' ' || *v == '\t' || *v == '\r' || *v == '\n' || *v == ',' || *v == '+'))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin v++;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (v >= x)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin item.data = v;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin while (v < x && *v != ',' && *v != '+' && *v++ != '>');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin item.size = v - item.data;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin item.quote = notice.item[AUTHOR].quote;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h = 0;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin for (i = 0; i < notice.ids; i++)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (q || item.size == notice.id[i].name.size && !strncmp(item.data, notice.id[i].name.data, item.size))
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin h = 1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.type == USAGE)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, "[-author?", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &buf, &notice.id[i].value);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, ']');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (k < 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "CONTRIBUTORS", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin k = 1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &notice.id[i].value);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!q)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (q)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin break;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (!h)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.type == USAGE)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, "[-author?", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &buf, &item);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, ']');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (k < 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin COMMENT(&notice, &buf, "CONTRIBUTORS", 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin k = 1;
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &tmp, &item);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, BUF(&tmp), USE(&tmp), 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (k > 0)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, 0, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.type == USAGE)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, "[-copyright?", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copyright(&notice, &buf);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, ']');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin if (notice.item[URL].data)
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin {
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin copy(&buf, "[-license?", -1);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin expand(&notice, &buf, &notice.item[URL]);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, ']');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin PUT(&buf, '\n');
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin }
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin else
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin comment(&notice, &buf, NiL, -1, 0);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin return END(&buf);
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin}