コード例 #1
0
ファイル: debug.c プロジェクト: Alkzndr/freebsd
/* Print a formatted string using format FMT and argument-list AP,
 * prefixing each line of output with a debug header. */
static void
debug_vprintf(const char *fmt, va_list ap)
{
  FILE *output = debug_output;
  char prefix[80], buffer[1000];
  char *s = buffer;
  int n;

  if (output == NULL || quiet_mode())
    return;

  n = apr_snprintf(prefix, sizeof(prefix), DBG_FLAG "%s:%4ld: ",
                   debug_file, debug_line);
  assert(n < sizeof(prefix) - 1);
  n = apr_vsnprintf(buffer, sizeof(buffer), fmt, ap);
  assert(n < sizeof(buffer) - 1);
  do
    {
      char *newline = strchr(s, '\n');
      if (newline)
        *newline = '\0';

      fputs(prefix, output);
      fputs(s, output);
      fputc('\n', output);

      if (! newline)
        break;
      s = newline + 1;
    }
  while (*s);  /* print another line, except after a final newline */
}
コード例 #2
0
ファイル: debug.c プロジェクト: Alkzndr/freebsd
void
svn_dbg__preamble(const char *file, long line, FILE *output)
{
  debug_output = output;

  if (output != NULL && !quiet_mode())
    {
      /* Quick and dirty basename() code.  */
      const char *slash = strrchr(file, '/');

      if (slash == NULL)
        slash = strrchr(file, '\\');
      if (slash)
        debug_file = slash + 1;
      else
        debug_file = file;
    }
  debug_line = line;
}
コード例 #3
0
ファイル: rn42_task.c プロジェクト: lkong/tmk_keyboard
void hook_keyboard_loop(void)
{

    if (test_status)
    {
        // 
        if (timer_elapsed32(last_press_timer) > 480000) // 8 minutes since last keypress
        {
            dprintf("test after\n");
	    rn42_disconnect();
	    led_set(host_keyboard_leds() & ~(1<<USB_LED_CAPS_LOCK)); // Turn off Caps Lock LED
	    sleep_led_toggle();
	    // if layer state x == 1, turn off layer LED and set bool saying it was on previously	    
	      if (third_test){
		quiet_mode();
		third_test = 0;
	      }
            rn42_cts_hi();
	    test_status = 0;
	    second_test = 1;
        }
    }
}