예제 #1
0
main()
{
  register total;

  putenv("_filesize_caps");
  chdir(getenv("HOME"));
  
  ss_open();
  co_open();
  oc_open();
  pr_open();

  total = ss_size + co_size + oc_size + pr_size;
  
  printf("\n\n");
  printf("    CAPS Shared Segment File Sizes\n");
  printf("    ------------------------------\n");
  printf("    ss segment is %7d bytes\n", ss_size);
  printf("    co segment is %7d bytes\n", co_size);
  printf("    oc segment is %7d bytes\n", oc_size);
  printf("    pr segment is %7d bytes\n", pr_size);
  printf("                  -------\n");
  printf("    total size is %7d bytes\n\n", total); 
   

  pr_close();
  co_close();
  oc_close();
  ss_close();


  return;
}
예제 #2
0
open_all()
{
  sd_open(leave);
  ss_open();
  co_open();
  oc_open();
  getparms(0);
}
예제 #3
0
open_all()
{
  sd_open(leave);
  ss_open();
  database_open();
  pmfile_open(AUTOLOCK);
  pmfile_setkey(1);
  log_open(AUTOLOCK);
}
예제 #4
0
/*-------------------------------------------------------------------------*
 *  Open All Files
 *-------------------------------------------------------------------------*/
open_all()
{
  database_open();
  sd_open(leave);
  ss_open();
  co_open();
  getparms(0);
  pmfile_open(READONLY);
  prodfile_open(READONLY);
}
예제 #5
0
/*
 *open all files
 */
open_all()
{
  database_open();
  sd_open(leave);
  ss_open();
  co_open();
  oc_open();
  od_open();
  getparms(0);
}
예제 #6
0
main()
{
  putenv("_=diskette_diags");
  chdir(getenv("HOME"));
    
  ss_open();
  sd_open(leave);

  fix(diskette_diags);
  sd_screen_off();
  sd_clear_screen();
  sd_text(diskette_diags);
  sd_screen_on();

  while (1)
  {  
    memset(buf, 0, 2);
      
    t = sd_input(&fld1,sd_prompt(&fld1,0),&rm,buf,0);

    if(t == EXIT) leave();
    if (t == UP_CURSOR) continue;
    
    *buf = tolower(*buf);
    if (*buf == 'n') continue;
    if (*buf != 'y')
    {
      eh_post(ERR_CODE, buf[0]);
      continue;
    }
/*
 *  Format Diskette
 */
    system("dosformat -fq a:");
    
    eh_post(ERR_CONFIRM, "Format diskette");
  
    memset(buf, 0, 2);
    
    t = sd_input(&fld2,sd_prompt(&fld2,0),&rm,buf,0);

    if(t == EXIT) leave();
    if (t == UP_CURSOR) continue;
    
    *buf = tolower(*buf);
    if (*buf == 'n') leave();
    if (*buf == 'y') continue;
    
    eh_post(ERR_CODE, buf);
  }  
}                                         /* end main                        */
예제 #7
0
/*
 *open all files
 */
open_all()
{
  database_open();

  sd_open(leave);
  ss_open();
  co_open();

  picker_open(AUTOLOCK); 
  picker_setkey(0);

  picker_order_open(AUTOLOCK); 
  picker_order_setkey(0);


  return 0;
}
예제 #8
0
/**
 * \fn ss_send_to_address()
 *
 * \brief Sends data to the some URL-address.
 *
 * \param[in] const char *addrrss. Address (without protocol and path) to get IP address and send (ya.ru, google.ru).
 * \param[in] int port. Port to send.
 * \param[in] char *request. Request to send.
 * \param[in] char **result_buf. Buffer for response.
 *
 * \return int. 0 if successful, otherwise -1.
 */
