/*
//////////////////////////////////////////////////////
//////                misc1.c                     //////
//////////////////////////////////////////////////////
*/


/*
/////////////////////////////
//
// Author: Gayatri Krishnan
// Assignment # 8
// Internet Applications
// 
/////////////////////////////
*/


/*
////
// include files
////
*/

#include "common.h"

/* 
 ** Function    : read_fields()
 ** Description : Outputs Field entries
 */ 
void read_fields(int totalf)
{
  int status;
  int  field_counter, attr_counter, attribute_count;

  /*&&&&&&&&&&Reading Fields&&&&&&&&&&*/

  for(field_counter=0; field_counter< totalf ;field_counter++) {
      /*Access Flags**Name Index**Signature Index*/
      status = read_bytes(6);
      if (status==-1) exit(0);
      /* Field Name */
      printf ( "%s \n", cPool[((byte[2] <<8) | byte[3])].str);
      /*AttributeCount*/
      status = read_bytes(2);
      if (status==-1) exit(0);
      attribute_count=(byte[0]<<8)| byte[1];

      if (attribute_count > 0) {
	for(attr_counter=0; attr_counter< attribute_count ;attr_counter++) {
	  status = read_bytes(8);
	  if (status==-1) exit(0);
	}
      }/* if */     
  }/* for */
}





