diff options
Diffstat (limited to 'lib/libcurses/tinfo/lib_print.c')
-rw-r--r-- | lib/libcurses/tinfo/lib_print.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/lib/libcurses/tinfo/lib_print.c b/lib/libcurses/tinfo/lib_print.c index a42bccf6f21..0bb6b5a4c6b 100644 --- a/lib/libcurses/tinfo/lib_print.c +++ b/lib/libcurses/tinfo/lib_print.c @@ -1,7 +1,7 @@ -/* $OpenBSD: lib_print.c,v 1.2 1999/03/02 06:23:28 millert Exp $ */ +/* $OpenBSD: lib_print.c,v 1.3 2001/01/22 18:01:53 millert Exp $ */ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,49 +33,44 @@ * and: Eric S. Raymond <esr@snark.thyrsus.com> * ****************************************************************************/ - #include <curses.priv.h> #include <term.h> -MODULE_ID("$From: lib_print.c,v 1.11 1999/02/27 19:59:05 tom Exp $") +MODULE_ID("$From: lib_print.c,v 1.13 2000/12/10 02:55:07 tom Exp $") -int mcprint(char *data, int len) +NCURSES_EXPORT(int) +mcprint(char *data, int len) /* ship binary character data to the printer via mc4/mc5/mc5p */ { - char *mybuf, *switchon; - size_t onsize, offsize, res; + char *mybuf, *switchon; + size_t onsize, offsize, res; errno = 0; - if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) - { + if (!cur_term || (!prtr_non && (!prtr_on || !prtr_off))) { errno = ENODEV; - return(ERR); + return (ERR); } - if (prtr_non) - { + if (prtr_non) { switchon = tparm(prtr_non, len); onsize = strlen(switchon); offsize = 0; - } - else - { + } else { switchon = prtr_on; onsize = strlen(prtr_on); offsize = strlen(prtr_off); } - if ((mybuf = typeMalloc(char, onsize + len + offsize + 1)) == (char *)0) - { + if ((mybuf = typeMalloc(char, onsize + len + offsize + 1)) == (char *) 0) { errno = ENOMEM; - return(ERR); + return (ERR); } (void) strcpy(mybuf, switchon); memcpy(mybuf + onsize, data, len); if (offsize) - (void) strcpy(mybuf + onsize + len, prtr_off); + (void) strcpy(mybuf + onsize + len, prtr_off); /* * We're relying on the atomicity of UNIX writes here. The @@ -94,5 +89,5 @@ int mcprint(char *data, int len) (void) sleep(0); free(mybuf); - return(res); + return (res); } |