Пример #1
0
/*
 *  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                        */
leave()
{
  sd_close();
  ss_close();
  execlp("diagnostics", "diagnostics", 0);
  krash("leave", "diagnostics load", 1);
}
Пример #2
0
static int
tfw_bmb_connect(int tn, int cn)
{
	int ret;
	struct sock *sk;
	TfwBmbConn *conn;

	conn = &bmb_task[tn].conn[cn];

	ret = ss_sock_create(bmb_server_address.sa.sa_family, SOCK_STREAM,
			     IPPROTO_TCP, &sk);
	if (ret) {
		TFW_ERR("Unable to create kernel socket (%d)\n", ret);
		return ret;
	}

	ss_proto_init(&conn->proto, &bmb_hooks, tn * nconns + cn);
	rcu_assign_sk_user_data(sk, &conn->proto);
	ss_set_callbacks(sk);

	ret = ss_connect(sk, &bmb_server_address.sa,
			 tfw_addr_sa_len(&bmb_server_address), 0);
	if (ret) {
		TFW_ERR("Connect error on server socket sk %p (%d)\n", sk, ret);
		tfw_connection_unlink_from_sk(sk);
		ss_close(sk);
		return ret;
        }

	conn->sk = sk;
	bmb_task[tn].conn_attempt++;

	return 0;
}
Пример #3
0
close_all()
{
  oc_close();
  co_close();
  ss_close();
  sd_close();
}
Пример #4
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;
}
Пример #5
0
leave()
{
  sd_close();
  ss_close();
  co_close();
  execlp("syscomm", "syscomm", 0);
  krash("leave", "syscomm load", 1);
}
Пример #6
0
close_all()
{
  ss_close();
  pmfile_close();
  log_close();
  database_close();
  sd_close();
}
Пример #7
0
/*-------------------------------------------------------------------------*
 *  Close All Files
 *-------------------------------------------------------------------------*/
close_all()
{ 
  co_close();
  ss_close();
  pmfile_close();
  prodfile_close();
  sd_close();
  database_close();
}
Пример #8
0
close_all()
{
  sd_close();
  ss_close();
  co_close();
  oc_close();
  od_close();
  database_close();
}
Пример #9
0
/*
 *close all files
 */
close_all()
{ 
  picker_close();
  picker_order_close();
  co_close();
  ss_close();
  sd_close();
  database_close();
  return 0;
}
Пример #10
0
/*---------------------------------------------------------------------------
 * Closed all opened shared memory segments
 *---------------------------------------------------------------------------*/
close_all()
{
  ss_close();
  co_close();

  if (hwf)
     {
       fclose(hwf);
     }

  return;
} /* end of close_all() */
Пример #11
0
static void
tfw_bmb_release_sockets(int tn)
{
	int i;

	TFW_LOG("Release connections.\n");

	for (i = 0; i < nconns; i++) {
		if (bmb_task[tn].conn[i].sk) {
			tfw_connection_unlink_from_sk(bmb_task[tn].conn[i].sk);
			ss_close(bmb_task[tn].conn[i].sk);
		}
	}
}
Пример #12
0
static void gx_joypad_destroy(void)
{
   int i;
   for (i = 0; i < MAX_PADS; i++)
   {
#ifdef HAVE_LIBSICKSAXIS
      ss_close(&dev[i]);
      USB_Deinitialize();
#endif

#ifdef HW_RVL
   // Commenting this out fixes the Wii remote not reconnecting after core load, exit, etc.
   //   WPAD_Flush(i);
   //   WPADDisconnect(i);
#endif
   }
}
Пример #13
0
void __exit
kserver_exit(void)
{
	int ci;

	ss_release(my_proto.proto.listener);

	for (ci = 0; ci < atomic_read(&conn_i); ++ci)
		if (conn[ci])
			ss_close(conn[ci]);

	/*
	 * FIXME at this point the module can crash if there is some active
	 * softirq processing the sockets which are calling ssocket_hooks
	 * callbacks.
	 */

	stat_print();
}
Пример #14
0
/* 
 * read all of the data from a SpiceStream and store it in the WaveFile
 * structure.
 */
WaveFile *wf_finish_read(SpiceStream *ss)
{
	WaveFile *wf;
	int rc;
	double ival;
	double *dvals;
	WvTable *wt;
	int state;
	double *spar = NULL;

	wf = g_new0(WaveFile, 1);
	wf->ss = ss;
	wf->tables = g_ptr_array_new();
	dvals = g_new(double, ss->ncols);

	state = 0;
	do {
		wt = wf_read_table(ss, wf, &state, &ival, dvals);
		if(wt) {
			ss_msg(DBG, "wf_finish_read", "table with %d rows; state=%d", wt->nvalues, state);
			wt->swindex = wf->wf_ntables;
			g_ptr_array_add(wf->tables, wt);
			if(!wt->name) {
				char tmp[128];
				sprintf(tmp, "tbl%d", wf->wf_ntables);
				wt->name = g_strdup(tmp);
			}
		} else {
			ss_msg(DBG, "wf_finish_read", "NULL table; state=%d", state);
		}
	} while(state > 0);

	g_free(dvals);
	g_free(spar);
	ss_close(ss);

	if(state < 0) {
		wf_free(wf);
		return NULL;
	} else {
		return wf;
	}
}
Пример #15
0
int ss_open(struct ss_device *dev)
{
   usb_device_entry dev_entry[8];
   unsigned char dev_count;
   if (!_ss_inited)
      return -1;
   if (dev->connected)
      ss_close(dev);

   if (USB_GetDeviceList(dev_entry, 8, USB_CLASS_HID, &dev_count) < 0)
      return -2;

   int i;
   for (i = 0; i < dev_count; ++i)
   {
      if ((dev_entry[i].vid == SS_VENDOR_ID) && 
            (dev_entry[i].pid == SS_PRODUCT_ID))
      {
         if (!_ss_dev_id_list_exists(dev_entry[i].device_id))
         {
            if (USB_OpenDevice(dev_entry[i].device_id, 
                     SS_VENDOR_ID, SS_PRODUCT_ID, &dev->fd) < 0)
               return -3;

            dev->device_id = dev_entry[i].device_id;
            dev->connected = 1;
            dev->enabled = 0;
            dev->reading = 0;

            _ss_set_operational(dev);
            ss_set_led(dev, _ss_dev_number);

            _ss_dev_id_list_add(dev_entry[i].device_id);
            _ss_dev_number++;

            USB_DeviceRemovalNotifyAsync(dev->fd, &_ss_removal_cb, dev);
            return 1;
         }
      }
   }
   return -4;
}
void DS3_Cleanup()
{
    psPressed = false;
    ss_close(&first);
    USB_Deinitialize();
}
Пример #17
0
/*---------------------------------------------------------------------------
 * Closed all opened shared memory segments
 *---------------------------------------------------------------------------*/
close_all()
{
    ss_close();
    return;
} /* end of close_all() */
Пример #18
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");
    }
  }
}
Пример #19
0
close_all()
{
  ss_close();
  sd_close();
}