diff options
563 files changed, 3985 insertions, 3978 deletions
diff --git a/lib/csu/i386/c++rt0.c b/lib/csu/i386/c++rt0.c index 44da43849482..df859071e516 100644 --- a/lib/csu/i386/c++rt0.c +++ b/lib/csu/i386/c++rt0.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: c++rt0.c,v 1.2 1994/01/29 01:58:31 jtc Exp $ + * $Id: c++rt0.c,v 1.1 1994/03/09 17:12:59 nate Exp $ */ /* @@ -46,7 +46,7 @@ __dtors(void) { unsigned long i = (unsigned long) __DTOR_LIST__[0]; void (**p)(void) = __DTOR_LIST__ + i; - + while (i--) (**p--)(); } diff --git a/lib/libc/db/btree/bt_close.c b/lib/libc/db/btree/bt_close.c index 66d8fc158174..6269bd5c8ac0 100644 --- a/lib/libc/db/btree/bt_close.c +++ b/lib/libc/db/btree/bt_close.c @@ -157,7 +157,7 @@ __bt_sync(dbp, flags) goto ecrsr; mpool_put(t->bt_mp, h, MPOOL_DIRTY); } - + if ((status = mpool_sync(t->bt_mp)) == RET_SUCCESS) CLR(t, B_MODIFIED); diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c index ec79cf75fbd2..f156745f9700 100644 --- a/lib/libc/db/btree/bt_open.c +++ b/lib/libc/db/btree/bt_open.c @@ -196,7 +196,7 @@ __bt_open(fname, flags, mode, openinfo, dflags) default: goto einval; } - + if ((t->bt_fd = open(fname, flags, mode)) < 0) goto err; diff --git a/lib/libc/db/hash/hash.h b/lib/libc/db/hash/hash.h index cfbedaa0ac99..1c80f83c69d5 100644 --- a/lib/libc/db/hash/hash.h +++ b/lib/libc/db/hash/hash.h @@ -185,7 +185,7 @@ typedef struct htab { /* Memory resident data structure */ * so it starts on this page and continues on the next. * The format of the page is: * KEY_OFF PARTIAL_KEY OVFL_PAGENO OVFLPAGE - * + * * KEY_OFF -- offset of the beginning of the key * PARTIAL_KEY -- 1 * OVFL_PAGENO - page number of the next overflow page @@ -220,7 +220,7 @@ typedef struct htab { /* Memory resident data structure */ * OVFL_PAGENO - page number of the next overflow page * OVFLPAGE -- 0 * - * FULL_KEY_DATA + * FULL_KEY_DATA * This must be the first key/data pair on the page. * There are two cases: * diff --git a/lib/libc/db/hash/hash_page.c b/lib/libc/db/hash/hash_page.c index 2b2f57264b06..7b018cbea45c 100644 --- a/lib/libc/db/hash/hash_page.c +++ b/lib/libc/db/hash/hash_page.c @@ -688,7 +688,7 @@ overflow_page(hashp) in_use_bits = free_bit; else in_use_bits = (hashp->BSIZE << BYTE_SHIFT) - 1; - + if (i == first_page) { bit = hashp->LAST_FREED & ((hashp->BSIZE << BYTE_SHIFT) - 1); diff --git a/lib/libc/db/mpool/mpool.c b/lib/libc/db/mpool/mpool.c index 72627bddade3..562c7f5e98fc 100644 --- a/lib/libc/db/mpool/mpool.c +++ b/lib/libc/db/mpool/mpool.c @@ -94,7 +94,7 @@ mpool_open(key, fd, pagesize, maxcache) mp->free.cnext = mp->free.cprev = (BKT *)&mp->free; mp->lru.cnext = mp->lru.cprev = (BKT *)&mp->lru; for (entry = 0; entry < HASHSIZE; ++entry) - mp->hashtable[entry].hnext = mp->hashtable[entry].hprev = + mp->hashtable[entry].hnext = mp->hashtable[entry].hprev = mp->hashtable[entry].cnext = mp->hashtable[entry].cprev = (BKT *)&mp->hashtable[entry]; mp->curcache = 0; @@ -106,8 +106,8 @@ mpool_open(key, fd, pagesize, maxcache) mp->pgin = mp->pgout = NULL; #ifdef STATISTICS - mp->cachehit = mp->cachemiss = mp->pagealloc = mp->pageflush = - mp->pageget = mp->pagenew = mp->pageput = mp->pageread = + mp->cachehit = mp->cachemiss = mp->pagealloc = mp->pageflush = + mp->pageget = mp->pagenew = mp->pageput = mp->pageread = mp->pagewrite = 0; #endif return (mp); @@ -132,7 +132,7 @@ mpool_filter(mp, pgin, pgout, pgcookie) mp->pgout = pgout; mp->pgcookie = pgcookie; } - + /* * MPOOL_NEW -- get a new page * @@ -335,7 +335,7 @@ mpool_sync(mp) * mp: mpool cookie * * Returns: - * NULL on failure and a pointer to the BKT on success + * NULL on failure and a pointer to the BKT on success */ static BKT * mpool_bkt(mp) @@ -478,7 +478,7 @@ mpool_stat(mp) mp->pagealloc, mp->pageflush); if (mp->cachehit + mp->cachemiss) (void)fprintf(stderr, - "%.0f%% cache hit rate (%lu hits, %lu misses)\n", + "%.0f%% cache hit rate (%lu hits, %lu misses)\n", ((double)mp->cachehit / (mp->cachehit + mp->cachemiss)) * 100, mp->cachehit, mp->cachemiss); (void)fprintf(stderr, "%lu page reads, %lu page writes\n", @@ -497,7 +497,7 @@ mpool_stat(mp) cnt = 0; } else sep = ", "; - + } (void)fprintf(stderr, "\n"); } diff --git a/lib/libc/db/recno/rec_put.c b/lib/libc/db/recno/rec_put.c index 8c3bae573f38..590d45b4f919 100644 --- a/lib/libc/db/recno/rec_put.c +++ b/lib/libc/db/recno/rec_put.c @@ -143,7 +143,7 @@ einval: errno = EINVAL; if (flags == R_SETCURSOR) t->bt_rcursor = nrec; - + SET(t, R_MODIFIED); return (__rec_ret(t, NULL, nrec, key, NULL)); } diff --git a/lib/libc/db/recno/rec_search.c b/lib/libc/db/recno/rec_search.c index 5d5df3c7fefd..a1feff8a4173 100644 --- a/lib/libc/db/recno/rec_search.c +++ b/lib/libc/db/recno/rec_search.c @@ -93,7 +93,7 @@ __rec_search(t, recno, op) if (__bt_push(t, pg, index - 1) == RET_ERROR) return (NULL); - + pg = r->pgno; switch (op) { case SDELETE: diff --git a/lib/libc/db/recno/rec_seq.c b/lib/libc/db/recno/rec_seq.c index bc66d1c4987e..56f78e764c51 100644 --- a/lib/libc/db/recno/rec_seq.c +++ b/lib/libc/db/recno/rec_seq.c @@ -107,7 +107,7 @@ __rec_seq(dbp, key, data, flags) einval: errno = EINVAL; return (RET_ERROR); } - + if (t->bt_nrecs == 0 || nrec > t->bt_nrecs) { if (!ISSET(t, R_EOF | R_INMEM) && (status = t->bt_irec(t, nrec)) != RET_SUCCESS) diff --git a/lib/libc/db/test/btree.tests/main.c b/lib/libc/db/test/btree.tests/main.c index f26e193562b3..39c1da0519ce 100644 --- a/lib/libc/db/test/btree.tests/main.c +++ b/lib/libc/db/test/btree.tests/main.c @@ -629,7 +629,7 @@ load(db, argv) key.size = sizeof(recno_t); data.data = lp; data.size = len + 1; - } else { + } else { key.data = lp; key.size = len + 1; for (p = lp + len - 1, t = buf; p >= lp; *t++ = *p--); diff --git a/lib/libc/db/test/dbtest.c b/lib/libc/db/test/dbtest.c index b8f97dc1ba78..c526415a7a09 100644 --- a/lib/libc/db/test/dbtest.c +++ b/lib/libc/db/test/dbtest.c @@ -337,7 +337,7 @@ get(dbp, kp) /* NOTREACHED */ case 1: (void)write(ofd, NOSUCHKEY, sizeof(NOSUCHKEY) - 1); - (void)fprintf(stderr, "%d: %.*s: %s\n", + (void)fprintf(stderr, "%d: %.*s: %s\n", lineno, kp->size, kp->data, NOSUCHKEY); break; } @@ -443,7 +443,7 @@ dump(dbp, rev) } done: return; } - + u_int setflags(s) char *s; @@ -476,7 +476,7 @@ setflags(s) err("line %lu: %s: unknown flag", lineno, s); /* NOTREACHED */ } - + DBTYPE dbtype(s) char *s; @@ -506,7 +506,7 @@ setinfo(type, s) *eq++ = '\0'; if (!isdigit(*eq)) err("%s: structure set statement must be a number", s); - + switch(type) { case DB_BTREE: if (!strcmp("flags", s)) { diff --git a/lib/libc/db/test/hash.tests/driver2.c b/lib/libc/db/test/hash.tests/driver2.c index 2008a2899c3b..896820c7fcae 100644 --- a/lib/libc/db/test/hash.tests/driver2.c +++ b/lib/libc/db/test/hash.tests/driver2.c @@ -110,5 +110,5 @@ main(argc, argv) exit(0); } - + diff --git a/lib/libc/db/test/hash.tests/tcreat3.c b/lib/libc/db/test/hash.tests/tcreat3.c index bd125ac6ee7a..31211c537d19 100644 --- a/lib/libc/db/test/hash.tests/tcreat3.c +++ b/lib/libc/db/test/hash.tests/tcreat3.c @@ -97,7 +97,7 @@ char **argv; fprintf(stderr, "cannot enter: key %s\n", item.data); exit(1); - } + } } (dbp->close)(dbp); diff --git a/lib/libc/db/test/hash.tests/tdel.c b/lib/libc/db/test/hash.tests/tdel.c index ed3f90ad7f2e..fb994318c5ea 100644 --- a/lib/libc/db/test/hash.tests/tdel.c +++ b/lib/libc/db/test/hash.tests/tdel.c @@ -99,7 +99,7 @@ char **argv; fprintf(stderr, "cannot enter: key %s\n", item.data); exit(1); - } + } } if ( --argc ) { @@ -113,7 +113,7 @@ char **argv; if (stat) { fprintf ( stderr, "Error retrieving %s\n", key.data ); exit(1); - } + } } fclose(fp); } diff --git a/lib/libc/db/test/hash.tests/thash4.c b/lib/libc/db/test/hash.tests/thash4.c index 9e344cb83323..952dccbd5bbd 100644 --- a/lib/libc/db/test/hash.tests/thash4.c +++ b/lib/libc/db/test/hash.tests/thash4.c @@ -86,8 +86,8 @@ char **argv; key.data = wp1; item.data = wp2; - while ( fgets(wp1, 8192, stdin) && - fgets(wp2, 8192, stdin) && + while ( fgets(wp1, 8192, stdin) && + fgets(wp2, 8192, stdin) && i++ < MAXWORDS) { /* * put info in structure, and structure in the item @@ -103,14 +103,14 @@ char **argv; item.data); fprintf(stderr, "\terrno: %d\n", errno); exit(1); - } + } } if ( --argc ) { fp = fopen ( argv[0], "r"); i = 0; - while ( fgets(wp1, 256, fp) && - fgets(wp2, 8192, fp) && + while ( fgets(wp1, 256, fp) && + fgets(wp2, 8192, fp) && i++ < MAXWORDS) { key.size = strlen(wp1); diff --git a/lib/libc/db/test/hash.tests/tseq.c b/lib/libc/db/test/hash.tests/tseq.c index f45700e5c007..f41c172fa5b0 100644 --- a/lib/libc/db/test/hash.tests/tseq.c +++ b/lib/libc/db/test/hash.tests/tseq.c @@ -72,7 +72,7 @@ char **argv; /* * put info in structure, and structure in the item */ - for ( stat = (dbp->seq) (dbp, &res, &item, 1 ); + for ( stat = (dbp->seq) (dbp, &res, &item, 1 ); stat == 0; stat = (dbp->seq) (dbp, &res, &item, 0 ) ) { diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index bad41ef998bf..69a434d85daa 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -1,5 +1,5 @@ # From: @(#)Makefile.inc 8.3 (Berkeley) 4/16/94 -# $Id: Makefile.inc,v 1.14 1994/11/13 20:47:41 phk Exp $ +# $Id: Makefile.inc,v 1.15 1994/12/18 14:06:38 guido Exp $ # machine-independent gen sources .PATH: ${.CURDIR}/${MACHINE}/gen ${.CURDIR}/gen @@ -56,7 +56,7 @@ MAN3+= gen/alarm.3 gen/clock.3 gen/confstr.3 gen/config_open.3 \ gen/uname.3 gen/unvis.3 gen/usleep.3 gen/utime.3 gen/valloc.3 gen/vis.3 MLINKS+=config_open.3 config_next.3 config_open.3 config_close.3 \ - config_open.3 config_skip.3 + config_open.3 config_skip.3 MLINKS+=crypt.3 encrypt.3 crypt.3 setkey.3 MLINKS+=directory.3 closedir.3 directory.3 dirfd.3 directory.3 opendir.3 \ directory.3 readdir.3 directory.3 rewinddir.3 directory.3 seekdir.3 \ diff --git a/lib/libc/gen/__xuname.c b/lib/libc/gen/__xuname.c index 1511c1f957fe..63f29566660b 100644 --- a/lib/libc/gen/__xuname.c +++ b/lib/libc/gen/__xuname.c @@ -34,7 +34,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char sccsid[] = "From: @(#)uname.c 8.1 (Berkeley) 1/4/94";*/ static const char rcsid[] = - "$Id$"; + "$Id: uname.c,v 1.2 1994/10/13 20:31:19 wollman Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -58,7 +58,7 @@ uname(name) len = sizeof(name->sysname); oerrno = errno; if (sysctl(mib, 2, &name->sysname, &len, NULL, 0) == -1) { - if(errno == ENOMEM) + if(errno == ENOMEM) errno = oerrno; else rval = -1; @@ -69,7 +69,7 @@ uname(name) len = sizeof(name->nodename); oerrno = errno; if (sysctl(mib, 2, &name->nodename, &len, NULL, 0) == -1) { - if(errno == ENOMEM) + if(errno == ENOMEM) errno = oerrno; else rval = -1; @@ -80,7 +80,7 @@ uname(name) len = sizeof(name->release); oerrno = errno; if (sysctl(mib, 2, &name->release, &len, NULL, 0) == -1) { - if(errno == ENOMEM) + if(errno == ENOMEM) errno = oerrno; else rval = -1; diff --git a/lib/libc/gen/config.c b/lib/libc/gen/config.c index 6ea292b78b13..ffe276697990 100644 --- a/lib/libc/gen/config.c +++ b/lib/libc/gen/config.c @@ -6,12 +6,12 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: config.c,v 1.1 1994/11/13 20:47:43 phk Exp $ * */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Id: config.c,v 1.1 1994/01/14 12:24:39 jkh Exp $"; +static char rcsid[] = "$Id: config.c,v 1.1 1994/11/13 20:47:43 phk Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -21,7 +21,7 @@ static char rcsid[] = "$Id: config.c,v 1.1 1994/01/14 12:24:39 jkh Exp $"; * Will open the named file, read it into a private malloc'ed area, * and close the file again. * All lines where the first !isspace() char is '#' are deleted. - * If contlines are non-zero lines where the first char is isspace() + * If contlines are non-zero lines where the first char is isspace() * will be joined to the preceeding line. * In case of trouble the name of the offending system call will be * returned. On success NULL is returned. @@ -93,8 +93,8 @@ config_open(const char *filename, int contlines) /* * /^[ \t]*#[^\n]*$/d - * - * Delete all lines where the first !isspace() char is '#' + * + * Delete all lines where the first !isspace() char is '#' */ ptr = file_buf; diff --git a/lib/libc/gen/crypt.c b/lib/libc/gen/crypt.c index 1aad9c6e2ae9..1ffb7366a760 100644 --- a/lib/libc/gen/crypt.c +++ b/lib/libc/gen/crypt.c @@ -36,7 +36,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /* from static char sccsid[] = "@(#)crypt.c 5.11 (Berkeley) 6/25/91"; */ -static char rcsid[] = "$Header: /a/cvs/386BSD/src/lib/libc/gen/crypt.c,v 1.6 1993/08/29 22:03:56 nate Exp $"; +static char rcsid[] = "$Header: /home/ncvs/src/lib/libc/gen/crypt.c,v 1.2 1994/08/22 20:38:00 csgr Exp $"; #endif /* LIBC_SCCS and not lint */ #include <unistd.h> @@ -44,7 +44,7 @@ static char rcsid[] = "$Header: /a/cvs/386BSD/src/lib/libc/gen/crypt.c,v 1.6 199 /* * UNIX password, and DES, encryption. - * + * * since this is non-exportable, this is just a dummy. if you want real * encryption, make sure you've got libcrypt.a around. */ diff --git a/lib/libc/gen/fnmatch.c b/lib/libc/gen/fnmatch.c index dc7f151194e3..0c2ca13d16d6 100644 --- a/lib/libc/gen/fnmatch.c +++ b/lib/libc/gen/fnmatch.c @@ -149,13 +149,13 @@ rangematch(pattern, test, flags) */ if (negate = (*pattern == '!' || *pattern == '^')) ++pattern; - + for (ok = 0; (c = *pattern++) != ']';) { if (c == '\\' && !(flags & FNM_NOESCAPE)) c = *pattern++; if (c == EOS) return (NULL); - if (*pattern == '-' + if (*pattern == '-' && (c2 = *(pattern+1)) != EOS && c2 != ']') { pattern += 2; if (c2 == '\\' && !(flags & FNM_NOESCAPE)) diff --git a/lib/libc/gen/fts-compat.c b/lib/libc/gen/fts-compat.c index 97a7048fa9d6..3915b008b953 100644 --- a/lib/libc/gen/fts-compat.c +++ b/lib/libc/gen/fts-compat.c @@ -313,7 +313,7 @@ fts_read(sp) } p->fts_info = FTS_DP; return (p); - } + } /* Rebuild if only read the names and now traversing. */ if (sp->fts_child && sp->fts_options & FTS_NAMEONLY) { @@ -508,7 +508,7 @@ fts_children(sp, instr) if (instr == FTS_NAMEONLY) { sp->fts_options |= FTS_NAMEONLY; instr = BNAMES; - } else + } else instr = BCHILD; /* @@ -680,7 +680,7 @@ mem1: saved_errno = errno; p->fts_accpath = cur->fts_accpath; } else if (nlinks == 0 #ifdef DT_DIR - || nlinks > 0 && + || nlinks > 0 && dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN #endif ) { @@ -774,7 +774,7 @@ fts_stat(sp, p, follow) /* If user needs stat info, stat buffer already allocated. */ sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp; - + /* * If doing a logical walk, or application requested FTS_FOLLOW, do * a stat(2). If that fails, check for a non-existent symlink. If @@ -786,7 +786,7 @@ fts_stat(sp, p, follow) if (!lstat(p->fts_accpath, sbp)) { errno = 0; return (FTS_SLNONE); - } + } p->fts_errno = saved_errno; goto err; } @@ -919,7 +919,7 @@ fts_lfree(head) * Allow essentially unlimited paths; find, rm, ls should all work on any tree. * Most systems will allow creation of paths much longer than MAXPATHLEN, even * though the kernel won't resolve them. Add the size (not just what's needed) - * plus 256 bytes so don't realloc the path 2 bytes at a time. + * plus 256 bytes so don't realloc the path 2 bytes at a time. */ static int fts_palloc(sp, more) diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index 97a7048fa9d6..3915b008b953 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -313,7 +313,7 @@ fts_read(sp) } p->fts_info = FTS_DP; return (p); - } + } /* Rebuild if only read the names and now traversing. */ if (sp->fts_child && sp->fts_options & FTS_NAMEONLY) { @@ -508,7 +508,7 @@ fts_children(sp, instr) if (instr == FTS_NAMEONLY) { sp->fts_options |= FTS_NAMEONLY; instr = BNAMES; - } else + } else instr = BCHILD; /* @@ -680,7 +680,7 @@ mem1: saved_errno = errno; p->fts_accpath = cur->fts_accpath; } else if (nlinks == 0 #ifdef DT_DIR - || nlinks > 0 && + || nlinks > 0 && dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN #endif ) { @@ -774,7 +774,7 @@ fts_stat(sp, p, follow) /* If user needs stat info, stat buffer already allocated. */ sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp; - + /* * If doing a logical walk, or application requested FTS_FOLLOW, do * a stat(2). If that fails, check for a non-existent symlink. If @@ -786,7 +786,7 @@ fts_stat(sp, p, follow) if (!lstat(p->fts_accpath, sbp)) { errno = 0; return (FTS_SLNONE); - } + } p->fts_errno = saved_errno; goto err; } @@ -919,7 +919,7 @@ fts_lfree(head) * Allow essentially unlimited paths; find, rm, ls should all work on any tree. * Most systems will allow creation of paths much longer than MAXPATHLEN, even * though the kernel won't resolve them. Add the size (not just what's needed) - * plus 256 bytes so don't realloc the path 2 bytes at a time. + * plus 256 bytes so don't realloc the path 2 bytes at a time. */ static int fts_palloc(sp, more) diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c index f883ec4efbb8..6bb44506ecbb 100644 --- a/lib/libc/gen/getcap.c +++ b/lib/libc/gen/getcap.c @@ -42,7 +42,7 @@ static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94"; #include <ctype.h> #include <db.h> -#include <errno.h> +#include <errno.h> #include <fcntl.h> #include <limits.h> #include <stdio.h> @@ -198,7 +198,7 @@ getent(cap, len, db_array, fd, name, depth, nfield) char *record, *cbuf; int tc_not_resolved; char pbuf[_POSIX_PATH_MAX]; - + /* * Return with ``loop detected'' error if we've recursed more than * MAX_RECURSION times. @@ -306,7 +306,7 @@ getent(cap, len, db_array, fd, name, depth, nfield) for (;;) { if (bp >= b_end) { int n; - + n = read(fd, buf, sizeof(buf)); if (n <= 0) { if (myfd) @@ -323,7 +323,7 @@ getent(cap, len, db_array, fd, name, depth, nfield) b_end = buf+n; bp = buf; } - + c = *bp++; if (c == '\n') { if (rp > record && *(rp-1) == '\\') { @@ -335,7 +335,7 @@ getent(cap, len, db_array, fd, name, depth, nfield) *rp++ = c; /* - * Enforce loop invariant: if no room + * Enforce loop invariant: if no room * left in record buffer, try to get * some more. */ @@ -364,13 +364,13 @@ getent(cap, len, db_array, fd, name, depth, nfield) */ if (eof) break; - + /* * Toss blank lines and comments. */ if (*record == '\0' || *record == '#') continue; - + /* * See if this is the record we want ... */ @@ -431,7 +431,7 @@ tc_exp: { tclen = s - tcstart; tcend = s; - iret = getent(&icap, &ilen, db_p, fd, tc, depth+1, + iret = getent(&icap, &ilen, db_p, fd, tc, depth+1, NULL); newicap = icap; /* Put into a register. */ newilen = ilen; @@ -447,11 +447,11 @@ tc_exp: { tc_not_resolved = 1; /* couldn't resolve tc */ if (iret == -1) { - *(s - 1) = ':'; + *(s - 1) = ':'; scan = s - 1; tc_not_resolved = 1; continue; - + } } /* not interested in name field of tc'ed record */ @@ -514,7 +514,7 @@ tc_exp: { */ scan = s-1; } - + } /* * Close file (if we opened it), give back any extra memory, and @@ -524,17 +524,17 @@ tc_exp: { (void)close(fd); *len = rp - record - 1; /* don't count NUL */ if (r_end > rp) - if ((record = + if ((record = realloc(record, (size_t)(rp - record))) == NULL) { errno = ENOMEM; return (-2); } - + *cap = record; if (tc_not_resolved) return (1); return (0); -} +} static int cdbget(capdbp, bp, name) @@ -564,7 +564,7 @@ cdbget(capdbp, bp, name) key.data = (char *)data.data + 1; key.size = data.size - 1; } - + *bp = (char *)data.data + 1; return (((char *)(data.data))[0] == TCERR ? 1 : 0); } @@ -641,7 +641,7 @@ cgetclose() } /* - * Cgetnext() gets either the first or next entry in the logical database + * Cgetnext() gets either the first or next entry in the logical database * specified by db_array. It returns 0 upon completion of the database, 1 * upon returning an entry with more remaining, and -1 if an error occurs. */ @@ -702,10 +702,10 @@ cgetnext(bp, db_array) slash = 1; else slash = 0; - } + } - /* + /* * Line points to a name line. */ i = 0; @@ -745,12 +745,12 @@ cgetnext(bp, db_array) *rp++ = *cp; *rp = '\0'; - /* - * XXX + /* + * XXX * Last argument of getent here should be nbuf if we want true - * sequential access in the case of duplicates. + * sequential access in the case of duplicates. * With NULL, getent will return the first entry found - * rather than the duplicate entry record. This is a + * rather than the duplicate entry record. This is a * matter of semantics that should be resolved. */ status = getent(bp, &dummy, db_array, -1, buf, 0, NULL); @@ -894,10 +894,10 @@ cgetstr(buf, cap, str) * Cgetustr retrieves the value of the string capability cap from the * capability record pointed to by buf. The difference between cgetustr() * and cgetstr() is that cgetustr does not decode escapes but rather treats - * all characters literally. A pointer to a NUL terminated malloc'd - * copy of the string is returned in the char pointed to by str. The + * all characters literally. A pointer to a NUL terminated malloc'd + * copy of the string is returned in the char pointed to by str. The * length of the string not including the trailing NUL is returned on success, - * -1 if the requested string capability couldn't be found, -2 if a system + * -1 if the requested string capability couldn't be found, -2 if a system * error was encountered (storage allocation failure). */ int @@ -1039,10 +1039,10 @@ nfcmp(nf, rec) { char *cp, tmp; int ret; - + for (cp = rec; *cp != ':'; cp++) ; - + tmp = *(cp + 1); *(cp + 1) = '\0'; ret = strcmp(nf, rec); diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index a13e7c30a9a7..e9b9d1fccd20 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -338,7 +338,7 @@ _getypgroup(struct group *gr, const char *name, char *map) return 0; } - if(yp_match(_gr_yp_domain, map, name, strlen(name), + if(yp_match(_gr_yp_domain, map, name, strlen(name), &result, &resultlen)) return 0; @@ -402,5 +402,5 @@ unpack: } return 1; } - + #endif /* YP */ diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index c60cc4e7f179..1ad838e86bdc 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -192,7 +192,7 @@ innetgr(group, host, user, dom) char *hst, *usr, *dm; /* Sanity check */ - + if (group == NULL || !strlen(group)) return (0); diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 46482b465fa2..22b148559d02 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -355,7 +355,7 @@ _createcaches() n->next = namehead; namehead = n; } - /* + /* * If netgroup 'foo' doesn't exist, * try group 'foo' instead. */ @@ -419,7 +419,7 @@ _createcaches() n->next = namehead; namehead = n; } - /* + /* * If netgroup 'foo' doesn't exist, * try group 'foo' instead. */ @@ -599,7 +599,7 @@ _getyppass(struct passwd *pw, const char *name, const char *map) gotmaster++; } - if(yp_match(_pw_yp_domain, (char *)&mastermap, name, strlen(name), + if(yp_match(_pw_yp_domain, (char *)&mastermap, name, strlen(name), &result, &resultlen)) return 0; @@ -739,5 +739,5 @@ unpack: } return 1; } - + #endif /* YP */ diff --git a/lib/libc/gen/getusershell.c b/lib/libc/gen/getusershell.c index 2bcdaf78bd97..408f9f3664d1 100644 --- a/lib/libc/gen/getusershell.c +++ b/lib/libc/gen/getusershell.c @@ -72,7 +72,7 @@ getusershell() void endusershell() { - + if (shells != NULL) free(shells); shells = NULL; diff --git a/lib/libc/gen/getvfsent.c b/lib/libc/gen/getvfsent.c index 79f9dd4445da..63fb1daf8ffa 100644 --- a/lib/libc/gen/getvfsent.c +++ b/lib/libc/gen/getvfsent.c @@ -83,7 +83,7 @@ getvfsbyname(const char *name) } for(i = 0; i < _vfslistlen; i++) { - if( ! strcmp(_vfslist[i].vfc_name, name) ) + if( ! strcmp(_vfslist[i].vfc_name, name) ) break; } @@ -113,7 +113,7 @@ getvfsbytype(int type) } for(i = 0; i < _vfslistlen; i++) { - if(_vfslist[i].vfc_index == type) + if(_vfslist[i].vfc_index == type) break; } diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c index 8c8e1629d64c..2105f2a79137 100644 --- a/lib/libc/gen/glob.c +++ b/lib/libc/gen/glob.c @@ -58,7 +58,7 @@ static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; * GLOB_TILDE: * expand ~user/foo to the /home/dir/of/user/foo * GLOB_BRACE: - * expand {1,2}{a,b} to 1a 1b 2a 2b + * expand {1,2}{a,b} to 1a 1b 2a 2b * gl_matchc: * Number of matches in the current invocation of glob. */ @@ -173,7 +173,7 @@ glob(pattern, flags, errfunc, pglob) bufend = bufnext + MAXPATHLEN; if (flags & GLOB_QUOTE) { /* Protect the quoted characters. */ - while (bufnext < bufend && (c = *patnext++) != EOS) + while (bufnext < bufend && (c = *patnext++) != EOS) if (c == QUOTE) { if ((c = *patnext++) == EOS) { c = QUOTE; @@ -184,8 +184,8 @@ glob(pattern, flags, errfunc, pglob) else *bufnext++ = c; } - else - while (bufnext < bufend && (c = *patnext++) != EOS) + else + while (bufnext < bufend && (c = *patnext++) != EOS) *bufnext++ = c; *bufnext = EOS; @@ -246,7 +246,7 @@ static int globexp2(ptr, pattern, pglob, rv) for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++) continue; if (*pe == EOS) { - /* + /* * We could not find a matching RBRACKET. * Ignore and just look for RBRACE */ @@ -274,7 +274,7 @@ static int globexp2(ptr, pattern, pglob, rv) for (pl = pm++; *pm != RBRACKET && *pm != EOS; pm++) continue; if (*pm == EOS) { - /* + /* * We could not find a matching RBRACKET. * Ignore and just look for RBRACE */ @@ -299,7 +299,7 @@ static int globexp2(ptr, pattern, pglob, rv) /* Append the current string */ for (lm = ls; (pl < pm); *lm++ = *pl++) continue; - /* + /* * Append the rest of the pattern after the * closing brace */ @@ -344,15 +344,15 @@ globtilde(pattern, patbuf, pglob) return pattern; /* Copy up to the end of the string or / */ - for (p = pattern + 1, h = (char *) patbuf; *p && *p != SLASH; + for (p = pattern + 1, h = (char *) patbuf; *p && *p != SLASH; *h++ = *p++) continue; *h = EOS; if (((char *) patbuf)[0] == EOS) { - /* - * handle a plain ~ or ~/ by expanding $HOME + /* + * handle a plain ~ or ~/ by expanding $HOME * first and then trying the password file */ if ((h = getenv("HOME")) == NULL) { @@ -375,14 +375,14 @@ globtilde(pattern, patbuf, pglob) /* Copy the home directory */ for (b = patbuf; *h; *b++ = *h++) continue; - + /* Append the rest of the pattern */ while ((*b++ = *p++) != EOS) continue; return patbuf; } - + /* * The main glob() routine: compiles the pattern (optionally processing @@ -440,7 +440,7 @@ glob0(pattern, pglob) break; case STAR: pglob->gl_flags |= GLOB_MAGCHAR; - /* collapse adjacent stars to one, + /* collapse adjacent stars to one, * to avoid exponential behavior */ if (bufnext == patbuf || bufnext[-1] != M_ALL) @@ -460,17 +460,17 @@ glob0(pattern, pglob) return(err); /* - * If there was no match we are going to append the pattern + * If there was no match we are going to append the pattern * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified * and the pattern did not contain any magic characters * GLOB_NOMAGIC is there just for compatibility with csh. */ - if (pglob->gl_pathc == oldpathc && - ((pglob->gl_flags & GLOB_NOCHECK) || + if (pglob->gl_pathc == oldpathc && + ((pglob->gl_flags & GLOB_NOCHECK) || ((pglob->gl_flags & GLOB_NOMAGIC) && !(pglob->gl_flags & GLOB_MAGCHAR)))) return(globextend(pattern, pglob)); - else if (!(pglob->gl_flags & GLOB_NOSORT)) + else if (!(pglob->gl_flags & GLOB_NOSORT)) qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, pglob->gl_pathc - oldpathc, sizeof(char *), compare); return(0); @@ -519,7 +519,7 @@ glob2(pathbuf, pathend, pattern, pglob) *pathend = EOS; if (g_lstat(pathbuf, &sb, pglob)) return(0); - + if (((pglob->gl_flags & GLOB_MARK) && pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) || (S_ISLNK(sb.st_mode) && @@ -572,7 +572,7 @@ glob3(pathbuf, pathend, pattern, restpattern, pglob) *pathend = EOS; errno = 0; - + if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { /* TODO: don't call for ENOENT or ENOTDIR? */ if (pglob->gl_errfunc) { @@ -598,7 +598,7 @@ glob3(pathbuf, pathend, pattern, restpattern, pglob) /* Initial DOT must be matched literally. */ if (dp->d_name[0] == DOT && *pattern != DOT) continue; - for (sc = (u_char *) dp->d_name, dc = pathend; + for (sc = (u_char *) dp->d_name, dc = pathend; (*dc++ = *sc++) != EOS;) continue; if (!match(pathend, pattern, restpattern)) { @@ -644,7 +644,7 @@ globextend(path, pglob) const Char *p; newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs); - pathv = pglob->gl_pathv ? + pathv = pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) : malloc(newsize); if (pathv == NULL) @@ -686,7 +686,7 @@ match(name, pat, patend) case M_ALL: if (pat == patend) return(1); - do + do if (match(name, pat, patend)) return(1); while (*name++ != EOS); @@ -825,7 +825,7 @@ g_Ctoc(str, buf) } #ifdef DEBUG -static void +static void qprintf(str, s) const char *str; register Char *s; diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c index 5dc3de1f2e1a..9993dcabc053 100644 --- a/lib/libc/gen/nlist.c +++ b/lib/libc/gen/nlist.c @@ -95,8 +95,8 @@ __fdnlist(fd, list) * does not start at a page boundary - we save ourselves a * lot of nastiness by mmapping the whole file. * - * This gives us an easy way to randomly access all the strings, - * without making the memory allocation permanent as with + * This gives us an easy way to randomly access all the strings, + * without making the memory allocation permanent as with * malloc/free (i.e., munmap will return it to the system). */ a_out_mmap = mmap(NULL, (size_t)st.st_size, PROT_READ, 0, fd, (off_t)0); diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c index 89aba1638ed9..4affdf4ae0a4 100644 --- a/lib/libc/gen/popen.c +++ b/lib/libc/gen/popen.c @@ -53,8 +53,8 @@ static struct pid { struct pid *next; FILE *fp; pid_t pid; -} *pidlist; - +} *pidlist; + FILE * popen(program, type) const char *program; @@ -155,6 +155,6 @@ pclose(iop) else last->next = cur->next; free(cur); - + return (pid == -1 ? -1 : pstat.w_status); } diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c index 395df8d3d52b..e6e840802703 100644 --- a/lib/libc/gen/scandir.c +++ b/lib/libc/gen/scandir.c @@ -79,7 +79,7 @@ scandir(dirname, namelist, select, dcomp) /* * estimate the array size by taking the size of the directory file - * and dividing it by a multiple of the minimum size entry. + * and dividing it by a multiple of the minimum size entry. */ arraysz = (stb.st_size / 24); names = (struct dirent **)malloc(arraysz * sizeof(struct dirent *)); diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c index 84cadcbd0891..2190b4e07d3c 100644 --- a/lib/libc/gen/setmode.c +++ b/lib/libc/gen/setmode.c @@ -190,7 +190,7 @@ setmode(p) (void)sigprocmask(SIG_SETMASK, &sigoset, NULL); setlen = SET_LEN + 2; - + if ((set = malloc((u_int)(sizeof(BITCMD) * setlen))) == NULL) return (NULL); saveset = set; @@ -368,7 +368,7 @@ addcmd(set, op, who, oparg, mask) set->cmd2 = CMD2_UBITS | CMD2_GBITS | CMD2_OBITS; set->bits = mask; } - + if (oparg == '+') set->cmd2 |= CMD2_SET; else if (oparg == '-') @@ -399,7 +399,7 @@ dumpmode(set) /* * Given an array of bitcmd structures, compress by compacting consecutive * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u', - * 'g' and 'o' commands continue to be separate. They could probably be + * 'g' and 'o' commands continue to be separate. They could probably be * compacted, but it's not worth the effort. */ static int diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c index 83f21a3e00e0..2994505e942c 100644 --- a/lib/libc/gen/sysconf.c +++ b/lib/libc/gen/sysconf.c @@ -184,5 +184,5 @@ yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1) errno = EINVAL; return (-1); } - return (sysctl(mib, 2, &value, &len, NULL, 0) == -1 ? -1 : value); + return (sysctl(mib, 2, &value, &len, NULL, 0) == -1 ? -1 : value); } diff --git a/lib/libc/gen/telldir.c b/lib/libc/gen/telldir.c index eeba2956aadb..ab23d9db7a20 100644 --- a/lib/libc/gen/telldir.c +++ b/lib/libc/gen/telldir.c @@ -49,7 +49,7 @@ static char sccsid[] = "@(#)telldir.c 8.1 (Berkeley) 6/4/93"; /* * One of these structures is malloced to describe the current directory - * position each time telldir is called. It records the current magic + * position each time telldir is called. It records the current magic * cookie returned by getdirentries and the offset within the buffer * associated with that return value. */ diff --git a/lib/libc/gen/ttyslot.c b/lib/libc/gen/ttyslot.c index 3d9fee62fc4f..066f2f9f855b 100644 --- a/lib/libc/gen/ttyslot.c +++ b/lib/libc/gen/ttyslot.c @@ -50,9 +50,9 @@ ttyslot() char *name; setttyent(); - for (cnt = 0; cnt < 3; ++cnt) + for (cnt = 0; cnt < 3; ++cnt) if (name = ttyname(cnt)) { - if (p = rindex(name, '/')) + if (p = rindex(name, '/')) ++p; else p = name; diff --git a/lib/libc/gen/ualarm.c b/lib/libc/gen/ualarm.c index e9e051d5e19f..ec49a2d75d3e 100644 --- a/lib/libc/gen/ualarm.c +++ b/lib/libc/gen/ualarm.c @@ -54,7 +54,7 @@ ualarm(usecs, reload) new.it_interval.tv_usec = reload % USPS; new.it_interval.tv_sec = reload / USPS; - + new.it_value.tv_usec = usecs % USPS; new.it_value.tv_sec = usecs / USPS; diff --git a/lib/libc/gen/uname.c b/lib/libc/gen/uname.c index 1511c1f957fe..63f29566660b 100644 --- a/lib/libc/gen/uname.c +++ b/lib/libc/gen/uname.c @@ -34,7 +34,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char sccsid[] = "From: @(#)uname.c 8.1 (Berkeley) 1/4/94";*/ static const char rcsid[] = - "$Id$"; + "$Id: uname.c,v 1.2 1994/10/13 20:31:19 wollman Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -58,7 +58,7 @@ uname(name) len = sizeof(name->sysname); oerrno = errno; if (sysctl(mib, 2, &name->sysname, &len, NULL, 0) == -1) { - if(errno == ENOMEM) + if(errno == ENOMEM) errno = oerrno; else rval = -1; @@ -69,7 +69,7 @@ uname(name) len = sizeof(name->nodename); oerrno = errno; if (sysctl(mib, 2, &name->nodename, &len, NULL, 0) == -1) { - if(errno == ENOMEM) + if(errno == ENOMEM) errno = oerrno; else rval = -1; @@ -80,7 +80,7 @@ uname(name) len = sizeof(name->release); oerrno = errno; if (sysctl(mib, 2, &name->release, &len, NULL, 0) == -1) { - if(errno == ENOMEM) + if(errno == ENOMEM) errno = oerrno; else rval = -1; diff --git a/lib/libc/gen/unvis.c b/lib/libc/gen/unvis.c index 6126d6ad66df..547048336c4d 100644 --- a/lib/libc/gen/unvis.c +++ b/lib/libc/gen/unvis.c @@ -65,7 +65,7 @@ unvis(cp, c, astate, flag) if (*astate == S_OCTAL2 || *astate == S_OCTAL3) { *astate = S_GROUND; return (UNVIS_VALID); - } + } return (*astate == S_GROUND ? UNVIS_NOCHAR : UNVIS_SYNBAD); } @@ -76,7 +76,7 @@ unvis(cp, c, astate, flag) if (c == '\\') { *astate = S_START; return (0); - } + } *cp = c; return (UNVIS_VALID); @@ -149,7 +149,7 @@ unvis(cp, c, astate, flag) } *astate = S_GROUND; return (UNVIS_SYNBAD); - + case S_META: if (c == '-') *astate = S_META1; @@ -160,12 +160,12 @@ unvis(cp, c, astate, flag) return (UNVIS_SYNBAD); } return (0); - + case S_META1: *astate = S_GROUND; *cp |= c; return (UNVIS_VALID); - + case S_CTRL: if (c == '?') *cp |= 0177; @@ -176,15 +176,15 @@ unvis(cp, c, astate, flag) case S_OCTAL2: /* second possible octal digit */ if (isoctal(c)) { - /* - * yes - and maybe a third + /* + * yes - and maybe a third */ *cp = (*cp << 3) + (c - '0'); - *astate = S_OCTAL3; + *astate = S_OCTAL3; return (0); - } - /* - * no - done with current sequence, push back passed char + } + /* + * no - done with current sequence, push back passed char */ *astate = S_GROUND; return (UNVIS_VALIDPUSH); @@ -199,10 +199,10 @@ unvis(cp, c, astate, flag) * we were done, push back passed char */ return (UNVIS_VALIDPUSH); - - default: - /* - * decoder in unknown state - (probably uninitialized) + + default: + /* + * decoder in unknown state - (probably uninitialized) */ *astate = S_GROUND; return (UNVIS_SYNBAD); @@ -210,7 +210,7 @@ unvis(cp, c, astate, flag) } /* - * strunvis - decode src into dst + * strunvis - decode src into dst * * Number of chars decoded into dst is returned, -1 on error. * Dst is null terminated. diff --git a/lib/libc/gen/vis.c b/lib/libc/gen/vis.c index 2232149122eb..e12226a593f6 100644 --- a/lib/libc/gen/vis.c +++ b/lib/libc/gen/vis.c @@ -111,7 +111,7 @@ vis(dst, c, flag, nextc) goto done; } } - if (((c & 0177) == ' ') || (flag & VIS_OCTAL)) { + if (((c & 0177) == ' ') || (flag & VIS_OCTAL)) { *dst++ = '\\'; *dst++ = ((u_char)c >> 6 & 07) + '0'; *dst++ = ((u_char)c >> 3 & 07) + '0'; @@ -141,10 +141,10 @@ done: /* * strvis, strvisx - visually encode characters from src into dst - * + * * Dst must be 4 times the size of src to account for possible * expansion. The length of dst, not including the trailing NULL, - * is returned. + * is returned. * * Strvisx encodes exactly len bytes from src into dst. * This is useful for encoding a block of data. diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c index 022ffb564122..572b7eb97e1c 100644 --- a/lib/libc/gmon/gmon.c +++ b/lib/libc/gmon/gmon.c @@ -106,7 +106,7 @@ monstartup(lowpc, highpc) s_scale = ((float)p->kcountsize / o ) * SCALE_1_TO_1; #else /* avoid floating point */ int quot = o / p->kcountsize; - + if (quot >= 0x10000) s_scale = 1; else if (quot >= 0x100) @@ -239,7 +239,7 @@ static int hertz() { struct itimerval tim; - + tim.it_interval.tv_sec = 0; tim.it_interval.tv_usec = 1; tim.it_value.tv_sec = 0; diff --git a/lib/libc/gmon/mcount.c b/lib/libc/gmon/mcount.c index 13e4df99e8a6..63fbf886a151 100644 --- a/lib/libc/gmon/mcount.c +++ b/lib/libc/gmon/mcount.c @@ -51,7 +51,7 @@ static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93"; * _mcount updates data structures that represent traversals of the * program's call graph edges. frompc and selfpc are the return * address and function address that represents the given call graph edge. - * + * * Note: the original BSD code used the same variable (frompcindex) for * both frompcindex and frompc. Any reasonable, modern compiler will * perform this optimization. @@ -158,7 +158,7 @@ _MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ *frompcindex = toindex; goto done; } - + } done: #ifdef KERNEL diff --git a/lib/libc/i386/sys/i386_get_ldt.c b/lib/libc/i386/sys/i386_get_ldt.c index db9757cf699d..8c4e5d221a06 100644 --- a/lib/libc/i386/sys/i386_get_ldt.c +++ b/lib/libc/i386/sys/i386_get_ldt.c @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 John Brezak * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,7 +12,7 @@ * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `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 @@ -24,12 +24,12 @@ * 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. - * - * $Id$ + * + * $Id: i386_get_ldt.c,v 1.2 1995/01/23 01:29:50 davidg Exp $ */ #if defined(LIBC_RCS) && !defined(lint) -static const char rcsid[] = "$Id$"; +static const char rcsid[] = "$Id: i386_get_ldt.c,v 1.2 1995/01/23 01:29:50 davidg Exp $"; #endif /* LIBC_RCS and not lint */ #include <sys/cdefs.h> @@ -50,6 +50,6 @@ i386_get_ldt(int start, union descriptor *descs, int num) p.start = start; p.descs = descs; p.num = num; - + return sysarch(I386_GET_LDT, (char *)&p); } diff --git a/lib/libc/i386/sys/i386_set_ldt.c b/lib/libc/i386/sys/i386_set_ldt.c index 1d24956a1a6f..8754fd12344e 100644 --- a/lib/libc/i386/sys/i386_set_ldt.c +++ b/lib/libc/i386/sys/i386_set_ldt.c @@ -1,7 +1,7 @@ /* * Copyright (c) 1993 John Brezak * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,7 +12,7 @@ * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `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 @@ -24,12 +24,12 @@ * 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. - * - * $Id$ + * + * $Id: i386_set_ldt.c,v 1.2 1995/01/23 01:29:53 davidg Exp $ */ #if defined(LIBC_RCS) && !defined(lint) -static const char rcsid[] = "$Id$"; +static const char rcsid[] = "$Id: i386_set_ldt.c,v 1.2 1995/01/23 01:29:53 davidg Exp $"; #endif /* LIBC_RCS and not lint */ #include <sys/cdefs.h> @@ -50,6 +50,6 @@ i386_set_ldt(int start, union descriptor *descs, int num) p.start = start; p.descs = descs; p.num = num; - + return sysarch(I386_SET_LDT, (char *)&p); } diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c index bcc6804986d9..bdcf6a486440 100644 --- a/lib/libc/locale/collate.c +++ b/lib/libc/locale/collate.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: collate.c,v 1.2 1995/02/17 16:36:12 ache Exp $ + * $Id: collate.c,v 1.3 1995/02/18 01:42:02 ache Exp $ */ #include <rune.h> @@ -50,7 +50,7 @@ struct __collate_st_chain_pri __collate_chain_pri_table[TABLE_SIZE]; return -1; \ } \ } while(0) - + __dead void __collate_err(int ex, const char *f) __dead2; int diff --git a/lib/libc/locale/read_runemagi.c b/lib/libc/locale/read_runemagi.c index 83b65f791556..9bd1808543a4 100644 --- a/lib/libc/locale/read_runemagi.c +++ b/lib/libc/locale/read_runemagi.c @@ -128,7 +128,7 @@ _Read_RuneMagi(fp) if (!rl->mapupper_ext.nranges) rl->mapupper_ext.ranges = 0; - + return(rl); } diff --git a/lib/libc/net/gethostbydns.c b/lib/libc/net/gethostbydns.c index 110e4172f34b..6db04f932dde 100644 --- a/lib/libc/net/gethostbydns.c +++ b/lib/libc/net/gethostbydns.c @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: gethostbydns.c,v 1.2 1994/09/25 17:45:37 pst Exp $"; +static char rcsid[] = "$Id: gethostbydns.c,v 1.3 1994/12/01 22:25:38 wollman Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -123,7 +123,7 @@ addrsort(ap, num) p = ap; for (i = 0; i < num; i++, p++) { for (j = 0 ; j < _res.nsort; j++) - if (_res.sort_list[j].addr.s_addr == + if (_res.sort_list[j].addr.s_addr == (((struct in_addr *)(*p))->s_addr & _res.sort_list[j].mask)) break; aval[i] = j; @@ -410,7 +410,7 @@ _gethostbydnsname(name) host.h_addr_list = h_addr_ptrs; return (&host); } - if (!isdigit(*cp) && *cp != '.') + if (!isdigit(*cp) && *cp != '.') break; } @@ -432,7 +432,7 @@ _gethostbydnsaddr(addr, len, type) register struct hostent *hp; char qbuf[MAXDNAME+1]; int o_res_options = _res.options; - + if (type != AF_INET) return (NULL); (void)sprintf(qbuf, "%u.%u.%u.%u.in-addr.arpa", diff --git a/lib/libc/net/gethostbyht.c b/lib/libc/net/gethostbyht.c index 78e0c305c099..4b616cd65cde 100644 --- a/lib/libc/net/gethostbyht.c +++ b/lib/libc/net/gethostbyht.c @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: gethostnamadr.c,v 1.1 1994/05/27 04:57:16 rgrimes Exp $"; +static char rcsid[] = "$Id: gethostbyht.c,v 1.1 1994/09/25 02:12:11 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -129,7 +129,7 @@ again: host.h_name = cp; q = host.h_aliases = host_aliases; cp = strpbrk(cp, " \t"); - if (cp != NULL) + if (cp != NULL) *cp++ = '\0'; while (cp && *cp) { if (*cp == ' ' || *cp == '\t') { @@ -152,7 +152,7 @@ _gethostbyhtname(name) { register struct hostent *p; register char **cp; - + sethostent(0); while ((p = gethostent())) { if (strcasecmp(p->h_name, name) == 0) diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c index 04a443d6b610..54f78d01fa82 100644 --- a/lib/libc/net/gethostnamadr.c +++ b/lib/libc/net/gethostnamadr.c @@ -24,8 +24,8 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)$Id: gethostnamadr.c,v 1.5 1994/09/25 02:12:18 pst Exp $"; -static char rcsid[] = "$Id: gethostnamadr.c,v 1.5 1994/09/25 02:12:18 pst Exp $"; +static char sccsid[] = "@(#)$Id: gethostnamadr.c,v 1.6 1995/03/24 15:38:54 ache Exp $"; +static char rcsid[] = "$Id: gethostnamadr.c,v 1.6 1995/03/24 15:38:54 ache Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -47,7 +47,7 @@ extern struct hostent * _gethostbynisaddr __P((const char *, int, int)); #define _PATH_HOSTCONF "/etc/host.conf" -enum service_type { +enum service_type { SERVICE_NONE = 0, SERVICE_BIND, SERVICE_HOSTS, diff --git a/lib/libc/net/getnetbydns.c b/lib/libc/net/getnetbydns.c index fbfb3c7371e8..f0a224fd5b0c 100644 --- a/lib/libc/net/getnetbydns.c +++ b/lib/libc/net/getnetbydns.c @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: getnetbydns.c,v 1.1 1994/09/25 02:12:20 pst Exp $"; +static char rcsid[] = "$Id: getnetbydns.c,v 1.2 1994/09/25 17:45:38 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -168,7 +168,7 @@ static char *net_aliases[MAXALIASES], cp += n; return (NULL); } - cp += n; + cp += n; *ap++ = bp; bp += (strlen(bp) + 1); net_entry.n_addrtype = (class == C_IN) @@ -204,7 +204,7 @@ static char *net_aliases[MAXALIASES], paux1 = pauxt; } in = ++st; - } + } net_entry.n_net = inet_network(paux2); } net_entry.n_aliases++; @@ -277,7 +277,7 @@ _getnetbydnsname(net) int anslen; querybuf buf; char qbuf[MAXDNAME]; - + (void)strcpy(&qbuf[0],net); anslen = res_search(qbuf, C_IN, T_PTR, buf.buf, sizeof buf.buf); if (anslen < 0) { diff --git a/lib/libc/net/getnetbyht.c b/lib/libc/net/getnetbyht.c index cdb5e4933b76..4f6439cc77df 100644 --- a/lib/libc/net/getnetbyht.c +++ b/lib/libc/net/getnetbyht.c @@ -103,7 +103,7 @@ again: net.n_net = inet_network(cp); net.n_addrtype = AF_INET; q = net.n_aliases = net_aliases; - if (p != NULL) + if (p != NULL) cp = p; while (cp && *cp) { if (*cp == ' ' || *cp == '\t') { diff --git a/lib/libc/net/getnetbynis.c b/lib/libc/net/getnetbynis.c index 33afdde4d0db..21f17b9cda15 100644 --- a/lib/libc/net/getnetbynis.c +++ b/lib/libc/net/getnetbynis.c @@ -24,8 +24,8 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)$Id: getnetbynis.c,v 1.1 1994/09/25 02:12:26 pst Exp $"; -static char rcsid[] = "$Id: getnetbynis.c,v 1.1 1994/09/25 02:12:26 pst Exp $"; +static char sccsid[] = "@(#)$Id: getnetbynis.c,v 1.2 1994/09/26 02:50:43 wollman Exp $"; +static char rcsid[] = "$Id: getnetbynis.c,v 1.2 1994/09/26 02:50:43 wollman Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -122,13 +122,13 @@ _getnetbynisaddr(addr, type) if (type != AF_INET) return (NULL); - in.s_addr = addr; + in.s_addr = addr; str = inet_ntoa(in); cp = str + strlen(str) - 2; while(!strcmp(cp, ".0")) { *cp = '\0'; cp = str + strlen(str) - 2; } - + return _getnetbynis(str, "networks.byaddr"); } diff --git a/lib/libc/net/getnetnamadr.c b/lib/libc/net/getnetnamadr.c index cf0a81aad456..5d99c8f9c9d8 100644 --- a/lib/libc/net/getnetnamadr.c +++ b/lib/libc/net/getnetnamadr.c @@ -24,8 +24,8 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)$Id: getnetnamadr.c,v 1.2 1994/09/26 22:45:10 wollman Exp $"; -static char rcsid[] = "$Id: getnetnamadr.c,v 1.2 1994/09/26 22:45:10 wollman Exp $"; +static char sccsid[] = "@(#)$Id: getnetnamadr.c,v 1.3 1995/03/24 15:51:30 ache Exp $"; +static char rcsid[] = "$Id: getnetnamadr.c,v 1.3 1995/03/24 15:51:30 ache Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -49,7 +49,7 @@ extern struct netent * _getnetbynisaddr __P((long, int)); #define _PATH_NETCONF "/etc/host.conf" #endif -enum service_type { +enum service_type { SERVICE_NONE = 0, SERVICE_BIND, SERVICE_TABLE, diff --git a/lib/libc/net/herror.c b/lib/libc/net/herror.c index 0366b0489807..c9135c304aae 100644 --- a/lib/libc/net/herror.c +++ b/lib/libc/net/herror.c @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: herror.c,v 4.9.1.1 1993/05/02 23:14:35 vixie Rel $"; +static char rcsid[] = "$Id: herror.c,v 1.1.1.1 1994/05/27 04:57:15 rgrimes Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> diff --git a/lib/libc/net/inet_addr.c b/lib/libc/net/inet_addr.c index 246a418a9563..f69d0fcd8c0f 100644 --- a/lib/libc/net/inet_addr.c +++ b/lib/libc/net/inet_addr.c @@ -55,7 +55,7 @@ inet_addr(cp) return (INADDR_NONE); } -/* +/* * Check whether "cp" is a valid ascii representation * of an Internet address and convert to a binary address. * Returns 1 if the address is valid, 0 if not. @@ -93,7 +93,7 @@ inet_aton(cp, addr) continue; } if (base == 16 && isascii(c) && isxdigit(c)) { - val = (val << 4) + + val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A')); cp++; continue; diff --git a/lib/libc/net/iso_addr.c b/lib/libc/net/iso_addr.c index 41dc531cb783..8829497973e5 100644 --- a/lib/libc/net/iso_addr.c +++ b/lib/libc/net/iso_addr.c @@ -65,7 +65,7 @@ iso_addr(addr) new = *addr - 'a' + 10; } else if ((*addr >= 'A') && (*addr <= 'F')) { new = *addr - 'A' + 10; - } else if (*addr == 0) + } else if (*addr == 0) state |= END; else state |= DELIM; @@ -86,7 +86,7 @@ iso_addr(addr) break; } break; - } while (cp < cplim); + } while (cp < cplim); out_addr.isoa_len = cp - out_addr.isoa_genaddr; return (&out_addr); } diff --git a/lib/libc/net/linkaddr.c b/lib/libc/net/linkaddr.c index 50ab39227824..68eed3df3394 100644 --- a/lib/libc/net/linkaddr.c +++ b/lib/libc/net/linkaddr.c @@ -112,7 +112,7 @@ link_addr(addr, sdl) break; } break; - } while (cp < cplim); + } while (cp < cplim); sdl->sdl_alen = cp - LLADDR(sdl); new = cp - (char *)sdl; if (new > sizeof(*sdl)) @@ -127,7 +127,7 @@ link_ntoa(sdl) register const struct sockaddr_dl *sdl; { static char obuf[64]; - register char *out = obuf; + register char *out = obuf; register int i; register u_char *in = (u_char *)LLADDR(sdl); u_char *inlim = in + sdl->sdl_alen; diff --git a/lib/libc/net/ns_addr.c b/lib/libc/net/ns_addr.c index 9b0b9d17e9ff..da8f8b4d72ca 100644 --- a/lib/libc/net/ns_addr.c +++ b/lib/libc/net/ns_addr.c @@ -47,7 +47,7 @@ static struct ns_addr addr, zero_addr; static void Field(), cvtbase(); -struct ns_addr +struct ns_addr ns_addr(name) const char *name; { @@ -157,7 +157,7 @@ Field(buf, out, len) case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': base16 = 1; break; - + case 'x': case 'X': *--bp = '0'; base16 = 1; diff --git a/lib/libc/net/res_comp.c b/lib/libc/net/res_comp.c index 1e7653555586..a78a7986629e 100644 --- a/lib/libc/net/res_comp.c +++ b/lib/libc/net/res_comp.c @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_comp.c,v 4.9.1.11 1994/07/23 23:24:11 vixie Exp $"; +static char rcsid[] = "$Id: res_comp.c,v 1.2 1994/09/25 02:12:32 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> diff --git a/lib/libc/net/res_debug.c b/lib/libc/net/res_debug.c index a40a3895f321..78b11c957fd9 100644 --- a/lib/libc/net/res_debug.c +++ b/lib/libc/net/res_debug.c @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_debug.c,v 4.9.1.16 1994/07/11 07:41:13 vixie Exp $"; +static char rcsid[] = "$Id: res_debug.c,v 1.2 1994/09/25 02:12:34 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -291,7 +291,7 @@ __fp_nquery(msg, len, file) fprintf(file, ", Auth: %d", ntohs(hp->nscount)); fprintf(file, ", Addit: %d", ntohs(hp->arcount)); } - if ((!_res.pfcode) || (_res.pfcode & + if ((!_res.pfcode) || (_res.pfcode & (RES_PRF_HEADX | RES_PRF_HEAD2 | RES_PRF_HEAD1))) { putc('\n',file); } diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c index 1b1613ffe72b..347e5b6d3e72 100644 --- a/lib/libc/net/res_init.c +++ b/lib/libc/net/res_init.c @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; -static char rcsid[] = "$Id: res_init.c,v 1.2 1994/09/25 02:12:36 pst Exp $"; +static char rcsid[] = "$Id: res_init.c,v 1.3 1994/09/25 17:45:39 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -91,7 +91,7 @@ struct __res_state _res; * since it was noted that INADDR_ANY actually meant ``the first interface * you "ifconfig"'d at boot time'' and if this was a SLIP or PPP interface, * it had to be "up" in order for you to reach your own name server. It - * was later decided that since the recommended practice is to always + * was later decided that since the recommended practice is to always * install local static routes through 127.0.0.1 for all your network * interfaces, that we could solve this problem without a code change. * @@ -287,11 +287,11 @@ res_init() if (inet_aton(net, &a)) { _res.sort_list[nsort].mask = a.s_addr; } else { - _res.sort_list[nsort].mask = + _res.sort_list[nsort].mask = net_mask(_res.sort_list[nsort].addr); } } else { - _res.sort_list[nsort].mask = + _res.sort_list[nsort].mask = net_mask(_res.sort_list[nsort].addr); } nsort++; @@ -306,7 +306,7 @@ res_init() continue; } } - if (nserv > 1) + if (nserv > 1) _res.nscount = nserv; #ifdef RESOLVSORT _res.nsort = nsort; diff --git a/lib/libc/net/res_mkquery.c b/lib/libc/net/res_mkquery.c index 7007edbc5570..7788d165b2ff 100644 --- a/lib/libc/net/res_mkquery.c +++ b/lib/libc/net/res_mkquery.c @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_mkquery.c,v 1.2 1994/09/25 02:12:38 pst Exp $"; +static char rcsid[] = "$Id: res_mkquery.c,v 1.3 1994/09/25 17:45:39 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> diff --git a/lib/libc/net/res_query.c b/lib/libc/net/res_query.c index 51e13e7f966c..ed923eb6e31b 100644 --- a/lib/libc/net/res_query.c +++ b/lib/libc/net/res_query.c @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_query.c,v 1.2 1994/09/25 02:12:41 pst Exp $"; +static char rcsid[] = "$Id: res_query.c,v 1.3 1994/09/25 17:45:40 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> diff --git a/lib/libc/net/res_send.c b/lib/libc/net/res_send.c index a694b5ec6e31..8ee0a928f4fb 100644 --- a/lib/libc/net/res_send.c +++ b/lib/libc/net/res_send.c @@ -31,14 +31,14 @@ * SUCH DAMAGE. * - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * + * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies, and that * the name of Digital Equipment Corporation not be used in advertising or * publicity pertaining to distribution of the document or software without * specific, written prior permission. - * + * * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_send.c,v 1.2 1994/09/25 02:12:49 pst Exp $"; +static char rcsid[] = "$Id: res_send.c,v 1.3 1994/09/25 17:45:41 pst Exp $"; #endif /* LIBC_SCCS and not lint */ /* change this to "0" diff --git a/lib/libc/nls/msgcat.c b/lib/libc/nls/msgcat.c index 37a15e1c6e80..b4a465290c12 100644 --- a/lib/libc/nls/msgcat.c +++ b/lib/libc/nls/msgcat.c @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: msgcat.c,v 1.1 1995/03/30 12:47:26 jkh Exp $ */ /*********************************************************** Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts. @@ -29,7 +29,7 @@ up-to-date. Many thanks. 267 Allston St., #3 Cambridge, MA 02139 USA nazgul@alfalfa.com - + ******************************************************************/ #if defined(LIBC_SCCS) && !defined(lint) @@ -92,7 +92,7 @@ int type; long len; char *base, *cptr, *pathP; struct stat sbuf; - + if (!name || !*name) return(NLERR); if (strchr(name, '/')) { @@ -103,14 +103,14 @@ int type; if ((nlspath = (char *) getenv("NLSPATH")) == NULL) { nlspath = "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L"; } - + len = strlen(nlspath); base = cptr = (char *) malloc(len + 2); if (!base) return(NLERR); strcpy(cptr, nlspath); cptr[len] = ':'; cptr[len+1] = '\0'; - + for (nlspath = cptr; *cptr; ++cptr) { if (*cptr == ':') { *cptr = '\0'; @@ -181,7 +181,7 @@ int setId; hi = cat->numSets; cur = (hi - lo) / 2; } - + while (True) { set = cat->sets + cur; if (set->setId == setId) break; @@ -201,16 +201,16 @@ int setId; return(set); } - + static MCMsgT *MCGetMsg( set, msgId) MCSetT *set; int msgId; { MCMsgT *msg; long lo, hi, cur, dir; - + if (!set || set->invalid || msgId <= 0) return(NULL); - + lo = 0; if (msgId - 1 < set->numMsgs) { cur = msgId - 1; @@ -219,7 +219,7 @@ int msgId; hi = set->numMsgs; cur = (hi - lo) / 2; } - + while (True) { msg = set->u.msgs + cur; if (msg->msgId == msgId) break; @@ -264,7 +264,7 @@ nl_catd catd; int i, j; if (!cat) return -1; - + if (cat->loadType != MCLoadAll) close(cat->fd); for (i = 0; i < cat->numSets; ++i) { set = cat->sets + i; @@ -312,13 +312,13 @@ int type; if (read(cat->fd, &header, sizeof(header)) != sizeof(header)) CORRUPT(); if (strncmp(header.magic, MCMagic, MCMagicLen) != 0) CORRUPT(); - + if (header.majorVer != MCMajorVer) { fprintf(stderr, "%s: %s is version %d, we need %d.\n", ERRNAME, catpath, header.majorVer, MCMajorVer); return(0); } - + if (header.numSets <= 0) { fprintf(stderr, "%s: %s has %d sets!\n", ERRNAME, catpath, header.numSets); @@ -338,7 +338,7 @@ int type; if (read(cat->fd, set, sizeof(*set)) != sizeof(*set)) CORRUPT(); /* if it's invalid, skip over it (and backup 'i') */ - + if (set->invalid) { --i; nextSet = set->nextSet; @@ -376,7 +376,7 @@ MCSetT *set; /* Get the messages */ if (lseek(cat->fd, set->u.firstMsg, 0) == -1) return(0); if ((set->u.msgs = (MCMsgT *) malloc(sizeof(MCMsgT) * set->numMsgs)) == NULL) return(-1); - + for (i = 0; i < set->numMsgs; ++i) { msg = set->u.msgs + i; if (read(cat->fd, msg, sizeof(*msg)) != sizeof(*msg)) return(0); @@ -389,8 +389,8 @@ MCSetT *set; set->invalid = False; return(1); } - - - + + + diff --git a/lib/libc/nls/msgcat.h b/lib/libc/nls/msgcat.h index e6e574488e06..4fabb591529b 100644 --- a/lib/libc/nls/msgcat.h +++ b/lib/libc/nls/msgcat.h @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: msgcat.h,v 1.1 1995/03/30 12:47:27 jkh Exp $ */ /* -*-c++-*- */ @@ -34,7 +34,7 @@ up-to-date. Many thanks. 267 Allston St., #3 Cambridge, MA 02139 USA nazgul@alfalfa.com - + ******************************************************************/ diff --git a/lib/libc/quad/muldi3.c b/lib/libc/quad/muldi3.c index a8d7cfc7eabc..5e2331fee273 100644 --- a/lib/libc/quad/muldi3.c +++ b/lib/libc/quad/muldi3.c @@ -49,7 +49,7 @@ static char sccsid[] = "@(#)muldi3.c 8.1 (Berkeley) 6/4/93"; * * u = 2^n u1 * u0 (n = number of bits in `u_long', usu. 32) * - * and + * and * * v = 2^n v1 * v0 * diff --git a/lib/libc/quad/qdivrem.c b/lib/libc/quad/qdivrem.c index 34b94ceaab23..56f91ec9fb7c 100644 --- a/lib/libc/quad/qdivrem.c +++ b/lib/libc/quad/qdivrem.c @@ -198,7 +198,7 @@ __qdivrem(uq, vq, arq) v2 = v[2]; /* for D3 */ do { register digit uj0, uj1, uj2; - + /* * D3: Calculate qhat (\^q, in TeX notation). * Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c index 02c841afa466..6d982f889c51 100644 --- a/lib/libc/regex/engine.c +++ b/lib/libc/regex/engine.c @@ -1028,7 +1028,7 @@ FILE *d; fprintf(d, "\n"); } -/* +/* - at - print current situation == #ifdef REDEBUG == static void at(struct match *m, char *title, char *start, char *stop, \ diff --git a/lib/libc/regex/regerror.c b/lib/libc/regex/regerror.c index a8d09454199b..2d2160ac1126 100644 --- a/lib/libc/regex/regerror.c +++ b/lib/libc/regex/regerror.c @@ -131,7 +131,7 @@ size_t errbuf_size; for (r = rerrs; r->code != 0; r++) if (r->code == target) break; - + if (errcode®_ITOA) { if (r->code != 0) (void) strcpy(convbuf, r->name); diff --git a/lib/libc/rpc/Makefile.inc b/lib/libc/rpc/Makefile.inc index 1854c0d23c05..43f0f3939532 100644 --- a/lib/libc/rpc/Makefile.inc +++ b/lib/libc/rpc/Makefile.inc @@ -7,7 +7,7 @@ SRCS+= auth_none.c auth_unix.c authunix_prot.c bindresvport.c \ pmap_clnt.c pmap_getmaps.c pmap_getport.c pmap_prot.c \ pmap_prot2.c pmap_rmt.c rpc_prot.c rpc_commondata.c rpc_callmsg.c \ svc.c svc_auth.c svc_auth_unix.c svc_raw.c svc_run.c svc_simple.c \ - svc_tcp.c svc_udp.c + svc_tcp.c svc_udp.c # # XXX -- rstat.1 and rstat_svc.8 shouldn't really be here @@ -16,7 +16,7 @@ SRCS+= auth_none.c auth_unix.c authunix_prot.c bindresvport.c \ # Paul. # -# MAN1+= rpc/rstat.1 +# MAN1+= rpc/rstat.1 MAN3+= rpc/bindresvport.3 rpc/getrpcent.3 rpc/getrpcport.3 rpc/rpc.3 MAN5+= rpc/rpc.5 MAN8+= rpc/rstat_svc.8 diff --git a/lib/libc/rpc/auth_none.c b/lib/libc/rpc/auth_none.c index 9c5a664795f6..3701363f3707 100644 --- a/lib/libc/rpc/auth_none.c +++ b/lib/libc/rpc/auth_none.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,15 +30,15 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: auth_none.c,v 1.1 1993/10/27 05:40:10 paul Exp $"; +static char *rcsid = "$Id: auth_none.c,v 1.1 1994/08/07 18:35:38 wollman Exp $"; #endif /* * auth_none.c - * Creates a client authentication handle for passing "null" - * credentials and verifiers to remote systems. - * - * Copyright (C) 1984, Sun Microsystems, Inc. + * Creates a client authentication handle for passing "null" + * credentials and verifiers to remote systems. + * + * Copyright (C) 1984, Sun Microsystems, Inc. */ #include <rpc/types.h> @@ -110,7 +110,7 @@ authnone_marshal(client, xdrs) ap->marshalled_client, ap->mcnt)); } -static void +static void authnone_verf() { } diff --git a/lib/libc/rpc/auth_unix.c b/lib/libc/rpc/auth_unix.c index 44df3e44b921..ed374cab72ba 100644 --- a/lib/libc/rpc/auth_unix.c +++ b/lib/libc/rpc/auth_unix.c @@ -5,11 +5,11 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. @@ -17,11 +17,11 @@ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,12 +30,12 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: auth_unix.c,v 1.2 1994/08/10 02:25:22 wollman Exp $"; +static char *rcsid = "$Id: auth_unix.c,v 1.3 1995/03/18 17:55:03 ache Exp $"; #endif /* - * auth_unix.c, Implements UNIX style authentication parameters. - * + * auth_unix.c, Implements UNIX style authentication parameters. + * * Copyright (C) 1984, Sun Microsystems, Inc. * * The system is very weak. The client uses no encryption for it's @@ -160,7 +160,7 @@ authunix_create(machname, uid, gid, len, aup_gids) * Serialize the parameters into origcred */ xdrmem_create(&xdrs, mymem, MAX_AUTH_BYTES, XDR_ENCODE); - if (! xdr_authunix_parms(&xdrs, &aup)) + if (! xdr_authunix_parms(&xdrs, &aup)) abort(); au->au_origcred.oa_length = len = XDR_GETPOS(&xdrs); au->au_origcred.oa_flavor = AUTH_UNIX; @@ -205,7 +205,7 @@ authunix_create_default() if ((len = getgroups(NGROUPS, real_gids)) < 0) abort(); if(len > NGRPS) len = NGRPS; /* GW: turn `gid_t's into `int's */ - for(i = 0; i < len; i++) { + for(i = 0; i < len; i++) { gids[i] = real_gids[i]; } return (authunix_create(machname, uid, gid, len, gids)); @@ -284,7 +284,7 @@ authunix_refresh(auth) xdrmem_create(&xdrs, au->au_origcred.oa_base, au->au_origcred.oa_length, XDR_DECODE); stat = xdr_authunix_parms(&xdrs, &aup); - if (! stat) + if (! stat) goto done; /* update the time and serialize in place */ diff --git a/lib/libc/rpc/authunix_prot.c b/lib/libc/rpc/authunix_prot.c index 15faf184cfb5..5a8c2a465ed7 100644 --- a/lib/libc/rpc/authunix_prot.c +++ b/lib/libc/rpc/authunix_prot.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)authunix_prot.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: authunix_prot.c,v 1.1 1993/10/27 05:40:15 paul Exp $"; +static char *rcsid = "$Id: authunix_prot.c,v 1.1 1994/08/07 18:35:40 wollman Exp $"; #endif /* diff --git a/lib/libc/rpc/bindresvport.c b/lib/libc/rpc/bindresvport.c index a085c910c3c3..3f48d268845a 100644 --- a/lib/libc/rpc/bindresvport.c +++ b/lib/libc/rpc/bindresvport.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)bindresvport.c 1.8 88/02/08 SMI";*/ /*static char *sccsid = "from: @(#)bindresvport.c 2.2 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: bindresvport.c,v 1.1 1993/10/27 05:40:17 paul Exp $"; +static char *rcsid = "$Id: bindresvport.c,v 1.1 1994/08/07 18:35:42 wollman Exp $"; #endif /* diff --git a/lib/libc/rpc/clnt_generic.c b/lib/libc/rpc/clnt_generic.c index ad9c22bb7191..ef4b969d4fd4 100644 --- a/lib/libc/rpc/clnt_generic.c +++ b/lib/libc/rpc/clnt_generic.c @@ -5,11 +5,11 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. @@ -17,11 +17,11 @@ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI";*/ /*static char *sccsid = "from: @(#)clnt_generic.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: clnt_generic.c,v 1.1 1993/10/27 05:40:19 paul Exp $"; +static char *rcsid = "$Id: clnt_generic.c,v 1.1 1994/08/07 18:35:43 wollman Exp $"; #endif /* @@ -43,7 +43,7 @@ static char *rcsid = "$Id: clnt_generic.c,v 1.1 1993/10/27 05:40:19 paul Exp $"; /* * Generic client creation: takes (hostname, program-number, protocol) and - * returns client handle. Default options are set, which the user can + * returns client handle. Default options are set, which the user can * change using the rpc equivalent of ioctl()'s. */ CLIENT * @@ -70,7 +70,7 @@ clnt_create(hostname, prog, vers, proto) * Only support INET for now */ rpc_createerr.cf_stat = RPC_SYSTEMERROR; - rpc_createerr.cf_error.re_errno = EAFNOSUPPORT; + rpc_createerr.cf_error.re_errno = EAFNOSUPPORT; return (NULL); } sin.sin_family = h->h_addrtype; @@ -80,7 +80,7 @@ clnt_create(hostname, prog, vers, proto) p = getprotobyname(proto); if (p == NULL) { rpc_createerr.cf_stat = RPC_UNKNOWNPROTO; - rpc_createerr.cf_error.re_errno = EPFNOSUPPORT; + rpc_createerr.cf_error.re_errno = EPFNOSUPPORT; return (NULL); } sock = RPC_ANYSOCK; @@ -106,7 +106,7 @@ clnt_create(hostname, prog, vers, proto) break; default: rpc_createerr.cf_stat = RPC_SYSTEMERROR; - rpc_createerr.cf_error.re_errno = EPFNOSUPPORT; + rpc_createerr.cf_error.re_errno = EPFNOSUPPORT; return (NULL); } return (client); diff --git a/lib/libc/rpc/clnt_perror.c b/lib/libc/rpc/clnt_perror.c index 9a7d76cbc200..c4076cb192d6 100644 --- a/lib/libc/rpc/clnt_perror.c +++ b/lib/libc/rpc/clnt_perror.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: clnt_perror.c,v 1.1 1993/10/27 05:40:20 paul Exp $"; +static char *rcsid = "$Id: clnt_perror.c,v 1.1 1994/08/07 18:35:44 wollman Exp $"; #endif /* @@ -77,17 +77,17 @@ clnt_sperror(rpch, s) return (0); CLNT_GETERR(rpch, &e); - (void) sprintf(str, "%s: ", s); + (void) sprintf(str, "%s: ", s); str += strlen(str); - (void) strcpy(str, clnt_sperrno(e.re_status)); + (void) strcpy(str, clnt_sperrno(e.re_status)); str += strlen(str); switch (e.re_status) { case RPC_SUCCESS: case RPC_CANTENCODEARGS: case RPC_CANTDECODERES: - case RPC_TIMEDOUT: + case RPC_TIMEDOUT: case RPC_PROGUNAVAIL: case RPC_PROCUNAVAIL: case RPC_CANTDECODEARGS: @@ -102,13 +102,13 @@ clnt_sperror(rpch, s) case RPC_CANTSEND: case RPC_CANTRECV: (void) sprintf(str, "; errno = %s", - strerror(e.re_errno)); + strerror(e.re_errno)); str += strlen(str); break; case RPC_VERSMISMATCH: (void) sprintf(str, - "; low version = %lu, high version = %lu", + "; low version = %lu, high version = %lu", e.re_vers.low, e.re_vers.high); str += strlen(str); break; @@ -128,15 +128,15 @@ clnt_sperror(rpch, s) break; case RPC_PROGVERSMISMATCH: - (void) sprintf(str, - "; low version = %lu, high version = %lu", + (void) sprintf(str, + "; low version = %lu, high version = %lu", e.re_vers.low, e.re_vers.high); str += strlen(str); break; default: /* unknown */ - (void) sprintf(str, - "; s1 = %lu, s2 = %lu", + (void) sprintf(str, + "; s1 = %lu, s2 = %lu", e.re_lb.s1, e.re_lb.s2); str += strlen(str); break; @@ -160,41 +160,41 @@ struct rpc_errtab { }; static struct rpc_errtab rpc_errlist[] = { - { RPC_SUCCESS, - "RPC: Success" }, - { RPC_CANTENCODEARGS, + { RPC_SUCCESS, + "RPC: Success" }, + { RPC_CANTENCODEARGS, "RPC: Can't encode arguments" }, - { RPC_CANTDECODERES, + { RPC_CANTDECODERES, "RPC: Can't decode result" }, - { RPC_CANTSEND, + { RPC_CANTSEND, "RPC: Unable to send" }, - { RPC_CANTRECV, + { RPC_CANTRECV, "RPC: Unable to receive" }, - { RPC_TIMEDOUT, + { RPC_TIMEDOUT, "RPC: Timed out" }, - { RPC_VERSMISMATCH, + { RPC_VERSMISMATCH, "RPC: Incompatible versions of RPC" }, - { RPC_AUTHERROR, + { RPC_AUTHERROR, "RPC: Authentication error" }, - { RPC_PROGUNAVAIL, + { RPC_PROGUNAVAIL, "RPC: Program unavailable" }, - { RPC_PROGVERSMISMATCH, + { RPC_PROGVERSMISMATCH, "RPC: Program/version mismatch" }, - { RPC_PROCUNAVAIL, + { RPC_PROCUNAVAIL, "RPC: Procedure unavailable" }, - { RPC_CANTDECODEARGS, + { RPC_CANTDECODEARGS, "RPC: Server can't decode arguments" }, - { RPC_SYSTEMERROR, + { RPC_SYSTEMERROR, "RPC: Remote system error" }, - { RPC_UNKNOWNHOST, + { RPC_UNKNOWNHOST, "RPC: Unknown host" }, { RPC_UNKNOWNPROTO, "RPC: Unknown protocol" }, - { RPC_PMAPFAILURE, + { RPC_PMAPFAILURE, "RPC: Port mapper failure" }, - { RPC_PROGNOTREGISTERED, + { RPC_PROGNOTREGISTERED, "RPC: Program not registered"}, - { RPC_FAILED, + { RPC_FAILED, "RPC: Failed (unspecified error)"} }; @@ -265,7 +265,7 @@ clnt_pcreateerror(s) } struct auth_errtab { - enum auth_stat status; + enum auth_stat status; char *message; }; diff --git a/lib/libc/rpc/clnt_raw.c b/lib/libc/rpc/clnt_raw.c index 9ee87b225701..0f86b3e571f5 100644 --- a/lib/libc/rpc/clnt_raw.c +++ b/lib/libc/rpc/clnt_raw.c @@ -5,11 +5,11 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. @@ -17,11 +17,11 @@ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)clnt_raw.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: clnt_raw.c,v 1.1 1993/10/27 05:40:22 paul Exp $"; +static char *rcsid = "$Id: clnt_raw.c,v 1.1 1994/08/07 18:35:45 wollman Exp $"; #endif /* @@ -103,7 +103,7 @@ clntraw_create(prog, vers) call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; call_msg.rm_call.cb_prog = prog; call_msg.rm_call.cb_vers = vers; - xdrmem_create(xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE); + xdrmem_create(xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE); if (! xdr_callhdr(xdrs, &call_msg)) { perror("clnt_raw.c - Fatal header serialization error."); } @@ -123,7 +123,7 @@ clntraw_create(prog, vers) return (client); } -static enum clnt_stat +static enum clnt_stat clntraw_call(h, proc, xargs, argsp, xresults, resultsp, timeout) CLIENT *h; u_long proc; diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c index 671e2eb61a93..fefef2efc288 100644 --- a/lib/libc/rpc/clnt_simple.c +++ b/lib/libc/rpc/clnt_simple.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,10 +30,10 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)clnt_simple.c 1.35 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)clnt_simple.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: clnt_simple.c,v 1.1 1993/10/27 05:40:23 paul Exp $"; +static char *rcsid = "$Id: clnt_simple.c,v 1.1 1994/08/07 18:35:46 wollman Exp $"; #endif -/* +/* * clnt_simple.c * Simplified front end to rpc. * @@ -78,7 +78,7 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out) } if (crp->valid && crp->oldprognum == prognum && crp->oldversnum == versnum && strcmp(crp->oldhost, host) == 0) { - /* reuse old client */ + /* reuse old client */ } else { crp->valid = 0; (void)close(crp->socket); @@ -106,7 +106,7 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out) tottimeout.tv_usec = 0; clnt_stat = clnt_call(crp->client, procnum, inproc, in, outproc, out, tottimeout); - /* + /* * if call failed, empty cache */ if (clnt_stat != RPC_SUCCESS) diff --git a/lib/libc/rpc/clnt_tcp.c b/lib/libc/rpc/clnt_tcp.c index efc041ab8db3..1de9d8e972f9 100644 --- a/lib/libc/rpc/clnt_tcp.c +++ b/lib/libc/rpc/clnt_tcp.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,9 +30,9 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)clnt_tcp.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: clnt_tcp.c,v 1.1 1993/10/27 05:40:24 paul Exp $"; +static char *rcsid = "$Id: clnt_tcp.c,v 1.1 1994/08/07 18:35:47 wollman Exp $"; #endif - + /* * clnt_tcp.c, Implements a TCP/IP based, client side RPC. * @@ -87,7 +87,7 @@ struct ct_data { bool_t ct_closeit; struct timeval ct_wait; bool_t ct_waitset; /* wait set by clnt_control? */ - struct sockaddr_in ct_addr; + struct sockaddr_in ct_addr; struct rpc_err ct_error; char ct_mcall[MCALL_MSG_SIZE]; /* marshalled callmsg */ u_int ct_mpos; /* pos after marshal */ diff --git a/lib/libc/rpc/clnt_udp.c b/lib/libc/rpc/clnt_udp.c index 42dfcf1e76fd..02867265a964 100644 --- a/lib/libc/rpc/clnt_udp.c +++ b/lib/libc/rpc/clnt_udp.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)clnt_udp.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: clnt_udp.c,v 1.1 1994/08/07 18:35:48 wollman Exp $"; +static char *rcsid = "$Id: clnt_udp.c,v 1.2 1995/04/02 20:05:20 wpaul Exp $"; #endif /* @@ -68,7 +68,7 @@ static struct clnt_ops udp_ops = { clntudp_control }; -/* +/* * Private data kept per client handle */ struct cu_data { @@ -206,7 +206,7 @@ clntudp_create(raddr, program, version, wait, sockp) UDPMSGSIZE, UDPMSGSIZE)); } -static enum clnt_stat +static enum clnt_stat clntudp_call(cl, proc, xargs, argsp, xresults, resultsp, utimeout) register CLIENT *cl; /* client handle */ u_long proc; /* procedure number */ @@ -298,7 +298,7 @@ send_again: #endif /* def FD_SETSIZE */ for (;;) { readfds = mask; - switch (select(_rpc_dtablesize(), &readfds, (int *)NULL, + switch (select(_rpc_dtablesize(), &readfds, (int *)NULL, (int *)NULL, &(cu->cu_wait))) { case 0: @@ -311,7 +311,7 @@ send_again: if ((time_waited.tv_sec < timeout.tv_sec) || ((time_waited.tv_sec == timeout.tv_sec) && (time_waited.tv_usec < timeout.tv_usec))) - goto send_again; + goto send_again; return (cu->cu_error.re_status = RPC_TIMEDOUT); /* @@ -320,27 +320,27 @@ send_again: */ case -1: if (errno == EINTR) - continue; + continue; cu->cu_error.re_errno = errno; return (cu->cu_error.re_status = RPC_CANTRECV); } do { fromlen = sizeof(struct sockaddr); - inlen = recvfrom(cu->cu_sock, cu->cu_inbuf, + inlen = recvfrom(cu->cu_sock, cu->cu_inbuf, (int) cu->cu_recvsz, 0, (struct sockaddr *)&from, &fromlen); } while (inlen < 0 && errno == EINTR); if (inlen < 0) { if (errno == EWOULDBLOCK) - continue; + continue; cu->cu_error.re_errno = errno; return (cu->cu_error.re_status = RPC_CANTRECV); } if (inlen < sizeof(u_long)) - continue; + continue; /* see if reply transaction id matches sent id */ if (*((u_long *)(cu->cu_inbuf)) != *((u_long *)(cu->cu_outbuf))) - continue; + continue; /* we now assume we have the proper reply */ break; } @@ -363,7 +363,7 @@ send_again: xdrs->x_op = XDR_FREE; (void)xdr_opaque_auth(xdrs, &(reply_msg.acpted_rply.ar_verf)); - } + } } /* end successful completion */ else { /* maybe our credentials need to be refreshed ... */ @@ -403,7 +403,7 @@ clntudp_freeres(cl, xdr_res, res_ptr) return ((*xdr_res)(xdrs, res_ptr)); } -static void +static void clntudp_abort(/*h*/) /*CLIENT *h;*/ { @@ -438,7 +438,7 @@ clntudp_control(cl, request, info) } return (TRUE); } - + static void clntudp_destroy(cl) CLIENT *cl; diff --git a/lib/libc/rpc/get_myaddress.c b/lib/libc/rpc/get_myaddress.c index 2b0b20d96f0e..c5cd91c98c6e 100644 --- a/lib/libc/rpc/get_myaddress.c +++ b/lib/libc/rpc/get_myaddress.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)get_myaddress.c 1.4 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)get_myaddress.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: get_myaddress.c,v 1.1 1993/10/27 05:40:27 paul Exp $"; +static char *rcsid = "$Id: get_myaddress.c,v 1.1 1994/08/07 18:35:49 wollman Exp $"; #endif /* @@ -50,7 +50,7 @@ static char *rcsid = "$Id: get_myaddress.c,v 1.1 1993/10/27 05:40:27 paul Exp $" #include <netinet/in.h> #include <arpa/inet.h> -/* +/* * don't use gethostbyname, which would invoke yellow pages */ get_myaddress(addr) diff --git a/lib/libc/rpc/getrpcent.c b/lib/libc/rpc/getrpcent.c index a495278f8d27..f94fcff8f31a 100644 --- a/lib/libc/rpc/getrpcent.c +++ b/lib/libc/rpc/getrpcent.c @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)getrpcent.c 1.14 91/03/11 Copyr 1984 Sun Micro";*/ -static char *rcsid = "$Id: getrpcent.c,v 1.1 1993/10/27 05:40:29 paul Exp $"; +static char *rcsid = "$Id: getrpcent.c,v 1.1 1994/08/07 18:35:51 wollman Exp $"; #endif /* @@ -279,7 +279,7 @@ interpret(val, len) d->rpc.r_number = atoi(cp); q = d->rpc.r_aliases = d->rpc_aliases; cp = strpbrk(cp, " \t"); - if (cp != NULL) + if (cp != NULL) *cp++ = '\0'; while (cp && *cp) { if (*cp == ' ' || *cp == '\t') { diff --git a/lib/libc/rpc/getrpcport.c b/lib/libc/rpc/getrpcport.c index f1d58f9eb718..75af815580fb 100644 --- a/lib/libc/rpc/getrpcport.c +++ b/lib/libc/rpc/getrpcport.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)getrpcport.c 1.3 87/08/11 SMI";*/ /*static char *sccsid = "from: @(#)getrpcport.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: getrpcport.c,v 1.1 1993/10/27 05:40:31 paul Exp $"; +static char *rcsid = "$Id: getrpcport.c,v 1.1 1994/08/07 18:35:52 wollman Exp $"; #endif /* diff --git a/lib/libc/rpc/pmap_clnt.c b/lib/libc/rpc/pmap_clnt.c index 4ef44ec3144c..a69284d917aa 100644 --- a/lib/libc/rpc/pmap_clnt.c +++ b/lib/libc/rpc/pmap_clnt.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)pmap_clnt.c 1.37 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)pmap_clnt.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: pmap_clnt.c,v 1.1 1993/10/27 05:40:32 paul Exp $"; +static char *rcsid = "$Id: pmap_clnt.c,v 1.1 1994/08/07 18:35:53 wollman Exp $"; #endif /* diff --git a/lib/libc/rpc/pmap_getmaps.c b/lib/libc/rpc/pmap_getmaps.c index 5af52106454b..7f43baa63cd6 100644 --- a/lib/libc/rpc/pmap_getmaps.c +++ b/lib/libc/rpc/pmap_getmaps.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)pmap_getmaps.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: pmap_getmaps.c,v 1.1 1993/10/27 05:40:35 paul Exp $"; +static char *rcsid = "$Id: pmap_getmaps.c,v 1.1 1994/08/07 18:35:54 wollman Exp $"; #endif /* diff --git a/lib/libc/rpc/pmap_getport.c b/lib/libc/rpc/pmap_getport.c index 06ed4d409fbb..c982fe84977a 100644 --- a/lib/libc/rpc/pmap_getport.c +++ b/lib/libc/rpc/pmap_getport.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)pmap_getport.c 1.9 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)pmap_getport.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: pmap_getport.c,v 1.1 1993/10/27 05:40:36 paul Exp $"; +static char *rcsid = "$Id: pmap_getport.c,v 1.1 1994/08/07 18:35:55 wollman Exp $"; #endif /* diff --git a/lib/libc/rpc/pmap_prot.c b/lib/libc/rpc/pmap_prot.c index ea0a20dfb144..07b5acd5b2af 100644 --- a/lib/libc/rpc/pmap_prot.c +++ b/lib/libc/rpc/pmap_prot.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)pmap_prot.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: pmap_prot.c,v 1.1 1993/10/27 05:40:37 paul Exp $"; +static char *rcsid = "$Id: pmap_prot.c,v 1.1 1994/08/07 18:35:56 wollman Exp $"; #endif /* @@ -51,8 +51,8 @@ xdr_pmap(xdrs, regs) struct pmap *regs; { - if (xdr_u_long(xdrs, ®s->pm_prog) && - xdr_u_long(xdrs, ®s->pm_vers) && + if (xdr_u_long(xdrs, ®s->pm_prog) && + xdr_u_long(xdrs, ®s->pm_vers) && xdr_u_long(xdrs, ®s->pm_prot)) return (xdr_u_long(xdrs, ®s->pm_port)); return (FALSE); diff --git a/lib/libc/rpc/pmap_prot2.c b/lib/libc/rpc/pmap_prot2.c index 71ab21a7103b..5e937ed7114e 100644 --- a/lib/libc/rpc/pmap_prot2.c +++ b/lib/libc/rpc/pmap_prot2.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)pmap_prot2.c 1.3 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)pmap_prot2.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: pmap_prot2.c,v 1.1 1993/10/27 05:40:39 paul Exp $"; +static char *rcsid = "$Id: pmap_prot2.c,v 1.1 1994/08/07 18:35:57 wollman Exp $"; #endif /* @@ -45,7 +45,7 @@ static char *rcsid = "$Id: pmap_prot2.c,v 1.1 1993/10/27 05:40:39 paul Exp $"; #include <rpc/pmap_prot.h> -/* +/* * What is going on with linked lists? (!) * First recall the link list declaration from pmap_prot.h: * @@ -54,11 +54,11 @@ static char *rcsid = "$Id: pmap_prot2.c,v 1.1 1993/10/27 05:40:39 paul Exp $"; * struct pmaplist *pml_map; * }; * - * Compare that declaration with a corresponding xdr declaration that + * Compare that declaration with a corresponding xdr declaration that * is (a) pointer-less, and (b) recursive: * * typedef union switch (bool_t) { - * + * * case TRUE: struct { * struct pmap; * pmaplist_t foo; @@ -71,8 +71,8 @@ static char *rcsid = "$Id: pmap_prot2.c,v 1.1 1993/10/27 05:40:39 paul Exp $"; * the C declaration has no bool_t variable. The bool_t can be * interpreted as ``more data follows me''; if FALSE then nothing * follows this bool_t; if TRUE then the bool_t is followed by - * an actual struct pmap, and then (recursively) by the - * xdr union, pamplist_t. + * an actual struct pmap, and then (recursively) by the + * xdr union, pamplist_t. * * This could be implemented via the xdr_union primitive, though this * would cause a one recursive call per element in the list. Rather than do @@ -109,7 +109,7 @@ xdr_pmaplist(xdrs, rp) * before we free the current object ... */ if (freeing) - next = &((*rp)->pml_next); + next = &((*rp)->pml_next); if (! xdr_reference(xdrs, (caddr_t *)rp, (u_int)sizeof(struct pmaplist), xdr_pmap)) return (FALSE); diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c index 339860c2c153..6f1b04832183 100644 --- a/lib/libc/rpc/pmap_rmt.c +++ b/lib/libc/rpc/pmap_rmt.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)pmap_rmt.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: pmap_rmt.c,v 1.1 1993/10/27 05:40:40 paul Exp $"; +static char *rcsid = "$Id: pmap_rmt.c,v 1.1 1994/08/07 18:35:57 wollman Exp $"; #endif /* @@ -156,7 +156,7 @@ xdr_rmtcallres(xdrs, crp) /* * The following is kludged-up support for simple rpc broadcasts. - * Someday a large, complicated system will replace these trivial + * Someday a large, complicated system will replace these trivial * routines which only support udp/ip . */ @@ -214,7 +214,7 @@ getbroadcastnets(addrs, sock, buf) typedef bool_t (*resultproc_t)(); -enum clnt_stat +enum clnt_stat clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) u_long prog; /* program number */ u_long vers; /* version number */ @@ -248,7 +248,7 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) struct rmtcallargs a; struct rmtcallres r; struct rpc_msg msg; - struct timeval t; + struct timeval t; char outbuf[MAX_BROADCAST_SIZE], inbuf[UDPMSGSIZE]; /* @@ -328,7 +328,7 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult) msg.acpted_rply.ar_results.where = (caddr_t)&r; msg.acpted_rply.ar_results.proc = xdr_rmtcallres; readfds = mask; - switch (select(_rpc_dtablesize(), &readfds, (int *)NULL, + switch (select(_rpc_dtablesize(), &readfds, (int *)NULL, (int *)NULL, &t)) { case 0: /* timed out */ diff --git a/lib/libc/rpc/rpc_callmsg.c b/lib/libc/rpc/rpc_callmsg.c index 4ec59dbc7855..205280379d62 100644 --- a/lib/libc/rpc/rpc_callmsg.c +++ b/lib/libc/rpc/rpc_callmsg.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)rpc_callmsg.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: rpc_callmsg.c,v 1.1 1993/10/27 05:40:46 paul Exp $"; +static char *rcsid = "$Id: rpc_callmsg.c,v 1.1 1994/08/07 18:36:00 wollman Exp $"; #endif /* diff --git a/lib/libc/rpc/rpc_commondata.c b/lib/libc/rpc/rpc_commondata.c index e870ab8dde7c..aa095265b086 100644 --- a/lib/libc/rpc/rpc_commondata.c +++ b/lib/libc/rpc/rpc_commondata.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -29,13 +29,13 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)rpc_commondata.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: rpc_commondata.c,v 1.1 1993/10/27 05:40:47 paul Exp $"; +static char *rcsid = "$Id: rpc_commondata.c,v 1.1 1994/08/07 18:36:01 wollman Exp $"; #endif #include <rpc/rpc.h> /* * This file should only contain common data (global data) that is exported - * by public interfaces + * by public interfaces */ struct opaque_auth _null_auth; #ifdef FD_SETSIZE diff --git a/lib/libc/rpc/rpc_dtablesize.c b/lib/libc/rpc/rpc_dtablesize.c index e448624883b0..6ca511df8994 100644 --- a/lib/libc/rpc/rpc_dtablesize.c +++ b/lib/libc/rpc/rpc_dtablesize.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -53,7 +53,7 @@ static char *rcsid = "rpc_dtablesize.c,v 1.1 1994/08/07 18:36:02 wollman Exp"; _rpc_dtablesize() { static int size; - + if (size == 0) { size = getdtablesize(); if (size > FD_SETSIZE) diff --git a/lib/libc/rpc/rpc_prot.c b/lib/libc/rpc/rpc_prot.c index 7fbb36fd7557..1693b6730c83 100644 --- a/lib/libc/rpc/rpc_prot.c +++ b/lib/libc/rpc/rpc_prot.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC";*/ -static char *rcsid = "$Id: rpc_prot.c,v 1.1 1993/10/27 05:40:50 paul Exp $"; +static char *rcsid = "$Id: rpc_prot.c,v 1.1 1994/08/07 18:36:03 wollman Exp $"; #endif /* @@ -86,9 +86,9 @@ xdr_des_block(xdrs, blkp) /* * XDR the MSG_ACCEPTED part of a reply message union */ -bool_t +bool_t xdr_accepted_reply(xdrs, ar) - register XDR *xdrs; + register XDR *xdrs; register struct accepted_reply *ar; { @@ -113,7 +113,7 @@ xdr_accepted_reply(xdrs, ar) /* * XDR the MSG_DENIED part of a reply message union */ -bool_t +bool_t xdr_rejected_reply(xdrs, rr) register XDR *xdrs; register struct rejected_reply *rr; @@ -149,7 +149,7 @@ xdr_replymsg(xdrs, rmsg) register struct rpc_msg *rmsg; { if ( - xdr_u_long(xdrs, &(rmsg->rm_xid)) && + xdr_u_long(xdrs, &(rmsg->rm_xid)) && xdr_enum(xdrs, (enum_t *)&(rmsg->rm_direction)) && (rmsg->rm_direction == REPLY) ) return (xdr_union(xdrs, (enum_t *)&(rmsg->rm_reply.rp_stat), @@ -221,7 +221,7 @@ accepted(acpt_stat, error) error->re_lb.s2 = (long)acpt_stat; } -static void +static void rejected(rjct_stat, error) register enum reject_stat rjct_stat; register struct rpc_err *error; diff --git a/lib/libc/rpc/svc.c b/lib/libc/rpc/svc.c index 55ad25e92ad0..de16d2eac71e 100644 --- a/lib/libc/rpc/svc.c +++ b/lib/libc/rpc/svc.c @@ -5,32 +5,32 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ -#if defined(LIBC_SCCS) && !defined(lint) +#if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc.c 2.4 88/08/11 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc.c,v 1.1 1993/10/27 05:40:54 paul Exp $"; +static char *rcsid = "$Id: svc.c,v 1.1 1994/08/07 18:36:06 wollman Exp $"; #endif /* @@ -105,12 +105,12 @@ xprt_register(xprt) } /* - * De-activate a transport handle. + * De-activate a transport handle. */ void -xprt_unregister(xprt) +xprt_unregister(xprt) SVCXPRT *xprt; -{ +{ register int sock = xprt->xp_sock; #ifdef FD_SETSIZE @@ -225,15 +225,15 @@ svc_sendreply(xprt, xdr_results, xdr_location) xdrproc_t xdr_results; caddr_t xdr_location; { - struct rpc_msg rply; + struct rpc_msg rply; - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_ACCEPTED; - rply.acpted_rply.ar_verf = xprt->xp_verf; + rply.rm_direction = REPLY; + rply.rm_reply.rp_stat = MSG_ACCEPTED; + rply.acpted_rply.ar_verf = xprt->xp_verf; rply.acpted_rply.ar_stat = SUCCESS; rply.acpted_rply.ar_results.where = xdr_location; rply.acpted_rply.ar_results.proc = xdr_results; - return (SVC_REPLY(xprt, &rply)); + return (SVC_REPLY(xprt, &rply)); } /* @@ -259,13 +259,13 @@ void svcerr_decode(xprt) register SVCXPRT *xprt; { - struct rpc_msg rply; + struct rpc_msg rply; - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_ACCEPTED; + rply.rm_direction = REPLY; + rply.rm_reply.rp_stat = MSG_ACCEPTED; rply.acpted_rply.ar_verf = xprt->xp_verf; rply.acpted_rply.ar_stat = GARBAGE_ARGS; - SVC_REPLY(xprt, &rply); + SVC_REPLY(xprt, &rply); } /* @@ -275,13 +275,13 @@ void svcerr_systemerr(xprt) register SVCXPRT *xprt; { - struct rpc_msg rply; + struct rpc_msg rply; - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_ACCEPTED; + rply.rm_direction = REPLY; + rply.rm_reply.rp_stat = MSG_ACCEPTED; rply.acpted_rply.ar_verf = xprt->xp_verf; rply.acpted_rply.ar_stat = SYSTEM_ERR; - SVC_REPLY(xprt, &rply); + SVC_REPLY(xprt, &rply); } /* @@ -315,15 +315,15 @@ svcerr_weakauth(xprt) /* * Program unavailable error reply */ -void +void svcerr_noprog(xprt) register SVCXPRT *xprt; { - struct rpc_msg rply; + struct rpc_msg rply; - rply.rm_direction = REPLY; - rply.rm_reply.rp_stat = MSG_ACCEPTED; - rply.acpted_rply.ar_verf = xprt->xp_verf; + rply.rm_direction = REPLY; + rply.rm_reply.rp_stat = MSG_ACCEPTED; + rply.acpted_rply.ar_verf = xprt->xp_verf; rply.acpted_rply.ar_stat = PROG_UNAVAIL; SVC_REPLY(xprt, &rply); } @@ -331,9 +331,9 @@ svcerr_noprog(xprt) /* * Program version mismatch error reply */ -void +void svcerr_progvers(xprt, low_vers, high_vers) - register SVCXPRT *xprt; + register SVCXPRT *xprt; u_long low_vers; u_long high_vers; { @@ -358,9 +358,9 @@ svcerr_progvers(xprt, low_vers, high_vers) * the "raw" parameters (msg.rm_call.cb_cred and msg.rm_call.cb_verf) and * the "cooked" credentials (rqst->rq_clntcred). * However, this function does not know the structure of the cooked - * credentials, so it make the following assumptions: + * credentials, so it make the following assumptions: * a) the structure is contiguous (no pointers), and - * b) the cred structure size does not exceed RQCRED_SIZE bytes. + * b) the cred structure size does not exceed RQCRED_SIZE bytes. * In all events, all three parameters are freed upon exit from this routine. * The storage is trivially management on the call stack in user land, but * is mallocated in kernel land. @@ -412,7 +412,7 @@ svc_getreqset(readfds) #ifdef FD_SETSIZE - setsize = _rpc_dtablesize(); + setsize = _rpc_dtablesize(); maskp = (u_long *)readfds->fds_bits; for (sock = 0; sock < setsize; sock += NFDBITS) { for (mask = *maskp++; bit = ffs(mask); mask ^= (1 << (bit - 1))) { diff --git a/lib/libc/rpc/svc_auth.c b/lib/libc/rpc/svc_auth.c index 0a9f2765bf6a..6c1e560c2be1 100644 --- a/lib/libc/rpc/svc_auth.c +++ b/lib/libc/rpc/svc_auth.c @@ -5,11 +5,11 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc_auth.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc_auth.c 2.1 88/08/07 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_auth.c,v 1.1 1993/10/27 05:40:56 paul Exp $"; +static char *rcsid = "$Id: svc_auth.c,v 1.1 1994/08/07 18:36:07 wollman Exp $"; #endif /* @@ -43,16 +43,16 @@ static char *rcsid = "$Id: svc_auth.c,v 1.1 1993/10/27 05:40:56 paul Exp $"; #include <rpc/rpc.h> /* - * svcauthsw is the bdevsw of server side authentication. - * + * svcauthsw is the bdevsw of server side authentication. + * * Server side authenticators are called from authenticate by * using the client auth struct flavor field to index into svcauthsw. - * The server auth flavors must implement a routine that looks - * like: - * + * The server auth flavors must implement a routine that looks + * like: + * * enum auth_stat * flavorx_auth(rqst, msg) - * register struct svc_req *rqst; + * register struct svc_req *rqst; * register struct rpc_msg *msg; * */ diff --git a/lib/libc/rpc/svc_auth_unix.c b/lib/libc/rpc/svc_auth_unix.c index 5cf825f6f8ab..d7d342405fd7 100644 --- a/lib/libc/rpc/svc_auth_unix.c +++ b/lib/libc/rpc/svc_auth_unix.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc_auth_unix.c 1.28 88/02/08 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc_auth_unix.c 2.3 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_auth_unix.c,v 1.1 1993/10/27 05:40:58 paul Exp $"; +static char *rcsid = "$Id: svc_auth_unix.c,v 1.1 1994/08/07 18:36:08 wollman Exp $"; #endif /* @@ -127,7 +127,7 @@ done: * Looks up longhand in a cache. */ /*ARGSUSED*/ -enum auth_stat +enum auth_stat _svcauth_short(rqst, msg) struct svc_req *rqst; struct rpc_msg *msg; diff --git a/lib/libc/rpc/svc_raw.c b/lib/libc/rpc/svc_raw.c index e34ea9e32608..8f0694be6335 100644 --- a/lib/libc/rpc/svc_raw.c +++ b/lib/libc/rpc/svc_raw.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc_raw.c 1.15 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc_raw.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_raw.c,v 1.1 1993/10/27 05:40:59 paul Exp $"; +static char *rcsid = "$Id: svc_raw.c,v 1.1 1994/08/07 18:36:08 wollman Exp $"; #endif /* @@ -151,7 +151,7 @@ svcraw_freeargs(xprt, xdr_args, args_ptr) SVCXPRT *xprt; xdrproc_t xdr_args; caddr_t args_ptr; -{ +{ register struct svcraw_private *srp = svcraw_private; register XDR *xdrs; @@ -160,7 +160,7 @@ svcraw_freeargs(xprt, xdr_args, args_ptr) xdrs = &srp->xdr_stream; xdrs->x_op = XDR_FREE; return ((*xdr_args)(xdrs, args_ptr)); -} +} static void svcraw_destroy() diff --git a/lib/libc/rpc/svc_run.c b/lib/libc/rpc/svc_run.c index 52fddf226382..730acd3f1907 100644 --- a/lib/libc/rpc/svc_run.c +++ b/lib/libc/rpc/svc_run.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc_run.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_run.c,v 1.1 1993/10/27 05:41:00 paul Exp $"; +static char *rcsid = "$Id: svc_run.c,v 1.1 1994/08/07 18:36:09 wollman Exp $"; #endif /* diff --git a/lib/libc/rpc/svc_simple.c b/lib/libc/rpc/svc_simple.c index eacf859f5ca9..75125b39a3a0 100644 --- a/lib/libc/rpc/svc_simple.c +++ b/lib/libc/rpc/svc_simple.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,10 +30,10 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc_simple.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_simple.c,v 1.1 1993/10/27 05:41:01 paul Exp $"; +static char *rcsid = "$Id: svc_simple.c,v 1.1 1994/08/07 18:36:10 wollman Exp $"; #endif -/* +/* * svc_simple.c * Simplified front end to rpc. * @@ -60,7 +60,7 @@ registerrpc(prognum, versnum, procnum, progname, inproc, outproc) char *(*progname)(); xdrproc_t inproc, outproc; { - + if (procnum == NULLPROC) { (void) fprintf(stderr, "can't reassign procedure number %d\n", NULLPROC); @@ -74,7 +74,7 @@ registerrpc(prognum, versnum, procnum, progname, inproc, outproc) } } (void) pmap_unset((u_long)prognum, (u_long)versnum); - if (!svc_register(transp, (u_long)prognum, (u_long)versnum, + if (!svc_register(transp, (u_long)prognum, (u_long)versnum, universal, IPPROTO_UDP)) { (void) fprintf(stderr, "couldn't register prog %d vers %d\n", prognum, versnum); @@ -105,7 +105,7 @@ universal(rqstp, transp) char xdrbuf[UDPMSGSIZE]; struct proglst *pl; - /* + /* * enforce "procnum 0 is echo" convention */ if (rqstp->rq_proc == NULLPROC) { diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c index 9d19504858fb..6c20de9cc247 100644 --- a/lib/libc/rpc/svc_tcp.c +++ b/lib/libc/rpc/svc_tcp.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,11 +30,11 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_tcp.c,v 1.1 1993/10/27 05:41:02 paul Exp $"; +static char *rcsid = "$Id: svc_tcp.c,v 1.1 1994/08/07 18:36:11 wollman Exp $"; #endif /* - * svc_tcp.c, Server side for TCP/IP based RPC. + * svc_tcp.c, Server side for TCP/IP based RPC. * * Copyright (C) 1984, Sun Microsystems, Inc. * @@ -195,7 +195,7 @@ makefd_xprt(fd, sendsize, recvsize) { register SVCXPRT *xprt; register struct tcp_conn *cd; - + xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT)); if (xprt == (SVCXPRT *)NULL) { (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n"); @@ -306,7 +306,7 @@ readtcp(xprt, buf, len) #endif /* def FD_SETSIZE */ do { readfds = mask; - if (select(_rpc_dtablesize(), &readfds, (int*)NULL, (int*)NULL, + if (select(_rpc_dtablesize(), &readfds, (int*)NULL, (int*)NULL, &wait_per_try) <= 0) { if (errno == EINTR) { continue; diff --git a/lib/libc/rpc/svc_udp.c b/lib/libc/rpc/svc_udp.c index e69318ca2f69..58a90fa6e0fe 100644 --- a/lib/libc/rpc/svc_udp.c +++ b/lib/libc/rpc/svc_udp.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)svc_udp.c 2.2 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: svc_udp.c,v 1.1 1994/08/07 18:36:12 wollman Exp $"; +static char *rcsid = "$Id: svc_udp.c,v 1.2 1994/08/31 12:38:18 csgr Exp $"; #endif /* @@ -164,7 +164,7 @@ svcudp_stat(xprt) SVCXPRT *xprt; { - return (XPRT_IDLE); + return (XPRT_IDLE); } static bool_t @@ -204,8 +204,8 @@ svcudp_recv(xprt, msg) static bool_t svcudp_reply(xprt, msg) - register SVCXPRT *xprt; - struct rpc_msg *msg; + register SVCXPRT *xprt; + struct rpc_msg *msg; { register struct svcudp_data *su = su_data(xprt); register XDR *xdrs = &(su->su_xdrs); @@ -284,7 +284,7 @@ svcudp_destroy(xprt) (type *) mem_alloc((unsigned) (sizeof(type) * (size))) #define BZERO(addr, type, size) \ - bzero((char *) addr, sizeof(type) * (int) (size)) + bzero((char *) addr, sizeof(type) * (int) (size)) /* * An entry in the cache @@ -307,7 +307,7 @@ struct cache_node { /* * Next node on the list, if there is a collision */ - cache_ptr cache_next; + cache_ptr cache_next; }; @@ -331,11 +331,11 @@ struct udp_cache { * the hashing function */ #define CACHE_LOC(transp, xid) \ - (xid % (SPARSENESS*((struct udp_cache *) su_data(transp)->su_cache)->uc_size)) + (xid % (SPARSENESS*((struct udp_cache *) su_data(transp)->su_cache)->uc_size)) /* - * Enable use of the cache. + * Enable use of the cache. * Note: there is no disable. */ svcudp_enablecache(transp, size) @@ -347,7 +347,7 @@ svcudp_enablecache(transp, size) if (su->su_cache != NULL) { CACHE_PERROR("enablecache: cache already enabled"); - return(0); + return(0); } uc = ALLOC(struct udp_cache, 1); if (uc == NULL) { @@ -379,9 +379,9 @@ svcudp_enablecache(transp, size) static void cache_set(xprt, replylen) SVCXPRT *xprt; - u_long replylen; + u_long replylen; { - register cache_ptr victim; + register cache_ptr victim; register cache_ptr *vicp; register struct svcudp_data *su = su_data(xprt); struct udp_cache *uc = (struct udp_cache *) su->su_cache; @@ -395,9 +395,9 @@ cache_set(xprt, replylen) victim = uc->uc_fifo[uc->uc_nextvictim]; if (victim != NULL) { loc = CACHE_LOC(xprt, victim->cache_xid); - for (vicp = &uc->uc_entries[loc]; - *vicp != NULL && *vicp != victim; - vicp = &(*vicp)->cache_next) + for (vicp = &uc->uc_entries[loc]; + *vicp != NULL && *vicp != victim; + vicp = &(*vicp)->cache_next) ; if (*vicp == NULL) { CACHE_PERROR("cache_set: victim not found"); @@ -431,7 +431,7 @@ cache_set(xprt, replylen) victim->cache_prog = uc->uc_prog; victim->cache_addr = uc->uc_addr; loc = CACHE_LOC(xprt, victim->cache_xid); - victim->cache_next = uc->uc_entries[loc]; + victim->cache_next = uc->uc_entries[loc]; uc->uc_entries[loc] = victim; uc->uc_fifo[uc->uc_nextvictim++] = victim; uc->uc_nextvictim %= uc->uc_size; diff --git a/lib/libc/stdio/Makefile.inc b/lib/libc/stdio/Makefile.inc index 04b01838a2c6..5ca501621a49 100644 --- a/lib/libc/stdio/Makefile.inc +++ b/lib/libc/stdio/Makefile.inc @@ -32,7 +32,7 @@ MLINKS+=getc.3 fgetc.3 getc.3 getchar.3 getc.3 getw.3 MLINKS+=mktemp.3 mkstemp.3 MLINKS+=printf.3 fprintf.3 printf.3 snprintf.3 printf.3 sprintf.3 \ printf.3 vfprintf.3 printf.3 vprintf.3 printf.3 vsnprintf.3 \ - printf.3 vsprintf.3 + printf.3 vsprintf.3 MLINKS+=putc.3 fputc.3 putc.3 putchar.3 putc.3 putw.3 MLINKS+=scanf.3 fscanf.3 scanf.3 sscanf.3 scanf.3 vfscanf.3 scanf.3 vscanf.3 \ scanf.3 vsscanf.3 diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c index 88dd03c89986..7a8a3efeb842 100644 --- a/lib/libc/stdio/freopen.c +++ b/lib/libc/stdio/freopen.c @@ -47,8 +47,8 @@ static char sccsid[] = "@(#)freopen.c 8.1 (Berkeley) 6/4/93"; #include <stdlib.h> #include "local.h" -/* - * Re-direct an existing, open (probably) file to some other file. +/* + * Re-direct an existing, open (probably) file to some other file. * ANSI is written such that the original file gets closed if at * all possible, no matter what. */ diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c index 78993877daf8..c2d7d874632a 100644 --- a/lib/libc/stdio/stdio.c +++ b/lib/libc/stdio/stdio.c @@ -54,7 +54,7 @@ __sread(cookie, buf, n) { register FILE *fp = cookie; register int ret; - + ret = read(fp->_file, buf, n); /* if the read succeeded, update the current offset */ if (ret >= 0) @@ -85,7 +85,7 @@ __sseek(cookie, offset, whence) { register FILE *fp = cookie; register off_t ret; - + ret = lseek(fp->_file, (off_t)offset, whence); if (ret == -1L) fp->_flags &= ~__SOFF; diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index 94e65cd5433b..f53db612ff60 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -537,7 +537,7 @@ fp_begin: if (prec == -1) ch = (ch == 'g') ? 'e' : 'E'; else ch = 'g'; - } + } if (ch <= 'e') { /* 'e' or 'E' fmt */ --expt; expsize = exponent(expstr, expt, ch); @@ -803,8 +803,8 @@ cvt(value, ndigits, flags, sign, decpt, ch, length) mode = 3; /* ndigits after the decimal point */ else { /* - * To obtain ndigits after the decimal point for the 'e' - * and 'E' formats, round to ndigits + 1 significant + * To obtain ndigits after the decimal point for the 'e' + * and 'E' formats, round to ndigits + 1 significant * figures. */ if (ch == 'e' || ch == 'E') diff --git a/lib/libc/stdlib/getsubopt.c b/lib/libc/stdlib/getsubopt.c index d0ebde2b4aa3..afd577ad933a 100644 --- a/lib/libc/stdlib/getsubopt.c +++ b/lib/libc/stdlib/getsubopt.c @@ -80,7 +80,7 @@ getsubopt(optionp, tokens, valuep) *p = '\0'; for (*valuep = ++p; *p && *p != ',' && *p != ' ' && *p != '\t'; ++p); - if (*p) + if (*p) *p++ = '\0'; } else *p++ = '\0'; diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index ea8f092a7176..26a2b54687e2 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -39,9 +39,9 @@ static char sccsid[] = "@(#)malloc.c 8.1 (Berkeley) 6/4/93"; * malloc.c (Caltech) 2/21/82 * Chris Kingsley, kingsley@cit-20. * - * This is a very fast storage allocator. It allocates blocks of a small + * This is a very fast storage allocator. It allocates blocks of a small * number of different sizes, and keeps free lists of each size. Blocks that - * don't exactly fit are passed up to the next larger size. In this + * don't exactly fit are passed up to the next larger size. In this * implementation, the available sizes are 2^n-4 (or 2^n-10) bytes long. * This is designed for use in a virtual memory environment. */ @@ -257,7 +257,7 @@ morecore(bucket) void free(cp) void *cp; -{ +{ register int size; register union overhead *op; @@ -298,9 +298,9 @@ int __realloc_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */ void * realloc(cp, nbytes) - void *cp; + void *cp; size_t nbytes; -{ +{ register u_int onb; register int i; union overhead *op; @@ -389,7 +389,7 @@ findbucket(freep, srchlen) #ifdef MSTATS /* * mstats - print out statistics about malloc - * + * * Prints two lines of numbers, one showing the length of the free list * for each size category, the second showing the number of mallocs - * frees for each size category. diff --git a/lib/libc/stdlib/merge.c b/lib/libc/stdlib/merge.c index 7d008445504d..a47e3007290e 100644 --- a/lib/libc/stdlib/merge.c +++ b/lib/libc/stdlib/merge.c @@ -80,7 +80,7 @@ static void insertionsort __P((u_char *, size_t, size_t, int (*)())); do \ *dst++ = *src++; \ while (i -= 1) - + /* * Find the next possible pointer head. (Trickery for forcing an array * to do double duty as a linked list when objects do not align with word @@ -164,7 +164,7 @@ EXPONENTIAL: for (i = size; ; i <<= 1) } else if ((*cmp)(q, p) <= sense) { t = p; if (i == size) - big = 0; + big = 0; goto FASTCASE; } else b = p; diff --git a/lib/libc/stdlib/qsort.c b/lib/libc/stdlib/qsort.c index 1d3aa93e0fc9..49f53495a10a 100644 --- a/lib/libc/stdlib/qsort.c +++ b/lib/libc/stdlib/qsort.c @@ -65,7 +65,7 @@ swapfunc(a, b, n, swaptype) char *a, *b; int n, swaptype; { - if(swaptype <= 1) + if(swaptype <= 1) swapcode(long, a, b, n) else swapcode(char, a, b, n) @@ -151,7 +151,7 @@ loop: SWAPINIT(a, es); } if (swap_cnt == 0) { /* Switch to insertion sort */ for (pm = a + es; pm < (char *) a + n * es; pm += es) - for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; + for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; pl -= es) swap(pl, pl - es); return; @@ -164,7 +164,7 @@ loop: SWAPINIT(a, es); vecswap(pb, pn - r, r); if ((r = pb - pa) > es) qsort(a, r / es, es, cmp); - if ((r = pd - pc) > es) { + if ((r = pd - pc) > es) { /* Iterate rather than recurse to save stack space */ a = pn - r; n = r / es; diff --git a/lib/libc/stdlib/radixsort.c b/lib/libc/stdlib/radixsort.c index d211f3d6396d..af47fb06ce76 100644 --- a/lib/libc/stdlib/radixsort.c +++ b/lib/libc/stdlib/radixsort.c @@ -3,7 +3,7 @@ * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by - * Peter McIlroy and by Dan Bernstein at New York University, + * Peter McIlroy and by Dan Bernstein at New York University, * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,13 +40,13 @@ static char sccsid[] = "@(#)radixsort.c 8.1 (Berkeley) 6/4/93"; /* * Radixsort routines. - * + * * Program r_sort_a() is unstable but uses O(logN) extra memory for a stack. * Use radixsort(a, n, trace, endchar) for this case. - * + * * For stable sorting (using N extra pointers) use sradixsort(), which calls * r_sort_b(). - * + * * For a description of this code, see D. McIlroy, P. McIlroy, K. Bostic, * "Engineering Radix Sort". */ @@ -294,7 +294,7 @@ r_sort_b(a, ta, n, i, tr, endch) *--top[tr[(*ak)[i]]] = *ak; } } - + static inline void simplesort(a, n, b, tr, endch) /* insertion sort */ register const u_char **a; diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c index 0928a86e60ae..fa89f82fd836 100644 --- a/lib/libc/stdlib/random.c +++ b/lib/libc/stdlib/random.c @@ -61,7 +61,7 @@ static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 6/4/93"; * state information, which will allow a degree seven polynomial. (Note: * the zeroeth word of state information also has some other information * stored in it -- see setstate() for details). - * + * * The random number generation technique is a linear feedback shift register * approach, employing trinomials (since there are fewer terms to sum up that * way). In this approach, the least significant bit of all the numbers in @@ -216,12 +216,12 @@ srandom(x) * the break values for the different R.N.G.'s, we choose the best (largest) * one we can and set things up for it. srandom() is then called to * initialize the state information. - * + * * Note that on return from srandom(), we set state[-1] to be the type * multiplexed with the current value of the rear pointer; this is so * successive calls to initstate() won't lose this information and will be * able to restart with setstate(). - * + * * Note: the first thing we do is save the current state, if any, just like * setstate() so that it doesn't matter when initstate is called. * diff --git a/lib/libc/stdlib/setenv.c b/lib/libc/stdlib/setenv.c index b36d6734fa53..4a28f25ef93e 100644 --- a/lib/libc/stdlib/setenv.c +++ b/lib/libc/stdlib/setenv.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)setenv.c 8.1 (Berkeley) 6/4/93"; #include <stdlib.h> #include <string.h> -char *__findenv __P((const char *, int *)); +char *__findenv __P((const char *, int *)); /* * setenv -- diff --git a/lib/libc/stdlib/strhash.c b/lib/libc/stdlib/strhash.c index 77bc02ef0c64..0b50ce020fdd 100644 --- a/lib/libc/stdlib/strhash.c +++ b/lib/libc/stdlib/strhash.c @@ -1,5 +1,5 @@ #ifndef lint -static char *rcsid = "$Header: /home/ncvs/src/lib/libc/stdlib/strhash.c,v 1.2 1995/03/26 19:32:24 ache Exp $"; +static char *rcsid = "$Header: /home/ncvs/src/lib/libc/stdlib/strhash.c,v 1.3 1995/03/28 08:41:02 jkh Exp $"; #endif /* @@ -12,12 +12,12 @@ static char *rcsid = "$Header: /home/ncvs/src/lib/libc/stdlib/strhash.c,v 1.2 19 * * * All rights reserved. - * + * * This is unsupported software and is subject to change without notice. * the author makes no representations about the suitability of this software * for any purpose. It is supplied "as is" without express or implied * warranty. - * + * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, provided * that the above copyright notice appear in all copies and that both that @@ -32,11 +32,18 @@ static char *rcsid = "$Header: /home/ncvs/src/lib/libc/stdlib/strhash.c,v 1.2 19 * This is a fairly simple open addressing hash scheme. * Terry did all the code, I just did the spec. * Thanks again, you crazy Aussie.. - * + * */ /* * $Log: strhash.c,v $ + * Revision 1.3 1995/03/28 08:41:02 jkh + * Fix a missing _hash() to prevent namespace pollution with the db/hash routines. + * Grrr. If the dbhash routines weren't grossly overengineered I wouldn't + * even need to do this! :-( + * + * Also now export the hash_stats routine. Manpage coming RSN - I promise. + * * Revision 1.2 1995/03/26 19:32:24 ache * Hash 8bit chars without sign extension * @@ -53,35 +60,35 @@ static char *rcsid = "$Header: /home/ncvs/src/lib/libc/stdlib/strhash.c,v 1.2 19 * * Revision 2.0 90/03/26 01:44:26 jkh * pre-beta check-in - * + * * Revision 1.8 90/03/09 19:22:35 jkh * Fixed bogus comment. - * + * * Revision 1.7 90/03/09 19:01:08 jkh * Added comments, GPL. - * + * * Revision 1.6 90/03/08 17:55:58 terry * Rearranged hash_purge to be a tiny bit more efficient. * Added verbose option to hash_stats. - * + * * Revision 1.5 90/03/08 17:19:54 terry * Added hash_purge. Added arg to hash_traverse. Changed all * void * to Generic. - * + * * Revision 1.4 90/03/08 12:02:35 terry * Fixed problems with allocation that I screwed up last night. * Changed bucket lists to be singly linked. Thanks to JKH, my hero. - * + * * Revision 1.3 90/03/07 21:33:33 terry * Cleaned up a few decls to keep gcc -Wall quiet. - * + * * Revision 1.2 90/03/07 21:14:53 terry * Comments. Added HASH_STATS define. Removed hash_find() * and new_node(). - * + * * Revision 1.1 90/03/07 20:49:45 terry * Initial revision - * + * * */ @@ -112,26 +119,26 @@ static hash_node *list_find(caddr_t key, hash_node *head); hash_table * hash_create(int size) { - register int i; + register int i; hash_table *new = (hash_table *)malloc(sizeof(hash_table)); if (!new || size < 0){ return HASH_NULL; } - + if (size == 0){ size = HASH_SZ; } - + if (!(new->buckets = (hash_node **)malloc(size * sizeof(hash_node *)))){ return HASH_NULL; } for (i = 0; i < size; i++){ new->buckets[i] = NODE_NULL; - } + } new->size = size; - + return new; } @@ -166,7 +173,7 @@ _hash(int size, char *key) while (*key){ h = (h << 1) ^ (h ^ (unsigned char) *key++); - } + } h %= size; return h; @@ -179,17 +186,17 @@ _hash(int size, char *key) * The function (*nukefunc)() is in charge of disposing * of the storage help by the data associated with the node. */ -void +void hash_destroy(hash_table *table, char *key, void (*nukefunc)()) { int bucket = _hash(table->size, key); hash_node *found = table->buckets[bucket]; hash_node *to_free = NODE_NULL; - + if (!found) { return; } - + if (!strcmp(found->key, key)) { /* * It was the head of the list. @@ -209,12 +216,12 @@ hash_destroy(hash_table *table, char *key, void (*nukefunc)()) } found = found->next; } - + if (!to_free){ return; } } - + if (nukefunc) (*nukefunc)(to_free->key, to_free->data); free(to_free); @@ -227,8 +234,8 @@ hash_destroy(hash_table *table, char *key, void (*nukefunc)()) * * Search the table for the given key. Then: * - * 1) If you find it and there is no replacement function, just - * return what you found. (This is a simple search). + * 1) If you find it and there is no replacement function, just + * return what you found. (This is a simple search). * 2) If you find it and there is a replacement function, run * the function on the data you found, and replace the old * data with whatever is passed in datum. Return 0. @@ -256,11 +263,11 @@ hash_search(hash_table *table, caddr_t key, void *datum, } else{ if (datum){ - + static int assign_key(); - + hash_node *new = (hash_node *)malloc(sizeof(hash_node)); - + if (!new || !assign_key(key, new)){ return GENERIC_NULL; } @@ -276,7 +283,7 @@ hash_search(hash_table *table, caddr_t key, void *datum, /* * assign_key() * - * Set the key value of a node to be 'key'. Get some space from + * Set the key value of a node to be 'key'. Get some space from * malloc and copy it in etc. Return 1 if all is well, 0 otherwise. */ static int @@ -285,11 +292,11 @@ assign_key(char *key, hash_node *node) if (!node || !key){ return 0; } - + if (!(node->key = (char *)malloc(strlen(key) + 1))){ return 0; } - + node->key[0] = '\0'; strcat(node->key, key); return 1; @@ -304,12 +311,12 @@ assign_key(char *key, hash_node *node) void hash_traverse(hash_table *table, int (*func)(), void *arg) { - register int i; + register int i; register int size = table->size; if (!func) return; - + for (i = 0; i < size; i++) { hash_node *n = table->buckets[i]; while (n) { @@ -317,7 +324,7 @@ hash_traverse(hash_table *table, int (*func)(), void *arg) return; n = n->next; } - } + } return; } @@ -331,9 +338,9 @@ hash_traverse(hash_table *table, int (*func)(), void *arg) void hash_purge(hash_table *table, void (*purge_func)(char *p1, void *p2)) { - register int i; + register int i; register int size = table->size; - + for (i = 0; i < size; i++) { hash_node *n = table->buckets[i]; if (n) { @@ -347,7 +354,7 @@ hash_purge(hash_table *table, void (*purge_func)(char *p1, void *p2)) } while (n); table->buckets[i] = NODE_NULL; } - } + } } #undef min @@ -361,19 +368,19 @@ hash_purge(hash_table *table, void (*purge_func)(char *p1, void *p2)) void hash_stats(hash_table *table, int verbose) { - register int i; + register int i; int total_elements = 0; int non_empty_buckets = 0; int max_count = 0; int max_repeats = 0; int *counts; int size = table->size; - + if (!(counts = (int *)malloc(size * sizeof(int)))){ fprintf(stderr, "malloc returns 0\n"); - exit(1); + exit(1); } - + for (i = 0; i < size; i++){ int x = 0; hash_node *n = table->buckets[i]; @@ -392,7 +399,7 @@ hash_stats(hash_table *table, int verbose) counts[i]++; n = n->next; } - + total_elements += counts[i]; if (counts[i] > max_count){ max_count = counts[i]; @@ -401,17 +408,17 @@ hash_stats(hash_table *table, int verbose) else if (counts[i] == max_count){ max_repeats++; } - + if (counts[i] && verbose){ printf(" (%d)\n", counts[i]); } - } - + } + printf("\n"); printf("%d element%s in storage.\n", total_elements, total_elements == 1 ? "" : "s"); - + if (total_elements){ - printf("%d of %d (%.2f%%) buckets are in use\n", non_empty_buckets, size, + printf("%d of %d (%.2f%%) buckets are in use\n", non_empty_buckets, size, (double)100 * (double)non_empty_buckets / (double)(size)); printf("the maximum number of elements in a bucket is %d (%d times)\n", max_count, max_repeats); printf("average per bucket is %f\n", (double)total_elements / (double)non_empty_buckets); diff --git a/lib/libc/stdlib/strtoull.c b/lib/libc/stdlib/strtoull.c index cc62a076ca4e..ee1e13b7d7c2 100644 --- a/lib/libc/stdlib/strtoull.c +++ b/lib/libc/stdlib/strtoull.c @@ -70,7 +70,7 @@ strtouq(nptr, endptr, base) if (c == '-') { neg = 1; c = *s++; - } else { + } else { neg = 0; if (c == '+') c = *s++; diff --git a/lib/libc/stdlib/strtouq.c b/lib/libc/stdlib/strtouq.c index cc62a076ca4e..ee1e13b7d7c2 100644 --- a/lib/libc/stdlib/strtouq.c +++ b/lib/libc/stdlib/strtouq.c @@ -70,7 +70,7 @@ strtouq(nptr, endptr, base) if (c == '-') { neg = 1; c = *s++; - } else { + } else { neg = 0; if (c == '+') c = *s++; diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index aafb75194718..e0a7e9a84f7c 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -1153,7 +1153,7 @@ int * number; int delta; { int number0; - + number0 = *number; *number += delta; return (*number < number0) != (delta < 0); diff --git a/lib/libc/string/memset.c b/lib/libc/string/memset.c index 9c28b7b81a38..99c72dcb0700 100644 --- a/lib/libc/string/memset.c +++ b/lib/libc/string/memset.c @@ -84,7 +84,7 @@ memset(dst0, c0, length) * * but we use a minimum of 3 here since the overhead of the code * to do word writes is substantial. - */ + */ if (length < 3 * wsize) { while (length != 0) { *dst++ = VAL; diff --git a/lib/libc/string/strsep.c b/lib/libc/string/strsep.c index 18dc3987e67e..ddad5964ce19 100644 --- a/lib/libc/string/strsep.c +++ b/lib/libc/string/strsep.c @@ -41,7 +41,7 @@ static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93"; /* * Get next token from string *stringp, where tokens are possibly-empty - * strings separated by characters from delim. + * strings separated by characters from delim. * * Writes NULs into the string at *stringp to end tokens. * delim need not remain constant from call to call. diff --git a/lib/libc/xdr/Makefile.inc b/lib/libc/xdr/Makefile.inc index b85f2eb12832..fc85212184d1 100644 --- a/lib/libc/xdr/Makefile.inc +++ b/lib/libc/xdr/Makefile.inc @@ -6,5 +6,5 @@ SRCS+= xdr.c xdr_array.c xdr_mem.c \ MAN3+= xdr/xdr.3 -UNSUPPORTED+= xdr_float.c +UNSUPPORTED+= xdr_float.c diff --git a/lib/libc/xdr/xdr.c b/lib/libc/xdr/xdr.c index 9f402047aa5a..92d75929b096 100644 --- a/lib/libc/xdr/xdr.c +++ b/lib/libc/xdr/xdr.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)xdr.c 1.35 87/08/12";*/ /*static char *sccsid = "from: @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: xdr.c,v 1.1 1993/10/27 05:41:06 paul Exp $"; +static char *rcsid = "$Id: xdr.c,v 1.1 1994/08/07 18:39:30 wollman Exp $"; #endif /* @@ -70,7 +70,7 @@ xdr_free(proc, objp) char *objp; { XDR x; - + x.x_op = XDR_FREE; (*proc)(&x, objp); } @@ -562,8 +562,8 @@ xdr_string(xdrs, cpp, maxsize) return (FALSE); } -/* - * Wrapper for xdr_string that can be called directly from +/* + * Wrapper for xdr_string that can be called directly from * routines like clnt_call */ bool_t diff --git a/lib/libc/xdr/xdr_array.c b/lib/libc/xdr/xdr_array.c index a17b534a92e7..47cc0afcb380 100644 --- a/lib/libc/xdr/xdr_array.c +++ b/lib/libc/xdr/xdr_array.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)xdr_array.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: xdr_array.c,v 1.1 1993/10/27 05:41:09 paul Exp $"; +static char *rcsid = "$Id: xdr_array.c,v 1.1 1994/08/07 18:39:31 wollman Exp $"; #endif /* @@ -93,7 +93,7 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) return (TRUE); *addrp = target = mem_alloc(nodesize); if (target == NULL) { - (void) fprintf(stderr, + (void) fprintf(stderr, "xdr_array: out of memory\n"); return (FALSE); } @@ -103,7 +103,7 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) case XDR_FREE: return (TRUE); } - + /* * now we xdr each element of array */ @@ -138,7 +138,7 @@ xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem) register char *basep; register u_int nelem; register u_int elemsize; - register xdrproc_t xdr_elem; + register xdrproc_t xdr_elem; { register u_int i; register char *elptr; @@ -150,6 +150,6 @@ xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem) } elptr += elemsize; } - return(TRUE); + return(TRUE); } diff --git a/lib/libc/xdr/xdr_float.c b/lib/libc/xdr/xdr_float.c index fae0c8b7f8e3..105ca43bbfad 100644 --- a/lib/libc/xdr/xdr_float.c +++ b/lib/libc/xdr/xdr_float.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: xdr_float.c,v 1.1 1993/10/27 05:41:10 paul Exp $"; +static char *rcsid = "$Id: xdr_float.c,v 1.1 1994/08/07 18:39:32 wollman Exp $"; #endif /* @@ -103,7 +103,7 @@ xdr_float(xdrs, fp) switch (xdrs->x_op) { case XDR_ENCODE: -#ifdef IEEEFP +#ifdef IEEEFP return (XDR_PUTLONG(xdrs, (long *)fp)); #else vs = *((struct vax_single *)fp); diff --git a/lib/libc/xdr/xdr_mem.c b/lib/libc/xdr/xdr_mem.c index 3909edda4ee8..63cacf727f52 100644 --- a/lib/libc/xdr/xdr_mem.c +++ b/lib/libc/xdr/xdr_mem.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: xdr_mem.c,v 1.1 1993/10/27 05:41:11 paul Exp $"; +static char *rcsid = "$Id: xdr_mem.c,v 1.1 1994/08/07 18:39:33 wollman Exp $"; #endif /* @@ -71,7 +71,7 @@ static struct xdr_ops xdrmem_ops = { /* * The procedure xdrmem_create initializes a stream descriptor for a - * memory buffer. + * memory buffer. */ void xdrmem_create(xdrs, addr, size, op) diff --git a/lib/libc/xdr/xdr_rec.c b/lib/libc/xdr/xdr_rec.c index 54ed0a388834..493d4436b235 100644 --- a/lib/libc/xdr/xdr_rec.c +++ b/lib/libc/xdr/xdr_rec.c @@ -5,31 +5,31 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ -#if defined(LIBC_SCCS) && !defined(lint) +#if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char *rcsid = "$Id: xdr_rec.c,v 1.1 1994/08/07 18:39:33 wollman Exp $"; +static char *rcsid = "$Id: xdr_rec.c,v 1.2 1994/08/07 22:21:14 wollman Exp $"; #endif /* @@ -45,7 +45,7 @@ static char *rcsid = "$Id: xdr_rec.c,v 1.1 1994/08/07 18:39:33 wollman Exp $"; * by n bytes of data, where n is contained in the header. The header * is represented as a htonl(u_long). Thegh order bit encodes * whether or not the fragment is the last fragment of the record - * (1 => fragment is last, 0 => more fragments to follow. + * (1 => fragment is last, 0 => more fragments to follow. * The other 31 bits encode the byte length of the fragment. */ @@ -146,8 +146,8 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) if (rstrm == NULL) { (void)fprintf(stderr, "xdrrec_create: out of memory\n"); - /* - * This is bad. Should rework xdrrec_create to + /* + * This is bad. Should rework xdrrec_create to * return a handle, and in this case return NULL */ return; @@ -260,7 +260,7 @@ xdrrec_getbytes(xdrs, addr, len) current = (len < current) ? len : current; if (! get_input_bytes(rstrm, addr, current)) return (FALSE); - addr += current; + addr += current; rstrm->fbtbc -= current; len -= current; } @@ -422,7 +422,7 @@ xdrrec_skiprecord(xdrs) /* * Look ahead fuction. - * Returns TRUE iff there is no more input in the buffer + * Returns TRUE iff there is no more input in the buffer * after consuming the rest of the current record. */ bool_t @@ -481,7 +481,7 @@ flush_out(rstrm, eor) bool_t eor; { register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0; - register u_long len = (u_long)(rstrm->out_finger) - + register u_long len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->frag_header) - sizeof(u_long); *(rstrm->frag_header) = htonl(len | eormask); diff --git a/lib/libc/xdr/xdr_reference.c b/lib/libc/xdr/xdr_reference.c index c955f8820256..d7ef28037df3 100644 --- a/lib/libc/xdr/xdr_reference.c +++ b/lib/libc/xdr/xdr_reference.c @@ -5,32 +5,32 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 */ -#if defined(LIBC_SCCS) && !defined(lint) +#if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)xdr_reference.c 1.11 87/08/11 SMI";*/ /*static char *sccsid = "from: @(#)xdr_reference.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: xdr_reference.c,v 1.1 1993/10/27 05:41:13 paul Exp $"; +static char *rcsid = "$Id: xdr_reference.c,v 1.1 1994/08/07 18:39:34 wollman Exp $"; #endif /* diff --git a/lib/libc/xdr/xdr_stdio.c b/lib/libc/xdr/xdr_stdio.c index 9761b13d5f2a..5cfdf205a619 100644 --- a/lib/libc/xdr/xdr_stdio.c +++ b/lib/libc/xdr/xdr_stdio.c @@ -5,23 +5,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -30,7 +30,7 @@ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";*/ /*static char *sccsid = "from: @(#)xdr_stdio.c 2.1 88/07/29 4.0 RPCSRC";*/ -static char *rcsid = "$Id: xdr_stdio.c,v 1.1 1993/10/27 05:41:14 paul Exp $"; +static char *rcsid = "$Id: xdr_stdio.c,v 1.1 1994/08/07 18:39:35 wollman Exp $"; #endif /* @@ -163,10 +163,10 @@ xdrstdio_getpos(xdrs) } static bool_t -xdrstdio_setpos(xdrs, pos) +xdrstdio_setpos(xdrs, pos) XDR *xdrs; u_int pos; -{ +{ return ((fseek((FILE *)xdrs->x_private, (long)pos, 0) < 0) ? FALSE : TRUE); diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c index 4d96340ed2fd..b54292ea09d4 100644 --- a/lib/libc/yp/yplib.c +++ b/lib/libc/yp/yplib.c @@ -28,7 +28,7 @@ */ #ifndef LINT -static char *rcsid = "$Id: yplib.c,v 1.8 1995/04/26 19:03:05 wpaul Exp $"; +static char *rcsid = "$Id: yplib.c,v 1.9 1995/05/03 18:33:10 wpaul Exp $"; #endif #include <sys/param.h> @@ -291,7 +291,7 @@ skipit: bzero((char *)&clnt_sin, sizeof clnt_sin); clnt_sin.sin_family = AF_INET; clnt_sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - + clnt_sock = RPC_ANYSOCK; client = clnttcp_create(&clnt_sin, YPBINDPROG, YPBINDVERS, &clnt_sock, 0, 0); diff --git a/lib/libcompat/4.1/getpw.c b/lib/libcompat/4.1/getpw.c index 9fc7eb1323ca..5ea696af7bdc 100644 --- a/lib/libcompat/4.1/getpw.c +++ b/lib/libcompat/4.1/getpw.c @@ -29,7 +29,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id$ + * $Id: getpw.c,v 1.1 1995/04/10 18:47:55 joerg Exp $ */ #include <sys/types.h> @@ -47,12 +47,12 @@ getpw(uid, buf) #endif { struct passwd *pw; - + pw = getpwuid(uid); endpwent(); - + if(pw == 0) return -1; - + strncpy(buf, pw->pw_name, L_cuserid); return 0; } diff --git a/lib/libcompat/4.3/rexec.c b/lib/libcompat/4.3/rexec.c index a8a7b5bfd4fe..5b1afc8d7239 100644 --- a/lib/libcompat/4.3/rexec.c +++ b/lib/libcompat/4.3/rexec.c @@ -170,7 +170,7 @@ next: continue; /* * Allow match either for user's input host name - * or official hostname. Also allow match of + * or official hostname. Also allow match of * incompletely-specified host in local domain. */ if (strcasecmp(host, tokval) == 0) @@ -187,7 +187,7 @@ next: case LOGIN: if (token()) - if (*aname == 0) { + if (*aname == 0) { *aname = malloc((unsigned) strlen(tokval) + 1); (void) strcpy(*aname, tokval); } else { @@ -335,7 +335,7 @@ retry: } else { char num[8]; int s2, sin2len; - + s2 = socket(AF_INET, SOCK_STREAM, 0); if (s2 < 0) { (void) close(s); diff --git a/lib/libcompat/regexp/regexp.c b/lib/libcompat/regexp/regexp.c index 0084295bfb37..3e8496806167 100644 --- a/lib/libcompat/regexp/regexp.c +++ b/lib/libcompat/regexp/regexp.c @@ -335,7 +335,7 @@ int *flagp; } /* Make a closing node, and hook it on the end. */ - ender = regnode((paren) ? CLOSE+parno : END); + ender = regnode((paren) ? CLOSE+parno : END); regtail(ret, ender); /* Hook the tails of the branches to the closing node. */ @@ -567,7 +567,7 @@ int *flagp; * On entry, the char at regparse[-1] is going to go * into the string, no matter what it is. (It could be * following a \ if we are entered from the '\' case.) - * + * * Basic idea is to pick up a good char in ch and * examine the next char. If it's *+? then we twiddle. * If it's \ then we frozzle. If it's other magic char @@ -622,7 +622,7 @@ int *flagp; default: /* Backup point is \, scan * point is after it. */ regprev = regparse; - regparse++; + regparse++; continue; /* NOT break; */ } } @@ -1174,7 +1174,7 @@ regexp *r; next = regnext(s); if (next == NULL) /* Next ptr. */ printf("(0)"); - else + else printf("(%d)", (s-r->program)+(next-s)); s += 3; if (op == ANYOF || op == ANYBUT || op == EXACTLY) { diff --git a/lib/libcrypt/Makefile b/lib/libcrypt/Makefile index 96b03f829c39..d4d5057297d2 100644 --- a/lib/libcrypt/Makefile +++ b/lib/libcrypt/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile,v 1.5 1994/11/07 21:07:05 phk Exp $ +# $Id: Makefile,v 1.6 1994/11/14 06:44:45 bde Exp $ # LCRYPTBASE= libcrypt @@ -18,7 +18,7 @@ CFLAGS+= -I${.CURDIR}/../libmd # This may have to be revised afterinstall: -.if !defined(NOPIC) +.if !defined(NOPIC) @cd ${DESTDIR}${SHLIBDIR}; \ if [ ! -e ${LCRYPTSO} ]; then \ rm -f ${LCRYPTSO}; \ diff --git a/lib/libcrypt/crypt.c b/lib/libcrypt/crypt.c index fd24e798fbef..0b475614b358 100644 --- a/lib/libcrypt/crypt.c +++ b/lib/libcrypt/crypt.c @@ -6,12 +6,12 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: crypt.c,v 1.2 1994/11/07 21:07:09 phk Exp $ * */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Header$"; +static char rcsid[] = "$Header: /home/ncvs/src/lib/libcrypt/crypt.c,v 1.2 1994/11/07 21:07:09 phk Exp $"; #endif /* LIBC_SCCS and not lint */ #include <unistd.h> @@ -35,7 +35,7 @@ to64(s, v, n) /* * UNIX password - * + * * Use MD5 for what it is best at... */ @@ -88,7 +88,7 @@ crypt(pw, salt) MD5Update(&ctx1,sp,sl); MD5Update(&ctx1,pw,strlen(pw)); MD5Final(final,&ctx1); - for(pl = strlen(pw); pl > 0; pl -= 16) + for(pl = strlen(pw); pl > 0; pl -= 16) MD5Update(&ctx,final,pl>16 ? 16 : pl); /* Don't leave anything around in vm they could use. */ @@ -108,8 +108,8 @@ crypt(pw, salt) MD5Final(final,&ctx); - /* - * and now, just to make sure things don't run too fast + /* + * and now, just to make sure things don't run too fast * On a 60 Mhz Pentium this takes 34 msec, so you would * need 30 seconds to build a 1000 entry dictionary... */ @@ -134,7 +134,7 @@ crypt(pw, salt) } p = passwd + strlen(passwd); - + l = (final[ 0]<<16) | (final[ 6]<<8) | final[12]; to64(p,l,4); p += 4; l = (final[ 1]<<16) | (final[ 7]<<8) | final[13]; to64(p,l,4); p += 4; l = (final[ 2]<<16) | (final[ 8]<<8) | final[14]; to64(p,l,4); p += 4; diff --git a/lib/libcurses/EXAMPLES/ex1.c b/lib/libcurses/EXAMPLES/ex1.c index 76da41b4d9bb..e8a4e0ff7442 100644 --- a/lib/libcurses/EXAMPLES/ex1.c +++ b/lib/libcurses/EXAMPLES/ex1.c @@ -47,7 +47,7 @@ static char sccsid[] = "@(#)ex1.c 8.1 (Berkeley) 6/4/93"; #include <signal.h> -#define YSIZE 10 +#define YSIZE 10 #define XSIZE 20 int quit(); @@ -65,7 +65,7 @@ main() crmode(); /* We want cbreak mode */ noecho(); /* We want to have control of chars */ delwin(stdscr); /* Create our own stdscr */ - stdscr = newwin(YSIZE, XSIZE, 10, 35); + stdscr = newwin(YSIZE, XSIZE, 10, 35); flushok(stdscr, TRUE); /* Enable flushing of stdout */ scrollok(stdscr, TRUE); /* Enable scrolling */ erase(); /* Initially, clear the screen */ @@ -107,6 +107,6 @@ quit() exit(0); } - - - + + + diff --git a/lib/libcurses/PSD.doc/ex1.c b/lib/libcurses/PSD.doc/ex1.c index 02ed9b936bdd..97d8432c8bbf 100644 --- a/lib/libcurses/PSD.doc/ex1.c +++ b/lib/libcurses/PSD.doc/ex1.c @@ -37,7 +37,7 @@ #include <signal.h> -#define YSIZE 10 +#define YSIZE 10 #define XSIZE 20 int quit(); @@ -55,7 +55,7 @@ main() crmode(); /* We want cbreak mode */ noecho(); /* We want to have control of chars */ delwin(stdscr); /* Create our own stdscr */ - stdscr = newwin(YSIZE, XSIZE, 10, 35); + stdscr = newwin(YSIZE, XSIZE, 10, 35); flushok(stdscr, TRUE); /* Enable flushing of stdout */ scrollok(stdscr, TRUE); /* Enable scrolling */ erase(); /* Initially, clear the screen */ @@ -97,6 +97,6 @@ quit() exit(0); } - - - + + + diff --git a/lib/libcurses/PSD.doc/ex2.c b/lib/libcurses/PSD.doc/ex2.c index 13e8f2990b99..7b23b61ebf83 100644 --- a/lib/libcurses/PSD.doc/ex2.c +++ b/lib/libcurses/PSD.doc/ex2.c @@ -52,7 +52,7 @@ main() char id[100]; int hh = 0; int curx, cury, base, arg; - + initscr(); signal(SIGINT, quit); crmode(); @@ -181,7 +181,7 @@ main() insertln(); sprintf(id, "%d: ", base); addstr(id); - for (j = 0; j < XSIZE - strlen(id) - 2; j++) + for (j = 0; j < XSIZE - strlen(id) - 2; j++) addch('0' + (base % 10)); cury++; } else if (cury >= YSIZE) { diff --git a/lib/libcurses/PSD.doc/life.c b/lib/libcurses/PSD.doc/life.c index 72febba29ae7..5ecd07f84c43 100644 --- a/lib/libcurses/PSD.doc/life.c +++ b/lib/libcurses/PSD.doc/life.c @@ -128,7 +128,7 @@ getstart() if (Head != NULL) /* start new list */ dellist(Head); - Head = malloc(sizeof (LIST)); + Head = malloc(sizeof (LIST)); /* * loop through the screen looking for 'x's, and add a list diff --git a/lib/libcurses/addbytes.c b/lib/libcurses/addbytes.c index 6dd8bf959b57..39124a063d7e 100644 --- a/lib/libcurses/addbytes.c +++ b/lib/libcurses/addbytes.c @@ -75,7 +75,7 @@ __waddbytes(win, bytes, count, so) #ifdef DEBUG __CTRACE("ADDBYTES(%0.2o, %d, %d)\n", win, y, x); #endif - + lp = win->lines[y]; if (lp->flags & __ISPASTEOL) { lp->flags &= ~__ISPASTEOL; @@ -96,7 +96,7 @@ newline: if (y == win->maxy - 1) { if (c == '\n') break; } - + stand = '\0'; if (win->flags & __WSTANDOUT || so) stand |= __STANDOUT; @@ -104,7 +104,7 @@ newline: if (y == win->maxy - 1) { __CTRACE("ADDBYTES: 1: y = %d, x = %d, firstch = %d, lastch = %d\n", y, x, *win->lines[y]->firstchp, *win->lines[y]->lastchp); #endif - if (lp->line[x].ch != c || + if (lp->line[x].ch != c || !(lp->line[x].attr & stand)) { newx = x + win->ch_off; if (!(lp->flags & __ISDIRTY)) { diff --git a/lib/libcurses/clrtoeol.c b/lib/libcurses/clrtoeol.c index 44fc190fee3d..1f10c41f918b 100644 --- a/lib/libcurses/clrtoeol.c +++ b/lib/libcurses/clrtoeol.c @@ -70,7 +70,7 @@ wclrtoeol(win) } #ifdef DEBUG __CTRACE("CLRTOEOL: minx = %d, maxx = %d, firstch = %d, lastch = %d\n", - minx, maxx - win->lines[y]->line, *win->lines[y]->firstchp, + minx, maxx - win->lines[y]->line, *win->lines[y]->firstchp, *win->lines[y]->lastchp); #endif /* Update firstch and lastch for the line. */ diff --git a/lib/libcurses/cr_put.c b/lib/libcurses/cr_put.c index 36b39fcfb486..b69b01ad3b4a 100644 --- a/lib/libcurses/cr_put.c +++ b/lib/libcurses/cr_put.c @@ -82,8 +82,8 @@ __mvcur(ly, lx, y, x, in_refresh) if (destline != outline || destcol != outcol) fgoto(in_refresh); return (OK); -} - +} + static void fgoto(in_refresh) int in_refresh; @@ -137,7 +137,7 @@ fgoto(in_refresh) * list this won't work. We should probably have an * sc capability but sf will generally take the place * if it works. - * + * * Superbee glitch: in the middle of the screen have * to use esc B (down) because linefeed screws up in * "Efficient Paging" (what a joke) mode (which is @@ -167,7 +167,7 @@ fgoto(in_refresh) */ if (outcol != COLS - 1 && plod(strlen(cgp), in_refresh) > 0) plod(0, in_refresh); - else + else tputs(cgp, 1, __cputchar); } else plod(0, in_refresh); diff --git a/lib/libcurses/curses.c b/lib/libcurses/curses.c index 13ee80ee0402..d78d2843c469 100644 --- a/lib/libcurses/curses.c +++ b/lib/libcurses/curses.c @@ -41,9 +41,9 @@ static char sccsid[] = "@(#)curses.c 8.3 (Berkeley) 5/4/94"; int __echoit = 1; /* If stty indicates ECHO. */ int __pfast; int __rawmode = 0; /* If stty indicates RAW mode. */ -int __noqch = 0; /* - * If terminal doesn't have - * insert/delete line capabilities +int __noqch = 0; /* + * If terminal doesn't have + * insert/delete line capabilities * or change scroll capabilities * for quick change on refresh. */ diff --git a/lib/libcurses/curses.h b/lib/libcurses/curses.h index 8b699fac48e9..1142ca5a894d 100644 --- a/lib/libcurses/curses.h +++ b/lib/libcurses/curses.h @@ -145,7 +145,7 @@ extern char __unctrllen[256]; /* Control strings length. */ * A line is an array of __LDATA structures pointed to by the 'line' pointer. * * IMPORTANT: the __LDATA structure must NOT induce any padding, so if new - * fields are added -- padding fields with *constant values* should ensure + * fields are added -- padding fields with *constant values* should ensure * that the compiler will not generate any padding when storing an array of * __LDATA structures. This is to enable consistent use of memcmp, and memcpy * for comparing and copying arrays. @@ -188,7 +188,7 @@ typedef struct __window { /* Window structure. */ #define __SCROLLOK 0x020 /* Scrolling ok. */ #define __CLEAROK 0x040 /* Clear on next refresh. */ #define __WSTANDOUT 0x080 /* Standout window */ -#define __LEAVEOK 0x100 /* If curser left */ +#define __LEAVEOK 0x100 /* If curser left */ #define __FULLLINE 0x200 /* Line width = terminal width. */ u_int flags; } WINDOW; diff --git a/lib/libcurses/deleteln.c b/lib/libcurses/deleteln.c index 4cb08ea37947..afe6b9381c9c 100644 --- a/lib/libcurses/deleteln.c +++ b/lib/libcurses/deleteln.c @@ -60,8 +60,8 @@ wdeleteln(win) if (win->orig == NULL) win->lines[y] = win->lines[y + 1]; else - (void) memcpy(win->lines[y]->line, - win->lines[y + 1]->line, + (void) memcpy(win->lines[y]->line, + win->lines[y + 1]->line, win->maxx * __LDATASIZE); __touchline(win, y, 0, win->maxx - 1, 0); } diff --git a/lib/libcurses/erase.c b/lib/libcurses/erase.c index 42ca68a35a64..c2e3e48c0ad4 100644 --- a/lib/libcurses/erase.c +++ b/lib/libcurses/erase.c @@ -58,7 +58,7 @@ werase(win) end = &start[win->maxx]; for (sp = start; sp < end; sp++) if (sp->ch != ' ' || sp->attr != 0) { - maxx = sp; + maxx = sp; if (minx == -1) minx = sp - start; sp->ch = ' '; diff --git a/lib/libcurses/id_subwins.c b/lib/libcurses/id_subwins.c index 3528348ff467..0ceef2d70ab1 100644 --- a/lib/libcurses/id_subwins.c +++ b/lib/libcurses/id_subwins.c @@ -59,7 +59,7 @@ __id_subwins(orig) oy = orig->cury; for (y = realy - win->begy; y < win->maxy; y++, oy++) - win->lines[y]->line = + win->lines[y]->line = &orig->lines[oy]->line[win->ch_off]; } } diff --git a/lib/libcurses/initscr.c b/lib/libcurses/initscr.c index 1af8b6f34ea5..ac39669189ba 100644 --- a/lib/libcurses/initscr.c +++ b/lib/libcurses/initscr.c @@ -68,7 +68,7 @@ initscr() return (NULL); /* Need either homing or cursor motion for refreshes */ - if (!HO && !CM) + if (!HO && !CM) return (NULL); if (curscr != NULL) diff --git a/lib/libcurses/insch.c b/lib/libcurses/insch.c index 36cc0dee8940..aa48bcb0d8d4 100644 --- a/lib/libcurses/insch.c +++ b/lib/libcurses/insch.c @@ -61,7 +61,7 @@ winsch(win, ch) temp1->ch = ch; temp1->attr &= ~__STANDOUT; __touchline(win, win->cury, win->curx, win->maxx - 1, 0); - if (win->cury == LINES - 1 && + if (win->cury == LINES - 1 && (win->lines[LINES - 1]->line[COLS - 1].ch != ' ' || win->lines[LINES -1]->line[COLS - 1].attr != 0)) if (win->flags & __SCROLLOK) { diff --git a/lib/libcurses/insertln.c b/lib/libcurses/insertln.c index 4de367eb2685..ce713caa81da 100644 --- a/lib/libcurses/insertln.c +++ b/lib/libcurses/insertln.c @@ -62,8 +62,8 @@ winsertln(win) if (win->orig == NULL) win->lines[y] = win->lines[y - 1]; else - (void)memcpy(win->lines[y]->line, - win->lines[y - 1]->line, + (void)memcpy(win->lines[y]->line, + win->lines[y - 1]->line, win->maxx * __LDATASIZE); __touchline(win, y, 0, win->maxx - 1, 0); } diff --git a/lib/libcurses/newwin.c b/lib/libcurses/newwin.c index afc90cf0aecb..327381774930 100644 --- a/lib/libcurses/newwin.c +++ b/lib/libcurses/newwin.c @@ -158,7 +158,7 @@ __makenew(nl, nc, by, bx, sub) register WINDOW *win; register __LINE *lp; int i; - + #ifdef DEBUG __CTRACE("makenew: (%d, %d, %d, %d)\n", nl, nc, by, bx); @@ -169,7 +169,7 @@ __makenew(nl, nc, by, bx, sub) __CTRACE("makenew: nl = %d\n", nl); #endif - /* + /* * Set up line pointer array and line space. */ if ((win->lines = malloc (nl * sizeof(__LINE *))) == NULL) { @@ -187,14 +187,14 @@ __makenew(nl, nc, by, bx, sub) /* * Allocate window space in one chunk. */ - if ((win->wspace = + if ((win->wspace = malloc(nc * nl * sizeof(__LDATA))) == NULL) { free(win->lines); free(win->lspace); free(win); return NULL; } - + /* * Point line pointers to line space, and lines themselves into * window space. diff --git a/lib/libcurses/overlay.c b/lib/libcurses/overlay.c index 9f35c79e3fb8..22c34332f0a2 100644 --- a/lib/libcurses/overlay.c +++ b/lib/libcurses/overlay.c @@ -69,7 +69,7 @@ overlay(win1, win2) for (y = starty; y < endy; y++, y1++, y2++) { end = &win1->lines[y1]->line[endx - win1->begx]; x = startx - win2->begx; - for (sp = &win1->lines[y1]->line[startx - win1->begx]; + for (sp = &win1->lines[y1]->line[startx - win1->begx]; sp < end; sp++) { if (!isspace(sp->ch)) { wmove(win2, y2, x); diff --git a/lib/libcurses/overwrite.c b/lib/libcurses/overwrite.c index e2d91bd0a8c5..162c731e2ab2 100644 --- a/lib/libcurses/overwrite.c +++ b/lib/libcurses/overwrite.c @@ -66,7 +66,7 @@ overwrite(win1, win2) x = endx - startx; for (y = starty; y < endy; y++) { (void)memcpy( - &win2->lines[y - win2->begy]->line[startx - win2->begx], + &win2->lines[y - win2->begy]->line[startx - win2->begx], &win1->lines[y - win1->begy]->line[startx - win1->begx], x * __LDATASIZE); __touchline(win2, y, startx - win2->begx, endx - win2->begx, diff --git a/lib/libcurses/refresh.c b/lib/libcurses/refresh.c index 5b091f937756..6350f1f1292f 100644 --- a/lib/libcurses/refresh.c +++ b/lib/libcurses/refresh.c @@ -44,7 +44,7 @@ static short ly, lx; static void domvcur __P((int, int, int, int)); static int makech __P((WINDOW *, int)); -static void quickch __P((WINDOW *)); +static void quickch __P((WINDOW *)); static void scrolln __P((int, int, int, int, int)); /* @@ -60,7 +60,7 @@ wrefresh(win) register int retval; register short wy; int dnum; - + /* Initialize loop parameters. */ ly = curscr->cury; lx = curscr->curx; @@ -71,7 +71,7 @@ wrefresh(win) for (wy = 0; wy < win->maxy; wy++) { wlp = win->lines[wy]; if (wlp->flags & __ISDIRTY) - wlp->hash = + wlp->hash = __hash((char *) wlp->line, win->maxx * __LDATASIZE); } @@ -126,12 +126,12 @@ wrefresh(win) for (i = 0; i < curscr->maxy; i++) { __CTRACE("C: %d:", i); __CTRACE(" 0x%x \n", curscr->lines[i]->hash); - for (j = 0; j < curscr->maxx; j++) - __CTRACE("%c", + for (j = 0; j < curscr->maxx; j++) + __CTRACE("%c", curscr->lines[i]->line[j].ch); __CTRACE("\n"); - for (j = 0; j < curscr->maxx; j++) - __CTRACE("%x", + for (j = 0; j < curscr->maxx; j++) + __CTRACE("%x", curscr->lines[i]->line[j].attr); __CTRACE("\n"); if (i < win->begy || i > win->begy + win->maxy - 1) @@ -139,12 +139,12 @@ wrefresh(win) __CTRACE("W: %d:", i - win->begy); __CTRACE(" 0x%x \n", win->lines[i - win->begy]->hash); __CTRACE(" 0x%x ", win->lines[i - win->begy]->flags); - for (j = 0; j < win->maxx; j++) - __CTRACE("%c", + for (j = 0; j < win->maxx; j++) + __CTRACE("%c", win->lines[i - win->begy]->line[j].ch); __CTRACE("\n"); - for (j = 0; j < win->maxx; j++) - __CTRACE("%x", + for (j = 0; j < win->maxx; j++) + __CTRACE("%x", win->lines[i - win->begy]->line[j].attr); __CTRACE("\n"); } @@ -168,7 +168,7 @@ wrefresh(win) if (*win->lines[wy]->lastchp < win->maxx + win->ch_off) *win->lines[wy]->lastchp = win->ch_off; - if (*win->lines[wy]->lastchp < + if (*win->lines[wy]->lastchp < *win->lines[wy]->firstchp) { #ifdef DEBUG __CTRACE("wrefresh: line %d notdirty \n", wy); @@ -179,11 +179,11 @@ wrefresh(win) } #ifdef DEBUG - __CTRACE("\t%d\t%d\n", *win->lines[wy]->firstchp, + __CTRACE("\t%d\t%d\n", *win->lines[wy]->firstchp, *win->lines[wy]->lastchp); #endif } - + #ifdef DEBUG __CTRACE("refresh: ly=%d, lx=%d\n", ly, lx); #endif @@ -258,7 +258,7 @@ makech(win, wy) force = win->lines[wy]->flags & __FORCEPAINT; win->lines[wy]->flags &= ~__FORCEPAINT; if (CE && !curwin) { - for (cp = &win->lines[wy]->line[win->maxx - 1]; + for (cp = &win->lines[wy]->line[win->maxx - 1]; cp->ch == ' ' && cp->attr == 0; cp--) if (cp <= win->lines[wy]->line) break; @@ -294,15 +294,15 @@ makech(win, wy) domvcur(ly, lx, y, wx + win->begx); #ifdef DEBUG - __CTRACE("makech: 1: wx = %d, ly= %d, lx = %d, newy = %d, newx = %d, force =%d\n", + __CTRACE("makech: 1: wx = %d, ly= %d, lx = %d, newy = %d, newx = %d, force =%d\n", wx, ly, lx, y, wx + win->begx, force); #endif ly = y; lx = wx + win->begx; - while ((force || memcmp(nsp, csp, sizeof(__LDATA)) != 0) + while ((force || memcmp(nsp, csp, sizeof(__LDATA)) != 0) && wx <= lch) { - if (ce != NULL && win->maxx + win->begx == + if (ce != NULL && win->maxx + win->begx == curscr->maxx && wx >= nlsp && nsp->ch == ' ' && nsp->attr == 0) { /* Check for clear to end-of-line. */ cep = &curscr->lines[win->begy + wy]->line[win->begx + win->maxx - 1]; @@ -314,7 +314,7 @@ makech(win, wy) #ifdef DEBUG __CTRACE("makech: clsp = %d, nlsp = %d\n", clsp, nlsp); #endif - if ((clsp - nlsp >= strlen(CE) + if ((clsp - nlsp >= strlen(CE) && clsp < win->maxx) || wy == win->maxy - 1) { #ifdef DEBUG @@ -369,21 +369,21 @@ makech(win, wy) putchar(nsp->ch); } if (wx + win->begx < curscr->maxx) { - domvcur(ly, wx + win->begx, + domvcur(ly, wx + win->begx, win->begy + win->maxy - 1, win->begx + win->maxx - 1); } ly = win->begy + win->maxy - 1; lx = win->begx + win->maxx - 1; return (OK); - } - if (wx < win->maxx || wy < win->maxy - 1 || + } + if (wx < win->maxx || wy < win->maxy - 1 || !(win->flags & __SCROLLWIN)) { if (!curwin) { csp->attr = nsp->attr; putchar(csp->ch = nsp->ch); csp++; - } else + } else putchar(nsp->ch); } #ifdef DEBUG @@ -433,7 +433,7 @@ domvcur(oy, ox, ny, nx) /* * Quickch() attempts to detect a pattern in the change of the window - * in order to optimize the change, e.g., scroll n lines as opposed to + * in order to optimize the change, e.g., scroll n lines as opposed to * repainting the screen line by line. */ @@ -449,26 +449,26 @@ quickch(win) __LDATA buf[1024]; u_int blank_hash; - /* + /* * Find how many lines from the top of the screen are unchanged. */ for (top = win->begy; top < win->begy + win->maxy; top++) if (win->lines[top - win->begy]->flags & __FORCEPAINT || win->lines[top - win->begy]->hash != curscr->lines[top]->hash || memcmp(win->lines[top - win->begy]->line, - curscr->lines[top]->line, + curscr->lines[top]->line, win->maxx * __LDATASIZE) != 0) break; else win->lines[top - win->begy]->flags &= ~__ISDIRTY; /* - * Find how many lines from bottom of screen are unchanged. + * Find how many lines from bottom of screen are unchanged. */ for (bot = win->begy + win->maxy - 1; bot >= (int) win->begy; bot--) if (win->lines[bot - win->begy]->flags & __FORCEPAINT || win->lines[bot - win->begy]->hash != curscr->lines[bot]->hash || memcmp(win->lines[bot - win->begy]->line, - curscr->lines[bot]->line, + curscr->lines[bot]->line, win->maxx * __LDATASIZE) != 0) break; else @@ -489,7 +489,7 @@ quickch(win) * Search for the largest block of text not changed. * Invariants of the loop: * - Startw is the index of the beginning of the examined block in win. - * - Starts is the index of the beginning of the examined block in + * - Starts is the index of the beginning of the examined block in * curscr. * - Curw is the index of one past the end of the exmined block in win. * - Curs is the index of one past the end of the exmined block in @@ -498,7 +498,7 @@ quickch(win) */ for (bsize = bot - top; bsize >= THRESH; bsize--) { for (startw = top; startw <= bot - bsize; startw++) - for (starts = top; starts <= bot - bsize; + for (starts = top; starts <= bot - bsize; starts++) { for (curw = startw, curs = starts; curs < starts + bsize; curw++, curs++) @@ -507,7 +507,7 @@ quickch(win) (win->lines[curw - win->begy]->hash != curscr->lines[curs]->hash || memcmp(win->lines[curw - win->begy]->line, - curscr->lines[curs]->line, + curscr->lines[curs]->line, win->maxx * __LDATASIZE) != 0)) break; if (curs == starts + bsize) @@ -516,16 +516,16 @@ quickch(win) } done: /* Did not find anything */ - if (bsize < THRESH) + if (bsize < THRESH) return; #ifdef DEBUG - __CTRACE("quickch:bsize=%d,starts=%d,startw=%d,curw=%d,curs=%d,top=%d,bot=%d\n", + __CTRACE("quickch:bsize=%d,starts=%d,startw=%d,curw=%d,curs=%d,top=%d,bot=%d\n", bsize, starts, startw, curw, curs, top, bot); #endif - /* - * Make sure that there is no overlap between the bottom and top + /* + * Make sure that there is no overlap between the bottom and top * regions and the middle scrolled block. */ if (bot < curs) @@ -540,12 +540,12 @@ quickch(win) for (i = 0; i < curscr->maxy; i++) { __CTRACE("C: %d:", i); __CTRACE(" 0x%x \n", curscr->lines[i]->hash); - for (j = 0; j < curscr->maxx; j++) - __CTRACE("%c", + for (j = 0; j < curscr->maxx; j++) + __CTRACE("%c", curscr->lines[i]->line[j].ch); __CTRACE("\n"); - for (j = 0; j < curscr->maxx; j++) - __CTRACE("%x", + for (j = 0; j < curscr->maxx; j++) + __CTRACE("%x", curscr->lines[i]->line[j].attr); __CTRACE("\n"); if (i < win->begy || i > win->begy + win->maxy - 1) @@ -553,17 +553,17 @@ quickch(win) __CTRACE("W: %d:", i - win->begy); __CTRACE(" 0x%x \n", win->lines[i - win->begy]->hash); __CTRACE(" 0x%x ", win->lines[i - win->begy]->flags); - for (j = 0; j < win->maxx; j++) - __CTRACE("%c", + for (j = 0; j < win->maxx; j++) + __CTRACE("%c", win->lines[i - win->begy]->line[j].ch); __CTRACE("\n"); - for (j = 0; j < win->maxx; j++) - __CTRACE("%x", + for (j = 0; j < win->maxx; j++) + __CTRACE("%x", win->lines[i - win->begy]->line[j].attr); __CTRACE("\n"); } -#endif - +#endif + /* So we don't have to call __hash() each time */ for (i = 0; i < win->maxx; i++) { buf[i].ch = ' '; @@ -579,27 +579,27 @@ quickch(win) * - Target is the index of the target of line i. * - Tmp1 points to current line (i). * - Tmp2 and points to target line (target); - * - Cur_period is the index of the end of the current period. + * - Cur_period is the index of the end of the current period. * (see below). * * There are 2 major issues here that make this rotation non-trivial: * 1. Scrolling in a scrolling region bounded by the top * and bottom regions determined (whose size is sc_region). - * 2. As a result of the use of the mod function, there may be a + * 2. As a result of the use of the mod function, there may be a * period introduced, i.e., 2 maps to 4, 4 to 6, n-2 to 0, and * 0 to 2, which then causes all odd lines not to be rotated. - * To remedy this, an index of the end ( = beginning) of the - * current 'period' is kept, cur_period, and when it is reached, - * the next period is started from cur_period + 1 which is + * To remedy this, an index of the end ( = beginning) of the + * current 'period' is kept, cur_period, and when it is reached, + * the next period is started from cur_period + 1 which is * guaranteed not to have been reached since that would mean that * all records would have been reached. (think about it...). - * + * * Lines in the rotation can have 3 attributes which are marked on the * line so that curscr is consistent with the visual screen. * 1. Not dirty -- lines inside the scrolled block, top region or * bottom region. - * 2. Blank lines -- lines in the differential of the scrolling - * region adjacent to top and bot regions + * 2. Blank lines -- lines in the differential of the scrolling + * region adjacent to top and bot regions * depending on scrolling direction. * 3. Dirty line -- all other lines are marked dirty. */ @@ -617,7 +617,7 @@ quickch(win) __CTRACE("quickch: n=%d startw=%d curw=%d i = %d target=%d ", n, startw, curw, i, target); #endif - if ((target >= startw && target < curw) || target < top + if ((target >= startw && target < curw) || target < top || target > bot) { #ifdef DEBUG __CTRACE("-- notdirty"); @@ -625,7 +625,7 @@ quickch(win) win->lines[target - win->begy]->flags &= ~__ISDIRTY; } else if ((n > 0 && target >= top && target < top + n) || (n < 0 && target <= bot && target > bot + n)) { - if (clp->hash != blank_hash || memcmp(clp->line, + if (clp->hash != blank_hash || memcmp(clp->line, buf, win->maxx * __LDATASIZE) !=0) { (void)memcpy(clp->line, buf, win->maxx * __LDATASIZE); @@ -662,14 +662,14 @@ quickch(win) __CTRACE("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n"); for (i = 0; i < curscr->maxy; i++) { __CTRACE("C: %d:", i); - for (j = 0; j < curscr->maxx; j++) - __CTRACE("%c", + for (j = 0; j < curscr->maxx; j++) + __CTRACE("%c", curscr->lines[i]->line[j].ch); __CTRACE("\n"); if (i < win->begy || i > win->begy + win->maxy - 1) continue; __CTRACE("W: %d:", i - win->begy); - for (j = 0; j < win->maxx; j++) + for (j = 0; j < win->maxx; j++) __CTRACE("%c", win->lines[i - win->begy]->line[j].ch); __CTRACE("\n"); @@ -680,7 +680,7 @@ quickch(win) scrolln(starts, startw, curs, bot, top); /* * Need to repoint any subwindow lines to the rotated - * line structured. + * line structured. */ for (wp = win->nextp; wp != win; wp = wp->nextp) __set_subwin(win, wp); @@ -846,5 +846,5 @@ scrolln(starts, startw, curs, bot, top) else abort(); __mvcur(top, 0, oy, ox, 1); - } + } } diff --git a/lib/libcurses/scanw.c b/lib/libcurses/scanw.c index d8d79fd23551..221384fdb1c9 100644 --- a/lib/libcurses/scanw.c +++ b/lib/libcurses/scanw.c @@ -101,7 +101,7 @@ wscanw(win, fmt, va_alist) } /* - * mvscanw, mvwscanw -- + * mvscanw, mvwscanw -- * Implement the mvscanw commands. Due to the variable number of * arguments, they cannot be macros. Another sigh.... */ diff --git a/lib/libcurses/setterm.c b/lib/libcurses/setterm.c index 2c2e36ef563e..ac85708bb767 100644 --- a/lib/libcurses/setterm.c +++ b/lib/libcurses/setterm.c @@ -71,9 +71,9 @@ static char *_PC, /* so SR ta te ti uc ue up us */ &SO, &SR, &TA, &TE, &TI, &UC, &UE, &UP, &US, /* vb vs ve al dl sf sr AL */ - &VB, &VS, &VE, &al, &dl, &sf, &sr, &AL_PARM, + &VB, &VS, &VE, &al, &dl, &sf, &sr, &AL_PARM, /* DL UP DO LE */ - &DL_PARM, &UP_PARM, &DOWN_PARM, &LEFT_PARM, + &DL_PARM, &UP_PARM, &DOWN_PARM, &LEFT_PARM, /* RI */ &RIGHT_PARM, }; @@ -224,7 +224,7 @@ zap() __CTRACE("2.2s = %s\n", namp, *fp[-1] ? "TRUE" : "FALSE"); #endif namp += 2; - + } while (*namp); namp = "ALbcbtcdceclcmcrcsdcDLdmdoedeik0k1k2k3k4k5k6k7k8k9hoicimipkdkekhklkrkskullmandnlpcrcscseSFsoSRtatetiucueupusvbvsvealdlsfsrALDLUPDOLERI"; sp = sstrs; diff --git a/lib/libcurses/tstp.c b/lib/libcurses/tstp.c index f16a46cf3f5c..069dbd8a4f72 100644 --- a/lib/libcurses/tstp.c +++ b/lib/libcurses/tstp.c @@ -65,7 +65,7 @@ __stop_signal_handler(signo) (void)sigaddset(&set, SIGALRM); (void)sigaddset(&set, SIGWINCH); (void)sigprocmask(SIG_BLOCK, &set, &oset); - + /* * End the window, which also resets the terminal state to the * original modes. diff --git a/lib/libcurses/tty.c b/lib/libcurses/tty.c index f3db2aad82e2..8265881f9076 100644 --- a/lib/libcurses/tty.c +++ b/lib/libcurses/tty.c @@ -75,7 +75,7 @@ int gettmode() { useraw = 0; - + if (tcgetattr(__tty_fileno = STDIN_FILENO, &__orig_termios)) if (tcgetattr(__tty_fileno = STDOUT_FILENO, &__orig_termios)) __noterm = 1; @@ -160,14 +160,14 @@ nocbreak() return (!__noterm && tcsetattr(__tty_fileno, __tcaction ? TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); } - + int echo() { rawt.c_lflag |= ECHO; cbreakt.c_lflag |= ECHO; __baset.c_lflag |= ECHO; - + __echoit = 1; return (!__noterm && tcsetattr(__tty_fileno, __tcaction ? TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); @@ -179,7 +179,7 @@ noecho() rawt.c_lflag &= ~ECHO; cbreakt.c_lflag &= ~ECHO; __baset.c_lflag &= ~ECHO; - + __echoit = 0; return (!__noterm && tcsetattr(__tty_fileno, __tcaction ? TCSASOFT | TCSADRAIN : TCSADRAIN, curt) ? ERR : OK); diff --git a/lib/libcurses/unctrl.c b/lib/libcurses/unctrl.c index ff52230b2e9b..530dcc28096a 100644 --- a/lib/libcurses/unctrl.c +++ b/lib/libcurses/unctrl.c @@ -87,7 +87,7 @@ char __unctrllen[256] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 1, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index 5880204058f0..8863e80a1b97 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -14,11 +14,11 @@ LDADD+= -ltermcap SRCS= editline.c tokenizer.c history.c CLEANFILES+=common.h emacs.h fcns.h help.h vi.h help.c fcns.c editline.c -CFLAGS+=-I. -I${.CURDIR} +CFLAGS+=-I. -I${.CURDIR} CFLAGS+=#-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH CFLAGS+=#-DDEBUG_PASTE -AHDR=vi.h emacs.h common.h +AHDR=vi.h emacs.h common.h ASRC=${.CURDIR}/vi.c ${.CURDIR}/emacs.c ${.CURDIR}/common.c vi.h: vi.c makelist @@ -36,7 +36,7 @@ fcns.h: ${AHDR} makelist fcns.c: ${AHDR} fcns.h makelist sh ${.CURDIR}/makelist -fc ${AHDR} > ${.TARGET} -help.c: ${ASRC} makelist +help.c: ${ASRC} makelist sh ${.CURDIR}/makelist -bc ${ASRC} > ${.TARGET} help.h: ${ASRC} makelist diff --git a/lib/libedit/TEST/test.c b/lib/libedit/TEST/test.c index f456f51277c9..2379b6f84781 100644 --- a/lib/libedit/TEST/test.c +++ b/lib/libedit/TEST/test.c @@ -87,7 +87,7 @@ complete(el, ch) EditLine *el; int ch; { - DIR *dd = opendir("."); + DIR *dd = opendir("."); struct dirent *dp; const char* ptr; const LineInfo *lf = el_line(el); diff --git a/lib/libedit/chared.c b/lib/libedit/chared.c index 5a393a762484..62e2f6a22219 100644 --- a/lib/libedit/chared.c +++ b/lib/libedit/chared.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint && not SCCSID */ -/* +/* * chared.c: Character editor utilities */ #include "sys.h" @@ -67,7 +67,7 @@ cv_undo(el, action, size, ptr) } -/* c_insert(): +/* c_insert(): * Insert num characters */ protected void @@ -80,7 +80,7 @@ c_insert(el, num) if (el->el_line.lastchar + num >= el->el_line.limit) return; /* can't go past end of buffer */ - if (el->el_line.cursor < el->el_line.lastchar) { + if (el->el_line.cursor < el->el_line.lastchar) { /* if I must move chars */ for (cp = el->el_line.lastchar; cp >= el->el_line.cursor; cp--) cp[num] = *cp; @@ -93,7 +93,7 @@ c_insert(el, num) * Delete num characters after the cursor */ protected void -c_delafter(el, num) +c_delafter(el, num) EditLine *el; int num; { @@ -101,10 +101,10 @@ c_delafter(el, num) if (el->el_line.cursor + num > el->el_line.lastchar) num = el->el_line.lastchar - el->el_line.cursor; - if (num > 0) { + if (num > 0) { char *cp; - if (el->el_map.current != el->el_map.emacs) + if (el->el_map.current != el->el_map.emacs) cv_undo(el, INSERT, num, el->el_line.cursor); for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) @@ -125,12 +125,12 @@ c_delbefore(el, num) { if (el->el_line.cursor - num < el->el_line.buffer) - num = el->el_line.cursor - el->el_line.buffer; + num = el->el_line.cursor - el->el_line.buffer; - if (num > 0) { + if (num > 0) { char *cp; - if (el->el_map.current != el->el_map.emacs) + if (el->el_map.current != el->el_map.emacs) cv_undo(el, INSERT, num, el->el_line.cursor - num); for (cp = el->el_line.cursor - num; cp <= el->el_line.lastchar; cp++) @@ -145,7 +145,7 @@ c_delbefore(el, num) * Return if p is part of a word according to emacs */ protected int -ce__isword(p) +ce__isword(p) int p; { return isalpha(p) || isdigit(p) || strchr("*?_-.[]~=", p) != NULL; @@ -156,7 +156,7 @@ ce__isword(p) * Return if p is part of a word according to vi */ protected int -cv__isword(p) +cv__isword(p) int p; { return !isspace(p); @@ -167,7 +167,7 @@ cv__isword(p) * Find the previous word */ protected char * -c__prev_word(p, low, n, wtest) +c__prev_word(p, low, n, wtest) register char *p, *low; register int n; int (*wtest) __P((int)); @@ -175,9 +175,9 @@ c__prev_word(p, low, n, wtest) p--; while (n--) { - while ((p >= low) && !(*wtest)((unsigned char) *p)) + while ((p >= low) && !(*wtest)((unsigned char) *p)) p--; - while ((p >= low) && (*wtest)((unsigned char) *p)) + while ((p >= low) && (*wtest)((unsigned char) *p)) p--; } @@ -200,9 +200,9 @@ c__next_word(p, high, n, wtest) int (*wtest) __P((int)); { while (n--) { - while ((p < high) && !(*wtest)((unsigned char) *p)) + while ((p < high) && !(*wtest)((unsigned char) *p)) p++; - while ((p < high) && (*wtest)((unsigned char) *p)) + while ((p < high) && (*wtest)((unsigned char) *p)) p++; } if (p > high) @@ -225,14 +225,14 @@ cv_next_word(el, p, high, n, wtest) while (n--) { test = (*wtest)((unsigned char) *p); - while ((p < high) && (*wtest)((unsigned char) *p) == test) + while ((p < high) && (*wtest)((unsigned char) *p) == test) p++; /* * vi historically deletes with cw only the word preserving the * trailing whitespace! This is not what 'w' does.. */ - if (el->el_chared.c_vcmd.action != (DELETE|INSERT)) - while ((p < high) && isspace((unsigned char) *p)) + if (el->el_chared.c_vcmd.action != (DELETE|INSERT)) + while ((p < high) && isspace((unsigned char) *p)) p++; } @@ -262,14 +262,14 @@ cv_prev_word(el, p, low, n, wtest) * vi historically deletes with cb only the word preserving the * leading whitespace! This is not what 'b' does.. */ - if (el->el_chared.c_vcmd.action != (DELETE|INSERT)) - while ((p > low) && isspace((unsigned char) *p)) + if (el->el_chared.c_vcmd.action != (DELETE|INSERT)) + while ((p > low) && isspace((unsigned char) *p)) p--; test = (*wtest)((unsigned char) *p); - while ((p >= low) && (*wtest)((unsigned char) *p) == test) + while ((p >= low) && (*wtest)((unsigned char) *p) == test) p--; p++; - while (isspace((unsigned char) *p)) + while (isspace((unsigned char) *p)) p++; } @@ -319,7 +319,7 @@ c__number(p, num, dval) * Finish vi delete action */ protected void -cv_delfini(el) +cv_delfini(el) EditLine *el; { register int size; @@ -331,13 +331,13 @@ cv_delfini(el) oaction = el->el_chared.c_vcmd.action; el->el_chared.c_vcmd.action = NOP; - if (el->el_chared.c_vcmd.pos == 0) + if (el->el_chared.c_vcmd.pos == 0) return; if (el->el_line.cursor > el->el_chared.c_vcmd.pos) { size = (int) (el->el_line.cursor - el->el_chared.c_vcmd.pos); - c_delbefore(el, size); + c_delbefore(el, size); el->el_line.cursor = el->el_chared.c_vcmd.pos; re_refresh_cursor(el); } @@ -362,7 +362,7 @@ cv_delfini(el) abort(); break; } - + el->el_chared.c_undo.ptr = el->el_line.cursor; el->el_chared.c_undo.dsize = size; @@ -383,7 +383,7 @@ ce__endword(p, high, n) while (n--) { while ((p < high) && isspace((unsigned char) *p)) p++; - while ((p < high) && !isspace((unsigned char) *p)) + while ((p < high) && !isspace((unsigned char) *p)) p++; } @@ -404,14 +404,14 @@ cv__endword(p, high, n) p++; while (n--) { - while ((p < high) && isspace((unsigned char) *p)) + while ((p < high) && isspace((unsigned char) *p)) p++; if (isalnum((unsigned char) *p)) - while ((p < high) && isalnum((unsigned char) *p)) + while ((p < high) && isalnum((unsigned char) *p)) p++; else - while ((p < high) && !(isspace((unsigned char) *p) || + while ((p < high) && !(isspace((unsigned char) *p) || isalnum((unsigned char) *p))) p++; } @@ -458,7 +458,7 @@ ch_init(el) el->el_chared.c_macro.nline = NULL; el->el_chared.c_macro.level = -1; - el->el_chared.c_macro.macro = (char **) el_malloc(EL_MAXMACRO * + el->el_chared.c_macro.macro = (char **) el_malloc(EL_MAXMACRO * sizeof(char *)); return 0; } @@ -551,7 +551,7 @@ el_deletestr(el, n) if (n <= 0) return; - if (el->el_line.cursor < &el->el_line.buffer[n]) + if (el->el_line.cursor < &el->el_line.buffer[n]) return; c_delbefore(el, n); /* delete before dot */ @@ -630,7 +630,7 @@ c_hpos(el) if (el->el_line.cursor == el->el_line.buffer) return 0; else { - for (ptr = el->el_line.cursor - 1; + for (ptr = el->el_line.cursor - 1; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--) continue; diff --git a/lib/libedit/chared.h b/lib/libedit/chared.h index 20da6c87a6db..22d07f0392ee 100644 --- a/lib/libedit/chared.h +++ b/lib/libedit/chared.h @@ -54,7 +54,7 @@ * like real vi: i.e. the transition from command<->insert modes moves * the cursor. * - * On the other hand we really don't want to move the cursor, because + * On the other hand we really don't want to move the cursor, because * all the editing commands don't include the character under the cursor. * Probably the best fix is to make all the editing commands aware of * this fact. @@ -68,7 +68,7 @@ typedef struct c_macro_t { char *nline; } c_macro_t; -/* +/* * Undo information for both vi and emacs */ typedef struct c_undo_t { @@ -139,7 +139,7 @@ protected void cv_delfini __P((EditLine *)); protected char *cv__endword __P((char *, char *, int)); protected int ce__isword __P((int)); protected void cv_undo __P((EditLine *, int, int, char *)); -protected char *cv_next_word __P((EditLine*, char *, char *, int, +protected char *cv_next_word __P((EditLine*, char *, char *, int, int (*)(int))); protected char *cv_prev_word __P((EditLine*, char *, char *, int, int (*)(int))); diff --git a/lib/libedit/common.c b/lib/libedit/common.c index 696da528e510..c8be2b79ec44 100644 --- a/lib/libedit/common.c +++ b/lib/libedit/common.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; #include "sys.h" #include "el.h" -/* ed_end_of_file(): +/* ed_end_of_file(): * Indicate end of file * [^D] */ @@ -60,7 +60,7 @@ ed_end_of_file(el, c) } -/* ed_insert(): +/* ed_insert(): * Add character to the line * Insert a character [bound to all insert keys] */ @@ -74,16 +74,16 @@ ed_insert(el, c) if (c == '\0') return CC_ERROR; - if (el->el_line.lastchar + el->el_state.argument >= + if (el->el_line.lastchar + el->el_state.argument >= el->el_line.limit) return CC_ERROR; /* end of buffer space */ if (el->el_state.argument == 1) { if (el->el_state.inputmode != MODE_INSERT) { - el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] = + el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] = *el->el_line.cursor; el->el_chared.c_undo.buf[el->el_chared.c_undo.isize] = '\0'; - c_delafter(el, 1); + c_delafter(el, 1); } c_insert(el, 1); @@ -95,12 +95,12 @@ ed_insert(el, c) else { if (el->el_state.inputmode != MODE_INSERT) { - for(i = 0;i < el->el_state.argument; i++) - el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] = + for(i = 0;i < el->el_state.argument; i++) + el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] = el->el_line.cursor[i]; el->el_chared.c_undo.buf[el->el_chared.c_undo.isize] = '\0'; - c_delafter(el, el->el_state.argument); + c_delafter(el, el->el_state.argument); } c_insert(el, el->el_state.argument); @@ -117,7 +117,7 @@ ed_insert(el, c) } -/* ed_delete_prev_word(): +/* ed_delete_prev_word(): * Delete from beginning of current word to cursor * [M-^?] [^W] */ @@ -132,7 +132,7 @@ ed_delete_prev_word(el, c) if (el->el_line.cursor == el->el_line.buffer) return CC_ERROR; - cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, + cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, ce__isword); for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++) @@ -147,7 +147,7 @@ ed_delete_prev_word(el, c) } -/* ed_delete_next_char(): +/* ed_delete_next_char(): * Delete character under cursor * [^D] [x] */ @@ -159,12 +159,12 @@ ed_delete_next_char(el, c) { #ifdef notdef /* XXX */ #define EL el->el_line -fprintf(stderr, "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", +fprintf(stderr, "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar, EL.lastchar, EL.limit, EL.limit); #endif if (el->el_line.cursor == el->el_line.lastchar) {/* if I'm at the end */ if (el->el_map.type == MAP_VI) { - if (el->el_line.cursor == el->el_line.buffer) { + if (el->el_line.cursor == el->el_line.buffer) { /* if I'm also at the beginning */ #ifdef KSHVI return CC_ERROR; @@ -196,7 +196,7 @@ fprintf(stderr, "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", } -/* ed_kill_line(): +/* ed_kill_line(): * Cut to the end of line * [^K] [^K] */ @@ -218,7 +218,7 @@ ed_kill_line(el, c) } -/* ed_move_to_end(): +/* ed_move_to_end(): * Move cursor to the end of line * [^E] [^E] */ @@ -242,7 +242,7 @@ ed_move_to_end(el, c) } -/* ed_move_to_beg(): +/* ed_move_to_beg(): * Move cursor to the beginning of line * [^A] [^A] */ @@ -256,7 +256,7 @@ ed_move_to_beg(el, c) if (el->el_map.type == MAP_VI) { /* We want FIRST non space character */ - while (isspace(*el->el_line.cursor)) + while (isspace(*el->el_line.cursor)) el->el_line.cursor++; if (el->el_chared.c_vcmd.action & DELETE) { cv_delfini(el); @@ -268,7 +268,7 @@ ed_move_to_beg(el, c) } -/* ed_transpose_chars(): +/* ed_transpose_chars(): * Exchange the character to the left of the cursor with the one under it * [^T] [^T] */ @@ -280,7 +280,7 @@ ed_transpose_chars(el, c) if (el->el_line.cursor < el->el_line.lastchar) { if (el->el_line.lastchar <= &el->el_line.buffer[1]) return CC_ERROR; - else + else el->el_line.cursor++; } if (el->el_line.cursor > &el->el_line.buffer[1]) { @@ -290,12 +290,12 @@ ed_transpose_chars(el, c) el->el_line.cursor[-1] = c; return CC_REFRESH; } - else + else return CC_ERROR; } -/* ed_next_char(): +/* ed_next_char(): * Move to the right one character * [^F] [^F] */ @@ -322,7 +322,7 @@ ed_next_char(el, c) } -/* ed_prev_word(): +/* ed_prev_word(): * Move to the beginning of the current word * [M-b] [b] */ @@ -335,8 +335,8 @@ ed_prev_word(el, c) if (el->el_line.cursor == el->el_line.buffer) return CC_ERROR; - el->el_line.cursor = c__prev_word(el->el_line.cursor, el->el_line.buffer, - el->el_state.argument, + el->el_line.cursor = c__prev_word(el->el_line.cursor, el->el_line.buffer, + el->el_state.argument, ce__isword); if (el->el_map.type == MAP_VI) @@ -349,7 +349,7 @@ ed_prev_word(el, c) } -/* ed_prev_char(): +/* ed_prev_char(): * Move to the left one character * [^B] [^B] */ @@ -372,12 +372,12 @@ ed_prev_char(el, c) return CC_CURSOR; } - else + else return CC_ERROR; } -/* ed_quoted_insert(): +/* ed_quoted_insert(): * Add the next character typed verbatim * [^V] [^V] */ @@ -400,7 +400,7 @@ ed_quoted_insert(el, c) } -/* ed_digit(): +/* ed_digit(): * Adds to argument or enters a digit */ protected el_action_t @@ -411,14 +411,14 @@ ed_digit(el, c) if (!isdigit(c)) return CC_ERROR; - if (el->el_state.doingarg) { + if (el->el_state.doingarg) { /* if doing an arg, add this in... */ - if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT) + if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT) el->el_state.argument = c - '0'; else { if (el->el_state.argument > 1000000) return CC_ERROR; - el->el_state.argument = + el->el_state.argument = (el->el_state.argument * 10) + (c - '0'); } return CC_ARGHACK; @@ -428,10 +428,10 @@ ed_digit(el, c) return CC_ERROR; if (el->el_state.inputmode != MODE_INSERT) { - el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] = + el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] = *el->el_line.cursor; el->el_chared.c_undo.buf[el->el_chared.c_undo.isize] = '\0'; - c_delafter(el, 1); + c_delafter(el, 1); } c_insert(el, 1); *el->el_line.cursor++ = c; @@ -442,7 +442,7 @@ ed_digit(el, c) } -/* ed_argument_digit(): +/* ed_argument_digit(): * Digit that starts argument * For ESC-n */ @@ -467,7 +467,7 @@ ed_argument_digit(el, c) } -/* ed_unassigned(): +/* ed_unassigned(): * Indicates unbound character * Bound to keys that are not assigned */ @@ -487,7 +487,7 @@ ed_unassigned(el, c) ** TTY key handling. **/ -/* ed_tty_sigint(): +/* ed_tty_sigint(): * Tty interrupt character * [^C] */ @@ -496,12 +496,12 @@ protected el_action_t ed_tty_sigint(el, c) EditLine *el; int c; -{ +{ return CC_NORM; } -/* ed_tty_dsusp(): +/* ed_tty_dsusp(): * Tty delayed suspend character * [^Y] */ @@ -515,7 +515,7 @@ ed_tty_dsusp(el, c) } -/* ed_tty_flush_output(): +/* ed_tty_flush_output(): * Tty flush output characters * [^O] */ @@ -529,7 +529,7 @@ ed_tty_flush_output(el, c) } -/* ed_tty_sigquit(): +/* ed_tty_sigquit(): * Tty quit character * [^\] */ @@ -543,7 +543,7 @@ ed_tty_sigquit(el, c) } -/* ed_tty_sigtstp(): +/* ed_tty_sigtstp(): * Tty suspend character * [^Z] */ @@ -557,7 +557,7 @@ ed_tty_sigtstp(el, c) } -/* ed_tty_stop_output(): +/* ed_tty_stop_output(): * Tty disallow output characters * [^S] */ @@ -571,7 +571,7 @@ ed_tty_stop_output(el, c) } -/* ed_tty_start_output(): +/* ed_tty_start_output(): * Tty allow output characters * [^Q] */ @@ -585,7 +585,7 @@ ed_tty_start_output(el, c) } -/* ed_newline(): +/* ed_newline(): * Execute command * [^J] */ @@ -604,7 +604,7 @@ ed_newline(el, c) } -/* ed_delete_prev_char(): +/* ed_delete_prev_char(): * Delete the character to the left of the cursor * [^?] */ @@ -614,10 +614,10 @@ ed_delete_prev_char(el, c) EditLine *el; int c; { - if (el->el_line.cursor <= el->el_line.buffer) + if (el->el_line.cursor <= el->el_line.buffer) return CC_ERROR; - c_delbefore(el, el->el_state.argument); + c_delbefore(el, el->el_state.argument); el->el_line.cursor -= el->el_state.argument; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; @@ -625,7 +625,7 @@ ed_delete_prev_char(el, c) } -/* ed_clear_screen(): +/* ed_clear_screen(): * Clear screen leaving current line at the top * [^L] */ @@ -641,7 +641,7 @@ ed_clear_screen(el, c) } -/* ed_redisplay(): +/* ed_redisplay(): * Redisplay everything * ^R */ @@ -657,7 +657,7 @@ ed_redisplay(el, c) } -/* ed_start_over(): +/* ed_start_over(): * Erase current line and start from scratch * [^G] */ @@ -672,7 +672,7 @@ ed_start_over(el, c) } -/* ed_sequence_lead_in(): +/* ed_sequence_lead_in(): * First character in a bound sequence * Placeholder for external keys */ @@ -686,7 +686,7 @@ ed_sequence_lead_in(el, c) } -/* ed_prev_history(): +/* ed_prev_history(): * Move to the previous history line * [^P] [k] */ @@ -703,7 +703,7 @@ ed_prev_history(el, c) if (el->el_history.eventno == 0) { /* save the current buffer away */ (void) strncpy(el->el_history.buf, el->el_line.buffer, EL_BUFSIZ); - el->el_history.last = el->el_history.buf + + el->el_history.last = el->el_history.buf + (el->el_line.lastchar - el->el_line.buffer); } @@ -712,7 +712,7 @@ ed_prev_history(el, c) if (hist_get(el) == CC_ERROR) { beep = 1; /* el->el_history.eventno was fixed by first call */ - (void) hist_get(el); + (void) hist_get(el); } re_refresh(el); @@ -723,7 +723,7 @@ ed_prev_history(el, c) } -/* ed_next_history(): +/* ed_next_history(): * Move to the next history line * [^N] [j] */ @@ -747,7 +747,7 @@ ed_next_history(el, c) } -/* ed_search_prev_history(): +/* ed_search_prev_history(): * Search previous in history for a line matching the current * next search history [M-P] [K] */ @@ -774,7 +774,7 @@ ed_search_prev_history(el, c) if (el->el_history.eventno == 0) { (void) strncpy(el->el_history.buf, el->el_line.buffer, EL_BUFSIZ); - el->el_history.last = el->el_history.buf + + el->el_history.last = el->el_history.buf + (el->el_line.lastchar - el->el_line.buffer); } @@ -795,9 +795,9 @@ ed_search_prev_history(el, c) #ifdef SDEBUG (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); #endif - if ((strncmp(hp, el->el_line.buffer, - el->el_line.lastchar - el->el_line.buffer) || - hp[el->el_line.lastchar-el->el_line.buffer]) && + if ((strncmp(hp, el->el_line.buffer, + el->el_line.lastchar - el->el_line.buffer) || + hp[el->el_line.lastchar-el->el_line.buffer]) && c_hmatch(el, hp)) { found++; break; @@ -808,7 +808,7 @@ ed_search_prev_history(el, c) if (!found) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "not found\n"); + (void) fprintf(el->el_errfile, "not found\n"); #endif return CC_ERROR; } @@ -819,7 +819,7 @@ ed_search_prev_history(el, c) } -/* ed_search_next_history(): +/* ed_search_next_history(): * Search next in history for a line matching the current * [M-N] [J] */ @@ -853,9 +853,9 @@ ed_search_next_history(el, c) #ifdef SDEBUG (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); #endif - if ((strncmp(hp, el->el_line.buffer, - el->el_line.lastchar - el->el_line.buffer) || - hp[el->el_line.lastchar-el->el_line.buffer]) && + if ((strncmp(hp, el->el_line.buffer, + el->el_line.lastchar - el->el_line.buffer) || + hp[el->el_line.lastchar-el->el_line.buffer]) && c_hmatch(el, hp)) found = h; hp = HIST_NEXT(el); @@ -864,7 +864,7 @@ ed_search_next_history(el, c) if (!found) { /* is it the current history number? */ if (!c_hmatch(el, el->el_history.buf)) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "not found\n"); + (void) fprintf(el->el_errfile, "not found\n"); #endif return CC_ERROR; } @@ -888,7 +888,7 @@ ed_prev_line(el, c) { char *ptr; int nchars = c_hpos(el); - + /* * Move to the line requested */ @@ -907,15 +907,15 @@ ed_prev_line(el, c) */ for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--) continue; - + /* * Move to the character requested */ - for (ptr++; - nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; + for (ptr++; + nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; ptr++) continue; - + el->el_line.cursor = ptr; return CC_CURSOR; } @@ -948,16 +948,16 @@ ed_next_line(el, c) * Move to the character requested */ for (ptr++; - nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; + nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; ptr++) continue; - + el->el_line.cursor = ptr; return CC_CURSOR; } -/* ed_command(): +/* ed_command(): * Editline extended command * [M-X] [:] */ diff --git a/lib/libedit/el.c b/lib/libedit/el.c index 7314477a69ac..075a05357a26 100644 --- a/lib/libedit/el.c +++ b/lib/libedit/el.c @@ -86,7 +86,7 @@ el_init(prog, fin, fout) return NULL; } } - else + else #endif el->el_errfile = stderr; @@ -132,7 +132,7 @@ el_end(el) el_free((ptr_t) el->el_prog); el_free((ptr_t) el); -} /* end el_end */ +} /* end el_end */ /* el_reset(): @@ -170,7 +170,7 @@ el_set(va_alist) el = va_arg(va, EditLine *); op = va_arg(va, int); #endif - + switch (op) { case EL_PROMPT: rv = prompt_set(el, va_arg(va, el_pfunc_t)); @@ -237,7 +237,7 @@ el_set(va_alist) } } break; - + case EL_ADDFN: { char *name = va_arg(va, char *); @@ -291,7 +291,7 @@ el_source(el, fname) if (fname == NULL) { fname = &elpath[1]; if ((fp = fopen(fname, "r")) == NULL) { - if ((ptr = getenv("HOME")) == NULL) + if ((ptr = getenv("HOME")) == NULL) return -1; fname = strncpy(path, ptr, MAXPATHLEN); (void) strncat(path, elpath, MAXPATHLEN); @@ -299,7 +299,7 @@ el_source(el, fname) } } - if ((fp = fopen(fname, "r")) == NULL) + if ((fp = fopen(fname, "r")) == NULL) return -1; while ((ptr = fgetln(fp, &len)) != NULL) diff --git a/lib/libedit/emacs.c b/lib/libedit/emacs.c index 273de1079f7b..a3a19759f00c 100644 --- a/lib/libedit/emacs.c +++ b/lib/libedit/emacs.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint && not SCCSID */ -/* +/* * emacs.c: Emacs functions */ #include "sys.h" @@ -90,7 +90,7 @@ em_delete_next_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, + cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (p = el->el_line.cursor, kp = el->el_chared.c_kill.buf; p < cp; p++) @@ -120,8 +120,8 @@ em_yank(el, c) if (el->el_chared.c_kill.last == el->el_chared.c_kill.buf) return CC_ERROR; - if (el->el_line.lastchar + - (el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >= + if (el->el_line.lastchar + + (el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >= el->el_line.limit) return CC_ERROR; @@ -129,13 +129,13 @@ em_yank(el, c) cp = el->el_line.cursor; /* open the space, */ - c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf); + c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf); /* copy the chars */ - for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) + for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) *cp++ = *kp; /* if an arg, cursor at beginning else cursor at end */ - if (el->el_state.argument == 1) + if (el->el_state.argument == 1) el->el_line.cursor = cp; return CC_REFRESH; @@ -251,7 +251,7 @@ em_gosmacs_traspose(el, c) el->el_line.cursor[-1] = c; return CC_REFRESH; } - else + else return CC_ERROR; } @@ -269,11 +269,11 @@ em_next_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - el->el_line.cursor = c__next_word(el->el_line.cursor, el->el_line.lastchar, + el->el_line.cursor = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); - if (el->el_map.type == MAP_VI) + if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action & DELETE) { cv_delfini(el); return CC_REFRESH; @@ -294,7 +294,7 @@ em_upper_case(el, c) { char *cp, *ep; - ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, + ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (cp = el->el_line.cursor; cp < ep; cp++) @@ -320,7 +320,7 @@ em_capitol_case(el, c) { char *cp, *ep; - ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, + ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (cp = el->el_line.cursor; cp < ep; cp++) { @@ -353,7 +353,7 @@ em_lower_case(el, c) { char *cp, *ep; - ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, + ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (cp = el->el_line.cursor; cp < ep; cp++) @@ -383,7 +383,7 @@ em_set_mark(el, c) /* em_exchange_mark(): - * Exchange the cursor and mark + * Exchange the cursor and mark * [^X^X] */ protected el_action_t @@ -427,7 +427,7 @@ em_meta_next(el, c) EditLine *el; int c; { - el->el_state.metanext = 1; + el->el_state.metanext = 1; return CC_ARGHACK; } @@ -441,7 +441,7 @@ em_toggle_overwrite(el, c) EditLine *el; int c; { - el->el_state.inputmode = + el->el_state.inputmode = (el->el_state.inputmode == MODE_INSERT) ? MODE_REPLACE : MODE_INSERT; return CC_NORM; } @@ -463,8 +463,8 @@ em_copy_prev_word(el, c) oldc = el->el_line.cursor; /* does a bounds check */ - cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, - el->el_state.argument, ce__isword); + cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, + el->el_state.argument, ce__isword); c_insert(el, oldc - cp); for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++) diff --git a/lib/libedit/hist.c b/lib/libedit/hist.c index 394df63e9d3e..27dacd1925b1 100644 --- a/lib/libedit/hist.c +++ b/lib/libedit/hist.c @@ -101,7 +101,7 @@ hist_get(el) if (el->el_history.eventno == 0) { /* if really the current line */ (void) strncpy(el->el_line.buffer, el->el_history.buf, EL_BUFSIZ); - el->el_line.lastchar = el->el_line.buffer + + el->el_line.lastchar = el->el_line.buffer + (el->el_history.last - el->el_history.buf); #ifdef KSHVI diff --git a/lib/libedit/history.c b/lib/libedit/history.c index e8665481977c..d60a7a968d2f 100644 --- a/lib/libedit/history.c +++ b/lib/libedit/history.c @@ -130,7 +130,7 @@ private void history_def_delete __P((history_t *, hentry_t *)); /* history_def_first(): * Default function to return the first event in the history. */ -private const HistEvent * +private const HistEvent * history_def_first(p) ptr_t p; { @@ -145,7 +145,7 @@ history_def_first(p) /* history_def_last(): * Default function to return the last event in the history. */ -private const HistEvent * +private const HistEvent * history_def_last(p) ptr_t p; { @@ -160,7 +160,7 @@ history_def_last(p) /* history_def_next(): * Default function to return the next event in the history. */ -private const HistEvent * +private const HistEvent * history_def_next(p) ptr_t p; { @@ -181,7 +181,7 @@ history_def_next(p) /* history_def_prev(): * Default function to return the previous event in the history. */ -private const HistEvent * +private const HistEvent * history_def_prev(p) ptr_t p; { @@ -202,7 +202,7 @@ history_def_prev(p) /* history_def_curr(): * Default function to return the current event in the history. */ -private const HistEvent * +private const HistEvent * history_def_curr(p) ptr_t p; { @@ -296,7 +296,7 @@ history_def_enter(p, str) * Always keep at least one entry. * This way we don't have to check for the empty list. */ - while (h->cur > h->max + 1) + while (h->cur > h->max + 1) history_def_delete(h, h->list.prev); return ev; } @@ -399,9 +399,9 @@ history_set_fun(h, first, next, last, prev, curr, enter, add, ptr) history_efun_t enter, add; ptr_t ptr; { - if (first == NULL || next == NULL || + if (first == NULL || next == NULL || last == NULL || prev == NULL || curr == NULL || - enter == NULL || add == NULL || + enter == NULL || add == NULL || ptr == NULL ) { if (h->h_next != history_def_next) { history_def_init(&h->h_ref, 0); @@ -514,7 +514,7 @@ history(va_alist) #if __STDC__ va_start(va, fun); #else - History *h; + History *h; int fun; va_start(va); h = va_arg(va, History *); @@ -584,7 +584,7 @@ history(va_alist) history_efun_t add = va_arg(va, history_efun_t); ptr_t ptr = va_arg(va, ptr_t); - if (history_set_fun(h, first, next, last, prev, + if (history_set_fun(h, first, next, last, prev, curr, enter, add, ptr) == 0) ev = &sev; } diff --git a/lib/libedit/key.c b/lib/libedit/key.c index 058da0e7f435..302b6bd68d54 100644 --- a/lib/libedit/key.c +++ b/lib/libedit/key.c @@ -42,10 +42,10 @@ static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93"; * key.c: This module contains the procedures for maintaining * the extended-key map. * - * An extended-key (key) is a sequence of keystrokes introduced - * with an sequence introducer and consisting of an arbitrary - * number of characters. This module maintains a map (the el->el_key.map) - * to convert these extended-key sequences into input strs + * An extended-key (key) is a sequence of keystrokes introduced + * with an sequence introducer and consisting of an arbitrary + * number of characters. This module maintains a map (the el->el_key.map) + * to convert these extended-key sequences into input strs * (XK_STR), editor functions (XK_CMD), or unix commands (XK_EXE). * * Warning: @@ -65,8 +65,8 @@ static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93"; #include "el.h" -/* - * The Nodes of the el->el_key.map. The el->el_key.map is a linked list +/* + * The Nodes of the el->el_key.map. The el->el_key.map is a linked list * of these node elements */ struct key_node_t { @@ -78,9 +78,9 @@ struct key_node_t { struct key_node_t *sibling; /* ptr to another key with same prefix */ }; -private int node_trav __P((EditLine *, key_node_t *, char *, +private int node_trav __P((EditLine *, key_node_t *, char *, key_value_t *)); -private int node__try __P((key_node_t *, char *, +private int node__try __P((key_node_t *, char *, key_value_t *, int)); private key_node_t *node__get __P((int)); private void node__put __P((key_node_t *)); @@ -104,7 +104,7 @@ key_init(el) el->el_key.map = NULL; key_reset(el); return 0; -} +} /* key_end(): @@ -118,7 +118,7 @@ key_end(el) el->el_key.buf = NULL; /* XXX: provide a function to clear the keys */ el->el_key.map = NULL; -} +} /* key_map_cmd(): @@ -167,7 +167,7 @@ key_reset(el) * Looks up *ch in map and then reads characters until a * complete match is found or a mismatch occurs. Returns the * type of the match found (XK_STR, XK_CMD, or XK_EXE). - * Returns NULL in val.str and XK_STR for no match. + * Returns NULL in val.str and XK_STR for no match. * The last character read is returned in *ch. */ protected int @@ -195,7 +195,7 @@ key_add(el, key, val, ntype) int ntype; { if (key[0] == '\0') { - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "key_add: Null extended-key not allowed.\n"); return; } @@ -211,7 +211,7 @@ key_add(el, key, val, ntype) el->el_key.map = node__get(key[0]); /* it is properly initialized */ /* Now recurse through el->el_key.map */ - (void) node__try(el->el_key.map, key, val, ntype); + (void) node__try(el->el_key.map, key, val, ntype); return; } @@ -226,9 +226,9 @@ key_clear(el, map, in) char *in; { if ((map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) && - ((map == el->el_map.key && + ((map == el->el_map.key && el->el_map.alt[(unsigned char) *in] != ED_SEQUENCE_LEAD_IN) || - (map == el->el_map.alt && + (map == el->el_map.alt && el->el_map.key[(unsigned char) *in] != ED_SEQUENCE_LEAD_IN))) (void) key_delete(el, in); } @@ -244,7 +244,7 @@ key_delete(el, key) char *key; { if (key[0] == '\0') { - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "key_delete: Null extended-key not allowed.\n"); return -1; } @@ -515,7 +515,7 @@ node_lookup(el, str, ptr, cnt) /* If match put this char into el->el_key.buf. Recurse */ if (ptr->ch == *str) { /* match found */ - ncnt = key__decode_char(el->el_key.buf, cnt, + ncnt = key__decode_char(el->el_key.buf, cnt, (unsigned char) ptr->ch); if (ptr->next != NULL) /* not yet at leaf */ @@ -557,7 +557,7 @@ node_enum(el, ptr, cnt) if (cnt >= KEY_BUFSIZ - 5) { /* buffer too small */ el->el_key.buf[++cnt] = '"'; el->el_key.buf[++cnt] = '\0'; - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "Some extended keys too long for internal print buffer"); (void) fprintf(el->el_errfile, " \"%s...\"\n", el->el_key.buf); return 0; @@ -607,18 +607,18 @@ key_kprint(el, key, val, ntype) switch (ntype) { case XK_STR: case XK_EXE: - (void) fprintf(el->el_errfile, fmt, key, - key__decode_str(val->str, unparsbuf, + (void) fprintf(el->el_errfile, fmt, key, + key__decode_str(val->str, unparsbuf, ntype == XK_STR ? "\"\"" : "[]")); break; case XK_CMD: - for (fp = el->el_map.help; fp->name; fp++) + for (fp = el->el_map.help; fp->name; fp++) if (val->cmd == fp->func) { (void) fprintf(el->el_errfile, fmt, key, fp->name); break; } #ifdef DEBUG_KEY - if (fp->name == NULL) + if (fp->name == NULL) (void) fprintf(el->el_errfile, "BUG! Command not found.\n"); #endif @@ -708,7 +708,7 @@ key__decode_str(str, buf, sep) *b++ = '\\'; *b++ = *p; } - else if (*p == ' ' || (isprint((unsigned char) *p) && + else if (*p == ' ' || (isprint((unsigned char) *p) && !isspace((unsigned char) *p))) { *b++ = *p; } diff --git a/lib/libedit/key.h b/lib/libedit/key.h index 2ed3afc8fe08..eed081829c80 100644 --- a/lib/libedit/key.h +++ b/lib/libedit/key.h @@ -65,7 +65,7 @@ protected void key_end __P((EditLine *)); protected key_value_t * key_map_cmd __P((EditLine *, int)); protected key_value_t * key_map_str __P((EditLine *, char *)); protected void key_reset __P((EditLine *)); -protected int key_get __P((EditLine *, char *, +protected int key_get __P((EditLine *, char *, key_value_t *)); protected void key_add __P((EditLine *, char *, key_value_t *, int)); @@ -73,7 +73,7 @@ protected void key_clear __P((EditLine *, el_action_t *, char *)); protected int key_delete __P((EditLine *, char *)); protected void key_print __P((EditLine *, char *)); -protected void key_kprint __P((EditLine *, char *, +protected void key_kprint __P((EditLine *, char *, key_value_t *, int)); protected char *key__decode_str __P((char *, char *, char *)); diff --git a/lib/libedit/map.c b/lib/libedit/map.c index 3378217ff851..5f91c75789b8 100644 --- a/lib/libedit/map.c +++ b/lib/libedit/map.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint && not SCCSID */ /* - * map.c: Editor function definitions + * map.c: Editor function definitions */ #include "sys.h" #include <stdlib.h> @@ -660,8 +660,8 @@ private el_action_t el_map_vi_command[] = { /* 41 */ ED_UNASSIGNED, /* ) */ /* 42 */ ED_UNASSIGNED, /* * */ /* 43 */ ED_NEXT_HISTORY, /* + */ - /* 44 */ VI_REPEAT_PREV_CHAR, /* , */ - /* 45 */ ED_PREV_HISTORY, /* - */ + /* 44 */ VI_REPEAT_PREV_CHAR, /* , */ + /* 45 */ ED_PREV_HISTORY, /* - */ /* 46 */ ED_UNASSIGNED, /* . */ /* 47 */ VI_SEARCH_PREV, /* / */ /* 48 */ VI_ZERO, /* 0 */ @@ -882,7 +882,7 @@ protected int map_init(el) EditLine *el; { - + /* * Make sure those are correct before starting. */ @@ -902,7 +902,7 @@ map_init(el) el->el_map.vii = el_map_vi_insert; el->el_map.help = (el_bindings_t *) el_malloc(sizeof(el_bindings_t) * EL_NUM_FCNS); - (void) memcpy(el->el_map.help, help__get(), + (void) memcpy(el->el_map.help, help__get(), sizeof(el_bindings_t) * EL_NUM_FCNS); el->el_map.func = (el_func_t *) el_malloc(sizeof(el_func_t) * EL_NUM_FCNS); memcpy(el->el_map.func, func__get(), sizeof(el_func_t) * EL_NUM_FCNS); @@ -948,8 +948,8 @@ map_init_nls(el) int i; el_action_t *map = el->el_map.key; - for (i = 0200; i <= 0377; i++) - if (isprint(i)) + for (i = 0200; i <= 0377; i++) + if (isprint(i)) map[i] = ED_INSERT; } @@ -977,12 +977,12 @@ map_init_meta(el) if (el->el_map.type == MAP_VI) map = alt; } - else + else map = alt; } buf[0] = (char) i; buf[2] = 0; - for (i = 0200; i <= 0377; i++) + for (i = 0200; i <= 0377; i++) switch (map[i]) { case ED_INSERT: case ED_UNASSIGNED: @@ -1064,14 +1064,14 @@ map_init_emacs(el) buf[2] = 0; buf[1] = CONTROL('X'); key_add(el, buf, key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD); - + tty_bind_char(el, 1); term_bind_arrow(el); } /* map_set_editor(): - * Set the editor + * Set the editor */ protected int map_set_editor(el, editor) @@ -1106,12 +1106,12 @@ map_print_key(el, map, in) (void) key__decode_str(in, outbuf, ""); for (bp = el->el_map.help; bp->name != NULL; bp++) if (bp->func == map[(unsigned char) *in]) { - (void) fprintf(el->el_outfile, + (void) fprintf(el->el_outfile, "%s\t->\t%s\n", outbuf, bp->name); return; } } - else + else key_print(el, in); } @@ -1144,13 +1144,13 @@ map_print_some_keys(el, map, first, last) if (bp->func == map[first]) { if (first == last) { (void) fprintf(el->el_outfile, "%-15s-> %s\n", - key__decode_str(firstbuf, unparsbuf, STRQQ), + key__decode_str(firstbuf, unparsbuf, STRQQ), bp->name); } else { (void) fprintf(el->el_outfile, "%-4s to %-7s-> %s\n", key__decode_str(firstbuf, unparsbuf, STRQQ), - key__decode_str(lastbuf, extrabuf, STRQQ), + key__decode_str(lastbuf, extrabuf, STRQQ), bp->name); } return; @@ -1160,13 +1160,13 @@ map_print_some_keys(el, map, first, last) if (map == el->el_map.key) { (void) fprintf(el->el_outfile, "BUG!!! %s isn't bound to anything.\n", key__decode_str(firstbuf, unparsbuf, STRQQ)); - (void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n", + (void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n", first, el->el_map.key[first]); } else { (void) fprintf(el->el_outfile, "BUG!!! %s isn't bound to anything.\n", key__decode_str(firstbuf, unparsbuf, STRQQ)); - (void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n", + (void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n", first, el->el_map.alt[first]); } #endif @@ -1268,8 +1268,8 @@ map_bind(el, argc, argv) return 0; case 'l': - for (bp = el->el_map.help; bp->name != NULL; bp++) - (void) fprintf(el->el_outfile, "%s\n\t%s\n", + for (bp = el->el_map.help; bp->name != NULL; bp++) + (void) fprintf(el->el_outfile, "%s\n\t%s\n", bp->name, bp->description); return 0; default: @@ -1298,11 +1298,11 @@ map_bind(el, argc, argv) (void) term_clear_arrow(el, in); return -1; } - if (in[1]) + if (in[1]) (void) key_delete(el, in); - else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) + else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) (void) key_delete(el, in); - else + else map[(unsigned char) *in] = ED_UNASSIGNED; return 0; } @@ -1326,7 +1326,7 @@ map_bind(el, argc, argv) case XK_STR: case XK_EXE: if ((out = parse__string(outbuf, argv[argc])) == NULL) { - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "%s: Invalid \\ or ^ in outstring.\n", argv[0]); return -1; } @@ -1339,7 +1339,7 @@ map_bind(el, argc, argv) case XK_CMD: if ((cmd = parse_cmd(el, argv[argc])) == -1) { - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "%s: Invalid command `%s'.\n", argv[0], argv[argc]); return -1; } @@ -1379,7 +1379,7 @@ map_addfunc(el, name, help, func) if (name == NULL || help == NULL || func == NULL) return -1; - el->el_map.func = (el_func_t *) + el->el_map.func = (el_func_t *) el_realloc(el->el_map.func, nf * sizeof(el_func_t)); el->el_map.help = (el_bindings_t *) el_realloc(el->el_map.help, nf * sizeof(el_bindings_t)); diff --git a/lib/libedit/map.h b/lib/libedit/map.h index 71c93b4a21e2..c0f16f10a0cd 100644 --- a/lib/libedit/map.h +++ b/lib/libedit/map.h @@ -71,7 +71,7 @@ protected void map_end __P((EditLine *)); protected void map_init_vi __P((EditLine *)); protected void map_init_emacs __P((EditLine *)); protected int map_set_editor __P((EditLine *, char *)); -protected int map_addfunc __P((EditLine *, const char *, +protected int map_addfunc __P((EditLine *, const char *, const char *, el_func_t)); #endif /* _h_el_map */ diff --git a/lib/libedit/parse.c b/lib/libedit/parse.c index 2fe746f370bc..a89539c9cd2f 100644 --- a/lib/libedit/parse.c +++ b/lib/libedit/parse.c @@ -131,7 +131,7 @@ parse__escape(ptr) p = *ptr; - if (p[1] == 0) + if (p[1] == 0) return -1; if (*p == '\\') { @@ -180,7 +180,7 @@ parse__escape(ptr) } c = (c << 3) | (ch - '0'); } - if ((c & 0xffffff00) != 0) + if ((c & 0xffffff00) != 0) return -1; --p; } diff --git a/lib/libedit/parse.h b/lib/libedit/parse.h index 263076b30a5a..060174655354 100644 --- a/lib/libedit/parse.h +++ b/lib/libedit/parse.h @@ -42,7 +42,7 @@ #ifndef _h_el_parse #define _h_el_parse -protected int parse_line __P((EditLine *, const char *)); +protected int parse_line __P((EditLine *, const char *)); protected int parse__escape __P((const char ** const)); protected char * parse__string __P((char *, const char *)); protected int parse_cmd __P((EditLine *, const char *)); diff --git a/lib/libedit/prompt.c b/lib/libedit/prompt.c index cea7ad7d1334..59ba200c7312 100644 --- a/lib/libedit/prompt.c +++ b/lib/libedit/prompt.c @@ -83,7 +83,7 @@ prompt_print(el) /* prompt_init(): * Initialize the prompt stuff */ -protected int +protected int prompt_init(el) EditLine *el; { @@ -98,7 +98,7 @@ prompt_init(el) * Clean up the prompt stuff */ protected void -/*ARGSUSED*/ +/*ARGSUSED*/ prompt_end(el) EditLine *el; { @@ -108,7 +108,7 @@ prompt_end(el) /* prompt_set(): * Install a prompt printing function */ -protected int +protected int prompt_set(el, prf) EditLine *el; el_pfunc_t prf; diff --git a/lib/libedit/read.c b/lib/libedit/read.c index ccfc88b8f59d..05049e81f908 100644 --- a/lib/libedit/read.c +++ b/lib/libedit/read.c @@ -104,7 +104,7 @@ read__fixio(fd, e) if (fcntl(fd, F_SETFL, e & ~O_NDELAY) == -1) return -1; - else + else e = 1; # endif /* F_SETFL && O_NDELAY */ @@ -233,7 +233,7 @@ read_getcmd(el, cmdnum, ch) break; } } - if (el->el_map.alt == NULL) + if (el->el_map.alt == NULL) el->el_map.current = el->el_map.key; } *cmdnum = cmd; @@ -261,9 +261,9 @@ el_getc(el, cp) if (!read_preread(el)) break; } - if (ma->level < 0) + if (ma->level < 0) break; - + if (*ma->macro[ma->level] == 0) { ma->level--; continue; @@ -347,7 +347,7 @@ el_gets(el, nread) if (cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */ #ifdef DEBUG_EDIT - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "ERROR: illegal command from key 0%o\r\n", ch); #endif /* DEBUG_EDIT */ continue; /* try again */ @@ -399,7 +399,7 @@ el_gets(el, nread) break; case CC_NEWLINE: /* normal end of line */ - num = el->el_line.lastchar - el->el_line.buffer; + num = el->el_line.lastchar - el->el_line.buffer; break; case CC_FATAL: /* fatal error, reset to known state */ diff --git a/lib/libedit/refresh.c b/lib/libedit/refresh.c index 51fe769c5141..6ad552283317 100644 --- a/lib/libedit/refresh.c +++ b/lib/libedit/refresh.c @@ -51,9 +51,9 @@ static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; private void re_addc __P((EditLine *, int)); private void re_update_line __P((EditLine *, char *, char *, int)); -private void re_insert __P((EditLine *, char *, int, int, +private void re_insert __P((EditLine *, char *, int, int, char *, int)); -private void re_delete __P((EditLine *, char *, int, int, +private void re_delete __P((EditLine *, char *, int, int, int)); private void re_fastputc __P((EditLine *, int)); @@ -61,7 +61,7 @@ private void re__strncopy __P((char *, char *, size_t)); private void re__copy_and_pad __P((char *, char *, size_t)); #ifdef DEBUG_REFRESH -private void re_printstr __P((EditLine *, char *, char *, +private void re_printstr __P((EditLine *, char *, char *, char *)); # define __F el->el_errfile # define RE_DEBUG(a, b, c) do \ @@ -83,7 +83,7 @@ re_printstr(el, str, f, t) while (f < t) RE_DEBUG(1,(__F, "%c", *f++ & 0177),); RE_DEBUG(1,(__F, "\"\r\n"),); -} +} #else # define RE_DEBUG(a, b, c) #endif @@ -117,9 +117,9 @@ re_addc(el, c) } else if (iscntrl(c)) { re_putc(el, '^'); - if (c == '\177') + if (c == '\177') re_putc(el, '?'); - else + else /* uncontrolify it; works only for iso8859-1 like sets */ re_putc(el, (c | 0100)); } @@ -145,11 +145,11 @@ re_putc(el, c) el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_refresh.r_cursor.h] = c; el->el_refresh.r_cursor.h++; /* advance to next place */ if (el->el_refresh.r_cursor.h >= el->el_term.t_size.h) { - el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_term.t_size.h] = '\0'; + el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_term.t_size.h] = '\0'; /* assure end of line */ el->el_refresh.r_cursor.h = 0; /* reset it. */ el->el_refresh.r_cursor.v++; - RE_DEBUG(el->el_refresh.r_cursor.v >= el->el_term.t_size.v, + RE_DEBUG(el->el_refresh.r_cursor.v >= el->el_term.t_size.v, (__F, "\r\nre_putc: overflow! r_cursor.v == %d > %d\r\n", el->el_refresh.r_cursor.v, el->el_term.t_size.v), abort()); } @@ -195,12 +195,12 @@ re_refresh(el) cur.v = el->el_refresh.r_cursor.v; } /* must be done BEFORE the NUL is written */ - el->el_refresh.r_newcv = el->el_refresh.r_cursor.v; + el->el_refresh.r_newcv = el->el_refresh.r_cursor.v; re_putc(el, '\0'); /* put NUL on end */ - RE_DEBUG(1,(__F, + RE_DEBUG(1,(__F, "term.h=%d vcur.h=%d vcur.v=%d vdisplay[0]=\r\n:%80.80s:\r\n", - el->el_term.t_size.h, el->el_refresh.r_cursor.h, + el->el_term.t_size.h, el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, el->el_vdisplay[0]),); RE_DEBUG(1,(__F, "updating %d lines.\r\n", el->el_refresh.r_newcv),); @@ -214,14 +214,14 @@ re_refresh(el) * cursor by writing the character that is at the end of the * screen line, it won't be a NUL or some old leftover stuff. */ - re__copy_and_pad(el->el_display[i], el->el_vdisplay[i], + re__copy_and_pad(el->el_display[i], el->el_vdisplay[i], el->el_term.t_size.h); } RE_DEBUG(1,(__F, "\r\nel->el_refresh.r_cursor.v=%d,el->el_refresh.r_oldcv=%d i=%d\r\n", el->el_refresh.r_cursor.v, el->el_refresh.r_oldcv, i),); - if (el->el_refresh.r_oldcv > el->el_refresh.r_newcv) + if (el->el_refresh.r_oldcv > el->el_refresh.r_newcv) for (; i <= el->el_refresh.r_oldcv; i++) { term_move_to_line(el, i); term_move_to_char(el, 0); @@ -231,11 +231,11 @@ re_refresh(el) #endif /* DEBUG_REFRESH */ *el->el_display[i] = '\0'; } - + el->el_refresh.r_oldcv = el->el_refresh.r_newcv; /* set for next time */ - RE_DEBUG(1,(__F, + RE_DEBUG(1,(__F, "\r\ncursor.h = %d, cursor.v = %d, cur.h = %d, cur.v = %d\r\n", - el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, + el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, cur.h, cur.v),); term_move_to_line(el, cur.v); /* go to where the cursor is */ term_move_to_char(el, cur.h); @@ -243,7 +243,7 @@ re_refresh(el) /* re_goto_bottom(): - * used to go to last used screen line + * used to go to last used screen line */ protected void re_goto_bottom(el) @@ -259,7 +259,7 @@ re_goto_bottom(el) /* re_insert(): * insert num characters of s into d (in front of the character) - * at dat, maximum length of d is dlen + * at dat, maximum length of d is dlen */ private void /*ARGSUSED*/ @@ -289,7 +289,7 @@ re_insert(el, d, dat, dlen, s, num) *b-- = *a--; d[dlen] = '\0'; /* just in case */ } - RE_DEBUG(1,(__F, + RE_DEBUG(1,(__F, "re_insert() after insert: %d at %d max %d, d == \"%s\"\n", num, dat, dlen, d),); RE_DEBUG(1,(__F, "s == \"%s\"n", s),); @@ -305,7 +305,7 @@ re_insert(el, d, dat, dlen, s, num) /* re_delete(): - * delete num characters d at dat, maximum length of d is dlen + * delete num characters d at dat, maximum length of d is dlen */ private void /*ARGSUSED*/ @@ -400,7 +400,7 @@ re_update_line(el, old, new, i) */ while (*o) o++; - /* + /* * Remove any trailing blanks off of the end, being careful not to * back up past the beginning. */ @@ -411,7 +411,7 @@ re_update_line(el, old, new, i) } oe = o; *oe = '\0'; - + while (*n) n++; @@ -423,7 +423,7 @@ re_update_line(el, old, new, i) } ne = n; *ne = '\0'; - + /* * if no diff, continue to next line of redraw */ @@ -574,7 +574,7 @@ re_update_line(el, old, new, i) ofd - old, osb - old, ose - old, ols - old, oe - old),); RE_DEBUG(1,(__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n", nfd - new, nsb - new, nse - new, nls - new, ne - new),); - RE_DEBUG(1,(__F, + RE_DEBUG(1,(__F, "xxx-xxx:\"00000000001111111111222222222233333333334\"\r\n"),); RE_DEBUG(1,(__F, "xxx-xxx:\"01234567890123456789012345678901234567890\"\r\n"),); @@ -602,14 +602,14 @@ re_update_line(el, old, new, i) /* * at this point we have something like this: - * + * * /old /ofd /osb /ose /ols /oe * v.....................v v..................v v........v * eddie> Oh, my fredded gruntle-buggy is to me, as foo var lurgid as * eddie> Oh, my fredded quiux buggy is to me, as gruntle-lurgid as - * ^.....................^ ^..................^ ^........^ + * ^.....................^ ^..................^ ^........^ * \new \nfd \nsb \nse \nls \ne - * + * * fx is the difference in length between the the chars between nfd and * nsb, and the chars between ofd and osb, and is thus the number of * characters to delete if < 0 (new is shorter than old, as above), @@ -739,7 +739,7 @@ re_update_line(el, old, new, i) * Again a duplicate test. */ if (sx < 0) { - RE_DEBUG(!EL_CAN_DELETE, + RE_DEBUG(!EL_CAN_DELETE, (__F, "ERROR: cannot delete in second diff\n"),); term_deletechars(el, -sx); } @@ -769,7 +769,7 @@ re_update_line(el, old, new, i) */ if (nsb != ne) { RE_DEBUG(1,(__F, "with stuff to keep at end\r\n"),); - /* + /* * We have to recalculate fx here because we set it * to zero above as a flag saying that we hadn't done * an early first insert. @@ -874,7 +874,7 @@ re_refresh_cursor(el) th = el->el_term.t_size.h; /* optimize for speed */ /* do input buffer to el->el_line.cursor */ - for (cp = el->el_line.buffer; cp < el->el_line.cursor; cp++) { + for (cp = el->el_line.buffer; cp < el->el_line.cursor; cp++) { c = *cp & 0xFF; h++; /* all chars at least this long */ @@ -927,7 +927,7 @@ re_fastputc(el, c) { term__putc(c); el->el_display[el->el_cursor.v][el->el_cursor.h++] = c; - if (el->el_cursor.h >= el->el_term.t_size.h) { + if (el->el_cursor.h >= el->el_term.t_size.h) { /* if we must overflow */ el->el_cursor.h = 0; el->el_cursor.v++; @@ -940,7 +940,7 @@ re_fastputc(el, c) /* re_fastaddc(): * we added just one char, handle it fast. - * Assumes that screen cursor == real cursor + * Assumes that screen cursor == real cursor */ protected void re_fastaddc(el) @@ -974,7 +974,7 @@ re_fastaddc(el) /* re_clear_display(): - * clear the screen buffers so that new new prompt starts fresh. + * clear the screen buffers so that new new prompt starts fresh. */ protected void re_clear_display(el) @@ -991,7 +991,7 @@ re_clear_display(el) /* re_clear_lines(): - * Make sure all lines are *really* blank + * Make sure all lines are *really* blank */ protected void re_clear_lines(el) diff --git a/lib/libedit/search.c b/lib/libedit/search.c index 7b622fdeaca7..bf6099de7156 100644 --- a/lib/libedit/search.c +++ b/lib/libedit/search.c @@ -91,7 +91,7 @@ search_end(el) /* regerror(): * Handle regular expression errors */ -public void +public void /*ARGSUSED*/ regerror(msg) const char *msg; @@ -156,25 +156,25 @@ c_hmatch(el, str) (void) fprintf(el->el_errfile, "match `%s' with `%s'\n", el->el_search.patbuf, str); #endif /* SDEBUG */ - + return el_match(str, el->el_search.patbuf); } -/* c_setpat(): +/* c_setpat(): * Set the history seatch pattern */ protected void c_setpat(el) EditLine *el; { - if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY && + if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY && el->el_state.lastcmd != ED_SEARCH_NEXT_HISTORY) { el->el_search.patlen = EL_CURSOR(el) - el->el_line.buffer; - if (el->el_search.patlen >= EL_BUFSIZ) + if (el->el_search.patlen >= EL_BUFSIZ) el->el_search.patlen = EL_BUFSIZ -1; if (el->el_search.patlen >= 0) { - (void) strncpy(el->el_search.patbuf, el->el_line.buffer, + (void) strncpy(el->el_search.patbuf, el->el_line.buffer, el->el_search.patlen); el->el_search.patbuf[el->el_search.patlen] = '\0'; } @@ -185,8 +185,8 @@ c_setpat(el) (void) fprintf(el->el_errfile, "\neventno = %d\n", el->el_history.eventno); (void) fprintf(el->el_errfile, "patlen = %d\n", el->el_search.patlen); (void) fprintf(el->el_errfile, "patbuf = \"%s\"\n", el->el_search.patbuf); - (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", - EL_CURSOR(el) - el->el_line.buffer, + (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", + EL_CURSOR(el) - el->el_line.buffer, el->el_line.lastchar - el->el_line.buffer); #endif } @@ -213,7 +213,7 @@ ce_inc_search(el, dir) newdir = dir, done, redo; - if (el->el_line.lastchar + sizeof(STRfwd) / sizeof(char) + 2 + + if (el->el_line.lastchar + sizeof(STRfwd) / sizeof(char) + 2 + el->el_search.patlen >= el->el_line.limit) return CC_ERROR; @@ -228,12 +228,12 @@ ce_inc_search(el, dir) } done = redo = 0; *el->el_line.lastchar++ = '\n'; - for (cp = newdir == ED_SEARCH_PREV_HISTORY ? STRbck : STRfwd; + for (cp = newdir == ED_SEARCH_PREV_HISTORY ? STRbck : STRfwd; *cp; *el->el_line.lastchar++ = *cp++) continue; *el->el_line.lastchar++ = pchar; - for (cp = &el->el_search.patbuf[1]; - cp < &el->el_search.patbuf[el->el_search.patlen]; + for (cp = &el->el_search.patbuf[1]; + cp < &el->el_search.patbuf[el->el_search.patlen]; *el->el_line.lastchar++ = *cp++) continue; *el->el_line.lastchar = '\0'; @@ -268,7 +268,7 @@ ce_inc_search(el, dir) case ED_DELETE_PREV_CHAR: if (el->el_search.patlen > 1) done++; - else + else term_beep(el); break; @@ -284,15 +284,15 @@ ce_inc_search(el, dir) for (cp = &el->el_search.patbuf[1]; ; cp++) if (cp >= &el->el_search.patbuf[el->el_search.patlen]) { el->el_line.cursor += el->el_search.patlen - 1; - cp = c__next_word(el->el_line.cursor, + cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, 1, ce__isword); - while (el->el_line.cursor < cp && + while (el->el_line.cursor < cp && *el->el_line.cursor != '\n') { if (el->el_search.patlen > EL_BUFSIZ - 3) { term_beep(el); break; } - el->el_search.patbuf[el->el_search.patlen++] = + el->el_search.patbuf[el->el_search.patlen++] = *el->el_line.cursor; *el->el_line.lastchar++ = *el->el_line.cursor++; } @@ -305,10 +305,10 @@ ce_inc_search(el, dir) break; } break; - + default: /* Terminate and execute cmd */ endcmd[0] = ch; - el_push(el, endcmd); + el_push(el, endcmd); /*FALLTHROUGH*/ case 0033: /* ESC: Terminate */ @@ -319,7 +319,7 @@ ce_inc_search(el, dir) break; } - while (el->el_line.lastchar > el->el_line.buffer && + while (el->el_line.lastchar > el->el_line.buffer && *el->el_line.lastchar != '\n') *el->el_line.lastchar-- = '\0'; *el->el_line.lastchar = '\0'; @@ -327,7 +327,7 @@ ce_inc_search(el, dir) if (!done) { /* Can't search if unmatched '[' */ - for (cp = &el->el_search.patbuf[el->el_search.patlen-1], ch = ']'; + for (cp = &el->el_search.patbuf[el->el_search.patlen-1], ch = ']'; cp > el->el_search.patbuf; cp--) if (*cp == '[' || *cp == ']') { ch = *cp; @@ -337,7 +337,7 @@ ce_inc_search(el, dir) if (el->el_search.patlen > 1 && ch != '[') { if (redo && newdir == dir) { if (pchar == '?') { /* wrap around */ - el->el_history.eventno = + el->el_history.eventno = newdir == ED_SEARCH_PREV_HISTORY ? 0 : 0x7fffffff; if (hist_get(el) == CC_ERROR) /* el->el_history.eventno was fixed by first call */ @@ -345,7 +345,7 @@ ce_inc_search(el, dir) el->el_line.cursor = newdir == ED_SEARCH_PREV_HISTORY ? el->el_line.lastchar : el->el_line.buffer; } else - el->el_line.cursor += + el->el_line.cursor += newdir == ED_SEARCH_PREV_HISTORY ? -1 : 1; } #ifdef ANCHOR @@ -353,19 +353,19 @@ ce_inc_search(el, dir) el->el_search.patbuf[el->el_search.patlen++] = '*'; #endif el->el_search.patbuf[el->el_search.patlen] = '\0'; - if (el->el_line.cursor < el->el_line.buffer || + if (el->el_line.cursor < el->el_line.buffer || el->el_line.cursor > el->el_line.lastchar || - (ret = ce_search_line(el, &el->el_search.patbuf[1], + (ret = ce_search_line(el, &el->el_search.patbuf[1], newdir)) == CC_ERROR) { /* avoid c_setpat */ - el->el_state.lastcmd = (el_action_t) newdir; + el->el_state.lastcmd = (el_action_t) newdir; ret = newdir == ED_SEARCH_PREV_HISTORY ? - ed_search_prev_history(el, 0) : + ed_search_prev_history(el, 0) : ed_search_next_history(el, 0); if (ret != CC_ERROR) { el->el_line.cursor = newdir == ED_SEARCH_PREV_HISTORY ? el->el_line.lastchar : el->el_line.buffer; - (void) ce_search_line(el, &el->el_search.patbuf[1], + (void) ce_search_line(el, &el->el_search.patbuf[1], newdir); } } @@ -386,7 +386,7 @@ ce_inc_search(el, dir) ret = ce_inc_search(el, newdir); - if (ret == CC_ERROR && pchar == '?' && oldpchar == ':') + if (ret == CC_ERROR && pchar == '?' && oldpchar == ':') /* break abort of failed search at last non-failed */ ret = CC_NORM; @@ -484,7 +484,7 @@ cv_search(el, dir) } el->el_state.lastcmd = (el_action_t) dir; /* avoid c_setpat */ el->el_line.cursor = el->el_line.lastchar = el->el_line.buffer; - if ((dir == ED_SEARCH_PREV_HISTORY ? ed_search_prev_history(el, 0) : + if ((dir == ED_SEARCH_PREV_HISTORY ? ed_search_prev_history(el, 0) : ed_search_next_history(el, 0)) == CC_ERROR) { re_refresh(el); return CC_ERROR; @@ -522,7 +522,7 @@ ce_search_line(el, pattern, dir) } return CC_ERROR; } else { - for (cp = el->el_line.cursor; *cp != '\0' && + for (cp = el->el_line.cursor; *cp != '\0' && cp < el->el_line.limit; cp++) if (el_match(cp, pattern)) { el->el_line.cursor = cp; @@ -542,7 +542,7 @@ cv_repeat_srch(el, c) int c; { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "dir %d patlen %d patbuf %s\n", + (void) fprintf(el->el_errfile, "dir %d patlen %d patbuf %s\n", c, el->el_search.patlen, el->el_search.patbuf); #endif @@ -572,9 +572,9 @@ cv_csearch_back(el, ch, count, tflag) cp = el->el_line.cursor; while (count--) { - if (*cp == ch) + if (*cp == ch) cp--; - while (cp > el->el_line.buffer && *cp != ch) + while (cp > el->el_line.buffer && *cp != ch) cp--; } @@ -609,9 +609,9 @@ cv_csearch_fwd(el, ch, count, tflag) cp = el->el_line.cursor; while (count--) { - if(*cp == ch) + if(*cp == ch) cp++; - while (cp < el->el_line.lastchar && *cp != ch) + while (cp < el->el_line.lastchar && *cp != ch) cp++; } diff --git a/lib/libedit/search.h b/lib/libedit/search.h index 51c58b4ab5ee..346b38c25866 100644 --- a/lib/libedit/search.h +++ b/lib/libedit/search.h @@ -39,8 +39,8 @@ /* * el.search.h: Line and history searching utilities */ -#ifndef _h_el_search -#define _h_el_search +#ifndef _h_el_search +#define _h_el_search #include "histedit.h" diff --git a/lib/libedit/sig.c b/lib/libedit/sig.c index 94ab4bb8380b..a16f5f161165 100644 --- a/lib/libedit/sig.c +++ b/lib/libedit/sig.c @@ -91,7 +91,7 @@ sig_handler(signo) break; } - for (i = 0; sighdl[i] != -1; i++) + for (i = 0; sighdl[i] != -1; i++) if (signo == sighdl[i]) break; @@ -120,7 +120,7 @@ sig_init(el) #define SIGSIZE (sizeof(sighdl) / sizeof(sighdl[0]) * sizeof(sig_t)) el->el_signal = (sig_t *) el_malloc(SIGSIZE); - for (i = 0; sighdl[i] != -1; i++) + for (i = 0; sighdl[i] != -1; i++) el->el_signal[i] = BADSIG; (void) sigprocmask(SIG_SETMASK, &oset, NULL); @@ -184,7 +184,7 @@ sig_clr(el) #undef _DO (void) sigprocmask(SIG_BLOCK, &nset, &oset); - for (i = 0; sighdl[i] != -1; i++) + for (i = 0; sighdl[i] != -1; i++) if (el->el_signal[i] != BADSIG) (void) signal(sighdl[i], el->el_signal[i]); diff --git a/lib/libedit/term.c b/lib/libedit/term.c index 053f052b1d1a..8d641f0e075e 100644 --- a/lib/libedit/term.c +++ b/lib/libedit/term.c @@ -177,7 +177,7 @@ private struct termcapstr { { "ho", "home cursor" }, #define T_ic 13 { "ic", "insert character" }, -#define T_im 14 +#define T_im 14 { "im", "start insert mode" }, #define T_ip 15 { "ip", "insert padding" }, @@ -251,7 +251,7 @@ private void term_rebuffer_display __P((EditLine *)); private void term_free_display __P((EditLine *)); private void term_alloc_display __P((EditLine *)); private void term_alloc __P((EditLine *, - struct termcapstr *, char *)); + struct termcapstr *, char *)); private void term_init_arrow __P((EditLine *)); private void term_reset_arrow __P((EditLine *)); @@ -267,7 +267,7 @@ term_setflags(el) EditLine *el; { EL_FLAGS = 0; - if (el->el_tty.t_tabs) + if (el->el_tty.t_tabs) EL_FLAGS |= (Val(T_pt) && !Val(T_xt)) ? TERM_CAN_TAB : 0; EL_FLAGS |= (Val(T_km) || Val(T_MT)) ? TERM_HAS_META : 0; @@ -485,7 +485,7 @@ term_free_display(el) protected void term_move_to_line(el, where) EditLine *el; - int where; + int where; { int del, i; @@ -494,7 +494,7 @@ term_move_to_line(el, where) if (where > el->el_term.t_size.v) { #ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "term_move_to_line: where is ridiculous: %d\r\n", where); #endif /* DEBUG_SCREEN */ return; @@ -538,7 +538,7 @@ mc_again: if (where > (el->el_term.t_size.h + 1)) { #ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "term_move_to_char: where is riduculous: %d\r\n", where); #endif /* DEBUG_SCREEN */ return; @@ -563,7 +563,7 @@ mc_again: if (EL_CAN_TAB) { /* if I can do tabs, use them */ if ((el->el_cursor.h & 0370) != (where & 0370)) { /* if not within tab stop */ - for (i = (el->el_cursor.h & 0370); + for (i = (el->el_cursor.h & 0370); i < (where & 0370); i += 8) term__putc('\t'); /* then tab over */ el->el_cursor.h = where & 0370; @@ -572,8 +572,8 @@ mc_again: /* it's usually cheaper to just write the chars, so we do. */ /* NOTE THAT term_overwrite() WILL CHANGE el->el_cursor.h!!! */ - term_overwrite(el, - &el->el_display[el->el_cursor.v][el->el_cursor.h], + term_overwrite(el, + &el->el_display[el->el_cursor.v][el->el_cursor.h], where - el->el_cursor.h); } @@ -644,7 +644,7 @@ term_deletechars(el, num) if (num > el->el_term.t_size.h) { #ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "term_deletechars: num is riduculous: %d\r\n", num); #endif /* DEBUG_SCREEN */ return; @@ -669,11 +669,11 @@ term_deletechars(el, num) /* term_insertwrite(): - * Puts terminal in insert character mode or inserts num - * characters in the line + * Puts terminal in insert character mode or inserts num + * characters in the line */ protected void -term_insertwrite(el, cp, num) +term_insertwrite(el, cp, num) EditLine *el; char *cp; int num; @@ -705,7 +705,7 @@ term_insertwrite(el, cp, num) (void) tputs(Str(T_im), 1, term__putc); el->el_cursor.h += num; - do + do term__putc(*cp++); while (--num); @@ -732,10 +732,10 @@ term_insertwrite(el, cp, num) /* term_clear_EOL(): - * clear to end of line. There are num characters to clear + * clear to end of line. There are num characters to clear */ protected void -term_clear_EOL(el, num) +term_clear_EOL(el, num) EditLine *el; int num; { @@ -752,7 +752,7 @@ term_clear_EOL(el, num) /* term_clear_screen(): - * Clear the screen + * Clear the screen */ protected void term_clear_screen(el) @@ -839,14 +839,14 @@ term_set(el, term) i = tgetent(el->el_term.t_cap, term); if (i <= 0) { - if (i == -1) + if (i == -1) #ifdef __FreeBSD__ (void) fprintf(el->el_errfile, "Cannot open /usr/share/misc/termcap.\n"); #else (void) fprintf(el->el_errfile, "Cannot open /etc/termcap.\n"); #endif - else if (i == 0) - (void) fprintf(el->el_errfile, + else if (i == 0) + (void) fprintf(el->el_errfile, "No entry for terminal type \"%s\"\n", term); (void) fprintf(el->el_errfile, "using dumb terminal settings.\n"); Val(T_co) = 80; /* do a dumb terminal */ @@ -889,7 +889,7 @@ term_set(el, term) /* term_get_size(): * Return the new window size in lines and cols, and - * true if the size was changed. + * true if the size was changed. */ protected int term_get_size(el, lins, cols) @@ -977,7 +977,7 @@ term_init_arrow(el) * Reset arrow key bindings */ private void -term_reset_arrow(el) +term_reset_arrow(el) EditLine *el; { fkey_t *arrow = el->el_term.t_fkey; @@ -1101,8 +1101,8 @@ term_bind_arrow(el) /* * Assign the arrow keys only if: * - * 1. They are multi-character arrow keys and the user - * has not re-assigned the leading character, or + * 1. They are multi-character arrow keys and the user + * has not re-assigned the leading character, or * has re-assigned the leading character to be * ED_SEQUENCE_LEAD_IN * 2. They are single arrow keys pointing to an unassigned key. @@ -1110,7 +1110,7 @@ term_bind_arrow(el) if (arrow[i].type == XK_NOD) key_clear(el, map, p); else { - if (p[1] && (dmap[j] == map[j] || + if (p[1] && (dmap[j] == map[j] || map[j] == ED_SEQUENCE_LEAD_IN)) { key_add(el, p, &arrow[i].fun, arrow[i].type); map[j] = ED_SEQUENCE_LEAD_IN; @@ -1167,21 +1167,21 @@ term_telltc(el, argc, argv) (void) fprintf(el->el_outfile, "\tfollowing characteristics:\n\n"); (void) fprintf(el->el_outfile, "\tIt has %d columns and %d lines\n", Val(T_co), Val(T_li)); - (void) fprintf(el->el_outfile, + (void) fprintf(el->el_outfile, "\tIt has %s meta key\n", EL_HAS_META ? "a" : "no"); - (void) fprintf(el->el_outfile, + (void) fprintf(el->el_outfile, "\tIt can%suse tabs\n", EL_CAN_TAB ? " " : "not "); #ifdef notyet - (void) fprintf(el->el_outfile, "\tIt %s automatic margins\n", + (void) fprintf(el->el_outfile, "\tIt %s automatic margins\n", (T_Margin&MARGIN_AUTO)? "has": "does not have"); if (T_Margin & MARGIN_AUTO) - (void) fprintf(el->el_outfile, "\tIt %s magic margins\n", + (void) fprintf(el->el_outfile, "\tIt %s magic margins\n", (T_Margin&MARGIN_MAGIC)?"has":"does not have"); #endif for (t = tstr, ts = el->el_term.t_str; t->name != NULL; t++, ts++) - (void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n", t->long_name, - t->name, *ts && **ts ? + (void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n", t->long_name, + t->name, *ts && **ts ? key__decode_str(*ts, upbuf, "") : "(empty)"); (void) fputc('\n', el->el_outfile); return 0; @@ -1229,7 +1229,7 @@ term_settc(el, argc, argv) break; if (tv->name != NULL) { - if (tv == &tval[T_pt] || tv == &tval[T_km] + if (tv == &tval[T_pt] || tv == &tval[T_km] #ifdef notyet || tv == &tval[T_am] || tv == &tval[T_xn] #endif @@ -1309,12 +1309,12 @@ term_echotc(el, argc, argv) } #ifdef notyet else if (strcmp(*argv, "xn") == 0) { - (void) fprintf(el->el_outfile, fmts, T_Margin & MARGIN_MAGIC ? + (void) fprintf(el->el_outfile, fmts, T_Margin & MARGIN_MAGIC ? "yes" : "no"); return 0; } else if (strcmp(*argv, "am") == 0) { - (void) fprintf(el->el_outfile, fmts, T_Margin & MARGIN_AUTO ? + (void) fprintf(el->el_outfile, fmts, T_Margin & MARGIN_AUTO ? "yes" : "no"); return 0; } @@ -1339,7 +1339,7 @@ term_echotc(el, argc, argv) return 0; } - /* + /* * Try to use our local definition first */ scap = NULL; @@ -1352,7 +1352,7 @@ term_echotc(el, argc, argv) scap = tgetstr(*argv, &area); if (!scap || scap[0] == '\0') { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Termcap parameter `%s' not found.\n", *argv); return -1; } @@ -1383,7 +1383,7 @@ term_echotc(el, argc, argv) * hpux has lot's of them... */ if (verbose) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: unknown termcap %% `%c'.\n", *cap); /* This is bad, but I won't complain */ break; @@ -1394,7 +1394,7 @@ term_echotc(el, argc, argv) argv++; if (*argv && *argv[0]) { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Extra argument `%s'.\n", *argv); return -1; } @@ -1404,7 +1404,7 @@ term_echotc(el, argc, argv) argv++; if (!*argv || *argv[0] == '\0') { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Missing argument.\n"); return -1; } @@ -1413,7 +1413,7 @@ term_echotc(el, argc, argv) argv++; if (*argv && *argv[0]) { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Extra argument `%s'.\n", *argv); return -1; } @@ -1422,15 +1422,15 @@ term_echotc(el, argc, argv) default: /* This is wrong, but I will ignore it... */ if (verbose) - (void) fprintf(el->el_errfile, - "echotc: Warning: Too many required arguments (%d).\n", + (void) fprintf(el->el_errfile, + "echotc: Warning: Too many required arguments (%d).\n", arg_need); /*FALLTHROUGH*/ case 2: argv++; if (!*argv || *argv[0] == '\0') { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Missing argument.\n"); return -1; } @@ -1438,7 +1438,7 @@ term_echotc(el, argc, argv) argv++; if (!*argv || *argv[0] == '\0') { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Missing argument.\n"); return -1; } @@ -1446,7 +1446,7 @@ term_echotc(el, argc, argv) argv++; if (*argv && *argv[0]) { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Extra argument `%s'.\n", *argv); return -1; } diff --git a/lib/libedit/term.h b/lib/libedit/term.h index 416e73ee8faa..26da7c30d43c 100644 --- a/lib/libedit/term.h +++ b/lib/libedit/term.h @@ -92,7 +92,7 @@ protected int term_init __P((EditLine *)); protected void term_bind_arrow __P((EditLine *)); protected void term_print_arrow __P((EditLine *, char *)); protected int term_clear_arrow __P((EditLine *, char *)); -protected int term_set_arrow __P((EditLine *, char *, +protected int term_set_arrow __P((EditLine *, char *, key_value_t *, int)); protected void term_end __P((EditLine *)); protected int term_set __P((EditLine *, char *)); diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c index 41095fa980f6..bbe847e2cab2 100644 --- a/lib/libedit/tokenizer.c +++ b/lib/libedit/tokenizer.c @@ -155,7 +155,7 @@ tok_end(tok) * 3: Quoted return * 2: Unmatched double quote * 1: Unmatched single quote - * 0: Ok + * 0: Ok */ public int tok_line(tok, line, argc, argv) @@ -225,7 +225,7 @@ tok_line(tok, line, argc, argv) *tok->wptr++ = *ptr; break; - default: + default: return(-1); } break; @@ -242,7 +242,7 @@ tok_line(tok, line, argc, argv) tok->quote = Q_doubleone;/* Quote next character */ break; - case Q_one: + case Q_one: *tok->wptr++ = *ptr; tok->quote = Q_none; /* Quote this, restore state */ break; @@ -274,7 +274,7 @@ tok_line(tok, line, argc, argv) case Q_double: *tok->wptr++ = *ptr; /* Add the return */ break; - + case Q_doubleone: tok->flags |= TOK_EAT; tok->quote = Q_double; /* Back to double, eat the '\n' */ @@ -377,7 +377,7 @@ tok_line(tok, line, argc, argv) if (tok->argc >= tok->amax - 4) { tok->amax += AINCR; - tok->argv = (char **) tok_realloc(tok->argv, + tok->argv = (char **) tok_realloc(tok->argv, tok->amax * sizeof(char*)); } diff --git a/lib/libedit/tokenizer.h b/lib/libedit/tokenizer.h index d495dc69ab02..86911e15d5f3 100644 --- a/lib/libedit/tokenizer.h +++ b/lib/libedit/tokenizer.h @@ -47,7 +47,7 @@ typedef struct tokenizer Tokenizer; Tokenizer *tok_init __P((const char *)); void tok_reset __P((Tokenizer *)); void tok_end __P((Tokenizer *)); -int tok_line __P((Tokenizer *, const char *, +int tok_line __P((Tokenizer *, const char *, int *, char ***)); #endif /* _h_tokenizer */ diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c index ac99843b7746..6fdf5ea4491d 100644 --- a/lib/libedit/tty.c +++ b/lib/libedit/tty.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint && not SCCSID */ -/* +/* * tty.c: tty interface stuff */ #include "sys.h" @@ -57,7 +57,7 @@ typedef struct ttymap_t { } ttymap_t; -private ttyperm_t ttyperm = { +private ttyperm_t ttyperm = { { { "iflag:", ICRNL, (INLCR|IGNCR) }, { "oflag:", (OPOST|ONLCR), ONLRET }, @@ -87,8 +87,8 @@ private ttyperm_t ttyperm = { private ttychar_t ttychar = { { - CINTR, CQUIT, CERASE, CKILL, - CEOF, CEOL, CEOL2, CSWTCH, + CINTR, CQUIT, CERASE, CKILL, + CEOF, CEOL, CEOL2, CSWTCH, CDSWTCH, CERASE2, CSTART, CSTOP, CWERASE, CSUSP, CDSUSP, CREPRINT, CDISCARD, CLNEXT, CSTATUS, CPAGE, @@ -96,15 +96,15 @@ private ttychar_t ttychar = { CTIME }, { - CINTR, CQUIT, CERASE, CKILL, - _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, - _POSIX_VDISABLE, CERASE2, CSTART, CSTOP, - _POSIX_VDISABLE, CSUSP, _POSIX_VDISABLE, _POSIX_VDISABLE, - CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, + CINTR, CQUIT, CERASE, CKILL, + _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, + _POSIX_VDISABLE, CERASE2, CSTART, CSTOP, + _POSIX_VDISABLE, CSUSP, _POSIX_VDISABLE, _POSIX_VDISABLE, + CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, 1, 0 }, - { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -117,38 +117,38 @@ private ttychar_t ttychar = { private ttymap_t tty_map[] = { #ifdef VERASE - { C_ERASE, VERASE, + { C_ERASE, VERASE, { ED_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR } }, #endif /* VERASE */ #ifdef VERASE2 - { C_ERASE2, VERASE2, + { C_ERASE2, VERASE2, { ED_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR } }, #endif /* VERASE2 */ #ifdef VKILL - { C_KILL, VKILL, + { C_KILL, VKILL, { EM_KILL_LINE, VI_KILL_LINE_PREV, ED_UNASSIGNED } }, #endif /* VKILL */ #ifdef VKILL2 - { C_KILL2, VKILL2, + { C_KILL2, VKILL2, { EM_KILL_LINE, VI_KILL_LINE_PREV, ED_UNASSIGNED } }, #endif /* VKILL2 */ #ifdef VEOF - { C_EOF, VEOF, + { C_EOF, VEOF, { EM_DELETE_OR_LIST, VI_LIST_OR_EOF, ED_UNASSIGNED } }, #endif /* VEOF */ #ifdef VWERASE - { C_WERASE, VWERASE, + { C_WERASE, VWERASE, { ED_DELETE_PREV_WORD, ED_DELETE_PREV_WORD, ED_PREV_WORD } }, #endif /* VWERASE */ #ifdef VREPRINT - { C_REPRINT, VREPRINT, + { C_REPRINT, VREPRINT, { ED_REDISPLAY, ED_INSERT, ED_REDISPLAY } }, #endif /* VREPRINT */ #ifdef VLNEXT - { C_LNEXT, VLNEXT, + { C_LNEXT, VLNEXT, { ED_QUOTED_INSERT, ED_QUOTED_INSERT, ED_UNASSIGNED } }, #endif /* VLNEXT */ - { -1, -1, + { -1, -1, { ED_UNASSIGNED, ED_UNASSIGNED, ED_UNASSIGNED } } }; @@ -359,7 +359,7 @@ private ttymodes_t ttymodes[] = { { "extproc",EXTPROC, M_LIN }, # endif /* EXTPROC */ -# if defined(VINTR) +# if defined(VINTR) { "intr", C_SH(C_INTR), M_CHAR }, # endif /* VINTR */ # if defined(VQUIT) @@ -422,7 +422,7 @@ private ttymodes_t ttymodes[] = { # if defined(VPGOFF) { "pgoff", C_SH(C_PGOFF), M_CHAR }, # endif /* VPGOFF */ -# if defined(VKILL2) +# if defined(VKILL2) { "kill2", C_SH(C_KILL2), M_CHAR }, # endif /* VKILL2 */ # if defined(VBRK) @@ -440,7 +440,7 @@ private ttymodes_t ttymodes[] = { #define tty_getty(el, td) tcgetattr((el)->el_infd, (td)) -#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td)) +#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td)) #define tty__gettabs(td) ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1) #define tty__geteightbit(td) (((td)->c_cflag & CSIZE) == CS8) @@ -457,14 +457,14 @@ private int tty_setup __P((EditLine *)); /* tty_setup(): * Get the tty parameters and initialize the editing state */ -private int +private int tty_setup(el) EditLine *el; { int rst = 1; if (tty_getty(el, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "tty_setup: tty_getty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return(-1); @@ -509,7 +509,7 @@ tty_setup(el) tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]); if (tty_setty(el, &el->el_tty.t_ex) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "tty_setup: tty_setty: %s\n", + (void) fprintf(el->el_errfile, "tty_setup: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return(-1); @@ -580,7 +580,7 @@ private void tty__getchar(td, s) struct termios *td; unsigned char *s; -{ +{ # ifdef VINTR s[C_INTR] = td->c_cc[VINTR]; # endif /* VINTR */ @@ -663,7 +663,7 @@ private void tty__setchar(td, s) struct termios *td; unsigned char *s; -{ +{ # ifdef VINTR td->c_cc[VINTR] = s[C_INTR]; # endif /* VINTR */ @@ -810,7 +810,7 @@ tty_rawmode(el) el->el_tty.t_eight = tty__geteightbit(&el->el_tty.t_ts); el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ts); - if (tty__getspeed(&el->el_tty.t_ex) != el->el_tty.t_speed || + if (tty__getspeed(&el->el_tty.t_ex) != el->el_tty.t_speed || tty__getspeed(&el->el_tty.t_ed) != el->el_tty.t_speed) { (void) cfsetispeed(&el->el_tty.t_ex, el->el_tty.t_speed); (void) cfsetospeed(&el->el_tty.t_ex, el->el_tty.t_speed); @@ -819,7 +819,7 @@ tty_rawmode(el) } if (tty__cooked_mode(&el->el_tty.t_ts)) { - if (el->el_tty.t_ts.c_cflag != el->el_tty.t_ex.c_cflag) { + if (el->el_tty.t_ts.c_cflag != el->el_tty.t_ex.c_cflag) { el->el_tty.t_ex.c_cflag = el->el_tty.t_ts.c_cflag; el->el_tty.t_ex.c_cflag &= ~el->el_tty.t_t[EX_IO][M_CTL].t_clrmask; el->el_tty.t_ex.c_cflag |= el->el_tty.t_t[EX_IO][M_CTL].t_setmask; @@ -862,9 +862,9 @@ tty_rawmode(el) el->el_tty.t_ed.c_oflag |= el->el_tty.t_t[ED_IO][M_OUT].t_setmask; } - if (tty__gettabs(&el->el_tty.t_ex) == 0) + if (tty__gettabs(&el->el_tty.t_ex) == 0) el->el_tty.t_tabs = 0; - else + else el->el_tty.t_tabs = EL_CAN_TAB ? 1 : 0; { @@ -879,7 +879,7 @@ tty_rawmode(el) for (i = 0; i < C_NCC; i++) if (el->el_tty.t_c[TS_IO][i] != el->el_tty.t_c[EX_IO][i]) break; - + if (i != C_NCC) { /* * Propagate changes only to the unprotected chars @@ -910,7 +910,7 @@ tty_rawmode(el) if (tty_setty(el, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n", + (void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return -1; @@ -932,7 +932,7 @@ tty_cookedmode(el) if (tty_setty(el, &el->el_tty.t_ex) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "tty_cookedmode: tty_setty: %s\n", + (void) fprintf(el->el_errfile, "tty_cookedmode: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return -1; @@ -968,7 +968,7 @@ tty_quotemode(el) if (tty_setty(el, &el->el_tty.t_qu) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n", + (void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return -1; @@ -989,7 +989,7 @@ tty_noquotemode(el) return 0; if (tty_setty(el, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n", + (void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return -1; @@ -1019,7 +1019,7 @@ tty_stty(el, argc, argv) return -1; name = *argv++; - while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0') + while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0') switch (argv[0][1]) { case 'a': aflag++; @@ -1048,7 +1048,7 @@ tty_stty(el, argc, argv) int len = 0, st = 0, cu; for (m = ttymodes; m->m_name; m++) { if (m->m_type != i) { - (void) fprintf(el->el_outfile, "%s%s", i != -1 ? "\n" : "", + (void) fprintf(el->el_outfile, "%s%s", i != -1 ? "\n" : "", el->el_tty.t_t[z][m->m_type].t_name); i = m->m_type; st = len = strlen(el->el_tty.t_t[z][m->m_type].t_name); @@ -1065,7 +1065,7 @@ tty_stty(el, argc, argv) (void) fprintf(el->el_outfile, "\n%*s", st, ""); len = st + cu; } - else + else len += cu; if (x != '\0') @@ -1131,7 +1131,7 @@ tty_printchar(el, s) int i; for (i = 0; i < C_NCC; i++) { - for (m = el->el_tty.t_t; m->m_name; m++) + for (m = el->el_tty.t_t; m->m_name; m++) if (m->m_type == M_CHAR && C_SH(i) == m->m_value) break; if (m->m_name) @@ -1139,6 +1139,6 @@ tty_printchar(el, s) if (i % 5 == 0) (void) fprintf(el->el_errfile, "\n"); } - (void) fprintf(el->el_errfile, "\n"); + (void) fprintf(el->el_errfile, "\n"); } #endif /* notyet */ diff --git a/lib/libedit/tty.h b/lib/libedit/tty.h index 12da50dcb5bd..14ba10911a0d 100644 --- a/lib/libedit/tty.h +++ b/lib/libedit/tty.h @@ -46,7 +46,7 @@ #include <termios.h> /* Define our own since everyone gets it wrong! */ -#define CONTROL(A) ((A) & 037) +#define CONTROL(A) ((A) & 037) /* * Aix compatible names @@ -444,7 +444,7 @@ #define M_CHAR 4 #define M_NN 5 -typedef struct { +typedef struct { char *t_name; int t_setmask; int t_clrmask; diff --git a/lib/libedit/vi.c b/lib/libedit/vi.c index 030ee2286b0d..1a467809dd88 100644 --- a/lib/libedit/vi.c +++ b/lib/libedit/vi.c @@ -59,7 +59,7 @@ cv_action(el, c) if (el->el_chared.c_vcmd.action & DELETE) { el->el_chared.c_vcmd.action = NOP; el->el_chared.c_vcmd.pos = 0; - + el->el_chared.c_undo.isize = 0; el->el_chared.c_undo.dsize = 0; kp = el->el_chared.c_undo.buf; @@ -67,14 +67,14 @@ cv_action(el, c) *kp++ = *cp; el->el_chared.c_undo.dsize++; } - + el->el_chared.c_undo.action = INSERT; el->el_chared.c_undo.ptr = el->el_line.buffer; el->el_line.lastchar = el->el_line.buffer; el->el_line.cursor = el->el_line.buffer; if (c & INSERT) el->el_map.current = el->el_map.key; - + return CC_REFRESH; } @@ -111,7 +111,7 @@ cv_paste(el, c) char *ptr; c_undo_t *un = &el->el_chared.c_undo; #ifdef DEBUG_PASTE - (void) fprintf(el->el_errfile, "Paste: %x \"%s\" +%d -%d\n", + (void) fprintf(el->el_errfile, "Paste: %x \"%s\" +%d -%d\n", un->action, un->buf, un->isize, un->dsize); #endif if (un->isize == 0) @@ -120,7 +120,7 @@ cv_paste(el, c) if (!c && el->el_line.cursor < el->el_line.lastchar) el->el_line.cursor++; ptr = el->el_line.cursor; - + c_insert(el, un->isize); if (el->el_line.cursor + un->isize > el->el_line.lastchar) return CC_ERROR; @@ -129,7 +129,7 @@ cv_paste(el, c) } -/* vi_paste_next(): +/* vi_paste_next(): * Vi paste previous deletion to the right of the cursor * [p] */ @@ -143,7 +143,7 @@ vi_paste_next(el, c) } -/* vi_paste_prev(): +/* vi_paste_prev(): * Vi paste previous deletion to the left of the cursor * [P] */ @@ -157,7 +157,7 @@ vi_paste_prev(el, c) } -/* vi_prev_space_word(): +/* vi_prev_space_word(): * Vi move to the previous space delimited word * [B] */ @@ -170,10 +170,10 @@ vi_prev_space_word(el, c) if (el->el_line.cursor == el->el_line.buffer) return CC_ERROR; - el->el_line.cursor = cv_prev_word(el, el->el_line.cursor, - el->el_line.buffer, - el->el_state.argument, - cv__isword); + el->el_line.cursor = cv_prev_word(el, el->el_line.cursor, + el->el_line.buffer, + el->el_state.argument, + cv__isword); if (el->el_chared.c_vcmd.action & DELETE) { cv_delfini(el); @@ -184,7 +184,7 @@ vi_prev_space_word(el, c) } -/* vi_prev_word(): +/* vi_prev_word(): * Vi move to the previous word * [B] */ @@ -197,10 +197,10 @@ vi_prev_word(el, c) if (el->el_line.cursor == el->el_line.buffer) return CC_ERROR; - el->el_line.cursor = cv_prev_word(el, el->el_line.cursor, - el->el_line.buffer, - el->el_state.argument, - ce__isword); + el->el_line.cursor = cv_prev_word(el, el->el_line.cursor, + el->el_line.buffer, + el->el_state.argument, + ce__isword); if (el->el_chared.c_vcmd.action & DELETE) { cv_delfini(el); @@ -211,7 +211,7 @@ vi_prev_word(el, c) } -/* vi_next_space_word(): +/* vi_next_space_word(): * Vi move to the next space delimited word * [W] */ @@ -224,9 +224,9 @@ vi_next_space_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - el->el_line.cursor = cv_next_word(el, el->el_line.cursor, - el->el_line.lastchar, - el->el_state.argument, + el->el_line.cursor = cv_next_word(el, el->el_line.cursor, + el->el_line.lastchar, + el->el_state.argument, cv__isword); if (el->el_map.type == MAP_VI) @@ -238,7 +238,7 @@ vi_next_space_word(el, c) return CC_CURSOR; } -/* vi_next_word(): +/* vi_next_word(): * Vi move to the next word * [w] */ @@ -251,8 +251,8 @@ vi_next_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - el->el_line.cursor = cv_next_word(el, el->el_line.cursor, - el->el_line.lastchar, + el->el_line.cursor = cv_next_word(el, el->el_line.cursor, + el->el_line.lastchar, el->el_state.argument, ce__isword); @@ -267,7 +267,7 @@ vi_next_word(el, c) -/* vi_change_case(): +/* vi_change_case(): * Vi change case of character under the cursor and advance one character * [~] */ @@ -291,7 +291,7 @@ vi_change_case(el, c) } -/* vi_change_meta(): +/* vi_change_meta(): * Vi change prefix command * [c] */ @@ -309,7 +309,7 @@ vi_change_meta(el, c) } -/* vi_insert_at_bol(): +/* vi_insert_at_bol(): * Vi enter insert mode at the beginning of line * [I] */ @@ -330,7 +330,7 @@ vi_insert_at_bol(el, c) } -/* vi_replace_char(): +/* vi_replace_char(): * Vi replace character under the cursor with the next character typed * [r] */ @@ -350,7 +350,7 @@ vi_replace_char(el, c) } -/* vi_replace_mode(): +/* vi_replace_mode(): * Vi enter replace mode * [R] */ @@ -370,7 +370,7 @@ vi_replace_mode(el, c) } -/* vi_substitute_char(): +/* vi_substitute_char(): * Vi replace character under the cursor and enter insert mode * [r] */ @@ -386,7 +386,7 @@ vi_substitute_char(el, c) } -/* vi_substitute_line(): +/* vi_substitute_line(): * Vi substitute entire line * [S] */ @@ -402,7 +402,7 @@ vi_substitute_line(el, c) } -/* vi_change_to_eol(): +/* vi_change_to_eol(): * Vi change to end of line * [C] */ @@ -439,7 +439,7 @@ vi_insert(el, c) /* vi_add(): - * Vi enter insert mode after the cursor + * Vi enter insert mode after the cursor * [a] */ protected el_action_t @@ -481,7 +481,7 @@ vi_add_at_eol(el, c) el->el_line.cursor = el->el_line.lastchar; /* Mark where insertion begins */ - el->el_chared.c_vcmd.ins = el->el_line.lastchar; + el->el_chared.c_vcmd.ins = el->el_line.lastchar; el->el_chared.c_undo.ptr = el->el_line.lastchar; el->el_chared.c_undo.action = DELETE; return CC_CURSOR; @@ -489,7 +489,7 @@ vi_add_at_eol(el, c) /* vi_delete_meta(): - * Vi delete prefix command + * Vi delete prefix command * [d] */ protected el_action_t @@ -503,8 +503,8 @@ vi_delete_meta(el, c) /* vi_end_word(): - * Vi move to the end of the current space delimited word - * [E] + * Vi move to the end of the current space delimited word + * [E] */ protected el_action_t /*ARGSUSED*/ @@ -515,7 +515,7 @@ vi_end_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - el->el_line.cursor = cv__endword(el->el_line.cursor, el->el_line.lastchar, + el->el_line.cursor = cv__endword(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument); if (el->el_chared.c_vcmd.action & DELETE) { @@ -541,7 +541,7 @@ vi_to_end_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - el->el_line.cursor = cv__endword(el->el_line.cursor, el->el_line.lastchar, + el->el_line.cursor = cv__endword(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument); if (el->el_chared.c_vcmd.action & DELETE) { @@ -570,12 +570,12 @@ vi_undo(el, c) c_undo_t *un = &el->el_chared.c_undo; #ifdef DEBUG_UNDO - (void) fprintf(el->el_errfile, "Undo: %x \"%s\" +%d -%d\n", + (void) fprintf(el->el_errfile, "Undo: %x \"%s\" +%d -%d\n", un->action, un->buf, un->isize, un->dsize); #endif switch (un->action) { case DELETE: - if (un->dsize == 0) + if (un->dsize == 0) return CC_NORM; (void) memcpy(un->buf, un->ptr, un->dsize); @@ -584,7 +584,7 @@ vi_undo(el, c) el->el_line.lastchar -= un->dsize; el->el_line.cursor = un->ptr; - + un->action = INSERT; un->isize = un->dsize; un->dsize = 0; @@ -592,9 +592,9 @@ vi_undo(el, c) case DELETE|INSERT: size = un->isize - un->dsize; - if (size > 0) + if (size > 0) i = un->dsize; - else + else i = un->isize; cp = un->ptr; kp = un->buf; @@ -627,7 +627,7 @@ vi_undo(el, c) break; case INSERT: - if (un->isize == 0) + if (un->isize == 0) return CC_NORM; el->el_line.cursor = un->ptr; @@ -639,11 +639,11 @@ vi_undo(el, c) break; case CHANGE: - if (un->isize == 0) + if (un->isize == 0) return CC_NORM; el->el_line.cursor = un->ptr; - size = (int) (el->el_line.cursor - el->el_line.lastchar); + size = (int) (el->el_line.cursor - el->el_line.lastchar); if (size < un->isize) size = un->isize; cp = un->ptr; @@ -677,7 +677,7 @@ vi_command_mode(el, c) int size; /* [Esc] cancels pending action */ el->el_chared.c_vcmd.ins = 0; - el->el_chared.c_vcmd.action = NOP; + el->el_chared.c_vcmd.action = NOP; el->el_chared.c_vcmd.pos = 0; el->el_state.doingarg = 0; @@ -700,7 +700,7 @@ vi_command_mode(el, c) } /* vi_zero(): - * Vi move to the beginning of line + * Vi move to the beginning of line * [0] */ protected el_action_t @@ -711,7 +711,7 @@ vi_zero(el, c) if (el->el_state.doingarg) { if (el->el_state.argument > 1000000) return CC_ERROR; - el->el_state.argument = + el->el_state.argument = (el->el_state.argument * 10) + (c - '0'); return CC_ARGHACK; } @@ -727,23 +727,23 @@ vi_zero(el, c) /* vi_delete_prev_char(): - * Vi move to previous character (backspace) + * Vi move to previous character (backspace) * [^H] - */ + */ protected el_action_t /*ARGSUSED*/ vi_delete_prev_char(el, c) EditLine *el; int c; { - if (el->el_chared.c_vcmd.ins == 0) + if (el->el_chared.c_vcmd.ins == 0) return CC_ERROR; - if (el->el_chared.c_vcmd.ins > + if (el->el_chared.c_vcmd.ins > el->el_line.cursor - el->el_state.argument) return CC_ERROR; - c_delbefore(el, el->el_state.argument); + c_delbefore(el, el->el_state.argument); el->el_line.cursor -= el->el_state.argument; return CC_REFRESH; @@ -761,7 +761,7 @@ vi_list_or_eof(el, c) int c; { #ifdef notyet - if (el->el_line.cursor == el->el_line.lastchar && + if (el->el_line.cursor == el->el_line.lastchar && el->el_line.cursor == el->el_line.buffer) { #endif term_overwrite(el, STReof, 4); /* then do a EOF */ @@ -779,7 +779,7 @@ vi_list_or_eof(el, c) /* vi_kill_line_prev(): - * Vi cut from beginning of line to cursor + * Vi cut from beginning of line to cursor * [^U] */ protected el_action_t @@ -839,7 +839,7 @@ vi_repeat_search_next(el, c) EditLine *el; int c; { - if (el->el_search.patlen == 0) + if (el->el_search.patlen == 0) return CC_ERROR; else return cv_repeat_srch(el, el->el_search.patdir); @@ -856,10 +856,10 @@ vi_repeat_search_prev(el, c) EditLine *el; int c; { - if (el->el_search.patlen == 0) + if (el->el_search.patlen == 0) return CC_ERROR; else - return cv_repeat_srch(el, + return cv_repeat_srch(el, el->el_search.patdir == ED_SEARCH_PREV_HISTORY ? ED_SEARCH_NEXT_HISTORY : ED_SEARCH_PREV_HISTORY); } @@ -961,8 +961,8 @@ vi_repeat_next_char(el, c) if (el->el_search.chacha == 0) return CC_ERROR; - return el->el_search.chadir == CHAR_FWD ? - cv_csearch_fwd(el, el->el_search.chacha, el->el_state.argument, 0) : + return el->el_search.chadir == CHAR_FWD ? + cv_csearch_fwd(el, el->el_search.chacha, el->el_state.argument, 0) : cv_csearch_back(el, el->el_search.chacha, el->el_state.argument, 0); } @@ -980,7 +980,7 @@ vi_repeat_prev_char(el, c) if (el->el_search.chacha == 0) return CC_ERROR; - return el->el_search.chadir == CHAR_BACK ? - cv_csearch_fwd(el, el->el_search.chacha, el->el_state.argument, 0) : + return el->el_search.chadir == CHAR_BACK ? + cv_csearch_fwd(el, el->el_search.chacha, el->el_state.argument, 0) : cv_csearch_back(el, el->el_search.chacha, el->el_state.argument, 0); } diff --git a/lib/libf2c/Makefile b/lib/libf2c/Makefile index 9baa64df20f6..63ad8082fe94 100644 --- a/lib/libf2c/Makefile +++ b/lib/libf2c/Makefile @@ -22,7 +22,7 @@ INT = i_abs.c i_dim.c i_dnnt.c i_indx.c i_len.c i_mod.c i_nint.c i_sign.c HALF = h_abs.c h_dim.c h_dnnt.c h_indx.c h_len.c h_mod.c h_nint.c h_sign.c CMP = l_ge.c l_gt.c l_le.c l_lt.c hl_ge.c hl_gt.c hl_le.c hl_lt.c EFL = ef1asc_.c ef1cmc_.c -CHAR = s_cat.c s_cmp.c s_copy.c +CHAR = s_cat.c s_cmp.c s_copy.c F77SRCS= $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) \ $(HALF) $(CMP) $(EFL) $(CHAR) diff --git a/lib/libforms/bindings.c b/lib/libforms/bindings.c index d568da548800..947b5ee47bdd 100644 --- a/lib/libforms/bindings.c +++ b/lib/libforms/bindings.c @@ -6,8 +6,8 @@ * 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, - * verbatim and that no modifications are made prior to this + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the diff --git a/lib/libforms/examples/example.c b/lib/libforms/examples/example.c index b08a4ea6e1f3..131ee04cb572 100644 --- a/lib/libforms/examples/example.c +++ b/lib/libforms/examples/example.c @@ -6,8 +6,8 @@ * 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, - * verbatim and that no modifications are made prior to this + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the diff --git a/lib/libforms/forms.c b/lib/libforms/forms.c index 575608fd08a0..2c2a87a21754 100644 --- a/lib/libforms/forms.c +++ b/lib/libforms/forms.c @@ -6,8 +6,8 @@ * 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, - * verbatim and that no modifications are made prior to this + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the @@ -65,7 +65,7 @@ struct intbind { struct intbind internal_bindings[] = { {"draw_box", &draw_box}, {"draw_shadow", &draw_shadow} -}; +}; /* Bind the internal function addresses */ diff --git a/lib/libforms/forms.h b/lib/libforms/forms.h index ceac28760690..d5bd723cf537 100644 --- a/lib/libforms/forms.h +++ b/lib/libforms/forms.h @@ -6,8 +6,8 @@ * 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, - * verbatim and that no modifications are made prior to this + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the diff --git a/lib/libforms/internal.h b/lib/libforms/internal.h index ba38601f7b0f..e7c5b274c13d 100644 --- a/lib/libforms/internal.h +++ b/lib/libforms/internal.h @@ -6,8 +6,8 @@ * 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, - * verbatim and that no modifications are made prior to this + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the diff --git a/lib/libforms/ncurses.c b/lib/libforms/ncurses.c index 5db4dd1182df..87ec478f89d1 100644 --- a/lib/libforms/ncurses.c +++ b/lib/libforms/ncurses.c @@ -6,8 +6,8 @@ * 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, - * verbatim and that no modifications are made prior to this + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the @@ -147,7 +147,7 @@ ncurses_parse_attrs(OBJECT *object, char *string) AttrType attr_type; int len, y, x; int skip = 0; - + if ((!string) || (*string != '\\')) return (0); @@ -155,7 +155,7 @@ ncurses_parse_attrs(OBJECT *object, char *string) if (*(string + inc) == '\\') return (skip); - while ((!isspace(*(string + inc))) + while ((!isspace(*(string + inc))) && (*(string+inc) != '\\') && (*(string + inc) != '\0')) inc++; @@ -201,7 +201,7 @@ ncurses_parse_attrs(OBJECT *object, char *string) break; } - + skip += inc; string += inc; inc = 0; @@ -245,7 +245,7 @@ ncurses_print_string(OBJECT *object, char *string) } } return (OK); -} +} void ncurses_display_object(OBJECT *object) @@ -554,7 +554,7 @@ ncurses_process_input(OBJECT *object) --cursor; } } - } else if ((isprint(ch)) && (len < object->object.input->limit)){ + } else if ((isprint(ch)) && (len < object->object.input->limit)){ bcopy(object->object.input->input+abspos, object->object.input->input+abspos+1, len-abspos+1); object->object.input->input[abspos++] = ch; @@ -563,7 +563,7 @@ ncurses_process_input(OBJECT *object) ++disp_off; --cursor; } - } else + } else beep(); ncurses_print_string(object, object->object.input->input+disp_off); } diff --git a/lib/libforms/objects.c b/lib/libforms/objects.c index 335e4adbe362..0a51caeda958 100644 --- a/lib/libforms/objects.c +++ b/lib/libforms/objects.c @@ -6,8 +6,8 @@ * 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, - * verbatim and that no modifications are made prior to this + * notice, this list of conditions and the following disclaimer, + * verbatim and that no modifications are made prior to this * point in the file. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the @@ -116,13 +116,13 @@ __inline void clone_object(OBJECT *object, OBJECT *def) { int i; - + /* XXX - Should really check if strdup's succeed */ object->type = def->type; object->status = def->status; object->parent = def->parent; - /* + /* * Only copy sizes for fixed size objects, * otherwise inherit from parent. Always * inherit x and y. @@ -188,7 +188,7 @@ clone_object(OBJECT *object, OBJECT *def) if (!object->object.function) errx(-1, "Failed to allocate memory for copy of function object"); object->object.function->fn = strdup(def->object.function->fn); - break; + break; case OT_INPUT: object->object.input = malloc(sizeof (INPUT_OBJECT)); if (!object->object.input) @@ -204,7 +204,7 @@ clone_object(OBJECT *object, OBJECT *def) errx(-1, "Failed to allocate memory for copy of menu object"); object->object.menu->selected = def->object.menu->selected; for (i=0; i < def->object.menu->no_options; i++) { - object->object.menu->no_options = + object->object.menu->no_options = add_menu_option(object->object.menu, def->object.menu->options[i]); if (!object->object.menu->no_options) @@ -256,7 +256,7 @@ copy_bound_objects(char *key, void *data, void *arg) int use_defined_object(OBJECT *object, char *src) -{ +{ TUPLE *tuple; OBJECT *def; @@ -271,7 +271,7 @@ use_defined_object(OBJECT *object, char *src) /* Now recursively clone sub-objects */ hash_traverse(def->bind, ©_bound_objects, object); -} +} /* diff --git a/lib/libftp/FtpAbort.c b/lib/libftp/FtpAbort.c index 98d72b8004a3..80943e52425a 100644 --- a/lib/libftp/FtpAbort.c +++ b/lib/libftp/FtpAbort.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -21,20 +21,20 @@ FtpAbort(FTP *ftp) fd_set fds; char msgc=IAC; String msg; - + FD_ZERO(&fds); FD_SET(fileno(FTPCMD(ftp)),&fds); - + FtpPutc(ftp, FTPCMD(ftp), IAC); FtpPutc(ftp, FTPCMD(ftp), IP); - + if ( send ( fileno(FTPCMD(ftp)), &msgc , 1 ,MSG_OOB) != 1 ) return EXIT(ftp,QUIT); - + FtpPutc(ftp, FTPCMD(ftp), DM); - + FtpSendMessage(ftp,"ABOR"); - + while (select ( getdtablesize(), &fds, 0,0, &(ftp->timeout) )>0) { FtpGetMessage(ftp,msg); diff --git a/lib/libftp/FtpArchie.c b/lib/libftp/FtpArchie.c index 7f039be06890..22a05e1745f9 100644 --- a/lib/libftp/FtpArchie.c +++ b/lib/libftp/FtpArchie.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -21,18 +21,18 @@ int FtpArchie ( char *what, ARCHIE *result, int len) FILE *archie; String cmd,tmp; int i; - + bzero(result,sizeof(result[0])*len); - + sprintf(cmd,"archie -l -m %d %s",len,what); - + if ((archie = popen(cmd,"r"))==NULL) return 0; for(i=0;i<len;i++) { char *p, *pp; - + if (fgets(tmp,sizeof (tmp), archie)==NULL) break; @@ -42,15 +42,15 @@ int FtpArchie ( char *what, ARCHIE *result, int len) result[i].createtime.tm_hour = C2I (tmp[6 ])*10 + C2I(tmp[7]); result[i].createtime.tm_min = C2I (tmp[8 ])*10 + C2I(tmp[9]); result[i].createtime.tm_sec = C2I (tmp[10])*10 + C2I(tmp[11]); - + for(p=tmp; *p!=' '; p++); for(; *p==' '; p++); - + result[i].size = atoi(p); for(; *p!=' '; p++); for(; *p==' '; p++); - + for (pp=result[i].host;*p!=' ';p++,pp++) *pp=*p; *pp=0; for(; *p==' '; p++); @@ -58,6 +58,6 @@ int FtpArchie ( char *what, ARCHIE *result, int len) *pp=0; } - + return i; } diff --git a/lib/libftp/FtpBye.c b/lib/libftp/FtpBye.c index f664cf6ddf5d..7094843ac0dc 100644 --- a/lib/libftp/FtpBye.c +++ b/lib/libftp/FtpBye.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -23,11 +23,11 @@ STATUS FtpBye(FTP *ftp) free(ftp); return 0; } - + STATUS FtpQuickBye(FTP *ftp) { if (ftp == NULL) return 0; - + if (FTPDATA(ftp)!=NULL) { shutdown(fileno(FTPDATA(ftp)),2); diff --git a/lib/libftp/FtpClose.c b/lib/libftp/FtpClose.c index 26dbc519c2ca..a14658e438db 100644 --- a/lib/libftp/FtpClose.c +++ b/lib/libftp/FtpClose.c @@ -1,9 +1,9 @@ /* Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. */ @@ -18,7 +18,7 @@ STATUS FtpClose(FTP *ftp) fflush(FTPDATA(ftp)); shutdown(fileno(FTPDATA(ftp)),2); fclose(FTPDATA(ftp)); - + FtpAssert(ftp,i=FtpGetMessage(ftp,S1)); if ( i != 226 ) return EXIT(ftp,-i); diff --git a/lib/libftp/FtpCommand.c b/lib/libftp/FtpCommand.c index 94e85949720e..25fd46060d35 100644 --- a/lib/libftp/FtpCommand.c +++ b/lib/libftp/FtpCommand.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -24,7 +24,7 @@ STATUS FtpCommand(va_alist) va_list args; String S1; int i,counter=0; - + va_start(args); con = va_arg(args,FTP *); @@ -41,21 +41,21 @@ STATUS FtpCommand(va_alist) } va_end(args); - - + + sprintf(S1,command,param); if ( FtpSendMessage(con,S1) == QUIT ) return EXIT(con,QUIT); - + if ( (i=FtpGetMessage(con,S1)) == QUIT ) return EXIT(con,QUIT); - + if ( ! FtpGood1 ( i , Answer )) return EXIT(con,-i); return EXIT(con,i); } - - - + + + diff --git a/lib/libftp/FtpConnect.c b/lib/libftp/FtpConnect.c index e114a50395bb..4de95ab04c5d 100644 --- a/lib/libftp/FtpConnect.c +++ b/lib/libftp/FtpConnect.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -22,22 +22,22 @@ STATUS FtpConnect(FTP **con,char * hostname) register int new_socket; String S1; STATUS x; - + *con = FtpCreateObject(); - + if ((host=FtpGetHost(hostname))==NULL) return EXIT((*con),QUIT); - + strcpy((*con) -> title,host -> h_name); /* Default title for FtpLog */ - + unit.sin_family = host -> h_addrtype; /* AF_INET */ - + bcopy(host-> h_addr_list[0],(char *)&unit.sin_addr,host->h_length); if ( ( new_socket = socket ( unit.sin_family , SOCK_STREAM , 0)) < 0) return EXIT((*con),QUIT); unit.sin_port = htons((*con)->port); - + while ( connect ( new_socket , (struct sockaddr *)&unit , sizeof unit ) < 0 ) { host -> h_addr_list ++; @@ -53,7 +53,7 @@ STATUS FtpConnect(FTP **con,char * hostname) return EXIT((*con),QUIT); } } - + FTPCMD(*con) = fdopen(new_socket,"r+"); if ( (x=FtpGetMessage(*con,S1)) == QUIT ) @@ -64,7 +64,7 @@ STATUS FtpConnect(FTP **con,char * hostname) return EXIT((*con),-x); } if ( (*con)->mode != 'A' ) FtpType(*con,(*con)->mode); - + return EXIT((*con),x); } diff --git a/lib/libftp/FtpCopy.c b/lib/libftp/FtpCopy.c index d09fd364c0d0..db582d2ab7d2 100644 --- a/lib/libftp/FtpCopy.c +++ b/lib/libftp/FtpCopy.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -21,19 +21,19 @@ STATUS FtpCopy (FTP * ftp1 , FTP * ftp2 ,char *in , char * out) if (!*out) out=in; - if ( FtpTestFlag(ftp1,FTP_REST) && FtpTestFlag(ftp2,FTP_REST) + if ( FtpTestFlag(ftp1,FTP_REST) && FtpTestFlag(ftp2,FTP_REST) && (size=FtpSize(ftp1,in))>0 && FtpCommand(ftp1,"REST 0",0,0,EOF)==350 && FtpCommand(ftp2,"REST 0",0,0,EOF)==350 ) ftp1->seek=ftp2->seek=size; else ftp1->seek=ftp2->seek=0; - + FtpAssert(ftp1,FtpData(ftp1,"RETR %s",in,"r")); FtpAssert(ftp2,FtpData(ftp2,"STOR %s",out,"w")); while ((size=FtpReadBlock(ftp1,buffer,FTPBUFSIZ))>0) { - if (FtpWriteBlock(ftp2,buffer,size)!=size) + if (FtpWriteBlock(ftp2,buffer,size)!=size) return EXIT(ftp2,QUIT); } diff --git a/lib/libftp/FtpData.c b/lib/libftp/FtpData.c index c1bbdb8d5576..066671f5243b 100644 --- a/lib/libftp/FtpData.c +++ b/lib/libftp/FtpData.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -26,17 +26,17 @@ STATUS FtpData(FTP * con,char * command , char * file ,char * mode) FREE(data); FREE(from); - + if ( gethostname( hostname , sizeof hostname ) == -1 ) return EXIT(con,QUIT); - + if ((host=(struct hostent *)gethostbyname(hostname))==0) return EXIT(con,QUIT); - + data.sin_family = host -> h_addrtype; - + bcopy(host-> h_addr_list[0],(char *)&data.sin_addr,host->h_length); - + if ((NewSocket = socket ( AF_INET , SOCK_STREAM , 0 ))<0) return EXIT(con,QUIT); @@ -54,7 +54,7 @@ STATUS FtpData(FTP * con,char * command , char * file ,char * mode) if ( getsockname ( NewSocket , (struct sockaddr *)&data , &len ) < 0 ) return EXIT(con,QUIT); - + if ( listen ( NewSocket , 1 ) < 0 ) return EXIT(con,QUIT); @@ -69,10 +69,10 @@ STATUS FtpData(FTP * con,char * command , char * file ,char * mode) if ((i = FtpCommand ( con, "REST %d" , con -> seek , 0, EOF)) != 350 ) return -i; } - - FtpAssert(con, FtpCommand ( con , command , file , + + FtpAssert(con, FtpCommand ( con , command , file , 200, 120 , 150 , 125 , 250 , EOF )); - + if (( Accepted_Socket = accept (NewSocket , (struct sockaddr *)&from , &fromlen )) < 0) { close(NewSocket); diff --git a/lib/libftp/FtpDebug.c b/lib/libftp/FtpDebug.c index 98686b90b38a..d2b5af92f751 100644 --- a/lib/libftp/FtpDebug.c +++ b/lib/libftp/FtpDebug.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -29,22 +29,22 @@ STATUS FtpDebugDebug(FTP *ftp,int n, char * Message) { String tmp; - + strcpy(tmp,Message); - + if (strncmp(tmp,"PASS ",5)==0) { char *p=tmp+5; while ( *p != '\0') *p++='*'; }; - + FtpLog(ftp->title,tmp); return 1; } STATUS FtpDebugError(FTP *ftp,int n, char * Message) { - + FtpLog("FtpDebugError",""); FtpLog(ftp->title,Message); if ( ! FtpTestFlag(ftp,FTP_NOEXIT)) @@ -74,7 +74,7 @@ STATUS FtpLog(char *name,char *str) int FtpHash(FTP *ftp, unsigned long chars) { - + if (chars==0) return ftp->counter=0; ftp->counter+=chars; fprintf(stdout,"%10u bytes transfered\r",(unsigned int)ftp->counter); @@ -88,7 +88,7 @@ STATUS FtpBadReply550(char *s) if( (strstr(s,"unreachable")!=NULL) || (strstr(s,"Broken pipe")!=NULL) - ) + ) return 0; return 1; } diff --git a/lib/libftp/FtpFilenameChecker.c b/lib/libftp/FtpFilenameChecker.c index 0d486c443bf9..99946eb99f6e 100644 --- a/lib/libftp/FtpFilenameChecker.c +++ b/lib/libftp/FtpFilenameChecker.c @@ -1,9 +1,9 @@ /* Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. */ @@ -13,12 +13,12 @@ Commercial usage is also possible with participation of it's author. static char * simplename(char *s) { char *p; - + if ( (p=(char *)strrchr(s,'/')) == NULL ) return s; return p+1; } - + diff --git a/lib/libftp/FtpFull.c b/lib/libftp/FtpFull.c index e2e6a56ae832..51c87dc0f8f0 100644 --- a/lib/libftp/FtpFull.c +++ b/lib/libftp/FtpFull.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -39,8 +39,8 @@ FILE * FtpFullOpen(char * file , char * mode ) switch(mode[0]) { - case 'r': - if (FtpError(FtpOpenRead(ftp,RemoteFile))) + case 'r': + if (FtpError(FtpOpenRead(ftp,RemoteFile))) return NULL; ftp_table[fileno(FTPDATA(ftp))] = ftp; return FTPDATA(ftp); @@ -80,16 +80,16 @@ STATUS FtpFullSyntax ( String source , { char *in,*out; String tmp; - + host[0] = user[0] = passwd[0] = file[0] = '\0'; - + for ( in=source, out = user; *in !='\0' && *in != '/' && *in!='@' && *in!=':' ; *out++ = *in++); *out = '\0'; - + if ( *in == '\0' ) return 0; - + if ( *in == ':' ) { strcpy(host,user); @@ -98,7 +98,7 @@ STATUS FtpFullSyntax ( String source , sprintf(passwd,"%s@%s", getpwuid(getuid())->pw_name,gethostbyname(tmp)->h_name); goto file; - } + } if ( *in == '/' ) { @@ -114,25 +114,25 @@ STATUS FtpFullSyntax ( String source , sprintf(passwd,"%s@%s", getpwuid(getuid())->pw_name,gethostbyname(tmp)->h_name); } - - + + for ( in++, out = host; *in !='\0' && *in!=':' ; *out++ = *in++); *out = '\0'; - + if ( *in == '\0' ) return 0; file: - + for ( in++, out = file; *in !='\0'; *out++ = *in++); *out = '\0'; - + return 1; } - + diff --git a/lib/libftp/FtpGetHost.c b/lib/libftp/FtpGetHost.c index 3dca113ab3d4..7171ba31e185 100644 --- a/lib/libftp/FtpGetHost.c +++ b/lib/libftp/FtpGetHost.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -37,7 +37,7 @@ struct hostent *FtpGetHost(char *host) _host.h_addrtype=AF_INET; return &_host; } - + return gethostbyname(host); } diff --git a/lib/libftp/FtpGood.c b/lib/libftp/FtpGood.c index e64959d6edd6..20af4e07a7e0 100644 --- a/lib/libftp/FtpGood.c +++ b/lib/libftp/FtpGood.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -22,11 +22,11 @@ STATUS FtpGood(va_alist) int Number; int Answer[MAX_ANSWERS]; int counter=0; - + va_start(args); Number = va_arg(args,int); - + while ( 1 ) { if (counter == MAX_ANSWERS) @@ -37,7 +37,7 @@ STATUS FtpGood(va_alist) } va_end(args); - + return FtpGood1(Number,Answer); } diff --git a/lib/libftp/FtpIO.c b/lib/libftp/FtpIO.c index ee701001d52c..b7f6af5dc6d1 100644 --- a/lib/libftp/FtpIO.c +++ b/lib/libftp/FtpIO.c @@ -1,9 +1,9 @@ /* Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the exist ing programs. Commercial usage is also possible with participation of it's author. @@ -18,23 +18,23 @@ Commercial usage is also possible with participation of it's author. int FtpRead(FTP *con) { int c; - + if ( con -> mode == 'I' ) return FtpGetc(con,FTPDATA(con)); - + if ( con->ch != EOF ) { c=con->ch; con->ch=EOF; return c; } - + c=FtpGetc(con,FTPDATA(con)); - + if ( c == Ctrl('M') ) { c = FtpGetc(con,FTPDATA(con)); - + if ( c == Ctrl('J') ) return '\n'; con->ch = c; @@ -45,20 +45,20 @@ int FtpRead(FTP *con) int FtpWrite(FTP *ftp,char c) { - + if ( ftp -> mode == 'I' || c != '\n' ) return FtpPutc(ftp,FTPDATA(ftp),c); - + FtpPutc(ftp,FTPDATA(ftp),Ctrl('M')); return FtpPutc(ftp,FTPDATA(ftp),Ctrl('J')); } - + int FtpGetc(FTP *ftp,FILE *fp) { fd_set fds; char c; - + FD_ZERO(&fds); FD_SET(fileno(fp),&fds); @@ -67,9 +67,9 @@ int FtpGetc(FTP *ftp,FILE *fp) if (read(fileno(fp),&c,1)<1) return EOF; - + if (ftp->hash!=NULL) (*ftp->hash)(ftp,1); - + return (int)c; } @@ -77,13 +77,13 @@ int FtpGetc(FTP *ftp,FILE *fp) STATUS FtpPutc(FTP *ftp,FILE *fp,char c) { fd_set fds; - + FD_ZERO(&fds); FD_SET(fileno(fp),&fds); - + if (select(getdtablesize(), 0, &fds, 0, &(ftp->timeout))<1) return EXIT(ftp,QUIT); - + if (write(fileno(fp),&c,1)!=1) return EXIT(ftp,QUIT); @@ -96,19 +96,19 @@ STATUS FtpReadBlock(FTP *ftp, char *buffer, int size) { fd_set fds; register int rsize; - + FD_ZERO(&fds); FD_SET(fileno(FTPDATA(ftp)),&fds); - + if (select(getdtablesize(), &fds,0, 0, &(ftp->timeout))<1) return EXIT(ftp,QUIT); - - + + if ((rsize=read(fileno(FTPDATA(ftp)),buffer,size))<0) return EXIT(ftp,QUIT); - + if (ftp->hash!=NULL && rsize!=0) (*ftp->hash)(ftp,rsize); - + if (ftp->mode == 'A') { char buffer2[size]; @@ -119,7 +119,7 @@ STATUS FtpReadBlock(FTP *ftp, char *buffer, int size) buffer2[ii]='\n',i++; else buffer2[ii]=buffer[i]; - + rsize=ii; bcopy(buffer2,buffer,rsize); } @@ -132,14 +132,14 @@ STATUS FtpWriteBlock(FTP *ftp, char *buffer, int size) fd_set fds; register int wsize; char buffer2[size*2]; - + FD_ZERO(&fds); FD_SET(fileno(FTPDATA(ftp)),&fds); - + if (select(getdtablesize(), 0, &fds, 0, &(ftp->timeout))<1) return EXIT(ftp,QUIT); - - + + if (ftp->mode=='A') { register int i,ii; @@ -152,17 +152,17 @@ STATUS FtpWriteBlock(FTP *ftp, char *buffer, int size) buffer=buffer2; size=ii; } - - if ((wsize=write(fileno(FTPDATA(ftp)),buffer,size))!=size) + + if ((wsize=write(fileno(FTPDATA(ftp)),buffer,size))!=size) return EXIT(ftp,QUIT); - + if ( ftp->hash!=NULL && wsize!=0 ) (*ftp->hash)(ftp,wsize); - + return wsize; } - + diff --git a/lib/libftp/FtpInit.c b/lib/libftp/FtpInit.c index 184f7fb8881c..4e43c8c0b39f 100644 --- a/lib/libftp/FtpInit.c +++ b/lib/libftp/FtpInit.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. diff --git a/lib/libftp/FtpLibrary.h b/lib/libftp/FtpLibrary.h index d834e3b1cd41..754e5a1517f8 100644 --- a/lib/libftp/FtpLibrary.h +++ b/lib/libftp/FtpLibrary.h @@ -2,16 +2,16 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. */ - + #ifndef __FTPLIBRARY_H #define __FTPLIBRARY_H @@ -43,20 +43,20 @@ extern int errno; /* Standard Macros & Definitions */ - - + + #define EXIT(con,e) \ ( con -> errno = e, \ ((e==QUIT||e==LQUIT)&&(con->IO != NULL))?(*(con->IO))(con,e,sys_errlist[errno]):0,\ ((con->error != NULL) && (e < 0) )?(*(con->error))(con,e,FtpMessage(e)):0,\ e) - - + + #define MAX_ANSWERS 10 /* Number of known goodest answers for reqest */ #define NFDS 64 #define FTPBUFSIZ BUFSIZ #define LQUIT (-6) -#define QUIT (-5) /* Few time ago QUIT character been +#define QUIT (-5) /* Few time ago QUIT character been equivalence to zero, changed for clear conflicts with reading functions */ #define Ctrl(x) ((x) - '@') @@ -90,28 +90,28 @@ typedef struct/* All structure initialize from edited struct FtpInit */ char mode; /* Binary, Ascii, ......... */ int errno; /* Last error code */ int ch; /* Help character for ascii streams */ - + STATUS (*error)(); STATUS (*debug)(); STATUS (*IO)(); STATUS (*hash)(); /* Call with reading/writing next "int" characters - from stream */ + from stream */ int seek; /* Warning! If server not supported REST-command, then seek variable automaticaly turn to zero */ - int flags; /* FTP_REST, + int flags; /* FTP_REST, FTP_NOEXIT */ struct timeval timeout; - /* How long must be waiting next character + /* How long must be waiting next character from server */ int port; String title; /* Using for FtpLog, FtpConnect lets hostname */ - unsigned long counter; + unsigned long counter; /* Using by FtpHash */ } FTP; -typedef struct +typedef struct { struct tm createtime; unsigned long size; @@ -136,7 +136,7 @@ extern FTP FtpInit; ((ftp)->timeout.tv_sec=tim,(ftp)->timeout.tv_usec=0) #define FtpSetPort(ftp,prt) ((ftp)->port=(prt)) -/* Connect & disconnect */ +/* Connect & disconnect */ STATUS FtpConnect(FTP **con,char *hostname); #define FtpUser(ftp,user) FtpCommand(ftp,"USER %s",user,230,331,332,EOF) @@ -207,7 +207,7 @@ int FtpNumber ( char * Message ); /* Debug */ #define FtpSetErrorHandler(con,f) (con)->error = f -#define FtpSetDebugHandler(con,f) (con)->debug = f +#define FtpSetDebugHandler(con,f) (con)->debug = f #define FtpSetIOHandler(con,f) (con)->IO =f #define FtpSetHashHandler(con,f) (con)->hash =f #define FtplibDebug(t) FtpDebug(&FtpInit) @@ -239,7 +239,7 @@ int FtpArchie(char *what, ARCHIE *, int number); #ifdef __cplusplus } #endif - + /* Additional definitions */ diff --git a/lib/libftp/FtpLogin.c b/lib/libftp/FtpLogin.c index 27e43ae60780..e066d5513c33 100644 --- a/lib/libftp/FtpLogin.c +++ b/lib/libftp/FtpLogin.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -14,10 +14,10 @@ Commercial usage is also possible with participation of it's author. #include "FtpLibrary.h" -STATUS FtpLogin ( FTP ** con, char * host , char * user , +STATUS FtpLogin ( FTP ** con, char * host , char * user , char * password , char * account) { - + FtpAssert((*con),FtpConnect(con,host)); FtpAssert((*con),FtpUser((*con),user)); if (((*con)->errno)==230 ) diff --git a/lib/libftp/FtpMessage.c b/lib/libftp/FtpMessage.c index 90106b14bc9c..8009d052cdaa 100644 --- a/lib/libftp/FtpMessage.c +++ b/lib/libftp/FtpMessage.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -26,28 +26,28 @@ INLINE static char *___gets(char *s, int maxchars, FTP *ftp) { if ((c = FtpGetc(ftp,FTPCMD(ftp))) == EOF) return NULL; - + if ( c == '\n' && *(p-1) == '\r' ) { p--; *p='\0'; return s; } - + if ( (p-s) > maxchars ) return NULL; - + *p++=(char)c; } } - - + + int FtpGetMessage(FTP *con , char * Message ) { int n; char tmp[1024]; - + while(1) { if (___gets(tmp,sizeof tmp,con)==NULL) @@ -60,7 +60,7 @@ int FtpGetMessage(FTP *con , char * Message ) (*con->debug)(con,0,tmp); } - strcpy(Message,tmp); + strcpy(Message,tmp); FtpInitMessageList(); FtpMessageList[n=FtpNumber(Message)] = ( char * ) malloc ( strlen(Message) + 1); @@ -74,10 +74,10 @@ int FtpGetMessage(FTP *con , char * Message ) STATUS FtpSendMessage(FTP *ftp,char * Message ) { char *msg=Message; - - while (*Message) + + while (*Message) FtpAssert(ftp,FtpPutc(ftp,FTPCMD(ftp),*Message++)); - + FtpAssert(ftp,FtpPutc(ftp,FTPCMD(ftp),'\015')); FtpAssert(ftp,FtpPutc(ftp,FTPCMD(ftp),'\012')); @@ -90,9 +90,9 @@ char *FtpMessage(int number) { extern int sys_nerr,errno; #ifndef __FreeBSD__ - extern char *sys_errlist[]; + extern char *sys_errlist[]; #endif - + FtpInitMessageList(); if ( number == 0 ) return (char *)sys_errlist[errno]; @@ -105,7 +105,7 @@ STATUS FtpInitMessageList() { int i; static u = 0; - + if ( u ) return 1; diff --git a/lib/libftp/FtpMove.c b/lib/libftp/FtpMove.c index 31d6c25fb132..8037b6b66def 100644 --- a/lib/libftp/FtpMove.c +++ b/lib/libftp/FtpMove.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. diff --git a/lib/libftp/FtpNumber.c b/lib/libftp/FtpNumber.c index 56411f8e8b3c..a6d711446188 100644 --- a/lib/libftp/FtpNumber.c +++ b/lib/libftp/FtpNumber.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. diff --git a/lib/libftp/FtpOpenDir.c b/lib/libftp/FtpOpenDir.c index 2d3e56e80f6f..3f2bcf1b5529 100644 --- a/lib/libftp/FtpOpenDir.c +++ b/lib/libftp/FtpOpenDir.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. diff --git a/lib/libftp/FtpPasv.c b/lib/libftp/FtpPasv.c index 3db132afcbc9..3dd52fef4b49 100644 --- a/lib/libftp/FtpPasv.c +++ b/lib/libftp/FtpPasv.c @@ -1,9 +1,9 @@ /* Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the exist ing programs. Commercial usage is also possible with participation of it's author. @@ -21,27 +21,27 @@ char * FtpPasv (FTP *ftp) char *msg; static String PORT; char *p=PORT; - - if FtpError(FtpCommand(ftp,"PASV","",227,EOF)) + + if FtpError(FtpCommand(ftp,"PASV","",227,EOF)) return ""; - + msg = FtpMessage (227); msg+=3; - - while (!isdigit(*msg++)); + + while (!isdigit(*msg++)); msg--; while (isdigit(*msg)||*msg==',') *p++=*msg++; *p=0; - + return PORT; } STATUS FtpLink(FTP *ftp1, FTP *ftp2) { - + String PORT; strcpy(PORT,FtpPasv(ftp1)); @@ -62,12 +62,12 @@ STATUS FtpPassiveTransfer(FTP *ftp1, FTP *ftp2, char *f1, char *f2) FtpAssert(ftp2,FtpCommand(ftp2,"STOR %s",f2, 200, 120 , 150 , 125 , 250 , EOF )); FtpAssert(ftp1,FtpCommand(ftp1,"RETR %s",f1, 200, 120 , 150 , 125 , 250 , EOF )); - + FD_ZERO(&fds); - + FD_SET(fileno(FTPCMD(ftp1)),&fds); FD_SET(fileno(FTPCMD(ftp2)),&fds); - + if (select(getdtablesize(),&fds,0,0,0)<0) { if (ftp1->error!=NULL) @@ -76,7 +76,7 @@ STATUS FtpPassiveTransfer(FTP *ftp1, FTP *ftp2, char *f1, char *f2) return (*(ftp2->error))(ftp1,QUIT,sys_errlist[errno]); return QUIT; } - + if (FD_ISSET(fileno(FTPCMD(ftp1)),&fds)) { FtpGetMessage(ftp1,tmp); diff --git a/lib/libftp/FtpPort.c b/lib/libftp/FtpPort.c index c6b0ca2b3cb5..eb15ac05c1f4 100644 --- a/lib/libftp/FtpPort.c +++ b/lib/libftp/FtpPort.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -24,7 +24,7 @@ STATUS FtpPort(FTP *con,int a,int b,int c,int d,int e,int f) return QUIT; if ( (i=FtpGetMessage(con,cmd)) == QUIT) return QUIT; - + if ( ! FtpGood ( i , 200 , EOF )) return EXIT(con,-i); diff --git a/lib/libftp/FtpPwd.c b/lib/libftp/FtpPwd.c index 4299bccf1288..59c792dfdfcf 100644 --- a/lib/libftp/FtpPwd.c +++ b/lib/libftp/FtpPwd.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -19,12 +19,12 @@ char * FtpPwd(FTP * con) String tmp; static String tmp1; int i; - + if ( FtpSendMessage(con,"PWD") == QUIT ) return (char *) EXIT(con,QUIT); if ( (i=FtpGetMessage(con,tmp)) == QUIT ) return (char *) EXIT(con,QUIT); - + if ( i != 257 ) return (char *) EXIT(con,-i); diff --git a/lib/libftp/FtpRetr.c b/lib/libftp/FtpRetr.c index eb19c16c448b..ced19b8c982b 100644 --- a/lib/libftp/FtpRetr.c +++ b/lib/libftp/FtpRetr.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -24,7 +24,7 @@ STATUS FtpRetr (FTP * con , char * command , struct stat st; char buffer[FTPBUFSIZ]; register int size; - + FtpFilenameChecker(&in,&out); if ( FtpTestFlag(con,FTP_REST) && stat(out,&st)==0) @@ -39,28 +39,28 @@ STATUS FtpRetr (FTP * con , char * command , if ((o=Ftpfopen(out,"w+"))==NULL) return EXIT(con,LQUIT); } - + if ( FtpError(FtpData(con,command,in,"r"))) { if (con->seek==0) return EXIT(con,con->errno); - + con -> seek = 0; fclose(o); - + if ( FtpError(FtpData(con,command,in,"r")) ) { return EXIT(con,con->errno); } - + if ((o=Ftpfopen(out,"w+"))==NULL) return EXIT(con,LQUIT); } - - + + fseek(o,con->seek,0); - + while((size=FtpReadBlock(con,buffer,FTPBUFSIZ))>0) { if (write(fileno(o),buffer,size)!=size) diff --git a/lib/libftp/FtpSize.c b/lib/libftp/FtpSize.c index 040e16bddf40..581e18641d15 100644 --- a/lib/libftp/FtpSize.c +++ b/lib/libftp/FtpSize.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -21,12 +21,12 @@ int FtpSize(FTP * con, char *filename) strcpy(tmp,"SIZE "); strcat(tmp,filename); - + if ( FtpSendMessage(con,tmp) == QUIT ) return EXIT(con,QUIT); if ( (i=FtpGetMessage(con,tmp)) == QUIT ) return EXIT(con,QUIT); - + if ( i != 213 ) return con -> errno = (-i); diff --git a/lib/libftp/FtpStor.c b/lib/libftp/FtpStor.c index 9ddb32681c30..9cd0e4eb557a 100644 --- a/lib/libftp/FtpStor.c +++ b/lib/libftp/FtpStor.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -27,11 +27,11 @@ STATUS FtpStor (FTP * con , char * command , if ( (i=Ftpfopen(in,"rb")) == NULL ) return EXIT(con,LQUIT); - if ( FtpTestFlag(con,FTP_REST) && + if ( FtpTestFlag(con,FTP_REST) && (con->seek=FtpSize(con,out))<0 ) con->seek=0; - - + + if ( FtpError(FtpData(con,command,out,"w"))) { if (con->seek==0) return EXIT(con,con->errno); @@ -40,12 +40,12 @@ STATUS FtpStor (FTP * con , char * command , if ( FtpError(FtpData(con,command,out,"w")) ) return EXIT(con,con->errno); } - + if (con->seek) fseek(i,con->seek,0); - - while ( (size=read ( fileno(i) , buffer, FTPBUFSIZ ))>0) + + while ( (size=read ( fileno(i) , buffer, FTPBUFSIZ ))>0) FtpWriteBlock(con,buffer,size); - + Ftpfclose(i); return FtpClose(con); } diff --git a/lib/libftp/FtpSyscalls.c b/lib/libftp/FtpSyscalls.c index 649d16f779b6..67fa4cae08eb 100644 --- a/lib/libftp/FtpSyscalls.c +++ b/lib/libftp/FtpSyscalls.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. diff --git a/lib/libftp/FtpType.c b/lib/libftp/FtpType.c index 6c32016aeb67..ae0d0ea00b11 100644 --- a/lib/libftp/FtpType.c +++ b/lib/libftp/FtpType.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -17,10 +17,10 @@ Commercial usage is also possible with participation of it's author. STATUS FtpType(FTP *ftp, char type) { STATUS p; - + if ((p=FtpCommand(ftp,"TYPE %c",type,200,EOF))>0) ftp->mode=(int)type; return p; } - + diff --git a/lib/libftp/Ftpfopen.c b/lib/libftp/Ftpfopen.c index b7b96d59f56d..9b89bb3e7835 100644 --- a/lib/libftp/Ftpfopen.c +++ b/lib/libftp/Ftpfopen.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -24,9 +24,9 @@ enum {T_EMPTY=0,T_FILE,T_STREAM,T_PIPE,T_FULL}; FILE *Ftpfopen(char *filename,char *mode) { FILE *fp; - + if (!init) - { + { bzero(fds_types,NFDS*sizeof(fds_types[0])); init=1; } @@ -36,22 +36,22 @@ FILE *Ftpfopen(char *filename,char *mode) fds_types[fileno(stdin)]=T_STREAM; return stdin; } - + if (!strcmp(filename,"*STDOUT*") || (!strcmp(filename,"-") && (mode[0]=='w'))) { fds_types[fileno(stdout)]=T_STREAM; return stdout; } - + if (strcmp(filename,"*STDERR*")==0) { fds_types[fileno(stderr)]=T_STREAM; return stderr; } - - if (*filename=='|') + + if (*filename=='|') { fp=popen(filename+1,mode); if (fp==NULL) return fp; @@ -63,33 +63,33 @@ FILE *Ftpfopen(char *filename,char *mode) if (fp==NULL) return fp; fds_types[fileno(fp)]=T_FILE; return fp; - + } int Ftpfclose(FILE *fp) { if (!init) - { + { bzero(fds_types,NFDS*sizeof(fds_types[0])); init=1; } switch (fds_types[fileno(fp)]) { - + case T_FILE: - + return FtpFullClose(fp); - + case T_STREAM: return fflush(fp); - + case T_PIPE: - + return pclose(fp); - + default: return -1; diff --git a/lib/libftp/doc/example.c b/lib/libftp/doc/example.c index 7f0928725ad8..0606592deea3 100644 --- a/lib/libftp/doc/example.c +++ b/lib/libftp/doc/example.c @@ -1,7 +1,7 @@ /* Include standard libftp's header */ -#include <FtpLibrary.h> +#include <FtpLibrary.h> @@ -10,25 +10,25 @@ main(int argc, char *argv[]) FILE *input,*output; int c; - + if (argc<3) exit(fprintf(stderr,"Usage: %s input-file output-file\n",argv[0])); FtplibDebug(yes); - + if ((input=Ftpfopen(argv[1],"r"))==NULL) { perror(argv[1]); exit(1); } - + if ((output=Ftpfopen(argv[2],"w"))==NULL) { perror(argv[2]); exit(1); } - + while ( (c=getc(input)) != EOF && (putc(c,output)!=EOF) ); if (ferror(input)) @@ -36,7 +36,7 @@ main(int argc, char *argv[]) perror(argv[1]); exit(1); } - + if (ferror(output)) { perror(argv[1]); @@ -47,5 +47,5 @@ main(int argc, char *argv[]) Ftpfclose(output); exit(0); - + } diff --git a/lib/libftp/utils/Makefile b/lib/libftp/utils/Makefile index d750ca7b5a45..bae516bf448c 100644 --- a/lib/libftp/utils/Makefile +++ b/lib/libftp/utils/Makefile @@ -25,10 +25,10 @@ uftp: uftp.o uftpcmd.o libetc.a mirror: mirror.o $(CC) $(CFLAGS) -o mirror mirror.o ${LDADD} -lftp -clean: +clean: rm -f ftptry mirror uftp *~ *.o *.a -LIBOBJS= readline.o glob.o -libetc.a: $(LIBOBJS) +LIBOBJS= readline.o glob.o +libetc.a: $(LIBOBJS) ar qc libetc.a $(LIBOBJS) ranlib libetc.a diff --git a/lib/libftp/utils/ftptry.c b/lib/libftp/utils/ftptry.c index 623d0da8e4ae..7dfb130d4b3b 100644 --- a/lib/libftp/utils/ftptry.c +++ b/lib/libftp/utils/ftptry.c @@ -2,9 +2,9 @@ Library for ftpd clients.(libftp) Copyright by Oleg Orel All rights reserved. - -This library is desined for free, non-commercial software creation. -It is changeable and can be improved. The author would greatly appreciate + +This library is desined for free, non-commercial software creation. +It is changeable and can be improved. The author would greatly appreciate any advises, new components and patches of the existing programs. Commercial usage is also possible with participation of it's author. @@ -27,7 +27,7 @@ will be described in usage, if the program is started without them.\n\ \n\ The libftp you may transfer from host lpuds.oea.ihep.su via ftp-anonymous.\n\ All question are sent to author via e-mail (orel@oea.ihep.su)\n\ - "; + "; #include <FtpLibrary.h> #include <sys/types.h> @@ -95,7 +95,7 @@ main(int argc,char **argv) if (setjmp(trap)!=0) exit(1); - + signal(SIGHUP,sighup); signal(SIGTRAP,done); signal(SIGINT,done); @@ -106,13 +106,13 @@ main(int argc,char **argv) gethost()); progname=argv[0]; - + FtpDebug(&FtpInit); FtpSetErrorHandler(&FtpInit,my_abort); FtpSetIOHandler(&FtpInit,my_IO); FtpSetFlag(&FtpInit,FTP_REST); FtpSetTimeout(&FtpInit,DEFAULT_TIMEOUT); - + setoptions(); optind=1; options(argc,argv); @@ -122,7 +122,7 @@ main(int argc,char **argv) { case lm_file: - + if (fork()) quit("Deattaching....."); close(0);close(1);close(2); @@ -133,7 +133,7 @@ main(int argc,char **argv) } else strcpy(tmp,logfile); - + open(tmp,O_TRUNC|O_CREAT|O_WRONLY,0600); dup(0); dup(0); @@ -142,23 +142,23 @@ main(int argc,char **argv) case lm_mail: - + if (fork()) quit("Deattaching....."); - + close(0);close(1);close(2); if (popen("/usr/lib/sendmail -t","w")==NULL) perror("sendmail"), quit(""); - + dup(0); dup(0); - + printf("From: %s@%s\n",USERNAME,gethost()); printf("To: %s@%s\n",USERNAME,gethost()); - printf("Subject: ftptry session log\n\n"); - + printf("Subject: ftptry session log\n\n"); + fflush(stdout); - + break; } @@ -174,12 +174,12 @@ main(int argc,char **argv) INLINE noargs(int argc, char **argv, int optind) { int i; - + for (i=optind;i<argc;i++) if (argv[i]!=NULL) return 0; return 1; } - + /* Main loop */ @@ -192,15 +192,15 @@ loop(int argc, char **argv, int optind /* First args as filename */ ) String filename; String localfilename; char *p1; - + for(i=optind;;(i==argc-1)?i=optind, sprintf(tmp,"Sleeping %d secs",sleeptime),log(tmp),sleep(sleeptime): i++) { if (noargs(argc,argv,optind)) quit("Nothing doing"); - - if (strchr(argv[i],':')==NULL) + + if (strchr(argv[i],':')==NULL) { if (find_archie(argv[i],machine,filename,localfilename)==0) argv[i]=NULL; @@ -226,19 +226,19 @@ transfer(char *machine, char *file, char *localfile) { int r; String tmp; - + if ((r=setjmp(stack))!=0) return r; - + sprintf(tmp,"Start transfer, machine is %s, remote file is %s, local file is %s", machine, file, localfile); DEBUG(tmp); - + FtpLogin(&ftp,machine,user,password,NULL); if (type==binary) FtpBinary(ftp); - + switch (mode) { @@ -260,11 +260,11 @@ transfer(char *machine, char *file, char *localfile) case multiget: domultiget(file); break; - + } - + FtpBye(ftp); - + DEBUG("Transfer complete"); return OK_; } @@ -288,11 +288,11 @@ quit(char *s) log(s); longjmp(trap,1); } - + my_IO(FTP *ftp, int n, char *s ) { - + DEBUG(s); leave(BREAK_); } @@ -312,7 +312,7 @@ domultiget(char *file) { String list,localname,tmp_name; char *p1; - + sprintf(list,"/tmp/ftptry-%s-multiget.XXXXXX",USERNAME); mktemp(list); @@ -405,7 +405,7 @@ void done(sig) options(int argc,char **argv) { char c; - + while((c=getopt(argc,argv,"GOIBDru:p:Pdbs:o:l:t:cm"))!=EOF) { switch(c) @@ -414,16 +414,16 @@ options(int argc,char **argv) case 'G': mode=multiget; break; - + case 'c': if (localfile==NULL) localfile="*STDOUT*"; break; - + case 'I': fprintf(stderr,intro); exit(0); - + case 'r': mode=put; @@ -444,12 +444,12 @@ options(int argc,char **argv) localfile=optarg; break; - + case 'D': debug=true; break; - + case 'u': user=optarg; @@ -464,7 +464,7 @@ options(int argc,char **argv) password=(char *)getpass("Password:"); break; - + case 'b': type=binary; @@ -480,14 +480,14 @@ options(int argc,char **argv) logmode=lm_file; logfile=optarg; break; - + case 'm': logmode=lm_mail; break; - + case 'B': - + logmode=lm_file; logfile=NULL; break; @@ -495,8 +495,8 @@ options(int argc,char **argv) default: usage(); - - } + + } } } @@ -510,14 +510,14 @@ setoptions() - + if ((p=(char *)getenv(FTPTRY))!=NULL && *p!=0) strcpy(x,p); else return; - - + + for (argv[0]="",p=x,sp=x,argc=1; *p!=0 ; p++) { if (*p==' ') @@ -529,7 +529,7 @@ setoptions() } argv[argc++]=sp; - + options(argc,argv); } @@ -562,7 +562,7 @@ find_archie(char *what,char *machine, char *filename, char *localfilename) static String oldwhat={'\0'}; char *p1; int i; - + if (!init || strcmp(oldwhat,what)!=0 || last==0) { String cmd; @@ -571,10 +571,10 @@ find_archie(char *what,char *machine, char *filename, char *localfilename) for (i=0;i<MAXHOPS;i++) result[i][0]=0; sprintf(cmd,"archie -l -m %d %s",MAXHOPS,what); DEBUG(cmd); - + if ((archie = popen(cmd,"r"))==NULL) quit("Archie can't execute"); - + for(i=0;i<MAXHOPS;i++) { if (fgets(result[i],sizeof (result[i]), archie)==NULL) @@ -582,17 +582,17 @@ find_archie(char *what,char *machine, char *filename, char *localfilename) result[i][strlen(result[i])-1]=0; DEBUG(result[i]); } - - + + last=i; - if ( last==0 ) + if ( last==0 ) { DEBUG("archie not found need file"); return(0); } - - + + init=1; first=0; strcpy(oldwhat,what); @@ -606,23 +606,23 @@ find_archie(char *what,char *machine, char *filename, char *localfilename) first=i+1; break; } - + DEBUG("Archie select is ... (see next line)"); DEBUG(result[i]); - + if (sscanf ( result[i] , "%*[^ ] %*[^ ] %[^ ] %s", machine, filename )!=2) { DEBUG("Bad archie output format"); last=0; return(0); } - - + + if ( (p1=strrchr(filename,'/'))!= NULL) strcpy(localfilename,p1+1); else strcpy(localfilename,filename); - + return(1); } diff --git a/lib/libftp/utils/glob.c b/lib/libftp/utils/glob.c index d80b1462fc20..efaeaa6a1cbc 100644 --- a/lib/libftp/utils/glob.c +++ b/lib/libftp/utils/glob.c @@ -58,7 +58,7 @@ static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; * GLOB_TILDE: * expand ~user/foo to the /home/dir/of/user/foo * GLOB_BRACE: - * expand {1,2}{a,b} to 1a 1b 2a 2b + * expand {1,2}{a,b} to 1a 1b 2a 2b * gl_matchc: * Number of matches in the current invocation of glob. */ @@ -173,7 +173,7 @@ glob(pattern, flags, errfunc, pglob) bufend = bufnext + MAXPATHLEN; if (flags & GLOB_QUOTE) { /* Protect the quoted characters. */ - while (bufnext < bufend && (c = *patnext++) != EOS) + while (bufnext < bufend && (c = *patnext++) != EOS) if (c == QUOTE) { if ((c = *patnext++) == EOS) { c = QUOTE; @@ -184,8 +184,8 @@ glob(pattern, flags, errfunc, pglob) else *bufnext++ = c; } - else - while (bufnext < bufend && (c = *patnext++) != EOS) + else + while (bufnext < bufend && (c = *patnext++) != EOS) *bufnext++ = c; *bufnext = EOS; @@ -246,7 +246,7 @@ static int globexp2(ptr, pattern, pglob, rv) for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++) continue; if (*pe == EOS) { - /* + /* * We could not find a matching RBRACKET. * Ignore and just look for RBRACE */ @@ -274,7 +274,7 @@ static int globexp2(ptr, pattern, pglob, rv) for (pl = pm++; *pm != RBRACKET && *pm != EOS; pm++) continue; if (*pm == EOS) { - /* + /* * We could not find a matching RBRACKET. * Ignore and just look for RBRACE */ @@ -299,7 +299,7 @@ static int globexp2(ptr, pattern, pglob, rv) /* Append the current string */ for (lm = ls; (pl < pm); *lm++ = *pl++) continue; - /* + /* * Append the rest of the pattern after the * closing brace */ @@ -344,15 +344,15 @@ globtilde(pattern, patbuf, pglob) return pattern; /* Copy up to the end of the string or / */ - for (p = pattern + 1, h = (char *) patbuf; *p && *p != SLASH; + for (p = pattern + 1, h = (char *) patbuf; *p && *p != SLASH; *h++ = *p++) continue; *h = EOS; if (((char *) patbuf)[0] == EOS) { - /* - * handle a plain ~ or ~/ by expanding $HOME + /* + * handle a plain ~ or ~/ by expanding $HOME * first and then trying the password file */ if ((h = getenv("HOME")) == NULL) { @@ -375,14 +375,14 @@ globtilde(pattern, patbuf, pglob) /* Copy the home directory */ for (b = patbuf; *h; *b++ = *h++) continue; - + /* Append the rest of the pattern */ while ((*b++ = *p++) != EOS) continue; return patbuf; } - + /* * The main glob() routine: compiles the pattern (optionally processing @@ -440,7 +440,7 @@ glob0(pattern, pglob) break; case STAR: pglob->gl_flags |= GLOB_MAGCHAR; - /* collapse adjacent stars to one, + /* collapse adjacent stars to one, * to avoid exponential behavior */ if (bufnext == patbuf || bufnext[-1] != M_ALL) @@ -460,17 +460,17 @@ glob0(pattern, pglob) return(err); /* - * If there was no match we are going to append the pattern + * If there was no match we are going to append the pattern * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified * and the pattern did not contain any magic characters * GLOB_NOMAGIC is there just for compatibility with csh. */ - if (pglob->gl_pathc == oldpathc && - ((pglob->gl_flags & GLOB_NOCHECK) || + if (pglob->gl_pathc == oldpathc && + ((pglob->gl_flags & GLOB_NOCHECK) || ((pglob->gl_flags & GLOB_NOMAGIC) && !(pglob->gl_flags & GLOB_MAGCHAR)))) return(globextend(pattern, pglob)); - else if (!(pglob->gl_flags & GLOB_NOSORT)) + else if (!(pglob->gl_flags & GLOB_NOSORT)) qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, pglob->gl_pathc - oldpathc, sizeof(char *), compare); return(0); @@ -519,7 +519,7 @@ glob2(pathbuf, pathend, pattern, pglob) *pathend = EOS; if (g_lstat(pathbuf, &sb, pglob)) return(0); - + if (((pglob->gl_flags & GLOB_MARK) && pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) #ifdef S_ISLNK @@ -576,7 +576,7 @@ glob3(pathbuf, pathend, pattern, restpattern, pglob) *pathend = EOS; errno = 0; - + if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { /* TODO: don't call for ENOENT or ENOTDIR? */ if (pglob->gl_errfunc) { @@ -602,7 +602,7 @@ glob3(pathbuf, pathend, pattern, restpattern, pglob) /* Initial DOT must be matched literally. */ if (dp->d_name[0] == DOT && *pattern != DOT) continue; - for (sc = (u_char *) dp->d_name, dc = pathend; + for (sc = (u_char *) dp->d_name, dc = pathend; (*dc++ = *sc++) != EOS;) continue; if (!match(pathend, pattern, restpattern)) { @@ -648,7 +648,7 @@ globextend(path, pglob) const Char *p; newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs); - pathv = pglob->gl_pathv ? + pathv = pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) : malloc(newsize); if (pathv == NULL) @@ -690,7 +690,7 @@ match(name, pat, patend) case M_ALL: if (pat == patend) return(1); - do + do if (match(name, pat, patend)) return(1); while (*name++ != EOS); @@ -829,7 +829,7 @@ g_Ctoc(str, buf) } #ifdef DEBUG -static void +static void qprintf(str, s) const char *str; register Char *s; diff --git a/lib/libftp/utils/glob.h b/lib/libftp/utils/glob.h index bffb28c7252c..b0432b717e98 100644 --- a/lib/libftp/utils/glob.h +++ b/lib/libftp/utils/glob.h @@ -58,7 +58,7 @@ typedef struct { * and lstat(2). */ void (*gl_closedir) __P((void *)); - struct dirent *(*gl_readdir) __P((void *)); + struct dirent *(*gl_readdir) __P((void *)); void *(*gl_opendir) __P((const char *)); int (*gl_lstat) __P((const char *, struct stat *)); int (*gl_stat) __P((const char *, struct stat *)); diff --git a/lib/libftp/utils/mirror.c b/lib/libftp/utils/mirror.c index babd840e6820..a0d329c1d2de 100644 --- a/lib/libftp/utils/mirror.c +++ b/lib/libftp/utils/mirror.c @@ -9,7 +9,7 @@ #include <syslog.h> #include <FtpLibrary.h> -/* Usage: mirror <local_dir> <host> <user> <passwd> <remote_dir> */ +/* Usage: mirror <local_dir> <host> <user> <passwd> <remote_dir> */ FTP *ftp; main(int a,char **b) @@ -24,7 +24,7 @@ main(int a,char **b) if ( a < 5 ) quit("Usage: mirror <local_dir> <host> <user> <passwd> <remote_dir>"); - + FtplibDebug(yes); FtpLogin(&ftp,HOST,USER,PASSWD,NULL); FtpChdir(ftp,REMOTE_DIR); @@ -53,7 +53,7 @@ doit(char *dirname) continue; sprintf(fn,"%s/%s",dirname,de->d_name); - + if ( stat(fn,&st) != 0 ) { log(fn); continue; @@ -72,7 +72,7 @@ doit(char *dirname) } closedir(dp); - + } diff --git a/lib/libftp/utils/readline.c b/lib/libftp/utils/readline.c index 34612ba8b339..e019bc1aaae0 100644 --- a/lib/libftp/utils/readline.c +++ b/lib/libftp/utils/readline.c @@ -1,5 +1,5 @@ #ifndef lint -static char *RCSid = "$Id: readline.c%v 3.50.1.9 1993/08/05 05:38:59 woo Exp $"; +static char *RCSid = "$Id: readline.c,v 1.1.1.1 1995/04/25 15:05:09 jkh Exp $"; #endif @@ -8,17 +8,17 @@ static char *RCSid = "$Id: readline.c%v 3.50.1.9 1993/08/05 05:38:59 woo Exp $"; * Copyright (C) 1986 - 1993 Thomas Williams, Colin Kelley * * Permission to use, copy, and distribute this software and its - * documentation for any purpose with or without fee is hereby granted, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear + * documentation for any purpose with or without fee is hereby granted, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear * in supporting documentation. * * Permission to modify the software is granted, but not the right to - * distribute the modified code. Modifications are to be distributed + * distribute the modified code. Modifications are to be distributed * as patches to released version. - * + * * This software is provided "as is" without express or implied warranty. - * + * * * AUTHORS * @@ -27,10 +27,10 @@ static char *RCSid = "$Id: readline.c%v 3.50.1.9 1993/08/05 05:38:59 woo Exp $"; * * Msdos port and some enhancements: * Gershon Elber and many others. - * + * * There is a mailing list for gnuplot users. Note, however, that the - * newsgroup - * comp.graphics.gnuplot + * newsgroup + * comp.graphics.gnuplot * is identical to the mailing list (they * both carry the same set of messages). We prefer that you read the * messages through that newsgroup, to subscribing to the mailing list. @@ -40,9 +40,9 @@ static char *RCSid = "$Id: readline.c%v 3.50.1.9 1993/08/05 05:38:59 woo Exp $"; * * The address for mailing to list members is * info-gnuplot@dartmouth.edu - * and for mailing administrative requests is + * and for mailing administrative requests is * info-gnuplot-request@dartmouth.edu - * The mailing list for bug reports is + * The mailing list for bug reports is * bug-gnuplot@dartmouth.edu * The list of those interested in beta-test versions is * info-gnuplot-beta@dartmouth.edu @@ -57,7 +57,7 @@ static char *RCSid = "$Id: readline.c%v 3.50.1.9 1993/08/05 05:38:59 woo Exp $"; #endif /* a small portable version of GNU's readline */ -/* this is not the BASH or GNU EMACS version of READLINE due to Copyleft +/* this is not the BASH or GNU EMACS version of READLINE due to Copyleft restrictions */ /* do not need any terminal capabilities except backspace, */ /* and space overwrites a character */ @@ -123,7 +123,7 @@ static struct ltchars s_ltchars; #ifdef ISC22 #ifndef ONOCR /* taken from sys/termio.h */ #define ONOCR 0000020 /* true at least for ISC 2.2 */ -#endif +#endif #ifndef IUCLC #define IUCLC 0001000 #endif @@ -226,7 +226,7 @@ void reset_termio(); /* user_putc and user_puts should be used in the place of * fputc(ch,stderr) and fputs(str,stderr) for all output - * of user typed characters. This allows MS-Windows to + * of user typed characters. This allows MS-Windows to * display user input in a different color. */ int user_putc(ch) @@ -265,7 +265,7 @@ backspace() { user_putc(BACKSPACE); } - + char * readline(prompt) char *prompt; @@ -322,7 +322,7 @@ char *prompt; } } #endif /*OS2*/ - if((isprint(cur_char) + if((isprint(cur_char) #if defined(ATARI) || defined(_Windows) || defined(MSDOS) || defined(DOS386) /* this should be used for all 8bit ASCII machines, I guess */ || ((unsigned char)cur_char > 0x7f) @@ -455,7 +455,7 @@ char *prompt; if(cur_entry != NULL) { cur_entry = cur_entry->next; clear_line(prompt); - if(cur_entry != NULL) + if(cur_entry != NULL) copy_line(cur_entry->line); else cur_pos = max_pos = 0; @@ -714,12 +714,12 @@ msdos_getch() /* Convert Arrow keystrokes to Control characters: TOS version */ -/* the volatile could be necessary to keep gcc from reordering +/* the volatile could be necessary to keep gcc from reordering the two Super calls */ #define CONTERM ((/*volatile*/ char *)0x484L) -static void +static void remove_conterm() { void *ssp=(void*)Super(0L); @@ -929,7 +929,7 @@ set_termio() } #endif /* !MSDOS && !ATARI && !defined(_Windows) */ } - + void reset_termio() { diff --git a/lib/libftp/utils/uftp.c b/lib/libftp/utils/uftp.c index fe64ffd23dfe..4c8961ffcd6e 100644 --- a/lib/libftp/utils/uftp.c +++ b/lib/libftp/utils/uftp.c @@ -37,25 +37,25 @@ main(int argc, char **argv) register char *p1; FILE *fp; String tmp; - - if (setjmp(start)!=0) + + if (setjmp(start)!=0) goto main_loop; - + setsignals(); - - + + FtpSetErrorHandler(&FtpInit,my_error); FtpSetIOHandler(&FtpInit,my_error); - + strcpy(defaultuser,getpwuid(getuid())->pw_name); - + memset(ftp,0,sizeof(FTP*)*NFRAMES); memset(iftp,0,sizeof(LINKINFO)*NFRAMES); - - + + batch(SYSTEMRC); if (access(getrcname(),F_OK)) @@ -69,16 +69,16 @@ main(int argc, char **argv) else { - + fprintf(out,"set timeout 120\nset hash\nset debug\nset bin\n"); fprintf(out,"set prompt \"%%T %%u@%%h:%%d\\> \"\n"); fprintf(out,"alias a alias\na ed ! emacs\nalias tn ! telnet\n"); - + fclose(out); } } - + batch(getrcname()); batch(getaliasrcname()); @@ -88,7 +88,7 @@ main(int argc, char **argv) strcat(tmp,argv[i]); if (i+1!=argc) strcat(tmp," "); } - + if (tmp[0]!=0) { String new; @@ -99,8 +99,8 @@ main(int argc, char **argv) else */ strcpy(new,"open "); - - if (ifalias(tmp)) + + if (ifalias(tmp)) execute (tmp); else strcat(new,tmp), @@ -111,25 +111,25 @@ main(int argc, char **argv) main_loop: setsignals(); - + while (1) { - + setjmp(start); if (lastcmd) exit(0); - + if (isatty(fileno(stdin))) p1=readline(getprompt()); else p1=gets(cmd); - - if (p1==NULL) + + if (p1==NULL) { putchar('\n'); exit(0); } - + strcpy(cmd,p1); if (cmd[0]) add_history(cmd); @@ -144,15 +144,15 @@ INLINE char *findspace(char *str) } - + char *word(char *str, int n) { String new; register char *p1, *p2; register int i; - + strcpy(new,str); - + p1=new; while (isspace(*p1)) p1++; @@ -160,7 +160,7 @@ char *word(char *str, int n) if (n>1 ) for (i=0;i<n-1;i++) /* Skip n-1 words */ { - if ((*p1=='"')||(*p1=='\'')) + if ((*p1=='"')||(*p1=='\'')) { p1=strchr(p1+1,*p1); if (p1==NULL) return ""; @@ -181,7 +181,7 @@ char *word(char *str, int n) *p2=0; return p1+1; } - + if ((p2=findspace(p1)) != NULL ) { *p2=0; @@ -191,8 +191,8 @@ char *word(char *str, int n) } -/* Exacute few command separated by ';' . The character ' must use for mark complex - works*/ +/* Exacute few command separated by ';' . The character ' must use for mark complex + works*/ execute (char *cmd) { @@ -208,13 +208,13 @@ execute (char *cmd) { *p++=*cmd++; while ( *cmd != '\'' && *cmd != 0 ) *p++=*cmd++; - if ( *cmd == 0 ) + if ( *cmd == 0 ) return puts("Unbalanced \', please corrected!\n"); *p++=*cmd; continue; } - - if ( *cmd == ';' ) + + if ( *cmd == ';' ) { *p=0; execute(newcmd); @@ -224,11 +224,11 @@ execute (char *cmd) *p++=*cmd; } - + *p=0; cmd=newcmd; - - if ( *cmd=='\\' ) + + if ( *cmd=='\\' ) cmd++; else { @@ -238,17 +238,17 @@ execute (char *cmd) return execute(new); } - if ( *cmd == '!' ) + if ( *cmd == '!' ) { int pid,_pid; int status; - + if (!(pid=fork())) { execlp((getenv("SHELL")==NULL)?"/bin/sh":(char *)getenv("SHELL"), "shell","-c",cmd+1,NULL); } - + while(1) { _pid=wait(&status); @@ -256,8 +256,8 @@ execute (char *cmd) return; } } - - + + redir(cmd); if (cmd[strlen(cmd)-1]=='&') @@ -271,14 +271,14 @@ execute (char *cmd) strcpy(cmd,tmp); } - + strcpy(w1,word(cmd,1)); strcpy(w2,word(cmd,2)); strcpy(w3,word(cmd,3)); strcpy(w4,word(cmd,4)); strcpy(w5,word(cmd,5)); strcpy(w6,word(cmd,6)); - + return executev(w1,w2,w3,w4,w5,w6); } @@ -286,18 +286,18 @@ executev(ARGS) { CMDS *xcmd=&cmds[0]; String tmp; - + if (isdigit(*w1)) - return + return atoi(w1)<NFRAMES?frame=atoi(w1):0, executev(w2,w3,w4,w5,w6,""); - + while ( xcmd -> cmd != NULL ) { if ( !strcmp(xcmd->cmd,w1) && (xcmd -> func != NULL) ) { int status; - + if ( xcmd -> need && LINK == NULL) return puts("Need connection to server"); iftp[frame].lock=1; unsetsignals(); @@ -308,11 +308,11 @@ executev(ARGS) } xcmd++; } - - + + if (LINK!=NULL && glassmode) return FtpCommand(LINK,cmd,"",0,EOF); - + printf("%s: unknown command\n",w1); fflush(stdout); return -1; @@ -332,7 +332,7 @@ void intr(int sig) newframe(int connecteble) { register int i; - + if (connecteble) for (i=0; i<NFRAMES; i++) if (ftp[i]!=NULL) return frame=i; for (i=0; i<NFRAMES; i++) if (ftp[i]==NULL) return frame=i; @@ -345,7 +345,7 @@ STATUS my_error(FTP *ftp, int code, char *msg) if (code==LQUIT||(ftp==NULL)) log(msg); else FtpLog(ftp->title,msg); - + if ( abs(code) == 530 && (strstr(msg,"anonymous")!=NULL)) { Ftp_reopen(); @@ -358,7 +358,7 @@ char *getrcname() { static String rcpath; struct passwd *pwd=getpwuid(getuid()); - + sprintf(rcpath,"%s/.uftprc",pwd->pw_dir); return rcpath; } @@ -367,7 +367,7 @@ char *getaliasrcname() { static String rcpath; struct passwd *pwd=getpwuid(getuid()); - + sprintf(rcpath,"%s/.uftp_aliases",pwd->pw_dir); return rcpath; } @@ -378,14 +378,14 @@ char *makestr(va_alist) char *p1; va_list args; String new={0}; - + va_start(args); while(1) { p1=va_arg(args,char *); if (p1==NULL) break; - if (*p1!=0) + if (*p1!=0) { if (new[0]!=0) strcat(new," "); strcat(new,p1); @@ -395,7 +395,7 @@ char *makestr(va_alist) return new; } - + #define ADD(str,chr) (*str++=chr,*str=0) INLINE ADDSTR(char **str, char *str1) @@ -409,59 +409,59 @@ char *expandalias(char *str) String new={0},w1={0}; char *p,*p1=new,*args; int dollar=0; - + strcpy(w1,word(str,1)); if ( (p=strchr(str,' '))!=NULL ) args=p+1; else args=""; - - while (a) + + while (a) { if (!strcmp(a->name,w1)) break; a=a->next; } - - if (!a) + + if (!a) return str; - + for ( p=a->str; *p; p++) { - if ( *p != '$' ) + if ( *p != '$' ) { ADD(p1,*p); continue; } - + dollar=1; p++; - - if (isdigit(*p)) + + if (isdigit(*p)) { ADDSTR(&p1,word(str,(*p)-'0'+1)); continue; } - switch (*p) - { - + switch (*p) + { + case '\0': case '$': ADD(p1,'$');continue; case '*': ADDSTR(&p1,args);continue; default: ADD(p1,'$');ADD(p1,*p);continue; } } - - if (!dollar) + + if (!dollar) { ADD(p1,' '); ADDSTR(&p1,args); } *p=0; - + return new; } @@ -481,12 +481,12 @@ ifalias(char *cmd) } return 0; } - + char *getprompt() { - + static String _prompt; String tmp; char *s; @@ -499,22 +499,22 @@ char *getprompt() case '%': switch (*++s) { - - case 'H': + + case 'H': strcat(_prompt,iftp[frame].host); break; - + case 'h': strcpy(tmp,iftp[frame].host); if (strchr(tmp,'.')!=NULL) *(char *)strchr(tmp,'.')=0; strcat(_prompt,tmp); break; - case 'M': + case 'M': gethostname(tmp, sizeof tmp); strcat(_prompt,gethostbyname(tmp)->h_name); break; - + case 'm': gethostname(tmp, sizeof tmp); strcpy(tmp,gethostbyname(tmp)->h_name); @@ -525,7 +525,7 @@ char *getprompt() case 'u': strcat(_prompt,iftp[frame].user); break; - + case 'd': strcat(_prompt,iftp[frame].pwd); break; @@ -543,16 +543,16 @@ char *getprompt() sprintf(tmp,"%d",(LINK==NULL)?0:LINK->port); strcat(_prompt,tmp); break; - + case 't': - + sprintf(tmp,"%d",(LINK==NULL)?0:LINK->timeout.tv_sec); strcat(_prompt,tmp); break; - + case 'T': - + { time_t t=time((time_t *)0); struct tm *lt=localtime(&t); @@ -567,7 +567,7 @@ char *getprompt() sprintf(tmp,"%d",getpid()); strcat(_prompt,tmp); break; - + default: sprintf(tmp,"%%%c",*s); strcat(_prompt,tmp); @@ -576,7 +576,7 @@ char *getprompt() break; case '^': - + ++s; if (isalpha(*s)) { @@ -584,17 +584,17 @@ char *getprompt() strcat(_prompt,tmp); } break; - + default: - + sprintf(tmp,"%c",*s); strcat(_prompt,tmp); break; } return _prompt; } - - + + void noop() { int i; @@ -603,26 +603,26 @@ void noop() if (noopinterval==0) return; - + curtime = time((time_t *)0); - + signal(SIGALRM,noop); - - if (prevtime==0) + + if (prevtime==0) { prevtime=curtime; alarm(noopinterval); return; } - - if (curtime-prevtime < noopinterval) + + if (curtime-prevtime < noopinterval) { alarm(prevtime+noopinterval-curtime); return; } - + printf("Waiting...");fflush(stdout); - + for (i=0;i<NFRAMES;i++) { if ( ftp[i]==NULL || FTPCMD(ftp[i]) == NULL || iftp[i].lock ) @@ -633,7 +633,7 @@ void noop() func3=ftp[i]->IO; ftp[i]->IO=NULL; save = ftp[i]->timeout.tv_sec; ftp[i]->timeout.tv_sec = nooptimeout; - + FtpCommand(ftp[i],"NOOP","",0,EOF); ftp[i]->timeout.tv_sec = save; @@ -642,10 +642,10 @@ void noop() ftp[i]->IO=func1; } - + alarm(noopinterval); prevtime=curtime; - + for (i=0;i<10;i++) putchar(8),putchar(' '),putchar(8); fflush(stdout); } @@ -667,7 +667,7 @@ unsetsignals() int myhash(FTP *ftp,unsigned int chars) { - + if (hashmode) { if (chars==0) return ftp -> counter=0; @@ -676,7 +676,7 @@ int myhash(FTP *ftp,unsigned int chars) fflush(stdout); } - if (!lastcmd) + if (!lastcmd) { noop(); alarm(0); @@ -688,7 +688,7 @@ int myhash(FTP *ftp,unsigned int chars) char *makefilename(char *f1, char *f2) { char *p; - + if (*f2!=0) return f2; @@ -702,21 +702,21 @@ redir(char *cmdline) char *p=cmdline; String result; char *r=result; - + for ( ; *p ; p++ , r++ ) { - if ( *p == '\\' ) + if ( *p == '\\' ) { *r = * ++ p ; continue; } - + if ( *p == '>' || *p == '<' ) { String filename; char *q=filename; char c=*p; - + for (p++;isspace(*p)&&*p!=0;p++); if (*p=='"') { @@ -725,10 +725,10 @@ redir(char *cmdline) } else for (; !isspace(*p) && *p!=0 ; p++,q++) *q=*p; - + *q=0; - - if ( c == '>' ) + + if ( c == '>' ) output(filename); else input(filename); @@ -745,7 +745,7 @@ FILE *is=NULL,*os=NULL; input(char *filename) { - + if ((is=Ftpfopen(filename,"r"))==NULL) { perror(filename); @@ -761,13 +761,13 @@ input(char *filename) output(char *filename) { - + if ((os=Ftpfopen(filename,"w"))==NULL) { perror(filename); return; } - + fflush(stdout); otty=dup(1); close(1); @@ -803,10 +803,10 @@ batch(char *filename) { FILE *fp; String tmp; - + if ((fp=fopen(filename,"r"))!=NULL) { - + while ( fgets(tmp, sizeof tmp, fp) != NULL) { tmp[strlen(tmp)-1]=0; @@ -816,7 +816,7 @@ batch(char *filename) fclose(fp); } } - + diff --git a/lib/libftp/utils/uftpcmd.c b/lib/libftp/utils/uftpcmd.c index 959de4030e65..2eb3cb246186 100644 --- a/lib/libftp/utils/uftpcmd.c +++ b/lib/libftp/utils/uftpcmd.c @@ -10,61 +10,61 @@ Ftp_connect_hook(FTP *ftp,int code, char *msg) { FtpLog(ftp->title,msg); longjmp(connectstack,1); - + } - -Ftp_connect(ARGS) + +Ftp_connect(ARGS) { STATUS (*func1)(),(*func2)(); if (*w2==0) w2=readline("Host:"); - if (FtpGetHost(w2)==NULL && FtpInit.IO != NULL) + if (FtpGetHost(w2)==NULL && FtpInit.IO != NULL) { char *msg; extern int h_errno; - + switch(h_errno) { case HOST_NOT_FOUND: msg = "Host unknown"; break; case TRY_AGAIN: msg = "Hostname lookup failure";break; - default: msg = "gethostbyname failure"; + default: msg = "gethostbyname failure"; } return (*FtpInit.IO)(LINK,QUIT,msg); } - + newframe(0); - + func1 = FtpInit.error; func2 = FtpInit.IO; - - if (trymode) + + if (trymode) { FtpSetErrorHandler(&FtpInit,Ftp_connect_hook); FtpSetIOHandler(&FtpInit,Ftp_connect_hook); setjmp(connectstack); } - + FtpConnect(&LINK,w2); strcpy(iftp[frame].host,FtpGetHost(w2)->h_name); - + FtpSetErrorHandler(LINK,func1); FtpSetErrorHandler(&FtpInit,func1); FtpSetIOHandler(LINK,func2); FtpSetIOHandler(&FtpInit,func2); - + return; } Ftp_user(ARGS) { - + if (*w2==0) { sprintf(tmp,"login (default %s):",defaultuser); w2=readline(tmp); - if (*w2==0) + if (*w2==0) w2=defaultuser; } strcpy(iftp[frame].user,w2); @@ -74,11 +74,11 @@ Ftp_user(ARGS) Ftp_pass(ARGS) { - if (*w2==0) + if (*w2==0) { String pass; String host; - + gethostname(host, sizeof host); strcpy(host,FtpGetHost(host)->h_name); sprintf(pass,"%s@%s",getpwuid(getuid())->pw_name,host); @@ -86,7 +86,7 @@ Ftp_pass(ARGS) w2=getpass(tmp); if (*w2==0) w2=pass; } - + strcpy(iftp[frame].pass,w2); FtpPassword(LINK,w2); strcpy(iftp[frame].pwd,FtpPwd(LINK)); @@ -96,11 +96,11 @@ Ftp_open(ARGS) { register char *p1; STATUS (*err)(); - + Ftp_connect("",w2,"","","",""); Ftp_user("",w3,w4,"","","" ); if (ifalias("autologin")) execute("autologin"); - if (*w5) + if (*w5) Ftp_cd("cd",w5,"","","",""); } @@ -121,11 +121,11 @@ Ftp_ftp(ARGS) { String pass; String host; - + gethostname(host, sizeof host); strcpy(host,FtpGetHost(host)->h_name); sprintf(pass,"%s@%s",getpwuid(getuid())->pw_name,host); - + Ftp_open("",w2,"anonymous",pass,w3,""); return; } @@ -147,14 +147,14 @@ Ftp_lcd(ARGS) glob_t gl; bzero(&gl,sizeof gl); - + glob(w2,GLOB_BRACE|GLOB_TILDE|GLOB_QUOTE, Ftp_mput_handler, &gl); - - + + if (gl.gl_matchc<1 || chdir(*gl.gl_pathv)) perror(w2); - + printf("Local directory is \"%s\"\n",getwd(tmp)); } @@ -163,35 +163,35 @@ Ftp_dir(ARGS) char *cmd1; String cmd; char mode=LINK->mode; - - if ( !strcmp(w1,"dir") ) + + if ( !strcmp(w1,"dir") ) cmd1="LIST"; else cmd1="NLST"; - + strcpy(cmd,makestr(cmd1,w2,w3,w4,w5,w6,NULL)); if ( LINK->mode != 'A' ) FtpAscii(LINK); FtpRetr(LINK,cmd,"","-"); if ( LINK->mode != mode ) FtpType(LINK,mode); - + } Ftp_close(ARGS) { register int i; - - if (isdigit(*w2)) + + if (isdigit(*w2)) { i=atoi(w2); } - else + else { i=frame; } - + FtpQuickBye(ftp[i]); - + iftp[i].host[0]=0; iftp[i].pwd[0]=0; ftp[i]=NULL; @@ -203,19 +203,19 @@ INLINE SetLogicalVar(char arg, int * var, char *msg) { switch(arg) { - + case 'y': - + *var=1; break; - + case 'n': - + *var=0; break; - + default: - + (*var)?(*var=0):(*var=1); break; } @@ -227,7 +227,7 @@ Ftp_set(ARGS) { if (!strcmp("frame",w2)) return atoi(w3)<NFRAMES?frame=atoi(w3):0; - + if (!strcmp("timeout",w2)) { FtpSetTimeout(&FtpInit,atoi(w3)); @@ -235,17 +235,17 @@ Ftp_set(ARGS) FtpSetTimeout(LINK,atoi(w3)); return; } - + if (!strcmp("sleep",w2)) { sleeptime=atoi(w3); return; } - + if (!strcmp("debug",w2)) { - if ( *w3=='y' || *w3==0) - { + if ( *w3=='y' || *w3==0) + { if (LINK!=NULL) FtpSetDebugHandler(LINK,FtpDebugDebug); FtpSetDebugHandler(&FtpInit,FtpDebugDebug); return puts("Debuging on for current and next session"); @@ -257,11 +257,11 @@ Ftp_set(ARGS) return puts("Debuging off for current and next session"); } } - + if (!strcmp("bin",w2)) { - if ( *w3=='y' || *w3==0) - { + if ( *w3=='y' || *w3==0) + { FtpInit.mode='I'; return puts("Binary mode enable"); } @@ -271,7 +271,7 @@ Ftp_set(ARGS) return puts("Binary mode disable"); } } - + if (!strcmp("try",w2)) return SetLogicalVar(*w3,&trymode,"Try mode"); if (!strcmp("hash",w2)) @@ -280,16 +280,16 @@ Ftp_set(ARGS) return SetLogicalVar(*w3,&glassmode,"Glass mode"); if (!strcmp("rest",w2)||!strcmp(w2,"restore")) return SetLogicalVar(*w3,&restmode,"Restore mode"); - + if (!strcmp("prompt",w2)) { strcpy(prompt,w3); return; } - + if (!strcmp("port",w2)) { - if ( isdigit(*w3)) + if ( isdigit(*w3)) return FtpSetPort(&FtpInit,atoi(w3)); puts("Port must be number"); fflush(stdout); @@ -298,7 +298,7 @@ Ftp_set(ARGS) if (!strcmp("noopinterval",w2)||!strcmp("noop",w2)) { - if ( isdigit(*w3)) + if ( isdigit(*w3)) return noopinterval=(time_t)atoi(w3); puts("Time must be number"); fflush(stdout); @@ -307,21 +307,21 @@ Ftp_set(ARGS) if (!strcmp("nooptimeout",w2)) { - if ( isdigit(*w3)) + if ( isdigit(*w3)) return nooptimeout=(time_t)atoi(w3); puts("Time must be number"); fflush(stdout); return; } - + if (!strcmp("user",w2)||!strcmp("login",w2)) { strcpy(defaultuser,w3); return; } - + if (!strcmp("",w2)) { @@ -342,8 +342,8 @@ Ftp_set(ARGS) fflush(stdout); return; } - return puts("arg 2 unknown"); - + return puts("arg 2 unknown"); + } jmp_buf getstack; @@ -351,13 +351,13 @@ jmp_buf getstack; Ftp_get_hook(FTP *con,int code, char *msg) { - if ( abs(code)==550 && FtpBadReply550(msg) ) + if ( abs(code)==550 && FtpBadReply550(msg) ) { FtpLog(con->title,msg); log("Transfer cancel"); longjmp(getstack,2); } - + if ( code == LQUIT ) { log(msg); @@ -366,7 +366,7 @@ Ftp_get_hook(FTP *con,int code, char *msg) } - + FtpLog(con->title,msg); FtpQuickBye(LINK); LINK=NULL; @@ -374,11 +374,11 @@ Ftp_get_hook(FTP *con,int code, char *msg) log("sleeping......"); sleep(sleeptime); log("try again..."); - + longjmp(getstack,1); - + } - + void Ftp_get_intr(int sig) { signal(SIGINT,intr); @@ -393,19 +393,19 @@ Ftp_get(ARGS) int back=0; int code; int status=0; - + OldInit=FtpInit; - + if (strstr(w1,"put")!=NULL) back=1; - - + + if (restmode || ((*w1=='r')&&(*(w1+1)=='e')) ) FtpSetFlag(LINK,FTP_REST); else - FtpClearFlag(LINK,FTP_REST); - - - + FtpClearFlag(LINK,FTP_REST); + + + if (trymode) { FtpSetErrorHandler(LINK,Ftp_get_hook); @@ -414,28 +414,28 @@ Ftp_get(ARGS) FTPCMD(&FtpInit)=FTPCMD(&OldInit); FTPDATA(&FtpInit)=FTPDATA(&OldInit); } - + signal(SIGINT,Ftp_get_intr); FtpSetHashHandler(LINK,NULL); - - - if ((status=setjmp(getstack))==2||status==3) + + + if ((status=setjmp(getstack))==2||status==3) goto done; - + if ((LINK==NULL)||(LINK->sock==FtpInit.sock)) { FtpLogin(&LINK,iftp[frame].host,iftp[frame].user, - iftp[frame].pass,NULL); + iftp[frame].pass,NULL); FtpChdir(LINK,iftp[frame].pwd); } - + if (hashmode && isatty(fileno(stdout))) FtpSetHashHandler(LINK,myhash); else FtpSetHashHandler(LINK,NULL); - + myhash(LINK,0); - + if (!back) FtpGet(LINK,w2,makefilename(w2,w3)); else @@ -443,15 +443,15 @@ Ftp_get(ARGS) log("Transfer compliete"); - - + + done: - - + + FtpSetHashHandler(LINK,NULL); FtpSetErrorHandler(LINK,my_error); FtpSetIOHandler(LINK,my_error); - FtpClearFlag(LINK,FTP_REST); + FtpClearFlag(LINK,FTP_REST); FtpInit=OldInit; } @@ -459,7 +459,7 @@ Ftp_mget(ARGS) { FILE *list; char mode=LINK->mode; - + sprintf(tmp,"/tmp/uftplist-%s.XXXXXX",getpwuid(getuid())->pw_name); mktemp(tmp); @@ -487,10 +487,10 @@ Ftp_mget(ARGS) Ftp_mput(ARGS) { glob_t gl; - + glob(w2,GLOB_BRACE|GLOB_TILDE|GLOB_QUOTE, Ftp_mput_handler, &gl); - + while(gl.gl_matchc--) { Ftp_get("put",*gl.gl_pathv,"","","",""); @@ -501,51 +501,51 @@ Ftp_mput(ARGS) Ftp_bget(ARGS) { - + String fn,lfn; char *p; newframe(0); - + if (!FtpFullSyntax(w2,iftp[frame].host,iftp[frame].user, iftp[frame].pass,fn)) return puts("Filename syntax error"); - + strcpy(iftp[frame].pwd,"/"); - - if ((p=strrchr(fn,'/'))!=NULL) + + if ((p=strrchr(fn,'/'))!=NULL) strcpy(lfn,p+1); else strcpy(lfn,fn); - + FtpQuickBye(LINK); LINK=FtpCreateObject(); LINK->sock=NULL; - + Ftp_get("get",fn,(*w3==0)?lfn:w3,"","",""); } Ftp_bput(ARGS) { - + String fn,lfn; char *p; if (!FtpFullSyntax((*w3==0)?w2:w3,iftp[frame].host,iftp[frame].user, iftp[frame].pass,fn)) return puts("Filename syntax error"); - + strcpy(iftp[frame].pwd,"/"); - - if ((p=strrchr(fn,'/'))!=NULL) + + if ((p=strrchr(fn,'/'))!=NULL) strcpy(lfn,p+1); else strcpy(lfn,fn); - + FtpQuickBye(LINK); LINK=FtpCreateObject(); LINK->sock=NULL; - + Ftp_get("put",(*w3==0)?lfn:w2,fn,"","",""); } @@ -553,10 +553,10 @@ Ftp_copy(ARGS) { char *p; int in,out; - + if ( !*w2 || !*w3 ) return puts("Must pass two args"); - - if ((p=strchr(w2,'!'))!=NULL) + + if ((p=strchr(w2,'!'))!=NULL) { *p=0; in=atoi(w2); @@ -565,7 +565,7 @@ Ftp_copy(ARGS) else in=frame; - if ((p=strchr(w3,'!'))!=NULL) + if ((p=strchr(w3,'!'))!=NULL) { *p=0; out=atoi(w3); @@ -573,9 +573,9 @@ Ftp_copy(ARGS) } else in=frame; - + if (in==out) return puts("Files must been from different frames"); - + FtpCopy(ftp[in],ftp[out],w2,w3); } @@ -583,10 +583,10 @@ Ftp_ccopy(ARGS) { char *p; int in,out; - + if ( !*w2 || !*w3 ) return puts("Must pass two args"); - - if ((p=strchr(w2,'!'))!=NULL) + + if ((p=strchr(w2,'!'))!=NULL) { *p=0; in=atoi(w2); @@ -595,7 +595,7 @@ Ftp_ccopy(ARGS) else in=frame; - if ((p=strchr(w3,'!'))!=NULL) + if ((p=strchr(w3,'!'))!=NULL) { *p=0; out=atoi(w3); @@ -603,9 +603,9 @@ Ftp_ccopy(ARGS) } else in=frame; - + if (in==out) return puts("Files must been from different frames"); - + FtpPassiveTransfer(ftp[in],ftp[out],w2,w3); } @@ -628,17 +628,17 @@ Ftp_cd(ARGS) Ftp_dup(ARGS) -{ +{ LINKINFO oldinfo; FTP oldftp; - + oldinfo=iftp[frame]; oldftp=*LINK; - + newframe(0); puts("Make alternative connection..."); Ftp_open("",oldinfo.host,oldinfo.user,oldinfo.pass,"",""); - if (strcmp(oldinfo.pwd,iftp[frame].pwd)) + if (strcmp(oldinfo.pwd,iftp[frame].pwd)) Ftp_cd("",oldinfo.pwd,"","","",""); if (LINK->mode!=oldftp.mode) FtpType(LINK,oldftp.mode); @@ -649,23 +649,23 @@ Ftp_dup(ARGS) FtpSetIOHandler(LINK,oldftp.IO); FtpSetHashHandler(LINK,oldftp.hash); } - - + + Ftp_bg(ARGS) { if (fork()) { - + log("Backgrounding..."); return; } else { int i=frame; - + lastcmd=1; - + /* Ignoring keypad */ alarm (0); @@ -680,7 +680,7 @@ Ftp_bg(ARGS) /* Droping output */ - + sprintf(tmp,"/tmp/uftp-%s.XXXXXX",getpwuid(getuid())->pw_name); mktemp(tmp); close(0);close(1);close(2); @@ -693,21 +693,21 @@ Ftp_bg(ARGS) free(ftp[i]); ftp[i]=NULL; } - + return executev(w2,w3,w4,w5,w6,""); } } - + Ftp_list() { register int i; - -#define _FMT "%-5s %-15s %-10s %-25s %-7s %-4s\n" -#define FMT "%-5d %-15s %-10s %-25s %-7d %-4d\n" - + +#define _FMT "%-5s %-15s %-10s %-25s %-7s %-4s\n" +#define FMT "%-5d %-15s %-10s %-25s %-7d %-4d\n" + printf(_FMT,"Frame","Host name","User's name","Working directory","Timeout","Port"); - + for ( i = 0 ; i < NFRAMES ; i++ ) if (ftp[i]!=NULL) printf(FMT,i,iftp[i].host,iftp[i].user,iftp[i].pwd, @@ -739,10 +739,10 @@ Ftp_page(ARGS) { register char *pager; String out={'|',0}; - - if ((pager=(char *)getenv("PAGER"))==NULL) + + if ((pager=(char *)getenv("PAGER"))==NULL) pager="more"; - + strcat(out,pager); FtpGet(LINK,w2,out); } @@ -759,24 +759,24 @@ Ftp_rm(ARGS) sprintf(tmp,"/tmp/uftplist-%s.XXXXXX",getpwuid(getuid())->pw_name); mktemp(tmp); - - if (*w2==0) + + if (*w2==0) { log("Filename specification must present"); return; } - + FtpRetr(LINK,"NLST %s",w2,tmp); - + if ((list=fopen(tmp,"r"))==NULL) return FtpLog(tmp,sys_errlist[errno]); - + while ( fgets(tmp,sizeof tmp,list)!=NULL) { tmp[strlen(tmp)-1]=0; FtpCommand(LINK,"DELE %s",tmp,0,EOF); } - + fclose(list); } @@ -791,7 +791,7 @@ Ftp_move(ARGS) Ftp_help(ARGS) { register int i,ii; - + if ( !*w2 ) { puts("Warrning!!!! \nPlease read general information using command \"help etc\"\n\n"); @@ -806,7 +806,7 @@ Ftp_help(ARGS) putchar ('\n'); } } - + for ( i = 0 ; 1; i++) { @@ -817,13 +817,13 @@ Ftp_help(ARGS) } puts(cmds[i].help); - + } Ftp_quote(ARGS) { String new; - + new[0]=0; if (*w2!=0) strcpy(new,w2); @@ -838,8 +838,8 @@ Ftp_quote(ARGS) Ftp_alias(ARGS) { ALIAS *a=firstalias; - - + + if ( *w2==0 ) { while (a!=NULL) @@ -851,20 +851,20 @@ Ftp_alias(ARGS) } - while (1) + while (1) { if ( a == NULL ) - { + { firstalias = a = (ALIAS *) malloc(sizeof(ALIAS)); memset(a,0,sizeof(ALIAS)); a -> next = NULL; break; } - + if (!strcmp(a->name,w2)) break; - + if ( a->next == NULL) { a -> next = (ALIAS *) malloc(sizeof(ALIAS)); @@ -875,7 +875,7 @@ Ftp_alias(ARGS) } a=a->next; } - + strcpy(a -> name,w2); strcpy(a -> str,makestr(w3,w4,w5,w6,NULL)); } @@ -889,7 +889,7 @@ Ftp_mkalias(ARGS) sprintf(new,"open \"%s\" \"%s\" \"%s\" \"%s\"", iftp[frame].host,iftp[frame].user, iftp[frame].pass,iftp[frame].pwd); - + Ftp_alias("alias",w2,new,"","",""); } @@ -947,31 +947,31 @@ Ftp_acd(ARGS) static int targets=0; static String what={0}; static ARCHIE result[ARCHIE_MAX_TARGETS]; - + int i, selected_target; String tmp; char *p; - + if ( (what[0] == 0 || strcmp(w2,what) != 0) && *w2!=0 ) { - if ((targets=FtpArchie(w2,result,ARCHIE_MAX_TARGETS))<1) + if ((targets=FtpArchie(w2,result,ARCHIE_MAX_TARGETS))<1) return puts("Archie failure or target not found"); strcpy(what,w2); } - + for (i=0;i<targets;i++) printf("%2d %s:%s\n",i,result[i].host,result[i].file); - + if (strcmp(w1,"archie")==0) return; - - + + p = readline("Your selection? "); if (p==NULL) return; - + selected_target = atoi(p); - + if ( result[selected_target].file[strlen(result[selected_target].file)-1] == '/' ) { @@ -989,25 +989,25 @@ Ftp_acd(ARGS) CMDS cmds[]={ - + "connect", Ftp_connect, 0, "connect <hostname> - make new ftp connection", "open", Ftp_open, 0, "open <hostname> <user> <pass> <directory> - login to server", - + "reopen", Ftp_reopen, 1, "Open again connection with existing frame information", - + "ftp", Ftp_ftp, 0, "ftp <hostname> - anonymously login to server", - + "close", Ftp_close, 1, "Close connection", - + "quit", Ftp_quit, 0, "Exit from uftp", - + "set", Ftp_set, 0, "Set variables: (Without args print current settings)\n\ frame <number> - select another session(frame)\n\ @@ -1028,7 +1028,7 @@ CMDS cmds[]={ "prompt", NULL, 0, "\ -prompt is a string, which may be contains %<char> +prompt is a string, which may be contains %<char> or ^<char> combitanion, which have next interprets: %H, %h - full and short remote host names @@ -1038,8 +1038,8 @@ or ^<char> combitanion, which have next interprets: %D - local current directory %f - number of current frame %p - the ftp's port number -%t - timeout -%T - current time +%t - timeout +%T - current time %P - uftp process id %% - character % ^<char>- control character @@ -1114,7 +1114,7 @@ or ^<char> combitanion, which have next interprets: "bput", Ftp_bput, 0, "bput [<localfile>] <libftp_file> - full session procedure (See \"help etc\")", - + "copy", Ftp_copy, 1, "copy [<frame>!]file [<frame>!]file - copy file via client cache", @@ -1123,7 +1123,7 @@ or ^<char> combitanion, which have next interprets: "cat", Ftp_type, 1, "cat <file> - print body of remote file to screen", - + "page", Ftp_page, 1, "page <file> - print body of remote file to screen via pager", diff --git a/lib/libkvm/kvm.c b/lib/libkvm/kvm.c index 8eb0056acb9a..753d06a6017d 100644 --- a/lib/libkvm/kvm.c +++ b/lib/libkvm/kvm.c @@ -232,7 +232,7 @@ _kvm_open(kd, uf, mf, sf, flag, errout) * If the database cannot be opened, open the namelist * argument so we revert to slow nlist() calls. */ - if (kvm_dbopen(kd, uf) < 0 && + if (kvm_dbopen(kd, uf) < 0 && (kd->nlfd = open(uf, O_RDONLY, 0)) < 0) { _kvm_syserr(kd, kd->program, "%s", uf); goto failed; @@ -328,7 +328,7 @@ kvm_close(kd) /* * Set up state necessary to do queries on the kernel namelist - * data base. If the data base is out-of-data/incompatible with + * data base. If the data base is out-of-data/incompatible with * given executable, set up things so we revert to standard nlist call. * Only called for live kernels. Return 0 on success, -1 on failure. */ @@ -376,7 +376,7 @@ kvm_dbopen(kd, uf) if (rec.data == 0 || rec.size != sizeof(struct nlist)) goto close; bcopy((char *)rec.data, (char *)&nitem, sizeof(nitem)); - if (kvm_read(kd, (u_long)nitem.n_value, kversion, dbversionlen) != + if (kvm_read(kd, (u_long)nitem.n_value, kversion, dbversionlen) != dbversionlen) goto close; /* @@ -401,7 +401,7 @@ kvm_nlist(kd, nl) register int nvalid; /* - * If we can't use the data base, revert to the + * If we can't use the data base, revert to the * slow library call. */ if (kd->db == 0) @@ -432,10 +432,10 @@ kvm_nlist(kd, nl) * Avoid alignment issues. */ bcopy((char *)&((struct nlist *)rec.data)->n_type, - (char *)&p->n_type, + (char *)&p->n_type, sizeof(p->n_type)); bcopy((char *)&((struct nlist *)rec.data)->n_value, - (char *)&p->n_value, + (char *)&p->n_value, sizeof(p->n_value)); } /* @@ -475,7 +475,7 @@ kvm_read(kd, kva, buf, len) cp = buf; while (len > 0) { u_long pa; - + cc = _kvm_kvatop(kd, kva, &pa); if (cc == 0) return (0); diff --git a/lib/libkvm/kvm_amd64.c b/lib/libkvm/kvm_amd64.c index e944cedc635b..e8e3cf377baa 100644 --- a/lib/libkvm/kvm_amd64.c +++ b/lib/libkvm/kvm_amd64.c @@ -40,7 +40,7 @@ static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ /* - * i386 machine dependent routines for kvm. Hopefully, the forthcoming + * i386 machine dependent routines for kvm. Hopefully, the forthcoming * vm code will one day obsolete this module. */ diff --git a/lib/libkvm/kvm_file.c b/lib/libkvm/kvm_file.c index 1e1d6bd60a3b..69e0aa30be60 100644 --- a/lib/libkvm/kvm_file.c +++ b/lib/libkvm/kvm_file.c @@ -36,7 +36,7 @@ static char sccsid[] = "@(#)kvm_file.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ /* - * File list interface for kvm. pstat, fstat and netstat are + * File list interface for kvm. pstat, fstat and netstat are * users of this code, so we've factored it out into a separate module. * Thus, we keep this grunge out of the other kvm applications (i.e., * most other applications are interested only in open/close/read/nlist). diff --git a/lib/libkvm/kvm_hp300.c b/lib/libkvm/kvm_hp300.c index 2154a23f3007..c84691ee1b03 100644 --- a/lib/libkvm/kvm_hp300.c +++ b/lib/libkvm/kvm_hp300.c @@ -40,7 +40,7 @@ static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ /* - * Hp300 machine dependent routines for kvm. Hopefully, the forthcoming + * Hp300 machine dependent routines for kvm. Hopefully, the forthcoming * vm code will one day obsolete this module. */ @@ -161,7 +161,7 @@ _kvm_vatop(kd, sta, va, pa) addr = (u_long)&sta[va >> SG4_SHIFT1]; /* * Can't use KREAD to read kernel segment table entries. - * Fortunately it is 1-to-1 mapped so we don't have to. + * Fortunately it is 1-to-1 mapped so we don't have to. */ if (sta == vm->Sysseg) { if (lseek(kd->pmfd, (off_t)addr, 0) == -1 || @@ -180,7 +180,7 @@ _kvm_vatop(kd, sta, va, pa) * Address from level 1 STE is a physical address, * so don't use kvm_read. */ - if (lseek(kd->pmfd, (off_t)(addr - lowram), 0) == -1 || + if (lseek(kd->pmfd, (off_t)(addr - lowram), 0) == -1 || read(kd->pmfd, (char *)&ste, sizeof(ste)) < 0) goto invalid; if ((ste & SG_V) == 0) { @@ -194,7 +194,7 @@ _kvm_vatop(kd, sta, va, pa) addr = (u_long)&sta[va >> SEGSHIFT]; /* * Can't use KREAD to read kernel segment table entries. - * Fortunately it is 1-to-1 mapped so we don't have to. + * Fortunately it is 1-to-1 mapped so we don't have to. */ if (sta == vm->Sysseg) { if (lseek(kd->pmfd, (off_t)addr, 0) == -1 || @@ -212,7 +212,7 @@ _kvm_vatop(kd, sta, va, pa) /* * Address from STE is a physical address so don't use kvm_read. */ - if (lseek(kd->pmfd, (off_t)(addr - lowram), 0) == -1 || + if (lseek(kd->pmfd, (off_t)(addr - lowram), 0) == -1 || read(kd->pmfd, (char *)&pte, sizeof(pte)) < 0) goto invalid; addr = pte & PG_FRAME; @@ -221,7 +221,7 @@ _kvm_vatop(kd, sta, va, pa) return (0); } *pa = addr - lowram + offset; - + return (NBPG - offset); invalid: _kvm_err(kd, 0, "invalid address (%x)", va); diff --git a/lib/libkvm/kvm_i386.c b/lib/libkvm/kvm_i386.c index e944cedc635b..e8e3cf377baa 100644 --- a/lib/libkvm/kvm_i386.c +++ b/lib/libkvm/kvm_i386.c @@ -40,7 +40,7 @@ static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ /* - * i386 machine dependent routines for kvm. Hopefully, the forthcoming + * i386 machine dependent routines for kvm. Hopefully, the forthcoming * vm code will one day obsolete this module. */ diff --git a/lib/libkvm/kvm_mips.c b/lib/libkvm/kvm_mips.c index b0f4cfe31b7a..208798185b40 100644 --- a/lib/libkvm/kvm_mips.c +++ b/lib/libkvm/kvm_mips.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)kvm_mips.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ /* - * MIPS machine dependent routines for kvm. Hopefully, the forthcoming + * MIPS machine dependent routines for kvm. Hopefully, the forthcoming * vm code will one day obsolete this module. */ @@ -146,7 +146,7 @@ _kvm_kvatop(kd, va, pa) addr = (u_long)(vm->Sysmap + ((va - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT)); /* * Can't use KREAD to read kernel segment table entries. - * Fortunately it is 1-to-1 mapped so we don't have to. + * Fortunately it is 1-to-1 mapped so we don't have to. */ if (lseek(kd->pmfd, (off_t)addr, 0) < 0 || read(kd->pmfd, (char *)&pte, sizeof(pte)) < 0) diff --git a/lib/libkvm/kvm_proc.c b/lib/libkvm/kvm_proc.c index bc4952e688d2..6b29d4041e51 100644 --- a/lib/libkvm/kvm_proc.c +++ b/lib/libkvm/kvm_proc.c @@ -116,7 +116,7 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) &eproc.e_ucred); switch(what) { - + case KERN_PROC_PID: if (proc.p_pid != (pid_t)arg) continue; @@ -154,7 +154,7 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) eproc.e_pgid = pgrp.pg_id; eproc.e_jobc = pgrp.pg_jobc; if (KREAD(kd, (u_long)pgrp.pg_session, &sess)) { - _kvm_err(kd, kd->program, "can't read session at %x", + _kvm_err(kd, kd->program, "can't read session at %x", pgrp.pg_session); return (-1); } @@ -169,7 +169,7 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) if (tty.t_pgrp != NULL) { if (KREAD(kd, (u_long)tty.t_pgrp, &pgrp)) { _kvm_err(kd, kd->program, - "can't read tpgrp at &x", + "can't read tpgrp at &x", tty.t_pgrp); return (-1); } @@ -182,7 +182,7 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) if (sess.s_leader == p) eproc.e_flag |= EPROC_SLEADER; if (proc.p_wmesg) - (void)kvm_read(kd, (u_long)proc.p_wmesg, + (void)kvm_read(kd, (u_long)proc.p_wmesg, eproc.e_wmesg, WMESGLEN); #ifdef sparc @@ -207,7 +207,7 @@ kvm_proclist(kd, what, arg, p, bp, maxcnt) break; case KERN_PROC_TTY: - if ((proc.p_flag & P_CONTROLT) == 0 || + if ((proc.p_flag & P_CONTROLT) == 0 || eproc.e_tdev != (dev_t)arg) continue; break; @@ -265,7 +265,7 @@ kvm_getprocs(kd, op, arg, cnt) if (kd->procbase != 0) { free((void *)kd->procbase); - /* + /* * Clear this pointer in case this call fails. Otherwise, * kvm_close() will free it again. */ @@ -361,7 +361,7 @@ _kvm_realloc(kd, p, n) /* * Read in an argument vector from the user address space of process p. - * addr is the user-space base address of narg null-terminated contiguous + * addr is the user-space base address of narg null-terminated contiguous * strings. This is used to read in both the command arguments and * environment strings. Read at most maxcnt characters of strings. */ @@ -389,13 +389,13 @@ kvm_argv(kd, p, addr, narg, maxcnt) * Try to avoid reallocs. */ kd->argc = MAX(narg + 1, 32); - kd->argv = (char **)_kvm_malloc(kd, kd->argc * + kd->argv = (char **)_kvm_malloc(kd, kd->argc * sizeof(*kd->argv)); if (kd->argv == 0) return (0); } else if (narg + 1 > kd->argc) { kd->argc = MAX(2 * kd->argc, narg + 1); - kd->argv = (char **)_kvm_realloc(kd, kd->argv, kd->argc * + kd->argv = (char **)_kvm_realloc(kd, kd->argv, kd->argc * sizeof(*kd->argv)); if (kd->argv == 0) return (0); @@ -505,7 +505,7 @@ proc_verify(kd, kernp, p) * Just read in the whole proc. It's not that big relative * to the cost of the read system call. */ - if (kvm_read(kd, kernp, (char *)&kernproc, sizeof(kernproc)) != + if (kvm_read(kd, kernp, (char *)&kernproc, sizeof(kernproc)) != sizeof(kernproc)) return (0); return (p->p_pid == kernproc.p_pid && @@ -528,7 +528,7 @@ kvm_doargv(kd, kp, nchr, info) /* * Pointers are stored at the top of the user stack. */ - if (p->p_stat == SZOMB || + if (p->p_stat == SZOMB || kvm_uread(kd, p, USRSTACK - sizeof(arginfo) - SPARE_USRSPACE, (char *)&arginfo, sizeof(arginfo)) != sizeof(arginfo)) return (0); @@ -592,7 +592,7 @@ kvm_uread(kd, p, uva, buf, len) return (0); } - + while (len > 0) { if (lseek(fd, (off_t)uva, 0) == -1 && errno != 0) { _kvm_err(kd, kd->program, "invalid address (%x) in %s", uva, procfile); diff --git a/lib/libkvm/kvm_sparc.c b/lib/libkvm/kvm_sparc.c index 5275068b6ea3..a7b9594841b6 100644 --- a/lib/libkvm/kvm_sparc.c +++ b/lib/libkvm/kvm_sparc.c @@ -40,7 +40,7 @@ static char sccsid[] = "@(#)kvm_sparc.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ /* - * Sparc machine dependent routines for kvm. Hopefully, the forthcoming + * Sparc machine dependent routines for kvm. Hopefully, the forthcoming * vm code will one day obsolete this module. */ @@ -107,7 +107,7 @@ _kvm_initvtop(kd) */ off = st.st_size - ctob(btoc(sizeof(vm->segmap))); errno = 0; - if (lseek(kd->pmfd, (off_t)off, 0) == -1 && errno != 0 || + if (lseek(kd->pmfd, (off_t)off, 0) == -1 && errno != 0 || read(kd->pmfd, (char *)vm->segmap, sizeof(vm->segmap)) < 0) { _kvm_err(kd, kd->program, "cannot read segment map"); return (-1); @@ -118,7 +118,7 @@ _kvm_initvtop(kd) off = st.st_size - ctob(btoc(sizeof(vm->pmeg)) + btoc(sizeof(vm->segmap))); errno = 0; - if (lseek(kd->pmfd, (off_t)off, 0) == -1 && errno != 0 || + if (lseek(kd->pmfd, (off_t)off, 0) == -1 && errno != 0 || read(kd->pmfd, (char *)vm->pmeg, sizeof(vm->pmeg)) < 0) { _kvm_err(kd, kd->program, "cannot read PMEG table"); return (-1); @@ -127,7 +127,7 @@ _kvm_initvtop(kd) * Make pmap_stod be an identity map so we can bootstrap it in. * We assume it's in the first contiguous chunk of physical memory. */ - for (i = 0; i < BTSIZE; ++i) + for (i = 0; i < BTSIZE; ++i) vm->pmap_stod[i] = i << 4; /* @@ -142,7 +142,7 @@ _kvm_initvtop(kd) _kvm_err(kd, kd->program, "pmap_stod: no such symbol"); return (-1); } - if (kvm_read(kd, (u_long)nlist[0].n_value, + if (kvm_read(kd, (u_long)nlist[0].n_value, (char *)vm->pmap_stod, sizeof(vm->pmap_stod)) != sizeof(vm->pmap_stod)) { _kvm_err(kd, kd->program, "cannot read pmap_stod"); @@ -194,7 +194,7 @@ _kvm_uvatop(kd, p, va, pa) frame = pte & PG_PFNUM; else frame = HWTOSW(kd->vmst->pmap_stod, pte & PG_PFNUM); - *pa = (frame << PGSHIFT) | off; + *pa = (frame << PGSHIFT) | off; return (NBPG - off); } invalid: @@ -205,7 +205,7 @@ invalid: /* * Translate a kernel virtual address to a physical address using the * mapping information in kd->vm. Returns the result in pa, and returns - * the number of bytes that are contiguously available from this + * the number of bytes that are contiguously available from this * physical address. This routine is used only for crashdumps. */ int diff --git a/lib/libm/common/atan2.c b/lib/libm/common/atan2.c index 958a15472603..b847a1d36623 100644 --- a/lib/libm/common/atan2.c +++ b/lib/libm/common/atan2.c @@ -38,21 +38,21 @@ static char sccsid[] = "@(#)atan2.c 8.1 (Berkeley) 6/4/93"; /* ATAN2(Y,X) * RETURN ARG (X+iY) * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) - * CODED IN C BY K.C. NG, 1/8/85; + * CODED IN C BY K.C. NG, 1/8/85; * REVISED BY K.C. NG on 2/7/85, 2/13/85, 3/7/85, 3/30/85, 6/29/85. * * Required system supported functions : * copysign(x,y) * scalb(x,y) * logb(x) - * + * * Method : * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). - * 2. Reduce x to positive by (if x and y are unexceptional): + * 2. Reduce x to positive by (if x and y are unexceptional): * ARG (x+iy) = arctan(y/x) ... if x > 0, * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, - * 3. According to the integer k=4t+0.25 truncated , t=y/x, the argument - * is further reduced to one of the following intervals and the + * 3. According to the integer k=4t+0.25 truncated , t=y/x, the argument + * is further reduced to one of the following intervals and the * arctangent of y/x is evaluated by the corresponding formula: * * [0,7/16] atan(y/x) = t - t^3*(a1+t^2*(a2+...(a10+t^2*a11)...) @@ -76,32 +76,32 @@ static char sccsid[] = "@(#)atan2.c 8.1 (Berkeley) 6/4/93"; * ARG( (anything but,0,NaN, and INF),+-INF ) is +-PI/2; * * Accuracy: - * atan2(y,x) returns (PI/pi) * the exact ARG (x+iy) nearly rounded, + * atan2(y,x) returns (PI/pi) * the exact ARG (x+iy) nearly rounded, * where * * in decimal: - * pi = 3.141592653589793 23846264338327 ..... + * pi = 3.141592653589793 23846264338327 ..... * 53 bits PI = 3.141592653589793 115997963 ..... , - * 56 bits PI = 3.141592653589793 227020265 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , * * in hexadecimal: * pi = 3.243F6A8885A308D313198A2E.... * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 error=.276ulps * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 error=.206ulps - * + * * In a test run with 356,000 random argument on [-1,1] * [-1,1] on a * VAX, the maximum observed error was 1.41 ulps (units of the last place) * compared with (PI/pi)*(the exact ARG(x+iy)). * * Note: * We use machine PI (the true pi rounded) in place of the actual - * value of pi for all the trig and inverse trig functions. In general, - * if trig is one of sin, cos, tan, then computed trig(y) returns the - * exact trig(y*pi/PI) nearly rounded; correspondingly, computed arctrig - * returns the exact arctrig(y)*PI/pi nearly rounded. These guarantee the + * value of pi for all the trig and inverse trig functions. In general, + * if trig is one of sin, cos, tan, then computed trig(y) returns the + * exact trig(y*pi/PI) nearly rounded; correspondingly, computed arctrig + * returns the exact arctrig(y)*PI/pi nearly rounded. These guarantee the * trig functions have period PI, and trig(arctrig(x)) returns x for * all critical values x. - * + * * Constants: * The hexadecimal values are the intended ones for the following constants. * The decimal values may be used, provided that the compiler will convert @@ -174,7 +174,7 @@ ic(a11, 1.6438029044759730479E-2 , -6, 1.0D52174A1BB54) double atan2(y,x) double y,x; -{ +{ static const double zero=0, one=1, small=1.0E-9, big=1.0E18; double t,z,signy,signx,hi,lo; int k,m; @@ -185,8 +185,8 @@ double y,x; #endif /* !defined(vax)&&!defined(tahoe) */ /* copy down the sign of y and x */ - signy = copysign(one,y) ; - signx = copysign(one,x) ; + signy = copysign(one,y) ; + signx = copysign(one,x) ; /* if x is 1.0, goto begin */ if(x==1) { y=copysign(y,one); t=y; if(finite(t)) goto begin;} @@ -196,10 +196,10 @@ double y,x; /* when x = 0 */ if(x==zero) return(copysign(PIo2,signy)); - + /* when x is INF */ if(!finite(x)) - if(!finite(y)) + if(!finite(y)) return(copysign((signx==one)?PIo4:3*PIo4,signy)); else return(copysign((signx==one)?zero:PI,signy)); @@ -208,43 +208,43 @@ double y,x; if(!finite(y)) return(copysign(PIo2,signy)); /* compute y/x */ - x=copysign(x,one); - y=copysign(y,one); - if((m=(k=logb(y))-logb(x)) > 60) t=big+big; + x=copysign(x,one); + y=copysign(y,one); + if((m=(k=logb(y))-logb(x)) > 60) t=big+big; else if(m < -80 ) t=y/x; else { t = y/x ; y = scalb(y,-k); x=scalb(x,-k); } /* begin argument reduction */ begin: - if (t < 2.4375) { + if (t < 2.4375) { /* truncate 4(t+1/16) to integer for branching */ k = 4 * (t+0.0625); switch (k) { /* t is in [0,7/16] */ - case 0: + case 0: case 1: - if (t < small) + if (t < small) { big + small ; /* raise inexact flag */ return (copysign((signx>zero)?t:PI-t,signy)); } hi = zero; lo = zero; break; /* t is in [7/16,11/16] */ - case 2: + case 2: hi = athfhi; lo = athflo; z = x+x; t = ( (y+y) - x ) / ( z + y ); break; /* t is in [11/16,19/16] */ - case 3: + case 3: case 4: hi = PIo4; lo = zero; t = ( y - x ) / ( x + y ); break; /* t is in [19/16,39/16] */ - default: + default: hi = at1fhi; lo = at1flo; z = y-x; y=y+y+y; t = x+x; t = ( (z+z)-x ) / ( t + y ); break; @@ -252,7 +252,7 @@ begin: } /* end of if (t < 2.4375) */ - else + else { hi = PIo2; lo = zero; @@ -260,7 +260,7 @@ begin: if (t <= big) t = - x / y; /* t is in [big, INF] */ - else + else { big+small; /* raise inexact flag */ t = zero; } } diff --git a/lib/libm/common/sincos.c b/lib/libm/common/sincos.c index ab885607cfaf..fc3561824235 100644 --- a/lib/libm/common/sincos.c +++ b/lib/libm/common/sincos.c @@ -67,7 +67,7 @@ double x; } double -cos(x) +cos(x) double x; { double a,c,z,s = 1.0; @@ -83,7 +83,7 @@ double x; } else { /* ... in [PI/4,3PI/4] */ a = PIo2-a; - return a+a*sin__S(a*a); /* rtn. S(PI/2-|x|) */ + return a+a*sin__S(a*a); /* rtn. S(PI/2-|x|) */ } } if (a < small) { diff --git a/lib/libm/common/tan.c b/lib/libm/common/tan.c index 61ed5c55c744..7b49bce57de7 100644 --- a/lib/libm/common/tan.c +++ b/lib/libm/common/tan.c @@ -37,7 +37,7 @@ static char sccsid[] = "@(#)tan.c 8.1 (Berkeley) 6/4/93"; #include "trig.h" double -tan(x) +tan(x) double x; { double a,z,ss,cc,c; diff --git a/lib/libm/common/trig.h b/lib/libm/common/trig.h index 9e05b0ea0d0f..e31fb4c25bbc 100644 --- a/lib/libm/common/trig.h +++ b/lib/libm/common/trig.h @@ -67,7 +67,7 @@ static const double zero = 0, one = 1, negone = -1, - half = 1.0/2.0, + half = 1.0/2.0, small = 1E-10, /* 1+small**2 == 1; better values for small: * small = 1.5E-9 for VAX D * = 1.2E-8 for IEEE Double @@ -77,27 +77,27 @@ static const double /* sin__S(x*x) ... re-implemented as a macro * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) - * STATIC KERNEL FUNCTION OF SIN(X), COS(X), AND TAN(X) - * CODED IN C BY K.C. NG, 1/21/85; + * STATIC KERNEL FUNCTION OF SIN(X), COS(X), AND TAN(X) + * CODED IN C BY K.C. NG, 1/21/85; * REVISED BY K.C. NG on 8/13/85. * * sin(x*k) - x * RETURN --------------- on [-PI/4,PI/4] , where k=pi/PI, PI is the rounded - * x + * x * value of pi in machine precision: * * Decimal: - * pi = 3.141592653589793 23846264338327 ..... + * pi = 3.141592653589793 23846264338327 ..... * 53 bits PI = 3.141592653589793 115997963 ..... , - * 56 bits PI = 3.141592653589793 227020265 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , * * Hexadecimal: * pi = 3.243F6A8885A308D313198A2E.... * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 - * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 + * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 * * Method: - * 1. Let z=x*x. Create a polynomial approximation to + * 1. Let z=x*x. Create a polynomial approximation to * (sin(k*x)-x)/x = z*(S0 + S1*z^1 + ... + S5*z^5). * Then * sin__S(x*x) = z*(S0 + S1*z^1 + ... + S5*z^5) @@ -105,8 +105,8 @@ static const double * The coefficient S's are obtained by a special Remez algorithm. * * Accuracy: - * In the absence of rounding error, the approximation has absolute error - * less than 2**(-61.11) for VAX D FORMAT, 2**(-57.45) for IEEE DOUBLE. + * In the absence of rounding error, the approximation has absolute error + * less than 2**(-61.11) for VAX D FORMAT, 2**(-57.45) for IEEE DOUBLE. * * Constants: * The hexadecimal values are the intended ones for the following constants. @@ -149,28 +149,28 @@ ic(S5, 1.5868926979889205164E-10 , -33, 1.5CF61DF672B13) /* cos__C(x*x) ... re-implemented as a macro * DOUBLE PRECISION (VAX D FORMAT 56 BITS, IEEE DOUBLE 53 BITS) - * STATIC KERNEL FUNCTION OF SIN(X), COS(X), AND TAN(X) - * CODED IN C BY K.C. NG, 1/21/85; + * STATIC KERNEL FUNCTION OF SIN(X), COS(X), AND TAN(X) + * CODED IN C BY K.C. NG, 1/21/85; * REVISED BY K.C. NG on 8/13/85. * - * x*x + * x*x * RETURN cos(k*x) - 1 + ----- on [-PI/4,PI/4], where k = pi/PI, - * 2 + * 2 * PI is the rounded value of pi in machine precision : * * Decimal: - * pi = 3.141592653589793 23846264338327 ..... + * pi = 3.141592653589793 23846264338327 ..... * 53 bits PI = 3.141592653589793 115997963 ..... , - * 56 bits PI = 3.141592653589793 227020265 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , * * Hexadecimal: * pi = 3.243F6A8885A308D313198A2E.... * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 - * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 + * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 * * * Method: - * 1. Let z=x*x. Create a polynomial approximation to + * 1. Let z=x*x. Create a polynomial approximation to * cos(k*x)-1+z/2 = z*z*(C0 + C1*z^1 + ... + C5*z^5) * then * cos__C(z) = z*z*(C0 + C1*z^1 + ... + C5*z^5) @@ -178,9 +178,9 @@ ic(S5, 1.5868926979889205164E-10 , -33, 1.5CF61DF672B13) * The coefficient C's are obtained by a special Remez algorithm. * * Accuracy: - * In the absence of rounding error, the approximation has absolute error - * less than 2**(-64) for VAX D FORMAT, 2**(-58.3) for IEEE DOUBLE. - * + * In the absence of rounding error, the approximation has absolute error + * less than 2**(-64) for VAX D FORMAT, 2**(-58.3) for IEEE DOUBLE. + * * * Constants: * The hexadecimal values are the intended ones for the following constants. diff --git a/lib/libm/common_source/acosh.c b/lib/libm/common_source/acosh.c index bc16cc7b46a8..149e5deec1e0 100644 --- a/lib/libm/common_source/acosh.c +++ b/lib/libm/common_source/acosh.c @@ -48,10 +48,10 @@ static char sccsid[] = "@(#)acosh.c 8.1 (Berkeley) 6/4/93"; * log1p(x) ...return log(1+x) * * Method : - * Based on + * Based on * acosh(x) = log [ x + sqrt(x*x-1) ] * we have - * acosh(x) := log1p(x)+ln2, if (x > 1.0E20); else + * acosh(x) := log1p(x)+ln2, if (x > 1.0E20); else * acosh(x) := log1p( sqrt(x-1) * (sqrt(x-1) + sqrt(x+1)) ) . * These formulae avoid the over/underflow complication. * @@ -60,7 +60,7 @@ static char sccsid[] = "@(#)acosh.c 8.1 (Berkeley) 6/4/93"; * acosh(NaN) is NaN without signal. * * Accuracy: - * acosh(x) returns the exact inverse hyperbolic cosine of x nearly + * acosh(x) returns the exact inverse hyperbolic cosine of x nearly * rounded. In a test run with 512,000 random arguments on a VAX, the * maximum observed error was 3.30 ulps (units of the last place) at * x=1.0070493753568216 . @@ -87,7 +87,7 @@ ic(ln2lo, 1.9082149292705877000E-10,-33, 1.A39EF35793C76) double acosh(x) double x; -{ +{ double t,big=1.E20; /* big+1==big */ #if !defined(vax)&&!defined(tahoe) @@ -95,7 +95,7 @@ double x; #endif /* !defined(vax)&&!defined(tahoe) */ /* return log1p(x) + log(2) if x is large */ - if(x>big) {t=log1p(x)+ln2lo; return(t+ln2hi);} + if(x>big) {t=log1p(x)+ln2lo; return(t+ln2hi);} t=sqrt(x-1.0); return(log1p(t*(t+sqrt(x+1.0)))); diff --git a/lib/libm/common_source/asincos.c b/lib/libm/common_source/asincos.c index c746b1652ac2..12d0e14e1ae3 100644 --- a/lib/libm/common_source/asincos.c +++ b/lib/libm/common_source/asincos.c @@ -45,12 +45,12 @@ static char sccsid[] = "@(#)asincos.c 8.1 (Berkeley) 6/4/93"; * sqrt(x) * * Required kernel function: - * atan2(y,x) + * atan2(y,x) * - * Method : - * asin(x) = atan2(x,sqrt(1-x*x)); for better accuracy, 1-x*x is + * Method : + * asin(x) = atan2(x,sqrt(1-x*x)); for better accuracy, 1-x*x is * computed as follows - * 1-x*x if x < 0.5, + * 1-x*x if x < 0.5, * 2*(1-|x|)-(1-|x|)*(1-|x|) if x >= 0.5. * * Special cases: @@ -59,22 +59,22 @@ static char sccsid[] = "@(#)asincos.c 8.1 (Berkeley) 6/4/93"; * * Accuracy: * 1) If atan2() uses machine PI, then - * + * * asin(x) returns (PI/pi) * (the exact arc sine of x) nearly rounded; * and PI is the exact pi rounded to machine precision (see atan2 for * details): * * in decimal: - * pi = 3.141592653589793 23846264338327 ..... + * pi = 3.141592653589793 23846264338327 ..... * 53 bits PI = 3.141592653589793 115997963 ..... , - * 56 bits PI = 3.141592653589793 227020265 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , * * in hexadecimal: * pi = 3.243F6A8885A308D313198A2E.... * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 error=.276ulps * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 error=.206ulps - * - * In a test run with more than 200,000 random arguments on a VAX, the + * + * In a test run with more than 200,000 random arguments on a VAX, the * maximum observed error in ulps (units in the last place) was * 2.06 ulps. (comparing against (PI/pi)*(exact asin(x))); * @@ -82,7 +82,7 @@ static char sccsid[] = "@(#)asincos.c 8.1 (Berkeley) 6/4/93"; * * asin(x) returns the exact asin(x) with error below about 2 ulps. * - * In a test run with more than 1,024,000 random arguments on a VAX, the + * In a test run with more than 1,024,000 random arguments on a VAX, the * maximum observed error in ulps (units in the last place) was * 1.99 ulps. */ @@ -97,7 +97,7 @@ double x; s=copysign(x,one); if(s <= 0.5) return(atan2(x,sqrt(one-x*x))); - else + else { t=one-s; s=t+t; return(atan2(x,sqrt(s-t*t))); } } @@ -112,9 +112,9 @@ double x; * sqrt(x) * * Required kernel function: - * atan2(y,x) + * atan2(y,x) * - * Method : + * Method : * ________ * / 1 - x * acos(x) = 2*atan2( / -------- , 1 ) . @@ -126,22 +126,22 @@ double x; * * Accuracy: * 1) If atan2() uses machine PI, then - * + * * acos(x) returns (PI/pi) * (the exact arc cosine of x) nearly rounded; * and PI is the exact pi rounded to machine precision (see atan2 for * details): * * in decimal: - * pi = 3.141592653589793 23846264338327 ..... + * pi = 3.141592653589793 23846264338327 ..... * 53 bits PI = 3.141592653589793 115997963 ..... , - * 56 bits PI = 3.141592653589793 227020265 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , * * in hexadecimal: * pi = 3.243F6A8885A308D313198A2E.... * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 error=.276ulps * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 error=.206ulps - * - * In a test run with more than 200,000 random arguments on a VAX, the + * + * In a test run with more than 200,000 random arguments on a VAX, the * maximum observed error in ulps (units in the last place) was * 2.07 ulps. (comparing against (PI/pi)*(exact acos(x))); * @@ -149,7 +149,7 @@ double x; * * acos(x) returns the exact acos(x) with error below about 2 ulps. * - * In a test run with more than 1,024,000 random arguments on a VAX, the + * In a test run with more than 1,024,000 random arguments on a VAX, the * maximum observed error in ulps (units in the last place) was * 2.15 ulps. */ diff --git a/lib/libm/common_source/asinh.c b/lib/libm/common_source/asinh.c index 5db8d2ddf7f8..1804145e3a93 100644 --- a/lib/libm/common_source/asinh.c +++ b/lib/libm/common_source/asinh.c @@ -49,16 +49,16 @@ static char sccsid[] = "@(#)asinh.c 8.1 (Berkeley) 6/4/93"; * log1p(x) ...return log(1+x) * * Method : - * Based on + * Based on * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] * we have * asinh(x) := x if 1+x*x=1, * := sign(x)*(log1p(x)+ln2)) if sqrt(1+x*x)=x, else - * := sign(x)*log1p(|x| + |x|/(1/|x| + sqrt(1+(1/|x|)^2)) ) + * := sign(x)*log1p(|x| + |x|/(1/|x| + sqrt(1+(1/|x|)^2)) ) * * Accuracy: * asinh(x) returns the exact inverse hyperbolic sine of x nearly rounded. - * In a test run with 52,000 random arguments on a VAX, the maximum + * In a test run with 52,000 random arguments on a VAX, the maximum * observed error was 1.58 ulps (units in the last place). * * Constants: @@ -82,16 +82,16 @@ ic(ln2lo, 1.9082149292705877000E-10, -33, 1.A39EF35793C76) double asinh(x) double x; -{ +{ double t,s; const static double small=1.0E-10, /* fl(1+small*small) == 1 */ big =1.0E20, /* fl(1+big) == big */ - one =1.0 ; + one =1.0 ; #if !defined(vax)&&!defined(tahoe) if(x!=x) return(x); /* x is NaN */ #endif /* !defined(vax)&&!defined(tahoe) */ - if((t=copysign(x,one))>small) + if((t=copysign(x,one))>small) if(t<big) { s=one/t; return(copysign(log1p(t+t/(s+sqrt(one+s*s))),x)); } else /* if |x| > big */ diff --git a/lib/libm/common_source/atan.c b/lib/libm/common_source/atan.c index 272c7f1cdc48..f29c7d4d3483 100644 --- a/lib/libm/common_source/atan.c +++ b/lib/libm/common_source/atan.c @@ -41,32 +41,32 @@ static char sccsid[] = "@(#)atan.c 8.1 (Berkeley) 6/4/93"; * CODED IN C BY K.C. NG, 4/16/85, REVISED ON 6/10/85. * * Required kernel function: - * atan2(y,x) + * atan2(y,x) * - * Method: - * atan(x) = atan2(x,1.0). + * Method: + * atan(x) = atan2(x,1.0). * * Special case: * if x is NaN, return x itself. * * Accuracy: * 1) If atan2() uses machine PI, then - * + * * atan(x) returns (PI/pi) * (the exact arc tangent of x) nearly rounded; * and PI is the exact pi rounded to machine precision (see atan2 for * details): * * in decimal: - * pi = 3.141592653589793 23846264338327 ..... + * pi = 3.141592653589793 23846264338327 ..... * 53 bits PI = 3.141592653589793 115997963 ..... , - * 56 bits PI = 3.141592653589793 227020265 ..... , + * 56 bits PI = 3.141592653589793 227020265 ..... , * * in hexadecimal: * pi = 3.243F6A8885A308D313198A2E.... * 53 bits PI = 3.243F6A8885A30 = 2 * 1.921FB54442D18 error=.276ulps * 56 bits PI = 3.243F6A8885A308 = 4 * .C90FDAA22168C2 error=.206ulps - * - * In a test run with more than 200,000 random arguments on a VAX, the + * + * In a test run with more than 200,000 random arguments on a VAX, the * maximum observed error in ulps (units in the last place) was * 0.86 ulps. (comparing against (PI/pi)*(exact atan(x))). * @@ -74,7 +74,7 @@ static char sccsid[] = "@(#)atan.c 8.1 (Berkeley) 6/4/93"; * * atan(x) returns the exact atan(x) with error below about 2 ulps. * - * In a test run with more than 1,024,000 random arguments on a VAX, the + * In a test run with more than 1,024,000 random arguments on a VAX, the * maximum observed error in ulps (units in the last place) was * 0.85 ulps. */ diff --git a/lib/libm/common_source/atanh.c b/lib/libm/common_source/atanh.c index 89cb61cca25e..e5cdadde9052 100644 --- a/lib/libm/common_source/atanh.c +++ b/lib/libm/common_source/atanh.c @@ -38,14 +38,14 @@ static char sccsid[] = "@(#)atanh.c 8.1 (Berkeley) 6/4/93"; /* ATANH(X) * RETURN THE HYPERBOLIC ARC TANGENT OF X * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) - * CODED IN C BY K.C. NG, 1/8/85; + * CODED IN C BY K.C. NG, 1/8/85; * REVISED BY K.C. NG on 2/7/85, 3/7/85, 8/18/85. * * Required kernel function: * log1p(x) ...return log(1+x) * * Method : - * Return + * Return * 1 2x x * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) * 2 1 - x 1 - x diff --git a/lib/libm/common_source/cosh.c b/lib/libm/common_source/cosh.c index e2b30731b8c1..e8d35195eb05 100644 --- a/lib/libm/common_source/cosh.c +++ b/lib/libm/common_source/cosh.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)cosh.c 8.1 (Berkeley) 6/4/93"; /* COSH(X) * RETURN THE HYPERBOLIC COSINE OF X * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) - * CODED IN C BY K.C. NG, 1/8/85; + * CODED IN C BY K.C. NG, 1/8/85; * REVISED BY K.C. NG on 2/8/85, 2/23/85, 3/7/85, 3/29/85, 4/16/85. * * Required system supported functions : @@ -46,20 +46,20 @@ static char sccsid[] = "@(#)cosh.c 8.1 (Berkeley) 6/4/93"; * scalb(x,N) * * Required kernel function: - * exp(x) + * exp(x) * exp__E(x,c) ...return exp(x+c)-1-x for |x|<0.3465 * * Method : - * 1. Replace x by |x|. - * 2. - * [ exp(x) - 1 ]^2 + * 1. Replace x by |x|. + * 2. + * [ exp(x) - 1 ]^2 * 0 <= x <= 0.3465 : cosh(x) := 1 + ------------------- * 2*exp(x) * * exp(x) + 1/exp(x) * 0.3465 <= x <= 22 : cosh(x) := ------------------- * 2 - * 22 <= x <= lnovfl : cosh(x) := exp(x)/2 + * 22 <= x <= lnovfl : cosh(x) := exp(x)/2 * lnovfl <= x <= lnovfl+log(2) * : cosh(x) := exp(x)/2 (avoid overflow) * log(2)+lnovfl < x < INF: overflow to INF @@ -106,7 +106,7 @@ static max = 1023 ; double cosh(x) double x; -{ +{ static const double half=1.0/2.0, one=1.0, small=1.0E-18; /* fl(1+small)==1 */ double t; @@ -115,19 +115,19 @@ double x; if(x!=x) return(x); /* x is NaN */ #endif /* !defined(vax)&&!defined(tahoe) */ if((x=copysign(x,one)) <= 22) - if(x<0.3465) + if(x<0.3465) if(x<small) return(one+x); else {t=x+__exp__E(x,0.0);x=t+t; return(one+t*t/(2.0+x)); } else /* for x lies in [0.3465,22] */ { t=exp(x); return((t+one/t)*half); } - if( lnovfl <= x && x <= (lnovfl+0.7)) - /* for x lies in [lnovfl, lnovfl+ln2], decrease x by ln(2^(max+1)) - * and return 2^max*exp(x) to avoid unnecessary overflow + if( lnovfl <= x && x <= (lnovfl+0.7)) + /* for x lies in [lnovfl, lnovfl+ln2], decrease x by ln(2^(max+1)) + * and return 2^max*exp(x) to avoid unnecessary overflow */ - return(scalb(exp((x-mln2hi)-mln2lo), max)); + return(scalb(exp((x-mln2hi)-mln2lo), max)); - else + else return(exp(x)*half); /* for large x, cosh(x)=exp(x)/2 */ } diff --git a/lib/libm/common_source/erf.c b/lib/libm/common_source/erf.c index 308f1a952d73..ba0c006eea5f 100644 --- a/lib/libm/common_source/erf.c +++ b/lib/libm/common_source/erf.c @@ -68,13 +68,13 @@ static char sccsid[] = "@(#)erf.c 8.1 (Berkeley) 6/4/93"; * erfc(x) = 1 - erf(x) if x<=0.25 * = 0.5 + ((0.5-x)-x*P) if x in [0.25,0.84375] * where - * 2 2 4 20 + * 2 2 4 20 * P = P(x ) = (p0 + p1 * x + p2 * x + ... + p10 * x ) * is an approximation to (erf(x)-x)/x with precision * * -56.45 * | P - (erf(x)-x)/x | <= 2 - * + * * * Remark. The formula is derived by noting * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) @@ -96,7 +96,7 @@ static char sccsid[] = "@(#)erf.c 8.1 (Berkeley) 6/4/93"; * That is, we use rational approximation to approximate * erf(1+s) - (c = (single)0.84506291151) * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] - * where + * where * P1(s) = degree 6 poly in s * Q1(s) = degree 6 poly in s * @@ -105,7 +105,7 @@ static char sccsid[] = "@(#)erf.c 8.1 (Berkeley) 6/4/93"; * erfc(x) = (1/x)exp(-x*x-(.5*log(pi) -.5z + R(z)/S(z)) * * Where z = 1/(x*x), R is degree 9, and S is degree 3; - * + * * 5. For x in [4,28] * erf(x) = 1.0 - tiny * erfc(x) = (1/x)exp(-x*x-(.5*log(pi)+eps + zP(z)) @@ -139,7 +139,7 @@ static char sccsid[] = "@(#)erf.c 8.1 (Berkeley) 6/4/93"; * * 7. Special cases: * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, + * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, * erfc/erf(NaN) is NaN */ @@ -181,7 +181,7 @@ p8 = 1.640186161764254363152286358441771740838e-0006, p9 = -1.571599331700515057841960987689515895479e-0007, p10= 1.073087585213621540635426191486561494058e-0008; /* - * Coefficients for approximation to erf in [0.84375,1.25] + * Coefficients for approximation to erf in [0.84375,1.25] */ static double pa0 = -2.362118560752659485957248365514511540287e-0003, @@ -319,7 +319,7 @@ double erf(x) return (z-one); } -double erfc(x) +double erfc(x) double x; { double R,S,P,Q,s,ax,y,z,r,fabs(),__exp__D(); @@ -352,7 +352,7 @@ double erfc(x) P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); if (x>=0) { - z = one-c; return z - P/Q; + z = one-c; return z - P/Q; } else { z = c+P/Q; return one+z; } diff --git a/lib/libm/common_source/exp.c b/lib/libm/common_source/exp.c index 9b4f045f82e4..fa6ea75735c5 100644 --- a/lib/libm/common_source/exp.c +++ b/lib/libm/common_source/exp.c @@ -38,21 +38,21 @@ static char sccsid[] = "@(#)exp.c 8.1 (Berkeley) 6/4/93"; /* EXP(X) * RETURN THE EXPONENTIAL OF X * DOUBLE PRECISION (IEEE 53 bits, VAX D FORMAT 56 BITS) - * CODED IN C BY K.C. NG, 1/19/85; + * CODED IN C BY K.C. NG, 1/19/85; * REVISED BY K.C. NG on 2/6/85, 2/15/85, 3/7/85, 3/24/85, 4/16/85, 6/14/86. * * Required system supported functions: - * scalb(x,n) - * copysign(x,y) + * scalb(x,n) + * copysign(x,y) * finite(x) * * Method: - * 1. Argument Reduction: given the input x, find r and integer k such + * 1. Argument Reduction: given the input x, find r and integer k such * that - * x = k*ln2 + r, |r| <= 0.5*ln2 . + * x = k*ln2 + r, |r| <= 0.5*ln2 . * r will be represented as r := z+c for better accuracy. * - * 2. Compute exp(r) by + * 2. Compute exp(r) by * * exp(r) = 1 + r + r*R1/(2-R1), * where @@ -143,7 +143,7 @@ double x; } /* end of x > lntiny */ - else + else /* exp(-big#) underflows to zero */ if(finite(x)) return(scalb(1.0,-5000)); @@ -152,7 +152,7 @@ double x; } /* end of x < lnhuge */ - else + else /* exp(INF) is INF, exp(+big#) overflows to INF */ return( finite(x) ? scalb(1.0,5000) : x); } @@ -188,7 +188,7 @@ double x, c; } /* end of x > lntiny */ - else + else /* exp(-big#) underflows to zero */ if(finite(x)) return(scalb(1.0,-5000)); @@ -197,7 +197,7 @@ double x, c; } /* end of x < lnhuge */ - else + else /* exp(INF) is INF, exp(+big#) overflows to INF */ return( finite(x) ? scalb(1.0,5000) : x); } diff --git a/lib/libm/common_source/exp__E.c b/lib/libm/common_source/exp__E.c index ab972477a04b..16ec4cbb2179 100644 --- a/lib/libm/common_source/exp__E.c +++ b/lib/libm/common_source/exp__E.c @@ -41,7 +41,7 @@ static char sccsid[] = "@(#)exp__E.c 8.1 (Berkeley) 6/4/93"; * exp__E RETURNS * * / exp(x+c) - 1 - x , 1E-19 < |x| < .3465736 - * exp__E(x,c) = | + * exp__E(x,c) = | * \ 0 , |x| < 1E-19. * * DOUBLE PRECISION (IEEE 53 bits, VAX D FORMAT 56 BITS) @@ -50,12 +50,12 @@ static char sccsid[] = "@(#)exp__E.c 8.1 (Berkeley) 6/4/93"; * REVISED BY K.C. NG on 3/16/85, 4/16/85. * * Required system supported function: - * copysign(x,y) + * copysign(x,y) * * Method: * 1. Rational approximation. Let r=x+c. * Based on - * 2 * sinh(r/2) + * 2 * sinh(r/2) * exp(r) - 1 = ---------------------- , * cosh(r/2) - sinh(r/2) * exp__E(r) is computed using @@ -76,7 +76,7 @@ static char sccsid[] = "@(#)exp__E.c 8.1 (Berkeley) 6/4/93"; * Approximation error: * * | exp(x) - 1 | 2**(-57), (IEEE double) - * | ------------ - (exp__E(x,0)+x)/x | <= + * | ------------ - (exp__E(x,0)+x)/x | <= * | x | 2**(-69). (VAX D) * * Constants: @@ -120,7 +120,7 @@ double x,c; #else /* defined(vax)||defined(tahoe) */ q = z*( q1 +z* q2 ); #endif /* defined(vax)||defined(tahoe) */ - xp= x*p ; + xp= x*p ; xh= x*half ; w = xh-(q-xp) ; p = p+p; diff --git a/lib/libm/common_source/expm1.c b/lib/libm/common_source/expm1.c index 760d2bed677d..8a84f14c4da2 100644 --- a/lib/libm/common_source/expm1.c +++ b/lib/libm/common_source/expm1.c @@ -38,36 +38,36 @@ static char sccsid[] = "@(#)expm1.c 8.1 (Berkeley) 6/4/93"; /* EXPM1(X) * RETURN THE EXPONENTIAL OF X MINUS ONE * DOUBLE PRECISION (IEEE 53 BITS, VAX D FORMAT 56 BITS) - * CODED IN C BY K.C. NG, 1/19/85; + * CODED IN C BY K.C. NG, 1/19/85; * REVISED BY K.C. NG on 2/6/85, 3/7/85, 3/21/85, 4/16/85. * * Required system supported functions: - * scalb(x,n) - * copysign(x,y) + * scalb(x,n) + * copysign(x,y) * finite(x) * * Kernel function: * exp__E(x,c) * * Method: - * 1. Argument Reduction: given the input x, find r and integer k such + * 1. Argument Reduction: given the input x, find r and integer k such * that - * x = k*ln2 + r, |r| <= 0.5*ln2 . + * x = k*ln2 + r, |r| <= 0.5*ln2 . * r will be represented as r := z+c for better accuracy. * - * 2. Compute EXPM1(r)=exp(r)-1 by + * 2. Compute EXPM1(r)=exp(r)-1 by * * EXPM1(r=z+c) := z + exp__E(z,c) * * 3. EXPM1(x) = 2^k * ( EXPM1(r) + 1-2^-k ). * - * Remarks: + * Remarks: * 1. When k=1 and z < -0.25, we use the following formula for * better accuracy: * EXPM1(x) = 2 * ( (z+0.5) + exp__E(z,c) ) * 2. To avoid rounding error in 1-2^-k where k is large, we use * EXPM1(x) = 2^k * { [z+(exp__E(z,c)-2^-k )] + 1 } - * when k>56. + * when k>56. * * Special cases: * EXPM1(INF) is INF, EXPM1(NaN) is NaN; @@ -108,7 +108,7 @@ ic(invln2, 1.4426950408889633870E0, 0, 1.71547652B82FE) double expm1(x) double x; { - const static double one=1.0, half=1.0/2.0; + const static double one=1.0, half=1.0/2.0; double z,hi,lo,c; int k; #if defined(vax)||defined(tahoe) @@ -126,13 +126,13 @@ double x; /* argument reduction : x - k*ln2 */ k= invln2 *x+copysign(0.5,x); /* k=NINT(x/ln2) */ - hi=x-k*ln2hi ; + hi=x-k*ln2hi ; z=hi-(lo=k*ln2lo); c=(hi-z)-lo; if(k==0) return(z+__exp__E(z,c)); if(k==1) - if(z< -0.25) + if(z< -0.25) {x=z+half;x +=__exp__E(z,c); return(x+x);} else {z+=__exp__E(z,c); x=half+z; return(x+x);} @@ -143,17 +143,17 @@ double x; { x=one-scalb(one,-k); z += __exp__E(z,c);} else if(k<100) { x = __exp__E(z,c)-scalb(one,-k); x+=z; z=one;} - else + else { x = __exp__E(z,c)+z; z=one;} - return (scalb(x+z,k)); + return (scalb(x+z,k)); } } /* end of x > lnunfl */ - else + else /* expm1(-big#) rounded to -1 (inexact) */ - if(finite(x)) + if(finite(x)) { ln2hi+ln2lo; return(-one);} /* expm1(-INF) is -1 */ @@ -161,7 +161,7 @@ double x; } /* end of x < lnhuge */ - else + else /* expm1(INF) is INF, expm1(+big#) overflows to INF */ return( finite(x) ? scalb(one,5000) : x); } diff --git a/lib/libm/common_source/j0.c b/lib/libm/common_source/j0.c index a9b28b38caea..684fb4d42c3e 100644 --- a/lib/libm/common_source/j0.c +++ b/lib/libm/common_source/j0.c @@ -46,18 +46,18 @@ static char sccsid[] = "@(#)j0.c 8.2 (Berkeley) 11/30/93"; * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== * * ******************* WARNING ******************** * This is an alpha version of SunPro's FDLIBM (Freely - * Distributable Math Library) for IEEE double precision + * Distributable Math Library) for IEEE double precision * arithmetic. FDLIBM is a basic math library written - * in C that runs on machines that conform to IEEE - * Standard 754/854. This alpha version is distributed - * for testing purpose. Those who use this software - * should report any bugs to + * in C that runs on machines that conform to IEEE + * Standard 754/854. This alpha version is distributed + * for testing purpose. Those who use this software + * should report any bugs to * * fdlibm-comments@sunpro.eng.sun.com * @@ -84,20 +84,20 @@ static char sccsid[] = "@(#)j0.c 8.2 (Berkeley) 11/30/93"; * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one.) - * + * * 3 Special cases * j0(nan)= nan * j0(0) = 1 * j0(inf) = 0 - * + * * Method -- y0(x): * 1. For x<2. - * Since + * Since * y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...) * therefore y0(x)-2/pi*j0(x)*ln(x) is an even function. * We use the following function to approximate y0, * y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2 - * where + * where * U(z) = u0 + u1*z + ... + u6*z^6 * V(z) = 1 + v1*z + ... + v4*z^4 * with absolute approximation error bounded by 2**-72. @@ -121,7 +121,7 @@ static char sccsid[] = "@(#)j0.c 8.2 (Berkeley) 11/30/93"; static double pzero __P((double)), qzero __P((double)); -static double +static double huge = 1e300, zero = 0.0, one = 1.0, @@ -138,7 +138,7 @@ s03 = 5.135465502073181376284426245689510134134e-0007, s04 = 1.166140033337900097836930825478674320464e-0009; double -j0(x) +j0(x) double x; { double z, s,c,ss,cc,r,u,v; @@ -201,7 +201,7 @@ v03 = 2.591508518404578033173189144579208685163e-0007, v04 = 4.411103113326754838596529339004302243157e-0010; double -y0(x) +y0(x) double x; { double z, s, c, ss, cc, u, v; @@ -345,7 +345,7 @@ static double pzero(x) s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qzero is * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. diff --git a/lib/libm/common_source/j1.c b/lib/libm/common_source/j1.c index 71602aac1381..e8ca43ad83b8 100644 --- a/lib/libm/common_source/j1.c +++ b/lib/libm/common_source/j1.c @@ -46,18 +46,18 @@ static char sccsid[] = "@(#)j1.c 8.2 (Berkeley) 11/30/93"; * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== * * ******************* WARNING ******************** * This is an alpha version of SunPro's FDLIBM (Freely - * Distributable Math Library) for IEEE double precision + * Distributable Math Library) for IEEE double precision * arithmetic. FDLIBM is a basic math library written - * in C that runs on machines that conform to IEEE - * Standard 754/854. This alpha version is distributed - * for testing purpose. Those who use this software - * should report any bugs to + * in C that runs on machines that conform to IEEE + * Standard 754/854. This alpha version is distributed + * for testing purpose. Those who use this software + * should report any bugs to * * fdlibm-comments@sunpro.eng.sun.com * @@ -85,16 +85,16 @@ static char sccsid[] = "@(#)j1.c 8.2 (Berkeley) 11/30/93"; * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one.) - * + * * 3 Special cases * j1(nan)= nan * j1(0) = 0 * j1(inf) = 0 - * + * * Method -- y1(x): - * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN + * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN * 2. For x<2. - * Since + * Since * y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...) * therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function. * We use the following function to approximate y1, @@ -122,7 +122,7 @@ static char sccsid[] = "@(#)j1.c 8.2 (Berkeley) 11/30/93"; static double pone(), qone(); -static double +static double huge = 1e300, zero = 0.0, one = 1.0, @@ -142,7 +142,7 @@ s05 = 1.235422744261379203512624973117299248281e-0011; #define two_129 6.80564733841876926e+038 /* 2^129 */ #define two_m54 5.55111512312578270e-017 /* 2^-54 */ -double j1(x) +double j1(x) double x; { double z, s,c,ss,cc,r,u,v,y; @@ -205,7 +205,7 @@ static double v0[5] = { 1.665592462079920695971450872592458916421e-0011, }; -double y1(x) +double y1(x) double x; { double z, s, c, ss, cc, u, v; @@ -254,10 +254,10 @@ double y1(x) z = invsqrtpi*(u*ss+v*cc)/sqrt(x); } return z; - } + } if (x <= two_m54) { /* x < 2**-54 */ return (-tpi/x); - } + } z = x*x; u = u0[0]+z*(u0[1]+z*(u0[2]+z*(u0[3]+z*u0[4]))); v = one+z*(v0[0]+z*(v0[1]+z*(v0[2]+z*(v0[3]+z*v0[4])))); @@ -351,7 +351,7 @@ static double pone(x) s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return (one + r/s); } - + /* For x >= 8, the asymptotic expansions of qone is * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. diff --git a/lib/libm/common_source/jn.c b/lib/libm/common_source/jn.c index 85a54012ecae..28d9687a51b1 100644 --- a/lib/libm/common_source/jn.c +++ b/lib/libm/common_source/jn.c @@ -46,18 +46,18 @@ static char sccsid[] = "@(#)jn.c 8.2 (Berkeley) 11/30/93"; * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== * * ******************* WARNING ******************** * This is an alpha version of SunPro's FDLIBM (Freely - * Distributable Math Library) for IEEE double precision + * Distributable Math Library) for IEEE double precision * arithmetic. FDLIBM is a basic math library written - * in C that runs on machines that conform to IEEE - * Standard 754/854. This alpha version is distributed - * for testing purpose. Those who use this software - * should report any bugs to + * in C that runs on machines that conform to IEEE + * Standard 754/854. This alpha version is distributed + * for testing purpose. Those who use this software + * should report any bugs to * * fdlibm-comments@sunpro.eng.sun.com * @@ -69,7 +69,7 @@ static char sccsid[] = "@(#)jn.c 8.2 (Berkeley) 11/30/93"; * jn(int n, double x), yn(int n, double x) * floating point Bessel's function of the 1st and 2nd kind * of order n - * + * * Special cases: * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. @@ -88,7 +88,7 @@ static char sccsid[] = "@(#)jn.c 8.2 (Berkeley) 11/30/93"; * yn(n,x) is similar in all respects, except * that forward recursion is used for all * values of n>1. - * + * */ #include <math.h> @@ -120,7 +120,7 @@ double jn(n,x) */ /* if J(n,NaN) is NaN */ if (_IEEE && isnan(x)) return x+x; - if (n<0){ + if (n<0){ n = -n; x = -x; } @@ -134,10 +134,10 @@ double jn(n,x) /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ if (_IEEE && x >= 8.148143905337944345e+090) { /* x >= 2**302 */ - /* (x >> n**2) + /* (x >> n**2) * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), + * Let s=sin(x), c=cos(x), * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then * * n sin(xn)*sqt2 cos(xn)*sqt2 @@ -154,7 +154,7 @@ double jn(n,x) case 3: temp = cos(x)-sin(x); break; } b = invsqrtpi*temp/sqrt(x); - } else { + } else { a = j0(x); b = j1(x); for(i=1;i<n;i++){ @@ -165,7 +165,7 @@ double jn(n,x) } } else { if (x < 1.86264514923095703125e-009) { /* x < 2**-29 */ - /* x is tiny, return the first Taylor expansion of J(n,x) + /* x is tiny, return the first Taylor expansion of J(n,x) * J(n,x) = 1/n!*(x/2)^n - ... */ if (n > 33) /* underflow */ @@ -180,14 +180,14 @@ double jn(n,x) } } else { /* use backward recurrence */ - /* x x^2 x^2 + /* x x^2 x^2 * J(n,x)/J(n-1,x) = ---- ------ ------ ..... * 2n - 2(n+1) - 2(n+2) * - * 1 1 1 + * 1 1 1 * (for large x) = ---- ------ ------ ..... * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - + * -- - ------ - ------ - * x x x * * Let w = 2n/x and h=2/x, then the above quotient @@ -203,9 +203,9 @@ double jn(n,x) * To determine how many terms needed, let * Q(0) = w, Q(1) = w(w+h) - 1, * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple + * When Q(k) > 1e4 good for single + * When Q(k) > 1e9 good for double + * When Q(k) > 1e17 good for quadruple */ /* determine k */ double t,v; @@ -254,7 +254,7 @@ double jn(n,x) } return ((sgn == 1) ? -b : b); } -double yn(n,x) +double yn(n,x) int n; double x; { int i, sign; @@ -275,10 +275,10 @@ double yn(n,x) if (n == 0) return(y0(x)); if (n == 1) return(sign*y1(x)); if(_IEEE && x >= 8.148143905337944345e+090) { /* x > 2**302 */ - /* (x >> n**2) + /* (x >> n**2) * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), + * Let s=sin(x), c=cos(x), * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then * * n sin(xn)*sqt2 cos(xn)*sqt2 diff --git a/lib/libm/common_source/log.c b/lib/libm/common_source/log.c index ae186722f8df..908b8544f93c 100644 --- a/lib/libm/common_source/log.c +++ b/lib/libm/common_source/log.c @@ -391,7 +391,7 @@ log(x) double x; return (x+x); else return (infnan(ERANGE)); - + /* Argument reduction: 1 <= g < 2; x/2^m = g; */ /* y = F*(1 + f/F) for |f| <= 2^-8 */ diff --git a/lib/libm/common_source/log10.c b/lib/libm/common_source/log10.c index d2617ccebb9e..75205cd5ee15 100644 --- a/lib/libm/common_source/log10.c +++ b/lib/libm/common_source/log10.c @@ -38,9 +38,9 @@ static char sccsid[] = "@(#)log10.c 8.1 (Berkeley) 6/4/93"; /* LOG10(X) * RETURN THE BASE 10 LOGARITHM OF x * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) - * CODED IN C BY K.C. NG, 1/20/85; + * CODED IN C BY K.C. NG, 1/20/85; * REVISED BY K.C. NG on 1/23/85, 3/7/85, 4/16/85. - * + * * Required kernel function: * log(x) * @@ -52,12 +52,12 @@ static char sccsid[] = "@(#)log10.c 8.1 (Berkeley) 6/4/93"; * Note: * [log(10)] rounded to 56 bits has error .0895 ulps, * [1/log(10)] rounded to 53 bits has error .198 ulps; - * therefore, for better accuracy, in VAX D format, we divide - * log(x) by log(10), but in IEEE Double format, we multiply + * therefore, for better accuracy, in VAX D format, we divide + * log(x) by log(10), but in IEEE Double format, we multiply * log(x) by [1/log(10)]. * * Special cases: - * log10(x) is NaN with signal if x < 0; + * log10(x) is NaN with signal if x < 0; * log10(+INF) is +INF with no signal; log10(0) is -INF with signal; * log10(NaN) is that NaN with no signal. * diff --git a/lib/libm/common_source/log1p.c b/lib/libm/common_source/log1p.c index cbf9fcd895e2..020266721ed6 100644 --- a/lib/libm/common_source/log1p.c +++ b/lib/libm/common_source/log1p.c @@ -35,24 +35,24 @@ static char sccsid[] = "@(#)log1p.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ -/* LOG1P(x) +/* LOG1P(x) * RETURN THE LOGARITHM OF 1+x * DOUBLE PRECISION (VAX D FORMAT 56 bits, IEEE DOUBLE 53 BITS) - * CODED IN C BY K.C. NG, 1/19/85; + * CODED IN C BY K.C. NG, 1/19/85; * REVISED BY K.C. NG on 2/6/85, 3/7/85, 3/24/85, 4/16/85. - * + * * Required system supported functions: - * scalb(x,n) + * scalb(x,n) * copysign(x,y) - * logb(x) + * logb(x) * finite(x) * * Required kernel function: * log__L(z) * * Method : - * 1. Argument Reduction: find k and f such that - * 1+x = 2^k * (1+f), + * 1. Argument Reduction: find k and f such that + * 1+x = 2^k * (1+f), * where sqrt(2)/2 < 1+f < sqrt(2) . * * 2. Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) @@ -65,11 +65,11 @@ static char sccsid[] = "@(#)log1p.c 8.1 (Berkeley) 6/4/93"; * * See log__L() for the values of the coefficients. * - * 3. Finally, log(1+x) = k*ln2 + log(1+f). + * 3. Finally, log(1+x) = k*ln2 + log(1+f). * * Remarks 1. In step 3 n*ln2 will be stored in two floating point numbers - * n*ln2hi + n*ln2lo, where ln2hi is chosen such that the last - * 20 bits (for VAX D format), or the last 21 bits ( for IEEE + * n*ln2hi + n*ln2lo, where ln2hi is chosen such that the last + * 20 bits (for VAX D format), or the last 21 bits ( for IEEE * double) is 0. This ensures n*ln2hi is exactly representable. * 2. In step 1, f may not be representable. A correction term c * for f is computed. It follows that the correction term for @@ -83,7 +83,7 @@ static char sccsid[] = "@(#)log1p.c 8.1 (Berkeley) 6/4/93"; * only log1p(0)=0 is exact for finite argument. * * Accuracy: - * log1p(x) returns the exact log(1+x) nearly rounded. In a test run + * log1p(x) returns the exact log(1+x) nearly rounded. In a test run * with 1,536,000 random arguments on a VAX, the maximum observed * error was .846 ulps (units in the last place). * @@ -114,7 +114,7 @@ ic(sqrt2, 1.4142135623730951455E0, 0, 1.6A09E667F3BCD) double log1p(x) double x; { - const static double zero=0.0, negone= -1.0, one=1.0, + const static double zero=0.0, negone= -1.0, one=1.0, half=1.0/2.0, small=1.0E-20; /* 1+small == 1 */ double z,s,t,c; int k; @@ -129,7 +129,7 @@ double x; /* argument reduction */ if(copysign(x,one)<small) return(x); k=logb(one+x); z=scalb(x,-k); t=scalb(one,-k); - if(z+t >= sqrt2 ) + if(z+t >= sqrt2 ) { k += 1 ; z *= half; t *= half; } t += negone; x = z + t; c = (t-x)+z ; /* correction term for x */ @@ -162,9 +162,9 @@ double x; /* end of if (finite(x)) */ /* log(-INF) is NaN */ - else if(x<0) + else if(x<0) return(zero/zero); /* log(+INF) is INF */ - else return(x); + else return(x); } diff --git a/lib/libm/common_source/log__L.c b/lib/libm/common_source/log__L.c index c00158fa5172..207cb0d9e5d8 100644 --- a/lib/libm/common_source/log__L.c +++ b/lib/libm/common_source/log__L.c @@ -39,14 +39,14 @@ static char sccsid[] = "@(#)log__L.c 8.1 (Berkeley) 6/4/93"; * LOG(1+X) - 2S X * RETURN --------------- WHERE Z = S*S, S = ------- , 0 <= Z <= .0294... * S 2 + X - * + * * DOUBLE PRECISION (VAX D FORMAT 56 bits or IEEE DOUBLE 53 BITS) * KERNEL FUNCTION FOR LOG; TO BE USED IN LOG1P, LOG, AND POW FUNCTIONS - * CODED IN C BY K.C. NG, 1/19/85; + * CODED IN C BY K.C. NG, 1/19/85; * REVISED BY K.C. Ng, 2/3/85, 4/16/85. * * Method : - * 1. Polynomial approximation: let s = x/(2+x). + * 1. Polynomial approximation: let s = x/(2+x). * Based on log(1+x) = log(1+s) - log(1-s) * = 2s + 2/3 s**3 + 2/5 s**5 + ....., * @@ -54,11 +54,11 @@ static char sccsid[] = "@(#)log__L.c 8.1 (Berkeley) 6/4/93"; * * z*(L1 + z*(L2 + z*(... (L7 + z*L8)...))) * - * where z=s*s. (See the listing below for Lk's values.) The - * coefficients are obtained by a special Remez algorithm. + * where z=s*s. (See the listing below for Lk's values.) The + * coefficients are obtained by a special Remez algorithm. * * Accuracy: - * Assuming no rounding error, the maximum magnitude of the approximation + * Assuming no rounding error, the maximum magnitude of the approximation * error (absolute) is 2**(-58.49) for IEEE double, and 2**(-63.63) * for VAX D format. * diff --git a/lib/libm/common_source/pow.c b/lib/libm/common_source/pow.c index cb4fc5029f4d..9e92985f8f97 100644 --- a/lib/libm/common_source/pow.c +++ b/lib/libm/common_source/pow.c @@ -35,17 +35,17 @@ static char sccsid[] = "@(#)pow.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ -/* POW(X,Y) - * RETURN X**Y +/* POW(X,Y) + * RETURN X**Y * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) - * CODED IN C BY K.C. NG, 1/8/85; + * CODED IN C BY K.C. NG, 1/8/85; * REVISED BY K.C. NG on 7/10/85. * KERNEL pow_P() REPLACED BY P. McILROY 7/22/92. * Required system supported functions: - * scalb(x,n) - * logb(x) - * copysign(x,y) - * finite(x) + * scalb(x,n) + * logb(x) + * copysign(x,y) + * finite(x) * drem(x,y) * * Required kernel functions: @@ -56,7 +56,7 @@ static char sccsid[] = "@(#)pow.c 8.1 (Berkeley) 6/4/93"; * 1. Compute and return log(x) in three pieces: * log(x) = n*ln2 + hi + lo, * where n is an integer. - * 2. Perform y*log(x) by simulating muti-precision arithmetic and + * 2. Perform y*log(x) by simulating muti-precision arithmetic and * return the answer in three pieces: * y*log(x) = m*ln2 + hi + lo, * where m is an integer. @@ -94,7 +94,7 @@ static char sccsid[] = "@(#)pow.c 8.1 (Berkeley) 6/4/93"; * pow(integer,integer) * always returns the correct integer provided it is representable. * In a test run with 100,000 random arguments with 0 < x, y < 20.0 - * on a VAX, the maximum observed error was 1.79 ulps (units in the + * on a VAX, the maximum observed error was 1.79 ulps (units in the * last place). * * Constants : @@ -123,7 +123,7 @@ const static double zero=0.0, one=1.0, two=2.0, negone= -1.0; static double pow_P __P((double, double)); -double pow(x,y) +double pow(x,y) double x,y; { double t; diff --git a/lib/libm/common_source/sinh.c b/lib/libm/common_source/sinh.c index 0516849cff13..075172c074e1 100644 --- a/lib/libm/common_source/sinh.c +++ b/lib/libm/common_source/sinh.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)sinh.c 8.1 (Berkeley) 6/4/93"; /* SINH(X) * RETURN THE HYPERBOLIC SINE OF X * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) - * CODED IN C BY K.C. NG, 1/8/85; + * CODED IN C BY K.C. NG, 1/8/85; * REVISED BY K.C. NG on 2/8/85, 3/7/85, 3/24/85, 4/16/85. * * Required system supported functions : @@ -50,14 +50,14 @@ static char sccsid[] = "@(#)sinh.c 8.1 (Berkeley) 6/4/93"; * * Method : * 1. reduce x to non-negative by sinh(-x) = - sinh(x). - * 2. + * 2. * * expm1(x) + expm1(x)/(expm1(x)+1) * 0 <= x <= lnovfl : sinh(x) := -------------------------------- * 2 * lnovfl <= x <= lnovfl+ln2 : sinh(x) := expm1(x)/2 (avoid overflow) * lnovfl+ln2 < x < INF : overflow to INF - * + * * * Special cases: * sinh(x) is x if x is +INF, -INF, or NaN. @@ -112,7 +112,7 @@ double x; {t=expm1(x); return(copysign((t+t/(one+t))*half,sign));} else if(x <= lnovfl+0.7) - /* subtract x by ln(2^(max+1)) and return 2^max*exp(x) + /* subtract x by ln(2^(max+1)) and return 2^max*exp(x) to avoid unnecessary overflow */ return(copysign(scalb(one+expm1((x-mln2hi)-mln2lo),max),sign)); diff --git a/lib/libm/common_source/tanh.c b/lib/libm/common_source/tanh.c index d4923b3418bd..6813b55a3a70 100644 --- a/lib/libm/common_source/tanh.c +++ b/lib/libm/common_source/tanh.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)tanh.c 8.1 (Berkeley) 6/4/93"; /* TANH(X) * RETURN THE HYPERBOLIC TANGENT OF X * DOUBLE PRECISION (VAX D FORMAT 56 BITS, IEEE DOUBLE 53 BITS) - * CODED IN C BY K.C. NG, 1/8/85; + * CODED IN C BY K.C. NG, 1/8/85; * REVISED BY K.C. NG on 2/8/85, 2/11/85, 3/7/85, 3/24/85. * * Required system supported functions : @@ -85,7 +85,7 @@ double x; sign=copysign(one,x); x=copysign(x,one); - if(x < 22.0) + if(x < 22.0) if( x > one ) return(copysign(one-two/(expm1(x+x)+two),sign)); else if ( x > small ) diff --git a/lib/libm/ieee/cabs.c b/lib/libm/ieee/cabs.c index c4a6fb063b4b..5f1fc6250203 100644 --- a/lib/libm/ieee/cabs.c +++ b/lib/libm/ieee/cabs.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)cabs.c 8.1 (Berkeley) 6/4/93"; /* HYPOT(X,Y) * RETURN THE SQUARE ROOT OF X^2 + Y^2 WHERE Z=X+iY * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) - * CODED IN C BY K.C. NG, 11/28/84; + * CODED IN C BY K.C. NG, 11/28/84; * REVISED BY K.C. NG, 7/12/85. * * Required system supported functions : @@ -52,16 +52,16 @@ static char sccsid[] = "@(#)cabs.c 8.1 (Berkeley) 6/4/93"; * y if y > x (hence x is never smaller than y). * 2. Hypot(x,y) is computed by: * Case I, x/y > 2 - * + * * y * hypot = x + ----------------------------- * 2 * sqrt ( 1 + [x/y] ) + x/y * - * Case II, x/y <= 2 + * Case II, x/y <= 2 * y * hypot = x + -------------------------------------------------- - * 2 + * 2 * [x/y] - 2 * (sqrt(2)+1) + (x-y)/y + ----------------------------- * 2 @@ -107,7 +107,7 @@ double hypot(x,y) double x, y; { - static const double zero=0, one=1, + static const double zero=0, one=1, small=1.0E-18; /* fl(1+small)==1 */ static const ibig=30; /* fl(1+2**(2*ibig))==1 */ double t,r; @@ -115,15 +115,15 @@ double x, y; if(finite(x)) if(finite(y)) - { + { x=copysign(x,one); y=copysign(y,one); - if(y > x) + if(y > x) { t=x; x=y; y=t; } if(x == zero) return(zero); if(y == zero) return(x); exp= logb(x); - if(exp-(int)logb(y) > ibig ) + if(exp-(int)logb(y) > ibig ) /* raise inexact flag and return |x| */ { one+small; return(x); } @@ -144,7 +144,7 @@ double x, y; else if(y==y) /* y is +-INF */ return(copysign(y,one)); - else + else return(y); /* y is NaN and x is finite */ else if(x==x) /* x is +-INF */ @@ -199,16 +199,16 @@ double x, y; if(finite(x)) if(finite(y)) - { + { x=copysign(x,one); y=copysign(y,one); - if(y > x) + if(y > x) { temp=x; x=y; y=temp; } if(x == zero) return(zero); if(y == zero) return(x); exp= logb(x); x=scalb(x,-exp); - if(exp-(int)logb(y) > ibig ) + if(exp-(int)logb(y) > ibig ) /* raise inexact flag and return |x| */ { one+small; return(scalb(x,exp)); } else y=scalb(y,-exp); @@ -217,7 +217,7 @@ double x, y; else if(y==y) /* y is +-INF */ return(copysign(y,one)); - else + else return(y); /* y is NaN and x is finite */ else if(x==x) /* x is +-INF */ diff --git a/lib/libm/ieee/cbrt.c b/lib/libm/ieee/cbrt.c index fe5fb9551109..6d737792e13a 100644 --- a/lib/libm/ieee/cbrt.c +++ b/lib/libm/ieee/cbrt.c @@ -50,8 +50,8 @@ static char sccsid[] = "@(#)cbrt.c 8.1 (Berkeley) 6/4/93"; * long interger at the address of a floating point number will be the * leading 32 bits of that floating point number (i.e., sign, exponent, * and the 20 most significant bits). - * On a National machine, it has different ordering; therefore, this code - * must be compiled with flag -DNATIONAL. + * On a National machine, it has different ordering; therefore, this code + * must be compiled with flag -DNATIONAL. */ #if !defined(vax)&&!defined(tahoe) @@ -65,7 +65,7 @@ static const double F= 45./28., G= 5./14.; -double cbrt(x) +double cbrt(x) double x; { double r,s,t=0.0,w; @@ -93,15 +93,15 @@ double x; t*=x; pt[n0]=pt[n0]/3+B2; } else - pt[n0]=px[n0]/3+B1; + pt[n0]=px[n0]/3+B1; /* new cbrt to 23 bits, may be implemented in single precision */ r=t*t/x; s=C+r*t; - t*=G+F/(s+E+D/s); + t*=G+F/(s+E+D/s); - /* chopped to 20 bits and make it larger than cbrt(x) */ + /* chopped to 20 bits and make it larger than cbrt(x) */ pt[n1]=0; pt[n0]+=0x00000001; diff --git a/lib/libm/ieee/support.c b/lib/libm/ieee/support.c index e97683942188..0ae10bb1e4c8 100644 --- a/lib/libm/ieee/support.c +++ b/lib/libm/ieee/support.c @@ -35,37 +35,37 @@ static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ -/* - * Some IEEE standard 754 recommended functions and remainder and sqrt for +/* + * Some IEEE standard 754 recommended functions and remainder and sqrt for * supporting the C elementary functions. ****************************************************************************** * WARNING: * These codes are developed (in double) to support the C elementary * functions temporarily. They are not universal, and some of them are very - * slow (in particular, drem and sqrt is extremely inefficient). Each - * computer system should have its implementation of these functions using + * slow (in particular, drem and sqrt is extremely inefficient). Each + * computer system should have its implementation of these functions using * its own assembler. ****************************************************************************** * * IEEE 754 required operations: - * drem(x,p) + * drem(x,p) * returns x REM y = x - [x/y]*y , where [x/y] is the integer * nearest x/y; in half way case, choose the even one. - * sqrt(x) - * returns the square root of x correctly rounded according to + * sqrt(x) + * returns the square root of x correctly rounded according to * the rounding mod. * * IEEE 754 recommended functions: - * (a) copysign(x,y) - * returns x with the sign of y. - * (b) scalb(x,N) + * (a) copysign(x,y) + * returns x with the sign of y. + * (b) scalb(x,N) * returns x * (2**N), for integer values N. - * (c) logb(x) - * returns the unbiased exponent of x, a signed integer in - * double precision, except that logb(0) is -INF, logb(INF) + * (c) logb(x) + * returns the unbiased exponent of x, a signed integer in + * double precision, except that logb(0) is -INF, logb(INF) * is +INF, and logb(NAN) is that NAN. - * (d) finite(x) - * returns the value TRUE if -INF < x < +INF and returns + * (d) finite(x) + * returns the value TRUE if -INF < x < +INF and returns * FALSE otherwise. * * @@ -78,7 +78,7 @@ static char sccsid[] = "@(#)support.c 8.1 (Berkeley) 6/4/93"; #if defined(vax)||defined(tahoe) /* VAX D format */ #include <errno.h> static const unsigned short msign=0x7fff , mexp =0x7f80 ; - static const short prep1=57, gap=7, bias=129 ; + static const short prep1=57, gap=7, bias=129 ; static const double novf=1.7E38, nunf=3.0E-39, zero=0.0 ; #else /* defined(vax)||defined(tahoe) */ static const unsigned short msign=0x7fff, mexp =0x7ff0 ; @@ -97,7 +97,7 @@ double x; int N; unsigned short *px=(unsigned short *) &x; #endif /* national */ - if( x == zero ) return(x); + if( x == zero ) return(x); #if defined(vax)||defined(tahoe) if( (k= *px & mexp ) != ~msign ) { @@ -117,7 +117,7 @@ double x; int N; if( k < (mexp>>gap) ) *px = (*px&~mexp) | (k<<gap); else x=novf+novf; /* overflow */ else - if( k > -prep1 ) + if( k > -prep1 ) /* gradual underflow */ {*px=(*px&~mexp)|(short)(1<<gap); x *= scalb(1.0,k-1);} else @@ -147,7 +147,7 @@ double x,y; } double logb(x) -double x; +double x; { #ifdef national @@ -164,8 +164,8 @@ double x; return ( (k>>gap) - bias ); else if( x != zero) return ( -1022.0 ); - else - return(-(1.0/zero)); + else + return(-(1.0/zero)); else if(x != x) return(x); else @@ -174,7 +174,7 @@ double x; } finite(x) -double x; +double x; { #if defined(vax)||defined(tahoe) return(1); @@ -192,16 +192,16 @@ double x,p; { short sign; double hp,dp,tmp; - unsigned short k; + unsigned short k; #ifdef national unsigned short - *px=(unsigned short *) &x +3, + *px=(unsigned short *) &x +3, *pp=(unsigned short *) &p +3, *pd=(unsigned short *) &dp +3, *pt=(unsigned short *) &tmp+3; #else /* national */ unsigned short - *px=(unsigned short *) &x , + *px=(unsigned short *) &x , *pp=(unsigned short *) &p , *pd=(unsigned short *) &dp , *pt=(unsigned short *) &tmp; @@ -230,13 +230,13 @@ double x,p; #endif /* defined(vax)||defined(tahoe) */ { if (p != p) return p; else return x;} - else if ( ((*pp & mexp)>>gap) <= 1 ) + else if ( ((*pp & mexp)>>gap) <= 1 ) /* subnormal p, or almost subnormal p */ { double b; b=scalb(1.0,(int)prep1); p *= b; x = drem(x,p); x *= b; return(drem(x,p)/b);} else if ( p >= novf/2) { p /= 2 ; x /= 2; return(drem(x,p)*2);} - else + else { dp=p+p; hp=p/2; sign= *px & ~msign ; @@ -294,13 +294,13 @@ double x; } /* sqrt(INF) is INF */ - if(!finite(x)) return(x); + if(!finite(x)) return(x); /* scale x to [1,4) */ n=logb(x); x=scalb(x,-n); if((m=logb(x))!=0) x=scalb(x,-m); /* subnormal number */ - m += n; + m += n; n = m/2; if((n+n)!=m) {x *= 2; m -=1; n=m/2;} @@ -313,23 +313,23 @@ double x; else s *= 2; } - + /* generate the last bit and determine the final rounding */ - r/=2; x *= 4; + r/=2; x *= 4; if(x==zero) goto end; 100+r; /* trigger inexact flag */ if(s<x) { q+=r; x -=s; s += 2; s *= 2; x *= 4; - t = (x-s)-5; + t = (x-s)-5; b=1.0+3*r/4; if(b==1.0) goto end; /* b==1 : Round-to-zero */ b=1.0+r/4; if(b>1.0) t=1; /* b>1 : Round-to-(+INF) */ if(t>=0) q+=r; } /* else: Round-to-nearest */ - else { - s *= 2; x *= 4; - t = (x-s)-1; + else { + s *= 2; x *= 4; + t = (x-s)-1; b=1.0+3*r/4; if(b==1.0) goto end; b=1.0+r/4; if(b>1.0) t=1; if(t>=0) q+=r; } - + end: return(scalb(q,n)); } @@ -342,13 +342,13 @@ end: return(scalb(q,n)); * * Warning: this code should not get compiled in unless ALL of * the following machine-dependent routines are supplied. - * + * * Required machine dependent functions (not on a VAX): * swapINX(i): save inexact flag and reset it to "i" * swapENI(e): save inexact enable and reset it to "e" */ -double drem(x,y) +double drem(x,y) double x,y; { @@ -363,8 +363,8 @@ double x,y; double hy,y1,t,t1; short k; long n; - int i,e; - unsigned short xexp,yexp, *px =(unsigned short *) &x , + int i,e; + unsigned short xexp,yexp, *px =(unsigned short *) &x , nx,nf, *py =(unsigned short *) &y , sign, *pt =(unsigned short *) &t , *pt1 =(unsigned short *) &t1 ; @@ -381,7 +381,7 @@ double x,y; /* save the inexact flag and inexact enable in i and e respectively * and reset them to zero */ - i=swapINX(0); e=swapENI(0); + i=swapINX(0); e=swapENI(0); /* subnormal number */ nx=0; @@ -391,7 +391,7 @@ double x,y; if( yexp <= m57 ) {py[n0]+=m57; nx+=m57; yexp+=m57;} nf=nx; - py[n0] &= 0x7fff; + py[n0] &= 0x7fff; px[n0] &= 0x7fff; /* mask off the least significant 27 bits of y */ @@ -408,7 +408,7 @@ loop: if(k>0) /* if x/y >= 2**26, scale up y so that x/y < 2**26 */ {pt[n0]+=k;pt1[n0]+=k;} n=x/t; x=(x-n*t1)-n*(t-t1); - } + } /* end while (x > y) */ if(nx!=0) {t=1.0; pt[n0]+=nx; x*=t; nx=0; goto loop;} @@ -416,14 +416,14 @@ loop: /* final adjustment */ hy=y/2.0; - if(x>hy||((x==hy)&&n%2==1)) x-=y; + if(x>hy||((x==hy)&&n%2==1)) x-=y; px[n0] ^= sign; if(nf!=0) { t=1.0; pt[n0]-=nf; x*=t;} /* restore inexact flag and inexact enable */ - swapINX(i); swapENI(e); + swapINX(i); swapENI(e); - return(x); + return(x); } #endif @@ -435,7 +435,7 @@ loop: * * Warning: this code should not get compiled in unless ALL of * the following machine-dependent routines are supplied. - * + * * Required machine dependent functions: * swapINX(i) ...return the status of INEXACT flag and reset it to "i" * swapRM(r) ...return the current Rounding Mode and reset it to "r" @@ -456,16 +456,16 @@ double x; double const b54=134217728.*134217728.; /* b54=2**54 */ long mx,scalx; long const mexp=0x7ff00000; - int i,j,r,e,swapINX(),swapRM(),swapENI(); + int i,j,r,e,swapINX(),swapRM(),swapENI(); unsigned long *py=(unsigned long *) &y , *pt=(unsigned long *) &t , *px=(unsigned long *) &x ; #ifdef national /* ordering of word in a floating point number */ - const int n0=1, n1=0; + const int n0=1, n1=0; #else - const int n0=0, n1=1; + const int n0=0, n1=1; #endif -/* Rounding Mode: RN ...round-to-nearest +/* Rounding Mode: RN ...round-to-nearest * RZ ...round-towards 0 * RP ...round-towards +INF * RM ...round-towards -INF @@ -502,10 +502,10 @@ double x; t=x/y; y=y+t; py[n0]=py[n0]-0x00100006; py[n1]=0; /* triple to almost 56 sig. bits; now y approx. sqrt(x) to within 1 ulp */ - t=y*y; z=t; pt[n0]+=0x00100000; t+=z; z=(x-z)*y; + t=y*y; z=t; pt[n0]+=0x00100000; t+=z; z=(x-z)*y; t=z/(t+x) ; pt[n0]+=0x00100000; y+=t; -/* twiddle last bit to force y correctly rounded */ +/* twiddle last bit to force y correctly rounded */ swapRM(RZ); /* ...set Rounding Mode to round-toward-zero */ swapINX(0); /* ...clear INEXACT flag */ swapENI(e); /* ...restore inexact enable status */ diff --git a/lib/libmd/Makefile b/lib/libmd/Makefile index a2b6f2889860..3ec58ccaa366 100644 --- a/lib/libmd/Makefile +++ b/lib/libmd/Makefile @@ -4,11 +4,11 @@ LIB= md NOPIC= true SRCS= md2c.c md4c.c md5c.c md2hl.c md4hl.c md5hl.c MAN3+= mdX.3 -MLINKS+=mdX.3 MD2Init.3 mdX.3 MD2Update.3 mdX.3 MD2Final.3 +MLINKS+=mdX.3 MD2Init.3 mdX.3 MD2Update.3 mdX.3 MD2Final.3 MLINKS+=mdX.3 MD2End.3 mdX.3 MD2File.3 mdX.3 MD2Data.3 -MLINKS+=mdX.3 MD4Init.3 mdX.3 MD4Update.3 mdX.3 MD4Final.3 +MLINKS+=mdX.3 MD4Init.3 mdX.3 MD4Update.3 mdX.3 MD4Final.3 MLINKS+=mdX.3 MD4End.3 mdX.3 MD4File.3 mdX.3 MD4Data.3 -MLINKS+=mdX.3 MD5Init.3 mdX.3 MD5Update.3 mdX.3 MD5Final.3 +MLINKS+=mdX.3 MD5Init.3 mdX.3 MD5Update.3 mdX.3 MD5Final.3 MLINKS+=mdX.3 MD5End.3 mdX.3 MD5File.3 mdX.3 MD5Data.3 CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver CFLAGS+= -I${.CURDIR} diff --git a/lib/libmd/mdXhl.c b/lib/libmd/mdXhl.c index 10c521c1d387..d99fb4389920 100644 --- a/lib/libmd/mdXhl.c +++ b/lib/libmd/mdXhl.c @@ -6,7 +6,7 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id$ + * $Id: mdXhl.c,v 1.4 1995/04/27 16:05:51 wollman Exp $ * */ @@ -26,7 +26,7 @@ MDXEnd(MDX_CTX *ctx) char *p = malloc(33); unsigned char digest[16]; static const char hex[]="0123456789abcdef"; - + if(!p) return 0; MDXFinal(digest,ctx); for(i=0;i<16;i++) { diff --git a/lib/libmytinfo/TESTS/caps.c b/lib/libmytinfo/TESTS/caps.c index 9d4f00f04acb..e90d26ebd4a2 100644 --- a/lib/libmytinfo/TESTS/caps.c +++ b/lib/libmytinfo/TESTS/caps.c @@ -1,6 +1,6 @@ /* * caps.c - * + * * By Ross Ridge * Public Domain * 92/02/01 07:29:45 diff --git a/lib/libmytinfo/TESTS/clear.c b/lib/libmytinfo/TESTS/clear.c index 1a4767aa7cf6..b603a522f03a 100644 --- a/lib/libmytinfo/TESTS/clear.c +++ b/lib/libmytinfo/TESTS/clear.c @@ -6,7 +6,7 @@ * 92/02/01 07:29:47 * * clear - * + * * clears the terminal's screen * */ @@ -146,7 +146,7 @@ int c; int main() { - setupterm((char *) 0, 1, (int *) 0); + setupterm((char *) 0, 1, (int *) 0); if (clear_screen == (char *) 0) exit(1); tputs(clear_screen, lines > 0 ? lines : 1, putch); diff --git a/lib/libmytinfo/TESTS/tput.c b/lib/libmytinfo/TESTS/tput.c index a3b4a163f011..9c220b809b29 100644 --- a/lib/libmytinfo/TESTS/tput.c +++ b/lib/libmytinfo/TESTS/tput.c @@ -1,6 +1,6 @@ /* * tput.c - * + * * By Ross Ridge * Public Domain * 92/02/01 07:30:39 diff --git a/lib/libmytinfo/TESTS/tset.c b/lib/libmytinfo/TESTS/tset.c index f04c321391bd..3d1eb65ce0c0 100644 --- a/lib/libmytinfo/TESTS/tset.c +++ b/lib/libmytinfo/TESTS/tset.c @@ -1,6 +1,6 @@ /* * tset.c - * + * * By Ross Ridge * Public Domain * 92/02/19 18:53:12 @@ -192,7 +192,7 @@ int ask; { ask = 1; *map++ = '\0'; } - if (*map == '\0') + if (*map == '\0') quit(-1, "bad argument to 'm' switch"); if (type[0] != '\0' && strcmp(type, term) != 0) { @@ -548,7 +548,7 @@ char **argv; { break; } } - + cleanup = clean; path = _buildpath("$MYTERMINFO", 2, @@ -756,7 +756,7 @@ char **argv; { #endif #ifdef USE_SGTTY - + #ifdef USE_NEWBSDTTY if (newbsdtty) { if (ioctl(2, TIOCSETD, NTTYDISC) == -1) { @@ -802,7 +802,7 @@ char **argv; { SETTO(VKILL, tty.sg_kill, "Kill", c); } - + #ifdef USE_INTERRUPT if (interrupt_char != -1) { if (interrupt_char != -2) { @@ -914,6 +914,6 @@ char **argv; { } break; } - + return 0; } diff --git a/lib/libmytinfo/TESTS/ttest.c b/lib/libmytinfo/TESTS/ttest.c index 3839e9f1881b..d6cc36ebad26 100644 --- a/lib/libmytinfo/TESTS/ttest.c +++ b/lib/libmytinfo/TESTS/ttest.c @@ -6,7 +6,7 @@ * 92/02/01 07:30:47 * */ - + #define NOTLIB #include "defs.h" #include <term.h> @@ -18,7 +18,7 @@ cup(x,y) int x, y; { if (columns < 2 || lines < 2) return -1; - if (cursor_address != NULL) + if (cursor_address != NULL) putp(tparm(cursor_address, y, x)); else if (cursor_home != NULL && cursor_down != NULL && cursor_right != NULL) { @@ -68,12 +68,12 @@ clear() { void nl() { - if (newline != NULL) + if (newline != NULL) putp(newline); else if (carriage_return != NULL && cursor_down != NULL) { putp(cursor_down); putp(carriage_return); - } else + } else quit(-1, "can't do a newline"); return; } @@ -176,7 +176,7 @@ char **argv; { #endif #endif def_prog_mode(); - + clear(); printf("columns = %d", columns); nl(); @@ -219,10 +219,10 @@ char **argv; { putchar('\\'); } } else if (carriage_return != NULL) { - for(i = 0; i < columns / 4 + 1; i++) + for(i = 0; i < columns / 4 + 1; i++) putchar('/'); putp(carriage_return); - for(i = 0; i < columns / 4 + 1; i++) + for(i = 0; i < columns / 4 + 1; i++) putchar('\\'); } nl(); @@ -292,6 +292,6 @@ char **argv; { clear(); reset_shell_mode(); - + return (0); } diff --git a/lib/libmytinfo/addstr.c b/lib/libmytinfo/addstr.c index 50fb4111f9b4..d3d74448e139 100644 --- a/lib/libmytinfo/addstr.c +++ b/lib/libmytinfo/addstr.c @@ -18,13 +18,13 @@ static char const SCCSid[] = "@(#) mytinfo addstr.c 3.2 92/02/01 public domain, /* * I think this routine could be improved, as it is now it searches a * linked list of strbufs for one that has enough room left for the - * string. The only thing else I can think of doing would be to + * string. The only thing else I can think of doing would be to * expand a buffer by realloc and then fix the string pointers if it * moves. */ static struct strbuf *strbuf = NULL; - + struct strbuf * _endstr() { register struct strbuf *p; @@ -81,7 +81,7 @@ TERMINAL *p; { q = p->strbuf; while(q != NULL) { - p->strbuf = q->next; + p->strbuf = q->next; free((anyptr) q); q = p->strbuf; } diff --git a/lib/libmytinfo/bsearch.c b/lib/libmytinfo/bsearch.c index 34fc0fd15883..aa4eabfc890e 100644 --- a/lib/libmytinfo/bsearch.c +++ b/lib/libmytinfo/bsearch.c @@ -52,7 +52,7 @@ static char const SCCSid[] = "@(#) mytinfo bsearch.c 3.4 92/06/04 public domain, * $OLog: bsearch.c,v $ * Revision 1.1 88/06/11 20:41:48 root * Initial revision - * + * */ #endif diff --git a/lib/libmytinfo/buildpath.c b/lib/libmytinfo/buildpath.c index 5d1c64ad4753..cecba422e2c8 100644 --- a/lib/libmytinfo/buildpath.c +++ b/lib/libmytinfo/buildpath.c @@ -1,6 +1,6 @@ /* * buildpath.c - * + * * By Ross Ridge * Public Domain * 92/02/01 07:29:42 @@ -9,7 +9,7 @@ * from its arguments. It returns a pointer to a structure that is used by * other routines as the list of file names to search for terminal * descriptions. It is passed a variable number of arguments consisting - * of file name and type pairs. The file name can actually be a list of + * of file name and type pairs. The file name can actually be a list of * file names seperated by spaces and any environment variables specified * by a dollar sign ($) followed by its name are substituted in. A type * of 1 indicates that the file name may actually be termcap description @@ -27,7 +27,7 @@ static const char SCCSid[] = "@(#) mytinfo buildpath.c 3.2 92/02/01 public domai #endif /* more memory is allocated for file names every HUNK file names */ -#define HUNK 32 +#define HUNK 32 /* characters that seperate file names in a list */ #define SEPERATORS " :" @@ -58,7 +58,7 @@ int type; { if (files >= size) { size += HUNK; if (path == NULL) - path = (struct term_path *) + path = (struct term_path *) malloc(size * sizeof(struct term_path)); else path = (struct term_path *) @@ -77,7 +77,7 @@ int type; { path[files].file = strcpy(s, file); } path[files].type = type; - + return ++files; } @@ -155,7 +155,7 @@ va_dcl if (*s == '$') { s++; j = 0; - while(*s != '\0' && (*s == '_' || isalnum(*s))) + while(*s != '\0' && (*s == '_' || isalnum(*s))) if (j < MAX_NAME) { name[j] = *s++; j++; @@ -171,7 +171,7 @@ va_dcl } else break; } - } else if (*s == '/') + } else if (*s == '/') s++; } else { if (i < MAX_BUF) { @@ -192,7 +192,7 @@ va_dcl while ((s = strsep(&p, SEPERATORS)) != NULL && *s == '\0') ; } - } else + } else if (addfile(line, type) == 0) return NULL; file = va_arg(ap, char *); diff --git a/lib/libmytinfo/config.h b/lib/libmytinfo/config.h index 486fa3a4c4c5..87afa0508e56 100644 --- a/lib/libmytinfo/config.h +++ b/lib/libmytinfo/config.h @@ -49,7 +49,7 @@ #undef USE_STDARG /* you have a <stdarg.h> */ #undef USE_STDDEF /* you have a <stddef.h> */ -#define const +#define const #define volatile #define noreturn /* a function that doesn't return */ @@ -86,4 +86,4 @@ typedef void *anyptr; #define TERMINFODIR "/usr/lib/terminfo" -#endif +#endif diff --git a/lib/libmytinfo/fillterm.c b/lib/libmytinfo/fillterm.c index 4797f1a625c5..8e120c9caa62 100644 --- a/lib/libmytinfo/fillterm.c +++ b/lib/libmytinfo/fillterm.c @@ -33,13 +33,13 @@ struct term_path *path; { _term_buf.strs[--i] = (char *) -1; _term_buf.name_all = NULL; - + r = _findterm(name, path, buf); switch(r) { case 1: if (_gettcap(buf, &_term_buf, path) != 0) return -3; - _tcapconv(); + _tcapconv(); _tcapdefault(); break; case 2: diff --git a/lib/libmytinfo/findterm.c b/lib/libmytinfo/findterm.c index 04f6ef6c955c..1fe5a9b66a98 100644 --- a/lib/libmytinfo/findterm.c +++ b/lib/libmytinfo/findterm.c @@ -170,7 +170,7 @@ char *file; { *dp++ = '\\'; *dp++ = c; continue; - } + } *dp++ = c; } *dp = '\0'; diff --git a/lib/libmytinfo/gettbin.c b/lib/libmytinfo/gettbin.c index 202f4cb0bf0e..678a7d8050f6 100644 --- a/lib/libmytinfo/gettbin.c +++ b/lib/libmytinfo/gettbin.c @@ -18,13 +18,13 @@ static const char SCCSid[] = "@(#) mytinfo gettbin.c 3.2 92/02/01 public domain, extern int _boolorder[], _numorder[], _strorder[]; -#ifdef TRUE_BYTE_ORDERING +#ifdef TRUE_BYTE_ORDERING /* 8 bit char, 16 bit short, lsb first, twos complement */ #define convshort(s) (*(short *)(s)) #else -#ifdef TWOS_COPLEMENT +#ifdef TWOS_COPLEMENT /* 8 bit char, 16 bit short, lsb last, twos complement */ #define convshort(s) ((short)(((s[0] & 0377) << 8) | (s[1] & 0377))) @@ -101,7 +101,7 @@ TERMINAL *cur; { s = buf + 12 + sz_names + sz_bools; for(i = 0; i < n_nums && _numorder[i] != -1; i++, s += 2) { - if (convshort(s) == -2) + if (convshort(s) == -2) cur->nums[_numorder[i]] = -1; else if (cur->nums[_numorder[i]] == -2 && convshort(s) != -1) cur->nums[_numorder[i]] = convshort(s); @@ -120,7 +120,7 @@ TERMINAL *cur; { if ((cur->strs[_strorder[i]] = _addstr(strtbl + convshort(s))) == NULL) return 1; - } + } } return 0; diff --git a/lib/libmytinfo/gettcap.c b/lib/libmytinfo/gettcap.c index ac900c280af7..1424b88d93a2 100644 --- a/lib/libmytinfo/gettcap.c +++ b/lib/libmytinfo/gettcap.c @@ -82,7 +82,7 @@ struct term_path *path; { sp++; } else mul = 0; - + } while(*sp != '\0' && *sp != ':') { switch(*sp) { @@ -98,7 +98,7 @@ struct term_path *path; { case 'f': *dp++ = '\f'; break; case 's': *dp++ = ' '; break; - case '^': + case '^': case '\\': case ',': case ':': @@ -177,7 +177,7 @@ struct term_path *path; { } else if (*sp == '?') { *dp++ = '\177'; sp++; - } else + } else *dp++ = '^'; break; case '$': @@ -195,7 +195,7 @@ struct term_path *path; { else sprintf(dp, "$<%d.%d", pad, fract); dp += strlen(dp); - if (mul) + if (mul) *dp++ = '*'; *dp++ = '>'; } @@ -211,7 +211,7 @@ struct term_path *path; { break; if ((ct->strs[ind] = _addstr(entry)) == NULL) return 1; - break; + break; case '#': #ifdef DEBUG putchar('#'); diff --git a/lib/libmytinfo/gettinfo.c b/lib/libmytinfo/gettinfo.c index d0ef43beeb7a..7b7b4451d384 100644 --- a/lib/libmytinfo/gettinfo.c +++ b/lib/libmytinfo/gettinfo.c @@ -90,7 +90,7 @@ TERMINAL *cur; { case 'f': *dp++ = '\f'; break; case 's': *dp++ = ' '; break; - case '^': + case '^': case '\\': case ',': case ':': @@ -116,7 +116,7 @@ TERMINAL *cur; { c = c * 8 + (*++sp-'0'); switch((char)c) { case 0: - if (flag == 'K') + if (flag == 'K') *dp++ = '\200'; else { *dp++ = '\\'; @@ -161,7 +161,7 @@ TERMINAL *cur; { *dp++ = '0'; } sp++; - } else + } else *dp++ = '^'; break; default: @@ -181,7 +181,7 @@ TERMINAL *cur; { break; if ((ct->strs[ind] = _addstr(entry)) == NULL) return 1; - break; + break; case '#': #ifdef DEBUG putchar('#'); diff --git a/lib/libmytinfo/mkcapsort.c b/lib/libmytinfo/mkcapsort.c index 21c1a4a73d2d..9079dcf9e88b 100644 --- a/lib/libmytinfo/mkcapsort.c +++ b/lib/libmytinfo/mkcapsort.c @@ -29,7 +29,7 @@ char **sstrnames[NUM_OF_STRS], **sstrcodes[NUM_OF_STRS], **sstrfnames[NUM_OF_STR int main() { register int i; - + i = NUM_OF_BOOLS; while(i) { i--; @@ -37,7 +37,7 @@ main() { sboolcodes[i] = &boolcodes[i]; sboolfnames[i] = &boolfnames[i]; } - + i = NUM_OF_NUMS; while(i) { i--; @@ -119,7 +119,7 @@ main() { printf("};\n\n"); printf("char **_sstrcodes[] = {\n"); - for(i = 0; i < NUM_OF_STRS; i++) + for(i = 0; i < NUM_OF_STRS; i++) printf("\tstrcodes + %d,\n", sstrcodes[i] - strcodes); printf(" (char **) 0\n"); printf("};\n\n"); diff --git a/lib/libmytinfo/mktermhead.c b/lib/libmytinfo/mktermhead.c index f70079b85b0e..bacf051e69a7 100644 --- a/lib/libmytinfo/mktermhead.c +++ b/lib/libmytinfo/mktermhead.c @@ -2,7 +2,7 @@ * mktermhead.c * * By Ross Ridge - * Public Domain + * Public Domain * 92/06/04 11:38:57 * * mktermhead [-n caps] file diff --git a/lib/libmytinfo/mkversion.c b/lib/libmytinfo/mkversion.c index b34ac73232cd..9fbc12ea0282 100644 --- a/lib/libmytinfo/mkversion.c +++ b/lib/libmytinfo/mkversion.c @@ -2,7 +2,7 @@ * mkversion.c * * By Ross Ridge - * Public Domain + * Public Domain * 92/02/01 07:30:09 * * generates version.c diff --git a/lib/libmytinfo/readcaps.c b/lib/libmytinfo/readcaps.c index 47a76f875f4c..b78bdc191706 100644 --- a/lib/libmytinfo/readcaps.c +++ b/lib/libmytinfo/readcaps.c @@ -67,7 +67,7 @@ int len; { c = getc(f); if (c == EOF) return EOF; - + } *s = '\0'; #ifdef TEST @@ -108,7 +108,7 @@ int max; { else buf[count].flag = ' '; } - + c = getfield(f, buf[count].var, MAX_VARNAME); if (c == EOF || c == '\n' || c == 0) return -1; diff --git a/lib/libmytinfo/tcapconv.c b/lib/libmytinfo/tcapconv.c index 6a28b1129079..3cd4d367174f 100644 --- a/lib/libmytinfo/tcapconv.c +++ b/lib/libmytinfo/tcapconv.c @@ -30,7 +30,7 @@ static char *C_HT = "\t"; /* * This routine fills in caps that either had defaults under termcap or - * can be manufactured from obsolete termcap capabilities. + * can be manufactured from obsolete termcap capabilities. */ void @@ -56,7 +56,7 @@ _tcapdefault() { } /* vi doesn't use "do", but it does seems to use nl (or '\n') instead */ if (NOTSET(cursor_down)) { - if (DEF(linefeed_if_not_lf)) + if (DEF(linefeed_if_not_lf)) cursor_down = _addstr(linefeed_if_not_lf); else if (linefeed_is_newline != 1) { if (new_line_delay > 0) { @@ -69,7 +69,7 @@ _tcapdefault() { set_scroll_forward_to_lf = 0; if (NOTSET(scroll_forward) && crt_without_scrolling != 1) { set_scroll_forward_to_lf = 1; - if (DEF(linefeed_if_not_lf)) + if (DEF(linefeed_if_not_lf)) scroll_forward = _addstr(linefeed_if_not_lf); else if (linefeed_is_newline != 1) { if (new_line_delay > 0) { diff --git a/lib/libmytinfo/term.h b/lib/libmytinfo/term.h index e91aefaecaf6..f2b3a4d46275 100644 --- a/lib/libmytinfo/term.h +++ b/lib/libmytinfo/term.h @@ -1,5 +1,5 @@ /* - * term.h + * term.h * * This file was generated automatically. * @@ -525,7 +525,7 @@ #define _MAX_CHUNK 640 #endif /* OVERRIDE */ -/* +/* * 92/02/01 07:30:28 * @(#) mytinfo term.tail 3.2 92/02/01 public domain, By Ross Ridge * @@ -604,8 +604,8 @@ typedef struct _terminal { #else #ifdef _USE_TERMIO struct termio prog_mode, shell_mode; -#endif -#endif +#endif +#endif #endif /* else _USE_SGTTY */ #ifdef _USE_WINSZ #ifdef TIOCGWINSZ diff --git a/lib/libmytinfo/termcap.c b/lib/libmytinfo/termcap.c index 8e8a3f348de7..f914c0b85b49 100644 --- a/lib/libmytinfo/termcap.c +++ b/lib/libmytinfo/termcap.c @@ -31,7 +31,7 @@ char *term, *buf; { int r = -1; int fd; - if (term == NULL) + if (term == NULL) term = getenv("TERM"); if (term == NULL) return 0; @@ -95,7 +95,7 @@ char *term, *buf; { if (_init_tty() == ERR) return 0; - if ((s = getenv("LINES")) != NULL && atoi(s) > 0) + if ((s = getenv("LINES")) != NULL && atoi(s) > 0) lines = atoi(s); if ((s = getenv("COLUMNS")) != NULL && atoi(s) > 0) columns = atoi(s); @@ -113,7 +113,7 @@ tgetnum(cap) char *cap; { int ind; - cap2[0] = cap[0]; + cap2[0] = cap[0]; cap2[1] = cap[1]; cap2[2] = '\0'; @@ -128,7 +128,7 @@ tgetflag(cap) char *cap; { int ind; - cap2[0] = cap[0]; + cap2[0] = cap[0]; cap2[1] = cap[1]; cap2[2] = '\0'; @@ -145,7 +145,7 @@ char **area; { register char *sp, *dp; int ind; - cap2[0] = cap[0]; + cap2[0] = cap[0]; cap2[1] = cap[1]; cap2[2] = '\0'; diff --git a/lib/libmytinfo/terminfo.c b/lib/libmytinfo/terminfo.c index 342e08f0172c..0568588a71e3 100644 --- a/lib/libmytinfo/terminfo.c +++ b/lib/libmytinfo/terminfo.c @@ -52,7 +52,7 @@ int *err; { char buf[MAX_BUF]; - if (term == NULL) + if (term == NULL) term = getenv("TERM"); if (term == NULL) RETERR(0, "TERM not set\n") @@ -99,7 +99,7 @@ int *err; { _term_buf.fd = fd; if (_init_tty() == ERR) RETERR(0, "problem initializing tty\n"); - if ((s = getenv("LINES")) != NULL && atoi(s) > 0) + if ((s = getenv("LINES")) != NULL && atoi(s) > 0) lines = atoi(s); if ((s = getenv("COLUMNS")) != NULL && atoi(s) > 0) columns = atoi(s); diff --git a/lib/libmytinfo/tgoto.c b/lib/libmytinfo/tgoto.c index e94a66091390..1bc735b1f18a 100644 --- a/lib/libmytinfo/tgoto.c +++ b/lib/libmytinfo/tgoto.c @@ -32,7 +32,7 @@ tgoto(str, x, y) char *str; int x,y; { register char *sp; - + static char buf[MAX_LINE] = {'\\', '@'}; sp = str = tparm(str, y, x); diff --git a/lib/libmytinfo/tparm.c b/lib/libmytinfo/tparm.c index cdc4297f85d3..0cc2c89c3925 100644 --- a/lib/libmytinfo/tparm.c +++ b/lib/libmytinfo/tparm.c @@ -80,7 +80,7 @@ anyptr p; { return 1; else if (type == STRING) *(char **)p = arg_list[argnum].string; - else + else *(int *)p = arg_list[argnum].integer; } else { arg_list[argcnt].type = type; @@ -212,7 +212,7 @@ static int termcap; (UW) %-x subtract parameter FROM the character x and output it as a char (UW) %ax add the character x to parameter (GNU) %a[+*-/=][cp]x - GNU arithmetic. + GNU arithmetic. (UW) %sx subtract parameter FROM the character x %>xy if parameter > character x then add character y to parameter %B convert to BCD (parameter = (parameter/10)*16 + parameter%16) @@ -325,7 +325,7 @@ va_dcl { } ;/* FALLTHROUGH */ case 'C': - if (*sp == 'C') { + if (*sp == 'C') { if (getarg(termcap - 1, INTEGER, &i)) return OOPS; if (i >= 96) { @@ -419,11 +419,11 @@ va_dcl { return OOPS; ;/* FALLTHROUGH */ case '.': - if (termcap && fmt == NULL) + if (termcap && fmt == NULL) fmt = "%c"; ;/* FALLTHROUGH */ case 'd': - if (termcap && fmt == NULL) + if (termcap && fmt == NULL) fmt = "%d"; ;/* FALLTHROUGH */ case '2': @@ -431,7 +431,7 @@ va_dcl { fmt = "%02d"; ;/* FALLTHROUGH */ case '3': - if (termcap && fmt == NULL) + if (termcap && fmt == NULL) fmt = "%03d"; ;/* FALLTHROUGH */ case ':': case ' ': case '#': case 'u': @@ -475,7 +475,7 @@ va_dcl { sp++; fmt = sbuf; while(*fmt != '\0') { - if (*fmt == '$') + if (*fmt == '$') *dp++ = '\\'; *dp++ = *fmt++; } diff --git a/lib/libmytinfo/tputs.c b/lib/libmytinfo/tputs.c index efdda8a6e906..840b3c82c797 100644 --- a/lib/libmytinfo/tputs.c +++ b/lib/libmytinfo/tputs.c @@ -59,7 +59,7 @@ register int (*outc)(); /* some programmes expect this behaviour from tputs */ if (sp == NULL) { #ifdef DEBUG - fprintf(stderr, "tputs: NULL\n"); + fprintf(stderr, "tputs: NULL\n"); #endif return 0; } @@ -181,7 +181,7 @@ register int (*outc)(); #endif if (cur_term->pad || must_pad) { cnt = ((long) l * cur_term->baudrate - * (multiply_pad ? count : 1) + * (multiply_pad ? count : 1) + (10000L * BITSPERCHAR / 2L)) / (10000L * BITSPERCHAR); #ifdef TEST @@ -247,7 +247,7 @@ char **argv; { test_term.baudrate = 1200; test_term.pad = 0; test_term.padch = 0; - if (argc > 1) + if (argc > 1) test_term.baudrate = atoi(argv[1]); if (argc > 2) test_term.padch = argv[2][0]; diff --git a/lib/libmytinfo/tty.c b/lib/libmytinfo/tty.c index 640fb47eb674..2ba2a7ccf905 100644 --- a/lib/libmytinfo/tty.c +++ b/lib/libmytinfo/tty.c @@ -70,7 +70,7 @@ _lit_output() { if (tcgetattr(cur_term->fd, &old) == -1) return 0; #endif - if (!(old.c_oflag & OPOST) || !(old.c_oflag & ONLCR)) + if (!(old.c_oflag & OPOST) || !(old.c_oflag & ONLCR)) return 0; memcpy((anyptr)&tmp, (anyptr)&old, sizeof(old)); tmp.c_oflag &= ~OPOST; @@ -90,7 +90,7 @@ _norm_output() { tcsetattr(cur_term->fd, TCSADRAIN, &old); #endif } - + int _check_tty() { if ((cur_term->prog_mode.c_iflag & IXON) && cur_term->xon) @@ -245,7 +245,7 @@ _norm_output() { ioctl(cur_term->fd, TIOCSETP, &old); } -#endif +#endif int _check_tty() { diff --git a/lib/libncurses/TESTS/Makefile b/lib/libncurses/TESTS/Makefile index 4136d7437ef1..d1209821b869 100644 --- a/lib/libncurses/TESTS/Makefile +++ b/lib/libncurses/TESTS/Makefile @@ -6,9 +6,9 @@ CLEANFILES += $(TESTS) LIBS += -lncurses -lmytinfo -all: $(TESTS) +all: $(TESTS) -$(TESTS): +$(TESTS): $(CC) $(CFLAGS) $(LDFLAGS) ${.CURDIR}/$@.c -o $@ $(LIBS) test: test.c diff --git a/lib/libncurses/TESTS/battle.c b/lib/libncurses/TESTS/battle.c index e7785fccb035..5b5a9610def5 100644 --- a/lib/libncurses/TESTS/battle.c +++ b/lib/libncurses/TESTS/battle.c @@ -1,4 +1,4 @@ -/* +/* * battle.c - original author: Bruce Holloway * mods by: Chuck A DeGaul */ @@ -91,21 +91,21 @@ main(int argc, char **argv) while(awinna() == -1) { if (!blitz) { if (!salvo) { - if (turn) - cputurn(); + if (turn) + cputurn(); else plyturn(); } else { register int i; i = scount(turn); while (i--) { - if (turn) - if (cputurn()) - if (awinna() != -1) + if (turn) + if (cputurn()) + if (awinna() != -1) i = 0; - else - if(plyturn()) - if (awinna() != -1) + else + if(plyturn()) + if (awinna() != -1) i = 0; } } @@ -141,8 +141,8 @@ char *tmpname; initscr(); savetty(); - nonl(); - cbreak(); + nonl(); + cbreak(); noecho(); clear(); mvaddstr(4,29,"Welcome to Battleship!"); @@ -187,9 +187,9 @@ int i; } for(turn=0; turn<2; ++turn){ for(i=0; i<5; ++i) - if (!turn) + if (!turn) plyplace(&plyship[i]); - else + else cpuplace(&cpuship[i]); } turn = rnd(2); @@ -220,11 +220,11 @@ int c, d; placeship(ss,c,d); } -int +int getdir() { - prompt(); + prompt(); addstr("What direction (0=right, 1=down) ? "); return(sgetc("01")-'0'); } @@ -296,7 +296,7 @@ void error(s) char *s; { - prompt(); + prompt(); beep(); printw("%s -- hit any key to continue --",s); refresh(); @@ -305,7 +305,7 @@ char *s; void prompt(){ - move(22,0); + move(22,0); clrtoeol(); } @@ -319,12 +319,12 @@ redo: do { ch = getch(); if (ch == 0x7F || ch == 8) { - addstr("\b \b"); + addstr("\b \b"); refresh(); goto redo; } } while(ch < '0' || ch > '9'); - addch(x = ch); + addch(x = ch); refresh(); return((y-'A')*10+x-'0'); } @@ -336,7 +336,7 @@ struct _ships *ss; int c, d; do{ - c = rnd(100); + c = rnd(100); d = rnd(2); } while(!checkplace(ss,c,d)); placeship(ss,c,d); @@ -383,8 +383,8 @@ char *m; m = "Have some mercy for my %s!"; break; } - move(23,0); - clrtoeol(); + move(23,0); + clrtoeol(); beep(); printw(m,cpuship[c-1].name); refresh(); return(awinna() == -1); @@ -407,16 +407,16 @@ int sym, i, j; if (!(sym = board[OTHER][c])) return(0); for (i = 0; i < 5; ++i, ++ss) if (ss->symbol == sym) { - j = ss->hits; - ++j; + j = ss->hits; + ++j; ss->hits = j; - if (j == ss->length) + if (j == ss->length) return(i+1); return(0); } } -int +int cputurn() { int c, res, x, y, i, d; @@ -479,8 +479,8 @@ fndir: for(i=0, d=rnd(4); i++ < 4; d = (d+1) % 4){ case 2: --x; break; case 3: --y; break; } - if(x<0 || x>9 || y<0 || y>9){ cstart = -1; - goto redo; + if(x<0 || x>9 || y<0 || y>9){ cstart = -1; + goto redo; } if(!hits[turn][y*10+x]) break; } @@ -517,7 +517,7 @@ fndir: for(i=0, d=rnd(4); i++ < 4; d = (d+1) % 4){ sleep(1); } } - else { + else { if (seemiss) { mvaddch(7+(c/10),3+3*(c%10),' '); } else { @@ -590,18 +590,18 @@ int ch; ch = toupper(getch()); for (s1 = s; *s1 && ch != *s1; ++s1); if (*s1) { - addch(ch); + addch(ch); refresh(); return(ch); } } } -/* +/* * I should use getopts() from libc.a, but I'm leary that other UNIX * systems might not have it, although I'd love to use it. */ - + int do_options(c,op) int c; @@ -654,23 +654,23 @@ register int i; } } fprintf(stdout, "Playing optional game ("); - if (salvo) + if (salvo) fprintf(stdout, "salvo, noblitz, "); else if (blitz) fprintf(stdout, "blitz, nosalvo, "); - else + else fprintf(stdout, "noblitz, nosalvo, "); - if (ask) + if (ask) fprintf(stdout, "ask, "); - else + else fprintf(stdout, "noask, "); - if (seemiss) + if (seemiss) fprintf(stdout, "seemiss)\n"); - else + else fprintf(stdout, "noseemiss)\n"); - } + } else fprintf(stdout, "Playing standard game (no blitz, no slavo, no ask, no seemiss)\n"); diff --git a/lib/libncurses/TESTS/copy.c b/lib/libncurses/TESTS/copy.c index 6ded258b90d2..013f9dbe4237 100644 --- a/lib/libncurses/TESTS/copy.c +++ b/lib/libncurses/TESTS/copy.c @@ -25,7 +25,7 @@ int h, i; getch(); /* now, remove window 2 and restore the contents of window 1 */ - i = copywin(win1, win2, 5, 10, 0, 0, 14, 39, 0); + i = copywin(win1, win2, 5, 10, 0, 0, 14, 39, 0); wnoutrefresh(win1); wnoutrefresh(win2); printw("copywin returns %d\n", i); diff --git a/lib/libncurses/TESTS/ensor.c b/lib/libncurses/TESTS/ensor.c index 7ace03899db9..4eca9cb463c4 100644 --- a/lib/libncurses/TESTS/ensor.c +++ b/lib/libncurses/TESTS/ensor.c @@ -12,7 +12,7 @@ main() scrollok(stdscr, TRUE); - for (i=0; i<25; i++) + for (i=0; i<25; i++) printw("This is in the background, this should be left alone!\n"); refresh(); diff --git a/lib/libncurses/TESTS/hanoi.c b/lib/libncurses/TESTS/hanoi.c index e7da51d2fa6c..bf44cc48cc61 100644 --- a/lib/libncurses/TESTS/hanoi.c +++ b/lib/libncurses/TESTS/hanoi.c @@ -153,10 +153,10 @@ void InitTiles(int NTiles) { int Size, SlotNo; - + for(Size=NTiles*2+1, SlotNo=0; Size>=3; Size-=2) Pegs[0].Length[SlotNo++] = Size; - + Pegs[0].Count = NTiles; Pegs[1].Count = 0; Pegs[2].Count = 0; diff --git a/lib/libncurses/TESTS/knight.c b/lib/libncurses/TESTS/knight.c index cea9183e0947..73f7b42f9d93 100644 --- a/lib/libncurses/TESTS/knight.c +++ b/lib/libncurses/TESTS/knight.c @@ -28,7 +28,7 @@ int xpos[]={0,1,2,1,0,5,4,3,2,4,6,7,8,8,9,10,10,11,12,13,14,15,15,16, 13,23,25,27,27,2,3,4,5,6,7,4,3,2,1,0,1,2,5,4,5,6,6,7,8,9,8,9,10, 11,11,12,13,14,14,15}; -static char *instructions[] = +static char *instructions[] = { " Knight's Tour is a board game for one player. It is played on", "an eight by eight board and is based on the allowable moves that a knight", @@ -59,7 +59,7 @@ void init(void); int play(void); void drawboard(void); void dosquares(void); -void getfirst(void); +void getfirst(void); void getrc(void); void putstars(void); int evalmove(void); @@ -73,7 +73,7 @@ int main () { init (); - for (;;) + for (;;) if (!play ()) { endwin (); exit (0); @@ -91,12 +91,12 @@ init () title (1,23); mvaddstr (23, 25, "Would you like instructions? "); refresh(); - if ((toupper(getch())) == 'Y') + if ((toupper(getch())) == 'Y') instruct(); clear (); } -int +int play () { drawboard (); /* clear screen and drawboard */ @@ -106,7 +106,7 @@ play () getrc(); if (evalmove()) { putstars (); - if (!chkmoves()) + if (!chkmoves()) return (endgame ()); } else beep(); @@ -164,7 +164,7 @@ getfirst () /* get first square */ putstars (); move (23, 0); clrtobot(); -} +} void getrc () /* get row and column */ diff --git a/lib/libncurses/TESTS/ncurses.c b/lib/libncurses/TESTS/ncurses.c index 14630a8c5ffe..91512360a9da 100644 --- a/lib/libncurses/TESTS/ncurses.c +++ b/lib/libncurses/TESTS/ncurses.c @@ -42,20 +42,20 @@ char buf[BUFSIZ]; unsigned int c; int incount = 0, firsttime = 0; bool blocking = TRUE; - + refresh(); - + (void) printw("Delay in 10ths of a second (<CR> for blocking input)? "); echo(); getstr(buf); noecho(); - + if (isdigit(buf[0])) { timeout(atoi(buf) * 100); blocking = FALSE; } - + c = '?'; for (;;) { @@ -162,7 +162,7 @@ static void attr_test(void) static char *colors[] = { - "black", + "black", "red", "green", "yellow", @@ -238,7 +238,7 @@ static void color_edit(void) for (i = 0; i < COLORS; i++) { mvprintw(2 + i, 0, "%c %-8s:", - (i == current ? '>' : ' '), + (i == current ? '>' : ' '), (i < sizeof(colors)/sizeof(colors[0]) ? colors[i] : "")); attrset(COLOR_PAIR(i)); addstr(" "); @@ -321,7 +321,7 @@ static void color_edit(void) goto changeit; case '=': - usebase = 0; + usebase = 0; changeit: color_content(current, &red, &green, &blue); if (field == 0) @@ -339,7 +339,7 @@ static void color_edit(void) P(""); P("You are in the RGB value editor. Use the arrow keys to select one of"); P("the fields in one of the RGB triples of the current colors; the one"); - P("currently selected will be reverse-video highlighted."); + P("currently selected will be reverse-video highlighted."); P(""); P("To change a field, enter the digits of the new value; they won't be"); P("echoed. Finish by typing `='; the change will take effect instantly."); @@ -510,7 +510,7 @@ static void acs_display() mvaddstr(ACSY + 10,40, "ACS_LANTERN: "); addch(ACS_LANTERN); mvaddstr(ACSY + 11,40, "ACS_BLOCK: "); addch(ACS_BLOCK); -#define HYBASE (ACSY + 13) +#define HYBASE (ACSY + 13) mvprintw(HYBASE + 1, 0, "High-half characters via echochar:\n"); for (i = 0; i < 4; i++) { @@ -796,7 +796,7 @@ static void panner(WINDOW *pad, int iy, int ix, int (*pgetc)(void)) basey, basex, 0, 0, porty - (hscroll != (WINDOW *)NULL) - 1, - portx - (vscroll != (WINDOW *)NULL) - 1); + portx - (vscroll != (WINDOW *)NULL) - 1); if (vscroll) { int lowend, i, highend; diff --git a/lib/libncurses/TESTS/newdemo.c b/lib/libncurses/TESTS/newdemo.c index 97c368d1bd5d..5573557b08ec 100644 --- a/lib/libncurses/TESTS/newdemo.c +++ b/lib/libncurses/TESTS/newdemo.c @@ -1,4 +1,4 @@ -/* $Header: c:/curses/demos/RCS/newdemo.c%v 2.0 1992/11/15 03:32:03 MH Rel $ +/* $Header: /home/ncvs/src/lib/libncurses/TESTS/newdemo.c,v 1.1.1.1 1994/10/07 08:58:56 ache Exp $ * * newdemo.c - A demo program using PDCurses. The program illustrate * the use of colours for text output. @@ -9,7 +9,7 @@ #include <time.h> #include <ncurses.h> -#define delay_output(x) +#define delay_output(x) /* * The Australian map diff --git a/lib/libncurses/TESTS/over.c b/lib/libncurses/TESTS/over.c index 530e48d35574..1f336d4321c7 100644 --- a/lib/libncurses/TESTS/over.c +++ b/lib/libncurses/TESTS/over.c @@ -13,7 +13,7 @@ * keypress, then removes the top window. With ncurses, * * nothing changes on the display. * *********************************************************************/ - + # include <ncurses.h> /* ncurses include lives here */ main() @@ -54,7 +54,7 @@ main() wnoutrefresh(win1); wnoutrefresh(win2); doupdate(); - + /**************************************************************** * Await a keypress to show what we've done so far. * ****************************************************************/ diff --git a/lib/libncurses/TESTS/rain.c b/lib/libncurses/TESTS/rain.c index 83951ae12746..9779d0219998 100644 --- a/lib/libncurses/TESTS/rain.c +++ b/lib/libncurses/TESTS/rain.c @@ -58,7 +58,7 @@ float c; addstr("\\ /"); cursor(xpos[j],ypos[j]+2); addch('-'); - + if (j==0) j=4; else --j; cursor(xpos[j],ypos[j]-2); addch(' '); diff --git a/lib/libncurses/TESTS/scroll2.c b/lib/libncurses/TESTS/scroll2.c index 53abaa3c3801..e7b2e3093993 100644 --- a/lib/libncurses/TESTS/scroll2.c +++ b/lib/libncurses/TESTS/scroll2.c @@ -6,7 +6,7 @@ main() { int i; WINDOW * w; - + initscr(); cbreak(); @@ -21,7 +21,7 @@ main() mvaddstr (0, 0, "With the original wscrl"); #endif refresh(); - + for (i=0; i<ROWS-1; i++) { @@ -41,7 +41,7 @@ main() } getch(); wclear (w); - + for (i=0; i<ROWS-1; i++) { @@ -49,10 +49,10 @@ main() } mvwaddstr (w, ROWS-1, 0, "Moving two line at a time"); #ifndef LELE - mvaddstr (0, 30, "** THIS FAILS ON MY MACHINE WITH A BUS ERROR + mvaddstr (0, 30, "** THIS FAILS ON MY MACHINE WITH A BUS ERROR **"); #endif - + wrefresh(w); for (i = 0; i < 4; i++) { @@ -84,7 +84,7 @@ main() wrefresh(w); } getch(); - + endwin(); } diff --git a/lib/libncurses/TESTS/scroll3.c b/lib/libncurses/TESTS/scroll3.c index 1d63c464f028..b2a10c3e213a 100644 --- a/lib/libncurses/TESTS/scroll3.c +++ b/lib/libncurses/TESTS/scroll3.c @@ -3,7 +3,7 @@ main(int argc, char **argv) { WINDOW *w, *x; - + initscr(); w = newwin(0, 0, 0, 0); if (argc > 2) diff --git a/lib/libncurses/TESTS/test.c b/lib/libncurses/TESTS/test.c index 1fc3e6e9a037..f77f3a1e751e 100644 --- a/lib/libncurses/TESTS/test.c +++ b/lib/libncurses/TESTS/test.c @@ -1,14 +1,14 @@ #include <ncurses.h> - + main() { int x, y; initscr(); cbreak(); - nodelay(stdscr, TRUE); - + nodelay(stdscr, TRUE); + for (y = 0; y < 43; y++) for (x =0; x < 132; x++) { move(y,x); diff --git a/lib/libncurses/curses.h b/lib/libncurses/curses.h index 692c1a6faf53..5aa5f646c697 100644 --- a/lib/libncurses/curses.h +++ b/lib/libncurses/curses.h @@ -22,7 +22,7 @@ #define CURSES 1 #define CURSES_H 1 -#include <stdio.h> +#include <stdio.h> #include <stdarg.h> #ifndef NOTERMIOS #include <termios.h> @@ -53,7 +53,7 @@ typedef unsigned long chtype; #define A_PROTECT 0x01000000 #define A_CHARTEXT 0x000000ff #define A_COLOR 0x0000ff00 -#define COLOR_PAIR(n) (n << 8) +#define COLOR_PAIR(n) (n << 8) #define PAIR_NUMBER(a) ((a & A_COLOR) >> 8) /* colors */ @@ -321,7 +321,7 @@ extern int slk_touch(void); #define saveterm() def_prog_mode() #define crmode() cbreak() #define nocrmode() nocbreak() -#define gettmode() +#define gettmode() #define getyx(win,y,x) (y = (win)->_cury, x = (win)->_curx) #define getbegyx(win,y,x) (y = (win)->_begy, x = (win)->_begx) @@ -527,4 +527,4 @@ extern int slk_touch(void); #define KEY_UNDO 0630 /* undo key */ #define KEY_MAX 0777 /* Maximum curses key */ -#endif +#endif diff --git a/lib/libncurses/curses.priv.h b/lib/libncurses/curses.priv.h index ed747ea0ba86..42952ce68669 100644 --- a/lib/libncurses/curses.priv.h +++ b/lib/libncurses/curses.priv.h @@ -37,11 +37,11 @@ typedef struct sigaction sigaction_t; extern WINDOW *newscr; #ifdef TRACE -#define T(a) if (_tracing & TRACE_ORDINARY) _tracef a -#define TR(n, a) if (_tracing & (n)) _tracef a +#define T(a) if (_tracing & TRACE_ORDINARY) _tracef a +#define TR(n, a) if (_tracing & (n)) _tracef a extern int _tracing; extern char *visbuf(const char *); -#else +#else #define T(a) #define TR(n, a) #endif @@ -58,11 +58,11 @@ struct try { unsigned char ch; /* character at this node */ unsigned short value; /* code of string so far. 0 if none. */ }; - + /* * Structure for soft labels. */ - + typedef struct { char dirty; /* all labels have changed */ char hidden; /* soft lables are hidden */ @@ -92,7 +92,7 @@ struct screen { WINDOW *_stdscr; struct try *_keytry; /* "Try" for use with keypad mode */ unsigned int _fifo[FIFO_SIZE]; /* Buffer for pushed back characters */ - signed char _fifohead, + signed char _fifohead, _fifotail, _fifopeek; bool _endwin; diff --git a/lib/libncurses/lib_acs.c b/lib/libncurses/lib_acs.c index 640ab897099b..2b6d25b087d1 100644 --- a/lib/libncurses/lib_acs.c +++ b/lib/libncurses/lib_acs.c @@ -30,23 +30,23 @@ void init_acs() ACS_PLUS (acs_map['n']) ACS_S1 (acs_map['o']) scan line 1 ACS_S9 (acs_map['s']) scan line 9 - ACS_DIAMOND (acs_map['`']) diamond - ACS_CKBOARD (acs_map['a']) checker board (stipple) - ACS_DEGREE (acs_map['f']) degree symbol + ACS_DIAMOND (acs_map['`']) diamond + ACS_CKBOARD (acs_map['a']) checker board (stipple) + ACS_DEGREE (acs_map['f']) degree symbol ACS_PLMINUS (acs_map['g']) plus/minus ACS_BULLET (acs_map['~']) bullet ACS_LARROW (acs_map[',']) arrow pointing left ACS_RARROW (acs_map['+']) arrow pointing right ACS_DARROW (acs_map['.']) arrow pointing down - ACS_UARROW (acs_map['-']) arrow pointing up - ACS_BOARD (acs_map['h']) board of squares - ACS_LANTERN (acs_map['I']) lantern symbol + ACS_UARROW (acs_map['-']) arrow pointing up + ACS_BOARD (acs_map['h']) board of squares + ACS_LANTERN (acs_map['I']) lantern symbol ACS_BLOCK (acs_map['0']) solid square block */ T(("initializing ACS map")); - acs_map['l'] = acs_map['m'] = acs_map['k'] = acs_map['j'] = + acs_map['l'] = acs_map['m'] = acs_map['k'] = acs_map['j'] = acs_map['u'] = acs_map['t'] = acs_map['v'] = acs_map['w'] = (chtype)'+' & A_CHARTEXT; acs_map['q'] = (chtype)'-' & A_CHARTEXT; acs_map['x'] = (chtype)'|' & A_CHARTEXT; @@ -72,8 +72,8 @@ void init_acs() if (acs_chars != NULL) { int i = 0; int length = strlen(acs_chars); - - while (i < length) + + while (i < length) switch (acs_chars[i]) { case 'l':case 'm':case 'k':case 'j': case 'u':case 't':case 'v':case 'w': @@ -81,8 +81,8 @@ void init_acs() case 's':case '`':case 'a':case 'f': case 'g':case '~':case ',':case '+': case '.':case '-':case 'h':case 'I': - case '0': - acs_map[(unsigned int)(unsigned char)acs_chars[i]] = + case '0': + acs_map[(unsigned int)(unsigned char)acs_chars[i]] = (acs_chars[++i] & A_CHARTEXT) | A_ALTCHARSET; default: i++; diff --git a/lib/libncurses/lib_bkgd.c b/lib/libncurses/lib_bkgd.c index 0210995b7eb0..a74c56e73bbb 100644 --- a/lib/libncurses/lib_bkgd.c +++ b/lib/libncurses/lib_bkgd.c @@ -26,7 +26,7 @@ int x, y; T(("wbkgd(%x, %x) called", win, ch)); for (y = 0; y < win->_maxy; y++) - for (x = 0; x < win->_maxx; x++) + for (x = 0; x < win->_maxx; x++) if (win->_line[y][x]&A_CHARTEXT == ' ') win->_line[y][x] |= ch; else diff --git a/lib/libncurses/lib_box.c b/lib/libncurses/lib_box.c index ca4e03270721..a0ffd127129e 100644 --- a/lib/libncurses/lib_box.c +++ b/lib/libncurses/lib_box.c @@ -47,8 +47,8 @@ int endx, endy; endy = win->_maxy; for (i = 0; i <= endx; i++) { - win->_line[0][i] = ts; - win->_line[endy][i] = bs; + win->_line[0][i] = ts; + win->_line[endy][i] = bs; } win->_firstchar[endy] = win->_firstchar[0] = 0; win->_lastchar[endy] = win->_lastchar[0] = endx; @@ -83,12 +83,12 @@ int end; line = win->_cury; start = win->_curx; end = start + n - 1; - if (end > win->_maxx) + if (end > win->_maxx) end = win->_maxx; - if (win->_firstchar[line] == _NOCHANGE || win->_firstchar[line] > start) + if (win->_firstchar[line] == _NOCHANGE || win->_firstchar[line] > start) win->_firstchar[line] = start; - if (win->_lastchar[line] == _NOCHANGE || win->_lastchar[line] < start) + if (win->_lastchar[line] == _NOCHANGE || win->_lastchar[line] < start) win->_lastchar[line] = end; if (ch == 0) @@ -111,7 +111,7 @@ int end; row = win->_cury; col = win->_curx; end = row + n - 1; - if (end > win->_maxy) + if (end > win->_maxy) end = win->_maxy; if (ch == 0) @@ -119,13 +119,13 @@ int end; while(end >= row) { win->_line[end][col] = ch | win->_attrs; - if (win->_firstchar[end] == _NOCHANGE || win->_firstchar[end] > col) + if (win->_firstchar[end] == _NOCHANGE || win->_firstchar[end] > col) win->_firstchar[end] = col; - if (win->_lastchar[end] == _NOCHANGE || win->_lastchar[end] < col) + if (win->_lastchar[end] == _NOCHANGE || win->_lastchar[end] < col) win->_lastchar[end] = col; end--; } return OK; } - + diff --git a/lib/libncurses/lib_color.c b/lib/libncurses/lib_color.c index 17aaedeb7311..3d40a693f11d 100644 --- a/lib/libncurses/lib_color.c +++ b/lib/libncurses/lib_color.c @@ -2,8 +2,8 @@ * details. If they are missing then this copy is in violation of * * the copyright conditions. */ -/* lib_color.c - * +/* lib_color.c + * * Handles color emulation of SYS V curses * */ @@ -63,15 +63,15 @@ int init_color(short color, short r, short g, short b) return ERR; if (hue_lightness_saturation == TRUE) if (r < 0 || r > 360 || g < 0 || g > 100 || b < 0 || b > 100) - return ERR; + return ERR; if (hue_lightness_saturation == FALSE) if (r < 0 || r > 1000 || g < 0 || g > 1000 || b < 0 || b > 1000) return ERR; - + putp(tparm(initialize_color, color, r, g, b)); return OK; } - + return ERR; } @@ -83,7 +83,7 @@ bool can_change_color() int has_colors() { return ((orig_pair != NULL) && (max_colors != -1) && (max_pairs != -1) - && + && (((set_foreground != NULL) && (set_background != NULL)) || ((set_a_foreground != NULL) && (set_a_background != NULL))) ); diff --git a/lib/libncurses/lib_doupdate.c b/lib/libncurses/lib_doupdate.c index fcab8e5b0d74..2dba9442e51e 100644 --- a/lib/libncurses/lib_doupdate.c +++ b/lib/libncurses/lib_doupdate.c @@ -10,7 +10,7 @@ * The routine doupdate() and its dependents * *-----------------------------------------------------------------*/ - + #include <stdlib.h> #include <sys/time.h> #ifdef SYS_SELECT @@ -77,22 +77,22 @@ static inline void PutChar(chtype ch) return; } PutAttrChar(ch); - SP->_curscol++; + SP->_curscol++; if (SP->_curscol >= columns) { - if (auto_right_margin) { - SP->_curscol = 0; - SP->_cursrow++; + if (auto_right_margin) { + SP->_curscol = 0; + SP->_cursrow++; } else { SP->_curscol--; } } -} +} static inline void GoTo(int row, int col) { - mvcur(SP->_cursrow, SP->_curscol, row, col); - SP->_cursrow = row; - SP->_curscol = col; + mvcur(SP->_cursrow, SP->_curscol, row, col); + SP->_cursrow = row; + SP->_curscol = col; } int _outch(int ch) @@ -108,7 +108,7 @@ int doupdate(void) { int i; sigaction_t act, oact; - + T(("doupdate() called")); act.sa_handler = SIG_IGN; @@ -121,7 +121,7 @@ sigaction_t act, oact; reset_prog_mode(); /* is this necessary? */ if (enter_alt_charset_mode) - init_acs(); + init_acs(); newscr->_clear = TRUE; SP->_endwin = FALSE; } @@ -168,7 +168,7 @@ sigaction_t act, oact; curscr->_cury = newscr->_cury; GoTo(curscr->_cury, curscr->_curx); - + /* perhaps we should turn attributes off here */ if (curscr->_attrs != A_NORMAL) @@ -201,7 +201,7 @@ static void ClrUpdate(WINDOW *scr) { int i = 0, j = 0; int lastNonBlank; - + T(("ClrUpdate(%x) called", scr)); if (back_color_erase && curscr->_attrs != A_NORMAL) { T(("back_color_erase, turning attributes off")); @@ -217,7 +217,7 @@ int lastNonBlank; T(("updating screen from scratch")); for (i = 0; i < lines; i++) { lastNonBlank = columns - 1; - + while (lastNonBlank >= 0 && scr->_line[i][lastNonBlank] == BLANK) lastNonBlank--; @@ -310,7 +310,7 @@ chtype *newLine = newscr->_line[lineno]; chtype *oldLine = curscr->_line[lineno]; int k; int attrchanged = 0; - + T(("NoIDcTransformLine(%d) called", lineno)); firstChar = 0; @@ -318,7 +318,7 @@ int attrchanged = 0; if(ceol_standout_glitch) { if((newLine[firstChar] & (chtype)A_ATTRIBUTES) != (oldLine[firstChar] & (chtype)A_ATTRIBUTES)) attrchanged = 1; - } + } firstChar++; } @@ -342,7 +342,7 @@ int attrchanged = 0; while (lastChar > firstChar && newLine[lastChar] == oldLine[lastChar]) lastChar--; GoTo(lineno, firstChar); - } + } /* check if we are at the lr corner */ if (lineno == lines-1) @@ -385,7 +385,7 @@ chtype *newLine = newscr->_line[lineno]; chtype *oldLine = curscr->_line[lineno]; int k, n; int attrchanged = 0; - + T(("IDcTransformLine(%d) called", lineno)); if(ceol_standout_glitch && clr_eol) { @@ -393,12 +393,12 @@ int attrchanged = 0; while(firstChar < columns) { if((newLine[firstChar] & (chtype)A_ATTRIBUTES) != (oldLine[firstChar] & (chtype)A_ATTRIBUTES)) attrchanged = 1; - firstChar++; + firstChar++; } } - + firstChar = 0; - + if (attrchanged) { GoTo(lineno, firstChar); if (back_color_erase && curscr->_attrs != A_NORMAL) { @@ -421,14 +421,14 @@ int attrchanged = 0; while (firstChar < columns && newLine[firstChar] == oldLine[firstChar]) firstChar++; - + if (firstChar >= columns) return; oLastChar = columns - 1; while (oLastChar > firstChar && oldLine[oLastChar] == BLANK) oLastChar--; - + nLastChar = columns - 1; while (nLastChar > firstChar && newLine[nLastChar] == BLANK) nLastChar--; @@ -473,11 +473,11 @@ int attrchanged = 0; nLastChar--; oLastChar--; } - + n = min(oLastChar, nLastChar); GoTo(lineno, firstChar); - + /* check if we are at the lr corner */ if (lineno == lines-1) if ((auto_right_margin) && !(eat_newline_glitch) && diff --git a/lib/libncurses/lib_endwin.c b/lib/libncurses/lib_endwin.c index 6d61ea4e8e9c..4e07e8fc24bd 100644 --- a/lib/libncurses/lib_endwin.c +++ b/lib/libncurses/lib_endwin.c @@ -38,7 +38,7 @@ endwin() if (SP->_coloron == TRUE) putp(orig_pair); - if (curscr && (curscr->_attrs != A_NORMAL)) + if (curscr && (curscr->_attrs != A_NORMAL)) vidattr(curscr->_attrs = A_NORMAL); if (SP->_cursor != 1) diff --git a/lib/libncurses/lib_erase.c b/lib/libncurses/lib_erase.c index 3e3703ca3463..f7b79c185f55 100644 --- a/lib/libncurses/lib_erase.c +++ b/lib/libncurses/lib_erase.c @@ -27,7 +27,7 @@ int minx; minx = _NOCHANGE; start = win->_line[y]; end = &start[win->_maxx]; - + maxx = start; for (sp = start; sp <= end; sp++) { maxx = sp; diff --git a/lib/libncurses/lib_getch.c b/lib/libncurses/lib_getch.c index 458cdecf4861..c30f7f21f1f2 100644 --- a/lib/libncurses/lib_getch.c +++ b/lib/libncurses/lib_getch.c @@ -62,7 +62,7 @@ int ungetch(int ch) t_inc() } else h_dec(); - + SP->_fifo[head] = ch; T(("ungetch ok")); fifo_dump(); @@ -75,7 +75,7 @@ int n; unsigned char ch; if (tail == -1) return ERR; -again: +again: n = read(fileno(SP->_ifp), &ch, 1); if (n == -1 && errno == EINTR) goto again; @@ -102,7 +102,7 @@ int wgetch(WINDOW *win) { bool setHere = FALSE; /* cbreak mode was set here */ -int ch; +int ch; T(("wgetch(%x) called", win)); @@ -195,9 +195,9 @@ int timeleft = 1000; peek = 0; while (ptr != NULL) { T(("ch = %d", ch)); - while ((ptr != NULL) && (ptr->ch != (unsigned char)ch)) + while ((ptr != NULL) && (ptr->ch != (unsigned char)ch)) ptr = ptr->sibling; - + if (ptr != NULL) if (ptr->value != 0) { /* sequence terminated */ T(("end of sequence")); @@ -219,6 +219,6 @@ int timeleft = 1000; ch = fifo_peek(); } } - } + } return(fifo_pull()); } diff --git a/lib/libncurses/lib_getstr.c b/lib/libncurses/lib_getstr.c index eb82bf213596..0eda9b914a66 100644 --- a/lib/libncurses/lib_getstr.c +++ b/lib/libncurses/lib_getstr.c @@ -20,7 +20,7 @@ inline void backspace(WINDOW *win) waddstr(win, "\b \b"); fputs("\b \b", SP->_ofp); fflush(SP->_ofp); - SP->_curscol--; + SP->_curscol--; } int wgetnstr(WINDOW *win, char *str, int maxlen) @@ -30,7 +30,7 @@ char erasec; char killc; char *oldstr; int ch; - + T(("wgetnstr(%x,%x, %d) called", win, str, maxlen)); oldnl = SP->_nl; diff --git a/lib/libncurses/lib_insdel.c b/lib/libncurses/lib_insdel.c index da26a2a31c54..aca7cc39dfd2 100644 --- a/lib/libncurses/lib_insdel.c +++ b/lib/libncurses/lib_insdel.c @@ -8,7 +8,7 @@ ** ** The routine winsdel(win, n). ** positive n insert n lines above current line -** negative n delete n lines starting from current line +** negative n delete n lines starting from current line ** */ diff --git a/lib/libncurses/lib_kernel.c b/lib/libncurses/lib_kernel.c index 5fa18797d5e5..e373935c5da8 100644 --- a/lib/libncurses/lib_kernel.c +++ b/lib/libncurses/lib_kernel.c @@ -66,7 +66,7 @@ int reset_prog_mode() stty(cur_term->Filedes, &cur_term->Nttyb); #endif - return OK; + return OK; } @@ -80,7 +80,7 @@ int reset_shell_mode() stty(cur_term->Filedes, &cur_term->Ottyb); #endif - return OK; + return OK; } #endif @@ -132,7 +132,7 @@ int speed; return OK; } - + /* * erasechar() * @@ -191,7 +191,7 @@ int flushinp() tcflush(cur_term->Filedes, TCIFLUSH); #else ioctl(cur_term->Filedes, TIOCFLUSH, 0); -#endif +#endif if (SP) { SP->_fifohead = -1; SP->_fifotail = 0; diff --git a/lib/libncurses/lib_mvcur.c b/lib/libncurses/lib_mvcur.c index a0f3bd5e1363..388c680b42e2 100644 --- a/lib/libncurses/lib_mvcur.c +++ b/lib/libncurses/lib_mvcur.c @@ -13,7 +13,7 @@ * -hm hpux lint'ing .. * *---------------------------------------------------------------------------*/ - + /* This work is copyrighted. See COPYRIGHT.OLD & COPYRIGHT.NEW for * * details. If they are missing then this copy is in violation of * * the copyright conditions. */ @@ -47,7 +47,7 @@ int mvcur(int oldrow, int oldcol, int newrow, int newcol) if (cursor_address) putp(tparm(cursor_address, newrow, newcol)); return OK; - + } #else @@ -132,7 +132,7 @@ static int op_info[NUM_OPS] = { /* ** Make_seq_best(best, try) -** +** ** Make_seq_best() copies try to best if try->cost < best->cost ** ** fixed the old version, now it really runs .. (-hm/08.04.93) @@ -180,7 +180,7 @@ bool nlstat = SP->_nl; /* nl-output-mapping in effect ?*/ if ((oldrow == newrow) && (oldcol == newcol)) return OK; - + if (oldcol == columns-1 && eat_newline_glitch && auto_right_margin) { putp(tparm(cursor_address, newrow, newcol)); return OK; @@ -199,7 +199,7 @@ bool nlstat = SP->_nl; /* nl-output-mapping in effect ?*/ oldrow %= lines; /* mod values into range */ oldcol %= columns; } - + newrow %= lines; newcol %= columns; @@ -393,10 +393,10 @@ int oc, int nc) /* old column, new column */ struct Sequence seqA, seqB, tabseq, *best, *try; int mytab, tabs, onepast, - one_step, opp_step; + one_step, opp_step; onepast = -1; - + if (oc == nc) return; @@ -456,7 +456,7 @@ int mytab, tabs, onepast, zero_seq(try); add_op(try, one_step, abs(nc - oc)); Make_seq_best(best, try); - + if (tabseq.cost < INFINITY) add_seq(outseq, &tabseq); add_seq(outseq, best); @@ -541,7 +541,7 @@ update_ops() T(("update_ops()")); if (SP) { /* SP structure exists */ - int op; + int op; if (! SP->_costinit) { /* this term not yet assigned costs */ loc_init = FALSE; /* if !SP in the future, new term */ @@ -551,7 +551,7 @@ update_ops() for (op = 0; op < NUM_NPARM; op++) op_info[op] = SP->_costs[op]; /* set up op_info */ - + /* check for newline that might be mapped... */ if (SP->_nlmapping && index(sequence(CURS_DOWN), '\n')) @@ -606,7 +606,7 @@ static int countc(char ch) ** add_op(seq, op, p0, p1, ... , p8) ** ** add_op() adds the operator op and the appropriate -** number of paramaters to seq. It also increases the +** number of paramaters to seq. It also increases the ** cost appropriately. ** if op has no parameters, p0 is taken to be a count. */ @@ -615,11 +615,11 @@ static void add_op(struct Sequence *seq, int op, ...) { va_list argp; int num_ps, p; - + T(("adding op %d to sequence", op)); va_start(argp, op); - + num_ps = - op_info[op]; /* get parms or -cost */ *(seq->end++) = op; @@ -632,12 +632,12 @@ int num_ps, p; *(seq->end++) = i; } else { int prm[9]; - + for (p = 0; p < num_ps; p++) *(seq->end++) = prm[p] = va_arg(argp, int); c_count = 0; - + tputs(tparm(sequence(op), prm[0], prm[1], prm[2], prm[3], prm[4], prm[5], prm[6], prm[7], prm[8]), 1, countc); diff --git a/lib/libncurses/lib_newterm.c b/lib/libncurses/lib_newterm.c index c1f8694f9f95..79e5b4e426f8 100644 --- a/lib/libncurses/lib_newterm.c +++ b/lib/libncurses/lib_newterm.c @@ -94,7 +94,7 @@ char *use_it = _ncurses_copyright; if (enter_ca_mode) putp(enter_ca_mode); - init_acs(); + init_acs(); T(("creating newscr")); if ((newscr = newwin(lines, columns, 0, 0)) == (WINDOW *)NULL) @@ -140,7 +140,7 @@ char *use_it = _ncurses_copyright; def_shell_mode(); def_prog_mode(); - + T(("newterm returns %x", SP)); return(SP); diff --git a/lib/libncurses/lib_newwin.c b/lib/libncurses/lib_newwin.c index a4db5f18f50a..793d06e8e831 100644 --- a/lib/libncurses/lib_newwin.c +++ b/lib/libncurses/lib_newwin.c @@ -66,7 +66,7 @@ int i; /* ** make sure window fits inside the original one */ - if ( begy < 0 || begx < 0) + if ( begy < 0 || begx < 0) return NULL; if ( begy + num_lines > orig->_maxy + 1 || begx + num_columns > orig->_maxx + 1) @@ -103,7 +103,7 @@ WINDOW *subwin(WINDOW *w, int l, int c, int y, int x) T(("subwin(%x, %d, %d, %d, %d) called", w, l, c, y, x)); T(("parent has begy = %d, begx = %d", w->_begy, w->_begx)); - return derwin(w, l, c, y - w->_begy, x - w->_begx); + return derwin(w, l, c, y - w->_begy, x - w->_begx); } WINDOW * @@ -115,24 +115,24 @@ WINDOW *win; T(("makenew(%d,%d,%d,%d)", num_lines, num_columns, begy, begx)); if ((win = (WINDOW *) malloc(sizeof(WINDOW))) == NULL) - return NULL; + return NULL; if ((win->_line = (chtype **) calloc(num_lines, sizeof (chtype *))) == NULL) { free(win); - return NULL; + return NULL; } if ((win->_firstchar = calloc(num_lines, sizeof(short))) == NULL) { free(win); free(win->_line); - return NULL; + return NULL; } if ((win->_lastchar = calloc(num_lines, sizeof(short))) == NULL) { free(win); free(win->_line); free(win->_firstchar); - return NULL; + return NULL; } win->_curx = 0; @@ -158,7 +158,7 @@ WINDOW *win; #else win->_use_meta = FALSE; #endif - win->_delay = -1; + win->_delay = -1; win->_immed = FALSE; win->_sync = 0; win->_parx = 0; diff --git a/lib/libncurses/lib_options.c b/lib/libncurses/lib_options.c index e22bcb799516..7aefe960d6c6 100644 --- a/lib/libncurses/lib_options.c +++ b/lib/libncurses/lib_options.c @@ -26,7 +26,7 @@ int idlok(WINDOW *win, int flag) if ((insert_line || parm_insert_line) && (delete_line || parm_delete_line)) { win->_idlok = TRUE; } - return OK; + return OK; } @@ -38,7 +38,7 @@ int clearok(WINDOW *win, int flag) newscr->_clear = flag; else win->_clear = flag; - return OK; + return OK; } @@ -51,7 +51,7 @@ int leaveok(WINDOW *win, int flag) curs_set(0); else curs_set(1); - return OK; + return OK; } @@ -60,7 +60,7 @@ int scrollok(WINDOW *win, int flag) T(("scrollok(%x,%d) called", win, flag)); win->_scroll = flag; - return OK; + return OK; } int halfdelay(int t) @@ -114,10 +114,10 @@ int keypad(WINDOW *win, int flag) putp(keypad_xmit); else if (! flag && keypad_local) putp(keypad_local); - + if (SP->_keytry == UNINITIALISED) init_keytry(); - return OK; + return OK; } @@ -132,7 +132,7 @@ int meta(WINDOW *win, int flag) putp(meta_on); else if (! flag && meta_off) putp(meta_off); - return OK; + return OK; } /* @@ -148,7 +148,7 @@ static struct try *newtry; static void init_keytry() { newtry = NULL; - + #include "keys.tries" SP->_keytry = newtry; @@ -162,15 +162,15 @@ struct try *ptr, *savedptr; if (! str || out_of_memory) return; - + if (newtry != NULL) { ptr = savedptr = newtry; - + for (;;) { while (ptr->ch != (unsigned char) *str && ptr->sibling != NULL) ptr = ptr->sibling; - + if (ptr->ch == (unsigned char) *str) { if (*(++str)) { if (ptr->child != NULL) @@ -186,53 +186,53 @@ struct try *ptr, *savedptr; out_of_memory = TRUE; return; } - + savedptr = ptr = ptr->sibling; ptr->child = ptr->sibling = NULL; ptr->ch = *str++; ptr->value = (short) NULL; - + break; } - } /* end for (;;) */ + } /* end for (;;) */ } else { /* newtry == NULL :: First sequence to be added */ savedptr = ptr = newtry = (struct try *) malloc(sizeof *ptr); - + if (ptr == NULL) { out_of_memory = TRUE; return; } - + ptr->child = ptr->sibling = NULL; ptr->ch = *(str++); ptr->value = (short) NULL; } - + /* at this point, we are adding to the try. ptr->child == NULL */ - + while (*str) { ptr->child = (struct try *) malloc(sizeof *ptr); - + ptr = ptr->child; - + if (ptr == NULL) { out_of_memory = TRUE; - + ptr = savedptr; while (ptr != NULL) { savedptr = ptr->child; free(ptr); ptr = savedptr; } - + return; } - + ptr->child = ptr->sibling = NULL; ptr->ch = *(str++); ptr->value = (short) NULL; } - + ptr->value = code; return; } diff --git a/lib/libncurses/lib_overlay.c b/lib/libncurses/lib_overlay.c index 62bb2f162c90..19e58f31f96d 100644 --- a/lib/libncurses/lib_overlay.c +++ b/lib/libncurses/lib_overlay.c @@ -13,11 +13,11 @@ #include "curses.priv.h" static void overlap(WINDOW *s, WINDOW *d, int flag) -{ +{ int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol; T(("overlap : sby %d, sbx %d, smy %d, smx %d, dby %d, dbx %d, dmy %d, dmx %d", - s->_begy, s->_begx, s->_maxy, s->_maxx, + s->_begy, s->_begx, s->_maxy, s->_maxx, d->_begy, d->_begx, d->_maxy, d->_maxx)); sminrow = max(s->_begy, d->_begy) - s->_begy; smincol = max(s->_begx, d->_begx) - s->_begx; @@ -61,16 +61,16 @@ int overwrite(WINDOW *win1, WINDOW *win2) return OK; } -int copywin(WINDOW *src, WINDOW *dst, +int copywin(WINDOW *src, WINDOW *dst, int sminrow, int smincol, - int dminrow, int dmincol, int dmaxrow, int dmaxcol, + int dminrow, int dmincol, int dmaxrow, int dmaxcol, int over) { int sx, sy, dx, dy; T(("copywin(%x, %x, %d, %d, %d, %d, %d, %d, %d)", src, dst, sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, over)); - + /* make sure rectangle exists in source */ if ((sminrow + dmaxrow - dminrow) > (src->_maxy + 1) || (smincol + dmaxcol - dmincol) > (src->_maxx + 1)) { @@ -91,13 +91,13 @@ int sx, sy, dx, dy; dst->_lastchar[dy] = dmincol; for (dx = dmincol, sx = smincol; dx <= dmaxcol; sx++, dx++) { if (over == TRUE ) { - if (((src->_line[sy][sx] & A_CHARTEXT) != ' ') && (dst->_line[dy][dx] != src->_line[sy][sx])) { + if (((src->_line[sy][sx] & A_CHARTEXT) != ' ') && (dst->_line[dy][dx] != src->_line[sy][sx])) { dst->_line[dy][dx] = src->_line[sy][sx]; dst->_lastchar[dy] = dx; } else dst->_firstchar[dy]++; } else { - if (dst->_line[dy][dx] != src->_line[sy][sx]) { + if (dst->_line[dy][dx] != src->_line[sy][sx]) { dst->_line[dy][dx] = src->_line[sy][sx]; dst->_lastchar[dy] = dx; } else diff --git a/lib/libncurses/lib_pad.c b/lib/libncurses/lib_pad.c index 11a005480802..5b4aa9926fce 100644 --- a/lib/libncurses/lib_pad.c +++ b/lib/libncurses/lib_pad.c @@ -57,7 +57,7 @@ int prefresh(WINDOW *win, int pminrow, int pmincol, if (pnoutrefresh(win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol) != ERR) return (doupdate()); else - return ERR; + return ERR; } @@ -67,7 +67,7 @@ int pnoutrefresh(WINDOW *win, int pminrow, int pmincol, int i, j; int m, n; - T(("pnoutrefresh(%x, %d, %d, %d, %d, %d, %d) called", + T(("pnoutrefresh(%x, %d, %d, %d, %d, %d, %d) called", win, pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)); if (!(win->_flags & _ISPAD)) diff --git a/lib/libncurses/lib_raw.c b/lib/libncurses/lib_raw.c index 5635caeedf76..336f6893e9b0 100644 --- a/lib/libncurses/lib_raw.c +++ b/lib/libncurses/lib_raw.c @@ -53,7 +53,7 @@ int cbreak() SP->_cbreak = 1; #ifdef TERMIOS - cur_term->Nttyb.c_lflag &= ~ICANON; + cur_term->Nttyb.c_lflag &= ~ICANON; cur_term->Nttyb.c_lflag |= ISIG; cur_term->Nttyb.c_cc[VMIN] = 1; cur_term->Nttyb.c_cc[VTIME] = 0; @@ -73,7 +73,7 @@ int echo() T(("echo() called")); SP->_echo = TRUE; - + #ifdef TERMIOS cur_term->Nttyb.c_lflag |= ECHO; if((tcsetattr(cur_term->Filedes, TCSANOW, &cur_term->Nttyb)) == -1) @@ -140,14 +140,14 @@ int nocbreak() T(("nocbreak() called")); SP->_cbreak = 0; - + #ifdef TERMIOS cur_term->Nttyb.c_lflag |= ICANON; if((tcsetattr(cur_term->Filedes, TCSANOW, &cur_term->Nttyb)) == -1) return ERR; else return OK; -#else +#else cur_term->Nttyb.sg_flags &= ~CBREAK; stty(cur_term->Filedes, &cur_term->Nttyb); return OK; @@ -159,7 +159,7 @@ int noecho() T(("noecho() called")); SP->_echo = FALSE; - + #ifdef TERMIOS cur_term->Nttyb.c_lflag &= ~(ECHO); if((tcsetattr(cur_term->Filedes, TCSANOW, &cur_term->Nttyb)) == -1) @@ -179,7 +179,7 @@ int nonl() T(("nonl() called")); SP->_nl = SP->_nlmapping = FALSE; - + #ifdef TERMIOS cur_term->Nttyb.c_iflag &= ~ICRNL; cur_term->Nttyb.c_oflag &= ~ONLCR; diff --git a/lib/libncurses/lib_scanw.c b/lib/libncurses/lib_scanw.c index d9a6a3c9a6c6..69b5a33f5b71 100644 --- a/lib/libncurses/lib_scanw.c +++ b/lib/libncurses/lib_scanw.c @@ -19,7 +19,7 @@ char buf[BUFSIZ]; if (wgetstr(win, buf) == ERR) return(ERR); - + return(vsscanf(buf, fmt, argp)); } diff --git a/lib/libncurses/lib_screen.c b/lib/libncurses/lib_screen.c index 0c0ab8ac5d7f..382411bc657b 100644 --- a/lib/libncurses/lib_screen.c +++ b/lib/libncurses/lib_screen.c @@ -10,7 +10,7 @@ int putwin(WINDOW *win, char *file) int fd, i; fd = open(file, O_WRONLY); - if (fd < -1) + if (fd < -1) return ERR; for (i = 0; i < lines; i++) write(fd, win->_line[i], sizeof(chtype)*columns); diff --git a/lib/libncurses/lib_scroll.c b/lib/libncurses/lib_scroll.c index 77bb8866ead1..1721a3fc1d13 100644 --- a/lib/libncurses/lib_scroll.c +++ b/lib/libncurses/lib_scroll.c @@ -27,12 +27,12 @@ chtype blank = ' '; if (n < 0) { /* save overwritten lines */ - + for (i = 0; i < -n; i++) saved[i] = win->_line[regbottom-i]; /* shift n lines */ - + for (line = regbottom; line >= regtop-n; line--) win->_line[line] = win->_line[line+n]; @@ -46,12 +46,12 @@ chtype blank = ' '; } } else { /* save overwritten lines */ - + for (i = 0; i < n; i++) saved[i] = win->_line[regtop+i]; /* shift n lines */ - + for (line = regtop; line <= regbottom-n; line++) win->_line[line] = win->_line[line+n]; @@ -64,7 +64,7 @@ chtype blank = ' '; *ptr = blank; } } - + free(saved); } @@ -194,7 +194,7 @@ int i; } mvcur(-1, -1, win->_begy+win->_cury, win->_begx+win->_curx); - } else + } else touchline(win, win->_regtop, win->_regbottom - win->_regtop + 1); return OK; diff --git a/lib/libncurses/lib_slk.c b/lib/libncurses/lib_slk.c index 850556f171dd..5d59c69155ec 100644 --- a/lib/libncurses/lib_slk.c +++ b/lib/libncurses/lib_slk.c @@ -68,7 +68,7 @@ slk_noutrefresh(void) SLK *slk = SP->_slk; T(("slk_noutrefresh()")); - + if (slk == NULL) return ERR; if (slk->hidden) @@ -87,7 +87,7 @@ slk_refresh(void) SLK *slk = SP->_slk; T(("slk_refresh()")); - + if (slk == NULL) return ERR; if (slk->hidden) @@ -106,7 +106,7 @@ slk_restore(void) SLK *slk = SP->_slk; T(("slk_restore()")); - + if (slk == NULL) return ERR; slk->hidden = FALSE; @@ -159,7 +159,7 @@ slk_touch(void) { SLK *slk = SP->_slk; T(("slk_touch()")); - + if (slk == NULL) return ERR; slk->dirty = TRUE; @@ -176,7 +176,7 @@ slk_clear(void) SLK *slk = SP->_slk; T(("slk_clear()")); - + if (slk == NULL) return ERR; slk->hidden = TRUE; diff --git a/lib/libncurses/lib_trace.c b/lib/libncurses/lib_trace.c index 64743225ca7f..3a6646725577 100644 --- a/lib/libncurses/lib_trace.c +++ b/lib/libncurses/lib_trace.c @@ -19,7 +19,7 @@ extern int errno; #endif -int _tracing = 0; +int _tracing = 0; static int tracefd; @@ -56,15 +56,15 @@ struct {unsigned int val; char *name;} names[] = { {A_STANDOUT, "A_STANDOUT, ",}, - {A_UNDERLINE, "A_UNDERLINE, ",}, + {A_UNDERLINE, "A_UNDERLINE, ",}, {A_REVERSE, "A_REVERSE, ",}, {A_BLINK, "A_BLINK, ",}, {A_DIM, "A_DIM, ",}, - {A_BOLD, "A_BOLD, ",}, - {A_ALTCHARSET, "A_ALTCHARSET, ",}, + {A_BOLD, "A_BOLD, ",}, + {A_ALTCHARSET, "A_ALTCHARSET, ",}, {A_INVIS, "A_INVIS, ",}, {A_PROTECT, "A_PROTECT, ",}, - {A_CHARTEXT, "A_CHARTEXT, ",}, + {A_CHARTEXT, "A_CHARTEXT, ",}, {A_NORMAL, "A_NORMAL, ",}, }, colors[] = @@ -150,7 +150,7 @@ char *visbuf(const char *buf) char *_tracechar(const unsigned char ch) { static char crep[20]; - /* + /* * We can show the actual character if it's either an ordinary printable * or one of the high-half characters. */ diff --git a/lib/libncurses/lib_vidattr.c b/lib/libncurses/lib_vidattr.c index b2fee871b7c4..eb796f4f4ec2 100644 --- a/lib/libncurses/lib_vidattr.c +++ b/lib/libncurses/lib_vidattr.c @@ -84,9 +84,9 @@ chtype turn_on = (newmode & ~previous_attr) & ~A_COLOR; tputs(exit_alt_charset_mode, 1, outc); previous_attr &= ~A_ALTCHARSET; } - if (previous_attr) + if (previous_attr) tputs(exit_attribute_mode, 1, outc); - + } else if (set_attributes) { if (turn_on || turn_off) { tputs(tparm(set_attributes, @@ -103,7 +103,7 @@ chtype turn_on = (newmode & ~previous_attr) & ~A_COLOR; } else { T(("turning %x off", _traceattr(turn_off))); - + if ((turn_off & A_ALTCHARSET) && exit_alt_charset_mode) { tputs(exit_alt_charset_mode, 1, outc); turn_off &= ~A_ALTCHARSET; @@ -126,7 +126,7 @@ chtype turn_on = (newmode & ~previous_attr) & ~A_COLOR; T(("turning %x on", _traceattr(turn_on))); - if ((turn_on & A_ALTCHARSET) && enter_alt_charset_mode) + if ((turn_on & A_ALTCHARSET) && enter_alt_charset_mode) tputs(enter_alt_charset_mode, 1, outc); if ((turn_on & A_BLINK) && enter_blink_mode) diff --git a/lib/libncurses/lib_window.c b/lib/libncurses/lib_window.c index c2686b982572..699863c76ae2 100644 --- a/lib/libncurses/lib_window.c +++ b/lib/libncurses/lib_window.c @@ -50,15 +50,15 @@ int linesize, i; nwin->_curx = win->_curx; nwin->_cury = win->_cury; nwin->_maxy = win->_maxy; - nwin->_maxx = win->_maxx; + nwin->_maxx = win->_maxx; nwin->_begy = win->_begy; nwin->_begx = win->_begx; nwin->_flags = win->_flags; nwin->_attrs = win->_attrs; - nwin->_bkgd = win->_bkgd; + nwin->_bkgd = win->_bkgd; - nwin->_clear = win->_clear; + nwin->_clear = win->_clear; nwin->_scroll = win->_scroll; nwin->_leave = win->_leave; nwin->_use_keypad = win->_use_keypad; @@ -68,7 +68,7 @@ int linesize, i; nwin->_sync = win->_sync; nwin->_parx = win->_parx; nwin->_pary = win->_pary; - nwin->_parent = win->_parent; + nwin->_parent = win->_parent; nwin->_regtop = win->_regtop; nwin->_regbottom = win->_regbottom; diff --git a/lib/libpcap/bpf_filter.c b/lib/libpcap/bpf_filter.c index 5baa552f4341..e755b59eb727 100644 --- a/lib/libpcap/bpf_filter.c +++ b/lib/libpcap/bpf_filter.c @@ -4,7 +4,7 @@ * * This code is derived from the Stanford/CMU enet packet filter, * (net/enet.c) distributed as part of 4.3BSD, and code contributed - * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence + * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence * Berkeley Laboratory. * * Redistribution and use in source and binary forms, with or without @@ -38,11 +38,11 @@ * @(#)bpf.c 7.5 (Berkeley) 7/15/91 * * static char rcsid[] = - * "$Header: bpf_filter.c,v 1.22 94/06/05 20:12:39 leres Exp $"; + * "$Header: /home/ncvs/src/lib/libpcap/bpf_filter.c,v 1.1.1.1 1995/01/20 04:13:02 jkh Exp $"; */ #if !(defined(lint) || defined(KERNEL)) static char rcsid[] = - "@(#) $Header: bpf_filter.c,v 1.22 94/06/05 20:12:39 leres Exp $ (LBL)"; + "@(#) $Header: /home/ncvs/src/lib/libpcap/bpf_filter.c,v 1.1.1.1 1995/01/20 04:13:02 jkh Exp $ (LBL)"; #endif #include <sys/param.h> @@ -129,7 +129,7 @@ m_xword(m, k, err) return (cp[k] << 24) | (np[0] << 16) | (np[1] << 8) | np[2]; case 2: - return (cp[k] << 24) | (cp[k + 1] << 16) | (np[0] << 8) | + return (cp[k] << 24) | (cp[k + 1] << 16) | (np[0] << 8) | np[1]; default: @@ -209,7 +209,7 @@ bpf_filter(pc, p, wirelen, buflen) return 0; #else abort(); -#endif +#endif case BPF_RET|BPF_K: return (u_int)pc->k; @@ -366,7 +366,7 @@ bpf_filter(pc, p, wirelen, buflen) case BPF_LD|BPF_MEM: A = mem[pc->k]; continue; - + case BPF_LDX|BPF_MEM: X = mem[pc->k]; continue; @@ -418,25 +418,25 @@ bpf_filter(pc, p, wirelen, buflen) case BPF_ALU|BPF_ADD|BPF_X: A += X; continue; - + case BPF_ALU|BPF_SUB|BPF_X: A -= X; continue; - + case BPF_ALU|BPF_MUL|BPF_X: A *= X; continue; - + case BPF_ALU|BPF_DIV|BPF_X: if (X == 0) return 0; A /= X; continue; - + case BPF_ALU|BPF_AND|BPF_X: A &= X; continue; - + case BPF_ALU|BPF_OR|BPF_X: A |= X; continue; @@ -452,23 +452,23 @@ bpf_filter(pc, p, wirelen, buflen) case BPF_ALU|BPF_ADD|BPF_K: A += pc->k; continue; - + case BPF_ALU|BPF_SUB|BPF_K: A -= pc->k; continue; - + case BPF_ALU|BPF_MUL|BPF_K: A *= pc->k; continue; - + case BPF_ALU|BPF_DIV|BPF_K: A /= pc->k; continue; - + case BPF_ALU|BPF_AND|BPF_K: A &= pc->k; continue; - + case BPF_ALU|BPF_OR|BPF_K: A |= pc->k; continue; @@ -500,9 +500,9 @@ bpf_filter(pc, p, wirelen, buflen) /* * Return true if the 'fcode' is a valid filter program. * The constraints are that each jump be forward and to a valid - * code. The code must terminate with either an accept or reject. + * code. The code must terminate with either an accept or reject. * 'valid' is an array for use by the routine (it must be at least - * 'len' bytes long). + * 'len' bytes long). * * The kernel needs to be able to verify an application's filter code. * Otherwise, a bogus program could easily crash the system. @@ -517,7 +517,7 @@ bpf_validate(f, len) for (i = 0; i < len; ++i) { /* - * Check that that jumps are forward, and within + * Check that that jumps are forward, and within * the code block. */ p = &f[i]; @@ -535,7 +535,7 @@ bpf_validate(f, len) * Check that memory operations use valid addresses. */ if ((BPF_CLASS(p->code) == BPF_ST || - (BPF_CLASS(p->code) == BPF_LD && + (BPF_CLASS(p->code) == BPF_LD && (p->code & 0xe0) == BPF_MEM)) && (p->k >= BPF_MEMWORDS || p->k < 0)) return 0; diff --git a/lib/libpcap/gencode.h b/lib/libpcap/gencode.h index b202acf404c8..34d4c19ef583 100644 --- a/lib/libpcap/gencode.h +++ b/lib/libpcap/gencode.h @@ -18,7 +18,7 @@ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * @(#) $Header: gencode.h,v 1.20 94/06/12 14:29:30 leres Exp $ (LBL) + * @(#) $Header: /home/ncvs/src/lib/libpcap/gencode.h,v 1.1.1.1 1995/01/20 04:13:06 jkh Exp $ (LBL) */ /* @@ -68,7 +68,7 @@ struct slist { struct slist *next; }; -/* +/* * A bit vector to represent definition sets. We assume TOT_REGISTERS * is smaller than 8*sizeof(atomset). */ diff --git a/lib/libpcap/nametoaddr.c b/lib/libpcap/nametoaddr.c index 0d8bbf7d571b..9732f97997b7 100644 --- a/lib/libpcap/nametoaddr.c +++ b/lib/libpcap/nametoaddr.c @@ -24,7 +24,7 @@ #ifndef lint static char rcsid[] = - "@(#) $Header: nametoaddr.c,v 1.21 94/06/20 19:07:54 leres Exp $ (LBL)"; + "@(#) $Header: /home/ncvs/src/lib/libpcap/nametoaddr.c,v 1.1.1.1 1995/01/20 04:13:03 jkh Exp $ (LBL)"; #endif #include <sys/param.h> @@ -302,7 +302,7 @@ pcap_ether_hostton(const char *name) return (NULL); else rewind(fp); - + while ((ep = pcap_next_etherent(fp)) != NULL) { if (strcmp(ep->name, name) == 0) { ap = (u_char *)malloc(6); diff --git a/lib/libpcap/pcap-enet.c b/lib/libpcap/pcap-enet.c index 3f4189b494a8..cb052eb345ed 100644 --- a/lib/libpcap/pcap-enet.c +++ b/lib/libpcap/pcap-enet.c @@ -125,7 +125,7 @@ wrapup(int fd) perror("tcpdump: enet ioctl EIOSTATS error"); exit(-1); } - + fprintf(stderr, "%d packets queued", es.enStat_Rcnt); if (es.enStat_Rdrops > 0) fprintf(stderr, ", %d dropped", es.enStat_Rdrops); @@ -133,7 +133,7 @@ wrapup(int fd) fprintf(stderr, ", %d tcpdump %s", es.enStat_Reads, es.enStat_Reads > 1 ? "reads" : "read"); if (es.enStat_MaxRead > 1) - fprintf(stderr, ", %d packets in largest read", + fprintf(stderr, ", %d packets in largest read", es.enStat_MaxRead); putc('\n', stderr); #endif /* IBMRTPC */ diff --git a/lib/libpcap/pcap-int.h b/lib/libpcap/pcap-int.h index 1f5da22ae876..db3677afa180 100644 --- a/lib/libpcap/pcap-int.h +++ b/lib/libpcap/pcap-int.h @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#) $Header: pcap-int.h,v 1.7 94/06/14 20:03:33 leres Exp $ (LBL) + * @(#) $Header: /home/ncvs/src/lib/libpcap/pcap-int.h,v 1.1.1.1 1995/01/20 04:13:06 jkh Exp $ (LBL) */ #ifndef pcap_int_h @@ -83,7 +83,7 @@ struct pcap { */ u_char *pkt; - + /* * Placeholder for filter code if bpf not in kernel. */ diff --git a/lib/libpcap/pcap.c b/lib/libpcap/pcap.c index e0433e93bfea..44d65aeebd00 100644 --- a/lib/libpcap/pcap.c +++ b/lib/libpcap/pcap.c @@ -33,7 +33,7 @@ #ifndef lint static char rcsid[] = - "@(#) $Header: /home/ncvs/src/lib/libpcap/pcap.c,v 1.1.1.1 1995/01/20 04:13:03 jkh Exp $ (LBL)"; + "@(#) $Header: /home/ncvs/src/lib/libpcap/pcap.c,v 1.2 1995/02/23 06:55:14 phk Exp $ (LBL)"; #endif #include <sys/types.h> @@ -167,6 +167,6 @@ pcap_close(pcap_t *p) free(p->sf.base); } else if (p->buffer != NULL) free(p->buffer); - + free(p); } diff --git a/lib/libscsi/scsi.c b/lib/libscsi/scsi.c index 1538f7bf1088..29051718fa9f 100644 --- a/lib/libscsi/scsi.c +++ b/lib/libscsi/scsi.c @@ -3,7 +3,7 @@ /* Copyright (c) 1994 HD Associates * (contact: dufault@hda.com) * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -18,7 +18,7 @@ * 4. Neither the name of the HD Associaates nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -30,7 +30,7 @@ * 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. - * $Id: scsi.c,v 1.4 1995/04/28 19:23:49 dufault Exp $ + * $Id: scsi.c,v 1.5 1995/05/05 20:40:02 dufault Exp $ */ #include <stdlib.h> #include <stdio.h> @@ -108,7 +108,7 @@ scsireq_t *scsireq_new(void) * field_specifier : type_specifier field_width * | '{' NAME '}' type_specifier field_width * ; - * + * * field_width : DECIMAL_NUMBER * ; * @@ -390,15 +390,15 @@ void (*arg_put)(void *, int, void *, int, char *), void *puthook) * field : value * | value ':' field_width * ; - * + * * field_width : digit * | 'i' digit // i2 = 2 byte integer, i3 = 3 byte integer etc. * ; - * + * * value : HEX_NUMBER * | 'v' // For indirection. * ; - * + * * Notes: * Bit fields are specified MSB first to match the SCSI spec. * @@ -646,7 +646,7 @@ char *fmt, va_list ap) else value = arg_get ? (*arg_get)(gethook, field_name) : va_arg(ap, int); } - + #if 0 printf( "do_encode: ret %d fmt %c width %d value %d name \"%s\" error %d suppress %d\n", @@ -1136,7 +1136,7 @@ int scsi_debug(FILE *f, int ret, scsireq_t *scsireq) d = "Data out"; else d = "No data transfer?"; - + if (scsireq->cmdlen == 0) fprintf(f, "Zero length command????\n"); diff --git a/lib/libscsi/scsi.h b/lib/libscsi/scsi.h index d045fc6b4b03..0050d977b07a 100644 --- a/lib/libscsi/scsi.h +++ b/lib/libscsi/scsi.h @@ -1,6 +1,6 @@ /* Copyright (c) 1994 HD Associates (hd@world.std.com) * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -15,7 +15,7 @@ * 4. Neither the name of the HD Associaates nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE diff --git a/lib/libskey/put.c b/lib/libskey/put.c index 6619f73bb1cd..cc7429ac269f 100644 --- a/lib/libskey/put.c +++ b/lib/libskey/put.c @@ -2095,8 +2095,8 @@ char *c, *engout; return(engout); } -/* convert English to binary - * returns 1 OK - all good words and parity is OK +/* convert English to binary + * returns 1 OK - all good words and parity is OK * 0 word not in data base * -1 badly formed in put ie > 4 char word * -2 words OK but parity is wrong diff --git a/lib/libskey/skeyaccess.c b/lib/libskey/skeyaccess.c index 170da6cff702..098d6180971d 100644 --- a/lib/libskey/skeyaccess.c +++ b/lib/libskey/skeyaccess.c @@ -1,26 +1,26 @@ /* * Figure out if UNIX passwords are permitted for any combination of user * name, group member, terminal port, host_name or network: - * + * * Programmatic interface: skeyaccess(user, port, host, addr) - * + * * All arguments are null-terminated strings. Specify a null character pointer * where information is not available. - * + * * When no address information is given this code performs the host (internet) * address lookup itself. It rejects addresses that appear to belong to * someone else. - * + * * When compiled with -DPERMIT_CONSOLE always permits UNIX passwords with * console logins, no matter what the configuration file says. - * + * * To build a stand-alone test version, compile with -DTEST and run it off an * skey.access file in the current directory: - * + * * Command-line interface: ./skeyaccess user port [host_or_ip_addr] - * + * * Errors are reported via syslogd. - * + * * Author: Wietse Venema, Eindhoven University of Technology. */ @@ -102,7 +102,7 @@ char *addr; /* * Bundle up the arguments in a structure so we won't have to drag around * boring long argument lists. - * + * * Look up the host address when only the name is given. We try to reject * addresses that belong to someone else. */ diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c index 217c67482d11..93a5d1d454e9 100644 --- a/lib/libskey/skeylogin.c +++ b/lib/libskey/skeylogin.c @@ -10,7 +10,7 @@ #include <sys/time.h> #include <sys/resource.h> - + #include <stdio.h> #include <string.h> #include <sys/types.h> @@ -84,7 +84,7 @@ char *ss; return -1; } return -1; /* Can't happen */ -} +} /* Find an entry in the One-time Password database. * Return codes: @@ -264,7 +264,7 @@ fprintf(stderr, "window= %d micro seconds \n" , microsec); fclose(mp->keyfile); - + setpriority(PRIO_PROCESS, 0, 0); return 0; } diff --git a/lib/libskey/skeysubr.c b/lib/libskey/skeysubr.c index e144202a7655..3911b324f67c 100644 --- a/lib/libskey/skeysubr.c +++ b/lib/libskey/skeysubr.c @@ -27,7 +27,7 @@ char *passwd; /* Password, any length */ MDX_CTX md; u_long results[4]; unsigned int buflen; - + buflen = strlen(seed) + strlen(passwd); if((buf = malloc(buflen+1)) == NULL) return -1; @@ -138,7 +138,7 @@ int n; written to standard error instead of standard output. That means that anyone using the program from a terminal won't notice, but capturing standard output will get the key words without a newline in front of - them. + them. */ fprintf(stderr, "\n"); fflush(stderr); diff --git a/lib/libss/Makefile b/lib/libss/Makefile index 3189ae5f8a77..e1026ef87d04 100644 --- a/lib/libss/Makefile +++ b/lib/libss/Makefile @@ -1,11 +1,11 @@ -# $Id: Makefile,v 1.6 1995/03/15 01:33:05 wpaul Exp $ +# $Id: Makefile,v 1.7 1995/03/18 08:34:42 rgrimes Exp $ LIB= ss SRCS= ss_err.c data.c error.c execute_cmd.c help.c invocation.c list_rqs.c \ listen.c pager.c parse.c prompt.c request_tbl.c requests.c \ std_rqs.c CFLAGS+= -I. -I${.CURDIR} -DPOSIX -DIN_LIBSS -CLEANFILES+= ss ss_err.c ss_err.h std_rqs.c +CLEANFILES+= ss ss_err.c ss_err.h std_rqs.c .if exists(${.CURDIR}/../libcom_err/obj/.) LDADD+= -L${.CURDIR}/../libcom_err/obj .else @@ -16,7 +16,7 @@ LDADD+= -lcom_err ss_err.h ss_err.c: ${.CURDIR}/ss_err.et test -e ss_err.et || ln -s ${.CURDIR}/ss_err.et . compile_et ss_err.et - -test -h ss_err.et && rm ss_err.et + -test -h ss_err.et && rm ss_err.et std_rqs.c: ${.CURDIR}/std_rqs.ct test -e std_rqs.ct || ln -s ${.CURDIR}/std_rqs.ct . diff --git a/lib/libss/error.c b/lib/libss/error.c index a3f86abbc443..3946359eedc9 100644 --- a/lib/libss/error.c +++ b/lib/libss/error.c @@ -30,7 +30,7 @@ char * ss_name(sci_idx) { register char *ret_val; register ss_data *infop; - + infop = ss_info(sci_idx); if (infop->current_request == (char const *)NULL) { ret_val = malloc((unsigned) @@ -44,7 +44,7 @@ char * ss_name(sci_idx) else { register char *cp; register char const *cp1; - ret_val = malloc((unsigned)sizeof(char) * + ret_val = malloc((unsigned)sizeof(char) * (strlen(infop->subsystem_name)+ strlen(infop->current_request)+ 4)); diff --git a/lib/libss/listen.c b/lib/libss/listen.c index 8d157b0b394d..16338271b1e8 100644 --- a/lib/libss/listen.c +++ b/lib/libss/listen.c @@ -1,9 +1,9 @@ /* * Listener loop for subsystem library libss.a. * - * Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/athena.lib/ss/RCS/listen.c,v 1.2 90/07/12 12:28:58 epeisach Exp + * Header: /afs/rel-eng.athena.mit.edu/project/release/current/source/athena/athena.lib/ss/RCS/listen.c,v 1.2 90/07/12 12:28:58 epeisach Exp * $Locker: $ - * + * * Copyright 1987, 1988 by MIT Student Information Processing Board * * For copyright information, see copyright.h. @@ -138,7 +138,7 @@ void ss_abort_subsystem(sci_idx, code) { ss_info(sci_idx)->abort = 1; ss_info(sci_idx)->exit_status = code; - + } int ss_quit(argc, argv, sci_idx, infop) diff --git a/lib/libss/pager.c b/lib/libss/pager.c index c189d6632841..fac80bda2356 100644 --- a/lib/libss/pager.c +++ b/lib/libss/pager.c @@ -28,10 +28,10 @@ extern int errno; void ss_page_stdin(); #ifndef NO_FORK -int ss_pager_create() +int ss_pager_create() { int filedes[2]; - + if (pipe(filedes) != 0) return(-1); diff --git a/lib/libss/prompt.c b/lib/libss/prompt.c index 1e88ca381d5e..60a598500e9b 100644 --- a/lib/libss/prompt.c +++ b/lib/libss/prompt.c @@ -1,7 +1,7 @@ /* * prompt.c: Routines for retrieving and setting a prompt. * - * Header: prompt.c,v 1.2 89/01/18 18:27:02 raeburn Exp + * Header: prompt.c,v 1.2 89/01/18 18:27:02 raeburn Exp * $Locker: $ * * Copyright 1987, 1988 by MIT Student Information Processing Board diff --git a/lib/libtelnet/Makefile b/lib/libtelnet/Makefile index 9c32ec9cdb70..5ab752297aa4 100644 --- a/lib/libtelnet/Makefile +++ b/lib/libtelnet/Makefile @@ -1,9 +1,9 @@ # From: @(#)Makefile 8.2 (Berkeley) 12/15/93 -# $Id: Makefile,v 1.2 1994/08/05 02:02:36 wollman Exp $ +# $Id: Makefile,v 1.3 1994/08/12 22:41:25 csgr Exp $ LIB= telnet SRCS= genget.c getent.c misc.c -#SRCS+= auth.c encrypt.c +#SRCS+= auth.c encrypt.c #SRCS+= kerberos.c enc_des.c #SRCS+= kerberos5.c CFLAGS+= -DHAS_CGETENT diff --git a/lib/libtermcap/termcap.c b/lib/libtermcap/termcap.c index 0b0a8acb5c18..38ae9da922bd 100644 --- a/lib/libtermcap/termcap.c +++ b/lib/libtermcap/termcap.c @@ -130,8 +130,8 @@ tgetent(bp, name) if (cgetset(cp) < 0) return(-2); - i = cgetent(&dummy, pathvec, name); - + i = cgetent(&dummy, pathvec, name); + if (i == 0) { char *pd, *ps, *tok, *s, *tcs; size_t len; @@ -236,7 +236,7 @@ tgetstr(id, area) char ids[3]; char *s; int i; - + /* * XXX * This is for all the boneheaded programs that relied on tgetstr @@ -248,7 +248,7 @@ tgetstr(id, area) if ((i = cgetstr(tbuf, ids, &s)) < 0) return NULL; - + strcpy(*area, s); *area += i + 1; return(s); diff --git a/lib/libtermcap/tgoto.c b/lib/libtermcap/tgoto.c index f0e4cc4fe311..c4dd9d7f43ca 100644 --- a/lib/libtermcap/tgoto.c +++ b/lib/libtermcap/tgoto.c @@ -114,7 +114,7 @@ toohard: /* fall into... */ case '2': -two: +two: *dp++ = which / 10 | '0'; one: *dp++ = which % 10 | '0'; diff --git a/lib/libtermcap/tparm.c b/lib/libtermcap/tparm.c index 96cbe3d19c7a..36070d962601 100644 --- a/lib/libtermcap/tparm.c +++ b/lib/libtermcap/tparm.c @@ -84,7 +84,7 @@ anyptr p; { return 1; else if (type == STRING) *(char **)p = arg_list[argnum].string; - else + else *(int *)p = arg_list[argnum].integer; } else { arg_list[argcnt].type = type; @@ -216,7 +216,7 @@ static int termcap; (UW) %-x subtract parameter FROM the character x and output it as a char (UW) %ax add the character x to parameter (GNU) %a[+*-/=][cp]x - GNU arithmetic. + GNU arithmetic. (UW) %sx subtract parameter FROM the character x %>xy if parameter > character x then add character y to parameter %B convert to BCD (parameter = (parameter/10)*16 + parameter%16) @@ -306,7 +306,7 @@ char *tparm(const char *str, ...) { } ;/* FALLTHROUGH */ case 'C': - if (*sp == 'C') { + if (*sp == 'C') { if (getarg(termcap - 1, INTEGER, &i)) return OOPS; if (i >= 96) { @@ -400,11 +400,11 @@ char *tparm(const char *str, ...) { return OOPS; ;/* FALLTHROUGH */ case '.': - if (termcap && fmt == NULL) + if (termcap && fmt == NULL) fmt = "%c"; ;/* FALLTHROUGH */ case 'd': - if (termcap && fmt == NULL) + if (termcap && fmt == NULL) fmt = "%d"; ;/* FALLTHROUGH */ case '2': @@ -412,7 +412,7 @@ char *tparm(const char *str, ...) { fmt = "%02d"; ;/* FALLTHROUGH */ case '3': - if (termcap && fmt == NULL) + if (termcap && fmt == NULL) fmt = "%03d"; ;/* FALLTHROUGH */ case ':': case ' ': case '#': case 'u': @@ -456,7 +456,7 @@ char *tparm(const char *str, ...) { sp++; fmt = sbuf; while(*fmt != '\0') { - if (*fmt == '$') + if (*fmt == '$') *dp++ = '\\'; *dp++ = *fmt++; } diff --git a/lib/libutil/pty.c b/lib/libutil/pty.c index 4443f0889c46..a6d08f612287 100644 --- a/lib/libutil/pty.c +++ b/lib/libutil/pty.c @@ -81,10 +81,10 @@ openpty(amaster, aslave, name, termp, winp) if (name) strcpy(name, line); if (termp) - (void) tcsetattr(slave, + (void) tcsetattr(slave, TCSAFLUSH, termp); if (winp) - (void) ioctl(slave, TIOCSWINSZ, + (void) ioctl(slave, TIOCSWINSZ, (char *)winp); return (0); } @@ -111,7 +111,7 @@ forkpty(amaster, name, termp, winp) case -1: return (-1); case 0: - /* + /* * child */ (void) close(master); diff --git a/lib/msun/Makefile b/lib/msun/Makefile index 72d70ac30bd4..642b002df6a9 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -1,45 +1,45 @@ -# @(#)Makefile 5.1beta 93/09/24 -# $Id: Makefile,v 1.3 1994/09/08 10:40:23 bde Exp $ -# +# @(#)Makefile 5.1beta 93/09/24 +# $Id: Makefile,v 1.4 1995/03/08 01:41:40 bde Exp $ +# # ==================================================== # Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. -# +# # Developed at SunPro, a Sun Microsystems, Inc. business. # Permission to use, copy, modify, and distribute this -# software is freely granted, provided that this notice +# software is freely granted, provided that this notice # is preserved. # ==================================================== -# -# +# +# # # There are two options in making libm at fdlibm compile time: # _IEEE_LIBM --- IEEE libm; smaller, and somewhat faster -# _MULTI_LIBM --- Support multi-standard at runtime by -# imposing wrapper functions defined in +# _MULTI_LIBM --- Support multi-standard at runtime by +# imposing wrapper functions defined in # fdlibm.h: # _IEEE_MODE -- IEEE # _XOPEN_MODE -- X/OPEN # _POSIX_MODE -- POSIX/ANSI # _SVID3_MODE -- SVID # -# Here is how to set up CFLAGS to create the desired libm at +# Here is how to set up CFLAGS to create the desired libm at # compile time: # # CFLAGS = -D_IEEE_LIBM ... IEEE libm (recommended) # CFLAGS = -D_SVID3_MODE ... Multi-standard supported -# libm with SVID as the +# libm with SVID as the # default standard # CFLAGS = -D_XOPEN_MODE ... Multi-standard supported -# libm with XOPEN as the +# libm with XOPEN as the # default standard # CFLAGS = -D_POSIX_MODE ... Multi-standard supported -# libm with POSIX as the +# libm with POSIX as the # default standard # CFLAGS = ... Multi-standard supported -# libm with IEEE as the +# libm with IEEE as the # default standard -# +# # Enable if you have a i387 (or i486 or Pentium) .if defined(HAVE_FPU) @@ -53,7 +53,7 @@ ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S e_log.S e_log10.S \ .PATH: ${.CURDIR}/man .PATH: ${.CURDIR}/src -CFLAGS+= -D_MULTI_LIBM -D_POSIX_MODE -D_IEEE_LIBM +CFLAGS+= -D_MULTI_LIBM -D_POSIX_MODE -D_IEEE_LIBM LIB= m COMMON_SRCS = e_acos.c e_acosf.c e_acosh.c e_acoshf.c e_asin.c e_asinf.c \ @@ -90,7 +90,7 @@ COMMON_SRCS = e_acos.c e_acosf.c e_acosh.c e_acoshf.c e_asin.c e_asinf.c \ SRCS=${COMMON_SRCS} -# Substitute common sources with any arch specific sources +# Substitute common sources with any arch specific sources .for i in ${ARCH_SRCS} SRCS:=${SRCS:S/${i:S/.S/.c/}/$i/} .endfor diff --git a/lib/msun/bsdsrc/b_exp.c b/lib/msun/bsdsrc/b_exp.c index 9b4f045f82e4..fa6ea75735c5 100644 --- a/lib/msun/bsdsrc/b_exp.c +++ b/lib/msun/bsdsrc/b_exp.c @@ -38,21 +38,21 @@ static char sccsid[] = "@(#)exp.c 8.1 (Berkeley) 6/4/93"; /* EXP(X) * RETURN THE EXPONENTIAL OF X * DOUBLE PRECISION (IEEE 53 bits, VAX D FORMAT 56 BITS) - * CODED IN C BY K.C. NG, 1/19/85; + * CODED IN C BY K.C. NG, 1/19/85; * REVISED BY K.C. NG on 2/6/85, 2/15/85, 3/7/85, 3/24/85, 4/16/85, 6/14/86. * * Required system supported functions: - * scalb(x,n) - * copysign(x,y) + * scalb(x,n) + * copysign(x,y) * finite(x) * * Method: - * 1. Argument Reduction: given the input x, find r and integer k such + * 1. Argument Reduction: given the input x, find r and integer k such * that - * x = k*ln2 + r, |r| <= 0.5*ln2 . + * x = k*ln2 + r, |r| <= 0.5*ln2 . * r will be represented as r := z+c for better accuracy. * - * 2. Compute exp(r) by + * 2. Compute exp(r) by * * exp(r) = 1 + r + r*R1/(2-R1), * where @@ -143,7 +143,7 @@ double x; } /* end of x > lntiny */ - else + else /* exp(-big#) underflows to zero */ if(finite(x)) return(scalb(1.0,-5000)); @@ -152,7 +152,7 @@ double x; } /* end of x < lnhuge */ - else + else /* exp(INF) is INF, exp(+big#) overflows to INF */ return( finite(x) ? scalb(1.0,5000) : x); } @@ -188,7 +188,7 @@ double x, c; } /* end of x > lntiny */ - else + else /* exp(-big#) underflows to zero */ if(finite(x)) return(scalb(1.0,-5000)); @@ -197,7 +197,7 @@ double x, c; } /* end of x < lnhuge */ - else + else /* exp(INF) is INF, exp(+big#) overflows to INF */ return( finite(x) ? scalb(1.0,5000) : x); } diff --git a/lib/msun/bsdsrc/b_log.c b/lib/msun/bsdsrc/b_log.c index ae186722f8df..908b8544f93c 100644 --- a/lib/msun/bsdsrc/b_log.c +++ b/lib/msun/bsdsrc/b_log.c @@ -391,7 +391,7 @@ log(x) double x; return (x+x); else return (infnan(ERANGE)); - + /* Argument reduction: 1 <= g < 2; x/2^m = g; */ /* y = F*(1 + f/F) for |f| <= 2^-8 */ diff --git a/lib/msun/src/e_acos.c b/lib/msun/src/e_acos.c index 0958a325a1f1..5f09e63d1e62 100644 --- a/lib/msun/src/e_acos.c +++ b/lib/msun/src/e_acos.c @@ -5,24 +5,24 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_acos.c,v 1.6 1994/08/18 23:04:51 jtc Exp $"; +static char rcsid[] = "$Id: e_acos.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif /* __ieee754_acos(x) - * Method : + * Method : * acos(x) = pi/2 - asin(x) * acos(-x) = pi/2 + asin(x) * For |x|<=0.5 * acos(x) = pi/2 - (x + x*x^2*R(x^2)) (see asin.c) * For x>0.5 * acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2))) - * = 2asin(sqrt((1-x)/2)) + * = 2asin(sqrt((1-x)/2)) * = 2s + 2s*z*R(z) ...z=(1-x)/2, s=sqrt(z) * = 2f + (2c + 2s*z*R(z)) * where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term @@ -42,9 +42,9 @@ static char rcsid[] = "$Id: e_acos.c,v 1.6 1994/08/18 23:04:51 jtc Exp $"; #include "math_private.h" #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif one= 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */ diff --git a/lib/msun/src/e_acosf.c b/lib/msun/src/e_acosf.c index b3703fe37da6..e220a72e20a1 100644 --- a/lib/msun/src/e_acosf.c +++ b/lib/msun/src/e_acosf.c @@ -8,22 +8,22 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_acosf.c,v 1.2 1994/08/18 23:04:53 jtc Exp $"; +static char rcsid[] = "$Id: e_acosf.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif one = 1.0000000000e+00, /* 0x3F800000 */ pi = 3.1415925026e+00, /* 0x40490fda */ diff --git a/lib/msun/src/e_acosh.c b/lib/msun/src/e_acosh.c index f54ba32879e3..efaefea51a0a 100644 --- a/lib/msun/src/e_acosh.c +++ b/lib/msun/src/e_acosh.c @@ -5,18 +5,18 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_acosh.c,v 1.6 1994/08/18 23:04:54 jtc Exp $"; +static char rcsid[] = "$Id: e_acosh.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif /* __ieee754_acosh(x) * Method : - * Based on + * Based on * acosh(x) = log [ x + sqrt(x*x-1) ] * we have * acosh(x) := log(x)+ln2, if x is large; else @@ -32,9 +32,9 @@ static char rcsid[] = "$Id: e_acosh.c,v 1.6 1994/08/18 23:04:54 jtc Exp $"; #include "math_private.h" #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif one = 1.0, ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ @@ -45,7 +45,7 @@ ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ double __ieee754_acosh(x) double x; #endif -{ +{ double t; int32_t hx; u_int32_t lx; @@ -55,7 +55,7 @@ ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ } else if(hx >=0x41b00000) { /* x > 2**28 */ if(hx >=0x7ff00000) { /* x is inf of NaN */ return x+x; - } else + } else return __ieee754_log(x)+ln2; /* acosh(huge)=log(2x) */ } else if(((hx-0x3ff00000)|lx)==0) { return 0.0; /* acosh(1) = 0 */ diff --git a/lib/msun/src/e_acoshf.c b/lib/msun/src/e_acoshf.c index 23ead6f468df..53080e9485df 100644 --- a/lib/msun/src/e_acoshf.c +++ b/lib/msun/src/e_acoshf.c @@ -8,22 +8,22 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_acoshf.c,v 1.2 1994/08/18 23:04:57 jtc Exp $"; +static char rcsid[] = "$Id: e_acoshf.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif one = 1.0, ln2 = 6.9314718246e-01; /* 0x3f317218 */ @@ -34,7 +34,7 @@ ln2 = 6.9314718246e-01; /* 0x3f317218 */ float __ieee754_acoshf(x) float x; #endif -{ +{ float t; int32_t hx; GET_FLOAT_WORD(hx,x); @@ -43,7 +43,7 @@ ln2 = 6.9314718246e-01; /* 0x3f317218 */ } else if(hx >=0x4d800000) { /* x > 2**28 */ if(hx >=0x7f800000) { /* x is inf of NaN */ return x+x; - } else + } else return __ieee754_logf(x)+ln2; /* acosh(huge)=log(2x) */ } else if (hx==0x3f800000) { return 0.0; /* acosh(1) = 0 */ diff --git a/lib/msun/src/e_asin.c b/lib/msun/src/e_asin.c index 7f6a915108f0..390ea5f4c3de 100644 --- a/lib/msun/src/e_asin.c +++ b/lib/msun/src/e_asin.c @@ -5,22 +5,22 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_asin.c,v 1.6 1994/08/18 23:05:01 jtc Exp $"; +static char rcsid[] = "$Id: e_asin.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif /* __ieee754_asin(x) - * Method : + * Method : * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ... * we approximate asin(x) on [0,0.5] by * asin(x) = x + x*x^2*R(x^2) * where - * R(x^2) is a rational approximation of (asin(x)-x)/x^3 + * R(x^2) is a rational approximation of (asin(x)-x)/x^3 * and its remez error is bounded by * |(asin(x)-x)/x^3 - R(x^2)| < 2^(-58.75) * @@ -49,9 +49,9 @@ static char rcsid[] = "$Id: e_asin.c,v 1.6 1994/08/18 23:05:01 jtc Exp $"; #include "math_private.h" #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ huge = 1.000e+300, @@ -86,12 +86,12 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ GET_LOW_WORD(lx,x); if(((ix-0x3ff00000)|lx)==0) /* asin(1)=+-pi/2 with inexact */ - return x*pio2_hi+x*pio2_lo; - return (x-x)/(x-x); /* asin(|x|>1) is NaN */ + return x*pio2_hi+x*pio2_lo; + return (x-x)/(x-x); /* asin(|x|>1) is NaN */ } else if (ix<0x3fe00000) { /* |x|<0.5 */ if(ix<0x3e400000) { /* if |x| < 2**-27 */ if(huge+x>one) return x;/* return x with inexact if x!=0*/ - } else + } else t = x*x; p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); @@ -115,6 +115,6 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ p = 2.0*s*r-(pio2_lo-2.0*c); q = pio4_hi-2.0*w; t = pio4_hi-(p-q); - } - if(hx>0) return t; else return -t; + } + if(hx>0) return t; else return -t; } diff --git a/lib/msun/src/e_asinf.c b/lib/msun/src/e_asinf.c index 7945874dcbb5..1f075796392a 100644 --- a/lib/msun/src/e_asinf.c +++ b/lib/msun/src/e_asinf.c @@ -8,22 +8,22 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_asinf.c,v 1.2 1994/08/18 23:05:05 jtc Exp $"; +static char rcsid[] = "$Id: e_asinf.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif one = 1.0000000000e+00, /* 0x3F800000 */ huge = 1.000e+30, @@ -55,13 +55,13 @@ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ ix = hx&0x7fffffff; if(ix==0x3f800000) { /* asin(1)=+-pi/2 with inexact */ - return x*pio2_hi+x*pio2_lo; + return x*pio2_hi+x*pio2_lo; } else if(ix> 0x3f800000) { /* |x|>= 1 */ - return (x-x)/(x-x); /* asin(|x|>1) is NaN */ + return (x-x)/(x-x); /* asin(|x|>1) is NaN */ } else if (ix<0x3f000000) { /* |x|<0.5 */ if(ix<0x32000000) { /* if |x| < 2**-27 */ if(huge+x>one) return x;/* return x with inexact if x!=0*/ - } else + } else t = x*x; p = t*(pS0+t*(pS1+t*(pS2+t*(pS3+t*(pS4+t*pS5))))); q = one+t*(qS1+t*(qS2+t*(qS3+t*qS4))); @@ -87,6 +87,6 @@ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */ p = (float)2.0*s*r-(pio2_lo-(float)2.0*c); q = pio4_hi-(float)2.0*w; t = pio4_hi-(p-q); - } - if(hx>0) return t; else return -t; + } + if(hx>0) return t; else return -t; } diff --git a/lib/msun/src/e_atan2.c b/lib/msun/src/e_atan2.c index 8221de669836..233d8b67e2da 100644 --- a/lib/msun/src/e_atan2.c +++ b/lib/msun/src/e_atan2.c @@ -5,19 +5,19 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_atan2.c,v 1.6 1994/08/18 23:05:08 jtc Exp $"; +static char rcsid[] = "$Id: e_atan2.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif /* __ieee754_atan2(y,x) * Method : * 1. Reduce y to positive by atan2(y,x)=-atan2(-y,x). - * 2. Reduce x to positive by (if x and y are unexceptional): + * 2. Reduce x to positive by (if x and y are unexceptional): * ARG (x+iy) = arctan(y/x) ... if x > 0, * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, * @@ -35,9 +35,9 @@ static char rcsid[] = "$Id: e_atan2.c,v 1.6 1994/08/18 23:05:08 jtc Exp $"; * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -45,9 +45,9 @@ static char rcsid[] = "$Id: e_atan2.c,v 1.6 1994/08/18 23:05:08 jtc Exp $"; #include "math_private.h" #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif tiny = 1.0e-300, zero = 0.0, @@ -62,7 +62,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ double __ieee754_atan2(y,x) double y,x; #endif -{ +{ double z; int32_t k,m,hx,hy,ix,iy; u_int32_t lx,ly; @@ -80,7 +80,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ /* when y = 0 */ if((iy|ly)==0) { switch(m) { - case 0: + case 0: case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi+tiny;/* atan(+0,-anything) = pi */ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ @@ -88,7 +88,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */ } /* when x = 0 */ if((ix|lx)==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - + /* when x is INF */ if(ix==0x7ff00000) { if(iy==0x7ff00000) { diff --git a/lib/msun/src/e_atan2f.c b/lib/msun/src/e_atan2f.c index 8493ca43537d..39aa779eeef9 100644 --- a/lib/msun/src/e_atan2f.c +++ b/lib/msun/src/e_atan2f.c @@ -8,22 +8,22 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_atan2f.c,v 1.2 1994/08/18 23:05:11 jtc Exp $"; +static char rcsid[] = "$Id: e_atan2f.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif tiny = 1.0e-30, zero = 0.0, @@ -38,7 +38,7 @@ pi_lo = 1.5099578832e-07; /* 0x34222168 */ float __ieee754_atan2f(y,x) float y,x; #endif -{ +{ float z; int32_t k,m,hx,hy,ix,iy; @@ -55,7 +55,7 @@ pi_lo = 1.5099578832e-07; /* 0x34222168 */ /* when y = 0 */ if(iy==0) { switch(m) { - case 0: + case 0: case 1: return y; /* atan(+-0,+anything)=+-0 */ case 2: return pi+tiny;/* atan(+0,-anything) = pi */ case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ @@ -63,7 +63,7 @@ pi_lo = 1.5099578832e-07; /* 0x34222168 */ } /* when x = 0 */ if(ix==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - + /* when x is INF */ if(ix==0x7f800000) { if(iy==0x7f800000) { diff --git a/lib/msun/src/e_atanh.c b/lib/msun/src/e_atanh.c index 7d8502315523..aeb8a75444fa 100644 --- a/lib/msun/src/e_atanh.c +++ b/lib/msun/src/e_atanh.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_atanh.c,v 1.6 1994/08/18 23:05:12 jtc Exp $"; +static char rcsid[] = "$Id: e_atanh.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif /* __ieee754_atanh(x) @@ -21,7 +21,7 @@ static char rcsid[] = "$Id: e_atanh.c,v 1.6 1994/08/18 23:05:12 jtc Exp $"; * 1 2x x * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) * 2 1 - x 1 - x - * + * * For x<0.5 * atanh(x) = 0.5*log1p(2x+2x*x/(1-x)) * @@ -61,14 +61,14 @@ static double zero = 0.0; ix = hx&0x7fffffff; if ((ix|((lx|(-lx))>>31))>0x3ff00000) /* |x|>1 */ return (x-x)/(x-x); - if(ix==0x3ff00000) + if(ix==0x3ff00000) return x/zero; if(ix<0x3e300000&&(huge+x)>zero) return x; /* x<2**-28 */ SET_HIGH_WORD(x,ix); if(ix<0x3fe00000) { /* x < 0.5 */ t = x+x; t = 0.5*log1p(t+t*x/(one-x)); - } else + } else t = 0.5*log1p((x+x)/(one-x)); if(hx>=0) return t; else return -t; } diff --git a/lib/msun/src/e_atanhf.c b/lib/msun/src/e_atanhf.c index 3a941cc751a1..1c2cc6450fca 100644 --- a/lib/msun/src/e_atanhf.c +++ b/lib/msun/src/e_atanhf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_atanhf.c,v 1.2 1994/08/18 23:05:14 jtc Exp $"; +static char rcsid[] = "$Id: e_atanhf.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif #include "math.h" @@ -45,14 +45,14 @@ static float zero = 0.0; ix = hx&0x7fffffff; if (ix>0x3f800000) /* |x|>1 */ return (x-x)/(x-x); - if(ix==0x3f800000) + if(ix==0x3f800000) return x/zero; if(ix<0x31800000&&(huge+x)>zero) return x; /* x<2**-28 */ SET_FLOAT_WORD(x,ix); if(ix<0x3f000000) { /* x < 0.5 */ t = x+x; t = (float)0.5*log1pf(t+t*x/(one-x)); - } else + } else t = (float)0.5*log1pf((x+x)/(one-x)); if(hx>=0) return t; else return -t; } diff --git a/lib/msun/src/e_cosh.c b/lib/msun/src/e_cosh.c index b54fc3f48b13..2153e6979900 100644 --- a/lib/msun/src/e_cosh.c +++ b/lib/msun/src/e_cosh.c @@ -5,28 +5,28 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_cosh.c,v 1.5 1994/08/18 23:05:15 jtc Exp $"; +static char rcsid[] = "$Id: e_cosh.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif /* __ieee754_cosh(x) - * Method : + * Method : * mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2 - * 1. Replace x by |x| (cosh(x) = cosh(-x)). - * 2. - * [ exp(x) - 1 ]^2 + * 1. Replace x by |x| (cosh(x) = cosh(-x)). + * 2. + * [ exp(x) - 1 ]^2 * 0 <= x <= ln2/2 : cosh(x) := 1 + ------------------- * 2*exp(x) * * exp(x) + 1/exp(x) * ln2/2 <= x <= 22 : cosh(x) := ------------------- * 2 - * 22 <= x <= lnovft : cosh(x) := exp(x)/2 + * 22 <= x <= lnovft : cosh(x) := exp(x)/2 * lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2) * ln2ovft < x : cosh(x) := huge*huge (overflow) * @@ -50,7 +50,7 @@ static double one = 1.0, half=0.5, huge = 1.0e300; double __ieee754_cosh(x) double x; #endif -{ +{ double t,w; int32_t ix; u_int32_t lx; @@ -60,7 +60,7 @@ static double one = 1.0, half=0.5, huge = 1.0e300; ix &= 0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7ff00000) return x*x; + if(ix>=0x7ff00000) return x*x; /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ if(ix<0x3fd62e43) { @@ -81,7 +81,7 @@ static double one = 1.0, half=0.5, huge = 1.0e300; /* |x| in [log(maxdouble), overflowthresold] */ GET_LOW_WORD(lx,x); - if (ix<0x408633CE || + if (ix<0x408633CE || (ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d)) { w = __ieee754_exp(half*fabs(x)); t = half*w; diff --git a/lib/msun/src/e_coshf.c b/lib/msun/src/e_coshf.c index 6c30ae55e4aa..25bb9e30aa19 100644 --- a/lib/msun/src/e_coshf.c +++ b/lib/msun/src/e_coshf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_coshf.c,v 1.2 1994/08/18 23:05:17 jtc Exp $"; +static char rcsid[] = "$Id: e_coshf.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif #include "math.h" @@ -32,7 +32,7 @@ static float one = 1.0, half=0.5, huge = 1.0e30; float __ieee754_coshf(x) float x; #endif -{ +{ float t,w; int32_t ix; @@ -40,7 +40,7 @@ static float one = 1.0, half=0.5, huge = 1.0e30; ix &= 0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7f800000) return x*x; + if(ix>=0x7f800000) return x*x; /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ if(ix<0x3eb17218) { diff --git a/lib/msun/src/e_exp.c b/lib/msun/src/e_exp.c index 4c76930e7c0c..9b833be6894a 100644 --- a/lib/msun/src/e_exp.c +++ b/lib/msun/src/e_exp.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_exp.c,v 1.6 1994/08/18 23:05:18 jtc Exp $"; +static char rcsid[] = "$Id: e_exp.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif /* __ieee754_exp(x) @@ -22,36 +22,36 @@ static char rcsid[] = "$Id: e_exp.c,v 1.6 1994/08/18 23:05:18 jtc Exp $"; * Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658. * Given x, find r and integer k such that * - * x = k*ln2 + r, |r| <= 0.5*ln2. + * x = k*ln2 + r, |r| <= 0.5*ln2. * - * Here r will be represented as r = hi-lo for better + * Here r will be represented as r = hi-lo for better * accuracy. * * 2. Approximation of exp(r) by a special rational function on * the interval [0,0.34658]: * Write * R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + ... - * We use a special Reme algorithm on [0,0.34658] to generate - * a polynomial of degree 5 to approximate R. The maximum error + * We use a special Reme algorithm on [0,0.34658] to generate + * a polynomial of degree 5 to approximate R. The maximum error * of this polynomial approximation is bounded by 2**-59. In * other words, * R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5 * (where z=r*r, and the values of P1 to P5 are listed below) * and * | 5 | -59 - * | 2.0+P1*z+...+P5*z - R(z) | <= 2 + * | 2.0+P1*z+...+P5*z - R(z) | <= 2 * | | * The computation of exp(r) thus becomes * 2*r * exp(r) = 1 + ------- * R - r - * r*R1(r) + * r*R1(r) * = 1 + r + ----------- (for better accuracy) * 2 - R1(r) * where * 2 4 10 * R1(r) = r - (P1*r + P2*r + ... + P5*r ). - * + * * 3. Scale back to obtain exp(x): * From step 1, we have * exp(x) = 2^k * exp(r) @@ -66,13 +66,13 @@ static char rcsid[] = "$Id: e_exp.c,v 1.6 1994/08/18 23:05:18 jtc Exp $"; * 1 ulp (unit in the last place). * * Misc. info. - * For IEEE double + * For IEEE double * if x > 7.09782712893383973096e+02 then exp(x) overflow * if x < -7.45133219101941108420e+02 then exp(x) underflow * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -123,7 +123,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ if(hx>=0x7ff00000) { u_int32_t lx; GET_LOW_WORD(lx,x); - if(((hx&0xfffff)|lx)!=0) + if(((hx&0xfffff)|lx)!=0) return x+x; /* NaN */ else return (xsb==0)? x:0.0; /* exp(+-inf)={inf,0} */ } @@ -132,7 +132,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ } /* argument reduction */ - if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ + if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb; } else { @@ -142,7 +142,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ lo = t*ln2LO[0]; } x = hi - lo; - } + } else if(hx < 0x3e300000) { /* when |x|<2**-28 */ if(huge+x>one) return one+x;/* trigger inexact */ } @@ -151,7 +151,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ /* x is now in primary range */ t = x*x; c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); - if(k==0) return one-((x*c)/(c-2.0)-x); + if(k==0) return one-((x*c)/(c-2.0)-x); else y = one-((lo-(x*c)/(2.0-c))-hi); if(k >= -1021) { u_int32_t hy; diff --git a/lib/msun/src/e_expf.c b/lib/msun/src/e_expf.c index e4df68eccbdd..19ff4ac2388f 100644 --- a/lib/msun/src/e_expf.c +++ b/lib/msun/src/e_expf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_expf.c,v 1.2 1994/08/18 23:05:20 jtc Exp $"; +static char rcsid[] = "$Id: e_expf.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif #include "math.h" @@ -68,7 +68,7 @@ P5 = 4.1381369442e-08; /* 0x3331bb4c */ } /* argument reduction */ - if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ + if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb; } else { @@ -78,7 +78,7 @@ P5 = 4.1381369442e-08; /* 0x3331bb4c */ lo = t*ln2LO[0]; } x = hi - lo; - } + } else if(hx < 0x31800000) { /* when |x|<2**-28 */ if(huge+x>one) return one+x;/* trigger inexact */ } @@ -87,7 +87,7 @@ P5 = 4.1381369442e-08; /* 0x3331bb4c */ /* x is now in primary range */ t = x*x; c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); - if(k==0) return one-((x*c)/(c-(float)2.0)-x); + if(k==0) return one-((x*c)/(c-(float)2.0)-x); else y = one-((lo-(x*c)/((float)2.0-c))-hi); if(k >= -125) { u_int32_t hy; diff --git a/lib/msun/src/e_fmod.c b/lib/msun/src/e_fmod.c index 0733d47a7ad5..d784c6848bac 100644 --- a/lib/msun/src/e_fmod.c +++ b/lib/msun/src/e_fmod.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_fmod.c,v 1.6 1994/08/18 23:05:21 jtc Exp $"; +static char rcsid[] = "$Id: e_fmod.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif -/* +/* * __ieee754_fmod(x,y) * Return x mod y in exact arithmetic * Method: shift and subtract @@ -51,7 +51,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; return (x*y)/(x*y); if(hx<=hy) { if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */ - if(lx==ly) + if(lx==ly) return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/ } @@ -74,7 +74,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; } else iy = (hy>>20)-1023; /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -1022) + if(ix >= -1022) hx = 0x00100000|(0x000fffff&hx); else { /* subnormal x, shift x to normal */ n = -1022-ix; @@ -86,7 +86,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; lx = 0; } } - if(iy >= -1022) + if(iy >= -1022) hy = 0x00100000|(0x000fffff&hy); else { /* subnormal y, shift y to normal */ n = -1022-iy; @@ -115,7 +115,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,}; /* convert back to floating value and restore the sign */ if((hx|lx)==0) /* return sign(x)*0 */ - return Zero[(u_int32_t)sx>>31]; + return Zero[(u_int32_t)sx>>31]; while(hx<0x00100000) { /* normalize x */ hx = hx+hx+(lx>>31); lx = lx+lx; iy -= 1; diff --git a/lib/msun/src/e_fmodf.c b/lib/msun/src/e_fmodf.c index 5e547f5d7771..4a54d1818b08 100644 --- a/lib/msun/src/e_fmodf.c +++ b/lib/msun/src/e_fmodf.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_fmodf.c,v 1.2 1994/08/18 23:05:23 jtc Exp $"; +static char rcsid[] = "$Id: e_fmodf.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif -/* +/* * __ieee754_fmodf(x,y) * Return x mod y in exact arithmetic * Method: shift and subtract @@ -66,13 +66,13 @@ static float one = 1.0, Zero[] = {0.0, -0.0,}; } else iy = (hy>>23)-127; /* set up {hx,lx}, {hy,ly} and align y to x */ - if(ix >= -126) + if(ix >= -126) hx = 0x00800000|(0x007fffff&hx); else { /* subnormal x, shift x to normal */ n = -126-ix; hx = hx<<n; } - if(iy >= -126) + if(iy >= -126) hy = 0x00800000|(0x007fffff&hy); else { /* subnormal y, shift y to normal */ n = -126-iy; @@ -95,7 +95,7 @@ static float one = 1.0, Zero[] = {0.0, -0.0,}; /* convert back to floating value and restore the sign */ if(hx==0) /* return sign(x)*0 */ - return Zero[(u_int32_t)sx>>31]; + return Zero[(u_int32_t)sx>>31]; while(hx<0x00800000) { /* normalize x */ hx = hx+hx; iy -= 1; diff --git a/lib/msun/src/e_gamma.c b/lib/msun/src/e_gamma.c index a3e6a4b18a2b..699dc54acad6 100644 --- a/lib/msun/src/e_gamma.c +++ b/lib/msun/src/e_gamma.c @@ -5,14 +5,14 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== * */ #ifndef lint -static char rcsid[] = "$Id: e_gamma.c,v 1.4 1994/08/10 20:30:51 jtc Exp $"; +static char rcsid[] = "$Id: e_gamma.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif /* __ieee754_gamma(x) diff --git a/lib/msun/src/e_gamma_r.c b/lib/msun/src/e_gamma_r.c index 8b6cb8fe4889..699af100b171 100644 --- a/lib/msun/src/e_gamma_r.c +++ b/lib/msun/src/e_gamma_r.c @@ -5,18 +5,18 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_gamma_r.c,v 1.4 1994/08/10 20:30:52 jtc Exp $"; +static char rcsid[] = "$Id: e_gamma_r.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif /* __ieee754_gamma_r(x, signgamp) - * Reentrant version of the logarithm of the Gamma function - * with user provide pointer for the sign of Gamma(x). + * Reentrant version of the logarithm of the Gamma function + * with user provide pointer for the sign of Gamma(x). * * Method: See __ieee754_lgamma_r */ diff --git a/lib/msun/src/e_gammaf.c b/lib/msun/src/e_gammaf.c index 593ae128462a..039c25784e36 100644 --- a/lib/msun/src/e_gammaf.c +++ b/lib/msun/src/e_gammaf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_gammaf.c,v 1.1 1994/08/10 20:30:53 jtc Exp $"; +static char rcsid[] = "$Id: e_gammaf.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif /* __ieee754_gammaf(x) diff --git a/lib/msun/src/e_gammaf_r.c b/lib/msun/src/e_gammaf_r.c index b74657a4c5f1..93f17fb825b4 100644 --- a/lib/msun/src/e_gammaf_r.c +++ b/lib/msun/src/e_gammaf_r.c @@ -8,18 +8,18 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_gammaf_r.c,v 1.1 1994/08/10 20:30:54 jtc Exp $"; +static char rcsid[] = "$Id: e_gammaf_r.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif /* __ieee754_gammaf_r(x, signgamp) - * Reentrant version of the logarithm of the Gamma function - * with user provide pointer for the sign of Gamma(x). + * Reentrant version of the logarithm of the Gamma function + * with user provide pointer for the sign of Gamma(x). * * Method: See __ieee754_lgammaf_r */ diff --git a/lib/msun/src/e_hypot.c b/lib/msun/src/e_hypot.c index 045f8a3a03cb..2f6e30ff44bf 100644 --- a/lib/msun/src/e_hypot.c +++ b/lib/msun/src/e_hypot.c @@ -5,23 +5,23 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_hypot.c,v 1.6 1994/08/18 23:05:24 jtc Exp $"; +static char rcsid[] = "$Id: e_hypot.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* __ieee754_hypot(x,y) * - * Method : - * If (assume round-to-nearest) z=x*x+y*y - * has error less than sqrt(2)/2 ulp, than + * Method : + * If (assume round-to-nearest) z=x*x+y*y + * has error less than sqrt(2)/2 ulp, than * sqrt(z) has error less than 1 ulp (exercise). * - * So, compute sqrt(x*x+y*y) with some care as + * So, compute sqrt(x*x+y*y) with some care as * follows to get the error below 1 ulp: * * Assume x>y>0; @@ -31,10 +31,10 @@ static char rcsid[] = "$Id: e_hypot.c,v 1.6 1994/08/18 23:05:24 jtc Exp $"; * where x1 = x with lower 32 bits cleared, x2 = x-x1; else * 2. if x <= 2y use * t1*y1+((x-y)*(x-y)+(t1*y2+t2*y)) - * where t1 = 2x with lower 32 bits cleared, t2 = 2x-t1, + * where t1 = 2x with lower 32 bits cleared, t2 = 2x-t1, * y1= y with lower 32 bits chopped, y2 = y-y1. - * - * NOTE: scaling may be necessary if some argument is too + * + * NOTE: scaling may be necessary if some argument is too * large or too tiny * * Special cases: @@ -42,8 +42,8 @@ static char rcsid[] = "$Id: e_hypot.c,v 1.6 1994/08/18 23:05:24 jtc Exp $"; * hypot(x,y) is NAN if x or y is NAN. * * Accuracy: - * hypot(x,y) returns sqrt(x^2+y^2) with error less - * than 1 ulps (units in the last place) + * hypot(x,y) returns sqrt(x^2+y^2) with error less + * than 1 ulps (units in the last place) */ #include "math.h" @@ -84,7 +84,7 @@ static char rcsid[] = "$Id: e_hypot.c,v 1.6 1994/08/18 23:05:24 jtc Exp $"; SET_HIGH_WORD(b,hb); } if(hb < 0x20b00000) { /* b < 2**-500 */ - if(hb <= 0x000fffff) { /* subnormal b or 0 */ + if(hb <= 0x000fffff) { /* subnormal b or 0 */ u_int32_t low; GET_LOW_WORD(low,b); if((hb|low)==0) return a; diff --git a/lib/msun/src/e_hypotf.c b/lib/msun/src/e_hypotf.c index 874d7eeadd16..66b9e17004d9 100644 --- a/lib/msun/src/e_hypotf.c +++ b/lib/msun/src/e_hypotf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_hypotf.c,v 1.2 1994/08/18 23:05:26 jtc Exp $"; +static char rcsid[] = "$Id: e_hypotf.c,v 1.1.1.1 1994/08/19 09:39:55 jkh Exp $"; #endif #include "math.h" @@ -52,7 +52,7 @@ static char rcsid[] = "$Id: e_hypotf.c,v 1.2 1994/08/18 23:05:26 jtc Exp $"; SET_FLOAT_WORD(b,hb); } if(hb < 0x26800000) { /* b < 2**-50 */ - if(hb <= 0x007fffff) { /* subnormal b or 0 */ + if(hb <= 0x007fffff) { /* subnormal b or 0 */ if(hb==0) return a; SET_FLOAT_WORD(t1,0x3f000000); /* t1=2^126 */ b *= t1; diff --git a/lib/msun/src/e_j0.c b/lib/msun/src/e_j0.c index 508f7210d6f3..3a11397a3262 100644 --- a/lib/msun/src/e_j0.c +++ b/lib/msun/src/e_j0.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_j0.c,v 1.6 1994/08/18 23:05:29 jtc Exp $"; +static char rcsid[] = "$Id: e_j0.c,v 1.1.1.1 1994/08/19 09:39:43 jkh Exp $"; #endif /* __ieee754_j0(x), __ieee754_y0(x) @@ -33,20 +33,20 @@ static char rcsid[] = "$Id: e_j0.c,v 1.6 1994/08/18 23:05:29 jtc Exp $"; * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one.) - * + * * 3 Special cases * j0(nan)= nan * j0(0) = 1 * j0(inf) = 0 - * + * * Method -- y0(x): * 1. For x<2. - * Since + * Since * y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...) * therefore y0(x)-2/pi*j0(x)*ln(x) is an even function. * We use the following function to approximate y0, * y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2 - * where + * where * U(z) = u00 + u01*z + ... + u06*z^6 * V(z) = 1 + v01*z + ... + v04*z^4 * with absolute approximation error bounded by 2**-72. @@ -69,9 +69,9 @@ static double pzero(), qzero(); #endif #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif huge = 1e300, one = 1.0, @@ -94,9 +94,9 @@ static double zero = 0.0; #endif #ifdef __STDC__ - double __ieee754_j0(double x) + double __ieee754_j0(double x) #else - double __ieee754_j0(x) + double __ieee754_j0(x) double x; #endif { @@ -163,9 +163,9 @@ v03 = 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */ v04 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */ #ifdef __STDC__ - double __ieee754_y0(double x) + double __ieee754_y0(double x) #else - double __ieee754_y0(x) + double __ieee754_y0(x) double x; #endif { @@ -175,7 +175,7 @@ v04 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */ EXTRACT_WORDS(hx,lx,x); ix = 0x7fffffff&hx; /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ - if(ix>=0x7ff00000) return one/(x+x*x); + if(ix>=0x7ff00000) return one/(x+x*x); if((ix|lx)==0) return -one/zero; if(hx<0) return zero/zero; if(ix >= 0x40000000) { /* |x| >= 2.0 */ @@ -349,7 +349,7 @@ static double pS2[5] = { s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qzero is * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. diff --git a/lib/msun/src/e_j0f.c b/lib/msun/src/e_j0f.c index ce8e510be634..ce416fab70e8 100644 --- a/lib/msun/src/e_j0f.c +++ b/lib/msun/src/e_j0f.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_j0f.c,v 1.2 1994/08/18 23:05:32 jtc Exp $"; +static char rcsid[] = "$Id: e_j0f.c,v 1.1.1.1 1994/08/19 09:39:55 jkh Exp $"; #endif #include "math.h" @@ -27,9 +27,9 @@ static float pzerof(), qzerof(); #endif #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif huge = 1e30, one = 1.0, @@ -52,9 +52,9 @@ static float zero = 0.0; #endif #ifdef __STDC__ - float __ieee754_j0f(float x) + float __ieee754_j0f(float x) #else - float __ieee754_j0f(x) + float __ieee754_j0f(x) float x; #endif { @@ -121,9 +121,9 @@ v03 = 2.5915085189e-07, /* 0x348b216c */ v04 = 4.4111031494e-10; /* 0x2ff280c2 */ #ifdef __STDC__ - float __ieee754_y0f(float x) + float __ieee754_y0f(float x) #else - float __ieee754_y0f(x) + float __ieee754_y0f(x) float x; #endif { @@ -133,7 +133,7 @@ v04 = 4.4111031494e-10; /* 0x2ff280c2 */ GET_FLOAT_WORD(hx,x); ix = 0x7fffffff&hx; /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0 */ - if(ix>=0x7f800000) return one/(x+x*x); + if(ix>=0x7f800000) return one/(x+x*x); if(ix==0) return -one/zero; if(hx<0) return zero/zero; if(ix >= 0x40000000) { /* |x| >= 2.0 */ @@ -306,7 +306,7 @@ static float pS2[5] = { s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qzero is * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. diff --git a/lib/msun/src/e_j1.c b/lib/msun/src/e_j1.c index 407b84cbb6af..f577368048ed 100644 --- a/lib/msun/src/e_j1.c +++ b/lib/msun/src/e_j1.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_j1.c,v 1.6 1994/08/18 23:05:33 jtc Exp $"; +static char rcsid[] = "$Id: e_j1.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* __ieee754_j1(x), __ieee754_y1(x) @@ -34,16 +34,16 @@ static char rcsid[] = "$Id: e_j1.c,v 1.6 1994/08/18 23:05:33 jtc Exp $"; * (To avoid cancellation, use * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) * to compute the worse one.) - * + * * 3 Special cases * j1(nan)= nan * j1(0) = 0 * j1(inf) = 0 - * + * * Method -- y1(x): - * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN + * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN * 2. For x<2. - * Since + * Since * y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...) * therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function. * We use the following function to approximate y1, @@ -69,9 +69,9 @@ static double pone(), qone(); #endif #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif huge = 1e300, one = 1.0, @@ -95,9 +95,9 @@ static double zero = 0.0; #endif #ifdef __STDC__ - double __ieee754_j1(double x) + double __ieee754_j1(double x) #else - double __ieee754_j1(x) + double __ieee754_j1(x) double x; #endif { @@ -164,9 +164,9 @@ static double V0[5] = { }; #ifdef __STDC__ - double __ieee754_y1(double x) + double __ieee754_y1(double x) #else - double __ieee754_y1(x) + double __ieee754_y1(x) double x; #endif { @@ -176,7 +176,7 @@ static double V0[5] = { EXTRACT_WORDS(hx,lx,x); ix = 0x7fffffff&hx; /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ - if(ix>=0x7ff00000) return one/(x+x*x); + if(ix>=0x7ff00000) return one/(x+x*x); if((ix|lx)==0) return -one/zero; if(hx<0) return zero/zero; if(ix >= 0x40000000) { /* |x| >= 2.0 */ @@ -206,10 +206,10 @@ static double V0[5] = { z = invsqrtpi*(u*ss+v*cc)/sqrt(x); } return z; - } + } if(ix<=0x3c900000) { /* x < 2**-54 */ return(-tpi/x); - } + } z = x*x; u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); @@ -347,7 +347,7 @@ static double ps2[5] = { s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qone is * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. diff --git a/lib/msun/src/e_j1f.c b/lib/msun/src/e_j1f.c index 9fa43fcd8f1d..f06b30006f2d 100644 --- a/lib/msun/src/e_j1f.c +++ b/lib/msun/src/e_j1f.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_j1f.c,v 1.2 1994/08/18 23:05:35 jtc Exp $"; +static char rcsid[] = "$Id: e_j1f.c,v 1.1.1.1 1994/08/19 09:39:55 jkh Exp $"; #endif #include "math.h" @@ -27,9 +27,9 @@ static float ponef(), qonef(); #endif #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif huge = 1e30, one = 1.0, @@ -53,9 +53,9 @@ static float zero = 0.0; #endif #ifdef __STDC__ - float __ieee754_j1f(float x) + float __ieee754_j1f(float x) #else - float __ieee754_j1f(x) + float __ieee754_j1f(x) float x; #endif { @@ -122,9 +122,9 @@ static float V0[5] = { }; #ifdef __STDC__ - float __ieee754_y1f(float x) + float __ieee754_y1f(float x) #else - float __ieee754_y1f(x) + float __ieee754_y1f(x) float x; #endif { @@ -134,7 +134,7 @@ static float V0[5] = { GET_FLOAT_WORD(hx,x); ix = 0x7fffffff&hx; /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ - if(ix>=0x7f800000) return one/(x+x*x); + if(ix>=0x7f800000) return one/(x+x*x); if(ix==0) return -one/zero; if(hx<0) return zero/zero; if(ix >= 0x40000000) { /* |x| >= 2.0 */ @@ -164,10 +164,10 @@ static float V0[5] = { z = invsqrtpi*(u*ss+v*cc)/sqrtf(x); } return z; - } + } if(ix<=0x24800000) { /* x < 2**-54 */ return(-tpi/x); - } + } z = x*x; u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); @@ -305,7 +305,7 @@ static float ps2[5] = { s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); return one+ r/s; } - + /* For x >= 8, the asymptotic expansions of qone is * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. diff --git a/lib/msun/src/e_jn.c b/lib/msun/src/e_jn.c index b06414942849..ae309f0e6b74 100644 --- a/lib/msun/src/e_jn.c +++ b/lib/msun/src/e_jn.c @@ -5,20 +5,20 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_jn.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; +static char rcsid[] = "$Id: e_jn.c,v 1.2 1995/04/07 23:13:42 bde Exp $"; #endif /* * __ieee754_jn(n, x), __ieee754_yn(n, x) * floating point Bessel's function of the 1st and 2nd kind * of order n - * + * * Special cases: * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. @@ -37,7 +37,7 @@ static char rcsid[] = "$Id: e_jn.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; * yn(n,x) is similar in all respects, except * that forward recursion is used for all * values of n>1. - * + * */ #include "math.h" @@ -76,7 +76,7 @@ static double zero = 0.00000000000000000000e+00; ix = 0x7fffffff&hx; /* if J(n,NaN) is NaN */ if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x; - if(n<0){ + if(n<0){ n = -n; x = -x; hx ^= 0x80000000; @@ -87,13 +87,13 @@ static double zero = 0.00000000000000000000e+00; x = fabs(x); if((ix|lx)==0||ix>=0x7ff00000) /* if x is 0 or inf */ b = zero; - else if((double)n<=x) { + else if((double)n<=x) { /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ if(ix>=0x52D00000) { /* x > 2**302 */ - /* (x >> n**2) + /* (x >> n**2) * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), + * Let s=sin(x), c=cos(x), * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then * * n sin(xn)*sqt2 cos(xn)*sqt2 @@ -110,7 +110,7 @@ static double zero = 0.00000000000000000000e+00; case 3: temp = cos(x)-sin(x); break; } b = invsqrtpi*temp/sqrt(x); - } else { + } else { a = __ieee754_j0(x); b = __ieee754_j1(x); for(i=1;i<n;i++){ @@ -121,7 +121,7 @@ static double zero = 0.00000000000000000000e+00; } } else { if(ix<0x3e100000) { /* x < 2**-29 */ - /* x is tiny, return the first Taylor expansion of J(n,x) + /* x is tiny, return the first Taylor expansion of J(n,x) * J(n,x) = 1/n!*(x/2)^n - ... */ if(n>33) /* underflow */ @@ -136,14 +136,14 @@ static double zero = 0.00000000000000000000e+00; } } else { /* use backward recurrence */ - /* x x^2 x^2 + /* x x^2 x^2 * J(n,x)/J(n-1,x) = ---- ------ ------ ..... * 2n - 2(n+1) - 2(n+2) * - * 1 1 1 + * 1 1 1 * (for large x) = ---- ------ ------ ..... * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - + * -- - ------ - ------ - * x x x * * Let w = 2n/x and h=2/x, then the above quotient @@ -159,9 +159,9 @@ static double zero = 0.00000000000000000000e+00; * To determine how many terms needed, let * Q(0) = w, Q(1) = w(w+h) - 1, * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple + * When Q(k) > 1e4 good for single + * When Q(k) > 1e9 good for double + * When Q(k) > 1e17 good for quadruple */ /* determine k */ double t,v; @@ -183,7 +183,7 @@ static double zero = 0.00000000000000000000e+00; * single 8.8722839355e+01 * double 7.09782712893383973096e+02 * long double 1.1356523406294143949491931077970765006170e+04 - * then recurrent value may overflow and the result is + * then recurrent value may overflow and the result is * likely underflow to zero */ tmp = n; @@ -219,9 +219,9 @@ static double zero = 0.00000000000000000000e+00; } #ifdef __STDC__ - double __ieee754_yn(int n, double x) + double __ieee754_yn(int n, double x) #else - double __ieee754_yn(n,x) + double __ieee754_yn(n,x) int n; double x; #endif { @@ -244,10 +244,10 @@ static double zero = 0.00000000000000000000e+00; if(n==1) return(sign*__ieee754_y1(x)); if(ix==0x7ff00000) return zero; if(ix>=0x52D00000) { /* x > 2**302 */ - /* (x >> n**2) + /* (x >> n**2) * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), + * Let s=sin(x), c=cos(x), * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then * * n sin(xn)*sqt2 cos(xn)*sqt2 @@ -270,7 +270,7 @@ static double zero = 0.00000000000000000000e+00; b = __ieee754_y1(x); /* quit if b is -inf */ GET_HIGH_WORD(high,b); - for(i=1;i<n&&high!=0xfff00000;i++){ + for(i=1;i<n&&high!=0xfff00000;i++){ temp = b; b = ((double)(i+i)/x)*b - a; GET_HIGH_WORD(high,b); diff --git a/lib/msun/src/e_jnf.c b/lib/msun/src/e_jnf.c index 4662bce1718b..6393f83df5c1 100644 --- a/lib/msun/src/e_jnf.c +++ b/lib/msun/src/e_jnf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_jnf.c,v 1.1.1.1 1994/08/19 09:39:55 jkh Exp $"; +static char rcsid[] = "$Id: e_jnf.c,v 1.2 1995/04/07 23:13:43 bde Exp $"; #endif #include "math.h" @@ -53,7 +53,7 @@ static float zero = 0.0000000000e+00; ix = 0x7fffffff&hx; /* if J(n,NaN) is NaN */ if(ix>0x7f800000) return x+x; - if(n<0){ + if(n<0){ n = -n; x = -x; hx ^= 0x80000000; @@ -64,7 +64,7 @@ static float zero = 0.0000000000e+00; x = fabsf(x); if(ix==0||ix>=0x7f800000) /* if x is 0 or inf */ b = zero; - else if((float)n<=x) { + else if((float)n<=x) { /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ a = __ieee754_j0f(x); b = __ieee754_j1f(x); @@ -75,7 +75,7 @@ static float zero = 0.0000000000e+00; } } else { if(ix<0x30800000) { /* x < 2**-29 */ - /* x is tiny, return the first Taylor expansion of J(n,x) + /* x is tiny, return the first Taylor expansion of J(n,x) * J(n,x) = 1/n!*(x/2)^n - ... */ if(n>33) /* underflow */ @@ -90,14 +90,14 @@ static float zero = 0.0000000000e+00; } } else { /* use backward recurrence */ - /* x x^2 x^2 + /* x x^2 x^2 * J(n,x)/J(n-1,x) = ---- ------ ------ ..... * 2n - 2(n+1) - 2(n+2) * - * 1 1 1 + * 1 1 1 * (for large x) = ---- ------ ------ ..... * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - + * -- - ------ - ------ - * x x x * * Let w = 2n/x and h=2/x, then the above quotient @@ -113,9 +113,9 @@ static float zero = 0.0000000000e+00; * To determine how many terms needed, let * Q(0) = w, Q(1) = w(w+h) - 1, * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple + * When Q(k) > 1e4 good for single + * When Q(k) > 1e9 good for double + * When Q(k) > 1e17 good for quadruple */ /* determine k */ float t,v; @@ -137,7 +137,7 @@ static float zero = 0.0000000000e+00; * single 8.8722839355e+01 * double 7.09782712893383973096e+02 * long double 1.1356523406294143949491931077970765006170e+04 - * then recurrent value may overflow and the result is + * then recurrent value may overflow and the result is * likely underflow to zero */ tmp = n; @@ -173,9 +173,9 @@ static float zero = 0.0000000000e+00; } #ifdef __STDC__ - float __ieee754_ynf(int n, float x) + float __ieee754_ynf(int n, float x) #else - float __ieee754_ynf(n,x) + float __ieee754_ynf(n,x) int n; float x; #endif { @@ -202,7 +202,7 @@ static float zero = 0.0000000000e+00; b = __ieee754_y1f(x); /* quit if b is -inf */ GET_FLOAT_WORD(ib,b); - for(i=1;i<n&&ib!=0xff800000;i++){ + for(i=1;i<n&&ib!=0xff800000;i++){ temp = b; b = ((float)(i+i)/x)*b - a; GET_FLOAT_WORD(ib,b); diff --git a/lib/msun/src/e_lgamma.c b/lib/msun/src/e_lgamma.c index 04852a2af99c..39de847aa175 100644 --- a/lib/msun/src/e_lgamma.c +++ b/lib/msun/src/e_lgamma.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_lgamma.c,v 1.4 1994/08/10 20:31:05 jtc Exp $"; +static char rcsid[] = "$Id: e_lgamma.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* __ieee754_lgamma(x) diff --git a/lib/msun/src/e_lgamma_r.c b/lib/msun/src/e_lgamma_r.c index 1b8d0c75709b..57b24d414de4 100644 --- a/lib/msun/src/e_lgamma_r.c +++ b/lib/msun/src/e_lgamma_r.c @@ -5,22 +5,22 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_lgamma_r.c,v 1.5 1994/08/10 20:31:07 jtc Exp $"; +static char rcsid[] = "$Id: e_lgamma_r.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* __ieee754_lgamma_r(x, signgamp) - * Reentrant version of the logarithm of the Gamma function - * with user provide pointer for the sign of Gamma(x). + * Reentrant version of the logarithm of the Gamma function + * with user provide pointer for the sign of Gamma(x). * * Method: * 1. Argument Reduction for 0 < x <= 8 - * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may + * Since gamma(1+s)=s*gamma(s), for x in [0,8], we may * reduce x to a number in [1.5,2.5] by * lgamma(1+s) = log(s) + lgamma(s) * for example, @@ -58,36 +58,36 @@ static char rcsid[] = "$Id: e_lgamma_r.c,v 1.5 1994/08/10 20:31:07 jtc Exp $"; * by * 3 5 11 * w = w0 + w1*z + w2*z + w3*z + ... + w6*z - * where + * where * |w - f(z)| < 2**-58.74 - * + * * 4. For negative x, since (G is gamma function) * -x*G(-x)*G(x) = pi/sin(pi*x), * we have * G(x) = pi/(sin(pi*x)*(-x)*G(-x)) * since G(-x) is positive, sign(G(x)) = sign(sin(pi*x)) for x<0 - * Hence, for x<0, signgam = sign(sin(pi*x)) and + * Hence, for x<0, signgam = sign(sin(pi*x)) and * lgamma(x) = log(|Gamma(x)|) * = log(pi/(|x*sin(pi*x)|)) - lgamma(-x); - * Note: one should avoid compute pi*(-x) directly in the + * Note: one should avoid compute pi*(-x) directly in the * computation of sin(pi*(-x)). - * + * * 5. Special Cases * lgamma(2+s) ~ s*(1-Euler) for tiny s * lgamma(1)=lgamma(2)=0 * lgamma(x) ~ -log(x) for tiny x * lgamma(0) = lgamma(inf) = inf * lgamma(-integer) = +-inf - * + * */ #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif two52= 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ half= 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ @@ -200,9 +200,9 @@ static double zero= 0.00000000000000000000e+00; } switch (n) { case 0: y = __kernel_sin(pi*y,zero,0); break; - case 1: + case 1: case 2: y = __kernel_cos(pi*(0.5-y),zero); break; - case 3: + case 3: case 4: y = __kernel_sin(pi*(one-y),zero,0); break; case 5: case 6: y = -__kernel_cos(pi*(y-1.5),zero); break; @@ -275,7 +275,7 @@ static double zero= 0.00000000000000000000e+00; p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); p = z*p1-(tt-w*(p2+y*p3)); r += (tf + p); break; - case 2: + case 2: p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); r += (-0.5*y + p1/p2); @@ -304,7 +304,7 @@ static double zero= 0.00000000000000000000e+00; y = z*z; w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); r = (x-half)*(t-one)+w; - } else + } else /* 2**58 <= x <= inf */ r = x*(__ieee754_log(x)-one); if(hx<0) r = nadj - r; diff --git a/lib/msun/src/e_lgammaf.c b/lib/msun/src/e_lgammaf.c index c65b29b65e66..1d90cdd692a9 100644 --- a/lib/msun/src/e_lgammaf.c +++ b/lib/msun/src/e_lgammaf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_lgammaf.c,v 1.1 1994/08/10 20:31:08 jtc Exp $"; +static char rcsid[] = "$Id: e_lgammaf.c,v 1.1.1.1 1994/08/19 09:39:55 jkh Exp $"; #endif /* __ieee754_lgammaf(x) diff --git a/lib/msun/src/e_lgammaf_r.c b/lib/msun/src/e_lgammaf_r.c index 9765002cc027..2cd8ec8ca9c4 100644 --- a/lib/msun/src/e_lgammaf_r.c +++ b/lib/msun/src/e_lgammaf_r.c @@ -8,22 +8,22 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_lgammaf_r.c,v 1.1 1994/08/10 20:31:09 jtc Exp $"; +static char rcsid[] = "$Id: e_lgammaf_r.c,v 1.1.1.1 1994/08/19 09:39:55 jkh Exp $"; #endif #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif two23= 8.3886080000e+06, /* 0x4b000000 */ half= 5.0000000000e-01, /* 0x3f000000 */ @@ -136,9 +136,9 @@ static float zero= 0.0000000000e+00; } switch (n) { case 0: y = __kernel_sinf(pi*y,zero,0); break; - case 1: + case 1: case 2: y = __kernel_cosf(pi*((float)0.5-y),zero); break; - case 3: + case 3: case 4: y = __kernel_sinf(pi*(one-y),zero,0); break; case 5: case 6: y = -__kernel_cosf(pi*(y-(float)1.5),zero); break; @@ -211,7 +211,7 @@ static float zero= 0.0000000000e+00; p3 = t2+w*(t5+w*(t8+w*(t11+w*t14))); p = z*p1-(tt-w*(p2+y*p3)); r += (tf + p); break; - case 2: + case 2: p1 = y*(u0+y*(u1+y*(u2+y*(u3+y*(u4+y*u5))))); p2 = one+y*(v1+y*(v2+y*(v3+y*(v4+y*v5)))); r += (-(float)0.5*y + p1/p2); @@ -240,7 +240,7 @@ static float zero= 0.0000000000e+00; y = z*z; w = w0+z*(w1+y*(w2+y*(w3+y*(w4+y*(w5+y*w6))))); r = (x-half)*(t-one)+w; - } else + } else /* 2**58 <= x <= inf */ r = x*(__ieee754_logf(x)-one); if(hx<0) r = nadj - r; diff --git a/lib/msun/src/e_log.c b/lib/msun/src/e_log.c index 222152da8738..67e2d216b7fa 100644 --- a/lib/msun/src/e_log.c +++ b/lib/msun/src/e_log.c @@ -5,29 +5,29 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_log.c,v 1.6 1994/08/18 23:05:41 jtc Exp $"; +static char rcsid[] = "$Id: e_log.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* __ieee754_log(x) * Return the logrithm of x * - * Method : - * 1. Argument Reduction: find k and f such that - * x = 2^k * (1+f), + * Method : + * 1. Argument Reduction: find k and f such that + * x = 2^k * (1+f), * where sqrt(2)/2 < 1+f < sqrt(2) . * * 2. Approximation of log(1+f). * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) * = 2s + 2/3 s**3 + 2/5 s**5 + ....., * = 2s + s*R - * We use a special Reme algorithm on [0,0.1716] to generate - * a polynomial of degree 14 to approximate R The maximum error + * We use a special Reme algorithm on [0,0.1716] to generate + * a polynomial of degree 14 to approximate R The maximum error * of this polynomial approximation is bounded by 2**-58.45. In * other words, * 2 4 6 8 10 12 14 @@ -35,22 +35,22 @@ static char rcsid[] = "$Id: e_log.c,v 1.6 1994/08/18 23:05:41 jtc Exp $"; * (the values of Lg1 to Lg7 are listed in the program) * and * | 2 14 | -58.45 - * | Lg1*s +...+Lg7*s - R(z) | <= 2 + * | Lg1*s +...+Lg7*s - R(z) | <= 2 * | | * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. * In order to guarantee error in log below 1ulp, we compute log * by * log(1+f) = f - s*(f - R) (if f is not too large) * log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy) - * - * 3. Finally, log(x) = k*ln2 + log(1+f). + * + * 3. Finally, log(x) = k*ln2 + log(1+f). * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) - * Here ln2 is split into two floating point number: + * Here ln2 is split into two floating point number: * ln2_hi + ln2_lo, * where n*ln2_hi is always exact for |n| < 2000. * * Special cases: - * log(x) is NaN with signal if x < 0 (including -INF) ; + * log(x) is NaN with signal if x < 0 (including -INF) ; * log(+INF) is +INF; log(0) is -INF with signal; * log(NaN) is that NaN with no signal. * @@ -59,9 +59,9 @@ static char rcsid[] = "$Id: e_log.c,v 1.6 1994/08/18 23:05:41 jtc Exp $"; * 1 ulp (unit in the last place). * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -105,12 +105,12 @@ static double zero = 0.0; k=0; if (hx < 0x00100000) { /* x < 2**-1022 */ - if (((hx&0x7fffffff)|lx)==0) + if (((hx&0x7fffffff)|lx)==0) return -two54/zero; /* log(+-0)=-inf */ if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ k -= 54; x *= two54; /* subnormal number, scale up x */ GET_HIGH_WORD(hx,x); - } + } if (hx >= 0x7ff00000) return x+x; k += (hx>>20)-1023; hx &= 0x000fffff; @@ -125,14 +125,14 @@ static double zero = 0.0; if(k==0) return f-R; else {dk=(double)k; return dk*ln2_hi-((R-dk*ln2_lo)-f);} } - s = f/(2.0+f); + s = f/(2.0+f); dk = (double)k; z = s*s; i = hx-0x6147a; w = z*z; j = 0x6b851-hx; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); i |= j; R = t2+t1; if(i>0) { diff --git a/lib/msun/src/e_log10.c b/lib/msun/src/e_log10.c index 69a235653ed6..4f4ed28933fd 100644 --- a/lib/msun/src/e_log10.c +++ b/lib/msun/src/e_log10.c @@ -5,37 +5,37 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_log10.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; +static char rcsid[] = "$Id: e_log10.c,v 1.2 1995/04/07 23:23:23 bde Exp $"; #endif /* __ieee754_log10(x) * Return the base 10 logarithm of x - * + * * Method : * Let log10_2hi = leading 40 bits of log10(2) and * log10_2lo = log10(2) - log10_2hi, * ivln10 = 1/log(10) rounded. * Then - * n = ilogb(x), + * n = ilogb(x), * if(n<0) n = n+1; * x = scalbn(x,-n); * log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x)) * * Note 1: - * To guarantee log10(10**n)=n, where 10**n is normal, the rounding + * To guarantee log10(10**n)=n, where 10**n is normal, the rounding * mode must set to Round-to-Nearest. * Note 2: * [1/log(10)] rounded to 53 bits has error .198 ulps; * log10 is monotonic at all binary break points. * * Special cases: - * log10(x) is NaN with signal if x < 0; + * log10(x) is NaN with signal if x < 0; * log10(+INF) is +INF with no signal; log10(0) is -INF with signal; * log10(NaN) is that NaN with no signal; * log10(10**N) = N for N=0,1,...,22. diff --git a/lib/msun/src/e_log10f.c b/lib/msun/src/e_log10f.c index d493ad8ba780..3caa25abba35 100644 --- a/lib/msun/src/e_log10f.c +++ b/lib/msun/src/e_log10f.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_log10f.c,v 1.1.1.1 1994/08/19 09:39:56 jkh Exp $"; +static char rcsid[] = "$Id: e_log10f.c,v 1.2 1995/04/07 23:23:23 bde Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/e_logf.c b/lib/msun/src/e_logf.c index b18bc7654092..1baef0470b73 100644 --- a/lib/msun/src/e_logf.c +++ b/lib/msun/src/e_logf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_logf.c,v 1.2 1994/08/18 23:05:48 jtc Exp $"; +static char rcsid[] = "$Id: e_logf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" @@ -56,12 +56,12 @@ static float zero = 0.0; k=0; if (ix < 0x00800000) { /* x < 2**-126 */ - if ((ix&0x7fffffff)==0) + if ((ix&0x7fffffff)==0) return -two25/zero; /* log(+-0)=-inf */ if (ix<0) return (x-x)/zero; /* log(-#) = NaN */ k -= 25; x *= two25; /* subnormal number, scale up x */ GET_FLOAT_WORD(ix,x); - } + } if (ix >= 0x7f800000) return x+x; k += (ix>>23)-127; ix &= 0x007fffff; @@ -76,14 +76,14 @@ static float zero = 0.0; if(k==0) return f-R; else {dk=(float)k; return dk*ln2_hi-((R-dk*ln2_lo)-f);} } - s = f/((float)2.0+f); + s = f/((float)2.0+f); dk = (float)k; z = s*s; i = ix-(0x6147a<<3); w = z*z; j = (0x6b851<<3)-ix; - t1= w*(Lg2+w*(Lg4+w*Lg6)); - t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); i |= j; R = t2+t1; if(i>0) { diff --git a/lib/msun/src/e_pow.c b/lib/msun/src/e_pow.c index 80ac795c9d02..8bdc8a862e5f 100644 --- a/lib/msun/src/e_pow.c +++ b/lib/msun/src/e_pow.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_pow.c,v 1.5 1994/08/18 23:05:51 jtc Exp $"; +static char rcsid[] = "$Id: e_pow.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* __ieee754_pow(x,y) return x**y @@ -21,7 +21,7 @@ static char rcsid[] = "$Id: e_pow.c,v 1.5 1994/08/18 23:05:51 jtc Exp $"; * 1. Compute and return log2(x) in two pieces: * log2(x) = w1 + w2, * where w1 has 53-24 = 29 bit trailing zeros. - * 2. Perform y*log2(x) = n+y' by simulating muti-precision + * 2. Perform y*log2(x) = n+y' by simulating muti-precision * arithmetic, where |y'|<=0.5. * 3. Return x**y = 2**n*exp(y'*log2) * @@ -49,13 +49,13 @@ static char rcsid[] = "$Id: e_pow.c,v 1.5 1994/08/18 23:05:51 jtc Exp $"; * Accuracy: * pow(x,y) returns x**y nearly rounded. In particular * pow(integer,integer) - * always returns the correct integer provided it is + * always returns the correct integer provided it is * representable. * * Constants : - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -63,9 +63,9 @@ static char rcsid[] = "$Id: e_pow.c,v 1.5 1994/08/18 23:05:51 jtc Exp $"; #include "math_private.h" #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif bp[] = {1.0, 1.5,}, dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ @@ -117,12 +117,12 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ ix = hx&0x7fffffff; iy = hy&0x7fffffff; /* y==zero: x**0 = 1 */ - if((iy|ly)==0) return one; + if((iy|ly)==0) return one; /* +-NaN return x+y */ if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || - iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) - return x+y; + iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) + return x+y; /* determine if y is an odd int when x < 0 * yisint = 0 ... y is not an integer @@ -130,7 +130,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ * yisint = 2 ... y is an even int */ yisint = 0; - if(hx<0) { + if(hx<0) { if(iy>=0x43400000) yisint = 2; /* even integer y */ else if(iy>=0x3ff00000) { k = (iy>>20)-0x3ff; /* exponent */ @@ -141,11 +141,11 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ j = iy>>(20-k); if((j<<(20-k))==iy) yisint = 2-(j&1); } - } - } + } + } /* special value of y */ - if(ly==0) { + if(ly==0) { if (iy==0x7ff00000) { /* y is +-inf */ if(((ix-0x3ff00000)|lx)==0) return y - y; /* inf**+-1 is NaN */ @@ -153,14 +153,14 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */ return (hy<0)?-y: zero; - } + } if(iy==0x3ff00000) { /* y is +-1 */ if(hy<0) return one/x; else return x; } if(hy==0x40000000) return x*x; /* y is 2 */ if(hy==0x3fe00000) { /* y is 0.5 */ if(hx>=0) /* x >= +0 */ - return sqrt(x); + return sqrt(x); } } @@ -173,13 +173,13 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ if(hx<0) { if(((ix-0x3ff00000)|yisint)==0) { z = (z-z)/(z-z); /* (-1)**non-int is NaN */ - } else if(yisint==1) + } else if(yisint==1) z = -z; /* (x<0)**odd = -(|x|**odd) */ } return z; } } - + /* (x<0)**(non-int) is NaN */ /* CYGNUS LOCAL: This used to be if((((hx>>31)+1)|yisint)==0) return (x-x)/(x-x); @@ -196,7 +196,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ /* over/underflow if x is not close to one */ if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute + /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ t = x-1; /* t has 20 trailing zeros */ w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); @@ -293,7 +293,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ n = ((n&0x000fffff)|0x00100000)>>(20-k); if(j<0) n = -n; p_h -= t; - } + } t = p_l+p_h; SET_LOW_WORD(t,0); u = t*lg2_h; diff --git a/lib/msun/src/e_powf.c b/lib/msun/src/e_powf.c index 2d1ef4a38214..7b268d36fe23 100644 --- a/lib/msun/src/e_powf.c +++ b/lib/msun/src/e_powf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_powf.c,v 1.2 1994/08/18 23:05:54 jtc Exp $"; +static char rcsid[] = "$Id: e_powf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" @@ -74,12 +74,12 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ ix = hx&0x7fffffff; iy = hy&0x7fffffff; /* y==zero: x**0 = 1 */ - if(iy==0) return one; + if(iy==0) return one; /* +-NaN return x+y */ if(ix > 0x7f800000 || iy > 0x7f800000) - return x+y; + return x+y; /* determine if y is an odd int when x < 0 * yisint = 0 ... y is not an integer @@ -87,14 +87,14 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ * yisint = 2 ... y is an even int */ yisint = 0; - if(hx<0) { + if(hx<0) { if(iy>=0x4b800000) yisint = 2; /* even integer y */ else if(iy>=0x3f800000) { k = (iy>>23)-0x7f; /* exponent */ j = iy>>(23-k); if((j<<(23-k))==iy) yisint = 2-(j&1); - } - } + } + } /* special value of y */ if (iy==0x7f800000) { /* y is +-inf */ @@ -104,14 +104,14 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ return (hy>=0)? y: zero; else /* (|x|<1)**-,+inf = inf,0 */ return (hy<0)?-y: zero; - } + } if(iy==0x3f800000) { /* y is +-1 */ if(hy<0) return one/x; else return x; } if(hy==0x40000000) return x*x; /* y is 2 */ if(hy==0x3f000000) { /* y is 0.5 */ if(hx>=0) /* x >= +0 */ - return sqrtf(x); + return sqrtf(x); } ax = fabsf(x); @@ -122,12 +122,12 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ if(hx<0) { if(((ix-0x3f800000)|yisint)==0) { z = (z-z)/(z-z); /* (-1)**non-int is NaN */ - } else if(yisint==1) + } else if(yisint==1) z = -z; /* (x<0)**odd = -(|x|**odd) */ } return z; } - + /* (x<0)**(non-int) is NaN */ if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); @@ -136,7 +136,7 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ /* over/underflow if x is not close to one */ if(ix<0x3f7ffff8) return (hy<0)? huge*huge:tiny*tiny; if(ix>0x3f800007) return (hy>0)? huge*huge:tiny*tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute + /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ t = x-1; /* t has 20 trailing zeros */ w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); @@ -233,7 +233,7 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ n = ((n&0x007fffff)|0x00800000)>>(23-k); if(j<0) n = -n; p_h -= t; - } + } t = p_l+p_h; GET_FLOAT_WORD(is,t); SET_FLOAT_WORD(t,is&0xfffff000); diff --git a/lib/msun/src/e_rem_pio2.c b/lib/msun/src/e_rem_pio2.c index be7cd502f5fb..5b1c3bf26403 100644 --- a/lib/msun/src/e_rem_pio2.c +++ b/lib/msun/src/e_rem_pio2.c @@ -5,18 +5,18 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_rem_pio2.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; +static char rcsid[] = "$Id: e_rem_pio2.c,v 1.2 1995/04/07 23:23:24 bde Exp $"; #endif /* __ieee754_rem_pio2(x,y) - * - * return the remainder of x rem pi/2 in y[0]+y[1] + * + * return the remainder of x rem pi/2 in y[0]+y[1] * use __kernel_rem_pio2() */ @@ -24,24 +24,24 @@ static char rcsid[] = "$Id: e_rem_pio2.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $ #include "math_private.h" /* - * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi + * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi */ #ifdef __STDC__ static const int32_t two_over_pi[] = { #else static int32_t two_over_pi[] = { #endif -0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, -0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, -0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, -0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, -0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, -0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, -0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, -0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, -0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, -0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, -0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, +0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, +0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, +0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, +0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, +0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, +0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, +0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, +0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, +0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, +0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, +0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, }; #ifdef __STDC__ @@ -68,9 +68,9 @@ static int32_t npio2_hw[] = { */ #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ @@ -100,7 +100,7 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ {y[0] = x; y[1] = 0; return 0;} if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ - if(hx>0) { + if(hx>0) { z = x - pio2_1; if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ y[0] = z - pio2_1t; @@ -130,27 +130,27 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ fn = (double)n; r = t-fn*pio2_1; w = fn*pio2_1t; /* 1st round good to 85 bit */ - if(n<32&&ix!=npio2_hw[n-1]) { + if(n<32&&ix!=npio2_hw[n-1]) { y[0] = r-w; /* quick check no cancellation */ } else { u_int32_t high; j = ix>>20; - y[0] = r-w; + y[0] = r-w; GET_HIGH_WORD(high,y[0]); i = j-((high>>20)&0x7ff); if(i>16) { /* 2nd iteration needed, good to 118 */ t = r; - w = fn*pio2_2; + w = fn*pio2_2; r = t-w; - w = fn*pio2_2t-((t-r)-w); + w = fn*pio2_2t-((t-r)-w); y[0] = r-w; GET_HIGH_WORD(high,y[0]); i = j-((high>>20)&0x7ff); if(i>49) { /* 3rd iteration need, 151 bits acc */ t = r; /* will cover all possible cases */ - w = fn*pio2_3; + w = fn*pio2_3; r = t-w; - w = fn*pio2_3t-((t-r)-w); + w = fn*pio2_3t-((t-r)-w); y[0] = r-w; } } @@ -159,7 +159,7 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} else return n; } - /* + /* * all other (large) arguments */ if(ix>=0x7ff00000) { /* x is inf or NaN */ diff --git a/lib/msun/src/e_rem_pio2f.c b/lib/msun/src/e_rem_pio2f.c index 153a8c406db2..98c305fd9f13 100644 --- a/lib/msun/src/e_rem_pio2f.c +++ b/lib/msun/src/e_rem_pio2f.c @@ -8,18 +8,18 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_rem_pio2f.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; +static char rcsid[] = "$Id: e_rem_pio2f.c,v 1.2 1995/04/07 23:23:25 bde Exp $"; #endif /* __ieee754_rem_pio2f(x,y) - * - * return the remainder of x rem pi/2 in y[0]+y[1] + * + * return the remainder of x rem pi/2 in y[0]+y[1] * use __kernel_rem_pio2f() */ @@ -27,7 +27,7 @@ static char rcsid[] = "$Id: e_rem_pio2f.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp #include "math_private.h" /* - * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi + * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi */ #ifdef __STDC__ static const int32_t two_over_pi[] = { @@ -35,27 +35,27 @@ static const int32_t two_over_pi[] = { static int32_t two_over_pi[] = { #endif 0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC, -0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62, +0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62, 0x95, 0x99, 0x3C, 0x43, 0x90, 0x41, 0xFE, 0x51, 0x63, -0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A, +0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A, 0x42, 0x4D, 0xD2, 0xE0, 0x06, 0x49, 0x2E, 0xEA, 0x09, -0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29, +0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29, 0xA7, 0x3E, 0xE8, 0x82, 0x35, 0xF5, 0x2E, 0xBB, 0x44, -0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41, +0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41, 0x39, 0x91, 0xD6, 0x39, 0x83, 0x53, 0x39, 0xF4, 0x9C, -0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8, +0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8, 0x97, 0xFF, 0xDE, 0x05, 0x98, 0x0F, 0xEF, 0x2F, 0x11, -0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF, +0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF, 0x27, 0xCB, 0x09, 0xB7, 0x4F, 0x46, 0x3F, 0x66, 0x9E, -0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5, +0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5, 0xF1, 0x7B, 0x3D, 0x07, 0x39, 0xF7, 0x8A, 0x52, 0x92, -0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08, +0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08, 0x56, 0x03, 0x30, 0x46, 0xFC, 0x7B, 0x6B, 0xAB, 0xF0, -0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3, +0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3, 0x91, 0x61, 0x5E, 0xE6, 0x1B, 0x08, 0x65, 0x99, 0x85, -0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80, +0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80, 0x4D, 0x73, 0x27, 0x31, 0x06, 0x06, 0x15, 0x56, 0xCA, -0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B, +0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B, }; /* This array is like the one in e_rem_pio2.c, but the numbers are @@ -84,9 +84,9 @@ static int32_t npio2_hw[] = { */ #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif zero = 0.0000000000e+00, /* 0x00000000 */ half = 5.0000000000e-01, /* 0x3f000000 */ @@ -115,7 +115,7 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */ if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */ {y[0] = x; y[1] = 0; return 0;} if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */ - if(hx>0) { + if(hx>0) { z = x - pio2_1; if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ y[0] = z - pio2_1t; @@ -145,27 +145,27 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */ fn = (float)n; r = t-fn*pio2_1; w = fn*pio2_1t; /* 1st round good to 40 bit */ - if(n<32&&(ix&0xffffff00)!=npio2_hw[n-1]) { + if(n<32&&(ix&0xffffff00)!=npio2_hw[n-1]) { y[0] = r-w; /* quick check no cancellation */ } else { u_int32_t high; j = ix>>23; - y[0] = r-w; + y[0] = r-w; GET_FLOAT_WORD(high,y[0]); i = j-((high>>23)&0xff); if(i>8) { /* 2nd iteration needed, good to 57 */ t = r; - w = fn*pio2_2; + w = fn*pio2_2; r = t-w; - w = fn*pio2_2t-((t-r)-w); + w = fn*pio2_2t-((t-r)-w); y[0] = r-w; GET_FLOAT_WORD(high,y[0]); i = j-((high>>23)&0xff); if(i>25) { /* 3rd iteration need, 74 bits acc */ t = r; /* will cover all possible cases */ - w = fn*pio2_3; + w = fn*pio2_3; r = t-w; - w = fn*pio2_3t-((t-r)-w); + w = fn*pio2_3t-((t-r)-w); y[0] = r-w; } } @@ -174,7 +174,7 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */ if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} else return n; } - /* + /* * all other (large) arguments */ if(ix>=0x7f800000) { /* x is inf or NaN */ diff --git a/lib/msun/src/e_remainder.c b/lib/msun/src/e_remainder.c index cf82a49f3a5f..430418d2ea2f 100644 --- a/lib/msun/src/e_remainder.c +++ b/lib/msun/src/e_remainder.c @@ -5,21 +5,21 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_remainder.c,v 1.6 1994/08/18 23:06:00 jtc Exp $"; +static char rcsid[] = "$Id: e_remainder.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* __ieee754_remainder(x,p) - * Return : - * returns x REM p = x - [x/p]*p as if in infinite - * precise arithmetic, where [x/p] is the (infinite bit) + * Return : + * returns x REM p = x - [x/p]*p as if in infinite + * precise arithmetic, where [x/p] is the (infinite bit) * integer nearest x/p (in half way case choose the even one). - * Method : + * Method : * Based on fmod() return x-[x/p]chopped*p exactlp. */ diff --git a/lib/msun/src/e_remainderf.c b/lib/msun/src/e_remainderf.c index 966b2165a7b3..cc66ba454aec 100644 --- a/lib/msun/src/e_remainderf.c +++ b/lib/msun/src/e_remainderf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_remainderf.c,v 1.2 1994/08/18 23:06:02 jtc Exp $"; +static char rcsid[] = "$Id: e_remainderf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/e_scalb.c b/lib/msun/src/e_scalb.c index 32a2703d2ce0..1000bc7e1de0 100644 --- a/lib/msun/src/e_scalb.c +++ b/lib/msun/src/e_scalb.c @@ -5,18 +5,18 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_scalb.c,v 1.4 1994/08/10 20:31:26 jtc Exp $"; +static char rcsid[] = "$Id: e_scalb.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* * __ieee754_scalb(x, fn) is provide for - * passing various standard test suite. One + * passing various standard test suite. One * should use scalbn() instead. */ diff --git a/lib/msun/src/e_scalbf.c b/lib/msun/src/e_scalbf.c index 6906c24d8359..0dff855c37c2 100644 --- a/lib/msun/src/e_scalbf.c +++ b/lib/msun/src/e_scalbf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_scalbf.c,v 1.1 1994/08/10 20:31:27 jtc Exp $"; +static char rcsid[] = "$Id: e_scalbf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/e_sinh.c b/lib/msun/src/e_sinh.c index f39019c06297..9f68f4365d0b 100644 --- a/lib/msun/src/e_sinh.c +++ b/lib/msun/src/e_sinh.c @@ -5,25 +5,25 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_sinh.c,v 1.5 1994/08/18 23:06:03 jtc Exp $"; +static char rcsid[] = "$Id: e_sinh.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* __ieee754_sinh(x) - * Method : + * Method : * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2 - * 1. Replace x by |x| (sinh(-x) = -sinh(x)). - * 2. + * 1. Replace x by |x| (sinh(-x) = -sinh(x)). + * 2. * E + E/(E+1) * 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x) * 2 * - * 22 <= x <= lnovft : sinh(x) := exp(x)/2 + * 22 <= x <= lnovft : sinh(x) := exp(x)/2 * lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2) * ln2ovft < x : sinh(x) := x*shuge (overflow) * @@ -47,7 +47,7 @@ static double one = 1.0, shuge = 1.0e307; double __ieee754_sinh(x) double x; #endif -{ +{ double t,w,h; int32_t ix,jx; u_int32_t lx; @@ -57,7 +57,7 @@ static double one = 1.0, shuge = 1.0e307; ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7ff00000) return x+x; + if(ix>=0x7ff00000) return x+x; h = 0.5; if (jx<0) h = -h; diff --git a/lib/msun/src/e_sinhf.c b/lib/msun/src/e_sinhf.c index 5c064403373e..9c6e45bed155 100644 --- a/lib/msun/src/e_sinhf.c +++ b/lib/msun/src/e_sinhf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_sinhf.c,v 1.2 1994/08/18 23:06:04 jtc Exp $"; +static char rcsid[] = "$Id: e_sinhf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" @@ -32,7 +32,7 @@ static float one = 1.0, shuge = 1.0e37; float __ieee754_sinhf(x) float x; #endif -{ +{ float t,w,h; int32_t ix,jx; @@ -40,7 +40,7 @@ static float one = 1.0, shuge = 1.0e37; ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7f800000) return x+x; + if(ix>=0x7f800000) return x+x; h = 0.5; if (jx<0) h = -h; diff --git a/lib/msun/src/e_sqrt.c b/lib/msun/src/e_sqrt.c index 257f498ba746..d805e33ab867 100644 --- a/lib/msun/src/e_sqrt.c +++ b/lib/msun/src/e_sqrt.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_sqrt.c,v 1.6 1994/08/18 23:06:06 jtc Exp $"; +static char rcsid[] = "$Id: e_sqrt.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* __ieee754_sqrt(x) @@ -19,10 +19,10 @@ static char rcsid[] = "$Id: e_sqrt.c,v 1.6 1994/08/18 23:06:06 jtc Exp $"; * ------------------------------------------ * | Use the hardware sqrt if you have one | * ------------------------------------------ - * Method: - * Bit by bit method using integer arithmetic. (Slow, but portable) + * Method: + * Bit by bit method using integer arithmetic. (Slow, but portable) * 1. Normalization - * Scale x to y in [1,4) with even powers of 2: + * Scale x to y in [1,4) with even powers of 2: * find an integer k such that 1 <= (y=x*2^(2k)) < 4, then * sqrt(x) = 2^k * sqrt(y) * 2. Bit by bit computation @@ -31,9 +31,9 @@ static char rcsid[] = "$Id: e_sqrt.c,v 1.6 1994/08/18 23:06:06 jtc Exp $"; * i+1 2 * s = 2*q , and y = 2 * ( y - q ). (1) * i i i i - * - * To compute q from q , one checks whether - * i+1 i + * + * To compute q from q , one checks whether + * i+1 i * * -(i+1) 2 * (q + 2 ) <= y. (2) @@ -43,12 +43,12 @@ static char rcsid[] = "$Id: e_sqrt.c,v 1.6 1994/08/18 23:06:06 jtc Exp $"; * i+1 i i+1 i * * With some algebric manipulation, it is not difficult to see - * that (2) is equivalent to + * that (2) is equivalent to * -(i+1) * s + 2 <= y (3) * i i * - * The advantage of (3) is that s and y can be computed by + * The advantage of (3) is that s and y can be computed by * i i * the following recurrence formula: * if (3) is false @@ -60,10 +60,10 @@ static char rcsid[] = "$Id: e_sqrt.c,v 1.6 1994/08/18 23:06:06 jtc Exp $"; * -i -(i+1) * s = s + 2 , y = y - s - 2 (5) * i+1 i i+1 i i - * - * One may easily use induction to prove (4) and (5). + * + * One may easily use induction to prove (4) and (5). * Note. Since the left hand side of (3) contain only i+2 bits, - * it does not necessary to do a full (53-bit) comparison + * it does not necessary to do a full (53-bit) comparison * in (3). * 3. Final rounding * After generating the 53 bits result, we compute one more bit. @@ -73,7 +73,7 @@ static char rcsid[] = "$Id: e_sqrt.c,v 1.6 1994/08/18 23:06:06 jtc Exp $"; * The rounding mode can be detected by checking whether * huge + tiny is equal to huge, and whether huge - tiny is * equal to huge for some floating point number "huge" and "tiny". - * + * * Special cases: * sqrt(+-0) = +-0 ... exact * sqrt(inf) = inf @@ -101,17 +101,17 @@ static double one = 1.0, tiny=1.0e-300; #endif { double z; - int32_t sign = (int)0x80000000; + int32_t sign = (int)0x80000000; int32_t ix0,s0,q,m,t,i; u_int32_t r,t1,s1,ix1,q1; EXTRACT_WORDS(ix0,ix1,x); /* take care of Inf and NaN */ - if((ix0&0x7ff00000)==0x7ff00000) { + if((ix0&0x7ff00000)==0x7ff00000) { return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf sqrt(-inf)=sNaN */ - } + } /* take care of zero */ if(ix0<=0) { if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ @@ -145,12 +145,12 @@ static double one = 1.0, tiny=1.0e-300; r = 0x00200000; /* r = moving bit from right to left */ while(r!=0) { - t = s0+r; - if(t<=ix0) { - s0 = t+r; - ix0 -= t; - q += r; - } + t = s0+r; + if(t<=ix0) { + s0 = t+r; + ix0 -= t; + q += r; + } ix0 += ix0 + ((ix1&sign)>>31); ix1 += ix1; r>>=1; @@ -158,9 +158,9 @@ static double one = 1.0, tiny=1.0e-300; r = sign; while(r!=0) { - t1 = s1+r; + t1 = s1+r; t = s0; - if((t<ix0)||((t==ix0)&&(t1<=ix1))) { + if((t<ix0)||((t==ix0)&&(t1<=ix1))) { s1 = t1+r; if(((t1&sign)==sign)&&(s1&sign)==0) s0 += 1; ix0 -= t; @@ -181,7 +181,7 @@ static double one = 1.0, tiny=1.0e-300; if (q1==(u_int32_t)0xffffffff) { q1=0; q += 1;} else if (z>one) { if (q1==(u_int32_t)0xfffffffe) q+=1; - q1+=2; + q1+=2; } else q1 += (q1&1); } @@ -197,18 +197,18 @@ static double one = 1.0, tiny=1.0e-300; /* Other methods (use floating-point arithmetic) ------------- -(This is a copy of a drafted paper by Prof W. Kahan +(This is a copy of a drafted paper by Prof W. Kahan and K.C. Ng, written in May, 1986) - Two algorithms are given here to implement sqrt(x) + Two algorithms are given here to implement sqrt(x) (IEEE double precision arithmetic) in software. Both supply sqrt(x) correctly rounded. The first algorithm (in Section A) uses newton iterations and involves four divisions. The second one uses reciproot iterations to avoid division, but requires more multiplications. Both algorithms need the ability - to chop results of arithmetic operations instead of round them, + to chop results of arithmetic operations instead of round them, and the INEXACT flag to indicate when an arithmetic operation - is executed exactly with no roundoff error, all part of the + is executed exactly with no roundoff error, all part of the standard (IEEE 754-1985). The ability to perform shift, add, subtract and logical AND operations upon 32-bit words is needed too, though not part of the standard. @@ -218,7 +218,7 @@ A. sqrt(x) by Newton Iteration (1) Initial approximation Let x0 and x1 be the leading and the trailing 32-bit words of - a floating point number x (in IEEE double format) respectively + a floating point number x (in IEEE double format) respectively 1 11 52 ...widths ------------------------------------------------------ @@ -226,7 +226,7 @@ A. sqrt(x) by Newton Iteration ------------------------------------------------------ msb lsb msb lsb ...order - + ------------------------ ------------------------ x0: |s| e | f1 | x1: | f2 | ------------------------ ------------------------ @@ -251,7 +251,7 @@ A. sqrt(x) by Newton Iteration (2) Iterative refinement - Apply Heron's rule three times to y, we have y approximates + Apply Heron's rule three times to y, we have y approximates sqrt(x) to within 1 ulp (Unit in the Last Place): y := (y+x/y)/2 ... almost 17 sig. bits @@ -276,12 +276,12 @@ A. sqrt(x) by Newton Iteration it requires more multiplications and additions. Also x must be scaled in advance to avoid spurious overflow in evaluating the expression 3y*y+x. Hence it is not recommended uless division - is slow. If division is very slow, then one should use the + is slow. If division is very slow, then one should use the reciproot algorithm given in section B. (3) Final adjustment - By twiddling y's last bit it is possible to force y to be + By twiddling y's last bit it is possible to force y to be correctly rounded according to the prevailing rounding mode as follows. Let r and i be copies of the rounding mode and inexact flag before entering the square root program. Also we @@ -312,7 +312,7 @@ A. sqrt(x) by Newton Iteration I := i; ... restore inexact flag R := r; ... restore rounded mode return sqrt(x):=y. - + (4) Special cases Square root of +inf, +-0, or NaN is itself; @@ -331,7 +331,7 @@ B. sqrt(x) by Reciproot Iteration k := 0x5fe80000 - (x0>>1); y0:= k - T2[63&(k>>14)]. ... y ~ 1/sqrt(x) to 7.8 bits - Here k is a 32-bit integer and T2[] is an integer array + Here k is a 32-bit integer and T2[] is an integer array containing correction terms. Now magically the floating value of y (y's leading 32-bit word is y0, the value of its trailing word y1 is set to zero) approximates 1/sqrt(x) @@ -352,9 +352,9 @@ B. sqrt(x) by Reciproot Iteration Apply Reciproot iteration three times to y and multiply the result by x to get an approximation z that matches sqrt(x) - to about 1 ulp. To be exact, we will have + to about 1 ulp. To be exact, we will have -1ulp < sqrt(x)-z<1.0625ulp. - + ... set rounding mode to Round-to-nearest y := y*(1.5-0.5*x*y*y) ... almost 15 sig. bits to 1/sqrt(x) y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x) @@ -363,14 +363,14 @@ B. sqrt(x) by Reciproot Iteration z := z + 0.5*z*(1-z*y) ... about 1 ulp to sqrt(x) Remark 2. The constant 1.5-2^-30 is chosen to bias the error so that - (a) the term z*y in the final iteration is always less than 1; + (a) the term z*y in the final iteration is always less than 1; (b) the error in the final result is biased upward so that -1 ulp < sqrt(x) - z < 1.0625 ulp instead of |sqrt(x)-z|<1.03125ulp. (3) Final adjustment - By twiddling y's last bit it is possible to force y to be + By twiddling y's last bit it is possible to force y to be correctly rounded according to the prevailing rounding mode as follows. Let r and i be copies of the rounding mode and inexact flag before entering the square root program. Also we @@ -410,27 +410,27 @@ B. sqrt(x) by Reciproot Iteration I := 1; ... Raise Inexact flag: z is not exact else { j := 1 - [(x0>>20)&1] ... j = logb(x) mod 2 - k := z1 >> 26; ... get z's 25-th and 26-th + k := z1 >> 26; ... get z's 25-th and 26-th fraction bits I := i or (k&j) or ((k&(j+j+1))!=(x1&3)); } R:= r ... restore rounded mode return sqrt(x):=z. - If multiplication is cheaper then the foregoing red tape, the + If multiplication is cheaper then the foregoing red tape, the Inexact flag can be evaluated by I := i; I := (z*z!=x) or I. - Note that z*z can overwrite I; this value must be sensed if it is + Note that z*z can overwrite I; this value must be sensed if it is True. Remark 4. If z*z = x exactly, then bit 25 to bit 0 of z1 must be zero. -------------------- - z1: | f2 | + z1: | f2 | -------------------- bit 31 bit 0 @@ -447,7 +447,7 @@ B. sqrt(x) by Reciproot Iteration 11 01 even ------------------------------------------------- - (4) Special cases (see (4) of Section A). - + (4) Special cases (see (4) of Section A). + */ - + diff --git a/lib/msun/src/e_sqrtf.c b/lib/msun/src/e_sqrtf.c index 28a9428fe6d0..a4cb172e1bdc 100644 --- a/lib/msun/src/e_sqrtf.c +++ b/lib/msun/src/e_sqrtf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: e_sqrtf.c,v 1.2 1994/08/18 23:06:07 jtc Exp $"; +static char rcsid[] = "$Id: e_sqrtf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" @@ -34,17 +34,17 @@ static float one = 1.0, tiny=1.0e-30; #endif { float z; - int32_t sign = (int)0x80000000; + int32_t sign = (int)0x80000000; int32_t ix,s,q,m,t,i; u_int32_t r; GET_FLOAT_WORD(ix,x); /* take care of Inf and NaN */ - if((ix&0x7f800000)==0x7f800000) { + if((ix&0x7f800000)==0x7f800000) { return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf sqrt(-inf)=sNaN */ - } + } /* take care of zero */ if(ix<=0) { if((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */ @@ -69,12 +69,12 @@ static float one = 1.0, tiny=1.0e-30; r = 0x01000000; /* r = moving bit from right to left */ while(r!=0) { - t = s+r; - if(t<=ix) { - s = t+r; - ix -= t; - q += r; - } + t = s+r; + if(t<=ix) { + s = t+r; + ix -= t; + q += r; + } ix += ix; r>>=1; } diff --git a/lib/msun/src/k_cos.c b/lib/msun/src/k_cos.c index 12600116e9da..57ebe6219613 100644 --- a/lib/msun/src/k_cos.c +++ b/lib/msun/src/k_cos.c @@ -5,20 +5,20 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: k_cos.c,v 1.6 1994/08/18 23:06:08 jtc Exp $"; +static char rcsid[] = "$Id: k_cos.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $"; #endif /* * __kernel_cos( x, y ) * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 * Input x is assumed to be bounded by ~pi/4 in magnitude. - * Input y is the tail of x. + * Input y is the tail of x. * * Algorithm * 1. Since cos(-x) = cos(x), we need only to consider positive x. @@ -28,15 +28,15 @@ static char rcsid[] = "$Id: k_cos.c,v 1.6 1994/08/18 23:06:08 jtc Exp $"; * 4 14 * cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x * where the remez error is - * + * * | 2 4 6 8 10 12 14 | -58 * |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x +C6*x )| <= 2 - * | | - * - * 4 6 8 10 12 14 + * | | + * + * 4 6 8 10 12 14 * 4. let r = C1*x +C2*x +C3*x +C4*x +C5*x +C6*x , then * cos(x) = 1 - x*x/2 + r - * since cos(x+y) ~ cos(x) - sin(x)*y + * since cos(x+y) ~ cos(x) - sin(x)*y * ~ cos(x) - x*y, * a correction term is necessary in cos(x) and hence * cos(x+y) = 1 - (x*x/2 - (r - x*y)) @@ -53,9 +53,9 @@ static char rcsid[] = "$Id: k_cos.c,v 1.6 1994/08/18 23:06:08 jtc Exp $"; #include "math_private.h" #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ @@ -81,7 +81,7 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ } z = x*x; r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); - if(ix < 0x3FD33333) /* if |x| < 0.3 */ + if(ix < 0x3FD33333) /* if |x| < 0.3 */ return one - (0.5*z - (z*r - x*y)); else { if(ix > 0x3fe90000) { /* x > 0.78125 */ diff --git a/lib/msun/src/k_cosf.c b/lib/msun/src/k_cosf.c index 9a2b83b922d9..09e2ff72cc2e 100644 --- a/lib/msun/src/k_cosf.c +++ b/lib/msun/src/k_cosf.c @@ -8,22 +8,22 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: k_cosf.c,v 1.2 1994/08/18 23:06:10 jtc Exp $"; +static char rcsid[] = "$Id: k_cosf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif one = 1.0000000000e+00, /* 0x3f800000 */ C1 = 4.1666667908e-02, /* 0x3d2aaaab */ @@ -49,7 +49,7 @@ C6 = -1.1359647598e-11; /* 0xad47d74e */ } z = x*x; r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); - if(ix < 0x3e99999a) /* if |x| < 0.3 */ + if(ix < 0x3e99999a) /* if |x| < 0.3 */ return one - ((float)0.5*z - (z*r - x*y)); else { if(ix > 0x3f480000) { /* x > 0.78125 */ diff --git a/lib/msun/src/k_rem_pio2.c b/lib/msun/src/k_rem_pio2.c index b4611fe2230e..25faf35f40ea 100644 --- a/lib/msun/src/k_rem_pio2.c +++ b/lib/msun/src/k_rem_pio2.c @@ -5,24 +5,24 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: k_rem_pio2.c,v 1.5 1994/08/18 23:06:11 jtc Exp $"; +static char rcsid[] = "$Id: k_rem_pio2.c,v 1.1.1.1 1994/08/19 09:39:45 jkh Exp $"; #endif /* * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) * double x[],y[]; int e0,nx,prec; int ipio2[]; - * - * __kernel_rem_pio2 return the last three digits of N with + * + * __kernel_rem_pio2 return the last three digits of N with * y = x - N*pi/2 * so that |y| < pi/2. * - * The method is to compute the integer (mod 8) and fraction parts of + * The method is to compute the integer (mod 8) and fraction parts of * (2/pi)*x without doing the full multiplication. In general we * skip the part of the product that are known to be a huge integer ( * more accurately, = 0 mod 8 ). Thus the number of operations are @@ -31,10 +31,10 @@ static char rcsid[] = "$Id: k_rem_pio2.c,v 1.5 1994/08/18 23:06:11 jtc Exp $"; * (2/pi) is represented by an array of 24-bit integers in ipio2[]. * * Input parameters: - * x[] The input value (must be positive) is broken into nx + * x[] The input value (must be positive) is broken into nx * pieces of 24-bit integers in double precision format. - * x[i] will be the i-th 24 bit of x. The scaled exponent - * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 + * x[i] will be the i-th 24 bit of x. The scaled exponent + * of x[0] is given in input parameter e0 (i.e., x[0]*2^e0 * match x's up to 24 bits. * * Example of breaking a double positive z into x[0]+x[1]+x[2]: @@ -71,8 +71,8 @@ static char rcsid[] = "$Id: k_rem_pio2.c,v 1.5 1994/08/18 23:06:11 jtc Exp $"; * 3 113 bits (quad) * * ipio2[] - * integer array, contains the (24*i)-th to (24*i+23)-th - * bit of 2/pi after binary point. The corresponding + * integer array, contains the (24*i)-th to (24*i+23)-th + * bit of 2/pi after binary point. The corresponding * floating value is * * ipio2[i] * 2^(-24(i+1)). @@ -87,8 +87,8 @@ static char rcsid[] = "$Id: k_rem_pio2.c,v 1.5 1994/08/18 23:06:11 jtc Exp $"; * in the computation. The recommended value is 2,3,4, * 6 for single, double, extended,and quad. * - * jz local integer variable indicating the number of - * terms of ipio2[] used. + * jz local integer variable indicating the number of + * terms of ipio2[] used. * * jx nx - 1 * @@ -108,9 +108,9 @@ static char rcsid[] = "$Id: k_rem_pio2.c,v 1.5 1994/08/18 23:06:11 jtc Exp $"; * exponent for q[i] would be q0-24*i. * * PIo2[] double precision array, obtained by cutting pi/2 - * into 24 bits chunks. + * into 24 bits chunks. * - * f[] ipio2[] in floating point + * f[] ipio2[] in floating point * * iq[] integer array by breaking up q[] in 24-bits chunk. * @@ -124,9 +124,9 @@ static char rcsid[] = "$Id: k_rem_pio2.c,v 1.5 1994/08/18 23:06:11 jtc Exp $"; /* * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -136,7 +136,7 @@ static char rcsid[] = "$Id: k_rem_pio2.c,v 1.5 1994/08/18 23:06:11 jtc Exp $"; #ifdef __STDC__ static const int init_jk[] = {2,3,4,6}; /* initial value for jk */ #else -static int init_jk[] = {2,3,4,6}; +static int init_jk[] = {2,3,4,6}; #endif #ifdef __STDC__ @@ -155,9 +155,9 @@ static double PIo2[] = { }; #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif zero = 0.0, one = 1.0, @@ -165,9 +165,9 @@ two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ #ifdef __STDC__ - int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2) + int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2) #else - int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) + int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) double x[], y[]; int e0,nx,prec; int32_t ipio2[]; #endif { @@ -211,7 +211,7 @@ recompute: i = (iq[jz-1]>>(24-q0)); n += i; iq[jz-1] -= i<<(24-q0); ih = iq[jz-1]>>(23-q0); - } + } else if(q0==0) ih = iq[jz-1]>>23; else if(z>=0.5) ih=2; @@ -262,7 +262,7 @@ recompute: while(iq[jz]==0) { jz--; q0-=24;} } else { /* break z into 24-bit if necessary */ z = scalbn(z,-q0); - if(z>=two24) { + if(z>=two24) { fw = (double)((int32_t)(twon24*z)); iq[jz] = (int32_t)(z-two24*fw); jz += 1; q0 += 24; @@ -287,29 +287,29 @@ recompute: case 0: fw = 0.0; for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; + y[0] = (ih==0)? fw: -fw; break; case 1: case 2: fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; fw = fq[0]-fw; for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; + y[1] = (ih==0)? fw: -fw; break; case 3: /* painful */ for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; + fw = fq[i-1]+fq[i]; fq[i] += fq[i-1]-fw; fq[i-1] = fw; } for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; + fw = fq[i-1]+fq[i]; fq[i] += fq[i-1]-fw; fq[i-1] = fw; } - for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; if(ih==0) { y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; } else { diff --git a/lib/msun/src/k_rem_pio2f.c b/lib/msun/src/k_rem_pio2f.c index c243a56a590b..10615386eb81 100644 --- a/lib/msun/src/k_rem_pio2f.c +++ b/lib/msun/src/k_rem_pio2f.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: k_rem_pio2f.c,v 1.2 1994/08/18 23:06:12 jtc Exp $"; +static char rcsid[] = "$Id: k_rem_pio2f.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" @@ -26,7 +26,7 @@ static char rcsid[] = "$Id: k_rem_pio2f.c,v 1.2 1994/08/18 23:06:12 jtc Exp $"; #ifdef __STDC__ static const int init_jk[] = {4,7,9}; /* initial value for jk */ #else -static int init_jk[] = {4,7,9}; +static int init_jk[] = {4,7,9}; #endif #ifdef __STDC__ @@ -48,9 +48,9 @@ static float PIo2[] = { }; #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif zero = 0.0, one = 1.0, @@ -58,9 +58,9 @@ two8 = 2.5600000000e+02, /* 0x43800000 */ twon8 = 3.9062500000e-03; /* 0x3b800000 */ #ifdef __STDC__ - int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32_t *ipio2) + int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32_t *ipio2) #else - int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2) + int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2) float x[], y[]; int e0,nx,prec; int32_t ipio2[]; #endif { @@ -104,7 +104,7 @@ recompute: i = (iq[jz-1]>>(8-q0)); n += i; iq[jz-1] -= i<<(8-q0); ih = iq[jz-1]>>(7-q0); - } + } else if(q0==0) ih = iq[jz-1]>>8; else if(z>=(float)0.5) ih=2; @@ -155,7 +155,7 @@ recompute: while(iq[jz]==0) { jz--; q0-=8;} } else { /* break z into 8-bit if necessary */ z = scalbnf(z,-q0); - if(z>=two8) { + if(z>=two8) { fw = (float)((int32_t)(twon8*z)); iq[jz] = (int32_t)(z-two8*fw); jz += 1; q0 += 8; @@ -180,29 +180,29 @@ recompute: case 0: fw = 0.0; for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; + y[0] = (ih==0)? fw: -fw; break; case 1: case 2: fw = 0.0; - for (i=jz;i>=0;i--) fw += fq[i]; - y[0] = (ih==0)? fw: -fw; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; fw = fq[0]-fw; for (i=1;i<=jz;i++) fw += fq[i]; - y[1] = (ih==0)? fw: -fw; + y[1] = (ih==0)? fw: -fw; break; case 3: /* painful */ for (i=jz;i>0;i--) { - fw = fq[i-1]+fq[i]; + fw = fq[i-1]+fq[i]; fq[i] += fq[i-1]-fw; fq[i-1] = fw; } for (i=jz;i>1;i--) { - fw = fq[i-1]+fq[i]; + fw = fq[i-1]+fq[i]; fq[i] += fq[i-1]-fw; fq[i-1] = fw; } - for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; if(ih==0) { y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; } else { diff --git a/lib/msun/src/k_sin.c b/lib/msun/src/k_sin.c index f0229014f8dd..394df9276811 100644 --- a/lib/msun/src/k_sin.c +++ b/lib/msun/src/k_sin.c @@ -5,37 +5,37 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: k_sin.c,v 1.6 1994/08/18 23:06:14 jtc Exp $"; +static char rcsid[] = "$Id: k_sin.c,v 1.1.1.1 1994/08/19 09:39:45 jkh Exp $"; #endif /* __kernel_sin( x, y, iy) * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854 * Input x is assumed to be bounded by ~pi/4 in magnitude. * Input y is the tail of x. - * Input iy indicates whether y is 0. (if iy=0, y assume to be 0). + * Input iy indicates whether y is 0. (if iy=0, y assume to be 0). * * Algorithm - * 1. Since sin(-x) = -sin(x), we need only to consider positive x. + * 1. Since sin(-x) = -sin(x), we need only to consider positive x. * 2. if x < 2^-27 (hx<0x3e400000 0), return x with inexact if x!=0. * 3. sin(x) is approximated by a polynomial of degree 13 on * [0,pi/4] * 3 13 * sin(x) ~ x + S1*x + ... + S6*x * where - * + * * |sin(x) 2 4 6 8 10 12 | -58 * |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x +S6*x )| <= 2 - * | x | - * + * | x | + * * 4. sin(x+y) = sin(x) + sin'(x')*y * ~ sin(x) + (1-x*x/2)*y - * For better accuracy, let + * For better accuracy, let * 3 2 2 2 2 * r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6)))) * then 3 2 @@ -46,9 +46,9 @@ static char rcsid[] = "$Id: k_sin.c,v 1.6 1994/08/18 23:06:14 jtc Exp $"; #include "math_private.h" #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ diff --git a/lib/msun/src/k_sinf.c b/lib/msun/src/k_sinf.c index ad19fb484306..b7c3db935dde 100644 --- a/lib/msun/src/k_sinf.c +++ b/lib/msun/src/k_sinf.c @@ -8,22 +8,22 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: k_sinf.c,v 1.2 1994/08/18 23:06:15 jtc Exp $"; +static char rcsid[] = "$Id: k_sinf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif half = 5.0000000000e-01,/* 0x3f000000 */ S1 = -1.6666667163e-01, /* 0xbe2aaaab */ diff --git a/lib/msun/src/k_standard.c b/lib/msun/src/k_standard.c index aa01a796e4f8..d32362e386b8 100644 --- a/lib/msun/src/k_standard.c +++ b/lib/msun/src/k_standard.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: k_standard.c,v 1.4 1994/08/10 20:31:44 jtc Exp $"; +static char rcsid[] = "$Id: k_standard.c,v 1.1.1.1 1994/08/19 09:39:45 jkh Exp $"; #endif #include "math.h" @@ -33,7 +33,7 @@ static const double zero = 0.0; /* used as const */ static double zero = 0.0; /* used as const */ #endif -/* +/* * Standard conformance (non-IEEE) on exception cases. * Mapping: * 1 -- acos(|x|>1) @@ -58,7 +58,7 @@ static double zero = 0.0; /* used as const */ * 20-- pow(0.0,0.0) * 21-- pow(x,y) overflow * 22-- pow(x,y) underflow - * 23-- pow(0,negative) + * 23-- pow(0,negative) * 24-- pow(neg,non-integral) * 25-- sinh(finite) overflow * 26-- sqrt(negative) @@ -82,14 +82,14 @@ static double zero = 0.0; /* used as const */ #ifdef __STDC__ - double __kernel_standard(double x, double y, int type) + double __kernel_standard(double x, double y, int type) #else - double __kernel_standard(x,y,type) + double __kernel_standard(x,y,type) double x,y; int type; #endif { struct exception exc; -#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */ +#ifndef HUGE_VAL /* this is the only routine that uses HUGE_VAL */ #define HUGE_VAL inf double inf = 0.0; @@ -469,7 +469,7 @@ static double zero = 0.0; /* used as const */ /* 0**neg */ exc.type = DOMAIN; exc.name = type < 100 ? "pow" : "powf"; - if (_LIB_VERSION == _SVID_) + if (_LIB_VERSION == _SVID_) exc.retval = zero; else exc.retval = -HUGE_VAL; @@ -487,11 +487,11 @@ static double zero = 0.0; /* used as const */ /* neg**non-integral */ exc.type = DOMAIN; exc.name = type < 100 ? "pow" : "powf"; - if (_LIB_VERSION == _SVID_) + if (_LIB_VERSION == _SVID_) exc.retval = zero; - else + else exc.retval = zero/zero; /* X/Open allow NaN */ - if (_LIB_VERSION == _POSIX_) + if (_LIB_VERSION == _POSIX_) errno = EDOM; else if (!matherr(&exc)) { if (_LIB_VERSION == _SVID_) { @@ -649,7 +649,7 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 35: case 135: @@ -665,7 +665,7 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 36: case 136: @@ -681,7 +681,7 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 37: case 137: @@ -697,7 +697,7 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 38: case 138: @@ -713,7 +713,7 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 39: case 139: @@ -729,7 +729,7 @@ static double zero = 0.0; /* used as const */ (void) WRITE2(": TLOSS error\n", 14); } errno = ERANGE; - } + } break; case 40: case 140: @@ -778,5 +778,5 @@ static double zero = 0.0; /* used as const */ } break; } - return exc.retval; + return exc.retval; } diff --git a/lib/msun/src/k_tan.c b/lib/msun/src/k_tan.c index 27abc1ca80bd..d5851cf2f0f8 100644 --- a/lib/msun/src/k_tan.c +++ b/lib/msun/src/k_tan.c @@ -5,38 +5,38 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: k_tan.c,v 1.6 1994/08/18 23:06:16 jtc Exp $"; +static char rcsid[] = "$Id: k_tan.c,v 1.1.1.1 1994/08/19 09:39:45 jkh Exp $"; #endif /* __kernel_tan( x, y, k ) * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 * Input x is assumed to be bounded by ~pi/4 in magnitude. * Input y is the tail of x. - * Input k indicates whether tan (if k=1) or + * Input k indicates whether tan (if k=1) or * -1/tan (if k= -1) is returned. * * Algorithm - * 1. Since tan(-x) = -tan(x), we need only to consider positive x. + * 1. Since tan(-x) = -tan(x), we need only to consider positive x. * 2. if x < 2^-28 (hx<0x3e300000 0), return x with inexact if x!=0. * 3. tan(x) is approximated by a odd polynomial of degree 27 on * [0,0.67434] * 3 27 * tan(x) ~ x + T1*x + ... + T13*x * where - * + * * |tan(x) 2 4 26 | -59.2 * |----- - (1+T1*x +T2*x +.... +T13*x )| <= 2 - * | x | - * + * | x | + * * Note: tan(x+y) = tan(x) + tan'(x)*y * ~ tan(x) + (1+x*x)*y - * Therefore, for better accuracy in computing tan(x+y), let + * Therefore, for better accuracy in computing tan(x+y), let * 3 2 2 2 2 * r = x *(T2+x *(T3+x *(...+x *(T12+x *T13)))) * then @@ -51,9 +51,9 @@ static char rcsid[] = "$Id: k_tan.c,v 1.6 1994/08/18 23:06:16 jtc Exp $"; #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ pio4 = 7.85398163397448278999e-01, /* 0x3FE921FB, 0x54442D18 */ @@ -116,7 +116,7 @@ T[] = { return (double)(1-((hx>>30)&2))*(v-2.0*(x-(w*w/(w+v)-r))); } if(iy==1) return w; - else { /* if allow error up to 2 ulp, + else { /* if allow error up to 2 ulp, simply return -1.0/(x+r) here */ /* compute -1.0/(x+r) accurately */ double a,t; diff --git a/lib/msun/src/k_tanf.c b/lib/msun/src/k_tanf.c index f4d13edd78c5..9be8d378ade6 100644 --- a/lib/msun/src/k_tanf.c +++ b/lib/msun/src/k_tanf.c @@ -8,21 +8,21 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: k_tanf.c,v 1.2 1994/08/18 23:06:18 jtc Exp $"; +static char rcsid[] = "$Id: k_tanf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif one = 1.0000000000e+00, /* 0x3f800000 */ pio4 = 7.8539812565e-01, /* 0x3f490fda */ @@ -83,7 +83,7 @@ T[] = { return (float)(1-((hx>>30)&2))*(v-(float)2.0*(x-(w*w/(w+v)-r))); } if(iy==1) return w; - else { /* if allow error up to 2 ulp, + else { /* if allow error up to 2 ulp, simply return -1.0/(x+r) here */ /* compute -1.0/(x+r) accurately */ float a,t; diff --git a/lib/msun/src/math.h b/lib/msun/src/math.h index eff080f8f84d..74b021ff06a7 100644 --- a/lib/msun/src/math.h +++ b/lib/msun/src/math.h @@ -4,14 +4,14 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* * from: @(#)fdlibm.h 5.1 93/09/24 - * $Id: math.h,v 1.1 1994/08/10 20:31:49 jtc Exp $ + * $Id: math.h,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $ */ #ifndef _MATH_H_ @@ -48,15 +48,15 @@ extern int signgam; enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix}; #define _LIB_VERSION_TYPE enum fdversion -#define _LIB_VERSION _fdlib_version +#define _LIB_VERSION _fdlib_version -/* if global variable _LIB_VERSION is not desirable, one may - * change the following to be a constant by: +/* if global variable _LIB_VERSION is not desirable, one may + * change the following to be a constant by: * #define _LIB_VERSION_TYPE const enum version * In that case, after one initializes the value _LIB_VERSION (see * s_lib_version.c) during compile time, it cannot be modified * in the middle of a program - */ + */ extern _LIB_VERSION_TYPE _LIB_VERSION; #define _IEEE_ fdlibm_ieee @@ -74,12 +74,12 @@ struct exception { #define HUGE MAXFLOAT -/* +/* * set X_TLOSS = pi*2**52, which is possibly defined in <values.h> * (one may replace the following line by "#include <values.h>") */ -#define X_TLOSS 1.41484755040568800000e+16 +#define X_TLOSS 1.41484755040568800000e+16 #define DOMAIN 1 #define SING 2 diff --git a/lib/msun/src/math_private.h b/lib/msun/src/math_private.h index 2183c9f2c166..232f65b8712f 100644 --- a/lib/msun/src/math_private.h +++ b/lib/msun/src/math_private.h @@ -4,14 +4,14 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ /* * from: @(#)fdlibm.h 5.1 93/09/24 - * $Id: math_private.h,v 1.2 1994/08/18 23:06:19 jtc Exp $ + * $Id: math_private.h,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $ */ #ifndef _MATH_PRIVATE_H_ @@ -36,10 +36,10 @@ #if BYTE_ORDER == BIG_ENDIAN -typedef union +typedef union { double value; - struct + struct { u_int32_t msw; u_int32_t lsw; @@ -50,10 +50,10 @@ typedef union #if BYTE_ORDER == LITTLE_ENDIAN -typedef union +typedef union { double value; - struct + struct { u_int32_t lsw; u_int32_t msw; @@ -149,13 +149,13 @@ do { \ } while (0) /* ieee style elementary functions */ -extern double __ieee754_sqrt __P((double)); -extern double __ieee754_acos __P((double)); -extern double __ieee754_acosh __P((double)); -extern double __ieee754_log __P((double)); -extern double __ieee754_atanh __P((double)); -extern double __ieee754_asin __P((double)); -extern double __ieee754_atan2 __P((double,double)); +extern double __ieee754_sqrt __P((double)); +extern double __ieee754_acos __P((double)); +extern double __ieee754_acosh __P((double)); +extern double __ieee754_log __P((double)); +extern double __ieee754_atanh __P((double)); +extern double __ieee754_asin __P((double)); +extern double __ieee754_atan2 __P((double,double)); extern double __ieee754_exp __P((double)); extern double __ieee754_cosh __P((double)); extern double __ieee754_fmod __P((double,double)); @@ -178,7 +178,7 @@ extern int __ieee754_rem_pio2 __P((double,double*)); extern double __ieee754_scalb __P((double,double)); /* fdlibm kernel function */ -extern double __kernel_standard __P((double,double,int)); +extern double __kernel_standard __P((double,double,int)); extern double __kernel_sin __P((double,double,int)); extern double __kernel_cos __P((double,double)); extern double __kernel_tan __P((double,double,int)); @@ -186,13 +186,13 @@ extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*)); /* ieee style elementary float functions */ -extern float __ieee754_sqrtf __P((float)); -extern float __ieee754_acosf __P((float)); -extern float __ieee754_acoshf __P((float)); -extern float __ieee754_logf __P((float)); -extern float __ieee754_atanhf __P((float)); -extern float __ieee754_asinf __P((float)); -extern float __ieee754_atan2f __P((float,float)); +extern float __ieee754_sqrtf __P((float)); +extern float __ieee754_acosf __P((float)); +extern float __ieee754_acoshf __P((float)); +extern float __ieee754_logf __P((float)); +extern float __ieee754_atanhf __P((float)); +extern float __ieee754_asinf __P((float)); +extern float __ieee754_atan2f __P((float,float)); extern float __ieee754_expf __P((float)); extern float __ieee754_coshf __P((float)); extern float __ieee754_fmodf __P((float,float)); diff --git a/lib/msun/src/s_asinh.c b/lib/msun/src/s_asinh.c index f9e1304ee48f..64de8defe96f 100644 --- a/lib/msun/src/s_asinh.c +++ b/lib/msun/src/s_asinh.c @@ -5,37 +5,37 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_asinh.c,v 1.6 1994/08/18 23:06:20 jtc Exp $"; +static char rcsid[] = "$Id: s_asinh.c,v 1.1.1.1 1994/08/19 09:39:45 jkh Exp $"; #endif /* asinh(x) * Method : - * Based on + * Based on * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] * we have * asinh(x) := x if 1+x*x=1, * := sign(x)*(log(x)+ln2)) for large |x|, else * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else - * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) + * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) */ #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const double +static const double #else -static double +static double #endif one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ -huge= 1.00000000000000000000e+300; +huge= 1.00000000000000000000e+300; #ifdef __STDC__ double asinh(double x) @@ -43,7 +43,7 @@ huge= 1.00000000000000000000e+300; double asinh(x) double x; #endif -{ +{ double t,w; int32_t hx,ix; GET_HIGH_WORD(hx,x); @@ -51,7 +51,7 @@ huge= 1.00000000000000000000e+300; if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */ if(ix< 0x3e300000) { /* |x|<2**-28 */ if(huge+x>one) return x; /* return x inexact except 0 */ - } + } if(ix>0x41b00000) { /* |x| > 2**28 */ w = __ieee754_log(fabs(x))+ln2; } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ diff --git a/lib/msun/src/s_asinhf.c b/lib/msun/src/s_asinhf.c index 3d4f2425c9c5..e96704fc9bf2 100644 --- a/lib/msun/src/s_asinhf.c +++ b/lib/msun/src/s_asinhf.c @@ -8,26 +8,26 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_asinhf.c,v 1.2 1994/08/18 23:06:21 jtc Exp $"; +static char rcsid[] = "$Id: s_asinhf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" #include "math_private.h" #ifdef __STDC__ -static const float +static const float #else -static float +static float #endif one = 1.0000000000e+00, /* 0x3F800000 */ ln2 = 6.9314718246e-01, /* 0x3f317218 */ -huge= 1.0000000000e+30; +huge= 1.0000000000e+30; #ifdef __STDC__ float asinhf(float x) @@ -35,7 +35,7 @@ huge= 1.0000000000e+30; float asinhf(x) float x; #endif -{ +{ float t,w; int32_t hx,ix; GET_FLOAT_WORD(hx,x); @@ -43,7 +43,7 @@ huge= 1.0000000000e+30; if(ix>=0x7f800000) return x+x; /* x is inf or NaN */ if(ix< 0x31800000) { /* |x|<2**-28 */ if(huge+x>one) return x; /* return x inexact except 0 */ - } + } if(ix>0x4d800000) { /* |x| > 2**28 */ w = __ieee754_logf(fabsf(x))+ln2; } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ diff --git a/lib/msun/src/s_atan.c b/lib/msun/src/s_atan.c index dd7966517339..f53462bb3895 100644 --- a/lib/msun/src/s_atan.c +++ b/lib/msun/src/s_atan.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_atan.c,v 1.6 1994/08/18 23:06:23 jtc Exp $"; +static char rcsid[] = "$Id: s_atan.c,v 1.1.1.1 1994/08/19 09:39:45 jkh Exp $"; #endif /* atan(x) @@ -28,9 +28,9 @@ static char rcsid[] = "$Id: s_atan.c,v 1.6 1994/08/18 23:06:23 jtc Exp $"; * [39/16,INF] atan(x) = atan(INF) + atan( -1/t ) * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -78,9 +78,9 @@ static double aT[] = { }; #ifdef __STDC__ - static const double + static const double #else - static double + static double #endif one = 1.0, huge = 1.0e300; @@ -114,9 +114,9 @@ huge = 1.0e300; x = fabs(x); if (ix < 0x3ff30000) { /* |x| < 1.1875 */ if (ix < 0x3fe60000) { /* 7/16 <=|x|<11/16 */ - id = 0; x = (2.0*x-one)/(2.0+x); + id = 0; x = (2.0*x-one)/(2.0+x); } else { /* 11/16<=|x|< 19/16 */ - id = 1; x = (x-one)/(x+one); + id = 1; x = (x-one)/(x+one); } } else { if (ix < 0x40038000) { /* |x| < 2.4375 */ diff --git a/lib/msun/src/s_atanf.c b/lib/msun/src/s_atanf.c index f9d51600a698..52beebfcf5ec 100644 --- a/lib/msun/src/s_atanf.c +++ b/lib/msun/src/s_atanf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_atanf.c,v 1.2 1994/08/18 23:06:24 jtc Exp $"; +static char rcsid[] = "$Id: s_atanf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" @@ -61,9 +61,9 @@ static float aT[] = { }; #ifdef __STDC__ - static const float + static const float #else - static float + static float #endif one = 1.0, huge = 1.0e30; @@ -94,9 +94,9 @@ huge = 1.0e30; x = fabsf(x); if (ix < 0x3f980000) { /* |x| < 1.1875 */ if (ix < 0x3f300000) { /* 7/16 <=|x|<11/16 */ - id = 0; x = ((float)2.0*x-one)/((float)2.0+x); + id = 0; x = ((float)2.0*x-one)/((float)2.0+x); } else { /* 11/16<=|x|< 19/16 */ - id = 1; x = (x-one)/(x+one); + id = 1; x = (x-one)/(x+one); } } else { if (ix < 0x401c0000) { /* |x| < 2.4375 */ diff --git a/lib/msun/src/s_cbrt.c b/lib/msun/src/s_cbrt.c index cbf50abe0f9b..a3fcc0215b47 100644 --- a/lib/msun/src/s_cbrt.c +++ b/lib/msun/src/s_cbrt.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_cbrt.c,v 1.6 1994/08/18 23:06:25 jtc Exp $"; +static char rcsid[] = "$Id: s_cbrt.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $"; #endif #include "math.h" @@ -40,9 +40,9 @@ F = 1.60714285714285720630e+00, /* 45/28 = 0x3FF9B6DB, 0x6DB6DB6E */ G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ #ifdef __STDC__ - double cbrt(double x) + double cbrt(double x) #else - double cbrt(x) + double cbrt(x) double x; #endif { @@ -56,7 +56,7 @@ G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ hx ^=sign; if(hx>=0x7ff00000) return(x+x); /* cbrt(NaN,INF) is itself */ GET_LOW_WORD(low,x); - if((hx|low)==0) + if((hx|low)==0) return(x); /* cbrt(0) is itself */ SET_HIGH_WORD(x,hx); /* x <- |x| */ @@ -72,9 +72,9 @@ G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */ /* new cbrt to 23 bits, may be implemented in single precision */ r=t*t/x; s=C+r*t; - t*=G+F/(s+E+D/s); + t*=G+F/(s+E+D/s); - /* chopped to 20 bits and make it larger than cbrt(x) */ + /* chopped to 20 bits and make it larger than cbrt(x) */ GET_HIGH_WORD(high,t); INSERT_WORDS(t,high+0x00000001,0); diff --git a/lib/msun/src/s_cbrtf.c b/lib/msun/src/s_cbrtf.c index 4b38c5066678..8bee2beb4a57 100644 --- a/lib/msun/src/s_cbrtf.c +++ b/lib/msun/src/s_cbrtf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_cbrtf.c,v 1.2 1994/08/18 23:06:27 jtc Exp $"; +static char rcsid[] = "$Id: s_cbrtf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" @@ -24,9 +24,9 @@ static char rcsid[] = "$Id: s_cbrtf.c,v 1.2 1994/08/18 23:06:27 jtc Exp $"; * Return cube root of x */ #ifdef __STDC__ -static const unsigned +static const unsigned #else -static unsigned +static unsigned #endif B1 = 709958130, /* B1 = (84+2/3-0.03306235651)*2**23 */ B2 = 642849266; /* B2 = (76+2/3-0.03306235651)*2**23 */ @@ -43,9 +43,9 @@ F = 1.6071428061e+00, /* 45/28 = 0x3fcdb6db */ G = 3.5714286566e-01; /* 5/14 = 0x3eb6db6e */ #ifdef __STDC__ - float cbrtf(float x) + float cbrtf(float x) #else - float cbrtf(x) + float cbrtf(x) float x; #endif { @@ -58,7 +58,7 @@ G = 3.5714286566e-01; /* 5/14 = 0x3eb6db6e */ sign=hx&0x80000000; /* sign= sign(x) */ hx ^=sign; if(hx>=0x7f800000) return(x+x); /* cbrt(NaN,INF) is itself */ - if(hx==0) + if(hx==0) return(x); /* cbrt(0) is itself */ SET_FLOAT_WORD(x,hx); /* x <- |x| */ @@ -74,7 +74,7 @@ G = 3.5714286566e-01; /* 5/14 = 0x3eb6db6e */ /* new cbrt to 23 bits */ r=t*t/x; s=C+r*t; - t*=G+F/(s+E+D/s); + t*=G+F/(s+E+D/s); /* retore the sign bit */ GET_FLOAT_WORD(high,t); diff --git a/lib/msun/src/s_ceil.c b/lib/msun/src/s_ceil.c index d1c55986e248..749bc606bb9a 100644 --- a/lib/msun/src/s_ceil.c +++ b/lib/msun/src/s_ceil.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_ceil.c,v 1.6 1994/08/18 23:06:29 jtc Exp $"; +static char rcsid[] = "$Id: s_ceil.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $"; #endif /* @@ -46,7 +46,7 @@ static double huge = 1.0e300; if(j0<20) { if(j0<0) { /* raise inexact if x != 0 */ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=0x80000000;i1=0;} + if(i0<0) {i0=0x80000000;i1=0;} else if((i0|i1)!=0) { i0=0x3ff00000;i1=0;} } } else { @@ -65,7 +65,7 @@ static double huge = 1.0e300; if((i1&i)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ if(i0>0) { - if(j0==20) i0+=1; + if(j0==20) i0+=1; else { j = i1 + (1<<(52-j0)); if(j<i1) i0+=1; /* got a carry */ diff --git a/lib/msun/src/s_ceilf.c b/lib/msun/src/s_ceilf.c index 76334f1a603e..b30f5ba8e816 100644 --- a/lib/msun/src/s_ceilf.c +++ b/lib/msun/src/s_ceilf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_ceilf.c,v 1.2 1994/08/18 23:06:30 jtc Exp $"; +static char rcsid[] = "$Id: s_ceilf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif #include "math.h" @@ -41,7 +41,7 @@ static float huge = 1.0e30; if(j0<23) { if(j0<0) { /* raise inexact if x != 0 */ if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=0x80000000;} + if(i0<0) {i0=0x80000000;} else if(i0!=0) { i0=0x3f800000;} } } else { diff --git a/lib/msun/src/s_copysign.c b/lib/msun/src/s_copysign.c index 93f39c09f7b7..30fea0e6a314 100644 --- a/lib/msun/src/s_copysign.c +++ b/lib/msun/src/s_copysign.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_copysign.c,v 1.6 1994/08/18 23:06:31 jtc Exp $"; +static char rcsid[] = "$Id: s_copysign.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $"; #endif /* diff --git a/lib/msun/src/s_copysignf.c b/lib/msun/src/s_copysignf.c index 219f35f00bd5..07b1a530ab14 100644 --- a/lib/msun/src/s_copysignf.c +++ b/lib/msun/src/s_copysignf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_copysignf.c,v 1.2 1994/08/18 23:06:33 jtc Exp $"; +static char rcsid[] = "$Id: s_copysignf.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif /* diff --git a/lib/msun/src/s_cos.c b/lib/msun/src/s_cos.c index 821af1ca66d9..b3666d33eb48 100644 --- a/lib/msun/src/s_cos.c +++ b/lib/msun/src/s_cos.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_cos.c,v 1.5 1994/08/18 23:06:34 jtc Exp $"; +static char rcsid[] = "$Id: s_cos.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $"; #endif /* cos(x) @@ -23,8 +23,8 @@ static char rcsid[] = "$Id: s_cos.c,v 1.5 1994/08/18 23:06:34 jtc Exp $"; * __ieee754_rem_pio2 ... argument reduction routine * * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * @@ -42,7 +42,7 @@ static char rcsid[] = "$Id: s_cos.c,v 1.5 1994/08/18 23:06:34 jtc Exp $"; * trig(NaN) is that NaN; * * Accuracy: - * TRIG(x) returns trig(x) nearly rounded + * TRIG(x) returns trig(x) nearly rounded */ #include "math.h" diff --git a/lib/msun/src/s_cosf.c b/lib/msun/src/s_cosf.c index f51fff48b95c..95fe4e7723d6 100644 --- a/lib/msun/src/s_cosf.c +++ b/lib/msun/src/s_cosf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_cosf.c,v 1.2 1994/08/18 23:06:35 jtc Exp $"; +static char rcsid[] = "$Id: s_cosf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/s_erf.c b/lib/msun/src/s_erf.c index 45f66366835c..4a06e2043ed2 100644 --- a/lib/msun/src/s_erf.c +++ b/lib/msun/src/s_erf.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_erf.c,v 1.6 1994/08/18 23:06:36 jtc Exp $"; +static char rcsid[] = "$Id: s_erf.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $"; #endif /* double erf(double x) @@ -19,11 +19,11 @@ static char rcsid[] = "$Id: s_erf.c,v 1.6 1994/08/18 23:06:36 jtc Exp $"; * x * 2 |\ * erf(x) = --------- | exp(-t*t)dt - * sqrt(pi) \| + * sqrt(pi) \| * 0 * * erfc(x) = 1-erf(x) - * Note that + * Note that * erf(-x) = -erf(x) * erfc(-x) = 2 - erfc(x) * @@ -36,7 +36,7 @@ static char rcsid[] = "$Id: s_erf.c,v 1.6 1994/08/18 23:06:36 jtc Exp $"; * Q is an odd poly of degree 10. * -57.90 * | R - (erf(x)-x)/x | <= 2 - * + * * * Remark. The formula is derived by noting * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) @@ -59,14 +59,14 @@ static char rcsid[] = "$Id: s_erf.c,v 1.6 1994/08/18 23:06:36 jtc Exp $"; * That is, we use rational approximation to approximate * erf(1+s) - (c = (single)0.84506291151) * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] - * where + * where * P1(s) = degree 6 poly in s * Q1(s) = degree 6 poly in s * - * 3. For x in [1.25,1/0.35(~2.857143)], + * 3. For x in [1.25,1/0.35(~2.857143)], * erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1) * erf(x) = 1 - erfc(x) - * where + * where * R1(z) = degree 7 poly in z, (z=1/x^2) * S1(z) = degree 8 poly in z * @@ -84,7 +84,7 @@ static char rcsid[] = "$Id: s_erf.c,v 1.6 1994/08/18 23:06:36 jtc Exp $"; * To compute exp(-x*x-0.5625+R/S), let s be a single * precision number and s := x; then * -x*x = -s*s + (s-x)*(s+x) - * exp(-x*x-0.5626+R/S) = + * exp(-x*x-0.5626+R/S) = * exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S); * Note2: * Here 4 and 5 make use of the asymptotic series @@ -104,7 +104,7 @@ static char rcsid[] = "$Id: s_erf.c,v 1.6 1994/08/18 23:06:36 jtc Exp $"; * * 7. Special case: * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, + * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, * erfc/erf(NaN) is NaN */ @@ -139,7 +139,7 @@ qq3 = 5.08130628187576562776e-03, /* 0x3F74D022, 0xC4D36B0F */ qq4 = 1.32494738004321644526e-04, /* 0x3F215DC9, 0x221C1A10 */ qq5 = -3.96022827877536812320e-06, /* 0xBED09C43, 0x42A26120 */ /* - * Coefficients for approximation to erf in [0.84375,1.25] + * Coefficients for approximation to erf in [0.84375,1.25] */ pa0 = -2.36211856075265944077e-03, /* 0xBF6359B8, 0xBEF77538 */ pa1 = 4.14856118683748331666e-01, /* 0x3FDA8D00, 0xAD92B34D */ @@ -192,9 +192,9 @@ sb6 = 4.74528541206955367215e+02, /* 0x407DA874, 0xE79FE763 */ sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ #ifdef __STDC__ - double erf(double x) + double erf(double x) #else - double erf(x) + double erf(x) double x; #endif { @@ -209,7 +209,7 @@ sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ if(ix < 0x3feb0000) { /* |x|<0.84375 */ if(ix < 0x3e300000) { /* |x|<2**-28 */ - if (ix < 0x00800000) + if (ix < 0x00800000) return 0.125*(8.0*x+efx8*x); /*avoid underflow */ return x + efx*x; } @@ -241,16 +241,16 @@ sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ S=one+s*(sb1+s*(sb2+s*(sb3+s*(sb4+s*( sb5+s*(sb6+s*sb7)))))); } - z = x; + z = x; SET_LOW_WORD(z,0); r = __ieee754_exp(-z*z-0.5625)*__ieee754_exp((z-x)*(z+x)+R/S); if(hx>=0) return one-r/x; else return r/x-one; } #ifdef __STDC__ - double erfc(double x) + double erfc(double x) #else - double erfc(x) + double erfc(x) double x; #endif { @@ -283,7 +283,7 @@ sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */ P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); if(hx>=0) { - z = one-erx; return z - P/Q; + z = one-erx; return z - P/Q; } else { z = erx+P/Q; return one+z; } diff --git a/lib/msun/src/s_erff.c b/lib/msun/src/s_erff.c index 5a931be7cd23..15e40b13e400 100644 --- a/lib/msun/src/s_erff.c +++ b/lib/msun/src/s_erff.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_erff.c,v 1.2 1994/08/18 23:06:38 jtc Exp $"; +static char rcsid[] = "$Id: s_erff.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" @@ -47,7 +47,7 @@ qq3 = 5.0813062117e-03, /* 0x3ba68116 */ qq4 = 1.3249473704e-04, /* 0x390aee49 */ qq5 = -3.9602282413e-06, /* 0xb684e21a */ /* - * Coefficients for approximation to erf in [0.84375,1.25] + * Coefficients for approximation to erf in [0.84375,1.25] */ pa0 = -2.3621185683e-03, /* 0xbb1acdc6 */ pa1 = 4.1485610604e-01, /* 0x3ed46805 */ @@ -100,9 +100,9 @@ sb6 = 4.7452853394e+02, /* 0x43ed43a7 */ sb7 = -2.2440952301e+01; /* 0xc1b38712 */ #ifdef __STDC__ - float erff(float x) + float erff(float x) #else - float erff(x) + float erff(x) float x; #endif { @@ -117,7 +117,7 @@ sb7 = -2.2440952301e+01; /* 0xc1b38712 */ if(ix < 0x3f580000) { /* |x|<0.84375 */ if(ix < 0x31800000) { /* |x|<2**-28 */ - if (ix < 0x04000000) + if (ix < 0x04000000) /*avoid underflow */ return (float)0.125*((float)8.0*x+efx8*x); return x + efx*x; @@ -157,9 +157,9 @@ sb7 = -2.2440952301e+01; /* 0xc1b38712 */ } #ifdef __STDC__ - float erfcf(float x) + float erfcf(float x) #else - float erfcf(x) + float erfcf(x) float x; #endif { @@ -192,7 +192,7 @@ sb7 = -2.2440952301e+01; /* 0xc1b38712 */ P = pa0+s*(pa1+s*(pa2+s*(pa3+s*(pa4+s*(pa5+s*pa6))))); Q = one+s*(qa1+s*(qa2+s*(qa3+s*(qa4+s*(qa5+s*qa6))))); if(hx>=0) { - z = one-erx; return z - P/Q; + z = one-erx; return z - P/Q; } else { z = erx+P/Q; return one+z; } diff --git a/lib/msun/src/s_expm1.c b/lib/msun/src/s_expm1.c index 70a1e05b448f..9c933e24c885 100644 --- a/lib/msun/src/s_expm1.c +++ b/lib/msun/src/s_expm1.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_expm1.c,v 1.6 1994/08/18 23:06:39 jtc Exp $"; +static char rcsid[] = "$Id: s_expm1.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $"; #endif /* expm1(x) @@ -21,9 +21,9 @@ static char rcsid[] = "$Id: s_expm1.c,v 1.6 1994/08/18 23:06:39 jtc Exp $"; * 1. Argument reduction: * Given x, find r and integer k such that * - * x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658 + * x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658 * - * Here a correction term c will be computed to compensate + * Here a correction term c will be computed to compensate * the error in r when rounded to a floating-point number. * * 2. Approximating expm1(r) by a special rational function on @@ -36,9 +36,9 @@ static char rcsid[] = "$Id: s_expm1.c,v 1.6 1994/08/18 23:06:39 jtc Exp $"; * R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r) * = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r)) * = 1 - r^2/60 + r^4/2520 - r^6/100800 + ... - * We use a special Reme algorithm on [0,0.347] to generate - * a polynomial of degree 5 in r*r to approximate R1. The - * maximum error of this polynomial approximation is bounded + * We use a special Reme algorithm on [0,0.347] to generate + * a polynomial of degree 5 in r*r to approximate R1. The + * maximum error of this polynomial approximation is bounded * by 2**-61. In other words, * R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5 * where Q1 = -1.6666666666666567384E-2, @@ -49,28 +49,28 @@ static char rcsid[] = "$Id: s_expm1.c,v 1.6 1994/08/18 23:06:39 jtc Exp $"; * (where z=r*r, and the values of Q1 to Q5 are listed below) * with error bounded by * | 5 | -61 - * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 + * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 * | | - * - * expm1(r) = exp(r)-1 is then computed by the following - * specific way which minimize the accumulation rounding error: + * + * expm1(r) = exp(r)-1 is then computed by the following + * specific way which minimize the accumulation rounding error: * 2 3 * r r [ 3 - (R1 + R1*r/2) ] * expm1(r) = r + --- + --- * [--------------------] * 2 2 [ 6 - r*(3 - R1*r/2) ] - * + * * To compensate the error in the argument reduction, we use - * expm1(r+c) = expm1(r) + c + expm1(r)*c - * ~ expm1(r) + c + r*c + * expm1(r+c) = expm1(r) + c + expm1(r)*c + * ~ expm1(r) + c + r*c * Thus c+r*c will be added in as the correction terms for - * expm1(r+c). Now rearrange the term to avoid optimization + * expm1(r+c). Now rearrange the term to avoid optimization * screw up: * ( 2 2 ) * ({ ( r [ R1 - (3 - R1*r/2) ] ) } r ) * expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- ) * ({ ( 2 [ 6 - r*(3 - R1*r/2) ] ) } 2 ) * ( ) - * + * * = r - E * 3. Scale back to obtain expm1(x): * From step 1, we have @@ -87,7 +87,7 @@ static char rcsid[] = "$Id: s_expm1.c,v 1.6 1994/08/18 23:06:39 jtc Exp $"; * else return 1.0+2.0*(r-E); * (v) if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1) * (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else - * (vii) return 2^k(1-((E+2^-k)-r)) + * (vii) return 2^k(1-((E+2^-k)-r)) * * Special cases: * expm1(INF) is INF, expm1(NaN) is NaN; @@ -99,12 +99,12 @@ static char rcsid[] = "$Id: s_expm1.c,v 1.6 1994/08/18 23:06:39 jtc Exp $"; * 1 ulp (unit in the last place). * * Misc. info. - * For IEEE double + * For IEEE double * if x > 7.09782712893383973096e+02 then expm1(x) overflow * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. */ @@ -153,7 +153,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ if(hx>=0x7ff00000) { u_int32_t low; GET_LOW_WORD(low,x); - if(((hx&0xfffff)|low)!=0) + if(((hx&0xfffff)|low)!=0) return x+x; /* NaN */ else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ } @@ -166,7 +166,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ } /* argument reduction */ - if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ + if(hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */ if(hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */ if(xsb==0) {hi = x - ln2_hi; lo = ln2_lo; k = 1;} @@ -180,10 +180,10 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ } x = hi - lo; c = (hi-x)-lo; - } + } else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ t = huge+x; /* return x with inexact flags when x!=0 */ - return x - (t-(huge+x)); + return x - (t-(huge+x)); } else k = 0; @@ -198,7 +198,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return 0.5*(x-e)-0.5; - if(k==1) + if(k==1) if(x < -0.25) return -2.0*(e-(x+0.5)); else return one+2.0*(x-e); if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ diff --git a/lib/msun/src/s_expm1f.c b/lib/msun/src/s_expm1f.c index 35c440b62aed..e7d43514f0cc 100644 --- a/lib/msun/src/s_expm1f.c +++ b/lib/msun/src/s_expm1f.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_expm1f.c,v 1.2 1994/08/18 23:06:40 jtc Exp $"; +static char rcsid[] = "$Id: s_expm1f.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" @@ -71,7 +71,7 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */ } /* argument reduction */ - if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ + if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ if(xsb==0) {hi = x - ln2_hi; lo = ln2_lo; k = 1;} @@ -85,10 +85,10 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */ } x = hi - lo; c = (hi-x)-lo; - } + } else if(hx < 0x33000000) { /* when |x|<2**-25, return x */ t = huge+x; /* return x with inexact flags when x!=0 */ - return x - (t-(huge+x)); + return x - (t-(huge+x)); } else k = 0; @@ -103,7 +103,7 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return (float)0.5*(x-e)-(float)0.5; - if(k==1) + if(k==1) if(x < (float)-0.25) return -(float)2.0*(e-(x+(float)0.5)); else return one+(float)2.0*(x-e); if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ diff --git a/lib/msun/src/s_fabs.c b/lib/msun/src/s_fabs.c index 26e19908522e..590d5594ea2e 100644 --- a/lib/msun/src/s_fabs.c +++ b/lib/msun/src/s_fabs.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_fabs.c,v 1.5 1994/08/18 23:06:42 jtc Exp $"; +static char rcsid[] = "$Id: s_fabs.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $"; #endif /* diff --git a/lib/msun/src/s_fabsf.c b/lib/msun/src/s_fabsf.c index 3050ecc82c20..e2462725b9a5 100644 --- a/lib/msun/src/s_fabsf.c +++ b/lib/msun/src/s_fabsf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_fabsf.c,v 1.2 1994/08/18 23:06:43 jtc Exp $"; +static char rcsid[] = "$Id: s_fabsf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif /* diff --git a/lib/msun/src/s_finite.c b/lib/msun/src/s_finite.c index 33fedbac1bb2..5de602467f44 100644 --- a/lib/msun/src/s_finite.c +++ b/lib/msun/src/s_finite.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_finite.c,v 1.6 1994/08/18 23:06:44 jtc Exp $"; +static char rcsid[] = "$Id: s_finite.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $"; #endif /* diff --git a/lib/msun/src/s_finitef.c b/lib/msun/src/s_finitef.c index a2add124b428..28b2f791b375 100644 --- a/lib/msun/src/s_finitef.c +++ b/lib/msun/src/s_finitef.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_finitef.c,v 1.2 1994/08/18 23:06:45 jtc Exp $"; +static char rcsid[] = "$Id: s_finitef.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif /* diff --git a/lib/msun/src/s_floor.c b/lib/msun/src/s_floor.c index e76d00a38bc0..84b5c9db6504 100644 --- a/lib/msun/src/s_floor.c +++ b/lib/msun/src/s_floor.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_floor.c,v 1.6 1994/08/18 23:06:47 jtc Exp $"; +static char rcsid[] = "$Id: s_floor.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $"; #endif /* @@ -46,7 +46,7 @@ static double huge = 1.0e300; if(j0<20) { if(j0<0) { /* raise inexact if x != 0 */ if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=i1=0;} + if(i0>=0) {i0=i1=0;} else if(((i0&0x7fffffff)|i1)!=0) { i0=0xbff00000;i1=0;} } @@ -66,7 +66,7 @@ static double huge = 1.0e300; if((i1&i)==0) return x; /* x is integral */ if(huge+x>0.0) { /* raise inexact flag */ if(i0<0) { - if(j0==20) i0+=1; + if(j0==20) i0+=1; else { j = i1+(1<<(52-j0)); if(j<i1) i0 +=1 ; /* got a carry */ diff --git a/lib/msun/src/s_floorf.c b/lib/msun/src/s_floorf.c index 216a073a9c0f..885121380886 100644 --- a/lib/msun/src/s_floorf.c +++ b/lib/msun/src/s_floorf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_floorf.c,v 1.2 1994/08/18 23:06:48 jtc Exp $"; +static char rcsid[] = "$Id: s_floorf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif /* @@ -49,7 +49,7 @@ static float huge = 1.0e30; if(j0<23) { if(j0<0) { /* raise inexact if x != 0 */ if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=0;} + if(i0>=0) {i0=0;} else if((i0&0x7fffffff)!=0) { i0=0xbf800000;} } diff --git a/lib/msun/src/s_frexp.c b/lib/msun/src/s_frexp.c index 00d344f72d37..6a1fadf97849 100644 --- a/lib/msun/src/s_frexp.c +++ b/lib/msun/src/s_frexp.c @@ -5,23 +5,23 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_frexp.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $"; +static char rcsid[] = "$Id: s_frexp.c,v 1.2 1995/04/07 23:23:26 bde Exp $"; #endif /* - * for non-zero x + * for non-zero x * x = frexp(arg,&exp); * return a double fp quantity x such that 0.5 <= |x| <1.0 * and the corresponding binary exponent "exp". That is * arg = x*2^exp. - * If arg is inf, 0.0, or NaN, then frexp(arg,&exp) returns arg - * with *exp=0. + * If arg is inf, 0.0, or NaN, then frexp(arg,&exp) returns arg + * with *exp=0. */ #include "math.h" diff --git a/lib/msun/src/s_frexpf.c b/lib/msun/src/s_frexpf.c index 6988cbe5d07e..ee97029b6f4d 100644 --- a/lib/msun/src/s_frexpf.c +++ b/lib/msun/src/s_frexpf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_frexpf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; +static char rcsid[] = "$Id: s_frexpf.c,v 1.2 1995/04/07 23:23:27 bde Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/s_ilogb.c b/lib/msun/src/s_ilogb.c index 1514cc41bd85..c6263d80b87a 100644 --- a/lib/msun/src/s_ilogb.c +++ b/lib/msun/src/s_ilogb.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_ilogb.c,v 1.6 1994/08/18 23:06:52 jtc Exp $"; +static char rcsid[] = "$Id: s_ilogb.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif /* ilogb(double x) @@ -35,7 +35,7 @@ static char rcsid[] = "$Id: s_ilogb.c,v 1.6 1994/08/18 23:06:52 jtc Exp $"; EXTRACT_WORDS(hx,lx,x); hx &= 0x7fffffff; if(hx<0x00100000) { - if((hx|lx)==0) + if((hx|lx)==0) return 0x80000001; /* ilogb(0) = 0x80000001 */ else /* subnormal x */ if(hx==0) { diff --git a/lib/msun/src/s_ilogbf.c b/lib/msun/src/s_ilogbf.c index 86bdda636d47..8c0f162a908d 100644 --- a/lib/msun/src/s_ilogbf.c +++ b/lib/msun/src/s_ilogbf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_ilogbf.c,v 1.2 1994/08/18 23:06:53 jtc Exp $"; +static char rcsid[] = "$Id: s_ilogbf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" @@ -32,7 +32,7 @@ static char rcsid[] = "$Id: s_ilogbf.c,v 1.2 1994/08/18 23:06:53 jtc Exp $"; GET_FLOAT_WORD(hx,x); hx &= 0x7fffffff; if(hx<0x00800000) { - if(hx==0) + if(hx==0) return 0x80000001; /* ilogb(0) = 0x80000001 */ else /* subnormal x */ for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1; diff --git a/lib/msun/src/s_isnan.c b/lib/msun/src/s_isnan.c index 3f18f7dc2649..677913f5c114 100644 --- a/lib/msun/src/s_isnan.c +++ b/lib/msun/src/s_isnan.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_isnan.c,v 1.6 1994/08/18 23:06:54 jtc Exp $"; +static char rcsid[] = "$Id: s_isnan.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif /* @@ -32,7 +32,7 @@ static char rcsid[] = "$Id: s_isnan.c,v 1.6 1994/08/18 23:06:54 jtc Exp $"; int32_t hx,lx; EXTRACT_WORDS(hx,lx,x); hx &= 0x7fffffff; - hx |= (u_int32_t)(lx|(-lx))>>31; + hx |= (u_int32_t)(lx|(-lx))>>31; hx = 0x7ff00000 - hx; return (int)((u_int32_t)(hx))>>31; } diff --git a/lib/msun/src/s_isnanf.c b/lib/msun/src/s_isnanf.c index 1c7458262af1..4c4e69ef01a0 100644 --- a/lib/msun/src/s_isnanf.c +++ b/lib/msun/src/s_isnanf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_isnanf.c,v 1.2 1994/08/18 23:06:56 jtc Exp $"; +static char rcsid[] = "$Id: s_isnanf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif /* diff --git a/lib/msun/src/s_ldexp.c b/lib/msun/src/s_ldexp.c index 824c2e7f180e..1d11ff2ba4b1 100644 --- a/lib/msun/src/s_ldexp.c +++ b/lib/msun/src/s_ldexp.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_ldexp.c,v 1.4 1994/08/10 20:32:37 jtc Exp $"; +static char rcsid[] = "$Id: s_ldexp.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/s_ldexpf.c b/lib/msun/src/s_ldexpf.c index cdb44764160b..7cd0ce06e2e2 100644 --- a/lib/msun/src/s_ldexpf.c +++ b/lib/msun/src/s_ldexpf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_ldexpf.c,v 1.1 1994/08/10 20:32:39 jtc Exp $"; +static char rcsid[] = "$Id: s_ldexpf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/s_lib_version.c b/lib/msun/src/s_lib_version.c index d8c875050b57..7936f89dca0d 100644 --- a/lib/msun/src/s_lib_version.c +++ b/lib/msun/src/s_lib_version.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_lib_version.c,v 1.4 1994/08/10 20:32:40 jtc Exp $"; +static char rcsid[] = "$Id: s_lib_version.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif /* diff --git a/lib/msun/src/s_log1p.c b/lib/msun/src/s_log1p.c index 475c7abb21a6..56218d4a720b 100644 --- a/lib/msun/src/s_log1p.c +++ b/lib/msun/src/s_log1p.c @@ -5,20 +5,20 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_log1p.c,v 1.6 1994/08/18 23:06:59 jtc Exp $"; +static char rcsid[] = "$Id: s_log1p.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif /* double log1p(double x) * - * Method : - * 1. Argument Reduction: find k and f such that - * 1+x = 2^k * (1+f), + * Method : + * 1. Argument Reduction: find k and f such that + * 1+x = 2^k * (1+f), * where sqrt(2)/2 < 1+f < sqrt(2) . * * Note. If k=0, then f=x is exact. However, if k!=0, then f @@ -32,8 +32,8 @@ static char rcsid[] = "$Id: s_log1p.c,v 1.6 1994/08/18 23:06:59 jtc Exp $"; * Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s) * = 2s + 2/3 s**3 + 2/5 s**5 + ....., * = 2s + s*R - * We use a special Reme algorithm on [0,0.1716] to generate - * a polynomial of degree 14 to approximate R The maximum error + * We use a special Reme algorithm on [0,0.1716] to generate + * a polynomial of degree 14 to approximate R The maximum error * of this polynomial approximation is bounded by 2**-58.45. In * other words, * 2 4 6 8 10 12 14 @@ -41,21 +41,21 @@ static char rcsid[] = "$Id: s_log1p.c,v 1.6 1994/08/18 23:06:59 jtc Exp $"; * (the values of Lp1 to Lp7 are listed in the program) * and * | 2 14 | -58.45 - * | Lp1*s +...+Lp7*s - R(z) | <= 2 + * | Lp1*s +...+Lp7*s - R(z) | <= 2 * | | * Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2. * In order to guarantee error in log below 1ulp, we compute log * by * log1p(f) = f - (hfsq - s*(hfsq+R)). - * - * 3. Finally, log1p(x) = k*ln2 + log1p(f). + * + * 3. Finally, log1p(x) = k*ln2 + log1p(f). * = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo))) - * Here ln2 is split into two floating point number: + * Here ln2 is split into two floating point number: * ln2_hi + ln2_lo, * where n*ln2_hi is always exact for |n| < 2000. * * Special cases: - * log1p(x) is NaN with signal if x < -1 (including -INF) ; + * log1p(x) is NaN with signal if x < -1 (including -INF) ; * log1p(+INF) is +INF; log1p(-1) is -INF with signal; * log1p(NaN) is that NaN with no signal. * @@ -64,14 +64,14 @@ static char rcsid[] = "$Id: s_log1p.c,v 1.6 1994/08/18 23:06:59 jtc Exp $"; * 1 ulp (unit in the last place). * * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough + * The hexadecimal values are the intended ones for the following + * constants. The decimal values may be used, provided that the + * compiler will convert from decimal to binary accurately enough * to produce the hexadecimal values shown. * * Note: Assuming log() return accurate answer, the following * algorithm can be used to compute log1p(x) to within a few ULP: - * + * * u = 1+x; * if(u==1.0) return x ; else * return log(u)*(x/(u-1.0)); @@ -132,11 +132,11 @@ static double zero = 0.0; } if(hx>0||hx<=((int32_t)0xbfd2bec3)) { k=0;f=x;hu=1;} /* -0.2929<x<0.41422 */ - } + } if (hx >= 0x7ff00000) return x+x; if(k!=0) { if(hx<0x43400000) { - u = 1.0+x; + u = 1.0+x; GET_HIGH_WORD(hu,u); k = (hu>>20)-1023; c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ @@ -151,7 +151,7 @@ static double zero = 0.0; if(hu<0x6a09e) { SET_HIGH_WORD(u,hu|0x3ff00000); /* normalize u */ } else { - k += 1; + k += 1; SET_HIGH_WORD(u,hu|0x3fe00000); /* normalize u/2 */ hu = (0x00100000-hu)>>2; } @@ -159,13 +159,13 @@ static double zero = 0.0; } hfsq=0.5*f*f; if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) if(k==0) return zero; + if(f==zero) if(k==0) return zero; else {c += k*ln2_lo; return k*ln2_hi+c;} R = hfsq*(1.0-0.66666666666666666*f); if(k==0) return f-R; else return k*ln2_hi-((R-(k*ln2_lo+c))-f); } - s = f/(2.0+f); + s = f/(2.0+f); z = s*s; R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); if(k==0) return f-(hfsq-s*(hfsq+R)); else diff --git a/lib/msun/src/s_log1pf.c b/lib/msun/src/s_log1pf.c index 229bb82b7230..4c4f65244850 100644 --- a/lib/msun/src/s_log1pf.c +++ b/lib/msun/src/s_log1pf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_log1pf.c,v 1.2 1994/08/18 23:07:02 jtc Exp $"; +static char rcsid[] = "$Id: s_log1pf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" @@ -70,11 +70,11 @@ static float zero = 0.0; } if(hx>0||hx<=((int32_t)0xbe95f61f)) { k=0;f=x;hu=1;} /* -0.2929<x<0.41422 */ - } + } if (hx >= 0x7f800000) return x+x; if(k!=0) { if(hx<0x5a000000) { - u = (float)1.0+x; + u = (float)1.0+x; GET_FLOAT_WORD(hu,u); k = (hu>>23)-127; /* correction term */ @@ -90,7 +90,7 @@ static float zero = 0.0; if(hu<0x3504f7) { SET_FLOAT_WORD(u,hu|0x3f800000);/* normalize u */ } else { - k += 1; + k += 1; SET_FLOAT_WORD(u,hu|0x3f000000); /* normalize u/2 */ hu = (0x00800000-hu)>>2; } @@ -98,13 +98,13 @@ static float zero = 0.0; } hfsq=(float)0.5*f*f; if(hu==0) { /* |f| < 2**-20 */ - if(f==zero) if(k==0) return zero; + if(f==zero) if(k==0) return zero; else {c += k*ln2_lo; return k*ln2_hi+c;} R = hfsq*((float)1.0-(float)0.66666666666666666*f); if(k==0) return f-R; else return k*ln2_hi-((R-(k*ln2_lo+c))-f); } - s = f/((float)2.0+f); + s = f/((float)2.0+f); z = s*s; R = z*(Lp1+z*(Lp2+z*(Lp3+z*(Lp4+z*(Lp5+z*(Lp6+z*Lp7)))))); if(k==0) return f-(hfsq-s*(hfsq+R)); else diff --git a/lib/msun/src/s_logb.c b/lib/msun/src/s_logb.c index d842cbf65605..96e8fc46b61e 100644 --- a/lib/msun/src/s_logb.c +++ b/lib/msun/src/s_logb.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_logb.c,v 1.6 1994/08/18 23:07:04 jtc Exp $"; +static char rcsid[] = "$Id: s_logb.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif /* @@ -36,7 +36,7 @@ static char rcsid[] = "$Id: s_logb.c,v 1.6 1994/08/18 23:07:04 jtc Exp $"; if((ix|lx)==0) return -1.0/fabs(x); if(ix>=0x7ff00000) return x*x; if((ix>>=20)==0) /* IEEE 754 logb */ - return -1022.0; + return -1022.0; else - return (double) (ix-1023); + return (double) (ix-1023); } diff --git a/lib/msun/src/s_logbf.c b/lib/msun/src/s_logbf.c index 0ee1bbe0b585..ddc0a04d8f86 100644 --- a/lib/msun/src/s_logbf.c +++ b/lib/msun/src/s_logbf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_logbf.c,v 1.2 1994/08/18 23:07:07 jtc Exp $"; +static char rcsid[] = "$Id: s_logbf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" @@ -33,7 +33,7 @@ static char rcsid[] = "$Id: s_logbf.c,v 1.2 1994/08/18 23:07:07 jtc Exp $"; if(ix==0) return (float)-1.0/fabsf(x); if(ix>=0x7f800000) return x*x; if((ix>>=23)==0) /* IEEE 754 logb */ - return -126.0; + return -126.0; else - return (float) (ix-127); + return (float) (ix-127); } diff --git a/lib/msun/src/s_matherr.c b/lib/msun/src/s_matherr.c index 102cde385117..219a88c48b02 100644 --- a/lib/msun/src/s_matherr.c +++ b/lib/msun/src/s_matherr.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_matherr.c,v 1.4 1994/08/10 20:32:52 jtc Exp $"; +static char rcsid[] = "$Id: s_matherr.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/s_modf.c b/lib/msun/src/s_modf.c index 2a3d24387f60..b0ebbd0ff03b 100644 --- a/lib/msun/src/s_modf.c +++ b/lib/msun/src/s_modf.c @@ -5,17 +5,17 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_modf.c,v 1.6 1994/08/18 23:07:09 jtc Exp $"; +static char rcsid[] = "$Id: s_modf.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif /* - * modf(double x, double *iptr) + * modf(double x, double *iptr) * return fraction part of x, and return x's integral part in *iptr. * Method: * Bit twiddling. diff --git a/lib/msun/src/s_modff.c b/lib/msun/src/s_modff.c index 63157e7edaed..d1f0e3257bc1 100644 --- a/lib/msun/src/s_modff.c +++ b/lib/msun/src/s_modff.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_modff.c,v 1.2 1994/08/18 23:07:12 jtc Exp $"; +static char rcsid[] = "$Id: s_modff.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/s_nextafter.c b/lib/msun/src/s_nextafter.c index be480bc4d46d..1936fad89e0f 100644 --- a/lib/msun/src/s_nextafter.c +++ b/lib/msun/src/s_nextafter.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_nextafter.c,v 1.6 1994/08/18 23:07:13 jtc Exp $"; +static char rcsid[] = "$Id: s_nextafter.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif /* IEEE functions @@ -39,15 +39,15 @@ static char rcsid[] = "$Id: s_nextafter.c,v 1.6 1994/08/18 23:07:13 jtc Exp $"; ix = hx&0x7fffffff; /* |x| */ iy = hy&0x7fffffff; /* |y| */ - if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ - ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */ - return x+y; + if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ + ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) /* y is nan */ + return x+y; if(x==y) return x; /* x=y, return x */ if((ix|lx)==0) { /* x == 0 */ INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */ y = x*x; if(y==x) return y; else return x; /* raise underflow flag */ - } + } if(hx>=0) { /* x > 0 */ if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ if(lx==0) hx -= 1; diff --git a/lib/msun/src/s_nextafterf.c b/lib/msun/src/s_nextafterf.c index fa3a21139482..bd870705acc9 100644 --- a/lib/msun/src/s_nextafterf.c +++ b/lib/msun/src/s_nextafterf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_nextafterf.c,v 1.2 1994/08/18 23:07:15 jtc Exp $"; +static char rcsid[] = "$Id: s_nextafterf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" @@ -34,15 +34,15 @@ static char rcsid[] = "$Id: s_nextafterf.c,v 1.2 1994/08/18 23:07:15 jtc Exp $"; ix = hx&0x7fffffff; /* |x| */ iy = hy&0x7fffffff; /* |y| */ - if((ix>0x7f800000) || /* x is nan */ - (iy>0x7f800000)) /* y is nan */ - return x+y; + if((ix>0x7f800000) || /* x is nan */ + (iy>0x7f800000)) /* y is nan */ + return x+y; if(x==y) return x; /* x=y, return x */ if(ix==0) { /* x == 0 */ SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */ y = x*x; if(y==x) return y; else return x; /* raise underflow flag */ - } + } if(hx>=0) { /* x > 0 */ if(hx>hy) { /* x > y, x -= ulp */ hx -= 1; diff --git a/lib/msun/src/s_rint.c b/lib/msun/src/s_rint.c index b324ed54fc94..3476eeff4cad 100644 --- a/lib/msun/src/s_rint.c +++ b/lib/msun/src/s_rint.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_rint.c,v 1.6 1994/08/18 23:07:16 jtc Exp $"; +static char rcsid[] = "$Id: s_rint.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif /* @@ -30,7 +30,7 @@ static char rcsid[] = "$Id: s_rint.c,v 1.6 1994/08/18 23:07:16 jtc Exp $"; #ifdef __STDC__ static const double #else -static double +static double #endif TWO52[2]={ 4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */ @@ -51,7 +51,7 @@ TWO52[2]={ sx = (i0>>31)&1; j0 = ((i0>>20)&0x7ff)-0x3ff; if(j0<20) { - if(j0<0) { + if(j0<0) { if(((i0&0x7fffffff)|i1)==0) return x; i1 |= (i0&0x0fffff); i0 &= 0xfffe0000; diff --git a/lib/msun/src/s_rintf.c b/lib/msun/src/s_rintf.c index 855442f2e543..4e77aab2391d 100644 --- a/lib/msun/src/s_rintf.c +++ b/lib/msun/src/s_rintf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_rintf.c,v 1.2 1994/08/18 23:07:17 jtc Exp $"; +static char rcsid[] = "$Id: s_rintf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" @@ -23,7 +23,7 @@ static char rcsid[] = "$Id: s_rintf.c,v 1.2 1994/08/18 23:07:17 jtc Exp $"; #ifdef __STDC__ static const float #else -static float +static float #endif TWO23[2]={ 8.3886080000e+06, /* 0x4b000000 */ @@ -44,7 +44,7 @@ TWO23[2]={ sx = (i0>>31)&1; j0 = ((i0>>23)&0xff)-0x7f; if(j0<23) { - if(j0<0) { + if(j0<0) { if((i0&0x7fffffff)==0) return x; i1 = (i0&0x07fffff); i0 &= 0xfff00000; diff --git a/lib/msun/src/s_scalbn.c b/lib/msun/src/s_scalbn.c index 1effa62e54f8..6549931fb34d 100644 --- a/lib/msun/src/s_scalbn.c +++ b/lib/msun/src/s_scalbn.c @@ -5,19 +5,19 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_scalbn.c,v 1.6 1994/08/18 23:10:13 jtc Exp $"; +static char rcsid[] = "$Id: s_scalbn.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif -/* +/* * scalbn (double x, int n) - * scalbn(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an + * scalbn(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an * exponentiation or a multiplication. */ @@ -46,13 +46,13 @@ tiny = 1.0e-300; k = (hx&0x7ff00000)>>20; /* extract exponent */ if (k==0) { /* 0 or subnormal x */ if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ - x *= two54; + x *= two54; GET_HIGH_WORD(hx,x); - k = ((hx&0x7ff00000)>>20) - 54; + k = ((hx&0x7ff00000)>>20) - 54; if (n< -50000) return tiny*x; /*underflow*/ } if (k==0x7ff) return x+x; /* NaN or Inf */ - k = k+n; + k = k+n; if (k > 0x7fe) return huge*copysign(huge,x); /* overflow */ if (k > 0) /* normal result */ {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} diff --git a/lib/msun/src/s_scalbnf.c b/lib/msun/src/s_scalbnf.c index bae30d965cc0..08b16406a95a 100644 --- a/lib/msun/src/s_scalbnf.c +++ b/lib/msun/src/s_scalbnf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_scalbnf.c,v 1.2 1994/08/18 23:10:15 jtc Exp $"; +static char rcsid[] = "$Id: s_scalbnf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" @@ -44,11 +44,11 @@ tiny = 1.0e-30; if ((ix&0x7fffffff)==0) return x; /* +-0 */ x *= two25; GET_FLOAT_WORD(ix,x); - k = ((ix&0x7f800000)>>23) - 25; + k = ((ix&0x7f800000)>>23) - 25; if (n< -50000) return tiny*x; /*underflow*/ } if (k==0xff) return x+x; /* NaN or Inf */ - k = k+n; + k = k+n; if (k > 0xfe) return huge*copysignf(huge,x); /* overflow */ if (k > 0) /* normal result */ {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} diff --git a/lib/msun/src/s_significand.c b/lib/msun/src/s_significand.c index 424dbe9658b4..b30e6f290d77 100644 --- a/lib/msun/src/s_significand.c +++ b/lib/msun/src/s_significand.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_significand.c,v 1.4 1994/08/10 20:33:06 jtc Exp $"; +static char rcsid[] = "$Id: s_significand.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif /* diff --git a/lib/msun/src/s_significandf.c b/lib/msun/src/s_significandf.c index 883b3394c6c6..445f264151e4 100644 --- a/lib/msun/src/s_significandf.c +++ b/lib/msun/src/s_significandf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_significandf.c,v 1.1 1994/08/10 20:33:07 jtc Exp $"; +static char rcsid[] = "$Id: s_significandf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/s_sin.c b/lib/msun/src/s_sin.c index eff762aafa4f..a06d8b084d28 100644 --- a/lib/msun/src/s_sin.c +++ b/lib/msun/src/s_sin.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_sin.c,v 1.5 1994/08/18 23:10:17 jtc Exp $"; +static char rcsid[] = "$Id: s_sin.c,v 1.1.1.1 1994/08/19 09:39:52 jkh Exp $"; #endif /* sin(x) @@ -23,8 +23,8 @@ static char rcsid[] = "$Id: s_sin.c,v 1.5 1994/08/18 23:10:17 jtc Exp $"; * __ieee754_rem_pio2 ... argument reduction routine * * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * @@ -42,7 +42,7 @@ static char rcsid[] = "$Id: s_sin.c,v 1.5 1994/08/18 23:10:17 jtc Exp $"; * trig(NaN) is that NaN; * * Accuracy: - * TRIG(x) returns trig(x) nearly rounded + * TRIG(x) returns trig(x) nearly rounded */ #include "math.h" diff --git a/lib/msun/src/s_sinf.c b/lib/msun/src/s_sinf.c index b2fafe298823..69b4841191e4 100644 --- a/lib/msun/src/s_sinf.c +++ b/lib/msun/src/s_sinf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_sinf.c,v 1.2 1994/08/18 23:10:18 jtc Exp $"; +static char rcsid[] = "$Id: s_sinf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/s_tan.c b/lib/msun/src/s_tan.c index 97f7849ce63c..24a406323d27 100644 --- a/lib/msun/src/s_tan.c +++ b/lib/msun/src/s_tan.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_tan.c,v 1.5 1994/08/18 23:10:19 jtc Exp $"; +static char rcsid[] = "$Id: s_tan.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif /* tan(x) @@ -22,8 +22,8 @@ static char rcsid[] = "$Id: s_tan.c,v 1.5 1994/08/18 23:10:19 jtc Exp $"; * __ieee754_rem_pio2 ... argument reduction routine * * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 + * Let S,C and T denote the sin, cos and tan respectively on + * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 * in [-pi/4 , +pi/4], and let n = k mod 4. * We have * @@ -41,7 +41,7 @@ static char rcsid[] = "$Id: s_tan.c,v 1.5 1994/08/18 23:10:19 jtc Exp $"; * trig(NaN) is that NaN; * * Accuracy: - * TRIG(x) returns trig(x) nearly rounded + * TRIG(x) returns trig(x) nearly rounded */ #include "math.h" diff --git a/lib/msun/src/s_tanf.c b/lib/msun/src/s_tanf.c index dd993a65b11f..0fb7e19c411c 100644 --- a/lib/msun/src/s_tanf.c +++ b/lib/msun/src/s_tanf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_tanf.c,v 1.2 1994/08/18 23:10:20 jtc Exp $"; +static char rcsid[] = "$Id: s_tanf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/s_tanh.c b/lib/msun/src/s_tanh.c index c987a1a9b96e..dc1baaab9b9e 100644 --- a/lib/msun/src/s_tanh.c +++ b/lib/msun/src/s_tanh.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_tanh.c,v 1.5 1994/08/18 23:10:22 jtc Exp $"; +static char rcsid[] = "$Id: s_tanh.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif /* Tanh(x) @@ -62,7 +62,7 @@ static double one=1.0, two=2.0, tiny = 1.0e-300; ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7ff00000) { + if(ix>=0x7ff00000) { if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ else return one/x-one; /* tanh(NaN) = NaN */ } diff --git a/lib/msun/src/s_tanhf.c b/lib/msun/src/s_tanhf.c index aa1417627cf2..47908316047b 100644 --- a/lib/msun/src/s_tanhf.c +++ b/lib/msun/src/s_tanhf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: s_tanhf.c,v 1.2 1994/08/18 23:10:23 jtc Exp $"; +static char rcsid[] = "$Id: s_tanhf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif #include "math.h" @@ -40,7 +40,7 @@ static float one=1.0, two=2.0, tiny = 1.0e-30; ix = jx&0x7fffffff; /* x is INF or NaN */ - if(ix>=0x7f800000) { + if(ix>=0x7f800000) { if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ else return one/x-one; /* tanh(NaN) = NaN */ } diff --git a/lib/msun/src/w_acos.c b/lib/msun/src/w_acos.c index b5fefebd4907..af5f0227edf7 100644 --- a/lib/msun/src/w_acos.c +++ b/lib/msun/src/w_acos.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_acos.c,v 1.4 1994/08/10 20:33:18 jtc Exp $"; +static char rcsid[] = "$Id: w_acos.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif /* diff --git a/lib/msun/src/w_acosf.c b/lib/msun/src/w_acosf.c index 6c8fc6f9c74e..1501235e3c40 100644 --- a/lib/msun/src/w_acosf.c +++ b/lib/msun/src/w_acosf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_acosf.c,v 1.1 1994/08/10 20:33:23 jtc Exp $"; +static char rcsid[] = "$Id: w_acosf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif /* diff --git a/lib/msun/src/w_acosh.c b/lib/msun/src/w_acosh.c index 306cd3160d1d..d32cd3d32d47 100644 --- a/lib/msun/src/w_acosh.c +++ b/lib/msun/src/w_acosh.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_acosh.c,v 1.4 1994/08/10 20:33:25 jtc Exp $"; +static char rcsid[] = "$Id: w_acosh.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif -/* +/* * wrapper acosh(x) */ diff --git a/lib/msun/src/w_acoshf.c b/lib/msun/src/w_acoshf.c index 5ba01e468adb..232685309174 100644 --- a/lib/msun/src/w_acoshf.c +++ b/lib/msun/src/w_acoshf.c @@ -8,17 +8,17 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== * */ #ifndef lint -static char rcsid[] = "$Id: w_acoshf.c,v 1.1 1994/08/10 20:33:28 jtc Exp $"; +static char rcsid[] = "$Id: w_acoshf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif -/* +/* * wrapper acoshf(x) */ diff --git a/lib/msun/src/w_asin.c b/lib/msun/src/w_asin.c index f28c0183978b..7174df657fa1 100644 --- a/lib/msun/src/w_asin.c +++ b/lib/msun/src/w_asin.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_asin.c,v 1.4 1994/08/10 20:33:30 jtc Exp $"; +static char rcsid[] = "$Id: w_asin.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif -/* +/* * wrapper asin(x) */ diff --git a/lib/msun/src/w_asinf.c b/lib/msun/src/w_asinf.c index bdad94304459..fdc08d4b7ff5 100644 --- a/lib/msun/src/w_asinf.c +++ b/lib/msun/src/w_asinf.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_asinf.c,v 1.1 1994/08/10 20:33:34 jtc Exp $"; +static char rcsid[] = "$Id: w_asinf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif -/* +/* * wrapper asinf(x) */ diff --git a/lib/msun/src/w_atan2.c b/lib/msun/src/w_atan2.c index 1d4055d896be..b408ad6e561a 100644 --- a/lib/msun/src/w_atan2.c +++ b/lib/msun/src/w_atan2.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_atan2.c,v 1.4 1994/08/10 20:33:38 jtc Exp $"; +static char rcsid[] = "$Id: w_atan2.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif -/* +/* * wrapper atan2(y,x) */ diff --git a/lib/msun/src/w_atan2f.c b/lib/msun/src/w_atan2f.c index 376e3c03b4c6..403cc52f22d2 100644 --- a/lib/msun/src/w_atan2f.c +++ b/lib/msun/src/w_atan2f.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_atan2f.c,v 1.1 1994/08/10 20:33:41 jtc Exp $"; +static char rcsid[] = "$Id: w_atan2f.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif -/* +/* * wrapper atan2f(y,x) */ diff --git a/lib/msun/src/w_atanh.c b/lib/msun/src/w_atanh.c index 5c4d32768d08..c0774220be44 100644 --- a/lib/msun/src/w_atanh.c +++ b/lib/msun/src/w_atanh.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_atanh.c,v 1.4 1994/08/10 20:33:45 jtc Exp $"; +static char rcsid[] = "$Id: w_atanh.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif -/* +/* * wrapper atanh(x) */ @@ -39,7 +39,7 @@ static char rcsid[] = "$Id: w_atanh.c,v 1.4 1994/08/10 20:33:45 jtc Exp $"; if(y>=1.0) { if(y>1.0) return __kernel_standard(x,x,30); /* atanh(|x|>1) */ - else + else return __kernel_standard(x,x,31); /* atanh(|x|==1) */ } else return z; diff --git a/lib/msun/src/w_atanhf.c b/lib/msun/src/w_atanhf.c index cbf844162dec..8e6fe1a185e1 100644 --- a/lib/msun/src/w_atanhf.c +++ b/lib/msun/src/w_atanhf.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_atanhf.c,v 1.1 1994/08/10 20:33:48 jtc Exp $"; +static char rcsid[] = "$Id: w_atanhf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif -/* +/* * wrapper atanhf(x) */ @@ -43,7 +43,7 @@ static char rcsid[] = "$Id: w_atanhf.c,v 1.1 1994/08/10 20:33:48 jtc Exp $"; if(y>(float)1.0) /* atanhf(|x|>1) */ return (float)__kernel_standard((double)x,(double)x,130); - else + else /* atanhf(|x|==1) */ return (float)__kernel_standard((double)x,(double)x,131); } else diff --git a/lib/msun/src/w_cabs.c b/lib/msun/src/w_cabs.c index a62592b2feea..b140515973f9 100644 --- a/lib/msun/src/w_cabs.c +++ b/lib/msun/src/w_cabs.c @@ -1,6 +1,6 @@ /* * cabs() wrapper for hypot(). - * + * * Written by J.T. Conklin, <jtc@wimsey.com> * Placed into the Public Domain, 1994. */ diff --git a/lib/msun/src/w_cabsf.c b/lib/msun/src/w_cabsf.c index d957a06908a6..6336d6d54564 100644 --- a/lib/msun/src/w_cabsf.c +++ b/lib/msun/src/w_cabsf.c @@ -1,6 +1,6 @@ /* * cabsf() wrapper for hypotf(). - * + * * Written by J.T. Conklin, <jtc@wimsey.com> * Placed into the Public Domain, 1994. */ diff --git a/lib/msun/src/w_cosh.c b/lib/msun/src/w_cosh.c index 02d3a3cadac7..5386838ffc72 100644 --- a/lib/msun/src/w_cosh.c +++ b/lib/msun/src/w_cosh.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_cosh.c,v 1.4 1994/08/10 20:33:54 jtc Exp $"; +static char rcsid[] = "$Id: w_cosh.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif -/* +/* * wrapper cosh(x) */ @@ -34,7 +34,7 @@ static char rcsid[] = "$Id: w_cosh.c,v 1.4 1994/08/10 20:33:54 jtc Exp $"; double z; z = __ieee754_cosh(x); if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; - if(fabs(x)>7.10475860073943863426e+02) { + if(fabs(x)>7.10475860073943863426e+02) { return __kernel_standard(x,x,5); /* cosh overflow */ } else return z; diff --git a/lib/msun/src/w_coshf.c b/lib/msun/src/w_coshf.c index eddc5f58dd2d..64fd579640f6 100644 --- a/lib/msun/src/w_coshf.c +++ b/lib/msun/src/w_coshf.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_coshf.c,v 1.1 1994/08/10 20:33:56 jtc Exp $"; +static char rcsid[] = "$Id: w_coshf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif -/* +/* * wrapper coshf(x) */ @@ -37,7 +37,7 @@ static char rcsid[] = "$Id: w_coshf.c,v 1.1 1994/08/10 20:33:56 jtc Exp $"; float z; z = __ieee754_coshf(x); if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z; - if(fabsf(x)>(float)8.9415985107e+01) { + if(fabsf(x)>(float)8.9415985107e+01) { /* cosh overflow */ return (float)__kernel_standard((double)x,(double)x,105); } else diff --git a/lib/msun/src/w_drem.c b/lib/msun/src/w_drem.c index 7f5049340381..0f6840934fef 100644 --- a/lib/msun/src/w_drem.c +++ b/lib/msun/src/w_drem.c @@ -1,6 +1,6 @@ /* * drem() wrapper for remainder(). - * + * * Written by J.T. Conklin, <jtc@wimsey.com> * Placed into the Public Domain, 1994. */ diff --git a/lib/msun/src/w_dremf.c b/lib/msun/src/w_dremf.c index 9f1de53567e2..92079a9a7bf3 100644 --- a/lib/msun/src/w_dremf.c +++ b/lib/msun/src/w_dremf.c @@ -1,6 +1,6 @@ /* * dremf() wrapper for remainderf(). - * + * * Written by J.T. Conklin, <jtc@wimsey.com> * Placed into the Public Domain, 1994. */ diff --git a/lib/msun/src/w_exp.c b/lib/msun/src/w_exp.c index 80f213b25f39..0d592ee5004e 100644 --- a/lib/msun/src/w_exp.c +++ b/lib/msun/src/w_exp.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_exp.c,v 1.4 1994/08/10 20:34:00 jtc Exp $"; +static char rcsid[] = "$Id: w_exp.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif -/* +/* * wrapper exp(x) */ @@ -47,7 +47,7 @@ u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */ return __kernel_standard(x,x,6); /* exp overflow */ else if(x<u_threshold) return __kernel_standard(x,x,7); /* exp underflow */ - } + } return z; #endif } diff --git a/lib/msun/src/w_expf.c b/lib/msun/src/w_expf.c index 62a77736f067..e22a951e92c9 100644 --- a/lib/msun/src/w_expf.c +++ b/lib/msun/src/w_expf.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_expf.c,v 1.1 1994/08/10 20:34:03 jtc Exp $"; +static char rcsid[] = "$Id: w_expf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif -/* +/* * wrapper expf(x) */ @@ -52,7 +52,7 @@ u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */ else if(x<u_threshold) /* exp underflow */ return (float)__kernel_standard((double)x,(double)x,107); - } + } return z; #endif } diff --git a/lib/msun/src/w_fmod.c b/lib/msun/src/w_fmod.c index 234a3429ec64..4065409d170e 100644 --- a/lib/msun/src/w_fmod.c +++ b/lib/msun/src/w_fmod.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_fmod.c,v 1.4 1994/08/10 20:34:05 jtc Exp $"; +static char rcsid[] = "$Id: w_fmod.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif -/* +/* * wrapper fmod(x,y) */ diff --git a/lib/msun/src/w_fmodf.c b/lib/msun/src/w_fmodf.c index 8081ed40b201..5c0c43209af2 100644 --- a/lib/msun/src/w_fmodf.c +++ b/lib/msun/src/w_fmodf.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_fmodf.c,v 1.1 1994/08/10 20:34:07 jtc Exp $"; +static char rcsid[] = "$Id: w_fmodf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif -/* +/* * wrapper fmodf(x,y) */ diff --git a/lib/msun/src/w_gamma.c b/lib/msun/src/w_gamma.c index f32f2863311e..bf53f1874931 100644 --- a/lib/msun/src/w_gamma.c +++ b/lib/msun/src/w_gamma.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_gamma.c,v 1.4 1994/08/10 20:34:09 jtc Exp $"; +static char rcsid[] = "$Id: w_gamma.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif /* double gamma(double x) @@ -46,4 +46,4 @@ extern int signgam; } else return y; #endif -} +} diff --git a/lib/msun/src/w_gamma_r.c b/lib/msun/src/w_gamma_r.c index b31486e98588..7aad6133c320 100644 --- a/lib/msun/src/w_gamma_r.c +++ b/lib/msun/src/w_gamma_r.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_gamma_r.c,v 1.4 1994/08/10 20:34:13 jtc Exp $"; +static char rcsid[] = "$Id: w_gamma_r.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif -/* +/* * wrapper double gamma_r(double x, int *signgamp) */ @@ -43,4 +43,4 @@ static char rcsid[] = "$Id: w_gamma_r.c,v 1.4 1994/08/10 20:34:13 jtc Exp $"; } else return y; #endif -} +} diff --git a/lib/msun/src/w_gammaf.c b/lib/msun/src/w_gammaf.c index 1183c79191d9..89e8f7fa26a1 100644 --- a/lib/msun/src/w_gammaf.c +++ b/lib/msun/src/w_gammaf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_gammaf.c,v 1.1 1994/08/10 20:34:16 jtc Exp $"; +static char rcsid[] = "$Id: w_gammaf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif #include "math.h" @@ -45,4 +45,4 @@ extern int signgam; } else return y; #endif -} +} diff --git a/lib/msun/src/w_gammaf_r.c b/lib/msun/src/w_gammaf_r.c index 0fd1f6c8aeac..a2585cbb300a 100644 --- a/lib/msun/src/w_gammaf_r.c +++ b/lib/msun/src/w_gammaf_r.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_gammaf_r.c,v 1.1 1994/08/10 20:34:20 jtc Exp $"; +static char rcsid[] = "$Id: w_gammaf_r.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif -/* +/* * wrapper float gammaf_r(float x, int *signgamp) */ @@ -48,4 +48,4 @@ static char rcsid[] = "$Id: w_gammaf_r.c,v 1.1 1994/08/10 20:34:20 jtc Exp $"; } else return y; #endif -} +} diff --git a/lib/msun/src/w_hypot.c b/lib/msun/src/w_hypot.c index 8c61649646a2..9b6f46fcf652 100644 --- a/lib/msun/src/w_hypot.c +++ b/lib/msun/src/w_hypot.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_hypot.c,v 1.4 1994/08/10 20:34:24 jtc Exp $"; +static char rcsid[] = "$Id: w_hypot.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif /* diff --git a/lib/msun/src/w_hypotf.c b/lib/msun/src/w_hypotf.c index c8ddb9747441..0b126d702cd7 100644 --- a/lib/msun/src/w_hypotf.c +++ b/lib/msun/src/w_hypotf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_hypotf.c,v 1.1 1994/08/10 20:34:27 jtc Exp $"; +static char rcsid[] = "$Id: w_hypotf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif /* diff --git a/lib/msun/src/w_j0.c b/lib/msun/src/w_j0.c index 199f85167c24..c5b9fe053584 100644 --- a/lib/msun/src/w_j0.c +++ b/lib/msun/src/w_j0.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_j0.c,v 1.4 1994/08/10 20:34:29 jtc Exp $"; +static char rcsid[] = "$Id: w_j0.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif /* diff --git a/lib/msun/src/w_j0f.c b/lib/msun/src/w_j0f.c index 33e201c6b0a3..e836edc55f5c 100644 --- a/lib/msun/src/w_j0f.c +++ b/lib/msun/src/w_j0f.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_j0f.c,v 1.1 1994/08/10 20:34:32 jtc Exp $"; +static char rcsid[] = "$Id: w_j0f.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $"; #endif /* diff --git a/lib/msun/src/w_j1.c b/lib/msun/src/w_j1.c index 38792b6a3ffa..c0204bd94c84 100644 --- a/lib/msun/src/w_j1.c +++ b/lib/msun/src/w_j1.c @@ -5,17 +5,17 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_j1.c,v 1.4 1994/08/10 20:34:35 jtc Exp $"; +static char rcsid[] = "$Id: w_j1.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif -/* - * wrapper of j1,y1 +/* + * wrapper of j1,y1 */ #include "math.h" diff --git a/lib/msun/src/w_j1f.c b/lib/msun/src/w_j1f.c index 506b8235ff74..60b9e21abcd2 100644 --- a/lib/msun/src/w_j1f.c +++ b/lib/msun/src/w_j1f.c @@ -8,17 +8,17 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_j1f.c,v 1.1 1994/08/10 20:34:39 jtc Exp $"; +static char rcsid[] = "$Id: w_j1f.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif -/* - * wrapper of j1f,y1f +/* + * wrapper of j1f,y1f */ #include "math.h" diff --git a/lib/msun/src/w_jn.c b/lib/msun/src/w_jn.c index 986265043188..2fb8365ecd99 100644 --- a/lib/msun/src/w_jn.c +++ b/lib/msun/src/w_jn.c @@ -5,20 +5,20 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_jn.c,v 1.4 1994/08/10 20:34:42 jtc Exp $"; +static char rcsid[] = "$Id: w_jn.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif /* * wrapper jn(int n, double x), yn(int n, double x) * floating point Bessel's function of the 1st and 2nd kind * of order n - * + * * Special cases: * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. @@ -37,7 +37,7 @@ static char rcsid[] = "$Id: w_jn.c,v 1.4 1994/08/10 20:34:42 jtc Exp $"; * yn(n,x) is similar in all respects, except * that forward recursion is used for all * values of n>1. - * + * */ #include "math.h" diff --git a/lib/msun/src/w_jnf.c b/lib/msun/src/w_jnf.c index 0b338009322d..00b2ddfa3de0 100644 --- a/lib/msun/src/w_jnf.c +++ b/lib/msun/src/w_jnf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_jnf.c,v 1.1 1994/08/10 20:34:47 jtc Exp $"; +static char rcsid[] = "$Id: w_jnf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif #include "math.h" diff --git a/lib/msun/src/w_lgamma.c b/lib/msun/src/w_lgamma.c index 59892e3fe9c6..f15cb9d14899 100644 --- a/lib/msun/src/w_lgamma.c +++ b/lib/msun/src/w_lgamma.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_lgamma.c,v 1.4 1994/08/10 20:34:53 jtc Exp $"; +static char rcsid[] = "$Id: w_lgamma.c,v 1.1.1.1 1994/08/19 09:39:53 jkh Exp $"; #endif /* double lgamma(double x) @@ -46,4 +46,4 @@ extern int signgam; } else return y; #endif -} +} diff --git a/lib/msun/src/w_lgamma_r.c b/lib/msun/src/w_lgamma_r.c index 52117c07ad51..2cac60c13ba5 100644 --- a/lib/msun/src/w_lgamma_r.c +++ b/lib/msun/src/w_lgamma_r.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_lgamma_r.c,v 1.4 1994/08/10 20:34:57 jtc Exp $"; +static char rcsid[] = "$Id: w_lgamma_r.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif -/* +/* * wrapper double lgamma_r(double x, int *signgamp) */ @@ -43,4 +43,4 @@ static char rcsid[] = "$Id: w_lgamma_r.c,v 1.4 1994/08/10 20:34:57 jtc Exp $"; } else return y; #endif -} +} diff --git a/lib/msun/src/w_lgammaf.c b/lib/msun/src/w_lgammaf.c index 74588f301d8c..e4b2aa20ee79 100644 --- a/lib/msun/src/w_lgammaf.c +++ b/lib/msun/src/w_lgammaf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_lgammaf.c,v 1.1 1994/08/10 20:35:00 jtc Exp $"; +static char rcsid[] = "$Id: w_lgammaf.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif #include "math.h" @@ -45,4 +45,4 @@ extern int signgam; } else return y; #endif -} +} diff --git a/lib/msun/src/w_lgammaf_r.c b/lib/msun/src/w_lgammaf_r.c index 7e477e9943e7..3fd4f227c533 100644 --- a/lib/msun/src/w_lgammaf_r.c +++ b/lib/msun/src/w_lgammaf_r.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_lgammaf_r.c,v 1.1 1994/08/10 20:35:05 jtc Exp $"; +static char rcsid[] = "$Id: w_lgammaf_r.c,v 1.1.1.1 1994/08/19 09:39:59 jkh Exp $"; #endif -/* +/* * wrapper float lgammaf_r(float x, int *signgamp) */ @@ -48,4 +48,4 @@ static char rcsid[] = "$Id: w_lgammaf_r.c,v 1.1 1994/08/10 20:35:05 jtc Exp $"; } else return y; #endif -} +} diff --git a/lib/msun/src/w_log.c b/lib/msun/src/w_log.c index 26f0ae6b6eb2..e5b8afde387f 100644 --- a/lib/msun/src/w_log.c +++ b/lib/msun/src/w_log.c @@ -5,13 +5,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_log.c,v 1.4 1994/08/10 20:35:09 jtc Exp $"; +static char rcsid[] = "$Id: w_log.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif /* @@ -37,7 +37,7 @@ static char rcsid[] = "$Id: w_log.c,v 1.4 1994/08/10 20:35:09 jtc Exp $"; if(_LIB_VERSION == _IEEE_ || isnan(x) || x > 0.0) return z; if(x==0.0) return __kernel_standard(x,x,16); /* log(0) */ - else + else return __kernel_standard(x,x,17); /* log(x<0) */ #endif } diff --git a/lib/msun/src/w_log10.c b/lib/msun/src/w_log10.c index d3c1f5a462d9..c09deeb78e3f 100644 --- a/lib/msun/src/w_log10.c +++ b/lib/msun/src/w_log10.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_log10.c,v 1.4 1994/08/10 20:35:15 jtc Exp $"; +static char rcsid[] = "$Id: w_log10.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif -/* +/* * wrapper log10(X) */ @@ -38,7 +38,7 @@ static char rcsid[] = "$Id: w_log10.c,v 1.4 1994/08/10 20:35:15 jtc Exp $"; if(x<=0.0) { if(x==0.0) return __kernel_standard(x,x,18); /* log10(0) */ - else + else return __kernel_standard(x,x,19); /* log10(x<0) */ } else return z; diff --git a/lib/msun/src/w_log10f.c b/lib/msun/src/w_log10f.c index 1c732241547f..31a94107239f 100644 --- a/lib/msun/src/w_log10f.c +++ b/lib/msun/src/w_log10f.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_log10f.c,v 1.1 1994/08/10 20:35:20 jtc Exp $"; +static char rcsid[] = "$Id: w_log10f.c,v 1.1.1.1 1994/08/19 09:40:00 jkh Exp $"; #endif -/* +/* * wrapper log10f(X) */ @@ -42,7 +42,7 @@ static char rcsid[] = "$Id: w_log10f.c,v 1.1 1994/08/10 20:35:20 jtc Exp $"; if(x==(float)0.0) /* log10(0) */ return (float)__kernel_standard((double)x,(double)x,118); - else + else /* log10(x<0) */ return (float)__kernel_standard((double)x,(double)x,119); } else diff --git a/lib/msun/src/w_logf.c b/lib/msun/src/w_logf.c index 77dcf1e338bf..3f3f8d47aab0 100644 --- a/lib/msun/src/w_logf.c +++ b/lib/msun/src/w_logf.c @@ -8,13 +8,13 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_logf.c,v 1.1 1994/08/10 20:35:23 jtc Exp $"; +static char rcsid[] = "$Id: w_logf.c,v 1.1.1.1 1994/08/19 09:40:00 jkh Exp $"; #endif /* @@ -41,7 +41,7 @@ static char rcsid[] = "$Id: w_logf.c,v 1.1 1994/08/10 20:35:23 jtc Exp $"; if(x==(float)0.0) /* logf(0) */ return (float)__kernel_standard((double)x,(double)x,116); - else + else /* logf(x<0) */ return (float)__kernel_standard((double)x,(double)x,117); #endif diff --git a/lib/msun/src/w_pow.c b/lib/msun/src/w_pow.c index 6d87ee558f56..571897cca041 100644 --- a/lib/msun/src/w_pow.c +++ b/lib/msun/src/w_pow.c @@ -7,12 +7,12 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ -/* +/* * wrapper pow(x,y) return x**y */ @@ -34,12 +34,12 @@ z=__ieee754_pow(x,y); if(_LIB_VERSION == _IEEE_|| isnan(y)) return z; if(isnan(x)) { - if(y==0.0) + if(y==0.0) return __kernel_standard(x,y,42); /* pow(NaN,0.0) */ - else + else return z; } - if(x==0.0){ + if(x==0.0){ if(y==0.0) return __kernel_standard(x,y,20); /* pow(0.0,0.0) */ if(finite(y)&&y<0.0) @@ -50,10 +50,10 @@ if(finite(x)&&finite(y)) { if(isnan(z)) return __kernel_standard(x,y,24); /* pow neg**non-int */ - else + else return __kernel_standard(x,y,21); /* pow overflow */ } - } + } if(z==0.0&&finite(x)&&finite(y)) return __kernel_standard(x,y,22); /* pow underflow */ return z; diff --git a/lib/msun/src/w_powf.c b/lib/msun/src/w_powf.c index c8ab5eb7b203..40fb91fc858e 100644 --- a/lib/msun/src/w_powf.c +++ b/lib/msun/src/w_powf.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_powf.c,v 1.1 1994/08/10 20:35:29 jtc Exp $"; +static char rcsid[] = "$Id: w_powf.c,v 1.1.1.1 1994/08/19 09:40:00 jkh Exp $"; #endif -/* +/* * wrapper powf(x,y) return x**y */ @@ -39,13 +39,13 @@ static char rcsid[] = "$Id: w_powf.c,v 1.1 1994/08/10 20:35:29 jtc Exp $"; z=__ieee754_powf(x,y); if(_LIB_VERSION == _IEEE_|| isnanf(y)) return z; if(isnanf(x)) { - if(y==(float)0.0) + if(y==(float)0.0) /* powf(NaN,0.0) */ return (float)__kernel_standard((double)x,(double)y,142); - else + else return z; } - if(x==(float)0.0){ + if(x==(float)0.0){ if(y==(float)0.0) /* powf(0.0,0.0) */ return (float)__kernel_standard((double)x,(double)y,120); @@ -59,11 +59,11 @@ static char rcsid[] = "$Id: w_powf.c,v 1.1 1994/08/10 20:35:29 jtc Exp $"; if(isnanf(z)) /* powf neg**non-int */ return (float)__kernel_standard((double)x,(double)y,124); - else + else /* powf overflow */ return (float)__kernel_standard((double)x,(double)y,121); } - } + } if(z==(float)0.0&&finitef(x)&&finitef(y)) /* powf underflow */ return (float)__kernel_standard((double)x,(double)y,122); diff --git a/lib/msun/src/w_remainder.c b/lib/msun/src/w_remainder.c index 98e4df2a472f..dd0f11215714 100644 --- a/lib/msun/src/w_remainder.c +++ b/lib/msun/src/w_remainder.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_remainder.c,v 1.4 1994/08/10 20:35:32 jtc Exp $"; +static char rcsid[] = "$Id: w_remainder.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif -/* +/* * wrapper remainder(x,p) */ @@ -34,7 +34,7 @@ static char rcsid[] = "$Id: w_remainder.c,v 1.4 1994/08/10 20:35:32 jtc Exp $"; double z; z = __ieee754_remainder(x,y); if(_LIB_VERSION == _IEEE_ || isnan(y)) return z; - if(y==0.0) + if(y==0.0) return __kernel_standard(x,y,28); /* remainder(x,0) */ else return z; diff --git a/lib/msun/src/w_remainderf.c b/lib/msun/src/w_remainderf.c index ddc081890ced..a7f3e469e6cc 100644 --- a/lib/msun/src/w_remainderf.c +++ b/lib/msun/src/w_remainderf.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_remainderf.c,v 1.1 1994/08/10 20:35:35 jtc Exp $"; +static char rcsid[] = "$Id: w_remainderf.c,v 1.1.1.1 1994/08/19 09:40:00 jkh Exp $"; #endif -/* +/* * wrapper remainderf(x,p) */ @@ -37,7 +37,7 @@ static char rcsid[] = "$Id: w_remainderf.c,v 1.1 1994/08/10 20:35:35 jtc Exp $"; float z; z = __ieee754_remainderf(x,y); if(_LIB_VERSION == _IEEE_ || isnanf(y)) return z; - if(y==(float)0.0) + if(y==(float)0.0) /* remainder(x,0) */ return (float)__kernel_standard((double)x,(double)y,128); else diff --git a/lib/msun/src/w_scalb.c b/lib/msun/src/w_scalb.c index b7a7ec68e6ef..9e3ce15042c7 100644 --- a/lib/msun/src/w_scalb.c +++ b/lib/msun/src/w_scalb.c @@ -5,18 +5,18 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_scalb.c,v 1.4 1994/08/10 20:35:37 jtc Exp $"; +static char rcsid[] = "$Id: w_scalb.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif /* * wrapper scalb(double x, double fn) is provide for - * passing various standard test suite. One + * passing various standard test suite. One * should use scalbn() instead. */ @@ -51,10 +51,10 @@ static char rcsid[] = "$Id: w_scalb.c,v 1.4 1994/08/10 20:35:37 jtc Exp $"; } if(z==0.0&&z!=x) { return __kernel_standard(x,(double)fn,33); /* scalb underflow */ - } + } #ifndef _SCALB_INT if(!finite(fn)) errno = ERANGE; #endif return z; -#endif +#endif } diff --git a/lib/msun/src/w_scalbf.c b/lib/msun/src/w_scalbf.c index 9e47c7035faa..469525cfc17f 100644 --- a/lib/msun/src/w_scalbf.c +++ b/lib/msun/src/w_scalbf.c @@ -8,18 +8,18 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_scalbf.c,v 1.1 1994/08/10 20:35:40 jtc Exp $"; +static char rcsid[] = "$Id: w_scalbf.c,v 1.1.1.1 1994/08/19 09:40:00 jkh Exp $"; #endif /* * wrapper scalbf(float x, float fn) is provide for - * passing various standard test suite. One + * passing various standard test suite. One * should use scalbn() instead. */ @@ -56,10 +56,10 @@ static char rcsid[] = "$Id: w_scalbf.c,v 1.1 1994/08/10 20:35:40 jtc Exp $"; if(z==(float)0.0&&z!=x) { /* scalbf underflow */ return (float)__kernel_standard((double)x,(double)fn,133); - } + } #ifndef _SCALB_INT if(!finitef(fn)) errno = ERANGE; #endif return z; -#endif +#endif } diff --git a/lib/msun/src/w_sinh.c b/lib/msun/src/w_sinh.c index 241e335e2948..8498dbe87e33 100644 --- a/lib/msun/src/w_sinh.c +++ b/lib/msun/src/w_sinh.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_sinh.c,v 1.4 1994/08/10 20:35:42 jtc Exp $"; +static char rcsid[] = "$Id: w_sinh.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif -/* +/* * wrapper sinh(x) */ @@ -31,7 +31,7 @@ static char rcsid[] = "$Id: w_sinh.c,v 1.4 1994/08/10 20:35:42 jtc Exp $"; #ifdef _IEEE_LIBM return __ieee754_sinh(x); #else - double z; + double z; z = __ieee754_sinh(x); if(_LIB_VERSION == _IEEE_) return z; if(!finite(z)&&finite(x)) { diff --git a/lib/msun/src/w_sinhf.c b/lib/msun/src/w_sinhf.c index dca5bfa6d254..5f1467dc1d22 100644 --- a/lib/msun/src/w_sinhf.c +++ b/lib/msun/src/w_sinhf.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_sinhf.c,v 1.1 1994/08/10 20:35:45 jtc Exp $"; +static char rcsid[] = "$Id: w_sinhf.c,v 1.1.1.1 1994/08/19 09:40:00 jkh Exp $"; #endif -/* +/* * wrapper sinhf(x) */ @@ -34,7 +34,7 @@ static char rcsid[] = "$Id: w_sinhf.c,v 1.1 1994/08/10 20:35:45 jtc Exp $"; #ifdef _IEEE_LIBM return __ieee754_sinhf(x); #else - float z; + float z; z = __ieee754_sinhf(x); if(_LIB_VERSION == _IEEE_) return z; if(!finitef(z)&&finitef(x)) { diff --git a/lib/msun/src/w_sqrt.c b/lib/msun/src/w_sqrt.c index 696f45a9fa0e..bdf97d21e086 100644 --- a/lib/msun/src/w_sqrt.c +++ b/lib/msun/src/w_sqrt.c @@ -5,16 +5,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_sqrt.c,v 1.4 1994/08/10 20:35:48 jtc Exp $"; +static char rcsid[] = "$Id: w_sqrt.c,v 1.1.1.1 1994/08/19 09:39:54 jkh Exp $"; #endif -/* +/* * wrapper sqrt(x) */ diff --git a/lib/msun/src/w_sqrtf.c b/lib/msun/src/w_sqrtf.c index c248f0c95017..55631bff8012 100644 --- a/lib/msun/src/w_sqrtf.c +++ b/lib/msun/src/w_sqrtf.c @@ -8,16 +8,16 @@ * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice + * software is freely granted, provided that this notice * is preserved. * ==================================================== */ #ifndef lint -static char rcsid[] = "$Id: w_sqrtf.c,v 1.1 1994/08/10 20:35:53 jtc Exp $"; +static char rcsid[] = "$Id: w_sqrtf.c,v 1.1.1.1 1994/08/19 09:40:00 jkh Exp $"; #endif -/* +/* * wrapper sqrtf(x) */ diff --git a/libexec/atrun/atrun.c b/libexec/atrun/atrun.c index 68b0207fff4b..3ae9ee78decd 100644 --- a/libexec/atrun/atrun.c +++ b/libexec/atrun/atrun.c @@ -1,4 +1,4 @@ -/* +/* * atrun.c - run jobs queued by at; run with root privileges. * Copyright (C) 1993, 1994 Thomas Koenig * @@ -73,7 +73,7 @@ /* File scope variables */ static char *namep; -static char rcsid[] = "$Id: atrun.c,v 1.2 1995/04/12 02:52:15 ache Exp $"; +static char rcsid[] = "$Id: atrun.c,v 1.3 1995/04/12 19:21:43 ache Exp $"; static debug = 0; /* Local functions */ @@ -142,7 +142,7 @@ run_file(const char *filename, uid_t uid, gid_t gid) pid = fork(); if (pid == -1) perr("Cannot fork"); - + else if (pid > 0) return; @@ -192,10 +192,10 @@ run_file(const char *filename, uid_t uid, gid_t gid) fclose(stream); if (chdir(ATSPOOL_DIR) < 0) perr("Cannot chdir to " ATSPOOL_DIR); - + /* Create a file to hold the output of the job we are about to run. * Write the mail header. - */ + */ if((fd_out=open(filename, O_WRONLY | O_CREAT | O_EXCL, S_IWUSR | S_IRUSR)) < 0) perr("Cannot create output file"); @@ -209,7 +209,7 @@ run_file(const char *filename, uid_t uid, gid_t gid) close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); - + pid = fork(); if (pid < 0) perr("Error in fork"); @@ -245,7 +245,7 @@ run_file(const char *filename, uid_t uid, gid_t gid) PRIV_START nice(tolower(queue) - 'a'); - + chdir(pentry->pw_dir); if (initgroups(pentry->pw_name,pentry->pw_gid)) @@ -277,7 +277,7 @@ run_file(const char *filename, uid_t uid, gid_t gid) unlink(filename); if ((buf.st_size != size) || send_mail) - { + { #ifdef __FreeBSD__ execl(_PATH_SENDMAIL, "sendmail", "-F", "Atrun Service", "-odi", "-oem", @@ -332,7 +332,7 @@ main(int argc, char *argv[]) { switch (c) { - case 'l': + case 'l': if (sscanf(optarg, "%lf", &load_avg) != 1) perr("garbled option -l"); if (load_avg <= 0.) @@ -382,7 +382,7 @@ main(int argc, char *argv[]) /* We don't want directories */ - if (!S_ISREG(buf.st_mode)) + if (!S_ISREG(buf.st_mode)) continue; if (sscanf(dirent->d_name,"%c%8lx",&queue,&ctm) != 2) @@ -399,7 +399,7 @@ main(int argc, char *argv[]) batch_uid = buf.st_uid; batch_gid = buf.st_gid; } - + /* The file is executable and old enough */ if (islower(queue)) diff --git a/libexec/bootpd/Makefile b/libexec/bootpd/Makefile index de4dfdbd44fc..2b00e81f4da1 100644 --- a/libexec/bootpd/Makefile +++ b/libexec/bootpd/Makefile @@ -1,8 +1,8 @@ # bootpd/Makefile -# $Id: Makefile,v 1.2 1994/09/10 14:59:55 csgr Exp $ +# $Id: Makefile,v 1.1.1.1 1994/09/30 05:45:04 pst Exp $ PROG= bootpd -#CFLAGS+= -DETC_ETHERS +#CFLAGS+= -DETC_ETHERS CFLAGS+= -DSYSLOG -DDEBUG -DVEND_CMU SUBDIR= tools diff --git a/libexec/bootpd/bootpd.c b/libexec/bootpd/bootpd.c index 323132a80a06..cf693fd6cc0c 100644 --- a/libexec/bootpd/bootpd.c +++ b/libexec/bootpd/bootpd.c @@ -21,7 +21,7 @@ SOFTWARE. ************************************************************************/ #ifndef lint -static char rcsid[] = "$Id: bootpd.c,v 1.1.1.1 1994/09/10 14:44:54 csgr Exp $"; +static char rcsid[] = "$Id: bootpd.c,v 1.1.1.1 1994/09/30 05:45:04 pst Exp $"; #endif /* @@ -1235,7 +1235,7 @@ dovend_rfc1048(bp, hp, bootsize) byte *p, *ep; byte tag, len; short msgsz = 0; - + p = vp + 4; ep = p + BP_VEND_LEN - 4; while (p < ep) { diff --git a/libexec/bootpd/rtmsg.c b/libexec/bootpd/rtmsg.c index 41b8273dcc67..5942b22d13f4 100644 --- a/libexec/bootpd/rtmsg.c +++ b/libexec/bootpd/rtmsg.c @@ -39,7 +39,7 @@ /* * from arp.c 8.2 (Berkeley) 1/2/94 - * $Id: rtmsg.c,v 1.2 1995/01/16 18:57:45 dfr Exp $ + * $Id: rtmsg.c,v 1.3 1995/01/30 11:11:43 dfr Exp $ */ #include <sys/param.h> @@ -111,7 +111,7 @@ static struct { } m_rtmsg; /* - * Set an individual arp entry + * Set an individual arp entry */ int bsd_arp_set(ia, eaddr, len) struct in_addr *ia; @@ -156,12 +156,12 @@ tryagain: goto overwrite; } if (doing_proxy == 0) { - report(LOG_WARNING, "set: can only proxy for %s\n", + report(LOG_WARNING, "set: can only proxy for %s\n", inet_ntoa(sin->sin_addr)); return (1); } if (sin_m.sin_other & SIN_PROXY) { - report(LOG_WARNING, + report(LOG_WARNING, "set: proxy entry exists for non 802 device\n"); return(1); } @@ -172,7 +172,7 @@ tryagain: overwrite: if (sdl->sdl_family != AF_LINK) { report(LOG_WARNING, - "cannot intuit interface index and type for %s\n", + "cannot intuit interface index and type for %s\n", inet_ntoa(sin->sin_addr)); return (1); } diff --git a/libexec/bootpd/tools/bootptest/Makefile b/libexec/bootpd/tools/bootptest/Makefile index c154d9798381..5350b7ce64b5 100644 --- a/libexec/bootpd/tools/bootptest/Makefile +++ b/libexec/bootpd/tools/bootptest/Makefile @@ -1,9 +1,9 @@ # Makefile -# $Id$ +# $Id: Makefile,v 1.1.1.1 1994/09/30 05:45:07 pst Exp $ PROG= bootptest MAN8= bootptest.8 -SRCS= bootptest.o print-bootp.o getif.o getether.o report.o +SRCS= bootptest.o print-bootp.o getif.o getether.o report.o SRCDIR= ${.CURDIR}/../.. CFLAGS+=-I${SRCDIR} diff --git a/libexec/fingerd/fingerd.c b/libexec/fingerd/fingerd.c index 4a80e11f544e..7f88bf44f063 100644 --- a/libexec/fingerd/fingerd.c +++ b/libexec/fingerd/fingerd.c @@ -105,7 +105,7 @@ main(argc, argv) if (!fgets(line, sizeof(line), stdin)) exit(1); - + comp = &av[1]; for (lp = line, ap = &av[2];;) { *ap = strtok(lp, " \t\r\n"); diff --git a/libexec/ftpd/Makefile b/libexec/ftpd/Makefile index ba6cb99cd55d..adcc9198f807 100644 --- a/libexec/ftpd/Makefile +++ b/libexec/ftpd/Makefile @@ -7,7 +7,7 @@ SRCS= ftpd.c ftpcmd.c logwtmp.c popen.c skey-stuff.c CFLAGS+=-DSETPROCTITLE -DSKEY -DSTATS LDADD= -lskey -lmd -lcrypt -DPADD= ${LIBSKEY} ${LIBMD} ${LIBCRYPT} +DPADD= ${LIBSKEY} ${LIBMD} ${LIBCRYPT} CLEANFILES+=ftpcmd.c y.tab.h diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 885166cfbc05..f6fc3795f5ef 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: ftpd.c,v 1.9 1995/05/22 11:03:55 davidg Exp $ */ #ifndef lint @@ -1019,7 +1019,7 @@ send_data(instr, outstr, blksize, filesize, isreg) * are sending a regular file */ netfd = fileno(outstr); - filefd = fileno(instr); + filefd = fileno(instr); if (isreg && filesize < (off_t)16 * 1024 * 1024) { buf = mmap(0, filesize, PROT_READ, MAP_SHARED, filefd, @@ -1052,7 +1052,7 @@ oldway: perror_reply(451, "Local resource failure: malloc"); return; } - + while ((cnt = read(filefd, buf, (u_int)blksize)) > 0 && write(netfd, buf, cnt) == cnt) byte_count += cnt; diff --git a/libexec/getty/main.c b/libexec/getty/main.c index 3a0336aefd83..a161ed54eb21 100644 --- a/libexec/getty/main.c +++ b/libexec/getty/main.c @@ -153,7 +153,7 @@ main(argc, argv) * The following is a work around for vhangup interactions * which cause great problems getting window systems started. * If the tty line is "-", we do the old style getty presuming - * that the file descriptors are already set up for us. + * that the file descriptors are already set up for us. * J. Gettys - MIT Project Athena. */ if (argc <= 2 || strcmp(argv[2], "-") == 0) diff --git a/libexec/getty/subr.c b/libexec/getty/subr.c index 607fd3836ac0..0223863fbc65 100644 --- a/libexec/getty/subr.c +++ b/libexec/getty/subr.c @@ -382,7 +382,7 @@ speed(val) for (sp = speedtab; sp->speed; sp++) if (sp->speed == val) return (sp->uxname); - + return (B300); /* default in impossible cases */ } diff --git a/libexec/lfs_cleanerd/clean.h b/libexec/lfs_cleanerd/clean.h index 5bbece7dec44..729d0f8f1e3b 100644 --- a/libexec/lfs_cleanerd/clean.h +++ b/libexec/lfs_cleanerd/clean.h @@ -82,9 +82,9 @@ typedef struct fs_info { off_t fi_ifile_length; /* length of the ifile */ } FS_INFO; -/* +/* * XXX: size (in bytes) of a segment - * should lfs_bsize be fsbtodb(fs,1), blksize(fs), or lfs_dsize? + * should lfs_bsize be fsbtodb(fs,1), blksize(fs), or lfs_dsize? */ #define seg_size(fs) ((fs)->lfs_ssize << (fs)->lfs_bshift) diff --git a/libexec/lfs_cleanerd/cleanerd.c b/libexec/lfs_cleanerd/cleanerd.c index 2b8566aca94c..994992e48cfe 100644 --- a/libexec/lfs_cleanerd/cleanerd.c +++ b/libexec/lfs_cleanerd/cleanerd.c @@ -65,7 +65,7 @@ struct cleaner_stats { int segs_error; } cleaner_stats; -struct seglist { +struct seglist { int sl_id; /* segment number */ int sl_cost; /* cleaning cost */ char sl_empty; /* is segment empty */ @@ -84,7 +84,7 @@ int lfs_markv __P((fsid_t *, BLOCK_INFO *, int)); /* function prototypes */ int bi_tossold __P((const void *, const void *, const void *)); -int choose_segments __P((FS_INFO *, struct seglist *, +int choose_segments __P((FS_INFO *, struct seglist *, int (*)(FS_INFO *, SEGUSE *))); void clean_fs __P((FS_INFO *, int (*)(FS_INFO *, SEGUSE *))); int clean_loop __P((FS_INFO *)); @@ -117,14 +117,14 @@ cost_benefit(fsp, su) gettimeofday(&t, NULL); - live = su->su_nbytes; + live = su->su_nbytes; age = t.tv_sec < su->su_lastmod ? 0 : t.tv_sec - su->su_lastmod; - + lfsp = &fsp->fi_lfs; if (live == 0) return (t.tv_sec * lblkno(lfsp, seg_size(lfsp))); else { - /* + /* * from lfsSegUsage.c (Mendel's code). * priority calculation is done using INTEGER arithmetic. * sizes are in BLOCKS (that is why we use lblkno below). @@ -212,7 +212,7 @@ main(argc, argv) (void)printf("Cleaner going to sleep.\n"); #endif if (lfs_segwait(&fsid, &timeout) < 0) - err(0, "lfs_segwait: returned error\n"); + err(0, "lfs_segwait: returned error\n"); #ifdef VERBOSE (void)printf("Cleaner waking up.\n"); #endif @@ -233,8 +233,8 @@ clean_loop(fsp) * number of free blocks. */ max_free_segs = fsp->fi_statfsp->f_bfree / fsp->fi_lfs.lfs_ssize; - - /* + + /* * We will clean if there are not enough free blocks or total clean * space is less than BUSY_LIM % of possible clean space. */ @@ -247,7 +247,7 @@ clean_loop(fsp) clean_fs(fsp, cost_benefit); return (1); } else { - /* + /* * We will also clean if the system is reasonably idle and * the total clean space is less then IDLE_LIM % of possible * clean space. @@ -256,16 +256,16 @@ clean_loop(fsp) perror("getloadavg: failed\n"); return (-1); } - if (loadavg[ONE_MIN] == 0.2 && loadavg[FIVE_MIN] && + if (loadavg[ONE_MIN] == 0.2 && loadavg[FIVE_MIN] && fsp->fi_cip->clean < max_free_segs * IDLE_LIM) { clean_fs(fsp, cost_benefit); printf("Cleaner running (system idle) at %s", ctime(&now)); return (1); } - } + } #ifdef VERBOSE - printf("Cleaner not running at %s", ctime(&now)); + printf("Cleaner not running at %s", ctime(&now)); #endif return (0); } @@ -456,7 +456,7 @@ clean_segment(fsp, id) } num_blocks -= clean_blocks; } - + free(block_array); munmap_segment(fsp, seg_buf, do_mmap); ++cleaner_stats.segs_cleaned; diff --git a/libexec/lfs_cleanerd/library.c b/libexec/lfs_cleanerd/library.c index 19ac0fd81fec..62f345af0106 100644 --- a/libexec/lfs_cleanerd/library.c +++ b/libexec/lfs_cleanerd/library.c @@ -108,7 +108,7 @@ get_fs_info (lstatfsp, use_mmap) { FS_INFO *fsp; int i; - + fsp = (FS_INFO *)malloc(sizeof(FS_INFO)); if (fsp == NULL) return NULL; @@ -125,7 +125,7 @@ get_fs_info (lstatfsp, use_mmap) /* * If we are reading the ifile then we need to refresh it. Even if - * we are mmapping it, it might have grown. Finally, we need to + * we are mmapping it, it might have grown. Finally, we need to * refresh the file system information (statfs) info. */ void @@ -134,14 +134,14 @@ reread_fs_info(fsp, use_mmap) int use_mmap; { int i; - + if (statfs(fsp->fi_statfsp->f_mntonname, fsp->fi_statfsp)) err(1, "reread_fs_info: statfs failed"); get_ifile (fsp, use_mmap); } -/* - * Gets the superblock from disk (possibly in face of errors) +/* + * Gets the superblock from disk (possibly in face of errors) */ int get_superblock (fsp, sbp) @@ -161,11 +161,11 @@ get_superblock (fsp, sbp) get(fid, LFS_LABELPAD, sbp, sizeof(struct lfs)); close (fid); - + return (0); } -/* +/* * This function will map the ifile into memory. It causes a * fatal error on failure. */ @@ -209,16 +209,16 @@ get_ifile (fsp, use_mmap) if (fsp->fi_cip) free(fsp->fi_cip); if (!(ifp = malloc (file_stat.st_size))) - err (1, "get_ifile: malloc failed"); + err (1, "get_ifile: malloc failed"); redo_read: count = read (fid, ifp, (size_t) file_stat.st_size); if (count < 0) - err(1, "get_ifile: bad ifile read"); + err(1, "get_ifile: bad ifile read"); else if (count < file_stat.st_size) { err(0, "get_ifile"); if (lseek(fid, 0, SEEK_SET) < 0) - err(1, "get_ifile: bad ifile lseek"); + err(1, "get_ifile: bad ifile lseek"); goto redo_read; } } @@ -249,7 +249,7 @@ redo_read: * summary was read (it may have "died" since then). Any given * pair will be listed at most once. */ -int +int lfs_segmapv(fsp, seg, seg_buf, blocks, bcount) FS_INFO *fsp; /* pointer to local file system information */ int seg; /* the segment number */ @@ -345,13 +345,13 @@ lfs_segmapv(fsp, seg, seg_buf, blocks, bcount) err0: *bcount = 0; return (-1); - + } -/* +/* * This will parse a partial segment and fill in BLOCK_INFO structures * for each block described in the segment summary. It will not include - * blocks or inodes from files with new version numbers. + * blocks or inodes from files with new version numbers. */ void add_blocks (fsp, bip, countp, sp, seg_buf, segaddr, psegaddr) @@ -429,10 +429,10 @@ add_inodes (fsp, bip, countp, sp, seg_buf, seg_addr) daddr_t *daddrp; ino_t inum; int i; - + if (sp->ss_ninos <= 0) return; - + bp = bip + *countp; lfsp = &fsp->fi_lfs; #ifdef VERBOSE @@ -444,9 +444,9 @@ add_inodes (fsp, bip, countp, sp, seg_buf, seg_addr) --daddrp; di = (struct dinode *)(seg_buf + ((*daddrp - seg_addr) << fsp->fi_daddr_shift)); - } else + } else ++di; - + inum = di->di_inumber; bp->bi_lbn = LFS_UNUSED_LBN; bp->bi_inode = inum; @@ -466,7 +466,7 @@ add_inodes (fsp, bip, countp, sp, seg_buf, seg_addr) if (ifp->if_daddr == *daddrp) { bp++; ++(*countp); - } + } } } } @@ -476,7 +476,7 @@ add_inodes (fsp, bip, countp, sp, seg_buf, seg_addr) * segment is valid or not. Returns the size of the partial segment if it * is valid, * and 0 otherwise. Use dump_summary to figure out size of the * the partial as well as whether or not the checksum is valid. - */ + */ int pseg_valid (fsp, ssp) FS_INFO *fsp; /* pointer to file system info */ @@ -489,7 +489,7 @@ pseg_valid (fsp, ssp) if ((nblocks = dump_summary(&fsp->fi_lfs, ssp, 0, NULL)) <= 0 || nblocks > fsp->fi_lfs.lfs_ssize - 1) return(0); - + /* check data/inode block(s) checksum too */ datap = (u_long *)malloc(nblocks * sizeof(u_long)); p = (caddr_t)ssp + LFS_SUMMARY_SIZE; @@ -499,13 +499,13 @@ pseg_valid (fsp, ssp) } if (cksum ((void *)datap, nblocks * sizeof(u_long)) != ssp->ss_datasum) return (0); - + return (nblocks); } /* #define MMAP_SEGMENT */ -/* +/* * read a segment into a memory buffer */ int @@ -562,7 +562,7 @@ mmap_segment (fsp, segment, segbuf, use_mmap) free(*segbuf); return (-1); } - + if (read (fid, *segbuf, ssize) != ssize) { err (0, "mmap_segment: bad read"); free(*segbuf); @@ -630,7 +630,7 @@ bi_compare(a, b) return (diff); diff = (int)(ba->bi_daddr - bb->bi_daddr); return (diff); -} +} int bi_toss(dummy, a, b) @@ -665,7 +665,7 @@ toss(p, nump, size, dotoss, client) if (dotoss(client, p, p1)) { memmove(p, p1, i * size); --(*nump); - } else + } else p += size; } } diff --git a/libexec/lfs_cleanerd/print.c b/libexec/lfs_cleanerd/print.c index 5c3863a7987a..64320c5a3a9e 100644 --- a/libexec/lfs_cleanerd/print.c +++ b/libexec/lfs_cleanerd/print.c @@ -65,7 +65,7 @@ dump_summary(lfsp, sp, flags, iaddrp) FINFO *fp; int ck; - if (sp->ss_sumsum != (ck = cksum(&sp->ss_datasum, + if (sp->ss_sumsum != (ck = cksum(&sp->ss_datasum, LFS_SUMMARY_SIZE - sizeof(sp->ss_sumsum)))) return(-1); diff --git a/libexec/mail.local/mail.local.c b/libexec/mail.local/mail.local.c index 0de89788c302..6effa031b227 100644 --- a/libexec/mail.local/mail.local.c +++ b/libexec/mail.local/mail.local.c @@ -304,7 +304,7 @@ err2: (void)ftruncate(mbfd, curoff); err1: (void)close(mbfd); return; } - + /* Close and check -- NFS doesn't write until the close. */ if (close(mbfd)) { e_to_sys(errno); diff --git a/libexec/makekey/makekey.c b/libexec/makekey/makekey.c index d786bc964537..95febcf31a40 100644 --- a/libexec/makekey/makekey.c +++ b/libexec/makekey/makekey.c @@ -57,7 +57,7 @@ main() { int len; char *r, key[9], salt[3]; - + get(key, sizeof(key) - 1); get(salt, sizeof(salt) - 1); len = strlen(r = crypt(key, salt)); diff --git a/libexec/rbootd/bpf.c b/libexec/rbootd/bpf.c index 7ecd41957a32..f5e8bceac680 100644 --- a/libexec/rbootd/bpf.c +++ b/libexec/rbootd/bpf.c @@ -253,7 +253,7 @@ BpfGetIntfName(errmsg) #endif ifrp = ibuf; ifend = (struct ifreq *)((char *)ibuf + ifc.ifc_len); - + mp = 0; minunit = 666; for (; ifrp < ifend; ++ifrp) { diff --git a/libexec/rbootd/parseconf.c b/libexec/rbootd/parseconf.c index d00436f071c8..a01a4a5245fa 100644 --- a/libexec/rbootd/parseconf.c +++ b/libexec/rbootd/parseconf.c @@ -192,7 +192,7 @@ ParseConfig() * the entire record is invalidated. */ if (i == 0) { - FreeClient(client); + FreeClient(client); continue; } } diff --git a/libexec/rbootd/rbootd.c b/libexec/rbootd/rbootd.c index aa01583496f2..0164345ad100 100644 --- a/libexec/rbootd/rbootd.c +++ b/libexec/rbootd/rbootd.c @@ -379,7 +379,7 @@ DoTimeout() ** FindClient -- Find client associated with a packet. ** ** Parameters: -** rconn - the new packet. +** rconn - the new packet. ** ** Returns: ** Pointer to client info if found, NULL otherwise. diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c index 5feb8a70d5ba..cd94b68a6748 100644 --- a/libexec/rexecd/rexecd.c +++ b/libexec/rexecd/rexecd.c @@ -187,7 +187,7 @@ doit(f, fromp) exit(1); } } - + if (pwd->pw_uid == 0 || *pwd->pw_passwd == '\0') { syslog(LOG_ERR, "%s LOGIN REFUSED from %s", user, remote); error("Login incorrect.\n"); diff --git a/libexec/rlogind/rlogind.c b/libexec/rlogind/rlogind.c index 57927985f42d..4ff0af7c36aa 100644 --- a/libexec/rlogind/rlogind.c +++ b/libexec/rlogind/rlogind.c @@ -705,7 +705,7 @@ do_krb_login(dest) /* returns nonzero for no access */ if (kuserok(kdata, lusername) != 0) return (-1); - + return (0); } diff --git a/libexec/rpc.rstatd/rstat_proc.c b/libexec/rpc.rstatd/rstat_proc.c index ade88ffeb031..613ce51cc47b 100644 --- a/libexec/rpc.rstatd/rstat_proc.c +++ b/libexec/rpc.rstatd/rstat_proc.c @@ -29,7 +29,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)rpc.rstatd.c 1.1 86/09/25 Copyr 1984 Sun Micro";*/ /*static char sccsid[] = "from: @(#)rstat_proc.c 2.2 88/08/01 4.0 RPCSRC";*/ -static char rcsid[] = "$Id: rstat_proc.c,v 1.1.1.1 1994/08/28 14:49:04 csgr Exp $"; +static char rcsid[] = "$Id: rstat_proc.c,v 1.2 1994/10/15 13:39:54 davidg Exp $"; #endif /* @@ -107,7 +107,7 @@ static kvm_t *kd; extern int errno; #if defined(BSD) -static int cp_time_xlat[RSTAT_CPUSTATES] = { CP_USER, CP_NICE, CP_SYS, +static int cp_time_xlat[RSTAT_CPUSTATES] = { CP_USER, CP_NICE, CP_SYS, CP_IDLE }; static long bsd_cp_time[CPUSTATES]; #endif diff --git a/libexec/rpc.rstatd/rstatd.c b/libexec/rpc.rstatd/rstatd.c index 2cbdac7881c7..972974cc101a 100644 --- a/libexec/rpc.rstatd/rstatd.c +++ b/libexec/rpc.rstatd/rstatd.c @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: rstatd.c,v 1.1.1.1 1994/08/28 14:49:04 csgr Exp $"; +static char rcsid[] = "$Id: rstatd.c,v 1.2 1994/11/18 22:31:05 ats Exp $"; #endif /* not lint */ #include <stdio.h> @@ -64,7 +64,7 @@ main(argc, argv) int proto = 0; struct sockaddr_in from; int fromlen; - + if (argc == 2) closedown = atoi(argv[1]); if (closedown <= 0) @@ -91,7 +91,7 @@ main(argc, argv) (void) signal(SIGTERM, cleanup); (void) signal(SIGHUP, cleanup); } - + openlog("rpc.rstatd", LOG_CONS|LOG_PID, LOG_DAEMON); transp = svcudp_create(sock); diff --git a/libexec/rpc.rusersd/rusers_proc.c b/libexec/rpc.rusersd/rusers_proc.c index 3a603c2d19ed..d472673e8a21 100644 --- a/libexec/rpc.rusersd/rusers_proc.c +++ b/libexec/rpc.rusersd/rusers_proc.c @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: rusers_proc.c,v 1.2 1994/11/04 02:12:49 jkh Exp $"; +static char rcsid[] = "$Id: rusers_proc.c,v 1.3 1994/11/18 23:36:18 ats Exp $"; #endif /* not lint */ #include <signal.h> @@ -146,7 +146,7 @@ getidle(char *tty, char *display) char devname[PATH_MAX]; time_t now; u_long idle; - + /* * If this is an X terminal or console, then try the * XIdle extension @@ -186,17 +186,17 @@ getidle(char *tty, char *display) return(idle); } - + static utmpidlearr * do_names_2(int all) { static utmpidlearr ut; struct utmp usr; int nusers = 0; - + bzero((char *)&ut, sizeof(ut)); ut.utmpidlearr_val = &utmp_idle[0]; - + ufp = fopen(_PATH_UTMP, "r"); if (!ufp) { syslog(LOG_ERR, "%m"); @@ -223,10 +223,10 @@ do_names_2(int all) strncpy(name[nusers], usr.ut_name, UT_NAMESIZE); utmp_idle[nusers].ui_utmp.ut_host = host[nusers]; strncpy(host[nusers], usr.ut_host, UT_HOSTSIZE); - + /* Make sure entries are NUL terminated */ - line[nusers][UT_LINESIZE] = - name[nusers][UT_NAMESIZE] = + line[nusers][UT_LINESIZE] = + name[nusers][UT_NAMESIZE] = host[nusers][UT_HOSTSIZE] = '\0'; nusers++; } @@ -270,9 +270,9 @@ do_names_1(int all) utmpidlearr *utidle; static utmparr ut; int i; - + bzero((char *)&ut, sizeof(ut)); - + utidle = do_names_2(all); if (utidle) { ut.utmparr_len = utidle->utmpidlearr_len; @@ -280,9 +280,9 @@ do_names_1(int all) for (i = 0; i < ut.utmparr_len; i++) bcopy(&utmp_idle[i].ui_utmp, &old_utmp[i], sizeof(old_utmp[0])); - + } - + return(&ut); } diff --git a/libexec/rpc.rusersd/rusersd.c b/libexec/rpc.rusersd/rusersd.c index d2a0d840ac4a..01823060f0b5 100644 --- a/libexec/rpc.rusersd/rusersd.c +++ b/libexec/rpc.rusersd/rusersd.c @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: rusersd.c,v 1.1.1.1 1994/08/28 14:53:45 csgr Exp $"; +static char rcsid[] = "$Id: rusersd.c,v 1.2 1994/11/18 22:40:11 ats Exp $"; #endif /* not lint */ #include <stdio.h> @@ -64,7 +64,7 @@ main(argc, argv) int proto = 0; struct sockaddr_in from; int fromlen; - + /* * See if inetd started us */ @@ -74,7 +74,7 @@ main(argc, argv) sock = RPC_ANYSOCK; proto = IPPROTO_UDP; } - + if (!from_inetd) { daemon(0, 0); @@ -87,7 +87,7 @@ main(argc, argv) } openlog("rpc.rusersd", LOG_CONS|LOG_PID, LOG_DAEMON); - + transp = svcudp_create(sock); if (transp == NULL) { syslog(LOG_ERR, "cannot create udp service."); @@ -102,7 +102,7 @@ main(argc, argv) syslog(LOG_ERR, "unable to register (RUSERSPROG, RUSERSVERS_ORIG, %s).", proto?"udp":"(inetd)"); exit(1); } - + svc_run(); syslog(LOG_ERR, "svc_run returned"); exit(1); diff --git a/libexec/rpc.rwalld/rwalld.c b/libexec/rpc.rwalld/rwalld.c index 7e99b62468f1..adb6c3f71b27 100644 --- a/libexec/rpc.rwalld/rwalld.c +++ b/libexec/rpc.rwalld/rwalld.c @@ -28,7 +28,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: rwalld.c,v 1.1.1.1 1994/08/28 14:58:36 csgr Exp $"; +static char rcsid[] = "$Id: rwalld.c,v 1.2 1994/11/18 22:50:22 ats Exp $"; #endif /* not lint */ #include <unistd.h> @@ -90,7 +90,7 @@ main(argc, argv) sock = RPC_ANYSOCK; proto = IPPROTO_UDP; } - + if (!from_inetd) { if (!nodaemon) possess(); diff --git a/libexec/talkd/announce.c b/libexec/talkd/announce.c index 9022a12b767e..db03bbfb8618 100644 --- a/libexec/talkd/announce.c +++ b/libexec/talkd/announce.c @@ -55,9 +55,9 @@ extern char hostname[]; /* * Announce an invitation to talk. */ - + /* - * See if the user is accepting messages. If so, announce that + * See if the user is accepting messages. If so, announce that * a talk is requested. */ announce(request, remote_machine) @@ -80,7 +80,7 @@ announce(request, remote_machine) #define N_CHARS 120 /* - * Build a block of characters containing the message. + * Build a block of characters containing the message. * It is sent blank filled and in a single block to * try to keep the message in one piece if the recipient * in in vi at the time diff --git a/libexec/talkd/print.c b/libexec/talkd/print.c index 9c0085bc7688..0769d97eef5b 100644 --- a/libexec/talkd/print.c +++ b/libexec/talkd/print.c @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)print.c 8.1 (Berkeley) 6/4/93"; static char *types[] = { "leave_invite", "look_up", "delete", "announce" }; #define NTYPES (sizeof (types) / sizeof (types[0])) -static char *answers[] = +static char *answers[] = { "success", "not_here", "failed", "machine_unknown", "permission_denied", "unknown_request", "badversion", "badaddr", "badctladdr" }; #define NANSWERS (sizeof (answers) / sizeof (answers[0])) @@ -56,7 +56,7 @@ print_request(cp, mp) register CTL_MSG *mp; { char tbuf[80], *tp; - + if (mp->type > NTYPES) { (void)sprintf(tbuf, "type %d", mp->type); tp = tbuf; @@ -71,7 +71,7 @@ print_response(cp, rp) register CTL_RESPONSE *rp; { char tbuf[80], *tp, abuf[80], *ap; - + if (rp->type > NTYPES) { (void)sprintf(tbuf, "type %d", rp->type); tp = tbuf; diff --git a/libexec/talkd/table.c b/libexec/talkd/table.c index cc8cb6628d68..ef5720608bf3 100644 --- a/libexec/talkd/table.c +++ b/libexec/talkd/table.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/4/93"; /* * Routines to handle insertion, deletion, etc on the table * of requests kept by the daemon. Nothing fancy here, linear - * search on a double-linked list. A time is kept with each + * search on a double-linked list. A time is kept with each * entry so that overly old invitations can be eliminated. * * Consider this a mis-guided attempt at modularity @@ -110,7 +110,7 @@ find_match(request) /* * Look for an identical request, as opposed to a complimentary - * one as find_match does + * one as find_match does */ CTL_MSG * find_request(request) diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c index ea4837691600..9fd595016208 100644 --- a/libexec/talkd/talkd.c +++ b/libexec/talkd/talkd.c @@ -43,7 +43,7 @@ static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93"; /* * The top level of the daemon, the format is heavily borrowed - * from rwhod.c. Basically: find out who and where you are; + * from rwhod.c. Basically: find out who and where you are; * disconnect all descriptors and ttys, and then endless * loop on waiting for and processing requests */ diff --git a/libexec/telnetd/pathnames.h b/libexec/telnetd/pathnames.h index c8b0806e7814..4e14a88b49cd 100644 --- a/libexec/telnetd/pathnames.h +++ b/libexec/telnetd/pathnames.h @@ -42,7 +42,7 @@ # endif #else - + # define _PATH_TTY "/dev/tty" # ifndef _PATH_LOGIN # define _PATH_LOGIN "/bin/login" diff --git a/libexec/telnetd/slc.c b/libexec/telnetd/slc.c index 145746afeaf4..a03bd9d3f42d 100644 --- a/libexec/telnetd/slc.c +++ b/libexec/telnetd/slc.c @@ -109,10 +109,10 @@ get_slc_defaults() init_termbuf(); for (i = 1; i <= NSLC; i++) { - slctab[i].defset.flag = + slctab[i].defset.flag = spcset(i, &slctab[i].defset.val, &slctab[i].sptr); - slctab[i].current.flag = SLC_NOSUPPORT; - slctab[i].current.val = 0; + slctab[i].current.flag = SLC_NOSUPPORT; + slctab[i].current.val = 0; } } /* end of get_slc_defaults */ @@ -286,7 +286,7 @@ change_slc(func, flag, val) register cc_t val; { register int hislevel, mylevel; - + hislevel = flag & SLC_LEVELBITS; mylevel = slctab[func].defset.flag & SLC_LEVELBITS; /* @@ -345,7 +345,7 @@ change_slc(func, flag, val) * request as he asks. * * If our level is DEFAULT, then just ack whatever was - * sent. + * sent. * * If he can't change and we can't change, * then degenerate to NOSUPPORT. @@ -372,7 +372,7 @@ change_slc(func, flag, val) slctab[func].defset.val; val = slctab[func].current.val; } - + } add_slc(func, flag, val); } @@ -423,7 +423,7 @@ check_slc() slctab[i].current.val); } } - + } /* check_slc */ /* diff --git a/libexec/telnetd/state.c b/libexec/telnetd/state.c index c957734e71ac..db9fbe814df4 100644 --- a/libexec/telnetd/state.c +++ b/libexec/telnetd/state.c @@ -376,7 +376,7 @@ gotiac: switch (c) { * All state defaults are negative, and resp defaults to 0. * * When initiating a request to change state to new_state: - * + * * if ((want_resp == 0 && new_state == my_state) || want_state == new_state) { * do nothing; * } else { diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c index 786661c097b6..75070af90b35 100644 --- a/libexec/telnetd/sys_term.c +++ b/libexec/telnetd/sys_term.c @@ -1083,7 +1083,7 @@ getptyslave() #ifdef USE_TERMIO ttyfd = t; #endif - if (ioctl(t, I_PUSH, "ptem") < 0) + if (ioctl(t, I_PUSH, "ptem") < 0) fatal(net, "I_PUSH ptem"); if (ioctl(t, I_PUSH, "ldterm") < 0) fatal(net, "I_PUSH ldterm"); @@ -1583,7 +1583,7 @@ start_login(host, autologin, name) if (bftpd) { argv = addarg(argv, "-e"); argv = addarg(argv, BFTPPATH); - } else + } else #endif #if defined (SecurID) /* @@ -1677,7 +1677,7 @@ start_login(host, autologin, name) if (user = getenv("USER")) { if (strchr(user, '-')) { syslog(LOG_ERR, "tried to pass user \"%s\" to login", - user); + user); fatal(net, "invalid user"); } argv = addarg(argv, getenv("USER")); @@ -2073,7 +2073,7 @@ rmut() if (statbf.st_size && utmp) { nutmp = read(f, (char *)utmp, (int)statbf.st_size); nutmp /= sizeof(struct utmp); - + for (u = utmp ; u < &utmp[nutmp] ; u++) { if (SCMPN(u->ut_line, line+5) || u->ut_name[0]==0) diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index 5b2a884e6982..87e017da7692 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -784,7 +784,7 @@ doit(who) #if defined(_SC_CRAY_SECURE_SYS) /* - * set ttyp line security label + * set ttyp line security label */ if (secflag) { char slave_dev[16]; @@ -1368,7 +1368,7 @@ telnet(f, p, host) } cleanup(0); } /* end of telnet */ - + #ifndef TCSIG # ifdef TIOCSIG # define TCSIG TIOCSIG @@ -1444,7 +1444,7 @@ int readstream(p, ibuf, bufsize) tp = (struct termio *) (ibuf+1 + sizeof(struct iocblk)); vstop = tp->c_cc[VSTOP]; vstart = tp->c_cc[VSTART]; - ixon = tp->c_iflag & IXON; + ixon = tp->c_iflag & IXON; break; default: errno = EAGAIN; diff --git a/libexec/telnetd/termstat.c b/libexec/telnetd/termstat.c index 25124a039386..3fde25a50c3f 100644 --- a/libexec/telnetd/termstat.c +++ b/libexec/telnetd/termstat.c @@ -301,7 +301,7 @@ localstat() nfrontp += 7; editmode = useeditmode; } - + /* * Check for changes to special characters in use. @@ -403,7 +403,7 @@ clientstat(code, parm1, parm2) uselinemode = 1; } } - + /* * Quit now if we can't do it. */ @@ -444,7 +444,7 @@ clientstat(code, parm1, parm2) send_will(TELOPT_ECHO, 1); } break; - + case LM_MODE: { register int ack, changed; @@ -493,7 +493,7 @@ clientstat(code, parm1, parm2) IAC, SE); nfrontp += 7; } - + editmode = useeditmode; } @@ -527,9 +527,9 @@ clientstat(code, parm1, parm2) (void) ioctl(pty, TIOCSWINSZ, (char *)&ws); } #endif /* TIOCSWINSZ */ - + break; - + case TELOPT_TSPEED: { def_tspeed = parm1; @@ -594,7 +594,7 @@ _termstat() * * Some things should not be done until after the login process has started * and all the pty modes are set to what they are supposed to be. This - * function is called when the pty state has been processed for the first time. + * function is called when the pty state has been processed for the first time. * It calls other functions that do things that were deferred in each module. */ void diff --git a/libexec/telnetd/utility.c b/libexec/telnetd/utility.c index 1fbd7e3603c6..4f5c2e6fc0c5 100644 --- a/libexec/telnetd/utility.c +++ b/libexec/telnetd/utility.c @@ -679,7 +679,7 @@ printsub(direction, pointer, length) break; } break; - + case LM_SLC: sprintf(nfrontp, "SLC"); nfrontp += strlen(nfrontp); @@ -829,7 +829,7 @@ printsub(direction, pointer, length) nfrontp += strlen(nfrontp); break; - + default: sprintf(nfrontp, " %d", pointer[i]); nfrontp += strlen(nfrontp); @@ -932,7 +932,7 @@ printsub(direction, pointer, length) case TELOPT_AUTHENTICATION: sprintf(nfrontp, "AUTHENTICATION"); nfrontp += strlen(nfrontp); - + if (length < 2) { sprintf(nfrontp, " (empty suboption??\?)"); nfrontp += strlen(nfrontp); @@ -1050,13 +1050,13 @@ printdata(tag, ptr, cnt) nfrontp += strlen(nfrontp); for (i = 0; i < 20 && cnt; i++) { sprintf(nfrontp, "%02x", *ptr); - nfrontp += strlen(nfrontp); + nfrontp += strlen(nfrontp); if (isprint(*ptr)) { xbuf[i] = *ptr; } else { xbuf[i] = '.'; } - if (i % 2) { + if (i % 2) { *nfrontp = ' '; nfrontp++; } @@ -1066,6 +1066,6 @@ printdata(tag, ptr, cnt) xbuf[i] = '\0'; sprintf(nfrontp, " %s\r\n", xbuf ); nfrontp += strlen(nfrontp); - } + } } #endif /* DIAGNOSTICS */ diff --git a/libexec/xtend/packet.c b/libexec/xtend/packet.c index 19958a980347..8dfad8808bbd 100644 --- a/libexec/xtend/packet.c +++ b/libexec/xtend/packet.c @@ -314,4 +314,4 @@ unsigned char *p; } } } -} +} diff --git a/libexec/xtend/status.c b/libexec/xtend/status.c index c09ae8582065..2ee3812a2d56 100644 --- a/libexec/xtend/status.c +++ b/libexec/xtend/status.c @@ -59,7 +59,7 @@ initstatus() * Checkpoint status of any devices whose status has changed * and notify anyone monitoring those devices. */ - + checkpoint_status() { int h, i, k, offset; diff --git a/sys/libkern/fnmatch.c b/sys/libkern/fnmatch.c index dc7f151194e3..0c2ca13d16d6 100644 --- a/sys/libkern/fnmatch.c +++ b/sys/libkern/fnmatch.c @@ -149,13 +149,13 @@ rangematch(pattern, test, flags) */ if (negate = (*pattern == '!' || *pattern == '^')) ++pattern; - + for (ok = 0; (c = *pattern++) != ']';) { if (c == '\\' && !(flags & FNM_NOESCAPE)) c = *pattern++; if (c == EOS) return (NULL); - if (*pattern == '-' + if (*pattern == '-' && (c2 = *(pattern+1)) != EOS && c2 != ']') { pattern += 2; if (c2 == '\\' && !(flags & FNM_NOESCAPE)) diff --git a/sys/libkern/strsep.c b/sys/libkern/strsep.c index 18dc3987e67e..ddad5964ce19 100644 --- a/sys/libkern/strsep.c +++ b/sys/libkern/strsep.c @@ -41,7 +41,7 @@ static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93"; /* * Get next token from string *stringp, where tokens are possibly-empty - * strings separated by characters from delim. + * strings separated by characters from delim. * * Writes NULs into the string at *stringp to end tokens. * delim need not remain constant from call to call. |