patches by R. Larice

This commit is contained in:
h_vogt 2010-02-08 21:15:17 +00:00
parent f721fdf782
commit d7d5a38583
7 changed files with 45 additions and 14 deletions

View File

@ -1,5 +1,7 @@
2010-02-08 Holger Vogt
* com_sysinfo.c: 64 bit support enabled
* terminal.c, terminal.h, cpextern.h, ngsconvert.c, inpgmod.c, ipcsockets.c: patches by
R. Larice from Feb. 8th, 2010
2010-02-07 Dietmar Warning
* cpl/cplload.c, cplsetup.c, /txl/txlload.c, txlsetup.c, include/swec.h, multi_line.h,

View File

@ -9,8 +9,11 @@ $Id$
* dependencies in here, and it isn't clear that versions of this stuff
* can be written for every possible machine...
*/
#include "ngspice.h"
#include "config.h"
#include <stdarg.h>
#ifdef HAVE_SGTTY_H
#include <sgtty.h>
#endif
@ -248,18 +251,27 @@ out_send(char *string)
/* Printf some stuff using more mode. */
void
out_printf(char *fmt, char *s1, char *s2, char *s3, char *s4, char *s5, char *s6, char *s7, char *s8, char *s9, char *s10)
out_printf(char *fmt, ...)
{
#if defined(HAVE_ASPRINTF) /* seems the best solution */
char * tbuf;
asprintf(&tbuf, fmt, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10);
va_list ap;
va_start (ap, fmt);
vasprintf(&tbuf, fmt, ap);
va_end (ap);
out_send(tbuf);
FREE(tbuf);
#elif defined(HAVE_SNPRINTF) /* the second best */
snprintf(out_pbuf, sizeof(out_pbuf), fmt, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10);
va_list ap;
va_start (ap, fmt);
vsnprintf(out_pbuf, sizeof(out_pbuf), fmt, ap);
va_end (ap);
out_send(out_pbuf);
#else /* guaranteed a bug for long messages */
sprintf(out_pbuf, fmt, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10);
va_list ap;
va_start (ap, fmt);
vsprintf(out_pbuf, fmt, ap);
va_end (ap);
out_send(out_pbuf);
#endif
return;
@ -363,9 +375,12 @@ void tcap_init(void) {}
void out_send(char *string) {fprintf(cp_out,string);}
void
out_printf(char *fmt, char *s1, char *s2, char *s3, char *s4, char *s5,
char *s6, char *s7, char *s8, char *s9, char *s10) {
fprintf(cp_out,fmt, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10);
out_printf(char *fmt, ...)
{
va_list ap;
va_start (ap, fmt);
vfprintf(cp_out, fmt, ap);
va_end (ap);
}
#endif /* TCL_MODULE */

View File

@ -7,9 +7,13 @@ void out_init(void);
void outbufputc(void);
void promptreturn(void);
void out_send(char *string);
void out_printf(char *fmt, char *s1, char *s2, char *s3,
char *s4, char *s5, char *s6,
char *s7, char *s8, char *s9, char *s10);
#ifdef __GNUC__
extern void out_printf(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
#else
extern void out_printf(char *fmt, ...);
#endif
void term_clear(void);
void term_home(void);
void term_cleol(void);

View File

@ -133,8 +133,18 @@ extern bool out_isatty;
extern void out_init();
#ifndef out_printf
/* don't want to declare it if we have #define'ed it */
#ifdef __GNUC__
#ifdef HAS_WINDOWS
#undef printf
#endif
extern void out_printf(char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
#ifdef HAS_WINDOWS
#define printf p_r_i_n_t_f
#endif
#else
extern void out_printf(char *fmt, ...);
#endif
extern void out_printf();
#endif
extern void out_send();

View File

@ -442,7 +442,7 @@ int cp_evloop(char *s) { return (0); }
void cp_ccon(bool o) { }
char *if_errstring(int c) { return ("error"); }
#ifndef out_printf
void out_printf(char *fmt, int args) { }
void out_printf(char *fmt, ...) { }
#endif
void out_send(char *string) {}
struct variable * cp_enqvar(char *word) { return (NULL); }

View File

@ -367,7 +367,7 @@ INPparseNumMod( void* ckt, INPmodel *model, INPtables *tab, char **errMessage )
if (cardType >= 0) {
/* Add card structure to model */
info = INPcardTab[cardType];
error = (*(info->newCard))( (void *)&tmpCard,
error = (*(info->newCard))( (void **)&tmpCard,
model->INPmodfast );
if (error) return(error);
/* Handle parameter-less cards */

View File

@ -576,7 +576,7 @@ Ipc_Status_t ipc_transport_get_line (str, len, wait)
/* we must get the body. */
*len = message_length;
count = read_sock (msg_stream, str, message_length);
count = read_sock (msg_stream, str, message_length, IPC_WAIT, 0);
if (count == 0) {
/* EOF, will this ever happen? */
/* fprintf (stderr, */