Changeset 01ff87d


Ignore:
Timestamp:
Aug 15, 2009, 7:16:47 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
4db2355
Parents:
96cdeaf (diff), 369a7f0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:
Merge branch 'andersk/const'
Files:
46 edited

Legend:

Unmodified
Added
Removed
  • aim.c

    r5227de4 re19eb97  
    2626};
    2727
    28 static char *msgerrreasons[] = {
     28static const char *msgerrreasons[] = {
    2929        "Invalid error",
    3030        "Invalid SNAC",
     
    136136
    137137
    138 int owl_aim_login(char *screenname, char *password)
     138int owl_aim_login(const char *screenname, const char *password)
    139139{
    140140  struct owlfaim_priv *priv;
     
    209209
    210210/* stuff to run once login has been successful */
    211 void owl_aim_successful_login(char *screenname)
     211void owl_aim_successful_login(const char *screenname)
    212212{
    213213  char *buff;
     
    248248}
    249249
    250 void owl_aim_login_error(char *message)
     250void owl_aim_login_error(const char *message)
    251251{
    252252  if (message) {
     
    261261}
    262262
    263 int owl_aim_send_im(char *to, char *msg)
     263int owl_aim_send_im(const char *to, const char *msg)
    264264{
    265265  int ret;
     
    271271}
    272272
    273 int owl_aim_send_awaymsg(char *to, char *msg)
     273int owl_aim_send_awaymsg(const char *to, const char *msg)
    274274{
    275275  int ret;
     
    281281}
    282282
    283 void owl_aim_addbuddy(char *name)
     283void owl_aim_addbuddy(const char *name)
    284284{
    285285
     
    295295}
    296296
    297 void owl_aim_delbuddy(char *name)
     297void owl_aim_delbuddy(const char *name)
    298298{
    299299  aim_ssi_delbuddy(owl_global_get_aimsess(&g), name, "Buddies");
     
    301301}
    302302
    303 void owl_aim_search(char *email)
     303void owl_aim_search(const char *email)
    304304{
    305305  int ret;
     
    314314
    315315
    316 int owl_aim_set_awaymsg(char *msg)
     316int owl_aim_set_awaymsg(const char *msg)
    317317{
    318318  int len;
     
    341341}
    342342
    343 void owl_aim_chat_join(char *name, int exchange)
     343void owl_aim_chat_join(const char *name, int exchange)
    344344{
    345345  int ret;
     
    347347  /*
    348348  OscarData *od = g->proto_data;
    349   char *name, *exchange;
     349  const char *name, *exchange;
    350350  */
    351351
     
    392392}
    393393
    394 void owl_aim_chat_leave(char *chatroom)
    395 {
    396 }
    397 
    398 int owl_aim_chat_sendmsg(char *chatroom, char *msg)
     394void owl_aim_chat_leave(const char *chatroom)
     395{
     396}
     397
     398int owl_aim_chat_sendmsg(const char *chatroom, const char *msg)
    399399{
    400400  return(0);
     
    402402
    403403/* caller must free the return */
    404 char *owl_aim_normalize_screenname(char *in)
     404char *owl_aim_normalize_screenname(const char *in)
    405405{
    406406  char *out;
     
    482482  struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD;
    483483   
    484   char *key;
    485   va_list ap;
    486 
    487   va_start(ap, fr);
    488   key = va_arg(ap, char *);
     484  const char *key;
     485  va_list ap;
     486
     487  va_start(ap, fr);
     488  key = va_arg(ap, const char *);
    489489  va_end(ap);
    490490
     
    706706  va_list ap;
    707707  fu16_t code;
    708   char *msg;
     708  const char *msg;
    709709 
    710710  va_start(ap, fr);
    711711  code = va_arg(ap, int);
    712   msg = va_arg(ap, char *);
     712  msg = va_arg(ap, const char *);
    713713  va_end(ap);
    714714 
     
    740740  fu16_t change = 0, perms, type;
    741741  int length, str;
    742   char *val;
     742  const char *val;
    743743  va_list ap;
    744744 
     
    748748  type = (fu16_t)va_arg(ap, unsigned int);
    749749  length = va_arg(ap, int);
    750   val = va_arg(ap, char *);
     750  val = va_arg(ap, const char *);
    751751  str = va_arg(ap, int);
    752752  va_end(ap);
     
    900900static int faimtest_parse_motd(aim_session_t *sess, aim_frame_t *fr, ...)
    901901{
    902   char *msg;
     902  const char *msg;
    903903  fu16_t id;
    904904  va_list ap;
    905905  static int codeslen = 5;
    906   static char *codes[] = {
     906  static const char *codes[] = {
    907907    "Unknown",
    908908    "Mandatory upgrade",
     
    914914  va_start(ap, fr);
    915915  id = va_arg(ap, int);
    916   msg = va_arg(ap, char *);
     916  msg = va_arg(ap, const char *);
    917917  va_end(ap);
    918918
     
    10721072  va_list ap;
    10731073  fu32_t offset, len;
    1074   char *modname;
     1074  const char *modname;
    10751075  unsigned char *buf;
    10761076  int buflen;
     
    10791079  offset = va_arg(ap, fu32_t);
    10801080  len = va_arg(ap, fu32_t);
    1081   modname = va_arg(ap, char *);
     1081  modname = va_arg(ap, const char *);
    10821082  va_end(ap);
    10831083 
     
    11121112{
    11131113  aim_userinfo_t *userinfo;
    1114   char *prof_encoding = NULL;
    1115   char *prof = NULL;
     1114  const char *prof_encoding = NULL;
     1115  const char *prof = NULL;
    11161116  fu16_t inforeq = 0;
    11171117  owl_buddy *b;
     
    11201120  userinfo = va_arg(ap, aim_userinfo_t *);
    11211121  inforeq = (fu16_t)va_arg(ap, unsigned int);
    1122   prof_encoding = va_arg(ap, char *);
    1123   prof = va_arg(ap, char *);
     1122  prof_encoding = va_arg(ap, const char *);
     1123  prof = va_arg(ap, const char *);
    11241124  va_end(ap);
    11251125
     
    14971497{
    14981498  va_list ap;
    1499   char *destsn;
     1499  const char *destsn;
    15001500  fu16_t reason;
    15011501 
    15021502  va_start(ap, fr);
    15031503  reason = (fu16_t)va_arg(ap, unsigned int);
    1504   destsn = va_arg(ap, char *);
     1504  destsn = va_arg(ap, const char *);
    15051505  va_end(ap);
    15061506 
     
    15181518{
    15191519  va_list ap;
    1520   char *destsn;
     1520  const char *destsn;
    15211521  fu16_t reason;
    15221522 
    15231523  va_start(ap, fr);
    15241524  reason = (fu16_t)va_arg(ap, unsigned int);
    1525   destsn = va_arg(ap, char *);
     1525  destsn = va_arg(ap, const char *);
    15261526  va_end(ap);
    15271527 
     
    15341534static int faimtest_parse_misses(aim_session_t *sess, aim_frame_t *fr, ...)
    15351535{
    1536   static char *missedreasons[] = {
     1536  static const char *missedreasons[] = {
    15371537    "Invalid (0)",
    15381538    "Message too large",
     
    15661566  va_list ap;
    15671567  fu16_t type;
    1568   char *sn = NULL;
     1568  const char *sn = NULL;
    15691569 
    15701570  va_start(ap, fr);
    15711571  type = (fu16_t)va_arg(ap, unsigned int);
    1572   sn = va_arg(ap, char *);
     1572  sn = va_arg(ap, const char *);
    15731573  va_end(ap);
    15741574 
     
    15801580static int faimtest_parse_ratechange(aim_session_t *sess, aim_frame_t *fr, ...)
    15811581{
    1582   static char *codes[5] = {
     1582  static const char *codes[5] = {
    15831583    "invalid",
    15841584    "change",
     
    16561656{
    16571657  va_list ap;
    1658   char *address, *SNs;
     1658  const char *address, *SNs;
    16591659  int num, i;
    16601660  owl_list list;
    16611661 
    16621662  va_start(ap, fr);
    1663   address = va_arg(ap, char *);
     1663  address = va_arg(ap, const char *);
    16641664  num = va_arg(ap, int);
    1665   SNs = va_arg(ap, char *);
     1665  SNs = va_arg(ap, const char *);
    16661666  va_end(ap);
    16671667
     
    16711671  for (i=0; i<num; i++) {
    16721672    owl_function_debugmsg("  %s", &SNs[i*(MAXSNLEN+1)]);
    1673     owl_list_append_element(&list, &SNs[i*(MAXSNLEN+1)]);
     1673    owl_list_append_element(&list, (void *)&SNs[i*(MAXSNLEN+1)]);
    16741674  }
    16751675  owl_function_aimsearch_results(address, &list);
     
    16811681{
    16821682  va_list ap;
    1683   char *address;
    1684  
    1685   va_start(ap, fr);
    1686   address = va_arg(ap, char *);
     1683  const char *address;
     1684 
     1685  va_start(ap, fr);
     1686  address = va_arg(ap, const char *);
    16871687  va_end(ap);
    16881688
     
    16961696{
    16971697  va_list ap;
    1698   char *msg, *url;
     1698  const char *msg, *url;
    16991699  fu16_t width, height, delay;
    17001700 
    17011701  va_start(ap, fr);
    1702   msg = va_arg(ap, char *);
    1703   url = va_arg(ap, char *);
     1702  msg = va_arg(ap, const char *);
     1703  url = va_arg(ap, const char *);
    17041704  width = va_arg(ap, unsigned int);
    17051705  height = va_arg(ap, unsigned int);
     
    17221722  va_list ap;
    17231723  aim_conn_t *bosconn;
    1724   char *bosip;
     1724  const char *bosip;
    17251725  fu8_t *cookie;
    17261726 
    17271727  va_start(ap, fr);
    1728   bosip = va_arg(ap, char *);
     1728  bosip = va_arg(ap, const char *);
    17291729  cookie = va_arg(ap, fu8_t *);
    17301730  va_end(ap);
     
    18731873  aim_userinfo_t *userinfo;
    18741874  struct aim_chat_roominfo *roominfo;
    1875   char *roomname;
     1875  const char *roomname;
    18761876  int usercount;
    1877   char *roomdesc;
     1877  const char *roomdesc;
    18781878  fu16_t flags, unknown_d2, unknown_d5, maxmsglen, maxvisiblemsglen;
    18791879  fu32_t creationtime;
     
    18851885  va_start(ap, fr);
    18861886  roominfo = va_arg(ap, struct aim_chat_roominfo *);
    1887   roomname = va_arg(ap, char *);
     1887  roomname = va_arg(ap, const char *);
    18881888  usercount = va_arg(ap, int);
    18891889  userinfo = va_arg(ap, aim_userinfo_t *);
    1890   roomdesc = va_arg(ap, char *);
     1890  roomdesc = va_arg(ap, const char *);
    18911891  flags = (fu16_t)va_arg(ap, unsigned int);
    18921892  creationtime = va_arg(ap, fu32_t);
     
    19281928  va_list ap;
    19291929  aim_userinfo_t *userinfo;
    1930   char *msg;
     1930  const char *msg;
    19311931  char tmpbuf[1152];
    19321932 
    19331933  va_start(ap, fr);
    19341934  userinfo = va_arg(ap, aim_userinfo_t *);     
    1935   msg = va_arg(ap, char *);
     1935  msg = va_arg(ap, const char *);
    19361936  va_end(ap);
    19371937
  • buddy.c

    rd43edd2 r476faed  
    11#include "owl.h"
    22
    3 void owl_buddy_create(owl_buddy *b, int proto, char *name)
     3void owl_buddy_create(owl_buddy *b, int proto, const char *name)
    44{
    55  b->proto=proto;
     
    88}
    99
    10 char *owl_buddy_get_name(owl_buddy *b)
     10const char *owl_buddy_get_name(const owl_buddy *b)
    1111{
    1212  if (b->name) return(b->name);
     
    1414}
    1515
    16 int owl_buddy_is_idle(owl_buddy *b)
     16int owl_buddy_is_idle(const owl_buddy *b)
    1717{
    1818  if (b->isidle) return(1);
     
    3030}
    3131
    32 int owl_buddy_get_proto(owl_buddy *b)
     32int owl_buddy_get_proto(const owl_buddy *b)
    3333{
    3434  return(b->proto);
    3535}
    3636
    37 int owl_buddy_is_proto_aim(owl_buddy *b)
     37int owl_buddy_is_proto_aim(const owl_buddy *b)
    3838{
    3939  if (b->proto==OWL_PROTOCOL_AIM) return(1);
     
    5353/* return the number of minutes the buddy has been idle
    5454 */
    55 int owl_buddy_get_idle_time(owl_buddy *b)
     55int owl_buddy_get_idle_time(const owl_buddy *b)
    5656{
    5757  time_t now;
  • buddylist.c

    rd43edd2 r35b3518  
    88/* add a (logged-in) AIM buddy to the buddy list
    99 */
    10 void owl_buddylist_add_aim_buddy(owl_buddylist *bl, char *screenname)
     10void owl_buddylist_add_aim_buddy(owl_buddylist *bl, const char *screenname)
    1111{
    1212  owl_buddy *b;
     
    1919/* remove an AIM buddy from the buddy list
    2020 */
    21 int owl_buddylist_remove_aim_buddy(owl_buddylist *bl, char *name)
     21int owl_buddylist_remove_aim_buddy(owl_buddylist *bl, const char *name)
    2222{
    2323  int i, j;
     
    4040 * logged in.
    4141 */
    42 void owl_buddylist_oncoming(owl_buddylist *bl, char *screenname)
     42void owl_buddylist_oncoming(owl_buddylist *bl, const char *screenname)
    4343{
    4444  owl_message *m;
     
    6666 * has logged out, and sending a message if they were logged in.
    6767 */
    68 void owl_buddylist_offgoing(owl_buddylist *bl, char *screenname)
     68void owl_buddylist_offgoing(owl_buddylist *bl, const char *screenname)
    6969{
    7070  owl_message *m;
     
    8585
    8686/* return the number of logged in buddies */
    87 int owl_buddylist_get_size(owl_buddylist *bl)
     87int owl_buddylist_get_size(const owl_buddylist *bl)
    8888{
    8989  return(owl_list_get_size(&(bl->buddies)));
     
    9292/* return the buddy with index N.  If out of range, return NULL
    9393 */
    94 owl_buddy *owl_buddylist_get_buddy_n(owl_buddylist *bl, int index)
     94owl_buddy *owl_buddylist_get_buddy_n(const owl_buddylist *bl, int index)
    9595{
    9696  if (index<0) return(NULL);
     
    103103 * no such buddy is logged in, return NULL.
    104104 */
    105 owl_buddy *owl_buddylist_get_aim_buddy(owl_buddylist *bl, char *name)
     105owl_buddy *owl_buddylist_get_aim_buddy(const owl_buddylist *bl, const char *name)
    106106{
    107107  int i, j;
     
    119119 * otherwise return 0
    120120 */
    121 int owl_buddylist_is_aim_buddy_loggedin(owl_buddylist *bl, char *screenname)
     121int owl_buddylist_is_aim_buddy_loggedin(const owl_buddylist *bl, const char *screenname)
    122122{
    123   owl_buddy *b;
     123  const owl_buddy *b;
    124124
    125125  b=owl_buddylist_get_aim_buddy(bl, screenname);
  • cmd.c

    r4d86e06 r0a0fb74  
    55#include "owl.h"
    66
    7 extern owl_cmd commands_to_init[];
     7extern const owl_cmd commands_to_init[];
    88
    99/**************************************************************************/
     
    2323
    2424/* for bulk initialization at startup */
    25 int owl_cmddict_add_from_list(owl_cmddict *cd, owl_cmd *cmds) {
    26   owl_cmd *cur;
     25int owl_cmddict_add_from_list(owl_cmddict *cd, const owl_cmd *cmds) {
     26  const owl_cmd *cur;
    2727  int ret = 0;
    2828  for (cur = cmds; cur->name != NULL; cur++) {
     
    3434
    3535/* free the list with owl_cmddict_namelist_free */
    36 void owl_cmddict_get_names(owl_cmddict *d, owl_list *l) {
     36void owl_cmddict_get_names(const owl_cmddict *d, owl_list *l) {
    3737  owl_dict_get_keys(d, l);
    3838}
    3939
    40 owl_cmd *owl_cmddict_find(owl_cmddict *d, char *name) {
     40const owl_cmd *owl_cmddict_find(const owl_cmddict *d, const char *name) {
    4141  return owl_dict_find_element(d, name);
    4242}
     
    4747
    4848/* creates a new command alias */
    49 int owl_cmddict_add_alias(owl_cmddict *cd, char *alias_from, char *alias_to) {
     49int owl_cmddict_add_alias(owl_cmddict *cd, const char *alias_from, const char *alias_to) {
    5050  owl_cmd *cmd;
    5151  cmd = owl_malloc(sizeof(owl_cmd));
     
    5555}
    5656
    57 int owl_cmddict_add_cmd(owl_cmddict *cd, owl_cmd * cmd) {
     57int owl_cmddict_add_cmd(owl_cmddict *cd, const owl_cmd * cmd) {
    5858  owl_cmd * newcmd = owl_malloc(sizeof(owl_cmd));
    5959  if(owl_cmd_create_from_template(newcmd, cmd) < 0) {
     
    6565}
    6666
    67 char *_owl_cmddict_execute(owl_cmddict *cd, owl_context *ctx, char **argv, int argc, char *buff) {
     67char *_owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc, const char *buff) {
    6868  char *retval = NULL;
    69   owl_cmd *cmd;
     69  const owl_cmd *cmd;
    7070
    7171  if (!strcmp(argv[0], "")) {
     
    7878}
    7979
    80 char *owl_cmddict_execute(owl_cmddict *cd, owl_context *ctx, char *cmdbuff) {
     80char *owl_cmddict_execute(const owl_cmddict *cd, const owl_context *ctx, const char *cmdbuff) {
    8181  char **argv;
    8282  int argc;
     
    9595  if (argc < 1) return(NULL);
    9696
    97   retval = _owl_cmddict_execute(cd, ctx, argv, argc, cmdbuff);
     97  retval = _owl_cmddict_execute(cd, ctx, strs(argv), argc, cmdbuff);
    9898
    9999  owl_parsefree(argv, argc);
     
    103103}
    104104
    105 char *owl_cmddict_execute_argv(owl_cmddict *cd, owl_context *ctx, char **argv, int argc) {
     105char *owl_cmddict_execute_argv(const owl_cmddict *cd, const owl_context *ctx, const char *const *argv, int argc) {
    106106  char *buff, *ptr;
    107107  int len = 0, i;
     
    132132
    133133/* sets up a new command based on a template, copying strings */
    134 int owl_cmd_create_from_template(owl_cmd *cmd, owl_cmd *templ) {
     134int owl_cmd_create_from_template(owl_cmd *cmd, const owl_cmd *templ) {
    135135  *cmd = *templ;
    136136  if (!templ->name) return(-1);
     
    143143}
    144144
    145 int owl_cmd_create_alias(owl_cmd *cmd, char *name, char *aliased_to) {
     145int owl_cmd_create_alias(owl_cmd *cmd, const char *name, const char *aliased_to) {
    146146  memset(cmd, 0, sizeof(owl_cmd));
    147147  cmd->name = owl_strdup(name);
     
    162162}
    163163
    164 int owl_cmd_is_context_valid(owl_cmd *cmd, owl_context *ctx) {
     164int owl_cmd_is_context_valid(const owl_cmd *cmd, const owl_context *ctx) {
    165165  if (owl_context_matches(ctx, cmd->validctx)) return 1;
    166166  else return 0;
    167167}
    168168
    169 char *owl_cmd_execute(owl_cmd *cmd, owl_cmddict *cd, owl_context *ctx, int argc, char **argv, char *cmdbuff) {
     169char *owl_cmd_execute(const owl_cmd *cmd, const owl_cmddict *cd, const owl_context *ctx, int argc, const char *const *argv, const char *cmdbuff) {
    170170  static int alias_recurse_depth = 0;
    171171  int ival=0;
    172   char *cmdbuffargs, *newcmd, *rv=NULL;
     172  const char *cmdbuffargs;
     173  char *newcmd, *rv=NULL;
    173174
    174175  if (argc < 1) return(NULL);
     
    205206
    206207  if (cmd->cmd_i_fn || cmd->cmd_ctxi_fn) {
    207       char *ep = "x";
     208      const char *ep = "x";
    208209      if (argc != 2) {
    209210        owl_function_makemsg("Wrong number of arguments for %s command.", argv[0]);
    210211        return NULL;
    211212      }
    212       ival = strtol(argv[1], &ep, 10);
     213      ival = strtol(argv[1], (char **)&ep, 10);
    213214      if (*ep || ep==argv[1]) {
    214215        owl_function_makemsg("Invalid argument '%s' for %s command.", argv[1], argv[0]);
     
    237238
    238239/* returns a reference */
    239 char *owl_cmd_get_summary(owl_cmd *cmd) {
     240const char *owl_cmd_get_summary(const owl_cmd *cmd) {
    240241  return cmd->summary;
    241242}
    242243
    243244/* returns a summary line describing this keymap.  the caller must free. */
    244 char *owl_cmd_describe(owl_cmd *cmd) {
     245char *owl_cmd_describe(const owl_cmd *cmd) {
    245246  char *s;
    246247  int slen;
     
    254255
    255256
    256 void owl_cmd_get_help(owl_cmddict *d, char *name, owl_fmtext *fm) {
    257   char *indent, *s;
     257void owl_cmd_get_help(const owl_cmddict *d, const char *name, owl_fmtext *fm) {
     258  const char *s;
     259  char *indent;
    258260  owl_cmd *cmd;
    259261
  • commands.c

    rbc9020f r9e5c9f3  
    55#include "owl.h"
    66
    7 /* fn is "char *foo(int argc, char **argv, char *buff)" */
     7/* fn is "char *foo(int argc, const char *const *argv, const char *buff)" */
    88#define OWLCMD_ARGS(name, fn, ctx, summary, usage, description) \
    99        { name, summary, usage, description, ctx, \
     
    2424          actualname, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
    2525
    26 /* fn is "char *foo(void *ctx, int argc, char **argv, char *buff)" */
     26/* fn is "char *foo(void *ctx, int argc, const char *const *argv, const char *buff)" */
    2727#define OWLCMD_ARGS_CTX(name, fn, ctx, summary, usage, description) \
    2828        { name, summary, usage, description, ctx, \
    29           NULL, NULL, NULL, NULL, ((char*(*)(void*,int,char**,char*))fn), NULL, NULL, NULL }
     29          NULL, NULL, NULL, NULL, ((char*(*)(void*,int,const char*const *,const char*))fn), NULL, NULL, NULL }
    3030
    3131/* fn is "void foo(void)" */
     
    4040
    4141
    42 owl_cmd commands_to_init[]
     42const owl_cmd commands_to_init[]
    4343  = {
    4444  OWLCMD_ARGS("zlog", owl_command_zlog, OWL_CTX_ANY,
     
    10041004}
    10051005
    1006 char *owl_command_help(int argc, char **argv, char *buff)
     1006char *owl_command_help(int argc, const char *const *argv, const char *buff)
    10071007{
    10081008  if (argc!=2) {
     
    10151015}
    10161016
    1017 char *owl_command_zlist(int argc, char **argv, char *buff)
     1017char *owl_command_zlist(int argc, const char *const *argv, const char *buff)
    10181018{
    10191019  int elapsed=0, timesort=0;
    1020   char *file=NULL;
     1020  const char *file=NULL;
    10211021
    10221022  argc--;
     
    10761076}
    10771077
    1078 char *owl_command_aim(int argc, char **argv, char *buff)
     1078char *owl_command_aim(int argc, const char *const *argv, const char *buff)
    10791079{
    10801080  if (argc<2) {
     
    10961096}
    10971097
    1098 char *owl_command_addbuddy(int argc, char **argv, char *buff)
     1098char *owl_command_addbuddy(int argc, const char *const *argv, const char *buff)
    10991099{
    11001100  if (argc!=3) {
     
    11241124}
    11251125
    1126 char *owl_command_delbuddy(int argc, char **argv, char *buff)
     1126char *owl_command_delbuddy(int argc, const char *const *argv, const char *buff)
    11271127{
    11281128  if (argc!=3) {
     
    11481148}
    11491149
    1150 char *owl_command_join(int argc, char **argv, char *buff)
     1150char *owl_command_join(int argc, const char *const *argv, const char *buff)
    11511151{
    11521152  if (argc!=3 && argc!=4) {
     
    11721172}
    11731173
    1174 char *owl_command_startup(int argc, char **argv, char *buff)
    1175 {
    1176   char *ptr;
     1174char *owl_command_startup(int argc, const char *const *argv, const char *buff)
     1175{
     1176  const char *ptr;
    11771177
    11781178  if (argc<2) {
     
    11931193}
    11941194
    1195 char *owl_command_unstartup(int argc, char **argv, char *buff)
    1196 {
    1197   char *ptr;
     1195char *owl_command_unstartup(int argc, const char *const *argv, const char *buff)
     1196{
     1197  const char *ptr;
    11981198
    11991199  if (argc<2) {
     
    12131213}
    12141214
    1215 char *owl_command_dump(int argc, char **argv, char *buff)
     1215char *owl_command_dump(int argc, const char *const *argv, const char *buff)
    12161216{
    12171217  char *filename;
     
    12271227}
    12281228
    1229 char *owl_command_source(int argc, char **argv, char *buff)
     1229char *owl_command_source(int argc, const char *const *argv, const char *buff)
    12301230{
    12311231  if (argc!=2) {
     
    12381238}
    12391239
    1240 char *owl_command_next(int argc, char **argv, char *buff)
     1240char *owl_command_next(int argc, const char *const *argv, const char *buff)
    12411241{
    12421242  char *filter=NULL;
     
    12681268}
    12691269
    1270 char *owl_command_prev(int argc, char **argv, char *buff)
     1270char *owl_command_prev(int argc, const char *const *argv, const char *buff)
    12711271{
    12721272  char *filter=NULL;
     
    12981298}
    12991299
    1300 char *owl_command_smartnarrow(int argc, char **argv, char *buff)
     1300char *owl_command_smartnarrow(int argc, const char *const *argv, const char *buff)
    13011301{
    13021302  char *filtname = NULL;
     
    13161316}
    13171317
    1318 char *owl_command_smartfilter(int argc, char **argv, char *buff)
     1318char *owl_command_smartfilter(int argc, const char *const *argv, const char *buff)
    13191319{
    13201320  char *filtname = NULL;
     
    13721372}
    13731373
    1374 char *owl_command_loadsubs(int argc, char **argv, char *buff)
     1374char *owl_command_loadsubs(int argc, const char *const *argv, const char *buff)
    13751375{
    13761376  if (argc == 2) {
     
    13861386
    13871387
    1388 char *owl_command_loadloginsubs(int argc, char **argv, char *buff)
     1388char *owl_command_loadloginsubs(int argc, const char *const *argv, const char *buff)
    13891389{
    13901390  if (argc == 2) {
     
    14041404}
    14051405
    1406 char *owl_command_start_command(int argc, char **argv, char *buff)
     1406char *owl_command_start_command(int argc, const char *const *argv, const char *buff)
    14071407{
    14081408  buff = skiptokens(buff, 1);
     
    14111411}
    14121412
    1413 char *owl_command_zaway(int argc, char **argv, char *buff)
     1413char *owl_command_zaway(int argc, const char *const *argv, const char *buff)
    14141414{
    14151415  if ((argc==1) ||
     
    14371437
    14381438
    1439 char *owl_command_aaway(int argc, char **argv, char *buff)
     1439char *owl_command_aaway(int argc, const char *const *argv, const char *buff)
    14401440{
    14411441  if ((argc==1) ||
     
    14631463
    14641464
    1465 char *owl_command_away(int argc, char **argv, char *buff)
     1465char *owl_command_away(int argc, const char *const *argv, const char *buff)
    14661466{
    14671467  if ((argc==1) ||
     
    15061506}
    15071507
    1508 char *owl_command_set(int argc, char **argv, char *buff)
    1509 {
    1510   char *var, *val;
     1508char *owl_command_set(int argc, const char *const *argv, const char *buff)
     1509{
     1510  const char *var, *val;
    15111511  int  silent=0;
    15121512  int requirebool=0;
     
    15371537}
    15381538
    1539 char *owl_command_unset(int argc, char **argv, char *buff)
    1540 {
    1541   char *var, *val;
     1539char *owl_command_unset(int argc, const char *const *argv, const char *buff)
     1540{
     1541  const char *var, *val;
    15421542  int  silent=0;
    15431543
     
    15571557}
    15581558
    1559 char *owl_command_print(int argc, char **argv, char *buff)
    1560 {
    1561   char *var;
     1559char *owl_command_print(int argc, const char *const *argv, const char *buff)
     1560{
     1561  const char *var;
    15621562  char valbuff[1024];
    15631563
     
    15821582
    15831583
    1584 char *owl_command_exec(int argc, char **argv, char *buff)
     1584char *owl_command_exec(int argc, const char *const *argv, const char *buff)
    15851585{
    15861586  return owl_function_exec(argc, argv, buff, 0);
    15871587}
    15881588
    1589 char *owl_command_pexec(int argc, char **argv, char *buff)
     1589char *owl_command_pexec(int argc, const char *const *argv, const char *buff)
    15901590{
    15911591  return owl_function_exec(argc, argv, buff, 1);
    15921592}
    15931593
    1594 char *owl_command_aexec(int argc, char **argv, char *buff)
     1594char *owl_command_aexec(int argc, const char *const *argv, const char *buff)
    15951595{
    15961596  return owl_function_exec(argc, argv, buff, 2);
    15971597}
    15981598
    1599 char *owl_command_perl(int argc, char **argv, char *buff)
     1599char *owl_command_perl(int argc, const char *const *argv, const char *buff)
    16001600{
    16011601  return owl_function_perl(argc, argv, buff, 0);
    16021602}
    16031603
    1604 char *owl_command_pperl(int argc, char **argv, char *buff)
     1604char *owl_command_pperl(int argc, const char *const *argv, const char *buff)
    16051605{
    16061606  return owl_function_perl(argc, argv, buff, 1);
    16071607}
    16081608
    1609 char *owl_command_aperl(int argc, char **argv, char *buff)
     1609char *owl_command_aperl(int argc, const char *const *argv, const char *buff)
    16101610{
    16111611  return owl_function_perl(argc, argv, buff, 2);
    16121612}
    16131613
    1614 char *owl_command_multi(int argc, char **argv, char *buff)
     1614char *owl_command_multi(int argc, const char *const *argv, const char *buff)
    16151615{
    16161616  char *lastrv = NULL, *newbuff;
     
    16471647
    16481648
    1649 char *owl_command_alias(int argc, char **argv, char *buff)
     1649char *owl_command_alias(int argc, const char *const *argv, const char *buff)
    16501650{
    16511651  if (argc < 3) {
     
    16591659
    16601660
    1661 char *owl_command_bindkey(int argc, char **argv, char *buff)
     1661char *owl_command_bindkey(int argc, const char *const *argv, const char *buff)
    16621662{
    16631663  owl_keymap *km;
     
    16881688}
    16891689
    1690 char *owl_command_debug(int argc, char **argv, char *buff)
     1690char *owl_command_debug(int argc, const char *const *argv, const char *buff)
    16911691{
    16921692  if (argc<2) {
     
    17041704}
    17051705
    1706 char *owl_command_term(int argc, char **argv, char *buff)
     1706char *owl_command_term(int argc, const char *const *argv, const char *buff)
    17071707{
    17081708  if (argc<2) {
     
    17211721}
    17221722
    1723 char *owl_command_zlog(int argc, char **argv, char *buff)
     1723char *owl_command_zlog(int argc, const char *const *argv, const char *buff)
    17241724{
    17251725  if ((argc<2) || (argc>3)) {
     
    17451745}
    17461746
    1747 char *owl_command_subscribe(int argc, char **argv, char *buff)
    1748 {
    1749   char *class, *instance, *recip="";
     1747char *owl_command_subscribe(int argc, const char *const *argv, const char *buff)
     1748{
     1749  const char *class, *instance, *recip="";
    17501750  int temp=0;
    17511751  int ret=0;
     
    17951795
    17961796
    1797 char *owl_command_unsubscribe(int argc, char **argv, char *buff)
    1798 {
    1799   char *class, *instance, *recip="";
     1797char *owl_command_unsubscribe(int argc, const char *const *argv, const char *buff)
     1798{
     1799  const char *class, *instance, *recip="";
    18001800  int temp=0;
    18011801
     
    18431843}
    18441844
    1845 char *owl_command_echo(int argc, char **argv, char *buff)
     1845char *owl_command_echo(int argc, const char *const *argv, const char *buff)
    18461846{
    18471847  buff = skiptokens(buff, 1);
     
    18601860}
    18611861
    1862 char *owl_command_zwrite(int argc, char **argv, char *buff)
     1862char *owl_command_zwrite(int argc, const char *const *argv, const char *buff)
    18631863{
    18641864  owl_zwrite z;
     
    18841884}
    18851885
    1886 char *owl_command_aimwrite(int argc, char **argv, char *buff)
    1887 {
    1888   char *newbuff, *recip, **myargv;
     1886char *owl_command_aimwrite(int argc, const char *const *argv, const char *buff)
     1887{
     1888  char *newbuff, *recip;
     1889  const char *const *myargv;
    18891890  int i, j, myargc;
    18901891  owl_message *m;
     
    19631964}
    19641965
    1965 char *owl_command_loopwrite(int argc, char **argv, char *buff)
     1966char *owl_command_loopwrite(int argc, const char *const *argv, const char *buff)
    19661967{
    19671968  owl_function_loopwrite_setup();
     
    19691970}
    19701971
    1971 char *owl_command_zcrypt(int argc, char **argv, char *buff)
     1972char *owl_command_zcrypt(int argc, const char *const *argv, const char *buff)
    19721973{
    19731974#ifdef OWL_ENABLE_ZCRYPT
     
    19971998}
    19981999
    1999 char *owl_command_reply(int argc, char **argv, char *buff)
     2000char *owl_command_reply(int argc, const char *const *argv, const char *buff)
    20002001{
    20012002  int edit=0;
     
    20122013    owl_function_reply(1, !edit);
    20132014  } else if (argc==2 && !strcmp(argv[1], "zaway")) {
    2014     owl_message *m;
    2015     owl_view    *v;
     2015    const owl_message *m;
     2016    const owl_view    *v;
    20162017    v = owl_global_get_current_view(&g);   
    20172018    m = owl_view_get_element(v, owl_global_get_curmsg(&g));
     
    20232024}
    20242025
    2025 char *owl_command_filter(int argc, char **argv, char *buff)
     2026char *owl_command_filter(int argc, const char *const *argv, const char *buff)
    20262027{
    20272028  owl_function_create_filter(argc, argv);
     
    20292030}
    20302031
    2031 char *owl_command_zlocate(int argc, char **argv, char *buff)
     2032char *owl_command_zlocate(int argc, const char *const *argv, const char *buff)
    20322033{
    20332034  int auth;
     
    20632064 * view --home
    20642065 */
    2065 char *owl_command_view(int argc, char **argv, char *buff)
     2066char *owl_command_view(int argc, const char *const *argv, const char *buff)
    20662067{
    20672068  /* First take the 'view --home' and 'view -r' cases */
     
    20872088  /* Now get 'view -d <expression>' */
    20882089  if (argc>=3 && !strcmp(argv[1], "-d")) {
    2089     char **myargv;
     2090    const char **myargv;
    20902091    int i;
    20912092
    2092     myargv=owl_malloc((argc*sizeof(char *))+50);
     2093    myargv=owl_malloc((argc*sizeof(const char *))+50);
    20932094    myargv[0]="";
    20942095    myargv[1]="owl-dynamic";
     
    21352136      argv++;
    21362137    } else if (!strcmp(argv[0], "-r")) {
    2137       char *foo;
     2138      const char *foo;
    21382139      foo=owl_function_create_negative_filter(owl_view_get_filtname(owl_global_get_current_view(&g)));
    21392140      owl_function_change_currentview_filter(foo);
     
    21552156}
    21562157
    2157 char *owl_command_show(int argc, char **argv, char *buff)
     2158char *owl_command_show(int argc, const char *const *argv, const char *buff)
    21582159{
    21592160  if (argc<2) {
     
    22122213    owl_function_show_quickstart();
    22132214  } else if (!strcmp(argv[1], "startup")) {
    2214     char *filename;
     2215    const char *filename;
    22152216   
    22162217    filename=owl_global_get_startupfile(&g);
     
    22252226}
    22262227
    2227 char *owl_command_viewclass(int argc, char **argv, char *buff)
     2228char *owl_command_viewclass(int argc, const char *const *argv, const char *buff)
    22282229{
    22292230  char *filtname;
     
    22382239}
    22392240
    2240 char *owl_command_viewuser(int argc, char **argv, char *buff)
     2241char *owl_command_viewuser(int argc, const char *const *argv, const char *buff)
    22412242{
    22422243  char *filtname;
     
    22572258}
    22582259
    2259 char *owl_command_delete(int argc, char **argv, char *buff)
     2260char *owl_command_delete(int argc, const char *const *argv, const char *buff)
    22602261{
    22612262  int move_after = 1;
     
    22912292}
    22922293
    2293 char *owl_command_undelete(int argc, char **argv, char *buff)
     2294char *owl_command_undelete(int argc, const char *const *argv, const char *buff)
    22942295{
    22952296  int move_after = 1;
     
    23252326}
    23262327
    2327 char *owl_command_colorview(int argc, char **argv, char *buff)
     2328char *owl_command_colorview(int argc, const char *const *argv, const char *buff)
    23282329{
    23292330  if (argc < 2 || argc > 3) {
     
    23352336}
    23362337
    2337 char *owl_command_colorclass(int argc, char **argv, char *buff)
    2338 {
    2339   char *filtname;
     2338char *owl_command_colorclass(int argc, const char *const *argv, const char *buff)
     2339{
     2340  const char *filtname;
    23402341 
    23412342  if (argc < 3 || argc > 4) {
     
    23492350}
    23502351
    2351 char *owl_command_zpunt(int argc, char **argv, char *buff)
     2352char *owl_command_zpunt(int argc, const char *const *argv, const char *buff)
    23522353{
    23532354  owl_command_zpunt_and_zunpunt(argc, argv, 0);
     
    23552356}
    23562357
    2357 char *owl_command_zunpunt(int argc, char **argv, char *buff)
     2358char *owl_command_zunpunt(int argc, const char *const *argv, const char *buff)
    23582359{
    23592360  owl_command_zpunt_and_zunpunt(argc, argv, 1);
     
    23612362}
    23622363
    2363 void owl_command_zpunt_and_zunpunt(int argc, char **argv, int type)
     2364void owl_command_zpunt_and_zunpunt(int argc, const char *const *argv, int type)
    23642365{
    23652366  /* if type==0 then zpunt
    23662367   * if type==1 then zunpunt
    23672368   */
    2368   char *class, *inst, *recip;
     2369  const char *class, *inst, *recip;
    23692370
    23702371  class="message";
     
    23982399}
    23992400
    2400 char *owl_command_smartzpunt(int argc, char **argv, char *buff)
     2401char *owl_command_smartzpunt(int argc, const char *const *argv, const char *buff)
    24012402{
    24022403  if (argc == 1) {
     
    24102411}
    24112412
    2412 char *owl_command_punt(int argc, char **argv, char *buff)
     2413char *owl_command_punt(int argc, const char *const *argv, const char *buff)
    24132414{
    24142415  owl_command_punt_unpunt(argc, argv, buff, 0);
     
    24162417}
    24172418
    2418 char *owl_command_unpunt(int argc, char **argv, char *buff)
     2419char *owl_command_unpunt(int argc, const char *const *argv, const char *buff)
    24192420{
    24202421  owl_command_punt_unpunt(argc, argv, buff, 1);
     
    24222423}
    24232424
    2424 void owl_command_punt_unpunt(int argc, char ** argv, char *buff, int unpunt)
     2425void owl_command_punt_unpunt(int argc, const char *const * argv, const char *buff, int unpunt)
    24252426{
    24262427  owl_list * fl;
     
    24562457
    24572458
    2458 char *owl_command_getview(int argc, char **argv, char *buff)
    2459 {
    2460   char *filtname;
     2459char *owl_command_getview(int argc, const char *const *argv, const char *buff)
     2460{
     2461  const char *filtname;
    24612462  if (argc != 1) {
    24622463    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
     
    24642465  }
    24652466  filtname = owl_view_get_filtname(owl_global_get_current_view(&g));
    2466   if (filtname) filtname = owl_strdup(filtname);
    2467   return filtname;
    2468 }
    2469 
    2470 char *owl_command_getvar(int argc, char **argv, char *buff)
     2467  if (filtname) return owl_strdup(filtname);
     2468  return NULL;
     2469}
     2470
     2471char *owl_command_getvar(int argc, const char *const *argv, const char *buff)
    24712472{
    24722473  char tmpbuff[1024];
     
    24822483}
    24832484
    2484 char *owl_command_getfilter(int argc, char **argv, char *buf)
    2485 {
    2486   owl_filter *f;
     2485char *owl_command_getfilter(int argc, const char *const *argv, const char *buf)
     2486{
     2487  const owl_filter *f;
    24872488  if (argc != 2) {
    24882489    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
     
    24962497}
    24972498
    2498 char *owl_command_search(int argc, char **argv, char *buff)
     2499char *owl_command_search(int argc, const char *const *argv, const char *buff)
    24992500{
    25002501  int direction;
    2501   char *buffstart;
     2502  const char *buffstart;
    25022503
    25032504  direction=OWL_DIRECTION_DOWNWARDS;
     
    25172518}
    25182519
    2519 char *owl_command_setsearch(int argc, char **argv, char *buff)
    2520 {
    2521   char *buffstart;
     2520char *owl_command_setsearch(int argc, const char *const *argv, const char *buff)
     2521{
     2522  const char *buffstart;
    25222523
    25232524  buffstart=skiptokens(buff, 1);
     
    25272528}
    25282529
    2529 char *owl_command_aimlogin(int argc, char **argv, char *buff)
     2530char *owl_command_aimlogin(int argc, const char *const *argv, const char *buff)
    25302531{
    25312532  if ((argc<2) || (argc>3)) {
     
    25482549}
    25492550
    2550 char *owl_command_aimlogout(int argc, char **argv, char *buff)
     2551char *owl_command_aimlogout(int argc, const char *const *argv, const char *buff)
    25512552{
    25522553  /* clear the buddylist */
     
    25572558}
    25582559
    2559 char *owl_command_getstyle(int argc, char **argv, char *buff)
    2560 {
    2561   char *stylename;
     2560char *owl_command_getstyle(int argc, const char *const *argv, const char *buff)
     2561{
     2562  const char *stylename;
    25622563  if (argc != 1) {
    25632564    owl_function_makemsg("Wrong number of arguments for %s", argv[0]);
     
    25652566  }
    25662567  stylename = owl_view_get_style_name(owl_global_get_current_view(&g));
    2567   if (stylename) stylename = owl_strdup(stylename);
    2568   return stylename;
    2569 }
    2570 
    2571 char *owl_command_error(int argc, char **argv, char *buff)
     2568  if (stylename) return owl_strdup(stylename);
     2569  return NULL;
     2570}
     2571
     2572char *owl_command_error(int argc, const char *const *argv, const char *buff)
    25722573{
    25732574    buff = skiptokens(buff, 1);
     
    25762577}
    25772578
    2578 char *owl_command_message(int argc, char **argv, char *buff)
     2579char *owl_command_message(int argc, const char *const *argv, const char *buff)
    25792580{
    25802581    buff = skiptokens(buff, 1);
     
    25862587{
    25872588  owl_message *m;
    2588   owl_view *v;
    2589   char *cmd;
     2589  const owl_view *v;
     2590  const char *cmd;
    25902591
    25912592  v = owl_global_get_current_view(&g);
     
    26202621{
    26212622  owl_message *m;
    2622   owl_view *v;
    2623   char *cmd;
     2623  const owl_view *v;
     2624  const char *cmd;
    26242625
    26252626  v = owl_global_get_current_view(&g);
     
    26792680{
    26802681  owl_history *hist;
    2681   char *ptr;
     2682  const char *ptr;
    26822683
    26832684  hist=owl_editwin_get_history(e);
     
    27002701{
    27012702  owl_history *hist;
    2702   char *ptr;
     2703  const char *ptr;
    27032704
    27042705  hist=owl_editwin_get_history(e);
     
    27142715}
    27152716
    2716 char *owl_command_edit_insert_text(owl_editwin *e, int argc, char **argv, char *buff)
     2717char *owl_command_edit_insert_text(owl_editwin *e, int argc, const char *const *argv, const char *buff)
    27172718{
    27182719  buff = skiptokens(buff, 1);
  • context.c

    r4d86e06 r3f8514b  
    1414
    1515/* returns whether test matches the current context */
    16 int owl_context_matches(owl_context *ctx, int test)
     16int owl_context_matches(const owl_context *ctx, int test)
    1717{
    1818  /*owl_function_debugmsg(", current: 0x%04x test: 0x%04x\n", ctx->mode, test);*/
     
    2828}
    2929
    30 void *owl_context_get_data(owl_context *ctx)
     30void *owl_context_get_data(const owl_context *ctx)
    3131{
    3232  return ctx->data;
    3333}
    3434
    35 int owl_context_get_mode(owl_context *ctx)
     35int owl_context_get_mode(const owl_context *ctx)
    3636{
    3737  return ctx->mode & OWL_CTX_MODE_BITS;
    3838}
    3939
    40 int owl_context_get_active(owl_context *ctx)
     40int owl_context_get_active(const owl_context *ctx)
    4141{
    4242  return ctx->mode & OWL_CTX_ACTIVE_BITS;
    4343}
    4444
    45 int owl_context_is_startup(owl_context *ctx)
     45int owl_context_is_startup(const owl_context *ctx)
    4646{
    4747  return (ctx->mode & OWL_CTX_STARTUP)?1:0;
    4848}
    4949
    50 int owl_context_is_interactive(owl_context *ctx)
     50int owl_context_is_interactive(const owl_context *ctx)
    5151{
    5252  return(ctx->mode & OWL_CTX_INTERACTIVE)?1:0;
  • dict.c

    r2b37be2 r636b137  
    2424}
    2525
    26 int owl_dict_get_size(owl_dict *d) {
     26int owl_dict_get_size(const owl_dict *d) {
    2727  return(d->size);
    2828}
     
    3131 * this element would logically go, and stores the index in pos.
    3232 * Returns 1 if found, else 0. */
    33 int _owl_dict_find_pos(owl_dict *d, char *k, int *pos) {
     33int _owl_dict_find_pos(const owl_dict *d, const char *k, int *pos) {
    3434  int lo = 0, hi = d->size;
    3535  while (lo < hi) {
     
    5050
    5151/* returns the value corresponding to key k */
    52 void *owl_dict_find_element(owl_dict *d, char *k) {
     52void *owl_dict_find_element(const owl_dict *d, const char *k) {
    5353  int found, pos;
    5454  found = _owl_dict_find_pos(d, k, &pos);
     
    6161/* creates a list and fills it in with keys.  duplicates the keys,
    6262 * so they will need to be freed by the caller. */
    63 int owl_dict_get_keys(owl_dict *d, owl_list *l) {
     63int owl_dict_get_keys(const owl_dict *d, owl_list *l) {
    6464  int i;
    6565  char *dupk;
     
    8282   Will return -2 if replace=NULL and match was found.
    8383*/
    84 int owl_dict_insert_element(owl_dict *d, char *k, void *v, void (*free_on_replace)(void *old)) {
     84int owl_dict_insert_element(owl_dict *d, const char *k, void *v, void (*free_on_replace)(void *old)) {
    8585  int pos, found;
    8686  char *dupk;
     
    113113/* Doesn't free the value of the element, but does
    114114 * return it so the caller can free it. */
    115 void *owl_dict_remove_element(owl_dict *d, char *k) {
     115void *owl_dict_remove_element(owl_dict *d, const char *k) {
    116116  int i;
    117117  int pos, found;
  • editwin.c

    r0509efc re19eb97  
    4545static void oe_restore_excursion(owl_editwin *e, oe_excursion *x);
    4646static void oe_restore_mark_only(owl_editwin *e, oe_excursion *x);
    47 static int oe_count_glyphs(char *s);
     47static int oe_count_glyphs(const char *s);
    4848static int oe_char_width(gunichar c, int column);
    4949static int oe_region_width(owl_editwin *e, int start, int end, int width);
     
    5252static int owl_editwin_limit_maxcols(int v, int maxv);
    5353static int owl_editwin_check_dotsend(owl_editwin *e);
    54 static int owl_editwin_is_char_in(owl_editwin *e, char *set);
     54static int owl_editwin_is_char_in(owl_editwin *e, const char *set);
    5555static gunichar owl_editwin_get_char_at_point(owl_editwin *e);
    56 static int owl_editwin_replace_internal(owl_editwin *e, int replace, char *s);
    57 static char *oe_copy_buf(owl_editwin *e, char *buf, int len);
     56static int owl_editwin_replace_internal(owl_editwin *e, int replace, const char *s);
     57static const char *oe_copy_buf(owl_editwin *e, const char *buf, int len);
    5858static int oe_copy_region(owl_editwin *e);
    5959static char *oe_chunk(owl_editwin *e, int start, int end);
     
    7171}
    7272
    73 static int oe_count_glyphs(char *s)
     73static int oe_count_glyphs(const char *s)
    7474{
    7575  int count = 0;
    76   char *p;
     76  const char *p;
    7777
    7878  for(p = s; *p != 0; p = g_utf8_find_next_char(p, NULL))
     
    175175}
    176176
    177 void owl_editwin_set_command(owl_editwin *e, char *command)
     177void owl_editwin_set_command(owl_editwin *e, const char *command)
    178178{
    179179  if(e->command) owl_free(e->command);
     
    181181}
    182182
    183 char *owl_editwin_get_command(owl_editwin *e)
     183const char *owl_editwin_get_command(owl_editwin *e)
    184184{
    185185  if(e->command) return e->command;
     
    230230 * previous text (including locked text) will be overwritten
    231231 */
    232 void owl_editwin_set_locktext(owl_editwin *e, char *text)
     232void owl_editwin_set_locktext(owl_editwin *e, const char *text)
    233233{
    234234  oe_set_index(e, 0);
     
    378378}
    379379
    380 static inline char *oe_next_point(owl_editwin *e, char *p)
    381 {
    382   char *boundary = e->buff + e->bufflen + 1;
    383   char *q;
     380static inline const char *oe_next_point(owl_editwin *e, const char *p)
     381{
     382  const char *boundary = e->buff + e->bufflen + 1;
     383  const char *q;
    384384
    385385  q = g_utf8_find_next_char(p, boundary);
     
    392392}
    393393
    394 static inline char *oe_prev_point(owl_editwin *e, char *p)
    395 {
    396   char *boundary = e->buff + e->lock;
     394static inline const char *oe_prev_point(owl_editwin *e, const char *p)
     395{
     396  const char *boundary = e->buff + e->lock;
    397397
    398398  p = g_utf8_find_prev_char(boundary, p);
     
    422422  int width = 0, cw;
    423423  gunichar c;
    424   char *p;
     424  const char *p;
    425425
    426426  while(1) {
     
    576576}
    577577
    578 int owl_editwin_replace_region(owl_editwin *e, char *s)
     578int owl_editwin_replace_region(owl_editwin *e, const char *s)
    579579{
    580580  oe_excursion x;
     
    594594
    595595/* replace 'replace' characters at the point with s, returning the change in size */
    596 int owl_editwin_replace(owl_editwin *e, int replace, char *s)
     596int owl_editwin_replace(owl_editwin *e, int replace, const char *s)
    597597{
    598598  int start, end, i;
    599   char *p;
     599  const char *p;
    600600
    601601  if (!g_utf8_validate(s, -1, NULL)) {
     
    615615}
    616616
    617 static int owl_editwin_replace_internal(owl_editwin *e, int replace, char *s)
     617static int owl_editwin_replace_internal(owl_editwin *e, int replace, const char *s)
    618618{
    619619  int start, end, free, need, size, change;
     
    694694void owl_editwin_transpose_chars(owl_editwin *e)
    695695{
    696   char *middle, *end, *start, *tmp;
     696  const char *middle, *end, *start;
     697  char *tmp;
    697698
    698699  if (e->bufflen == 0) return;
     
    727728 * right
    728729 */
    729 void owl_editwin_insert_string(owl_editwin *e, char *s)
     730void owl_editwin_insert_string(owl_editwin *e, const char *s)
    730731{
    731732  owl_editwin_replace(e, 0, s);
     
    750751int owl_editwin_point_move(owl_editwin *e, int delta)
    751752{
    752   char *p;
     753  const char *p;
    753754  int change, d = 0;
    754755
     
    800801}
    801802
    802 static int owl_editwin_is_char_in(owl_editwin *e, char *set)
    803 {
    804   char *p;
     803static int owl_editwin_is_char_in(owl_editwin *e, const char *set)
     804{
     805  const char *p;
    805806
    806807  for (p = set; *p != 0; p = g_utf8_find_next_char(p, NULL))
     
    810811}
    811812
    812 int owl_editwin_move_if_in(owl_editwin *e, int delta, char *set)
     813int owl_editwin_move_if_in(owl_editwin *e, int delta, const char *set)
    813814{
    814815  int change, distance = 0;
     
    822823}
    823824
    824 int owl_editwin_move_if_not_in(owl_editwin *e, int delta, char *set)
     825int owl_editwin_move_if_not_in(owl_editwin *e, int delta, const char *set)
    825826{
    826827  int change, distance = 0;
     
    10291030}
    10301031
    1031 static char *oe_copy_buf(owl_editwin *e, char *buf, int len)
     1032static const char *oe_copy_buf(owl_editwin *e, const char *buf, int len)
    10321033{
    10331034  char *p;
     
    10471048static int oe_copy_region(owl_editwin *e)
    10481049{
    1049   char *p;
     1050  const char *p;
    10501051  int start, end;
    10511052
     
    12361237static int oe_region_width(owl_editwin *e, int start, int end, int offset)
    12371238{
    1238   char *p;
     1239  const char *p;
    12391240  int width = offset;
    12401241 
     
    13161317}
    13171318
    1318 char *owl_editwin_get_text(owl_editwin *e)
     1319const char *owl_editwin_get_text(owl_editwin *e)
    13191320{
    13201321  return(e->buff+e->lock);
  • errqueue.c

    rec6ff52 r5b256de  
    66}
    77
    8 void owl_errqueue_append_err(owl_errqueue *eq, char *msg)
     8void owl_errqueue_append_err(owl_errqueue *eq, const char *msg)
    99{
    1010  owl_list_append_element(&(eq->errlist), owl_strdup(msg));
     
    1212
    1313/* fmtext should already be initialized */
    14 void owl_errqueue_to_fmtext(owl_errqueue *eq, owl_fmtext *fm)
     14void owl_errqueue_to_fmtext(const owl_errqueue *eq, owl_fmtext *fm)
    1515{
    1616  int i, j;
  • filter.c

    rd43edd2 r4542047  
    22#include "owl.h"
    33
    4 int owl_filter_init_fromstring(owl_filter *f, char *name, char *string)
     4int owl_filter_init_fromstring(owl_filter *f, const char *name, const char *string)
    55{
    66  char **argv;
     
    88
    99  argv=owl_parseline(string, &argc);
    10   out=owl_filter_init(f, name, argc, argv);
     10  out=owl_filter_init(f, name, argc, strs(argv));
    1111  owl_parsefree(argv, argc);
    1212  return(out);
    1313}
    1414
    15 int owl_filter_init(owl_filter *f, char *name, int argc, char **argv)
     15int owl_filter_init(owl_filter *f, const char *name, int argc, const char *const *argv)
    1616{
    1717  f->name=owl_strdup(name);
     
    5656/* A primitive expression is one without any toplevel ``and'' or ``or''s*/
    5757
    58 static owl_filterelement * owl_filter_parse_primitive_expression(int argc, char **argv, int *next)
     58static owl_filterelement * owl_filter_parse_primitive_expression(int argc, const char *const *argv, int *next)
    5959{
    6060  owl_filterelement *fe, *op;
     
    112112}
    113113
    114 owl_filterelement * owl_filter_parse_expression(int argc, char **argv, int *next)
     114owl_filterelement * owl_filter_parse_expression(int argc, const char *const *argv, int *next)
    115115{
    116116  int i = 0, skip;
     
    151151}
    152152
    153 char *owl_filter_get_name(owl_filter *f)
     153const char *owl_filter_get_name(const owl_filter *f)
    154154{
    155155  return(f->name);
     
    161161}
    162162
    163 int owl_filter_get_fgcolor(owl_filter *f)
     163int owl_filter_get_fgcolor(const owl_filter *f)
    164164{
    165165  return(f->fgcolor);
     
    171171}
    172172
    173 int owl_filter_get_bgcolor(owl_filter *f)
     173int owl_filter_get_bgcolor(const owl_filter *f)
    174174{
    175175  return(f->bgcolor);
     
    181181}
    182182
    183 int owl_filter_get_cachedmsgid(owl_filter *f)
     183int owl_filter_get_cachedmsgid(const owl_filter *f)
    184184{
    185185  return(f->cachedmsgid);
     
    189189 * return 0.
    190190 */
    191 int owl_filter_message_match(owl_filter *f, owl_message *m)
     191int owl_filter_message_match(const owl_filter *f, const owl_message *m)
    192192{
    193193  int ret;
     
    198198
    199199
    200 char* owl_filter_print(owl_filter *f)
     200char* owl_filter_print(const owl_filter *f)
    201201{
    202202  GString *out = g_string_new("");
     
    231231
    232232/* Return 1 if the filters 'a' and 'b' are equivalent, 0 otherwise */
    233 int owl_filter_equiv(owl_filter *a, owl_filter *b)
     233int owl_filter_equiv(const owl_filter *a, const owl_filter *b)
    234234{
    235235  char *buffa, *buffb;
     
    250250
    251251
    252 int owl_filter_is_toodeep(owl_filter *f)
     252int owl_filter_is_toodeep(const owl_filter *f)
    253253{
    254254  return owl_filterelement_is_toodeep(f, f->root);
     
    270270#ifdef OWL_INCLUDE_REG_TESTS
    271271
    272 int owl_filter_test_string(char * filt, owl_message *m, int shouldmatch) /* noproto */ {
     272int owl_filter_test_string(const char * filt, const owl_message *m, int shouldmatch) /* noproto */ {
    273273  owl_filter f;
    274274  int ok;
  • filterelement.c

    r41c9a96 r4542047  
    11#include "owl.h"
    22
    3 static char * owl_filterelement_get_field(owl_message *m, char * field)
    4 {
    5   char *match;
     3static const char * owl_filterelement_get_field(const owl_message *m, const char * field)
     4{
     5  const char *match;
    66  if (!strcasecmp(field, "class")) {
    77    match=owl_message_get_class(m);
     
    4848}
    4949
    50 static int owl_filterelement_match_false(owl_filterelement *fe, owl_message *m)
     50static int owl_filterelement_match_false(const owl_filterelement *fe, const owl_message *m)
    5151{
    5252  return 0;
    5353}
    5454
    55 static int owl_filterelement_match_true(owl_filterelement *fe, owl_message *m)
     55static int owl_filterelement_match_true(const owl_filterelement *fe, const owl_message *m)
    5656{
    5757  return 1;
    5858}
    5959
    60 static int owl_filterelement_match_re(owl_filterelement *fe, owl_message *m)
    61 {
    62   char * val = owl_filterelement_get_field(m, fe->field);
     60static int owl_filterelement_match_re(const owl_filterelement *fe, const owl_message *m)
     61{
     62  const char * val = owl_filterelement_get_field(m, fe->field);
    6363  return !owl_regex_compare(&(fe->re), val, NULL, NULL);
    6464}
    6565
    66 static int owl_filterelement_match_filter(owl_filterelement *fe, owl_message *m)
    67 {
    68   owl_filter *subfilter;
     66static int owl_filterelement_match_filter(const owl_filterelement *fe, const owl_message *m)
     67{
     68  const owl_filter *subfilter;
    6969  subfilter=owl_global_get_filter(&g, fe->field);
    7070  if (!subfilter) {
     
    7777}
    7878
    79 static int owl_filterelement_match_perl(owl_filterelement *fe, owl_message *m)
    80 {
    81   char *subname, *perlrv;
     79static int owl_filterelement_match_perl(const owl_filterelement *fe, const owl_message *m)
     80{
     81  const char *subname;
     82  char *perlrv;
    8283  int   tf=0;
    8384
     
    9697}
    9798
    98 static int owl_filterelement_match_group(owl_filterelement *fe, owl_message *m)
     99static int owl_filterelement_match_group(const owl_filterelement *fe, const owl_message *m)
    99100{
    100101  return owl_filterelement_match(fe->left, m);
     
    105106*/
    106107
    107 static int owl_filterelement_match_and(owl_filterelement *fe, owl_message *m)
     108static int owl_filterelement_match_and(const owl_filterelement *fe, const owl_message *m)
    108109{
    109110  return owl_filterelement_match(fe->left, m) &&
     
    111112}
    112113
    113 static int owl_filterelement_match_or(owl_filterelement *fe, owl_message *m)
     114static int owl_filterelement_match_or(const owl_filterelement *fe, const owl_message *m)
    114115{
    115116  return owl_filterelement_match(fe->left, m) ||
     
    117118}
    118119
    119 static int owl_filterelement_match_not(owl_filterelement *fe, owl_message *m)
     120static int owl_filterelement_match_not(const owl_filterelement *fe, const owl_message *m)
    120121{
    121122  return !owl_filterelement_match(fe->left, m);
     
    124125/* Print methods */
    125126
    126 static void owl_filterelement_print_true(owl_filterelement *fe, GString *buf)
     127static void owl_filterelement_print_true(const owl_filterelement *fe, GString *buf)
    127128{
    128129  g_string_append(buf, "true");
    129130}
    130131
    131 static void owl_filterelement_print_false(owl_filterelement *fe, GString *buf)
     132static void owl_filterelement_print_false(const owl_filterelement *fe, GString *buf)
    132133{
    133134  g_string_append(buf, "false");
    134135}
    135136
    136 static void owl_filterelement_print_re(owl_filterelement *fe, GString *buf)
    137 {
    138   char *re, *q;
     137static void owl_filterelement_print_re(const owl_filterelement *fe, GString *buf)
     138{
     139  const char *re, *q;
    139140  g_string_append(buf, fe->field);
    140141  g_string_append(buf, " ");
     
    147148}
    148149
    149 static void owl_filterelement_print_filter(owl_filterelement *fe, GString *buf)
     150static void owl_filterelement_print_filter(const owl_filterelement *fe, GString *buf)
    150151{
    151152  g_string_append(buf, "filter ");
     
    153154}
    154155
    155 static void owl_filterelement_print_perl(owl_filterelement *fe, GString *buf)
     156static void owl_filterelement_print_perl(const owl_filterelement *fe, GString *buf)
    156157{
    157158  g_string_append(buf, "perl ");
     
    159160}
    160161
    161 static void owl_filterelement_print_group(owl_filterelement *fe, GString *buf)
     162static void owl_filterelement_print_group(const owl_filterelement *fe, GString *buf)
    162163{
    163164  g_string_append(buf, "( ");
     
    166167}
    167168
    168 static void owl_filterelement_print_or(owl_filterelement *fe, GString *buf)
     169static void owl_filterelement_print_or(const owl_filterelement *fe, GString *buf)
    169170{
    170171  owl_filterelement_print(fe->left, buf);
     
    173174}
    174175
    175 static void owl_filterelement_print_and(owl_filterelement *fe, GString *buf)
     176static void owl_filterelement_print_and(const owl_filterelement *fe, GString *buf)
    176177{
    177178  owl_filterelement_print(fe->left, buf);
     
    180181}
    181182
    182 static void owl_filterelement_print_not(owl_filterelement *fe, GString *buf)
     183static void owl_filterelement_print_not(const owl_filterelement *fe, GString *buf)
    183184{
    184185  g_string_append(buf, " not ");
     
    211212}
    212213
    213 int owl_filterelement_create_re(owl_filterelement *fe, char *field, char *re)
     214int owl_filterelement_create_re(owl_filterelement *fe, const char *field, const char *re)
    214215{
    215216  owl_filterelement_create(fe);
     
    225226}
    226227
    227 void owl_filterelement_create_filter(owl_filterelement *fe, char *name)
     228void owl_filterelement_create_filter(owl_filterelement *fe, const char *name)
    228229{
    229230  owl_filterelement_create(fe);
     
    233234}
    234235
    235 void owl_filterelement_create_perl(owl_filterelement *fe, char *name)
     236void owl_filterelement_create_perl(owl_filterelement *fe, const char *name)
    236237{
    237238  owl_filterelement_create(fe);
     
    275276}
    276277
    277 int owl_filterelement_match(owl_filterelement *fe, owl_message *m)
     278int owl_filterelement_match(const owl_filterelement *fe, const owl_message *m)
    278279{
    279280  if(!fe) return 0;
     
    285286static int fe_visited  = 1;
    286287
    287 int owl_filterelement_is_toodeep(owl_filter *f, owl_filterelement *fe)
     288int owl_filterelement_is_toodeep(const owl_filter *f, const owl_filterelement *fe)
    288289{
    289290  int rv;
     
    299300}
    300301
    301 int _owl_filterelement_is_toodeep(owl_filterelement *fe, owl_dict *seen)
     302int _owl_filterelement_is_toodeep(const owl_filterelement *fe, owl_dict *seen)
    302303{
    303304  int rv = 0;
    304   owl_filter *f;
     305  const owl_filter *f;
    305306
    306307  if(fe->match_message == owl_filterelement_match_filter) {
     
    337338}
    338339
    339 void owl_filterelement_print(owl_filterelement *fe, GString *buf)
     340void owl_filterelement_print(const owl_filterelement *fe, GString *buf)
    340341{
    341342  if(!fe || !fe->print_elt) return;
  • fmtext.c

    r41c9a96 r89b2daf  
    4343 * 'color'
    4444 */
    45 void owl_fmtext_append_attr(owl_fmtext *f, char *text, char attr, short fgcolor, short bgcolor)
     45void owl_fmtext_append_attr(owl_fmtext *f, const char *text, char attr, short fgcolor, short bgcolor)
    4646{
    4747  char attrbuff[6];
     
    8383
    8484/* Append normal, uncolored text 'text' to 'f' */
    85 void owl_fmtext_append_normal(owl_fmtext *f, char *text)
     85void owl_fmtext_append_normal(owl_fmtext *f, const char *text)
    8686{
    8787  owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_NONE, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT);
     
    8989
    9090/* Append normal, uncolored text specified by format string to 'f' */
    91 void owl_fmtext_appendf_normal(owl_fmtext *f, char *fmt, ...)
     91void owl_fmtext_appendf_normal(owl_fmtext *f, const char *fmt, ...)
    9292{
    9393  va_list ap;
     
    103103
    104104/* Append normal text 'text' to 'f' with color 'color' */
    105 void owl_fmtext_append_normal_color(owl_fmtext *f, char *text, int fgcolor, int bgcolor)
     105void owl_fmtext_append_normal_color(owl_fmtext *f, const char *text, int fgcolor, int bgcolor)
    106106{
    107107  owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_NONE, fgcolor, bgcolor);
     
    109109
    110110/* Append bold text 'text' to 'f' */
    111 void owl_fmtext_append_bold(owl_fmtext *f, char *text)
     111void owl_fmtext_append_bold(owl_fmtext *f, const char *text)
    112112{
    113113  owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_BOLD, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT);
     
    115115
    116116/* Append reverse video text 'text' to 'f' */
    117 void owl_fmtext_append_reverse(owl_fmtext *f, char *text)
     117void owl_fmtext_append_reverse(owl_fmtext *f, const char *text)
    118118{
    119119  owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_REVERSE, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT);
     
    121121
    122122/* Append reversed and bold, uncolored text 'text' to 'f' */
    123 void owl_fmtext_append_reversebold(owl_fmtext *f, char *text)
     123void owl_fmtext_append_reversebold(owl_fmtext *f, const char *text)
    124124{
    125125  owl_fmtext_append_attr(f, text, OWL_FMTEXT_ATTR_REVERSE | OWL_FMTEXT_ATTR_BOLD, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT);
     
    170170
    171171/* Internal function. Scan for attribute characters. */
    172 void _owl_fmtext_scan_attributes(owl_fmtext *f, int start, char *attr, short *fgcolor, short *bgcolor) /*noproto*/
    173 {
    174   char *p;
     172void _owl_fmtext_scan_attributes(const owl_fmtext *f, int start, char *attr, short *fgcolor, short *bgcolor) /*noproto*/
     173{
     174  const char *p;
    175175  p = strchr(f->textbuff, OWL_FMTEXT_UC_STARTBYTE_UTF8);
    176176  while (p && p < f->textbuff + start) {
     
    184184 * bytes.
    185185 */
    186 void _owl_fmtext_append_fmtext(owl_fmtext *f, owl_fmtext *in, int start, int stop) /*noproto*/
     186void _owl_fmtext_append_fmtext(owl_fmtext *f, const owl_fmtext *in, int start, int stop) /*noproto*/
    187187{
    188188  char attrbuff[6];
     
    230230
    231231/* append fmtext 'in' to 'f' */
    232 void owl_fmtext_append_fmtext(owl_fmtext *f, owl_fmtext *in)
     232void owl_fmtext_append_fmtext(owl_fmtext *f, const owl_fmtext *in)
    233233{
    234234  _owl_fmtext_append_fmtext(f, in, 0, in->textlen);
     
    248248 * freeing the return
    249249 */
    250 char *owl_fmtext_print_plain(owl_fmtext *f)
     250char *owl_fmtext_print_plain(const owl_fmtext *f)
    251251{
    252252  return owl_strip_format_chars(f->textbuff);
     
    278278 * must already be initiatlized with curses
    279279 */
    280 void _owl_fmtext_curs_waddstr(owl_fmtext *f, WINDOW *w, int do_search) /*noproto*/
     280void _owl_fmtext_curs_waddstr(const owl_fmtext *f, WINDOW *w, int do_search) /*noproto*/
    281281{
    282282  /* char *tmpbuff; */
     
    367367}
    368368
    369 void owl_fmtext_curs_waddstr(owl_fmtext *f, WINDOW *w)
     369void owl_fmtext_curs_waddstr(const owl_fmtext *f, WINDOW *w)
    370370{
    371371  _owl_fmtext_curs_waddstr(f, w, owl_global_is_search_active(&g));
    372372}
    373373
    374 void owl_fmtext_curs_waddstr_without_search(owl_fmtext *f, WINDOW *w)
     374void owl_fmtext_curs_waddstr_without_search(const owl_fmtext *f, WINDOW *w)
    375375{
    376376  _owl_fmtext_curs_waddstr(f, w, 0);
     
    380380 * 'lines' number of lines into 'out'
    381381 */
    382 int owl_fmtext_truncate_lines(owl_fmtext *in, int aline, int lines, owl_fmtext *out)
    383 {
    384   char *ptr1, *ptr2;
     382int owl_fmtext_truncate_lines(const owl_fmtext *in, int aline, int lines, owl_fmtext *out)
     383{
     384  const char *ptr1, *ptr2;
    385385  int i, offset;
    386386 
     
    424424 * character and stop there.
    425425 */
    426 void owl_fmtext_truncate_cols(owl_fmtext *in, int acol, int bcol, owl_fmtext *out)
    427 {
    428   char *ptr_s, *ptr_e, *ptr_c, *last;
     426void owl_fmtext_truncate_cols(const owl_fmtext *in, int acol, int bcol, owl_fmtext *out)
     427{
     428  const char *ptr_s, *ptr_e, *ptr_c, *last;
    429429  int col, st, padding, chwidth;
    430430
     
    500500
    501501/* Return the number of lines in 'f' */
    502 int owl_fmtext_num_lines(owl_fmtext *f)
     502int owl_fmtext_num_lines(const owl_fmtext *f)
    503503{
    504504  int lines, i;
     
    517517}
    518518
    519 char *owl_fmtext_get_text(owl_fmtext *f)
     519const char *owl_fmtext_get_text(const owl_fmtext *f)
    520520{
    521521  return(f->textbuff);
     
    534534
    535535/* Make a copy of the fmtext 'src' into 'dst' */
    536 void owl_fmtext_copy(owl_fmtext *dst, owl_fmtext *src)
     536void owl_fmtext_copy(owl_fmtext *dst, const owl_fmtext *src)
    537537{
    538538  int mallocsize;
     
    555555 *  insensitive search.
    556556 */
    557 int owl_fmtext_search(owl_fmtext *f, owl_regex *re)
     557int owl_fmtext_search(const owl_fmtext *f, const owl_regex *re)
    558558{
    559559  if (owl_regex_compare(re, f->textbuff, NULL, NULL) == 0) return(1);
     
    565565 * formatting syntax to set appropriate attributes.
    566566 */
    567 void owl_fmtext_append_ztext(owl_fmtext *f, char *text)
     567void owl_fmtext_append_ztext(owl_fmtext *f, const char *text)
    568568{
    569569  int stacksize, curattrs, curcolor;
    570   char *ptr, *txtptr, *buff, *tmpptr;
     570  const char *ptr, *txtptr, *tmpptr;
     571  char *buff;
    571572  int attrstack[32], chrstack[32], colorstack[32];
    572573
     
    769770 * If format_fn is specified, passes it the list element value
    770771 * and it will return a string which this needs to free. */
    771 void owl_fmtext_append_list(owl_fmtext *f, owl_list *l, char *join_with, char *(format_fn)(char *))
     772void owl_fmtext_append_list(owl_fmtext *f, const owl_list *l, const char *join_with, char *(format_fn)(const char *))
    772773{
    773774  int i, size;
    774   char *elem;
     775  const char *elem;
    775776  char *text;
    776777
  • functions.c

    rfea7992 r35b3518  
    1313#include "owl.h"
    1414
    15 char *owl_function_command(char *cmdbuff)
     15char *owl_function_command(const char *cmdbuff)
    1616{
    1717  owl_function_debugmsg("executing command: %s", cmdbuff);
     
    2020}
    2121
    22 char *owl_function_command_argv(char **argv, int argc)
     22char *owl_function_command_argv(const char *const *argv, int argc)
    2323{
    2424  return owl_cmddict_execute_argv(owl_global_get_cmddict(&g),
     
    2727}
    2828
    29 void owl_function_command_norv(char *cmdbuff)
     29void owl_function_command_norv(const char *cmdbuff)
    3030{
    3131  char *rv;
     
    3434}
    3535
    36 void owl_function_command_alias(char *alias_from, char *alias_to)
     36void owl_function_command_alias(const char *alias_from, const char *alias_to)
    3737{
    3838  owl_cmddict_add_alias(owl_global_get_cmddict(&g), alias_from, alias_to);
    3939}
    4040
    41 owl_cmd *owl_function_get_cmd(char *name)
     41const owl_cmd *owl_function_get_cmd(const char *name)
    4242{
    4343  return owl_cmddict_find(owl_global_get_cmddict(&g), name);
     
    6060}
    6161
    62 void owl_function_show_view(char *viewname)
    63 {
    64   owl_view *v;
     62void owl_function_show_view(const char *viewname)
     63{
     64  const owl_view *v;
    6565  owl_fmtext fm;
    6666
     
    9292}
    9393
    94 char *owl_function_style_describe(char *name) {
    95   char *desc, *s;
    96   owl_style *style;
     94char *owl_function_style_describe(const char *name) {
     95  const char *desc;
     96  char *s;
     97  const owl_style *style;
    9798  style = owl_global_get_style_by_name(&g, name);
    9899  if (style) {
     
    107108}
    108109
    109 char *owl_function_cmd_describe(char *name)
    110 {
    111   owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
     110char *owl_function_cmd_describe(const char *name)
     111{
     112  const owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
    112113  if (cmd) return owl_cmd_describe(cmd);
    113114  else return(NULL);
    114115}
    115116
    116 void owl_function_show_command(char *name)
     117void owl_function_show_command(const char *name)
    117118{
    118119  owl_function_help_for_command(name);
     
    121122void owl_function_show_license()
    122123{
    123   char *text;
     124  const char *text;
    124125
    125126  text=""
     
    167168void owl_function_show_quickstart()
    168169{
    169     char *message =
     170    const char *message =
    170171    "Move between messages with the arrow keys, and press 'r' to reply.\n"
    171172    "For more info, press 'h' or visit http://barnowl.mit.edu/\n\n"
     
    198199 * and redisplay if necessary.
    199200 */
    200 void owl_function_adminmsg(char *header, char *body)
     201void owl_function_adminmsg(const char *header, const char *body)
    201202{
    202203  owl_message *m;
     
    225226 * that.
    226227 */
    227 owl_message *owl_function_make_outgoing_zephyr(char *body, char *zwriteline, char *zsig)
     228owl_message *owl_function_make_outgoing_zephyr(const char *body, const char *zwriteline, const char *zsig)
    228229{
    229230  owl_message *m;
     
    246247 * owl_global_messagequeue_addmsg() for that .
    247248 */
    248 owl_message *owl_function_make_outgoing_aim(char *body, char *to)
     249owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)
    249250{
    250251  owl_message *m;
     
    267268 * owl_global_messagequeue_addmsg() for that.
    268269 */
    269 owl_message *owl_function_make_outgoing_loopback(char *body)
     270owl_message *owl_function_make_outgoing_loopback(const char *body)
    270271{
    271272  owl_message *m;
     
    279280}
    280281
    281 void owl_function_zwrite_setup(char *line)
     282void owl_function_zwrite_setup(const char *line)
    282283{
    283284  owl_editwin *e;
     
    324325}
    325326
    326 void owl_function_aimwrite_setup(char *line)
     327void owl_function_aimwrite_setup(const char *line)
    327328{
    328329  owl_editwin *e;
     
    388389 * the message is expected to be set from the zwrite line itself
    389390 */
    390 void owl_function_zwrite(char *line, char *msg)
     391void owl_function_zwrite(const char *line, const char *msg)
    391392{
    392393  owl_zwrite z;
    393   char *mymsg;
     394  const char *mymsg;
    394395  owl_message *m;
    395396
     
    428429 * the message is expected to be set from the zwrite line itself
    429430 */
    430 void owl_function_zcrypt(char *line, char *msg)
     431void owl_function_zcrypt(const char *line, const char *msg)
    431432{
    432433  owl_zwrite z;
    433   char *mymsg;
     434  const char *mymsg;
    434435  char *cryptmsg;
    435436  owl_message *m;
     
    497498}
    498499
    499 void owl_function_aimwrite(char *line, char *msg)
     500void owl_function_aimwrite(const char *line, const char *msg)
    500501{
    501502  int ret;
    502   char *to, *format_msg;
     503  const char *to;
     504  char *format_msg;
    503505  owl_message *m;
    504506
     
    529531}
    530532
    531 void owl_function_send_aimawymsg(char *to, char *msg)
     533void owl_function_send_aimawymsg(const char *to, const char *msg)
    532534{
    533535  int ret;
     
    561563}
    562564
    563 void owl_function_loopwrite(char *msg)
     565void owl_function_loopwrite(const char *msg)
    564566{
    565567  owl_message *min, *mout;
     
    588590 * If last_if_none, will stop at the last message in the view
    589591 * if no matching messages are found.  */
    590 void owl_function_nextmsg_full(char *filter, int skip_deleted, int last_if_none)
     592void owl_function_nextmsg_full(const char *filter, int skip_deleted, int last_if_none)
    591593{
    592594  int curmsg, i, viewsize, found;
    593   owl_view *v;
    594   owl_filter *f = NULL;
    595   owl_message *m;
     595  const owl_view *v;
     596  const owl_filter *f = NULL;
     597  const owl_message *m;
    596598
    597599  v=owl_global_get_current_view(&g);
     
    641643}
    642644
    643 void owl_function_prevmsg_full(char *filter, int skip_deleted, int first_if_none)
     645void owl_function_prevmsg_full(const char *filter, int skip_deleted, int first_if_none)
    644646{
    645647  int curmsg, i, viewsize, found;
    646   owl_view *v;
    647   owl_filter *f = NULL;
    648   owl_message *m;
     648  const owl_view *v;
     649  const owl_filter *f = NULL;
     650  const owl_message *m;
    649651
    650652  v=owl_global_get_current_view(&g);
     
    772774{
    773775  int curmsg;
    774   owl_message *m;
     776  const owl_message *m;
    775777  owl_messagelist *ml;
    776778  owl_view *v;
     
    816818{
    817819  int oldcurmsg, curmsg;
    818   owl_view *v;
     820  const owl_view *v;
    819821
    820822  v=owl_global_get_current_view(&g);
     
    879881 * only, no error message is printed.
    880882 */
    881 void owl_function_loadsubs(char *file)
     883void owl_function_loadsubs(const char *file)
    882884{
    883885  int ret, ret2;
    884   char *foo, *path;
     886  const char *foo;
     887  char *path;
    885888
    886889  if (file==NULL) {
     
    911914}
    912915
    913 void owl_function_loadloginsubs(char *file)
     916void owl_function_loadloginsubs(const char *file)
    914917{
    915918  int ret;
     
    931934}
    932935
    933 void owl_function_aimlogin(char *user, char *passwd) {
     936void owl_function_aimlogin(const char *user, const char *passwd) {
    934937  int ret;
    935938
     
    10381041{
    10391042  int recwinlines, topmsg, curmsg;
    1040   owl_view *v;
     1043  const owl_view *v;
    10411044
    10421045  v=owl_global_get_current_view(&g);
     
    10821085 * and the number of lines in the recwin.
    10831086 */
    1084 int owl_function_calculate_topmsg_top(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
     1087int owl_function_calculate_topmsg_top(int direction, const owl_view *v, int curmsg, int topmsg, int recwinlines)
    10851088{
    10861089  return(curmsg);
    10871090}
    10881091
    1089 int owl_function_calculate_topmsg_neartop(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
     1092int owl_function_calculate_topmsg_neartop(int direction, const owl_view *v, int curmsg, int topmsg, int recwinlines)
    10901093{
    10911094  if (curmsg>0
     
    10981101}
    10991102 
    1100 int owl_function_calculate_topmsg_center(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
     1103int owl_function_calculate_topmsg_center(int direction, const owl_view *v, int curmsg, int topmsg, int recwinlines)
    11011104{
    11021105  int i, last, lines;
     
    11121115}
    11131116 
    1114 int owl_function_calculate_topmsg_paged(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines, int center_on_page)
     1117int owl_function_calculate_topmsg_paged(int direction, const owl_view *v, int curmsg, int topmsg, int recwinlines, int center_on_page)
    11151118{
    11161119  int i, last, lines, savey;
     
    11521155}
    11531156
    1154 int owl_function_calculate_topmsg_normal(int direction, owl_view *v, int curmsg, int topmsg, int recwinlines)
     1157int owl_function_calculate_topmsg_normal(int direction, const owl_view *v, int curmsg, int topmsg, int recwinlines)
    11551158{
    11561159  int savey, i, foo, y;
     
    12331236}
    12341237
    1235 void owl_function_debugmsg(char *fmt, ...)
     1238void owl_function_debugmsg(const char *fmt, ...)
    12361239{
    12371240  FILE *file;
     
    12681271}
    12691272
    1270 int owl_function_subscribe(char *class, char *inst, char *recip)
     1273int owl_function_subscribe(const char *class, const char *inst, const char *recip)
    12711274{
    12721275  int ret;
     
    12811284}
    12821285
    1283 void owl_function_unsubscribe(char *class, char *inst, char *recip)
     1286void owl_function_unsubscribe(const char *class, const char *inst, const char *recip)
    12841287{
    12851288  int ret;
     
    13231326}
    13241327
    1325 void owl_function_popless_text(char *text)
     1328void owl_function_popless_text(const char *text)
    13261329{
    13271330  owl_popwin *pw;
     
    13401343}
    13411344
    1342 void owl_function_popless_fmtext(owl_fmtext *fm)
     1345void owl_function_popless_fmtext(const owl_fmtext *fm)
    13431346{
    13441347  owl_popwin *pw;
     
    13571360}
    13581361
    1359 void owl_function_popless_file(char *filename)
     1362void owl_function_popless_file(const char *filename)
    13601363{
    13611364  owl_fmtext fm;
     
    14081411void owl_function_info()
    14091412{
    1410   owl_message *m;
     1413  const owl_message *m;
    14111414  owl_fmtext fm, attrfm;
    1412   owl_view *v;
     1415  const owl_view *v;
    14131416#ifdef HAVE_LIBZEPHYR
    1414   ZNotice_t *n;
     1417  const ZNotice_t *n;
    14151418#endif
    14161419
     
    15431546void owl_function_curmsg_to_popwin()
    15441547{
    1545   owl_view *v;
    1546   owl_message *m;
    1547   owl_style *s;
     1548  const owl_view *v;
     1549  const owl_message *m;
     1550  const owl_style *s;
    15481551  owl_fmtext fm;
    15491552
     
    15701573
    15711574  int offset, curmsg, lines;
    1572   owl_view *v;
     1575  const owl_view *v;
    15731576  owl_message *m;
    15741577
     
    16621665void owl_function_printallvars()
    16631666{
    1664   char *name;
     1667  const char *name;
    16651668  char var[LINE];
    16661669  owl_list varnames;
     
    16921695  owl_fmtext fm; 
    16931696  int i, numvarnames;
    1694   char *varname;
     1697  const char *varname;
    16951698
    16961699  owl_fmtext_init_null(&fm);
     
    17101713}
    17111714
    1712 void owl_function_show_variable(char *name)
     1715void owl_function_show_variable(const char *name)
    17131716{
    17141717  owl_fmtext fm; 
     
    17241727void owl_function_delete_by_id(int id, int flag)
    17251728{
    1726   owl_messagelist *ml;
     1729  const owl_messagelist *ml;
    17271730  owl_message *m;
    17281731  ml = owl_global_get_msglist(&g);
     
    17481751  int i, j, count;
    17491752  owl_message *m;
    1750   owl_view *v;
    1751   owl_filter *f;
     1753  const owl_view *v;
     1754  const owl_filter *f;
    17521755
    17531756  /* get the trash filter */
     
    18831886{
    18841887  char *buff=NULL;
    1885   owl_message *m;
    1886   owl_filter *f;
     1888  const owl_message *m;
     1889  const owl_filter *f;
    18871890 
    18881891  if (owl_view_get_size(owl_global_get_current_view(&g))==0) {
     
    19361939}
    19371940
    1938 void owl_function_zlocate(int argc, char **argv, int auth)
     1941void owl_function_zlocate(int argc, const char *const *argv, int auth)
    19391942{
    19401943  owl_fmtext fm;
     
    19551958}
    19561959
    1957 void owl_function_start_command(char *line)
     1960void owl_function_start_command(const char *line)
    19581961{
    19591962  owl_editwin *tw;
     
    19741977}
    19751978
    1976 void owl_function_start_question(char *line)
     1979void owl_function_start_question(const char *line)
    19771980{
    19781981  owl_editwin *tw;
     
    19911994}
    19921995
    1993 void owl_function_start_password(char *line)
     1996void owl_function_start_password(const char *line)
    19941997{
    19951998  owl_editwin *tw;
     
    20092012}
    20102013
    2011 char *owl_function_exec(int argc, char **argv, char *buff, int type)
     2014char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)
    20122015{
    20132016  /* if type == 1 display in a popup
     
    20162019   * else display in a popup
    20172020   */
    2018   char *newbuff, *redirect = " 2>&1 < /dev/null";
     2021  const char *redirect = " 2>&1 < /dev/null";
     2022  char *newbuff;
    20192023  char *out, buff2[1024];
    20202024  int size;
     
    20632067}
    20642068
    2065 char *owl_function_perl(int argc, char **argv, char *buff, int type)
     2069char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)
    20662070{
    20672071  /* if type == 1 display in a popup
     
    21002104 * should have the pointer.
    21012105 */
    2102 void owl_function_change_currentview_filter(char *filtname)
     2106void owl_function_change_currentview_filter(const char *filtname)
    21032107{
    21042108  owl_view *v;
    21052109  owl_filter *f;
    21062110  int curid=-1, newpos, curmsg;
    2107   owl_message *curm=NULL;
     2111  const owl_message *curm=NULL;
    21082112
    21092113  v=owl_global_get_current_view(&g);
     
    21482152 * with a new definition.
    21492153 */
    2150 void owl_function_create_filter(int argc, char **argv)
     2154void owl_function_create_filter(int argc, const char *const *argv)
    21512155{
    21522156  owl_filter *f;
    2153   owl_view *v;
     2157  const owl_view *v;
    21542158  int ret, inuse=0;
    21552159
     
    22402244 * Returns the name of the negated filter, which the caller must free.
    22412245 */
    2242 char *owl_function_create_negative_filter(char *filtername)
     2246char *owl_function_create_negative_filter(const char *filtername)
    22432247{
    22442248  char *newname;
    2245   owl_filter *tmpfilt;
    2246   char *argv[5];
     2249  const owl_filter *tmpfilt;
     2250  const char *argv[5];
    22472251
    22482252  owl_function_debugmsg("owl_function_create_negative_filter");
     
    22702274void owl_function_show_filters()
    22712275{
    2272   owl_list *l;
    2273   owl_filter *f;
     2276  const owl_list *l;
     2277  const owl_filter *f;
    22742278  int i, j;
    22752279  owl_fmtext fm;
     
    22962300}
    22972301
    2298 void owl_function_show_filter(char *name)
    2299 {
    2300   owl_filter *f;
     2302void owl_function_show_filter(const char *name)
     2303{
     2304  const owl_filter *f;
    23012305  char *buff, *tmp;
    23022306
     
    23152319void owl_function_show_zpunts()
    23162320{
    2317   owl_filter *f;
    2318   owl_list *fl;
     2321  const owl_filter *f;
     2322  const owl_list *fl;
    23192323  char buff[5000];
    23202324  char *tmp;
     
    23442348 * name of the filter, which the caller must free.
    23452349 */
    2346 char *owl_function_classinstfilt(char *c, char *i)
     2350char *owl_function_classinstfilt(const char *c, const char *i)
    23472351{
    23482352  owl_filter *f;
     
    24222426 * the filter, which the caller must free.
    24232427 */
    2424 char *owl_function_zuserfilt(char *user)
     2428char *owl_function_zuserfilt(const char *user)
    24252429{
    24262430  owl_filter *f;
     
    24692473 * Returns the name of the filter, which the caller must free.
    24702474 */
    2471 char *owl_function_aimuserfilt(char *user)
     2475char *owl_function_aimuserfilt(const char *user)
    24722476{
    24732477  owl_filter *f;
     
    25052509}
    25062510
    2507 char *owl_function_typefilt(char *type)
     2511char *owl_function_typefilt(const char *type)
    25082512{
    25092513  owl_filter *f;
     
    25412545void owl_function_delete_curview_msgs(int flag)
    25422546{
    2543   owl_view *v;
     2547  const owl_view *v;
    25442548  int i, j;
    25452549
     
    25752579char *owl_function_smartfilter(int type)
    25762580{
    2577   owl_view *v;
    2578   owl_message *m;
     2581  const owl_view *v;
     2582  const owl_message *m;
    25792583  char *zperson, *filtname=NULL;
    2580   char *argv[1];
     2584  const char *argv[1];
    25812585 
    25822586  v=owl_global_get_current_view(&g);
     
    26472651  /* Starts a zpunt command based on the current class,instance pair.
    26482652   * If type=0, uses just class.  If type=1, uses instance as well. */
    2649   owl_view *v;
    2650   owl_message *m;
    2651   char *cmd, *cmdprefix, *mclass, *minst;
     2653  const owl_view *v;
     2654  const owl_message *m;
     2655  const char *cmdprefix, *mclass, *minst;
     2656  char *cmd;
    26522657 
    26532658  v=owl_global_get_current_view(&g);
     
    26972702 * be 'color'
    26982703 */
    2699 void owl_function_color_current_filter(char *fgcolor, char *bgcolor)
    2700 {
    2701   char *name;
     2704void owl_function_color_current_filter(const char *fgcolor, const char *bgcolor)
     2705{
     2706  const char *name;
    27022707
    27032708  name=owl_view_get_filtname(owl_global_get_current_view(&g));
     
    27092714 * the "all" filter, return -2.  Return 0 on success
    27102715 */
    2711 int owl_function_color_filter(char *filtname, char *fgcolor, char *bgcolor)
     2716int owl_function_color_filter(const char *filtname, const char *fgcolor, const char *bgcolor)
    27122717{
    27132718  owl_filter *f;
     
    27922797 *   if direction==1 then unpunt
    27932798 */
    2794 void owl_function_zpunt(char *class, char *inst, char *recip, int direction)
     2799void owl_function_zpunt(const char *class, const char *inst, const char *recip, int direction)
    27952800{
    27962801  char *puntexpr, *classexpr, *instexpr, *recipexpr;
     
    28392844}
    28402845
    2841 void owl_function_punt(char *filter, int direction)
     2846void owl_function_punt(const char *filter, int direction)
    28422847{
    28432848  owl_filter *f;
     
    28852890}
    28862891
    2887 void owl_function_activate_keymap(char *keymap)
     2892void owl_function_activate_keymap(const char *keymap)
    28882893{
    28892894  if (!owl_keyhandler_activate(owl_global_get_keyhandler(&g), keymap)) {
     
    28962901  owl_list l;
    28972902  owl_fmtext fm;
    2898   owl_keymap *km;
    2899   owl_keyhandler *kh;
     2903  const owl_keymap *km;
     2904  const owl_keyhandler *kh;
    29002905  int i, numkm;
    2901   char *kmname;
     2906  const char *kmname;
    29022907
    29032908  kh = owl_global_get_keyhandler(&g);
     
    29232928}
    29242929
    2925 char *owl_function_keymap_summary(char *name)
    2926 {
    2927   owl_keymap *km
     2930char *owl_function_keymap_summary(const char *name)
     2931{
     2932  const owl_keymap *km
    29282933    = owl_keyhandler_get_keymap(owl_global_get_keyhandler(&g), name);
    29292934  if (km) return owl_keymap_summary(km);
     
    29322937
    29332938/* TODO: implement for real */
    2934 void owl_function_show_keymap(char *name)
     2939void owl_function_show_keymap(const char *name)
    29352940{
    29362941  owl_fmtext fm;
    2937   owl_keymap *km;
     2942  const owl_keymap *km;
    29382943
    29392944  owl_fmtext_init_null(&fm);
     
    29482953}
    29492954
    2950 void owl_function_help_for_command(char *cmdname)
     2955void owl_function_help_for_command(const char *cmdname)
    29512956{
    29522957  owl_fmtext fm;
     
    29582963}
    29592964
    2960 void owl_function_search_start(char *string, int direction)
     2965void owl_function_search_start(const char *string, int direction)
    29612966{
    29622967  /* direction is OWL_DIRECTION_DOWNWARDS or OWL_DIRECTION_UPWARDS or
     
    29932998   */
    29942999
    2995   owl_view *v;
     3000  const owl_view *v;
    29963001  int viewsize, i, curmsg, start;
    29973002  owl_message *m;
     
    30543059/* strips formatting from ztext and returns the unformatted text.
    30553060 * caller is responsible for freeing. */
    3056 char *owl_function_ztext_stylestrip(char *zt)
     3061char *owl_function_ztext_stylestrip(const char *zt)
    30573062{
    30583063  owl_fmtext fm;
     
    30673072
    30683073/* Popup a buddylisting.  If filename is NULL use the default .anyone */
    3069 void owl_function_buddylist(int aim, int zephyr, char *filename)
     3074void owl_function_buddylist(int aim, int zephyr, const char *filename)
    30703075{
    30713076  int i, j, idle;
    30723077  int interrupted = 0;
    30733078  owl_fmtext fm;
    3074   owl_buddylist *bl;
    3075   owl_buddy *b;
     3079  const owl_buddylist *bl;
     3080  const owl_buddy *b;
    30763081  char *timestr;
    30773082#ifdef HAVE_LIBZEPHYR
    30783083  int x;
    30793084  owl_list anyone;
    3080   char *tmp, *user;
     3085  const char *user;
     3086  char *tmp;
    30813087  ZLocations_t location[200];
    30823088  int numlocs, ret;
     
    31263132        for (i=0; i<j; i++) {
    31273133          user=owl_list_get_element(&anyone, i);
    3128           ret=ZLocateUser(user, &numlocs, ZAUTH);
     3134          ret=ZLocateUser(zstr(user), &numlocs, ZAUTH);
    31293135
    31303136          owl_function_mask_sigint(NULL);
     
    31833189
    31843190/* Dump messages in the current view to the file 'filename'. */
    3185 void owl_function_dump(char *filename)
     3191void owl_function_dump(const char *filename)
    31863192{
    31873193  int i, j, count;
    31883194  owl_message *m;
    3189   owl_view *v;
     3195  const owl_view *v;
    31903196  FILE *file;
    31913197  char *plaintext;
     
    32933299 * startupfile.
    32943300 */
    3295 void owl_function_addstartup(char *buff)
     3301void owl_function_addstartup(const char *buff)
    32963302{
    32973303  FILE *file;
    3298   char *filename;
     3304  const char *filename;
    32993305
    33003306  filename=owl_global_get_startupfile(&g);
     
    33153321
    33163322/* Remove the specified command from the startup file. */
    3317 void owl_function_delstartup(char *buff)
    3318 {
    3319   char *filename;
     3323void owl_function_delstartup(const char *buff)
     3324{
     3325  const char *filename;
    33203326  filename=owl_global_get_startupfile(&g);
    33213327  owl_util_file_deleteline(filename, buff, 1);
     
    33253331 * is NULL, use the default owl startup commands file.
    33263332 */
    3327 void owl_function_source(char *filename)
     3333void owl_function_source(const char *filename)
    33283334{
    33293335  char *path;
     
    33543360}
    33553361
    3356 void owl_function_change_style(owl_view *v, char *stylename)
    3357 {
    3358   owl_style *s;
     3362void owl_function_change_style(owl_view *v, const char *stylename)
     3363{
     3364  const owl_style *s;
    33593365
    33603366  s=owl_global_get_style_by_name(&g, stylename);
     
    33723378{
    33733379  owl_view *v;
    3374   owl_style *s;
     3380  const owl_style *s;
    33753381
    33763382  v=owl_global_get_current_view(&g);
     
    33883394}
    33893395
    3390 void owl_function_error(char *fmt, ...)
     3396void owl_function_error(const char *fmt, ...)
    33913397{
    33923398  va_list ap;
    33933399  char *buff;
    3394   char *nl;
     3400  const char *nl;
    33953401
    33963402  va_start(ap, fmt);
     
    34103416}
    34113417
    3412 void owl_function_log_err(char *string)
     3418void owl_function_log_err(const char *string)
    34133419{
    34143420  char *date;
     
    34383444}
    34393445
    3440 void owl_function_makemsg(char *fmt, ...)
     3446void owl_function_makemsg(const char *fmt, ...)
    34413447{
    34423448  va_list ap;
     
    34683474  owl_message *m;
    34693475  owl_zbuddylist *zbl;
    3470   char *user;
     3476  const char *user;
    34713477  ZLocations_t location[200];
    34723478  int numlocs, ret;
     
    34803486  for (i=0; i<j; i++) {
    34813487    user=owl_list_get_element(&anyone, i);
    3482     ret=ZLocateUser(user, &numlocs, ZAUTH);
     3488    ret=ZLocateUser(zstr(user), &numlocs, ZAUTH);
    34833489    if (ret!=ZERR_NONE) {
    34843490      owl_function_error("Error getting location for %s", user);
     
    35193525}
    35203526
    3521 void owl_function_aimsearch_results(char *email, owl_list *namelist)
     3527void owl_function_aimsearch_results(const char *email, owl_list *namelist)
    35223528{
    35233529  owl_fmtext fm;
     
    35613567}
    35623568
    3563 void _owl_function_mark_message(owl_message *m)
     3569void _owl_function_mark_message(const owl_message *m)
    35643570{
    35653571  if (m)
     
    35693575void owl_function_mark_message()
    35703576{
    3571   owl_message *m;
    3572   owl_view *v;
     3577  const owl_message *m;
     3578  const owl_view *v;
    35733579
    35743580  v=owl_global_get_current_view(&g);
     
    35893595{
    35903596  int marked_id;
    3591   owl_message *m;
    3592   owl_view *v;
     3597  const owl_message *m;
     3598  const owl_view *v;
    35933599
    35943600  marked_id=owl_global_get_markedmsgid(&g);
  • global.c

    r41c9a96 r8742840  
    168168}
    169169                         
    170 int owl_global_get_lines(owl_global *g) {
     170int owl_global_get_lines(const owl_global *g) {
    171171  return(g->lines);
    172172}
    173173
    174 int owl_global_get_cols(owl_global *g) {
     174int owl_global_get_cols(const owl_global *g) {
    175175  return(g->cols);
    176176}
    177177
    178 int owl_global_get_recwin_lines(owl_global *g) {
     178int owl_global_get_recwin_lines(const owl_global *g) {
    179179  return(g->recwinlines);
    180180}
     
    182182/* curmsg */
    183183
    184 int owl_global_get_curmsg(owl_global *g) {
     184int owl_global_get_curmsg(const owl_global *g) {
    185185  return(g->curmsg);
    186186}
     
    195195/* topmsg */
    196196
    197 int owl_global_get_topmsg(owl_global *g) {
     197int owl_global_get_topmsg(const owl_global *g) {
    198198  return(g->topmsg);
    199199}
     
    205205/* markedmsgid */
    206206
    207 int owl_global_get_markedmsgid(owl_global *g) {
     207int owl_global_get_markedmsgid(const owl_global *g) {
    208208  return(g->markedmsgid);
    209209}
     
    212212  g->markedmsgid=i;
    213213  /* i; index of message in the current view.
    214   owl_message *m;
     214  const owl_message *m;
    215215  owl_view *v;
    216216
     
    245245/* curses windows */
    246246
    247 WINDOW *owl_global_get_curs_recwin(owl_global *g) {
     247WINDOW *owl_global_get_curs_recwin(const owl_global *g) {
    248248  return(g->recwin);
    249249}
    250250
    251 WINDOW *owl_global_get_curs_sepwin(owl_global *g) {
     251WINDOW *owl_global_get_curs_sepwin(const owl_global *g) {
    252252  return(g->sepwin);
    253253}
    254254
    255 WINDOW *owl_global_get_curs_msgwin(owl_global *g) {
     255WINDOW *owl_global_get_curs_msgwin(const owl_global *g) {
    256256  return(g->msgwin);
    257257}
    258258
    259 WINDOW *owl_global_get_curs_typwin(owl_global *g) {
     259WINDOW *owl_global_get_curs_typwin(const owl_global *g) {
    260260  return(g->typwin);
    261261}
     
    263263/* typwin */
    264264
    265 owl_editwin *owl_global_get_typwin(owl_global *g) {
     265owl_editwin *owl_global_get_typwin(const owl_global *g) {
    266266  return(g->tw);
    267267}
     
    269269/* buffercommand */
    270270
    271 void owl_global_set_buffercommand(owl_global *g, char *command) {
     271void owl_global_set_buffercommand(owl_global *g, const char *command) {
    272272  owl_editwin_set_command(owl_global_get_typwin(g), command);
    273273}
    274274
    275 char *owl_global_get_buffercommand(owl_global *g) {
     275const char *owl_global_get_buffercommand(const owl_global *g) {
    276276  return owl_editwin_get_command(owl_global_get_typwin(g));
    277277}
     
    281281}
    282282
    283 void (*owl_global_get_buffercallback(owl_global *g))(owl_editwin*) {
     283void (*owl_global_get_buffercallback(const owl_global *g))(owl_editwin*) {
    284284  return owl_editwin_get_callback(owl_global_get_typwin(g));
    285285}
     
    287287/* refresh */
    288288
    289 int owl_global_is_needrefresh(owl_global *g) {
     289int owl_global_is_needrefresh(const owl_global *g) {
    290290  if (g->needrefresh==1) return(1);
    291291  return(0);
     
    318318}
    319319
    320 int owl_global_get_rightshift(owl_global *g) {
     320int owl_global_get_rightshift(const owl_global *g) {
    321321  return(g->rightshift);
    322322}
     
    324324/* typwin */
    325325
    326 int owl_global_is_typwin_active(owl_global *g) {
     326int owl_global_is_typwin_active(const owl_global *g) {
    327327  if (g->typwinactive==1) return(1);
    328328  return(0);
     
    351351}
    352352
    353 char *owl_global_get_homedir(owl_global *g) {
     353const char *owl_global_get_homedir(const owl_global *g) {
    354354  if (g->homedir) return(g->homedir);
    355355  return("/");
    356356}
    357357
    358 char *owl_global_get_confdir(owl_global *g) {
     358const char *owl_global_get_confdir(const owl_global *g) {
    359359  if (g->confdir) return(g->confdir);
    360360  return("/");
     
    364364 * Setting this also sets startupfile to confdir/startup
    365365 */
    366 void owl_global_set_confdir(owl_global *g, char *cd) {
     366void owl_global_set_confdir(owl_global *g, const char *cd) {
    367367  free(g->confdir);
    368368  g->confdir = owl_strdup(cd);
     
    371371}
    372372
    373 char *owl_global_get_startupfile(owl_global *g) {
     373const char *owl_global_get_startupfile(const owl_global *g) {
    374374  if(g->startupfile) return(g->startupfile);
    375375  return("/");
    376376}
    377377
    378 int owl_global_get_direction(owl_global *g) {
     378int owl_global_get_direction(const owl_global *g) {
    379379  return(g->direction);
    380380}
     
    394394}
    395395
    396 void *owl_global_get_perlinterp(owl_global *g) {
     396void *owl_global_get_perlinterp(const owl_global *g) {
    397397  return(g->perl);
    398398}
    399399
    400 int owl_global_is_config_format(owl_global *g) {
     400int owl_global_is_config_format(const owl_global *g) {
    401401  if (g->config_format) return(1);
    402402  return(0);
     
    498498/* debug */
    499499
    500 int owl_global_is_debug_fast(owl_global *g) {
     500int owl_global_is_debug_fast(const owl_global *g) {
    501501  if (g->debug) return(1);
    502502  return(0);
     
    505505/* starttime */
    506506
    507 time_t owl_global_get_starttime(owl_global *g) {
     507time_t owl_global_get_starttime(const owl_global *g) {
    508508  return(g->starttime);
    509509}
    510510
    511 time_t owl_global_get_runtime(owl_global *g) {
     511time_t owl_global_get_runtime(const owl_global *g) {
    512512  return(time(NULL)-g->starttime);
    513513}
    514514
    515 time_t owl_global_get_lastinputtime(owl_global *g) {
     515time_t owl_global_get_lastinputtime(const owl_global *g) {
    516516  return(g->lastinputtime);
    517517}
     
    521521}
    522522
    523 time_t owl_global_get_idletime(owl_global *g) {
     523time_t owl_global_get_idletime(const owl_global *g) {
    524524  return(time(NULL)-g->lastinputtime);
    525525}
    526526
    527 void owl_global_get_runtime_string(owl_global *g, char *buff) {
     527void owl_global_get_runtime_string(const owl_global *g, char *buff) {
    528528  time_t diff;
    529529
     
    534534}
    535535
    536 char *owl_global_get_hostname(owl_global *g) {
     536const char *owl_global_get_hostname(const owl_global *g) {
    537537  if (g->thishost) return(g->thishost);
    538538  return("");
     
    549549}
    550550
    551 int owl_global_get_userclue(owl_global *g) {
     551int owl_global_get_userclue(const owl_global *g) {
    552552  return(g->userclue);
    553553}
    554554
    555 int owl_global_is_userclue(owl_global *g, int clue) {
     555int owl_global_is_userclue(const owl_global *g, int clue) {
    556556  if (g->userclue & clue) return(1);
    557557  return(0);
     
    567567/* vert offset */
    568568
    569 int owl_global_get_curmsg_vert_offset(owl_global *g) {
     569int owl_global_get_curmsg_vert_offset(const owl_global *g) {
    570570  return(g->curmsg_vert_offset);
    571571}
     
    577577/* startup args */
    578578
    579 void owl_global_set_startupargs(owl_global *g, int argc, char **argv) {
     579void owl_global_set_startupargs(owl_global *g, int argc, const char *const *argv) {
    580580  int i, len;
    581581
     
    595595}
    596596
    597 char *owl_global_get_startupargs(owl_global *g) {
     597const char *owl_global_get_startupargs(const owl_global *g) {
    598598  if (g->startupargs) return(g->startupargs);
    599599  return("");
     
    616616}
    617617
    618 owl_filter *owl_global_get_filter(owl_global *g, char *name) {
     618owl_filter *owl_global_get_filter(const owl_global *g, const char *name) {
    619619  int i, j;
    620620  owl_filter *f;
     
    634634}
    635635
    636 void owl_global_remove_filter(owl_global *g, char *name) {
     636void owl_global_remove_filter(owl_global *g, const char *name) {
    637637  int i, j;
    638638  owl_filter *f;
     
    663663/* has colors */
    664664
    665 int owl_global_get_hascolors(owl_global *g) {
     665int owl_global_get_hascolors(const owl_global *g) {
    666666  if (g->hascolors) return(1);
    667667  return(0);
     
    670670/* color pairs */
    671671
    672 int owl_global_get_colorpairs(owl_global *g) {
     672int owl_global_get_colorpairs(const owl_global *g) {
    673673  return(g->colorpairs);
    674674}
     
    684684}
    685685
    686 int owl_global_message_is_puntable(owl_global *g, owl_message *m) {
    687   owl_list *pl;
     686int owl_global_message_is_puntable(owl_global *g, const owl_message *m) {
     687  const owl_list *pl;
    688688  int i, j;
    689689
     
    697697
    698698int owl_global_should_followlast(owl_global *g) {
    699   owl_view *v;
     699  const owl_view *v;
    700700 
    701701  if (!owl_global_is__followlast(g)) return(0);
     
    707707}
    708708
    709 int owl_global_is_search_active(owl_global *g) {
     709int owl_global_is_search_active(const owl_global *g) {
    710710  if (owl_regex_is_set(&g->search_re)) return(1);
    711711  return(0);
    712712}
    713713
    714 void owl_global_set_search_re(owl_global *g, owl_regex *re) {
     714void owl_global_set_search_re(owl_global *g, const owl_regex *re) {
    715715  if (owl_regex_is_set(&g->search_re)) {
    716716    owl_regex_free(&g->search_re);
     
    721721}
    722722
    723 owl_regex *owl_global_get_search_re(owl_global *g) {
     723const owl_regex *owl_global_get_search_re(const owl_global *g) {
    724724  return &g->search_re;
    725725}
     
    729729}
    730730
    731 int owl_global_get_newmsgproc_pid(owl_global *g) {
     731int owl_global_get_newmsgproc_pid(const owl_global *g) {
    732732  return(g->newmsgproc_pid);
    733733}
     
    735735/* AIM stuff */
    736736
    737 int owl_global_is_aimloggedin(owl_global *g)
     737int owl_global_is_aimloggedin(const owl_global *g)
    738738{
    739739  if (g->aim_loggedin) return(1);
     
    741741}
    742742
    743 char *owl_global_get_aim_screenname(owl_global *g)
     743const char *owl_global_get_aim_screenname(const owl_global *g)
    744744{
    745745  if (owl_global_is_aimloggedin(g)) {
     
    749749}
    750750
    751 char *owl_global_get_aim_screenname_for_filters(owl_global *g)
     751const char *owl_global_get_aim_screenname_for_filters(const owl_global *g)
    752752{
    753753  if (owl_global_is_aimloggedin(g)) {
     
    757757}
    758758
    759 void owl_global_set_aimloggedin(owl_global *g, char *screenname)
    760 {
    761   char *sn_escaped, *quote;
     759void owl_global_set_aimloggedin(owl_global *g, const char *screenname)
     760{
     761  char *sn_escaped;
     762  const char *quote;
    762763  g->aim_loggedin=1;
    763764  if (g->aim_screenname) owl_free(g->aim_screenname);
     
    775776}
    776777
    777 int owl_global_is_doaimevents(owl_global *g)
     778int owl_global_is_doaimevents(const owl_global *g)
    778779{
    779780  if (g->aim_doprocessing) return(1);
     
    842843/* Return the style with name 'name'.  If it does not exist return
    843844 * NULL */
    844 owl_style *owl_global_get_style_by_name(owl_global *g, char *name)
     845const owl_style *owl_global_get_style_by_name(const owl_global *g, const char *name)
    845846{
    846847  return owl_dict_find_element(&(g->styledict), name);
     
    849850/* creates a list and fills it in with keys.  duplicates the keys,
    850851 * so they will need to be freed by the caller. */
    851 int owl_global_get_style_names(owl_global *g, owl_list *l) {
     852int owl_global_get_style_names(const owl_global *g, owl_list *l) {
    852853  return owl_dict_get_keys(&(g->styledict), l);
    853854}
     
    872873}
    873874
    874 int owl_global_is_haveaim(owl_global *g)
     875int owl_global_is_haveaim(const owl_global *g)
    875876{
    876877  if (g->haveaim) return(1);
     
    888889}
    889890
    890 int owl_global_is_ignore_aimlogin(owl_global *g)
     891int owl_global_is_ignore_aimlogin(const owl_global *g)
    891892{
    892893    return g->ignoreaimlogin;
     
    898899}
    899900
    900 int owl_global_is_havezephyr(owl_global *g)
     901int owl_global_is_havezephyr(const owl_global *g)
    901902{
    902903  if (g->havezephyr) return(1);
     
    941942}
    942943
    943 char * owl_global_intern(owl_global *g, char * string)
     944const char * owl_global_intern(owl_global *g, const char * string)
    944945{
    945946  return owl_obarray_insert(&(g->obarray), string);
     
    956957}
    957958
    958 int owl_global_is_interrupted(owl_global *g) {
     959int owl_global_is_interrupted(const owl_global *g) {
    959960  return g->interrupted;
    960961}
  • help.c

    rd43edd2 re19eb97  
    55{
    66  owl_fmtext fm;
    7   char *varname;
     7  const char *varname;
    88  owl_list varnames;
    99  int i, numvarnames;
  • history.c

    rd43edd2 r1e94c0b  
    1515}
    1616
    17 char *owl_history_get_prev(owl_history *h)
     17const char *owl_history_get_prev(owl_history *h)
    1818{
    1919
     
    3232}
    3333
    34 char *owl_history_get_next(owl_history *h)
     34const char *owl_history_get_next(owl_history *h)
    3535{
    3636  if (!h) return NULL;
     
    4444}
    4545
    46 void owl_history_store(owl_history *h, char *line)
     46void owl_history_store(owl_history *h, const char *line)
    4747{
    4848  int size;
     
    8585}
    8686
    87 int owl_history_is_touched(owl_history *h)
     87int owl_history_is_touched(const owl_history *h)
    8888{
    8989  if (!h) return(0);
  • keybinding.c

    rd43edd2 r12bc46a  
    1212
    1313/* sets up a new keybinding for a command */
    14 int owl_keybinding_init(owl_keybinding *kb, char *keyseq, char *command, void (*function_fn)(void), char *desc)
     14int owl_keybinding_init(owl_keybinding *kb, const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)
    1515{
    1616  char **ktokens;
     
    6868
    6969/* executes a keybinding */
    70 void owl_keybinding_execute(owl_keybinding *kb, int j)
     70void owl_keybinding_execute(const owl_keybinding *kb, int j)
    7171{
    7272  if (kb->type == OWL_KEYBINDING_COMMAND && kb->command) {
     
    9595
    9696/* returns 0 on success */
    97 int owl_keybinding_tostring(owl_keybinding *kb, char *buff, int bufflen)
     97int owl_keybinding_tostring(const owl_keybinding *kb, char *buff, int bufflen)
    9898{
    9999  return owl_keybinding_stack_tostring(kb->keys, kb->len, buff, bufflen);
    100100}
    101101
    102 char *owl_keybinding_get_desc(owl_keybinding *kb)
     102const char *owl_keybinding_get_desc(const owl_keybinding *kb)
    103103{
    104104  return kb->desc;
     
    106106
    107107/* returns 0 on no match, 1 on subset match, and 2 on complete match */
    108 int owl_keybinding_match(owl_keybinding *kb, owl_keyhandler *kh)
     108int owl_keybinding_match(const owl_keybinding *kb, const owl_keyhandler *kh)
    109109{
    110110  int i;
     
    126126
    127127/* returns 1 if keypress sequence is the same */
    128 int owl_keybinding_equal(owl_keybinding *kb1, owl_keybinding *kb2)
     128int owl_keybinding_equal(const owl_keybinding *kb1, const owl_keybinding *kb2)
    129129{
    130130  int i;
  • keymap.c

    r4d86e06 r12bc46a  
    33
    44/* returns 0 on success */
    5 int owl_keymap_init(owl_keymap *km, char *name, char *desc, void (*default_fn)(owl_input), void (*prealways_fn)(owl_input), void (*postalways_fn)(owl_input))
     5int owl_keymap_init(owl_keymap *km, const char *name, const char *desc, void (*default_fn)(owl_input), void (*prealways_fn)(owl_input), void (*postalways_fn)(owl_input))
    66{
    77  if (!name || !desc) return(-1);
     
    2424}
    2525
    26 void owl_keymap_set_submap(owl_keymap *km, owl_keymap *submap)
     26void owl_keymap_set_submap(owl_keymap *km, const owl_keymap *submap)
    2727{
    2828  km->submap = submap;
     
    3030
    3131/* creates and adds a key binding */
    32 int owl_keymap_create_binding(owl_keymap *km, char *keyseq, char *command, void (*function_fn)(void), char *desc)
     32int owl_keymap_create_binding(owl_keymap *km, const char *keyseq, const char *command, void (*function_fn)(void), const char *desc)
    3333{
    3434  owl_keybinding *kb, *curkb;
     
    5454
    5555/* returns a summary line describing this keymap.  the caller must free. */
    56 char *owl_keymap_summary(owl_keymap *km)
     56char *owl_keymap_summary(const owl_keymap *km)
    5757{
    5858  char *s;
     
    6666
    6767/* Appends details about the keymap to fm */
    68 void owl_keymap_get_details(owl_keymap *km, owl_fmtext *fm)
     68void owl_keymap_get_details(const owl_keymap *km, owl_fmtext *fm)
    6969{
    7070  int i, nbindings;
    71   owl_keybinding *kb;
     71  const owl_keybinding *kb;
    7272 
    7373  owl_fmtext_append_bold(fm, "KEYMAP - ");
     
    102102  for (i=0; i<nbindings; i++) {
    103103    char buff[100];
    104     owl_cmd *cmd;
    105     char *tmpdesc, *desc = "";
     104    const owl_cmd *cmd;
     105    const char *tmpdesc, *desc = "";
    106106
    107107    kb = owl_list_get_element(&km->bindings, i);
     
    149149}
    150150
    151 owl_keymap *owl_keyhandler_create_and_add_keymap(owl_keyhandler *kh, char *name, char *desc, void (*default_fn)(owl_input), void (*prealways_fn)(owl_input), void (*postalways_fn)(owl_input))
     151owl_keymap *owl_keyhandler_create_and_add_keymap(owl_keyhandler *kh, const char *name, const char *desc, void (*default_fn)(owl_input), void (*prealways_fn)(owl_input), void (*postalways_fn)(owl_input))
    152152{
    153153  owl_keymap *km;
     
    167167}
    168168
    169 owl_keymap *owl_keyhandler_get_keymap(owl_keyhandler *kh, char *mapname)
     169owl_keymap *owl_keyhandler_get_keymap(const owl_keyhandler *kh, const char *mapname)
    170170{
    171171  return owl_dict_find_element(&kh->keymaps, mapname);
     
    173173
    174174/* free the list with owl_cmddict_namelist_free */
    175 void owl_keyhandler_get_keymap_names(owl_keyhandler *kh, owl_list *l)
     175void owl_keyhandler_get_keymap_names(const owl_keyhandler *kh, owl_list *l)
    176176{
    177177  owl_dict_get_keys(&kh->keymaps, l);
     
    187187/* sets the active keymap, which will also reset any key state.
    188188 * returns the new keymap, or NULL on failure. */
    189 owl_keymap *owl_keyhandler_activate(owl_keyhandler *kh, char *mapname)
    190 {
    191   owl_keymap *km;
     189const owl_keymap *owl_keyhandler_activate(owl_keyhandler *kh, const char *mapname)
     190{
     191  const owl_keymap *km;
    192192  if (kh->active && !strcmp(mapname, kh->active->name)) return(kh->active);
    193193  km = owl_dict_find_element(&kh->keymaps, mapname);
     
    202202int owl_keyhandler_process(owl_keyhandler *kh, owl_input j)
    203203{
    204   owl_keymap     *km;
    205   owl_keybinding *kb;
     204  const owl_keymap     *km;
     205  const owl_keybinding *kb;
    206206  int i, match;
    207207
  • keypress.c

    r6551eae r369a7f0  
    33#include "owl.h"
    44
    5 static struct _owl_keypress_specialmap {
     5static const struct _owl_keypress_specialmap {
    66  int   kj;
    7   char *ks;
     7  const char *ks;
    88} specialmap[] = {
    99#ifdef KEY_CODE_YES
     
    133133{
    134134  char kb[64], kb2[2];
    135   struct _owl_keypress_specialmap *sm;
     135  const struct _owl_keypress_specialmap *sm;
    136136
    137137  *kb = '\0';
     
    175175
    176176/* returns ERR on failure, else a keycode */
    177 int owl_keypress_fromstring(char *kb)
     177int owl_keypress_fromstring(const char *kb)
    178178{
    179   struct _owl_keypress_specialmap *sm;
     179  const struct _owl_keypress_specialmap *sm;
    180180  int ismeta=0, isctrl=0;
    181181  int j = ERR;
  • keys.c

    rd43edd2 r9c01a5e  
    344344void owl_keys_popless_postalways(owl_input j) {
    345345  owl_viewwin *v = owl_global_get_viewwin(&g);
    346   owl_popwin *pw = owl_global_get_popwin(&g);
     346  const owl_popwin *pw = owl_global_get_popwin(&g);
    347347
    348348  if (pw && owl_popwin_is_active(pw) && v) {
  • list.c

    r4d86e06 r77bced3  
    1414}
    1515
    16 int owl_list_get_size(owl_list *l)
     16int owl_list_get_size(const owl_list *l)
    1717{
    1818  return(l->size);
     
    3333}
    3434
    35 void *owl_list_get_element(owl_list *l, int n)
     35void *owl_list_get_element(const owl_list *l, int n)
    3636{
    3737  if (n>l->size-1) return(NULL);
  • logging.c

    rd43edd2 r4542047  
    99 * functions in this file as necessary.
    1010 */
    11 void owl_log_message(owl_message *m) {
     11void owl_log_message(const owl_message *m) {
    1212  owl_function_debugmsg("owl_log_message: entering");
    1313
     
    3737
    3838/* Return 1 if we should log the given message, otherwise return 0 */
    39 int owl_log_shouldlog_message(owl_message *m) {
    40   owl_filter *f;
     39int owl_log_shouldlog_message(const owl_message *m) {
     40  const owl_filter *f;
    4141
    4242  /* If there's a logfilter and this message matches it, log */
     
    7070}
    7171
    72 void owl_log_zephyr(owl_message *m, FILE *file) {
     72void owl_log_zephyr(const owl_message *m, FILE *file) {
    7373    char *tmp;
    7474    tmp=short_zuser(owl_message_get_sender(m));
     
    8282}
    8383
    84 void owl_log_aim(owl_message *m, FILE *file) {
     84void owl_log_aim(const owl_message *m, FILE *file) {
    8585    fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m));
    8686    fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
     
    9393}
    9494
    95 void owl_log_jabber(owl_message *m, FILE *file) {
     95void owl_log_jabber(const owl_message *m, FILE *file) {
    9696    fprintf(file, "From: <%s> To: <%s>\n",owl_message_get_sender(m), owl_message_get_recipient(m));
    9797    fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
     
    9999}
    100100
    101 void owl_log_generic(owl_message *m, FILE *file) {
     101void owl_log_generic(const owl_message *m, FILE *file) {
    102102    fprintf(file, "From: <%s> To: <%s>\n", owl_message_get_sender(m), owl_message_get_recipient(m));
    103103    fprintf(file, "Time: %s\n\n", owl_message_get_timestr(m));
     
    105105}
    106106
    107 void owl_log_append(owl_message *m, char *filename) {
     107void owl_log_append(const owl_message *m, const char *filename) {
    108108    FILE *file;
    109109    file=fopen(filename, "a");
     
    124124}
    125125
    126 void owl_log_outgoing(owl_message *m)
     126void owl_log_outgoing(const owl_message *m)
    127127{
    128128  char filename[MAXPATHLEN], *logpath;
     
    171171
    172172
    173 void owl_log_outgoing_zephyr_error(char *to, char *text)
     173void owl_log_outgoing_zephyr_error(const char *to, const char *text)
    174174{
    175175  FILE *file;
     
    227227}
    228228
    229 void owl_log_incoming(owl_message *m)
     229void owl_log_incoming(const owl_message *m)
    230230{
    231231  char filename[MAXPATHLEN], allfilename[MAXPATHLEN], *logpath;
    232   char *frombuff=NULL, *from=NULL;
     232  const char *from=NULL;
     233  char *frombuff=NULL;
    233234  int len, ch, i, personal;
    234235
     
    242243  } else if (owl_message_is_type_jabber(m)) {
    243244    /* This needs to be fixed to handle groupchat */
    244     char* msgtype = owl_message_get_attribute_value(m,"jtype");
     245    const char* msgtype = owl_message_get_attribute_value(m,"jtype");
    245246    if (msgtype && !strcmp(msgtype,"groupchat")) {
    246247      personal = 0;
  • mainwin.c

    rd43edd2 r9e5c9f3  
    1414  int topmsg, curmsg, fgcolor, bgcolor;
    1515  WINDOW *recwin;
    16   owl_view *v;
    17   owl_list *filtlist;
    18   owl_filter *f;
     16  const owl_view *v;
     17  const owl_list *filtlist;
     18  const owl_filter *f;
    1919
    2020  recwin=owl_global_get_curs_recwin(&g);
     
    142142
    143143
    144 int owl_mainwin_is_curmsg_truncated(owl_mainwin *mw)
     144int owl_mainwin_is_curmsg_truncated(const owl_mainwin *mw)
    145145{
    146146  if (mw->curtruncated) return(1);
     
    148148}
    149149
    150 int owl_mainwin_is_last_msg_truncated(owl_mainwin *mw)
     150int owl_mainwin_is_last_msg_truncated(const owl_mainwin *mw)
    151151{
    152152  if (mw->lasttruncated) return(1);
     
    154154}
    155155
    156 int owl_mainwin_get_last_msg(owl_mainwin *mw)
     156int owl_mainwin_get_last_msg(const owl_mainwin *mw)
    157157{
    158158  /* return the number of the last message displayed. -1 if none */
  • message.c

    r41c9a96 r9e5c9f3  
    5555 * name already exists, replace the old value with the new value
    5656 */
    57 void owl_message_set_attribute(owl_message *m, char *attrname, const char *attrvalue)
     57void owl_message_set_attribute(owl_message *m, const char *attrname, const char *attrvalue)
    5858{
    5959  int i, j;
     
    8282 * the attribute does not exist
    8383 */
    84 char *owl_message_get_attribute_value(owl_message *m, char *attrname)
     84const char *owl_message_get_attribute_value(const owl_message *m, const char *attrname)
    8585{
    8686  int i, j;
     
    107107 * function to indent fmtext.
    108108 */
    109 void owl_message_attributes_tofmtext(owl_message *m, owl_fmtext *fm) {
     109void owl_message_attributes_tofmtext(const owl_message *m, owl_fmtext *fm) {
    110110  int i, j;
    111111  owl_pair *p;
     
    145145void owl_message_format(owl_message *m)
    146146{
    147   owl_style *s;
    148   owl_view *v;
     147  const owl_style *s;
     148  const owl_view *v;
    149149
    150150  if (!m->fmtext) {
     
    159159}
    160160
    161 void owl_message_set_class(owl_message *m, char *class)
     161void owl_message_set_class(owl_message *m, const char *class)
    162162{
    163163  owl_message_set_attribute(m, "class", class);
    164164}
    165165
    166 char *owl_message_get_class(owl_message *m)
    167 {
    168   char *class;
     166const char *owl_message_get_class(const owl_message *m)
     167{
     168  const char *class;
    169169
    170170  class=owl_message_get_attribute_value(m, "class");
     
    173173}
    174174
    175 void owl_message_set_instance(owl_message *m, char *inst)
     175void owl_message_set_instance(owl_message *m, const char *inst)
    176176{
    177177  owl_message_set_attribute(m, "instance", inst);
    178178}
    179179
    180 char *owl_message_get_instance(owl_message *m)
    181 {
    182   char *instance;
     180const char *owl_message_get_instance(const owl_message *m)
     181{
     182  const char *instance;
    183183
    184184  instance=owl_message_get_attribute_value(m, "instance");
     
    187187}
    188188
    189 void owl_message_set_sender(owl_message *m, char *sender)
     189void owl_message_set_sender(owl_message *m, const char *sender)
    190190{
    191191  owl_message_set_attribute(m, "sender", sender);
    192192}
    193193
    194 char *owl_message_get_sender(owl_message *m)
    195 {
    196   char *sender;
     194const char *owl_message_get_sender(const owl_message *m)
     195{
     196  const char *sender;
    197197
    198198  sender=owl_message_get_attribute_value(m, "sender");
     
    201201}
    202202
    203 void owl_message_set_zsig(owl_message *m, char *zsig)
     203void owl_message_set_zsig(owl_message *m, const char *zsig)
    204204{
    205205  owl_message_set_attribute(m, "zsig", zsig);
    206206}
    207207
    208 char *owl_message_get_zsig(owl_message *m)
    209 {
    210   char *zsig;
     208const char *owl_message_get_zsig(const owl_message *m)
     209{
     210  const char *zsig;
    211211
    212212  zsig=owl_message_get_attribute_value(m, "zsig");
     
    215215}
    216216
    217 void owl_message_set_recipient(owl_message *m, char *recip)
     217void owl_message_set_recipient(owl_message *m, const char *recip)
    218218{
    219219  owl_message_set_attribute(m, "recipient", recip);
    220220}
    221221
    222 char *owl_message_get_recipient(owl_message *m)
     222const char *owl_message_get_recipient(const owl_message *m)
    223223{
    224224  /* this is stupid for outgoing messages, we need to fix it. */
    225225
    226   char *recip;
     226  const char *recip;
    227227
    228228  recip=owl_message_get_attribute_value(m, "recipient");
     
    236236}
    237237
    238 char *owl_message_get_realm(owl_message *m)
    239 {
    240   char *realm;
     238const char *owl_message_get_realm(const owl_message *m)
     239{
     240  const char *realm;
    241241 
    242242  realm=owl_message_get_attribute_value(m, "realm");
     
    245245}
    246246
    247 void owl_message_set_body(owl_message *m, char *body)
     247void owl_message_set_body(owl_message *m, const char *body)
    248248{
    249249  owl_message_set_attribute(m, "body", body);
    250250}
    251251
    252 char *owl_message_get_body(owl_message *m)
    253 {
    254   char *body;
     252const char *owl_message_get_body(const owl_message *m)
     253{
     254  const char *body;
    255255
    256256  body=owl_message_get_attribute_value(m, "body");
     
    260260
    261261
    262 void owl_message_set_opcode(owl_message *m, char *opcode)
     262void owl_message_set_opcode(owl_message *m, const char *opcode)
    263263{
    264264  owl_message_set_attribute(m, "opcode", opcode);
    265265}
    266266
    267 char *owl_message_get_opcode(owl_message *m)
    268 {
    269   char *opcode;
     267const char *owl_message_get_opcode(const owl_message *m)
     268{
     269  const char *opcode;
    270270
    271271  opcode=owl_message_get_attribute_value(m, "opcode");
     
    286286}
    287287
    288 int owl_message_is_loginout(owl_message *m)
    289 {
    290   char *res;
     288int owl_message_is_loginout(const owl_message *m)
     289{
     290  const char *res;
    291291
    292292  res=owl_message_get_attribute_value(m, "loginout");
     
    295295}
    296296
    297 int owl_message_is_login(owl_message *m)
    298 {
    299   char *res;
     297int owl_message_is_login(const owl_message *m)
     298{
     299  const char *res;
    300300
    301301  res=owl_message_get_attribute_value(m, "loginout");
     
    306306
    307307
    308 int owl_message_is_logout(owl_message *m)
    309 {
    310   char *res;
     308int owl_message_is_logout(const owl_message *m)
     309{
     310  const char *res;
    311311
    312312  res=owl_message_get_attribute_value(m, "loginout");
     
    321321}
    322322
    323 int owl_message_is_private(owl_message *m)
    324 {
    325   char *res;
     323int owl_message_is_private(const owl_message *m)
     324{
     325  const char *res;
    326326
    327327  res=owl_message_get_attribute_value(m, "isprivate");
     
    330330}
    331331
    332 char *owl_message_get_timestr(owl_message *m)
     332const char *owl_message_get_timestr(const owl_message *m)
    333333{
    334334  if (m->timestr) return(m->timestr);
     
    356356}
    357357
    358 void owl_message_set_type(owl_message *m, char* type)
     358void owl_message_set_type(owl_message *m, const char* type)
    359359{
    360360  owl_message_set_attribute(m, "type", type);
    361361}
    362362
    363 int owl_message_is_type(owl_message *m, char *type) {
    364   char * t = owl_message_get_attribute_value(m, "type");
     363int owl_message_is_type(const owl_message *m, const char *type) {
     364  const char * t = owl_message_get_attribute_value(m, "type");
    365365  if(!t) return 0;
    366366  return !strcasecmp(t, type);
    367367}
    368368                                               
    369 int owl_message_is_type_admin(owl_message *m)
     369int owl_message_is_type_admin(const owl_message *m)
    370370{
    371371  return owl_message_is_type(m, "admin");
    372372}
    373373
    374 int owl_message_is_type_zephyr(owl_message *m)
     374int owl_message_is_type_zephyr(const owl_message *m)
    375375{
    376376  return owl_message_is_type(m, "zephyr");
    377377}
    378378
    379 int owl_message_is_type_aim(owl_message *m)
     379int owl_message_is_type_aim(const owl_message *m)
    380380{
    381381  return owl_message_is_type(m, "aim");
     
    383383
    384384/* XXX TODO: deprecate this */
    385 int owl_message_is_type_jabber(owl_message *m)
     385int owl_message_is_type_jabber(const owl_message *m)
    386386{
    387387  return owl_message_is_type(m, "jabber");
    388388}
    389389
    390 int owl_message_is_type_loopback(owl_message *m)
     390int owl_message_is_type_loopback(const owl_message *m)
    391391{
    392392  return owl_message_is_type(m, "loopback");
    393393}
    394394
    395 int owl_message_is_pseudo(owl_message *m)
     395int owl_message_is_pseudo(const owl_message *m)
    396396{
    397397  if (owl_message_get_attribute_value(m, "pseudo")) return(1);
     
    399399}
    400400
    401 char *owl_message_get_text(owl_message *m)
     401const char *owl_message_get_text(owl_message *m)
    402402{
    403403  owl_message_format(m);
     
    425425}
    426426
    427 int owl_message_is_direction_in(owl_message *m)
     427int owl_message_is_direction_in(const owl_message *m)
    428428{
    429429  if (m->direction==OWL_MESSAGE_DIRECTION_IN) return(1);
     
    431431}
    432432
    433 int owl_message_is_direction_out(owl_message *m)
     433int owl_message_is_direction_out(const owl_message *m)
    434434{
    435435  if (m->direction==OWL_MESSAGE_DIRECTION_OUT) return(1);
     
    437437}
    438438
    439 int owl_message_is_direction_none(owl_message *m)
     439int owl_message_is_direction_none(const owl_message *m)
    440440{
    441441  if (m->direction==OWL_MESSAGE_DIRECTION_NONE) return(1);
     
    462462}
    463463
    464 char *owl_message_get_zwriteline(owl_message *m)
    465 {
    466   char *z = owl_message_get_attribute_value(m, "zwriteline");
     464const char *owl_message_get_zwriteline(const owl_message *m)
     465{
     466  const char *z = owl_message_get_attribute_value(m, "zwriteline");
    467467  if (!z) return "";
    468468  return z;
    469469}
    470470
    471 void owl_message_set_zwriteline(owl_message *m, char *line)
     471void owl_message_set_zwriteline(owl_message *m, const char *line)
    472472{
    473473  owl_message_set_attribute(m, "zwriteline", line);
    474474}
    475475
    476 int owl_message_is_delete(owl_message *m)
     476int owl_message_is_delete(const owl_message *m)
    477477{
    478478  if (m == NULL) return(0);
     
    482482
    483483#ifdef HAVE_LIBZEPHYR
    484 ZNotice_t *owl_message_get_notice(owl_message *m)
     484const ZNotice_t *owl_message_get_notice(const owl_message *m)
    485485{
    486486  return(&(m->notice));
    487487}
    488488#else
    489 void *owl_message_get_notice(owl_message *m)
     489void *owl_message_get_notice(const owl_message *m)
    490490{
    491491  return(NULL);
     
    493493#endif
    494494
    495 void owl_message_set_hostname(owl_message *m, char *hostname)
     495void owl_message_set_hostname(owl_message *m, const char *hostname)
    496496{
    497497  m->hostname=owl_global_intern(&g, hostname);
    498498}
    499499
    500 char *owl_message_get_hostname(owl_message *m)
     500const char *owl_message_get_hostname(const owl_message *m)
    501501{
    502502  return(m->hostname);
     
    524524}
    525525
    526 int owl_message_is_personal(owl_message *m)
    527 {
    528   owl_filter * f = owl_global_get_filter(&g, "personal");
     526int owl_message_is_personal(const owl_message *m)
     527{
     528  const owl_filter * f = owl_global_get_filter(&g, "personal");
    529529  if(!f) {
    530530      owl_function_error("personal filter is not defined");
     
    534534}
    535535
    536 int owl_message_is_question(owl_message *m)
     536int owl_message_is_question(const owl_message *m)
    537537{
    538538  if(!owl_message_is_type_admin(m)) return 0;
     
    541541}
    542542
    543 int owl_message_is_answered(owl_message *m) {
    544   char *q;
     543int owl_message_is_answered(const owl_message *m) {
     544  const char *q;
    545545  if(!owl_message_is_question(m)) return 0;
    546546  q = owl_message_get_attribute_value(m, "question");
     
    553553}
    554554
    555 int owl_message_is_mail(owl_message *m)
     555int owl_message_is_mail(const owl_message *m)
    556556{
    557557  if (owl_message_is_type_zephyr(m)) {
     
    566566
    567567/* caller must free return value. */
    568 char *owl_message_get_cc(owl_message *m)
    569 {
    570   char *cur, *out, *end;
     568char *owl_message_get_cc(const owl_message *m)
     569{
     570  const char *cur;
     571  char *out, *end;
    571572
    572573  cur = owl_message_get_body(m);
     
    582583
    583584/* caller must free return value */
    584 char *owl_message_get_cc_without_recipient(owl_message *m)
    585 {
    586   char *cc, *out, *end, *user, *shortuser, *recip;
     585char *owl_message_get_cc_without_recipient(const owl_message *m)
     586{
     587  char *cc, *out, *end, *shortuser, *recip;
     588  const char *user;
    587589
    588590  cc = owl_message_get_cc(m);
     
    618620}
    619621
    620 int owl_message_get_id(owl_message *m)
     622int owl_message_get_id(const owl_message *m)
    621623{
    622624  return(m->id);
    623625}
    624626
    625 char *owl_message_get_type(owl_message *m) {
    626   char * type = owl_message_get_attribute_value(m, "type");
     627const char *owl_message_get_type(const owl_message *m) {
     628  const char * type = owl_message_get_attribute_value(m, "type");
    627629  if(!type) {
    628630    return "generic";
     
    631633}
    632634
    633 char *owl_message_get_direction(owl_message *m) {
     635const char *owl_message_get_direction(const owl_message *m) {
    634636  switch (m->direction) {
    635637  case OWL_MESSAGE_DIRECTION_IN:
     
    644646}
    645647
    646 int owl_message_parse_direction(char *d) {
     648int owl_message_parse_direction(const char *d) {
    647649  if(!strcmp(d, "in")) {
    648650    return OWL_MESSAGE_DIRECTION_IN;
     
    655657
    656658
    657 char *owl_message_get_login(owl_message *m) {
     659const char *owl_message_get_login(const owl_message *m) {
    658660  if (owl_message_is_login(m)) {
    659661    return "login";
     
    666668
    667669
    668 char *owl_message_get_header(owl_message *m) {
     670const char *owl_message_get_header(const owl_message *m) {
    669671  return owl_message_get_attribute_value(m, "adminheader");
    670672}
     
    673675 * case insensitive because the functions it uses are
    674676 */
    675 int owl_message_search(owl_message *m, owl_regex *re)
     677int owl_message_search(owl_message *m, const owl_regex *re)
    676678{
    677679
     
    686688 *                 1 it's a login message
    687689 */
    688 void owl_message_create_aim(owl_message *m, char *sender, char *recipient, char *text, int direction, int loginout)
     690void owl_message_create_aim(owl_message *m, const char *sender, const char *recipient, const char *text, int direction, int loginout)
    689691{
    690692  owl_message_init(m);
     
    712714}
    713715
    714 void owl_message_create_admin(owl_message *m, char *header, char *text)
     716void owl_message_create_admin(owl_message *m, const char *header, const char *text)
    715717{
    716718  owl_message_init(m);
     
    721723
    722724/* caller should set the direction */
    723 void owl_message_create_loopback(owl_message *m, char *text)
     725void owl_message_create_loopback(owl_message *m, const char *text)
    724726{
    725727  owl_message_init(m);
     
    732734
    733735#ifdef HAVE_LIBZEPHYR
    734 void owl_message_create_from_znotice(owl_message *m, ZNotice_t *n)
     736void owl_message_create_from_znotice(owl_message *m, const ZNotice_t *n)
    735737{
    736738  struct hostent *hent;
    737   char *ptr, *tmp, *tmp2;
     739  const char *ptr;
     740  char *tmp, *tmp2;
    738741  int len;
    739742
     
    843846}
    844847#else
    845 void owl_message_create_from_znotice(owl_message *m, void *n)
     848void owl_message_create_from_znotice(owl_message *m, const void *n)
    846849{
    847850}
     
    849852
    850853/* If 'direction' is '0' it is a login message, '1' is a logout message. */
    851 void owl_message_create_pseudo_zlogin(owl_message *m, int direction, char *user, char *host, char *time, char *tty)
    852 {
    853   char *longuser, *ptr;
     854void owl_message_create_pseudo_zlogin(owl_message *m, int direction, const char *user, const char *host, const char *time, const char *tty)
     855{
     856  char *longuser;
     857  const char *ptr;
    854858
    855859#ifdef HAVE_LIBZEPHYR
     
    894898}
    895899
    896 void owl_message_create_from_zwriteline(owl_message *m, char *line, char *body, char *zsig)
     900void owl_message_create_from_zwriteline(owl_message *m, const char *line, const char *body, const char *zsig)
    897901{
    898902  owl_zwrite z;
  • messagelist.c

    rd43edd2 r3eb599d  
    99}
    1010
    11 int owl_messagelist_get_size(owl_messagelist *ml)
     11int owl_messagelist_get_size(const owl_messagelist *ml)
    1212{
    1313  return(owl_list_get_size(&(ml->list)));
    1414}
    1515
    16 void *owl_messagelist_get_element(owl_messagelist *ml, int n)
     16void *owl_messagelist_get_element(const owl_messagelist *ml, int n)
    1717{
    1818  return(owl_list_get_element(&(ml->list), n));
    1919}
    2020
    21 owl_message *owl_messagelist_get_by_id(owl_messagelist *ml, int target_id)
     21owl_message *owl_messagelist_get_by_id(const owl_messagelist *ml, int target_id)
    2222{
    2323  /* return the message with id == 'id'.  If it doesn't exist return NULL. */
     
    9090}
    9191
    92 void owl_messagelist_invalidate_formats(owl_messagelist *ml)
     92void owl_messagelist_invalidate_formats(const owl_messagelist *ml)
    9393{
    9494  int i, j;
  • obarray.c

    r4d86e06 rb1d5517  
    1414 * the index it should be inserted at.
    1515 */
    16 int owl_obarray_lookup(owl_obarray *oa, char * key, char ** val) /*noproto*/
     16int owl_obarray_lookup(const owl_obarray *oa, const char * key, const char ** val) /*noproto*/
    1717{
    1818  int first, last, mid;
    19   char * str;
     19  const char * str;
    2020  int cmp;
    2121
     
    4141
    4242/* Returns NULL if the string doesn't exist in the obarray */
    43 char * owl_obarray_find(owl_obarray *oa, char * string)
     43const char * owl_obarray_find(const owl_obarray *oa, const char * string)
    4444{
    45   char *v;
     45  const char *v;
    4646  owl_obarray_lookup(oa, string, &v);
    4747  return v;
     
    4949
    5050/* Inserts the string into the obarray if it doesn't exist */
    51 char * owl_obarray_insert(owl_obarray *oa, char * string)
     51const char * owl_obarray_insert(owl_obarray *oa, const char * string)
    5252{
    53   char *v;
     53  const char *v;
    5454  int i;
    5555  i = owl_obarray_lookup(oa, string, &v);
    5656  if(!v) {
    57     v = owl_strdup(string);
    58     owl_list_insert_element(&(oa->strings), i, v);
     57    char *v2 = owl_strdup(string);
     58    owl_list_insert_element(&(oa->strings), i, v2);
     59    return v2;
    5960  }
    6061  return v;
     
    7677int owl_obarray_regtest(void) {
    7778  int numfailed = 0;
    78   char *p,*p2;
     79  const char *p,*p2;
    7980
    8081  owl_obarray oa;
  • owl.c

    r4d86e06 r4542047  
    4444  int newmsgs, nexttimediff;
    4545  struct sigaction sigact;
    46   char *configfile, *tty, *perlout, *perlerr, **argvsave;
    47   char *confdir;
     46  const char *configfile, *tty, *const *argvsave;
     47  char *perlout, *perlerr;
     48  const char *confdir;
    4849  owl_filter *f;
    49   owl_style *s;
     50  const owl_style *s;
    5051  time_t nexttime, now;
    5152  struct tm *today;
    52   char *dir;
     53  const char *dir;
    5354  struct termios tio;
    5455  owl_message *m;
     
    5859
    5960  argcsave=argc;
    60   argvsave=argv;
     61  argvsave=strs(argv);
    6162  configfile=NULL;
    6263  confdir = NULL;
     
    486487 */
    487488int owl_process_message(owl_message *m) {
    488   owl_filter *f;
     489  const owl_filter *f;
    489490  /* if this message it on the puntlist, nuke it and continue */
    490491  if (owl_global_message_is_puntable(&g, m)) {
  • owl.h

    r41c9a96 rafa200a  
    194194#define LINE 2048
    195195
     196#ifdef HAVE_LIBZEPHYR
     197/* libzephyr doesn't use const, so we appease the type system with this cast. */
     198static inline char *zstr(const char *str)
     199{
     200  return (char *)str;
     201}
     202#endif
     203
     204/* Convert char *const * into const char *const *.  This conversion is safe,
     205 * and implicit in C++ (conv.qual 4) but for some reason not in C. */
     206static inline const char *const *strs(char *const *pstr)
     207{
     208  return (const char *const *)pstr;
     209}
     210
    196211typedef struct _owl_variable {
    197212  char *name;
     
    203218  char *description;            /* detailed description */
    204219  void *val;                    /* current value */
    205   int  (*validate_fn)(struct _owl_variable *v, void *newval);
     220  int  (*validate_fn)(const struct _owl_variable *v, const void *newval);
    206221                                /* returns 1 if newval is valid */
    207   int  (*set_fn)(struct _owl_variable *v, void *newval);
     222  int  (*set_fn)(struct _owl_variable *v, const void *newval);
    208223                                /* sets the variable to a value
    209224                                 * of the appropriate type.
     
    211226                                 * should make a copy.
    212227                                 * returns 0 on success. */
    213   int  (*set_fromstring_fn)(struct _owl_variable *v, char *newval);
     228  int  (*set_fromstring_fn)(struct _owl_variable *v, const char *newval);
    214229                                /* sets the variable to a value
    215230                                 * of the appropriate type.
     
    217232                                 * should make a copy.
    218233                                 * returns 0 on success. */
    219   void *(*get_fn)(struct _owl_variable *v);
     234  const void *(*get_fn)(const struct _owl_variable *v);
    220235                                /* returns a reference to the current value.
    221236                                 * WARNING:  this approach is hard to make
    222237                                 * thread-safe... */
    223   int  (*get_tostring_fn)(struct _owl_variable *v,
    224                           char *buf, int bufsize, void *val);
     238  int  (*get_tostring_fn)(const struct _owl_variable *v,
     239                          char *buf, int bufsize, const void *val);
    225240                                /* converts val to a string
    226241                                 * and puts into buf */
     
    284299 
    285300  /* These don't take any context */
    286   char *(*cmd_args_fn)(int argc, char **argv, char *buff); 
     301  char *(*cmd_args_fn)(int argc, const char *const *argv, const char *buff); 
    287302                                /* takes argv and the full command as buff.
    288303                                 * caller must free return value if !NULL */
     
    291306
    292307  /* The following also take the active context if it's valid */
    293   char *(*cmd_ctxargs_fn)(void *ctx, int argc, char **argv, char *buff); 
     308  char *(*cmd_ctxargs_fn)(void *ctx, int argc, const char *const *argv, const char *buff); 
    294309                                /* takes argv and the full command as buff.
    295310                                 * caller must free return value if !NULL */
     
    313328
    314329typedef struct _owl_pair {
    315   char *key;
     330  const char *key;
    316331  char *value;
    317332} owl_pair;
     
    327342  struct _owl_fmtext_cache * fmtext;
    328343  int delete;
    329   char *hostname;
     344  const char *hostname;
    330345  owl_list attributes;            /* this is a list of pairs */
    331346  char *timestr;
     
    383398
    384399typedef struct _owl_filterelement {
    385   int (*match_message)(struct _owl_filterelement *fe, owl_message *m);
     400  int (*match_message)(const struct _owl_filterelement *fe, const owl_message *m);
    386401  /* Append a string representation of the filterelement onto buf*/
    387   void (*print_elt)(struct _owl_filterelement *fe, GString *buf);
     402  void (*print_elt)(const struct _owl_filterelement *fe, GString *buf);
    388403  /* Operands for and,or,not*/
    389404  struct _owl_filterelement *left, *right;
     
    406421  owl_filter *filter;
    407422  owl_messagelist ml;
    408   owl_style *style;
     423  const owl_style *style;
    409424} owl_view;
    410425
     
    433448  char     *desc;               /* description */
    434449  owl_list  bindings;           /* key bindings */
    435   struct _owl_keymap *submap;   /* submap */
     450  const struct _owl_keymap *submap;     /* submap */
    436451  void (*default_fn)(owl_input j);      /* default action (takes a keypress) */
    437452  void (*prealways_fn)(owl_input  j);   /* always called before a keypress is received */
     
    441456typedef struct _owl_keyhandler {
    442457  owl_dict  keymaps;            /* dictionary of keymaps */
    443   owl_keymap *active;           /* currently active keymap */
     458  const owl_keymap *active;             /* currently active keymap */
    444459  int       in_esc;             /* escape pressed? */
    445460  int       kpstack[OWL_KEYMAP_MAXSTACK+1]; /* current stack of keypresses */
  • pair.c

    rde1c8a5 r25fb825  
    11#include "owl.h"
    22
    3 void owl_pair_create(owl_pair *p, char *key, char *value) {
     3void owl_pair_create(owl_pair *p, const char *key, char *value) {
    44  p->key=key;
    55  p->value=value;
    66}
    77
    8 void owl_pair_set_key(owl_pair *p, char *key) {
     8void owl_pair_set_key(owl_pair *p, const char *key) {
    99  p->key=key;
    1010}
     
    1414}
    1515
    16 char *owl_pair_get_key(owl_pair *p) {
     16const char *owl_pair_get_key(const owl_pair *p) {
    1717  return(p->key);
    1818}
    1919
    20 char *owl_pair_get_value(owl_pair *p) {
     20char *owl_pair_get_value(const owl_pair *p) {
    2121  return(p->value);
    2222}
  • perlconfig.c

    rf12d199 r9e5c9f3  
    1414static void owl_perl_xs_init(pTHX)
    1515{
    16   char *file = __FILE__;
     16  const char *file = __FILE__;
    1717  dXSUB_SYS;
    1818  {
     
    2222}
    2323
    24 SV *owl_perlconfig_message2hashref(owl_message *m)
     24SV *owl_perlconfig_message2hashref(const owl_message *m)
    2525{
    2626  HV *h, *stash;
    2727  SV *hr;
    28   char *ptr, *blessas, *type;
     28  const char *type;
     29  char *ptr, *utype, *blessas;
    2930  int i, j;
    30   owl_pair *pair;
    31   owl_filter *wrap;
     31  const owl_pair *pair;
     32  const owl_filter *wrap;
    3233
    3334  if (!m) return &PL_sv_undef;
     
    9596  type = owl_message_get_type(m);
    9697  if(!type || !*type) type = "generic";
    97   type = owl_strdup(type);
    98   type[0] = toupper(type[0]);
    99   blessas = owl_sprintf("BarnOwl::Message::%s", type);
     98  utype = owl_strdup(type);
     99  utype[0] = toupper(type[0]);
     100  blessas = owl_sprintf("BarnOwl::Message::%s", utype);
    100101
    101102  hr = newRV_noinc((SV*)h);
     
    106107  }
    107108  hr = sv_bless(hr,stash);
    108   owl_free(type);
     109  owl_free(utype);
    109110  owl_free(blessas);
    110111  return hr;
     
    114115{
    115116  int curmsg;
    116   owl_view *v;
     117  const owl_view *v;
    117118  v=owl_global_get_current_view(&g);
    118119  if (owl_view_get_size(v) < 1) {
     
    134135  HE * ent;
    135136  I32 count, len;
    136   char *key,*val;
     137  const char *key,*val;
    137138  HV * hash;
    138139  struct tm tm;
     
    179180    n->z_auth = ZAUTH_NO;
    180181    n->z_checked_auth = 0;
    181     n->z_class = owl_message_get_class(m);
    182     n->z_class_inst = owl_message_get_instance(m);
    183     n->z_opcode = owl_message_get_opcode(m);
    184     n->z_sender = owl_message_get_sender(m);
    185     n->z_recipient = owl_message_get_recipient(m);
    186     n->z_default_format = "[zephyr created from perl]";
    187     n->z_multinotice = "[zephyr created from perl]";
     182    n->z_class = zstr(owl_message_get_class(m));
     183    n->z_class_inst = zstr(owl_message_get_instance(m));
     184    n->z_opcode = zstr(owl_message_get_opcode(m));
     185    n->z_sender = zstr(owl_message_get_sender(m));
     186    n->z_recipient = zstr(owl_message_get_recipient(m));
     187    n->z_default_format = zstr("[zephyr created from perl]");
     188    n->z_multinotice = zstr("[zephyr created from perl]");
    188189    n->z_num_other_fields = 0;
    189190    n->z_message = owl_sprintf("%s%c%s", owl_message_get_zsig(m), '\0', owl_message_get_body(m));
     
    196197/* Calls in a scalar context, passing it a hash reference.
    197198   If return value is non-null, caller must free. */
    198 char *owl_perlconfig_call_with_message(char *subname, owl_message *m)
     199char *owl_perlconfig_call_with_message(const char *subname, const owl_message *m)
    199200{
    200201  dSP ;
     
    245246   If the return value is non-null, the caller must free it.
    246247 */
    247 char * owl_perlconfig_message_call_method(owl_message *m, char *method, int argc, char ** argv)
     248char * owl_perlconfig_message_call_method(const owl_message *m, const char *method, int argc, const char ** argv)
    248249{
    249250  dSP;
     
    295296
    296297
    297 char *owl_perlconfig_initperl(char * file, int *Pargc, char ***Pargv, char *** Penv)
     298char *owl_perlconfig_initperl(const char * file, int *Pargc, char ***Pargv, char *** Penv)
    298299{
    299300  int ret;
    300301  PerlInterpreter *p;
    301302  char *err;
    302   char *args[4] = {"", "-e", "0;", NULL};
     303  const char *args[4] = {"", "-e", "0;", NULL};
    303304  AV *inc;
    304305  char *path;
     
    312313  owl_global_set_no_have_config(&g);
    313314
    314   ret=perl_parse(p, owl_perl_xs_init, 2, args, NULL);
     315  ret=perl_parse(p, owl_perl_xs_init, 2, (char **)args, NULL);
    315316  if (ret || SvTRUE(ERRSV)) {
    316317    err=owl_strdup(SvPV_nolen(ERRSV));
     
    371372
    372373/* returns whether or not a function exists */
    373 int owl_perlconfig_is_function(char *fn) {
     374int owl_perlconfig_is_function(const char *fn) {
    374375  if (get_cv(fn, FALSE)) return(1);
    375376  else return(0);
     
    377378
    378379/* caller is responsible for freeing returned string */
    379 char *owl_perlconfig_execute(char *line)
     380char *owl_perlconfig_execute(const char *line)
    380381{
    381382  STRLEN len;
    382383  SV *response;
    383   char *out, *preout;
     384  const char *preout;
     385  char *out;
    384386
    385387  if (!owl_global_have_config(&g)) return NULL;
     
    406408}
    407409
    408 void owl_perlconfig_getmsg(owl_message *m, char *subname)
     410void owl_perlconfig_getmsg(const owl_message *m, const char *subname)
    409411{
    410412  char *ptr = NULL;
     
    417419
    418420/* Called on all new messages; receivemsg is only called on incoming ones */
    419 void owl_perlconfig_newmsg(owl_message *m, char *subname)
     421void owl_perlconfig_newmsg(const owl_message *m, const char *subname)
    420422{
    421423  char *ptr = NULL;
     
    427429}
    428430
    429 void owl_perlconfig_new_command(char *name)
     431void owl_perlconfig_new_command(const char *name)
    430432{
    431433  dSP;
     
    450452}
    451453
    452 char *owl_perlconfig_perlcmd(owl_cmd *cmd, int argc, char **argv)
     454char *owl_perlconfig_perlcmd(const owl_cmd *cmd, int argc, const char *const *argv)
    453455{
    454456  int i, count;
  • perlglue.xs

    r3ff3d86 r4542047  
    3232char *
    3333command(cmd, ...)
    34         char *cmd
     34        const char *cmd
    3535        PREINIT:
    3636                char *rv = NULL;
    37                 char **argv;
     37                const char **argv;
    3838                int i;
    3939        CODE:
     
    8585                RETVAL
    8686
    87 char *
     87const char *
    8888zephyr_getsender()
    8989        CODE:
     
    9494void
    9595zephyr_zwrite(cmd,msg)
    96         char *cmd
    97         char *msg
     96        const char *cmd
     97        const char *msg
    9898        PREINIT:
    9999                int i;
     
    103103char *
    104104ztext_stylestrip(ztext)
    105         char *ztext
     105        const char *ztext
    106106        PREINIT:
    107107                char *rv = NULL;
     
    116116char *
    117117zephyr_smartstrip_user(in)
    118         char *in
     118        const char *in
    119119        PREINIT:
    120120                char *rv = NULL;
     
    157157
    158158void admin_message(header, body)
    159         char *header
    160         char *body
     159        const char *header
     160        const char *body
    161161        CODE:
    162162        {
     
    165165
    166166void start_question(line, callback)
    167         char *line
     167        const char *line
    168168        SV *callback
    169169        PREINIT:
     
    181181
    182182void start_password(line, callback)
    183         char *line
     183        const char *line
    184184        SV *callback
    185185        PREINIT:
     
    197197
    198198void start_edit_win(line, callback)
    199         char *line
     199        const char *line
    200200        SV *callback
    201201        PREINIT:
     
    223223
    224224
    225 char *
     225const char *
    226226get_data_dir ()
    227227        CODE:
     
    230230        RETVAL
    231231
    232 char *
     232const char *
    233233get_config_dir ()
    234234        CODE:
     
    239239void
    240240popless_text(text)
    241         char *text
     241        const char *text
    242242        CODE:
    243243        {
     
    247247void
    248248popless_ztext(text)
    249         char *text
     249        const char *text
    250250        CODE:
    251251        {
     
    259259void
    260260error(text)
    261         char *text
     261        const char *text
    262262        CODE:
    263263        {
     
    267267void
    268268debug(text)
    269         char *text
     269        const char *text
    270270        CODE:
    271271        {
     
    275275void
    276276message(text)
    277         char *text
     277        const char *text
    278278        CODE:
    279279        {
     
    283283void
    284284create_style(name, object)
    285      char *name
     285     const char *name
    286286     SV  *object
    287287     PREINIT:
     
    303303void
    304304_remove_filter(filterName)
    305         char *filterName
     305        const char *filterName
    306306        CODE:
    307307        {
     
    315315char *
    316316wordwrap(in, cols)
    317         char *in
     317        const char *in
    318318        int cols
    319319        PREINIT:
     
    346346        PREINIT:
    347347                AV *filters;
    348                 owl_list *fl;
    349                 owl_filter *f;
     348                const owl_list *fl;
     349                const owl_filter *f;
    350350                int i;
    351351        CODE:
     
    368368                AV *styles;
    369369                owl_list l;
    370                 char *name;
     370                const char *name;
    371371                int i;
    372372        CODE:
     
    393393                AV *vars;
    394394                owl_list l;
    395                 char *name;
     395                const char *name;
    396396                int i;
    397397        CODE:
     
    448448void
    449449new_variable_string(name, ival, summ, desc)
    450         char * name
    451         char * ival
    452         char * summ
    453         char * desc
     450        const char * name
     451        const char * ival
     452        const char * summ
     453        const char * desc
    454454        CODE:
    455455        owl_variable_dict_newvar_string(owl_global_get_vardict(&g),
     
    461461void
    462462new_variable_int(name, ival, summ, desc)
    463         char * name
     463        const char * name
    464464        int ival
    465         char * summ
    466         char * desc
     465        const char * summ
     466        const char * desc
    467467        CODE:
    468468        owl_variable_dict_newvar_int(owl_global_get_vardict(&g),
     
    474474void
    475475new_variable_bool(name, ival, summ, desc)
    476         char * name
     476        const char * name
    477477        int ival
    478         char * summ
    479         char * desc
     478        const char * summ
     479        const char * desc
    480480        CODE:
    481481        owl_variable_dict_newvar_bool(owl_global_get_vardict(&g),
     
    520520replace(count, string)
    521521        int count;
    522         char *string;
     522        const char *string;
    523523        CODE:
    524524                RETVAL = owl_editwin_replace(owl_global_get_typwin(&g), count, string);
     
    536536int
    537537replace_region(string)
    538         char *string;
     538        const char *string;
    539539        CODE:
    540540                RETVAL = owl_editwin_replace_region(owl_global_get_typwin(&g), string);
  • popexec.c

    r4d86e06 re19eb97  
    99
    1010/* starts up popexec in a new viewwin */
    11 owl_popexec *owl_popexec_new(char *command)
     11owl_popexec *owl_popexec_new(const char *command)
    1212{
    1313  owl_popexec *pe;
     
    6161  } else {
    6262    /* in the child process */
    63     char *argv[4];
    6463    int i;
    6564    int fdlimit = sysconf(_SC_OPEN_MAX);
     
    7271    close(child_write_fd);
    7372
    74     argv[0] = "sh";
    75     argv[1] = "-c";
    76     argv[2] = command;
    77     argv[3] = 0;
    78     execv("/bin/sh", argv);
     73    execl("/bin/sh", "sh", "-c", command, (const char *)NULL);
    7974    _exit(127);
    8075  }
  • popwin.c

    rd43edd2 r9c01a5e  
    6666}
    6767
    68 int owl_popwin_is_active(owl_popwin *pw)
     68int owl_popwin_is_active(const owl_popwin *pw)
    6969{
    7070  if (pw->active==1) return(1);
     
    7373
    7474/* this will refresh the border as well as the text area */
    75 int owl_popwin_refresh(owl_popwin *pw)
     75int owl_popwin_refresh(const owl_popwin *pw)
    7676{
    7777  touchwin(pw->borderwin);
     
    8484}
    8585
    86 WINDOW *owl_popwin_get_curswin(owl_popwin *pw)
     86WINDOW *owl_popwin_get_curswin(const owl_popwin *pw)
    8787{
    8888  return(pw->popwin);
    8989}
    9090
    91 int owl_popwin_get_lines(owl_popwin *pw)
     91int owl_popwin_get_lines(const owl_popwin *pw)
    9292{
    9393  return(pw->lines-2);
    9494}
    9595
    96 int owl_popwin_get_cols(owl_popwin *pw)
     96int owl_popwin_get_cols(const owl_popwin *pw)
    9797{
    9898  return(pw->cols-2);
    9999}
    100100
    101 int owl_popwin_needs_first_refresh(owl_popwin *pw)
     101int owl_popwin_needs_first_refresh(const owl_popwin *pw)
    102102{
    103103  if (pw->needsfirstrefresh) return(1);
  • regex.c

    r41c9a96 r89b2daf  
    88}
    99
    10 int owl_regex_create(owl_regex *re, char *string)
     10int owl_regex_create(owl_regex *re, const char *string)
    1111{
    1212  int ret;
    1313  char buff1[LINE];
    14   char *ptr;
     14  const char *ptr;
    1515 
    1616  re->string=owl_strdup(string);
     
    3636}
    3737
    38 int owl_regex_create_quoted(owl_regex *re, char *string)
     38int owl_regex_create_quoted(owl_regex *re, const char *string)
    3939{
    4040  char *quoted;
     
    4646}
    4747
    48 int owl_regex_compare(owl_regex *re, char *string, int *start, int *end)
     48int owl_regex_compare(const owl_regex *re, const char *string, int *start, int *end)
    4949{
    5050  int out, ret;
     
    6868}
    6969
    70 int owl_regex_is_set(owl_regex *re)
     70int owl_regex_is_set(const owl_regex *re)
    7171{
    7272  if (re->string) return(1);
     
    7474}
    7575
    76 char *owl_regex_get_string(owl_regex *re)
     76const char *owl_regex_get_string(const owl_regex *re)
    7777{
    7878  return(re->string);
    7979}
    8080
    81 void owl_regex_copy(owl_regex *a, owl_regex *b)
     81void owl_regex_copy(const owl_regex *a, owl_regex *b)
    8282{
    8383  owl_regex_create(b, a->string);
  • select.c

    r4d86e06 r6249e137  
    33static int dispatch_active = 0;
    44
    5 int _owl_select_timer_cmp(owl_timer *t1, owl_timer *t2) {
     5int _owl_select_timer_cmp(const owl_timer *t1, const owl_timer *t2) {
    66  return t1->time - t2->time;
    77}
    88
    9 int _owl_select_timer_eq(owl_timer *t1, owl_timer *t2) {
     9int _owl_select_timer_eq(const owl_timer *t1, const owl_timer *t2) {
    1010  return t1 == t2;
    1111}
     
    8484{
    8585  int i, len;
    86   owl_list *dl;
    87   owl_dispatch *d;
     86  const owl_list *dl;
     87  const owl_dispatch *d;
    8888 
    8989  dl = owl_global_get_dispatchlist(&g);
     
    199199  int i, len, max_fd;
    200200  owl_dispatch *d;
    201   owl_list *dl;
     201  const owl_list *dl;
    202202
    203203  dl = owl_global_get_dispatchlist(&g);
     
    226226   */
    227227  for(i = owl_list_get_size(dl) - 1; i >= 0; i--) {
    228     owl_dispatch *d = owl_list_get_element(dl, i);
     228    const owl_dispatch *d = owl_list_get_element(dl, i);
    229229    if(d->needs_gc) {
    230230      owl_select_remove_dispatch_at(i);
     
    237237  int i, len;
    238238  owl_dispatch *d;
    239   owl_list *dl;
     239  const owl_list *dl;
    240240
    241241  dl = owl_global_get_dispatchlist(&g);
  • stubgen.pl

    r1aee7d9 r8742840  
    2525        print "void owl_global_set_${altvarname}_off(owl_global *g) {\n";
    2626        print "  owl_variable_set_bool_off(&g->vars, \"$varname\");\n}\n";
    27         print "int owl_global_is_$altvarname(owl_global *g) {\n";
     27        print "int owl_global_is_$altvarname(const owl_global *g) {\n";
    2828        print "  return owl_variable_get_bool(&g->vars, \"$varname\");\n}\n";
    2929    } elsif ($vartype =~ /^PATH/ or $vartype =~ /^STRING/) {
    30         print "void owl_global_set_$altvarname(owl_global *g, char *text) {\n";
     30        print "void owl_global_set_$altvarname(owl_global *g, const char *text) {\n";
    3131        print "  owl_variable_set_string(&g->vars, \"$varname\", text);\n}\n";
    32         print "char *owl_global_get_$altvarname(owl_global *g) {\n";
     32        print "const char *owl_global_get_$altvarname(const owl_global *g) {\n";
    3333        print "  return owl_variable_get_string(&g->vars, \"$varname\");\n}\n";
    3434    } elsif ($vartype =~ /^INT/ or $vartype =~ /^ENUM/) {
    3535        print "void owl_global_set_$altvarname(owl_global *g, int n) {\n";
    3636        print "  owl_variable_set_int(&g->vars, \"$varname\", n);\n}\n";
    37         print "int owl_global_get_$altvarname(owl_global *g) {\n";
     37        print "int owl_global_get_$altvarname(const owl_global *g) {\n";
    3838        print "  return owl_variable_get_int(&g->vars, \"$varname\");\n}\n";
    3939    }
  • style.c

    rd43edd2 r1fdab04  
    22#include "owl.h"
    33
    4 void owl_style_create_perl(owl_style *s, char *name, SV *obj)
     4void owl_style_create_perl(owl_style *s, const char *name, SV *obj)
    55{
    66  s->name=owl_strdup(name);
     
    88}
    99
    10 int owl_style_matches_name(owl_style *s, char *name)
     10int owl_style_matches_name(const owl_style *s, const char *name)
    1111{
    1212  if (!strcmp(s->name, name)) return(1);
     
    1414}
    1515
    16 char *owl_style_get_name(owl_style *s)
     16const char *owl_style_get_name(const owl_style *s)
    1717{
    1818  return(s->name);
    1919}
    2020
    21 char *owl_style_get_description(owl_style *s)
     21const char *owl_style_get_description(const owl_style *s)
    2222{
    2323  SV *sv = NULL;
     
    3939 * 'fm' should already be be initialzed
    4040 */
    41 void owl_style_get_formattext(owl_style *s, owl_fmtext *fm, owl_message *m)
     41void owl_style_get_formattext(const owl_style *s, owl_fmtext *fm, const owl_message *m)
    4242{
    43   char *body, *indent;
     43  const char *body;
     44  char *indent;
    4445  int curlen;
    4546
     
    7879}
    7980
    80 int owl_style_validate(owl_style *s) {
     81int owl_style_validate(const owl_style *s) {
    8182  if (!s || !s->perlobj || !SvOK(s->perlobj)) {
    8283    return -1;