Annotation of 43BSDReno/usr.bin/window/error.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1983 Regents of the University of California.
        !             3:  * All rights reserved.
        !             4:  *
        !             5:  * This code is derived from software contributed to Berkeley by
        !             6:  * Edward Wang at The University of California, Berkeley.
        !             7:  *
        !             8:  * Redistribution and use in source and binary forms are permitted provided
        !             9:  * that: (1) source distributions retain this entire copyright notice and
        !            10:  * comment, and (2) distributions including binaries display the following
        !            11:  * acknowledgement:  ``This product includes software developed by the
        !            12:  * University of California, Berkeley and its contributors'' in the
        !            13:  * documentation or other materials provided with the distribution and in
        !            14:  * all advertising materials mentioning features or use of this software.
        !            15:  * Neither the name of the University nor the names of its contributors may
        !            16:  * be used to endorse or promote products derived from this software without
        !            17:  * specific prior written permission.
        !            18:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            19:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            20:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            21:  */
        !            22: 
        !            23: #ifndef lint
        !            24: static char sccsid[] = "@(#)error.c    3.16 (Berkeley) 6/6/90";
        !            25: #endif /* not lint */
        !            26: 
        !            27: #include "defs.h"
        !            28: #include "value.h"
        !            29: #include "context.h"
        !            30: #include "char.h"
        !            31: 
        !            32: #define ERRLINES 10                    /* number of lines for errwin */
        !            33: 
        !            34: /*VARARGS1*/
        !            35: error(fmt, a, b, c, d, e, f, g, h)
        !            36: char *fmt;
        !            37: {
        !            38:        register struct context *x;
        !            39:        register struct ww *w;
        !            40: 
        !            41:        for (x = &cx; x != 0 && x->x_type != X_FILE; x = x->x_link)
        !            42:                ;
        !            43:        if (x == 0) {
        !            44:                if (terse)
        !            45:                        wwbell();
        !            46:                else {
        !            47:                        wwprintf(cmdwin, fmt, a, b, c, d, e, f, g, h);
        !            48:                        wwputs("  ", cmdwin);
        !            49:                }
        !            50:                return;
        !            51:        }
        !            52:        if (x->x_noerr)
        !            53:                return;
        !            54:        if ((w = x->x_errwin) == 0) {
        !            55:                char buf[512];
        !            56: 
        !            57:                (void) sprintf(buf, "Errors from %s", x->x_filename);
        !            58:                if ((w = x->x_errwin = openiwin(ERRLINES, buf)) == 0) {
        !            59:                        wwputs("Can't open error window.  ", cmdwin);
        !            60:                        x->x_noerr = 1;
        !            61:                        return;
        !            62:                }
        !            63:        }
        !            64:        if (more(w, 0) == 2) {
        !            65:                x->x_noerr = 1;
        !            66:                return;
        !            67:        }
        !            68:        wwprintf(w, "line %d: ", x->x_lineno);
        !            69:        wwprintf(w, fmt, a, b, c, d, e, f, g, h);
        !            70:        wwputc('\n', w);
        !            71: }
        !            72: 
        !            73: err_end()
        !            74: {
        !            75:        if (cx.x_type == X_FILE && cx.x_errwin != 0) {
        !            76:                if (!cx.x_noerr)
        !            77:                        waitnl(cx.x_errwin);
        !            78:                closeiwin(cx.x_errwin);
        !            79:                cx.x_errwin = 0;
        !            80:        }
        !            81: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.