Example #1
0
int main(int argc, char *argv[])
{

int sec,min,hour,date,month,year;
	test();
	while(1){
		sec=Getsec();
		min = Getmin();
		hour = Gethour();
		date= Getdate();
		month = Getmonth();
		year = Getyear();
		if(year>= 10)
			printf("̣\n The date is \t\t %i / %i / 20%i \n\n",date,month,year);
		else
			printf("̣\n The date is \t\t %i / %i / 200%i \n\n",date,month,year);
		printf("̣\n The time is \t\t %i : %i : %i \n",hour,min,sec);
		usleep(1000000);
		system("clear");
	}

}
void	ps_init (const GEN_PAR *pg, const OUT_PAR *po, FILE *fd,
                 PEN_W pensize)
{
    long	left, right, low, high;
    double	hmxpenw;

    hmxpenw = pg->maxpensize / 2.0;	/* Half max. pen width, in mm	*/

    /**
     ** Header comments into PostScript file
     **/

    fprintf(fd,"%%!PS-Adobe-2.0 EPSF-2.0\n");
    fprintf(fd,"%%%%Title: %s\n", po->outfile);
    fprintf(fd,"%%%%Creator: hp2xx (c) 1991 - 1994 by  H. Werntges\n");
    fprintf(fd,"%%%%CreationDate: %s\n", Getdate());
    fprintf(fd,"%%%%Pages: 1\n");

    /**
     ** Bounding Box limits: Conversion factor: 2.834646 * 1/72" = 1 mm
     **
     ** (hmxpenw & floor/ceil corrections suggested by Eric Norum)
     **/
    left  = (long) floor(abs(po->xoff-hmxpenw)                * MM_TO_PS_POINT);
    low   = (long) floor(abs(po->yoff-hmxpenw)                * MM_TO_PS_POINT);
    right = (long) ceil ((po->xoff+po->width+hmxpenw)         * MM_TO_PS_POINT);
    high  = (long) ceil ((po->yoff+po->height+hmxpenw)        * MM_TO_PS_POINT);
    fprintf(fd,"%%%%BoundingBox: %ld %ld %ld %ld\n", left, low, right, high);
    if (!pg->quiet)
        Eprintf ("Bounding Box: [%ld %ld %ld %ld]\n",
                 left, low, right, high);

    fprintf(fd,"%%%%EndComments\n\n");

    /**
     ** Definitions
     **/

    fprintf(fd,"%%%%BeginProcSet:\n");
    fprintf(fd,"/PSSave save def\n");      /* save VM state */
    fprintf(fd,"/PSDict 200 dict def\n");  /* define a dictionary */
    fprintf(fd,"PSDict begin\n");          /* start using it */
    fprintf(fd,"/@restore /restore load def\n");
    fprintf(fd,"/restore\n");
    fprintf(fd,"   {vmstatus pop\n");
    fprintf(fd,"    dup @VMused lt {pop @VMused} if\n");
    fprintf(fd,"    exch pop exch @restore /@VMused exch def\n");
    fprintf(fd,"   } def\n");

    fprintf(fd,"/@pri\n");
    fprintf(fd,"   {\n");
    fprintf(fd,"    ( ) print\n");
    fprintf(fd,"    (                                       ) cvs print\n");
    fprintf(fd,"   } def\n");

    fprintf(fd,"/@start\n");    /* - @start -  -- start everything */
    fprintf(fd,"   {\n");
    fprintf(fd,"    vmstatus pop /@VMused exch def pop\n");
    fprintf(fd,"   } def\n");

    fprintf(fd,"/@end\n");      /* - @end -  -- finished */
    fprintf(fd,"   {");
    if (!pg->quiet)
    {
        fprintf(fd,    "(VM Used: ) print @VMused @pri\n");
        fprintf(fd,"    (. Unused: ) print vmstatus @VMused sub @pri pop pop\n");
        fprintf(fd,"    (\\n) print flush\n");

    }
    fprintf(fd,"    end\n");
    fprintf(fd,"    PSSave restore\n");
    fprintf(fd,"   } def\n");

    fprintf(fd,"/bop\n");       /* bop -  -- begin a new page */
    fprintf(fd,"   {\n");
    fprintf(fd,"    /SaveImage save def\n");
    fprintf(fd,"   } def\n");

    fprintf(fd,"/eop\n");       /* - eop -  -- end a page */
    fprintf(fd,"   {\n");
    fprintf(fd,"    showpage\n");
    fprintf(fd,"    SaveImage restore\n");
    fprintf(fd,"   } def\n");

    fprintf(fd,"/@line\n   {");     /* set line parameters */
    fprintf(fd,"  1 setlinejoin %%%% Replace 1 by 0 for cut-off lines\n");
    fprintf(fd,"%%%%    1 setmiterlimit    %%%%  Uncomment this for cut-off lines\n");
    fprintf(fd,"   } def\n");

    fprintf(fd,"/@SetPlot\n");
    fprintf(fd,"   {\n");
    fprintf(fd,"    %f %f scale\n",MM_TO_PS_POINT,MM_TO_PS_POINT);	/* 1/72"--> mm */
    fprintf(fd,"    %7.3f %7.3f translate\n", po->xoff+hmxpenw, po->yoff+hmxpenw);
    fprintf(fd,"    %6.3f setlinewidth\n", pensize);
    fprintf(fd,"   } def\n");
    fprintf(fd,"/C {setrgbcolor} def\n");
    fprintf(fd,"/D {lineto} def\n");
    fprintf(fd,"/M {moveto} def\n");
    fprintf(fd,"/S {stroke} def\n");
    fprintf(fd,"/W {setlinewidth} def\n");
    fprintf(fd,"/Z {stroke newpath} def\n");
    fprintf(fd,"end\n");      /* end of dictionary definition */
    fprintf(fd,"%%%%EndProcSet\n\n");

    /**
     ** Set up the plots
     **/

    fprintf(fd,"%%%%BeginSetup\n");
    fprintf(fd,"/#copies 1 def\n");
    fprintf(fd,"%%%%EndSetup\n");
    fprintf(fd,"%%%%Page: 1 1\n");
    fprintf(fd,"%%%%BeginPageSetup\n");
    fprintf(fd,"PSDict begin\n");
    fprintf(fd,"@start\n");
    fprintf(fd,"@line\n");
    fprintf(fd,"@SetPlot\n\n");
    fprintf(fd,"bop\n");
    fprintf(fd,"%%%%EndPageSetup\n");
}