main.c
void beep_run(beep_args_t *args, int consolefd) {

  // -s
  if (args->input_stream == INPUT_STREAM_LINE) {
    beep_on_line(args, consolefd);
    return;
  }

  // -c
  if (args->input_stream == INPUT_STREAM_CHAR) {
    beep_on_char(args, consolefd);
    return;
  }

  // Everything else
  int r;
  for (r=0;r<args->repititions;r++) {

    beep(args->duration_ms, args->freq_hz, consolefd);

    if (args->delay_on_last_beep == -1 && r == args->repititions-1) 
      break;

    usleep(args->delay_ms*1000);
  }
}
// Decide how to beep based on config
Decide how to beep based on config
Decide how to beep based on config
void beep_run(beep_args_t *args, int consolefd) {
  if (args->input_stream == INPUT_STREAM_LINE) {
    beep_on_line(args, consolefd);
    return;
  }
  if (args->input_stream == INPUT_STREAM_CHAR) {
    beep_on_char(args, consolefd);
    return;
  }
  int r;
  for (r=0;r<args->repititions;r++) {
    beep(args->duration_ms, args->freq_hz, consolefd);
    if (args->delay_on_last_beep == -1 && r == args->repititions-1) 
      break;
    usleep(args->delay_ms*1000);
  }
}
void beep_run ( beep_args_t * args , int consolefd ) { if ( args -> input_stream == INPUT_STREAM_LINE ) { beep_on_line ( args , consolefd ) ; return ; } if ( args -> input_stream == INPUT_STREAM_CHAR ) { beep_on_char ( args , consolefd ) ; return ; } int r ; for ( r = 0 ; r < args -> repititions ; r ++ ) { beep ( args -> duration_ms , args -> freq_hz , consolefd ) ; if ( args -> delay_on_last_beep == -1 && r == args -> repititions - 1 ) break ; usleep ( args -> delay_ms * 1000 ) ; } }
Decide how to beep based on config
Decide how to beep based on config
// -s // -c // Everything else