Changeset 73d8a88


Ignore:
Timestamp:
Mar 29, 2009, 11:49:55 AM (12 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
owl
Children:
3674002
Parents:
924ee11
Message:
cleanup sprintf use in owl_function_info()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r924ee11 r73d8a88  
    13991399  owl_message *m;
    14001400  owl_fmtext fm, attrfm;
    1401   char buff[10000];
     1401  char *buff;
    14021402  owl_view *v;
    14031403#ifdef HAVE_LIBZEPHYR
     
    14161416  owl_fmtext_append_bold(&fm, "General Information:\n");
    14171417  owl_fmtext_append_normal(&fm, "  Msg Id    : ");
    1418   sprintf(buff, "%i", owl_message_get_id(m));
     1418  buff=owl_sprintf("%i", owl_message_get_id(m));
    14191419  owl_fmtext_append_normal(&fm, buff);
     1420  owl_free(buff);
    14201421  owl_fmtext_append_normal(&fm, "\n");
    14211422
     
    15001501      if (!owl_message_is_pseudo(m)) {
    15011502        owl_fmtext_append_normal(&fm, "\n");
    1502         sprintf(buff, "  Port      : %i\n", ntohs(n->z_port));
     1503        buff=owl_sprintf("  Port      : %i\n", ntohs(n->z_port));
    15031504        owl_fmtext_append_normal(&fm, buff);
     1505        owl_free(buff);
    15041506
    15051507        owl_fmtext_append_normal(&fm,    "  Auth      : ");
     
    15071509        owl_fmtext_append_normal(&fm, "\n");
    15081510       
    1509         /* fix this */
    1510         sprintf(buff, "  Checkd Ath: %i\n", n->z_checked_auth);
    1511         sprintf(buff, "%s  Multi notc: %s\n", buff, n->z_multinotice);
    1512         sprintf(buff, "%s  Num other : %i\n", buff, n->z_num_other_fields);
    1513         sprintf(buff, "%s  Msg Len   : %i\n", buff, n->z_message_len);
     1511        buff=owl_sprintf("  Checkd Ath: %i\n  Multi notc: %s\n  Num other : %i\n  Msg Len   : %i\n",
     1512                         n->z_checked_auth,
     1513                         n->z_multinotice,
     1514                         n->z_num_other_fields,
     1515                        n->z_message_len);
    15141516        owl_fmtext_append_normal(&fm, buff);
     1517        owl_free(buff);
    15151518       
    1516         sprintf(buff, "  Fields    : %i\n", owl_zephyr_get_num_fields(n));
     1519        buff=owl_sprintf("  Fields    : %i\n", owl_zephyr_get_num_fields(n));
    15171520        owl_fmtext_append_normal(&fm, buff);
     1521        owl_free(buff);
    15181522       
    15191523        fields=owl_zephyr_get_num_fields(n);
    15201524        for (i=0; i<fields; i++) {
    1521           sprintf(buff, "  Field %i   : ", i+1);
     1525          buff=owl_sprintf("  Field %i   : ", i+1);
     1526          owl_fmtext_append_normal(&fm, buff);
     1527          owl_free(buff);
    15221528         
    15231529          ptr=owl_zephyr_get_field(n, i+1);
     
    15381544          }
    15391545         
    1540           strcat(buff, tmpbuff);
    1541           strcat(buff, "\n");
    1542           owl_fmtext_append_normal(&fm, buff);
     1546          owl_fmtext_append_normal(&fm, tmpbuff);
     1547          owl_fmtext_append_normal(&fm, "\n");
    15431548        }
    15441549        owl_fmtext_append_normal(&fm, "  Default Fm:");
Note: See TracChangeset for help on using the changeset viewer.