X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_print.c;h=aa65041c71d004a80d46b1eace9a8c2d4e0c6230;hp=0dab4d45911530e21d3805842da7d3d92e28edb9;hb=deb0d07e8eb4803b9e9653359eab17a30d04369d;hpb=8b06e371ed1bce3dd6f37138e6becb5e1a562fe0 diff --git a/ncurses/tinfo/lib_print.c b/ncurses/tinfo/lib_print.c index 0dab4d45..aa65041c 100644 --- a/ncurses/tinfo/lib_print.c +++ b/ncurses/tinfo/lib_print.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2011,2012 Free Software Foundation, Inc. * + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2011,2012 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 * @@ -39,14 +40,14 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_print.c,v 1.23 2012/02/22 22:34:31 tom Exp $") +MODULE_ID("$Id: lib_print.c,v 1.30 2021/04/18 14:58:57 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len) /* ship binary character data to the printer via mc4/mc5/mc5p */ { int result; - char *mybuf, *switchon; + char *mybuf = NULL, *switchon; size_t onsize, offsize; size_t need; @@ -59,7 +60,7 @@ NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len) } if (prtr_non) { - switchon = TPARM_1(prtr_non, len); + switchon = TIPARM_1(prtr_non, len); onsize = strlen(switchon); offsize = 0; } else { @@ -72,6 +73,7 @@ NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len) if (switchon == 0 || (mybuf = typeMalloc(char, need + 1)) == 0) { + free(mybuf); errno = ENOMEM; return (ERR); } @@ -95,7 +97,7 @@ NCURSES_SP_NAME(mcprint) (NCURSES_SP_DCLx char *data, int len) * kernel will ship the contiguous clist items from the last write * immediately. */ -#ifndef __MINGW32__ +#ifndef _NC_WINDOWS (void) sleep(0); #endif free(mybuf);