aboutsummaryrefslogtreecommitdiff
path: root/project/src/lib-file.c
diff options
context:
space:
mode:
authorWiimm <wiimm@wiimm.de>2020-11-30 16:16:56 +0100
committerWiimm <wiimm@wiimm.de>2020-11-30 16:16:56 +0100
commit9c0078c6b9c1309b48f9ece8b5cad1b9be9a75c5 (patch)
tree0abd3b6a244076650e40a07e42adae9c2a6b2d8c /project/src/lib-file.c
parenta0815499b2d9014695e6e261c909476729445360 (diff)
SZS v2.21a
Diffstat (limited to 'project/src/lib-file.c')
-rw-r--r--project/src/lib-file.c249
1 files changed, 0 insertions, 249 deletions
diff --git a/project/src/lib-file.c b/project/src/lib-file.c
index d5a01f2..979d875 100644
--- a/project/src/lib-file.c
+++ b/project/src/lib-file.c
@@ -3107,255 +3107,6 @@ enumError SaveSubFiles ( SubDir_t *sd, ccp basepath )
//
///////////////////////////////////////////////////////////////////////////////
-/////////////// PrintScript ///////////////
-///////////////////////////////////////////////////////////////////////////////
-
-void PrintScriptHeader ( PrintScript_t *ps )
-{
- DASSERT(ps);
-
- ps->index = 0;
- ps->add_index = false;
- ps->sep[0] = ps->sep[1] = 0;
-
- if ( ps->fo && ps->fo->f )
- {
- switch (script_fform)
- {
- case FF_JSON:
- if ( script_array > 0 )
- fputs("[",ps->fo->f);
- break;
-
- case FF_SH:
- ps->add_index = script_array > 0;
- break;
-
- case FF_PHP:
- if ( script_array > 0 )
- fprintf(ps->fo->f,"$%s = array();\n\n",script_varname);
- break;
-
- case FF_MAKEDOC:
- if ( script_array > 0 )
- fprintf(ps->fo->f,"%s = @LIST\n\n",script_varname);
- break;
-
- default:
- //fputc('\n',ps->fo->f);
- break;
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-void PrintScriptFooter ( PrintScript_t *ps )
-{
- DASSERT(ps);
-
- if ( ps && ps->fo && ps->fo->f )
- {
- switch (script_fform)
- {
- case FF_JSON:
- if ( script_array > 0 )
- fputs("]\n",ps->fo->f);
- break;
-
- case FF_SH:
- if (script_array)
- fprintf(ps->fo->f,"%s_N=%u\n\n",script_varname,ps->index);
- break;
-
- case FF_PHP:
- fputs("?>\n",ps->fo->f);
- break;
-
- default:
- break;
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-int PutScriptVars
-(
- PrintScript_t *ps, // valid control struct
- uint mode, // bit field: 1=open var, 2:close var
- ccp text // text with line of format NAME=VALUE
-)
-{
- DASSERT(ps);
-
- FILE * f = ps->fo ? ps->fo->f : 0;
- if (!f)
- return 0;
-
-
- //--- begin of output
-
- if ( mode & 1 )
- {
- if ( ps->add_index )
- snprintf( ps->prefix, sizeof(ps->prefix),
- "%s_%u", script_varname, ps->index );
- else
- snprintf( ps->prefix, sizeof(ps->prefix),
- "%s", script_varname );
-
- switch (script_fform)
- {
- case FF_JSON:
- fprintf(f,"%s{",ps->sep);
- ps->sep[0] = ',';
- break;
-
- case FF_PHP:
- fputs("$d = new \\stdClass;\n",f);
- break;
-
- case FF_MAKEDOC:
- fprintf(f,"d = @MAP\n");
- break;
-
- default:
- break;
- }
- }
-
-
- //--- print var lines
-
- if (!text)
- text = "";
-
- uint count;
- for( count = 0; ; count++ )
- {
- while ( *text && (uchar)*text <= ' ' )
- text++;
-
- ccp ptr = text;
- while ( *ptr && *ptr != '=' )
- ptr++;
- if ( *ptr != '=' || ptr == text )
- break;
-
- ccp param = ptr++;
- while ( (uchar)*ptr >= ' ' )
- ptr++;
-
- switch (script_fform)
- {
- case FF_JSON:
- fprintf(f, "%s\"%.*s\":%.*s",
- count ? "," : "",
- (int)( param - text ), text,
- (int)( ptr - param - 1 ), param+1 );
- break;
-
- case FF_BASH:
- if (script_array)
- {
- fprintf(f, "%s_%.*s%s=(%.*s)\n", ps->prefix,
- (int)( param - text ), text,
- ps->index ? "+" : "",
- (int)( ptr - param - 1 ), param+1 );
- break;
- }
- // fall through
-
- case FF_SH:
- fprintf(f, "%s_%.*s=%.*s\n", ps->prefix,
- (int)( param - text ), text,
- (int)( ptr - param - 1 ), param+1 );
- break;
-
- case FF_PHP:
- fprintf(f, "$d->%.*s = %.*s;\n",
- (int)( param - text ), text,
- (int)( ptr - param - 1 ), param+1 );
- break;
-
- case FF_MAKEDOC:
- fprintf(f, "d[\"%.*s\"] = %.*s\n",
- (int)( param - text ), text,
- (int)( ptr - param - 1 ), param+1 );
- break;
-
- default:
- fprintf(f, "%20.*s = %.*s\n",
- (int)( param - text ), text,
- (int)( ptr - param - 1 ), param+1 );
- break;
- }
-
- text = ptr;
- }
-
-
- //--- end of output
-
- if ( mode & 2 )
- {
- switch (script_fform)
- {
- case FF_JSON:
- fputs("}\n",f);
- break;
-
- case FF_PHP:
- fprintf(f, "$%s%s = $d;\n\n",
- ps->prefix, script_array ? "[]" : "" );
- break;
-
- case FF_MAKEDOC:
- fprintf(f, "%s %s= move(d);\n\n",
- ps->prefix, script_array ? "#" : "" );
- break;
-
- default:
- fputc('\n',f);
- break;
- }
- fflush(f);
- }
-
- ps->index++;
- return count;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-int PrintScriptVars
-(
- PrintScript_t *ps, // valid control struct
- uint mode, // bit field: 1=open var, 2:close var
- ccp format, // format of message
- ... // arguments
-
-)
-{
- DASSERT(ps);
-
- char buf[5000];
- if (format)
- {
- va_list arg;
- va_start(arg,format);
- vsnprintf(buf,sizeof(buf),format,arg);
- va_end(arg);
- }
- else
- *buf = 0;
-
- return PutScriptVars(ps,mode,buf);
-}
-
-//
-///////////////////////////////////////////////////////////////////////////////
/////////////// Base64 coding ///////////////
///////////////////////////////////////////////////////////////////////////////