コード例 #1
0
ファイル: devices_htc.c プロジェクト: Red680812/DNA_kitkat
int board_get_usb_ats(void)
{
	if (get_debug_flag() & DEBUG_FLAG_ENABLE_ATS_FLAG)
		return 1;
	else
		return usb_ats;
}
コード例 #2
0
ファイル: main.c プロジェクト: badwtg1111/Jabberd2s
static void router_signal_usr2(int signum)
{
    //set_debug_flag(1);
    
    if(get_debug_flag())
        set_debug_flag(0);
    else
        set_debug_flag(1);
}
コード例 #3
0
ファイル: dnsrv.c プロジェクト: TooKennySupreme/jabberd
/**
 * Spawn a separate process for ADNS 
 */
int dnsrv_fork_and_capture(RESOLVEFUNC f, dns_io di)
{
  int pid;
  int childToParent[2];
  int parentToChild[2];
  char childWriteHandle[10];  
  char childReadHandle[10];
  char debugging[10];
  int READ=0;
  int WRITE=1;
  
  /* create pipes for communication with child */
  pipe(childToParent);
  pipe(parentToChild);

  /* convert the handles as they should be seen by the child to 
   * strings so we can pass them as arguments to it
   */
  sprintf(childWriteHandle, "%i", childToParent[WRITE]);
  sprintf(childReadHandle, "%i", parentToChild[READ]);
  sprintf(debugging, "%i", get_debug_flag());
  
  /* try and spawn the child process */
  pid = spawnlp(_P_NOWAIT, "jabadns", "jabadns", 
                childReadHandle, childWriteHandle, debugging, NULL);
  if (pid < 0) {
    return -1;
  }
  
  /* setup di structure */
  di->pid = pid;
  di->in = childToParent[READ];
  di->out = parentToChild[WRITE];
  
  /* OK! */
  return pid;
}
コード例 #4
0
ファイル: msx_error.c プロジェクト: liororama/gossimon
/** Reading the debug file, parsing it and setting the msx_debug_level variable
    according to the entries found in the file
 @param *fname       Alternative debug file name
 @return 0 on error 1 on success
*/
int msx_read_debug_file(char *fname) {
	FILE *dbgFile;
	char *ptr;
	char line[256];
	int  found_out_file = 0;
	
	if(!fname)
		fname = DEFAULT_DEBUG_FILE;
	
	if(!(dbgFile = fopen(fname, "r")))
		return 0;

        msx_debug_level = 0;

	while(fgets(line, 256, dbgFile)) {
		char *out_file;
		
                // Skeeping comments
		if(line[0] == '#')
			continue;
		// removing spaces and newline
		ptr = line;
                ptr = eat_spaces(ptr);
                trim_spaces(ptr);

                // Getting the output file to use
		if((out_file = strstr(ptr, MSX_DEBUG_OUT_FILE_STR))) {
			found_out_file = 1;
                        out_file+= strlen(MSX_DEBUG_OUT_FILE_STR);
			out_file = eat_spaces(out_file);
			if(*out_file == '=') {
                             out_file++;
                             out_file = eat_spaces(out_file);
                        }

                        // out_file should now point to the file name
			if(!msx_debug_file ||
			   strcmp(msx_debug_file, out_file) != 0) {
				if(msx_debug_file)
					free(msx_debug_file);
				if(msx_debug_filp)
					fclose(msx_debug_filp);
				msx_debug_filp = NULL;
				msx_debug_file = strdup(out_file);
			}
			
			if(msx_debug_filp == NULL) {
				msx_debug_filp = fopen(out_file, "w");
				if(msx_debug_filp == NULL) {
					free(msx_debug_file);
					msx_debug_file = NULL;
					msx_debug_filp = NULL;
				} else {
					setlinebuf(msx_debug_filp);
				}
			}
		}

                // Getting the flags to set
                int flag;
                if((flag = get_debug_flag(ptr)))
                     msx_debug_level |= flag;
                
        }
        
	fclose(dbgFile);
	if(!found_out_file) {
             if(msx_debug_file) {
                  fclose(msx_debug_filp);
                  free(msx_debug_file);
                  msx_debug_file = NULL;
             }
             msx_debug_filp = NULL;
	}
	
	return 1;
}