Пример #1
0
void
show_area_being_processed(char *area, int n)
{
  static char *last_area = NULL;

  if (verbose < 0)
    return;
  if (last_area) {
    if (total_shown)
      show_total();
    fputs(")", stdout);
    col += 1;
  }

  if (!last_area || !STREQ(area, last_area)) {
    if (last_area) {
      col_cleanup(0);
      total_shown = 0;
      total_mmm = show_range + 1;
    }
    (void) col_output(strlen(area) + 2);
    fprintf(stdout, "[%s", area);
    last_area = area;
  }

  fputs(" (", stdout);
  col += 2;
  show_range = n;
  total_mmm = n + 1;

  fflush(stdout);
}
Пример #2
0
void
lwarning(ioloc *l, char *fmt, ...)
{
  va_list ap;

  va_start(ap, fmt);
  col_cleanup(0);
  fprintf(stderr, "%s:%d: ", l->i_file, l->i_line);
  vfprintf(stderr, fmt, ap);
  fputc('\n', stderr);
  va_end(ap);
}
Пример #3
0
void
fatal(char *fmt, ...)
{
  va_list ap;

  va_start(ap, fmt);
  col_cleanup(1);
  fprintf(stderr, "%s: Fatal, ", progname);
  vfprintf(stderr, fmt, ap);
  fputc('\n', stderr);
  va_end(ap);
  exit(1);
}
Пример #4
0
/*
 * Lots of ways of reporting errors...
 */
void
error(char *fmt, ...)
{
  va_list ap;

  va_start(ap, fmt);
  col_cleanup(0);
  fprintf(stderr, "%s: Error, ", progname);
  vfprintf(stderr, fmt, ap);
  fputc('\n', stderr);
  errors++;
  va_end(ap);
}
Пример #5
0
/** @todo XXX - implement a smarter solution for recreating the packet list */
void
packet_list_recreate(void)
{
	g_signal_handler_block(packetlist->view, column_changed_handler_id);
	gtk_widget_destroy(pkt_scrollw);

	prefs.num_cols = g_list_length(prefs.col_list);

	col_cleanup(&cfile.cinfo);
	build_column_format_array(&cfile.cinfo, prefs.num_cols, FALSE);

	pkt_scrollw = packet_list_create();
	gtk_widget_show_all(pkt_scrollw);

	main_widgets_rearrange();

	if(cfile.state != FILE_CLOSED)
		redissect_packets();
}
Пример #6
0
/*
 * MAIN
 */
int
main(int argc, char *argv[])
{
  /*
   * Process arguments
   */
  fsi_get_args(argc, argv);

  /*
   * If no hostname given then use the local name
   */
  if (!*hostname && gethostname(hostname, sizeof(hostname)) < 0) {
    perror("gethostname");
    exit(1);
  }
  hostname[sizeof(hostname) - 1] = '\0';

  /*
   * Get the username
   */
  username = find_username();

  /*
   * New hosts and automounts
   */
  list_of_hosts = new_que();
  list_of_automounts = new_que();

  /*
   * New dictionaries
   */
  dict_of_volnames = new_dict();
  dict_of_hosts = new_dict();

  /*
   * Parse input
   */
  show_area_being_processed("read config", 11);
  if (fsi_parse())
    errors = 1;
  errors += file_io_errors + parse_errors;

  if (errors == 0) {
    /*
     * Do semantic analysis of input
     */
    analyze_hosts(list_of_hosts);
    analyze_automounts(list_of_automounts);
  }

  /*
   * Give up if errors
   */
  if (errors == 0) {
    /*
     * Output data files
     */

    write_atab(list_of_automounts);
    write_bootparams(list_of_hosts);
    write_dumpset(list_of_hosts);
    write_exportfs(list_of_hosts);
    write_fstab(list_of_hosts);
  }
  col_cleanup(1);

  exit(errors);
  return errors; /* should never reach here */
}