#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

/* globale Arbeitsvariablen */

#include "cube.h"


void main(argc,argv)
int argc;
char **argv;
{
  long			nsamp1,nsamp2,j,ch,jj;
  long			tqx;
  double		tx,tx2,t1,t2,t,T; 
  long			ts1,tmks1,ts2,tmks2,hx,gps_t,trs,trmks;
  long			delta_t,tt;
  long			ampx[3],k;
  char  		buf[1000];
  int			code;
  double		yx1[10];
  int		azi;


extern int optind, opterr, optopt;
extern char *optarg;

   int c,errflg; 
   time_t start_time;
   struct tm *tss;

   errflg=0;
   putenv ("TZ=GMT");
   tzset; 

  gps_t=0;
  opterr=0; while ((c = getopt (argc, argv, "r")) != -1)
  switch (c)
      {
         case 'r':        /* get azi */
	   azi = atoi(optarg);
           fprintf(stderr,"XXXX %d \n", azi);
           break;
         case '?':
           fprintf(stderr,"ERROR: Unrecognized option: -%c\n", argv[0], optopt);
           errflg++;
      }

/* read config */   
   if (fgets(buf,1000,stdin)) 
   {
	code=sscanf(buf,STR_FORMAT,(char *) SC_STR);
   }

   fprintf(stdout,STR_FORMAT"\n",PR_STR);

fprintf(stderr,"XXX %d\n",CH_NUM);
/* main loop */
  while (!feof(stdin))
  {
  	if (fgets(buf,1000,stdin))
  	{
		switch (CH_NUM)
		{
			case 1: code=sscanf(buf,"%ld%d%ld%ld",&ts2,&tmks2,&ampx[0]); break;		
			case 2: code=sscanf(buf,"%ld%d%d%ld%ld",&ts2,&tmks2,&ampx[0],&ampx[1]); break;
			case 3: code=sscanf(buf,"%ld%d%d%d%ld%ld",&ts2,&tmks2,&ampx[0],&ampx[1],&ampx[2]); break;
		}
  	}
	fprintf(stdout,"%ld %ld ",ts2,tmks2); 
	for (ch=0; ch<CH_NUM; ch++) fprintf(stdout,"%d ",ampx[ch]); 
	fprintf(stdout,"\n"); 
  }
 }