int ss_send_to_address(const char *addrrss, const char *port, const char *request, char **result_buf)
{
	struct addrinfo hints;
	struct addrinfo *ai = NULL;//  ss_get_ip_address((char*)addrrss, (char*)port);  
	
	memset(&hints, 0, sizeof(hints));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;
	hints.ai_protocol = IPPROTO_TCP;

	int result = getaddrinfo(addrrss, port, &hints, &ai);

	if (result != 0) {
		fprintf(stderr, "getaddrinfo() error: %s\n", gai_strerror(result));
		return -1;
	}

	struct sockaddr_in *sin = (struct sockaddr_in *) (ai->ai_addr);

	const char *addr = inet_ntoa(sin->sin_addr);
	if (addr == NULL) { 
		return -1;
	}

	sib_address_t sa;
	strncpy(sa.ip, addr, MAX_IP_LEN);
	sa.port = atoi(port);

	freeaddrinfo(ai);

	int sockfd = ss_open(&sa);

	if (ss_send(sockfd, (char *)request) < 0) 
	{
		fprintf(stderr, "Sending error.");
		return -1;
	}

	if (ss_recv_sparql(sockfd, *result_buf, SS_RECV_TIMEOUT_MSECS) <= 0) {
		fprintf(stderr, "Receiving error.");		
		return -1;
	}

	return 0;
}
예제 #9
0
파일: test-store.c 프로젝트: mvollmer/dpm
void
init (const char *file, int mode)
{
  ss_val r;
  int len;

  store = ss_open (file, mode);
  r = ss_get_root (store);
  len = r? ss_len (r) : 0;

  table = ss_tab_init (store, (len > 0)? ss_ref (r, 0) : NULL);
  package_files_dict = ss_dict_init (store, (len > 1)? ss_ref (r, 1) : NULL,
				     SS_DICT_STRONG);
  file_packages_dict = ss_dict_init (store, (len > 2)? ss_ref (r, 2) : NULL,
				     SS_DICT_STRONG);
  package_info_dict = ss_dict_init (store, (len > 2)? ss_ref (r, 3) : NULL,
				    SS_DICT_STRONG);
}
void DS3_ScanPads()
{
    if (!ss_is_connected(&first))
    {
        psPressed = false;
        ss_initialize(&first);
        if (ss_open(&first) > 0)
        {
            ss_start_reading(&first);
            ss_set_led(&first, 0);
        }
    }
    else if (first.pad.buttons.PS && !psPressed)
    {
        psPressed = true;
        ss_set_led(&first, 1);
    }
}
예제 #11
0
파일: hw_dump.c 프로젝트: priyancka/caps
main()
{
  FILE *td;
  short j    = 0,
        hwix = 0;
  char kernel_check[12],
       command[80],
       h_type[4],
       tmpname[16];

  memset(kernel_check, 0x0, 12);
  memset(command, 0x0, 80);
  memset(tmpname, 0x0, 16);

  putenv("_=hw_dump");                  /* name to environ   */
  chdir(getenv("HOME"));                /* to home directory  */

  tmp_name(tmpname);
  sprintf(command, "%s > %s",
          "ps -ef|grep -v grep|grep ' bin/kernel'|cut -c54-63",
          tmpname);
  system(command);

  td = fopen(tmpname, "r");
  if (td == 0)
     {
       exit(-1);
     }

  fgets(kernel_check, 11, td);

  if (td)
     {
       fclose(td);
       unlink(tmpname);
     }

  if (strcmp(kernel_check, KERNELNAME) != 0)
     {
       printf("System not started.\n");
       exit(4);
     }

  ss_open();
  co_open();

  if (sp->sp_config_status != 'y')
     {
       printf("System is running.\n");
       close_all();
       exit(2);
     }

  hwf = fopen(DUMPFILE, "w");

  if (hwf == 0)
     {
       printf("Cannot open sql/hw_dump.dat for writing.\n");
       close_all();
       exit(3);
     }

  for (j = 0; j < coh->co_light_cnt; j++)
      {
         memset(h_type, 0x0, 4);

         switch (hw[j].hw_type)
                {
                   case BL:   strcpy(h_type, "BL");
                              break;

                   case ZC:   strcpy(h_type, "ZC");
                              break;

                   case PM:   strcpy(h_type, "PM");
                              break;

                   case PI:   strcpy(h_type, "PI");
                              break;

                   case ZC2:  strcpy(h_type, "ZC2");
                              break;

                   case PM2:  strcpy(h_type, "PM2");
                              break;

                   case PM4:  strcpy(h_type, "PM4");
                              break;

                   case PM6:  strcpy(h_type, "PM6");
                              break;

                   case BF:   strcpy(h_type, "BF");
                              break;

                   case IO:   strcpy(h_type, "IO");
                              break;

                   default:   break;
                }  /* end of switch statement for hardware type */

         hwix = j + 1;

         fprintf(hwf, "%d|%d|%d|%d|%d|%d|%s|\n",
                 j,
                 hwix,
                 hw[j].hw_mod,
                 hw[j].hw_mod_address,
                 hw[j].hw_bay,
                 hw[j].hw_controller,
                 h_type);
         fflush(hwf);

      }  /* end of for loop to read hw table */

  fclose(hwf);

  memset(command, 0x0, 80);

  sprintf(command, "%s%s",
          "/u/mfc/script/ld_hw_dump_file ",
          "1>/u/mfc/dat/log/ld_hdf.log 2>&1");

  system(command);

  sleep(5);

  unlink(DUMPFILE);

  close_all();

  exit(0);
} /* end of main() */
예제 #12
0
static void gx_joypad_poll(void)
{
   unsigned i, j, port;
   uint8_t gcpad    = 0;
   global_t *global = global_get_ptr();

   pad_state[0] = 0;
   pad_state[1] = 0;
   pad_state[2] = 0;
   pad_state[3] = 0;

   gcpad = PAD_ScanPads();

#ifdef HW_RVL
   WPAD_ReadPending(WPAD_CHAN_ALL, NULL);
#endif

   for (port = 0; port < MAX_PADS; port++)
   {
      uint32_t down = 0, ptype = WPAD_EXP_NOCONTROLLER;
      uint64_t *state_cur = &pad_state[port];

#ifdef HW_RVL
      if (WPADProbe(port, &ptype) == WPAD_ERR_NONE)
      {
         WPADData *wpaddata = (WPADData*)WPAD_Data(port);
         expansion_t *exp = NULL;

         down = wpaddata->btns_h;

         exp = (expansion_t*)&wpaddata->exp;

         *state_cur |= (down & WPAD_BUTTON_A) ? (1ULL << GX_WIIMOTE_A) : 0;
         *state_cur |= (down & WPAD_BUTTON_B) ? (1ULL << GX_WIIMOTE_B) : 0;
         *state_cur |= (down & WPAD_BUTTON_1) ? (1ULL << GX_WIIMOTE_1) : 0;
         *state_cur |= (down & WPAD_BUTTON_2) ? (1ULL << GX_WIIMOTE_2) : 0;
         *state_cur |= (down & WPAD_BUTTON_PLUS) ? (1ULL << GX_WIIMOTE_PLUS) : 0;
         *state_cur |= (down & WPAD_BUTTON_MINUS) ? (1ULL << GX_WIIMOTE_MINUS) : 0;
         *state_cur |= (down & WPAD_BUTTON_HOME) ? (1ULL << GX_WIIMOTE_HOME) : 0;

         if (ptype != WPAD_EXP_NUNCHUK)
         {
            /* Rotated d-pad on Wiimote. */
            *state_cur |= (down & WPAD_BUTTON_UP) ? (1ULL << GX_WIIMOTE_LEFT) : 0;
            *state_cur |= (down & WPAD_BUTTON_DOWN) ? (1ULL << GX_WIIMOTE_RIGHT) : 0;
            *state_cur |= (down & WPAD_BUTTON_LEFT) ? (1ULL << GX_WIIMOTE_DOWN) : 0;
            *state_cur |= (down & WPAD_BUTTON_RIGHT) ? (1ULL << GX_WIIMOTE_UP) : 0;
         }


         if (ptype == WPAD_EXP_CLASSIC)
         {
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_A) ? (1ULL << GX_CLASSIC_A) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_B) ? (1ULL << GX_CLASSIC_B) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_X) ? (1ULL << GX_CLASSIC_X) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_Y) ? (1ULL << GX_CLASSIC_Y) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_UP) ? (1ULL << GX_CLASSIC_UP) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_DOWN) ? (1ULL << GX_CLASSIC_DOWN) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_LEFT) ? (1ULL << GX_CLASSIC_LEFT) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_RIGHT) ? (1ULL << GX_CLASSIC_RIGHT) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_PLUS) ? (1ULL << GX_CLASSIC_PLUS) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_MINUS) ? (1ULL << GX_CLASSIC_MINUS) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_HOME) ? (1ULL << GX_CLASSIC_HOME) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_FULL_L) ? (1ULL << GX_CLASSIC_L_TRIGGER) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_FULL_R) ? (1ULL << GX_CLASSIC_R_TRIGGER) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_ZL) ? (1ULL << GX_CLASSIC_ZL_TRIGGER) : 0;
            *state_cur |= (down & WPAD_CLASSIC_BUTTON_ZR) ? (1ULL << GX_CLASSIC_ZR_TRIGGER) : 0;

            analog_state[port][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X]  = WPAD_StickX(wpaddata, port, 0);
            analog_state[port][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y]  = WPAD_StickY(wpaddata, port, 0);
            analog_state[port][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_X] = WPAD_StickX(wpaddata, port, 1);
            analog_state[port][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_Y] = WPAD_StickY(wpaddata, port, 1);
         }
         else if (ptype == WPAD_EXP_NUNCHUK)
         {
            /* Wiimote is held upright with nunchuk,
             * do not change d-pad orientation. */
            *state_cur |= (down & WPAD_BUTTON_UP) ? (1ULL << GX_WIIMOTE_UP) : 0;
            *state_cur |= (down & WPAD_BUTTON_DOWN) ? (1ULL << GX_WIIMOTE_DOWN) : 0;
            *state_cur |= (down & WPAD_BUTTON_LEFT) ? (1ULL << GX_WIIMOTE_LEFT) : 0;
            *state_cur |= (down & WPAD_BUTTON_RIGHT) ? (1ULL << GX_WIIMOTE_RIGHT) : 0;

            *state_cur |= (down & WPAD_NUNCHUK_BUTTON_Z) ? (1ULL << GX_NUNCHUK_Z) : 0;
            *state_cur |= (down & WPAD_NUNCHUK_BUTTON_C) ? (1ULL << GX_NUNCHUK_C) : 0;

            float js_mag = exp->nunchuk.js.mag;
            float js_ang = exp->nunchuk.js.ang;

            if (js_mag > 1.0f)
               js_mag = 1.0f;
            else if (js_mag < -1.0f)
               js_mag = -1.0f;

            double js_val_x = js_mag * sin(M_PI * js_ang / 180.0);
            double js_val_y = -js_mag * cos(M_PI * js_ang / 180.0);

            int16_t x = (int16_t)(js_val_x * 32767.0f);
            int16_t y = (int16_t)(js_val_y * 32767.0f);

            analog_state[port][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] = x;
            analog_state[port][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] = y;

         }
      }
      else
