[Circle] Help - segmentation fault

From: Primacy (jmrobins@wired.uvm.edu)
Date: 08/23/96

Here's a hunk of my code, it's modification of the do_finger command, 
posted a day or so ago.  I keep getting segmentation faults when I run it 
- could someone please help me out...thought I had it working once - but 
I was wrong.  Thanks!


  FILE* f;
  struct char_file_u chdata;
  struct char_data *victim = 0;
  char shost[80];

  one_argument(argument, arg);
  if (!*arg) {
    send_to_char("Whom do you wish to finger?\r\n", ch);
  if (load_char(arg, &chdata) < 0) {
    send_to_char("There is no such player.\r\n", ch);
  sprintf(buf, "%s %s is a level %3d player.\r\n", chdata.name, (chdata.title ? chdata.title : " "), (int) 
  send_to_char(buf, ch);
  strcpy(shost, chdata.host);
  if ((victim = get_player_vis(ch, arg, 0))) {
    sprintf(buf, "Is playing from %s.\r\n", shost);
    send_to_char(buf, ch);
    sprintf(buf, "Idle time: %d ticks..\r\n", victim->char_specials.timer);
    send_to_char(buf, ch);
  } else {
    strcpy(buf1, ctime(&chdata.last_logon));
    buf[19] = '\0';
    sprintf(buf, "Last login was on %s, from %s.\r\n", buf1, shost);
    send_to_char(buf, ch);
  sprintf(buf, "Email Address: %s\r\n", GET_EMAIL(victim));
  send_to_char(buf, ch);
  sprintf(buf, "finger %s > ../log/finger_file", GET_EMAIL(victim));

  f = fopen("../log/finger_file", "r");
  fread(buf, MAX_STRING_LENGTH-5, 1, f);
  buf[MAX(0, ftell(f))]=0;

  page_string(ch->desc, buf, 1);

| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |

This archive was generated by hypermail 2b30 : 12/07/00 PST