#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <dlg/user.h>
#include <dlg/menu.h>
#include <proto/dos.h>
#include <proto/dlg.h>

#include <link/io.h>

#include <pragmas/dlg.h>

extern struct Library   *DLGBase;
extern struct USER_DATA  UserDat;


LONG Show_User(char *name,struct twocoldata *data2,char len2,struct threecoldata *data3,char len3)
{
char buffer[3000],flippybindle=1;
int counter,buffcount=0;
USHORT pos=0;

ASPrintf(&UserDat,buffer,"%a2[%a7--%a2] Name      - %a6%-22.22s ",name);
if(UserDat.Ansi_Flag & ANSI_COLOR)buffcount+=60;
else    buffcount+=40;

for(counter=0;counter<len2;counter++)
        {
        ASPrintf(&UserDat,buffer+buffcount,"%a2[%a7%2.2s%a2] %-10.10s- %a6%-21.21s",
                (data2+counter)->number,(data2+counter)->title,(data2+counter)->data);
                if(UserDat.Ansi_Flag & ANSI_COLOR)buffcount+=58;
                else    buffcount+=38;
        if(flippybindle)
                ASPrintf(&UserDat,buffer+buffcount,"\n");
        else    {ASPrintf(&UserDat,buffer+buffcount,"  ");buffcount++;}
        buffcount++;
        flippybindle = (flippybindle+1)&1;
        }
if(flippybindle)
        {
        ASPrintf(&UserDat,buffer+buffcount,"\n\n");
        buffcount++;
        }
else    ASPrintf(&UserDat,buffer+buffcount,"\n");
buffcount++;
flippybindle=0;
for(counter=0;counter<len3;counter++)
        {
        if(flippybindle==2)
                {
                ASPrintf(&UserDat,buffer+buffcount,"%a2[%a7%2.2s%a2] %-11.11s- %a6%-7.7s",
                        (data3+counter)->number,(data3+counter)->title,(data3+counter)->data);
                        if(UserDat.Ansi_Flag & ANSI_COLOR)buffcount+=45;
                        else    buffcount+=25;
                }
        else    {
                ASPrintf(&UserDat,buffer+buffcount,"%a2[%a7%2.2s%a2] %-11.11s- %a6%-8.8s",
                        (data3+counter)->number,(data3+counter)->title,(data3+counter)->data);
                        if(UserDat.Ansi_Flag & ANSI_COLOR)buffcount+=46;
                        else    buffcount+=26;
                }
        if(flippybindle==2)
                ASPrintf(&UserDat,buffer+buffcount,"\n");
        else    ASPrintf(&UserDat,buffer+buffcount," ");
        buffcount++;
        flippybindle++;
        if(flippybindle==3) flippybindle=0;
        }

if(flippybindle==2)
        {
        ASPrintf(&UserDat,buffer+buffcount,"\n");
        buffcount++;
        }
buffer[buffcount]='\0';
return(DisplayBuffer(Output(),buffer,UserDat.Screen_Width,UserDat.Screen_Len,
                UserDat.More_Flag,UserDat.Ansi_Flag,&pos,0,NULL,0,"\003"));
}       
