00001
00002
00003
00004
00005
00006 #include<linux/linkage.h>
00007 #include<descrip.h>
00008 #include<system_data_cells.h>
00009 #include<ssdef.h>
00010 #include<stdarg.h>
00011 #include <exe_routines.h>
00012 #include <linux/string.h>
00013 #include<linux/kernel.h>
00014
00015 asmlinkage int exe_faol(void * ctrstr , short int * outlen , void * outbuf , int * prmlst) {
00016 long * argv=prmlst;
00017 struct dsc_descriptor * in=ctrstr;
00018 struct dsc_descriptor * out=outbuf;
00019 int in_dex=0,out_dex=0;
00020 char * in_p=in->dsc_a_pointer;
00021 char * out_p=out->dsc_a_pointer;
00022 signed int argv_num=0;
00023 while (in_dex<in->dsc_w_length) {
00024 char c;
00025 c=in_p[in_dex++];
00026 switch (c) {
00027 case '!':
00028 c=in_p[in_dex++];
00029 switch (c) {
00030 case 'A':
00031 c=in_p[in_dex++];
00032 switch (c) {
00033 case 'C':
00034 {
00035 char * bufc=argv[argv_num++];
00036 char len=*bufc++;
00037 memcpy(&out_p[out_dex],bufc,len);
00038 out_dex+=len;
00039 }
00040 break;
00041 case 'F':
00042
00043 case 'D':
00044 {
00045 char len=argv[argv_num++];
00046 char * bufc=argv[argv_num++];
00047 memcpy(&out_p[out_dex],bufc,len);
00048 out_dex+=len;
00049 }
00050 break;
00051 case 'S':
00052 {
00053 struct dsc_descriptor * d=argv[argv_num++];
00054 char len=d->dsc_w_length;
00055 char * bufc=d->dsc_a_pointer;
00056 memcpy(&out_p[out_dex],bufc,len);
00057 out_dex+=len;
00058 }
00059 break;
00060 case 'Z':
00061 {
00062
00063 char * bufc=argv[argv_num++];
00064 char len=strlen(bufc);
00065 memcpy(&out_p[out_dex],bufc,len);
00066 out_dex+=len;
00067 }
00068 break;
00069 default:
00070 printk("fao !A%c stuff not recognized\n",c);
00071 }
00072 break;
00073 case 'O':
00074 case 'X':
00075 case 'Z':
00076 case 'S':
00077 case 'U':
00078 case 'I':
00079 {
00080 char type=0;
00081 long mask=0;
00082 int num=0;
00083 switch (c) {
00084 case 'O':
00085 type='o';
00086 break;
00087 case 'X':
00088 type='x';
00089 break;
00090 case 'Z':
00091 case 'I':
00092 case 'S':
00093 case 'U':
00094 type='d';
00095 break;
00096 }
00097 c=in_p[in_dex++];
00098 switch (c) {
00099 case 'B':
00100 mask=0xff;
00101 break;
00102 case 'W':
00103 mask=0xffff;
00104 break;
00105 case 'A':
00106 case 'L':
00107 mask=0xffffffff;
00108 break;
00109 default:
00110 printk("fao !O/X/Z%c stuff not recognized\n",c);
00111 break;
00112 }
00113 num=mask&argv[argv_num++];
00114 char * format="% ";
00115 format[1]=type;
00116 out_dex+=sprintf(&out_p[out_dex],format,num);
00117 }
00118 break;
00119 case '/':
00120 out_p[out_dex++]='\n';
00121 break;
00122 case '_':
00123 out_p[out_dex++]='\t';
00124 break;
00125 case '^':
00126
00127 out_p[out_dex++]='\t';
00128 break;
00129 case '!':
00130 out_p[out_dex++]='!';
00131 break;
00132 case '%':
00133 c=in_p[in_dex++];
00134 switch (c) {
00135 case 'T':
00136 {
00137 long long * l=argv[argv_num++];
00138 if (l==0)
00139 l=&exe_gq_systime;
00140 struct dsc_descriptor d;
00141 char chr[32];
00142 d.dsc_w_length=32;
00143 d.dsc_a_pointer=chr;
00144 short int len;
00145 exe_asctim(&len,&d,l,0);
00146 memcpy(&out_p[out_dex],d.dsc_a_pointer,len);
00147 out_dex+=len;
00148 }
00149 break;
00150 default:
00151 printk("fao !percent %c not recognized\n",c);
00152 }
00153 break;
00154 default:
00155 printk("fao !%c not recognized\n",c);
00156 break;
00157 }
00158 break;
00159 default:
00160 out_p[out_dex++]=c;
00161 }
00162 }
00163 #if 0
00164 sprintf(out->dsc_w_apointer,format,argv[0],argv[1],argv[2],argv[3],argv[4],argv[5],argv[6],argv[7],argv[8],argv[9],argv[10],argv[11],argv[12],argv[13],argv[14],argv[15],argv[16]);
00165 #endif
00166 if (outlen) (*outlen)=out_dex;
00167 return SS__NORMAL;
00168 }
00169
00170 asmlinkage int exe_fao(void * ctrstr , short int * outlen , void * outbuf , ...) {
00171 va_list args;
00172 long argv[18],argc=0;
00173 va_start(args,outbuf);
00174 while(argc<17) {
00175 argv[argc]=va_arg(args,long);
00176 argc++;
00177 }
00178 va_end(args);
00179 return exe_faol(ctrstr,outlen,outbuf,argv);
00180 }
00181
00182