#endif
      {
         if (gcpad & (1 << port))
         {
            int16_t ls_x, ls_y, rs_x, rs_y;
            uint64_t menu_combo = 0;

            down = PAD_ButtonsHeld(port);

            *state_cur |= (down & PAD_BUTTON_A) ? (1ULL << GX_GC_A) : 0;
            *state_cur |= (down & PAD_BUTTON_B) ? (1ULL << GX_GC_B) : 0;
            *state_cur |= (down & PAD_BUTTON_X) ? (1ULL << GX_GC_X) : 0;
            *state_cur |= (down & PAD_BUTTON_Y) ? (1ULL << GX_GC_Y) : 0;
            *state_cur |= (down & PAD_BUTTON_UP) ? (1ULL << GX_GC_UP) : 0;
            *state_cur |= (down & PAD_BUTTON_DOWN) ? (1ULL << GX_GC_DOWN) : 0;
            *state_cur |= (down & PAD_BUTTON_LEFT) ? (1ULL << GX_GC_LEFT) : 0;
            *state_cur |= (down & PAD_BUTTON_RIGHT) ? (1ULL << GX_GC_RIGHT) : 0;
            *state_cur |= (down & PAD_BUTTON_START) ? (1ULL << GX_GC_START) : 0;
            *state_cur |= (down & PAD_TRIGGER_Z) ? (1ULL << GX_GC_Z_TRIGGER) : 0;
            *state_cur |= ((down & PAD_TRIGGER_L) || PAD_TriggerL(port) > 127) ? (1ULL << GX_GC_L_TRIGGER) : 0;
            *state_cur |= ((down & PAD_TRIGGER_R) || PAD_TriggerR(port) > 127) ? (1ULL << GX_GC_R_TRIGGER) : 0;

            ls_x = (int16_t)PAD_StickX(port) * 256;
            ls_y = (int16_t)PAD_StickY(port) * -256;
            rs_x = (int16_t)PAD_SubStickX(port) * 256;
            rs_y = (int16_t)PAD_SubStickY(port) * -256;

            analog_state[port][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_X] = ls_x;
            analog_state[port][RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y] = ls_y;
            analog_state[port][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_X] = rs_x;
            analog_state[port][RETRO_DEVICE_INDEX_ANALOG_RIGHT][RETRO_DEVICE_ID_ANALOG_Y] = rs_y;

            menu_combo = (1ULL << GX_GC_START) | (1ULL << GX_GC_Z_TRIGGER) |
               (1ULL << GX_GC_L_TRIGGER) | (1ULL << GX_GC_R_TRIGGER);

            if ((*state_cur & menu_combo) == menu_combo)
               *state_cur |= (1ULL << GX_WIIMOTE_HOME);

            ptype = WPAD_EXP_GAMECUBE;
         }
#ifdef HAVE_LIBSICKSAXIS
         else
         {
            USB_DeviceChangeNotifyAsync(USB_CLASS_HID, change_cb, (void*)&lol);

            if (ss_is_connected(&dev[port]))
            {
               ptype = WPAD_EXP_SICKSAXIS;
               *state_cur |= (dev[port].pad.buttons.PS)       ? (1ULL << RARCH_MENU_TOGGLE) : 0;
               *state_cur |= (dev[port].pad.buttons.cross)    ? (1ULL << RETRO_DEVICE_ID_JOYPAD_B) : 0;
               *state_cur |= (dev[port].pad.buttons.square)   ? (1ULL << RETRO_DEVICE_ID_JOYPAD_Y) : 0;
               *state_cur |= (dev[port].pad.buttons.select)   ? (1ULL << RETRO_DEVICE_ID_JOYPAD_SELECT) : 0;
               *state_cur |= (dev[port].pad.buttons.start)    ? (1ULL << RETRO_DEVICE_ID_JOYPAD_START) : 0;
               *state_cur |= (dev[port].pad.buttons.up)       ? (1ULL << RETRO_DEVICE_ID_JOYPAD_UP) : 0;
               *state_cur |= (dev[port].pad.buttons.down)     ? (1ULL << RETRO_DEVICE_ID_JOYPAD_DOWN) : 0;
               *state_cur |= (dev[port].pad.buttons.left)     ? (1ULL << RETRO_DEVICE_ID_JOYPAD_LEFT) : 0;
               *state_cur |= (dev[port].pad.buttons.right)    ? (1ULL << RETRO_DEVICE_ID_JOYPAD_RIGHT) : 0;
               *state_cur |= (dev[port].pad.buttons.circle)   ? (1ULL << RETRO_DEVICE_ID_JOYPAD_A) : 0;
               *state_cur |= (dev[port].pad.buttons.triangle) ? (1ULL << RETRO_DEVICE_ID_JOYPAD_X) : 0;
               *state_cur |= (dev[port].pad.buttons.L1)       ? (1ULL << RETRO_DEVICE_ID_JOYPAD_L) : 0;
               *state_cur |= (dev[port].pad.buttons.R1)       ? (1ULL << RETRO_DEVICE_ID_JOYPAD_R) : 0;
               *state_cur |= (dev[port].pad.buttons.L2)       ? (1ULL << RETRO_DEVICE_ID_JOYPAD_L2) : 0;
               *state_cur |= (dev[port].pad.buttons.R2)       ? (1ULL << RETRO_DEVICE_ID_JOYPAD_R2) : 0;
               *state_cur |= (dev[port].pad.buttons.L3)       ? (1ULL << RETRO_DEVICE_ID_JOYPAD_L3) : 0;
               *state_cur |= (dev[port].pad.buttons.R3)       ? (1ULL << RETRO_DEVICE_ID_JOYPAD_R3) : 0;
            }
            else
            {
               if (ss_open(&dev[port]) > 0)
               {
                  ptype = WPAD_EXP_SICKSAXIS;
                  ss_start_reading(&dev[port]);
                  ss_set_removal_cb(&dev[port], removal_cb, (void*)1);
               }
            }
         }
#endif
      }

      if (ptype != pad_type[port])
         handle_hotplug(port, ptype);

      for (i = 0; i < 2; i++)
         for (j = 0; j < 2; j++)
            if (analog_state[port][i][j] == -0x8000)
               analog_state[port][i][j] = -0x7fff;
   }

   uint64_t *state_p1        = &pad_state[0];
   uint64_t *lifecycle_state = &global->lifecycle_state;

   *lifecycle_state &= ~((1ULL << RARCH_MENU_TOGGLE));

   if (g_menu)
   {
      *state_p1 |= (1ULL << GX_WIIMOTE_HOME);
      g_menu = false;
   }

   if (*state_p1 & ((1ULL << GX_WIIMOTE_HOME)
#ifdef HW_RVL
            | (1ULL << GX_CLASSIC_HOME)
#endif
            ))
      *lifecycle_state |= (1ULL << RARCH_MENU_TOGGLE);
}
예제 #13
0
main()
{
  register long k;
  unsigned char t, incode[2], ans[2], yn[2], again[2];
  unsigned char timestr[30], datetime[15], intime[20];
  long systime;
  long pid, status;

  putenv("_=transac_output");
  chdir(getenv("HOME"));

  open_all();

  fix(transac_output);
  sd_screen_off();
  sd_clear_screen();
  sd_text(transac_output);
  sd_screen_on();
  
  sd_prompt(&fld[0], 0);

  while(1)
  {
    for (k = 15; k <= 20; k++)
    {
      sd_cursor(0, k, 1);
      sd_clear_line();
    }
    while(1)
    {
      memset(incode, 0, 2);

      t = sd_input(&fld[0], 0, 0, incode, 0);
      if(t == EXIT)      leave();
      if(t == UP_CURSOR) continue;

      if (!*incode) break;

      *incode = tolower(*incode);
        
      if (*incode != 'c' && *incode != 'd' &&
          *incode != 'p' && *incode != 'e')
      {
        eh_post(ERR_CODE, incode);
        continue;
      }
      break;
    }
    if (*incode == 'p')
    {
      if (sp->sp_to_flag != 'y' && sp->sp_to_flag != 'b')
      {
        eh_post(LOCAL_MSG, "No Transaction File Feature");
        continue;
      }
      sd_wait();
      
      if((pid = fork()) == 0)
      {
        ss_close();
        execlp("transac_short_rpt", "transac_short_rpt", 0);
        exit(1);
      }
      else pid = wait(&status);

      if (pid > 0 && !status) eh_post(ERR_CONFIRM, "Short Printing");
      else eh_post(CRASH_MSG, "tranac_short_rpt failed");
      continue;
    }
    if (*incode == 'e')
    {
      if (sp->sp_to_flag != 'y' && sp->sp_to_flag != 'b')
      {
        eh_post(LOCAL_MSG, "No Transaction File Feature");
        continue;
      }
      while(1)
      {
        memset(ans, 0, 2);                /* are you sure response           */
        memset(yn, 0, 2);
        
        t = sd_input(&fld[5],sd_prompt(&fld[5],0), 0, yn, 0);
        if (t == EXIT)      leave();
        if (t == UP_CURSOR) break;

        *ans = code_to_caps(*yn);

        if(*ans != 'y' && *ans != 'n')
        {
          eh_post(ERR_YN,0);
          continue;
        }
        if(*ans == 'y')
        {
          eh_post(LOCAL_MSG, "Purging Transaction File");

          database_open();
          xt_open();
          transaction_setkey(0);
          
          begin_work();
          while (!transaction_next(&xt, LOCK)) 
          {
            transaction_delete();
            commit_work();
            begin_work();
          }
          commit_work();
          xt_close();
          database_close();
          
          sp->sp_to_count = 0;
          
          eh_post(PURGE_TRANS, 0);
        }
        break;
      }                                   /* end while(1)                    */
      continue;
    }                                     /* end if                          */
    if (*incode == 'c' || *incode == 'd')
    {
      if (sp->sp_to_mode != 0x20 || sp->sp_oi_mode == *incode) /* F071395    */
      {
        eh_post(LOCAL_MSG, "Device/Port In Use");          
        continue;
      }
    }
    if (*incode == 'd')
    {
      while(1)
      {
        memset(ans, 0, 2);
        memset(yn, 0, 2);
        
        t = sd_input(&fld[1],sd_prompt(&fld[1],0), 0, yn, 0);
        if (t == EXIT)     leave();
        if (t == UP_CURSOR) break;

        *ans = code_to_caps(*yn);
        
        if(*ans != 'y' && *ans != 'n')
        {
          eh_post(ERR_YN,0);
          continue;
        }
        break;
      }
      if (t == UP_CURSOR) continue;
      if (*ans == 'n') continue;          /* abort diskette in               */
    }
    while(1)
    {
      memset(again, 0, 2);                /* retransmit response             */
      memset(yn, 0, 2);
      
      t = sd_input(&fld[2],sd_prompt(&fld[2],0), 0, yn, 0);
      if (t == EXIT)     leave();
      if (t == UP_CURSOR) break;

      *again = code_to_caps(*yn);
      if (*again != 'y' && *again != 'n')
      {
        eh_post(ERR_YN, 0);
        continue;
      }
      break;
    }
    if (t == UP_CURSOR) continue;

    while(1)
    {
      memset(ans, 0, 2);                  /* purge response                  */
      memset(yn, 0, 2);
      
      t = sd_input(&fld[3],sd_prompt(&fld[3],0), 0, yn, 0);
      if(t == EXIT)      leave();
      if(t == UP_CURSOR) break;

      *ans = code_to_caps(*yn);
      if(*ans != 'y' && *ans != 'n')
      {
        eh_post(ERR_YN,0);
        continue;
      }
      break;
    }
    if(*ans == 'y')
    {
      sd_prompt(&fld[4],0);
      systime = time(0) - sp->sp_purge_window;
      strcpy(timestr, ctime(&systime));
      timestr[24] = 0;
      sd_cursor(0,18,25);
      sd_text("Default Date/Time:");
      sd_cursor(0,18,54);
      sd_text(&timestr[4]);
      sd_cursor(0,20,25);
      sd_text("Format is:");
      sd_cursor(0,20,54);
      sd_text("mm/dd/yyyy hh:mm:ss");

      while(1)
      {
        t = sd_input(&fld[4], 0, 0, intime, 0);
        if(t == EXIT)      leave();
        if(t == UP_CURSOR) break;

        if(*intime != 0)
        {
          if(!time_convert(intime, &systime))
          {
            eh_post(ERR_TIME, intime);
            continue;
          }
        }
        eh_post(LOCAL_MSG, "Purging Orders");

        if ((pid = fork()) == 0)
        {
          sprintf(datetime, "%d", systime);
          ss_close();
          execlp("order_purge", "order_purge", datetime, 0);
          exit(1);
        }
        else pid = wait(&status);

        if (pid > 0 && !status) eh_post(ERR_CONFIRM, "Order purge");
        else eh_post(CRASH_MSG, "order_purge failed");
        break;
      }
      if (t == UP_CURSOR) continue;
    }
    if (*again == 'n')                    /* transmit current file           */
    {
      eh_post(LOCAL_MSG, "Extracting Transactions");

      if ((pid = fork()) == 0)
      {
        ss_close();
        execlp("transac_copy", "transac_copy", 0);
        exit(1);
      }
      else pid = wait(&status);

      if (pid < 0 || status)
      {
        eh_post(LOCAL_MSG, "transac_copy failed");
        continue;
      }
      eh_post(ERR_CONFIRM, "Transaction File");
    }
/*
 *  Start Transaction Output Operations
 */
    if (*incode == 'c')                   /* comm output                     */
    {
      if (sp->sp_commo_trans_out == 'n')
      {
        eh_post(LOCAL_MSG, "No Communication Feature");
        continue;
      }
      eh_post(LOCAL_MSG, "Sending Transactions");
      sd_close();

      sp->sp_to_mode = 'c';
      
      if (fork() == 0)
      {
        if (sp->sp_commo_trans_out == 'k') 
        {
          ss_close();
          execlp("com_kermit_out", "com_kermit_out", 0);
        }
        else 
        {
          ss_close();
          execlp("comsend",  "comsend",  0);
        }
        ss_open();
        sd_open();
        sp->sp_to_mode = 0x20;
        eh_post(LOCAL_MSG, "Program Not Found");
        continue;
      }
      pid = wait(&status);
      sp->sp_to_mode = 0x20;
      sd_open();
      
      if (pid < 0 || status) 
      {
        eh_post(LOCAL_MSG, "Communications Failed");
      }
      else eh_post(ERR_CONFIRM, "Transactions Output");
      continue;
    }
    if (*incode == 'd')
    {
      sd_wait();

      sp->sp_to_mode = 'd';

      sprintf(message, command);
      status = system(message);
      sp->sp_to_mode = 0x20;
      
      if (status) eh_post(LOCAL_MSG, "Diskette output failed");
      else eh_post(ERR_CONFIRM, "Tranaction Output");
    }
  }
}
예제 #14
0
/* function to transfer control back to the calling program*/
open_all()
{
  sd_open(leave);
  ss_open();
}
예제 #15
0
파일: check_caps.c 프로젝트: priyancka/caps
main()
{
    FILE *td;
    char kernel_check[12],
         command[80],
         tmpname[16];

    memset(kernel_check, 0x0, 12);
    memset(command, 0x0, 80);
    memset(tmpname, 0x0, 16);

    putenv("_=check_caps");                  /* name to environ   */
    chdir(getenv("HOME"));                  /* to home directory  */

    tmp_name(tmpname);
    sprintf(command, "%s > %s",
            "ps -ef|grep -v grep|grep ' bin/kernel'|cut -c54-63",
            tmpname);
    system(command);

    td = fopen(tmpname, "r");
    if (td == 0)
    {
        exit(-1);
    }

    fgets(kernel_check, 11, td);

    if (td)
    {
        fclose(td);
        unlink(tmpname);
    }

    if (strcmp(kernel_check, KERNELNAME) != 0)
    {
        printf("System not started\n");
        exit(4);
    }

    ss_open();

    if (sp->sp_running_status == 'n')
    {
        printf("Markplace\n");
        close_all();
        exit(3);
    }
    else
    {
        if (sp->sp_in_process_status != 'x')
        {
            printf("System is Busy\n");
            close_all();
            exit(1);
        }
        else
        {
            if (sp->sp_config_status == 'y')
            {
                printf("System is running\n");
                close_all();
                exit(2);
            }
        }
    }

    close_all();

    exit(0);
} /* end of main() */
예제 #16
0
main()
{
  FILE *td;
  unsigned short int k       = 0,
                     results = 0;
  struct zone_item *z;
  char kernel_check[12],
       command[80],
       tmpname[16];

  memset(kernel_check, 0x0, 12);
  memset(command, 0x0, 80);
  memset(tmpname, 0x0, 16);

  putenv("_=check_caps");                  /* name to environ   */
  chdir(getenv("HOME"));                   /* to home directory  */

  tmp_name(tmpname);
  sprintf(command, "%s > %s",
          "ps -ef|grep -v grep|grep ' bin/kernel'|cut -c54-63",
          tmpname);
  system(command);

  td = fopen(tmpname, "r");
  if (td == 0)
     {
       exit(-1);
     }

  fgets(kernel_check, 11, td);

  if (td)
     {
       fclose(td);
       unlink(tmpname);
     }

  if (strcmp(kernel_check, KERNELNAME) != 0)
     {
       printf("System not started\n");
       exit(4);
     }

  ss_open();
  co_open();

  if (sp->sp_config_status != 'y')
     {
       printf("System is not configured\n");
       close_all();
       exit(4);
     }
  else
     {
       if (sp->sp_in_process_status != 'x')
          {
            printf("System is Busy\n");
            close_all();
            exit(-1);
          }

       results = 0;

       for (k = 0; k < coh->co_zone_cnt; k++)
           {
             z = &zone[k];

             if (z->zt_picker)
                {
                  results = 1;
                  break;
                }
           } /* end of for loop to check each configured zone */

       if (results)
          {
            printf("Picker ID %ld is logged in at zone %d\n",
                   z->zt_picker, z->zt_zone);
            close_all();
            exit(1);
          }
       else
          {
            printf("No logins present\n");
            close_all();
            exit(0);
          }
     }
} /* end of main() */
예제 #17
0
main()
{
  register long k;
  unsigned char t;
  struct fld_parms fld;

  putenv("_=record_format_srn");
  chdir(getenv("HOME"));

  sd_open(leave);
  sd_echo_flag = 0x20;
  ss_open();
  co_open();
  
  fix(record_format_srn);
  sd_screen_off();
  sd_clear_screen();
  sd_text(record_format_srn);
  sd_screen_on();
  
  memcpy(&x, rf, sizeof(struct rf_item));
  
  for (k = 0; k < NUM_PROMPTS; k++) show_field(k);
  
/*
 *  Only Super Operator May Input Data
 */
  getparms(0);
  
  if (!SUPER_OP)
  {
    eh_post(ERR_SUPER, 0);
    sd_cursor(0, 23, 3);
    sd_text("* * *  Hit Any Key   * * *");
    t = sd_keystroke(NOECHO);
    leave();
  }
  k = 0;
  
  while (1)
  {
    fld.irow   = field[k].row;
    fld.icol   = field[k].col;
    fld.pcol   = 0;
    fld.arrow  = 0;
    fld.length = &field[k].len;
    fld.prompt = 0;
    fld.type   = field[k].type;
    
    get_field(k); 

    t = sd_input(&fld, 0, 0, buf, 0);
  
    put_field(k);
    
    if (t == EXIT) leave();
    
    if (field[k].type == 'a')
    {
      if (field[k].valid)
      {
        if (!memchr(field[k].valid, *buf, strlen(field[k].valid)))
        {
          eh_post(ERR_CODE, buf);
          continue;
        }
      }
    }
    else
    {
      if (value < field[k].min || value > field[k].max)
      {
        eh_post(ERR_CODE, buf);
        continue;
      }
    }
    switch(k)
    {
      case 0:  if (x.rf_rp == 0x20 || !x.rf_rp)
               {
                 eh_post(ERR_PREFACE, 0);
                 x.rf_rp = rf->rf_rp;
                 continue;
               }
               break;
               
      case 1:  if (x.rf_rt == 0x20) x.rf_rt = 0; break;
      
      case 2:  if (x.rf_ft == 0x20) x.rf_ft = 0; break;
      
      case 3:  if (x.rf_eof == 0x20) x.rf_eof = 0; break;
      
      case 13: if (x.rf_box_pos > x.rf_rmks)
               {
                 eh_post(ERR_CODE, buf);
                 continue;
               }
               break;
               
      case 14: if (x.rf_box_len && !x.rf_rmks)
               {
                 eh_post(ERR_CODE, buf);
                 continue;
               }
               break;
      
      case 15: if (x.rf_box_count && !x.rf_box_len)
               {
                 eh_post(ERR_CODE, buf);
                 continue;
               }
               break;

    }
    show_field(k);
    
    if (t == UP_CURSOR) {if (k > 0) k--;}
    else if (t == RETURN) break;
    else 
    {
      k++;
      if (k >= NUM_PROMPTS) k = 0;
    }
  }
  sd_prompt(&fld1, 0);
  memset(buf, 0, 2);
  t = sd_input(&fld1, 0, 0, buf, 0);
  if (t == EXIT) leave();
  *buf = tolower(*buf);
  if (*buf == 'y')
  {
    memcpy(rf, &x, sizeof(struct rf_item));
    system("ss_dump -sp= -rf=sys/rf_text 1>/dev/null 2>/dev/null");
  }
  leave();
}
예제 #18
0
main()
{
  register struct pw_item *i;
  register struct st_item *s;
  register long k, errors;
  long pid, status;
  char command[80];
  
  putenv("_=orphan_picks");
  chdir(getenv("HOME"));
  
  database_open();

  ss_open();
  co_open();
  oc_open();
  od_open();
  
  if (sp->sp_sku_support == 'n') leave(0);
  
  errors = 0;
  tmp_name(fd_name);
  
  fd = fopen(fd_name, "w");
  if (fd == 0) krash("main", "open temp", 1);
  
  if (sp->sp_sku_support == 'y')           /* only when sku support          */
  {
    for (k = 0, i = pw; k < coh->co_prod_cnt; k++, i++)
    {
      if (i->pw_lines_to_go <= 0) continue;  /* has no picks                 */
  
      s = mod_lookup(k + 1);               /* find in sku table              */
      if (s) continue;                     /* module has a sku               */
    
      fprintf(fd, "No SKU Assigned To Module %d Has %d Picks\n", 
        k + 1, i->pw_lines_to_go);

      errors++;
    }
  }
#ifdef DEBUG
  fprintf(stderr, "errors=%d\n", errors);
#endif

  fprintf(fd, "\n\n");
  pick_setkey(1);
  
  begin_work();
  while (!pick_next(op_rec, NOLOCK))
  {
#ifdef DEBUG
  fprintf(stderr, "pl=%d  on=%d  mod=%d  flag=%x\n",
    op_rec->pi_pl, op_rec->pi_on, op_rec->pi_mod, op_rec->pi_flags);
#endif

    commit_work();
    begin_work();
    
    if (op_rec->pi_flags & VALIDATED) continue;
  
    fprintf(fd, 
      "Pickline: %2d  Order: %7.*d  Mod: %5d  SKU: %-15.15s  Quan: %3d\n",

      op_rec->pi_pl, rf->rf_on, op_rec->pi_on, op_rec->pi_mod,
      op_rec->pi_sku, op_rec->pi_ordered);

    errors++;
  }
  commit_work();
  fclose(fd);

  if (errors)
  {
    tmp_name(ed_name);

    if (fork() == 0)
    {
      execlp("prft", "prft", fd_name, ed_name, "sys/report/orphan_picks.h", 0);
      krash("main", "load prft", 1);
    }
    pid = wait(&status);
    if (!pid || status) krash("main", "prft failed", 1);
   
    sprintf(command, "%s %s", getenv("LPR"), fd_name);
  }
  else unlink(fd_name);
  leave(0);
}
예제 #19
0
open_all()
{
  ss_open();
  sd_open(leave);
  getparms(0);
}