FACT++  1.0
static int get_format_data ( FORMAT_STR format_data,
char *  def 
)
static

Definition at line 548 of file dis.c.

References FORMAT_STR::flags, IT_IS_FLOAT, NOSWAP, FORMAT_STR::par_bytes, FORMAT_STR::par_num, SIZEOF_CHAR, SIZEOF_DOUBLE, SIZEOF_FLOAT, SIZEOF_LONG, SIZEOF_SHORT, SWAPD, SWAPL, and SWAPS.

Referenced by do_dis_add_cmnd_dns(), and do_dis_add_service_dns().

549 {
550  register char code, last_code = 0;
551  int num;
552 
553  code = *def;
554  while(*def)
555  {
556  if(code != last_code)
557  {
558  format_data->par_num = 0;
559  format_data->flags = 0;
560  switch(code)
561  {
562  case 'i':
563  case 'I':
564  case 'l':
565  case 'L':
566  format_data->par_bytes = SIZEOF_LONG;
567  format_data->flags |= SWAPL;
568  break;
569  case 'x':
570  case 'X':
571  format_data->par_bytes = SIZEOF_DOUBLE;
572  format_data->flags |= SWAPD;
573  break;
574  case 's':
575  case 'S':
576  format_data->par_bytes = SIZEOF_SHORT;
577  format_data->flags |= SWAPS;
578  break;
579  case 'f':
580  case 'F':
581  format_data->par_bytes = SIZEOF_FLOAT;
582  format_data->flags |= SWAPL;
583 #ifdef vms
584  format_data->flags |= IT_IS_FLOAT;
585 #endif
586  break;
587  case 'd':
588  case 'D':
589  format_data->par_bytes = SIZEOF_DOUBLE;
590  format_data->flags |= SWAPD;
591 #ifdef vms
592  format_data->flags |= IT_IS_FLOAT;
593 #endif
594  break;
595  case 'c':
596  case 'C':
597  case 'b':
598  case 'B':
599  case 'v':
600  case 'V':
601  format_data->par_bytes = SIZEOF_CHAR;
602  format_data->flags |= NOSWAP;
603  break;
604  }
605  }
606  def++;
607  if(*def != ':')
608  {
609  if(*def)
610  {
611 /*
612  printf("Bad service definition parsing\n");
613  fflush(stdout);
614 
615  error_handler("Bad service definition parsing",2);
616 */
617  return(0);
618  }
619  else
620  format_data->par_num = 0;
621  }
622  else
623  {
624  def++;
625  sscanf(def,"%d",&num);
626  format_data->par_num += num;
627  while((*def != ';') && (*def != '\0'))
628  def++;
629  if(*def)
630  def++;
631  }
632  last_code = code;
633  code = *def;
634  if(code != last_code)
635  format_data++;
636  }
637  format_data->par_bytes = 0;
638  return(1);
639 }
Definition: dim.h:191
short flags
Definition: dim.h:219
Definition: dim.h:191
Definition: dim.h:191
#define SIZEOF_CHAR
Definition: dim.h:596
short par_bytes
Definition: dim.h:218
#define SIZEOF_FLOAT
Definition: dim.h:599
#define SIZEOF_DOUBLE
Definition: dim.h:600
int par_num
Definition: dim.h:217
#define SIZEOF_LONG
Definition: dim.h:598
#define IT_IS_FLOAT
Definition: dim.h:27
#define SIZEOF_SHORT
Definition: dim.h:597
Definition: dim.h:191

+ Here is the caller graph for this function: