diff options
author | mwesdorp <mwesdorp> | 2013-12-03 09:22:23 +0000 |
---|---|---|
committer | mwesdorp <mwesdorp> | 2013-12-03 09:22:23 +0000 |
commit | ba6ff7b43fc47658341a54f17f83379a6487f591 (patch) | |
tree | 5482cd4eb1d2243640f525574dd156d63bbe5c0f /src | |
parent | 7f606aa466fc58e927ff76f85e63f587b1d3eb0a (diff) |
sqsh-2.5 new features and bugfixes
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd_bcp.c | 5 | ||||
-rw-r--r-- | src/cmd_connect.c | 62 | ||||
-rw-r--r-- | src/cmd_do.c | 20 | ||||
-rw-r--r-- | src/cmd_history.c | 11 | ||||
-rw-r--r-- | src/dsp.c | 141 | ||||
-rw-r--r-- | src/dsp_desc.c | 15 | ||||
-rw-r--r-- | src/dsp_meta.c | 6 | ||||
-rw-r--r-- | src/sqsh_config.h | 2 | ||||
-rw-r--r-- | src/sqsh_global.c | 13 | ||||
-rw-r--r-- | src/sqsh_global.h | 9 | ||||
-rw-r--r-- | src/sqsh_init.c | 10 | ||||
-rw-r--r-- | src/sqsh_parser/sqsh_parser.c | 10 | ||||
-rw-r--r-- | src/sqsh_parser/tsql.l | 2 | ||||
-rw-r--r-- | src/sqsh_parser/tsql.yy.c | 396 | ||||
-rw-r--r-- | src/var.h | 4 | ||||
-rw-r--r-- | src/var_misc.c | 39 |
16 files changed, 438 insertions, 307 deletions
diff --git a/src/cmd_bcp.c b/src/cmd_bcp.c index e38caa5..384f355 100644 --- a/src/cmd_bcp.c +++ b/src/cmd_bcp.c @@ -40,7 +40,7 @@ /*-- Current Version --*/ #if !defined(lint) && !defined(__LINT__) -static char RCS_Id[] = "$Id: cmd_bcp.c,v 1.17 2013/05/05 19:50:43 mwesdorp Exp $"; +static char RCS_Id[] = "$Id: cmd_bcp.c,v 1.18 2013/12/03 09:22:23 mwesdorp Exp $"; USE(RCS_Id) #endif /* !defined(lint) */ @@ -455,6 +455,9 @@ int cmd_bcp( argc, argv ) goto return_fail; } + /* sqsh-2.5 - Feature p2f, reset g_p2fc before a new batch is started */ + g_p2fc = 0; + /*-- Send command to server --*/ if (ct_send( bcp_cmd ) != CS_SUCCEED) { diff --git a/src/cmd_connect.c b/src/cmd_connect.c index fd9c09b..b066b0a 100644 --- a/src/cmd_connect.c +++ b/src/cmd_connect.c @@ -42,7 +42,7 @@ /*-- Current Version --*/ #if !defined(lint) && !defined(__LINT__) -static char RCS_Id[] = "$Id: cmd_connect.c,v 1.34 2013/08/22 19:54:34 mwesdorp Exp $"; +static char RCS_Id[] = "$Id: cmd_connect.c,v 1.35 2013/12/03 09:22:23 mwesdorp Exp $"; USE(RCS_Id) #endif /* !defined(lint) */ @@ -636,6 +636,8 @@ int cmd_connect( argc, argv ) g_cs_ver = CS_VERSION_100; retcode = cs_ctx_alloc(g_cs_ver, &g_context); } + DBG(sqsh_debug(DEBUG_TDS, "cmd_connect: g_cs_ver (CS_VERSION) set to: %d\n", g_cs_ver);) + if (retcode != CS_SUCCEED) /* nothing worked... */ goto connect_fail; @@ -1511,6 +1513,12 @@ static CS_RETCODE syb_server_cb (ctx, con, msg) char var_value[31]; int i; char *c; + /* sqsh-2.5 - New variables to support feature p2f */ + char *p2faxm; + int p2faxm_int; + char *p2fname; + FILE *dest_fp; + int p2fstat = False; /* * Record last error in $? @@ -1601,6 +1609,30 @@ static CS_RETCODE syb_server_cb (ctx, con, msg) if (msg->severity >= 0 || msg->msgnumber == 10) { /* + * sqsh-2.5 : Implementation of p2f feature. + * When the number of messages handled by this callback handler exceeds the limit specified in p2faxm, + * and a file is provided in $p2fname and is succesfully opened and we are in interactive mode, then + * write the remaining messages from the current batch to this file instead of on screen. + * Note that global variable g_p2fc will be reset to zero for each new batch in dsp.c. + */ + env_get( g_env, "p2faxm", &p2faxm ); + p2faxm_int = atoi(p2faxm); + if (++g_p2fc > p2faxm_int && + p2faxm_int > 0 && + g_p2f_fp != NULL && + g_interactive == True) + { + if (g_p2fc == p2faxm_int + 1) { + env_get( g_env, "p2fname", &p2fname ); + fprintf (stderr, "Warning: Number of printed server messages exceeds p2faxm=%d limit for current batch.\n", p2faxm_int); + fprintf (stderr," Remaining server messages will be printed to file: %s\n", p2fname); + fflush (stderr ); + fprintf (g_p2f_fp, "--------\n"); + } + p2fstat = True; + } + + /* * If the message was something other than informational, and * the severity was greater than 0, then print information to * stderr with a little pre-amble information. According to @@ -1609,17 +1641,18 @@ static CS_RETCODE syb_server_cb (ctx, con, msg) */ if (msg->msgnumber > 0 && msg->severity > 10) { - fprintf( stderr, "Msg %d, Level %d, State %d\n", + dest_fp = (p2fstat == True) ? g_p2f_fp : stderr; + fprintf( dest_fp, "Msg %d, Level %d, State %d\n", (int)msg->msgnumber, (int)msg->severity, (int)msg->state ); if (msg->svrnlen > 0) - fprintf( stderr, "Server '%s'", (char*)msg->svrname ); + fprintf( dest_fp, "Server '%s'", (char*)msg->svrname ); if (msg->proclen > 0) - fprintf( stderr, ", Procedure '%s'", (char*)msg->proc ); + fprintf( dest_fp, ", Procedure '%s'", (char*)msg->proc ); if( msg->line > 0 ) - fprintf( stderr, ", Line %d", (int)msg->line ); - fprintf( stderr, "\n" ); - wrap_print( stderr, msg->text ); - fflush( stderr ); + fprintf( dest_fp, ", Line %d", (int)msg->line ); + fprintf( dest_fp, "\n" ); + wrap_print( dest_fp, msg->text ); + fflush( dest_fp ); } else { @@ -1627,8 +1660,9 @@ static CS_RETCODE syb_server_cb (ctx, con, msg) * Otherwise, it is just an informational (e.g. print) message * from the server, so send it to stdout. */ - wrap_print( stdout, msg->text ); - fflush( stdout ); + dest_fp = (p2fstat == True) ? g_p2f_fp : stdout; + wrap_print( dest_fp, msg->text ); + fflush( dest_fp ); } } } @@ -2055,13 +2089,11 @@ ShowNetAuthCredExp (conn, cmdname) else { fmt = (char *) malloc (sizeof(char) * strlen(datetime)+2); - for (cp = fmt; *datetime != '\0'; ++datetime) + for (cp = fmt; *datetime != '\0'; datetime++) { - if (*datetime == '%' && *(datetime+1) == 'u') + if (*datetime == '.' && *(datetime+1) == '%' && *(datetime+2) == 'q') { - sprintf (cp, "000"); - cp += 3; - datetime += 1; + datetime += 2; } else if (*datetime != '[' && *datetime != ']') *cp++ = *datetime; diff --git a/src/cmd_do.c b/src/cmd_do.c index 2717240..fa64a88 100644 --- a/src/cmd_do.c +++ b/src/cmd_do.c @@ -316,6 +316,9 @@ static int cmd_do_exec( conn, sql, dobuf ) /* ** Save away current signal context. + ** + ** sqsh-2.5: Make sure that the signal context is restored using sig_restore() prior + ** to every return from this function. */ sig_save(); @@ -341,17 +344,20 @@ static int cmd_do_exec( conn, sql, dobuf ) { fprintf( stderr, "\\do: Error initializing command\n" ); - sig_restore(); ct_cmd_drop( cmd ); + sig_restore(); return(CMD_FAIL); } + /* sqsh-2.5 - Feature p2f, reset g_p2fc before a new batch is started */ + g_p2fc = 0; + if (ct_send( cmd ) != CS_SUCCEED) { fprintf( stderr, "\\do: Error sending command\n" ); - sig_restore(); ct_cmd_drop( cmd ); + sig_restore(); return(CMD_FAIL); } @@ -368,6 +374,7 @@ static int cmd_do_exec( conn, sql, dobuf ) { ct_cancel( conn, (CS_COMMAND*)NULL, CS_CANCEL_ALL ); ct_cmd_drop( cmd ); + sig_restore(); return(CMD_INTERRUPTED); } @@ -382,6 +389,7 @@ static int cmd_do_exec( conn, sql, dobuf ) { ct_cancel( conn, (CS_COMMAND*)NULL, CS_CANCEL_ALL ); ct_cmd_drop( cmd ); + sig_restore(); if (retcode == CS_CANCELED) { @@ -400,6 +408,7 @@ static int cmd_do_exec( conn, sql, dobuf ) { ct_cancel( conn, (CS_COMMAND*)NULL, CS_CANCEL_ALL ); ct_cmd_drop( cmd ); + sig_restore(); return(CMD_FAIL); } @@ -408,6 +417,7 @@ static int cmd_do_exec( conn, sql, dobuf ) ct_cancel( conn, (CS_COMMAND*)NULL, CS_CANCEL_ALL ); ct_cmd_drop( cmd ); dsp_desc_destroy( desc ); + sig_restore(); return(CMD_INTERRUPTED); } @@ -444,6 +454,7 @@ static int cmd_do_exec( conn, sql, dobuf ) */ if (ret == CMD_BREAK) { + sig_restore(); return(CMD_LEAVEBUF); } @@ -451,6 +462,7 @@ static int cmd_do_exec( conn, sql, dobuf ) ct_cmd_drop( cmd ); dsp_desc_destroy( desc ); --g_do_ncols; + sig_restore(); return(ret); } @@ -461,6 +473,7 @@ static int cmd_do_exec( conn, sql, dobuf ) ct_cancel( conn, (CS_COMMAND*)NULL, CS_CANCEL_ALL ); ct_cmd_drop( cmd ); dsp_desc_destroy( desc ); + sig_restore(); return(CMD_INTERRUPTED); } } @@ -472,6 +485,7 @@ static int cmd_do_exec( conn, sql, dobuf ) { ct_cancel( conn, (CS_COMMAND*)NULL, CS_CANCEL_ALL ); ct_cmd_drop( cmd ); + sig_restore(); if (retcode == CS_CANCELED) { @@ -490,10 +504,12 @@ static int cmd_do_exec( conn, sql, dobuf ) { ct_cancel( conn, (CS_COMMAND*)NULL, CS_CANCEL_ALL ); ct_cmd_drop( cmd ); + sig_restore(); return(CMD_FAIL); } ct_cmd_drop( cmd ); + sig_restore(); return(CMD_RESETBUF); } diff --git a/src/cmd_history.c b/src/cmd_history.c index f16fa30..42d5579 100644 --- a/src/cmd_history.c +++ b/src/cmd_history.c @@ -35,7 +35,7 @@ /*-- Current Version --*/ #if !defined(lint) && !defined(__LINT__) -static char RCS_Id[] = "$Id: cmd_history.c,v 1.8 2013/05/07 21:18:02 mwesdorp Exp $" ; +static char RCS_Id[] = "$Id: cmd_history.c,v 1.9 2013/12/03 09:22:23 mwesdorp Exp $" ; USE(RCS_Id) #endif /* !defined(lint) */ @@ -117,6 +117,7 @@ int cmd_history( argc, argv ) * sqsh-2.2.0 - Since the datetime format string may contain [] to filter out seconds for * smalldatetime datatypes, we have to remove these brackets here. Also replace the %u format * specifier with 000 when specified in the format string. + * sqsh-2.5: Strip of .%q and [] from the datetime format string. */ if (show_info == True) { @@ -125,13 +126,11 @@ int cmd_history( argc, argv ) strcpy (fmt, "%Y%m%d %H:%M:%S"); else { - for (cp = fmt; *datetime != '\0'; ++datetime) + for (cp = fmt; *datetime != '\0'; datetime++) { - if (*datetime == '%' && *(datetime+1) == 'u') + if (*datetime == '.' && *(datetime+1) == '%' && *(datetime+2) == 'q') { - sprintf (cp, "000"); - cp += 3; - datetime += 1; + datetime += 2; } else if (*datetime != '[' && *datetime != ']') *cp++ = *datetime; @@ -31,7 +31,7 @@ /*-- Current Version --*/ #if !defined(lint) && !defined(__LINT__) -static char RCS_Id[] = "$Id: dsp.c,v 1.4 2013/02/19 18:06:42 mwesdorp Exp $"; +static char RCS_Id[] = "$Id: dsp.c,v 1.5 2013/12/03 09:22:23 mwesdorp Exp $"; USE(RCS_Id) #endif /* !defined(lint) */ @@ -50,7 +50,7 @@ int g_dsp_interrupted = False; static CS_COMMAND *sg_cmd = NULL; /* - * g_dsp_props: This data structure contains the current set of + * g_dsp_props: This data structure contains the current set of * properties defined for the display sub-system. Be careful * when editing this data strcuture. */ @@ -178,6 +178,9 @@ int dsp_cmd( output, cmd, sql, flags ) sig_install( SIGINT, dsp_signal, (void*)NULL, 0 ); sig_install( SIGPIPE, dsp_signal, (void*)NULL, 0 ); + /* sqsh-2.5 - Feature p2f, reset g_p2fc before a new batch is started */ + g_p2fc = 0; + if (ct_send( cmd ) != CS_SUCCEED) ret = DSP_FAIL; @@ -188,7 +191,7 @@ int dsp_cmd( output, cmd, sql, flags ) * All that is left is to process the results of the current * query, reinstall the old signal handlers, and return! */ - if (ret == DSP_SUCCEED) + if (ret == DSP_SUCCEED) { if ((flags & DSP_F_NOTHING) != 0) { @@ -324,7 +327,7 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_COLWIDTH: - DBG(sqsh_debug(DEBUG_DISPLAY, + DBG(sqsh_debug(DEBUG_DISPLAY, "dsp_prop: dsp_prop(DSP_SET, DSP_COLWDTH, %d)\n", *((int*)ptr));) if (*((int*)ptr) < 1) @@ -337,7 +340,7 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_FLOAT_PREC: - DBG(sqsh_debug(DEBUG_DISPLAY, + DBG(sqsh_debug(DEBUG_DISPLAY, "dsp_prop: dsp_prop(DSP_SET, DSP_FLOAT_PREC, %d)\n", *((int*)ptr));) if (*((int*)ptr) < 0 || *((int*)ptr) < g_dsp_props.p_flt_scale) @@ -350,7 +353,7 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_FLOAT_SCALE: - DBG(sqsh_debug(DEBUG_DISPLAY, + DBG(sqsh_debug(DEBUG_DISPLAY, "dsp_prop: dsp_prop(DSP_SET, DSP_FLOAT_SCALE, %d)\n", *((int*)ptr));) @@ -364,7 +367,7 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_REAL_PREC: - DBG(sqsh_debug(DEBUG_DISPLAY, + DBG(sqsh_debug(DEBUG_DISPLAY, "dsp_prop: dsp_prop(DSP_SET, DSP_REAL_PREC, %d)\n", *((int*)ptr));) if (*((int*)ptr) < 0 || *((int*)ptr) < g_dsp_props.p_real_scale) @@ -377,7 +380,7 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_REAL_SCALE: - DBG(sqsh_debug(DEBUG_DISPLAY, + DBG(sqsh_debug(DEBUG_DISPLAY, "dsp_prop: dsp_prop(DSP_SET, DSP_REAL_SCALE, %d)\n", *((int*)ptr));) @@ -391,7 +394,7 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_STYLE: - DBG(sqsh_debug(DEBUG_DISPLAY, + DBG(sqsh_debug(DEBUG_DISPLAY, "dsp_prop: dsp_prop(DSP_SET, DSP_STYLE, %d)\n", *((int*)ptr));) if (!(DSP_VALID_STYLE( *((int*)ptr) ))) @@ -403,8 +406,8 @@ static int dsp_prop_set( prop, ptr, len ) g_dsp_props.p_style = *((int*)ptr); break; - case DSP_WIDTH: - DBG(sqsh_debug(DEBUG_DISPLAY, + case DSP_WIDTH: + DBG(sqsh_debug(DEBUG_DISPLAY, "dsp_prop: dsp_prop(DSP_SET, DSP_WIDTH, %d)\n", *((int*)ptr));) if (*((int*)ptr) >= 30) @@ -418,8 +421,8 @@ static int dsp_prop_set( prop, ptr, len ) } break; - case DSP_OUTPUTPARMS: - DBG(sqsh_debug(DEBUG_DISPLAY, + case DSP_OUTPUTPARMS: + DBG(sqsh_debug(DEBUG_DISPLAY, "dsp_prop: dsp_prop(DSP_SET, DSP_OUTPUTPARMS, %d)\n", *((int*)ptr));) @@ -435,8 +438,8 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_COLSEP: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_SET, DSP_COLSEP, '%s')\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_SET, DSP_COLSEP, '%s')\n", (ptr == NULL)?"NULL":((char*)ptr));) if (len == DSP_NULLTERM) @@ -446,7 +449,7 @@ static int dsp_prop_set( prop, ptr, len ) if (len > MAX_SEPLEN || len < 0) { - sqsh_set_error( SQSH_E_INVAL, + sqsh_set_error( SQSH_E_INVAL, "Invalid length of column separator (between 0 and %d allowed)", MAX_SEPLEN ); return DSP_FAIL; @@ -460,8 +463,8 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_BCP_COLSEP: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_SET, DSP_BCP_COLSEP, '%s')\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_SET, DSP_BCP_COLSEP, '%s')\n", (ptr == NULL)?"NULL":((char*)ptr));) if (len == DSP_NULLTERM) @@ -471,7 +474,7 @@ static int dsp_prop_set( prop, ptr, len ) if (len > MAX_SEPLEN || len < 0) { - sqsh_set_error( SQSH_E_INVAL, + sqsh_set_error( SQSH_E_INVAL, "Invalid length of bcp col separator (between 0 and %d allowed)", MAX_SEPLEN ); return DSP_FAIL; @@ -485,8 +488,8 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_BCP_ROWSEP: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_SET, DSP_BCP_ROWSEP, '%s')\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_SET, DSP_BCP_ROWSEP, '%s')\n", (ptr == NULL)?"NULL":((char*)ptr));) if (len == DSP_NULLTERM) @@ -496,7 +499,7 @@ static int dsp_prop_set( prop, ptr, len ) if (len > MAX_SEPLEN || len < 0) { - sqsh_set_error( SQSH_E_INVAL, + sqsh_set_error( SQSH_E_INVAL, "Invalid length of bcp row separator (between 0 and %d allowed)", MAX_SEPLEN ); return DSP_FAIL; @@ -510,8 +513,8 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_BCP_TRIM: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_SET, DSP_BCP_TRIM, '%d')\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_SET, DSP_BCP_TRIM, '%d')\n", (ptr == NULL)?-1:*((int*)ptr));) if (*((int*)ptr) == 0) @@ -525,8 +528,8 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_LINESEP: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_SET, DSP_LINESEP, '%s')\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_SET, DSP_LINESEP, '%s')\n", (ptr == NULL)?"NULL":((char*)ptr));) if (len == DSP_NULLTERM) @@ -536,7 +539,7 @@ static int dsp_prop_set( prop, ptr, len ) if (len > MAX_SEPLEN || len < 0) { - sqsh_set_error( SQSH_E_INVAL, + sqsh_set_error( SQSH_E_INVAL, "Invalid length of line separator (between 0 and %d allowed)", MAX_SEPLEN ); return DSP_FAIL; @@ -549,8 +552,8 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_XGEOM: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_SET, DSP_XGEOM, '%s')\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_SET, DSP_XGEOM, '%s')\n", (ptr == NULL)?"NULL":((char*)ptr));) if (len == DSP_NULLTERM) @@ -560,7 +563,7 @@ static int dsp_prop_set( prop, ptr, len ) if (len > MAX_XGEOM || len < 0) { - sqsh_set_error( SQSH_E_INVAL, + sqsh_set_error( SQSH_E_INVAL, "Invalid length of X geometry (between 0 and %d allowed)", MAX_XGEOM ); return DSP_FAIL; @@ -571,7 +574,7 @@ static int dsp_prop_set( prop, ptr, len ) break; case DSP_MAXLEN: - DBG(sqsh_debug(DEBUG_DISPLAY, + DBG(sqsh_debug(DEBUG_DISPLAY, "dsp_prop: dsp_prop(DSP_SET, DSP_MAXLEN, %d)\n", *((int*)ptr));) if (*((int*)ptr) < 0) @@ -612,48 +615,48 @@ static int dsp_prop_get( prop, ptr, len ) * This feature request was filed as bugreport 3603409 on Sourceforge. */ case DSP_COLWIDTH: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_COLWIDTH) = %d\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_COLWIDTH) = %d\n", g_dsp_props.p_colwidth);) *((int*)ptr) = g_dsp_props.p_colwidth; break; case DSP_FLOAT_PREC: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_FLOAT_PREC) = %d\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_FLOAT_PREC) = %d\n", g_dsp_props.p_flt_prec);) *((int*)ptr) = g_dsp_props.p_flt_prec; break; case DSP_FLOAT_SCALE: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_FLOAT_SCALE) = %d\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_FLOAT_SCALE) = %d\n", g_dsp_props.p_flt_scale);) *((int*)ptr) = g_dsp_props.p_flt_scale; break; case DSP_REAL_PREC: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_REAL_PREC) = %d\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_REAL_PREC) = %d\n", g_dsp_props.p_real_prec);) *((int*)ptr) = g_dsp_props.p_real_prec; break; case DSP_REAL_SCALE: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_REAL_SCALE) = %d\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_REAL_SCALE) = %d\n", g_dsp_props.p_real_scale);) *((int*)ptr) = g_dsp_props.p_real_scale; break; case DSP_DATETIMEFMT: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_DATETIMEFMT) = %s\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_DATETIMEFMT) = %s\n", dsp_datetimefmt_get());) if (len <= 0) @@ -666,8 +669,8 @@ static int dsp_prop_get( prop, ptr, len ) break; case DSP_DATEFMT: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_DATEFMT) = %s\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_DATEFMT) = %s\n", dsp_datefmt_get());) if (len <= 0) @@ -680,8 +683,8 @@ static int dsp_prop_get( prop, ptr, len ) break; case DSP_TIMEFMT: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_TIMEFMT) = %s\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_TIMEFMT) = %s\n", dsp_timefmt_get());) if (len <= 0) @@ -694,72 +697,72 @@ static int dsp_prop_get( prop, ptr, len ) break; case DSP_STYLE: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_STYLE) = %d\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_STYLE) = %d\n", g_dsp_props.p_style);) *((int*)ptr) = g_dsp_props.p_style; break; - case DSP_WIDTH: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_WIDTH) = %d\n", + case DSP_WIDTH: + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_WIDTH) = %d\n", g_dsp_props.p_width);) *((int*)ptr) = g_dsp_props.p_width; break; - case DSP_OUTPUTPARMS: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_OUTPUTPARMS) = %d\n", + case DSP_OUTPUTPARMS: + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_OUTPUTPARMS) = %d\n", g_dsp_props.p_outputparms);) *((int*)ptr) = g_dsp_props.p_outputparms; break; case DSP_COLSEP: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_COLSEP) = %s\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_COLSEP) = %s\n", g_dsp_props.p_colsep);) strncpy( (char*)ptr, g_dsp_props.p_colsep, len ); break; case DSP_BCP_COLSEP: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_BCP_COLSEP) = %s\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_BCP_COLSEP) = %s\n", g_dsp_props.p_bcp_colsep);) strncpy( (char*)ptr, g_dsp_props.p_bcp_colsep, len ); break; case DSP_BCP_ROWSEP: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_BCP_ROWSEP) = %s\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_BCP_ROWSEP) = %s\n", g_dsp_props.p_bcp_rowsep);) strncpy( (char*)ptr, g_dsp_props.p_bcp_rowsep, len ); break; case DSP_BCP_TRIM: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_BCP_TRIM) = %d\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_BCP_TRIM) = %d\n", g_dsp_props.p_bcp_trim);) *((int*)ptr) = g_dsp_props.p_bcp_trim; break; case DSP_LINESEP: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_LINESEP) = %s\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_LINESEP) = %s\n", g_dsp_props.p_linesep);) strncpy( (char*)ptr, g_dsp_props.p_linesep, len ); break; case DSP_XGEOM: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_XGEOM) = %s\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_XGEOM) = %s\n", g_dsp_props.p_xgeom);) if (len <= 0) @@ -772,8 +775,8 @@ static int dsp_prop_get( prop, ptr, len ) break; case DSP_MAXLEN: - DBG(sqsh_debug(DEBUG_DISPLAY, - "dsp_prop: dsp_prop(DSP_GET, DSP_MAXLEN) = %d\n", + DBG(sqsh_debug(DEBUG_DISPLAY, + "dsp_prop: dsp_prop(DSP_GET, DSP_MAXLEN) = %d\n", g_dsp_props.p_maxlen);) *((int*)ptr) = g_dsp_props.p_maxlen; diff --git a/src/dsp_desc.c b/src/dsp_desc.c index 96c0d61..f2bbd54 100644 --- a/src/dsp_desc.c +++ b/src/dsp_desc.c @@ -32,10 +32,19 @@ /*-- Current Version --*/ #if !defined(lint) && !defined(__LINT__) -static char RCS_Id[] = "$Id: dsp_desc.c,v 1.12 2013/07/22 14:02:23 mwesdorp Exp $"; +static char RCS_Id[] = "$Id: dsp_desc.c,v 1.13 2013/12/03 09:22:23 mwesdorp Exp $"; USE(RCS_Id) #endif /* !defined(lint) */ +/* + * sqsh-2.5 : FreeTDS defines a datatype CS_UNIQUE_TYPE for the MSSQL uniqueidentifier. + * In order to compile correctly and make coding somewhat easier we define the type here, + * in case it was not defined already. +*/ +#if !defined(CS_UNIQUE_TYPE) +#define CS_UNIQUE_TYPE 40 +#endif + /*-- Local Prototypes --*/ static CS_INT dsp_dlen _ANSI_ARGS(( CS_DATAFMT* )); static CS_INT dsp_just _ANSI_ARGS(( CS_INT )); @@ -75,6 +84,7 @@ static void dsp_display_fmt _ANSI_ARGS(( CS_CHAR*, CS_DATAFMT* )); || ((t) == CS_USMALLINT_TYPE) \ || ((t) == CS_UINT_TYPE) \ || ((t) == CS_UBIGINT_TYPE) \ + || ((t) == CS_UNIQUE_TYPE) \ ) #else #define LET_CTLIB_CONV(t) ( \ @@ -93,6 +103,7 @@ static void dsp_display_fmt _ANSI_ARGS(( CS_CHAR*, CS_DATAFMT* )); || ((t) == CS_VARCHAR_TYPE) \ || ((t) == CS_VARBINARY_TYPE) \ || ((t) == CS_UNICHAR_TYPE) \ + || ((t) == CS_UNIQUE_TYPE) \ ) #endif @@ -908,6 +919,8 @@ static CS_INT dsp_dlen( fmt ) case CS_UBIGINT_TYPE: return 20; #endif + case CS_UNIQUE_TYPE: + return 36; default: break; } diff --git a/src/dsp_meta.c b/src/dsp_meta.c index 910f141..8759806 100644 --- a/src/dsp_meta.c +++ b/src/dsp_meta.c @@ -32,7 +32,7 @@ /*-- Current Version --*/ #if !defined(lint) && !defined(__LINT__) -static char RCS_Id[] = "$Id: dsp_meta.c,v 1.4 2013/07/20 16:18:35 mwesdorp Exp $"; +static char RCS_Id[] = "$Id: dsp_meta.c,v 1.5 2013/12/03 09:22:23 mwesdorp Exp $"; USE(RCS_Id) #endif /* !defined(lint) */ @@ -614,6 +614,10 @@ static CS_CHAR* dsp_meta_datatype( t ) case CS_BIGTIME_TYPE: return "CS_BIGTIME_TYPE"; #endif +#if defined(CS_UNIQUE_TYPE) + case CS_UNIQUE_TYPE: + return "CS_UNIQUE_TYPE"; +#endif default: break; } diff --git a/src/sqsh_config.h b/src/sqsh_config.h index 91fbcc2..6603d5b 100644 --- a/src/sqsh_config.h +++ b/src/sqsh_config.h @@ -149,7 +149,7 @@ /* * Current version number. */ -#define SQSH_VERSION "sqsh-2.4" +#define SQSH_VERSION "sqsh-2.5" #if !defined(__ansi__) # if defined(__STDC__) || defined(STDC_HEADERS) || defined(PROTOTYPES) diff --git a/src/sqsh_global.c b/src/sqsh_global.c index 5ddddd7..6ec1081 100644 --- a/src/sqsh_global.c +++ b/src/sqsh_global.c @@ -28,7 +28,7 @@ /*-- Current Version --*/ #if !defined(lint) && !defined(__LINT__) -static char RCS_Id[] = "$Id: sqsh_global.c,v 1.9 2013/07/20 16:18:35 mwesdorp Exp $" ; +static char RCS_Id[] = "$Id: sqsh_global.c,v 1.10 2013/12/03 09:22:23 mwesdorp Exp $" ; USE(RCS_Id) #endif /* !defined(lint) */ @@ -55,11 +55,18 @@ char *g_version = SQSH_VERSION; dsp_desc_t *g_do_cols[64]; int g_do_ncols = 0; funcarg_t g_func_args[64]; -int g_func_nargs = 0; -int g_interactive = False; +int g_func_nargs = 0; +int g_interactive = False; #if defined(HAVE_LOCALE_H) struct lconv *g_lconv = NULL; #else void *g_lconv = NULL; #endif + +/* + * sqsh-2.5 - Initialize variables for p2f feature. + */ +FILE *g_p2f_fp = NULL; +int g_p2fc = 0; + diff --git a/src/sqsh_global.h b/src/sqsh_global.h index f9e1b09..4d5b978 100644 --- a/src/sqsh_global.h +++ b/src/sqsh_global.h @@ -147,7 +147,7 @@ extern char *g_version ; /* * g_password & g_lock: Contains the current value of the regular database - * password and the session lock password. + * password and the session lock password. */ extern int g_password_set; extern char *g_password; @@ -167,4 +167,11 @@ extern int g_interactive; extern void *g_lconv; #endif +/* + * sqsh-2.5 - New feature: Print to file from message handler after $p2faxm + * number of printed messages to screen. + */ +extern FILE *g_p2f_fp; /* Print to file filepointer */ +extern int g_p2fc; /* Print to file count */ + #endif diff --git a/src/sqsh_init.c b/src/sqsh_init.c index 5ee2353..3e1a6b8 100644 --- a/src/sqsh_init.c +++ b/src/sqsh_init.c @@ -48,7 +48,7 @@ /*-- Current Version --*/ #if !defined(lint) && !defined(__LINT__) -static char RCS_Id[] = "$Id: sqsh_init.c,v 1.8 2013/07/23 20:57:28 mwesdorp Exp $" ; +static char RCS_Id[] = "$Id: sqsh_init.c,v 1.9 2013/12/03 09:22:23 mwesdorp Exp $" ; USE(RCS_Id) #endif /* !defined(lint) */ @@ -377,6 +377,14 @@ void sqsh_exit( exit_status ) fprintf (stdout, "%c]0;%c", '\033', '\007' ); } + /* + * sqsh-2.5 - Close file $p2fname + */ + if (g_p2f_fp != NULL) { + fclose (g_p2f_fp); + g_p2f_fp = NULL; + } + if( g_env != NULL ) { env_destroy( g_env ) ; g_env = NULL; diff --git a/src/sqsh_parser/sqsh_parser.c b/src/sqsh_parser/sqsh_parser.c index c7a0540..c3014df 100644 --- a/src/sqsh_parser/sqsh_parser.c +++ b/src/sqsh_parser/sqsh_parser.c @@ -17,7 +17,7 @@ void* def_root = NULL; aliascallback callback = NULL; long callbacklparam = 0; -void* xmalloc(size_t size) { +static void* xmalloc(size_t size) { void* m = malloc(size); if (m == NULL) { exit(0); @@ -26,7 +26,7 @@ void* xmalloc(size_t size) { return m; } -void free_node(void *nodep) { +static void free_node(void *nodep) { t_tdef* datap; datap = (t_tdef*) nodep; @@ -36,7 +36,7 @@ void free_node(void *nodep) { } -int def_compare(const void *pa, const void *pb) { +static int def_compare(const void *pa, const void *pb) { return strcmp(((t_tdef*) pa)->alias, ((t_tdef*) pb)->alias); } @@ -59,7 +59,7 @@ void* addTableDefNode(char* table, char* alias) { return p; } -void callback_walker(const void *nodep, const VISIT which, const int depth) { +static void callback_walker(const void *nodep, const VISIT which, const int depth) { t_tdef* datap; datap = *(t_tdef**) nodep; @@ -75,7 +75,7 @@ void callback_walker(const void *nodep, const VISIT which, const int depth) { } } -void print_walker(const void *nodep, const VISIT which, const int depth) { +static void print_walker(const void *nodep, const VISIT which, const int depth) { t_tdef* datap; datap = *(t_tdef**) nodep; diff --git a/src/sqsh_parser/tsql.l b/src/sqsh_parser/tsql.l index 219e3fd..911a3e7 100644 --- a/src/sqsh_parser/tsql.l +++ b/src/sqsh_parser/tsql.l @@ -23,7 +23,7 @@ ws [ \t\r\n] <INITIAL>(?i:insert|update|delete)/{ws}+ {BEGIN INDML; KW(INSUP);} <INITIAL>(?i:insert{ws}+into)/{ws}+ {BEGIN INDML; KW(INSUP);} <INITIAL,INFROM>(?i:join)/{ws}+ {BEGIN INFROM; KW(JOIN);} -<INFROM>(?i:left|right|outer)/{ws}+ {BEGIN INITIAL;} +<INFROM>(?i:inner|left|right|outer)/{ws}+ {BEGIN INITIAL;} <INFROM>(?i:where|on)/{ws}+ {BEGIN INITIAL;} <INFROM>{alpha}{anum}* {KW(TOKEN);} <INFROM>\"{alpha}{anumsp}*\" {KW(TOKEN);} diff --git a/src/sqsh_parser/tsql.yy.c b/src/sqsh_parser/tsql.yy.c index 0548c00..f6b037a 100644 --- a/src/sqsh_parser/tsql.yy.c +++ b/src/sqsh_parser/tsql.yy.c @@ -381,33 +381,33 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_acclist[92] = +static yyconst flex_int16_t yy_acclist[100] = { 0, 18, 15, 17, 16, 17, 15, 17, 15, 17, 15, 17, 15, 17, 15, 17, 15, 17, 14, 15, 17, 13, 15, 17, 7, 15, 17, 7, 15, 17, 7, 15, 17, 7, 15, 17, 7, 15, 17, 7, 15, - 17, 15, 17, 15, 17, 10, 15, 17, 15, 17, - 7, 7, 7, 7,16390, 7, 7, 7, 10, 8, - 7, 7, 8198, 7, 7, 7, 9, 11, 12, 7, - 7,16389, 7, 7, 7, 4, 1, 8197, 7,16389, - 7,16389, 7,16390,16386,16386,16386, 8194, 8194,16387, - 8195 + 17, 7, 15, 17, 15, 17, 15, 17, 10, 15, + 17, 15, 17, 7, 7, 7, 7, 7,16390, 7, + 7, 7, 10, 8, 7, 7, 7, 8198, 7, 7, + 7, 9, 11, 12, 7, 7, 7,16389, 7, 7, + 7, 4, 1, 7,16389, 8197, 7,16389, 7,16389, + 7,16390,16386,16386,16386, 8194, 8194,16387, 8195 } ; -static yyconst flex_int16_t yy_accept[95] = +static yyconst flex_int16_t yy_accept[100] = { 0, 1, 1, 1, 1, 1, 1, 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 21, 24, 27, 30, - 33, 36, 39, 42, 44, 46, 49, 51, 51, 51, - 51, 51, 51, 51, 52, 53, 54, 56, 57, 58, - 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, - 60, 61, 62, 63, 64, 65, 66, 67, 67, 68, - 68, 69, 69, 70, 70, 70, 70, 70, 70, 71, - 73, 74, 75, 76, 76, 76, 77, 77, 78, 79, - 81, 83, 85, 86, 87, 88, 89, 90, 90, 90, - 90, 91, 92, 92 + 33, 36, 39, 42, 45, 47, 49, 52, 54, 54, + 54, 54, 54, 54, 54, 55, 56, 57, 58, 60, + 61, 62, 63, 63, 63, 64, 64, 64, 64, 64, + 64, 64, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 72, 73, 73, 74, 74, 75, 75, 75, 75, + 75, 75, 76, 77, 79, 80, 81, 82, 82, 82, + 83, 83, 84, 86, 87, 89, 91, 93, 94, 95, + 96, 97, 98, 98, 98, 98, 99, 100, 100 } ; @@ -443,173 +443,173 @@ static yyconst flex_int32_t yy_meta[257] = 1, 1, 1, 1, 1, 7 } ; -static yyconst flex_int16_t yy_base[105] = +static yyconst flex_int16_t yy_base[110] = { 0, 0, 7, 115, 0, 301, 0, 161, 525, 525, 0, - 0, 0, 2, 46, 0, 525, 525, 0, 4, 2, - 6, 3, 0, 0, 0, 0, 0, 10, 4, 15, - 21, 47, 123, 0, 17, 24, 2, 11, 25, 28, - 63, 120, 0, 60, 29, 30, 54, 68, 43, 117, - 525, 56, 51, 9, 67, 65, 56, 57, 525, 114, - 525, 0, 525, 55, 58, 11, 57, 16, 18, 23, - 60, 59, 75, 76, 62, 29, 78, 229, 231, 236, - 238, 243, 245, 256, 263, 272, 289, 133, 173, 180, - 274, 283, 525, 496, 3, 499, 2, 1, 501, 0, - - 505, 509, 514, 518 + 0, 0, 2, 46, 0, 525, 525, 0, 5, 5, + 2, 9, 3, 0, 0, 0, 0, 0, 10, 5, + 16, 22, 47, 123, 0, 13, 22, 26, 2, 13, + 27, 30, 63, 120, 0, 60, 63, 64, 56, 70, + 43, 117, 525, 67, 59, 54, 9, 70, 68, 59, + 57, 525, 114, 525, 0, 525, 58, 61, 11, 60, + 16, 63, 18, 23, 64, 63, 138, 139, 125, 29, + 142, 235, 237, 243, 245, 250, 252, 263, 276, 281, + 283, 289, 160, 165, 172, 291, 296, 525, 496, 3, + + 499, 2, 1, 501, 0, 505, 509, 514, 518 } ; -static yyconst flex_int16_t yy_def[105] = +static yyconst flex_int16_t yy_def[110] = { 0, - 94, 94, 94, 3, 94, 5, 93, 93, 93, 93, - 93, 93, 93, 93, 95, 93, 93, 96, 96, 96, - 96, 96, 96, 97, 98, 99, 100, 93, 93, 93, - 93, 93, 101, 96, 96, 96, 96, 96, 96, 96, - 102, 103, 99, 104, 93, 93, 93, 93, 93, 101, - 93, 96, 96, 93, 96, 96, 96, 102, 93, 103, - 93, 104, 93, 93, 93, 93, 93, 93, 96, 96, - 96, 96, 96, 93, 93, 93, 93, 93, 93, 96, - 96, 96, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 0, 93, 93, 93, 93, 93, 93, 93, - - 93, 93, 93, 93 + 99, 99, 99, 3, 99, 5, 98, 98, 98, 98, + 98, 98, 98, 98, 100, 98, 98, 101, 101, 101, + 101, 101, 101, 101, 102, 103, 104, 105, 98, 98, + 98, 98, 98, 106, 101, 101, 101, 101, 101, 101, + 101, 101, 107, 108, 104, 109, 98, 98, 98, 98, + 98, 106, 98, 101, 101, 101, 98, 101, 101, 101, + 107, 98, 108, 98, 109, 98, 98, 98, 98, 98, + 98, 101, 101, 101, 101, 101, 101, 98, 98, 98, + 98, 98, 101, 98, 101, 101, 101, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 0, 98, 98, + + 98, 98, 98, 98, 98, 98, 98, 98, 98 } ; static yyconst flex_int16_t yy_nxt[782] = { 0, - 93, 93, 93, 93, 44, 42, 41, 33, 93, 9, - 54, 54, 93, 93, 54, 93, 9, 54, 54, 76, - 76, 54, 93, 76, 78, 78, 76, 76, 78, 93, - 76, 79, 79, 54, 93, 79, 93, 76, 76, 93, - 54, 76, 76, 93, 93, 93, 93, 78, 93, 76, - 93, 93, 93, 93, 79, 93, 93, 93, 93, 93, - 76, 93, 93, 93, 93, 93, 93, 10, 28, 93, - 36, 40, 11, 12, 10, 39, 93, 29, 30, 11, - 12, 31, 35, 37, 13, 45, 46, 47, 48, 52, - 38, 13, 63, 53, 55, 56, 57, 64, 65, 10, - - 28, 14, 36, 40, 11, 12, 10, 39, 14, 29, - 30, 11, 12, 31, 35, 37, 13, 45, 46, 47, - 48, 52, 38, 13, 9, 53, 55, 56, 57, 64, - 65, 66, 67, 69, 70, 71, 72, 73, 74, 75, - 77, 80, 81, 82, 83, 84, 85, 61, 15, 59, - 51, 68, 63, 61, 16, 59, 51, 49, 17, 32, - 93, 93, 93, 66, 67, 69, 70, 71, 72, 73, - 74, 75, 77, 80, 81, 82, 83, 84, 85, 18, - 18, 18, 18, 18, 18, 18, 18, 18, 19, 18, - 20, 18, 18, 21, 18, 18, 22, 18, 18, 18, - - 18, 23, 18, 18, 18, 24, 93, 93, 93, 18, - 89, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 19, 18, 20, 18, 18, 21, 18, 18, 22, 18, - 18, 18, 18, 23, 18, 18, 18, 78, 78, 79, - 79, 78, 89, 79, 79, 79, 79, 79, 79, 93, - 79, 54, 54, 86, 86, 54, 90, 86, 91, 93, - 78, 93, 79, 93, 87, 87, 93, 79, 87, 79, - 93, 86, 86, 18, 54, 86, 86, 93, 18, 93, - 86, 86, 92, 92, 86, 93, 92, 87, 90, 93, - 91, 92, 92, 93, 86, 92, 18, 87, 87, 93, - - 93, 87, 18, 86, 93, 92, 93, 93, 93, 18, - 9, 93, 93, 93, 92, 93, 93, 93, 93, 93, - 87, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 25, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 88, 93, 93, 93, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 27, 93, 88, 93, 26, 93, 26, 26, 26, - - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 26, - 93, 93, 93, 93, 26, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 26, 93, 93, 93, 93, 93, 26, 93, - 93, 93, 93, 93, 93, 26, 8, 8, 8, 8, - - 8, 8, 34, 34, 43, 43, 50, 50, 50, 50, - 58, 93, 58, 58, 58, 60, 60, 60, 60, 62, - 93, 62, 62, 62, 7, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93 + 98, 98, 98, 98, 46, 44, 43, 34, 98, 9, + 57, 57, 98, 98, 57, 98, 9, 57, 57, 80, + 80, 57, 98, 80, 82, 82, 80, 80, 82, 98, + 80, 84, 84, 57, 98, 84, 98, 80, 80, 98, + 57, 80, 80, 98, 98, 98, 98, 82, 98, 80, + 98, 98, 98, 98, 84, 98, 98, 98, 98, 98, + 80, 98, 98, 98, 98, 98, 98, 10, 29, 98, + 38, 42, 11, 12, 10, 41, 98, 30, 31, 11, + 12, 32, 36, 37, 13, 47, 39, 48, 49, 50, + 54, 13, 66, 40, 55, 56, 58, 59, 60, 10, + + 29, 14, 38, 42, 11, 12, 10, 41, 14, 30, + 31, 11, 12, 32, 36, 37, 13, 47, 39, 48, + 49, 50, 54, 13, 9, 40, 55, 56, 58, 59, + 60, 67, 68, 69, 70, 72, 73, 74, 75, 76, + 77, 78, 79, 81, 83, 85, 86, 64, 15, 62, + 53, 71, 66, 64, 16, 62, 53, 51, 17, 33, + 98, 98, 98, 67, 68, 69, 70, 72, 73, 74, + 75, 76, 77, 78, 79, 81, 83, 85, 86, 18, + 18, 18, 18, 18, 18, 18, 18, 19, 20, 18, + 21, 18, 18, 22, 18, 18, 23, 18, 18, 18, + + 18, 24, 18, 18, 18, 25, 87, 88, 89, 18, + 90, 18, 18, 18, 18, 18, 18, 18, 18, 19, + 20, 18, 21, 18, 18, 22, 18, 18, 23, 18, + 18, 18, 18, 24, 18, 18, 18, 94, 87, 88, + 89, 98, 90, 82, 82, 84, 84, 82, 95, 84, + 96, 84, 84, 84, 84, 84, 98, 84, 84, 84, + 57, 57, 84, 98, 57, 98, 82, 98, 84, 94, + 98, 91, 91, 18, 84, 91, 84, 98, 18, 98, + 95, 84, 96, 57, 92, 92, 98, 98, 92, 91, + 91, 91, 91, 91, 91, 91, 18, 92, 92, 97, + + 97, 92, 18, 97, 97, 97, 98, 92, 97, 18, + 9, 98, 91, 98, 91, 98, 98, 98, 98, 98, + 92, 98, 97, 98, 98, 98, 98, 97, 98, 98, + 98, 98, 98, 98, 26, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 93, 98, 98, 98, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 28, 98, 93, 98, 27, 98, 27, 27, 27, + + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 27, + 98, 98, 98, 98, 27, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 27, 98, 98, 98, 98, 98, 27, 98, + 98, 98, 98, 98, 98, 27, 8, 8, 8, 8, + + 8, 8, 35, 35, 45, 45, 52, 52, 52, 52, + 61, 98, 61, 61, 61, 63, 63, 63, 63, 65, + 98, 65, 65, 65, 7, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98 } ; static yyconst flex_int16_t yy_chk[782] = { 0, - 0, 0, 0, 0, 100, 98, 97, 95, 0, 1, - 37, 37, 0, 0, 37, 0, 2, 54, 54, 66, - 66, 54, 0, 66, 68, 68, 69, 69, 68, 0, - 69, 70, 70, 37, 0, 70, 0, 76, 76, 0, - 54, 76, 66, 0, 0, 0, 0, 68, 0, 69, - 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, - 76, 0, 0, 0, 0, 0, 0, 1, 10, 0, - 20, 23, 1, 1, 2, 22, 0, 11, 12, 2, - 2, 13, 19, 21, 1, 28, 29, 30, 31, 35, - 21, 2, 62, 36, 38, 39, 40, 45, 46, 1, - - 10, 1, 20, 23, 1, 1, 2, 22, 2, 11, - 12, 2, 2, 13, 19, 21, 1, 28, 29, 30, - 31, 35, 21, 2, 3, 36, 38, 39, 40, 45, - 46, 47, 48, 52, 53, 55, 56, 57, 64, 65, - 67, 71, 72, 73, 74, 75, 77, 60, 3, 58, - 50, 49, 44, 42, 3, 41, 33, 32, 3, 14, - 7, 0, 0, 47, 48, 52, 53, 55, 56, 57, - 64, 65, 67, 71, 72, 73, 74, 75, 77, 3, + 0, 0, 0, 0, 105, 103, 102, 100, 0, 1, + 39, 39, 0, 0, 39, 0, 2, 57, 57, 69, + 69, 57, 0, 69, 71, 71, 73, 73, 71, 0, + 73, 74, 74, 39, 0, 74, 0, 80, 80, 0, + 57, 80, 69, 0, 0, 0, 0, 71, 0, 73, + 0, 0, 0, 0, 74, 0, 0, 0, 0, 0, + 80, 0, 0, 0, 0, 0, 0, 1, 10, 0, + 21, 24, 1, 1, 2, 23, 0, 11, 12, 2, + 2, 13, 19, 20, 1, 29, 22, 30, 31, 32, + 36, 2, 65, 22, 37, 38, 40, 41, 42, 1, + + 10, 1, 21, 24, 1, 1, 2, 23, 2, 11, + 12, 2, 2, 13, 19, 20, 1, 29, 22, 30, + 31, 32, 36, 2, 3, 22, 37, 38, 40, 41, + 42, 47, 48, 49, 50, 54, 55, 56, 58, 59, + 60, 67, 68, 70, 72, 75, 76, 63, 3, 61, + 52, 51, 46, 44, 3, 43, 34, 33, 3, 14, + 7, 0, 0, 47, 48, 49, 50, 54, 55, 56, + 58, 59, 60, 67, 68, 70, 72, 75, 76, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 0, 0, 0, 3, - 88, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 77, 78, 79, 3, + 81, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 78, 78, 79, - 79, 78, 88, 79, 80, 80, 81, 81, 80, 0, - 81, 82, 82, 83, 83, 82, 89, 83, 90, 0, - 78, 0, 79, 0, 84, 84, 0, 80, 84, 81, - 0, 85, 85, 3, 82, 85, 83, 0, 3, 0, - 86, 86, 91, 91, 86, 0, 91, 84, 89, 0, - 90, 92, 92, 0, 85, 92, 3, 87, 87, 0, - - 0, 87, 3, 86, 0, 91, 0, 0, 0, 3, - 5, 0, 0, 0, 92, 0, 0, 0, 0, 0, - 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 3, 3, 3, 3, 3, 3, 93, 77, 78, + 79, 0, 81, 82, 82, 83, 83, 82, 94, 83, + 95, 84, 84, 85, 85, 84, 0, 85, 86, 86, + 87, 87, 86, 0, 87, 0, 82, 0, 83, 93, + 0, 88, 88, 3, 84, 88, 85, 0, 3, 0, + 94, 86, 95, 87, 89, 89, 0, 0, 89, 90, + 90, 91, 91, 90, 88, 91, 3, 92, 92, 96, + + 96, 92, 3, 96, 97, 97, 0, 89, 97, 3, + 5, 0, 90, 0, 91, 0, 0, 0, 0, 0, + 92, 0, 96, 0, 0, 0, 0, 97, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 87, 0, 0, 0, 5, 5, 5, 5, 5, + 0, 92, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 0, 87, 0, 5, 0, 5, 5, 5, + 5, 5, 0, 92, 0, 5, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, @@ -620,42 +620,42 @@ static yyconst flex_int16_t yy_chk[782] = 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 5, 94, 94, 94, 94, - - 94, 94, 96, 96, 99, 99, 101, 101, 101, 101, - 102, 0, 102, 102, 102, 103, 103, 103, 103, 104, - 0, 104, 104, 104, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93 + 0, 0, 0, 0, 0, 5, 99, 99, 99, 99, + + 99, 99, 101, 101, 104, 104, 106, 106, 106, 106, + 107, 0, 107, 107, 107, 108, 108, 108, 108, 109, + 0, 109, 109, 109, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, + 98 } ; -static yyconst yy_state_type yy_NUL_trans[93] = +static yyconst yy_state_type yy_NUL_trans[98] = { 0, 8, 8, 8, 8, 8, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -666,7 +666,7 @@ static yyconst yy_state_type yy_NUL_trans[93] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 + 0, 0, 0, 0, 0, 0, 0 } ; @@ -954,7 +954,7 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 94 ) + if ( yy_current_state >= 99 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1371,7 +1371,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 94 ) + if ( yy_current_state >= 99 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -63,6 +63,7 @@ int var_set_maxlen _ANSI_ARGS(( env_t*, char*, char** )) ; int var_set_datefmt _ANSI_ARGS(( env_t*, char*, char** )) ; int var_set_timefmt _ANSI_ARGS(( env_t*, char*, char** )) ; int var_set_lconv _ANSI_ARGS(( env_t*, char*, char** )) ; +int var_set_p2fname _ANSI_ARGS(( env_t*, char*, char** )) ; /*-- Retrieval validation functions --*/ int var_get_date _ANSI_ARGS(( env_t*, char*, char** )) ; @@ -209,6 +210,9 @@ static var_entry_t sg_var_entry[] = { { "localeconv", "0", var_set_lconv, NULL }, /* sqsh-2.4 - New variable */ { "usedbcheck", "0", var_set_bool, NULL }, + /* sqsh-2.5 - New variables */ + { "p2faxm", NULL, var_set_nullint, NULL }, + { "p2fname", NULL, var_set_p2fname, NULL }, } ; #endif /* SQSH_INIT */ diff --git a/src/var_misc.c b/src/var_misc.c index b680dd0..17e72bb 100644 --- a/src/var_misc.c +++ b/src/var_misc.c @@ -30,10 +30,11 @@ #include "sqsh_stdin.h" #include "var.h" #include "sqsh_global.h" +#include "sqsh_fd.h" /*-- Current Version --*/ #if !defined(lint) && !defined(__LINT__) -static char RCS_Id[] = "$Id: var_misc.c,v 1.3 2013/07/23 20:57:28 mwesdorp Exp $" ; +static char RCS_Id[] = "$Id: var_misc.c,v 1.4 2013/12/03 09:22:23 mwesdorp Exp $" ; USE(RCS_Id) #endif /* !defined(lint) */ @@ -287,7 +288,7 @@ int var_set_int( env, var_name, var_value ) char **var_value ; { /*-- Can't set it a NULL value --*/ - if( var_value == NULL || *var_value == NULL ) { + if( var_value == NULL || *var_value == NULL || strcmp(*var_value, "NULL") == 0) { sqsh_set_error( SQSH_E_INVAL, "Invalid integer expression" ) ; return False ; } @@ -472,3 +473,37 @@ int var_set_lconv( env, var_name, var_value ) return False ; } +/* + * sqsh-2.5 - New feature p2f (Print to File) + * Assume var_name == "p2fname" + */ +int var_set_p2fname( env, var_name, var_value ) + env_t *env ; + char *var_name ; + char **var_value ; +{ + + if ( strcmp(var_name, "p2fname") != 0 ) { + sqsh_set_error( SQSH_E_INVAL, "Unexpected variable name %s", var_name ) ; + return False; + } + + if (g_p2f_fp != NULL) { + fclose (g_p2f_fp); + g_p2f_fp = NULL; + } + + if ( *var_value == NULL || strcmp( *var_value, "NULL" ) == 0 ) { + *var_value = NULL ; + } + else { + if( (g_p2f_fp = fopen( *var_value, "a" )) == NULL) { + sqsh_set_error( SQSH_E_INVAL, "Unable to open file %s", *var_value ) ; + *var_value = NULL ; + return False; + } + } + + return True ; +} + |