diff options
author | ru <ru@FreeBSD.org> | 2001-04-17 12:23:50 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2001-04-17 12:23:50 +0000 |
commit | 3b5355d725800022c2c055a699326722a43b9dc2 (patch) | |
tree | 496e96972d2062817422e21a3cb29c8d258b2d22 /contrib/groff/libgroff/errarg.cc | |
parent | 0e0a0e6429c7113acf15c4c94bd5fe94c45f9e99 (diff) | |
download | FreeBSD-src-3b5355d725800022c2c055a699326722a43b9dc2.zip FreeBSD-src-3b5355d725800022c2c055a699326722a43b9dc2.tar.gz |
Removed files not present in v1.17 import.
Diffstat (limited to 'contrib/groff/libgroff/errarg.cc')
-rw-r--r-- | contrib/groff/libgroff/errarg.cc | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/contrib/groff/libgroff/errarg.cc b/contrib/groff/libgroff/errarg.cc deleted file mode 100644 index be4d3dc..0000000 --- a/contrib/groff/libgroff/errarg.cc +++ /dev/null @@ -1,118 +0,0 @@ -// -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - Written by James Clark (jjc@jclark.com) - -This file is part of groff. - -groff is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -groff is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License along -with groff; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include <stdio.h> -#include "assert.h" -#include "errarg.h" - -errarg::errarg(const char *p) : type(STRING) -{ - s = p ? p : "(null)"; -} - -errarg::errarg() : type(EMPTY) -{ -} - -errarg::errarg(unsigned char cc) : type(CHAR) -{ - c = cc; -} - -errarg::errarg(int nn) : type(INTEGER) -{ - n = nn; -} - -errarg::errarg(char cc) : type(CHAR) -{ - c = cc; -} - -errarg::errarg(double dd) : type(DOUBLE) -{ - d = dd; -} - -int errarg::empty() const -{ - return type == EMPTY; -} - -extern "C" { - const char *i_to_a(int); -} - -void errarg::print() const -{ - switch (type) { - case INTEGER: - fputs(i_to_a(n), stderr); - break; - case CHAR: - putc(c, stderr); - break; - case STRING: - fputs(s, stderr); - break; - case DOUBLE: - fprintf(stderr, "%g", d); - break; - case EMPTY: - break; - } -} - -errarg empty_errarg; - -void errprint(const char *format, - const errarg &arg1, - const errarg &arg2, - const errarg &arg3) -{ - assert(format != 0); - char c; - while ((c = *format++) != '\0') { - if (c == '%') { - c = *format++; - switch(c) { - case '%': - fputc('%', stderr); - break; - case '1': - assert(!arg1.empty()); - arg1.print(); - break; - case '2': - assert(!arg2.empty()); - arg2.print(); - break; - case '3': - assert(!arg3.empty()); - arg3.print(); - break; - default: - assert(0); - } - } - else - putc(c, stderr); - } -} |